commit 252dac314399e3727aa28b13d4ef9e86bbb05123 Author: Siwat Sirichai Date: Sun Jun 8 16:22:20 2025 +0700 initial commit diff --git a/.vs/Persons/config/applicationhost.config b/.vs/Persons/config/applicationhost.config new file mode 100644 index 0000000..860e194 --- /dev/null +++ b/.vs/Persons/config/applicationhost.config @@ -0,0 +1,1033 @@ + + + + + + + +
+
+
+
+
+
+
+
+ + + +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ +
+
+ +
+
+
+
+
+
+ +
+
+
+
+
+ +
+
+
+ +
+
+ +
+
+ +
+
+
+ + +
+
+
+
+
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/.vs/Persons/v16/.suo b/.vs/Persons/v16/.suo new file mode 100644 index 0000000..845b292 Binary files /dev/null and b/.vs/Persons/v16/.suo differ diff --git a/AppInfo.xml b/AppInfo.xml new file mode 100644 index 0000000..3d6b2e6 --- /dev/null +++ b/AppInfo.xml @@ -0,0 +1,25396 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Menu and Related Options + These options only apply to new (future) applications when they are created. Click "Apply as Defaults..." to set options for future applications. + + Web Page Controls + These settings govern the generation and display of navigation menu controls on pages. + + + + + + + + + Mobile Page Controls + These settings govern the generation and display of navigation menu controls on pages. + + + Formatting + Options controlling formatting for mobile pages. + + + + + + New Page and Charts Options + These options apply to new pages when they are created. + + Web Page Options + These options apply to new pages when they are created. + + Pages to Create + The Application Wizard will automatically create these pages for the database tables and views you select. + + Data Entry Forms + Creates Data Entry pages for each table, view or custom query selected in the Application Wizard. + + + + + + Creates Reports pages for each table, view or custom query selected in the Application Wizard. + + + + + + + + + + + + Workflow + Creates Workflow pages for each table, view or custom query selected in the Application Wizard. + + + + + + + + Data Entry Forms + Creates Data Entry pages for each table, view or custom query selected in the Application Wizard. + + Add Record + These settings govern the generation and display of Add Record pages. + + Page Options + Add these controls to appropriate pages. + + + + + + + + + Edit Record + These settings govern the generation and display of Edit Record. + + Page Options + Add these controls to appropriate pages. + + + + + + + + + Edit Table + These controls govern the generation and display of Edit Table pages. + + Page Options + Add these controls to appropriate pages. + + + + + + + Creates Report pages for each table, view or custom query selected in the Application Wizard. + + Gallery + These settings govern the generation and display of Gallery pages. + + + + Enhanced + These settings govern the generation and display of Enhanced Show Table pages. + + Page Options + Add these controls to appropriate pages. + + + + + + + + Enhanced with Detail below + These settings govern the generation and display of Show Table - detail table below pages. (Unrestricted Iron Speed Designer.) + + Page Options + Add these controls to appropriate pages. + + + + + + + + Group By + These settings govern the generation and display of Group By Table pages. + + Page Options + Add these controls to appropriate pages. + + + + + + + + Basic + These settings govern the generation and display of Basic Show Table pages. + + + + Emailable-Printable + Creates Emailable-Printable table pages for each table, view or custom query selected in the Application Wizard. (Unrestricted Iron Speed Designer.) + + + + Search and Show + These settings govern the generation and display of Search and Show Table pages. (Unrestricted Iron Speed Designer.) + + + + Record + These settings govern the generation and display of Show Record pages. + + Page Options + Add these controls to appropriate pages. + + + + + + + + Emailable-Printable Record + These settings govern the generation and display of Emailable-Printable Record pages. (Unrestricted Iron Speed Designer.) + + Page Options + Add these controls to appropriate pages. + + + + + + + + + Workflow + Creates Workflow pages for each table, view or custom query selected in the Application Wizard. + + Search and Edit Record + These settings govern the generation and display of Search and Edit Record pages. (Unrestricted Iron Speed Designer.) + + Page Options + Add these controls to appropriate pages. + + + + + + + + + Search and Show Record + These settings govern the generation and display of Search and Show Record pages. (Unrestricted Iron Speed Designer.) + + Page Options + Add these controls to appropriate pages. + + + + + + + + Select and Edit Record + These settings govern the generation and display of Select and Edit Record pages. (Unrestricted Iron Speed Designer.) + + Page Options + Add these controls to appropriate pages. + + + + + + + + + Select and Show Record + These settings govern the generation and display of Select and Show Record pages. (Unrestricted Iron Speed Designer.) + + Page Options + Add these controls to appropriate pages. + + + + + + + + + Charts + These settings govern the Charts visualization (Unrestricted Iron Speed Designer.) + + + + Title + Specifies the Title settings for the charts. + + + + + + Display + Indicates properties to display data values on bars or lines. + + + + + + + Labels + Indicates display properties of the labels for the chart + + + + + Inside Table Row + Specifies settings for charts present inside table rows. + + + + + Outside Table Rows + Specifies settings for charts present outside table rows. + + + + + + SharePoint + Options for SharePoint applications. + + Master Pages + Options controlling SharePoint master page creation. + + + + + + + + + + + Mobile Page Options + These options apply to new pages when they are created. + + Pages to Create + Creates Data Entry pages for each table, view or custom query selected in the Application Wizard. + + + + + + + Data Entry Forms + Creates Mobile pages for each table, view or custom query selected in the Application Wizard. + + Add Record Mobile + These settings govern the generation and display of Add Record pages (Unrestricted Iron Speed Designer.) + + + + Edit Record Mobile + These settings govern the generation and display of Edit Record (Unrestricted Iron Speed Designer.) + + + + + Reports + Creates Mobile pages for each table, view or custom query selected in the Application Wizard. + + Report Mobile + These settings govern the generation and display of Basic Show Table pages (Unrestricted Iron Speed Designer.) + + + + Record Mobile + These settings govern the generation and display of Show Record pages (Unrestricted Iron Speed Designer.) + + Page Options + Add these controls to appropriate pages. + + + + + + + + + Charts + These settings govern the Charts visualization (Unrestricted Iron Speed Designer.) + + + + Title + Specifies the Title settings for the charts. + + + + + + Display + Indicates properties to display data values on bars or lines. + + + + + + + Labels + Indicates display properties of the labels for the chart + + + + + Inside Table Rows + Specifies settings for charts present inside table rows. + + + + + Outside Table Rows + Specifies settings for charts present outside table rows. + + + + + + + Common Page Options + These options apply to new web or mobile pages when they are created. + + + + + + + Master Pages + Options controlling master page creation. + + + + + General Application Options + These options apply globally to your application and take effect when you next rebuild your application. + + Web Page Options + These options apply to the pages when you next rebuild your application. + + Page Header + Add these controls to the page header. + + + Upper Tool Bar + Add these controls to the upper right corner of pages. + + + + + + + + + Page Controls + These settings govern the generation and display of various page controls. + + + + + + Maximum width for images + These settings governs the maximum width of the image, inside and outside tables rows + + + + + + + Large List Selector Controls + These settings govern the generation and display of large list selector controls for list box fields. + + + + + Pop-up Text Controls + These settings govern the generation and display of pop-up controls for large text fields. + + + + + Pop-up Image Controls + These settings govern the generation and display of pop-up controls for image fields. + + + + + Rich Text Editor Controls + These settings govern the use of rich text editor controls. + + + + Record Controls + Controls rich text editor settings when used within record panels. + + + + + Table Controls (Field Labels Inside Table Rows) + Controls rich text editor settings when used within table panels. Applies to Modern Page Styles with field labels Inside Table Rows. + + + + + Table Controls (Field Labels Above Column) + Controls rich text editor settings when used within table panels. Applies to Classic Page Styles and Modern Pages Styles with field labels Above Column. + + + + + + Data Export + These settings govern the maximum Microsoft Excel or CSV rows that can be exported. + + + + + Mobile Page Options + These options apply to pages when you next rebuild your application. (Unrestricted Iron Speed Designer.) + + Page Header + Add these controls to the StartMobile page header. + + Upper Tool Bar + Add these controls to the StartMobile page header area. + + + + + + + + + Page Controls + These settings govern the generation and display of various page controls. + + + + + + Maximum width for images + These settings governs the maximum width of the image, inside and outside table rows + + + + + + Rich Text Editor Controls + These settings govern the use of rich text editor controls. + + + + Record Controls + Controls rich text editor settings when used within record panels. + + + + + Table Controls + Controls rich text editor settings when used within table panels. + + + + + + + Sign-in page + These settings govern the generation and display of controls on the Sign-In page. + + + + + + Charts + These settings govern the Charts visualization (Unrestricted Iron Speed Designer.) + + + + + + Fonts + Fonts properties for the Chart Control + + + + + + Web Text Controls + These settings govern the generation and display of pop-up controls for large text fields. + + + + + + Mobile Text Controls + These settings govern the generation and display of pop-up controls for large text fields. + + + + Search Controls + These settings govern the generation and display of search controls. + + + + + + + + + + Security + These settings govern the application security. + + + + ROI Calculation + These settings govern the ROI calculations + + + + + + + + AddRec_DTB_Child + AddRec_DTB_Child + Add Table + Add table node on the related panels section. + EditTable + AddRec_DTB_Child + EditRec_DTB_Child + SearchEditRec_EDTB_Child + SelectEditRec_EDTB_Child + + + EditRec_DTB_Child + EditRec_DTB_Child + Edit Table + Edit table node on the related panels section. + EditTable + AddRec_DTB_Child + EditRec_DTB_Child + SearchEditRec_EDTB_Child + SelectEditRec_EDTB_Child + + + TableTable_DSepRow_Child + TableTable_DSepRow_Child + Basic + Show table node on the related panels section. + ShowTable + SearchShowTable + TableTable_DSameR_Parent + TableTable_DSameR_Child + TableTable_DSepRow_Parent + TableTable_DSepRow_Child + RecInTable_RISameR_Parent + RecInTable_RISepR_Parent + RecInTable_RISepC_Parent + ShowTable_DTB_Parent + ShowTable_DTB_Child + ShowRec_DTB_Child + SearchShowRec_DTB_Child + SelectShowRec_DTB_Child + WebReport + EmailTable + PrintTable + EmailRec_Child + PrintRec_Child + ShowGallery + + + EmailRec_Child + EmailRec_Child + Emailable-Printable + Email table node on the related panels section. + ShowTable + SearchShowTable + TableTable_DSameR_Parent + TableTable_DSameR_Child + TableTable_DSepRow_Parent + TableTable_DSepRow_Child + RecInTable_RISameR_Parent + RecInTable_RISepR_Parent + RecInTable_RISepC_Parent + ShowTable_DTB_Parent + ShowTable_DTB_Child + ShowRec_DTB_Child + SearchShowRec_DTB_Child + SelectShowRec_DTB_Child + WebReport + EmailTable + PrintTable + EmailRec_Child + PrintRec_Child + + + AddRec_DTB_Parent + AddRec_DTB_Parent + Add Record + Add record node on the related panels section. + AddRec_DTB_Parent + + + EditRec_DTB_Parent + EditRec_DTB_Parent + Edit Record + Edit record node on the related panels section. + EditRec_DTB_Parent + SelectShowRec_EDRS_Child + + + RecInTable_RISepC_Child + RecInTable_RISepC_Child + Record + Show record node on the related panels section. + RecInTable_RISameR_Child + RecInTable_RISepR_Child + RecInTable_RISepC_Child + ShowRec_DTB_Parent + SelectShowRec_DRS_Child + EmailRec_Parent + PrintRec_Parent + + + EmailRec_Parent + EmailRec_Parent + Emailable-Printable Record + Email record node on the related panels section. + RecInTable_RISameR_Child + RecInTable_RISepR_Child + RecInTable_RISepC_Child + ShowRec_DTB_Parent + SelectShowRec_DRS_Child + EmailRec_Parent + PrintRec_Parent + + + SearchShowRec_DTB_Parent + SearchShowRec_DTB_Parent + Search and Show Record + Search and show record node on the unrelated panels section. + SearchShowRec_DTB_Parent + SelectShowRec_DTB_Parent + SelectShowRec_DRS_Parent + SelectShowRec_EDRS_Parent + + + SearchEditRec_EDTB_Parent + SearchEditRec_EDTB_Parent + Search and Edit Record + Search and edit record node on the unrelated panels section. + SearchEditRec_EDTB_Parent + SelectEditRec_EDTB_Parent + + + SelectShowRec_DTB_Parent + SelectShowRec_DTB_Parent + Select and Show Record + Select and show record node on the unrelated panels section. + SearchShowRec_DTB_Parent + SelectShowRec_DTB_Parent + SelectShowRec_DRS_Parent + SelectShowRec_EDRS_Parent + + + SelectEditRec_EDTB_Parent + SelectEditRec_EDTB_Parent + Select and Edit Record + Select and edit record node on the unrelated panels section. + SearchEditRec_EDTB_Parent + SelectEditRec_EDTB_Parent + + + AddRecMobile_DTB_Parent + AddRecMobile_DTB_Parent + Add Record Mobile + Add record node on the related panels section. + AddRecMobile_DTB_Parent + + + EditRecMobile_DTB_Parent + EditRecMobile_DTB_Parent + Edit Record Mobile + Edit record node on the related panels section. + EditRecMobile_DTB_Parent + + + ShowRecMobile_DTB_Parent + ShowRecMobile_DTB_Parent + Record Mobile + Show record node on the related panels section. + ShowRecMobile_DTB_Parent + + + ShowTableMobile + ShowTableMobile + Report Mobile + Show table node on the related panels section. + ShowTableMobile + ShowTableMobile_DTB_Parent + ShowTableMobile_DTB_Child + + + ShowGallery + ShowGallery + Gallery + Show gallery node on the related panels section. + ShowGallery + + + AddRec_DTB_Child + AddRec_DTB_Child + Add Table + Add table node on the unrelated panels section. + EditTable + AddRec_DTB_Child + EditRec_DTB_Child + SearchEditRec_EDTB_Child + SelectEditRec_EDTB_Child + + + EditTable + EditTable + Edit Table + Edit table node on the unrelated panels section. + EditTable + AddRec_DTB_Child + EditRec_DTB_Child + SearchEditRec_EDTB_Child + SelectEditRec_EDTB_Child + + + ShowTable + ShowTable + Basic + Show table node on the unrelated panels section. + ShowTable + SearchShowTable + TableTable_DSameR_Parent + TableTable_DSameR_Child + TableTable_DSepRow_Parent + TableTable_DSepRow_Child + RecInTable_RISameR_Parent + RecInTable_RISepR_Parent + RecInTable_RISepC_Parent + ShowTable_DTB_Parent + ShowTable_DTB_Child + ShowRec_DTB_Child + SearchShowRec_DTB_Child + SelectShowRec_DTB_Child + WebReport + EmailTable + PrintTable + EmailRec_Child + PrintRec_Child + ShowGallery + + + EmailTable + EmailTable + Emailable-Printable + Email table node on the unrelated panels section. + ShowTable + SearchShowTable + TableTable_DSameR_Parent + TableTable_DSameR_Child + TableTable_DSepRow_Parent + TableTable_DSepRow_Child + RecInTable_RISameR_Parent + RecInTable_RISepR_Parent + RecInTable_RISepC_Parent + ShowTable_DTB_Parent + ShowTable_DTB_Child + ShowRec_DTB_Child + SearchShowRec_DTB_Child + SelectShowRec_DTB_Child + WebReport + EmailTable + PrintTable + EmailRec_Child + PrintRec_Child + + + AddRec_DTB_Parent + AddRec_DTB_Parent + Add Record + Add record node on the unrelated panels section. + AddRec_DTB_Parent + + + EditRec_DTB_Parent + EditRec_DTB_Parent + Edit Record + Edit record node on the unrelated panels section. + EditRec_DTB_Parent + SelectShowRec_EDRS_Child + + + ShowRec_DTB_Parent + ShowRec_DTB_Parent + Record + Show record node on the unrelated panels section. + RecInTable_RISameR_Child + RecInTable_RISepR_Child + RecInTable_RISepC_Child + ShowRec_DTB_Parent + SelectShowRec_DRS_Child + EmailRec_Parent + PrintRec_Parent + + + EmailRec_Parent + EmailRec_Parent + Emailable-Printable Record + Email record node on the unrelated panels section. + RecInTable_RISameR_Child + RecInTable_RISepR_Child + RecInTable_RISepC_Child + ShowRec_DTB_Parent + SelectShowRec_DRS_Child + EmailRec_Parent + PrintRec_Parent + + + SearchShowRec_DTB_Parent + SearchShowRec_DTB_Parent + Search and Show Record + Search and show record node on the unrelated panels section. + SearchShowRec_DTB_Parent + SelectShowRec_DTB_Parent + SelectShowRec_DRS_Parent + SelectShowRec_EDRS_Parent + + + SearchEditRec_EDTB_Parent + SearchEditRec_EDTB_Parent + Search and Edit Record + Search and edit record node on the unrelated panels section. + SearchEditRec_EDTB_Parent + SelectEditRec_EDTB_Parent + + + SelectShowRec_DTB_Parent + SelectShowRec_DTB_Parent + Select and Show Record + Select and show record node on the unrelated panels section. + SearchShowRec_DTB_Parent + SelectShowRec_DTB_Parent + SelectShowRec_DRS_Parent + SelectShowRec_EDRS_Parent + + + SelectEditRec_EDTB_Parent + SelectEditRec_EDTB_Parent + Select and Edit Record + Select and edit record node on the unrelated panels section. + SearchEditRec_EDTB_Parent + SelectEditRec_EDTB_Parent + + + AddRecMobile_DTB_Parent + AddRecMobile_DTB_Parent + Add Record Mobile + Add record node on the unrelated panels section. + AddRecMobile_DTB_Parent + + + EditRecMobile_DTB_Parent + EditRecMobile_DTB_Parent + Edit Record Mobile + Edit record node on the unrelated panels section. + EditRecMobile_DTB_Parent + + + ShowRecMobile_DTB_Parent + ShowRecMobile_DTB_Parent + Record Mobile + Show record node on the unrelated panels section. + ShowRecMobile_DTB_Parent + + + ShowTableMobile + ShowTableMobile + Report Mobile + Show table node on the unrelated panels section. + ShowTableMobile + ShowTableMobile_DTB_Child + + + ShowGallery + ShowGallery + Gallery + Show gallery node on the unrelated panels section. + ShowGallery + + + \ No newline at end of file diff --git a/App_Code/AssemblyInfo.vb b/App_Code/AssemblyInfo.vb new file mode 100644 index 0000000..e95e0b9 --- /dev/null +++ b/App_Code/AssemblyInfo.vb @@ -0,0 +1,39 @@ +Imports System.Reflection +Imports System.Runtime.InteropServices + +' General Information about an assembly is controlled through the following +' set of attributes. Change these attribute values to modify the information +' associated with an assembly. + +' Review the values of the assembly attributes + + + + + + + + + +'The following GUID is for the ID of the typelib if this project is exposed to COM + + +' Version information for an assembly consists of the following four values: +' +' Major Version +' Minor Version +' Build Number +' Revision +' +' You can specify all the values or you can default the Build and Revision Numbers +' by using the '*' as shown below: + + + +' NOTE: If you want to generate a deployment installer(MSI) then the acceptable assembly version format is: +' Major Version +' Minor Version +' Build Number +' 0-255.0-255.0-65534 +' Example: 1.0.* or 255.255.65534 + diff --git a/App_Code/Business Layer/AbsentRecord.vb b/App_Code/Business Layer/AbsentRecord.vb new file mode 100644 index 0000000..770f46c --- /dev/null +++ b/App_Code/Business Layer/AbsentRecord.vb @@ -0,0 +1,35 @@ +' This is a "safe" class, meaning that it is created once +' and never overwritten. Any custom code you add to this class +' will be preserved when you regenerate your application. +' +' Typical customizations that may be done in this class include +' - adding custom event handlers +' - overriding base class methods + +Imports System.Data.SqlTypes +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + +Namespace Persons.Business + +''' +''' Provides access to the data in a database record. +''' Also provides access to the that each record is associated with. +''' +''' +''' +''' + + Public Class AbsentRecord + Inherits BaseAbsentRecord + + ' Constructors + + Public Sub New() + MyBase.New() + End Sub + + +End Class +End Namespace diff --git a/App_Code/Business Layer/AbsentTable.vb b/App_Code/Business Layer/AbsentTable.vb new file mode 100644 index 0000000..b049649 --- /dev/null +++ b/App_Code/Business Layer/AbsentTable.vb @@ -0,0 +1,89 @@ +' This is a "safe" class, meaning that it is created once +' and never overwritten. Any custom code you add to this class +' will be preserved when you regenerate your application. +' +' Typical customizations that may be done in this class include +' - adding custom event handlers +' - overriding base class methods + +Imports System.Data.SqlTypes +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + +Namespace Persons.Business + +''' +''' Provides access to the schema information and record data of a database table (or view). +''' See for additional information. +''' +''' +''' See for additional information. +''' +''' This class is implemented using the Singleton design pattern. +''' +''' +''' This is a "safe" class, meaning that it is generated once and never overwritten. +''' Any changes you make to this class will be preserved when you regenerate your application. +''' +''' +''' +''' +''' +''' +''' +''' + + Public Class AbsentTable + Inherits BaseAbsentTable + Implements System.Runtime.Serialization.ISerializable, ISingleton + + +#Region "ISerializable Members" + + ''' + ''' Overridden to use the class + ''' for deserialization of data. + ''' + ''' + ''' Since the class is implemented using the Singleton design pattern, + ''' this method must be overridden to prevent additional instances from being created during deserialization. + ''' + Protected Overridable Sub GetObjectData( _ + ByVal info As System.Runtime.Serialization.SerializationInfo, _ + ByVal context As System.Runtime.Serialization.StreamingContext _ + ) Implements System.Runtime.Serialization.ISerializable.GetObjectData + info.SetType(GetType(AbsentTable_SerializationHelper)) 'No other values need to be added + End Sub + +#Region "Class AbsentTable_SerializationHelper" + + Private Class AbsentTable_SerializationHelper + Implements System.Runtime.Serialization.IObjectReference + + 'Method called after this object is deserialized + Public Function GetRealObject(ByVal context As System.Runtime.Serialization.StreamingContext) As Object _ + Implements System.Runtime.Serialization.IObjectReference.GetRealObject + Return AbsentTable.Instance + End Function + End Class + +#End Region + +#End Region + + ''' + ''' References the only instance of the class. + ''' + ''' + ''' Since the class is implemented using the Singleton design pattern, + ''' this field is the only way to access an instance of the class. + ''' + Public Shared ReadOnly Instance As New AbsentTable() + + Private Sub New() + MyBase.New() + End Sub + +End Class ' AbsentTable +End Namespace diff --git a/App_Code/Business Layer/ArmRecord.vb b/App_Code/Business Layer/ArmRecord.vb new file mode 100644 index 0000000..60f76a5 --- /dev/null +++ b/App_Code/Business Layer/ArmRecord.vb @@ -0,0 +1,35 @@ +' This is a "safe" class, meaning that it is created once +' and never overwritten. Any custom code you add to this class +' will be preserved when you regenerate your application. +' +' Typical customizations that may be done in this class include +' - adding custom event handlers +' - overriding base class methods + +Imports System.Data.SqlTypes +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + +Namespace Persons.Business + +''' +''' Provides access to the data in a database record. +''' Also provides access to the that each record is associated with. +''' +''' +''' +''' + + Public Class ArmRecord + Inherits BaseArmRecord + + ' Constructors + + Public Sub New() + MyBase.New() + End Sub + + +End Class +End Namespace diff --git a/App_Code/Business Layer/ArmTable.vb b/App_Code/Business Layer/ArmTable.vb new file mode 100644 index 0000000..11411d0 --- /dev/null +++ b/App_Code/Business Layer/ArmTable.vb @@ -0,0 +1,89 @@ +' This is a "safe" class, meaning that it is created once +' and never overwritten. Any custom code you add to this class +' will be preserved when you regenerate your application. +' +' Typical customizations that may be done in this class include +' - adding custom event handlers +' - overriding base class methods + +Imports System.Data.SqlTypes +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + +Namespace Persons.Business + +''' +''' Provides access to the schema information and record data of a database table (or view). +''' See for additional information. +''' +''' +''' See for additional information. +''' +''' This class is implemented using the Singleton design pattern. +''' +''' +''' This is a "safe" class, meaning that it is generated once and never overwritten. +''' Any changes you make to this class will be preserved when you regenerate your application. +''' +''' +''' +''' +''' +''' +''' +''' + + Public Class ArmTable + Inherits BaseArmTable + Implements System.Runtime.Serialization.ISerializable, ISingleton + + +#Region "ISerializable Members" + + ''' + ''' Overridden to use the class + ''' for deserialization of data. + ''' + ''' + ''' Since the class is implemented using the Singleton design pattern, + ''' this method must be overridden to prevent additional instances from being created during deserialization. + ''' + Protected Overridable Sub GetObjectData( _ + ByVal info As System.Runtime.Serialization.SerializationInfo, _ + ByVal context As System.Runtime.Serialization.StreamingContext _ + ) Implements System.Runtime.Serialization.ISerializable.GetObjectData + info.SetType(GetType(ArmTable_SerializationHelper)) 'No other values need to be added + End Sub + +#Region "Class ArmTable_SerializationHelper" + + Private Class ArmTable_SerializationHelper + Implements System.Runtime.Serialization.IObjectReference + + 'Method called after this object is deserialized + Public Function GetRealObject(ByVal context As System.Runtime.Serialization.StreamingContext) As Object _ + Implements System.Runtime.Serialization.IObjectReference.GetRealObject + Return ArmTable.Instance + End Function + End Class + +#End Region + +#End Region + + ''' + ''' References the only instance of the class. + ''' + ''' + ''' Since the class is implemented using the Singleton design pattern, + ''' this field is the only way to access an instance of the class. + ''' + Public Shared ReadOnly Instance As New ArmTable() + + Private Sub New() + MyBase.New() + End Sub + +End Class ' ArmTable +End Namespace diff --git a/App_Code/Business Layer/ArmyRecord.vb b/App_Code/Business Layer/ArmyRecord.vb new file mode 100644 index 0000000..47fd5de --- /dev/null +++ b/App_Code/Business Layer/ArmyRecord.vb @@ -0,0 +1,35 @@ +' This is a "safe" class, meaning that it is created once +' and never overwritten. Any custom code you add to this class +' will be preserved when you regenerate your application. +' +' Typical customizations that may be done in this class include +' - adding custom event handlers +' - overriding base class methods + +Imports System.Data.SqlTypes +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + +Namespace Persons.Business + +''' +''' Provides access to the data in a database record. +''' Also provides access to the that each record is associated with. +''' +''' +''' +''' + + Public Class ArmyRecord + Inherits BaseArmyRecord + + ' Constructors + + Public Sub New() + MyBase.New() + End Sub + + +End Class +End Namespace diff --git a/App_Code/Business Layer/ArmyTable.vb b/App_Code/Business Layer/ArmyTable.vb new file mode 100644 index 0000000..cf10387 --- /dev/null +++ b/App_Code/Business Layer/ArmyTable.vb @@ -0,0 +1,89 @@ +' This is a "safe" class, meaning that it is created once +' and never overwritten. Any custom code you add to this class +' will be preserved when you regenerate your application. +' +' Typical customizations that may be done in this class include +' - adding custom event handlers +' - overriding base class methods + +Imports System.Data.SqlTypes +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + +Namespace Persons.Business + +''' +''' Provides access to the schema information and record data of a database table (or view). +''' See for additional information. +''' +''' +''' See for additional information. +''' +''' This class is implemented using the Singleton design pattern. +''' +''' +''' This is a "safe" class, meaning that it is generated once and never overwritten. +''' Any changes you make to this class will be preserved when you regenerate your application. +''' +''' +''' +''' +''' +''' +''' +''' + + Public Class ArmyTable + Inherits BaseArmyTable + Implements System.Runtime.Serialization.ISerializable, ISingleton + + +#Region "ISerializable Members" + + ''' + ''' Overridden to use the class + ''' for deserialization of data. + ''' + ''' + ''' Since the class is implemented using the Singleton design pattern, + ''' this method must be overridden to prevent additional instances from being created during deserialization. + ''' + Protected Overridable Sub GetObjectData( _ + ByVal info As System.Runtime.Serialization.SerializationInfo, _ + ByVal context As System.Runtime.Serialization.StreamingContext _ + ) Implements System.Runtime.Serialization.ISerializable.GetObjectData + info.SetType(GetType(ArmyTable_SerializationHelper)) 'No other values need to be added + End Sub + +#Region "Class ArmyTable_SerializationHelper" + + Private Class ArmyTable_SerializationHelper + Implements System.Runtime.Serialization.IObjectReference + + 'Method called after this object is deserialized + Public Function GetRealObject(ByVal context As System.Runtime.Serialization.StreamingContext) As Object _ + Implements System.Runtime.Serialization.IObjectReference.GetRealObject + Return ArmyTable.Instance + End Function + End Class + +#End Region + +#End Region + + ''' + ''' References the only instance of the class. + ''' + ''' + ''' Since the class is implemented using the Singleton design pattern, + ''' this field is the only way to access an instance of the class. + ''' + Public Shared ReadOnly Instance As New ArmyTable() + + Private Sub New() + MyBase.New() + End Sub + +End Class ' ArmyTable +End Namespace diff --git a/App_Code/Business Layer/BaseAbsentRecord.vb b/App_Code/Business Layer/BaseAbsentRecord.vb new file mode 100644 index 0000000..e2b8a3b --- /dev/null +++ b/App_Code/Business Layer/BaseAbsentRecord.vb @@ -0,0 +1,283 @@ +' This class is "generated" and will be overwritten. +' Your customizations should be made in AbsentRecord.vb + +Imports System.Data.SqlTypes +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + +Namespace Persons.Business + +''' +''' The generated superclass for the class. +''' +''' +''' This class is not intended to be instantiated directly. To obtain an instance of this class, +''' use the methods of the class. +''' +''' +''' + + Public Class BaseAbsentRecord + Inherits PrimaryKeyRecord + + + Public Shared Shadows ReadOnly TableUtils As AbsentTable = AbsentTable.Instance + + ' Constructors + + Protected Sub New() + MyBase.New(TableUtils) + End Sub + + Protected Sub New(ByVal record As PrimaryKeyRecord) + MyBase.New(record, TableUtils) + End Sub + + 'Evaluates Initialize when->Inserting record formulas specified at the data access layer + Public Overridable Sub AbsentRecord_InsertingRecord(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles Me.InsertingRecord + 'Apply Initialize->Inserting record formula only if validation is successful. + Dim AbsentRec As AbsentRecord = CType(sender,AbsentRecord) + Validate_Inserting() + If Not AbsentRec Is Nothing AndAlso Not AbsentRec.IsReadOnly Then + End If + End Sub + + 'Evaluates Initialize when->Updating record formulas specified at the data access layer + Public Overridable Sub AbsentRecord_UpdatingRecord(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles Me.UpdatingRecord + 'Apply Initialize->Updating record formula only if validation is successful. + Dim AbsentRec As AbsentRecord = CType(sender,AbsentRecord) + Validate_Updating() + If Not AbsentRec Is Nothing AndAlso Not AbsentRec.IsReadOnly Then + End If + End Sub + + 'Evaluates Initialize when->Reading record formulas specified at the data access layer + Public Overridable Sub AbsentRecord_ReadRecord(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.ReadRecord + 'Apply Initialize->Reading record formula only if validation is successful. + Dim AbsentRec As AbsentRecord = CType(sender,AbsentRecord) + If Not AbsentRec Is Nothing AndAlso Not AbsentRec.IsReadOnly Then + End If + End Sub + + 'Evaluates Validate when->Inserting formulas specified at the data access layer + Public Overridable Sub Validate_Inserting () + Dim fullValidationMessage As String = "" + Dim validationMessage As String = "" + + dim formula as String = "" + + + If validationMessage <> "" AndAlso validationMessage.ToLower() <> "true" Then + fullValidationMessage &= validationMessage & vbCrLf + End If + + If fullValidationMessage <> "" Then + Throw New Exception(fullValidationMessage) + End If + End Sub + + 'Evaluates Validate when->Updating formulas specified at the data access layer + Public Overridable Sub Validate_Updating () + Dim fullValidationMessage As String = "" + Dim validationMessage As String = "" + + dim formula as String = "" + + + If validationMessage <> "" AndAlso validationMessage.ToLower() <> "true" Then + fullValidationMessage &= validationMessage & vbCrLf + End If + + If fullValidationMessage <> "" Then + Throw New Exception(fullValidationMessage) + End If + End Sub + + Public Overridable Function EvaluateFormula(ByVal formula As String, Optional ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord = Nothing, Optional ByVal format As String = Nothing) As String + + Dim e As Data.BaseFormulaEvaluator = New Data.BaseFormulaEvaluator() + + ' All variables referred to in the formula are expected to be + ' properties of the DataSource. For example, referring to + ' UnitPrice as a variable will refer to DataSource.UnitPrice + e.DataSource = dataSourceForEvaluate + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + Return resultObj.ToString() + End Function + + + + + + + +#Region "Convenience methods to get/set values of fields" + + ''' + ''' This is a convenience method that provides direct access to the value of the record's Absent_.AbsentId field. + ''' + Public Function GetAbsentIdValue() As ColumnValue + Return Me.GetValue(TableUtils.AbsentIdColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's Absent_.AbsentId field. + ''' + Public Function GetAbsentIdFieldValue() As Byte + Return CType(Me.GetValue(TableUtils.AbsentIdColumn).ToByte(), Byte) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Absent_.AbsentId field. + ''' + Public Sub SetAbsentIdFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.AbsentIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Absent_.AbsentId field. + ''' + Public Sub SetAbsentIdFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.AbsentIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Absent_.AbsentId field. + ''' + Public Sub SetAbsentIdFieldValue(ByVal val As Double) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.AbsentIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Absent_.AbsentId field. + ''' + Public Sub SetAbsentIdFieldValue(ByVal val As Decimal) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.AbsentIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Absent_.AbsentId field. + ''' + Public Sub SetAbsentIdFieldValue(ByVal val As Int64) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.AbsentIdColumn) + End Sub + ''' + ''' This is a convenience method that provides direct access to the value of the record's Absent_.Absent field. + ''' + Public Function GetAbsentValue() As ColumnValue + Return Me.GetValue(TableUtils.AbsentColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's Absent_.Absent field. + ''' + Public Function GetAbsentFieldValue() As String + Return CType(Me.GetValue(TableUtils.AbsentColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Absent_.Absent field. + ''' + Public Sub SetAbsentFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.AbsentColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Absent_.Absent field. + ''' + Public Sub SetAbsentFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.AbsentColumn) + End Sub + + + +#End Region + +#Region "Convenience methods to get field names" + + ''' + ''' This is a convenience property that provides direct access to the value of the record's Absent_.AbsentId field. + ''' + Public Property AbsentId() As Byte + Get + Return CType(Me.GetValue(TableUtils.AbsentIdColumn).ToByte(), Byte) + End Get + Set (ByVal val As Byte) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.AbsentIdColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property AbsentIdSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.AbsentIdColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property AbsentIdDefault() As String + Get + Return TableUtils.AbsentIdColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's Absent_.Absent field. + ''' + Public Property Absent() As String + Get + Return CType(Me.GetValue(TableUtils.AbsentColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.AbsentColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property AbsentSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.AbsentColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property AbsentDefault() As String + Get + Return TableUtils.AbsentColumn.DefaultValue + End Get + End Property + + + +#End Region + +End Class +End Namespace diff --git a/App_Code/Business Layer/BaseAbsentTable.vb b/App_Code/Business Layer/BaseAbsentTable.vb new file mode 100644 index 0000000..4da7132 --- /dev/null +++ b/App_Code/Business Layer/BaseAbsentTable.vb @@ -0,0 +1,778 @@ +' This class is "generated" and will be overwritten. +' Your customizations should be made in AbsentRecord.vb + +Imports System.Data.SqlTypes +Imports System.Data +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider +Imports Persons.Data + +Namespace Persons.Business + +''' +''' The generated superclass for the class. +''' Provides access to the schema information and record data of a database table or view named Absent. +''' +''' +''' The connection details (name, location, etc.) of the database and table (or view) accessed by this class +''' are resolved at runtime based on the connection string in the application's Web.Config file. +''' +''' This class is not intended to be instantiated directly. To obtain an instance of this class, use +''' AbsentTable.Instance. +''' +''' +''' + + Public Class BaseAbsentTable + Inherits PrimaryKeyTable + + + Private ReadOnly TableDefinitionString As String = AbsentDefinition.GetXMLString() + + + + + + + + Protected Sub New() + MyBase.New() + Me.Initialize() + End Sub + + Protected Overridable Sub Initialize() + Dim def As New XmlTableDefinition(TableDefinitionString) + Me.TableDefinition = New TableDefinition() + Me.TableDefinition.TableClassName = System.Reflection.Assembly.CreateQualifiedName("App_Code", "Persons.Business.AbsentTable") + def.InitializeTableDefinition(Me.TableDefinition) + Me.ConnectionName = def.GetConnectionName() + Me.RecordClassName = System.Reflection.Assembly.CreateQualifiedName("App_Code", "Persons.Business.AbsentRecord") + Me.ApplicationName = "App_Code" + Me.DataAdapter = New AbsentSqlTable() + Directcast(Me.DataAdapter, AbsentSqlTable).ConnectionName = Me.ConnectionName + + Me.TableDefinition.AdapterMetaData = Me.DataAdapter.AdapterMetaData + AbsentIdColumn.CodeName = "AbsentId" + AbsentColumn.CodeName = "Absent" + + End Sub + +#Region "Overriden methods" + + +#End Region + +#Region "Properties for columns" + + ''' + ''' This is a convenience property that provides direct access to the table's Absent_.AbsentId column object. + ''' + Public ReadOnly Property AbsentIdColumn() As BaseClasses.Data.NumberColumn + Get + Return CType(Me.TableDefinition.ColumnList(0), BaseClasses.Data.NumberColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's Absent_.AbsentId column object. + ''' + Public Shared ReadOnly Property AbsentId() As BaseClasses.Data.NumberColumn + Get + Return AbsentTable.Instance.AbsentIdColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's Absent_.Absent column object. + ''' + Public ReadOnly Property AbsentColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(1), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's Absent_.Absent column object. + ''' + Public Shared ReadOnly Property Absent() As BaseClasses.Data.StringColumn + Get + Return AbsentTable.Instance.AbsentColumn + End Get + End Property + + +#End Region + + +#Region "Shared helper methods" + + ''' + ''' This is a shared function that can be used to get an array of AbsentRecord records using a where clause. + ''' + Public Shared Function GetRecords(ByVal where As String) As AbsentRecord() + + Return GetRecords(where, Nothing, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) + End Function + + ''' + ''' This is a shared function that can be used to get an array of AbsentRecord records using a where clause. + ''' + Public Shared Function GetRecords(ByVal join As BaseFilter, ByVal where As String) As AbsentRecord() + + Return GetRecords(join, where, Nothing, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) + End Function + + ''' + ''' This is a shared function that can be used to get an array of AbsentRecord records using a where and order by clause. + ''' + Public Shared Function GetRecords( _ + ByVal where As String, _ + ByVal orderBy As OrderBy) As AbsentRecord() + + Return GetRecords(where, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) + End Function + + ''' + ''' This is a shared function that can be used to get an array of AbsentRecord records using a where and order by clause. + ''' + Public Shared Function GetRecords( _ + ByVal join As BaseFilter, _ + ByVal where As String, _ + ByVal orderBy As OrderBy) As AbsentRecord() + + Return GetRecords(join, where, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) + End Function + + ''' + ''' This is a shared function that can be used to get an array of AbsentRecord records using a where and order by clause clause with pagination. + ''' + Public Shared Function GetRecords( _ + ByVal where As String, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As AbsentRecord() + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + Dim join As BaseClasses.Data.BaseFilter = Nothing + Dim recList As ArrayList = AbsentTable.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, pageIndex, pageSize) + + Return CType(recList.ToArray(GetType(Persons.Business.AbsentRecord)), AbsentRecord()) + End Function + + ''' + ''' This is a shared function that can be used to get an array of AbsentRecord records using a where and order by clause clause with pagination. + ''' + Public Shared Function GetRecords( _ + ByVal join As BaseFilter, _ + ByVal where As String, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As AbsentRecord() + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Dim recList As ArrayList = AbsentTable.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, pageIndex, pageSize) + + Return CType(recList.ToArray(GetType(Persons.Business.AbsentRecord)), AbsentRecord()) + End Function + + Public Shared Function GetRecords( _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As AbsentRecord() + Dim join As BaseClasses.Data.BaseFilter = Nothing + Dim recList As ArrayList = AbsentTable.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + Return CType(recList.ToArray(GetType(Persons.Business.AbsentRecord)), AbsentRecord()) + End Function + + Public Shared Function GetRecords( _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As AbsentRecord() + + Dim recList As ArrayList = AbsentTable.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + Return CType(recList.ToArray(GetType(Persons.Business.AbsentRecord)), AbsentRecord()) + End Function + + Public Shared Function GetRecords( _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer, _ + ByRef totalRecords As Integer) As AbsentRecord() + Dim join As BaseClasses.Data.BaseFilter = Nothing + Dim recList As ArrayList = AbsentTable.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize, totalRecords) + + Return CType(recList.ToArray(GetType(Persons.Business.AbsentRecord)), AbsentRecord()) + End Function + + Public Shared Function GetRecords( _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer, _ + ByRef totalRecords As Integer) As AbsentRecord() + + Dim recList As ArrayList = AbsentTable.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize, totalRecords) + + Return CType(recList.ToArray(GetType(Persons.Business.AbsentRecord)), AbsentRecord()) + End Function + + ''' + ''' This is a shared function that can be used to get total number of records that will be returned using the where clause. + ''' + Public Shared Function GetRecordCount(ByVal where As String) As Integer + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Return CInt(AbsentTable.Instance.GetRecordListCount(Nothing, whereFilter, Nothing, Nothing)) + End Function + +''' + ''' This is a shared function that can be used to get total number of records that will be returned using the where clause. + ''' + Public Shared Function GetRecordCount(ByVal join As BaseFilter, ByVal where As String) As Integer + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Return CInt(AbsentTable.Instance.GetRecordListCount(join, whereFilter, Nothing, Nothing)) + End Function + + Public Shared Function GetRecordCount(ByVal where As WhereClause) As Integer + Return CInt(AbsentTable.Instance.GetRecordListCount(Nothing, where.GetFilter(), Nothing, Nothing)) + End Function + + Public Shared Function GetRecordCount(ByVal join As BaseFilter, ByVal where As WhereClause) As Integer + Return CInt(AbsentTable.Instance.GetRecordListCount(join, where.GetFilter(), Nothing, Nothing)) + End Function + + ''' + ''' This is a shared function that can be used to get a AbsentRecord record using a where clause. + ''' + Public Shared Function GetRecord(ByVal where As String) As AbsentRecord + Dim orderBy As OrderBy = Nothing + Return GetRecord(where, orderBy) + End Function + + ''' + ''' This is a shared function that can be used to get a AbsentRecord record using a where clause. + ''' + Public Shared Function GetRecord(ByVal join As BaseFilter, ByVal where As String) As AbsentRecord + Dim orderBy As OrderBy = Nothing + Return GetRecord(join, where, orderBy) + End Function + + ''' + ''' This is a shared function that can be used to get a AbsentRecord record using a where and order by clause. + ''' + Public Shared Function GetRecord( _ + ByVal where As String, _ + ByVal orderBy As OrderBy) As AbsentRecord + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + Dim join As BaseClasses.Data.BaseFilter = Nothing + Dim recList As ArrayList = AbsentTable.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MIN_BATCH_SIZE) + + Dim rec As AbsentRecord = Nothing + If recList.Count > 0 Then + rec = CType(recList(0), AbsentRecord) + End If + + Return rec + End Function + + ''' + ''' This is a shared function that can be used to get a AbsentRecord record using a where and order by clause. + ''' + Public Shared Function GetRecord( _ + ByVal join As BaseFilter, _ + ByVal where As String, _ + ByVal orderBy As OrderBy) As AbsentRecord + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Dim recList As ArrayList = AbsentTable.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MIN_BATCH_SIZE) + + Dim rec As AbsentRecord = Nothing + If recList.Count > 0 Then + rec = CType(recList(0), AbsentRecord) + End If + + Return rec + End Function + + + Public Shared Function GetValues( _ + ByVal col As BaseColumn, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal maxItems As Integer) As String() + + ' Create the filter list. + Dim retCol As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, True) + retCol.AddColumn(col) + + Return AbsentTable.Instance.GetColumnValues(retCol, Nothing, where.GetFilter(), Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, maxItems) + + End Function + + Public Shared Function GetValues( _ + ByVal col As BaseColumn, _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal maxItems As Integer) As String() + + ' Create the filter list. + Dim retCol As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, True) + retCol.AddColumn(col) + + Return AbsentTable.Instance.GetColumnValues(retCol, join, where.GetFilter(), Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, maxItems) + + End Function + + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where clause. + ''' + Public Shared Function GetDataTable(ByVal where As String) As System.Data.DataTable + + Dim recs() As AbsentRecord = GetRecords(where) + Return AbsentTable.Instance.CreateDataTable(recs, Nothing) + End Function + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where clause. + ''' + Public Shared Function GetDataTable(ByVal join As BaseFilter, ByVal where As String) As System.Data.DataTable + + Dim recs() As AbsentRecord = GetRecords(join, where) + Return AbsentTable.Instance.CreateDataTable(recs, Nothing) + End Function + + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause. + ''' + Public Shared Function GetDataTable(ByVal where As String, ByVal orderBy As OrderBy) As System.Data.DataTable + + Dim recs() As AbsentRecord = GetRecords(where, orderBy) + Return AbsentTable.Instance.CreateDataTable(recs, Nothing) + End Function + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause. + ''' + Public Shared Function GetDataTable(ByVal join As BaseFilter, ByVal where As String, ByVal orderBy As OrderBy) As System.Data.DataTable + + Dim recs() As AbsentRecord = GetRecords(join, where, orderBy) + Return AbsentTable.Instance.CreateDataTable(recs, Nothing) + End Function + + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause with pagination. + ''' + Public Shared Function GetDataTable( _ + ByVal where As String, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As System.Data.DataTable + + Dim recs() As AbsentRecord = GetRecords(where, orderBy, pageIndex, pageSize) + Return AbsentTable.Instance.CreateDataTable(recs, Nothing) + End Function + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause with pagination. + ''' + Public Shared Function GetDataTable( _ + ByVal join As BaseFilter, _ + ByVal where As String, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As System.Data.DataTable + + Dim recs() As AbsentRecord = GetRecords(join, where, orderBy, pageIndex, pageSize) + Return AbsentTable.Instance.CreateDataTable(recs, Nothing) + End Function + + + ''' + ''' This is a shared function that can be used to delete records using a where clause. + ''' + Public Shared Sub DeleteRecords(ByVal where As String) + If where = Nothing OrElse where.Trim() = "" Then + Return + End If + + Dim whereFilter As SqlFilter = New SqlFilter(where) + AbsentTable.Instance.DeleteRecordList(whereFilter) + End Sub + + ''' + ''' This is a shared function that can be used to export records using a where clause. + ''' + Public Shared Function Export(ByVal where As String) As String + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Return AbsentTable.Instance.ExportRecordData(whereFilter) + End Function + + Public Shared Function Export(ByVal where As WhereClause) As String + Dim whereFilter As BaseFilter = Nothing + If Not where Is Nothing Then + whereFilter = where.GetFilter() + End If + + Return AbsentTable.Instance.ExportRecordData(whereFilter) + End Function + + Public Shared Function GetSum( _ + ByVal col As BaseColumn, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) _ + As String + + Dim colSel As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, False) + colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Sum) + + Return AbsentTable.Instance.GetColumnStatistics(colSel, Nothing, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + End Function + + Public Shared Function GetSum( _ + ByVal col As BaseColumn, _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) _ + As String + + Dim colSel As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, False) + colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Sum) + + Return AbsentTable.Instance.GetColumnStatistics(colSel, join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + End Function + + + Public Shared Function GetCount( _ + ByVal col As BaseColumn, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) _ + As String + + Dim colSel As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, False) + colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Count) + + Return AbsentTable.Instance.GetColumnStatistics(colSel, Nothing, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + End Function + + Public Shared Function GetCount( _ + ByVal col As BaseColumn, _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) _ + As String + + Dim colSel As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, False) + colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Count) + + Return AbsentTable.Instance.GetColumnStatistics(colSel, join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + End Function + + ''' + ''' This method returns the columns in the table. + ''' + Public Shared Function GetColumns() As BaseColumn() + Return AbsentTable.Instance.TableDefinition.Columns + End Function + + ''' + ''' This method returns the columnlist in the table. + ''' + Public Shared Function GetColumnList() As ColumnList + Return AbsentTable.Instance.TableDefinition.ColumnList + End Function + + + ''' + ''' This method creates a new record and returns it to be edited. + ''' + Public Shared Function CreateNewRecord() As IRecord + Return AbsentTable.Instance.CreateRecord() + End Function + + ''' + ''' This method creates a new record and returns it to be edited. + ''' + ''' ID of the new record. + Public Shared Function CreateNewRecord(ByVal tempId As String) As IRecord + Return AbsentTable.Instance.CreateRecord(tempId) + End Function + + ''' + ''' This method checks if column is editable. + ''' + ''' Name of the column to check. + Public Shared Function isReadOnlyColumn(ByVal columnName As String) As Boolean + Dim column As BaseColumn = GetColumn(columnName) + If (Not IsNothing(column)) Then + Return column.IsValuesReadOnly + Else + Return True + End If + End Function + + ''' + ''' This method gets the specified column. + ''' + ''' Unique name of the column to fetch. + Public Shared Function GetColumn(ByVal uniqueColumnName As String) As BaseColumn + Dim column As BaseColumn = AbsentTable.Instance.TableDefinition.ColumnList.GetByUniqueName(uniqueColumnName) + Return column + End Function + + ' Convenience method for getting a record using a string-based record identifier + Public Shared Function GetRecord(ByVal id As String, ByVal bMutable As Boolean) As AbsentRecord + Return CType(AbsentTable.Instance.GetRecordData(id, bMutable), AbsentRecord) + End Function + + ' Convenience method for getting a record using a KeyValue record identifier + Public Shared Function GetRecord(ByVal id As KeyValue, ByVal bMutable As Boolean) As AbsentRecord + Return CType(AbsentTable.Instance.GetRecordData(id, bMutable), AbsentRecord) + End Function + + ' Convenience method for creating a record + Public Overloads Function NewRecord( _ + ByVal AbsentIdValue As String, _ + ByVal AbsentValue As String _ + ) As KeyValue + Dim rec As IPrimaryKeyRecord = CType(Me.CreateRecord(), IPrimaryKeyRecord) + rec.SetString(AbsentIdValue, AbsentIdColumn) + rec.SetString(AbsentValue, AbsentColumn) + + + rec.Create() 'update the DB so any DB-initialized fields (like autoincrement IDs) can be initialized + + Dim key As KeyValue = rec.GetID() + Return key + End Function + + ''' + ''' This method deletes a specified record + ''' + ''' Keyvalue of the record to be deleted. + Public Shared Sub DeleteRecord(ByVal kv As KeyValue) + AbsentTable.Instance.DeleteOneRecord(kv) + End Sub + + ''' + ''' This method checks if record exist in the database using the keyvalue provided. + ''' + ''' Key value of the record. + Public Shared Function DoesRecordExist(ByVal kv As KeyValue) As Boolean + Dim recordExist As Boolean = True + Try + AbsentTable.GetRecord(kv, False) + Catch ex As Exception + recordExist = False + End Try + Return recordExist + End Function + + ''' + ''' This method returns all the primary columns in the table. + ''' + Public Shared Function GetPrimaryKeyColumns() As ColumnList + If (Not IsNothing(AbsentTable.Instance.TableDefinition.PrimaryKey)) Then + Return AbsentTable.Instance.TableDefinition.PrimaryKey.Columns + Else + Return Nothing + End If + End Function + + ''' + ''' This method takes a key and returns a keyvalue. + ''' + ''' key could be array of primary key values in case of composite primary key or a string containing single primary key value in case of non-composite primary key. + Public Shared Function GetKeyValue(ByVal key As Object) As KeyValue + Dim kv As KeyValue = Nothing + + If (Not (IsNothing(AbsentTable.Instance.TableDefinition.PrimaryKey))) Then + + Dim isCompositePrimaryKey As Boolean = False + isCompositePrimaryKey = AbsentTable.Instance.TableDefinition.PrimaryKey.IsCompositeKey + + If ((isCompositePrimaryKey) AndAlso (key.GetType.IsArray())) Then + + ' If the key is composite, then construct a key value. + kv = New KeyValue + Dim fullKeyString As String = "" + Dim keyArray As Array = CType(key, Array) + If (Not IsNothing(keyArray)) Then + Dim length As Integer = keyArray.Length + Dim pkColumns As ColumnList = AbsentTable.Instance.TableDefinition.PrimaryKey.Columns + Dim pkColumn As BaseColumn + Dim index As Integer = 0 + For Each pkColumn In pkColumns + Dim keyString As String = CType(keyArray.GetValue(index), String) + If (AbsentTable.Instance.TableDefinition.TableType = BaseClasses.Data.TableDefinition.TableTypes.Virtual) Then + kv.AddElement(pkColumn.UniqueName, keyString) + Else + kv.AddElement(pkColumn.InternalName, keyString) + End If + index = index + 1 + Next pkColumn + End If + + Else + ' If the key is not composite, then get the key value. + kv = AbsentTable.Instance.TableDefinition.PrimaryKey.ParseValue(CType(key, String)) + End If + End If + Return kv + End Function + + + ''' + ''' This method takes a record and a Column and returns an evaluated value of DFKA formula. + ''' + Public Shared Function GetDFKA(ByVal rec As BaseRecord, ByVal col As BaseColumn) As String + Dim fkColumn As ForeignKey = AbsentTable.Instance.TableDefinition.GetExpandableNonCompositeForeignKey(col) + If fkColumn Is Nothing Then + Return Nothing + End If + Dim _DFKA As String = fkColumn.PrimaryKeyDisplayColumns + If (_DFKA.Trim().StartsWith("=")) Then + ' if the formula is in the format of "= ., then pull out the data from the rec object instead of doing formula evaluation + Dim tableCodeName As String = fkColumn.PrimaryKeyTableDefinition.TableCodeName + Dim column As String = _DFKA.Trim("="c).Trim() + If column.StartsWith(tableCodeName & ".", StringComparison.InvariantCultureIgnoreCase) Then + column = column.Substring(tableCodeName.Length + 1) + End If + + For Each c As BaseColumn In fkColumn.PrimaryKeyTableDefinition.Columns + If column = c.CodeName Then + Return rec.Format(c) + End If + Next + Dim tableName As String = fkColumn.PrimaryKeyTableDefinition.TableCodeName + Return EvaluateFormula(_DFKA, rec, Nothing, tableName) + Else + Return Nothing + End If + End Function + + ''' + ''' This method takes a keyValue and a Column and returns an evaluated value of DFKA formula. + ''' + Public Shared Function GetDFKA(ByVal keyValue As String, ByVal col As BaseColumn, ByVal formatPattern as String) As String + If keyValue Is Nothing Then + Return Nothing + End If + Dim fkColumn As ForeignKey = AbsentTable.Instance.TableDefinition.GetExpandableNonCompositeForeignKey(col) + If fkColumn Is Nothing Then + Return Nothing + End If + Dim _DFKA As String = fkColumn.PrimaryKeyDisplayColumns + If (_DFKA.Trim().StartsWith("=")) Then + Dim tableName As String = fkColumn.PrimaryKeyTableDefinition.TableCodeName + Dim t As PrimaryKeyTable = CType(DatabaseObjects.GetTableObject(tableName), PrimaryKeyTable) + Dim rec As BaseRecord = Nothing + If Not t Is Nothing Then + Try + rec = CType(t.GetRecordData(keyValue, False), BaseRecord) + Catch + rec = Nothing + End Try + End If + If rec Is Nothing Then + Return "" + End If + + ' if the formula is in the format of "= ., then pull out the data from the rec object instead of doing formula evaluation + Dim tableCodeName As String = fkColumn.PrimaryKeyTableDefinition.TableCodeName + Dim column As String = _DFKA.Trim("="c).Trim() + If column.StartsWith(tableCodeName & ".", StringComparison.InvariantCultureIgnoreCase) Then + column = column.Substring(tableCodeName.Length + 1) + End If + + For Each c As BaseColumn In fkColumn.PrimaryKeyTableDefinition.Columns + If column = c.CodeName Then + Return rec.Format(c) + End If + Next + Return EvaluateFormula(_DFKA, rec, Nothing, tableName) + Else + Return Nothing + End If + End Function + + ''' + ''' Evaluates the formula + ''' + Public Shared Function EvaluateFormula(ByVal formula As String, Optional ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord = Nothing, Optional ByVal format As String = Nothing, Optional ByVal name As String = "") As String + Dim e As BaseFormulaEvaluator = New BaseFormulaEvaluator() + If Not dataSourceForEvaluate Is Nothing Then + e.Evaluator.Variables.Add(name, dataSourceForEvaluate) + end if + e.DataSource = dataSourceForEvaluate + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + If Not String.IsNullOrEmpty(format) Then + Return BaseFormulaUtils.Format(resultObj, format) + Else + Return resultObj.ToString() + End If + End Function + + +#End Region + +End Class +End Namespace diff --git a/App_Code/Business Layer/BaseArmRecord.vb b/App_Code/Business Layer/BaseArmRecord.vb new file mode 100644 index 0000000..6db33d6 --- /dev/null +++ b/App_Code/Business Layer/BaseArmRecord.vb @@ -0,0 +1,498 @@ +' This class is "generated" and will be overwritten. +' Your customizations should be made in ArmRecord.vb + +Imports System.Data.SqlTypes +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + +Namespace Persons.Business + +''' +''' The generated superclass for the class. +''' +''' +''' This class is not intended to be instantiated directly. To obtain an instance of this class, +''' use the methods of the class. +''' +''' +''' + + Public Class BaseArmRecord + Inherits PrimaryKeyRecord + + + Public Shared Shadows ReadOnly TableUtils As ArmTable = ArmTable.Instance + + ' Constructors + + Protected Sub New() + MyBase.New(TableUtils) + End Sub + + Protected Sub New(ByVal record As PrimaryKeyRecord) + MyBase.New(record, TableUtils) + End Sub + + 'Evaluates Initialize when->Inserting record formulas specified at the data access layer + Public Overridable Sub ArmRecord_InsertingRecord(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles Me.InsertingRecord + 'Apply Initialize->Inserting record formula only if validation is successful. + Dim ArmRec As ArmRecord = CType(sender,ArmRecord) + Validate_Inserting() + If Not ArmRec Is Nothing AndAlso Not ArmRec.IsReadOnly Then + End If + End Sub + + 'Evaluates Initialize when->Updating record formulas specified at the data access layer + Public Overridable Sub ArmRecord_UpdatingRecord(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles Me.UpdatingRecord + 'Apply Initialize->Updating record formula only if validation is successful. + Dim ArmRec As ArmRecord = CType(sender,ArmRecord) + Validate_Updating() + If Not ArmRec Is Nothing AndAlso Not ArmRec.IsReadOnly Then + End If + End Sub + + 'Evaluates Initialize when->Reading record formulas specified at the data access layer + Public Overridable Sub ArmRecord_ReadRecord(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.ReadRecord + 'Apply Initialize->Reading record formula only if validation is successful. + Dim ArmRec As ArmRecord = CType(sender,ArmRecord) + If Not ArmRec Is Nothing AndAlso Not ArmRec.IsReadOnly Then + End If + End Sub + + 'Evaluates Validate when->Inserting formulas specified at the data access layer + Public Overridable Sub Validate_Inserting () + Dim fullValidationMessage As String = "" + Dim validationMessage As String = "" + + dim formula as String = "" + + + If validationMessage <> "" AndAlso validationMessage.ToLower() <> "true" Then + fullValidationMessage &= validationMessage & vbCrLf + End If + + If fullValidationMessage <> "" Then + Throw New Exception(fullValidationMessage) + End If + End Sub + + 'Evaluates Validate when->Updating formulas specified at the data access layer + Public Overridable Sub Validate_Updating () + Dim fullValidationMessage As String = "" + Dim validationMessage As String = "" + + dim formula as String = "" + + + If validationMessage <> "" AndAlso validationMessage.ToLower() <> "true" Then + fullValidationMessage &= validationMessage & vbCrLf + End If + + If fullValidationMessage <> "" Then + Throw New Exception(fullValidationMessage) + End If + End Sub + + Public Overridable Function EvaluateFormula(ByVal formula As String, Optional ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord = Nothing, Optional ByVal format As String = Nothing) As String + + Dim e As Data.BaseFormulaEvaluator = New Data.BaseFormulaEvaluator() + + ' All variables referred to in the formula are expected to be + ' properties of the DataSource. For example, referring to + ' UnitPrice as a variable will refer to DataSource.UnitPrice + e.DataSource = dataSourceForEvaluate + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + Return resultObj.ToString() + End Function + + + + + + + +#Region "Convenience methods to get/set values of fields" + + ''' + ''' This is a convenience method that provides direct access to the value of the record's Arm_.ArmId field. + ''' + Public Function GetArmIdValue() As ColumnValue + Return Me.GetValue(TableUtils.ArmIdColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's Arm_.ArmId field. + ''' + Public Function GetArmIdFieldValue() As Int32 + Return CType(Me.GetValue(TableUtils.ArmIdColumn).ToInt32(), Int32) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Arm_.ArmId field. + ''' + Public Sub SetArmIdFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.ArmIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Arm_.ArmId field. + ''' + Public Sub SetArmIdFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.ArmIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Arm_.ArmId field. + ''' + Public Sub SetArmIdFieldValue(ByVal val As Double) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.ArmIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Arm_.ArmId field. + ''' + Public Sub SetArmIdFieldValue(ByVal val As Decimal) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.ArmIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Arm_.ArmId field. + ''' + Public Sub SetArmIdFieldValue(ByVal val As Int64) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.ArmIdColumn) + End Sub + ''' + ''' This is a convenience method that provides direct access to the value of the record's Arm_.ArmyId field. + ''' + Public Function GetArmyIdValue() As ColumnValue + Return Me.GetValue(TableUtils.ArmyIdColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's Arm_.ArmyId field. + ''' + Public Function GetArmyIdFieldValue() As Byte + Return CType(Me.GetValue(TableUtils.ArmyIdColumn).ToByte(), Byte) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Arm_.ArmyId field. + ''' + Public Sub SetArmyIdFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.ArmyIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Arm_.ArmyId field. + ''' + Public Sub SetArmyIdFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.ArmyIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Arm_.ArmyId field. + ''' + Public Sub SetArmyIdFieldValue(ByVal val As Double) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.ArmyIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Arm_.ArmyId field. + ''' + Public Sub SetArmyIdFieldValue(ByVal val As Decimal) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.ArmyIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Arm_.ArmyId field. + ''' + Public Sub SetArmyIdFieldValue(ByVal val As Int64) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.ArmyIdColumn) + End Sub + ''' + ''' This is a convenience method that provides direct access to the value of the record's Arm_.ArmSName field. + ''' + Public Function GetArmSNameValue() As ColumnValue + Return Me.GetValue(TableUtils.ArmSNameColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's Arm_.ArmSName field. + ''' + Public Function GetArmSNameFieldValue() As String + Return CType(Me.GetValue(TableUtils.ArmSNameColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Arm_.ArmSName field. + ''' + Public Sub SetArmSNameFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.ArmSNameColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Arm_.ArmSName field. + ''' + Public Sub SetArmSNameFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.ArmSNameColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's Arm_.ArmName field. + ''' + Public Function GetArmNameValue() As ColumnValue + Return Me.GetValue(TableUtils.ArmNameColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's Arm_.ArmName field. + ''' + Public Function GetArmNameFieldValue() As String + Return CType(Me.GetValue(TableUtils.ArmNameColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Arm_.ArmName field. + ''' + Public Sub SetArmNameFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.ArmNameColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Arm_.ArmName field. + ''' + Public Sub SetArmNameFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.ArmNameColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's Arm_.Party field. + ''' + Public Function GetPartyValue() As ColumnValue + Return Me.GetValue(TableUtils.PartyColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's Arm_.Party field. + ''' + Public Function GetPartyFieldValue() As String + Return CType(Me.GetValue(TableUtils.PartyColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Arm_.Party field. + ''' + Public Sub SetPartyFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.PartyColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Arm_.Party field. + ''' + Public Sub SetPartyFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.PartyColumn) + End Sub + + + +#End Region + +#Region "Convenience methods to get field names" + + ''' + ''' This is a convenience property that provides direct access to the value of the record's Arm_.ArmId field. + ''' + Public Property ArmId() As Int32 + Get + Return CType(Me.GetValue(TableUtils.ArmIdColumn).ToInt32(), Int32) + End Get + Set (ByVal val As Int32) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.ArmIdColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property ArmIdSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.ArmIdColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property ArmIdDefault() As String + Get + Return TableUtils.ArmIdColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's Arm_.ArmyId field. + ''' + Public Property ArmyId() As Byte + Get + Return CType(Me.GetValue(TableUtils.ArmyIdColumn).ToByte(), Byte) + End Get + Set (ByVal val As Byte) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.ArmyIdColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property ArmyIdSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.ArmyIdColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property ArmyIdDefault() As String + Get + Return TableUtils.ArmyIdColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's Arm_.ArmSName field. + ''' + Public Property ArmSName() As String + Get + Return CType(Me.GetValue(TableUtils.ArmSNameColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.ArmSNameColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property ArmSNameSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.ArmSNameColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property ArmSNameDefault() As String + Get + Return TableUtils.ArmSNameColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's Arm_.ArmName field. + ''' + Public Property ArmName() As String + Get + Return CType(Me.GetValue(TableUtils.ArmNameColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.ArmNameColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property ArmNameSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.ArmNameColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property ArmNameDefault() As String + Get + Return TableUtils.ArmNameColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's Arm_.Party field. + ''' + Public Property Party() As String + Get + Return CType(Me.GetValue(TableUtils.PartyColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.PartyColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property PartySpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.PartyColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property PartyDefault() As String + Get + Return TableUtils.PartyColumn.DefaultValue + End Get + End Property + + + +#End Region + +End Class +End Namespace diff --git a/App_Code/Business Layer/BaseArmTable.vb b/App_Code/Business Layer/BaseArmTable.vb new file mode 100644 index 0000000..073087e --- /dev/null +++ b/App_Code/Business Layer/BaseArmTable.vb @@ -0,0 +1,844 @@ +' This class is "generated" and will be overwritten. +' Your customizations should be made in ArmRecord.vb + +Imports System.Data.SqlTypes +Imports System.Data +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider +Imports Persons.Data + +Namespace Persons.Business + +''' +''' The generated superclass for the class. +''' Provides access to the schema information and record data of a database table or view named Arm. +''' +''' +''' The connection details (name, location, etc.) of the database and table (or view) accessed by this class +''' are resolved at runtime based on the connection string in the application's Web.Config file. +''' +''' This class is not intended to be instantiated directly. To obtain an instance of this class, use +''' ArmTable.Instance. +''' +''' +''' + + Public Class BaseArmTable + Inherits PrimaryKeyTable + + + Private ReadOnly TableDefinitionString As String = ArmDefinition.GetXMLString() + + + + + + + + Protected Sub New() + MyBase.New() + Me.Initialize() + End Sub + + Protected Overridable Sub Initialize() + Dim def As New XmlTableDefinition(TableDefinitionString) + Me.TableDefinition = New TableDefinition() + Me.TableDefinition.TableClassName = System.Reflection.Assembly.CreateQualifiedName("App_Code", "Persons.Business.ArmTable") + def.InitializeTableDefinition(Me.TableDefinition) + Me.ConnectionName = def.GetConnectionName() + Me.RecordClassName = System.Reflection.Assembly.CreateQualifiedName("App_Code", "Persons.Business.ArmRecord") + Me.ApplicationName = "App_Code" + Me.DataAdapter = New ArmSqlTable() + Directcast(Me.DataAdapter, ArmSqlTable).ConnectionName = Me.ConnectionName + + Me.TableDefinition.AdapterMetaData = Me.DataAdapter.AdapterMetaData + ArmIdColumn.CodeName = "ArmId" + ArmyIdColumn.CodeName = "ArmyId" + ArmSNameColumn.CodeName = "ArmSName" + ArmNameColumn.CodeName = "ArmName" + PartyColumn.CodeName = "Party" + + End Sub + +#Region "Overriden methods" + + +#End Region + +#Region "Properties for columns" + + ''' + ''' This is a convenience property that provides direct access to the table's Arm_.ArmId column object. + ''' + Public ReadOnly Property ArmIdColumn() As BaseClasses.Data.NumberColumn + Get + Return CType(Me.TableDefinition.ColumnList(0), BaseClasses.Data.NumberColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's Arm_.ArmId column object. + ''' + Public Shared ReadOnly Property ArmId() As BaseClasses.Data.NumberColumn + Get + Return ArmTable.Instance.ArmIdColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's Arm_.ArmyId column object. + ''' + Public ReadOnly Property ArmyIdColumn() As BaseClasses.Data.NumberColumn + Get + Return CType(Me.TableDefinition.ColumnList(1), BaseClasses.Data.NumberColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's Arm_.ArmyId column object. + ''' + Public Shared ReadOnly Property ArmyId() As BaseClasses.Data.NumberColumn + Get + Return ArmTable.Instance.ArmyIdColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's Arm_.ArmSName column object. + ''' + Public ReadOnly Property ArmSNameColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(2), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's Arm_.ArmSName column object. + ''' + Public Shared ReadOnly Property ArmSName() As BaseClasses.Data.StringColumn + Get + Return ArmTable.Instance.ArmSNameColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's Arm_.ArmName column object. + ''' + Public ReadOnly Property ArmNameColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(3), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's Arm_.ArmName column object. + ''' + Public Shared ReadOnly Property ArmName() As BaseClasses.Data.StringColumn + Get + Return ArmTable.Instance.ArmNameColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's Arm_.Party column object. + ''' + Public ReadOnly Property PartyColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(4), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's Arm_.Party column object. + ''' + Public Shared ReadOnly Property Party() As BaseClasses.Data.StringColumn + Get + Return ArmTable.Instance.PartyColumn + End Get + End Property + + +#End Region + + +#Region "Shared helper methods" + + ''' + ''' This is a shared function that can be used to get an array of ArmRecord records using a where clause. + ''' + Public Shared Function GetRecords(ByVal where As String) As ArmRecord() + + Return GetRecords(where, Nothing, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) + End Function + + ''' + ''' This is a shared function that can be used to get an array of ArmRecord records using a where clause. + ''' + Public Shared Function GetRecords(ByVal join As BaseFilter, ByVal where As String) As ArmRecord() + + Return GetRecords(join, where, Nothing, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) + End Function + + ''' + ''' This is a shared function that can be used to get an array of ArmRecord records using a where and order by clause. + ''' + Public Shared Function GetRecords( _ + ByVal where As String, _ + ByVal orderBy As OrderBy) As ArmRecord() + + Return GetRecords(where, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) + End Function + + ''' + ''' This is a shared function that can be used to get an array of ArmRecord records using a where and order by clause. + ''' + Public Shared Function GetRecords( _ + ByVal join As BaseFilter, _ + ByVal where As String, _ + ByVal orderBy As OrderBy) As ArmRecord() + + Return GetRecords(join, where, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) + End Function + + ''' + ''' This is a shared function that can be used to get an array of ArmRecord records using a where and order by clause clause with pagination. + ''' + Public Shared Function GetRecords( _ + ByVal where As String, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As ArmRecord() + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + Dim join As BaseClasses.Data.BaseFilter = Nothing + Dim recList As ArrayList = ArmTable.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, pageIndex, pageSize) + + Return CType(recList.ToArray(GetType(Persons.Business.ArmRecord)), ArmRecord()) + End Function + + ''' + ''' This is a shared function that can be used to get an array of ArmRecord records using a where and order by clause clause with pagination. + ''' + Public Shared Function GetRecords( _ + ByVal join As BaseFilter, _ + ByVal where As String, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As ArmRecord() + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Dim recList As ArrayList = ArmTable.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, pageIndex, pageSize) + + Return CType(recList.ToArray(GetType(Persons.Business.ArmRecord)), ArmRecord()) + End Function + + Public Shared Function GetRecords( _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As ArmRecord() + Dim join As BaseClasses.Data.BaseFilter = Nothing + Dim recList As ArrayList = ArmTable.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + Return CType(recList.ToArray(GetType(Persons.Business.ArmRecord)), ArmRecord()) + End Function + + Public Shared Function GetRecords( _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As ArmRecord() + + Dim recList As ArrayList = ArmTable.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + Return CType(recList.ToArray(GetType(Persons.Business.ArmRecord)), ArmRecord()) + End Function + + Public Shared Function GetRecords( _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer, _ + ByRef totalRecords As Integer) As ArmRecord() + Dim join As BaseClasses.Data.BaseFilter = Nothing + Dim recList As ArrayList = ArmTable.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize, totalRecords) + + Return CType(recList.ToArray(GetType(Persons.Business.ArmRecord)), ArmRecord()) + End Function + + Public Shared Function GetRecords( _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer, _ + ByRef totalRecords As Integer) As ArmRecord() + + Dim recList As ArrayList = ArmTable.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize, totalRecords) + + Return CType(recList.ToArray(GetType(Persons.Business.ArmRecord)), ArmRecord()) + End Function + + ''' + ''' This is a shared function that can be used to get total number of records that will be returned using the where clause. + ''' + Public Shared Function GetRecordCount(ByVal where As String) As Integer + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Return CInt(ArmTable.Instance.GetRecordListCount(Nothing, whereFilter, Nothing, Nothing)) + End Function + +''' + ''' This is a shared function that can be used to get total number of records that will be returned using the where clause. + ''' + Public Shared Function GetRecordCount(ByVal join As BaseFilter, ByVal where As String) As Integer + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Return CInt(ArmTable.Instance.GetRecordListCount(join, whereFilter, Nothing, Nothing)) + End Function + + Public Shared Function GetRecordCount(ByVal where As WhereClause) As Integer + Return CInt(ArmTable.Instance.GetRecordListCount(Nothing, where.GetFilter(), Nothing, Nothing)) + End Function + + Public Shared Function GetRecordCount(ByVal join As BaseFilter, ByVal where As WhereClause) As Integer + Return CInt(ArmTable.Instance.GetRecordListCount(join, where.GetFilter(), Nothing, Nothing)) + End Function + + ''' + ''' This is a shared function that can be used to get a ArmRecord record using a where clause. + ''' + Public Shared Function GetRecord(ByVal where As String) As ArmRecord + Dim orderBy As OrderBy = Nothing + Return GetRecord(where, orderBy) + End Function + + ''' + ''' This is a shared function that can be used to get a ArmRecord record using a where clause. + ''' + Public Shared Function GetRecord(ByVal join As BaseFilter, ByVal where As String) As ArmRecord + Dim orderBy As OrderBy = Nothing + Return GetRecord(join, where, orderBy) + End Function + + ''' + ''' This is a shared function that can be used to get a ArmRecord record using a where and order by clause. + ''' + Public Shared Function GetRecord( _ + ByVal where As String, _ + ByVal orderBy As OrderBy) As ArmRecord + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + Dim join As BaseClasses.Data.BaseFilter = Nothing + Dim recList As ArrayList = ArmTable.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MIN_BATCH_SIZE) + + Dim rec As ArmRecord = Nothing + If recList.Count > 0 Then + rec = CType(recList(0), ArmRecord) + End If + + Return rec + End Function + + ''' + ''' This is a shared function that can be used to get a ArmRecord record using a where and order by clause. + ''' + Public Shared Function GetRecord( _ + ByVal join As BaseFilter, _ + ByVal where As String, _ + ByVal orderBy As OrderBy) As ArmRecord + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Dim recList As ArrayList = ArmTable.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MIN_BATCH_SIZE) + + Dim rec As ArmRecord = Nothing + If recList.Count > 0 Then + rec = CType(recList(0), ArmRecord) + End If + + Return rec + End Function + + + Public Shared Function GetValues( _ + ByVal col As BaseColumn, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal maxItems As Integer) As String() + + ' Create the filter list. + Dim retCol As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, True) + retCol.AddColumn(col) + + Return ArmTable.Instance.GetColumnValues(retCol, Nothing, where.GetFilter(), Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, maxItems) + + End Function + + Public Shared Function GetValues( _ + ByVal col As BaseColumn, _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal maxItems As Integer) As String() + + ' Create the filter list. + Dim retCol As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, True) + retCol.AddColumn(col) + + Return ArmTable.Instance.GetColumnValues(retCol, join, where.GetFilter(), Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, maxItems) + + End Function + + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where clause. + ''' + Public Shared Function GetDataTable(ByVal where As String) As System.Data.DataTable + + Dim recs() As ArmRecord = GetRecords(where) + Return ArmTable.Instance.CreateDataTable(recs, Nothing) + End Function + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where clause. + ''' + Public Shared Function GetDataTable(ByVal join As BaseFilter, ByVal where As String) As System.Data.DataTable + + Dim recs() As ArmRecord = GetRecords(join, where) + Return ArmTable.Instance.CreateDataTable(recs, Nothing) + End Function + + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause. + ''' + Public Shared Function GetDataTable(ByVal where As String, ByVal orderBy As OrderBy) As System.Data.DataTable + + Dim recs() As ArmRecord = GetRecords(where, orderBy) + Return ArmTable.Instance.CreateDataTable(recs, Nothing) + End Function + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause. + ''' + Public Shared Function GetDataTable(ByVal join As BaseFilter, ByVal where As String, ByVal orderBy As OrderBy) As System.Data.DataTable + + Dim recs() As ArmRecord = GetRecords(join, where, orderBy) + Return ArmTable.Instance.CreateDataTable(recs, Nothing) + End Function + + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause with pagination. + ''' + Public Shared Function GetDataTable( _ + ByVal where As String, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As System.Data.DataTable + + Dim recs() As ArmRecord = GetRecords(where, orderBy, pageIndex, pageSize) + Return ArmTable.Instance.CreateDataTable(recs, Nothing) + End Function + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause with pagination. + ''' + Public Shared Function GetDataTable( _ + ByVal join As BaseFilter, _ + ByVal where As String, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As System.Data.DataTable + + Dim recs() As ArmRecord = GetRecords(join, where, orderBy, pageIndex, pageSize) + Return ArmTable.Instance.CreateDataTable(recs, Nothing) + End Function + + + ''' + ''' This is a shared function that can be used to delete records using a where clause. + ''' + Public Shared Sub DeleteRecords(ByVal where As String) + If where = Nothing OrElse where.Trim() = "" Then + Return + End If + + Dim whereFilter As SqlFilter = New SqlFilter(where) + ArmTable.Instance.DeleteRecordList(whereFilter) + End Sub + + ''' + ''' This is a shared function that can be used to export records using a where clause. + ''' + Public Shared Function Export(ByVal where As String) As String + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Return ArmTable.Instance.ExportRecordData(whereFilter) + End Function + + Public Shared Function Export(ByVal where As WhereClause) As String + Dim whereFilter As BaseFilter = Nothing + If Not where Is Nothing Then + whereFilter = where.GetFilter() + End If + + Return ArmTable.Instance.ExportRecordData(whereFilter) + End Function + + Public Shared Function GetSum( _ + ByVal col As BaseColumn, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) _ + As String + + Dim colSel As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, False) + colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Sum) + + Return ArmTable.Instance.GetColumnStatistics(colSel, Nothing, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + End Function + + Public Shared Function GetSum( _ + ByVal col As BaseColumn, _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) _ + As String + + Dim colSel As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, False) + colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Sum) + + Return ArmTable.Instance.GetColumnStatistics(colSel, join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + End Function + + + Public Shared Function GetCount( _ + ByVal col As BaseColumn, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) _ + As String + + Dim colSel As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, False) + colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Count) + + Return ArmTable.Instance.GetColumnStatistics(colSel, Nothing, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + End Function + + Public Shared Function GetCount( _ + ByVal col As BaseColumn, _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) _ + As String + + Dim colSel As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, False) + colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Count) + + Return ArmTable.Instance.GetColumnStatistics(colSel, join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + End Function + + ''' + ''' This method returns the columns in the table. + ''' + Public Shared Function GetColumns() As BaseColumn() + Return ArmTable.Instance.TableDefinition.Columns + End Function + + ''' + ''' This method returns the columnlist in the table. + ''' + Public Shared Function GetColumnList() As ColumnList + Return ArmTable.Instance.TableDefinition.ColumnList + End Function + + + ''' + ''' This method creates a new record and returns it to be edited. + ''' + Public Shared Function CreateNewRecord() As IRecord + Return ArmTable.Instance.CreateRecord() + End Function + + ''' + ''' This method creates a new record and returns it to be edited. + ''' + ''' ID of the new record. + Public Shared Function CreateNewRecord(ByVal tempId As String) As IRecord + Return ArmTable.Instance.CreateRecord(tempId) + End Function + + ''' + ''' This method checks if column is editable. + ''' + ''' Name of the column to check. + Public Shared Function isReadOnlyColumn(ByVal columnName As String) As Boolean + Dim column As BaseColumn = GetColumn(columnName) + If (Not IsNothing(column)) Then + Return column.IsValuesReadOnly + Else + Return True + End If + End Function + + ''' + ''' This method gets the specified column. + ''' + ''' Unique name of the column to fetch. + Public Shared Function GetColumn(ByVal uniqueColumnName As String) As BaseColumn + Dim column As BaseColumn = ArmTable.Instance.TableDefinition.ColumnList.GetByUniqueName(uniqueColumnName) + Return column + End Function + + ' Convenience method for getting a record using a string-based record identifier + Public Shared Function GetRecord(ByVal id As String, ByVal bMutable As Boolean) As ArmRecord + Return CType(ArmTable.Instance.GetRecordData(id, bMutable), ArmRecord) + End Function + + ' Convenience method for getting a record using a KeyValue record identifier + Public Shared Function GetRecord(ByVal id As KeyValue, ByVal bMutable As Boolean) As ArmRecord + Return CType(ArmTable.Instance.GetRecordData(id, bMutable), ArmRecord) + End Function + + ' Convenience method for creating a record + Public Overloads Function NewRecord( _ + ByVal ArmIdValue As String, _ + ByVal ArmyIdValue As String, _ + ByVal ArmSNameValue As String, _ + ByVal ArmNameValue As String, _ + ByVal PartyValue As String _ + ) As KeyValue + Dim rec As IPrimaryKeyRecord = CType(Me.CreateRecord(), IPrimaryKeyRecord) + rec.SetString(ArmIdValue, ArmIdColumn) + rec.SetString(ArmyIdValue, ArmyIdColumn) + rec.SetString(ArmSNameValue, ArmSNameColumn) + rec.SetString(ArmNameValue, ArmNameColumn) + rec.SetString(PartyValue, PartyColumn) + + + rec.Create() 'update the DB so any DB-initialized fields (like autoincrement IDs) can be initialized + + Dim key As KeyValue = rec.GetID() + Return key + End Function + + ''' + ''' This method deletes a specified record + ''' + ''' Keyvalue of the record to be deleted. + Public Shared Sub DeleteRecord(ByVal kv As KeyValue) + ArmTable.Instance.DeleteOneRecord(kv) + End Sub + + ''' + ''' This method checks if record exist in the database using the keyvalue provided. + ''' + ''' Key value of the record. + Public Shared Function DoesRecordExist(ByVal kv As KeyValue) As Boolean + Dim recordExist As Boolean = True + Try + ArmTable.GetRecord(kv, False) + Catch ex As Exception + recordExist = False + End Try + Return recordExist + End Function + + ''' + ''' This method returns all the primary columns in the table. + ''' + Public Shared Function GetPrimaryKeyColumns() As ColumnList + If (Not IsNothing(ArmTable.Instance.TableDefinition.PrimaryKey)) Then + Return ArmTable.Instance.TableDefinition.PrimaryKey.Columns + Else + Return Nothing + End If + End Function + + ''' + ''' This method takes a key and returns a keyvalue. + ''' + ''' key could be array of primary key values in case of composite primary key or a string containing single primary key value in case of non-composite primary key. + Public Shared Function GetKeyValue(ByVal key As Object) As KeyValue + Dim kv As KeyValue = Nothing + + If (Not (IsNothing(ArmTable.Instance.TableDefinition.PrimaryKey))) Then + + Dim isCompositePrimaryKey As Boolean = False + isCompositePrimaryKey = ArmTable.Instance.TableDefinition.PrimaryKey.IsCompositeKey + + If ((isCompositePrimaryKey) AndAlso (key.GetType.IsArray())) Then + + ' If the key is composite, then construct a key value. + kv = New KeyValue + Dim fullKeyString As String = "" + Dim keyArray As Array = CType(key, Array) + If (Not IsNothing(keyArray)) Then + Dim length As Integer = keyArray.Length + Dim pkColumns As ColumnList = ArmTable.Instance.TableDefinition.PrimaryKey.Columns + Dim pkColumn As BaseColumn + Dim index As Integer = 0 + For Each pkColumn In pkColumns + Dim keyString As String = CType(keyArray.GetValue(index), String) + If (ArmTable.Instance.TableDefinition.TableType = BaseClasses.Data.TableDefinition.TableTypes.Virtual) Then + kv.AddElement(pkColumn.UniqueName, keyString) + Else + kv.AddElement(pkColumn.InternalName, keyString) + End If + index = index + 1 + Next pkColumn + End If + + Else + ' If the key is not composite, then get the key value. + kv = ArmTable.Instance.TableDefinition.PrimaryKey.ParseValue(CType(key, String)) + End If + End If + Return kv + End Function + + + ''' + ''' This method takes a record and a Column and returns an evaluated value of DFKA formula. + ''' + Public Shared Function GetDFKA(ByVal rec As BaseRecord, ByVal col As BaseColumn) As String + Dim fkColumn As ForeignKey = ArmTable.Instance.TableDefinition.GetExpandableNonCompositeForeignKey(col) + If fkColumn Is Nothing Then + Return Nothing + End If + Dim _DFKA As String = fkColumn.PrimaryKeyDisplayColumns + If (_DFKA.Trim().StartsWith("=")) Then + ' if the formula is in the format of "= ., then pull out the data from the rec object instead of doing formula evaluation + Dim tableCodeName As String = fkColumn.PrimaryKeyTableDefinition.TableCodeName + Dim column As String = _DFKA.Trim("="c).Trim() + If column.StartsWith(tableCodeName & ".", StringComparison.InvariantCultureIgnoreCase) Then + column = column.Substring(tableCodeName.Length + 1) + End If + + For Each c As BaseColumn In fkColumn.PrimaryKeyTableDefinition.Columns + If column = c.CodeName Then + Return rec.Format(c) + End If + Next + Dim tableName As String = fkColumn.PrimaryKeyTableDefinition.TableCodeName + Return EvaluateFormula(_DFKA, rec, Nothing, tableName) + Else + Return Nothing + End If + End Function + + ''' + ''' This method takes a keyValue and a Column and returns an evaluated value of DFKA formula. + ''' + Public Shared Function GetDFKA(ByVal keyValue As String, ByVal col As BaseColumn, ByVal formatPattern as String) As String + If keyValue Is Nothing Then + Return Nothing + End If + Dim fkColumn As ForeignKey = ArmTable.Instance.TableDefinition.GetExpandableNonCompositeForeignKey(col) + If fkColumn Is Nothing Then + Return Nothing + End If + Dim _DFKA As String = fkColumn.PrimaryKeyDisplayColumns + If (_DFKA.Trim().StartsWith("=")) Then + Dim tableName As String = fkColumn.PrimaryKeyTableDefinition.TableCodeName + Dim t As PrimaryKeyTable = CType(DatabaseObjects.GetTableObject(tableName), PrimaryKeyTable) + Dim rec As BaseRecord = Nothing + If Not t Is Nothing Then + Try + rec = CType(t.GetRecordData(keyValue, False), BaseRecord) + Catch + rec = Nothing + End Try + End If + If rec Is Nothing Then + Return "" + End If + + ' if the formula is in the format of "= ., then pull out the data from the rec object instead of doing formula evaluation + Dim tableCodeName As String = fkColumn.PrimaryKeyTableDefinition.TableCodeName + Dim column As String = _DFKA.Trim("="c).Trim() + If column.StartsWith(tableCodeName & ".", StringComparison.InvariantCultureIgnoreCase) Then + column = column.Substring(tableCodeName.Length + 1) + End If + + For Each c As BaseColumn In fkColumn.PrimaryKeyTableDefinition.Columns + If column = c.CodeName Then + Return rec.Format(c) + End If + Next + Return EvaluateFormula(_DFKA, rec, Nothing, tableName) + Else + Return Nothing + End If + End Function + + ''' + ''' Evaluates the formula + ''' + Public Shared Function EvaluateFormula(ByVal formula As String, Optional ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord = Nothing, Optional ByVal format As String = Nothing, Optional ByVal name As String = "") As String + Dim e As BaseFormulaEvaluator = New BaseFormulaEvaluator() + If Not dataSourceForEvaluate Is Nothing Then + e.Evaluator.Variables.Add(name, dataSourceForEvaluate) + end if + e.DataSource = dataSourceForEvaluate + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + If Not String.IsNullOrEmpty(format) Then + Return BaseFormulaUtils.Format(resultObj, format) + Else + Return resultObj.ToString() + End If + End Function + + +#End Region + +End Class +End Namespace diff --git a/App_Code/Business Layer/BaseArmyRecord.vb b/App_Code/Business Layer/BaseArmyRecord.vb new file mode 100644 index 0000000..72a277e --- /dev/null +++ b/App_Code/Business Layer/BaseArmyRecord.vb @@ -0,0 +1,283 @@ +' This class is "generated" and will be overwritten. +' Your customizations should be made in ArmyRecord.vb + +Imports System.Data.SqlTypes +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + +Namespace Persons.Business + +''' +''' The generated superclass for the class. +''' +''' +''' This class is not intended to be instantiated directly. To obtain an instance of this class, +''' use the methods of the class. +''' +''' +''' + + Public Class BaseArmyRecord + Inherits PrimaryKeyRecord + + + Public Shared Shadows ReadOnly TableUtils As ArmyTable = ArmyTable.Instance + + ' Constructors + + Protected Sub New() + MyBase.New(TableUtils) + End Sub + + Protected Sub New(ByVal record As PrimaryKeyRecord) + MyBase.New(record, TableUtils) + End Sub + + 'Evaluates Initialize when->Inserting record formulas specified at the data access layer + Public Overridable Sub ArmyRecord_InsertingRecord(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles Me.InsertingRecord + 'Apply Initialize->Inserting record formula only if validation is successful. + Dim ArmyRec As ArmyRecord = CType(sender,ArmyRecord) + Validate_Inserting() + If Not ArmyRec Is Nothing AndAlso Not ArmyRec.IsReadOnly Then + End If + End Sub + + 'Evaluates Initialize when->Updating record formulas specified at the data access layer + Public Overridable Sub ArmyRecord_UpdatingRecord(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles Me.UpdatingRecord + 'Apply Initialize->Updating record formula only if validation is successful. + Dim ArmyRec As ArmyRecord = CType(sender,ArmyRecord) + Validate_Updating() + If Not ArmyRec Is Nothing AndAlso Not ArmyRec.IsReadOnly Then + End If + End Sub + + 'Evaluates Initialize when->Reading record formulas specified at the data access layer + Public Overridable Sub ArmyRecord_ReadRecord(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.ReadRecord + 'Apply Initialize->Reading record formula only if validation is successful. + Dim ArmyRec As ArmyRecord = CType(sender,ArmyRecord) + If Not ArmyRec Is Nothing AndAlso Not ArmyRec.IsReadOnly Then + End If + End Sub + + 'Evaluates Validate when->Inserting formulas specified at the data access layer + Public Overridable Sub Validate_Inserting () + Dim fullValidationMessage As String = "" + Dim validationMessage As String = "" + + dim formula as String = "" + + + If validationMessage <> "" AndAlso validationMessage.ToLower() <> "true" Then + fullValidationMessage &= validationMessage & vbCrLf + End If + + If fullValidationMessage <> "" Then + Throw New Exception(fullValidationMessage) + End If + End Sub + + 'Evaluates Validate when->Updating formulas specified at the data access layer + Public Overridable Sub Validate_Updating () + Dim fullValidationMessage As String = "" + Dim validationMessage As String = "" + + dim formula as String = "" + + + If validationMessage <> "" AndAlso validationMessage.ToLower() <> "true" Then + fullValidationMessage &= validationMessage & vbCrLf + End If + + If fullValidationMessage <> "" Then + Throw New Exception(fullValidationMessage) + End If + End Sub + + Public Overridable Function EvaluateFormula(ByVal formula As String, Optional ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord = Nothing, Optional ByVal format As String = Nothing) As String + + Dim e As Data.BaseFormulaEvaluator = New Data.BaseFormulaEvaluator() + + ' All variables referred to in the formula are expected to be + ' properties of the DataSource. For example, referring to + ' UnitPrice as a variable will refer to DataSource.UnitPrice + e.DataSource = dataSourceForEvaluate + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + Return resultObj.ToString() + End Function + + + + + + + +#Region "Convenience methods to get/set values of fields" + + ''' + ''' This is a convenience method that provides direct access to the value of the record's Army_.ArmyId field. + ''' + Public Function GetArmyIdValue() As ColumnValue + Return Me.GetValue(TableUtils.ArmyIdColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's Army_.ArmyId field. + ''' + Public Function GetArmyIdFieldValue() As Byte + Return CType(Me.GetValue(TableUtils.ArmyIdColumn).ToByte(), Byte) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Army_.ArmyId field. + ''' + Public Sub SetArmyIdFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.ArmyIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Army_.ArmyId field. + ''' + Public Sub SetArmyIdFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.ArmyIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Army_.ArmyId field. + ''' + Public Sub SetArmyIdFieldValue(ByVal val As Double) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.ArmyIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Army_.ArmyId field. + ''' + Public Sub SetArmyIdFieldValue(ByVal val As Decimal) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.ArmyIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Army_.ArmyId field. + ''' + Public Sub SetArmyIdFieldValue(ByVal val As Int64) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.ArmyIdColumn) + End Sub + ''' + ''' This is a convenience method that provides direct access to the value of the record's Army_.Army field. + ''' + Public Function GetArmyValue() As ColumnValue + Return Me.GetValue(TableUtils.ArmyColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's Army_.Army field. + ''' + Public Function GetArmyFieldValue() As String + Return CType(Me.GetValue(TableUtils.ArmyColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Army_.Army field. + ''' + Public Sub SetArmyFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.ArmyColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Army_.Army field. + ''' + Public Sub SetArmyFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.ArmyColumn) + End Sub + + + +#End Region + +#Region "Convenience methods to get field names" + + ''' + ''' This is a convenience property that provides direct access to the value of the record's Army_.ArmyId field. + ''' + Public Property ArmyId() As Byte + Get + Return CType(Me.GetValue(TableUtils.ArmyIdColumn).ToByte(), Byte) + End Get + Set (ByVal val As Byte) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.ArmyIdColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property ArmyIdSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.ArmyIdColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property ArmyIdDefault() As String + Get + Return TableUtils.ArmyIdColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's Army_.Army field. + ''' + Public Property Army() As String + Get + Return CType(Me.GetValue(TableUtils.ArmyColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.ArmyColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property ArmySpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.ArmyColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property ArmyDefault() As String + Get + Return TableUtils.ArmyColumn.DefaultValue + End Get + End Property + + + +#End Region + +End Class +End Namespace diff --git a/App_Code/Business Layer/BaseArmyTable.vb b/App_Code/Business Layer/BaseArmyTable.vb new file mode 100644 index 0000000..a0e7f0e --- /dev/null +++ b/App_Code/Business Layer/BaseArmyTable.vb @@ -0,0 +1,778 @@ +' This class is "generated" and will be overwritten. +' Your customizations should be made in ArmyRecord.vb + +Imports System.Data.SqlTypes +Imports System.Data +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider +Imports Persons.Data + +Namespace Persons.Business + +''' +''' The generated superclass for the class. +''' Provides access to the schema information and record data of a database table or view named Army. +''' +''' +''' The connection details (name, location, etc.) of the database and table (or view) accessed by this class +''' are resolved at runtime based on the connection string in the application's Web.Config file. +''' +''' This class is not intended to be instantiated directly. To obtain an instance of this class, use +''' ArmyTable.Instance. +''' +''' +''' + + Public Class BaseArmyTable + Inherits PrimaryKeyTable + + + Private ReadOnly TableDefinitionString As String = ArmyDefinition.GetXMLString() + + + + + + + + Protected Sub New() + MyBase.New() + Me.Initialize() + End Sub + + Protected Overridable Sub Initialize() + Dim def As New XmlTableDefinition(TableDefinitionString) + Me.TableDefinition = New TableDefinition() + Me.TableDefinition.TableClassName = System.Reflection.Assembly.CreateQualifiedName("App_Code", "Persons.Business.ArmyTable") + def.InitializeTableDefinition(Me.TableDefinition) + Me.ConnectionName = def.GetConnectionName() + Me.RecordClassName = System.Reflection.Assembly.CreateQualifiedName("App_Code", "Persons.Business.ArmyRecord") + Me.ApplicationName = "App_Code" + Me.DataAdapter = New ArmySqlTable() + Directcast(Me.DataAdapter, ArmySqlTable).ConnectionName = Me.ConnectionName + + Me.TableDefinition.AdapterMetaData = Me.DataAdapter.AdapterMetaData + ArmyIdColumn.CodeName = "ArmyId" + ArmyColumn.CodeName = "Army" + + End Sub + +#Region "Overriden methods" + + +#End Region + +#Region "Properties for columns" + + ''' + ''' This is a convenience property that provides direct access to the table's Army_.ArmyId column object. + ''' + Public ReadOnly Property ArmyIdColumn() As BaseClasses.Data.NumberColumn + Get + Return CType(Me.TableDefinition.ColumnList(0), BaseClasses.Data.NumberColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's Army_.ArmyId column object. + ''' + Public Shared ReadOnly Property ArmyId() As BaseClasses.Data.NumberColumn + Get + Return ArmyTable.Instance.ArmyIdColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's Army_.Army column object. + ''' + Public ReadOnly Property ArmyColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(1), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's Army_.Army column object. + ''' + Public Shared ReadOnly Property Army() As BaseClasses.Data.StringColumn + Get + Return ArmyTable.Instance.ArmyColumn + End Get + End Property + + +#End Region + + +#Region "Shared helper methods" + + ''' + ''' This is a shared function that can be used to get an array of ArmyRecord records using a where clause. + ''' + Public Shared Function GetRecords(ByVal where As String) As ArmyRecord() + + Return GetRecords(where, Nothing, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) + End Function + + ''' + ''' This is a shared function that can be used to get an array of ArmyRecord records using a where clause. + ''' + Public Shared Function GetRecords(ByVal join As BaseFilter, ByVal where As String) As ArmyRecord() + + Return GetRecords(join, where, Nothing, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) + End Function + + ''' + ''' This is a shared function that can be used to get an array of ArmyRecord records using a where and order by clause. + ''' + Public Shared Function GetRecords( _ + ByVal where As String, _ + ByVal orderBy As OrderBy) As ArmyRecord() + + Return GetRecords(where, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) + End Function + + ''' + ''' This is a shared function that can be used to get an array of ArmyRecord records using a where and order by clause. + ''' + Public Shared Function GetRecords( _ + ByVal join As BaseFilter, _ + ByVal where As String, _ + ByVal orderBy As OrderBy) As ArmyRecord() + + Return GetRecords(join, where, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) + End Function + + ''' + ''' This is a shared function that can be used to get an array of ArmyRecord records using a where and order by clause clause with pagination. + ''' + Public Shared Function GetRecords( _ + ByVal where As String, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As ArmyRecord() + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + Dim join As BaseClasses.Data.BaseFilter = Nothing + Dim recList As ArrayList = ArmyTable.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, pageIndex, pageSize) + + Return CType(recList.ToArray(GetType(Persons.Business.ArmyRecord)), ArmyRecord()) + End Function + + ''' + ''' This is a shared function that can be used to get an array of ArmyRecord records using a where and order by clause clause with pagination. + ''' + Public Shared Function GetRecords( _ + ByVal join As BaseFilter, _ + ByVal where As String, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As ArmyRecord() + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Dim recList As ArrayList = ArmyTable.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, pageIndex, pageSize) + + Return CType(recList.ToArray(GetType(Persons.Business.ArmyRecord)), ArmyRecord()) + End Function + + Public Shared Function GetRecords( _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As ArmyRecord() + Dim join As BaseClasses.Data.BaseFilter = Nothing + Dim recList As ArrayList = ArmyTable.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + Return CType(recList.ToArray(GetType(Persons.Business.ArmyRecord)), ArmyRecord()) + End Function + + Public Shared Function GetRecords( _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As ArmyRecord() + + Dim recList As ArrayList = ArmyTable.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + Return CType(recList.ToArray(GetType(Persons.Business.ArmyRecord)), ArmyRecord()) + End Function + + Public Shared Function GetRecords( _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer, _ + ByRef totalRecords As Integer) As ArmyRecord() + Dim join As BaseClasses.Data.BaseFilter = Nothing + Dim recList As ArrayList = ArmyTable.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize, totalRecords) + + Return CType(recList.ToArray(GetType(Persons.Business.ArmyRecord)), ArmyRecord()) + End Function + + Public Shared Function GetRecords( _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer, _ + ByRef totalRecords As Integer) As ArmyRecord() + + Dim recList As ArrayList = ArmyTable.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize, totalRecords) + + Return CType(recList.ToArray(GetType(Persons.Business.ArmyRecord)), ArmyRecord()) + End Function + + ''' + ''' This is a shared function that can be used to get total number of records that will be returned using the where clause. + ''' + Public Shared Function GetRecordCount(ByVal where As String) As Integer + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Return CInt(ArmyTable.Instance.GetRecordListCount(Nothing, whereFilter, Nothing, Nothing)) + End Function + +''' + ''' This is a shared function that can be used to get total number of records that will be returned using the where clause. + ''' + Public Shared Function GetRecordCount(ByVal join As BaseFilter, ByVal where As String) As Integer + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Return CInt(ArmyTable.Instance.GetRecordListCount(join, whereFilter, Nothing, Nothing)) + End Function + + Public Shared Function GetRecordCount(ByVal where As WhereClause) As Integer + Return CInt(ArmyTable.Instance.GetRecordListCount(Nothing, where.GetFilter(), Nothing, Nothing)) + End Function + + Public Shared Function GetRecordCount(ByVal join As BaseFilter, ByVal where As WhereClause) As Integer + Return CInt(ArmyTable.Instance.GetRecordListCount(join, where.GetFilter(), Nothing, Nothing)) + End Function + + ''' + ''' This is a shared function that can be used to get a ArmyRecord record using a where clause. + ''' + Public Shared Function GetRecord(ByVal where As String) As ArmyRecord + Dim orderBy As OrderBy = Nothing + Return GetRecord(where, orderBy) + End Function + + ''' + ''' This is a shared function that can be used to get a ArmyRecord record using a where clause. + ''' + Public Shared Function GetRecord(ByVal join As BaseFilter, ByVal where As String) As ArmyRecord + Dim orderBy As OrderBy = Nothing + Return GetRecord(join, where, orderBy) + End Function + + ''' + ''' This is a shared function that can be used to get a ArmyRecord record using a where and order by clause. + ''' + Public Shared Function GetRecord( _ + ByVal where As String, _ + ByVal orderBy As OrderBy) As ArmyRecord + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + Dim join As BaseClasses.Data.BaseFilter = Nothing + Dim recList As ArrayList = ArmyTable.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MIN_BATCH_SIZE) + + Dim rec As ArmyRecord = Nothing + If recList.Count > 0 Then + rec = CType(recList(0), ArmyRecord) + End If + + Return rec + End Function + + ''' + ''' This is a shared function that can be used to get a ArmyRecord record using a where and order by clause. + ''' + Public Shared Function GetRecord( _ + ByVal join As BaseFilter, _ + ByVal where As String, _ + ByVal orderBy As OrderBy) As ArmyRecord + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Dim recList As ArrayList = ArmyTable.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MIN_BATCH_SIZE) + + Dim rec As ArmyRecord = Nothing + If recList.Count > 0 Then + rec = CType(recList(0), ArmyRecord) + End If + + Return rec + End Function + + + Public Shared Function GetValues( _ + ByVal col As BaseColumn, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal maxItems As Integer) As String() + + ' Create the filter list. + Dim retCol As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, True) + retCol.AddColumn(col) + + Return ArmyTable.Instance.GetColumnValues(retCol, Nothing, where.GetFilter(), Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, maxItems) + + End Function + + Public Shared Function GetValues( _ + ByVal col As BaseColumn, _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal maxItems As Integer) As String() + + ' Create the filter list. + Dim retCol As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, True) + retCol.AddColumn(col) + + Return ArmyTable.Instance.GetColumnValues(retCol, join, where.GetFilter(), Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, maxItems) + + End Function + + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where clause. + ''' + Public Shared Function GetDataTable(ByVal where As String) As System.Data.DataTable + + Dim recs() As ArmyRecord = GetRecords(where) + Return ArmyTable.Instance.CreateDataTable(recs, Nothing) + End Function + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where clause. + ''' + Public Shared Function GetDataTable(ByVal join As BaseFilter, ByVal where As String) As System.Data.DataTable + + Dim recs() As ArmyRecord = GetRecords(join, where) + Return ArmyTable.Instance.CreateDataTable(recs, Nothing) + End Function + + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause. + ''' + Public Shared Function GetDataTable(ByVal where As String, ByVal orderBy As OrderBy) As System.Data.DataTable + + Dim recs() As ArmyRecord = GetRecords(where, orderBy) + Return ArmyTable.Instance.CreateDataTable(recs, Nothing) + End Function + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause. + ''' + Public Shared Function GetDataTable(ByVal join As BaseFilter, ByVal where As String, ByVal orderBy As OrderBy) As System.Data.DataTable + + Dim recs() As ArmyRecord = GetRecords(join, where, orderBy) + Return ArmyTable.Instance.CreateDataTable(recs, Nothing) + End Function + + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause with pagination. + ''' + Public Shared Function GetDataTable( _ + ByVal where As String, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As System.Data.DataTable + + Dim recs() As ArmyRecord = GetRecords(where, orderBy, pageIndex, pageSize) + Return ArmyTable.Instance.CreateDataTable(recs, Nothing) + End Function + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause with pagination. + ''' + Public Shared Function GetDataTable( _ + ByVal join As BaseFilter, _ + ByVal where As String, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As System.Data.DataTable + + Dim recs() As ArmyRecord = GetRecords(join, where, orderBy, pageIndex, pageSize) + Return ArmyTable.Instance.CreateDataTable(recs, Nothing) + End Function + + + ''' + ''' This is a shared function that can be used to delete records using a where clause. + ''' + Public Shared Sub DeleteRecords(ByVal where As String) + If where = Nothing OrElse where.Trim() = "" Then + Return + End If + + Dim whereFilter As SqlFilter = New SqlFilter(where) + ArmyTable.Instance.DeleteRecordList(whereFilter) + End Sub + + ''' + ''' This is a shared function that can be used to export records using a where clause. + ''' + Public Shared Function Export(ByVal where As String) As String + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Return ArmyTable.Instance.ExportRecordData(whereFilter) + End Function + + Public Shared Function Export(ByVal where As WhereClause) As String + Dim whereFilter As BaseFilter = Nothing + If Not where Is Nothing Then + whereFilter = where.GetFilter() + End If + + Return ArmyTable.Instance.ExportRecordData(whereFilter) + End Function + + Public Shared Function GetSum( _ + ByVal col As BaseColumn, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) _ + As String + + Dim colSel As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, False) + colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Sum) + + Return ArmyTable.Instance.GetColumnStatistics(colSel, Nothing, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + End Function + + Public Shared Function GetSum( _ + ByVal col As BaseColumn, _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) _ + As String + + Dim colSel As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, False) + colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Sum) + + Return ArmyTable.Instance.GetColumnStatistics(colSel, join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + End Function + + + Public Shared Function GetCount( _ + ByVal col As BaseColumn, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) _ + As String + + Dim colSel As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, False) + colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Count) + + Return ArmyTable.Instance.GetColumnStatistics(colSel, Nothing, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + End Function + + Public Shared Function GetCount( _ + ByVal col As BaseColumn, _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) _ + As String + + Dim colSel As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, False) + colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Count) + + Return ArmyTable.Instance.GetColumnStatistics(colSel, join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + End Function + + ''' + ''' This method returns the columns in the table. + ''' + Public Shared Function GetColumns() As BaseColumn() + Return ArmyTable.Instance.TableDefinition.Columns + End Function + + ''' + ''' This method returns the columnlist in the table. + ''' + Public Shared Function GetColumnList() As ColumnList + Return ArmyTable.Instance.TableDefinition.ColumnList + End Function + + + ''' + ''' This method creates a new record and returns it to be edited. + ''' + Public Shared Function CreateNewRecord() As IRecord + Return ArmyTable.Instance.CreateRecord() + End Function + + ''' + ''' This method creates a new record and returns it to be edited. + ''' + ''' ID of the new record. + Public Shared Function CreateNewRecord(ByVal tempId As String) As IRecord + Return ArmyTable.Instance.CreateRecord(tempId) + End Function + + ''' + ''' This method checks if column is editable. + ''' + ''' Name of the column to check. + Public Shared Function isReadOnlyColumn(ByVal columnName As String) As Boolean + Dim column As BaseColumn = GetColumn(columnName) + If (Not IsNothing(column)) Then + Return column.IsValuesReadOnly + Else + Return True + End If + End Function + + ''' + ''' This method gets the specified column. + ''' + ''' Unique name of the column to fetch. + Public Shared Function GetColumn(ByVal uniqueColumnName As String) As BaseColumn + Dim column As BaseColumn = ArmyTable.Instance.TableDefinition.ColumnList.GetByUniqueName(uniqueColumnName) + Return column + End Function + + ' Convenience method for getting a record using a string-based record identifier + Public Shared Function GetRecord(ByVal id As String, ByVal bMutable As Boolean) As ArmyRecord + Return CType(ArmyTable.Instance.GetRecordData(id, bMutable), ArmyRecord) + End Function + + ' Convenience method for getting a record using a KeyValue record identifier + Public Shared Function GetRecord(ByVal id As KeyValue, ByVal bMutable As Boolean) As ArmyRecord + Return CType(ArmyTable.Instance.GetRecordData(id, bMutable), ArmyRecord) + End Function + + ' Convenience method for creating a record + Public Overloads Function NewRecord( _ + ByVal ArmyIdValue As String, _ + ByVal ArmyValue As String _ + ) As KeyValue + Dim rec As IPrimaryKeyRecord = CType(Me.CreateRecord(), IPrimaryKeyRecord) + rec.SetString(ArmyIdValue, ArmyIdColumn) + rec.SetString(ArmyValue, ArmyColumn) + + + rec.Create() 'update the DB so any DB-initialized fields (like autoincrement IDs) can be initialized + + Dim key As KeyValue = rec.GetID() + Return key + End Function + + ''' + ''' This method deletes a specified record + ''' + ''' Keyvalue of the record to be deleted. + Public Shared Sub DeleteRecord(ByVal kv As KeyValue) + ArmyTable.Instance.DeleteOneRecord(kv) + End Sub + + ''' + ''' This method checks if record exist in the database using the keyvalue provided. + ''' + ''' Key value of the record. + Public Shared Function DoesRecordExist(ByVal kv As KeyValue) As Boolean + Dim recordExist As Boolean = True + Try + ArmyTable.GetRecord(kv, False) + Catch ex As Exception + recordExist = False + End Try + Return recordExist + End Function + + ''' + ''' This method returns all the primary columns in the table. + ''' + Public Shared Function GetPrimaryKeyColumns() As ColumnList + If (Not IsNothing(ArmyTable.Instance.TableDefinition.PrimaryKey)) Then + Return ArmyTable.Instance.TableDefinition.PrimaryKey.Columns + Else + Return Nothing + End If + End Function + + ''' + ''' This method takes a key and returns a keyvalue. + ''' + ''' key could be array of primary key values in case of composite primary key or a string containing single primary key value in case of non-composite primary key. + Public Shared Function GetKeyValue(ByVal key As Object) As KeyValue + Dim kv As KeyValue = Nothing + + If (Not (IsNothing(ArmyTable.Instance.TableDefinition.PrimaryKey))) Then + + Dim isCompositePrimaryKey As Boolean = False + isCompositePrimaryKey = ArmyTable.Instance.TableDefinition.PrimaryKey.IsCompositeKey + + If ((isCompositePrimaryKey) AndAlso (key.GetType.IsArray())) Then + + ' If the key is composite, then construct a key value. + kv = New KeyValue + Dim fullKeyString As String = "" + Dim keyArray As Array = CType(key, Array) + If (Not IsNothing(keyArray)) Then + Dim length As Integer = keyArray.Length + Dim pkColumns As ColumnList = ArmyTable.Instance.TableDefinition.PrimaryKey.Columns + Dim pkColumn As BaseColumn + Dim index As Integer = 0 + For Each pkColumn In pkColumns + Dim keyString As String = CType(keyArray.GetValue(index), String) + If (ArmyTable.Instance.TableDefinition.TableType = BaseClasses.Data.TableDefinition.TableTypes.Virtual) Then + kv.AddElement(pkColumn.UniqueName, keyString) + Else + kv.AddElement(pkColumn.InternalName, keyString) + End If + index = index + 1 + Next pkColumn + End If + + Else + ' If the key is not composite, then get the key value. + kv = ArmyTable.Instance.TableDefinition.PrimaryKey.ParseValue(CType(key, String)) + End If + End If + Return kv + End Function + + + ''' + ''' This method takes a record and a Column and returns an evaluated value of DFKA formula. + ''' + Public Shared Function GetDFKA(ByVal rec As BaseRecord, ByVal col As BaseColumn) As String + Dim fkColumn As ForeignKey = ArmyTable.Instance.TableDefinition.GetExpandableNonCompositeForeignKey(col) + If fkColumn Is Nothing Then + Return Nothing + End If + Dim _DFKA As String = fkColumn.PrimaryKeyDisplayColumns + If (_DFKA.Trim().StartsWith("=")) Then + ' if the formula is in the format of "= ., then pull out the data from the rec object instead of doing formula evaluation + Dim tableCodeName As String = fkColumn.PrimaryKeyTableDefinition.TableCodeName + Dim column As String = _DFKA.Trim("="c).Trim() + If column.StartsWith(tableCodeName & ".", StringComparison.InvariantCultureIgnoreCase) Then + column = column.Substring(tableCodeName.Length + 1) + End If + + For Each c As BaseColumn In fkColumn.PrimaryKeyTableDefinition.Columns + If column = c.CodeName Then + Return rec.Format(c) + End If + Next + Dim tableName As String = fkColumn.PrimaryKeyTableDefinition.TableCodeName + Return EvaluateFormula(_DFKA, rec, Nothing, tableName) + Else + Return Nothing + End If + End Function + + ''' + ''' This method takes a keyValue and a Column and returns an evaluated value of DFKA formula. + ''' + Public Shared Function GetDFKA(ByVal keyValue As String, ByVal col As BaseColumn, ByVal formatPattern as String) As String + If keyValue Is Nothing Then + Return Nothing + End If + Dim fkColumn As ForeignKey = ArmyTable.Instance.TableDefinition.GetExpandableNonCompositeForeignKey(col) + If fkColumn Is Nothing Then + Return Nothing + End If + Dim _DFKA As String = fkColumn.PrimaryKeyDisplayColumns + If (_DFKA.Trim().StartsWith("=")) Then + Dim tableName As String = fkColumn.PrimaryKeyTableDefinition.TableCodeName + Dim t As PrimaryKeyTable = CType(DatabaseObjects.GetTableObject(tableName), PrimaryKeyTable) + Dim rec As BaseRecord = Nothing + If Not t Is Nothing Then + Try + rec = CType(t.GetRecordData(keyValue, False), BaseRecord) + Catch + rec = Nothing + End Try + End If + If rec Is Nothing Then + Return "" + End If + + ' if the formula is in the format of "= ., then pull out the data from the rec object instead of doing formula evaluation + Dim tableCodeName As String = fkColumn.PrimaryKeyTableDefinition.TableCodeName + Dim column As String = _DFKA.Trim("="c).Trim() + If column.StartsWith(tableCodeName & ".", StringComparison.InvariantCultureIgnoreCase) Then + column = column.Substring(tableCodeName.Length + 1) + End If + + For Each c As BaseColumn In fkColumn.PrimaryKeyTableDefinition.Columns + If column = c.CodeName Then + Return rec.Format(c) + End If + Next + Return EvaluateFormula(_DFKA, rec, Nothing, tableName) + Else + Return Nothing + End If + End Function + + ''' + ''' Evaluates the formula + ''' + Public Shared Function EvaluateFormula(ByVal formula As String, Optional ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord = Nothing, Optional ByVal format As String = Nothing, Optional ByVal name As String = "") As String + Dim e As BaseFormulaEvaluator = New BaseFormulaEvaluator() + If Not dataSourceForEvaluate Is Nothing Then + e.Evaluator.Variables.Add(name, dataSourceForEvaluate) + end if + e.DataSource = dataSourceForEvaluate + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + If Not String.IsNullOrEmpty(format) Then + Return BaseFormulaUtils.Format(resultObj, format) + Else + Return resultObj.ToString() + End If + End Function + + +#End Region + +End Class +End Namespace diff --git a/App_Code/Business Layer/BaseBloodIdRecord.vb b/App_Code/Business Layer/BaseBloodIdRecord.vb new file mode 100644 index 0000000..4df06be --- /dev/null +++ b/App_Code/Business Layer/BaseBloodIdRecord.vb @@ -0,0 +1,283 @@ +' This class is "generated" and will be overwritten. +' Your customizations should be made in BloodIdRecord.vb + +Imports System.Data.SqlTypes +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + +Namespace Persons.Business + +''' +''' The generated superclass for the class. +''' +''' +''' This class is not intended to be instantiated directly. To obtain an instance of this class, +''' use the methods of the class. +''' +''' +''' + + Public Class BaseBloodIdRecord + Inherits PrimaryKeyRecord + + + Public Shared Shadows ReadOnly TableUtils As BloodIdTable = BloodIdTable.Instance + + ' Constructors + + Protected Sub New() + MyBase.New(TableUtils) + End Sub + + Protected Sub New(ByVal record As PrimaryKeyRecord) + MyBase.New(record, TableUtils) + End Sub + + 'Evaluates Initialize when->Inserting record formulas specified at the data access layer + Public Overridable Sub BloodIdRecord_InsertingRecord(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles Me.InsertingRecord + 'Apply Initialize->Inserting record formula only if validation is successful. + Dim BloodIdRec As BloodIdRecord = CType(sender,BloodIdRecord) + Validate_Inserting() + If Not BloodIdRec Is Nothing AndAlso Not BloodIdRec.IsReadOnly Then + End If + End Sub + + 'Evaluates Initialize when->Updating record formulas specified at the data access layer + Public Overridable Sub BloodIdRecord_UpdatingRecord(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles Me.UpdatingRecord + 'Apply Initialize->Updating record formula only if validation is successful. + Dim BloodIdRec As BloodIdRecord = CType(sender,BloodIdRecord) + Validate_Updating() + If Not BloodIdRec Is Nothing AndAlso Not BloodIdRec.IsReadOnly Then + End If + End Sub + + 'Evaluates Initialize when->Reading record formulas specified at the data access layer + Public Overridable Sub BloodIdRecord_ReadRecord(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.ReadRecord + 'Apply Initialize->Reading record formula only if validation is successful. + Dim BloodIdRec As BloodIdRecord = CType(sender,BloodIdRecord) + If Not BloodIdRec Is Nothing AndAlso Not BloodIdRec.IsReadOnly Then + End If + End Sub + + 'Evaluates Validate when->Inserting formulas specified at the data access layer + Public Overridable Sub Validate_Inserting () + Dim fullValidationMessage As String = "" + Dim validationMessage As String = "" + + dim formula as String = "" + + + If validationMessage <> "" AndAlso validationMessage.ToLower() <> "true" Then + fullValidationMessage &= validationMessage & vbCrLf + End If + + If fullValidationMessage <> "" Then + Throw New Exception(fullValidationMessage) + End If + End Sub + + 'Evaluates Validate when->Updating formulas specified at the data access layer + Public Overridable Sub Validate_Updating () + Dim fullValidationMessage As String = "" + Dim validationMessage As String = "" + + dim formula as String = "" + + + If validationMessage <> "" AndAlso validationMessage.ToLower() <> "true" Then + fullValidationMessage &= validationMessage & vbCrLf + End If + + If fullValidationMessage <> "" Then + Throw New Exception(fullValidationMessage) + End If + End Sub + + Public Overridable Function EvaluateFormula(ByVal formula As String, Optional ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord = Nothing, Optional ByVal format As String = Nothing) As String + + Dim e As Data.BaseFormulaEvaluator = New Data.BaseFormulaEvaluator() + + ' All variables referred to in the formula are expected to be + ' properties of the DataSource. For example, referring to + ' UnitPrice as a variable will refer to DataSource.UnitPrice + e.DataSource = dataSourceForEvaluate + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + Return resultObj.ToString() + End Function + + + + + + + +#Region "Convenience methods to get/set values of fields" + + ''' + ''' This is a convenience method that provides direct access to the value of the record's BloodId_.BloodId field. + ''' + Public Function GetBloodIdValue() As ColumnValue + Return Me.GetValue(TableUtils.BloodIdColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's BloodId_.BloodId field. + ''' + Public Function GetBloodIdFieldValue() As Byte + Return CType(Me.GetValue(TableUtils.BloodIdColumn).ToByte(), Byte) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's BloodId_.BloodId field. + ''' + Public Sub SetBloodIdFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.BloodIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's BloodId_.BloodId field. + ''' + Public Sub SetBloodIdFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.BloodIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's BloodId_.BloodId field. + ''' + Public Sub SetBloodIdFieldValue(ByVal val As Double) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.BloodIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's BloodId_.BloodId field. + ''' + Public Sub SetBloodIdFieldValue(ByVal val As Decimal) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.BloodIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's BloodId_.BloodId field. + ''' + Public Sub SetBloodIdFieldValue(ByVal val As Int64) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.BloodIdColumn) + End Sub + ''' + ''' This is a convenience method that provides direct access to the value of the record's BloodId_.BloodName field. + ''' + Public Function GetBloodNameValue() As ColumnValue + Return Me.GetValue(TableUtils.BloodNameColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's BloodId_.BloodName field. + ''' + Public Function GetBloodNameFieldValue() As String + Return CType(Me.GetValue(TableUtils.BloodNameColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's BloodId_.BloodName field. + ''' + Public Sub SetBloodNameFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.BloodNameColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's BloodId_.BloodName field. + ''' + Public Sub SetBloodNameFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.BloodNameColumn) + End Sub + + + +#End Region + +#Region "Convenience methods to get field names" + + ''' + ''' This is a convenience property that provides direct access to the value of the record's BloodId_.BloodId field. + ''' + Public Property BloodId() As Byte + Get + Return CType(Me.GetValue(TableUtils.BloodIdColumn).ToByte(), Byte) + End Get + Set (ByVal val As Byte) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.BloodIdColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property BloodIdSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.BloodIdColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property BloodIdDefault() As String + Get + Return TableUtils.BloodIdColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's BloodId_.BloodName field. + ''' + Public Property BloodName() As String + Get + Return CType(Me.GetValue(TableUtils.BloodNameColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.BloodNameColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property BloodNameSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.BloodNameColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property BloodNameDefault() As String + Get + Return TableUtils.BloodNameColumn.DefaultValue + End Get + End Property + + + +#End Region + +End Class +End Namespace diff --git a/App_Code/Business Layer/BaseBloodIdTable.vb b/App_Code/Business Layer/BaseBloodIdTable.vb new file mode 100644 index 0000000..b2e8371 --- /dev/null +++ b/App_Code/Business Layer/BaseBloodIdTable.vb @@ -0,0 +1,778 @@ +' This class is "generated" and will be overwritten. +' Your customizations should be made in BloodIdRecord.vb + +Imports System.Data.SqlTypes +Imports System.Data +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider +Imports Persons.Data + +Namespace Persons.Business + +''' +''' The generated superclass for the class. +''' Provides access to the schema information and record data of a database table or view named BloodId. +''' +''' +''' The connection details (name, location, etc.) of the database and table (or view) accessed by this class +''' are resolved at runtime based on the connection string in the application's Web.Config file. +''' +''' This class is not intended to be instantiated directly. To obtain an instance of this class, use +''' BloodIdTable.Instance. +''' +''' +''' + + Public Class BaseBloodIdTable + Inherits PrimaryKeyTable + + + Private ReadOnly TableDefinitionString As String = BloodIdDefinition.GetXMLString() + + + + + + + + Protected Sub New() + MyBase.New() + Me.Initialize() + End Sub + + Protected Overridable Sub Initialize() + Dim def As New XmlTableDefinition(TableDefinitionString) + Me.TableDefinition = New TableDefinition() + Me.TableDefinition.TableClassName = System.Reflection.Assembly.CreateQualifiedName("App_Code", "Persons.Business.BloodIdTable") + def.InitializeTableDefinition(Me.TableDefinition) + Me.ConnectionName = def.GetConnectionName() + Me.RecordClassName = System.Reflection.Assembly.CreateQualifiedName("App_Code", "Persons.Business.BloodIdRecord") + Me.ApplicationName = "App_Code" + Me.DataAdapter = New BloodIdSqlTable() + Directcast(Me.DataAdapter, BloodIdSqlTable).ConnectionName = Me.ConnectionName + + Me.TableDefinition.AdapterMetaData = Me.DataAdapter.AdapterMetaData + BloodIdColumn.CodeName = "BloodId" + BloodNameColumn.CodeName = "BloodName" + + End Sub + +#Region "Overriden methods" + + +#End Region + +#Region "Properties for columns" + + ''' + ''' This is a convenience property that provides direct access to the table's BloodId_.BloodId column object. + ''' + Public ReadOnly Property BloodIdColumn() As BaseClasses.Data.NumberColumn + Get + Return CType(Me.TableDefinition.ColumnList(0), BaseClasses.Data.NumberColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's BloodId_.BloodId column object. + ''' + Public Shared ReadOnly Property BloodId() As BaseClasses.Data.NumberColumn + Get + Return BloodIdTable.Instance.BloodIdColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's BloodId_.BloodName column object. + ''' + Public ReadOnly Property BloodNameColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(1), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's BloodId_.BloodName column object. + ''' + Public Shared ReadOnly Property BloodName() As BaseClasses.Data.StringColumn + Get + Return BloodIdTable.Instance.BloodNameColumn + End Get + End Property + + +#End Region + + +#Region "Shared helper methods" + + ''' + ''' This is a shared function that can be used to get an array of BloodIdRecord records using a where clause. + ''' + Public Shared Function GetRecords(ByVal where As String) As BloodIdRecord() + + Return GetRecords(where, Nothing, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) + End Function + + ''' + ''' This is a shared function that can be used to get an array of BloodIdRecord records using a where clause. + ''' + Public Shared Function GetRecords(ByVal join As BaseFilter, ByVal where As String) As BloodIdRecord() + + Return GetRecords(join, where, Nothing, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) + End Function + + ''' + ''' This is a shared function that can be used to get an array of BloodIdRecord records using a where and order by clause. + ''' + Public Shared Function GetRecords( _ + ByVal where As String, _ + ByVal orderBy As OrderBy) As BloodIdRecord() + + Return GetRecords(where, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) + End Function + + ''' + ''' This is a shared function that can be used to get an array of BloodIdRecord records using a where and order by clause. + ''' + Public Shared Function GetRecords( _ + ByVal join As BaseFilter, _ + ByVal where As String, _ + ByVal orderBy As OrderBy) As BloodIdRecord() + + Return GetRecords(join, where, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) + End Function + + ''' + ''' This is a shared function that can be used to get an array of BloodIdRecord records using a where and order by clause clause with pagination. + ''' + Public Shared Function GetRecords( _ + ByVal where As String, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As BloodIdRecord() + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + Dim join As BaseClasses.Data.BaseFilter = Nothing + Dim recList As ArrayList = BloodIdTable.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, pageIndex, pageSize) + + Return CType(recList.ToArray(GetType(Persons.Business.BloodIdRecord)), BloodIdRecord()) + End Function + + ''' + ''' This is a shared function that can be used to get an array of BloodIdRecord records using a where and order by clause clause with pagination. + ''' + Public Shared Function GetRecords( _ + ByVal join As BaseFilter, _ + ByVal where As String, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As BloodIdRecord() + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Dim recList As ArrayList = BloodIdTable.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, pageIndex, pageSize) + + Return CType(recList.ToArray(GetType(Persons.Business.BloodIdRecord)), BloodIdRecord()) + End Function + + Public Shared Function GetRecords( _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As BloodIdRecord() + Dim join As BaseClasses.Data.BaseFilter = Nothing + Dim recList As ArrayList = BloodIdTable.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + Return CType(recList.ToArray(GetType(Persons.Business.BloodIdRecord)), BloodIdRecord()) + End Function + + Public Shared Function GetRecords( _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As BloodIdRecord() + + Dim recList As ArrayList = BloodIdTable.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + Return CType(recList.ToArray(GetType(Persons.Business.BloodIdRecord)), BloodIdRecord()) + End Function + + Public Shared Function GetRecords( _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer, _ + ByRef totalRecords As Integer) As BloodIdRecord() + Dim join As BaseClasses.Data.BaseFilter = Nothing + Dim recList As ArrayList = BloodIdTable.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize, totalRecords) + + Return CType(recList.ToArray(GetType(Persons.Business.BloodIdRecord)), BloodIdRecord()) + End Function + + Public Shared Function GetRecords( _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer, _ + ByRef totalRecords As Integer) As BloodIdRecord() + + Dim recList As ArrayList = BloodIdTable.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize, totalRecords) + + Return CType(recList.ToArray(GetType(Persons.Business.BloodIdRecord)), BloodIdRecord()) + End Function + + ''' + ''' This is a shared function that can be used to get total number of records that will be returned using the where clause. + ''' + Public Shared Function GetRecordCount(ByVal where As String) As Integer + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Return CInt(BloodIdTable.Instance.GetRecordListCount(Nothing, whereFilter, Nothing, Nothing)) + End Function + +''' + ''' This is a shared function that can be used to get total number of records that will be returned using the where clause. + ''' + Public Shared Function GetRecordCount(ByVal join As BaseFilter, ByVal where As String) As Integer + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Return CInt(BloodIdTable.Instance.GetRecordListCount(join, whereFilter, Nothing, Nothing)) + End Function + + Public Shared Function GetRecordCount(ByVal where As WhereClause) As Integer + Return CInt(BloodIdTable.Instance.GetRecordListCount(Nothing, where.GetFilter(), Nothing, Nothing)) + End Function + + Public Shared Function GetRecordCount(ByVal join As BaseFilter, ByVal where As WhereClause) As Integer + Return CInt(BloodIdTable.Instance.GetRecordListCount(join, where.GetFilter(), Nothing, Nothing)) + End Function + + ''' + ''' This is a shared function that can be used to get a BloodIdRecord record using a where clause. + ''' + Public Shared Function GetRecord(ByVal where As String) As BloodIdRecord + Dim orderBy As OrderBy = Nothing + Return GetRecord(where, orderBy) + End Function + + ''' + ''' This is a shared function that can be used to get a BloodIdRecord record using a where clause. + ''' + Public Shared Function GetRecord(ByVal join As BaseFilter, ByVal where As String) As BloodIdRecord + Dim orderBy As OrderBy = Nothing + Return GetRecord(join, where, orderBy) + End Function + + ''' + ''' This is a shared function that can be used to get a BloodIdRecord record using a where and order by clause. + ''' + Public Shared Function GetRecord( _ + ByVal where As String, _ + ByVal orderBy As OrderBy) As BloodIdRecord + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + Dim join As BaseClasses.Data.BaseFilter = Nothing + Dim recList As ArrayList = BloodIdTable.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MIN_BATCH_SIZE) + + Dim rec As BloodIdRecord = Nothing + If recList.Count > 0 Then + rec = CType(recList(0), BloodIdRecord) + End If + + Return rec + End Function + + ''' + ''' This is a shared function that can be used to get a BloodIdRecord record using a where and order by clause. + ''' + Public Shared Function GetRecord( _ + ByVal join As BaseFilter, _ + ByVal where As String, _ + ByVal orderBy As OrderBy) As BloodIdRecord + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Dim recList As ArrayList = BloodIdTable.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MIN_BATCH_SIZE) + + Dim rec As BloodIdRecord = Nothing + If recList.Count > 0 Then + rec = CType(recList(0), BloodIdRecord) + End If + + Return rec + End Function + + + Public Shared Function GetValues( _ + ByVal col As BaseColumn, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal maxItems As Integer) As String() + + ' Create the filter list. + Dim retCol As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, True) + retCol.AddColumn(col) + + Return BloodIdTable.Instance.GetColumnValues(retCol, Nothing, where.GetFilter(), Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, maxItems) + + End Function + + Public Shared Function GetValues( _ + ByVal col As BaseColumn, _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal maxItems As Integer) As String() + + ' Create the filter list. + Dim retCol As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, True) + retCol.AddColumn(col) + + Return BloodIdTable.Instance.GetColumnValues(retCol, join, where.GetFilter(), Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, maxItems) + + End Function + + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where clause. + ''' + Public Shared Function GetDataTable(ByVal where As String) As System.Data.DataTable + + Dim recs() As BloodIdRecord = GetRecords(where) + Return BloodIdTable.Instance.CreateDataTable(recs, Nothing) + End Function + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where clause. + ''' + Public Shared Function GetDataTable(ByVal join As BaseFilter, ByVal where As String) As System.Data.DataTable + + Dim recs() As BloodIdRecord = GetRecords(join, where) + Return BloodIdTable.Instance.CreateDataTable(recs, Nothing) + End Function + + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause. + ''' + Public Shared Function GetDataTable(ByVal where As String, ByVal orderBy As OrderBy) As System.Data.DataTable + + Dim recs() As BloodIdRecord = GetRecords(where, orderBy) + Return BloodIdTable.Instance.CreateDataTable(recs, Nothing) + End Function + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause. + ''' + Public Shared Function GetDataTable(ByVal join As BaseFilter, ByVal where As String, ByVal orderBy As OrderBy) As System.Data.DataTable + + Dim recs() As BloodIdRecord = GetRecords(join, where, orderBy) + Return BloodIdTable.Instance.CreateDataTable(recs, Nothing) + End Function + + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause with pagination. + ''' + Public Shared Function GetDataTable( _ + ByVal where As String, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As System.Data.DataTable + + Dim recs() As BloodIdRecord = GetRecords(where, orderBy, pageIndex, pageSize) + Return BloodIdTable.Instance.CreateDataTable(recs, Nothing) + End Function + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause with pagination. + ''' + Public Shared Function GetDataTable( _ + ByVal join As BaseFilter, _ + ByVal where As String, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As System.Data.DataTable + + Dim recs() As BloodIdRecord = GetRecords(join, where, orderBy, pageIndex, pageSize) + Return BloodIdTable.Instance.CreateDataTable(recs, Nothing) + End Function + + + ''' + ''' This is a shared function that can be used to delete records using a where clause. + ''' + Public Shared Sub DeleteRecords(ByVal where As String) + If where = Nothing OrElse where.Trim() = "" Then + Return + End If + + Dim whereFilter As SqlFilter = New SqlFilter(where) + BloodIdTable.Instance.DeleteRecordList(whereFilter) + End Sub + + ''' + ''' This is a shared function that can be used to export records using a where clause. + ''' + Public Shared Function Export(ByVal where As String) As String + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Return BloodIdTable.Instance.ExportRecordData(whereFilter) + End Function + + Public Shared Function Export(ByVal where As WhereClause) As String + Dim whereFilter As BaseFilter = Nothing + If Not where Is Nothing Then + whereFilter = where.GetFilter() + End If + + Return BloodIdTable.Instance.ExportRecordData(whereFilter) + End Function + + Public Shared Function GetSum( _ + ByVal col As BaseColumn, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) _ + As String + + Dim colSel As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, False) + colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Sum) + + Return BloodIdTable.Instance.GetColumnStatistics(colSel, Nothing, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + End Function + + Public Shared Function GetSum( _ + ByVal col As BaseColumn, _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) _ + As String + + Dim colSel As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, False) + colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Sum) + + Return BloodIdTable.Instance.GetColumnStatistics(colSel, join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + End Function + + + Public Shared Function GetCount( _ + ByVal col As BaseColumn, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) _ + As String + + Dim colSel As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, False) + colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Count) + + Return BloodIdTable.Instance.GetColumnStatistics(colSel, Nothing, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + End Function + + Public Shared Function GetCount( _ + ByVal col As BaseColumn, _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) _ + As String + + Dim colSel As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, False) + colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Count) + + Return BloodIdTable.Instance.GetColumnStatistics(colSel, join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + End Function + + ''' + ''' This method returns the columns in the table. + ''' + Public Shared Function GetColumns() As BaseColumn() + Return BloodIdTable.Instance.TableDefinition.Columns + End Function + + ''' + ''' This method returns the columnlist in the table. + ''' + Public Shared Function GetColumnList() As ColumnList + Return BloodIdTable.Instance.TableDefinition.ColumnList + End Function + + + ''' + ''' This method creates a new record and returns it to be edited. + ''' + Public Shared Function CreateNewRecord() As IRecord + Return BloodIdTable.Instance.CreateRecord() + End Function + + ''' + ''' This method creates a new record and returns it to be edited. + ''' + ''' ID of the new record. + Public Shared Function CreateNewRecord(ByVal tempId As String) As IRecord + Return BloodIdTable.Instance.CreateRecord(tempId) + End Function + + ''' + ''' This method checks if column is editable. + ''' + ''' Name of the column to check. + Public Shared Function isReadOnlyColumn(ByVal columnName As String) As Boolean + Dim column As BaseColumn = GetColumn(columnName) + If (Not IsNothing(column)) Then + Return column.IsValuesReadOnly + Else + Return True + End If + End Function + + ''' + ''' This method gets the specified column. + ''' + ''' Unique name of the column to fetch. + Public Shared Function GetColumn(ByVal uniqueColumnName As String) As BaseColumn + Dim column As BaseColumn = BloodIdTable.Instance.TableDefinition.ColumnList.GetByUniqueName(uniqueColumnName) + Return column + End Function + + ' Convenience method for getting a record using a string-based record identifier + Public Shared Function GetRecord(ByVal id As String, ByVal bMutable As Boolean) As BloodIdRecord + Return CType(BloodIdTable.Instance.GetRecordData(id, bMutable), BloodIdRecord) + End Function + + ' Convenience method for getting a record using a KeyValue record identifier + Public Shared Function GetRecord(ByVal id As KeyValue, ByVal bMutable As Boolean) As BloodIdRecord + Return CType(BloodIdTable.Instance.GetRecordData(id, bMutable), BloodIdRecord) + End Function + + ' Convenience method for creating a record + Public Overloads Function NewRecord( _ + ByVal BloodIdValue As String, _ + ByVal BloodNameValue As String _ + ) As KeyValue + Dim rec As IPrimaryKeyRecord = CType(Me.CreateRecord(), IPrimaryKeyRecord) + rec.SetString(BloodIdValue, BloodIdColumn) + rec.SetString(BloodNameValue, BloodNameColumn) + + + rec.Create() 'update the DB so any DB-initialized fields (like autoincrement IDs) can be initialized + + Dim key As KeyValue = rec.GetID() + Return key + End Function + + ''' + ''' This method deletes a specified record + ''' + ''' Keyvalue of the record to be deleted. + Public Shared Sub DeleteRecord(ByVal kv As KeyValue) + BloodIdTable.Instance.DeleteOneRecord(kv) + End Sub + + ''' + ''' This method checks if record exist in the database using the keyvalue provided. + ''' + ''' Key value of the record. + Public Shared Function DoesRecordExist(ByVal kv As KeyValue) As Boolean + Dim recordExist As Boolean = True + Try + BloodIdTable.GetRecord(kv, False) + Catch ex As Exception + recordExist = False + End Try + Return recordExist + End Function + + ''' + ''' This method returns all the primary columns in the table. + ''' + Public Shared Function GetPrimaryKeyColumns() As ColumnList + If (Not IsNothing(BloodIdTable.Instance.TableDefinition.PrimaryKey)) Then + Return BloodIdTable.Instance.TableDefinition.PrimaryKey.Columns + Else + Return Nothing + End If + End Function + + ''' + ''' This method takes a key and returns a keyvalue. + ''' + ''' key could be array of primary key values in case of composite primary key or a string containing single primary key value in case of non-composite primary key. + Public Shared Function GetKeyValue(ByVal key As Object) As KeyValue + Dim kv As KeyValue = Nothing + + If (Not (IsNothing(BloodIdTable.Instance.TableDefinition.PrimaryKey))) Then + + Dim isCompositePrimaryKey As Boolean = False + isCompositePrimaryKey = BloodIdTable.Instance.TableDefinition.PrimaryKey.IsCompositeKey + + If ((isCompositePrimaryKey) AndAlso (key.GetType.IsArray())) Then + + ' If the key is composite, then construct a key value. + kv = New KeyValue + Dim fullKeyString As String = "" + Dim keyArray As Array = CType(key, Array) + If (Not IsNothing(keyArray)) Then + Dim length As Integer = keyArray.Length + Dim pkColumns As ColumnList = BloodIdTable.Instance.TableDefinition.PrimaryKey.Columns + Dim pkColumn As BaseColumn + Dim index As Integer = 0 + For Each pkColumn In pkColumns + Dim keyString As String = CType(keyArray.GetValue(index), String) + If (BloodIdTable.Instance.TableDefinition.TableType = BaseClasses.Data.TableDefinition.TableTypes.Virtual) Then + kv.AddElement(pkColumn.UniqueName, keyString) + Else + kv.AddElement(pkColumn.InternalName, keyString) + End If + index = index + 1 + Next pkColumn + End If + + Else + ' If the key is not composite, then get the key value. + kv = BloodIdTable.Instance.TableDefinition.PrimaryKey.ParseValue(CType(key, String)) + End If + End If + Return kv + End Function + + + ''' + ''' This method takes a record and a Column and returns an evaluated value of DFKA formula. + ''' + Public Shared Function GetDFKA(ByVal rec As BaseRecord, ByVal col As BaseColumn) As String + Dim fkColumn As ForeignKey = BloodIdTable.Instance.TableDefinition.GetExpandableNonCompositeForeignKey(col) + If fkColumn Is Nothing Then + Return Nothing + End If + Dim _DFKA As String = fkColumn.PrimaryKeyDisplayColumns + If (_DFKA.Trim().StartsWith("=")) Then + ' if the formula is in the format of "= ., then pull out the data from the rec object instead of doing formula evaluation + Dim tableCodeName As String = fkColumn.PrimaryKeyTableDefinition.TableCodeName + Dim column As String = _DFKA.Trim("="c).Trim() + If column.StartsWith(tableCodeName & ".", StringComparison.InvariantCultureIgnoreCase) Then + column = column.Substring(tableCodeName.Length + 1) + End If + + For Each c As BaseColumn In fkColumn.PrimaryKeyTableDefinition.Columns + If column = c.CodeName Then + Return rec.Format(c) + End If + Next + Dim tableName As String = fkColumn.PrimaryKeyTableDefinition.TableCodeName + Return EvaluateFormula(_DFKA, rec, Nothing, tableName) + Else + Return Nothing + End If + End Function + + ''' + ''' This method takes a keyValue and a Column and returns an evaluated value of DFKA formula. + ''' + Public Shared Function GetDFKA(ByVal keyValue As String, ByVal col As BaseColumn, ByVal formatPattern as String) As String + If keyValue Is Nothing Then + Return Nothing + End If + Dim fkColumn As ForeignKey = BloodIdTable.Instance.TableDefinition.GetExpandableNonCompositeForeignKey(col) + If fkColumn Is Nothing Then + Return Nothing + End If + Dim _DFKA As String = fkColumn.PrimaryKeyDisplayColumns + If (_DFKA.Trim().StartsWith("=")) Then + Dim tableName As String = fkColumn.PrimaryKeyTableDefinition.TableCodeName + Dim t As PrimaryKeyTable = CType(DatabaseObjects.GetTableObject(tableName), PrimaryKeyTable) + Dim rec As BaseRecord = Nothing + If Not t Is Nothing Then + Try + rec = CType(t.GetRecordData(keyValue, False), BaseRecord) + Catch + rec = Nothing + End Try + End If + If rec Is Nothing Then + Return "" + End If + + ' if the formula is in the format of "= ., then pull out the data from the rec object instead of doing formula evaluation + Dim tableCodeName As String = fkColumn.PrimaryKeyTableDefinition.TableCodeName + Dim column As String = _DFKA.Trim("="c).Trim() + If column.StartsWith(tableCodeName & ".", StringComparison.InvariantCultureIgnoreCase) Then + column = column.Substring(tableCodeName.Length + 1) + End If + + For Each c As BaseColumn In fkColumn.PrimaryKeyTableDefinition.Columns + If column = c.CodeName Then + Return rec.Format(c) + End If + Next + Return EvaluateFormula(_DFKA, rec, Nothing, tableName) + Else + Return Nothing + End If + End Function + + ''' + ''' Evaluates the formula + ''' + Public Shared Function EvaluateFormula(ByVal formula As String, Optional ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord = Nothing, Optional ByVal format As String = Nothing, Optional ByVal name As String = "") As String + Dim e As BaseFormulaEvaluator = New BaseFormulaEvaluator() + If Not dataSourceForEvaluate Is Nothing Then + e.Evaluator.Variables.Add(name, dataSourceForEvaluate) + end if + e.DataSource = dataSourceForEvaluate + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + If Not String.IsNullOrEmpty(format) Then + Return BaseFormulaUtils.Format(resultObj, format) + Else + Return resultObj.ToString() + End If + End Function + + +#End Region + +End Class +End Namespace diff --git a/App_Code/Business Layer/BaseBornRecord.vb b/App_Code/Business Layer/BaseBornRecord.vb new file mode 100644 index 0000000..dba5eb1 --- /dev/null +++ b/App_Code/Business Layer/BaseBornRecord.vb @@ -0,0 +1,260 @@ +' This class is "generated" and will be overwritten. +' Your customizations should be made in BornRecord.vb + +Imports System.Data.SqlTypes +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + +Namespace Persons.Business + +''' +''' The generated superclass for the class. +''' +''' +''' This class is not intended to be instantiated directly. To obtain an instance of this class, +''' use the methods of the class. +''' +''' +''' + + Public Class BaseBornRecord + Inherits PrimaryKeyRecord + + + Public Shared Shadows ReadOnly TableUtils As BornTable = BornTable.Instance + + ' Constructors + + Protected Sub New() + MyBase.New(TableUtils) + End Sub + + Protected Sub New(ByVal record As PrimaryKeyRecord) + MyBase.New(record, TableUtils) + End Sub + + 'Evaluates Initialize when->Inserting record formulas specified at the data access layer + Public Overridable Sub BornRecord_InsertingRecord(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles Me.InsertingRecord + 'Apply Initialize->Inserting record formula only if validation is successful. + Dim BornRec As BornRecord = CType(sender,BornRecord) + Validate_Inserting() + If Not BornRec Is Nothing AndAlso Not BornRec.IsReadOnly Then + End If + End Sub + + 'Evaluates Initialize when->Updating record formulas specified at the data access layer + Public Overridable Sub BornRecord_UpdatingRecord(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles Me.UpdatingRecord + 'Apply Initialize->Updating record formula only if validation is successful. + Dim BornRec As BornRecord = CType(sender,BornRecord) + Validate_Updating() + If Not BornRec Is Nothing AndAlso Not BornRec.IsReadOnly Then + End If + End Sub + + 'Evaluates Initialize when->Reading record formulas specified at the data access layer + Public Overridable Sub BornRecord_ReadRecord(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.ReadRecord + 'Apply Initialize->Reading record formula only if validation is successful. + Dim BornRec As BornRecord = CType(sender,BornRecord) + If Not BornRec Is Nothing AndAlso Not BornRec.IsReadOnly Then + End If + End Sub + + 'Evaluates Validate when->Inserting formulas specified at the data access layer + Public Overridable Sub Validate_Inserting () + Dim fullValidationMessage As String = "" + Dim validationMessage As String = "" + + dim formula as String = "" + + + If validationMessage <> "" AndAlso validationMessage.ToLower() <> "true" Then + fullValidationMessage &= validationMessage & vbCrLf + End If + + If fullValidationMessage <> "" Then + Throw New Exception(fullValidationMessage) + End If + End Sub + + 'Evaluates Validate when->Updating formulas specified at the data access layer + Public Overridable Sub Validate_Updating () + Dim fullValidationMessage As String = "" + Dim validationMessage As String = "" + + dim formula as String = "" + + + If validationMessage <> "" AndAlso validationMessage.ToLower() <> "true" Then + fullValidationMessage &= validationMessage & vbCrLf + End If + + If fullValidationMessage <> "" Then + Throw New Exception(fullValidationMessage) + End If + End Sub + + Public Overridable Function EvaluateFormula(ByVal formula As String, Optional ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord = Nothing, Optional ByVal format As String = Nothing) As String + + Dim e As Data.BaseFormulaEvaluator = New Data.BaseFormulaEvaluator() + + ' All variables referred to in the formula are expected to be + ' properties of the DataSource. For example, referring to + ' UnitPrice as a variable will refer to DataSource.UnitPrice + e.DataSource = dataSourceForEvaluate + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + Return resultObj.ToString() + End Function + + + + + + + +#Region "Convenience methods to get/set values of fields" + + ''' + ''' This is a convenience method that provides direct access to the value of the record's Born_.Born field. + ''' + Public Function GetBornValue() As ColumnValue + Return Me.GetValue(TableUtils.BornColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's Born_.Born field. + ''' + Public Function GetBornFieldValue() As String + Return CType(Me.GetValue(TableUtils.BornColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Born_.Born field. + ''' + Public Sub SetBornFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.BornColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Born_.Born field. + ''' + Public Sub SetBornFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.BornColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's Born_.BornDesc field. + ''' + Public Function GetBornDescValue() As ColumnValue + Return Me.GetValue(TableUtils.BornDescColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's Born_.BornDesc field. + ''' + Public Function GetBornDescFieldValue() As String + Return CType(Me.GetValue(TableUtils.BornDescColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Born_.BornDesc field. + ''' + Public Sub SetBornDescFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.BornDescColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Born_.BornDesc field. + ''' + Public Sub SetBornDescFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.BornDescColumn) + End Sub + + + +#End Region + +#Region "Convenience methods to get field names" + + ''' + ''' This is a convenience property that provides direct access to the value of the record's Born_.Born field. + ''' + Public Property Born() As String + Get + Return CType(Me.GetValue(TableUtils.BornColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.BornColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property BornSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.BornColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property BornDefault() As String + Get + Return TableUtils.BornColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's Born_.BornDesc field. + ''' + Public Property BornDesc() As String + Get + Return CType(Me.GetValue(TableUtils.BornDescColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.BornDescColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property BornDescSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.BornDescColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property BornDescDefault() As String + Get + Return TableUtils.BornDescColumn.DefaultValue + End Get + End Property + + + +#End Region + +End Class +End Namespace diff --git a/App_Code/Business Layer/BaseBornTable.vb b/App_Code/Business Layer/BaseBornTable.vb new file mode 100644 index 0000000..6922b7f --- /dev/null +++ b/App_Code/Business Layer/BaseBornTable.vb @@ -0,0 +1,778 @@ +' This class is "generated" and will be overwritten. +' Your customizations should be made in BornRecord.vb + +Imports System.Data.SqlTypes +Imports System.Data +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider +Imports Persons.Data + +Namespace Persons.Business + +''' +''' The generated superclass for the class. +''' Provides access to the schema information and record data of a database table or view named Born. +''' +''' +''' The connection details (name, location, etc.) of the database and table (or view) accessed by this class +''' are resolved at runtime based on the connection string in the application's Web.Config file. +''' +''' This class is not intended to be instantiated directly. To obtain an instance of this class, use +''' BornTable.Instance. +''' +''' +''' + + Public Class BaseBornTable + Inherits PrimaryKeyTable + + + Private ReadOnly TableDefinitionString As String = BornDefinition.GetXMLString() + + + + + + + + Protected Sub New() + MyBase.New() + Me.Initialize() + End Sub + + Protected Overridable Sub Initialize() + Dim def As New XmlTableDefinition(TableDefinitionString) + Me.TableDefinition = New TableDefinition() + Me.TableDefinition.TableClassName = System.Reflection.Assembly.CreateQualifiedName("App_Code", "Persons.Business.BornTable") + def.InitializeTableDefinition(Me.TableDefinition) + Me.ConnectionName = def.GetConnectionName() + Me.RecordClassName = System.Reflection.Assembly.CreateQualifiedName("App_Code", "Persons.Business.BornRecord") + Me.ApplicationName = "App_Code" + Me.DataAdapter = New BornSqlTable() + Directcast(Me.DataAdapter, BornSqlTable).ConnectionName = Me.ConnectionName + + Me.TableDefinition.AdapterMetaData = Me.DataAdapter.AdapterMetaData + BornColumn.CodeName = "Born" + BornDescColumn.CodeName = "BornDesc" + + End Sub + +#Region "Overriden methods" + + +#End Region + +#Region "Properties for columns" + + ''' + ''' This is a convenience property that provides direct access to the table's Born_.Born column object. + ''' + Public ReadOnly Property BornColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(0), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's Born_.Born column object. + ''' + Public Shared ReadOnly Property Born() As BaseClasses.Data.StringColumn + Get + Return BornTable.Instance.BornColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's Born_.BornDesc column object. + ''' + Public ReadOnly Property BornDescColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(1), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's Born_.BornDesc column object. + ''' + Public Shared ReadOnly Property BornDesc() As BaseClasses.Data.StringColumn + Get + Return BornTable.Instance.BornDescColumn + End Get + End Property + + +#End Region + + +#Region "Shared helper methods" + + ''' + ''' This is a shared function that can be used to get an array of BornRecord records using a where clause. + ''' + Public Shared Function GetRecords(ByVal where As String) As BornRecord() + + Return GetRecords(where, Nothing, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) + End Function + + ''' + ''' This is a shared function that can be used to get an array of BornRecord records using a where clause. + ''' + Public Shared Function GetRecords(ByVal join As BaseFilter, ByVal where As String) As BornRecord() + + Return GetRecords(join, where, Nothing, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) + End Function + + ''' + ''' This is a shared function that can be used to get an array of BornRecord records using a where and order by clause. + ''' + Public Shared Function GetRecords( _ + ByVal where As String, _ + ByVal orderBy As OrderBy) As BornRecord() + + Return GetRecords(where, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) + End Function + + ''' + ''' This is a shared function that can be used to get an array of BornRecord records using a where and order by clause. + ''' + Public Shared Function GetRecords( _ + ByVal join As BaseFilter, _ + ByVal where As String, _ + ByVal orderBy As OrderBy) As BornRecord() + + Return GetRecords(join, where, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) + End Function + + ''' + ''' This is a shared function that can be used to get an array of BornRecord records using a where and order by clause clause with pagination. + ''' + Public Shared Function GetRecords( _ + ByVal where As String, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As BornRecord() + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + Dim join As BaseClasses.Data.BaseFilter = Nothing + Dim recList As ArrayList = BornTable.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, pageIndex, pageSize) + + Return CType(recList.ToArray(GetType(Persons.Business.BornRecord)), BornRecord()) + End Function + + ''' + ''' This is a shared function that can be used to get an array of BornRecord records using a where and order by clause clause with pagination. + ''' + Public Shared Function GetRecords( _ + ByVal join As BaseFilter, _ + ByVal where As String, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As BornRecord() + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Dim recList As ArrayList = BornTable.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, pageIndex, pageSize) + + Return CType(recList.ToArray(GetType(Persons.Business.BornRecord)), BornRecord()) + End Function + + Public Shared Function GetRecords( _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As BornRecord() + Dim join As BaseClasses.Data.BaseFilter = Nothing + Dim recList As ArrayList = BornTable.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + Return CType(recList.ToArray(GetType(Persons.Business.BornRecord)), BornRecord()) + End Function + + Public Shared Function GetRecords( _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As BornRecord() + + Dim recList As ArrayList = BornTable.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + Return CType(recList.ToArray(GetType(Persons.Business.BornRecord)), BornRecord()) + End Function + + Public Shared Function GetRecords( _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer, _ + ByRef totalRecords As Integer) As BornRecord() + Dim join As BaseClasses.Data.BaseFilter = Nothing + Dim recList As ArrayList = BornTable.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize, totalRecords) + + Return CType(recList.ToArray(GetType(Persons.Business.BornRecord)), BornRecord()) + End Function + + Public Shared Function GetRecords( _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer, _ + ByRef totalRecords As Integer) As BornRecord() + + Dim recList As ArrayList = BornTable.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize, totalRecords) + + Return CType(recList.ToArray(GetType(Persons.Business.BornRecord)), BornRecord()) + End Function + + ''' + ''' This is a shared function that can be used to get total number of records that will be returned using the where clause. + ''' + Public Shared Function GetRecordCount(ByVal where As String) As Integer + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Return CInt(BornTable.Instance.GetRecordListCount(Nothing, whereFilter, Nothing, Nothing)) + End Function + +''' + ''' This is a shared function that can be used to get total number of records that will be returned using the where clause. + ''' + Public Shared Function GetRecordCount(ByVal join As BaseFilter, ByVal where As String) As Integer + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Return CInt(BornTable.Instance.GetRecordListCount(join, whereFilter, Nothing, Nothing)) + End Function + + Public Shared Function GetRecordCount(ByVal where As WhereClause) As Integer + Return CInt(BornTable.Instance.GetRecordListCount(Nothing, where.GetFilter(), Nothing, Nothing)) + End Function + + Public Shared Function GetRecordCount(ByVal join As BaseFilter, ByVal where As WhereClause) As Integer + Return CInt(BornTable.Instance.GetRecordListCount(join, where.GetFilter(), Nothing, Nothing)) + End Function + + ''' + ''' This is a shared function that can be used to get a BornRecord record using a where clause. + ''' + Public Shared Function GetRecord(ByVal where As String) As BornRecord + Dim orderBy As OrderBy = Nothing + Return GetRecord(where, orderBy) + End Function + + ''' + ''' This is a shared function that can be used to get a BornRecord record using a where clause. + ''' + Public Shared Function GetRecord(ByVal join As BaseFilter, ByVal where As String) As BornRecord + Dim orderBy As OrderBy = Nothing + Return GetRecord(join, where, orderBy) + End Function + + ''' + ''' This is a shared function that can be used to get a BornRecord record using a where and order by clause. + ''' + Public Shared Function GetRecord( _ + ByVal where As String, _ + ByVal orderBy As OrderBy) As BornRecord + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + Dim join As BaseClasses.Data.BaseFilter = Nothing + Dim recList As ArrayList = BornTable.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MIN_BATCH_SIZE) + + Dim rec As BornRecord = Nothing + If recList.Count > 0 Then + rec = CType(recList(0), BornRecord) + End If + + Return rec + End Function + + ''' + ''' This is a shared function that can be used to get a BornRecord record using a where and order by clause. + ''' + Public Shared Function GetRecord( _ + ByVal join As BaseFilter, _ + ByVal where As String, _ + ByVal orderBy As OrderBy) As BornRecord + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Dim recList As ArrayList = BornTable.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MIN_BATCH_SIZE) + + Dim rec As BornRecord = Nothing + If recList.Count > 0 Then + rec = CType(recList(0), BornRecord) + End If + + Return rec + End Function + + + Public Shared Function GetValues( _ + ByVal col As BaseColumn, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal maxItems As Integer) As String() + + ' Create the filter list. + Dim retCol As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, True) + retCol.AddColumn(col) + + Return BornTable.Instance.GetColumnValues(retCol, Nothing, where.GetFilter(), Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, maxItems) + + End Function + + Public Shared Function GetValues( _ + ByVal col As BaseColumn, _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal maxItems As Integer) As String() + + ' Create the filter list. + Dim retCol As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, True) + retCol.AddColumn(col) + + Return BornTable.Instance.GetColumnValues(retCol, join, where.GetFilter(), Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, maxItems) + + End Function + + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where clause. + ''' + Public Shared Function GetDataTable(ByVal where As String) As System.Data.DataTable + + Dim recs() As BornRecord = GetRecords(where) + Return BornTable.Instance.CreateDataTable(recs, Nothing) + End Function + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where clause. + ''' + Public Shared Function GetDataTable(ByVal join As BaseFilter, ByVal where As String) As System.Data.DataTable + + Dim recs() As BornRecord = GetRecords(join, where) + Return BornTable.Instance.CreateDataTable(recs, Nothing) + End Function + + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause. + ''' + Public Shared Function GetDataTable(ByVal where As String, ByVal orderBy As OrderBy) As System.Data.DataTable + + Dim recs() As BornRecord = GetRecords(where, orderBy) + Return BornTable.Instance.CreateDataTable(recs, Nothing) + End Function + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause. + ''' + Public Shared Function GetDataTable(ByVal join As BaseFilter, ByVal where As String, ByVal orderBy As OrderBy) As System.Data.DataTable + + Dim recs() As BornRecord = GetRecords(join, where, orderBy) + Return BornTable.Instance.CreateDataTable(recs, Nothing) + End Function + + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause with pagination. + ''' + Public Shared Function GetDataTable( _ + ByVal where As String, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As System.Data.DataTable + + Dim recs() As BornRecord = GetRecords(where, orderBy, pageIndex, pageSize) + Return BornTable.Instance.CreateDataTable(recs, Nothing) + End Function + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause with pagination. + ''' + Public Shared Function GetDataTable( _ + ByVal join As BaseFilter, _ + ByVal where As String, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As System.Data.DataTable + + Dim recs() As BornRecord = GetRecords(join, where, orderBy, pageIndex, pageSize) + Return BornTable.Instance.CreateDataTable(recs, Nothing) + End Function + + + ''' + ''' This is a shared function that can be used to delete records using a where clause. + ''' + Public Shared Sub DeleteRecords(ByVal where As String) + If where = Nothing OrElse where.Trim() = "" Then + Return + End If + + Dim whereFilter As SqlFilter = New SqlFilter(where) + BornTable.Instance.DeleteRecordList(whereFilter) + End Sub + + ''' + ''' This is a shared function that can be used to export records using a where clause. + ''' + Public Shared Function Export(ByVal where As String) As String + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Return BornTable.Instance.ExportRecordData(whereFilter) + End Function + + Public Shared Function Export(ByVal where As WhereClause) As String + Dim whereFilter As BaseFilter = Nothing + If Not where Is Nothing Then + whereFilter = where.GetFilter() + End If + + Return BornTable.Instance.ExportRecordData(whereFilter) + End Function + + Public Shared Function GetSum( _ + ByVal col As BaseColumn, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) _ + As String + + Dim colSel As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, False) + colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Sum) + + Return BornTable.Instance.GetColumnStatistics(colSel, Nothing, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + End Function + + Public Shared Function GetSum( _ + ByVal col As BaseColumn, _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) _ + As String + + Dim colSel As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, False) + colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Sum) + + Return BornTable.Instance.GetColumnStatistics(colSel, join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + End Function + + + Public Shared Function GetCount( _ + ByVal col As BaseColumn, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) _ + As String + + Dim colSel As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, False) + colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Count) + + Return BornTable.Instance.GetColumnStatistics(colSel, Nothing, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + End Function + + Public Shared Function GetCount( _ + ByVal col As BaseColumn, _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) _ + As String + + Dim colSel As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, False) + colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Count) + + Return BornTable.Instance.GetColumnStatistics(colSel, join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + End Function + + ''' + ''' This method returns the columns in the table. + ''' + Public Shared Function GetColumns() As BaseColumn() + Return BornTable.Instance.TableDefinition.Columns + End Function + + ''' + ''' This method returns the columnlist in the table. + ''' + Public Shared Function GetColumnList() As ColumnList + Return BornTable.Instance.TableDefinition.ColumnList + End Function + + + ''' + ''' This method creates a new record and returns it to be edited. + ''' + Public Shared Function CreateNewRecord() As IRecord + Return BornTable.Instance.CreateRecord() + End Function + + ''' + ''' This method creates a new record and returns it to be edited. + ''' + ''' ID of the new record. + Public Shared Function CreateNewRecord(ByVal tempId As String) As IRecord + Return BornTable.Instance.CreateRecord(tempId) + End Function + + ''' + ''' This method checks if column is editable. + ''' + ''' Name of the column to check. + Public Shared Function isReadOnlyColumn(ByVal columnName As String) As Boolean + Dim column As BaseColumn = GetColumn(columnName) + If (Not IsNothing(column)) Then + Return column.IsValuesReadOnly + Else + Return True + End If + End Function + + ''' + ''' This method gets the specified column. + ''' + ''' Unique name of the column to fetch. + Public Shared Function GetColumn(ByVal uniqueColumnName As String) As BaseColumn + Dim column As BaseColumn = BornTable.Instance.TableDefinition.ColumnList.GetByUniqueName(uniqueColumnName) + Return column + End Function + + ' Convenience method for getting a record using a string-based record identifier + Public Shared Function GetRecord(ByVal id As String, ByVal bMutable As Boolean) As BornRecord + Return CType(BornTable.Instance.GetRecordData(id, bMutable), BornRecord) + End Function + + ' Convenience method for getting a record using a KeyValue record identifier + Public Shared Function GetRecord(ByVal id As KeyValue, ByVal bMutable As Boolean) As BornRecord + Return CType(BornTable.Instance.GetRecordData(id, bMutable), BornRecord) + End Function + + ' Convenience method for creating a record + Public Overloads Function NewRecord( _ + ByVal BornValue As String, _ + ByVal BornDescValue As String _ + ) As KeyValue + Dim rec As IPrimaryKeyRecord = CType(Me.CreateRecord(), IPrimaryKeyRecord) + rec.SetString(BornValue, BornColumn) + rec.SetString(BornDescValue, BornDescColumn) + + + rec.Create() 'update the DB so any DB-initialized fields (like autoincrement IDs) can be initialized + + Dim key As KeyValue = rec.GetID() + Return key + End Function + + ''' + ''' This method deletes a specified record + ''' + ''' Keyvalue of the record to be deleted. + Public Shared Sub DeleteRecord(ByVal kv As KeyValue) + BornTable.Instance.DeleteOneRecord(kv) + End Sub + + ''' + ''' This method checks if record exist in the database using the keyvalue provided. + ''' + ''' Key value of the record. + Public Shared Function DoesRecordExist(ByVal kv As KeyValue) As Boolean + Dim recordExist As Boolean = True + Try + BornTable.GetRecord(kv, False) + Catch ex As Exception + recordExist = False + End Try + Return recordExist + End Function + + ''' + ''' This method returns all the primary columns in the table. + ''' + Public Shared Function GetPrimaryKeyColumns() As ColumnList + If (Not IsNothing(BornTable.Instance.TableDefinition.PrimaryKey)) Then + Return BornTable.Instance.TableDefinition.PrimaryKey.Columns + Else + Return Nothing + End If + End Function + + ''' + ''' This method takes a key and returns a keyvalue. + ''' + ''' key could be array of primary key values in case of composite primary key or a string containing single primary key value in case of non-composite primary key. + Public Shared Function GetKeyValue(ByVal key As Object) As KeyValue + Dim kv As KeyValue = Nothing + + If (Not (IsNothing(BornTable.Instance.TableDefinition.PrimaryKey))) Then + + Dim isCompositePrimaryKey As Boolean = False + isCompositePrimaryKey = BornTable.Instance.TableDefinition.PrimaryKey.IsCompositeKey + + If ((isCompositePrimaryKey) AndAlso (key.GetType.IsArray())) Then + + ' If the key is composite, then construct a key value. + kv = New KeyValue + Dim fullKeyString As String = "" + Dim keyArray As Array = CType(key, Array) + If (Not IsNothing(keyArray)) Then + Dim length As Integer = keyArray.Length + Dim pkColumns As ColumnList = BornTable.Instance.TableDefinition.PrimaryKey.Columns + Dim pkColumn As BaseColumn + Dim index As Integer = 0 + For Each pkColumn In pkColumns + Dim keyString As String = CType(keyArray.GetValue(index), String) + If (BornTable.Instance.TableDefinition.TableType = BaseClasses.Data.TableDefinition.TableTypes.Virtual) Then + kv.AddElement(pkColumn.UniqueName, keyString) + Else + kv.AddElement(pkColumn.InternalName, keyString) + End If + index = index + 1 + Next pkColumn + End If + + Else + ' If the key is not composite, then get the key value. + kv = BornTable.Instance.TableDefinition.PrimaryKey.ParseValue(CType(key, String)) + End If + End If + Return kv + End Function + + + ''' + ''' This method takes a record and a Column and returns an evaluated value of DFKA formula. + ''' + Public Shared Function GetDFKA(ByVal rec As BaseRecord, ByVal col As BaseColumn) As String + Dim fkColumn As ForeignKey = BornTable.Instance.TableDefinition.GetExpandableNonCompositeForeignKey(col) + If fkColumn Is Nothing Then + Return Nothing + End If + Dim _DFKA As String = fkColumn.PrimaryKeyDisplayColumns + If (_DFKA.Trim().StartsWith("=")) Then + ' if the formula is in the format of "= ., then pull out the data from the rec object instead of doing formula evaluation + Dim tableCodeName As String = fkColumn.PrimaryKeyTableDefinition.TableCodeName + Dim column As String = _DFKA.Trim("="c).Trim() + If column.StartsWith(tableCodeName & ".", StringComparison.InvariantCultureIgnoreCase) Then + column = column.Substring(tableCodeName.Length + 1) + End If + + For Each c As BaseColumn In fkColumn.PrimaryKeyTableDefinition.Columns + If column = c.CodeName Then + Return rec.Format(c) + End If + Next + Dim tableName As String = fkColumn.PrimaryKeyTableDefinition.TableCodeName + Return EvaluateFormula(_DFKA, rec, Nothing, tableName) + Else + Return Nothing + End If + End Function + + ''' + ''' This method takes a keyValue and a Column and returns an evaluated value of DFKA formula. + ''' + Public Shared Function GetDFKA(ByVal keyValue As String, ByVal col As BaseColumn, ByVal formatPattern as String) As String + If keyValue Is Nothing Then + Return Nothing + End If + Dim fkColumn As ForeignKey = BornTable.Instance.TableDefinition.GetExpandableNonCompositeForeignKey(col) + If fkColumn Is Nothing Then + Return Nothing + End If + Dim _DFKA As String = fkColumn.PrimaryKeyDisplayColumns + If (_DFKA.Trim().StartsWith("=")) Then + Dim tableName As String = fkColumn.PrimaryKeyTableDefinition.TableCodeName + Dim t As PrimaryKeyTable = CType(DatabaseObjects.GetTableObject(tableName), PrimaryKeyTable) + Dim rec As BaseRecord = Nothing + If Not t Is Nothing Then + Try + rec = CType(t.GetRecordData(keyValue, False), BaseRecord) + Catch + rec = Nothing + End Try + End If + If rec Is Nothing Then + Return "" + End If + + ' if the formula is in the format of "= ., then pull out the data from the rec object instead of doing formula evaluation + Dim tableCodeName As String = fkColumn.PrimaryKeyTableDefinition.TableCodeName + Dim column As String = _DFKA.Trim("="c).Trim() + If column.StartsWith(tableCodeName & ".", StringComparison.InvariantCultureIgnoreCase) Then + column = column.Substring(tableCodeName.Length + 1) + End If + + For Each c As BaseColumn In fkColumn.PrimaryKeyTableDefinition.Columns + If column = c.CodeName Then + Return rec.Format(c) + End If + Next + Return EvaluateFormula(_DFKA, rec, Nothing, tableName) + Else + Return Nothing + End If + End Function + + ''' + ''' Evaluates the formula + ''' + Public Shared Function EvaluateFormula(ByVal formula As String, Optional ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord = Nothing, Optional ByVal format As String = Nothing, Optional ByVal name As String = "") As String + Dim e As BaseFormulaEvaluator = New BaseFormulaEvaluator() + If Not dataSourceForEvaluate Is Nothing Then + e.Evaluator.Variables.Add(name, dataSourceForEvaluate) + end if + e.DataSource = dataSourceForEvaluate + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + If Not String.IsNullOrEmpty(format) Then + Return BaseFormulaUtils.Format(resultObj, format) + Else + Return resultObj.ToString() + End If + End Function + + +#End Region + +End Class +End Namespace diff --git a/App_Code/Business Layer/BaseCountryRecord.vb b/App_Code/Business Layer/BaseCountryRecord.vb new file mode 100644 index 0000000..7a13eef --- /dev/null +++ b/App_Code/Business Layer/BaseCountryRecord.vb @@ -0,0 +1,283 @@ +' This class is "generated" and will be overwritten. +' Your customizations should be made in CountryRecord.vb + +Imports System.Data.SqlTypes +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + +Namespace Persons.Business + +''' +''' The generated superclass for the class. +''' +''' +''' This class is not intended to be instantiated directly. To obtain an instance of this class, +''' use the methods of the class. +''' +''' +''' + + Public Class BaseCountryRecord + Inherits PrimaryKeyRecord + + + Public Shared Shadows ReadOnly TableUtils As CountryTable = CountryTable.Instance + + ' Constructors + + Protected Sub New() + MyBase.New(TableUtils) + End Sub + + Protected Sub New(ByVal record As PrimaryKeyRecord) + MyBase.New(record, TableUtils) + End Sub + + 'Evaluates Initialize when->Inserting record formulas specified at the data access layer + Public Overridable Sub CountryRecord_InsertingRecord(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles Me.InsertingRecord + 'Apply Initialize->Inserting record formula only if validation is successful. + Dim CountryRec As CountryRecord = CType(sender,CountryRecord) + Validate_Inserting() + If Not CountryRec Is Nothing AndAlso Not CountryRec.IsReadOnly Then + End If + End Sub + + 'Evaluates Initialize when->Updating record formulas specified at the data access layer + Public Overridable Sub CountryRecord_UpdatingRecord(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles Me.UpdatingRecord + 'Apply Initialize->Updating record formula only if validation is successful. + Dim CountryRec As CountryRecord = CType(sender,CountryRecord) + Validate_Updating() + If Not CountryRec Is Nothing AndAlso Not CountryRec.IsReadOnly Then + End If + End Sub + + 'Evaluates Initialize when->Reading record formulas specified at the data access layer + Public Overridable Sub CountryRecord_ReadRecord(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.ReadRecord + 'Apply Initialize->Reading record formula only if validation is successful. + Dim CountryRec As CountryRecord = CType(sender,CountryRecord) + If Not CountryRec Is Nothing AndAlso Not CountryRec.IsReadOnly Then + End If + End Sub + + 'Evaluates Validate when->Inserting formulas specified at the data access layer + Public Overridable Sub Validate_Inserting () + Dim fullValidationMessage As String = "" + Dim validationMessage As String = "" + + dim formula as String = "" + + + If validationMessage <> "" AndAlso validationMessage.ToLower() <> "true" Then + fullValidationMessage &= validationMessage & vbCrLf + End If + + If fullValidationMessage <> "" Then + Throw New Exception(fullValidationMessage) + End If + End Sub + + 'Evaluates Validate when->Updating formulas specified at the data access layer + Public Overridable Sub Validate_Updating () + Dim fullValidationMessage As String = "" + Dim validationMessage As String = "" + + dim formula as String = "" + + + If validationMessage <> "" AndAlso validationMessage.ToLower() <> "true" Then + fullValidationMessage &= validationMessage & vbCrLf + End If + + If fullValidationMessage <> "" Then + Throw New Exception(fullValidationMessage) + End If + End Sub + + Public Overridable Function EvaluateFormula(ByVal formula As String, Optional ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord = Nothing, Optional ByVal format As String = Nothing) As String + + Dim e As Data.BaseFormulaEvaluator = New Data.BaseFormulaEvaluator() + + ' All variables referred to in the formula are expected to be + ' properties of the DataSource. For example, referring to + ' UnitPrice as a variable will refer to DataSource.UnitPrice + e.DataSource = dataSourceForEvaluate + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + Return resultObj.ToString() + End Function + + + + + + + +#Region "Convenience methods to get/set values of fields" + + ''' + ''' This is a convenience method that provides direct access to the value of the record's Country_.CountryId field. + ''' + Public Function GetCountryIdValue() As ColumnValue + Return Me.GetValue(TableUtils.CountryIdColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's Country_.CountryId field. + ''' + Public Function GetCountryIdFieldValue() As Int16 + Return CType(Me.GetValue(TableUtils.CountryIdColumn).ToInt16(), Int16) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Country_.CountryId field. + ''' + Public Sub SetCountryIdFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.CountryIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Country_.CountryId field. + ''' + Public Sub SetCountryIdFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.CountryIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Country_.CountryId field. + ''' + Public Sub SetCountryIdFieldValue(ByVal val As Double) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.CountryIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Country_.CountryId field. + ''' + Public Sub SetCountryIdFieldValue(ByVal val As Decimal) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.CountryIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Country_.CountryId field. + ''' + Public Sub SetCountryIdFieldValue(ByVal val As Int64) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.CountryIdColumn) + End Sub + ''' + ''' This is a convenience method that provides direct access to the value of the record's Country_.Country field. + ''' + Public Function GetCountryValue() As ColumnValue + Return Me.GetValue(TableUtils.CountryColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's Country_.Country field. + ''' + Public Function GetCountryFieldValue() As String + Return CType(Me.GetValue(TableUtils.CountryColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Country_.Country field. + ''' + Public Sub SetCountryFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.CountryColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Country_.Country field. + ''' + Public Sub SetCountryFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.CountryColumn) + End Sub + + + +#End Region + +#Region "Convenience methods to get field names" + + ''' + ''' This is a convenience property that provides direct access to the value of the record's Country_.CountryId field. + ''' + Public Property CountryId() As Int16 + Get + Return CType(Me.GetValue(TableUtils.CountryIdColumn).ToInt16(), Int16) + End Get + Set (ByVal val As Int16) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.CountryIdColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property CountryIdSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.CountryIdColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property CountryIdDefault() As String + Get + Return TableUtils.CountryIdColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's Country_.Country field. + ''' + Public Property Country() As String + Get + Return CType(Me.GetValue(TableUtils.CountryColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.CountryColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property CountrySpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.CountryColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property CountryDefault() As String + Get + Return TableUtils.CountryColumn.DefaultValue + End Get + End Property + + + +#End Region + +End Class +End Namespace diff --git a/App_Code/Business Layer/BaseCountryTable.vb b/App_Code/Business Layer/BaseCountryTable.vb new file mode 100644 index 0000000..ff6fdce --- /dev/null +++ b/App_Code/Business Layer/BaseCountryTable.vb @@ -0,0 +1,778 @@ +' This class is "generated" and will be overwritten. +' Your customizations should be made in CountryRecord.vb + +Imports System.Data.SqlTypes +Imports System.Data +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider +Imports Persons.Data + +Namespace Persons.Business + +''' +''' The generated superclass for the class. +''' Provides access to the schema information and record data of a database table or view named Country. +''' +''' +''' The connection details (name, location, etc.) of the database and table (or view) accessed by this class +''' are resolved at runtime based on the connection string in the application's Web.Config file. +''' +''' This class is not intended to be instantiated directly. To obtain an instance of this class, use +''' CountryTable.Instance. +''' +''' +''' + + Public Class BaseCountryTable + Inherits PrimaryKeyTable + + + Private ReadOnly TableDefinitionString As String = CountryDefinition.GetXMLString() + + + + + + + + Protected Sub New() + MyBase.New() + Me.Initialize() + End Sub + + Protected Overridable Sub Initialize() + Dim def As New XmlTableDefinition(TableDefinitionString) + Me.TableDefinition = New TableDefinition() + Me.TableDefinition.TableClassName = System.Reflection.Assembly.CreateQualifiedName("App_Code", "Persons.Business.CountryTable") + def.InitializeTableDefinition(Me.TableDefinition) + Me.ConnectionName = def.GetConnectionName() + Me.RecordClassName = System.Reflection.Assembly.CreateQualifiedName("App_Code", "Persons.Business.CountryRecord") + Me.ApplicationName = "App_Code" + Me.DataAdapter = New CountrySqlTable() + Directcast(Me.DataAdapter, CountrySqlTable).ConnectionName = Me.ConnectionName + + Me.TableDefinition.AdapterMetaData = Me.DataAdapter.AdapterMetaData + CountryIdColumn.CodeName = "CountryId" + CountryColumn.CodeName = "Country" + + End Sub + +#Region "Overriden methods" + + +#End Region + +#Region "Properties for columns" + + ''' + ''' This is a convenience property that provides direct access to the table's Country_.CountryId column object. + ''' + Public ReadOnly Property CountryIdColumn() As BaseClasses.Data.NumberColumn + Get + Return CType(Me.TableDefinition.ColumnList(0), BaseClasses.Data.NumberColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's Country_.CountryId column object. + ''' + Public Shared ReadOnly Property CountryId() As BaseClasses.Data.NumberColumn + Get + Return CountryTable.Instance.CountryIdColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's Country_.Country column object. + ''' + Public ReadOnly Property CountryColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(1), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's Country_.Country column object. + ''' + Public Shared ReadOnly Property Country() As BaseClasses.Data.StringColumn + Get + Return CountryTable.Instance.CountryColumn + End Get + End Property + + +#End Region + + +#Region "Shared helper methods" + + ''' + ''' This is a shared function that can be used to get an array of CountryRecord records using a where clause. + ''' + Public Shared Function GetRecords(ByVal where As String) As CountryRecord() + + Return GetRecords(where, Nothing, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) + End Function + + ''' + ''' This is a shared function that can be used to get an array of CountryRecord records using a where clause. + ''' + Public Shared Function GetRecords(ByVal join As BaseFilter, ByVal where As String) As CountryRecord() + + Return GetRecords(join, where, Nothing, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) + End Function + + ''' + ''' This is a shared function that can be used to get an array of CountryRecord records using a where and order by clause. + ''' + Public Shared Function GetRecords( _ + ByVal where As String, _ + ByVal orderBy As OrderBy) As CountryRecord() + + Return GetRecords(where, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) + End Function + + ''' + ''' This is a shared function that can be used to get an array of CountryRecord records using a where and order by clause. + ''' + Public Shared Function GetRecords( _ + ByVal join As BaseFilter, _ + ByVal where As String, _ + ByVal orderBy As OrderBy) As CountryRecord() + + Return GetRecords(join, where, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) + End Function + + ''' + ''' This is a shared function that can be used to get an array of CountryRecord records using a where and order by clause clause with pagination. + ''' + Public Shared Function GetRecords( _ + ByVal where As String, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As CountryRecord() + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + Dim join As BaseClasses.Data.BaseFilter = Nothing + Dim recList As ArrayList = CountryTable.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, pageIndex, pageSize) + + Return CType(recList.ToArray(GetType(Persons.Business.CountryRecord)), CountryRecord()) + End Function + + ''' + ''' This is a shared function that can be used to get an array of CountryRecord records using a where and order by clause clause with pagination. + ''' + Public Shared Function GetRecords( _ + ByVal join As BaseFilter, _ + ByVal where As String, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As CountryRecord() + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Dim recList As ArrayList = CountryTable.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, pageIndex, pageSize) + + Return CType(recList.ToArray(GetType(Persons.Business.CountryRecord)), CountryRecord()) + End Function + + Public Shared Function GetRecords( _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As CountryRecord() + Dim join As BaseClasses.Data.BaseFilter = Nothing + Dim recList As ArrayList = CountryTable.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + Return CType(recList.ToArray(GetType(Persons.Business.CountryRecord)), CountryRecord()) + End Function + + Public Shared Function GetRecords( _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As CountryRecord() + + Dim recList As ArrayList = CountryTable.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + Return CType(recList.ToArray(GetType(Persons.Business.CountryRecord)), CountryRecord()) + End Function + + Public Shared Function GetRecords( _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer, _ + ByRef totalRecords As Integer) As CountryRecord() + Dim join As BaseClasses.Data.BaseFilter = Nothing + Dim recList As ArrayList = CountryTable.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize, totalRecords) + + Return CType(recList.ToArray(GetType(Persons.Business.CountryRecord)), CountryRecord()) + End Function + + Public Shared Function GetRecords( _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer, _ + ByRef totalRecords As Integer) As CountryRecord() + + Dim recList As ArrayList = CountryTable.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize, totalRecords) + + Return CType(recList.ToArray(GetType(Persons.Business.CountryRecord)), CountryRecord()) + End Function + + ''' + ''' This is a shared function that can be used to get total number of records that will be returned using the where clause. + ''' + Public Shared Function GetRecordCount(ByVal where As String) As Integer + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Return CInt(CountryTable.Instance.GetRecordListCount(Nothing, whereFilter, Nothing, Nothing)) + End Function + +''' + ''' This is a shared function that can be used to get total number of records that will be returned using the where clause. + ''' + Public Shared Function GetRecordCount(ByVal join As BaseFilter, ByVal where As String) As Integer + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Return CInt(CountryTable.Instance.GetRecordListCount(join, whereFilter, Nothing, Nothing)) + End Function + + Public Shared Function GetRecordCount(ByVal where As WhereClause) As Integer + Return CInt(CountryTable.Instance.GetRecordListCount(Nothing, where.GetFilter(), Nothing, Nothing)) + End Function + + Public Shared Function GetRecordCount(ByVal join As BaseFilter, ByVal where As WhereClause) As Integer + Return CInt(CountryTable.Instance.GetRecordListCount(join, where.GetFilter(), Nothing, Nothing)) + End Function + + ''' + ''' This is a shared function that can be used to get a CountryRecord record using a where clause. + ''' + Public Shared Function GetRecord(ByVal where As String) As CountryRecord + Dim orderBy As OrderBy = Nothing + Return GetRecord(where, orderBy) + End Function + + ''' + ''' This is a shared function that can be used to get a CountryRecord record using a where clause. + ''' + Public Shared Function GetRecord(ByVal join As BaseFilter, ByVal where As String) As CountryRecord + Dim orderBy As OrderBy = Nothing + Return GetRecord(join, where, orderBy) + End Function + + ''' + ''' This is a shared function that can be used to get a CountryRecord record using a where and order by clause. + ''' + Public Shared Function GetRecord( _ + ByVal where As String, _ + ByVal orderBy As OrderBy) As CountryRecord + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + Dim join As BaseClasses.Data.BaseFilter = Nothing + Dim recList As ArrayList = CountryTable.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MIN_BATCH_SIZE) + + Dim rec As CountryRecord = Nothing + If recList.Count > 0 Then + rec = CType(recList(0), CountryRecord) + End If + + Return rec + End Function + + ''' + ''' This is a shared function that can be used to get a CountryRecord record using a where and order by clause. + ''' + Public Shared Function GetRecord( _ + ByVal join As BaseFilter, _ + ByVal where As String, _ + ByVal orderBy As OrderBy) As CountryRecord + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Dim recList As ArrayList = CountryTable.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MIN_BATCH_SIZE) + + Dim rec As CountryRecord = Nothing + If recList.Count > 0 Then + rec = CType(recList(0), CountryRecord) + End If + + Return rec + End Function + + + Public Shared Function GetValues( _ + ByVal col As BaseColumn, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal maxItems As Integer) As String() + + ' Create the filter list. + Dim retCol As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, True) + retCol.AddColumn(col) + + Return CountryTable.Instance.GetColumnValues(retCol, Nothing, where.GetFilter(), Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, maxItems) + + End Function + + Public Shared Function GetValues( _ + ByVal col As BaseColumn, _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal maxItems As Integer) As String() + + ' Create the filter list. + Dim retCol As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, True) + retCol.AddColumn(col) + + Return CountryTable.Instance.GetColumnValues(retCol, join, where.GetFilter(), Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, maxItems) + + End Function + + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where clause. + ''' + Public Shared Function GetDataTable(ByVal where As String) As System.Data.DataTable + + Dim recs() As CountryRecord = GetRecords(where) + Return CountryTable.Instance.CreateDataTable(recs, Nothing) + End Function + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where clause. + ''' + Public Shared Function GetDataTable(ByVal join As BaseFilter, ByVal where As String) As System.Data.DataTable + + Dim recs() As CountryRecord = GetRecords(join, where) + Return CountryTable.Instance.CreateDataTable(recs, Nothing) + End Function + + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause. + ''' + Public Shared Function GetDataTable(ByVal where As String, ByVal orderBy As OrderBy) As System.Data.DataTable + + Dim recs() As CountryRecord = GetRecords(where, orderBy) + Return CountryTable.Instance.CreateDataTable(recs, Nothing) + End Function + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause. + ''' + Public Shared Function GetDataTable(ByVal join As BaseFilter, ByVal where As String, ByVal orderBy As OrderBy) As System.Data.DataTable + + Dim recs() As CountryRecord = GetRecords(join, where, orderBy) + Return CountryTable.Instance.CreateDataTable(recs, Nothing) + End Function + + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause with pagination. + ''' + Public Shared Function GetDataTable( _ + ByVal where As String, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As System.Data.DataTable + + Dim recs() As CountryRecord = GetRecords(where, orderBy, pageIndex, pageSize) + Return CountryTable.Instance.CreateDataTable(recs, Nothing) + End Function + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause with pagination. + ''' + Public Shared Function GetDataTable( _ + ByVal join As BaseFilter, _ + ByVal where As String, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As System.Data.DataTable + + Dim recs() As CountryRecord = GetRecords(join, where, orderBy, pageIndex, pageSize) + Return CountryTable.Instance.CreateDataTable(recs, Nothing) + End Function + + + ''' + ''' This is a shared function that can be used to delete records using a where clause. + ''' + Public Shared Sub DeleteRecords(ByVal where As String) + If where = Nothing OrElse where.Trim() = "" Then + Return + End If + + Dim whereFilter As SqlFilter = New SqlFilter(where) + CountryTable.Instance.DeleteRecordList(whereFilter) + End Sub + + ''' + ''' This is a shared function that can be used to export records using a where clause. + ''' + Public Shared Function Export(ByVal where As String) As String + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Return CountryTable.Instance.ExportRecordData(whereFilter) + End Function + + Public Shared Function Export(ByVal where As WhereClause) As String + Dim whereFilter As BaseFilter = Nothing + If Not where Is Nothing Then + whereFilter = where.GetFilter() + End If + + Return CountryTable.Instance.ExportRecordData(whereFilter) + End Function + + Public Shared Function GetSum( _ + ByVal col As BaseColumn, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) _ + As String + + Dim colSel As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, False) + colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Sum) + + Return CountryTable.Instance.GetColumnStatistics(colSel, Nothing, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + End Function + + Public Shared Function GetSum( _ + ByVal col As BaseColumn, _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) _ + As String + + Dim colSel As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, False) + colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Sum) + + Return CountryTable.Instance.GetColumnStatistics(colSel, join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + End Function + + + Public Shared Function GetCount( _ + ByVal col As BaseColumn, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) _ + As String + + Dim colSel As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, False) + colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Count) + + Return CountryTable.Instance.GetColumnStatistics(colSel, Nothing, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + End Function + + Public Shared Function GetCount( _ + ByVal col As BaseColumn, _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) _ + As String + + Dim colSel As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, False) + colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Count) + + Return CountryTable.Instance.GetColumnStatistics(colSel, join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + End Function + + ''' + ''' This method returns the columns in the table. + ''' + Public Shared Function GetColumns() As BaseColumn() + Return CountryTable.Instance.TableDefinition.Columns + End Function + + ''' + ''' This method returns the columnlist in the table. + ''' + Public Shared Function GetColumnList() As ColumnList + Return CountryTable.Instance.TableDefinition.ColumnList + End Function + + + ''' + ''' This method creates a new record and returns it to be edited. + ''' + Public Shared Function CreateNewRecord() As IRecord + Return CountryTable.Instance.CreateRecord() + End Function + + ''' + ''' This method creates a new record and returns it to be edited. + ''' + ''' ID of the new record. + Public Shared Function CreateNewRecord(ByVal tempId As String) As IRecord + Return CountryTable.Instance.CreateRecord(tempId) + End Function + + ''' + ''' This method checks if column is editable. + ''' + ''' Name of the column to check. + Public Shared Function isReadOnlyColumn(ByVal columnName As String) As Boolean + Dim column As BaseColumn = GetColumn(columnName) + If (Not IsNothing(column)) Then + Return column.IsValuesReadOnly + Else + Return True + End If + End Function + + ''' + ''' This method gets the specified column. + ''' + ''' Unique name of the column to fetch. + Public Shared Function GetColumn(ByVal uniqueColumnName As String) As BaseColumn + Dim column As BaseColumn = CountryTable.Instance.TableDefinition.ColumnList.GetByUniqueName(uniqueColumnName) + Return column + End Function + + ' Convenience method for getting a record using a string-based record identifier + Public Shared Function GetRecord(ByVal id As String, ByVal bMutable As Boolean) As CountryRecord + Return CType(CountryTable.Instance.GetRecordData(id, bMutable), CountryRecord) + End Function + + ' Convenience method for getting a record using a KeyValue record identifier + Public Shared Function GetRecord(ByVal id As KeyValue, ByVal bMutable As Boolean) As CountryRecord + Return CType(CountryTable.Instance.GetRecordData(id, bMutable), CountryRecord) + End Function + + ' Convenience method for creating a record + Public Overloads Function NewRecord( _ + ByVal CountryIdValue As String, _ + ByVal CountryValue As String _ + ) As KeyValue + Dim rec As IPrimaryKeyRecord = CType(Me.CreateRecord(), IPrimaryKeyRecord) + rec.SetString(CountryIdValue, CountryIdColumn) + rec.SetString(CountryValue, CountryColumn) + + + rec.Create() 'update the DB so any DB-initialized fields (like autoincrement IDs) can be initialized + + Dim key As KeyValue = rec.GetID() + Return key + End Function + + ''' + ''' This method deletes a specified record + ''' + ''' Keyvalue of the record to be deleted. + Public Shared Sub DeleteRecord(ByVal kv As KeyValue) + CountryTable.Instance.DeleteOneRecord(kv) + End Sub + + ''' + ''' This method checks if record exist in the database using the keyvalue provided. + ''' + ''' Key value of the record. + Public Shared Function DoesRecordExist(ByVal kv As KeyValue) As Boolean + Dim recordExist As Boolean = True + Try + CountryTable.GetRecord(kv, False) + Catch ex As Exception + recordExist = False + End Try + Return recordExist + End Function + + ''' + ''' This method returns all the primary columns in the table. + ''' + Public Shared Function GetPrimaryKeyColumns() As ColumnList + If (Not IsNothing(CountryTable.Instance.TableDefinition.PrimaryKey)) Then + Return CountryTable.Instance.TableDefinition.PrimaryKey.Columns + Else + Return Nothing + End If + End Function + + ''' + ''' This method takes a key and returns a keyvalue. + ''' + ''' key could be array of primary key values in case of composite primary key or a string containing single primary key value in case of non-composite primary key. + Public Shared Function GetKeyValue(ByVal key As Object) As KeyValue + Dim kv As KeyValue = Nothing + + If (Not (IsNothing(CountryTable.Instance.TableDefinition.PrimaryKey))) Then + + Dim isCompositePrimaryKey As Boolean = False + isCompositePrimaryKey = CountryTable.Instance.TableDefinition.PrimaryKey.IsCompositeKey + + If ((isCompositePrimaryKey) AndAlso (key.GetType.IsArray())) Then + + ' If the key is composite, then construct a key value. + kv = New KeyValue + Dim fullKeyString As String = "" + Dim keyArray As Array = CType(key, Array) + If (Not IsNothing(keyArray)) Then + Dim length As Integer = keyArray.Length + Dim pkColumns As ColumnList = CountryTable.Instance.TableDefinition.PrimaryKey.Columns + Dim pkColumn As BaseColumn + Dim index As Integer = 0 + For Each pkColumn In pkColumns + Dim keyString As String = CType(keyArray.GetValue(index), String) + If (CountryTable.Instance.TableDefinition.TableType = BaseClasses.Data.TableDefinition.TableTypes.Virtual) Then + kv.AddElement(pkColumn.UniqueName, keyString) + Else + kv.AddElement(pkColumn.InternalName, keyString) + End If + index = index + 1 + Next pkColumn + End If + + Else + ' If the key is not composite, then get the key value. + kv = CountryTable.Instance.TableDefinition.PrimaryKey.ParseValue(CType(key, String)) + End If + End If + Return kv + End Function + + + ''' + ''' This method takes a record and a Column and returns an evaluated value of DFKA formula. + ''' + Public Shared Function GetDFKA(ByVal rec As BaseRecord, ByVal col As BaseColumn) As String + Dim fkColumn As ForeignKey = CountryTable.Instance.TableDefinition.GetExpandableNonCompositeForeignKey(col) + If fkColumn Is Nothing Then + Return Nothing + End If + Dim _DFKA As String = fkColumn.PrimaryKeyDisplayColumns + If (_DFKA.Trim().StartsWith("=")) Then + ' if the formula is in the format of "= ., then pull out the data from the rec object instead of doing formula evaluation + Dim tableCodeName As String = fkColumn.PrimaryKeyTableDefinition.TableCodeName + Dim column As String = _DFKA.Trim("="c).Trim() + If column.StartsWith(tableCodeName & ".", StringComparison.InvariantCultureIgnoreCase) Then + column = column.Substring(tableCodeName.Length + 1) + End If + + For Each c As BaseColumn In fkColumn.PrimaryKeyTableDefinition.Columns + If column = c.CodeName Then + Return rec.Format(c) + End If + Next + Dim tableName As String = fkColumn.PrimaryKeyTableDefinition.TableCodeName + Return EvaluateFormula(_DFKA, rec, Nothing, tableName) + Else + Return Nothing + End If + End Function + + ''' + ''' This method takes a keyValue and a Column and returns an evaluated value of DFKA formula. + ''' + Public Shared Function GetDFKA(ByVal keyValue As String, ByVal col As BaseColumn, ByVal formatPattern as String) As String + If keyValue Is Nothing Then + Return Nothing + End If + Dim fkColumn As ForeignKey = CountryTable.Instance.TableDefinition.GetExpandableNonCompositeForeignKey(col) + If fkColumn Is Nothing Then + Return Nothing + End If + Dim _DFKA As String = fkColumn.PrimaryKeyDisplayColumns + If (_DFKA.Trim().StartsWith("=")) Then + Dim tableName As String = fkColumn.PrimaryKeyTableDefinition.TableCodeName + Dim t As PrimaryKeyTable = CType(DatabaseObjects.GetTableObject(tableName), PrimaryKeyTable) + Dim rec As BaseRecord = Nothing + If Not t Is Nothing Then + Try + rec = CType(t.GetRecordData(keyValue, False), BaseRecord) + Catch + rec = Nothing + End Try + End If + If rec Is Nothing Then + Return "" + End If + + ' if the formula is in the format of "= ., then pull out the data from the rec object instead of doing formula evaluation + Dim tableCodeName As String = fkColumn.PrimaryKeyTableDefinition.TableCodeName + Dim column As String = _DFKA.Trim("="c).Trim() + If column.StartsWith(tableCodeName & ".", StringComparison.InvariantCultureIgnoreCase) Then + column = column.Substring(tableCodeName.Length + 1) + End If + + For Each c As BaseColumn In fkColumn.PrimaryKeyTableDefinition.Columns + If column = c.CodeName Then + Return rec.Format(c) + End If + Next + Return EvaluateFormula(_DFKA, rec, Nothing, tableName) + Else + Return Nothing + End If + End Function + + ''' + ''' Evaluates the formula + ''' + Public Shared Function EvaluateFormula(ByVal formula As String, Optional ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord = Nothing, Optional ByVal format As String = Nothing, Optional ByVal name As String = "") As String + Dim e As BaseFormulaEvaluator = New BaseFormulaEvaluator() + If Not dataSourceForEvaluate Is Nothing Then + e.Evaluator.Variables.Add(name, dataSourceForEvaluate) + end if + e.DataSource = dataSourceForEvaluate + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + If Not String.IsNullOrEmpty(format) Then + Return BaseFormulaUtils.Format(resultObj, format) + Else + Return resultObj.ToString() + End If + End Function + + +#End Region + +End Class +End Namespace diff --git a/App_Code/Business Layer/BaseDeptRecord.vb b/App_Code/Business Layer/BaseDeptRecord.vb new file mode 100644 index 0000000..8634a79 --- /dev/null +++ b/App_Code/Business Layer/BaseDeptRecord.vb @@ -0,0 +1,657 @@ +' This class is "generated" and will be overwritten. +' Your customizations should be made in DeptRecord.vb + +Imports System.Data.SqlTypes +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + +Namespace Persons.Business + +''' +''' The generated superclass for the class. +''' +''' +''' This class is not intended to be instantiated directly. To obtain an instance of this class, +''' use the methods of the class. +''' +''' +''' + + Public Class BaseDeptRecord + Inherits PrimaryKeyRecord + + + Public Shared Shadows ReadOnly TableUtils As DeptTable = DeptTable.Instance + + ' Constructors + + Protected Sub New() + MyBase.New(TableUtils) + End Sub + + Protected Sub New(ByVal record As PrimaryKeyRecord) + MyBase.New(record, TableUtils) + End Sub + + 'Evaluates Initialize when->Inserting record formulas specified at the data access layer + Public Overridable Sub DeptRecord_InsertingRecord(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles Me.InsertingRecord + 'Apply Initialize->Inserting record formula only if validation is successful. + Dim DeptRec As DeptRecord = CType(sender,DeptRecord) + Validate_Inserting() + If Not DeptRec Is Nothing AndAlso Not DeptRec.IsReadOnly Then + End If + End Sub + + 'Evaluates Initialize when->Updating record formulas specified at the data access layer + Public Overridable Sub DeptRecord_UpdatingRecord(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles Me.UpdatingRecord + 'Apply Initialize->Updating record formula only if validation is successful. + Dim DeptRec As DeptRecord = CType(sender,DeptRecord) + Validate_Updating() + If Not DeptRec Is Nothing AndAlso Not DeptRec.IsReadOnly Then + End If + End Sub + + 'Evaluates Initialize when->Reading record formulas specified at the data access layer + Public Overridable Sub DeptRecord_ReadRecord(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.ReadRecord + 'Apply Initialize->Reading record formula only if validation is successful. + Dim DeptRec As DeptRecord = CType(sender,DeptRecord) + If Not DeptRec Is Nothing AndAlso Not DeptRec.IsReadOnly Then + End If + End Sub + + 'Evaluates Validate when->Inserting formulas specified at the data access layer + Public Overridable Sub Validate_Inserting () + Dim fullValidationMessage As String = "" + Dim validationMessage As String = "" + + dim formula as String = "" + + + If validationMessage <> "" AndAlso validationMessage.ToLower() <> "true" Then + fullValidationMessage &= validationMessage & vbCrLf + End If + + If fullValidationMessage <> "" Then + Throw New Exception(fullValidationMessage) + End If + End Sub + + 'Evaluates Validate when->Updating formulas specified at the data access layer + Public Overridable Sub Validate_Updating () + Dim fullValidationMessage As String = "" + Dim validationMessage As String = "" + + dim formula as String = "" + + + If validationMessage <> "" AndAlso validationMessage.ToLower() <> "true" Then + fullValidationMessage &= validationMessage & vbCrLf + End If + + If fullValidationMessage <> "" Then + Throw New Exception(fullValidationMessage) + End If + End Sub + + Public Overridable Function EvaluateFormula(ByVal formula As String, Optional ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord = Nothing, Optional ByVal format As String = Nothing) As String + + Dim e As Data.BaseFormulaEvaluator = New Data.BaseFormulaEvaluator() + + ' All variables referred to in the formula are expected to be + ' properties of the DataSource. For example, referring to + ' UnitPrice as a variable will refer to DataSource.UnitPrice + e.DataSource = dataSourceForEvaluate + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + Return resultObj.ToString() + End Function + + + + + + + +#Region "Convenience methods to get/set values of fields" + + ''' + ''' This is a convenience method that provides direct access to the value of the record's Dept_.DeptId field. + ''' + Public Function GetDeptIdValue() As ColumnValue + Return Me.GetValue(TableUtils.DeptIdColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's Dept_.DeptId field. + ''' + Public Function GetDeptIdFieldValue() As Int16 + Return CType(Me.GetValue(TableUtils.DeptIdColumn).ToInt16(), Int16) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Dept_.DeptId field. + ''' + Public Sub SetDeptIdFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.DeptIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Dept_.DeptId field. + ''' + Public Sub SetDeptIdFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.DeptIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Dept_.DeptId field. + ''' + Public Sub SetDeptIdFieldValue(ByVal val As Double) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.DeptIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Dept_.DeptId field. + ''' + Public Sub SetDeptIdFieldValue(ByVal val As Decimal) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.DeptIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Dept_.DeptId field. + ''' + Public Sub SetDeptIdFieldValue(ByVal val As Int64) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.DeptIdColumn) + End Sub + ''' + ''' This is a convenience method that provides direct access to the value of the record's Dept_.SectionId field. + ''' + Public Function GetSectionIdValue() As ColumnValue + Return Me.GetValue(TableUtils.SectionIdColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's Dept_.SectionId field. + ''' + Public Function GetSectionIdFieldValue() As Int16 + Return CType(Me.GetValue(TableUtils.SectionIdColumn).ToInt16(), Int16) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Dept_.SectionId field. + ''' + Public Sub SetSectionIdFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.SectionIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Dept_.SectionId field. + ''' + Public Sub SetSectionIdFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.SectionIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Dept_.SectionId field. + ''' + Public Sub SetSectionIdFieldValue(ByVal val As Double) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.SectionIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Dept_.SectionId field. + ''' + Public Sub SetSectionIdFieldValue(ByVal val As Decimal) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.SectionIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Dept_.SectionId field. + ''' + Public Sub SetSectionIdFieldValue(ByVal val As Int64) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.SectionIdColumn) + End Sub + ''' + ''' This is a convenience method that provides direct access to the value of the record's Dept_.Dept field. + ''' + Public Function GetDeptValue() As ColumnValue + Return Me.GetValue(TableUtils.DeptColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's Dept_.Dept field. + ''' + Public Function GetDeptFieldValue() As String + Return CType(Me.GetValue(TableUtils.DeptColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Dept_.Dept field. + ''' + Public Sub SetDeptFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.DeptColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Dept_.Dept field. + ''' + Public Sub SetDeptFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.DeptColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's Dept_.DeptAbbvr field. + ''' + Public Function GetDeptAbbvrValue() As ColumnValue + Return Me.GetValue(TableUtils.DeptAbbvrColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's Dept_.DeptAbbvr field. + ''' + Public Function GetDeptAbbvrFieldValue() As String + Return CType(Me.GetValue(TableUtils.DeptAbbvrColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Dept_.DeptAbbvr field. + ''' + Public Sub SetDeptAbbvrFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.DeptAbbvrColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Dept_.DeptAbbvr field. + ''' + Public Sub SetDeptAbbvrFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.DeptAbbvrColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's Dept_.ChiefId field. + ''' + Public Function GetChiefIdValue() As ColumnValue + Return Me.GetValue(TableUtils.ChiefIdColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's Dept_.ChiefId field. + ''' + Public Function GetChiefIdFieldValue() As Int32 + Return CType(Me.GetValue(TableUtils.ChiefIdColumn).ToInt32(), Int32) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Dept_.ChiefId field. + ''' + Public Sub SetChiefIdFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.ChiefIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Dept_.ChiefId field. + ''' + Public Sub SetChiefIdFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.ChiefIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Dept_.ChiefId field. + ''' + Public Sub SetChiefIdFieldValue(ByVal val As Double) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.ChiefIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Dept_.ChiefId field. + ''' + Public Sub SetChiefIdFieldValue(ByVal val As Decimal) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.ChiefIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Dept_.ChiefId field. + ''' + Public Sub SetChiefIdFieldValue(ByVal val As Int64) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.ChiefIdColumn) + End Sub + ''' + ''' This is a convenience method that provides direct access to the value of the record's Dept_.Position field. + ''' + Public Function GetPositionValue() As ColumnValue + Return Me.GetValue(TableUtils.PositionColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's Dept_.Position field. + ''' + Public Function GetPositionFieldValue() As String + Return CType(Me.GetValue(TableUtils.PositionColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Dept_.Position field. + ''' + Public Sub SetPositionFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.PositionColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Dept_.Position field. + ''' + Public Sub SetPositionFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.PositionColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's Dept_.Sign field. + ''' + Public Function GetSignValue() As ColumnValue + Return Me.GetValue(TableUtils.SignColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's Dept_.Sign field. + ''' + Public Function GetSignFieldValue() As Byte() + Return CType(Me.GetValue(TableUtils.SignColumn).ToBinary(), Byte()) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Dept_.Sign field. + ''' + Public Sub SetSignFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.SignColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Dept_.Sign field. + ''' + Public Sub SetSignFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.SignColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Dept_.Sign field. + ''' + Public Sub SetSignFieldValue(ByVal val As Byte ()) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.SignColumn) + End Sub + + +#End Region + +#Region "Convenience methods to get field names" + + ''' + ''' This is a convenience property that provides direct access to the value of the record's Dept_.DeptId field. + ''' + Public Property DeptId() As Int16 + Get + Return CType(Me.GetValue(TableUtils.DeptIdColumn).ToInt16(), Int16) + End Get + Set (ByVal val As Int16) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.DeptIdColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property DeptIdSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.DeptIdColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property DeptIdDefault() As String + Get + Return TableUtils.DeptIdColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's Dept_.SectionId field. + ''' + Public Property SectionId() As Int16 + Get + Return CType(Me.GetValue(TableUtils.SectionIdColumn).ToInt16(), Int16) + End Get + Set (ByVal val As Int16) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.SectionIdColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property SectionIdSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.SectionIdColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property SectionIdDefault() As String + Get + Return TableUtils.SectionIdColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's Dept_.Dept field. + ''' + Public Property Dept() As String + Get + Return CType(Me.GetValue(TableUtils.DeptColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.DeptColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property DeptSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.DeptColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property DeptDefault() As String + Get + Return TableUtils.DeptColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's Dept_.DeptAbbvr field. + ''' + Public Property DeptAbbvr() As String + Get + Return CType(Me.GetValue(TableUtils.DeptAbbvrColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.DeptAbbvrColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property DeptAbbvrSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.DeptAbbvrColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property DeptAbbvrDefault() As String + Get + Return TableUtils.DeptAbbvrColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's Dept_.ChiefId field. + ''' + Public Property ChiefId() As Int32 + Get + Return CType(Me.GetValue(TableUtils.ChiefIdColumn).ToInt32(), Int32) + End Get + Set (ByVal val As Int32) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.ChiefIdColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property ChiefIdSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.ChiefIdColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property ChiefIdDefault() As String + Get + Return TableUtils.ChiefIdColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's Dept_.Position field. + ''' + Public Property Position() As String + Get + Return CType(Me.GetValue(TableUtils.PositionColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.PositionColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property PositionSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.PositionColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property PositionDefault() As String + Get + Return TableUtils.PositionColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's Dept_.Sign field. + ''' + Public Property Sign() As Byte() + Get + Return CType(Me.GetValue(TableUtils.SignColumn).ToBinary(), Byte()) + End Get + Set (ByVal val As Byte ()) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.SignColumn) + End Set + End Property + + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property SignSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.SignColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property SignDefault() As String + Get + Return TableUtils.SignColumn.DefaultValue + End Get + End Property + + + +#End Region + +End Class +End Namespace diff --git a/App_Code/Business Layer/BaseDeptTable.vb b/App_Code/Business Layer/BaseDeptTable.vb new file mode 100644 index 0000000..8d0b264 --- /dev/null +++ b/App_Code/Business Layer/BaseDeptTable.vb @@ -0,0 +1,888 @@ +' This class is "generated" and will be overwritten. +' Your customizations should be made in DeptRecord.vb + +Imports System.Data.SqlTypes +Imports System.Data +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider +Imports Persons.Data + +Namespace Persons.Business + +''' +''' The generated superclass for the class. +''' Provides access to the schema information and record data of a database table or view named Dept. +''' +''' +''' The connection details (name, location, etc.) of the database and table (or view) accessed by this class +''' are resolved at runtime based on the connection string in the application's Web.Config file. +''' +''' This class is not intended to be instantiated directly. To obtain an instance of this class, use +''' DeptTable.Instance. +''' +''' +''' + + Public Class BaseDeptTable + Inherits PrimaryKeyTable + + + Private ReadOnly TableDefinitionString As String = DeptDefinition.GetXMLString() + + + + + + + + Protected Sub New() + MyBase.New() + Me.Initialize() + End Sub + + Protected Overridable Sub Initialize() + Dim def As New XmlTableDefinition(TableDefinitionString) + Me.TableDefinition = New TableDefinition() + Me.TableDefinition.TableClassName = System.Reflection.Assembly.CreateQualifiedName("App_Code", "Persons.Business.DeptTable") + def.InitializeTableDefinition(Me.TableDefinition) + Me.ConnectionName = def.GetConnectionName() + Me.RecordClassName = System.Reflection.Assembly.CreateQualifiedName("App_Code", "Persons.Business.DeptRecord") + Me.ApplicationName = "App_Code" + Me.DataAdapter = New DeptSqlTable() + Directcast(Me.DataAdapter, DeptSqlTable).ConnectionName = Me.ConnectionName + + Me.TableDefinition.AdapterMetaData = Me.DataAdapter.AdapterMetaData + DeptIdColumn.CodeName = "DeptId" + SectionIdColumn.CodeName = "SectionId" + DeptColumn.CodeName = "Dept" + DeptAbbvrColumn.CodeName = "DeptAbbvr" + ChiefIdColumn.CodeName = "ChiefId" + PositionColumn.CodeName = "Position" + SignColumn.CodeName = "Sign" + + End Sub + +#Region "Overriden methods" + + +#End Region + +#Region "Properties for columns" + + ''' + ''' This is a convenience property that provides direct access to the table's Dept_.DeptId column object. + ''' + Public ReadOnly Property DeptIdColumn() As BaseClasses.Data.NumberColumn + Get + Return CType(Me.TableDefinition.ColumnList(0), BaseClasses.Data.NumberColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's Dept_.DeptId column object. + ''' + Public Shared ReadOnly Property DeptId() As BaseClasses.Data.NumberColumn + Get + Return DeptTable.Instance.DeptIdColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's Dept_.SectionId column object. + ''' + Public ReadOnly Property SectionIdColumn() As BaseClasses.Data.NumberColumn + Get + Return CType(Me.TableDefinition.ColumnList(1), BaseClasses.Data.NumberColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's Dept_.SectionId column object. + ''' + Public Shared ReadOnly Property SectionId() As BaseClasses.Data.NumberColumn + Get + Return DeptTable.Instance.SectionIdColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's Dept_.Dept column object. + ''' + Public ReadOnly Property DeptColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(2), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's Dept_.Dept column object. + ''' + Public Shared ReadOnly Property Dept() As BaseClasses.Data.StringColumn + Get + Return DeptTable.Instance.DeptColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's Dept_.DeptAbbvr column object. + ''' + Public ReadOnly Property DeptAbbvrColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(3), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's Dept_.DeptAbbvr column object. + ''' + Public Shared ReadOnly Property DeptAbbvr() As BaseClasses.Data.StringColumn + Get + Return DeptTable.Instance.DeptAbbvrColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's Dept_.ChiefId column object. + ''' + Public ReadOnly Property ChiefIdColumn() As BaseClasses.Data.NumberColumn + Get + Return CType(Me.TableDefinition.ColumnList(4), BaseClasses.Data.NumberColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's Dept_.ChiefId column object. + ''' + Public Shared ReadOnly Property ChiefId() As BaseClasses.Data.NumberColumn + Get + Return DeptTable.Instance.ChiefIdColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's Dept_.Position column object. + ''' + Public ReadOnly Property PositionColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(5), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's Dept_.Position column object. + ''' + Public Shared ReadOnly Property Position() As BaseClasses.Data.StringColumn + Get + Return DeptTable.Instance.PositionColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's Dept_.Sign column object. + ''' + Public ReadOnly Property SignColumn() As BaseClasses.Data.ImageColumn + Get + Return CType(Me.TableDefinition.ColumnList(6), BaseClasses.Data.ImageColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's Dept_.Sign column object. + ''' + Public Shared ReadOnly Property Sign() As BaseClasses.Data.ImageColumn + Get + Return DeptTable.Instance.SignColumn + End Get + End Property + + +#End Region + + +#Region "Shared helper methods" + + ''' + ''' This is a shared function that can be used to get an array of DeptRecord records using a where clause. + ''' + Public Shared Function GetRecords(ByVal where As String) As DeptRecord() + + Return GetRecords(where, Nothing, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) + End Function + + ''' + ''' This is a shared function that can be used to get an array of DeptRecord records using a where clause. + ''' + Public Shared Function GetRecords(ByVal join As BaseFilter, ByVal where As String) As DeptRecord() + + Return GetRecords(join, where, Nothing, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) + End Function + + ''' + ''' This is a shared function that can be used to get an array of DeptRecord records using a where and order by clause. + ''' + Public Shared Function GetRecords( _ + ByVal where As String, _ + ByVal orderBy As OrderBy) As DeptRecord() + + Return GetRecords(where, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) + End Function + + ''' + ''' This is a shared function that can be used to get an array of DeptRecord records using a where and order by clause. + ''' + Public Shared Function GetRecords( _ + ByVal join As BaseFilter, _ + ByVal where As String, _ + ByVal orderBy As OrderBy) As DeptRecord() + + Return GetRecords(join, where, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) + End Function + + ''' + ''' This is a shared function that can be used to get an array of DeptRecord records using a where and order by clause clause with pagination. + ''' + Public Shared Function GetRecords( _ + ByVal where As String, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As DeptRecord() + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + Dim join As BaseClasses.Data.BaseFilter = Nothing + Dim recList As ArrayList = DeptTable.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, pageIndex, pageSize) + + Return CType(recList.ToArray(GetType(Persons.Business.DeptRecord)), DeptRecord()) + End Function + + ''' + ''' This is a shared function that can be used to get an array of DeptRecord records using a where and order by clause clause with pagination. + ''' + Public Shared Function GetRecords( _ + ByVal join As BaseFilter, _ + ByVal where As String, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As DeptRecord() + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Dim recList As ArrayList = DeptTable.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, pageIndex, pageSize) + + Return CType(recList.ToArray(GetType(Persons.Business.DeptRecord)), DeptRecord()) + End Function + + Public Shared Function GetRecords( _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As DeptRecord() + Dim join As BaseClasses.Data.BaseFilter = Nothing + Dim recList As ArrayList = DeptTable.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + Return CType(recList.ToArray(GetType(Persons.Business.DeptRecord)), DeptRecord()) + End Function + + Public Shared Function GetRecords( _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As DeptRecord() + + Dim recList As ArrayList = DeptTable.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + Return CType(recList.ToArray(GetType(Persons.Business.DeptRecord)), DeptRecord()) + End Function + + Public Shared Function GetRecords( _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer, _ + ByRef totalRecords As Integer) As DeptRecord() + Dim join As BaseClasses.Data.BaseFilter = Nothing + Dim recList As ArrayList = DeptTable.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize, totalRecords) + + Return CType(recList.ToArray(GetType(Persons.Business.DeptRecord)), DeptRecord()) + End Function + + Public Shared Function GetRecords( _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer, _ + ByRef totalRecords As Integer) As DeptRecord() + + Dim recList As ArrayList = DeptTable.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize, totalRecords) + + Return CType(recList.ToArray(GetType(Persons.Business.DeptRecord)), DeptRecord()) + End Function + + ''' + ''' This is a shared function that can be used to get total number of records that will be returned using the where clause. + ''' + Public Shared Function GetRecordCount(ByVal where As String) As Integer + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Return CInt(DeptTable.Instance.GetRecordListCount(Nothing, whereFilter, Nothing, Nothing)) + End Function + +''' + ''' This is a shared function that can be used to get total number of records that will be returned using the where clause. + ''' + Public Shared Function GetRecordCount(ByVal join As BaseFilter, ByVal where As String) As Integer + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Return CInt(DeptTable.Instance.GetRecordListCount(join, whereFilter, Nothing, Nothing)) + End Function + + Public Shared Function GetRecordCount(ByVal where As WhereClause) As Integer + Return CInt(DeptTable.Instance.GetRecordListCount(Nothing, where.GetFilter(), Nothing, Nothing)) + End Function + + Public Shared Function GetRecordCount(ByVal join As BaseFilter, ByVal where As WhereClause) As Integer + Return CInt(DeptTable.Instance.GetRecordListCount(join, where.GetFilter(), Nothing, Nothing)) + End Function + + ''' + ''' This is a shared function that can be used to get a DeptRecord record using a where clause. + ''' + Public Shared Function GetRecord(ByVal where As String) As DeptRecord + Dim orderBy As OrderBy = Nothing + Return GetRecord(where, orderBy) + End Function + + ''' + ''' This is a shared function that can be used to get a DeptRecord record using a where clause. + ''' + Public Shared Function GetRecord(ByVal join As BaseFilter, ByVal where As String) As DeptRecord + Dim orderBy As OrderBy = Nothing + Return GetRecord(join, where, orderBy) + End Function + + ''' + ''' This is a shared function that can be used to get a DeptRecord record using a where and order by clause. + ''' + Public Shared Function GetRecord( _ + ByVal where As String, _ + ByVal orderBy As OrderBy) As DeptRecord + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + Dim join As BaseClasses.Data.BaseFilter = Nothing + Dim recList As ArrayList = DeptTable.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MIN_BATCH_SIZE) + + Dim rec As DeptRecord = Nothing + If recList.Count > 0 Then + rec = CType(recList(0), DeptRecord) + End If + + Return rec + End Function + + ''' + ''' This is a shared function that can be used to get a DeptRecord record using a where and order by clause. + ''' + Public Shared Function GetRecord( _ + ByVal join As BaseFilter, _ + ByVal where As String, _ + ByVal orderBy As OrderBy) As DeptRecord + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Dim recList As ArrayList = DeptTable.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MIN_BATCH_SIZE) + + Dim rec As DeptRecord = Nothing + If recList.Count > 0 Then + rec = CType(recList(0), DeptRecord) + End If + + Return rec + End Function + + + Public Shared Function GetValues( _ + ByVal col As BaseColumn, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal maxItems As Integer) As String() + + ' Create the filter list. + Dim retCol As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, True) + retCol.AddColumn(col) + + Return DeptTable.Instance.GetColumnValues(retCol, Nothing, where.GetFilter(), Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, maxItems) + + End Function + + Public Shared Function GetValues( _ + ByVal col As BaseColumn, _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal maxItems As Integer) As String() + + ' Create the filter list. + Dim retCol As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, True) + retCol.AddColumn(col) + + Return DeptTable.Instance.GetColumnValues(retCol, join, where.GetFilter(), Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, maxItems) + + End Function + + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where clause. + ''' + Public Shared Function GetDataTable(ByVal where As String) As System.Data.DataTable + + Dim recs() As DeptRecord = GetRecords(where) + Return DeptTable.Instance.CreateDataTable(recs, Nothing) + End Function + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where clause. + ''' + Public Shared Function GetDataTable(ByVal join As BaseFilter, ByVal where As String) As System.Data.DataTable + + Dim recs() As DeptRecord = GetRecords(join, where) + Return DeptTable.Instance.CreateDataTable(recs, Nothing) + End Function + + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause. + ''' + Public Shared Function GetDataTable(ByVal where As String, ByVal orderBy As OrderBy) As System.Data.DataTable + + Dim recs() As DeptRecord = GetRecords(where, orderBy) + Return DeptTable.Instance.CreateDataTable(recs, Nothing) + End Function + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause. + ''' + Public Shared Function GetDataTable(ByVal join As BaseFilter, ByVal where As String, ByVal orderBy As OrderBy) As System.Data.DataTable + + Dim recs() As DeptRecord = GetRecords(join, where, orderBy) + Return DeptTable.Instance.CreateDataTable(recs, Nothing) + End Function + + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause with pagination. + ''' + Public Shared Function GetDataTable( _ + ByVal where As String, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As System.Data.DataTable + + Dim recs() As DeptRecord = GetRecords(where, orderBy, pageIndex, pageSize) + Return DeptTable.Instance.CreateDataTable(recs, Nothing) + End Function + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause with pagination. + ''' + Public Shared Function GetDataTable( _ + ByVal join As BaseFilter, _ + ByVal where As String, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As System.Data.DataTable + + Dim recs() As DeptRecord = GetRecords(join, where, orderBy, pageIndex, pageSize) + Return DeptTable.Instance.CreateDataTable(recs, Nothing) + End Function + + + ''' + ''' This is a shared function that can be used to delete records using a where clause. + ''' + Public Shared Sub DeleteRecords(ByVal where As String) + If where = Nothing OrElse where.Trim() = "" Then + Return + End If + + Dim whereFilter As SqlFilter = New SqlFilter(where) + DeptTable.Instance.DeleteRecordList(whereFilter) + End Sub + + ''' + ''' This is a shared function that can be used to export records using a where clause. + ''' + Public Shared Function Export(ByVal where As String) As String + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Return DeptTable.Instance.ExportRecordData(whereFilter) + End Function + + Public Shared Function Export(ByVal where As WhereClause) As String + Dim whereFilter As BaseFilter = Nothing + If Not where Is Nothing Then + whereFilter = where.GetFilter() + End If + + Return DeptTable.Instance.ExportRecordData(whereFilter) + End Function + + Public Shared Function GetSum( _ + ByVal col As BaseColumn, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) _ + As String + + Dim colSel As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, False) + colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Sum) + + Return DeptTable.Instance.GetColumnStatistics(colSel, Nothing, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + End Function + + Public Shared Function GetSum( _ + ByVal col As BaseColumn, _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) _ + As String + + Dim colSel As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, False) + colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Sum) + + Return DeptTable.Instance.GetColumnStatistics(colSel, join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + End Function + + + Public Shared Function GetCount( _ + ByVal col As BaseColumn, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) _ + As String + + Dim colSel As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, False) + colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Count) + + Return DeptTable.Instance.GetColumnStatistics(colSel, Nothing, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + End Function + + Public Shared Function GetCount( _ + ByVal col As BaseColumn, _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) _ + As String + + Dim colSel As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, False) + colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Count) + + Return DeptTable.Instance.GetColumnStatistics(colSel, join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + End Function + + ''' + ''' This method returns the columns in the table. + ''' + Public Shared Function GetColumns() As BaseColumn() + Return DeptTable.Instance.TableDefinition.Columns + End Function + + ''' + ''' This method returns the columnlist in the table. + ''' + Public Shared Function GetColumnList() As ColumnList + Return DeptTable.Instance.TableDefinition.ColumnList + End Function + + + ''' + ''' This method creates a new record and returns it to be edited. + ''' + Public Shared Function CreateNewRecord() As IRecord + Return DeptTable.Instance.CreateRecord() + End Function + + ''' + ''' This method creates a new record and returns it to be edited. + ''' + ''' ID of the new record. + Public Shared Function CreateNewRecord(ByVal tempId As String) As IRecord + Return DeptTable.Instance.CreateRecord(tempId) + End Function + + ''' + ''' This method checks if column is editable. + ''' + ''' Name of the column to check. + Public Shared Function isReadOnlyColumn(ByVal columnName As String) As Boolean + Dim column As BaseColumn = GetColumn(columnName) + If (Not IsNothing(column)) Then + Return column.IsValuesReadOnly + Else + Return True + End If + End Function + + ''' + ''' This method gets the specified column. + ''' + ''' Unique name of the column to fetch. + Public Shared Function GetColumn(ByVal uniqueColumnName As String) As BaseColumn + Dim column As BaseColumn = DeptTable.Instance.TableDefinition.ColumnList.GetByUniqueName(uniqueColumnName) + Return column + End Function + + ' Convenience method for getting a record using a string-based record identifier + Public Shared Function GetRecord(ByVal id As String, ByVal bMutable As Boolean) As DeptRecord + Return CType(DeptTable.Instance.GetRecordData(id, bMutable), DeptRecord) + End Function + + ' Convenience method for getting a record using a KeyValue record identifier + Public Shared Function GetRecord(ByVal id As KeyValue, ByVal bMutable As Boolean) As DeptRecord + Return CType(DeptTable.Instance.GetRecordData(id, bMutable), DeptRecord) + End Function + + ' Convenience method for creating a record + Public Overloads Function NewRecord( _ + ByVal DeptIdValue As String, _ + ByVal SectionIdValue As String, _ + ByVal DeptValue As String, _ + ByVal DeptAbbvrValue As String, _ + ByVal ChiefIdValue As String, _ + ByVal PositionValue As String, _ + ByVal SignValue As String _ + ) As KeyValue + Dim rec As IPrimaryKeyRecord = CType(Me.CreateRecord(), IPrimaryKeyRecord) + rec.SetString(DeptIdValue, DeptIdColumn) + rec.SetString(SectionIdValue, SectionIdColumn) + rec.SetString(DeptValue, DeptColumn) + rec.SetString(DeptAbbvrValue, DeptAbbvrColumn) + rec.SetString(ChiefIdValue, ChiefIdColumn) + rec.SetString(PositionValue, PositionColumn) + rec.SetString(SignValue, SignColumn) + + + rec.Create() 'update the DB so any DB-initialized fields (like autoincrement IDs) can be initialized + + Dim key As KeyValue = rec.GetID() + Return key + End Function + + ''' + ''' This method deletes a specified record + ''' + ''' Keyvalue of the record to be deleted. + Public Shared Sub DeleteRecord(ByVal kv As KeyValue) + DeptTable.Instance.DeleteOneRecord(kv) + End Sub + + ''' + ''' This method checks if record exist in the database using the keyvalue provided. + ''' + ''' Key value of the record. + Public Shared Function DoesRecordExist(ByVal kv As KeyValue) As Boolean + Dim recordExist As Boolean = True + Try + DeptTable.GetRecord(kv, False) + Catch ex As Exception + recordExist = False + End Try + Return recordExist + End Function + + ''' + ''' This method returns all the primary columns in the table. + ''' + Public Shared Function GetPrimaryKeyColumns() As ColumnList + If (Not IsNothing(DeptTable.Instance.TableDefinition.PrimaryKey)) Then + Return DeptTable.Instance.TableDefinition.PrimaryKey.Columns + Else + Return Nothing + End If + End Function + + ''' + ''' This method takes a key and returns a keyvalue. + ''' + ''' key could be array of primary key values in case of composite primary key or a string containing single primary key value in case of non-composite primary key. + Public Shared Function GetKeyValue(ByVal key As Object) As KeyValue + Dim kv As KeyValue = Nothing + + If (Not (IsNothing(DeptTable.Instance.TableDefinition.PrimaryKey))) Then + + Dim isCompositePrimaryKey As Boolean = False + isCompositePrimaryKey = DeptTable.Instance.TableDefinition.PrimaryKey.IsCompositeKey + + If ((isCompositePrimaryKey) AndAlso (key.GetType.IsArray())) Then + + ' If the key is composite, then construct a key value. + kv = New KeyValue + Dim fullKeyString As String = "" + Dim keyArray As Array = CType(key, Array) + If (Not IsNothing(keyArray)) Then + Dim length As Integer = keyArray.Length + Dim pkColumns As ColumnList = DeptTable.Instance.TableDefinition.PrimaryKey.Columns + Dim pkColumn As BaseColumn + Dim index As Integer = 0 + For Each pkColumn In pkColumns + Dim keyString As String = CType(keyArray.GetValue(index), String) + If (DeptTable.Instance.TableDefinition.TableType = BaseClasses.Data.TableDefinition.TableTypes.Virtual) Then + kv.AddElement(pkColumn.UniqueName, keyString) + Else + kv.AddElement(pkColumn.InternalName, keyString) + End If + index = index + 1 + Next pkColumn + End If + + Else + ' If the key is not composite, then get the key value. + kv = DeptTable.Instance.TableDefinition.PrimaryKey.ParseValue(CType(key, String)) + End If + End If + Return kv + End Function + + + ''' + ''' This method takes a record and a Column and returns an evaluated value of DFKA formula. + ''' + Public Shared Function GetDFKA(ByVal rec As BaseRecord, ByVal col As BaseColumn) As String + Dim fkColumn As ForeignKey = DeptTable.Instance.TableDefinition.GetExpandableNonCompositeForeignKey(col) + If fkColumn Is Nothing Then + Return Nothing + End If + Dim _DFKA As String = fkColumn.PrimaryKeyDisplayColumns + If (_DFKA.Trim().StartsWith("=")) Then + ' if the formula is in the format of "= ., then pull out the data from the rec object instead of doing formula evaluation + Dim tableCodeName As String = fkColumn.PrimaryKeyTableDefinition.TableCodeName + Dim column As String = _DFKA.Trim("="c).Trim() + If column.StartsWith(tableCodeName & ".", StringComparison.InvariantCultureIgnoreCase) Then + column = column.Substring(tableCodeName.Length + 1) + End If + + For Each c As BaseColumn In fkColumn.PrimaryKeyTableDefinition.Columns + If column = c.CodeName Then + Return rec.Format(c) + End If + Next + Dim tableName As String = fkColumn.PrimaryKeyTableDefinition.TableCodeName + Return EvaluateFormula(_DFKA, rec, Nothing, tableName) + Else + Return Nothing + End If + End Function + + ''' + ''' This method takes a keyValue and a Column and returns an evaluated value of DFKA formula. + ''' + Public Shared Function GetDFKA(ByVal keyValue As String, ByVal col As BaseColumn, ByVal formatPattern as String) As String + If keyValue Is Nothing Then + Return Nothing + End If + Dim fkColumn As ForeignKey = DeptTable.Instance.TableDefinition.GetExpandableNonCompositeForeignKey(col) + If fkColumn Is Nothing Then + Return Nothing + End If + Dim _DFKA As String = fkColumn.PrimaryKeyDisplayColumns + If (_DFKA.Trim().StartsWith("=")) Then + Dim tableName As String = fkColumn.PrimaryKeyTableDefinition.TableCodeName + Dim t As PrimaryKeyTable = CType(DatabaseObjects.GetTableObject(tableName), PrimaryKeyTable) + Dim rec As BaseRecord = Nothing + If Not t Is Nothing Then + Try + rec = CType(t.GetRecordData(keyValue, False), BaseRecord) + Catch + rec = Nothing + End Try + End If + If rec Is Nothing Then + Return "" + End If + + ' if the formula is in the format of "= ., then pull out the data from the rec object instead of doing formula evaluation + Dim tableCodeName As String = fkColumn.PrimaryKeyTableDefinition.TableCodeName + Dim column As String = _DFKA.Trim("="c).Trim() + If column.StartsWith(tableCodeName & ".", StringComparison.InvariantCultureIgnoreCase) Then + column = column.Substring(tableCodeName.Length + 1) + End If + + For Each c As BaseColumn In fkColumn.PrimaryKeyTableDefinition.Columns + If column = c.CodeName Then + Return rec.Format(c) + End If + Next + Return EvaluateFormula(_DFKA, rec, Nothing, tableName) + Else + Return Nothing + End If + End Function + + ''' + ''' Evaluates the formula + ''' + Public Shared Function EvaluateFormula(ByVal formula As String, Optional ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord = Nothing, Optional ByVal format As String = Nothing, Optional ByVal name As String = "") As String + Dim e As BaseFormulaEvaluator = New BaseFormulaEvaluator() + If Not dataSourceForEvaluate Is Nothing Then + e.Evaluator.Variables.Add(name, dataSourceForEvaluate) + end if + e.DataSource = dataSourceForEvaluate + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + If Not String.IsNullOrEmpty(format) Then + Return BaseFormulaUtils.Format(resultObj, format) + Else + Return resultObj.ToString() + End If + End Function + + +#End Region + +End Class +End Namespace diff --git a/App_Code/Business Layer/BaseEducationPeriodRecord.vb b/App_Code/Business Layer/BaseEducationPeriodRecord.vb new file mode 100644 index 0000000..8bd8376 --- /dev/null +++ b/App_Code/Business Layer/BaseEducationPeriodRecord.vb @@ -0,0 +1,283 @@ +' This class is "generated" and will be overwritten. +' Your customizations should be made in EducationPeriodRecord.vb + +Imports System.Data.SqlTypes +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + +Namespace Persons.Business + +''' +''' The generated superclass for the class. +''' +''' +''' This class is not intended to be instantiated directly. To obtain an instance of this class, +''' use the methods of the class. +''' +''' +''' + + Public Class BaseEducationPeriodRecord + Inherits PrimaryKeyRecord + + + Public Shared Shadows ReadOnly TableUtils As EducationPeriodTable = EducationPeriodTable.Instance + + ' Constructors + + Protected Sub New() + MyBase.New(TableUtils) + End Sub + + Protected Sub New(ByVal record As PrimaryKeyRecord) + MyBase.New(record, TableUtils) + End Sub + + 'Evaluates Initialize when->Inserting record formulas specified at the data access layer + Public Overridable Sub EducationPeriodRecord_InsertingRecord(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles Me.InsertingRecord + 'Apply Initialize->Inserting record formula only if validation is successful. + Dim EducationPeriodRec As EducationPeriodRecord = CType(sender,EducationPeriodRecord) + Validate_Inserting() + If Not EducationPeriodRec Is Nothing AndAlso Not EducationPeriodRec.IsReadOnly Then + End If + End Sub + + 'Evaluates Initialize when->Updating record formulas specified at the data access layer + Public Overridable Sub EducationPeriodRecord_UpdatingRecord(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles Me.UpdatingRecord + 'Apply Initialize->Updating record formula only if validation is successful. + Dim EducationPeriodRec As EducationPeriodRecord = CType(sender,EducationPeriodRecord) + Validate_Updating() + If Not EducationPeriodRec Is Nothing AndAlso Not EducationPeriodRec.IsReadOnly Then + End If + End Sub + + 'Evaluates Initialize when->Reading record formulas specified at the data access layer + Public Overridable Sub EducationPeriodRecord_ReadRecord(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.ReadRecord + 'Apply Initialize->Reading record formula only if validation is successful. + Dim EducationPeriodRec As EducationPeriodRecord = CType(sender,EducationPeriodRecord) + If Not EducationPeriodRec Is Nothing AndAlso Not EducationPeriodRec.IsReadOnly Then + End If + End Sub + + 'Evaluates Validate when->Inserting formulas specified at the data access layer + Public Overridable Sub Validate_Inserting () + Dim fullValidationMessage As String = "" + Dim validationMessage As String = "" + + dim formula as String = "" + + + If validationMessage <> "" AndAlso validationMessage.ToLower() <> "true" Then + fullValidationMessage &= validationMessage & vbCrLf + End If + + If fullValidationMessage <> "" Then + Throw New Exception(fullValidationMessage) + End If + End Sub + + 'Evaluates Validate when->Updating formulas specified at the data access layer + Public Overridable Sub Validate_Updating () + Dim fullValidationMessage As String = "" + Dim validationMessage As String = "" + + dim formula as String = "" + + + If validationMessage <> "" AndAlso validationMessage.ToLower() <> "true" Then + fullValidationMessage &= validationMessage & vbCrLf + End If + + If fullValidationMessage <> "" Then + Throw New Exception(fullValidationMessage) + End If + End Sub + + Public Overridable Function EvaluateFormula(ByVal formula As String, Optional ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord = Nothing, Optional ByVal format As String = Nothing) As String + + Dim e As Data.BaseFormulaEvaluator = New Data.BaseFormulaEvaluator() + + ' All variables referred to in the formula are expected to be + ' properties of the DataSource. For example, referring to + ' UnitPrice as a variable will refer to DataSource.UnitPrice + e.DataSource = dataSourceForEvaluate + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + Return resultObj.ToString() + End Function + + + + + + + +#Region "Convenience methods to get/set values of fields" + + ''' + ''' This is a convenience method that provides direct access to the value of the record's EducationPeriod_.PeriodId field. + ''' + Public Function GetPeriodIdValue() As ColumnValue + Return Me.GetValue(TableUtils.PeriodIdColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's EducationPeriod_.PeriodId field. + ''' + Public Function GetPeriodIdFieldValue() As Byte + Return CType(Me.GetValue(TableUtils.PeriodIdColumn).ToByte(), Byte) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's EducationPeriod_.PeriodId field. + ''' + Public Sub SetPeriodIdFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.PeriodIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's EducationPeriod_.PeriodId field. + ''' + Public Sub SetPeriodIdFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.PeriodIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's EducationPeriod_.PeriodId field. + ''' + Public Sub SetPeriodIdFieldValue(ByVal val As Double) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.PeriodIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's EducationPeriod_.PeriodId field. + ''' + Public Sub SetPeriodIdFieldValue(ByVal val As Decimal) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.PeriodIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's EducationPeriod_.PeriodId field. + ''' + Public Sub SetPeriodIdFieldValue(ByVal val As Int64) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.PeriodIdColumn) + End Sub + ''' + ''' This is a convenience method that provides direct access to the value of the record's EducationPeriod_.Period field. + ''' + Public Function GetPeriodValue() As ColumnValue + Return Me.GetValue(TableUtils.PeriodColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's EducationPeriod_.Period field. + ''' + Public Function GetPeriodFieldValue() As String + Return CType(Me.GetValue(TableUtils.PeriodColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's EducationPeriod_.Period field. + ''' + Public Sub SetPeriodFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.PeriodColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's EducationPeriod_.Period field. + ''' + Public Sub SetPeriodFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.PeriodColumn) + End Sub + + + +#End Region + +#Region "Convenience methods to get field names" + + ''' + ''' This is a convenience property that provides direct access to the value of the record's EducationPeriod_.PeriodId field. + ''' + Public Property PeriodId() As Byte + Get + Return CType(Me.GetValue(TableUtils.PeriodIdColumn).ToByte(), Byte) + End Get + Set (ByVal val As Byte) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.PeriodIdColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property PeriodIdSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.PeriodIdColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property PeriodIdDefault() As String + Get + Return TableUtils.PeriodIdColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's EducationPeriod_.Period field. + ''' + Public Property Period() As String + Get + Return CType(Me.GetValue(TableUtils.PeriodColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.PeriodColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property PeriodSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.PeriodColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property PeriodDefault() As String + Get + Return TableUtils.PeriodColumn.DefaultValue + End Get + End Property + + + +#End Region + +End Class +End Namespace diff --git a/App_Code/Business Layer/BaseEducationPeriodTable.vb b/App_Code/Business Layer/BaseEducationPeriodTable.vb new file mode 100644 index 0000000..45169ef --- /dev/null +++ b/App_Code/Business Layer/BaseEducationPeriodTable.vb @@ -0,0 +1,778 @@ +' This class is "generated" and will be overwritten. +' Your customizations should be made in EducationPeriodRecord.vb + +Imports System.Data.SqlTypes +Imports System.Data +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider +Imports Persons.Data + +Namespace Persons.Business + +''' +''' The generated superclass for the class. +''' Provides access to the schema information and record data of a database table or view named EducationPeriod. +''' +''' +''' The connection details (name, location, etc.) of the database and table (or view) accessed by this class +''' are resolved at runtime based on the connection string in the application's Web.Config file. +''' +''' This class is not intended to be instantiated directly. To obtain an instance of this class, use +''' EducationPeriodTable.Instance. +''' +''' +''' + + Public Class BaseEducationPeriodTable + Inherits PrimaryKeyTable + + + Private ReadOnly TableDefinitionString As String = EducationPeriodDefinition.GetXMLString() + + + + + + + + Protected Sub New() + MyBase.New() + Me.Initialize() + End Sub + + Protected Overridable Sub Initialize() + Dim def As New XmlTableDefinition(TableDefinitionString) + Me.TableDefinition = New TableDefinition() + Me.TableDefinition.TableClassName = System.Reflection.Assembly.CreateQualifiedName("App_Code", "Persons.Business.EducationPeriodTable") + def.InitializeTableDefinition(Me.TableDefinition) + Me.ConnectionName = def.GetConnectionName() + Me.RecordClassName = System.Reflection.Assembly.CreateQualifiedName("App_Code", "Persons.Business.EducationPeriodRecord") + Me.ApplicationName = "App_Code" + Me.DataAdapter = New EducationPeriodSqlTable() + Directcast(Me.DataAdapter, EducationPeriodSqlTable).ConnectionName = Me.ConnectionName + + Me.TableDefinition.AdapterMetaData = Me.DataAdapter.AdapterMetaData + PeriodIdColumn.CodeName = "PeriodId" + PeriodColumn.CodeName = "Period" + + End Sub + +#Region "Overriden methods" + + +#End Region + +#Region "Properties for columns" + + ''' + ''' This is a convenience property that provides direct access to the table's EducationPeriod_.PeriodId column object. + ''' + Public ReadOnly Property PeriodIdColumn() As BaseClasses.Data.NumberColumn + Get + Return CType(Me.TableDefinition.ColumnList(0), BaseClasses.Data.NumberColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's EducationPeriod_.PeriodId column object. + ''' + Public Shared ReadOnly Property PeriodId() As BaseClasses.Data.NumberColumn + Get + Return EducationPeriodTable.Instance.PeriodIdColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's EducationPeriod_.Period column object. + ''' + Public ReadOnly Property PeriodColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(1), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's EducationPeriod_.Period column object. + ''' + Public Shared ReadOnly Property Period() As BaseClasses.Data.StringColumn + Get + Return EducationPeriodTable.Instance.PeriodColumn + End Get + End Property + + +#End Region + + +#Region "Shared helper methods" + + ''' + ''' This is a shared function that can be used to get an array of EducationPeriodRecord records using a where clause. + ''' + Public Shared Function GetRecords(ByVal where As String) As EducationPeriodRecord() + + Return GetRecords(where, Nothing, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) + End Function + + ''' + ''' This is a shared function that can be used to get an array of EducationPeriodRecord records using a where clause. + ''' + Public Shared Function GetRecords(ByVal join As BaseFilter, ByVal where As String) As EducationPeriodRecord() + + Return GetRecords(join, where, Nothing, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) + End Function + + ''' + ''' This is a shared function that can be used to get an array of EducationPeriodRecord records using a where and order by clause. + ''' + Public Shared Function GetRecords( _ + ByVal where As String, _ + ByVal orderBy As OrderBy) As EducationPeriodRecord() + + Return GetRecords(where, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) + End Function + + ''' + ''' This is a shared function that can be used to get an array of EducationPeriodRecord records using a where and order by clause. + ''' + Public Shared Function GetRecords( _ + ByVal join As BaseFilter, _ + ByVal where As String, _ + ByVal orderBy As OrderBy) As EducationPeriodRecord() + + Return GetRecords(join, where, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) + End Function + + ''' + ''' This is a shared function that can be used to get an array of EducationPeriodRecord records using a where and order by clause clause with pagination. + ''' + Public Shared Function GetRecords( _ + ByVal where As String, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As EducationPeriodRecord() + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + Dim join As BaseClasses.Data.BaseFilter = Nothing + Dim recList As ArrayList = EducationPeriodTable.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, pageIndex, pageSize) + + Return CType(recList.ToArray(GetType(Persons.Business.EducationPeriodRecord)), EducationPeriodRecord()) + End Function + + ''' + ''' This is a shared function that can be used to get an array of EducationPeriodRecord records using a where and order by clause clause with pagination. + ''' + Public Shared Function GetRecords( _ + ByVal join As BaseFilter, _ + ByVal where As String, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As EducationPeriodRecord() + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Dim recList As ArrayList = EducationPeriodTable.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, pageIndex, pageSize) + + Return CType(recList.ToArray(GetType(Persons.Business.EducationPeriodRecord)), EducationPeriodRecord()) + End Function + + Public Shared Function GetRecords( _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As EducationPeriodRecord() + Dim join As BaseClasses.Data.BaseFilter = Nothing + Dim recList As ArrayList = EducationPeriodTable.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + Return CType(recList.ToArray(GetType(Persons.Business.EducationPeriodRecord)), EducationPeriodRecord()) + End Function + + Public Shared Function GetRecords( _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As EducationPeriodRecord() + + Dim recList As ArrayList = EducationPeriodTable.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + Return CType(recList.ToArray(GetType(Persons.Business.EducationPeriodRecord)), EducationPeriodRecord()) + End Function + + Public Shared Function GetRecords( _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer, _ + ByRef totalRecords As Integer) As EducationPeriodRecord() + Dim join As BaseClasses.Data.BaseFilter = Nothing + Dim recList As ArrayList = EducationPeriodTable.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize, totalRecords) + + Return CType(recList.ToArray(GetType(Persons.Business.EducationPeriodRecord)), EducationPeriodRecord()) + End Function + + Public Shared Function GetRecords( _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer, _ + ByRef totalRecords As Integer) As EducationPeriodRecord() + + Dim recList As ArrayList = EducationPeriodTable.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize, totalRecords) + + Return CType(recList.ToArray(GetType(Persons.Business.EducationPeriodRecord)), EducationPeriodRecord()) + End Function + + ''' + ''' This is a shared function that can be used to get total number of records that will be returned using the where clause. + ''' + Public Shared Function GetRecordCount(ByVal where As String) As Integer + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Return CInt(EducationPeriodTable.Instance.GetRecordListCount(Nothing, whereFilter, Nothing, Nothing)) + End Function + +''' + ''' This is a shared function that can be used to get total number of records that will be returned using the where clause. + ''' + Public Shared Function GetRecordCount(ByVal join As BaseFilter, ByVal where As String) As Integer + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Return CInt(EducationPeriodTable.Instance.GetRecordListCount(join, whereFilter, Nothing, Nothing)) + End Function + + Public Shared Function GetRecordCount(ByVal where As WhereClause) As Integer + Return CInt(EducationPeriodTable.Instance.GetRecordListCount(Nothing, where.GetFilter(), Nothing, Nothing)) + End Function + + Public Shared Function GetRecordCount(ByVal join As BaseFilter, ByVal where As WhereClause) As Integer + Return CInt(EducationPeriodTable.Instance.GetRecordListCount(join, where.GetFilter(), Nothing, Nothing)) + End Function + + ''' + ''' This is a shared function that can be used to get a EducationPeriodRecord record using a where clause. + ''' + Public Shared Function GetRecord(ByVal where As String) As EducationPeriodRecord + Dim orderBy As OrderBy = Nothing + Return GetRecord(where, orderBy) + End Function + + ''' + ''' This is a shared function that can be used to get a EducationPeriodRecord record using a where clause. + ''' + Public Shared Function GetRecord(ByVal join As BaseFilter, ByVal where As String) As EducationPeriodRecord + Dim orderBy As OrderBy = Nothing + Return GetRecord(join, where, orderBy) + End Function + + ''' + ''' This is a shared function that can be used to get a EducationPeriodRecord record using a where and order by clause. + ''' + Public Shared Function GetRecord( _ + ByVal where As String, _ + ByVal orderBy As OrderBy) As EducationPeriodRecord + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + Dim join As BaseClasses.Data.BaseFilter = Nothing + Dim recList As ArrayList = EducationPeriodTable.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MIN_BATCH_SIZE) + + Dim rec As EducationPeriodRecord = Nothing + If recList.Count > 0 Then + rec = CType(recList(0), EducationPeriodRecord) + End If + + Return rec + End Function + + ''' + ''' This is a shared function that can be used to get a EducationPeriodRecord record using a where and order by clause. + ''' + Public Shared Function GetRecord( _ + ByVal join As BaseFilter, _ + ByVal where As String, _ + ByVal orderBy As OrderBy) As EducationPeriodRecord + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Dim recList As ArrayList = EducationPeriodTable.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MIN_BATCH_SIZE) + + Dim rec As EducationPeriodRecord = Nothing + If recList.Count > 0 Then + rec = CType(recList(0), EducationPeriodRecord) + End If + + Return rec + End Function + + + Public Shared Function GetValues( _ + ByVal col As BaseColumn, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal maxItems As Integer) As String() + + ' Create the filter list. + Dim retCol As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, True) + retCol.AddColumn(col) + + Return EducationPeriodTable.Instance.GetColumnValues(retCol, Nothing, where.GetFilter(), Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, maxItems) + + End Function + + Public Shared Function GetValues( _ + ByVal col As BaseColumn, _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal maxItems As Integer) As String() + + ' Create the filter list. + Dim retCol As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, True) + retCol.AddColumn(col) + + Return EducationPeriodTable.Instance.GetColumnValues(retCol, join, where.GetFilter(), Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, maxItems) + + End Function + + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where clause. + ''' + Public Shared Function GetDataTable(ByVal where As String) As System.Data.DataTable + + Dim recs() As EducationPeriodRecord = GetRecords(where) + Return EducationPeriodTable.Instance.CreateDataTable(recs, Nothing) + End Function + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where clause. + ''' + Public Shared Function GetDataTable(ByVal join As BaseFilter, ByVal where As String) As System.Data.DataTable + + Dim recs() As EducationPeriodRecord = GetRecords(join, where) + Return EducationPeriodTable.Instance.CreateDataTable(recs, Nothing) + End Function + + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause. + ''' + Public Shared Function GetDataTable(ByVal where As String, ByVal orderBy As OrderBy) As System.Data.DataTable + + Dim recs() As EducationPeriodRecord = GetRecords(where, orderBy) + Return EducationPeriodTable.Instance.CreateDataTable(recs, Nothing) + End Function + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause. + ''' + Public Shared Function GetDataTable(ByVal join As BaseFilter, ByVal where As String, ByVal orderBy As OrderBy) As System.Data.DataTable + + Dim recs() As EducationPeriodRecord = GetRecords(join, where, orderBy) + Return EducationPeriodTable.Instance.CreateDataTable(recs, Nothing) + End Function + + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause with pagination. + ''' + Public Shared Function GetDataTable( _ + ByVal where As String, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As System.Data.DataTable + + Dim recs() As EducationPeriodRecord = GetRecords(where, orderBy, pageIndex, pageSize) + Return EducationPeriodTable.Instance.CreateDataTable(recs, Nothing) + End Function + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause with pagination. + ''' + Public Shared Function GetDataTable( _ + ByVal join As BaseFilter, _ + ByVal where As String, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As System.Data.DataTable + + Dim recs() As EducationPeriodRecord = GetRecords(join, where, orderBy, pageIndex, pageSize) + Return EducationPeriodTable.Instance.CreateDataTable(recs, Nothing) + End Function + + + ''' + ''' This is a shared function that can be used to delete records using a where clause. + ''' + Public Shared Sub DeleteRecords(ByVal where As String) + If where = Nothing OrElse where.Trim() = "" Then + Return + End If + + Dim whereFilter As SqlFilter = New SqlFilter(where) + EducationPeriodTable.Instance.DeleteRecordList(whereFilter) + End Sub + + ''' + ''' This is a shared function that can be used to export records using a where clause. + ''' + Public Shared Function Export(ByVal where As String) As String + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Return EducationPeriodTable.Instance.ExportRecordData(whereFilter) + End Function + + Public Shared Function Export(ByVal where As WhereClause) As String + Dim whereFilter As BaseFilter = Nothing + If Not where Is Nothing Then + whereFilter = where.GetFilter() + End If + + Return EducationPeriodTable.Instance.ExportRecordData(whereFilter) + End Function + + Public Shared Function GetSum( _ + ByVal col As BaseColumn, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) _ + As String + + Dim colSel As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, False) + colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Sum) + + Return EducationPeriodTable.Instance.GetColumnStatistics(colSel, Nothing, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + End Function + + Public Shared Function GetSum( _ + ByVal col As BaseColumn, _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) _ + As String + + Dim colSel As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, False) + colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Sum) + + Return EducationPeriodTable.Instance.GetColumnStatistics(colSel, join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + End Function + + + Public Shared Function GetCount( _ + ByVal col As BaseColumn, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) _ + As String + + Dim colSel As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, False) + colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Count) + + Return EducationPeriodTable.Instance.GetColumnStatistics(colSel, Nothing, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + End Function + + Public Shared Function GetCount( _ + ByVal col As BaseColumn, _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) _ + As String + + Dim colSel As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, False) + colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Count) + + Return EducationPeriodTable.Instance.GetColumnStatistics(colSel, join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + End Function + + ''' + ''' This method returns the columns in the table. + ''' + Public Shared Function GetColumns() As BaseColumn() + Return EducationPeriodTable.Instance.TableDefinition.Columns + End Function + + ''' + ''' This method returns the columnlist in the table. + ''' + Public Shared Function GetColumnList() As ColumnList + Return EducationPeriodTable.Instance.TableDefinition.ColumnList + End Function + + + ''' + ''' This method creates a new record and returns it to be edited. + ''' + Public Shared Function CreateNewRecord() As IRecord + Return EducationPeriodTable.Instance.CreateRecord() + End Function + + ''' + ''' This method creates a new record and returns it to be edited. + ''' + ''' ID of the new record. + Public Shared Function CreateNewRecord(ByVal tempId As String) As IRecord + Return EducationPeriodTable.Instance.CreateRecord(tempId) + End Function + + ''' + ''' This method checks if column is editable. + ''' + ''' Name of the column to check. + Public Shared Function isReadOnlyColumn(ByVal columnName As String) As Boolean + Dim column As BaseColumn = GetColumn(columnName) + If (Not IsNothing(column)) Then + Return column.IsValuesReadOnly + Else + Return True + End If + End Function + + ''' + ''' This method gets the specified column. + ''' + ''' Unique name of the column to fetch. + Public Shared Function GetColumn(ByVal uniqueColumnName As String) As BaseColumn + Dim column As BaseColumn = EducationPeriodTable.Instance.TableDefinition.ColumnList.GetByUniqueName(uniqueColumnName) + Return column + End Function + + ' Convenience method for getting a record using a string-based record identifier + Public Shared Function GetRecord(ByVal id As String, ByVal bMutable As Boolean) As EducationPeriodRecord + Return CType(EducationPeriodTable.Instance.GetRecordData(id, bMutable), EducationPeriodRecord) + End Function + + ' Convenience method for getting a record using a KeyValue record identifier + Public Shared Function GetRecord(ByVal id As KeyValue, ByVal bMutable As Boolean) As EducationPeriodRecord + Return CType(EducationPeriodTable.Instance.GetRecordData(id, bMutable), EducationPeriodRecord) + End Function + + ' Convenience method for creating a record + Public Overloads Function NewRecord( _ + ByVal PeriodIdValue As String, _ + ByVal PeriodValue As String _ + ) As KeyValue + Dim rec As IPrimaryKeyRecord = CType(Me.CreateRecord(), IPrimaryKeyRecord) + rec.SetString(PeriodIdValue, PeriodIdColumn) + rec.SetString(PeriodValue, PeriodColumn) + + + rec.Create() 'update the DB so any DB-initialized fields (like autoincrement IDs) can be initialized + + Dim key As KeyValue = rec.GetID() + Return key + End Function + + ''' + ''' This method deletes a specified record + ''' + ''' Keyvalue of the record to be deleted. + Public Shared Sub DeleteRecord(ByVal kv As KeyValue) + EducationPeriodTable.Instance.DeleteOneRecord(kv) + End Sub + + ''' + ''' This method checks if record exist in the database using the keyvalue provided. + ''' + ''' Key value of the record. + Public Shared Function DoesRecordExist(ByVal kv As KeyValue) As Boolean + Dim recordExist As Boolean = True + Try + EducationPeriodTable.GetRecord(kv, False) + Catch ex As Exception + recordExist = False + End Try + Return recordExist + End Function + + ''' + ''' This method returns all the primary columns in the table. + ''' + Public Shared Function GetPrimaryKeyColumns() As ColumnList + If (Not IsNothing(EducationPeriodTable.Instance.TableDefinition.PrimaryKey)) Then + Return EducationPeriodTable.Instance.TableDefinition.PrimaryKey.Columns + Else + Return Nothing + End If + End Function + + ''' + ''' This method takes a key and returns a keyvalue. + ''' + ''' key could be array of primary key values in case of composite primary key or a string containing single primary key value in case of non-composite primary key. + Public Shared Function GetKeyValue(ByVal key As Object) As KeyValue + Dim kv As KeyValue = Nothing + + If (Not (IsNothing(EducationPeriodTable.Instance.TableDefinition.PrimaryKey))) Then + + Dim isCompositePrimaryKey As Boolean = False + isCompositePrimaryKey = EducationPeriodTable.Instance.TableDefinition.PrimaryKey.IsCompositeKey + + If ((isCompositePrimaryKey) AndAlso (key.GetType.IsArray())) Then + + ' If the key is composite, then construct a key value. + kv = New KeyValue + Dim fullKeyString As String = "" + Dim keyArray As Array = CType(key, Array) + If (Not IsNothing(keyArray)) Then + Dim length As Integer = keyArray.Length + Dim pkColumns As ColumnList = EducationPeriodTable.Instance.TableDefinition.PrimaryKey.Columns + Dim pkColumn As BaseColumn + Dim index As Integer = 0 + For Each pkColumn In pkColumns + Dim keyString As String = CType(keyArray.GetValue(index), String) + If (EducationPeriodTable.Instance.TableDefinition.TableType = BaseClasses.Data.TableDefinition.TableTypes.Virtual) Then + kv.AddElement(pkColumn.UniqueName, keyString) + Else + kv.AddElement(pkColumn.InternalName, keyString) + End If + index = index + 1 + Next pkColumn + End If + + Else + ' If the key is not composite, then get the key value. + kv = EducationPeriodTable.Instance.TableDefinition.PrimaryKey.ParseValue(CType(key, String)) + End If + End If + Return kv + End Function + + + ''' + ''' This method takes a record and a Column and returns an evaluated value of DFKA formula. + ''' + Public Shared Function GetDFKA(ByVal rec As BaseRecord, ByVal col As BaseColumn) As String + Dim fkColumn As ForeignKey = EducationPeriodTable.Instance.TableDefinition.GetExpandableNonCompositeForeignKey(col) + If fkColumn Is Nothing Then + Return Nothing + End If + Dim _DFKA As String = fkColumn.PrimaryKeyDisplayColumns + If (_DFKA.Trim().StartsWith("=")) Then + ' if the formula is in the format of "= ., then pull out the data from the rec object instead of doing formula evaluation + Dim tableCodeName As String = fkColumn.PrimaryKeyTableDefinition.TableCodeName + Dim column As String = _DFKA.Trim("="c).Trim() + If column.StartsWith(tableCodeName & ".", StringComparison.InvariantCultureIgnoreCase) Then + column = column.Substring(tableCodeName.Length + 1) + End If + + For Each c As BaseColumn In fkColumn.PrimaryKeyTableDefinition.Columns + If column = c.CodeName Then + Return rec.Format(c) + End If + Next + Dim tableName As String = fkColumn.PrimaryKeyTableDefinition.TableCodeName + Return EvaluateFormula(_DFKA, rec, Nothing, tableName) + Else + Return Nothing + End If + End Function + + ''' + ''' This method takes a keyValue and a Column and returns an evaluated value of DFKA formula. + ''' + Public Shared Function GetDFKA(ByVal keyValue As String, ByVal col As BaseColumn, ByVal formatPattern as String) As String + If keyValue Is Nothing Then + Return Nothing + End If + Dim fkColumn As ForeignKey = EducationPeriodTable.Instance.TableDefinition.GetExpandableNonCompositeForeignKey(col) + If fkColumn Is Nothing Then + Return Nothing + End If + Dim _DFKA As String = fkColumn.PrimaryKeyDisplayColumns + If (_DFKA.Trim().StartsWith("=")) Then + Dim tableName As String = fkColumn.PrimaryKeyTableDefinition.TableCodeName + Dim t As PrimaryKeyTable = CType(DatabaseObjects.GetTableObject(tableName), PrimaryKeyTable) + Dim rec As BaseRecord = Nothing + If Not t Is Nothing Then + Try + rec = CType(t.GetRecordData(keyValue, False), BaseRecord) + Catch + rec = Nothing + End Try + End If + If rec Is Nothing Then + Return "" + End If + + ' if the formula is in the format of "= ., then pull out the data from the rec object instead of doing formula evaluation + Dim tableCodeName As String = fkColumn.PrimaryKeyTableDefinition.TableCodeName + Dim column As String = _DFKA.Trim("="c).Trim() + If column.StartsWith(tableCodeName & ".", StringComparison.InvariantCultureIgnoreCase) Then + column = column.Substring(tableCodeName.Length + 1) + End If + + For Each c As BaseColumn In fkColumn.PrimaryKeyTableDefinition.Columns + If column = c.CodeName Then + Return rec.Format(c) + End If + Next + Return EvaluateFormula(_DFKA, rec, Nothing, tableName) + Else + Return Nothing + End If + End Function + + ''' + ''' Evaluates the formula + ''' + Public Shared Function EvaluateFormula(ByVal formula As String, Optional ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord = Nothing, Optional ByVal format As String = Nothing, Optional ByVal name As String = "") As String + Dim e As BaseFormulaEvaluator = New BaseFormulaEvaluator() + If Not dataSourceForEvaluate Is Nothing Then + e.Evaluator.Variables.Add(name, dataSourceForEvaluate) + end if + e.DataSource = dataSourceForEvaluate + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + If Not String.IsNullOrEmpty(format) Then + Return BaseFormulaUtils.Format(resultObj, format) + Else + Return resultObj.ToString() + End If + End Function + + +#End Region + +End Class +End Namespace diff --git a/App_Code/Business Layer/BaseEducationRecord.vb b/App_Code/Business Layer/BaseEducationRecord.vb new file mode 100644 index 0000000..054b81d --- /dev/null +++ b/App_Code/Business Layer/BaseEducationRecord.vb @@ -0,0 +1,283 @@ +' This class is "generated" and will be overwritten. +' Your customizations should be made in EducationRecord.vb + +Imports System.Data.SqlTypes +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + +Namespace Persons.Business + +''' +''' The generated superclass for the class. +''' +''' +''' This class is not intended to be instantiated directly. To obtain an instance of this class, +''' use the methods of the class. +''' +''' +''' + + Public Class BaseEducationRecord + Inherits PrimaryKeyRecord + + + Public Shared Shadows ReadOnly TableUtils As EducationTable = EducationTable.Instance + + ' Constructors + + Protected Sub New() + MyBase.New(TableUtils) + End Sub + + Protected Sub New(ByVal record As PrimaryKeyRecord) + MyBase.New(record, TableUtils) + End Sub + + 'Evaluates Initialize when->Inserting record formulas specified at the data access layer + Public Overridable Sub EducationRecord_InsertingRecord(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles Me.InsertingRecord + 'Apply Initialize->Inserting record formula only if validation is successful. + Dim EducationRec As EducationRecord = CType(sender,EducationRecord) + Validate_Inserting() + If Not EducationRec Is Nothing AndAlso Not EducationRec.IsReadOnly Then + End If + End Sub + + 'Evaluates Initialize when->Updating record formulas specified at the data access layer + Public Overridable Sub EducationRecord_UpdatingRecord(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles Me.UpdatingRecord + 'Apply Initialize->Updating record formula only if validation is successful. + Dim EducationRec As EducationRecord = CType(sender,EducationRecord) + Validate_Updating() + If Not EducationRec Is Nothing AndAlso Not EducationRec.IsReadOnly Then + End If + End Sub + + 'Evaluates Initialize when->Reading record formulas specified at the data access layer + Public Overridable Sub EducationRecord_ReadRecord(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.ReadRecord + 'Apply Initialize->Reading record formula only if validation is successful. + Dim EducationRec As EducationRecord = CType(sender,EducationRecord) + If Not EducationRec Is Nothing AndAlso Not EducationRec.IsReadOnly Then + End If + End Sub + + 'Evaluates Validate when->Inserting formulas specified at the data access layer + Public Overridable Sub Validate_Inserting () + Dim fullValidationMessage As String = "" + Dim validationMessage As String = "" + + dim formula as String = "" + + + If validationMessage <> "" AndAlso validationMessage.ToLower() <> "true" Then + fullValidationMessage &= validationMessage & vbCrLf + End If + + If fullValidationMessage <> "" Then + Throw New Exception(fullValidationMessage) + End If + End Sub + + 'Evaluates Validate when->Updating formulas specified at the data access layer + Public Overridable Sub Validate_Updating () + Dim fullValidationMessage As String = "" + Dim validationMessage As String = "" + + dim formula as String = "" + + + If validationMessage <> "" AndAlso validationMessage.ToLower() <> "true" Then + fullValidationMessage &= validationMessage & vbCrLf + End If + + If fullValidationMessage <> "" Then + Throw New Exception(fullValidationMessage) + End If + End Sub + + Public Overridable Function EvaluateFormula(ByVal formula As String, Optional ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord = Nothing, Optional ByVal format As String = Nothing) As String + + Dim e As Data.BaseFormulaEvaluator = New Data.BaseFormulaEvaluator() + + ' All variables referred to in the formula are expected to be + ' properties of the DataSource. For example, referring to + ' UnitPrice as a variable will refer to DataSource.UnitPrice + e.DataSource = dataSourceForEvaluate + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + Return resultObj.ToString() + End Function + + + + + + + +#Region "Convenience methods to get/set values of fields" + + ''' + ''' This is a convenience method that provides direct access to the value of the record's Education_.EducationId field. + ''' + Public Function GetEducationIdValue() As ColumnValue + Return Me.GetValue(TableUtils.EducationIdColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's Education_.EducationId field. + ''' + Public Function GetEducationIdFieldValue() As Int16 + Return CType(Me.GetValue(TableUtils.EducationIdColumn).ToInt16(), Int16) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Education_.EducationId field. + ''' + Public Sub SetEducationIdFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.EducationIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Education_.EducationId field. + ''' + Public Sub SetEducationIdFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.EducationIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Education_.EducationId field. + ''' + Public Sub SetEducationIdFieldValue(ByVal val As Double) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.EducationIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Education_.EducationId field. + ''' + Public Sub SetEducationIdFieldValue(ByVal val As Decimal) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.EducationIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Education_.EducationId field. + ''' + Public Sub SetEducationIdFieldValue(ByVal val As Int64) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.EducationIdColumn) + End Sub + ''' + ''' This is a convenience method that provides direct access to the value of the record's Education_.Level field. + ''' + Public Function GetLevelValue() As ColumnValue + Return Me.GetValue(TableUtils.LevelColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's Education_.Level field. + ''' + Public Function GetLevelFieldValue() As String + Return CType(Me.GetValue(TableUtils.LevelColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Education_.Level field. + ''' + Public Sub SetLevelFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.LevelColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Education_.Level field. + ''' + Public Sub SetLevelFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.LevelColumn) + End Sub + + + +#End Region + +#Region "Convenience methods to get field names" + + ''' + ''' This is a convenience property that provides direct access to the value of the record's Education_.EducationId field. + ''' + Public Property EducationId() As Int16 + Get + Return CType(Me.GetValue(TableUtils.EducationIdColumn).ToInt16(), Int16) + End Get + Set (ByVal val As Int16) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.EducationIdColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property EducationIdSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.EducationIdColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property EducationIdDefault() As String + Get + Return TableUtils.EducationIdColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's Education_.Level field. + ''' + Public Property Level() As String + Get + Return CType(Me.GetValue(TableUtils.LevelColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.LevelColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property LevelSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.LevelColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property LevelDefault() As String + Get + Return TableUtils.LevelColumn.DefaultValue + End Get + End Property + + + +#End Region + +End Class +End Namespace diff --git a/App_Code/Business Layer/BaseEducationTable.vb b/App_Code/Business Layer/BaseEducationTable.vb new file mode 100644 index 0000000..30393b2 --- /dev/null +++ b/App_Code/Business Layer/BaseEducationTable.vb @@ -0,0 +1,778 @@ +' This class is "generated" and will be overwritten. +' Your customizations should be made in EducationRecord.vb + +Imports System.Data.SqlTypes +Imports System.Data +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider +Imports Persons.Data + +Namespace Persons.Business + +''' +''' The generated superclass for the class. +''' Provides access to the schema information and record data of a database table or view named Education. +''' +''' +''' The connection details (name, location, etc.) of the database and table (or view) accessed by this class +''' are resolved at runtime based on the connection string in the application's Web.Config file. +''' +''' This class is not intended to be instantiated directly. To obtain an instance of this class, use +''' EducationTable.Instance. +''' +''' +''' + + Public Class BaseEducationTable + Inherits PrimaryKeyTable + + + Private ReadOnly TableDefinitionString As String = EducationDefinition.GetXMLString() + + + + + + + + Protected Sub New() + MyBase.New() + Me.Initialize() + End Sub + + Protected Overridable Sub Initialize() + Dim def As New XmlTableDefinition(TableDefinitionString) + Me.TableDefinition = New TableDefinition() + Me.TableDefinition.TableClassName = System.Reflection.Assembly.CreateQualifiedName("App_Code", "Persons.Business.EducationTable") + def.InitializeTableDefinition(Me.TableDefinition) + Me.ConnectionName = def.GetConnectionName() + Me.RecordClassName = System.Reflection.Assembly.CreateQualifiedName("App_Code", "Persons.Business.EducationRecord") + Me.ApplicationName = "App_Code" + Me.DataAdapter = New EducationSqlTable() + Directcast(Me.DataAdapter, EducationSqlTable).ConnectionName = Me.ConnectionName + + Me.TableDefinition.AdapterMetaData = Me.DataAdapter.AdapterMetaData + EducationIdColumn.CodeName = "EducationId" + LevelColumn.CodeName = "Level" + + End Sub + +#Region "Overriden methods" + + +#End Region + +#Region "Properties for columns" + + ''' + ''' This is a convenience property that provides direct access to the table's Education_.EducationId column object. + ''' + Public ReadOnly Property EducationIdColumn() As BaseClasses.Data.NumberColumn + Get + Return CType(Me.TableDefinition.ColumnList(0), BaseClasses.Data.NumberColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's Education_.EducationId column object. + ''' + Public Shared ReadOnly Property EducationId() As BaseClasses.Data.NumberColumn + Get + Return EducationTable.Instance.EducationIdColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's Education_.Level column object. + ''' + Public ReadOnly Property LevelColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(1), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's Education_.Level column object. + ''' + Public Shared ReadOnly Property Level() As BaseClasses.Data.StringColumn + Get + Return EducationTable.Instance.LevelColumn + End Get + End Property + + +#End Region + + +#Region "Shared helper methods" + + ''' + ''' This is a shared function that can be used to get an array of EducationRecord records using a where clause. + ''' + Public Shared Function GetRecords(ByVal where As String) As EducationRecord() + + Return GetRecords(where, Nothing, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) + End Function + + ''' + ''' This is a shared function that can be used to get an array of EducationRecord records using a where clause. + ''' + Public Shared Function GetRecords(ByVal join As BaseFilter, ByVal where As String) As EducationRecord() + + Return GetRecords(join, where, Nothing, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) + End Function + + ''' + ''' This is a shared function that can be used to get an array of EducationRecord records using a where and order by clause. + ''' + Public Shared Function GetRecords( _ + ByVal where As String, _ + ByVal orderBy As OrderBy) As EducationRecord() + + Return GetRecords(where, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) + End Function + + ''' + ''' This is a shared function that can be used to get an array of EducationRecord records using a where and order by clause. + ''' + Public Shared Function GetRecords( _ + ByVal join As BaseFilter, _ + ByVal where As String, _ + ByVal orderBy As OrderBy) As EducationRecord() + + Return GetRecords(join, where, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) + End Function + + ''' + ''' This is a shared function that can be used to get an array of EducationRecord records using a where and order by clause clause with pagination. + ''' + Public Shared Function GetRecords( _ + ByVal where As String, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As EducationRecord() + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + Dim join As BaseClasses.Data.BaseFilter = Nothing + Dim recList As ArrayList = EducationTable.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, pageIndex, pageSize) + + Return CType(recList.ToArray(GetType(Persons.Business.EducationRecord)), EducationRecord()) + End Function + + ''' + ''' This is a shared function that can be used to get an array of EducationRecord records using a where and order by clause clause with pagination. + ''' + Public Shared Function GetRecords( _ + ByVal join As BaseFilter, _ + ByVal where As String, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As EducationRecord() + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Dim recList As ArrayList = EducationTable.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, pageIndex, pageSize) + + Return CType(recList.ToArray(GetType(Persons.Business.EducationRecord)), EducationRecord()) + End Function + + Public Shared Function GetRecords( _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As EducationRecord() + Dim join As BaseClasses.Data.BaseFilter = Nothing + Dim recList As ArrayList = EducationTable.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + Return CType(recList.ToArray(GetType(Persons.Business.EducationRecord)), EducationRecord()) + End Function + + Public Shared Function GetRecords( _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As EducationRecord() + + Dim recList As ArrayList = EducationTable.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + Return CType(recList.ToArray(GetType(Persons.Business.EducationRecord)), EducationRecord()) + End Function + + Public Shared Function GetRecords( _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer, _ + ByRef totalRecords As Integer) As EducationRecord() + Dim join As BaseClasses.Data.BaseFilter = Nothing + Dim recList As ArrayList = EducationTable.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize, totalRecords) + + Return CType(recList.ToArray(GetType(Persons.Business.EducationRecord)), EducationRecord()) + End Function + + Public Shared Function GetRecords( _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer, _ + ByRef totalRecords As Integer) As EducationRecord() + + Dim recList As ArrayList = EducationTable.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize, totalRecords) + + Return CType(recList.ToArray(GetType(Persons.Business.EducationRecord)), EducationRecord()) + End Function + + ''' + ''' This is a shared function that can be used to get total number of records that will be returned using the where clause. + ''' + Public Shared Function GetRecordCount(ByVal where As String) As Integer + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Return CInt(EducationTable.Instance.GetRecordListCount(Nothing, whereFilter, Nothing, Nothing)) + End Function + +''' + ''' This is a shared function that can be used to get total number of records that will be returned using the where clause. + ''' + Public Shared Function GetRecordCount(ByVal join As BaseFilter, ByVal where As String) As Integer + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Return CInt(EducationTable.Instance.GetRecordListCount(join, whereFilter, Nothing, Nothing)) + End Function + + Public Shared Function GetRecordCount(ByVal where As WhereClause) As Integer + Return CInt(EducationTable.Instance.GetRecordListCount(Nothing, where.GetFilter(), Nothing, Nothing)) + End Function + + Public Shared Function GetRecordCount(ByVal join As BaseFilter, ByVal where As WhereClause) As Integer + Return CInt(EducationTable.Instance.GetRecordListCount(join, where.GetFilter(), Nothing, Nothing)) + End Function + + ''' + ''' This is a shared function that can be used to get a EducationRecord record using a where clause. + ''' + Public Shared Function GetRecord(ByVal where As String) As EducationRecord + Dim orderBy As OrderBy = Nothing + Return GetRecord(where, orderBy) + End Function + + ''' + ''' This is a shared function that can be used to get a EducationRecord record using a where clause. + ''' + Public Shared Function GetRecord(ByVal join As BaseFilter, ByVal where As String) As EducationRecord + Dim orderBy As OrderBy = Nothing + Return GetRecord(join, where, orderBy) + End Function + + ''' + ''' This is a shared function that can be used to get a EducationRecord record using a where and order by clause. + ''' + Public Shared Function GetRecord( _ + ByVal where As String, _ + ByVal orderBy As OrderBy) As EducationRecord + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + Dim join As BaseClasses.Data.BaseFilter = Nothing + Dim recList As ArrayList = EducationTable.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MIN_BATCH_SIZE) + + Dim rec As EducationRecord = Nothing + If recList.Count > 0 Then + rec = CType(recList(0), EducationRecord) + End If + + Return rec + End Function + + ''' + ''' This is a shared function that can be used to get a EducationRecord record using a where and order by clause. + ''' + Public Shared Function GetRecord( _ + ByVal join As BaseFilter, _ + ByVal where As String, _ + ByVal orderBy As OrderBy) As EducationRecord + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Dim recList As ArrayList = EducationTable.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MIN_BATCH_SIZE) + + Dim rec As EducationRecord = Nothing + If recList.Count > 0 Then + rec = CType(recList(0), EducationRecord) + End If + + Return rec + End Function + + + Public Shared Function GetValues( _ + ByVal col As BaseColumn, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal maxItems As Integer) As String() + + ' Create the filter list. + Dim retCol As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, True) + retCol.AddColumn(col) + + Return EducationTable.Instance.GetColumnValues(retCol, Nothing, where.GetFilter(), Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, maxItems) + + End Function + + Public Shared Function GetValues( _ + ByVal col As BaseColumn, _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal maxItems As Integer) As String() + + ' Create the filter list. + Dim retCol As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, True) + retCol.AddColumn(col) + + Return EducationTable.Instance.GetColumnValues(retCol, join, where.GetFilter(), Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, maxItems) + + End Function + + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where clause. + ''' + Public Shared Function GetDataTable(ByVal where As String) As System.Data.DataTable + + Dim recs() As EducationRecord = GetRecords(where) + Return EducationTable.Instance.CreateDataTable(recs, Nothing) + End Function + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where clause. + ''' + Public Shared Function GetDataTable(ByVal join As BaseFilter, ByVal where As String) As System.Data.DataTable + + Dim recs() As EducationRecord = GetRecords(join, where) + Return EducationTable.Instance.CreateDataTable(recs, Nothing) + End Function + + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause. + ''' + Public Shared Function GetDataTable(ByVal where As String, ByVal orderBy As OrderBy) As System.Data.DataTable + + Dim recs() As EducationRecord = GetRecords(where, orderBy) + Return EducationTable.Instance.CreateDataTable(recs, Nothing) + End Function + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause. + ''' + Public Shared Function GetDataTable(ByVal join As BaseFilter, ByVal where As String, ByVal orderBy As OrderBy) As System.Data.DataTable + + Dim recs() As EducationRecord = GetRecords(join, where, orderBy) + Return EducationTable.Instance.CreateDataTable(recs, Nothing) + End Function + + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause with pagination. + ''' + Public Shared Function GetDataTable( _ + ByVal where As String, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As System.Data.DataTable + + Dim recs() As EducationRecord = GetRecords(where, orderBy, pageIndex, pageSize) + Return EducationTable.Instance.CreateDataTable(recs, Nothing) + End Function + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause with pagination. + ''' + Public Shared Function GetDataTable( _ + ByVal join As BaseFilter, _ + ByVal where As String, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As System.Data.DataTable + + Dim recs() As EducationRecord = GetRecords(join, where, orderBy, pageIndex, pageSize) + Return EducationTable.Instance.CreateDataTable(recs, Nothing) + End Function + + + ''' + ''' This is a shared function that can be used to delete records using a where clause. + ''' + Public Shared Sub DeleteRecords(ByVal where As String) + If where = Nothing OrElse where.Trim() = "" Then + Return + End If + + Dim whereFilter As SqlFilter = New SqlFilter(where) + EducationTable.Instance.DeleteRecordList(whereFilter) + End Sub + + ''' + ''' This is a shared function that can be used to export records using a where clause. + ''' + Public Shared Function Export(ByVal where As String) As String + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Return EducationTable.Instance.ExportRecordData(whereFilter) + End Function + + Public Shared Function Export(ByVal where As WhereClause) As String + Dim whereFilter As BaseFilter = Nothing + If Not where Is Nothing Then + whereFilter = where.GetFilter() + End If + + Return EducationTable.Instance.ExportRecordData(whereFilter) + End Function + + Public Shared Function GetSum( _ + ByVal col As BaseColumn, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) _ + As String + + Dim colSel As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, False) + colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Sum) + + Return EducationTable.Instance.GetColumnStatistics(colSel, Nothing, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + End Function + + Public Shared Function GetSum( _ + ByVal col As BaseColumn, _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) _ + As String + + Dim colSel As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, False) + colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Sum) + + Return EducationTable.Instance.GetColumnStatistics(colSel, join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + End Function + + + Public Shared Function GetCount( _ + ByVal col As BaseColumn, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) _ + As String + + Dim colSel As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, False) + colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Count) + + Return EducationTable.Instance.GetColumnStatistics(colSel, Nothing, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + End Function + + Public Shared Function GetCount( _ + ByVal col As BaseColumn, _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) _ + As String + + Dim colSel As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, False) + colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Count) + + Return EducationTable.Instance.GetColumnStatistics(colSel, join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + End Function + + ''' + ''' This method returns the columns in the table. + ''' + Public Shared Function GetColumns() As BaseColumn() + Return EducationTable.Instance.TableDefinition.Columns + End Function + + ''' + ''' This method returns the columnlist in the table. + ''' + Public Shared Function GetColumnList() As ColumnList + Return EducationTable.Instance.TableDefinition.ColumnList + End Function + + + ''' + ''' This method creates a new record and returns it to be edited. + ''' + Public Shared Function CreateNewRecord() As IRecord + Return EducationTable.Instance.CreateRecord() + End Function + + ''' + ''' This method creates a new record and returns it to be edited. + ''' + ''' ID of the new record. + Public Shared Function CreateNewRecord(ByVal tempId As String) As IRecord + Return EducationTable.Instance.CreateRecord(tempId) + End Function + + ''' + ''' This method checks if column is editable. + ''' + ''' Name of the column to check. + Public Shared Function isReadOnlyColumn(ByVal columnName As String) As Boolean + Dim column As BaseColumn = GetColumn(columnName) + If (Not IsNothing(column)) Then + Return column.IsValuesReadOnly + Else + Return True + End If + End Function + + ''' + ''' This method gets the specified column. + ''' + ''' Unique name of the column to fetch. + Public Shared Function GetColumn(ByVal uniqueColumnName As String) As BaseColumn + Dim column As BaseColumn = EducationTable.Instance.TableDefinition.ColumnList.GetByUniqueName(uniqueColumnName) + Return column + End Function + + ' Convenience method for getting a record using a string-based record identifier + Public Shared Function GetRecord(ByVal id As String, ByVal bMutable As Boolean) As EducationRecord + Return CType(EducationTable.Instance.GetRecordData(id, bMutable), EducationRecord) + End Function + + ' Convenience method for getting a record using a KeyValue record identifier + Public Shared Function GetRecord(ByVal id As KeyValue, ByVal bMutable As Boolean) As EducationRecord + Return CType(EducationTable.Instance.GetRecordData(id, bMutable), EducationRecord) + End Function + + ' Convenience method for creating a record + Public Overloads Function NewRecord( _ + ByVal EducationIdValue As String, _ + ByVal LevelValue As String _ + ) As KeyValue + Dim rec As IPrimaryKeyRecord = CType(Me.CreateRecord(), IPrimaryKeyRecord) + rec.SetString(EducationIdValue, EducationIdColumn) + rec.SetString(LevelValue, LevelColumn) + + + rec.Create() 'update the DB so any DB-initialized fields (like autoincrement IDs) can be initialized + + Dim key As KeyValue = rec.GetID() + Return key + End Function + + ''' + ''' This method deletes a specified record + ''' + ''' Keyvalue of the record to be deleted. + Public Shared Sub DeleteRecord(ByVal kv As KeyValue) + EducationTable.Instance.DeleteOneRecord(kv) + End Sub + + ''' + ''' This method checks if record exist in the database using the keyvalue provided. + ''' + ''' Key value of the record. + Public Shared Function DoesRecordExist(ByVal kv As KeyValue) As Boolean + Dim recordExist As Boolean = True + Try + EducationTable.GetRecord(kv, False) + Catch ex As Exception + recordExist = False + End Try + Return recordExist + End Function + + ''' + ''' This method returns all the primary columns in the table. + ''' + Public Shared Function GetPrimaryKeyColumns() As ColumnList + If (Not IsNothing(EducationTable.Instance.TableDefinition.PrimaryKey)) Then + Return EducationTable.Instance.TableDefinition.PrimaryKey.Columns + Else + Return Nothing + End If + End Function + + ''' + ''' This method takes a key and returns a keyvalue. + ''' + ''' key could be array of primary key values in case of composite primary key or a string containing single primary key value in case of non-composite primary key. + Public Shared Function GetKeyValue(ByVal key As Object) As KeyValue + Dim kv As KeyValue = Nothing + + If (Not (IsNothing(EducationTable.Instance.TableDefinition.PrimaryKey))) Then + + Dim isCompositePrimaryKey As Boolean = False + isCompositePrimaryKey = EducationTable.Instance.TableDefinition.PrimaryKey.IsCompositeKey + + If ((isCompositePrimaryKey) AndAlso (key.GetType.IsArray())) Then + + ' If the key is composite, then construct a key value. + kv = New KeyValue + Dim fullKeyString As String = "" + Dim keyArray As Array = CType(key, Array) + If (Not IsNothing(keyArray)) Then + Dim length As Integer = keyArray.Length + Dim pkColumns As ColumnList = EducationTable.Instance.TableDefinition.PrimaryKey.Columns + Dim pkColumn As BaseColumn + Dim index As Integer = 0 + For Each pkColumn In pkColumns + Dim keyString As String = CType(keyArray.GetValue(index), String) + If (EducationTable.Instance.TableDefinition.TableType = BaseClasses.Data.TableDefinition.TableTypes.Virtual) Then + kv.AddElement(pkColumn.UniqueName, keyString) + Else + kv.AddElement(pkColumn.InternalName, keyString) + End If + index = index + 1 + Next pkColumn + End If + + Else + ' If the key is not composite, then get the key value. + kv = EducationTable.Instance.TableDefinition.PrimaryKey.ParseValue(CType(key, String)) + End If + End If + Return kv + End Function + + + ''' + ''' This method takes a record and a Column and returns an evaluated value of DFKA formula. + ''' + Public Shared Function GetDFKA(ByVal rec As BaseRecord, ByVal col As BaseColumn) As String + Dim fkColumn As ForeignKey = EducationTable.Instance.TableDefinition.GetExpandableNonCompositeForeignKey(col) + If fkColumn Is Nothing Then + Return Nothing + End If + Dim _DFKA As String = fkColumn.PrimaryKeyDisplayColumns + If (_DFKA.Trim().StartsWith("=")) Then + ' if the formula is in the format of "= ., then pull out the data from the rec object instead of doing formula evaluation + Dim tableCodeName As String = fkColumn.PrimaryKeyTableDefinition.TableCodeName + Dim column As String = _DFKA.Trim("="c).Trim() + If column.StartsWith(tableCodeName & ".", StringComparison.InvariantCultureIgnoreCase) Then + column = column.Substring(tableCodeName.Length + 1) + End If + + For Each c As BaseColumn In fkColumn.PrimaryKeyTableDefinition.Columns + If column = c.CodeName Then + Return rec.Format(c) + End If + Next + Dim tableName As String = fkColumn.PrimaryKeyTableDefinition.TableCodeName + Return EvaluateFormula(_DFKA, rec, Nothing, tableName) + Else + Return Nothing + End If + End Function + + ''' + ''' This method takes a keyValue and a Column and returns an evaluated value of DFKA formula. + ''' + Public Shared Function GetDFKA(ByVal keyValue As String, ByVal col As BaseColumn, ByVal formatPattern as String) As String + If keyValue Is Nothing Then + Return Nothing + End If + Dim fkColumn As ForeignKey = EducationTable.Instance.TableDefinition.GetExpandableNonCompositeForeignKey(col) + If fkColumn Is Nothing Then + Return Nothing + End If + Dim _DFKA As String = fkColumn.PrimaryKeyDisplayColumns + If (_DFKA.Trim().StartsWith("=")) Then + Dim tableName As String = fkColumn.PrimaryKeyTableDefinition.TableCodeName + Dim t As PrimaryKeyTable = CType(DatabaseObjects.GetTableObject(tableName), PrimaryKeyTable) + Dim rec As BaseRecord = Nothing + If Not t Is Nothing Then + Try + rec = CType(t.GetRecordData(keyValue, False), BaseRecord) + Catch + rec = Nothing + End Try + End If + If rec Is Nothing Then + Return "" + End If + + ' if the formula is in the format of "= ., then pull out the data from the rec object instead of doing formula evaluation + Dim tableCodeName As String = fkColumn.PrimaryKeyTableDefinition.TableCodeName + Dim column As String = _DFKA.Trim("="c).Trim() + If column.StartsWith(tableCodeName & ".", StringComparison.InvariantCultureIgnoreCase) Then + column = column.Substring(tableCodeName.Length + 1) + End If + + For Each c As BaseColumn In fkColumn.PrimaryKeyTableDefinition.Columns + If column = c.CodeName Then + Return rec.Format(c) + End If + Next + Return EvaluateFormula(_DFKA, rec, Nothing, tableName) + Else + Return Nothing + End If + End Function + + ''' + ''' Evaluates the formula + ''' + Public Shared Function EvaluateFormula(ByVal formula As String, Optional ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord = Nothing, Optional ByVal format As String = Nothing, Optional ByVal name As String = "") As String + Dim e As BaseFormulaEvaluator = New BaseFormulaEvaluator() + If Not dataSourceForEvaluate Is Nothing Then + e.Evaluator.Variables.Add(name, dataSourceForEvaluate) + end if + e.DataSource = dataSourceForEvaluate + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + If Not String.IsNullOrEmpty(format) Then + Return BaseFormulaUtils.Format(resultObj, format) + Else + Return resultObj.ToString() + End If + End Function + + +#End Region + +End Class +End Namespace diff --git a/App_Code/Business Layer/BaseExTraSalaryRecord.vb b/App_Code/Business Layer/BaseExTraSalaryRecord.vb new file mode 100644 index 0000000..01bd586 --- /dev/null +++ b/App_Code/Business Layer/BaseExTraSalaryRecord.vb @@ -0,0 +1,635 @@ +' This class is "generated" and will be overwritten. +' Your customizations should be made in ExTraSalaryRecord.vb + +Imports System.Data.SqlTypes +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + +Namespace Persons.Business + +''' +''' The generated superclass for the class. +''' +''' +''' This class is not intended to be instantiated directly. To obtain an instance of this class, +''' use the methods of the class. +''' +''' +''' + + Public Class BaseExTraSalaryRecord + Inherits PrimaryKeyRecord + + + Public Shared Shadows ReadOnly TableUtils As ExTraSalaryTable = ExTraSalaryTable.Instance + + ' Constructors + + Protected Sub New() + MyBase.New(TableUtils) + End Sub + + Protected Sub New(ByVal record As PrimaryKeyRecord) + MyBase.New(record, TableUtils) + End Sub + + 'Evaluates Initialize when->Inserting record formulas specified at the data access layer + Public Overridable Sub ExTraSalaryRecord_InsertingRecord(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles Me.InsertingRecord + 'Apply Initialize->Inserting record formula only if validation is successful. + Dim ExTraSalaryRec As ExTraSalaryRecord = CType(sender,ExTraSalaryRecord) + Validate_Inserting() + If Not ExTraSalaryRec Is Nothing AndAlso Not ExTraSalaryRec.IsReadOnly Then + End If + End Sub + + 'Evaluates Initialize when->Updating record formulas specified at the data access layer + Public Overridable Sub ExTraSalaryRecord_UpdatingRecord(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles Me.UpdatingRecord + 'Apply Initialize->Updating record formula only if validation is successful. + Dim ExTraSalaryRec As ExTraSalaryRecord = CType(sender,ExTraSalaryRecord) + Validate_Updating() + If Not ExTraSalaryRec Is Nothing AndAlso Not ExTraSalaryRec.IsReadOnly Then + End If + End Sub + + 'Evaluates Initialize when->Reading record formulas specified at the data access layer + Public Overridable Sub ExTraSalaryRecord_ReadRecord(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.ReadRecord + 'Apply Initialize->Reading record formula only if validation is successful. + Dim ExTraSalaryRec As ExTraSalaryRecord = CType(sender,ExTraSalaryRecord) + If Not ExTraSalaryRec Is Nothing AndAlso Not ExTraSalaryRec.IsReadOnly Then + End If + End Sub + + 'Evaluates Validate when->Inserting formulas specified at the data access layer + Public Overridable Sub Validate_Inserting () + Dim fullValidationMessage As String = "" + Dim validationMessage As String = "" + + dim formula as String = "" + + + If validationMessage <> "" AndAlso validationMessage.ToLower() <> "true" Then + fullValidationMessage &= validationMessage & vbCrLf + End If + + If fullValidationMessage <> "" Then + Throw New Exception(fullValidationMessage) + End If + End Sub + + 'Evaluates Validate when->Updating formulas specified at the data access layer + Public Overridable Sub Validate_Updating () + Dim fullValidationMessage As String = "" + Dim validationMessage As String = "" + + dim formula as String = "" + + + If validationMessage <> "" AndAlso validationMessage.ToLower() <> "true" Then + fullValidationMessage &= validationMessage & vbCrLf + End If + + If fullValidationMessage <> "" Then + Throw New Exception(fullValidationMessage) + End If + End Sub + + Public Overridable Function EvaluateFormula(ByVal formula As String, Optional ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord = Nothing, Optional ByVal format As String = Nothing) As String + + Dim e As Data.BaseFormulaEvaluator = New Data.BaseFormulaEvaluator() + + ' All variables referred to in the formula are expected to be + ' properties of the DataSource. For example, referring to + ' UnitPrice as a variable will refer to DataSource.UnitPrice + e.DataSource = dataSourceForEvaluate + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + Return resultObj.ToString() + End Function + + + + + + + +#Region "Convenience methods to get/set values of fields" + + ''' + ''' This is a convenience method that provides direct access to the value of the record's ExTraSalary_.ExtraSalaryId field. + ''' + Public Function GetExtraSalaryIdValue() As ColumnValue + Return Me.GetValue(TableUtils.ExtraSalaryIdColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's ExTraSalary_.ExtraSalaryId field. + ''' + Public Function GetExtraSalaryIdFieldValue() As Int32 + Return CType(Me.GetValue(TableUtils.ExtraSalaryIdColumn).ToInt32(), Int32) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's ExTraSalary_.FullName field. + ''' + Public Function GetFullNameValue() As ColumnValue + Return Me.GetValue(TableUtils.FullNameColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's ExTraSalary_.FullName field. + ''' + Public Function GetFullNameFieldValue() As String + Return CType(Me.GetValue(TableUtils.FullNameColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's ExTraSalary_.FullName field. + ''' + Public Sub SetFullNameFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.FullNameColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's ExTraSalary_.FullName field. + ''' + Public Sub SetFullNameFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.FullNameColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's ExTraSalary_.AbbvrName field. + ''' + Public Function GetAbbvrNameValue() As ColumnValue + Return Me.GetValue(TableUtils.AbbvrNameColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's ExTraSalary_.AbbvrName field. + ''' + Public Function GetAbbvrNameFieldValue() As String + Return CType(Me.GetValue(TableUtils.AbbvrNameColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's ExTraSalary_.AbbvrName field. + ''' + Public Sub SetAbbvrNameFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.AbbvrNameColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's ExTraSalary_.AbbvrName field. + ''' + Public Sub SetAbbvrNameFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.AbbvrNameColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's ExTraSalary_.OffAmout field. + ''' + Public Function GetOffAmoutValue() As ColumnValue + Return Me.GetValue(TableUtils.OffAmoutColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's ExTraSalary_.OffAmout field. + ''' + Public Function GetOffAmoutFieldValue() As Int32 + Return CType(Me.GetValue(TableUtils.OffAmoutColumn).ToInt32(), Int32) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's ExTraSalary_.OffAmout field. + ''' + Public Sub SetOffAmoutFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.OffAmoutColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's ExTraSalary_.OffAmout field. + ''' + Public Sub SetOffAmoutFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.OffAmoutColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's ExTraSalary_.OffAmout field. + ''' + Public Sub SetOffAmoutFieldValue(ByVal val As Double) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.OffAmoutColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's ExTraSalary_.OffAmout field. + ''' + Public Sub SetOffAmoutFieldValue(ByVal val As Decimal) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.OffAmoutColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's ExTraSalary_.OffAmout field. + ''' + Public Sub SetOffAmoutFieldValue(ByVal val As Int64) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.OffAmoutColumn) + End Sub + ''' + ''' This is a convenience method that provides direct access to the value of the record's ExTraSalary_.NonOffAmout field. + ''' + Public Function GetNonOffAmoutValue() As ColumnValue + Return Me.GetValue(TableUtils.NonOffAmoutColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's ExTraSalary_.NonOffAmout field. + ''' + Public Function GetNonOffAmoutFieldValue() As Int32 + Return CType(Me.GetValue(TableUtils.NonOffAmoutColumn).ToInt32(), Int32) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's ExTraSalary_.NonOffAmout field. + ''' + Public Sub SetNonOffAmoutFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.NonOffAmoutColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's ExTraSalary_.NonOffAmout field. + ''' + Public Sub SetNonOffAmoutFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.NonOffAmoutColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's ExTraSalary_.NonOffAmout field. + ''' + Public Sub SetNonOffAmoutFieldValue(ByVal val As Double) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.NonOffAmoutColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's ExTraSalary_.NonOffAmout field. + ''' + Public Sub SetNonOffAmoutFieldValue(ByVal val As Decimal) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.NonOffAmoutColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's ExTraSalary_.NonOffAmout field. + ''' + Public Sub SetNonOffAmoutFieldValue(ByVal val As Int64) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.NonOffAmoutColumn) + End Sub + ''' + ''' This is a convenience method that provides direct access to the value of the record's ExTraSalary_.PrivateAmout field. + ''' + Public Function GetPrivateAmoutValue() As ColumnValue + Return Me.GetValue(TableUtils.PrivateAmoutColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's ExTraSalary_.PrivateAmout field. + ''' + Public Function GetPrivateAmoutFieldValue() As Int32 + Return CType(Me.GetValue(TableUtils.PrivateAmoutColumn).ToInt32(), Int32) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's ExTraSalary_.PrivateAmout field. + ''' + Public Sub SetPrivateAmoutFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.PrivateAmoutColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's ExTraSalary_.PrivateAmout field. + ''' + Public Sub SetPrivateAmoutFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.PrivateAmoutColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's ExTraSalary_.PrivateAmout field. + ''' + Public Sub SetPrivateAmoutFieldValue(ByVal val As Double) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.PrivateAmoutColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's ExTraSalary_.PrivateAmout field. + ''' + Public Sub SetPrivateAmoutFieldValue(ByVal val As Decimal) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.PrivateAmoutColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's ExTraSalary_.PrivateAmout field. + ''' + Public Sub SetPrivateAmoutFieldValue(ByVal val As Int64) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.PrivateAmoutColumn) + End Sub + ''' + ''' This is a convenience method that provides direct access to the value of the record's ExTraSalary_.AppBy field. + ''' + Public Function GetAppByValue() As ColumnValue + Return Me.GetValue(TableUtils.AppByColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's ExTraSalary_.AppBy field. + ''' + Public Function GetAppByFieldValue() As String + Return CType(Me.GetValue(TableUtils.AppByColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's ExTraSalary_.AppBy field. + ''' + Public Sub SetAppByFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.AppByColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's ExTraSalary_.AppBy field. + ''' + Public Sub SetAppByFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.AppByColumn) + End Sub + + + +#End Region + +#Region "Convenience methods to get field names" + + ''' + ''' This is a convenience property that provides direct access to the value of the record's ExTraSalary_.ExtraSalaryId field. + ''' + Public Property ExtraSalaryId() As Int32 + Get + Return CType(Me.GetValue(TableUtils.ExtraSalaryIdColumn).ToInt32(), Int32) + End Get + Set (ByVal val As Int32) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.ExtraSalaryIdColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property ExtraSalaryIdSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.ExtraSalaryIdColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property ExtraSalaryIdDefault() As String + Get + Return TableUtils.ExtraSalaryIdColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's ExTraSalary_.FullName field. + ''' + Public Property FullName() As String + Get + Return CType(Me.GetValue(TableUtils.FullNameColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.FullNameColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property FullNameSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.FullNameColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property FullNameDefault() As String + Get + Return TableUtils.FullNameColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's ExTraSalary_.AbbvrName field. + ''' + Public Property AbbvrName() As String + Get + Return CType(Me.GetValue(TableUtils.AbbvrNameColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.AbbvrNameColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property AbbvrNameSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.AbbvrNameColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property AbbvrNameDefault() As String + Get + Return TableUtils.AbbvrNameColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's ExTraSalary_.OffAmout field. + ''' + Public Property OffAmout() As Int32 + Get + Return CType(Me.GetValue(TableUtils.OffAmoutColumn).ToInt32(), Int32) + End Get + Set (ByVal val As Int32) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.OffAmoutColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property OffAmoutSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.OffAmoutColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property OffAmoutDefault() As String + Get + Return TableUtils.OffAmoutColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's ExTraSalary_.NonOffAmout field. + ''' + Public Property NonOffAmout() As Int32 + Get + Return CType(Me.GetValue(TableUtils.NonOffAmoutColumn).ToInt32(), Int32) + End Get + Set (ByVal val As Int32) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.NonOffAmoutColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property NonOffAmoutSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.NonOffAmoutColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property NonOffAmoutDefault() As String + Get + Return TableUtils.NonOffAmoutColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's ExTraSalary_.PrivateAmout field. + ''' + Public Property PrivateAmout() As Int32 + Get + Return CType(Me.GetValue(TableUtils.PrivateAmoutColumn).ToInt32(), Int32) + End Get + Set (ByVal val As Int32) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.PrivateAmoutColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property PrivateAmoutSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.PrivateAmoutColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property PrivateAmoutDefault() As String + Get + Return TableUtils.PrivateAmoutColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's ExTraSalary_.AppBy field. + ''' + Public Property AppBy() As String + Get + Return CType(Me.GetValue(TableUtils.AppByColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.AppByColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property AppBySpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.AppByColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property AppByDefault() As String + Get + Return TableUtils.AppByColumn.DefaultValue + End Get + End Property + + + +#End Region + +End Class +End Namespace diff --git a/App_Code/Business Layer/BaseExTraSalaryTable.vb b/App_Code/Business Layer/BaseExTraSalaryTable.vb new file mode 100644 index 0000000..ab92240 --- /dev/null +++ b/App_Code/Business Layer/BaseExTraSalaryTable.vb @@ -0,0 +1,886 @@ +' This class is "generated" and will be overwritten. +' Your customizations should be made in ExTraSalaryRecord.vb + +Imports System.Data.SqlTypes +Imports System.Data +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider +Imports Persons.Data + +Namespace Persons.Business + +''' +''' The generated superclass for the class. +''' Provides access to the schema information and record data of a database table or view named ExTraSalary. +''' +''' +''' The connection details (name, location, etc.) of the database and table (or view) accessed by this class +''' are resolved at runtime based on the connection string in the application's Web.Config file. +''' +''' This class is not intended to be instantiated directly. To obtain an instance of this class, use +''' ExTraSalaryTable.Instance. +''' +''' +''' + + Public Class BaseExTraSalaryTable + Inherits PrimaryKeyTable + + + Private ReadOnly TableDefinitionString As String = ExTraSalaryDefinition.GetXMLString() + + + + + + + + Protected Sub New() + MyBase.New() + Me.Initialize() + End Sub + + Protected Overridable Sub Initialize() + Dim def As New XmlTableDefinition(TableDefinitionString) + Me.TableDefinition = New TableDefinition() + Me.TableDefinition.TableClassName = System.Reflection.Assembly.CreateQualifiedName("App_Code", "Persons.Business.ExTraSalaryTable") + def.InitializeTableDefinition(Me.TableDefinition) + Me.ConnectionName = def.GetConnectionName() + Me.RecordClassName = System.Reflection.Assembly.CreateQualifiedName("App_Code", "Persons.Business.ExTraSalaryRecord") + Me.ApplicationName = "App_Code" + Me.DataAdapter = New ExTraSalarySqlTable() + Directcast(Me.DataAdapter, ExTraSalarySqlTable).ConnectionName = Me.ConnectionName + + Me.TableDefinition.AdapterMetaData = Me.DataAdapter.AdapterMetaData + ExtraSalaryIdColumn.CodeName = "ExtraSalaryId" + FullNameColumn.CodeName = "FullName" + AbbvrNameColumn.CodeName = "AbbvrName" + OffAmoutColumn.CodeName = "OffAmout" + NonOffAmoutColumn.CodeName = "NonOffAmout" + PrivateAmoutColumn.CodeName = "PrivateAmout" + AppByColumn.CodeName = "AppBy" + + End Sub + +#Region "Overriden methods" + + +#End Region + +#Region "Properties for columns" + + ''' + ''' This is a convenience property that provides direct access to the table's ExTraSalary_.ExtraSalaryId column object. + ''' + Public ReadOnly Property ExtraSalaryIdColumn() As BaseClasses.Data.NumberColumn + Get + Return CType(Me.TableDefinition.ColumnList(0), BaseClasses.Data.NumberColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's ExTraSalary_.ExtraSalaryId column object. + ''' + Public Shared ReadOnly Property ExtraSalaryId() As BaseClasses.Data.NumberColumn + Get + Return ExTraSalaryTable.Instance.ExtraSalaryIdColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's ExTraSalary_.FullName column object. + ''' + Public ReadOnly Property FullNameColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(1), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's ExTraSalary_.FullName column object. + ''' + Public Shared ReadOnly Property FullName() As BaseClasses.Data.StringColumn + Get + Return ExTraSalaryTable.Instance.FullNameColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's ExTraSalary_.AbbvrName column object. + ''' + Public ReadOnly Property AbbvrNameColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(2), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's ExTraSalary_.AbbvrName column object. + ''' + Public Shared ReadOnly Property AbbvrName() As BaseClasses.Data.StringColumn + Get + Return ExTraSalaryTable.Instance.AbbvrNameColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's ExTraSalary_.OffAmout column object. + ''' + Public ReadOnly Property OffAmoutColumn() As BaseClasses.Data.NumberColumn + Get + Return CType(Me.TableDefinition.ColumnList(3), BaseClasses.Data.NumberColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's ExTraSalary_.OffAmout column object. + ''' + Public Shared ReadOnly Property OffAmout() As BaseClasses.Data.NumberColumn + Get + Return ExTraSalaryTable.Instance.OffAmoutColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's ExTraSalary_.NonOffAmout column object. + ''' + Public ReadOnly Property NonOffAmoutColumn() As BaseClasses.Data.NumberColumn + Get + Return CType(Me.TableDefinition.ColumnList(4), BaseClasses.Data.NumberColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's ExTraSalary_.NonOffAmout column object. + ''' + Public Shared ReadOnly Property NonOffAmout() As BaseClasses.Data.NumberColumn + Get + Return ExTraSalaryTable.Instance.NonOffAmoutColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's ExTraSalary_.PrivateAmout column object. + ''' + Public ReadOnly Property PrivateAmoutColumn() As BaseClasses.Data.NumberColumn + Get + Return CType(Me.TableDefinition.ColumnList(5), BaseClasses.Data.NumberColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's ExTraSalary_.PrivateAmout column object. + ''' + Public Shared ReadOnly Property PrivateAmout() As BaseClasses.Data.NumberColumn + Get + Return ExTraSalaryTable.Instance.PrivateAmoutColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's ExTraSalary_.AppBy column object. + ''' + Public ReadOnly Property AppByColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(6), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's ExTraSalary_.AppBy column object. + ''' + Public Shared ReadOnly Property AppBy() As BaseClasses.Data.StringColumn + Get + Return ExTraSalaryTable.Instance.AppByColumn + End Get + End Property + + +#End Region + + +#Region "Shared helper methods" + + ''' + ''' This is a shared function that can be used to get an array of ExTraSalaryRecord records using a where clause. + ''' + Public Shared Function GetRecords(ByVal where As String) As ExTraSalaryRecord() + + Return GetRecords(where, Nothing, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) + End Function + + ''' + ''' This is a shared function that can be used to get an array of ExTraSalaryRecord records using a where clause. + ''' + Public Shared Function GetRecords(ByVal join As BaseFilter, ByVal where As String) As ExTraSalaryRecord() + + Return GetRecords(join, where, Nothing, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) + End Function + + ''' + ''' This is a shared function that can be used to get an array of ExTraSalaryRecord records using a where and order by clause. + ''' + Public Shared Function GetRecords( _ + ByVal where As String, _ + ByVal orderBy As OrderBy) As ExTraSalaryRecord() + + Return GetRecords(where, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) + End Function + + ''' + ''' This is a shared function that can be used to get an array of ExTraSalaryRecord records using a where and order by clause. + ''' + Public Shared Function GetRecords( _ + ByVal join As BaseFilter, _ + ByVal where As String, _ + ByVal orderBy As OrderBy) As ExTraSalaryRecord() + + Return GetRecords(join, where, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) + End Function + + ''' + ''' This is a shared function that can be used to get an array of ExTraSalaryRecord records using a where and order by clause clause with pagination. + ''' + Public Shared Function GetRecords( _ + ByVal where As String, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As ExTraSalaryRecord() + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + Dim join As BaseClasses.Data.BaseFilter = Nothing + Dim recList As ArrayList = ExTraSalaryTable.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, pageIndex, pageSize) + + Return CType(recList.ToArray(GetType(Persons.Business.ExTraSalaryRecord)), ExTraSalaryRecord()) + End Function + + ''' + ''' This is a shared function that can be used to get an array of ExTraSalaryRecord records using a where and order by clause clause with pagination. + ''' + Public Shared Function GetRecords( _ + ByVal join As BaseFilter, _ + ByVal where As String, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As ExTraSalaryRecord() + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Dim recList As ArrayList = ExTraSalaryTable.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, pageIndex, pageSize) + + Return CType(recList.ToArray(GetType(Persons.Business.ExTraSalaryRecord)), ExTraSalaryRecord()) + End Function + + Public Shared Function GetRecords( _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As ExTraSalaryRecord() + Dim join As BaseClasses.Data.BaseFilter = Nothing + Dim recList As ArrayList = ExTraSalaryTable.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + Return CType(recList.ToArray(GetType(Persons.Business.ExTraSalaryRecord)), ExTraSalaryRecord()) + End Function + + Public Shared Function GetRecords( _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As ExTraSalaryRecord() + + Dim recList As ArrayList = ExTraSalaryTable.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + Return CType(recList.ToArray(GetType(Persons.Business.ExTraSalaryRecord)), ExTraSalaryRecord()) + End Function + + Public Shared Function GetRecords( _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer, _ + ByRef totalRecords As Integer) As ExTraSalaryRecord() + Dim join As BaseClasses.Data.BaseFilter = Nothing + Dim recList As ArrayList = ExTraSalaryTable.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize, totalRecords) + + Return CType(recList.ToArray(GetType(Persons.Business.ExTraSalaryRecord)), ExTraSalaryRecord()) + End Function + + Public Shared Function GetRecords( _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer, _ + ByRef totalRecords As Integer) As ExTraSalaryRecord() + + Dim recList As ArrayList = ExTraSalaryTable.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize, totalRecords) + + Return CType(recList.ToArray(GetType(Persons.Business.ExTraSalaryRecord)), ExTraSalaryRecord()) + End Function + + ''' + ''' This is a shared function that can be used to get total number of records that will be returned using the where clause. + ''' + Public Shared Function GetRecordCount(ByVal where As String) As Integer + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Return CInt(ExTraSalaryTable.Instance.GetRecordListCount(Nothing, whereFilter, Nothing, Nothing)) + End Function + +''' + ''' This is a shared function that can be used to get total number of records that will be returned using the where clause. + ''' + Public Shared Function GetRecordCount(ByVal join As BaseFilter, ByVal where As String) As Integer + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Return CInt(ExTraSalaryTable.Instance.GetRecordListCount(join, whereFilter, Nothing, Nothing)) + End Function + + Public Shared Function GetRecordCount(ByVal where As WhereClause) As Integer + Return CInt(ExTraSalaryTable.Instance.GetRecordListCount(Nothing, where.GetFilter(), Nothing, Nothing)) + End Function + + Public Shared Function GetRecordCount(ByVal join As BaseFilter, ByVal where As WhereClause) As Integer + Return CInt(ExTraSalaryTable.Instance.GetRecordListCount(join, where.GetFilter(), Nothing, Nothing)) + End Function + + ''' + ''' This is a shared function that can be used to get a ExTraSalaryRecord record using a where clause. + ''' + Public Shared Function GetRecord(ByVal where As String) As ExTraSalaryRecord + Dim orderBy As OrderBy = Nothing + Return GetRecord(where, orderBy) + End Function + + ''' + ''' This is a shared function that can be used to get a ExTraSalaryRecord record using a where clause. + ''' + Public Shared Function GetRecord(ByVal join As BaseFilter, ByVal where As String) As ExTraSalaryRecord + Dim orderBy As OrderBy = Nothing + Return GetRecord(join, where, orderBy) + End Function + + ''' + ''' This is a shared function that can be used to get a ExTraSalaryRecord record using a where and order by clause. + ''' + Public Shared Function GetRecord( _ + ByVal where As String, _ + ByVal orderBy As OrderBy) As ExTraSalaryRecord + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + Dim join As BaseClasses.Data.BaseFilter = Nothing + Dim recList As ArrayList = ExTraSalaryTable.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MIN_BATCH_SIZE) + + Dim rec As ExTraSalaryRecord = Nothing + If recList.Count > 0 Then + rec = CType(recList(0), ExTraSalaryRecord) + End If + + Return rec + End Function + + ''' + ''' This is a shared function that can be used to get a ExTraSalaryRecord record using a where and order by clause. + ''' + Public Shared Function GetRecord( _ + ByVal join As BaseFilter, _ + ByVal where As String, _ + ByVal orderBy As OrderBy) As ExTraSalaryRecord + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Dim recList As ArrayList = ExTraSalaryTable.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MIN_BATCH_SIZE) + + Dim rec As ExTraSalaryRecord = Nothing + If recList.Count > 0 Then + rec = CType(recList(0), ExTraSalaryRecord) + End If + + Return rec + End Function + + + Public Shared Function GetValues( _ + ByVal col As BaseColumn, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal maxItems As Integer) As String() + + ' Create the filter list. + Dim retCol As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, True) + retCol.AddColumn(col) + + Return ExTraSalaryTable.Instance.GetColumnValues(retCol, Nothing, where.GetFilter(), Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, maxItems) + + End Function + + Public Shared Function GetValues( _ + ByVal col As BaseColumn, _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal maxItems As Integer) As String() + + ' Create the filter list. + Dim retCol As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, True) + retCol.AddColumn(col) + + Return ExTraSalaryTable.Instance.GetColumnValues(retCol, join, where.GetFilter(), Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, maxItems) + + End Function + + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where clause. + ''' + Public Shared Function GetDataTable(ByVal where As String) As System.Data.DataTable + + Dim recs() As ExTraSalaryRecord = GetRecords(where) + Return ExTraSalaryTable.Instance.CreateDataTable(recs, Nothing) + End Function + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where clause. + ''' + Public Shared Function GetDataTable(ByVal join As BaseFilter, ByVal where As String) As System.Data.DataTable + + Dim recs() As ExTraSalaryRecord = GetRecords(join, where) + Return ExTraSalaryTable.Instance.CreateDataTable(recs, Nothing) + End Function + + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause. + ''' + Public Shared Function GetDataTable(ByVal where As String, ByVal orderBy As OrderBy) As System.Data.DataTable + + Dim recs() As ExTraSalaryRecord = GetRecords(where, orderBy) + Return ExTraSalaryTable.Instance.CreateDataTable(recs, Nothing) + End Function + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause. + ''' + Public Shared Function GetDataTable(ByVal join As BaseFilter, ByVal where As String, ByVal orderBy As OrderBy) As System.Data.DataTable + + Dim recs() As ExTraSalaryRecord = GetRecords(join, where, orderBy) + Return ExTraSalaryTable.Instance.CreateDataTable(recs, Nothing) + End Function + + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause with pagination. + ''' + Public Shared Function GetDataTable( _ + ByVal where As String, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As System.Data.DataTable + + Dim recs() As ExTraSalaryRecord = GetRecords(where, orderBy, pageIndex, pageSize) + Return ExTraSalaryTable.Instance.CreateDataTable(recs, Nothing) + End Function + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause with pagination. + ''' + Public Shared Function GetDataTable( _ + ByVal join As BaseFilter, _ + ByVal where As String, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As System.Data.DataTable + + Dim recs() As ExTraSalaryRecord = GetRecords(join, where, orderBy, pageIndex, pageSize) + Return ExTraSalaryTable.Instance.CreateDataTable(recs, Nothing) + End Function + + + ''' + ''' This is a shared function that can be used to delete records using a where clause. + ''' + Public Shared Sub DeleteRecords(ByVal where As String) + If where = Nothing OrElse where.Trim() = "" Then + Return + End If + + Dim whereFilter As SqlFilter = New SqlFilter(where) + ExTraSalaryTable.Instance.DeleteRecordList(whereFilter) + End Sub + + ''' + ''' This is a shared function that can be used to export records using a where clause. + ''' + Public Shared Function Export(ByVal where As String) As String + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Return ExTraSalaryTable.Instance.ExportRecordData(whereFilter) + End Function + + Public Shared Function Export(ByVal where As WhereClause) As String + Dim whereFilter As BaseFilter = Nothing + If Not where Is Nothing Then + whereFilter = where.GetFilter() + End If + + Return ExTraSalaryTable.Instance.ExportRecordData(whereFilter) + End Function + + Public Shared Function GetSum( _ + ByVal col As BaseColumn, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) _ + As String + + Dim colSel As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, False) + colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Sum) + + Return ExTraSalaryTable.Instance.GetColumnStatistics(colSel, Nothing, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + End Function + + Public Shared Function GetSum( _ + ByVal col As BaseColumn, _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) _ + As String + + Dim colSel As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, False) + colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Sum) + + Return ExTraSalaryTable.Instance.GetColumnStatistics(colSel, join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + End Function + + + Public Shared Function GetCount( _ + ByVal col As BaseColumn, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) _ + As String + + Dim colSel As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, False) + colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Count) + + Return ExTraSalaryTable.Instance.GetColumnStatistics(colSel, Nothing, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + End Function + + Public Shared Function GetCount( _ + ByVal col As BaseColumn, _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) _ + As String + + Dim colSel As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, False) + colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Count) + + Return ExTraSalaryTable.Instance.GetColumnStatistics(colSel, join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + End Function + + ''' + ''' This method returns the columns in the table. + ''' + Public Shared Function GetColumns() As BaseColumn() + Return ExTraSalaryTable.Instance.TableDefinition.Columns + End Function + + ''' + ''' This method returns the columnlist in the table. + ''' + Public Shared Function GetColumnList() As ColumnList + Return ExTraSalaryTable.Instance.TableDefinition.ColumnList + End Function + + + ''' + ''' This method creates a new record and returns it to be edited. + ''' + Public Shared Function CreateNewRecord() As IRecord + Return ExTraSalaryTable.Instance.CreateRecord() + End Function + + ''' + ''' This method creates a new record and returns it to be edited. + ''' + ''' ID of the new record. + Public Shared Function CreateNewRecord(ByVal tempId As String) As IRecord + Return ExTraSalaryTable.Instance.CreateRecord(tempId) + End Function + + ''' + ''' This method checks if column is editable. + ''' + ''' Name of the column to check. + Public Shared Function isReadOnlyColumn(ByVal columnName As String) As Boolean + Dim column As BaseColumn = GetColumn(columnName) + If (Not IsNothing(column)) Then + Return column.IsValuesReadOnly + Else + Return True + End If + End Function + + ''' + ''' This method gets the specified column. + ''' + ''' Unique name of the column to fetch. + Public Shared Function GetColumn(ByVal uniqueColumnName As String) As BaseColumn + Dim column As BaseColumn = ExTraSalaryTable.Instance.TableDefinition.ColumnList.GetByUniqueName(uniqueColumnName) + Return column + End Function + + ' Convenience method for getting a record using a string-based record identifier + Public Shared Function GetRecord(ByVal id As String, ByVal bMutable As Boolean) As ExTraSalaryRecord + Return CType(ExTraSalaryTable.Instance.GetRecordData(id, bMutable), ExTraSalaryRecord) + End Function + + ' Convenience method for getting a record using a KeyValue record identifier + Public Shared Function GetRecord(ByVal id As KeyValue, ByVal bMutable As Boolean) As ExTraSalaryRecord + Return CType(ExTraSalaryTable.Instance.GetRecordData(id, bMutable), ExTraSalaryRecord) + End Function + + ' Convenience method for creating a record + Public Overloads Function NewRecord( _ + ByVal FullNameValue As String, _ + ByVal AbbvrNameValue As String, _ + ByVal OffAmoutValue As String, _ + ByVal NonOffAmoutValue As String, _ + ByVal PrivateAmoutValue As String, _ + ByVal AppByValue As String _ + ) As KeyValue + Dim rec As IPrimaryKeyRecord = CType(Me.CreateRecord(), IPrimaryKeyRecord) + rec.SetString(FullNameValue, FullNameColumn) + rec.SetString(AbbvrNameValue, AbbvrNameColumn) + rec.SetString(OffAmoutValue, OffAmoutColumn) + rec.SetString(NonOffAmoutValue, NonOffAmoutColumn) + rec.SetString(PrivateAmoutValue, PrivateAmoutColumn) + rec.SetString(AppByValue, AppByColumn) + + + rec.Create() 'update the DB so any DB-initialized fields (like autoincrement IDs) can be initialized + + Dim key As KeyValue = rec.GetID() + Return key + End Function + + ''' + ''' This method deletes a specified record + ''' + ''' Keyvalue of the record to be deleted. + Public Shared Sub DeleteRecord(ByVal kv As KeyValue) + ExTraSalaryTable.Instance.DeleteOneRecord(kv) + End Sub + + ''' + ''' This method checks if record exist in the database using the keyvalue provided. + ''' + ''' Key value of the record. + Public Shared Function DoesRecordExist(ByVal kv As KeyValue) As Boolean + Dim recordExist As Boolean = True + Try + ExTraSalaryTable.GetRecord(kv, False) + Catch ex As Exception + recordExist = False + End Try + Return recordExist + End Function + + ''' + ''' This method returns all the primary columns in the table. + ''' + Public Shared Function GetPrimaryKeyColumns() As ColumnList + If (Not IsNothing(ExTraSalaryTable.Instance.TableDefinition.PrimaryKey)) Then + Return ExTraSalaryTable.Instance.TableDefinition.PrimaryKey.Columns + Else + Return Nothing + End If + End Function + + ''' + ''' This method takes a key and returns a keyvalue. + ''' + ''' key could be array of primary key values in case of composite primary key or a string containing single primary key value in case of non-composite primary key. + Public Shared Function GetKeyValue(ByVal key As Object) As KeyValue + Dim kv As KeyValue = Nothing + + If (Not (IsNothing(ExTraSalaryTable.Instance.TableDefinition.PrimaryKey))) Then + + Dim isCompositePrimaryKey As Boolean = False + isCompositePrimaryKey = ExTraSalaryTable.Instance.TableDefinition.PrimaryKey.IsCompositeKey + + If ((isCompositePrimaryKey) AndAlso (key.GetType.IsArray())) Then + + ' If the key is composite, then construct a key value. + kv = New KeyValue + Dim fullKeyString As String = "" + Dim keyArray As Array = CType(key, Array) + If (Not IsNothing(keyArray)) Then + Dim length As Integer = keyArray.Length + Dim pkColumns As ColumnList = ExTraSalaryTable.Instance.TableDefinition.PrimaryKey.Columns + Dim pkColumn As BaseColumn + Dim index As Integer = 0 + For Each pkColumn In pkColumns + Dim keyString As String = CType(keyArray.GetValue(index), String) + If (ExTraSalaryTable.Instance.TableDefinition.TableType = BaseClasses.Data.TableDefinition.TableTypes.Virtual) Then + kv.AddElement(pkColumn.UniqueName, keyString) + Else + kv.AddElement(pkColumn.InternalName, keyString) + End If + index = index + 1 + Next pkColumn + End If + + Else + ' If the key is not composite, then get the key value. + kv = ExTraSalaryTable.Instance.TableDefinition.PrimaryKey.ParseValue(CType(key, String)) + End If + End If + Return kv + End Function + + + ''' + ''' This method takes a record and a Column and returns an evaluated value of DFKA formula. + ''' + Public Shared Function GetDFKA(ByVal rec As BaseRecord, ByVal col As BaseColumn) As String + Dim fkColumn As ForeignKey = ExTraSalaryTable.Instance.TableDefinition.GetExpandableNonCompositeForeignKey(col) + If fkColumn Is Nothing Then + Return Nothing + End If + Dim _DFKA As String = fkColumn.PrimaryKeyDisplayColumns + If (_DFKA.Trim().StartsWith("=")) Then + ' if the formula is in the format of "= ., then pull out the data from the rec object instead of doing formula evaluation + Dim tableCodeName As String = fkColumn.PrimaryKeyTableDefinition.TableCodeName + Dim column As String = _DFKA.Trim("="c).Trim() + If column.StartsWith(tableCodeName & ".", StringComparison.InvariantCultureIgnoreCase) Then + column = column.Substring(tableCodeName.Length + 1) + End If + + For Each c As BaseColumn In fkColumn.PrimaryKeyTableDefinition.Columns + If column = c.CodeName Then + Return rec.Format(c) + End If + Next + Dim tableName As String = fkColumn.PrimaryKeyTableDefinition.TableCodeName + Return EvaluateFormula(_DFKA, rec, Nothing, tableName) + Else + Return Nothing + End If + End Function + + ''' + ''' This method takes a keyValue and a Column and returns an evaluated value of DFKA formula. + ''' + Public Shared Function GetDFKA(ByVal keyValue As String, ByVal col As BaseColumn, ByVal formatPattern as String) As String + If keyValue Is Nothing Then + Return Nothing + End If + Dim fkColumn As ForeignKey = ExTraSalaryTable.Instance.TableDefinition.GetExpandableNonCompositeForeignKey(col) + If fkColumn Is Nothing Then + Return Nothing + End If + Dim _DFKA As String = fkColumn.PrimaryKeyDisplayColumns + If (_DFKA.Trim().StartsWith("=")) Then + Dim tableName As String = fkColumn.PrimaryKeyTableDefinition.TableCodeName + Dim t As PrimaryKeyTable = CType(DatabaseObjects.GetTableObject(tableName), PrimaryKeyTable) + Dim rec As BaseRecord = Nothing + If Not t Is Nothing Then + Try + rec = CType(t.GetRecordData(keyValue, False), BaseRecord) + Catch + rec = Nothing + End Try + End If + If rec Is Nothing Then + Return "" + End If + + ' if the formula is in the format of "= ., then pull out the data from the rec object instead of doing formula evaluation + Dim tableCodeName As String = fkColumn.PrimaryKeyTableDefinition.TableCodeName + Dim column As String = _DFKA.Trim("="c).Trim() + If column.StartsWith(tableCodeName & ".", StringComparison.InvariantCultureIgnoreCase) Then + column = column.Substring(tableCodeName.Length + 1) + End If + + For Each c As BaseColumn In fkColumn.PrimaryKeyTableDefinition.Columns + If column = c.CodeName Then + Return rec.Format(c) + End If + Next + Return EvaluateFormula(_DFKA, rec, Nothing, tableName) + Else + Return Nothing + End If + End Function + + ''' + ''' Evaluates the formula + ''' + Public Shared Function EvaluateFormula(ByVal formula As String, Optional ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord = Nothing, Optional ByVal format As String = Nothing, Optional ByVal name As String = "") As String + Dim e As BaseFormulaEvaluator = New BaseFormulaEvaluator() + If Not dataSourceForEvaluate Is Nothing Then + e.Evaluator.Variables.Add(name, dataSourceForEvaluate) + end if + e.DataSource = dataSourceForEvaluate + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + If Not String.IsNullOrEmpty(format) Then + Return BaseFormulaUtils.Format(resultObj, format) + Else + Return resultObj.ToString() + End If + End Function + + +#End Region + +End Class +End Namespace diff --git a/App_Code/Business Layer/BaseInsigniaRecord.vb b/App_Code/Business Layer/BaseInsigniaRecord.vb new file mode 100644 index 0000000..98c30a3 --- /dev/null +++ b/App_Code/Business Layer/BaseInsigniaRecord.vb @@ -0,0 +1,347 @@ +' This class is "generated" and will be overwritten. +' Your customizations should be made in InsigniaRecord.vb + +Imports System.Data.SqlTypes +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + +Namespace Persons.Business + +''' +''' The generated superclass for the class. +''' +''' +''' This class is not intended to be instantiated directly. To obtain an instance of this class, +''' use the methods of the class. +''' +''' +''' + + Public Class BaseInsigniaRecord + Inherits PrimaryKeyRecord + + + Public Shared Shadows ReadOnly TableUtils As InsigniaTable = InsigniaTable.Instance + + ' Constructors + + Protected Sub New() + MyBase.New(TableUtils) + End Sub + + Protected Sub New(ByVal record As PrimaryKeyRecord) + MyBase.New(record, TableUtils) + End Sub + + 'Evaluates Initialize when->Inserting record formulas specified at the data access layer + Public Overridable Sub InsigniaRecord_InsertingRecord(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles Me.InsertingRecord + 'Apply Initialize->Inserting record formula only if validation is successful. + Dim InsigniaRec As InsigniaRecord = CType(sender,InsigniaRecord) + Validate_Inserting() + If Not InsigniaRec Is Nothing AndAlso Not InsigniaRec.IsReadOnly Then + End If + End Sub + + 'Evaluates Initialize when->Updating record formulas specified at the data access layer + Public Overridable Sub InsigniaRecord_UpdatingRecord(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles Me.UpdatingRecord + 'Apply Initialize->Updating record formula only if validation is successful. + Dim InsigniaRec As InsigniaRecord = CType(sender,InsigniaRecord) + Validate_Updating() + If Not InsigniaRec Is Nothing AndAlso Not InsigniaRec.IsReadOnly Then + End If + End Sub + + 'Evaluates Initialize when->Reading record formulas specified at the data access layer + Public Overridable Sub InsigniaRecord_ReadRecord(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.ReadRecord + 'Apply Initialize->Reading record formula only if validation is successful. + Dim InsigniaRec As InsigniaRecord = CType(sender,InsigniaRecord) + If Not InsigniaRec Is Nothing AndAlso Not InsigniaRec.IsReadOnly Then + End If + End Sub + + 'Evaluates Validate when->Inserting formulas specified at the data access layer + Public Overridable Sub Validate_Inserting () + Dim fullValidationMessage As String = "" + Dim validationMessage As String = "" + + dim formula as String = "" + + + If validationMessage <> "" AndAlso validationMessage.ToLower() <> "true" Then + fullValidationMessage &= validationMessage & vbCrLf + End If + + If fullValidationMessage <> "" Then + Throw New Exception(fullValidationMessage) + End If + End Sub + + 'Evaluates Validate when->Updating formulas specified at the data access layer + Public Overridable Sub Validate_Updating () + Dim fullValidationMessage As String = "" + Dim validationMessage As String = "" + + dim formula as String = "" + + + If validationMessage <> "" AndAlso validationMessage.ToLower() <> "true" Then + fullValidationMessage &= validationMessage & vbCrLf + End If + + If fullValidationMessage <> "" Then + Throw New Exception(fullValidationMessage) + End If + End Sub + + Public Overridable Function EvaluateFormula(ByVal formula As String, Optional ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord = Nothing, Optional ByVal format As String = Nothing) As String + + Dim e As Data.BaseFormulaEvaluator = New Data.BaseFormulaEvaluator() + + ' All variables referred to in the formula are expected to be + ' properties of the DataSource. For example, referring to + ' UnitPrice as a variable will refer to DataSource.UnitPrice + e.DataSource = dataSourceForEvaluate + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + Return resultObj.ToString() + End Function + + + + + + + +#Region "Convenience methods to get/set values of fields" + + ''' + ''' This is a convenience method that provides direct access to the value of the record's Insignia_.InsigniaId field. + ''' + Public Function GetInsigniaIdValue() As ColumnValue + Return Me.GetValue(TableUtils.InsigniaIdColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's Insignia_.InsigniaId field. + ''' + Public Function GetInsigniaIdFieldValue() As Int16 + Return CType(Me.GetValue(TableUtils.InsigniaIdColumn).ToInt16(), Int16) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Insignia_.InsigniaId field. + ''' + Public Sub SetInsigniaIdFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.InsigniaIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Insignia_.InsigniaId field. + ''' + Public Sub SetInsigniaIdFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.InsigniaIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Insignia_.InsigniaId field. + ''' + Public Sub SetInsigniaIdFieldValue(ByVal val As Double) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.InsigniaIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Insignia_.InsigniaId field. + ''' + Public Sub SetInsigniaIdFieldValue(ByVal val As Decimal) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.InsigniaIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Insignia_.InsigniaId field. + ''' + Public Sub SetInsigniaIdFieldValue(ByVal val As Int64) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.InsigniaIdColumn) + End Sub + ''' + ''' This is a convenience method that provides direct access to the value of the record's Insignia_.InsigniaAbbr field. + ''' + Public Function GetInsigniaAbbrValue() As ColumnValue + Return Me.GetValue(TableUtils.InsigniaAbbrColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's Insignia_.InsigniaAbbr field. + ''' + Public Function GetInsigniaAbbrFieldValue() As String + Return CType(Me.GetValue(TableUtils.InsigniaAbbrColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Insignia_.InsigniaAbbr field. + ''' + Public Sub SetInsigniaAbbrFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.InsigniaAbbrColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Insignia_.InsigniaAbbr field. + ''' + Public Sub SetInsigniaAbbrFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.InsigniaAbbrColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's Insignia_.InsigniaName field. + ''' + Public Function GetInsigniaNameValue() As ColumnValue + Return Me.GetValue(TableUtils.InsigniaNameColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's Insignia_.InsigniaName field. + ''' + Public Function GetInsigniaNameFieldValue() As String + Return CType(Me.GetValue(TableUtils.InsigniaNameColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Insignia_.InsigniaName field. + ''' + Public Sub SetInsigniaNameFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.InsigniaNameColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Insignia_.InsigniaName field. + ''' + Public Sub SetInsigniaNameFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.InsigniaNameColumn) + End Sub + + + +#End Region + +#Region "Convenience methods to get field names" + + ''' + ''' This is a convenience property that provides direct access to the value of the record's Insignia_.InsigniaId field. + ''' + Public Property InsigniaId() As Int16 + Get + Return CType(Me.GetValue(TableUtils.InsigniaIdColumn).ToInt16(), Int16) + End Get + Set (ByVal val As Int16) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.InsigniaIdColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property InsigniaIdSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.InsigniaIdColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property InsigniaIdDefault() As String + Get + Return TableUtils.InsigniaIdColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's Insignia_.InsigniaAbbr field. + ''' + Public Property InsigniaAbbr() As String + Get + Return CType(Me.GetValue(TableUtils.InsigniaAbbrColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.InsigniaAbbrColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property InsigniaAbbrSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.InsigniaAbbrColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property InsigniaAbbrDefault() As String + Get + Return TableUtils.InsigniaAbbrColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's Insignia_.InsigniaName field. + ''' + Public Property InsigniaName() As String + Get + Return CType(Me.GetValue(TableUtils.InsigniaNameColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.InsigniaNameColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property InsigniaNameSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.InsigniaNameColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property InsigniaNameDefault() As String + Get + Return TableUtils.InsigniaNameColumn.DefaultValue + End Get + End Property + + + +#End Region + +End Class +End Namespace diff --git a/App_Code/Business Layer/BaseInsigniaTable.vb b/App_Code/Business Layer/BaseInsigniaTable.vb new file mode 100644 index 0000000..48a5c3a --- /dev/null +++ b/App_Code/Business Layer/BaseInsigniaTable.vb @@ -0,0 +1,800 @@ +' This class is "generated" and will be overwritten. +' Your customizations should be made in InsigniaRecord.vb + +Imports System.Data.SqlTypes +Imports System.Data +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider +Imports Persons.Data + +Namespace Persons.Business + +''' +''' The generated superclass for the class. +''' Provides access to the schema information and record data of a database table or view named Insignia. +''' +''' +''' The connection details (name, location, etc.) of the database and table (or view) accessed by this class +''' are resolved at runtime based on the connection string in the application's Web.Config file. +''' +''' This class is not intended to be instantiated directly. To obtain an instance of this class, use +''' InsigniaTable.Instance. +''' +''' +''' + + Public Class BaseInsigniaTable + Inherits PrimaryKeyTable + + + Private ReadOnly TableDefinitionString As String = InsigniaDefinition.GetXMLString() + + + + + + + + Protected Sub New() + MyBase.New() + Me.Initialize() + End Sub + + Protected Overridable Sub Initialize() + Dim def As New XmlTableDefinition(TableDefinitionString) + Me.TableDefinition = New TableDefinition() + Me.TableDefinition.TableClassName = System.Reflection.Assembly.CreateQualifiedName("App_Code", "Persons.Business.InsigniaTable") + def.InitializeTableDefinition(Me.TableDefinition) + Me.ConnectionName = def.GetConnectionName() + Me.RecordClassName = System.Reflection.Assembly.CreateQualifiedName("App_Code", "Persons.Business.InsigniaRecord") + Me.ApplicationName = "App_Code" + Me.DataAdapter = New InsigniaSqlTable() + Directcast(Me.DataAdapter, InsigniaSqlTable).ConnectionName = Me.ConnectionName + + Me.TableDefinition.AdapterMetaData = Me.DataAdapter.AdapterMetaData + InsigniaIdColumn.CodeName = "InsigniaId" + InsigniaAbbrColumn.CodeName = "InsigniaAbbr" + InsigniaNameColumn.CodeName = "InsigniaName" + + End Sub + +#Region "Overriden methods" + + +#End Region + +#Region "Properties for columns" + + ''' + ''' This is a convenience property that provides direct access to the table's Insignia_.InsigniaId column object. + ''' + Public ReadOnly Property InsigniaIdColumn() As BaseClasses.Data.NumberColumn + Get + Return CType(Me.TableDefinition.ColumnList(0), BaseClasses.Data.NumberColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's Insignia_.InsigniaId column object. + ''' + Public Shared ReadOnly Property InsigniaId() As BaseClasses.Data.NumberColumn + Get + Return InsigniaTable.Instance.InsigniaIdColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's Insignia_.InsigniaAbbr column object. + ''' + Public ReadOnly Property InsigniaAbbrColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(1), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's Insignia_.InsigniaAbbr column object. + ''' + Public Shared ReadOnly Property InsigniaAbbr() As BaseClasses.Data.StringColumn + Get + Return InsigniaTable.Instance.InsigniaAbbrColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's Insignia_.InsigniaName column object. + ''' + Public ReadOnly Property InsigniaNameColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(2), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's Insignia_.InsigniaName column object. + ''' + Public Shared ReadOnly Property InsigniaName() As BaseClasses.Data.StringColumn + Get + Return InsigniaTable.Instance.InsigniaNameColumn + End Get + End Property + + +#End Region + + +#Region "Shared helper methods" + + ''' + ''' This is a shared function that can be used to get an array of InsigniaRecord records using a where clause. + ''' + Public Shared Function GetRecords(ByVal where As String) As InsigniaRecord() + + Return GetRecords(where, Nothing, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) + End Function + + ''' + ''' This is a shared function that can be used to get an array of InsigniaRecord records using a where clause. + ''' + Public Shared Function GetRecords(ByVal join As BaseFilter, ByVal where As String) As InsigniaRecord() + + Return GetRecords(join, where, Nothing, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) + End Function + + ''' + ''' This is a shared function that can be used to get an array of InsigniaRecord records using a where and order by clause. + ''' + Public Shared Function GetRecords( _ + ByVal where As String, _ + ByVal orderBy As OrderBy) As InsigniaRecord() + + Return GetRecords(where, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) + End Function + + ''' + ''' This is a shared function that can be used to get an array of InsigniaRecord records using a where and order by clause. + ''' + Public Shared Function GetRecords( _ + ByVal join As BaseFilter, _ + ByVal where As String, _ + ByVal orderBy As OrderBy) As InsigniaRecord() + + Return GetRecords(join, where, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) + End Function + + ''' + ''' This is a shared function that can be used to get an array of InsigniaRecord records using a where and order by clause clause with pagination. + ''' + Public Shared Function GetRecords( _ + ByVal where As String, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As InsigniaRecord() + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + Dim join As BaseClasses.Data.BaseFilter = Nothing + Dim recList As ArrayList = InsigniaTable.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, pageIndex, pageSize) + + Return CType(recList.ToArray(GetType(Persons.Business.InsigniaRecord)), InsigniaRecord()) + End Function + + ''' + ''' This is a shared function that can be used to get an array of InsigniaRecord records using a where and order by clause clause with pagination. + ''' + Public Shared Function GetRecords( _ + ByVal join As BaseFilter, _ + ByVal where As String, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As InsigniaRecord() + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Dim recList As ArrayList = InsigniaTable.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, pageIndex, pageSize) + + Return CType(recList.ToArray(GetType(Persons.Business.InsigniaRecord)), InsigniaRecord()) + End Function + + Public Shared Function GetRecords( _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As InsigniaRecord() + Dim join As BaseClasses.Data.BaseFilter = Nothing + Dim recList As ArrayList = InsigniaTable.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + Return CType(recList.ToArray(GetType(Persons.Business.InsigniaRecord)), InsigniaRecord()) + End Function + + Public Shared Function GetRecords( _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As InsigniaRecord() + + Dim recList As ArrayList = InsigniaTable.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + Return CType(recList.ToArray(GetType(Persons.Business.InsigniaRecord)), InsigniaRecord()) + End Function + + Public Shared Function GetRecords( _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer, _ + ByRef totalRecords As Integer) As InsigniaRecord() + Dim join As BaseClasses.Data.BaseFilter = Nothing + Dim recList As ArrayList = InsigniaTable.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize, totalRecords) + + Return CType(recList.ToArray(GetType(Persons.Business.InsigniaRecord)), InsigniaRecord()) + End Function + + Public Shared Function GetRecords( _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer, _ + ByRef totalRecords As Integer) As InsigniaRecord() + + Dim recList As ArrayList = InsigniaTable.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize, totalRecords) + + Return CType(recList.ToArray(GetType(Persons.Business.InsigniaRecord)), InsigniaRecord()) + End Function + + ''' + ''' This is a shared function that can be used to get total number of records that will be returned using the where clause. + ''' + Public Shared Function GetRecordCount(ByVal where As String) As Integer + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Return CInt(InsigniaTable.Instance.GetRecordListCount(Nothing, whereFilter, Nothing, Nothing)) + End Function + +''' + ''' This is a shared function that can be used to get total number of records that will be returned using the where clause. + ''' + Public Shared Function GetRecordCount(ByVal join As BaseFilter, ByVal where As String) As Integer + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Return CInt(InsigniaTable.Instance.GetRecordListCount(join, whereFilter, Nothing, Nothing)) + End Function + + Public Shared Function GetRecordCount(ByVal where As WhereClause) As Integer + Return CInt(InsigniaTable.Instance.GetRecordListCount(Nothing, where.GetFilter(), Nothing, Nothing)) + End Function + + Public Shared Function GetRecordCount(ByVal join As BaseFilter, ByVal where As WhereClause) As Integer + Return CInt(InsigniaTable.Instance.GetRecordListCount(join, where.GetFilter(), Nothing, Nothing)) + End Function + + ''' + ''' This is a shared function that can be used to get a InsigniaRecord record using a where clause. + ''' + Public Shared Function GetRecord(ByVal where As String) As InsigniaRecord + Dim orderBy As OrderBy = Nothing + Return GetRecord(where, orderBy) + End Function + + ''' + ''' This is a shared function that can be used to get a InsigniaRecord record using a where clause. + ''' + Public Shared Function GetRecord(ByVal join As BaseFilter, ByVal where As String) As InsigniaRecord + Dim orderBy As OrderBy = Nothing + Return GetRecord(join, where, orderBy) + End Function + + ''' + ''' This is a shared function that can be used to get a InsigniaRecord record using a where and order by clause. + ''' + Public Shared Function GetRecord( _ + ByVal where As String, _ + ByVal orderBy As OrderBy) As InsigniaRecord + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + Dim join As BaseClasses.Data.BaseFilter = Nothing + Dim recList As ArrayList = InsigniaTable.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MIN_BATCH_SIZE) + + Dim rec As InsigniaRecord = Nothing + If recList.Count > 0 Then + rec = CType(recList(0), InsigniaRecord) + End If + + Return rec + End Function + + ''' + ''' This is a shared function that can be used to get a InsigniaRecord record using a where and order by clause. + ''' + Public Shared Function GetRecord( _ + ByVal join As BaseFilter, _ + ByVal where As String, _ + ByVal orderBy As OrderBy) As InsigniaRecord + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Dim recList As ArrayList = InsigniaTable.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MIN_BATCH_SIZE) + + Dim rec As InsigniaRecord = Nothing + If recList.Count > 0 Then + rec = CType(recList(0), InsigniaRecord) + End If + + Return rec + End Function + + + Public Shared Function GetValues( _ + ByVal col As BaseColumn, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal maxItems As Integer) As String() + + ' Create the filter list. + Dim retCol As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, True) + retCol.AddColumn(col) + + Return InsigniaTable.Instance.GetColumnValues(retCol, Nothing, where.GetFilter(), Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, maxItems) + + End Function + + Public Shared Function GetValues( _ + ByVal col As BaseColumn, _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal maxItems As Integer) As String() + + ' Create the filter list. + Dim retCol As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, True) + retCol.AddColumn(col) + + Return InsigniaTable.Instance.GetColumnValues(retCol, join, where.GetFilter(), Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, maxItems) + + End Function + + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where clause. + ''' + Public Shared Function GetDataTable(ByVal where As String) As System.Data.DataTable + + Dim recs() As InsigniaRecord = GetRecords(where) + Return InsigniaTable.Instance.CreateDataTable(recs, Nothing) + End Function + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where clause. + ''' + Public Shared Function GetDataTable(ByVal join As BaseFilter, ByVal where As String) As System.Data.DataTable + + Dim recs() As InsigniaRecord = GetRecords(join, where) + Return InsigniaTable.Instance.CreateDataTable(recs, Nothing) + End Function + + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause. + ''' + Public Shared Function GetDataTable(ByVal where As String, ByVal orderBy As OrderBy) As System.Data.DataTable + + Dim recs() As InsigniaRecord = GetRecords(where, orderBy) + Return InsigniaTable.Instance.CreateDataTable(recs, Nothing) + End Function + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause. + ''' + Public Shared Function GetDataTable(ByVal join As BaseFilter, ByVal where As String, ByVal orderBy As OrderBy) As System.Data.DataTable + + Dim recs() As InsigniaRecord = GetRecords(join, where, orderBy) + Return InsigniaTable.Instance.CreateDataTable(recs, Nothing) + End Function + + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause with pagination. + ''' + Public Shared Function GetDataTable( _ + ByVal where As String, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As System.Data.DataTable + + Dim recs() As InsigniaRecord = GetRecords(where, orderBy, pageIndex, pageSize) + Return InsigniaTable.Instance.CreateDataTable(recs, Nothing) + End Function + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause with pagination. + ''' + Public Shared Function GetDataTable( _ + ByVal join As BaseFilter, _ + ByVal where As String, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As System.Data.DataTable + + Dim recs() As InsigniaRecord = GetRecords(join, where, orderBy, pageIndex, pageSize) + Return InsigniaTable.Instance.CreateDataTable(recs, Nothing) + End Function + + + ''' + ''' This is a shared function that can be used to delete records using a where clause. + ''' + Public Shared Sub DeleteRecords(ByVal where As String) + If where = Nothing OrElse where.Trim() = "" Then + Return + End If + + Dim whereFilter As SqlFilter = New SqlFilter(where) + InsigniaTable.Instance.DeleteRecordList(whereFilter) + End Sub + + ''' + ''' This is a shared function that can be used to export records using a where clause. + ''' + Public Shared Function Export(ByVal where As String) As String + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Return InsigniaTable.Instance.ExportRecordData(whereFilter) + End Function + + Public Shared Function Export(ByVal where As WhereClause) As String + Dim whereFilter As BaseFilter = Nothing + If Not where Is Nothing Then + whereFilter = where.GetFilter() + End If + + Return InsigniaTable.Instance.ExportRecordData(whereFilter) + End Function + + Public Shared Function GetSum( _ + ByVal col As BaseColumn, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) _ + As String + + Dim colSel As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, False) + colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Sum) + + Return InsigniaTable.Instance.GetColumnStatistics(colSel, Nothing, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + End Function + + Public Shared Function GetSum( _ + ByVal col As BaseColumn, _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) _ + As String + + Dim colSel As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, False) + colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Sum) + + Return InsigniaTable.Instance.GetColumnStatistics(colSel, join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + End Function + + + Public Shared Function GetCount( _ + ByVal col As BaseColumn, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) _ + As String + + Dim colSel As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, False) + colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Count) + + Return InsigniaTable.Instance.GetColumnStatistics(colSel, Nothing, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + End Function + + Public Shared Function GetCount( _ + ByVal col As BaseColumn, _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) _ + As String + + Dim colSel As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, False) + colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Count) + + Return InsigniaTable.Instance.GetColumnStatistics(colSel, join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + End Function + + ''' + ''' This method returns the columns in the table. + ''' + Public Shared Function GetColumns() As BaseColumn() + Return InsigniaTable.Instance.TableDefinition.Columns + End Function + + ''' + ''' This method returns the columnlist in the table. + ''' + Public Shared Function GetColumnList() As ColumnList + Return InsigniaTable.Instance.TableDefinition.ColumnList + End Function + + + ''' + ''' This method creates a new record and returns it to be edited. + ''' + Public Shared Function CreateNewRecord() As IRecord + Return InsigniaTable.Instance.CreateRecord() + End Function + + ''' + ''' This method creates a new record and returns it to be edited. + ''' + ''' ID of the new record. + Public Shared Function CreateNewRecord(ByVal tempId As String) As IRecord + Return InsigniaTable.Instance.CreateRecord(tempId) + End Function + + ''' + ''' This method checks if column is editable. + ''' + ''' Name of the column to check. + Public Shared Function isReadOnlyColumn(ByVal columnName As String) As Boolean + Dim column As BaseColumn = GetColumn(columnName) + If (Not IsNothing(column)) Then + Return column.IsValuesReadOnly + Else + Return True + End If + End Function + + ''' + ''' This method gets the specified column. + ''' + ''' Unique name of the column to fetch. + Public Shared Function GetColumn(ByVal uniqueColumnName As String) As BaseColumn + Dim column As BaseColumn = InsigniaTable.Instance.TableDefinition.ColumnList.GetByUniqueName(uniqueColumnName) + Return column + End Function + + ' Convenience method for getting a record using a string-based record identifier + Public Shared Function GetRecord(ByVal id As String, ByVal bMutable As Boolean) As InsigniaRecord + Return CType(InsigniaTable.Instance.GetRecordData(id, bMutable), InsigniaRecord) + End Function + + ' Convenience method for getting a record using a KeyValue record identifier + Public Shared Function GetRecord(ByVal id As KeyValue, ByVal bMutable As Boolean) As InsigniaRecord + Return CType(InsigniaTable.Instance.GetRecordData(id, bMutable), InsigniaRecord) + End Function + + ' Convenience method for creating a record + Public Overloads Function NewRecord( _ + ByVal InsigniaIdValue As String, _ + ByVal InsigniaAbbrValue As String, _ + ByVal InsigniaNameValue As String _ + ) As KeyValue + Dim rec As IPrimaryKeyRecord = CType(Me.CreateRecord(), IPrimaryKeyRecord) + rec.SetString(InsigniaIdValue, InsigniaIdColumn) + rec.SetString(InsigniaAbbrValue, InsigniaAbbrColumn) + rec.SetString(InsigniaNameValue, InsigniaNameColumn) + + + rec.Create() 'update the DB so any DB-initialized fields (like autoincrement IDs) can be initialized + + Dim key As KeyValue = rec.GetID() + Return key + End Function + + ''' + ''' This method deletes a specified record + ''' + ''' Keyvalue of the record to be deleted. + Public Shared Sub DeleteRecord(ByVal kv As KeyValue) + InsigniaTable.Instance.DeleteOneRecord(kv) + End Sub + + ''' + ''' This method checks if record exist in the database using the keyvalue provided. + ''' + ''' Key value of the record. + Public Shared Function DoesRecordExist(ByVal kv As KeyValue) As Boolean + Dim recordExist As Boolean = True + Try + InsigniaTable.GetRecord(kv, False) + Catch ex As Exception + recordExist = False + End Try + Return recordExist + End Function + + ''' + ''' This method returns all the primary columns in the table. + ''' + Public Shared Function GetPrimaryKeyColumns() As ColumnList + If (Not IsNothing(InsigniaTable.Instance.TableDefinition.PrimaryKey)) Then + Return InsigniaTable.Instance.TableDefinition.PrimaryKey.Columns + Else + Return Nothing + End If + End Function + + ''' + ''' This method takes a key and returns a keyvalue. + ''' + ''' key could be array of primary key values in case of composite primary key or a string containing single primary key value in case of non-composite primary key. + Public Shared Function GetKeyValue(ByVal key As Object) As KeyValue + Dim kv As KeyValue = Nothing + + If (Not (IsNothing(InsigniaTable.Instance.TableDefinition.PrimaryKey))) Then + + Dim isCompositePrimaryKey As Boolean = False + isCompositePrimaryKey = InsigniaTable.Instance.TableDefinition.PrimaryKey.IsCompositeKey + + If ((isCompositePrimaryKey) AndAlso (key.GetType.IsArray())) Then + + ' If the key is composite, then construct a key value. + kv = New KeyValue + Dim fullKeyString As String = "" + Dim keyArray As Array = CType(key, Array) + If (Not IsNothing(keyArray)) Then + Dim length As Integer = keyArray.Length + Dim pkColumns As ColumnList = InsigniaTable.Instance.TableDefinition.PrimaryKey.Columns + Dim pkColumn As BaseColumn + Dim index As Integer = 0 + For Each pkColumn In pkColumns + Dim keyString As String = CType(keyArray.GetValue(index), String) + If (InsigniaTable.Instance.TableDefinition.TableType = BaseClasses.Data.TableDefinition.TableTypes.Virtual) Then + kv.AddElement(pkColumn.UniqueName, keyString) + Else + kv.AddElement(pkColumn.InternalName, keyString) + End If + index = index + 1 + Next pkColumn + End If + + Else + ' If the key is not composite, then get the key value. + kv = InsigniaTable.Instance.TableDefinition.PrimaryKey.ParseValue(CType(key, String)) + End If + End If + Return kv + End Function + + + ''' + ''' This method takes a record and a Column and returns an evaluated value of DFKA formula. + ''' + Public Shared Function GetDFKA(ByVal rec As BaseRecord, ByVal col As BaseColumn) As String + Dim fkColumn As ForeignKey = InsigniaTable.Instance.TableDefinition.GetExpandableNonCompositeForeignKey(col) + If fkColumn Is Nothing Then + Return Nothing + End If + Dim _DFKA As String = fkColumn.PrimaryKeyDisplayColumns + If (_DFKA.Trim().StartsWith("=")) Then + ' if the formula is in the format of "= ., then pull out the data from the rec object instead of doing formula evaluation + Dim tableCodeName As String = fkColumn.PrimaryKeyTableDefinition.TableCodeName + Dim column As String = _DFKA.Trim("="c).Trim() + If column.StartsWith(tableCodeName & ".", StringComparison.InvariantCultureIgnoreCase) Then + column = column.Substring(tableCodeName.Length + 1) + End If + + For Each c As BaseColumn In fkColumn.PrimaryKeyTableDefinition.Columns + If column = c.CodeName Then + Return rec.Format(c) + End If + Next + Dim tableName As String = fkColumn.PrimaryKeyTableDefinition.TableCodeName + Return EvaluateFormula(_DFKA, rec, Nothing, tableName) + Else + Return Nothing + End If + End Function + + ''' + ''' This method takes a keyValue and a Column and returns an evaluated value of DFKA formula. + ''' + Public Shared Function GetDFKA(ByVal keyValue As String, ByVal col As BaseColumn, ByVal formatPattern as String) As String + If keyValue Is Nothing Then + Return Nothing + End If + Dim fkColumn As ForeignKey = InsigniaTable.Instance.TableDefinition.GetExpandableNonCompositeForeignKey(col) + If fkColumn Is Nothing Then + Return Nothing + End If + Dim _DFKA As String = fkColumn.PrimaryKeyDisplayColumns + If (_DFKA.Trim().StartsWith("=")) Then + Dim tableName As String = fkColumn.PrimaryKeyTableDefinition.TableCodeName + Dim t As PrimaryKeyTable = CType(DatabaseObjects.GetTableObject(tableName), PrimaryKeyTable) + Dim rec As BaseRecord = Nothing + If Not t Is Nothing Then + Try + rec = CType(t.GetRecordData(keyValue, False), BaseRecord) + Catch + rec = Nothing + End Try + End If + If rec Is Nothing Then + Return "" + End If + + ' if the formula is in the format of "= ., then pull out the data from the rec object instead of doing formula evaluation + Dim tableCodeName As String = fkColumn.PrimaryKeyTableDefinition.TableCodeName + Dim column As String = _DFKA.Trim("="c).Trim() + If column.StartsWith(tableCodeName & ".", StringComparison.InvariantCultureIgnoreCase) Then + column = column.Substring(tableCodeName.Length + 1) + End If + + For Each c As BaseColumn In fkColumn.PrimaryKeyTableDefinition.Columns + If column = c.CodeName Then + Return rec.Format(c) + End If + Next + Return EvaluateFormula(_DFKA, rec, Nothing, tableName) + Else + Return Nothing + End If + End Function + + ''' + ''' Evaluates the formula + ''' + Public Shared Function EvaluateFormula(ByVal formula As String, Optional ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord = Nothing, Optional ByVal format As String = Nothing, Optional ByVal name As String = "") As String + Dim e As BaseFormulaEvaluator = New BaseFormulaEvaluator() + If Not dataSourceForEvaluate Is Nothing Then + e.Evaluator.Variables.Add(name, dataSourceForEvaluate) + end if + e.DataSource = dataSourceForEvaluate + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + If Not String.IsNullOrEmpty(format) Then + Return BaseFormulaUtils.Format(resultObj, format) + Else + Return resultObj.ToString() + End If + End Function + + +#End Region + +End Class +End Namespace diff --git a/App_Code/Business Layer/BaseLanguageRecord.vb b/App_Code/Business Layer/BaseLanguageRecord.vb new file mode 100644 index 0000000..a92ac58 --- /dev/null +++ b/App_Code/Business Layer/BaseLanguageRecord.vb @@ -0,0 +1,283 @@ +' This class is "generated" and will be overwritten. +' Your customizations should be made in LanguageRecord.vb + +Imports System.Data.SqlTypes +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + +Namespace Persons.Business + +''' +''' The generated superclass for the class. +''' +''' +''' This class is not intended to be instantiated directly. To obtain an instance of this class, +''' use the methods of the class. +''' +''' +''' + + Public Class BaseLanguageRecord + Inherits PrimaryKeyRecord + + + Public Shared Shadows ReadOnly TableUtils As LanguageTable = LanguageTable.Instance + + ' Constructors + + Protected Sub New() + MyBase.New(TableUtils) + End Sub + + Protected Sub New(ByVal record As PrimaryKeyRecord) + MyBase.New(record, TableUtils) + End Sub + + 'Evaluates Initialize when->Inserting record formulas specified at the data access layer + Public Overridable Sub LanguageRecord_InsertingRecord(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles Me.InsertingRecord + 'Apply Initialize->Inserting record formula only if validation is successful. + Dim LanguageRec As LanguageRecord = CType(sender,LanguageRecord) + Validate_Inserting() + If Not LanguageRec Is Nothing AndAlso Not LanguageRec.IsReadOnly Then + End If + End Sub + + 'Evaluates Initialize when->Updating record formulas specified at the data access layer + Public Overridable Sub LanguageRecord_UpdatingRecord(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles Me.UpdatingRecord + 'Apply Initialize->Updating record formula only if validation is successful. + Dim LanguageRec As LanguageRecord = CType(sender,LanguageRecord) + Validate_Updating() + If Not LanguageRec Is Nothing AndAlso Not LanguageRec.IsReadOnly Then + End If + End Sub + + 'Evaluates Initialize when->Reading record formulas specified at the data access layer + Public Overridable Sub LanguageRecord_ReadRecord(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.ReadRecord + 'Apply Initialize->Reading record formula only if validation is successful. + Dim LanguageRec As LanguageRecord = CType(sender,LanguageRecord) + If Not LanguageRec Is Nothing AndAlso Not LanguageRec.IsReadOnly Then + End If + End Sub + + 'Evaluates Validate when->Inserting formulas specified at the data access layer + Public Overridable Sub Validate_Inserting () + Dim fullValidationMessage As String = "" + Dim validationMessage As String = "" + + dim formula as String = "" + + + If validationMessage <> "" AndAlso validationMessage.ToLower() <> "true" Then + fullValidationMessage &= validationMessage & vbCrLf + End If + + If fullValidationMessage <> "" Then + Throw New Exception(fullValidationMessage) + End If + End Sub + + 'Evaluates Validate when->Updating formulas specified at the data access layer + Public Overridable Sub Validate_Updating () + Dim fullValidationMessage As String = "" + Dim validationMessage As String = "" + + dim formula as String = "" + + + If validationMessage <> "" AndAlso validationMessage.ToLower() <> "true" Then + fullValidationMessage &= validationMessage & vbCrLf + End If + + If fullValidationMessage <> "" Then + Throw New Exception(fullValidationMessage) + End If + End Sub + + Public Overridable Function EvaluateFormula(ByVal formula As String, Optional ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord = Nothing, Optional ByVal format As String = Nothing) As String + + Dim e As Data.BaseFormulaEvaluator = New Data.BaseFormulaEvaluator() + + ' All variables referred to in the formula are expected to be + ' properties of the DataSource. For example, referring to + ' UnitPrice as a variable will refer to DataSource.UnitPrice + e.DataSource = dataSourceForEvaluate + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + Return resultObj.ToString() + End Function + + + + + + + +#Region "Convenience methods to get/set values of fields" + + ''' + ''' This is a convenience method that provides direct access to the value of the record's Language_.LanguageId field. + ''' + Public Function GetLanguageIdValue() As ColumnValue + Return Me.GetValue(TableUtils.LanguageIdColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's Language_.LanguageId field. + ''' + Public Function GetLanguageIdFieldValue() As Int32 + Return CType(Me.GetValue(TableUtils.LanguageIdColumn).ToInt32(), Int32) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Language_.LanguageId field. + ''' + Public Sub SetLanguageIdFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.LanguageIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Language_.LanguageId field. + ''' + Public Sub SetLanguageIdFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.LanguageIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Language_.LanguageId field. + ''' + Public Sub SetLanguageIdFieldValue(ByVal val As Double) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.LanguageIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Language_.LanguageId field. + ''' + Public Sub SetLanguageIdFieldValue(ByVal val As Decimal) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.LanguageIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Language_.LanguageId field. + ''' + Public Sub SetLanguageIdFieldValue(ByVal val As Int64) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.LanguageIdColumn) + End Sub + ''' + ''' This is a convenience method that provides direct access to the value of the record's Language_.Language field. + ''' + Public Function GetLanguage0Value() As ColumnValue + Return Me.GetValue(TableUtils.Language0Column) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's Language_.Language field. + ''' + Public Function GetLanguage0FieldValue() As String + Return CType(Me.GetValue(TableUtils.Language0Column).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Language_.Language field. + ''' + Public Sub SetLanguage0FieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.Language0Column) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Language_.Language field. + ''' + Public Sub SetLanguage0FieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.Language0Column) + End Sub + + + +#End Region + +#Region "Convenience methods to get field names" + + ''' + ''' This is a convenience property that provides direct access to the value of the record's Language_.LanguageId field. + ''' + Public Property LanguageId() As Int32 + Get + Return CType(Me.GetValue(TableUtils.LanguageIdColumn).ToInt32(), Int32) + End Get + Set (ByVal val As Int32) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.LanguageIdColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property LanguageIdSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.LanguageIdColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property LanguageIdDefault() As String + Get + Return TableUtils.LanguageIdColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's Language_.Language field. + ''' + Public Property Language0() As String + Get + Return CType(Me.GetValue(TableUtils.Language0Column).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.Language0Column) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property Language0Specified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.Language0Column) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property Language0Default() As String + Get + Return TableUtils.Language0Column.DefaultValue + End Get + End Property + + + +#End Region + +End Class +End Namespace diff --git a/App_Code/Business Layer/BaseLanguageTable.vb b/App_Code/Business Layer/BaseLanguageTable.vb new file mode 100644 index 0000000..0a902f9 --- /dev/null +++ b/App_Code/Business Layer/BaseLanguageTable.vb @@ -0,0 +1,778 @@ +' This class is "generated" and will be overwritten. +' Your customizations should be made in LanguageRecord.vb + +Imports System.Data.SqlTypes +Imports System.Data +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider +Imports Persons.Data + +Namespace Persons.Business + +''' +''' The generated superclass for the class. +''' Provides access to the schema information and record data of a database table or view named Language. +''' +''' +''' The connection details (name, location, etc.) of the database and table (or view) accessed by this class +''' are resolved at runtime based on the connection string in the application's Web.Config file. +''' +''' This class is not intended to be instantiated directly. To obtain an instance of this class, use +''' LanguageTable.Instance. +''' +''' +''' + + Public Class BaseLanguageTable + Inherits PrimaryKeyTable + + + Private ReadOnly TableDefinitionString As String = LanguageDefinition.GetXMLString() + + + + + + + + Protected Sub New() + MyBase.New() + Me.Initialize() + End Sub + + Protected Overridable Sub Initialize() + Dim def As New XmlTableDefinition(TableDefinitionString) + Me.TableDefinition = New TableDefinition() + Me.TableDefinition.TableClassName = System.Reflection.Assembly.CreateQualifiedName("App_Code", "Persons.Business.LanguageTable") + def.InitializeTableDefinition(Me.TableDefinition) + Me.ConnectionName = def.GetConnectionName() + Me.RecordClassName = System.Reflection.Assembly.CreateQualifiedName("App_Code", "Persons.Business.LanguageRecord") + Me.ApplicationName = "App_Code" + Me.DataAdapter = New LanguageSqlTable() + Directcast(Me.DataAdapter, LanguageSqlTable).ConnectionName = Me.ConnectionName + + Me.TableDefinition.AdapterMetaData = Me.DataAdapter.AdapterMetaData + LanguageIdColumn.CodeName = "LanguageId" + Language0Column.CodeName = "Language0" + + End Sub + +#Region "Overriden methods" + + +#End Region + +#Region "Properties for columns" + + ''' + ''' This is a convenience property that provides direct access to the table's Language_.LanguageId column object. + ''' + Public ReadOnly Property LanguageIdColumn() As BaseClasses.Data.NumberColumn + Get + Return CType(Me.TableDefinition.ColumnList(0), BaseClasses.Data.NumberColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's Language_.LanguageId column object. + ''' + Public Shared ReadOnly Property LanguageId() As BaseClasses.Data.NumberColumn + Get + Return LanguageTable.Instance.LanguageIdColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's Language_.Language column object. + ''' + Public ReadOnly Property Language0Column() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(1), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's Language_.Language column object. + ''' + Public Shared ReadOnly Property Language0() As BaseClasses.Data.StringColumn + Get + Return LanguageTable.Instance.Language0Column + End Get + End Property + + +#End Region + + +#Region "Shared helper methods" + + ''' + ''' This is a shared function that can be used to get an array of LanguageRecord records using a where clause. + ''' + Public Shared Function GetRecords(ByVal where As String) As LanguageRecord() + + Return GetRecords(where, Nothing, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) + End Function + + ''' + ''' This is a shared function that can be used to get an array of LanguageRecord records using a where clause. + ''' + Public Shared Function GetRecords(ByVal join As BaseFilter, ByVal where As String) As LanguageRecord() + + Return GetRecords(join, where, Nothing, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) + End Function + + ''' + ''' This is a shared function that can be used to get an array of LanguageRecord records using a where and order by clause. + ''' + Public Shared Function GetRecords( _ + ByVal where As String, _ + ByVal orderBy As OrderBy) As LanguageRecord() + + Return GetRecords(where, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) + End Function + + ''' + ''' This is a shared function that can be used to get an array of LanguageRecord records using a where and order by clause. + ''' + Public Shared Function GetRecords( _ + ByVal join As BaseFilter, _ + ByVal where As String, _ + ByVal orderBy As OrderBy) As LanguageRecord() + + Return GetRecords(join, where, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) + End Function + + ''' + ''' This is a shared function that can be used to get an array of LanguageRecord records using a where and order by clause clause with pagination. + ''' + Public Shared Function GetRecords( _ + ByVal where As String, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As LanguageRecord() + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + Dim join As BaseClasses.Data.BaseFilter = Nothing + Dim recList As ArrayList = LanguageTable.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, pageIndex, pageSize) + + Return CType(recList.ToArray(GetType(Persons.Business.LanguageRecord)), LanguageRecord()) + End Function + + ''' + ''' This is a shared function that can be used to get an array of LanguageRecord records using a where and order by clause clause with pagination. + ''' + Public Shared Function GetRecords( _ + ByVal join As BaseFilter, _ + ByVal where As String, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As LanguageRecord() + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Dim recList As ArrayList = LanguageTable.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, pageIndex, pageSize) + + Return CType(recList.ToArray(GetType(Persons.Business.LanguageRecord)), LanguageRecord()) + End Function + + Public Shared Function GetRecords( _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As LanguageRecord() + Dim join As BaseClasses.Data.BaseFilter = Nothing + Dim recList As ArrayList = LanguageTable.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + Return CType(recList.ToArray(GetType(Persons.Business.LanguageRecord)), LanguageRecord()) + End Function + + Public Shared Function GetRecords( _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As LanguageRecord() + + Dim recList As ArrayList = LanguageTable.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + Return CType(recList.ToArray(GetType(Persons.Business.LanguageRecord)), LanguageRecord()) + End Function + + Public Shared Function GetRecords( _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer, _ + ByRef totalRecords As Integer) As LanguageRecord() + Dim join As BaseClasses.Data.BaseFilter = Nothing + Dim recList As ArrayList = LanguageTable.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize, totalRecords) + + Return CType(recList.ToArray(GetType(Persons.Business.LanguageRecord)), LanguageRecord()) + End Function + + Public Shared Function GetRecords( _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer, _ + ByRef totalRecords As Integer) As LanguageRecord() + + Dim recList As ArrayList = LanguageTable.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize, totalRecords) + + Return CType(recList.ToArray(GetType(Persons.Business.LanguageRecord)), LanguageRecord()) + End Function + + ''' + ''' This is a shared function that can be used to get total number of records that will be returned using the where clause. + ''' + Public Shared Function GetRecordCount(ByVal where As String) As Integer + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Return CInt(LanguageTable.Instance.GetRecordListCount(Nothing, whereFilter, Nothing, Nothing)) + End Function + +''' + ''' This is a shared function that can be used to get total number of records that will be returned using the where clause. + ''' + Public Shared Function GetRecordCount(ByVal join As BaseFilter, ByVal where As String) As Integer + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Return CInt(LanguageTable.Instance.GetRecordListCount(join, whereFilter, Nothing, Nothing)) + End Function + + Public Shared Function GetRecordCount(ByVal where As WhereClause) As Integer + Return CInt(LanguageTable.Instance.GetRecordListCount(Nothing, where.GetFilter(), Nothing, Nothing)) + End Function + + Public Shared Function GetRecordCount(ByVal join As BaseFilter, ByVal where As WhereClause) As Integer + Return CInt(LanguageTable.Instance.GetRecordListCount(join, where.GetFilter(), Nothing, Nothing)) + End Function + + ''' + ''' This is a shared function that can be used to get a LanguageRecord record using a where clause. + ''' + Public Shared Function GetRecord(ByVal where As String) As LanguageRecord + Dim orderBy As OrderBy = Nothing + Return GetRecord(where, orderBy) + End Function + + ''' + ''' This is a shared function that can be used to get a LanguageRecord record using a where clause. + ''' + Public Shared Function GetRecord(ByVal join As BaseFilter, ByVal where As String) As LanguageRecord + Dim orderBy As OrderBy = Nothing + Return GetRecord(join, where, orderBy) + End Function + + ''' + ''' This is a shared function that can be used to get a LanguageRecord record using a where and order by clause. + ''' + Public Shared Function GetRecord( _ + ByVal where As String, _ + ByVal orderBy As OrderBy) As LanguageRecord + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + Dim join As BaseClasses.Data.BaseFilter = Nothing + Dim recList As ArrayList = LanguageTable.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MIN_BATCH_SIZE) + + Dim rec As LanguageRecord = Nothing + If recList.Count > 0 Then + rec = CType(recList(0), LanguageRecord) + End If + + Return rec + End Function + + ''' + ''' This is a shared function that can be used to get a LanguageRecord record using a where and order by clause. + ''' + Public Shared Function GetRecord( _ + ByVal join As BaseFilter, _ + ByVal where As String, _ + ByVal orderBy As OrderBy) As LanguageRecord + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Dim recList As ArrayList = LanguageTable.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MIN_BATCH_SIZE) + + Dim rec As LanguageRecord = Nothing + If recList.Count > 0 Then + rec = CType(recList(0), LanguageRecord) + End If + + Return rec + End Function + + + Public Shared Function GetValues( _ + ByVal col As BaseColumn, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal maxItems As Integer) As String() + + ' Create the filter list. + Dim retCol As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, True) + retCol.AddColumn(col) + + Return LanguageTable.Instance.GetColumnValues(retCol, Nothing, where.GetFilter(), Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, maxItems) + + End Function + + Public Shared Function GetValues( _ + ByVal col As BaseColumn, _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal maxItems As Integer) As String() + + ' Create the filter list. + Dim retCol As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, True) + retCol.AddColumn(col) + + Return LanguageTable.Instance.GetColumnValues(retCol, join, where.GetFilter(), Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, maxItems) + + End Function + + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where clause. + ''' + Public Shared Function GetDataTable(ByVal where As String) As System.Data.DataTable + + Dim recs() As LanguageRecord = GetRecords(where) + Return LanguageTable.Instance.CreateDataTable(recs, Nothing) + End Function + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where clause. + ''' + Public Shared Function GetDataTable(ByVal join As BaseFilter, ByVal where As String) As System.Data.DataTable + + Dim recs() As LanguageRecord = GetRecords(join, where) + Return LanguageTable.Instance.CreateDataTable(recs, Nothing) + End Function + + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause. + ''' + Public Shared Function GetDataTable(ByVal where As String, ByVal orderBy As OrderBy) As System.Data.DataTable + + Dim recs() As LanguageRecord = GetRecords(where, orderBy) + Return LanguageTable.Instance.CreateDataTable(recs, Nothing) + End Function + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause. + ''' + Public Shared Function GetDataTable(ByVal join As BaseFilter, ByVal where As String, ByVal orderBy As OrderBy) As System.Data.DataTable + + Dim recs() As LanguageRecord = GetRecords(join, where, orderBy) + Return LanguageTable.Instance.CreateDataTable(recs, Nothing) + End Function + + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause with pagination. + ''' + Public Shared Function GetDataTable( _ + ByVal where As String, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As System.Data.DataTable + + Dim recs() As LanguageRecord = GetRecords(where, orderBy, pageIndex, pageSize) + Return LanguageTable.Instance.CreateDataTable(recs, Nothing) + End Function + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause with pagination. + ''' + Public Shared Function GetDataTable( _ + ByVal join As BaseFilter, _ + ByVal where As String, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As System.Data.DataTable + + Dim recs() As LanguageRecord = GetRecords(join, where, orderBy, pageIndex, pageSize) + Return LanguageTable.Instance.CreateDataTable(recs, Nothing) + End Function + + + ''' + ''' This is a shared function that can be used to delete records using a where clause. + ''' + Public Shared Sub DeleteRecords(ByVal where As String) + If where = Nothing OrElse where.Trim() = "" Then + Return + End If + + Dim whereFilter As SqlFilter = New SqlFilter(where) + LanguageTable.Instance.DeleteRecordList(whereFilter) + End Sub + + ''' + ''' This is a shared function that can be used to export records using a where clause. + ''' + Public Shared Function Export(ByVal where As String) As String + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Return LanguageTable.Instance.ExportRecordData(whereFilter) + End Function + + Public Shared Function Export(ByVal where As WhereClause) As String + Dim whereFilter As BaseFilter = Nothing + If Not where Is Nothing Then + whereFilter = where.GetFilter() + End If + + Return LanguageTable.Instance.ExportRecordData(whereFilter) + End Function + + Public Shared Function GetSum( _ + ByVal col As BaseColumn, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) _ + As String + + Dim colSel As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, False) + colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Sum) + + Return LanguageTable.Instance.GetColumnStatistics(colSel, Nothing, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + End Function + + Public Shared Function GetSum( _ + ByVal col As BaseColumn, _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) _ + As String + + Dim colSel As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, False) + colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Sum) + + Return LanguageTable.Instance.GetColumnStatistics(colSel, join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + End Function + + + Public Shared Function GetCount( _ + ByVal col As BaseColumn, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) _ + As String + + Dim colSel As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, False) + colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Count) + + Return LanguageTable.Instance.GetColumnStatistics(colSel, Nothing, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + End Function + + Public Shared Function GetCount( _ + ByVal col As BaseColumn, _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) _ + As String + + Dim colSel As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, False) + colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Count) + + Return LanguageTable.Instance.GetColumnStatistics(colSel, join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + End Function + + ''' + ''' This method returns the columns in the table. + ''' + Public Shared Function GetColumns() As BaseColumn() + Return LanguageTable.Instance.TableDefinition.Columns + End Function + + ''' + ''' This method returns the columnlist in the table. + ''' + Public Shared Function GetColumnList() As ColumnList + Return LanguageTable.Instance.TableDefinition.ColumnList + End Function + + + ''' + ''' This method creates a new record and returns it to be edited. + ''' + Public Shared Function CreateNewRecord() As IRecord + Return LanguageTable.Instance.CreateRecord() + End Function + + ''' + ''' This method creates a new record and returns it to be edited. + ''' + ''' ID of the new record. + Public Shared Function CreateNewRecord(ByVal tempId As String) As IRecord + Return LanguageTable.Instance.CreateRecord(tempId) + End Function + + ''' + ''' This method checks if column is editable. + ''' + ''' Name of the column to check. + Public Shared Function isReadOnlyColumn(ByVal columnName As String) As Boolean + Dim column As BaseColumn = GetColumn(columnName) + If (Not IsNothing(column)) Then + Return column.IsValuesReadOnly + Else + Return True + End If + End Function + + ''' + ''' This method gets the specified column. + ''' + ''' Unique name of the column to fetch. + Public Shared Function GetColumn(ByVal uniqueColumnName As String) As BaseColumn + Dim column As BaseColumn = LanguageTable.Instance.TableDefinition.ColumnList.GetByUniqueName(uniqueColumnName) + Return column + End Function + + ' Convenience method for getting a record using a string-based record identifier + Public Shared Function GetRecord(ByVal id As String, ByVal bMutable As Boolean) As LanguageRecord + Return CType(LanguageTable.Instance.GetRecordData(id, bMutable), LanguageRecord) + End Function + + ' Convenience method for getting a record using a KeyValue record identifier + Public Shared Function GetRecord(ByVal id As KeyValue, ByVal bMutable As Boolean) As LanguageRecord + Return CType(LanguageTable.Instance.GetRecordData(id, bMutable), LanguageRecord) + End Function + + ' Convenience method for creating a record + Public Overloads Function NewRecord( _ + ByVal LanguageIdValue As String, _ + ByVal Language0Value As String _ + ) As KeyValue + Dim rec As IPrimaryKeyRecord = CType(Me.CreateRecord(), IPrimaryKeyRecord) + rec.SetString(LanguageIdValue, LanguageIdColumn) + rec.SetString(Language0Value, Language0Column) + + + rec.Create() 'update the DB so any DB-initialized fields (like autoincrement IDs) can be initialized + + Dim key As KeyValue = rec.GetID() + Return key + End Function + + ''' + ''' This method deletes a specified record + ''' + ''' Keyvalue of the record to be deleted. + Public Shared Sub DeleteRecord(ByVal kv As KeyValue) + LanguageTable.Instance.DeleteOneRecord(kv) + End Sub + + ''' + ''' This method checks if record exist in the database using the keyvalue provided. + ''' + ''' Key value of the record. + Public Shared Function DoesRecordExist(ByVal kv As KeyValue) As Boolean + Dim recordExist As Boolean = True + Try + LanguageTable.GetRecord(kv, False) + Catch ex As Exception + recordExist = False + End Try + Return recordExist + End Function + + ''' + ''' This method returns all the primary columns in the table. + ''' + Public Shared Function GetPrimaryKeyColumns() As ColumnList + If (Not IsNothing(LanguageTable.Instance.TableDefinition.PrimaryKey)) Then + Return LanguageTable.Instance.TableDefinition.PrimaryKey.Columns + Else + Return Nothing + End If + End Function + + ''' + ''' This method takes a key and returns a keyvalue. + ''' + ''' key could be array of primary key values in case of composite primary key or a string containing single primary key value in case of non-composite primary key. + Public Shared Function GetKeyValue(ByVal key As Object) As KeyValue + Dim kv As KeyValue = Nothing + + If (Not (IsNothing(LanguageTable.Instance.TableDefinition.PrimaryKey))) Then + + Dim isCompositePrimaryKey As Boolean = False + isCompositePrimaryKey = LanguageTable.Instance.TableDefinition.PrimaryKey.IsCompositeKey + + If ((isCompositePrimaryKey) AndAlso (key.GetType.IsArray())) Then + + ' If the key is composite, then construct a key value. + kv = New KeyValue + Dim fullKeyString As String = "" + Dim keyArray As Array = CType(key, Array) + If (Not IsNothing(keyArray)) Then + Dim length As Integer = keyArray.Length + Dim pkColumns As ColumnList = LanguageTable.Instance.TableDefinition.PrimaryKey.Columns + Dim pkColumn As BaseColumn + Dim index As Integer = 0 + For Each pkColumn In pkColumns + Dim keyString As String = CType(keyArray.GetValue(index), String) + If (LanguageTable.Instance.TableDefinition.TableType = BaseClasses.Data.TableDefinition.TableTypes.Virtual) Then + kv.AddElement(pkColumn.UniqueName, keyString) + Else + kv.AddElement(pkColumn.InternalName, keyString) + End If + index = index + 1 + Next pkColumn + End If + + Else + ' If the key is not composite, then get the key value. + kv = LanguageTable.Instance.TableDefinition.PrimaryKey.ParseValue(CType(key, String)) + End If + End If + Return kv + End Function + + + ''' + ''' This method takes a record and a Column and returns an evaluated value of DFKA formula. + ''' + Public Shared Function GetDFKA(ByVal rec As BaseRecord, ByVal col As BaseColumn) As String + Dim fkColumn As ForeignKey = LanguageTable.Instance.TableDefinition.GetExpandableNonCompositeForeignKey(col) + If fkColumn Is Nothing Then + Return Nothing + End If + Dim _DFKA As String = fkColumn.PrimaryKeyDisplayColumns + If (_DFKA.Trim().StartsWith("=")) Then + ' if the formula is in the format of "= ., then pull out the data from the rec object instead of doing formula evaluation + Dim tableCodeName As String = fkColumn.PrimaryKeyTableDefinition.TableCodeName + Dim column As String = _DFKA.Trim("="c).Trim() + If column.StartsWith(tableCodeName & ".", StringComparison.InvariantCultureIgnoreCase) Then + column = column.Substring(tableCodeName.Length + 1) + End If + + For Each c As BaseColumn In fkColumn.PrimaryKeyTableDefinition.Columns + If column = c.CodeName Then + Return rec.Format(c) + End If + Next + Dim tableName As String = fkColumn.PrimaryKeyTableDefinition.TableCodeName + Return EvaluateFormula(_DFKA, rec, Nothing, tableName) + Else + Return Nothing + End If + End Function + + ''' + ''' This method takes a keyValue and a Column and returns an evaluated value of DFKA formula. + ''' + Public Shared Function GetDFKA(ByVal keyValue As String, ByVal col As BaseColumn, ByVal formatPattern as String) As String + If keyValue Is Nothing Then + Return Nothing + End If + Dim fkColumn As ForeignKey = LanguageTable.Instance.TableDefinition.GetExpandableNonCompositeForeignKey(col) + If fkColumn Is Nothing Then + Return Nothing + End If + Dim _DFKA As String = fkColumn.PrimaryKeyDisplayColumns + If (_DFKA.Trim().StartsWith("=")) Then + Dim tableName As String = fkColumn.PrimaryKeyTableDefinition.TableCodeName + Dim t As PrimaryKeyTable = CType(DatabaseObjects.GetTableObject(tableName), PrimaryKeyTable) + Dim rec As BaseRecord = Nothing + If Not t Is Nothing Then + Try + rec = CType(t.GetRecordData(keyValue, False), BaseRecord) + Catch + rec = Nothing + End Try + End If + If rec Is Nothing Then + Return "" + End If + + ' if the formula is in the format of "= ., then pull out the data from the rec object instead of doing formula evaluation + Dim tableCodeName As String = fkColumn.PrimaryKeyTableDefinition.TableCodeName + Dim column As String = _DFKA.Trim("="c).Trim() + If column.StartsWith(tableCodeName & ".", StringComparison.InvariantCultureIgnoreCase) Then + column = column.Substring(tableCodeName.Length + 1) + End If + + For Each c As BaseColumn In fkColumn.PrimaryKeyTableDefinition.Columns + If column = c.CodeName Then + Return rec.Format(c) + End If + Next + Return EvaluateFormula(_DFKA, rec, Nothing, tableName) + Else + Return Nothing + End If + End Function + + ''' + ''' Evaluates the formula + ''' + Public Shared Function EvaluateFormula(ByVal formula As String, Optional ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord = Nothing, Optional ByVal format As String = Nothing, Optional ByVal name As String = "") As String + Dim e As BaseFormulaEvaluator = New BaseFormulaEvaluator() + If Not dataSourceForEvaluate Is Nothing Then + e.Evaluator.Variables.Add(name, dataSourceForEvaluate) + end if + e.DataSource = dataSourceForEvaluate + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + If Not String.IsNullOrEmpty(format) Then + Return BaseFormulaUtils.Format(resultObj, format) + Else + Return resultObj.ToString() + End If + End Function + + +#End Region + +End Class +End Namespace diff --git a/App_Code/Business Layer/BasePersonRelativeRecord.vb b/App_Code/Business Layer/BasePersonRelativeRecord.vb new file mode 100644 index 0000000..9e496bf --- /dev/null +++ b/App_Code/Business Layer/BasePersonRelativeRecord.vb @@ -0,0 +1,1788 @@ +' This class is "generated" and will be overwritten. +' Your customizations should be made in PersonRelativeRecord.vb + +Imports System.Data.SqlTypes +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + +Namespace Persons.Business + +''' +''' The generated superclass for the class. +''' +''' +''' This class is not intended to be instantiated directly. To obtain an instance of this class, +''' use the methods of the class. +''' +''' +''' + + Public Class BasePersonRelativeRecord + Inherits PrimaryKeyRecord + + + Public Shared Shadows ReadOnly TableUtils As PersonRelativeTable = PersonRelativeTable.Instance + + ' Constructors + + Protected Sub New() + MyBase.New(TableUtils) + End Sub + + Protected Sub New(ByVal record As PrimaryKeyRecord) + MyBase.New(record, TableUtils) + End Sub + + 'Evaluates Initialize when->Inserting record formulas specified at the data access layer + Public Overridable Sub PersonRelativeRecord_InsertingRecord(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles Me.InsertingRecord + 'Apply Initialize->Inserting record formula only if validation is successful. + Dim PersonRelativeRec As PersonRelativeRecord = CType(sender,PersonRelativeRecord) + Validate_Inserting() + If Not PersonRelativeRec Is Nothing AndAlso Not PersonRelativeRec.IsReadOnly Then + End If + End Sub + + 'Evaluates Initialize when->Updating record formulas specified at the data access layer + Public Overridable Sub PersonRelativeRecord_UpdatingRecord(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles Me.UpdatingRecord + 'Apply Initialize->Updating record formula only if validation is successful. + Dim PersonRelativeRec As PersonRelativeRecord = CType(sender,PersonRelativeRecord) + Validate_Updating() + If Not PersonRelativeRec Is Nothing AndAlso Not PersonRelativeRec.IsReadOnly Then + End If + End Sub + + 'Evaluates Initialize when->Reading record formulas specified at the data access layer + Public Overridable Sub PersonRelativeRecord_ReadRecord(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.ReadRecord + 'Apply Initialize->Reading record formula only if validation is successful. + Dim PersonRelativeRec As PersonRelativeRecord = CType(sender,PersonRelativeRecord) + If Not PersonRelativeRec Is Nothing AndAlso Not PersonRelativeRec.IsReadOnly Then + End If + End Sub + + 'Evaluates Validate when->Inserting formulas specified at the data access layer + Public Overridable Sub Validate_Inserting () + Dim fullValidationMessage As String = "" + Dim validationMessage As String = "" + + dim formula as String = "" + + + If validationMessage <> "" AndAlso validationMessage.ToLower() <> "true" Then + fullValidationMessage &= validationMessage & vbCrLf + End If + + If fullValidationMessage <> "" Then + Throw New Exception(fullValidationMessage) + End If + End Sub + + 'Evaluates Validate when->Updating formulas specified at the data access layer + Public Overridable Sub Validate_Updating () + Dim fullValidationMessage As String = "" + Dim validationMessage As String = "" + + dim formula as String = "" + + + If validationMessage <> "" AndAlso validationMessage.ToLower() <> "true" Then + fullValidationMessage &= validationMessage & vbCrLf + End If + + If fullValidationMessage <> "" Then + Throw New Exception(fullValidationMessage) + End If + End Sub + + Public Overridable Function EvaluateFormula(ByVal formula As String, Optional ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord = Nothing, Optional ByVal format As String = Nothing) As String + + Dim e As Data.BaseFormulaEvaluator = New Data.BaseFormulaEvaluator() + + ' All variables referred to in the formula are expected to be + ' properties of the DataSource. For example, referring to + ' UnitPrice as a variable will refer to DataSource.UnitPrice + e.DataSource = dataSourceForEvaluate + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + Return resultObj.ToString() + End Function + + + + + + + +#Region "Convenience methods to get/set values of fields" + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonRelative_.RelativeId field. + ''' + Public Function GetRelativeIdValue() As ColumnValue + Return Me.GetValue(TableUtils.RelativeIdColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonRelative_.RelativeId field. + ''' + Public Function GetRelativeIdFieldValue() As Int32 + Return CType(Me.GetValue(TableUtils.RelativeIdColumn).ToInt32(), Int32) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonRelative_.PersonalId field. + ''' + Public Function GetPersonalIdValue() As ColumnValue + Return Me.GetValue(TableUtils.PersonalIdColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonRelative_.PersonalId field. + ''' + Public Function GetPersonalIdFieldValue() As String + Return CType(Me.GetValue(TableUtils.PersonalIdColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonRelative_.PersonalId field. + ''' + Public Sub SetPersonalIdFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.PersonalIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonRelative_.PersonalId field. + ''' + Public Sub SetPersonalIdFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.PersonalIdColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonRelative_.RPreName field. + ''' + Public Function GetRPreNameValue() As ColumnValue + Return Me.GetValue(TableUtils.RPreNameColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonRelative_.RPreName field. + ''' + Public Function GetRPreNameFieldValue() As String + Return CType(Me.GetValue(TableUtils.RPreNameColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonRelative_.RPreName field. + ''' + Public Sub SetRPreNameFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.RPreNameColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonRelative_.RPreName field. + ''' + Public Sub SetRPreNameFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.RPreNameColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonRelative_.RFirstName field. + ''' + Public Function GetRFirstNameValue() As ColumnValue + Return Me.GetValue(TableUtils.RFirstNameColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonRelative_.RFirstName field. + ''' + Public Function GetRFirstNameFieldValue() As String + Return CType(Me.GetValue(TableUtils.RFirstNameColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonRelative_.RFirstName field. + ''' + Public Sub SetRFirstNameFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.RFirstNameColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonRelative_.RFirstName field. + ''' + Public Sub SetRFirstNameFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.RFirstNameColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonRelative_.RLastName field. + ''' + Public Function GetRLastNameValue() As ColumnValue + Return Me.GetValue(TableUtils.RLastNameColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonRelative_.RLastName field. + ''' + Public Function GetRLastNameFieldValue() As String + Return CType(Me.GetValue(TableUtils.RLastNameColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonRelative_.RLastName field. + ''' + Public Sub SetRLastNameFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.RLastNameColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonRelative_.RLastName field. + ''' + Public Sub SetRLastNameFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.RLastNameColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonRelative_.ROrLastName field. + ''' + Public Function GetROrLastNameValue() As ColumnValue + Return Me.GetValue(TableUtils.ROrLastNameColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonRelative_.ROrLastName field. + ''' + Public Function GetROrLastNameFieldValue() As String + Return CType(Me.GetValue(TableUtils.ROrLastNameColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonRelative_.ROrLastName field. + ''' + Public Sub SetROrLastNameFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.ROrLastNameColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonRelative_.ROrLastName field. + ''' + Public Sub SetROrLastNameFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.ROrLastNameColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonRelative_.FName field. + ''' + Public Function GetFNameValue() As ColumnValue + Return Me.GetValue(TableUtils.FNameColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonRelative_.FName field. + ''' + Public Function GetFNameFieldValue() As String + Return CType(Me.GetValue(TableUtils.FNameColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonRelative_.FName field. + ''' + Public Sub SetFNameFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.FNameColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonRelative_.FName field. + ''' + Public Sub SetFNameFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.FNameColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonRelative_.FLastName field. + ''' + Public Function GetFLastNameValue() As ColumnValue + Return Me.GetValue(TableUtils.FLastNameColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonRelative_.FLastName field. + ''' + Public Function GetFLastNameFieldValue() As String + Return CType(Me.GetValue(TableUtils.FLastNameColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonRelative_.FLastName field. + ''' + Public Sub SetFLastNameFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.FLastNameColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonRelative_.FLastName field. + ''' + Public Sub SetFLastNameFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.FLastNameColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonRelative_.MName field. + ''' + Public Function GetMNameValue() As ColumnValue + Return Me.GetValue(TableUtils.MNameColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonRelative_.MName field. + ''' + Public Function GetMNameFieldValue() As String + Return CType(Me.GetValue(TableUtils.MNameColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonRelative_.MName field. + ''' + Public Sub SetMNameFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.MNameColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonRelative_.MName field. + ''' + Public Sub SetMNameFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.MNameColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonRelative_.MLastName field. + ''' + Public Function GetMLastNameValue() As ColumnValue + Return Me.GetValue(TableUtils.MLastNameColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonRelative_.MLastName field. + ''' + Public Function GetMLastNameFieldValue() As String + Return CType(Me.GetValue(TableUtils.MLastNameColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonRelative_.MLastName field. + ''' + Public Sub SetMLastNameFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.MLastNameColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonRelative_.MLastName field. + ''' + Public Sub SetMLastNameFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.MLastNameColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonRelative_.MOrLastName field. + ''' + Public Function GetMOrLastNameValue() As ColumnValue + Return Me.GetValue(TableUtils.MOrLastNameColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonRelative_.MOrLastName field. + ''' + Public Function GetMOrLastNameFieldValue() As String + Return CType(Me.GetValue(TableUtils.MOrLastNameColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonRelative_.MOrLastName field. + ''' + Public Sub SetMOrLastNameFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.MOrLastNameColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonRelative_.MOrLastName field. + ''' + Public Sub SetMOrLastNameFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.MOrLastNameColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonRelative_.ROrigin field. + ''' + Public Function GetROriginValue() As ColumnValue + Return Me.GetValue(TableUtils.ROriginColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonRelative_.ROrigin field. + ''' + Public Function GetROriginFieldValue() As String + Return CType(Me.GetValue(TableUtils.ROriginColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonRelative_.ROrigin field. + ''' + Public Sub SetROriginFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.ROriginColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonRelative_.ROrigin field. + ''' + Public Sub SetROriginFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.ROriginColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonRelative_.RNationality field. + ''' + Public Function GetRNationalityValue() As ColumnValue + Return Me.GetValue(TableUtils.RNationalityColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonRelative_.RNationality field. + ''' + Public Function GetRNationalityFieldValue() As String + Return CType(Me.GetValue(TableUtils.RNationalityColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonRelative_.RNationality field. + ''' + Public Sub SetRNationalityFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.RNationalityColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonRelative_.RNationality field. + ''' + Public Sub SetRNationalityFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.RNationalityColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonRelative_.RReligion field. + ''' + Public Function GetRReligionValue() As ColumnValue + Return Me.GetValue(TableUtils.RReligionColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonRelative_.RReligion field. + ''' + Public Function GetRReligionFieldValue() As String + Return CType(Me.GetValue(TableUtils.RReligionColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonRelative_.RReligion field. + ''' + Public Sub SetRReligionFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.RReligionColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonRelative_.RReligion field. + ''' + Public Sub SetRReligionFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.RReligionColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonRelative_.RAddress field. + ''' + Public Function GetRAddressValue() As ColumnValue + Return Me.GetValue(TableUtils.RAddressColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonRelative_.RAddress field. + ''' + Public Function GetRAddressFieldValue() As String + Return CType(Me.GetValue(TableUtils.RAddressColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonRelative_.RAddress field. + ''' + Public Sub SetRAddressFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.RAddressColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonRelative_.RAddress field. + ''' + Public Sub SetRAddressFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.RAddressColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonRelative_.RAmphur field. + ''' + Public Function GetRAmphurValue() As ColumnValue + Return Me.GetValue(TableUtils.RAmphurColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonRelative_.RAmphur field. + ''' + Public Function GetRAmphurFieldValue() As String + Return CType(Me.GetValue(TableUtils.RAmphurColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonRelative_.RAmphur field. + ''' + Public Sub SetRAmphurFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.RAmphurColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonRelative_.RAmphur field. + ''' + Public Sub SetRAmphurFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.RAmphurColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonRelative_.RProvince field. + ''' + Public Function GetRProvinceValue() As ColumnValue + Return Me.GetValue(TableUtils.RProvinceColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonRelative_.RProvince field. + ''' + Public Function GetRProvinceFieldValue() As String + Return CType(Me.GetValue(TableUtils.RProvinceColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonRelative_.RProvince field. + ''' + Public Sub SetRProvinceFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.RProvinceColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonRelative_.RProvince field. + ''' + Public Sub SetRProvinceFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.RProvinceColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonRelative_.RBirthDate field. + ''' + Public Function GetRBirthDateValue() As ColumnValue + Return Me.GetValue(TableUtils.RBirthDateColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonRelative_.RBirthDate field. + ''' + Public Function GetRBirthDateFieldValue() As DateTime + Return CType(Me.GetValue(TableUtils.RBirthDateColumn).ToDateTime(), DateTime) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonRelative_.RBirthDate field. + ''' + Public Sub SetRBirthDateFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.RBirthDateColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonRelative_.RBirthDate field. + ''' + Public Sub SetRBirthDateFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.RBirthDateColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonRelative_.RBirthDate field. + ''' + Public Sub SetRBirthDateFieldValue(ByVal val As DateTime) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.RBirthDateColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonRelative_.RelationId field. + ''' + Public Function GetRelationIdValue() As ColumnValue + Return Me.GetValue(TableUtils.RelationIdColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonRelative_.RelationId field. + ''' + Public Function GetRelationIdFieldValue() As Int32 + Return CType(Me.GetValue(TableUtils.RelationIdColumn).ToInt32(), Int32) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonRelative_.RelationId field. + ''' + Public Sub SetRelationIdFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.RelationIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonRelative_.RelationId field. + ''' + Public Sub SetRelationIdFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.RelationIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonRelative_.RelationId field. + ''' + Public Sub SetRelationIdFieldValue(ByVal val As Double) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.RelationIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonRelative_.RelationId field. + ''' + Public Sub SetRelationIdFieldValue(ByVal val As Decimal) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.RelationIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonRelative_.RelationId field. + ''' + Public Sub SetRelationIdFieldValue(ByVal val As Int64) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.RelationIdColumn) + End Sub + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonRelative_.Ref field. + ''' + Public Function GetRef0Value() As ColumnValue + Return Me.GetValue(TableUtils.Ref0Column) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonRelative_.Ref field. + ''' + Public Function GetRef0FieldValue() As String + Return CType(Me.GetValue(TableUtils.Ref0Column).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonRelative_.Ref field. + ''' + Public Sub SetRef0FieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.Ref0Column) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonRelative_.Ref field. + ''' + Public Sub SetRef0FieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.Ref0Column) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonRelative_.RefDate field. + ''' + Public Function GetRefDateValue() As ColumnValue + Return Me.GetValue(TableUtils.RefDateColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonRelative_.RefDate field. + ''' + Public Function GetRefDateFieldValue() As DateTime + Return CType(Me.GetValue(TableUtils.RefDateColumn).ToDateTime(), DateTime) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonRelative_.RefDate field. + ''' + Public Sub SetRefDateFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.RefDateColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonRelative_.RefDate field. + ''' + Public Sub SetRefDateFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.RefDateColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonRelative_.RefDate field. + ''' + Public Sub SetRefDateFieldValue(ByVal val As DateTime) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.RefDateColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonRelative_.RStatus field. + ''' + Public Function GetRStatusValue() As ColumnValue + Return Me.GetValue(TableUtils.RStatusColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonRelative_.RStatus field. + ''' + Public Function GetRStatusFieldValue() As Byte + Return CType(Me.GetValue(TableUtils.RStatusColumn).ToByte(), Byte) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonRelative_.RStatus field. + ''' + Public Sub SetRStatusFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.RStatusColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonRelative_.RStatus field. + ''' + Public Sub SetRStatusFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.RStatusColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonRelative_.RStatus field. + ''' + Public Sub SetRStatusFieldValue(ByVal val As Double) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.RStatusColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonRelative_.RStatus field. + ''' + Public Sub SetRStatusFieldValue(ByVal val As Decimal) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.RStatusColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonRelative_.RStatus field. + ''' + Public Sub SetRStatusFieldValue(ByVal val As Int64) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.RStatusColumn) + End Sub + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonRelative_.RStatusRef field. + ''' + Public Function GetRStatusRefValue() As ColumnValue + Return Me.GetValue(TableUtils.RStatusRefColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonRelative_.RStatusRef field. + ''' + Public Function GetRStatusRefFieldValue() As String + Return CType(Me.GetValue(TableUtils.RStatusRefColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonRelative_.RStatusRef field. + ''' + Public Sub SetRStatusRefFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.RStatusRefColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonRelative_.RStatusRef field. + ''' + Public Sub SetRStatusRefFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.RStatusRefColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonRelative_.RStatusDate field. + ''' + Public Function GetRStatusDateValue() As ColumnValue + Return Me.GetValue(TableUtils.RStatusDateColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonRelative_.RStatusDate field. + ''' + Public Function GetRStatusDateFieldValue() As DateTime + Return CType(Me.GetValue(TableUtils.RStatusDateColumn).ToDateTime(), DateTime) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonRelative_.RStatusDate field. + ''' + Public Sub SetRStatusDateFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.RStatusDateColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonRelative_.RStatusDate field. + ''' + Public Sub SetRStatusDateFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.RStatusDateColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonRelative_.RStatusDate field. + ''' + Public Sub SetRStatusDateFieldValue(ByVal val As DateTime) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.RStatusDateColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonRelative_.RRemark field. + ''' + Public Function GetRRemarkValue() As ColumnValue + Return Me.GetValue(TableUtils.RRemarkColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonRelative_.RRemark field. + ''' + Public Function GetRRemarkFieldValue() As String + Return CType(Me.GetValue(TableUtils.RRemarkColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonRelative_.RRemark field. + ''' + Public Sub SetRRemarkFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.RRemarkColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonRelative_.RRemark field. + ''' + Public Sub SetRRemarkFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.RRemarkColumn) + End Sub + + + +#End Region + +#Region "Convenience methods to get field names" + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonRelative_.RelativeId field. + ''' + Public Property RelativeId() As Int32 + Get + Return CType(Me.GetValue(TableUtils.RelativeIdColumn).ToInt32(), Int32) + End Get + Set (ByVal val As Int32) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.RelativeIdColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property RelativeIdSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.RelativeIdColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property RelativeIdDefault() As String + Get + Return TableUtils.RelativeIdColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonRelative_.PersonalId field. + ''' + Public Property PersonalId() As String + Get + Return CType(Me.GetValue(TableUtils.PersonalIdColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.PersonalIdColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property PersonalIdSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.PersonalIdColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property PersonalIdDefault() As String + Get + Return TableUtils.PersonalIdColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonRelative_.RPreName field. + ''' + Public Property RPreName() As String + Get + Return CType(Me.GetValue(TableUtils.RPreNameColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.RPreNameColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property RPreNameSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.RPreNameColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property RPreNameDefault() As String + Get + Return TableUtils.RPreNameColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonRelative_.RFirstName field. + ''' + Public Property RFirstName() As String + Get + Return CType(Me.GetValue(TableUtils.RFirstNameColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.RFirstNameColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property RFirstNameSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.RFirstNameColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property RFirstNameDefault() As String + Get + Return TableUtils.RFirstNameColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonRelative_.RLastName field. + ''' + Public Property RLastName() As String + Get + Return CType(Me.GetValue(TableUtils.RLastNameColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.RLastNameColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property RLastNameSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.RLastNameColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property RLastNameDefault() As String + Get + Return TableUtils.RLastNameColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonRelative_.ROrLastName field. + ''' + Public Property ROrLastName() As String + Get + Return CType(Me.GetValue(TableUtils.ROrLastNameColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.ROrLastNameColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property ROrLastNameSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.ROrLastNameColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property ROrLastNameDefault() As String + Get + Return TableUtils.ROrLastNameColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonRelative_.FName field. + ''' + Public Property FName() As String + Get + Return CType(Me.GetValue(TableUtils.FNameColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.FNameColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property FNameSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.FNameColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property FNameDefault() As String + Get + Return TableUtils.FNameColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonRelative_.FLastName field. + ''' + Public Property FLastName() As String + Get + Return CType(Me.GetValue(TableUtils.FLastNameColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.FLastNameColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property FLastNameSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.FLastNameColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property FLastNameDefault() As String + Get + Return TableUtils.FLastNameColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonRelative_.MName field. + ''' + Public Property MName() As String + Get + Return CType(Me.GetValue(TableUtils.MNameColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.MNameColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property MNameSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.MNameColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property MNameDefault() As String + Get + Return TableUtils.MNameColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonRelative_.MLastName field. + ''' + Public Property MLastName() As String + Get + Return CType(Me.GetValue(TableUtils.MLastNameColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.MLastNameColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property MLastNameSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.MLastNameColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property MLastNameDefault() As String + Get + Return TableUtils.MLastNameColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonRelative_.MOrLastName field. + ''' + Public Property MOrLastName() As String + Get + Return CType(Me.GetValue(TableUtils.MOrLastNameColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.MOrLastNameColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property MOrLastNameSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.MOrLastNameColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property MOrLastNameDefault() As String + Get + Return TableUtils.MOrLastNameColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonRelative_.ROrigin field. + ''' + Public Property ROrigin() As String + Get + Return CType(Me.GetValue(TableUtils.ROriginColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.ROriginColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property ROriginSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.ROriginColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property ROriginDefault() As String + Get + Return TableUtils.ROriginColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonRelative_.RNationality field. + ''' + Public Property RNationality() As String + Get + Return CType(Me.GetValue(TableUtils.RNationalityColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.RNationalityColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property RNationalitySpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.RNationalityColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property RNationalityDefault() As String + Get + Return TableUtils.RNationalityColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonRelative_.RReligion field. + ''' + Public Property RReligion() As String + Get + Return CType(Me.GetValue(TableUtils.RReligionColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.RReligionColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property RReligionSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.RReligionColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property RReligionDefault() As String + Get + Return TableUtils.RReligionColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonRelative_.RAddress field. + ''' + Public Property RAddress() As String + Get + Return CType(Me.GetValue(TableUtils.RAddressColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.RAddressColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property RAddressSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.RAddressColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property RAddressDefault() As String + Get + Return TableUtils.RAddressColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonRelative_.RAmphur field. + ''' + Public Property RAmphur() As String + Get + Return CType(Me.GetValue(TableUtils.RAmphurColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.RAmphurColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property RAmphurSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.RAmphurColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property RAmphurDefault() As String + Get + Return TableUtils.RAmphurColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonRelative_.RProvince field. + ''' + Public Property RProvince() As String + Get + Return CType(Me.GetValue(TableUtils.RProvinceColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.RProvinceColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property RProvinceSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.RProvinceColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property RProvinceDefault() As String + Get + Return TableUtils.RProvinceColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonRelative_.RBirthDate field. + ''' + Public Property RBirthDate() As DateTime + Get + Return CType(Me.GetValue(TableUtils.RBirthDateColumn).ToDateTime(), DateTime) + End Get + Set (ByVal val As DateTime) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.RBirthDateColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property RBirthDateSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.RBirthDateColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property RBirthDateDefault() As String + Get + Return TableUtils.RBirthDateColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonRelative_.RelationId field. + ''' + Public Property RelationId() As Int32 + Get + Return CType(Me.GetValue(TableUtils.RelationIdColumn).ToInt32(), Int32) + End Get + Set (ByVal val As Int32) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.RelationIdColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property RelationIdSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.RelationIdColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property RelationIdDefault() As String + Get + Return TableUtils.RelationIdColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonRelative_.Ref field. + ''' + Public Property Ref0() As String + Get + Return CType(Me.GetValue(TableUtils.Ref0Column).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.Ref0Column) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property Ref0Specified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.Ref0Column) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property Ref0Default() As String + Get + Return TableUtils.Ref0Column.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonRelative_.RefDate field. + ''' + Public Property RefDate() As DateTime + Get + Return CType(Me.GetValue(TableUtils.RefDateColumn).ToDateTime(), DateTime) + End Get + Set (ByVal val As DateTime) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.RefDateColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property RefDateSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.RefDateColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property RefDateDefault() As String + Get + Return TableUtils.RefDateColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonRelative_.RStatus field. + ''' + Public Property RStatus() As Byte + Get + Return CType(Me.GetValue(TableUtils.RStatusColumn).ToByte(), Byte) + End Get + Set (ByVal val As Byte) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.RStatusColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property RStatusSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.RStatusColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property RStatusDefault() As String + Get + Return TableUtils.RStatusColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonRelative_.RStatusRef field. + ''' + Public Property RStatusRef() As String + Get + Return CType(Me.GetValue(TableUtils.RStatusRefColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.RStatusRefColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property RStatusRefSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.RStatusRefColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property RStatusRefDefault() As String + Get + Return TableUtils.RStatusRefColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonRelative_.RStatusDate field. + ''' + Public Property RStatusDate() As DateTime + Get + Return CType(Me.GetValue(TableUtils.RStatusDateColumn).ToDateTime(), DateTime) + End Get + Set (ByVal val As DateTime) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.RStatusDateColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property RStatusDateSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.RStatusDateColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property RStatusDateDefault() As String + Get + Return TableUtils.RStatusDateColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonRelative_.RRemark field. + ''' + Public Property RRemark() As String + Get + Return CType(Me.GetValue(TableUtils.RRemarkColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.RRemarkColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property RRemarkSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.RRemarkColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property RRemarkDefault() As String + Get + Return TableUtils.RRemarkColumn.DefaultValue + End Get + End Property + + + +#End Region + +End Class +End Namespace diff --git a/App_Code/Business Layer/BasePersonRelativeTable.vb b/App_Code/Business Layer/BasePersonRelativeTable.vb new file mode 100644 index 0000000..6b5c757 --- /dev/null +++ b/App_Code/Business Layer/BasePersonRelativeTable.vb @@ -0,0 +1,1282 @@ +' This class is "generated" and will be overwritten. +' Your customizations should be made in PersonRelativeRecord.vb + +Imports System.Data.SqlTypes +Imports System.Data +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider +Imports Persons.Data + +Namespace Persons.Business + +''' +''' The generated superclass for the class. +''' Provides access to the schema information and record data of a database table or view named PersonRelative. +''' +''' +''' The connection details (name, location, etc.) of the database and table (or view) accessed by this class +''' are resolved at runtime based on the connection string in the application's Web.Config file. +''' +''' This class is not intended to be instantiated directly. To obtain an instance of this class, use +''' PersonRelativeTable.Instance. +''' +''' +''' + + Public Class BasePersonRelativeTable + Inherits PrimaryKeyTable + + + Private ReadOnly TableDefinitionString As String = PersonRelativeDefinition.GetXMLString() + + + + + + + + Protected Sub New() + MyBase.New() + Me.Initialize() + End Sub + + Protected Overridable Sub Initialize() + Dim def As New XmlTableDefinition(TableDefinitionString) + Me.TableDefinition = New TableDefinition() + Me.TableDefinition.TableClassName = System.Reflection.Assembly.CreateQualifiedName("App_Code", "Persons.Business.PersonRelativeTable") + def.InitializeTableDefinition(Me.TableDefinition) + Me.ConnectionName = def.GetConnectionName() + Me.RecordClassName = System.Reflection.Assembly.CreateQualifiedName("App_Code", "Persons.Business.PersonRelativeRecord") + Me.ApplicationName = "App_Code" + Me.DataAdapter = New PersonRelativeSqlTable() + Directcast(Me.DataAdapter, PersonRelativeSqlTable).ConnectionName = Me.ConnectionName + + Me.TableDefinition.AdapterMetaData = Me.DataAdapter.AdapterMetaData + RelativeIdColumn.CodeName = "RelativeId" + PersonalIdColumn.CodeName = "PersonalId" + RPreNameColumn.CodeName = "RPreName" + RFirstNameColumn.CodeName = "RFirstName" + RLastNameColumn.CodeName = "RLastName" + ROrLastNameColumn.CodeName = "ROrLastName" + FNameColumn.CodeName = "FName" + FLastNameColumn.CodeName = "FLastName" + MNameColumn.CodeName = "MName" + MLastNameColumn.CodeName = "MLastName" + MOrLastNameColumn.CodeName = "MOrLastName" + ROriginColumn.CodeName = "ROrigin" + RNationalityColumn.CodeName = "RNationality" + RReligionColumn.CodeName = "RReligion" + RAddressColumn.CodeName = "RAddress" + RAmphurColumn.CodeName = "RAmphur" + RProvinceColumn.CodeName = "RProvince" + RBirthDateColumn.CodeName = "RBirthDate" + RelationIdColumn.CodeName = "RelationId" + Ref0Column.CodeName = "Ref0" + RefDateColumn.CodeName = "RefDate" + RStatusColumn.CodeName = "RStatus" + RStatusRefColumn.CodeName = "RStatusRef" + RStatusDateColumn.CodeName = "RStatusDate" + RRemarkColumn.CodeName = "RRemark" + + End Sub + +#Region "Overriden methods" + + +#End Region + +#Region "Properties for columns" + + ''' + ''' This is a convenience property that provides direct access to the table's PersonRelative_.RelativeId column object. + ''' + Public ReadOnly Property RelativeIdColumn() As BaseClasses.Data.NumberColumn + Get + Return CType(Me.TableDefinition.ColumnList(0), BaseClasses.Data.NumberColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonRelative_.RelativeId column object. + ''' + Public Shared ReadOnly Property RelativeId() As BaseClasses.Data.NumberColumn + Get + Return PersonRelativeTable.Instance.RelativeIdColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonRelative_.PersonalId column object. + ''' + Public ReadOnly Property PersonalIdColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(1), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonRelative_.PersonalId column object. + ''' + Public Shared ReadOnly Property PersonalId() As BaseClasses.Data.StringColumn + Get + Return PersonRelativeTable.Instance.PersonalIdColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonRelative_.RPreName column object. + ''' + Public ReadOnly Property RPreNameColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(2), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonRelative_.RPreName column object. + ''' + Public Shared ReadOnly Property RPreName() As BaseClasses.Data.StringColumn + Get + Return PersonRelativeTable.Instance.RPreNameColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonRelative_.RFirstName column object. + ''' + Public ReadOnly Property RFirstNameColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(3), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonRelative_.RFirstName column object. + ''' + Public Shared ReadOnly Property RFirstName() As BaseClasses.Data.StringColumn + Get + Return PersonRelativeTable.Instance.RFirstNameColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonRelative_.RLastName column object. + ''' + Public ReadOnly Property RLastNameColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(4), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonRelative_.RLastName column object. + ''' + Public Shared ReadOnly Property RLastName() As BaseClasses.Data.StringColumn + Get + Return PersonRelativeTable.Instance.RLastNameColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonRelative_.ROrLastName column object. + ''' + Public ReadOnly Property ROrLastNameColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(5), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonRelative_.ROrLastName column object. + ''' + Public Shared ReadOnly Property ROrLastName() As BaseClasses.Data.StringColumn + Get + Return PersonRelativeTable.Instance.ROrLastNameColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonRelative_.FName column object. + ''' + Public ReadOnly Property FNameColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(6), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonRelative_.FName column object. + ''' + Public Shared ReadOnly Property FName() As BaseClasses.Data.StringColumn + Get + Return PersonRelativeTable.Instance.FNameColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonRelative_.FLastName column object. + ''' + Public ReadOnly Property FLastNameColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(7), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonRelative_.FLastName column object. + ''' + Public Shared ReadOnly Property FLastName() As BaseClasses.Data.StringColumn + Get + Return PersonRelativeTable.Instance.FLastNameColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonRelative_.MName column object. + ''' + Public ReadOnly Property MNameColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(8), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonRelative_.MName column object. + ''' + Public Shared ReadOnly Property MName() As BaseClasses.Data.StringColumn + Get + Return PersonRelativeTable.Instance.MNameColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonRelative_.MLastName column object. + ''' + Public ReadOnly Property MLastNameColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(9), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonRelative_.MLastName column object. + ''' + Public Shared ReadOnly Property MLastName() As BaseClasses.Data.StringColumn + Get + Return PersonRelativeTable.Instance.MLastNameColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonRelative_.MOrLastName column object. + ''' + Public ReadOnly Property MOrLastNameColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(10), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonRelative_.MOrLastName column object. + ''' + Public Shared ReadOnly Property MOrLastName() As BaseClasses.Data.StringColumn + Get + Return PersonRelativeTable.Instance.MOrLastNameColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonRelative_.ROrigin column object. + ''' + Public ReadOnly Property ROriginColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(11), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonRelative_.ROrigin column object. + ''' + Public Shared ReadOnly Property ROrigin() As BaseClasses.Data.StringColumn + Get + Return PersonRelativeTable.Instance.ROriginColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonRelative_.RNationality column object. + ''' + Public ReadOnly Property RNationalityColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(12), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonRelative_.RNationality column object. + ''' + Public Shared ReadOnly Property RNationality() As BaseClasses.Data.StringColumn + Get + Return PersonRelativeTable.Instance.RNationalityColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonRelative_.RReligion column object. + ''' + Public ReadOnly Property RReligionColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(13), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonRelative_.RReligion column object. + ''' + Public Shared ReadOnly Property RReligion() As BaseClasses.Data.StringColumn + Get + Return PersonRelativeTable.Instance.RReligionColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonRelative_.RAddress column object. + ''' + Public ReadOnly Property RAddressColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(14), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonRelative_.RAddress column object. + ''' + Public Shared ReadOnly Property RAddress() As BaseClasses.Data.StringColumn + Get + Return PersonRelativeTable.Instance.RAddressColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonRelative_.RAmphur column object. + ''' + Public ReadOnly Property RAmphurColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(15), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonRelative_.RAmphur column object. + ''' + Public Shared ReadOnly Property RAmphur() As BaseClasses.Data.StringColumn + Get + Return PersonRelativeTable.Instance.RAmphurColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonRelative_.RProvince column object. + ''' + Public ReadOnly Property RProvinceColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(16), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonRelative_.RProvince column object. + ''' + Public Shared ReadOnly Property RProvince() As BaseClasses.Data.StringColumn + Get + Return PersonRelativeTable.Instance.RProvinceColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonRelative_.RBirthDate column object. + ''' + Public ReadOnly Property RBirthDateColumn() As BaseClasses.Data.DateColumn + Get + Return CType(Me.TableDefinition.ColumnList(17), BaseClasses.Data.DateColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonRelative_.RBirthDate column object. + ''' + Public Shared ReadOnly Property RBirthDate() As BaseClasses.Data.DateColumn + Get + Return PersonRelativeTable.Instance.RBirthDateColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonRelative_.RelationId column object. + ''' + Public ReadOnly Property RelationIdColumn() As BaseClasses.Data.NumberColumn + Get + Return CType(Me.TableDefinition.ColumnList(18), BaseClasses.Data.NumberColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonRelative_.RelationId column object. + ''' + Public Shared ReadOnly Property RelationId() As BaseClasses.Data.NumberColumn + Get + Return PersonRelativeTable.Instance.RelationIdColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonRelative_.Ref column object. + ''' + Public ReadOnly Property Ref0Column() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(19), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonRelative_.Ref column object. + ''' + Public Shared ReadOnly Property Ref0() As BaseClasses.Data.StringColumn + Get + Return PersonRelativeTable.Instance.Ref0Column + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonRelative_.RefDate column object. + ''' + Public ReadOnly Property RefDateColumn() As BaseClasses.Data.DateColumn + Get + Return CType(Me.TableDefinition.ColumnList(20), BaseClasses.Data.DateColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonRelative_.RefDate column object. + ''' + Public Shared ReadOnly Property RefDate() As BaseClasses.Data.DateColumn + Get + Return PersonRelativeTable.Instance.RefDateColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonRelative_.RStatus column object. + ''' + Public ReadOnly Property RStatusColumn() As BaseClasses.Data.NumberColumn + Get + Return CType(Me.TableDefinition.ColumnList(21), BaseClasses.Data.NumberColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonRelative_.RStatus column object. + ''' + Public Shared ReadOnly Property RStatus() As BaseClasses.Data.NumberColumn + Get + Return PersonRelativeTable.Instance.RStatusColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonRelative_.RStatusRef column object. + ''' + Public ReadOnly Property RStatusRefColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(22), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonRelative_.RStatusRef column object. + ''' + Public Shared ReadOnly Property RStatusRef() As BaseClasses.Data.StringColumn + Get + Return PersonRelativeTable.Instance.RStatusRefColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonRelative_.RStatusDate column object. + ''' + Public ReadOnly Property RStatusDateColumn() As BaseClasses.Data.DateColumn + Get + Return CType(Me.TableDefinition.ColumnList(23), BaseClasses.Data.DateColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonRelative_.RStatusDate column object. + ''' + Public Shared ReadOnly Property RStatusDate() As BaseClasses.Data.DateColumn + Get + Return PersonRelativeTable.Instance.RStatusDateColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonRelative_.RRemark column object. + ''' + Public ReadOnly Property RRemarkColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(24), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonRelative_.RRemark column object. + ''' + Public Shared ReadOnly Property RRemark() As BaseClasses.Data.StringColumn + Get + Return PersonRelativeTable.Instance.RRemarkColumn + End Get + End Property + + +#End Region + + +#Region "Shared helper methods" + + ''' + ''' This is a shared function that can be used to get an array of PersonRelativeRecord records using a where clause. + ''' + Public Shared Function GetRecords(ByVal where As String) As PersonRelativeRecord() + + Return GetRecords(where, Nothing, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) + End Function + + ''' + ''' This is a shared function that can be used to get an array of PersonRelativeRecord records using a where clause. + ''' + Public Shared Function GetRecords(ByVal join As BaseFilter, ByVal where As String) As PersonRelativeRecord() + + Return GetRecords(join, where, Nothing, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) + End Function + + ''' + ''' This is a shared function that can be used to get an array of PersonRelativeRecord records using a where and order by clause. + ''' + Public Shared Function GetRecords( _ + ByVal where As String, _ + ByVal orderBy As OrderBy) As PersonRelativeRecord() + + Return GetRecords(where, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) + End Function + + ''' + ''' This is a shared function that can be used to get an array of PersonRelativeRecord records using a where and order by clause. + ''' + Public Shared Function GetRecords( _ + ByVal join As BaseFilter, _ + ByVal where As String, _ + ByVal orderBy As OrderBy) As PersonRelativeRecord() + + Return GetRecords(join, where, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) + End Function + + ''' + ''' This is a shared function that can be used to get an array of PersonRelativeRecord records using a where and order by clause clause with pagination. + ''' + Public Shared Function GetRecords( _ + ByVal where As String, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As PersonRelativeRecord() + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + Dim join As BaseClasses.Data.BaseFilter = Nothing + Dim recList As ArrayList = PersonRelativeTable.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, pageIndex, pageSize) + + Return CType(recList.ToArray(GetType(Persons.Business.PersonRelativeRecord)), PersonRelativeRecord()) + End Function + + ''' + ''' This is a shared function that can be used to get an array of PersonRelativeRecord records using a where and order by clause clause with pagination. + ''' + Public Shared Function GetRecords( _ + ByVal join As BaseFilter, _ + ByVal where As String, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As PersonRelativeRecord() + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Dim recList As ArrayList = PersonRelativeTable.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, pageIndex, pageSize) + + Return CType(recList.ToArray(GetType(Persons.Business.PersonRelativeRecord)), PersonRelativeRecord()) + End Function + + Public Shared Function GetRecords( _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As PersonRelativeRecord() + Dim join As BaseClasses.Data.BaseFilter = Nothing + Dim recList As ArrayList = PersonRelativeTable.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + Return CType(recList.ToArray(GetType(Persons.Business.PersonRelativeRecord)), PersonRelativeRecord()) + End Function + + Public Shared Function GetRecords( _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As PersonRelativeRecord() + + Dim recList As ArrayList = PersonRelativeTable.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + Return CType(recList.ToArray(GetType(Persons.Business.PersonRelativeRecord)), PersonRelativeRecord()) + End Function + + Public Shared Function GetRecords( _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer, _ + ByRef totalRecords As Integer) As PersonRelativeRecord() + Dim join As BaseClasses.Data.BaseFilter = Nothing + Dim recList As ArrayList = PersonRelativeTable.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize, totalRecords) + + Return CType(recList.ToArray(GetType(Persons.Business.PersonRelativeRecord)), PersonRelativeRecord()) + End Function + + Public Shared Function GetRecords( _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer, _ + ByRef totalRecords As Integer) As PersonRelativeRecord() + + Dim recList As ArrayList = PersonRelativeTable.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize, totalRecords) + + Return CType(recList.ToArray(GetType(Persons.Business.PersonRelativeRecord)), PersonRelativeRecord()) + End Function + + ''' + ''' This is a shared function that can be used to get total number of records that will be returned using the where clause. + ''' + Public Shared Function GetRecordCount(ByVal where As String) As Integer + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Return CInt(PersonRelativeTable.Instance.GetRecordListCount(Nothing, whereFilter, Nothing, Nothing)) + End Function + +''' + ''' This is a shared function that can be used to get total number of records that will be returned using the where clause. + ''' + Public Shared Function GetRecordCount(ByVal join As BaseFilter, ByVal where As String) As Integer + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Return CInt(PersonRelativeTable.Instance.GetRecordListCount(join, whereFilter, Nothing, Nothing)) + End Function + + Public Shared Function GetRecordCount(ByVal where As WhereClause) As Integer + Return CInt(PersonRelativeTable.Instance.GetRecordListCount(Nothing, where.GetFilter(), Nothing, Nothing)) + End Function + + Public Shared Function GetRecordCount(ByVal join As BaseFilter, ByVal where As WhereClause) As Integer + Return CInt(PersonRelativeTable.Instance.GetRecordListCount(join, where.GetFilter(), Nothing, Nothing)) + End Function + + ''' + ''' This is a shared function that can be used to get a PersonRelativeRecord record using a where clause. + ''' + Public Shared Function GetRecord(ByVal where As String) As PersonRelativeRecord + Dim orderBy As OrderBy = Nothing + Return GetRecord(where, orderBy) + End Function + + ''' + ''' This is a shared function that can be used to get a PersonRelativeRecord record using a where clause. + ''' + Public Shared Function GetRecord(ByVal join As BaseFilter, ByVal where As String) As PersonRelativeRecord + Dim orderBy As OrderBy = Nothing + Return GetRecord(join, where, orderBy) + End Function + + ''' + ''' This is a shared function that can be used to get a PersonRelativeRecord record using a where and order by clause. + ''' + Public Shared Function GetRecord( _ + ByVal where As String, _ + ByVal orderBy As OrderBy) As PersonRelativeRecord + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + Dim join As BaseClasses.Data.BaseFilter = Nothing + Dim recList As ArrayList = PersonRelativeTable.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MIN_BATCH_SIZE) + + Dim rec As PersonRelativeRecord = Nothing + If recList.Count > 0 Then + rec = CType(recList(0), PersonRelativeRecord) + End If + + Return rec + End Function + + ''' + ''' This is a shared function that can be used to get a PersonRelativeRecord record using a where and order by clause. + ''' + Public Shared Function GetRecord( _ + ByVal join As BaseFilter, _ + ByVal where As String, _ + ByVal orderBy As OrderBy) As PersonRelativeRecord + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Dim recList As ArrayList = PersonRelativeTable.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MIN_BATCH_SIZE) + + Dim rec As PersonRelativeRecord = Nothing + If recList.Count > 0 Then + rec = CType(recList(0), PersonRelativeRecord) + End If + + Return rec + End Function + + + Public Shared Function GetValues( _ + ByVal col As BaseColumn, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal maxItems As Integer) As String() + + ' Create the filter list. + Dim retCol As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, True) + retCol.AddColumn(col) + + Return PersonRelativeTable.Instance.GetColumnValues(retCol, Nothing, where.GetFilter(), Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, maxItems) + + End Function + + Public Shared Function GetValues( _ + ByVal col As BaseColumn, _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal maxItems As Integer) As String() + + ' Create the filter list. + Dim retCol As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, True) + retCol.AddColumn(col) + + Return PersonRelativeTable.Instance.GetColumnValues(retCol, join, where.GetFilter(), Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, maxItems) + + End Function + + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where clause. + ''' + Public Shared Function GetDataTable(ByVal where As String) As System.Data.DataTable + + Dim recs() As PersonRelativeRecord = GetRecords(where) + Return PersonRelativeTable.Instance.CreateDataTable(recs, Nothing) + End Function + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where clause. + ''' + Public Shared Function GetDataTable(ByVal join As BaseFilter, ByVal where As String) As System.Data.DataTable + + Dim recs() As PersonRelativeRecord = GetRecords(join, where) + Return PersonRelativeTable.Instance.CreateDataTable(recs, Nothing) + End Function + + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause. + ''' + Public Shared Function GetDataTable(ByVal where As String, ByVal orderBy As OrderBy) As System.Data.DataTable + + Dim recs() As PersonRelativeRecord = GetRecords(where, orderBy) + Return PersonRelativeTable.Instance.CreateDataTable(recs, Nothing) + End Function + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause. + ''' + Public Shared Function GetDataTable(ByVal join As BaseFilter, ByVal where As String, ByVal orderBy As OrderBy) As System.Data.DataTable + + Dim recs() As PersonRelativeRecord = GetRecords(join, where, orderBy) + Return PersonRelativeTable.Instance.CreateDataTable(recs, Nothing) + End Function + + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause with pagination. + ''' + Public Shared Function GetDataTable( _ + ByVal where As String, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As System.Data.DataTable + + Dim recs() As PersonRelativeRecord = GetRecords(where, orderBy, pageIndex, pageSize) + Return PersonRelativeTable.Instance.CreateDataTable(recs, Nothing) + End Function + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause with pagination. + ''' + Public Shared Function GetDataTable( _ + ByVal join As BaseFilter, _ + ByVal where As String, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As System.Data.DataTable + + Dim recs() As PersonRelativeRecord = GetRecords(join, where, orderBy, pageIndex, pageSize) + Return PersonRelativeTable.Instance.CreateDataTable(recs, Nothing) + End Function + + + ''' + ''' This is a shared function that can be used to delete records using a where clause. + ''' + Public Shared Sub DeleteRecords(ByVal where As String) + If where = Nothing OrElse where.Trim() = "" Then + Return + End If + + Dim whereFilter As SqlFilter = New SqlFilter(where) + PersonRelativeTable.Instance.DeleteRecordList(whereFilter) + End Sub + + ''' + ''' This is a shared function that can be used to export records using a where clause. + ''' + Public Shared Function Export(ByVal where As String) As String + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Return PersonRelativeTable.Instance.ExportRecordData(whereFilter) + End Function + + Public Shared Function Export(ByVal where As WhereClause) As String + Dim whereFilter As BaseFilter = Nothing + If Not where Is Nothing Then + whereFilter = where.GetFilter() + End If + + Return PersonRelativeTable.Instance.ExportRecordData(whereFilter) + End Function + + Public Shared Function GetSum( _ + ByVal col As BaseColumn, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) _ + As String + + Dim colSel As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, False) + colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Sum) + + Return PersonRelativeTable.Instance.GetColumnStatistics(colSel, Nothing, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + End Function + + Public Shared Function GetSum( _ + ByVal col As BaseColumn, _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) _ + As String + + Dim colSel As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, False) + colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Sum) + + Return PersonRelativeTable.Instance.GetColumnStatistics(colSel, join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + End Function + + + Public Shared Function GetCount( _ + ByVal col As BaseColumn, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) _ + As String + + Dim colSel As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, False) + colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Count) + + Return PersonRelativeTable.Instance.GetColumnStatistics(colSel, Nothing, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + End Function + + Public Shared Function GetCount( _ + ByVal col As BaseColumn, _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) _ + As String + + Dim colSel As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, False) + colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Count) + + Return PersonRelativeTable.Instance.GetColumnStatistics(colSel, join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + End Function + + ''' + ''' This method returns the columns in the table. + ''' + Public Shared Function GetColumns() As BaseColumn() + Return PersonRelativeTable.Instance.TableDefinition.Columns + End Function + + ''' + ''' This method returns the columnlist in the table. + ''' + Public Shared Function GetColumnList() As ColumnList + Return PersonRelativeTable.Instance.TableDefinition.ColumnList + End Function + + + ''' + ''' This method creates a new record and returns it to be edited. + ''' + Public Shared Function CreateNewRecord() As IRecord + Return PersonRelativeTable.Instance.CreateRecord() + End Function + + ''' + ''' This method creates a new record and returns it to be edited. + ''' + ''' ID of the new record. + Public Shared Function CreateNewRecord(ByVal tempId As String) As IRecord + Return PersonRelativeTable.Instance.CreateRecord(tempId) + End Function + + ''' + ''' This method checks if column is editable. + ''' + ''' Name of the column to check. + Public Shared Function isReadOnlyColumn(ByVal columnName As String) As Boolean + Dim column As BaseColumn = GetColumn(columnName) + If (Not IsNothing(column)) Then + Return column.IsValuesReadOnly + Else + Return True + End If + End Function + + ''' + ''' This method gets the specified column. + ''' + ''' Unique name of the column to fetch. + Public Shared Function GetColumn(ByVal uniqueColumnName As String) As BaseColumn + Dim column As BaseColumn = PersonRelativeTable.Instance.TableDefinition.ColumnList.GetByUniqueName(uniqueColumnName) + Return column + End Function + + ' Convenience method for getting a record using a string-based record identifier + Public Shared Function GetRecord(ByVal id As String, ByVal bMutable As Boolean) As PersonRelativeRecord + Return CType(PersonRelativeTable.Instance.GetRecordData(id, bMutable), PersonRelativeRecord) + End Function + + ' Convenience method for getting a record using a KeyValue record identifier + Public Shared Function GetRecord(ByVal id As KeyValue, ByVal bMutable As Boolean) As PersonRelativeRecord + Return CType(PersonRelativeTable.Instance.GetRecordData(id, bMutable), PersonRelativeRecord) + End Function + + ' Convenience method for creating a record + Public Overloads Function NewRecord( _ + ByVal PersonalIdValue As String, _ + ByVal RPreNameValue As String, _ + ByVal RFirstNameValue As String, _ + ByVal RLastNameValue As String, _ + ByVal ROrLastNameValue As String, _ + ByVal FNameValue As String, _ + ByVal FLastNameValue As String, _ + ByVal MNameValue As String, _ + ByVal MLastNameValue As String, _ + ByVal MOrLastNameValue As String, _ + ByVal ROriginValue As String, _ + ByVal RNationalityValue As String, _ + ByVal RReligionValue As String, _ + ByVal RAddressValue As String, _ + ByVal RAmphurValue As String, _ + ByVal RProvinceValue As String, _ + ByVal RBirthDateValue As String, _ + ByVal RelationIdValue As String, _ + ByVal Ref0Value As String, _ + ByVal RefDateValue As String, _ + ByVal RStatusValue As String, _ + ByVal RStatusRefValue As String, _ + ByVal RStatusDateValue As String, _ + ByVal RRemarkValue As String _ + ) As KeyValue + Dim rec As IPrimaryKeyRecord = CType(Me.CreateRecord(), IPrimaryKeyRecord) + rec.SetString(PersonalIdValue, PersonalIdColumn) + rec.SetString(RPreNameValue, RPreNameColumn) + rec.SetString(RFirstNameValue, RFirstNameColumn) + rec.SetString(RLastNameValue, RLastNameColumn) + rec.SetString(ROrLastNameValue, ROrLastNameColumn) + rec.SetString(FNameValue, FNameColumn) + rec.SetString(FLastNameValue, FLastNameColumn) + rec.SetString(MNameValue, MNameColumn) + rec.SetString(MLastNameValue, MLastNameColumn) + rec.SetString(MOrLastNameValue, MOrLastNameColumn) + rec.SetString(ROriginValue, ROriginColumn) + rec.SetString(RNationalityValue, RNationalityColumn) + rec.SetString(RReligionValue, RReligionColumn) + rec.SetString(RAddressValue, RAddressColumn) + rec.SetString(RAmphurValue, RAmphurColumn) + rec.SetString(RProvinceValue, RProvinceColumn) + rec.SetString(RBirthDateValue, RBirthDateColumn) + rec.SetString(RelationIdValue, RelationIdColumn) + rec.SetString(Ref0Value, Ref0Column) + rec.SetString(RefDateValue, RefDateColumn) + rec.SetString(RStatusValue, RStatusColumn) + rec.SetString(RStatusRefValue, RStatusRefColumn) + rec.SetString(RStatusDateValue, RStatusDateColumn) + rec.SetString(RRemarkValue, RRemarkColumn) + + + rec.Create() 'update the DB so any DB-initialized fields (like autoincrement IDs) can be initialized + + Dim key As KeyValue = rec.GetID() + Return key + End Function + + ''' + ''' This method deletes a specified record + ''' + ''' Keyvalue of the record to be deleted. + Public Shared Sub DeleteRecord(ByVal kv As KeyValue) + PersonRelativeTable.Instance.DeleteOneRecord(kv) + End Sub + + ''' + ''' This method checks if record exist in the database using the keyvalue provided. + ''' + ''' Key value of the record. + Public Shared Function DoesRecordExist(ByVal kv As KeyValue) As Boolean + Dim recordExist As Boolean = True + Try + PersonRelativeTable.GetRecord(kv, False) + Catch ex As Exception + recordExist = False + End Try + Return recordExist + End Function + + ''' + ''' This method returns all the primary columns in the table. + ''' + Public Shared Function GetPrimaryKeyColumns() As ColumnList + If (Not IsNothing(PersonRelativeTable.Instance.TableDefinition.PrimaryKey)) Then + Return PersonRelativeTable.Instance.TableDefinition.PrimaryKey.Columns + Else + Return Nothing + End If + End Function + + ''' + ''' This method takes a key and returns a keyvalue. + ''' + ''' key could be array of primary key values in case of composite primary key or a string containing single primary key value in case of non-composite primary key. + Public Shared Function GetKeyValue(ByVal key As Object) As KeyValue + Dim kv As KeyValue = Nothing + + If (Not (IsNothing(PersonRelativeTable.Instance.TableDefinition.PrimaryKey))) Then + + Dim isCompositePrimaryKey As Boolean = False + isCompositePrimaryKey = PersonRelativeTable.Instance.TableDefinition.PrimaryKey.IsCompositeKey + + If ((isCompositePrimaryKey) AndAlso (key.GetType.IsArray())) Then + + ' If the key is composite, then construct a key value. + kv = New KeyValue + Dim fullKeyString As String = "" + Dim keyArray As Array = CType(key, Array) + If (Not IsNothing(keyArray)) Then + Dim length As Integer = keyArray.Length + Dim pkColumns As ColumnList = PersonRelativeTable.Instance.TableDefinition.PrimaryKey.Columns + Dim pkColumn As BaseColumn + Dim index As Integer = 0 + For Each pkColumn In pkColumns + Dim keyString As String = CType(keyArray.GetValue(index), String) + If (PersonRelativeTable.Instance.TableDefinition.TableType = BaseClasses.Data.TableDefinition.TableTypes.Virtual) Then + kv.AddElement(pkColumn.UniqueName, keyString) + Else + kv.AddElement(pkColumn.InternalName, keyString) + End If + index = index + 1 + Next pkColumn + End If + + Else + ' If the key is not composite, then get the key value. + kv = PersonRelativeTable.Instance.TableDefinition.PrimaryKey.ParseValue(CType(key, String)) + End If + End If + Return kv + End Function + + + ''' + ''' This method takes a record and a Column and returns an evaluated value of DFKA formula. + ''' + Public Shared Function GetDFKA(ByVal rec As BaseRecord, ByVal col As BaseColumn) As String + Dim fkColumn As ForeignKey = PersonRelativeTable.Instance.TableDefinition.GetExpandableNonCompositeForeignKey(col) + If fkColumn Is Nothing Then + Return Nothing + End If + Dim _DFKA As String = fkColumn.PrimaryKeyDisplayColumns + If (_DFKA.Trim().StartsWith("=")) Then + ' if the formula is in the format of "= ., then pull out the data from the rec object instead of doing formula evaluation + Dim tableCodeName As String = fkColumn.PrimaryKeyTableDefinition.TableCodeName + Dim column As String = _DFKA.Trim("="c).Trim() + If column.StartsWith(tableCodeName & ".", StringComparison.InvariantCultureIgnoreCase) Then + column = column.Substring(tableCodeName.Length + 1) + End If + + For Each c As BaseColumn In fkColumn.PrimaryKeyTableDefinition.Columns + If column = c.CodeName Then + Return rec.Format(c) + End If + Next + Dim tableName As String = fkColumn.PrimaryKeyTableDefinition.TableCodeName + Return EvaluateFormula(_DFKA, rec, Nothing, tableName) + Else + Return Nothing + End If + End Function + + ''' + ''' This method takes a keyValue and a Column and returns an evaluated value of DFKA formula. + ''' + Public Shared Function GetDFKA(ByVal keyValue As String, ByVal col As BaseColumn, ByVal formatPattern as String) As String + If keyValue Is Nothing Then + Return Nothing + End If + Dim fkColumn As ForeignKey = PersonRelativeTable.Instance.TableDefinition.GetExpandableNonCompositeForeignKey(col) + If fkColumn Is Nothing Then + Return Nothing + End If + Dim _DFKA As String = fkColumn.PrimaryKeyDisplayColumns + If (_DFKA.Trim().StartsWith("=")) Then + Dim tableName As String = fkColumn.PrimaryKeyTableDefinition.TableCodeName + Dim t As PrimaryKeyTable = CType(DatabaseObjects.GetTableObject(tableName), PrimaryKeyTable) + Dim rec As BaseRecord = Nothing + If Not t Is Nothing Then + Try + rec = CType(t.GetRecordData(keyValue, False), BaseRecord) + Catch + rec = Nothing + End Try + End If + If rec Is Nothing Then + Return "" + End If + + ' if the formula is in the format of "= ., then pull out the data from the rec object instead of doing formula evaluation + Dim tableCodeName As String = fkColumn.PrimaryKeyTableDefinition.TableCodeName + Dim column As String = _DFKA.Trim("="c).Trim() + If column.StartsWith(tableCodeName & ".", StringComparison.InvariantCultureIgnoreCase) Then + column = column.Substring(tableCodeName.Length + 1) + End If + + For Each c As BaseColumn In fkColumn.PrimaryKeyTableDefinition.Columns + If column = c.CodeName Then + Return rec.Format(c) + End If + Next + Return EvaluateFormula(_DFKA, rec, Nothing, tableName) + Else + Return Nothing + End If + End Function + + ''' + ''' Evaluates the formula + ''' + Public Shared Function EvaluateFormula(ByVal formula As String, Optional ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord = Nothing, Optional ByVal format As String = Nothing, Optional ByVal name As String = "") As String + Dim e As BaseFormulaEvaluator = New BaseFormulaEvaluator() + If Not dataSourceForEvaluate Is Nothing Then + e.Evaluator.Variables.Add(name, dataSourceForEvaluate) + end if + e.DataSource = dataSourceForEvaluate + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + If Not String.IsNullOrEmpty(format) Then + Return BaseFormulaUtils.Format(resultObj, format) + Else + Return resultObj.ToString() + End If + End Function + + +#End Region + +End Class +End Namespace diff --git a/App_Code/Business Layer/BasePersonalDDRecord.vb b/App_Code/Business Layer/BasePersonalDDRecord.vb new file mode 100644 index 0000000..45c09fd --- /dev/null +++ b/App_Code/Business Layer/BasePersonalDDRecord.vb @@ -0,0 +1,590 @@ +' This class is "generated" and will be overwritten. +' Your customizations should be made in PersonalDDRecord.vb + +Imports System.Data.SqlTypes +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + +Namespace Persons.Business + +''' +''' The generated superclass for the class. +''' +''' +''' This class is not intended to be instantiated directly. To obtain an instance of this class, +''' use the methods of the class. +''' +''' +''' + + Public Class BasePersonalDDRecord + Inherits PrimaryKeyRecord + + + Public Shared Shadows ReadOnly TableUtils As PersonalDDTable = PersonalDDTable.Instance + + ' Constructors + + Protected Sub New() + MyBase.New(TableUtils) + End Sub + + Protected Sub New(ByVal record As PrimaryKeyRecord) + MyBase.New(record, TableUtils) + End Sub + + 'Evaluates Initialize when->Inserting record formulas specified at the data access layer + Public Overridable Sub PersonalDDRecord_InsertingRecord(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles Me.InsertingRecord + 'Apply Initialize->Inserting record formula only if validation is successful. + Dim PersonalDDRec As PersonalDDRecord = CType(sender,PersonalDDRecord) + Validate_Inserting() + If Not PersonalDDRec Is Nothing AndAlso Not PersonalDDRec.IsReadOnly Then + End If + End Sub + + 'Evaluates Initialize when->Updating record formulas specified at the data access layer + Public Overridable Sub PersonalDDRecord_UpdatingRecord(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles Me.UpdatingRecord + 'Apply Initialize->Updating record formula only if validation is successful. + Dim PersonalDDRec As PersonalDDRecord = CType(sender,PersonalDDRecord) + Validate_Updating() + If Not PersonalDDRec Is Nothing AndAlso Not PersonalDDRec.IsReadOnly Then + End If + End Sub + + 'Evaluates Initialize when->Reading record formulas specified at the data access layer + Public Overridable Sub PersonalDDRecord_ReadRecord(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.ReadRecord + 'Apply Initialize->Reading record formula only if validation is successful. + Dim PersonalDDRec As PersonalDDRecord = CType(sender,PersonalDDRecord) + If Not PersonalDDRec Is Nothing AndAlso Not PersonalDDRec.IsReadOnly Then + End If + End Sub + + 'Evaluates Validate when->Inserting formulas specified at the data access layer + Public Overridable Sub Validate_Inserting () + Dim fullValidationMessage As String = "" + Dim validationMessage As String = "" + + dim formula as String = "" + + + If validationMessage <> "" AndAlso validationMessage.ToLower() <> "true" Then + fullValidationMessage &= validationMessage & vbCrLf + End If + + If fullValidationMessage <> "" Then + Throw New Exception(fullValidationMessage) + End If + End Sub + + 'Evaluates Validate when->Updating formulas specified at the data access layer + Public Overridable Sub Validate_Updating () + Dim fullValidationMessage As String = "" + Dim validationMessage As String = "" + + dim formula as String = "" + + + If validationMessage <> "" AndAlso validationMessage.ToLower() <> "true" Then + fullValidationMessage &= validationMessage & vbCrLf + End If + + If fullValidationMessage <> "" Then + Throw New Exception(fullValidationMessage) + End If + End Sub + + Public Overridable Function EvaluateFormula(ByVal formula As String, Optional ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord = Nothing, Optional ByVal format As String = Nothing) As String + + Dim e As Data.BaseFormulaEvaluator = New Data.BaseFormulaEvaluator() + + ' All variables referred to in the formula are expected to be + ' properties of the DataSource. For example, referring to + ' UnitPrice as a variable will refer to DataSource.UnitPrice + e.DataSource = dataSourceForEvaluate + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + Return resultObj.ToString() + End Function + + + + + + + +#Region "Convenience methods to get/set values of fields" + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalDD_.id field. + ''' + Public Function Getid0Value() As ColumnValue + Return Me.GetValue(TableUtils.id0Column) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalDD_.id field. + ''' + Public Function Getid0FieldValue() As Int32 + Return CType(Me.GetValue(TableUtils.id0Column).ToInt32(), Int32) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalDD_.PersonalId field. + ''' + Public Function GetPersonalIdValue() As ColumnValue + Return Me.GetValue(TableUtils.PersonalIdColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalDD_.PersonalId field. + ''' + Public Function GetPersonalIdFieldValue() As String + Return CType(Me.GetValue(TableUtils.PersonalIdColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalDD_.PersonalId field. + ''' + Public Sub SetPersonalIdFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.PersonalIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalDD_.PersonalId field. + ''' + Public Sub SetPersonalIdFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.PersonalIdColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalDD_.StartDate field. + ''' + Public Function GetStartDateValue() As ColumnValue + Return Me.GetValue(TableUtils.StartDateColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalDD_.StartDate field. + ''' + Public Function GetStartDateFieldValue() As DateTime + Return CType(Me.GetValue(TableUtils.StartDateColumn).ToDateTime(), DateTime) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalDD_.StartDate field. + ''' + Public Sub SetStartDateFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.StartDateColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalDD_.StartDate field. + ''' + Public Sub SetStartDateFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.StartDateColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalDD_.StartDate field. + ''' + Public Sub SetStartDateFieldValue(ByVal val As DateTime) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.StartDateColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalDD_.EndDate field. + ''' + Public Function GetEndDateValue() As ColumnValue + Return Me.GetValue(TableUtils.EndDateColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalDD_.EndDate field. + ''' + Public Function GetEndDateFieldValue() As DateTime + Return CType(Me.GetValue(TableUtils.EndDateColumn).ToDateTime(), DateTime) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalDD_.EndDate field. + ''' + Public Sub SetEndDateFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.EndDateColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalDD_.EndDate field. + ''' + Public Sub SetEndDateFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.EndDateColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalDD_.EndDate field. + ''' + Public Sub SetEndDateFieldValue(ByVal val As DateTime) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.EndDateColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalDD_.Mission field. + ''' + Public Function GetMissionValue() As ColumnValue + Return Me.GetValue(TableUtils.MissionColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalDD_.Mission field. + ''' + Public Function GetMissionFieldValue() As String + Return CType(Me.GetValue(TableUtils.MissionColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalDD_.Mission field. + ''' + Public Sub SetMissionFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.MissionColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalDD_.Mission field. + ''' + Public Sub SetMissionFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.MissionColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalDD_.Ref field. + ''' + Public Function GetRef0Value() As ColumnValue + Return Me.GetValue(TableUtils.Ref0Column) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalDD_.Ref field. + ''' + Public Function GetRef0FieldValue() As String + Return CType(Me.GetValue(TableUtils.Ref0Column).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalDD_.Ref field. + ''' + Public Sub SetRef0FieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.Ref0Column) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalDD_.Ref field. + ''' + Public Sub SetRef0FieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.Ref0Column) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalDD_.RefDate field. + ''' + Public Function GetRefDateValue() As ColumnValue + Return Me.GetValue(TableUtils.RefDateColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalDD_.RefDate field. + ''' + Public Function GetRefDateFieldValue() As DateTime + Return CType(Me.GetValue(TableUtils.RefDateColumn).ToDateTime(), DateTime) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalDD_.RefDate field. + ''' + Public Sub SetRefDateFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.RefDateColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalDD_.RefDate field. + ''' + Public Sub SetRefDateFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.RefDateColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalDD_.RefDate field. + ''' + Public Sub SetRefDateFieldValue(ByVal val As DateTime) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.RefDateColumn) + End Sub + + + +#End Region + +#Region "Convenience methods to get field names" + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonalDD_.id field. + ''' + Public Property id0() As Int32 + Get + Return CType(Me.GetValue(TableUtils.id0Column).ToInt32(), Int32) + End Get + Set (ByVal val As Int32) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.id0Column) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property id0Specified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.id0Column) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property id0Default() As String + Get + Return TableUtils.id0Column.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonalDD_.PersonalId field. + ''' + Public Property PersonalId() As String + Get + Return CType(Me.GetValue(TableUtils.PersonalIdColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.PersonalIdColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property PersonalIdSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.PersonalIdColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property PersonalIdDefault() As String + Get + Return TableUtils.PersonalIdColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonalDD_.StartDate field. + ''' + Public Property StartDate() As DateTime + Get + Return CType(Me.GetValue(TableUtils.StartDateColumn).ToDateTime(), DateTime) + End Get + Set (ByVal val As DateTime) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.StartDateColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property StartDateSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.StartDateColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property StartDateDefault() As String + Get + Return TableUtils.StartDateColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonalDD_.EndDate field. + ''' + Public Property EndDate() As DateTime + Get + Return CType(Me.GetValue(TableUtils.EndDateColumn).ToDateTime(), DateTime) + End Get + Set (ByVal val As DateTime) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.EndDateColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property EndDateSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.EndDateColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property EndDateDefault() As String + Get + Return TableUtils.EndDateColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonalDD_.Mission field. + ''' + Public Property Mission() As String + Get + Return CType(Me.GetValue(TableUtils.MissionColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.MissionColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property MissionSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.MissionColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property MissionDefault() As String + Get + Return TableUtils.MissionColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonalDD_.Ref field. + ''' + Public Property Ref0() As String + Get + Return CType(Me.GetValue(TableUtils.Ref0Column).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.Ref0Column) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property Ref0Specified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.Ref0Column) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property Ref0Default() As String + Get + Return TableUtils.Ref0Column.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonalDD_.RefDate field. + ''' + Public Property RefDate() As DateTime + Get + Return CType(Me.GetValue(TableUtils.RefDateColumn).ToDateTime(), DateTime) + End Get + Set (ByVal val As DateTime) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.RefDateColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property RefDateSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.RefDateColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property RefDateDefault() As String + Get + Return TableUtils.RefDateColumn.DefaultValue + End Get + End Property + + + +#End Region + +End Class +End Namespace diff --git a/App_Code/Business Layer/BasePersonalDDTable.vb b/App_Code/Business Layer/BasePersonalDDTable.vb new file mode 100644 index 0000000..0246621 --- /dev/null +++ b/App_Code/Business Layer/BasePersonalDDTable.vb @@ -0,0 +1,886 @@ +' This class is "generated" and will be overwritten. +' Your customizations should be made in PersonalDDRecord.vb + +Imports System.Data.SqlTypes +Imports System.Data +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider +Imports Persons.Data + +Namespace Persons.Business + +''' +''' The generated superclass for the class. +''' Provides access to the schema information and record data of a database table or view named PersonalDD. +''' +''' +''' The connection details (name, location, etc.) of the database and table (or view) accessed by this class +''' are resolved at runtime based on the connection string in the application's Web.Config file. +''' +''' This class is not intended to be instantiated directly. To obtain an instance of this class, use +''' PersonalDDTable.Instance. +''' +''' +''' + + Public Class BasePersonalDDTable + Inherits PrimaryKeyTable + + + Private ReadOnly TableDefinitionString As String = PersonalDDDefinition.GetXMLString() + + + + + + + + Protected Sub New() + MyBase.New() + Me.Initialize() + End Sub + + Protected Overridable Sub Initialize() + Dim def As New XmlTableDefinition(TableDefinitionString) + Me.TableDefinition = New TableDefinition() + Me.TableDefinition.TableClassName = System.Reflection.Assembly.CreateQualifiedName("App_Code", "Persons.Business.PersonalDDTable") + def.InitializeTableDefinition(Me.TableDefinition) + Me.ConnectionName = def.GetConnectionName() + Me.RecordClassName = System.Reflection.Assembly.CreateQualifiedName("App_Code", "Persons.Business.PersonalDDRecord") + Me.ApplicationName = "App_Code" + Me.DataAdapter = New PersonalDDSqlTable() + Directcast(Me.DataAdapter, PersonalDDSqlTable).ConnectionName = Me.ConnectionName + + Me.TableDefinition.AdapterMetaData = Me.DataAdapter.AdapterMetaData + id0Column.CodeName = "id0" + PersonalIdColumn.CodeName = "PersonalId" + StartDateColumn.CodeName = "StartDate" + EndDateColumn.CodeName = "EndDate" + MissionColumn.CodeName = "Mission" + Ref0Column.CodeName = "Ref0" + RefDateColumn.CodeName = "RefDate" + + End Sub + +#Region "Overriden methods" + + +#End Region + +#Region "Properties for columns" + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalDD_.id column object. + ''' + Public ReadOnly Property id0Column() As BaseClasses.Data.NumberColumn + Get + Return CType(Me.TableDefinition.ColumnList(0), BaseClasses.Data.NumberColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalDD_.id column object. + ''' + Public Shared ReadOnly Property id0() As BaseClasses.Data.NumberColumn + Get + Return PersonalDDTable.Instance.id0Column + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonalDD_.PersonalId column object. + ''' + Public ReadOnly Property PersonalIdColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(1), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalDD_.PersonalId column object. + ''' + Public Shared ReadOnly Property PersonalId() As BaseClasses.Data.StringColumn + Get + Return PersonalDDTable.Instance.PersonalIdColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonalDD_.StartDate column object. + ''' + Public ReadOnly Property StartDateColumn() As BaseClasses.Data.DateColumn + Get + Return CType(Me.TableDefinition.ColumnList(2), BaseClasses.Data.DateColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalDD_.StartDate column object. + ''' + Public Shared ReadOnly Property StartDate() As BaseClasses.Data.DateColumn + Get + Return PersonalDDTable.Instance.StartDateColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonalDD_.EndDate column object. + ''' + Public ReadOnly Property EndDateColumn() As BaseClasses.Data.DateColumn + Get + Return CType(Me.TableDefinition.ColumnList(3), BaseClasses.Data.DateColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalDD_.EndDate column object. + ''' + Public Shared ReadOnly Property EndDate() As BaseClasses.Data.DateColumn + Get + Return PersonalDDTable.Instance.EndDateColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonalDD_.Mission column object. + ''' + Public ReadOnly Property MissionColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(4), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalDD_.Mission column object. + ''' + Public Shared ReadOnly Property Mission() As BaseClasses.Data.StringColumn + Get + Return PersonalDDTable.Instance.MissionColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonalDD_.Ref column object. + ''' + Public ReadOnly Property Ref0Column() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(5), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalDD_.Ref column object. + ''' + Public Shared ReadOnly Property Ref0() As BaseClasses.Data.StringColumn + Get + Return PersonalDDTable.Instance.Ref0Column + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonalDD_.RefDate column object. + ''' + Public ReadOnly Property RefDateColumn() As BaseClasses.Data.DateColumn + Get + Return CType(Me.TableDefinition.ColumnList(6), BaseClasses.Data.DateColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalDD_.RefDate column object. + ''' + Public Shared ReadOnly Property RefDate() As BaseClasses.Data.DateColumn + Get + Return PersonalDDTable.Instance.RefDateColumn + End Get + End Property + + +#End Region + + +#Region "Shared helper methods" + + ''' + ''' This is a shared function that can be used to get an array of PersonalDDRecord records using a where clause. + ''' + Public Shared Function GetRecords(ByVal where As String) As PersonalDDRecord() + + Return GetRecords(where, Nothing, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) + End Function + + ''' + ''' This is a shared function that can be used to get an array of PersonalDDRecord records using a where clause. + ''' + Public Shared Function GetRecords(ByVal join As BaseFilter, ByVal where As String) As PersonalDDRecord() + + Return GetRecords(join, where, Nothing, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) + End Function + + ''' + ''' This is a shared function that can be used to get an array of PersonalDDRecord records using a where and order by clause. + ''' + Public Shared Function GetRecords( _ + ByVal where As String, _ + ByVal orderBy As OrderBy) As PersonalDDRecord() + + Return GetRecords(where, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) + End Function + + ''' + ''' This is a shared function that can be used to get an array of PersonalDDRecord records using a where and order by clause. + ''' + Public Shared Function GetRecords( _ + ByVal join As BaseFilter, _ + ByVal where As String, _ + ByVal orderBy As OrderBy) As PersonalDDRecord() + + Return GetRecords(join, where, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) + End Function + + ''' + ''' This is a shared function that can be used to get an array of PersonalDDRecord records using a where and order by clause clause with pagination. + ''' + Public Shared Function GetRecords( _ + ByVal where As String, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As PersonalDDRecord() + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + Dim join As BaseClasses.Data.BaseFilter = Nothing + Dim recList As ArrayList = PersonalDDTable.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, pageIndex, pageSize) + + Return CType(recList.ToArray(GetType(Persons.Business.PersonalDDRecord)), PersonalDDRecord()) + End Function + + ''' + ''' This is a shared function that can be used to get an array of PersonalDDRecord records using a where and order by clause clause with pagination. + ''' + Public Shared Function GetRecords( _ + ByVal join As BaseFilter, _ + ByVal where As String, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As PersonalDDRecord() + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Dim recList As ArrayList = PersonalDDTable.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, pageIndex, pageSize) + + Return CType(recList.ToArray(GetType(Persons.Business.PersonalDDRecord)), PersonalDDRecord()) + End Function + + Public Shared Function GetRecords( _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As PersonalDDRecord() + Dim join As BaseClasses.Data.BaseFilter = Nothing + Dim recList As ArrayList = PersonalDDTable.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + Return CType(recList.ToArray(GetType(Persons.Business.PersonalDDRecord)), PersonalDDRecord()) + End Function + + Public Shared Function GetRecords( _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As PersonalDDRecord() + + Dim recList As ArrayList = PersonalDDTable.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + Return CType(recList.ToArray(GetType(Persons.Business.PersonalDDRecord)), PersonalDDRecord()) + End Function + + Public Shared Function GetRecords( _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer, _ + ByRef totalRecords As Integer) As PersonalDDRecord() + Dim join As BaseClasses.Data.BaseFilter = Nothing + Dim recList As ArrayList = PersonalDDTable.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize, totalRecords) + + Return CType(recList.ToArray(GetType(Persons.Business.PersonalDDRecord)), PersonalDDRecord()) + End Function + + Public Shared Function GetRecords( _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer, _ + ByRef totalRecords As Integer) As PersonalDDRecord() + + Dim recList As ArrayList = PersonalDDTable.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize, totalRecords) + + Return CType(recList.ToArray(GetType(Persons.Business.PersonalDDRecord)), PersonalDDRecord()) + End Function + + ''' + ''' This is a shared function that can be used to get total number of records that will be returned using the where clause. + ''' + Public Shared Function GetRecordCount(ByVal where As String) As Integer + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Return CInt(PersonalDDTable.Instance.GetRecordListCount(Nothing, whereFilter, Nothing, Nothing)) + End Function + +''' + ''' This is a shared function that can be used to get total number of records that will be returned using the where clause. + ''' + Public Shared Function GetRecordCount(ByVal join As BaseFilter, ByVal where As String) As Integer + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Return CInt(PersonalDDTable.Instance.GetRecordListCount(join, whereFilter, Nothing, Nothing)) + End Function + + Public Shared Function GetRecordCount(ByVal where As WhereClause) As Integer + Return CInt(PersonalDDTable.Instance.GetRecordListCount(Nothing, where.GetFilter(), Nothing, Nothing)) + End Function + + Public Shared Function GetRecordCount(ByVal join As BaseFilter, ByVal where As WhereClause) As Integer + Return CInt(PersonalDDTable.Instance.GetRecordListCount(join, where.GetFilter(), Nothing, Nothing)) + End Function + + ''' + ''' This is a shared function that can be used to get a PersonalDDRecord record using a where clause. + ''' + Public Shared Function GetRecord(ByVal where As String) As PersonalDDRecord + Dim orderBy As OrderBy = Nothing + Return GetRecord(where, orderBy) + End Function + + ''' + ''' This is a shared function that can be used to get a PersonalDDRecord record using a where clause. + ''' + Public Shared Function GetRecord(ByVal join As BaseFilter, ByVal where As String) As PersonalDDRecord + Dim orderBy As OrderBy = Nothing + Return GetRecord(join, where, orderBy) + End Function + + ''' + ''' This is a shared function that can be used to get a PersonalDDRecord record using a where and order by clause. + ''' + Public Shared Function GetRecord( _ + ByVal where As String, _ + ByVal orderBy As OrderBy) As PersonalDDRecord + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + Dim join As BaseClasses.Data.BaseFilter = Nothing + Dim recList As ArrayList = PersonalDDTable.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MIN_BATCH_SIZE) + + Dim rec As PersonalDDRecord = Nothing + If recList.Count > 0 Then + rec = CType(recList(0), PersonalDDRecord) + End If + + Return rec + End Function + + ''' + ''' This is a shared function that can be used to get a PersonalDDRecord record using a where and order by clause. + ''' + Public Shared Function GetRecord( _ + ByVal join As BaseFilter, _ + ByVal where As String, _ + ByVal orderBy As OrderBy) As PersonalDDRecord + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Dim recList As ArrayList = PersonalDDTable.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MIN_BATCH_SIZE) + + Dim rec As PersonalDDRecord = Nothing + If recList.Count > 0 Then + rec = CType(recList(0), PersonalDDRecord) + End If + + Return rec + End Function + + + Public Shared Function GetValues( _ + ByVal col As BaseColumn, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal maxItems As Integer) As String() + + ' Create the filter list. + Dim retCol As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, True) + retCol.AddColumn(col) + + Return PersonalDDTable.Instance.GetColumnValues(retCol, Nothing, where.GetFilter(), Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, maxItems) + + End Function + + Public Shared Function GetValues( _ + ByVal col As BaseColumn, _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal maxItems As Integer) As String() + + ' Create the filter list. + Dim retCol As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, True) + retCol.AddColumn(col) + + Return PersonalDDTable.Instance.GetColumnValues(retCol, join, where.GetFilter(), Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, maxItems) + + End Function + + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where clause. + ''' + Public Shared Function GetDataTable(ByVal where As String) As System.Data.DataTable + + Dim recs() As PersonalDDRecord = GetRecords(where) + Return PersonalDDTable.Instance.CreateDataTable(recs, Nothing) + End Function + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where clause. + ''' + Public Shared Function GetDataTable(ByVal join As BaseFilter, ByVal where As String) As System.Data.DataTable + + Dim recs() As PersonalDDRecord = GetRecords(join, where) + Return PersonalDDTable.Instance.CreateDataTable(recs, Nothing) + End Function + + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause. + ''' + Public Shared Function GetDataTable(ByVal where As String, ByVal orderBy As OrderBy) As System.Data.DataTable + + Dim recs() As PersonalDDRecord = GetRecords(where, orderBy) + Return PersonalDDTable.Instance.CreateDataTable(recs, Nothing) + End Function + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause. + ''' + Public Shared Function GetDataTable(ByVal join As BaseFilter, ByVal where As String, ByVal orderBy As OrderBy) As System.Data.DataTable + + Dim recs() As PersonalDDRecord = GetRecords(join, where, orderBy) + Return PersonalDDTable.Instance.CreateDataTable(recs, Nothing) + End Function + + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause with pagination. + ''' + Public Shared Function GetDataTable( _ + ByVal where As String, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As System.Data.DataTable + + Dim recs() As PersonalDDRecord = GetRecords(where, orderBy, pageIndex, pageSize) + Return PersonalDDTable.Instance.CreateDataTable(recs, Nothing) + End Function + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause with pagination. + ''' + Public Shared Function GetDataTable( _ + ByVal join As BaseFilter, _ + ByVal where As String, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As System.Data.DataTable + + Dim recs() As PersonalDDRecord = GetRecords(join, where, orderBy, pageIndex, pageSize) + Return PersonalDDTable.Instance.CreateDataTable(recs, Nothing) + End Function + + + ''' + ''' This is a shared function that can be used to delete records using a where clause. + ''' + Public Shared Sub DeleteRecords(ByVal where As String) + If where = Nothing OrElse where.Trim() = "" Then + Return + End If + + Dim whereFilter As SqlFilter = New SqlFilter(where) + PersonalDDTable.Instance.DeleteRecordList(whereFilter) + End Sub + + ''' + ''' This is a shared function that can be used to export records using a where clause. + ''' + Public Shared Function Export(ByVal where As String) As String + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Return PersonalDDTable.Instance.ExportRecordData(whereFilter) + End Function + + Public Shared Function Export(ByVal where As WhereClause) As String + Dim whereFilter As BaseFilter = Nothing + If Not where Is Nothing Then + whereFilter = where.GetFilter() + End If + + Return PersonalDDTable.Instance.ExportRecordData(whereFilter) + End Function + + Public Shared Function GetSum( _ + ByVal col As BaseColumn, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) _ + As String + + Dim colSel As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, False) + colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Sum) + + Return PersonalDDTable.Instance.GetColumnStatistics(colSel, Nothing, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + End Function + + Public Shared Function GetSum( _ + ByVal col As BaseColumn, _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) _ + As String + + Dim colSel As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, False) + colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Sum) + + Return PersonalDDTable.Instance.GetColumnStatistics(colSel, join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + End Function + + + Public Shared Function GetCount( _ + ByVal col As BaseColumn, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) _ + As String + + Dim colSel As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, False) + colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Count) + + Return PersonalDDTable.Instance.GetColumnStatistics(colSel, Nothing, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + End Function + + Public Shared Function GetCount( _ + ByVal col As BaseColumn, _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) _ + As String + + Dim colSel As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, False) + colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Count) + + Return PersonalDDTable.Instance.GetColumnStatistics(colSel, join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + End Function + + ''' + ''' This method returns the columns in the table. + ''' + Public Shared Function GetColumns() As BaseColumn() + Return PersonalDDTable.Instance.TableDefinition.Columns + End Function + + ''' + ''' This method returns the columnlist in the table. + ''' + Public Shared Function GetColumnList() As ColumnList + Return PersonalDDTable.Instance.TableDefinition.ColumnList + End Function + + + ''' + ''' This method creates a new record and returns it to be edited. + ''' + Public Shared Function CreateNewRecord() As IRecord + Return PersonalDDTable.Instance.CreateRecord() + End Function + + ''' + ''' This method creates a new record and returns it to be edited. + ''' + ''' ID of the new record. + Public Shared Function CreateNewRecord(ByVal tempId As String) As IRecord + Return PersonalDDTable.Instance.CreateRecord(tempId) + End Function + + ''' + ''' This method checks if column is editable. + ''' + ''' Name of the column to check. + Public Shared Function isReadOnlyColumn(ByVal columnName As String) As Boolean + Dim column As BaseColumn = GetColumn(columnName) + If (Not IsNothing(column)) Then + Return column.IsValuesReadOnly + Else + Return True + End If + End Function + + ''' + ''' This method gets the specified column. + ''' + ''' Unique name of the column to fetch. + Public Shared Function GetColumn(ByVal uniqueColumnName As String) As BaseColumn + Dim column As BaseColumn = PersonalDDTable.Instance.TableDefinition.ColumnList.GetByUniqueName(uniqueColumnName) + Return column + End Function + + ' Convenience method for getting a record using a string-based record identifier + Public Shared Function GetRecord(ByVal id As String, ByVal bMutable As Boolean) As PersonalDDRecord + Return CType(PersonalDDTable.Instance.GetRecordData(id, bMutable), PersonalDDRecord) + End Function + + ' Convenience method for getting a record using a KeyValue record identifier + Public Shared Function GetRecord(ByVal id As KeyValue, ByVal bMutable As Boolean) As PersonalDDRecord + Return CType(PersonalDDTable.Instance.GetRecordData(id, bMutable), PersonalDDRecord) + End Function + + ' Convenience method for creating a record + Public Overloads Function NewRecord( _ + ByVal PersonalIdValue As String, _ + ByVal StartDateValue As String, _ + ByVal EndDateValue As String, _ + ByVal MissionValue As String, _ + ByVal Ref0Value As String, _ + ByVal RefDateValue As String _ + ) As KeyValue + Dim rec As IPrimaryKeyRecord = CType(Me.CreateRecord(), IPrimaryKeyRecord) + rec.SetString(PersonalIdValue, PersonalIdColumn) + rec.SetString(StartDateValue, StartDateColumn) + rec.SetString(EndDateValue, EndDateColumn) + rec.SetString(MissionValue, MissionColumn) + rec.SetString(Ref0Value, Ref0Column) + rec.SetString(RefDateValue, RefDateColumn) + + + rec.Create() 'update the DB so any DB-initialized fields (like autoincrement IDs) can be initialized + + Dim key As KeyValue = rec.GetID() + Return key + End Function + + ''' + ''' This method deletes a specified record + ''' + ''' Keyvalue of the record to be deleted. + Public Shared Sub DeleteRecord(ByVal kv As KeyValue) + PersonalDDTable.Instance.DeleteOneRecord(kv) + End Sub + + ''' + ''' This method checks if record exist in the database using the keyvalue provided. + ''' + ''' Key value of the record. + Public Shared Function DoesRecordExist(ByVal kv As KeyValue) As Boolean + Dim recordExist As Boolean = True + Try + PersonalDDTable.GetRecord(kv, False) + Catch ex As Exception + recordExist = False + End Try + Return recordExist + End Function + + ''' + ''' This method returns all the primary columns in the table. + ''' + Public Shared Function GetPrimaryKeyColumns() As ColumnList + If (Not IsNothing(PersonalDDTable.Instance.TableDefinition.PrimaryKey)) Then + Return PersonalDDTable.Instance.TableDefinition.PrimaryKey.Columns + Else + Return Nothing + End If + End Function + + ''' + ''' This method takes a key and returns a keyvalue. + ''' + ''' key could be array of primary key values in case of composite primary key or a string containing single primary key value in case of non-composite primary key. + Public Shared Function GetKeyValue(ByVal key As Object) As KeyValue + Dim kv As KeyValue = Nothing + + If (Not (IsNothing(PersonalDDTable.Instance.TableDefinition.PrimaryKey))) Then + + Dim isCompositePrimaryKey As Boolean = False + isCompositePrimaryKey = PersonalDDTable.Instance.TableDefinition.PrimaryKey.IsCompositeKey + + If ((isCompositePrimaryKey) AndAlso (key.GetType.IsArray())) Then + + ' If the key is composite, then construct a key value. + kv = New KeyValue + Dim fullKeyString As String = "" + Dim keyArray As Array = CType(key, Array) + If (Not IsNothing(keyArray)) Then + Dim length As Integer = keyArray.Length + Dim pkColumns As ColumnList = PersonalDDTable.Instance.TableDefinition.PrimaryKey.Columns + Dim pkColumn As BaseColumn + Dim index As Integer = 0 + For Each pkColumn In pkColumns + Dim keyString As String = CType(keyArray.GetValue(index), String) + If (PersonalDDTable.Instance.TableDefinition.TableType = BaseClasses.Data.TableDefinition.TableTypes.Virtual) Then + kv.AddElement(pkColumn.UniqueName, keyString) + Else + kv.AddElement(pkColumn.InternalName, keyString) + End If + index = index + 1 + Next pkColumn + End If + + Else + ' If the key is not composite, then get the key value. + kv = PersonalDDTable.Instance.TableDefinition.PrimaryKey.ParseValue(CType(key, String)) + End If + End If + Return kv + End Function + + + ''' + ''' This method takes a record and a Column and returns an evaluated value of DFKA formula. + ''' + Public Shared Function GetDFKA(ByVal rec As BaseRecord, ByVal col As BaseColumn) As String + Dim fkColumn As ForeignKey = PersonalDDTable.Instance.TableDefinition.GetExpandableNonCompositeForeignKey(col) + If fkColumn Is Nothing Then + Return Nothing + End If + Dim _DFKA As String = fkColumn.PrimaryKeyDisplayColumns + If (_DFKA.Trim().StartsWith("=")) Then + ' if the formula is in the format of "= ., then pull out the data from the rec object instead of doing formula evaluation + Dim tableCodeName As String = fkColumn.PrimaryKeyTableDefinition.TableCodeName + Dim column As String = _DFKA.Trim("="c).Trim() + If column.StartsWith(tableCodeName & ".", StringComparison.InvariantCultureIgnoreCase) Then + column = column.Substring(tableCodeName.Length + 1) + End If + + For Each c As BaseColumn In fkColumn.PrimaryKeyTableDefinition.Columns + If column = c.CodeName Then + Return rec.Format(c) + End If + Next + Dim tableName As String = fkColumn.PrimaryKeyTableDefinition.TableCodeName + Return EvaluateFormula(_DFKA, rec, Nothing, tableName) + Else + Return Nothing + End If + End Function + + ''' + ''' This method takes a keyValue and a Column and returns an evaluated value of DFKA formula. + ''' + Public Shared Function GetDFKA(ByVal keyValue As String, ByVal col As BaseColumn, ByVal formatPattern as String) As String + If keyValue Is Nothing Then + Return Nothing + End If + Dim fkColumn As ForeignKey = PersonalDDTable.Instance.TableDefinition.GetExpandableNonCompositeForeignKey(col) + If fkColumn Is Nothing Then + Return Nothing + End If + Dim _DFKA As String = fkColumn.PrimaryKeyDisplayColumns + If (_DFKA.Trim().StartsWith("=")) Then + Dim tableName As String = fkColumn.PrimaryKeyTableDefinition.TableCodeName + Dim t As PrimaryKeyTable = CType(DatabaseObjects.GetTableObject(tableName), PrimaryKeyTable) + Dim rec As BaseRecord = Nothing + If Not t Is Nothing Then + Try + rec = CType(t.GetRecordData(keyValue, False), BaseRecord) + Catch + rec = Nothing + End Try + End If + If rec Is Nothing Then + Return "" + End If + + ' if the formula is in the format of "= ., then pull out the data from the rec object instead of doing formula evaluation + Dim tableCodeName As String = fkColumn.PrimaryKeyTableDefinition.TableCodeName + Dim column As String = _DFKA.Trim("="c).Trim() + If column.StartsWith(tableCodeName & ".", StringComparison.InvariantCultureIgnoreCase) Then + column = column.Substring(tableCodeName.Length + 1) + End If + + For Each c As BaseColumn In fkColumn.PrimaryKeyTableDefinition.Columns + If column = c.CodeName Then + Return rec.Format(c) + End If + Next + Return EvaluateFormula(_DFKA, rec, Nothing, tableName) + Else + Return Nothing + End If + End Function + + ''' + ''' Evaluates the formula + ''' + Public Shared Function EvaluateFormula(ByVal formula As String, Optional ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord = Nothing, Optional ByVal format As String = Nothing, Optional ByVal name As String = "") As String + Dim e As BaseFormulaEvaluator = New BaseFormulaEvaluator() + If Not dataSourceForEvaluate Is Nothing Then + e.Evaluator.Variables.Add(name, dataSourceForEvaluate) + end if + e.DataSource = dataSourceForEvaluate + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + If Not String.IsNullOrEmpty(format) Then + Return BaseFormulaUtils.Format(resultObj, format) + Else + Return resultObj.ToString() + End If + End Function + + +#End Region + +End Class +End Namespace diff --git a/App_Code/Business Layer/BasePersonalDailyJobRecord.vb b/App_Code/Business Layer/BasePersonalDailyJobRecord.vb new file mode 100644 index 0000000..0b64f5d --- /dev/null +++ b/App_Code/Business Layer/BasePersonalDailyJobRecord.vb @@ -0,0 +1,533 @@ +' This class is "generated" and will be overwritten. +' Your customizations should be made in PersonalDailyJobRecord.vb + +Imports System.Data.SqlTypes +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + +Namespace Persons.Business + +''' +''' The generated superclass for the class. +''' +''' +''' This class is not intended to be instantiated directly. To obtain an instance of this class, +''' use the methods of the class. +''' +''' +''' + + Public Class BasePersonalDailyJobRecord + Inherits PrimaryKeyRecord + + + Public Shared Shadows ReadOnly TableUtils As PersonalDailyJobTable = PersonalDailyJobTable.Instance + + ' Constructors + + Protected Sub New() + MyBase.New(TableUtils) + End Sub + + Protected Sub New(ByVal record As PrimaryKeyRecord) + MyBase.New(record, TableUtils) + End Sub + + 'Evaluates Initialize when->Inserting record formulas specified at the data access layer + Public Overridable Sub PersonalDailyJobRecord_InsertingRecord(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles Me.InsertingRecord + 'Apply Initialize->Inserting record formula only if validation is successful. + Dim PersonalDailyJobRec As PersonalDailyJobRecord = CType(sender,PersonalDailyJobRecord) + Validate_Inserting() + If Not PersonalDailyJobRec Is Nothing AndAlso Not PersonalDailyJobRec.IsReadOnly Then + End If + End Sub + + 'Evaluates Initialize when->Updating record formulas specified at the data access layer + Public Overridable Sub PersonalDailyJobRecord_UpdatingRecord(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles Me.UpdatingRecord + 'Apply Initialize->Updating record formula only if validation is successful. + Dim PersonalDailyJobRec As PersonalDailyJobRecord = CType(sender,PersonalDailyJobRecord) + Validate_Updating() + If Not PersonalDailyJobRec Is Nothing AndAlso Not PersonalDailyJobRec.IsReadOnly Then + End If + End Sub + + 'Evaluates Initialize when->Reading record formulas specified at the data access layer + Public Overridable Sub PersonalDailyJobRecord_ReadRecord(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.ReadRecord + 'Apply Initialize->Reading record formula only if validation is successful. + Dim PersonalDailyJobRec As PersonalDailyJobRecord = CType(sender,PersonalDailyJobRecord) + If Not PersonalDailyJobRec Is Nothing AndAlso Not PersonalDailyJobRec.IsReadOnly Then + End If + End Sub + + 'Evaluates Validate when->Inserting formulas specified at the data access layer + Public Overridable Sub Validate_Inserting () + Dim fullValidationMessage As String = "" + Dim validationMessage As String = "" + + dim formula as String = "" + + + If validationMessage <> "" AndAlso validationMessage.ToLower() <> "true" Then + fullValidationMessage &= validationMessage & vbCrLf + End If + + If fullValidationMessage <> "" Then + Throw New Exception(fullValidationMessage) + End If + End Sub + + 'Evaluates Validate when->Updating formulas specified at the data access layer + Public Overridable Sub Validate_Updating () + Dim fullValidationMessage As String = "" + Dim validationMessage As String = "" + + dim formula as String = "" + + + If validationMessage <> "" AndAlso validationMessage.ToLower() <> "true" Then + fullValidationMessage &= validationMessage & vbCrLf + End If + + If fullValidationMessage <> "" Then + Throw New Exception(fullValidationMessage) + End If + End Sub + + Public Overridable Function EvaluateFormula(ByVal formula As String, Optional ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord = Nothing, Optional ByVal format As String = Nothing) As String + + Dim e As Data.BaseFormulaEvaluator = New Data.BaseFormulaEvaluator() + + ' All variables referred to in the formula are expected to be + ' properties of the DataSource. For example, referring to + ' UnitPrice as a variable will refer to DataSource.UnitPrice + e.DataSource = dataSourceForEvaluate + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + Return resultObj.ToString() + End Function + + + + + + + +#Region "Convenience methods to get/set values of fields" + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalDailyJob_.id field. + ''' + Public Function Getid0Value() As ColumnValue + Return Me.GetValue(TableUtils.id0Column) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalDailyJob_.id field. + ''' + Public Function Getid0FieldValue() As Int32 + Return CType(Me.GetValue(TableUtils.id0Column).ToInt32(), Int32) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalDailyJob_.PersonalId field. + ''' + Public Function GetPersonalIdValue() As ColumnValue + Return Me.GetValue(TableUtils.PersonalIdColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalDailyJob_.PersonalId field. + ''' + Public Function GetPersonalIdFieldValue() As String + Return CType(Me.GetValue(TableUtils.PersonalIdColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalDailyJob_.PersonalId field. + ''' + Public Sub SetPersonalIdFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.PersonalIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalDailyJob_.PersonalId field. + ''' + Public Sub SetPersonalIdFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.PersonalIdColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalDailyJob_.Job field. + ''' + Public Function GetJobValue() As ColumnValue + Return Me.GetValue(TableUtils.JobColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalDailyJob_.Job field. + ''' + Public Function GetJobFieldValue() As String + Return CType(Me.GetValue(TableUtils.JobColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalDailyJob_.Job field. + ''' + Public Sub SetJobFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.JobColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalDailyJob_.Job field. + ''' + Public Sub SetJobFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.JobColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalDailyJob_.AbsentId field. + ''' + Public Function GetAbsentIdValue() As ColumnValue + Return Me.GetValue(TableUtils.AbsentIdColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalDailyJob_.AbsentId field. + ''' + Public Function GetAbsentIdFieldValue() As Byte + Return CType(Me.GetValue(TableUtils.AbsentIdColumn).ToByte(), Byte) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalDailyJob_.AbsentId field. + ''' + Public Sub SetAbsentIdFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.AbsentIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalDailyJob_.AbsentId field. + ''' + Public Sub SetAbsentIdFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.AbsentIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalDailyJob_.AbsentId field. + ''' + Public Sub SetAbsentIdFieldValue(ByVal val As Double) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.AbsentIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalDailyJob_.AbsentId field. + ''' + Public Sub SetAbsentIdFieldValue(ByVal val As Decimal) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.AbsentIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalDailyJob_.AbsentId field. + ''' + Public Sub SetAbsentIdFieldValue(ByVal val As Int64) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.AbsentIdColumn) + End Sub + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalDailyJob_.JobDate field. + ''' + Public Function GetJobDateValue() As ColumnValue + Return Me.GetValue(TableUtils.JobDateColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalDailyJob_.JobDate field. + ''' + Public Function GetJobDateFieldValue() As DateTime + Return CType(Me.GetValue(TableUtils.JobDateColumn).ToDateTime(), DateTime) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalDailyJob_.JobDate field. + ''' + Public Sub SetJobDateFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.JobDateColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalDailyJob_.JobDate field. + ''' + Public Sub SetJobDateFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.JobDateColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalDailyJob_.JobDate field. + ''' + Public Sub SetJobDateFieldValue(ByVal val As DateTime) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.JobDateColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalDailyJob_.Remark field. + ''' + Public Function GetRemarkValue() As ColumnValue + Return Me.GetValue(TableUtils.RemarkColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalDailyJob_.Remark field. + ''' + Public Function GetRemarkFieldValue() As String + Return CType(Me.GetValue(TableUtils.RemarkColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalDailyJob_.Remark field. + ''' + Public Sub SetRemarkFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.RemarkColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalDailyJob_.Remark field. + ''' + Public Sub SetRemarkFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.RemarkColumn) + End Sub + + + +#End Region + +#Region "Convenience methods to get field names" + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonalDailyJob_.id field. + ''' + Public Property id0() As Int32 + Get + Return CType(Me.GetValue(TableUtils.id0Column).ToInt32(), Int32) + End Get + Set (ByVal val As Int32) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.id0Column) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property id0Specified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.id0Column) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property id0Default() As String + Get + Return TableUtils.id0Column.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonalDailyJob_.PersonalId field. + ''' + Public Property PersonalId() As String + Get + Return CType(Me.GetValue(TableUtils.PersonalIdColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.PersonalIdColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property PersonalIdSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.PersonalIdColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property PersonalIdDefault() As String + Get + Return TableUtils.PersonalIdColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonalDailyJob_.Job field. + ''' + Public Property Job() As String + Get + Return CType(Me.GetValue(TableUtils.JobColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.JobColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property JobSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.JobColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property JobDefault() As String + Get + Return TableUtils.JobColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonalDailyJob_.AbsentId field. + ''' + Public Property AbsentId() As Byte + Get + Return CType(Me.GetValue(TableUtils.AbsentIdColumn).ToByte(), Byte) + End Get + Set (ByVal val As Byte) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.AbsentIdColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property AbsentIdSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.AbsentIdColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property AbsentIdDefault() As String + Get + Return TableUtils.AbsentIdColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonalDailyJob_.JobDate field. + ''' + Public Property JobDate() As DateTime + Get + Return CType(Me.GetValue(TableUtils.JobDateColumn).ToDateTime(), DateTime) + End Get + Set (ByVal val As DateTime) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.JobDateColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property JobDateSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.JobDateColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property JobDateDefault() As String + Get + Return TableUtils.JobDateColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonalDailyJob_.Remark field. + ''' + Public Property Remark() As String + Get + Return CType(Me.GetValue(TableUtils.RemarkColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.RemarkColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property RemarkSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.RemarkColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property RemarkDefault() As String + Get + Return TableUtils.RemarkColumn.DefaultValue + End Get + End Property + + + +#End Region + +End Class +End Namespace diff --git a/App_Code/Business Layer/BasePersonalDailyJobTable.vb b/App_Code/Business Layer/BasePersonalDailyJobTable.vb new file mode 100644 index 0000000..a869d78 --- /dev/null +++ b/App_Code/Business Layer/BasePersonalDailyJobTable.vb @@ -0,0 +1,864 @@ +' This class is "generated" and will be overwritten. +' Your customizations should be made in PersonalDailyJobRecord.vb + +Imports System.Data.SqlTypes +Imports System.Data +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider +Imports Persons.Data + +Namespace Persons.Business + +''' +''' The generated superclass for the class. +''' Provides access to the schema information and record data of a database table or view named PersonalDailyJob. +''' +''' +''' The connection details (name, location, etc.) of the database and table (or view) accessed by this class +''' are resolved at runtime based on the connection string in the application's Web.Config file. +''' +''' This class is not intended to be instantiated directly. To obtain an instance of this class, use +''' PersonalDailyJobTable.Instance. +''' +''' +''' + + Public Class BasePersonalDailyJobTable + Inherits PrimaryKeyTable + + + Private ReadOnly TableDefinitionString As String = PersonalDailyJobDefinition.GetXMLString() + + + + + + + + Protected Sub New() + MyBase.New() + Me.Initialize() + End Sub + + Protected Overridable Sub Initialize() + Dim def As New XmlTableDefinition(TableDefinitionString) + Me.TableDefinition = New TableDefinition() + Me.TableDefinition.TableClassName = System.Reflection.Assembly.CreateQualifiedName("App_Code", "Persons.Business.PersonalDailyJobTable") + def.InitializeTableDefinition(Me.TableDefinition) + Me.ConnectionName = def.GetConnectionName() + Me.RecordClassName = System.Reflection.Assembly.CreateQualifiedName("App_Code", "Persons.Business.PersonalDailyJobRecord") + Me.ApplicationName = "App_Code" + Me.DataAdapter = New PersonalDailyJobSqlTable() + Directcast(Me.DataAdapter, PersonalDailyJobSqlTable).ConnectionName = Me.ConnectionName + + Me.TableDefinition.AdapterMetaData = Me.DataAdapter.AdapterMetaData + id0Column.CodeName = "id0" + PersonalIdColumn.CodeName = "PersonalId" + JobColumn.CodeName = "Job" + AbsentIdColumn.CodeName = "AbsentId" + JobDateColumn.CodeName = "JobDate" + RemarkColumn.CodeName = "Remark" + + End Sub + +#Region "Overriden methods" + + +#End Region + +#Region "Properties for columns" + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalDailyJob_.id column object. + ''' + Public ReadOnly Property id0Column() As BaseClasses.Data.NumberColumn + Get + Return CType(Me.TableDefinition.ColumnList(0), BaseClasses.Data.NumberColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalDailyJob_.id column object. + ''' + Public Shared ReadOnly Property id0() As BaseClasses.Data.NumberColumn + Get + Return PersonalDailyJobTable.Instance.id0Column + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonalDailyJob_.PersonalId column object. + ''' + Public ReadOnly Property PersonalIdColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(1), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalDailyJob_.PersonalId column object. + ''' + Public Shared ReadOnly Property PersonalId() As BaseClasses.Data.StringColumn + Get + Return PersonalDailyJobTable.Instance.PersonalIdColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonalDailyJob_.Job column object. + ''' + Public ReadOnly Property JobColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(2), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalDailyJob_.Job column object. + ''' + Public Shared ReadOnly Property Job() As BaseClasses.Data.StringColumn + Get + Return PersonalDailyJobTable.Instance.JobColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonalDailyJob_.AbsentId column object. + ''' + Public ReadOnly Property AbsentIdColumn() As BaseClasses.Data.NumberColumn + Get + Return CType(Me.TableDefinition.ColumnList(3), BaseClasses.Data.NumberColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalDailyJob_.AbsentId column object. + ''' + Public Shared ReadOnly Property AbsentId() As BaseClasses.Data.NumberColumn + Get + Return PersonalDailyJobTable.Instance.AbsentIdColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonalDailyJob_.JobDate column object. + ''' + Public ReadOnly Property JobDateColumn() As BaseClasses.Data.DateColumn + Get + Return CType(Me.TableDefinition.ColumnList(4), BaseClasses.Data.DateColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalDailyJob_.JobDate column object. + ''' + Public Shared ReadOnly Property JobDate() As BaseClasses.Data.DateColumn + Get + Return PersonalDailyJobTable.Instance.JobDateColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonalDailyJob_.Remark column object. + ''' + Public ReadOnly Property RemarkColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(5), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalDailyJob_.Remark column object. + ''' + Public Shared ReadOnly Property Remark() As BaseClasses.Data.StringColumn + Get + Return PersonalDailyJobTable.Instance.RemarkColumn + End Get + End Property + + +#End Region + + +#Region "Shared helper methods" + + ''' + ''' This is a shared function that can be used to get an array of PersonalDailyJobRecord records using a where clause. + ''' + Public Shared Function GetRecords(ByVal where As String) As PersonalDailyJobRecord() + + Return GetRecords(where, Nothing, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) + End Function + + ''' + ''' This is a shared function that can be used to get an array of PersonalDailyJobRecord records using a where clause. + ''' + Public Shared Function GetRecords(ByVal join As BaseFilter, ByVal where As String) As PersonalDailyJobRecord() + + Return GetRecords(join, where, Nothing, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) + End Function + + ''' + ''' This is a shared function that can be used to get an array of PersonalDailyJobRecord records using a where and order by clause. + ''' + Public Shared Function GetRecords( _ + ByVal where As String, _ + ByVal orderBy As OrderBy) As PersonalDailyJobRecord() + + Return GetRecords(where, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) + End Function + + ''' + ''' This is a shared function that can be used to get an array of PersonalDailyJobRecord records using a where and order by clause. + ''' + Public Shared Function GetRecords( _ + ByVal join As BaseFilter, _ + ByVal where As String, _ + ByVal orderBy As OrderBy) As PersonalDailyJobRecord() + + Return GetRecords(join, where, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) + End Function + + ''' + ''' This is a shared function that can be used to get an array of PersonalDailyJobRecord records using a where and order by clause clause with pagination. + ''' + Public Shared Function GetRecords( _ + ByVal where As String, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As PersonalDailyJobRecord() + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + Dim join As BaseClasses.Data.BaseFilter = Nothing + Dim recList As ArrayList = PersonalDailyJobTable.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, pageIndex, pageSize) + + Return CType(recList.ToArray(GetType(Persons.Business.PersonalDailyJobRecord)), PersonalDailyJobRecord()) + End Function + + ''' + ''' This is a shared function that can be used to get an array of PersonalDailyJobRecord records using a where and order by clause clause with pagination. + ''' + Public Shared Function GetRecords( _ + ByVal join As BaseFilter, _ + ByVal where As String, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As PersonalDailyJobRecord() + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Dim recList As ArrayList = PersonalDailyJobTable.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, pageIndex, pageSize) + + Return CType(recList.ToArray(GetType(Persons.Business.PersonalDailyJobRecord)), PersonalDailyJobRecord()) + End Function + + Public Shared Function GetRecords( _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As PersonalDailyJobRecord() + Dim join As BaseClasses.Data.BaseFilter = Nothing + Dim recList As ArrayList = PersonalDailyJobTable.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + Return CType(recList.ToArray(GetType(Persons.Business.PersonalDailyJobRecord)), PersonalDailyJobRecord()) + End Function + + Public Shared Function GetRecords( _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As PersonalDailyJobRecord() + + Dim recList As ArrayList = PersonalDailyJobTable.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + Return CType(recList.ToArray(GetType(Persons.Business.PersonalDailyJobRecord)), PersonalDailyJobRecord()) + End Function + + Public Shared Function GetRecords( _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer, _ + ByRef totalRecords As Integer) As PersonalDailyJobRecord() + Dim join As BaseClasses.Data.BaseFilter = Nothing + Dim recList As ArrayList = PersonalDailyJobTable.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize, totalRecords) + + Return CType(recList.ToArray(GetType(Persons.Business.PersonalDailyJobRecord)), PersonalDailyJobRecord()) + End Function + + Public Shared Function GetRecords( _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer, _ + ByRef totalRecords As Integer) As PersonalDailyJobRecord() + + Dim recList As ArrayList = PersonalDailyJobTable.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize, totalRecords) + + Return CType(recList.ToArray(GetType(Persons.Business.PersonalDailyJobRecord)), PersonalDailyJobRecord()) + End Function + + ''' + ''' This is a shared function that can be used to get total number of records that will be returned using the where clause. + ''' + Public Shared Function GetRecordCount(ByVal where As String) As Integer + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Return CInt(PersonalDailyJobTable.Instance.GetRecordListCount(Nothing, whereFilter, Nothing, Nothing)) + End Function + +''' + ''' This is a shared function that can be used to get total number of records that will be returned using the where clause. + ''' + Public Shared Function GetRecordCount(ByVal join As BaseFilter, ByVal where As String) As Integer + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Return CInt(PersonalDailyJobTable.Instance.GetRecordListCount(join, whereFilter, Nothing, Nothing)) + End Function + + Public Shared Function GetRecordCount(ByVal where As WhereClause) As Integer + Return CInt(PersonalDailyJobTable.Instance.GetRecordListCount(Nothing, where.GetFilter(), Nothing, Nothing)) + End Function + + Public Shared Function GetRecordCount(ByVal join As BaseFilter, ByVal where As WhereClause) As Integer + Return CInt(PersonalDailyJobTable.Instance.GetRecordListCount(join, where.GetFilter(), Nothing, Nothing)) + End Function + + ''' + ''' This is a shared function that can be used to get a PersonalDailyJobRecord record using a where clause. + ''' + Public Shared Function GetRecord(ByVal where As String) As PersonalDailyJobRecord + Dim orderBy As OrderBy = Nothing + Return GetRecord(where, orderBy) + End Function + + ''' + ''' This is a shared function that can be used to get a PersonalDailyJobRecord record using a where clause. + ''' + Public Shared Function GetRecord(ByVal join As BaseFilter, ByVal where As String) As PersonalDailyJobRecord + Dim orderBy As OrderBy = Nothing + Return GetRecord(join, where, orderBy) + End Function + + ''' + ''' This is a shared function that can be used to get a PersonalDailyJobRecord record using a where and order by clause. + ''' + Public Shared Function GetRecord( _ + ByVal where As String, _ + ByVal orderBy As OrderBy) As PersonalDailyJobRecord + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + Dim join As BaseClasses.Data.BaseFilter = Nothing + Dim recList As ArrayList = PersonalDailyJobTable.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MIN_BATCH_SIZE) + + Dim rec As PersonalDailyJobRecord = Nothing + If recList.Count > 0 Then + rec = CType(recList(0), PersonalDailyJobRecord) + End If + + Return rec + End Function + + ''' + ''' This is a shared function that can be used to get a PersonalDailyJobRecord record using a where and order by clause. + ''' + Public Shared Function GetRecord( _ + ByVal join As BaseFilter, _ + ByVal where As String, _ + ByVal orderBy As OrderBy) As PersonalDailyJobRecord + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Dim recList As ArrayList = PersonalDailyJobTable.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MIN_BATCH_SIZE) + + Dim rec As PersonalDailyJobRecord = Nothing + If recList.Count > 0 Then + rec = CType(recList(0), PersonalDailyJobRecord) + End If + + Return rec + End Function + + + Public Shared Function GetValues( _ + ByVal col As BaseColumn, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal maxItems As Integer) As String() + + ' Create the filter list. + Dim retCol As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, True) + retCol.AddColumn(col) + + Return PersonalDailyJobTable.Instance.GetColumnValues(retCol, Nothing, where.GetFilter(), Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, maxItems) + + End Function + + Public Shared Function GetValues( _ + ByVal col As BaseColumn, _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal maxItems As Integer) As String() + + ' Create the filter list. + Dim retCol As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, True) + retCol.AddColumn(col) + + Return PersonalDailyJobTable.Instance.GetColumnValues(retCol, join, where.GetFilter(), Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, maxItems) + + End Function + + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where clause. + ''' + Public Shared Function GetDataTable(ByVal where As String) As System.Data.DataTable + + Dim recs() As PersonalDailyJobRecord = GetRecords(where) + Return PersonalDailyJobTable.Instance.CreateDataTable(recs, Nothing) + End Function + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where clause. + ''' + Public Shared Function GetDataTable(ByVal join As BaseFilter, ByVal where As String) As System.Data.DataTable + + Dim recs() As PersonalDailyJobRecord = GetRecords(join, where) + Return PersonalDailyJobTable.Instance.CreateDataTable(recs, Nothing) + End Function + + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause. + ''' + Public Shared Function GetDataTable(ByVal where As String, ByVal orderBy As OrderBy) As System.Data.DataTable + + Dim recs() As PersonalDailyJobRecord = GetRecords(where, orderBy) + Return PersonalDailyJobTable.Instance.CreateDataTable(recs, Nothing) + End Function + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause. + ''' + Public Shared Function GetDataTable(ByVal join As BaseFilter, ByVal where As String, ByVal orderBy As OrderBy) As System.Data.DataTable + + Dim recs() As PersonalDailyJobRecord = GetRecords(join, where, orderBy) + Return PersonalDailyJobTable.Instance.CreateDataTable(recs, Nothing) + End Function + + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause with pagination. + ''' + Public Shared Function GetDataTable( _ + ByVal where As String, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As System.Data.DataTable + + Dim recs() As PersonalDailyJobRecord = GetRecords(where, orderBy, pageIndex, pageSize) + Return PersonalDailyJobTable.Instance.CreateDataTable(recs, Nothing) + End Function + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause with pagination. + ''' + Public Shared Function GetDataTable( _ + ByVal join As BaseFilter, _ + ByVal where As String, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As System.Data.DataTable + + Dim recs() As PersonalDailyJobRecord = GetRecords(join, where, orderBy, pageIndex, pageSize) + Return PersonalDailyJobTable.Instance.CreateDataTable(recs, Nothing) + End Function + + + ''' + ''' This is a shared function that can be used to delete records using a where clause. + ''' + Public Shared Sub DeleteRecords(ByVal where As String) + If where = Nothing OrElse where.Trim() = "" Then + Return + End If + + Dim whereFilter As SqlFilter = New SqlFilter(where) + PersonalDailyJobTable.Instance.DeleteRecordList(whereFilter) + End Sub + + ''' + ''' This is a shared function that can be used to export records using a where clause. + ''' + Public Shared Function Export(ByVal where As String) As String + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Return PersonalDailyJobTable.Instance.ExportRecordData(whereFilter) + End Function + + Public Shared Function Export(ByVal where As WhereClause) As String + Dim whereFilter As BaseFilter = Nothing + If Not where Is Nothing Then + whereFilter = where.GetFilter() + End If + + Return PersonalDailyJobTable.Instance.ExportRecordData(whereFilter) + End Function + + Public Shared Function GetSum( _ + ByVal col As BaseColumn, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) _ + As String + + Dim colSel As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, False) + colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Sum) + + Return PersonalDailyJobTable.Instance.GetColumnStatistics(colSel, Nothing, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + End Function + + Public Shared Function GetSum( _ + ByVal col As BaseColumn, _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) _ + As String + + Dim colSel As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, False) + colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Sum) + + Return PersonalDailyJobTable.Instance.GetColumnStatistics(colSel, join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + End Function + + + Public Shared Function GetCount( _ + ByVal col As BaseColumn, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) _ + As String + + Dim colSel As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, False) + colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Count) + + Return PersonalDailyJobTable.Instance.GetColumnStatistics(colSel, Nothing, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + End Function + + Public Shared Function GetCount( _ + ByVal col As BaseColumn, _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) _ + As String + + Dim colSel As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, False) + colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Count) + + Return PersonalDailyJobTable.Instance.GetColumnStatistics(colSel, join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + End Function + + ''' + ''' This method returns the columns in the table. + ''' + Public Shared Function GetColumns() As BaseColumn() + Return PersonalDailyJobTable.Instance.TableDefinition.Columns + End Function + + ''' + ''' This method returns the columnlist in the table. + ''' + Public Shared Function GetColumnList() As ColumnList + Return PersonalDailyJobTable.Instance.TableDefinition.ColumnList + End Function + + + ''' + ''' This method creates a new record and returns it to be edited. + ''' + Public Shared Function CreateNewRecord() As IRecord + Return PersonalDailyJobTable.Instance.CreateRecord() + End Function + + ''' + ''' This method creates a new record and returns it to be edited. + ''' + ''' ID of the new record. + Public Shared Function CreateNewRecord(ByVal tempId As String) As IRecord + Return PersonalDailyJobTable.Instance.CreateRecord(tempId) + End Function + + ''' + ''' This method checks if column is editable. + ''' + ''' Name of the column to check. + Public Shared Function isReadOnlyColumn(ByVal columnName As String) As Boolean + Dim column As BaseColumn = GetColumn(columnName) + If (Not IsNothing(column)) Then + Return column.IsValuesReadOnly + Else + Return True + End If + End Function + + ''' + ''' This method gets the specified column. + ''' + ''' Unique name of the column to fetch. + Public Shared Function GetColumn(ByVal uniqueColumnName As String) As BaseColumn + Dim column As BaseColumn = PersonalDailyJobTable.Instance.TableDefinition.ColumnList.GetByUniqueName(uniqueColumnName) + Return column + End Function + + ' Convenience method for getting a record using a string-based record identifier + Public Shared Function GetRecord(ByVal id As String, ByVal bMutable As Boolean) As PersonalDailyJobRecord + Return CType(PersonalDailyJobTable.Instance.GetRecordData(id, bMutable), PersonalDailyJobRecord) + End Function + + ' Convenience method for getting a record using a KeyValue record identifier + Public Shared Function GetRecord(ByVal id As KeyValue, ByVal bMutable As Boolean) As PersonalDailyJobRecord + Return CType(PersonalDailyJobTable.Instance.GetRecordData(id, bMutable), PersonalDailyJobRecord) + End Function + + ' Convenience method for creating a record + Public Overloads Function NewRecord( _ + ByVal PersonalIdValue As String, _ + ByVal JobValue As String, _ + ByVal AbsentIdValue As String, _ + ByVal JobDateValue As String, _ + ByVal RemarkValue As String _ + ) As KeyValue + Dim rec As IPrimaryKeyRecord = CType(Me.CreateRecord(), IPrimaryKeyRecord) + rec.SetString(PersonalIdValue, PersonalIdColumn) + rec.SetString(JobValue, JobColumn) + rec.SetString(AbsentIdValue, AbsentIdColumn) + rec.SetString(JobDateValue, JobDateColumn) + rec.SetString(RemarkValue, RemarkColumn) + + + rec.Create() 'update the DB so any DB-initialized fields (like autoincrement IDs) can be initialized + + Dim key As KeyValue = rec.GetID() + Return key + End Function + + ''' + ''' This method deletes a specified record + ''' + ''' Keyvalue of the record to be deleted. + Public Shared Sub DeleteRecord(ByVal kv As KeyValue) + PersonalDailyJobTable.Instance.DeleteOneRecord(kv) + End Sub + + ''' + ''' This method checks if record exist in the database using the keyvalue provided. + ''' + ''' Key value of the record. + Public Shared Function DoesRecordExist(ByVal kv As KeyValue) As Boolean + Dim recordExist As Boolean = True + Try + PersonalDailyJobTable.GetRecord(kv, False) + Catch ex As Exception + recordExist = False + End Try + Return recordExist + End Function + + ''' + ''' This method returns all the primary columns in the table. + ''' + Public Shared Function GetPrimaryKeyColumns() As ColumnList + If (Not IsNothing(PersonalDailyJobTable.Instance.TableDefinition.PrimaryKey)) Then + Return PersonalDailyJobTable.Instance.TableDefinition.PrimaryKey.Columns + Else + Return Nothing + End If + End Function + + ''' + ''' This method takes a key and returns a keyvalue. + ''' + ''' key could be array of primary key values in case of composite primary key or a string containing single primary key value in case of non-composite primary key. + Public Shared Function GetKeyValue(ByVal key As Object) As KeyValue + Dim kv As KeyValue = Nothing + + If (Not (IsNothing(PersonalDailyJobTable.Instance.TableDefinition.PrimaryKey))) Then + + Dim isCompositePrimaryKey As Boolean = False + isCompositePrimaryKey = PersonalDailyJobTable.Instance.TableDefinition.PrimaryKey.IsCompositeKey + + If ((isCompositePrimaryKey) AndAlso (key.GetType.IsArray())) Then + + ' If the key is composite, then construct a key value. + kv = New KeyValue + Dim fullKeyString As String = "" + Dim keyArray As Array = CType(key, Array) + If (Not IsNothing(keyArray)) Then + Dim length As Integer = keyArray.Length + Dim pkColumns As ColumnList = PersonalDailyJobTable.Instance.TableDefinition.PrimaryKey.Columns + Dim pkColumn As BaseColumn + Dim index As Integer = 0 + For Each pkColumn In pkColumns + Dim keyString As String = CType(keyArray.GetValue(index), String) + If (PersonalDailyJobTable.Instance.TableDefinition.TableType = BaseClasses.Data.TableDefinition.TableTypes.Virtual) Then + kv.AddElement(pkColumn.UniqueName, keyString) + Else + kv.AddElement(pkColumn.InternalName, keyString) + End If + index = index + 1 + Next pkColumn + End If + + Else + ' If the key is not composite, then get the key value. + kv = PersonalDailyJobTable.Instance.TableDefinition.PrimaryKey.ParseValue(CType(key, String)) + End If + End If + Return kv + End Function + + + ''' + ''' This method takes a record and a Column and returns an evaluated value of DFKA formula. + ''' + Public Shared Function GetDFKA(ByVal rec As BaseRecord, ByVal col As BaseColumn) As String + Dim fkColumn As ForeignKey = PersonalDailyJobTable.Instance.TableDefinition.GetExpandableNonCompositeForeignKey(col) + If fkColumn Is Nothing Then + Return Nothing + End If + Dim _DFKA As String = fkColumn.PrimaryKeyDisplayColumns + If (_DFKA.Trim().StartsWith("=")) Then + ' if the formula is in the format of "= ., then pull out the data from the rec object instead of doing formula evaluation + Dim tableCodeName As String = fkColumn.PrimaryKeyTableDefinition.TableCodeName + Dim column As String = _DFKA.Trim("="c).Trim() + If column.StartsWith(tableCodeName & ".", StringComparison.InvariantCultureIgnoreCase) Then + column = column.Substring(tableCodeName.Length + 1) + End If + + For Each c As BaseColumn In fkColumn.PrimaryKeyTableDefinition.Columns + If column = c.CodeName Then + Return rec.Format(c) + End If + Next + Dim tableName As String = fkColumn.PrimaryKeyTableDefinition.TableCodeName + Return EvaluateFormula(_DFKA, rec, Nothing, tableName) + Else + Return Nothing + End If + End Function + + ''' + ''' This method takes a keyValue and a Column and returns an evaluated value of DFKA formula. + ''' + Public Shared Function GetDFKA(ByVal keyValue As String, ByVal col As BaseColumn, ByVal formatPattern as String) As String + If keyValue Is Nothing Then + Return Nothing + End If + Dim fkColumn As ForeignKey = PersonalDailyJobTable.Instance.TableDefinition.GetExpandableNonCompositeForeignKey(col) + If fkColumn Is Nothing Then + Return Nothing + End If + Dim _DFKA As String = fkColumn.PrimaryKeyDisplayColumns + If (_DFKA.Trim().StartsWith("=")) Then + Dim tableName As String = fkColumn.PrimaryKeyTableDefinition.TableCodeName + Dim t As PrimaryKeyTable = CType(DatabaseObjects.GetTableObject(tableName), PrimaryKeyTable) + Dim rec As BaseRecord = Nothing + If Not t Is Nothing Then + Try + rec = CType(t.GetRecordData(keyValue, False), BaseRecord) + Catch + rec = Nothing + End Try + End If + If rec Is Nothing Then + Return "" + End If + + ' if the formula is in the format of "= ., then pull out the data from the rec object instead of doing formula evaluation + Dim tableCodeName As String = fkColumn.PrimaryKeyTableDefinition.TableCodeName + Dim column As String = _DFKA.Trim("="c).Trim() + If column.StartsWith(tableCodeName & ".", StringComparison.InvariantCultureIgnoreCase) Then + column = column.Substring(tableCodeName.Length + 1) + End If + + For Each c As BaseColumn In fkColumn.PrimaryKeyTableDefinition.Columns + If column = c.CodeName Then + Return rec.Format(c) + End If + Next + Return EvaluateFormula(_DFKA, rec, Nothing, tableName) + Else + Return Nothing + End If + End Function + + ''' + ''' Evaluates the formula + ''' + Public Shared Function EvaluateFormula(ByVal formula As String, Optional ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord = Nothing, Optional ByVal format As String = Nothing, Optional ByVal name As String = "") As String + Dim e As BaseFormulaEvaluator = New BaseFormulaEvaluator() + If Not dataSourceForEvaluate Is Nothing Then + e.Evaluator.Variables.Add(name, dataSourceForEvaluate) + end if + e.DataSource = dataSourceForEvaluate + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + If Not String.IsNullOrEmpty(format) Then + Return BaseFormulaUtils.Format(resultObj, format) + Else + Return resultObj.ToString() + End If + End Function + + +#End Region + +End Class +End Namespace diff --git a/App_Code/Business Layer/BasePersonalEducationRecord.vb b/App_Code/Business Layer/BasePersonalEducationRecord.vb new file mode 100644 index 0000000..7303c97 --- /dev/null +++ b/App_Code/Business Layer/BasePersonalEducationRecord.vb @@ -0,0 +1,1450 @@ +' This class is "generated" and will be overwritten. +' Your customizations should be made in PersonalEducationRecord.vb + +Imports System.Data.SqlTypes +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + +Namespace Persons.Business + +''' +''' The generated superclass for the class. +''' +''' +''' This class is not intended to be instantiated directly. To obtain an instance of this class, +''' use the methods of the class. +''' +''' +''' + + Public Class BasePersonalEducationRecord + Inherits PrimaryKeyRecord + + + Public Shared Shadows ReadOnly TableUtils As PersonalEducationTable = PersonalEducationTable.Instance + + ' Constructors + + Protected Sub New() + MyBase.New(TableUtils) + End Sub + + Protected Sub New(ByVal record As PrimaryKeyRecord) + MyBase.New(record, TableUtils) + End Sub + + 'Evaluates Initialize when->Inserting record formulas specified at the data access layer + Public Overridable Sub PersonalEducationRecord_InsertingRecord(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles Me.InsertingRecord + 'Apply Initialize->Inserting record formula only if validation is successful. + Dim PersonalEducationRec As PersonalEducationRecord = CType(sender,PersonalEducationRecord) + Validate_Inserting() + If Not PersonalEducationRec Is Nothing AndAlso Not PersonalEducationRec.IsReadOnly Then + End If + End Sub + + 'Evaluates Initialize when->Updating record formulas specified at the data access layer + Public Overridable Sub PersonalEducationRecord_UpdatingRecord(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles Me.UpdatingRecord + 'Apply Initialize->Updating record formula only if validation is successful. + Dim PersonalEducationRec As PersonalEducationRecord = CType(sender,PersonalEducationRecord) + Validate_Updating() + If Not PersonalEducationRec Is Nothing AndAlso Not PersonalEducationRec.IsReadOnly Then + End If + End Sub + + 'Evaluates Initialize when->Reading record formulas specified at the data access layer + Public Overridable Sub PersonalEducationRecord_ReadRecord(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.ReadRecord + 'Apply Initialize->Reading record formula only if validation is successful. + Dim PersonalEducationRec As PersonalEducationRecord = CType(sender,PersonalEducationRecord) + If Not PersonalEducationRec Is Nothing AndAlso Not PersonalEducationRec.IsReadOnly Then + End If + End Sub + + 'Evaluates Validate when->Inserting formulas specified at the data access layer + Public Overridable Sub Validate_Inserting () + Dim fullValidationMessage As String = "" + Dim validationMessage As String = "" + + dim formula as String = "" + + + If validationMessage <> "" AndAlso validationMessage.ToLower() <> "true" Then + fullValidationMessage &= validationMessage & vbCrLf + End If + + If fullValidationMessage <> "" Then + Throw New Exception(fullValidationMessage) + End If + End Sub + + 'Evaluates Validate when->Updating formulas specified at the data access layer + Public Overridable Sub Validate_Updating () + Dim fullValidationMessage As String = "" + Dim validationMessage As String = "" + + dim formula as String = "" + + + If validationMessage <> "" AndAlso validationMessage.ToLower() <> "true" Then + fullValidationMessage &= validationMessage & vbCrLf + End If + + If fullValidationMessage <> "" Then + Throw New Exception(fullValidationMessage) + End If + End Sub + + Public Overridable Function EvaluateFormula(ByVal formula As String, Optional ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord = Nothing, Optional ByVal format As String = Nothing) As String + + Dim e As Data.BaseFormulaEvaluator = New Data.BaseFormulaEvaluator() + + ' All variables referred to in the formula are expected to be + ' properties of the DataSource. For example, referring to + ' UnitPrice as a variable will refer to DataSource.UnitPrice + e.DataSource = dataSourceForEvaluate + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + Return resultObj.ToString() + End Function + + + + + + + +#Region "Convenience methods to get/set values of fields" + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalEducation_.EducationId field. + ''' + Public Function GetEducationIdValue() As ColumnValue + Return Me.GetValue(TableUtils.EducationIdColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalEducation_.EducationId field. + ''' + Public Function GetEducationIdFieldValue() As Int32 + Return CType(Me.GetValue(TableUtils.EducationIdColumn).ToInt32(), Int32) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalEducation_.PersonalId field. + ''' + Public Function GetPersonalIdValue() As ColumnValue + Return Me.GetValue(TableUtils.PersonalIdColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalEducation_.PersonalId field. + ''' + Public Function GetPersonalIdFieldValue() As String + Return CType(Me.GetValue(TableUtils.PersonalIdColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalEducation_.PersonalId field. + ''' + Public Sub SetPersonalIdFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.PersonalIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalEducation_.PersonalId field. + ''' + Public Sub SetPersonalIdFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.PersonalIdColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalEducation_.StartDate field. + ''' + Public Function GetStartDateValue() As ColumnValue + Return Me.GetValue(TableUtils.StartDateColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalEducation_.StartDate field. + ''' + Public Function GetStartDateFieldValue() As DateTime + Return CType(Me.GetValue(TableUtils.StartDateColumn).ToDateTime(), DateTime) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalEducation_.StartDate field. + ''' + Public Sub SetStartDateFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.StartDateColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalEducation_.StartDate field. + ''' + Public Sub SetStartDateFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.StartDateColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalEducation_.StartDate field. + ''' + Public Sub SetStartDateFieldValue(ByVal val As DateTime) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.StartDateColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalEducation_.EndDate field. + ''' + Public Function GetEndDateValue() As ColumnValue + Return Me.GetValue(TableUtils.EndDateColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalEducation_.EndDate field. + ''' + Public Function GetEndDateFieldValue() As DateTime + Return CType(Me.GetValue(TableUtils.EndDateColumn).ToDateTime(), DateTime) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalEducation_.EndDate field. + ''' + Public Sub SetEndDateFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.EndDateColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalEducation_.EndDate field. + ''' + Public Sub SetEndDateFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.EndDateColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalEducation_.EndDate field. + ''' + Public Sub SetEndDateFieldValue(ByVal val As DateTime) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.EndDateColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalEducation_.Course field. + ''' + Public Function GetCourseValue() As ColumnValue + Return Me.GetValue(TableUtils.CourseColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalEducation_.Course field. + ''' + Public Function GetCourseFieldValue() As String + Return CType(Me.GetValue(TableUtils.CourseColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalEducation_.Course field. + ''' + Public Sub SetCourseFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.CourseColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalEducation_.Course field. + ''' + Public Sub SetCourseFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.CourseColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalEducation_.CourseAbbr field. + ''' + Public Function GetCourseAbbrValue() As ColumnValue + Return Me.GetValue(TableUtils.CourseAbbrColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalEducation_.CourseAbbr field. + ''' + Public Function GetCourseAbbrFieldValue() As String + Return CType(Me.GetValue(TableUtils.CourseAbbrColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalEducation_.CourseAbbr field. + ''' + Public Sub SetCourseAbbrFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.CourseAbbrColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalEducation_.CourseAbbr field. + ''' + Public Sub SetCourseAbbrFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.CourseAbbrColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalEducation_.Institue field. + ''' + Public Function GetInstitueValue() As ColumnValue + Return Me.GetValue(TableUtils.InstitueColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalEducation_.Institue field. + ''' + Public Function GetInstitueFieldValue() As String + Return CType(Me.GetValue(TableUtils.InstitueColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalEducation_.Institue field. + ''' + Public Sub SetInstitueFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.InstitueColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalEducation_.Institue field. + ''' + Public Sub SetInstitueFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.InstitueColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalEducation_.Facultry field. + ''' + Public Function GetFacultryValue() As ColumnValue + Return Me.GetValue(TableUtils.FacultryColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalEducation_.Facultry field. + ''' + Public Function GetFacultryFieldValue() As String + Return CType(Me.GetValue(TableUtils.FacultryColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalEducation_.Facultry field. + ''' + Public Sub SetFacultryFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.FacultryColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalEducation_.Facultry field. + ''' + Public Sub SetFacultryFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.FacultryColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalEducation_.LevelId field. + ''' + Public Function GetLevelIdValue() As ColumnValue + Return Me.GetValue(TableUtils.LevelIdColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalEducation_.LevelId field. + ''' + Public Function GetLevelIdFieldValue() As Int16 + Return CType(Me.GetValue(TableUtils.LevelIdColumn).ToInt16(), Int16) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalEducation_.LevelId field. + ''' + Public Sub SetLevelIdFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.LevelIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalEducation_.LevelId field. + ''' + Public Sub SetLevelIdFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.LevelIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalEducation_.LevelId field. + ''' + Public Sub SetLevelIdFieldValue(ByVal val As Double) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.LevelIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalEducation_.LevelId field. + ''' + Public Sub SetLevelIdFieldValue(ByVal val As Decimal) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.LevelIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalEducation_.LevelId field. + ''' + Public Sub SetLevelIdFieldValue(ByVal val As Int64) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.LevelIdColumn) + End Sub + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalEducation_.EdYear field. + ''' + Public Function GetEdYearValue() As ColumnValue + Return Me.GetValue(TableUtils.EdYearColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalEducation_.EdYear field. + ''' + Public Function GetEdYearFieldValue() As String + Return CType(Me.GetValue(TableUtils.EdYearColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalEducation_.EdYear field. + ''' + Public Sub SetEdYearFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.EdYearColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalEducation_.EdYear field. + ''' + Public Sub SetEdYearFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.EdYearColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalEducation_.EducationPeriod field. + ''' + Public Function GetEducationPeriodValue() As ColumnValue + Return Me.GetValue(TableUtils.EducationPeriodColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalEducation_.EducationPeriod field. + ''' + Public Function GetEducationPeriodFieldValue() As Byte + Return CType(Me.GetValue(TableUtils.EducationPeriodColumn).ToByte(), Byte) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalEducation_.EducationPeriod field. + ''' + Public Sub SetEducationPeriodFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.EducationPeriodColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalEducation_.EducationPeriod field. + ''' + Public Sub SetEducationPeriodFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.EducationPeriodColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalEducation_.EducationPeriod field. + ''' + Public Sub SetEducationPeriodFieldValue(ByVal val As Double) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.EducationPeriodColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalEducation_.EducationPeriod field. + ''' + Public Sub SetEducationPeriodFieldValue(ByVal val As Decimal) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.EducationPeriodColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalEducation_.EducationPeriod field. + ''' + Public Sub SetEducationPeriodFieldValue(ByVal val As Int64) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.EducationPeriodColumn) + End Sub + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalEducation_.EducationType field. + ''' + Public Function GetEducationTypeValue() As ColumnValue + Return Me.GetValue(TableUtils.EducationTypeColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalEducation_.EducationType field. + ''' + Public Function GetEducationTypeFieldValue() As Byte + Return CType(Me.GetValue(TableUtils.EducationTypeColumn).ToByte(), Byte) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalEducation_.EducationType field. + ''' + Public Sub SetEducationTypeFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.EducationTypeColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalEducation_.EducationType field. + ''' + Public Sub SetEducationTypeFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.EducationTypeColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalEducation_.EducationType field. + ''' + Public Sub SetEducationTypeFieldValue(ByVal val As Double) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.EducationTypeColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalEducation_.EducationType field. + ''' + Public Sub SetEducationTypeFieldValue(ByVal val As Decimal) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.EducationTypeColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalEducation_.EducationType field. + ''' + Public Sub SetEducationTypeFieldValue(ByVal val As Int64) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.EducationTypeColumn) + End Sub + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalEducation_.COUNTRY field. + ''' + Public Function GetCOUNTRYValue() As ColumnValue + Return Me.GetValue(TableUtils.COUNTRYColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalEducation_.COUNTRY field. + ''' + Public Function GetCOUNTRYFieldValue() As Int16 + Return CType(Me.GetValue(TableUtils.COUNTRYColumn).ToInt16(), Int16) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalEducation_.COUNTRY field. + ''' + Public Sub SetCOUNTRYFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.COUNTRYColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalEducation_.COUNTRY field. + ''' + Public Sub SetCOUNTRYFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.COUNTRYColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalEducation_.COUNTRY field. + ''' + Public Sub SetCOUNTRYFieldValue(ByVal val As Double) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.COUNTRYColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalEducation_.COUNTRY field. + ''' + Public Sub SetCOUNTRYFieldValue(ByVal val As Decimal) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.COUNTRYColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalEducation_.COUNTRY field. + ''' + Public Sub SetCOUNTRYFieldValue(ByVal val As Int64) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.COUNTRYColumn) + End Sub + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalEducation_.CourseNo field. + ''' + Public Function GetCourseNoValue() As ColumnValue + Return Me.GetValue(TableUtils.CourseNoColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalEducation_.CourseNo field. + ''' + Public Function GetCourseNoFieldValue() As String + Return CType(Me.GetValue(TableUtils.CourseNoColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalEducation_.CourseNo field. + ''' + Public Sub SetCourseNoFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.CourseNoColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalEducation_.CourseNo field. + ''' + Public Sub SetCourseNoFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.CourseNoColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalEducation_.ScoreNo field. + ''' + Public Function GetScoreNoValue() As ColumnValue + Return Me.GetValue(TableUtils.ScoreNoColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalEducation_.ScoreNo field. + ''' + Public Function GetScoreNoFieldValue() As String + Return CType(Me.GetValue(TableUtils.ScoreNoColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalEducation_.ScoreNo field. + ''' + Public Sub SetScoreNoFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.ScoreNoColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalEducation_.ScoreNo field. + ''' + Public Sub SetScoreNoFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.ScoreNoColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalEducation_.NoAll field. + ''' + Public Function GetNoAllValue() As ColumnValue + Return Me.GetValue(TableUtils.NoAllColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalEducation_.NoAll field. + ''' + Public Function GetNoAllFieldValue() As String + Return CType(Me.GetValue(TableUtils.NoAllColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalEducation_.NoAll field. + ''' + Public Sub SetNoAllFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.NoAllColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalEducation_.NoAll field. + ''' + Public Sub SetNoAllFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.NoAllColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalEducation_.Score field. + ''' + Public Function GetScoreValue() As ColumnValue + Return Me.GetValue(TableUtils.ScoreColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalEducation_.Score field. + ''' + Public Function GetScoreFieldValue() As String + Return CType(Me.GetValue(TableUtils.ScoreColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalEducation_.Score field. + ''' + Public Sub SetScoreFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.ScoreColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalEducation_.Score field. + ''' + Public Sub SetScoreFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.ScoreColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalEducation_.Command field. + ''' + Public Function GetCommandValue() As ColumnValue + Return Me.GetValue(TableUtils.CommandColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalEducation_.Command field. + ''' + Public Function GetCommandFieldValue() As String + Return CType(Me.GetValue(TableUtils.CommandColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalEducation_.Command field. + ''' + Public Sub SetCommandFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.CommandColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalEducation_.Command field. + ''' + Public Sub SetCommandFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.CommandColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalEducation_.CommandDate field. + ''' + Public Function GetCommandDateValue() As ColumnValue + Return Me.GetValue(TableUtils.CommandDateColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalEducation_.CommandDate field. + ''' + Public Function GetCommandDateFieldValue() As DateTime + Return CType(Me.GetValue(TableUtils.CommandDateColumn).ToDateTime(), DateTime) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalEducation_.CommandDate field. + ''' + Public Sub SetCommandDateFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.CommandDateColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalEducation_.CommandDate field. + ''' + Public Sub SetCommandDateFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.CommandDateColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalEducation_.CommandDate field. + ''' + Public Sub SetCommandDateFieldValue(ByVal val As DateTime) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.CommandDateColumn) + End Sub + + + +#End Region + +#Region "Convenience methods to get field names" + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonalEducation_.EducationId field. + ''' + Public Property EducationId() As Int32 + Get + Return CType(Me.GetValue(TableUtils.EducationIdColumn).ToInt32(), Int32) + End Get + Set (ByVal val As Int32) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.EducationIdColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property EducationIdSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.EducationIdColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property EducationIdDefault() As String + Get + Return TableUtils.EducationIdColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonalEducation_.PersonalId field. + ''' + Public Property PersonalId() As String + Get + Return CType(Me.GetValue(TableUtils.PersonalIdColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.PersonalIdColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property PersonalIdSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.PersonalIdColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property PersonalIdDefault() As String + Get + Return TableUtils.PersonalIdColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonalEducation_.StartDate field. + ''' + Public Property StartDate() As DateTime + Get + Return CType(Me.GetValue(TableUtils.StartDateColumn).ToDateTime(), DateTime) + End Get + Set (ByVal val As DateTime) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.StartDateColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property StartDateSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.StartDateColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property StartDateDefault() As String + Get + Return TableUtils.StartDateColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonalEducation_.EndDate field. + ''' + Public Property EndDate() As DateTime + Get + Return CType(Me.GetValue(TableUtils.EndDateColumn).ToDateTime(), DateTime) + End Get + Set (ByVal val As DateTime) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.EndDateColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property EndDateSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.EndDateColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property EndDateDefault() As String + Get + Return TableUtils.EndDateColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonalEducation_.Course field. + ''' + Public Property Course() As String + Get + Return CType(Me.GetValue(TableUtils.CourseColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.CourseColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property CourseSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.CourseColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property CourseDefault() As String + Get + Return TableUtils.CourseColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonalEducation_.CourseAbbr field. + ''' + Public Property CourseAbbr() As String + Get + Return CType(Me.GetValue(TableUtils.CourseAbbrColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.CourseAbbrColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property CourseAbbrSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.CourseAbbrColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property CourseAbbrDefault() As String + Get + Return TableUtils.CourseAbbrColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonalEducation_.Institue field. + ''' + Public Property Institue() As String + Get + Return CType(Me.GetValue(TableUtils.InstitueColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.InstitueColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property InstitueSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.InstitueColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property InstitueDefault() As String + Get + Return TableUtils.InstitueColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonalEducation_.Facultry field. + ''' + Public Property Facultry() As String + Get + Return CType(Me.GetValue(TableUtils.FacultryColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.FacultryColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property FacultrySpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.FacultryColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property FacultryDefault() As String + Get + Return TableUtils.FacultryColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonalEducation_.LevelId field. + ''' + Public Property LevelId() As Int16 + Get + Return CType(Me.GetValue(TableUtils.LevelIdColumn).ToInt16(), Int16) + End Get + Set (ByVal val As Int16) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.LevelIdColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property LevelIdSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.LevelIdColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property LevelIdDefault() As String + Get + Return TableUtils.LevelIdColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonalEducation_.EdYear field. + ''' + Public Property EdYear() As String + Get + Return CType(Me.GetValue(TableUtils.EdYearColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.EdYearColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property EdYearSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.EdYearColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property EdYearDefault() As String + Get + Return TableUtils.EdYearColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonalEducation_.EducationPeriod field. + ''' + Public Property EducationPeriod() As Byte + Get + Return CType(Me.GetValue(TableUtils.EducationPeriodColumn).ToByte(), Byte) + End Get + Set (ByVal val As Byte) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.EducationPeriodColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property EducationPeriodSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.EducationPeriodColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property EducationPeriodDefault() As String + Get + Return TableUtils.EducationPeriodColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonalEducation_.EducationType field. + ''' + Public Property EducationType() As Byte + Get + Return CType(Me.GetValue(TableUtils.EducationTypeColumn).ToByte(), Byte) + End Get + Set (ByVal val As Byte) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.EducationTypeColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property EducationTypeSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.EducationTypeColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property EducationTypeDefault() As String + Get + Return TableUtils.EducationTypeColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonalEducation_.COUNTRY field. + ''' + Public Property COUNTRY() As Int16 + Get + Return CType(Me.GetValue(TableUtils.COUNTRYColumn).ToInt16(), Int16) + End Get + Set (ByVal val As Int16) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.COUNTRYColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property COUNTRYSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.COUNTRYColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property COUNTRYDefault() As String + Get + Return TableUtils.COUNTRYColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonalEducation_.CourseNo field. + ''' + Public Property CourseNo() As String + Get + Return CType(Me.GetValue(TableUtils.CourseNoColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.CourseNoColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property CourseNoSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.CourseNoColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property CourseNoDefault() As String + Get + Return TableUtils.CourseNoColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonalEducation_.ScoreNo field. + ''' + Public Property ScoreNo() As String + Get + Return CType(Me.GetValue(TableUtils.ScoreNoColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.ScoreNoColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property ScoreNoSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.ScoreNoColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property ScoreNoDefault() As String + Get + Return TableUtils.ScoreNoColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonalEducation_.NoAll field. + ''' + Public Property NoAll() As String + Get + Return CType(Me.GetValue(TableUtils.NoAllColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.NoAllColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property NoAllSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.NoAllColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property NoAllDefault() As String + Get + Return TableUtils.NoAllColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonalEducation_.Score field. + ''' + Public Property Score() As String + Get + Return CType(Me.GetValue(TableUtils.ScoreColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.ScoreColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property ScoreSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.ScoreColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property ScoreDefault() As String + Get + Return TableUtils.ScoreColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonalEducation_.Command field. + ''' + Public Property Command() As String + Get + Return CType(Me.GetValue(TableUtils.CommandColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.CommandColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property CommandSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.CommandColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property CommandDefault() As String + Get + Return TableUtils.CommandColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonalEducation_.CommandDate field. + ''' + Public Property CommandDate() As DateTime + Get + Return CType(Me.GetValue(TableUtils.CommandDateColumn).ToDateTime(), DateTime) + End Get + Set (ByVal val As DateTime) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.CommandDateColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property CommandDateSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.CommandDateColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property CommandDateDefault() As String + Get + Return TableUtils.CommandDateColumn.DefaultValue + End Get + End Property + + + +#End Region + +End Class +End Namespace diff --git a/App_Code/Business Layer/BasePersonalEducationTable.vb b/App_Code/Business Layer/BasePersonalEducationTable.vb new file mode 100644 index 0000000..5e1c598 --- /dev/null +++ b/App_Code/Business Layer/BasePersonalEducationTable.vb @@ -0,0 +1,1150 @@ +' This class is "generated" and will be overwritten. +' Your customizations should be made in PersonalEducationRecord.vb + +Imports System.Data.SqlTypes +Imports System.Data +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider +Imports Persons.Data + +Namespace Persons.Business + +''' +''' The generated superclass for the class. +''' Provides access to the schema information and record data of a database table or view named PersonalEducation. +''' +''' +''' The connection details (name, location, etc.) of the database and table (or view) accessed by this class +''' are resolved at runtime based on the connection string in the application's Web.Config file. +''' +''' This class is not intended to be instantiated directly. To obtain an instance of this class, use +''' PersonalEducationTable.Instance. +''' +''' +''' + + Public Class BasePersonalEducationTable + Inherits PrimaryKeyTable + + + Private ReadOnly TableDefinitionString As String = PersonalEducationDefinition.GetXMLString() + + + + + + + + Protected Sub New() + MyBase.New() + Me.Initialize() + End Sub + + Protected Overridable Sub Initialize() + Dim def As New XmlTableDefinition(TableDefinitionString) + Me.TableDefinition = New TableDefinition() + Me.TableDefinition.TableClassName = System.Reflection.Assembly.CreateQualifiedName("App_Code", "Persons.Business.PersonalEducationTable") + def.InitializeTableDefinition(Me.TableDefinition) + Me.ConnectionName = def.GetConnectionName() + Me.RecordClassName = System.Reflection.Assembly.CreateQualifiedName("App_Code", "Persons.Business.PersonalEducationRecord") + Me.ApplicationName = "App_Code" + Me.DataAdapter = New PersonalEducationSqlTable() + Directcast(Me.DataAdapter, PersonalEducationSqlTable).ConnectionName = Me.ConnectionName + + Me.TableDefinition.AdapterMetaData = Me.DataAdapter.AdapterMetaData + EducationIdColumn.CodeName = "EducationId" + PersonalIdColumn.CodeName = "PersonalId" + StartDateColumn.CodeName = "StartDate" + EndDateColumn.CodeName = "EndDate" + CourseColumn.CodeName = "Course" + CourseAbbrColumn.CodeName = "CourseAbbr" + InstitueColumn.CodeName = "Institue" + FacultryColumn.CodeName = "Facultry" + LevelIdColumn.CodeName = "LevelId" + EdYearColumn.CodeName = "EdYear" + EducationPeriodColumn.CodeName = "EducationPeriod" + EducationTypeColumn.CodeName = "EducationType" + COUNTRYColumn.CodeName = "COUNTRY" + CourseNoColumn.CodeName = "CourseNo" + ScoreNoColumn.CodeName = "ScoreNo" + NoAllColumn.CodeName = "NoAll" + ScoreColumn.CodeName = "Score" + CommandColumn.CodeName = "Command" + CommandDateColumn.CodeName = "CommandDate" + + End Sub + +#Region "Overriden methods" + + +#End Region + +#Region "Properties for columns" + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalEducation_.EducationId column object. + ''' + Public ReadOnly Property EducationIdColumn() As BaseClasses.Data.NumberColumn + Get + Return CType(Me.TableDefinition.ColumnList(0), BaseClasses.Data.NumberColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalEducation_.EducationId column object. + ''' + Public Shared ReadOnly Property EducationId() As BaseClasses.Data.NumberColumn + Get + Return PersonalEducationTable.Instance.EducationIdColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonalEducation_.PersonalId column object. + ''' + Public ReadOnly Property PersonalIdColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(1), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalEducation_.PersonalId column object. + ''' + Public Shared ReadOnly Property PersonalId() As BaseClasses.Data.StringColumn + Get + Return PersonalEducationTable.Instance.PersonalIdColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonalEducation_.StartDate column object. + ''' + Public ReadOnly Property StartDateColumn() As BaseClasses.Data.DateColumn + Get + Return CType(Me.TableDefinition.ColumnList(2), BaseClasses.Data.DateColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalEducation_.StartDate column object. + ''' + Public Shared ReadOnly Property StartDate() As BaseClasses.Data.DateColumn + Get + Return PersonalEducationTable.Instance.StartDateColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonalEducation_.EndDate column object. + ''' + Public ReadOnly Property EndDateColumn() As BaseClasses.Data.DateColumn + Get + Return CType(Me.TableDefinition.ColumnList(3), BaseClasses.Data.DateColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalEducation_.EndDate column object. + ''' + Public Shared ReadOnly Property EndDate() As BaseClasses.Data.DateColumn + Get + Return PersonalEducationTable.Instance.EndDateColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonalEducation_.Course column object. + ''' + Public ReadOnly Property CourseColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(4), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalEducation_.Course column object. + ''' + Public Shared ReadOnly Property Course() As BaseClasses.Data.StringColumn + Get + Return PersonalEducationTable.Instance.CourseColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonalEducation_.CourseAbbr column object. + ''' + Public ReadOnly Property CourseAbbrColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(5), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalEducation_.CourseAbbr column object. + ''' + Public Shared ReadOnly Property CourseAbbr() As BaseClasses.Data.StringColumn + Get + Return PersonalEducationTable.Instance.CourseAbbrColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonalEducation_.Institue column object. + ''' + Public ReadOnly Property InstitueColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(6), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalEducation_.Institue column object. + ''' + Public Shared ReadOnly Property Institue() As BaseClasses.Data.StringColumn + Get + Return PersonalEducationTable.Instance.InstitueColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonalEducation_.Facultry column object. + ''' + Public ReadOnly Property FacultryColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(7), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalEducation_.Facultry column object. + ''' + Public Shared ReadOnly Property Facultry() As BaseClasses.Data.StringColumn + Get + Return PersonalEducationTable.Instance.FacultryColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonalEducation_.LevelId column object. + ''' + Public ReadOnly Property LevelIdColumn() As BaseClasses.Data.NumberColumn + Get + Return CType(Me.TableDefinition.ColumnList(8), BaseClasses.Data.NumberColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalEducation_.LevelId column object. + ''' + Public Shared ReadOnly Property LevelId() As BaseClasses.Data.NumberColumn + Get + Return PersonalEducationTable.Instance.LevelIdColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonalEducation_.EdYear column object. + ''' + Public ReadOnly Property EdYearColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(9), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalEducation_.EdYear column object. + ''' + Public Shared ReadOnly Property EdYear() As BaseClasses.Data.StringColumn + Get + Return PersonalEducationTable.Instance.EdYearColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonalEducation_.EducationPeriod column object. + ''' + Public ReadOnly Property EducationPeriodColumn() As BaseClasses.Data.NumberColumn + Get + Return CType(Me.TableDefinition.ColumnList(10), BaseClasses.Data.NumberColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalEducation_.EducationPeriod column object. + ''' + Public Shared ReadOnly Property EducationPeriod() As BaseClasses.Data.NumberColumn + Get + Return PersonalEducationTable.Instance.EducationPeriodColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonalEducation_.EducationType column object. + ''' + Public ReadOnly Property EducationTypeColumn() As BaseClasses.Data.NumberColumn + Get + Return CType(Me.TableDefinition.ColumnList(11), BaseClasses.Data.NumberColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalEducation_.EducationType column object. + ''' + Public Shared ReadOnly Property EducationType() As BaseClasses.Data.NumberColumn + Get + Return PersonalEducationTable.Instance.EducationTypeColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonalEducation_.COUNTRY column object. + ''' + Public ReadOnly Property COUNTRYColumn() As BaseClasses.Data.NumberColumn + Get + Return CType(Me.TableDefinition.ColumnList(12), BaseClasses.Data.NumberColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalEducation_.COUNTRY column object. + ''' + Public Shared ReadOnly Property COUNTRY() As BaseClasses.Data.NumberColumn + Get + Return PersonalEducationTable.Instance.COUNTRYColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonalEducation_.CourseNo column object. + ''' + Public ReadOnly Property CourseNoColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(13), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalEducation_.CourseNo column object. + ''' + Public Shared ReadOnly Property CourseNo() As BaseClasses.Data.StringColumn + Get + Return PersonalEducationTable.Instance.CourseNoColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonalEducation_.ScoreNo column object. + ''' + Public ReadOnly Property ScoreNoColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(14), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalEducation_.ScoreNo column object. + ''' + Public Shared ReadOnly Property ScoreNo() As BaseClasses.Data.StringColumn + Get + Return PersonalEducationTable.Instance.ScoreNoColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonalEducation_.NoAll column object. + ''' + Public ReadOnly Property NoAllColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(15), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalEducation_.NoAll column object. + ''' + Public Shared ReadOnly Property NoAll() As BaseClasses.Data.StringColumn + Get + Return PersonalEducationTable.Instance.NoAllColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonalEducation_.Score column object. + ''' + Public ReadOnly Property ScoreColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(16), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalEducation_.Score column object. + ''' + Public Shared ReadOnly Property Score() As BaseClasses.Data.StringColumn + Get + Return PersonalEducationTable.Instance.ScoreColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonalEducation_.Command column object. + ''' + Public ReadOnly Property CommandColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(17), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalEducation_.Command column object. + ''' + Public Shared ReadOnly Property Command() As BaseClasses.Data.StringColumn + Get + Return PersonalEducationTable.Instance.CommandColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonalEducation_.CommandDate column object. + ''' + Public ReadOnly Property CommandDateColumn() As BaseClasses.Data.DateColumn + Get + Return CType(Me.TableDefinition.ColumnList(18), BaseClasses.Data.DateColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalEducation_.CommandDate column object. + ''' + Public Shared ReadOnly Property CommandDate() As BaseClasses.Data.DateColumn + Get + Return PersonalEducationTable.Instance.CommandDateColumn + End Get + End Property + + +#End Region + + +#Region "Shared helper methods" + + ''' + ''' This is a shared function that can be used to get an array of PersonalEducationRecord records using a where clause. + ''' + Public Shared Function GetRecords(ByVal where As String) As PersonalEducationRecord() + + Return GetRecords(where, Nothing, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) + End Function + + ''' + ''' This is a shared function that can be used to get an array of PersonalEducationRecord records using a where clause. + ''' + Public Shared Function GetRecords(ByVal join As BaseFilter, ByVal where As String) As PersonalEducationRecord() + + Return GetRecords(join, where, Nothing, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) + End Function + + ''' + ''' This is a shared function that can be used to get an array of PersonalEducationRecord records using a where and order by clause. + ''' + Public Shared Function GetRecords( _ + ByVal where As String, _ + ByVal orderBy As OrderBy) As PersonalEducationRecord() + + Return GetRecords(where, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) + End Function + + ''' + ''' This is a shared function that can be used to get an array of PersonalEducationRecord records using a where and order by clause. + ''' + Public Shared Function GetRecords( _ + ByVal join As BaseFilter, _ + ByVal where As String, _ + ByVal orderBy As OrderBy) As PersonalEducationRecord() + + Return GetRecords(join, where, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) + End Function + + ''' + ''' This is a shared function that can be used to get an array of PersonalEducationRecord records using a where and order by clause clause with pagination. + ''' + Public Shared Function GetRecords( _ + ByVal where As String, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As PersonalEducationRecord() + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + Dim join As BaseClasses.Data.BaseFilter = Nothing + Dim recList As ArrayList = PersonalEducationTable.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, pageIndex, pageSize) + + Return CType(recList.ToArray(GetType(Persons.Business.PersonalEducationRecord)), PersonalEducationRecord()) + End Function + + ''' + ''' This is a shared function that can be used to get an array of PersonalEducationRecord records using a where and order by clause clause with pagination. + ''' + Public Shared Function GetRecords( _ + ByVal join As BaseFilter, _ + ByVal where As String, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As PersonalEducationRecord() + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Dim recList As ArrayList = PersonalEducationTable.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, pageIndex, pageSize) + + Return CType(recList.ToArray(GetType(Persons.Business.PersonalEducationRecord)), PersonalEducationRecord()) + End Function + + Public Shared Function GetRecords( _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As PersonalEducationRecord() + Dim join As BaseClasses.Data.BaseFilter = Nothing + Dim recList As ArrayList = PersonalEducationTable.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + Return CType(recList.ToArray(GetType(Persons.Business.PersonalEducationRecord)), PersonalEducationRecord()) + End Function + + Public Shared Function GetRecords( _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As PersonalEducationRecord() + + Dim recList As ArrayList = PersonalEducationTable.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + Return CType(recList.ToArray(GetType(Persons.Business.PersonalEducationRecord)), PersonalEducationRecord()) + End Function + + Public Shared Function GetRecords( _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer, _ + ByRef totalRecords As Integer) As PersonalEducationRecord() + Dim join As BaseClasses.Data.BaseFilter = Nothing + Dim recList As ArrayList = PersonalEducationTable.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize, totalRecords) + + Return CType(recList.ToArray(GetType(Persons.Business.PersonalEducationRecord)), PersonalEducationRecord()) + End Function + + Public Shared Function GetRecords( _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer, _ + ByRef totalRecords As Integer) As PersonalEducationRecord() + + Dim recList As ArrayList = PersonalEducationTable.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize, totalRecords) + + Return CType(recList.ToArray(GetType(Persons.Business.PersonalEducationRecord)), PersonalEducationRecord()) + End Function + + ''' + ''' This is a shared function that can be used to get total number of records that will be returned using the where clause. + ''' + Public Shared Function GetRecordCount(ByVal where As String) As Integer + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Return CInt(PersonalEducationTable.Instance.GetRecordListCount(Nothing, whereFilter, Nothing, Nothing)) + End Function + +''' + ''' This is a shared function that can be used to get total number of records that will be returned using the where clause. + ''' + Public Shared Function GetRecordCount(ByVal join As BaseFilter, ByVal where As String) As Integer + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Return CInt(PersonalEducationTable.Instance.GetRecordListCount(join, whereFilter, Nothing, Nothing)) + End Function + + Public Shared Function GetRecordCount(ByVal where As WhereClause) As Integer + Return CInt(PersonalEducationTable.Instance.GetRecordListCount(Nothing, where.GetFilter(), Nothing, Nothing)) + End Function + + Public Shared Function GetRecordCount(ByVal join As BaseFilter, ByVal where As WhereClause) As Integer + Return CInt(PersonalEducationTable.Instance.GetRecordListCount(join, where.GetFilter(), Nothing, Nothing)) + End Function + + ''' + ''' This is a shared function that can be used to get a PersonalEducationRecord record using a where clause. + ''' + Public Shared Function GetRecord(ByVal where As String) As PersonalEducationRecord + Dim orderBy As OrderBy = Nothing + Return GetRecord(where, orderBy) + End Function + + ''' + ''' This is a shared function that can be used to get a PersonalEducationRecord record using a where clause. + ''' + Public Shared Function GetRecord(ByVal join As BaseFilter, ByVal where As String) As PersonalEducationRecord + Dim orderBy As OrderBy = Nothing + Return GetRecord(join, where, orderBy) + End Function + + ''' + ''' This is a shared function that can be used to get a PersonalEducationRecord record using a where and order by clause. + ''' + Public Shared Function GetRecord( _ + ByVal where As String, _ + ByVal orderBy As OrderBy) As PersonalEducationRecord + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + Dim join As BaseClasses.Data.BaseFilter = Nothing + Dim recList As ArrayList = PersonalEducationTable.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MIN_BATCH_SIZE) + + Dim rec As PersonalEducationRecord = Nothing + If recList.Count > 0 Then + rec = CType(recList(0), PersonalEducationRecord) + End If + + Return rec + End Function + + ''' + ''' This is a shared function that can be used to get a PersonalEducationRecord record using a where and order by clause. + ''' + Public Shared Function GetRecord( _ + ByVal join As BaseFilter, _ + ByVal where As String, _ + ByVal orderBy As OrderBy) As PersonalEducationRecord + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Dim recList As ArrayList = PersonalEducationTable.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MIN_BATCH_SIZE) + + Dim rec As PersonalEducationRecord = Nothing + If recList.Count > 0 Then + rec = CType(recList(0), PersonalEducationRecord) + End If + + Return rec + End Function + + + Public Shared Function GetValues( _ + ByVal col As BaseColumn, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal maxItems As Integer) As String() + + ' Create the filter list. + Dim retCol As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, True) + retCol.AddColumn(col) + + Return PersonalEducationTable.Instance.GetColumnValues(retCol, Nothing, where.GetFilter(), Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, maxItems) + + End Function + + Public Shared Function GetValues( _ + ByVal col As BaseColumn, _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal maxItems As Integer) As String() + + ' Create the filter list. + Dim retCol As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, True) + retCol.AddColumn(col) + + Return PersonalEducationTable.Instance.GetColumnValues(retCol, join, where.GetFilter(), Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, maxItems) + + End Function + + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where clause. + ''' + Public Shared Function GetDataTable(ByVal where As String) As System.Data.DataTable + + Dim recs() As PersonalEducationRecord = GetRecords(where) + Return PersonalEducationTable.Instance.CreateDataTable(recs, Nothing) + End Function + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where clause. + ''' + Public Shared Function GetDataTable(ByVal join As BaseFilter, ByVal where As String) As System.Data.DataTable + + Dim recs() As PersonalEducationRecord = GetRecords(join, where) + Return PersonalEducationTable.Instance.CreateDataTable(recs, Nothing) + End Function + + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause. + ''' + Public Shared Function GetDataTable(ByVal where As String, ByVal orderBy As OrderBy) As System.Data.DataTable + + Dim recs() As PersonalEducationRecord = GetRecords(where, orderBy) + Return PersonalEducationTable.Instance.CreateDataTable(recs, Nothing) + End Function + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause. + ''' + Public Shared Function GetDataTable(ByVal join As BaseFilter, ByVal where As String, ByVal orderBy As OrderBy) As System.Data.DataTable + + Dim recs() As PersonalEducationRecord = GetRecords(join, where, orderBy) + Return PersonalEducationTable.Instance.CreateDataTable(recs, Nothing) + End Function + + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause with pagination. + ''' + Public Shared Function GetDataTable( _ + ByVal where As String, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As System.Data.DataTable + + Dim recs() As PersonalEducationRecord = GetRecords(where, orderBy, pageIndex, pageSize) + Return PersonalEducationTable.Instance.CreateDataTable(recs, Nothing) + End Function + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause with pagination. + ''' + Public Shared Function GetDataTable( _ + ByVal join As BaseFilter, _ + ByVal where As String, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As System.Data.DataTable + + Dim recs() As PersonalEducationRecord = GetRecords(join, where, orderBy, pageIndex, pageSize) + Return PersonalEducationTable.Instance.CreateDataTable(recs, Nothing) + End Function + + + ''' + ''' This is a shared function that can be used to delete records using a where clause. + ''' + Public Shared Sub DeleteRecords(ByVal where As String) + If where = Nothing OrElse where.Trim() = "" Then + Return + End If + + Dim whereFilter As SqlFilter = New SqlFilter(where) + PersonalEducationTable.Instance.DeleteRecordList(whereFilter) + End Sub + + ''' + ''' This is a shared function that can be used to export records using a where clause. + ''' + Public Shared Function Export(ByVal where As String) As String + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Return PersonalEducationTable.Instance.ExportRecordData(whereFilter) + End Function + + Public Shared Function Export(ByVal where As WhereClause) As String + Dim whereFilter As BaseFilter = Nothing + If Not where Is Nothing Then + whereFilter = where.GetFilter() + End If + + Return PersonalEducationTable.Instance.ExportRecordData(whereFilter) + End Function + + Public Shared Function GetSum( _ + ByVal col As BaseColumn, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) _ + As String + + Dim colSel As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, False) + colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Sum) + + Return PersonalEducationTable.Instance.GetColumnStatistics(colSel, Nothing, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + End Function + + Public Shared Function GetSum( _ + ByVal col As BaseColumn, _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) _ + As String + + Dim colSel As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, False) + colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Sum) + + Return PersonalEducationTable.Instance.GetColumnStatistics(colSel, join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + End Function + + + Public Shared Function GetCount( _ + ByVal col As BaseColumn, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) _ + As String + + Dim colSel As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, False) + colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Count) + + Return PersonalEducationTable.Instance.GetColumnStatistics(colSel, Nothing, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + End Function + + Public Shared Function GetCount( _ + ByVal col As BaseColumn, _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) _ + As String + + Dim colSel As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, False) + colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Count) + + Return PersonalEducationTable.Instance.GetColumnStatistics(colSel, join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + End Function + + ''' + ''' This method returns the columns in the table. + ''' + Public Shared Function GetColumns() As BaseColumn() + Return PersonalEducationTable.Instance.TableDefinition.Columns + End Function + + ''' + ''' This method returns the columnlist in the table. + ''' + Public Shared Function GetColumnList() As ColumnList + Return PersonalEducationTable.Instance.TableDefinition.ColumnList + End Function + + + ''' + ''' This method creates a new record and returns it to be edited. + ''' + Public Shared Function CreateNewRecord() As IRecord + Return PersonalEducationTable.Instance.CreateRecord() + End Function + + ''' + ''' This method creates a new record and returns it to be edited. + ''' + ''' ID of the new record. + Public Shared Function CreateNewRecord(ByVal tempId As String) As IRecord + Return PersonalEducationTable.Instance.CreateRecord(tempId) + End Function + + ''' + ''' This method checks if column is editable. + ''' + ''' Name of the column to check. + Public Shared Function isReadOnlyColumn(ByVal columnName As String) As Boolean + Dim column As BaseColumn = GetColumn(columnName) + If (Not IsNothing(column)) Then + Return column.IsValuesReadOnly + Else + Return True + End If + End Function + + ''' + ''' This method gets the specified column. + ''' + ''' Unique name of the column to fetch. + Public Shared Function GetColumn(ByVal uniqueColumnName As String) As BaseColumn + Dim column As BaseColumn = PersonalEducationTable.Instance.TableDefinition.ColumnList.GetByUniqueName(uniqueColumnName) + Return column + End Function + + ' Convenience method for getting a record using a string-based record identifier + Public Shared Function GetRecord(ByVal id As String, ByVal bMutable As Boolean) As PersonalEducationRecord + Return CType(PersonalEducationTable.Instance.GetRecordData(id, bMutable), PersonalEducationRecord) + End Function + + ' Convenience method for getting a record using a KeyValue record identifier + Public Shared Function GetRecord(ByVal id As KeyValue, ByVal bMutable As Boolean) As PersonalEducationRecord + Return CType(PersonalEducationTable.Instance.GetRecordData(id, bMutable), PersonalEducationRecord) + End Function + + ' Convenience method for creating a record + Public Overloads Function NewRecord( _ + ByVal PersonalIdValue As String, _ + ByVal StartDateValue As String, _ + ByVal EndDateValue As String, _ + ByVal CourseValue As String, _ + ByVal CourseAbbrValue As String, _ + ByVal InstitueValue As String, _ + ByVal FacultryValue As String, _ + ByVal LevelIdValue As String, _ + ByVal EdYearValue As String, _ + ByVal EducationPeriodValue As String, _ + ByVal EducationTypeValue As String, _ + ByVal COUNTRYValue As String, _ + ByVal CourseNoValue As String, _ + ByVal ScoreNoValue As String, _ + ByVal NoAllValue As String, _ + ByVal ScoreValue As String, _ + ByVal CommandValue As String, _ + ByVal CommandDateValue As String _ + ) As KeyValue + Dim rec As IPrimaryKeyRecord = CType(Me.CreateRecord(), IPrimaryKeyRecord) + rec.SetString(PersonalIdValue, PersonalIdColumn) + rec.SetString(StartDateValue, StartDateColumn) + rec.SetString(EndDateValue, EndDateColumn) + rec.SetString(CourseValue, CourseColumn) + rec.SetString(CourseAbbrValue, CourseAbbrColumn) + rec.SetString(InstitueValue, InstitueColumn) + rec.SetString(FacultryValue, FacultryColumn) + rec.SetString(LevelIdValue, LevelIdColumn) + rec.SetString(EdYearValue, EdYearColumn) + rec.SetString(EducationPeriodValue, EducationPeriodColumn) + rec.SetString(EducationTypeValue, EducationTypeColumn) + rec.SetString(COUNTRYValue, COUNTRYColumn) + rec.SetString(CourseNoValue, CourseNoColumn) + rec.SetString(ScoreNoValue, ScoreNoColumn) + rec.SetString(NoAllValue, NoAllColumn) + rec.SetString(ScoreValue, ScoreColumn) + rec.SetString(CommandValue, CommandColumn) + rec.SetString(CommandDateValue, CommandDateColumn) + + + rec.Create() 'update the DB so any DB-initialized fields (like autoincrement IDs) can be initialized + + Dim key As KeyValue = rec.GetID() + Return key + End Function + + ''' + ''' This method deletes a specified record + ''' + ''' Keyvalue of the record to be deleted. + Public Shared Sub DeleteRecord(ByVal kv As KeyValue) + PersonalEducationTable.Instance.DeleteOneRecord(kv) + End Sub + + ''' + ''' This method checks if record exist in the database using the keyvalue provided. + ''' + ''' Key value of the record. + Public Shared Function DoesRecordExist(ByVal kv As KeyValue) As Boolean + Dim recordExist As Boolean = True + Try + PersonalEducationTable.GetRecord(kv, False) + Catch ex As Exception + recordExist = False + End Try + Return recordExist + End Function + + ''' + ''' This method returns all the primary columns in the table. + ''' + Public Shared Function GetPrimaryKeyColumns() As ColumnList + If (Not IsNothing(PersonalEducationTable.Instance.TableDefinition.PrimaryKey)) Then + Return PersonalEducationTable.Instance.TableDefinition.PrimaryKey.Columns + Else + Return Nothing + End If + End Function + + ''' + ''' This method takes a key and returns a keyvalue. + ''' + ''' key could be array of primary key values in case of composite primary key or a string containing single primary key value in case of non-composite primary key. + Public Shared Function GetKeyValue(ByVal key As Object) As KeyValue + Dim kv As KeyValue = Nothing + + If (Not (IsNothing(PersonalEducationTable.Instance.TableDefinition.PrimaryKey))) Then + + Dim isCompositePrimaryKey As Boolean = False + isCompositePrimaryKey = PersonalEducationTable.Instance.TableDefinition.PrimaryKey.IsCompositeKey + + If ((isCompositePrimaryKey) AndAlso (key.GetType.IsArray())) Then + + ' If the key is composite, then construct a key value. + kv = New KeyValue + Dim fullKeyString As String = "" + Dim keyArray As Array = CType(key, Array) + If (Not IsNothing(keyArray)) Then + Dim length As Integer = keyArray.Length + Dim pkColumns As ColumnList = PersonalEducationTable.Instance.TableDefinition.PrimaryKey.Columns + Dim pkColumn As BaseColumn + Dim index As Integer = 0 + For Each pkColumn In pkColumns + Dim keyString As String = CType(keyArray.GetValue(index), String) + If (PersonalEducationTable.Instance.TableDefinition.TableType = BaseClasses.Data.TableDefinition.TableTypes.Virtual) Then + kv.AddElement(pkColumn.UniqueName, keyString) + Else + kv.AddElement(pkColumn.InternalName, keyString) + End If + index = index + 1 + Next pkColumn + End If + + Else + ' If the key is not composite, then get the key value. + kv = PersonalEducationTable.Instance.TableDefinition.PrimaryKey.ParseValue(CType(key, String)) + End If + End If + Return kv + End Function + + + ''' + ''' This method takes a record and a Column and returns an evaluated value of DFKA formula. + ''' + Public Shared Function GetDFKA(ByVal rec As BaseRecord, ByVal col As BaseColumn) As String + Dim fkColumn As ForeignKey = PersonalEducationTable.Instance.TableDefinition.GetExpandableNonCompositeForeignKey(col) + If fkColumn Is Nothing Then + Return Nothing + End If + Dim _DFKA As String = fkColumn.PrimaryKeyDisplayColumns + If (_DFKA.Trim().StartsWith("=")) Then + ' if the formula is in the format of "= ., then pull out the data from the rec object instead of doing formula evaluation + Dim tableCodeName As String = fkColumn.PrimaryKeyTableDefinition.TableCodeName + Dim column As String = _DFKA.Trim("="c).Trim() + If column.StartsWith(tableCodeName & ".", StringComparison.InvariantCultureIgnoreCase) Then + column = column.Substring(tableCodeName.Length + 1) + End If + + For Each c As BaseColumn In fkColumn.PrimaryKeyTableDefinition.Columns + If column = c.CodeName Then + Return rec.Format(c) + End If + Next + Dim tableName As String = fkColumn.PrimaryKeyTableDefinition.TableCodeName + Return EvaluateFormula(_DFKA, rec, Nothing, tableName) + Else + Return Nothing + End If + End Function + + ''' + ''' This method takes a keyValue and a Column and returns an evaluated value of DFKA formula. + ''' + Public Shared Function GetDFKA(ByVal keyValue As String, ByVal col As BaseColumn, ByVal formatPattern as String) As String + If keyValue Is Nothing Then + Return Nothing + End If + Dim fkColumn As ForeignKey = PersonalEducationTable.Instance.TableDefinition.GetExpandableNonCompositeForeignKey(col) + If fkColumn Is Nothing Then + Return Nothing + End If + Dim _DFKA As String = fkColumn.PrimaryKeyDisplayColumns + If (_DFKA.Trim().StartsWith("=")) Then + Dim tableName As String = fkColumn.PrimaryKeyTableDefinition.TableCodeName + Dim t As PrimaryKeyTable = CType(DatabaseObjects.GetTableObject(tableName), PrimaryKeyTable) + Dim rec As BaseRecord = Nothing + If Not t Is Nothing Then + Try + rec = CType(t.GetRecordData(keyValue, False), BaseRecord) + Catch + rec = Nothing + End Try + End If + If rec Is Nothing Then + Return "" + End If + + ' if the formula is in the format of "= ., then pull out the data from the rec object instead of doing formula evaluation + Dim tableCodeName As String = fkColumn.PrimaryKeyTableDefinition.TableCodeName + Dim column As String = _DFKA.Trim("="c).Trim() + If column.StartsWith(tableCodeName & ".", StringComparison.InvariantCultureIgnoreCase) Then + column = column.Substring(tableCodeName.Length + 1) + End If + + For Each c As BaseColumn In fkColumn.PrimaryKeyTableDefinition.Columns + If column = c.CodeName Then + Return rec.Format(c) + End If + Next + Return EvaluateFormula(_DFKA, rec, Nothing, tableName) + Else + Return Nothing + End If + End Function + + ''' + ''' Evaluates the formula + ''' + Public Shared Function EvaluateFormula(ByVal formula As String, Optional ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord = Nothing, Optional ByVal format As String = Nothing, Optional ByVal name As String = "") As String + Dim e As BaseFormulaEvaluator = New BaseFormulaEvaluator() + If Not dataSourceForEvaluate Is Nothing Then + e.Evaluator.Variables.Add(name, dataSourceForEvaluate) + end if + e.DataSource = dataSourceForEvaluate + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + If Not String.IsNullOrEmpty(format) Then + Return BaseFormulaUtils.Format(resultObj, format) + Else + Return resultObj.ToString() + End If + End Function + + +#End Region + +End Class +End Namespace diff --git a/App_Code/Business Layer/BasePersonalExtWorkRecord.vb b/App_Code/Business Layer/BasePersonalExtWorkRecord.vb new file mode 100644 index 0000000..e82cb4f --- /dev/null +++ b/App_Code/Business Layer/BasePersonalExtWorkRecord.vb @@ -0,0 +1,725 @@ +' This class is "generated" and will be overwritten. +' Your customizations should be made in PersonalExtWorkRecord.vb + +Imports System.Data.SqlTypes +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + +Namespace Persons.Business + +''' +''' The generated superclass for the class. +''' +''' +''' This class is not intended to be instantiated directly. To obtain an instance of this class, +''' use the methods of the class. +''' +''' +''' + + Public Class BasePersonalExtWorkRecord + Inherits PrimaryKeyRecord + + + Public Shared Shadows ReadOnly TableUtils As PersonalExtWorkTable = PersonalExtWorkTable.Instance + + ' Constructors + + Protected Sub New() + MyBase.New(TableUtils) + End Sub + + Protected Sub New(ByVal record As PrimaryKeyRecord) + MyBase.New(record, TableUtils) + End Sub + + 'Evaluates Initialize when->Inserting record formulas specified at the data access layer + Public Overridable Sub PersonalExtWorkRecord_InsertingRecord(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles Me.InsertingRecord + 'Apply Initialize->Inserting record formula only if validation is successful. + Dim PersonalExtWorkRec As PersonalExtWorkRecord = CType(sender,PersonalExtWorkRecord) + Validate_Inserting() + If Not PersonalExtWorkRec Is Nothing AndAlso Not PersonalExtWorkRec.IsReadOnly Then + End If + End Sub + + 'Evaluates Initialize when->Updating record formulas specified at the data access layer + Public Overridable Sub PersonalExtWorkRecord_UpdatingRecord(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles Me.UpdatingRecord + 'Apply Initialize->Updating record formula only if validation is successful. + Dim PersonalExtWorkRec As PersonalExtWorkRecord = CType(sender,PersonalExtWorkRecord) + Validate_Updating() + If Not PersonalExtWorkRec Is Nothing AndAlso Not PersonalExtWorkRec.IsReadOnly Then + End If + End Sub + + 'Evaluates Initialize when->Reading record formulas specified at the data access layer + Public Overridable Sub PersonalExtWorkRecord_ReadRecord(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.ReadRecord + 'Apply Initialize->Reading record formula only if validation is successful. + Dim PersonalExtWorkRec As PersonalExtWorkRecord = CType(sender,PersonalExtWorkRecord) + If Not PersonalExtWorkRec Is Nothing AndAlso Not PersonalExtWorkRec.IsReadOnly Then + End If + End Sub + + 'Evaluates Validate when->Inserting formulas specified at the data access layer + Public Overridable Sub Validate_Inserting () + Dim fullValidationMessage As String = "" + Dim validationMessage As String = "" + + dim formula as String = "" + + + If validationMessage <> "" AndAlso validationMessage.ToLower() <> "true" Then + fullValidationMessage &= validationMessage & vbCrLf + End If + + If fullValidationMessage <> "" Then + Throw New Exception(fullValidationMessage) + End If + End Sub + + 'Evaluates Validate when->Updating formulas specified at the data access layer + Public Overridable Sub Validate_Updating () + Dim fullValidationMessage As String = "" + Dim validationMessage As String = "" + + dim formula as String = "" + + + If validationMessage <> "" AndAlso validationMessage.ToLower() <> "true" Then + fullValidationMessage &= validationMessage & vbCrLf + End If + + If fullValidationMessage <> "" Then + Throw New Exception(fullValidationMessage) + End If + End Sub + + Public Overridable Function EvaluateFormula(ByVal formula As String, Optional ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord = Nothing, Optional ByVal format As String = Nothing) As String + + Dim e As Data.BaseFormulaEvaluator = New Data.BaseFormulaEvaluator() + + ' All variables referred to in the formula are expected to be + ' properties of the DataSource. For example, referring to + ' UnitPrice as a variable will refer to DataSource.UnitPrice + e.DataSource = dataSourceForEvaluate + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + Return resultObj.ToString() + End Function + + + + + + + +#Region "Convenience methods to get/set values of fields" + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalExtWork_.id field. + ''' + Public Function Getid0Value() As ColumnValue + Return Me.GetValue(TableUtils.id0Column) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalExtWork_.id field. + ''' + Public Function Getid0FieldValue() As Int32 + Return CType(Me.GetValue(TableUtils.id0Column).ToInt32(), Int32) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalExtWork_.PersonalId field. + ''' + Public Function GetPersonalIdValue() As ColumnValue + Return Me.GetValue(TableUtils.PersonalIdColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalExtWork_.PersonalId field. + ''' + Public Function GetPersonalIdFieldValue() As String + Return CType(Me.GetValue(TableUtils.PersonalIdColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalExtWork_.PersonalId field. + ''' + Public Sub SetPersonalIdFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.PersonalIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalExtWork_.PersonalId field. + ''' + Public Sub SetPersonalIdFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.PersonalIdColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalExtWork_.Description field. + ''' + Public Function GetDescriptionValue() As ColumnValue + Return Me.GetValue(TableUtils.DescriptionColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalExtWork_.Description field. + ''' + Public Function GetDescriptionFieldValue() As String + Return CType(Me.GetValue(TableUtils.DescriptionColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalExtWork_.Description field. + ''' + Public Sub SetDescriptionFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.DescriptionColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalExtWork_.Description field. + ''' + Public Sub SetDescriptionFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.DescriptionColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalExtWork_.Place field. + ''' + Public Function GetPlaceValue() As ColumnValue + Return Me.GetValue(TableUtils.PlaceColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalExtWork_.Place field. + ''' + Public Function GetPlaceFieldValue() As String + Return CType(Me.GetValue(TableUtils.PlaceColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalExtWork_.Place field. + ''' + Public Sub SetPlaceFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.PlaceColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalExtWork_.Place field. + ''' + Public Sub SetPlaceFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.PlaceColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalExtWork_.Active field. + ''' + Public Function GetActiveValue() As ColumnValue + Return Me.GetValue(TableUtils.ActiveColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalExtWork_.Active field. + ''' + Public Function GetActiveFieldValue() As Boolean + Return CType(Me.GetValue(TableUtils.ActiveColumn).ToBoolean(), Boolean) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalExtWork_.Active field. + ''' + Public Sub SetActiveFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.ActiveColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalExtWork_.Active field. + ''' + Public Sub SetActiveFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.ActiveColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalExtWork_.Active field. + ''' + Public Sub SetActiveFieldValue(ByVal val As Boolean) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.ActiveColumn) + End Sub + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalExtWork_.BeginDate field. + ''' + Public Function GetBeginDateValue() As ColumnValue + Return Me.GetValue(TableUtils.BeginDateColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalExtWork_.BeginDate field. + ''' + Public Function GetBeginDateFieldValue() As DateTime + Return CType(Me.GetValue(TableUtils.BeginDateColumn).ToDateTime(), DateTime) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalExtWork_.BeginDate field. + ''' + Public Sub SetBeginDateFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.BeginDateColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalExtWork_.BeginDate field. + ''' + Public Sub SetBeginDateFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.BeginDateColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalExtWork_.BeginDate field. + ''' + Public Sub SetBeginDateFieldValue(ByVal val As DateTime) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.BeginDateColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalExtWork_.EndDate field. + ''' + Public Function GetEndDateValue() As ColumnValue + Return Me.GetValue(TableUtils.EndDateColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalExtWork_.EndDate field. + ''' + Public Function GetEndDateFieldValue() As DateTime + Return CType(Me.GetValue(TableUtils.EndDateColumn).ToDateTime(), DateTime) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalExtWork_.EndDate field. + ''' + Public Sub SetEndDateFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.EndDateColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalExtWork_.EndDate field. + ''' + Public Sub SetEndDateFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.EndDateColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalExtWork_.EndDate field. + ''' + Public Sub SetEndDateFieldValue(ByVal val As DateTime) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.EndDateColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalExtWork_.Command field. + ''' + Public Function GetCommandValue() As ColumnValue + Return Me.GetValue(TableUtils.CommandColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalExtWork_.Command field. + ''' + Public Function GetCommandFieldValue() As String + Return CType(Me.GetValue(TableUtils.CommandColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalExtWork_.Command field. + ''' + Public Sub SetCommandFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.CommandColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalExtWork_.Command field. + ''' + Public Sub SetCommandFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.CommandColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalExtWork_.CommandDate field. + ''' + Public Function GetCommandDateValue() As ColumnValue + Return Me.GetValue(TableUtils.CommandDateColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalExtWork_.CommandDate field. + ''' + Public Function GetCommandDateFieldValue() As DateTime + Return CType(Me.GetValue(TableUtils.CommandDateColumn).ToDateTime(), DateTime) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalExtWork_.CommandDate field. + ''' + Public Sub SetCommandDateFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.CommandDateColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalExtWork_.CommandDate field. + ''' + Public Sub SetCommandDateFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.CommandDateColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalExtWork_.CommandDate field. + ''' + Public Sub SetCommandDateFieldValue(ByVal val As DateTime) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.CommandDateColumn) + End Sub + + + +#End Region + +#Region "Convenience methods to get field names" + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonalExtWork_.id field. + ''' + Public Property id0() As Int32 + Get + Return CType(Me.GetValue(TableUtils.id0Column).ToInt32(), Int32) + End Get + Set (ByVal val As Int32) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.id0Column) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property id0Specified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.id0Column) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property id0Default() As String + Get + Return TableUtils.id0Column.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonalExtWork_.PersonalId field. + ''' + Public Property PersonalId() As String + Get + Return CType(Me.GetValue(TableUtils.PersonalIdColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.PersonalIdColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property PersonalIdSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.PersonalIdColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property PersonalIdDefault() As String + Get + Return TableUtils.PersonalIdColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonalExtWork_.Description field. + ''' + Public Property Description() As String + Get + Return CType(Me.GetValue(TableUtils.DescriptionColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.DescriptionColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property DescriptionSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.DescriptionColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property DescriptionDefault() As String + Get + Return TableUtils.DescriptionColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonalExtWork_.Place field. + ''' + Public Property Place() As String + Get + Return CType(Me.GetValue(TableUtils.PlaceColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.PlaceColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property PlaceSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.PlaceColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property PlaceDefault() As String + Get + Return TableUtils.PlaceColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonalExtWork_.Active field. + ''' + Public Property Active() As Boolean + Get + Return CType(Me.GetValue(TableUtils.ActiveColumn).ToBoolean(), Boolean) + End Get + Set (ByVal val As Boolean) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.ActiveColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property ActiveSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.ActiveColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property ActiveDefault() As String + Get + Return TableUtils.ActiveColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonalExtWork_.BeginDate field. + ''' + Public Property BeginDate() As DateTime + Get + Return CType(Me.GetValue(TableUtils.BeginDateColumn).ToDateTime(), DateTime) + End Get + Set (ByVal val As DateTime) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.BeginDateColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property BeginDateSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.BeginDateColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property BeginDateDefault() As String + Get + Return TableUtils.BeginDateColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonalExtWork_.EndDate field. + ''' + Public Property EndDate() As DateTime + Get + Return CType(Me.GetValue(TableUtils.EndDateColumn).ToDateTime(), DateTime) + End Get + Set (ByVal val As DateTime) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.EndDateColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property EndDateSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.EndDateColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property EndDateDefault() As String + Get + Return TableUtils.EndDateColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonalExtWork_.Command field. + ''' + Public Property Command() As String + Get + Return CType(Me.GetValue(TableUtils.CommandColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.CommandColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property CommandSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.CommandColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property CommandDefault() As String + Get + Return TableUtils.CommandColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonalExtWork_.CommandDate field. + ''' + Public Property CommandDate() As DateTime + Get + Return CType(Me.GetValue(TableUtils.CommandDateColumn).ToDateTime(), DateTime) + End Get + Set (ByVal val As DateTime) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.CommandDateColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property CommandDateSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.CommandDateColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property CommandDateDefault() As String + Get + Return TableUtils.CommandDateColumn.DefaultValue + End Get + End Property + + + +#End Region + +End Class +End Namespace diff --git a/App_Code/Business Layer/BasePersonalExtWorkTable.vb b/App_Code/Business Layer/BasePersonalExtWorkTable.vb new file mode 100644 index 0000000..f40d5d3 --- /dev/null +++ b/App_Code/Business Layer/BasePersonalExtWorkTable.vb @@ -0,0 +1,930 @@ +' This class is "generated" and will be overwritten. +' Your customizations should be made in PersonalExtWorkRecord.vb + +Imports System.Data.SqlTypes +Imports System.Data +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider +Imports Persons.Data + +Namespace Persons.Business + +''' +''' The generated superclass for the class. +''' Provides access to the schema information and record data of a database table or view named PersonalExtWork. +''' +''' +''' The connection details (name, location, etc.) of the database and table (or view) accessed by this class +''' are resolved at runtime based on the connection string in the application's Web.Config file. +''' +''' This class is not intended to be instantiated directly. To obtain an instance of this class, use +''' PersonalExtWorkTable.Instance. +''' +''' +''' + + Public Class BasePersonalExtWorkTable + Inherits PrimaryKeyTable + + + Private ReadOnly TableDefinitionString As String = PersonalExtWorkDefinition.GetXMLString() + + + + + + + + Protected Sub New() + MyBase.New() + Me.Initialize() + End Sub + + Protected Overridable Sub Initialize() + Dim def As New XmlTableDefinition(TableDefinitionString) + Me.TableDefinition = New TableDefinition() + Me.TableDefinition.TableClassName = System.Reflection.Assembly.CreateQualifiedName("App_Code", "Persons.Business.PersonalExtWorkTable") + def.InitializeTableDefinition(Me.TableDefinition) + Me.ConnectionName = def.GetConnectionName() + Me.RecordClassName = System.Reflection.Assembly.CreateQualifiedName("App_Code", "Persons.Business.PersonalExtWorkRecord") + Me.ApplicationName = "App_Code" + Me.DataAdapter = New PersonalExtWorkSqlTable() + Directcast(Me.DataAdapter, PersonalExtWorkSqlTable).ConnectionName = Me.ConnectionName + + Me.TableDefinition.AdapterMetaData = Me.DataAdapter.AdapterMetaData + id0Column.CodeName = "id0" + PersonalIdColumn.CodeName = "PersonalId" + DescriptionColumn.CodeName = "Description" + PlaceColumn.CodeName = "Place" + ActiveColumn.CodeName = "Active" + BeginDateColumn.CodeName = "BeginDate" + EndDateColumn.CodeName = "EndDate" + CommandColumn.CodeName = "Command" + CommandDateColumn.CodeName = "CommandDate" + + End Sub + +#Region "Overriden methods" + + +#End Region + +#Region "Properties for columns" + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalExtWork_.id column object. + ''' + Public ReadOnly Property id0Column() As BaseClasses.Data.NumberColumn + Get + Return CType(Me.TableDefinition.ColumnList(0), BaseClasses.Data.NumberColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalExtWork_.id column object. + ''' + Public Shared ReadOnly Property id0() As BaseClasses.Data.NumberColumn + Get + Return PersonalExtWorkTable.Instance.id0Column + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonalExtWork_.PersonalId column object. + ''' + Public ReadOnly Property PersonalIdColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(1), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalExtWork_.PersonalId column object. + ''' + Public Shared ReadOnly Property PersonalId() As BaseClasses.Data.StringColumn + Get + Return PersonalExtWorkTable.Instance.PersonalIdColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonalExtWork_.Description column object. + ''' + Public ReadOnly Property DescriptionColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(2), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalExtWork_.Description column object. + ''' + Public Shared ReadOnly Property Description() As BaseClasses.Data.StringColumn + Get + Return PersonalExtWorkTable.Instance.DescriptionColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonalExtWork_.Place column object. + ''' + Public ReadOnly Property PlaceColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(3), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalExtWork_.Place column object. + ''' + Public Shared ReadOnly Property Place() As BaseClasses.Data.StringColumn + Get + Return PersonalExtWorkTable.Instance.PlaceColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonalExtWork_.Active column object. + ''' + Public ReadOnly Property ActiveColumn() As BaseClasses.Data.BooleanColumn + Get + Return CType(Me.TableDefinition.ColumnList(4), BaseClasses.Data.BooleanColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalExtWork_.Active column object. + ''' + Public Shared ReadOnly Property Active() As BaseClasses.Data.BooleanColumn + Get + Return PersonalExtWorkTable.Instance.ActiveColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonalExtWork_.BeginDate column object. + ''' + Public ReadOnly Property BeginDateColumn() As BaseClasses.Data.DateColumn + Get + Return CType(Me.TableDefinition.ColumnList(5), BaseClasses.Data.DateColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalExtWork_.BeginDate column object. + ''' + Public Shared ReadOnly Property BeginDate() As BaseClasses.Data.DateColumn + Get + Return PersonalExtWorkTable.Instance.BeginDateColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonalExtWork_.EndDate column object. + ''' + Public ReadOnly Property EndDateColumn() As BaseClasses.Data.DateColumn + Get + Return CType(Me.TableDefinition.ColumnList(6), BaseClasses.Data.DateColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalExtWork_.EndDate column object. + ''' + Public Shared ReadOnly Property EndDate() As BaseClasses.Data.DateColumn + Get + Return PersonalExtWorkTable.Instance.EndDateColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonalExtWork_.Command column object. + ''' + Public ReadOnly Property CommandColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(7), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalExtWork_.Command column object. + ''' + Public Shared ReadOnly Property Command() As BaseClasses.Data.StringColumn + Get + Return PersonalExtWorkTable.Instance.CommandColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonalExtWork_.CommandDate column object. + ''' + Public ReadOnly Property CommandDateColumn() As BaseClasses.Data.DateColumn + Get + Return CType(Me.TableDefinition.ColumnList(8), BaseClasses.Data.DateColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalExtWork_.CommandDate column object. + ''' + Public Shared ReadOnly Property CommandDate() As BaseClasses.Data.DateColumn + Get + Return PersonalExtWorkTable.Instance.CommandDateColumn + End Get + End Property + + +#End Region + + +#Region "Shared helper methods" + + ''' + ''' This is a shared function that can be used to get an array of PersonalExtWorkRecord records using a where clause. + ''' + Public Shared Function GetRecords(ByVal where As String) As PersonalExtWorkRecord() + + Return GetRecords(where, Nothing, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) + End Function + + ''' + ''' This is a shared function that can be used to get an array of PersonalExtWorkRecord records using a where clause. + ''' + Public Shared Function GetRecords(ByVal join As BaseFilter, ByVal where As String) As PersonalExtWorkRecord() + + Return GetRecords(join, where, Nothing, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) + End Function + + ''' + ''' This is a shared function that can be used to get an array of PersonalExtWorkRecord records using a where and order by clause. + ''' + Public Shared Function GetRecords( _ + ByVal where As String, _ + ByVal orderBy As OrderBy) As PersonalExtWorkRecord() + + Return GetRecords(where, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) + End Function + + ''' + ''' This is a shared function that can be used to get an array of PersonalExtWorkRecord records using a where and order by clause. + ''' + Public Shared Function GetRecords( _ + ByVal join As BaseFilter, _ + ByVal where As String, _ + ByVal orderBy As OrderBy) As PersonalExtWorkRecord() + + Return GetRecords(join, where, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) + End Function + + ''' + ''' This is a shared function that can be used to get an array of PersonalExtWorkRecord records using a where and order by clause clause with pagination. + ''' + Public Shared Function GetRecords( _ + ByVal where As String, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As PersonalExtWorkRecord() + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + Dim join As BaseClasses.Data.BaseFilter = Nothing + Dim recList As ArrayList = PersonalExtWorkTable.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, pageIndex, pageSize) + + Return CType(recList.ToArray(GetType(Persons.Business.PersonalExtWorkRecord)), PersonalExtWorkRecord()) + End Function + + ''' + ''' This is a shared function that can be used to get an array of PersonalExtWorkRecord records using a where and order by clause clause with pagination. + ''' + Public Shared Function GetRecords( _ + ByVal join As BaseFilter, _ + ByVal where As String, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As PersonalExtWorkRecord() + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Dim recList As ArrayList = PersonalExtWorkTable.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, pageIndex, pageSize) + + Return CType(recList.ToArray(GetType(Persons.Business.PersonalExtWorkRecord)), PersonalExtWorkRecord()) + End Function + + Public Shared Function GetRecords( _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As PersonalExtWorkRecord() + Dim join As BaseClasses.Data.BaseFilter = Nothing + Dim recList As ArrayList = PersonalExtWorkTable.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + Return CType(recList.ToArray(GetType(Persons.Business.PersonalExtWorkRecord)), PersonalExtWorkRecord()) + End Function + + Public Shared Function GetRecords( _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As PersonalExtWorkRecord() + + Dim recList As ArrayList = PersonalExtWorkTable.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + Return CType(recList.ToArray(GetType(Persons.Business.PersonalExtWorkRecord)), PersonalExtWorkRecord()) + End Function + + Public Shared Function GetRecords( _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer, _ + ByRef totalRecords As Integer) As PersonalExtWorkRecord() + Dim join As BaseClasses.Data.BaseFilter = Nothing + Dim recList As ArrayList = PersonalExtWorkTable.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize, totalRecords) + + Return CType(recList.ToArray(GetType(Persons.Business.PersonalExtWorkRecord)), PersonalExtWorkRecord()) + End Function + + Public Shared Function GetRecords( _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer, _ + ByRef totalRecords As Integer) As PersonalExtWorkRecord() + + Dim recList As ArrayList = PersonalExtWorkTable.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize, totalRecords) + + Return CType(recList.ToArray(GetType(Persons.Business.PersonalExtWorkRecord)), PersonalExtWorkRecord()) + End Function + + ''' + ''' This is a shared function that can be used to get total number of records that will be returned using the where clause. + ''' + Public Shared Function GetRecordCount(ByVal where As String) As Integer + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Return CInt(PersonalExtWorkTable.Instance.GetRecordListCount(Nothing, whereFilter, Nothing, Nothing)) + End Function + +''' + ''' This is a shared function that can be used to get total number of records that will be returned using the where clause. + ''' + Public Shared Function GetRecordCount(ByVal join As BaseFilter, ByVal where As String) As Integer + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Return CInt(PersonalExtWorkTable.Instance.GetRecordListCount(join, whereFilter, Nothing, Nothing)) + End Function + + Public Shared Function GetRecordCount(ByVal where As WhereClause) As Integer + Return CInt(PersonalExtWorkTable.Instance.GetRecordListCount(Nothing, where.GetFilter(), Nothing, Nothing)) + End Function + + Public Shared Function GetRecordCount(ByVal join As BaseFilter, ByVal where As WhereClause) As Integer + Return CInt(PersonalExtWorkTable.Instance.GetRecordListCount(join, where.GetFilter(), Nothing, Nothing)) + End Function + + ''' + ''' This is a shared function that can be used to get a PersonalExtWorkRecord record using a where clause. + ''' + Public Shared Function GetRecord(ByVal where As String) As PersonalExtWorkRecord + Dim orderBy As OrderBy = Nothing + Return GetRecord(where, orderBy) + End Function + + ''' + ''' This is a shared function that can be used to get a PersonalExtWorkRecord record using a where clause. + ''' + Public Shared Function GetRecord(ByVal join As BaseFilter, ByVal where As String) As PersonalExtWorkRecord + Dim orderBy As OrderBy = Nothing + Return GetRecord(join, where, orderBy) + End Function + + ''' + ''' This is a shared function that can be used to get a PersonalExtWorkRecord record using a where and order by clause. + ''' + Public Shared Function GetRecord( _ + ByVal where As String, _ + ByVal orderBy As OrderBy) As PersonalExtWorkRecord + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + Dim join As BaseClasses.Data.BaseFilter = Nothing + Dim recList As ArrayList = PersonalExtWorkTable.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MIN_BATCH_SIZE) + + Dim rec As PersonalExtWorkRecord = Nothing + If recList.Count > 0 Then + rec = CType(recList(0), PersonalExtWorkRecord) + End If + + Return rec + End Function + + ''' + ''' This is a shared function that can be used to get a PersonalExtWorkRecord record using a where and order by clause. + ''' + Public Shared Function GetRecord( _ + ByVal join As BaseFilter, _ + ByVal where As String, _ + ByVal orderBy As OrderBy) As PersonalExtWorkRecord + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Dim recList As ArrayList = PersonalExtWorkTable.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MIN_BATCH_SIZE) + + Dim rec As PersonalExtWorkRecord = Nothing + If recList.Count > 0 Then + rec = CType(recList(0), PersonalExtWorkRecord) + End If + + Return rec + End Function + + + Public Shared Function GetValues( _ + ByVal col As BaseColumn, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal maxItems As Integer) As String() + + ' Create the filter list. + Dim retCol As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, True) + retCol.AddColumn(col) + + Return PersonalExtWorkTable.Instance.GetColumnValues(retCol, Nothing, where.GetFilter(), Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, maxItems) + + End Function + + Public Shared Function GetValues( _ + ByVal col As BaseColumn, _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal maxItems As Integer) As String() + + ' Create the filter list. + Dim retCol As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, True) + retCol.AddColumn(col) + + Return PersonalExtWorkTable.Instance.GetColumnValues(retCol, join, where.GetFilter(), Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, maxItems) + + End Function + + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where clause. + ''' + Public Shared Function GetDataTable(ByVal where As String) As System.Data.DataTable + + Dim recs() As PersonalExtWorkRecord = GetRecords(where) + Return PersonalExtWorkTable.Instance.CreateDataTable(recs, Nothing) + End Function + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where clause. + ''' + Public Shared Function GetDataTable(ByVal join As BaseFilter, ByVal where As String) As System.Data.DataTable + + Dim recs() As PersonalExtWorkRecord = GetRecords(join, where) + Return PersonalExtWorkTable.Instance.CreateDataTable(recs, Nothing) + End Function + + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause. + ''' + Public Shared Function GetDataTable(ByVal where As String, ByVal orderBy As OrderBy) As System.Data.DataTable + + Dim recs() As PersonalExtWorkRecord = GetRecords(where, orderBy) + Return PersonalExtWorkTable.Instance.CreateDataTable(recs, Nothing) + End Function + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause. + ''' + Public Shared Function GetDataTable(ByVal join As BaseFilter, ByVal where As String, ByVal orderBy As OrderBy) As System.Data.DataTable + + Dim recs() As PersonalExtWorkRecord = GetRecords(join, where, orderBy) + Return PersonalExtWorkTable.Instance.CreateDataTable(recs, Nothing) + End Function + + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause with pagination. + ''' + Public Shared Function GetDataTable( _ + ByVal where As String, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As System.Data.DataTable + + Dim recs() As PersonalExtWorkRecord = GetRecords(where, orderBy, pageIndex, pageSize) + Return PersonalExtWorkTable.Instance.CreateDataTable(recs, Nothing) + End Function + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause with pagination. + ''' + Public Shared Function GetDataTable( _ + ByVal join As BaseFilter, _ + ByVal where As String, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As System.Data.DataTable + + Dim recs() As PersonalExtWorkRecord = GetRecords(join, where, orderBy, pageIndex, pageSize) + Return PersonalExtWorkTable.Instance.CreateDataTable(recs, Nothing) + End Function + + + ''' + ''' This is a shared function that can be used to delete records using a where clause. + ''' + Public Shared Sub DeleteRecords(ByVal where As String) + If where = Nothing OrElse where.Trim() = "" Then + Return + End If + + Dim whereFilter As SqlFilter = New SqlFilter(where) + PersonalExtWorkTable.Instance.DeleteRecordList(whereFilter) + End Sub + + ''' + ''' This is a shared function that can be used to export records using a where clause. + ''' + Public Shared Function Export(ByVal where As String) As String + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Return PersonalExtWorkTable.Instance.ExportRecordData(whereFilter) + End Function + + Public Shared Function Export(ByVal where As WhereClause) As String + Dim whereFilter As BaseFilter = Nothing + If Not where Is Nothing Then + whereFilter = where.GetFilter() + End If + + Return PersonalExtWorkTable.Instance.ExportRecordData(whereFilter) + End Function + + Public Shared Function GetSum( _ + ByVal col As BaseColumn, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) _ + As String + + Dim colSel As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, False) + colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Sum) + + Return PersonalExtWorkTable.Instance.GetColumnStatistics(colSel, Nothing, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + End Function + + Public Shared Function GetSum( _ + ByVal col As BaseColumn, _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) _ + As String + + Dim colSel As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, False) + colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Sum) + + Return PersonalExtWorkTable.Instance.GetColumnStatistics(colSel, join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + End Function + + + Public Shared Function GetCount( _ + ByVal col As BaseColumn, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) _ + As String + + Dim colSel As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, False) + colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Count) + + Return PersonalExtWorkTable.Instance.GetColumnStatistics(colSel, Nothing, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + End Function + + Public Shared Function GetCount( _ + ByVal col As BaseColumn, _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) _ + As String + + Dim colSel As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, False) + colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Count) + + Return PersonalExtWorkTable.Instance.GetColumnStatistics(colSel, join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + End Function + + ''' + ''' This method returns the columns in the table. + ''' + Public Shared Function GetColumns() As BaseColumn() + Return PersonalExtWorkTable.Instance.TableDefinition.Columns + End Function + + ''' + ''' This method returns the columnlist in the table. + ''' + Public Shared Function GetColumnList() As ColumnList + Return PersonalExtWorkTable.Instance.TableDefinition.ColumnList + End Function + + + ''' + ''' This method creates a new record and returns it to be edited. + ''' + Public Shared Function CreateNewRecord() As IRecord + Return PersonalExtWorkTable.Instance.CreateRecord() + End Function + + ''' + ''' This method creates a new record and returns it to be edited. + ''' + ''' ID of the new record. + Public Shared Function CreateNewRecord(ByVal tempId As String) As IRecord + Return PersonalExtWorkTable.Instance.CreateRecord(tempId) + End Function + + ''' + ''' This method checks if column is editable. + ''' + ''' Name of the column to check. + Public Shared Function isReadOnlyColumn(ByVal columnName As String) As Boolean + Dim column As BaseColumn = GetColumn(columnName) + If (Not IsNothing(column)) Then + Return column.IsValuesReadOnly + Else + Return True + End If + End Function + + ''' + ''' This method gets the specified column. + ''' + ''' Unique name of the column to fetch. + Public Shared Function GetColumn(ByVal uniqueColumnName As String) As BaseColumn + Dim column As BaseColumn = PersonalExtWorkTable.Instance.TableDefinition.ColumnList.GetByUniqueName(uniqueColumnName) + Return column + End Function + + ' Convenience method for getting a record using a string-based record identifier + Public Shared Function GetRecord(ByVal id As String, ByVal bMutable As Boolean) As PersonalExtWorkRecord + Return CType(PersonalExtWorkTable.Instance.GetRecordData(id, bMutable), PersonalExtWorkRecord) + End Function + + ' Convenience method for getting a record using a KeyValue record identifier + Public Shared Function GetRecord(ByVal id As KeyValue, ByVal bMutable As Boolean) As PersonalExtWorkRecord + Return CType(PersonalExtWorkTable.Instance.GetRecordData(id, bMutable), PersonalExtWorkRecord) + End Function + + ' Convenience method for creating a record + Public Overloads Function NewRecord( _ + ByVal PersonalIdValue As String, _ + ByVal DescriptionValue As String, _ + ByVal PlaceValue As String, _ + ByVal ActiveValue As String, _ + ByVal BeginDateValue As String, _ + ByVal EndDateValue As String, _ + ByVal CommandValue As String, _ + ByVal CommandDateValue As String _ + ) As KeyValue + Dim rec As IPrimaryKeyRecord = CType(Me.CreateRecord(), IPrimaryKeyRecord) + rec.SetString(PersonalIdValue, PersonalIdColumn) + rec.SetString(DescriptionValue, DescriptionColumn) + rec.SetString(PlaceValue, PlaceColumn) + rec.SetString(ActiveValue, ActiveColumn) + rec.SetString(BeginDateValue, BeginDateColumn) + rec.SetString(EndDateValue, EndDateColumn) + rec.SetString(CommandValue, CommandColumn) + rec.SetString(CommandDateValue, CommandDateColumn) + + + rec.Create() 'update the DB so any DB-initialized fields (like autoincrement IDs) can be initialized + + Dim key As KeyValue = rec.GetID() + Return key + End Function + + ''' + ''' This method deletes a specified record + ''' + ''' Keyvalue of the record to be deleted. + Public Shared Sub DeleteRecord(ByVal kv As KeyValue) + PersonalExtWorkTable.Instance.DeleteOneRecord(kv) + End Sub + + ''' + ''' This method checks if record exist in the database using the keyvalue provided. + ''' + ''' Key value of the record. + Public Shared Function DoesRecordExist(ByVal kv As KeyValue) As Boolean + Dim recordExist As Boolean = True + Try + PersonalExtWorkTable.GetRecord(kv, False) + Catch ex As Exception + recordExist = False + End Try + Return recordExist + End Function + + ''' + ''' This method returns all the primary columns in the table. + ''' + Public Shared Function GetPrimaryKeyColumns() As ColumnList + If (Not IsNothing(PersonalExtWorkTable.Instance.TableDefinition.PrimaryKey)) Then + Return PersonalExtWorkTable.Instance.TableDefinition.PrimaryKey.Columns + Else + Return Nothing + End If + End Function + + ''' + ''' This method takes a key and returns a keyvalue. + ''' + ''' key could be array of primary key values in case of composite primary key or a string containing single primary key value in case of non-composite primary key. + Public Shared Function GetKeyValue(ByVal key As Object) As KeyValue + Dim kv As KeyValue = Nothing + + If (Not (IsNothing(PersonalExtWorkTable.Instance.TableDefinition.PrimaryKey))) Then + + Dim isCompositePrimaryKey As Boolean = False + isCompositePrimaryKey = PersonalExtWorkTable.Instance.TableDefinition.PrimaryKey.IsCompositeKey + + If ((isCompositePrimaryKey) AndAlso (key.GetType.IsArray())) Then + + ' If the key is composite, then construct a key value. + kv = New KeyValue + Dim fullKeyString As String = "" + Dim keyArray As Array = CType(key, Array) + If (Not IsNothing(keyArray)) Then + Dim length As Integer = keyArray.Length + Dim pkColumns As ColumnList = PersonalExtWorkTable.Instance.TableDefinition.PrimaryKey.Columns + Dim pkColumn As BaseColumn + Dim index As Integer = 0 + For Each pkColumn In pkColumns + Dim keyString As String = CType(keyArray.GetValue(index), String) + If (PersonalExtWorkTable.Instance.TableDefinition.TableType = BaseClasses.Data.TableDefinition.TableTypes.Virtual) Then + kv.AddElement(pkColumn.UniqueName, keyString) + Else + kv.AddElement(pkColumn.InternalName, keyString) + End If + index = index + 1 + Next pkColumn + End If + + Else + ' If the key is not composite, then get the key value. + kv = PersonalExtWorkTable.Instance.TableDefinition.PrimaryKey.ParseValue(CType(key, String)) + End If + End If + Return kv + End Function + + + ''' + ''' This method takes a record and a Column and returns an evaluated value of DFKA formula. + ''' + Public Shared Function GetDFKA(ByVal rec As BaseRecord, ByVal col As BaseColumn) As String + Dim fkColumn As ForeignKey = PersonalExtWorkTable.Instance.TableDefinition.GetExpandableNonCompositeForeignKey(col) + If fkColumn Is Nothing Then + Return Nothing + End If + Dim _DFKA As String = fkColumn.PrimaryKeyDisplayColumns + If (_DFKA.Trim().StartsWith("=")) Then + ' if the formula is in the format of "= ., then pull out the data from the rec object instead of doing formula evaluation + Dim tableCodeName As String = fkColumn.PrimaryKeyTableDefinition.TableCodeName + Dim column As String = _DFKA.Trim("="c).Trim() + If column.StartsWith(tableCodeName & ".", StringComparison.InvariantCultureIgnoreCase) Then + column = column.Substring(tableCodeName.Length + 1) + End If + + For Each c As BaseColumn In fkColumn.PrimaryKeyTableDefinition.Columns + If column = c.CodeName Then + Return rec.Format(c) + End If + Next + Dim tableName As String = fkColumn.PrimaryKeyTableDefinition.TableCodeName + Return EvaluateFormula(_DFKA, rec, Nothing, tableName) + Else + Return Nothing + End If + End Function + + ''' + ''' This method takes a keyValue and a Column and returns an evaluated value of DFKA formula. + ''' + Public Shared Function GetDFKA(ByVal keyValue As String, ByVal col As BaseColumn, ByVal formatPattern as String) As String + If keyValue Is Nothing Then + Return Nothing + End If + Dim fkColumn As ForeignKey = PersonalExtWorkTable.Instance.TableDefinition.GetExpandableNonCompositeForeignKey(col) + If fkColumn Is Nothing Then + Return Nothing + End If + Dim _DFKA As String = fkColumn.PrimaryKeyDisplayColumns + If (_DFKA.Trim().StartsWith("=")) Then + Dim tableName As String = fkColumn.PrimaryKeyTableDefinition.TableCodeName + Dim t As PrimaryKeyTable = CType(DatabaseObjects.GetTableObject(tableName), PrimaryKeyTable) + Dim rec As BaseRecord = Nothing + If Not t Is Nothing Then + Try + rec = CType(t.GetRecordData(keyValue, False), BaseRecord) + Catch + rec = Nothing + End Try + End If + If rec Is Nothing Then + Return "" + End If + + ' if the formula is in the format of "= ., then pull out the data from the rec object instead of doing formula evaluation + Dim tableCodeName As String = fkColumn.PrimaryKeyTableDefinition.TableCodeName + Dim column As String = _DFKA.Trim("="c).Trim() + If column.StartsWith(tableCodeName & ".", StringComparison.InvariantCultureIgnoreCase) Then + column = column.Substring(tableCodeName.Length + 1) + End If + + For Each c As BaseColumn In fkColumn.PrimaryKeyTableDefinition.Columns + If column = c.CodeName Then + Return rec.Format(c) + End If + Next + Return EvaluateFormula(_DFKA, rec, Nothing, tableName) + Else + Return Nothing + End If + End Function + + ''' + ''' Evaluates the formula + ''' + Public Shared Function EvaluateFormula(ByVal formula As String, Optional ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord = Nothing, Optional ByVal format As String = Nothing, Optional ByVal name As String = "") As String + Dim e As BaseFormulaEvaluator = New BaseFormulaEvaluator() + If Not dataSourceForEvaluate Is Nothing Then + e.Evaluator.Variables.Add(name, dataSourceForEvaluate) + end if + e.DataSource = dataSourceForEvaluate + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + If Not String.IsNullOrEmpty(format) Then + Return BaseFormulaUtils.Format(resultObj, format) + Else + Return resultObj.ToString() + End If + End Function + + +#End Region + +End Class +End Namespace diff --git a/App_Code/Business Layer/BasePersonalExtraSalaryRecord.vb b/App_Code/Business Layer/BasePersonalExtraSalaryRecord.vb new file mode 100644 index 0000000..c6237fd --- /dev/null +++ b/App_Code/Business Layer/BasePersonalExtraSalaryRecord.vb @@ -0,0 +1,628 @@ +' This class is "generated" and will be overwritten. +' Your customizations should be made in PersonalExtraSalaryRecord.vb + +Imports System.Data.SqlTypes +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + +Namespace Persons.Business + +''' +''' The generated superclass for the class. +''' +''' +''' This class is not intended to be instantiated directly. To obtain an instance of this class, +''' use the methods of the class. +''' +''' +''' + + Public Class BasePersonalExtraSalaryRecord + Inherits PrimaryKeyRecord + + + Public Shared Shadows ReadOnly TableUtils As PersonalExtraSalaryTable = PersonalExtraSalaryTable.Instance + + ' Constructors + + Protected Sub New() + MyBase.New(TableUtils) + End Sub + + Protected Sub New(ByVal record As PrimaryKeyRecord) + MyBase.New(record, TableUtils) + End Sub + + 'Evaluates Initialize when->Inserting record formulas specified at the data access layer + Public Overridable Sub PersonalExtraSalaryRecord_InsertingRecord(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles Me.InsertingRecord + 'Apply Initialize->Inserting record formula only if validation is successful. + Dim PersonalExtraSalaryRec As PersonalExtraSalaryRecord = CType(sender,PersonalExtraSalaryRecord) + Validate_Inserting() + If Not PersonalExtraSalaryRec Is Nothing AndAlso Not PersonalExtraSalaryRec.IsReadOnly Then + End If + End Sub + + 'Evaluates Initialize when->Updating record formulas specified at the data access layer + Public Overridable Sub PersonalExtraSalaryRecord_UpdatingRecord(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles Me.UpdatingRecord + 'Apply Initialize->Updating record formula only if validation is successful. + Dim PersonalExtraSalaryRec As PersonalExtraSalaryRecord = CType(sender,PersonalExtraSalaryRecord) + Validate_Updating() + If Not PersonalExtraSalaryRec Is Nothing AndAlso Not PersonalExtraSalaryRec.IsReadOnly Then + End If + End Sub + + 'Evaluates Initialize when->Reading record formulas specified at the data access layer + Public Overridable Sub PersonalExtraSalaryRecord_ReadRecord(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.ReadRecord + 'Apply Initialize->Reading record formula only if validation is successful. + Dim PersonalExtraSalaryRec As PersonalExtraSalaryRecord = CType(sender,PersonalExtraSalaryRecord) + If Not PersonalExtraSalaryRec Is Nothing AndAlso Not PersonalExtraSalaryRec.IsReadOnly Then + End If + End Sub + + 'Evaluates Validate when->Inserting formulas specified at the data access layer + Public Overridable Sub Validate_Inserting () + Dim fullValidationMessage As String = "" + Dim validationMessage As String = "" + + dim formula as String = "" + + + If validationMessage <> "" AndAlso validationMessage.ToLower() <> "true" Then + fullValidationMessage &= validationMessage & vbCrLf + End If + + If fullValidationMessage <> "" Then + Throw New Exception(fullValidationMessage) + End If + End Sub + + 'Evaluates Validate when->Updating formulas specified at the data access layer + Public Overridable Sub Validate_Updating () + Dim fullValidationMessage As String = "" + Dim validationMessage As String = "" + + dim formula as String = "" + + + If validationMessage <> "" AndAlso validationMessage.ToLower() <> "true" Then + fullValidationMessage &= validationMessage & vbCrLf + End If + + If fullValidationMessage <> "" Then + Throw New Exception(fullValidationMessage) + End If + End Sub + + Public Overridable Function EvaluateFormula(ByVal formula As String, Optional ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord = Nothing, Optional ByVal format As String = Nothing) As String + + Dim e As Data.BaseFormulaEvaluator = New Data.BaseFormulaEvaluator() + + ' All variables referred to in the formula are expected to be + ' properties of the DataSource. For example, referring to + ' UnitPrice as a variable will refer to DataSource.UnitPrice + e.DataSource = dataSourceForEvaluate + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + Return resultObj.ToString() + End Function + + + + + + + +#Region "Convenience methods to get/set values of fields" + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalExtraSalary_.Id field. + ''' + Public Function GetId0Value() As ColumnValue + Return Me.GetValue(TableUtils.Id0Column) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalExtraSalary_.Id field. + ''' + Public Function GetId0FieldValue() As Int32 + Return CType(Me.GetValue(TableUtils.Id0Column).ToInt32(), Int32) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalExtraSalary_.PersonalId field. + ''' + Public Function GetPersonalIdValue() As ColumnValue + Return Me.GetValue(TableUtils.PersonalIdColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalExtraSalary_.PersonalId field. + ''' + Public Function GetPersonalIdFieldValue() As String + Return CType(Me.GetValue(TableUtils.PersonalIdColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalExtraSalary_.PersonalId field. + ''' + Public Sub SetPersonalIdFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.PersonalIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalExtraSalary_.PersonalId field. + ''' + Public Sub SetPersonalIdFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.PersonalIdColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalExtraSalary_.ExtraSalaryId field. + ''' + Public Function GetExtraSalaryIdValue() As ColumnValue + Return Me.GetValue(TableUtils.ExtraSalaryIdColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalExtraSalary_.ExtraSalaryId field. + ''' + Public Function GetExtraSalaryIdFieldValue() As Int32 + Return CType(Me.GetValue(TableUtils.ExtraSalaryIdColumn).ToInt32(), Int32) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalExtraSalary_.ExtraSalaryId field. + ''' + Public Sub SetExtraSalaryIdFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.ExtraSalaryIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalExtraSalary_.ExtraSalaryId field. + ''' + Public Sub SetExtraSalaryIdFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.ExtraSalaryIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalExtraSalary_.ExtraSalaryId field. + ''' + Public Sub SetExtraSalaryIdFieldValue(ByVal val As Double) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.ExtraSalaryIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalExtraSalary_.ExtraSalaryId field. + ''' + Public Sub SetExtraSalaryIdFieldValue(ByVal val As Decimal) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.ExtraSalaryIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalExtraSalary_.ExtraSalaryId field. + ''' + Public Sub SetExtraSalaryIdFieldValue(ByVal val As Int64) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.ExtraSalaryIdColumn) + End Sub + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalExtraSalary_.Amout field. + ''' + Public Function GetAmoutValue() As ColumnValue + Return Me.GetValue(TableUtils.AmoutColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalExtraSalary_.Amout field. + ''' + Public Function GetAmoutFieldValue() As Int32 + Return CType(Me.GetValue(TableUtils.AmoutColumn).ToInt32(), Int32) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalExtraSalary_.Amout field. + ''' + Public Sub SetAmoutFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.AmoutColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalExtraSalary_.Amout field. + ''' + Public Sub SetAmoutFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.AmoutColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalExtraSalary_.Amout field. + ''' + Public Sub SetAmoutFieldValue(ByVal val As Double) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.AmoutColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalExtraSalary_.Amout field. + ''' + Public Sub SetAmoutFieldValue(ByVal val As Decimal) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.AmoutColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalExtraSalary_.Amout field. + ''' + Public Sub SetAmoutFieldValue(ByVal val As Int64) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.AmoutColumn) + End Sub + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalExtraSalary_.StartDate field. + ''' + Public Function GetStartDateValue() As ColumnValue + Return Me.GetValue(TableUtils.StartDateColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalExtraSalary_.StartDate field. + ''' + Public Function GetStartDateFieldValue() As DateTime + Return CType(Me.GetValue(TableUtils.StartDateColumn).ToDateTime(), DateTime) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalExtraSalary_.StartDate field. + ''' + Public Sub SetStartDateFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.StartDateColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalExtraSalary_.StartDate field. + ''' + Public Sub SetStartDateFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.StartDateColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalExtraSalary_.StartDate field. + ''' + Public Sub SetStartDateFieldValue(ByVal val As DateTime) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.StartDateColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalExtraSalary_.Ref field. + ''' + Public Function GetRef0Value() As ColumnValue + Return Me.GetValue(TableUtils.Ref0Column) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalExtraSalary_.Ref field. + ''' + Public Function GetRef0FieldValue() As String + Return CType(Me.GetValue(TableUtils.Ref0Column).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalExtraSalary_.Ref field. + ''' + Public Sub SetRef0FieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.Ref0Column) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalExtraSalary_.Ref field. + ''' + Public Sub SetRef0FieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.Ref0Column) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalExtraSalary_.RefDate field. + ''' + Public Function GetRefDateValue() As ColumnValue + Return Me.GetValue(TableUtils.RefDateColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalExtraSalary_.RefDate field. + ''' + Public Function GetRefDateFieldValue() As DateTime + Return CType(Me.GetValue(TableUtils.RefDateColumn).ToDateTime(), DateTime) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalExtraSalary_.RefDate field. + ''' + Public Sub SetRefDateFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.RefDateColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalExtraSalary_.RefDate field. + ''' + Public Sub SetRefDateFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.RefDateColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalExtraSalary_.RefDate field. + ''' + Public Sub SetRefDateFieldValue(ByVal val As DateTime) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.RefDateColumn) + End Sub + + + +#End Region + +#Region "Convenience methods to get field names" + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonalExtraSalary_.Id field. + ''' + Public Property Id0() As Int32 + Get + Return CType(Me.GetValue(TableUtils.Id0Column).ToInt32(), Int32) + End Get + Set (ByVal val As Int32) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.Id0Column) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property Id0Specified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.Id0Column) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property Id0Default() As String + Get + Return TableUtils.Id0Column.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonalExtraSalary_.PersonalId field. + ''' + Public Property PersonalId() As String + Get + Return CType(Me.GetValue(TableUtils.PersonalIdColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.PersonalIdColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property PersonalIdSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.PersonalIdColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property PersonalIdDefault() As String + Get + Return TableUtils.PersonalIdColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonalExtraSalary_.ExtraSalaryId field. + ''' + Public Property ExtraSalaryId() As Int32 + Get + Return CType(Me.GetValue(TableUtils.ExtraSalaryIdColumn).ToInt32(), Int32) + End Get + Set (ByVal val As Int32) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.ExtraSalaryIdColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property ExtraSalaryIdSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.ExtraSalaryIdColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property ExtraSalaryIdDefault() As String + Get + Return TableUtils.ExtraSalaryIdColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonalExtraSalary_.Amout field. + ''' + Public Property Amout() As Int32 + Get + Return CType(Me.GetValue(TableUtils.AmoutColumn).ToInt32(), Int32) + End Get + Set (ByVal val As Int32) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.AmoutColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property AmoutSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.AmoutColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property AmoutDefault() As String + Get + Return TableUtils.AmoutColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonalExtraSalary_.StartDate field. + ''' + Public Property StartDate() As DateTime + Get + Return CType(Me.GetValue(TableUtils.StartDateColumn).ToDateTime(), DateTime) + End Get + Set (ByVal val As DateTime) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.StartDateColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property StartDateSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.StartDateColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property StartDateDefault() As String + Get + Return TableUtils.StartDateColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonalExtraSalary_.Ref field. + ''' + Public Property Ref0() As String + Get + Return CType(Me.GetValue(TableUtils.Ref0Column).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.Ref0Column) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property Ref0Specified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.Ref0Column) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property Ref0Default() As String + Get + Return TableUtils.Ref0Column.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonalExtraSalary_.RefDate field. + ''' + Public Property RefDate() As DateTime + Get + Return CType(Me.GetValue(TableUtils.RefDateColumn).ToDateTime(), DateTime) + End Get + Set (ByVal val As DateTime) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.RefDateColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property RefDateSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.RefDateColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property RefDateDefault() As String + Get + Return TableUtils.RefDateColumn.DefaultValue + End Get + End Property + + + +#End Region + +End Class +End Namespace diff --git a/App_Code/Business Layer/BasePersonalExtraSalaryTable.vb b/App_Code/Business Layer/BasePersonalExtraSalaryTable.vb new file mode 100644 index 0000000..5f0808f --- /dev/null +++ b/App_Code/Business Layer/BasePersonalExtraSalaryTable.vb @@ -0,0 +1,886 @@ +' This class is "generated" and will be overwritten. +' Your customizations should be made in PersonalExtraSalaryRecord.vb + +Imports System.Data.SqlTypes +Imports System.Data +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider +Imports Persons.Data + +Namespace Persons.Business + +''' +''' The generated superclass for the class. +''' Provides access to the schema information and record data of a database table or view named PersonalExtraSalary. +''' +''' +''' The connection details (name, location, etc.) of the database and table (or view) accessed by this class +''' are resolved at runtime based on the connection string in the application's Web.Config file. +''' +''' This class is not intended to be instantiated directly. To obtain an instance of this class, use +''' PersonalExtraSalaryTable.Instance. +''' +''' +''' + + Public Class BasePersonalExtraSalaryTable + Inherits PrimaryKeyTable + + + Private ReadOnly TableDefinitionString As String = PersonalExtraSalaryDefinition.GetXMLString() + + + + + + + + Protected Sub New() + MyBase.New() + Me.Initialize() + End Sub + + Protected Overridable Sub Initialize() + Dim def As New XmlTableDefinition(TableDefinitionString) + Me.TableDefinition = New TableDefinition() + Me.TableDefinition.TableClassName = System.Reflection.Assembly.CreateQualifiedName("App_Code", "Persons.Business.PersonalExtraSalaryTable") + def.InitializeTableDefinition(Me.TableDefinition) + Me.ConnectionName = def.GetConnectionName() + Me.RecordClassName = System.Reflection.Assembly.CreateQualifiedName("App_Code", "Persons.Business.PersonalExtraSalaryRecord") + Me.ApplicationName = "App_Code" + Me.DataAdapter = New PersonalExtraSalarySqlTable() + Directcast(Me.DataAdapter, PersonalExtraSalarySqlTable).ConnectionName = Me.ConnectionName + + Me.TableDefinition.AdapterMetaData = Me.DataAdapter.AdapterMetaData + Id0Column.CodeName = "Id0" + PersonalIdColumn.CodeName = "PersonalId" + ExtraSalaryIdColumn.CodeName = "ExtraSalaryId" + AmoutColumn.CodeName = "Amout" + StartDateColumn.CodeName = "StartDate" + Ref0Column.CodeName = "Ref0" + RefDateColumn.CodeName = "RefDate" + + End Sub + +#Region "Overriden methods" + + +#End Region + +#Region "Properties for columns" + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalExtraSalary_.Id column object. + ''' + Public ReadOnly Property Id0Column() As BaseClasses.Data.NumberColumn + Get + Return CType(Me.TableDefinition.ColumnList(0), BaseClasses.Data.NumberColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalExtraSalary_.Id column object. + ''' + Public Shared ReadOnly Property Id0() As BaseClasses.Data.NumberColumn + Get + Return PersonalExtraSalaryTable.Instance.Id0Column + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonalExtraSalary_.PersonalId column object. + ''' + Public ReadOnly Property PersonalIdColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(1), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalExtraSalary_.PersonalId column object. + ''' + Public Shared ReadOnly Property PersonalId() As BaseClasses.Data.StringColumn + Get + Return PersonalExtraSalaryTable.Instance.PersonalIdColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonalExtraSalary_.ExtraSalaryId column object. + ''' + Public ReadOnly Property ExtraSalaryIdColumn() As BaseClasses.Data.NumberColumn + Get + Return CType(Me.TableDefinition.ColumnList(2), BaseClasses.Data.NumberColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalExtraSalary_.ExtraSalaryId column object. + ''' + Public Shared ReadOnly Property ExtraSalaryId() As BaseClasses.Data.NumberColumn + Get + Return PersonalExtraSalaryTable.Instance.ExtraSalaryIdColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonalExtraSalary_.Amout column object. + ''' + Public ReadOnly Property AmoutColumn() As BaseClasses.Data.NumberColumn + Get + Return CType(Me.TableDefinition.ColumnList(3), BaseClasses.Data.NumberColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalExtraSalary_.Amout column object. + ''' + Public Shared ReadOnly Property Amout() As BaseClasses.Data.NumberColumn + Get + Return PersonalExtraSalaryTable.Instance.AmoutColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonalExtraSalary_.StartDate column object. + ''' + Public ReadOnly Property StartDateColumn() As BaseClasses.Data.DateColumn + Get + Return CType(Me.TableDefinition.ColumnList(4), BaseClasses.Data.DateColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalExtraSalary_.StartDate column object. + ''' + Public Shared ReadOnly Property StartDate() As BaseClasses.Data.DateColumn + Get + Return PersonalExtraSalaryTable.Instance.StartDateColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonalExtraSalary_.Ref column object. + ''' + Public ReadOnly Property Ref0Column() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(5), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalExtraSalary_.Ref column object. + ''' + Public Shared ReadOnly Property Ref0() As BaseClasses.Data.StringColumn + Get + Return PersonalExtraSalaryTable.Instance.Ref0Column + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonalExtraSalary_.RefDate column object. + ''' + Public ReadOnly Property RefDateColumn() As BaseClasses.Data.DateColumn + Get + Return CType(Me.TableDefinition.ColumnList(6), BaseClasses.Data.DateColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalExtraSalary_.RefDate column object. + ''' + Public Shared ReadOnly Property RefDate() As BaseClasses.Data.DateColumn + Get + Return PersonalExtraSalaryTable.Instance.RefDateColumn + End Get + End Property + + +#End Region + + +#Region "Shared helper methods" + + ''' + ''' This is a shared function that can be used to get an array of PersonalExtraSalaryRecord records using a where clause. + ''' + Public Shared Function GetRecords(ByVal where As String) As PersonalExtraSalaryRecord() + + Return GetRecords(where, Nothing, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) + End Function + + ''' + ''' This is a shared function that can be used to get an array of PersonalExtraSalaryRecord records using a where clause. + ''' + Public Shared Function GetRecords(ByVal join As BaseFilter, ByVal where As String) As PersonalExtraSalaryRecord() + + Return GetRecords(join, where, Nothing, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) + End Function + + ''' + ''' This is a shared function that can be used to get an array of PersonalExtraSalaryRecord records using a where and order by clause. + ''' + Public Shared Function GetRecords( _ + ByVal where As String, _ + ByVal orderBy As OrderBy) As PersonalExtraSalaryRecord() + + Return GetRecords(where, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) + End Function + + ''' + ''' This is a shared function that can be used to get an array of PersonalExtraSalaryRecord records using a where and order by clause. + ''' + Public Shared Function GetRecords( _ + ByVal join As BaseFilter, _ + ByVal where As String, _ + ByVal orderBy As OrderBy) As PersonalExtraSalaryRecord() + + Return GetRecords(join, where, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) + End Function + + ''' + ''' This is a shared function that can be used to get an array of PersonalExtraSalaryRecord records using a where and order by clause clause with pagination. + ''' + Public Shared Function GetRecords( _ + ByVal where As String, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As PersonalExtraSalaryRecord() + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + Dim join As BaseClasses.Data.BaseFilter = Nothing + Dim recList As ArrayList = PersonalExtraSalaryTable.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, pageIndex, pageSize) + + Return CType(recList.ToArray(GetType(Persons.Business.PersonalExtraSalaryRecord)), PersonalExtraSalaryRecord()) + End Function + + ''' + ''' This is a shared function that can be used to get an array of PersonalExtraSalaryRecord records using a where and order by clause clause with pagination. + ''' + Public Shared Function GetRecords( _ + ByVal join As BaseFilter, _ + ByVal where As String, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As PersonalExtraSalaryRecord() + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Dim recList As ArrayList = PersonalExtraSalaryTable.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, pageIndex, pageSize) + + Return CType(recList.ToArray(GetType(Persons.Business.PersonalExtraSalaryRecord)), PersonalExtraSalaryRecord()) + End Function + + Public Shared Function GetRecords( _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As PersonalExtraSalaryRecord() + Dim join As BaseClasses.Data.BaseFilter = Nothing + Dim recList As ArrayList = PersonalExtraSalaryTable.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + Return CType(recList.ToArray(GetType(Persons.Business.PersonalExtraSalaryRecord)), PersonalExtraSalaryRecord()) + End Function + + Public Shared Function GetRecords( _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As PersonalExtraSalaryRecord() + + Dim recList As ArrayList = PersonalExtraSalaryTable.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + Return CType(recList.ToArray(GetType(Persons.Business.PersonalExtraSalaryRecord)), PersonalExtraSalaryRecord()) + End Function + + Public Shared Function GetRecords( _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer, _ + ByRef totalRecords As Integer) As PersonalExtraSalaryRecord() + Dim join As BaseClasses.Data.BaseFilter = Nothing + Dim recList As ArrayList = PersonalExtraSalaryTable.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize, totalRecords) + + Return CType(recList.ToArray(GetType(Persons.Business.PersonalExtraSalaryRecord)), PersonalExtraSalaryRecord()) + End Function + + Public Shared Function GetRecords( _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer, _ + ByRef totalRecords As Integer) As PersonalExtraSalaryRecord() + + Dim recList As ArrayList = PersonalExtraSalaryTable.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize, totalRecords) + + Return CType(recList.ToArray(GetType(Persons.Business.PersonalExtraSalaryRecord)), PersonalExtraSalaryRecord()) + End Function + + ''' + ''' This is a shared function that can be used to get total number of records that will be returned using the where clause. + ''' + Public Shared Function GetRecordCount(ByVal where As String) As Integer + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Return CInt(PersonalExtraSalaryTable.Instance.GetRecordListCount(Nothing, whereFilter, Nothing, Nothing)) + End Function + +''' + ''' This is a shared function that can be used to get total number of records that will be returned using the where clause. + ''' + Public Shared Function GetRecordCount(ByVal join As BaseFilter, ByVal where As String) As Integer + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Return CInt(PersonalExtraSalaryTable.Instance.GetRecordListCount(join, whereFilter, Nothing, Nothing)) + End Function + + Public Shared Function GetRecordCount(ByVal where As WhereClause) As Integer + Return CInt(PersonalExtraSalaryTable.Instance.GetRecordListCount(Nothing, where.GetFilter(), Nothing, Nothing)) + End Function + + Public Shared Function GetRecordCount(ByVal join As BaseFilter, ByVal where As WhereClause) As Integer + Return CInt(PersonalExtraSalaryTable.Instance.GetRecordListCount(join, where.GetFilter(), Nothing, Nothing)) + End Function + + ''' + ''' This is a shared function that can be used to get a PersonalExtraSalaryRecord record using a where clause. + ''' + Public Shared Function GetRecord(ByVal where As String) As PersonalExtraSalaryRecord + Dim orderBy As OrderBy = Nothing + Return GetRecord(where, orderBy) + End Function + + ''' + ''' This is a shared function that can be used to get a PersonalExtraSalaryRecord record using a where clause. + ''' + Public Shared Function GetRecord(ByVal join As BaseFilter, ByVal where As String) As PersonalExtraSalaryRecord + Dim orderBy As OrderBy = Nothing + Return GetRecord(join, where, orderBy) + End Function + + ''' + ''' This is a shared function that can be used to get a PersonalExtraSalaryRecord record using a where and order by clause. + ''' + Public Shared Function GetRecord( _ + ByVal where As String, _ + ByVal orderBy As OrderBy) As PersonalExtraSalaryRecord + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + Dim join As BaseClasses.Data.BaseFilter = Nothing + Dim recList As ArrayList = PersonalExtraSalaryTable.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MIN_BATCH_SIZE) + + Dim rec As PersonalExtraSalaryRecord = Nothing + If recList.Count > 0 Then + rec = CType(recList(0), PersonalExtraSalaryRecord) + End If + + Return rec + End Function + + ''' + ''' This is a shared function that can be used to get a PersonalExtraSalaryRecord record using a where and order by clause. + ''' + Public Shared Function GetRecord( _ + ByVal join As BaseFilter, _ + ByVal where As String, _ + ByVal orderBy As OrderBy) As PersonalExtraSalaryRecord + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Dim recList As ArrayList = PersonalExtraSalaryTable.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MIN_BATCH_SIZE) + + Dim rec As PersonalExtraSalaryRecord = Nothing + If recList.Count > 0 Then + rec = CType(recList(0), PersonalExtraSalaryRecord) + End If + + Return rec + End Function + + + Public Shared Function GetValues( _ + ByVal col As BaseColumn, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal maxItems As Integer) As String() + + ' Create the filter list. + Dim retCol As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, True) + retCol.AddColumn(col) + + Return PersonalExtraSalaryTable.Instance.GetColumnValues(retCol, Nothing, where.GetFilter(), Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, maxItems) + + End Function + + Public Shared Function GetValues( _ + ByVal col As BaseColumn, _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal maxItems As Integer) As String() + + ' Create the filter list. + Dim retCol As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, True) + retCol.AddColumn(col) + + Return PersonalExtraSalaryTable.Instance.GetColumnValues(retCol, join, where.GetFilter(), Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, maxItems) + + End Function + + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where clause. + ''' + Public Shared Function GetDataTable(ByVal where As String) As System.Data.DataTable + + Dim recs() As PersonalExtraSalaryRecord = GetRecords(where) + Return PersonalExtraSalaryTable.Instance.CreateDataTable(recs, Nothing) + End Function + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where clause. + ''' + Public Shared Function GetDataTable(ByVal join As BaseFilter, ByVal where As String) As System.Data.DataTable + + Dim recs() As PersonalExtraSalaryRecord = GetRecords(join, where) + Return PersonalExtraSalaryTable.Instance.CreateDataTable(recs, Nothing) + End Function + + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause. + ''' + Public Shared Function GetDataTable(ByVal where As String, ByVal orderBy As OrderBy) As System.Data.DataTable + + Dim recs() As PersonalExtraSalaryRecord = GetRecords(where, orderBy) + Return PersonalExtraSalaryTable.Instance.CreateDataTable(recs, Nothing) + End Function + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause. + ''' + Public Shared Function GetDataTable(ByVal join As BaseFilter, ByVal where As String, ByVal orderBy As OrderBy) As System.Data.DataTable + + Dim recs() As PersonalExtraSalaryRecord = GetRecords(join, where, orderBy) + Return PersonalExtraSalaryTable.Instance.CreateDataTable(recs, Nothing) + End Function + + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause with pagination. + ''' + Public Shared Function GetDataTable( _ + ByVal where As String, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As System.Data.DataTable + + Dim recs() As PersonalExtraSalaryRecord = GetRecords(where, orderBy, pageIndex, pageSize) + Return PersonalExtraSalaryTable.Instance.CreateDataTable(recs, Nothing) + End Function + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause with pagination. + ''' + Public Shared Function GetDataTable( _ + ByVal join As BaseFilter, _ + ByVal where As String, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As System.Data.DataTable + + Dim recs() As PersonalExtraSalaryRecord = GetRecords(join, where, orderBy, pageIndex, pageSize) + Return PersonalExtraSalaryTable.Instance.CreateDataTable(recs, Nothing) + End Function + + + ''' + ''' This is a shared function that can be used to delete records using a where clause. + ''' + Public Shared Sub DeleteRecords(ByVal where As String) + If where = Nothing OrElse where.Trim() = "" Then + Return + End If + + Dim whereFilter As SqlFilter = New SqlFilter(where) + PersonalExtraSalaryTable.Instance.DeleteRecordList(whereFilter) + End Sub + + ''' + ''' This is a shared function that can be used to export records using a where clause. + ''' + Public Shared Function Export(ByVal where As String) As String + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Return PersonalExtraSalaryTable.Instance.ExportRecordData(whereFilter) + End Function + + Public Shared Function Export(ByVal where As WhereClause) As String + Dim whereFilter As BaseFilter = Nothing + If Not where Is Nothing Then + whereFilter = where.GetFilter() + End If + + Return PersonalExtraSalaryTable.Instance.ExportRecordData(whereFilter) + End Function + + Public Shared Function GetSum( _ + ByVal col As BaseColumn, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) _ + As String + + Dim colSel As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, False) + colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Sum) + + Return PersonalExtraSalaryTable.Instance.GetColumnStatistics(colSel, Nothing, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + End Function + + Public Shared Function GetSum( _ + ByVal col As BaseColumn, _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) _ + As String + + Dim colSel As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, False) + colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Sum) + + Return PersonalExtraSalaryTable.Instance.GetColumnStatistics(colSel, join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + End Function + + + Public Shared Function GetCount( _ + ByVal col As BaseColumn, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) _ + As String + + Dim colSel As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, False) + colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Count) + + Return PersonalExtraSalaryTable.Instance.GetColumnStatistics(colSel, Nothing, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + End Function + + Public Shared Function GetCount( _ + ByVal col As BaseColumn, _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) _ + As String + + Dim colSel As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, False) + colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Count) + + Return PersonalExtraSalaryTable.Instance.GetColumnStatistics(colSel, join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + End Function + + ''' + ''' This method returns the columns in the table. + ''' + Public Shared Function GetColumns() As BaseColumn() + Return PersonalExtraSalaryTable.Instance.TableDefinition.Columns + End Function + + ''' + ''' This method returns the columnlist in the table. + ''' + Public Shared Function GetColumnList() As ColumnList + Return PersonalExtraSalaryTable.Instance.TableDefinition.ColumnList + End Function + + + ''' + ''' This method creates a new record and returns it to be edited. + ''' + Public Shared Function CreateNewRecord() As IRecord + Return PersonalExtraSalaryTable.Instance.CreateRecord() + End Function + + ''' + ''' This method creates a new record and returns it to be edited. + ''' + ''' ID of the new record. + Public Shared Function CreateNewRecord(ByVal tempId As String) As IRecord + Return PersonalExtraSalaryTable.Instance.CreateRecord(tempId) + End Function + + ''' + ''' This method checks if column is editable. + ''' + ''' Name of the column to check. + Public Shared Function isReadOnlyColumn(ByVal columnName As String) As Boolean + Dim column As BaseColumn = GetColumn(columnName) + If (Not IsNothing(column)) Then + Return column.IsValuesReadOnly + Else + Return True + End If + End Function + + ''' + ''' This method gets the specified column. + ''' + ''' Unique name of the column to fetch. + Public Shared Function GetColumn(ByVal uniqueColumnName As String) As BaseColumn + Dim column As BaseColumn = PersonalExtraSalaryTable.Instance.TableDefinition.ColumnList.GetByUniqueName(uniqueColumnName) + Return column + End Function + + ' Convenience method for getting a record using a string-based record identifier + Public Shared Function GetRecord(ByVal id As String, ByVal bMutable As Boolean) As PersonalExtraSalaryRecord + Return CType(PersonalExtraSalaryTable.Instance.GetRecordData(id, bMutable), PersonalExtraSalaryRecord) + End Function + + ' Convenience method for getting a record using a KeyValue record identifier + Public Shared Function GetRecord(ByVal id As KeyValue, ByVal bMutable As Boolean) As PersonalExtraSalaryRecord + Return CType(PersonalExtraSalaryTable.Instance.GetRecordData(id, bMutable), PersonalExtraSalaryRecord) + End Function + + ' Convenience method for creating a record + Public Overloads Function NewRecord( _ + ByVal PersonalIdValue As String, _ + ByVal ExtraSalaryIdValue As String, _ + ByVal AmoutValue As String, _ + ByVal StartDateValue As String, _ + ByVal Ref0Value As String, _ + ByVal RefDateValue As String _ + ) As KeyValue + Dim rec As IPrimaryKeyRecord = CType(Me.CreateRecord(), IPrimaryKeyRecord) + rec.SetString(PersonalIdValue, PersonalIdColumn) + rec.SetString(ExtraSalaryIdValue, ExtraSalaryIdColumn) + rec.SetString(AmoutValue, AmoutColumn) + rec.SetString(StartDateValue, StartDateColumn) + rec.SetString(Ref0Value, Ref0Column) + rec.SetString(RefDateValue, RefDateColumn) + + + rec.Create() 'update the DB so any DB-initialized fields (like autoincrement IDs) can be initialized + + Dim key As KeyValue = rec.GetID() + Return key + End Function + + ''' + ''' This method deletes a specified record + ''' + ''' Keyvalue of the record to be deleted. + Public Shared Sub DeleteRecord(ByVal kv As KeyValue) + PersonalExtraSalaryTable.Instance.DeleteOneRecord(kv) + End Sub + + ''' + ''' This method checks if record exist in the database using the keyvalue provided. + ''' + ''' Key value of the record. + Public Shared Function DoesRecordExist(ByVal kv As KeyValue) As Boolean + Dim recordExist As Boolean = True + Try + PersonalExtraSalaryTable.GetRecord(kv, False) + Catch ex As Exception + recordExist = False + End Try + Return recordExist + End Function + + ''' + ''' This method returns all the primary columns in the table. + ''' + Public Shared Function GetPrimaryKeyColumns() As ColumnList + If (Not IsNothing(PersonalExtraSalaryTable.Instance.TableDefinition.PrimaryKey)) Then + Return PersonalExtraSalaryTable.Instance.TableDefinition.PrimaryKey.Columns + Else + Return Nothing + End If + End Function + + ''' + ''' This method takes a key and returns a keyvalue. + ''' + ''' key could be array of primary key values in case of composite primary key or a string containing single primary key value in case of non-composite primary key. + Public Shared Function GetKeyValue(ByVal key As Object) As KeyValue + Dim kv As KeyValue = Nothing + + If (Not (IsNothing(PersonalExtraSalaryTable.Instance.TableDefinition.PrimaryKey))) Then + + Dim isCompositePrimaryKey As Boolean = False + isCompositePrimaryKey = PersonalExtraSalaryTable.Instance.TableDefinition.PrimaryKey.IsCompositeKey + + If ((isCompositePrimaryKey) AndAlso (key.GetType.IsArray())) Then + + ' If the key is composite, then construct a key value. + kv = New KeyValue + Dim fullKeyString As String = "" + Dim keyArray As Array = CType(key, Array) + If (Not IsNothing(keyArray)) Then + Dim length As Integer = keyArray.Length + Dim pkColumns As ColumnList = PersonalExtraSalaryTable.Instance.TableDefinition.PrimaryKey.Columns + Dim pkColumn As BaseColumn + Dim index As Integer = 0 + For Each pkColumn In pkColumns + Dim keyString As String = CType(keyArray.GetValue(index), String) + If (PersonalExtraSalaryTable.Instance.TableDefinition.TableType = BaseClasses.Data.TableDefinition.TableTypes.Virtual) Then + kv.AddElement(pkColumn.UniqueName, keyString) + Else + kv.AddElement(pkColumn.InternalName, keyString) + End If + index = index + 1 + Next pkColumn + End If + + Else + ' If the key is not composite, then get the key value. + kv = PersonalExtraSalaryTable.Instance.TableDefinition.PrimaryKey.ParseValue(CType(key, String)) + End If + End If + Return kv + End Function + + + ''' + ''' This method takes a record and a Column and returns an evaluated value of DFKA formula. + ''' + Public Shared Function GetDFKA(ByVal rec As BaseRecord, ByVal col As BaseColumn) As String + Dim fkColumn As ForeignKey = PersonalExtraSalaryTable.Instance.TableDefinition.GetExpandableNonCompositeForeignKey(col) + If fkColumn Is Nothing Then + Return Nothing + End If + Dim _DFKA As String = fkColumn.PrimaryKeyDisplayColumns + If (_DFKA.Trim().StartsWith("=")) Then + ' if the formula is in the format of "= ., then pull out the data from the rec object instead of doing formula evaluation + Dim tableCodeName As String = fkColumn.PrimaryKeyTableDefinition.TableCodeName + Dim column As String = _DFKA.Trim("="c).Trim() + If column.StartsWith(tableCodeName & ".", StringComparison.InvariantCultureIgnoreCase) Then + column = column.Substring(tableCodeName.Length + 1) + End If + + For Each c As BaseColumn In fkColumn.PrimaryKeyTableDefinition.Columns + If column = c.CodeName Then + Return rec.Format(c) + End If + Next + Dim tableName As String = fkColumn.PrimaryKeyTableDefinition.TableCodeName + Return EvaluateFormula(_DFKA, rec, Nothing, tableName) + Else + Return Nothing + End If + End Function + + ''' + ''' This method takes a keyValue and a Column and returns an evaluated value of DFKA formula. + ''' + Public Shared Function GetDFKA(ByVal keyValue As String, ByVal col As BaseColumn, ByVal formatPattern as String) As String + If keyValue Is Nothing Then + Return Nothing + End If + Dim fkColumn As ForeignKey = PersonalExtraSalaryTable.Instance.TableDefinition.GetExpandableNonCompositeForeignKey(col) + If fkColumn Is Nothing Then + Return Nothing + End If + Dim _DFKA As String = fkColumn.PrimaryKeyDisplayColumns + If (_DFKA.Trim().StartsWith("=")) Then + Dim tableName As String = fkColumn.PrimaryKeyTableDefinition.TableCodeName + Dim t As PrimaryKeyTable = CType(DatabaseObjects.GetTableObject(tableName), PrimaryKeyTable) + Dim rec As BaseRecord = Nothing + If Not t Is Nothing Then + Try + rec = CType(t.GetRecordData(keyValue, False), BaseRecord) + Catch + rec = Nothing + End Try + End If + If rec Is Nothing Then + Return "" + End If + + ' if the formula is in the format of "= ., then pull out the data from the rec object instead of doing formula evaluation + Dim tableCodeName As String = fkColumn.PrimaryKeyTableDefinition.TableCodeName + Dim column As String = _DFKA.Trim("="c).Trim() + If column.StartsWith(tableCodeName & ".", StringComparison.InvariantCultureIgnoreCase) Then + column = column.Substring(tableCodeName.Length + 1) + End If + + For Each c As BaseColumn In fkColumn.PrimaryKeyTableDefinition.Columns + If column = c.CodeName Then + Return rec.Format(c) + End If + Next + Return EvaluateFormula(_DFKA, rec, Nothing, tableName) + Else + Return Nothing + End If + End Function + + ''' + ''' Evaluates the formula + ''' + Public Shared Function EvaluateFormula(ByVal formula As String, Optional ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord = Nothing, Optional ByVal format As String = Nothing, Optional ByVal name As String = "") As String + Dim e As BaseFormulaEvaluator = New BaseFormulaEvaluator() + If Not dataSourceForEvaluate Is Nothing Then + e.Evaluator.Variables.Add(name, dataSourceForEvaluate) + end if + e.DataSource = dataSourceForEvaluate + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + If Not String.IsNullOrEmpty(format) Then + Return BaseFormulaUtils.Format(resultObj, format) + Else + Return resultObj.ToString() + End If + End Function + + +#End Region + +End Class +End Namespace diff --git a/App_Code/Business Layer/BasePersonalIdRecord.vb b/App_Code/Business Layer/BasePersonalIdRecord.vb new file mode 100644 index 0000000..57a9dce --- /dev/null +++ b/App_Code/Business Layer/BasePersonalIdRecord.vb @@ -0,0 +1,2918 @@ +' This class is "generated" and will be overwritten. +' Your customizations should be made in PersonalIdRecord.vb + +Imports System.Data.SqlTypes +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + +Namespace Persons.Business + +''' +''' The generated superclass for the class. +''' +''' +''' This class is not intended to be instantiated directly. To obtain an instance of this class, +''' use the methods of the class. +''' +''' +''' + + Public Class BasePersonalIdRecord + Inherits PrimaryKeyRecord + Implements IUserIdentityRecord + + + Public Shared Shadows ReadOnly TableUtils As PersonalIdTable = PersonalIdTable.Instance + + ' Constructors + + Protected Sub New() + MyBase.New(TableUtils) + End Sub + + Protected Sub New(ByVal record As PrimaryKeyRecord) + MyBase.New(record, TableUtils) + End Sub + + 'Evaluates Initialize when->Inserting record formulas specified at the data access layer + Public Overridable Sub PersonalIdRecord_InsertingRecord(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles Me.InsertingRecord + 'Apply Initialize->Inserting record formula only if validation is successful. + Dim PersonalIdRec As PersonalIdRecord = CType(sender,PersonalIdRecord) + Validate_Inserting() + If Not PersonalIdRec Is Nothing AndAlso Not PersonalIdRec.IsReadOnly Then + End If + End Sub + + 'Evaluates Initialize when->Updating record formulas specified at the data access layer + Public Overridable Sub PersonalIdRecord_UpdatingRecord(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles Me.UpdatingRecord + 'Apply Initialize->Updating record formula only if validation is successful. + Dim PersonalIdRec As PersonalIdRecord = CType(sender,PersonalIdRecord) + Validate_Updating() + If Not PersonalIdRec Is Nothing AndAlso Not PersonalIdRec.IsReadOnly Then + End If + End Sub + + 'Evaluates Initialize when->Reading record formulas specified at the data access layer + Public Overridable Sub PersonalIdRecord_ReadRecord(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.ReadRecord + 'Apply Initialize->Reading record formula only if validation is successful. + Dim PersonalIdRec As PersonalIdRecord = CType(sender,PersonalIdRecord) + If Not PersonalIdRec Is Nothing AndAlso Not PersonalIdRec.IsReadOnly Then + End If + End Sub + + 'Evaluates Validate when->Inserting formulas specified at the data access layer + Public Overridable Sub Validate_Inserting () + Dim fullValidationMessage As String = "" + Dim validationMessage As String = "" + + dim formula as String = "" + + + If validationMessage <> "" AndAlso validationMessage.ToLower() <> "true" Then + fullValidationMessage &= validationMessage & vbCrLf + End If + + If fullValidationMessage <> "" Then + Throw New Exception(fullValidationMessage) + End If + End Sub + + 'Evaluates Validate when->Updating formulas specified at the data access layer + Public Overridable Sub Validate_Updating () + Dim fullValidationMessage As String = "" + Dim validationMessage As String = "" + + dim formula as String = "" + + + If validationMessage <> "" AndAlso validationMessage.ToLower() <> "true" Then + fullValidationMessage &= validationMessage & vbCrLf + End If + + If fullValidationMessage <> "" Then + Throw New Exception(fullValidationMessage) + End If + End Sub + + Public Overridable Function EvaluateFormula(ByVal formula As String, Optional ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord = Nothing, Optional ByVal format As String = Nothing) As String + + Dim e As Data.BaseFormulaEvaluator = New Data.BaseFormulaEvaluator() + + ' All variables referred to in the formula are expected to be + ' properties of the DataSource. For example, referring to + ' UnitPrice as a variable will refer to DataSource.UnitPrice + e.DataSource = dataSourceForEvaluate + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + Return resultObj.ToString() + End Function + +#Region "IUserRecord Members" + + ' Get the user's unique identifier + Public Function GetUserId() As String Implements IUserRecord.GetUserId + Return CType(Me, IRecord).GetString(CType(Me.TableAccess, IUserTable).UserIdColumn) + End Function + +#End Region + + +#Region "IUserIdentityRecord Members" + + ' Get the user's name + Public Function GetUserName() As String Implements IUserIdentityRecord.GetUserName + Return CType(Me, IRecord).getString(CType(Me.TableAccess, IUserIdentityTable).UserNameColumn) + End Function + + ' Get the user's password + Public Function GetUserPassword() As String Implements IUserIdentityRecord.GetUserPassword + Return CType(Me, IRecord).getString(CType(Me.TableAccess, IUserIdentityTable).UserPasswordColumn) + End Function + + ' Get the user's email address + Public Function GetUserEmail() As String Implements IUserIdentityRecord.GetUserEmail + Return CType(Me, IRecord).getString(CType(Me.TableAccess, IUserIdentityTable).UserEmailColumn) + End Function + + ' Get a list of roles to which the user belongs + Public Function GetUserRoles() As String() Implements IUserIdentityRecord.GetUserRoles + Dim roles() As String + If (TypeOf (Me) Is IUserRoleRecord) Then + roles = New String(0) {} + roles(0) = CType(Me, IUserRoleRecord).GetUserRole() + Else + Dim roleTable As IUserRoleTable = CType(Me.TableAccess, IUserIdentityTable).GetUserRoleTable() + If (IsNothing(roleTable)) Then + Return Nothing +#If False Then + 'Note: Not compiled for performance + ElseIf (CType(roleTable, Object).Equals(Me.TableAccess)) Then + 'This should never occur because it should be handled above instead +#End If + Else + Dim filter As ColumnValueFilter = BaseFilter.CreateUserIdFilter(roleTable, Me.GetUserId()) + Dim order As New OrderBy(False, False) + Dim join As BaseClasses.Data.BaseFilter = Nothing + Dim roleRecords As ArrayList = roleTable.GetRecordList(join, filter, Nothing, order, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) + Dim roleRecord As IUserRoleRecord + Dim roleList As New ArrayList(roleRecords.Count) + For Each roleRecord In roleRecords + roleList.Add(roleRecord.GetUserRole()) + Next + roles = CType(roleList.ToArray(GetType(String)), String()) + End If + End If + Return roles + End Function + +#End Region + + + + +#Region "Convenience methods to get/set values of fields" + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalId_.PersonalId field. + ''' + Public Function GetPersonalIdValue() As ColumnValue + Return Me.GetValue(TableUtils.PersonalIdColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalId_.PersonalId field. + ''' + Public Function GetPersonalIdFieldValue() As String + Return CType(Me.GetValue(TableUtils.PersonalIdColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalId_.PersonalId field. + ''' + Public Sub SetPersonalIdFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.PersonalIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalId_.PersonalId field. + ''' + Public Sub SetPersonalIdFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.PersonalIdColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalId_.SectionId field. + ''' + Public Function GetSectionIdValue() As ColumnValue + Return Me.GetValue(TableUtils.SectionIdColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalId_.SectionId field. + ''' + Public Function GetSectionIdFieldValue() As Int16 + Return CType(Me.GetValue(TableUtils.SectionIdColumn).ToInt16(), Int16) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalId_.SectionId field. + ''' + Public Sub SetSectionIdFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.SectionIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalId_.SectionId field. + ''' + Public Sub SetSectionIdFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.SectionIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalId_.SectionId field. + ''' + Public Sub SetSectionIdFieldValue(ByVal val As Double) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.SectionIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalId_.SectionId field. + ''' + Public Sub SetSectionIdFieldValue(ByVal val As Decimal) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.SectionIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalId_.SectionId field. + ''' + Public Sub SetSectionIdFieldValue(ByVal val As Int64) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.SectionIdColumn) + End Sub + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalId_.MId field. + ''' + Public Function GetMIdValue() As ColumnValue + Return Me.GetValue(TableUtils.MIdColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalId_.MId field. + ''' + Public Function GetMIdFieldValue() As String + Return CType(Me.GetValue(TableUtils.MIdColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalId_.MId field. + ''' + Public Sub SetMIdFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.MIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalId_.MId field. + ''' + Public Sub SetMIdFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.MIdColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalId_.TId field. + ''' + Public Function GetTIdValue() As ColumnValue + Return Me.GetValue(TableUtils.TIdColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalId_.TId field. + ''' + Public Function GetTIdFieldValue() As String + Return CType(Me.GetValue(TableUtils.TIdColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalId_.TId field. + ''' + Public Sub SetTIdFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.TIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalId_.TId field. + ''' + Public Sub SetTIdFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.TIdColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalId_.ArmyId field. + ''' + Public Function GetArmyIdValue() As ColumnValue + Return Me.GetValue(TableUtils.ArmyIdColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalId_.ArmyId field. + ''' + Public Function GetArmyIdFieldValue() As Byte + Return CType(Me.GetValue(TableUtils.ArmyIdColumn).ToByte(), Byte) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalId_.ArmyId field. + ''' + Public Sub SetArmyIdFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.ArmyIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalId_.ArmyId field. + ''' + Public Sub SetArmyIdFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.ArmyIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalId_.ArmyId field. + ''' + Public Sub SetArmyIdFieldValue(ByVal val As Double) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.ArmyIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalId_.ArmyId field. + ''' + Public Sub SetArmyIdFieldValue(ByVal val As Decimal) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.ArmyIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalId_.ArmyId field. + ''' + Public Sub SetArmyIdFieldValue(ByVal val As Int64) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.ArmyIdColumn) + End Sub + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalId_.RankId field. + ''' + Public Function GetRankIdValue() As ColumnValue + Return Me.GetValue(TableUtils.RankIdColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalId_.RankId field. + ''' + Public Function GetRankIdFieldValue() As Int32 + Return CType(Me.GetValue(TableUtils.RankIdColumn).ToInt32(), Int32) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalId_.RankId field. + ''' + Public Sub SetRankIdFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.RankIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalId_.RankId field. + ''' + Public Sub SetRankIdFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.RankIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalId_.RankId field. + ''' + Public Sub SetRankIdFieldValue(ByVal val As Double) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.RankIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalId_.RankId field. + ''' + Public Sub SetRankIdFieldValue(ByVal val As Decimal) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.RankIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalId_.RankId field. + ''' + Public Sub SetRankIdFieldValue(ByVal val As Int64) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.RankIdColumn) + End Sub + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalId_.PersonalName field. + ''' + Public Function GetPersonalNameValue() As ColumnValue + Return Me.GetValue(TableUtils.PersonalNameColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalId_.PersonalName field. + ''' + Public Function GetPersonalNameFieldValue() As String + Return CType(Me.GetValue(TableUtils.PersonalNameColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalId_.PersonalName field. + ''' + Public Sub SetPersonalNameFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.PersonalNameColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalId_.PersonalName field. + ''' + Public Sub SetPersonalNameFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.PersonalNameColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalId_.PersonalLastName field. + ''' + Public Function GetPersonalLastNameValue() As ColumnValue + Return Me.GetValue(TableUtils.PersonalLastNameColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalId_.PersonalLastName field. + ''' + Public Function GetPersonalLastNameFieldValue() As String + Return CType(Me.GetValue(TableUtils.PersonalLastNameColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalId_.PersonalLastName field. + ''' + Public Sub SetPersonalLastNameFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.PersonalLastNameColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalId_.PersonalLastName field. + ''' + Public Sub SetPersonalLastNameFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.PersonalLastNameColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalId_.Sex field. + ''' + Public Function GetSexValue() As ColumnValue + Return Me.GetValue(TableUtils.SexColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalId_.Sex field. + ''' + Public Function GetSexFieldValue() As Int16 + Return CType(Me.GetValue(TableUtils.SexColumn).ToInt16(), Int16) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalId_.Sex field. + ''' + Public Sub SetSexFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.SexColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalId_.Sex field. + ''' + Public Sub SetSexFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.SexColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalId_.Sex field. + ''' + Public Sub SetSexFieldValue(ByVal val As Double) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.SexColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalId_.Sex field. + ''' + Public Sub SetSexFieldValue(ByVal val As Decimal) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.SexColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalId_.Sex field. + ''' + Public Sub SetSexFieldValue(ByVal val As Int64) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.SexColumn) + End Sub + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalId_.BirthDate field. + ''' + Public Function GetBirthDateValue() As ColumnValue + Return Me.GetValue(TableUtils.BirthDateColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalId_.BirthDate field. + ''' + Public Function GetBirthDateFieldValue() As DateTime + Return CType(Me.GetValue(TableUtils.BirthDateColumn).ToDateTime(), DateTime) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalId_.BirthDate field. + ''' + Public Sub SetBirthDateFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.BirthDateColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalId_.BirthDate field. + ''' + Public Sub SetBirthDateFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.BirthDateColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalId_.BirthDate field. + ''' + Public Sub SetBirthDateFieldValue(ByVal val As DateTime) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.BirthDateColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalId_.PlaceOfBirth field. + ''' + Public Function GetPlaceOfBirthValue() As ColumnValue + Return Me.GetValue(TableUtils.PlaceOfBirthColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalId_.PlaceOfBirth field. + ''' + Public Function GetPlaceOfBirthFieldValue() As String + Return CType(Me.GetValue(TableUtils.PlaceOfBirthColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalId_.PlaceOfBirth field. + ''' + Public Sub SetPlaceOfBirthFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.PlaceOfBirthColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalId_.PlaceOfBirth field. + ''' + Public Sub SetPlaceOfBirthFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.PlaceOfBirthColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalId_.BAmphur field. + ''' + Public Function GetBAmphurValue() As ColumnValue + Return Me.GetValue(TableUtils.BAmphurColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalId_.BAmphur field. + ''' + Public Function GetBAmphurFieldValue() As String + Return CType(Me.GetValue(TableUtils.BAmphurColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalId_.BAmphur field. + ''' + Public Sub SetBAmphurFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.BAmphurColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalId_.BAmphur field. + ''' + Public Sub SetBAmphurFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.BAmphurColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalId_.BProvince field. + ''' + Public Function GetBProvinceValue() As ColumnValue + Return Me.GetValue(TableUtils.BProvinceColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalId_.BProvince field. + ''' + Public Function GetBProvinceFieldValue() As String + Return CType(Me.GetValue(TableUtils.BProvinceColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalId_.BProvince field. + ''' + Public Sub SetBProvinceFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.BProvinceColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalId_.BProvince field. + ''' + Public Sub SetBProvinceFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.BProvinceColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalId_.BloodId field. + ''' + Public Function GetBloodIdValue() As ColumnValue + Return Me.GetValue(TableUtils.BloodIdColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalId_.BloodId field. + ''' + Public Function GetBloodIdFieldValue() As Byte + Return CType(Me.GetValue(TableUtils.BloodIdColumn).ToByte(), Byte) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalId_.BloodId field. + ''' + Public Sub SetBloodIdFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.BloodIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalId_.BloodId field. + ''' + Public Sub SetBloodIdFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.BloodIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalId_.BloodId field. + ''' + Public Sub SetBloodIdFieldValue(ByVal val As Double) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.BloodIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalId_.BloodId field. + ''' + Public Sub SetBloodIdFieldValue(ByVal val As Decimal) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.BloodIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalId_.BloodId field. + ''' + Public Sub SetBloodIdFieldValue(ByVal val As Int64) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.BloodIdColumn) + End Sub + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalId_.Origin field. + ''' + Public Function GetOriginValue() As ColumnValue + Return Me.GetValue(TableUtils.OriginColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalId_.Origin field. + ''' + Public Function GetOriginFieldValue() As String + Return CType(Me.GetValue(TableUtils.OriginColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalId_.Origin field. + ''' + Public Sub SetOriginFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.OriginColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalId_.Origin field. + ''' + Public Sub SetOriginFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.OriginColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalId_.Nationality field. + ''' + Public Function GetNationalityValue() As ColumnValue + Return Me.GetValue(TableUtils.NationalityColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalId_.Nationality field. + ''' + Public Function GetNationalityFieldValue() As String + Return CType(Me.GetValue(TableUtils.NationalityColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalId_.Nationality field. + ''' + Public Sub SetNationalityFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.NationalityColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalId_.Nationality field. + ''' + Public Sub SetNationalityFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.NationalityColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalId_.Religion field. + ''' + Public Function GetReligionValue() As ColumnValue + Return Me.GetValue(TableUtils.ReligionColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalId_.Religion field. + ''' + Public Function GetReligionFieldValue() As String + Return CType(Me.GetValue(TableUtils.ReligionColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalId_.Religion field. + ''' + Public Sub SetReligionFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.ReligionColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalId_.Religion field. + ''' + Public Sub SetReligionFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.ReligionColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalId_.ArmId field. + ''' + Public Function GetArmIdValue() As ColumnValue + Return Me.GetValue(TableUtils.ArmIdColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalId_.ArmId field. + ''' + Public Function GetArmIdFieldValue() As Int32 + Return CType(Me.GetValue(TableUtils.ArmIdColumn).ToInt32(), Int32) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalId_.ArmId field. + ''' + Public Sub SetArmIdFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.ArmIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalId_.ArmId field. + ''' + Public Sub SetArmIdFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.ArmIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalId_.ArmId field. + ''' + Public Sub SetArmIdFieldValue(ByVal val As Double) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.ArmIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalId_.ArmId field. + ''' + Public Sub SetArmIdFieldValue(ByVal val As Decimal) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.ArmIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalId_.ArmId field. + ''' + Public Sub SetArmIdFieldValue(ByVal val As Int64) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.ArmIdColumn) + End Sub + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalId_.RegDate field. + ''' + Public Function GetRegDateValue() As ColumnValue + Return Me.GetValue(TableUtils.RegDateColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalId_.RegDate field. + ''' + Public Function GetRegDateFieldValue() As DateTime + Return CType(Me.GetValue(TableUtils.RegDateColumn).ToDateTime(), DateTime) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalId_.RegDate field. + ''' + Public Sub SetRegDateFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.RegDateColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalId_.RegDate field. + ''' + Public Sub SetRegDateFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.RegDateColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalId_.RegDate field. + ''' + Public Sub SetRegDateFieldValue(ByVal val As DateTime) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.RegDateColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalId_.RegNo1 field. + ''' + Public Function GetRegNo1Value() As ColumnValue + Return Me.GetValue(TableUtils.RegNo1Column) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalId_.RegNo1 field. + ''' + Public Function GetRegNo1FieldValue() As String + Return CType(Me.GetValue(TableUtils.RegNo1Column).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalId_.RegNo1 field. + ''' + Public Sub SetRegNo1FieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.RegNo1Column) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalId_.RegNo1 field. + ''' + Public Sub SetRegNo1FieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.RegNo1Column) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalId_.RegNo2 field. + ''' + Public Function GetRegNo2Value() As ColumnValue + Return Me.GetValue(TableUtils.RegNo2Column) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalId_.RegNo2 field. + ''' + Public Function GetRegNo2FieldValue() As String + Return CType(Me.GetValue(TableUtils.RegNo2Column).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalId_.RegNo2 field. + ''' + Public Sub SetRegNo2FieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.RegNo2Column) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalId_.RegNo2 field. + ''' + Public Sub SetRegNo2FieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.RegNo2Column) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalId_.OfficerDate field. + ''' + Public Function GetOfficerDateValue() As ColumnValue + Return Me.GetValue(TableUtils.OfficerDateColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalId_.OfficerDate field. + ''' + Public Function GetOfficerDateFieldValue() As DateTime + Return CType(Me.GetValue(TableUtils.OfficerDateColumn).ToDateTime(), DateTime) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalId_.OfficerDate field. + ''' + Public Sub SetOfficerDateFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.OfficerDateColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalId_.OfficerDate field. + ''' + Public Sub SetOfficerDateFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.OfficerDateColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalId_.OfficerDate field. + ''' + Public Sub SetOfficerDateFieldValue(ByVal val As DateTime) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.OfficerDateColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalId_.Born field. + ''' + Public Function GetBornValue() As ColumnValue + Return Me.GetValue(TableUtils.BornColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalId_.Born field. + ''' + Public Function GetBornFieldValue() As String + Return CType(Me.GetValue(TableUtils.BornColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalId_.Born field. + ''' + Public Sub SetBornFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.BornColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalId_.Born field. + ''' + Public Sub SetBornFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.BornColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalId_.CremateMemId field. + ''' + Public Function GetCremateMemIdValue() As ColumnValue + Return Me.GetValue(TableUtils.CremateMemIdColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalId_.CremateMemId field. + ''' + Public Function GetCremateMemIdFieldValue() As String + Return CType(Me.GetValue(TableUtils.CremateMemIdColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalId_.CremateMemId field. + ''' + Public Sub SetCremateMemIdFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.CremateMemIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalId_.CremateMemId field. + ''' + Public Sub SetCremateMemIdFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.CremateMemIdColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalId_.ArmyWelfareMemId field. + ''' + Public Function GetArmyWelfareMemIdValue() As ColumnValue + Return Me.GetValue(TableUtils.ArmyWelfareMemIdColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalId_.ArmyWelfareMemId field. + ''' + Public Function GetArmyWelfareMemIdFieldValue() As String + Return CType(Me.GetValue(TableUtils.ArmyWelfareMemIdColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalId_.ArmyWelfareMemId field. + ''' + Public Sub SetArmyWelfareMemIdFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.ArmyWelfareMemIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalId_.ArmyWelfareMemId field. + ''' + Public Sub SetArmyWelfareMemIdFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.ArmyWelfareMemIdColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalId_.StatusId field. + ''' + Public Function GetStatusIdValue() As ColumnValue + Return Me.GetValue(TableUtils.StatusIdColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalId_.StatusId field. + ''' + Public Function GetStatusIdFieldValue() As Byte + Return CType(Me.GetValue(TableUtils.StatusIdColumn).ToByte(), Byte) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalId_.StatusId field. + ''' + Public Sub SetStatusIdFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.StatusIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalId_.StatusId field. + ''' + Public Sub SetStatusIdFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.StatusIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalId_.StatusId field. + ''' + Public Sub SetStatusIdFieldValue(ByVal val As Double) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.StatusIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalId_.StatusId field. + ''' + Public Sub SetStatusIdFieldValue(ByVal val As Decimal) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.StatusIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalId_.StatusId field. + ''' + Public Sub SetStatusIdFieldValue(ByVal val As Int64) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.StatusIdColumn) + End Sub + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalId_.Commission field. + ''' + Public Function GetCommissionValue() As ColumnValue + Return Me.GetValue(TableUtils.CommissionColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalId_.Commission field. + ''' + Public Function GetCommissionFieldValue() As String + Return CType(Me.GetValue(TableUtils.CommissionColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalId_.Commission field. + ''' + Public Sub SetCommissionFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.CommissionColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalId_.Commission field. + ''' + Public Sub SetCommissionFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.CommissionColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalId_.DeptId field. + ''' + Public Function GetDeptIdValue() As ColumnValue + Return Me.GetValue(TableUtils.DeptIdColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalId_.DeptId field. + ''' + Public Function GetDeptIdFieldValue() As Int16 + Return CType(Me.GetValue(TableUtils.DeptIdColumn).ToInt16(), Int16) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalId_.DeptId field. + ''' + Public Sub SetDeptIdFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.DeptIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalId_.DeptId field. + ''' + Public Sub SetDeptIdFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.DeptIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalId_.DeptId field. + ''' + Public Sub SetDeptIdFieldValue(ByVal val As Double) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.DeptIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalId_.DeptId field. + ''' + Public Sub SetDeptIdFieldValue(ByVal val As Decimal) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.DeptIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalId_.DeptId field. + ''' + Public Sub SetDeptIdFieldValue(ByVal val As Int64) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.DeptIdColumn) + End Sub + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalId_.Addr field. + ''' + Public Function GetAddrValue() As ColumnValue + Return Me.GetValue(TableUtils.AddrColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalId_.Addr field. + ''' + Public Function GetAddrFieldValue() As String + Return CType(Me.GetValue(TableUtils.AddrColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalId_.Addr field. + ''' + Public Sub SetAddrFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.AddrColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalId_.Addr field. + ''' + Public Sub SetAddrFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.AddrColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalId_.Amphur field. + ''' + Public Function GetAmphurValue() As ColumnValue + Return Me.GetValue(TableUtils.AmphurColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalId_.Amphur field. + ''' + Public Function GetAmphurFieldValue() As String + Return CType(Me.GetValue(TableUtils.AmphurColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalId_.Amphur field. + ''' + Public Sub SetAmphurFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.AmphurColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalId_.Amphur field. + ''' + Public Sub SetAmphurFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.AmphurColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalId_.Province field. + ''' + Public Function GetProvinceValue() As ColumnValue + Return Me.GetValue(TableUtils.ProvinceColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalId_.Province field. + ''' + Public Function GetProvinceFieldValue() As String + Return CType(Me.GetValue(TableUtils.ProvinceColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalId_.Province field. + ''' + Public Sub SetProvinceFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.ProvinceColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalId_.Province field. + ''' + Public Sub SetProvinceFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.ProvinceColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalId_.PostCode field. + ''' + Public Function GetPostCodeValue() As ColumnValue + Return Me.GetValue(TableUtils.PostCodeColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalId_.PostCode field. + ''' + Public Function GetPostCodeFieldValue() As String + Return CType(Me.GetValue(TableUtils.PostCodeColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalId_.PostCode field. + ''' + Public Sub SetPostCodeFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.PostCodeColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalId_.PostCode field. + ''' + Public Sub SetPostCodeFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.PostCodeColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalId_.Phone field. + ''' + Public Function GetPhoneValue() As ColumnValue + Return Me.GetValue(TableUtils.PhoneColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalId_.Phone field. + ''' + Public Function GetPhoneFieldValue() As String + Return CType(Me.GetValue(TableUtils.PhoneColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalId_.Phone field. + ''' + Public Sub SetPhoneFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.PhoneColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalId_.Phone field. + ''' + Public Sub SetPhoneFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.PhoneColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalId_.PhoneExt field. + ''' + Public Function GetPhoneExtValue() As ColumnValue + Return Me.GetValue(TableUtils.PhoneExtColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalId_.PhoneExt field. + ''' + Public Function GetPhoneExtFieldValue() As String + Return CType(Me.GetValue(TableUtils.PhoneExtColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalId_.PhoneExt field. + ''' + Public Sub SetPhoneExtFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.PhoneExtColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalId_.PhoneExt field. + ''' + Public Sub SetPhoneExtFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.PhoneExtColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalId_.MobilePhone field. + ''' + Public Function GetMobilePhoneValue() As ColumnValue + Return Me.GetValue(TableUtils.MobilePhoneColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalId_.MobilePhone field. + ''' + Public Function GetMobilePhoneFieldValue() As String + Return CType(Me.GetValue(TableUtils.MobilePhoneColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalId_.MobilePhone field. + ''' + Public Sub SetMobilePhoneFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.MobilePhoneColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalId_.MobilePhone field. + ''' + Public Sub SetMobilePhoneFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.MobilePhoneColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalId_.picture field. + ''' + Public Function GetpictureValue() As ColumnValue + Return Me.GetValue(TableUtils.pictureColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalId_.picture field. + ''' + Public Function GetpictureFieldValue() As Byte() + Return CType(Me.GetValue(TableUtils.pictureColumn).ToBinary(), Byte()) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalId_.picture field. + ''' + Public Sub SetpictureFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.pictureColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalId_.picture field. + ''' + Public Sub SetpictureFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.pictureColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalId_.picture field. + ''' + Public Sub SetpictureFieldValue(ByVal val As Byte ()) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.pictureColumn) + End Sub + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalId_.PictureName field. + ''' + Public Function GetPictureNameValue() As ColumnValue + Return Me.GetValue(TableUtils.PictureNameColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalId_.PictureName field. + ''' + Public Function GetPictureNameFieldValue() As String + Return CType(Me.GetValue(TableUtils.PictureNameColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalId_.PictureName field. + ''' + Public Sub SetPictureNameFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.PictureNameColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalId_.PictureName field. + ''' + Public Sub SetPictureNameFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.PictureNameColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalId_.DateRank field. + ''' + Public Function GetDateRankValue() As ColumnValue + Return Me.GetValue(TableUtils.DateRankColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalId_.DateRank field. + ''' + Public Function GetDateRankFieldValue() As DateTime + Return CType(Me.GetValue(TableUtils.DateRankColumn).ToDateTime(), DateTime) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalId_.DateRank field. + ''' + Public Sub SetDateRankFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.DateRankColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalId_.DateRank field. + ''' + Public Sub SetDateRankFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.DateRankColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalId_.DateRank field. + ''' + Public Sub SetDateRankFieldValue(ByVal val As DateTime) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.DateRankColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalId_.DatePrevRank field. + ''' + Public Function GetDatePrevRankValue() As ColumnValue + Return Me.GetValue(TableUtils.DatePrevRankColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalId_.DatePrevRank field. + ''' + Public Function GetDatePrevRankFieldValue() As DateTime + Return CType(Me.GetValue(TableUtils.DatePrevRankColumn).ToDateTime(), DateTime) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalId_.DatePrevRank field. + ''' + Public Sub SetDatePrevRankFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.DatePrevRankColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalId_.DatePrevRank field. + ''' + Public Sub SetDatePrevRankFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.DatePrevRankColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalId_.DatePrevRank field. + ''' + Public Sub SetDatePrevRankFieldValue(ByVal val As DateTime) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.DatePrevRankColumn) + End Sub + + + +#End Region + +#Region "Convenience methods to get field names" + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonalId_.PersonalId field. + ''' + Public Property PersonalId() As String + Get + Return CType(Me.GetValue(TableUtils.PersonalIdColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.PersonalIdColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property PersonalIdSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.PersonalIdColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property PersonalIdDefault() As String + Get + Return TableUtils.PersonalIdColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonalId_.SectionId field. + ''' + Public Property SectionId() As Int16 + Get + Return CType(Me.GetValue(TableUtils.SectionIdColumn).ToInt16(), Int16) + End Get + Set (ByVal val As Int16) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.SectionIdColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property SectionIdSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.SectionIdColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property SectionIdDefault() As String + Get + Return TableUtils.SectionIdColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonalId_.MId field. + ''' + Public Property MId() As String + Get + Return CType(Me.GetValue(TableUtils.MIdColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.MIdColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property MIdSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.MIdColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property MIdDefault() As String + Get + Return TableUtils.MIdColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonalId_.TId field. + ''' + Public Property TId() As String + Get + Return CType(Me.GetValue(TableUtils.TIdColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.TIdColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property TIdSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.TIdColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property TIdDefault() As String + Get + Return TableUtils.TIdColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonalId_.ArmyId field. + ''' + Public Property ArmyId() As Byte + Get + Return CType(Me.GetValue(TableUtils.ArmyIdColumn).ToByte(), Byte) + End Get + Set (ByVal val As Byte) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.ArmyIdColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property ArmyIdSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.ArmyIdColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property ArmyIdDefault() As String + Get + Return TableUtils.ArmyIdColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonalId_.RankId field. + ''' + Public Property RankId() As Int32 + Get + Return CType(Me.GetValue(TableUtils.RankIdColumn).ToInt32(), Int32) + End Get + Set (ByVal val As Int32) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.RankIdColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property RankIdSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.RankIdColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property RankIdDefault() As String + Get + Return TableUtils.RankIdColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonalId_.PersonalName field. + ''' + Public Property PersonalName() As String + Get + Return CType(Me.GetValue(TableUtils.PersonalNameColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.PersonalNameColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property PersonalNameSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.PersonalNameColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property PersonalNameDefault() As String + Get + Return TableUtils.PersonalNameColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonalId_.PersonalLastName field. + ''' + Public Property PersonalLastName() As String + Get + Return CType(Me.GetValue(TableUtils.PersonalLastNameColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.PersonalLastNameColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property PersonalLastNameSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.PersonalLastNameColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property PersonalLastNameDefault() As String + Get + Return TableUtils.PersonalLastNameColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonalId_.Sex field. + ''' + Public Property Sex() As Int16 + Get + Return CType(Me.GetValue(TableUtils.SexColumn).ToInt16(), Int16) + End Get + Set (ByVal val As Int16) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.SexColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property SexSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.SexColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property SexDefault() As String + Get + Return TableUtils.SexColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonalId_.BirthDate field. + ''' + Public Property BirthDate() As DateTime + Get + Return CType(Me.GetValue(TableUtils.BirthDateColumn).ToDateTime(), DateTime) + End Get + Set (ByVal val As DateTime) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.BirthDateColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property BirthDateSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.BirthDateColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property BirthDateDefault() As String + Get + Return TableUtils.BirthDateColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonalId_.PlaceOfBirth field. + ''' + Public Property PlaceOfBirth() As String + Get + Return CType(Me.GetValue(TableUtils.PlaceOfBirthColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.PlaceOfBirthColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property PlaceOfBirthSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.PlaceOfBirthColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property PlaceOfBirthDefault() As String + Get + Return TableUtils.PlaceOfBirthColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonalId_.BAmphur field. + ''' + Public Property BAmphur() As String + Get + Return CType(Me.GetValue(TableUtils.BAmphurColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.BAmphurColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property BAmphurSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.BAmphurColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property BAmphurDefault() As String + Get + Return TableUtils.BAmphurColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonalId_.BProvince field. + ''' + Public Property BProvince() As String + Get + Return CType(Me.GetValue(TableUtils.BProvinceColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.BProvinceColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property BProvinceSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.BProvinceColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property BProvinceDefault() As String + Get + Return TableUtils.BProvinceColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonalId_.BloodId field. + ''' + Public Property BloodId() As Byte + Get + Return CType(Me.GetValue(TableUtils.BloodIdColumn).ToByte(), Byte) + End Get + Set (ByVal val As Byte) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.BloodIdColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property BloodIdSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.BloodIdColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property BloodIdDefault() As String + Get + Return TableUtils.BloodIdColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonalId_.Origin field. + ''' + Public Property Origin() As String + Get + Return CType(Me.GetValue(TableUtils.OriginColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.OriginColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property OriginSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.OriginColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property OriginDefault() As String + Get + Return TableUtils.OriginColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonalId_.Nationality field. + ''' + Public Property Nationality() As String + Get + Return CType(Me.GetValue(TableUtils.NationalityColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.NationalityColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property NationalitySpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.NationalityColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property NationalityDefault() As String + Get + Return TableUtils.NationalityColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonalId_.Religion field. + ''' + Public Property Religion() As String + Get + Return CType(Me.GetValue(TableUtils.ReligionColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.ReligionColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property ReligionSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.ReligionColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property ReligionDefault() As String + Get + Return TableUtils.ReligionColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonalId_.ArmId field. + ''' + Public Property ArmId() As Int32 + Get + Return CType(Me.GetValue(TableUtils.ArmIdColumn).ToInt32(), Int32) + End Get + Set (ByVal val As Int32) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.ArmIdColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property ArmIdSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.ArmIdColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property ArmIdDefault() As String + Get + Return TableUtils.ArmIdColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonalId_.RegDate field. + ''' + Public Property RegDate() As DateTime + Get + Return CType(Me.GetValue(TableUtils.RegDateColumn).ToDateTime(), DateTime) + End Get + Set (ByVal val As DateTime) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.RegDateColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property RegDateSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.RegDateColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property RegDateDefault() As String + Get + Return TableUtils.RegDateColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonalId_.RegNo1 field. + ''' + Public Property RegNo1() As String + Get + Return CType(Me.GetValue(TableUtils.RegNo1Column).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.RegNo1Column) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property RegNo1Specified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.RegNo1Column) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property RegNo1Default() As String + Get + Return TableUtils.RegNo1Column.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonalId_.RegNo2 field. + ''' + Public Property RegNo2() As String + Get + Return CType(Me.GetValue(TableUtils.RegNo2Column).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.RegNo2Column) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property RegNo2Specified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.RegNo2Column) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property RegNo2Default() As String + Get + Return TableUtils.RegNo2Column.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonalId_.OfficerDate field. + ''' + Public Property OfficerDate() As DateTime + Get + Return CType(Me.GetValue(TableUtils.OfficerDateColumn).ToDateTime(), DateTime) + End Get + Set (ByVal val As DateTime) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.OfficerDateColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property OfficerDateSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.OfficerDateColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property OfficerDateDefault() As String + Get + Return TableUtils.OfficerDateColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonalId_.Born field. + ''' + Public Property Born() As String + Get + Return CType(Me.GetValue(TableUtils.BornColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.BornColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property BornSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.BornColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property BornDefault() As String + Get + Return TableUtils.BornColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonalId_.CremateMemId field. + ''' + Public Property CremateMemId() As String + Get + Return CType(Me.GetValue(TableUtils.CremateMemIdColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.CremateMemIdColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property CremateMemIdSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.CremateMemIdColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property CremateMemIdDefault() As String + Get + Return TableUtils.CremateMemIdColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonalId_.ArmyWelfareMemId field. + ''' + Public Property ArmyWelfareMemId() As String + Get + Return CType(Me.GetValue(TableUtils.ArmyWelfareMemIdColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.ArmyWelfareMemIdColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property ArmyWelfareMemIdSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.ArmyWelfareMemIdColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property ArmyWelfareMemIdDefault() As String + Get + Return TableUtils.ArmyWelfareMemIdColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonalId_.StatusId field. + ''' + Public Property StatusId() As Byte + Get + Return CType(Me.GetValue(TableUtils.StatusIdColumn).ToByte(), Byte) + End Get + Set (ByVal val As Byte) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.StatusIdColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property StatusIdSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.StatusIdColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property StatusIdDefault() As String + Get + Return TableUtils.StatusIdColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonalId_.Commission field. + ''' + Public Property Commission() As String + Get + Return CType(Me.GetValue(TableUtils.CommissionColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.CommissionColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property CommissionSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.CommissionColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property CommissionDefault() As String + Get + Return TableUtils.CommissionColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonalId_.DeptId field. + ''' + Public Property DeptId() As Int16 + Get + Return CType(Me.GetValue(TableUtils.DeptIdColumn).ToInt16(), Int16) + End Get + Set (ByVal val As Int16) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.DeptIdColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property DeptIdSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.DeptIdColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property DeptIdDefault() As String + Get + Return TableUtils.DeptIdColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonalId_.Addr field. + ''' + Public Property Addr() As String + Get + Return CType(Me.GetValue(TableUtils.AddrColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.AddrColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property AddrSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.AddrColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property AddrDefault() As String + Get + Return TableUtils.AddrColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonalId_.Amphur field. + ''' + Public Property Amphur() As String + Get + Return CType(Me.GetValue(TableUtils.AmphurColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.AmphurColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property AmphurSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.AmphurColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property AmphurDefault() As String + Get + Return TableUtils.AmphurColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonalId_.Province field. + ''' + Public Property Province() As String + Get + Return CType(Me.GetValue(TableUtils.ProvinceColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.ProvinceColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property ProvinceSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.ProvinceColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property ProvinceDefault() As String + Get + Return TableUtils.ProvinceColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonalId_.PostCode field. + ''' + Public Property PostCode() As String + Get + Return CType(Me.GetValue(TableUtils.PostCodeColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.PostCodeColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property PostCodeSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.PostCodeColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property PostCodeDefault() As String + Get + Return TableUtils.PostCodeColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonalId_.Phone field. + ''' + Public Property Phone() As String + Get + Return CType(Me.GetValue(TableUtils.PhoneColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.PhoneColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property PhoneSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.PhoneColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property PhoneDefault() As String + Get + Return TableUtils.PhoneColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonalId_.PhoneExt field. + ''' + Public Property PhoneExt() As String + Get + Return CType(Me.GetValue(TableUtils.PhoneExtColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.PhoneExtColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property PhoneExtSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.PhoneExtColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property PhoneExtDefault() As String + Get + Return TableUtils.PhoneExtColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonalId_.MobilePhone field. + ''' + Public Property MobilePhone() As String + Get + Return CType(Me.GetValue(TableUtils.MobilePhoneColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.MobilePhoneColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property MobilePhoneSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.MobilePhoneColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property MobilePhoneDefault() As String + Get + Return TableUtils.MobilePhoneColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonalId_.picture field. + ''' + Public Property picture() As Byte() + Get + Return CType(Me.GetValue(TableUtils.pictureColumn).ToBinary(), Byte()) + End Get + Set (ByVal val As Byte ()) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.pictureColumn) + End Set + End Property + + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property pictureSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.pictureColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property pictureDefault() As String + Get + Return TableUtils.pictureColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonalId_.PictureName field. + ''' + Public Property PictureName() As String + Get + Return CType(Me.GetValue(TableUtils.PictureNameColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.PictureNameColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property PictureNameSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.PictureNameColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property PictureNameDefault() As String + Get + Return TableUtils.PictureNameColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonalId_.DateRank field. + ''' + Public Property DateRank() As DateTime + Get + Return CType(Me.GetValue(TableUtils.DateRankColumn).ToDateTime(), DateTime) + End Get + Set (ByVal val As DateTime) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.DateRankColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property DateRankSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.DateRankColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property DateRankDefault() As String + Get + Return TableUtils.DateRankColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonalId_.DatePrevRank field. + ''' + Public Property DatePrevRank() As DateTime + Get + Return CType(Me.GetValue(TableUtils.DatePrevRankColumn).ToDateTime(), DateTime) + End Get + Set (ByVal val As DateTime) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.DatePrevRankColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property DatePrevRankSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.DatePrevRankColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property DatePrevRankDefault() As String + Get + Return TableUtils.DatePrevRankColumn.DefaultValue + End Get + End Property + + + +#End Region + +End Class +End Namespace diff --git a/App_Code/Business Layer/BasePersonalIdTable.vb b/App_Code/Business Layer/BasePersonalIdTable.vb new file mode 100644 index 0000000..cba2d79 --- /dev/null +++ b/App_Code/Business Layer/BasePersonalIdTable.vb @@ -0,0 +1,1673 @@ +' This class is "generated" and will be overwritten. +' Your customizations should be made in PersonalIdRecord.vb + +Imports System.Data.SqlTypes +Imports System.Data +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider +Imports Persons.Data + +Namespace Persons.Business + +''' +''' The generated superclass for the class. +''' Provides access to the schema information and record data of a database table or view named PersonalId. +''' +''' +''' The connection details (name, location, etc.) of the database and table (or view) accessed by this class +''' are resolved at runtime based on the connection string in the application's Web.Config file. +''' +''' This class is not intended to be instantiated directly. To obtain an instance of this class, use +''' PersonalIdTable.Instance. +''' +''' +''' + + Public Class BasePersonalIdTable + Inherits PrimaryKeyTable + Implements IUserIdentityTable + + + Private ReadOnly TableDefinitionString As String = PersonalIdDefinition.GetXMLString() + +#Region "IUserTable Members" + + ' Get the column that specifies the user's unique identifier + Public ReadOnly Property UserId() As BaseColumn Implements IUserTable.UserIdColumn + Get + Return Me.TableDefinition.ColumnList.GetByNumber(0) + End Get + End Property + + ' Get a list of records that match the criteria specified in a filter + Public Overloads Function GetRecordList( _ + ByVal userId As String, _ + ByVal filter As BaseFilter, _ + ByVal orderBy As OrderBy, _ + ByVal pageNumber As Integer, _ + ByVal batchSize As Integer, _ + Optional ByRef totalRows As Integer = Nothing _ + ) As ArrayList + If (Not IsNothing(userId)) Then + filter = BaseFilter.CombineFilters( _ + CompoundFilter.CompoundingOperators.And_Operator, _ + filter, _ + BaseFilter.CreateUserIdFilter(CType(Me, IUserTable), userId)) + End If + Dim join As BaseClasses.Data.BaseFilter = Nothing + Return CType(Me, ITable).GetRecordList(join, filter, Nothing, orderBy, pageNumber, batchSize, totalRows) + End Function + +#End Region + + + +#Region "IUserIdentityTable Members" + + ' Get the column that specifies the user's name + Public ReadOnly Property UserName() As BaseColumn Implements IUserIdentityTable.UserNameColumn + Get + Return Me.TableDefinition.ColumnList.GetByNumber(0) + End Get + End Property + + ' Get the column that specifies the user's password + Public ReadOnly Property UserPassword() As BaseColumn Implements IUserIdentityTable.UserPasswordColumn + Get + Return Me.TableDefinition.ColumnList.GetByNumber(9) + End Get + End Property + + ' Get the column that specifies the user's email address + Public ReadOnly Property UserEmail() As BaseColumn Implements IUserIdentityTable.UserEmailColumn + Get + Return Nothing + End Get + End Property + + ' Get a role table object + Public Function GetUserRoleTable() As IUserRoleTable Implements IUserIdentityTable.GetUserRoleTable + Return TblUserRoleTable.Instance + End Function + + ' Get a list of records that match the user's name/password + Public Overloads Function GetRecordList( _ + ByVal userName As String, _ + ByVal userPassword As String, _ + ByVal filter As BaseFilter, _ + ByVal orderBy As OrderBy, _ + ByVal pageNumber As Integer, _ + ByVal batchSize As Integer, _ + Optional ByRef totalRows As Integer = Nothing _ + ) As ArrayList + ' Set up a name/password filter + If (Not (IsNothing(userName) AndAlso IsNothing(userPassword))) Then + filter = BaseFilter.CombineFilters( _ + CompoundFilter.CompoundingOperators.And_Operator, _ + filter, _ + BaseFilter.CreateUserAuthenticationFilter(CType(Me, IUserIdentityTable), userName, userPassword)) + End If + Dim join As BaseClasses.Data.BaseFilter = Nothing + Return CType(Me, ITable).GetRecordList(join, filter, Nothing, orderBy, pageNumber, batchSize, totalRows) + End Function + +#End Region + + + + + Protected Sub New() + MyBase.New() + Me.Initialize() + End Sub + + Protected Overridable Sub Initialize() + Dim def As New XmlTableDefinition(TableDefinitionString) + Me.TableDefinition = New TableDefinition() + Me.TableDefinition.TableClassName = System.Reflection.Assembly.CreateQualifiedName("App_Code", "Persons.Business.PersonalIdTable") + def.InitializeTableDefinition(Me.TableDefinition) + Me.ConnectionName = def.GetConnectionName() + Me.RecordClassName = System.Reflection.Assembly.CreateQualifiedName("App_Code", "Persons.Business.PersonalIdRecord") + Me.ApplicationName = "App_Code" + Me.DataAdapter = New PersonalIdSqlTable() + Directcast(Me.DataAdapter, PersonalIdSqlTable).ConnectionName = Me.ConnectionName + + Me.TableDefinition.AdapterMetaData = Me.DataAdapter.AdapterMetaData + PersonalIdColumn.CodeName = "PersonalId" + SectionIdColumn.CodeName = "SectionId" + MIdColumn.CodeName = "MId" + TIdColumn.CodeName = "TId" + ArmyIdColumn.CodeName = "ArmyId" + RankIdColumn.CodeName = "RankId" + PersonalNameColumn.CodeName = "PersonalName" + PersonalLastNameColumn.CodeName = "PersonalLastName" + SexColumn.CodeName = "Sex" + BirthDateColumn.CodeName = "BirthDate" + PlaceOfBirthColumn.CodeName = "PlaceOfBirth" + BAmphurColumn.CodeName = "BAmphur" + BProvinceColumn.CodeName = "BProvince" + BloodIdColumn.CodeName = "BloodId" + OriginColumn.CodeName = "Origin" + NationalityColumn.CodeName = "Nationality" + ReligionColumn.CodeName = "Religion" + ArmIdColumn.CodeName = "ArmId" + RegDateColumn.CodeName = "RegDate" + RegNo1Column.CodeName = "RegNo1" + RegNo2Column.CodeName = "RegNo2" + OfficerDateColumn.CodeName = "OfficerDate" + BornColumn.CodeName = "Born" + CremateMemIdColumn.CodeName = "CremateMemId" + ArmyWelfareMemIdColumn.CodeName = "ArmyWelfareMemId" + StatusIdColumn.CodeName = "StatusId" + CommissionColumn.CodeName = "Commission" + DeptIdColumn.CodeName = "DeptId" + AddrColumn.CodeName = "Addr" + AmphurColumn.CodeName = "Amphur" + ProvinceColumn.CodeName = "Province" + PostCodeColumn.CodeName = "PostCode" + PhoneColumn.CodeName = "Phone" + PhoneExtColumn.CodeName = "PhoneExt" + MobilePhoneColumn.CodeName = "MobilePhone" + pictureColumn.CodeName = "picture" + PictureNameColumn.CodeName = "PictureName" + DateRankColumn.CodeName = "DateRank" + DatePrevRankColumn.CodeName = "DatePrevRank" + + End Sub + +#Region "Overriden methods" + + +#End Region + +#Region "Properties for columns" + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalId_.PersonalId column object. + ''' + Public ReadOnly Property PersonalIdColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(0), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalId_.PersonalId column object. + ''' + Public Shared ReadOnly Property PersonalId() As BaseClasses.Data.StringColumn + Get + Return PersonalIdTable.Instance.PersonalIdColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonalId_.SectionId column object. + ''' + Public ReadOnly Property SectionIdColumn() As BaseClasses.Data.NumberColumn + Get + Return CType(Me.TableDefinition.ColumnList(1), BaseClasses.Data.NumberColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalId_.SectionId column object. + ''' + Public Shared ReadOnly Property SectionId() As BaseClasses.Data.NumberColumn + Get + Return PersonalIdTable.Instance.SectionIdColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonalId_.MId column object. + ''' + Public ReadOnly Property MIdColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(2), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalId_.MId column object. + ''' + Public Shared ReadOnly Property MId() As BaseClasses.Data.StringColumn + Get + Return PersonalIdTable.Instance.MIdColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonalId_.TId column object. + ''' + Public ReadOnly Property TIdColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(3), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalId_.TId column object. + ''' + Public Shared ReadOnly Property TId() As BaseClasses.Data.StringColumn + Get + Return PersonalIdTable.Instance.TIdColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonalId_.ArmyId column object. + ''' + Public ReadOnly Property ArmyIdColumn() As BaseClasses.Data.NumberColumn + Get + Return CType(Me.TableDefinition.ColumnList(4), BaseClasses.Data.NumberColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalId_.ArmyId column object. + ''' + Public Shared ReadOnly Property ArmyId() As BaseClasses.Data.NumberColumn + Get + Return PersonalIdTable.Instance.ArmyIdColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonalId_.RankId column object. + ''' + Public ReadOnly Property RankIdColumn() As BaseClasses.Data.NumberColumn + Get + Return CType(Me.TableDefinition.ColumnList(5), BaseClasses.Data.NumberColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalId_.RankId column object. + ''' + Public Shared ReadOnly Property RankId() As BaseClasses.Data.NumberColumn + Get + Return PersonalIdTable.Instance.RankIdColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonalId_.PersonalName column object. + ''' + Public ReadOnly Property PersonalNameColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(6), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalId_.PersonalName column object. + ''' + Public Shared ReadOnly Property PersonalName() As BaseClasses.Data.StringColumn + Get + Return PersonalIdTable.Instance.PersonalNameColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonalId_.PersonalLastName column object. + ''' + Public ReadOnly Property PersonalLastNameColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(7), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalId_.PersonalLastName column object. + ''' + Public Shared ReadOnly Property PersonalLastName() As BaseClasses.Data.StringColumn + Get + Return PersonalIdTable.Instance.PersonalLastNameColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonalId_.Sex column object. + ''' + Public ReadOnly Property SexColumn() As BaseClasses.Data.NumberColumn + Get + Return CType(Me.TableDefinition.ColumnList(8), BaseClasses.Data.NumberColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalId_.Sex column object. + ''' + Public Shared ReadOnly Property Sex() As BaseClasses.Data.NumberColumn + Get + Return PersonalIdTable.Instance.SexColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonalId_.BirthDate column object. + ''' + Public ReadOnly Property BirthDateColumn() As BaseClasses.Data.DateColumn + Get + Return CType(Me.TableDefinition.ColumnList(9), BaseClasses.Data.DateColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalId_.BirthDate column object. + ''' + Public Shared ReadOnly Property BirthDate() As BaseClasses.Data.DateColumn + Get + Return PersonalIdTable.Instance.BirthDateColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonalId_.PlaceOfBirth column object. + ''' + Public ReadOnly Property PlaceOfBirthColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(10), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalId_.PlaceOfBirth column object. + ''' + Public Shared ReadOnly Property PlaceOfBirth() As BaseClasses.Data.StringColumn + Get + Return PersonalIdTable.Instance.PlaceOfBirthColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonalId_.BAmphur column object. + ''' + Public ReadOnly Property BAmphurColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(11), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalId_.BAmphur column object. + ''' + Public Shared ReadOnly Property BAmphur() As BaseClasses.Data.StringColumn + Get + Return PersonalIdTable.Instance.BAmphurColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonalId_.BProvince column object. + ''' + Public ReadOnly Property BProvinceColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(12), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalId_.BProvince column object. + ''' + Public Shared ReadOnly Property BProvince() As BaseClasses.Data.StringColumn + Get + Return PersonalIdTable.Instance.BProvinceColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonalId_.BloodId column object. + ''' + Public ReadOnly Property BloodIdColumn() As BaseClasses.Data.NumberColumn + Get + Return CType(Me.TableDefinition.ColumnList(13), BaseClasses.Data.NumberColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalId_.BloodId column object. + ''' + Public Shared ReadOnly Property BloodId() As BaseClasses.Data.NumberColumn + Get + Return PersonalIdTable.Instance.BloodIdColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonalId_.Origin column object. + ''' + Public ReadOnly Property OriginColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(14), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalId_.Origin column object. + ''' + Public Shared ReadOnly Property Origin() As BaseClasses.Data.StringColumn + Get + Return PersonalIdTable.Instance.OriginColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonalId_.Nationality column object. + ''' + Public ReadOnly Property NationalityColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(15), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalId_.Nationality column object. + ''' + Public Shared ReadOnly Property Nationality() As BaseClasses.Data.StringColumn + Get + Return PersonalIdTable.Instance.NationalityColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonalId_.Religion column object. + ''' + Public ReadOnly Property ReligionColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(16), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalId_.Religion column object. + ''' + Public Shared ReadOnly Property Religion() As BaseClasses.Data.StringColumn + Get + Return PersonalIdTable.Instance.ReligionColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonalId_.ArmId column object. + ''' + Public ReadOnly Property ArmIdColumn() As BaseClasses.Data.NumberColumn + Get + Return CType(Me.TableDefinition.ColumnList(17), BaseClasses.Data.NumberColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalId_.ArmId column object. + ''' + Public Shared ReadOnly Property ArmId() As BaseClasses.Data.NumberColumn + Get + Return PersonalIdTable.Instance.ArmIdColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonalId_.RegDate column object. + ''' + Public ReadOnly Property RegDateColumn() As BaseClasses.Data.DateColumn + Get + Return CType(Me.TableDefinition.ColumnList(18), BaseClasses.Data.DateColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalId_.RegDate column object. + ''' + Public Shared ReadOnly Property RegDate() As BaseClasses.Data.DateColumn + Get + Return PersonalIdTable.Instance.RegDateColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonalId_.RegNo1 column object. + ''' + Public ReadOnly Property RegNo1Column() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(19), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalId_.RegNo1 column object. + ''' + Public Shared ReadOnly Property RegNo1() As BaseClasses.Data.StringColumn + Get + Return PersonalIdTable.Instance.RegNo1Column + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonalId_.RegNo2 column object. + ''' + Public ReadOnly Property RegNo2Column() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(20), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalId_.RegNo2 column object. + ''' + Public Shared ReadOnly Property RegNo2() As BaseClasses.Data.StringColumn + Get + Return PersonalIdTable.Instance.RegNo2Column + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonalId_.OfficerDate column object. + ''' + Public ReadOnly Property OfficerDateColumn() As BaseClasses.Data.DateColumn + Get + Return CType(Me.TableDefinition.ColumnList(21), BaseClasses.Data.DateColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalId_.OfficerDate column object. + ''' + Public Shared ReadOnly Property OfficerDate() As BaseClasses.Data.DateColumn + Get + Return PersonalIdTable.Instance.OfficerDateColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonalId_.Born column object. + ''' + Public ReadOnly Property BornColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(22), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalId_.Born column object. + ''' + Public Shared ReadOnly Property Born() As BaseClasses.Data.StringColumn + Get + Return PersonalIdTable.Instance.BornColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonalId_.CremateMemId column object. + ''' + Public ReadOnly Property CremateMemIdColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(23), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalId_.CremateMemId column object. + ''' + Public Shared ReadOnly Property CremateMemId() As BaseClasses.Data.StringColumn + Get + Return PersonalIdTable.Instance.CremateMemIdColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonalId_.ArmyWelfareMemId column object. + ''' + Public ReadOnly Property ArmyWelfareMemIdColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(24), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalId_.ArmyWelfareMemId column object. + ''' + Public Shared ReadOnly Property ArmyWelfareMemId() As BaseClasses.Data.StringColumn + Get + Return PersonalIdTable.Instance.ArmyWelfareMemIdColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonalId_.StatusId column object. + ''' + Public ReadOnly Property StatusIdColumn() As BaseClasses.Data.NumberColumn + Get + Return CType(Me.TableDefinition.ColumnList(25), BaseClasses.Data.NumberColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalId_.StatusId column object. + ''' + Public Shared ReadOnly Property StatusId() As BaseClasses.Data.NumberColumn + Get + Return PersonalIdTable.Instance.StatusIdColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonalId_.Commission column object. + ''' + Public ReadOnly Property CommissionColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(26), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalId_.Commission column object. + ''' + Public Shared ReadOnly Property Commission() As BaseClasses.Data.StringColumn + Get + Return PersonalIdTable.Instance.CommissionColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonalId_.DeptId column object. + ''' + Public ReadOnly Property DeptIdColumn() As BaseClasses.Data.NumberColumn + Get + Return CType(Me.TableDefinition.ColumnList(27), BaseClasses.Data.NumberColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalId_.DeptId column object. + ''' + Public Shared ReadOnly Property DeptId() As BaseClasses.Data.NumberColumn + Get + Return PersonalIdTable.Instance.DeptIdColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonalId_.Addr column object. + ''' + Public ReadOnly Property AddrColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(28), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalId_.Addr column object. + ''' + Public Shared ReadOnly Property Addr() As BaseClasses.Data.StringColumn + Get + Return PersonalIdTable.Instance.AddrColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonalId_.Amphur column object. + ''' + Public ReadOnly Property AmphurColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(29), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalId_.Amphur column object. + ''' + Public Shared ReadOnly Property Amphur() As BaseClasses.Data.StringColumn + Get + Return PersonalIdTable.Instance.AmphurColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonalId_.Province column object. + ''' + Public ReadOnly Property ProvinceColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(30), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalId_.Province column object. + ''' + Public Shared ReadOnly Property Province() As BaseClasses.Data.StringColumn + Get + Return PersonalIdTable.Instance.ProvinceColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonalId_.PostCode column object. + ''' + Public ReadOnly Property PostCodeColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(31), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalId_.PostCode column object. + ''' + Public Shared ReadOnly Property PostCode() As BaseClasses.Data.StringColumn + Get + Return PersonalIdTable.Instance.PostCodeColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonalId_.Phone column object. + ''' + Public ReadOnly Property PhoneColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(32), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalId_.Phone column object. + ''' + Public Shared ReadOnly Property Phone() As BaseClasses.Data.StringColumn + Get + Return PersonalIdTable.Instance.PhoneColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonalId_.PhoneExt column object. + ''' + Public ReadOnly Property PhoneExtColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(33), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalId_.PhoneExt column object. + ''' + Public Shared ReadOnly Property PhoneExt() As BaseClasses.Data.StringColumn + Get + Return PersonalIdTable.Instance.PhoneExtColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonalId_.MobilePhone column object. + ''' + Public ReadOnly Property MobilePhoneColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(34), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalId_.MobilePhone column object. + ''' + Public Shared ReadOnly Property MobilePhone() As BaseClasses.Data.StringColumn + Get + Return PersonalIdTable.Instance.MobilePhoneColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonalId_.picture column object. + ''' + Public ReadOnly Property pictureColumn() As BaseClasses.Data.ImageColumn + Get + Return CType(Me.TableDefinition.ColumnList(35), BaseClasses.Data.ImageColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalId_.picture column object. + ''' + Public Shared ReadOnly Property picture() As BaseClasses.Data.ImageColumn + Get + Return PersonalIdTable.Instance.pictureColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonalId_.PictureName column object. + ''' + Public ReadOnly Property PictureNameColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(36), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalId_.PictureName column object. + ''' + Public Shared ReadOnly Property PictureName() As BaseClasses.Data.StringColumn + Get + Return PersonalIdTable.Instance.PictureNameColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonalId_.DateRank column object. + ''' + Public ReadOnly Property DateRankColumn() As BaseClasses.Data.DateColumn + Get + Return CType(Me.TableDefinition.ColumnList(37), BaseClasses.Data.DateColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalId_.DateRank column object. + ''' + Public Shared ReadOnly Property DateRank() As BaseClasses.Data.DateColumn + Get + Return PersonalIdTable.Instance.DateRankColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonalId_.DatePrevRank column object. + ''' + Public ReadOnly Property DatePrevRankColumn() As BaseClasses.Data.DateColumn + Get + Return CType(Me.TableDefinition.ColumnList(38), BaseClasses.Data.DateColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalId_.DatePrevRank column object. + ''' + Public Shared ReadOnly Property DatePrevRank() As BaseClasses.Data.DateColumn + Get + Return PersonalIdTable.Instance.DatePrevRankColumn + End Get + End Property + + +#End Region + + +#Region "Shared helper methods" + + ''' + ''' This is a shared function that can be used to get an array of PersonalIdRecord records using a where clause. + ''' + Public Shared Function GetRecords(ByVal where As String) As PersonalIdRecord() + + Return GetRecords(where, Nothing, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) + End Function + + ''' + ''' This is a shared function that can be used to get an array of PersonalIdRecord records using a where clause. + ''' + Public Shared Function GetRecords(ByVal join As BaseFilter, ByVal where As String) As PersonalIdRecord() + + Return GetRecords(join, where, Nothing, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) + End Function + + ''' + ''' This is a shared function that can be used to get an array of PersonalIdRecord records using a where and order by clause. + ''' + Public Shared Function GetRecords( _ + ByVal where As String, _ + ByVal orderBy As OrderBy) As PersonalIdRecord() + + Return GetRecords(where, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) + End Function + + ''' + ''' This is a shared function that can be used to get an array of PersonalIdRecord records using a where and order by clause. + ''' + Public Shared Function GetRecords( _ + ByVal join As BaseFilter, _ + ByVal where As String, _ + ByVal orderBy As OrderBy) As PersonalIdRecord() + + Return GetRecords(join, where, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) + End Function + + ''' + ''' This is a shared function that can be used to get an array of PersonalIdRecord records using a where and order by clause clause with pagination. + ''' + Public Shared Function GetRecords( _ + ByVal where As String, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As PersonalIdRecord() + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + Dim join As BaseClasses.Data.BaseFilter = Nothing + Dim recList As ArrayList = PersonalIdTable.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, pageIndex, pageSize) + + Return CType(recList.ToArray(GetType(Persons.Business.PersonalIdRecord)), PersonalIdRecord()) + End Function + + ''' + ''' This is a shared function that can be used to get an array of PersonalIdRecord records using a where and order by clause clause with pagination. + ''' + Public Shared Function GetRecords( _ + ByVal join As BaseFilter, _ + ByVal where As String, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As PersonalIdRecord() + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Dim recList As ArrayList = PersonalIdTable.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, pageIndex, pageSize) + + Return CType(recList.ToArray(GetType(Persons.Business.PersonalIdRecord)), PersonalIdRecord()) + End Function + + Public Shared Function GetRecords( _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As PersonalIdRecord() + Dim join As BaseClasses.Data.BaseFilter = Nothing + Dim recList As ArrayList = PersonalIdTable.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + Return CType(recList.ToArray(GetType(Persons.Business.PersonalIdRecord)), PersonalIdRecord()) + End Function + + Public Shared Function GetRecords( _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As PersonalIdRecord() + + Dim recList As ArrayList = PersonalIdTable.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + Return CType(recList.ToArray(GetType(Persons.Business.PersonalIdRecord)), PersonalIdRecord()) + End Function + + Public Shared Function GetRecords( _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer, _ + ByRef totalRecords As Integer) As PersonalIdRecord() + Dim join As BaseClasses.Data.BaseFilter = Nothing + Dim recList As ArrayList = PersonalIdTable.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize, totalRecords) + + Return CType(recList.ToArray(GetType(Persons.Business.PersonalIdRecord)), PersonalIdRecord()) + End Function + + Public Shared Function GetRecords( _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer, _ + ByRef totalRecords As Integer) As PersonalIdRecord() + + Dim recList As ArrayList = PersonalIdTable.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize, totalRecords) + + Return CType(recList.ToArray(GetType(Persons.Business.PersonalIdRecord)), PersonalIdRecord()) + End Function + + ''' + ''' This is a shared function that can be used to get total number of records that will be returned using the where clause. + ''' + Public Shared Function GetRecordCount(ByVal where As String) As Integer + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Return CInt(PersonalIdTable.Instance.GetRecordListCount(Nothing, whereFilter, Nothing, Nothing)) + End Function + +''' + ''' This is a shared function that can be used to get total number of records that will be returned using the where clause. + ''' + Public Shared Function GetRecordCount(ByVal join As BaseFilter, ByVal where As String) As Integer + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Return CInt(PersonalIdTable.Instance.GetRecordListCount(join, whereFilter, Nothing, Nothing)) + End Function + + Public Shared Function GetRecordCount(ByVal where As WhereClause) As Integer + Return CInt(PersonalIdTable.Instance.GetRecordListCount(Nothing, where.GetFilter(), Nothing, Nothing)) + End Function + + Public Shared Function GetRecordCount(ByVal join As BaseFilter, ByVal where As WhereClause) As Integer + Return CInt(PersonalIdTable.Instance.GetRecordListCount(join, where.GetFilter(), Nothing, Nothing)) + End Function + + ''' + ''' This is a shared function that can be used to get a PersonalIdRecord record using a where clause. + ''' + Public Shared Function GetRecord(ByVal where As String) As PersonalIdRecord + Dim orderBy As OrderBy = Nothing + Return GetRecord(where, orderBy) + End Function + + ''' + ''' This is a shared function that can be used to get a PersonalIdRecord record using a where clause. + ''' + Public Shared Function GetRecord(ByVal join As BaseFilter, ByVal where As String) As PersonalIdRecord + Dim orderBy As OrderBy = Nothing + Return GetRecord(join, where, orderBy) + End Function + + ''' + ''' This is a shared function that can be used to get a PersonalIdRecord record using a where and order by clause. + ''' + Public Shared Function GetRecord( _ + ByVal where As String, _ + ByVal orderBy As OrderBy) As PersonalIdRecord + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + Dim join As BaseClasses.Data.BaseFilter = Nothing + Dim recList As ArrayList = PersonalIdTable.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MIN_BATCH_SIZE) + + Dim rec As PersonalIdRecord = Nothing + If recList.Count > 0 Then + rec = CType(recList(0), PersonalIdRecord) + End If + + Return rec + End Function + + ''' + ''' This is a shared function that can be used to get a PersonalIdRecord record using a where and order by clause. + ''' + Public Shared Function GetRecord( _ + ByVal join As BaseFilter, _ + ByVal where As String, _ + ByVal orderBy As OrderBy) As PersonalIdRecord + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Dim recList As ArrayList = PersonalIdTable.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MIN_BATCH_SIZE) + + Dim rec As PersonalIdRecord = Nothing + If recList.Count > 0 Then + rec = CType(recList(0), PersonalIdRecord) + End If + + Return rec + End Function + + + Public Shared Function GetValues( _ + ByVal col As BaseColumn, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal maxItems As Integer) As String() + + ' Create the filter list. + Dim retCol As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, True) + retCol.AddColumn(col) + + Return PersonalIdTable.Instance.GetColumnValues(retCol, Nothing, where.GetFilter(), Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, maxItems) + + End Function + + Public Shared Function GetValues( _ + ByVal col As BaseColumn, _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal maxItems As Integer) As String() + + ' Create the filter list. + Dim retCol As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, True) + retCol.AddColumn(col) + + Return PersonalIdTable.Instance.GetColumnValues(retCol, join, where.GetFilter(), Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, maxItems) + + End Function + + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where clause. + ''' + Public Shared Function GetDataTable(ByVal where As String) As System.Data.DataTable + + Dim recs() As PersonalIdRecord = GetRecords(where) + Return PersonalIdTable.Instance.CreateDataTable(recs, Nothing) + End Function + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where clause. + ''' + Public Shared Function GetDataTable(ByVal join As BaseFilter, ByVal where As String) As System.Data.DataTable + + Dim recs() As PersonalIdRecord = GetRecords(join, where) + Return PersonalIdTable.Instance.CreateDataTable(recs, Nothing) + End Function + + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause. + ''' + Public Shared Function GetDataTable(ByVal where As String, ByVal orderBy As OrderBy) As System.Data.DataTable + + Dim recs() As PersonalIdRecord = GetRecords(where, orderBy) + Return PersonalIdTable.Instance.CreateDataTable(recs, Nothing) + End Function + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause. + ''' + Public Shared Function GetDataTable(ByVal join As BaseFilter, ByVal where As String, ByVal orderBy As OrderBy) As System.Data.DataTable + + Dim recs() As PersonalIdRecord = GetRecords(join, where, orderBy) + Return PersonalIdTable.Instance.CreateDataTable(recs, Nothing) + End Function + + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause with pagination. + ''' + Public Shared Function GetDataTable( _ + ByVal where As String, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As System.Data.DataTable + + Dim recs() As PersonalIdRecord = GetRecords(where, orderBy, pageIndex, pageSize) + Return PersonalIdTable.Instance.CreateDataTable(recs, Nothing) + End Function + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause with pagination. + ''' + Public Shared Function GetDataTable( _ + ByVal join As BaseFilter, _ + ByVal where As String, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As System.Data.DataTable + + Dim recs() As PersonalIdRecord = GetRecords(join, where, orderBy, pageIndex, pageSize) + Return PersonalIdTable.Instance.CreateDataTable(recs, Nothing) + End Function + + + ''' + ''' This is a shared function that can be used to delete records using a where clause. + ''' + Public Shared Sub DeleteRecords(ByVal where As String) + If where = Nothing OrElse where.Trim() = "" Then + Return + End If + + Dim whereFilter As SqlFilter = New SqlFilter(where) + PersonalIdTable.Instance.DeleteRecordList(whereFilter) + End Sub + + ''' + ''' This is a shared function that can be used to export records using a where clause. + ''' + Public Shared Function Export(ByVal where As String) As String + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Return PersonalIdTable.Instance.ExportRecordData(whereFilter) + End Function + + Public Shared Function Export(ByVal where As WhereClause) As String + Dim whereFilter As BaseFilter = Nothing + If Not where Is Nothing Then + whereFilter = where.GetFilter() + End If + + Return PersonalIdTable.Instance.ExportRecordData(whereFilter) + End Function + + Public Shared Function GetSum( _ + ByVal col As BaseColumn, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) _ + As String + + Dim colSel As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, False) + colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Sum) + + Return PersonalIdTable.Instance.GetColumnStatistics(colSel, Nothing, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + End Function + + Public Shared Function GetSum( _ + ByVal col As BaseColumn, _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) _ + As String + + Dim colSel As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, False) + colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Sum) + + Return PersonalIdTable.Instance.GetColumnStatistics(colSel, join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + End Function + + + Public Shared Function GetCount( _ + ByVal col As BaseColumn, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) _ + As String + + Dim colSel As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, False) + colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Count) + + Return PersonalIdTable.Instance.GetColumnStatistics(colSel, Nothing, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + End Function + + Public Shared Function GetCount( _ + ByVal col As BaseColumn, _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) _ + As String + + Dim colSel As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, False) + colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Count) + + Return PersonalIdTable.Instance.GetColumnStatistics(colSel, join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + End Function + + ''' + ''' This method returns the columns in the table. + ''' + Public Shared Function GetColumns() As BaseColumn() + Return PersonalIdTable.Instance.TableDefinition.Columns + End Function + + ''' + ''' This method returns the columnlist in the table. + ''' + Public Shared Function GetColumnList() As ColumnList + Return PersonalIdTable.Instance.TableDefinition.ColumnList + End Function + + + ''' + ''' This method creates a new record and returns it to be edited. + ''' + Public Shared Function CreateNewRecord() As IRecord + Return PersonalIdTable.Instance.CreateRecord() + End Function + + ''' + ''' This method creates a new record and returns it to be edited. + ''' + ''' ID of the new record. + Public Shared Function CreateNewRecord(ByVal tempId As String) As IRecord + Return PersonalIdTable.Instance.CreateRecord(tempId) + End Function + + ''' + ''' This method checks if column is editable. + ''' + ''' Name of the column to check. + Public Shared Function isReadOnlyColumn(ByVal columnName As String) As Boolean + Dim column As BaseColumn = GetColumn(columnName) + If (Not IsNothing(column)) Then + Return column.IsValuesReadOnly + Else + Return True + End If + End Function + + ''' + ''' This method gets the specified column. + ''' + ''' Unique name of the column to fetch. + Public Shared Function GetColumn(ByVal uniqueColumnName As String) As BaseColumn + Dim column As BaseColumn = PersonalIdTable.Instance.TableDefinition.ColumnList.GetByUniqueName(uniqueColumnName) + Return column + End Function + + ' Convenience method for getting a record using a string-based record identifier + Public Shared Function GetRecord(ByVal id As String, ByVal bMutable As Boolean) As PersonalIdRecord + Return CType(PersonalIdTable.Instance.GetRecordData(id, bMutable), PersonalIdRecord) + End Function + + ' Convenience method for getting a record using a KeyValue record identifier + Public Shared Function GetRecord(ByVal id As KeyValue, ByVal bMutable As Boolean) As PersonalIdRecord + Return CType(PersonalIdTable.Instance.GetRecordData(id, bMutable), PersonalIdRecord) + End Function + + ' Convenience method for creating a record + Public Overloads Function NewRecord( _ + ByVal PersonalIdValue As String, _ + ByVal SectionIdValue As String, _ + ByVal MIdValue As String, _ + ByVal TIdValue As String, _ + ByVal ArmyIdValue As String, _ + ByVal RankIdValue As String, _ + ByVal PersonalNameValue As String, _ + ByVal PersonalLastNameValue As String, _ + ByVal SexValue As String, _ + ByVal BirthDateValue As String, _ + ByVal PlaceOfBirthValue As String, _ + ByVal BAmphurValue As String, _ + ByVal BProvinceValue As String, _ + ByVal BloodIdValue As String, _ + ByVal OriginValue As String, _ + ByVal NationalityValue As String, _ + ByVal ReligionValue As String, _ + ByVal ArmIdValue As String, _ + ByVal RegDateValue As String, _ + ByVal RegNo1Value As String, _ + ByVal RegNo2Value As String, _ + ByVal OfficerDateValue As String, _ + ByVal BornValue As String, _ + ByVal CremateMemIdValue As String, _ + ByVal ArmyWelfareMemIdValue As String, _ + ByVal StatusIdValue As String, _ + ByVal CommissionValue As String, _ + ByVal DeptIdValue As String, _ + ByVal AddrValue As String, _ + ByVal AmphurValue As String, _ + ByVal ProvinceValue As String, _ + ByVal PostCodeValue As String, _ + ByVal PhoneValue As String, _ + ByVal PhoneExtValue As String, _ + ByVal MobilePhoneValue As String, _ + ByVal pictureValue As String, _ + ByVal PictureNameValue As String, _ + ByVal DateRankValue As String, _ + ByVal DatePrevRankValue As String _ + ) As KeyValue + Dim rec As IPrimaryKeyRecord = CType(Me.CreateRecord(), IPrimaryKeyRecord) + rec.SetString(PersonalIdValue, PersonalIdColumn) + rec.SetString(SectionIdValue, SectionIdColumn) + rec.SetString(MIdValue, MIdColumn) + rec.SetString(TIdValue, TIdColumn) + rec.SetString(ArmyIdValue, ArmyIdColumn) + rec.SetString(RankIdValue, RankIdColumn) + rec.SetString(PersonalNameValue, PersonalNameColumn) + rec.SetString(PersonalLastNameValue, PersonalLastNameColumn) + rec.SetString(SexValue, SexColumn) + rec.SetString(BirthDateValue, BirthDateColumn) + rec.SetString(PlaceOfBirthValue, PlaceOfBirthColumn) + rec.SetString(BAmphurValue, BAmphurColumn) + rec.SetString(BProvinceValue, BProvinceColumn) + rec.SetString(BloodIdValue, BloodIdColumn) + rec.SetString(OriginValue, OriginColumn) + rec.SetString(NationalityValue, NationalityColumn) + rec.SetString(ReligionValue, ReligionColumn) + rec.SetString(ArmIdValue, ArmIdColumn) + rec.SetString(RegDateValue, RegDateColumn) + rec.SetString(RegNo1Value, RegNo1Column) + rec.SetString(RegNo2Value, RegNo2Column) + rec.SetString(OfficerDateValue, OfficerDateColumn) + rec.SetString(BornValue, BornColumn) + rec.SetString(CremateMemIdValue, CremateMemIdColumn) + rec.SetString(ArmyWelfareMemIdValue, ArmyWelfareMemIdColumn) + rec.SetString(StatusIdValue, StatusIdColumn) + rec.SetString(CommissionValue, CommissionColumn) + rec.SetString(DeptIdValue, DeptIdColumn) + rec.SetString(AddrValue, AddrColumn) + rec.SetString(AmphurValue, AmphurColumn) + rec.SetString(ProvinceValue, ProvinceColumn) + rec.SetString(PostCodeValue, PostCodeColumn) + rec.SetString(PhoneValue, PhoneColumn) + rec.SetString(PhoneExtValue, PhoneExtColumn) + rec.SetString(MobilePhoneValue, MobilePhoneColumn) + rec.SetString(pictureValue, pictureColumn) + rec.SetString(PictureNameValue, PictureNameColumn) + rec.SetString(DateRankValue, DateRankColumn) + rec.SetString(DatePrevRankValue, DatePrevRankColumn) + + + rec.Create() 'update the DB so any DB-initialized fields (like autoincrement IDs) can be initialized + + Dim key As KeyValue = rec.GetID() + Return key + End Function + + ''' + ''' This method deletes a specified record + ''' + ''' Keyvalue of the record to be deleted. + Public Shared Sub DeleteRecord(ByVal kv As KeyValue) + PersonalIdTable.Instance.DeleteOneRecord(kv) + End Sub + + ''' + ''' This method checks if record exist in the database using the keyvalue provided. + ''' + ''' Key value of the record. + Public Shared Function DoesRecordExist(ByVal kv As KeyValue) As Boolean + Dim recordExist As Boolean = True + Try + PersonalIdTable.GetRecord(kv, False) + Catch ex As Exception + recordExist = False + End Try + Return recordExist + End Function + + ''' + ''' This method returns all the primary columns in the table. + ''' + Public Shared Function GetPrimaryKeyColumns() As ColumnList + If (Not IsNothing(PersonalIdTable.Instance.TableDefinition.PrimaryKey)) Then + Return PersonalIdTable.Instance.TableDefinition.PrimaryKey.Columns + Else + Return Nothing + End If + End Function + + ''' + ''' This method takes a key and returns a keyvalue. + ''' + ''' key could be array of primary key values in case of composite primary key or a string containing single primary key value in case of non-composite primary key. + Public Shared Function GetKeyValue(ByVal key As Object) As KeyValue + Dim kv As KeyValue = Nothing + + If (Not (IsNothing(PersonalIdTable.Instance.TableDefinition.PrimaryKey))) Then + + Dim isCompositePrimaryKey As Boolean = False + isCompositePrimaryKey = PersonalIdTable.Instance.TableDefinition.PrimaryKey.IsCompositeKey + + If ((isCompositePrimaryKey) AndAlso (key.GetType.IsArray())) Then + + ' If the key is composite, then construct a key value. + kv = New KeyValue + Dim fullKeyString As String = "" + Dim keyArray As Array = CType(key, Array) + If (Not IsNothing(keyArray)) Then + Dim length As Integer = keyArray.Length + Dim pkColumns As ColumnList = PersonalIdTable.Instance.TableDefinition.PrimaryKey.Columns + Dim pkColumn As BaseColumn + Dim index As Integer = 0 + For Each pkColumn In pkColumns + Dim keyString As String = CType(keyArray.GetValue(index), String) + If (PersonalIdTable.Instance.TableDefinition.TableType = BaseClasses.Data.TableDefinition.TableTypes.Virtual) Then + kv.AddElement(pkColumn.UniqueName, keyString) + Else + kv.AddElement(pkColumn.InternalName, keyString) + End If + index = index + 1 + Next pkColumn + End If + + Else + ' If the key is not composite, then get the key value. + kv = PersonalIdTable.Instance.TableDefinition.PrimaryKey.ParseValue(CType(key, String)) + End If + End If + Return kv + End Function + + + ''' + ''' This method takes a record and a Column and returns an evaluated value of DFKA formula. + ''' + Public Shared Function GetDFKA(ByVal rec As BaseRecord, ByVal col As BaseColumn) As String + Dim fkColumn As ForeignKey = PersonalIdTable.Instance.TableDefinition.GetExpandableNonCompositeForeignKey(col) + If fkColumn Is Nothing Then + Return Nothing + End If + Dim _DFKA As String = fkColumn.PrimaryKeyDisplayColumns + If (_DFKA.Trim().StartsWith("=")) Then + ' if the formula is in the format of "= ., then pull out the data from the rec object instead of doing formula evaluation + Dim tableCodeName As String = fkColumn.PrimaryKeyTableDefinition.TableCodeName + Dim column As String = _DFKA.Trim("="c).Trim() + If column.StartsWith(tableCodeName & ".", StringComparison.InvariantCultureIgnoreCase) Then + column = column.Substring(tableCodeName.Length + 1) + End If + + For Each c As BaseColumn In fkColumn.PrimaryKeyTableDefinition.Columns + If column = c.CodeName Then + Return rec.Format(c) + End If + Next + Dim tableName As String = fkColumn.PrimaryKeyTableDefinition.TableCodeName + Return EvaluateFormula(_DFKA, rec, Nothing, tableName) + Else + Return Nothing + End If + End Function + + ''' + ''' This method takes a keyValue and a Column and returns an evaluated value of DFKA formula. + ''' + Public Shared Function GetDFKA(ByVal keyValue As String, ByVal col As BaseColumn, ByVal formatPattern as String) As String + If keyValue Is Nothing Then + Return Nothing + End If + Dim fkColumn As ForeignKey = PersonalIdTable.Instance.TableDefinition.GetExpandableNonCompositeForeignKey(col) + If fkColumn Is Nothing Then + Return Nothing + End If + Dim _DFKA As String = fkColumn.PrimaryKeyDisplayColumns + If (_DFKA.Trim().StartsWith("=")) Then + Dim tableName As String = fkColumn.PrimaryKeyTableDefinition.TableCodeName + Dim t As PrimaryKeyTable = CType(DatabaseObjects.GetTableObject(tableName), PrimaryKeyTable) + Dim rec As BaseRecord = Nothing + If Not t Is Nothing Then + Try + rec = CType(t.GetRecordData(keyValue, False), BaseRecord) + Catch + rec = Nothing + End Try + End If + If rec Is Nothing Then + Return "" + End If + + ' if the formula is in the format of "= ., then pull out the data from the rec object instead of doing formula evaluation + Dim tableCodeName As String = fkColumn.PrimaryKeyTableDefinition.TableCodeName + Dim column As String = _DFKA.Trim("="c).Trim() + If column.StartsWith(tableCodeName & ".", StringComparison.InvariantCultureIgnoreCase) Then + column = column.Substring(tableCodeName.Length + 1) + End If + + For Each c As BaseColumn In fkColumn.PrimaryKeyTableDefinition.Columns + If column = c.CodeName Then + Return rec.Format(c) + End If + Next + Return EvaluateFormula(_DFKA, rec, Nothing, tableName) + Else + Return Nothing + End If + End Function + + ''' + ''' Evaluates the formula + ''' + Public Shared Function EvaluateFormula(ByVal formula As String, Optional ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord = Nothing, Optional ByVal format As String = Nothing, Optional ByVal name As String = "") As String + Dim e As BaseFormulaEvaluator = New BaseFormulaEvaluator() + If Not dataSourceForEvaluate Is Nothing Then + e.Evaluator.Variables.Add(name, dataSourceForEvaluate) + end if + e.DataSource = dataSourceForEvaluate + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + If Not String.IsNullOrEmpty(format) Then + Return BaseFormulaUtils.Format(resultObj, format) + Else + Return resultObj.ToString() + End If + End Function + + +#End Region + +End Class +End Namespace diff --git a/App_Code/Business Layer/BasePersonalInsigniaRecord.vb b/App_Code/Business Layer/BasePersonalInsigniaRecord.vb new file mode 100644 index 0000000..78a3027 --- /dev/null +++ b/App_Code/Business Layer/BasePersonalInsigniaRecord.vb @@ -0,0 +1,733 @@ +' This class is "generated" and will be overwritten. +' Your customizations should be made in PersonalInsigniaRecord.vb + +Imports System.Data.SqlTypes +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + +Namespace Persons.Business + +''' +''' The generated superclass for the class. +''' +''' +''' This class is not intended to be instantiated directly. To obtain an instance of this class, +''' use the methods of the class. +''' +''' +''' + + Public Class BasePersonalInsigniaRecord + Inherits PrimaryKeyRecord + + + Public Shared Shadows ReadOnly TableUtils As PersonalInsigniaTable = PersonalInsigniaTable.Instance + + ' Constructors + + Protected Sub New() + MyBase.New(TableUtils) + End Sub + + Protected Sub New(ByVal record As PrimaryKeyRecord) + MyBase.New(record, TableUtils) + End Sub + + 'Evaluates Initialize when->Inserting record formulas specified at the data access layer + Public Overridable Sub PersonalInsigniaRecord_InsertingRecord(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles Me.InsertingRecord + 'Apply Initialize->Inserting record formula only if validation is successful. + Dim PersonalInsigniaRec As PersonalInsigniaRecord = CType(sender,PersonalInsigniaRecord) + Validate_Inserting() + If Not PersonalInsigniaRec Is Nothing AndAlso Not PersonalInsigniaRec.IsReadOnly Then + End If + End Sub + + 'Evaluates Initialize when->Updating record formulas specified at the data access layer + Public Overridable Sub PersonalInsigniaRecord_UpdatingRecord(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles Me.UpdatingRecord + 'Apply Initialize->Updating record formula only if validation is successful. + Dim PersonalInsigniaRec As PersonalInsigniaRecord = CType(sender,PersonalInsigniaRecord) + Validate_Updating() + If Not PersonalInsigniaRec Is Nothing AndAlso Not PersonalInsigniaRec.IsReadOnly Then + End If + End Sub + + 'Evaluates Initialize when->Reading record formulas specified at the data access layer + Public Overridable Sub PersonalInsigniaRecord_ReadRecord(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.ReadRecord + 'Apply Initialize->Reading record formula only if validation is successful. + Dim PersonalInsigniaRec As PersonalInsigniaRecord = CType(sender,PersonalInsigniaRecord) + If Not PersonalInsigniaRec Is Nothing AndAlso Not PersonalInsigniaRec.IsReadOnly Then + End If + End Sub + + 'Evaluates Validate when->Inserting formulas specified at the data access layer + Public Overridable Sub Validate_Inserting () + Dim fullValidationMessage As String = "" + Dim validationMessage As String = "" + + dim formula as String = "" + + + If validationMessage <> "" AndAlso validationMessage.ToLower() <> "true" Then + fullValidationMessage &= validationMessage & vbCrLf + End If + + If fullValidationMessage <> "" Then + Throw New Exception(fullValidationMessage) + End If + End Sub + + 'Evaluates Validate when->Updating formulas specified at the data access layer + Public Overridable Sub Validate_Updating () + Dim fullValidationMessage As String = "" + Dim validationMessage As String = "" + + dim formula as String = "" + + + If validationMessage <> "" AndAlso validationMessage.ToLower() <> "true" Then + fullValidationMessage &= validationMessage & vbCrLf + End If + + If fullValidationMessage <> "" Then + Throw New Exception(fullValidationMessage) + End If + End Sub + + Public Overridable Function EvaluateFormula(ByVal formula As String, Optional ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord = Nothing, Optional ByVal format As String = Nothing) As String + + Dim e As Data.BaseFormulaEvaluator = New Data.BaseFormulaEvaluator() + + ' All variables referred to in the formula are expected to be + ' properties of the DataSource. For example, referring to + ' UnitPrice as a variable will refer to DataSource.UnitPrice + e.DataSource = dataSourceForEvaluate + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + Return resultObj.ToString() + End Function + + + + + + + +#Region "Convenience methods to get/set values of fields" + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalInsignia_.id field. + ''' + Public Function Getid0Value() As ColumnValue + Return Me.GetValue(TableUtils.id0Column) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalInsignia_.id field. + ''' + Public Function Getid0FieldValue() As Int32 + Return CType(Me.GetValue(TableUtils.id0Column).ToInt32(), Int32) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalInsignia_.PersonalId field. + ''' + Public Function GetPersonalIdValue() As ColumnValue + Return Me.GetValue(TableUtils.PersonalIdColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalInsignia_.PersonalId field. + ''' + Public Function GetPersonalIdFieldValue() As String + Return CType(Me.GetValue(TableUtils.PersonalIdColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalInsignia_.PersonalId field. + ''' + Public Sub SetPersonalIdFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.PersonalIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalInsignia_.PersonalId field. + ''' + Public Sub SetPersonalIdFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.PersonalIdColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalInsignia_.InsigniaDate field. + ''' + Public Function GetInsigniaDateValue() As ColumnValue + Return Me.GetValue(TableUtils.InsigniaDateColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalInsignia_.InsigniaDate field. + ''' + Public Function GetInsigniaDateFieldValue() As DateTime + Return CType(Me.GetValue(TableUtils.InsigniaDateColumn).ToDateTime(), DateTime) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalInsignia_.InsigniaDate field. + ''' + Public Sub SetInsigniaDateFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.InsigniaDateColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalInsignia_.InsigniaDate field. + ''' + Public Sub SetInsigniaDateFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.InsigniaDateColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalInsignia_.InsigniaDate field. + ''' + Public Sub SetInsigniaDateFieldValue(ByVal val As DateTime) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.InsigniaDateColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalInsignia_.InsigniaId field. + ''' + Public Function GetInsigniaIdValue() As ColumnValue + Return Me.GetValue(TableUtils.InsigniaIdColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalInsignia_.InsigniaId field. + ''' + Public Function GetInsigniaIdFieldValue() As Int16 + Return CType(Me.GetValue(TableUtils.InsigniaIdColumn).ToInt16(), Int16) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalInsignia_.InsigniaId field. + ''' + Public Sub SetInsigniaIdFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.InsigniaIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalInsignia_.InsigniaId field. + ''' + Public Sub SetInsigniaIdFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.InsigniaIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalInsignia_.InsigniaId field. + ''' + Public Sub SetInsigniaIdFieldValue(ByVal val As Double) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.InsigniaIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalInsignia_.InsigniaId field. + ''' + Public Sub SetInsigniaIdFieldValue(ByVal val As Decimal) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.InsigniaIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalInsignia_.InsigniaId field. + ''' + Public Sub SetInsigniaIdFieldValue(ByVal val As Int64) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.InsigniaIdColumn) + End Sub + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalInsignia_.GazetteNO field. + ''' + Public Function GetGazetteNOValue() As ColumnValue + Return Me.GetValue(TableUtils.GazetteNOColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalInsignia_.GazetteNO field. + ''' + Public Function GetGazetteNOFieldValue() As String + Return CType(Me.GetValue(TableUtils.GazetteNOColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalInsignia_.GazetteNO field. + ''' + Public Sub SetGazetteNOFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.GazetteNOColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalInsignia_.GazetteNO field. + ''' + Public Sub SetGazetteNOFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.GazetteNOColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalInsignia_.GazetteSection field. + ''' + Public Function GetGazetteSectionValue() As ColumnValue + Return Me.GetValue(TableUtils.GazetteSectionColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalInsignia_.GazetteSection field. + ''' + Public Function GetGazetteSectionFieldValue() As String + Return CType(Me.GetValue(TableUtils.GazetteSectionColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalInsignia_.GazetteSection field. + ''' + Public Sub SetGazetteSectionFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.GazetteSectionColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalInsignia_.GazetteSection field. + ''' + Public Sub SetGazetteSectionFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.GazetteSectionColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalInsignia_.GazettePage field. + ''' + Public Function GetGazettePageValue() As ColumnValue + Return Me.GetValue(TableUtils.GazettePageColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalInsignia_.GazettePage field. + ''' + Public Function GetGazettePageFieldValue() As String + Return CType(Me.GetValue(TableUtils.GazettePageColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalInsignia_.GazettePage field. + ''' + Public Sub SetGazettePageFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.GazettePageColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalInsignia_.GazettePage field. + ''' + Public Sub SetGazettePageFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.GazettePageColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalInsignia_.GazetteDate field. + ''' + Public Function GetGazetteDateValue() As ColumnValue + Return Me.GetValue(TableUtils.GazetteDateColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalInsignia_.GazetteDate field. + ''' + Public Function GetGazetteDateFieldValue() As DateTime + Return CType(Me.GetValue(TableUtils.GazetteDateColumn).ToDateTime(), DateTime) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalInsignia_.GazetteDate field. + ''' + Public Sub SetGazetteDateFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.GazetteDateColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalInsignia_.GazetteDate field. + ''' + Public Sub SetGazetteDateFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.GazetteDateColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalInsignia_.GazetteDate field. + ''' + Public Sub SetGazetteDateFieldValue(ByVal val As DateTime) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.GazetteDateColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalInsignia_.InsigniaReturn field. + ''' + Public Function GetInsigniaReturnValue() As ColumnValue + Return Me.GetValue(TableUtils.InsigniaReturnColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalInsignia_.InsigniaReturn field. + ''' + Public Function GetInsigniaReturnFieldValue() As String + Return CType(Me.GetValue(TableUtils.InsigniaReturnColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalInsignia_.InsigniaReturn field. + ''' + Public Sub SetInsigniaReturnFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.InsigniaReturnColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalInsignia_.InsigniaReturn field. + ''' + Public Sub SetInsigniaReturnFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.InsigniaReturnColumn) + End Sub + + + +#End Region + +#Region "Convenience methods to get field names" + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonalInsignia_.id field. + ''' + Public Property id0() As Int32 + Get + Return CType(Me.GetValue(TableUtils.id0Column).ToInt32(), Int32) + End Get + Set (ByVal val As Int32) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.id0Column) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property id0Specified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.id0Column) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property id0Default() As String + Get + Return TableUtils.id0Column.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonalInsignia_.PersonalId field. + ''' + Public Property PersonalId() As String + Get + Return CType(Me.GetValue(TableUtils.PersonalIdColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.PersonalIdColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property PersonalIdSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.PersonalIdColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property PersonalIdDefault() As String + Get + Return TableUtils.PersonalIdColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonalInsignia_.InsigniaDate field. + ''' + Public Property InsigniaDate() As DateTime + Get + Return CType(Me.GetValue(TableUtils.InsigniaDateColumn).ToDateTime(), DateTime) + End Get + Set (ByVal val As DateTime) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.InsigniaDateColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property InsigniaDateSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.InsigniaDateColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property InsigniaDateDefault() As String + Get + Return TableUtils.InsigniaDateColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonalInsignia_.InsigniaId field. + ''' + Public Property InsigniaId() As Int16 + Get + Return CType(Me.GetValue(TableUtils.InsigniaIdColumn).ToInt16(), Int16) + End Get + Set (ByVal val As Int16) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.InsigniaIdColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property InsigniaIdSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.InsigniaIdColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property InsigniaIdDefault() As String + Get + Return TableUtils.InsigniaIdColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonalInsignia_.GazetteNO field. + ''' + Public Property GazetteNO() As String + Get + Return CType(Me.GetValue(TableUtils.GazetteNOColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.GazetteNOColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property GazetteNOSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.GazetteNOColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property GazetteNODefault() As String + Get + Return TableUtils.GazetteNOColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonalInsignia_.GazetteSection field. + ''' + Public Property GazetteSection() As String + Get + Return CType(Me.GetValue(TableUtils.GazetteSectionColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.GazetteSectionColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property GazetteSectionSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.GazetteSectionColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property GazetteSectionDefault() As String + Get + Return TableUtils.GazetteSectionColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonalInsignia_.GazettePage field. + ''' + Public Property GazettePage() As String + Get + Return CType(Me.GetValue(TableUtils.GazettePageColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.GazettePageColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property GazettePageSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.GazettePageColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property GazettePageDefault() As String + Get + Return TableUtils.GazettePageColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonalInsignia_.GazetteDate field. + ''' + Public Property GazetteDate() As DateTime + Get + Return CType(Me.GetValue(TableUtils.GazetteDateColumn).ToDateTime(), DateTime) + End Get + Set (ByVal val As DateTime) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.GazetteDateColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property GazetteDateSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.GazetteDateColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property GazetteDateDefault() As String + Get + Return TableUtils.GazetteDateColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonalInsignia_.InsigniaReturn field. + ''' + Public Property InsigniaReturn() As String + Get + Return CType(Me.GetValue(TableUtils.InsigniaReturnColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.InsigniaReturnColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property InsigniaReturnSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.InsigniaReturnColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property InsigniaReturnDefault() As String + Get + Return TableUtils.InsigniaReturnColumn.DefaultValue + End Get + End Property + + + +#End Region + +End Class +End Namespace diff --git a/App_Code/Business Layer/BasePersonalInsigniaTable.vb b/App_Code/Business Layer/BasePersonalInsigniaTable.vb new file mode 100644 index 0000000..c42fb1f --- /dev/null +++ b/App_Code/Business Layer/BasePersonalInsigniaTable.vb @@ -0,0 +1,930 @@ +' This class is "generated" and will be overwritten. +' Your customizations should be made in PersonalInsigniaRecord.vb + +Imports System.Data.SqlTypes +Imports System.Data +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider +Imports Persons.Data + +Namespace Persons.Business + +''' +''' The generated superclass for the class. +''' Provides access to the schema information and record data of a database table or view named PersonalInsignia. +''' +''' +''' The connection details (name, location, etc.) of the database and table (or view) accessed by this class +''' are resolved at runtime based on the connection string in the application's Web.Config file. +''' +''' This class is not intended to be instantiated directly. To obtain an instance of this class, use +''' PersonalInsigniaTable.Instance. +''' +''' +''' + + Public Class BasePersonalInsigniaTable + Inherits PrimaryKeyTable + + + Private ReadOnly TableDefinitionString As String = PersonalInsigniaDefinition.GetXMLString() + + + + + + + + Protected Sub New() + MyBase.New() + Me.Initialize() + End Sub + + Protected Overridable Sub Initialize() + Dim def As New XmlTableDefinition(TableDefinitionString) + Me.TableDefinition = New TableDefinition() + Me.TableDefinition.TableClassName = System.Reflection.Assembly.CreateQualifiedName("App_Code", "Persons.Business.PersonalInsigniaTable") + def.InitializeTableDefinition(Me.TableDefinition) + Me.ConnectionName = def.GetConnectionName() + Me.RecordClassName = System.Reflection.Assembly.CreateQualifiedName("App_Code", "Persons.Business.PersonalInsigniaRecord") + Me.ApplicationName = "App_Code" + Me.DataAdapter = New PersonalInsigniaSqlTable() + Directcast(Me.DataAdapter, PersonalInsigniaSqlTable).ConnectionName = Me.ConnectionName + + Me.TableDefinition.AdapterMetaData = Me.DataAdapter.AdapterMetaData + id0Column.CodeName = "id0" + PersonalIdColumn.CodeName = "PersonalId" + InsigniaDateColumn.CodeName = "InsigniaDate" + InsigniaIdColumn.CodeName = "InsigniaId" + GazetteNOColumn.CodeName = "GazetteNO" + GazetteSectionColumn.CodeName = "GazetteSection" + GazettePageColumn.CodeName = "GazettePage" + GazetteDateColumn.CodeName = "GazetteDate" + InsigniaReturnColumn.CodeName = "InsigniaReturn" + + End Sub + +#Region "Overriden methods" + + +#End Region + +#Region "Properties for columns" + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalInsignia_.id column object. + ''' + Public ReadOnly Property id0Column() As BaseClasses.Data.NumberColumn + Get + Return CType(Me.TableDefinition.ColumnList(0), BaseClasses.Data.NumberColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalInsignia_.id column object. + ''' + Public Shared ReadOnly Property id0() As BaseClasses.Data.NumberColumn + Get + Return PersonalInsigniaTable.Instance.id0Column + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonalInsignia_.PersonalId column object. + ''' + Public ReadOnly Property PersonalIdColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(1), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalInsignia_.PersonalId column object. + ''' + Public Shared ReadOnly Property PersonalId() As BaseClasses.Data.StringColumn + Get + Return PersonalInsigniaTable.Instance.PersonalIdColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonalInsignia_.InsigniaDate column object. + ''' + Public ReadOnly Property InsigniaDateColumn() As BaseClasses.Data.DateColumn + Get + Return CType(Me.TableDefinition.ColumnList(2), BaseClasses.Data.DateColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalInsignia_.InsigniaDate column object. + ''' + Public Shared ReadOnly Property InsigniaDate() As BaseClasses.Data.DateColumn + Get + Return PersonalInsigniaTable.Instance.InsigniaDateColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonalInsignia_.InsigniaId column object. + ''' + Public ReadOnly Property InsigniaIdColumn() As BaseClasses.Data.NumberColumn + Get + Return CType(Me.TableDefinition.ColumnList(3), BaseClasses.Data.NumberColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalInsignia_.InsigniaId column object. + ''' + Public Shared ReadOnly Property InsigniaId() As BaseClasses.Data.NumberColumn + Get + Return PersonalInsigniaTable.Instance.InsigniaIdColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonalInsignia_.GazetteNO column object. + ''' + Public ReadOnly Property GazetteNOColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(4), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalInsignia_.GazetteNO column object. + ''' + Public Shared ReadOnly Property GazetteNO() As BaseClasses.Data.StringColumn + Get + Return PersonalInsigniaTable.Instance.GazetteNOColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonalInsignia_.GazetteSection column object. + ''' + Public ReadOnly Property GazetteSectionColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(5), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalInsignia_.GazetteSection column object. + ''' + Public Shared ReadOnly Property GazetteSection() As BaseClasses.Data.StringColumn + Get + Return PersonalInsigniaTable.Instance.GazetteSectionColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonalInsignia_.GazettePage column object. + ''' + Public ReadOnly Property GazettePageColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(6), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalInsignia_.GazettePage column object. + ''' + Public Shared ReadOnly Property GazettePage() As BaseClasses.Data.StringColumn + Get + Return PersonalInsigniaTable.Instance.GazettePageColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonalInsignia_.GazetteDate column object. + ''' + Public ReadOnly Property GazetteDateColumn() As BaseClasses.Data.DateColumn + Get + Return CType(Me.TableDefinition.ColumnList(7), BaseClasses.Data.DateColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalInsignia_.GazetteDate column object. + ''' + Public Shared ReadOnly Property GazetteDate() As BaseClasses.Data.DateColumn + Get + Return PersonalInsigniaTable.Instance.GazetteDateColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonalInsignia_.InsigniaReturn column object. + ''' + Public ReadOnly Property InsigniaReturnColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(8), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalInsignia_.InsigniaReturn column object. + ''' + Public Shared ReadOnly Property InsigniaReturn() As BaseClasses.Data.StringColumn + Get + Return PersonalInsigniaTable.Instance.InsigniaReturnColumn + End Get + End Property + + +#End Region + + +#Region "Shared helper methods" + + ''' + ''' This is a shared function that can be used to get an array of PersonalInsigniaRecord records using a where clause. + ''' + Public Shared Function GetRecords(ByVal where As String) As PersonalInsigniaRecord() + + Return GetRecords(where, Nothing, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) + End Function + + ''' + ''' This is a shared function that can be used to get an array of PersonalInsigniaRecord records using a where clause. + ''' + Public Shared Function GetRecords(ByVal join As BaseFilter, ByVal where As String) As PersonalInsigniaRecord() + + Return GetRecords(join, where, Nothing, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) + End Function + + ''' + ''' This is a shared function that can be used to get an array of PersonalInsigniaRecord records using a where and order by clause. + ''' + Public Shared Function GetRecords( _ + ByVal where As String, _ + ByVal orderBy As OrderBy) As PersonalInsigniaRecord() + + Return GetRecords(where, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) + End Function + + ''' + ''' This is a shared function that can be used to get an array of PersonalInsigniaRecord records using a where and order by clause. + ''' + Public Shared Function GetRecords( _ + ByVal join As BaseFilter, _ + ByVal where As String, _ + ByVal orderBy As OrderBy) As PersonalInsigniaRecord() + + Return GetRecords(join, where, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) + End Function + + ''' + ''' This is a shared function that can be used to get an array of PersonalInsigniaRecord records using a where and order by clause clause with pagination. + ''' + Public Shared Function GetRecords( _ + ByVal where As String, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As PersonalInsigniaRecord() + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + Dim join As BaseClasses.Data.BaseFilter = Nothing + Dim recList As ArrayList = PersonalInsigniaTable.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, pageIndex, pageSize) + + Return CType(recList.ToArray(GetType(Persons.Business.PersonalInsigniaRecord)), PersonalInsigniaRecord()) + End Function + + ''' + ''' This is a shared function that can be used to get an array of PersonalInsigniaRecord records using a where and order by clause clause with pagination. + ''' + Public Shared Function GetRecords( _ + ByVal join As BaseFilter, _ + ByVal where As String, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As PersonalInsigniaRecord() + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Dim recList As ArrayList = PersonalInsigniaTable.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, pageIndex, pageSize) + + Return CType(recList.ToArray(GetType(Persons.Business.PersonalInsigniaRecord)), PersonalInsigniaRecord()) + End Function + + Public Shared Function GetRecords( _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As PersonalInsigniaRecord() + Dim join As BaseClasses.Data.BaseFilter = Nothing + Dim recList As ArrayList = PersonalInsigniaTable.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + Return CType(recList.ToArray(GetType(Persons.Business.PersonalInsigniaRecord)), PersonalInsigniaRecord()) + End Function + + Public Shared Function GetRecords( _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As PersonalInsigniaRecord() + + Dim recList As ArrayList = PersonalInsigniaTable.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + Return CType(recList.ToArray(GetType(Persons.Business.PersonalInsigniaRecord)), PersonalInsigniaRecord()) + End Function + + Public Shared Function GetRecords( _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer, _ + ByRef totalRecords As Integer) As PersonalInsigniaRecord() + Dim join As BaseClasses.Data.BaseFilter = Nothing + Dim recList As ArrayList = PersonalInsigniaTable.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize, totalRecords) + + Return CType(recList.ToArray(GetType(Persons.Business.PersonalInsigniaRecord)), PersonalInsigniaRecord()) + End Function + + Public Shared Function GetRecords( _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer, _ + ByRef totalRecords As Integer) As PersonalInsigniaRecord() + + Dim recList As ArrayList = PersonalInsigniaTable.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize, totalRecords) + + Return CType(recList.ToArray(GetType(Persons.Business.PersonalInsigniaRecord)), PersonalInsigniaRecord()) + End Function + + ''' + ''' This is a shared function that can be used to get total number of records that will be returned using the where clause. + ''' + Public Shared Function GetRecordCount(ByVal where As String) As Integer + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Return CInt(PersonalInsigniaTable.Instance.GetRecordListCount(Nothing, whereFilter, Nothing, Nothing)) + End Function + +''' + ''' This is a shared function that can be used to get total number of records that will be returned using the where clause. + ''' + Public Shared Function GetRecordCount(ByVal join As BaseFilter, ByVal where As String) As Integer + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Return CInt(PersonalInsigniaTable.Instance.GetRecordListCount(join, whereFilter, Nothing, Nothing)) + End Function + + Public Shared Function GetRecordCount(ByVal where As WhereClause) As Integer + Return CInt(PersonalInsigniaTable.Instance.GetRecordListCount(Nothing, where.GetFilter(), Nothing, Nothing)) + End Function + + Public Shared Function GetRecordCount(ByVal join As BaseFilter, ByVal where As WhereClause) As Integer + Return CInt(PersonalInsigniaTable.Instance.GetRecordListCount(join, where.GetFilter(), Nothing, Nothing)) + End Function + + ''' + ''' This is a shared function that can be used to get a PersonalInsigniaRecord record using a where clause. + ''' + Public Shared Function GetRecord(ByVal where As String) As PersonalInsigniaRecord + Dim orderBy As OrderBy = Nothing + Return GetRecord(where, orderBy) + End Function + + ''' + ''' This is a shared function that can be used to get a PersonalInsigniaRecord record using a where clause. + ''' + Public Shared Function GetRecord(ByVal join As BaseFilter, ByVal where As String) As PersonalInsigniaRecord + Dim orderBy As OrderBy = Nothing + Return GetRecord(join, where, orderBy) + End Function + + ''' + ''' This is a shared function that can be used to get a PersonalInsigniaRecord record using a where and order by clause. + ''' + Public Shared Function GetRecord( _ + ByVal where As String, _ + ByVal orderBy As OrderBy) As PersonalInsigniaRecord + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + Dim join As BaseClasses.Data.BaseFilter = Nothing + Dim recList As ArrayList = PersonalInsigniaTable.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MIN_BATCH_SIZE) + + Dim rec As PersonalInsigniaRecord = Nothing + If recList.Count > 0 Then + rec = CType(recList(0), PersonalInsigniaRecord) + End If + + Return rec + End Function + + ''' + ''' This is a shared function that can be used to get a PersonalInsigniaRecord record using a where and order by clause. + ''' + Public Shared Function GetRecord( _ + ByVal join As BaseFilter, _ + ByVal where As String, _ + ByVal orderBy As OrderBy) As PersonalInsigniaRecord + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Dim recList As ArrayList = PersonalInsigniaTable.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MIN_BATCH_SIZE) + + Dim rec As PersonalInsigniaRecord = Nothing + If recList.Count > 0 Then + rec = CType(recList(0), PersonalInsigniaRecord) + End If + + Return rec + End Function + + + Public Shared Function GetValues( _ + ByVal col As BaseColumn, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal maxItems As Integer) As String() + + ' Create the filter list. + Dim retCol As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, True) + retCol.AddColumn(col) + + Return PersonalInsigniaTable.Instance.GetColumnValues(retCol, Nothing, where.GetFilter(), Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, maxItems) + + End Function + + Public Shared Function GetValues( _ + ByVal col As BaseColumn, _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal maxItems As Integer) As String() + + ' Create the filter list. + Dim retCol As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, True) + retCol.AddColumn(col) + + Return PersonalInsigniaTable.Instance.GetColumnValues(retCol, join, where.GetFilter(), Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, maxItems) + + End Function + + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where clause. + ''' + Public Shared Function GetDataTable(ByVal where As String) As System.Data.DataTable + + Dim recs() As PersonalInsigniaRecord = GetRecords(where) + Return PersonalInsigniaTable.Instance.CreateDataTable(recs, Nothing) + End Function + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where clause. + ''' + Public Shared Function GetDataTable(ByVal join As BaseFilter, ByVal where As String) As System.Data.DataTable + + Dim recs() As PersonalInsigniaRecord = GetRecords(join, where) + Return PersonalInsigniaTable.Instance.CreateDataTable(recs, Nothing) + End Function + + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause. + ''' + Public Shared Function GetDataTable(ByVal where As String, ByVal orderBy As OrderBy) As System.Data.DataTable + + Dim recs() As PersonalInsigniaRecord = GetRecords(where, orderBy) + Return PersonalInsigniaTable.Instance.CreateDataTable(recs, Nothing) + End Function + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause. + ''' + Public Shared Function GetDataTable(ByVal join As BaseFilter, ByVal where As String, ByVal orderBy As OrderBy) As System.Data.DataTable + + Dim recs() As PersonalInsigniaRecord = GetRecords(join, where, orderBy) + Return PersonalInsigniaTable.Instance.CreateDataTable(recs, Nothing) + End Function + + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause with pagination. + ''' + Public Shared Function GetDataTable( _ + ByVal where As String, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As System.Data.DataTable + + Dim recs() As PersonalInsigniaRecord = GetRecords(where, orderBy, pageIndex, pageSize) + Return PersonalInsigniaTable.Instance.CreateDataTable(recs, Nothing) + End Function + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause with pagination. + ''' + Public Shared Function GetDataTable( _ + ByVal join As BaseFilter, _ + ByVal where As String, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As System.Data.DataTable + + Dim recs() As PersonalInsigniaRecord = GetRecords(join, where, orderBy, pageIndex, pageSize) + Return PersonalInsigniaTable.Instance.CreateDataTable(recs, Nothing) + End Function + + + ''' + ''' This is a shared function that can be used to delete records using a where clause. + ''' + Public Shared Sub DeleteRecords(ByVal where As String) + If where = Nothing OrElse where.Trim() = "" Then + Return + End If + + Dim whereFilter As SqlFilter = New SqlFilter(where) + PersonalInsigniaTable.Instance.DeleteRecordList(whereFilter) + End Sub + + ''' + ''' This is a shared function that can be used to export records using a where clause. + ''' + Public Shared Function Export(ByVal where As String) As String + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Return PersonalInsigniaTable.Instance.ExportRecordData(whereFilter) + End Function + + Public Shared Function Export(ByVal where As WhereClause) As String + Dim whereFilter As BaseFilter = Nothing + If Not where Is Nothing Then + whereFilter = where.GetFilter() + End If + + Return PersonalInsigniaTable.Instance.ExportRecordData(whereFilter) + End Function + + Public Shared Function GetSum( _ + ByVal col As BaseColumn, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) _ + As String + + Dim colSel As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, False) + colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Sum) + + Return PersonalInsigniaTable.Instance.GetColumnStatistics(colSel, Nothing, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + End Function + + Public Shared Function GetSum( _ + ByVal col As BaseColumn, _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) _ + As String + + Dim colSel As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, False) + colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Sum) + + Return PersonalInsigniaTable.Instance.GetColumnStatistics(colSel, join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + End Function + + + Public Shared Function GetCount( _ + ByVal col As BaseColumn, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) _ + As String + + Dim colSel As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, False) + colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Count) + + Return PersonalInsigniaTable.Instance.GetColumnStatistics(colSel, Nothing, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + End Function + + Public Shared Function GetCount( _ + ByVal col As BaseColumn, _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) _ + As String + + Dim colSel As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, False) + colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Count) + + Return PersonalInsigniaTable.Instance.GetColumnStatistics(colSel, join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + End Function + + ''' + ''' This method returns the columns in the table. + ''' + Public Shared Function GetColumns() As BaseColumn() + Return PersonalInsigniaTable.Instance.TableDefinition.Columns + End Function + + ''' + ''' This method returns the columnlist in the table. + ''' + Public Shared Function GetColumnList() As ColumnList + Return PersonalInsigniaTable.Instance.TableDefinition.ColumnList + End Function + + + ''' + ''' This method creates a new record and returns it to be edited. + ''' + Public Shared Function CreateNewRecord() As IRecord + Return PersonalInsigniaTable.Instance.CreateRecord() + End Function + + ''' + ''' This method creates a new record and returns it to be edited. + ''' + ''' ID of the new record. + Public Shared Function CreateNewRecord(ByVal tempId As String) As IRecord + Return PersonalInsigniaTable.Instance.CreateRecord(tempId) + End Function + + ''' + ''' This method checks if column is editable. + ''' + ''' Name of the column to check. + Public Shared Function isReadOnlyColumn(ByVal columnName As String) As Boolean + Dim column As BaseColumn = GetColumn(columnName) + If (Not IsNothing(column)) Then + Return column.IsValuesReadOnly + Else + Return True + End If + End Function + + ''' + ''' This method gets the specified column. + ''' + ''' Unique name of the column to fetch. + Public Shared Function GetColumn(ByVal uniqueColumnName As String) As BaseColumn + Dim column As BaseColumn = PersonalInsigniaTable.Instance.TableDefinition.ColumnList.GetByUniqueName(uniqueColumnName) + Return column + End Function + + ' Convenience method for getting a record using a string-based record identifier + Public Shared Function GetRecord(ByVal id As String, ByVal bMutable As Boolean) As PersonalInsigniaRecord + Return CType(PersonalInsigniaTable.Instance.GetRecordData(id, bMutable), PersonalInsigniaRecord) + End Function + + ' Convenience method for getting a record using a KeyValue record identifier + Public Shared Function GetRecord(ByVal id As KeyValue, ByVal bMutable As Boolean) As PersonalInsigniaRecord + Return CType(PersonalInsigniaTable.Instance.GetRecordData(id, bMutable), PersonalInsigniaRecord) + End Function + + ' Convenience method for creating a record + Public Overloads Function NewRecord( _ + ByVal PersonalIdValue As String, _ + ByVal InsigniaDateValue As String, _ + ByVal InsigniaIdValue As String, _ + ByVal GazetteNOValue As String, _ + ByVal GazetteSectionValue As String, _ + ByVal GazettePageValue As String, _ + ByVal GazetteDateValue As String, _ + ByVal InsigniaReturnValue As String _ + ) As KeyValue + Dim rec As IPrimaryKeyRecord = CType(Me.CreateRecord(), IPrimaryKeyRecord) + rec.SetString(PersonalIdValue, PersonalIdColumn) + rec.SetString(InsigniaDateValue, InsigniaDateColumn) + rec.SetString(InsigniaIdValue, InsigniaIdColumn) + rec.SetString(GazetteNOValue, GazetteNOColumn) + rec.SetString(GazetteSectionValue, GazetteSectionColumn) + rec.SetString(GazettePageValue, GazettePageColumn) + rec.SetString(GazetteDateValue, GazetteDateColumn) + rec.SetString(InsigniaReturnValue, InsigniaReturnColumn) + + + rec.Create() 'update the DB so any DB-initialized fields (like autoincrement IDs) can be initialized + + Dim key As KeyValue = rec.GetID() + Return key + End Function + + ''' + ''' This method deletes a specified record + ''' + ''' Keyvalue of the record to be deleted. + Public Shared Sub DeleteRecord(ByVal kv As KeyValue) + PersonalInsigniaTable.Instance.DeleteOneRecord(kv) + End Sub + + ''' + ''' This method checks if record exist in the database using the keyvalue provided. + ''' + ''' Key value of the record. + Public Shared Function DoesRecordExist(ByVal kv As KeyValue) As Boolean + Dim recordExist As Boolean = True + Try + PersonalInsigniaTable.GetRecord(kv, False) + Catch ex As Exception + recordExist = False + End Try + Return recordExist + End Function + + ''' + ''' This method returns all the primary columns in the table. + ''' + Public Shared Function GetPrimaryKeyColumns() As ColumnList + If (Not IsNothing(PersonalInsigniaTable.Instance.TableDefinition.PrimaryKey)) Then + Return PersonalInsigniaTable.Instance.TableDefinition.PrimaryKey.Columns + Else + Return Nothing + End If + End Function + + ''' + ''' This method takes a key and returns a keyvalue. + ''' + ''' key could be array of primary key values in case of composite primary key or a string containing single primary key value in case of non-composite primary key. + Public Shared Function GetKeyValue(ByVal key As Object) As KeyValue + Dim kv As KeyValue = Nothing + + If (Not (IsNothing(PersonalInsigniaTable.Instance.TableDefinition.PrimaryKey))) Then + + Dim isCompositePrimaryKey As Boolean = False + isCompositePrimaryKey = PersonalInsigniaTable.Instance.TableDefinition.PrimaryKey.IsCompositeKey + + If ((isCompositePrimaryKey) AndAlso (key.GetType.IsArray())) Then + + ' If the key is composite, then construct a key value. + kv = New KeyValue + Dim fullKeyString As String = "" + Dim keyArray As Array = CType(key, Array) + If (Not IsNothing(keyArray)) Then + Dim length As Integer = keyArray.Length + Dim pkColumns As ColumnList = PersonalInsigniaTable.Instance.TableDefinition.PrimaryKey.Columns + Dim pkColumn As BaseColumn + Dim index As Integer = 0 + For Each pkColumn In pkColumns + Dim keyString As String = CType(keyArray.GetValue(index), String) + If (PersonalInsigniaTable.Instance.TableDefinition.TableType = BaseClasses.Data.TableDefinition.TableTypes.Virtual) Then + kv.AddElement(pkColumn.UniqueName, keyString) + Else + kv.AddElement(pkColumn.InternalName, keyString) + End If + index = index + 1 + Next pkColumn + End If + + Else + ' If the key is not composite, then get the key value. + kv = PersonalInsigniaTable.Instance.TableDefinition.PrimaryKey.ParseValue(CType(key, String)) + End If + End If + Return kv + End Function + + + ''' + ''' This method takes a record and a Column and returns an evaluated value of DFKA formula. + ''' + Public Shared Function GetDFKA(ByVal rec As BaseRecord, ByVal col As BaseColumn) As String + Dim fkColumn As ForeignKey = PersonalInsigniaTable.Instance.TableDefinition.GetExpandableNonCompositeForeignKey(col) + If fkColumn Is Nothing Then + Return Nothing + End If + Dim _DFKA As String = fkColumn.PrimaryKeyDisplayColumns + If (_DFKA.Trim().StartsWith("=")) Then + ' if the formula is in the format of "= ., then pull out the data from the rec object instead of doing formula evaluation + Dim tableCodeName As String = fkColumn.PrimaryKeyTableDefinition.TableCodeName + Dim column As String = _DFKA.Trim("="c).Trim() + If column.StartsWith(tableCodeName & ".", StringComparison.InvariantCultureIgnoreCase) Then + column = column.Substring(tableCodeName.Length + 1) + End If + + For Each c As BaseColumn In fkColumn.PrimaryKeyTableDefinition.Columns + If column = c.CodeName Then + Return rec.Format(c) + End If + Next + Dim tableName As String = fkColumn.PrimaryKeyTableDefinition.TableCodeName + Return EvaluateFormula(_DFKA, rec, Nothing, tableName) + Else + Return Nothing + End If + End Function + + ''' + ''' This method takes a keyValue and a Column and returns an evaluated value of DFKA formula. + ''' + Public Shared Function GetDFKA(ByVal keyValue As String, ByVal col As BaseColumn, ByVal formatPattern as String) As String + If keyValue Is Nothing Then + Return Nothing + End If + Dim fkColumn As ForeignKey = PersonalInsigniaTable.Instance.TableDefinition.GetExpandableNonCompositeForeignKey(col) + If fkColumn Is Nothing Then + Return Nothing + End If + Dim _DFKA As String = fkColumn.PrimaryKeyDisplayColumns + If (_DFKA.Trim().StartsWith("=")) Then + Dim tableName As String = fkColumn.PrimaryKeyTableDefinition.TableCodeName + Dim t As PrimaryKeyTable = CType(DatabaseObjects.GetTableObject(tableName), PrimaryKeyTable) + Dim rec As BaseRecord = Nothing + If Not t Is Nothing Then + Try + rec = CType(t.GetRecordData(keyValue, False), BaseRecord) + Catch + rec = Nothing + End Try + End If + If rec Is Nothing Then + Return "" + End If + + ' if the formula is in the format of "= ., then pull out the data from the rec object instead of doing formula evaluation + Dim tableCodeName As String = fkColumn.PrimaryKeyTableDefinition.TableCodeName + Dim column As String = _DFKA.Trim("="c).Trim() + If column.StartsWith(tableCodeName & ".", StringComparison.InvariantCultureIgnoreCase) Then + column = column.Substring(tableCodeName.Length + 1) + End If + + For Each c As BaseColumn In fkColumn.PrimaryKeyTableDefinition.Columns + If column = c.CodeName Then + Return rec.Format(c) + End If + Next + Return EvaluateFormula(_DFKA, rec, Nothing, tableName) + Else + Return Nothing + End If + End Function + + ''' + ''' Evaluates the formula + ''' + Public Shared Function EvaluateFormula(ByVal formula As String, Optional ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord = Nothing, Optional ByVal format As String = Nothing, Optional ByVal name As String = "") As String + Dim e As BaseFormulaEvaluator = New BaseFormulaEvaluator() + If Not dataSourceForEvaluate Is Nothing Then + e.Evaluator.Variables.Add(name, dataSourceForEvaluate) + end if + e.DataSource = dataSourceForEvaluate + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + If Not String.IsNullOrEmpty(format) Then + Return BaseFormulaUtils.Format(resultObj, format) + Else + Return resultObj.ToString() + End If + End Function + + +#End Region + +End Class +End Namespace diff --git a/App_Code/Business Layer/BasePersonalLanguageSkillRecord.vb b/App_Code/Business Layer/BasePersonalLanguageSkillRecord.vb new file mode 100644 index 0000000..7403cf7 --- /dev/null +++ b/App_Code/Business Layer/BasePersonalLanguageSkillRecord.vb @@ -0,0 +1,397 @@ +' This class is "generated" and will be overwritten. +' Your customizations should be made in PersonalLanguageSkillRecord.vb + +Imports System.Data.SqlTypes +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + +Namespace Persons.Business + +''' +''' The generated superclass for the class. +''' +''' +''' This class is not intended to be instantiated directly. To obtain an instance of this class, +''' use the methods of the class. +''' +''' +''' + + Public Class BasePersonalLanguageSkillRecord + Inherits PrimaryKeyRecord + + + Public Shared Shadows ReadOnly TableUtils As PersonalLanguageSkillTable = PersonalLanguageSkillTable.Instance + + ' Constructors + + Protected Sub New() + MyBase.New(TableUtils) + End Sub + + Protected Sub New(ByVal record As PrimaryKeyRecord) + MyBase.New(record, TableUtils) + End Sub + + 'Evaluates Initialize when->Inserting record formulas specified at the data access layer + Public Overridable Sub PersonalLanguageSkillRecord_InsertingRecord(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles Me.InsertingRecord + 'Apply Initialize->Inserting record formula only if validation is successful. + Dim PersonalLanguageSkillRec As PersonalLanguageSkillRecord = CType(sender,PersonalLanguageSkillRecord) + Validate_Inserting() + If Not PersonalLanguageSkillRec Is Nothing AndAlso Not PersonalLanguageSkillRec.IsReadOnly Then + End If + End Sub + + 'Evaluates Initialize when->Updating record formulas specified at the data access layer + Public Overridable Sub PersonalLanguageSkillRecord_UpdatingRecord(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles Me.UpdatingRecord + 'Apply Initialize->Updating record formula only if validation is successful. + Dim PersonalLanguageSkillRec As PersonalLanguageSkillRecord = CType(sender,PersonalLanguageSkillRecord) + Validate_Updating() + If Not PersonalLanguageSkillRec Is Nothing AndAlso Not PersonalLanguageSkillRec.IsReadOnly Then + End If + End Sub + + 'Evaluates Initialize when->Reading record formulas specified at the data access layer + Public Overridable Sub PersonalLanguageSkillRecord_ReadRecord(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.ReadRecord + 'Apply Initialize->Reading record formula only if validation is successful. + Dim PersonalLanguageSkillRec As PersonalLanguageSkillRecord = CType(sender,PersonalLanguageSkillRecord) + If Not PersonalLanguageSkillRec Is Nothing AndAlso Not PersonalLanguageSkillRec.IsReadOnly Then + End If + End Sub + + 'Evaluates Validate when->Inserting formulas specified at the data access layer + Public Overridable Sub Validate_Inserting () + Dim fullValidationMessage As String = "" + Dim validationMessage As String = "" + + dim formula as String = "" + + + If validationMessage <> "" AndAlso validationMessage.ToLower() <> "true" Then + fullValidationMessage &= validationMessage & vbCrLf + End If + + If fullValidationMessage <> "" Then + Throw New Exception(fullValidationMessage) + End If + End Sub + + 'Evaluates Validate when->Updating formulas specified at the data access layer + Public Overridable Sub Validate_Updating () + Dim fullValidationMessage As String = "" + Dim validationMessage As String = "" + + dim formula as String = "" + + + If validationMessage <> "" AndAlso validationMessage.ToLower() <> "true" Then + fullValidationMessage &= validationMessage & vbCrLf + End If + + If fullValidationMessage <> "" Then + Throw New Exception(fullValidationMessage) + End If + End Sub + + Public Overridable Function EvaluateFormula(ByVal formula As String, Optional ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord = Nothing, Optional ByVal format As String = Nothing) As String + + Dim e As Data.BaseFormulaEvaluator = New Data.BaseFormulaEvaluator() + + ' All variables referred to in the formula are expected to be + ' properties of the DataSource. For example, referring to + ' UnitPrice as a variable will refer to DataSource.UnitPrice + e.DataSource = dataSourceForEvaluate + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + Return resultObj.ToString() + End Function + + + + + + + +#Region "Convenience methods to get/set values of fields" + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalLanguageSkill_.id field. + ''' + Public Function Getid0Value() As ColumnValue + Return Me.GetValue(TableUtils.id0Column) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalLanguageSkill_.id field. + ''' + Public Function Getid0FieldValue() As Int32 + Return CType(Me.GetValue(TableUtils.id0Column).ToInt32(), Int32) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalLanguageSkill_.PersonalId field. + ''' + Public Function GetPersonalIdValue() As ColumnValue + Return Me.GetValue(TableUtils.PersonalIdColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalLanguageSkill_.PersonalId field. + ''' + Public Function GetPersonalIdFieldValue() As String + Return CType(Me.GetValue(TableUtils.PersonalIdColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalLanguageSkill_.PersonalId field. + ''' + Public Sub SetPersonalIdFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.PersonalIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalLanguageSkill_.PersonalId field. + ''' + Public Sub SetPersonalIdFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.PersonalIdColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalLanguageSkill_.LanguageId field. + ''' + Public Function GetLanguageIdValue() As ColumnValue + Return Me.GetValue(TableUtils.LanguageIdColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalLanguageSkill_.LanguageId field. + ''' + Public Function GetLanguageIdFieldValue() As Int32 + Return CType(Me.GetValue(TableUtils.LanguageIdColumn).ToInt32(), Int32) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalLanguageSkill_.LanguageId field. + ''' + Public Sub SetLanguageIdFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.LanguageIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalLanguageSkill_.LanguageId field. + ''' + Public Sub SetLanguageIdFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.LanguageIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalLanguageSkill_.LanguageId field. + ''' + Public Sub SetLanguageIdFieldValue(ByVal val As Double) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.LanguageIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalLanguageSkill_.LanguageId field. + ''' + Public Sub SetLanguageIdFieldValue(ByVal val As Decimal) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.LanguageIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalLanguageSkill_.LanguageId field. + ''' + Public Sub SetLanguageIdFieldValue(ByVal val As Int64) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.LanguageIdColumn) + End Sub + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalLanguageSkill_.Level field. + ''' + Public Function GetLevelValue() As ColumnValue + Return Me.GetValue(TableUtils.LevelColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalLanguageSkill_.Level field. + ''' + Public Function GetLevelFieldValue() As String + Return CType(Me.GetValue(TableUtils.LevelColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalLanguageSkill_.Level field. + ''' + Public Sub SetLevelFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.LevelColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalLanguageSkill_.Level field. + ''' + Public Sub SetLevelFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.LevelColumn) + End Sub + + + +#End Region + +#Region "Convenience methods to get field names" + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonalLanguageSkill_.id field. + ''' + Public Property id0() As Int32 + Get + Return CType(Me.GetValue(TableUtils.id0Column).ToInt32(), Int32) + End Get + Set (ByVal val As Int32) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.id0Column) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property id0Specified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.id0Column) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property id0Default() As String + Get + Return TableUtils.id0Column.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonalLanguageSkill_.PersonalId field. + ''' + Public Property PersonalId() As String + Get + Return CType(Me.GetValue(TableUtils.PersonalIdColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.PersonalIdColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property PersonalIdSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.PersonalIdColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property PersonalIdDefault() As String + Get + Return TableUtils.PersonalIdColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonalLanguageSkill_.LanguageId field. + ''' + Public Property LanguageId() As Int32 + Get + Return CType(Me.GetValue(TableUtils.LanguageIdColumn).ToInt32(), Int32) + End Get + Set (ByVal val As Int32) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.LanguageIdColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property LanguageIdSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.LanguageIdColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property LanguageIdDefault() As String + Get + Return TableUtils.LanguageIdColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonalLanguageSkill_.Level field. + ''' + Public Property Level() As String + Get + Return CType(Me.GetValue(TableUtils.LevelColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.LevelColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property LevelSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.LevelColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property LevelDefault() As String + Get + Return TableUtils.LevelColumn.DefaultValue + End Get + End Property + + + +#End Region + +End Class +End Namespace diff --git a/App_Code/Business Layer/BasePersonalLanguageSkillTable.vb b/App_Code/Business Layer/BasePersonalLanguageSkillTable.vb new file mode 100644 index 0000000..de404fe --- /dev/null +++ b/App_Code/Business Layer/BasePersonalLanguageSkillTable.vb @@ -0,0 +1,820 @@ +' This class is "generated" and will be overwritten. +' Your customizations should be made in PersonalLanguageSkillRecord.vb + +Imports System.Data.SqlTypes +Imports System.Data +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider +Imports Persons.Data + +Namespace Persons.Business + +''' +''' The generated superclass for the class. +''' Provides access to the schema information and record data of a database table or view named PersonalLanguageSkill. +''' +''' +''' The connection details (name, location, etc.) of the database and table (or view) accessed by this class +''' are resolved at runtime based on the connection string in the application's Web.Config file. +''' +''' This class is not intended to be instantiated directly. To obtain an instance of this class, use +''' PersonalLanguageSkillTable.Instance. +''' +''' +''' + + Public Class BasePersonalLanguageSkillTable + Inherits PrimaryKeyTable + + + Private ReadOnly TableDefinitionString As String = PersonalLanguageSkillDefinition.GetXMLString() + + + + + + + + Protected Sub New() + MyBase.New() + Me.Initialize() + End Sub + + Protected Overridable Sub Initialize() + Dim def As New XmlTableDefinition(TableDefinitionString) + Me.TableDefinition = New TableDefinition() + Me.TableDefinition.TableClassName = System.Reflection.Assembly.CreateQualifiedName("App_Code", "Persons.Business.PersonalLanguageSkillTable") + def.InitializeTableDefinition(Me.TableDefinition) + Me.ConnectionName = def.GetConnectionName() + Me.RecordClassName = System.Reflection.Assembly.CreateQualifiedName("App_Code", "Persons.Business.PersonalLanguageSkillRecord") + Me.ApplicationName = "App_Code" + Me.DataAdapter = New PersonalLanguageSkillSqlTable() + Directcast(Me.DataAdapter, PersonalLanguageSkillSqlTable).ConnectionName = Me.ConnectionName + + Me.TableDefinition.AdapterMetaData = Me.DataAdapter.AdapterMetaData + id0Column.CodeName = "id0" + PersonalIdColumn.CodeName = "PersonalId" + LanguageIdColumn.CodeName = "LanguageId" + LevelColumn.CodeName = "Level" + + End Sub + +#Region "Overriden methods" + + +#End Region + +#Region "Properties for columns" + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalLanguageSkill_.id column object. + ''' + Public ReadOnly Property id0Column() As BaseClasses.Data.NumberColumn + Get + Return CType(Me.TableDefinition.ColumnList(0), BaseClasses.Data.NumberColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalLanguageSkill_.id column object. + ''' + Public Shared ReadOnly Property id0() As BaseClasses.Data.NumberColumn + Get + Return PersonalLanguageSkillTable.Instance.id0Column + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonalLanguageSkill_.PersonalId column object. + ''' + Public ReadOnly Property PersonalIdColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(1), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalLanguageSkill_.PersonalId column object. + ''' + Public Shared ReadOnly Property PersonalId() As BaseClasses.Data.StringColumn + Get + Return PersonalLanguageSkillTable.Instance.PersonalIdColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonalLanguageSkill_.LanguageId column object. + ''' + Public ReadOnly Property LanguageIdColumn() As BaseClasses.Data.NumberColumn + Get + Return CType(Me.TableDefinition.ColumnList(2), BaseClasses.Data.NumberColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalLanguageSkill_.LanguageId column object. + ''' + Public Shared ReadOnly Property LanguageId() As BaseClasses.Data.NumberColumn + Get + Return PersonalLanguageSkillTable.Instance.LanguageIdColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonalLanguageSkill_.Level column object. + ''' + Public ReadOnly Property LevelColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(3), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalLanguageSkill_.Level column object. + ''' + Public Shared ReadOnly Property Level() As BaseClasses.Data.StringColumn + Get + Return PersonalLanguageSkillTable.Instance.LevelColumn + End Get + End Property + + +#End Region + + +#Region "Shared helper methods" + + ''' + ''' This is a shared function that can be used to get an array of PersonalLanguageSkillRecord records using a where clause. + ''' + Public Shared Function GetRecords(ByVal where As String) As PersonalLanguageSkillRecord() + + Return GetRecords(where, Nothing, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) + End Function + + ''' + ''' This is a shared function that can be used to get an array of PersonalLanguageSkillRecord records using a where clause. + ''' + Public Shared Function GetRecords(ByVal join As BaseFilter, ByVal where As String) As PersonalLanguageSkillRecord() + + Return GetRecords(join, where, Nothing, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) + End Function + + ''' + ''' This is a shared function that can be used to get an array of PersonalLanguageSkillRecord records using a where and order by clause. + ''' + Public Shared Function GetRecords( _ + ByVal where As String, _ + ByVal orderBy As OrderBy) As PersonalLanguageSkillRecord() + + Return GetRecords(where, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) + End Function + + ''' + ''' This is a shared function that can be used to get an array of PersonalLanguageSkillRecord records using a where and order by clause. + ''' + Public Shared Function GetRecords( _ + ByVal join As BaseFilter, _ + ByVal where As String, _ + ByVal orderBy As OrderBy) As PersonalLanguageSkillRecord() + + Return GetRecords(join, where, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) + End Function + + ''' + ''' This is a shared function that can be used to get an array of PersonalLanguageSkillRecord records using a where and order by clause clause with pagination. + ''' + Public Shared Function GetRecords( _ + ByVal where As String, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As PersonalLanguageSkillRecord() + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + Dim join As BaseClasses.Data.BaseFilter = Nothing + Dim recList As ArrayList = PersonalLanguageSkillTable.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, pageIndex, pageSize) + + Return CType(recList.ToArray(GetType(Persons.Business.PersonalLanguageSkillRecord)), PersonalLanguageSkillRecord()) + End Function + + ''' + ''' This is a shared function that can be used to get an array of PersonalLanguageSkillRecord records using a where and order by clause clause with pagination. + ''' + Public Shared Function GetRecords( _ + ByVal join As BaseFilter, _ + ByVal where As String, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As PersonalLanguageSkillRecord() + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Dim recList As ArrayList = PersonalLanguageSkillTable.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, pageIndex, pageSize) + + Return CType(recList.ToArray(GetType(Persons.Business.PersonalLanguageSkillRecord)), PersonalLanguageSkillRecord()) + End Function + + Public Shared Function GetRecords( _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As PersonalLanguageSkillRecord() + Dim join As BaseClasses.Data.BaseFilter = Nothing + Dim recList As ArrayList = PersonalLanguageSkillTable.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + Return CType(recList.ToArray(GetType(Persons.Business.PersonalLanguageSkillRecord)), PersonalLanguageSkillRecord()) + End Function + + Public Shared Function GetRecords( _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As PersonalLanguageSkillRecord() + + Dim recList As ArrayList = PersonalLanguageSkillTable.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + Return CType(recList.ToArray(GetType(Persons.Business.PersonalLanguageSkillRecord)), PersonalLanguageSkillRecord()) + End Function + + Public Shared Function GetRecords( _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer, _ + ByRef totalRecords As Integer) As PersonalLanguageSkillRecord() + Dim join As BaseClasses.Data.BaseFilter = Nothing + Dim recList As ArrayList = PersonalLanguageSkillTable.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize, totalRecords) + + Return CType(recList.ToArray(GetType(Persons.Business.PersonalLanguageSkillRecord)), PersonalLanguageSkillRecord()) + End Function + + Public Shared Function GetRecords( _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer, _ + ByRef totalRecords As Integer) As PersonalLanguageSkillRecord() + + Dim recList As ArrayList = PersonalLanguageSkillTable.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize, totalRecords) + + Return CType(recList.ToArray(GetType(Persons.Business.PersonalLanguageSkillRecord)), PersonalLanguageSkillRecord()) + End Function + + ''' + ''' This is a shared function that can be used to get total number of records that will be returned using the where clause. + ''' + Public Shared Function GetRecordCount(ByVal where As String) As Integer + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Return CInt(PersonalLanguageSkillTable.Instance.GetRecordListCount(Nothing, whereFilter, Nothing, Nothing)) + End Function + +''' + ''' This is a shared function that can be used to get total number of records that will be returned using the where clause. + ''' + Public Shared Function GetRecordCount(ByVal join As BaseFilter, ByVal where As String) As Integer + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Return CInt(PersonalLanguageSkillTable.Instance.GetRecordListCount(join, whereFilter, Nothing, Nothing)) + End Function + + Public Shared Function GetRecordCount(ByVal where As WhereClause) As Integer + Return CInt(PersonalLanguageSkillTable.Instance.GetRecordListCount(Nothing, where.GetFilter(), Nothing, Nothing)) + End Function + + Public Shared Function GetRecordCount(ByVal join As BaseFilter, ByVal where As WhereClause) As Integer + Return CInt(PersonalLanguageSkillTable.Instance.GetRecordListCount(join, where.GetFilter(), Nothing, Nothing)) + End Function + + ''' + ''' This is a shared function that can be used to get a PersonalLanguageSkillRecord record using a where clause. + ''' + Public Shared Function GetRecord(ByVal where As String) As PersonalLanguageSkillRecord + Dim orderBy As OrderBy = Nothing + Return GetRecord(where, orderBy) + End Function + + ''' + ''' This is a shared function that can be used to get a PersonalLanguageSkillRecord record using a where clause. + ''' + Public Shared Function GetRecord(ByVal join As BaseFilter, ByVal where As String) As PersonalLanguageSkillRecord + Dim orderBy As OrderBy = Nothing + Return GetRecord(join, where, orderBy) + End Function + + ''' + ''' This is a shared function that can be used to get a PersonalLanguageSkillRecord record using a where and order by clause. + ''' + Public Shared Function GetRecord( _ + ByVal where As String, _ + ByVal orderBy As OrderBy) As PersonalLanguageSkillRecord + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + Dim join As BaseClasses.Data.BaseFilter = Nothing + Dim recList As ArrayList = PersonalLanguageSkillTable.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MIN_BATCH_SIZE) + + Dim rec As PersonalLanguageSkillRecord = Nothing + If recList.Count > 0 Then + rec = CType(recList(0), PersonalLanguageSkillRecord) + End If + + Return rec + End Function + + ''' + ''' This is a shared function that can be used to get a PersonalLanguageSkillRecord record using a where and order by clause. + ''' + Public Shared Function GetRecord( _ + ByVal join As BaseFilter, _ + ByVal where As String, _ + ByVal orderBy As OrderBy) As PersonalLanguageSkillRecord + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Dim recList As ArrayList = PersonalLanguageSkillTable.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MIN_BATCH_SIZE) + + Dim rec As PersonalLanguageSkillRecord = Nothing + If recList.Count > 0 Then + rec = CType(recList(0), PersonalLanguageSkillRecord) + End If + + Return rec + End Function + + + Public Shared Function GetValues( _ + ByVal col As BaseColumn, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal maxItems As Integer) As String() + + ' Create the filter list. + Dim retCol As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, True) + retCol.AddColumn(col) + + Return PersonalLanguageSkillTable.Instance.GetColumnValues(retCol, Nothing, where.GetFilter(), Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, maxItems) + + End Function + + Public Shared Function GetValues( _ + ByVal col As BaseColumn, _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal maxItems As Integer) As String() + + ' Create the filter list. + Dim retCol As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, True) + retCol.AddColumn(col) + + Return PersonalLanguageSkillTable.Instance.GetColumnValues(retCol, join, where.GetFilter(), Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, maxItems) + + End Function + + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where clause. + ''' + Public Shared Function GetDataTable(ByVal where As String) As System.Data.DataTable + + Dim recs() As PersonalLanguageSkillRecord = GetRecords(where) + Return PersonalLanguageSkillTable.Instance.CreateDataTable(recs, Nothing) + End Function + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where clause. + ''' + Public Shared Function GetDataTable(ByVal join As BaseFilter, ByVal where As String) As System.Data.DataTable + + Dim recs() As PersonalLanguageSkillRecord = GetRecords(join, where) + Return PersonalLanguageSkillTable.Instance.CreateDataTable(recs, Nothing) + End Function + + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause. + ''' + Public Shared Function GetDataTable(ByVal where As String, ByVal orderBy As OrderBy) As System.Data.DataTable + + Dim recs() As PersonalLanguageSkillRecord = GetRecords(where, orderBy) + Return PersonalLanguageSkillTable.Instance.CreateDataTable(recs, Nothing) + End Function + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause. + ''' + Public Shared Function GetDataTable(ByVal join As BaseFilter, ByVal where As String, ByVal orderBy As OrderBy) As System.Data.DataTable + + Dim recs() As PersonalLanguageSkillRecord = GetRecords(join, where, orderBy) + Return PersonalLanguageSkillTable.Instance.CreateDataTable(recs, Nothing) + End Function + + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause with pagination. + ''' + Public Shared Function GetDataTable( _ + ByVal where As String, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As System.Data.DataTable + + Dim recs() As PersonalLanguageSkillRecord = GetRecords(where, orderBy, pageIndex, pageSize) + Return PersonalLanguageSkillTable.Instance.CreateDataTable(recs, Nothing) + End Function + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause with pagination. + ''' + Public Shared Function GetDataTable( _ + ByVal join As BaseFilter, _ + ByVal where As String, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As System.Data.DataTable + + Dim recs() As PersonalLanguageSkillRecord = GetRecords(join, where, orderBy, pageIndex, pageSize) + Return PersonalLanguageSkillTable.Instance.CreateDataTable(recs, Nothing) + End Function + + + ''' + ''' This is a shared function that can be used to delete records using a where clause. + ''' + Public Shared Sub DeleteRecords(ByVal where As String) + If where = Nothing OrElse where.Trim() = "" Then + Return + End If + + Dim whereFilter As SqlFilter = New SqlFilter(where) + PersonalLanguageSkillTable.Instance.DeleteRecordList(whereFilter) + End Sub + + ''' + ''' This is a shared function that can be used to export records using a where clause. + ''' + Public Shared Function Export(ByVal where As String) As String + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Return PersonalLanguageSkillTable.Instance.ExportRecordData(whereFilter) + End Function + + Public Shared Function Export(ByVal where As WhereClause) As String + Dim whereFilter As BaseFilter = Nothing + If Not where Is Nothing Then + whereFilter = where.GetFilter() + End If + + Return PersonalLanguageSkillTable.Instance.ExportRecordData(whereFilter) + End Function + + Public Shared Function GetSum( _ + ByVal col As BaseColumn, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) _ + As String + + Dim colSel As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, False) + colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Sum) + + Return PersonalLanguageSkillTable.Instance.GetColumnStatistics(colSel, Nothing, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + End Function + + Public Shared Function GetSum( _ + ByVal col As BaseColumn, _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) _ + As String + + Dim colSel As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, False) + colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Sum) + + Return PersonalLanguageSkillTable.Instance.GetColumnStatistics(colSel, join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + End Function + + + Public Shared Function GetCount( _ + ByVal col As BaseColumn, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) _ + As String + + Dim colSel As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, False) + colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Count) + + Return PersonalLanguageSkillTable.Instance.GetColumnStatistics(colSel, Nothing, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + End Function + + Public Shared Function GetCount( _ + ByVal col As BaseColumn, _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) _ + As String + + Dim colSel As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, False) + colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Count) + + Return PersonalLanguageSkillTable.Instance.GetColumnStatistics(colSel, join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + End Function + + ''' + ''' This method returns the columns in the table. + ''' + Public Shared Function GetColumns() As BaseColumn() + Return PersonalLanguageSkillTable.Instance.TableDefinition.Columns + End Function + + ''' + ''' This method returns the columnlist in the table. + ''' + Public Shared Function GetColumnList() As ColumnList + Return PersonalLanguageSkillTable.Instance.TableDefinition.ColumnList + End Function + + + ''' + ''' This method creates a new record and returns it to be edited. + ''' + Public Shared Function CreateNewRecord() As IRecord + Return PersonalLanguageSkillTable.Instance.CreateRecord() + End Function + + ''' + ''' This method creates a new record and returns it to be edited. + ''' + ''' ID of the new record. + Public Shared Function CreateNewRecord(ByVal tempId As String) As IRecord + Return PersonalLanguageSkillTable.Instance.CreateRecord(tempId) + End Function + + ''' + ''' This method checks if column is editable. + ''' + ''' Name of the column to check. + Public Shared Function isReadOnlyColumn(ByVal columnName As String) As Boolean + Dim column As BaseColumn = GetColumn(columnName) + If (Not IsNothing(column)) Then + Return column.IsValuesReadOnly + Else + Return True + End If + End Function + + ''' + ''' This method gets the specified column. + ''' + ''' Unique name of the column to fetch. + Public Shared Function GetColumn(ByVal uniqueColumnName As String) As BaseColumn + Dim column As BaseColumn = PersonalLanguageSkillTable.Instance.TableDefinition.ColumnList.GetByUniqueName(uniqueColumnName) + Return column + End Function + + ' Convenience method for getting a record using a string-based record identifier + Public Shared Function GetRecord(ByVal id As String, ByVal bMutable As Boolean) As PersonalLanguageSkillRecord + Return CType(PersonalLanguageSkillTable.Instance.GetRecordData(id, bMutable), PersonalLanguageSkillRecord) + End Function + + ' Convenience method for getting a record using a KeyValue record identifier + Public Shared Function GetRecord(ByVal id As KeyValue, ByVal bMutable As Boolean) As PersonalLanguageSkillRecord + Return CType(PersonalLanguageSkillTable.Instance.GetRecordData(id, bMutable), PersonalLanguageSkillRecord) + End Function + + ' Convenience method for creating a record + Public Overloads Function NewRecord( _ + ByVal PersonalIdValue As String, _ + ByVal LanguageIdValue As String, _ + ByVal LevelValue As String _ + ) As KeyValue + Dim rec As IPrimaryKeyRecord = CType(Me.CreateRecord(), IPrimaryKeyRecord) + rec.SetString(PersonalIdValue, PersonalIdColumn) + rec.SetString(LanguageIdValue, LanguageIdColumn) + rec.SetString(LevelValue, LevelColumn) + + + rec.Create() 'update the DB so any DB-initialized fields (like autoincrement IDs) can be initialized + + Dim key As KeyValue = rec.GetID() + Return key + End Function + + ''' + ''' This method deletes a specified record + ''' + ''' Keyvalue of the record to be deleted. + Public Shared Sub DeleteRecord(ByVal kv As KeyValue) + PersonalLanguageSkillTable.Instance.DeleteOneRecord(kv) + End Sub + + ''' + ''' This method checks if record exist in the database using the keyvalue provided. + ''' + ''' Key value of the record. + Public Shared Function DoesRecordExist(ByVal kv As KeyValue) As Boolean + Dim recordExist As Boolean = True + Try + PersonalLanguageSkillTable.GetRecord(kv, False) + Catch ex As Exception + recordExist = False + End Try + Return recordExist + End Function + + ''' + ''' This method returns all the primary columns in the table. + ''' + Public Shared Function GetPrimaryKeyColumns() As ColumnList + If (Not IsNothing(PersonalLanguageSkillTable.Instance.TableDefinition.PrimaryKey)) Then + Return PersonalLanguageSkillTable.Instance.TableDefinition.PrimaryKey.Columns + Else + Return Nothing + End If + End Function + + ''' + ''' This method takes a key and returns a keyvalue. + ''' + ''' key could be array of primary key values in case of composite primary key or a string containing single primary key value in case of non-composite primary key. + Public Shared Function GetKeyValue(ByVal key As Object) As KeyValue + Dim kv As KeyValue = Nothing + + If (Not (IsNothing(PersonalLanguageSkillTable.Instance.TableDefinition.PrimaryKey))) Then + + Dim isCompositePrimaryKey As Boolean = False + isCompositePrimaryKey = PersonalLanguageSkillTable.Instance.TableDefinition.PrimaryKey.IsCompositeKey + + If ((isCompositePrimaryKey) AndAlso (key.GetType.IsArray())) Then + + ' If the key is composite, then construct a key value. + kv = New KeyValue + Dim fullKeyString As String = "" + Dim keyArray As Array = CType(key, Array) + If (Not IsNothing(keyArray)) Then + Dim length As Integer = keyArray.Length + Dim pkColumns As ColumnList = PersonalLanguageSkillTable.Instance.TableDefinition.PrimaryKey.Columns + Dim pkColumn As BaseColumn + Dim index As Integer = 0 + For Each pkColumn In pkColumns + Dim keyString As String = CType(keyArray.GetValue(index), String) + If (PersonalLanguageSkillTable.Instance.TableDefinition.TableType = BaseClasses.Data.TableDefinition.TableTypes.Virtual) Then + kv.AddElement(pkColumn.UniqueName, keyString) + Else + kv.AddElement(pkColumn.InternalName, keyString) + End If + index = index + 1 + Next pkColumn + End If + + Else + ' If the key is not composite, then get the key value. + kv = PersonalLanguageSkillTable.Instance.TableDefinition.PrimaryKey.ParseValue(CType(key, String)) + End If + End If + Return kv + End Function + + + ''' + ''' This method takes a record and a Column and returns an evaluated value of DFKA formula. + ''' + Public Shared Function GetDFKA(ByVal rec As BaseRecord, ByVal col As BaseColumn) As String + Dim fkColumn As ForeignKey = PersonalLanguageSkillTable.Instance.TableDefinition.GetExpandableNonCompositeForeignKey(col) + If fkColumn Is Nothing Then + Return Nothing + End If + Dim _DFKA As String = fkColumn.PrimaryKeyDisplayColumns + If (_DFKA.Trim().StartsWith("=")) Then + ' if the formula is in the format of "= ., then pull out the data from the rec object instead of doing formula evaluation + Dim tableCodeName As String = fkColumn.PrimaryKeyTableDefinition.TableCodeName + Dim column As String = _DFKA.Trim("="c).Trim() + If column.StartsWith(tableCodeName & ".", StringComparison.InvariantCultureIgnoreCase) Then + column = column.Substring(tableCodeName.Length + 1) + End If + + For Each c As BaseColumn In fkColumn.PrimaryKeyTableDefinition.Columns + If column = c.CodeName Then + Return rec.Format(c) + End If + Next + Dim tableName As String = fkColumn.PrimaryKeyTableDefinition.TableCodeName + Return EvaluateFormula(_DFKA, rec, Nothing, tableName) + Else + Return Nothing + End If + End Function + + ''' + ''' This method takes a keyValue and a Column and returns an evaluated value of DFKA formula. + ''' + Public Shared Function GetDFKA(ByVal keyValue As String, ByVal col As BaseColumn, ByVal formatPattern as String) As String + If keyValue Is Nothing Then + Return Nothing + End If + Dim fkColumn As ForeignKey = PersonalLanguageSkillTable.Instance.TableDefinition.GetExpandableNonCompositeForeignKey(col) + If fkColumn Is Nothing Then + Return Nothing + End If + Dim _DFKA As String = fkColumn.PrimaryKeyDisplayColumns + If (_DFKA.Trim().StartsWith("=")) Then + Dim tableName As String = fkColumn.PrimaryKeyTableDefinition.TableCodeName + Dim t As PrimaryKeyTable = CType(DatabaseObjects.GetTableObject(tableName), PrimaryKeyTable) + Dim rec As BaseRecord = Nothing + If Not t Is Nothing Then + Try + rec = CType(t.GetRecordData(keyValue, False), BaseRecord) + Catch + rec = Nothing + End Try + End If + If rec Is Nothing Then + Return "" + End If + + ' if the formula is in the format of "= ., then pull out the data from the rec object instead of doing formula evaluation + Dim tableCodeName As String = fkColumn.PrimaryKeyTableDefinition.TableCodeName + Dim column As String = _DFKA.Trim("="c).Trim() + If column.StartsWith(tableCodeName & ".", StringComparison.InvariantCultureIgnoreCase) Then + column = column.Substring(tableCodeName.Length + 1) + End If + + For Each c As BaseColumn In fkColumn.PrimaryKeyTableDefinition.Columns + If column = c.CodeName Then + Return rec.Format(c) + End If + Next + Return EvaluateFormula(_DFKA, rec, Nothing, tableName) + Else + Return Nothing + End If + End Function + + ''' + ''' Evaluates the formula + ''' + Public Shared Function EvaluateFormula(ByVal formula As String, Optional ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord = Nothing, Optional ByVal format As String = Nothing, Optional ByVal name As String = "") As String + Dim e As BaseFormulaEvaluator = New BaseFormulaEvaluator() + If Not dataSourceForEvaluate Is Nothing Then + e.Evaluator.Variables.Add(name, dataSourceForEvaluate) + end if + e.DataSource = dataSourceForEvaluate + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + If Not String.IsNullOrEmpty(format) Then + Return BaseFormulaUtils.Format(resultObj, format) + Else + Return resultObj.ToString() + End If + End Function + + +#End Region + +End Class +End Namespace diff --git a/App_Code/Business Layer/BasePersonalNameRecord.vb b/App_Code/Business Layer/BasePersonalNameRecord.vb new file mode 100644 index 0000000..1e0e17a --- /dev/null +++ b/App_Code/Business Layer/BasePersonalNameRecord.vb @@ -0,0 +1,510 @@ +' This class is "generated" and will be overwritten. +' Your customizations should be made in PersonalNameRecord.vb + +Imports System.Data.SqlTypes +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + +Namespace Persons.Business + +''' +''' The generated superclass for the class. +''' +''' +''' This class is not intended to be instantiated directly. To obtain an instance of this class, +''' use the methods of the class. +''' +''' +''' + + Public Class BasePersonalNameRecord + Inherits PrimaryKeyRecord + + + Public Shared Shadows ReadOnly TableUtils As PersonalNameTable = PersonalNameTable.Instance + + ' Constructors + + Protected Sub New() + MyBase.New(TableUtils) + End Sub + + Protected Sub New(ByVal record As PrimaryKeyRecord) + MyBase.New(record, TableUtils) + End Sub + + 'Evaluates Initialize when->Inserting record formulas specified at the data access layer + Public Overridable Sub PersonalNameRecord_InsertingRecord(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles Me.InsertingRecord + 'Apply Initialize->Inserting record formula only if validation is successful. + Dim PersonalNameRec As PersonalNameRecord = CType(sender,PersonalNameRecord) + Validate_Inserting() + If Not PersonalNameRec Is Nothing AndAlso Not PersonalNameRec.IsReadOnly Then + End If + End Sub + + 'Evaluates Initialize when->Updating record formulas specified at the data access layer + Public Overridable Sub PersonalNameRecord_UpdatingRecord(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles Me.UpdatingRecord + 'Apply Initialize->Updating record formula only if validation is successful. + Dim PersonalNameRec As PersonalNameRecord = CType(sender,PersonalNameRecord) + Validate_Updating() + If Not PersonalNameRec Is Nothing AndAlso Not PersonalNameRec.IsReadOnly Then + End If + End Sub + + 'Evaluates Initialize when->Reading record formulas specified at the data access layer + Public Overridable Sub PersonalNameRecord_ReadRecord(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.ReadRecord + 'Apply Initialize->Reading record formula only if validation is successful. + Dim PersonalNameRec As PersonalNameRecord = CType(sender,PersonalNameRecord) + If Not PersonalNameRec Is Nothing AndAlso Not PersonalNameRec.IsReadOnly Then + End If + End Sub + + 'Evaluates Validate when->Inserting formulas specified at the data access layer + Public Overridable Sub Validate_Inserting () + Dim fullValidationMessage As String = "" + Dim validationMessage As String = "" + + dim formula as String = "" + + + If validationMessage <> "" AndAlso validationMessage.ToLower() <> "true" Then + fullValidationMessage &= validationMessage & vbCrLf + End If + + If fullValidationMessage <> "" Then + Throw New Exception(fullValidationMessage) + End If + End Sub + + 'Evaluates Validate when->Updating formulas specified at the data access layer + Public Overridable Sub Validate_Updating () + Dim fullValidationMessage As String = "" + Dim validationMessage As String = "" + + dim formula as String = "" + + + If validationMessage <> "" AndAlso validationMessage.ToLower() <> "true" Then + fullValidationMessage &= validationMessage & vbCrLf + End If + + If fullValidationMessage <> "" Then + Throw New Exception(fullValidationMessage) + End If + End Sub + + Public Overridable Function EvaluateFormula(ByVal formula As String, Optional ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord = Nothing, Optional ByVal format As String = Nothing) As String + + Dim e As Data.BaseFormulaEvaluator = New Data.BaseFormulaEvaluator() + + ' All variables referred to in the formula are expected to be + ' properties of the DataSource. For example, referring to + ' UnitPrice as a variable will refer to DataSource.UnitPrice + e.DataSource = dataSourceForEvaluate + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + Return resultObj.ToString() + End Function + + + + + + + +#Region "Convenience methods to get/set values of fields" + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalName_.id field. + ''' + Public Function Getid0Value() As ColumnValue + Return Me.GetValue(TableUtils.id0Column) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalName_.id field. + ''' + Public Function Getid0FieldValue() As Int32 + Return CType(Me.GetValue(TableUtils.id0Column).ToInt32(), Int32) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalName_.PersonalId field. + ''' + Public Function GetPersonalIdValue() As ColumnValue + Return Me.GetValue(TableUtils.PersonalIdColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalName_.PersonalId field. + ''' + Public Function GetPersonalIdFieldValue() As String + Return CType(Me.GetValue(TableUtils.PersonalIdColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalName_.PersonalId field. + ''' + Public Sub SetPersonalIdFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.PersonalIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalName_.PersonalId field. + ''' + Public Sub SetPersonalIdFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.PersonalIdColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalName_.PersonalName field. + ''' + Public Function GetPersonalNameValue() As ColumnValue + Return Me.GetValue(TableUtils.PersonalNameColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalName_.PersonalName field. + ''' + Public Function GetPersonalNameFieldValue() As String + Return CType(Me.GetValue(TableUtils.PersonalNameColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalName_.PersonalName field. + ''' + Public Sub SetPersonalNameFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.PersonalNameColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalName_.PersonalName field. + ''' + Public Sub SetPersonalNameFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.PersonalNameColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalName_.PersonalLastName field. + ''' + Public Function GetPersonalLastNameValue() As ColumnValue + Return Me.GetValue(TableUtils.PersonalLastNameColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalName_.PersonalLastName field. + ''' + Public Function GetPersonalLastNameFieldValue() As String + Return CType(Me.GetValue(TableUtils.PersonalLastNameColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalName_.PersonalLastName field. + ''' + Public Sub SetPersonalLastNameFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.PersonalLastNameColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalName_.PersonalLastName field. + ''' + Public Sub SetPersonalLastNameFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.PersonalLastNameColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalName_.NameDate field. + ''' + Public Function GetNameDateValue() As ColumnValue + Return Me.GetValue(TableUtils.NameDateColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalName_.NameDate field. + ''' + Public Function GetNameDateFieldValue() As DateTime + Return CType(Me.GetValue(TableUtils.NameDateColumn).ToDateTime(), DateTime) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalName_.NameDate field. + ''' + Public Sub SetNameDateFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.NameDateColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalName_.NameDate field. + ''' + Public Sub SetNameDateFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.NameDateColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalName_.NameDate field. + ''' + Public Sub SetNameDateFieldValue(ByVal val As DateTime) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.NameDateColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalName_.Ref field. + ''' + Public Function GetRef0Value() As ColumnValue + Return Me.GetValue(TableUtils.Ref0Column) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalName_.Ref field. + ''' + Public Function GetRef0FieldValue() As String + Return CType(Me.GetValue(TableUtils.Ref0Column).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalName_.Ref field. + ''' + Public Sub SetRef0FieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.Ref0Column) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalName_.Ref field. + ''' + Public Sub SetRef0FieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.Ref0Column) + End Sub + + + +#End Region + +#Region "Convenience methods to get field names" + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonalName_.id field. + ''' + Public Property id0() As Int32 + Get + Return CType(Me.GetValue(TableUtils.id0Column).ToInt32(), Int32) + End Get + Set (ByVal val As Int32) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.id0Column) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property id0Specified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.id0Column) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property id0Default() As String + Get + Return TableUtils.id0Column.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonalName_.PersonalId field. + ''' + Public Property PersonalId() As String + Get + Return CType(Me.GetValue(TableUtils.PersonalIdColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.PersonalIdColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property PersonalIdSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.PersonalIdColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property PersonalIdDefault() As String + Get + Return TableUtils.PersonalIdColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonalName_.PersonalName field. + ''' + Public Property PersonalName() As String + Get + Return CType(Me.GetValue(TableUtils.PersonalNameColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.PersonalNameColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property PersonalNameSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.PersonalNameColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property PersonalNameDefault() As String + Get + Return TableUtils.PersonalNameColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonalName_.PersonalLastName field. + ''' + Public Property PersonalLastName() As String + Get + Return CType(Me.GetValue(TableUtils.PersonalLastNameColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.PersonalLastNameColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property PersonalLastNameSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.PersonalLastNameColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property PersonalLastNameDefault() As String + Get + Return TableUtils.PersonalLastNameColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonalName_.NameDate field. + ''' + Public Property NameDate() As DateTime + Get + Return CType(Me.GetValue(TableUtils.NameDateColumn).ToDateTime(), DateTime) + End Get + Set (ByVal val As DateTime) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.NameDateColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property NameDateSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.NameDateColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property NameDateDefault() As String + Get + Return TableUtils.NameDateColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonalName_.Ref field. + ''' + Public Property Ref0() As String + Get + Return CType(Me.GetValue(TableUtils.Ref0Column).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.Ref0Column) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property Ref0Specified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.Ref0Column) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property Ref0Default() As String + Get + Return TableUtils.Ref0Column.DefaultValue + End Get + End Property + + + +#End Region + +End Class +End Namespace diff --git a/App_Code/Business Layer/BasePersonalNameTable.vb b/App_Code/Business Layer/BasePersonalNameTable.vb new file mode 100644 index 0000000..bdacd22 --- /dev/null +++ b/App_Code/Business Layer/BasePersonalNameTable.vb @@ -0,0 +1,864 @@ +' This class is "generated" and will be overwritten. +' Your customizations should be made in PersonalNameRecord.vb + +Imports System.Data.SqlTypes +Imports System.Data +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider +Imports Persons.Data + +Namespace Persons.Business + +''' +''' The generated superclass for the class. +''' Provides access to the schema information and record data of a database table or view named PersonalName. +''' +''' +''' The connection details (name, location, etc.) of the database and table (or view) accessed by this class +''' are resolved at runtime based on the connection string in the application's Web.Config file. +''' +''' This class is not intended to be instantiated directly. To obtain an instance of this class, use +''' PersonalNameTable.Instance. +''' +''' +''' + + Public Class BasePersonalNameTable + Inherits PrimaryKeyTable + + + Private ReadOnly TableDefinitionString As String = PersonalNameDefinition.GetXMLString() + + + + + + + + Protected Sub New() + MyBase.New() + Me.Initialize() + End Sub + + Protected Overridable Sub Initialize() + Dim def As New XmlTableDefinition(TableDefinitionString) + Me.TableDefinition = New TableDefinition() + Me.TableDefinition.TableClassName = System.Reflection.Assembly.CreateQualifiedName("App_Code", "Persons.Business.PersonalNameTable") + def.InitializeTableDefinition(Me.TableDefinition) + Me.ConnectionName = def.GetConnectionName() + Me.RecordClassName = System.Reflection.Assembly.CreateQualifiedName("App_Code", "Persons.Business.PersonalNameRecord") + Me.ApplicationName = "App_Code" + Me.DataAdapter = New PersonalNameSqlTable() + Directcast(Me.DataAdapter, PersonalNameSqlTable).ConnectionName = Me.ConnectionName + + Me.TableDefinition.AdapterMetaData = Me.DataAdapter.AdapterMetaData + id0Column.CodeName = "id0" + PersonalIdColumn.CodeName = "PersonalId" + PersonalNameColumn.CodeName = "PersonalName" + PersonalLastNameColumn.CodeName = "PersonalLastName" + NameDateColumn.CodeName = "NameDate" + Ref0Column.CodeName = "Ref0" + + End Sub + +#Region "Overriden methods" + + +#End Region + +#Region "Properties for columns" + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalName_.id column object. + ''' + Public ReadOnly Property id0Column() As BaseClasses.Data.NumberColumn + Get + Return CType(Me.TableDefinition.ColumnList(0), BaseClasses.Data.NumberColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalName_.id column object. + ''' + Public Shared ReadOnly Property id0() As BaseClasses.Data.NumberColumn + Get + Return PersonalNameTable.Instance.id0Column + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonalName_.PersonalId column object. + ''' + Public ReadOnly Property PersonalIdColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(1), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalName_.PersonalId column object. + ''' + Public Shared ReadOnly Property PersonalId() As BaseClasses.Data.StringColumn + Get + Return PersonalNameTable.Instance.PersonalIdColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonalName_.PersonalName column object. + ''' + Public ReadOnly Property PersonalNameColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(2), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalName_.PersonalName column object. + ''' + Public Shared ReadOnly Property PersonalName() As BaseClasses.Data.StringColumn + Get + Return PersonalNameTable.Instance.PersonalNameColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonalName_.PersonalLastName column object. + ''' + Public ReadOnly Property PersonalLastNameColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(3), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalName_.PersonalLastName column object. + ''' + Public Shared ReadOnly Property PersonalLastName() As BaseClasses.Data.StringColumn + Get + Return PersonalNameTable.Instance.PersonalLastNameColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonalName_.NameDate column object. + ''' + Public ReadOnly Property NameDateColumn() As BaseClasses.Data.DateColumn + Get + Return CType(Me.TableDefinition.ColumnList(4), BaseClasses.Data.DateColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalName_.NameDate column object. + ''' + Public Shared ReadOnly Property NameDate() As BaseClasses.Data.DateColumn + Get + Return PersonalNameTable.Instance.NameDateColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonalName_.Ref column object. + ''' + Public ReadOnly Property Ref0Column() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(5), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalName_.Ref column object. + ''' + Public Shared ReadOnly Property Ref0() As BaseClasses.Data.StringColumn + Get + Return PersonalNameTable.Instance.Ref0Column + End Get + End Property + + +#End Region + + +#Region "Shared helper methods" + + ''' + ''' This is a shared function that can be used to get an array of PersonalNameRecord records using a where clause. + ''' + Public Shared Function GetRecords(ByVal where As String) As PersonalNameRecord() + + Return GetRecords(where, Nothing, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) + End Function + + ''' + ''' This is a shared function that can be used to get an array of PersonalNameRecord records using a where clause. + ''' + Public Shared Function GetRecords(ByVal join As BaseFilter, ByVal where As String) As PersonalNameRecord() + + Return GetRecords(join, where, Nothing, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) + End Function + + ''' + ''' This is a shared function that can be used to get an array of PersonalNameRecord records using a where and order by clause. + ''' + Public Shared Function GetRecords( _ + ByVal where As String, _ + ByVal orderBy As OrderBy) As PersonalNameRecord() + + Return GetRecords(where, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) + End Function + + ''' + ''' This is a shared function that can be used to get an array of PersonalNameRecord records using a where and order by clause. + ''' + Public Shared Function GetRecords( _ + ByVal join As BaseFilter, _ + ByVal where As String, _ + ByVal orderBy As OrderBy) As PersonalNameRecord() + + Return GetRecords(join, where, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) + End Function + + ''' + ''' This is a shared function that can be used to get an array of PersonalNameRecord records using a where and order by clause clause with pagination. + ''' + Public Shared Function GetRecords( _ + ByVal where As String, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As PersonalNameRecord() + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + Dim join As BaseClasses.Data.BaseFilter = Nothing + Dim recList As ArrayList = PersonalNameTable.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, pageIndex, pageSize) + + Return CType(recList.ToArray(GetType(Persons.Business.PersonalNameRecord)), PersonalNameRecord()) + End Function + + ''' + ''' This is a shared function that can be used to get an array of PersonalNameRecord records using a where and order by clause clause with pagination. + ''' + Public Shared Function GetRecords( _ + ByVal join As BaseFilter, _ + ByVal where As String, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As PersonalNameRecord() + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Dim recList As ArrayList = PersonalNameTable.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, pageIndex, pageSize) + + Return CType(recList.ToArray(GetType(Persons.Business.PersonalNameRecord)), PersonalNameRecord()) + End Function + + Public Shared Function GetRecords( _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As PersonalNameRecord() + Dim join As BaseClasses.Data.BaseFilter = Nothing + Dim recList As ArrayList = PersonalNameTable.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + Return CType(recList.ToArray(GetType(Persons.Business.PersonalNameRecord)), PersonalNameRecord()) + End Function + + Public Shared Function GetRecords( _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As PersonalNameRecord() + + Dim recList As ArrayList = PersonalNameTable.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + Return CType(recList.ToArray(GetType(Persons.Business.PersonalNameRecord)), PersonalNameRecord()) + End Function + + Public Shared Function GetRecords( _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer, _ + ByRef totalRecords As Integer) As PersonalNameRecord() + Dim join As BaseClasses.Data.BaseFilter = Nothing + Dim recList As ArrayList = PersonalNameTable.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize, totalRecords) + + Return CType(recList.ToArray(GetType(Persons.Business.PersonalNameRecord)), PersonalNameRecord()) + End Function + + Public Shared Function GetRecords( _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer, _ + ByRef totalRecords As Integer) As PersonalNameRecord() + + Dim recList As ArrayList = PersonalNameTable.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize, totalRecords) + + Return CType(recList.ToArray(GetType(Persons.Business.PersonalNameRecord)), PersonalNameRecord()) + End Function + + ''' + ''' This is a shared function that can be used to get total number of records that will be returned using the where clause. + ''' + Public Shared Function GetRecordCount(ByVal where As String) As Integer + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Return CInt(PersonalNameTable.Instance.GetRecordListCount(Nothing, whereFilter, Nothing, Nothing)) + End Function + +''' + ''' This is a shared function that can be used to get total number of records that will be returned using the where clause. + ''' + Public Shared Function GetRecordCount(ByVal join As BaseFilter, ByVal where As String) As Integer + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Return CInt(PersonalNameTable.Instance.GetRecordListCount(join, whereFilter, Nothing, Nothing)) + End Function + + Public Shared Function GetRecordCount(ByVal where As WhereClause) As Integer + Return CInt(PersonalNameTable.Instance.GetRecordListCount(Nothing, where.GetFilter(), Nothing, Nothing)) + End Function + + Public Shared Function GetRecordCount(ByVal join As BaseFilter, ByVal where As WhereClause) As Integer + Return CInt(PersonalNameTable.Instance.GetRecordListCount(join, where.GetFilter(), Nothing, Nothing)) + End Function + + ''' + ''' This is a shared function that can be used to get a PersonalNameRecord record using a where clause. + ''' + Public Shared Function GetRecord(ByVal where As String) As PersonalNameRecord + Dim orderBy As OrderBy = Nothing + Return GetRecord(where, orderBy) + End Function + + ''' + ''' This is a shared function that can be used to get a PersonalNameRecord record using a where clause. + ''' + Public Shared Function GetRecord(ByVal join As BaseFilter, ByVal where As String) As PersonalNameRecord + Dim orderBy As OrderBy = Nothing + Return GetRecord(join, where, orderBy) + End Function + + ''' + ''' This is a shared function that can be used to get a PersonalNameRecord record using a where and order by clause. + ''' + Public Shared Function GetRecord( _ + ByVal where As String, _ + ByVal orderBy As OrderBy) As PersonalNameRecord + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + Dim join As BaseClasses.Data.BaseFilter = Nothing + Dim recList As ArrayList = PersonalNameTable.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MIN_BATCH_SIZE) + + Dim rec As PersonalNameRecord = Nothing + If recList.Count > 0 Then + rec = CType(recList(0), PersonalNameRecord) + End If + + Return rec + End Function + + ''' + ''' This is a shared function that can be used to get a PersonalNameRecord record using a where and order by clause. + ''' + Public Shared Function GetRecord( _ + ByVal join As BaseFilter, _ + ByVal where As String, _ + ByVal orderBy As OrderBy) As PersonalNameRecord + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Dim recList As ArrayList = PersonalNameTable.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MIN_BATCH_SIZE) + + Dim rec As PersonalNameRecord = Nothing + If recList.Count > 0 Then + rec = CType(recList(0), PersonalNameRecord) + End If + + Return rec + End Function + + + Public Shared Function GetValues( _ + ByVal col As BaseColumn, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal maxItems As Integer) As String() + + ' Create the filter list. + Dim retCol As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, True) + retCol.AddColumn(col) + + Return PersonalNameTable.Instance.GetColumnValues(retCol, Nothing, where.GetFilter(), Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, maxItems) + + End Function + + Public Shared Function GetValues( _ + ByVal col As BaseColumn, _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal maxItems As Integer) As String() + + ' Create the filter list. + Dim retCol As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, True) + retCol.AddColumn(col) + + Return PersonalNameTable.Instance.GetColumnValues(retCol, join, where.GetFilter(), Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, maxItems) + + End Function + + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where clause. + ''' + Public Shared Function GetDataTable(ByVal where As String) As System.Data.DataTable + + Dim recs() As PersonalNameRecord = GetRecords(where) + Return PersonalNameTable.Instance.CreateDataTable(recs, Nothing) + End Function + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where clause. + ''' + Public Shared Function GetDataTable(ByVal join As BaseFilter, ByVal where As String) As System.Data.DataTable + + Dim recs() As PersonalNameRecord = GetRecords(join, where) + Return PersonalNameTable.Instance.CreateDataTable(recs, Nothing) + End Function + + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause. + ''' + Public Shared Function GetDataTable(ByVal where As String, ByVal orderBy As OrderBy) As System.Data.DataTable + + Dim recs() As PersonalNameRecord = GetRecords(where, orderBy) + Return PersonalNameTable.Instance.CreateDataTable(recs, Nothing) + End Function + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause. + ''' + Public Shared Function GetDataTable(ByVal join As BaseFilter, ByVal where As String, ByVal orderBy As OrderBy) As System.Data.DataTable + + Dim recs() As PersonalNameRecord = GetRecords(join, where, orderBy) + Return PersonalNameTable.Instance.CreateDataTable(recs, Nothing) + End Function + + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause with pagination. + ''' + Public Shared Function GetDataTable( _ + ByVal where As String, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As System.Data.DataTable + + Dim recs() As PersonalNameRecord = GetRecords(where, orderBy, pageIndex, pageSize) + Return PersonalNameTable.Instance.CreateDataTable(recs, Nothing) + End Function + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause with pagination. + ''' + Public Shared Function GetDataTable( _ + ByVal join As BaseFilter, _ + ByVal where As String, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As System.Data.DataTable + + Dim recs() As PersonalNameRecord = GetRecords(join, where, orderBy, pageIndex, pageSize) + Return PersonalNameTable.Instance.CreateDataTable(recs, Nothing) + End Function + + + ''' + ''' This is a shared function that can be used to delete records using a where clause. + ''' + Public Shared Sub DeleteRecords(ByVal where As String) + If where = Nothing OrElse where.Trim() = "" Then + Return + End If + + Dim whereFilter As SqlFilter = New SqlFilter(where) + PersonalNameTable.Instance.DeleteRecordList(whereFilter) + End Sub + + ''' + ''' This is a shared function that can be used to export records using a where clause. + ''' + Public Shared Function Export(ByVal where As String) As String + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Return PersonalNameTable.Instance.ExportRecordData(whereFilter) + End Function + + Public Shared Function Export(ByVal where As WhereClause) As String + Dim whereFilter As BaseFilter = Nothing + If Not where Is Nothing Then + whereFilter = where.GetFilter() + End If + + Return PersonalNameTable.Instance.ExportRecordData(whereFilter) + End Function + + Public Shared Function GetSum( _ + ByVal col As BaseColumn, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) _ + As String + + Dim colSel As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, False) + colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Sum) + + Return PersonalNameTable.Instance.GetColumnStatistics(colSel, Nothing, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + End Function + + Public Shared Function GetSum( _ + ByVal col As BaseColumn, _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) _ + As String + + Dim colSel As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, False) + colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Sum) + + Return PersonalNameTable.Instance.GetColumnStatistics(colSel, join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + End Function + + + Public Shared Function GetCount( _ + ByVal col As BaseColumn, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) _ + As String + + Dim colSel As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, False) + colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Count) + + Return PersonalNameTable.Instance.GetColumnStatistics(colSel, Nothing, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + End Function + + Public Shared Function GetCount( _ + ByVal col As BaseColumn, _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) _ + As String + + Dim colSel As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, False) + colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Count) + + Return PersonalNameTable.Instance.GetColumnStatistics(colSel, join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + End Function + + ''' + ''' This method returns the columns in the table. + ''' + Public Shared Function GetColumns() As BaseColumn() + Return PersonalNameTable.Instance.TableDefinition.Columns + End Function + + ''' + ''' This method returns the columnlist in the table. + ''' + Public Shared Function GetColumnList() As ColumnList + Return PersonalNameTable.Instance.TableDefinition.ColumnList + End Function + + + ''' + ''' This method creates a new record and returns it to be edited. + ''' + Public Shared Function CreateNewRecord() As IRecord + Return PersonalNameTable.Instance.CreateRecord() + End Function + + ''' + ''' This method creates a new record and returns it to be edited. + ''' + ''' ID of the new record. + Public Shared Function CreateNewRecord(ByVal tempId As String) As IRecord + Return PersonalNameTable.Instance.CreateRecord(tempId) + End Function + + ''' + ''' This method checks if column is editable. + ''' + ''' Name of the column to check. + Public Shared Function isReadOnlyColumn(ByVal columnName As String) As Boolean + Dim column As BaseColumn = GetColumn(columnName) + If (Not IsNothing(column)) Then + Return column.IsValuesReadOnly + Else + Return True + End If + End Function + + ''' + ''' This method gets the specified column. + ''' + ''' Unique name of the column to fetch. + Public Shared Function GetColumn(ByVal uniqueColumnName As String) As BaseColumn + Dim column As BaseColumn = PersonalNameTable.Instance.TableDefinition.ColumnList.GetByUniqueName(uniqueColumnName) + Return column + End Function + + ' Convenience method for getting a record using a string-based record identifier + Public Shared Function GetRecord(ByVal id As String, ByVal bMutable As Boolean) As PersonalNameRecord + Return CType(PersonalNameTable.Instance.GetRecordData(id, bMutable), PersonalNameRecord) + End Function + + ' Convenience method for getting a record using a KeyValue record identifier + Public Shared Function GetRecord(ByVal id As KeyValue, ByVal bMutable As Boolean) As PersonalNameRecord + Return CType(PersonalNameTable.Instance.GetRecordData(id, bMutable), PersonalNameRecord) + End Function + + ' Convenience method for creating a record + Public Overloads Function NewRecord( _ + ByVal PersonalIdValue As String, _ + ByVal PersonalNameValue As String, _ + ByVal PersonalLastNameValue As String, _ + ByVal NameDateValue As String, _ + ByVal Ref0Value As String _ + ) As KeyValue + Dim rec As IPrimaryKeyRecord = CType(Me.CreateRecord(), IPrimaryKeyRecord) + rec.SetString(PersonalIdValue, PersonalIdColumn) + rec.SetString(PersonalNameValue, PersonalNameColumn) + rec.SetString(PersonalLastNameValue, PersonalLastNameColumn) + rec.SetString(NameDateValue, NameDateColumn) + rec.SetString(Ref0Value, Ref0Column) + + + rec.Create() 'update the DB so any DB-initialized fields (like autoincrement IDs) can be initialized + + Dim key As KeyValue = rec.GetID() + Return key + End Function + + ''' + ''' This method deletes a specified record + ''' + ''' Keyvalue of the record to be deleted. + Public Shared Sub DeleteRecord(ByVal kv As KeyValue) + PersonalNameTable.Instance.DeleteOneRecord(kv) + End Sub + + ''' + ''' This method checks if record exist in the database using the keyvalue provided. + ''' + ''' Key value of the record. + Public Shared Function DoesRecordExist(ByVal kv As KeyValue) As Boolean + Dim recordExist As Boolean = True + Try + PersonalNameTable.GetRecord(kv, False) + Catch ex As Exception + recordExist = False + End Try + Return recordExist + End Function + + ''' + ''' This method returns all the primary columns in the table. + ''' + Public Shared Function GetPrimaryKeyColumns() As ColumnList + If (Not IsNothing(PersonalNameTable.Instance.TableDefinition.PrimaryKey)) Then + Return PersonalNameTable.Instance.TableDefinition.PrimaryKey.Columns + Else + Return Nothing + End If + End Function + + ''' + ''' This method takes a key and returns a keyvalue. + ''' + ''' key could be array of primary key values in case of composite primary key or a string containing single primary key value in case of non-composite primary key. + Public Shared Function GetKeyValue(ByVal key As Object) As KeyValue + Dim kv As KeyValue = Nothing + + If (Not (IsNothing(PersonalNameTable.Instance.TableDefinition.PrimaryKey))) Then + + Dim isCompositePrimaryKey As Boolean = False + isCompositePrimaryKey = PersonalNameTable.Instance.TableDefinition.PrimaryKey.IsCompositeKey + + If ((isCompositePrimaryKey) AndAlso (key.GetType.IsArray())) Then + + ' If the key is composite, then construct a key value. + kv = New KeyValue + Dim fullKeyString As String = "" + Dim keyArray As Array = CType(key, Array) + If (Not IsNothing(keyArray)) Then + Dim length As Integer = keyArray.Length + Dim pkColumns As ColumnList = PersonalNameTable.Instance.TableDefinition.PrimaryKey.Columns + Dim pkColumn As BaseColumn + Dim index As Integer = 0 + For Each pkColumn In pkColumns + Dim keyString As String = CType(keyArray.GetValue(index), String) + If (PersonalNameTable.Instance.TableDefinition.TableType = BaseClasses.Data.TableDefinition.TableTypes.Virtual) Then + kv.AddElement(pkColumn.UniqueName, keyString) + Else + kv.AddElement(pkColumn.InternalName, keyString) + End If + index = index + 1 + Next pkColumn + End If + + Else + ' If the key is not composite, then get the key value. + kv = PersonalNameTable.Instance.TableDefinition.PrimaryKey.ParseValue(CType(key, String)) + End If + End If + Return kv + End Function + + + ''' + ''' This method takes a record and a Column and returns an evaluated value of DFKA formula. + ''' + Public Shared Function GetDFKA(ByVal rec As BaseRecord, ByVal col As BaseColumn) As String + Dim fkColumn As ForeignKey = PersonalNameTable.Instance.TableDefinition.GetExpandableNonCompositeForeignKey(col) + If fkColumn Is Nothing Then + Return Nothing + End If + Dim _DFKA As String = fkColumn.PrimaryKeyDisplayColumns + If (_DFKA.Trim().StartsWith("=")) Then + ' if the formula is in the format of "= ., then pull out the data from the rec object instead of doing formula evaluation + Dim tableCodeName As String = fkColumn.PrimaryKeyTableDefinition.TableCodeName + Dim column As String = _DFKA.Trim("="c).Trim() + If column.StartsWith(tableCodeName & ".", StringComparison.InvariantCultureIgnoreCase) Then + column = column.Substring(tableCodeName.Length + 1) + End If + + For Each c As BaseColumn In fkColumn.PrimaryKeyTableDefinition.Columns + If column = c.CodeName Then + Return rec.Format(c) + End If + Next + Dim tableName As String = fkColumn.PrimaryKeyTableDefinition.TableCodeName + Return EvaluateFormula(_DFKA, rec, Nothing, tableName) + Else + Return Nothing + End If + End Function + + ''' + ''' This method takes a keyValue and a Column and returns an evaluated value of DFKA formula. + ''' + Public Shared Function GetDFKA(ByVal keyValue As String, ByVal col As BaseColumn, ByVal formatPattern as String) As String + If keyValue Is Nothing Then + Return Nothing + End If + Dim fkColumn As ForeignKey = PersonalNameTable.Instance.TableDefinition.GetExpandableNonCompositeForeignKey(col) + If fkColumn Is Nothing Then + Return Nothing + End If + Dim _DFKA As String = fkColumn.PrimaryKeyDisplayColumns + If (_DFKA.Trim().StartsWith("=")) Then + Dim tableName As String = fkColumn.PrimaryKeyTableDefinition.TableCodeName + Dim t As PrimaryKeyTable = CType(DatabaseObjects.GetTableObject(tableName), PrimaryKeyTable) + Dim rec As BaseRecord = Nothing + If Not t Is Nothing Then + Try + rec = CType(t.GetRecordData(keyValue, False), BaseRecord) + Catch + rec = Nothing + End Try + End If + If rec Is Nothing Then + Return "" + End If + + ' if the formula is in the format of "= ., then pull out the data from the rec object instead of doing formula evaluation + Dim tableCodeName As String = fkColumn.PrimaryKeyTableDefinition.TableCodeName + Dim column As String = _DFKA.Trim("="c).Trim() + If column.StartsWith(tableCodeName & ".", StringComparison.InvariantCultureIgnoreCase) Then + column = column.Substring(tableCodeName.Length + 1) + End If + + For Each c As BaseColumn In fkColumn.PrimaryKeyTableDefinition.Columns + If column = c.CodeName Then + Return rec.Format(c) + End If + Next + Return EvaluateFormula(_DFKA, rec, Nothing, tableName) + Else + Return Nothing + End If + End Function + + ''' + ''' Evaluates the formula + ''' + Public Shared Function EvaluateFormula(ByVal formula As String, Optional ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord = Nothing, Optional ByVal format As String = Nothing, Optional ByVal name As String = "") As String + Dim e As BaseFormulaEvaluator = New BaseFormulaEvaluator() + If Not dataSourceForEvaluate Is Nothing Then + e.Evaluator.Variables.Add(name, dataSourceForEvaluate) + end if + e.DataSource = dataSourceForEvaluate + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + If Not String.IsNullOrEmpty(format) Then + Return BaseFormulaUtils.Format(resultObj, format) + Else + Return resultObj.ToString() + End If + End Function + + +#End Region + +End Class +End Namespace diff --git a/App_Code/Business Layer/BasePersonalRankRecord.vb b/App_Code/Business Layer/BasePersonalRankRecord.vb new file mode 100644 index 0000000..d1522ad --- /dev/null +++ b/App_Code/Business Layer/BasePersonalRankRecord.vb @@ -0,0 +1,892 @@ +' This class is "generated" and will be overwritten. +' Your customizations should be made in PersonalRankRecord.vb + +Imports System.Data.SqlTypes +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + +Namespace Persons.Business + +''' +''' The generated superclass for the class. +''' +''' +''' This class is not intended to be instantiated directly. To obtain an instance of this class, +''' use the methods of the class. +''' +''' +''' + + Public Class BasePersonalRankRecord + Inherits PrimaryKeyRecord + + + Public Shared Shadows ReadOnly TableUtils As PersonalRankTable = PersonalRankTable.Instance + + ' Constructors + + Protected Sub New() + MyBase.New(TableUtils) + End Sub + + Protected Sub New(ByVal record As PrimaryKeyRecord) + MyBase.New(record, TableUtils) + End Sub + + 'Evaluates Initialize when->Inserting record formulas specified at the data access layer + Public Overridable Sub PersonalRankRecord_InsertingRecord(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles Me.InsertingRecord + 'Apply Initialize->Inserting record formula only if validation is successful. + Dim PersonalRankRec As PersonalRankRecord = CType(sender,PersonalRankRecord) + Validate_Inserting() + If Not PersonalRankRec Is Nothing AndAlso Not PersonalRankRec.IsReadOnly Then + End If + End Sub + + 'Evaluates Initialize when->Updating record formulas specified at the data access layer + Public Overridable Sub PersonalRankRecord_UpdatingRecord(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles Me.UpdatingRecord + 'Apply Initialize->Updating record formula only if validation is successful. + Dim PersonalRankRec As PersonalRankRecord = CType(sender,PersonalRankRecord) + Validate_Updating() + If Not PersonalRankRec Is Nothing AndAlso Not PersonalRankRec.IsReadOnly Then + End If + End Sub + + 'Evaluates Initialize when->Reading record formulas specified at the data access layer + Public Overridable Sub PersonalRankRecord_ReadRecord(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.ReadRecord + 'Apply Initialize->Reading record formula only if validation is successful. + Dim PersonalRankRec As PersonalRankRecord = CType(sender,PersonalRankRecord) + If Not PersonalRankRec Is Nothing AndAlso Not PersonalRankRec.IsReadOnly Then + End If + End Sub + + 'Evaluates Validate when->Inserting formulas specified at the data access layer + Public Overridable Sub Validate_Inserting () + Dim fullValidationMessage As String = "" + Dim validationMessage As String = "" + + dim formula as String = "" + + + If validationMessage <> "" AndAlso validationMessage.ToLower() <> "true" Then + fullValidationMessage &= validationMessage & vbCrLf + End If + + If fullValidationMessage <> "" Then + Throw New Exception(fullValidationMessage) + End If + End Sub + + 'Evaluates Validate when->Updating formulas specified at the data access layer + Public Overridable Sub Validate_Updating () + Dim fullValidationMessage As String = "" + Dim validationMessage As String = "" + + dim formula as String = "" + + + If validationMessage <> "" AndAlso validationMessage.ToLower() <> "true" Then + fullValidationMessage &= validationMessage & vbCrLf + End If + + If fullValidationMessage <> "" Then + Throw New Exception(fullValidationMessage) + End If + End Sub + + Public Overridable Function EvaluateFormula(ByVal formula As String, Optional ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord = Nothing, Optional ByVal format As String = Nothing) As String + + Dim e As Data.BaseFormulaEvaluator = New Data.BaseFormulaEvaluator() + + ' All variables referred to in the formula are expected to be + ' properties of the DataSource. For example, referring to + ' UnitPrice as a variable will refer to DataSource.UnitPrice + e.DataSource = dataSourceForEvaluate + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + Return resultObj.ToString() + End Function + + + + + + + +#Region "Convenience methods to get/set values of fields" + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalRank_.id field. + ''' + Public Function Getid0Value() As ColumnValue + Return Me.GetValue(TableUtils.id0Column) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalRank_.id field. + ''' + Public Function Getid0FieldValue() As Int32 + Return CType(Me.GetValue(TableUtils.id0Column).ToInt32(), Int32) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalRank_.PersonalId field. + ''' + Public Function GetPersonalIdValue() As ColumnValue + Return Me.GetValue(TableUtils.PersonalIdColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalRank_.PersonalId field. + ''' + Public Function GetPersonalIdFieldValue() As String + Return CType(Me.GetValue(TableUtils.PersonalIdColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalRank_.PersonalId field. + ''' + Public Sub SetPersonalIdFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.PersonalIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalRank_.PersonalId field. + ''' + Public Sub SetPersonalIdFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.PersonalIdColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalRank_.PreRank field. + ''' + Public Function GetPreRankValue() As ColumnValue + Return Me.GetValue(TableUtils.PreRankColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalRank_.PreRank field. + ''' + Public Function GetPreRankFieldValue() As Byte + Return CType(Me.GetValue(TableUtils.PreRankColumn).ToByte(), Byte) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalRank_.PreRank field. + ''' + Public Sub SetPreRankFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.PreRankColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalRank_.PreRank field. + ''' + Public Sub SetPreRankFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.PreRankColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalRank_.PreRank field. + ''' + Public Sub SetPreRankFieldValue(ByVal val As Double) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.PreRankColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalRank_.PreRank field. + ''' + Public Sub SetPreRankFieldValue(ByVal val As Decimal) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.PreRankColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalRank_.PreRank field. + ''' + Public Sub SetPreRankFieldValue(ByVal val As Int64) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.PreRankColumn) + End Sub + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalRank_.RankId field. + ''' + Public Function GetRankIdValue() As ColumnValue + Return Me.GetValue(TableUtils.RankIdColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalRank_.RankId field. + ''' + Public Function GetRankIdFieldValue() As Int32 + Return CType(Me.GetValue(TableUtils.RankIdColumn).ToInt32(), Int32) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalRank_.RankId field. + ''' + Public Sub SetRankIdFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.RankIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalRank_.RankId field. + ''' + Public Sub SetRankIdFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.RankIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalRank_.RankId field. + ''' + Public Sub SetRankIdFieldValue(ByVal val As Double) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.RankIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalRank_.RankId field. + ''' + Public Sub SetRankIdFieldValue(ByVal val As Decimal) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.RankIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalRank_.RankId field. + ''' + Public Sub SetRankIdFieldValue(ByVal val As Int64) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.RankIdColumn) + End Sub + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalRank_.RankDate field. + ''' + Public Function GetRankDateValue() As ColumnValue + Return Me.GetValue(TableUtils.RankDateColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalRank_.RankDate field. + ''' + Public Function GetRankDateFieldValue() As DateTime + Return CType(Me.GetValue(TableUtils.RankDateColumn).ToDateTime(), DateTime) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalRank_.RankDate field. + ''' + Public Sub SetRankDateFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.RankDateColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalRank_.RankDate field. + ''' + Public Sub SetRankDateFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.RankDateColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalRank_.RankDate field. + ''' + Public Sub SetRankDateFieldValue(ByVal val As DateTime) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.RankDateColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalRank_.RefDate field. + ''' + Public Function GetRefDateValue() As ColumnValue + Return Me.GetValue(TableUtils.RefDateColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalRank_.RefDate field. + ''' + Public Function GetRefDateFieldValue() As DateTime + Return CType(Me.GetValue(TableUtils.RefDateColumn).ToDateTime(), DateTime) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalRank_.RefDate field. + ''' + Public Sub SetRefDateFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.RefDateColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalRank_.RefDate field. + ''' + Public Sub SetRefDateFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.RefDateColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalRank_.RefDate field. + ''' + Public Sub SetRefDateFieldValue(ByVal val As DateTime) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.RefDateColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalRank_.Ref field. + ''' + Public Function GetRef0Value() As ColumnValue + Return Me.GetValue(TableUtils.Ref0Column) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalRank_.Ref field. + ''' + Public Function GetRef0FieldValue() As String + Return CType(Me.GetValue(TableUtils.Ref0Column).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalRank_.Ref field. + ''' + Public Sub SetRef0FieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.Ref0Column) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalRank_.Ref field. + ''' + Public Sub SetRef0FieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.Ref0Column) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalRank_.GazetteNO field. + ''' + Public Function GetGazetteNOValue() As ColumnValue + Return Me.GetValue(TableUtils.GazetteNOColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalRank_.GazetteNO field. + ''' + Public Function GetGazetteNOFieldValue() As String + Return CType(Me.GetValue(TableUtils.GazetteNOColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalRank_.GazetteNO field. + ''' + Public Sub SetGazetteNOFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.GazetteNOColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalRank_.GazetteNO field. + ''' + Public Sub SetGazetteNOFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.GazetteNOColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalRank_.GazetteSection field. + ''' + Public Function GetGazetteSectionValue() As ColumnValue + Return Me.GetValue(TableUtils.GazetteSectionColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalRank_.GazetteSection field. + ''' + Public Function GetGazetteSectionFieldValue() As String + Return CType(Me.GetValue(TableUtils.GazetteSectionColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalRank_.GazetteSection field. + ''' + Public Sub SetGazetteSectionFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.GazetteSectionColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalRank_.GazetteSection field. + ''' + Public Sub SetGazetteSectionFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.GazetteSectionColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalRank_.GazettePage field. + ''' + Public Function GetGazettePageValue() As ColumnValue + Return Me.GetValue(TableUtils.GazettePageColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalRank_.GazettePage field. + ''' + Public Function GetGazettePageFieldValue() As String + Return CType(Me.GetValue(TableUtils.GazettePageColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalRank_.GazettePage field. + ''' + Public Sub SetGazettePageFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.GazettePageColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalRank_.GazettePage field. + ''' + Public Sub SetGazettePageFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.GazettePageColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalRank_.GazetteDate field. + ''' + Public Function GetGazetteDateValue() As ColumnValue + Return Me.GetValue(TableUtils.GazetteDateColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalRank_.GazetteDate field. + ''' + Public Function GetGazetteDateFieldValue() As DateTime + Return CType(Me.GetValue(TableUtils.GazetteDateColumn).ToDateTime(), DateTime) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalRank_.GazetteDate field. + ''' + Public Sub SetGazetteDateFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.GazetteDateColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalRank_.GazetteDate field. + ''' + Public Sub SetGazetteDateFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.GazetteDateColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalRank_.GazetteDate field. + ''' + Public Sub SetGazetteDateFieldValue(ByVal val As DateTime) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.GazetteDateColumn) + End Sub + + + +#End Region + +#Region "Convenience methods to get field names" + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonalRank_.id field. + ''' + Public Property id0() As Int32 + Get + Return CType(Me.GetValue(TableUtils.id0Column).ToInt32(), Int32) + End Get + Set (ByVal val As Int32) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.id0Column) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property id0Specified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.id0Column) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property id0Default() As String + Get + Return TableUtils.id0Column.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonalRank_.PersonalId field. + ''' + Public Property PersonalId() As String + Get + Return CType(Me.GetValue(TableUtils.PersonalIdColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.PersonalIdColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property PersonalIdSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.PersonalIdColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property PersonalIdDefault() As String + Get + Return TableUtils.PersonalIdColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonalRank_.PreRank field. + ''' + Public Property PreRank() As Byte + Get + Return CType(Me.GetValue(TableUtils.PreRankColumn).ToByte(), Byte) + End Get + Set (ByVal val As Byte) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.PreRankColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property PreRankSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.PreRankColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property PreRankDefault() As String + Get + Return TableUtils.PreRankColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonalRank_.RankId field. + ''' + Public Property RankId() As Int32 + Get + Return CType(Me.GetValue(TableUtils.RankIdColumn).ToInt32(), Int32) + End Get + Set (ByVal val As Int32) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.RankIdColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property RankIdSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.RankIdColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property RankIdDefault() As String + Get + Return TableUtils.RankIdColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonalRank_.RankDate field. + ''' + Public Property RankDate() As DateTime + Get + Return CType(Me.GetValue(TableUtils.RankDateColumn).ToDateTime(), DateTime) + End Get + Set (ByVal val As DateTime) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.RankDateColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property RankDateSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.RankDateColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property RankDateDefault() As String + Get + Return TableUtils.RankDateColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonalRank_.RefDate field. + ''' + Public Property RefDate() As DateTime + Get + Return CType(Me.GetValue(TableUtils.RefDateColumn).ToDateTime(), DateTime) + End Get + Set (ByVal val As DateTime) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.RefDateColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property RefDateSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.RefDateColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property RefDateDefault() As String + Get + Return TableUtils.RefDateColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonalRank_.Ref field. + ''' + Public Property Ref0() As String + Get + Return CType(Me.GetValue(TableUtils.Ref0Column).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.Ref0Column) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property Ref0Specified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.Ref0Column) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property Ref0Default() As String + Get + Return TableUtils.Ref0Column.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonalRank_.GazetteNO field. + ''' + Public Property GazetteNO() As String + Get + Return CType(Me.GetValue(TableUtils.GazetteNOColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.GazetteNOColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property GazetteNOSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.GazetteNOColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property GazetteNODefault() As String + Get + Return TableUtils.GazetteNOColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonalRank_.GazetteSection field. + ''' + Public Property GazetteSection() As String + Get + Return CType(Me.GetValue(TableUtils.GazetteSectionColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.GazetteSectionColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property GazetteSectionSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.GazetteSectionColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property GazetteSectionDefault() As String + Get + Return TableUtils.GazetteSectionColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonalRank_.GazettePage field. + ''' + Public Property GazettePage() As String + Get + Return CType(Me.GetValue(TableUtils.GazettePageColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.GazettePageColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property GazettePageSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.GazettePageColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property GazettePageDefault() As String + Get + Return TableUtils.GazettePageColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonalRank_.GazetteDate field. + ''' + Public Property GazetteDate() As DateTime + Get + Return CType(Me.GetValue(TableUtils.GazetteDateColumn).ToDateTime(), DateTime) + End Get + Set (ByVal val As DateTime) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.GazetteDateColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property GazetteDateSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.GazetteDateColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property GazetteDateDefault() As String + Get + Return TableUtils.GazetteDateColumn.DefaultValue + End Get + End Property + + + +#End Region + +End Class +End Namespace diff --git a/App_Code/Business Layer/BasePersonalRankTable.vb b/App_Code/Business Layer/BasePersonalRankTable.vb new file mode 100644 index 0000000..42a2131 --- /dev/null +++ b/App_Code/Business Layer/BasePersonalRankTable.vb @@ -0,0 +1,974 @@ +' This class is "generated" and will be overwritten. +' Your customizations should be made in PersonalRankRecord.vb + +Imports System.Data.SqlTypes +Imports System.Data +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider +Imports Persons.Data + +Namespace Persons.Business + +''' +''' The generated superclass for the class. +''' Provides access to the schema information and record data of a database table or view named PersonalRank. +''' +''' +''' The connection details (name, location, etc.) of the database and table (or view) accessed by this class +''' are resolved at runtime based on the connection string in the application's Web.Config file. +''' +''' This class is not intended to be instantiated directly. To obtain an instance of this class, use +''' PersonalRankTable.Instance. +''' +''' +''' + + Public Class BasePersonalRankTable + Inherits PrimaryKeyTable + + + Private ReadOnly TableDefinitionString As String = PersonalRankDefinition.GetXMLString() + + + + + + + + Protected Sub New() + MyBase.New() + Me.Initialize() + End Sub + + Protected Overridable Sub Initialize() + Dim def As New XmlTableDefinition(TableDefinitionString) + Me.TableDefinition = New TableDefinition() + Me.TableDefinition.TableClassName = System.Reflection.Assembly.CreateQualifiedName("App_Code", "Persons.Business.PersonalRankTable") + def.InitializeTableDefinition(Me.TableDefinition) + Me.ConnectionName = def.GetConnectionName() + Me.RecordClassName = System.Reflection.Assembly.CreateQualifiedName("App_Code", "Persons.Business.PersonalRankRecord") + Me.ApplicationName = "App_Code" + Me.DataAdapter = New PersonalRankSqlTable() + Directcast(Me.DataAdapter, PersonalRankSqlTable).ConnectionName = Me.ConnectionName + + Me.TableDefinition.AdapterMetaData = Me.DataAdapter.AdapterMetaData + id0Column.CodeName = "id0" + PersonalIdColumn.CodeName = "PersonalId" + PreRankColumn.CodeName = "PreRank" + RankIdColumn.CodeName = "RankId" + RankDateColumn.CodeName = "RankDate" + RefDateColumn.CodeName = "RefDate" + Ref0Column.CodeName = "Ref0" + GazetteNOColumn.CodeName = "GazetteNO" + GazetteSectionColumn.CodeName = "GazetteSection" + GazettePageColumn.CodeName = "GazettePage" + GazetteDateColumn.CodeName = "GazetteDate" + + End Sub + +#Region "Overriden methods" + + +#End Region + +#Region "Properties for columns" + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalRank_.id column object. + ''' + Public ReadOnly Property id0Column() As BaseClasses.Data.NumberColumn + Get + Return CType(Me.TableDefinition.ColumnList(0), BaseClasses.Data.NumberColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalRank_.id column object. + ''' + Public Shared ReadOnly Property id0() As BaseClasses.Data.NumberColumn + Get + Return PersonalRankTable.Instance.id0Column + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonalRank_.PersonalId column object. + ''' + Public ReadOnly Property PersonalIdColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(1), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalRank_.PersonalId column object. + ''' + Public Shared ReadOnly Property PersonalId() As BaseClasses.Data.StringColumn + Get + Return PersonalRankTable.Instance.PersonalIdColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonalRank_.PreRank column object. + ''' + Public ReadOnly Property PreRankColumn() As BaseClasses.Data.NumberColumn + Get + Return CType(Me.TableDefinition.ColumnList(2), BaseClasses.Data.NumberColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalRank_.PreRank column object. + ''' + Public Shared ReadOnly Property PreRank() As BaseClasses.Data.NumberColumn + Get + Return PersonalRankTable.Instance.PreRankColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonalRank_.RankId column object. + ''' + Public ReadOnly Property RankIdColumn() As BaseClasses.Data.NumberColumn + Get + Return CType(Me.TableDefinition.ColumnList(3), BaseClasses.Data.NumberColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalRank_.RankId column object. + ''' + Public Shared ReadOnly Property RankId() As BaseClasses.Data.NumberColumn + Get + Return PersonalRankTable.Instance.RankIdColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonalRank_.RankDate column object. + ''' + Public ReadOnly Property RankDateColumn() As BaseClasses.Data.DateColumn + Get + Return CType(Me.TableDefinition.ColumnList(4), BaseClasses.Data.DateColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalRank_.RankDate column object. + ''' + Public Shared ReadOnly Property RankDate() As BaseClasses.Data.DateColumn + Get + Return PersonalRankTable.Instance.RankDateColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonalRank_.RefDate column object. + ''' + Public ReadOnly Property RefDateColumn() As BaseClasses.Data.DateColumn + Get + Return CType(Me.TableDefinition.ColumnList(5), BaseClasses.Data.DateColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalRank_.RefDate column object. + ''' + Public Shared ReadOnly Property RefDate() As BaseClasses.Data.DateColumn + Get + Return PersonalRankTable.Instance.RefDateColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonalRank_.Ref column object. + ''' + Public ReadOnly Property Ref0Column() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(6), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalRank_.Ref column object. + ''' + Public Shared ReadOnly Property Ref0() As BaseClasses.Data.StringColumn + Get + Return PersonalRankTable.Instance.Ref0Column + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonalRank_.GazetteNO column object. + ''' + Public ReadOnly Property GazetteNOColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(7), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalRank_.GazetteNO column object. + ''' + Public Shared ReadOnly Property GazetteNO() As BaseClasses.Data.StringColumn + Get + Return PersonalRankTable.Instance.GazetteNOColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonalRank_.GazetteSection column object. + ''' + Public ReadOnly Property GazetteSectionColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(8), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalRank_.GazetteSection column object. + ''' + Public Shared ReadOnly Property GazetteSection() As BaseClasses.Data.StringColumn + Get + Return PersonalRankTable.Instance.GazetteSectionColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonalRank_.GazettePage column object. + ''' + Public ReadOnly Property GazettePageColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(9), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalRank_.GazettePage column object. + ''' + Public Shared ReadOnly Property GazettePage() As BaseClasses.Data.StringColumn + Get + Return PersonalRankTable.Instance.GazettePageColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonalRank_.GazetteDate column object. + ''' + Public ReadOnly Property GazetteDateColumn() As BaseClasses.Data.DateColumn + Get + Return CType(Me.TableDefinition.ColumnList(10), BaseClasses.Data.DateColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalRank_.GazetteDate column object. + ''' + Public Shared ReadOnly Property GazetteDate() As BaseClasses.Data.DateColumn + Get + Return PersonalRankTable.Instance.GazetteDateColumn + End Get + End Property + + +#End Region + + +#Region "Shared helper methods" + + ''' + ''' This is a shared function that can be used to get an array of PersonalRankRecord records using a where clause. + ''' + Public Shared Function GetRecords(ByVal where As String) As PersonalRankRecord() + + Return GetRecords(where, Nothing, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) + End Function + + ''' + ''' This is a shared function that can be used to get an array of PersonalRankRecord records using a where clause. + ''' + Public Shared Function GetRecords(ByVal join As BaseFilter, ByVal where As String) As PersonalRankRecord() + + Return GetRecords(join, where, Nothing, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) + End Function + + ''' + ''' This is a shared function that can be used to get an array of PersonalRankRecord records using a where and order by clause. + ''' + Public Shared Function GetRecords( _ + ByVal where As String, _ + ByVal orderBy As OrderBy) As PersonalRankRecord() + + Return GetRecords(where, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) + End Function + + ''' + ''' This is a shared function that can be used to get an array of PersonalRankRecord records using a where and order by clause. + ''' + Public Shared Function GetRecords( _ + ByVal join As BaseFilter, _ + ByVal where As String, _ + ByVal orderBy As OrderBy) As PersonalRankRecord() + + Return GetRecords(join, where, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) + End Function + + ''' + ''' This is a shared function that can be used to get an array of PersonalRankRecord records using a where and order by clause clause with pagination. + ''' + Public Shared Function GetRecords( _ + ByVal where As String, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As PersonalRankRecord() + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + Dim join As BaseClasses.Data.BaseFilter = Nothing + Dim recList As ArrayList = PersonalRankTable.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, pageIndex, pageSize) + + Return CType(recList.ToArray(GetType(Persons.Business.PersonalRankRecord)), PersonalRankRecord()) + End Function + + ''' + ''' This is a shared function that can be used to get an array of PersonalRankRecord records using a where and order by clause clause with pagination. + ''' + Public Shared Function GetRecords( _ + ByVal join As BaseFilter, _ + ByVal where As String, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As PersonalRankRecord() + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Dim recList As ArrayList = PersonalRankTable.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, pageIndex, pageSize) + + Return CType(recList.ToArray(GetType(Persons.Business.PersonalRankRecord)), PersonalRankRecord()) + End Function + + Public Shared Function GetRecords( _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As PersonalRankRecord() + Dim join As BaseClasses.Data.BaseFilter = Nothing + Dim recList As ArrayList = PersonalRankTable.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + Return CType(recList.ToArray(GetType(Persons.Business.PersonalRankRecord)), PersonalRankRecord()) + End Function + + Public Shared Function GetRecords( _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As PersonalRankRecord() + + Dim recList As ArrayList = PersonalRankTable.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + Return CType(recList.ToArray(GetType(Persons.Business.PersonalRankRecord)), PersonalRankRecord()) + End Function + + Public Shared Function GetRecords( _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer, _ + ByRef totalRecords As Integer) As PersonalRankRecord() + Dim join As BaseClasses.Data.BaseFilter = Nothing + Dim recList As ArrayList = PersonalRankTable.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize, totalRecords) + + Return CType(recList.ToArray(GetType(Persons.Business.PersonalRankRecord)), PersonalRankRecord()) + End Function + + Public Shared Function GetRecords( _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer, _ + ByRef totalRecords As Integer) As PersonalRankRecord() + + Dim recList As ArrayList = PersonalRankTable.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize, totalRecords) + + Return CType(recList.ToArray(GetType(Persons.Business.PersonalRankRecord)), PersonalRankRecord()) + End Function + + ''' + ''' This is a shared function that can be used to get total number of records that will be returned using the where clause. + ''' + Public Shared Function GetRecordCount(ByVal where As String) As Integer + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Return CInt(PersonalRankTable.Instance.GetRecordListCount(Nothing, whereFilter, Nothing, Nothing)) + End Function + +''' + ''' This is a shared function that can be used to get total number of records that will be returned using the where clause. + ''' + Public Shared Function GetRecordCount(ByVal join As BaseFilter, ByVal where As String) As Integer + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Return CInt(PersonalRankTable.Instance.GetRecordListCount(join, whereFilter, Nothing, Nothing)) + End Function + + Public Shared Function GetRecordCount(ByVal where As WhereClause) As Integer + Return CInt(PersonalRankTable.Instance.GetRecordListCount(Nothing, where.GetFilter(), Nothing, Nothing)) + End Function + + Public Shared Function GetRecordCount(ByVal join As BaseFilter, ByVal where As WhereClause) As Integer + Return CInt(PersonalRankTable.Instance.GetRecordListCount(join, where.GetFilter(), Nothing, Nothing)) + End Function + + ''' + ''' This is a shared function that can be used to get a PersonalRankRecord record using a where clause. + ''' + Public Shared Function GetRecord(ByVal where As String) As PersonalRankRecord + Dim orderBy As OrderBy = Nothing + Return GetRecord(where, orderBy) + End Function + + ''' + ''' This is a shared function that can be used to get a PersonalRankRecord record using a where clause. + ''' + Public Shared Function GetRecord(ByVal join As BaseFilter, ByVal where As String) As PersonalRankRecord + Dim orderBy As OrderBy = Nothing + Return GetRecord(join, where, orderBy) + End Function + + ''' + ''' This is a shared function that can be used to get a PersonalRankRecord record using a where and order by clause. + ''' + Public Shared Function GetRecord( _ + ByVal where As String, _ + ByVal orderBy As OrderBy) As PersonalRankRecord + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + Dim join As BaseClasses.Data.BaseFilter = Nothing + Dim recList As ArrayList = PersonalRankTable.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MIN_BATCH_SIZE) + + Dim rec As PersonalRankRecord = Nothing + If recList.Count > 0 Then + rec = CType(recList(0), PersonalRankRecord) + End If + + Return rec + End Function + + ''' + ''' This is a shared function that can be used to get a PersonalRankRecord record using a where and order by clause. + ''' + Public Shared Function GetRecord( _ + ByVal join As BaseFilter, _ + ByVal where As String, _ + ByVal orderBy As OrderBy) As PersonalRankRecord + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Dim recList As ArrayList = PersonalRankTable.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MIN_BATCH_SIZE) + + Dim rec As PersonalRankRecord = Nothing + If recList.Count > 0 Then + rec = CType(recList(0), PersonalRankRecord) + End If + + Return rec + End Function + + + Public Shared Function GetValues( _ + ByVal col As BaseColumn, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal maxItems As Integer) As String() + + ' Create the filter list. + Dim retCol As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, True) + retCol.AddColumn(col) + + Return PersonalRankTable.Instance.GetColumnValues(retCol, Nothing, where.GetFilter(), Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, maxItems) + + End Function + + Public Shared Function GetValues( _ + ByVal col As BaseColumn, _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal maxItems As Integer) As String() + + ' Create the filter list. + Dim retCol As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, True) + retCol.AddColumn(col) + + Return PersonalRankTable.Instance.GetColumnValues(retCol, join, where.GetFilter(), Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, maxItems) + + End Function + + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where clause. + ''' + Public Shared Function GetDataTable(ByVal where As String) As System.Data.DataTable + + Dim recs() As PersonalRankRecord = GetRecords(where) + Return PersonalRankTable.Instance.CreateDataTable(recs, Nothing) + End Function + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where clause. + ''' + Public Shared Function GetDataTable(ByVal join As BaseFilter, ByVal where As String) As System.Data.DataTable + + Dim recs() As PersonalRankRecord = GetRecords(join, where) + Return PersonalRankTable.Instance.CreateDataTable(recs, Nothing) + End Function + + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause. + ''' + Public Shared Function GetDataTable(ByVal where As String, ByVal orderBy As OrderBy) As System.Data.DataTable + + Dim recs() As PersonalRankRecord = GetRecords(where, orderBy) + Return PersonalRankTable.Instance.CreateDataTable(recs, Nothing) + End Function + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause. + ''' + Public Shared Function GetDataTable(ByVal join As BaseFilter, ByVal where As String, ByVal orderBy As OrderBy) As System.Data.DataTable + + Dim recs() As PersonalRankRecord = GetRecords(join, where, orderBy) + Return PersonalRankTable.Instance.CreateDataTable(recs, Nothing) + End Function + + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause with pagination. + ''' + Public Shared Function GetDataTable( _ + ByVal where As String, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As System.Data.DataTable + + Dim recs() As PersonalRankRecord = GetRecords(where, orderBy, pageIndex, pageSize) + Return PersonalRankTable.Instance.CreateDataTable(recs, Nothing) + End Function + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause with pagination. + ''' + Public Shared Function GetDataTable( _ + ByVal join As BaseFilter, _ + ByVal where As String, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As System.Data.DataTable + + Dim recs() As PersonalRankRecord = GetRecords(join, where, orderBy, pageIndex, pageSize) + Return PersonalRankTable.Instance.CreateDataTable(recs, Nothing) + End Function + + + ''' + ''' This is a shared function that can be used to delete records using a where clause. + ''' + Public Shared Sub DeleteRecords(ByVal where As String) + If where = Nothing OrElse where.Trim() = "" Then + Return + End If + + Dim whereFilter As SqlFilter = New SqlFilter(where) + PersonalRankTable.Instance.DeleteRecordList(whereFilter) + End Sub + + ''' + ''' This is a shared function that can be used to export records using a where clause. + ''' + Public Shared Function Export(ByVal where As String) As String + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Return PersonalRankTable.Instance.ExportRecordData(whereFilter) + End Function + + Public Shared Function Export(ByVal where As WhereClause) As String + Dim whereFilter As BaseFilter = Nothing + If Not where Is Nothing Then + whereFilter = where.GetFilter() + End If + + Return PersonalRankTable.Instance.ExportRecordData(whereFilter) + End Function + + Public Shared Function GetSum( _ + ByVal col As BaseColumn, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) _ + As String + + Dim colSel As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, False) + colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Sum) + + Return PersonalRankTable.Instance.GetColumnStatistics(colSel, Nothing, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + End Function + + Public Shared Function GetSum( _ + ByVal col As BaseColumn, _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) _ + As String + + Dim colSel As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, False) + colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Sum) + + Return PersonalRankTable.Instance.GetColumnStatistics(colSel, join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + End Function + + + Public Shared Function GetCount( _ + ByVal col As BaseColumn, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) _ + As String + + Dim colSel As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, False) + colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Count) + + Return PersonalRankTable.Instance.GetColumnStatistics(colSel, Nothing, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + End Function + + Public Shared Function GetCount( _ + ByVal col As BaseColumn, _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) _ + As String + + Dim colSel As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, False) + colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Count) + + Return PersonalRankTable.Instance.GetColumnStatistics(colSel, join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + End Function + + ''' + ''' This method returns the columns in the table. + ''' + Public Shared Function GetColumns() As BaseColumn() + Return PersonalRankTable.Instance.TableDefinition.Columns + End Function + + ''' + ''' This method returns the columnlist in the table. + ''' + Public Shared Function GetColumnList() As ColumnList + Return PersonalRankTable.Instance.TableDefinition.ColumnList + End Function + + + ''' + ''' This method creates a new record and returns it to be edited. + ''' + Public Shared Function CreateNewRecord() As IRecord + Return PersonalRankTable.Instance.CreateRecord() + End Function + + ''' + ''' This method creates a new record and returns it to be edited. + ''' + ''' ID of the new record. + Public Shared Function CreateNewRecord(ByVal tempId As String) As IRecord + Return PersonalRankTable.Instance.CreateRecord(tempId) + End Function + + ''' + ''' This method checks if column is editable. + ''' + ''' Name of the column to check. + Public Shared Function isReadOnlyColumn(ByVal columnName As String) As Boolean + Dim column As BaseColumn = GetColumn(columnName) + If (Not IsNothing(column)) Then + Return column.IsValuesReadOnly + Else + Return True + End If + End Function + + ''' + ''' This method gets the specified column. + ''' + ''' Unique name of the column to fetch. + Public Shared Function GetColumn(ByVal uniqueColumnName As String) As BaseColumn + Dim column As BaseColumn = PersonalRankTable.Instance.TableDefinition.ColumnList.GetByUniqueName(uniqueColumnName) + Return column + End Function + + ' Convenience method for getting a record using a string-based record identifier + Public Shared Function GetRecord(ByVal id As String, ByVal bMutable As Boolean) As PersonalRankRecord + Return CType(PersonalRankTable.Instance.GetRecordData(id, bMutable), PersonalRankRecord) + End Function + + ' Convenience method for getting a record using a KeyValue record identifier + Public Shared Function GetRecord(ByVal id As KeyValue, ByVal bMutable As Boolean) As PersonalRankRecord + Return CType(PersonalRankTable.Instance.GetRecordData(id, bMutable), PersonalRankRecord) + End Function + + ' Convenience method for creating a record + Public Overloads Function NewRecord( _ + ByVal PersonalIdValue As String, _ + ByVal PreRankValue As String, _ + ByVal RankIdValue As String, _ + ByVal RankDateValue As String, _ + ByVal RefDateValue As String, _ + ByVal Ref0Value As String, _ + ByVal GazetteNOValue As String, _ + ByVal GazetteSectionValue As String, _ + ByVal GazettePageValue As String, _ + ByVal GazetteDateValue As String _ + ) As KeyValue + Dim rec As IPrimaryKeyRecord = CType(Me.CreateRecord(), IPrimaryKeyRecord) + rec.SetString(PersonalIdValue, PersonalIdColumn) + rec.SetString(PreRankValue, PreRankColumn) + rec.SetString(RankIdValue, RankIdColumn) + rec.SetString(RankDateValue, RankDateColumn) + rec.SetString(RefDateValue, RefDateColumn) + rec.SetString(Ref0Value, Ref0Column) + rec.SetString(GazetteNOValue, GazetteNOColumn) + rec.SetString(GazetteSectionValue, GazetteSectionColumn) + rec.SetString(GazettePageValue, GazettePageColumn) + rec.SetString(GazetteDateValue, GazetteDateColumn) + + + rec.Create() 'update the DB so any DB-initialized fields (like autoincrement IDs) can be initialized + + Dim key As KeyValue = rec.GetID() + Return key + End Function + + ''' + ''' This method deletes a specified record + ''' + ''' Keyvalue of the record to be deleted. + Public Shared Sub DeleteRecord(ByVal kv As KeyValue) + PersonalRankTable.Instance.DeleteOneRecord(kv) + End Sub + + ''' + ''' This method checks if record exist in the database using the keyvalue provided. + ''' + ''' Key value of the record. + Public Shared Function DoesRecordExist(ByVal kv As KeyValue) As Boolean + Dim recordExist As Boolean = True + Try + PersonalRankTable.GetRecord(kv, False) + Catch ex As Exception + recordExist = False + End Try + Return recordExist + End Function + + ''' + ''' This method returns all the primary columns in the table. + ''' + Public Shared Function GetPrimaryKeyColumns() As ColumnList + If (Not IsNothing(PersonalRankTable.Instance.TableDefinition.PrimaryKey)) Then + Return PersonalRankTable.Instance.TableDefinition.PrimaryKey.Columns + Else + Return Nothing + End If + End Function + + ''' + ''' This method takes a key and returns a keyvalue. + ''' + ''' key could be array of primary key values in case of composite primary key or a string containing single primary key value in case of non-composite primary key. + Public Shared Function GetKeyValue(ByVal key As Object) As KeyValue + Dim kv As KeyValue = Nothing + + If (Not (IsNothing(PersonalRankTable.Instance.TableDefinition.PrimaryKey))) Then + + Dim isCompositePrimaryKey As Boolean = False + isCompositePrimaryKey = PersonalRankTable.Instance.TableDefinition.PrimaryKey.IsCompositeKey + + If ((isCompositePrimaryKey) AndAlso (key.GetType.IsArray())) Then + + ' If the key is composite, then construct a key value. + kv = New KeyValue + Dim fullKeyString As String = "" + Dim keyArray As Array = CType(key, Array) + If (Not IsNothing(keyArray)) Then + Dim length As Integer = keyArray.Length + Dim pkColumns As ColumnList = PersonalRankTable.Instance.TableDefinition.PrimaryKey.Columns + Dim pkColumn As BaseColumn + Dim index As Integer = 0 + For Each pkColumn In pkColumns + Dim keyString As String = CType(keyArray.GetValue(index), String) + If (PersonalRankTable.Instance.TableDefinition.TableType = BaseClasses.Data.TableDefinition.TableTypes.Virtual) Then + kv.AddElement(pkColumn.UniqueName, keyString) + Else + kv.AddElement(pkColumn.InternalName, keyString) + End If + index = index + 1 + Next pkColumn + End If + + Else + ' If the key is not composite, then get the key value. + kv = PersonalRankTable.Instance.TableDefinition.PrimaryKey.ParseValue(CType(key, String)) + End If + End If + Return kv + End Function + + + ''' + ''' This method takes a record and a Column and returns an evaluated value of DFKA formula. + ''' + Public Shared Function GetDFKA(ByVal rec As BaseRecord, ByVal col As BaseColumn) As String + Dim fkColumn As ForeignKey = PersonalRankTable.Instance.TableDefinition.GetExpandableNonCompositeForeignKey(col) + If fkColumn Is Nothing Then + Return Nothing + End If + Dim _DFKA As String = fkColumn.PrimaryKeyDisplayColumns + If (_DFKA.Trim().StartsWith("=")) Then + ' if the formula is in the format of "= ., then pull out the data from the rec object instead of doing formula evaluation + Dim tableCodeName As String = fkColumn.PrimaryKeyTableDefinition.TableCodeName + Dim column As String = _DFKA.Trim("="c).Trim() + If column.StartsWith(tableCodeName & ".", StringComparison.InvariantCultureIgnoreCase) Then + column = column.Substring(tableCodeName.Length + 1) + End If + + For Each c As BaseColumn In fkColumn.PrimaryKeyTableDefinition.Columns + If column = c.CodeName Then + Return rec.Format(c) + End If + Next + Dim tableName As String = fkColumn.PrimaryKeyTableDefinition.TableCodeName + Return EvaluateFormula(_DFKA, rec, Nothing, tableName) + Else + Return Nothing + End If + End Function + + ''' + ''' This method takes a keyValue and a Column and returns an evaluated value of DFKA formula. + ''' + Public Shared Function GetDFKA(ByVal keyValue As String, ByVal col As BaseColumn, ByVal formatPattern as String) As String + If keyValue Is Nothing Then + Return Nothing + End If + Dim fkColumn As ForeignKey = PersonalRankTable.Instance.TableDefinition.GetExpandableNonCompositeForeignKey(col) + If fkColumn Is Nothing Then + Return Nothing + End If + Dim _DFKA As String = fkColumn.PrimaryKeyDisplayColumns + If (_DFKA.Trim().StartsWith("=")) Then + Dim tableName As String = fkColumn.PrimaryKeyTableDefinition.TableCodeName + Dim t As PrimaryKeyTable = CType(DatabaseObjects.GetTableObject(tableName), PrimaryKeyTable) + Dim rec As BaseRecord = Nothing + If Not t Is Nothing Then + Try + rec = CType(t.GetRecordData(keyValue, False), BaseRecord) + Catch + rec = Nothing + End Try + End If + If rec Is Nothing Then + Return "" + End If + + ' if the formula is in the format of "= ., then pull out the data from the rec object instead of doing formula evaluation + Dim tableCodeName As String = fkColumn.PrimaryKeyTableDefinition.TableCodeName + Dim column As String = _DFKA.Trim("="c).Trim() + If column.StartsWith(tableCodeName & ".", StringComparison.InvariantCultureIgnoreCase) Then + column = column.Substring(tableCodeName.Length + 1) + End If + + For Each c As BaseColumn In fkColumn.PrimaryKeyTableDefinition.Columns + If column = c.CodeName Then + Return rec.Format(c) + End If + Next + Return EvaluateFormula(_DFKA, rec, Nothing, tableName) + Else + Return Nothing + End If + End Function + + ''' + ''' Evaluates the formula + ''' + Public Shared Function EvaluateFormula(ByVal formula As String, Optional ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord = Nothing, Optional ByVal format As String = Nothing, Optional ByVal name As String = "") As String + Dim e As BaseFormulaEvaluator = New BaseFormulaEvaluator() + If Not dataSourceForEvaluate Is Nothing Then + e.Evaluator.Variables.Add(name, dataSourceForEvaluate) + end if + e.DataSource = dataSourceForEvaluate + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + If Not String.IsNullOrEmpty(format) Then + Return BaseFormulaUtils.Format(resultObj, format) + Else + Return resultObj.ToString() + End If + End Function + + +#End Region + +End Class +End Namespace diff --git a/App_Code/Business Layer/BasePersonalSalaryRecord.vb b/App_Code/Business Layer/BasePersonalSalaryRecord.vb new file mode 100644 index 0000000..230983b --- /dev/null +++ b/App_Code/Business Layer/BasePersonalSalaryRecord.vb @@ -0,0 +1,1081 @@ +' This class is "generated" and will be overwritten. +' Your customizations should be made in PersonalSalaryRecord.vb + +Imports System.Data.SqlTypes +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + +Namespace Persons.Business + +''' +''' The generated superclass for the class. +''' +''' +''' This class is not intended to be instantiated directly. To obtain an instance of this class, +''' use the methods of the class. +''' +''' +''' + + Public Class BasePersonalSalaryRecord + Inherits PrimaryKeyRecord + + + Public Shared Shadows ReadOnly TableUtils As PersonalSalaryTable = PersonalSalaryTable.Instance + + ' Constructors + + Protected Sub New() + MyBase.New(TableUtils) + End Sub + + Protected Sub New(ByVal record As PrimaryKeyRecord) + MyBase.New(record, TableUtils) + End Sub + + 'Evaluates Initialize when->Inserting record formulas specified at the data access layer + Public Overridable Sub PersonalSalaryRecord_InsertingRecord(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles Me.InsertingRecord + 'Apply Initialize->Inserting record formula only if validation is successful. + Dim PersonalSalaryRec As PersonalSalaryRecord = CType(sender,PersonalSalaryRecord) + Validate_Inserting() + If Not PersonalSalaryRec Is Nothing AndAlso Not PersonalSalaryRec.IsReadOnly Then + End If + End Sub + + 'Evaluates Initialize when->Updating record formulas specified at the data access layer + Public Overridable Sub PersonalSalaryRecord_UpdatingRecord(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles Me.UpdatingRecord + 'Apply Initialize->Updating record formula only if validation is successful. + Dim PersonalSalaryRec As PersonalSalaryRecord = CType(sender,PersonalSalaryRecord) + Validate_Updating() + If Not PersonalSalaryRec Is Nothing AndAlso Not PersonalSalaryRec.IsReadOnly Then + End If + End Sub + + 'Evaluates Initialize when->Reading record formulas specified at the data access layer + Public Overridable Sub PersonalSalaryRecord_ReadRecord(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.ReadRecord + 'Apply Initialize->Reading record formula only if validation is successful. + Dim PersonalSalaryRec As PersonalSalaryRecord = CType(sender,PersonalSalaryRecord) + If Not PersonalSalaryRec Is Nothing AndAlso Not PersonalSalaryRec.IsReadOnly Then + End If + End Sub + + 'Evaluates Validate when->Inserting formulas specified at the data access layer + Public Overridable Sub Validate_Inserting () + Dim fullValidationMessage As String = "" + Dim validationMessage As String = "" + + dim formula as String = "" + + + If validationMessage <> "" AndAlso validationMessage.ToLower() <> "true" Then + fullValidationMessage &= validationMessage & vbCrLf + End If + + If fullValidationMessage <> "" Then + Throw New Exception(fullValidationMessage) + End If + End Sub + + 'Evaluates Validate when->Updating formulas specified at the data access layer + Public Overridable Sub Validate_Updating () + Dim fullValidationMessage As String = "" + Dim validationMessage As String = "" + + dim formula as String = "" + + + If validationMessage <> "" AndAlso validationMessage.ToLower() <> "true" Then + fullValidationMessage &= validationMessage & vbCrLf + End If + + If fullValidationMessage <> "" Then + Throw New Exception(fullValidationMessage) + End If + End Sub + + Public Overridable Function EvaluateFormula(ByVal formula As String, Optional ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord = Nothing, Optional ByVal format As String = Nothing) As String + + Dim e As Data.BaseFormulaEvaluator = New Data.BaseFormulaEvaluator() + + ' All variables referred to in the formula are expected to be + ' properties of the DataSource. For example, referring to + ' UnitPrice as a variable will refer to DataSource.UnitPrice + e.DataSource = dataSourceForEvaluate + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + Return resultObj.ToString() + End Function + + + + + + + +#Region "Convenience methods to get/set values of fields" + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalSalary_.id field. + ''' + Public Function Getid0Value() As ColumnValue + Return Me.GetValue(TableUtils.id0Column) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalSalary_.id field. + ''' + Public Function Getid0FieldValue() As Int32 + Return CType(Me.GetValue(TableUtils.id0Column).ToInt32(), Int32) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalSalary_.PersonalId field. + ''' + Public Function GetPersonalIdValue() As ColumnValue + Return Me.GetValue(TableUtils.PersonalIdColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalSalary_.PersonalId field. + ''' + Public Function GetPersonalIdFieldValue() As String + Return CType(Me.GetValue(TableUtils.PersonalIdColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalSalary_.PersonalId field. + ''' + Public Sub SetPersonalIdFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.PersonalIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalSalary_.PersonalId field. + ''' + Public Sub SetPersonalIdFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.PersonalIdColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalSalary_.SalaryDate field. + ''' + Public Function GetSalaryDateValue() As ColumnValue + Return Me.GetValue(TableUtils.SalaryDateColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalSalary_.SalaryDate field. + ''' + Public Function GetSalaryDateFieldValue() As DateTime + Return CType(Me.GetValue(TableUtils.SalaryDateColumn).ToDateTime(), DateTime) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalSalary_.SalaryDate field. + ''' + Public Sub SetSalaryDateFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.SalaryDateColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalSalary_.SalaryDate field. + ''' + Public Sub SetSalaryDateFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.SalaryDateColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalSalary_.SalaryDate field. + ''' + Public Sub SetSalaryDateFieldValue(ByVal val As DateTime) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.SalaryDateColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalSalary_.SalaryRank field. + ''' + Public Function GetSalaryRankValue() As ColumnValue + Return Me.GetValue(TableUtils.SalaryRankColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalSalary_.SalaryRank field. + ''' + Public Function GetSalaryRankFieldValue() As String + Return CType(Me.GetValue(TableUtils.SalaryRankColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalSalary_.SalaryRank field. + ''' + Public Sub SetSalaryRankFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.SalaryRankColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalSalary_.SalaryRank field. + ''' + Public Sub SetSalaryRankFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.SalaryRankColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalSalary_.SalaryStep field. + ''' + Public Function GetSalaryStepValue() As ColumnValue + Return Me.GetValue(TableUtils.SalaryStepColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalSalary_.SalaryStep field. + ''' + Public Function GetSalaryStepFieldValue() As Double + Return CType(Me.GetValue(TableUtils.SalaryStepColumn).ToDouble(), Double) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalSalary_.SalaryStep field. + ''' + Public Sub SetSalaryStepFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.SalaryStepColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalSalary_.SalaryStep field. + ''' + Public Sub SetSalaryStepFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.SalaryStepColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalSalary_.SalaryStep field. + ''' + Public Sub SetSalaryStepFieldValue(ByVal val As Double) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.SalaryStepColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalSalary_.SalaryStep field. + ''' + Public Sub SetSalaryStepFieldValue(ByVal val As Decimal) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.SalaryStepColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalSalary_.SalaryStep field. + ''' + Public Sub SetSalaryStepFieldValue(ByVal val As Int64) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.SalaryStepColumn) + End Sub + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalSalary_.SalaryYear field. + ''' + Public Function GetSalaryYearValue() As ColumnValue + Return Me.GetValue(TableUtils.SalaryYearColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalSalary_.SalaryYear field. + ''' + Public Function GetSalaryYearFieldValue() As String + Return CType(Me.GetValue(TableUtils.SalaryYearColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalSalary_.SalaryYear field. + ''' + Public Sub SetSalaryYearFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.SalaryYearColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalSalary_.SalaryYear field. + ''' + Public Sub SetSalaryYearFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.SalaryYearColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalSalary_.SalaryRound field. + ''' + Public Function GetSalaryRoundValue() As ColumnValue + Return Me.GetValue(TableUtils.SalaryRoundColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalSalary_.SalaryRound field. + ''' + Public Function GetSalaryRoundFieldValue() As Decimal + Return CType(Me.GetValue(TableUtils.SalaryRoundColumn).ToDecimal(), Decimal) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalSalary_.SalaryRound field. + ''' + Public Sub SetSalaryRoundFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.SalaryRoundColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalSalary_.SalaryRound field. + ''' + Public Sub SetSalaryRoundFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.SalaryRoundColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalSalary_.SalaryRound field. + ''' + Public Sub SetSalaryRoundFieldValue(ByVal val As Double) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.SalaryRoundColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalSalary_.SalaryRound field. + ''' + Public Sub SetSalaryRoundFieldValue(ByVal val As Decimal) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.SalaryRoundColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalSalary_.SalaryRound field. + ''' + Public Sub SetSalaryRoundFieldValue(ByVal val As Int64) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.SalaryRoundColumn) + End Sub + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalSalary_.SalaryAmout field. + ''' + Public Function GetSalaryAmoutValue() As ColumnValue + Return Me.GetValue(TableUtils.SalaryAmoutColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalSalary_.SalaryAmout field. + ''' + Public Function GetSalaryAmoutFieldValue() As Decimal + Return CType(Me.GetValue(TableUtils.SalaryAmoutColumn).ToDecimal(), Decimal) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalSalary_.SalaryAmout field. + ''' + Public Sub SetSalaryAmoutFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.SalaryAmoutColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalSalary_.SalaryAmout field. + ''' + Public Sub SetSalaryAmoutFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.SalaryAmoutColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalSalary_.SalaryAmout field. + ''' + Public Sub SetSalaryAmoutFieldValue(ByVal val As Double) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.SalaryAmoutColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalSalary_.SalaryAmout field. + ''' + Public Sub SetSalaryAmoutFieldValue(ByVal val As Decimal) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.SalaryAmoutColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalSalary_.SalaryAmout field. + ''' + Public Sub SetSalaryAmoutFieldValue(ByVal val As Int64) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.SalaryAmoutColumn) + End Sub + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalSalary_.SalaryExtra_NotUsed field. + ''' + Public Function GetSalaryExtra_NotUsedValue() As ColumnValue + Return Me.GetValue(TableUtils.SalaryExtra_NotUsedColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalSalary_.SalaryExtra_NotUsed field. + ''' + Public Function GetSalaryExtra_NotUsedFieldValue() As String + Return CType(Me.GetValue(TableUtils.SalaryExtra_NotUsedColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalSalary_.SalaryExtra_NotUsed field. + ''' + Public Sub SetSalaryExtra_NotUsedFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.SalaryExtra_NotUsedColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalSalary_.SalaryExtra_NotUsed field. + ''' + Public Sub SetSalaryExtra_NotUsedFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.SalaryExtra_NotUsedColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalSalary_.SalaryPlus field. + ''' + Public Function GetSalaryPlusValue() As ColumnValue + Return Me.GetValue(TableUtils.SalaryPlusColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalSalary_.SalaryPlus field. + ''' + Public Function GetSalaryPlusFieldValue() As Decimal + Return CType(Me.GetValue(TableUtils.SalaryPlusColumn).ToDecimal(), Decimal) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalSalary_.SalaryPlus field. + ''' + Public Sub SetSalaryPlusFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.SalaryPlusColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalSalary_.SalaryPlus field. + ''' + Public Sub SetSalaryPlusFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.SalaryPlusColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalSalary_.SalaryPlus field. + ''' + Public Sub SetSalaryPlusFieldValue(ByVal val As Double) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.SalaryPlusColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalSalary_.SalaryPlus field. + ''' + Public Sub SetSalaryPlusFieldValue(ByVal val As Decimal) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.SalaryPlusColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalSalary_.SalaryPlus field. + ''' + Public Sub SetSalaryPlusFieldValue(ByVal val As Int64) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.SalaryPlusColumn) + End Sub + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalSalary_.PositionSalary field. + ''' + Public Function GetPositionSalaryValue() As ColumnValue + Return Me.GetValue(TableUtils.PositionSalaryColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalSalary_.PositionSalary field. + ''' + Public Function GetPositionSalaryFieldValue() As Decimal + Return CType(Me.GetValue(TableUtils.PositionSalaryColumn).ToDecimal(), Decimal) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalSalary_.PositionSalary field. + ''' + Public Sub SetPositionSalaryFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.PositionSalaryColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalSalary_.PositionSalary field. + ''' + Public Sub SetPositionSalaryFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.PositionSalaryColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalSalary_.PositionSalary field. + ''' + Public Sub SetPositionSalaryFieldValue(ByVal val As Double) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.PositionSalaryColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalSalary_.PositionSalary field. + ''' + Public Sub SetPositionSalaryFieldValue(ByVal val As Decimal) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.PositionSalaryColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalSalary_.PositionSalary field. + ''' + Public Sub SetPositionSalaryFieldValue(ByVal val As Int64) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.PositionSalaryColumn) + End Sub + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalSalary_.SalaryCommand field. + ''' + Public Function GetSalaryCommandValue() As ColumnValue + Return Me.GetValue(TableUtils.SalaryCommandColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalSalary_.SalaryCommand field. + ''' + Public Function GetSalaryCommandFieldValue() As String + Return CType(Me.GetValue(TableUtils.SalaryCommandColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalSalary_.SalaryCommand field. + ''' + Public Sub SetSalaryCommandFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.SalaryCommandColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalSalary_.SalaryCommand field. + ''' + Public Sub SetSalaryCommandFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.SalaryCommandColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalSalary_.CommandDate field. + ''' + Public Function GetCommandDateValue() As ColumnValue + Return Me.GetValue(TableUtils.CommandDateColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalSalary_.CommandDate field. + ''' + Public Function GetCommandDateFieldValue() As DateTime + Return CType(Me.GetValue(TableUtils.CommandDateColumn).ToDateTime(), DateTime) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalSalary_.CommandDate field. + ''' + Public Sub SetCommandDateFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.CommandDateColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalSalary_.CommandDate field. + ''' + Public Sub SetCommandDateFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.CommandDateColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalSalary_.CommandDate field. + ''' + Public Sub SetCommandDateFieldValue(ByVal val As DateTime) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.CommandDateColumn) + End Sub + + + +#End Region + +#Region "Convenience methods to get field names" + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonalSalary_.id field. + ''' + Public Property id0() As Int32 + Get + Return CType(Me.GetValue(TableUtils.id0Column).ToInt32(), Int32) + End Get + Set (ByVal val As Int32) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.id0Column) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property id0Specified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.id0Column) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property id0Default() As String + Get + Return TableUtils.id0Column.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonalSalary_.PersonalId field. + ''' + Public Property PersonalId() As String + Get + Return CType(Me.GetValue(TableUtils.PersonalIdColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.PersonalIdColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property PersonalIdSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.PersonalIdColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property PersonalIdDefault() As String + Get + Return TableUtils.PersonalIdColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonalSalary_.SalaryDate field. + ''' + Public Property SalaryDate() As DateTime + Get + Return CType(Me.GetValue(TableUtils.SalaryDateColumn).ToDateTime(), DateTime) + End Get + Set (ByVal val As DateTime) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.SalaryDateColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property SalaryDateSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.SalaryDateColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property SalaryDateDefault() As String + Get + Return TableUtils.SalaryDateColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonalSalary_.SalaryRank field. + ''' + Public Property SalaryRank() As String + Get + Return CType(Me.GetValue(TableUtils.SalaryRankColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.SalaryRankColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property SalaryRankSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.SalaryRankColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property SalaryRankDefault() As String + Get + Return TableUtils.SalaryRankColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonalSalary_.SalaryStep field. + ''' + Public Property SalaryStep() As Double + Get + Return CType(Me.GetValue(TableUtils.SalaryStepColumn).ToDouble(), Double) + End Get + Set (ByVal val As Double) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.SalaryStepColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property SalaryStepSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.SalaryStepColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property SalaryStepDefault() As String + Get + Return TableUtils.SalaryStepColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonalSalary_.SalaryYear field. + ''' + Public Property SalaryYear() As String + Get + Return CType(Me.GetValue(TableUtils.SalaryYearColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.SalaryYearColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property SalaryYearSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.SalaryYearColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property SalaryYearDefault() As String + Get + Return TableUtils.SalaryYearColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonalSalary_.SalaryRound field. + ''' + Public Property SalaryRound() As Decimal + Get + Return CType(Me.GetValue(TableUtils.SalaryRoundColumn).ToDecimal(), Decimal) + End Get + Set (ByVal val As Decimal) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.SalaryRoundColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property SalaryRoundSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.SalaryRoundColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property SalaryRoundDefault() As String + Get + Return TableUtils.SalaryRoundColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonalSalary_.SalaryAmout field. + ''' + Public Property SalaryAmout() As Decimal + Get + Return CType(Me.GetValue(TableUtils.SalaryAmoutColumn).ToDecimal(), Decimal) + End Get + Set (ByVal val As Decimal) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.SalaryAmoutColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property SalaryAmoutSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.SalaryAmoutColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property SalaryAmoutDefault() As String + Get + Return TableUtils.SalaryAmoutColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonalSalary_.SalaryExtra_NotUsed field. + ''' + Public Property SalaryExtra_NotUsed() As String + Get + Return CType(Me.GetValue(TableUtils.SalaryExtra_NotUsedColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.SalaryExtra_NotUsedColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property SalaryExtra_NotUsedSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.SalaryExtra_NotUsedColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property SalaryExtra_NotUsedDefault() As String + Get + Return TableUtils.SalaryExtra_NotUsedColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonalSalary_.SalaryPlus field. + ''' + Public Property SalaryPlus() As Decimal + Get + Return CType(Me.GetValue(TableUtils.SalaryPlusColumn).ToDecimal(), Decimal) + End Get + Set (ByVal val As Decimal) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.SalaryPlusColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property SalaryPlusSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.SalaryPlusColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property SalaryPlusDefault() As String + Get + Return TableUtils.SalaryPlusColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonalSalary_.PositionSalary field. + ''' + Public Property PositionSalary() As Decimal + Get + Return CType(Me.GetValue(TableUtils.PositionSalaryColumn).ToDecimal(), Decimal) + End Get + Set (ByVal val As Decimal) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.PositionSalaryColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property PositionSalarySpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.PositionSalaryColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property PositionSalaryDefault() As String + Get + Return TableUtils.PositionSalaryColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonalSalary_.SalaryCommand field. + ''' + Public Property SalaryCommand() As String + Get + Return CType(Me.GetValue(TableUtils.SalaryCommandColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.SalaryCommandColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property SalaryCommandSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.SalaryCommandColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property SalaryCommandDefault() As String + Get + Return TableUtils.SalaryCommandColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonalSalary_.CommandDate field. + ''' + Public Property CommandDate() As DateTime + Get + Return CType(Me.GetValue(TableUtils.CommandDateColumn).ToDateTime(), DateTime) + End Get + Set (ByVal val As DateTime) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.CommandDateColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property CommandDateSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.CommandDateColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property CommandDateDefault() As String + Get + Return TableUtils.CommandDateColumn.DefaultValue + End Get + End Property + + + +#End Region + +End Class +End Namespace diff --git a/App_Code/Business Layer/BasePersonalSalaryTable.vb b/App_Code/Business Layer/BasePersonalSalaryTable.vb new file mode 100644 index 0000000..b435cfa --- /dev/null +++ b/App_Code/Business Layer/BasePersonalSalaryTable.vb @@ -0,0 +1,1018 @@ +' This class is "generated" and will be overwritten. +' Your customizations should be made in PersonalSalaryRecord.vb + +Imports System.Data.SqlTypes +Imports System.Data +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider +Imports Persons.Data + +Namespace Persons.Business + +''' +''' The generated superclass for the class. +''' Provides access to the schema information and record data of a database table or view named PersonalSalary. +''' +''' +''' The connection details (name, location, etc.) of the database and table (or view) accessed by this class +''' are resolved at runtime based on the connection string in the application's Web.Config file. +''' +''' This class is not intended to be instantiated directly. To obtain an instance of this class, use +''' PersonalSalaryTable.Instance. +''' +''' +''' + + Public Class BasePersonalSalaryTable + Inherits PrimaryKeyTable + + + Private ReadOnly TableDefinitionString As String = PersonalSalaryDefinition.GetXMLString() + + + + + + + + Protected Sub New() + MyBase.New() + Me.Initialize() + End Sub + + Protected Overridable Sub Initialize() + Dim def As New XmlTableDefinition(TableDefinitionString) + Me.TableDefinition = New TableDefinition() + Me.TableDefinition.TableClassName = System.Reflection.Assembly.CreateQualifiedName("App_Code", "Persons.Business.PersonalSalaryTable") + def.InitializeTableDefinition(Me.TableDefinition) + Me.ConnectionName = def.GetConnectionName() + Me.RecordClassName = System.Reflection.Assembly.CreateQualifiedName("App_Code", "Persons.Business.PersonalSalaryRecord") + Me.ApplicationName = "App_Code" + Me.DataAdapter = New PersonalSalarySqlTable() + Directcast(Me.DataAdapter, PersonalSalarySqlTable).ConnectionName = Me.ConnectionName + + Me.TableDefinition.AdapterMetaData = Me.DataAdapter.AdapterMetaData + id0Column.CodeName = "id0" + PersonalIdColumn.CodeName = "PersonalId" + SalaryDateColumn.CodeName = "SalaryDate" + SalaryRankColumn.CodeName = "SalaryRank" + SalaryStepColumn.CodeName = "SalaryStep" + SalaryYearColumn.CodeName = "SalaryYear" + SalaryRoundColumn.CodeName = "SalaryRound" + SalaryAmoutColumn.CodeName = "SalaryAmout" + SalaryExtra_NotUsedColumn.CodeName = "SalaryExtra_NotUsed" + SalaryPlusColumn.CodeName = "SalaryPlus" + PositionSalaryColumn.CodeName = "PositionSalary" + SalaryCommandColumn.CodeName = "SalaryCommand" + CommandDateColumn.CodeName = "CommandDate" + + End Sub + +#Region "Overriden methods" + + +#End Region + +#Region "Properties for columns" + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalSalary_.id column object. + ''' + Public ReadOnly Property id0Column() As BaseClasses.Data.NumberColumn + Get + Return CType(Me.TableDefinition.ColumnList(0), BaseClasses.Data.NumberColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalSalary_.id column object. + ''' + Public Shared ReadOnly Property id0() As BaseClasses.Data.NumberColumn + Get + Return PersonalSalaryTable.Instance.id0Column + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonalSalary_.PersonalId column object. + ''' + Public ReadOnly Property PersonalIdColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(1), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalSalary_.PersonalId column object. + ''' + Public Shared ReadOnly Property PersonalId() As BaseClasses.Data.StringColumn + Get + Return PersonalSalaryTable.Instance.PersonalIdColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonalSalary_.SalaryDate column object. + ''' + Public ReadOnly Property SalaryDateColumn() As BaseClasses.Data.DateColumn + Get + Return CType(Me.TableDefinition.ColumnList(2), BaseClasses.Data.DateColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalSalary_.SalaryDate column object. + ''' + Public Shared ReadOnly Property SalaryDate() As BaseClasses.Data.DateColumn + Get + Return PersonalSalaryTable.Instance.SalaryDateColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonalSalary_.SalaryRank column object. + ''' + Public ReadOnly Property SalaryRankColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(3), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalSalary_.SalaryRank column object. + ''' + Public Shared ReadOnly Property SalaryRank() As BaseClasses.Data.StringColumn + Get + Return PersonalSalaryTable.Instance.SalaryRankColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonalSalary_.SalaryStep column object. + ''' + Public ReadOnly Property SalaryStepColumn() As BaseClasses.Data.NumberColumn + Get + Return CType(Me.TableDefinition.ColumnList(4), BaseClasses.Data.NumberColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalSalary_.SalaryStep column object. + ''' + Public Shared ReadOnly Property SalaryStep() As BaseClasses.Data.NumberColumn + Get + Return PersonalSalaryTable.Instance.SalaryStepColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonalSalary_.SalaryYear column object. + ''' + Public ReadOnly Property SalaryYearColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(5), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalSalary_.SalaryYear column object. + ''' + Public Shared ReadOnly Property SalaryYear() As BaseClasses.Data.StringColumn + Get + Return PersonalSalaryTable.Instance.SalaryYearColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonalSalary_.SalaryRound column object. + ''' + Public ReadOnly Property SalaryRoundColumn() As BaseClasses.Data.NumberColumn + Get + Return CType(Me.TableDefinition.ColumnList(6), BaseClasses.Data.NumberColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalSalary_.SalaryRound column object. + ''' + Public Shared ReadOnly Property SalaryRound() As BaseClasses.Data.NumberColumn + Get + Return PersonalSalaryTable.Instance.SalaryRoundColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonalSalary_.SalaryAmout column object. + ''' + Public ReadOnly Property SalaryAmoutColumn() As BaseClasses.Data.CurrencyColumn + Get + Return CType(Me.TableDefinition.ColumnList(7), BaseClasses.Data.CurrencyColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalSalary_.SalaryAmout column object. + ''' + Public Shared ReadOnly Property SalaryAmout() As BaseClasses.Data.CurrencyColumn + Get + Return PersonalSalaryTable.Instance.SalaryAmoutColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonalSalary_.SalaryExtra_NotUsed column object. + ''' + Public ReadOnly Property SalaryExtra_NotUsedColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(8), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalSalary_.SalaryExtra_NotUsed column object. + ''' + Public Shared ReadOnly Property SalaryExtra_NotUsed() As BaseClasses.Data.StringColumn + Get + Return PersonalSalaryTable.Instance.SalaryExtra_NotUsedColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonalSalary_.SalaryPlus column object. + ''' + Public ReadOnly Property SalaryPlusColumn() As BaseClasses.Data.CurrencyColumn + Get + Return CType(Me.TableDefinition.ColumnList(9), BaseClasses.Data.CurrencyColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalSalary_.SalaryPlus column object. + ''' + Public Shared ReadOnly Property SalaryPlus() As BaseClasses.Data.CurrencyColumn + Get + Return PersonalSalaryTable.Instance.SalaryPlusColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonalSalary_.PositionSalary column object. + ''' + Public ReadOnly Property PositionSalaryColumn() As BaseClasses.Data.CurrencyColumn + Get + Return CType(Me.TableDefinition.ColumnList(10), BaseClasses.Data.CurrencyColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalSalary_.PositionSalary column object. + ''' + Public Shared ReadOnly Property PositionSalary() As BaseClasses.Data.CurrencyColumn + Get + Return PersonalSalaryTable.Instance.PositionSalaryColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonalSalary_.SalaryCommand column object. + ''' + Public ReadOnly Property SalaryCommandColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(11), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalSalary_.SalaryCommand column object. + ''' + Public Shared ReadOnly Property SalaryCommand() As BaseClasses.Data.StringColumn + Get + Return PersonalSalaryTable.Instance.SalaryCommandColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonalSalary_.CommandDate column object. + ''' + Public ReadOnly Property CommandDateColumn() As BaseClasses.Data.DateColumn + Get + Return CType(Me.TableDefinition.ColumnList(12), BaseClasses.Data.DateColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalSalary_.CommandDate column object. + ''' + Public Shared ReadOnly Property CommandDate() As BaseClasses.Data.DateColumn + Get + Return PersonalSalaryTable.Instance.CommandDateColumn + End Get + End Property + + +#End Region + + +#Region "Shared helper methods" + + ''' + ''' This is a shared function that can be used to get an array of PersonalSalaryRecord records using a where clause. + ''' + Public Shared Function GetRecords(ByVal where As String) As PersonalSalaryRecord() + + Return GetRecords(where, Nothing, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) + End Function + + ''' + ''' This is a shared function that can be used to get an array of PersonalSalaryRecord records using a where clause. + ''' + Public Shared Function GetRecords(ByVal join As BaseFilter, ByVal where As String) As PersonalSalaryRecord() + + Return GetRecords(join, where, Nothing, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) + End Function + + ''' + ''' This is a shared function that can be used to get an array of PersonalSalaryRecord records using a where and order by clause. + ''' + Public Shared Function GetRecords( _ + ByVal where As String, _ + ByVal orderBy As OrderBy) As PersonalSalaryRecord() + + Return GetRecords(where, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) + End Function + + ''' + ''' This is a shared function that can be used to get an array of PersonalSalaryRecord records using a where and order by clause. + ''' + Public Shared Function GetRecords( _ + ByVal join As BaseFilter, _ + ByVal where As String, _ + ByVal orderBy As OrderBy) As PersonalSalaryRecord() + + Return GetRecords(join, where, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) + End Function + + ''' + ''' This is a shared function that can be used to get an array of PersonalSalaryRecord records using a where and order by clause clause with pagination. + ''' + Public Shared Function GetRecords( _ + ByVal where As String, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As PersonalSalaryRecord() + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + Dim join As BaseClasses.Data.BaseFilter = Nothing + Dim recList As ArrayList = PersonalSalaryTable.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, pageIndex, pageSize) + + Return CType(recList.ToArray(GetType(Persons.Business.PersonalSalaryRecord)), PersonalSalaryRecord()) + End Function + + ''' + ''' This is a shared function that can be used to get an array of PersonalSalaryRecord records using a where and order by clause clause with pagination. + ''' + Public Shared Function GetRecords( _ + ByVal join As BaseFilter, _ + ByVal where As String, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As PersonalSalaryRecord() + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Dim recList As ArrayList = PersonalSalaryTable.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, pageIndex, pageSize) + + Return CType(recList.ToArray(GetType(Persons.Business.PersonalSalaryRecord)), PersonalSalaryRecord()) + End Function + + Public Shared Function GetRecords( _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As PersonalSalaryRecord() + Dim join As BaseClasses.Data.BaseFilter = Nothing + Dim recList As ArrayList = PersonalSalaryTable.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + Return CType(recList.ToArray(GetType(Persons.Business.PersonalSalaryRecord)), PersonalSalaryRecord()) + End Function + + Public Shared Function GetRecords( _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As PersonalSalaryRecord() + + Dim recList As ArrayList = PersonalSalaryTable.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + Return CType(recList.ToArray(GetType(Persons.Business.PersonalSalaryRecord)), PersonalSalaryRecord()) + End Function + + Public Shared Function GetRecords( _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer, _ + ByRef totalRecords As Integer) As PersonalSalaryRecord() + Dim join As BaseClasses.Data.BaseFilter = Nothing + Dim recList As ArrayList = PersonalSalaryTable.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize, totalRecords) + + Return CType(recList.ToArray(GetType(Persons.Business.PersonalSalaryRecord)), PersonalSalaryRecord()) + End Function + + Public Shared Function GetRecords( _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer, _ + ByRef totalRecords As Integer) As PersonalSalaryRecord() + + Dim recList As ArrayList = PersonalSalaryTable.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize, totalRecords) + + Return CType(recList.ToArray(GetType(Persons.Business.PersonalSalaryRecord)), PersonalSalaryRecord()) + End Function + + ''' + ''' This is a shared function that can be used to get total number of records that will be returned using the where clause. + ''' + Public Shared Function GetRecordCount(ByVal where As String) As Integer + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Return CInt(PersonalSalaryTable.Instance.GetRecordListCount(Nothing, whereFilter, Nothing, Nothing)) + End Function + +''' + ''' This is a shared function that can be used to get total number of records that will be returned using the where clause. + ''' + Public Shared Function GetRecordCount(ByVal join As BaseFilter, ByVal where As String) As Integer + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Return CInt(PersonalSalaryTable.Instance.GetRecordListCount(join, whereFilter, Nothing, Nothing)) + End Function + + Public Shared Function GetRecordCount(ByVal where As WhereClause) As Integer + Return CInt(PersonalSalaryTable.Instance.GetRecordListCount(Nothing, where.GetFilter(), Nothing, Nothing)) + End Function + + Public Shared Function GetRecordCount(ByVal join As BaseFilter, ByVal where As WhereClause) As Integer + Return CInt(PersonalSalaryTable.Instance.GetRecordListCount(join, where.GetFilter(), Nothing, Nothing)) + End Function + + ''' + ''' This is a shared function that can be used to get a PersonalSalaryRecord record using a where clause. + ''' + Public Shared Function GetRecord(ByVal where As String) As PersonalSalaryRecord + Dim orderBy As OrderBy = Nothing + Return GetRecord(where, orderBy) + End Function + + ''' + ''' This is a shared function that can be used to get a PersonalSalaryRecord record using a where clause. + ''' + Public Shared Function GetRecord(ByVal join As BaseFilter, ByVal where As String) As PersonalSalaryRecord + Dim orderBy As OrderBy = Nothing + Return GetRecord(join, where, orderBy) + End Function + + ''' + ''' This is a shared function that can be used to get a PersonalSalaryRecord record using a where and order by clause. + ''' + Public Shared Function GetRecord( _ + ByVal where As String, _ + ByVal orderBy As OrderBy) As PersonalSalaryRecord + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + Dim join As BaseClasses.Data.BaseFilter = Nothing + Dim recList As ArrayList = PersonalSalaryTable.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MIN_BATCH_SIZE) + + Dim rec As PersonalSalaryRecord = Nothing + If recList.Count > 0 Then + rec = CType(recList(0), PersonalSalaryRecord) + End If + + Return rec + End Function + + ''' + ''' This is a shared function that can be used to get a PersonalSalaryRecord record using a where and order by clause. + ''' + Public Shared Function GetRecord( _ + ByVal join As BaseFilter, _ + ByVal where As String, _ + ByVal orderBy As OrderBy) As PersonalSalaryRecord + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Dim recList As ArrayList = PersonalSalaryTable.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MIN_BATCH_SIZE) + + Dim rec As PersonalSalaryRecord = Nothing + If recList.Count > 0 Then + rec = CType(recList(0), PersonalSalaryRecord) + End If + + Return rec + End Function + + + Public Shared Function GetValues( _ + ByVal col As BaseColumn, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal maxItems As Integer) As String() + + ' Create the filter list. + Dim retCol As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, True) + retCol.AddColumn(col) + + Return PersonalSalaryTable.Instance.GetColumnValues(retCol, Nothing, where.GetFilter(), Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, maxItems) + + End Function + + Public Shared Function GetValues( _ + ByVal col As BaseColumn, _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal maxItems As Integer) As String() + + ' Create the filter list. + Dim retCol As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, True) + retCol.AddColumn(col) + + Return PersonalSalaryTable.Instance.GetColumnValues(retCol, join, where.GetFilter(), Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, maxItems) + + End Function + + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where clause. + ''' + Public Shared Function GetDataTable(ByVal where As String) As System.Data.DataTable + + Dim recs() As PersonalSalaryRecord = GetRecords(where) + Return PersonalSalaryTable.Instance.CreateDataTable(recs, Nothing) + End Function + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where clause. + ''' + Public Shared Function GetDataTable(ByVal join As BaseFilter, ByVal where As String) As System.Data.DataTable + + Dim recs() As PersonalSalaryRecord = GetRecords(join, where) + Return PersonalSalaryTable.Instance.CreateDataTable(recs, Nothing) + End Function + + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause. + ''' + Public Shared Function GetDataTable(ByVal where As String, ByVal orderBy As OrderBy) As System.Data.DataTable + + Dim recs() As PersonalSalaryRecord = GetRecords(where, orderBy) + Return PersonalSalaryTable.Instance.CreateDataTable(recs, Nothing) + End Function + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause. + ''' + Public Shared Function GetDataTable(ByVal join As BaseFilter, ByVal where As String, ByVal orderBy As OrderBy) As System.Data.DataTable + + Dim recs() As PersonalSalaryRecord = GetRecords(join, where, orderBy) + Return PersonalSalaryTable.Instance.CreateDataTable(recs, Nothing) + End Function + + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause with pagination. + ''' + Public Shared Function GetDataTable( _ + ByVal where As String, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As System.Data.DataTable + + Dim recs() As PersonalSalaryRecord = GetRecords(where, orderBy, pageIndex, pageSize) + Return PersonalSalaryTable.Instance.CreateDataTable(recs, Nothing) + End Function + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause with pagination. + ''' + Public Shared Function GetDataTable( _ + ByVal join As BaseFilter, _ + ByVal where As String, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As System.Data.DataTable + + Dim recs() As PersonalSalaryRecord = GetRecords(join, where, orderBy, pageIndex, pageSize) + Return PersonalSalaryTable.Instance.CreateDataTable(recs, Nothing) + End Function + + + ''' + ''' This is a shared function that can be used to delete records using a where clause. + ''' + Public Shared Sub DeleteRecords(ByVal where As String) + If where = Nothing OrElse where.Trim() = "" Then + Return + End If + + Dim whereFilter As SqlFilter = New SqlFilter(where) + PersonalSalaryTable.Instance.DeleteRecordList(whereFilter) + End Sub + + ''' + ''' This is a shared function that can be used to export records using a where clause. + ''' + Public Shared Function Export(ByVal where As String) As String + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Return PersonalSalaryTable.Instance.ExportRecordData(whereFilter) + End Function + + Public Shared Function Export(ByVal where As WhereClause) As String + Dim whereFilter As BaseFilter = Nothing + If Not where Is Nothing Then + whereFilter = where.GetFilter() + End If + + Return PersonalSalaryTable.Instance.ExportRecordData(whereFilter) + End Function + + Public Shared Function GetSum( _ + ByVal col As BaseColumn, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) _ + As String + + Dim colSel As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, False) + colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Sum) + + Return PersonalSalaryTable.Instance.GetColumnStatistics(colSel, Nothing, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + End Function + + Public Shared Function GetSum( _ + ByVal col As BaseColumn, _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) _ + As String + + Dim colSel As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, False) + colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Sum) + + Return PersonalSalaryTable.Instance.GetColumnStatistics(colSel, join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + End Function + + + Public Shared Function GetCount( _ + ByVal col As BaseColumn, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) _ + As String + + Dim colSel As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, False) + colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Count) + + Return PersonalSalaryTable.Instance.GetColumnStatistics(colSel, Nothing, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + End Function + + Public Shared Function GetCount( _ + ByVal col As BaseColumn, _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) _ + As String + + Dim colSel As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, False) + colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Count) + + Return PersonalSalaryTable.Instance.GetColumnStatistics(colSel, join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + End Function + + ''' + ''' This method returns the columns in the table. + ''' + Public Shared Function GetColumns() As BaseColumn() + Return PersonalSalaryTable.Instance.TableDefinition.Columns + End Function + + ''' + ''' This method returns the columnlist in the table. + ''' + Public Shared Function GetColumnList() As ColumnList + Return PersonalSalaryTable.Instance.TableDefinition.ColumnList + End Function + + + ''' + ''' This method creates a new record and returns it to be edited. + ''' + Public Shared Function CreateNewRecord() As IRecord + Return PersonalSalaryTable.Instance.CreateRecord() + End Function + + ''' + ''' This method creates a new record and returns it to be edited. + ''' + ''' ID of the new record. + Public Shared Function CreateNewRecord(ByVal tempId As String) As IRecord + Return PersonalSalaryTable.Instance.CreateRecord(tempId) + End Function + + ''' + ''' This method checks if column is editable. + ''' + ''' Name of the column to check. + Public Shared Function isReadOnlyColumn(ByVal columnName As String) As Boolean + Dim column As BaseColumn = GetColumn(columnName) + If (Not IsNothing(column)) Then + Return column.IsValuesReadOnly + Else + Return True + End If + End Function + + ''' + ''' This method gets the specified column. + ''' + ''' Unique name of the column to fetch. + Public Shared Function GetColumn(ByVal uniqueColumnName As String) As BaseColumn + Dim column As BaseColumn = PersonalSalaryTable.Instance.TableDefinition.ColumnList.GetByUniqueName(uniqueColumnName) + Return column + End Function + + ' Convenience method for getting a record using a string-based record identifier + Public Shared Function GetRecord(ByVal id As String, ByVal bMutable As Boolean) As PersonalSalaryRecord + Return CType(PersonalSalaryTable.Instance.GetRecordData(id, bMutable), PersonalSalaryRecord) + End Function + + ' Convenience method for getting a record using a KeyValue record identifier + Public Shared Function GetRecord(ByVal id As KeyValue, ByVal bMutable As Boolean) As PersonalSalaryRecord + Return CType(PersonalSalaryTable.Instance.GetRecordData(id, bMutable), PersonalSalaryRecord) + End Function + + ' Convenience method for creating a record + Public Overloads Function NewRecord( _ + ByVal PersonalIdValue As String, _ + ByVal SalaryDateValue As String, _ + ByVal SalaryRankValue As String, _ + ByVal SalaryStepValue As String, _ + ByVal SalaryYearValue As String, _ + ByVal SalaryRoundValue As String, _ + ByVal SalaryAmoutValue As String, _ + ByVal SalaryExtra_NotUsedValue As String, _ + ByVal SalaryPlusValue As String, _ + ByVal PositionSalaryValue As String, _ + ByVal SalaryCommandValue As String, _ + ByVal CommandDateValue As String _ + ) As KeyValue + Dim rec As IPrimaryKeyRecord = CType(Me.CreateRecord(), IPrimaryKeyRecord) + rec.SetString(PersonalIdValue, PersonalIdColumn) + rec.SetString(SalaryDateValue, SalaryDateColumn) + rec.SetString(SalaryRankValue, SalaryRankColumn) + rec.SetString(SalaryStepValue, SalaryStepColumn) + rec.SetString(SalaryYearValue, SalaryYearColumn) + rec.SetString(SalaryRoundValue, SalaryRoundColumn) + rec.SetString(SalaryAmoutValue, SalaryAmoutColumn) + rec.SetString(SalaryExtra_NotUsedValue, SalaryExtra_NotUsedColumn) + rec.SetString(SalaryPlusValue, SalaryPlusColumn) + rec.SetString(PositionSalaryValue, PositionSalaryColumn) + rec.SetString(SalaryCommandValue, SalaryCommandColumn) + rec.SetString(CommandDateValue, CommandDateColumn) + + + rec.Create() 'update the DB so any DB-initialized fields (like autoincrement IDs) can be initialized + + Dim key As KeyValue = rec.GetID() + Return key + End Function + + ''' + ''' This method deletes a specified record + ''' + ''' Keyvalue of the record to be deleted. + Public Shared Sub DeleteRecord(ByVal kv As KeyValue) + PersonalSalaryTable.Instance.DeleteOneRecord(kv) + End Sub + + ''' + ''' This method checks if record exist in the database using the keyvalue provided. + ''' + ''' Key value of the record. + Public Shared Function DoesRecordExist(ByVal kv As KeyValue) As Boolean + Dim recordExist As Boolean = True + Try + PersonalSalaryTable.GetRecord(kv, False) + Catch ex As Exception + recordExist = False + End Try + Return recordExist + End Function + + ''' + ''' This method returns all the primary columns in the table. + ''' + Public Shared Function GetPrimaryKeyColumns() As ColumnList + If (Not IsNothing(PersonalSalaryTable.Instance.TableDefinition.PrimaryKey)) Then + Return PersonalSalaryTable.Instance.TableDefinition.PrimaryKey.Columns + Else + Return Nothing + End If + End Function + + ''' + ''' This method takes a key and returns a keyvalue. + ''' + ''' key could be array of primary key values in case of composite primary key or a string containing single primary key value in case of non-composite primary key. + Public Shared Function GetKeyValue(ByVal key As Object) As KeyValue + Dim kv As KeyValue = Nothing + + If (Not (IsNothing(PersonalSalaryTable.Instance.TableDefinition.PrimaryKey))) Then + + Dim isCompositePrimaryKey As Boolean = False + isCompositePrimaryKey = PersonalSalaryTable.Instance.TableDefinition.PrimaryKey.IsCompositeKey + + If ((isCompositePrimaryKey) AndAlso (key.GetType.IsArray())) Then + + ' If the key is composite, then construct a key value. + kv = New KeyValue + Dim fullKeyString As String = "" + Dim keyArray As Array = CType(key, Array) + If (Not IsNothing(keyArray)) Then + Dim length As Integer = keyArray.Length + Dim pkColumns As ColumnList = PersonalSalaryTable.Instance.TableDefinition.PrimaryKey.Columns + Dim pkColumn As BaseColumn + Dim index As Integer = 0 + For Each pkColumn In pkColumns + Dim keyString As String = CType(keyArray.GetValue(index), String) + If (PersonalSalaryTable.Instance.TableDefinition.TableType = BaseClasses.Data.TableDefinition.TableTypes.Virtual) Then + kv.AddElement(pkColumn.UniqueName, keyString) + Else + kv.AddElement(pkColumn.InternalName, keyString) + End If + index = index + 1 + Next pkColumn + End If + + Else + ' If the key is not composite, then get the key value. + kv = PersonalSalaryTable.Instance.TableDefinition.PrimaryKey.ParseValue(CType(key, String)) + End If + End If + Return kv + End Function + + + ''' + ''' This method takes a record and a Column and returns an evaluated value of DFKA formula. + ''' + Public Shared Function GetDFKA(ByVal rec As BaseRecord, ByVal col As BaseColumn) As String + Dim fkColumn As ForeignKey = PersonalSalaryTable.Instance.TableDefinition.GetExpandableNonCompositeForeignKey(col) + If fkColumn Is Nothing Then + Return Nothing + End If + Dim _DFKA As String = fkColumn.PrimaryKeyDisplayColumns + If (_DFKA.Trim().StartsWith("=")) Then + ' if the formula is in the format of "= ., then pull out the data from the rec object instead of doing formula evaluation + Dim tableCodeName As String = fkColumn.PrimaryKeyTableDefinition.TableCodeName + Dim column As String = _DFKA.Trim("="c).Trim() + If column.StartsWith(tableCodeName & ".", StringComparison.InvariantCultureIgnoreCase) Then + column = column.Substring(tableCodeName.Length + 1) + End If + + For Each c As BaseColumn In fkColumn.PrimaryKeyTableDefinition.Columns + If column = c.CodeName Then + Return rec.Format(c) + End If + Next + Dim tableName As String = fkColumn.PrimaryKeyTableDefinition.TableCodeName + Return EvaluateFormula(_DFKA, rec, Nothing, tableName) + Else + Return Nothing + End If + End Function + + ''' + ''' This method takes a keyValue and a Column and returns an evaluated value of DFKA formula. + ''' + Public Shared Function GetDFKA(ByVal keyValue As String, ByVal col As BaseColumn, ByVal formatPattern as String) As String + If keyValue Is Nothing Then + Return Nothing + End If + Dim fkColumn As ForeignKey = PersonalSalaryTable.Instance.TableDefinition.GetExpandableNonCompositeForeignKey(col) + If fkColumn Is Nothing Then + Return Nothing + End If + Dim _DFKA As String = fkColumn.PrimaryKeyDisplayColumns + If (_DFKA.Trim().StartsWith("=")) Then + Dim tableName As String = fkColumn.PrimaryKeyTableDefinition.TableCodeName + Dim t As PrimaryKeyTable = CType(DatabaseObjects.GetTableObject(tableName), PrimaryKeyTable) + Dim rec As BaseRecord = Nothing + If Not t Is Nothing Then + Try + rec = CType(t.GetRecordData(keyValue, False), BaseRecord) + Catch + rec = Nothing + End Try + End If + If rec Is Nothing Then + Return "" + End If + + ' if the formula is in the format of "= ., then pull out the data from the rec object instead of doing formula evaluation + Dim tableCodeName As String = fkColumn.PrimaryKeyTableDefinition.TableCodeName + Dim column As String = _DFKA.Trim("="c).Trim() + If column.StartsWith(tableCodeName & ".", StringComparison.InvariantCultureIgnoreCase) Then + column = column.Substring(tableCodeName.Length + 1) + End If + + For Each c As BaseColumn In fkColumn.PrimaryKeyTableDefinition.Columns + If column = c.CodeName Then + Return rec.Format(c) + End If + Next + Return EvaluateFormula(_DFKA, rec, Nothing, tableName) + Else + Return Nothing + End If + End Function + + ''' + ''' Evaluates the formula + ''' + Public Shared Function EvaluateFormula(ByVal formula As String, Optional ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord = Nothing, Optional ByVal format As String = Nothing, Optional ByVal name As String = "") As String + Dim e As BaseFormulaEvaluator = New BaseFormulaEvaluator() + If Not dataSourceForEvaluate Is Nothing Then + e.Evaluator.Variables.Add(name, dataSourceForEvaluate) + end if + e.DataSource = dataSourceForEvaluate + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + If Not String.IsNullOrEmpty(format) Then + Return BaseFormulaUtils.Format(resultObj, format) + Else + Return resultObj.ToString() + End If + End Function + + +#End Region + +End Class +End Namespace diff --git a/App_Code/Business Layer/BasePersonalSpecialSkillRecord.vb b/App_Code/Business Layer/BasePersonalSpecialSkillRecord.vb new file mode 100644 index 0000000..de5802d --- /dev/null +++ b/App_Code/Business Layer/BasePersonalSpecialSkillRecord.vb @@ -0,0 +1,374 @@ +' This class is "generated" and will be overwritten. +' Your customizations should be made in PersonalSpecialSkillRecord.vb + +Imports System.Data.SqlTypes +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + +Namespace Persons.Business + +''' +''' The generated superclass for the class. +''' +''' +''' This class is not intended to be instantiated directly. To obtain an instance of this class, +''' use the methods of the class. +''' +''' +''' + + Public Class BasePersonalSpecialSkillRecord + Inherits PrimaryKeyRecord + + + Public Shared Shadows ReadOnly TableUtils As PersonalSpecialSkillTable = PersonalSpecialSkillTable.Instance + + ' Constructors + + Protected Sub New() + MyBase.New(TableUtils) + End Sub + + Protected Sub New(ByVal record As PrimaryKeyRecord) + MyBase.New(record, TableUtils) + End Sub + + 'Evaluates Initialize when->Inserting record formulas specified at the data access layer + Public Overridable Sub PersonalSpecialSkillRecord_InsertingRecord(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles Me.InsertingRecord + 'Apply Initialize->Inserting record formula only if validation is successful. + Dim PersonalSpecialSkillRec As PersonalSpecialSkillRecord = CType(sender,PersonalSpecialSkillRecord) + Validate_Inserting() + If Not PersonalSpecialSkillRec Is Nothing AndAlso Not PersonalSpecialSkillRec.IsReadOnly Then + End If + End Sub + + 'Evaluates Initialize when->Updating record formulas specified at the data access layer + Public Overridable Sub PersonalSpecialSkillRecord_UpdatingRecord(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles Me.UpdatingRecord + 'Apply Initialize->Updating record formula only if validation is successful. + Dim PersonalSpecialSkillRec As PersonalSpecialSkillRecord = CType(sender,PersonalSpecialSkillRecord) + Validate_Updating() + If Not PersonalSpecialSkillRec Is Nothing AndAlso Not PersonalSpecialSkillRec.IsReadOnly Then + End If + End Sub + + 'Evaluates Initialize when->Reading record formulas specified at the data access layer + Public Overridable Sub PersonalSpecialSkillRecord_ReadRecord(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.ReadRecord + 'Apply Initialize->Reading record formula only if validation is successful. + Dim PersonalSpecialSkillRec As PersonalSpecialSkillRecord = CType(sender,PersonalSpecialSkillRecord) + If Not PersonalSpecialSkillRec Is Nothing AndAlso Not PersonalSpecialSkillRec.IsReadOnly Then + End If + End Sub + + 'Evaluates Validate when->Inserting formulas specified at the data access layer + Public Overridable Sub Validate_Inserting () + Dim fullValidationMessage As String = "" + Dim validationMessage As String = "" + + dim formula as String = "" + + + If validationMessage <> "" AndAlso validationMessage.ToLower() <> "true" Then + fullValidationMessage &= validationMessage & vbCrLf + End If + + If fullValidationMessage <> "" Then + Throw New Exception(fullValidationMessage) + End If + End Sub + + 'Evaluates Validate when->Updating formulas specified at the data access layer + Public Overridable Sub Validate_Updating () + Dim fullValidationMessage As String = "" + Dim validationMessage As String = "" + + dim formula as String = "" + + + If validationMessage <> "" AndAlso validationMessage.ToLower() <> "true" Then + fullValidationMessage &= validationMessage & vbCrLf + End If + + If fullValidationMessage <> "" Then + Throw New Exception(fullValidationMessage) + End If + End Sub + + Public Overridable Function EvaluateFormula(ByVal formula As String, Optional ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord = Nothing, Optional ByVal format As String = Nothing) As String + + Dim e As Data.BaseFormulaEvaluator = New Data.BaseFormulaEvaluator() + + ' All variables referred to in the formula are expected to be + ' properties of the DataSource. For example, referring to + ' UnitPrice as a variable will refer to DataSource.UnitPrice + e.DataSource = dataSourceForEvaluate + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + Return resultObj.ToString() + End Function + + + + + + + +#Region "Convenience methods to get/set values of fields" + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalSpecialSkill_.id field. + ''' + Public Function Getid0Value() As ColumnValue + Return Me.GetValue(TableUtils.id0Column) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalSpecialSkill_.id field. + ''' + Public Function Getid0FieldValue() As Int32 + Return CType(Me.GetValue(TableUtils.id0Column).ToInt32(), Int32) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalSpecialSkill_.PersonalId field. + ''' + Public Function GetPersonalIdValue() As ColumnValue + Return Me.GetValue(TableUtils.PersonalIdColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalSpecialSkill_.PersonalId field. + ''' + Public Function GetPersonalIdFieldValue() As String + Return CType(Me.GetValue(TableUtils.PersonalIdColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalSpecialSkill_.PersonalId field. + ''' + Public Sub SetPersonalIdFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.PersonalIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalSpecialSkill_.PersonalId field. + ''' + Public Sub SetPersonalIdFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.PersonalIdColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalSpecialSkill_.Skill field. + ''' + Public Function GetSkillValue() As ColumnValue + Return Me.GetValue(TableUtils.SkillColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalSpecialSkill_.Skill field. + ''' + Public Function GetSkillFieldValue() As String + Return CType(Me.GetValue(TableUtils.SkillColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalSpecialSkill_.Skill field. + ''' + Public Sub SetSkillFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.SkillColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalSpecialSkill_.Skill field. + ''' + Public Sub SetSkillFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.SkillColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalSpecialSkill_.Level field. + ''' + Public Function GetLevelValue() As ColumnValue + Return Me.GetValue(TableUtils.LevelColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalSpecialSkill_.Level field. + ''' + Public Function GetLevelFieldValue() As String + Return CType(Me.GetValue(TableUtils.LevelColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalSpecialSkill_.Level field. + ''' + Public Sub SetLevelFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.LevelColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalSpecialSkill_.Level field. + ''' + Public Sub SetLevelFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.LevelColumn) + End Sub + + + +#End Region + +#Region "Convenience methods to get field names" + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonalSpecialSkill_.id field. + ''' + Public Property id0() As Int32 + Get + Return CType(Me.GetValue(TableUtils.id0Column).ToInt32(), Int32) + End Get + Set (ByVal val As Int32) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.id0Column) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property id0Specified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.id0Column) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property id0Default() As String + Get + Return TableUtils.id0Column.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonalSpecialSkill_.PersonalId field. + ''' + Public Property PersonalId() As String + Get + Return CType(Me.GetValue(TableUtils.PersonalIdColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.PersonalIdColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property PersonalIdSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.PersonalIdColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property PersonalIdDefault() As String + Get + Return TableUtils.PersonalIdColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonalSpecialSkill_.Skill field. + ''' + Public Property Skill() As String + Get + Return CType(Me.GetValue(TableUtils.SkillColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.SkillColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property SkillSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.SkillColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property SkillDefault() As String + Get + Return TableUtils.SkillColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonalSpecialSkill_.Level field. + ''' + Public Property Level() As String + Get + Return CType(Me.GetValue(TableUtils.LevelColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.LevelColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property LevelSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.LevelColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property LevelDefault() As String + Get + Return TableUtils.LevelColumn.DefaultValue + End Get + End Property + + + +#End Region + +End Class +End Namespace diff --git a/App_Code/Business Layer/BasePersonalSpecialSkillTable.vb b/App_Code/Business Layer/BasePersonalSpecialSkillTable.vb new file mode 100644 index 0000000..a727f4e --- /dev/null +++ b/App_Code/Business Layer/BasePersonalSpecialSkillTable.vb @@ -0,0 +1,820 @@ +' This class is "generated" and will be overwritten. +' Your customizations should be made in PersonalSpecialSkillRecord.vb + +Imports System.Data.SqlTypes +Imports System.Data +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider +Imports Persons.Data + +Namespace Persons.Business + +''' +''' The generated superclass for the class. +''' Provides access to the schema information and record data of a database table or view named PersonalSpecialSkill. +''' +''' +''' The connection details (name, location, etc.) of the database and table (or view) accessed by this class +''' are resolved at runtime based on the connection string in the application's Web.Config file. +''' +''' This class is not intended to be instantiated directly. To obtain an instance of this class, use +''' PersonalSpecialSkillTable.Instance. +''' +''' +''' + + Public Class BasePersonalSpecialSkillTable + Inherits PrimaryKeyTable + + + Private ReadOnly TableDefinitionString As String = PersonalSpecialSkillDefinition.GetXMLString() + + + + + + + + Protected Sub New() + MyBase.New() + Me.Initialize() + End Sub + + Protected Overridable Sub Initialize() + Dim def As New XmlTableDefinition(TableDefinitionString) + Me.TableDefinition = New TableDefinition() + Me.TableDefinition.TableClassName = System.Reflection.Assembly.CreateQualifiedName("App_Code", "Persons.Business.PersonalSpecialSkillTable") + def.InitializeTableDefinition(Me.TableDefinition) + Me.ConnectionName = def.GetConnectionName() + Me.RecordClassName = System.Reflection.Assembly.CreateQualifiedName("App_Code", "Persons.Business.PersonalSpecialSkillRecord") + Me.ApplicationName = "App_Code" + Me.DataAdapter = New PersonalSpecialSkillSqlTable() + Directcast(Me.DataAdapter, PersonalSpecialSkillSqlTable).ConnectionName = Me.ConnectionName + + Me.TableDefinition.AdapterMetaData = Me.DataAdapter.AdapterMetaData + id0Column.CodeName = "id0" + PersonalIdColumn.CodeName = "PersonalId" + SkillColumn.CodeName = "Skill" + LevelColumn.CodeName = "Level" + + End Sub + +#Region "Overriden methods" + + +#End Region + +#Region "Properties for columns" + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalSpecialSkill_.id column object. + ''' + Public ReadOnly Property id0Column() As BaseClasses.Data.NumberColumn + Get + Return CType(Me.TableDefinition.ColumnList(0), BaseClasses.Data.NumberColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalSpecialSkill_.id column object. + ''' + Public Shared ReadOnly Property id0() As BaseClasses.Data.NumberColumn + Get + Return PersonalSpecialSkillTable.Instance.id0Column + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonalSpecialSkill_.PersonalId column object. + ''' + Public ReadOnly Property PersonalIdColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(1), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalSpecialSkill_.PersonalId column object. + ''' + Public Shared ReadOnly Property PersonalId() As BaseClasses.Data.StringColumn + Get + Return PersonalSpecialSkillTable.Instance.PersonalIdColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonalSpecialSkill_.Skill column object. + ''' + Public ReadOnly Property SkillColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(2), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalSpecialSkill_.Skill column object. + ''' + Public Shared ReadOnly Property Skill() As BaseClasses.Data.StringColumn + Get + Return PersonalSpecialSkillTable.Instance.SkillColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonalSpecialSkill_.Level column object. + ''' + Public ReadOnly Property LevelColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(3), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalSpecialSkill_.Level column object. + ''' + Public Shared ReadOnly Property Level() As BaseClasses.Data.StringColumn + Get + Return PersonalSpecialSkillTable.Instance.LevelColumn + End Get + End Property + + +#End Region + + +#Region "Shared helper methods" + + ''' + ''' This is a shared function that can be used to get an array of PersonalSpecialSkillRecord records using a where clause. + ''' + Public Shared Function GetRecords(ByVal where As String) As PersonalSpecialSkillRecord() + + Return GetRecords(where, Nothing, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) + End Function + + ''' + ''' This is a shared function that can be used to get an array of PersonalSpecialSkillRecord records using a where clause. + ''' + Public Shared Function GetRecords(ByVal join As BaseFilter, ByVal where As String) As PersonalSpecialSkillRecord() + + Return GetRecords(join, where, Nothing, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) + End Function + + ''' + ''' This is a shared function that can be used to get an array of PersonalSpecialSkillRecord records using a where and order by clause. + ''' + Public Shared Function GetRecords( _ + ByVal where As String, _ + ByVal orderBy As OrderBy) As PersonalSpecialSkillRecord() + + Return GetRecords(where, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) + End Function + + ''' + ''' This is a shared function that can be used to get an array of PersonalSpecialSkillRecord records using a where and order by clause. + ''' + Public Shared Function GetRecords( _ + ByVal join As BaseFilter, _ + ByVal where As String, _ + ByVal orderBy As OrderBy) As PersonalSpecialSkillRecord() + + Return GetRecords(join, where, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) + End Function + + ''' + ''' This is a shared function that can be used to get an array of PersonalSpecialSkillRecord records using a where and order by clause clause with pagination. + ''' + Public Shared Function GetRecords( _ + ByVal where As String, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As PersonalSpecialSkillRecord() + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + Dim join As BaseClasses.Data.BaseFilter = Nothing + Dim recList As ArrayList = PersonalSpecialSkillTable.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, pageIndex, pageSize) + + Return CType(recList.ToArray(GetType(Persons.Business.PersonalSpecialSkillRecord)), PersonalSpecialSkillRecord()) + End Function + + ''' + ''' This is a shared function that can be used to get an array of PersonalSpecialSkillRecord records using a where and order by clause clause with pagination. + ''' + Public Shared Function GetRecords( _ + ByVal join As BaseFilter, _ + ByVal where As String, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As PersonalSpecialSkillRecord() + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Dim recList As ArrayList = PersonalSpecialSkillTable.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, pageIndex, pageSize) + + Return CType(recList.ToArray(GetType(Persons.Business.PersonalSpecialSkillRecord)), PersonalSpecialSkillRecord()) + End Function + + Public Shared Function GetRecords( _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As PersonalSpecialSkillRecord() + Dim join As BaseClasses.Data.BaseFilter = Nothing + Dim recList As ArrayList = PersonalSpecialSkillTable.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + Return CType(recList.ToArray(GetType(Persons.Business.PersonalSpecialSkillRecord)), PersonalSpecialSkillRecord()) + End Function + + Public Shared Function GetRecords( _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As PersonalSpecialSkillRecord() + + Dim recList As ArrayList = PersonalSpecialSkillTable.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + Return CType(recList.ToArray(GetType(Persons.Business.PersonalSpecialSkillRecord)), PersonalSpecialSkillRecord()) + End Function + + Public Shared Function GetRecords( _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer, _ + ByRef totalRecords As Integer) As PersonalSpecialSkillRecord() + Dim join As BaseClasses.Data.BaseFilter = Nothing + Dim recList As ArrayList = PersonalSpecialSkillTable.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize, totalRecords) + + Return CType(recList.ToArray(GetType(Persons.Business.PersonalSpecialSkillRecord)), PersonalSpecialSkillRecord()) + End Function + + Public Shared Function GetRecords( _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer, _ + ByRef totalRecords As Integer) As PersonalSpecialSkillRecord() + + Dim recList As ArrayList = PersonalSpecialSkillTable.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize, totalRecords) + + Return CType(recList.ToArray(GetType(Persons.Business.PersonalSpecialSkillRecord)), PersonalSpecialSkillRecord()) + End Function + + ''' + ''' This is a shared function that can be used to get total number of records that will be returned using the where clause. + ''' + Public Shared Function GetRecordCount(ByVal where As String) As Integer + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Return CInt(PersonalSpecialSkillTable.Instance.GetRecordListCount(Nothing, whereFilter, Nothing, Nothing)) + End Function + +''' + ''' This is a shared function that can be used to get total number of records that will be returned using the where clause. + ''' + Public Shared Function GetRecordCount(ByVal join As BaseFilter, ByVal where As String) As Integer + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Return CInt(PersonalSpecialSkillTable.Instance.GetRecordListCount(join, whereFilter, Nothing, Nothing)) + End Function + + Public Shared Function GetRecordCount(ByVal where As WhereClause) As Integer + Return CInt(PersonalSpecialSkillTable.Instance.GetRecordListCount(Nothing, where.GetFilter(), Nothing, Nothing)) + End Function + + Public Shared Function GetRecordCount(ByVal join As BaseFilter, ByVal where As WhereClause) As Integer + Return CInt(PersonalSpecialSkillTable.Instance.GetRecordListCount(join, where.GetFilter(), Nothing, Nothing)) + End Function + + ''' + ''' This is a shared function that can be used to get a PersonalSpecialSkillRecord record using a where clause. + ''' + Public Shared Function GetRecord(ByVal where As String) As PersonalSpecialSkillRecord + Dim orderBy As OrderBy = Nothing + Return GetRecord(where, orderBy) + End Function + + ''' + ''' This is a shared function that can be used to get a PersonalSpecialSkillRecord record using a where clause. + ''' + Public Shared Function GetRecord(ByVal join As BaseFilter, ByVal where As String) As PersonalSpecialSkillRecord + Dim orderBy As OrderBy = Nothing + Return GetRecord(join, where, orderBy) + End Function + + ''' + ''' This is a shared function that can be used to get a PersonalSpecialSkillRecord record using a where and order by clause. + ''' + Public Shared Function GetRecord( _ + ByVal where As String, _ + ByVal orderBy As OrderBy) As PersonalSpecialSkillRecord + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + Dim join As BaseClasses.Data.BaseFilter = Nothing + Dim recList As ArrayList = PersonalSpecialSkillTable.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MIN_BATCH_SIZE) + + Dim rec As PersonalSpecialSkillRecord = Nothing + If recList.Count > 0 Then + rec = CType(recList(0), PersonalSpecialSkillRecord) + End If + + Return rec + End Function + + ''' + ''' This is a shared function that can be used to get a PersonalSpecialSkillRecord record using a where and order by clause. + ''' + Public Shared Function GetRecord( _ + ByVal join As BaseFilter, _ + ByVal where As String, _ + ByVal orderBy As OrderBy) As PersonalSpecialSkillRecord + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Dim recList As ArrayList = PersonalSpecialSkillTable.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MIN_BATCH_SIZE) + + Dim rec As PersonalSpecialSkillRecord = Nothing + If recList.Count > 0 Then + rec = CType(recList(0), PersonalSpecialSkillRecord) + End If + + Return rec + End Function + + + Public Shared Function GetValues( _ + ByVal col As BaseColumn, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal maxItems As Integer) As String() + + ' Create the filter list. + Dim retCol As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, True) + retCol.AddColumn(col) + + Return PersonalSpecialSkillTable.Instance.GetColumnValues(retCol, Nothing, where.GetFilter(), Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, maxItems) + + End Function + + Public Shared Function GetValues( _ + ByVal col As BaseColumn, _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal maxItems As Integer) As String() + + ' Create the filter list. + Dim retCol As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, True) + retCol.AddColumn(col) + + Return PersonalSpecialSkillTable.Instance.GetColumnValues(retCol, join, where.GetFilter(), Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, maxItems) + + End Function + + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where clause. + ''' + Public Shared Function GetDataTable(ByVal where As String) As System.Data.DataTable + + Dim recs() As PersonalSpecialSkillRecord = GetRecords(where) + Return PersonalSpecialSkillTable.Instance.CreateDataTable(recs, Nothing) + End Function + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where clause. + ''' + Public Shared Function GetDataTable(ByVal join As BaseFilter, ByVal where As String) As System.Data.DataTable + + Dim recs() As PersonalSpecialSkillRecord = GetRecords(join, where) + Return PersonalSpecialSkillTable.Instance.CreateDataTable(recs, Nothing) + End Function + + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause. + ''' + Public Shared Function GetDataTable(ByVal where As String, ByVal orderBy As OrderBy) As System.Data.DataTable + + Dim recs() As PersonalSpecialSkillRecord = GetRecords(where, orderBy) + Return PersonalSpecialSkillTable.Instance.CreateDataTable(recs, Nothing) + End Function + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause. + ''' + Public Shared Function GetDataTable(ByVal join As BaseFilter, ByVal where As String, ByVal orderBy As OrderBy) As System.Data.DataTable + + Dim recs() As PersonalSpecialSkillRecord = GetRecords(join, where, orderBy) + Return PersonalSpecialSkillTable.Instance.CreateDataTable(recs, Nothing) + End Function + + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause with pagination. + ''' + Public Shared Function GetDataTable( _ + ByVal where As String, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As System.Data.DataTable + + Dim recs() As PersonalSpecialSkillRecord = GetRecords(where, orderBy, pageIndex, pageSize) + Return PersonalSpecialSkillTable.Instance.CreateDataTable(recs, Nothing) + End Function + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause with pagination. + ''' + Public Shared Function GetDataTable( _ + ByVal join As BaseFilter, _ + ByVal where As String, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As System.Data.DataTable + + Dim recs() As PersonalSpecialSkillRecord = GetRecords(join, where, orderBy, pageIndex, pageSize) + Return PersonalSpecialSkillTable.Instance.CreateDataTable(recs, Nothing) + End Function + + + ''' + ''' This is a shared function that can be used to delete records using a where clause. + ''' + Public Shared Sub DeleteRecords(ByVal where As String) + If where = Nothing OrElse where.Trim() = "" Then + Return + End If + + Dim whereFilter As SqlFilter = New SqlFilter(where) + PersonalSpecialSkillTable.Instance.DeleteRecordList(whereFilter) + End Sub + + ''' + ''' This is a shared function that can be used to export records using a where clause. + ''' + Public Shared Function Export(ByVal where As String) As String + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Return PersonalSpecialSkillTable.Instance.ExportRecordData(whereFilter) + End Function + + Public Shared Function Export(ByVal where As WhereClause) As String + Dim whereFilter As BaseFilter = Nothing + If Not where Is Nothing Then + whereFilter = where.GetFilter() + End If + + Return PersonalSpecialSkillTable.Instance.ExportRecordData(whereFilter) + End Function + + Public Shared Function GetSum( _ + ByVal col As BaseColumn, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) _ + As String + + Dim colSel As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, False) + colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Sum) + + Return PersonalSpecialSkillTable.Instance.GetColumnStatistics(colSel, Nothing, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + End Function + + Public Shared Function GetSum( _ + ByVal col As BaseColumn, _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) _ + As String + + Dim colSel As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, False) + colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Sum) + + Return PersonalSpecialSkillTable.Instance.GetColumnStatistics(colSel, join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + End Function + + + Public Shared Function GetCount( _ + ByVal col As BaseColumn, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) _ + As String + + Dim colSel As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, False) + colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Count) + + Return PersonalSpecialSkillTable.Instance.GetColumnStatistics(colSel, Nothing, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + End Function + + Public Shared Function GetCount( _ + ByVal col As BaseColumn, _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) _ + As String + + Dim colSel As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, False) + colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Count) + + Return PersonalSpecialSkillTable.Instance.GetColumnStatistics(colSel, join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + End Function + + ''' + ''' This method returns the columns in the table. + ''' + Public Shared Function GetColumns() As BaseColumn() + Return PersonalSpecialSkillTable.Instance.TableDefinition.Columns + End Function + + ''' + ''' This method returns the columnlist in the table. + ''' + Public Shared Function GetColumnList() As ColumnList + Return PersonalSpecialSkillTable.Instance.TableDefinition.ColumnList + End Function + + + ''' + ''' This method creates a new record and returns it to be edited. + ''' + Public Shared Function CreateNewRecord() As IRecord + Return PersonalSpecialSkillTable.Instance.CreateRecord() + End Function + + ''' + ''' This method creates a new record and returns it to be edited. + ''' + ''' ID of the new record. + Public Shared Function CreateNewRecord(ByVal tempId As String) As IRecord + Return PersonalSpecialSkillTable.Instance.CreateRecord(tempId) + End Function + + ''' + ''' This method checks if column is editable. + ''' + ''' Name of the column to check. + Public Shared Function isReadOnlyColumn(ByVal columnName As String) As Boolean + Dim column As BaseColumn = GetColumn(columnName) + If (Not IsNothing(column)) Then + Return column.IsValuesReadOnly + Else + Return True + End If + End Function + + ''' + ''' This method gets the specified column. + ''' + ''' Unique name of the column to fetch. + Public Shared Function GetColumn(ByVal uniqueColumnName As String) As BaseColumn + Dim column As BaseColumn = PersonalSpecialSkillTable.Instance.TableDefinition.ColumnList.GetByUniqueName(uniqueColumnName) + Return column + End Function + + ' Convenience method for getting a record using a string-based record identifier + Public Shared Function GetRecord(ByVal id As String, ByVal bMutable As Boolean) As PersonalSpecialSkillRecord + Return CType(PersonalSpecialSkillTable.Instance.GetRecordData(id, bMutable), PersonalSpecialSkillRecord) + End Function + + ' Convenience method for getting a record using a KeyValue record identifier + Public Shared Function GetRecord(ByVal id As KeyValue, ByVal bMutable As Boolean) As PersonalSpecialSkillRecord + Return CType(PersonalSpecialSkillTable.Instance.GetRecordData(id, bMutable), PersonalSpecialSkillRecord) + End Function + + ' Convenience method for creating a record + Public Overloads Function NewRecord( _ + ByVal PersonalIdValue As String, _ + ByVal SkillValue As String, _ + ByVal LevelValue As String _ + ) As KeyValue + Dim rec As IPrimaryKeyRecord = CType(Me.CreateRecord(), IPrimaryKeyRecord) + rec.SetString(PersonalIdValue, PersonalIdColumn) + rec.SetString(SkillValue, SkillColumn) + rec.SetString(LevelValue, LevelColumn) + + + rec.Create() 'update the DB so any DB-initialized fields (like autoincrement IDs) can be initialized + + Dim key As KeyValue = rec.GetID() + Return key + End Function + + ''' + ''' This method deletes a specified record + ''' + ''' Keyvalue of the record to be deleted. + Public Shared Sub DeleteRecord(ByVal kv As KeyValue) + PersonalSpecialSkillTable.Instance.DeleteOneRecord(kv) + End Sub + + ''' + ''' This method checks if record exist in the database using the keyvalue provided. + ''' + ''' Key value of the record. + Public Shared Function DoesRecordExist(ByVal kv As KeyValue) As Boolean + Dim recordExist As Boolean = True + Try + PersonalSpecialSkillTable.GetRecord(kv, False) + Catch ex As Exception + recordExist = False + End Try + Return recordExist + End Function + + ''' + ''' This method returns all the primary columns in the table. + ''' + Public Shared Function GetPrimaryKeyColumns() As ColumnList + If (Not IsNothing(PersonalSpecialSkillTable.Instance.TableDefinition.PrimaryKey)) Then + Return PersonalSpecialSkillTable.Instance.TableDefinition.PrimaryKey.Columns + Else + Return Nothing + End If + End Function + + ''' + ''' This method takes a key and returns a keyvalue. + ''' + ''' key could be array of primary key values in case of composite primary key or a string containing single primary key value in case of non-composite primary key. + Public Shared Function GetKeyValue(ByVal key As Object) As KeyValue + Dim kv As KeyValue = Nothing + + If (Not (IsNothing(PersonalSpecialSkillTable.Instance.TableDefinition.PrimaryKey))) Then + + Dim isCompositePrimaryKey As Boolean = False + isCompositePrimaryKey = PersonalSpecialSkillTable.Instance.TableDefinition.PrimaryKey.IsCompositeKey + + If ((isCompositePrimaryKey) AndAlso (key.GetType.IsArray())) Then + + ' If the key is composite, then construct a key value. + kv = New KeyValue + Dim fullKeyString As String = "" + Dim keyArray As Array = CType(key, Array) + If (Not IsNothing(keyArray)) Then + Dim length As Integer = keyArray.Length + Dim pkColumns As ColumnList = PersonalSpecialSkillTable.Instance.TableDefinition.PrimaryKey.Columns + Dim pkColumn As BaseColumn + Dim index As Integer = 0 + For Each pkColumn In pkColumns + Dim keyString As String = CType(keyArray.GetValue(index), String) + If (PersonalSpecialSkillTable.Instance.TableDefinition.TableType = BaseClasses.Data.TableDefinition.TableTypes.Virtual) Then + kv.AddElement(pkColumn.UniqueName, keyString) + Else + kv.AddElement(pkColumn.InternalName, keyString) + End If + index = index + 1 + Next pkColumn + End If + + Else + ' If the key is not composite, then get the key value. + kv = PersonalSpecialSkillTable.Instance.TableDefinition.PrimaryKey.ParseValue(CType(key, String)) + End If + End If + Return kv + End Function + + + ''' + ''' This method takes a record and a Column and returns an evaluated value of DFKA formula. + ''' + Public Shared Function GetDFKA(ByVal rec As BaseRecord, ByVal col As BaseColumn) As String + Dim fkColumn As ForeignKey = PersonalSpecialSkillTable.Instance.TableDefinition.GetExpandableNonCompositeForeignKey(col) + If fkColumn Is Nothing Then + Return Nothing + End If + Dim _DFKA As String = fkColumn.PrimaryKeyDisplayColumns + If (_DFKA.Trim().StartsWith("=")) Then + ' if the formula is in the format of "= ., then pull out the data from the rec object instead of doing formula evaluation + Dim tableCodeName As String = fkColumn.PrimaryKeyTableDefinition.TableCodeName + Dim column As String = _DFKA.Trim("="c).Trim() + If column.StartsWith(tableCodeName & ".", StringComparison.InvariantCultureIgnoreCase) Then + column = column.Substring(tableCodeName.Length + 1) + End If + + For Each c As BaseColumn In fkColumn.PrimaryKeyTableDefinition.Columns + If column = c.CodeName Then + Return rec.Format(c) + End If + Next + Dim tableName As String = fkColumn.PrimaryKeyTableDefinition.TableCodeName + Return EvaluateFormula(_DFKA, rec, Nothing, tableName) + Else + Return Nothing + End If + End Function + + ''' + ''' This method takes a keyValue and a Column and returns an evaluated value of DFKA formula. + ''' + Public Shared Function GetDFKA(ByVal keyValue As String, ByVal col As BaseColumn, ByVal formatPattern as String) As String + If keyValue Is Nothing Then + Return Nothing + End If + Dim fkColumn As ForeignKey = PersonalSpecialSkillTable.Instance.TableDefinition.GetExpandableNonCompositeForeignKey(col) + If fkColumn Is Nothing Then + Return Nothing + End If + Dim _DFKA As String = fkColumn.PrimaryKeyDisplayColumns + If (_DFKA.Trim().StartsWith("=")) Then + Dim tableName As String = fkColumn.PrimaryKeyTableDefinition.TableCodeName + Dim t As PrimaryKeyTable = CType(DatabaseObjects.GetTableObject(tableName), PrimaryKeyTable) + Dim rec As BaseRecord = Nothing + If Not t Is Nothing Then + Try + rec = CType(t.GetRecordData(keyValue, False), BaseRecord) + Catch + rec = Nothing + End Try + End If + If rec Is Nothing Then + Return "" + End If + + ' if the formula is in the format of "= ., then pull out the data from the rec object instead of doing formula evaluation + Dim tableCodeName As String = fkColumn.PrimaryKeyTableDefinition.TableCodeName + Dim column As String = _DFKA.Trim("="c).Trim() + If column.StartsWith(tableCodeName & ".", StringComparison.InvariantCultureIgnoreCase) Then + column = column.Substring(tableCodeName.Length + 1) + End If + + For Each c As BaseColumn In fkColumn.PrimaryKeyTableDefinition.Columns + If column = c.CodeName Then + Return rec.Format(c) + End If + Next + Return EvaluateFormula(_DFKA, rec, Nothing, tableName) + Else + Return Nothing + End If + End Function + + ''' + ''' Evaluates the formula + ''' + Public Shared Function EvaluateFormula(ByVal formula As String, Optional ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord = Nothing, Optional ByVal format As String = Nothing, Optional ByVal name As String = "") As String + Dim e As BaseFormulaEvaluator = New BaseFormulaEvaluator() + If Not dataSourceForEvaluate Is Nothing Then + e.Evaluator.Variables.Add(name, dataSourceForEvaluate) + end if + e.DataSource = dataSourceForEvaluate + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + If Not String.IsNullOrEmpty(format) Then + Return BaseFormulaUtils.Format(resultObj, format) + Else + Return resultObj.ToString() + End If + End Function + + +#End Region + +End Class +End Namespace diff --git a/App_Code/Business Layer/BasePersonalSportSkillRecord.vb b/App_Code/Business Layer/BasePersonalSportSkillRecord.vb new file mode 100644 index 0000000..9408243 --- /dev/null +++ b/App_Code/Business Layer/BasePersonalSportSkillRecord.vb @@ -0,0 +1,397 @@ +' This class is "generated" and will be overwritten. +' Your customizations should be made in PersonalSportSkillRecord.vb + +Imports System.Data.SqlTypes +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + +Namespace Persons.Business + +''' +''' The generated superclass for the class. +''' +''' +''' This class is not intended to be instantiated directly. To obtain an instance of this class, +''' use the methods of the class. +''' +''' +''' + + Public Class BasePersonalSportSkillRecord + Inherits PrimaryKeyRecord + + + Public Shared Shadows ReadOnly TableUtils As PersonalSportSkillTable = PersonalSportSkillTable.Instance + + ' Constructors + + Protected Sub New() + MyBase.New(TableUtils) + End Sub + + Protected Sub New(ByVal record As PrimaryKeyRecord) + MyBase.New(record, TableUtils) + End Sub + + 'Evaluates Initialize when->Inserting record formulas specified at the data access layer + Public Overridable Sub PersonalSportSkillRecord_InsertingRecord(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles Me.InsertingRecord + 'Apply Initialize->Inserting record formula only if validation is successful. + Dim PersonalSportSkillRec As PersonalSportSkillRecord = CType(sender,PersonalSportSkillRecord) + Validate_Inserting() + If Not PersonalSportSkillRec Is Nothing AndAlso Not PersonalSportSkillRec.IsReadOnly Then + End If + End Sub + + 'Evaluates Initialize when->Updating record formulas specified at the data access layer + Public Overridable Sub PersonalSportSkillRecord_UpdatingRecord(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles Me.UpdatingRecord + 'Apply Initialize->Updating record formula only if validation is successful. + Dim PersonalSportSkillRec As PersonalSportSkillRecord = CType(sender,PersonalSportSkillRecord) + Validate_Updating() + If Not PersonalSportSkillRec Is Nothing AndAlso Not PersonalSportSkillRec.IsReadOnly Then + End If + End Sub + + 'Evaluates Initialize when->Reading record formulas specified at the data access layer + Public Overridable Sub PersonalSportSkillRecord_ReadRecord(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.ReadRecord + 'Apply Initialize->Reading record formula only if validation is successful. + Dim PersonalSportSkillRec As PersonalSportSkillRecord = CType(sender,PersonalSportSkillRecord) + If Not PersonalSportSkillRec Is Nothing AndAlso Not PersonalSportSkillRec.IsReadOnly Then + End If + End Sub + + 'Evaluates Validate when->Inserting formulas specified at the data access layer + Public Overridable Sub Validate_Inserting () + Dim fullValidationMessage As String = "" + Dim validationMessage As String = "" + + dim formula as String = "" + + + If validationMessage <> "" AndAlso validationMessage.ToLower() <> "true" Then + fullValidationMessage &= validationMessage & vbCrLf + End If + + If fullValidationMessage <> "" Then + Throw New Exception(fullValidationMessage) + End If + End Sub + + 'Evaluates Validate when->Updating formulas specified at the data access layer + Public Overridable Sub Validate_Updating () + Dim fullValidationMessage As String = "" + Dim validationMessage As String = "" + + dim formula as String = "" + + + If validationMessage <> "" AndAlso validationMessage.ToLower() <> "true" Then + fullValidationMessage &= validationMessage & vbCrLf + End If + + If fullValidationMessage <> "" Then + Throw New Exception(fullValidationMessage) + End If + End Sub + + Public Overridable Function EvaluateFormula(ByVal formula As String, Optional ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord = Nothing, Optional ByVal format As String = Nothing) As String + + Dim e As Data.BaseFormulaEvaluator = New Data.BaseFormulaEvaluator() + + ' All variables referred to in the formula are expected to be + ' properties of the DataSource. For example, referring to + ' UnitPrice as a variable will refer to DataSource.UnitPrice + e.DataSource = dataSourceForEvaluate + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + Return resultObj.ToString() + End Function + + + + + + + +#Region "Convenience methods to get/set values of fields" + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalSportSkill_.id field. + ''' + Public Function Getid0Value() As ColumnValue + Return Me.GetValue(TableUtils.id0Column) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalSportSkill_.id field. + ''' + Public Function Getid0FieldValue() As Int32 + Return CType(Me.GetValue(TableUtils.id0Column).ToInt32(), Int32) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalSportSkill_.PersonalId field. + ''' + Public Function GetPersonalIdValue() As ColumnValue + Return Me.GetValue(TableUtils.PersonalIdColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalSportSkill_.PersonalId field. + ''' + Public Function GetPersonalIdFieldValue() As String + Return CType(Me.GetValue(TableUtils.PersonalIdColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalSportSkill_.PersonalId field. + ''' + Public Sub SetPersonalIdFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.PersonalIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalSportSkill_.PersonalId field. + ''' + Public Sub SetPersonalIdFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.PersonalIdColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalSportSkill_.SportId field. + ''' + Public Function GetSportIdValue() As ColumnValue + Return Me.GetValue(TableUtils.SportIdColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalSportSkill_.SportId field. + ''' + Public Function GetSportIdFieldValue() As Int16 + Return CType(Me.GetValue(TableUtils.SportIdColumn).ToInt16(), Int16) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalSportSkill_.SportId field. + ''' + Public Sub SetSportIdFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.SportIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalSportSkill_.SportId field. + ''' + Public Sub SetSportIdFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.SportIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalSportSkill_.SportId field. + ''' + Public Sub SetSportIdFieldValue(ByVal val As Double) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.SportIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalSportSkill_.SportId field. + ''' + Public Sub SetSportIdFieldValue(ByVal val As Decimal) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.SportIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalSportSkill_.SportId field. + ''' + Public Sub SetSportIdFieldValue(ByVal val As Int64) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.SportIdColumn) + End Sub + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalSportSkill_.Level field. + ''' + Public Function GetLevelValue() As ColumnValue + Return Me.GetValue(TableUtils.LevelColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalSportSkill_.Level field. + ''' + Public Function GetLevelFieldValue() As String + Return CType(Me.GetValue(TableUtils.LevelColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalSportSkill_.Level field. + ''' + Public Sub SetLevelFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.LevelColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalSportSkill_.Level field. + ''' + Public Sub SetLevelFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.LevelColumn) + End Sub + + + +#End Region + +#Region "Convenience methods to get field names" + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonalSportSkill_.id field. + ''' + Public Property id0() As Int32 + Get + Return CType(Me.GetValue(TableUtils.id0Column).ToInt32(), Int32) + End Get + Set (ByVal val As Int32) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.id0Column) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property id0Specified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.id0Column) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property id0Default() As String + Get + Return TableUtils.id0Column.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonalSportSkill_.PersonalId field. + ''' + Public Property PersonalId() As String + Get + Return CType(Me.GetValue(TableUtils.PersonalIdColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.PersonalIdColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property PersonalIdSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.PersonalIdColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property PersonalIdDefault() As String + Get + Return TableUtils.PersonalIdColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonalSportSkill_.SportId field. + ''' + Public Property SportId() As Int16 + Get + Return CType(Me.GetValue(TableUtils.SportIdColumn).ToInt16(), Int16) + End Get + Set (ByVal val As Int16) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.SportIdColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property SportIdSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.SportIdColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property SportIdDefault() As String + Get + Return TableUtils.SportIdColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonalSportSkill_.Level field. + ''' + Public Property Level() As String + Get + Return CType(Me.GetValue(TableUtils.LevelColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.LevelColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property LevelSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.LevelColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property LevelDefault() As String + Get + Return TableUtils.LevelColumn.DefaultValue + End Get + End Property + + + +#End Region + +End Class +End Namespace diff --git a/App_Code/Business Layer/BasePersonalSportSkillTable.vb b/App_Code/Business Layer/BasePersonalSportSkillTable.vb new file mode 100644 index 0000000..a15a849 --- /dev/null +++ b/App_Code/Business Layer/BasePersonalSportSkillTable.vb @@ -0,0 +1,820 @@ +' This class is "generated" and will be overwritten. +' Your customizations should be made in PersonalSportSkillRecord.vb + +Imports System.Data.SqlTypes +Imports System.Data +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider +Imports Persons.Data + +Namespace Persons.Business + +''' +''' The generated superclass for the class. +''' Provides access to the schema information and record data of a database table or view named PersonalSportSkill. +''' +''' +''' The connection details (name, location, etc.) of the database and table (or view) accessed by this class +''' are resolved at runtime based on the connection string in the application's Web.Config file. +''' +''' This class is not intended to be instantiated directly. To obtain an instance of this class, use +''' PersonalSportSkillTable.Instance. +''' +''' +''' + + Public Class BasePersonalSportSkillTable + Inherits PrimaryKeyTable + + + Private ReadOnly TableDefinitionString As String = PersonalSportSkillDefinition.GetXMLString() + + + + + + + + Protected Sub New() + MyBase.New() + Me.Initialize() + End Sub + + Protected Overridable Sub Initialize() + Dim def As New XmlTableDefinition(TableDefinitionString) + Me.TableDefinition = New TableDefinition() + Me.TableDefinition.TableClassName = System.Reflection.Assembly.CreateQualifiedName("App_Code", "Persons.Business.PersonalSportSkillTable") + def.InitializeTableDefinition(Me.TableDefinition) + Me.ConnectionName = def.GetConnectionName() + Me.RecordClassName = System.Reflection.Assembly.CreateQualifiedName("App_Code", "Persons.Business.PersonalSportSkillRecord") + Me.ApplicationName = "App_Code" + Me.DataAdapter = New PersonalSportSkillSqlTable() + Directcast(Me.DataAdapter, PersonalSportSkillSqlTable).ConnectionName = Me.ConnectionName + + Me.TableDefinition.AdapterMetaData = Me.DataAdapter.AdapterMetaData + id0Column.CodeName = "id0" + PersonalIdColumn.CodeName = "PersonalId" + SportIdColumn.CodeName = "SportId" + LevelColumn.CodeName = "Level" + + End Sub + +#Region "Overriden methods" + + +#End Region + +#Region "Properties for columns" + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalSportSkill_.id column object. + ''' + Public ReadOnly Property id0Column() As BaseClasses.Data.NumberColumn + Get + Return CType(Me.TableDefinition.ColumnList(0), BaseClasses.Data.NumberColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalSportSkill_.id column object. + ''' + Public Shared ReadOnly Property id0() As BaseClasses.Data.NumberColumn + Get + Return PersonalSportSkillTable.Instance.id0Column + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonalSportSkill_.PersonalId column object. + ''' + Public ReadOnly Property PersonalIdColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(1), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalSportSkill_.PersonalId column object. + ''' + Public Shared ReadOnly Property PersonalId() As BaseClasses.Data.StringColumn + Get + Return PersonalSportSkillTable.Instance.PersonalIdColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonalSportSkill_.SportId column object. + ''' + Public ReadOnly Property SportIdColumn() As BaseClasses.Data.NumberColumn + Get + Return CType(Me.TableDefinition.ColumnList(2), BaseClasses.Data.NumberColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalSportSkill_.SportId column object. + ''' + Public Shared ReadOnly Property SportId() As BaseClasses.Data.NumberColumn + Get + Return PersonalSportSkillTable.Instance.SportIdColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonalSportSkill_.Level column object. + ''' + Public ReadOnly Property LevelColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(3), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalSportSkill_.Level column object. + ''' + Public Shared ReadOnly Property Level() As BaseClasses.Data.StringColumn + Get + Return PersonalSportSkillTable.Instance.LevelColumn + End Get + End Property + + +#End Region + + +#Region "Shared helper methods" + + ''' + ''' This is a shared function that can be used to get an array of PersonalSportSkillRecord records using a where clause. + ''' + Public Shared Function GetRecords(ByVal where As String) As PersonalSportSkillRecord() + + Return GetRecords(where, Nothing, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) + End Function + + ''' + ''' This is a shared function that can be used to get an array of PersonalSportSkillRecord records using a where clause. + ''' + Public Shared Function GetRecords(ByVal join As BaseFilter, ByVal where As String) As PersonalSportSkillRecord() + + Return GetRecords(join, where, Nothing, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) + End Function + + ''' + ''' This is a shared function that can be used to get an array of PersonalSportSkillRecord records using a where and order by clause. + ''' + Public Shared Function GetRecords( _ + ByVal where As String, _ + ByVal orderBy As OrderBy) As PersonalSportSkillRecord() + + Return GetRecords(where, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) + End Function + + ''' + ''' This is a shared function that can be used to get an array of PersonalSportSkillRecord records using a where and order by clause. + ''' + Public Shared Function GetRecords( _ + ByVal join As BaseFilter, _ + ByVal where As String, _ + ByVal orderBy As OrderBy) As PersonalSportSkillRecord() + + Return GetRecords(join, where, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) + End Function + + ''' + ''' This is a shared function that can be used to get an array of PersonalSportSkillRecord records using a where and order by clause clause with pagination. + ''' + Public Shared Function GetRecords( _ + ByVal where As String, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As PersonalSportSkillRecord() + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + Dim join As BaseClasses.Data.BaseFilter = Nothing + Dim recList As ArrayList = PersonalSportSkillTable.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, pageIndex, pageSize) + + Return CType(recList.ToArray(GetType(Persons.Business.PersonalSportSkillRecord)), PersonalSportSkillRecord()) + End Function + + ''' + ''' This is a shared function that can be used to get an array of PersonalSportSkillRecord records using a where and order by clause clause with pagination. + ''' + Public Shared Function GetRecords( _ + ByVal join As BaseFilter, _ + ByVal where As String, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As PersonalSportSkillRecord() + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Dim recList As ArrayList = PersonalSportSkillTable.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, pageIndex, pageSize) + + Return CType(recList.ToArray(GetType(Persons.Business.PersonalSportSkillRecord)), PersonalSportSkillRecord()) + End Function + + Public Shared Function GetRecords( _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As PersonalSportSkillRecord() + Dim join As BaseClasses.Data.BaseFilter = Nothing + Dim recList As ArrayList = PersonalSportSkillTable.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + Return CType(recList.ToArray(GetType(Persons.Business.PersonalSportSkillRecord)), PersonalSportSkillRecord()) + End Function + + Public Shared Function GetRecords( _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As PersonalSportSkillRecord() + + Dim recList As ArrayList = PersonalSportSkillTable.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + Return CType(recList.ToArray(GetType(Persons.Business.PersonalSportSkillRecord)), PersonalSportSkillRecord()) + End Function + + Public Shared Function GetRecords( _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer, _ + ByRef totalRecords As Integer) As PersonalSportSkillRecord() + Dim join As BaseClasses.Data.BaseFilter = Nothing + Dim recList As ArrayList = PersonalSportSkillTable.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize, totalRecords) + + Return CType(recList.ToArray(GetType(Persons.Business.PersonalSportSkillRecord)), PersonalSportSkillRecord()) + End Function + + Public Shared Function GetRecords( _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer, _ + ByRef totalRecords As Integer) As PersonalSportSkillRecord() + + Dim recList As ArrayList = PersonalSportSkillTable.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize, totalRecords) + + Return CType(recList.ToArray(GetType(Persons.Business.PersonalSportSkillRecord)), PersonalSportSkillRecord()) + End Function + + ''' + ''' This is a shared function that can be used to get total number of records that will be returned using the where clause. + ''' + Public Shared Function GetRecordCount(ByVal where As String) As Integer + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Return CInt(PersonalSportSkillTable.Instance.GetRecordListCount(Nothing, whereFilter, Nothing, Nothing)) + End Function + +''' + ''' This is a shared function that can be used to get total number of records that will be returned using the where clause. + ''' + Public Shared Function GetRecordCount(ByVal join As BaseFilter, ByVal where As String) As Integer + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Return CInt(PersonalSportSkillTable.Instance.GetRecordListCount(join, whereFilter, Nothing, Nothing)) + End Function + + Public Shared Function GetRecordCount(ByVal where As WhereClause) As Integer + Return CInt(PersonalSportSkillTable.Instance.GetRecordListCount(Nothing, where.GetFilter(), Nothing, Nothing)) + End Function + + Public Shared Function GetRecordCount(ByVal join As BaseFilter, ByVal where As WhereClause) As Integer + Return CInt(PersonalSportSkillTable.Instance.GetRecordListCount(join, where.GetFilter(), Nothing, Nothing)) + End Function + + ''' + ''' This is a shared function that can be used to get a PersonalSportSkillRecord record using a where clause. + ''' + Public Shared Function GetRecord(ByVal where As String) As PersonalSportSkillRecord + Dim orderBy As OrderBy = Nothing + Return GetRecord(where, orderBy) + End Function + + ''' + ''' This is a shared function that can be used to get a PersonalSportSkillRecord record using a where clause. + ''' + Public Shared Function GetRecord(ByVal join As BaseFilter, ByVal where As String) As PersonalSportSkillRecord + Dim orderBy As OrderBy = Nothing + Return GetRecord(join, where, orderBy) + End Function + + ''' + ''' This is a shared function that can be used to get a PersonalSportSkillRecord record using a where and order by clause. + ''' + Public Shared Function GetRecord( _ + ByVal where As String, _ + ByVal orderBy As OrderBy) As PersonalSportSkillRecord + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + Dim join As BaseClasses.Data.BaseFilter = Nothing + Dim recList As ArrayList = PersonalSportSkillTable.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MIN_BATCH_SIZE) + + Dim rec As PersonalSportSkillRecord = Nothing + If recList.Count > 0 Then + rec = CType(recList(0), PersonalSportSkillRecord) + End If + + Return rec + End Function + + ''' + ''' This is a shared function that can be used to get a PersonalSportSkillRecord record using a where and order by clause. + ''' + Public Shared Function GetRecord( _ + ByVal join As BaseFilter, _ + ByVal where As String, _ + ByVal orderBy As OrderBy) As PersonalSportSkillRecord + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Dim recList As ArrayList = PersonalSportSkillTable.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MIN_BATCH_SIZE) + + Dim rec As PersonalSportSkillRecord = Nothing + If recList.Count > 0 Then + rec = CType(recList(0), PersonalSportSkillRecord) + End If + + Return rec + End Function + + + Public Shared Function GetValues( _ + ByVal col As BaseColumn, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal maxItems As Integer) As String() + + ' Create the filter list. + Dim retCol As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, True) + retCol.AddColumn(col) + + Return PersonalSportSkillTable.Instance.GetColumnValues(retCol, Nothing, where.GetFilter(), Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, maxItems) + + End Function + + Public Shared Function GetValues( _ + ByVal col As BaseColumn, _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal maxItems As Integer) As String() + + ' Create the filter list. + Dim retCol As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, True) + retCol.AddColumn(col) + + Return PersonalSportSkillTable.Instance.GetColumnValues(retCol, join, where.GetFilter(), Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, maxItems) + + End Function + + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where clause. + ''' + Public Shared Function GetDataTable(ByVal where As String) As System.Data.DataTable + + Dim recs() As PersonalSportSkillRecord = GetRecords(where) + Return PersonalSportSkillTable.Instance.CreateDataTable(recs, Nothing) + End Function + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where clause. + ''' + Public Shared Function GetDataTable(ByVal join As BaseFilter, ByVal where As String) As System.Data.DataTable + + Dim recs() As PersonalSportSkillRecord = GetRecords(join, where) + Return PersonalSportSkillTable.Instance.CreateDataTable(recs, Nothing) + End Function + + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause. + ''' + Public Shared Function GetDataTable(ByVal where As String, ByVal orderBy As OrderBy) As System.Data.DataTable + + Dim recs() As PersonalSportSkillRecord = GetRecords(where, orderBy) + Return PersonalSportSkillTable.Instance.CreateDataTable(recs, Nothing) + End Function + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause. + ''' + Public Shared Function GetDataTable(ByVal join As BaseFilter, ByVal where As String, ByVal orderBy As OrderBy) As System.Data.DataTable + + Dim recs() As PersonalSportSkillRecord = GetRecords(join, where, orderBy) + Return PersonalSportSkillTable.Instance.CreateDataTable(recs, Nothing) + End Function + + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause with pagination. + ''' + Public Shared Function GetDataTable( _ + ByVal where As String, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As System.Data.DataTable + + Dim recs() As PersonalSportSkillRecord = GetRecords(where, orderBy, pageIndex, pageSize) + Return PersonalSportSkillTable.Instance.CreateDataTable(recs, Nothing) + End Function + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause with pagination. + ''' + Public Shared Function GetDataTable( _ + ByVal join As BaseFilter, _ + ByVal where As String, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As System.Data.DataTable + + Dim recs() As PersonalSportSkillRecord = GetRecords(join, where, orderBy, pageIndex, pageSize) + Return PersonalSportSkillTable.Instance.CreateDataTable(recs, Nothing) + End Function + + + ''' + ''' This is a shared function that can be used to delete records using a where clause. + ''' + Public Shared Sub DeleteRecords(ByVal where As String) + If where = Nothing OrElse where.Trim() = "" Then + Return + End If + + Dim whereFilter As SqlFilter = New SqlFilter(where) + PersonalSportSkillTable.Instance.DeleteRecordList(whereFilter) + End Sub + + ''' + ''' This is a shared function that can be used to export records using a where clause. + ''' + Public Shared Function Export(ByVal where As String) As String + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Return PersonalSportSkillTable.Instance.ExportRecordData(whereFilter) + End Function + + Public Shared Function Export(ByVal where As WhereClause) As String + Dim whereFilter As BaseFilter = Nothing + If Not where Is Nothing Then + whereFilter = where.GetFilter() + End If + + Return PersonalSportSkillTable.Instance.ExportRecordData(whereFilter) + End Function + + Public Shared Function GetSum( _ + ByVal col As BaseColumn, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) _ + As String + + Dim colSel As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, False) + colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Sum) + + Return PersonalSportSkillTable.Instance.GetColumnStatistics(colSel, Nothing, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + End Function + + Public Shared Function GetSum( _ + ByVal col As BaseColumn, _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) _ + As String + + Dim colSel As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, False) + colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Sum) + + Return PersonalSportSkillTable.Instance.GetColumnStatistics(colSel, join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + End Function + + + Public Shared Function GetCount( _ + ByVal col As BaseColumn, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) _ + As String + + Dim colSel As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, False) + colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Count) + + Return PersonalSportSkillTable.Instance.GetColumnStatistics(colSel, Nothing, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + End Function + + Public Shared Function GetCount( _ + ByVal col As BaseColumn, _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) _ + As String + + Dim colSel As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, False) + colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Count) + + Return PersonalSportSkillTable.Instance.GetColumnStatistics(colSel, join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + End Function + + ''' + ''' This method returns the columns in the table. + ''' + Public Shared Function GetColumns() As BaseColumn() + Return PersonalSportSkillTable.Instance.TableDefinition.Columns + End Function + + ''' + ''' This method returns the columnlist in the table. + ''' + Public Shared Function GetColumnList() As ColumnList + Return PersonalSportSkillTable.Instance.TableDefinition.ColumnList + End Function + + + ''' + ''' This method creates a new record and returns it to be edited. + ''' + Public Shared Function CreateNewRecord() As IRecord + Return PersonalSportSkillTable.Instance.CreateRecord() + End Function + + ''' + ''' This method creates a new record and returns it to be edited. + ''' + ''' ID of the new record. + Public Shared Function CreateNewRecord(ByVal tempId As String) As IRecord + Return PersonalSportSkillTable.Instance.CreateRecord(tempId) + End Function + + ''' + ''' This method checks if column is editable. + ''' + ''' Name of the column to check. + Public Shared Function isReadOnlyColumn(ByVal columnName As String) As Boolean + Dim column As BaseColumn = GetColumn(columnName) + If (Not IsNothing(column)) Then + Return column.IsValuesReadOnly + Else + Return True + End If + End Function + + ''' + ''' This method gets the specified column. + ''' + ''' Unique name of the column to fetch. + Public Shared Function GetColumn(ByVal uniqueColumnName As String) As BaseColumn + Dim column As BaseColumn = PersonalSportSkillTable.Instance.TableDefinition.ColumnList.GetByUniqueName(uniqueColumnName) + Return column + End Function + + ' Convenience method for getting a record using a string-based record identifier + Public Shared Function GetRecord(ByVal id As String, ByVal bMutable As Boolean) As PersonalSportSkillRecord + Return CType(PersonalSportSkillTable.Instance.GetRecordData(id, bMutable), PersonalSportSkillRecord) + End Function + + ' Convenience method for getting a record using a KeyValue record identifier + Public Shared Function GetRecord(ByVal id As KeyValue, ByVal bMutable As Boolean) As PersonalSportSkillRecord + Return CType(PersonalSportSkillTable.Instance.GetRecordData(id, bMutable), PersonalSportSkillRecord) + End Function + + ' Convenience method for creating a record + Public Overloads Function NewRecord( _ + ByVal PersonalIdValue As String, _ + ByVal SportIdValue As String, _ + ByVal LevelValue As String _ + ) As KeyValue + Dim rec As IPrimaryKeyRecord = CType(Me.CreateRecord(), IPrimaryKeyRecord) + rec.SetString(PersonalIdValue, PersonalIdColumn) + rec.SetString(SportIdValue, SportIdColumn) + rec.SetString(LevelValue, LevelColumn) + + + rec.Create() 'update the DB so any DB-initialized fields (like autoincrement IDs) can be initialized + + Dim key As KeyValue = rec.GetID() + Return key + End Function + + ''' + ''' This method deletes a specified record + ''' + ''' Keyvalue of the record to be deleted. + Public Shared Sub DeleteRecord(ByVal kv As KeyValue) + PersonalSportSkillTable.Instance.DeleteOneRecord(kv) + End Sub + + ''' + ''' This method checks if record exist in the database using the keyvalue provided. + ''' + ''' Key value of the record. + Public Shared Function DoesRecordExist(ByVal kv As KeyValue) As Boolean + Dim recordExist As Boolean = True + Try + PersonalSportSkillTable.GetRecord(kv, False) + Catch ex As Exception + recordExist = False + End Try + Return recordExist + End Function + + ''' + ''' This method returns all the primary columns in the table. + ''' + Public Shared Function GetPrimaryKeyColumns() As ColumnList + If (Not IsNothing(PersonalSportSkillTable.Instance.TableDefinition.PrimaryKey)) Then + Return PersonalSportSkillTable.Instance.TableDefinition.PrimaryKey.Columns + Else + Return Nothing + End If + End Function + + ''' + ''' This method takes a key and returns a keyvalue. + ''' + ''' key could be array of primary key values in case of composite primary key or a string containing single primary key value in case of non-composite primary key. + Public Shared Function GetKeyValue(ByVal key As Object) As KeyValue + Dim kv As KeyValue = Nothing + + If (Not (IsNothing(PersonalSportSkillTable.Instance.TableDefinition.PrimaryKey))) Then + + Dim isCompositePrimaryKey As Boolean = False + isCompositePrimaryKey = PersonalSportSkillTable.Instance.TableDefinition.PrimaryKey.IsCompositeKey + + If ((isCompositePrimaryKey) AndAlso (key.GetType.IsArray())) Then + + ' If the key is composite, then construct a key value. + kv = New KeyValue + Dim fullKeyString As String = "" + Dim keyArray As Array = CType(key, Array) + If (Not IsNothing(keyArray)) Then + Dim length As Integer = keyArray.Length + Dim pkColumns As ColumnList = PersonalSportSkillTable.Instance.TableDefinition.PrimaryKey.Columns + Dim pkColumn As BaseColumn + Dim index As Integer = 0 + For Each pkColumn In pkColumns + Dim keyString As String = CType(keyArray.GetValue(index), String) + If (PersonalSportSkillTable.Instance.TableDefinition.TableType = BaseClasses.Data.TableDefinition.TableTypes.Virtual) Then + kv.AddElement(pkColumn.UniqueName, keyString) + Else + kv.AddElement(pkColumn.InternalName, keyString) + End If + index = index + 1 + Next pkColumn + End If + + Else + ' If the key is not composite, then get the key value. + kv = PersonalSportSkillTable.Instance.TableDefinition.PrimaryKey.ParseValue(CType(key, String)) + End If + End If + Return kv + End Function + + + ''' + ''' This method takes a record and a Column and returns an evaluated value of DFKA formula. + ''' + Public Shared Function GetDFKA(ByVal rec As BaseRecord, ByVal col As BaseColumn) As String + Dim fkColumn As ForeignKey = PersonalSportSkillTable.Instance.TableDefinition.GetExpandableNonCompositeForeignKey(col) + If fkColumn Is Nothing Then + Return Nothing + End If + Dim _DFKA As String = fkColumn.PrimaryKeyDisplayColumns + If (_DFKA.Trim().StartsWith("=")) Then + ' if the formula is in the format of "= ., then pull out the data from the rec object instead of doing formula evaluation + Dim tableCodeName As String = fkColumn.PrimaryKeyTableDefinition.TableCodeName + Dim column As String = _DFKA.Trim("="c).Trim() + If column.StartsWith(tableCodeName & ".", StringComparison.InvariantCultureIgnoreCase) Then + column = column.Substring(tableCodeName.Length + 1) + End If + + For Each c As BaseColumn In fkColumn.PrimaryKeyTableDefinition.Columns + If column = c.CodeName Then + Return rec.Format(c) + End If + Next + Dim tableName As String = fkColumn.PrimaryKeyTableDefinition.TableCodeName + Return EvaluateFormula(_DFKA, rec, Nothing, tableName) + Else + Return Nothing + End If + End Function + + ''' + ''' This method takes a keyValue and a Column and returns an evaluated value of DFKA formula. + ''' + Public Shared Function GetDFKA(ByVal keyValue As String, ByVal col As BaseColumn, ByVal formatPattern as String) As String + If keyValue Is Nothing Then + Return Nothing + End If + Dim fkColumn As ForeignKey = PersonalSportSkillTable.Instance.TableDefinition.GetExpandableNonCompositeForeignKey(col) + If fkColumn Is Nothing Then + Return Nothing + End If + Dim _DFKA As String = fkColumn.PrimaryKeyDisplayColumns + If (_DFKA.Trim().StartsWith("=")) Then + Dim tableName As String = fkColumn.PrimaryKeyTableDefinition.TableCodeName + Dim t As PrimaryKeyTable = CType(DatabaseObjects.GetTableObject(tableName), PrimaryKeyTable) + Dim rec As BaseRecord = Nothing + If Not t Is Nothing Then + Try + rec = CType(t.GetRecordData(keyValue, False), BaseRecord) + Catch + rec = Nothing + End Try + End If + If rec Is Nothing Then + Return "" + End If + + ' if the formula is in the format of "= ., then pull out the data from the rec object instead of doing formula evaluation + Dim tableCodeName As String = fkColumn.PrimaryKeyTableDefinition.TableCodeName + Dim column As String = _DFKA.Trim("="c).Trim() + If column.StartsWith(tableCodeName & ".", StringComparison.InvariantCultureIgnoreCase) Then + column = column.Substring(tableCodeName.Length + 1) + End If + + For Each c As BaseColumn In fkColumn.PrimaryKeyTableDefinition.Columns + If column = c.CodeName Then + Return rec.Format(c) + End If + Next + Return EvaluateFormula(_DFKA, rec, Nothing, tableName) + Else + Return Nothing + End If + End Function + + ''' + ''' Evaluates the formula + ''' + Public Shared Function EvaluateFormula(ByVal formula As String, Optional ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord = Nothing, Optional ByVal format As String = Nothing, Optional ByVal name As String = "") As String + Dim e As BaseFormulaEvaluator = New BaseFormulaEvaluator() + If Not dataSourceForEvaluate Is Nothing Then + e.Evaluator.Variables.Add(name, dataSourceForEvaluate) + end if + e.DataSource = dataSourceForEvaluate + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + If Not String.IsNullOrEmpty(format) Then + Return BaseFormulaUtils.Format(resultObj, format) + Else + Return resultObj.ToString() + End If + End Function + + +#End Region + +End Class +End Namespace diff --git a/App_Code/Business Layer/BasePersonalTitleRecord.vb b/App_Code/Business Layer/BasePersonalTitleRecord.vb new file mode 100644 index 0000000..92a9129 --- /dev/null +++ b/App_Code/Business Layer/BasePersonalTitleRecord.vb @@ -0,0 +1,797 @@ +' This class is "generated" and will be overwritten. +' Your customizations should be made in PersonalTitleRecord.vb + +Imports System.Data.SqlTypes +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + +Namespace Persons.Business + +''' +''' The generated superclass for the class. +''' +''' +''' This class is not intended to be instantiated directly. To obtain an instance of this class, +''' use the methods of the class. +''' +''' +''' + + Public Class BasePersonalTitleRecord + Inherits PrimaryKeyRecord + + + Public Shared Shadows ReadOnly TableUtils As PersonalTitleTable = PersonalTitleTable.Instance + + ' Constructors + + Protected Sub New() + MyBase.New(TableUtils) + End Sub + + Protected Sub New(ByVal record As PrimaryKeyRecord) + MyBase.New(record, TableUtils) + End Sub + + 'Evaluates Initialize when->Inserting record formulas specified at the data access layer + Public Overridable Sub PersonalTitleRecord_InsertingRecord(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles Me.InsertingRecord + 'Apply Initialize->Inserting record formula only if validation is successful. + Dim PersonalTitleRec As PersonalTitleRecord = CType(sender,PersonalTitleRecord) + Validate_Inserting() + If Not PersonalTitleRec Is Nothing AndAlso Not PersonalTitleRec.IsReadOnly Then + End If + End Sub + + 'Evaluates Initialize when->Updating record formulas specified at the data access layer + Public Overridable Sub PersonalTitleRecord_UpdatingRecord(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles Me.UpdatingRecord + 'Apply Initialize->Updating record formula only if validation is successful. + Dim PersonalTitleRec As PersonalTitleRecord = CType(sender,PersonalTitleRecord) + Validate_Updating() + If Not PersonalTitleRec Is Nothing AndAlso Not PersonalTitleRec.IsReadOnly Then + End If + End Sub + + 'Evaluates Initialize when->Reading record formulas specified at the data access layer + Public Overridable Sub PersonalTitleRecord_ReadRecord(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.ReadRecord + 'Apply Initialize->Reading record formula only if validation is successful. + Dim PersonalTitleRec As PersonalTitleRecord = CType(sender,PersonalTitleRecord) + If Not PersonalTitleRec Is Nothing AndAlso Not PersonalTitleRec.IsReadOnly Then + End If + End Sub + + 'Evaluates Validate when->Inserting formulas specified at the data access layer + Public Overridable Sub Validate_Inserting () + Dim fullValidationMessage As String = "" + Dim validationMessage As String = "" + + dim formula as String = "" + + + If validationMessage <> "" AndAlso validationMessage.ToLower() <> "true" Then + fullValidationMessage &= validationMessage & vbCrLf + End If + + If fullValidationMessage <> "" Then + Throw New Exception(fullValidationMessage) + End If + End Sub + + 'Evaluates Validate when->Updating formulas specified at the data access layer + Public Overridable Sub Validate_Updating () + Dim fullValidationMessage As String = "" + Dim validationMessage As String = "" + + dim formula as String = "" + + + If validationMessage <> "" AndAlso validationMessage.ToLower() <> "true" Then + fullValidationMessage &= validationMessage & vbCrLf + End If + + If fullValidationMessage <> "" Then + Throw New Exception(fullValidationMessage) + End If + End Sub + + Public Overridable Function EvaluateFormula(ByVal formula As String, Optional ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord = Nothing, Optional ByVal format As String = Nothing) As String + + Dim e As Data.BaseFormulaEvaluator = New Data.BaseFormulaEvaluator() + + ' All variables referred to in the formula are expected to be + ' properties of the DataSource. For example, referring to + ' UnitPrice as a variable will refer to DataSource.UnitPrice + e.DataSource = dataSourceForEvaluate + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + Return resultObj.ToString() + End Function + + + + + + + +#Region "Convenience methods to get/set values of fields" + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalTitle_.id field. + ''' + Public Function Getid0Value() As ColumnValue + Return Me.GetValue(TableUtils.id0Column) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalTitle_.id field. + ''' + Public Function Getid0FieldValue() As Int32 + Return CType(Me.GetValue(TableUtils.id0Column).ToInt32(), Int32) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalTitle_.PersonalId field. + ''' + Public Function GetPersonalIdValue() As ColumnValue + Return Me.GetValue(TableUtils.PersonalIdColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalTitle_.PersonalId field. + ''' + Public Function GetPersonalIdFieldValue() As String + Return CType(Me.GetValue(TableUtils.PersonalIdColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalTitle_.PersonalId field. + ''' + Public Sub SetPersonalIdFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.PersonalIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalTitle_.PersonalId field. + ''' + Public Sub SetPersonalIdFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.PersonalIdColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalTitle_.TitleDate field. + ''' + Public Function GetTitleDateValue() As ColumnValue + Return Me.GetValue(TableUtils.TitleDateColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalTitle_.TitleDate field. + ''' + Public Function GetTitleDateFieldValue() As DateTime + Return CType(Me.GetValue(TableUtils.TitleDateColumn).ToDateTime(), DateTime) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalTitle_.TitleDate field. + ''' + Public Sub SetTitleDateFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.TitleDateColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalTitle_.TitleDate field. + ''' + Public Sub SetTitleDateFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.TitleDateColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalTitle_.TitleDate field. + ''' + Public Sub SetTitleDateFieldValue(ByVal val As DateTime) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.TitleDateColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalTitle_.Ass field. + ''' + Public Function GetAssValue() As ColumnValue + Return Me.GetValue(TableUtils.AssColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalTitle_.Ass field. + ''' + Public Function GetAssFieldValue() As Byte + Return CType(Me.GetValue(TableUtils.AssColumn).ToByte(), Byte) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalTitle_.Ass field. + ''' + Public Sub SetAssFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.AssColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalTitle_.Ass field. + ''' + Public Sub SetAssFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.AssColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalTitle_.Ass field. + ''' + Public Sub SetAssFieldValue(ByVal val As Double) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.AssColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalTitle_.Ass field. + ''' + Public Sub SetAssFieldValue(ByVal val As Decimal) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.AssColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalTitle_.Ass field. + ''' + Public Sub SetAssFieldValue(ByVal val As Int64) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.AssColumn) + End Sub + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalTitle_.Title field. + ''' + Public Function GetTitleValue() As ColumnValue + Return Me.GetValue(TableUtils.TitleColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalTitle_.Title field. + ''' + Public Function GetTitleFieldValue() As String + Return CType(Me.GetValue(TableUtils.TitleColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalTitle_.Title field. + ''' + Public Sub SetTitleFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.TitleColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalTitle_.Title field. + ''' + Public Sub SetTitleFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.TitleColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalTitle_.SkillNo field. + ''' + Public Function GetSkillNoValue() As ColumnValue + Return Me.GetValue(TableUtils.SkillNoColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalTitle_.SkillNo field. + ''' + Public Function GetSkillNoFieldValue() As String + Return CType(Me.GetValue(TableUtils.SkillNoColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalTitle_.SkillNo field. + ''' + Public Sub SetSkillNoFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.SkillNoColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalTitle_.SkillNo field. + ''' + Public Sub SetSkillNoFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.SkillNoColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalTitle_.TitleRank field. + ''' + Public Function GetTitleRankValue() As ColumnValue + Return Me.GetValue(TableUtils.TitleRankColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalTitle_.TitleRank field. + ''' + Public Function GetTitleRankFieldValue() As String + Return CType(Me.GetValue(TableUtils.TitleRankColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalTitle_.TitleRank field. + ''' + Public Sub SetTitleRankFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.TitleRankColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalTitle_.TitleRank field. + ''' + Public Sub SetTitleRankFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.TitleRankColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalTitle_.Command field. + ''' + Public Function GetCommandValue() As ColumnValue + Return Me.GetValue(TableUtils.CommandColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalTitle_.Command field. + ''' + Public Function GetCommandFieldValue() As String + Return CType(Me.GetValue(TableUtils.CommandColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalTitle_.Command field. + ''' + Public Sub SetCommandFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.CommandColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalTitle_.Command field. + ''' + Public Sub SetCommandFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.CommandColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalTitle_.CommandDate field. + ''' + Public Function GetCommandDateValue() As ColumnValue + Return Me.GetValue(TableUtils.CommandDateColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalTitle_.CommandDate field. + ''' + Public Function GetCommandDateFieldValue() As DateTime + Return CType(Me.GetValue(TableUtils.CommandDateColumn).ToDateTime(), DateTime) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalTitle_.CommandDate field. + ''' + Public Sub SetCommandDateFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.CommandDateColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalTitle_.CommandDate field. + ''' + Public Sub SetCommandDateFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.CommandDateColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalTitle_.CommandDate field. + ''' + Public Sub SetCommandDateFieldValue(ByVal val As DateTime) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.CommandDateColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalTitle_.Dept field. + ''' + Public Function GetDeptValue() As ColumnValue + Return Me.GetValue(TableUtils.DeptColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalTitle_.Dept field. + ''' + Public Function GetDeptFieldValue() As String + Return CType(Me.GetValue(TableUtils.DeptColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalTitle_.Dept field. + ''' + Public Sub SetDeptFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.DeptColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalTitle_.Dept field. + ''' + Public Sub SetDeptFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.DeptColumn) + End Sub + + + +#End Region + +#Region "Convenience methods to get field names" + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonalTitle_.id field. + ''' + Public Property id0() As Int32 + Get + Return CType(Me.GetValue(TableUtils.id0Column).ToInt32(), Int32) + End Get + Set (ByVal val As Int32) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.id0Column) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property id0Specified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.id0Column) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property id0Default() As String + Get + Return TableUtils.id0Column.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonalTitle_.PersonalId field. + ''' + Public Property PersonalId() As String + Get + Return CType(Me.GetValue(TableUtils.PersonalIdColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.PersonalIdColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property PersonalIdSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.PersonalIdColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property PersonalIdDefault() As String + Get + Return TableUtils.PersonalIdColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonalTitle_.TitleDate field. + ''' + Public Property TitleDate() As DateTime + Get + Return CType(Me.GetValue(TableUtils.TitleDateColumn).ToDateTime(), DateTime) + End Get + Set (ByVal val As DateTime) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.TitleDateColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property TitleDateSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.TitleDateColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property TitleDateDefault() As String + Get + Return TableUtils.TitleDateColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonalTitle_.Ass field. + ''' + Public Property Ass() As Byte + Get + Return CType(Me.GetValue(TableUtils.AssColumn).ToByte(), Byte) + End Get + Set (ByVal val As Byte) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.AssColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property AssSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.AssColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property AssDefault() As String + Get + Return TableUtils.AssColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonalTitle_.Title field. + ''' + Public Property Title() As String + Get + Return CType(Me.GetValue(TableUtils.TitleColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.TitleColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property TitleSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.TitleColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property TitleDefault() As String + Get + Return TableUtils.TitleColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonalTitle_.SkillNo field. + ''' + Public Property SkillNo() As String + Get + Return CType(Me.GetValue(TableUtils.SkillNoColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.SkillNoColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property SkillNoSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.SkillNoColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property SkillNoDefault() As String + Get + Return TableUtils.SkillNoColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonalTitle_.TitleRank field. + ''' + Public Property TitleRank() As String + Get + Return CType(Me.GetValue(TableUtils.TitleRankColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.TitleRankColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property TitleRankSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.TitleRankColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property TitleRankDefault() As String + Get + Return TableUtils.TitleRankColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonalTitle_.Command field. + ''' + Public Property Command() As String + Get + Return CType(Me.GetValue(TableUtils.CommandColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.CommandColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property CommandSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.CommandColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property CommandDefault() As String + Get + Return TableUtils.CommandColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonalTitle_.CommandDate field. + ''' + Public Property CommandDate() As DateTime + Get + Return CType(Me.GetValue(TableUtils.CommandDateColumn).ToDateTime(), DateTime) + End Get + Set (ByVal val As DateTime) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.CommandDateColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property CommandDateSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.CommandDateColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property CommandDateDefault() As String + Get + Return TableUtils.CommandDateColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonalTitle_.Dept field. + ''' + Public Property Dept() As String + Get + Return CType(Me.GetValue(TableUtils.DeptColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.DeptColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property DeptSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.DeptColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property DeptDefault() As String + Get + Return TableUtils.DeptColumn.DefaultValue + End Get + End Property + + + +#End Region + +End Class +End Namespace diff --git a/App_Code/Business Layer/BasePersonalTitleTable.vb b/App_Code/Business Layer/BasePersonalTitleTable.vb new file mode 100644 index 0000000..5d28a8d --- /dev/null +++ b/App_Code/Business Layer/BasePersonalTitleTable.vb @@ -0,0 +1,952 @@ +' This class is "generated" and will be overwritten. +' Your customizations should be made in PersonalTitleRecord.vb + +Imports System.Data.SqlTypes +Imports System.Data +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider +Imports Persons.Data + +Namespace Persons.Business + +''' +''' The generated superclass for the class. +''' Provides access to the schema information and record data of a database table or view named PersonalTitle. +''' +''' +''' The connection details (name, location, etc.) of the database and table (or view) accessed by this class +''' are resolved at runtime based on the connection string in the application's Web.Config file. +''' +''' This class is not intended to be instantiated directly. To obtain an instance of this class, use +''' PersonalTitleTable.Instance. +''' +''' +''' + + Public Class BasePersonalTitleTable + Inherits PrimaryKeyTable + + + Private ReadOnly TableDefinitionString As String = PersonalTitleDefinition.GetXMLString() + + + + + + + + Protected Sub New() + MyBase.New() + Me.Initialize() + End Sub + + Protected Overridable Sub Initialize() + Dim def As New XmlTableDefinition(TableDefinitionString) + Me.TableDefinition = New TableDefinition() + Me.TableDefinition.TableClassName = System.Reflection.Assembly.CreateQualifiedName("App_Code", "Persons.Business.PersonalTitleTable") + def.InitializeTableDefinition(Me.TableDefinition) + Me.ConnectionName = def.GetConnectionName() + Me.RecordClassName = System.Reflection.Assembly.CreateQualifiedName("App_Code", "Persons.Business.PersonalTitleRecord") + Me.ApplicationName = "App_Code" + Me.DataAdapter = New PersonalTitleSqlTable() + Directcast(Me.DataAdapter, PersonalTitleSqlTable).ConnectionName = Me.ConnectionName + + Me.TableDefinition.AdapterMetaData = Me.DataAdapter.AdapterMetaData + id0Column.CodeName = "id0" + PersonalIdColumn.CodeName = "PersonalId" + TitleDateColumn.CodeName = "TitleDate" + AssColumn.CodeName = "Ass" + TitleColumn.CodeName = "Title" + SkillNoColumn.CodeName = "SkillNo" + TitleRankColumn.CodeName = "TitleRank" + CommandColumn.CodeName = "Command" + CommandDateColumn.CodeName = "CommandDate" + DeptColumn.CodeName = "Dept" + + End Sub + +#Region "Overriden methods" + + +#End Region + +#Region "Properties for columns" + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalTitle_.id column object. + ''' + Public ReadOnly Property id0Column() As BaseClasses.Data.NumberColumn + Get + Return CType(Me.TableDefinition.ColumnList(0), BaseClasses.Data.NumberColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalTitle_.id column object. + ''' + Public Shared ReadOnly Property id0() As BaseClasses.Data.NumberColumn + Get + Return PersonalTitleTable.Instance.id0Column + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonalTitle_.PersonalId column object. + ''' + Public ReadOnly Property PersonalIdColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(1), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalTitle_.PersonalId column object. + ''' + Public Shared ReadOnly Property PersonalId() As BaseClasses.Data.StringColumn + Get + Return PersonalTitleTable.Instance.PersonalIdColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonalTitle_.TitleDate column object. + ''' + Public ReadOnly Property TitleDateColumn() As BaseClasses.Data.DateColumn + Get + Return CType(Me.TableDefinition.ColumnList(2), BaseClasses.Data.DateColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalTitle_.TitleDate column object. + ''' + Public Shared ReadOnly Property TitleDate() As BaseClasses.Data.DateColumn + Get + Return PersonalTitleTable.Instance.TitleDateColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonalTitle_.Ass column object. + ''' + Public ReadOnly Property AssColumn() As BaseClasses.Data.NumberColumn + Get + Return CType(Me.TableDefinition.ColumnList(3), BaseClasses.Data.NumberColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalTitle_.Ass column object. + ''' + Public Shared ReadOnly Property Ass() As BaseClasses.Data.NumberColumn + Get + Return PersonalTitleTable.Instance.AssColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonalTitle_.Title column object. + ''' + Public ReadOnly Property TitleColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(4), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalTitle_.Title column object. + ''' + Public Shared ReadOnly Property Title() As BaseClasses.Data.StringColumn + Get + Return PersonalTitleTable.Instance.TitleColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonalTitle_.SkillNo column object. + ''' + Public ReadOnly Property SkillNoColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(5), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalTitle_.SkillNo column object. + ''' + Public Shared ReadOnly Property SkillNo() As BaseClasses.Data.StringColumn + Get + Return PersonalTitleTable.Instance.SkillNoColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonalTitle_.TitleRank column object. + ''' + Public ReadOnly Property TitleRankColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(6), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalTitle_.TitleRank column object. + ''' + Public Shared ReadOnly Property TitleRank() As BaseClasses.Data.StringColumn + Get + Return PersonalTitleTable.Instance.TitleRankColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonalTitle_.Command column object. + ''' + Public ReadOnly Property CommandColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(7), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalTitle_.Command column object. + ''' + Public Shared ReadOnly Property Command() As BaseClasses.Data.StringColumn + Get + Return PersonalTitleTable.Instance.CommandColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonalTitle_.CommandDate column object. + ''' + Public ReadOnly Property CommandDateColumn() As BaseClasses.Data.DateColumn + Get + Return CType(Me.TableDefinition.ColumnList(8), BaseClasses.Data.DateColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalTitle_.CommandDate column object. + ''' + Public Shared ReadOnly Property CommandDate() As BaseClasses.Data.DateColumn + Get + Return PersonalTitleTable.Instance.CommandDateColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonalTitle_.Dept column object. + ''' + Public ReadOnly Property DeptColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(9), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalTitle_.Dept column object. + ''' + Public Shared ReadOnly Property Dept() As BaseClasses.Data.StringColumn + Get + Return PersonalTitleTable.Instance.DeptColumn + End Get + End Property + + +#End Region + + +#Region "Shared helper methods" + + ''' + ''' This is a shared function that can be used to get an array of PersonalTitleRecord records using a where clause. + ''' + Public Shared Function GetRecords(ByVal where As String) As PersonalTitleRecord() + + Return GetRecords(where, Nothing, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) + End Function + + ''' + ''' This is a shared function that can be used to get an array of PersonalTitleRecord records using a where clause. + ''' + Public Shared Function GetRecords(ByVal join As BaseFilter, ByVal where As String) As PersonalTitleRecord() + + Return GetRecords(join, where, Nothing, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) + End Function + + ''' + ''' This is a shared function that can be used to get an array of PersonalTitleRecord records using a where and order by clause. + ''' + Public Shared Function GetRecords( _ + ByVal where As String, _ + ByVal orderBy As OrderBy) As PersonalTitleRecord() + + Return GetRecords(where, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) + End Function + + ''' + ''' This is a shared function that can be used to get an array of PersonalTitleRecord records using a where and order by clause. + ''' + Public Shared Function GetRecords( _ + ByVal join As BaseFilter, _ + ByVal where As String, _ + ByVal orderBy As OrderBy) As PersonalTitleRecord() + + Return GetRecords(join, where, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) + End Function + + ''' + ''' This is a shared function that can be used to get an array of PersonalTitleRecord records using a where and order by clause clause with pagination. + ''' + Public Shared Function GetRecords( _ + ByVal where As String, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As PersonalTitleRecord() + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + Dim join As BaseClasses.Data.BaseFilter = Nothing + Dim recList As ArrayList = PersonalTitleTable.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, pageIndex, pageSize) + + Return CType(recList.ToArray(GetType(Persons.Business.PersonalTitleRecord)), PersonalTitleRecord()) + End Function + + ''' + ''' This is a shared function that can be used to get an array of PersonalTitleRecord records using a where and order by clause clause with pagination. + ''' + Public Shared Function GetRecords( _ + ByVal join As BaseFilter, _ + ByVal where As String, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As PersonalTitleRecord() + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Dim recList As ArrayList = PersonalTitleTable.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, pageIndex, pageSize) + + Return CType(recList.ToArray(GetType(Persons.Business.PersonalTitleRecord)), PersonalTitleRecord()) + End Function + + Public Shared Function GetRecords( _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As PersonalTitleRecord() + Dim join As BaseClasses.Data.BaseFilter = Nothing + Dim recList As ArrayList = PersonalTitleTable.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + Return CType(recList.ToArray(GetType(Persons.Business.PersonalTitleRecord)), PersonalTitleRecord()) + End Function + + Public Shared Function GetRecords( _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As PersonalTitleRecord() + + Dim recList As ArrayList = PersonalTitleTable.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + Return CType(recList.ToArray(GetType(Persons.Business.PersonalTitleRecord)), PersonalTitleRecord()) + End Function + + Public Shared Function GetRecords( _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer, _ + ByRef totalRecords As Integer) As PersonalTitleRecord() + Dim join As BaseClasses.Data.BaseFilter = Nothing + Dim recList As ArrayList = PersonalTitleTable.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize, totalRecords) + + Return CType(recList.ToArray(GetType(Persons.Business.PersonalTitleRecord)), PersonalTitleRecord()) + End Function + + Public Shared Function GetRecords( _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer, _ + ByRef totalRecords As Integer) As PersonalTitleRecord() + + Dim recList As ArrayList = PersonalTitleTable.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize, totalRecords) + + Return CType(recList.ToArray(GetType(Persons.Business.PersonalTitleRecord)), PersonalTitleRecord()) + End Function + + ''' + ''' This is a shared function that can be used to get total number of records that will be returned using the where clause. + ''' + Public Shared Function GetRecordCount(ByVal where As String) As Integer + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Return CInt(PersonalTitleTable.Instance.GetRecordListCount(Nothing, whereFilter, Nothing, Nothing)) + End Function + +''' + ''' This is a shared function that can be used to get total number of records that will be returned using the where clause. + ''' + Public Shared Function GetRecordCount(ByVal join As BaseFilter, ByVal where As String) As Integer + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Return CInt(PersonalTitleTable.Instance.GetRecordListCount(join, whereFilter, Nothing, Nothing)) + End Function + + Public Shared Function GetRecordCount(ByVal where As WhereClause) As Integer + Return CInt(PersonalTitleTable.Instance.GetRecordListCount(Nothing, where.GetFilter(), Nothing, Nothing)) + End Function + + Public Shared Function GetRecordCount(ByVal join As BaseFilter, ByVal where As WhereClause) As Integer + Return CInt(PersonalTitleTable.Instance.GetRecordListCount(join, where.GetFilter(), Nothing, Nothing)) + End Function + + ''' + ''' This is a shared function that can be used to get a PersonalTitleRecord record using a where clause. + ''' + Public Shared Function GetRecord(ByVal where As String) As PersonalTitleRecord + Dim orderBy As OrderBy = Nothing + Return GetRecord(where, orderBy) + End Function + + ''' + ''' This is a shared function that can be used to get a PersonalTitleRecord record using a where clause. + ''' + Public Shared Function GetRecord(ByVal join As BaseFilter, ByVal where As String) As PersonalTitleRecord + Dim orderBy As OrderBy = Nothing + Return GetRecord(join, where, orderBy) + End Function + + ''' + ''' This is a shared function that can be used to get a PersonalTitleRecord record using a where and order by clause. + ''' + Public Shared Function GetRecord( _ + ByVal where As String, _ + ByVal orderBy As OrderBy) As PersonalTitleRecord + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + Dim join As BaseClasses.Data.BaseFilter = Nothing + Dim recList As ArrayList = PersonalTitleTable.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MIN_BATCH_SIZE) + + Dim rec As PersonalTitleRecord = Nothing + If recList.Count > 0 Then + rec = CType(recList(0), PersonalTitleRecord) + End If + + Return rec + End Function + + ''' + ''' This is a shared function that can be used to get a PersonalTitleRecord record using a where and order by clause. + ''' + Public Shared Function GetRecord( _ + ByVal join As BaseFilter, _ + ByVal where As String, _ + ByVal orderBy As OrderBy) As PersonalTitleRecord + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Dim recList As ArrayList = PersonalTitleTable.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MIN_BATCH_SIZE) + + Dim rec As PersonalTitleRecord = Nothing + If recList.Count > 0 Then + rec = CType(recList(0), PersonalTitleRecord) + End If + + Return rec + End Function + + + Public Shared Function GetValues( _ + ByVal col As BaseColumn, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal maxItems As Integer) As String() + + ' Create the filter list. + Dim retCol As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, True) + retCol.AddColumn(col) + + Return PersonalTitleTable.Instance.GetColumnValues(retCol, Nothing, where.GetFilter(), Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, maxItems) + + End Function + + Public Shared Function GetValues( _ + ByVal col As BaseColumn, _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal maxItems As Integer) As String() + + ' Create the filter list. + Dim retCol As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, True) + retCol.AddColumn(col) + + Return PersonalTitleTable.Instance.GetColumnValues(retCol, join, where.GetFilter(), Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, maxItems) + + End Function + + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where clause. + ''' + Public Shared Function GetDataTable(ByVal where As String) As System.Data.DataTable + + Dim recs() As PersonalTitleRecord = GetRecords(where) + Return PersonalTitleTable.Instance.CreateDataTable(recs, Nothing) + End Function + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where clause. + ''' + Public Shared Function GetDataTable(ByVal join As BaseFilter, ByVal where As String) As System.Data.DataTable + + Dim recs() As PersonalTitleRecord = GetRecords(join, where) + Return PersonalTitleTable.Instance.CreateDataTable(recs, Nothing) + End Function + + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause. + ''' + Public Shared Function GetDataTable(ByVal where As String, ByVal orderBy As OrderBy) As System.Data.DataTable + + Dim recs() As PersonalTitleRecord = GetRecords(where, orderBy) + Return PersonalTitleTable.Instance.CreateDataTable(recs, Nothing) + End Function + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause. + ''' + Public Shared Function GetDataTable(ByVal join As BaseFilter, ByVal where As String, ByVal orderBy As OrderBy) As System.Data.DataTable + + Dim recs() As PersonalTitleRecord = GetRecords(join, where, orderBy) + Return PersonalTitleTable.Instance.CreateDataTable(recs, Nothing) + End Function + + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause with pagination. + ''' + Public Shared Function GetDataTable( _ + ByVal where As String, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As System.Data.DataTable + + Dim recs() As PersonalTitleRecord = GetRecords(where, orderBy, pageIndex, pageSize) + Return PersonalTitleTable.Instance.CreateDataTable(recs, Nothing) + End Function + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause with pagination. + ''' + Public Shared Function GetDataTable( _ + ByVal join As BaseFilter, _ + ByVal where As String, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As System.Data.DataTable + + Dim recs() As PersonalTitleRecord = GetRecords(join, where, orderBy, pageIndex, pageSize) + Return PersonalTitleTable.Instance.CreateDataTable(recs, Nothing) + End Function + + + ''' + ''' This is a shared function that can be used to delete records using a where clause. + ''' + Public Shared Sub DeleteRecords(ByVal where As String) + If where = Nothing OrElse where.Trim() = "" Then + Return + End If + + Dim whereFilter As SqlFilter = New SqlFilter(where) + PersonalTitleTable.Instance.DeleteRecordList(whereFilter) + End Sub + + ''' + ''' This is a shared function that can be used to export records using a where clause. + ''' + Public Shared Function Export(ByVal where As String) As String + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Return PersonalTitleTable.Instance.ExportRecordData(whereFilter) + End Function + + Public Shared Function Export(ByVal where As WhereClause) As String + Dim whereFilter As BaseFilter = Nothing + If Not where Is Nothing Then + whereFilter = where.GetFilter() + End If + + Return PersonalTitleTable.Instance.ExportRecordData(whereFilter) + End Function + + Public Shared Function GetSum( _ + ByVal col As BaseColumn, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) _ + As String + + Dim colSel As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, False) + colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Sum) + + Return PersonalTitleTable.Instance.GetColumnStatistics(colSel, Nothing, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + End Function + + Public Shared Function GetSum( _ + ByVal col As BaseColumn, _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) _ + As String + + Dim colSel As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, False) + colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Sum) + + Return PersonalTitleTable.Instance.GetColumnStatistics(colSel, join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + End Function + + + Public Shared Function GetCount( _ + ByVal col As BaseColumn, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) _ + As String + + Dim colSel As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, False) + colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Count) + + Return PersonalTitleTable.Instance.GetColumnStatistics(colSel, Nothing, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + End Function + + Public Shared Function GetCount( _ + ByVal col As BaseColumn, _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) _ + As String + + Dim colSel As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, False) + colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Count) + + Return PersonalTitleTable.Instance.GetColumnStatistics(colSel, join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + End Function + + ''' + ''' This method returns the columns in the table. + ''' + Public Shared Function GetColumns() As BaseColumn() + Return PersonalTitleTable.Instance.TableDefinition.Columns + End Function + + ''' + ''' This method returns the columnlist in the table. + ''' + Public Shared Function GetColumnList() As ColumnList + Return PersonalTitleTable.Instance.TableDefinition.ColumnList + End Function + + + ''' + ''' This method creates a new record and returns it to be edited. + ''' + Public Shared Function CreateNewRecord() As IRecord + Return PersonalTitleTable.Instance.CreateRecord() + End Function + + ''' + ''' This method creates a new record and returns it to be edited. + ''' + ''' ID of the new record. + Public Shared Function CreateNewRecord(ByVal tempId As String) As IRecord + Return PersonalTitleTable.Instance.CreateRecord(tempId) + End Function + + ''' + ''' This method checks if column is editable. + ''' + ''' Name of the column to check. + Public Shared Function isReadOnlyColumn(ByVal columnName As String) As Boolean + Dim column As BaseColumn = GetColumn(columnName) + If (Not IsNothing(column)) Then + Return column.IsValuesReadOnly + Else + Return True + End If + End Function + + ''' + ''' This method gets the specified column. + ''' + ''' Unique name of the column to fetch. + Public Shared Function GetColumn(ByVal uniqueColumnName As String) As BaseColumn + Dim column As BaseColumn = PersonalTitleTable.Instance.TableDefinition.ColumnList.GetByUniqueName(uniqueColumnName) + Return column + End Function + + ' Convenience method for getting a record using a string-based record identifier + Public Shared Function GetRecord(ByVal id As String, ByVal bMutable As Boolean) As PersonalTitleRecord + Return CType(PersonalTitleTable.Instance.GetRecordData(id, bMutable), PersonalTitleRecord) + End Function + + ' Convenience method for getting a record using a KeyValue record identifier + Public Shared Function GetRecord(ByVal id As KeyValue, ByVal bMutable As Boolean) As PersonalTitleRecord + Return CType(PersonalTitleTable.Instance.GetRecordData(id, bMutable), PersonalTitleRecord) + End Function + + ' Convenience method for creating a record + Public Overloads Function NewRecord( _ + ByVal PersonalIdValue As String, _ + ByVal TitleDateValue As String, _ + ByVal AssValue As String, _ + ByVal TitleValue As String, _ + ByVal SkillNoValue As String, _ + ByVal TitleRankValue As String, _ + ByVal CommandValue As String, _ + ByVal CommandDateValue As String, _ + ByVal DeptValue As String _ + ) As KeyValue + Dim rec As IPrimaryKeyRecord = CType(Me.CreateRecord(), IPrimaryKeyRecord) + rec.SetString(PersonalIdValue, PersonalIdColumn) + rec.SetString(TitleDateValue, TitleDateColumn) + rec.SetString(AssValue, AssColumn) + rec.SetString(TitleValue, TitleColumn) + rec.SetString(SkillNoValue, SkillNoColumn) + rec.SetString(TitleRankValue, TitleRankColumn) + rec.SetString(CommandValue, CommandColumn) + rec.SetString(CommandDateValue, CommandDateColumn) + rec.SetString(DeptValue, DeptColumn) + + + rec.Create() 'update the DB so any DB-initialized fields (like autoincrement IDs) can be initialized + + Dim key As KeyValue = rec.GetID() + Return key + End Function + + ''' + ''' This method deletes a specified record + ''' + ''' Keyvalue of the record to be deleted. + Public Shared Sub DeleteRecord(ByVal kv As KeyValue) + PersonalTitleTable.Instance.DeleteOneRecord(kv) + End Sub + + ''' + ''' This method checks if record exist in the database using the keyvalue provided. + ''' + ''' Key value of the record. + Public Shared Function DoesRecordExist(ByVal kv As KeyValue) As Boolean + Dim recordExist As Boolean = True + Try + PersonalTitleTable.GetRecord(kv, False) + Catch ex As Exception + recordExist = False + End Try + Return recordExist + End Function + + ''' + ''' This method returns all the primary columns in the table. + ''' + Public Shared Function GetPrimaryKeyColumns() As ColumnList + If (Not IsNothing(PersonalTitleTable.Instance.TableDefinition.PrimaryKey)) Then + Return PersonalTitleTable.Instance.TableDefinition.PrimaryKey.Columns + Else + Return Nothing + End If + End Function + + ''' + ''' This method takes a key and returns a keyvalue. + ''' + ''' key could be array of primary key values in case of composite primary key or a string containing single primary key value in case of non-composite primary key. + Public Shared Function GetKeyValue(ByVal key As Object) As KeyValue + Dim kv As KeyValue = Nothing + + If (Not (IsNothing(PersonalTitleTable.Instance.TableDefinition.PrimaryKey))) Then + + Dim isCompositePrimaryKey As Boolean = False + isCompositePrimaryKey = PersonalTitleTable.Instance.TableDefinition.PrimaryKey.IsCompositeKey + + If ((isCompositePrimaryKey) AndAlso (key.GetType.IsArray())) Then + + ' If the key is composite, then construct a key value. + kv = New KeyValue + Dim fullKeyString As String = "" + Dim keyArray As Array = CType(key, Array) + If (Not IsNothing(keyArray)) Then + Dim length As Integer = keyArray.Length + Dim pkColumns As ColumnList = PersonalTitleTable.Instance.TableDefinition.PrimaryKey.Columns + Dim pkColumn As BaseColumn + Dim index As Integer = 0 + For Each pkColumn In pkColumns + Dim keyString As String = CType(keyArray.GetValue(index), String) + If (PersonalTitleTable.Instance.TableDefinition.TableType = BaseClasses.Data.TableDefinition.TableTypes.Virtual) Then + kv.AddElement(pkColumn.UniqueName, keyString) + Else + kv.AddElement(pkColumn.InternalName, keyString) + End If + index = index + 1 + Next pkColumn + End If + + Else + ' If the key is not composite, then get the key value. + kv = PersonalTitleTable.Instance.TableDefinition.PrimaryKey.ParseValue(CType(key, String)) + End If + End If + Return kv + End Function + + + ''' + ''' This method takes a record and a Column and returns an evaluated value of DFKA formula. + ''' + Public Shared Function GetDFKA(ByVal rec As BaseRecord, ByVal col As BaseColumn) As String + Dim fkColumn As ForeignKey = PersonalTitleTable.Instance.TableDefinition.GetExpandableNonCompositeForeignKey(col) + If fkColumn Is Nothing Then + Return Nothing + End If + Dim _DFKA As String = fkColumn.PrimaryKeyDisplayColumns + If (_DFKA.Trim().StartsWith("=")) Then + ' if the formula is in the format of "= ., then pull out the data from the rec object instead of doing formula evaluation + Dim tableCodeName As String = fkColumn.PrimaryKeyTableDefinition.TableCodeName + Dim column As String = _DFKA.Trim("="c).Trim() + If column.StartsWith(tableCodeName & ".", StringComparison.InvariantCultureIgnoreCase) Then + column = column.Substring(tableCodeName.Length + 1) + End If + + For Each c As BaseColumn In fkColumn.PrimaryKeyTableDefinition.Columns + If column = c.CodeName Then + Return rec.Format(c) + End If + Next + Dim tableName As String = fkColumn.PrimaryKeyTableDefinition.TableCodeName + Return EvaluateFormula(_DFKA, rec, Nothing, tableName) + Else + Return Nothing + End If + End Function + + ''' + ''' This method takes a keyValue and a Column and returns an evaluated value of DFKA formula. + ''' + Public Shared Function GetDFKA(ByVal keyValue As String, ByVal col As BaseColumn, ByVal formatPattern as String) As String + If keyValue Is Nothing Then + Return Nothing + End If + Dim fkColumn As ForeignKey = PersonalTitleTable.Instance.TableDefinition.GetExpandableNonCompositeForeignKey(col) + If fkColumn Is Nothing Then + Return Nothing + End If + Dim _DFKA As String = fkColumn.PrimaryKeyDisplayColumns + If (_DFKA.Trim().StartsWith("=")) Then + Dim tableName As String = fkColumn.PrimaryKeyTableDefinition.TableCodeName + Dim t As PrimaryKeyTable = CType(DatabaseObjects.GetTableObject(tableName), PrimaryKeyTable) + Dim rec As BaseRecord = Nothing + If Not t Is Nothing Then + Try + rec = CType(t.GetRecordData(keyValue, False), BaseRecord) + Catch + rec = Nothing + End Try + End If + If rec Is Nothing Then + Return "" + End If + + ' if the formula is in the format of "= ., then pull out the data from the rec object instead of doing formula evaluation + Dim tableCodeName As String = fkColumn.PrimaryKeyTableDefinition.TableCodeName + Dim column As String = _DFKA.Trim("="c).Trim() + If column.StartsWith(tableCodeName & ".", StringComparison.InvariantCultureIgnoreCase) Then + column = column.Substring(tableCodeName.Length + 1) + End If + + For Each c As BaseColumn In fkColumn.PrimaryKeyTableDefinition.Columns + If column = c.CodeName Then + Return rec.Format(c) + End If + Next + Return EvaluateFormula(_DFKA, rec, Nothing, tableName) + Else + Return Nothing + End If + End Function + + ''' + ''' Evaluates the formula + ''' + Public Shared Function EvaluateFormula(ByVal formula As String, Optional ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord = Nothing, Optional ByVal format As String = Nothing, Optional ByVal name As String = "") As String + Dim e As BaseFormulaEvaluator = New BaseFormulaEvaluator() + If Not dataSourceForEvaluate Is Nothing Then + e.Evaluator.Variables.Add(name, dataSourceForEvaluate) + end if + e.DataSource = dataSourceForEvaluate + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + If Not String.IsNullOrEmpty(format) Then + Return BaseFormulaUtils.Format(resultObj, format) + Else + Return resultObj.ToString() + End If + End Function + + +#End Region + +End Class +End Namespace diff --git a/App_Code/Business Layer/BaseRStatusRecord.vb b/App_Code/Business Layer/BaseRStatusRecord.vb new file mode 100644 index 0000000..d319b07 --- /dev/null +++ b/App_Code/Business Layer/BaseRStatusRecord.vb @@ -0,0 +1,283 @@ +' This class is "generated" and will be overwritten. +' Your customizations should be made in RStatusRecord.vb + +Imports System.Data.SqlTypes +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + +Namespace Persons.Business + +''' +''' The generated superclass for the class. +''' +''' +''' This class is not intended to be instantiated directly. To obtain an instance of this class, +''' use the methods of the class. +''' +''' +''' + + Public Class BaseRStatusRecord + Inherits PrimaryKeyRecord + + + Public Shared Shadows ReadOnly TableUtils As RStatusTable = RStatusTable.Instance + + ' Constructors + + Protected Sub New() + MyBase.New(TableUtils) + End Sub + + Protected Sub New(ByVal record As PrimaryKeyRecord) + MyBase.New(record, TableUtils) + End Sub + + 'Evaluates Initialize when->Inserting record formulas specified at the data access layer + Public Overridable Sub RStatusRecord_InsertingRecord(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles Me.InsertingRecord + 'Apply Initialize->Inserting record formula only if validation is successful. + Dim RStatusRec As RStatusRecord = CType(sender,RStatusRecord) + Validate_Inserting() + If Not RStatusRec Is Nothing AndAlso Not RStatusRec.IsReadOnly Then + End If + End Sub + + 'Evaluates Initialize when->Updating record formulas specified at the data access layer + Public Overridable Sub RStatusRecord_UpdatingRecord(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles Me.UpdatingRecord + 'Apply Initialize->Updating record formula only if validation is successful. + Dim RStatusRec As RStatusRecord = CType(sender,RStatusRecord) + Validate_Updating() + If Not RStatusRec Is Nothing AndAlso Not RStatusRec.IsReadOnly Then + End If + End Sub + + 'Evaluates Initialize when->Reading record formulas specified at the data access layer + Public Overridable Sub RStatusRecord_ReadRecord(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.ReadRecord + 'Apply Initialize->Reading record formula only if validation is successful. + Dim RStatusRec As RStatusRecord = CType(sender,RStatusRecord) + If Not RStatusRec Is Nothing AndAlso Not RStatusRec.IsReadOnly Then + End If + End Sub + + 'Evaluates Validate when->Inserting formulas specified at the data access layer + Public Overridable Sub Validate_Inserting () + Dim fullValidationMessage As String = "" + Dim validationMessage As String = "" + + dim formula as String = "" + + + If validationMessage <> "" AndAlso validationMessage.ToLower() <> "true" Then + fullValidationMessage &= validationMessage & vbCrLf + End If + + If fullValidationMessage <> "" Then + Throw New Exception(fullValidationMessage) + End If + End Sub + + 'Evaluates Validate when->Updating formulas specified at the data access layer + Public Overridable Sub Validate_Updating () + Dim fullValidationMessage As String = "" + Dim validationMessage As String = "" + + dim formula as String = "" + + + If validationMessage <> "" AndAlso validationMessage.ToLower() <> "true" Then + fullValidationMessage &= validationMessage & vbCrLf + End If + + If fullValidationMessage <> "" Then + Throw New Exception(fullValidationMessage) + End If + End Sub + + Public Overridable Function EvaluateFormula(ByVal formula As String, Optional ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord = Nothing, Optional ByVal format As String = Nothing) As String + + Dim e As Data.BaseFormulaEvaluator = New Data.BaseFormulaEvaluator() + + ' All variables referred to in the formula are expected to be + ' properties of the DataSource. For example, referring to + ' UnitPrice as a variable will refer to DataSource.UnitPrice + e.DataSource = dataSourceForEvaluate + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + Return resultObj.ToString() + End Function + + + + + + + +#Region "Convenience methods to get/set values of fields" + + ''' + ''' This is a convenience method that provides direct access to the value of the record's RStatus_.RStatusId field. + ''' + Public Function GetRStatusIdValue() As ColumnValue + Return Me.GetValue(TableUtils.RStatusIdColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's RStatus_.RStatusId field. + ''' + Public Function GetRStatusIdFieldValue() As Byte + Return CType(Me.GetValue(TableUtils.RStatusIdColumn).ToByte(), Byte) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's RStatus_.RStatusId field. + ''' + Public Sub SetRStatusIdFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.RStatusIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's RStatus_.RStatusId field. + ''' + Public Sub SetRStatusIdFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.RStatusIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's RStatus_.RStatusId field. + ''' + Public Sub SetRStatusIdFieldValue(ByVal val As Double) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.RStatusIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's RStatus_.RStatusId field. + ''' + Public Sub SetRStatusIdFieldValue(ByVal val As Decimal) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.RStatusIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's RStatus_.RStatusId field. + ''' + Public Sub SetRStatusIdFieldValue(ByVal val As Int64) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.RStatusIdColumn) + End Sub + ''' + ''' This is a convenience method that provides direct access to the value of the record's RStatus_.RStatus field. + ''' + Public Function GetRStatusValue() As ColumnValue + Return Me.GetValue(TableUtils.RStatusColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's RStatus_.RStatus field. + ''' + Public Function GetRStatusFieldValue() As String + Return CType(Me.GetValue(TableUtils.RStatusColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's RStatus_.RStatus field. + ''' + Public Sub SetRStatusFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.RStatusColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's RStatus_.RStatus field. + ''' + Public Sub SetRStatusFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.RStatusColumn) + End Sub + + + +#End Region + +#Region "Convenience methods to get field names" + + ''' + ''' This is a convenience property that provides direct access to the value of the record's RStatus_.RStatusId field. + ''' + Public Property RStatusId() As Byte + Get + Return CType(Me.GetValue(TableUtils.RStatusIdColumn).ToByte(), Byte) + End Get + Set (ByVal val As Byte) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.RStatusIdColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property RStatusIdSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.RStatusIdColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property RStatusIdDefault() As String + Get + Return TableUtils.RStatusIdColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's RStatus_.RStatus field. + ''' + Public Property RStatus() As String + Get + Return CType(Me.GetValue(TableUtils.RStatusColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.RStatusColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property RStatusSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.RStatusColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property RStatusDefault() As String + Get + Return TableUtils.RStatusColumn.DefaultValue + End Get + End Property + + + +#End Region + +End Class +End Namespace diff --git a/App_Code/Business Layer/BaseRStatusTable.vb b/App_Code/Business Layer/BaseRStatusTable.vb new file mode 100644 index 0000000..10944d5 --- /dev/null +++ b/App_Code/Business Layer/BaseRStatusTable.vb @@ -0,0 +1,778 @@ +' This class is "generated" and will be overwritten. +' Your customizations should be made in RStatusRecord.vb + +Imports System.Data.SqlTypes +Imports System.Data +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider +Imports Persons.Data + +Namespace Persons.Business + +''' +''' The generated superclass for the class. +''' Provides access to the schema information and record data of a database table or view named RStatus. +''' +''' +''' The connection details (name, location, etc.) of the database and table (or view) accessed by this class +''' are resolved at runtime based on the connection string in the application's Web.Config file. +''' +''' This class is not intended to be instantiated directly. To obtain an instance of this class, use +''' RStatusTable.Instance. +''' +''' +''' + + Public Class BaseRStatusTable + Inherits PrimaryKeyTable + + + Private ReadOnly TableDefinitionString As String = RStatusDefinition.GetXMLString() + + + + + + + + Protected Sub New() + MyBase.New() + Me.Initialize() + End Sub + + Protected Overridable Sub Initialize() + Dim def As New XmlTableDefinition(TableDefinitionString) + Me.TableDefinition = New TableDefinition() + Me.TableDefinition.TableClassName = System.Reflection.Assembly.CreateQualifiedName("App_Code", "Persons.Business.RStatusTable") + def.InitializeTableDefinition(Me.TableDefinition) + Me.ConnectionName = def.GetConnectionName() + Me.RecordClassName = System.Reflection.Assembly.CreateQualifiedName("App_Code", "Persons.Business.RStatusRecord") + Me.ApplicationName = "App_Code" + Me.DataAdapter = New RStatusSqlTable() + Directcast(Me.DataAdapter, RStatusSqlTable).ConnectionName = Me.ConnectionName + + Me.TableDefinition.AdapterMetaData = Me.DataAdapter.AdapterMetaData + RStatusIdColumn.CodeName = "RStatusId" + RStatusColumn.CodeName = "RStatus" + + End Sub + +#Region "Overriden methods" + + +#End Region + +#Region "Properties for columns" + + ''' + ''' This is a convenience property that provides direct access to the table's RStatus_.RStatusId column object. + ''' + Public ReadOnly Property RStatusIdColumn() As BaseClasses.Data.NumberColumn + Get + Return CType(Me.TableDefinition.ColumnList(0), BaseClasses.Data.NumberColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's RStatus_.RStatusId column object. + ''' + Public Shared ReadOnly Property RStatusId() As BaseClasses.Data.NumberColumn + Get + Return RStatusTable.Instance.RStatusIdColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's RStatus_.RStatus column object. + ''' + Public ReadOnly Property RStatusColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(1), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's RStatus_.RStatus column object. + ''' + Public Shared ReadOnly Property RStatus() As BaseClasses.Data.StringColumn + Get + Return RStatusTable.Instance.RStatusColumn + End Get + End Property + + +#End Region + + +#Region "Shared helper methods" + + ''' + ''' This is a shared function that can be used to get an array of RStatusRecord records using a where clause. + ''' + Public Shared Function GetRecords(ByVal where As String) As RStatusRecord() + + Return GetRecords(where, Nothing, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) + End Function + + ''' + ''' This is a shared function that can be used to get an array of RStatusRecord records using a where clause. + ''' + Public Shared Function GetRecords(ByVal join As BaseFilter, ByVal where As String) As RStatusRecord() + + Return GetRecords(join, where, Nothing, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) + End Function + + ''' + ''' This is a shared function that can be used to get an array of RStatusRecord records using a where and order by clause. + ''' + Public Shared Function GetRecords( _ + ByVal where As String, _ + ByVal orderBy As OrderBy) As RStatusRecord() + + Return GetRecords(where, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) + End Function + + ''' + ''' This is a shared function that can be used to get an array of RStatusRecord records using a where and order by clause. + ''' + Public Shared Function GetRecords( _ + ByVal join As BaseFilter, _ + ByVal where As String, _ + ByVal orderBy As OrderBy) As RStatusRecord() + + Return GetRecords(join, where, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) + End Function + + ''' + ''' This is a shared function that can be used to get an array of RStatusRecord records using a where and order by clause clause with pagination. + ''' + Public Shared Function GetRecords( _ + ByVal where As String, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As RStatusRecord() + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + Dim join As BaseClasses.Data.BaseFilter = Nothing + Dim recList As ArrayList = RStatusTable.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, pageIndex, pageSize) + + Return CType(recList.ToArray(GetType(Persons.Business.RStatusRecord)), RStatusRecord()) + End Function + + ''' + ''' This is a shared function that can be used to get an array of RStatusRecord records using a where and order by clause clause with pagination. + ''' + Public Shared Function GetRecords( _ + ByVal join As BaseFilter, _ + ByVal where As String, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As RStatusRecord() + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Dim recList As ArrayList = RStatusTable.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, pageIndex, pageSize) + + Return CType(recList.ToArray(GetType(Persons.Business.RStatusRecord)), RStatusRecord()) + End Function + + Public Shared Function GetRecords( _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As RStatusRecord() + Dim join As BaseClasses.Data.BaseFilter = Nothing + Dim recList As ArrayList = RStatusTable.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + Return CType(recList.ToArray(GetType(Persons.Business.RStatusRecord)), RStatusRecord()) + End Function + + Public Shared Function GetRecords( _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As RStatusRecord() + + Dim recList As ArrayList = RStatusTable.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + Return CType(recList.ToArray(GetType(Persons.Business.RStatusRecord)), RStatusRecord()) + End Function + + Public Shared Function GetRecords( _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer, _ + ByRef totalRecords As Integer) As RStatusRecord() + Dim join As BaseClasses.Data.BaseFilter = Nothing + Dim recList As ArrayList = RStatusTable.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize, totalRecords) + + Return CType(recList.ToArray(GetType(Persons.Business.RStatusRecord)), RStatusRecord()) + End Function + + Public Shared Function GetRecords( _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer, _ + ByRef totalRecords As Integer) As RStatusRecord() + + Dim recList As ArrayList = RStatusTable.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize, totalRecords) + + Return CType(recList.ToArray(GetType(Persons.Business.RStatusRecord)), RStatusRecord()) + End Function + + ''' + ''' This is a shared function that can be used to get total number of records that will be returned using the where clause. + ''' + Public Shared Function GetRecordCount(ByVal where As String) As Integer + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Return CInt(RStatusTable.Instance.GetRecordListCount(Nothing, whereFilter, Nothing, Nothing)) + End Function + +''' + ''' This is a shared function that can be used to get total number of records that will be returned using the where clause. + ''' + Public Shared Function GetRecordCount(ByVal join As BaseFilter, ByVal where As String) As Integer + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Return CInt(RStatusTable.Instance.GetRecordListCount(join, whereFilter, Nothing, Nothing)) + End Function + + Public Shared Function GetRecordCount(ByVal where As WhereClause) As Integer + Return CInt(RStatusTable.Instance.GetRecordListCount(Nothing, where.GetFilter(), Nothing, Nothing)) + End Function + + Public Shared Function GetRecordCount(ByVal join As BaseFilter, ByVal where As WhereClause) As Integer + Return CInt(RStatusTable.Instance.GetRecordListCount(join, where.GetFilter(), Nothing, Nothing)) + End Function + + ''' + ''' This is a shared function that can be used to get a RStatusRecord record using a where clause. + ''' + Public Shared Function GetRecord(ByVal where As String) As RStatusRecord + Dim orderBy As OrderBy = Nothing + Return GetRecord(where, orderBy) + End Function + + ''' + ''' This is a shared function that can be used to get a RStatusRecord record using a where clause. + ''' + Public Shared Function GetRecord(ByVal join As BaseFilter, ByVal where As String) As RStatusRecord + Dim orderBy As OrderBy = Nothing + Return GetRecord(join, where, orderBy) + End Function + + ''' + ''' This is a shared function that can be used to get a RStatusRecord record using a where and order by clause. + ''' + Public Shared Function GetRecord( _ + ByVal where As String, _ + ByVal orderBy As OrderBy) As RStatusRecord + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + Dim join As BaseClasses.Data.BaseFilter = Nothing + Dim recList As ArrayList = RStatusTable.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MIN_BATCH_SIZE) + + Dim rec As RStatusRecord = Nothing + If recList.Count > 0 Then + rec = CType(recList(0), RStatusRecord) + End If + + Return rec + End Function + + ''' + ''' This is a shared function that can be used to get a RStatusRecord record using a where and order by clause. + ''' + Public Shared Function GetRecord( _ + ByVal join As BaseFilter, _ + ByVal where As String, _ + ByVal orderBy As OrderBy) As RStatusRecord + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Dim recList As ArrayList = RStatusTable.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MIN_BATCH_SIZE) + + Dim rec As RStatusRecord = Nothing + If recList.Count > 0 Then + rec = CType(recList(0), RStatusRecord) + End If + + Return rec + End Function + + + Public Shared Function GetValues( _ + ByVal col As BaseColumn, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal maxItems As Integer) As String() + + ' Create the filter list. + Dim retCol As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, True) + retCol.AddColumn(col) + + Return RStatusTable.Instance.GetColumnValues(retCol, Nothing, where.GetFilter(), Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, maxItems) + + End Function + + Public Shared Function GetValues( _ + ByVal col As BaseColumn, _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal maxItems As Integer) As String() + + ' Create the filter list. + Dim retCol As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, True) + retCol.AddColumn(col) + + Return RStatusTable.Instance.GetColumnValues(retCol, join, where.GetFilter(), Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, maxItems) + + End Function + + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where clause. + ''' + Public Shared Function GetDataTable(ByVal where As String) As System.Data.DataTable + + Dim recs() As RStatusRecord = GetRecords(where) + Return RStatusTable.Instance.CreateDataTable(recs, Nothing) + End Function + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where clause. + ''' + Public Shared Function GetDataTable(ByVal join As BaseFilter, ByVal where As String) As System.Data.DataTable + + Dim recs() As RStatusRecord = GetRecords(join, where) + Return RStatusTable.Instance.CreateDataTable(recs, Nothing) + End Function + + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause. + ''' + Public Shared Function GetDataTable(ByVal where As String, ByVal orderBy As OrderBy) As System.Data.DataTable + + Dim recs() As RStatusRecord = GetRecords(where, orderBy) + Return RStatusTable.Instance.CreateDataTable(recs, Nothing) + End Function + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause. + ''' + Public Shared Function GetDataTable(ByVal join As BaseFilter, ByVal where As String, ByVal orderBy As OrderBy) As System.Data.DataTable + + Dim recs() As RStatusRecord = GetRecords(join, where, orderBy) + Return RStatusTable.Instance.CreateDataTable(recs, Nothing) + End Function + + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause with pagination. + ''' + Public Shared Function GetDataTable( _ + ByVal where As String, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As System.Data.DataTable + + Dim recs() As RStatusRecord = GetRecords(where, orderBy, pageIndex, pageSize) + Return RStatusTable.Instance.CreateDataTable(recs, Nothing) + End Function + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause with pagination. + ''' + Public Shared Function GetDataTable( _ + ByVal join As BaseFilter, _ + ByVal where As String, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As System.Data.DataTable + + Dim recs() As RStatusRecord = GetRecords(join, where, orderBy, pageIndex, pageSize) + Return RStatusTable.Instance.CreateDataTable(recs, Nothing) + End Function + + + ''' + ''' This is a shared function that can be used to delete records using a where clause. + ''' + Public Shared Sub DeleteRecords(ByVal where As String) + If where = Nothing OrElse where.Trim() = "" Then + Return + End If + + Dim whereFilter As SqlFilter = New SqlFilter(where) + RStatusTable.Instance.DeleteRecordList(whereFilter) + End Sub + + ''' + ''' This is a shared function that can be used to export records using a where clause. + ''' + Public Shared Function Export(ByVal where As String) As String + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Return RStatusTable.Instance.ExportRecordData(whereFilter) + End Function + + Public Shared Function Export(ByVal where As WhereClause) As String + Dim whereFilter As BaseFilter = Nothing + If Not where Is Nothing Then + whereFilter = where.GetFilter() + End If + + Return RStatusTable.Instance.ExportRecordData(whereFilter) + End Function + + Public Shared Function GetSum( _ + ByVal col As BaseColumn, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) _ + As String + + Dim colSel As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, False) + colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Sum) + + Return RStatusTable.Instance.GetColumnStatistics(colSel, Nothing, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + End Function + + Public Shared Function GetSum( _ + ByVal col As BaseColumn, _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) _ + As String + + Dim colSel As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, False) + colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Sum) + + Return RStatusTable.Instance.GetColumnStatistics(colSel, join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + End Function + + + Public Shared Function GetCount( _ + ByVal col As BaseColumn, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) _ + As String + + Dim colSel As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, False) + colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Count) + + Return RStatusTable.Instance.GetColumnStatistics(colSel, Nothing, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + End Function + + Public Shared Function GetCount( _ + ByVal col As BaseColumn, _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) _ + As String + + Dim colSel As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, False) + colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Count) + + Return RStatusTable.Instance.GetColumnStatistics(colSel, join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + End Function + + ''' + ''' This method returns the columns in the table. + ''' + Public Shared Function GetColumns() As BaseColumn() + Return RStatusTable.Instance.TableDefinition.Columns + End Function + + ''' + ''' This method returns the columnlist in the table. + ''' + Public Shared Function GetColumnList() As ColumnList + Return RStatusTable.Instance.TableDefinition.ColumnList + End Function + + + ''' + ''' This method creates a new record and returns it to be edited. + ''' + Public Shared Function CreateNewRecord() As IRecord + Return RStatusTable.Instance.CreateRecord() + End Function + + ''' + ''' This method creates a new record and returns it to be edited. + ''' + ''' ID of the new record. + Public Shared Function CreateNewRecord(ByVal tempId As String) As IRecord + Return RStatusTable.Instance.CreateRecord(tempId) + End Function + + ''' + ''' This method checks if column is editable. + ''' + ''' Name of the column to check. + Public Shared Function isReadOnlyColumn(ByVal columnName As String) As Boolean + Dim column As BaseColumn = GetColumn(columnName) + If (Not IsNothing(column)) Then + Return column.IsValuesReadOnly + Else + Return True + End If + End Function + + ''' + ''' This method gets the specified column. + ''' + ''' Unique name of the column to fetch. + Public Shared Function GetColumn(ByVal uniqueColumnName As String) As BaseColumn + Dim column As BaseColumn = RStatusTable.Instance.TableDefinition.ColumnList.GetByUniqueName(uniqueColumnName) + Return column + End Function + + ' Convenience method for getting a record using a string-based record identifier + Public Shared Function GetRecord(ByVal id As String, ByVal bMutable As Boolean) As RStatusRecord + Return CType(RStatusTable.Instance.GetRecordData(id, bMutable), RStatusRecord) + End Function + + ' Convenience method for getting a record using a KeyValue record identifier + Public Shared Function GetRecord(ByVal id As KeyValue, ByVal bMutable As Boolean) As RStatusRecord + Return CType(RStatusTable.Instance.GetRecordData(id, bMutable), RStatusRecord) + End Function + + ' Convenience method for creating a record + Public Overloads Function NewRecord( _ + ByVal RStatusIdValue As String, _ + ByVal RStatusValue As String _ + ) As KeyValue + Dim rec As IPrimaryKeyRecord = CType(Me.CreateRecord(), IPrimaryKeyRecord) + rec.SetString(RStatusIdValue, RStatusIdColumn) + rec.SetString(RStatusValue, RStatusColumn) + + + rec.Create() 'update the DB so any DB-initialized fields (like autoincrement IDs) can be initialized + + Dim key As KeyValue = rec.GetID() + Return key + End Function + + ''' + ''' This method deletes a specified record + ''' + ''' Keyvalue of the record to be deleted. + Public Shared Sub DeleteRecord(ByVal kv As KeyValue) + RStatusTable.Instance.DeleteOneRecord(kv) + End Sub + + ''' + ''' This method checks if record exist in the database using the keyvalue provided. + ''' + ''' Key value of the record. + Public Shared Function DoesRecordExist(ByVal kv As KeyValue) As Boolean + Dim recordExist As Boolean = True + Try + RStatusTable.GetRecord(kv, False) + Catch ex As Exception + recordExist = False + End Try + Return recordExist + End Function + + ''' + ''' This method returns all the primary columns in the table. + ''' + Public Shared Function GetPrimaryKeyColumns() As ColumnList + If (Not IsNothing(RStatusTable.Instance.TableDefinition.PrimaryKey)) Then + Return RStatusTable.Instance.TableDefinition.PrimaryKey.Columns + Else + Return Nothing + End If + End Function + + ''' + ''' This method takes a key and returns a keyvalue. + ''' + ''' key could be array of primary key values in case of composite primary key or a string containing single primary key value in case of non-composite primary key. + Public Shared Function GetKeyValue(ByVal key As Object) As KeyValue + Dim kv As KeyValue = Nothing + + If (Not (IsNothing(RStatusTable.Instance.TableDefinition.PrimaryKey))) Then + + Dim isCompositePrimaryKey As Boolean = False + isCompositePrimaryKey = RStatusTable.Instance.TableDefinition.PrimaryKey.IsCompositeKey + + If ((isCompositePrimaryKey) AndAlso (key.GetType.IsArray())) Then + + ' If the key is composite, then construct a key value. + kv = New KeyValue + Dim fullKeyString As String = "" + Dim keyArray As Array = CType(key, Array) + If (Not IsNothing(keyArray)) Then + Dim length As Integer = keyArray.Length + Dim pkColumns As ColumnList = RStatusTable.Instance.TableDefinition.PrimaryKey.Columns + Dim pkColumn As BaseColumn + Dim index As Integer = 0 + For Each pkColumn In pkColumns + Dim keyString As String = CType(keyArray.GetValue(index), String) + If (RStatusTable.Instance.TableDefinition.TableType = BaseClasses.Data.TableDefinition.TableTypes.Virtual) Then + kv.AddElement(pkColumn.UniqueName, keyString) + Else + kv.AddElement(pkColumn.InternalName, keyString) + End If + index = index + 1 + Next pkColumn + End If + + Else + ' If the key is not composite, then get the key value. + kv = RStatusTable.Instance.TableDefinition.PrimaryKey.ParseValue(CType(key, String)) + End If + End If + Return kv + End Function + + + ''' + ''' This method takes a record and a Column and returns an evaluated value of DFKA formula. + ''' + Public Shared Function GetDFKA(ByVal rec As BaseRecord, ByVal col As BaseColumn) As String + Dim fkColumn As ForeignKey = RStatusTable.Instance.TableDefinition.GetExpandableNonCompositeForeignKey(col) + If fkColumn Is Nothing Then + Return Nothing + End If + Dim _DFKA As String = fkColumn.PrimaryKeyDisplayColumns + If (_DFKA.Trim().StartsWith("=")) Then + ' if the formula is in the format of "= ., then pull out the data from the rec object instead of doing formula evaluation + Dim tableCodeName As String = fkColumn.PrimaryKeyTableDefinition.TableCodeName + Dim column As String = _DFKA.Trim("="c).Trim() + If column.StartsWith(tableCodeName & ".", StringComparison.InvariantCultureIgnoreCase) Then + column = column.Substring(tableCodeName.Length + 1) + End If + + For Each c As BaseColumn In fkColumn.PrimaryKeyTableDefinition.Columns + If column = c.CodeName Then + Return rec.Format(c) + End If + Next + Dim tableName As String = fkColumn.PrimaryKeyTableDefinition.TableCodeName + Return EvaluateFormula(_DFKA, rec, Nothing, tableName) + Else + Return Nothing + End If + End Function + + ''' + ''' This method takes a keyValue and a Column and returns an evaluated value of DFKA formula. + ''' + Public Shared Function GetDFKA(ByVal keyValue As String, ByVal col As BaseColumn, ByVal formatPattern as String) As String + If keyValue Is Nothing Then + Return Nothing + End If + Dim fkColumn As ForeignKey = RStatusTable.Instance.TableDefinition.GetExpandableNonCompositeForeignKey(col) + If fkColumn Is Nothing Then + Return Nothing + End If + Dim _DFKA As String = fkColumn.PrimaryKeyDisplayColumns + If (_DFKA.Trim().StartsWith("=")) Then + Dim tableName As String = fkColumn.PrimaryKeyTableDefinition.TableCodeName + Dim t As PrimaryKeyTable = CType(DatabaseObjects.GetTableObject(tableName), PrimaryKeyTable) + Dim rec As BaseRecord = Nothing + If Not t Is Nothing Then + Try + rec = CType(t.GetRecordData(keyValue, False), BaseRecord) + Catch + rec = Nothing + End Try + End If + If rec Is Nothing Then + Return "" + End If + + ' if the formula is in the format of "= ., then pull out the data from the rec object instead of doing formula evaluation + Dim tableCodeName As String = fkColumn.PrimaryKeyTableDefinition.TableCodeName + Dim column As String = _DFKA.Trim("="c).Trim() + If column.StartsWith(tableCodeName & ".", StringComparison.InvariantCultureIgnoreCase) Then + column = column.Substring(tableCodeName.Length + 1) + End If + + For Each c As BaseColumn In fkColumn.PrimaryKeyTableDefinition.Columns + If column = c.CodeName Then + Return rec.Format(c) + End If + Next + Return EvaluateFormula(_DFKA, rec, Nothing, tableName) + Else + Return Nothing + End If + End Function + + ''' + ''' Evaluates the formula + ''' + Public Shared Function EvaluateFormula(ByVal formula As String, Optional ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord = Nothing, Optional ByVal format As String = Nothing, Optional ByVal name As String = "") As String + Dim e As BaseFormulaEvaluator = New BaseFormulaEvaluator() + If Not dataSourceForEvaluate Is Nothing Then + e.Evaluator.Variables.Add(name, dataSourceForEvaluate) + end if + e.DataSource = dataSourceForEvaluate + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + If Not String.IsNullOrEmpty(format) Then + Return BaseFormulaUtils.Format(resultObj, format) + Else + Return resultObj.ToString() + End If + End Function + + +#End Region + +End Class +End Namespace diff --git a/App_Code/Business Layer/BaseRankRecord.vb b/App_Code/Business Layer/BaseRankRecord.vb new file mode 100644 index 0000000..2945f88 --- /dev/null +++ b/App_Code/Business Layer/BaseRankRecord.vb @@ -0,0 +1,841 @@ +' This class is "generated" and will be overwritten. +' Your customizations should be made in RankRecord.vb + +Imports System.Data.SqlTypes +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + +Namespace Persons.Business + +''' +''' The generated superclass for the class. +''' +''' +''' This class is not intended to be instantiated directly. To obtain an instance of this class, +''' use the methods of the class. +''' +''' +''' + + Public Class BaseRankRecord + Inherits PrimaryKeyRecord + + + Public Shared Shadows ReadOnly TableUtils As RankTable = RankTable.Instance + + ' Constructors + + Protected Sub New() + MyBase.New(TableUtils) + End Sub + + Protected Sub New(ByVal record As PrimaryKeyRecord) + MyBase.New(record, TableUtils) + End Sub + + 'Evaluates Initialize when->Inserting record formulas specified at the data access layer + Public Overridable Sub RankRecord_InsertingRecord(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles Me.InsertingRecord + 'Apply Initialize->Inserting record formula only if validation is successful. + Dim RankRec As RankRecord = CType(sender,RankRecord) + Validate_Inserting() + If Not RankRec Is Nothing AndAlso Not RankRec.IsReadOnly Then + End If + End Sub + + 'Evaluates Initialize when->Updating record formulas specified at the data access layer + Public Overridable Sub RankRecord_UpdatingRecord(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles Me.UpdatingRecord + 'Apply Initialize->Updating record formula only if validation is successful. + Dim RankRec As RankRecord = CType(sender,RankRecord) + Validate_Updating() + If Not RankRec Is Nothing AndAlso Not RankRec.IsReadOnly Then + End If + End Sub + + 'Evaluates Initialize when->Reading record formulas specified at the data access layer + Public Overridable Sub RankRecord_ReadRecord(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.ReadRecord + 'Apply Initialize->Reading record formula only if validation is successful. + Dim RankRec As RankRecord = CType(sender,RankRecord) + If Not RankRec Is Nothing AndAlso Not RankRec.IsReadOnly Then + End If + End Sub + + 'Evaluates Validate when->Inserting formulas specified at the data access layer + Public Overridable Sub Validate_Inserting () + Dim fullValidationMessage As String = "" + Dim validationMessage As String = "" + + dim formula as String = "" + + + If validationMessage <> "" AndAlso validationMessage.ToLower() <> "true" Then + fullValidationMessage &= validationMessage & vbCrLf + End If + + If fullValidationMessage <> "" Then + Throw New Exception(fullValidationMessage) + End If + End Sub + + 'Evaluates Validate when->Updating formulas specified at the data access layer + Public Overridable Sub Validate_Updating () + Dim fullValidationMessage As String = "" + Dim validationMessage As String = "" + + dim formula as String = "" + + + If validationMessage <> "" AndAlso validationMessage.ToLower() <> "true" Then + fullValidationMessage &= validationMessage & vbCrLf + End If + + If fullValidationMessage <> "" Then + Throw New Exception(fullValidationMessage) + End If + End Sub + + Public Overridable Function EvaluateFormula(ByVal formula As String, Optional ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord = Nothing, Optional ByVal format As String = Nothing) As String + + Dim e As Data.BaseFormulaEvaluator = New Data.BaseFormulaEvaluator() + + ' All variables referred to in the formula are expected to be + ' properties of the DataSource. For example, referring to + ' UnitPrice as a variable will refer to DataSource.UnitPrice + e.DataSource = dataSourceForEvaluate + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + Return resultObj.ToString() + End Function + + + + + + + +#Region "Convenience methods to get/set values of fields" + + ''' + ''' This is a convenience method that provides direct access to the value of the record's Rank_.RankId field. + ''' + Public Function GetRankIdValue() As ColumnValue + Return Me.GetValue(TableUtils.RankIdColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's Rank_.RankId field. + ''' + Public Function GetRankIdFieldValue() As Int32 + Return CType(Me.GetValue(TableUtils.RankIdColumn).ToInt32(), Int32) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Rank_.RankId field. + ''' + Public Sub SetRankIdFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.RankIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Rank_.RankId field. + ''' + Public Sub SetRankIdFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.RankIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Rank_.RankId field. + ''' + Public Sub SetRankIdFieldValue(ByVal val As Double) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.RankIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Rank_.RankId field. + ''' + Public Sub SetRankIdFieldValue(ByVal val As Decimal) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.RankIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Rank_.RankId field. + ''' + Public Sub SetRankIdFieldValue(ByVal val As Int64) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.RankIdColumn) + End Sub + ''' + ''' This is a convenience method that provides direct access to the value of the record's Rank_.RankLevel field. + ''' + Public Function GetRankLevelValue() As ColumnValue + Return Me.GetValue(TableUtils.RankLevelColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's Rank_.RankLevel field. + ''' + Public Function GetRankLevelFieldValue() As Int32 + Return CType(Me.GetValue(TableUtils.RankLevelColumn).ToInt32(), Int32) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Rank_.RankLevel field. + ''' + Public Sub SetRankLevelFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.RankLevelColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Rank_.RankLevel field. + ''' + Public Sub SetRankLevelFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.RankLevelColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Rank_.RankLevel field. + ''' + Public Sub SetRankLevelFieldValue(ByVal val As Double) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.RankLevelColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Rank_.RankLevel field. + ''' + Public Sub SetRankLevelFieldValue(ByVal val As Decimal) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.RankLevelColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Rank_.RankLevel field. + ''' + Public Sub SetRankLevelFieldValue(ByVal val As Int64) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.RankLevelColumn) + End Sub + ''' + ''' This is a convenience method that provides direct access to the value of the record's Rank_.ArmyId field. + ''' + Public Function GetArmyIdValue() As ColumnValue + Return Me.GetValue(TableUtils.ArmyIdColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's Rank_.ArmyId field. + ''' + Public Function GetArmyIdFieldValue() As Byte + Return CType(Me.GetValue(TableUtils.ArmyIdColumn).ToByte(), Byte) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Rank_.ArmyId field. + ''' + Public Sub SetArmyIdFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.ArmyIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Rank_.ArmyId field. + ''' + Public Sub SetArmyIdFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.ArmyIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Rank_.ArmyId field. + ''' + Public Sub SetArmyIdFieldValue(ByVal val As Double) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.ArmyIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Rank_.ArmyId field. + ''' + Public Sub SetArmyIdFieldValue(ByVal val As Decimal) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.ArmyIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Rank_.ArmyId field. + ''' + Public Sub SetArmyIdFieldValue(ByVal val As Int64) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.ArmyIdColumn) + End Sub + ''' + ''' This is a convenience method that provides direct access to the value of the record's Rank_.ShortRank field. + ''' + Public Function GetShortRankValue() As ColumnValue + Return Me.GetValue(TableUtils.ShortRankColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's Rank_.ShortRank field. + ''' + Public Function GetShortRankFieldValue() As String + Return CType(Me.GetValue(TableUtils.ShortRankColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Rank_.ShortRank field. + ''' + Public Sub SetShortRankFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.ShortRankColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Rank_.ShortRank field. + ''' + Public Sub SetShortRankFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.ShortRankColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's Rank_.ShortRankNormal field. + ''' + Public Function GetShortRankNormalValue() As ColumnValue + Return Me.GetValue(TableUtils.ShortRankNormalColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's Rank_.ShortRankNormal field. + ''' + Public Function GetShortRankNormalFieldValue() As String + Return CType(Me.GetValue(TableUtils.ShortRankNormalColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Rank_.ShortRankNormal field. + ''' + Public Sub SetShortRankNormalFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.ShortRankNormalColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Rank_.ShortRankNormal field. + ''' + Public Sub SetShortRankNormalFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.ShortRankNormalColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's Rank_.EShortRank field. + ''' + Public Function GetEShortRankValue() As ColumnValue + Return Me.GetValue(TableUtils.EShortRankColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's Rank_.EShortRank field. + ''' + Public Function GetEShortRankFieldValue() As String + Return CType(Me.GetValue(TableUtils.EShortRankColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Rank_.EShortRank field. + ''' + Public Sub SetEShortRankFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.EShortRankColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Rank_.EShortRank field. + ''' + Public Sub SetEShortRankFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.EShortRankColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's Rank_.RankName field. + ''' + Public Function GetRankNameValue() As ColumnValue + Return Me.GetValue(TableUtils.RankNameColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's Rank_.RankName field. + ''' + Public Function GetRankNameFieldValue() As String + Return CType(Me.GetValue(TableUtils.RankNameColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Rank_.RankName field. + ''' + Public Sub SetRankNameFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.RankNameColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Rank_.RankName field. + ''' + Public Sub SetRankNameFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.RankNameColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's Rank_.ERankName field. + ''' + Public Function GetERankNameValue() As ColumnValue + Return Me.GetValue(TableUtils.ERankNameColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's Rank_.ERankName field. + ''' + Public Function GetERankNameFieldValue() As String + Return CType(Me.GetValue(TableUtils.ERankNameColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Rank_.ERankName field. + ''' + Public Sub SetERankNameFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.ERankNameColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Rank_.ERankName field. + ''' + Public Sub SetERankNameFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.ERankNameColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's Rank_.RankLevelName field. + ''' + Public Function GetRankLevelNameValue() As ColumnValue + Return Me.GetValue(TableUtils.RankLevelNameColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's Rank_.RankLevelName field. + ''' + Public Function GetRankLevelNameFieldValue() As String + Return CType(Me.GetValue(TableUtils.RankLevelNameColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Rank_.RankLevelName field. + ''' + Public Sub SetRankLevelNameFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.RankLevelNameColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Rank_.RankLevelName field. + ''' + Public Sub SetRankLevelNameFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.RankLevelNameColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's Rank_.suffix field. + ''' + Public Function GetsuffixValue() As ColumnValue + Return Me.GetValue(TableUtils.suffixColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's Rank_.suffix field. + ''' + Public Function GetsuffixFieldValue() As String + Return CType(Me.GetValue(TableUtils.suffixColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Rank_.suffix field. + ''' + Public Sub SetsuffixFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.suffixColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Rank_.suffix field. + ''' + Public Sub SetsuffixFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.suffixColumn) + End Sub + + + +#End Region + +#Region "Convenience methods to get field names" + + ''' + ''' This is a convenience property that provides direct access to the value of the record's Rank_.RankId field. + ''' + Public Property RankId() As Int32 + Get + Return CType(Me.GetValue(TableUtils.RankIdColumn).ToInt32(), Int32) + End Get + Set (ByVal val As Int32) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.RankIdColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property RankIdSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.RankIdColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property RankIdDefault() As String + Get + Return TableUtils.RankIdColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's Rank_.RankLevel field. + ''' + Public Property RankLevel() As Int32 + Get + Return CType(Me.GetValue(TableUtils.RankLevelColumn).ToInt32(), Int32) + End Get + Set (ByVal val As Int32) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.RankLevelColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property RankLevelSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.RankLevelColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property RankLevelDefault() As String + Get + Return TableUtils.RankLevelColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's Rank_.ArmyId field. + ''' + Public Property ArmyId() As Byte + Get + Return CType(Me.GetValue(TableUtils.ArmyIdColumn).ToByte(), Byte) + End Get + Set (ByVal val As Byte) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.ArmyIdColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property ArmyIdSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.ArmyIdColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property ArmyIdDefault() As String + Get + Return TableUtils.ArmyIdColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's Rank_.ShortRank field. + ''' + Public Property ShortRank() As String + Get + Return CType(Me.GetValue(TableUtils.ShortRankColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.ShortRankColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property ShortRankSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.ShortRankColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property ShortRankDefault() As String + Get + Return TableUtils.ShortRankColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's Rank_.ShortRankNormal field. + ''' + Public Property ShortRankNormal() As String + Get + Return CType(Me.GetValue(TableUtils.ShortRankNormalColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.ShortRankNormalColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property ShortRankNormalSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.ShortRankNormalColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property ShortRankNormalDefault() As String + Get + Return TableUtils.ShortRankNormalColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's Rank_.EShortRank field. + ''' + Public Property EShortRank() As String + Get + Return CType(Me.GetValue(TableUtils.EShortRankColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.EShortRankColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property EShortRankSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.EShortRankColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property EShortRankDefault() As String + Get + Return TableUtils.EShortRankColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's Rank_.RankName field. + ''' + Public Property RankName() As String + Get + Return CType(Me.GetValue(TableUtils.RankNameColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.RankNameColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property RankNameSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.RankNameColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property RankNameDefault() As String + Get + Return TableUtils.RankNameColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's Rank_.ERankName field. + ''' + Public Property ERankName() As String + Get + Return CType(Me.GetValue(TableUtils.ERankNameColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.ERankNameColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property ERankNameSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.ERankNameColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property ERankNameDefault() As String + Get + Return TableUtils.ERankNameColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's Rank_.RankLevelName field. + ''' + Public Property RankLevelName() As String + Get + Return CType(Me.GetValue(TableUtils.RankLevelNameColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.RankLevelNameColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property RankLevelNameSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.RankLevelNameColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property RankLevelNameDefault() As String + Get + Return TableUtils.RankLevelNameColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's Rank_.suffix field. + ''' + Public Property suffix() As String + Get + Return CType(Me.GetValue(TableUtils.suffixColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.suffixColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property suffixSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.suffixColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property suffixDefault() As String + Get + Return TableUtils.suffixColumn.DefaultValue + End Get + End Property + + + +#End Region + +End Class +End Namespace diff --git a/App_Code/Business Layer/BaseRankTable.vb b/App_Code/Business Layer/BaseRankTable.vb new file mode 100644 index 0000000..d8efed7 --- /dev/null +++ b/App_Code/Business Layer/BaseRankTable.vb @@ -0,0 +1,954 @@ +' This class is "generated" and will be overwritten. +' Your customizations should be made in RankRecord.vb + +Imports System.Data.SqlTypes +Imports System.Data +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider +Imports Persons.Data + +Namespace Persons.Business + +''' +''' The generated superclass for the class. +''' Provides access to the schema information and record data of a database table or view named Rank. +''' +''' +''' The connection details (name, location, etc.) of the database and table (or view) accessed by this class +''' are resolved at runtime based on the connection string in the application's Web.Config file. +''' +''' This class is not intended to be instantiated directly. To obtain an instance of this class, use +''' RankTable.Instance. +''' +''' +''' + + Public Class BaseRankTable + Inherits PrimaryKeyTable + + + Private ReadOnly TableDefinitionString As String = RankDefinition.GetXMLString() + + + + + + + + Protected Sub New() + MyBase.New() + Me.Initialize() + End Sub + + Protected Overridable Sub Initialize() + Dim def As New XmlTableDefinition(TableDefinitionString) + Me.TableDefinition = New TableDefinition() + Me.TableDefinition.TableClassName = System.Reflection.Assembly.CreateQualifiedName("App_Code", "Persons.Business.RankTable") + def.InitializeTableDefinition(Me.TableDefinition) + Me.ConnectionName = def.GetConnectionName() + Me.RecordClassName = System.Reflection.Assembly.CreateQualifiedName("App_Code", "Persons.Business.RankRecord") + Me.ApplicationName = "App_Code" + Me.DataAdapter = New RankSqlTable() + Directcast(Me.DataAdapter, RankSqlTable).ConnectionName = Me.ConnectionName + + Me.TableDefinition.AdapterMetaData = Me.DataAdapter.AdapterMetaData + RankIdColumn.CodeName = "RankId" + RankLevelColumn.CodeName = "RankLevel" + ArmyIdColumn.CodeName = "ArmyId" + ShortRankColumn.CodeName = "ShortRank" + ShortRankNormalColumn.CodeName = "ShortRankNormal" + EShortRankColumn.CodeName = "EShortRank" + RankNameColumn.CodeName = "RankName" + ERankNameColumn.CodeName = "ERankName" + RankLevelNameColumn.CodeName = "RankLevelName" + suffixColumn.CodeName = "suffix" + + End Sub + +#Region "Overriden methods" + + +#End Region + +#Region "Properties for columns" + + ''' + ''' This is a convenience property that provides direct access to the table's Rank_.RankId column object. + ''' + Public ReadOnly Property RankIdColumn() As BaseClasses.Data.NumberColumn + Get + Return CType(Me.TableDefinition.ColumnList(0), BaseClasses.Data.NumberColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's Rank_.RankId column object. + ''' + Public Shared ReadOnly Property RankId() As BaseClasses.Data.NumberColumn + Get + Return RankTable.Instance.RankIdColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's Rank_.RankLevel column object. + ''' + Public ReadOnly Property RankLevelColumn() As BaseClasses.Data.NumberColumn + Get + Return CType(Me.TableDefinition.ColumnList(1), BaseClasses.Data.NumberColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's Rank_.RankLevel column object. + ''' + Public Shared ReadOnly Property RankLevel() As BaseClasses.Data.NumberColumn + Get + Return RankTable.Instance.RankLevelColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's Rank_.ArmyId column object. + ''' + Public ReadOnly Property ArmyIdColumn() As BaseClasses.Data.NumberColumn + Get + Return CType(Me.TableDefinition.ColumnList(2), BaseClasses.Data.NumberColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's Rank_.ArmyId column object. + ''' + Public Shared ReadOnly Property ArmyId() As BaseClasses.Data.NumberColumn + Get + Return RankTable.Instance.ArmyIdColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's Rank_.ShortRank column object. + ''' + Public ReadOnly Property ShortRankColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(3), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's Rank_.ShortRank column object. + ''' + Public Shared ReadOnly Property ShortRank() As BaseClasses.Data.StringColumn + Get + Return RankTable.Instance.ShortRankColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's Rank_.ShortRankNormal column object. + ''' + Public ReadOnly Property ShortRankNormalColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(4), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's Rank_.ShortRankNormal column object. + ''' + Public Shared ReadOnly Property ShortRankNormal() As BaseClasses.Data.StringColumn + Get + Return RankTable.Instance.ShortRankNormalColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's Rank_.EShortRank column object. + ''' + Public ReadOnly Property EShortRankColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(5), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's Rank_.EShortRank column object. + ''' + Public Shared ReadOnly Property EShortRank() As BaseClasses.Data.StringColumn + Get + Return RankTable.Instance.EShortRankColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's Rank_.RankName column object. + ''' + Public ReadOnly Property RankNameColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(6), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's Rank_.RankName column object. + ''' + Public Shared ReadOnly Property RankName() As BaseClasses.Data.StringColumn + Get + Return RankTable.Instance.RankNameColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's Rank_.ERankName column object. + ''' + Public ReadOnly Property ERankNameColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(7), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's Rank_.ERankName column object. + ''' + Public Shared ReadOnly Property ERankName() As BaseClasses.Data.StringColumn + Get + Return RankTable.Instance.ERankNameColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's Rank_.RankLevelName column object. + ''' + Public ReadOnly Property RankLevelNameColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(8), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's Rank_.RankLevelName column object. + ''' + Public Shared ReadOnly Property RankLevelName() As BaseClasses.Data.StringColumn + Get + Return RankTable.Instance.RankLevelNameColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's Rank_.suffix column object. + ''' + Public ReadOnly Property suffixColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(9), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's Rank_.suffix column object. + ''' + Public Shared ReadOnly Property suffix() As BaseClasses.Data.StringColumn + Get + Return RankTable.Instance.suffixColumn + End Get + End Property + + +#End Region + + +#Region "Shared helper methods" + + ''' + ''' This is a shared function that can be used to get an array of RankRecord records using a where clause. + ''' + Public Shared Function GetRecords(ByVal where As String) As RankRecord() + + Return GetRecords(where, Nothing, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) + End Function + + ''' + ''' This is a shared function that can be used to get an array of RankRecord records using a where clause. + ''' + Public Shared Function GetRecords(ByVal join As BaseFilter, ByVal where As String) As RankRecord() + + Return GetRecords(join, where, Nothing, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) + End Function + + ''' + ''' This is a shared function that can be used to get an array of RankRecord records using a where and order by clause. + ''' + Public Shared Function GetRecords( _ + ByVal where As String, _ + ByVal orderBy As OrderBy) As RankRecord() + + Return GetRecords(where, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) + End Function + + ''' + ''' This is a shared function that can be used to get an array of RankRecord records using a where and order by clause. + ''' + Public Shared Function GetRecords( _ + ByVal join As BaseFilter, _ + ByVal where As String, _ + ByVal orderBy As OrderBy) As RankRecord() + + Return GetRecords(join, where, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) + End Function + + ''' + ''' This is a shared function that can be used to get an array of RankRecord records using a where and order by clause clause with pagination. + ''' + Public Shared Function GetRecords( _ + ByVal where As String, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As RankRecord() + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + Dim join As BaseClasses.Data.BaseFilter = Nothing + Dim recList As ArrayList = RankTable.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, pageIndex, pageSize) + + Return CType(recList.ToArray(GetType(Persons.Business.RankRecord)), RankRecord()) + End Function + + ''' + ''' This is a shared function that can be used to get an array of RankRecord records using a where and order by clause clause with pagination. + ''' + Public Shared Function GetRecords( _ + ByVal join As BaseFilter, _ + ByVal where As String, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As RankRecord() + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Dim recList As ArrayList = RankTable.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, pageIndex, pageSize) + + Return CType(recList.ToArray(GetType(Persons.Business.RankRecord)), RankRecord()) + End Function + + Public Shared Function GetRecords( _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As RankRecord() + Dim join As BaseClasses.Data.BaseFilter = Nothing + Dim recList As ArrayList = RankTable.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + Return CType(recList.ToArray(GetType(Persons.Business.RankRecord)), RankRecord()) + End Function + + Public Shared Function GetRecords( _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As RankRecord() + + Dim recList As ArrayList = RankTable.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + Return CType(recList.ToArray(GetType(Persons.Business.RankRecord)), RankRecord()) + End Function + + Public Shared Function GetRecords( _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer, _ + ByRef totalRecords As Integer) As RankRecord() + Dim join As BaseClasses.Data.BaseFilter = Nothing + Dim recList As ArrayList = RankTable.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize, totalRecords) + + Return CType(recList.ToArray(GetType(Persons.Business.RankRecord)), RankRecord()) + End Function + + Public Shared Function GetRecords( _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer, _ + ByRef totalRecords As Integer) As RankRecord() + + Dim recList As ArrayList = RankTable.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize, totalRecords) + + Return CType(recList.ToArray(GetType(Persons.Business.RankRecord)), RankRecord()) + End Function + + ''' + ''' This is a shared function that can be used to get total number of records that will be returned using the where clause. + ''' + Public Shared Function GetRecordCount(ByVal where As String) As Integer + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Return CInt(RankTable.Instance.GetRecordListCount(Nothing, whereFilter, Nothing, Nothing)) + End Function + +''' + ''' This is a shared function that can be used to get total number of records that will be returned using the where clause. + ''' + Public Shared Function GetRecordCount(ByVal join As BaseFilter, ByVal where As String) As Integer + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Return CInt(RankTable.Instance.GetRecordListCount(join, whereFilter, Nothing, Nothing)) + End Function + + Public Shared Function GetRecordCount(ByVal where As WhereClause) As Integer + Return CInt(RankTable.Instance.GetRecordListCount(Nothing, where.GetFilter(), Nothing, Nothing)) + End Function + + Public Shared Function GetRecordCount(ByVal join As BaseFilter, ByVal where As WhereClause) As Integer + Return CInt(RankTable.Instance.GetRecordListCount(join, where.GetFilter(), Nothing, Nothing)) + End Function + + ''' + ''' This is a shared function that can be used to get a RankRecord record using a where clause. + ''' + Public Shared Function GetRecord(ByVal where As String) As RankRecord + Dim orderBy As OrderBy = Nothing + Return GetRecord(where, orderBy) + End Function + + ''' + ''' This is a shared function that can be used to get a RankRecord record using a where clause. + ''' + Public Shared Function GetRecord(ByVal join As BaseFilter, ByVal where As String) As RankRecord + Dim orderBy As OrderBy = Nothing + Return GetRecord(join, where, orderBy) + End Function + + ''' + ''' This is a shared function that can be used to get a RankRecord record using a where and order by clause. + ''' + Public Shared Function GetRecord( _ + ByVal where As String, _ + ByVal orderBy As OrderBy) As RankRecord + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + Dim join As BaseClasses.Data.BaseFilter = Nothing + Dim recList As ArrayList = RankTable.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MIN_BATCH_SIZE) + + Dim rec As RankRecord = Nothing + If recList.Count > 0 Then + rec = CType(recList(0), RankRecord) + End If + + Return rec + End Function + + ''' + ''' This is a shared function that can be used to get a RankRecord record using a where and order by clause. + ''' + Public Shared Function GetRecord( _ + ByVal join As BaseFilter, _ + ByVal where As String, _ + ByVal orderBy As OrderBy) As RankRecord + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Dim recList As ArrayList = RankTable.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MIN_BATCH_SIZE) + + Dim rec As RankRecord = Nothing + If recList.Count > 0 Then + rec = CType(recList(0), RankRecord) + End If + + Return rec + End Function + + + Public Shared Function GetValues( _ + ByVal col As BaseColumn, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal maxItems As Integer) As String() + + ' Create the filter list. + Dim retCol As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, True) + retCol.AddColumn(col) + + Return RankTable.Instance.GetColumnValues(retCol, Nothing, where.GetFilter(), Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, maxItems) + + End Function + + Public Shared Function GetValues( _ + ByVal col As BaseColumn, _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal maxItems As Integer) As String() + + ' Create the filter list. + Dim retCol As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, True) + retCol.AddColumn(col) + + Return RankTable.Instance.GetColumnValues(retCol, join, where.GetFilter(), Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, maxItems) + + End Function + + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where clause. + ''' + Public Shared Function GetDataTable(ByVal where As String) As System.Data.DataTable + + Dim recs() As RankRecord = GetRecords(where) + Return RankTable.Instance.CreateDataTable(recs, Nothing) + End Function + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where clause. + ''' + Public Shared Function GetDataTable(ByVal join As BaseFilter, ByVal where As String) As System.Data.DataTable + + Dim recs() As RankRecord = GetRecords(join, where) + Return RankTable.Instance.CreateDataTable(recs, Nothing) + End Function + + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause. + ''' + Public Shared Function GetDataTable(ByVal where As String, ByVal orderBy As OrderBy) As System.Data.DataTable + + Dim recs() As RankRecord = GetRecords(where, orderBy) + Return RankTable.Instance.CreateDataTable(recs, Nothing) + End Function + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause. + ''' + Public Shared Function GetDataTable(ByVal join As BaseFilter, ByVal where As String, ByVal orderBy As OrderBy) As System.Data.DataTable + + Dim recs() As RankRecord = GetRecords(join, where, orderBy) + Return RankTable.Instance.CreateDataTable(recs, Nothing) + End Function + + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause with pagination. + ''' + Public Shared Function GetDataTable( _ + ByVal where As String, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As System.Data.DataTable + + Dim recs() As RankRecord = GetRecords(where, orderBy, pageIndex, pageSize) + Return RankTable.Instance.CreateDataTable(recs, Nothing) + End Function + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause with pagination. + ''' + Public Shared Function GetDataTable( _ + ByVal join As BaseFilter, _ + ByVal where As String, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As System.Data.DataTable + + Dim recs() As RankRecord = GetRecords(join, where, orderBy, pageIndex, pageSize) + Return RankTable.Instance.CreateDataTable(recs, Nothing) + End Function + + + ''' + ''' This is a shared function that can be used to delete records using a where clause. + ''' + Public Shared Sub DeleteRecords(ByVal where As String) + If where = Nothing OrElse where.Trim() = "" Then + Return + End If + + Dim whereFilter As SqlFilter = New SqlFilter(where) + RankTable.Instance.DeleteRecordList(whereFilter) + End Sub + + ''' + ''' This is a shared function that can be used to export records using a where clause. + ''' + Public Shared Function Export(ByVal where As String) As String + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Return RankTable.Instance.ExportRecordData(whereFilter) + End Function + + Public Shared Function Export(ByVal where As WhereClause) As String + Dim whereFilter As BaseFilter = Nothing + If Not where Is Nothing Then + whereFilter = where.GetFilter() + End If + + Return RankTable.Instance.ExportRecordData(whereFilter) + End Function + + Public Shared Function GetSum( _ + ByVal col As BaseColumn, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) _ + As String + + Dim colSel As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, False) + colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Sum) + + Return RankTable.Instance.GetColumnStatistics(colSel, Nothing, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + End Function + + Public Shared Function GetSum( _ + ByVal col As BaseColumn, _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) _ + As String + + Dim colSel As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, False) + colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Sum) + + Return RankTable.Instance.GetColumnStatistics(colSel, join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + End Function + + + Public Shared Function GetCount( _ + ByVal col As BaseColumn, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) _ + As String + + Dim colSel As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, False) + colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Count) + + Return RankTable.Instance.GetColumnStatistics(colSel, Nothing, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + End Function + + Public Shared Function GetCount( _ + ByVal col As BaseColumn, _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) _ + As String + + Dim colSel As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, False) + colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Count) + + Return RankTable.Instance.GetColumnStatistics(colSel, join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + End Function + + ''' + ''' This method returns the columns in the table. + ''' + Public Shared Function GetColumns() As BaseColumn() + Return RankTable.Instance.TableDefinition.Columns + End Function + + ''' + ''' This method returns the columnlist in the table. + ''' + Public Shared Function GetColumnList() As ColumnList + Return RankTable.Instance.TableDefinition.ColumnList + End Function + + + ''' + ''' This method creates a new record and returns it to be edited. + ''' + Public Shared Function CreateNewRecord() As IRecord + Return RankTable.Instance.CreateRecord() + End Function + + ''' + ''' This method creates a new record and returns it to be edited. + ''' + ''' ID of the new record. + Public Shared Function CreateNewRecord(ByVal tempId As String) As IRecord + Return RankTable.Instance.CreateRecord(tempId) + End Function + + ''' + ''' This method checks if column is editable. + ''' + ''' Name of the column to check. + Public Shared Function isReadOnlyColumn(ByVal columnName As String) As Boolean + Dim column As BaseColumn = GetColumn(columnName) + If (Not IsNothing(column)) Then + Return column.IsValuesReadOnly + Else + Return True + End If + End Function + + ''' + ''' This method gets the specified column. + ''' + ''' Unique name of the column to fetch. + Public Shared Function GetColumn(ByVal uniqueColumnName As String) As BaseColumn + Dim column As BaseColumn = RankTable.Instance.TableDefinition.ColumnList.GetByUniqueName(uniqueColumnName) + Return column + End Function + + ' Convenience method for getting a record using a string-based record identifier + Public Shared Function GetRecord(ByVal id As String, ByVal bMutable As Boolean) As RankRecord + Return CType(RankTable.Instance.GetRecordData(id, bMutable), RankRecord) + End Function + + ' Convenience method for getting a record using a KeyValue record identifier + Public Shared Function GetRecord(ByVal id As KeyValue, ByVal bMutable As Boolean) As RankRecord + Return CType(RankTable.Instance.GetRecordData(id, bMutable), RankRecord) + End Function + + ' Convenience method for creating a record + Public Overloads Function NewRecord( _ + ByVal RankIdValue As String, _ + ByVal RankLevelValue As String, _ + ByVal ArmyIdValue As String, _ + ByVal ShortRankValue As String, _ + ByVal ShortRankNormalValue As String, _ + ByVal EShortRankValue As String, _ + ByVal RankNameValue As String, _ + ByVal ERankNameValue As String, _ + ByVal RankLevelNameValue As String, _ + ByVal suffixValue As String _ + ) As KeyValue + Dim rec As IPrimaryKeyRecord = CType(Me.CreateRecord(), IPrimaryKeyRecord) + rec.SetString(RankIdValue, RankIdColumn) + rec.SetString(RankLevelValue, RankLevelColumn) + rec.SetString(ArmyIdValue, ArmyIdColumn) + rec.SetString(ShortRankValue, ShortRankColumn) + rec.SetString(ShortRankNormalValue, ShortRankNormalColumn) + rec.SetString(EShortRankValue, EShortRankColumn) + rec.SetString(RankNameValue, RankNameColumn) + rec.SetString(ERankNameValue, ERankNameColumn) + rec.SetString(RankLevelNameValue, RankLevelNameColumn) + rec.SetString(suffixValue, suffixColumn) + + + rec.Create() 'update the DB so any DB-initialized fields (like autoincrement IDs) can be initialized + + Dim key As KeyValue = rec.GetID() + Return key + End Function + + ''' + ''' This method deletes a specified record + ''' + ''' Keyvalue of the record to be deleted. + Public Shared Sub DeleteRecord(ByVal kv As KeyValue) + RankTable.Instance.DeleteOneRecord(kv) + End Sub + + ''' + ''' This method checks if record exist in the database using the keyvalue provided. + ''' + ''' Key value of the record. + Public Shared Function DoesRecordExist(ByVal kv As KeyValue) As Boolean + Dim recordExist As Boolean = True + Try + RankTable.GetRecord(kv, False) + Catch ex As Exception + recordExist = False + End Try + Return recordExist + End Function + + ''' + ''' This method returns all the primary columns in the table. + ''' + Public Shared Function GetPrimaryKeyColumns() As ColumnList + If (Not IsNothing(RankTable.Instance.TableDefinition.PrimaryKey)) Then + Return RankTable.Instance.TableDefinition.PrimaryKey.Columns + Else + Return Nothing + End If + End Function + + ''' + ''' This method takes a key and returns a keyvalue. + ''' + ''' key could be array of primary key values in case of composite primary key or a string containing single primary key value in case of non-composite primary key. + Public Shared Function GetKeyValue(ByVal key As Object) As KeyValue + Dim kv As KeyValue = Nothing + + If (Not (IsNothing(RankTable.Instance.TableDefinition.PrimaryKey))) Then + + Dim isCompositePrimaryKey As Boolean = False + isCompositePrimaryKey = RankTable.Instance.TableDefinition.PrimaryKey.IsCompositeKey + + If ((isCompositePrimaryKey) AndAlso (key.GetType.IsArray())) Then + + ' If the key is composite, then construct a key value. + kv = New KeyValue + Dim fullKeyString As String = "" + Dim keyArray As Array = CType(key, Array) + If (Not IsNothing(keyArray)) Then + Dim length As Integer = keyArray.Length + Dim pkColumns As ColumnList = RankTable.Instance.TableDefinition.PrimaryKey.Columns + Dim pkColumn As BaseColumn + Dim index As Integer = 0 + For Each pkColumn In pkColumns + Dim keyString As String = CType(keyArray.GetValue(index), String) + If (RankTable.Instance.TableDefinition.TableType = BaseClasses.Data.TableDefinition.TableTypes.Virtual) Then + kv.AddElement(pkColumn.UniqueName, keyString) + Else + kv.AddElement(pkColumn.InternalName, keyString) + End If + index = index + 1 + Next pkColumn + End If + + Else + ' If the key is not composite, then get the key value. + kv = RankTable.Instance.TableDefinition.PrimaryKey.ParseValue(CType(key, String)) + End If + End If + Return kv + End Function + + + ''' + ''' This method takes a record and a Column and returns an evaluated value of DFKA formula. + ''' + Public Shared Function GetDFKA(ByVal rec As BaseRecord, ByVal col As BaseColumn) As String + Dim fkColumn As ForeignKey = RankTable.Instance.TableDefinition.GetExpandableNonCompositeForeignKey(col) + If fkColumn Is Nothing Then + Return Nothing + End If + Dim _DFKA As String = fkColumn.PrimaryKeyDisplayColumns + If (_DFKA.Trim().StartsWith("=")) Then + ' if the formula is in the format of "= ., then pull out the data from the rec object instead of doing formula evaluation + Dim tableCodeName As String = fkColumn.PrimaryKeyTableDefinition.TableCodeName + Dim column As String = _DFKA.Trim("="c).Trim() + If column.StartsWith(tableCodeName & ".", StringComparison.InvariantCultureIgnoreCase) Then + column = column.Substring(tableCodeName.Length + 1) + End If + + For Each c As BaseColumn In fkColumn.PrimaryKeyTableDefinition.Columns + If column = c.CodeName Then + Return rec.Format(c) + End If + Next + Dim tableName As String = fkColumn.PrimaryKeyTableDefinition.TableCodeName + Return EvaluateFormula(_DFKA, rec, Nothing, tableName) + Else + Return Nothing + End If + End Function + + ''' + ''' This method takes a keyValue and a Column and returns an evaluated value of DFKA formula. + ''' + Public Shared Function GetDFKA(ByVal keyValue As String, ByVal col As BaseColumn, ByVal formatPattern as String) As String + If keyValue Is Nothing Then + Return Nothing + End If + Dim fkColumn As ForeignKey = RankTable.Instance.TableDefinition.GetExpandableNonCompositeForeignKey(col) + If fkColumn Is Nothing Then + Return Nothing + End If + Dim _DFKA As String = fkColumn.PrimaryKeyDisplayColumns + If (_DFKA.Trim().StartsWith("=")) Then + Dim tableName As String = fkColumn.PrimaryKeyTableDefinition.TableCodeName + Dim t As PrimaryKeyTable = CType(DatabaseObjects.GetTableObject(tableName), PrimaryKeyTable) + Dim rec As BaseRecord = Nothing + If Not t Is Nothing Then + Try + rec = CType(t.GetRecordData(keyValue, False), BaseRecord) + Catch + rec = Nothing + End Try + End If + If rec Is Nothing Then + Return "" + End If + + ' if the formula is in the format of "= ., then pull out the data from the rec object instead of doing formula evaluation + Dim tableCodeName As String = fkColumn.PrimaryKeyTableDefinition.TableCodeName + Dim column As String = _DFKA.Trim("="c).Trim() + If column.StartsWith(tableCodeName & ".", StringComparison.InvariantCultureIgnoreCase) Then + column = column.Substring(tableCodeName.Length + 1) + End If + + For Each c As BaseColumn In fkColumn.PrimaryKeyTableDefinition.Columns + If column = c.CodeName Then + Return rec.Format(c) + End If + Next + Return EvaluateFormula(_DFKA, rec, Nothing, tableName) + Else + Return Nothing + End If + End Function + + ''' + ''' Evaluates the formula + ''' + Public Shared Function EvaluateFormula(ByVal formula As String, Optional ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord = Nothing, Optional ByVal format As String = Nothing, Optional ByVal name As String = "") As String + Dim e As BaseFormulaEvaluator = New BaseFormulaEvaluator() + If Not dataSourceForEvaluate Is Nothing Then + e.Evaluator.Variables.Add(name, dataSourceForEvaluate) + end if + e.DataSource = dataSourceForEvaluate + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + If Not String.IsNullOrEmpty(format) Then + Return BaseFormulaUtils.Format(resultObj, format) + Else + Return resultObj.ToString() + End If + End Function + + +#End Region + +End Class +End Namespace diff --git a/App_Code/Business Layer/BaseRelationRecord.vb b/App_Code/Business Layer/BaseRelationRecord.vb new file mode 100644 index 0000000..86946e3 --- /dev/null +++ b/App_Code/Business Layer/BaseRelationRecord.vb @@ -0,0 +1,283 @@ +' This class is "generated" and will be overwritten. +' Your customizations should be made in RelationRecord.vb + +Imports System.Data.SqlTypes +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + +Namespace Persons.Business + +''' +''' The generated superclass for the class. +''' +''' +''' This class is not intended to be instantiated directly. To obtain an instance of this class, +''' use the methods of the class. +''' +''' +''' + + Public Class BaseRelationRecord + Inherits PrimaryKeyRecord + + + Public Shared Shadows ReadOnly TableUtils As RelationTable = RelationTable.Instance + + ' Constructors + + Protected Sub New() + MyBase.New(TableUtils) + End Sub + + Protected Sub New(ByVal record As PrimaryKeyRecord) + MyBase.New(record, TableUtils) + End Sub + + 'Evaluates Initialize when->Inserting record formulas specified at the data access layer + Public Overridable Sub RelationRecord_InsertingRecord(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles Me.InsertingRecord + 'Apply Initialize->Inserting record formula only if validation is successful. + Dim RelationRec As RelationRecord = CType(sender,RelationRecord) + Validate_Inserting() + If Not RelationRec Is Nothing AndAlso Not RelationRec.IsReadOnly Then + End If + End Sub + + 'Evaluates Initialize when->Updating record formulas specified at the data access layer + Public Overridable Sub RelationRecord_UpdatingRecord(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles Me.UpdatingRecord + 'Apply Initialize->Updating record formula only if validation is successful. + Dim RelationRec As RelationRecord = CType(sender,RelationRecord) + Validate_Updating() + If Not RelationRec Is Nothing AndAlso Not RelationRec.IsReadOnly Then + End If + End Sub + + 'Evaluates Initialize when->Reading record formulas specified at the data access layer + Public Overridable Sub RelationRecord_ReadRecord(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.ReadRecord + 'Apply Initialize->Reading record formula only if validation is successful. + Dim RelationRec As RelationRecord = CType(sender,RelationRecord) + If Not RelationRec Is Nothing AndAlso Not RelationRec.IsReadOnly Then + End If + End Sub + + 'Evaluates Validate when->Inserting formulas specified at the data access layer + Public Overridable Sub Validate_Inserting () + Dim fullValidationMessage As String = "" + Dim validationMessage As String = "" + + dim formula as String = "" + + + If validationMessage <> "" AndAlso validationMessage.ToLower() <> "true" Then + fullValidationMessage &= validationMessage & vbCrLf + End If + + If fullValidationMessage <> "" Then + Throw New Exception(fullValidationMessage) + End If + End Sub + + 'Evaluates Validate when->Updating formulas specified at the data access layer + Public Overridable Sub Validate_Updating () + Dim fullValidationMessage As String = "" + Dim validationMessage As String = "" + + dim formula as String = "" + + + If validationMessage <> "" AndAlso validationMessage.ToLower() <> "true" Then + fullValidationMessage &= validationMessage & vbCrLf + End If + + If fullValidationMessage <> "" Then + Throw New Exception(fullValidationMessage) + End If + End Sub + + Public Overridable Function EvaluateFormula(ByVal formula As String, Optional ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord = Nothing, Optional ByVal format As String = Nothing) As String + + Dim e As Data.BaseFormulaEvaluator = New Data.BaseFormulaEvaluator() + + ' All variables referred to in the formula are expected to be + ' properties of the DataSource. For example, referring to + ' UnitPrice as a variable will refer to DataSource.UnitPrice + e.DataSource = dataSourceForEvaluate + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + Return resultObj.ToString() + End Function + + + + + + + +#Region "Convenience methods to get/set values of fields" + + ''' + ''' This is a convenience method that provides direct access to the value of the record's Relation_.RelationId field. + ''' + Public Function GetRelationIdValue() As ColumnValue + Return Me.GetValue(TableUtils.RelationIdColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's Relation_.RelationId field. + ''' + Public Function GetRelationIdFieldValue() As Int32 + Return CType(Me.GetValue(TableUtils.RelationIdColumn).ToInt32(), Int32) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Relation_.RelationId field. + ''' + Public Sub SetRelationIdFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.RelationIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Relation_.RelationId field. + ''' + Public Sub SetRelationIdFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.RelationIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Relation_.RelationId field. + ''' + Public Sub SetRelationIdFieldValue(ByVal val As Double) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.RelationIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Relation_.RelationId field. + ''' + Public Sub SetRelationIdFieldValue(ByVal val As Decimal) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.RelationIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Relation_.RelationId field. + ''' + Public Sub SetRelationIdFieldValue(ByVal val As Int64) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.RelationIdColumn) + End Sub + ''' + ''' This is a convenience method that provides direct access to the value of the record's Relation_.Relation field. + ''' + Public Function GetRelationValue() As ColumnValue + Return Me.GetValue(TableUtils.RelationColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's Relation_.Relation field. + ''' + Public Function GetRelationFieldValue() As String + Return CType(Me.GetValue(TableUtils.RelationColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Relation_.Relation field. + ''' + Public Sub SetRelationFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.RelationColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Relation_.Relation field. + ''' + Public Sub SetRelationFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.RelationColumn) + End Sub + + + +#End Region + +#Region "Convenience methods to get field names" + + ''' + ''' This is a convenience property that provides direct access to the value of the record's Relation_.RelationId field. + ''' + Public Property RelationId() As Int32 + Get + Return CType(Me.GetValue(TableUtils.RelationIdColumn).ToInt32(), Int32) + End Get + Set (ByVal val As Int32) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.RelationIdColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property RelationIdSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.RelationIdColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property RelationIdDefault() As String + Get + Return TableUtils.RelationIdColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's Relation_.Relation field. + ''' + Public Property Relation() As String + Get + Return CType(Me.GetValue(TableUtils.RelationColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.RelationColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property RelationSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.RelationColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property RelationDefault() As String + Get + Return TableUtils.RelationColumn.DefaultValue + End Get + End Property + + + +#End Region + +End Class +End Namespace diff --git a/App_Code/Business Layer/BaseRelationTable.vb b/App_Code/Business Layer/BaseRelationTable.vb new file mode 100644 index 0000000..f39bf4a --- /dev/null +++ b/App_Code/Business Layer/BaseRelationTable.vb @@ -0,0 +1,778 @@ +' This class is "generated" and will be overwritten. +' Your customizations should be made in RelationRecord.vb + +Imports System.Data.SqlTypes +Imports System.Data +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider +Imports Persons.Data + +Namespace Persons.Business + +''' +''' The generated superclass for the class. +''' Provides access to the schema information and record data of a database table or view named relation. +''' +''' +''' The connection details (name, location, etc.) of the database and table (or view) accessed by this class +''' are resolved at runtime based on the connection string in the application's Web.Config file. +''' +''' This class is not intended to be instantiated directly. To obtain an instance of this class, use +''' RelationTable.Instance. +''' +''' +''' + + Public Class BaseRelationTable + Inherits PrimaryKeyTable + + + Private ReadOnly TableDefinitionString As String = RelationDefinition.GetXMLString() + + + + + + + + Protected Sub New() + MyBase.New() + Me.Initialize() + End Sub + + Protected Overridable Sub Initialize() + Dim def As New XmlTableDefinition(TableDefinitionString) + Me.TableDefinition = New TableDefinition() + Me.TableDefinition.TableClassName = System.Reflection.Assembly.CreateQualifiedName("App_Code", "Persons.Business.RelationTable") + def.InitializeTableDefinition(Me.TableDefinition) + Me.ConnectionName = def.GetConnectionName() + Me.RecordClassName = System.Reflection.Assembly.CreateQualifiedName("App_Code", "Persons.Business.RelationRecord") + Me.ApplicationName = "App_Code" + Me.DataAdapter = New RelationSqlTable() + Directcast(Me.DataAdapter, RelationSqlTable).ConnectionName = Me.ConnectionName + + Me.TableDefinition.AdapterMetaData = Me.DataAdapter.AdapterMetaData + RelationIdColumn.CodeName = "RelationId" + RelationColumn.CodeName = "Relation" + + End Sub + +#Region "Overriden methods" + + +#End Region + +#Region "Properties for columns" + + ''' + ''' This is a convenience property that provides direct access to the table's Relation_.RelationId column object. + ''' + Public ReadOnly Property RelationIdColumn() As BaseClasses.Data.NumberColumn + Get + Return CType(Me.TableDefinition.ColumnList(0), BaseClasses.Data.NumberColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's Relation_.RelationId column object. + ''' + Public Shared ReadOnly Property RelationId() As BaseClasses.Data.NumberColumn + Get + Return RelationTable.Instance.RelationIdColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's Relation_.Relation column object. + ''' + Public ReadOnly Property RelationColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(1), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's Relation_.Relation column object. + ''' + Public Shared ReadOnly Property Relation() As BaseClasses.Data.StringColumn + Get + Return RelationTable.Instance.RelationColumn + End Get + End Property + + +#End Region + + +#Region "Shared helper methods" + + ''' + ''' This is a shared function that can be used to get an array of RelationRecord records using a where clause. + ''' + Public Shared Function GetRecords(ByVal where As String) As RelationRecord() + + Return GetRecords(where, Nothing, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) + End Function + + ''' + ''' This is a shared function that can be used to get an array of RelationRecord records using a where clause. + ''' + Public Shared Function GetRecords(ByVal join As BaseFilter, ByVal where As String) As RelationRecord() + + Return GetRecords(join, where, Nothing, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) + End Function + + ''' + ''' This is a shared function that can be used to get an array of RelationRecord records using a where and order by clause. + ''' + Public Shared Function GetRecords( _ + ByVal where As String, _ + ByVal orderBy As OrderBy) As RelationRecord() + + Return GetRecords(where, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) + End Function + + ''' + ''' This is a shared function that can be used to get an array of RelationRecord records using a where and order by clause. + ''' + Public Shared Function GetRecords( _ + ByVal join As BaseFilter, _ + ByVal where As String, _ + ByVal orderBy As OrderBy) As RelationRecord() + + Return GetRecords(join, where, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) + End Function + + ''' + ''' This is a shared function that can be used to get an array of RelationRecord records using a where and order by clause clause with pagination. + ''' + Public Shared Function GetRecords( _ + ByVal where As String, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As RelationRecord() + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + Dim join As BaseClasses.Data.BaseFilter = Nothing + Dim recList As ArrayList = RelationTable.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, pageIndex, pageSize) + + Return CType(recList.ToArray(GetType(Persons.Business.RelationRecord)), RelationRecord()) + End Function + + ''' + ''' This is a shared function that can be used to get an array of RelationRecord records using a where and order by clause clause with pagination. + ''' + Public Shared Function GetRecords( _ + ByVal join As BaseFilter, _ + ByVal where As String, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As RelationRecord() + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Dim recList As ArrayList = RelationTable.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, pageIndex, pageSize) + + Return CType(recList.ToArray(GetType(Persons.Business.RelationRecord)), RelationRecord()) + End Function + + Public Shared Function GetRecords( _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As RelationRecord() + Dim join As BaseClasses.Data.BaseFilter = Nothing + Dim recList As ArrayList = RelationTable.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + Return CType(recList.ToArray(GetType(Persons.Business.RelationRecord)), RelationRecord()) + End Function + + Public Shared Function GetRecords( _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As RelationRecord() + + Dim recList As ArrayList = RelationTable.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + Return CType(recList.ToArray(GetType(Persons.Business.RelationRecord)), RelationRecord()) + End Function + + Public Shared Function GetRecords( _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer, _ + ByRef totalRecords As Integer) As RelationRecord() + Dim join As BaseClasses.Data.BaseFilter = Nothing + Dim recList As ArrayList = RelationTable.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize, totalRecords) + + Return CType(recList.ToArray(GetType(Persons.Business.RelationRecord)), RelationRecord()) + End Function + + Public Shared Function GetRecords( _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer, _ + ByRef totalRecords As Integer) As RelationRecord() + + Dim recList As ArrayList = RelationTable.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize, totalRecords) + + Return CType(recList.ToArray(GetType(Persons.Business.RelationRecord)), RelationRecord()) + End Function + + ''' + ''' This is a shared function that can be used to get total number of records that will be returned using the where clause. + ''' + Public Shared Function GetRecordCount(ByVal where As String) As Integer + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Return CInt(RelationTable.Instance.GetRecordListCount(Nothing, whereFilter, Nothing, Nothing)) + End Function + +''' + ''' This is a shared function that can be used to get total number of records that will be returned using the where clause. + ''' + Public Shared Function GetRecordCount(ByVal join As BaseFilter, ByVal where As String) As Integer + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Return CInt(RelationTable.Instance.GetRecordListCount(join, whereFilter, Nothing, Nothing)) + End Function + + Public Shared Function GetRecordCount(ByVal where As WhereClause) As Integer + Return CInt(RelationTable.Instance.GetRecordListCount(Nothing, where.GetFilter(), Nothing, Nothing)) + End Function + + Public Shared Function GetRecordCount(ByVal join As BaseFilter, ByVal where As WhereClause) As Integer + Return CInt(RelationTable.Instance.GetRecordListCount(join, where.GetFilter(), Nothing, Nothing)) + End Function + + ''' + ''' This is a shared function that can be used to get a RelationRecord record using a where clause. + ''' + Public Shared Function GetRecord(ByVal where As String) As RelationRecord + Dim orderBy As OrderBy = Nothing + Return GetRecord(where, orderBy) + End Function + + ''' + ''' This is a shared function that can be used to get a RelationRecord record using a where clause. + ''' + Public Shared Function GetRecord(ByVal join As BaseFilter, ByVal where As String) As RelationRecord + Dim orderBy As OrderBy = Nothing + Return GetRecord(join, where, orderBy) + End Function + + ''' + ''' This is a shared function that can be used to get a RelationRecord record using a where and order by clause. + ''' + Public Shared Function GetRecord( _ + ByVal where As String, _ + ByVal orderBy As OrderBy) As RelationRecord + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + Dim join As BaseClasses.Data.BaseFilter = Nothing + Dim recList As ArrayList = RelationTable.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MIN_BATCH_SIZE) + + Dim rec As RelationRecord = Nothing + If recList.Count > 0 Then + rec = CType(recList(0), RelationRecord) + End If + + Return rec + End Function + + ''' + ''' This is a shared function that can be used to get a RelationRecord record using a where and order by clause. + ''' + Public Shared Function GetRecord( _ + ByVal join As BaseFilter, _ + ByVal where As String, _ + ByVal orderBy As OrderBy) As RelationRecord + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Dim recList As ArrayList = RelationTable.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MIN_BATCH_SIZE) + + Dim rec As RelationRecord = Nothing + If recList.Count > 0 Then + rec = CType(recList(0), RelationRecord) + End If + + Return rec + End Function + + + Public Shared Function GetValues( _ + ByVal col As BaseColumn, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal maxItems As Integer) As String() + + ' Create the filter list. + Dim retCol As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, True) + retCol.AddColumn(col) + + Return RelationTable.Instance.GetColumnValues(retCol, Nothing, where.GetFilter(), Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, maxItems) + + End Function + + Public Shared Function GetValues( _ + ByVal col As BaseColumn, _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal maxItems As Integer) As String() + + ' Create the filter list. + Dim retCol As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, True) + retCol.AddColumn(col) + + Return RelationTable.Instance.GetColumnValues(retCol, join, where.GetFilter(), Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, maxItems) + + End Function + + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where clause. + ''' + Public Shared Function GetDataTable(ByVal where As String) As System.Data.DataTable + + Dim recs() As RelationRecord = GetRecords(where) + Return RelationTable.Instance.CreateDataTable(recs, Nothing) + End Function + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where clause. + ''' + Public Shared Function GetDataTable(ByVal join As BaseFilter, ByVal where As String) As System.Data.DataTable + + Dim recs() As RelationRecord = GetRecords(join, where) + Return RelationTable.Instance.CreateDataTable(recs, Nothing) + End Function + + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause. + ''' + Public Shared Function GetDataTable(ByVal where As String, ByVal orderBy As OrderBy) As System.Data.DataTable + + Dim recs() As RelationRecord = GetRecords(where, orderBy) + Return RelationTable.Instance.CreateDataTable(recs, Nothing) + End Function + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause. + ''' + Public Shared Function GetDataTable(ByVal join As BaseFilter, ByVal where As String, ByVal orderBy As OrderBy) As System.Data.DataTable + + Dim recs() As RelationRecord = GetRecords(join, where, orderBy) + Return RelationTable.Instance.CreateDataTable(recs, Nothing) + End Function + + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause with pagination. + ''' + Public Shared Function GetDataTable( _ + ByVal where As String, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As System.Data.DataTable + + Dim recs() As RelationRecord = GetRecords(where, orderBy, pageIndex, pageSize) + Return RelationTable.Instance.CreateDataTable(recs, Nothing) + End Function + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause with pagination. + ''' + Public Shared Function GetDataTable( _ + ByVal join As BaseFilter, _ + ByVal where As String, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As System.Data.DataTable + + Dim recs() As RelationRecord = GetRecords(join, where, orderBy, pageIndex, pageSize) + Return RelationTable.Instance.CreateDataTable(recs, Nothing) + End Function + + + ''' + ''' This is a shared function that can be used to delete records using a where clause. + ''' + Public Shared Sub DeleteRecords(ByVal where As String) + If where = Nothing OrElse where.Trim() = "" Then + Return + End If + + Dim whereFilter As SqlFilter = New SqlFilter(where) + RelationTable.Instance.DeleteRecordList(whereFilter) + End Sub + + ''' + ''' This is a shared function that can be used to export records using a where clause. + ''' + Public Shared Function Export(ByVal where As String) As String + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Return RelationTable.Instance.ExportRecordData(whereFilter) + End Function + + Public Shared Function Export(ByVal where As WhereClause) As String + Dim whereFilter As BaseFilter = Nothing + If Not where Is Nothing Then + whereFilter = where.GetFilter() + End If + + Return RelationTable.Instance.ExportRecordData(whereFilter) + End Function + + Public Shared Function GetSum( _ + ByVal col As BaseColumn, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) _ + As String + + Dim colSel As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, False) + colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Sum) + + Return RelationTable.Instance.GetColumnStatistics(colSel, Nothing, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + End Function + + Public Shared Function GetSum( _ + ByVal col As BaseColumn, _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) _ + As String + + Dim colSel As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, False) + colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Sum) + + Return RelationTable.Instance.GetColumnStatistics(colSel, join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + End Function + + + Public Shared Function GetCount( _ + ByVal col As BaseColumn, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) _ + As String + + Dim colSel As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, False) + colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Count) + + Return RelationTable.Instance.GetColumnStatistics(colSel, Nothing, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + End Function + + Public Shared Function GetCount( _ + ByVal col As BaseColumn, _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) _ + As String + + Dim colSel As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, False) + colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Count) + + Return RelationTable.Instance.GetColumnStatistics(colSel, join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + End Function + + ''' + ''' This method returns the columns in the table. + ''' + Public Shared Function GetColumns() As BaseColumn() + Return RelationTable.Instance.TableDefinition.Columns + End Function + + ''' + ''' This method returns the columnlist in the table. + ''' + Public Shared Function GetColumnList() As ColumnList + Return RelationTable.Instance.TableDefinition.ColumnList + End Function + + + ''' + ''' This method creates a new record and returns it to be edited. + ''' + Public Shared Function CreateNewRecord() As IRecord + Return RelationTable.Instance.CreateRecord() + End Function + + ''' + ''' This method creates a new record and returns it to be edited. + ''' + ''' ID of the new record. + Public Shared Function CreateNewRecord(ByVal tempId As String) As IRecord + Return RelationTable.Instance.CreateRecord(tempId) + End Function + + ''' + ''' This method checks if column is editable. + ''' + ''' Name of the column to check. + Public Shared Function isReadOnlyColumn(ByVal columnName As String) As Boolean + Dim column As BaseColumn = GetColumn(columnName) + If (Not IsNothing(column)) Then + Return column.IsValuesReadOnly + Else + Return True + End If + End Function + + ''' + ''' This method gets the specified column. + ''' + ''' Unique name of the column to fetch. + Public Shared Function GetColumn(ByVal uniqueColumnName As String) As BaseColumn + Dim column As BaseColumn = RelationTable.Instance.TableDefinition.ColumnList.GetByUniqueName(uniqueColumnName) + Return column + End Function + + ' Convenience method for getting a record using a string-based record identifier + Public Shared Function GetRecord(ByVal id As String, ByVal bMutable As Boolean) As RelationRecord + Return CType(RelationTable.Instance.GetRecordData(id, bMutable), RelationRecord) + End Function + + ' Convenience method for getting a record using a KeyValue record identifier + Public Shared Function GetRecord(ByVal id As KeyValue, ByVal bMutable As Boolean) As RelationRecord + Return CType(RelationTable.Instance.GetRecordData(id, bMutable), RelationRecord) + End Function + + ' Convenience method for creating a record + Public Overloads Function NewRecord( _ + ByVal RelationIdValue As String, _ + ByVal RelationValue As String _ + ) As KeyValue + Dim rec As IPrimaryKeyRecord = CType(Me.CreateRecord(), IPrimaryKeyRecord) + rec.SetString(RelationIdValue, RelationIdColumn) + rec.SetString(RelationValue, RelationColumn) + + + rec.Create() 'update the DB so any DB-initialized fields (like autoincrement IDs) can be initialized + + Dim key As KeyValue = rec.GetID() + Return key + End Function + + ''' + ''' This method deletes a specified record + ''' + ''' Keyvalue of the record to be deleted. + Public Shared Sub DeleteRecord(ByVal kv As KeyValue) + RelationTable.Instance.DeleteOneRecord(kv) + End Sub + + ''' + ''' This method checks if record exist in the database using the keyvalue provided. + ''' + ''' Key value of the record. + Public Shared Function DoesRecordExist(ByVal kv As KeyValue) As Boolean + Dim recordExist As Boolean = True + Try + RelationTable.GetRecord(kv, False) + Catch ex As Exception + recordExist = False + End Try + Return recordExist + End Function + + ''' + ''' This method returns all the primary columns in the table. + ''' + Public Shared Function GetPrimaryKeyColumns() As ColumnList + If (Not IsNothing(RelationTable.Instance.TableDefinition.PrimaryKey)) Then + Return RelationTable.Instance.TableDefinition.PrimaryKey.Columns + Else + Return Nothing + End If + End Function + + ''' + ''' This method takes a key and returns a keyvalue. + ''' + ''' key could be array of primary key values in case of composite primary key or a string containing single primary key value in case of non-composite primary key. + Public Shared Function GetKeyValue(ByVal key As Object) As KeyValue + Dim kv As KeyValue = Nothing + + If (Not (IsNothing(RelationTable.Instance.TableDefinition.PrimaryKey))) Then + + Dim isCompositePrimaryKey As Boolean = False + isCompositePrimaryKey = RelationTable.Instance.TableDefinition.PrimaryKey.IsCompositeKey + + If ((isCompositePrimaryKey) AndAlso (key.GetType.IsArray())) Then + + ' If the key is composite, then construct a key value. + kv = New KeyValue + Dim fullKeyString As String = "" + Dim keyArray As Array = CType(key, Array) + If (Not IsNothing(keyArray)) Then + Dim length As Integer = keyArray.Length + Dim pkColumns As ColumnList = RelationTable.Instance.TableDefinition.PrimaryKey.Columns + Dim pkColumn As BaseColumn + Dim index As Integer = 0 + For Each pkColumn In pkColumns + Dim keyString As String = CType(keyArray.GetValue(index), String) + If (RelationTable.Instance.TableDefinition.TableType = BaseClasses.Data.TableDefinition.TableTypes.Virtual) Then + kv.AddElement(pkColumn.UniqueName, keyString) + Else + kv.AddElement(pkColumn.InternalName, keyString) + End If + index = index + 1 + Next pkColumn + End If + + Else + ' If the key is not composite, then get the key value. + kv = RelationTable.Instance.TableDefinition.PrimaryKey.ParseValue(CType(key, String)) + End If + End If + Return kv + End Function + + + ''' + ''' This method takes a record and a Column and returns an evaluated value of DFKA formula. + ''' + Public Shared Function GetDFKA(ByVal rec As BaseRecord, ByVal col As BaseColumn) As String + Dim fkColumn As ForeignKey = RelationTable.Instance.TableDefinition.GetExpandableNonCompositeForeignKey(col) + If fkColumn Is Nothing Then + Return Nothing + End If + Dim _DFKA As String = fkColumn.PrimaryKeyDisplayColumns + If (_DFKA.Trim().StartsWith("=")) Then + ' if the formula is in the format of "= ., then pull out the data from the rec object instead of doing formula evaluation + Dim tableCodeName As String = fkColumn.PrimaryKeyTableDefinition.TableCodeName + Dim column As String = _DFKA.Trim("="c).Trim() + If column.StartsWith(tableCodeName & ".", StringComparison.InvariantCultureIgnoreCase) Then + column = column.Substring(tableCodeName.Length + 1) + End If + + For Each c As BaseColumn In fkColumn.PrimaryKeyTableDefinition.Columns + If column = c.CodeName Then + Return rec.Format(c) + End If + Next + Dim tableName As String = fkColumn.PrimaryKeyTableDefinition.TableCodeName + Return EvaluateFormula(_DFKA, rec, Nothing, tableName) + Else + Return Nothing + End If + End Function + + ''' + ''' This method takes a keyValue and a Column and returns an evaluated value of DFKA formula. + ''' + Public Shared Function GetDFKA(ByVal keyValue As String, ByVal col As BaseColumn, ByVal formatPattern as String) As String + If keyValue Is Nothing Then + Return Nothing + End If + Dim fkColumn As ForeignKey = RelationTable.Instance.TableDefinition.GetExpandableNonCompositeForeignKey(col) + If fkColumn Is Nothing Then + Return Nothing + End If + Dim _DFKA As String = fkColumn.PrimaryKeyDisplayColumns + If (_DFKA.Trim().StartsWith("=")) Then + Dim tableName As String = fkColumn.PrimaryKeyTableDefinition.TableCodeName + Dim t As PrimaryKeyTable = CType(DatabaseObjects.GetTableObject(tableName), PrimaryKeyTable) + Dim rec As BaseRecord = Nothing + If Not t Is Nothing Then + Try + rec = CType(t.GetRecordData(keyValue, False), BaseRecord) + Catch + rec = Nothing + End Try + End If + If rec Is Nothing Then + Return "" + End If + + ' if the formula is in the format of "= ., then pull out the data from the rec object instead of doing formula evaluation + Dim tableCodeName As String = fkColumn.PrimaryKeyTableDefinition.TableCodeName + Dim column As String = _DFKA.Trim("="c).Trim() + If column.StartsWith(tableCodeName & ".", StringComparison.InvariantCultureIgnoreCase) Then + column = column.Substring(tableCodeName.Length + 1) + End If + + For Each c As BaseColumn In fkColumn.PrimaryKeyTableDefinition.Columns + If column = c.CodeName Then + Return rec.Format(c) + End If + Next + Return EvaluateFormula(_DFKA, rec, Nothing, tableName) + Else + Return Nothing + End If + End Function + + ''' + ''' Evaluates the formula + ''' + Public Shared Function EvaluateFormula(ByVal formula As String, Optional ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord = Nothing, Optional ByVal format As String = Nothing, Optional ByVal name As String = "") As String + Dim e As BaseFormulaEvaluator = New BaseFormulaEvaluator() + If Not dataSourceForEvaluate Is Nothing Then + e.Evaluator.Variables.Add(name, dataSourceForEvaluate) + end if + e.DataSource = dataSourceForEvaluate + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + If Not String.IsNullOrEmpty(format) Then + Return BaseFormulaUtils.Format(resultObj, format) + Else + Return resultObj.ToString() + End If + End Function + + +#End Region + +End Class +End Namespace diff --git a/App_Code/Business Layer/BaseReportPropertiesRecord.vb b/App_Code/Business Layer/BaseReportPropertiesRecord.vb new file mode 100644 index 0000000..b173ede --- /dev/null +++ b/App_Code/Business Layer/BaseReportPropertiesRecord.vb @@ -0,0 +1,1026 @@ +' This class is "generated" and will be overwritten. +' Your customizations should be made in ReportPropertiesRecord.vb + +Imports System.Data.SqlTypes +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + +Namespace Persons.Business + +''' +''' The generated superclass for the class. +''' +''' +''' This class is not intended to be instantiated directly. To obtain an instance of this class, +''' use the methods of the class. +''' +''' +''' + + Public Class BaseReportPropertiesRecord + Inherits PrimaryKeyRecord + + + Public Shared Shadows ReadOnly TableUtils As ReportPropertiesTable = ReportPropertiesTable.Instance + + ' Constructors + + Protected Sub New() + MyBase.New(TableUtils) + End Sub + + Protected Sub New(ByVal record As PrimaryKeyRecord) + MyBase.New(record, TableUtils) + End Sub + + 'Evaluates Initialize when->Inserting record formulas specified at the data access layer + Public Overridable Sub ReportPropertiesRecord_InsertingRecord(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles Me.InsertingRecord + 'Apply Initialize->Inserting record formula only if validation is successful. + Dim ReportPropertiesRec As ReportPropertiesRecord = CType(sender,ReportPropertiesRecord) + Validate_Inserting() + If Not ReportPropertiesRec Is Nothing AndAlso Not ReportPropertiesRec.IsReadOnly Then + End If + End Sub + + 'Evaluates Initialize when->Updating record formulas specified at the data access layer + Public Overridable Sub ReportPropertiesRecord_UpdatingRecord(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles Me.UpdatingRecord + 'Apply Initialize->Updating record formula only if validation is successful. + Dim ReportPropertiesRec As ReportPropertiesRecord = CType(sender,ReportPropertiesRecord) + Validate_Updating() + If Not ReportPropertiesRec Is Nothing AndAlso Not ReportPropertiesRec.IsReadOnly Then + End If + End Sub + + 'Evaluates Initialize when->Reading record formulas specified at the data access layer + Public Overridable Sub ReportPropertiesRecord_ReadRecord(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.ReadRecord + 'Apply Initialize->Reading record formula only if validation is successful. + Dim ReportPropertiesRec As ReportPropertiesRecord = CType(sender,ReportPropertiesRecord) + If Not ReportPropertiesRec Is Nothing AndAlso Not ReportPropertiesRec.IsReadOnly Then + End If + End Sub + + 'Evaluates Validate when->Inserting formulas specified at the data access layer + Public Overridable Sub Validate_Inserting () + Dim fullValidationMessage As String = "" + Dim validationMessage As String = "" + + dim formula as String = "" + + + If validationMessage <> "" AndAlso validationMessage.ToLower() <> "true" Then + fullValidationMessage &= validationMessage & vbCrLf + End If + + If fullValidationMessage <> "" Then + Throw New Exception(fullValidationMessage) + End If + End Sub + + 'Evaluates Validate when->Updating formulas specified at the data access layer + Public Overridable Sub Validate_Updating () + Dim fullValidationMessage As String = "" + Dim validationMessage As String = "" + + dim formula as String = "" + + + If validationMessage <> "" AndAlso validationMessage.ToLower() <> "true" Then + fullValidationMessage &= validationMessage & vbCrLf + End If + + If fullValidationMessage <> "" Then + Throw New Exception(fullValidationMessage) + End If + End Sub + + Public Overridable Function EvaluateFormula(ByVal formula As String, Optional ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord = Nothing, Optional ByVal format As String = Nothing) As String + + Dim e As Data.BaseFormulaEvaluator = New Data.BaseFormulaEvaluator() + + ' All variables referred to in the formula are expected to be + ' properties of the DataSource. For example, referring to + ' UnitPrice as a variable will refer to DataSource.UnitPrice + e.DataSource = dataSourceForEvaluate + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + Return resultObj.ToString() + End Function + + + + + + + +#Region "Convenience methods to get/set values of fields" + + ''' + ''' This is a convenience method that provides direct access to the value of the record's ReportProperties_.ReportName field. + ''' + Public Function GetReportNameValue() As ColumnValue + Return Me.GetValue(TableUtils.ReportNameColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's ReportProperties_.ReportName field. + ''' + Public Function GetReportNameFieldValue() As String + Return CType(Me.GetValue(TableUtils.ReportNameColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's ReportProperties_.ReportName field. + ''' + Public Sub SetReportNameFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.ReportNameColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's ReportProperties_.ReportName field. + ''' + Public Sub SetReportNameFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.ReportNameColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's ReportProperties_.ReportDesc field. + ''' + Public Function GetReportDescValue() As ColumnValue + Return Me.GetValue(TableUtils.ReportDescColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's ReportProperties_.ReportDesc field. + ''' + Public Function GetReportDescFieldValue() As String + Return CType(Me.GetValue(TableUtils.ReportDescColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's ReportProperties_.ReportDesc field. + ''' + Public Sub SetReportDescFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.ReportDescColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's ReportProperties_.ReportDesc field. + ''' + Public Sub SetReportDescFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.ReportDescColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's ReportProperties_.Logo1 field. + ''' + Public Function GetLogo1Value() As ColumnValue + Return Me.GetValue(TableUtils.Logo1Column) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's ReportProperties_.Logo1 field. + ''' + Public Function GetLogo1FieldValue() As Byte() + Return CType(Me.GetValue(TableUtils.Logo1Column).ToBinary(), Byte()) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's ReportProperties_.Logo1 field. + ''' + Public Sub SetLogo1FieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.Logo1Column) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's ReportProperties_.Logo1 field. + ''' + Public Sub SetLogo1FieldValue(ByVal val As String) + Me.SetString(val, TableUtils.Logo1Column) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's ReportProperties_.Logo1 field. + ''' + Public Sub SetLogo1FieldValue(ByVal val As Byte ()) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.Logo1Column) + End Sub + ''' + ''' This is a convenience method that provides direct access to the value of the record's ReportProperties_.Logo2 field. + ''' + Public Function GetLogo2Value() As ColumnValue + Return Me.GetValue(TableUtils.Logo2Column) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's ReportProperties_.Logo2 field. + ''' + Public Function GetLogo2FieldValue() As Byte() + Return CType(Me.GetValue(TableUtils.Logo2Column).ToBinary(), Byte()) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's ReportProperties_.Logo2 field. + ''' + Public Sub SetLogo2FieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.Logo2Column) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's ReportProperties_.Logo2 field. + ''' + Public Sub SetLogo2FieldValue(ByVal val As String) + Me.SetString(val, TableUtils.Logo2Column) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's ReportProperties_.Logo2 field. + ''' + Public Sub SetLogo2FieldValue(ByVal val As Byte ()) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.Logo2Column) + End Sub + ''' + ''' This is a convenience method that provides direct access to the value of the record's ReportProperties_.Heading1 field. + ''' + Public Function GetHeading1Value() As ColumnValue + Return Me.GetValue(TableUtils.Heading1Column) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's ReportProperties_.Heading1 field. + ''' + Public Function GetHeading1FieldValue() As String + Return CType(Me.GetValue(TableUtils.Heading1Column).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's ReportProperties_.Heading1 field. + ''' + Public Sub SetHeading1FieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.Heading1Column) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's ReportProperties_.Heading1 field. + ''' + Public Sub SetHeading1FieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.Heading1Column) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's ReportProperties_.Heading2 field. + ''' + Public Function GetHeading2Value() As ColumnValue + Return Me.GetValue(TableUtils.Heading2Column) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's ReportProperties_.Heading2 field. + ''' + Public Function GetHeading2FieldValue() As String + Return CType(Me.GetValue(TableUtils.Heading2Column).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's ReportProperties_.Heading2 field. + ''' + Public Sub SetHeading2FieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.Heading2Column) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's ReportProperties_.Heading2 field. + ''' + Public Sub SetHeading2FieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.Heading2Column) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's ReportProperties_.Heading3 field. + ''' + Public Function GetHeading3Value() As ColumnValue + Return Me.GetValue(TableUtils.Heading3Column) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's ReportProperties_.Heading3 field. + ''' + Public Function GetHeading3FieldValue() As String + Return CType(Me.GetValue(TableUtils.Heading3Column).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's ReportProperties_.Heading3 field. + ''' + Public Sub SetHeading3FieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.Heading3Column) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's ReportProperties_.Heading3 field. + ''' + Public Sub SetHeading3FieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.Heading3Column) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's ReportProperties_.MarginLeft field. + ''' + Public Function GetMarginLeftValue() As ColumnValue + Return Me.GetValue(TableUtils.MarginLeftColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's ReportProperties_.MarginLeft field. + ''' + Public Function GetMarginLeftFieldValue() As Decimal + Return CType(Me.GetValue(TableUtils.MarginLeftColumn).ToDecimal(), Decimal) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's ReportProperties_.MarginLeft field. + ''' + Public Sub SetMarginLeftFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.MarginLeftColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's ReportProperties_.MarginLeft field. + ''' + Public Sub SetMarginLeftFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.MarginLeftColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's ReportProperties_.MarginLeft field. + ''' + Public Sub SetMarginLeftFieldValue(ByVal val As Double) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.MarginLeftColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's ReportProperties_.MarginLeft field. + ''' + Public Sub SetMarginLeftFieldValue(ByVal val As Decimal) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.MarginLeftColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's ReportProperties_.MarginLeft field. + ''' + Public Sub SetMarginLeftFieldValue(ByVal val As Int64) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.MarginLeftColumn) + End Sub + ''' + ''' This is a convenience method that provides direct access to the value of the record's ReportProperties_.MarginTop field. + ''' + Public Function GetMarginTopValue() As ColumnValue + Return Me.GetValue(TableUtils.MarginTopColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's ReportProperties_.MarginTop field. + ''' + Public Function GetMarginTopFieldValue() As Decimal + Return CType(Me.GetValue(TableUtils.MarginTopColumn).ToDecimal(), Decimal) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's ReportProperties_.MarginTop field. + ''' + Public Sub SetMarginTopFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.MarginTopColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's ReportProperties_.MarginTop field. + ''' + Public Sub SetMarginTopFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.MarginTopColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's ReportProperties_.MarginTop field. + ''' + Public Sub SetMarginTopFieldValue(ByVal val As Double) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.MarginTopColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's ReportProperties_.MarginTop field. + ''' + Public Sub SetMarginTopFieldValue(ByVal val As Decimal) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.MarginTopColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's ReportProperties_.MarginTop field. + ''' + Public Sub SetMarginTopFieldValue(ByVal val As Int64) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.MarginTopColumn) + End Sub + ''' + ''' This is a convenience method that provides direct access to the value of the record's ReportProperties_.Footer1 field. + ''' + Public Function GetFooter1Value() As ColumnValue + Return Me.GetValue(TableUtils.Footer1Column) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's ReportProperties_.Footer1 field. + ''' + Public Function GetFooter1FieldValue() As String + Return CType(Me.GetValue(TableUtils.Footer1Column).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's ReportProperties_.Footer1 field. + ''' + Public Sub SetFooter1FieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.Footer1Column) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's ReportProperties_.Footer1 field. + ''' + Public Sub SetFooter1FieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.Footer1Column) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's ReportProperties_.Footer2 field. + ''' + Public Function GetFooter2Value() As ColumnValue + Return Me.GetValue(TableUtils.Footer2Column) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's ReportProperties_.Footer2 field. + ''' + Public Function GetFooter2FieldValue() As String + Return CType(Me.GetValue(TableUtils.Footer2Column).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's ReportProperties_.Footer2 field. + ''' + Public Sub SetFooter2FieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.Footer2Column) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's ReportProperties_.Footer2 field. + ''' + Public Sub SetFooter2FieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.Footer2Column) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's ReportProperties_.Footer3 field. + ''' + Public Function GetFooter3Value() As ColumnValue + Return Me.GetValue(TableUtils.Footer3Column) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's ReportProperties_.Footer3 field. + ''' + Public Function GetFooter3FieldValue() As String + Return CType(Me.GetValue(TableUtils.Footer3Column).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's ReportProperties_.Footer3 field. + ''' + Public Sub SetFooter3FieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.Footer3Column) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's ReportProperties_.Footer3 field. + ''' + Public Sub SetFooter3FieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.Footer3Column) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's ReportProperties_.Footer4 field. + ''' + Public Function GetFooter4Value() As ColumnValue + Return Me.GetValue(TableUtils.Footer4Column) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's ReportProperties_.Footer4 field. + ''' + Public Function GetFooter4FieldValue() As String + Return CType(Me.GetValue(TableUtils.Footer4Column).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's ReportProperties_.Footer4 field. + ''' + Public Sub SetFooter4FieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.Footer4Column) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's ReportProperties_.Footer4 field. + ''' + Public Sub SetFooter4FieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.Footer4Column) + End Sub + + + +#End Region + +#Region "Convenience methods to get field names" + + ''' + ''' This is a convenience property that provides direct access to the value of the record's ReportProperties_.ReportName field. + ''' + Public Property ReportName() As String + Get + Return CType(Me.GetValue(TableUtils.ReportNameColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.ReportNameColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property ReportNameSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.ReportNameColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property ReportNameDefault() As String + Get + Return TableUtils.ReportNameColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's ReportProperties_.ReportDesc field. + ''' + Public Property ReportDesc() As String + Get + Return CType(Me.GetValue(TableUtils.ReportDescColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.ReportDescColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property ReportDescSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.ReportDescColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property ReportDescDefault() As String + Get + Return TableUtils.ReportDescColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's ReportProperties_.Logo1 field. + ''' + Public Property Logo1() As Byte() + Get + Return CType(Me.GetValue(TableUtils.Logo1Column).ToBinary(), Byte()) + End Get + Set (ByVal val As Byte ()) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.Logo1Column) + End Set + End Property + + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property Logo1Specified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.Logo1Column) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property Logo1Default() As String + Get + Return TableUtils.Logo1Column.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's ReportProperties_.Logo2 field. + ''' + Public Property Logo2() As Byte() + Get + Return CType(Me.GetValue(TableUtils.Logo2Column).ToBinary(), Byte()) + End Get + Set (ByVal val As Byte ()) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.Logo2Column) + End Set + End Property + + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property Logo2Specified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.Logo2Column) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property Logo2Default() As String + Get + Return TableUtils.Logo2Column.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's ReportProperties_.Heading1 field. + ''' + Public Property Heading1() As String + Get + Return CType(Me.GetValue(TableUtils.Heading1Column).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.Heading1Column) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property Heading1Specified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.Heading1Column) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property Heading1Default() As String + Get + Return TableUtils.Heading1Column.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's ReportProperties_.Heading2 field. + ''' + Public Property Heading2() As String + Get + Return CType(Me.GetValue(TableUtils.Heading2Column).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.Heading2Column) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property Heading2Specified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.Heading2Column) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property Heading2Default() As String + Get + Return TableUtils.Heading2Column.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's ReportProperties_.Heading3 field. + ''' + Public Property Heading3() As String + Get + Return CType(Me.GetValue(TableUtils.Heading3Column).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.Heading3Column) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property Heading3Specified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.Heading3Column) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property Heading3Default() As String + Get + Return TableUtils.Heading3Column.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's ReportProperties_.MarginLeft field. + ''' + Public Property MarginLeft() As Decimal + Get + Return CType(Me.GetValue(TableUtils.MarginLeftColumn).ToDecimal(), Decimal) + End Get + Set (ByVal val As Decimal) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.MarginLeftColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property MarginLeftSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.MarginLeftColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property MarginLeftDefault() As String + Get + Return TableUtils.MarginLeftColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's ReportProperties_.MarginTop field. + ''' + Public Property MarginTop() As Decimal + Get + Return CType(Me.GetValue(TableUtils.MarginTopColumn).ToDecimal(), Decimal) + End Get + Set (ByVal val As Decimal) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.MarginTopColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property MarginTopSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.MarginTopColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property MarginTopDefault() As String + Get + Return TableUtils.MarginTopColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's ReportProperties_.Footer1 field. + ''' + Public Property Footer1() As String + Get + Return CType(Me.GetValue(TableUtils.Footer1Column).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.Footer1Column) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property Footer1Specified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.Footer1Column) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property Footer1Default() As String + Get + Return TableUtils.Footer1Column.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's ReportProperties_.Footer2 field. + ''' + Public Property Footer2() As String + Get + Return CType(Me.GetValue(TableUtils.Footer2Column).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.Footer2Column) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property Footer2Specified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.Footer2Column) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property Footer2Default() As String + Get + Return TableUtils.Footer2Column.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's ReportProperties_.Footer3 field. + ''' + Public Property Footer3() As String + Get + Return CType(Me.GetValue(TableUtils.Footer3Column).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.Footer3Column) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property Footer3Specified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.Footer3Column) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property Footer3Default() As String + Get + Return TableUtils.Footer3Column.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's ReportProperties_.Footer4 field. + ''' + Public Property Footer4() As String + Get + Return CType(Me.GetValue(TableUtils.Footer4Column).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.Footer4Column) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property Footer4Specified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.Footer4Column) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property Footer4Default() As String + Get + Return TableUtils.Footer4Column.DefaultValue + End Get + End Property + + + +#End Region + +End Class +End Namespace diff --git a/App_Code/Business Layer/BaseReportPropertiesTable.vb b/App_Code/Business Layer/BaseReportPropertiesTable.vb new file mode 100644 index 0000000..8ae3aae --- /dev/null +++ b/App_Code/Business Layer/BaseReportPropertiesTable.vb @@ -0,0 +1,1020 @@ +' This class is "generated" and will be overwritten. +' Your customizations should be made in ReportPropertiesRecord.vb + +Imports System.Data.SqlTypes +Imports System.Data +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider +Imports Persons.Data + +Namespace Persons.Business + +''' +''' The generated superclass for the class. +''' Provides access to the schema information and record data of a database table or view named ReportProperties. +''' +''' +''' The connection details (name, location, etc.) of the database and table (or view) accessed by this class +''' are resolved at runtime based on the connection string in the application's Web.Config file. +''' +''' This class is not intended to be instantiated directly. To obtain an instance of this class, use +''' ReportPropertiesTable.Instance. +''' +''' +''' + + Public Class BaseReportPropertiesTable + Inherits PrimaryKeyTable + + + Private ReadOnly TableDefinitionString As String = ReportPropertiesDefinition.GetXMLString() + + + + + + + + Protected Sub New() + MyBase.New() + Me.Initialize() + End Sub + + Protected Overridable Sub Initialize() + Dim def As New XmlTableDefinition(TableDefinitionString) + Me.TableDefinition = New TableDefinition() + Me.TableDefinition.TableClassName = System.Reflection.Assembly.CreateQualifiedName("App_Code", "Persons.Business.ReportPropertiesTable") + def.InitializeTableDefinition(Me.TableDefinition) + Me.ConnectionName = def.GetConnectionName() + Me.RecordClassName = System.Reflection.Assembly.CreateQualifiedName("App_Code", "Persons.Business.ReportPropertiesRecord") + Me.ApplicationName = "App_Code" + Me.DataAdapter = New ReportPropertiesSqlTable() + Directcast(Me.DataAdapter, ReportPropertiesSqlTable).ConnectionName = Me.ConnectionName + + Me.TableDefinition.AdapterMetaData = Me.DataAdapter.AdapterMetaData + ReportNameColumn.CodeName = "ReportName" + ReportDescColumn.CodeName = "ReportDesc" + Logo1Column.CodeName = "Logo1" + Logo2Column.CodeName = "Logo2" + Heading1Column.CodeName = "Heading1" + Heading2Column.CodeName = "Heading2" + Heading3Column.CodeName = "Heading3" + MarginLeftColumn.CodeName = "MarginLeft" + MarginTopColumn.CodeName = "MarginTop" + Footer1Column.CodeName = "Footer1" + Footer2Column.CodeName = "Footer2" + Footer3Column.CodeName = "Footer3" + Footer4Column.CodeName = "Footer4" + + End Sub + +#Region "Overriden methods" + + +#End Region + +#Region "Properties for columns" + + ''' + ''' This is a convenience property that provides direct access to the table's ReportProperties_.ReportName column object. + ''' + Public ReadOnly Property ReportNameColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(0), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's ReportProperties_.ReportName column object. + ''' + Public Shared ReadOnly Property ReportName() As BaseClasses.Data.StringColumn + Get + Return ReportPropertiesTable.Instance.ReportNameColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's ReportProperties_.ReportDesc column object. + ''' + Public ReadOnly Property ReportDescColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(1), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's ReportProperties_.ReportDesc column object. + ''' + Public Shared ReadOnly Property ReportDesc() As BaseClasses.Data.StringColumn + Get + Return ReportPropertiesTable.Instance.ReportDescColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's ReportProperties_.Logo1 column object. + ''' + Public ReadOnly Property Logo1Column() As BaseClasses.Data.ImageColumn + Get + Return CType(Me.TableDefinition.ColumnList(2), BaseClasses.Data.ImageColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's ReportProperties_.Logo1 column object. + ''' + Public Shared ReadOnly Property Logo1() As BaseClasses.Data.ImageColumn + Get + Return ReportPropertiesTable.Instance.Logo1Column + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's ReportProperties_.Logo2 column object. + ''' + Public ReadOnly Property Logo2Column() As BaseClasses.Data.ImageColumn + Get + Return CType(Me.TableDefinition.ColumnList(3), BaseClasses.Data.ImageColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's ReportProperties_.Logo2 column object. + ''' + Public Shared ReadOnly Property Logo2() As BaseClasses.Data.ImageColumn + Get + Return ReportPropertiesTable.Instance.Logo2Column + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's ReportProperties_.Heading1 column object. + ''' + Public ReadOnly Property Heading1Column() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(4), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's ReportProperties_.Heading1 column object. + ''' + Public Shared ReadOnly Property Heading1() As BaseClasses.Data.StringColumn + Get + Return ReportPropertiesTable.Instance.Heading1Column + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's ReportProperties_.Heading2 column object. + ''' + Public ReadOnly Property Heading2Column() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(5), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's ReportProperties_.Heading2 column object. + ''' + Public Shared ReadOnly Property Heading2() As BaseClasses.Data.StringColumn + Get + Return ReportPropertiesTable.Instance.Heading2Column + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's ReportProperties_.Heading3 column object. + ''' + Public ReadOnly Property Heading3Column() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(6), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's ReportProperties_.Heading3 column object. + ''' + Public Shared ReadOnly Property Heading3() As BaseClasses.Data.StringColumn + Get + Return ReportPropertiesTable.Instance.Heading3Column + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's ReportProperties_.MarginLeft column object. + ''' + Public ReadOnly Property MarginLeftColumn() As BaseClasses.Data.NumberColumn + Get + Return CType(Me.TableDefinition.ColumnList(7), BaseClasses.Data.NumberColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's ReportProperties_.MarginLeft column object. + ''' + Public Shared ReadOnly Property MarginLeft() As BaseClasses.Data.NumberColumn + Get + Return ReportPropertiesTable.Instance.MarginLeftColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's ReportProperties_.MarginTop column object. + ''' + Public ReadOnly Property MarginTopColumn() As BaseClasses.Data.NumberColumn + Get + Return CType(Me.TableDefinition.ColumnList(8), BaseClasses.Data.NumberColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's ReportProperties_.MarginTop column object. + ''' + Public Shared ReadOnly Property MarginTop() As BaseClasses.Data.NumberColumn + Get + Return ReportPropertiesTable.Instance.MarginTopColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's ReportProperties_.Footer1 column object. + ''' + Public ReadOnly Property Footer1Column() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(9), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's ReportProperties_.Footer1 column object. + ''' + Public Shared ReadOnly Property Footer1() As BaseClasses.Data.StringColumn + Get + Return ReportPropertiesTable.Instance.Footer1Column + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's ReportProperties_.Footer2 column object. + ''' + Public ReadOnly Property Footer2Column() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(10), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's ReportProperties_.Footer2 column object. + ''' + Public Shared ReadOnly Property Footer2() As BaseClasses.Data.StringColumn + Get + Return ReportPropertiesTable.Instance.Footer2Column + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's ReportProperties_.Footer3 column object. + ''' + Public ReadOnly Property Footer3Column() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(11), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's ReportProperties_.Footer3 column object. + ''' + Public Shared ReadOnly Property Footer3() As BaseClasses.Data.StringColumn + Get + Return ReportPropertiesTable.Instance.Footer3Column + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's ReportProperties_.Footer4 column object. + ''' + Public ReadOnly Property Footer4Column() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(12), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's ReportProperties_.Footer4 column object. + ''' + Public Shared ReadOnly Property Footer4() As BaseClasses.Data.StringColumn + Get + Return ReportPropertiesTable.Instance.Footer4Column + End Get + End Property + + +#End Region + + +#Region "Shared helper methods" + + ''' + ''' This is a shared function that can be used to get an array of ReportPropertiesRecord records using a where clause. + ''' + Public Shared Function GetRecords(ByVal where As String) As ReportPropertiesRecord() + + Return GetRecords(where, Nothing, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) + End Function + + ''' + ''' This is a shared function that can be used to get an array of ReportPropertiesRecord records using a where clause. + ''' + Public Shared Function GetRecords(ByVal join As BaseFilter, ByVal where As String) As ReportPropertiesRecord() + + Return GetRecords(join, where, Nothing, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) + End Function + + ''' + ''' This is a shared function that can be used to get an array of ReportPropertiesRecord records using a where and order by clause. + ''' + Public Shared Function GetRecords( _ + ByVal where As String, _ + ByVal orderBy As OrderBy) As ReportPropertiesRecord() + + Return GetRecords(where, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) + End Function + + ''' + ''' This is a shared function that can be used to get an array of ReportPropertiesRecord records using a where and order by clause. + ''' + Public Shared Function GetRecords( _ + ByVal join As BaseFilter, _ + ByVal where As String, _ + ByVal orderBy As OrderBy) As ReportPropertiesRecord() + + Return GetRecords(join, where, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) + End Function + + ''' + ''' This is a shared function that can be used to get an array of ReportPropertiesRecord records using a where and order by clause clause with pagination. + ''' + Public Shared Function GetRecords( _ + ByVal where As String, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As ReportPropertiesRecord() + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + Dim join As BaseClasses.Data.BaseFilter = Nothing + Dim recList As ArrayList = ReportPropertiesTable.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, pageIndex, pageSize) + + Return CType(recList.ToArray(GetType(Persons.Business.ReportPropertiesRecord)), ReportPropertiesRecord()) + End Function + + ''' + ''' This is a shared function that can be used to get an array of ReportPropertiesRecord records using a where and order by clause clause with pagination. + ''' + Public Shared Function GetRecords( _ + ByVal join As BaseFilter, _ + ByVal where As String, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As ReportPropertiesRecord() + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Dim recList As ArrayList = ReportPropertiesTable.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, pageIndex, pageSize) + + Return CType(recList.ToArray(GetType(Persons.Business.ReportPropertiesRecord)), ReportPropertiesRecord()) + End Function + + Public Shared Function GetRecords( _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As ReportPropertiesRecord() + Dim join As BaseClasses.Data.BaseFilter = Nothing + Dim recList As ArrayList = ReportPropertiesTable.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + Return CType(recList.ToArray(GetType(Persons.Business.ReportPropertiesRecord)), ReportPropertiesRecord()) + End Function + + Public Shared Function GetRecords( _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As ReportPropertiesRecord() + + Dim recList As ArrayList = ReportPropertiesTable.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + Return CType(recList.ToArray(GetType(Persons.Business.ReportPropertiesRecord)), ReportPropertiesRecord()) + End Function + + Public Shared Function GetRecords( _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer, _ + ByRef totalRecords As Integer) As ReportPropertiesRecord() + Dim join As BaseClasses.Data.BaseFilter = Nothing + Dim recList As ArrayList = ReportPropertiesTable.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize, totalRecords) + + Return CType(recList.ToArray(GetType(Persons.Business.ReportPropertiesRecord)), ReportPropertiesRecord()) + End Function + + Public Shared Function GetRecords( _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer, _ + ByRef totalRecords As Integer) As ReportPropertiesRecord() + + Dim recList As ArrayList = ReportPropertiesTable.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize, totalRecords) + + Return CType(recList.ToArray(GetType(Persons.Business.ReportPropertiesRecord)), ReportPropertiesRecord()) + End Function + + ''' + ''' This is a shared function that can be used to get total number of records that will be returned using the where clause. + ''' + Public Shared Function GetRecordCount(ByVal where As String) As Integer + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Return CInt(ReportPropertiesTable.Instance.GetRecordListCount(Nothing, whereFilter, Nothing, Nothing)) + End Function + +''' + ''' This is a shared function that can be used to get total number of records that will be returned using the where clause. + ''' + Public Shared Function GetRecordCount(ByVal join As BaseFilter, ByVal where As String) As Integer + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Return CInt(ReportPropertiesTable.Instance.GetRecordListCount(join, whereFilter, Nothing, Nothing)) + End Function + + Public Shared Function GetRecordCount(ByVal where As WhereClause) As Integer + Return CInt(ReportPropertiesTable.Instance.GetRecordListCount(Nothing, where.GetFilter(), Nothing, Nothing)) + End Function + + Public Shared Function GetRecordCount(ByVal join As BaseFilter, ByVal where As WhereClause) As Integer + Return CInt(ReportPropertiesTable.Instance.GetRecordListCount(join, where.GetFilter(), Nothing, Nothing)) + End Function + + ''' + ''' This is a shared function that can be used to get a ReportPropertiesRecord record using a where clause. + ''' + Public Shared Function GetRecord(ByVal where As String) As ReportPropertiesRecord + Dim orderBy As OrderBy = Nothing + Return GetRecord(where, orderBy) + End Function + + ''' + ''' This is a shared function that can be used to get a ReportPropertiesRecord record using a where clause. + ''' + Public Shared Function GetRecord(ByVal join As BaseFilter, ByVal where As String) As ReportPropertiesRecord + Dim orderBy As OrderBy = Nothing + Return GetRecord(join, where, orderBy) + End Function + + ''' + ''' This is a shared function that can be used to get a ReportPropertiesRecord record using a where and order by clause. + ''' + Public Shared Function GetRecord( _ + ByVal where As String, _ + ByVal orderBy As OrderBy) As ReportPropertiesRecord + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + Dim join As BaseClasses.Data.BaseFilter = Nothing + Dim recList As ArrayList = ReportPropertiesTable.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MIN_BATCH_SIZE) + + Dim rec As ReportPropertiesRecord = Nothing + If recList.Count > 0 Then + rec = CType(recList(0), ReportPropertiesRecord) + End If + + Return rec + End Function + + ''' + ''' This is a shared function that can be used to get a ReportPropertiesRecord record using a where and order by clause. + ''' + Public Shared Function GetRecord( _ + ByVal join As BaseFilter, _ + ByVal where As String, _ + ByVal orderBy As OrderBy) As ReportPropertiesRecord + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Dim recList As ArrayList = ReportPropertiesTable.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MIN_BATCH_SIZE) + + Dim rec As ReportPropertiesRecord = Nothing + If recList.Count > 0 Then + rec = CType(recList(0), ReportPropertiesRecord) + End If + + Return rec + End Function + + + Public Shared Function GetValues( _ + ByVal col As BaseColumn, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal maxItems As Integer) As String() + + ' Create the filter list. + Dim retCol As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, True) + retCol.AddColumn(col) + + Return ReportPropertiesTable.Instance.GetColumnValues(retCol, Nothing, where.GetFilter(), Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, maxItems) + + End Function + + Public Shared Function GetValues( _ + ByVal col As BaseColumn, _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal maxItems As Integer) As String() + + ' Create the filter list. + Dim retCol As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, True) + retCol.AddColumn(col) + + Return ReportPropertiesTable.Instance.GetColumnValues(retCol, join, where.GetFilter(), Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, maxItems) + + End Function + + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where clause. + ''' + Public Shared Function GetDataTable(ByVal where As String) As System.Data.DataTable + + Dim recs() As ReportPropertiesRecord = GetRecords(where) + Return ReportPropertiesTable.Instance.CreateDataTable(recs, Nothing) + End Function + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where clause. + ''' + Public Shared Function GetDataTable(ByVal join As BaseFilter, ByVal where As String) As System.Data.DataTable + + Dim recs() As ReportPropertiesRecord = GetRecords(join, where) + Return ReportPropertiesTable.Instance.CreateDataTable(recs, Nothing) + End Function + + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause. + ''' + Public Shared Function GetDataTable(ByVal where As String, ByVal orderBy As OrderBy) As System.Data.DataTable + + Dim recs() As ReportPropertiesRecord = GetRecords(where, orderBy) + Return ReportPropertiesTable.Instance.CreateDataTable(recs, Nothing) + End Function + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause. + ''' + Public Shared Function GetDataTable(ByVal join As BaseFilter, ByVal where As String, ByVal orderBy As OrderBy) As System.Data.DataTable + + Dim recs() As ReportPropertiesRecord = GetRecords(join, where, orderBy) + Return ReportPropertiesTable.Instance.CreateDataTable(recs, Nothing) + End Function + + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause with pagination. + ''' + Public Shared Function GetDataTable( _ + ByVal where As String, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As System.Data.DataTable + + Dim recs() As ReportPropertiesRecord = GetRecords(where, orderBy, pageIndex, pageSize) + Return ReportPropertiesTable.Instance.CreateDataTable(recs, Nothing) + End Function + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause with pagination. + ''' + Public Shared Function GetDataTable( _ + ByVal join As BaseFilter, _ + ByVal where As String, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As System.Data.DataTable + + Dim recs() As ReportPropertiesRecord = GetRecords(join, where, orderBy, pageIndex, pageSize) + Return ReportPropertiesTable.Instance.CreateDataTable(recs, Nothing) + End Function + + + ''' + ''' This is a shared function that can be used to delete records using a where clause. + ''' + Public Shared Sub DeleteRecords(ByVal where As String) + If where = Nothing OrElse where.Trim() = "" Then + Return + End If + + Dim whereFilter As SqlFilter = New SqlFilter(where) + ReportPropertiesTable.Instance.DeleteRecordList(whereFilter) + End Sub + + ''' + ''' This is a shared function that can be used to export records using a where clause. + ''' + Public Shared Function Export(ByVal where As String) As String + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Return ReportPropertiesTable.Instance.ExportRecordData(whereFilter) + End Function + + Public Shared Function Export(ByVal where As WhereClause) As String + Dim whereFilter As BaseFilter = Nothing + If Not where Is Nothing Then + whereFilter = where.GetFilter() + End If + + Return ReportPropertiesTable.Instance.ExportRecordData(whereFilter) + End Function + + Public Shared Function GetSum( _ + ByVal col As BaseColumn, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) _ + As String + + Dim colSel As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, False) + colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Sum) + + Return ReportPropertiesTable.Instance.GetColumnStatistics(colSel, Nothing, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + End Function + + Public Shared Function GetSum( _ + ByVal col As BaseColumn, _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) _ + As String + + Dim colSel As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, False) + colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Sum) + + Return ReportPropertiesTable.Instance.GetColumnStatistics(colSel, join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + End Function + + + Public Shared Function GetCount( _ + ByVal col As BaseColumn, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) _ + As String + + Dim colSel As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, False) + colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Count) + + Return ReportPropertiesTable.Instance.GetColumnStatistics(colSel, Nothing, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + End Function + + Public Shared Function GetCount( _ + ByVal col As BaseColumn, _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) _ + As String + + Dim colSel As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, False) + colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Count) + + Return ReportPropertiesTable.Instance.GetColumnStatistics(colSel, join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + End Function + + ''' + ''' This method returns the columns in the table. + ''' + Public Shared Function GetColumns() As BaseColumn() + Return ReportPropertiesTable.Instance.TableDefinition.Columns + End Function + + ''' + ''' This method returns the columnlist in the table. + ''' + Public Shared Function GetColumnList() As ColumnList + Return ReportPropertiesTable.Instance.TableDefinition.ColumnList + End Function + + + ''' + ''' This method creates a new record and returns it to be edited. + ''' + Public Shared Function CreateNewRecord() As IRecord + Return ReportPropertiesTable.Instance.CreateRecord() + End Function + + ''' + ''' This method creates a new record and returns it to be edited. + ''' + ''' ID of the new record. + Public Shared Function CreateNewRecord(ByVal tempId As String) As IRecord + Return ReportPropertiesTable.Instance.CreateRecord(tempId) + End Function + + ''' + ''' This method checks if column is editable. + ''' + ''' Name of the column to check. + Public Shared Function isReadOnlyColumn(ByVal columnName As String) As Boolean + Dim column As BaseColumn = GetColumn(columnName) + If (Not IsNothing(column)) Then + Return column.IsValuesReadOnly + Else + Return True + End If + End Function + + ''' + ''' This method gets the specified column. + ''' + ''' Unique name of the column to fetch. + Public Shared Function GetColumn(ByVal uniqueColumnName As String) As BaseColumn + Dim column As BaseColumn = ReportPropertiesTable.Instance.TableDefinition.ColumnList.GetByUniqueName(uniqueColumnName) + Return column + End Function + + ' Convenience method for getting a record using a string-based record identifier + Public Shared Function GetRecord(ByVal id As String, ByVal bMutable As Boolean) As ReportPropertiesRecord + Return CType(ReportPropertiesTable.Instance.GetRecordData(id, bMutable), ReportPropertiesRecord) + End Function + + ' Convenience method for getting a record using a KeyValue record identifier + Public Shared Function GetRecord(ByVal id As KeyValue, ByVal bMutable As Boolean) As ReportPropertiesRecord + Return CType(ReportPropertiesTable.Instance.GetRecordData(id, bMutable), ReportPropertiesRecord) + End Function + + ' Convenience method for creating a record + Public Overloads Function NewRecord( _ + ByVal ReportNameValue As String, _ + ByVal ReportDescValue As String, _ + ByVal Logo1Value As String, _ + ByVal Logo2Value As String, _ + ByVal Heading1Value As String, _ + ByVal Heading2Value As String, _ + ByVal Heading3Value As String, _ + ByVal MarginLeftValue As String, _ + ByVal MarginTopValue As String, _ + ByVal Footer1Value As String, _ + ByVal Footer2Value As String, _ + ByVal Footer3Value As String, _ + ByVal Footer4Value As String _ + ) As KeyValue + Dim rec As IPrimaryKeyRecord = CType(Me.CreateRecord(), IPrimaryKeyRecord) + rec.SetString(ReportNameValue, ReportNameColumn) + rec.SetString(ReportDescValue, ReportDescColumn) + rec.SetString(Logo1Value, Logo1Column) + rec.SetString(Logo2Value, Logo2Column) + rec.SetString(Heading1Value, Heading1Column) + rec.SetString(Heading2Value, Heading2Column) + rec.SetString(Heading3Value, Heading3Column) + rec.SetString(MarginLeftValue, MarginLeftColumn) + rec.SetString(MarginTopValue, MarginTopColumn) + rec.SetString(Footer1Value, Footer1Column) + rec.SetString(Footer2Value, Footer2Column) + rec.SetString(Footer3Value, Footer3Column) + rec.SetString(Footer4Value, Footer4Column) + + + rec.Create() 'update the DB so any DB-initialized fields (like autoincrement IDs) can be initialized + + Dim key As KeyValue = rec.GetID() + Return key + End Function + + ''' + ''' This method deletes a specified record + ''' + ''' Keyvalue of the record to be deleted. + Public Shared Sub DeleteRecord(ByVal kv As KeyValue) + ReportPropertiesTable.Instance.DeleteOneRecord(kv) + End Sub + + ''' + ''' This method checks if record exist in the database using the keyvalue provided. + ''' + ''' Key value of the record. + Public Shared Function DoesRecordExist(ByVal kv As KeyValue) As Boolean + Dim recordExist As Boolean = True + Try + ReportPropertiesTable.GetRecord(kv, False) + Catch ex As Exception + recordExist = False + End Try + Return recordExist + End Function + + ''' + ''' This method returns all the primary columns in the table. + ''' + Public Shared Function GetPrimaryKeyColumns() As ColumnList + If (Not IsNothing(ReportPropertiesTable.Instance.TableDefinition.PrimaryKey)) Then + Return ReportPropertiesTable.Instance.TableDefinition.PrimaryKey.Columns + Else + Return Nothing + End If + End Function + + ''' + ''' This method takes a key and returns a keyvalue. + ''' + ''' key could be array of primary key values in case of composite primary key or a string containing single primary key value in case of non-composite primary key. + Public Shared Function GetKeyValue(ByVal key As Object) As KeyValue + Dim kv As KeyValue = Nothing + + If (Not (IsNothing(ReportPropertiesTable.Instance.TableDefinition.PrimaryKey))) Then + + Dim isCompositePrimaryKey As Boolean = False + isCompositePrimaryKey = ReportPropertiesTable.Instance.TableDefinition.PrimaryKey.IsCompositeKey + + If ((isCompositePrimaryKey) AndAlso (key.GetType.IsArray())) Then + + ' If the key is composite, then construct a key value. + kv = New KeyValue + Dim fullKeyString As String = "" + Dim keyArray As Array = CType(key, Array) + If (Not IsNothing(keyArray)) Then + Dim length As Integer = keyArray.Length + Dim pkColumns As ColumnList = ReportPropertiesTable.Instance.TableDefinition.PrimaryKey.Columns + Dim pkColumn As BaseColumn + Dim index As Integer = 0 + For Each pkColumn In pkColumns + Dim keyString As String = CType(keyArray.GetValue(index), String) + If (ReportPropertiesTable.Instance.TableDefinition.TableType = BaseClasses.Data.TableDefinition.TableTypes.Virtual) Then + kv.AddElement(pkColumn.UniqueName, keyString) + Else + kv.AddElement(pkColumn.InternalName, keyString) + End If + index = index + 1 + Next pkColumn + End If + + Else + ' If the key is not composite, then get the key value. + kv = ReportPropertiesTable.Instance.TableDefinition.PrimaryKey.ParseValue(CType(key, String)) + End If + End If + Return kv + End Function + + + ''' + ''' This method takes a record and a Column and returns an evaluated value of DFKA formula. + ''' + Public Shared Function GetDFKA(ByVal rec As BaseRecord, ByVal col As BaseColumn) As String + Dim fkColumn As ForeignKey = ReportPropertiesTable.Instance.TableDefinition.GetExpandableNonCompositeForeignKey(col) + If fkColumn Is Nothing Then + Return Nothing + End If + Dim _DFKA As String = fkColumn.PrimaryKeyDisplayColumns + If (_DFKA.Trim().StartsWith("=")) Then + ' if the formula is in the format of "= ., then pull out the data from the rec object instead of doing formula evaluation + Dim tableCodeName As String = fkColumn.PrimaryKeyTableDefinition.TableCodeName + Dim column As String = _DFKA.Trim("="c).Trim() + If column.StartsWith(tableCodeName & ".", StringComparison.InvariantCultureIgnoreCase) Then + column = column.Substring(tableCodeName.Length + 1) + End If + + For Each c As BaseColumn In fkColumn.PrimaryKeyTableDefinition.Columns + If column = c.CodeName Then + Return rec.Format(c) + End If + Next + Dim tableName As String = fkColumn.PrimaryKeyTableDefinition.TableCodeName + Return EvaluateFormula(_DFKA, rec, Nothing, tableName) + Else + Return Nothing + End If + End Function + + ''' + ''' This method takes a keyValue and a Column and returns an evaluated value of DFKA formula. + ''' + Public Shared Function GetDFKA(ByVal keyValue As String, ByVal col As BaseColumn, ByVal formatPattern as String) As String + If keyValue Is Nothing Then + Return Nothing + End If + Dim fkColumn As ForeignKey = ReportPropertiesTable.Instance.TableDefinition.GetExpandableNonCompositeForeignKey(col) + If fkColumn Is Nothing Then + Return Nothing + End If + Dim _DFKA As String = fkColumn.PrimaryKeyDisplayColumns + If (_DFKA.Trim().StartsWith("=")) Then + Dim tableName As String = fkColumn.PrimaryKeyTableDefinition.TableCodeName + Dim t As PrimaryKeyTable = CType(DatabaseObjects.GetTableObject(tableName), PrimaryKeyTable) + Dim rec As BaseRecord = Nothing + If Not t Is Nothing Then + Try + rec = CType(t.GetRecordData(keyValue, False), BaseRecord) + Catch + rec = Nothing + End Try + End If + If rec Is Nothing Then + Return "" + End If + + ' if the formula is in the format of "= ., then pull out the data from the rec object instead of doing formula evaluation + Dim tableCodeName As String = fkColumn.PrimaryKeyTableDefinition.TableCodeName + Dim column As String = _DFKA.Trim("="c).Trim() + If column.StartsWith(tableCodeName & ".", StringComparison.InvariantCultureIgnoreCase) Then + column = column.Substring(tableCodeName.Length + 1) + End If + + For Each c As BaseColumn In fkColumn.PrimaryKeyTableDefinition.Columns + If column = c.CodeName Then + Return rec.Format(c) + End If + Next + Return EvaluateFormula(_DFKA, rec, Nothing, tableName) + Else + Return Nothing + End If + End Function + + ''' + ''' Evaluates the formula + ''' + Public Shared Function EvaluateFormula(ByVal formula As String, Optional ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord = Nothing, Optional ByVal format As String = Nothing, Optional ByVal name As String = "") As String + Dim e As BaseFormulaEvaluator = New BaseFormulaEvaluator() + If Not dataSourceForEvaluate Is Nothing Then + e.Evaluator.Variables.Add(name, dataSourceForEvaluate) + end if + e.DataSource = dataSourceForEvaluate + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + If Not String.IsNullOrEmpty(format) Then + Return BaseFormulaUtils.Format(resultObj, format) + Else + Return resultObj.ToString() + End If + End Function + + +#End Region + +End Class +End Namespace diff --git a/App_Code/Business Layer/BaseSectionRecord.vb b/App_Code/Business Layer/BaseSectionRecord.vb new file mode 100644 index 0000000..7814a7d --- /dev/null +++ b/App_Code/Business Layer/BaseSectionRecord.vb @@ -0,0 +1,4848 @@ +' This class is "generated" and will be overwritten. +' Your customizations should be made in SectionRecord.vb + +Imports System.Data.SqlTypes +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + +Namespace Persons.Business + +''' +''' The generated superclass for the class. +''' +''' +''' This class is not intended to be instantiated directly. To obtain an instance of this class, +''' use the methods of the class. +''' +''' +''' + + Public Class BaseSectionRecord + Inherits PrimaryKeyRecord + + + Public Shared Shadows ReadOnly TableUtils As SectionTable = SectionTable.Instance + + ' Constructors + + Protected Sub New() + MyBase.New(TableUtils) + End Sub + + Protected Sub New(ByVal record As PrimaryKeyRecord) + MyBase.New(record, TableUtils) + End Sub + + 'Evaluates Initialize when->Inserting record formulas specified at the data access layer + Public Overridable Sub SectionRecord_InsertingRecord(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles Me.InsertingRecord + 'Apply Initialize->Inserting record formula only if validation is successful. + Dim SectionRec As SectionRecord = CType(sender,SectionRecord) + Validate_Inserting() + If Not SectionRec Is Nothing AndAlso Not SectionRec.IsReadOnly Then + End If + End Sub + + 'Evaluates Initialize when->Updating record formulas specified at the data access layer + Public Overridable Sub SectionRecord_UpdatingRecord(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles Me.UpdatingRecord + 'Apply Initialize->Updating record formula only if validation is successful. + Dim SectionRec As SectionRecord = CType(sender,SectionRecord) + Validate_Updating() + If Not SectionRec Is Nothing AndAlso Not SectionRec.IsReadOnly Then + End If + End Sub + + 'Evaluates Initialize when->Reading record formulas specified at the data access layer + Public Overridable Sub SectionRecord_ReadRecord(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.ReadRecord + 'Apply Initialize->Reading record formula only if validation is successful. + Dim SectionRec As SectionRecord = CType(sender,SectionRecord) + If Not SectionRec Is Nothing AndAlso Not SectionRec.IsReadOnly Then + End If + End Sub + + 'Evaluates Validate when->Inserting formulas specified at the data access layer + Public Overridable Sub Validate_Inserting () + Dim fullValidationMessage As String = "" + Dim validationMessage As String = "" + + dim formula as String = "" + + + If validationMessage <> "" AndAlso validationMessage.ToLower() <> "true" Then + fullValidationMessage &= validationMessage & vbCrLf + End If + + If fullValidationMessage <> "" Then + Throw New Exception(fullValidationMessage) + End If + End Sub + + 'Evaluates Validate when->Updating formulas specified at the data access layer + Public Overridable Sub Validate_Updating () + Dim fullValidationMessage As String = "" + Dim validationMessage As String = "" + + dim formula as String = "" + + + If validationMessage <> "" AndAlso validationMessage.ToLower() <> "true" Then + fullValidationMessage &= validationMessage & vbCrLf + End If + + If fullValidationMessage <> "" Then + Throw New Exception(fullValidationMessage) + End If + End Sub + + Public Overridable Function EvaluateFormula(ByVal formula As String, Optional ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord = Nothing, Optional ByVal format As String = Nothing) As String + + Dim e As Data.BaseFormulaEvaluator = New Data.BaseFormulaEvaluator() + + ' All variables referred to in the formula are expected to be + ' properties of the DataSource. For example, referring to + ' UnitPrice as a variable will refer to DataSource.UnitPrice + e.DataSource = dataSourceForEvaluate + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + Return resultObj.ToString() + End Function + + + + + + + +#Region "Convenience methods to get/set values of fields" + + ''' + ''' This is a convenience method that provides direct access to the value of the record's Section_.SectionId field. + ''' + Public Function GetSectionIdValue() As ColumnValue + Return Me.GetValue(TableUtils.SectionIdColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's Section_.SectionId field. + ''' + Public Function GetSectionIdFieldValue() As Int16 + Return CType(Me.GetValue(TableUtils.SectionIdColumn).ToInt16(), Int16) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.SectionId field. + ''' + Public Sub SetSectionIdFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.SectionIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.SectionId field. + ''' + Public Sub SetSectionIdFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.SectionIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.SectionId field. + ''' + Public Sub SetSectionIdFieldValue(ByVal val As Double) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.SectionIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.SectionId field. + ''' + Public Sub SetSectionIdFieldValue(ByVal val As Decimal) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.SectionIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.SectionId field. + ''' + Public Sub SetSectionIdFieldValue(ByVal val As Int64) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.SectionIdColumn) + End Sub + ''' + ''' This is a convenience method that provides direct access to the value of the record's Section_.SectionName field. + ''' + Public Function GetSectionNameValue() As ColumnValue + Return Me.GetValue(TableUtils.SectionNameColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's Section_.SectionName field. + ''' + Public Function GetSectionNameFieldValue() As String + Return CType(Me.GetValue(TableUtils.SectionNameColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.SectionName field. + ''' + Public Sub SetSectionNameFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.SectionNameColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.SectionName field. + ''' + Public Sub SetSectionNameFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.SectionNameColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's Section_.SectionAbbvrName field. + ''' + Public Function GetSectionAbbvrNameValue() As ColumnValue + Return Me.GetValue(TableUtils.SectionAbbvrNameColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's Section_.SectionAbbvrName field. + ''' + Public Function GetSectionAbbvrNameFieldValue() As String + Return CType(Me.GetValue(TableUtils.SectionAbbvrNameColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.SectionAbbvrName field. + ''' + Public Sub SetSectionAbbvrNameFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.SectionAbbvrNameColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.SectionAbbvrName field. + ''' + Public Sub SetSectionAbbvrNameFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.SectionAbbvrNameColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's Section_.SectionEName field. + ''' + Public Function GetSectionENameValue() As ColumnValue + Return Me.GetValue(TableUtils.SectionENameColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's Section_.SectionEName field. + ''' + Public Function GetSectionENameFieldValue() As String + Return CType(Me.GetValue(TableUtils.SectionENameColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.SectionEName field. + ''' + Public Sub SetSectionENameFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.SectionENameColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.SectionEName field. + ''' + Public Sub SetSectionENameFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.SectionENameColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's Section_.MarshallFull field. + ''' + Public Function GetMarshallFullValue() As ColumnValue + Return Me.GetValue(TableUtils.MarshallFullColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's Section_.MarshallFull field. + ''' + Public Function GetMarshallFullFieldValue() As Int16 + Return CType(Me.GetValue(TableUtils.MarshallFullColumn).ToInt16(), Int16) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.MarshallFull field. + ''' + Public Sub SetMarshallFullFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.MarshallFullColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.MarshallFull field. + ''' + Public Sub SetMarshallFullFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.MarshallFullColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.MarshallFull field. + ''' + Public Sub SetMarshallFullFieldValue(ByVal val As Double) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.MarshallFullColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.MarshallFull field. + ''' + Public Sub SetMarshallFullFieldValue(ByVal val As Decimal) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.MarshallFullColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.MarshallFull field. + ''' + Public Sub SetMarshallFullFieldValue(ByVal val As Int64) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.MarshallFullColumn) + End Sub + ''' + ''' This is a convenience method that provides direct access to the value of the record's Section_.MarShall field. + ''' + Public Function GetMarShallValue() As ColumnValue + Return Me.GetValue(TableUtils.MarShallColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's Section_.MarShall field. + ''' + Public Function GetMarShallFieldValue() As Int16 + Return CType(Me.GetValue(TableUtils.MarShallColumn).ToInt16(), Int16) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.MarShall field. + ''' + Public Sub SetMarShallFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.MarShallColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.MarShall field. + ''' + Public Sub SetMarShallFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.MarShallColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.MarShall field. + ''' + Public Sub SetMarShallFieldValue(ByVal val As Double) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.MarShallColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.MarShall field. + ''' + Public Sub SetMarShallFieldValue(ByVal val As Decimal) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.MarShallColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.MarShall field. + ''' + Public Sub SetMarShallFieldValue(ByVal val As Int64) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.MarShallColumn) + End Sub + ''' + ''' This is a convenience method that provides direct access to the value of the record's Section_.GeneralFull field. + ''' + Public Function GetGeneralFullValue() As ColumnValue + Return Me.GetValue(TableUtils.GeneralFullColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's Section_.GeneralFull field. + ''' + Public Function GetGeneralFullFieldValue() As Int16 + Return CType(Me.GetValue(TableUtils.GeneralFullColumn).ToInt16(), Int16) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.GeneralFull field. + ''' + Public Sub SetGeneralFullFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.GeneralFullColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.GeneralFull field. + ''' + Public Sub SetGeneralFullFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.GeneralFullColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.GeneralFull field. + ''' + Public Sub SetGeneralFullFieldValue(ByVal val As Double) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.GeneralFullColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.GeneralFull field. + ''' + Public Sub SetGeneralFullFieldValue(ByVal val As Decimal) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.GeneralFullColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.GeneralFull field. + ''' + Public Sub SetGeneralFullFieldValue(ByVal val As Int64) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.GeneralFullColumn) + End Sub + ''' + ''' This is a convenience method that provides direct access to the value of the record's Section_.General field. + ''' + Public Function GetGeneralValue() As ColumnValue + Return Me.GetValue(TableUtils.GeneralColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's Section_.General field. + ''' + Public Function GetGeneralFieldValue() As Int16 + Return CType(Me.GetValue(TableUtils.GeneralColumn).ToInt16(), Int16) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.General field. + ''' + Public Sub SetGeneralFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.GeneralColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.General field. + ''' + Public Sub SetGeneralFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.GeneralColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.General field. + ''' + Public Sub SetGeneralFieldValue(ByVal val As Double) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.GeneralColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.General field. + ''' + Public Sub SetGeneralFieldValue(ByVal val As Decimal) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.GeneralColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.General field. + ''' + Public Sub SetGeneralFieldValue(ByVal val As Int64) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.GeneralColumn) + End Sub + ''' + ''' This is a convenience method that provides direct access to the value of the record's Section_.LtGeneralFull field. + ''' + Public Function GetLtGeneralFullValue() As ColumnValue + Return Me.GetValue(TableUtils.LtGeneralFullColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's Section_.LtGeneralFull field. + ''' + Public Function GetLtGeneralFullFieldValue() As Int16 + Return CType(Me.GetValue(TableUtils.LtGeneralFullColumn).ToInt16(), Int16) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.LtGeneralFull field. + ''' + Public Sub SetLtGeneralFullFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.LtGeneralFullColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.LtGeneralFull field. + ''' + Public Sub SetLtGeneralFullFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.LtGeneralFullColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.LtGeneralFull field. + ''' + Public Sub SetLtGeneralFullFieldValue(ByVal val As Double) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.LtGeneralFullColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.LtGeneralFull field. + ''' + Public Sub SetLtGeneralFullFieldValue(ByVal val As Decimal) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.LtGeneralFullColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.LtGeneralFull field. + ''' + Public Sub SetLtGeneralFullFieldValue(ByVal val As Int64) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.LtGeneralFullColumn) + End Sub + ''' + ''' This is a convenience method that provides direct access to the value of the record's Section_.LtGeneral field. + ''' + Public Function GetLtGeneralValue() As ColumnValue + Return Me.GetValue(TableUtils.LtGeneralColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's Section_.LtGeneral field. + ''' + Public Function GetLtGeneralFieldValue() As Int16 + Return CType(Me.GetValue(TableUtils.LtGeneralColumn).ToInt16(), Int16) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.LtGeneral field. + ''' + Public Sub SetLtGeneralFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.LtGeneralColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.LtGeneral field. + ''' + Public Sub SetLtGeneralFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.LtGeneralColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.LtGeneral field. + ''' + Public Sub SetLtGeneralFieldValue(ByVal val As Double) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.LtGeneralColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.LtGeneral field. + ''' + Public Sub SetLtGeneralFieldValue(ByVal val As Decimal) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.LtGeneralColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.LtGeneral field. + ''' + Public Sub SetLtGeneralFieldValue(ByVal val As Int64) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.LtGeneralColumn) + End Sub + ''' + ''' This is a convenience method that provides direct access to the value of the record's Section_.MjGeneralFull field. + ''' + Public Function GetMjGeneralFullValue() As ColumnValue + Return Me.GetValue(TableUtils.MjGeneralFullColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's Section_.MjGeneralFull field. + ''' + Public Function GetMjGeneralFullFieldValue() As Int16 + Return CType(Me.GetValue(TableUtils.MjGeneralFullColumn).ToInt16(), Int16) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.MjGeneralFull field. + ''' + Public Sub SetMjGeneralFullFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.MjGeneralFullColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.MjGeneralFull field. + ''' + Public Sub SetMjGeneralFullFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.MjGeneralFullColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.MjGeneralFull field. + ''' + Public Sub SetMjGeneralFullFieldValue(ByVal val As Double) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.MjGeneralFullColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.MjGeneralFull field. + ''' + Public Sub SetMjGeneralFullFieldValue(ByVal val As Decimal) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.MjGeneralFullColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.MjGeneralFull field. + ''' + Public Sub SetMjGeneralFullFieldValue(ByVal val As Int64) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.MjGeneralFullColumn) + End Sub + ''' + ''' This is a convenience method that provides direct access to the value of the record's Section_.MjGeneral field. + ''' + Public Function GetMjGeneralValue() As ColumnValue + Return Me.GetValue(TableUtils.MjGeneralColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's Section_.MjGeneral field. + ''' + Public Function GetMjGeneralFieldValue() As Int16 + Return CType(Me.GetValue(TableUtils.MjGeneralColumn).ToInt16(), Int16) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.MjGeneral field. + ''' + Public Sub SetMjGeneralFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.MjGeneralColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.MjGeneral field. + ''' + Public Sub SetMjGeneralFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.MjGeneralColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.MjGeneral field. + ''' + Public Sub SetMjGeneralFieldValue(ByVal val As Double) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.MjGeneralColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.MjGeneral field. + ''' + Public Sub SetMjGeneralFieldValue(ByVal val As Decimal) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.MjGeneralColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.MjGeneral field. + ''' + Public Sub SetMjGeneralFieldValue(ByVal val As Int64) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.MjGeneralColumn) + End Sub + ''' + ''' This is a convenience method that provides direct access to the value of the record's Section_.SpColonelFull field. + ''' + Public Function GetSpColonelFullValue() As ColumnValue + Return Me.GetValue(TableUtils.SpColonelFullColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's Section_.SpColonelFull field. + ''' + Public Function GetSpColonelFullFieldValue() As Int16 + Return CType(Me.GetValue(TableUtils.SpColonelFullColumn).ToInt16(), Int16) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.SpColonelFull field. + ''' + Public Sub SetSpColonelFullFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.SpColonelFullColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.SpColonelFull field. + ''' + Public Sub SetSpColonelFullFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.SpColonelFullColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.SpColonelFull field. + ''' + Public Sub SetSpColonelFullFieldValue(ByVal val As Double) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.SpColonelFullColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.SpColonelFull field. + ''' + Public Sub SetSpColonelFullFieldValue(ByVal val As Decimal) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.SpColonelFullColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.SpColonelFull field. + ''' + Public Sub SetSpColonelFullFieldValue(ByVal val As Int64) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.SpColonelFullColumn) + End Sub + ''' + ''' This is a convenience method that provides direct access to the value of the record's Section_.SpColonel field. + ''' + Public Function GetSpColonelValue() As ColumnValue + Return Me.GetValue(TableUtils.SpColonelColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's Section_.SpColonel field. + ''' + Public Function GetSpColonelFieldValue() As Int16 + Return CType(Me.GetValue(TableUtils.SpColonelColumn).ToInt16(), Int16) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.SpColonel field. + ''' + Public Sub SetSpColonelFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.SpColonelColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.SpColonel field. + ''' + Public Sub SetSpColonelFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.SpColonelColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.SpColonel field. + ''' + Public Sub SetSpColonelFieldValue(ByVal val As Double) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.SpColonelColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.SpColonel field. + ''' + Public Sub SetSpColonelFieldValue(ByVal val As Decimal) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.SpColonelColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.SpColonel field. + ''' + Public Sub SetSpColonelFieldValue(ByVal val As Int64) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.SpColonelColumn) + End Sub + ''' + ''' This is a convenience method that provides direct access to the value of the record's Section_.ColonelFull field. + ''' + Public Function GetColonelFullValue() As ColumnValue + Return Me.GetValue(TableUtils.ColonelFullColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's Section_.ColonelFull field. + ''' + Public Function GetColonelFullFieldValue() As Int16 + Return CType(Me.GetValue(TableUtils.ColonelFullColumn).ToInt16(), Int16) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.ColonelFull field. + ''' + Public Sub SetColonelFullFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.ColonelFullColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.ColonelFull field. + ''' + Public Sub SetColonelFullFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.ColonelFullColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.ColonelFull field. + ''' + Public Sub SetColonelFullFieldValue(ByVal val As Double) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.ColonelFullColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.ColonelFull field. + ''' + Public Sub SetColonelFullFieldValue(ByVal val As Decimal) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.ColonelFullColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.ColonelFull field. + ''' + Public Sub SetColonelFullFieldValue(ByVal val As Int64) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.ColonelFullColumn) + End Sub + ''' + ''' This is a convenience method that provides direct access to the value of the record's Section_.Colonel field. + ''' + Public Function GetColonelValue() As ColumnValue + Return Me.GetValue(TableUtils.ColonelColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's Section_.Colonel field. + ''' + Public Function GetColonelFieldValue() As Int16 + Return CType(Me.GetValue(TableUtils.ColonelColumn).ToInt16(), Int16) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.Colonel field. + ''' + Public Sub SetColonelFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.ColonelColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.Colonel field. + ''' + Public Sub SetColonelFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.ColonelColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.Colonel field. + ''' + Public Sub SetColonelFieldValue(ByVal val As Double) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.ColonelColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.Colonel field. + ''' + Public Sub SetColonelFieldValue(ByVal val As Decimal) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.ColonelColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.Colonel field. + ''' + Public Sub SetColonelFieldValue(ByVal val As Int64) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.ColonelColumn) + End Sub + ''' + ''' This is a convenience method that provides direct access to the value of the record's Section_.LtColonelFull field. + ''' + Public Function GetLtColonelFullValue() As ColumnValue + Return Me.GetValue(TableUtils.LtColonelFullColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's Section_.LtColonelFull field. + ''' + Public Function GetLtColonelFullFieldValue() As Int16 + Return CType(Me.GetValue(TableUtils.LtColonelFullColumn).ToInt16(), Int16) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.LtColonelFull field. + ''' + Public Sub SetLtColonelFullFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.LtColonelFullColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.LtColonelFull field. + ''' + Public Sub SetLtColonelFullFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.LtColonelFullColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.LtColonelFull field. + ''' + Public Sub SetLtColonelFullFieldValue(ByVal val As Double) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.LtColonelFullColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.LtColonelFull field. + ''' + Public Sub SetLtColonelFullFieldValue(ByVal val As Decimal) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.LtColonelFullColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.LtColonelFull field. + ''' + Public Sub SetLtColonelFullFieldValue(ByVal val As Int64) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.LtColonelFullColumn) + End Sub + ''' + ''' This is a convenience method that provides direct access to the value of the record's Section_.LtColonel field. + ''' + Public Function GetLtColonelValue() As ColumnValue + Return Me.GetValue(TableUtils.LtColonelColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's Section_.LtColonel field. + ''' + Public Function GetLtColonelFieldValue() As Int16 + Return CType(Me.GetValue(TableUtils.LtColonelColumn).ToInt16(), Int16) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.LtColonel field. + ''' + Public Sub SetLtColonelFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.LtColonelColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.LtColonel field. + ''' + Public Sub SetLtColonelFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.LtColonelColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.LtColonel field. + ''' + Public Sub SetLtColonelFieldValue(ByVal val As Double) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.LtColonelColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.LtColonel field. + ''' + Public Sub SetLtColonelFieldValue(ByVal val As Decimal) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.LtColonelColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.LtColonel field. + ''' + Public Sub SetLtColonelFieldValue(ByVal val As Int64) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.LtColonelColumn) + End Sub + ''' + ''' This is a convenience method that provides direct access to the value of the record's Section_.MajorFull field. + ''' + Public Function GetMajorFullValue() As ColumnValue + Return Me.GetValue(TableUtils.MajorFullColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's Section_.MajorFull field. + ''' + Public Function GetMajorFullFieldValue() As Int16 + Return CType(Me.GetValue(TableUtils.MajorFullColumn).ToInt16(), Int16) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.MajorFull field. + ''' + Public Sub SetMajorFullFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.MajorFullColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.MajorFull field. + ''' + Public Sub SetMajorFullFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.MajorFullColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.MajorFull field. + ''' + Public Sub SetMajorFullFieldValue(ByVal val As Double) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.MajorFullColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.MajorFull field. + ''' + Public Sub SetMajorFullFieldValue(ByVal val As Decimal) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.MajorFullColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.MajorFull field. + ''' + Public Sub SetMajorFullFieldValue(ByVal val As Int64) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.MajorFullColumn) + End Sub + ''' + ''' This is a convenience method that provides direct access to the value of the record's Section_.Major field. + ''' + Public Function GetMajorValue() As ColumnValue + Return Me.GetValue(TableUtils.MajorColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's Section_.Major field. + ''' + Public Function GetMajorFieldValue() As Int16 + Return CType(Me.GetValue(TableUtils.MajorColumn).ToInt16(), Int16) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.Major field. + ''' + Public Sub SetMajorFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.MajorColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.Major field. + ''' + Public Sub SetMajorFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.MajorColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.Major field. + ''' + Public Sub SetMajorFieldValue(ByVal val As Double) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.MajorColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.Major field. + ''' + Public Sub SetMajorFieldValue(ByVal val As Decimal) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.MajorColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.Major field. + ''' + Public Sub SetMajorFieldValue(ByVal val As Int64) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.MajorColumn) + End Sub + ''' + ''' This is a convenience method that provides direct access to the value of the record's Section_.CaptianFull field. + ''' + Public Function GetCaptianFullValue() As ColumnValue + Return Me.GetValue(TableUtils.CaptianFullColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's Section_.CaptianFull field. + ''' + Public Function GetCaptianFullFieldValue() As Int16 + Return CType(Me.GetValue(TableUtils.CaptianFullColumn).ToInt16(), Int16) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.CaptianFull field. + ''' + Public Sub SetCaptianFullFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.CaptianFullColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.CaptianFull field. + ''' + Public Sub SetCaptianFullFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.CaptianFullColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.CaptianFull field. + ''' + Public Sub SetCaptianFullFieldValue(ByVal val As Double) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.CaptianFullColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.CaptianFull field. + ''' + Public Sub SetCaptianFullFieldValue(ByVal val As Decimal) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.CaptianFullColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.CaptianFull field. + ''' + Public Sub SetCaptianFullFieldValue(ByVal val As Int64) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.CaptianFullColumn) + End Sub + ''' + ''' This is a convenience method that provides direct access to the value of the record's Section_.Captian field. + ''' + Public Function GetCaptianValue() As ColumnValue + Return Me.GetValue(TableUtils.CaptianColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's Section_.Captian field. + ''' + Public Function GetCaptianFieldValue() As Int16 + Return CType(Me.GetValue(TableUtils.CaptianColumn).ToInt16(), Int16) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.Captian field. + ''' + Public Sub SetCaptianFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.CaptianColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.Captian field. + ''' + Public Sub SetCaptianFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.CaptianColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.Captian field. + ''' + Public Sub SetCaptianFieldValue(ByVal val As Double) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.CaptianColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.Captian field. + ''' + Public Sub SetCaptianFieldValue(ByVal val As Decimal) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.CaptianColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.Captian field. + ''' + Public Sub SetCaptianFieldValue(ByVal val As Int64) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.CaptianColumn) + End Sub + ''' + ''' This is a convenience method that provides direct access to the value of the record's Section_.LieutenantFull field. + ''' + Public Function GetLieutenantFullValue() As ColumnValue + Return Me.GetValue(TableUtils.LieutenantFullColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's Section_.LieutenantFull field. + ''' + Public Function GetLieutenantFullFieldValue() As Int16 + Return CType(Me.GetValue(TableUtils.LieutenantFullColumn).ToInt16(), Int16) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.LieutenantFull field. + ''' + Public Sub SetLieutenantFullFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.LieutenantFullColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.LieutenantFull field. + ''' + Public Sub SetLieutenantFullFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.LieutenantFullColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.LieutenantFull field. + ''' + Public Sub SetLieutenantFullFieldValue(ByVal val As Double) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.LieutenantFullColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.LieutenantFull field. + ''' + Public Sub SetLieutenantFullFieldValue(ByVal val As Decimal) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.LieutenantFullColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.LieutenantFull field. + ''' + Public Sub SetLieutenantFullFieldValue(ByVal val As Int64) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.LieutenantFullColumn) + End Sub + ''' + ''' This is a convenience method that provides direct access to the value of the record's Section_.Lieutenant field. + ''' + Public Function GetLieutenantValue() As ColumnValue + Return Me.GetValue(TableUtils.LieutenantColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's Section_.Lieutenant field. + ''' + Public Function GetLieutenantFieldValue() As Int16 + Return CType(Me.GetValue(TableUtils.LieutenantColumn).ToInt16(), Int16) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.Lieutenant field. + ''' + Public Sub SetLieutenantFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.LieutenantColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.Lieutenant field. + ''' + Public Sub SetLieutenantFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.LieutenantColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.Lieutenant field. + ''' + Public Sub SetLieutenantFieldValue(ByVal val As Double) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.LieutenantColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.Lieutenant field. + ''' + Public Sub SetLieutenantFieldValue(ByVal val As Decimal) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.LieutenantColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.Lieutenant field. + ''' + Public Sub SetLieutenantFieldValue(ByVal val As Int64) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.LieutenantColumn) + End Sub + ''' + ''' This is a convenience method that provides direct access to the value of the record's Section_.SubLieutenantFull field. + ''' + Public Function GetSubLieutenantFullValue() As ColumnValue + Return Me.GetValue(TableUtils.SubLieutenantFullColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's Section_.SubLieutenantFull field. + ''' + Public Function GetSubLieutenantFullFieldValue() As Int16 + Return CType(Me.GetValue(TableUtils.SubLieutenantFullColumn).ToInt16(), Int16) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.SubLieutenantFull field. + ''' + Public Sub SetSubLieutenantFullFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.SubLieutenantFullColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.SubLieutenantFull field. + ''' + Public Sub SetSubLieutenantFullFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.SubLieutenantFullColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.SubLieutenantFull field. + ''' + Public Sub SetSubLieutenantFullFieldValue(ByVal val As Double) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.SubLieutenantFullColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.SubLieutenantFull field. + ''' + Public Sub SetSubLieutenantFullFieldValue(ByVal val As Decimal) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.SubLieutenantFullColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.SubLieutenantFull field. + ''' + Public Sub SetSubLieutenantFullFieldValue(ByVal val As Int64) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.SubLieutenantFullColumn) + End Sub + ''' + ''' This is a convenience method that provides direct access to the value of the record's Section_.SubLieutenant field. + ''' + Public Function GetSubLieutenantValue() As ColumnValue + Return Me.GetValue(TableUtils.SubLieutenantColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's Section_.SubLieutenant field. + ''' + Public Function GetSubLieutenantFieldValue() As Int16 + Return CType(Me.GetValue(TableUtils.SubLieutenantColumn).ToInt16(), Int16) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.SubLieutenant field. + ''' + Public Sub SetSubLieutenantFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.SubLieutenantColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.SubLieutenant field. + ''' + Public Sub SetSubLieutenantFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.SubLieutenantColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.SubLieutenant field. + ''' + Public Sub SetSubLieutenantFieldValue(ByVal val As Double) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.SubLieutenantColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.SubLieutenant field. + ''' + Public Sub SetSubLieutenantFieldValue(ByVal val As Decimal) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.SubLieutenantColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.SubLieutenant field. + ''' + Public Sub SetSubLieutenantFieldValue(ByVal val As Int64) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.SubLieutenantColumn) + End Sub + ''' + ''' This is a convenience method that provides direct access to the value of the record's Section_.Sm0Full field. + ''' + Public Function GetSm0FullValue() As ColumnValue + Return Me.GetValue(TableUtils.Sm0FullColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's Section_.Sm0Full field. + ''' + Public Function GetSm0FullFieldValue() As Int16 + Return CType(Me.GetValue(TableUtils.Sm0FullColumn).ToInt16(), Int16) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.Sm0Full field. + ''' + Public Sub SetSm0FullFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.Sm0FullColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.Sm0Full field. + ''' + Public Sub SetSm0FullFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.Sm0FullColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.Sm0Full field. + ''' + Public Sub SetSm0FullFieldValue(ByVal val As Double) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.Sm0FullColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.Sm0Full field. + ''' + Public Sub SetSm0FullFieldValue(ByVal val As Decimal) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.Sm0FullColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.Sm0Full field. + ''' + Public Sub SetSm0FullFieldValue(ByVal val As Int64) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.Sm0FullColumn) + End Sub + ''' + ''' This is a convenience method that provides direct access to the value of the record's Section_.Sm0 field. + ''' + Public Function GetSm0Value() As ColumnValue + Return Me.GetValue(TableUtils.Sm0Column) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's Section_.Sm0 field. + ''' + Public Function GetSm0FieldValue() As Int16 + Return CType(Me.GetValue(TableUtils.Sm0Column).ToInt16(), Int16) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.Sm0 field. + ''' + Public Sub SetSm0FieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.Sm0Column) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.Sm0 field. + ''' + Public Sub SetSm0FieldValue(ByVal val As String) + Me.SetString(val, TableUtils.Sm0Column) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.Sm0 field. + ''' + Public Sub SetSm0FieldValue(ByVal val As Double) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.Sm0Column) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.Sm0 field. + ''' + Public Sub SetSm0FieldValue(ByVal val As Decimal) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.Sm0Column) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.Sm0 field. + ''' + Public Sub SetSm0FieldValue(ByVal val As Int64) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.Sm0Column) + End Sub + ''' + ''' This is a convenience method that provides direct access to the value of the record's Section_.Sm1Full field. + ''' + Public Function GetSm1FullValue() As ColumnValue + Return Me.GetValue(TableUtils.Sm1FullColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's Section_.Sm1Full field. + ''' + Public Function GetSm1FullFieldValue() As Int16 + Return CType(Me.GetValue(TableUtils.Sm1FullColumn).ToInt16(), Int16) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.Sm1Full field. + ''' + Public Sub SetSm1FullFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.Sm1FullColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.Sm1Full field. + ''' + Public Sub SetSm1FullFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.Sm1FullColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.Sm1Full field. + ''' + Public Sub SetSm1FullFieldValue(ByVal val As Double) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.Sm1FullColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.Sm1Full field. + ''' + Public Sub SetSm1FullFieldValue(ByVal val As Decimal) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.Sm1FullColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.Sm1Full field. + ''' + Public Sub SetSm1FullFieldValue(ByVal val As Int64) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.Sm1FullColumn) + End Sub + ''' + ''' This is a convenience method that provides direct access to the value of the record's Section_.Sm1 field. + ''' + Public Function GetSm1Value() As ColumnValue + Return Me.GetValue(TableUtils.Sm1Column) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's Section_.Sm1 field. + ''' + Public Function GetSm1FieldValue() As Int16 + Return CType(Me.GetValue(TableUtils.Sm1Column).ToInt16(), Int16) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.Sm1 field. + ''' + Public Sub SetSm1FieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.Sm1Column) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.Sm1 field. + ''' + Public Sub SetSm1FieldValue(ByVal val As String) + Me.SetString(val, TableUtils.Sm1Column) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.Sm1 field. + ''' + Public Sub SetSm1FieldValue(ByVal val As Double) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.Sm1Column) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.Sm1 field. + ''' + Public Sub SetSm1FieldValue(ByVal val As Decimal) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.Sm1Column) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.Sm1 field. + ''' + Public Sub SetSm1FieldValue(ByVal val As Int64) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.Sm1Column) + End Sub + ''' + ''' This is a convenience method that provides direct access to the value of the record's Section_.Sm2Full field. + ''' + Public Function GetSm2FullValue() As ColumnValue + Return Me.GetValue(TableUtils.Sm2FullColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's Section_.Sm2Full field. + ''' + Public Function GetSm2FullFieldValue() As Int16 + Return CType(Me.GetValue(TableUtils.Sm2FullColumn).ToInt16(), Int16) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.Sm2Full field. + ''' + Public Sub SetSm2FullFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.Sm2FullColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.Sm2Full field. + ''' + Public Sub SetSm2FullFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.Sm2FullColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.Sm2Full field. + ''' + Public Sub SetSm2FullFieldValue(ByVal val As Double) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.Sm2FullColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.Sm2Full field. + ''' + Public Sub SetSm2FullFieldValue(ByVal val As Decimal) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.Sm2FullColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.Sm2Full field. + ''' + Public Sub SetSm2FullFieldValue(ByVal val As Int64) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.Sm2FullColumn) + End Sub + ''' + ''' This is a convenience method that provides direct access to the value of the record's Section_.Sm2 field. + ''' + Public Function GetSm2Value() As ColumnValue + Return Me.GetValue(TableUtils.Sm2Column) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's Section_.Sm2 field. + ''' + Public Function GetSm2FieldValue() As Int16 + Return CType(Me.GetValue(TableUtils.Sm2Column).ToInt16(), Int16) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.Sm2 field. + ''' + Public Sub SetSm2FieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.Sm2Column) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.Sm2 field. + ''' + Public Sub SetSm2FieldValue(ByVal val As String) + Me.SetString(val, TableUtils.Sm2Column) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.Sm2 field. + ''' + Public Sub SetSm2FieldValue(ByVal val As Double) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.Sm2Column) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.Sm2 field. + ''' + Public Sub SetSm2FieldValue(ByVal val As Decimal) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.Sm2Column) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.Sm2 field. + ''' + Public Sub SetSm2FieldValue(ByVal val As Int64) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.Sm2Column) + End Sub + ''' + ''' This is a convenience method that provides direct access to the value of the record's Section_.Sm3Full field. + ''' + Public Function GetSm3FullValue() As ColumnValue + Return Me.GetValue(TableUtils.Sm3FullColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's Section_.Sm3Full field. + ''' + Public Function GetSm3FullFieldValue() As Int16 + Return CType(Me.GetValue(TableUtils.Sm3FullColumn).ToInt16(), Int16) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.Sm3Full field. + ''' + Public Sub SetSm3FullFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.Sm3FullColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.Sm3Full field. + ''' + Public Sub SetSm3FullFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.Sm3FullColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.Sm3Full field. + ''' + Public Sub SetSm3FullFieldValue(ByVal val As Double) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.Sm3FullColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.Sm3Full field. + ''' + Public Sub SetSm3FullFieldValue(ByVal val As Decimal) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.Sm3FullColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.Sm3Full field. + ''' + Public Sub SetSm3FullFieldValue(ByVal val As Int64) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.Sm3FullColumn) + End Sub + ''' + ''' This is a convenience method that provides direct access to the value of the record's Section_.Sm3 field. + ''' + Public Function GetSm3Value() As ColumnValue + Return Me.GetValue(TableUtils.Sm3Column) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's Section_.Sm3 field. + ''' + Public Function GetSm3FieldValue() As Int16 + Return CType(Me.GetValue(TableUtils.Sm3Column).ToInt16(), Int16) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.Sm3 field. + ''' + Public Sub SetSm3FieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.Sm3Column) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.Sm3 field. + ''' + Public Sub SetSm3FieldValue(ByVal val As String) + Me.SetString(val, TableUtils.Sm3Column) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.Sm3 field. + ''' + Public Sub SetSm3FieldValue(ByVal val As Double) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.Sm3Column) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.Sm3 field. + ''' + Public Sub SetSm3FieldValue(ByVal val As Decimal) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.Sm3Column) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.Sm3 field. + ''' + Public Sub SetSm3FieldValue(ByVal val As Int64) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.Sm3Column) + End Sub + ''' + ''' This is a convenience method that provides direct access to the value of the record's Section_.SgtFull field. + ''' + Public Function GetSgtFullValue() As ColumnValue + Return Me.GetValue(TableUtils.SgtFullColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's Section_.SgtFull field. + ''' + Public Function GetSgtFullFieldValue() As Int16 + Return CType(Me.GetValue(TableUtils.SgtFullColumn).ToInt16(), Int16) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.SgtFull field. + ''' + Public Sub SetSgtFullFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.SgtFullColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.SgtFull field. + ''' + Public Sub SetSgtFullFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.SgtFullColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.SgtFull field. + ''' + Public Sub SetSgtFullFieldValue(ByVal val As Double) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.SgtFullColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.SgtFull field. + ''' + Public Sub SetSgtFullFieldValue(ByVal val As Decimal) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.SgtFullColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.SgtFull field. + ''' + Public Sub SetSgtFullFieldValue(ByVal val As Int64) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.SgtFullColumn) + End Sub + ''' + ''' This is a convenience method that provides direct access to the value of the record's Section_.Sgt field. + ''' + Public Function GetSgtValue() As ColumnValue + Return Me.GetValue(TableUtils.SgtColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's Section_.Sgt field. + ''' + Public Function GetSgtFieldValue() As Int16 + Return CType(Me.GetValue(TableUtils.SgtColumn).ToInt16(), Int16) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.Sgt field. + ''' + Public Sub SetSgtFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.SgtColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.Sgt field. + ''' + Public Sub SetSgtFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.SgtColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.Sgt field. + ''' + Public Sub SetSgtFieldValue(ByVal val As Double) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.SgtColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.Sgt field. + ''' + Public Sub SetSgtFieldValue(ByVal val As Decimal) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.SgtColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.Sgt field. + ''' + Public Sub SetSgtFieldValue(ByVal val As Int64) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.SgtColumn) + End Sub + ''' + ''' This is a convenience method that provides direct access to the value of the record's Section_.CptFull field. + ''' + Public Function GetCptFullValue() As ColumnValue + Return Me.GetValue(TableUtils.CptFullColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's Section_.CptFull field. + ''' + Public Function GetCptFullFieldValue() As Int16 + Return CType(Me.GetValue(TableUtils.CptFullColumn).ToInt16(), Int16) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.CptFull field. + ''' + Public Sub SetCptFullFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.CptFullColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.CptFull field. + ''' + Public Sub SetCptFullFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.CptFullColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.CptFull field. + ''' + Public Sub SetCptFullFieldValue(ByVal val As Double) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.CptFullColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.CptFull field. + ''' + Public Sub SetCptFullFieldValue(ByVal val As Decimal) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.CptFullColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.CptFull field. + ''' + Public Sub SetCptFullFieldValue(ByVal val As Int64) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.CptFullColumn) + End Sub + ''' + ''' This is a convenience method that provides direct access to the value of the record's Section_.Cpt field. + ''' + Public Function GetCptValue() As ColumnValue + Return Me.GetValue(TableUtils.CptColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's Section_.Cpt field. + ''' + Public Function GetCptFieldValue() As Int16 + Return CType(Me.GetValue(TableUtils.CptColumn).ToInt16(), Int16) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.Cpt field. + ''' + Public Sub SetCptFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.CptColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.Cpt field. + ''' + Public Sub SetCptFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.CptColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.Cpt field. + ''' + Public Sub SetCptFieldValue(ByVal val As Double) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.CptColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.Cpt field. + ''' + Public Sub SetCptFieldValue(ByVal val As Decimal) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.CptColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.Cpt field. + ''' + Public Sub SetCptFieldValue(ByVal val As Int64) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.CptColumn) + End Sub + ''' + ''' This is a convenience method that provides direct access to the value of the record's Section_.PtcFull field. + ''' + Public Function GetPtcFullValue() As ColumnValue + Return Me.GetValue(TableUtils.PtcFullColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's Section_.PtcFull field. + ''' + Public Function GetPtcFullFieldValue() As Int16 + Return CType(Me.GetValue(TableUtils.PtcFullColumn).ToInt16(), Int16) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.PtcFull field. + ''' + Public Sub SetPtcFullFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.PtcFullColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.PtcFull field. + ''' + Public Sub SetPtcFullFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.PtcFullColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.PtcFull field. + ''' + Public Sub SetPtcFullFieldValue(ByVal val As Double) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.PtcFullColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.PtcFull field. + ''' + Public Sub SetPtcFullFieldValue(ByVal val As Decimal) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.PtcFullColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.PtcFull field. + ''' + Public Sub SetPtcFullFieldValue(ByVal val As Int64) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.PtcFullColumn) + End Sub + ''' + ''' This is a convenience method that provides direct access to the value of the record's Section_.Ptc field. + ''' + Public Function GetPtcValue() As ColumnValue + Return Me.GetValue(TableUtils.PtcColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's Section_.Ptc field. + ''' + Public Function GetPtcFieldValue() As Int16 + Return CType(Me.GetValue(TableUtils.PtcColumn).ToInt16(), Int16) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.Ptc field. + ''' + Public Sub SetPtcFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.PtcColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.Ptc field. + ''' + Public Sub SetPtcFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.PtcColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.Ptc field. + ''' + Public Sub SetPtcFieldValue(ByVal val As Double) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.PtcColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.Ptc field. + ''' + Public Sub SetPtcFieldValue(ByVal val As Decimal) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.PtcColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.Ptc field. + ''' + Public Sub SetPtcFieldValue(ByVal val As Int64) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.PtcColumn) + End Sub + ''' + ''' This is a convenience method that provides direct access to the value of the record's Section_.PvtVolFull field. + ''' + Public Function GetPvtVolFullValue() As ColumnValue + Return Me.GetValue(TableUtils.PvtVolFullColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's Section_.PvtVolFull field. + ''' + Public Function GetPvtVolFullFieldValue() As Int16 + Return CType(Me.GetValue(TableUtils.PvtVolFullColumn).ToInt16(), Int16) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.PvtVolFull field. + ''' + Public Sub SetPvtVolFullFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.PvtVolFullColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.PvtVolFull field. + ''' + Public Sub SetPvtVolFullFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.PvtVolFullColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.PvtVolFull field. + ''' + Public Sub SetPvtVolFullFieldValue(ByVal val As Double) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.PvtVolFullColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.PvtVolFull field. + ''' + Public Sub SetPvtVolFullFieldValue(ByVal val As Decimal) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.PvtVolFullColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.PvtVolFull field. + ''' + Public Sub SetPvtVolFullFieldValue(ByVal val As Int64) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.PvtVolFullColumn) + End Sub + ''' + ''' This is a convenience method that provides direct access to the value of the record's Section_.PvtVol field. + ''' + Public Function GetPvtVolValue() As ColumnValue + Return Me.GetValue(TableUtils.PvtVolColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's Section_.PvtVol field. + ''' + Public Function GetPvtVolFieldValue() As Int16 + Return CType(Me.GetValue(TableUtils.PvtVolColumn).ToInt16(), Int16) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.PvtVol field. + ''' + Public Sub SetPvtVolFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.PvtVolColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.PvtVol field. + ''' + Public Sub SetPvtVolFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.PvtVolColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.PvtVol field. + ''' + Public Sub SetPvtVolFieldValue(ByVal val As Double) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.PvtVolColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.PvtVol field. + ''' + Public Sub SetPvtVolFieldValue(ByVal val As Decimal) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.PvtVolColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.PvtVol field. + ''' + Public Sub SetPvtVolFieldValue(ByVal val As Int64) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.PvtVolColumn) + End Sub + ''' + ''' This is a convenience method that provides direct access to the value of the record's Section_.Sm4Full field. + ''' + Public Function GetSm4FullValue() As ColumnValue + Return Me.GetValue(TableUtils.Sm4FullColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's Section_.Sm4Full field. + ''' + Public Function GetSm4FullFieldValue() As Int16 + Return CType(Me.GetValue(TableUtils.Sm4FullColumn).ToInt16(), Int16) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.Sm4Full field. + ''' + Public Sub SetSm4FullFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.Sm4FullColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.Sm4Full field. + ''' + Public Sub SetSm4FullFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.Sm4FullColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.Sm4Full field. + ''' + Public Sub SetSm4FullFieldValue(ByVal val As Double) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.Sm4FullColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.Sm4Full field. + ''' + Public Sub SetSm4FullFieldValue(ByVal val As Decimal) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.Sm4FullColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.Sm4Full field. + ''' + Public Sub SetSm4FullFieldValue(ByVal val As Int64) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.Sm4FullColumn) + End Sub + ''' + ''' This is a convenience method that provides direct access to the value of the record's Section_.Sm4 field. + ''' + Public Function GetSm4Value() As ColumnValue + Return Me.GetValue(TableUtils.Sm4Column) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's Section_.Sm4 field. + ''' + Public Function GetSm4FieldValue() As Int16 + Return CType(Me.GetValue(TableUtils.Sm4Column).ToInt16(), Int16) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.Sm4 field. + ''' + Public Sub SetSm4FieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.Sm4Column) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.Sm4 field. + ''' + Public Sub SetSm4FieldValue(ByVal val As String) + Me.SetString(val, TableUtils.Sm4Column) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.Sm4 field. + ''' + Public Sub SetSm4FieldValue(ByVal val As Double) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.Sm4Column) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.Sm4 field. + ''' + Public Sub SetSm4FieldValue(ByVal val As Decimal) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.Sm4Column) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.Sm4 field. + ''' + Public Sub SetSm4FieldValue(ByVal val As Int64) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.Sm4Column) + End Sub + ''' + ''' This is a convenience method that provides direct access to the value of the record's Section_.PvtFull field. + ''' + Public Function GetPvtFullValue() As ColumnValue + Return Me.GetValue(TableUtils.PvtFullColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's Section_.PvtFull field. + ''' + Public Function GetPvtFullFieldValue() As Int16 + Return CType(Me.GetValue(TableUtils.PvtFullColumn).ToInt16(), Int16) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.PvtFull field. + ''' + Public Sub SetPvtFullFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.PvtFullColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.PvtFull field. + ''' + Public Sub SetPvtFullFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.PvtFullColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.PvtFull field. + ''' + Public Sub SetPvtFullFieldValue(ByVal val As Double) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.PvtFullColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.PvtFull field. + ''' + Public Sub SetPvtFullFieldValue(ByVal val As Decimal) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.PvtFullColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.PvtFull field. + ''' + Public Sub SetPvtFullFieldValue(ByVal val As Int64) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.PvtFullColumn) + End Sub + ''' + ''' This is a convenience method that provides direct access to the value of the record's Section_.Pvt field. + ''' + Public Function GetPvtValue() As ColumnValue + Return Me.GetValue(TableUtils.PvtColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's Section_.Pvt field. + ''' + Public Function GetPvtFieldValue() As Int16 + Return CType(Me.GetValue(TableUtils.PvtColumn).ToInt16(), Int16) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.Pvt field. + ''' + Public Sub SetPvtFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.PvtColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.Pvt field. + ''' + Public Sub SetPvtFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.PvtColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.Pvt field. + ''' + Public Sub SetPvtFieldValue(ByVal val As Double) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.PvtColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.Pvt field. + ''' + Public Sub SetPvtFieldValue(ByVal val As Decimal) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.PvtColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.Pvt field. + ''' + Public Sub SetPvtFieldValue(ByVal val As Int64) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.PvtColumn) + End Sub + ''' + ''' This is a convenience method that provides direct access to the value of the record's Section_.Sm4Now field. + ''' + Public Function GetSm4NowValue() As ColumnValue + Return Me.GetValue(TableUtils.Sm4NowColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's Section_.Sm4Now field. + ''' + Public Function GetSm4NowFieldValue() As Int16 + Return CType(Me.GetValue(TableUtils.Sm4NowColumn).ToInt16(), Int16) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.Sm4Now field. + ''' + Public Sub SetSm4NowFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.Sm4NowColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.Sm4Now field. + ''' + Public Sub SetSm4NowFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.Sm4NowColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.Sm4Now field. + ''' + Public Sub SetSm4NowFieldValue(ByVal val As Double) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.Sm4NowColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.Sm4Now field. + ''' + Public Sub SetSm4NowFieldValue(ByVal val As Decimal) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.Sm4NowColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.Sm4Now field. + ''' + Public Sub SetSm4NowFieldValue(ByVal val As Int64) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.Sm4NowColumn) + End Sub + ''' + ''' This is a convenience method that provides direct access to the value of the record's Section_.Pvtst field. + ''' + Public Function GetPvtstValue() As ColumnValue + Return Me.GetValue(TableUtils.PvtstColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's Section_.Pvtst field. + ''' + Public Function GetPvtstFieldValue() As Int16 + Return CType(Me.GetValue(TableUtils.PvtstColumn).ToInt16(), Int16) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.Pvtst field. + ''' + Public Sub SetPvtstFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.PvtstColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.Pvtst field. + ''' + Public Sub SetPvtstFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.PvtstColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.Pvtst field. + ''' + Public Sub SetPvtstFieldValue(ByVal val As Double) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.PvtstColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.Pvtst field. + ''' + Public Sub SetPvtstFieldValue(ByVal val As Decimal) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.PvtstColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.Pvtst field. + ''' + Public Sub SetPvtstFieldValue(ByVal val As Int64) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.PvtstColumn) + End Sub + ''' + ''' This is a convenience method that provides direct access to the value of the record's Section_.Pvtnd field. + ''' + Public Function GetPvtndValue() As ColumnValue + Return Me.GetValue(TableUtils.PvtndColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's Section_.Pvtnd field. + ''' + Public Function GetPvtndFieldValue() As Int16 + Return CType(Me.GetValue(TableUtils.PvtndColumn).ToInt16(), Int16) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.Pvtnd field. + ''' + Public Sub SetPvtndFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.PvtndColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.Pvtnd field. + ''' + Public Sub SetPvtndFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.PvtndColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.Pvtnd field. + ''' + Public Sub SetPvtndFieldValue(ByVal val As Double) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.PvtndColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.Pvtnd field. + ''' + Public Sub SetPvtndFieldValue(ByVal val As Decimal) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.PvtndColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.Pvtnd field. + ''' + Public Sub SetPvtndFieldValue(ByVal val As Int64) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.PvtndColumn) + End Sub + ''' + ''' This is a convenience method that provides direct access to the value of the record's Section_.EmpFull field. + ''' + Public Function GetEmpFullValue() As ColumnValue + Return Me.GetValue(TableUtils.EmpFullColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's Section_.EmpFull field. + ''' + Public Function GetEmpFullFieldValue() As Int16 + Return CType(Me.GetValue(TableUtils.EmpFullColumn).ToInt16(), Int16) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.EmpFull field. + ''' + Public Sub SetEmpFullFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.EmpFullColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.EmpFull field. + ''' + Public Sub SetEmpFullFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.EmpFullColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.EmpFull field. + ''' + Public Sub SetEmpFullFieldValue(ByVal val As Double) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.EmpFullColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.EmpFull field. + ''' + Public Sub SetEmpFullFieldValue(ByVal val As Decimal) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.EmpFullColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.EmpFull field. + ''' + Public Sub SetEmpFullFieldValue(ByVal val As Int64) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.EmpFullColumn) + End Sub + ''' + ''' This is a convenience method that provides direct access to the value of the record's Section_.Emp field. + ''' + Public Function GetEmpValue() As ColumnValue + Return Me.GetValue(TableUtils.EmpColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's Section_.Emp field. + ''' + Public Function GetEmpFieldValue() As Int16 + Return CType(Me.GetValue(TableUtils.EmpColumn).ToInt16(), Int16) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.Emp field. + ''' + Public Sub SetEmpFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.EmpColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.Emp field. + ''' + Public Sub SetEmpFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.EmpColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.Emp field. + ''' + Public Sub SetEmpFieldValue(ByVal val As Double) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.EmpColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.Emp field. + ''' + Public Sub SetEmpFieldValue(ByVal val As Decimal) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.EmpColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.Emp field. + ''' + Public Sub SetEmpFieldValue(ByVal val As Int64) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.EmpColumn) + End Sub + ''' + ''' This is a convenience method that provides direct access to the value of the record's Section_.EmpOffFull field. + ''' + Public Function GetEmpOffFullValue() As ColumnValue + Return Me.GetValue(TableUtils.EmpOffFullColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's Section_.EmpOffFull field. + ''' + Public Function GetEmpOffFullFieldValue() As Int16 + Return CType(Me.GetValue(TableUtils.EmpOffFullColumn).ToInt16(), Int16) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.EmpOffFull field. + ''' + Public Sub SetEmpOffFullFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.EmpOffFullColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.EmpOffFull field. + ''' + Public Sub SetEmpOffFullFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.EmpOffFullColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.EmpOffFull field. + ''' + Public Sub SetEmpOffFullFieldValue(ByVal val As Double) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.EmpOffFullColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.EmpOffFull field. + ''' + Public Sub SetEmpOffFullFieldValue(ByVal val As Decimal) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.EmpOffFullColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.EmpOffFull field. + ''' + Public Sub SetEmpOffFullFieldValue(ByVal val As Int64) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.EmpOffFullColumn) + End Sub + ''' + ''' This is a convenience method that provides direct access to the value of the record's Section_.EmpOff field. + ''' + Public Function GetEmpOffValue() As ColumnValue + Return Me.GetValue(TableUtils.EmpOffColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's Section_.EmpOff field. + ''' + Public Function GetEmpOffFieldValue() As Int16 + Return CType(Me.GetValue(TableUtils.EmpOffColumn).ToInt16(), Int16) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.EmpOff field. + ''' + Public Sub SetEmpOffFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.EmpOffColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.EmpOff field. + ''' + Public Sub SetEmpOffFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.EmpOffColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.EmpOff field. + ''' + Public Sub SetEmpOffFieldValue(ByVal val As Double) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.EmpOffColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.EmpOff field. + ''' + Public Sub SetEmpOffFieldValue(ByVal val As Decimal) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.EmpOffColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.EmpOff field. + ''' + Public Sub SetEmpOffFieldValue(ByVal val As Int64) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.EmpOffColumn) + End Sub + ''' + ''' This is a convenience method that provides direct access to the value of the record's Section_.EmpTmpFull field. + ''' + Public Function GetEmpTmpFullValue() As ColumnValue + Return Me.GetValue(TableUtils.EmpTmpFullColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's Section_.EmpTmpFull field. + ''' + Public Function GetEmpTmpFullFieldValue() As Int16 + Return CType(Me.GetValue(TableUtils.EmpTmpFullColumn).ToInt16(), Int16) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.EmpTmpFull field. + ''' + Public Sub SetEmpTmpFullFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.EmpTmpFullColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.EmpTmpFull field. + ''' + Public Sub SetEmpTmpFullFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.EmpTmpFullColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.EmpTmpFull field. + ''' + Public Sub SetEmpTmpFullFieldValue(ByVal val As Double) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.EmpTmpFullColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.EmpTmpFull field. + ''' + Public Sub SetEmpTmpFullFieldValue(ByVal val As Decimal) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.EmpTmpFullColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.EmpTmpFull field. + ''' + Public Sub SetEmpTmpFullFieldValue(ByVal val As Int64) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.EmpTmpFullColumn) + End Sub + ''' + ''' This is a convenience method that provides direct access to the value of the record's Section_.EmpTmp field. + ''' + Public Function GetEmpTmpValue() As ColumnValue + Return Me.GetValue(TableUtils.EmpTmpColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's Section_.EmpTmp field. + ''' + Public Function GetEmpTmpFieldValue() As Int16 + Return CType(Me.GetValue(TableUtils.EmpTmpColumn).ToInt16(), Int16) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.EmpTmp field. + ''' + Public Sub SetEmpTmpFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.EmpTmpColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.EmpTmp field. + ''' + Public Sub SetEmpTmpFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.EmpTmpColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.EmpTmp field. + ''' + Public Sub SetEmpTmpFieldValue(ByVal val As Double) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.EmpTmpColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.EmpTmp field. + ''' + Public Sub SetEmpTmpFieldValue(ByVal val As Decimal) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.EmpTmpColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Section_.EmpTmp field. + ''' + Public Sub SetEmpTmpFieldValue(ByVal val As Int64) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.EmpTmpColumn) + End Sub + + +#End Region + +#Region "Convenience methods to get field names" + + ''' + ''' This is a convenience property that provides direct access to the value of the record's Section_.SectionId field. + ''' + Public Property SectionId() As Int16 + Get + Return CType(Me.GetValue(TableUtils.SectionIdColumn).ToInt16(), Int16) + End Get + Set (ByVal val As Int16) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.SectionIdColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property SectionIdSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.SectionIdColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property SectionIdDefault() As String + Get + Return TableUtils.SectionIdColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's Section_.SectionName field. + ''' + Public Property SectionName() As String + Get + Return CType(Me.GetValue(TableUtils.SectionNameColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.SectionNameColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property SectionNameSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.SectionNameColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property SectionNameDefault() As String + Get + Return TableUtils.SectionNameColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's Section_.SectionAbbvrName field. + ''' + Public Property SectionAbbvrName() As String + Get + Return CType(Me.GetValue(TableUtils.SectionAbbvrNameColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.SectionAbbvrNameColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property SectionAbbvrNameSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.SectionAbbvrNameColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property SectionAbbvrNameDefault() As String + Get + Return TableUtils.SectionAbbvrNameColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's Section_.SectionEName field. + ''' + Public Property SectionEName() As String + Get + Return CType(Me.GetValue(TableUtils.SectionENameColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.SectionENameColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property SectionENameSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.SectionENameColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property SectionENameDefault() As String + Get + Return TableUtils.SectionENameColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's Section_.MarshallFull field. + ''' + Public Property MarshallFull() As Int16 + Get + Return CType(Me.GetValue(TableUtils.MarshallFullColumn).ToInt16(), Int16) + End Get + Set (ByVal val As Int16) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.MarshallFullColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property MarshallFullSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.MarshallFullColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property MarshallFullDefault() As String + Get + Return TableUtils.MarshallFullColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's Section_.MarShall field. + ''' + Public Property MarShall() As Int16 + Get + Return CType(Me.GetValue(TableUtils.MarShallColumn).ToInt16(), Int16) + End Get + Set (ByVal val As Int16) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.MarShallColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property MarShallSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.MarShallColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property MarShallDefault() As String + Get + Return TableUtils.MarShallColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's Section_.GeneralFull field. + ''' + Public Property GeneralFull() As Int16 + Get + Return CType(Me.GetValue(TableUtils.GeneralFullColumn).ToInt16(), Int16) + End Get + Set (ByVal val As Int16) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.GeneralFullColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property GeneralFullSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.GeneralFullColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property GeneralFullDefault() As String + Get + Return TableUtils.GeneralFullColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's Section_.General field. + ''' + Public Property General() As Int16 + Get + Return CType(Me.GetValue(TableUtils.GeneralColumn).ToInt16(), Int16) + End Get + Set (ByVal val As Int16) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.GeneralColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property GeneralSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.GeneralColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property GeneralDefault() As String + Get + Return TableUtils.GeneralColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's Section_.LtGeneralFull field. + ''' + Public Property LtGeneralFull() As Int16 + Get + Return CType(Me.GetValue(TableUtils.LtGeneralFullColumn).ToInt16(), Int16) + End Get + Set (ByVal val As Int16) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.LtGeneralFullColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property LtGeneralFullSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.LtGeneralFullColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property LtGeneralFullDefault() As String + Get + Return TableUtils.LtGeneralFullColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's Section_.LtGeneral field. + ''' + Public Property LtGeneral() As Int16 + Get + Return CType(Me.GetValue(TableUtils.LtGeneralColumn).ToInt16(), Int16) + End Get + Set (ByVal val As Int16) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.LtGeneralColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property LtGeneralSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.LtGeneralColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property LtGeneralDefault() As String + Get + Return TableUtils.LtGeneralColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's Section_.MjGeneralFull field. + ''' + Public Property MjGeneralFull() As Int16 + Get + Return CType(Me.GetValue(TableUtils.MjGeneralFullColumn).ToInt16(), Int16) + End Get + Set (ByVal val As Int16) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.MjGeneralFullColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property MjGeneralFullSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.MjGeneralFullColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property MjGeneralFullDefault() As String + Get + Return TableUtils.MjGeneralFullColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's Section_.MjGeneral field. + ''' + Public Property MjGeneral() As Int16 + Get + Return CType(Me.GetValue(TableUtils.MjGeneralColumn).ToInt16(), Int16) + End Get + Set (ByVal val As Int16) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.MjGeneralColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property MjGeneralSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.MjGeneralColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property MjGeneralDefault() As String + Get + Return TableUtils.MjGeneralColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's Section_.SpColonelFull field. + ''' + Public Property SpColonelFull() As Int16 + Get + Return CType(Me.GetValue(TableUtils.SpColonelFullColumn).ToInt16(), Int16) + End Get + Set (ByVal val As Int16) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.SpColonelFullColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property SpColonelFullSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.SpColonelFullColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property SpColonelFullDefault() As String + Get + Return TableUtils.SpColonelFullColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's Section_.SpColonel field. + ''' + Public Property SpColonel() As Int16 + Get + Return CType(Me.GetValue(TableUtils.SpColonelColumn).ToInt16(), Int16) + End Get + Set (ByVal val As Int16) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.SpColonelColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property SpColonelSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.SpColonelColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property SpColonelDefault() As String + Get + Return TableUtils.SpColonelColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's Section_.ColonelFull field. + ''' + Public Property ColonelFull() As Int16 + Get + Return CType(Me.GetValue(TableUtils.ColonelFullColumn).ToInt16(), Int16) + End Get + Set (ByVal val As Int16) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.ColonelFullColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property ColonelFullSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.ColonelFullColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property ColonelFullDefault() As String + Get + Return TableUtils.ColonelFullColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's Section_.Colonel field. + ''' + Public Property Colonel() As Int16 + Get + Return CType(Me.GetValue(TableUtils.ColonelColumn).ToInt16(), Int16) + End Get + Set (ByVal val As Int16) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.ColonelColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property ColonelSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.ColonelColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property ColonelDefault() As String + Get + Return TableUtils.ColonelColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's Section_.LtColonelFull field. + ''' + Public Property LtColonelFull() As Int16 + Get + Return CType(Me.GetValue(TableUtils.LtColonelFullColumn).ToInt16(), Int16) + End Get + Set (ByVal val As Int16) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.LtColonelFullColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property LtColonelFullSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.LtColonelFullColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property LtColonelFullDefault() As String + Get + Return TableUtils.LtColonelFullColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's Section_.LtColonel field. + ''' + Public Property LtColonel() As Int16 + Get + Return CType(Me.GetValue(TableUtils.LtColonelColumn).ToInt16(), Int16) + End Get + Set (ByVal val As Int16) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.LtColonelColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property LtColonelSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.LtColonelColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property LtColonelDefault() As String + Get + Return TableUtils.LtColonelColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's Section_.MajorFull field. + ''' + Public Property MajorFull() As Int16 + Get + Return CType(Me.GetValue(TableUtils.MajorFullColumn).ToInt16(), Int16) + End Get + Set (ByVal val As Int16) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.MajorFullColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property MajorFullSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.MajorFullColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property MajorFullDefault() As String + Get + Return TableUtils.MajorFullColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's Section_.Major field. + ''' + Public Property Major() As Int16 + Get + Return CType(Me.GetValue(TableUtils.MajorColumn).ToInt16(), Int16) + End Get + Set (ByVal val As Int16) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.MajorColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property MajorSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.MajorColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property MajorDefault() As String + Get + Return TableUtils.MajorColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's Section_.CaptianFull field. + ''' + Public Property CaptianFull() As Int16 + Get + Return CType(Me.GetValue(TableUtils.CaptianFullColumn).ToInt16(), Int16) + End Get + Set (ByVal val As Int16) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.CaptianFullColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property CaptianFullSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.CaptianFullColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property CaptianFullDefault() As String + Get + Return TableUtils.CaptianFullColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's Section_.Captian field. + ''' + Public Property Captian() As Int16 + Get + Return CType(Me.GetValue(TableUtils.CaptianColumn).ToInt16(), Int16) + End Get + Set (ByVal val As Int16) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.CaptianColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property CaptianSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.CaptianColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property CaptianDefault() As String + Get + Return TableUtils.CaptianColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's Section_.LieutenantFull field. + ''' + Public Property LieutenantFull() As Int16 + Get + Return CType(Me.GetValue(TableUtils.LieutenantFullColumn).ToInt16(), Int16) + End Get + Set (ByVal val As Int16) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.LieutenantFullColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property LieutenantFullSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.LieutenantFullColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property LieutenantFullDefault() As String + Get + Return TableUtils.LieutenantFullColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's Section_.Lieutenant field. + ''' + Public Property Lieutenant() As Int16 + Get + Return CType(Me.GetValue(TableUtils.LieutenantColumn).ToInt16(), Int16) + End Get + Set (ByVal val As Int16) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.LieutenantColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property LieutenantSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.LieutenantColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property LieutenantDefault() As String + Get + Return TableUtils.LieutenantColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's Section_.SubLieutenantFull field. + ''' + Public Property SubLieutenantFull() As Int16 + Get + Return CType(Me.GetValue(TableUtils.SubLieutenantFullColumn).ToInt16(), Int16) + End Get + Set (ByVal val As Int16) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.SubLieutenantFullColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property SubLieutenantFullSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.SubLieutenantFullColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property SubLieutenantFullDefault() As String + Get + Return TableUtils.SubLieutenantFullColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's Section_.SubLieutenant field. + ''' + Public Property SubLieutenant() As Int16 + Get + Return CType(Me.GetValue(TableUtils.SubLieutenantColumn).ToInt16(), Int16) + End Get + Set (ByVal val As Int16) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.SubLieutenantColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property SubLieutenantSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.SubLieutenantColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property SubLieutenantDefault() As String + Get + Return TableUtils.SubLieutenantColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's Section_.Sm0Full field. + ''' + Public Property Sm0Full() As Int16 + Get + Return CType(Me.GetValue(TableUtils.Sm0FullColumn).ToInt16(), Int16) + End Get + Set (ByVal val As Int16) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.Sm0FullColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property Sm0FullSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.Sm0FullColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property Sm0FullDefault() As String + Get + Return TableUtils.Sm0FullColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's Section_.Sm0 field. + ''' + Public Property Sm0() As Int16 + Get + Return CType(Me.GetValue(TableUtils.Sm0Column).ToInt16(), Int16) + End Get + Set (ByVal val As Int16) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.Sm0Column) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property Sm0Specified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.Sm0Column) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property Sm0Default() As String + Get + Return TableUtils.Sm0Column.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's Section_.Sm1Full field. + ''' + Public Property Sm1Full() As Int16 + Get + Return CType(Me.GetValue(TableUtils.Sm1FullColumn).ToInt16(), Int16) + End Get + Set (ByVal val As Int16) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.Sm1FullColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property Sm1FullSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.Sm1FullColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property Sm1FullDefault() As String + Get + Return TableUtils.Sm1FullColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's Section_.Sm1 field. + ''' + Public Property Sm1() As Int16 + Get + Return CType(Me.GetValue(TableUtils.Sm1Column).ToInt16(), Int16) + End Get + Set (ByVal val As Int16) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.Sm1Column) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property Sm1Specified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.Sm1Column) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property Sm1Default() As String + Get + Return TableUtils.Sm1Column.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's Section_.Sm2Full field. + ''' + Public Property Sm2Full() As Int16 + Get + Return CType(Me.GetValue(TableUtils.Sm2FullColumn).ToInt16(), Int16) + End Get + Set (ByVal val As Int16) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.Sm2FullColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property Sm2FullSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.Sm2FullColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property Sm2FullDefault() As String + Get + Return TableUtils.Sm2FullColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's Section_.Sm2 field. + ''' + Public Property Sm2() As Int16 + Get + Return CType(Me.GetValue(TableUtils.Sm2Column).ToInt16(), Int16) + End Get + Set (ByVal val As Int16) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.Sm2Column) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property Sm2Specified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.Sm2Column) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property Sm2Default() As String + Get + Return TableUtils.Sm2Column.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's Section_.Sm3Full field. + ''' + Public Property Sm3Full() As Int16 + Get + Return CType(Me.GetValue(TableUtils.Sm3FullColumn).ToInt16(), Int16) + End Get + Set (ByVal val As Int16) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.Sm3FullColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property Sm3FullSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.Sm3FullColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property Sm3FullDefault() As String + Get + Return TableUtils.Sm3FullColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's Section_.Sm3 field. + ''' + Public Property Sm3() As Int16 + Get + Return CType(Me.GetValue(TableUtils.Sm3Column).ToInt16(), Int16) + End Get + Set (ByVal val As Int16) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.Sm3Column) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property Sm3Specified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.Sm3Column) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property Sm3Default() As String + Get + Return TableUtils.Sm3Column.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's Section_.SgtFull field. + ''' + Public Property SgtFull() As Int16 + Get + Return CType(Me.GetValue(TableUtils.SgtFullColumn).ToInt16(), Int16) + End Get + Set (ByVal val As Int16) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.SgtFullColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property SgtFullSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.SgtFullColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property SgtFullDefault() As String + Get + Return TableUtils.SgtFullColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's Section_.Sgt field. + ''' + Public Property Sgt() As Int16 + Get + Return CType(Me.GetValue(TableUtils.SgtColumn).ToInt16(), Int16) + End Get + Set (ByVal val As Int16) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.SgtColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property SgtSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.SgtColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property SgtDefault() As String + Get + Return TableUtils.SgtColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's Section_.CptFull field. + ''' + Public Property CptFull() As Int16 + Get + Return CType(Me.GetValue(TableUtils.CptFullColumn).ToInt16(), Int16) + End Get + Set (ByVal val As Int16) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.CptFullColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property CptFullSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.CptFullColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property CptFullDefault() As String + Get + Return TableUtils.CptFullColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's Section_.Cpt field. + ''' + Public Property Cpt() As Int16 + Get + Return CType(Me.GetValue(TableUtils.CptColumn).ToInt16(), Int16) + End Get + Set (ByVal val As Int16) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.CptColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property CptSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.CptColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property CptDefault() As String + Get + Return TableUtils.CptColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's Section_.PtcFull field. + ''' + Public Property PtcFull() As Int16 + Get + Return CType(Me.GetValue(TableUtils.PtcFullColumn).ToInt16(), Int16) + End Get + Set (ByVal val As Int16) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.PtcFullColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property PtcFullSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.PtcFullColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property PtcFullDefault() As String + Get + Return TableUtils.PtcFullColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's Section_.Ptc field. + ''' + Public Property Ptc() As Int16 + Get + Return CType(Me.GetValue(TableUtils.PtcColumn).ToInt16(), Int16) + End Get + Set (ByVal val As Int16) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.PtcColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property PtcSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.PtcColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property PtcDefault() As String + Get + Return TableUtils.PtcColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's Section_.PvtVolFull field. + ''' + Public Property PvtVolFull() As Int16 + Get + Return CType(Me.GetValue(TableUtils.PvtVolFullColumn).ToInt16(), Int16) + End Get + Set (ByVal val As Int16) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.PvtVolFullColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property PvtVolFullSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.PvtVolFullColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property PvtVolFullDefault() As String + Get + Return TableUtils.PvtVolFullColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's Section_.PvtVol field. + ''' + Public Property PvtVol() As Int16 + Get + Return CType(Me.GetValue(TableUtils.PvtVolColumn).ToInt16(), Int16) + End Get + Set (ByVal val As Int16) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.PvtVolColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property PvtVolSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.PvtVolColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property PvtVolDefault() As String + Get + Return TableUtils.PvtVolColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's Section_.Sm4Full field. + ''' + Public Property Sm4Full() As Int16 + Get + Return CType(Me.GetValue(TableUtils.Sm4FullColumn).ToInt16(), Int16) + End Get + Set (ByVal val As Int16) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.Sm4FullColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property Sm4FullSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.Sm4FullColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property Sm4FullDefault() As String + Get + Return TableUtils.Sm4FullColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's Section_.Sm4 field. + ''' + Public Property Sm4() As Int16 + Get + Return CType(Me.GetValue(TableUtils.Sm4Column).ToInt16(), Int16) + End Get + Set (ByVal val As Int16) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.Sm4Column) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property Sm4Specified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.Sm4Column) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property Sm4Default() As String + Get + Return TableUtils.Sm4Column.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's Section_.PvtFull field. + ''' + Public Property PvtFull() As Int16 + Get + Return CType(Me.GetValue(TableUtils.PvtFullColumn).ToInt16(), Int16) + End Get + Set (ByVal val As Int16) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.PvtFullColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property PvtFullSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.PvtFullColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property PvtFullDefault() As String + Get + Return TableUtils.PvtFullColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's Section_.Pvt field. + ''' + Public Property Pvt() As Int16 + Get + Return CType(Me.GetValue(TableUtils.PvtColumn).ToInt16(), Int16) + End Get + Set (ByVal val As Int16) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.PvtColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property PvtSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.PvtColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property PvtDefault() As String + Get + Return TableUtils.PvtColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's Section_.Sm4Now field. + ''' + Public Property Sm4Now() As Int16 + Get + Return CType(Me.GetValue(TableUtils.Sm4NowColumn).ToInt16(), Int16) + End Get + Set (ByVal val As Int16) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.Sm4NowColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property Sm4NowSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.Sm4NowColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property Sm4NowDefault() As String + Get + Return TableUtils.Sm4NowColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's Section_.Pvtst field. + ''' + Public Property Pvtst() As Int16 + Get + Return CType(Me.GetValue(TableUtils.PvtstColumn).ToInt16(), Int16) + End Get + Set (ByVal val As Int16) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.PvtstColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property PvtstSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.PvtstColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property PvtstDefault() As String + Get + Return TableUtils.PvtstColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's Section_.Pvtnd field. + ''' + Public Property Pvtnd() As Int16 + Get + Return CType(Me.GetValue(TableUtils.PvtndColumn).ToInt16(), Int16) + End Get + Set (ByVal val As Int16) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.PvtndColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property PvtndSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.PvtndColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property PvtndDefault() As String + Get + Return TableUtils.PvtndColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's Section_.EmpFull field. + ''' + Public Property EmpFull() As Int16 + Get + Return CType(Me.GetValue(TableUtils.EmpFullColumn).ToInt16(), Int16) + End Get + Set (ByVal val As Int16) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.EmpFullColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property EmpFullSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.EmpFullColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property EmpFullDefault() As String + Get + Return TableUtils.EmpFullColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's Section_.Emp field. + ''' + Public Property Emp() As Int16 + Get + Return CType(Me.GetValue(TableUtils.EmpColumn).ToInt16(), Int16) + End Get + Set (ByVal val As Int16) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.EmpColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property EmpSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.EmpColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property EmpDefault() As String + Get + Return TableUtils.EmpColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's Section_.EmpOffFull field. + ''' + Public Property EmpOffFull() As Int16 + Get + Return CType(Me.GetValue(TableUtils.EmpOffFullColumn).ToInt16(), Int16) + End Get + Set (ByVal val As Int16) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.EmpOffFullColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property EmpOffFullSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.EmpOffFullColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property EmpOffFullDefault() As String + Get + Return TableUtils.EmpOffFullColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's Section_.EmpOff field. + ''' + Public Property EmpOff() As Int16 + Get + Return CType(Me.GetValue(TableUtils.EmpOffColumn).ToInt16(), Int16) + End Get + Set (ByVal val As Int16) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.EmpOffColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property EmpOffSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.EmpOffColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property EmpOffDefault() As String + Get + Return TableUtils.EmpOffColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's Section_.EmpTmpFull field. + ''' + Public Property EmpTmpFull() As Int16 + Get + Return CType(Me.GetValue(TableUtils.EmpTmpFullColumn).ToInt16(), Int16) + End Get + Set (ByVal val As Int16) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.EmpTmpFullColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property EmpTmpFullSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.EmpTmpFullColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property EmpTmpFullDefault() As String + Get + Return TableUtils.EmpTmpFullColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's Section_.EmpTmp field. + ''' + Public Property EmpTmp() As Int16 + Get + Return CType(Me.GetValue(TableUtils.EmpTmpColumn).ToInt16(), Int16) + End Get + Set (ByVal val As Int16) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.EmpTmpColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property EmpTmpSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.EmpTmpColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property EmpTmpDefault() As String + Get + Return TableUtils.EmpTmpColumn.DefaultValue + End Get + End Property + + + +#End Region + +End Class +End Namespace diff --git a/App_Code/Business Layer/BaseSectionTable.vb b/App_Code/Business Layer/BaseSectionTable.vb new file mode 100644 index 0000000..2c8f465 --- /dev/null +++ b/App_Code/Business Layer/BaseSectionTable.vb @@ -0,0 +1,1944 @@ +' This class is "generated" and will be overwritten. +' Your customizations should be made in SectionRecord.vb + +Imports System.Data.SqlTypes +Imports System.Data +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider +Imports Persons.Data + +Namespace Persons.Business + +''' +''' The generated superclass for the class. +''' Provides access to the schema information and record data of a database table or view named Section. +''' +''' +''' The connection details (name, location, etc.) of the database and table (or view) accessed by this class +''' are resolved at runtime based on the connection string in the application's Web.Config file. +''' +''' This class is not intended to be instantiated directly. To obtain an instance of this class, use +''' SectionTable.Instance. +''' +''' +''' + + Public Class BaseSectionTable + Inherits PrimaryKeyTable + + + Private ReadOnly TableDefinitionString As String = SectionDefinition.GetXMLString() + + + + + + + + Protected Sub New() + MyBase.New() + Me.Initialize() + End Sub + + Protected Overridable Sub Initialize() + Dim def As New XmlTableDefinition(TableDefinitionString) + Me.TableDefinition = New TableDefinition() + Me.TableDefinition.TableClassName = System.Reflection.Assembly.CreateQualifiedName("App_Code", "Persons.Business.SectionTable") + def.InitializeTableDefinition(Me.TableDefinition) + Me.ConnectionName = def.GetConnectionName() + Me.RecordClassName = System.Reflection.Assembly.CreateQualifiedName("App_Code", "Persons.Business.SectionRecord") + Me.ApplicationName = "App_Code" + Me.DataAdapter = New SectionSqlTable() + Directcast(Me.DataAdapter, SectionSqlTable).ConnectionName = Me.ConnectionName + + Me.TableDefinition.AdapterMetaData = Me.DataAdapter.AdapterMetaData + SectionIdColumn.CodeName = "SectionId" + SectionNameColumn.CodeName = "SectionName" + SectionAbbvrNameColumn.CodeName = "SectionAbbvrName" + SectionENameColumn.CodeName = "SectionEName" + MarshallFullColumn.CodeName = "MarshallFull" + MarShallColumn.CodeName = "MarShall" + GeneralFullColumn.CodeName = "GeneralFull" + GeneralColumn.CodeName = "General" + LtGeneralFullColumn.CodeName = "LtGeneralFull" + LtGeneralColumn.CodeName = "LtGeneral" + MjGeneralFullColumn.CodeName = "MjGeneralFull" + MjGeneralColumn.CodeName = "MjGeneral" + SpColonelFullColumn.CodeName = "SpColonelFull" + SpColonelColumn.CodeName = "SpColonel" + ColonelFullColumn.CodeName = "ColonelFull" + ColonelColumn.CodeName = "Colonel" + LtColonelFullColumn.CodeName = "LtColonelFull" + LtColonelColumn.CodeName = "LtColonel" + MajorFullColumn.CodeName = "MajorFull" + MajorColumn.CodeName = "Major" + CaptianFullColumn.CodeName = "CaptianFull" + CaptianColumn.CodeName = "Captian" + LieutenantFullColumn.CodeName = "LieutenantFull" + LieutenantColumn.CodeName = "Lieutenant" + SubLieutenantFullColumn.CodeName = "SubLieutenantFull" + SubLieutenantColumn.CodeName = "SubLieutenant" + Sm0FullColumn.CodeName = "Sm0Full" + Sm0Column.CodeName = "Sm0" + Sm1FullColumn.CodeName = "Sm1Full" + Sm1Column.CodeName = "Sm1" + Sm2FullColumn.CodeName = "Sm2Full" + Sm2Column.CodeName = "Sm2" + Sm3FullColumn.CodeName = "Sm3Full" + Sm3Column.CodeName = "Sm3" + SgtFullColumn.CodeName = "SgtFull" + SgtColumn.CodeName = "Sgt" + CptFullColumn.CodeName = "CptFull" + CptColumn.CodeName = "Cpt" + PtcFullColumn.CodeName = "PtcFull" + PtcColumn.CodeName = "Ptc" + PvtVolFullColumn.CodeName = "PvtVolFull" + PvtVolColumn.CodeName = "PvtVol" + Sm4FullColumn.CodeName = "Sm4Full" + Sm4Column.CodeName = "Sm4" + PvtFullColumn.CodeName = "PvtFull" + PvtColumn.CodeName = "Pvt" + Sm4NowColumn.CodeName = "Sm4Now" + PvtstColumn.CodeName = "Pvtst" + PvtndColumn.CodeName = "Pvtnd" + EmpFullColumn.CodeName = "EmpFull" + EmpColumn.CodeName = "Emp" + EmpOffFullColumn.CodeName = "EmpOffFull" + EmpOffColumn.CodeName = "EmpOff" + EmpTmpFullColumn.CodeName = "EmpTmpFull" + EmpTmpColumn.CodeName = "EmpTmp" + + End Sub + +#Region "Overriden methods" + + +#End Region + +#Region "Properties for columns" + + ''' + ''' This is a convenience property that provides direct access to the table's Section_.SectionId column object. + ''' + Public ReadOnly Property SectionIdColumn() As BaseClasses.Data.NumberColumn + Get + Return CType(Me.TableDefinition.ColumnList(0), BaseClasses.Data.NumberColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's Section_.SectionId column object. + ''' + Public Shared ReadOnly Property SectionId() As BaseClasses.Data.NumberColumn + Get + Return SectionTable.Instance.SectionIdColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's Section_.SectionName column object. + ''' + Public ReadOnly Property SectionNameColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(1), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's Section_.SectionName column object. + ''' + Public Shared ReadOnly Property SectionName() As BaseClasses.Data.StringColumn + Get + Return SectionTable.Instance.SectionNameColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's Section_.SectionAbbvrName column object. + ''' + Public ReadOnly Property SectionAbbvrNameColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(2), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's Section_.SectionAbbvrName column object. + ''' + Public Shared ReadOnly Property SectionAbbvrName() As BaseClasses.Data.StringColumn + Get + Return SectionTable.Instance.SectionAbbvrNameColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's Section_.SectionEName column object. + ''' + Public ReadOnly Property SectionENameColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(3), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's Section_.SectionEName column object. + ''' + Public Shared ReadOnly Property SectionEName() As BaseClasses.Data.StringColumn + Get + Return SectionTable.Instance.SectionENameColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's Section_.MarshallFull column object. + ''' + Public ReadOnly Property MarshallFullColumn() As BaseClasses.Data.NumberColumn + Get + Return CType(Me.TableDefinition.ColumnList(4), BaseClasses.Data.NumberColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's Section_.MarshallFull column object. + ''' + Public Shared ReadOnly Property MarshallFull() As BaseClasses.Data.NumberColumn + Get + Return SectionTable.Instance.MarshallFullColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's Section_.MarShall column object. + ''' + Public ReadOnly Property MarShallColumn() As BaseClasses.Data.NumberColumn + Get + Return CType(Me.TableDefinition.ColumnList(5), BaseClasses.Data.NumberColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's Section_.MarShall column object. + ''' + Public Shared ReadOnly Property MarShall() As BaseClasses.Data.NumberColumn + Get + Return SectionTable.Instance.MarShallColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's Section_.GeneralFull column object. + ''' + Public ReadOnly Property GeneralFullColumn() As BaseClasses.Data.NumberColumn + Get + Return CType(Me.TableDefinition.ColumnList(6), BaseClasses.Data.NumberColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's Section_.GeneralFull column object. + ''' + Public Shared ReadOnly Property GeneralFull() As BaseClasses.Data.NumberColumn + Get + Return SectionTable.Instance.GeneralFullColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's Section_.General column object. + ''' + Public ReadOnly Property GeneralColumn() As BaseClasses.Data.NumberColumn + Get + Return CType(Me.TableDefinition.ColumnList(7), BaseClasses.Data.NumberColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's Section_.General column object. + ''' + Public Shared ReadOnly Property General() As BaseClasses.Data.NumberColumn + Get + Return SectionTable.Instance.GeneralColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's Section_.LtGeneralFull column object. + ''' + Public ReadOnly Property LtGeneralFullColumn() As BaseClasses.Data.NumberColumn + Get + Return CType(Me.TableDefinition.ColumnList(8), BaseClasses.Data.NumberColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's Section_.LtGeneralFull column object. + ''' + Public Shared ReadOnly Property LtGeneralFull() As BaseClasses.Data.NumberColumn + Get + Return SectionTable.Instance.LtGeneralFullColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's Section_.LtGeneral column object. + ''' + Public ReadOnly Property LtGeneralColumn() As BaseClasses.Data.NumberColumn + Get + Return CType(Me.TableDefinition.ColumnList(9), BaseClasses.Data.NumberColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's Section_.LtGeneral column object. + ''' + Public Shared ReadOnly Property LtGeneral() As BaseClasses.Data.NumberColumn + Get + Return SectionTable.Instance.LtGeneralColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's Section_.MjGeneralFull column object. + ''' + Public ReadOnly Property MjGeneralFullColumn() As BaseClasses.Data.NumberColumn + Get + Return CType(Me.TableDefinition.ColumnList(10), BaseClasses.Data.NumberColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's Section_.MjGeneralFull column object. + ''' + Public Shared ReadOnly Property MjGeneralFull() As BaseClasses.Data.NumberColumn + Get + Return SectionTable.Instance.MjGeneralFullColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's Section_.MjGeneral column object. + ''' + Public ReadOnly Property MjGeneralColumn() As BaseClasses.Data.NumberColumn + Get + Return CType(Me.TableDefinition.ColumnList(11), BaseClasses.Data.NumberColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's Section_.MjGeneral column object. + ''' + Public Shared ReadOnly Property MjGeneral() As BaseClasses.Data.NumberColumn + Get + Return SectionTable.Instance.MjGeneralColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's Section_.SpColonelFull column object. + ''' + Public ReadOnly Property SpColonelFullColumn() As BaseClasses.Data.NumberColumn + Get + Return CType(Me.TableDefinition.ColumnList(12), BaseClasses.Data.NumberColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's Section_.SpColonelFull column object. + ''' + Public Shared ReadOnly Property SpColonelFull() As BaseClasses.Data.NumberColumn + Get + Return SectionTable.Instance.SpColonelFullColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's Section_.SpColonel column object. + ''' + Public ReadOnly Property SpColonelColumn() As BaseClasses.Data.NumberColumn + Get + Return CType(Me.TableDefinition.ColumnList(13), BaseClasses.Data.NumberColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's Section_.SpColonel column object. + ''' + Public Shared ReadOnly Property SpColonel() As BaseClasses.Data.NumberColumn + Get + Return SectionTable.Instance.SpColonelColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's Section_.ColonelFull column object. + ''' + Public ReadOnly Property ColonelFullColumn() As BaseClasses.Data.NumberColumn + Get + Return CType(Me.TableDefinition.ColumnList(14), BaseClasses.Data.NumberColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's Section_.ColonelFull column object. + ''' + Public Shared ReadOnly Property ColonelFull() As BaseClasses.Data.NumberColumn + Get + Return SectionTable.Instance.ColonelFullColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's Section_.Colonel column object. + ''' + Public ReadOnly Property ColonelColumn() As BaseClasses.Data.NumberColumn + Get + Return CType(Me.TableDefinition.ColumnList(15), BaseClasses.Data.NumberColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's Section_.Colonel column object. + ''' + Public Shared ReadOnly Property Colonel() As BaseClasses.Data.NumberColumn + Get + Return SectionTable.Instance.ColonelColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's Section_.LtColonelFull column object. + ''' + Public ReadOnly Property LtColonelFullColumn() As BaseClasses.Data.NumberColumn + Get + Return CType(Me.TableDefinition.ColumnList(16), BaseClasses.Data.NumberColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's Section_.LtColonelFull column object. + ''' + Public Shared ReadOnly Property LtColonelFull() As BaseClasses.Data.NumberColumn + Get + Return SectionTable.Instance.LtColonelFullColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's Section_.LtColonel column object. + ''' + Public ReadOnly Property LtColonelColumn() As BaseClasses.Data.NumberColumn + Get + Return CType(Me.TableDefinition.ColumnList(17), BaseClasses.Data.NumberColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's Section_.LtColonel column object. + ''' + Public Shared ReadOnly Property LtColonel() As BaseClasses.Data.NumberColumn + Get + Return SectionTable.Instance.LtColonelColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's Section_.MajorFull column object. + ''' + Public ReadOnly Property MajorFullColumn() As BaseClasses.Data.NumberColumn + Get + Return CType(Me.TableDefinition.ColumnList(18), BaseClasses.Data.NumberColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's Section_.MajorFull column object. + ''' + Public Shared ReadOnly Property MajorFull() As BaseClasses.Data.NumberColumn + Get + Return SectionTable.Instance.MajorFullColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's Section_.Major column object. + ''' + Public ReadOnly Property MajorColumn() As BaseClasses.Data.NumberColumn + Get + Return CType(Me.TableDefinition.ColumnList(19), BaseClasses.Data.NumberColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's Section_.Major column object. + ''' + Public Shared ReadOnly Property Major() As BaseClasses.Data.NumberColumn + Get + Return SectionTable.Instance.MajorColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's Section_.CaptianFull column object. + ''' + Public ReadOnly Property CaptianFullColumn() As BaseClasses.Data.NumberColumn + Get + Return CType(Me.TableDefinition.ColumnList(20), BaseClasses.Data.NumberColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's Section_.CaptianFull column object. + ''' + Public Shared ReadOnly Property CaptianFull() As BaseClasses.Data.NumberColumn + Get + Return SectionTable.Instance.CaptianFullColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's Section_.Captian column object. + ''' + Public ReadOnly Property CaptianColumn() As BaseClasses.Data.NumberColumn + Get + Return CType(Me.TableDefinition.ColumnList(21), BaseClasses.Data.NumberColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's Section_.Captian column object. + ''' + Public Shared ReadOnly Property Captian() As BaseClasses.Data.NumberColumn + Get + Return SectionTable.Instance.CaptianColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's Section_.LieutenantFull column object. + ''' + Public ReadOnly Property LieutenantFullColumn() As BaseClasses.Data.NumberColumn + Get + Return CType(Me.TableDefinition.ColumnList(22), BaseClasses.Data.NumberColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's Section_.LieutenantFull column object. + ''' + Public Shared ReadOnly Property LieutenantFull() As BaseClasses.Data.NumberColumn + Get + Return SectionTable.Instance.LieutenantFullColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's Section_.Lieutenant column object. + ''' + Public ReadOnly Property LieutenantColumn() As BaseClasses.Data.NumberColumn + Get + Return CType(Me.TableDefinition.ColumnList(23), BaseClasses.Data.NumberColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's Section_.Lieutenant column object. + ''' + Public Shared ReadOnly Property Lieutenant() As BaseClasses.Data.NumberColumn + Get + Return SectionTable.Instance.LieutenantColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's Section_.SubLieutenantFull column object. + ''' + Public ReadOnly Property SubLieutenantFullColumn() As BaseClasses.Data.NumberColumn + Get + Return CType(Me.TableDefinition.ColumnList(24), BaseClasses.Data.NumberColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's Section_.SubLieutenantFull column object. + ''' + Public Shared ReadOnly Property SubLieutenantFull() As BaseClasses.Data.NumberColumn + Get + Return SectionTable.Instance.SubLieutenantFullColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's Section_.SubLieutenant column object. + ''' + Public ReadOnly Property SubLieutenantColumn() As BaseClasses.Data.NumberColumn + Get + Return CType(Me.TableDefinition.ColumnList(25), BaseClasses.Data.NumberColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's Section_.SubLieutenant column object. + ''' + Public Shared ReadOnly Property SubLieutenant() As BaseClasses.Data.NumberColumn + Get + Return SectionTable.Instance.SubLieutenantColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's Section_.Sm0Full column object. + ''' + Public ReadOnly Property Sm0FullColumn() As BaseClasses.Data.NumberColumn + Get + Return CType(Me.TableDefinition.ColumnList(26), BaseClasses.Data.NumberColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's Section_.Sm0Full column object. + ''' + Public Shared ReadOnly Property Sm0Full() As BaseClasses.Data.NumberColumn + Get + Return SectionTable.Instance.Sm0FullColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's Section_.Sm0 column object. + ''' + Public ReadOnly Property Sm0Column() As BaseClasses.Data.NumberColumn + Get + Return CType(Me.TableDefinition.ColumnList(27), BaseClasses.Data.NumberColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's Section_.Sm0 column object. + ''' + Public Shared ReadOnly Property Sm0() As BaseClasses.Data.NumberColumn + Get + Return SectionTable.Instance.Sm0Column + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's Section_.Sm1Full column object. + ''' + Public ReadOnly Property Sm1FullColumn() As BaseClasses.Data.NumberColumn + Get + Return CType(Me.TableDefinition.ColumnList(28), BaseClasses.Data.NumberColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's Section_.Sm1Full column object. + ''' + Public Shared ReadOnly Property Sm1Full() As BaseClasses.Data.NumberColumn + Get + Return SectionTable.Instance.Sm1FullColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's Section_.Sm1 column object. + ''' + Public ReadOnly Property Sm1Column() As BaseClasses.Data.NumberColumn + Get + Return CType(Me.TableDefinition.ColumnList(29), BaseClasses.Data.NumberColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's Section_.Sm1 column object. + ''' + Public Shared ReadOnly Property Sm1() As BaseClasses.Data.NumberColumn + Get + Return SectionTable.Instance.Sm1Column + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's Section_.Sm2Full column object. + ''' + Public ReadOnly Property Sm2FullColumn() As BaseClasses.Data.NumberColumn + Get + Return CType(Me.TableDefinition.ColumnList(30), BaseClasses.Data.NumberColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's Section_.Sm2Full column object. + ''' + Public Shared ReadOnly Property Sm2Full() As BaseClasses.Data.NumberColumn + Get + Return SectionTable.Instance.Sm2FullColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's Section_.Sm2 column object. + ''' + Public ReadOnly Property Sm2Column() As BaseClasses.Data.NumberColumn + Get + Return CType(Me.TableDefinition.ColumnList(31), BaseClasses.Data.NumberColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's Section_.Sm2 column object. + ''' + Public Shared ReadOnly Property Sm2() As BaseClasses.Data.NumberColumn + Get + Return SectionTable.Instance.Sm2Column + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's Section_.Sm3Full column object. + ''' + Public ReadOnly Property Sm3FullColumn() As BaseClasses.Data.NumberColumn + Get + Return CType(Me.TableDefinition.ColumnList(32), BaseClasses.Data.NumberColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's Section_.Sm3Full column object. + ''' + Public Shared ReadOnly Property Sm3Full() As BaseClasses.Data.NumberColumn + Get + Return SectionTable.Instance.Sm3FullColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's Section_.Sm3 column object. + ''' + Public ReadOnly Property Sm3Column() As BaseClasses.Data.NumberColumn + Get + Return CType(Me.TableDefinition.ColumnList(33), BaseClasses.Data.NumberColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's Section_.Sm3 column object. + ''' + Public Shared ReadOnly Property Sm3() As BaseClasses.Data.NumberColumn + Get + Return SectionTable.Instance.Sm3Column + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's Section_.SgtFull column object. + ''' + Public ReadOnly Property SgtFullColumn() As BaseClasses.Data.NumberColumn + Get + Return CType(Me.TableDefinition.ColumnList(34), BaseClasses.Data.NumberColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's Section_.SgtFull column object. + ''' + Public Shared ReadOnly Property SgtFull() As BaseClasses.Data.NumberColumn + Get + Return SectionTable.Instance.SgtFullColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's Section_.Sgt column object. + ''' + Public ReadOnly Property SgtColumn() As BaseClasses.Data.NumberColumn + Get + Return CType(Me.TableDefinition.ColumnList(35), BaseClasses.Data.NumberColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's Section_.Sgt column object. + ''' + Public Shared ReadOnly Property Sgt() As BaseClasses.Data.NumberColumn + Get + Return SectionTable.Instance.SgtColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's Section_.CptFull column object. + ''' + Public ReadOnly Property CptFullColumn() As BaseClasses.Data.NumberColumn + Get + Return CType(Me.TableDefinition.ColumnList(36), BaseClasses.Data.NumberColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's Section_.CptFull column object. + ''' + Public Shared ReadOnly Property CptFull() As BaseClasses.Data.NumberColumn + Get + Return SectionTable.Instance.CptFullColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's Section_.Cpt column object. + ''' + Public ReadOnly Property CptColumn() As BaseClasses.Data.NumberColumn + Get + Return CType(Me.TableDefinition.ColumnList(37), BaseClasses.Data.NumberColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's Section_.Cpt column object. + ''' + Public Shared ReadOnly Property Cpt() As BaseClasses.Data.NumberColumn + Get + Return SectionTable.Instance.CptColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's Section_.PtcFull column object. + ''' + Public ReadOnly Property PtcFullColumn() As BaseClasses.Data.NumberColumn + Get + Return CType(Me.TableDefinition.ColumnList(38), BaseClasses.Data.NumberColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's Section_.PtcFull column object. + ''' + Public Shared ReadOnly Property PtcFull() As BaseClasses.Data.NumberColumn + Get + Return SectionTable.Instance.PtcFullColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's Section_.Ptc column object. + ''' + Public ReadOnly Property PtcColumn() As BaseClasses.Data.NumberColumn + Get + Return CType(Me.TableDefinition.ColumnList(39), BaseClasses.Data.NumberColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's Section_.Ptc column object. + ''' + Public Shared ReadOnly Property Ptc() As BaseClasses.Data.NumberColumn + Get + Return SectionTable.Instance.PtcColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's Section_.PvtVolFull column object. + ''' + Public ReadOnly Property PvtVolFullColumn() As BaseClasses.Data.NumberColumn + Get + Return CType(Me.TableDefinition.ColumnList(40), BaseClasses.Data.NumberColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's Section_.PvtVolFull column object. + ''' + Public Shared ReadOnly Property PvtVolFull() As BaseClasses.Data.NumberColumn + Get + Return SectionTable.Instance.PvtVolFullColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's Section_.PvtVol column object. + ''' + Public ReadOnly Property PvtVolColumn() As BaseClasses.Data.NumberColumn + Get + Return CType(Me.TableDefinition.ColumnList(41), BaseClasses.Data.NumberColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's Section_.PvtVol column object. + ''' + Public Shared ReadOnly Property PvtVol() As BaseClasses.Data.NumberColumn + Get + Return SectionTable.Instance.PvtVolColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's Section_.Sm4Full column object. + ''' + Public ReadOnly Property Sm4FullColumn() As BaseClasses.Data.NumberColumn + Get + Return CType(Me.TableDefinition.ColumnList(42), BaseClasses.Data.NumberColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's Section_.Sm4Full column object. + ''' + Public Shared ReadOnly Property Sm4Full() As BaseClasses.Data.NumberColumn + Get + Return SectionTable.Instance.Sm4FullColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's Section_.Sm4 column object. + ''' + Public ReadOnly Property Sm4Column() As BaseClasses.Data.NumberColumn + Get + Return CType(Me.TableDefinition.ColumnList(43), BaseClasses.Data.NumberColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's Section_.Sm4 column object. + ''' + Public Shared ReadOnly Property Sm4() As BaseClasses.Data.NumberColumn + Get + Return SectionTable.Instance.Sm4Column + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's Section_.PvtFull column object. + ''' + Public ReadOnly Property PvtFullColumn() As BaseClasses.Data.NumberColumn + Get + Return CType(Me.TableDefinition.ColumnList(44), BaseClasses.Data.NumberColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's Section_.PvtFull column object. + ''' + Public Shared ReadOnly Property PvtFull() As BaseClasses.Data.NumberColumn + Get + Return SectionTable.Instance.PvtFullColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's Section_.Pvt column object. + ''' + Public ReadOnly Property PvtColumn() As BaseClasses.Data.NumberColumn + Get + Return CType(Me.TableDefinition.ColumnList(45), BaseClasses.Data.NumberColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's Section_.Pvt column object. + ''' + Public Shared ReadOnly Property Pvt() As BaseClasses.Data.NumberColumn + Get + Return SectionTable.Instance.PvtColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's Section_.Sm4Now column object. + ''' + Public ReadOnly Property Sm4NowColumn() As BaseClasses.Data.NumberColumn + Get + Return CType(Me.TableDefinition.ColumnList(46), BaseClasses.Data.NumberColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's Section_.Sm4Now column object. + ''' + Public Shared ReadOnly Property Sm4Now() As BaseClasses.Data.NumberColumn + Get + Return SectionTable.Instance.Sm4NowColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's Section_.Pvtst column object. + ''' + Public ReadOnly Property PvtstColumn() As BaseClasses.Data.NumberColumn + Get + Return CType(Me.TableDefinition.ColumnList(47), BaseClasses.Data.NumberColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's Section_.Pvtst column object. + ''' + Public Shared ReadOnly Property Pvtst() As BaseClasses.Data.NumberColumn + Get + Return SectionTable.Instance.PvtstColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's Section_.Pvtnd column object. + ''' + Public ReadOnly Property PvtndColumn() As BaseClasses.Data.NumberColumn + Get + Return CType(Me.TableDefinition.ColumnList(48), BaseClasses.Data.NumberColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's Section_.Pvtnd column object. + ''' + Public Shared ReadOnly Property Pvtnd() As BaseClasses.Data.NumberColumn + Get + Return SectionTable.Instance.PvtndColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's Section_.EmpFull column object. + ''' + Public ReadOnly Property EmpFullColumn() As BaseClasses.Data.NumberColumn + Get + Return CType(Me.TableDefinition.ColumnList(49), BaseClasses.Data.NumberColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's Section_.EmpFull column object. + ''' + Public Shared ReadOnly Property EmpFull() As BaseClasses.Data.NumberColumn + Get + Return SectionTable.Instance.EmpFullColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's Section_.Emp column object. + ''' + Public ReadOnly Property EmpColumn() As BaseClasses.Data.NumberColumn + Get + Return CType(Me.TableDefinition.ColumnList(50), BaseClasses.Data.NumberColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's Section_.Emp column object. + ''' + Public Shared ReadOnly Property Emp() As BaseClasses.Data.NumberColumn + Get + Return SectionTable.Instance.EmpColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's Section_.EmpOffFull column object. + ''' + Public ReadOnly Property EmpOffFullColumn() As BaseClasses.Data.NumberColumn + Get + Return CType(Me.TableDefinition.ColumnList(51), BaseClasses.Data.NumberColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's Section_.EmpOffFull column object. + ''' + Public Shared ReadOnly Property EmpOffFull() As BaseClasses.Data.NumberColumn + Get + Return SectionTable.Instance.EmpOffFullColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's Section_.EmpOff column object. + ''' + Public ReadOnly Property EmpOffColumn() As BaseClasses.Data.NumberColumn + Get + Return CType(Me.TableDefinition.ColumnList(52), BaseClasses.Data.NumberColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's Section_.EmpOff column object. + ''' + Public Shared ReadOnly Property EmpOff() As BaseClasses.Data.NumberColumn + Get + Return SectionTable.Instance.EmpOffColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's Section_.EmpTmpFull column object. + ''' + Public ReadOnly Property EmpTmpFullColumn() As BaseClasses.Data.NumberColumn + Get + Return CType(Me.TableDefinition.ColumnList(53), BaseClasses.Data.NumberColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's Section_.EmpTmpFull column object. + ''' + Public Shared ReadOnly Property EmpTmpFull() As BaseClasses.Data.NumberColumn + Get + Return SectionTable.Instance.EmpTmpFullColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's Section_.EmpTmp column object. + ''' + Public ReadOnly Property EmpTmpColumn() As BaseClasses.Data.NumberColumn + Get + Return CType(Me.TableDefinition.ColumnList(54), BaseClasses.Data.NumberColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's Section_.EmpTmp column object. + ''' + Public Shared ReadOnly Property EmpTmp() As BaseClasses.Data.NumberColumn + Get + Return SectionTable.Instance.EmpTmpColumn + End Get + End Property + + +#End Region + + +#Region "Shared helper methods" + + ''' + ''' This is a shared function that can be used to get an array of SectionRecord records using a where clause. + ''' + Public Shared Function GetRecords(ByVal where As String) As SectionRecord() + + Return GetRecords(where, Nothing, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) + End Function + + ''' + ''' This is a shared function that can be used to get an array of SectionRecord records using a where clause. + ''' + Public Shared Function GetRecords(ByVal join As BaseFilter, ByVal where As String) As SectionRecord() + + Return GetRecords(join, where, Nothing, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) + End Function + + ''' + ''' This is a shared function that can be used to get an array of SectionRecord records using a where and order by clause. + ''' + Public Shared Function GetRecords( _ + ByVal where As String, _ + ByVal orderBy As OrderBy) As SectionRecord() + + Return GetRecords(where, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) + End Function + + ''' + ''' This is a shared function that can be used to get an array of SectionRecord records using a where and order by clause. + ''' + Public Shared Function GetRecords( _ + ByVal join As BaseFilter, _ + ByVal where As String, _ + ByVal orderBy As OrderBy) As SectionRecord() + + Return GetRecords(join, where, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) + End Function + + ''' + ''' This is a shared function that can be used to get an array of SectionRecord records using a where and order by clause clause with pagination. + ''' + Public Shared Function GetRecords( _ + ByVal where As String, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As SectionRecord() + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + Dim join As BaseClasses.Data.BaseFilter = Nothing + Dim recList As ArrayList = SectionTable.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, pageIndex, pageSize) + + Return CType(recList.ToArray(GetType(Persons.Business.SectionRecord)), SectionRecord()) + End Function + + ''' + ''' This is a shared function that can be used to get an array of SectionRecord records using a where and order by clause clause with pagination. + ''' + Public Shared Function GetRecords( _ + ByVal join As BaseFilter, _ + ByVal where As String, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As SectionRecord() + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Dim recList As ArrayList = SectionTable.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, pageIndex, pageSize) + + Return CType(recList.ToArray(GetType(Persons.Business.SectionRecord)), SectionRecord()) + End Function + + Public Shared Function GetRecords( _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As SectionRecord() + Dim join As BaseClasses.Data.BaseFilter = Nothing + Dim recList As ArrayList = SectionTable.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + Return CType(recList.ToArray(GetType(Persons.Business.SectionRecord)), SectionRecord()) + End Function + + Public Shared Function GetRecords( _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As SectionRecord() + + Dim recList As ArrayList = SectionTable.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + Return CType(recList.ToArray(GetType(Persons.Business.SectionRecord)), SectionRecord()) + End Function + + Public Shared Function GetRecords( _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer, _ + ByRef totalRecords As Integer) As SectionRecord() + Dim join As BaseClasses.Data.BaseFilter = Nothing + Dim recList As ArrayList = SectionTable.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize, totalRecords) + + Return CType(recList.ToArray(GetType(Persons.Business.SectionRecord)), SectionRecord()) + End Function + + Public Shared Function GetRecords( _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer, _ + ByRef totalRecords As Integer) As SectionRecord() + + Dim recList As ArrayList = SectionTable.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize, totalRecords) + + Return CType(recList.ToArray(GetType(Persons.Business.SectionRecord)), SectionRecord()) + End Function + + ''' + ''' This is a shared function that can be used to get total number of records that will be returned using the where clause. + ''' + Public Shared Function GetRecordCount(ByVal where As String) As Integer + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Return CInt(SectionTable.Instance.GetRecordListCount(Nothing, whereFilter, Nothing, Nothing)) + End Function + +''' + ''' This is a shared function that can be used to get total number of records that will be returned using the where clause. + ''' + Public Shared Function GetRecordCount(ByVal join As BaseFilter, ByVal where As String) As Integer + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Return CInt(SectionTable.Instance.GetRecordListCount(join, whereFilter, Nothing, Nothing)) + End Function + + Public Shared Function GetRecordCount(ByVal where As WhereClause) As Integer + Return CInt(SectionTable.Instance.GetRecordListCount(Nothing, where.GetFilter(), Nothing, Nothing)) + End Function + + Public Shared Function GetRecordCount(ByVal join As BaseFilter, ByVal where As WhereClause) As Integer + Return CInt(SectionTable.Instance.GetRecordListCount(join, where.GetFilter(), Nothing, Nothing)) + End Function + + ''' + ''' This is a shared function that can be used to get a SectionRecord record using a where clause. + ''' + Public Shared Function GetRecord(ByVal where As String) As SectionRecord + Dim orderBy As OrderBy = Nothing + Return GetRecord(where, orderBy) + End Function + + ''' + ''' This is a shared function that can be used to get a SectionRecord record using a where clause. + ''' + Public Shared Function GetRecord(ByVal join As BaseFilter, ByVal where As String) As SectionRecord + Dim orderBy As OrderBy = Nothing + Return GetRecord(join, where, orderBy) + End Function + + ''' + ''' This is a shared function that can be used to get a SectionRecord record using a where and order by clause. + ''' + Public Shared Function GetRecord( _ + ByVal where As String, _ + ByVal orderBy As OrderBy) As SectionRecord + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + Dim join As BaseClasses.Data.BaseFilter = Nothing + Dim recList As ArrayList = SectionTable.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MIN_BATCH_SIZE) + + Dim rec As SectionRecord = Nothing + If recList.Count > 0 Then + rec = CType(recList(0), SectionRecord) + End If + + Return rec + End Function + + ''' + ''' This is a shared function that can be used to get a SectionRecord record using a where and order by clause. + ''' + Public Shared Function GetRecord( _ + ByVal join As BaseFilter, _ + ByVal where As String, _ + ByVal orderBy As OrderBy) As SectionRecord + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Dim recList As ArrayList = SectionTable.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MIN_BATCH_SIZE) + + Dim rec As SectionRecord = Nothing + If recList.Count > 0 Then + rec = CType(recList(0), SectionRecord) + End If + + Return rec + End Function + + + Public Shared Function GetValues( _ + ByVal col As BaseColumn, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal maxItems As Integer) As String() + + ' Create the filter list. + Dim retCol As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, True) + retCol.AddColumn(col) + + Return SectionTable.Instance.GetColumnValues(retCol, Nothing, where.GetFilter(), Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, maxItems) + + End Function + + Public Shared Function GetValues( _ + ByVal col As BaseColumn, _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal maxItems As Integer) As String() + + ' Create the filter list. + Dim retCol As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, True) + retCol.AddColumn(col) + + Return SectionTable.Instance.GetColumnValues(retCol, join, where.GetFilter(), Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, maxItems) + + End Function + + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where clause. + ''' + Public Shared Function GetDataTable(ByVal where As String) As System.Data.DataTable + + Dim recs() As SectionRecord = GetRecords(where) + Return SectionTable.Instance.CreateDataTable(recs, Nothing) + End Function + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where clause. + ''' + Public Shared Function GetDataTable(ByVal join As BaseFilter, ByVal where As String) As System.Data.DataTable + + Dim recs() As SectionRecord = GetRecords(join, where) + Return SectionTable.Instance.CreateDataTable(recs, Nothing) + End Function + + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause. + ''' + Public Shared Function GetDataTable(ByVal where As String, ByVal orderBy As OrderBy) As System.Data.DataTable + + Dim recs() As SectionRecord = GetRecords(where, orderBy) + Return SectionTable.Instance.CreateDataTable(recs, Nothing) + End Function + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause. + ''' + Public Shared Function GetDataTable(ByVal join As BaseFilter, ByVal where As String, ByVal orderBy As OrderBy) As System.Data.DataTable + + Dim recs() As SectionRecord = GetRecords(join, where, orderBy) + Return SectionTable.Instance.CreateDataTable(recs, Nothing) + End Function + + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause with pagination. + ''' + Public Shared Function GetDataTable( _ + ByVal where As String, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As System.Data.DataTable + + Dim recs() As SectionRecord = GetRecords(where, orderBy, pageIndex, pageSize) + Return SectionTable.Instance.CreateDataTable(recs, Nothing) + End Function + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause with pagination. + ''' + Public Shared Function GetDataTable( _ + ByVal join As BaseFilter, _ + ByVal where As String, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As System.Data.DataTable + + Dim recs() As SectionRecord = GetRecords(join, where, orderBy, pageIndex, pageSize) + Return SectionTable.Instance.CreateDataTable(recs, Nothing) + End Function + + + ''' + ''' This is a shared function that can be used to delete records using a where clause. + ''' + Public Shared Sub DeleteRecords(ByVal where As String) + If where = Nothing OrElse where.Trim() = "" Then + Return + End If + + Dim whereFilter As SqlFilter = New SqlFilter(where) + SectionTable.Instance.DeleteRecordList(whereFilter) + End Sub + + ''' + ''' This is a shared function that can be used to export records using a where clause. + ''' + Public Shared Function Export(ByVal where As String) As String + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Return SectionTable.Instance.ExportRecordData(whereFilter) + End Function + + Public Shared Function Export(ByVal where As WhereClause) As String + Dim whereFilter As BaseFilter = Nothing + If Not where Is Nothing Then + whereFilter = where.GetFilter() + End If + + Return SectionTable.Instance.ExportRecordData(whereFilter) + End Function + + Public Shared Function GetSum( _ + ByVal col As BaseColumn, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) _ + As String + + Dim colSel As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, False) + colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Sum) + + Return SectionTable.Instance.GetColumnStatistics(colSel, Nothing, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + End Function + + Public Shared Function GetSum( _ + ByVal col As BaseColumn, _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) _ + As String + + Dim colSel As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, False) + colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Sum) + + Return SectionTable.Instance.GetColumnStatistics(colSel, join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + End Function + + + Public Shared Function GetCount( _ + ByVal col As BaseColumn, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) _ + As String + + Dim colSel As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, False) + colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Count) + + Return SectionTable.Instance.GetColumnStatistics(colSel, Nothing, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + End Function + + Public Shared Function GetCount( _ + ByVal col As BaseColumn, _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) _ + As String + + Dim colSel As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, False) + colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Count) + + Return SectionTable.Instance.GetColumnStatistics(colSel, join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + End Function + + ''' + ''' This method returns the columns in the table. + ''' + Public Shared Function GetColumns() As BaseColumn() + Return SectionTable.Instance.TableDefinition.Columns + End Function + + ''' + ''' This method returns the columnlist in the table. + ''' + Public Shared Function GetColumnList() As ColumnList + Return SectionTable.Instance.TableDefinition.ColumnList + End Function + + + ''' + ''' This method creates a new record and returns it to be edited. + ''' + Public Shared Function CreateNewRecord() As IRecord + Return SectionTable.Instance.CreateRecord() + End Function + + ''' + ''' This method creates a new record and returns it to be edited. + ''' + ''' ID of the new record. + Public Shared Function CreateNewRecord(ByVal tempId As String) As IRecord + Return SectionTable.Instance.CreateRecord(tempId) + End Function + + ''' + ''' This method checks if column is editable. + ''' + ''' Name of the column to check. + Public Shared Function isReadOnlyColumn(ByVal columnName As String) As Boolean + Dim column As BaseColumn = GetColumn(columnName) + If (Not IsNothing(column)) Then + Return column.IsValuesReadOnly + Else + Return True + End If + End Function + + ''' + ''' This method gets the specified column. + ''' + ''' Unique name of the column to fetch. + Public Shared Function GetColumn(ByVal uniqueColumnName As String) As BaseColumn + Dim column As BaseColumn = SectionTable.Instance.TableDefinition.ColumnList.GetByUniqueName(uniqueColumnName) + Return column + End Function + + ' Convenience method for getting a record using a string-based record identifier + Public Shared Function GetRecord(ByVal id As String, ByVal bMutable As Boolean) As SectionRecord + Return CType(SectionTable.Instance.GetRecordData(id, bMutable), SectionRecord) + End Function + + ' Convenience method for getting a record using a KeyValue record identifier + Public Shared Function GetRecord(ByVal id As KeyValue, ByVal bMutable As Boolean) As SectionRecord + Return CType(SectionTable.Instance.GetRecordData(id, bMutable), SectionRecord) + End Function + + ' Convenience method for creating a record + Public Overloads Function NewRecord( _ + ByVal SectionIdValue As String, _ + ByVal SectionNameValue As String, _ + ByVal SectionAbbvrNameValue As String, _ + ByVal SectionENameValue As String, _ + ByVal MarshallFullValue As String, _ + ByVal MarShallValue As String, _ + ByVal GeneralFullValue As String, _ + ByVal GeneralValue As String, _ + ByVal LtGeneralFullValue As String, _ + ByVal LtGeneralValue As String, _ + ByVal MjGeneralFullValue As String, _ + ByVal MjGeneralValue As String, _ + ByVal SpColonelFullValue As String, _ + ByVal SpColonelValue As String, _ + ByVal ColonelFullValue As String, _ + ByVal ColonelValue As String, _ + ByVal LtColonelFullValue As String, _ + ByVal LtColonelValue As String, _ + ByVal MajorFullValue As String, _ + ByVal MajorValue As String, _ + ByVal CaptianFullValue As String, _ + ByVal CaptianValue As String, _ + ByVal LieutenantFullValue As String, _ + ByVal LieutenantValue As String, _ + ByVal SubLieutenantFullValue As String, _ + ByVal SubLieutenantValue As String, _ + ByVal Sm0FullValue As String, _ + ByVal Sm0Value As String, _ + ByVal Sm1FullValue As String, _ + ByVal Sm1Value As String, _ + ByVal Sm2FullValue As String, _ + ByVal Sm2Value As String, _ + ByVal Sm3FullValue As String, _ + ByVal Sm3Value As String, _ + ByVal SgtFullValue As String, _ + ByVal SgtValue As String, _ + ByVal CptFullValue As String, _ + ByVal CptValue As String, _ + ByVal PtcFullValue As String, _ + ByVal PtcValue As String, _ + ByVal PvtVolFullValue As String, _ + ByVal PvtVolValue As String, _ + ByVal Sm4FullValue As String, _ + ByVal Sm4Value As String, _ + ByVal PvtFullValue As String, _ + ByVal PvtValue As String, _ + ByVal Sm4NowValue As String, _ + ByVal PvtstValue As String, _ + ByVal PvtndValue As String, _ + ByVal EmpFullValue As String, _ + ByVal EmpValue As String, _ + ByVal EmpOffFullValue As String, _ + ByVal EmpOffValue As String, _ + ByVal EmpTmpFullValue As String, _ + ByVal EmpTmpValue As String _ + ) As KeyValue + Dim rec As IPrimaryKeyRecord = CType(Me.CreateRecord(), IPrimaryKeyRecord) + rec.SetString(SectionIdValue, SectionIdColumn) + rec.SetString(SectionNameValue, SectionNameColumn) + rec.SetString(SectionAbbvrNameValue, SectionAbbvrNameColumn) + rec.SetString(SectionENameValue, SectionENameColumn) + rec.SetString(MarshallFullValue, MarshallFullColumn) + rec.SetString(MarShallValue, MarShallColumn) + rec.SetString(GeneralFullValue, GeneralFullColumn) + rec.SetString(GeneralValue, GeneralColumn) + rec.SetString(LtGeneralFullValue, LtGeneralFullColumn) + rec.SetString(LtGeneralValue, LtGeneralColumn) + rec.SetString(MjGeneralFullValue, MjGeneralFullColumn) + rec.SetString(MjGeneralValue, MjGeneralColumn) + rec.SetString(SpColonelFullValue, SpColonelFullColumn) + rec.SetString(SpColonelValue, SpColonelColumn) + rec.SetString(ColonelFullValue, ColonelFullColumn) + rec.SetString(ColonelValue, ColonelColumn) + rec.SetString(LtColonelFullValue, LtColonelFullColumn) + rec.SetString(LtColonelValue, LtColonelColumn) + rec.SetString(MajorFullValue, MajorFullColumn) + rec.SetString(MajorValue, MajorColumn) + rec.SetString(CaptianFullValue, CaptianFullColumn) + rec.SetString(CaptianValue, CaptianColumn) + rec.SetString(LieutenantFullValue, LieutenantFullColumn) + rec.SetString(LieutenantValue, LieutenantColumn) + rec.SetString(SubLieutenantFullValue, SubLieutenantFullColumn) + rec.SetString(SubLieutenantValue, SubLieutenantColumn) + rec.SetString(Sm0FullValue, Sm0FullColumn) + rec.SetString(Sm0Value, Sm0Column) + rec.SetString(Sm1FullValue, Sm1FullColumn) + rec.SetString(Sm1Value, Sm1Column) + rec.SetString(Sm2FullValue, Sm2FullColumn) + rec.SetString(Sm2Value, Sm2Column) + rec.SetString(Sm3FullValue, Sm3FullColumn) + rec.SetString(Sm3Value, Sm3Column) + rec.SetString(SgtFullValue, SgtFullColumn) + rec.SetString(SgtValue, SgtColumn) + rec.SetString(CptFullValue, CptFullColumn) + rec.SetString(CptValue, CptColumn) + rec.SetString(PtcFullValue, PtcFullColumn) + rec.SetString(PtcValue, PtcColumn) + rec.SetString(PvtVolFullValue, PvtVolFullColumn) + rec.SetString(PvtVolValue, PvtVolColumn) + rec.SetString(Sm4FullValue, Sm4FullColumn) + rec.SetString(Sm4Value, Sm4Column) + rec.SetString(PvtFullValue, PvtFullColumn) + rec.SetString(PvtValue, PvtColumn) + rec.SetString(Sm4NowValue, Sm4NowColumn) + rec.SetString(PvtstValue, PvtstColumn) + rec.SetString(PvtndValue, PvtndColumn) + rec.SetString(EmpFullValue, EmpFullColumn) + rec.SetString(EmpValue, EmpColumn) + rec.SetString(EmpOffFullValue, EmpOffFullColumn) + rec.SetString(EmpOffValue, EmpOffColumn) + rec.SetString(EmpTmpFullValue, EmpTmpFullColumn) + rec.SetString(EmpTmpValue, EmpTmpColumn) + + + rec.Create() 'update the DB so any DB-initialized fields (like autoincrement IDs) can be initialized + + Dim key As KeyValue = rec.GetID() + Return key + End Function + + ''' + ''' This method deletes a specified record + ''' + ''' Keyvalue of the record to be deleted. + Public Shared Sub DeleteRecord(ByVal kv As KeyValue) + SectionTable.Instance.DeleteOneRecord(kv) + End Sub + + ''' + ''' This method checks if record exist in the database using the keyvalue provided. + ''' + ''' Key value of the record. + Public Shared Function DoesRecordExist(ByVal kv As KeyValue) As Boolean + Dim recordExist As Boolean = True + Try + SectionTable.GetRecord(kv, False) + Catch ex As Exception + recordExist = False + End Try + Return recordExist + End Function + + ''' + ''' This method returns all the primary columns in the table. + ''' + Public Shared Function GetPrimaryKeyColumns() As ColumnList + If (Not IsNothing(SectionTable.Instance.TableDefinition.PrimaryKey)) Then + Return SectionTable.Instance.TableDefinition.PrimaryKey.Columns + Else + Return Nothing + End If + End Function + + ''' + ''' This method takes a key and returns a keyvalue. + ''' + ''' key could be array of primary key values in case of composite primary key or a string containing single primary key value in case of non-composite primary key. + Public Shared Function GetKeyValue(ByVal key As Object) As KeyValue + Dim kv As KeyValue = Nothing + + If (Not (IsNothing(SectionTable.Instance.TableDefinition.PrimaryKey))) Then + + Dim isCompositePrimaryKey As Boolean = False + isCompositePrimaryKey = SectionTable.Instance.TableDefinition.PrimaryKey.IsCompositeKey + + If ((isCompositePrimaryKey) AndAlso (key.GetType.IsArray())) Then + + ' If the key is composite, then construct a key value. + kv = New KeyValue + Dim fullKeyString As String = "" + Dim keyArray As Array = CType(key, Array) + If (Not IsNothing(keyArray)) Then + Dim length As Integer = keyArray.Length + Dim pkColumns As ColumnList = SectionTable.Instance.TableDefinition.PrimaryKey.Columns + Dim pkColumn As BaseColumn + Dim index As Integer = 0 + For Each pkColumn In pkColumns + Dim keyString As String = CType(keyArray.GetValue(index), String) + If (SectionTable.Instance.TableDefinition.TableType = BaseClasses.Data.TableDefinition.TableTypes.Virtual) Then + kv.AddElement(pkColumn.UniqueName, keyString) + Else + kv.AddElement(pkColumn.InternalName, keyString) + End If + index = index + 1 + Next pkColumn + End If + + Else + ' If the key is not composite, then get the key value. + kv = SectionTable.Instance.TableDefinition.PrimaryKey.ParseValue(CType(key, String)) + End If + End If + Return kv + End Function + + + ''' + ''' This method takes a record and a Column and returns an evaluated value of DFKA formula. + ''' + Public Shared Function GetDFKA(ByVal rec As BaseRecord, ByVal col As BaseColumn) As String + Dim fkColumn As ForeignKey = SectionTable.Instance.TableDefinition.GetExpandableNonCompositeForeignKey(col) + If fkColumn Is Nothing Then + Return Nothing + End If + Dim _DFKA As String = fkColumn.PrimaryKeyDisplayColumns + If (_DFKA.Trim().StartsWith("=")) Then + ' if the formula is in the format of "= ., then pull out the data from the rec object instead of doing formula evaluation + Dim tableCodeName As String = fkColumn.PrimaryKeyTableDefinition.TableCodeName + Dim column As String = _DFKA.Trim("="c).Trim() + If column.StartsWith(tableCodeName & ".", StringComparison.InvariantCultureIgnoreCase) Then + column = column.Substring(tableCodeName.Length + 1) + End If + + For Each c As BaseColumn In fkColumn.PrimaryKeyTableDefinition.Columns + If column = c.CodeName Then + Return rec.Format(c) + End If + Next + Dim tableName As String = fkColumn.PrimaryKeyTableDefinition.TableCodeName + Return EvaluateFormula(_DFKA, rec, Nothing, tableName) + Else + Return Nothing + End If + End Function + + ''' + ''' This method takes a keyValue and a Column and returns an evaluated value of DFKA formula. + ''' + Public Shared Function GetDFKA(ByVal keyValue As String, ByVal col As BaseColumn, ByVal formatPattern as String) As String + If keyValue Is Nothing Then + Return Nothing + End If + Dim fkColumn As ForeignKey = SectionTable.Instance.TableDefinition.GetExpandableNonCompositeForeignKey(col) + If fkColumn Is Nothing Then + Return Nothing + End If + Dim _DFKA As String = fkColumn.PrimaryKeyDisplayColumns + If (_DFKA.Trim().StartsWith("=")) Then + Dim tableName As String = fkColumn.PrimaryKeyTableDefinition.TableCodeName + Dim t As PrimaryKeyTable = CType(DatabaseObjects.GetTableObject(tableName), PrimaryKeyTable) + Dim rec As BaseRecord = Nothing + If Not t Is Nothing Then + Try + rec = CType(t.GetRecordData(keyValue, False), BaseRecord) + Catch + rec = Nothing + End Try + End If + If rec Is Nothing Then + Return "" + End If + + ' if the formula is in the format of "= ., then pull out the data from the rec object instead of doing formula evaluation + Dim tableCodeName As String = fkColumn.PrimaryKeyTableDefinition.TableCodeName + Dim column As String = _DFKA.Trim("="c).Trim() + If column.StartsWith(tableCodeName & ".", StringComparison.InvariantCultureIgnoreCase) Then + column = column.Substring(tableCodeName.Length + 1) + End If + + For Each c As BaseColumn In fkColumn.PrimaryKeyTableDefinition.Columns + If column = c.CodeName Then + Return rec.Format(c) + End If + Next + Return EvaluateFormula(_DFKA, rec, Nothing, tableName) + Else + Return Nothing + End If + End Function + + ''' + ''' Evaluates the formula + ''' + Public Shared Function EvaluateFormula(ByVal formula As String, Optional ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord = Nothing, Optional ByVal format As String = Nothing, Optional ByVal name As String = "") As String + Dim e As BaseFormulaEvaluator = New BaseFormulaEvaluator() + If Not dataSourceForEvaluate Is Nothing Then + e.Evaluator.Variables.Add(name, dataSourceForEvaluate) + end if + e.DataSource = dataSourceForEvaluate + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + If Not String.IsNullOrEmpty(format) Then + Return BaseFormulaUtils.Format(resultObj, format) + Else + Return resultObj.ToString() + End If + End Function + + +#End Region + +End Class +End Namespace diff --git a/App_Code/Business Layer/BaseSexRecord.vb b/App_Code/Business Layer/BaseSexRecord.vb new file mode 100644 index 0000000..d93a38a --- /dev/null +++ b/App_Code/Business Layer/BaseSexRecord.vb @@ -0,0 +1,283 @@ +' This class is "generated" and will be overwritten. +' Your customizations should be made in SexRecord.vb + +Imports System.Data.SqlTypes +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + +Namespace Persons.Business + +''' +''' The generated superclass for the class. +''' +''' +''' This class is not intended to be instantiated directly. To obtain an instance of this class, +''' use the methods of the class. +''' +''' +''' + + Public Class BaseSexRecord + Inherits PrimaryKeyRecord + + + Public Shared Shadows ReadOnly TableUtils As SexTable = SexTable.Instance + + ' Constructors + + Protected Sub New() + MyBase.New(TableUtils) + End Sub + + Protected Sub New(ByVal record As PrimaryKeyRecord) + MyBase.New(record, TableUtils) + End Sub + + 'Evaluates Initialize when->Inserting record formulas specified at the data access layer + Public Overridable Sub SexRecord_InsertingRecord(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles Me.InsertingRecord + 'Apply Initialize->Inserting record formula only if validation is successful. + Dim SexRec As SexRecord = CType(sender,SexRecord) + Validate_Inserting() + If Not SexRec Is Nothing AndAlso Not SexRec.IsReadOnly Then + End If + End Sub + + 'Evaluates Initialize when->Updating record formulas specified at the data access layer + Public Overridable Sub SexRecord_UpdatingRecord(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles Me.UpdatingRecord + 'Apply Initialize->Updating record formula only if validation is successful. + Dim SexRec As SexRecord = CType(sender,SexRecord) + Validate_Updating() + If Not SexRec Is Nothing AndAlso Not SexRec.IsReadOnly Then + End If + End Sub + + 'Evaluates Initialize when->Reading record formulas specified at the data access layer + Public Overridable Sub SexRecord_ReadRecord(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.ReadRecord + 'Apply Initialize->Reading record formula only if validation is successful. + Dim SexRec As SexRecord = CType(sender,SexRecord) + If Not SexRec Is Nothing AndAlso Not SexRec.IsReadOnly Then + End If + End Sub + + 'Evaluates Validate when->Inserting formulas specified at the data access layer + Public Overridable Sub Validate_Inserting () + Dim fullValidationMessage As String = "" + Dim validationMessage As String = "" + + dim formula as String = "" + + + If validationMessage <> "" AndAlso validationMessage.ToLower() <> "true" Then + fullValidationMessage &= validationMessage & vbCrLf + End If + + If fullValidationMessage <> "" Then + Throw New Exception(fullValidationMessage) + End If + End Sub + + 'Evaluates Validate when->Updating formulas specified at the data access layer + Public Overridable Sub Validate_Updating () + Dim fullValidationMessage As String = "" + Dim validationMessage As String = "" + + dim formula as String = "" + + + If validationMessage <> "" AndAlso validationMessage.ToLower() <> "true" Then + fullValidationMessage &= validationMessage & vbCrLf + End If + + If fullValidationMessage <> "" Then + Throw New Exception(fullValidationMessage) + End If + End Sub + + Public Overridable Function EvaluateFormula(ByVal formula As String, Optional ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord = Nothing, Optional ByVal format As String = Nothing) As String + + Dim e As Data.BaseFormulaEvaluator = New Data.BaseFormulaEvaluator() + + ' All variables referred to in the formula are expected to be + ' properties of the DataSource. For example, referring to + ' UnitPrice as a variable will refer to DataSource.UnitPrice + e.DataSource = dataSourceForEvaluate + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + Return resultObj.ToString() + End Function + + + + + + + +#Region "Convenience methods to get/set values of fields" + + ''' + ''' This is a convenience method that provides direct access to the value of the record's Sex_.SexId field. + ''' + Public Function GetSexIdValue() As ColumnValue + Return Me.GetValue(TableUtils.SexIdColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's Sex_.SexId field. + ''' + Public Function GetSexIdFieldValue() As Int16 + Return CType(Me.GetValue(TableUtils.SexIdColumn).ToInt16(), Int16) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Sex_.SexId field. + ''' + Public Sub SetSexIdFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.SexIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Sex_.SexId field. + ''' + Public Sub SetSexIdFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.SexIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Sex_.SexId field. + ''' + Public Sub SetSexIdFieldValue(ByVal val As Double) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.SexIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Sex_.SexId field. + ''' + Public Sub SetSexIdFieldValue(ByVal val As Decimal) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.SexIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Sex_.SexId field. + ''' + Public Sub SetSexIdFieldValue(ByVal val As Int64) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.SexIdColumn) + End Sub + ''' + ''' This is a convenience method that provides direct access to the value of the record's Sex_.Sex field. + ''' + Public Function GetSexValue() As ColumnValue + Return Me.GetValue(TableUtils.SexColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's Sex_.Sex field. + ''' + Public Function GetSexFieldValue() As String + Return CType(Me.GetValue(TableUtils.SexColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Sex_.Sex field. + ''' + Public Sub SetSexFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.SexColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Sex_.Sex field. + ''' + Public Sub SetSexFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.SexColumn) + End Sub + + + +#End Region + +#Region "Convenience methods to get field names" + + ''' + ''' This is a convenience property that provides direct access to the value of the record's Sex_.SexId field. + ''' + Public Property SexId() As Int16 + Get + Return CType(Me.GetValue(TableUtils.SexIdColumn).ToInt16(), Int16) + End Get + Set (ByVal val As Int16) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.SexIdColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property SexIdSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.SexIdColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property SexIdDefault() As String + Get + Return TableUtils.SexIdColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's Sex_.Sex field. + ''' + Public Property Sex() As String + Get + Return CType(Me.GetValue(TableUtils.SexColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.SexColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property SexSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.SexColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property SexDefault() As String + Get + Return TableUtils.SexColumn.DefaultValue + End Get + End Property + + + +#End Region + +End Class +End Namespace diff --git a/App_Code/Business Layer/BaseSexTable.vb b/App_Code/Business Layer/BaseSexTable.vb new file mode 100644 index 0000000..b916059 --- /dev/null +++ b/App_Code/Business Layer/BaseSexTable.vb @@ -0,0 +1,778 @@ +' This class is "generated" and will be overwritten. +' Your customizations should be made in SexRecord.vb + +Imports System.Data.SqlTypes +Imports System.Data +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider +Imports Persons.Data + +Namespace Persons.Business + +''' +''' The generated superclass for the class. +''' Provides access to the schema information and record data of a database table or view named Sex. +''' +''' +''' The connection details (name, location, etc.) of the database and table (or view) accessed by this class +''' are resolved at runtime based on the connection string in the application's Web.Config file. +''' +''' This class is not intended to be instantiated directly. To obtain an instance of this class, use +''' SexTable.Instance. +''' +''' +''' + + Public Class BaseSexTable + Inherits PrimaryKeyTable + + + Private ReadOnly TableDefinitionString As String = SexDefinition.GetXMLString() + + + + + + + + Protected Sub New() + MyBase.New() + Me.Initialize() + End Sub + + Protected Overridable Sub Initialize() + Dim def As New XmlTableDefinition(TableDefinitionString) + Me.TableDefinition = New TableDefinition() + Me.TableDefinition.TableClassName = System.Reflection.Assembly.CreateQualifiedName("App_Code", "Persons.Business.SexTable") + def.InitializeTableDefinition(Me.TableDefinition) + Me.ConnectionName = def.GetConnectionName() + Me.RecordClassName = System.Reflection.Assembly.CreateQualifiedName("App_Code", "Persons.Business.SexRecord") + Me.ApplicationName = "App_Code" + Me.DataAdapter = New SexSqlTable() + Directcast(Me.DataAdapter, SexSqlTable).ConnectionName = Me.ConnectionName + + Me.TableDefinition.AdapterMetaData = Me.DataAdapter.AdapterMetaData + SexIdColumn.CodeName = "SexId" + SexColumn.CodeName = "Sex" + + End Sub + +#Region "Overriden methods" + + +#End Region + +#Region "Properties for columns" + + ''' + ''' This is a convenience property that provides direct access to the table's Sex_.SexId column object. + ''' + Public ReadOnly Property SexIdColumn() As BaseClasses.Data.NumberColumn + Get + Return CType(Me.TableDefinition.ColumnList(0), BaseClasses.Data.NumberColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's Sex_.SexId column object. + ''' + Public Shared ReadOnly Property SexId() As BaseClasses.Data.NumberColumn + Get + Return SexTable.Instance.SexIdColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's Sex_.Sex column object. + ''' + Public ReadOnly Property SexColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(1), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's Sex_.Sex column object. + ''' + Public Shared ReadOnly Property Sex() As BaseClasses.Data.StringColumn + Get + Return SexTable.Instance.SexColumn + End Get + End Property + + +#End Region + + +#Region "Shared helper methods" + + ''' + ''' This is a shared function that can be used to get an array of SexRecord records using a where clause. + ''' + Public Shared Function GetRecords(ByVal where As String) As SexRecord() + + Return GetRecords(where, Nothing, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) + End Function + + ''' + ''' This is a shared function that can be used to get an array of SexRecord records using a where clause. + ''' + Public Shared Function GetRecords(ByVal join As BaseFilter, ByVal where As String) As SexRecord() + + Return GetRecords(join, where, Nothing, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) + End Function + + ''' + ''' This is a shared function that can be used to get an array of SexRecord records using a where and order by clause. + ''' + Public Shared Function GetRecords( _ + ByVal where As String, _ + ByVal orderBy As OrderBy) As SexRecord() + + Return GetRecords(where, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) + End Function + + ''' + ''' This is a shared function that can be used to get an array of SexRecord records using a where and order by clause. + ''' + Public Shared Function GetRecords( _ + ByVal join As BaseFilter, _ + ByVal where As String, _ + ByVal orderBy As OrderBy) As SexRecord() + + Return GetRecords(join, where, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) + End Function + + ''' + ''' This is a shared function that can be used to get an array of SexRecord records using a where and order by clause clause with pagination. + ''' + Public Shared Function GetRecords( _ + ByVal where As String, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As SexRecord() + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + Dim join As BaseClasses.Data.BaseFilter = Nothing + Dim recList As ArrayList = SexTable.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, pageIndex, pageSize) + + Return CType(recList.ToArray(GetType(Persons.Business.SexRecord)), SexRecord()) + End Function + + ''' + ''' This is a shared function that can be used to get an array of SexRecord records using a where and order by clause clause with pagination. + ''' + Public Shared Function GetRecords( _ + ByVal join As BaseFilter, _ + ByVal where As String, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As SexRecord() + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Dim recList As ArrayList = SexTable.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, pageIndex, pageSize) + + Return CType(recList.ToArray(GetType(Persons.Business.SexRecord)), SexRecord()) + End Function + + Public Shared Function GetRecords( _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As SexRecord() + Dim join As BaseClasses.Data.BaseFilter = Nothing + Dim recList As ArrayList = SexTable.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + Return CType(recList.ToArray(GetType(Persons.Business.SexRecord)), SexRecord()) + End Function + + Public Shared Function GetRecords( _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As SexRecord() + + Dim recList As ArrayList = SexTable.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + Return CType(recList.ToArray(GetType(Persons.Business.SexRecord)), SexRecord()) + End Function + + Public Shared Function GetRecords( _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer, _ + ByRef totalRecords As Integer) As SexRecord() + Dim join As BaseClasses.Data.BaseFilter = Nothing + Dim recList As ArrayList = SexTable.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize, totalRecords) + + Return CType(recList.ToArray(GetType(Persons.Business.SexRecord)), SexRecord()) + End Function + + Public Shared Function GetRecords( _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer, _ + ByRef totalRecords As Integer) As SexRecord() + + Dim recList As ArrayList = SexTable.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize, totalRecords) + + Return CType(recList.ToArray(GetType(Persons.Business.SexRecord)), SexRecord()) + End Function + + ''' + ''' This is a shared function that can be used to get total number of records that will be returned using the where clause. + ''' + Public Shared Function GetRecordCount(ByVal where As String) As Integer + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Return CInt(SexTable.Instance.GetRecordListCount(Nothing, whereFilter, Nothing, Nothing)) + End Function + +''' + ''' This is a shared function that can be used to get total number of records that will be returned using the where clause. + ''' + Public Shared Function GetRecordCount(ByVal join As BaseFilter, ByVal where As String) As Integer + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Return CInt(SexTable.Instance.GetRecordListCount(join, whereFilter, Nothing, Nothing)) + End Function + + Public Shared Function GetRecordCount(ByVal where As WhereClause) As Integer + Return CInt(SexTable.Instance.GetRecordListCount(Nothing, where.GetFilter(), Nothing, Nothing)) + End Function + + Public Shared Function GetRecordCount(ByVal join As BaseFilter, ByVal where As WhereClause) As Integer + Return CInt(SexTable.Instance.GetRecordListCount(join, where.GetFilter(), Nothing, Nothing)) + End Function + + ''' + ''' This is a shared function that can be used to get a SexRecord record using a where clause. + ''' + Public Shared Function GetRecord(ByVal where As String) As SexRecord + Dim orderBy As OrderBy = Nothing + Return GetRecord(where, orderBy) + End Function + + ''' + ''' This is a shared function that can be used to get a SexRecord record using a where clause. + ''' + Public Shared Function GetRecord(ByVal join As BaseFilter, ByVal where As String) As SexRecord + Dim orderBy As OrderBy = Nothing + Return GetRecord(join, where, orderBy) + End Function + + ''' + ''' This is a shared function that can be used to get a SexRecord record using a where and order by clause. + ''' + Public Shared Function GetRecord( _ + ByVal where As String, _ + ByVal orderBy As OrderBy) As SexRecord + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + Dim join As BaseClasses.Data.BaseFilter = Nothing + Dim recList As ArrayList = SexTable.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MIN_BATCH_SIZE) + + Dim rec As SexRecord = Nothing + If recList.Count > 0 Then + rec = CType(recList(0), SexRecord) + End If + + Return rec + End Function + + ''' + ''' This is a shared function that can be used to get a SexRecord record using a where and order by clause. + ''' + Public Shared Function GetRecord( _ + ByVal join As BaseFilter, _ + ByVal where As String, _ + ByVal orderBy As OrderBy) As SexRecord + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Dim recList As ArrayList = SexTable.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MIN_BATCH_SIZE) + + Dim rec As SexRecord = Nothing + If recList.Count > 0 Then + rec = CType(recList(0), SexRecord) + End If + + Return rec + End Function + + + Public Shared Function GetValues( _ + ByVal col As BaseColumn, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal maxItems As Integer) As String() + + ' Create the filter list. + Dim retCol As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, True) + retCol.AddColumn(col) + + Return SexTable.Instance.GetColumnValues(retCol, Nothing, where.GetFilter(), Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, maxItems) + + End Function + + Public Shared Function GetValues( _ + ByVal col As BaseColumn, _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal maxItems As Integer) As String() + + ' Create the filter list. + Dim retCol As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, True) + retCol.AddColumn(col) + + Return SexTable.Instance.GetColumnValues(retCol, join, where.GetFilter(), Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, maxItems) + + End Function + + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where clause. + ''' + Public Shared Function GetDataTable(ByVal where As String) As System.Data.DataTable + + Dim recs() As SexRecord = GetRecords(where) + Return SexTable.Instance.CreateDataTable(recs, Nothing) + End Function + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where clause. + ''' + Public Shared Function GetDataTable(ByVal join As BaseFilter, ByVal where As String) As System.Data.DataTable + + Dim recs() As SexRecord = GetRecords(join, where) + Return SexTable.Instance.CreateDataTable(recs, Nothing) + End Function + + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause. + ''' + Public Shared Function GetDataTable(ByVal where As String, ByVal orderBy As OrderBy) As System.Data.DataTable + + Dim recs() As SexRecord = GetRecords(where, orderBy) + Return SexTable.Instance.CreateDataTable(recs, Nothing) + End Function + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause. + ''' + Public Shared Function GetDataTable(ByVal join As BaseFilter, ByVal where As String, ByVal orderBy As OrderBy) As System.Data.DataTable + + Dim recs() As SexRecord = GetRecords(join, where, orderBy) + Return SexTable.Instance.CreateDataTable(recs, Nothing) + End Function + + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause with pagination. + ''' + Public Shared Function GetDataTable( _ + ByVal where As String, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As System.Data.DataTable + + Dim recs() As SexRecord = GetRecords(where, orderBy, pageIndex, pageSize) + Return SexTable.Instance.CreateDataTable(recs, Nothing) + End Function + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause with pagination. + ''' + Public Shared Function GetDataTable( _ + ByVal join As BaseFilter, _ + ByVal where As String, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As System.Data.DataTable + + Dim recs() As SexRecord = GetRecords(join, where, orderBy, pageIndex, pageSize) + Return SexTable.Instance.CreateDataTable(recs, Nothing) + End Function + + + ''' + ''' This is a shared function that can be used to delete records using a where clause. + ''' + Public Shared Sub DeleteRecords(ByVal where As String) + If where = Nothing OrElse where.Trim() = "" Then + Return + End If + + Dim whereFilter As SqlFilter = New SqlFilter(where) + SexTable.Instance.DeleteRecordList(whereFilter) + End Sub + + ''' + ''' This is a shared function that can be used to export records using a where clause. + ''' + Public Shared Function Export(ByVal where As String) As String + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Return SexTable.Instance.ExportRecordData(whereFilter) + End Function + + Public Shared Function Export(ByVal where As WhereClause) As String + Dim whereFilter As BaseFilter = Nothing + If Not where Is Nothing Then + whereFilter = where.GetFilter() + End If + + Return SexTable.Instance.ExportRecordData(whereFilter) + End Function + + Public Shared Function GetSum( _ + ByVal col As BaseColumn, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) _ + As String + + Dim colSel As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, False) + colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Sum) + + Return SexTable.Instance.GetColumnStatistics(colSel, Nothing, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + End Function + + Public Shared Function GetSum( _ + ByVal col As BaseColumn, _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) _ + As String + + Dim colSel As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, False) + colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Sum) + + Return SexTable.Instance.GetColumnStatistics(colSel, join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + End Function + + + Public Shared Function GetCount( _ + ByVal col As BaseColumn, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) _ + As String + + Dim colSel As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, False) + colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Count) + + Return SexTable.Instance.GetColumnStatistics(colSel, Nothing, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + End Function + + Public Shared Function GetCount( _ + ByVal col As BaseColumn, _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) _ + As String + + Dim colSel As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, False) + colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Count) + + Return SexTable.Instance.GetColumnStatistics(colSel, join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + End Function + + ''' + ''' This method returns the columns in the table. + ''' + Public Shared Function GetColumns() As BaseColumn() + Return SexTable.Instance.TableDefinition.Columns + End Function + + ''' + ''' This method returns the columnlist in the table. + ''' + Public Shared Function GetColumnList() As ColumnList + Return SexTable.Instance.TableDefinition.ColumnList + End Function + + + ''' + ''' This method creates a new record and returns it to be edited. + ''' + Public Shared Function CreateNewRecord() As IRecord + Return SexTable.Instance.CreateRecord() + End Function + + ''' + ''' This method creates a new record and returns it to be edited. + ''' + ''' ID of the new record. + Public Shared Function CreateNewRecord(ByVal tempId As String) As IRecord + Return SexTable.Instance.CreateRecord(tempId) + End Function + + ''' + ''' This method checks if column is editable. + ''' + ''' Name of the column to check. + Public Shared Function isReadOnlyColumn(ByVal columnName As String) As Boolean + Dim column As BaseColumn = GetColumn(columnName) + If (Not IsNothing(column)) Then + Return column.IsValuesReadOnly + Else + Return True + End If + End Function + + ''' + ''' This method gets the specified column. + ''' + ''' Unique name of the column to fetch. + Public Shared Function GetColumn(ByVal uniqueColumnName As String) As BaseColumn + Dim column As BaseColumn = SexTable.Instance.TableDefinition.ColumnList.GetByUniqueName(uniqueColumnName) + Return column + End Function + + ' Convenience method for getting a record using a string-based record identifier + Public Shared Function GetRecord(ByVal id As String, ByVal bMutable As Boolean) As SexRecord + Return CType(SexTable.Instance.GetRecordData(id, bMutable), SexRecord) + End Function + + ' Convenience method for getting a record using a KeyValue record identifier + Public Shared Function GetRecord(ByVal id As KeyValue, ByVal bMutable As Boolean) As SexRecord + Return CType(SexTable.Instance.GetRecordData(id, bMutable), SexRecord) + End Function + + ' Convenience method for creating a record + Public Overloads Function NewRecord( _ + ByVal SexIdValue As String, _ + ByVal SexValue As String _ + ) As KeyValue + Dim rec As IPrimaryKeyRecord = CType(Me.CreateRecord(), IPrimaryKeyRecord) + rec.SetString(SexIdValue, SexIdColumn) + rec.SetString(SexValue, SexColumn) + + + rec.Create() 'update the DB so any DB-initialized fields (like autoincrement IDs) can be initialized + + Dim key As KeyValue = rec.GetID() + Return key + End Function + + ''' + ''' This method deletes a specified record + ''' + ''' Keyvalue of the record to be deleted. + Public Shared Sub DeleteRecord(ByVal kv As KeyValue) + SexTable.Instance.DeleteOneRecord(kv) + End Sub + + ''' + ''' This method checks if record exist in the database using the keyvalue provided. + ''' + ''' Key value of the record. + Public Shared Function DoesRecordExist(ByVal kv As KeyValue) As Boolean + Dim recordExist As Boolean = True + Try + SexTable.GetRecord(kv, False) + Catch ex As Exception + recordExist = False + End Try + Return recordExist + End Function + + ''' + ''' This method returns all the primary columns in the table. + ''' + Public Shared Function GetPrimaryKeyColumns() As ColumnList + If (Not IsNothing(SexTable.Instance.TableDefinition.PrimaryKey)) Then + Return SexTable.Instance.TableDefinition.PrimaryKey.Columns + Else + Return Nothing + End If + End Function + + ''' + ''' This method takes a key and returns a keyvalue. + ''' + ''' key could be array of primary key values in case of composite primary key or a string containing single primary key value in case of non-composite primary key. + Public Shared Function GetKeyValue(ByVal key As Object) As KeyValue + Dim kv As KeyValue = Nothing + + If (Not (IsNothing(SexTable.Instance.TableDefinition.PrimaryKey))) Then + + Dim isCompositePrimaryKey As Boolean = False + isCompositePrimaryKey = SexTable.Instance.TableDefinition.PrimaryKey.IsCompositeKey + + If ((isCompositePrimaryKey) AndAlso (key.GetType.IsArray())) Then + + ' If the key is composite, then construct a key value. + kv = New KeyValue + Dim fullKeyString As String = "" + Dim keyArray As Array = CType(key, Array) + If (Not IsNothing(keyArray)) Then + Dim length As Integer = keyArray.Length + Dim pkColumns As ColumnList = SexTable.Instance.TableDefinition.PrimaryKey.Columns + Dim pkColumn As BaseColumn + Dim index As Integer = 0 + For Each pkColumn In pkColumns + Dim keyString As String = CType(keyArray.GetValue(index), String) + If (SexTable.Instance.TableDefinition.TableType = BaseClasses.Data.TableDefinition.TableTypes.Virtual) Then + kv.AddElement(pkColumn.UniqueName, keyString) + Else + kv.AddElement(pkColumn.InternalName, keyString) + End If + index = index + 1 + Next pkColumn + End If + + Else + ' If the key is not composite, then get the key value. + kv = SexTable.Instance.TableDefinition.PrimaryKey.ParseValue(CType(key, String)) + End If + End If + Return kv + End Function + + + ''' + ''' This method takes a record and a Column and returns an evaluated value of DFKA formula. + ''' + Public Shared Function GetDFKA(ByVal rec As BaseRecord, ByVal col As BaseColumn) As String + Dim fkColumn As ForeignKey = SexTable.Instance.TableDefinition.GetExpandableNonCompositeForeignKey(col) + If fkColumn Is Nothing Then + Return Nothing + End If + Dim _DFKA As String = fkColumn.PrimaryKeyDisplayColumns + If (_DFKA.Trim().StartsWith("=")) Then + ' if the formula is in the format of "= ., then pull out the data from the rec object instead of doing formula evaluation + Dim tableCodeName As String = fkColumn.PrimaryKeyTableDefinition.TableCodeName + Dim column As String = _DFKA.Trim("="c).Trim() + If column.StartsWith(tableCodeName & ".", StringComparison.InvariantCultureIgnoreCase) Then + column = column.Substring(tableCodeName.Length + 1) + End If + + For Each c As BaseColumn In fkColumn.PrimaryKeyTableDefinition.Columns + If column = c.CodeName Then + Return rec.Format(c) + End If + Next + Dim tableName As String = fkColumn.PrimaryKeyTableDefinition.TableCodeName + Return EvaluateFormula(_DFKA, rec, Nothing, tableName) + Else + Return Nothing + End If + End Function + + ''' + ''' This method takes a keyValue and a Column and returns an evaluated value of DFKA formula. + ''' + Public Shared Function GetDFKA(ByVal keyValue As String, ByVal col As BaseColumn, ByVal formatPattern as String) As String + If keyValue Is Nothing Then + Return Nothing + End If + Dim fkColumn As ForeignKey = SexTable.Instance.TableDefinition.GetExpandableNonCompositeForeignKey(col) + If fkColumn Is Nothing Then + Return Nothing + End If + Dim _DFKA As String = fkColumn.PrimaryKeyDisplayColumns + If (_DFKA.Trim().StartsWith("=")) Then + Dim tableName As String = fkColumn.PrimaryKeyTableDefinition.TableCodeName + Dim t As PrimaryKeyTable = CType(DatabaseObjects.GetTableObject(tableName), PrimaryKeyTable) + Dim rec As BaseRecord = Nothing + If Not t Is Nothing Then + Try + rec = CType(t.GetRecordData(keyValue, False), BaseRecord) + Catch + rec = Nothing + End Try + End If + If rec Is Nothing Then + Return "" + End If + + ' if the formula is in the format of "= ., then pull out the data from the rec object instead of doing formula evaluation + Dim tableCodeName As String = fkColumn.PrimaryKeyTableDefinition.TableCodeName + Dim column As String = _DFKA.Trim("="c).Trim() + If column.StartsWith(tableCodeName & ".", StringComparison.InvariantCultureIgnoreCase) Then + column = column.Substring(tableCodeName.Length + 1) + End If + + For Each c As BaseColumn In fkColumn.PrimaryKeyTableDefinition.Columns + If column = c.CodeName Then + Return rec.Format(c) + End If + Next + Return EvaluateFormula(_DFKA, rec, Nothing, tableName) + Else + Return Nothing + End If + End Function + + ''' + ''' Evaluates the formula + ''' + Public Shared Function EvaluateFormula(ByVal formula As String, Optional ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord = Nothing, Optional ByVal format As String = Nothing, Optional ByVal name As String = "") As String + Dim e As BaseFormulaEvaluator = New BaseFormulaEvaluator() + If Not dataSourceForEvaluate Is Nothing Then + e.Evaluator.Variables.Add(name, dataSourceForEvaluate) + end if + e.DataSource = dataSourceForEvaluate + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + If Not String.IsNullOrEmpty(format) Then + Return BaseFormulaUtils.Format(resultObj, format) + Else + Return resultObj.ToString() + End If + End Function + + +#End Region + +End Class +End Namespace diff --git a/App_Code/Business Layer/BaseShowPersonalIdTableQuery.vb b/App_Code/Business Layer/BaseShowPersonalIdTableQuery.vb new file mode 100644 index 0000000..c048166 --- /dev/null +++ b/App_Code/Business Layer/BaseShowPersonalIdTableQuery.vb @@ -0,0 +1,1018 @@ +' This class is "generated" and will be overwritten. +' Your customizations should be made in ShowPersonalIdTableQuery.vb + +Imports System.Data.SqlTypes +Imports System.Data +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider +Imports Persons.Data + +Namespace Persons.Business + +''' +''' The generated superclass for the class. +''' Provides access to the schema information and record data of the ShowPersonalIdTable custom query. +''' +''' +''' The connection details (name, location, etc.) of the database and table(s) and/or view(s) accessed by this class +''' are resolved at runtime based on the connection string in the application's Web.Config file. +''' +''' This class is not intended to be instantiated directly. To obtain an instance of this class, use +''' ShowPersonalIdTableQuery.Instance. +''' +''' +''' + + Public Class BaseShowPersonalIdTableQuery + Inherits VirtualTable + + Private ReadOnly TableDefinitionString As String = ShowPersonalIdTableDefinition.GetXMLString() + + Protected Sub New() + MyBase.New() + Me.Initialize() + End Sub + + Protected Overridable Sub Initialize() + Dim def As New XmlTableDefinition(TableDefinitionString) + Me.TableDefinition = New TableDefinition() + def.InitializeTableDefinition(Me.TableDefinition) + Me.TableDefinition.TableClassName = System.Reflection.Assembly.CreateQualifiedName("App_Code", "Persons.Business.ShowPersonalIdTableQuery") + + Me.TableDefinition.VirtualFromClauseTable = BaseTable.CreateInstance("Persons.Business.PersonalIdTable, App_Code").TableDefinition + Me.TableDefinition.VirtualFromClauseTableAlias = "PersonalId" + + Me.ConnectionName = def.GetConnectionName() + Me.RecordClassName = System.Reflection.Assembly.CreateQualifiedName("App_Code", "Persons.Business.ShowPersonalIdTableRecord") + Me.DataAdapter = New ShowPersonalIdTableSqlQuery() + Directcast(Me.DataAdapter, ShowPersonalIdTableSqlQuery).ConnectionName = Me.ConnectionName + + Me.TableDefinition.AdapterMetaData = Me.DataAdapter.AdapterMetaData + Addr_PersonalIdColumn.CodeName = "Addr_PersonalId" + Amphur_PersonalIdColumn.CodeName = "Amphur_PersonalId" + BirthDate_PersonalIdColumn.CodeName = "BirthDate_PersonalId" + Born_PersonalIdColumn.CodeName = "Born_PersonalId" + DeptId_PersonalIdColumn.CodeName = "DeptId_PersonalId" + MobilePhone_PersonalIdColumn.CodeName = "MobilePhone_PersonalId" + OfficerDate_PersonalIdColumn.CodeName = "OfficerDate_PersonalId" + PersonalName_PersonalIdColumn.CodeName = "PersonalName_PersonalId" + picture_PersonalIdColumn.CodeName = "picture_PersonalId" + Province_PersonalIdColumn.CodeName = "Province_PersonalId" + PersonalId_PersonalIdColumn.CodeName = "PersonalId_PersonalId" + RankId_PersonalIdColumn.CodeName = "RankId_PersonalId" + DateRank_PersonalIdColumn.CodeName = "DateRank_PersonalId" + PersonalLastName_PersonalIdColumn.CodeName = "PersonalLastName_PersonalId" + + End Sub + + Public Overrides Property InnerFilter() As BaseFilter + Get + If MyBase.InnerFilter Is Nothing Then + MyBase.InnerFilter = CreateInnerFilter() + End If + + Return MyBase.InnerFilter + End Get + Set(ByVal Value As BaseFilter) + MyBase.InnerFilter = Value + End Set + End Property + + Protected Overridable Function CreateInnerFilter() As BaseFilter + Dim filter As CompoundFilter = New CompoundFilter(CompoundFilter.CompoundingOperators.And_Operator, Nothing) + + + Return filter + + End Function + + + + +#Region "Overriden methods" + +#End Region + +#Region "Properties for columns" + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalId.Addr column object. + ''' + Public ReadOnly Property Addr_PersonalIdColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(0), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalId.Addr column object. + ''' + Public Shared ReadOnly Property Addr_PersonalId() As BaseClasses.Data.StringColumn + Get + Return ShowPersonalIdTableQuery.Instance.Addr_PersonalIdColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonalId.Amphur column object. + ''' + Public ReadOnly Property Amphur_PersonalIdColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(1), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalId.Amphur column object. + ''' + Public Shared ReadOnly Property Amphur_PersonalId() As BaseClasses.Data.StringColumn + Get + Return ShowPersonalIdTableQuery.Instance.Amphur_PersonalIdColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonalId.BirthDate column object. + ''' + Public ReadOnly Property BirthDate_PersonalIdColumn() As BaseClasses.Data.DateColumn + Get + Return CType(Me.TableDefinition.ColumnList(2), BaseClasses.Data.DateColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalId.BirthDate column object. + ''' + Public Shared ReadOnly Property BirthDate_PersonalId() As BaseClasses.Data.DateColumn + Get + Return ShowPersonalIdTableQuery.Instance.BirthDate_PersonalIdColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonalId.Born column object. + ''' + Public ReadOnly Property Born_PersonalIdColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(3), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalId.Born column object. + ''' + Public Shared ReadOnly Property Born_PersonalId() As BaseClasses.Data.StringColumn + Get + Return ShowPersonalIdTableQuery.Instance.Born_PersonalIdColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonalId.DeptId column object. + ''' + Public ReadOnly Property DeptId_PersonalIdColumn() As BaseClasses.Data.NumberColumn + Get + Return CType(Me.TableDefinition.ColumnList(4), BaseClasses.Data.NumberColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalId.DeptId column object. + ''' + Public Shared ReadOnly Property DeptId_PersonalId() As BaseClasses.Data.NumberColumn + Get + Return ShowPersonalIdTableQuery.Instance.DeptId_PersonalIdColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonalId.MobilePhone column object. + ''' + Public ReadOnly Property MobilePhone_PersonalIdColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(5), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalId.MobilePhone column object. + ''' + Public Shared ReadOnly Property MobilePhone_PersonalId() As BaseClasses.Data.StringColumn + Get + Return ShowPersonalIdTableQuery.Instance.MobilePhone_PersonalIdColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonalId.OfficerDate column object. + ''' + Public ReadOnly Property OfficerDate_PersonalIdColumn() As BaseClasses.Data.DateColumn + Get + Return CType(Me.TableDefinition.ColumnList(6), BaseClasses.Data.DateColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalId.OfficerDate column object. + ''' + Public Shared ReadOnly Property OfficerDate_PersonalId() As BaseClasses.Data.DateColumn + Get + Return ShowPersonalIdTableQuery.Instance.OfficerDate_PersonalIdColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonalId.PersonalName column object. + ''' + Public ReadOnly Property PersonalName_PersonalIdColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(7), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalId.PersonalName column object. + ''' + Public Shared ReadOnly Property PersonalName_PersonalId() As BaseClasses.Data.StringColumn + Get + Return ShowPersonalIdTableQuery.Instance.PersonalName_PersonalIdColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonalId.picture column object. + ''' + Public ReadOnly Property picture_PersonalIdColumn() As BaseClasses.Data.ImageColumn + Get + Return CType(Me.TableDefinition.ColumnList(8), BaseClasses.Data.ImageColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalId.picture column object. + ''' + Public Shared ReadOnly Property picture_PersonalId() As BaseClasses.Data.ImageColumn + Get + Return ShowPersonalIdTableQuery.Instance.picture_PersonalIdColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonalId.Province column object. + ''' + Public ReadOnly Property Province_PersonalIdColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(9), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalId.Province column object. + ''' + Public Shared ReadOnly Property Province_PersonalId() As BaseClasses.Data.StringColumn + Get + Return ShowPersonalIdTableQuery.Instance.Province_PersonalIdColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonalId.PersonalId column object. + ''' + Public ReadOnly Property PersonalId_PersonalIdColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(10), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalId.PersonalId column object. + ''' + Public Shared ReadOnly Property PersonalId_PersonalId() As BaseClasses.Data.StringColumn + Get + Return ShowPersonalIdTableQuery.Instance.PersonalId_PersonalIdColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonalId.RankId column object. + ''' + Public ReadOnly Property RankId_PersonalIdColumn() As BaseClasses.Data.NumberColumn + Get + Return CType(Me.TableDefinition.ColumnList(11), BaseClasses.Data.NumberColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalId.RankId column object. + ''' + Public Shared ReadOnly Property RankId_PersonalId() As BaseClasses.Data.NumberColumn + Get + Return ShowPersonalIdTableQuery.Instance.RankId_PersonalIdColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonalId.DateRank column object. + ''' + Public ReadOnly Property DateRank_PersonalIdColumn() As BaseClasses.Data.DateColumn + Get + Return CType(Me.TableDefinition.ColumnList(12), BaseClasses.Data.DateColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalId.DateRank column object. + ''' + Public Shared ReadOnly Property DateRank_PersonalId() As BaseClasses.Data.DateColumn + Get + Return ShowPersonalIdTableQuery.Instance.DateRank_PersonalIdColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's PersonalId.PersonalLastName column object. + ''' + Public ReadOnly Property PersonalLastName_PersonalIdColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(13), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's PersonalId.PersonalLastName column object. + ''' + Public Shared ReadOnly Property PersonalLastName_PersonalId() As BaseClasses.Data.StringColumn + Get + Return ShowPersonalIdTableQuery.Instance.PersonalLastName_PersonalIdColumn + End Get + End Property + + +#End Region + +#Region "Shared helper methods" + + ''' + ''' This is a shared function that can be used to get an array of ShowPersonalIdTableRecord records using a where clause. + ''' + Public Shared Function GetRecords(ByVal where As String) As ShowPersonalIdTableRecord() + + Return GetRecords(where, Nothing, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) + End Function + + ''' + ''' This is a shared function that can be used to get an array of ShowPersonalIdTableRecord records using a where clause. + ''' + Public Shared Function GetRecords(ByVal join As BaseFilter, ByVal where As String) As ShowPersonalIdTableRecord() + + Return GetRecords(join, where, Nothing, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) + End Function + + ''' + ''' This is a shared function that can be used to get an array of ShowPersonalIdTableRecord records using a where and order by clause. + ''' + Public Shared Function GetRecords( _ + ByVal where As String, _ + ByVal orderBy As OrderBy) As ShowPersonalIdTableRecord() + + Return GetRecords(where, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) + End Function + + ''' + ''' This is a shared function that can be used to get an array of ShowPersonalIdTableRecord records using a where and order by clause. + ''' + Public Shared Function GetRecords( _ + ByVal join As BaseFilter, _ + ByVal where As String, _ + ByVal orderBy As OrderBy) As ShowPersonalIdTableRecord() + + Return GetRecords(join, where, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) + End Function + + ''' + ''' This is a shared function that can be used to get an array of ShowPersonalIdTableRecord records using a where and order by clause clause with pagination. + ''' + Public Shared Function GetRecords( _ + ByVal where As String, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As ShowPersonalIdTableRecord() + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + Dim join As BaseClasses.Data.BaseFilter = Nothing + Dim recList As ArrayList = ShowPersonalIdTableQuery.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, pageIndex, pageSize) + + Return CType(recList.ToArray(GetType(Persons.Business.ShowPersonalIdTableRecord)), ShowPersonalIdTableRecord()) + End Function + + ''' + ''' This is a shared function that can be used to get an array of ShowPersonalIdTableRecord records using a where and order by clause clause with pagination. + ''' + Public Shared Function GetRecords( _ + ByVal join As BaseFilter, _ + ByVal where As String, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As ShowPersonalIdTableRecord() + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Dim recList As ArrayList = ShowPersonalIdTableQuery.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, pageIndex, pageSize) + + Return CType(recList.ToArray(GetType(Persons.Business.ShowPersonalIdTableRecord)), ShowPersonalIdTableRecord()) + End Function + + Public Shared Function GetRecords( _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As ShowPersonalIdTableRecord() + Dim join As BaseClasses.Data.BaseFilter = Nothing + Dim recList As ArrayList = ShowPersonalIdTableQuery.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + Return CType(recList.ToArray(GetType(Persons.Business.ShowPersonalIdTableRecord)), ShowPersonalIdTableRecord()) + End Function + + Public Shared Function GetRecords( _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As ShowPersonalIdTableRecord() + + Dim recList As ArrayList = ShowPersonalIdTableQuery.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + Return CType(recList.ToArray(GetType(Persons.Business.ShowPersonalIdTableRecord)), ShowPersonalIdTableRecord()) + End Function + + Public Shared Function GetRecords( _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer, _ + ByRef totalRecords As Integer) As ShowPersonalIdTableRecord() + Dim join As BaseClasses.Data.BaseFilter = Nothing + Dim recList As ArrayList = ShowPersonalIdTableQuery.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize, totalRecords) + + Return CType(recList.ToArray(GetType(Persons.Business.ShowPersonalIdTableRecord)), ShowPersonalIdTableRecord()) + End Function + + Public Shared Function GetRecords( _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer, _ + ByRef totalRecords As Integer) As ShowPersonalIdTableRecord() + + Dim recList As ArrayList = ShowPersonalIdTableQuery.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize, totalRecords) + + Return CType(recList.ToArray(GetType(Persons.Business.ShowPersonalIdTableRecord)), ShowPersonalIdTableRecord()) + End Function + + ''' + ''' This is a shared function that can be used to get total number of records that will be returned using the where clause. + ''' + Public Shared Function GetRecordCount(ByVal where As String) As Integer + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Return CInt(ShowPersonalIdTableQuery.Instance.GetRecordListCount(Nothing, whereFilter, Nothing, Nothing)) + End Function + +''' + ''' This is a shared function that can be used to get total number of records that will be returned using the where clause. + ''' + Public Shared Function GetRecordCount(ByVal join As BaseFilter, ByVal where As String) As Integer + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Return CInt(ShowPersonalIdTableQuery.Instance.GetRecordListCount(join, whereFilter, Nothing, Nothing)) + End Function + + Public Shared Function GetRecordCount(ByVal where As WhereClause) As Integer + Return CInt(ShowPersonalIdTableQuery.Instance.GetRecordListCount(Nothing, where.GetFilter(), Nothing, Nothing)) + End Function + + Public Shared Function GetRecordCount(ByVal join As BaseFilter, ByVal where As WhereClause) As Integer + Return CInt(ShowPersonalIdTableQuery.Instance.GetRecordListCount(join, where.GetFilter(), Nothing, Nothing)) + End Function + + ''' + ''' This is a shared function that can be used to get a ShowPersonalIdTableRecord record using a where clause. + ''' + Public Shared Function GetRecord(ByVal where As String) As ShowPersonalIdTableRecord + Dim orderBy As OrderBy = Nothing + Return GetRecord(where, orderBy) + End Function + + ''' + ''' This is a shared function that can be used to get a ShowPersonalIdTableRecord record using a where clause. + ''' + Public Shared Function GetRecord(ByVal join As BaseFilter, ByVal where As String) As ShowPersonalIdTableRecord + Dim orderBy As OrderBy = Nothing + Return GetRecord(join, where, orderBy) + End Function + + ''' + ''' This is a shared function that can be used to get a ShowPersonalIdTableRecord record using a where and order by clause. + ''' + Public Shared Function GetRecord( _ + ByVal where As String, _ + ByVal orderBy As OrderBy) As ShowPersonalIdTableRecord + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + Dim join As BaseClasses.Data.BaseFilter = Nothing + Dim recList As ArrayList = ShowPersonalIdTableQuery.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MIN_BATCH_SIZE) + + Dim rec As ShowPersonalIdTableRecord = Nothing + If recList.Count > 0 Then + rec = CType(recList(0), ShowPersonalIdTableRecord) + End If + + Return rec + End Function + + ''' + ''' This is a shared function that can be used to get a ShowPersonalIdTableRecord record using a where and order by clause. + ''' + Public Shared Function GetRecord( _ + ByVal join As BaseFilter, _ + ByVal where As String, _ + ByVal orderBy As OrderBy) As ShowPersonalIdTableRecord + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Dim recList As ArrayList = ShowPersonalIdTableQuery.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MIN_BATCH_SIZE) + + Dim rec As ShowPersonalIdTableRecord = Nothing + If recList.Count > 0 Then + rec = CType(recList(0), ShowPersonalIdTableRecord) + End If + + Return rec + End Function + + + Public Shared Function GetValues( _ + ByVal col As BaseColumn, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal maxItems As Integer) As String() + + ' Create the filter list. + Dim retCol As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, True) + retCol.AddColumn(col) + + Return ShowPersonalIdTableQuery.Instance.GetColumnValues(retCol, Nothing, where.GetFilter(), Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, maxItems) + + End Function + + Public Shared Function GetValues( _ + ByVal col As BaseColumn, _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal maxItems As Integer) As String() + + ' Create the filter list. + Dim retCol As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, True) + retCol.AddColumn(col) + + Return ShowPersonalIdTableQuery.Instance.GetColumnValues(retCol, join, where.GetFilter(), Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, maxItems) + + End Function + + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where clause. + ''' + Public Shared Function GetDataTable(ByVal where As String) As System.Data.DataTable + + Dim recs() As ShowPersonalIdTableRecord = GetRecords(where) + Return ShowPersonalIdTableQuery.Instance.CreateDataTable(recs, Nothing) + End Function + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where clause. + ''' + Public Shared Function GetDataTable(ByVal join As BaseFilter, ByVal where As String) As System.Data.DataTable + + Dim recs() As ShowPersonalIdTableRecord = GetRecords(join, where) + Return ShowPersonalIdTableQuery.Instance.CreateDataTable(recs, Nothing) + End Function + + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause. + ''' + Public Shared Function GetDataTable(ByVal where As String, ByVal orderBy As OrderBy) As System.Data.DataTable + + Dim recs() As ShowPersonalIdTableRecord = GetRecords(where, orderBy) + Return ShowPersonalIdTableQuery.Instance.CreateDataTable(recs, Nothing) + End Function + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause. + ''' + Public Shared Function GetDataTable(ByVal join As BaseFilter, ByVal where As String, ByVal orderBy As OrderBy) As System.Data.DataTable + + Dim recs() As ShowPersonalIdTableRecord = GetRecords(join, where, orderBy) + Return ShowPersonalIdTableQuery.Instance.CreateDataTable(recs, Nothing) + End Function + + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause with pagination. + ''' + Public Shared Function GetDataTable( _ + ByVal where As String, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As System.Data.DataTable + + Dim recs() As ShowPersonalIdTableRecord = GetRecords(where, orderBy, pageIndex, pageSize) + Return ShowPersonalIdTableQuery.Instance.CreateDataTable(recs, Nothing) + End Function + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause with pagination. + ''' + Public Shared Function GetDataTable( _ + ByVal join As BaseFilter, _ + ByVal where As String, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As System.Data.DataTable + + Dim recs() As ShowPersonalIdTableRecord = GetRecords(join, where, orderBy, pageIndex, pageSize) + Return ShowPersonalIdTableQuery.Instance.CreateDataTable(recs, Nothing) + End Function + + + ''' + ''' This is a shared function that can be used to delete records using a where clause. + ''' + Public Shared Sub DeleteRecords(ByVal where As String) + If where = Nothing OrElse where.Trim() = "" Then + Return + End If + + Dim whereFilter As SqlFilter = New SqlFilter(where) + ShowPersonalIdTableQuery.Instance.DeleteRecordList(whereFilter) + End Sub + + ''' + ''' This is a shared function that can be used to export records using a where clause. + ''' + Public Shared Function Export(ByVal where As String) As String + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Return ShowPersonalIdTableQuery.Instance.ExportRecordData(whereFilter) + End Function + + Public Shared Function Export(ByVal where As WhereClause) As String + Dim whereFilter As BaseFilter = Nothing + If Not where Is Nothing Then + whereFilter = where.GetFilter() + End If + + Return ShowPersonalIdTableQuery.Instance.ExportRecordData(whereFilter) + End Function + + Public Shared Function GetSum( _ + ByVal col As BaseColumn, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) _ + As String + + Dim colSel As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, False) + colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Sum) + + Return ShowPersonalIdTableQuery.Instance.GetColumnStatistics(colSel, Nothing, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + End Function + + Public Shared Function GetSum( _ + ByVal col As BaseColumn, _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) _ + As String + + Dim colSel As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, False) + colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Sum) + + Return ShowPersonalIdTableQuery.Instance.GetColumnStatistics(colSel, join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + End Function + + + Public Shared Function GetCount( _ + ByVal col As BaseColumn, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) _ + As String + + Dim colSel As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, False) + colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Count) + + Return ShowPersonalIdTableQuery.Instance.GetColumnStatistics(colSel, Nothing, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + End Function + + Public Shared Function GetCount( _ + ByVal col As BaseColumn, _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) _ + As String + + Dim colSel As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, False) + colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Count) + + Return ShowPersonalIdTableQuery.Instance.GetColumnStatistics(colSel, join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + End Function + + ''' + ''' This method returns the columns in the table. + ''' + Public Shared Function GetColumns() As BaseColumn() + Return ShowPersonalIdTableQuery.Instance.TableDefinition.Columns + End Function + + ''' + ''' This method returns the columnlist in the table. + ''' + Public Shared Function GetColumnList() As ColumnList + Return ShowPersonalIdTableQuery.Instance.TableDefinition.ColumnList + End Function + + + ''' + ''' This method creates a new record and returns it to be edited. + ''' + Public Shared Function CreateNewRecord() As IRecord + Return ShowPersonalIdTableQuery.Instance.CreateRecord() + End Function + + ''' + ''' This method creates a new record and returns it to be edited. + ''' + ''' ID of the new record. + Public Shared Function CreateNewRecord(ByVal tempId As String) As IRecord + Return ShowPersonalIdTableQuery.Instance.CreateRecord(tempId) + End Function + + ''' + ''' This method checks if column is editable. + ''' + ''' Name of the column to check. + Public Shared Function isReadOnlyColumn(ByVal columnName As String) As Boolean + Dim column As BaseColumn = GetColumn(columnName) + If (Not IsNothing(column)) Then + Return column.IsValuesReadOnly + Else + Return True + End If + End Function + + ''' + ''' This method gets the specified column. + ''' + ''' Unique name of the column to fetch. + Public Shared Function GetColumn(ByVal uniqueColumnName As String) As BaseColumn + Dim column As BaseColumn = ShowPersonalIdTableQuery.Instance.TableDefinition.ColumnList.GetByUniqueName(uniqueColumnName) + Return column + End Function + + ''' + ''' This method deletes a specified record + ''' + ''' Keyvalue of the record to be deleted. + Public Shared Sub DeleteRecord(ByVal kv As KeyValue) + ShowPersonalIdTableQuery.Instance.DeleteOneRecord(kv) + End Sub + + ''' + ''' This method checks if record exist in the database using the keyvalue provided. + ''' + ''' Key value of the record. + Public Shared Function DoesRecordExist(ByVal kv As KeyValue) As Boolean + Dim recordExist As Boolean = True + Try + ShowPersonalIdTableQuery.GetRecord(kv, False) + Catch ex As Exception + recordExist = False + End Try + Return recordExist + End Function + + ' Convenience method for getting a record using a string-based record identifier + Public Shared Function GetRecord(ByVal id As String, ByVal bMutable As Boolean) As ShowPersonalIdTableRecord + Return CType(ShowPersonalIdTableQuery.Instance.GetRecordData(id, bMutable), ShowPersonalIdTableRecord) + End Function + + ' Convenience method for getting a record using a KeyValue record identifier + Public Shared Function GetRecord(ByVal id As KeyValue, ByVal bMutable As Boolean) As ShowPersonalIdTableRecord + Return CType(ShowPersonalIdTableQuery.Instance.GetRecordData(id, bMutable), ShowPersonalIdTableRecord) + End Function + + ''' + ''' This method returns all the primary columns in the table. + ''' + Public Shared Function GetPrimaryKeyColumns() As ColumnList + If (Not IsNothing(ShowPersonalIdTableQuery.Instance.TableDefinition.PrimaryKey)) Then + Return ShowPersonalIdTableQuery.Instance.TableDefinition.PrimaryKey.Columns + Else + Return Nothing + End If + End Function + + ''' + ''' This method takes a key and returns a keyvalue. + ''' + ''' key could be array of primary key values in case of composite primary key or a string containing single primary key value in case of non-composite primary key. + Public Shared Function GetKeyValue(ByVal key As Object) As KeyValue + Dim kv As KeyValue = Nothing + + If (Not (IsNothing(ShowPersonalIdTableQuery.Instance.TableDefinition.PrimaryKey))) Then + + Dim isCompositePrimaryKey As Boolean = False + isCompositePrimaryKey = ShowPersonalIdTableQuery.Instance.TableDefinition.PrimaryKey.IsCompositeKey + + If ((isCompositePrimaryKey) AndAlso (key.GetType.IsArray())) Then + + ' If the key is composite, then construct a key value. + kv = New KeyValue + Dim fullKeyString As String = "" + Dim keyArray As Array = CType(key, Array) + If (Not IsNothing(keyArray)) Then + Dim length As Integer = keyArray.Length + Dim pkColumns As ColumnList = ShowPersonalIdTableQuery.Instance.TableDefinition.PrimaryKey.Columns + Dim pkColumn As BaseColumn + Dim index As Integer = 0 + For Each pkColumn In pkColumns + Dim keyString As String = CType(keyArray.GetValue(index), String) + If (ShowPersonalIdTableQuery.Instance.TableDefinition.TableType = BaseClasses.Data.TableDefinition.TableTypes.Virtual) Then + kv.AddElement(pkColumn.UniqueName, keyString) + Else + kv.AddElement(pkColumn.InternalName, keyString) + End If + index = index + 1 + Next pkColumn + End If + + Else + ' If the key is not composite, then get the key value. + kv = ShowPersonalIdTableQuery.Instance.TableDefinition.PrimaryKey.ParseValue(CType(key, String)) + End If + End If + Return kv + End Function + + ''' + ''' This method takes a record and a Column and returns an evaluated value of DFKA formula. + ''' + Public Shared Function GetDFKA(ByVal rec As BaseRecord, ByVal col As BaseColumn) As String + Dim fkColumn As ForeignKey = ShowPersonalIdTableQuery.Instance.TableDefinition.GetExpandableNonCompositeForeignKey(col) + If fkColumn Is Nothing Then + Return Nothing + End If + Dim _DFKA As String = fkColumn.PrimaryKeyDisplayColumns + If (_DFKA.Trim().StartsWith("=")) Then + ' if the formula is in the format of "= ., then pull out the data from the rec object instead of doing formula evaluation + Dim tableCodeName As String = fkColumn.PrimaryKeyTableDefinition.TableCodeName + Dim column As String = _DFKA.Trim("="c).Trim() + If column.StartsWith(tableCodeName & ".", StringComparison.InvariantCultureIgnoreCase) Then + column = column.Substring(tableCodeName.Length + 1) + End If + + For Each c As BaseColumn In fkColumn.PrimaryKeyTableDefinition.Columns + If column = c.CodeName Then + Return rec.Format(c) + End If + Next + Dim tableName As String = fkColumn.PrimaryKeyTableDefinition.TableCodeName + Return EvaluateFormula(_DFKA, rec, Nothing, tableName) + Else + Return Nothing + End If + End Function + + ''' + ''' This method takes a keyValue and a Column and returns an evaluated value of DFKA formula. + ''' + Public Shared Function GetDFKA(ByVal keyValue As String, ByVal col As BaseColumn, ByVal formatPattern as String) As String + If keyValue Is Nothing Then + Return Nothing + End If + Dim fkColumn As ForeignKey = ShowPersonalIdTableQuery.Instance.TableDefinition.GetExpandableNonCompositeForeignKey(col) + If fkColumn Is Nothing Then + Return Nothing + End If + Dim _DFKA As String = fkColumn.PrimaryKeyDisplayColumns + If (_DFKA.Trim().StartsWith("=")) Then + Dim tableName As String = fkColumn.PrimaryKeyTableDefinition.TableCodeName + Dim t As PrimaryKeyTable = CType(DatabaseObjects.GetTableObject(tableName), PrimaryKeyTable) + Dim rec As BaseRecord = Nothing + If Not t Is Nothing Then + Try + rec = CType(t.GetRecordData(keyValue, False), BaseRecord) + Catch + rec = Nothing + End Try + End If + If rec Is Nothing Then + Return "" + End If + + ' if the formula is in the format of "= ., then pull out the data from the rec object instead of doing formula evaluation + Dim tableCodeName As String = fkColumn.PrimaryKeyTableDefinition.TableCodeName + Dim column As String = _DFKA.Trim("="c).Trim() + If column.StartsWith(tableCodeName & ".", StringComparison.InvariantCultureIgnoreCase) Then + column = column.Substring(tableCodeName.Length + 1) + End If + + For Each c As BaseColumn In fkColumn.PrimaryKeyTableDefinition.Columns + If column = c.CodeName Then + Return rec.Format(c) + End If + Next + Return EvaluateFormula(_DFKA, rec, Nothing, tableName) + Else + Return Nothing + End If + End Function + + ''' + ''' Evaluates the formula + ''' + Public Shared Function EvaluateFormula(ByVal formula As String, Optional ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord = Nothing, Optional ByVal format As String = Nothing, Optional ByVal name As String = "") As String + Dim e As BaseFormulaEvaluator = New BaseFormulaEvaluator() + If Not dataSourceForEvaluate Is Nothing Then + e.Evaluator.Variables.Add(name, dataSourceForEvaluate) + end if + e.DataSource = dataSourceForEvaluate + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + If Not String.IsNullOrEmpty(format) Then + Return BaseFormulaUtils.Format(resultObj, format) + Else + Return resultObj.ToString() + End If + End Function + +#End Region + +End Class +End Namespace diff --git a/App_Code/Business Layer/BaseShowPersonalIdTableRecord.vb b/App_Code/Business Layer/BaseShowPersonalIdTableRecord.vb new file mode 100644 index 0000000..3bd0c9c --- /dev/null +++ b/App_Code/Business Layer/BaseShowPersonalIdTableRecord.vb @@ -0,0 +1,1099 @@ +' This class is "generated" and will be overwritten. +' Your customizations should be made in ShowPersonalIdTableRecord.vb + +Imports System.Data.SqlTypes +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + +Namespace Persons.Business + +''' +''' The generated superclass for the class. +''' +''' +''' This class is not intended to be instantiated directly. To obtain an instance of this class, +''' use the methods of the class. +''' +''' +''' + + Public Class BaseShowPersonalIdTableRecord + Inherits VirtualRecord + + Public Shared Shadows ReadOnly TableUtils As ShowPersonalIdTableQuery = ShowPersonalIdTableQuery.Instance + + Protected Sub New() + MyBase.New(TableUtils) + Me.LoadInnerRecords() + End Sub + + Public Sub New(ByVal record As VirtualRecord) + MyBase.New(record, TableUtils) + Me.LoadInnerRecords() + End Sub + + 'Evaluates Initialize when->Inserting record formulas specified at the data access layer + Public Overridable Sub ShowPersonalIdTableRecord_InsertingRecord(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles Me.InsertingRecord + 'Apply Initialize->Inserting record formula only if validation is successful. + Dim ShowPersonalIdTableRec As ShowPersonalIdTableRecord = CType(sender,ShowPersonalIdTableRecord) + Validate_Inserting() + If Not ShowPersonalIdTableRec Is Nothing AndAlso Not ShowPersonalIdTableRec.IsReadOnly Then + End If + End Sub + + 'Evaluates Initialize when->Updating record formulas specified at the data access layer + Public Overridable Sub ShowPersonalIdTableRecord_UpdatingRecord(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles Me.UpdatingRecord + 'Apply Initialize->Updating record formula only if validation is successful. + Dim ShowPersonalIdTableRec As ShowPersonalIdTableRecord = CType(sender,ShowPersonalIdTableRecord) + Validate_Updating() + If Not ShowPersonalIdTableRec Is Nothing AndAlso Not ShowPersonalIdTableRec.IsReadOnly Then + End If + End Sub + + 'Evaluates Initialize when->Reading record formulas specified at the data access layer + Public Overridable Sub ShowPersonalIdTableRecord_ReadRecord(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.ReadRecord + 'Apply Initialize->Reading record formula only if validation is successful. + Dim ShowPersonalIdTableRec As ShowPersonalIdTableRecord = CType(sender,ShowPersonalIdTableRecord) + If Not ShowPersonalIdTableRec Is Nothing AndAlso Not ShowPersonalIdTableRec.IsReadOnly Then + End If + End Sub + + 'Evaluates Validate when->Inserting formulas specified at the data access layer + Public Overridable Sub Validate_Inserting () + Dim fullValidationMessage As String = "" + Dim validationMessage As String = "" + + dim formula as String = "" + + + If validationMessage <> "" AndAlso validationMessage.ToLower() <> "true" Then + fullValidationMessage &= validationMessage & vbCrLf + End If + + If fullValidationMessage <> "" Then + Throw New Exception(fullValidationMessage) + End If + End Sub + + 'Evaluates Validate when->Updating formulas specified at the data access layer + Public Overridable Sub Validate_Updating () + Dim fullValidationMessage As String = "" + Dim validationMessage As String = "" + + dim formula as String = "" + + + If validationMessage <> "" AndAlso validationMessage.ToLower() <> "true" Then + fullValidationMessage &= validationMessage & vbCrLf + End If + + If fullValidationMessage <> "" Then + Throw New Exception(fullValidationMessage) + End If + End Sub + + Public Overridable Function EvaluateFormula(ByVal formula As String, Optional ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord = Nothing, Optional ByVal format As String = Nothing) As String + + Dim e As Data.BaseFormulaEvaluator = New Data.BaseFormulaEvaluator() + + ' All variables referred to in the formula are expected to be + ' properties of the DataSource. For example, referring to + ' UnitPrice as a variable will refer to DataSource.UnitPrice + e.DataSource = dataSourceForEvaluate + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + Return resultObj.ToString() + End Function + +#Region "Convenience method implementations for columns" + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalId.Addr field. + ''' + Public Function GetAddr_PersonalIdValue() As ColumnValue + Return Me.GetValue(TableUtils.Addr_PersonalIdColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalId.Addr field. + ''' + Public Function GetAddr_PersonalIdFieldValue() As String + Return CType(Me.GetValue(TableUtils.Addr_PersonalIdColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalId.Addr field. + ''' + Public Sub SetAddr_PersonalIdFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.Addr_PersonalIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalId.Addr field. + ''' + Public Sub SetAddr_PersonalIdFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.Addr_PersonalIdColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalId.Amphur field. + ''' + Public Function GetAmphur_PersonalIdValue() As ColumnValue + Return Me.GetValue(TableUtils.Amphur_PersonalIdColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalId.Amphur field. + ''' + Public Function GetAmphur_PersonalIdFieldValue() As String + Return CType(Me.GetValue(TableUtils.Amphur_PersonalIdColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalId.Amphur field. + ''' + Public Sub SetAmphur_PersonalIdFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.Amphur_PersonalIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalId.Amphur field. + ''' + Public Sub SetAmphur_PersonalIdFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.Amphur_PersonalIdColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalId.BirthDate field. + ''' + Public Function GetBirthDate_PersonalIdValue() As ColumnValue + Return Me.GetValue(TableUtils.BirthDate_PersonalIdColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalId.BirthDate field. + ''' + Public Function GetBirthDate_PersonalIdFieldValue() As DateTime + Return CType(Me.GetValue(TableUtils.BirthDate_PersonalIdColumn).ToDateTime(), DateTime) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalId.BirthDate field. + ''' + Public Sub SetBirthDate_PersonalIdFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.BirthDate_PersonalIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalId.BirthDate field. + ''' + Public Sub SetBirthDate_PersonalIdFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.BirthDate_PersonalIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalId.BirthDate field. + ''' + Public Sub SetBirthDate_PersonalIdFieldValue(ByVal val As DateTime) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.BirthDate_PersonalIdColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalId.Born field. + ''' + Public Function GetBorn_PersonalIdValue() As ColumnValue + Return Me.GetValue(TableUtils.Born_PersonalIdColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalId.Born field. + ''' + Public Function GetBorn_PersonalIdFieldValue() As String + Return CType(Me.GetValue(TableUtils.Born_PersonalIdColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalId.Born field. + ''' + Public Sub SetBorn_PersonalIdFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.Born_PersonalIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalId.Born field. + ''' + Public Sub SetBorn_PersonalIdFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.Born_PersonalIdColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalId.DeptId field. + ''' + Public Function GetDeptId_PersonalIdValue() As ColumnValue + Return Me.GetValue(TableUtils.DeptId_PersonalIdColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalId.DeptId field. + ''' + Public Function GetDeptId_PersonalIdFieldValue() As Int16 + Return CType(Me.GetValue(TableUtils.DeptId_PersonalIdColumn).ToInt16(), Int16) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalId.DeptId field. + ''' + Public Sub SetDeptId_PersonalIdFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.DeptId_PersonalIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalId.DeptId field. + ''' + Public Sub SetDeptId_PersonalIdFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.DeptId_PersonalIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalId.DeptId field. + ''' + Public Sub SetDeptId_PersonalIdFieldValue(ByVal val As Double) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.DeptId_PersonalIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalId.DeptId field. + ''' + Public Sub SetDeptId_PersonalIdFieldValue(ByVal val As Decimal) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.DeptId_PersonalIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalId.DeptId field. + ''' + Public Sub SetDeptId_PersonalIdFieldValue(ByVal val As Int64) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.DeptId_PersonalIdColumn) + End Sub + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalId.MobilePhone field. + ''' + Public Function GetMobilePhone_PersonalIdValue() As ColumnValue + Return Me.GetValue(TableUtils.MobilePhone_PersonalIdColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalId.MobilePhone field. + ''' + Public Function GetMobilePhone_PersonalIdFieldValue() As String + Return CType(Me.GetValue(TableUtils.MobilePhone_PersonalIdColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalId.MobilePhone field. + ''' + Public Sub SetMobilePhone_PersonalIdFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.MobilePhone_PersonalIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalId.MobilePhone field. + ''' + Public Sub SetMobilePhone_PersonalIdFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.MobilePhone_PersonalIdColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalId.OfficerDate field. + ''' + Public Function GetOfficerDate_PersonalIdValue() As ColumnValue + Return Me.GetValue(TableUtils.OfficerDate_PersonalIdColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalId.OfficerDate field. + ''' + Public Function GetOfficerDate_PersonalIdFieldValue() As DateTime + Return CType(Me.GetValue(TableUtils.OfficerDate_PersonalIdColumn).ToDateTime(), DateTime) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalId.OfficerDate field. + ''' + Public Sub SetOfficerDate_PersonalIdFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.OfficerDate_PersonalIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalId.OfficerDate field. + ''' + Public Sub SetOfficerDate_PersonalIdFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.OfficerDate_PersonalIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalId.OfficerDate field. + ''' + Public Sub SetOfficerDate_PersonalIdFieldValue(ByVal val As DateTime) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.OfficerDate_PersonalIdColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalId.PersonalName field. + ''' + Public Function GetPersonalName_PersonalIdValue() As ColumnValue + Return Me.GetValue(TableUtils.PersonalName_PersonalIdColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalId.PersonalName field. + ''' + Public Function GetPersonalName_PersonalIdFieldValue() As String + Return CType(Me.GetValue(TableUtils.PersonalName_PersonalIdColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalId.PersonalName field. + ''' + Public Sub SetPersonalName_PersonalIdFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.PersonalName_PersonalIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalId.PersonalName field. + ''' + Public Sub SetPersonalName_PersonalIdFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.PersonalName_PersonalIdColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalId.picture field. + ''' + Public Function Getpicture_PersonalIdValue() As ColumnValue + Return Me.GetValue(TableUtils.picture_PersonalIdColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalId.picture field. + ''' + Public Function Getpicture_PersonalIdFieldValue() As Byte() + Return CType(Me.GetValue(TableUtils.picture_PersonalIdColumn).ToBinary(), Byte()) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalId.picture field. + ''' + Public Sub Setpicture_PersonalIdFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.picture_PersonalIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalId.picture field. + ''' + Public Sub Setpicture_PersonalIdFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.picture_PersonalIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalId.picture field. + ''' + Public Sub Setpicture_PersonalIdFieldValue(ByVal val As Byte ()) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.picture_PersonalIdColumn) + End Sub + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalId.Province field. + ''' + Public Function GetProvince_PersonalIdValue() As ColumnValue + Return Me.GetValue(TableUtils.Province_PersonalIdColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalId.Province field. + ''' + Public Function GetProvince_PersonalIdFieldValue() As String + Return CType(Me.GetValue(TableUtils.Province_PersonalIdColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalId.Province field. + ''' + Public Sub SetProvince_PersonalIdFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.Province_PersonalIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalId.Province field. + ''' + Public Sub SetProvince_PersonalIdFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.Province_PersonalIdColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalId.PersonalId field. + ''' + Public Function GetPersonalId_PersonalIdValue() As ColumnValue + Return Me.GetValue(TableUtils.PersonalId_PersonalIdColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalId.PersonalId field. + ''' + Public Function GetPersonalId_PersonalIdFieldValue() As String + Return CType(Me.GetValue(TableUtils.PersonalId_PersonalIdColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalId.PersonalId field. + ''' + Public Sub SetPersonalId_PersonalIdFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.PersonalId_PersonalIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalId.PersonalId field. + ''' + Public Sub SetPersonalId_PersonalIdFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.PersonalId_PersonalIdColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalId.RankId field. + ''' + Public Function GetRankId_PersonalIdValue() As ColumnValue + Return Me.GetValue(TableUtils.RankId_PersonalIdColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalId.RankId field. + ''' + Public Function GetRankId_PersonalIdFieldValue() As Int32 + Return CType(Me.GetValue(TableUtils.RankId_PersonalIdColumn).ToInt32(), Int32) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalId.RankId field. + ''' + Public Sub SetRankId_PersonalIdFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.RankId_PersonalIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalId.RankId field. + ''' + Public Sub SetRankId_PersonalIdFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.RankId_PersonalIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalId.RankId field. + ''' + Public Sub SetRankId_PersonalIdFieldValue(ByVal val As Double) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.RankId_PersonalIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalId.RankId field. + ''' + Public Sub SetRankId_PersonalIdFieldValue(ByVal val As Decimal) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.RankId_PersonalIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalId.RankId field. + ''' + Public Sub SetRankId_PersonalIdFieldValue(ByVal val As Int64) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.RankId_PersonalIdColumn) + End Sub + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalId.DateRank field. + ''' + Public Function GetDateRank_PersonalIdValue() As ColumnValue + Return Me.GetValue(TableUtils.DateRank_PersonalIdColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalId.DateRank field. + ''' + Public Function GetDateRank_PersonalIdFieldValue() As DateTime + Return CType(Me.GetValue(TableUtils.DateRank_PersonalIdColumn).ToDateTime(), DateTime) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalId.DateRank field. + ''' + Public Sub SetDateRank_PersonalIdFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.DateRank_PersonalIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalId.DateRank field. + ''' + Public Sub SetDateRank_PersonalIdFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.DateRank_PersonalIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalId.DateRank field. + ''' + Public Sub SetDateRank_PersonalIdFieldValue(ByVal val As DateTime) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.DateRank_PersonalIdColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalId.PersonalLastName field. + ''' + Public Function GetPersonalLastName_PersonalIdValue() As ColumnValue + Return Me.GetValue(TableUtils.PersonalLastName_PersonalIdColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's PersonalId.PersonalLastName field. + ''' + Public Function GetPersonalLastName_PersonalIdFieldValue() As String + Return CType(Me.GetValue(TableUtils.PersonalLastName_PersonalIdColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalId.PersonalLastName field. + ''' + Public Sub SetPersonalLastName_PersonalIdFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.PersonalLastName_PersonalIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's PersonalId.PersonalLastName field. + ''' + Public Sub SetPersonalLastName_PersonalIdFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.PersonalLastName_PersonalIdColumn) + End Sub + + + +#End Region + +#Region "Convenience method implementations for column names" + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonalId.Addr field. + ''' + Public Property Addr_PersonalId() As String + Get + Return CType(Me.GetValue(TableUtils.Addr_PersonalIdColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.Addr_PersonalIdColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property Addr_PersonalIdSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.Addr_PersonalIdColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property Addr_PersonalIdDefault() As String + Get + Return TableUtils.Addr_PersonalIdColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonalId.Amphur field. + ''' + Public Property Amphur_PersonalId() As String + Get + Return CType(Me.GetValue(TableUtils.Amphur_PersonalIdColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.Amphur_PersonalIdColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property Amphur_PersonalIdSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.Amphur_PersonalIdColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property Amphur_PersonalIdDefault() As String + Get + Return TableUtils.Amphur_PersonalIdColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonalId.BirthDate field. + ''' + Public Property BirthDate_PersonalId() As DateTime + Get + Return CType(Me.GetValue(TableUtils.BirthDate_PersonalIdColumn).ToDateTime(), DateTime) + End Get + Set (ByVal val As DateTime) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.BirthDate_PersonalIdColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property BirthDate_PersonalIdSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.BirthDate_PersonalIdColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property BirthDate_PersonalIdDefault() As String + Get + Return TableUtils.BirthDate_PersonalIdColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonalId.Born field. + ''' + Public Property Born_PersonalId() As String + Get + Return CType(Me.GetValue(TableUtils.Born_PersonalIdColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.Born_PersonalIdColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property Born_PersonalIdSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.Born_PersonalIdColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property Born_PersonalIdDefault() As String + Get + Return TableUtils.Born_PersonalIdColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonalId.DeptId field. + ''' + Public Property DeptId_PersonalId() As Int16 + Get + Return CType(Me.GetValue(TableUtils.DeptId_PersonalIdColumn).ToInt16(), Int16) + End Get + Set (ByVal val As Int16) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.DeptId_PersonalIdColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property DeptId_PersonalIdSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.DeptId_PersonalIdColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property DeptId_PersonalIdDefault() As String + Get + Return TableUtils.DeptId_PersonalIdColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonalId.MobilePhone field. + ''' + Public Property MobilePhone_PersonalId() As String + Get + Return CType(Me.GetValue(TableUtils.MobilePhone_PersonalIdColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.MobilePhone_PersonalIdColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property MobilePhone_PersonalIdSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.MobilePhone_PersonalIdColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property MobilePhone_PersonalIdDefault() As String + Get + Return TableUtils.MobilePhone_PersonalIdColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonalId.OfficerDate field. + ''' + Public Property OfficerDate_PersonalId() As DateTime + Get + Return CType(Me.GetValue(TableUtils.OfficerDate_PersonalIdColumn).ToDateTime(), DateTime) + End Get + Set (ByVal val As DateTime) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.OfficerDate_PersonalIdColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property OfficerDate_PersonalIdSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.OfficerDate_PersonalIdColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property OfficerDate_PersonalIdDefault() As String + Get + Return TableUtils.OfficerDate_PersonalIdColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonalId.PersonalName field. + ''' + Public Property PersonalName_PersonalId() As String + Get + Return CType(Me.GetValue(TableUtils.PersonalName_PersonalIdColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.PersonalName_PersonalIdColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property PersonalName_PersonalIdSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.PersonalName_PersonalIdColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property PersonalName_PersonalIdDefault() As String + Get + Return TableUtils.PersonalName_PersonalIdColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonalId.picture field. + ''' + Public Property picture_PersonalId() As Byte() + Get + Return CType(Me.GetValue(TableUtils.picture_PersonalIdColumn).ToBinary(), Byte()) + End Get + Set (ByVal val As Byte ()) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.picture_PersonalIdColumn) + End Set + End Property + + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property picture_PersonalIdSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.picture_PersonalIdColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property picture_PersonalIdDefault() As String + Get + Return TableUtils.picture_PersonalIdColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonalId.Province field. + ''' + Public Property Province_PersonalId() As String + Get + Return CType(Me.GetValue(TableUtils.Province_PersonalIdColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.Province_PersonalIdColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property Province_PersonalIdSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.Province_PersonalIdColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property Province_PersonalIdDefault() As String + Get + Return TableUtils.Province_PersonalIdColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonalId.PersonalId field. + ''' + Public Property PersonalId_PersonalId() As String + Get + Return CType(Me.GetValue(TableUtils.PersonalId_PersonalIdColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.PersonalId_PersonalIdColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property PersonalId_PersonalIdSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.PersonalId_PersonalIdColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property PersonalId_PersonalIdDefault() As String + Get + Return TableUtils.PersonalId_PersonalIdColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonalId.RankId field. + ''' + Public Property RankId_PersonalId() As Int32 + Get + Return CType(Me.GetValue(TableUtils.RankId_PersonalIdColumn).ToInt32(), Int32) + End Get + Set (ByVal val As Int32) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.RankId_PersonalIdColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property RankId_PersonalIdSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.RankId_PersonalIdColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property RankId_PersonalIdDefault() As String + Get + Return TableUtils.RankId_PersonalIdColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonalId.DateRank field. + ''' + Public Property DateRank_PersonalId() As DateTime + Get + Return CType(Me.GetValue(TableUtils.DateRank_PersonalIdColumn).ToDateTime(), DateTime) + End Get + Set (ByVal val As DateTime) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.DateRank_PersonalIdColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property DateRank_PersonalIdSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.DateRank_PersonalIdColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property DateRank_PersonalIdDefault() As String + Get + Return TableUtils.DateRank_PersonalIdColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's PersonalId.PersonalLastName field. + ''' + Public Property PersonalLastName_PersonalId() As String + Get + Return CType(Me.GetValue(TableUtils.PersonalLastName_PersonalIdColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.PersonalLastName_PersonalIdColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property PersonalLastName_PersonalIdSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.PersonalLastName_PersonalIdColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property PersonalLastName_PersonalIdDefault() As String + Get + Return TableUtils.PersonalLastName_PersonalIdColumn.DefaultValue + End Get + End Property + + + +#End Region + +End Class +End Namespace diff --git a/App_Code/Business Layer/BaseSportRecord.vb b/App_Code/Business Layer/BaseSportRecord.vb new file mode 100644 index 0000000..fe6d6b1 --- /dev/null +++ b/App_Code/Business Layer/BaseSportRecord.vb @@ -0,0 +1,283 @@ +' This class is "generated" and will be overwritten. +' Your customizations should be made in SportRecord.vb + +Imports System.Data.SqlTypes +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + +Namespace Persons.Business + +''' +''' The generated superclass for the class. +''' +''' +''' This class is not intended to be instantiated directly. To obtain an instance of this class, +''' use the methods of the class. +''' +''' +''' + + Public Class BaseSportRecord + Inherits PrimaryKeyRecord + + + Public Shared Shadows ReadOnly TableUtils As SportTable = SportTable.Instance + + ' Constructors + + Protected Sub New() + MyBase.New(TableUtils) + End Sub + + Protected Sub New(ByVal record As PrimaryKeyRecord) + MyBase.New(record, TableUtils) + End Sub + + 'Evaluates Initialize when->Inserting record formulas specified at the data access layer + Public Overridable Sub SportRecord_InsertingRecord(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles Me.InsertingRecord + 'Apply Initialize->Inserting record formula only if validation is successful. + Dim SportRec As SportRecord = CType(sender,SportRecord) + Validate_Inserting() + If Not SportRec Is Nothing AndAlso Not SportRec.IsReadOnly Then + End If + End Sub + + 'Evaluates Initialize when->Updating record formulas specified at the data access layer + Public Overridable Sub SportRecord_UpdatingRecord(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles Me.UpdatingRecord + 'Apply Initialize->Updating record formula only if validation is successful. + Dim SportRec As SportRecord = CType(sender,SportRecord) + Validate_Updating() + If Not SportRec Is Nothing AndAlso Not SportRec.IsReadOnly Then + End If + End Sub + + 'Evaluates Initialize when->Reading record formulas specified at the data access layer + Public Overridable Sub SportRecord_ReadRecord(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.ReadRecord + 'Apply Initialize->Reading record formula only if validation is successful. + Dim SportRec As SportRecord = CType(sender,SportRecord) + If Not SportRec Is Nothing AndAlso Not SportRec.IsReadOnly Then + End If + End Sub + + 'Evaluates Validate when->Inserting formulas specified at the data access layer + Public Overridable Sub Validate_Inserting () + Dim fullValidationMessage As String = "" + Dim validationMessage As String = "" + + dim formula as String = "" + + + If validationMessage <> "" AndAlso validationMessage.ToLower() <> "true" Then + fullValidationMessage &= validationMessage & vbCrLf + End If + + If fullValidationMessage <> "" Then + Throw New Exception(fullValidationMessage) + End If + End Sub + + 'Evaluates Validate when->Updating formulas specified at the data access layer + Public Overridable Sub Validate_Updating () + Dim fullValidationMessage As String = "" + Dim validationMessage As String = "" + + dim formula as String = "" + + + If validationMessage <> "" AndAlso validationMessage.ToLower() <> "true" Then + fullValidationMessage &= validationMessage & vbCrLf + End If + + If fullValidationMessage <> "" Then + Throw New Exception(fullValidationMessage) + End If + End Sub + + Public Overridable Function EvaluateFormula(ByVal formula As String, Optional ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord = Nothing, Optional ByVal format As String = Nothing) As String + + Dim e As Data.BaseFormulaEvaluator = New Data.BaseFormulaEvaluator() + + ' All variables referred to in the formula are expected to be + ' properties of the DataSource. For example, referring to + ' UnitPrice as a variable will refer to DataSource.UnitPrice + e.DataSource = dataSourceForEvaluate + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + Return resultObj.ToString() + End Function + + + + + + + +#Region "Convenience methods to get/set values of fields" + + ''' + ''' This is a convenience method that provides direct access to the value of the record's Sport_.SportId field. + ''' + Public Function GetSportIdValue() As ColumnValue + Return Me.GetValue(TableUtils.SportIdColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's Sport_.SportId field. + ''' + Public Function GetSportIdFieldValue() As Int16 + Return CType(Me.GetValue(TableUtils.SportIdColumn).ToInt16(), Int16) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Sport_.SportId field. + ''' + Public Sub SetSportIdFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.SportIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Sport_.SportId field. + ''' + Public Sub SetSportIdFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.SportIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Sport_.SportId field. + ''' + Public Sub SetSportIdFieldValue(ByVal val As Double) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.SportIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Sport_.SportId field. + ''' + Public Sub SetSportIdFieldValue(ByVal val As Decimal) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.SportIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Sport_.SportId field. + ''' + Public Sub SetSportIdFieldValue(ByVal val As Int64) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.SportIdColumn) + End Sub + ''' + ''' This is a convenience method that provides direct access to the value of the record's Sport_.SPORT field. + ''' + Public Function GetSPORTValue() As ColumnValue + Return Me.GetValue(TableUtils.SPORTColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's Sport_.SPORT field. + ''' + Public Function GetSPORTFieldValue() As String + Return CType(Me.GetValue(TableUtils.SPORTColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Sport_.SPORT field. + ''' + Public Sub SetSPORTFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.SPORTColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Sport_.SPORT field. + ''' + Public Sub SetSPORTFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.SPORTColumn) + End Sub + + + +#End Region + +#Region "Convenience methods to get field names" + + ''' + ''' This is a convenience property that provides direct access to the value of the record's Sport_.SportId field. + ''' + Public Property SportId() As Int16 + Get + Return CType(Me.GetValue(TableUtils.SportIdColumn).ToInt16(), Int16) + End Get + Set (ByVal val As Int16) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.SportIdColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property SportIdSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.SportIdColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property SportIdDefault() As String + Get + Return TableUtils.SportIdColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's Sport_.SPORT field. + ''' + Public Property SPORT() As String + Get + Return CType(Me.GetValue(TableUtils.SPORTColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.SPORTColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property SPORTSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.SPORTColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property SPORTDefault() As String + Get + Return TableUtils.SPORTColumn.DefaultValue + End Get + End Property + + + +#End Region + +End Class +End Namespace diff --git a/App_Code/Business Layer/BaseSportTable.vb b/App_Code/Business Layer/BaseSportTable.vb new file mode 100644 index 0000000..3d56bcd --- /dev/null +++ b/App_Code/Business Layer/BaseSportTable.vb @@ -0,0 +1,778 @@ +' This class is "generated" and will be overwritten. +' Your customizations should be made in SportRecord.vb + +Imports System.Data.SqlTypes +Imports System.Data +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider +Imports Persons.Data + +Namespace Persons.Business + +''' +''' The generated superclass for the class. +''' Provides access to the schema information and record data of a database table or view named Sport. +''' +''' +''' The connection details (name, location, etc.) of the database and table (or view) accessed by this class +''' are resolved at runtime based on the connection string in the application's Web.Config file. +''' +''' This class is not intended to be instantiated directly. To obtain an instance of this class, use +''' SportTable.Instance. +''' +''' +''' + + Public Class BaseSportTable + Inherits PrimaryKeyTable + + + Private ReadOnly TableDefinitionString As String = SportDefinition.GetXMLString() + + + + + + + + Protected Sub New() + MyBase.New() + Me.Initialize() + End Sub + + Protected Overridable Sub Initialize() + Dim def As New XmlTableDefinition(TableDefinitionString) + Me.TableDefinition = New TableDefinition() + Me.TableDefinition.TableClassName = System.Reflection.Assembly.CreateQualifiedName("App_Code", "Persons.Business.SportTable") + def.InitializeTableDefinition(Me.TableDefinition) + Me.ConnectionName = def.GetConnectionName() + Me.RecordClassName = System.Reflection.Assembly.CreateQualifiedName("App_Code", "Persons.Business.SportRecord") + Me.ApplicationName = "App_Code" + Me.DataAdapter = New SportSqlTable() + Directcast(Me.DataAdapter, SportSqlTable).ConnectionName = Me.ConnectionName + + Me.TableDefinition.AdapterMetaData = Me.DataAdapter.AdapterMetaData + SportIdColumn.CodeName = "SportId" + SPORTColumn.CodeName = "SPORT" + + End Sub + +#Region "Overriden methods" + + +#End Region + +#Region "Properties for columns" + + ''' + ''' This is a convenience property that provides direct access to the table's Sport_.SportId column object. + ''' + Public ReadOnly Property SportIdColumn() As BaseClasses.Data.NumberColumn + Get + Return CType(Me.TableDefinition.ColumnList(0), BaseClasses.Data.NumberColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's Sport_.SportId column object. + ''' + Public Shared ReadOnly Property SportId() As BaseClasses.Data.NumberColumn + Get + Return SportTable.Instance.SportIdColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's Sport_.SPORT column object. + ''' + Public ReadOnly Property SPORTColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(1), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's Sport_.SPORT column object. + ''' + Public Shared ReadOnly Property SPORT() As BaseClasses.Data.StringColumn + Get + Return SportTable.Instance.SPORTColumn + End Get + End Property + + +#End Region + + +#Region "Shared helper methods" + + ''' + ''' This is a shared function that can be used to get an array of SportRecord records using a where clause. + ''' + Public Shared Function GetRecords(ByVal where As String) As SportRecord() + + Return GetRecords(where, Nothing, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) + End Function + + ''' + ''' This is a shared function that can be used to get an array of SportRecord records using a where clause. + ''' + Public Shared Function GetRecords(ByVal join As BaseFilter, ByVal where As String) As SportRecord() + + Return GetRecords(join, where, Nothing, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) + End Function + + ''' + ''' This is a shared function that can be used to get an array of SportRecord records using a where and order by clause. + ''' + Public Shared Function GetRecords( _ + ByVal where As String, _ + ByVal orderBy As OrderBy) As SportRecord() + + Return GetRecords(where, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) + End Function + + ''' + ''' This is a shared function that can be used to get an array of SportRecord records using a where and order by clause. + ''' + Public Shared Function GetRecords( _ + ByVal join As BaseFilter, _ + ByVal where As String, _ + ByVal orderBy As OrderBy) As SportRecord() + + Return GetRecords(join, where, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) + End Function + + ''' + ''' This is a shared function that can be used to get an array of SportRecord records using a where and order by clause clause with pagination. + ''' + Public Shared Function GetRecords( _ + ByVal where As String, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As SportRecord() + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + Dim join As BaseClasses.Data.BaseFilter = Nothing + Dim recList As ArrayList = SportTable.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, pageIndex, pageSize) + + Return CType(recList.ToArray(GetType(Persons.Business.SportRecord)), SportRecord()) + End Function + + ''' + ''' This is a shared function that can be used to get an array of SportRecord records using a where and order by clause clause with pagination. + ''' + Public Shared Function GetRecords( _ + ByVal join As BaseFilter, _ + ByVal where As String, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As SportRecord() + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Dim recList As ArrayList = SportTable.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, pageIndex, pageSize) + + Return CType(recList.ToArray(GetType(Persons.Business.SportRecord)), SportRecord()) + End Function + + Public Shared Function GetRecords( _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As SportRecord() + Dim join As BaseClasses.Data.BaseFilter = Nothing + Dim recList As ArrayList = SportTable.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + Return CType(recList.ToArray(GetType(Persons.Business.SportRecord)), SportRecord()) + End Function + + Public Shared Function GetRecords( _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As SportRecord() + + Dim recList As ArrayList = SportTable.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + Return CType(recList.ToArray(GetType(Persons.Business.SportRecord)), SportRecord()) + End Function + + Public Shared Function GetRecords( _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer, _ + ByRef totalRecords As Integer) As SportRecord() + Dim join As BaseClasses.Data.BaseFilter = Nothing + Dim recList As ArrayList = SportTable.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize, totalRecords) + + Return CType(recList.ToArray(GetType(Persons.Business.SportRecord)), SportRecord()) + End Function + + Public Shared Function GetRecords( _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer, _ + ByRef totalRecords As Integer) As SportRecord() + + Dim recList As ArrayList = SportTable.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize, totalRecords) + + Return CType(recList.ToArray(GetType(Persons.Business.SportRecord)), SportRecord()) + End Function + + ''' + ''' This is a shared function that can be used to get total number of records that will be returned using the where clause. + ''' + Public Shared Function GetRecordCount(ByVal where As String) As Integer + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Return CInt(SportTable.Instance.GetRecordListCount(Nothing, whereFilter, Nothing, Nothing)) + End Function + +''' + ''' This is a shared function that can be used to get total number of records that will be returned using the where clause. + ''' + Public Shared Function GetRecordCount(ByVal join As BaseFilter, ByVal where As String) As Integer + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Return CInt(SportTable.Instance.GetRecordListCount(join, whereFilter, Nothing, Nothing)) + End Function + + Public Shared Function GetRecordCount(ByVal where As WhereClause) As Integer + Return CInt(SportTable.Instance.GetRecordListCount(Nothing, where.GetFilter(), Nothing, Nothing)) + End Function + + Public Shared Function GetRecordCount(ByVal join As BaseFilter, ByVal where As WhereClause) As Integer + Return CInt(SportTable.Instance.GetRecordListCount(join, where.GetFilter(), Nothing, Nothing)) + End Function + + ''' + ''' This is a shared function that can be used to get a SportRecord record using a where clause. + ''' + Public Shared Function GetRecord(ByVal where As String) As SportRecord + Dim orderBy As OrderBy = Nothing + Return GetRecord(where, orderBy) + End Function + + ''' + ''' This is a shared function that can be used to get a SportRecord record using a where clause. + ''' + Public Shared Function GetRecord(ByVal join As BaseFilter, ByVal where As String) As SportRecord + Dim orderBy As OrderBy = Nothing + Return GetRecord(join, where, orderBy) + End Function + + ''' + ''' This is a shared function that can be used to get a SportRecord record using a where and order by clause. + ''' + Public Shared Function GetRecord( _ + ByVal where As String, _ + ByVal orderBy As OrderBy) As SportRecord + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + Dim join As BaseClasses.Data.BaseFilter = Nothing + Dim recList As ArrayList = SportTable.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MIN_BATCH_SIZE) + + Dim rec As SportRecord = Nothing + If recList.Count > 0 Then + rec = CType(recList(0), SportRecord) + End If + + Return rec + End Function + + ''' + ''' This is a shared function that can be used to get a SportRecord record using a where and order by clause. + ''' + Public Shared Function GetRecord( _ + ByVal join As BaseFilter, _ + ByVal where As String, _ + ByVal orderBy As OrderBy) As SportRecord + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Dim recList As ArrayList = SportTable.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MIN_BATCH_SIZE) + + Dim rec As SportRecord = Nothing + If recList.Count > 0 Then + rec = CType(recList(0), SportRecord) + End If + + Return rec + End Function + + + Public Shared Function GetValues( _ + ByVal col As BaseColumn, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal maxItems As Integer) As String() + + ' Create the filter list. + Dim retCol As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, True) + retCol.AddColumn(col) + + Return SportTable.Instance.GetColumnValues(retCol, Nothing, where.GetFilter(), Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, maxItems) + + End Function + + Public Shared Function GetValues( _ + ByVal col As BaseColumn, _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal maxItems As Integer) As String() + + ' Create the filter list. + Dim retCol As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, True) + retCol.AddColumn(col) + + Return SportTable.Instance.GetColumnValues(retCol, join, where.GetFilter(), Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, maxItems) + + End Function + + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where clause. + ''' + Public Shared Function GetDataTable(ByVal where As String) As System.Data.DataTable + + Dim recs() As SportRecord = GetRecords(where) + Return SportTable.Instance.CreateDataTable(recs, Nothing) + End Function + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where clause. + ''' + Public Shared Function GetDataTable(ByVal join As BaseFilter, ByVal where As String) As System.Data.DataTable + + Dim recs() As SportRecord = GetRecords(join, where) + Return SportTable.Instance.CreateDataTable(recs, Nothing) + End Function + + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause. + ''' + Public Shared Function GetDataTable(ByVal where As String, ByVal orderBy As OrderBy) As System.Data.DataTable + + Dim recs() As SportRecord = GetRecords(where, orderBy) + Return SportTable.Instance.CreateDataTable(recs, Nothing) + End Function + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause. + ''' + Public Shared Function GetDataTable(ByVal join As BaseFilter, ByVal where As String, ByVal orderBy As OrderBy) As System.Data.DataTable + + Dim recs() As SportRecord = GetRecords(join, where, orderBy) + Return SportTable.Instance.CreateDataTable(recs, Nothing) + End Function + + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause with pagination. + ''' + Public Shared Function GetDataTable( _ + ByVal where As String, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As System.Data.DataTable + + Dim recs() As SportRecord = GetRecords(where, orderBy, pageIndex, pageSize) + Return SportTable.Instance.CreateDataTable(recs, Nothing) + End Function + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause with pagination. + ''' + Public Shared Function GetDataTable( _ + ByVal join As BaseFilter, _ + ByVal where As String, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As System.Data.DataTable + + Dim recs() As SportRecord = GetRecords(join, where, orderBy, pageIndex, pageSize) + Return SportTable.Instance.CreateDataTable(recs, Nothing) + End Function + + + ''' + ''' This is a shared function that can be used to delete records using a where clause. + ''' + Public Shared Sub DeleteRecords(ByVal where As String) + If where = Nothing OrElse where.Trim() = "" Then + Return + End If + + Dim whereFilter As SqlFilter = New SqlFilter(where) + SportTable.Instance.DeleteRecordList(whereFilter) + End Sub + + ''' + ''' This is a shared function that can be used to export records using a where clause. + ''' + Public Shared Function Export(ByVal where As String) As String + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Return SportTable.Instance.ExportRecordData(whereFilter) + End Function + + Public Shared Function Export(ByVal where As WhereClause) As String + Dim whereFilter As BaseFilter = Nothing + If Not where Is Nothing Then + whereFilter = where.GetFilter() + End If + + Return SportTable.Instance.ExportRecordData(whereFilter) + End Function + + Public Shared Function GetSum( _ + ByVal col As BaseColumn, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) _ + As String + + Dim colSel As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, False) + colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Sum) + + Return SportTable.Instance.GetColumnStatistics(colSel, Nothing, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + End Function + + Public Shared Function GetSum( _ + ByVal col As BaseColumn, _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) _ + As String + + Dim colSel As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, False) + colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Sum) + + Return SportTable.Instance.GetColumnStatistics(colSel, join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + End Function + + + Public Shared Function GetCount( _ + ByVal col As BaseColumn, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) _ + As String + + Dim colSel As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, False) + colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Count) + + Return SportTable.Instance.GetColumnStatistics(colSel, Nothing, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + End Function + + Public Shared Function GetCount( _ + ByVal col As BaseColumn, _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) _ + As String + + Dim colSel As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, False) + colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Count) + + Return SportTable.Instance.GetColumnStatistics(colSel, join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + End Function + + ''' + ''' This method returns the columns in the table. + ''' + Public Shared Function GetColumns() As BaseColumn() + Return SportTable.Instance.TableDefinition.Columns + End Function + + ''' + ''' This method returns the columnlist in the table. + ''' + Public Shared Function GetColumnList() As ColumnList + Return SportTable.Instance.TableDefinition.ColumnList + End Function + + + ''' + ''' This method creates a new record and returns it to be edited. + ''' + Public Shared Function CreateNewRecord() As IRecord + Return SportTable.Instance.CreateRecord() + End Function + + ''' + ''' This method creates a new record and returns it to be edited. + ''' + ''' ID of the new record. + Public Shared Function CreateNewRecord(ByVal tempId As String) As IRecord + Return SportTable.Instance.CreateRecord(tempId) + End Function + + ''' + ''' This method checks if column is editable. + ''' + ''' Name of the column to check. + Public Shared Function isReadOnlyColumn(ByVal columnName As String) As Boolean + Dim column As BaseColumn = GetColumn(columnName) + If (Not IsNothing(column)) Then + Return column.IsValuesReadOnly + Else + Return True + End If + End Function + + ''' + ''' This method gets the specified column. + ''' + ''' Unique name of the column to fetch. + Public Shared Function GetColumn(ByVal uniqueColumnName As String) As BaseColumn + Dim column As BaseColumn = SportTable.Instance.TableDefinition.ColumnList.GetByUniqueName(uniqueColumnName) + Return column + End Function + + ' Convenience method for getting a record using a string-based record identifier + Public Shared Function GetRecord(ByVal id As String, ByVal bMutable As Boolean) As SportRecord + Return CType(SportTable.Instance.GetRecordData(id, bMutable), SportRecord) + End Function + + ' Convenience method for getting a record using a KeyValue record identifier + Public Shared Function GetRecord(ByVal id As KeyValue, ByVal bMutable As Boolean) As SportRecord + Return CType(SportTable.Instance.GetRecordData(id, bMutable), SportRecord) + End Function + + ' Convenience method for creating a record + Public Overloads Function NewRecord( _ + ByVal SportIdValue As String, _ + ByVal SPORTValue As String _ + ) As KeyValue + Dim rec As IPrimaryKeyRecord = CType(Me.CreateRecord(), IPrimaryKeyRecord) + rec.SetString(SportIdValue, SportIdColumn) + rec.SetString(SPORTValue, SPORTColumn) + + + rec.Create() 'update the DB so any DB-initialized fields (like autoincrement IDs) can be initialized + + Dim key As KeyValue = rec.GetID() + Return key + End Function + + ''' + ''' This method deletes a specified record + ''' + ''' Keyvalue of the record to be deleted. + Public Shared Sub DeleteRecord(ByVal kv As KeyValue) + SportTable.Instance.DeleteOneRecord(kv) + End Sub + + ''' + ''' This method checks if record exist in the database using the keyvalue provided. + ''' + ''' Key value of the record. + Public Shared Function DoesRecordExist(ByVal kv As KeyValue) As Boolean + Dim recordExist As Boolean = True + Try + SportTable.GetRecord(kv, False) + Catch ex As Exception + recordExist = False + End Try + Return recordExist + End Function + + ''' + ''' This method returns all the primary columns in the table. + ''' + Public Shared Function GetPrimaryKeyColumns() As ColumnList + If (Not IsNothing(SportTable.Instance.TableDefinition.PrimaryKey)) Then + Return SportTable.Instance.TableDefinition.PrimaryKey.Columns + Else + Return Nothing + End If + End Function + + ''' + ''' This method takes a key and returns a keyvalue. + ''' + ''' key could be array of primary key values in case of composite primary key or a string containing single primary key value in case of non-composite primary key. + Public Shared Function GetKeyValue(ByVal key As Object) As KeyValue + Dim kv As KeyValue = Nothing + + If (Not (IsNothing(SportTable.Instance.TableDefinition.PrimaryKey))) Then + + Dim isCompositePrimaryKey As Boolean = False + isCompositePrimaryKey = SportTable.Instance.TableDefinition.PrimaryKey.IsCompositeKey + + If ((isCompositePrimaryKey) AndAlso (key.GetType.IsArray())) Then + + ' If the key is composite, then construct a key value. + kv = New KeyValue + Dim fullKeyString As String = "" + Dim keyArray As Array = CType(key, Array) + If (Not IsNothing(keyArray)) Then + Dim length As Integer = keyArray.Length + Dim pkColumns As ColumnList = SportTable.Instance.TableDefinition.PrimaryKey.Columns + Dim pkColumn As BaseColumn + Dim index As Integer = 0 + For Each pkColumn In pkColumns + Dim keyString As String = CType(keyArray.GetValue(index), String) + If (SportTable.Instance.TableDefinition.TableType = BaseClasses.Data.TableDefinition.TableTypes.Virtual) Then + kv.AddElement(pkColumn.UniqueName, keyString) + Else + kv.AddElement(pkColumn.InternalName, keyString) + End If + index = index + 1 + Next pkColumn + End If + + Else + ' If the key is not composite, then get the key value. + kv = SportTable.Instance.TableDefinition.PrimaryKey.ParseValue(CType(key, String)) + End If + End If + Return kv + End Function + + + ''' + ''' This method takes a record and a Column and returns an evaluated value of DFKA formula. + ''' + Public Shared Function GetDFKA(ByVal rec As BaseRecord, ByVal col As BaseColumn) As String + Dim fkColumn As ForeignKey = SportTable.Instance.TableDefinition.GetExpandableNonCompositeForeignKey(col) + If fkColumn Is Nothing Then + Return Nothing + End If + Dim _DFKA As String = fkColumn.PrimaryKeyDisplayColumns + If (_DFKA.Trim().StartsWith("=")) Then + ' if the formula is in the format of "= ., then pull out the data from the rec object instead of doing formula evaluation + Dim tableCodeName As String = fkColumn.PrimaryKeyTableDefinition.TableCodeName + Dim column As String = _DFKA.Trim("="c).Trim() + If column.StartsWith(tableCodeName & ".", StringComparison.InvariantCultureIgnoreCase) Then + column = column.Substring(tableCodeName.Length + 1) + End If + + For Each c As BaseColumn In fkColumn.PrimaryKeyTableDefinition.Columns + If column = c.CodeName Then + Return rec.Format(c) + End If + Next + Dim tableName As String = fkColumn.PrimaryKeyTableDefinition.TableCodeName + Return EvaluateFormula(_DFKA, rec, Nothing, tableName) + Else + Return Nothing + End If + End Function + + ''' + ''' This method takes a keyValue and a Column and returns an evaluated value of DFKA formula. + ''' + Public Shared Function GetDFKA(ByVal keyValue As String, ByVal col As BaseColumn, ByVal formatPattern as String) As String + If keyValue Is Nothing Then + Return Nothing + End If + Dim fkColumn As ForeignKey = SportTable.Instance.TableDefinition.GetExpandableNonCompositeForeignKey(col) + If fkColumn Is Nothing Then + Return Nothing + End If + Dim _DFKA As String = fkColumn.PrimaryKeyDisplayColumns + If (_DFKA.Trim().StartsWith("=")) Then + Dim tableName As String = fkColumn.PrimaryKeyTableDefinition.TableCodeName + Dim t As PrimaryKeyTable = CType(DatabaseObjects.GetTableObject(tableName), PrimaryKeyTable) + Dim rec As BaseRecord = Nothing + If Not t Is Nothing Then + Try + rec = CType(t.GetRecordData(keyValue, False), BaseRecord) + Catch + rec = Nothing + End Try + End If + If rec Is Nothing Then + Return "" + End If + + ' if the formula is in the format of "= ., then pull out the data from the rec object instead of doing formula evaluation + Dim tableCodeName As String = fkColumn.PrimaryKeyTableDefinition.TableCodeName + Dim column As String = _DFKA.Trim("="c).Trim() + If column.StartsWith(tableCodeName & ".", StringComparison.InvariantCultureIgnoreCase) Then + column = column.Substring(tableCodeName.Length + 1) + End If + + For Each c As BaseColumn In fkColumn.PrimaryKeyTableDefinition.Columns + If column = c.CodeName Then + Return rec.Format(c) + End If + Next + Return EvaluateFormula(_DFKA, rec, Nothing, tableName) + Else + Return Nothing + End If + End Function + + ''' + ''' Evaluates the formula + ''' + Public Shared Function EvaluateFormula(ByVal formula As String, Optional ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord = Nothing, Optional ByVal format As String = Nothing, Optional ByVal name As String = "") As String + Dim e As BaseFormulaEvaluator = New BaseFormulaEvaluator() + If Not dataSourceForEvaluate Is Nothing Then + e.Evaluator.Variables.Add(name, dataSourceForEvaluate) + end if + e.DataSource = dataSourceForEvaluate + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + If Not String.IsNullOrEmpty(format) Then + Return BaseFormulaUtils.Format(resultObj, format) + Else + Return resultObj.ToString() + End If + End Function + + +#End Region + +End Class +End Namespace diff --git a/App_Code/Business Layer/BaseStatusRecord.vb b/App_Code/Business Layer/BaseStatusRecord.vb new file mode 100644 index 0000000..52b6139 --- /dev/null +++ b/App_Code/Business Layer/BaseStatusRecord.vb @@ -0,0 +1,283 @@ +' This class is "generated" and will be overwritten. +' Your customizations should be made in StatusRecord.vb + +Imports System.Data.SqlTypes +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + +Namespace Persons.Business + +''' +''' The generated superclass for the class. +''' +''' +''' This class is not intended to be instantiated directly. To obtain an instance of this class, +''' use the methods of the class. +''' +''' +''' + + Public Class BaseStatusRecord + Inherits PrimaryKeyRecord + + + Public Shared Shadows ReadOnly TableUtils As StatusTable = StatusTable.Instance + + ' Constructors + + Protected Sub New() + MyBase.New(TableUtils) + End Sub + + Protected Sub New(ByVal record As PrimaryKeyRecord) + MyBase.New(record, TableUtils) + End Sub + + 'Evaluates Initialize when->Inserting record formulas specified at the data access layer + Public Overridable Sub StatusRecord_InsertingRecord(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles Me.InsertingRecord + 'Apply Initialize->Inserting record formula only if validation is successful. + Dim StatusRec As StatusRecord = CType(sender,StatusRecord) + Validate_Inserting() + If Not StatusRec Is Nothing AndAlso Not StatusRec.IsReadOnly Then + End If + End Sub + + 'Evaluates Initialize when->Updating record formulas specified at the data access layer + Public Overridable Sub StatusRecord_UpdatingRecord(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles Me.UpdatingRecord + 'Apply Initialize->Updating record formula only if validation is successful. + Dim StatusRec As StatusRecord = CType(sender,StatusRecord) + Validate_Updating() + If Not StatusRec Is Nothing AndAlso Not StatusRec.IsReadOnly Then + End If + End Sub + + 'Evaluates Initialize when->Reading record formulas specified at the data access layer + Public Overridable Sub StatusRecord_ReadRecord(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.ReadRecord + 'Apply Initialize->Reading record formula only if validation is successful. + Dim StatusRec As StatusRecord = CType(sender,StatusRecord) + If Not StatusRec Is Nothing AndAlso Not StatusRec.IsReadOnly Then + End If + End Sub + + 'Evaluates Validate when->Inserting formulas specified at the data access layer + Public Overridable Sub Validate_Inserting () + Dim fullValidationMessage As String = "" + Dim validationMessage As String = "" + + dim formula as String = "" + + + If validationMessage <> "" AndAlso validationMessage.ToLower() <> "true" Then + fullValidationMessage &= validationMessage & vbCrLf + End If + + If fullValidationMessage <> "" Then + Throw New Exception(fullValidationMessage) + End If + End Sub + + 'Evaluates Validate when->Updating formulas specified at the data access layer + Public Overridable Sub Validate_Updating () + Dim fullValidationMessage As String = "" + Dim validationMessage As String = "" + + dim formula as String = "" + + + If validationMessage <> "" AndAlso validationMessage.ToLower() <> "true" Then + fullValidationMessage &= validationMessage & vbCrLf + End If + + If fullValidationMessage <> "" Then + Throw New Exception(fullValidationMessage) + End If + End Sub + + Public Overridable Function EvaluateFormula(ByVal formula As String, Optional ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord = Nothing, Optional ByVal format As String = Nothing) As String + + Dim e As Data.BaseFormulaEvaluator = New Data.BaseFormulaEvaluator() + + ' All variables referred to in the formula are expected to be + ' properties of the DataSource. For example, referring to + ' UnitPrice as a variable will refer to DataSource.UnitPrice + e.DataSource = dataSourceForEvaluate + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + Return resultObj.ToString() + End Function + + + + + + + +#Region "Convenience methods to get/set values of fields" + + ''' + ''' This is a convenience method that provides direct access to the value of the record's Status_.StatusId field. + ''' + Public Function GetStatusIdValue() As ColumnValue + Return Me.GetValue(TableUtils.StatusIdColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's Status_.StatusId field. + ''' + Public Function GetStatusIdFieldValue() As Byte + Return CType(Me.GetValue(TableUtils.StatusIdColumn).ToByte(), Byte) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Status_.StatusId field. + ''' + Public Sub SetStatusIdFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.StatusIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Status_.StatusId field. + ''' + Public Sub SetStatusIdFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.StatusIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Status_.StatusId field. + ''' + Public Sub SetStatusIdFieldValue(ByVal val As Double) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.StatusIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Status_.StatusId field. + ''' + Public Sub SetStatusIdFieldValue(ByVal val As Decimal) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.StatusIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Status_.StatusId field. + ''' + Public Sub SetStatusIdFieldValue(ByVal val As Int64) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.StatusIdColumn) + End Sub + ''' + ''' This is a convenience method that provides direct access to the value of the record's Status_.Status field. + ''' + Public Function GetStatusValue() As ColumnValue + Return Me.GetValue(TableUtils.StatusColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's Status_.Status field. + ''' + Public Function GetStatusFieldValue() As String + Return CType(Me.GetValue(TableUtils.StatusColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Status_.Status field. + ''' + Public Sub SetStatusFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.StatusColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's Status_.Status field. + ''' + Public Sub SetStatusFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.StatusColumn) + End Sub + + + +#End Region + +#Region "Convenience methods to get field names" + + ''' + ''' This is a convenience property that provides direct access to the value of the record's Status_.StatusId field. + ''' + Public Property StatusId() As Byte + Get + Return CType(Me.GetValue(TableUtils.StatusIdColumn).ToByte(), Byte) + End Get + Set (ByVal val As Byte) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.StatusIdColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property StatusIdSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.StatusIdColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property StatusIdDefault() As String + Get + Return TableUtils.StatusIdColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's Status_.Status field. + ''' + Public Property Status() As String + Get + Return CType(Me.GetValue(TableUtils.StatusColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.StatusColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property StatusSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.StatusColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property StatusDefault() As String + Get + Return TableUtils.StatusColumn.DefaultValue + End Get + End Property + + + +#End Region + +End Class +End Namespace diff --git a/App_Code/Business Layer/BaseStatusTable.vb b/App_Code/Business Layer/BaseStatusTable.vb new file mode 100644 index 0000000..8c938cd --- /dev/null +++ b/App_Code/Business Layer/BaseStatusTable.vb @@ -0,0 +1,778 @@ +' This class is "generated" and will be overwritten. +' Your customizations should be made in StatusRecord.vb + +Imports System.Data.SqlTypes +Imports System.Data +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider +Imports Persons.Data + +Namespace Persons.Business + +''' +''' The generated superclass for the class. +''' Provides access to the schema information and record data of a database table or view named Status. +''' +''' +''' The connection details (name, location, etc.) of the database and table (or view) accessed by this class +''' are resolved at runtime based on the connection string in the application's Web.Config file. +''' +''' This class is not intended to be instantiated directly. To obtain an instance of this class, use +''' StatusTable.Instance. +''' +''' +''' + + Public Class BaseStatusTable + Inherits PrimaryKeyTable + + + Private ReadOnly TableDefinitionString As String = StatusDefinition.GetXMLString() + + + + + + + + Protected Sub New() + MyBase.New() + Me.Initialize() + End Sub + + Protected Overridable Sub Initialize() + Dim def As New XmlTableDefinition(TableDefinitionString) + Me.TableDefinition = New TableDefinition() + Me.TableDefinition.TableClassName = System.Reflection.Assembly.CreateQualifiedName("App_Code", "Persons.Business.StatusTable") + def.InitializeTableDefinition(Me.TableDefinition) + Me.ConnectionName = def.GetConnectionName() + Me.RecordClassName = System.Reflection.Assembly.CreateQualifiedName("App_Code", "Persons.Business.StatusRecord") + Me.ApplicationName = "App_Code" + Me.DataAdapter = New StatusSqlTable() + Directcast(Me.DataAdapter, StatusSqlTable).ConnectionName = Me.ConnectionName + + Me.TableDefinition.AdapterMetaData = Me.DataAdapter.AdapterMetaData + StatusIdColumn.CodeName = "StatusId" + StatusColumn.CodeName = "Status" + + End Sub + +#Region "Overriden methods" + + +#End Region + +#Region "Properties for columns" + + ''' + ''' This is a convenience property that provides direct access to the table's Status_.StatusId column object. + ''' + Public ReadOnly Property StatusIdColumn() As BaseClasses.Data.NumberColumn + Get + Return CType(Me.TableDefinition.ColumnList(0), BaseClasses.Data.NumberColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's Status_.StatusId column object. + ''' + Public Shared ReadOnly Property StatusId() As BaseClasses.Data.NumberColumn + Get + Return StatusTable.Instance.StatusIdColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's Status_.Status column object. + ''' + Public ReadOnly Property StatusColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(1), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's Status_.Status column object. + ''' + Public Shared ReadOnly Property Status() As BaseClasses.Data.StringColumn + Get + Return StatusTable.Instance.StatusColumn + End Get + End Property + + +#End Region + + +#Region "Shared helper methods" + + ''' + ''' This is a shared function that can be used to get an array of StatusRecord records using a where clause. + ''' + Public Shared Function GetRecords(ByVal where As String) As StatusRecord() + + Return GetRecords(where, Nothing, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) + End Function + + ''' + ''' This is a shared function that can be used to get an array of StatusRecord records using a where clause. + ''' + Public Shared Function GetRecords(ByVal join As BaseFilter, ByVal where As String) As StatusRecord() + + Return GetRecords(join, where, Nothing, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) + End Function + + ''' + ''' This is a shared function that can be used to get an array of StatusRecord records using a where and order by clause. + ''' + Public Shared Function GetRecords( _ + ByVal where As String, _ + ByVal orderBy As OrderBy) As StatusRecord() + + Return GetRecords(where, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) + End Function + + ''' + ''' This is a shared function that can be used to get an array of StatusRecord records using a where and order by clause. + ''' + Public Shared Function GetRecords( _ + ByVal join As BaseFilter, _ + ByVal where As String, _ + ByVal orderBy As OrderBy) As StatusRecord() + + Return GetRecords(join, where, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) + End Function + + ''' + ''' This is a shared function that can be used to get an array of StatusRecord records using a where and order by clause clause with pagination. + ''' + Public Shared Function GetRecords( _ + ByVal where As String, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As StatusRecord() + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + Dim join As BaseClasses.Data.BaseFilter = Nothing + Dim recList As ArrayList = StatusTable.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, pageIndex, pageSize) + + Return CType(recList.ToArray(GetType(Persons.Business.StatusRecord)), StatusRecord()) + End Function + + ''' + ''' This is a shared function that can be used to get an array of StatusRecord records using a where and order by clause clause with pagination. + ''' + Public Shared Function GetRecords( _ + ByVal join As BaseFilter, _ + ByVal where As String, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As StatusRecord() + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Dim recList As ArrayList = StatusTable.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, pageIndex, pageSize) + + Return CType(recList.ToArray(GetType(Persons.Business.StatusRecord)), StatusRecord()) + End Function + + Public Shared Function GetRecords( _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As StatusRecord() + Dim join As BaseClasses.Data.BaseFilter = Nothing + Dim recList As ArrayList = StatusTable.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + Return CType(recList.ToArray(GetType(Persons.Business.StatusRecord)), StatusRecord()) + End Function + + Public Shared Function GetRecords( _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As StatusRecord() + + Dim recList As ArrayList = StatusTable.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + Return CType(recList.ToArray(GetType(Persons.Business.StatusRecord)), StatusRecord()) + End Function + + Public Shared Function GetRecords( _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer, _ + ByRef totalRecords As Integer) As StatusRecord() + Dim join As BaseClasses.Data.BaseFilter = Nothing + Dim recList As ArrayList = StatusTable.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize, totalRecords) + + Return CType(recList.ToArray(GetType(Persons.Business.StatusRecord)), StatusRecord()) + End Function + + Public Shared Function GetRecords( _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer, _ + ByRef totalRecords As Integer) As StatusRecord() + + Dim recList As ArrayList = StatusTable.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize, totalRecords) + + Return CType(recList.ToArray(GetType(Persons.Business.StatusRecord)), StatusRecord()) + End Function + + ''' + ''' This is a shared function that can be used to get total number of records that will be returned using the where clause. + ''' + Public Shared Function GetRecordCount(ByVal where As String) As Integer + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Return CInt(StatusTable.Instance.GetRecordListCount(Nothing, whereFilter, Nothing, Nothing)) + End Function + +''' + ''' This is a shared function that can be used to get total number of records that will be returned using the where clause. + ''' + Public Shared Function GetRecordCount(ByVal join As BaseFilter, ByVal where As String) As Integer + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Return CInt(StatusTable.Instance.GetRecordListCount(join, whereFilter, Nothing, Nothing)) + End Function + + Public Shared Function GetRecordCount(ByVal where As WhereClause) As Integer + Return CInt(StatusTable.Instance.GetRecordListCount(Nothing, where.GetFilter(), Nothing, Nothing)) + End Function + + Public Shared Function GetRecordCount(ByVal join As BaseFilter, ByVal where As WhereClause) As Integer + Return CInt(StatusTable.Instance.GetRecordListCount(join, where.GetFilter(), Nothing, Nothing)) + End Function + + ''' + ''' This is a shared function that can be used to get a StatusRecord record using a where clause. + ''' + Public Shared Function GetRecord(ByVal where As String) As StatusRecord + Dim orderBy As OrderBy = Nothing + Return GetRecord(where, orderBy) + End Function + + ''' + ''' This is a shared function that can be used to get a StatusRecord record using a where clause. + ''' + Public Shared Function GetRecord(ByVal join As BaseFilter, ByVal where As String) As StatusRecord + Dim orderBy As OrderBy = Nothing + Return GetRecord(join, where, orderBy) + End Function + + ''' + ''' This is a shared function that can be used to get a StatusRecord record using a where and order by clause. + ''' + Public Shared Function GetRecord( _ + ByVal where As String, _ + ByVal orderBy As OrderBy) As StatusRecord + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + Dim join As BaseClasses.Data.BaseFilter = Nothing + Dim recList As ArrayList = StatusTable.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MIN_BATCH_SIZE) + + Dim rec As StatusRecord = Nothing + If recList.Count > 0 Then + rec = CType(recList(0), StatusRecord) + End If + + Return rec + End Function + + ''' + ''' This is a shared function that can be used to get a StatusRecord record using a where and order by clause. + ''' + Public Shared Function GetRecord( _ + ByVal join As BaseFilter, _ + ByVal where As String, _ + ByVal orderBy As OrderBy) As StatusRecord + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Dim recList As ArrayList = StatusTable.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MIN_BATCH_SIZE) + + Dim rec As StatusRecord = Nothing + If recList.Count > 0 Then + rec = CType(recList(0), StatusRecord) + End If + + Return rec + End Function + + + Public Shared Function GetValues( _ + ByVal col As BaseColumn, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal maxItems As Integer) As String() + + ' Create the filter list. + Dim retCol As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, True) + retCol.AddColumn(col) + + Return StatusTable.Instance.GetColumnValues(retCol, Nothing, where.GetFilter(), Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, maxItems) + + End Function + + Public Shared Function GetValues( _ + ByVal col As BaseColumn, _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal maxItems As Integer) As String() + + ' Create the filter list. + Dim retCol As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, True) + retCol.AddColumn(col) + + Return StatusTable.Instance.GetColumnValues(retCol, join, where.GetFilter(), Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, maxItems) + + End Function + + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where clause. + ''' + Public Shared Function GetDataTable(ByVal where As String) As System.Data.DataTable + + Dim recs() As StatusRecord = GetRecords(where) + Return StatusTable.Instance.CreateDataTable(recs, Nothing) + End Function + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where clause. + ''' + Public Shared Function GetDataTable(ByVal join As BaseFilter, ByVal where As String) As System.Data.DataTable + + Dim recs() As StatusRecord = GetRecords(join, where) + Return StatusTable.Instance.CreateDataTable(recs, Nothing) + End Function + + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause. + ''' + Public Shared Function GetDataTable(ByVal where As String, ByVal orderBy As OrderBy) As System.Data.DataTable + + Dim recs() As StatusRecord = GetRecords(where, orderBy) + Return StatusTable.Instance.CreateDataTable(recs, Nothing) + End Function + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause. + ''' + Public Shared Function GetDataTable(ByVal join As BaseFilter, ByVal where As String, ByVal orderBy As OrderBy) As System.Data.DataTable + + Dim recs() As StatusRecord = GetRecords(join, where, orderBy) + Return StatusTable.Instance.CreateDataTable(recs, Nothing) + End Function + + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause with pagination. + ''' + Public Shared Function GetDataTable( _ + ByVal where As String, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As System.Data.DataTable + + Dim recs() As StatusRecord = GetRecords(where, orderBy, pageIndex, pageSize) + Return StatusTable.Instance.CreateDataTable(recs, Nothing) + End Function + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause with pagination. + ''' + Public Shared Function GetDataTable( _ + ByVal join As BaseFilter, _ + ByVal where As String, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As System.Data.DataTable + + Dim recs() As StatusRecord = GetRecords(join, where, orderBy, pageIndex, pageSize) + Return StatusTable.Instance.CreateDataTable(recs, Nothing) + End Function + + + ''' + ''' This is a shared function that can be used to delete records using a where clause. + ''' + Public Shared Sub DeleteRecords(ByVal where As String) + If where = Nothing OrElse where.Trim() = "" Then + Return + End If + + Dim whereFilter As SqlFilter = New SqlFilter(where) + StatusTable.Instance.DeleteRecordList(whereFilter) + End Sub + + ''' + ''' This is a shared function that can be used to export records using a where clause. + ''' + Public Shared Function Export(ByVal where As String) As String + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Return StatusTable.Instance.ExportRecordData(whereFilter) + End Function + + Public Shared Function Export(ByVal where As WhereClause) As String + Dim whereFilter As BaseFilter = Nothing + If Not where Is Nothing Then + whereFilter = where.GetFilter() + End If + + Return StatusTable.Instance.ExportRecordData(whereFilter) + End Function + + Public Shared Function GetSum( _ + ByVal col As BaseColumn, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) _ + As String + + Dim colSel As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, False) + colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Sum) + + Return StatusTable.Instance.GetColumnStatistics(colSel, Nothing, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + End Function + + Public Shared Function GetSum( _ + ByVal col As BaseColumn, _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) _ + As String + + Dim colSel As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, False) + colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Sum) + + Return StatusTable.Instance.GetColumnStatistics(colSel, join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + End Function + + + Public Shared Function GetCount( _ + ByVal col As BaseColumn, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) _ + As String + + Dim colSel As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, False) + colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Count) + + Return StatusTable.Instance.GetColumnStatistics(colSel, Nothing, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + End Function + + Public Shared Function GetCount( _ + ByVal col As BaseColumn, _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) _ + As String + + Dim colSel As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, False) + colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Count) + + Return StatusTable.Instance.GetColumnStatistics(colSel, join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + End Function + + ''' + ''' This method returns the columns in the table. + ''' + Public Shared Function GetColumns() As BaseColumn() + Return StatusTable.Instance.TableDefinition.Columns + End Function + + ''' + ''' This method returns the columnlist in the table. + ''' + Public Shared Function GetColumnList() As ColumnList + Return StatusTable.Instance.TableDefinition.ColumnList + End Function + + + ''' + ''' This method creates a new record and returns it to be edited. + ''' + Public Shared Function CreateNewRecord() As IRecord + Return StatusTable.Instance.CreateRecord() + End Function + + ''' + ''' This method creates a new record and returns it to be edited. + ''' + ''' ID of the new record. + Public Shared Function CreateNewRecord(ByVal tempId As String) As IRecord + Return StatusTable.Instance.CreateRecord(tempId) + End Function + + ''' + ''' This method checks if column is editable. + ''' + ''' Name of the column to check. + Public Shared Function isReadOnlyColumn(ByVal columnName As String) As Boolean + Dim column As BaseColumn = GetColumn(columnName) + If (Not IsNothing(column)) Then + Return column.IsValuesReadOnly + Else + Return True + End If + End Function + + ''' + ''' This method gets the specified column. + ''' + ''' Unique name of the column to fetch. + Public Shared Function GetColumn(ByVal uniqueColumnName As String) As BaseColumn + Dim column As BaseColumn = StatusTable.Instance.TableDefinition.ColumnList.GetByUniqueName(uniqueColumnName) + Return column + End Function + + ' Convenience method for getting a record using a string-based record identifier + Public Shared Function GetRecord(ByVal id As String, ByVal bMutable As Boolean) As StatusRecord + Return CType(StatusTable.Instance.GetRecordData(id, bMutable), StatusRecord) + End Function + + ' Convenience method for getting a record using a KeyValue record identifier + Public Shared Function GetRecord(ByVal id As KeyValue, ByVal bMutable As Boolean) As StatusRecord + Return CType(StatusTable.Instance.GetRecordData(id, bMutable), StatusRecord) + End Function + + ' Convenience method for creating a record + Public Overloads Function NewRecord( _ + ByVal StatusIdValue As String, _ + ByVal StatusValue As String _ + ) As KeyValue + Dim rec As IPrimaryKeyRecord = CType(Me.CreateRecord(), IPrimaryKeyRecord) + rec.SetString(StatusIdValue, StatusIdColumn) + rec.SetString(StatusValue, StatusColumn) + + + rec.Create() 'update the DB so any DB-initialized fields (like autoincrement IDs) can be initialized + + Dim key As KeyValue = rec.GetID() + Return key + End Function + + ''' + ''' This method deletes a specified record + ''' + ''' Keyvalue of the record to be deleted. + Public Shared Sub DeleteRecord(ByVal kv As KeyValue) + StatusTable.Instance.DeleteOneRecord(kv) + End Sub + + ''' + ''' This method checks if record exist in the database using the keyvalue provided. + ''' + ''' Key value of the record. + Public Shared Function DoesRecordExist(ByVal kv As KeyValue) As Boolean + Dim recordExist As Boolean = True + Try + StatusTable.GetRecord(kv, False) + Catch ex As Exception + recordExist = False + End Try + Return recordExist + End Function + + ''' + ''' This method returns all the primary columns in the table. + ''' + Public Shared Function GetPrimaryKeyColumns() As ColumnList + If (Not IsNothing(StatusTable.Instance.TableDefinition.PrimaryKey)) Then + Return StatusTable.Instance.TableDefinition.PrimaryKey.Columns + Else + Return Nothing + End If + End Function + + ''' + ''' This method takes a key and returns a keyvalue. + ''' + ''' key could be array of primary key values in case of composite primary key or a string containing single primary key value in case of non-composite primary key. + Public Shared Function GetKeyValue(ByVal key As Object) As KeyValue + Dim kv As KeyValue = Nothing + + If (Not (IsNothing(StatusTable.Instance.TableDefinition.PrimaryKey))) Then + + Dim isCompositePrimaryKey As Boolean = False + isCompositePrimaryKey = StatusTable.Instance.TableDefinition.PrimaryKey.IsCompositeKey + + If ((isCompositePrimaryKey) AndAlso (key.GetType.IsArray())) Then + + ' If the key is composite, then construct a key value. + kv = New KeyValue + Dim fullKeyString As String = "" + Dim keyArray As Array = CType(key, Array) + If (Not IsNothing(keyArray)) Then + Dim length As Integer = keyArray.Length + Dim pkColumns As ColumnList = StatusTable.Instance.TableDefinition.PrimaryKey.Columns + Dim pkColumn As BaseColumn + Dim index As Integer = 0 + For Each pkColumn In pkColumns + Dim keyString As String = CType(keyArray.GetValue(index), String) + If (StatusTable.Instance.TableDefinition.TableType = BaseClasses.Data.TableDefinition.TableTypes.Virtual) Then + kv.AddElement(pkColumn.UniqueName, keyString) + Else + kv.AddElement(pkColumn.InternalName, keyString) + End If + index = index + 1 + Next pkColumn + End If + + Else + ' If the key is not composite, then get the key value. + kv = StatusTable.Instance.TableDefinition.PrimaryKey.ParseValue(CType(key, String)) + End If + End If + Return kv + End Function + + + ''' + ''' This method takes a record and a Column and returns an evaluated value of DFKA formula. + ''' + Public Shared Function GetDFKA(ByVal rec As BaseRecord, ByVal col As BaseColumn) As String + Dim fkColumn As ForeignKey = StatusTable.Instance.TableDefinition.GetExpandableNonCompositeForeignKey(col) + If fkColumn Is Nothing Then + Return Nothing + End If + Dim _DFKA As String = fkColumn.PrimaryKeyDisplayColumns + If (_DFKA.Trim().StartsWith("=")) Then + ' if the formula is in the format of "= ., then pull out the data from the rec object instead of doing formula evaluation + Dim tableCodeName As String = fkColumn.PrimaryKeyTableDefinition.TableCodeName + Dim column As String = _DFKA.Trim("="c).Trim() + If column.StartsWith(tableCodeName & ".", StringComparison.InvariantCultureIgnoreCase) Then + column = column.Substring(tableCodeName.Length + 1) + End If + + For Each c As BaseColumn In fkColumn.PrimaryKeyTableDefinition.Columns + If column = c.CodeName Then + Return rec.Format(c) + End If + Next + Dim tableName As String = fkColumn.PrimaryKeyTableDefinition.TableCodeName + Return EvaluateFormula(_DFKA, rec, Nothing, tableName) + Else + Return Nothing + End If + End Function + + ''' + ''' This method takes a keyValue and a Column and returns an evaluated value of DFKA formula. + ''' + Public Shared Function GetDFKA(ByVal keyValue As String, ByVal col As BaseColumn, ByVal formatPattern as String) As String + If keyValue Is Nothing Then + Return Nothing + End If + Dim fkColumn As ForeignKey = StatusTable.Instance.TableDefinition.GetExpandableNonCompositeForeignKey(col) + If fkColumn Is Nothing Then + Return Nothing + End If + Dim _DFKA As String = fkColumn.PrimaryKeyDisplayColumns + If (_DFKA.Trim().StartsWith("=")) Then + Dim tableName As String = fkColumn.PrimaryKeyTableDefinition.TableCodeName + Dim t As PrimaryKeyTable = CType(DatabaseObjects.GetTableObject(tableName), PrimaryKeyTable) + Dim rec As BaseRecord = Nothing + If Not t Is Nothing Then + Try + rec = CType(t.GetRecordData(keyValue, False), BaseRecord) + Catch + rec = Nothing + End Try + End If + If rec Is Nothing Then + Return "" + End If + + ' if the formula is in the format of "= ., then pull out the data from the rec object instead of doing formula evaluation + Dim tableCodeName As String = fkColumn.PrimaryKeyTableDefinition.TableCodeName + Dim column As String = _DFKA.Trim("="c).Trim() + If column.StartsWith(tableCodeName & ".", StringComparison.InvariantCultureIgnoreCase) Then + column = column.Substring(tableCodeName.Length + 1) + End If + + For Each c As BaseColumn In fkColumn.PrimaryKeyTableDefinition.Columns + If column = c.CodeName Then + Return rec.Format(c) + End If + Next + Return EvaluateFormula(_DFKA, rec, Nothing, tableName) + Else + Return Nothing + End If + End Function + + ''' + ''' Evaluates the formula + ''' + Public Shared Function EvaluateFormula(ByVal formula As String, Optional ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord = Nothing, Optional ByVal format As String = Nothing, Optional ByVal name As String = "") As String + Dim e As BaseFormulaEvaluator = New BaseFormulaEvaluator() + If Not dataSourceForEvaluate Is Nothing Then + e.Evaluator.Variables.Add(name, dataSourceForEvaluate) + end if + e.DataSource = dataSourceForEvaluate + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + If Not String.IsNullOrEmpty(format) Then + Return BaseFormulaUtils.Format(resultObj, format) + Else + Return resultObj.ToString() + End If + End Function + + +#End Region + +End Class +End Namespace diff --git a/App_Code/Business Layer/BaseTblRoleRecord.vb b/App_Code/Business Layer/BaseTblRoleRecord.vb new file mode 100644 index 0000000..c82668e --- /dev/null +++ b/App_Code/Business Layer/BaseTblRoleRecord.vb @@ -0,0 +1,246 @@ +' This class is "generated" and will be overwritten. +' Your customizations should be made in TblRoleRecord.vb + +Imports System.Data.SqlTypes +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + +Namespace Persons.Business + +''' +''' The generated superclass for the class. +''' +''' +''' This class is not intended to be instantiated directly. To obtain an instance of this class, +''' use the methods of the class. +''' +''' +''' + + Public Class BaseTblRoleRecord + Inherits PrimaryKeyRecord + + + Public Shared Shadows ReadOnly TableUtils As TblRoleTable = TblRoleTable.Instance + + ' Constructors + + Protected Sub New() + MyBase.New(TableUtils) + End Sub + + Protected Sub New(ByVal record As PrimaryKeyRecord) + MyBase.New(record, TableUtils) + End Sub + + 'Evaluates Initialize when->Inserting record formulas specified at the data access layer + Public Overridable Sub TblRoleRecord_InsertingRecord(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles Me.InsertingRecord + 'Apply Initialize->Inserting record formula only if validation is successful. + Dim TblRoleRec As TblRoleRecord = CType(sender,TblRoleRecord) + Validate_Inserting() + If Not TblRoleRec Is Nothing AndAlso Not TblRoleRec.IsReadOnly Then + End If + End Sub + + 'Evaluates Initialize when->Updating record formulas specified at the data access layer + Public Overridable Sub TblRoleRecord_UpdatingRecord(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles Me.UpdatingRecord + 'Apply Initialize->Updating record formula only if validation is successful. + Dim TblRoleRec As TblRoleRecord = CType(sender,TblRoleRecord) + Validate_Updating() + If Not TblRoleRec Is Nothing AndAlso Not TblRoleRec.IsReadOnly Then + End If + End Sub + + 'Evaluates Initialize when->Reading record formulas specified at the data access layer + Public Overridable Sub TblRoleRecord_ReadRecord(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.ReadRecord + 'Apply Initialize->Reading record formula only if validation is successful. + Dim TblRoleRec As TblRoleRecord = CType(sender,TblRoleRecord) + If Not TblRoleRec Is Nothing AndAlso Not TblRoleRec.IsReadOnly Then + End If + End Sub + + 'Evaluates Validate when->Inserting formulas specified at the data access layer + Public Overridable Sub Validate_Inserting () + Dim fullValidationMessage As String = "" + Dim validationMessage As String = "" + + dim formula as String = "" + + + If validationMessage <> "" AndAlso validationMessage.ToLower() <> "true" Then + fullValidationMessage &= validationMessage & vbCrLf + End If + + If fullValidationMessage <> "" Then + Throw New Exception(fullValidationMessage) + End If + End Sub + + 'Evaluates Validate when->Updating formulas specified at the data access layer + Public Overridable Sub Validate_Updating () + Dim fullValidationMessage As String = "" + Dim validationMessage As String = "" + + dim formula as String = "" + + + If validationMessage <> "" AndAlso validationMessage.ToLower() <> "true" Then + fullValidationMessage &= validationMessage & vbCrLf + End If + + If fullValidationMessage <> "" Then + Throw New Exception(fullValidationMessage) + End If + End Sub + + Public Overridable Function EvaluateFormula(ByVal formula As String, Optional ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord = Nothing, Optional ByVal format As String = Nothing) As String + + Dim e As Data.BaseFormulaEvaluator = New Data.BaseFormulaEvaluator() + + ' All variables referred to in the formula are expected to be + ' properties of the DataSource. For example, referring to + ' UnitPrice as a variable will refer to DataSource.UnitPrice + e.DataSource = dataSourceForEvaluate + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + Return resultObj.ToString() + End Function + + + + + + + +#Region "Convenience methods to get/set values of fields" + + ''' + ''' This is a convenience method that provides direct access to the value of the record's TblRole_.RoleId field. + ''' + Public Function GetRoleIdValue() As ColumnValue + Return Me.GetValue(TableUtils.RoleIdColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's TblRole_.RoleId field. + ''' + Public Function GetRoleIdFieldValue() As Byte + Return CType(Me.GetValue(TableUtils.RoleIdColumn).ToByte(), Byte) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's TblRole_.Role field. + ''' + Public Function GetRoleValue() As ColumnValue + Return Me.GetValue(TableUtils.RoleColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's TblRole_.Role field. + ''' + Public Function GetRoleFieldValue() As String + Return CType(Me.GetValue(TableUtils.RoleColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's TblRole_.Role field. + ''' + Public Sub SetRoleFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.RoleColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's TblRole_.Role field. + ''' + Public Sub SetRoleFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.RoleColumn) + End Sub + + + +#End Region + +#Region "Convenience methods to get field names" + + ''' + ''' This is a convenience property that provides direct access to the value of the record's TblRole_.RoleId field. + ''' + Public Property RoleId() As Byte + Get + Return CType(Me.GetValue(TableUtils.RoleIdColumn).ToByte(), Byte) + End Get + Set (ByVal val As Byte) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.RoleIdColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property RoleIdSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.RoleIdColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property RoleIdDefault() As String + Get + Return TableUtils.RoleIdColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's TblRole_.Role field. + ''' + Public Property Role() As String + Get + Return CType(Me.GetValue(TableUtils.RoleColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.RoleColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property RoleSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.RoleColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property RoleDefault() As String + Get + Return TableUtils.RoleColumn.DefaultValue + End Get + End Property + + + +#End Region + +End Class +End Namespace diff --git a/App_Code/Business Layer/BaseTblRoleTable.vb b/App_Code/Business Layer/BaseTblRoleTable.vb new file mode 100644 index 0000000..d83b24c --- /dev/null +++ b/App_Code/Business Layer/BaseTblRoleTable.vb @@ -0,0 +1,776 @@ +' This class is "generated" and will be overwritten. +' Your customizations should be made in TblRoleRecord.vb + +Imports System.Data.SqlTypes +Imports System.Data +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider +Imports Persons.Data + +Namespace Persons.Business + +''' +''' The generated superclass for the class. +''' Provides access to the schema information and record data of a database table or view named tblRole. +''' +''' +''' The connection details (name, location, etc.) of the database and table (or view) accessed by this class +''' are resolved at runtime based on the connection string in the application's Web.Config file. +''' +''' This class is not intended to be instantiated directly. To obtain an instance of this class, use +''' TblRoleTable.Instance. +''' +''' +''' + + Public Class BaseTblRoleTable + Inherits PrimaryKeyTable + + + Private ReadOnly TableDefinitionString As String = TblRoleDefinition.GetXMLString() + + + + + + + + Protected Sub New() + MyBase.New() + Me.Initialize() + End Sub + + Protected Overridable Sub Initialize() + Dim def As New XmlTableDefinition(TableDefinitionString) + Me.TableDefinition = New TableDefinition() + Me.TableDefinition.TableClassName = System.Reflection.Assembly.CreateQualifiedName("App_Code", "Persons.Business.TblRoleTable") + def.InitializeTableDefinition(Me.TableDefinition) + Me.ConnectionName = def.GetConnectionName() + Me.RecordClassName = System.Reflection.Assembly.CreateQualifiedName("App_Code", "Persons.Business.TblRoleRecord") + Me.ApplicationName = "App_Code" + Me.DataAdapter = New TblRoleSqlTable() + Directcast(Me.DataAdapter, TblRoleSqlTable).ConnectionName = Me.ConnectionName + + Me.TableDefinition.AdapterMetaData = Me.DataAdapter.AdapterMetaData + RoleIdColumn.CodeName = "RoleId" + RoleColumn.CodeName = "Role" + + End Sub + +#Region "Overriden methods" + + +#End Region + +#Region "Properties for columns" + + ''' + ''' This is a convenience property that provides direct access to the table's TblRole_.RoleId column object. + ''' + Public ReadOnly Property RoleIdColumn() As BaseClasses.Data.NumberColumn + Get + Return CType(Me.TableDefinition.ColumnList(0), BaseClasses.Data.NumberColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's TblRole_.RoleId column object. + ''' + Public Shared ReadOnly Property RoleId() As BaseClasses.Data.NumberColumn + Get + Return TblRoleTable.Instance.RoleIdColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's TblRole_.Role column object. + ''' + Public ReadOnly Property RoleColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(1), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's TblRole_.Role column object. + ''' + Public Shared ReadOnly Property Role() As BaseClasses.Data.StringColumn + Get + Return TblRoleTable.Instance.RoleColumn + End Get + End Property + + +#End Region + + +#Region "Shared helper methods" + + ''' + ''' This is a shared function that can be used to get an array of TblRoleRecord records using a where clause. + ''' + Public Shared Function GetRecords(ByVal where As String) As TblRoleRecord() + + Return GetRecords(where, Nothing, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) + End Function + + ''' + ''' This is a shared function that can be used to get an array of TblRoleRecord records using a where clause. + ''' + Public Shared Function GetRecords(ByVal join As BaseFilter, ByVal where As String) As TblRoleRecord() + + Return GetRecords(join, where, Nothing, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) + End Function + + ''' + ''' This is a shared function that can be used to get an array of TblRoleRecord records using a where and order by clause. + ''' + Public Shared Function GetRecords( _ + ByVal where As String, _ + ByVal orderBy As OrderBy) As TblRoleRecord() + + Return GetRecords(where, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) + End Function + + ''' + ''' This is a shared function that can be used to get an array of TblRoleRecord records using a where and order by clause. + ''' + Public Shared Function GetRecords( _ + ByVal join As BaseFilter, _ + ByVal where As String, _ + ByVal orderBy As OrderBy) As TblRoleRecord() + + Return GetRecords(join, where, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) + End Function + + ''' + ''' This is a shared function that can be used to get an array of TblRoleRecord records using a where and order by clause clause with pagination. + ''' + Public Shared Function GetRecords( _ + ByVal where As String, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As TblRoleRecord() + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + Dim join As BaseClasses.Data.BaseFilter = Nothing + Dim recList As ArrayList = TblRoleTable.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, pageIndex, pageSize) + + Return CType(recList.ToArray(GetType(Persons.Business.TblRoleRecord)), TblRoleRecord()) + End Function + + ''' + ''' This is a shared function that can be used to get an array of TblRoleRecord records using a where and order by clause clause with pagination. + ''' + Public Shared Function GetRecords( _ + ByVal join As BaseFilter, _ + ByVal where As String, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As TblRoleRecord() + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Dim recList As ArrayList = TblRoleTable.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, pageIndex, pageSize) + + Return CType(recList.ToArray(GetType(Persons.Business.TblRoleRecord)), TblRoleRecord()) + End Function + + Public Shared Function GetRecords( _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As TblRoleRecord() + Dim join As BaseClasses.Data.BaseFilter = Nothing + Dim recList As ArrayList = TblRoleTable.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + Return CType(recList.ToArray(GetType(Persons.Business.TblRoleRecord)), TblRoleRecord()) + End Function + + Public Shared Function GetRecords( _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As TblRoleRecord() + + Dim recList As ArrayList = TblRoleTable.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + Return CType(recList.ToArray(GetType(Persons.Business.TblRoleRecord)), TblRoleRecord()) + End Function + + Public Shared Function GetRecords( _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer, _ + ByRef totalRecords As Integer) As TblRoleRecord() + Dim join As BaseClasses.Data.BaseFilter = Nothing + Dim recList As ArrayList = TblRoleTable.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize, totalRecords) + + Return CType(recList.ToArray(GetType(Persons.Business.TblRoleRecord)), TblRoleRecord()) + End Function + + Public Shared Function GetRecords( _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer, _ + ByRef totalRecords As Integer) As TblRoleRecord() + + Dim recList As ArrayList = TblRoleTable.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize, totalRecords) + + Return CType(recList.ToArray(GetType(Persons.Business.TblRoleRecord)), TblRoleRecord()) + End Function + + ''' + ''' This is a shared function that can be used to get total number of records that will be returned using the where clause. + ''' + Public Shared Function GetRecordCount(ByVal where As String) As Integer + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Return CInt(TblRoleTable.Instance.GetRecordListCount(Nothing, whereFilter, Nothing, Nothing)) + End Function + +''' + ''' This is a shared function that can be used to get total number of records that will be returned using the where clause. + ''' + Public Shared Function GetRecordCount(ByVal join As BaseFilter, ByVal where As String) As Integer + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Return CInt(TblRoleTable.Instance.GetRecordListCount(join, whereFilter, Nothing, Nothing)) + End Function + + Public Shared Function GetRecordCount(ByVal where As WhereClause) As Integer + Return CInt(TblRoleTable.Instance.GetRecordListCount(Nothing, where.GetFilter(), Nothing, Nothing)) + End Function + + Public Shared Function GetRecordCount(ByVal join As BaseFilter, ByVal where As WhereClause) As Integer + Return CInt(TblRoleTable.Instance.GetRecordListCount(join, where.GetFilter(), Nothing, Nothing)) + End Function + + ''' + ''' This is a shared function that can be used to get a TblRoleRecord record using a where clause. + ''' + Public Shared Function GetRecord(ByVal where As String) As TblRoleRecord + Dim orderBy As OrderBy = Nothing + Return GetRecord(where, orderBy) + End Function + + ''' + ''' This is a shared function that can be used to get a TblRoleRecord record using a where clause. + ''' + Public Shared Function GetRecord(ByVal join As BaseFilter, ByVal where As String) As TblRoleRecord + Dim orderBy As OrderBy = Nothing + Return GetRecord(join, where, orderBy) + End Function + + ''' + ''' This is a shared function that can be used to get a TblRoleRecord record using a where and order by clause. + ''' + Public Shared Function GetRecord( _ + ByVal where As String, _ + ByVal orderBy As OrderBy) As TblRoleRecord + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + Dim join As BaseClasses.Data.BaseFilter = Nothing + Dim recList As ArrayList = TblRoleTable.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MIN_BATCH_SIZE) + + Dim rec As TblRoleRecord = Nothing + If recList.Count > 0 Then + rec = CType(recList(0), TblRoleRecord) + End If + + Return rec + End Function + + ''' + ''' This is a shared function that can be used to get a TblRoleRecord record using a where and order by clause. + ''' + Public Shared Function GetRecord( _ + ByVal join As BaseFilter, _ + ByVal where As String, _ + ByVal orderBy As OrderBy) As TblRoleRecord + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Dim recList As ArrayList = TblRoleTable.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MIN_BATCH_SIZE) + + Dim rec As TblRoleRecord = Nothing + If recList.Count > 0 Then + rec = CType(recList(0), TblRoleRecord) + End If + + Return rec + End Function + + + Public Shared Function GetValues( _ + ByVal col As BaseColumn, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal maxItems As Integer) As String() + + ' Create the filter list. + Dim retCol As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, True) + retCol.AddColumn(col) + + Return TblRoleTable.Instance.GetColumnValues(retCol, Nothing, where.GetFilter(), Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, maxItems) + + End Function + + Public Shared Function GetValues( _ + ByVal col As BaseColumn, _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal maxItems As Integer) As String() + + ' Create the filter list. + Dim retCol As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, True) + retCol.AddColumn(col) + + Return TblRoleTable.Instance.GetColumnValues(retCol, join, where.GetFilter(), Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, maxItems) + + End Function + + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where clause. + ''' + Public Shared Function GetDataTable(ByVal where As String) As System.Data.DataTable + + Dim recs() As TblRoleRecord = GetRecords(where) + Return TblRoleTable.Instance.CreateDataTable(recs, Nothing) + End Function + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where clause. + ''' + Public Shared Function GetDataTable(ByVal join As BaseFilter, ByVal where As String) As System.Data.DataTable + + Dim recs() As TblRoleRecord = GetRecords(join, where) + Return TblRoleTable.Instance.CreateDataTable(recs, Nothing) + End Function + + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause. + ''' + Public Shared Function GetDataTable(ByVal where As String, ByVal orderBy As OrderBy) As System.Data.DataTable + + Dim recs() As TblRoleRecord = GetRecords(where, orderBy) + Return TblRoleTable.Instance.CreateDataTable(recs, Nothing) + End Function + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause. + ''' + Public Shared Function GetDataTable(ByVal join As BaseFilter, ByVal where As String, ByVal orderBy As OrderBy) As System.Data.DataTable + + Dim recs() As TblRoleRecord = GetRecords(join, where, orderBy) + Return TblRoleTable.Instance.CreateDataTable(recs, Nothing) + End Function + + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause with pagination. + ''' + Public Shared Function GetDataTable( _ + ByVal where As String, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As System.Data.DataTable + + Dim recs() As TblRoleRecord = GetRecords(where, orderBy, pageIndex, pageSize) + Return TblRoleTable.Instance.CreateDataTable(recs, Nothing) + End Function + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause with pagination. + ''' + Public Shared Function GetDataTable( _ + ByVal join As BaseFilter, _ + ByVal where As String, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As System.Data.DataTable + + Dim recs() As TblRoleRecord = GetRecords(join, where, orderBy, pageIndex, pageSize) + Return TblRoleTable.Instance.CreateDataTable(recs, Nothing) + End Function + + + ''' + ''' This is a shared function that can be used to delete records using a where clause. + ''' + Public Shared Sub DeleteRecords(ByVal where As String) + If where = Nothing OrElse where.Trim() = "" Then + Return + End If + + Dim whereFilter As SqlFilter = New SqlFilter(where) + TblRoleTable.Instance.DeleteRecordList(whereFilter) + End Sub + + ''' + ''' This is a shared function that can be used to export records using a where clause. + ''' + Public Shared Function Export(ByVal where As String) As String + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Return TblRoleTable.Instance.ExportRecordData(whereFilter) + End Function + + Public Shared Function Export(ByVal where As WhereClause) As String + Dim whereFilter As BaseFilter = Nothing + If Not where Is Nothing Then + whereFilter = where.GetFilter() + End If + + Return TblRoleTable.Instance.ExportRecordData(whereFilter) + End Function + + Public Shared Function GetSum( _ + ByVal col As BaseColumn, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) _ + As String + + Dim colSel As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, False) + colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Sum) + + Return TblRoleTable.Instance.GetColumnStatistics(colSel, Nothing, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + End Function + + Public Shared Function GetSum( _ + ByVal col As BaseColumn, _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) _ + As String + + Dim colSel As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, False) + colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Sum) + + Return TblRoleTable.Instance.GetColumnStatistics(colSel, join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + End Function + + + Public Shared Function GetCount( _ + ByVal col As BaseColumn, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) _ + As String + + Dim colSel As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, False) + colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Count) + + Return TblRoleTable.Instance.GetColumnStatistics(colSel, Nothing, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + End Function + + Public Shared Function GetCount( _ + ByVal col As BaseColumn, _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) _ + As String + + Dim colSel As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, False) + colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Count) + + Return TblRoleTable.Instance.GetColumnStatistics(colSel, join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + End Function + + ''' + ''' This method returns the columns in the table. + ''' + Public Shared Function GetColumns() As BaseColumn() + Return TblRoleTable.Instance.TableDefinition.Columns + End Function + + ''' + ''' This method returns the columnlist in the table. + ''' + Public Shared Function GetColumnList() As ColumnList + Return TblRoleTable.Instance.TableDefinition.ColumnList + End Function + + + ''' + ''' This method creates a new record and returns it to be edited. + ''' + Public Shared Function CreateNewRecord() As IRecord + Return TblRoleTable.Instance.CreateRecord() + End Function + + ''' + ''' This method creates a new record and returns it to be edited. + ''' + ''' ID of the new record. + Public Shared Function CreateNewRecord(ByVal tempId As String) As IRecord + Return TblRoleTable.Instance.CreateRecord(tempId) + End Function + + ''' + ''' This method checks if column is editable. + ''' + ''' Name of the column to check. + Public Shared Function isReadOnlyColumn(ByVal columnName As String) As Boolean + Dim column As BaseColumn = GetColumn(columnName) + If (Not IsNothing(column)) Then + Return column.IsValuesReadOnly + Else + Return True + End If + End Function + + ''' + ''' This method gets the specified column. + ''' + ''' Unique name of the column to fetch. + Public Shared Function GetColumn(ByVal uniqueColumnName As String) As BaseColumn + Dim column As BaseColumn = TblRoleTable.Instance.TableDefinition.ColumnList.GetByUniqueName(uniqueColumnName) + Return column + End Function + + ' Convenience method for getting a record using a string-based record identifier + Public Shared Function GetRecord(ByVal id As String, ByVal bMutable As Boolean) As TblRoleRecord + Return CType(TblRoleTable.Instance.GetRecordData(id, bMutable), TblRoleRecord) + End Function + + ' Convenience method for getting a record using a KeyValue record identifier + Public Shared Function GetRecord(ByVal id As KeyValue, ByVal bMutable As Boolean) As TblRoleRecord + Return CType(TblRoleTable.Instance.GetRecordData(id, bMutable), TblRoleRecord) + End Function + + ' Convenience method for creating a record + Public Overloads Function NewRecord( _ + ByVal RoleValue As String _ + ) As KeyValue + Dim rec As IPrimaryKeyRecord = CType(Me.CreateRecord(), IPrimaryKeyRecord) + rec.SetString(RoleValue, RoleColumn) + + + rec.Create() 'update the DB so any DB-initialized fields (like autoincrement IDs) can be initialized + + Dim key As KeyValue = rec.GetID() + Return key + End Function + + ''' + ''' This method deletes a specified record + ''' + ''' Keyvalue of the record to be deleted. + Public Shared Sub DeleteRecord(ByVal kv As KeyValue) + TblRoleTable.Instance.DeleteOneRecord(kv) + End Sub + + ''' + ''' This method checks if record exist in the database using the keyvalue provided. + ''' + ''' Key value of the record. + Public Shared Function DoesRecordExist(ByVal kv As KeyValue) As Boolean + Dim recordExist As Boolean = True + Try + TblRoleTable.GetRecord(kv, False) + Catch ex As Exception + recordExist = False + End Try + Return recordExist + End Function + + ''' + ''' This method returns all the primary columns in the table. + ''' + Public Shared Function GetPrimaryKeyColumns() As ColumnList + If (Not IsNothing(TblRoleTable.Instance.TableDefinition.PrimaryKey)) Then + Return TblRoleTable.Instance.TableDefinition.PrimaryKey.Columns + Else + Return Nothing + End If + End Function + + ''' + ''' This method takes a key and returns a keyvalue. + ''' + ''' key could be array of primary key values in case of composite primary key or a string containing single primary key value in case of non-composite primary key. + Public Shared Function GetKeyValue(ByVal key As Object) As KeyValue + Dim kv As KeyValue = Nothing + + If (Not (IsNothing(TblRoleTable.Instance.TableDefinition.PrimaryKey))) Then + + Dim isCompositePrimaryKey As Boolean = False + isCompositePrimaryKey = TblRoleTable.Instance.TableDefinition.PrimaryKey.IsCompositeKey + + If ((isCompositePrimaryKey) AndAlso (key.GetType.IsArray())) Then + + ' If the key is composite, then construct a key value. + kv = New KeyValue + Dim fullKeyString As String = "" + Dim keyArray As Array = CType(key, Array) + If (Not IsNothing(keyArray)) Then + Dim length As Integer = keyArray.Length + Dim pkColumns As ColumnList = TblRoleTable.Instance.TableDefinition.PrimaryKey.Columns + Dim pkColumn As BaseColumn + Dim index As Integer = 0 + For Each pkColumn In pkColumns + Dim keyString As String = CType(keyArray.GetValue(index), String) + If (TblRoleTable.Instance.TableDefinition.TableType = BaseClasses.Data.TableDefinition.TableTypes.Virtual) Then + kv.AddElement(pkColumn.UniqueName, keyString) + Else + kv.AddElement(pkColumn.InternalName, keyString) + End If + index = index + 1 + Next pkColumn + End If + + Else + ' If the key is not composite, then get the key value. + kv = TblRoleTable.Instance.TableDefinition.PrimaryKey.ParseValue(CType(key, String)) + End If + End If + Return kv + End Function + + + ''' + ''' This method takes a record and a Column and returns an evaluated value of DFKA formula. + ''' + Public Shared Function GetDFKA(ByVal rec As BaseRecord, ByVal col As BaseColumn) As String + Dim fkColumn As ForeignKey = TblRoleTable.Instance.TableDefinition.GetExpandableNonCompositeForeignKey(col) + If fkColumn Is Nothing Then + Return Nothing + End If + Dim _DFKA As String = fkColumn.PrimaryKeyDisplayColumns + If (_DFKA.Trim().StartsWith("=")) Then + ' if the formula is in the format of "= ., then pull out the data from the rec object instead of doing formula evaluation + Dim tableCodeName As String = fkColumn.PrimaryKeyTableDefinition.TableCodeName + Dim column As String = _DFKA.Trim("="c).Trim() + If column.StartsWith(tableCodeName & ".", StringComparison.InvariantCultureIgnoreCase) Then + column = column.Substring(tableCodeName.Length + 1) + End If + + For Each c As BaseColumn In fkColumn.PrimaryKeyTableDefinition.Columns + If column = c.CodeName Then + Return rec.Format(c) + End If + Next + Dim tableName As String = fkColumn.PrimaryKeyTableDefinition.TableCodeName + Return EvaluateFormula(_DFKA, rec, Nothing, tableName) + Else + Return Nothing + End If + End Function + + ''' + ''' This method takes a keyValue and a Column and returns an evaluated value of DFKA formula. + ''' + Public Shared Function GetDFKA(ByVal keyValue As String, ByVal col As BaseColumn, ByVal formatPattern as String) As String + If keyValue Is Nothing Then + Return Nothing + End If + Dim fkColumn As ForeignKey = TblRoleTable.Instance.TableDefinition.GetExpandableNonCompositeForeignKey(col) + If fkColumn Is Nothing Then + Return Nothing + End If + Dim _DFKA As String = fkColumn.PrimaryKeyDisplayColumns + If (_DFKA.Trim().StartsWith("=")) Then + Dim tableName As String = fkColumn.PrimaryKeyTableDefinition.TableCodeName + Dim t As PrimaryKeyTable = CType(DatabaseObjects.GetTableObject(tableName), PrimaryKeyTable) + Dim rec As BaseRecord = Nothing + If Not t Is Nothing Then + Try + rec = CType(t.GetRecordData(keyValue, False), BaseRecord) + Catch + rec = Nothing + End Try + End If + If rec Is Nothing Then + Return "" + End If + + ' if the formula is in the format of "= ., then pull out the data from the rec object instead of doing formula evaluation + Dim tableCodeName As String = fkColumn.PrimaryKeyTableDefinition.TableCodeName + Dim column As String = _DFKA.Trim("="c).Trim() + If column.StartsWith(tableCodeName & ".", StringComparison.InvariantCultureIgnoreCase) Then + column = column.Substring(tableCodeName.Length + 1) + End If + + For Each c As BaseColumn In fkColumn.PrimaryKeyTableDefinition.Columns + If column = c.CodeName Then + Return rec.Format(c) + End If + Next + Return EvaluateFormula(_DFKA, rec, Nothing, tableName) + Else + Return Nothing + End If + End Function + + ''' + ''' Evaluates the formula + ''' + Public Shared Function EvaluateFormula(ByVal formula As String, Optional ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord = Nothing, Optional ByVal format As String = Nothing, Optional ByVal name As String = "") As String + Dim e As BaseFormulaEvaluator = New BaseFormulaEvaluator() + If Not dataSourceForEvaluate Is Nothing Then + e.Evaluator.Variables.Add(name, dataSourceForEvaluate) + end if + e.DataSource = dataSourceForEvaluate + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + If Not String.IsNullOrEmpty(format) Then + Return BaseFormulaUtils.Format(resultObj, format) + Else + Return resultObj.ToString() + End If + End Function + + +#End Region + +End Class +End Namespace diff --git a/App_Code/Business Layer/BaseTblUserRoleRecord.vb b/App_Code/Business Layer/BaseTblUserRoleRecord.vb new file mode 100644 index 0000000..6eef1d2 --- /dev/null +++ b/App_Code/Business Layer/BaseTblUserRoleRecord.vb @@ -0,0 +1,350 @@ +' This class is "generated" and will be overwritten. +' Your customizations should be made in TblUserRoleRecord.vb + +Imports System.Data.SqlTypes +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + +Namespace Persons.Business + +''' +''' The generated superclass for the class. +''' +''' +''' This class is not intended to be instantiated directly. To obtain an instance of this class, +''' use the methods of the class. +''' +''' +''' + + Public Class BaseTblUserRoleRecord + Inherits PrimaryKeyRecord + Implements IUserRoleRecord + + + Public Shared Shadows ReadOnly TableUtils As TblUserRoleTable = TblUserRoleTable.Instance + + ' Constructors + + Protected Sub New() + MyBase.New(TableUtils) + End Sub + + Protected Sub New(ByVal record As PrimaryKeyRecord) + MyBase.New(record, TableUtils) + End Sub + + 'Evaluates Initialize when->Inserting record formulas specified at the data access layer + Public Overridable Sub TblUserRoleRecord_InsertingRecord(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles Me.InsertingRecord + 'Apply Initialize->Inserting record formula only if validation is successful. + Dim TblUserRoleRec As TblUserRoleRecord = CType(sender,TblUserRoleRecord) + Validate_Inserting() + If Not TblUserRoleRec Is Nothing AndAlso Not TblUserRoleRec.IsReadOnly Then + End If + End Sub + + 'Evaluates Initialize when->Updating record formulas specified at the data access layer + Public Overridable Sub TblUserRoleRecord_UpdatingRecord(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles Me.UpdatingRecord + 'Apply Initialize->Updating record formula only if validation is successful. + Dim TblUserRoleRec As TblUserRoleRecord = CType(sender,TblUserRoleRecord) + Validate_Updating() + If Not TblUserRoleRec Is Nothing AndAlso Not TblUserRoleRec.IsReadOnly Then + End If + End Sub + + 'Evaluates Initialize when->Reading record formulas specified at the data access layer + Public Overridable Sub TblUserRoleRecord_ReadRecord(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.ReadRecord + 'Apply Initialize->Reading record formula only if validation is successful. + Dim TblUserRoleRec As TblUserRoleRecord = CType(sender,TblUserRoleRecord) + If Not TblUserRoleRec Is Nothing AndAlso Not TblUserRoleRec.IsReadOnly Then + End If + End Sub + + 'Evaluates Validate when->Inserting formulas specified at the data access layer + Public Overridable Sub Validate_Inserting () + Dim fullValidationMessage As String = "" + Dim validationMessage As String = "" + + dim formula as String = "" + + + If validationMessage <> "" AndAlso validationMessage.ToLower() <> "true" Then + fullValidationMessage &= validationMessage & vbCrLf + End If + + If fullValidationMessage <> "" Then + Throw New Exception(fullValidationMessage) + End If + End Sub + + 'Evaluates Validate when->Updating formulas specified at the data access layer + Public Overridable Sub Validate_Updating () + Dim fullValidationMessage As String = "" + Dim validationMessage As String = "" + + dim formula as String = "" + + + If validationMessage <> "" AndAlso validationMessage.ToLower() <> "true" Then + fullValidationMessage &= validationMessage & vbCrLf + End If + + If fullValidationMessage <> "" Then + Throw New Exception(fullValidationMessage) + End If + End Sub + + Public Overridable Function EvaluateFormula(ByVal formula As String, Optional ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord = Nothing, Optional ByVal format As String = Nothing) As String + + Dim e As Data.BaseFormulaEvaluator = New Data.BaseFormulaEvaluator() + + ' All variables referred to in the formula are expected to be + ' properties of the DataSource. For example, referring to + ' UnitPrice as a variable will refer to DataSource.UnitPrice + e.DataSource = dataSourceForEvaluate + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + Return resultObj.ToString() + End Function + +#Region "IUserRecord Members" + + ' Get the user's unique identifier + Public Function GetUserId() As String Implements IUserRecord.GetUserId + Return CType(Me, IRecord).GetString(CType(Me.TableAccess, IUserTable).UserIdColumn) + End Function + +#End Region + + + + +#Region "IUserRoleRecord Members" + + ' Get the role to which this user belongs + Public Function GetUserRole() As String Implements IUserRoleRecord.GetUserRole + Return CType(Me, IRecord).GetString(CType(Me.TableAccess, IUserRoleTable).UserRoleColumn) + End Function + +#End Region + + +#Region "Convenience methods to get/set values of fields" + + ''' + ''' This is a convenience method that provides direct access to the value of the record's TblUserRole_.UserRoleId field. + ''' + Public Function GetUserRoleIdValue() As ColumnValue + Return Me.GetValue(TableUtils.UserRoleIdColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's TblUserRole_.UserRoleId field. + ''' + Public Function GetUserRoleIdFieldValue() As Int32 + Return CType(Me.GetValue(TableUtils.UserRoleIdColumn).ToInt32(), Int32) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's TblUserRole_.PersonalId field. + ''' + Public Function GetPersonalIdValue() As ColumnValue + Return Me.GetValue(TableUtils.PersonalIdColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's TblUserRole_.PersonalId field. + ''' + Public Function GetPersonalIdFieldValue() As String + Return CType(Me.GetValue(TableUtils.PersonalIdColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's TblUserRole_.PersonalId field. + ''' + Public Sub SetPersonalIdFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.PersonalIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's TblUserRole_.PersonalId field. + ''' + Public Sub SetPersonalIdFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.PersonalIdColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's TblUserRole_.RoleId field. + ''' + Public Function GetRoleIdValue() As ColumnValue + Return Me.GetValue(TableUtils.RoleIdColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's TblUserRole_.RoleId field. + ''' + Public Function GetRoleIdFieldValue() As Byte + Return CType(Me.GetValue(TableUtils.RoleIdColumn).ToByte(), Byte) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's TblUserRole_.RoleId field. + ''' + Public Sub SetRoleIdFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.RoleIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's TblUserRole_.RoleId field. + ''' + Public Sub SetRoleIdFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.RoleIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's TblUserRole_.RoleId field. + ''' + Public Sub SetRoleIdFieldValue(ByVal val As Double) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.RoleIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's TblUserRole_.RoleId field. + ''' + Public Sub SetRoleIdFieldValue(ByVal val As Decimal) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.RoleIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's TblUserRole_.RoleId field. + ''' + Public Sub SetRoleIdFieldValue(ByVal val As Int64) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.RoleIdColumn) + End Sub + + +#End Region + +#Region "Convenience methods to get field names" + + ''' + ''' This is a convenience property that provides direct access to the value of the record's TblUserRole_.UserRoleId field. + ''' + Public Property UserRoleId() As Int32 + Get + Return CType(Me.GetValue(TableUtils.UserRoleIdColumn).ToInt32(), Int32) + End Get + Set (ByVal val As Int32) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.UserRoleIdColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property UserRoleIdSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.UserRoleIdColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property UserRoleIdDefault() As String + Get + Return TableUtils.UserRoleIdColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's TblUserRole_.PersonalId field. + ''' + Public Property PersonalId() As String + Get + Return CType(Me.GetValue(TableUtils.PersonalIdColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.PersonalIdColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property PersonalIdSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.PersonalIdColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property PersonalIdDefault() As String + Get + Return TableUtils.PersonalIdColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's TblUserRole_.RoleId field. + ''' + Public Property RoleId() As Byte + Get + Return CType(Me.GetValue(TableUtils.RoleIdColumn).ToByte(), Byte) + End Get + Set (ByVal val As Byte) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.RoleIdColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property RoleIdSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.RoleIdColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property RoleIdDefault() As String + Get + Return TableUtils.RoleIdColumn.DefaultValue + End Get + End Property + + + +#End Region + +End Class +End Namespace diff --git a/App_Code/Business Layer/BaseTblUserRoleTable.vb b/App_Code/Business Layer/BaseTblUserRoleTable.vb new file mode 100644 index 0000000..da8dfbd --- /dev/null +++ b/App_Code/Business Layer/BaseTblUserRoleTable.vb @@ -0,0 +1,839 @@ +' This class is "generated" and will be overwritten. +' Your customizations should be made in TblUserRoleRecord.vb + +Imports System.Data.SqlTypes +Imports System.Data +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider +Imports Persons.Data + +Namespace Persons.Business + +''' +''' The generated superclass for the class. +''' Provides access to the schema information and record data of a database table or view named tblUserRole. +''' +''' +''' The connection details (name, location, etc.) of the database and table (or view) accessed by this class +''' are resolved at runtime based on the connection string in the application's Web.Config file. +''' +''' This class is not intended to be instantiated directly. To obtain an instance of this class, use +''' TblUserRoleTable.Instance. +''' +''' +''' + + Public Class BaseTblUserRoleTable + Inherits PrimaryKeyTable + Implements IUserRoleTable + + + Private ReadOnly TableDefinitionString As String = TblUserRoleDefinition.GetXMLString() + +#Region "IUserTable Members" + + ' Get the column that specifies the user's unique identifier + Public ReadOnly Property UserId() As BaseColumn Implements IUserTable.UserIdColumn + Get + Return Me.TableDefinition.ColumnList.GetByNumber(1) + End Get + End Property + + ' Get a list of records that match the criteria specified in a filter + Public Overloads Function GetRecordList( _ + ByVal userId As String, _ + ByVal filter As BaseFilter, _ + ByVal orderBy As OrderBy, _ + ByVal pageNumber As Integer, _ + ByVal batchSize As Integer, _ + Optional ByRef totalRows As Integer = Nothing _ + ) As ArrayList + If (Not IsNothing(userId)) Then + filter = BaseFilter.CombineFilters( _ + CompoundFilter.CompoundingOperators.And_Operator, _ + filter, _ + BaseFilter.CreateUserIdFilter(CType(Me, IUserTable), userId)) + End If + Dim join As BaseClasses.Data.BaseFilter = Nothing + Return CType(Me, ITable).GetRecordList(join, filter, Nothing, orderBy, pageNumber, batchSize, totalRows) + End Function + +#End Region + + + + + +#Region "IUserRoleTable Members" + + ' Get the column that specifies role values + Public ReadOnly Property UserRole() As BaseColumn Implements IUserRoleTable.UserRoleColumn + Get + Return Me.TableDefinition.ColumnList.GetByNumber(2) + End Get + End Property + +#End Region + + + Protected Sub New() + MyBase.New() + Me.Initialize() + End Sub + + Protected Overridable Sub Initialize() + Dim def As New XmlTableDefinition(TableDefinitionString) + Me.TableDefinition = New TableDefinition() + Me.TableDefinition.TableClassName = System.Reflection.Assembly.CreateQualifiedName("App_Code", "Persons.Business.TblUserRoleTable") + def.InitializeTableDefinition(Me.TableDefinition) + Me.ConnectionName = def.GetConnectionName() + Me.RecordClassName = System.Reflection.Assembly.CreateQualifiedName("App_Code", "Persons.Business.TblUserRoleRecord") + Me.ApplicationName = "App_Code" + Me.DataAdapter = New TblUserRoleSqlTable() + Directcast(Me.DataAdapter, TblUserRoleSqlTable).ConnectionName = Me.ConnectionName + + Me.TableDefinition.AdapterMetaData = Me.DataAdapter.AdapterMetaData + UserRoleIdColumn.CodeName = "UserRoleId" + PersonalIdColumn.CodeName = "PersonalId" + RoleIdColumn.CodeName = "RoleId" + + End Sub + +#Region "Overriden methods" + + +#End Region + +#Region "Properties for columns" + + ''' + ''' This is a convenience property that provides direct access to the table's TblUserRole_.UserRoleId column object. + ''' + Public ReadOnly Property UserRoleIdColumn() As BaseClasses.Data.NumberColumn + Get + Return CType(Me.TableDefinition.ColumnList(0), BaseClasses.Data.NumberColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's TblUserRole_.UserRoleId column object. + ''' + Public Shared ReadOnly Property UserRoleId() As BaseClasses.Data.NumberColumn + Get + Return TblUserRoleTable.Instance.UserRoleIdColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's TblUserRole_.PersonalId column object. + ''' + Public ReadOnly Property PersonalIdColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(1), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's TblUserRole_.PersonalId column object. + ''' + Public Shared ReadOnly Property PersonalId() As BaseClasses.Data.StringColumn + Get + Return TblUserRoleTable.Instance.PersonalIdColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's TblUserRole_.RoleId column object. + ''' + Public ReadOnly Property RoleIdColumn() As BaseClasses.Data.NumberColumn + Get + Return CType(Me.TableDefinition.ColumnList(2), BaseClasses.Data.NumberColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's TblUserRole_.RoleId column object. + ''' + Public Shared ReadOnly Property RoleId() As BaseClasses.Data.NumberColumn + Get + Return TblUserRoleTable.Instance.RoleIdColumn + End Get + End Property + + +#End Region + + +#Region "Shared helper methods" + + ''' + ''' This is a shared function that can be used to get an array of TblUserRoleRecord records using a where clause. + ''' + Public Shared Function GetRecords(ByVal where As String) As TblUserRoleRecord() + + Return GetRecords(where, Nothing, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) + End Function + + ''' + ''' This is a shared function that can be used to get an array of TblUserRoleRecord records using a where clause. + ''' + Public Shared Function GetRecords(ByVal join As BaseFilter, ByVal where As String) As TblUserRoleRecord() + + Return GetRecords(join, where, Nothing, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) + End Function + + ''' + ''' This is a shared function that can be used to get an array of TblUserRoleRecord records using a where and order by clause. + ''' + Public Shared Function GetRecords( _ + ByVal where As String, _ + ByVal orderBy As OrderBy) As TblUserRoleRecord() + + Return GetRecords(where, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) + End Function + + ''' + ''' This is a shared function that can be used to get an array of TblUserRoleRecord records using a where and order by clause. + ''' + Public Shared Function GetRecords( _ + ByVal join As BaseFilter, _ + ByVal where As String, _ + ByVal orderBy As OrderBy) As TblUserRoleRecord() + + Return GetRecords(join, where, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) + End Function + + ''' + ''' This is a shared function that can be used to get an array of TblUserRoleRecord records using a where and order by clause clause with pagination. + ''' + Public Shared Function GetRecords( _ + ByVal where As String, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As TblUserRoleRecord() + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + Dim join As BaseClasses.Data.BaseFilter = Nothing + Dim recList As ArrayList = TblUserRoleTable.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, pageIndex, pageSize) + + Return CType(recList.ToArray(GetType(Persons.Business.TblUserRoleRecord)), TblUserRoleRecord()) + End Function + + ''' + ''' This is a shared function that can be used to get an array of TblUserRoleRecord records using a where and order by clause clause with pagination. + ''' + Public Shared Function GetRecords( _ + ByVal join As BaseFilter, _ + ByVal where As String, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As TblUserRoleRecord() + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Dim recList As ArrayList = TblUserRoleTable.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, pageIndex, pageSize) + + Return CType(recList.ToArray(GetType(Persons.Business.TblUserRoleRecord)), TblUserRoleRecord()) + End Function + + Public Shared Function GetRecords( _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As TblUserRoleRecord() + Dim join As BaseClasses.Data.BaseFilter = Nothing + Dim recList As ArrayList = TblUserRoleTable.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + Return CType(recList.ToArray(GetType(Persons.Business.TblUserRoleRecord)), TblUserRoleRecord()) + End Function + + Public Shared Function GetRecords( _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As TblUserRoleRecord() + + Dim recList As ArrayList = TblUserRoleTable.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + Return CType(recList.ToArray(GetType(Persons.Business.TblUserRoleRecord)), TblUserRoleRecord()) + End Function + + Public Shared Function GetRecords( _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer, _ + ByRef totalRecords As Integer) As TblUserRoleRecord() + Dim join As BaseClasses.Data.BaseFilter = Nothing + Dim recList As ArrayList = TblUserRoleTable.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize, totalRecords) + + Return CType(recList.ToArray(GetType(Persons.Business.TblUserRoleRecord)), TblUserRoleRecord()) + End Function + + Public Shared Function GetRecords( _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer, _ + ByRef totalRecords As Integer) As TblUserRoleRecord() + + Dim recList As ArrayList = TblUserRoleTable.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize, totalRecords) + + Return CType(recList.ToArray(GetType(Persons.Business.TblUserRoleRecord)), TblUserRoleRecord()) + End Function + + ''' + ''' This is a shared function that can be used to get total number of records that will be returned using the where clause. + ''' + Public Shared Function GetRecordCount(ByVal where As String) As Integer + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Return CInt(TblUserRoleTable.Instance.GetRecordListCount(Nothing, whereFilter, Nothing, Nothing)) + End Function + +''' + ''' This is a shared function that can be used to get total number of records that will be returned using the where clause. + ''' + Public Shared Function GetRecordCount(ByVal join As BaseFilter, ByVal where As String) As Integer + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Return CInt(TblUserRoleTable.Instance.GetRecordListCount(join, whereFilter, Nothing, Nothing)) + End Function + + Public Shared Function GetRecordCount(ByVal where As WhereClause) As Integer + Return CInt(TblUserRoleTable.Instance.GetRecordListCount(Nothing, where.GetFilter(), Nothing, Nothing)) + End Function + + Public Shared Function GetRecordCount(ByVal join As BaseFilter, ByVal where As WhereClause) As Integer + Return CInt(TblUserRoleTable.Instance.GetRecordListCount(join, where.GetFilter(), Nothing, Nothing)) + End Function + + ''' + ''' This is a shared function that can be used to get a TblUserRoleRecord record using a where clause. + ''' + Public Shared Function GetRecord(ByVal where As String) As TblUserRoleRecord + Dim orderBy As OrderBy = Nothing + Return GetRecord(where, orderBy) + End Function + + ''' + ''' This is a shared function that can be used to get a TblUserRoleRecord record using a where clause. + ''' + Public Shared Function GetRecord(ByVal join As BaseFilter, ByVal where As String) As TblUserRoleRecord + Dim orderBy As OrderBy = Nothing + Return GetRecord(join, where, orderBy) + End Function + + ''' + ''' This is a shared function that can be used to get a TblUserRoleRecord record using a where and order by clause. + ''' + Public Shared Function GetRecord( _ + ByVal where As String, _ + ByVal orderBy As OrderBy) As TblUserRoleRecord + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + Dim join As BaseClasses.Data.BaseFilter = Nothing + Dim recList As ArrayList = TblUserRoleTable.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MIN_BATCH_SIZE) + + Dim rec As TblUserRoleRecord = Nothing + If recList.Count > 0 Then + rec = CType(recList(0), TblUserRoleRecord) + End If + + Return rec + End Function + + ''' + ''' This is a shared function that can be used to get a TblUserRoleRecord record using a where and order by clause. + ''' + Public Shared Function GetRecord( _ + ByVal join As BaseFilter, _ + ByVal where As String, _ + ByVal orderBy As OrderBy) As TblUserRoleRecord + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Dim recList As ArrayList = TblUserRoleTable.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MIN_BATCH_SIZE) + + Dim rec As TblUserRoleRecord = Nothing + If recList.Count > 0 Then + rec = CType(recList(0), TblUserRoleRecord) + End If + + Return rec + End Function + + + Public Shared Function GetValues( _ + ByVal col As BaseColumn, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal maxItems As Integer) As String() + + ' Create the filter list. + Dim retCol As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, True) + retCol.AddColumn(col) + + Return TblUserRoleTable.Instance.GetColumnValues(retCol, Nothing, where.GetFilter(), Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, maxItems) + + End Function + + Public Shared Function GetValues( _ + ByVal col As BaseColumn, _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal maxItems As Integer) As String() + + ' Create the filter list. + Dim retCol As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, True) + retCol.AddColumn(col) + + Return TblUserRoleTable.Instance.GetColumnValues(retCol, join, where.GetFilter(), Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, maxItems) + + End Function + + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where clause. + ''' + Public Shared Function GetDataTable(ByVal where As String) As System.Data.DataTable + + Dim recs() As TblUserRoleRecord = GetRecords(where) + Return TblUserRoleTable.Instance.CreateDataTable(recs, Nothing) + End Function + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where clause. + ''' + Public Shared Function GetDataTable(ByVal join As BaseFilter, ByVal where As String) As System.Data.DataTable + + Dim recs() As TblUserRoleRecord = GetRecords(join, where) + Return TblUserRoleTable.Instance.CreateDataTable(recs, Nothing) + End Function + + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause. + ''' + Public Shared Function GetDataTable(ByVal where As String, ByVal orderBy As OrderBy) As System.Data.DataTable + + Dim recs() As TblUserRoleRecord = GetRecords(where, orderBy) + Return TblUserRoleTable.Instance.CreateDataTable(recs, Nothing) + End Function + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause. + ''' + Public Shared Function GetDataTable(ByVal join As BaseFilter, ByVal where As String, ByVal orderBy As OrderBy) As System.Data.DataTable + + Dim recs() As TblUserRoleRecord = GetRecords(join, where, orderBy) + Return TblUserRoleTable.Instance.CreateDataTable(recs, Nothing) + End Function + + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause with pagination. + ''' + Public Shared Function GetDataTable( _ + ByVal where As String, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As System.Data.DataTable + + Dim recs() As TblUserRoleRecord = GetRecords(where, orderBy, pageIndex, pageSize) + Return TblUserRoleTable.Instance.CreateDataTable(recs, Nothing) + End Function + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause with pagination. + ''' + Public Shared Function GetDataTable( _ + ByVal join As BaseFilter, _ + ByVal where As String, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As System.Data.DataTable + + Dim recs() As TblUserRoleRecord = GetRecords(join, where, orderBy, pageIndex, pageSize) + Return TblUserRoleTable.Instance.CreateDataTable(recs, Nothing) + End Function + + + ''' + ''' This is a shared function that can be used to delete records using a where clause. + ''' + Public Shared Sub DeleteRecords(ByVal where As String) + If where = Nothing OrElse where.Trim() = "" Then + Return + End If + + Dim whereFilter As SqlFilter = New SqlFilter(where) + TblUserRoleTable.Instance.DeleteRecordList(whereFilter) + End Sub + + ''' + ''' This is a shared function that can be used to export records using a where clause. + ''' + Public Shared Function Export(ByVal where As String) As String + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Return TblUserRoleTable.Instance.ExportRecordData(whereFilter) + End Function + + Public Shared Function Export(ByVal where As WhereClause) As String + Dim whereFilter As BaseFilter = Nothing + If Not where Is Nothing Then + whereFilter = where.GetFilter() + End If + + Return TblUserRoleTable.Instance.ExportRecordData(whereFilter) + End Function + + Public Shared Function GetSum( _ + ByVal col As BaseColumn, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) _ + As String + + Dim colSel As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, False) + colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Sum) + + Return TblUserRoleTable.Instance.GetColumnStatistics(colSel, Nothing, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + End Function + + Public Shared Function GetSum( _ + ByVal col As BaseColumn, _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) _ + As String + + Dim colSel As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, False) + colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Sum) + + Return TblUserRoleTable.Instance.GetColumnStatistics(colSel, join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + End Function + + + Public Shared Function GetCount( _ + ByVal col As BaseColumn, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) _ + As String + + Dim colSel As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, False) + colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Count) + + Return TblUserRoleTable.Instance.GetColumnStatistics(colSel, Nothing, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + End Function + + Public Shared Function GetCount( _ + ByVal col As BaseColumn, _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) _ + As String + + Dim colSel As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, False) + colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Count) + + Return TblUserRoleTable.Instance.GetColumnStatistics(colSel, join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + End Function + + ''' + ''' This method returns the columns in the table. + ''' + Public Shared Function GetColumns() As BaseColumn() + Return TblUserRoleTable.Instance.TableDefinition.Columns + End Function + + ''' + ''' This method returns the columnlist in the table. + ''' + Public Shared Function GetColumnList() As ColumnList + Return TblUserRoleTable.Instance.TableDefinition.ColumnList + End Function + + + ''' + ''' This method creates a new record and returns it to be edited. + ''' + Public Shared Function CreateNewRecord() As IRecord + Return TblUserRoleTable.Instance.CreateRecord() + End Function + + ''' + ''' This method creates a new record and returns it to be edited. + ''' + ''' ID of the new record. + Public Shared Function CreateNewRecord(ByVal tempId As String) As IRecord + Return TblUserRoleTable.Instance.CreateRecord(tempId) + End Function + + ''' + ''' This method checks if column is editable. + ''' + ''' Name of the column to check. + Public Shared Function isReadOnlyColumn(ByVal columnName As String) As Boolean + Dim column As BaseColumn = GetColumn(columnName) + If (Not IsNothing(column)) Then + Return column.IsValuesReadOnly + Else + Return True + End If + End Function + + ''' + ''' This method gets the specified column. + ''' + ''' Unique name of the column to fetch. + Public Shared Function GetColumn(ByVal uniqueColumnName As String) As BaseColumn + Dim column As BaseColumn = TblUserRoleTable.Instance.TableDefinition.ColumnList.GetByUniqueName(uniqueColumnName) + Return column + End Function + + ' Convenience method for getting a record using a string-based record identifier + Public Shared Function GetRecord(ByVal id As String, ByVal bMutable As Boolean) As TblUserRoleRecord + Return CType(TblUserRoleTable.Instance.GetRecordData(id, bMutable), TblUserRoleRecord) + End Function + + ' Convenience method for getting a record using a KeyValue record identifier + Public Shared Function GetRecord(ByVal id As KeyValue, ByVal bMutable As Boolean) As TblUserRoleRecord + Return CType(TblUserRoleTable.Instance.GetRecordData(id, bMutable), TblUserRoleRecord) + End Function + + ' Convenience method for creating a record + Public Overloads Function NewRecord( _ + ByVal PersonalIdValue As String, _ + ByVal RoleIdValue As String _ + ) As KeyValue + Dim rec As IPrimaryKeyRecord = CType(Me.CreateRecord(), IPrimaryKeyRecord) + rec.SetString(PersonalIdValue, PersonalIdColumn) + rec.SetString(RoleIdValue, RoleIdColumn) + + + rec.Create() 'update the DB so any DB-initialized fields (like autoincrement IDs) can be initialized + + Dim key As KeyValue = rec.GetID() + Return key + End Function + + ''' + ''' This method deletes a specified record + ''' + ''' Keyvalue of the record to be deleted. + Public Shared Sub DeleteRecord(ByVal kv As KeyValue) + TblUserRoleTable.Instance.DeleteOneRecord(kv) + End Sub + + ''' + ''' This method checks if record exist in the database using the keyvalue provided. + ''' + ''' Key value of the record. + Public Shared Function DoesRecordExist(ByVal kv As KeyValue) As Boolean + Dim recordExist As Boolean = True + Try + TblUserRoleTable.GetRecord(kv, False) + Catch ex As Exception + recordExist = False + End Try + Return recordExist + End Function + + ''' + ''' This method returns all the primary columns in the table. + ''' + Public Shared Function GetPrimaryKeyColumns() As ColumnList + If (Not IsNothing(TblUserRoleTable.Instance.TableDefinition.PrimaryKey)) Then + Return TblUserRoleTable.Instance.TableDefinition.PrimaryKey.Columns + Else + Return Nothing + End If + End Function + + ''' + ''' This method takes a key and returns a keyvalue. + ''' + ''' key could be array of primary key values in case of composite primary key or a string containing single primary key value in case of non-composite primary key. + Public Shared Function GetKeyValue(ByVal key As Object) As KeyValue + Dim kv As KeyValue = Nothing + + If (Not (IsNothing(TblUserRoleTable.Instance.TableDefinition.PrimaryKey))) Then + + Dim isCompositePrimaryKey As Boolean = False + isCompositePrimaryKey = TblUserRoleTable.Instance.TableDefinition.PrimaryKey.IsCompositeKey + + If ((isCompositePrimaryKey) AndAlso (key.GetType.IsArray())) Then + + ' If the key is composite, then construct a key value. + kv = New KeyValue + Dim fullKeyString As String = "" + Dim keyArray As Array = CType(key, Array) + If (Not IsNothing(keyArray)) Then + Dim length As Integer = keyArray.Length + Dim pkColumns As ColumnList = TblUserRoleTable.Instance.TableDefinition.PrimaryKey.Columns + Dim pkColumn As BaseColumn + Dim index As Integer = 0 + For Each pkColumn In pkColumns + Dim keyString As String = CType(keyArray.GetValue(index), String) + If (TblUserRoleTable.Instance.TableDefinition.TableType = BaseClasses.Data.TableDefinition.TableTypes.Virtual) Then + kv.AddElement(pkColumn.UniqueName, keyString) + Else + kv.AddElement(pkColumn.InternalName, keyString) + End If + index = index + 1 + Next pkColumn + End If + + Else + ' If the key is not composite, then get the key value. + kv = TblUserRoleTable.Instance.TableDefinition.PrimaryKey.ParseValue(CType(key, String)) + End If + End If + Return kv + End Function + + + ''' + ''' This method takes a record and a Column and returns an evaluated value of DFKA formula. + ''' + Public Shared Function GetDFKA(ByVal rec As BaseRecord, ByVal col As BaseColumn) As String + Dim fkColumn As ForeignKey = TblUserRoleTable.Instance.TableDefinition.GetExpandableNonCompositeForeignKey(col) + If fkColumn Is Nothing Then + Return Nothing + End If + Dim _DFKA As String = fkColumn.PrimaryKeyDisplayColumns + If (_DFKA.Trim().StartsWith("=")) Then + ' if the formula is in the format of "= ., then pull out the data from the rec object instead of doing formula evaluation + Dim tableCodeName As String = fkColumn.PrimaryKeyTableDefinition.TableCodeName + Dim column As String = _DFKA.Trim("="c).Trim() + If column.StartsWith(tableCodeName & ".", StringComparison.InvariantCultureIgnoreCase) Then + column = column.Substring(tableCodeName.Length + 1) + End If + + For Each c As BaseColumn In fkColumn.PrimaryKeyTableDefinition.Columns + If column = c.CodeName Then + Return rec.Format(c) + End If + Next + Dim tableName As String = fkColumn.PrimaryKeyTableDefinition.TableCodeName + Return EvaluateFormula(_DFKA, rec, Nothing, tableName) + Else + Return Nothing + End If + End Function + + ''' + ''' This method takes a keyValue and a Column and returns an evaluated value of DFKA formula. + ''' + Public Shared Function GetDFKA(ByVal keyValue As String, ByVal col As BaseColumn, ByVal formatPattern as String) As String + If keyValue Is Nothing Then + Return Nothing + End If + Dim fkColumn As ForeignKey = TblUserRoleTable.Instance.TableDefinition.GetExpandableNonCompositeForeignKey(col) + If fkColumn Is Nothing Then + Return Nothing + End If + Dim _DFKA As String = fkColumn.PrimaryKeyDisplayColumns + If (_DFKA.Trim().StartsWith("=")) Then + Dim tableName As String = fkColumn.PrimaryKeyTableDefinition.TableCodeName + Dim t As PrimaryKeyTable = CType(DatabaseObjects.GetTableObject(tableName), PrimaryKeyTable) + Dim rec As BaseRecord = Nothing + If Not t Is Nothing Then + Try + rec = CType(t.GetRecordData(keyValue, False), BaseRecord) + Catch + rec = Nothing + End Try + End If + If rec Is Nothing Then + Return "" + End If + + ' if the formula is in the format of "= ., then pull out the data from the rec object instead of doing formula evaluation + Dim tableCodeName As String = fkColumn.PrimaryKeyTableDefinition.TableCodeName + Dim column As String = _DFKA.Trim("="c).Trim() + If column.StartsWith(tableCodeName & ".", StringComparison.InvariantCultureIgnoreCase) Then + column = column.Substring(tableCodeName.Length + 1) + End If + + For Each c As BaseColumn In fkColumn.PrimaryKeyTableDefinition.Columns + If column = c.CodeName Then + Return rec.Format(c) + End If + Next + Return EvaluateFormula(_DFKA, rec, Nothing, tableName) + Else + Return Nothing + End If + End Function + + ''' + ''' Evaluates the formula + ''' + Public Shared Function EvaluateFormula(ByVal formula As String, Optional ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord = Nothing, Optional ByVal format As String = Nothing, Optional ByVal name As String = "") As String + Dim e As BaseFormulaEvaluator = New BaseFormulaEvaluator() + If Not dataSourceForEvaluate Is Nothing Then + e.Evaluator.Variables.Add(name, dataSourceForEvaluate) + end if + e.DataSource = dataSourceForEvaluate + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + If Not String.IsNullOrEmpty(format) Then + Return BaseFormulaUtils.Format(resultObj, format) + Else + Return resultObj.ToString() + End If + End Function + + +#End Region + +End Class +End Namespace diff --git a/App_Code/Business Layer/BaseView_MaxPersonalEducationRecord.vb b/App_Code/Business Layer/BaseView_MaxPersonalEducationRecord.vb new file mode 100644 index 0000000..8f506e2 --- /dev/null +++ b/App_Code/Business Layer/BaseView_MaxPersonalEducationRecord.vb @@ -0,0 +1,2294 @@ +' This class is "generated" and will be overwritten. +' Your customizations should be made in View_MaxPersonalEducationRecord.vb + +Imports System.Data.SqlTypes +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + +Namespace Persons.Business + +''' +''' The generated superclass for the class. +''' +''' +''' This class is not intended to be instantiated directly. To obtain an instance of this class, +''' use the methods of the class. +''' +''' +''' + + Public Class BaseView_MaxPersonalEducationRecord + Inherits PrimaryKeyRecord + + + Public Shared Shadows ReadOnly TableUtils As View_MaxPersonalEducationView = View_MaxPersonalEducationView.Instance + + ' Constructors + + Protected Sub New() + MyBase.New(TableUtils) + End Sub + + Protected Sub New(ByVal record As PrimaryKeyRecord) + MyBase.New(record, TableUtils) + End Sub + + 'Evaluates Initialize when->Inserting record formulas specified at the data access layer + Public Overridable Sub View_MaxPersonalEducationRecord_InsertingRecord(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles Me.InsertingRecord + 'Apply Initialize->Inserting record formula only if validation is successful. + Dim View_MaxPersonalEducationRec As View_MaxPersonalEducationRecord = CType(sender,View_MaxPersonalEducationRecord) + Validate_Inserting() + If Not View_MaxPersonalEducationRec Is Nothing AndAlso Not View_MaxPersonalEducationRec.IsReadOnly Then + End If + End Sub + + 'Evaluates Initialize when->Updating record formulas specified at the data access layer + Public Overridable Sub View_MaxPersonalEducationRecord_UpdatingRecord(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles Me.UpdatingRecord + 'Apply Initialize->Updating record formula only if validation is successful. + Dim View_MaxPersonalEducationRec As View_MaxPersonalEducationRecord = CType(sender,View_MaxPersonalEducationRecord) + Validate_Updating() + If Not View_MaxPersonalEducationRec Is Nothing AndAlso Not View_MaxPersonalEducationRec.IsReadOnly Then + End If + End Sub + + 'Evaluates Initialize when->Reading record formulas specified at the data access layer + Public Overridable Sub View_MaxPersonalEducationRecord_ReadRecord(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.ReadRecord + 'Apply Initialize->Reading record formula only if validation is successful. + Dim View_MaxPersonalEducationRec As View_MaxPersonalEducationRecord = CType(sender,View_MaxPersonalEducationRecord) + If Not View_MaxPersonalEducationRec Is Nothing AndAlso Not View_MaxPersonalEducationRec.IsReadOnly Then + End If + End Sub + + 'Evaluates Validate when->Inserting formulas specified at the data access layer + Public Overridable Sub Validate_Inserting () + Dim fullValidationMessage As String = "" + Dim validationMessage As String = "" + + dim formula as String = "" + + + If validationMessage <> "" AndAlso validationMessage.ToLower() <> "true" Then + fullValidationMessage &= validationMessage & vbCrLf + End If + + If fullValidationMessage <> "" Then + Throw New Exception(fullValidationMessage) + End If + End Sub + + 'Evaluates Validate when->Updating formulas specified at the data access layer + Public Overridable Sub Validate_Updating () + Dim fullValidationMessage As String = "" + Dim validationMessage As String = "" + + dim formula as String = "" + + + If validationMessage <> "" AndAlso validationMessage.ToLower() <> "true" Then + fullValidationMessage &= validationMessage & vbCrLf + End If + + If fullValidationMessage <> "" Then + Throw New Exception(fullValidationMessage) + End If + End Sub + + Public Overridable Function EvaluateFormula(ByVal formula As String, Optional ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord = Nothing, Optional ByVal format As String = Nothing) As String + + Dim e As Data.BaseFormulaEvaluator = New Data.BaseFormulaEvaluator() + + ' All variables referred to in the formula are expected to be + ' properties of the DataSource. For example, referring to + ' UnitPrice as a variable will refer to DataSource.UnitPrice + e.DataSource = dataSourceForEvaluate + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + Return resultObj.ToString() + End Function + + + + + + + +#Region "Convenience methods to get/set values of fields" + + ''' + ''' This is a convenience method that provides direct access to the value of the record's View_MaxPersonalEducation_.PersonalId field. + ''' + Public Function GetPersonalIdValue() As ColumnValue + Return Me.GetValue(TableUtils.PersonalIdColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's View_MaxPersonalEducation_.PersonalId field. + ''' + Public Function GetPersonalIdFieldValue() As String + Return CType(Me.GetValue(TableUtils.PersonalIdColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_MaxPersonalEducation_.PersonalId field. + ''' + Public Sub SetPersonalIdFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.PersonalIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_MaxPersonalEducation_.PersonalId field. + ''' + Public Sub SetPersonalIdFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.PersonalIdColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's View_MaxPersonalEducation_.RankId field. + ''' + Public Function GetRankIdValue() As ColumnValue + Return Me.GetValue(TableUtils.RankIdColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's View_MaxPersonalEducation_.RankId field. + ''' + Public Function GetRankIdFieldValue() As Int32 + Return CType(Me.GetValue(TableUtils.RankIdColumn).ToInt32(), Int32) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_MaxPersonalEducation_.RankId field. + ''' + Public Sub SetRankIdFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.RankIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_MaxPersonalEducation_.RankId field. + ''' + Public Sub SetRankIdFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.RankIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_MaxPersonalEducation_.RankId field. + ''' + Public Sub SetRankIdFieldValue(ByVal val As Double) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.RankIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_MaxPersonalEducation_.RankId field. + ''' + Public Sub SetRankIdFieldValue(ByVal val As Decimal) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.RankIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_MaxPersonalEducation_.RankId field. + ''' + Public Sub SetRankIdFieldValue(ByVal val As Int64) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.RankIdColumn) + End Sub + ''' + ''' This is a convenience method that provides direct access to the value of the record's View_MaxPersonalEducation_.ShortRankNormal field. + ''' + Public Function GetShortRankNormalValue() As ColumnValue + Return Me.GetValue(TableUtils.ShortRankNormalColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's View_MaxPersonalEducation_.ShortRankNormal field. + ''' + Public Function GetShortRankNormalFieldValue() As String + Return CType(Me.GetValue(TableUtils.ShortRankNormalColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_MaxPersonalEducation_.ShortRankNormal field. + ''' + Public Sub SetShortRankNormalFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.ShortRankNormalColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_MaxPersonalEducation_.ShortRankNormal field. + ''' + Public Sub SetShortRankNormalFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.ShortRankNormalColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's View_MaxPersonalEducation_.PersonalName field. + ''' + Public Function GetPersonalNameValue() As ColumnValue + Return Me.GetValue(TableUtils.PersonalNameColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's View_MaxPersonalEducation_.PersonalName field. + ''' + Public Function GetPersonalNameFieldValue() As String + Return CType(Me.GetValue(TableUtils.PersonalNameColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_MaxPersonalEducation_.PersonalName field. + ''' + Public Sub SetPersonalNameFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.PersonalNameColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_MaxPersonalEducation_.PersonalName field. + ''' + Public Sub SetPersonalNameFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.PersonalNameColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's View_MaxPersonalEducation_.PersonalLastName field. + ''' + Public Function GetPersonalLastNameValue() As ColumnValue + Return Me.GetValue(TableUtils.PersonalLastNameColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's View_MaxPersonalEducation_.PersonalLastName field. + ''' + Public Function GetPersonalLastNameFieldValue() As String + Return CType(Me.GetValue(TableUtils.PersonalLastNameColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_MaxPersonalEducation_.PersonalLastName field. + ''' + Public Sub SetPersonalLastNameFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.PersonalLastNameColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_MaxPersonalEducation_.PersonalLastName field. + ''' + Public Sub SetPersonalLastNameFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.PersonalLastNameColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's View_MaxPersonalEducation_.SectionName field. + ''' + Public Function GetSectionNameValue() As ColumnValue + Return Me.GetValue(TableUtils.SectionNameColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's View_MaxPersonalEducation_.SectionName field. + ''' + Public Function GetSectionNameFieldValue() As String + Return CType(Me.GetValue(TableUtils.SectionNameColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_MaxPersonalEducation_.SectionName field. + ''' + Public Sub SetSectionNameFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.SectionNameColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_MaxPersonalEducation_.SectionName field. + ''' + Public Sub SetSectionNameFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.SectionNameColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's View_MaxPersonalEducation_.Level field. + ''' + Public Function GetLevelValue() As ColumnValue + Return Me.GetValue(TableUtils.LevelColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's View_MaxPersonalEducation_.Level field. + ''' + Public Function GetLevelFieldValue() As String + Return CType(Me.GetValue(TableUtils.LevelColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_MaxPersonalEducation_.Level field. + ''' + Public Sub SetLevelFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.LevelColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_MaxPersonalEducation_.Level field. + ''' + Public Sub SetLevelFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.LevelColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's View_MaxPersonalEducation_.StartDate field. + ''' + Public Function GetStartDateValue() As ColumnValue + Return Me.GetValue(TableUtils.StartDateColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's View_MaxPersonalEducation_.StartDate field. + ''' + Public Function GetStartDateFieldValue() As DateTime + Return CType(Me.GetValue(TableUtils.StartDateColumn).ToDateTime(), DateTime) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_MaxPersonalEducation_.StartDate field. + ''' + Public Sub SetStartDateFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.StartDateColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_MaxPersonalEducation_.StartDate field. + ''' + Public Sub SetStartDateFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.StartDateColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_MaxPersonalEducation_.StartDate field. + ''' + Public Sub SetStartDateFieldValue(ByVal val As DateTime) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.StartDateColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's View_MaxPersonalEducation_.EndDate field. + ''' + Public Function GetEndDateValue() As ColumnValue + Return Me.GetValue(TableUtils.EndDateColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's View_MaxPersonalEducation_.EndDate field. + ''' + Public Function GetEndDateFieldValue() As DateTime + Return CType(Me.GetValue(TableUtils.EndDateColumn).ToDateTime(), DateTime) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_MaxPersonalEducation_.EndDate field. + ''' + Public Sub SetEndDateFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.EndDateColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_MaxPersonalEducation_.EndDate field. + ''' + Public Sub SetEndDateFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.EndDateColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_MaxPersonalEducation_.EndDate field. + ''' + Public Sub SetEndDateFieldValue(ByVal val As DateTime) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.EndDateColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's View_MaxPersonalEducation_.Course field. + ''' + Public Function GetCourseValue() As ColumnValue + Return Me.GetValue(TableUtils.CourseColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's View_MaxPersonalEducation_.Course field. + ''' + Public Function GetCourseFieldValue() As String + Return CType(Me.GetValue(TableUtils.CourseColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_MaxPersonalEducation_.Course field. + ''' + Public Sub SetCourseFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.CourseColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_MaxPersonalEducation_.Course field. + ''' + Public Sub SetCourseFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.CourseColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's View_MaxPersonalEducation_.CourseAbbr field. + ''' + Public Function GetCourseAbbrValue() As ColumnValue + Return Me.GetValue(TableUtils.CourseAbbrColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's View_MaxPersonalEducation_.CourseAbbr field. + ''' + Public Function GetCourseAbbrFieldValue() As String + Return CType(Me.GetValue(TableUtils.CourseAbbrColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_MaxPersonalEducation_.CourseAbbr field. + ''' + Public Sub SetCourseAbbrFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.CourseAbbrColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_MaxPersonalEducation_.CourseAbbr field. + ''' + Public Sub SetCourseAbbrFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.CourseAbbrColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's View_MaxPersonalEducation_.Institue field. + ''' + Public Function GetInstitueValue() As ColumnValue + Return Me.GetValue(TableUtils.InstitueColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's View_MaxPersonalEducation_.Institue field. + ''' + Public Function GetInstitueFieldValue() As String + Return CType(Me.GetValue(TableUtils.InstitueColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_MaxPersonalEducation_.Institue field. + ''' + Public Sub SetInstitueFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.InstitueColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_MaxPersonalEducation_.Institue field. + ''' + Public Sub SetInstitueFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.InstitueColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's View_MaxPersonalEducation_.Facultry field. + ''' + Public Function GetFacultryValue() As ColumnValue + Return Me.GetValue(TableUtils.FacultryColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's View_MaxPersonalEducation_.Facultry field. + ''' + Public Function GetFacultryFieldValue() As String + Return CType(Me.GetValue(TableUtils.FacultryColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_MaxPersonalEducation_.Facultry field. + ''' + Public Sub SetFacultryFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.FacultryColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_MaxPersonalEducation_.Facultry field. + ''' + Public Sub SetFacultryFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.FacultryColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's View_MaxPersonalEducation_.LevelId field. + ''' + Public Function GetLevelIdValue() As ColumnValue + Return Me.GetValue(TableUtils.LevelIdColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's View_MaxPersonalEducation_.LevelId field. + ''' + Public Function GetLevelIdFieldValue() As Int16 + Return CType(Me.GetValue(TableUtils.LevelIdColumn).ToInt16(), Int16) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_MaxPersonalEducation_.LevelId field. + ''' + Public Sub SetLevelIdFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.LevelIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_MaxPersonalEducation_.LevelId field. + ''' + Public Sub SetLevelIdFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.LevelIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_MaxPersonalEducation_.LevelId field. + ''' + Public Sub SetLevelIdFieldValue(ByVal val As Double) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.LevelIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_MaxPersonalEducation_.LevelId field. + ''' + Public Sub SetLevelIdFieldValue(ByVal val As Decimal) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.LevelIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_MaxPersonalEducation_.LevelId field. + ''' + Public Sub SetLevelIdFieldValue(ByVal val As Int64) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.LevelIdColumn) + End Sub + ''' + ''' This is a convenience method that provides direct access to the value of the record's View_MaxPersonalEducation_.EdYear field. + ''' + Public Function GetEdYearValue() As ColumnValue + Return Me.GetValue(TableUtils.EdYearColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's View_MaxPersonalEducation_.EdYear field. + ''' + Public Function GetEdYearFieldValue() As String + Return CType(Me.GetValue(TableUtils.EdYearColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_MaxPersonalEducation_.EdYear field. + ''' + Public Sub SetEdYearFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.EdYearColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_MaxPersonalEducation_.EdYear field. + ''' + Public Sub SetEdYearFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.EdYearColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's View_MaxPersonalEducation_.EducationPeriod field. + ''' + Public Function GetEducationPeriodValue() As ColumnValue + Return Me.GetValue(TableUtils.EducationPeriodColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's View_MaxPersonalEducation_.EducationPeriod field. + ''' + Public Function GetEducationPeriodFieldValue() As Byte + Return CType(Me.GetValue(TableUtils.EducationPeriodColumn).ToByte(), Byte) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_MaxPersonalEducation_.EducationPeriod field. + ''' + Public Sub SetEducationPeriodFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.EducationPeriodColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_MaxPersonalEducation_.EducationPeriod field. + ''' + Public Sub SetEducationPeriodFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.EducationPeriodColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_MaxPersonalEducation_.EducationPeriod field. + ''' + Public Sub SetEducationPeriodFieldValue(ByVal val As Double) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.EducationPeriodColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_MaxPersonalEducation_.EducationPeriod field. + ''' + Public Sub SetEducationPeriodFieldValue(ByVal val As Decimal) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.EducationPeriodColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_MaxPersonalEducation_.EducationPeriod field. + ''' + Public Sub SetEducationPeriodFieldValue(ByVal val As Int64) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.EducationPeriodColumn) + End Sub + ''' + ''' This is a convenience method that provides direct access to the value of the record's View_MaxPersonalEducation_.EducationType field. + ''' + Public Function GetEducationTypeValue() As ColumnValue + Return Me.GetValue(TableUtils.EducationTypeColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's View_MaxPersonalEducation_.EducationType field. + ''' + Public Function GetEducationTypeFieldValue() As Byte + Return CType(Me.GetValue(TableUtils.EducationTypeColumn).ToByte(), Byte) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_MaxPersonalEducation_.EducationType field. + ''' + Public Sub SetEducationTypeFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.EducationTypeColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_MaxPersonalEducation_.EducationType field. + ''' + Public Sub SetEducationTypeFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.EducationTypeColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_MaxPersonalEducation_.EducationType field. + ''' + Public Sub SetEducationTypeFieldValue(ByVal val As Double) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.EducationTypeColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_MaxPersonalEducation_.EducationType field. + ''' + Public Sub SetEducationTypeFieldValue(ByVal val As Decimal) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.EducationTypeColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_MaxPersonalEducation_.EducationType field. + ''' + Public Sub SetEducationTypeFieldValue(ByVal val As Int64) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.EducationTypeColumn) + End Sub + ''' + ''' This is a convenience method that provides direct access to the value of the record's View_MaxPersonalEducation_.CourseNo field. + ''' + Public Function GetCourseNoValue() As ColumnValue + Return Me.GetValue(TableUtils.CourseNoColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's View_MaxPersonalEducation_.CourseNo field. + ''' + Public Function GetCourseNoFieldValue() As String + Return CType(Me.GetValue(TableUtils.CourseNoColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_MaxPersonalEducation_.CourseNo field. + ''' + Public Sub SetCourseNoFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.CourseNoColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_MaxPersonalEducation_.CourseNo field. + ''' + Public Sub SetCourseNoFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.CourseNoColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's View_MaxPersonalEducation_.ScoreNo field. + ''' + Public Function GetScoreNoValue() As ColumnValue + Return Me.GetValue(TableUtils.ScoreNoColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's View_MaxPersonalEducation_.ScoreNo field. + ''' + Public Function GetScoreNoFieldValue() As String + Return CType(Me.GetValue(TableUtils.ScoreNoColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_MaxPersonalEducation_.ScoreNo field. + ''' + Public Sub SetScoreNoFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.ScoreNoColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_MaxPersonalEducation_.ScoreNo field. + ''' + Public Sub SetScoreNoFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.ScoreNoColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's View_MaxPersonalEducation_.NoAll field. + ''' + Public Function GetNoAllValue() As ColumnValue + Return Me.GetValue(TableUtils.NoAllColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's View_MaxPersonalEducation_.NoAll field. + ''' + Public Function GetNoAllFieldValue() As String + Return CType(Me.GetValue(TableUtils.NoAllColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_MaxPersonalEducation_.NoAll field. + ''' + Public Sub SetNoAllFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.NoAllColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_MaxPersonalEducation_.NoAll field. + ''' + Public Sub SetNoAllFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.NoAllColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's View_MaxPersonalEducation_.Score field. + ''' + Public Function GetScoreValue() As ColumnValue + Return Me.GetValue(TableUtils.ScoreColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's View_MaxPersonalEducation_.Score field. + ''' + Public Function GetScoreFieldValue() As String + Return CType(Me.GetValue(TableUtils.ScoreColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_MaxPersonalEducation_.Score field. + ''' + Public Sub SetScoreFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.ScoreColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_MaxPersonalEducation_.Score field. + ''' + Public Sub SetScoreFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.ScoreColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's View_MaxPersonalEducation_.Command field. + ''' + Public Function GetCommandValue() As ColumnValue + Return Me.GetValue(TableUtils.CommandColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's View_MaxPersonalEducation_.Command field. + ''' + Public Function GetCommandFieldValue() As String + Return CType(Me.GetValue(TableUtils.CommandColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_MaxPersonalEducation_.Command field. + ''' + Public Sub SetCommandFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.CommandColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_MaxPersonalEducation_.Command field. + ''' + Public Sub SetCommandFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.CommandColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's View_MaxPersonalEducation_.CommandDate field. + ''' + Public Function GetCommandDateValue() As ColumnValue + Return Me.GetValue(TableUtils.CommandDateColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's View_MaxPersonalEducation_.CommandDate field. + ''' + Public Function GetCommandDateFieldValue() As DateTime + Return CType(Me.GetValue(TableUtils.CommandDateColumn).ToDateTime(), DateTime) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_MaxPersonalEducation_.CommandDate field. + ''' + Public Sub SetCommandDateFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.CommandDateColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_MaxPersonalEducation_.CommandDate field. + ''' + Public Sub SetCommandDateFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.CommandDateColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_MaxPersonalEducation_.CommandDate field. + ''' + Public Sub SetCommandDateFieldValue(ByVal val As DateTime) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.CommandDateColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's View_MaxPersonalEducation_.Country field. + ''' + Public Function GetCountryValue() As ColumnValue + Return Me.GetValue(TableUtils.CountryColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's View_MaxPersonalEducation_.Country field. + ''' + Public Function GetCountryFieldValue() As String + Return CType(Me.GetValue(TableUtils.CountryColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_MaxPersonalEducation_.Country field. + ''' + Public Sub SetCountryFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.CountryColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_MaxPersonalEducation_.Country field. + ''' + Public Sub SetCountryFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.CountryColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's View_MaxPersonalEducation_.DateRank field. + ''' + Public Function GetDateRankValue() As ColumnValue + Return Me.GetValue(TableUtils.DateRankColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's View_MaxPersonalEducation_.DateRank field. + ''' + Public Function GetDateRankFieldValue() As DateTime + Return CType(Me.GetValue(TableUtils.DateRankColumn).ToDateTime(), DateTime) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_MaxPersonalEducation_.DateRank field. + ''' + Public Sub SetDateRankFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.DateRankColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_MaxPersonalEducation_.DateRank field. + ''' + Public Sub SetDateRankFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.DateRankColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_MaxPersonalEducation_.DateRank field. + ''' + Public Sub SetDateRankFieldValue(ByVal val As DateTime) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.DateRankColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's View_MaxPersonalEducation_.DatePrevRank field. + ''' + Public Function GetDatePrevRankValue() As ColumnValue + Return Me.GetValue(TableUtils.DatePrevRankColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's View_MaxPersonalEducation_.DatePrevRank field. + ''' + Public Function GetDatePrevRankFieldValue() As DateTime + Return CType(Me.GetValue(TableUtils.DatePrevRankColumn).ToDateTime(), DateTime) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_MaxPersonalEducation_.DatePrevRank field. + ''' + Public Sub SetDatePrevRankFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.DatePrevRankColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_MaxPersonalEducation_.DatePrevRank field. + ''' + Public Sub SetDatePrevRankFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.DatePrevRankColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_MaxPersonalEducation_.DatePrevRank field. + ''' + Public Sub SetDatePrevRankFieldValue(ByVal val As DateTime) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.DatePrevRankColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's View_MaxPersonalEducation_.StatusId field. + ''' + Public Function GetStatusIdValue() As ColumnValue + Return Me.GetValue(TableUtils.StatusIdColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's View_MaxPersonalEducation_.StatusId field. + ''' + Public Function GetStatusIdFieldValue() As Byte + Return CType(Me.GetValue(TableUtils.StatusIdColumn).ToByte(), Byte) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_MaxPersonalEducation_.StatusId field. + ''' + Public Sub SetStatusIdFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.StatusIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_MaxPersonalEducation_.StatusId field. + ''' + Public Sub SetStatusIdFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.StatusIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_MaxPersonalEducation_.StatusId field. + ''' + Public Sub SetStatusIdFieldValue(ByVal val As Double) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.StatusIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_MaxPersonalEducation_.StatusId field. + ''' + Public Sub SetStatusIdFieldValue(ByVal val As Decimal) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.StatusIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_MaxPersonalEducation_.StatusId field. + ''' + Public Sub SetStatusIdFieldValue(ByVal val As Int64) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.StatusIdColumn) + End Sub + ''' + ''' This is a convenience method that provides direct access to the value of the record's View_MaxPersonalEducation_.RankLevelName field. + ''' + Public Function GetRankLevelNameValue() As ColumnValue + Return Me.GetValue(TableUtils.RankLevelNameColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's View_MaxPersonalEducation_.RankLevelName field. + ''' + Public Function GetRankLevelNameFieldValue() As String + Return CType(Me.GetValue(TableUtils.RankLevelNameColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_MaxPersonalEducation_.RankLevelName field. + ''' + Public Sub SetRankLevelNameFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.RankLevelNameColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_MaxPersonalEducation_.RankLevelName field. + ''' + Public Sub SetRankLevelNameFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.RankLevelNameColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's View_MaxPersonalEducation_.SectionAbbvrName field. + ''' + Public Function GetSectionAbbvrNameValue() As ColumnValue + Return Me.GetValue(TableUtils.SectionAbbvrNameColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's View_MaxPersonalEducation_.SectionAbbvrName field. + ''' + Public Function GetSectionAbbvrNameFieldValue() As String + Return CType(Me.GetValue(TableUtils.SectionAbbvrNameColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_MaxPersonalEducation_.SectionAbbvrName field. + ''' + Public Sub SetSectionAbbvrNameFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.SectionAbbvrNameColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_MaxPersonalEducation_.SectionAbbvrName field. + ''' + Public Sub SetSectionAbbvrNameFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.SectionAbbvrNameColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's View_MaxPersonalEducation_.RankAndName field. + ''' + Public Function GetRankAndNameValue() As ColumnValue + Return Me.GetValue(TableUtils.RankAndNameColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's View_MaxPersonalEducation_.RankAndName field. + ''' + Public Function GetRankAndNameFieldValue() As String + Return CType(Me.GetValue(TableUtils.RankAndNameColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_MaxPersonalEducation_.RankAndName field. + ''' + Public Sub SetRankAndNameFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.RankAndNameColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_MaxPersonalEducation_.RankAndName field. + ''' + Public Sub SetRankAndNameFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.RankAndNameColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's View_MaxPersonalEducation_.RankLevel field. + ''' + Public Function GetRankLevelValue() As ColumnValue + Return Me.GetValue(TableUtils.RankLevelColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's View_MaxPersonalEducation_.RankLevel field. + ''' + Public Function GetRankLevelFieldValue() As Int32 + Return CType(Me.GetValue(TableUtils.RankLevelColumn).ToInt32(), Int32) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_MaxPersonalEducation_.RankLevel field. + ''' + Public Sub SetRankLevelFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.RankLevelColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_MaxPersonalEducation_.RankLevel field. + ''' + Public Sub SetRankLevelFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.RankLevelColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_MaxPersonalEducation_.RankLevel field. + ''' + Public Sub SetRankLevelFieldValue(ByVal val As Double) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.RankLevelColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_MaxPersonalEducation_.RankLevel field. + ''' + Public Sub SetRankLevelFieldValue(ByVal val As Decimal) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.RankLevelColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_MaxPersonalEducation_.RankLevel field. + ''' + Public Sub SetRankLevelFieldValue(ByVal val As Int64) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.RankLevelColumn) + End Sub + + +#End Region + +#Region "Convenience methods to get field names" + + ''' + ''' This is a convenience property that provides direct access to the value of the record's View_MaxPersonalEducation_.PersonalId field. + ''' + Public Property PersonalId() As String + Get + Return CType(Me.GetValue(TableUtils.PersonalIdColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.PersonalIdColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property PersonalIdSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.PersonalIdColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property PersonalIdDefault() As String + Get + Return TableUtils.PersonalIdColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's View_MaxPersonalEducation_.RankId field. + ''' + Public Property RankId() As Int32 + Get + Return CType(Me.GetValue(TableUtils.RankIdColumn).ToInt32(), Int32) + End Get + Set (ByVal val As Int32) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.RankIdColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property RankIdSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.RankIdColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property RankIdDefault() As String + Get + Return TableUtils.RankIdColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's View_MaxPersonalEducation_.ShortRankNormal field. + ''' + Public Property ShortRankNormal() As String + Get + Return CType(Me.GetValue(TableUtils.ShortRankNormalColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.ShortRankNormalColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property ShortRankNormalSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.ShortRankNormalColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property ShortRankNormalDefault() As String + Get + Return TableUtils.ShortRankNormalColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's View_MaxPersonalEducation_.PersonalName field. + ''' + Public Property PersonalName() As String + Get + Return CType(Me.GetValue(TableUtils.PersonalNameColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.PersonalNameColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property PersonalNameSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.PersonalNameColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property PersonalNameDefault() As String + Get + Return TableUtils.PersonalNameColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's View_MaxPersonalEducation_.PersonalLastName field. + ''' + Public Property PersonalLastName() As String + Get + Return CType(Me.GetValue(TableUtils.PersonalLastNameColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.PersonalLastNameColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property PersonalLastNameSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.PersonalLastNameColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property PersonalLastNameDefault() As String + Get + Return TableUtils.PersonalLastNameColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's View_MaxPersonalEducation_.SectionName field. + ''' + Public Property SectionName() As String + Get + Return CType(Me.GetValue(TableUtils.SectionNameColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.SectionNameColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property SectionNameSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.SectionNameColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property SectionNameDefault() As String + Get + Return TableUtils.SectionNameColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's View_MaxPersonalEducation_.Level field. + ''' + Public Property Level() As String + Get + Return CType(Me.GetValue(TableUtils.LevelColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.LevelColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property LevelSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.LevelColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property LevelDefault() As String + Get + Return TableUtils.LevelColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's View_MaxPersonalEducation_.StartDate field. + ''' + Public Property StartDate() As DateTime + Get + Return CType(Me.GetValue(TableUtils.StartDateColumn).ToDateTime(), DateTime) + End Get + Set (ByVal val As DateTime) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.StartDateColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property StartDateSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.StartDateColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property StartDateDefault() As String + Get + Return TableUtils.StartDateColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's View_MaxPersonalEducation_.EndDate field. + ''' + Public Property EndDate() As DateTime + Get + Return CType(Me.GetValue(TableUtils.EndDateColumn).ToDateTime(), DateTime) + End Get + Set (ByVal val As DateTime) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.EndDateColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property EndDateSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.EndDateColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property EndDateDefault() As String + Get + Return TableUtils.EndDateColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's View_MaxPersonalEducation_.Course field. + ''' + Public Property Course() As String + Get + Return CType(Me.GetValue(TableUtils.CourseColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.CourseColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property CourseSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.CourseColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property CourseDefault() As String + Get + Return TableUtils.CourseColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's View_MaxPersonalEducation_.CourseAbbr field. + ''' + Public Property CourseAbbr() As String + Get + Return CType(Me.GetValue(TableUtils.CourseAbbrColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.CourseAbbrColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property CourseAbbrSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.CourseAbbrColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property CourseAbbrDefault() As String + Get + Return TableUtils.CourseAbbrColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's View_MaxPersonalEducation_.Institue field. + ''' + Public Property Institue() As String + Get + Return CType(Me.GetValue(TableUtils.InstitueColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.InstitueColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property InstitueSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.InstitueColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property InstitueDefault() As String + Get + Return TableUtils.InstitueColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's View_MaxPersonalEducation_.Facultry field. + ''' + Public Property Facultry() As String + Get + Return CType(Me.GetValue(TableUtils.FacultryColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.FacultryColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property FacultrySpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.FacultryColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property FacultryDefault() As String + Get + Return TableUtils.FacultryColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's View_MaxPersonalEducation_.LevelId field. + ''' + Public Property LevelId() As Int16 + Get + Return CType(Me.GetValue(TableUtils.LevelIdColumn).ToInt16(), Int16) + End Get + Set (ByVal val As Int16) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.LevelIdColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property LevelIdSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.LevelIdColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property LevelIdDefault() As String + Get + Return TableUtils.LevelIdColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's View_MaxPersonalEducation_.EdYear field. + ''' + Public Property EdYear() As String + Get + Return CType(Me.GetValue(TableUtils.EdYearColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.EdYearColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property EdYearSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.EdYearColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property EdYearDefault() As String + Get + Return TableUtils.EdYearColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's View_MaxPersonalEducation_.EducationPeriod field. + ''' + Public Property EducationPeriod() As Byte + Get + Return CType(Me.GetValue(TableUtils.EducationPeriodColumn).ToByte(), Byte) + End Get + Set (ByVal val As Byte) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.EducationPeriodColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property EducationPeriodSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.EducationPeriodColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property EducationPeriodDefault() As String + Get + Return TableUtils.EducationPeriodColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's View_MaxPersonalEducation_.EducationType field. + ''' + Public Property EducationType() As Byte + Get + Return CType(Me.GetValue(TableUtils.EducationTypeColumn).ToByte(), Byte) + End Get + Set (ByVal val As Byte) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.EducationTypeColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property EducationTypeSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.EducationTypeColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property EducationTypeDefault() As String + Get + Return TableUtils.EducationTypeColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's View_MaxPersonalEducation_.CourseNo field. + ''' + Public Property CourseNo() As String + Get + Return CType(Me.GetValue(TableUtils.CourseNoColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.CourseNoColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property CourseNoSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.CourseNoColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property CourseNoDefault() As String + Get + Return TableUtils.CourseNoColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's View_MaxPersonalEducation_.ScoreNo field. + ''' + Public Property ScoreNo() As String + Get + Return CType(Me.GetValue(TableUtils.ScoreNoColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.ScoreNoColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property ScoreNoSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.ScoreNoColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property ScoreNoDefault() As String + Get + Return TableUtils.ScoreNoColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's View_MaxPersonalEducation_.NoAll field. + ''' + Public Property NoAll() As String + Get + Return CType(Me.GetValue(TableUtils.NoAllColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.NoAllColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property NoAllSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.NoAllColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property NoAllDefault() As String + Get + Return TableUtils.NoAllColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's View_MaxPersonalEducation_.Score field. + ''' + Public Property Score() As String + Get + Return CType(Me.GetValue(TableUtils.ScoreColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.ScoreColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property ScoreSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.ScoreColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property ScoreDefault() As String + Get + Return TableUtils.ScoreColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's View_MaxPersonalEducation_.Command field. + ''' + Public Property Command() As String + Get + Return CType(Me.GetValue(TableUtils.CommandColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.CommandColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property CommandSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.CommandColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property CommandDefault() As String + Get + Return TableUtils.CommandColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's View_MaxPersonalEducation_.CommandDate field. + ''' + Public Property CommandDate() As DateTime + Get + Return CType(Me.GetValue(TableUtils.CommandDateColumn).ToDateTime(), DateTime) + End Get + Set (ByVal val As DateTime) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.CommandDateColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property CommandDateSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.CommandDateColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property CommandDateDefault() As String + Get + Return TableUtils.CommandDateColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's View_MaxPersonalEducation_.Country field. + ''' + Public Property Country() As String + Get + Return CType(Me.GetValue(TableUtils.CountryColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.CountryColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property CountrySpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.CountryColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property CountryDefault() As String + Get + Return TableUtils.CountryColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's View_MaxPersonalEducation_.DateRank field. + ''' + Public Property DateRank() As DateTime + Get + Return CType(Me.GetValue(TableUtils.DateRankColumn).ToDateTime(), DateTime) + End Get + Set (ByVal val As DateTime) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.DateRankColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property DateRankSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.DateRankColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property DateRankDefault() As String + Get + Return TableUtils.DateRankColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's View_MaxPersonalEducation_.DatePrevRank field. + ''' + Public Property DatePrevRank() As DateTime + Get + Return CType(Me.GetValue(TableUtils.DatePrevRankColumn).ToDateTime(), DateTime) + End Get + Set (ByVal val As DateTime) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.DatePrevRankColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property DatePrevRankSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.DatePrevRankColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property DatePrevRankDefault() As String + Get + Return TableUtils.DatePrevRankColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's View_MaxPersonalEducation_.StatusId field. + ''' + Public Property StatusId() As Byte + Get + Return CType(Me.GetValue(TableUtils.StatusIdColumn).ToByte(), Byte) + End Get + Set (ByVal val As Byte) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.StatusIdColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property StatusIdSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.StatusIdColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property StatusIdDefault() As String + Get + Return TableUtils.StatusIdColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's View_MaxPersonalEducation_.RankLevelName field. + ''' + Public Property RankLevelName() As String + Get + Return CType(Me.GetValue(TableUtils.RankLevelNameColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.RankLevelNameColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property RankLevelNameSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.RankLevelNameColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property RankLevelNameDefault() As String + Get + Return TableUtils.RankLevelNameColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's View_MaxPersonalEducation_.SectionAbbvrName field. + ''' + Public Property SectionAbbvrName() As String + Get + Return CType(Me.GetValue(TableUtils.SectionAbbvrNameColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.SectionAbbvrNameColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property SectionAbbvrNameSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.SectionAbbvrNameColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property SectionAbbvrNameDefault() As String + Get + Return TableUtils.SectionAbbvrNameColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's View_MaxPersonalEducation_.RankAndName field. + ''' + Public Property RankAndName() As String + Get + Return CType(Me.GetValue(TableUtils.RankAndNameColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.RankAndNameColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property RankAndNameSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.RankAndNameColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property RankAndNameDefault() As String + Get + Return TableUtils.RankAndNameColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's View_MaxPersonalEducation_.RankLevel field. + ''' + Public Property RankLevel() As Int32 + Get + Return CType(Me.GetValue(TableUtils.RankLevelColumn).ToInt32(), Int32) + End Get + Set (ByVal val As Int32) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.RankLevelColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property RankLevelSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.RankLevelColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property RankLevelDefault() As String + Get + Return TableUtils.RankLevelColumn.DefaultValue + End Get + End Property + + + +#End Region + +End Class +End Namespace diff --git a/App_Code/Business Layer/BaseView_MaxPersonalEducationView.vb b/App_Code/Business Layer/BaseView_MaxPersonalEducationView.vb new file mode 100644 index 0000000..b954309 --- /dev/null +++ b/App_Code/Business Layer/BaseView_MaxPersonalEducationView.vb @@ -0,0 +1,1416 @@ +' This class is "generated" and will be overwritten. +' Your customizations should be made in View_MaxPersonalEducationRecord.vb + +Imports System.Data.SqlTypes +Imports System.Data +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider +Imports Persons.Data + +Namespace Persons.Business + +''' +''' The generated superclass for the class. +''' Provides access to the schema information and record data of a database table or view named View_MaxPersonalEducation. +''' +''' +''' The connection details (name, location, etc.) of the database and table (or view) accessed by this class +''' are resolved at runtime based on the connection string in the application's Web.Config file. +''' +''' This class is not intended to be instantiated directly. To obtain an instance of this class, use +''' View_MaxPersonalEducationView.Instance. +''' +''' +''' + + Public Class BaseView_MaxPersonalEducationView + Inherits PrimaryKeyTable + + + Private ReadOnly TableDefinitionString As String = View_MaxPersonalEducationDefinition.GetXMLString() + + + + + + + + Protected Sub New() + MyBase.New() + Me.Initialize() + End Sub + + Protected Overridable Sub Initialize() + Dim def As New XmlTableDefinition(TableDefinitionString) + Me.TableDefinition = New TableDefinition() + Me.TableDefinition.TableClassName = System.Reflection.Assembly.CreateQualifiedName("App_Code", "Persons.Business.View_MaxPersonalEducationView") + def.InitializeTableDefinition(Me.TableDefinition) + Me.ConnectionName = def.GetConnectionName() + Me.RecordClassName = System.Reflection.Assembly.CreateQualifiedName("App_Code", "Persons.Business.View_MaxPersonalEducationRecord") + Me.ApplicationName = "App_Code" + Me.DataAdapter = New View_MaxPersonalEducationSqlView() + Directcast(Me.DataAdapter, View_MaxPersonalEducationSqlView).ConnectionName = Me.ConnectionName + + Me.TableDefinition.AdapterMetaData = Me.DataAdapter.AdapterMetaData + PersonalIdColumn.CodeName = "PersonalId" + RankIdColumn.CodeName = "RankId" + ShortRankNormalColumn.CodeName = "ShortRankNormal" + PersonalNameColumn.CodeName = "PersonalName" + PersonalLastNameColumn.CodeName = "PersonalLastName" + SectionNameColumn.CodeName = "SectionName" + LevelColumn.CodeName = "Level" + StartDateColumn.CodeName = "StartDate" + EndDateColumn.CodeName = "EndDate" + CourseColumn.CodeName = "Course" + CourseAbbrColumn.CodeName = "CourseAbbr" + InstitueColumn.CodeName = "Institue" + FacultryColumn.CodeName = "Facultry" + LevelIdColumn.CodeName = "LevelId" + EdYearColumn.CodeName = "EdYear" + EducationPeriodColumn.CodeName = "EducationPeriod" + EducationTypeColumn.CodeName = "EducationType" + CourseNoColumn.CodeName = "CourseNo" + ScoreNoColumn.CodeName = "ScoreNo" + NoAllColumn.CodeName = "NoAll" + ScoreColumn.CodeName = "Score" + CommandColumn.CodeName = "Command" + CommandDateColumn.CodeName = "CommandDate" + CountryColumn.CodeName = "Country" + DateRankColumn.CodeName = "DateRank" + DatePrevRankColumn.CodeName = "DatePrevRank" + StatusIdColumn.CodeName = "StatusId" + RankLevelNameColumn.CodeName = "RankLevelName" + SectionAbbvrNameColumn.CodeName = "SectionAbbvrName" + RankAndNameColumn.CodeName = "RankAndName" + RankLevelColumn.CodeName = "RankLevel" + + End Sub + +#Region "Overriden methods" + + +#End Region + +#Region "Properties for columns" + + ''' + ''' This is a convenience property that provides direct access to the table's View_MaxPersonalEducation_.PersonalId column object. + ''' + Public ReadOnly Property PersonalIdColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(0), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's View_MaxPersonalEducation_.PersonalId column object. + ''' + Public Shared ReadOnly Property PersonalId() As BaseClasses.Data.StringColumn + Get + Return View_MaxPersonalEducationView.Instance.PersonalIdColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's View_MaxPersonalEducation_.RankId column object. + ''' + Public ReadOnly Property RankIdColumn() As BaseClasses.Data.NumberColumn + Get + Return CType(Me.TableDefinition.ColumnList(1), BaseClasses.Data.NumberColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's View_MaxPersonalEducation_.RankId column object. + ''' + Public Shared ReadOnly Property RankId() As BaseClasses.Data.NumberColumn + Get + Return View_MaxPersonalEducationView.Instance.RankIdColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's View_MaxPersonalEducation_.ShortRankNormal column object. + ''' + Public ReadOnly Property ShortRankNormalColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(2), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's View_MaxPersonalEducation_.ShortRankNormal column object. + ''' + Public Shared ReadOnly Property ShortRankNormal() As BaseClasses.Data.StringColumn + Get + Return View_MaxPersonalEducationView.Instance.ShortRankNormalColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's View_MaxPersonalEducation_.PersonalName column object. + ''' + Public ReadOnly Property PersonalNameColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(3), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's View_MaxPersonalEducation_.PersonalName column object. + ''' + Public Shared ReadOnly Property PersonalName() As BaseClasses.Data.StringColumn + Get + Return View_MaxPersonalEducationView.Instance.PersonalNameColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's View_MaxPersonalEducation_.PersonalLastName column object. + ''' + Public ReadOnly Property PersonalLastNameColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(4), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's View_MaxPersonalEducation_.PersonalLastName column object. + ''' + Public Shared ReadOnly Property PersonalLastName() As BaseClasses.Data.StringColumn + Get + Return View_MaxPersonalEducationView.Instance.PersonalLastNameColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's View_MaxPersonalEducation_.SectionName column object. + ''' + Public ReadOnly Property SectionNameColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(5), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's View_MaxPersonalEducation_.SectionName column object. + ''' + Public Shared ReadOnly Property SectionName() As BaseClasses.Data.StringColumn + Get + Return View_MaxPersonalEducationView.Instance.SectionNameColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's View_MaxPersonalEducation_.Level column object. + ''' + Public ReadOnly Property LevelColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(6), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's View_MaxPersonalEducation_.Level column object. + ''' + Public Shared ReadOnly Property Level() As BaseClasses.Data.StringColumn + Get + Return View_MaxPersonalEducationView.Instance.LevelColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's View_MaxPersonalEducation_.StartDate column object. + ''' + Public ReadOnly Property StartDateColumn() As BaseClasses.Data.DateColumn + Get + Return CType(Me.TableDefinition.ColumnList(7), BaseClasses.Data.DateColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's View_MaxPersonalEducation_.StartDate column object. + ''' + Public Shared ReadOnly Property StartDate() As BaseClasses.Data.DateColumn + Get + Return View_MaxPersonalEducationView.Instance.StartDateColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's View_MaxPersonalEducation_.EndDate column object. + ''' + Public ReadOnly Property EndDateColumn() As BaseClasses.Data.DateColumn + Get + Return CType(Me.TableDefinition.ColumnList(8), BaseClasses.Data.DateColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's View_MaxPersonalEducation_.EndDate column object. + ''' + Public Shared ReadOnly Property EndDate() As BaseClasses.Data.DateColumn + Get + Return View_MaxPersonalEducationView.Instance.EndDateColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's View_MaxPersonalEducation_.Course column object. + ''' + Public ReadOnly Property CourseColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(9), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's View_MaxPersonalEducation_.Course column object. + ''' + Public Shared ReadOnly Property Course() As BaseClasses.Data.StringColumn + Get + Return View_MaxPersonalEducationView.Instance.CourseColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's View_MaxPersonalEducation_.CourseAbbr column object. + ''' + Public ReadOnly Property CourseAbbrColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(10), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's View_MaxPersonalEducation_.CourseAbbr column object. + ''' + Public Shared ReadOnly Property CourseAbbr() As BaseClasses.Data.StringColumn + Get + Return View_MaxPersonalEducationView.Instance.CourseAbbrColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's View_MaxPersonalEducation_.Institue column object. + ''' + Public ReadOnly Property InstitueColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(11), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's View_MaxPersonalEducation_.Institue column object. + ''' + Public Shared ReadOnly Property Institue() As BaseClasses.Data.StringColumn + Get + Return View_MaxPersonalEducationView.Instance.InstitueColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's View_MaxPersonalEducation_.Facultry column object. + ''' + Public ReadOnly Property FacultryColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(12), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's View_MaxPersonalEducation_.Facultry column object. + ''' + Public Shared ReadOnly Property Facultry() As BaseClasses.Data.StringColumn + Get + Return View_MaxPersonalEducationView.Instance.FacultryColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's View_MaxPersonalEducation_.LevelId column object. + ''' + Public ReadOnly Property LevelIdColumn() As BaseClasses.Data.NumberColumn + Get + Return CType(Me.TableDefinition.ColumnList(13), BaseClasses.Data.NumberColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's View_MaxPersonalEducation_.LevelId column object. + ''' + Public Shared ReadOnly Property LevelId() As BaseClasses.Data.NumberColumn + Get + Return View_MaxPersonalEducationView.Instance.LevelIdColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's View_MaxPersonalEducation_.EdYear column object. + ''' + Public ReadOnly Property EdYearColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(14), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's View_MaxPersonalEducation_.EdYear column object. + ''' + Public Shared ReadOnly Property EdYear() As BaseClasses.Data.StringColumn + Get + Return View_MaxPersonalEducationView.Instance.EdYearColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's View_MaxPersonalEducation_.EducationPeriod column object. + ''' + Public ReadOnly Property EducationPeriodColumn() As BaseClasses.Data.NumberColumn + Get + Return CType(Me.TableDefinition.ColumnList(15), BaseClasses.Data.NumberColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's View_MaxPersonalEducation_.EducationPeriod column object. + ''' + Public Shared ReadOnly Property EducationPeriod() As BaseClasses.Data.NumberColumn + Get + Return View_MaxPersonalEducationView.Instance.EducationPeriodColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's View_MaxPersonalEducation_.EducationType column object. + ''' + Public ReadOnly Property EducationTypeColumn() As BaseClasses.Data.NumberColumn + Get + Return CType(Me.TableDefinition.ColumnList(16), BaseClasses.Data.NumberColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's View_MaxPersonalEducation_.EducationType column object. + ''' + Public Shared ReadOnly Property EducationType() As BaseClasses.Data.NumberColumn + Get + Return View_MaxPersonalEducationView.Instance.EducationTypeColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's View_MaxPersonalEducation_.CourseNo column object. + ''' + Public ReadOnly Property CourseNoColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(17), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's View_MaxPersonalEducation_.CourseNo column object. + ''' + Public Shared ReadOnly Property CourseNo() As BaseClasses.Data.StringColumn + Get + Return View_MaxPersonalEducationView.Instance.CourseNoColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's View_MaxPersonalEducation_.ScoreNo column object. + ''' + Public ReadOnly Property ScoreNoColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(18), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's View_MaxPersonalEducation_.ScoreNo column object. + ''' + Public Shared ReadOnly Property ScoreNo() As BaseClasses.Data.StringColumn + Get + Return View_MaxPersonalEducationView.Instance.ScoreNoColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's View_MaxPersonalEducation_.NoAll column object. + ''' + Public ReadOnly Property NoAllColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(19), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's View_MaxPersonalEducation_.NoAll column object. + ''' + Public Shared ReadOnly Property NoAll() As BaseClasses.Data.StringColumn + Get + Return View_MaxPersonalEducationView.Instance.NoAllColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's View_MaxPersonalEducation_.Score column object. + ''' + Public ReadOnly Property ScoreColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(20), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's View_MaxPersonalEducation_.Score column object. + ''' + Public Shared ReadOnly Property Score() As BaseClasses.Data.StringColumn + Get + Return View_MaxPersonalEducationView.Instance.ScoreColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's View_MaxPersonalEducation_.Command column object. + ''' + Public ReadOnly Property CommandColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(21), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's View_MaxPersonalEducation_.Command column object. + ''' + Public Shared ReadOnly Property Command() As BaseClasses.Data.StringColumn + Get + Return View_MaxPersonalEducationView.Instance.CommandColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's View_MaxPersonalEducation_.CommandDate column object. + ''' + Public ReadOnly Property CommandDateColumn() As BaseClasses.Data.DateColumn + Get + Return CType(Me.TableDefinition.ColumnList(22), BaseClasses.Data.DateColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's View_MaxPersonalEducation_.CommandDate column object. + ''' + Public Shared ReadOnly Property CommandDate() As BaseClasses.Data.DateColumn + Get + Return View_MaxPersonalEducationView.Instance.CommandDateColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's View_MaxPersonalEducation_.Country column object. + ''' + Public ReadOnly Property CountryColumn() As BaseClasses.Data.CountryColumn + Get + Return CType(Me.TableDefinition.ColumnList(23), BaseClasses.Data.CountryColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's View_MaxPersonalEducation_.Country column object. + ''' + Public Shared ReadOnly Property Country() As BaseClasses.Data.CountryColumn + Get + Return View_MaxPersonalEducationView.Instance.CountryColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's View_MaxPersonalEducation_.DateRank column object. + ''' + Public ReadOnly Property DateRankColumn() As BaseClasses.Data.DateColumn + Get + Return CType(Me.TableDefinition.ColumnList(24), BaseClasses.Data.DateColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's View_MaxPersonalEducation_.DateRank column object. + ''' + Public Shared ReadOnly Property DateRank() As BaseClasses.Data.DateColumn + Get + Return View_MaxPersonalEducationView.Instance.DateRankColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's View_MaxPersonalEducation_.DatePrevRank column object. + ''' + Public ReadOnly Property DatePrevRankColumn() As BaseClasses.Data.DateColumn + Get + Return CType(Me.TableDefinition.ColumnList(25), BaseClasses.Data.DateColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's View_MaxPersonalEducation_.DatePrevRank column object. + ''' + Public Shared ReadOnly Property DatePrevRank() As BaseClasses.Data.DateColumn + Get + Return View_MaxPersonalEducationView.Instance.DatePrevRankColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's View_MaxPersonalEducation_.StatusId column object. + ''' + Public ReadOnly Property StatusIdColumn() As BaseClasses.Data.NumberColumn + Get + Return CType(Me.TableDefinition.ColumnList(26), BaseClasses.Data.NumberColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's View_MaxPersonalEducation_.StatusId column object. + ''' + Public Shared ReadOnly Property StatusId() As BaseClasses.Data.NumberColumn + Get + Return View_MaxPersonalEducationView.Instance.StatusIdColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's View_MaxPersonalEducation_.RankLevelName column object. + ''' + Public ReadOnly Property RankLevelNameColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(27), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's View_MaxPersonalEducation_.RankLevelName column object. + ''' + Public Shared ReadOnly Property RankLevelName() As BaseClasses.Data.StringColumn + Get + Return View_MaxPersonalEducationView.Instance.RankLevelNameColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's View_MaxPersonalEducation_.SectionAbbvrName column object. + ''' + Public ReadOnly Property SectionAbbvrNameColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(28), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's View_MaxPersonalEducation_.SectionAbbvrName column object. + ''' + Public Shared ReadOnly Property SectionAbbvrName() As BaseClasses.Data.StringColumn + Get + Return View_MaxPersonalEducationView.Instance.SectionAbbvrNameColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's View_MaxPersonalEducation_.RankAndName column object. + ''' + Public ReadOnly Property RankAndNameColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(29), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's View_MaxPersonalEducation_.RankAndName column object. + ''' + Public Shared ReadOnly Property RankAndName() As BaseClasses.Data.StringColumn + Get + Return View_MaxPersonalEducationView.Instance.RankAndNameColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's View_MaxPersonalEducation_.RankLevel column object. + ''' + Public ReadOnly Property RankLevelColumn() As BaseClasses.Data.NumberColumn + Get + Return CType(Me.TableDefinition.ColumnList(30), BaseClasses.Data.NumberColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's View_MaxPersonalEducation_.RankLevel column object. + ''' + Public Shared ReadOnly Property RankLevel() As BaseClasses.Data.NumberColumn + Get + Return View_MaxPersonalEducationView.Instance.RankLevelColumn + End Get + End Property + + +#End Region + + +#Region "Shared helper methods" + + ''' + ''' This is a shared function that can be used to get an array of View_MaxPersonalEducationRecord records using a where clause. + ''' + Public Shared Function GetRecords(ByVal where As String) As View_MaxPersonalEducationRecord() + + Return GetRecords(where, Nothing, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) + End Function + + ''' + ''' This is a shared function that can be used to get an array of View_MaxPersonalEducationRecord records using a where clause. + ''' + Public Shared Function GetRecords(ByVal join As BaseFilter, ByVal where As String) As View_MaxPersonalEducationRecord() + + Return GetRecords(join, where, Nothing, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) + End Function + + ''' + ''' This is a shared function that can be used to get an array of View_MaxPersonalEducationRecord records using a where and order by clause. + ''' + Public Shared Function GetRecords( _ + ByVal where As String, _ + ByVal orderBy As OrderBy) As View_MaxPersonalEducationRecord() + + Return GetRecords(where, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) + End Function + + ''' + ''' This is a shared function that can be used to get an array of View_MaxPersonalEducationRecord records using a where and order by clause. + ''' + Public Shared Function GetRecords( _ + ByVal join As BaseFilter, _ + ByVal where As String, _ + ByVal orderBy As OrderBy) As View_MaxPersonalEducationRecord() + + Return GetRecords(join, where, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) + End Function + + ''' + ''' This is a shared function that can be used to get an array of View_MaxPersonalEducationRecord records using a where and order by clause clause with pagination. + ''' + Public Shared Function GetRecords( _ + ByVal where As String, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As View_MaxPersonalEducationRecord() + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + Dim join As BaseClasses.Data.BaseFilter = Nothing + Dim recList As ArrayList = View_MaxPersonalEducationView.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, pageIndex, pageSize) + + Return CType(recList.ToArray(GetType(Persons.Business.View_MaxPersonalEducationRecord)), View_MaxPersonalEducationRecord()) + End Function + + ''' + ''' This is a shared function that can be used to get an array of View_MaxPersonalEducationRecord records using a where and order by clause clause with pagination. + ''' + Public Shared Function GetRecords( _ + ByVal join As BaseFilter, _ + ByVal where As String, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As View_MaxPersonalEducationRecord() + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Dim recList As ArrayList = View_MaxPersonalEducationView.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, pageIndex, pageSize) + + Return CType(recList.ToArray(GetType(Persons.Business.View_MaxPersonalEducationRecord)), View_MaxPersonalEducationRecord()) + End Function + + Public Shared Function GetRecords( _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As View_MaxPersonalEducationRecord() + Dim join As BaseClasses.Data.BaseFilter = Nothing + Dim recList As ArrayList = View_MaxPersonalEducationView.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + Return CType(recList.ToArray(GetType(Persons.Business.View_MaxPersonalEducationRecord)), View_MaxPersonalEducationRecord()) + End Function + + Public Shared Function GetRecords( _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As View_MaxPersonalEducationRecord() + + Dim recList As ArrayList = View_MaxPersonalEducationView.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + Return CType(recList.ToArray(GetType(Persons.Business.View_MaxPersonalEducationRecord)), View_MaxPersonalEducationRecord()) + End Function + + Public Shared Function GetRecords( _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer, _ + ByRef totalRecords As Integer) As View_MaxPersonalEducationRecord() + Dim join As BaseClasses.Data.BaseFilter = Nothing + Dim recList As ArrayList = View_MaxPersonalEducationView.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize, totalRecords) + + Return CType(recList.ToArray(GetType(Persons.Business.View_MaxPersonalEducationRecord)), View_MaxPersonalEducationRecord()) + End Function + + Public Shared Function GetRecords( _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer, _ + ByRef totalRecords As Integer) As View_MaxPersonalEducationRecord() + + Dim recList As ArrayList = View_MaxPersonalEducationView.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize, totalRecords) + + Return CType(recList.ToArray(GetType(Persons.Business.View_MaxPersonalEducationRecord)), View_MaxPersonalEducationRecord()) + End Function + + ''' + ''' This is a shared function that can be used to get total number of records that will be returned using the where clause. + ''' + Public Shared Function GetRecordCount(ByVal where As String) As Integer + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Return CInt(View_MaxPersonalEducationView.Instance.GetRecordListCount(Nothing, whereFilter, Nothing, Nothing)) + End Function + +''' + ''' This is a shared function that can be used to get total number of records that will be returned using the where clause. + ''' + Public Shared Function GetRecordCount(ByVal join As BaseFilter, ByVal where As String) As Integer + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Return CInt(View_MaxPersonalEducationView.Instance.GetRecordListCount(join, whereFilter, Nothing, Nothing)) + End Function + + Public Shared Function GetRecordCount(ByVal where As WhereClause) As Integer + Return CInt(View_MaxPersonalEducationView.Instance.GetRecordListCount(Nothing, where.GetFilter(), Nothing, Nothing)) + End Function + + Public Shared Function GetRecordCount(ByVal join As BaseFilter, ByVal where As WhereClause) As Integer + Return CInt(View_MaxPersonalEducationView.Instance.GetRecordListCount(join, where.GetFilter(), Nothing, Nothing)) + End Function + + ''' + ''' This is a shared function that can be used to get a View_MaxPersonalEducationRecord record using a where clause. + ''' + Public Shared Function GetRecord(ByVal where As String) As View_MaxPersonalEducationRecord + Dim orderBy As OrderBy = Nothing + Return GetRecord(where, orderBy) + End Function + + ''' + ''' This is a shared function that can be used to get a View_MaxPersonalEducationRecord record using a where clause. + ''' + Public Shared Function GetRecord(ByVal join As BaseFilter, ByVal where As String) As View_MaxPersonalEducationRecord + Dim orderBy As OrderBy = Nothing + Return GetRecord(join, where, orderBy) + End Function + + ''' + ''' This is a shared function that can be used to get a View_MaxPersonalEducationRecord record using a where and order by clause. + ''' + Public Shared Function GetRecord( _ + ByVal where As String, _ + ByVal orderBy As OrderBy) As View_MaxPersonalEducationRecord + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + Dim join As BaseClasses.Data.BaseFilter = Nothing + Dim recList As ArrayList = View_MaxPersonalEducationView.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MIN_BATCH_SIZE) + + Dim rec As View_MaxPersonalEducationRecord = Nothing + If recList.Count > 0 Then + rec = CType(recList(0), View_MaxPersonalEducationRecord) + End If + + Return rec + End Function + + ''' + ''' This is a shared function that can be used to get a View_MaxPersonalEducationRecord record using a where and order by clause. + ''' + Public Shared Function GetRecord( _ + ByVal join As BaseFilter, _ + ByVal where As String, _ + ByVal orderBy As OrderBy) As View_MaxPersonalEducationRecord + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Dim recList As ArrayList = View_MaxPersonalEducationView.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MIN_BATCH_SIZE) + + Dim rec As View_MaxPersonalEducationRecord = Nothing + If recList.Count > 0 Then + rec = CType(recList(0), View_MaxPersonalEducationRecord) + End If + + Return rec + End Function + + + Public Shared Function GetValues( _ + ByVal col As BaseColumn, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal maxItems As Integer) As String() + + ' Create the filter list. + Dim retCol As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, True) + retCol.AddColumn(col) + + Return View_MaxPersonalEducationView.Instance.GetColumnValues(retCol, Nothing, where.GetFilter(), Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, maxItems) + + End Function + + Public Shared Function GetValues( _ + ByVal col As BaseColumn, _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal maxItems As Integer) As String() + + ' Create the filter list. + Dim retCol As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, True) + retCol.AddColumn(col) + + Return View_MaxPersonalEducationView.Instance.GetColumnValues(retCol, join, where.GetFilter(), Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, maxItems) + + End Function + + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where clause. + ''' + Public Shared Function GetDataTable(ByVal where As String) As System.Data.DataTable + + Dim recs() As View_MaxPersonalEducationRecord = GetRecords(where) + Return View_MaxPersonalEducationView.Instance.CreateDataTable(recs, Nothing) + End Function + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where clause. + ''' + Public Shared Function GetDataTable(ByVal join As BaseFilter, ByVal where As String) As System.Data.DataTable + + Dim recs() As View_MaxPersonalEducationRecord = GetRecords(join, where) + Return View_MaxPersonalEducationView.Instance.CreateDataTable(recs, Nothing) + End Function + + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause. + ''' + Public Shared Function GetDataTable(ByVal where As String, ByVal orderBy As OrderBy) As System.Data.DataTable + + Dim recs() As View_MaxPersonalEducationRecord = GetRecords(where, orderBy) + Return View_MaxPersonalEducationView.Instance.CreateDataTable(recs, Nothing) + End Function + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause. + ''' + Public Shared Function GetDataTable(ByVal join As BaseFilter, ByVal where As String, ByVal orderBy As OrderBy) As System.Data.DataTable + + Dim recs() As View_MaxPersonalEducationRecord = GetRecords(join, where, orderBy) + Return View_MaxPersonalEducationView.Instance.CreateDataTable(recs, Nothing) + End Function + + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause with pagination. + ''' + Public Shared Function GetDataTable( _ + ByVal where As String, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As System.Data.DataTable + + Dim recs() As View_MaxPersonalEducationRecord = GetRecords(where, orderBy, pageIndex, pageSize) + Return View_MaxPersonalEducationView.Instance.CreateDataTable(recs, Nothing) + End Function + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause with pagination. + ''' + Public Shared Function GetDataTable( _ + ByVal join As BaseFilter, _ + ByVal where As String, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As System.Data.DataTable + + Dim recs() As View_MaxPersonalEducationRecord = GetRecords(join, where, orderBy, pageIndex, pageSize) + Return View_MaxPersonalEducationView.Instance.CreateDataTable(recs, Nothing) + End Function + + + ''' + ''' This is a shared function that can be used to delete records using a where clause. + ''' + Public Shared Sub DeleteRecords(ByVal where As String) + If where = Nothing OrElse where.Trim() = "" Then + Return + End If + + Dim whereFilter As SqlFilter = New SqlFilter(where) + View_MaxPersonalEducationView.Instance.DeleteRecordList(whereFilter) + End Sub + + ''' + ''' This is a shared function that can be used to export records using a where clause. + ''' + Public Shared Function Export(ByVal where As String) As String + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Return View_MaxPersonalEducationView.Instance.ExportRecordData(whereFilter) + End Function + + Public Shared Function Export(ByVal where As WhereClause) As String + Dim whereFilter As BaseFilter = Nothing + If Not where Is Nothing Then + whereFilter = where.GetFilter() + End If + + Return View_MaxPersonalEducationView.Instance.ExportRecordData(whereFilter) + End Function + + Public Shared Function GetSum( _ + ByVal col As BaseColumn, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) _ + As String + + Dim colSel As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, False) + colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Sum) + + Return View_MaxPersonalEducationView.Instance.GetColumnStatistics(colSel, Nothing, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + End Function + + Public Shared Function GetSum( _ + ByVal col As BaseColumn, _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) _ + As String + + Dim colSel As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, False) + colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Sum) + + Return View_MaxPersonalEducationView.Instance.GetColumnStatistics(colSel, join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + End Function + + + Public Shared Function GetCount( _ + ByVal col As BaseColumn, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) _ + As String + + Dim colSel As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, False) + colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Count) + + Return View_MaxPersonalEducationView.Instance.GetColumnStatistics(colSel, Nothing, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + End Function + + Public Shared Function GetCount( _ + ByVal col As BaseColumn, _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) _ + As String + + Dim colSel As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, False) + colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Count) + + Return View_MaxPersonalEducationView.Instance.GetColumnStatistics(colSel, join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + End Function + + ''' + ''' This method returns the columns in the table. + ''' + Public Shared Function GetColumns() As BaseColumn() + Return View_MaxPersonalEducationView.Instance.TableDefinition.Columns + End Function + + ''' + ''' This method returns the columnlist in the table. + ''' + Public Shared Function GetColumnList() As ColumnList + Return View_MaxPersonalEducationView.Instance.TableDefinition.ColumnList + End Function + + + ''' + ''' This method creates a new record and returns it to be edited. + ''' + Public Shared Function CreateNewRecord() As IRecord + Return View_MaxPersonalEducationView.Instance.CreateRecord() + End Function + + ''' + ''' This method creates a new record and returns it to be edited. + ''' + ''' ID of the new record. + Public Shared Function CreateNewRecord(ByVal tempId As String) As IRecord + Return View_MaxPersonalEducationView.Instance.CreateRecord(tempId) + End Function + + ''' + ''' This method checks if column is editable. + ''' + ''' Name of the column to check. + Public Shared Function isReadOnlyColumn(ByVal columnName As String) As Boolean + Dim column As BaseColumn = GetColumn(columnName) + If (Not IsNothing(column)) Then + Return column.IsValuesReadOnly + Else + Return True + End If + End Function + + ''' + ''' This method gets the specified column. + ''' + ''' Unique name of the column to fetch. + Public Shared Function GetColumn(ByVal uniqueColumnName As String) As BaseColumn + Dim column As BaseColumn = View_MaxPersonalEducationView.Instance.TableDefinition.ColumnList.GetByUniqueName(uniqueColumnName) + Return column + End Function + + ' Convenience method for getting a record using a string-based record identifier + Public Shared Function GetRecord(ByVal id As String, ByVal bMutable As Boolean) As View_MaxPersonalEducationRecord + Return CType(View_MaxPersonalEducationView.Instance.GetRecordData(id, bMutable), View_MaxPersonalEducationRecord) + End Function + + ' Convenience method for getting a record using a KeyValue record identifier + Public Shared Function GetRecord(ByVal id As KeyValue, ByVal bMutable As Boolean) As View_MaxPersonalEducationRecord + Return CType(View_MaxPersonalEducationView.Instance.GetRecordData(id, bMutable), View_MaxPersonalEducationRecord) + End Function + + ' Convenience method for creating a record + Public Overloads Function NewRecord( _ + ByVal PersonalIdValue As String, _ + ByVal RankIdValue As String, _ + ByVal ShortRankNormalValue As String, _ + ByVal PersonalNameValue As String, _ + ByVal PersonalLastNameValue As String, _ + ByVal SectionNameValue As String, _ + ByVal LevelValue As String, _ + ByVal StartDateValue As String, _ + ByVal EndDateValue As String, _ + ByVal CourseValue As String, _ + ByVal CourseAbbrValue As String, _ + ByVal InstitueValue As String, _ + ByVal FacultryValue As String, _ + ByVal LevelIdValue As String, _ + ByVal EdYearValue As String, _ + ByVal EducationPeriodValue As String, _ + ByVal EducationTypeValue As String, _ + ByVal CourseNoValue As String, _ + ByVal ScoreNoValue As String, _ + ByVal NoAllValue As String, _ + ByVal ScoreValue As String, _ + ByVal CommandValue As String, _ + ByVal CommandDateValue As String, _ + ByVal CountryValue As String, _ + ByVal DateRankValue As String, _ + ByVal DatePrevRankValue As String, _ + ByVal StatusIdValue As String, _ + ByVal RankLevelNameValue As String, _ + ByVal SectionAbbvrNameValue As String, _ + ByVal RankAndNameValue As String, _ + ByVal RankLevelValue As String _ + ) As KeyValue + Dim rec As IPrimaryKeyRecord = CType(Me.CreateRecord(), IPrimaryKeyRecord) + rec.SetString(PersonalIdValue, PersonalIdColumn) + rec.SetString(RankIdValue, RankIdColumn) + rec.SetString(ShortRankNormalValue, ShortRankNormalColumn) + rec.SetString(PersonalNameValue, PersonalNameColumn) + rec.SetString(PersonalLastNameValue, PersonalLastNameColumn) + rec.SetString(SectionNameValue, SectionNameColumn) + rec.SetString(LevelValue, LevelColumn) + rec.SetString(StartDateValue, StartDateColumn) + rec.SetString(EndDateValue, EndDateColumn) + rec.SetString(CourseValue, CourseColumn) + rec.SetString(CourseAbbrValue, CourseAbbrColumn) + rec.SetString(InstitueValue, InstitueColumn) + rec.SetString(FacultryValue, FacultryColumn) + rec.SetString(LevelIdValue, LevelIdColumn) + rec.SetString(EdYearValue, EdYearColumn) + rec.SetString(EducationPeriodValue, EducationPeriodColumn) + rec.SetString(EducationTypeValue, EducationTypeColumn) + rec.SetString(CourseNoValue, CourseNoColumn) + rec.SetString(ScoreNoValue, ScoreNoColumn) + rec.SetString(NoAllValue, NoAllColumn) + rec.SetString(ScoreValue, ScoreColumn) + rec.SetString(CommandValue, CommandColumn) + rec.SetString(CommandDateValue, CommandDateColumn) + rec.SetString(CountryValue, CountryColumn) + rec.SetString(DateRankValue, DateRankColumn) + rec.SetString(DatePrevRankValue, DatePrevRankColumn) + rec.SetString(StatusIdValue, StatusIdColumn) + rec.SetString(RankLevelNameValue, RankLevelNameColumn) + rec.SetString(SectionAbbvrNameValue, SectionAbbvrNameColumn) + rec.SetString(RankAndNameValue, RankAndNameColumn) + rec.SetString(RankLevelValue, RankLevelColumn) + + + rec.Create() 'update the DB so any DB-initialized fields (like autoincrement IDs) can be initialized + + Dim key As KeyValue = rec.GetID() + Return key + End Function + + ''' + ''' This method deletes a specified record + ''' + ''' Keyvalue of the record to be deleted. + Public Shared Sub DeleteRecord(ByVal kv As KeyValue) + View_MaxPersonalEducationView.Instance.DeleteOneRecord(kv) + End Sub + + ''' + ''' This method checks if record exist in the database using the keyvalue provided. + ''' + ''' Key value of the record. + Public Shared Function DoesRecordExist(ByVal kv As KeyValue) As Boolean + Dim recordExist As Boolean = True + Try + View_MaxPersonalEducationView.GetRecord(kv, False) + Catch ex As Exception + recordExist = False + End Try + Return recordExist + End Function + + ''' + ''' This method returns all the primary columns in the table. + ''' + Public Shared Function GetPrimaryKeyColumns() As ColumnList + If (Not IsNothing(View_MaxPersonalEducationView.Instance.TableDefinition.PrimaryKey)) Then + Return View_MaxPersonalEducationView.Instance.TableDefinition.PrimaryKey.Columns + Else + Return Nothing + End If + End Function + + ''' + ''' This method takes a key and returns a keyvalue. + ''' + ''' key could be array of primary key values in case of composite primary key or a string containing single primary key value in case of non-composite primary key. + Public Shared Function GetKeyValue(ByVal key As Object) As KeyValue + Dim kv As KeyValue = Nothing + + If (Not (IsNothing(View_MaxPersonalEducationView.Instance.TableDefinition.PrimaryKey))) Then + + Dim isCompositePrimaryKey As Boolean = False + isCompositePrimaryKey = View_MaxPersonalEducationView.Instance.TableDefinition.PrimaryKey.IsCompositeKey + + If ((isCompositePrimaryKey) AndAlso (key.GetType.IsArray())) Then + + ' If the key is composite, then construct a key value. + kv = New KeyValue + Dim fullKeyString As String = "" + Dim keyArray As Array = CType(key, Array) + If (Not IsNothing(keyArray)) Then + Dim length As Integer = keyArray.Length + Dim pkColumns As ColumnList = View_MaxPersonalEducationView.Instance.TableDefinition.PrimaryKey.Columns + Dim pkColumn As BaseColumn + Dim index As Integer = 0 + For Each pkColumn In pkColumns + Dim keyString As String = CType(keyArray.GetValue(index), String) + If (View_MaxPersonalEducationView.Instance.TableDefinition.TableType = BaseClasses.Data.TableDefinition.TableTypes.Virtual) Then + kv.AddElement(pkColumn.UniqueName, keyString) + Else + kv.AddElement(pkColumn.InternalName, keyString) + End If + index = index + 1 + Next pkColumn + End If + + Else + ' If the key is not composite, then get the key value. + kv = View_MaxPersonalEducationView.Instance.TableDefinition.PrimaryKey.ParseValue(CType(key, String)) + End If + End If + Return kv + End Function + + + ''' + ''' This method takes a record and a Column and returns an evaluated value of DFKA formula. + ''' + Public Shared Function GetDFKA(ByVal rec As BaseRecord, ByVal col As BaseColumn) As String + Dim fkColumn As ForeignKey = View_MaxPersonalEducationView.Instance.TableDefinition.GetExpandableNonCompositeForeignKey(col) + If fkColumn Is Nothing Then + Return Nothing + End If + Dim _DFKA As String = fkColumn.PrimaryKeyDisplayColumns + If (_DFKA.Trim().StartsWith("=")) Then + ' if the formula is in the format of "= ., then pull out the data from the rec object instead of doing formula evaluation + Dim tableCodeName As String = fkColumn.PrimaryKeyTableDefinition.TableCodeName + Dim column As String = _DFKA.Trim("="c).Trim() + If column.StartsWith(tableCodeName & ".", StringComparison.InvariantCultureIgnoreCase) Then + column = column.Substring(tableCodeName.Length + 1) + End If + + For Each c As BaseColumn In fkColumn.PrimaryKeyTableDefinition.Columns + If column = c.CodeName Then + Return rec.Format(c) + End If + Next + Dim tableName As String = fkColumn.PrimaryKeyTableDefinition.TableCodeName + Return EvaluateFormula(_DFKA, rec, Nothing, tableName) + Else + Return Nothing + End If + End Function + + ''' + ''' This method takes a keyValue and a Column and returns an evaluated value of DFKA formula. + ''' + Public Shared Function GetDFKA(ByVal keyValue As String, ByVal col As BaseColumn, ByVal formatPattern as String) As String + If keyValue Is Nothing Then + Return Nothing + End If + Dim fkColumn As ForeignKey = View_MaxPersonalEducationView.Instance.TableDefinition.GetExpandableNonCompositeForeignKey(col) + If fkColumn Is Nothing Then + Return Nothing + End If + Dim _DFKA As String = fkColumn.PrimaryKeyDisplayColumns + If (_DFKA.Trim().StartsWith("=")) Then + Dim tableName As String = fkColumn.PrimaryKeyTableDefinition.TableCodeName + Dim t As PrimaryKeyTable = CType(DatabaseObjects.GetTableObject(tableName), PrimaryKeyTable) + Dim rec As BaseRecord = Nothing + If Not t Is Nothing Then + Try + rec = CType(t.GetRecordData(keyValue, False), BaseRecord) + Catch + rec = Nothing + End Try + End If + If rec Is Nothing Then + Return "" + End If + + ' if the formula is in the format of "= ., then pull out the data from the rec object instead of doing formula evaluation + Dim tableCodeName As String = fkColumn.PrimaryKeyTableDefinition.TableCodeName + Dim column As String = _DFKA.Trim("="c).Trim() + If column.StartsWith(tableCodeName & ".", StringComparison.InvariantCultureIgnoreCase) Then + column = column.Substring(tableCodeName.Length + 1) + End If + + For Each c As BaseColumn In fkColumn.PrimaryKeyTableDefinition.Columns + If column = c.CodeName Then + Return rec.Format(c) + End If + Next + Return EvaluateFormula(_DFKA, rec, Nothing, tableName) + Else + Return Nothing + End If + End Function + + ''' + ''' Evaluates the formula + ''' + Public Shared Function EvaluateFormula(ByVal formula As String, Optional ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord = Nothing, Optional ByVal format As String = Nothing, Optional ByVal name As String = "") As String + Dim e As BaseFormulaEvaluator = New BaseFormulaEvaluator() + If Not dataSourceForEvaluate Is Nothing Then + e.Evaluator.Variables.Add(name, dataSourceForEvaluate) + end if + e.DataSource = dataSourceForEvaluate + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + If Not String.IsNullOrEmpty(format) Then + Return BaseFormulaUtils.Format(resultObj, format) + Else + Return resultObj.ToString() + End If + End Function + + +#End Region + +End Class +End Namespace diff --git a/App_Code/Business Layer/BaseView_PersonalEducationRecord.vb b/App_Code/Business Layer/BaseView_PersonalEducationRecord.vb new file mode 100644 index 0000000..8bd463b --- /dev/null +++ b/App_Code/Business Layer/BaseView_PersonalEducationRecord.vb @@ -0,0 +1,1717 @@ +' This class is "generated" and will be overwritten. +' Your customizations should be made in View_PersonalEducationRecord.vb + +Imports System.Data.SqlTypes +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + +Namespace Persons.Business + +''' +''' The generated superclass for the class. +''' +''' +''' This class is not intended to be instantiated directly. To obtain an instance of this class, +''' use the methods of the class. +''' +''' +''' + + Public Class BaseView_PersonalEducationRecord + Inherits KeylessRecord + + + Public Shared Shadows ReadOnly TableUtils As View_PersonalEducationView = View_PersonalEducationView.Instance + + ' Constructors + + Protected Sub New() + MyBase.New(TableUtils) + End Sub + + Protected Sub New(ByVal record As KeylessRecord) + MyBase.New(record, TableUtils) + End Sub + + 'Evaluates Initialize when->Reading record formulas specified at the data access layer + Public Overridable Sub View_PersonalEducationRecord_ReadRecord(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.ReadRecord + 'Apply Initialize->Reading record formula only if validation is successful. + Dim View_PersonalEducationRec As View_PersonalEducationRecord = CType(sender,View_PersonalEducationRecord) + If Not View_PersonalEducationRec Is Nothing AndAlso Not View_PersonalEducationRec.IsReadOnly Then + End If + End Sub + + 'Evaluates Initialize when->Inserting record formulas specified at the data access layer + Public Overridable Sub View_PersonalEducationRecord_InsertingRecord(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles Me.InsertingRecord + 'Apply Initialize->Inserting record formula only if validation is successful. + Dim View_PersonalEducationRec As View_PersonalEducationRecord = CType(sender,View_PersonalEducationRecord) + Validate_Inserting() + If Not View_PersonalEducationRec Is Nothing AndAlso Not View_PersonalEducationRec.IsReadOnly Then + End If + End Sub + + 'Evaluates Validate when->Inserting formulas specified at the data access layer + Public Overridable Sub Validate_Inserting () + Dim fullValidationMessage As String = "" + Dim validationMessage As String = "" + + dim formula as String = "" + + + If validationMessage <> "" AndAlso validationMessage.ToLower() <> "true" Then + fullValidationMessage &= validationMessage & vbCrLf + End If + + If fullValidationMessage <> "" Then + Throw New Exception(fullValidationMessage) + End If + End Sub + + Public Overridable Function EvaluateFormula(ByVal formula As String, Optional ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord = Nothing, Optional ByVal format As String = Nothing) As String + + Dim e As Data.BaseFormulaEvaluator = New Data.BaseFormulaEvaluator() + + ' All variables referred to in the formula are expected to be + ' properties of the DataSource. For example, referring to + ' UnitPrice as a variable will refer to DataSource.UnitPrice + e.DataSource = dataSourceForEvaluate + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + Return resultObj.ToString() + End Function + + + + + + + +#Region "Convenience methods to get/set values of fields" + + ''' + ''' This is a convenience method that provides direct access to the value of the record's View_PersonalEducation_.PersonalId field. + ''' + Public Function GetPersonalIdValue() As ColumnValue + Return Me.GetValue(TableUtils.PersonalIdColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's View_PersonalEducation_.PersonalId field. + ''' + Public Function GetPersonalIdFieldValue() As String + Return CType(Me.GetValue(TableUtils.PersonalIdColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_PersonalEducation_.PersonalId field. + ''' + Public Sub SetPersonalIdFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.PersonalIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_PersonalEducation_.PersonalId field. + ''' + Public Sub SetPersonalIdFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.PersonalIdColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's View_PersonalEducation_.RankAndName field. + ''' + Public Function GetRankAndNameValue() As ColumnValue + Return Me.GetValue(TableUtils.RankAndNameColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's View_PersonalEducation_.RankAndName field. + ''' + Public Function GetRankAndNameFieldValue() As String + Return CType(Me.GetValue(TableUtils.RankAndNameColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_PersonalEducation_.RankAndName field. + ''' + Public Sub SetRankAndNameFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.RankAndNameColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_PersonalEducation_.RankAndName field. + ''' + Public Sub SetRankAndNameFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.RankAndNameColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's View_PersonalEducation_.SectionId field. + ''' + Public Function GetSectionIdValue() As ColumnValue + Return Me.GetValue(TableUtils.SectionIdColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's View_PersonalEducation_.SectionId field. + ''' + Public Function GetSectionIdFieldValue() As Int16 + Return CType(Me.GetValue(TableUtils.SectionIdColumn).ToInt16(), Int16) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_PersonalEducation_.SectionId field. + ''' + Public Sub SetSectionIdFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.SectionIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_PersonalEducation_.SectionId field. + ''' + Public Sub SetSectionIdFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.SectionIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_PersonalEducation_.SectionId field. + ''' + Public Sub SetSectionIdFieldValue(ByVal val As Double) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.SectionIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_PersonalEducation_.SectionId field. + ''' + Public Sub SetSectionIdFieldValue(ByVal val As Decimal) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.SectionIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_PersonalEducation_.SectionId field. + ''' + Public Sub SetSectionIdFieldValue(ByVal val As Int64) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.SectionIdColumn) + End Sub + ''' + ''' This is a convenience method that provides direct access to the value of the record's View_PersonalEducation_.SectionName field. + ''' + Public Function GetSectionNameValue() As ColumnValue + Return Me.GetValue(TableUtils.SectionNameColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's View_PersonalEducation_.SectionName field. + ''' + Public Function GetSectionNameFieldValue() As String + Return CType(Me.GetValue(TableUtils.SectionNameColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_PersonalEducation_.SectionName field. + ''' + Public Sub SetSectionNameFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.SectionNameColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_PersonalEducation_.SectionName field. + ''' + Public Sub SetSectionNameFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.SectionNameColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's View_PersonalEducation_.SectionAbbvrName field. + ''' + Public Function GetSectionAbbvrNameValue() As ColumnValue + Return Me.GetValue(TableUtils.SectionAbbvrNameColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's View_PersonalEducation_.SectionAbbvrName field. + ''' + Public Function GetSectionAbbvrNameFieldValue() As String + Return CType(Me.GetValue(TableUtils.SectionAbbvrNameColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_PersonalEducation_.SectionAbbvrName field. + ''' + Public Sub SetSectionAbbvrNameFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.SectionAbbvrNameColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_PersonalEducation_.SectionAbbvrName field. + ''' + Public Sub SetSectionAbbvrNameFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.SectionAbbvrNameColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's View_PersonalEducation_.ShortRankNormal field. + ''' + Public Function GetShortRankNormalValue() As ColumnValue + Return Me.GetValue(TableUtils.ShortRankNormalColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's View_PersonalEducation_.ShortRankNormal field. + ''' + Public Function GetShortRankNormalFieldValue() As String + Return CType(Me.GetValue(TableUtils.ShortRankNormalColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_PersonalEducation_.ShortRankNormal field. + ''' + Public Sub SetShortRankNormalFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.ShortRankNormalColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_PersonalEducation_.ShortRankNormal field. + ''' + Public Sub SetShortRankNormalFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.ShortRankNormalColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's View_PersonalEducation_.StartDate field. + ''' + Public Function GetStartDateValue() As ColumnValue + Return Me.GetValue(TableUtils.StartDateColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's View_PersonalEducation_.StartDate field. + ''' + Public Function GetStartDateFieldValue() As DateTime + Return CType(Me.GetValue(TableUtils.StartDateColumn).ToDateTime(), DateTime) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_PersonalEducation_.StartDate field. + ''' + Public Sub SetStartDateFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.StartDateColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_PersonalEducation_.StartDate field. + ''' + Public Sub SetStartDateFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.StartDateColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_PersonalEducation_.StartDate field. + ''' + Public Sub SetStartDateFieldValue(ByVal val As DateTime) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.StartDateColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's View_PersonalEducation_.EndDate field. + ''' + Public Function GetEndDateValue() As ColumnValue + Return Me.GetValue(TableUtils.EndDateColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's View_PersonalEducation_.EndDate field. + ''' + Public Function GetEndDateFieldValue() As DateTime + Return CType(Me.GetValue(TableUtils.EndDateColumn).ToDateTime(), DateTime) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_PersonalEducation_.EndDate field. + ''' + Public Sub SetEndDateFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.EndDateColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_PersonalEducation_.EndDate field. + ''' + Public Sub SetEndDateFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.EndDateColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_PersonalEducation_.EndDate field. + ''' + Public Sub SetEndDateFieldValue(ByVal val As DateTime) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.EndDateColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's View_PersonalEducation_.Course field. + ''' + Public Function GetCourseValue() As ColumnValue + Return Me.GetValue(TableUtils.CourseColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's View_PersonalEducation_.Course field. + ''' + Public Function GetCourseFieldValue() As String + Return CType(Me.GetValue(TableUtils.CourseColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_PersonalEducation_.Course field. + ''' + Public Sub SetCourseFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.CourseColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_PersonalEducation_.Course field. + ''' + Public Sub SetCourseFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.CourseColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's View_PersonalEducation_.CourseAbbr field. + ''' + Public Function GetCourseAbbrValue() As ColumnValue + Return Me.GetValue(TableUtils.CourseAbbrColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's View_PersonalEducation_.CourseAbbr field. + ''' + Public Function GetCourseAbbrFieldValue() As String + Return CType(Me.GetValue(TableUtils.CourseAbbrColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_PersonalEducation_.CourseAbbr field. + ''' + Public Sub SetCourseAbbrFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.CourseAbbrColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_PersonalEducation_.CourseAbbr field. + ''' + Public Sub SetCourseAbbrFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.CourseAbbrColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's View_PersonalEducation_.Institue field. + ''' + Public Function GetInstitueValue() As ColumnValue + Return Me.GetValue(TableUtils.InstitueColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's View_PersonalEducation_.Institue field. + ''' + Public Function GetInstitueFieldValue() As String + Return CType(Me.GetValue(TableUtils.InstitueColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_PersonalEducation_.Institue field. + ''' + Public Sub SetInstitueFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.InstitueColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_PersonalEducation_.Institue field. + ''' + Public Sub SetInstitueFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.InstitueColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's View_PersonalEducation_.Facultry field. + ''' + Public Function GetFacultryValue() As ColumnValue + Return Me.GetValue(TableUtils.FacultryColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's View_PersonalEducation_.Facultry field. + ''' + Public Function GetFacultryFieldValue() As String + Return CType(Me.GetValue(TableUtils.FacultryColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_PersonalEducation_.Facultry field. + ''' + Public Sub SetFacultryFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.FacultryColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_PersonalEducation_.Facultry field. + ''' + Public Sub SetFacultryFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.FacultryColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's View_PersonalEducation_.LevelId field. + ''' + Public Function GetLevelIdValue() As ColumnValue + Return Me.GetValue(TableUtils.LevelIdColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's View_PersonalEducation_.LevelId field. + ''' + Public Function GetLevelIdFieldValue() As Int16 + Return CType(Me.GetValue(TableUtils.LevelIdColumn).ToInt16(), Int16) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_PersonalEducation_.LevelId field. + ''' + Public Sub SetLevelIdFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.LevelIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_PersonalEducation_.LevelId field. + ''' + Public Sub SetLevelIdFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.LevelIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_PersonalEducation_.LevelId field. + ''' + Public Sub SetLevelIdFieldValue(ByVal val As Double) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.LevelIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_PersonalEducation_.LevelId field. + ''' + Public Sub SetLevelIdFieldValue(ByVal val As Decimal) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.LevelIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_PersonalEducation_.LevelId field. + ''' + Public Sub SetLevelIdFieldValue(ByVal val As Int64) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.LevelIdColumn) + End Sub + ''' + ''' This is a convenience method that provides direct access to the value of the record's View_PersonalEducation_.EdYear field. + ''' + Public Function GetEdYearValue() As ColumnValue + Return Me.GetValue(TableUtils.EdYearColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's View_PersonalEducation_.EdYear field. + ''' + Public Function GetEdYearFieldValue() As String + Return CType(Me.GetValue(TableUtils.EdYearColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_PersonalEducation_.EdYear field. + ''' + Public Sub SetEdYearFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.EdYearColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_PersonalEducation_.EdYear field. + ''' + Public Sub SetEdYearFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.EdYearColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's View_PersonalEducation_.EducationPeriod field. + ''' + Public Function GetEducationPeriodValue() As ColumnValue + Return Me.GetValue(TableUtils.EducationPeriodColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's View_PersonalEducation_.EducationPeriod field. + ''' + Public Function GetEducationPeriodFieldValue() As Byte + Return CType(Me.GetValue(TableUtils.EducationPeriodColumn).ToByte(), Byte) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_PersonalEducation_.EducationPeriod field. + ''' + Public Sub SetEducationPeriodFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.EducationPeriodColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_PersonalEducation_.EducationPeriod field. + ''' + Public Sub SetEducationPeriodFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.EducationPeriodColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_PersonalEducation_.EducationPeriod field. + ''' + Public Sub SetEducationPeriodFieldValue(ByVal val As Double) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.EducationPeriodColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_PersonalEducation_.EducationPeriod field. + ''' + Public Sub SetEducationPeriodFieldValue(ByVal val As Decimal) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.EducationPeriodColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_PersonalEducation_.EducationPeriod field. + ''' + Public Sub SetEducationPeriodFieldValue(ByVal val As Int64) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.EducationPeriodColumn) + End Sub + ''' + ''' This is a convenience method that provides direct access to the value of the record's View_PersonalEducation_.EducationType field. + ''' + Public Function GetEducationTypeValue() As ColumnValue + Return Me.GetValue(TableUtils.EducationTypeColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's View_PersonalEducation_.EducationType field. + ''' + Public Function GetEducationTypeFieldValue() As Byte + Return CType(Me.GetValue(TableUtils.EducationTypeColumn).ToByte(), Byte) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_PersonalEducation_.EducationType field. + ''' + Public Sub SetEducationTypeFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.EducationTypeColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_PersonalEducation_.EducationType field. + ''' + Public Sub SetEducationTypeFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.EducationTypeColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_PersonalEducation_.EducationType field. + ''' + Public Sub SetEducationTypeFieldValue(ByVal val As Double) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.EducationTypeColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_PersonalEducation_.EducationType field. + ''' + Public Sub SetEducationTypeFieldValue(ByVal val As Decimal) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.EducationTypeColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_PersonalEducation_.EducationType field. + ''' + Public Sub SetEducationTypeFieldValue(ByVal val As Int64) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.EducationTypeColumn) + End Sub + ''' + ''' This is a convenience method that provides direct access to the value of the record's View_PersonalEducation_.COUNTRY field. + ''' + Public Function GetCOUNTRYValue() As ColumnValue + Return Me.GetValue(TableUtils.COUNTRYColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's View_PersonalEducation_.COUNTRY field. + ''' + Public Function GetCOUNTRYFieldValue() As Int16 + Return CType(Me.GetValue(TableUtils.COUNTRYColumn).ToInt16(), Int16) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_PersonalEducation_.COUNTRY field. + ''' + Public Sub SetCOUNTRYFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.COUNTRYColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_PersonalEducation_.COUNTRY field. + ''' + Public Sub SetCOUNTRYFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.COUNTRYColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_PersonalEducation_.COUNTRY field. + ''' + Public Sub SetCOUNTRYFieldValue(ByVal val As Double) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.COUNTRYColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_PersonalEducation_.COUNTRY field. + ''' + Public Sub SetCOUNTRYFieldValue(ByVal val As Decimal) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.COUNTRYColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_PersonalEducation_.COUNTRY field. + ''' + Public Sub SetCOUNTRYFieldValue(ByVal val As Int64) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.COUNTRYColumn) + End Sub + ''' + ''' This is a convenience method that provides direct access to the value of the record's View_PersonalEducation_.CourseNo field. + ''' + Public Function GetCourseNoValue() As ColumnValue + Return Me.GetValue(TableUtils.CourseNoColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's View_PersonalEducation_.CourseNo field. + ''' + Public Function GetCourseNoFieldValue() As String + Return CType(Me.GetValue(TableUtils.CourseNoColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_PersonalEducation_.CourseNo field. + ''' + Public Sub SetCourseNoFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.CourseNoColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_PersonalEducation_.CourseNo field. + ''' + Public Sub SetCourseNoFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.CourseNoColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's View_PersonalEducation_.ScoreNo field. + ''' + Public Function GetScoreNoValue() As ColumnValue + Return Me.GetValue(TableUtils.ScoreNoColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's View_PersonalEducation_.ScoreNo field. + ''' + Public Function GetScoreNoFieldValue() As String + Return CType(Me.GetValue(TableUtils.ScoreNoColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_PersonalEducation_.ScoreNo field. + ''' + Public Sub SetScoreNoFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.ScoreNoColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_PersonalEducation_.ScoreNo field. + ''' + Public Sub SetScoreNoFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.ScoreNoColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's View_PersonalEducation_.NoAll field. + ''' + Public Function GetNoAllValue() As ColumnValue + Return Me.GetValue(TableUtils.NoAllColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's View_PersonalEducation_.NoAll field. + ''' + Public Function GetNoAllFieldValue() As String + Return CType(Me.GetValue(TableUtils.NoAllColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_PersonalEducation_.NoAll field. + ''' + Public Sub SetNoAllFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.NoAllColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_PersonalEducation_.NoAll field. + ''' + Public Sub SetNoAllFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.NoAllColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's View_PersonalEducation_.Score field. + ''' + Public Function GetScoreValue() As ColumnValue + Return Me.GetValue(TableUtils.ScoreColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's View_PersonalEducation_.Score field. + ''' + Public Function GetScoreFieldValue() As String + Return CType(Me.GetValue(TableUtils.ScoreColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_PersonalEducation_.Score field. + ''' + Public Sub SetScoreFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.ScoreColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_PersonalEducation_.Score field. + ''' + Public Sub SetScoreFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.ScoreColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's View_PersonalEducation_.Command field. + ''' + Public Function GetCommandValue() As ColumnValue + Return Me.GetValue(TableUtils.CommandColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's View_PersonalEducation_.Command field. + ''' + Public Function GetCommandFieldValue() As String + Return CType(Me.GetValue(TableUtils.CommandColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_PersonalEducation_.Command field. + ''' + Public Sub SetCommandFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.CommandColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_PersonalEducation_.Command field. + ''' + Public Sub SetCommandFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.CommandColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's View_PersonalEducation_.CommandDate field. + ''' + Public Function GetCommandDateValue() As ColumnValue + Return Me.GetValue(TableUtils.CommandDateColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's View_PersonalEducation_.CommandDate field. + ''' + Public Function GetCommandDateFieldValue() As DateTime + Return CType(Me.GetValue(TableUtils.CommandDateColumn).ToDateTime(), DateTime) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_PersonalEducation_.CommandDate field. + ''' + Public Sub SetCommandDateFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.CommandDateColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_PersonalEducation_.CommandDate field. + ''' + Public Sub SetCommandDateFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.CommandDateColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_PersonalEducation_.CommandDate field. + ''' + Public Sub SetCommandDateFieldValue(ByVal val As DateTime) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.CommandDateColumn) + End Sub + + + +#End Region + +#Region "Convenience methods to get field names" + + ''' + ''' This is a convenience property that provides direct access to the value of the record's View_PersonalEducation_.PersonalId field. + ''' + Public Property PersonalId() As String + Get + Return CType(Me.GetValue(TableUtils.PersonalIdColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.PersonalIdColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property PersonalIdSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.PersonalIdColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property PersonalIdDefault() As String + Get + Return TableUtils.PersonalIdColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's View_PersonalEducation_.RankAndName field. + ''' + Public Property RankAndName() As String + Get + Return CType(Me.GetValue(TableUtils.RankAndNameColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.RankAndNameColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property RankAndNameSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.RankAndNameColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property RankAndNameDefault() As String + Get + Return TableUtils.RankAndNameColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's View_PersonalEducation_.SectionId field. + ''' + Public Property SectionId() As Int16 + Get + Return CType(Me.GetValue(TableUtils.SectionIdColumn).ToInt16(), Int16) + End Get + Set (ByVal val As Int16) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.SectionIdColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property SectionIdSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.SectionIdColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property SectionIdDefault() As String + Get + Return TableUtils.SectionIdColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's View_PersonalEducation_.SectionName field. + ''' + Public Property SectionName() As String + Get + Return CType(Me.GetValue(TableUtils.SectionNameColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.SectionNameColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property SectionNameSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.SectionNameColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property SectionNameDefault() As String + Get + Return TableUtils.SectionNameColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's View_PersonalEducation_.SectionAbbvrName field. + ''' + Public Property SectionAbbvrName() As String + Get + Return CType(Me.GetValue(TableUtils.SectionAbbvrNameColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.SectionAbbvrNameColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property SectionAbbvrNameSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.SectionAbbvrNameColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property SectionAbbvrNameDefault() As String + Get + Return TableUtils.SectionAbbvrNameColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's View_PersonalEducation_.ShortRankNormal field. + ''' + Public Property ShortRankNormal() As String + Get + Return CType(Me.GetValue(TableUtils.ShortRankNormalColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.ShortRankNormalColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property ShortRankNormalSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.ShortRankNormalColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property ShortRankNormalDefault() As String + Get + Return TableUtils.ShortRankNormalColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's View_PersonalEducation_.StartDate field. + ''' + Public Property StartDate() As DateTime + Get + Return CType(Me.GetValue(TableUtils.StartDateColumn).ToDateTime(), DateTime) + End Get + Set (ByVal val As DateTime) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.StartDateColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property StartDateSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.StartDateColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property StartDateDefault() As String + Get + Return TableUtils.StartDateColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's View_PersonalEducation_.EndDate field. + ''' + Public Property EndDate() As DateTime + Get + Return CType(Me.GetValue(TableUtils.EndDateColumn).ToDateTime(), DateTime) + End Get + Set (ByVal val As DateTime) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.EndDateColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property EndDateSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.EndDateColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property EndDateDefault() As String + Get + Return TableUtils.EndDateColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's View_PersonalEducation_.Course field. + ''' + Public Property Course() As String + Get + Return CType(Me.GetValue(TableUtils.CourseColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.CourseColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property CourseSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.CourseColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property CourseDefault() As String + Get + Return TableUtils.CourseColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's View_PersonalEducation_.CourseAbbr field. + ''' + Public Property CourseAbbr() As String + Get + Return CType(Me.GetValue(TableUtils.CourseAbbrColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.CourseAbbrColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property CourseAbbrSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.CourseAbbrColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property CourseAbbrDefault() As String + Get + Return TableUtils.CourseAbbrColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's View_PersonalEducation_.Institue field. + ''' + Public Property Institue() As String + Get + Return CType(Me.GetValue(TableUtils.InstitueColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.InstitueColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property InstitueSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.InstitueColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property InstitueDefault() As String + Get + Return TableUtils.InstitueColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's View_PersonalEducation_.Facultry field. + ''' + Public Property Facultry() As String + Get + Return CType(Me.GetValue(TableUtils.FacultryColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.FacultryColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property FacultrySpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.FacultryColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property FacultryDefault() As String + Get + Return TableUtils.FacultryColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's View_PersonalEducation_.LevelId field. + ''' + Public Property LevelId() As Int16 + Get + Return CType(Me.GetValue(TableUtils.LevelIdColumn).ToInt16(), Int16) + End Get + Set (ByVal val As Int16) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.LevelIdColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property LevelIdSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.LevelIdColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property LevelIdDefault() As String + Get + Return TableUtils.LevelIdColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's View_PersonalEducation_.EdYear field. + ''' + Public Property EdYear() As String + Get + Return CType(Me.GetValue(TableUtils.EdYearColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.EdYearColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property EdYearSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.EdYearColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property EdYearDefault() As String + Get + Return TableUtils.EdYearColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's View_PersonalEducation_.EducationPeriod field. + ''' + Public Property EducationPeriod() As Byte + Get + Return CType(Me.GetValue(TableUtils.EducationPeriodColumn).ToByte(), Byte) + End Get + Set (ByVal val As Byte) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.EducationPeriodColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property EducationPeriodSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.EducationPeriodColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property EducationPeriodDefault() As String + Get + Return TableUtils.EducationPeriodColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's View_PersonalEducation_.EducationType field. + ''' + Public Property EducationType() As Byte + Get + Return CType(Me.GetValue(TableUtils.EducationTypeColumn).ToByte(), Byte) + End Get + Set (ByVal val As Byte) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.EducationTypeColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property EducationTypeSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.EducationTypeColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property EducationTypeDefault() As String + Get + Return TableUtils.EducationTypeColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's View_PersonalEducation_.COUNTRY field. + ''' + Public Property COUNTRY() As Int16 + Get + Return CType(Me.GetValue(TableUtils.COUNTRYColumn).ToInt16(), Int16) + End Get + Set (ByVal val As Int16) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.COUNTRYColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property COUNTRYSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.COUNTRYColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property COUNTRYDefault() As String + Get + Return TableUtils.COUNTRYColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's View_PersonalEducation_.CourseNo field. + ''' + Public Property CourseNo() As String + Get + Return CType(Me.GetValue(TableUtils.CourseNoColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.CourseNoColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property CourseNoSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.CourseNoColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property CourseNoDefault() As String + Get + Return TableUtils.CourseNoColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's View_PersonalEducation_.ScoreNo field. + ''' + Public Property ScoreNo() As String + Get + Return CType(Me.GetValue(TableUtils.ScoreNoColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.ScoreNoColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property ScoreNoSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.ScoreNoColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property ScoreNoDefault() As String + Get + Return TableUtils.ScoreNoColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's View_PersonalEducation_.NoAll field. + ''' + Public Property NoAll() As String + Get + Return CType(Me.GetValue(TableUtils.NoAllColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.NoAllColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property NoAllSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.NoAllColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property NoAllDefault() As String + Get + Return TableUtils.NoAllColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's View_PersonalEducation_.Score field. + ''' + Public Property Score() As String + Get + Return CType(Me.GetValue(TableUtils.ScoreColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.ScoreColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property ScoreSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.ScoreColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property ScoreDefault() As String + Get + Return TableUtils.ScoreColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's View_PersonalEducation_.Command field. + ''' + Public Property Command() As String + Get + Return CType(Me.GetValue(TableUtils.CommandColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.CommandColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property CommandSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.CommandColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property CommandDefault() As String + Get + Return TableUtils.CommandColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's View_PersonalEducation_.CommandDate field. + ''' + Public Property CommandDate() As DateTime + Get + Return CType(Me.GetValue(TableUtils.CommandDateColumn).ToDateTime(), DateTime) + End Get + Set (ByVal val As DateTime) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.CommandDateColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property CommandDateSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.CommandDateColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property CommandDateDefault() As String + Get + Return TableUtils.CommandDateColumn.DefaultValue + End Get + End Property + + + +#End Region + +End Class +End Namespace diff --git a/App_Code/Business Layer/BaseView_PersonalEducationView.vb b/App_Code/Business Layer/BaseView_PersonalEducationView.vb new file mode 100644 index 0000000..02ed3df --- /dev/null +++ b/App_Code/Business Layer/BaseView_PersonalEducationView.vb @@ -0,0 +1,1092 @@ +' This class is "generated" and will be overwritten. +' Your customizations should be made in View_PersonalEducationView.vb + +Imports System.Data.SqlTypes +Imports System.Data +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider +Imports Persons.Data + +Namespace Persons.Business + +''' +''' The generated superclass for the class. +''' Provides access to the schema information and record data of a database table or view named View_PersonalEducation. +''' +''' +''' The connection details (name, location, etc.) of the database and table (or view) accessed by this class +''' are resolved at runtime based on the connection string in the application's Web.Config file. +''' +''' This class is not intended to be instantiated directly. To obtain an instance of this class, use +''' View_PersonalEducationView.Instance. +''' +''' +''' + + Public Class BaseView_PersonalEducationView + Inherits KeylessTable + + + Private ReadOnly TableDefinitionString As String = View_PersonalEducationDefinition.GetXMLString() + + + + + + + + Protected Sub New() + MyBase.New() + Me.Initialize() + End Sub + + Protected Overridable Sub Initialize() + Dim def As New XmlTableDefinition(TableDefinitionString) + Me.TableDefinition = New TableDefinition() + Me.TableDefinition.TableClassName = System.Reflection.Assembly.CreateQualifiedName("App_Code", "Persons.Business.View_PersonalEducationView") + def.InitializeTableDefinition(Me.TableDefinition) + Me.ConnectionName = def.GetConnectionName() + Me.RecordClassName = System.Reflection.Assembly.CreateQualifiedName("App_Code", "Persons.Business.View_PersonalEducationRecord") + Me.ApplicationName = "App_Code" + Me.DataAdapter = New View_PersonalEducationSqlView() + Directcast(Me.DataAdapter, View_PersonalEducationSqlView).ConnectionName = Me.ConnectionName + + Me.TableDefinition.AdapterMetaData = Me.DataAdapter.AdapterMetaData + PersonalIdColumn.CodeName = "PersonalId" + RankAndNameColumn.CodeName = "RankAndName" + SectionIdColumn.CodeName = "SectionId" + SectionNameColumn.CodeName = "SectionName" + SectionAbbvrNameColumn.CodeName = "SectionAbbvrName" + ShortRankNormalColumn.CodeName = "ShortRankNormal" + StartDateColumn.CodeName = "StartDate" + EndDateColumn.CodeName = "EndDate" + CourseColumn.CodeName = "Course" + CourseAbbrColumn.CodeName = "CourseAbbr" + InstitueColumn.CodeName = "Institue" + FacultryColumn.CodeName = "Facultry" + LevelIdColumn.CodeName = "LevelId" + EdYearColumn.CodeName = "EdYear" + EducationPeriodColumn.CodeName = "EducationPeriod" + EducationTypeColumn.CodeName = "EducationType" + COUNTRYColumn.CodeName = "COUNTRY" + CourseNoColumn.CodeName = "CourseNo" + ScoreNoColumn.CodeName = "ScoreNo" + NoAllColumn.CodeName = "NoAll" + ScoreColumn.CodeName = "Score" + CommandColumn.CodeName = "Command" + CommandDateColumn.CodeName = "CommandDate" + + End Sub + +#Region "Overriden methods" + +#End Region + +#Region "Properties for columns" + + ''' + ''' This is a convenience property that provides direct access to the table's View_PersonalEducation_.PersonalId column object. + ''' + Public ReadOnly Property PersonalIdColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(0), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's View_PersonalEducation_.PersonalId column object. + ''' + Public Shared ReadOnly Property PersonalId() As BaseClasses.Data.StringColumn + Get + Return View_PersonalEducationView.Instance.PersonalIdColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's View_PersonalEducation_.RankAndName column object. + ''' + Public ReadOnly Property RankAndNameColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(1), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's View_PersonalEducation_.RankAndName column object. + ''' + Public Shared ReadOnly Property RankAndName() As BaseClasses.Data.StringColumn + Get + Return View_PersonalEducationView.Instance.RankAndNameColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's View_PersonalEducation_.SectionId column object. + ''' + Public ReadOnly Property SectionIdColumn() As BaseClasses.Data.NumberColumn + Get + Return CType(Me.TableDefinition.ColumnList(2), BaseClasses.Data.NumberColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's View_PersonalEducation_.SectionId column object. + ''' + Public Shared ReadOnly Property SectionId() As BaseClasses.Data.NumberColumn + Get + Return View_PersonalEducationView.Instance.SectionIdColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's View_PersonalEducation_.SectionName column object. + ''' + Public ReadOnly Property SectionNameColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(3), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's View_PersonalEducation_.SectionName column object. + ''' + Public Shared ReadOnly Property SectionName() As BaseClasses.Data.StringColumn + Get + Return View_PersonalEducationView.Instance.SectionNameColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's View_PersonalEducation_.SectionAbbvrName column object. + ''' + Public ReadOnly Property SectionAbbvrNameColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(4), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's View_PersonalEducation_.SectionAbbvrName column object. + ''' + Public Shared ReadOnly Property SectionAbbvrName() As BaseClasses.Data.StringColumn + Get + Return View_PersonalEducationView.Instance.SectionAbbvrNameColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's View_PersonalEducation_.ShortRankNormal column object. + ''' + Public ReadOnly Property ShortRankNormalColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(5), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's View_PersonalEducation_.ShortRankNormal column object. + ''' + Public Shared ReadOnly Property ShortRankNormal() As BaseClasses.Data.StringColumn + Get + Return View_PersonalEducationView.Instance.ShortRankNormalColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's View_PersonalEducation_.StartDate column object. + ''' + Public ReadOnly Property StartDateColumn() As BaseClasses.Data.DateColumn + Get + Return CType(Me.TableDefinition.ColumnList(6), BaseClasses.Data.DateColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's View_PersonalEducation_.StartDate column object. + ''' + Public Shared ReadOnly Property StartDate() As BaseClasses.Data.DateColumn + Get + Return View_PersonalEducationView.Instance.StartDateColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's View_PersonalEducation_.EndDate column object. + ''' + Public ReadOnly Property EndDateColumn() As BaseClasses.Data.DateColumn + Get + Return CType(Me.TableDefinition.ColumnList(7), BaseClasses.Data.DateColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's View_PersonalEducation_.EndDate column object. + ''' + Public Shared ReadOnly Property EndDate() As BaseClasses.Data.DateColumn + Get + Return View_PersonalEducationView.Instance.EndDateColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's View_PersonalEducation_.Course column object. + ''' + Public ReadOnly Property CourseColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(8), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's View_PersonalEducation_.Course column object. + ''' + Public Shared ReadOnly Property Course() As BaseClasses.Data.StringColumn + Get + Return View_PersonalEducationView.Instance.CourseColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's View_PersonalEducation_.CourseAbbr column object. + ''' + Public ReadOnly Property CourseAbbrColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(9), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's View_PersonalEducation_.CourseAbbr column object. + ''' + Public Shared ReadOnly Property CourseAbbr() As BaseClasses.Data.StringColumn + Get + Return View_PersonalEducationView.Instance.CourseAbbrColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's View_PersonalEducation_.Institue column object. + ''' + Public ReadOnly Property InstitueColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(10), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's View_PersonalEducation_.Institue column object. + ''' + Public Shared ReadOnly Property Institue() As BaseClasses.Data.StringColumn + Get + Return View_PersonalEducationView.Instance.InstitueColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's View_PersonalEducation_.Facultry column object. + ''' + Public ReadOnly Property FacultryColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(11), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's View_PersonalEducation_.Facultry column object. + ''' + Public Shared ReadOnly Property Facultry() As BaseClasses.Data.StringColumn + Get + Return View_PersonalEducationView.Instance.FacultryColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's View_PersonalEducation_.LevelId column object. + ''' + Public ReadOnly Property LevelIdColumn() As BaseClasses.Data.NumberColumn + Get + Return CType(Me.TableDefinition.ColumnList(12), BaseClasses.Data.NumberColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's View_PersonalEducation_.LevelId column object. + ''' + Public Shared ReadOnly Property LevelId() As BaseClasses.Data.NumberColumn + Get + Return View_PersonalEducationView.Instance.LevelIdColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's View_PersonalEducation_.EdYear column object. + ''' + Public ReadOnly Property EdYearColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(13), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's View_PersonalEducation_.EdYear column object. + ''' + Public Shared ReadOnly Property EdYear() As BaseClasses.Data.StringColumn + Get + Return View_PersonalEducationView.Instance.EdYearColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's View_PersonalEducation_.EducationPeriod column object. + ''' + Public ReadOnly Property EducationPeriodColumn() As BaseClasses.Data.NumberColumn + Get + Return CType(Me.TableDefinition.ColumnList(14), BaseClasses.Data.NumberColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's View_PersonalEducation_.EducationPeriod column object. + ''' + Public Shared ReadOnly Property EducationPeriod() As BaseClasses.Data.NumberColumn + Get + Return View_PersonalEducationView.Instance.EducationPeriodColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's View_PersonalEducation_.EducationType column object. + ''' + Public ReadOnly Property EducationTypeColumn() As BaseClasses.Data.NumberColumn + Get + Return CType(Me.TableDefinition.ColumnList(15), BaseClasses.Data.NumberColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's View_PersonalEducation_.EducationType column object. + ''' + Public Shared ReadOnly Property EducationType() As BaseClasses.Data.NumberColumn + Get + Return View_PersonalEducationView.Instance.EducationTypeColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's View_PersonalEducation_.COUNTRY column object. + ''' + Public ReadOnly Property COUNTRYColumn() As BaseClasses.Data.NumberColumn + Get + Return CType(Me.TableDefinition.ColumnList(16), BaseClasses.Data.NumberColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's View_PersonalEducation_.COUNTRY column object. + ''' + Public Shared ReadOnly Property COUNTRY() As BaseClasses.Data.NumberColumn + Get + Return View_PersonalEducationView.Instance.COUNTRYColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's View_PersonalEducation_.CourseNo column object. + ''' + Public ReadOnly Property CourseNoColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(17), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's View_PersonalEducation_.CourseNo column object. + ''' + Public Shared ReadOnly Property CourseNo() As BaseClasses.Data.StringColumn + Get + Return View_PersonalEducationView.Instance.CourseNoColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's View_PersonalEducation_.ScoreNo column object. + ''' + Public ReadOnly Property ScoreNoColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(18), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's View_PersonalEducation_.ScoreNo column object. + ''' + Public Shared ReadOnly Property ScoreNo() As BaseClasses.Data.StringColumn + Get + Return View_PersonalEducationView.Instance.ScoreNoColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's View_PersonalEducation_.NoAll column object. + ''' + Public ReadOnly Property NoAllColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(19), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's View_PersonalEducation_.NoAll column object. + ''' + Public Shared ReadOnly Property NoAll() As BaseClasses.Data.StringColumn + Get + Return View_PersonalEducationView.Instance.NoAllColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's View_PersonalEducation_.Score column object. + ''' + Public ReadOnly Property ScoreColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(20), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's View_PersonalEducation_.Score column object. + ''' + Public Shared ReadOnly Property Score() As BaseClasses.Data.StringColumn + Get + Return View_PersonalEducationView.Instance.ScoreColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's View_PersonalEducation_.Command column object. + ''' + Public ReadOnly Property CommandColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(21), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's View_PersonalEducation_.Command column object. + ''' + Public Shared ReadOnly Property Command() As BaseClasses.Data.StringColumn + Get + Return View_PersonalEducationView.Instance.CommandColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's View_PersonalEducation_.CommandDate column object. + ''' + Public ReadOnly Property CommandDateColumn() As BaseClasses.Data.DateColumn + Get + Return CType(Me.TableDefinition.ColumnList(22), BaseClasses.Data.DateColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's View_PersonalEducation_.CommandDate column object. + ''' + Public Shared ReadOnly Property CommandDate() As BaseClasses.Data.DateColumn + Get + Return View_PersonalEducationView.Instance.CommandDateColumn + End Get + End Property + + +#End Region + +#Region "Shared helper methods" + + ''' + ''' This is a shared function that can be used to get an array of View_PersonalEducationRecord records using a where clause. + ''' + Public Shared Function GetRecords(ByVal where As String) As View_PersonalEducationRecord() + + Return GetRecords(where, Nothing, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) + End Function + + ''' + ''' This is a shared function that can be used to get an array of View_PersonalEducationRecord records using a where clause. + ''' + Public Shared Function GetRecords(ByVal join As BaseFilter, ByVal where As String) As View_PersonalEducationRecord() + + Return GetRecords(join, where, Nothing, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) + End Function + + ''' + ''' This is a shared function that can be used to get an array of View_PersonalEducationRecord records using a where and order by clause. + ''' + Public Shared Function GetRecords( _ + ByVal where As String, _ + ByVal orderBy As OrderBy) As View_PersonalEducationRecord() + + Return GetRecords(where, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) + End Function + + ''' + ''' This is a shared function that can be used to get an array of View_PersonalEducationRecord records using a where and order by clause. + ''' + Public Shared Function GetRecords( _ + ByVal join As BaseFilter, _ + ByVal where As String, _ + ByVal orderBy As OrderBy) As View_PersonalEducationRecord() + + Return GetRecords(join, where, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) + End Function + + ''' + ''' This is a shared function that can be used to get an array of View_PersonalEducationRecord records using a where and order by clause clause with pagination. + ''' + Public Shared Function GetRecords( _ + ByVal where As String, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As View_PersonalEducationRecord() + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + Dim join As BaseClasses.Data.BaseFilter = Nothing + Dim recList As ArrayList = View_PersonalEducationView.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, pageIndex, pageSize) + + Return CType(recList.ToArray(GetType(Persons.Business.View_PersonalEducationRecord)), View_PersonalEducationRecord()) + End Function + + ''' + ''' This is a shared function that can be used to get an array of View_PersonalEducationRecord records using a where and order by clause clause with pagination. + ''' + Public Shared Function GetRecords( _ + ByVal join As BaseFilter, _ + ByVal where As String, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As View_PersonalEducationRecord() + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Dim recList As ArrayList = View_PersonalEducationView.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, pageIndex, pageSize) + + Return CType(recList.ToArray(GetType(Persons.Business.View_PersonalEducationRecord)), View_PersonalEducationRecord()) + End Function + + Public Shared Function GetRecords( _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As View_PersonalEducationRecord() + Dim join As BaseClasses.Data.BaseFilter = Nothing + Dim recList As ArrayList = View_PersonalEducationView.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + Return CType(recList.ToArray(GetType(Persons.Business.View_PersonalEducationRecord)), View_PersonalEducationRecord()) + End Function + + Public Shared Function GetRecords( _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As View_PersonalEducationRecord() + + Dim recList As ArrayList = View_PersonalEducationView.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + Return CType(recList.ToArray(GetType(Persons.Business.View_PersonalEducationRecord)), View_PersonalEducationRecord()) + End Function + + Public Shared Function GetRecords( _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer, _ + ByRef totalRecords As Integer) As View_PersonalEducationRecord() + Dim join As BaseClasses.Data.BaseFilter = Nothing + Dim recList As ArrayList = View_PersonalEducationView.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize, totalRecords) + + Return CType(recList.ToArray(GetType(Persons.Business.View_PersonalEducationRecord)), View_PersonalEducationRecord()) + End Function + + Public Shared Function GetRecords( _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer, _ + ByRef totalRecords As Integer) As View_PersonalEducationRecord() + + Dim recList As ArrayList = View_PersonalEducationView.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize, totalRecords) + + Return CType(recList.ToArray(GetType(Persons.Business.View_PersonalEducationRecord)), View_PersonalEducationRecord()) + End Function + + ''' + ''' This is a shared function that can be used to get total number of records that will be returned using the where clause. + ''' + Public Shared Function GetRecordCount(ByVal where As String) As Integer + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Return CInt(View_PersonalEducationView.Instance.GetRecordListCount(Nothing, whereFilter, Nothing, Nothing)) + End Function + +''' + ''' This is a shared function that can be used to get total number of records that will be returned using the where clause. + ''' + Public Shared Function GetRecordCount(ByVal join As BaseFilter, ByVal where As String) As Integer + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Return CInt(View_PersonalEducationView.Instance.GetRecordListCount(join, whereFilter, Nothing, Nothing)) + End Function + + Public Shared Function GetRecordCount(ByVal where As WhereClause) As Integer + Return CInt(View_PersonalEducationView.Instance.GetRecordListCount(Nothing, where.GetFilter(), Nothing, Nothing)) + End Function + + Public Shared Function GetRecordCount(ByVal join As BaseFilter, ByVal where As WhereClause) As Integer + Return CInt(View_PersonalEducationView.Instance.GetRecordListCount(join, where.GetFilter(), Nothing, Nothing)) + End Function + + ''' + ''' This is a shared function that can be used to get a View_PersonalEducationRecord record using a where clause. + ''' + Public Shared Function GetRecord(ByVal where As String) As View_PersonalEducationRecord + Dim orderBy As OrderBy = Nothing + Return GetRecord(where, orderBy) + End Function + + ''' + ''' This is a shared function that can be used to get a View_PersonalEducationRecord record using a where clause. + ''' + Public Shared Function GetRecord(ByVal join As BaseFilter, ByVal where As String) As View_PersonalEducationRecord + Dim orderBy As OrderBy = Nothing + Return GetRecord(join, where, orderBy) + End Function + + ''' + ''' This is a shared function that can be used to get a View_PersonalEducationRecord record using a where and order by clause. + ''' + Public Shared Function GetRecord( _ + ByVal where As String, _ + ByVal orderBy As OrderBy) As View_PersonalEducationRecord + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + Dim join As BaseClasses.Data.BaseFilter = Nothing + Dim recList As ArrayList = View_PersonalEducationView.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MIN_BATCH_SIZE) + + Dim rec As View_PersonalEducationRecord = Nothing + If recList.Count > 0 Then + rec = CType(recList(0), View_PersonalEducationRecord) + End If + + Return rec + End Function + + ''' + ''' This is a shared function that can be used to get a View_PersonalEducationRecord record using a where and order by clause. + ''' + Public Shared Function GetRecord( _ + ByVal join As BaseFilter, _ + ByVal where As String, _ + ByVal orderBy As OrderBy) As View_PersonalEducationRecord + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Dim recList As ArrayList = View_PersonalEducationView.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MIN_BATCH_SIZE) + + Dim rec As View_PersonalEducationRecord = Nothing + If recList.Count > 0 Then + rec = CType(recList(0), View_PersonalEducationRecord) + End If + + Return rec + End Function + + + Public Shared Function GetValues( _ + ByVal col As BaseColumn, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal maxItems As Integer) As String() + + ' Create the filter list. + Dim retCol As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, True) + retCol.AddColumn(col) + + Return View_PersonalEducationView.Instance.GetColumnValues(retCol, Nothing, where.GetFilter(), Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, maxItems) + + End Function + + Public Shared Function GetValues( _ + ByVal col As BaseColumn, _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal maxItems As Integer) As String() + + ' Create the filter list. + Dim retCol As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, True) + retCol.AddColumn(col) + + Return View_PersonalEducationView.Instance.GetColumnValues(retCol, join, where.GetFilter(), Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, maxItems) + + End Function + + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where clause. + ''' + Public Shared Function GetDataTable(ByVal where As String) As System.Data.DataTable + + Dim recs() As View_PersonalEducationRecord = GetRecords(where) + Return View_PersonalEducationView.Instance.CreateDataTable(recs, Nothing) + End Function + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where clause. + ''' + Public Shared Function GetDataTable(ByVal join As BaseFilter, ByVal where As String) As System.Data.DataTable + + Dim recs() As View_PersonalEducationRecord = GetRecords(join, where) + Return View_PersonalEducationView.Instance.CreateDataTable(recs, Nothing) + End Function + + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause. + ''' + Public Shared Function GetDataTable(ByVal where As String, ByVal orderBy As OrderBy) As System.Data.DataTable + + Dim recs() As View_PersonalEducationRecord = GetRecords(where, orderBy) + Return View_PersonalEducationView.Instance.CreateDataTable(recs, Nothing) + End Function + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause. + ''' + Public Shared Function GetDataTable(ByVal join As BaseFilter, ByVal where As String, ByVal orderBy As OrderBy) As System.Data.DataTable + + Dim recs() As View_PersonalEducationRecord = GetRecords(join, where, orderBy) + Return View_PersonalEducationView.Instance.CreateDataTable(recs, Nothing) + End Function + + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause with pagination. + ''' + Public Shared Function GetDataTable( _ + ByVal where As String, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As System.Data.DataTable + + Dim recs() As View_PersonalEducationRecord = GetRecords(where, orderBy, pageIndex, pageSize) + Return View_PersonalEducationView.Instance.CreateDataTable(recs, Nothing) + End Function + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause with pagination. + ''' + Public Shared Function GetDataTable( _ + ByVal join As BaseFilter, _ + ByVal where As String, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As System.Data.DataTable + + Dim recs() As View_PersonalEducationRecord = GetRecords(join, where, orderBy, pageIndex, pageSize) + Return View_PersonalEducationView.Instance.CreateDataTable(recs, Nothing) + End Function + + + ''' + ''' This is a shared function that can be used to delete records using a where clause. + ''' + Public Shared Sub DeleteRecords(ByVal where As String) + If where = Nothing OrElse where.Trim() = "" Then + Return + End If + + Dim whereFilter As SqlFilter = New SqlFilter(where) + View_PersonalEducationView.Instance.DeleteRecordList(whereFilter) + End Sub + + ''' + ''' This is a shared function that can be used to export records using a where clause. + ''' + Public Shared Function Export(ByVal where As String) As String + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Return View_PersonalEducationView.Instance.ExportRecordData(whereFilter) + End Function + + Public Shared Function Export(ByVal where As WhereClause) As String + Dim whereFilter As BaseFilter = Nothing + If Not where Is Nothing Then + whereFilter = where.GetFilter() + End If + + Return View_PersonalEducationView.Instance.ExportRecordData(whereFilter) + End Function + + Public Shared Function GetSum( _ + ByVal col As BaseColumn, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) _ + As String + + Dim colSel As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, False) + colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Sum) + + Return View_PersonalEducationView.Instance.GetColumnStatistics(colSel, Nothing, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + End Function + + Public Shared Function GetSum( _ + ByVal col As BaseColumn, _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) _ + As String + + Dim colSel As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, False) + colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Sum) + + Return View_PersonalEducationView.Instance.GetColumnStatistics(colSel, join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + End Function + + + Public Shared Function GetCount( _ + ByVal col As BaseColumn, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) _ + As String + + Dim colSel As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, False) + colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Count) + + Return View_PersonalEducationView.Instance.GetColumnStatistics(colSel, Nothing, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + End Function + + Public Shared Function GetCount( _ + ByVal col As BaseColumn, _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) _ + As String + + Dim colSel As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, False) + colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Count) + + Return View_PersonalEducationView.Instance.GetColumnStatistics(colSel, join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + End Function + + ''' + ''' This method returns the columns in the table. + ''' + Public Shared Function GetColumns() As BaseColumn() + Return View_PersonalEducationView.Instance.TableDefinition.Columns + End Function + + ''' + ''' This method returns the columnlist in the table. + ''' + Public Shared Function GetColumnList() As ColumnList + Return View_PersonalEducationView.Instance.TableDefinition.ColumnList + End Function + + + ''' + ''' This method creates a new record and returns it to be edited. + ''' + Public Shared Function CreateNewRecord() As IRecord + Return View_PersonalEducationView.Instance.CreateRecord() + End Function + + ''' + ''' This method creates a new record and returns it to be edited. + ''' + ''' ID of the new record. + Public Shared Function CreateNewRecord(ByVal tempId As String) As IRecord + Return View_PersonalEducationView.Instance.CreateRecord(tempId) + End Function + + ''' + ''' This method checks if column is editable. + ''' + ''' Name of the column to check. + Public Shared Function isReadOnlyColumn(ByVal columnName As String) As Boolean + Dim column As BaseColumn = GetColumn(columnName) + If (Not IsNothing(column)) Then + Return column.IsValuesReadOnly + Else + Return True + End If + End Function + + ''' + ''' This method gets the specified column. + ''' + ''' Unique name of the column to fetch. + Public Shared Function GetColumn(ByVal uniqueColumnName As String) As BaseColumn + Dim column As BaseColumn = View_PersonalEducationView.Instance.TableDefinition.ColumnList.GetByUniqueName(uniqueColumnName) + Return column + End Function + + ''' + ''' This method takes a record and a Column and returns an evaluated value of DFKA formula. + ''' + Public Shared Function GetDFKA(ByVal rec As BaseRecord, ByVal col As BaseColumn) As String + Dim fkColumn As ForeignKey = View_PersonalEducationView.Instance.TableDefinition.GetExpandableNonCompositeForeignKey(col) + If fkColumn Is Nothing Then + Return Nothing + End If + Dim _DFKA As String = fkColumn.PrimaryKeyDisplayColumns + If (_DFKA.Trim().StartsWith("=")) Then + ' if the formula is in the format of "= ., then pull out the data from the rec object instead of doing formula evaluation + Dim tableCodeName As String = fkColumn.PrimaryKeyTableDefinition.TableCodeName + Dim column As String = _DFKA.Trim("="c).Trim() + If column.StartsWith(tableCodeName & ".", StringComparison.InvariantCultureIgnoreCase) Then + column = column.Substring(tableCodeName.Length + 1) + End If + + For Each c As BaseColumn In fkColumn.PrimaryKeyTableDefinition.Columns + If column = c.CodeName Then + Return rec.Format(c) + End If + Next + Dim tableName As String = fkColumn.PrimaryKeyTableDefinition.TableCodeName + Return EvaluateFormula(_DFKA, rec, Nothing, tableName) + Else + Return Nothing + End If + End Function + + ''' + ''' This method takes a keyValue and a Column and returns an evaluated value of DFKA formula. + ''' + Public Shared Function GetDFKA(ByVal keyValue As String, ByVal col As BaseColumn, ByVal formatPattern as String) As String + If keyValue Is Nothing Then + Return Nothing + End If + Dim fkColumn As ForeignKey = View_PersonalEducationView.Instance.TableDefinition.GetExpandableNonCompositeForeignKey(col) + If fkColumn Is Nothing Then + Return Nothing + End If + Dim _DFKA As String = fkColumn.PrimaryKeyDisplayColumns + If (_DFKA.Trim().StartsWith("=")) Then + Dim tableName As String = fkColumn.PrimaryKeyTableDefinition.TableCodeName + Dim t As PrimaryKeyTable = CType(DatabaseObjects.GetTableObject(tableName), PrimaryKeyTable) + Dim rec As BaseRecord = Nothing + If Not t Is Nothing Then + Try + rec = CType(t.GetRecordData(keyValue, False), BaseRecord) + Catch + rec = Nothing + End Try + End If + If rec Is Nothing Then + Return "" + End If + + ' if the formula is in the format of "= ., then pull out the data from the rec object instead of doing formula evaluation + Dim tableCodeName As String = fkColumn.PrimaryKeyTableDefinition.TableCodeName + Dim column As String = _DFKA.Trim("="c).Trim() + If column.StartsWith(tableCodeName & ".", StringComparison.InvariantCultureIgnoreCase) Then + column = column.Substring(tableCodeName.Length + 1) + End If + + For Each c As BaseColumn In fkColumn.PrimaryKeyTableDefinition.Columns + If column = c.CodeName Then + Return rec.Format(c) + End If + Next + Return EvaluateFormula(_DFKA, rec, Nothing, tableName) + Else + Return Nothing + End If + End Function + + ''' + ''' Evaluates the formula + ''' + Public Shared Function EvaluateFormula(ByVal formula As String, Optional ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord = Nothing, Optional ByVal format As String = Nothing, Optional ByVal name As String = "") As String + Dim e As BaseFormulaEvaluator = New BaseFormulaEvaluator() + If Not dataSourceForEvaluate Is Nothing Then + e.Evaluator.Variables.Add(name, dataSourceForEvaluate) + end if + e.DataSource = dataSourceForEvaluate + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + If Not String.IsNullOrEmpty(format) Then + Return BaseFormulaUtils.Format(resultObj, format) + Else + Return resultObj.ToString() + End If + End Function +#End Region + +End Class +End Namespace diff --git a/App_Code/Business Layer/BaseView_PersonsRecord.vb b/App_Code/Business Layer/BaseView_PersonsRecord.vb new file mode 100644 index 0000000..a2bf781 --- /dev/null +++ b/App_Code/Business Layer/BaseView_PersonsRecord.vb @@ -0,0 +1,1910 @@ +' This class is "generated" and will be overwritten. +' Your customizations should be made in View_PersonsRecord.vb + +Imports System.Data.SqlTypes +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + +Namespace Persons.Business + +''' +''' The generated superclass for the class. +''' +''' +''' This class is not intended to be instantiated directly. To obtain an instance of this class, +''' use the methods of the class. +''' +''' +''' + + Public Class BaseView_PersonsRecord + Inherits PrimaryKeyRecord + + + Public Shared Shadows ReadOnly TableUtils As View_PersonsView = View_PersonsView.Instance + + ' Constructors + + Protected Sub New() + MyBase.New(TableUtils) + End Sub + + Protected Sub New(ByVal record As PrimaryKeyRecord) + MyBase.New(record, TableUtils) + End Sub + + 'Evaluates Initialize when->Inserting record formulas specified at the data access layer + Public Overridable Sub View_PersonsRecord_InsertingRecord(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles Me.InsertingRecord + 'Apply Initialize->Inserting record formula only if validation is successful. + Dim View_PersonsRec As View_PersonsRecord = CType(sender,View_PersonsRecord) + Validate_Inserting() + If Not View_PersonsRec Is Nothing AndAlso Not View_PersonsRec.IsReadOnly Then + End If + End Sub + + 'Evaluates Initialize when->Updating record formulas specified at the data access layer + Public Overridable Sub View_PersonsRecord_UpdatingRecord(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles Me.UpdatingRecord + 'Apply Initialize->Updating record formula only if validation is successful. + Dim View_PersonsRec As View_PersonsRecord = CType(sender,View_PersonsRecord) + Validate_Updating() + If Not View_PersonsRec Is Nothing AndAlso Not View_PersonsRec.IsReadOnly Then + End If + End Sub + + 'Evaluates Initialize when->Reading record formulas specified at the data access layer + Public Overridable Sub View_PersonsRecord_ReadRecord(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.ReadRecord + 'Apply Initialize->Reading record formula only if validation is successful. + Dim View_PersonsRec As View_PersonsRecord = CType(sender,View_PersonsRecord) + If Not View_PersonsRec Is Nothing AndAlso Not View_PersonsRec.IsReadOnly Then + End If + End Sub + + 'Evaluates Validate when->Inserting formulas specified at the data access layer + Public Overridable Sub Validate_Inserting () + Dim fullValidationMessage As String = "" + Dim validationMessage As String = "" + + dim formula as String = "" + + + If validationMessage <> "" AndAlso validationMessage.ToLower() <> "true" Then + fullValidationMessage &= validationMessage & vbCrLf + End If + + If fullValidationMessage <> "" Then + Throw New Exception(fullValidationMessage) + End If + End Sub + + 'Evaluates Validate when->Updating formulas specified at the data access layer + Public Overridable Sub Validate_Updating () + Dim fullValidationMessage As String = "" + Dim validationMessage As String = "" + + dim formula as String = "" + + + If validationMessage <> "" AndAlso validationMessage.ToLower() <> "true" Then + fullValidationMessage &= validationMessage & vbCrLf + End If + + If fullValidationMessage <> "" Then + Throw New Exception(fullValidationMessage) + End If + End Sub + + Public Overridable Function EvaluateFormula(ByVal formula As String, Optional ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord = Nothing, Optional ByVal format As String = Nothing) As String + + Dim e As Data.BaseFormulaEvaluator = New Data.BaseFormulaEvaluator() + + ' All variables referred to in the formula are expected to be + ' properties of the DataSource. For example, referring to + ' UnitPrice as a variable will refer to DataSource.UnitPrice + e.DataSource = dataSourceForEvaluate + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + Return resultObj.ToString() + End Function + + + + + + + +#Region "Convenience methods to get/set values of fields" + + ''' + ''' This is a convenience method that provides direct access to the value of the record's View_Persons_.PersonalId field. + ''' + Public Function GetPersonalIdValue() As ColumnValue + Return Me.GetValue(TableUtils.PersonalIdColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's View_Persons_.PersonalId field. + ''' + Public Function GetPersonalIdFieldValue() As String + Return CType(Me.GetValue(TableUtils.PersonalIdColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_Persons_.PersonalId field. + ''' + Public Sub SetPersonalIdFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.PersonalIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_Persons_.PersonalId field. + ''' + Public Sub SetPersonalIdFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.PersonalIdColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's View_Persons_.ArmyId field. + ''' + Public Function GetArmyIdValue() As ColumnValue + Return Me.GetValue(TableUtils.ArmyIdColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's View_Persons_.ArmyId field. + ''' + Public Function GetArmyIdFieldValue() As Byte + Return CType(Me.GetValue(TableUtils.ArmyIdColumn).ToByte(), Byte) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_Persons_.ArmyId field. + ''' + Public Sub SetArmyIdFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.ArmyIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_Persons_.ArmyId field. + ''' + Public Sub SetArmyIdFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.ArmyIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_Persons_.ArmyId field. + ''' + Public Sub SetArmyIdFieldValue(ByVal val As Double) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.ArmyIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_Persons_.ArmyId field. + ''' + Public Sub SetArmyIdFieldValue(ByVal val As Decimal) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.ArmyIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_Persons_.ArmyId field. + ''' + Public Sub SetArmyIdFieldValue(ByVal val As Int64) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.ArmyIdColumn) + End Sub + ''' + ''' This is a convenience method that provides direct access to the value of the record's View_Persons_.ArmSName field. + ''' + Public Function GetArmSNameValue() As ColumnValue + Return Me.GetValue(TableUtils.ArmSNameColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's View_Persons_.ArmSName field. + ''' + Public Function GetArmSNameFieldValue() As String + Return CType(Me.GetValue(TableUtils.ArmSNameColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_Persons_.ArmSName field. + ''' + Public Sub SetArmSNameFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.ArmSNameColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_Persons_.ArmSName field. + ''' + Public Sub SetArmSNameFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.ArmSNameColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's View_Persons_.SectionId field. + ''' + Public Function GetSectionIdValue() As ColumnValue + Return Me.GetValue(TableUtils.SectionIdColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's View_Persons_.SectionId field. + ''' + Public Function GetSectionIdFieldValue() As Int16 + Return CType(Me.GetValue(TableUtils.SectionIdColumn).ToInt16(), Int16) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_Persons_.SectionId field. + ''' + Public Sub SetSectionIdFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.SectionIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_Persons_.SectionId field. + ''' + Public Sub SetSectionIdFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.SectionIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_Persons_.SectionId field. + ''' + Public Sub SetSectionIdFieldValue(ByVal val As Double) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.SectionIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_Persons_.SectionId field. + ''' + Public Sub SetSectionIdFieldValue(ByVal val As Decimal) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.SectionIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_Persons_.SectionId field. + ''' + Public Sub SetSectionIdFieldValue(ByVal val As Int64) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.SectionIdColumn) + End Sub + ''' + ''' This is a convenience method that provides direct access to the value of the record's View_Persons_.SectionAbbvrName field. + ''' + Public Function GetSectionAbbvrNameValue() As ColumnValue + Return Me.GetValue(TableUtils.SectionAbbvrNameColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's View_Persons_.SectionAbbvrName field. + ''' + Public Function GetSectionAbbvrNameFieldValue() As String + Return CType(Me.GetValue(TableUtils.SectionAbbvrNameColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_Persons_.SectionAbbvrName field. + ''' + Public Sub SetSectionAbbvrNameFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.SectionAbbvrNameColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_Persons_.SectionAbbvrName field. + ''' + Public Sub SetSectionAbbvrNameFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.SectionAbbvrNameColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's View_Persons_.DeptId field. + ''' + Public Function GetDeptIdValue() As ColumnValue + Return Me.GetValue(TableUtils.DeptIdColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's View_Persons_.DeptId field. + ''' + Public Function GetDeptIdFieldValue() As Int16 + Return CType(Me.GetValue(TableUtils.DeptIdColumn).ToInt16(), Int16) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_Persons_.DeptId field. + ''' + Public Sub SetDeptIdFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.DeptIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_Persons_.DeptId field. + ''' + Public Sub SetDeptIdFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.DeptIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_Persons_.DeptId field. + ''' + Public Sub SetDeptIdFieldValue(ByVal val As Double) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.DeptIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_Persons_.DeptId field. + ''' + Public Sub SetDeptIdFieldValue(ByVal val As Decimal) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.DeptIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_Persons_.DeptId field. + ''' + Public Sub SetDeptIdFieldValue(ByVal val As Int64) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.DeptIdColumn) + End Sub + ''' + ''' This is a convenience method that provides direct access to the value of the record's View_Persons_.DeptAbbvr field. + ''' + Public Function GetDeptAbbvrValue() As ColumnValue + Return Me.GetValue(TableUtils.DeptAbbvrColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's View_Persons_.DeptAbbvr field. + ''' + Public Function GetDeptAbbvrFieldValue() As String + Return CType(Me.GetValue(TableUtils.DeptAbbvrColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_Persons_.DeptAbbvr field. + ''' + Public Sub SetDeptAbbvrFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.DeptAbbvrColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_Persons_.DeptAbbvr field. + ''' + Public Sub SetDeptAbbvrFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.DeptAbbvrColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's View_Persons_.RankId field. + ''' + Public Function GetRankIdValue() As ColumnValue + Return Me.GetValue(TableUtils.RankIdColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's View_Persons_.RankId field. + ''' + Public Function GetRankIdFieldValue() As Int32 + Return CType(Me.GetValue(TableUtils.RankIdColumn).ToInt32(), Int32) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_Persons_.RankId field. + ''' + Public Sub SetRankIdFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.RankIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_Persons_.RankId field. + ''' + Public Sub SetRankIdFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.RankIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_Persons_.RankId field. + ''' + Public Sub SetRankIdFieldValue(ByVal val As Double) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.RankIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_Persons_.RankId field. + ''' + Public Sub SetRankIdFieldValue(ByVal val As Decimal) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.RankIdColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_Persons_.RankId field. + ''' + Public Sub SetRankIdFieldValue(ByVal val As Int64) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.RankIdColumn) + End Sub + ''' + ''' This is a convenience method that provides direct access to the value of the record's View_Persons_.PersonalName field. + ''' + Public Function GetPersonalNameValue() As ColumnValue + Return Me.GetValue(TableUtils.PersonalNameColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's View_Persons_.PersonalName field. + ''' + Public Function GetPersonalNameFieldValue() As String + Return CType(Me.GetValue(TableUtils.PersonalNameColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_Persons_.PersonalName field. + ''' + Public Sub SetPersonalNameFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.PersonalNameColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_Persons_.PersonalName field. + ''' + Public Sub SetPersonalNameFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.PersonalNameColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's View_Persons_.PersonalLastName field. + ''' + Public Function GetPersonalLastNameValue() As ColumnValue + Return Me.GetValue(TableUtils.PersonalLastNameColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's View_Persons_.PersonalLastName field. + ''' + Public Function GetPersonalLastNameFieldValue() As String + Return CType(Me.GetValue(TableUtils.PersonalLastNameColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_Persons_.PersonalLastName field. + ''' + Public Sub SetPersonalLastNameFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.PersonalLastNameColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_Persons_.PersonalLastName field. + ''' + Public Sub SetPersonalLastNameFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.PersonalLastNameColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's View_Persons_.BirthDate field. + ''' + Public Function GetBirthDateValue() As ColumnValue + Return Me.GetValue(TableUtils.BirthDateColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's View_Persons_.BirthDate field. + ''' + Public Function GetBirthDateFieldValue() As DateTime + Return CType(Me.GetValue(TableUtils.BirthDateColumn).ToDateTime(), DateTime) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_Persons_.BirthDate field. + ''' + Public Sub SetBirthDateFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.BirthDateColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_Persons_.BirthDate field. + ''' + Public Sub SetBirthDateFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.BirthDateColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_Persons_.BirthDate field. + ''' + Public Sub SetBirthDateFieldValue(ByVal val As DateTime) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.BirthDateColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's View_Persons_.Retire field. + ''' + Public Function GetRetireValue() As ColumnValue + Return Me.GetValue(TableUtils.RetireColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's View_Persons_.Retire field. + ''' + Public Function GetRetireFieldValue() As String + Return CType(Me.GetValue(TableUtils.RetireColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_Persons_.Retire field. + ''' + Public Sub SetRetireFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.RetireColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_Persons_.Retire field. + ''' + Public Sub SetRetireFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.RetireColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's View_Persons_.Commission field. + ''' + Public Function GetCommissionValue() As ColumnValue + Return Me.GetValue(TableUtils.CommissionColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's View_Persons_.Commission field. + ''' + Public Function GetCommissionFieldValue() As String + Return CType(Me.GetValue(TableUtils.CommissionColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_Persons_.Commission field. + ''' + Public Sub SetCommissionFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.CommissionColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_Persons_.Commission field. + ''' + Public Sub SetCommissionFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.CommissionColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's View_Persons_.Born field. + ''' + Public Function GetBornValue() As ColumnValue + Return Me.GetValue(TableUtils.BornColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's View_Persons_.Born field. + ''' + Public Function GetBornFieldValue() As String + Return CType(Me.GetValue(TableUtils.BornColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_Persons_.Born field. + ''' + Public Sub SetBornFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.BornColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_Persons_.Born field. + ''' + Public Sub SetBornFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.BornColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's View_Persons_.DateRank field. + ''' + Public Function GetDateRankValue() As ColumnValue + Return Me.GetValue(TableUtils.DateRankColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's View_Persons_.DateRank field. + ''' + Public Function GetDateRankFieldValue() As DateTime + Return CType(Me.GetValue(TableUtils.DateRankColumn).ToDateTime(), DateTime) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_Persons_.DateRank field. + ''' + Public Sub SetDateRankFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.DateRankColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_Persons_.DateRank field. + ''' + Public Sub SetDateRankFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.DateRankColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_Persons_.DateRank field. + ''' + Public Sub SetDateRankFieldValue(ByVal val As DateTime) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.DateRankColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's View_Persons_.DatePrevRank field. + ''' + Public Function GetDatePrevRankValue() As ColumnValue + Return Me.GetValue(TableUtils.DatePrevRankColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's View_Persons_.DatePrevRank field. + ''' + Public Function GetDatePrevRankFieldValue() As DateTime + Return CType(Me.GetValue(TableUtils.DatePrevRankColumn).ToDateTime(), DateTime) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_Persons_.DatePrevRank field. + ''' + Public Sub SetDatePrevRankFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.DatePrevRankColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_Persons_.DatePrevRank field. + ''' + Public Sub SetDatePrevRankFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.DatePrevRankColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_Persons_.DatePrevRank field. + ''' + Public Sub SetDatePrevRankFieldValue(ByVal val As DateTime) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.DatePrevRankColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's View_Persons_.BProvince field. + ''' + Public Function GetBProvinceValue() As ColumnValue + Return Me.GetValue(TableUtils.BProvinceColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's View_Persons_.BProvince field. + ''' + Public Function GetBProvinceFieldValue() As String + Return CType(Me.GetValue(TableUtils.BProvinceColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_Persons_.BProvince field. + ''' + Public Sub SetBProvinceFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.BProvinceColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_Persons_.BProvince field. + ''' + Public Sub SetBProvinceFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.BProvinceColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's View_Persons_.SAmout field. + ''' + Public Function GetSAmoutValue() As ColumnValue + Return Me.GetValue(TableUtils.SAmoutColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's View_Persons_.SAmout field. + ''' + Public Function GetSAmoutFieldValue() As Decimal + Return CType(Me.GetValue(TableUtils.SAmoutColumn).ToDecimal(), Decimal) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_Persons_.SAmout field. + ''' + Public Sub SetSAmoutFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.SAmoutColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_Persons_.SAmout field. + ''' + Public Sub SetSAmoutFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.SAmoutColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_Persons_.SAmout field. + ''' + Public Sub SetSAmoutFieldValue(ByVal val As Double) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.SAmoutColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_Persons_.SAmout field. + ''' + Public Sub SetSAmoutFieldValue(ByVal val As Decimal) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.SAmoutColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_Persons_.SAmout field. + ''' + Public Sub SetSAmoutFieldValue(ByVal val As Int64) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.SAmoutColumn) + End Sub + ''' + ''' This is a convenience method that provides direct access to the value of the record's View_Persons_.CEdu field. + ''' + Public Function GetCEduValue() As ColumnValue + Return Me.GetValue(TableUtils.CEduColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's View_Persons_.CEdu field. + ''' + Public Function GetCEduFieldValue() As String + Return CType(Me.GetValue(TableUtils.CEduColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_Persons_.CEdu field. + ''' + Public Sub SetCEduFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.CEduColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_Persons_.CEdu field. + ''' + Public Sub SetCEduFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.CEduColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's View_Persons_.MobilePhone field. + ''' + Public Function GetMobilePhoneValue() As ColumnValue + Return Me.GetValue(TableUtils.MobilePhoneColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's View_Persons_.MobilePhone field. + ''' + Public Function GetMobilePhoneFieldValue() As String + Return CType(Me.GetValue(TableUtils.MobilePhoneColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_Persons_.MobilePhone field. + ''' + Public Sub SetMobilePhoneFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.MobilePhoneColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_Persons_.MobilePhone field. + ''' + Public Sub SetMobilePhoneFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.MobilePhoneColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's View_Persons_.picture field. + ''' + Public Function GetpictureValue() As ColumnValue + Return Me.GetValue(TableUtils.pictureColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's View_Persons_.picture field. + ''' + Public Function GetpictureFieldValue() As Byte() + Return CType(Me.GetValue(TableUtils.pictureColumn).ToBinary(), Byte()) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_Persons_.picture field. + ''' + Public Sub SetpictureFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.pictureColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_Persons_.picture field. + ''' + Public Sub SetpictureFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.pictureColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_Persons_.picture field. + ''' + Public Sub SetpictureFieldValue(ByVal val As Byte ()) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.pictureColumn) + End Sub + ''' + ''' This is a convenience method that provides direct access to the value of the record's View_Persons_.RankDate field. + ''' + Public Function GetRankDateValue() As ColumnValue + Return Me.GetValue(TableUtils.RankDateColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's View_Persons_.RankDate field. + ''' + Public Function GetRankDateFieldValue() As DateTime + Return CType(Me.GetValue(TableUtils.RankDateColumn).ToDateTime(), DateTime) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_Persons_.RankDate field. + ''' + Public Sub SetRankDateFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.RankDateColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_Persons_.RankDate field. + ''' + Public Sub SetRankDateFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.RankDateColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_Persons_.RankDate field. + ''' + Public Sub SetRankDateFieldValue(ByVal val As DateTime) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.RankDateColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's View_Persons_.Title field. + ''' + Public Function GetTitleValue() As ColumnValue + Return Me.GetValue(TableUtils.TitleColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's View_Persons_.Title field. + ''' + Public Function GetTitleFieldValue() As String + Return CType(Me.GetValue(TableUtils.TitleColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_Persons_.Title field. + ''' + Public Sub SetTitleFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.TitleColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_Persons_.Title field. + ''' + Public Sub SetTitleFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.TitleColumn) + End Sub + + ''' + ''' This is a convenience method that provides direct access to the value of the record's View_Persons_.RankLevel field. + ''' + Public Function GetRankLevelValue() As ColumnValue + Return Me.GetValue(TableUtils.RankLevelColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's View_Persons_.RankLevel field. + ''' + Public Function GetRankLevelFieldValue() As Int32 + Return CType(Me.GetValue(TableUtils.RankLevelColumn).ToInt32(), Int32) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_Persons_.RankLevel field. + ''' + Public Sub SetRankLevelFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.RankLevelColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_Persons_.RankLevel field. + ''' + Public Sub SetRankLevelFieldValue(ByVal val As String) + Me.SetString(val, TableUtils.RankLevelColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_Persons_.RankLevel field. + ''' + Public Sub SetRankLevelFieldValue(ByVal val As Double) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.RankLevelColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_Persons_.RankLevel field. + ''' + Public Sub SetRankLevelFieldValue(ByVal val As Decimal) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.RankLevelColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_Persons_.RankLevel field. + ''' + Public Sub SetRankLevelFieldValue(ByVal val As Int64) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.RankLevelColumn) + End Sub + ''' + ''' This is a convenience method that provides direct access to the value of the record's View_Persons_.RankAndName field. + ''' + Public Function GetRankAndNameValue() As ColumnValue + Return Me.GetValue(TableUtils.RankAndNameColumn) + End Function + + ''' + ''' This is a convenience method that provides direct access to the value of the record's View_Persons_.RankAndName field. + ''' + Public Function GetRankAndNameFieldValue() As String + Return CType(Me.GetValue(TableUtils.RankAndNameColumn).ToString(), String) + End Function + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_Persons_.RankAndName field. + ''' + Public Sub SetRankAndNameFieldValue(ByVal val As ColumnValue) + Me.SetValue(val, TableUtils.RankAndNameColumn) + End Sub + + ''' + ''' This is a convenience method that allows direct modification of the value of the record's View_Persons_.RankAndName field. + ''' + Public Sub SetRankAndNameFieldValue(ByVal val As String) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.RankAndNameColumn) + End Sub + + + +#End Region + +#Region "Convenience methods to get field names" + + ''' + ''' This is a convenience property that provides direct access to the value of the record's View_Persons_.PersonalId field. + ''' + Public Property PersonalId() As String + Get + Return CType(Me.GetValue(TableUtils.PersonalIdColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.PersonalIdColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property PersonalIdSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.PersonalIdColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property PersonalIdDefault() As String + Get + Return TableUtils.PersonalIdColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's View_Persons_.ArmyId field. + ''' + Public Property ArmyId() As Byte + Get + Return CType(Me.GetValue(TableUtils.ArmyIdColumn).ToByte(), Byte) + End Get + Set (ByVal val As Byte) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.ArmyIdColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property ArmyIdSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.ArmyIdColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property ArmyIdDefault() As String + Get + Return TableUtils.ArmyIdColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's View_Persons_.ArmSName field. + ''' + Public Property ArmSName() As String + Get + Return CType(Me.GetValue(TableUtils.ArmSNameColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.ArmSNameColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property ArmSNameSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.ArmSNameColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property ArmSNameDefault() As String + Get + Return TableUtils.ArmSNameColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's View_Persons_.SectionId field. + ''' + Public Property SectionId() As Int16 + Get + Return CType(Me.GetValue(TableUtils.SectionIdColumn).ToInt16(), Int16) + End Get + Set (ByVal val As Int16) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.SectionIdColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property SectionIdSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.SectionIdColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property SectionIdDefault() As String + Get + Return TableUtils.SectionIdColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's View_Persons_.SectionAbbvrName field. + ''' + Public Property SectionAbbvrName() As String + Get + Return CType(Me.GetValue(TableUtils.SectionAbbvrNameColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.SectionAbbvrNameColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property SectionAbbvrNameSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.SectionAbbvrNameColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property SectionAbbvrNameDefault() As String + Get + Return TableUtils.SectionAbbvrNameColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's View_Persons_.DeptId field. + ''' + Public Property DeptId() As Int16 + Get + Return CType(Me.GetValue(TableUtils.DeptIdColumn).ToInt16(), Int16) + End Get + Set (ByVal val As Int16) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.DeptIdColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property DeptIdSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.DeptIdColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property DeptIdDefault() As String + Get + Return TableUtils.DeptIdColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's View_Persons_.DeptAbbvr field. + ''' + Public Property DeptAbbvr() As String + Get + Return CType(Me.GetValue(TableUtils.DeptAbbvrColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.DeptAbbvrColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property DeptAbbvrSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.DeptAbbvrColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property DeptAbbvrDefault() As String + Get + Return TableUtils.DeptAbbvrColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's View_Persons_.RankId field. + ''' + Public Property RankId() As Int32 + Get + Return CType(Me.GetValue(TableUtils.RankIdColumn).ToInt32(), Int32) + End Get + Set (ByVal val As Int32) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.RankIdColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property RankIdSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.RankIdColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property RankIdDefault() As String + Get + Return TableUtils.RankIdColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's View_Persons_.PersonalName field. + ''' + Public Property PersonalName() As String + Get + Return CType(Me.GetValue(TableUtils.PersonalNameColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.PersonalNameColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property PersonalNameSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.PersonalNameColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property PersonalNameDefault() As String + Get + Return TableUtils.PersonalNameColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's View_Persons_.PersonalLastName field. + ''' + Public Property PersonalLastName() As String + Get + Return CType(Me.GetValue(TableUtils.PersonalLastNameColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.PersonalLastNameColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property PersonalLastNameSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.PersonalLastNameColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property PersonalLastNameDefault() As String + Get + Return TableUtils.PersonalLastNameColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's View_Persons_.BirthDate field. + ''' + Public Property BirthDate() As DateTime + Get + Return CType(Me.GetValue(TableUtils.BirthDateColumn).ToDateTime(), DateTime) + End Get + Set (ByVal val As DateTime) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.BirthDateColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property BirthDateSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.BirthDateColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property BirthDateDefault() As String + Get + Return TableUtils.BirthDateColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's View_Persons_.Retire field. + ''' + Public Property Retire() As String + Get + Return CType(Me.GetValue(TableUtils.RetireColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.RetireColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property RetireSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.RetireColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property RetireDefault() As String + Get + Return TableUtils.RetireColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's View_Persons_.Commission field. + ''' + Public Property Commission() As String + Get + Return CType(Me.GetValue(TableUtils.CommissionColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.CommissionColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property CommissionSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.CommissionColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property CommissionDefault() As String + Get + Return TableUtils.CommissionColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's View_Persons_.Born field. + ''' + Public Property Born() As String + Get + Return CType(Me.GetValue(TableUtils.BornColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.BornColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property BornSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.BornColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property BornDefault() As String + Get + Return TableUtils.BornColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's View_Persons_.DateRank field. + ''' + Public Property DateRank() As DateTime + Get + Return CType(Me.GetValue(TableUtils.DateRankColumn).ToDateTime(), DateTime) + End Get + Set (ByVal val As DateTime) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.DateRankColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property DateRankSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.DateRankColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property DateRankDefault() As String + Get + Return TableUtils.DateRankColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's View_Persons_.DatePrevRank field. + ''' + Public Property DatePrevRank() As DateTime + Get + Return CType(Me.GetValue(TableUtils.DatePrevRankColumn).ToDateTime(), DateTime) + End Get + Set (ByVal val As DateTime) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.DatePrevRankColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property DatePrevRankSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.DatePrevRankColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property DatePrevRankDefault() As String + Get + Return TableUtils.DatePrevRankColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's View_Persons_.BProvince field. + ''' + Public Property BProvince() As String + Get + Return CType(Me.GetValue(TableUtils.BProvinceColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.BProvinceColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property BProvinceSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.BProvinceColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property BProvinceDefault() As String + Get + Return TableUtils.BProvinceColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's View_Persons_.SAmout field. + ''' + Public Property SAmout() As Decimal + Get + Return CType(Me.GetValue(TableUtils.SAmoutColumn).ToDecimal(), Decimal) + End Get + Set (ByVal val As Decimal) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.SAmoutColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property SAmoutSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.SAmoutColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property SAmoutDefault() As String + Get + Return TableUtils.SAmoutColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's View_Persons_.CEdu field. + ''' + Public Property CEdu() As String + Get + Return CType(Me.GetValue(TableUtils.CEduColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.CEduColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property CEduSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.CEduColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property CEduDefault() As String + Get + Return TableUtils.CEduColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's View_Persons_.MobilePhone field. + ''' + Public Property MobilePhone() As String + Get + Return CType(Me.GetValue(TableUtils.MobilePhoneColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.MobilePhoneColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property MobilePhoneSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.MobilePhoneColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property MobilePhoneDefault() As String + Get + Return TableUtils.MobilePhoneColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's View_Persons_.picture field. + ''' + Public Property picture() As Byte() + Get + Return CType(Me.GetValue(TableUtils.pictureColumn).ToBinary(), Byte()) + End Get + Set (ByVal val As Byte ()) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.pictureColumn) + End Set + End Property + + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property pictureSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.pictureColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property pictureDefault() As String + Get + Return TableUtils.pictureColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's View_Persons_.RankDate field. + ''' + Public Property RankDate() As DateTime + Get + Return CType(Me.GetValue(TableUtils.RankDateColumn).ToDateTime(), DateTime) + End Get + Set (ByVal val As DateTime) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.RankDateColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property RankDateSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.RankDateColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property RankDateDefault() As String + Get + Return TableUtils.RankDateColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's View_Persons_.Title field. + ''' + Public Property Title() As String + Get + Return CType(Me.GetValue(TableUtils.TitleColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.TitleColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property TitleSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.TitleColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property TitleDefault() As String + Get + Return TableUtils.TitleColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's View_Persons_.RankLevel field. + ''' + Public Property RankLevel() As Int32 + Get + Return CType(Me.GetValue(TableUtils.RankLevelColumn).ToInt32(), Int32) + End Get + Set (ByVal val As Int32) + Dim colValue As ColumnValue = New ColumnValue(val) + Me.SetValue(colValue, TableUtils.RankLevelColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property RankLevelSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.RankLevelColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property RankLevelDefault() As String + Get + Return TableUtils.RankLevelColumn.DefaultValue + End Get + End Property + + ''' + ''' This is a convenience property that provides direct access to the value of the record's View_Persons_.RankAndName field. + ''' + Public Property RankAndName() As String + Get + Return CType(Me.GetValue(TableUtils.RankAndNameColumn).ToString(), String) + End Get + Set (ByVal Value As String) + Me.SetString(value, TableUtils.RankAndNameColumn) + End Set + End Property + + + ''' + ''' This is a convenience method that can be used to determine that the column is set. + ''' + Public ReadOnly Property RankAndNameSpecified() As Boolean + Get + Dim val As ColumnValue = Me.GetValue(TableUtils.RankAndNameColumn) + If val Is Nothing OrElse val.IsNull Then + Return False + End If + Return True + End Get + End Property + + ''' + ''' This is a convenience method that can be used to get the default value of a column. + ''' + Public ReadOnly Property RankAndNameDefault() As String + Get + Return TableUtils.RankAndNameColumn.DefaultValue + End Get + End Property + + + +#End Region + +End Class +End Namespace diff --git a/App_Code/Business Layer/BaseView_PersonsView.vb b/App_Code/Business Layer/BaseView_PersonsView.vb new file mode 100644 index 0000000..e0e2f5f --- /dev/null +++ b/App_Code/Business Layer/BaseView_PersonsView.vb @@ -0,0 +1,1284 @@ +' This class is "generated" and will be overwritten. +' Your customizations should be made in View_PersonsRecord.vb + +Imports System.Data.SqlTypes +Imports System.Data +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider +Imports Persons.Data + +Namespace Persons.Business + +''' +''' The generated superclass for the class. +''' Provides access to the schema information and record data of a database table or view named View_Persons. +''' +''' +''' The connection details (name, location, etc.) of the database and table (or view) accessed by this class +''' are resolved at runtime based on the connection string in the application's Web.Config file. +''' +''' This class is not intended to be instantiated directly. To obtain an instance of this class, use +''' View_PersonsView.Instance. +''' +''' +''' + + Public Class BaseView_PersonsView + Inherits PrimaryKeyTable + + + Private ReadOnly TableDefinitionString As String = View_PersonsDefinition.GetXMLString() + + + + + + + + Protected Sub New() + MyBase.New() + Me.Initialize() + End Sub + + Protected Overridable Sub Initialize() + Dim def As New XmlTableDefinition(TableDefinitionString) + Me.TableDefinition = New TableDefinition() + Me.TableDefinition.TableClassName = System.Reflection.Assembly.CreateQualifiedName("App_Code", "Persons.Business.View_PersonsView") + def.InitializeTableDefinition(Me.TableDefinition) + Me.ConnectionName = def.GetConnectionName() + Me.RecordClassName = System.Reflection.Assembly.CreateQualifiedName("App_Code", "Persons.Business.View_PersonsRecord") + Me.ApplicationName = "App_Code" + Me.DataAdapter = New View_PersonsSqlView() + Directcast(Me.DataAdapter, View_PersonsSqlView).ConnectionName = Me.ConnectionName + + Me.TableDefinition.AdapterMetaData = Me.DataAdapter.AdapterMetaData + PersonalIdColumn.CodeName = "PersonalId" + ArmyIdColumn.CodeName = "ArmyId" + ArmSNameColumn.CodeName = "ArmSName" + SectionIdColumn.CodeName = "SectionId" + SectionAbbvrNameColumn.CodeName = "SectionAbbvrName" + DeptIdColumn.CodeName = "DeptId" + DeptAbbvrColumn.CodeName = "DeptAbbvr" + RankIdColumn.CodeName = "RankId" + PersonalNameColumn.CodeName = "PersonalName" + PersonalLastNameColumn.CodeName = "PersonalLastName" + BirthDateColumn.CodeName = "BirthDate" + RetireColumn.CodeName = "Retire" + CommissionColumn.CodeName = "Commission" + BornColumn.CodeName = "Born" + DateRankColumn.CodeName = "DateRank" + DatePrevRankColumn.CodeName = "DatePrevRank" + BProvinceColumn.CodeName = "BProvince" + SAmoutColumn.CodeName = "SAmout" + CEduColumn.CodeName = "CEdu" + MobilePhoneColumn.CodeName = "MobilePhone" + pictureColumn.CodeName = "picture" + RankDateColumn.CodeName = "RankDate" + TitleColumn.CodeName = "Title" + RankLevelColumn.CodeName = "RankLevel" + RankAndNameColumn.CodeName = "RankAndName" + + End Sub + +#Region "Overriden methods" + + +#End Region + +#Region "Properties for columns" + + ''' + ''' This is a convenience property that provides direct access to the table's View_Persons_.PersonalId column object. + ''' + Public ReadOnly Property PersonalIdColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(0), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's View_Persons_.PersonalId column object. + ''' + Public Shared ReadOnly Property PersonalId() As BaseClasses.Data.StringColumn + Get + Return View_PersonsView.Instance.PersonalIdColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's View_Persons_.ArmyId column object. + ''' + Public ReadOnly Property ArmyIdColumn() As BaseClasses.Data.NumberColumn + Get + Return CType(Me.TableDefinition.ColumnList(1), BaseClasses.Data.NumberColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's View_Persons_.ArmyId column object. + ''' + Public Shared ReadOnly Property ArmyId() As BaseClasses.Data.NumberColumn + Get + Return View_PersonsView.Instance.ArmyIdColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's View_Persons_.ArmSName column object. + ''' + Public ReadOnly Property ArmSNameColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(2), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's View_Persons_.ArmSName column object. + ''' + Public Shared ReadOnly Property ArmSName() As BaseClasses.Data.StringColumn + Get + Return View_PersonsView.Instance.ArmSNameColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's View_Persons_.SectionId column object. + ''' + Public ReadOnly Property SectionIdColumn() As BaseClasses.Data.NumberColumn + Get + Return CType(Me.TableDefinition.ColumnList(3), BaseClasses.Data.NumberColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's View_Persons_.SectionId column object. + ''' + Public Shared ReadOnly Property SectionId() As BaseClasses.Data.NumberColumn + Get + Return View_PersonsView.Instance.SectionIdColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's View_Persons_.SectionAbbvrName column object. + ''' + Public ReadOnly Property SectionAbbvrNameColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(4), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's View_Persons_.SectionAbbvrName column object. + ''' + Public Shared ReadOnly Property SectionAbbvrName() As BaseClasses.Data.StringColumn + Get + Return View_PersonsView.Instance.SectionAbbvrNameColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's View_Persons_.DeptId column object. + ''' + Public ReadOnly Property DeptIdColumn() As BaseClasses.Data.NumberColumn + Get + Return CType(Me.TableDefinition.ColumnList(5), BaseClasses.Data.NumberColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's View_Persons_.DeptId column object. + ''' + Public Shared ReadOnly Property DeptId() As BaseClasses.Data.NumberColumn + Get + Return View_PersonsView.Instance.DeptIdColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's View_Persons_.DeptAbbvr column object. + ''' + Public ReadOnly Property DeptAbbvrColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(6), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's View_Persons_.DeptAbbvr column object. + ''' + Public Shared ReadOnly Property DeptAbbvr() As BaseClasses.Data.StringColumn + Get + Return View_PersonsView.Instance.DeptAbbvrColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's View_Persons_.RankId column object. + ''' + Public ReadOnly Property RankIdColumn() As BaseClasses.Data.NumberColumn + Get + Return CType(Me.TableDefinition.ColumnList(7), BaseClasses.Data.NumberColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's View_Persons_.RankId column object. + ''' + Public Shared ReadOnly Property RankId() As BaseClasses.Data.NumberColumn + Get + Return View_PersonsView.Instance.RankIdColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's View_Persons_.PersonalName column object. + ''' + Public ReadOnly Property PersonalNameColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(8), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's View_Persons_.PersonalName column object. + ''' + Public Shared ReadOnly Property PersonalName() As BaseClasses.Data.StringColumn + Get + Return View_PersonsView.Instance.PersonalNameColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's View_Persons_.PersonalLastName column object. + ''' + Public ReadOnly Property PersonalLastNameColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(9), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's View_Persons_.PersonalLastName column object. + ''' + Public Shared ReadOnly Property PersonalLastName() As BaseClasses.Data.StringColumn + Get + Return View_PersonsView.Instance.PersonalLastNameColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's View_Persons_.BirthDate column object. + ''' + Public ReadOnly Property BirthDateColumn() As BaseClasses.Data.DateColumn + Get + Return CType(Me.TableDefinition.ColumnList(10), BaseClasses.Data.DateColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's View_Persons_.BirthDate column object. + ''' + Public Shared ReadOnly Property BirthDate() As BaseClasses.Data.DateColumn + Get + Return View_PersonsView.Instance.BirthDateColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's View_Persons_.Retire column object. + ''' + Public ReadOnly Property RetireColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(11), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's View_Persons_.Retire column object. + ''' + Public Shared ReadOnly Property Retire() As BaseClasses.Data.StringColumn + Get + Return View_PersonsView.Instance.RetireColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's View_Persons_.Commission column object. + ''' + Public ReadOnly Property CommissionColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(12), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's View_Persons_.Commission column object. + ''' + Public Shared ReadOnly Property Commission() As BaseClasses.Data.StringColumn + Get + Return View_PersonsView.Instance.CommissionColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's View_Persons_.Born column object. + ''' + Public ReadOnly Property BornColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(13), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's View_Persons_.Born column object. + ''' + Public Shared ReadOnly Property Born() As BaseClasses.Data.StringColumn + Get + Return View_PersonsView.Instance.BornColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's View_Persons_.DateRank column object. + ''' + Public ReadOnly Property DateRankColumn() As BaseClasses.Data.DateColumn + Get + Return CType(Me.TableDefinition.ColumnList(14), BaseClasses.Data.DateColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's View_Persons_.DateRank column object. + ''' + Public Shared ReadOnly Property DateRank() As BaseClasses.Data.DateColumn + Get + Return View_PersonsView.Instance.DateRankColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's View_Persons_.DatePrevRank column object. + ''' + Public ReadOnly Property DatePrevRankColumn() As BaseClasses.Data.DateColumn + Get + Return CType(Me.TableDefinition.ColumnList(15), BaseClasses.Data.DateColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's View_Persons_.DatePrevRank column object. + ''' + Public Shared ReadOnly Property DatePrevRank() As BaseClasses.Data.DateColumn + Get + Return View_PersonsView.Instance.DatePrevRankColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's View_Persons_.BProvince column object. + ''' + Public ReadOnly Property BProvinceColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(16), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's View_Persons_.BProvince column object. + ''' + Public Shared ReadOnly Property BProvince() As BaseClasses.Data.StringColumn + Get + Return View_PersonsView.Instance.BProvinceColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's View_Persons_.SAmout column object. + ''' + Public ReadOnly Property SAmoutColumn() As BaseClasses.Data.CurrencyColumn + Get + Return CType(Me.TableDefinition.ColumnList(17), BaseClasses.Data.CurrencyColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's View_Persons_.SAmout column object. + ''' + Public Shared ReadOnly Property SAmout() As BaseClasses.Data.CurrencyColumn + Get + Return View_PersonsView.Instance.SAmoutColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's View_Persons_.CEdu column object. + ''' + Public ReadOnly Property CEduColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(18), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's View_Persons_.CEdu column object. + ''' + Public Shared ReadOnly Property CEdu() As BaseClasses.Data.StringColumn + Get + Return View_PersonsView.Instance.CEduColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's View_Persons_.MobilePhone column object. + ''' + Public ReadOnly Property MobilePhoneColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(19), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's View_Persons_.MobilePhone column object. + ''' + Public Shared ReadOnly Property MobilePhone() As BaseClasses.Data.StringColumn + Get + Return View_PersonsView.Instance.MobilePhoneColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's View_Persons_.picture column object. + ''' + Public ReadOnly Property pictureColumn() As BaseClasses.Data.ImageColumn + Get + Return CType(Me.TableDefinition.ColumnList(20), BaseClasses.Data.ImageColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's View_Persons_.picture column object. + ''' + Public Shared ReadOnly Property picture() As BaseClasses.Data.ImageColumn + Get + Return View_PersonsView.Instance.pictureColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's View_Persons_.RankDate column object. + ''' + Public ReadOnly Property RankDateColumn() As BaseClasses.Data.DateColumn + Get + Return CType(Me.TableDefinition.ColumnList(21), BaseClasses.Data.DateColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's View_Persons_.RankDate column object. + ''' + Public Shared ReadOnly Property RankDate() As BaseClasses.Data.DateColumn + Get + Return View_PersonsView.Instance.RankDateColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's View_Persons_.Title column object. + ''' + Public ReadOnly Property TitleColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(22), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's View_Persons_.Title column object. + ''' + Public Shared ReadOnly Property Title() As BaseClasses.Data.StringColumn + Get + Return View_PersonsView.Instance.TitleColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's View_Persons_.RankLevel column object. + ''' + Public ReadOnly Property RankLevelColumn() As BaseClasses.Data.NumberColumn + Get + Return CType(Me.TableDefinition.ColumnList(23), BaseClasses.Data.NumberColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's View_Persons_.RankLevel column object. + ''' + Public Shared ReadOnly Property RankLevel() As BaseClasses.Data.NumberColumn + Get + Return View_PersonsView.Instance.RankLevelColumn + End Get + End Property + ''' + ''' This is a convenience property that provides direct access to the table's View_Persons_.RankAndName column object. + ''' + Public ReadOnly Property RankAndNameColumn() As BaseClasses.Data.StringColumn + Get + Return CType(Me.TableDefinition.ColumnList(24), BaseClasses.Data.StringColumn) + End Get + End Property + + + + ''' + ''' This is a convenience property that provides direct access to the table's View_Persons_.RankAndName column object. + ''' + Public Shared ReadOnly Property RankAndName() As BaseClasses.Data.StringColumn + Get + Return View_PersonsView.Instance.RankAndNameColumn + End Get + End Property + + +#End Region + + +#Region "Shared helper methods" + + ''' + ''' This is a shared function that can be used to get an array of View_PersonsRecord records using a where clause. + ''' + Public Shared Function GetRecords(ByVal where As String) As View_PersonsRecord() + + Return GetRecords(where, Nothing, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) + End Function + + ''' + ''' This is a shared function that can be used to get an array of View_PersonsRecord records using a where clause. + ''' + Public Shared Function GetRecords(ByVal join As BaseFilter, ByVal where As String) As View_PersonsRecord() + + Return GetRecords(join, where, Nothing, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) + End Function + + ''' + ''' This is a shared function that can be used to get an array of View_PersonsRecord records using a where and order by clause. + ''' + Public Shared Function GetRecords( _ + ByVal where As String, _ + ByVal orderBy As OrderBy) As View_PersonsRecord() + + Return GetRecords(where, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) + End Function + + ''' + ''' This is a shared function that can be used to get an array of View_PersonsRecord records using a where and order by clause. + ''' + Public Shared Function GetRecords( _ + ByVal join As BaseFilter, _ + ByVal where As String, _ + ByVal orderBy As OrderBy) As View_PersonsRecord() + + Return GetRecords(join, where, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) + End Function + + ''' + ''' This is a shared function that can be used to get an array of View_PersonsRecord records using a where and order by clause clause with pagination. + ''' + Public Shared Function GetRecords( _ + ByVal where As String, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As View_PersonsRecord() + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + Dim join As BaseClasses.Data.BaseFilter = Nothing + Dim recList As ArrayList = View_PersonsView.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, pageIndex, pageSize) + + Return CType(recList.ToArray(GetType(Persons.Business.View_PersonsRecord)), View_PersonsRecord()) + End Function + + ''' + ''' This is a shared function that can be used to get an array of View_PersonsRecord records using a where and order by clause clause with pagination. + ''' + Public Shared Function GetRecords( _ + ByVal join As BaseFilter, _ + ByVal where As String, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As View_PersonsRecord() + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Dim recList As ArrayList = View_PersonsView.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, pageIndex, pageSize) + + Return CType(recList.ToArray(GetType(Persons.Business.View_PersonsRecord)), View_PersonsRecord()) + End Function + + Public Shared Function GetRecords( _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As View_PersonsRecord() + Dim join As BaseClasses.Data.BaseFilter = Nothing + Dim recList As ArrayList = View_PersonsView.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + Return CType(recList.ToArray(GetType(Persons.Business.View_PersonsRecord)), View_PersonsRecord()) + End Function + + Public Shared Function GetRecords( _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As View_PersonsRecord() + + Dim recList As ArrayList = View_PersonsView.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + Return CType(recList.ToArray(GetType(Persons.Business.View_PersonsRecord)), View_PersonsRecord()) + End Function + + Public Shared Function GetRecords( _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer, _ + ByRef totalRecords As Integer) As View_PersonsRecord() + Dim join As BaseClasses.Data.BaseFilter = Nothing + Dim recList As ArrayList = View_PersonsView.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize, totalRecords) + + Return CType(recList.ToArray(GetType(Persons.Business.View_PersonsRecord)), View_PersonsRecord()) + End Function + + Public Shared Function GetRecords( _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer, _ + ByRef totalRecords As Integer) As View_PersonsRecord() + + Dim recList As ArrayList = View_PersonsView.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize, totalRecords) + + Return CType(recList.ToArray(GetType(Persons.Business.View_PersonsRecord)), View_PersonsRecord()) + End Function + + ''' + ''' This is a shared function that can be used to get total number of records that will be returned using the where clause. + ''' + Public Shared Function GetRecordCount(ByVal where As String) As Integer + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Return CInt(View_PersonsView.Instance.GetRecordListCount(Nothing, whereFilter, Nothing, Nothing)) + End Function + +''' + ''' This is a shared function that can be used to get total number of records that will be returned using the where clause. + ''' + Public Shared Function GetRecordCount(ByVal join As BaseFilter, ByVal where As String) As Integer + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Return CInt(View_PersonsView.Instance.GetRecordListCount(join, whereFilter, Nothing, Nothing)) + End Function + + Public Shared Function GetRecordCount(ByVal where As WhereClause) As Integer + Return CInt(View_PersonsView.Instance.GetRecordListCount(Nothing, where.GetFilter(), Nothing, Nothing)) + End Function + + Public Shared Function GetRecordCount(ByVal join As BaseFilter, ByVal where As WhereClause) As Integer + Return CInt(View_PersonsView.Instance.GetRecordListCount(join, where.GetFilter(), Nothing, Nothing)) + End Function + + ''' + ''' This is a shared function that can be used to get a View_PersonsRecord record using a where clause. + ''' + Public Shared Function GetRecord(ByVal where As String) As View_PersonsRecord + Dim orderBy As OrderBy = Nothing + Return GetRecord(where, orderBy) + End Function + + ''' + ''' This is a shared function that can be used to get a View_PersonsRecord record using a where clause. + ''' + Public Shared Function GetRecord(ByVal join As BaseFilter, ByVal where As String) As View_PersonsRecord + Dim orderBy As OrderBy = Nothing + Return GetRecord(join, where, orderBy) + End Function + + ''' + ''' This is a shared function that can be used to get a View_PersonsRecord record using a where and order by clause. + ''' + Public Shared Function GetRecord( _ + ByVal where As String, _ + ByVal orderBy As OrderBy) As View_PersonsRecord + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + Dim join As BaseClasses.Data.BaseFilter = Nothing + Dim recList As ArrayList = View_PersonsView.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MIN_BATCH_SIZE) + + Dim rec As View_PersonsRecord = Nothing + If recList.Count > 0 Then + rec = CType(recList(0), View_PersonsRecord) + End If + + Return rec + End Function + + ''' + ''' This is a shared function that can be used to get a View_PersonsRecord record using a where and order by clause. + ''' + Public Shared Function GetRecord( _ + ByVal join As BaseFilter, _ + ByVal where As String, _ + ByVal orderBy As OrderBy) As View_PersonsRecord + + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Dim recList As ArrayList = View_PersonsView.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MIN_BATCH_SIZE) + + Dim rec As View_PersonsRecord = Nothing + If recList.Count > 0 Then + rec = CType(recList(0), View_PersonsRecord) + End If + + Return rec + End Function + + + Public Shared Function GetValues( _ + ByVal col As BaseColumn, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal maxItems As Integer) As String() + + ' Create the filter list. + Dim retCol As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, True) + retCol.AddColumn(col) + + Return View_PersonsView.Instance.GetColumnValues(retCol, Nothing, where.GetFilter(), Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, maxItems) + + End Function + + Public Shared Function GetValues( _ + ByVal col As BaseColumn, _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal maxItems As Integer) As String() + + ' Create the filter list. + Dim retCol As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, True) + retCol.AddColumn(col) + + Return View_PersonsView.Instance.GetColumnValues(retCol, join, where.GetFilter(), Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, maxItems) + + End Function + + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where clause. + ''' + Public Shared Function GetDataTable(ByVal where As String) As System.Data.DataTable + + Dim recs() As View_PersonsRecord = GetRecords(where) + Return View_PersonsView.Instance.CreateDataTable(recs, Nothing) + End Function + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where clause. + ''' + Public Shared Function GetDataTable(ByVal join As BaseFilter, ByVal where As String) As System.Data.DataTable + + Dim recs() As View_PersonsRecord = GetRecords(join, where) + Return View_PersonsView.Instance.CreateDataTable(recs, Nothing) + End Function + + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause. + ''' + Public Shared Function GetDataTable(ByVal where As String, ByVal orderBy As OrderBy) As System.Data.DataTable + + Dim recs() As View_PersonsRecord = GetRecords(where, orderBy) + Return View_PersonsView.Instance.CreateDataTable(recs, Nothing) + End Function + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause. + ''' + Public Shared Function GetDataTable(ByVal join As BaseFilter, ByVal where As String, ByVal orderBy As OrderBy) As System.Data.DataTable + + Dim recs() As View_PersonsRecord = GetRecords(join, where, orderBy) + Return View_PersonsView.Instance.CreateDataTable(recs, Nothing) + End Function + + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause with pagination. + ''' + Public Shared Function GetDataTable( _ + ByVal where As String, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As System.Data.DataTable + + Dim recs() As View_PersonsRecord = GetRecords(where, orderBy, pageIndex, pageSize) + Return View_PersonsView.Instance.CreateDataTable(recs, Nothing) + End Function + + ''' + ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause with pagination. + ''' + Public Shared Function GetDataTable( _ + ByVal join As BaseFilter, _ + ByVal where As String, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) As System.Data.DataTable + + Dim recs() As View_PersonsRecord = GetRecords(join, where, orderBy, pageIndex, pageSize) + Return View_PersonsView.Instance.CreateDataTable(recs, Nothing) + End Function + + + ''' + ''' This is a shared function that can be used to delete records using a where clause. + ''' + Public Shared Sub DeleteRecords(ByVal where As String) + If where = Nothing OrElse where.Trim() = "" Then + Return + End If + + Dim whereFilter As SqlFilter = New SqlFilter(where) + View_PersonsView.Instance.DeleteRecordList(whereFilter) + End Sub + + ''' + ''' This is a shared function that can be used to export records using a where clause. + ''' + Public Shared Function Export(ByVal where As String) As String + Dim whereFilter As SqlFilter = Nothing + If Not where Is Nothing AndAlso where.Trim() <> "" Then + whereFilter = New SqlFilter(where) + End If + + Return View_PersonsView.Instance.ExportRecordData(whereFilter) + End Function + + Public Shared Function Export(ByVal where As WhereClause) As String + Dim whereFilter As BaseFilter = Nothing + If Not where Is Nothing Then + whereFilter = where.GetFilter() + End If + + Return View_PersonsView.Instance.ExportRecordData(whereFilter) + End Function + + Public Shared Function GetSum( _ + ByVal col As BaseColumn, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) _ + As String + + Dim colSel As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, False) + colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Sum) + + Return View_PersonsView.Instance.GetColumnStatistics(colSel, Nothing, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + End Function + + Public Shared Function GetSum( _ + ByVal col As BaseColumn, _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) _ + As String + + Dim colSel As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, False) + colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Sum) + + Return View_PersonsView.Instance.GetColumnStatistics(colSel, join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + End Function + + + Public Shared Function GetCount( _ + ByVal col As BaseColumn, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) _ + As String + + Dim colSel As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, False) + colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Count) + + Return View_PersonsView.Instance.GetColumnStatistics(colSel, Nothing, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + End Function + + Public Shared Function GetCount( _ + ByVal col As BaseColumn, _ + ByVal join As BaseFilter, _ + ByVal where As WhereClause, _ + ByVal orderBy As OrderBy, _ + ByVal pageIndex As Integer, _ + ByVal pageSize As Integer) _ + As String + + Dim colSel As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, False) + colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Count) + + Return View_PersonsView.Instance.GetColumnStatistics(colSel, join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) + + End Function + + ''' + ''' This method returns the columns in the table. + ''' + Public Shared Function GetColumns() As BaseColumn() + Return View_PersonsView.Instance.TableDefinition.Columns + End Function + + ''' + ''' This method returns the columnlist in the table. + ''' + Public Shared Function GetColumnList() As ColumnList + Return View_PersonsView.Instance.TableDefinition.ColumnList + End Function + + + ''' + ''' This method creates a new record and returns it to be edited. + ''' + Public Shared Function CreateNewRecord() As IRecord + Return View_PersonsView.Instance.CreateRecord() + End Function + + ''' + ''' This method creates a new record and returns it to be edited. + ''' + ''' ID of the new record. + Public Shared Function CreateNewRecord(ByVal tempId As String) As IRecord + Return View_PersonsView.Instance.CreateRecord(tempId) + End Function + + ''' + ''' This method checks if column is editable. + ''' + ''' Name of the column to check. + Public Shared Function isReadOnlyColumn(ByVal columnName As String) As Boolean + Dim column As BaseColumn = GetColumn(columnName) + If (Not IsNothing(column)) Then + Return column.IsValuesReadOnly + Else + Return True + End If + End Function + + ''' + ''' This method gets the specified column. + ''' + ''' Unique name of the column to fetch. + Public Shared Function GetColumn(ByVal uniqueColumnName As String) As BaseColumn + Dim column As BaseColumn = View_PersonsView.Instance.TableDefinition.ColumnList.GetByUniqueName(uniqueColumnName) + Return column + End Function + + ' Convenience method for getting a record using a string-based record identifier + Public Shared Function GetRecord(ByVal id As String, ByVal bMutable As Boolean) As View_PersonsRecord + Return CType(View_PersonsView.Instance.GetRecordData(id, bMutable), View_PersonsRecord) + End Function + + ' Convenience method for getting a record using a KeyValue record identifier + Public Shared Function GetRecord(ByVal id As KeyValue, ByVal bMutable As Boolean) As View_PersonsRecord + Return CType(View_PersonsView.Instance.GetRecordData(id, bMutable), View_PersonsRecord) + End Function + + ' Convenience method for creating a record + Public Overloads Function NewRecord( _ + ByVal PersonalIdValue As String, _ + ByVal ArmyIdValue As String, _ + ByVal ArmSNameValue As String, _ + ByVal SectionIdValue As String, _ + ByVal SectionAbbvrNameValue As String, _ + ByVal DeptIdValue As String, _ + ByVal DeptAbbvrValue As String, _ + ByVal RankIdValue As String, _ + ByVal PersonalNameValue As String, _ + ByVal PersonalLastNameValue As String, _ + ByVal BirthDateValue As String, _ + ByVal RetireValue As String, _ + ByVal CommissionValue As String, _ + ByVal BornValue As String, _ + ByVal DateRankValue As String, _ + ByVal DatePrevRankValue As String, _ + ByVal BProvinceValue As String, _ + ByVal SAmoutValue As String, _ + ByVal CEduValue As String, _ + ByVal MobilePhoneValue As String, _ + ByVal pictureValue As String, _ + ByVal RankDateValue As String, _ + ByVal TitleValue As String, _ + ByVal RankLevelValue As String, _ + ByVal RankAndNameValue As String _ + ) As KeyValue + Dim rec As IPrimaryKeyRecord = CType(Me.CreateRecord(), IPrimaryKeyRecord) + rec.SetString(PersonalIdValue, PersonalIdColumn) + rec.SetString(ArmyIdValue, ArmyIdColumn) + rec.SetString(ArmSNameValue, ArmSNameColumn) + rec.SetString(SectionIdValue, SectionIdColumn) + rec.SetString(SectionAbbvrNameValue, SectionAbbvrNameColumn) + rec.SetString(DeptIdValue, DeptIdColumn) + rec.SetString(DeptAbbvrValue, DeptAbbvrColumn) + rec.SetString(RankIdValue, RankIdColumn) + rec.SetString(PersonalNameValue, PersonalNameColumn) + rec.SetString(PersonalLastNameValue, PersonalLastNameColumn) + rec.SetString(BirthDateValue, BirthDateColumn) + rec.SetString(RetireValue, RetireColumn) + rec.SetString(CommissionValue, CommissionColumn) + rec.SetString(BornValue, BornColumn) + rec.SetString(DateRankValue, DateRankColumn) + rec.SetString(DatePrevRankValue, DatePrevRankColumn) + rec.SetString(BProvinceValue, BProvinceColumn) + rec.SetString(SAmoutValue, SAmoutColumn) + rec.SetString(CEduValue, CEduColumn) + rec.SetString(MobilePhoneValue, MobilePhoneColumn) + rec.SetString(pictureValue, pictureColumn) + rec.SetString(RankDateValue, RankDateColumn) + rec.SetString(TitleValue, TitleColumn) + rec.SetString(RankLevelValue, RankLevelColumn) + rec.SetString(RankAndNameValue, RankAndNameColumn) + + + rec.Create() 'update the DB so any DB-initialized fields (like autoincrement IDs) can be initialized + + Dim key As KeyValue = rec.GetID() + Return key + End Function + + ''' + ''' This method deletes a specified record + ''' + ''' Keyvalue of the record to be deleted. + Public Shared Sub DeleteRecord(ByVal kv As KeyValue) + View_PersonsView.Instance.DeleteOneRecord(kv) + End Sub + + ''' + ''' This method checks if record exist in the database using the keyvalue provided. + ''' + ''' Key value of the record. + Public Shared Function DoesRecordExist(ByVal kv As KeyValue) As Boolean + Dim recordExist As Boolean = True + Try + View_PersonsView.GetRecord(kv, False) + Catch ex As Exception + recordExist = False + End Try + Return recordExist + End Function + + ''' + ''' This method returns all the primary columns in the table. + ''' + Public Shared Function GetPrimaryKeyColumns() As ColumnList + If (Not IsNothing(View_PersonsView.Instance.TableDefinition.PrimaryKey)) Then + Return View_PersonsView.Instance.TableDefinition.PrimaryKey.Columns + Else + Return Nothing + End If + End Function + + ''' + ''' This method takes a key and returns a keyvalue. + ''' + ''' key could be array of primary key values in case of composite primary key or a string containing single primary key value in case of non-composite primary key. + Public Shared Function GetKeyValue(ByVal key As Object) As KeyValue + Dim kv As KeyValue = Nothing + + If (Not (IsNothing(View_PersonsView.Instance.TableDefinition.PrimaryKey))) Then + + Dim isCompositePrimaryKey As Boolean = False + isCompositePrimaryKey = View_PersonsView.Instance.TableDefinition.PrimaryKey.IsCompositeKey + + If ((isCompositePrimaryKey) AndAlso (key.GetType.IsArray())) Then + + ' If the key is composite, then construct a key value. + kv = New KeyValue + Dim fullKeyString As String = "" + Dim keyArray As Array = CType(key, Array) + If (Not IsNothing(keyArray)) Then + Dim length As Integer = keyArray.Length + Dim pkColumns As ColumnList = View_PersonsView.Instance.TableDefinition.PrimaryKey.Columns + Dim pkColumn As BaseColumn + Dim index As Integer = 0 + For Each pkColumn In pkColumns + Dim keyString As String = CType(keyArray.GetValue(index), String) + If (View_PersonsView.Instance.TableDefinition.TableType = BaseClasses.Data.TableDefinition.TableTypes.Virtual) Then + kv.AddElement(pkColumn.UniqueName, keyString) + Else + kv.AddElement(pkColumn.InternalName, keyString) + End If + index = index + 1 + Next pkColumn + End If + + Else + ' If the key is not composite, then get the key value. + kv = View_PersonsView.Instance.TableDefinition.PrimaryKey.ParseValue(CType(key, String)) + End If + End If + Return kv + End Function + + + ''' + ''' This method takes a record and a Column and returns an evaluated value of DFKA formula. + ''' + Public Shared Function GetDFKA(ByVal rec As BaseRecord, ByVal col As BaseColumn) As String + Dim fkColumn As ForeignKey = View_PersonsView.Instance.TableDefinition.GetExpandableNonCompositeForeignKey(col) + If fkColumn Is Nothing Then + Return Nothing + End If + Dim _DFKA As String = fkColumn.PrimaryKeyDisplayColumns + If (_DFKA.Trim().StartsWith("=")) Then + ' if the formula is in the format of "= ., then pull out the data from the rec object instead of doing formula evaluation + Dim tableCodeName As String = fkColumn.PrimaryKeyTableDefinition.TableCodeName + Dim column As String = _DFKA.Trim("="c).Trim() + If column.StartsWith(tableCodeName & ".", StringComparison.InvariantCultureIgnoreCase) Then + column = column.Substring(tableCodeName.Length + 1) + End If + + For Each c As BaseColumn In fkColumn.PrimaryKeyTableDefinition.Columns + If column = c.CodeName Then + Return rec.Format(c) + End If + Next + Dim tableName As String = fkColumn.PrimaryKeyTableDefinition.TableCodeName + Return EvaluateFormula(_DFKA, rec, Nothing, tableName) + Else + Return Nothing + End If + End Function + + ''' + ''' This method takes a keyValue and a Column and returns an evaluated value of DFKA formula. + ''' + Public Shared Function GetDFKA(ByVal keyValue As String, ByVal col As BaseColumn, ByVal formatPattern as String) As String + If keyValue Is Nothing Then + Return Nothing + End If + Dim fkColumn As ForeignKey = View_PersonsView.Instance.TableDefinition.GetExpandableNonCompositeForeignKey(col) + If fkColumn Is Nothing Then + Return Nothing + End If + Dim _DFKA As String = fkColumn.PrimaryKeyDisplayColumns + If (_DFKA.Trim().StartsWith("=")) Then + Dim tableName As String = fkColumn.PrimaryKeyTableDefinition.TableCodeName + Dim t As PrimaryKeyTable = CType(DatabaseObjects.GetTableObject(tableName), PrimaryKeyTable) + Dim rec As BaseRecord = Nothing + If Not t Is Nothing Then + Try + rec = CType(t.GetRecordData(keyValue, False), BaseRecord) + Catch + rec = Nothing + End Try + End If + If rec Is Nothing Then + Return "" + End If + + ' if the formula is in the format of "= ., then pull out the data from the rec object instead of doing formula evaluation + Dim tableCodeName As String = fkColumn.PrimaryKeyTableDefinition.TableCodeName + Dim column As String = _DFKA.Trim("="c).Trim() + If column.StartsWith(tableCodeName & ".", StringComparison.InvariantCultureIgnoreCase) Then + column = column.Substring(tableCodeName.Length + 1) + End If + + For Each c As BaseColumn In fkColumn.PrimaryKeyTableDefinition.Columns + If column = c.CodeName Then + Return rec.Format(c) + End If + Next + Return EvaluateFormula(_DFKA, rec, Nothing, tableName) + Else + Return Nothing + End If + End Function + + ''' + ''' Evaluates the formula + ''' + Public Shared Function EvaluateFormula(ByVal formula As String, Optional ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord = Nothing, Optional ByVal format As String = Nothing, Optional ByVal name As String = "") As String + Dim e As BaseFormulaEvaluator = New BaseFormulaEvaluator() + If Not dataSourceForEvaluate Is Nothing Then + e.Evaluator.Variables.Add(name, dataSourceForEvaluate) + end if + e.DataSource = dataSourceForEvaluate + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + If Not String.IsNullOrEmpty(format) Then + Return BaseFormulaUtils.Format(resultObj, format) + Else + Return resultObj.ToString() + End If + End Function + + +#End Region + +End Class +End Namespace diff --git a/App_Code/Business Layer/BloodIdRecord.vb b/App_Code/Business Layer/BloodIdRecord.vb new file mode 100644 index 0000000..939701a --- /dev/null +++ b/App_Code/Business Layer/BloodIdRecord.vb @@ -0,0 +1,35 @@ +' This is a "safe" class, meaning that it is created once +' and never overwritten. Any custom code you add to this class +' will be preserved when you regenerate your application. +' +' Typical customizations that may be done in this class include +' - adding custom event handlers +' - overriding base class methods + +Imports System.Data.SqlTypes +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + +Namespace Persons.Business + +''' +''' Provides access to the data in a database record. +''' Also provides access to the that each record is associated with. +''' +''' +''' +''' + + Public Class BloodIdRecord + Inherits BaseBloodIdRecord + + ' Constructors + + Public Sub New() + MyBase.New() + End Sub + + +End Class +End Namespace diff --git a/App_Code/Business Layer/BloodIdTable.vb b/App_Code/Business Layer/BloodIdTable.vb new file mode 100644 index 0000000..0f602c3 --- /dev/null +++ b/App_Code/Business Layer/BloodIdTable.vb @@ -0,0 +1,89 @@ +' This is a "safe" class, meaning that it is created once +' and never overwritten. Any custom code you add to this class +' will be preserved when you regenerate your application. +' +' Typical customizations that may be done in this class include +' - adding custom event handlers +' - overriding base class methods + +Imports System.Data.SqlTypes +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + +Namespace Persons.Business + +''' +''' Provides access to the schema information and record data of a database table (or view). +''' See for additional information. +''' +''' +''' See for additional information. +''' +''' This class is implemented using the Singleton design pattern. +''' +''' +''' This is a "safe" class, meaning that it is generated once and never overwritten. +''' Any changes you make to this class will be preserved when you regenerate your application. +''' +''' +''' +''' +''' +''' +''' +''' + + Public Class BloodIdTable + Inherits BaseBloodIdTable + Implements System.Runtime.Serialization.ISerializable, ISingleton + + +#Region "ISerializable Members" + + ''' + ''' Overridden to use the class + ''' for deserialization of data. + ''' + ''' + ''' Since the class is implemented using the Singleton design pattern, + ''' this method must be overridden to prevent additional instances from being created during deserialization. + ''' + Protected Overridable Sub GetObjectData( _ + ByVal info As System.Runtime.Serialization.SerializationInfo, _ + ByVal context As System.Runtime.Serialization.StreamingContext _ + ) Implements System.Runtime.Serialization.ISerializable.GetObjectData + info.SetType(GetType(BloodIdTable_SerializationHelper)) 'No other values need to be added + End Sub + +#Region "Class BloodIdTable_SerializationHelper" + + Private Class BloodIdTable_SerializationHelper + Implements System.Runtime.Serialization.IObjectReference + + 'Method called after this object is deserialized + Public Function GetRealObject(ByVal context As System.Runtime.Serialization.StreamingContext) As Object _ + Implements System.Runtime.Serialization.IObjectReference.GetRealObject + Return BloodIdTable.Instance + End Function + End Class + +#End Region + +#End Region + + ''' + ''' References the only instance of the class. + ''' + ''' + ''' Since the class is implemented using the Singleton design pattern, + ''' this field is the only way to access an instance of the class. + ''' + Public Shared ReadOnly Instance As New BloodIdTable() + + Private Sub New() + MyBase.New() + End Sub + +End Class ' BloodIdTable +End Namespace diff --git a/App_Code/Business Layer/BornRecord.vb b/App_Code/Business Layer/BornRecord.vb new file mode 100644 index 0000000..8d13ef9 --- /dev/null +++ b/App_Code/Business Layer/BornRecord.vb @@ -0,0 +1,35 @@ +' This is a "safe" class, meaning that it is created once +' and never overwritten. Any custom code you add to this class +' will be preserved when you regenerate your application. +' +' Typical customizations that may be done in this class include +' - adding custom event handlers +' - overriding base class methods + +Imports System.Data.SqlTypes +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + +Namespace Persons.Business + +''' +''' Provides access to the data in a database record. +''' Also provides access to the that each record is associated with. +''' +''' +''' +''' + + Public Class BornRecord + Inherits BaseBornRecord + + ' Constructors + + Public Sub New() + MyBase.New() + End Sub + + +End Class +End Namespace diff --git a/App_Code/Business Layer/BornTable.vb b/App_Code/Business Layer/BornTable.vb new file mode 100644 index 0000000..1745766 --- /dev/null +++ b/App_Code/Business Layer/BornTable.vb @@ -0,0 +1,89 @@ +' This is a "safe" class, meaning that it is created once +' and never overwritten. Any custom code you add to this class +' will be preserved when you regenerate your application. +' +' Typical customizations that may be done in this class include +' - adding custom event handlers +' - overriding base class methods + +Imports System.Data.SqlTypes +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + +Namespace Persons.Business + +''' +''' Provides access to the schema information and record data of a database table (or view). +''' See for additional information. +''' +''' +''' See for additional information. +''' +''' This class is implemented using the Singleton design pattern. +''' +''' +''' This is a "safe" class, meaning that it is generated once and never overwritten. +''' Any changes you make to this class will be preserved when you regenerate your application. +''' +''' +''' +''' +''' +''' +''' +''' + + Public Class BornTable + Inherits BaseBornTable + Implements System.Runtime.Serialization.ISerializable, ISingleton + + +#Region "ISerializable Members" + + ''' + ''' Overridden to use the class + ''' for deserialization of data. + ''' + ''' + ''' Since the class is implemented using the Singleton design pattern, + ''' this method must be overridden to prevent additional instances from being created during deserialization. + ''' + Protected Overridable Sub GetObjectData( _ + ByVal info As System.Runtime.Serialization.SerializationInfo, _ + ByVal context As System.Runtime.Serialization.StreamingContext _ + ) Implements System.Runtime.Serialization.ISerializable.GetObjectData + info.SetType(GetType(BornTable_SerializationHelper)) 'No other values need to be added + End Sub + +#Region "Class BornTable_SerializationHelper" + + Private Class BornTable_SerializationHelper + Implements System.Runtime.Serialization.IObjectReference + + 'Method called after this object is deserialized + Public Function GetRealObject(ByVal context As System.Runtime.Serialization.StreamingContext) As Object _ + Implements System.Runtime.Serialization.IObjectReference.GetRealObject + Return BornTable.Instance + End Function + End Class + +#End Region + +#End Region + + ''' + ''' References the only instance of the class. + ''' + ''' + ''' Since the class is implemented using the Singleton design pattern, + ''' this field is the only way to access an instance of the class. + ''' + Public Shared ReadOnly Instance As New BornTable() + + Private Sub New() + MyBase.New() + End Sub + +End Class ' BornTable +End Namespace diff --git a/App_Code/Business Layer/CountryRecord.vb b/App_Code/Business Layer/CountryRecord.vb new file mode 100644 index 0000000..d9ec32f --- /dev/null +++ b/App_Code/Business Layer/CountryRecord.vb @@ -0,0 +1,35 @@ +' This is a "safe" class, meaning that it is created once +' and never overwritten. Any custom code you add to this class +' will be preserved when you regenerate your application. +' +' Typical customizations that may be done in this class include +' - adding custom event handlers +' - overriding base class methods + +Imports System.Data.SqlTypes +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + +Namespace Persons.Business + +''' +''' Provides access to the data in a database record. +''' Also provides access to the that each record is associated with. +''' +''' +''' +''' + + Public Class CountryRecord + Inherits BaseCountryRecord + + ' Constructors + + Public Sub New() + MyBase.New() + End Sub + + +End Class +End Namespace diff --git a/App_Code/Business Layer/CountryTable.vb b/App_Code/Business Layer/CountryTable.vb new file mode 100644 index 0000000..07f7c0e --- /dev/null +++ b/App_Code/Business Layer/CountryTable.vb @@ -0,0 +1,89 @@ +' This is a "safe" class, meaning that it is created once +' and never overwritten. Any custom code you add to this class +' will be preserved when you regenerate your application. +' +' Typical customizations that may be done in this class include +' - adding custom event handlers +' - overriding base class methods + +Imports System.Data.SqlTypes +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + +Namespace Persons.Business + +''' +''' Provides access to the schema information and record data of a database table (or view). +''' See for additional information. +''' +''' +''' See for additional information. +''' +''' This class is implemented using the Singleton design pattern. +''' +''' +''' This is a "safe" class, meaning that it is generated once and never overwritten. +''' Any changes you make to this class will be preserved when you regenerate your application. +''' +''' +''' +''' +''' +''' +''' +''' + + Public Class CountryTable + Inherits BaseCountryTable + Implements System.Runtime.Serialization.ISerializable, ISingleton + + +#Region "ISerializable Members" + + ''' + ''' Overridden to use the class + ''' for deserialization of data. + ''' + ''' + ''' Since the class is implemented using the Singleton design pattern, + ''' this method must be overridden to prevent additional instances from being created during deserialization. + ''' + Protected Overridable Sub GetObjectData( _ + ByVal info As System.Runtime.Serialization.SerializationInfo, _ + ByVal context As System.Runtime.Serialization.StreamingContext _ + ) Implements System.Runtime.Serialization.ISerializable.GetObjectData + info.SetType(GetType(CountryTable_SerializationHelper)) 'No other values need to be added + End Sub + +#Region "Class CountryTable_SerializationHelper" + + Private Class CountryTable_SerializationHelper + Implements System.Runtime.Serialization.IObjectReference + + 'Method called after this object is deserialized + Public Function GetRealObject(ByVal context As System.Runtime.Serialization.StreamingContext) As Object _ + Implements System.Runtime.Serialization.IObjectReference.GetRealObject + Return CountryTable.Instance + End Function + End Class + +#End Region + +#End Region + + ''' + ''' References the only instance of the class. + ''' + ''' + ''' Since the class is implemented using the Singleton design pattern, + ''' this field is the only way to access an instance of the class. + ''' + Public Shared ReadOnly Instance As New CountryTable() + + Private Sub New() + MyBase.New() + End Sub + +End Class ' CountryTable +End Namespace diff --git a/App_Code/Business Layer/DeptRecord.vb b/App_Code/Business Layer/DeptRecord.vb new file mode 100644 index 0000000..0d0122f --- /dev/null +++ b/App_Code/Business Layer/DeptRecord.vb @@ -0,0 +1,35 @@ +' This is a "safe" class, meaning that it is created once +' and never overwritten. Any custom code you add to this class +' will be preserved when you regenerate your application. +' +' Typical customizations that may be done in this class include +' - adding custom event handlers +' - overriding base class methods + +Imports System.Data.SqlTypes +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + +Namespace Persons.Business + +''' +''' Provides access to the data in a database record. +''' Also provides access to the that each record is associated with. +''' +''' +''' +''' + + Public Class DeptRecord + Inherits BaseDeptRecord + + ' Constructors + + Public Sub New() + MyBase.New() + End Sub + + +End Class +End Namespace diff --git a/App_Code/Business Layer/DeptTable.vb b/App_Code/Business Layer/DeptTable.vb new file mode 100644 index 0000000..2e21d3c --- /dev/null +++ b/App_Code/Business Layer/DeptTable.vb @@ -0,0 +1,89 @@ +' This is a "safe" class, meaning that it is created once +' and never overwritten. Any custom code you add to this class +' will be preserved when you regenerate your application. +' +' Typical customizations that may be done in this class include +' - adding custom event handlers +' - overriding base class methods + +Imports System.Data.SqlTypes +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + +Namespace Persons.Business + +''' +''' Provides access to the schema information and record data of a database table (or view). +''' See for additional information. +''' +''' +''' See for additional information. +''' +''' This class is implemented using the Singleton design pattern. +''' +''' +''' This is a "safe" class, meaning that it is generated once and never overwritten. +''' Any changes you make to this class will be preserved when you regenerate your application. +''' +''' +''' +''' +''' +''' +''' +''' + + Public Class DeptTable + Inherits BaseDeptTable + Implements System.Runtime.Serialization.ISerializable, ISingleton + + +#Region "ISerializable Members" + + ''' + ''' Overridden to use the class + ''' for deserialization of data. + ''' + ''' + ''' Since the class is implemented using the Singleton design pattern, + ''' this method must be overridden to prevent additional instances from being created during deserialization. + ''' + Protected Overridable Sub GetObjectData( _ + ByVal info As System.Runtime.Serialization.SerializationInfo, _ + ByVal context As System.Runtime.Serialization.StreamingContext _ + ) Implements System.Runtime.Serialization.ISerializable.GetObjectData + info.SetType(GetType(DeptTable_SerializationHelper)) 'No other values need to be added + End Sub + +#Region "Class DeptTable_SerializationHelper" + + Private Class DeptTable_SerializationHelper + Implements System.Runtime.Serialization.IObjectReference + + 'Method called after this object is deserialized + Public Function GetRealObject(ByVal context As System.Runtime.Serialization.StreamingContext) As Object _ + Implements System.Runtime.Serialization.IObjectReference.GetRealObject + Return DeptTable.Instance + End Function + End Class + +#End Region + +#End Region + + ''' + ''' References the only instance of the class. + ''' + ''' + ''' Since the class is implemented using the Singleton design pattern, + ''' this field is the only way to access an instance of the class. + ''' + Public Shared ReadOnly Instance As New DeptTable() + + Private Sub New() + MyBase.New() + End Sub + +End Class ' DeptTable +End Namespace diff --git a/App_Code/Business Layer/EducationPeriodRecord.vb b/App_Code/Business Layer/EducationPeriodRecord.vb new file mode 100644 index 0000000..8b2c2d6 --- /dev/null +++ b/App_Code/Business Layer/EducationPeriodRecord.vb @@ -0,0 +1,35 @@ +' This is a "safe" class, meaning that it is created once +' and never overwritten. Any custom code you add to this class +' will be preserved when you regenerate your application. +' +' Typical customizations that may be done in this class include +' - adding custom event handlers +' - overriding base class methods + +Imports System.Data.SqlTypes +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + +Namespace Persons.Business + +''' +''' Provides access to the data in a database record. +''' Also provides access to the that each record is associated with. +''' +''' +''' +''' + + Public Class EducationPeriodRecord + Inherits BaseEducationPeriodRecord + + ' Constructors + + Public Sub New() + MyBase.New() + End Sub + + +End Class +End Namespace diff --git a/App_Code/Business Layer/EducationPeriodTable.vb b/App_Code/Business Layer/EducationPeriodTable.vb new file mode 100644 index 0000000..0ddcdfb --- /dev/null +++ b/App_Code/Business Layer/EducationPeriodTable.vb @@ -0,0 +1,89 @@ +' This is a "safe" class, meaning that it is created once +' and never overwritten. Any custom code you add to this class +' will be preserved when you regenerate your application. +' +' Typical customizations that may be done in this class include +' - adding custom event handlers +' - overriding base class methods + +Imports System.Data.SqlTypes +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + +Namespace Persons.Business + +''' +''' Provides access to the schema information and record data of a database table (or view). +''' See for additional information. +''' +''' +''' See for additional information. +''' +''' This class is implemented using the Singleton design pattern. +''' +''' +''' This is a "safe" class, meaning that it is generated once and never overwritten. +''' Any changes you make to this class will be preserved when you regenerate your application. +''' +''' +''' +''' +''' +''' +''' +''' + + Public Class EducationPeriodTable + Inherits BaseEducationPeriodTable + Implements System.Runtime.Serialization.ISerializable, ISingleton + + +#Region "ISerializable Members" + + ''' + ''' Overridden to use the class + ''' for deserialization of data. + ''' + ''' + ''' Since the class is implemented using the Singleton design pattern, + ''' this method must be overridden to prevent additional instances from being created during deserialization. + ''' + Protected Overridable Sub GetObjectData( _ + ByVal info As System.Runtime.Serialization.SerializationInfo, _ + ByVal context As System.Runtime.Serialization.StreamingContext _ + ) Implements System.Runtime.Serialization.ISerializable.GetObjectData + info.SetType(GetType(EducationPeriodTable_SerializationHelper)) 'No other values need to be added + End Sub + +#Region "Class EducationPeriodTable_SerializationHelper" + + Private Class EducationPeriodTable_SerializationHelper + Implements System.Runtime.Serialization.IObjectReference + + 'Method called after this object is deserialized + Public Function GetRealObject(ByVal context As System.Runtime.Serialization.StreamingContext) As Object _ + Implements System.Runtime.Serialization.IObjectReference.GetRealObject + Return EducationPeriodTable.Instance + End Function + End Class + +#End Region + +#End Region + + ''' + ''' References the only instance of the class. + ''' + ''' + ''' Since the class is implemented using the Singleton design pattern, + ''' this field is the only way to access an instance of the class. + ''' + Public Shared ReadOnly Instance As New EducationPeriodTable() + + Private Sub New() + MyBase.New() + End Sub + +End Class ' EducationPeriodTable +End Namespace diff --git a/App_Code/Business Layer/EducationRecord.vb b/App_Code/Business Layer/EducationRecord.vb new file mode 100644 index 0000000..b2d645c --- /dev/null +++ b/App_Code/Business Layer/EducationRecord.vb @@ -0,0 +1,35 @@ +' This is a "safe" class, meaning that it is created once +' and never overwritten. Any custom code you add to this class +' will be preserved when you regenerate your application. +' +' Typical customizations that may be done in this class include +' - adding custom event handlers +' - overriding base class methods + +Imports System.Data.SqlTypes +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + +Namespace Persons.Business + +''' +''' Provides access to the data in a database record. +''' Also provides access to the that each record is associated with. +''' +''' +''' +''' + + Public Class EducationRecord + Inherits BaseEducationRecord + + ' Constructors + + Public Sub New() + MyBase.New() + End Sub + + +End Class +End Namespace diff --git a/App_Code/Business Layer/EducationTable.vb b/App_Code/Business Layer/EducationTable.vb new file mode 100644 index 0000000..00ede49 --- /dev/null +++ b/App_Code/Business Layer/EducationTable.vb @@ -0,0 +1,89 @@ +' This is a "safe" class, meaning that it is created once +' and never overwritten. Any custom code you add to this class +' will be preserved when you regenerate your application. +' +' Typical customizations that may be done in this class include +' - adding custom event handlers +' - overriding base class methods + +Imports System.Data.SqlTypes +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + +Namespace Persons.Business + +''' +''' Provides access to the schema information and record data of a database table (or view). +''' See for additional information. +''' +''' +''' See for additional information. +''' +''' This class is implemented using the Singleton design pattern. +''' +''' +''' This is a "safe" class, meaning that it is generated once and never overwritten. +''' Any changes you make to this class will be preserved when you regenerate your application. +''' +''' +''' +''' +''' +''' +''' +''' + + Public Class EducationTable + Inherits BaseEducationTable + Implements System.Runtime.Serialization.ISerializable, ISingleton + + +#Region "ISerializable Members" + + ''' + ''' Overridden to use the class + ''' for deserialization of data. + ''' + ''' + ''' Since the class is implemented using the Singleton design pattern, + ''' this method must be overridden to prevent additional instances from being created during deserialization. + ''' + Protected Overridable Sub GetObjectData( _ + ByVal info As System.Runtime.Serialization.SerializationInfo, _ + ByVal context As System.Runtime.Serialization.StreamingContext _ + ) Implements System.Runtime.Serialization.ISerializable.GetObjectData + info.SetType(GetType(EducationTable_SerializationHelper)) 'No other values need to be added + End Sub + +#Region "Class EducationTable_SerializationHelper" + + Private Class EducationTable_SerializationHelper + Implements System.Runtime.Serialization.IObjectReference + + 'Method called after this object is deserialized + Public Function GetRealObject(ByVal context As System.Runtime.Serialization.StreamingContext) As Object _ + Implements System.Runtime.Serialization.IObjectReference.GetRealObject + Return EducationTable.Instance + End Function + End Class + +#End Region + +#End Region + + ''' + ''' References the only instance of the class. + ''' + ''' + ''' Since the class is implemented using the Singleton design pattern, + ''' this field is the only way to access an instance of the class. + ''' + Public Shared ReadOnly Instance As New EducationTable() + + Private Sub New() + MyBase.New() + End Sub + +End Class ' EducationTable +End Namespace diff --git a/App_Code/Business Layer/ExTraSalaryRecord.vb b/App_Code/Business Layer/ExTraSalaryRecord.vb new file mode 100644 index 0000000..8b9f2f0 --- /dev/null +++ b/App_Code/Business Layer/ExTraSalaryRecord.vb @@ -0,0 +1,35 @@ +' This is a "safe" class, meaning that it is created once +' and never overwritten. Any custom code you add to this class +' will be preserved when you regenerate your application. +' +' Typical customizations that may be done in this class include +' - adding custom event handlers +' - overriding base class methods + +Imports System.Data.SqlTypes +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + +Namespace Persons.Business + +''' +''' Provides access to the data in a database record. +''' Also provides access to the that each record is associated with. +''' +''' +''' +''' + + Public Class ExTraSalaryRecord + Inherits BaseExTraSalaryRecord + + ' Constructors + + Public Sub New() + MyBase.New() + End Sub + + +End Class +End Namespace diff --git a/App_Code/Business Layer/ExTraSalaryTable.vb b/App_Code/Business Layer/ExTraSalaryTable.vb new file mode 100644 index 0000000..5260e3a --- /dev/null +++ b/App_Code/Business Layer/ExTraSalaryTable.vb @@ -0,0 +1,89 @@ +' This is a "safe" class, meaning that it is created once +' and never overwritten. Any custom code you add to this class +' will be preserved when you regenerate your application. +' +' Typical customizations that may be done in this class include +' - adding custom event handlers +' - overriding base class methods + +Imports System.Data.SqlTypes +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + +Namespace Persons.Business + +''' +''' Provides access to the schema information and record data of a database table (or view). +''' See for additional information. +''' +''' +''' See for additional information. +''' +''' This class is implemented using the Singleton design pattern. +''' +''' +''' This is a "safe" class, meaning that it is generated once and never overwritten. +''' Any changes you make to this class will be preserved when you regenerate your application. +''' +''' +''' +''' +''' +''' +''' +''' + + Public Class ExTraSalaryTable + Inherits BaseExTraSalaryTable + Implements System.Runtime.Serialization.ISerializable, ISingleton + + +#Region "ISerializable Members" + + ''' + ''' Overridden to use the class + ''' for deserialization of data. + ''' + ''' + ''' Since the class is implemented using the Singleton design pattern, + ''' this method must be overridden to prevent additional instances from being created during deserialization. + ''' + Protected Overridable Sub GetObjectData( _ + ByVal info As System.Runtime.Serialization.SerializationInfo, _ + ByVal context As System.Runtime.Serialization.StreamingContext _ + ) Implements System.Runtime.Serialization.ISerializable.GetObjectData + info.SetType(GetType(ExTraSalaryTable_SerializationHelper)) 'No other values need to be added + End Sub + +#Region "Class ExTraSalaryTable_SerializationHelper" + + Private Class ExTraSalaryTable_SerializationHelper + Implements System.Runtime.Serialization.IObjectReference + + 'Method called after this object is deserialized + Public Function GetRealObject(ByVal context As System.Runtime.Serialization.StreamingContext) As Object _ + Implements System.Runtime.Serialization.IObjectReference.GetRealObject + Return ExTraSalaryTable.Instance + End Function + End Class + +#End Region + +#End Region + + ''' + ''' References the only instance of the class. + ''' + ''' + ''' Since the class is implemented using the Singleton design pattern, + ''' this field is the only way to access an instance of the class. + ''' + Public Shared ReadOnly Instance As New ExTraSalaryTable() + + Private Sub New() + MyBase.New() + End Sub + +End Class ' ExTraSalaryTable +End Namespace diff --git a/App_Code/Business Layer/InsigniaRecord.vb b/App_Code/Business Layer/InsigniaRecord.vb new file mode 100644 index 0000000..f0f5811 --- /dev/null +++ b/App_Code/Business Layer/InsigniaRecord.vb @@ -0,0 +1,35 @@ +' This is a "safe" class, meaning that it is created once +' and never overwritten. Any custom code you add to this class +' will be preserved when you regenerate your application. +' +' Typical customizations that may be done in this class include +' - adding custom event handlers +' - overriding base class methods + +Imports System.Data.SqlTypes +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + +Namespace Persons.Business + +''' +''' Provides access to the data in a database record. +''' Also provides access to the that each record is associated with. +''' +''' +''' +''' + + Public Class InsigniaRecord + Inherits BaseInsigniaRecord + + ' Constructors + + Public Sub New() + MyBase.New() + End Sub + + +End Class +End Namespace diff --git a/App_Code/Business Layer/InsigniaTable.vb b/App_Code/Business Layer/InsigniaTable.vb new file mode 100644 index 0000000..b9c426a --- /dev/null +++ b/App_Code/Business Layer/InsigniaTable.vb @@ -0,0 +1,89 @@ +' This is a "safe" class, meaning that it is created once +' and never overwritten. Any custom code you add to this class +' will be preserved when you regenerate your application. +' +' Typical customizations that may be done in this class include +' - adding custom event handlers +' - overriding base class methods + +Imports System.Data.SqlTypes +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + +Namespace Persons.Business + +''' +''' Provides access to the schema information and record data of a database table (or view). +''' See for additional information. +''' +''' +''' See for additional information. +''' +''' This class is implemented using the Singleton design pattern. +''' +''' +''' This is a "safe" class, meaning that it is generated once and never overwritten. +''' Any changes you make to this class will be preserved when you regenerate your application. +''' +''' +''' +''' +''' +''' +''' +''' + + Public Class InsigniaTable + Inherits BaseInsigniaTable + Implements System.Runtime.Serialization.ISerializable, ISingleton + + +#Region "ISerializable Members" + + ''' + ''' Overridden to use the class + ''' for deserialization of data. + ''' + ''' + ''' Since the class is implemented using the Singleton design pattern, + ''' this method must be overridden to prevent additional instances from being created during deserialization. + ''' + Protected Overridable Sub GetObjectData( _ + ByVal info As System.Runtime.Serialization.SerializationInfo, _ + ByVal context As System.Runtime.Serialization.StreamingContext _ + ) Implements System.Runtime.Serialization.ISerializable.GetObjectData + info.SetType(GetType(InsigniaTable_SerializationHelper)) 'No other values need to be added + End Sub + +#Region "Class InsigniaTable_SerializationHelper" + + Private Class InsigniaTable_SerializationHelper + Implements System.Runtime.Serialization.IObjectReference + + 'Method called after this object is deserialized + Public Function GetRealObject(ByVal context As System.Runtime.Serialization.StreamingContext) As Object _ + Implements System.Runtime.Serialization.IObjectReference.GetRealObject + Return InsigniaTable.Instance + End Function + End Class + +#End Region + +#End Region + + ''' + ''' References the only instance of the class. + ''' + ''' + ''' Since the class is implemented using the Singleton design pattern, + ''' this field is the only way to access an instance of the class. + ''' + Public Shared ReadOnly Instance As New InsigniaTable() + + Private Sub New() + MyBase.New() + End Sub + +End Class ' InsigniaTable +End Namespace diff --git a/App_Code/Business Layer/LanguageRecord.vb b/App_Code/Business Layer/LanguageRecord.vb new file mode 100644 index 0000000..ef32dca --- /dev/null +++ b/App_Code/Business Layer/LanguageRecord.vb @@ -0,0 +1,35 @@ +' This is a "safe" class, meaning that it is created once +' and never overwritten. Any custom code you add to this class +' will be preserved when you regenerate your application. +' +' Typical customizations that may be done in this class include +' - adding custom event handlers +' - overriding base class methods + +Imports System.Data.SqlTypes +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + +Namespace Persons.Business + +''' +''' Provides access to the data in a database record. +''' Also provides access to the that each record is associated with. +''' +''' +''' +''' + + Public Class LanguageRecord + Inherits BaseLanguageRecord + + ' Constructors + + Public Sub New() + MyBase.New() + End Sub + + +End Class +End Namespace diff --git a/App_Code/Business Layer/LanguageTable.vb b/App_Code/Business Layer/LanguageTable.vb new file mode 100644 index 0000000..8dfa080 --- /dev/null +++ b/App_Code/Business Layer/LanguageTable.vb @@ -0,0 +1,89 @@ +' This is a "safe" class, meaning that it is created once +' and never overwritten. Any custom code you add to this class +' will be preserved when you regenerate your application. +' +' Typical customizations that may be done in this class include +' - adding custom event handlers +' - overriding base class methods + +Imports System.Data.SqlTypes +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + +Namespace Persons.Business + +''' +''' Provides access to the schema information and record data of a database table (or view). +''' See for additional information. +''' +''' +''' See for additional information. +''' +''' This class is implemented using the Singleton design pattern. +''' +''' +''' This is a "safe" class, meaning that it is generated once and never overwritten. +''' Any changes you make to this class will be preserved when you regenerate your application. +''' +''' +''' +''' +''' +''' +''' +''' + + Public Class LanguageTable + Inherits BaseLanguageTable + Implements System.Runtime.Serialization.ISerializable, ISingleton + + +#Region "ISerializable Members" + + ''' + ''' Overridden to use the class + ''' for deserialization of data. + ''' + ''' + ''' Since the class is implemented using the Singleton design pattern, + ''' this method must be overridden to prevent additional instances from being created during deserialization. + ''' + Protected Overridable Sub GetObjectData( _ + ByVal info As System.Runtime.Serialization.SerializationInfo, _ + ByVal context As System.Runtime.Serialization.StreamingContext _ + ) Implements System.Runtime.Serialization.ISerializable.GetObjectData + info.SetType(GetType(LanguageTable_SerializationHelper)) 'No other values need to be added + End Sub + +#Region "Class LanguageTable_SerializationHelper" + + Private Class LanguageTable_SerializationHelper + Implements System.Runtime.Serialization.IObjectReference + + 'Method called after this object is deserialized + Public Function GetRealObject(ByVal context As System.Runtime.Serialization.StreamingContext) As Object _ + Implements System.Runtime.Serialization.IObjectReference.GetRealObject + Return LanguageTable.Instance + End Function + End Class + +#End Region + +#End Region + + ''' + ''' References the only instance of the class. + ''' + ''' + ''' Since the class is implemented using the Singleton design pattern, + ''' this field is the only way to access an instance of the class. + ''' + Public Shared ReadOnly Instance As New LanguageTable() + + Private Sub New() + MyBase.New() + End Sub + +End Class ' LanguageTable +End Namespace diff --git a/App_Code/Business Layer/PersonRelativeRecord.vb b/App_Code/Business Layer/PersonRelativeRecord.vb new file mode 100644 index 0000000..45180c7 --- /dev/null +++ b/App_Code/Business Layer/PersonRelativeRecord.vb @@ -0,0 +1,35 @@ +' This is a "safe" class, meaning that it is created once +' and never overwritten. Any custom code you add to this class +' will be preserved when you regenerate your application. +' +' Typical customizations that may be done in this class include +' - adding custom event handlers +' - overriding base class methods + +Imports System.Data.SqlTypes +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + +Namespace Persons.Business + +''' +''' Provides access to the data in a database record. +''' Also provides access to the that each record is associated with. +''' +''' +''' +''' + + Public Class PersonRelativeRecord + Inherits BasePersonRelativeRecord + + ' Constructors + + Public Sub New() + MyBase.New() + End Sub + + +End Class +End Namespace diff --git a/App_Code/Business Layer/PersonRelativeTable.vb b/App_Code/Business Layer/PersonRelativeTable.vb new file mode 100644 index 0000000..95084b3 --- /dev/null +++ b/App_Code/Business Layer/PersonRelativeTable.vb @@ -0,0 +1,89 @@ +' This is a "safe" class, meaning that it is created once +' and never overwritten. Any custom code you add to this class +' will be preserved when you regenerate your application. +' +' Typical customizations that may be done in this class include +' - adding custom event handlers +' - overriding base class methods + +Imports System.Data.SqlTypes +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + +Namespace Persons.Business + +''' +''' Provides access to the schema information and record data of a database table (or view). +''' See for additional information. +''' +''' +''' See for additional information. +''' +''' This class is implemented using the Singleton design pattern. +''' +''' +''' This is a "safe" class, meaning that it is generated once and never overwritten. +''' Any changes you make to this class will be preserved when you regenerate your application. +''' +''' +''' +''' +''' +''' +''' +''' + + Public Class PersonRelativeTable + Inherits BasePersonRelativeTable + Implements System.Runtime.Serialization.ISerializable, ISingleton + + +#Region "ISerializable Members" + + ''' + ''' Overridden to use the class + ''' for deserialization of data. + ''' + ''' + ''' Since the class is implemented using the Singleton design pattern, + ''' this method must be overridden to prevent additional instances from being created during deserialization. + ''' + Protected Overridable Sub GetObjectData( _ + ByVal info As System.Runtime.Serialization.SerializationInfo, _ + ByVal context As System.Runtime.Serialization.StreamingContext _ + ) Implements System.Runtime.Serialization.ISerializable.GetObjectData + info.SetType(GetType(PersonRelativeTable_SerializationHelper)) 'No other values need to be added + End Sub + +#Region "Class PersonRelativeTable_SerializationHelper" + + Private Class PersonRelativeTable_SerializationHelper + Implements System.Runtime.Serialization.IObjectReference + + 'Method called after this object is deserialized + Public Function GetRealObject(ByVal context As System.Runtime.Serialization.StreamingContext) As Object _ + Implements System.Runtime.Serialization.IObjectReference.GetRealObject + Return PersonRelativeTable.Instance + End Function + End Class + +#End Region + +#End Region + + ''' + ''' References the only instance of the class. + ''' + ''' + ''' Since the class is implemented using the Singleton design pattern, + ''' this field is the only way to access an instance of the class. + ''' + Public Shared ReadOnly Instance As New PersonRelativeTable() + + Private Sub New() + MyBase.New() + End Sub + +End Class ' PersonRelativeTable +End Namespace diff --git a/App_Code/Business Layer/PersonalDDRecord.vb b/App_Code/Business Layer/PersonalDDRecord.vb new file mode 100644 index 0000000..6b03f97 --- /dev/null +++ b/App_Code/Business Layer/PersonalDDRecord.vb @@ -0,0 +1,35 @@ +' This is a "safe" class, meaning that it is created once +' and never overwritten. Any custom code you add to this class +' will be preserved when you regenerate your application. +' +' Typical customizations that may be done in this class include +' - adding custom event handlers +' - overriding base class methods + +Imports System.Data.SqlTypes +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + +Namespace Persons.Business + +''' +''' Provides access to the data in a database record. +''' Also provides access to the that each record is associated with. +''' +''' +''' +''' + + Public Class PersonalDDRecord + Inherits BasePersonalDDRecord + + ' Constructors + + Public Sub New() + MyBase.New() + End Sub + + +End Class +End Namespace diff --git a/App_Code/Business Layer/PersonalDDTable.vb b/App_Code/Business Layer/PersonalDDTable.vb new file mode 100644 index 0000000..2962405 --- /dev/null +++ b/App_Code/Business Layer/PersonalDDTable.vb @@ -0,0 +1,89 @@ +' This is a "safe" class, meaning that it is created once +' and never overwritten. Any custom code you add to this class +' will be preserved when you regenerate your application. +' +' Typical customizations that may be done in this class include +' - adding custom event handlers +' - overriding base class methods + +Imports System.Data.SqlTypes +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + +Namespace Persons.Business + +''' +''' Provides access to the schema information and record data of a database table (or view). +''' See for additional information. +''' +''' +''' See for additional information. +''' +''' This class is implemented using the Singleton design pattern. +''' +''' +''' This is a "safe" class, meaning that it is generated once and never overwritten. +''' Any changes you make to this class will be preserved when you regenerate your application. +''' +''' +''' +''' +''' +''' +''' +''' + + Public Class PersonalDDTable + Inherits BasePersonalDDTable + Implements System.Runtime.Serialization.ISerializable, ISingleton + + +#Region "ISerializable Members" + + ''' + ''' Overridden to use the class + ''' for deserialization of data. + ''' + ''' + ''' Since the class is implemented using the Singleton design pattern, + ''' this method must be overridden to prevent additional instances from being created during deserialization. + ''' + Protected Overridable Sub GetObjectData( _ + ByVal info As System.Runtime.Serialization.SerializationInfo, _ + ByVal context As System.Runtime.Serialization.StreamingContext _ + ) Implements System.Runtime.Serialization.ISerializable.GetObjectData + info.SetType(GetType(PersonalDDTable_SerializationHelper)) 'No other values need to be added + End Sub + +#Region "Class PersonalDDTable_SerializationHelper" + + Private Class PersonalDDTable_SerializationHelper + Implements System.Runtime.Serialization.IObjectReference + + 'Method called after this object is deserialized + Public Function GetRealObject(ByVal context As System.Runtime.Serialization.StreamingContext) As Object _ + Implements System.Runtime.Serialization.IObjectReference.GetRealObject + Return PersonalDDTable.Instance + End Function + End Class + +#End Region + +#End Region + + ''' + ''' References the only instance of the class. + ''' + ''' + ''' Since the class is implemented using the Singleton design pattern, + ''' this field is the only way to access an instance of the class. + ''' + Public Shared ReadOnly Instance As New PersonalDDTable() + + Private Sub New() + MyBase.New() + End Sub + +End Class ' PersonalDDTable +End Namespace diff --git a/App_Code/Business Layer/PersonalDailyJobRecord.vb b/App_Code/Business Layer/PersonalDailyJobRecord.vb new file mode 100644 index 0000000..ee24bce --- /dev/null +++ b/App_Code/Business Layer/PersonalDailyJobRecord.vb @@ -0,0 +1,35 @@ +' This is a "safe" class, meaning that it is created once +' and never overwritten. Any custom code you add to this class +' will be preserved when you regenerate your application. +' +' Typical customizations that may be done in this class include +' - adding custom event handlers +' - overriding base class methods + +Imports System.Data.SqlTypes +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + +Namespace Persons.Business + +''' +''' Provides access to the data in a database record. +''' Also provides access to the that each record is associated with. +''' +''' +''' +''' + + Public Class PersonalDailyJobRecord + Inherits BasePersonalDailyJobRecord + + ' Constructors + + Public Sub New() + MyBase.New() + End Sub + + +End Class +End Namespace diff --git a/App_Code/Business Layer/PersonalDailyJobTable.vb b/App_Code/Business Layer/PersonalDailyJobTable.vb new file mode 100644 index 0000000..1583ed8 --- /dev/null +++ b/App_Code/Business Layer/PersonalDailyJobTable.vb @@ -0,0 +1,89 @@ +' This is a "safe" class, meaning that it is created once +' and never overwritten. Any custom code you add to this class +' will be preserved when you regenerate your application. +' +' Typical customizations that may be done in this class include +' - adding custom event handlers +' - overriding base class methods + +Imports System.Data.SqlTypes +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + +Namespace Persons.Business + +''' +''' Provides access to the schema information and record data of a database table (or view). +''' See for additional information. +''' +''' +''' See for additional information. +''' +''' This class is implemented using the Singleton design pattern. +''' +''' +''' This is a "safe" class, meaning that it is generated once and never overwritten. +''' Any changes you make to this class will be preserved when you regenerate your application. +''' +''' +''' +''' +''' +''' +''' +''' + + Public Class PersonalDailyJobTable + Inherits BasePersonalDailyJobTable + Implements System.Runtime.Serialization.ISerializable, ISingleton + + +#Region "ISerializable Members" + + ''' + ''' Overridden to use the class + ''' for deserialization of data. + ''' + ''' + ''' Since the class is implemented using the Singleton design pattern, + ''' this method must be overridden to prevent additional instances from being created during deserialization. + ''' + Protected Overridable Sub GetObjectData( _ + ByVal info As System.Runtime.Serialization.SerializationInfo, _ + ByVal context As System.Runtime.Serialization.StreamingContext _ + ) Implements System.Runtime.Serialization.ISerializable.GetObjectData + info.SetType(GetType(PersonalDailyJobTable_SerializationHelper)) 'No other values need to be added + End Sub + +#Region "Class PersonalDailyJobTable_SerializationHelper" + + Private Class PersonalDailyJobTable_SerializationHelper + Implements System.Runtime.Serialization.IObjectReference + + 'Method called after this object is deserialized + Public Function GetRealObject(ByVal context As System.Runtime.Serialization.StreamingContext) As Object _ + Implements System.Runtime.Serialization.IObjectReference.GetRealObject + Return PersonalDailyJobTable.Instance + End Function + End Class + +#End Region + +#End Region + + ''' + ''' References the only instance of the class. + ''' + ''' + ''' Since the class is implemented using the Singleton design pattern, + ''' this field is the only way to access an instance of the class. + ''' + Public Shared ReadOnly Instance As New PersonalDailyJobTable() + + Private Sub New() + MyBase.New() + End Sub + +End Class ' PersonalDailyJobTable +End Namespace diff --git a/App_Code/Business Layer/PersonalEducationRecord.vb b/App_Code/Business Layer/PersonalEducationRecord.vb new file mode 100644 index 0000000..aeead25 --- /dev/null +++ b/App_Code/Business Layer/PersonalEducationRecord.vb @@ -0,0 +1,35 @@ +' This is a "safe" class, meaning that it is created once +' and never overwritten. Any custom code you add to this class +' will be preserved when you regenerate your application. +' +' Typical customizations that may be done in this class include +' - adding custom event handlers +' - overriding base class methods + +Imports System.Data.SqlTypes +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + +Namespace Persons.Business + +''' +''' Provides access to the data in a database record. +''' Also provides access to the that each record is associated with. +''' +''' +''' +''' + + Public Class PersonalEducationRecord + Inherits BasePersonalEducationRecord + + ' Constructors + + Public Sub New() + MyBase.New() + End Sub + + +End Class +End Namespace diff --git a/App_Code/Business Layer/PersonalEducationTable.vb b/App_Code/Business Layer/PersonalEducationTable.vb new file mode 100644 index 0000000..9a0dc68 --- /dev/null +++ b/App_Code/Business Layer/PersonalEducationTable.vb @@ -0,0 +1,89 @@ +' This is a "safe" class, meaning that it is created once +' and never overwritten. Any custom code you add to this class +' will be preserved when you regenerate your application. +' +' Typical customizations that may be done in this class include +' - adding custom event handlers +' - overriding base class methods + +Imports System.Data.SqlTypes +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + +Namespace Persons.Business + +''' +''' Provides access to the schema information and record data of a database table (or view). +''' See for additional information. +''' +''' +''' See for additional information. +''' +''' This class is implemented using the Singleton design pattern. +''' +''' +''' This is a "safe" class, meaning that it is generated once and never overwritten. +''' Any changes you make to this class will be preserved when you regenerate your application. +''' +''' +''' +''' +''' +''' +''' +''' + + Public Class PersonalEducationTable + Inherits BasePersonalEducationTable + Implements System.Runtime.Serialization.ISerializable, ISingleton + + +#Region "ISerializable Members" + + ''' + ''' Overridden to use the class + ''' for deserialization of data. + ''' + ''' + ''' Since the class is implemented using the Singleton design pattern, + ''' this method must be overridden to prevent additional instances from being created during deserialization. + ''' + Protected Overridable Sub GetObjectData( _ + ByVal info As System.Runtime.Serialization.SerializationInfo, _ + ByVal context As System.Runtime.Serialization.StreamingContext _ + ) Implements System.Runtime.Serialization.ISerializable.GetObjectData + info.SetType(GetType(PersonalEducationTable_SerializationHelper)) 'No other values need to be added + End Sub + +#Region "Class PersonalEducationTable_SerializationHelper" + + Private Class PersonalEducationTable_SerializationHelper + Implements System.Runtime.Serialization.IObjectReference + + 'Method called after this object is deserialized + Public Function GetRealObject(ByVal context As System.Runtime.Serialization.StreamingContext) As Object _ + Implements System.Runtime.Serialization.IObjectReference.GetRealObject + Return PersonalEducationTable.Instance + End Function + End Class + +#End Region + +#End Region + + ''' + ''' References the only instance of the class. + ''' + ''' + ''' Since the class is implemented using the Singleton design pattern, + ''' this field is the only way to access an instance of the class. + ''' + Public Shared ReadOnly Instance As New PersonalEducationTable() + + Private Sub New() + MyBase.New() + End Sub + +End Class ' PersonalEducationTable +End Namespace diff --git a/App_Code/Business Layer/PersonalExtWorkRecord.vb b/App_Code/Business Layer/PersonalExtWorkRecord.vb new file mode 100644 index 0000000..e23b51b --- /dev/null +++ b/App_Code/Business Layer/PersonalExtWorkRecord.vb @@ -0,0 +1,35 @@ +' This is a "safe" class, meaning that it is created once +' and never overwritten. Any custom code you add to this class +' will be preserved when you regenerate your application. +' +' Typical customizations that may be done in this class include +' - adding custom event handlers +' - overriding base class methods + +Imports System.Data.SqlTypes +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + +Namespace Persons.Business + +''' +''' Provides access to the data in a database record. +''' Also provides access to the that each record is associated with. +''' +''' +''' +''' + + Public Class PersonalExtWorkRecord + Inherits BasePersonalExtWorkRecord + + ' Constructors + + Public Sub New() + MyBase.New() + End Sub + + +End Class +End Namespace diff --git a/App_Code/Business Layer/PersonalExtWorkTable.vb b/App_Code/Business Layer/PersonalExtWorkTable.vb new file mode 100644 index 0000000..2daeb8c --- /dev/null +++ b/App_Code/Business Layer/PersonalExtWorkTable.vb @@ -0,0 +1,89 @@ +' This is a "safe" class, meaning that it is created once +' and never overwritten. Any custom code you add to this class +' will be preserved when you regenerate your application. +' +' Typical customizations that may be done in this class include +' - adding custom event handlers +' - overriding base class methods + +Imports System.Data.SqlTypes +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + +Namespace Persons.Business + +''' +''' Provides access to the schema information and record data of a database table (or view). +''' See for additional information. +''' +''' +''' See for additional information. +''' +''' This class is implemented using the Singleton design pattern. +''' +''' +''' This is a "safe" class, meaning that it is generated once and never overwritten. +''' Any changes you make to this class will be preserved when you regenerate your application. +''' +''' +''' +''' +''' +''' +''' +''' + + Public Class PersonalExtWorkTable + Inherits BasePersonalExtWorkTable + Implements System.Runtime.Serialization.ISerializable, ISingleton + + +#Region "ISerializable Members" + + ''' + ''' Overridden to use the class + ''' for deserialization of data. + ''' + ''' + ''' Since the class is implemented using the Singleton design pattern, + ''' this method must be overridden to prevent additional instances from being created during deserialization. + ''' + Protected Overridable Sub GetObjectData( _ + ByVal info As System.Runtime.Serialization.SerializationInfo, _ + ByVal context As System.Runtime.Serialization.StreamingContext _ + ) Implements System.Runtime.Serialization.ISerializable.GetObjectData + info.SetType(GetType(PersonalExtWorkTable_SerializationHelper)) 'No other values need to be added + End Sub + +#Region "Class PersonalExtWorkTable_SerializationHelper" + + Private Class PersonalExtWorkTable_SerializationHelper + Implements System.Runtime.Serialization.IObjectReference + + 'Method called after this object is deserialized + Public Function GetRealObject(ByVal context As System.Runtime.Serialization.StreamingContext) As Object _ + Implements System.Runtime.Serialization.IObjectReference.GetRealObject + Return PersonalExtWorkTable.Instance + End Function + End Class + +#End Region + +#End Region + + ''' + ''' References the only instance of the class. + ''' + ''' + ''' Since the class is implemented using the Singleton design pattern, + ''' this field is the only way to access an instance of the class. + ''' + Public Shared ReadOnly Instance As New PersonalExtWorkTable() + + Private Sub New() + MyBase.New() + End Sub + +End Class ' PersonalExtWorkTable +End Namespace diff --git a/App_Code/Business Layer/PersonalExtraSalaryRecord.vb b/App_Code/Business Layer/PersonalExtraSalaryRecord.vb new file mode 100644 index 0000000..1c3eeeb --- /dev/null +++ b/App_Code/Business Layer/PersonalExtraSalaryRecord.vb @@ -0,0 +1,35 @@ +' This is a "safe" class, meaning that it is created once +' and never overwritten. Any custom code you add to this class +' will be preserved when you regenerate your application. +' +' Typical customizations that may be done in this class include +' - adding custom event handlers +' - overriding base class methods + +Imports System.Data.SqlTypes +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + +Namespace Persons.Business + +''' +''' Provides access to the data in a database record. +''' Also provides access to the that each record is associated with. +''' +''' +''' +''' + + Public Class PersonalExtraSalaryRecord + Inherits BasePersonalExtraSalaryRecord + + ' Constructors + + Public Sub New() + MyBase.New() + End Sub + + +End Class +End Namespace diff --git a/App_Code/Business Layer/PersonalExtraSalaryTable.vb b/App_Code/Business Layer/PersonalExtraSalaryTable.vb new file mode 100644 index 0000000..8d5aa27 --- /dev/null +++ b/App_Code/Business Layer/PersonalExtraSalaryTable.vb @@ -0,0 +1,89 @@ +' This is a "safe" class, meaning that it is created once +' and never overwritten. Any custom code you add to this class +' will be preserved when you regenerate your application. +' +' Typical customizations that may be done in this class include +' - adding custom event handlers +' - overriding base class methods + +Imports System.Data.SqlTypes +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + +Namespace Persons.Business + +''' +''' Provides access to the schema information and record data of a database table (or view). +''' See for additional information. +''' +''' +''' See for additional information. +''' +''' This class is implemented using the Singleton design pattern. +''' +''' +''' This is a "safe" class, meaning that it is generated once and never overwritten. +''' Any changes you make to this class will be preserved when you regenerate your application. +''' +''' +''' +''' +''' +''' +''' +''' + + Public Class PersonalExtraSalaryTable + Inherits BasePersonalExtraSalaryTable + Implements System.Runtime.Serialization.ISerializable, ISingleton + + +#Region "ISerializable Members" + + ''' + ''' Overridden to use the class + ''' for deserialization of data. + ''' + ''' + ''' Since the class is implemented using the Singleton design pattern, + ''' this method must be overridden to prevent additional instances from being created during deserialization. + ''' + Protected Overridable Sub GetObjectData( _ + ByVal info As System.Runtime.Serialization.SerializationInfo, _ + ByVal context As System.Runtime.Serialization.StreamingContext _ + ) Implements System.Runtime.Serialization.ISerializable.GetObjectData + info.SetType(GetType(PersonalExtraSalaryTable_SerializationHelper)) 'No other values need to be added + End Sub + +#Region "Class PersonalExtraSalaryTable_SerializationHelper" + + Private Class PersonalExtraSalaryTable_SerializationHelper + Implements System.Runtime.Serialization.IObjectReference + + 'Method called after this object is deserialized + Public Function GetRealObject(ByVal context As System.Runtime.Serialization.StreamingContext) As Object _ + Implements System.Runtime.Serialization.IObjectReference.GetRealObject + Return PersonalExtraSalaryTable.Instance + End Function + End Class + +#End Region + +#End Region + + ''' + ''' References the only instance of the class. + ''' + ''' + ''' Since the class is implemented using the Singleton design pattern, + ''' this field is the only way to access an instance of the class. + ''' + Public Shared ReadOnly Instance As New PersonalExtraSalaryTable() + + Private Sub New() + MyBase.New() + End Sub + +End Class ' PersonalExtraSalaryTable +End Namespace diff --git a/App_Code/Business Layer/PersonalIdRecord.vb b/App_Code/Business Layer/PersonalIdRecord.vb new file mode 100644 index 0000000..0e5da19 --- /dev/null +++ b/App_Code/Business Layer/PersonalIdRecord.vb @@ -0,0 +1,35 @@ +' This is a "safe" class, meaning that it is created once +' and never overwritten. Any custom code you add to this class +' will be preserved when you regenerate your application. +' +' Typical customizations that may be done in this class include +' - adding custom event handlers +' - overriding base class methods + +Imports System.Data.SqlTypes +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + +Namespace Persons.Business + +''' +''' Provides access to the data in a database record. +''' Also provides access to the that each record is associated with. +''' +''' +''' +''' + + Public Class PersonalIdRecord + Inherits BasePersonalIdRecord + + ' Constructors + + Public Sub New() + MyBase.New() + End Sub + + +End Class +End Namespace diff --git a/App_Code/Business Layer/PersonalIdTable.vb b/App_Code/Business Layer/PersonalIdTable.vb new file mode 100644 index 0000000..8a36bf4 --- /dev/null +++ b/App_Code/Business Layer/PersonalIdTable.vb @@ -0,0 +1,89 @@ +' This is a "safe" class, meaning that it is created once +' and never overwritten. Any custom code you add to this class +' will be preserved when you regenerate your application. +' +' Typical customizations that may be done in this class include +' - adding custom event handlers +' - overriding base class methods + +Imports System.Data.SqlTypes +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + +Namespace Persons.Business + +''' +''' Provides access to the schema information and record data of a database table (or view). +''' See for additional information. +''' +''' +''' See for additional information. +''' +''' This class is implemented using the Singleton design pattern. +''' +''' +''' This is a "safe" class, meaning that it is generated once and never overwritten. +''' Any changes you make to this class will be preserved when you regenerate your application. +''' +''' +''' +''' +''' +''' +''' +''' + + Public Class PersonalIdTable + Inherits BasePersonalIdTable + Implements System.Runtime.Serialization.ISerializable, ISingleton + + +#Region "ISerializable Members" + + ''' + ''' Overridden to use the class + ''' for deserialization of data. + ''' + ''' + ''' Since the class is implemented using the Singleton design pattern, + ''' this method must be overridden to prevent additional instances from being created during deserialization. + ''' + Protected Overridable Sub GetObjectData( _ + ByVal info As System.Runtime.Serialization.SerializationInfo, _ + ByVal context As System.Runtime.Serialization.StreamingContext _ + ) Implements System.Runtime.Serialization.ISerializable.GetObjectData + info.SetType(GetType(PersonalIdTable_SerializationHelper)) 'No other values need to be added + End Sub + +#Region "Class PersonalIdTable_SerializationHelper" + + Private Class PersonalIdTable_SerializationHelper + Implements System.Runtime.Serialization.IObjectReference + + 'Method called after this object is deserialized + Public Function GetRealObject(ByVal context As System.Runtime.Serialization.StreamingContext) As Object _ + Implements System.Runtime.Serialization.IObjectReference.GetRealObject + Return PersonalIdTable.Instance + End Function + End Class + +#End Region + +#End Region + + ''' + ''' References the only instance of the class. + ''' + ''' + ''' Since the class is implemented using the Singleton design pattern, + ''' this field is the only way to access an instance of the class. + ''' + Public Shared ReadOnly Instance As New PersonalIdTable() + + Private Sub New() + MyBase.New() + End Sub + +End Class ' PersonalIdTable +End Namespace diff --git a/App_Code/Business Layer/PersonalInsigniaRecord.vb b/App_Code/Business Layer/PersonalInsigniaRecord.vb new file mode 100644 index 0000000..aa5a147 --- /dev/null +++ b/App_Code/Business Layer/PersonalInsigniaRecord.vb @@ -0,0 +1,35 @@ +' This is a "safe" class, meaning that it is created once +' and never overwritten. Any custom code you add to this class +' will be preserved when you regenerate your application. +' +' Typical customizations that may be done in this class include +' - adding custom event handlers +' - overriding base class methods + +Imports System.Data.SqlTypes +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + +Namespace Persons.Business + +''' +''' Provides access to the data in a database record. +''' Also provides access to the that each record is associated with. +''' +''' +''' +''' + + Public Class PersonalInsigniaRecord + Inherits BasePersonalInsigniaRecord + + ' Constructors + + Public Sub New() + MyBase.New() + End Sub + + +End Class +End Namespace diff --git a/App_Code/Business Layer/PersonalInsigniaTable.vb b/App_Code/Business Layer/PersonalInsigniaTable.vb new file mode 100644 index 0000000..fb024f8 --- /dev/null +++ b/App_Code/Business Layer/PersonalInsigniaTable.vb @@ -0,0 +1,89 @@ +' This is a "safe" class, meaning that it is created once +' and never overwritten. Any custom code you add to this class +' will be preserved when you regenerate your application. +' +' Typical customizations that may be done in this class include +' - adding custom event handlers +' - overriding base class methods + +Imports System.Data.SqlTypes +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + +Namespace Persons.Business + +''' +''' Provides access to the schema information and record data of a database table (or view). +''' See for additional information. +''' +''' +''' See for additional information. +''' +''' This class is implemented using the Singleton design pattern. +''' +''' +''' This is a "safe" class, meaning that it is generated once and never overwritten. +''' Any changes you make to this class will be preserved when you regenerate your application. +''' +''' +''' +''' +''' +''' +''' +''' + + Public Class PersonalInsigniaTable + Inherits BasePersonalInsigniaTable + Implements System.Runtime.Serialization.ISerializable, ISingleton + + +#Region "ISerializable Members" + + ''' + ''' Overridden to use the class + ''' for deserialization of data. + ''' + ''' + ''' Since the class is implemented using the Singleton design pattern, + ''' this method must be overridden to prevent additional instances from being created during deserialization. + ''' + Protected Overridable Sub GetObjectData( _ + ByVal info As System.Runtime.Serialization.SerializationInfo, _ + ByVal context As System.Runtime.Serialization.StreamingContext _ + ) Implements System.Runtime.Serialization.ISerializable.GetObjectData + info.SetType(GetType(PersonalInsigniaTable_SerializationHelper)) 'No other values need to be added + End Sub + +#Region "Class PersonalInsigniaTable_SerializationHelper" + + Private Class PersonalInsigniaTable_SerializationHelper + Implements System.Runtime.Serialization.IObjectReference + + 'Method called after this object is deserialized + Public Function GetRealObject(ByVal context As System.Runtime.Serialization.StreamingContext) As Object _ + Implements System.Runtime.Serialization.IObjectReference.GetRealObject + Return PersonalInsigniaTable.Instance + End Function + End Class + +#End Region + +#End Region + + ''' + ''' References the only instance of the class. + ''' + ''' + ''' Since the class is implemented using the Singleton design pattern, + ''' this field is the only way to access an instance of the class. + ''' + Public Shared ReadOnly Instance As New PersonalInsigniaTable() + + Private Sub New() + MyBase.New() + End Sub + +End Class ' PersonalInsigniaTable +End Namespace diff --git a/App_Code/Business Layer/PersonalLanguageSkillRecord.vb b/App_Code/Business Layer/PersonalLanguageSkillRecord.vb new file mode 100644 index 0000000..dd23b11 --- /dev/null +++ b/App_Code/Business Layer/PersonalLanguageSkillRecord.vb @@ -0,0 +1,35 @@ +' This is a "safe" class, meaning that it is created once +' and never overwritten. Any custom code you add to this class +' will be preserved when you regenerate your application. +' +' Typical customizations that may be done in this class include +' - adding custom event handlers +' - overriding base class methods + +Imports System.Data.SqlTypes +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + +Namespace Persons.Business + +''' +''' Provides access to the data in a database record. +''' Also provides access to the that each record is associated with. +''' +''' +''' +''' + + Public Class PersonalLanguageSkillRecord + Inherits BasePersonalLanguageSkillRecord + + ' Constructors + + Public Sub New() + MyBase.New() + End Sub + + +End Class +End Namespace diff --git a/App_Code/Business Layer/PersonalLanguageSkillTable.vb b/App_Code/Business Layer/PersonalLanguageSkillTable.vb new file mode 100644 index 0000000..cabb738 --- /dev/null +++ b/App_Code/Business Layer/PersonalLanguageSkillTable.vb @@ -0,0 +1,89 @@ +' This is a "safe" class, meaning that it is created once +' and never overwritten. Any custom code you add to this class +' will be preserved when you regenerate your application. +' +' Typical customizations that may be done in this class include +' - adding custom event handlers +' - overriding base class methods + +Imports System.Data.SqlTypes +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + +Namespace Persons.Business + +''' +''' Provides access to the schema information and record data of a database table (or view). +''' See for additional information. +''' +''' +''' See for additional information. +''' +''' This class is implemented using the Singleton design pattern. +''' +''' +''' This is a "safe" class, meaning that it is generated once and never overwritten. +''' Any changes you make to this class will be preserved when you regenerate your application. +''' +''' +''' +''' +''' +''' +''' +''' + + Public Class PersonalLanguageSkillTable + Inherits BasePersonalLanguageSkillTable + Implements System.Runtime.Serialization.ISerializable, ISingleton + + +#Region "ISerializable Members" + + ''' + ''' Overridden to use the class + ''' for deserialization of data. + ''' + ''' + ''' Since the class is implemented using the Singleton design pattern, + ''' this method must be overridden to prevent additional instances from being created during deserialization. + ''' + Protected Overridable Sub GetObjectData( _ + ByVal info As System.Runtime.Serialization.SerializationInfo, _ + ByVal context As System.Runtime.Serialization.StreamingContext _ + ) Implements System.Runtime.Serialization.ISerializable.GetObjectData + info.SetType(GetType(PersonalLanguageSkillTable_SerializationHelper)) 'No other values need to be added + End Sub + +#Region "Class PersonalLanguageSkillTable_SerializationHelper" + + Private Class PersonalLanguageSkillTable_SerializationHelper + Implements System.Runtime.Serialization.IObjectReference + + 'Method called after this object is deserialized + Public Function GetRealObject(ByVal context As System.Runtime.Serialization.StreamingContext) As Object _ + Implements System.Runtime.Serialization.IObjectReference.GetRealObject + Return PersonalLanguageSkillTable.Instance + End Function + End Class + +#End Region + +#End Region + + ''' + ''' References the only instance of the class. + ''' + ''' + ''' Since the class is implemented using the Singleton design pattern, + ''' this field is the only way to access an instance of the class. + ''' + Public Shared ReadOnly Instance As New PersonalLanguageSkillTable() + + Private Sub New() + MyBase.New() + End Sub + +End Class ' PersonalLanguageSkillTable +End Namespace diff --git a/App_Code/Business Layer/PersonalNameRecord.vb b/App_Code/Business Layer/PersonalNameRecord.vb new file mode 100644 index 0000000..4dde631 --- /dev/null +++ b/App_Code/Business Layer/PersonalNameRecord.vb @@ -0,0 +1,35 @@ +' This is a "safe" class, meaning that it is created once +' and never overwritten. Any custom code you add to this class +' will be preserved when you regenerate your application. +' +' Typical customizations that may be done in this class include +' - adding custom event handlers +' - overriding base class methods + +Imports System.Data.SqlTypes +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + +Namespace Persons.Business + +''' +''' Provides access to the data in a database record. +''' Also provides access to the that each record is associated with. +''' +''' +''' +''' + + Public Class PersonalNameRecord + Inherits BasePersonalNameRecord + + ' Constructors + + Public Sub New() + MyBase.New() + End Sub + + +End Class +End Namespace diff --git a/App_Code/Business Layer/PersonalNameTable.vb b/App_Code/Business Layer/PersonalNameTable.vb new file mode 100644 index 0000000..c90e8d1 --- /dev/null +++ b/App_Code/Business Layer/PersonalNameTable.vb @@ -0,0 +1,89 @@ +' This is a "safe" class, meaning that it is created once +' and never overwritten. Any custom code you add to this class +' will be preserved when you regenerate your application. +' +' Typical customizations that may be done in this class include +' - adding custom event handlers +' - overriding base class methods + +Imports System.Data.SqlTypes +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + +Namespace Persons.Business + +''' +''' Provides access to the schema information and record data of a database table (or view). +''' See for additional information. +''' +''' +''' See for additional information. +''' +''' This class is implemented using the Singleton design pattern. +''' +''' +''' This is a "safe" class, meaning that it is generated once and never overwritten. +''' Any changes you make to this class will be preserved when you regenerate your application. +''' +''' +''' +''' +''' +''' +''' +''' + + Public Class PersonalNameTable + Inherits BasePersonalNameTable + Implements System.Runtime.Serialization.ISerializable, ISingleton + + +#Region "ISerializable Members" + + ''' + ''' Overridden to use the class + ''' for deserialization of data. + ''' + ''' + ''' Since the class is implemented using the Singleton design pattern, + ''' this method must be overridden to prevent additional instances from being created during deserialization. + ''' + Protected Overridable Sub GetObjectData( _ + ByVal info As System.Runtime.Serialization.SerializationInfo, _ + ByVal context As System.Runtime.Serialization.StreamingContext _ + ) Implements System.Runtime.Serialization.ISerializable.GetObjectData + info.SetType(GetType(PersonalNameTable_SerializationHelper)) 'No other values need to be added + End Sub + +#Region "Class PersonalNameTable_SerializationHelper" + + Private Class PersonalNameTable_SerializationHelper + Implements System.Runtime.Serialization.IObjectReference + + 'Method called after this object is deserialized + Public Function GetRealObject(ByVal context As System.Runtime.Serialization.StreamingContext) As Object _ + Implements System.Runtime.Serialization.IObjectReference.GetRealObject + Return PersonalNameTable.Instance + End Function + End Class + +#End Region + +#End Region + + ''' + ''' References the only instance of the class. + ''' + ''' + ''' Since the class is implemented using the Singleton design pattern, + ''' this field is the only way to access an instance of the class. + ''' + Public Shared ReadOnly Instance As New PersonalNameTable() + + Private Sub New() + MyBase.New() + End Sub + +End Class ' PersonalNameTable +End Namespace diff --git a/App_Code/Business Layer/PersonalRankRecord.vb b/App_Code/Business Layer/PersonalRankRecord.vb new file mode 100644 index 0000000..5ce7946 --- /dev/null +++ b/App_Code/Business Layer/PersonalRankRecord.vb @@ -0,0 +1,35 @@ +' This is a "safe" class, meaning that it is created once +' and never overwritten. Any custom code you add to this class +' will be preserved when you regenerate your application. +' +' Typical customizations that may be done in this class include +' - adding custom event handlers +' - overriding base class methods + +Imports System.Data.SqlTypes +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + +Namespace Persons.Business + +''' +''' Provides access to the data in a database record. +''' Also provides access to the that each record is associated with. +''' +''' +''' +''' + + Public Class PersonalRankRecord + Inherits BasePersonalRankRecord + + ' Constructors + + Public Sub New() + MyBase.New() + End Sub + + +End Class +End Namespace diff --git a/App_Code/Business Layer/PersonalRankTable.vb b/App_Code/Business Layer/PersonalRankTable.vb new file mode 100644 index 0000000..4b895cc --- /dev/null +++ b/App_Code/Business Layer/PersonalRankTable.vb @@ -0,0 +1,89 @@ +' This is a "safe" class, meaning that it is created once +' and never overwritten. Any custom code you add to this class +' will be preserved when you regenerate your application. +' +' Typical customizations that may be done in this class include +' - adding custom event handlers +' - overriding base class methods + +Imports System.Data.SqlTypes +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + +Namespace Persons.Business + +''' +''' Provides access to the schema information and record data of a database table (or view). +''' See for additional information. +''' +''' +''' See for additional information. +''' +''' This class is implemented using the Singleton design pattern. +''' +''' +''' This is a "safe" class, meaning that it is generated once and never overwritten. +''' Any changes you make to this class will be preserved when you regenerate your application. +''' +''' +''' +''' +''' +''' +''' +''' + + Public Class PersonalRankTable + Inherits BasePersonalRankTable + Implements System.Runtime.Serialization.ISerializable, ISingleton + + +#Region "ISerializable Members" + + ''' + ''' Overridden to use the class + ''' for deserialization of data. + ''' + ''' + ''' Since the class is implemented using the Singleton design pattern, + ''' this method must be overridden to prevent additional instances from being created during deserialization. + ''' + Protected Overridable Sub GetObjectData( _ + ByVal info As System.Runtime.Serialization.SerializationInfo, _ + ByVal context As System.Runtime.Serialization.StreamingContext _ + ) Implements System.Runtime.Serialization.ISerializable.GetObjectData + info.SetType(GetType(PersonalRankTable_SerializationHelper)) 'No other values need to be added + End Sub + +#Region "Class PersonalRankTable_SerializationHelper" + + Private Class PersonalRankTable_SerializationHelper + Implements System.Runtime.Serialization.IObjectReference + + 'Method called after this object is deserialized + Public Function GetRealObject(ByVal context As System.Runtime.Serialization.StreamingContext) As Object _ + Implements System.Runtime.Serialization.IObjectReference.GetRealObject + Return PersonalRankTable.Instance + End Function + End Class + +#End Region + +#End Region + + ''' + ''' References the only instance of the class. + ''' + ''' + ''' Since the class is implemented using the Singleton design pattern, + ''' this field is the only way to access an instance of the class. + ''' + Public Shared ReadOnly Instance As New PersonalRankTable() + + Private Sub New() + MyBase.New() + End Sub + +End Class ' PersonalRankTable +End Namespace diff --git a/App_Code/Business Layer/PersonalSalaryRecord.vb b/App_Code/Business Layer/PersonalSalaryRecord.vb new file mode 100644 index 0000000..7743fa8 --- /dev/null +++ b/App_Code/Business Layer/PersonalSalaryRecord.vb @@ -0,0 +1,35 @@ +' This is a "safe" class, meaning that it is created once +' and never overwritten. Any custom code you add to this class +' will be preserved when you regenerate your application. +' +' Typical customizations that may be done in this class include +' - adding custom event handlers +' - overriding base class methods + +Imports System.Data.SqlTypes +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + +Namespace Persons.Business + +''' +''' Provides access to the data in a database record. +''' Also provides access to the that each record is associated with. +''' +''' +''' +''' + + Public Class PersonalSalaryRecord + Inherits BasePersonalSalaryRecord + + ' Constructors + + Public Sub New() + MyBase.New() + End Sub + + +End Class +End Namespace diff --git a/App_Code/Business Layer/PersonalSalaryTable.vb b/App_Code/Business Layer/PersonalSalaryTable.vb new file mode 100644 index 0000000..0b7a486 --- /dev/null +++ b/App_Code/Business Layer/PersonalSalaryTable.vb @@ -0,0 +1,89 @@ +' This is a "safe" class, meaning that it is created once +' and never overwritten. Any custom code you add to this class +' will be preserved when you regenerate your application. +' +' Typical customizations that may be done in this class include +' - adding custom event handlers +' - overriding base class methods + +Imports System.Data.SqlTypes +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + +Namespace Persons.Business + +''' +''' Provides access to the schema information and record data of a database table (or view). +''' See for additional information. +''' +''' +''' See for additional information. +''' +''' This class is implemented using the Singleton design pattern. +''' +''' +''' This is a "safe" class, meaning that it is generated once and never overwritten. +''' Any changes you make to this class will be preserved when you regenerate your application. +''' +''' +''' +''' +''' +''' +''' +''' + + Public Class PersonalSalaryTable + Inherits BasePersonalSalaryTable + Implements System.Runtime.Serialization.ISerializable, ISingleton + + +#Region "ISerializable Members" + + ''' + ''' Overridden to use the class + ''' for deserialization of data. + ''' + ''' + ''' Since the class is implemented using the Singleton design pattern, + ''' this method must be overridden to prevent additional instances from being created during deserialization. + ''' + Protected Overridable Sub GetObjectData( _ + ByVal info As System.Runtime.Serialization.SerializationInfo, _ + ByVal context As System.Runtime.Serialization.StreamingContext _ + ) Implements System.Runtime.Serialization.ISerializable.GetObjectData + info.SetType(GetType(PersonalSalaryTable_SerializationHelper)) 'No other values need to be added + End Sub + +#Region "Class PersonalSalaryTable_SerializationHelper" + + Private Class PersonalSalaryTable_SerializationHelper + Implements System.Runtime.Serialization.IObjectReference + + 'Method called after this object is deserialized + Public Function GetRealObject(ByVal context As System.Runtime.Serialization.StreamingContext) As Object _ + Implements System.Runtime.Serialization.IObjectReference.GetRealObject + Return PersonalSalaryTable.Instance + End Function + End Class + +#End Region + +#End Region + + ''' + ''' References the only instance of the class. + ''' + ''' + ''' Since the class is implemented using the Singleton design pattern, + ''' this field is the only way to access an instance of the class. + ''' + Public Shared ReadOnly Instance As New PersonalSalaryTable() + + Private Sub New() + MyBase.New() + End Sub + +End Class ' PersonalSalaryTable +End Namespace diff --git a/App_Code/Business Layer/PersonalSpecialSkillRecord.vb b/App_Code/Business Layer/PersonalSpecialSkillRecord.vb new file mode 100644 index 0000000..bf30370 --- /dev/null +++ b/App_Code/Business Layer/PersonalSpecialSkillRecord.vb @@ -0,0 +1,35 @@ +' This is a "safe" class, meaning that it is created once +' and never overwritten. Any custom code you add to this class +' will be preserved when you regenerate your application. +' +' Typical customizations that may be done in this class include +' - adding custom event handlers +' - overriding base class methods + +Imports System.Data.SqlTypes +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + +Namespace Persons.Business + +''' +''' Provides access to the data in a database record. +''' Also provides access to the that each record is associated with. +''' +''' +''' +''' + + Public Class PersonalSpecialSkillRecord + Inherits BasePersonalSpecialSkillRecord + + ' Constructors + + Public Sub New() + MyBase.New() + End Sub + + +End Class +End Namespace diff --git a/App_Code/Business Layer/PersonalSpecialSkillTable.vb b/App_Code/Business Layer/PersonalSpecialSkillTable.vb new file mode 100644 index 0000000..7c7038c --- /dev/null +++ b/App_Code/Business Layer/PersonalSpecialSkillTable.vb @@ -0,0 +1,89 @@ +' This is a "safe" class, meaning that it is created once +' and never overwritten. Any custom code you add to this class +' will be preserved when you regenerate your application. +' +' Typical customizations that may be done in this class include +' - adding custom event handlers +' - overriding base class methods + +Imports System.Data.SqlTypes +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + +Namespace Persons.Business + +''' +''' Provides access to the schema information and record data of a database table (or view). +''' See for additional information. +''' +''' +''' See for additional information. +''' +''' This class is implemented using the Singleton design pattern. +''' +''' +''' This is a "safe" class, meaning that it is generated once and never overwritten. +''' Any changes you make to this class will be preserved when you regenerate your application. +''' +''' +''' +''' +''' +''' +''' +''' + + Public Class PersonalSpecialSkillTable + Inherits BasePersonalSpecialSkillTable + Implements System.Runtime.Serialization.ISerializable, ISingleton + + +#Region "ISerializable Members" + + ''' + ''' Overridden to use the class + ''' for deserialization of data. + ''' + ''' + ''' Since the class is implemented using the Singleton design pattern, + ''' this method must be overridden to prevent additional instances from being created during deserialization. + ''' + Protected Overridable Sub GetObjectData( _ + ByVal info As System.Runtime.Serialization.SerializationInfo, _ + ByVal context As System.Runtime.Serialization.StreamingContext _ + ) Implements System.Runtime.Serialization.ISerializable.GetObjectData + info.SetType(GetType(PersonalSpecialSkillTable_SerializationHelper)) 'No other values need to be added + End Sub + +#Region "Class PersonalSpecialSkillTable_SerializationHelper" + + Private Class PersonalSpecialSkillTable_SerializationHelper + Implements System.Runtime.Serialization.IObjectReference + + 'Method called after this object is deserialized + Public Function GetRealObject(ByVal context As System.Runtime.Serialization.StreamingContext) As Object _ + Implements System.Runtime.Serialization.IObjectReference.GetRealObject + Return PersonalSpecialSkillTable.Instance + End Function + End Class + +#End Region + +#End Region + + ''' + ''' References the only instance of the class. + ''' + ''' + ''' Since the class is implemented using the Singleton design pattern, + ''' this field is the only way to access an instance of the class. + ''' + Public Shared ReadOnly Instance As New PersonalSpecialSkillTable() + + Private Sub New() + MyBase.New() + End Sub + +End Class ' PersonalSpecialSkillTable +End Namespace diff --git a/App_Code/Business Layer/PersonalSportSkillRecord.vb b/App_Code/Business Layer/PersonalSportSkillRecord.vb new file mode 100644 index 0000000..394df80 --- /dev/null +++ b/App_Code/Business Layer/PersonalSportSkillRecord.vb @@ -0,0 +1,35 @@ +' This is a "safe" class, meaning that it is created once +' and never overwritten. Any custom code you add to this class +' will be preserved when you regenerate your application. +' +' Typical customizations that may be done in this class include +' - adding custom event handlers +' - overriding base class methods + +Imports System.Data.SqlTypes +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + +Namespace Persons.Business + +''' +''' Provides access to the data in a database record. +''' Also provides access to the that each record is associated with. +''' +''' +''' +''' + + Public Class PersonalSportSkillRecord + Inherits BasePersonalSportSkillRecord + + ' Constructors + + Public Sub New() + MyBase.New() + End Sub + + +End Class +End Namespace diff --git a/App_Code/Business Layer/PersonalSportSkillTable.vb b/App_Code/Business Layer/PersonalSportSkillTable.vb new file mode 100644 index 0000000..4ff1a7d --- /dev/null +++ b/App_Code/Business Layer/PersonalSportSkillTable.vb @@ -0,0 +1,89 @@ +' This is a "safe" class, meaning that it is created once +' and never overwritten. Any custom code you add to this class +' will be preserved when you regenerate your application. +' +' Typical customizations that may be done in this class include +' - adding custom event handlers +' - overriding base class methods + +Imports System.Data.SqlTypes +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + +Namespace Persons.Business + +''' +''' Provides access to the schema information and record data of a database table (or view). +''' See for additional information. +''' +''' +''' See for additional information. +''' +''' This class is implemented using the Singleton design pattern. +''' +''' +''' This is a "safe" class, meaning that it is generated once and never overwritten. +''' Any changes you make to this class will be preserved when you regenerate your application. +''' +''' +''' +''' +''' +''' +''' +''' + + Public Class PersonalSportSkillTable + Inherits BasePersonalSportSkillTable + Implements System.Runtime.Serialization.ISerializable, ISingleton + + +#Region "ISerializable Members" + + ''' + ''' Overridden to use the class + ''' for deserialization of data. + ''' + ''' + ''' Since the class is implemented using the Singleton design pattern, + ''' this method must be overridden to prevent additional instances from being created during deserialization. + ''' + Protected Overridable Sub GetObjectData( _ + ByVal info As System.Runtime.Serialization.SerializationInfo, _ + ByVal context As System.Runtime.Serialization.StreamingContext _ + ) Implements System.Runtime.Serialization.ISerializable.GetObjectData + info.SetType(GetType(PersonalSportSkillTable_SerializationHelper)) 'No other values need to be added + End Sub + +#Region "Class PersonalSportSkillTable_SerializationHelper" + + Private Class PersonalSportSkillTable_SerializationHelper + Implements System.Runtime.Serialization.IObjectReference + + 'Method called after this object is deserialized + Public Function GetRealObject(ByVal context As System.Runtime.Serialization.StreamingContext) As Object _ + Implements System.Runtime.Serialization.IObjectReference.GetRealObject + Return PersonalSportSkillTable.Instance + End Function + End Class + +#End Region + +#End Region + + ''' + ''' References the only instance of the class. + ''' + ''' + ''' Since the class is implemented using the Singleton design pattern, + ''' this field is the only way to access an instance of the class. + ''' + Public Shared ReadOnly Instance As New PersonalSportSkillTable() + + Private Sub New() + MyBase.New() + End Sub + +End Class ' PersonalSportSkillTable +End Namespace diff --git a/App_Code/Business Layer/PersonalTitleRecord.vb b/App_Code/Business Layer/PersonalTitleRecord.vb new file mode 100644 index 0000000..846f505 --- /dev/null +++ b/App_Code/Business Layer/PersonalTitleRecord.vb @@ -0,0 +1,35 @@ +' This is a "safe" class, meaning that it is created once +' and never overwritten. Any custom code you add to this class +' will be preserved when you regenerate your application. +' +' Typical customizations that may be done in this class include +' - adding custom event handlers +' - overriding base class methods + +Imports System.Data.SqlTypes +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + +Namespace Persons.Business + +''' +''' Provides access to the data in a database record. +''' Also provides access to the that each record is associated with. +''' +''' +''' +''' + + Public Class PersonalTitleRecord + Inherits BasePersonalTitleRecord + + ' Constructors + + Public Sub New() + MyBase.New() + End Sub + + +End Class +End Namespace diff --git a/App_Code/Business Layer/PersonalTitleRecord.vb.old b/App_Code/Business Layer/PersonalTitleRecord.vb.old new file mode 100644 index 0000000..846f505 --- /dev/null +++ b/App_Code/Business Layer/PersonalTitleRecord.vb.old @@ -0,0 +1,35 @@ +' This is a "safe" class, meaning that it is created once +' and never overwritten. Any custom code you add to this class +' will be preserved when you regenerate your application. +' +' Typical customizations that may be done in this class include +' - adding custom event handlers +' - overriding base class methods + +Imports System.Data.SqlTypes +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + +Namespace Persons.Business + +''' +''' Provides access to the data in a database record. +''' Also provides access to the that each record is associated with. +''' +''' +''' +''' + + Public Class PersonalTitleRecord + Inherits BasePersonalTitleRecord + + ' Constructors + + Public Sub New() + MyBase.New() + End Sub + + +End Class +End Namespace diff --git a/App_Code/Business Layer/PersonalTitleTable.vb b/App_Code/Business Layer/PersonalTitleTable.vb new file mode 100644 index 0000000..17184cf --- /dev/null +++ b/App_Code/Business Layer/PersonalTitleTable.vb @@ -0,0 +1,89 @@ +' This is a "safe" class, meaning that it is created once +' and never overwritten. Any custom code you add to this class +' will be preserved when you regenerate your application. +' +' Typical customizations that may be done in this class include +' - adding custom event handlers +' - overriding base class methods + +Imports System.Data.SqlTypes +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + +Namespace Persons.Business + +''' +''' Provides access to the schema information and record data of a database table (or view). +''' See for additional information. +''' +''' +''' See for additional information. +''' +''' This class is implemented using the Singleton design pattern. +''' +''' +''' This is a "safe" class, meaning that it is generated once and never overwritten. +''' Any changes you make to this class will be preserved when you regenerate your application. +''' +''' +''' +''' +''' +''' +''' +''' + + Public Class PersonalTitleTable + Inherits BasePersonalTitleTable + Implements System.Runtime.Serialization.ISerializable, ISingleton + + +#Region "ISerializable Members" + + ''' + ''' Overridden to use the class + ''' for deserialization of data. + ''' + ''' + ''' Since the class is implemented using the Singleton design pattern, + ''' this method must be overridden to prevent additional instances from being created during deserialization. + ''' + Protected Overridable Sub GetObjectData( _ + ByVal info As System.Runtime.Serialization.SerializationInfo, _ + ByVal context As System.Runtime.Serialization.StreamingContext _ + ) Implements System.Runtime.Serialization.ISerializable.GetObjectData + info.SetType(GetType(PersonalTitleTable_SerializationHelper)) 'No other values need to be added + End Sub + +#Region "Class PersonalTitleTable_SerializationHelper" + + Private Class PersonalTitleTable_SerializationHelper + Implements System.Runtime.Serialization.IObjectReference + + 'Method called after this object is deserialized + Public Function GetRealObject(ByVal context As System.Runtime.Serialization.StreamingContext) As Object _ + Implements System.Runtime.Serialization.IObjectReference.GetRealObject + Return PersonalTitleTable.Instance + End Function + End Class + +#End Region + +#End Region + + ''' + ''' References the only instance of the class. + ''' + ''' + ''' Since the class is implemented using the Singleton design pattern, + ''' this field is the only way to access an instance of the class. + ''' + Public Shared ReadOnly Instance As New PersonalTitleTable() + + Private Sub New() + MyBase.New() + End Sub + +End Class ' PersonalTitleTable +End Namespace diff --git a/App_Code/Business Layer/PersonalTitleTable.vb.old b/App_Code/Business Layer/PersonalTitleTable.vb.old new file mode 100644 index 0000000..17184cf --- /dev/null +++ b/App_Code/Business Layer/PersonalTitleTable.vb.old @@ -0,0 +1,89 @@ +' This is a "safe" class, meaning that it is created once +' and never overwritten. Any custom code you add to this class +' will be preserved when you regenerate your application. +' +' Typical customizations that may be done in this class include +' - adding custom event handlers +' - overriding base class methods + +Imports System.Data.SqlTypes +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + +Namespace Persons.Business + +''' +''' Provides access to the schema information and record data of a database table (or view). +''' See for additional information. +''' +''' +''' See for additional information. +''' +''' This class is implemented using the Singleton design pattern. +''' +''' +''' This is a "safe" class, meaning that it is generated once and never overwritten. +''' Any changes you make to this class will be preserved when you regenerate your application. +''' +''' +''' +''' +''' +''' +''' +''' + + Public Class PersonalTitleTable + Inherits BasePersonalTitleTable + Implements System.Runtime.Serialization.ISerializable, ISingleton + + +#Region "ISerializable Members" + + ''' + ''' Overridden to use the class + ''' for deserialization of data. + ''' + ''' + ''' Since the class is implemented using the Singleton design pattern, + ''' this method must be overridden to prevent additional instances from being created during deserialization. + ''' + Protected Overridable Sub GetObjectData( _ + ByVal info As System.Runtime.Serialization.SerializationInfo, _ + ByVal context As System.Runtime.Serialization.StreamingContext _ + ) Implements System.Runtime.Serialization.ISerializable.GetObjectData + info.SetType(GetType(PersonalTitleTable_SerializationHelper)) 'No other values need to be added + End Sub + +#Region "Class PersonalTitleTable_SerializationHelper" + + Private Class PersonalTitleTable_SerializationHelper + Implements System.Runtime.Serialization.IObjectReference + + 'Method called after this object is deserialized + Public Function GetRealObject(ByVal context As System.Runtime.Serialization.StreamingContext) As Object _ + Implements System.Runtime.Serialization.IObjectReference.GetRealObject + Return PersonalTitleTable.Instance + End Function + End Class + +#End Region + +#End Region + + ''' + ''' References the only instance of the class. + ''' + ''' + ''' Since the class is implemented using the Singleton design pattern, + ''' this field is the only way to access an instance of the class. + ''' + Public Shared ReadOnly Instance As New PersonalTitleTable() + + Private Sub New() + MyBase.New() + End Sub + +End Class ' PersonalTitleTable +End Namespace diff --git a/App_Code/Business Layer/RStatusRecord.vb b/App_Code/Business Layer/RStatusRecord.vb new file mode 100644 index 0000000..83dae98 --- /dev/null +++ b/App_Code/Business Layer/RStatusRecord.vb @@ -0,0 +1,35 @@ +' This is a "safe" class, meaning that it is created once +' and never overwritten. Any custom code you add to this class +' will be preserved when you regenerate your application. +' +' Typical customizations that may be done in this class include +' - adding custom event handlers +' - overriding base class methods + +Imports System.Data.SqlTypes +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + +Namespace Persons.Business + +''' +''' Provides access to the data in a database record. +''' Also provides access to the that each record is associated with. +''' +''' +''' +''' + + Public Class RStatusRecord + Inherits BaseRStatusRecord + + ' Constructors + + Public Sub New() + MyBase.New() + End Sub + + +End Class +End Namespace diff --git a/App_Code/Business Layer/RStatusTable.vb b/App_Code/Business Layer/RStatusTable.vb new file mode 100644 index 0000000..1b3e804 --- /dev/null +++ b/App_Code/Business Layer/RStatusTable.vb @@ -0,0 +1,89 @@ +' This is a "safe" class, meaning that it is created once +' and never overwritten. Any custom code you add to this class +' will be preserved when you regenerate your application. +' +' Typical customizations that may be done in this class include +' - adding custom event handlers +' - overriding base class methods + +Imports System.Data.SqlTypes +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + +Namespace Persons.Business + +''' +''' Provides access to the schema information and record data of a database table (or view). +''' See for additional information. +''' +''' +''' See for additional information. +''' +''' This class is implemented using the Singleton design pattern. +''' +''' +''' This is a "safe" class, meaning that it is generated once and never overwritten. +''' Any changes you make to this class will be preserved when you regenerate your application. +''' +''' +''' +''' +''' +''' +''' +''' + + Public Class RStatusTable + Inherits BaseRStatusTable + Implements System.Runtime.Serialization.ISerializable, ISingleton + + +#Region "ISerializable Members" + + ''' + ''' Overridden to use the class + ''' for deserialization of data. + ''' + ''' + ''' Since the class is implemented using the Singleton design pattern, + ''' this method must be overridden to prevent additional instances from being created during deserialization. + ''' + Protected Overridable Sub GetObjectData( _ + ByVal info As System.Runtime.Serialization.SerializationInfo, _ + ByVal context As System.Runtime.Serialization.StreamingContext _ + ) Implements System.Runtime.Serialization.ISerializable.GetObjectData + info.SetType(GetType(RStatusTable_SerializationHelper)) 'No other values need to be added + End Sub + +#Region "Class RStatusTable_SerializationHelper" + + Private Class RStatusTable_SerializationHelper + Implements System.Runtime.Serialization.IObjectReference + + 'Method called after this object is deserialized + Public Function GetRealObject(ByVal context As System.Runtime.Serialization.StreamingContext) As Object _ + Implements System.Runtime.Serialization.IObjectReference.GetRealObject + Return RStatusTable.Instance + End Function + End Class + +#End Region + +#End Region + + ''' + ''' References the only instance of the class. + ''' + ''' + ''' Since the class is implemented using the Singleton design pattern, + ''' this field is the only way to access an instance of the class. + ''' + Public Shared ReadOnly Instance As New RStatusTable() + + Private Sub New() + MyBase.New() + End Sub + +End Class ' RStatusTable +End Namespace diff --git a/App_Code/Business Layer/RankRecord.vb b/App_Code/Business Layer/RankRecord.vb new file mode 100644 index 0000000..e97d782 --- /dev/null +++ b/App_Code/Business Layer/RankRecord.vb @@ -0,0 +1,35 @@ +' This is a "safe" class, meaning that it is created once +' and never overwritten. Any custom code you add to this class +' will be preserved when you regenerate your application. +' +' Typical customizations that may be done in this class include +' - adding custom event handlers +' - overriding base class methods + +Imports System.Data.SqlTypes +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + +Namespace Persons.Business + +''' +''' Provides access to the data in a database record. +''' Also provides access to the that each record is associated with. +''' +''' +''' +''' + + Public Class RankRecord + Inherits BaseRankRecord + + ' Constructors + + Public Sub New() + MyBase.New() + End Sub + + +End Class +End Namespace diff --git a/App_Code/Business Layer/RankTable.vb b/App_Code/Business Layer/RankTable.vb new file mode 100644 index 0000000..8d33f50 --- /dev/null +++ b/App_Code/Business Layer/RankTable.vb @@ -0,0 +1,89 @@ +' This is a "safe" class, meaning that it is created once +' and never overwritten. Any custom code you add to this class +' will be preserved when you regenerate your application. +' +' Typical customizations that may be done in this class include +' - adding custom event handlers +' - overriding base class methods + +Imports System.Data.SqlTypes +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + +Namespace Persons.Business + +''' +''' Provides access to the schema information and record data of a database table (or view). +''' See for additional information. +''' +''' +''' See for additional information. +''' +''' This class is implemented using the Singleton design pattern. +''' +''' +''' This is a "safe" class, meaning that it is generated once and never overwritten. +''' Any changes you make to this class will be preserved when you regenerate your application. +''' +''' +''' +''' +''' +''' +''' +''' + + Public Class RankTable + Inherits BaseRankTable + Implements System.Runtime.Serialization.ISerializable, ISingleton + + +#Region "ISerializable Members" + + ''' + ''' Overridden to use the class + ''' for deserialization of data. + ''' + ''' + ''' Since the class is implemented using the Singleton design pattern, + ''' this method must be overridden to prevent additional instances from being created during deserialization. + ''' + Protected Overridable Sub GetObjectData( _ + ByVal info As System.Runtime.Serialization.SerializationInfo, _ + ByVal context As System.Runtime.Serialization.StreamingContext _ + ) Implements System.Runtime.Serialization.ISerializable.GetObjectData + info.SetType(GetType(RankTable_SerializationHelper)) 'No other values need to be added + End Sub + +#Region "Class RankTable_SerializationHelper" + + Private Class RankTable_SerializationHelper + Implements System.Runtime.Serialization.IObjectReference + + 'Method called after this object is deserialized + Public Function GetRealObject(ByVal context As System.Runtime.Serialization.StreamingContext) As Object _ + Implements System.Runtime.Serialization.IObjectReference.GetRealObject + Return RankTable.Instance + End Function + End Class + +#End Region + +#End Region + + ''' + ''' References the only instance of the class. + ''' + ''' + ''' Since the class is implemented using the Singleton design pattern, + ''' this field is the only way to access an instance of the class. + ''' + Public Shared ReadOnly Instance As New RankTable() + + Private Sub New() + MyBase.New() + End Sub + +End Class ' RankTable +End Namespace diff --git a/App_Code/Business Layer/RelationRecord.vb b/App_Code/Business Layer/RelationRecord.vb new file mode 100644 index 0000000..854f46c --- /dev/null +++ b/App_Code/Business Layer/RelationRecord.vb @@ -0,0 +1,35 @@ +' This is a "safe" class, meaning that it is created once +' and never overwritten. Any custom code you add to this class +' will be preserved when you regenerate your application. +' +' Typical customizations that may be done in this class include +' - adding custom event handlers +' - overriding base class methods + +Imports System.Data.SqlTypes +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + +Namespace Persons.Business + +''' +''' Provides access to the data in a database record. +''' Also provides access to the that each record is associated with. +''' +''' +''' +''' + + Public Class RelationRecord + Inherits BaseRelationRecord + + ' Constructors + + Public Sub New() + MyBase.New() + End Sub + + +End Class +End Namespace diff --git a/App_Code/Business Layer/RelationTable.vb b/App_Code/Business Layer/RelationTable.vb new file mode 100644 index 0000000..d9136cb --- /dev/null +++ b/App_Code/Business Layer/RelationTable.vb @@ -0,0 +1,89 @@ +' This is a "safe" class, meaning that it is created once +' and never overwritten. Any custom code you add to this class +' will be preserved when you regenerate your application. +' +' Typical customizations that may be done in this class include +' - adding custom event handlers +' - overriding base class methods + +Imports System.Data.SqlTypes +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + +Namespace Persons.Business + +''' +''' Provides access to the schema information and record data of a database table (or view). +''' See for additional information. +''' +''' +''' See for additional information. +''' +''' This class is implemented using the Singleton design pattern. +''' +''' +''' This is a "safe" class, meaning that it is generated once and never overwritten. +''' Any changes you make to this class will be preserved when you regenerate your application. +''' +''' +''' +''' +''' +''' +''' +''' + + Public Class RelationTable + Inherits BaseRelationTable + Implements System.Runtime.Serialization.ISerializable, ISingleton + + +#Region "ISerializable Members" + + ''' + ''' Overridden to use the class + ''' for deserialization of data. + ''' + ''' + ''' Since the class is implemented using the Singleton design pattern, + ''' this method must be overridden to prevent additional instances from being created during deserialization. + ''' + Protected Overridable Sub GetObjectData( _ + ByVal info As System.Runtime.Serialization.SerializationInfo, _ + ByVal context As System.Runtime.Serialization.StreamingContext _ + ) Implements System.Runtime.Serialization.ISerializable.GetObjectData + info.SetType(GetType(RelationTable_SerializationHelper)) 'No other values need to be added + End Sub + +#Region "Class RelationTable_SerializationHelper" + + Private Class RelationTable_SerializationHelper + Implements System.Runtime.Serialization.IObjectReference + + 'Method called after this object is deserialized + Public Function GetRealObject(ByVal context As System.Runtime.Serialization.StreamingContext) As Object _ + Implements System.Runtime.Serialization.IObjectReference.GetRealObject + Return RelationTable.Instance + End Function + End Class + +#End Region + +#End Region + + ''' + ''' References the only instance of the class. + ''' + ''' + ''' Since the class is implemented using the Singleton design pattern, + ''' this field is the only way to access an instance of the class. + ''' + Public Shared ReadOnly Instance As New RelationTable() + + Private Sub New() + MyBase.New() + End Sub + +End Class ' RelationTable +End Namespace diff --git a/App_Code/Business Layer/ReportPropertiesRecord.vb b/App_Code/Business Layer/ReportPropertiesRecord.vb new file mode 100644 index 0000000..2cfa7c2 --- /dev/null +++ b/App_Code/Business Layer/ReportPropertiesRecord.vb @@ -0,0 +1,35 @@ +' This is a "safe" class, meaning that it is created once +' and never overwritten. Any custom code you add to this class +' will be preserved when you regenerate your application. +' +' Typical customizations that may be done in this class include +' - adding custom event handlers +' - overriding base class methods + +Imports System.Data.SqlTypes +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + +Namespace Persons.Business + +''' +''' Provides access to the data in a database record. +''' Also provides access to the that each record is associated with. +''' +''' +''' +''' + + Public Class ReportPropertiesRecord + Inherits BaseReportPropertiesRecord + + ' Constructors + + Public Sub New() + MyBase.New() + End Sub + + +End Class +End Namespace diff --git a/App_Code/Business Layer/ReportPropertiesTable.vb b/App_Code/Business Layer/ReportPropertiesTable.vb new file mode 100644 index 0000000..5988805 --- /dev/null +++ b/App_Code/Business Layer/ReportPropertiesTable.vb @@ -0,0 +1,89 @@ +' This is a "safe" class, meaning that it is created once +' and never overwritten. Any custom code you add to this class +' will be preserved when you regenerate your application. +' +' Typical customizations that may be done in this class include +' - adding custom event handlers +' - overriding base class methods + +Imports System.Data.SqlTypes +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + +Namespace Persons.Business + +''' +''' Provides access to the schema information and record data of a database table (or view). +''' See for additional information. +''' +''' +''' See for additional information. +''' +''' This class is implemented using the Singleton design pattern. +''' +''' +''' This is a "safe" class, meaning that it is generated once and never overwritten. +''' Any changes you make to this class will be preserved when you regenerate your application. +''' +''' +''' +''' +''' +''' +''' +''' + + Public Class ReportPropertiesTable + Inherits BaseReportPropertiesTable + Implements System.Runtime.Serialization.ISerializable, ISingleton + + +#Region "ISerializable Members" + + ''' + ''' Overridden to use the class + ''' for deserialization of data. + ''' + ''' + ''' Since the class is implemented using the Singleton design pattern, + ''' this method must be overridden to prevent additional instances from being created during deserialization. + ''' + Protected Overridable Sub GetObjectData( _ + ByVal info As System.Runtime.Serialization.SerializationInfo, _ + ByVal context As System.Runtime.Serialization.StreamingContext _ + ) Implements System.Runtime.Serialization.ISerializable.GetObjectData + info.SetType(GetType(ReportPropertiesTable_SerializationHelper)) 'No other values need to be added + End Sub + +#Region "Class ReportPropertiesTable_SerializationHelper" + + Private Class ReportPropertiesTable_SerializationHelper + Implements System.Runtime.Serialization.IObjectReference + + 'Method called after this object is deserialized + Public Function GetRealObject(ByVal context As System.Runtime.Serialization.StreamingContext) As Object _ + Implements System.Runtime.Serialization.IObjectReference.GetRealObject + Return ReportPropertiesTable.Instance + End Function + End Class + +#End Region + +#End Region + + ''' + ''' References the only instance of the class. + ''' + ''' + ''' Since the class is implemented using the Singleton design pattern, + ''' this field is the only way to access an instance of the class. + ''' + Public Shared ReadOnly Instance As New ReportPropertiesTable() + + Private Sub New() + MyBase.New() + End Sub + +End Class ' ReportPropertiesTable +End Namespace diff --git a/App_Code/Business Layer/SectionRecord.vb b/App_Code/Business Layer/SectionRecord.vb new file mode 100644 index 0000000..88892a8 --- /dev/null +++ b/App_Code/Business Layer/SectionRecord.vb @@ -0,0 +1,35 @@ +' This is a "safe" class, meaning that it is created once +' and never overwritten. Any custom code you add to this class +' will be preserved when you regenerate your application. +' +' Typical customizations that may be done in this class include +' - adding custom event handlers +' - overriding base class methods + +Imports System.Data.SqlTypes +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + +Namespace Persons.Business + +''' +''' Provides access to the data in a database record. +''' Also provides access to the that each record is associated with. +''' +''' +''' +''' + + Public Class SectionRecord + Inherits BaseSectionRecord + + ' Constructors + + Public Sub New() + MyBase.New() + End Sub + + +End Class +End Namespace diff --git a/App_Code/Business Layer/SectionTable.vb b/App_Code/Business Layer/SectionTable.vb new file mode 100644 index 0000000..86368f6 --- /dev/null +++ b/App_Code/Business Layer/SectionTable.vb @@ -0,0 +1,89 @@ +' This is a "safe" class, meaning that it is created once +' and never overwritten. Any custom code you add to this class +' will be preserved when you regenerate your application. +' +' Typical customizations that may be done in this class include +' - adding custom event handlers +' - overriding base class methods + +Imports System.Data.SqlTypes +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + +Namespace Persons.Business + +''' +''' Provides access to the schema information and record data of a database table (or view). +''' See for additional information. +''' +''' +''' See for additional information. +''' +''' This class is implemented using the Singleton design pattern. +''' +''' +''' This is a "safe" class, meaning that it is generated once and never overwritten. +''' Any changes you make to this class will be preserved when you regenerate your application. +''' +''' +''' +''' +''' +''' +''' +''' + + Public Class SectionTable + Inherits BaseSectionTable + Implements System.Runtime.Serialization.ISerializable, ISingleton + + +#Region "ISerializable Members" + + ''' + ''' Overridden to use the class + ''' for deserialization of data. + ''' + ''' + ''' Since the class is implemented using the Singleton design pattern, + ''' this method must be overridden to prevent additional instances from being created during deserialization. + ''' + Protected Overridable Sub GetObjectData( _ + ByVal info As System.Runtime.Serialization.SerializationInfo, _ + ByVal context As System.Runtime.Serialization.StreamingContext _ + ) Implements System.Runtime.Serialization.ISerializable.GetObjectData + info.SetType(GetType(SectionTable_SerializationHelper)) 'No other values need to be added + End Sub + +#Region "Class SectionTable_SerializationHelper" + + Private Class SectionTable_SerializationHelper + Implements System.Runtime.Serialization.IObjectReference + + 'Method called after this object is deserialized + Public Function GetRealObject(ByVal context As System.Runtime.Serialization.StreamingContext) As Object _ + Implements System.Runtime.Serialization.IObjectReference.GetRealObject + Return SectionTable.Instance + End Function + End Class + +#End Region + +#End Region + + ''' + ''' References the only instance of the class. + ''' + ''' + ''' Since the class is implemented using the Singleton design pattern, + ''' this field is the only way to access an instance of the class. + ''' + Public Shared ReadOnly Instance As New SectionTable() + + Private Sub New() + MyBase.New() + End Sub + +End Class ' SectionTable +End Namespace diff --git a/App_Code/Business Layer/SexRecord.vb b/App_Code/Business Layer/SexRecord.vb new file mode 100644 index 0000000..bb1f5d7 --- /dev/null +++ b/App_Code/Business Layer/SexRecord.vb @@ -0,0 +1,35 @@ +' This is a "safe" class, meaning that it is created once +' and never overwritten. Any custom code you add to this class +' will be preserved when you regenerate your application. +' +' Typical customizations that may be done in this class include +' - adding custom event handlers +' - overriding base class methods + +Imports System.Data.SqlTypes +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + +Namespace Persons.Business + +''' +''' Provides access to the data in a database record. +''' Also provides access to the that each record is associated with. +''' +''' +''' +''' + + Public Class SexRecord + Inherits BaseSexRecord + + ' Constructors + + Public Sub New() + MyBase.New() + End Sub + + +End Class +End Namespace diff --git a/App_Code/Business Layer/SexTable.vb b/App_Code/Business Layer/SexTable.vb new file mode 100644 index 0000000..161bcfc --- /dev/null +++ b/App_Code/Business Layer/SexTable.vb @@ -0,0 +1,89 @@ +' This is a "safe" class, meaning that it is created once +' and never overwritten. Any custom code you add to this class +' will be preserved when you regenerate your application. +' +' Typical customizations that may be done in this class include +' - adding custom event handlers +' - overriding base class methods + +Imports System.Data.SqlTypes +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + +Namespace Persons.Business + +''' +''' Provides access to the schema information and record data of a database table (or view). +''' See for additional information. +''' +''' +''' See for additional information. +''' +''' This class is implemented using the Singleton design pattern. +''' +''' +''' This is a "safe" class, meaning that it is generated once and never overwritten. +''' Any changes you make to this class will be preserved when you regenerate your application. +''' +''' +''' +''' +''' +''' +''' +''' + + Public Class SexTable + Inherits BaseSexTable + Implements System.Runtime.Serialization.ISerializable, ISingleton + + +#Region "ISerializable Members" + + ''' + ''' Overridden to use the class + ''' for deserialization of data. + ''' + ''' + ''' Since the class is implemented using the Singleton design pattern, + ''' this method must be overridden to prevent additional instances from being created during deserialization. + ''' + Protected Overridable Sub GetObjectData( _ + ByVal info As System.Runtime.Serialization.SerializationInfo, _ + ByVal context As System.Runtime.Serialization.StreamingContext _ + ) Implements System.Runtime.Serialization.ISerializable.GetObjectData + info.SetType(GetType(SexTable_SerializationHelper)) 'No other values need to be added + End Sub + +#Region "Class SexTable_SerializationHelper" + + Private Class SexTable_SerializationHelper + Implements System.Runtime.Serialization.IObjectReference + + 'Method called after this object is deserialized + Public Function GetRealObject(ByVal context As System.Runtime.Serialization.StreamingContext) As Object _ + Implements System.Runtime.Serialization.IObjectReference.GetRealObject + Return SexTable.Instance + End Function + End Class + +#End Region + +#End Region + + ''' + ''' References the only instance of the class. + ''' + ''' + ''' Since the class is implemented using the Singleton design pattern, + ''' this field is the only way to access an instance of the class. + ''' + Public Shared ReadOnly Instance As New SexTable() + + Private Sub New() + MyBase.New() + End Sub + +End Class ' SexTable +End Namespace diff --git a/App_Code/Business Layer/ShowPersonalEducationTableQuery.vb.old b/App_Code/Business Layer/ShowPersonalEducationTableQuery.vb.old new file mode 100644 index 0000000..ac2e8a5 --- /dev/null +++ b/App_Code/Business Layer/ShowPersonalEducationTableQuery.vb.old @@ -0,0 +1,88 @@ +' This is a "safe" class, meaning that it is created once +' and never overwritten. Any custom code you add to this class +' will be preserved when you regenerate your application. +' +' Typical customizations that may be done in this class include +' - adding custom event handlers +' - overriding base class methods + +Imports System +Imports System.Data.SqlTypes +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + +Namespace Persons.Business + +''' +''' Provides access to the schema information and record data of the ShowPersonalEducationTable custom query. +''' See for additional information. +''' +''' +''' See for additional information. +''' +''' This class is implemented using the Singleton design pattern. +''' +''' +''' +''' +''' +''' +''' +''' + + Public Class ShowPersonalEducationTableQuery + Inherits BaseShowPersonalEducationTableQuery + Implements System.Runtime.Serialization.ISerializable, ISingleton + + +#Region "ISerializable Members" + + ''' + ''' Overridden to use the class + ''' for deserialization of data. + ''' + ''' + ''' Since the class is implemented using the Singleton design pattern, + ''' this method must be overridden to prevent additional instances from being created during deserialization. + ''' + Protected Overridable Sub GetObjectData( _ + ByVal info As System.Runtime.Serialization.SerializationInfo, _ + ByVal context As System.Runtime.Serialization.StreamingContext _ + ) Implements System.Runtime.Serialization.ISerializable.GetObjectData + info.SetType(GetType(ShowPersonalEducationTableQuery_SerializationHelper)) 'No other values need to be added + End Sub + +#Region "Class ShowPersonalEducationTableQuery_SerializationHelper" + + Private Class ShowPersonalEducationTableQuery_SerializationHelper + Implements System.Runtime.Serialization.IObjectReference + + 'Method called after this object is deserialized + Public Function GetRealObject(ByVal context As System.Runtime.Serialization.StreamingContext) As Object _ + Implements System.Runtime.Serialization.IObjectReference.GetRealObject + Return ShowPersonalEducationTableQuery.Instance + End Function + End Class + +#End Region + +#End Region + + ''' + ''' References the only instance of the class. + ''' + ''' + ''' Since the class is implemented using the Singleton design pattern, + ''' this field is the only way to access an instance of the class. + ''' + Public Shared ReadOnly Instance As New ShowPersonalEducationTableQuery() + + Private Sub New() + MyBase.New() + End Sub + + +End Class + +End Namespace diff --git a/App_Code/Business Layer/ShowPersonalEducationTableRecord.vb.old b/App_Code/Business Layer/ShowPersonalEducationTableRecord.vb.old new file mode 100644 index 0000000..171d23f --- /dev/null +++ b/App_Code/Business Layer/ShowPersonalEducationTableRecord.vb.old @@ -0,0 +1,34 @@ +' This is a "safe" class, meaning that it is created once +' and never overwritten. Any custom code you add to this class +' will be preserved when you regenerate your application. +' +' Typical customizations that may be done in this class include +' - adding custom event handlers +' - overriding base class methods + +Imports System.Data.SqlTypes +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + +Namespace Persons.Business + +''' +''' Provides access to the data in a record associated with a custom query. +''' Also provides access to the that each record is associated with. +''' +''' +''' This is a "safe" class, meaning that it is generated once and never overwritten. +''' Any changes you make to this class will be preserved when you regenerate your application. +''' +''' + + Public Class ShowPersonalEducationTableRecord + Inherits BaseShowPersonalEducationTableRecord + + Public Sub New() + MyBase.New() + End Sub + +End Class +End Namespace diff --git a/App_Code/Business Layer/ShowPersonalIdTableQuery.vb b/App_Code/Business Layer/ShowPersonalIdTableQuery.vb new file mode 100644 index 0000000..0719207 --- /dev/null +++ b/App_Code/Business Layer/ShowPersonalIdTableQuery.vb @@ -0,0 +1,88 @@ +' This is a "safe" class, meaning that it is created once +' and never overwritten. Any custom code you add to this class +' will be preserved when you regenerate your application. +' +' Typical customizations that may be done in this class include +' - adding custom event handlers +' - overriding base class methods + +Imports System +Imports System.Data.SqlTypes +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + +Namespace Persons.Business + +''' +''' Provides access to the schema information and record data of the ShowPersonalIdTable custom query. +''' See for additional information. +''' +''' +''' See for additional information. +''' +''' This class is implemented using the Singleton design pattern. +''' +''' +''' +''' +''' +''' +''' +''' + + Public Class ShowPersonalIdTableQuery + Inherits BaseShowPersonalIdTableQuery + Implements System.Runtime.Serialization.ISerializable, ISingleton + + +#Region "ISerializable Members" + + ''' + ''' Overridden to use the class + ''' for deserialization of data. + ''' + ''' + ''' Since the class is implemented using the Singleton design pattern, + ''' this method must be overridden to prevent additional instances from being created during deserialization. + ''' + Protected Overridable Sub GetObjectData( _ + ByVal info As System.Runtime.Serialization.SerializationInfo, _ + ByVal context As System.Runtime.Serialization.StreamingContext _ + ) Implements System.Runtime.Serialization.ISerializable.GetObjectData + info.SetType(GetType(ShowPersonalIdTableQuery_SerializationHelper)) 'No other values need to be added + End Sub + +#Region "Class ShowPersonalIdTableQuery_SerializationHelper" + + Private Class ShowPersonalIdTableQuery_SerializationHelper + Implements System.Runtime.Serialization.IObjectReference + + 'Method called after this object is deserialized + Public Function GetRealObject(ByVal context As System.Runtime.Serialization.StreamingContext) As Object _ + Implements System.Runtime.Serialization.IObjectReference.GetRealObject + Return ShowPersonalIdTableQuery.Instance + End Function + End Class + +#End Region + +#End Region + + ''' + ''' References the only instance of the class. + ''' + ''' + ''' Since the class is implemented using the Singleton design pattern, + ''' this field is the only way to access an instance of the class. + ''' + Public Shared ReadOnly Instance As New ShowPersonalIdTableQuery() + + Private Sub New() + MyBase.New() + End Sub + + +End Class + +End Namespace diff --git a/App_Code/Business Layer/ShowPersonalIdTableRecord.vb b/App_Code/Business Layer/ShowPersonalIdTableRecord.vb new file mode 100644 index 0000000..633334d --- /dev/null +++ b/App_Code/Business Layer/ShowPersonalIdTableRecord.vb @@ -0,0 +1,34 @@ +' This is a "safe" class, meaning that it is created once +' and never overwritten. Any custom code you add to this class +' will be preserved when you regenerate your application. +' +' Typical customizations that may be done in this class include +' - adding custom event handlers +' - overriding base class methods + +Imports System.Data.SqlTypes +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + +Namespace Persons.Business + +''' +''' Provides access to the data in a record associated with a custom query. +''' Also provides access to the that each record is associated with. +''' +''' +''' This is a "safe" class, meaning that it is generated once and never overwritten. +''' Any changes you make to this class will be preserved when you regenerate your application. +''' +''' + + Public Class ShowPersonalIdTableRecord + Inherits BaseShowPersonalIdTableRecord + + Public Sub New() + MyBase.New() + End Sub + +End Class +End Namespace diff --git a/App_Code/Business Layer/SportRecord.vb b/App_Code/Business Layer/SportRecord.vb new file mode 100644 index 0000000..e74d5a8 --- /dev/null +++ b/App_Code/Business Layer/SportRecord.vb @@ -0,0 +1,35 @@ +' This is a "safe" class, meaning that it is created once +' and never overwritten. Any custom code you add to this class +' will be preserved when you regenerate your application. +' +' Typical customizations that may be done in this class include +' - adding custom event handlers +' - overriding base class methods + +Imports System.Data.SqlTypes +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + +Namespace Persons.Business + +''' +''' Provides access to the data in a database record. +''' Also provides access to the that each record is associated with. +''' +''' +''' +''' + + Public Class SportRecord + Inherits BaseSportRecord + + ' Constructors + + Public Sub New() + MyBase.New() + End Sub + + +End Class +End Namespace diff --git a/App_Code/Business Layer/SportTable.vb b/App_Code/Business Layer/SportTable.vb new file mode 100644 index 0000000..00b57a1 --- /dev/null +++ b/App_Code/Business Layer/SportTable.vb @@ -0,0 +1,89 @@ +' This is a "safe" class, meaning that it is created once +' and never overwritten. Any custom code you add to this class +' will be preserved when you regenerate your application. +' +' Typical customizations that may be done in this class include +' - adding custom event handlers +' - overriding base class methods + +Imports System.Data.SqlTypes +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + +Namespace Persons.Business + +''' +''' Provides access to the schema information and record data of a database table (or view). +''' See for additional information. +''' +''' +''' See for additional information. +''' +''' This class is implemented using the Singleton design pattern. +''' +''' +''' This is a "safe" class, meaning that it is generated once and never overwritten. +''' Any changes you make to this class will be preserved when you regenerate your application. +''' +''' +''' +''' +''' +''' +''' +''' + + Public Class SportTable + Inherits BaseSportTable + Implements System.Runtime.Serialization.ISerializable, ISingleton + + +#Region "ISerializable Members" + + ''' + ''' Overridden to use the class + ''' for deserialization of data. + ''' + ''' + ''' Since the class is implemented using the Singleton design pattern, + ''' this method must be overridden to prevent additional instances from being created during deserialization. + ''' + Protected Overridable Sub GetObjectData( _ + ByVal info As System.Runtime.Serialization.SerializationInfo, _ + ByVal context As System.Runtime.Serialization.StreamingContext _ + ) Implements System.Runtime.Serialization.ISerializable.GetObjectData + info.SetType(GetType(SportTable_SerializationHelper)) 'No other values need to be added + End Sub + +#Region "Class SportTable_SerializationHelper" + + Private Class SportTable_SerializationHelper + Implements System.Runtime.Serialization.IObjectReference + + 'Method called after this object is deserialized + Public Function GetRealObject(ByVal context As System.Runtime.Serialization.StreamingContext) As Object _ + Implements System.Runtime.Serialization.IObjectReference.GetRealObject + Return SportTable.Instance + End Function + End Class + +#End Region + +#End Region + + ''' + ''' References the only instance of the class. + ''' + ''' + ''' Since the class is implemented using the Singleton design pattern, + ''' this field is the only way to access an instance of the class. + ''' + Public Shared ReadOnly Instance As New SportTable() + + Private Sub New() + MyBase.New() + End Sub + +End Class ' SportTable +End Namespace diff --git a/App_Code/Business Layer/StatusRecord.vb b/App_Code/Business Layer/StatusRecord.vb new file mode 100644 index 0000000..1477c81 --- /dev/null +++ b/App_Code/Business Layer/StatusRecord.vb @@ -0,0 +1,35 @@ +' This is a "safe" class, meaning that it is created once +' and never overwritten. Any custom code you add to this class +' will be preserved when you regenerate your application. +' +' Typical customizations that may be done in this class include +' - adding custom event handlers +' - overriding base class methods + +Imports System.Data.SqlTypes +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + +Namespace Persons.Business + +''' +''' Provides access to the data in a database record. +''' Also provides access to the that each record is associated with. +''' +''' +''' +''' + + Public Class StatusRecord + Inherits BaseStatusRecord + + ' Constructors + + Public Sub New() + MyBase.New() + End Sub + + +End Class +End Namespace diff --git a/App_Code/Business Layer/StatusTable.vb b/App_Code/Business Layer/StatusTable.vb new file mode 100644 index 0000000..b44858b --- /dev/null +++ b/App_Code/Business Layer/StatusTable.vb @@ -0,0 +1,89 @@ +' This is a "safe" class, meaning that it is created once +' and never overwritten. Any custom code you add to this class +' will be preserved when you regenerate your application. +' +' Typical customizations that may be done in this class include +' - adding custom event handlers +' - overriding base class methods + +Imports System.Data.SqlTypes +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + +Namespace Persons.Business + +''' +''' Provides access to the schema information and record data of a database table (or view). +''' See for additional information. +''' +''' +''' See for additional information. +''' +''' This class is implemented using the Singleton design pattern. +''' +''' +''' This is a "safe" class, meaning that it is generated once and never overwritten. +''' Any changes you make to this class will be preserved when you regenerate your application. +''' +''' +''' +''' +''' +''' +''' +''' + + Public Class StatusTable + Inherits BaseStatusTable + Implements System.Runtime.Serialization.ISerializable, ISingleton + + +#Region "ISerializable Members" + + ''' + ''' Overridden to use the class + ''' for deserialization of data. + ''' + ''' + ''' Since the class is implemented using the Singleton design pattern, + ''' this method must be overridden to prevent additional instances from being created during deserialization. + ''' + Protected Overridable Sub GetObjectData( _ + ByVal info As System.Runtime.Serialization.SerializationInfo, _ + ByVal context As System.Runtime.Serialization.StreamingContext _ + ) Implements System.Runtime.Serialization.ISerializable.GetObjectData + info.SetType(GetType(StatusTable_SerializationHelper)) 'No other values need to be added + End Sub + +#Region "Class StatusTable_SerializationHelper" + + Private Class StatusTable_SerializationHelper + Implements System.Runtime.Serialization.IObjectReference + + 'Method called after this object is deserialized + Public Function GetRealObject(ByVal context As System.Runtime.Serialization.StreamingContext) As Object _ + Implements System.Runtime.Serialization.IObjectReference.GetRealObject + Return StatusTable.Instance + End Function + End Class + +#End Region + +#End Region + + ''' + ''' References the only instance of the class. + ''' + ''' + ''' Since the class is implemented using the Singleton design pattern, + ''' this field is the only way to access an instance of the class. + ''' + Public Shared ReadOnly Instance As New StatusTable() + + Private Sub New() + MyBase.New() + End Sub + +End Class ' StatusTable +End Namespace diff --git a/App_Code/Business Layer/TblRoleRecord.vb b/App_Code/Business Layer/TblRoleRecord.vb new file mode 100644 index 0000000..03eac85 --- /dev/null +++ b/App_Code/Business Layer/TblRoleRecord.vb @@ -0,0 +1,35 @@ +' This is a "safe" class, meaning that it is created once +' and never overwritten. Any custom code you add to this class +' will be preserved when you regenerate your application. +' +' Typical customizations that may be done in this class include +' - adding custom event handlers +' - overriding base class methods + +Imports System.Data.SqlTypes +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + +Namespace Persons.Business + +''' +''' Provides access to the data in a database record. +''' Also provides access to the that each record is associated with. +''' +''' +''' +''' + + Public Class TblRoleRecord + Inherits BaseTblRoleRecord + + ' Constructors + + Public Sub New() + MyBase.New() + End Sub + + +End Class +End Namespace diff --git a/App_Code/Business Layer/TblRoleTable.vb b/App_Code/Business Layer/TblRoleTable.vb new file mode 100644 index 0000000..6fc2e76 --- /dev/null +++ b/App_Code/Business Layer/TblRoleTable.vb @@ -0,0 +1,89 @@ +' This is a "safe" class, meaning that it is created once +' and never overwritten. Any custom code you add to this class +' will be preserved when you regenerate your application. +' +' Typical customizations that may be done in this class include +' - adding custom event handlers +' - overriding base class methods + +Imports System.Data.SqlTypes +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + +Namespace Persons.Business + +''' +''' Provides access to the schema information and record data of a database table (or view). +''' See for additional information. +''' +''' +''' See for additional information. +''' +''' This class is implemented using the Singleton design pattern. +''' +''' +''' This is a "safe" class, meaning that it is generated once and never overwritten. +''' Any changes you make to this class will be preserved when you regenerate your application. +''' +''' +''' +''' +''' +''' +''' +''' + + Public Class TblRoleTable + Inherits BaseTblRoleTable + Implements System.Runtime.Serialization.ISerializable, ISingleton + + +#Region "ISerializable Members" + + ''' + ''' Overridden to use the class + ''' for deserialization of data. + ''' + ''' + ''' Since the class is implemented using the Singleton design pattern, + ''' this method must be overridden to prevent additional instances from being created during deserialization. + ''' + Protected Overridable Sub GetObjectData( _ + ByVal info As System.Runtime.Serialization.SerializationInfo, _ + ByVal context As System.Runtime.Serialization.StreamingContext _ + ) Implements System.Runtime.Serialization.ISerializable.GetObjectData + info.SetType(GetType(TblRoleTable_SerializationHelper)) 'No other values need to be added + End Sub + +#Region "Class TblRoleTable_SerializationHelper" + + Private Class TblRoleTable_SerializationHelper + Implements System.Runtime.Serialization.IObjectReference + + 'Method called after this object is deserialized + Public Function GetRealObject(ByVal context As System.Runtime.Serialization.StreamingContext) As Object _ + Implements System.Runtime.Serialization.IObjectReference.GetRealObject + Return TblRoleTable.Instance + End Function + End Class + +#End Region + +#End Region + + ''' + ''' References the only instance of the class. + ''' + ''' + ''' Since the class is implemented using the Singleton design pattern, + ''' this field is the only way to access an instance of the class. + ''' + Public Shared ReadOnly Instance As New TblRoleTable() + + Private Sub New() + MyBase.New() + End Sub + +End Class ' TblRoleTable +End Namespace diff --git a/App_Code/Business Layer/TblUserRoleRecord.vb b/App_Code/Business Layer/TblUserRoleRecord.vb new file mode 100644 index 0000000..1464735 --- /dev/null +++ b/App_Code/Business Layer/TblUserRoleRecord.vb @@ -0,0 +1,35 @@ +' This is a "safe" class, meaning that it is created once +' and never overwritten. Any custom code you add to this class +' will be preserved when you regenerate your application. +' +' Typical customizations that may be done in this class include +' - adding custom event handlers +' - overriding base class methods + +Imports System.Data.SqlTypes +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + +Namespace Persons.Business + +''' +''' Provides access to the data in a database record. +''' Also provides access to the that each record is associated with. +''' +''' +''' +''' + + Public Class TblUserRoleRecord + Inherits BaseTblUserRoleRecord + + ' Constructors + + Public Sub New() + MyBase.New() + End Sub + + +End Class +End Namespace diff --git a/App_Code/Business Layer/TblUserRoleTable.vb b/App_Code/Business Layer/TblUserRoleTable.vb new file mode 100644 index 0000000..ce0ac27 --- /dev/null +++ b/App_Code/Business Layer/TblUserRoleTable.vb @@ -0,0 +1,89 @@ +' This is a "safe" class, meaning that it is created once +' and never overwritten. Any custom code you add to this class +' will be preserved when you regenerate your application. +' +' Typical customizations that may be done in this class include +' - adding custom event handlers +' - overriding base class methods + +Imports System.Data.SqlTypes +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + +Namespace Persons.Business + +''' +''' Provides access to the schema information and record data of a database table (or view). +''' See for additional information. +''' +''' +''' See for additional information. +''' +''' This class is implemented using the Singleton design pattern. +''' +''' +''' This is a "safe" class, meaning that it is generated once and never overwritten. +''' Any changes you make to this class will be preserved when you regenerate your application. +''' +''' +''' +''' +''' +''' +''' +''' + + Public Class TblUserRoleTable + Inherits BaseTblUserRoleTable + Implements System.Runtime.Serialization.ISerializable, ISingleton + + +#Region "ISerializable Members" + + ''' + ''' Overridden to use the class + ''' for deserialization of data. + ''' + ''' + ''' Since the class is implemented using the Singleton design pattern, + ''' this method must be overridden to prevent additional instances from being created during deserialization. + ''' + Protected Overridable Sub GetObjectData( _ + ByVal info As System.Runtime.Serialization.SerializationInfo, _ + ByVal context As System.Runtime.Serialization.StreamingContext _ + ) Implements System.Runtime.Serialization.ISerializable.GetObjectData + info.SetType(GetType(TblUserRoleTable_SerializationHelper)) 'No other values need to be added + End Sub + +#Region "Class TblUserRoleTable_SerializationHelper" + + Private Class TblUserRoleTable_SerializationHelper + Implements System.Runtime.Serialization.IObjectReference + + 'Method called after this object is deserialized + Public Function GetRealObject(ByVal context As System.Runtime.Serialization.StreamingContext) As Object _ + Implements System.Runtime.Serialization.IObjectReference.GetRealObject + Return TblUserRoleTable.Instance + End Function + End Class + +#End Region + +#End Region + + ''' + ''' References the only instance of the class. + ''' + ''' + ''' Since the class is implemented using the Singleton design pattern, + ''' this field is the only way to access an instance of the class. + ''' + Public Shared ReadOnly Instance As New TblUserRoleTable() + + Private Sub New() + MyBase.New() + End Sub + +End Class ' TblUserRoleTable +End Namespace diff --git a/App_Code/Business Layer/View_MaxPersonalEducationRecord.vb b/App_Code/Business Layer/View_MaxPersonalEducationRecord.vb new file mode 100644 index 0000000..97d40b2 --- /dev/null +++ b/App_Code/Business Layer/View_MaxPersonalEducationRecord.vb @@ -0,0 +1,38 @@ +' This is a "safe" class, meaning that it is created once +' and never overwritten. Any custom code you add to this class +' will be preserved when you regenerate your application. +' +' Typical customizations that may be done in this class include +' - adding custom event handlers +' - overriding base class methods + +Imports System.Data.SqlTypes +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + +Namespace Persons.Business + +''' +''' Provides access to the data in a database record from a table (or view) that lacks a primary key. +''' Also provides access to the that each record is associated with. +''' +''' +''' +''' This is a "safe" class, meaning that it is generated once and never overwritten. +''' Any changes you make to this class will be preserved when you regenerate your application. +''' +''' +''' + + Public Class View_MaxPersonalEducationRecord + Inherits BaseView_MaxPersonalEducationRecord + + ' Constructors + + Public Sub New() + MyBase.New() + End Sub + +End Class +End Namespace diff --git a/App_Code/Business Layer/View_MaxPersonalEducationView.vb b/App_Code/Business Layer/View_MaxPersonalEducationView.vb new file mode 100644 index 0000000..5f2d2cf --- /dev/null +++ b/App_Code/Business Layer/View_MaxPersonalEducationView.vb @@ -0,0 +1,86 @@ +' This is a "safe" class, meaning that it is created once +' and never overwritten. Any custom code you add to this class +' will be preserved when you regenerate your application. +' +' Typical customizations that may be done in this class include +' - adding custom event handlers +' - overriding base class methods + +Imports System.Data.SqlTypes +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + +Namespace Persons.Business + +''' +''' Provides access to the schema information and record data of a database table (or view). +''' See for additional information. +''' +''' +''' See for additional information. +''' +''' This class is implemented using the Singleton design pattern. +''' +''' +''' +''' +''' +''' +''' +''' + + Public Class View_MaxPersonalEducationView + Inherits BaseView_MaxPersonalEducationView + Implements System.Runtime.Serialization.ISerializable, ISingleton + + +#Region "ISerializable Members" + + ''' + ''' Overridden to use the class + ''' for deserialization of data. + ''' + ''' + ''' Since the class is implemented using the Singleton design pattern, + ''' this method must be overridden to prevent additional instances from being created during deserialization. + ''' + Protected Overridable Sub GetObjectData( _ + ByVal info As System.Runtime.Serialization.SerializationInfo, _ + ByVal context As System.Runtime.Serialization.StreamingContext _ + ) Implements System.Runtime.Serialization.ISerializable.GetObjectData + info.SetType(GetType(View_MaxPersonalEducationView_SerializationHelper)) 'No other values need to be added + End Sub + +#Region "Class View_MaxPersonalEducationView_SerializationHelper" + + Private Class View_MaxPersonalEducationView_SerializationHelper + Implements System.Runtime.Serialization.IObjectReference + + 'Method called after this object is deserialized + Public Function GetRealObject(ByVal context As System.Runtime.Serialization.StreamingContext) As Object _ + Implements System.Runtime.Serialization.IObjectReference.GetRealObject + Return View_MaxPersonalEducationView.Instance + End Function + End Class + +#End Region + +#End Region + + ''' + ''' References the only instance of the class. + ''' + ''' + ''' Since the class is implemented using the Singleton design pattern, + ''' this field is the only way to access an instance of the class. + ''' + Public Shared ReadOnly Instance As New View_MaxPersonalEducationView() + + Private Sub New() + MyBase.New() + End Sub + + +End Class +End Namespace diff --git a/App_Code/Business Layer/View_PersonalEducationRecord.vb b/App_Code/Business Layer/View_PersonalEducationRecord.vb new file mode 100644 index 0000000..01d5d53 --- /dev/null +++ b/App_Code/Business Layer/View_PersonalEducationRecord.vb @@ -0,0 +1,38 @@ +' This is a "safe" class, meaning that it is created once +' and never overwritten. Any custom code you add to this class +' will be preserved when you regenerate your application. +' +' Typical customizations that may be done in this class include +' - adding custom event handlers +' - overriding base class methods + +Imports System.Data.SqlTypes +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + +Namespace Persons.Business + +''' +''' Provides access to the data in a database record from a table (or view) that lacks a primary key. +''' Also provides access to the that each record is associated with. +''' +''' +''' +''' This is a "safe" class, meaning that it is generated once and never overwritten. +''' Any changes you make to this class will be preserved when you regenerate your application. +''' +''' +''' + + Public Class View_PersonalEducationRecord + Inherits BaseView_PersonalEducationRecord + + ' Constructors + + Public Sub New() + MyBase.New() + End Sub + +End Class +End Namespace diff --git a/App_Code/Business Layer/View_PersonalEducationView.vb b/App_Code/Business Layer/View_PersonalEducationView.vb new file mode 100644 index 0000000..83cea80 --- /dev/null +++ b/App_Code/Business Layer/View_PersonalEducationView.vb @@ -0,0 +1,86 @@ +' This is a "safe" class, meaning that it is created once +' and never overwritten. Any custom code you add to this class +' will be preserved when you regenerate your application. +' +' Typical customizations that may be done in this class include +' - adding custom event handlers +' - overriding base class methods + +Imports System.Data.SqlTypes +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + +Namespace Persons.Business + +''' +''' Provides access to the schema information and record data of a database table (or view). +''' See for additional information. +''' +''' +''' See for additional information. +''' +''' This class is implemented using the Singleton design pattern. +''' +''' +''' +''' +''' +''' +''' +''' + + Public Class View_PersonalEducationView + Inherits BaseView_PersonalEducationView + Implements System.Runtime.Serialization.ISerializable, ISingleton + + +#Region "ISerializable Members" + + ''' + ''' Overridden to use the class + ''' for deserialization of data. + ''' + ''' + ''' Since the class is implemented using the Singleton design pattern, + ''' this method must be overridden to prevent additional instances from being created during deserialization. + ''' + Protected Overridable Sub GetObjectData( _ + ByVal info As System.Runtime.Serialization.SerializationInfo, _ + ByVal context As System.Runtime.Serialization.StreamingContext _ + ) Implements System.Runtime.Serialization.ISerializable.GetObjectData + info.SetType(GetType(View_PersonalEducationView_SerializationHelper)) 'No other values need to be added + End Sub + +#Region "Class View_PersonalEducationView_SerializationHelper" + + Private Class View_PersonalEducationView_SerializationHelper + Implements System.Runtime.Serialization.IObjectReference + + 'Method called after this object is deserialized + Public Function GetRealObject(ByVal context As System.Runtime.Serialization.StreamingContext) As Object _ + Implements System.Runtime.Serialization.IObjectReference.GetRealObject + Return View_PersonalEducationView.Instance + End Function + End Class + +#End Region + +#End Region + + ''' + ''' References the only instance of the class. + ''' + ''' + ''' Since the class is implemented using the Singleton design pattern, + ''' this field is the only way to access an instance of the class. + ''' + Public Shared ReadOnly Instance As New View_PersonalEducationView() + + Private Sub New() + MyBase.New() + End Sub + + +End Class +End Namespace diff --git a/App_Code/Business Layer/View_PersonsRecord.vb b/App_Code/Business Layer/View_PersonsRecord.vb new file mode 100644 index 0000000..018ca21 --- /dev/null +++ b/App_Code/Business Layer/View_PersonsRecord.vb @@ -0,0 +1,38 @@ +' This is a "safe" class, meaning that it is created once +' and never overwritten. Any custom code you add to this class +' will be preserved when you regenerate your application. +' +' Typical customizations that may be done in this class include +' - adding custom event handlers +' - overriding base class methods + +Imports System.Data.SqlTypes +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + +Namespace Persons.Business + +''' +''' Provides access to the data in a database record from a table (or view) that lacks a primary key. +''' Also provides access to the that each record is associated with. +''' +''' +''' +''' This is a "safe" class, meaning that it is generated once and never overwritten. +''' Any changes you make to this class will be preserved when you regenerate your application. +''' +''' +''' + + Public Class View_PersonsRecord + Inherits BaseView_PersonsRecord + + ' Constructors + + Public Sub New() + MyBase.New() + End Sub + +End Class +End Namespace diff --git a/App_Code/Business Layer/View_PersonsView.vb b/App_Code/Business Layer/View_PersonsView.vb new file mode 100644 index 0000000..bcb0459 --- /dev/null +++ b/App_Code/Business Layer/View_PersonsView.vb @@ -0,0 +1,86 @@ +' This is a "safe" class, meaning that it is created once +' and never overwritten. Any custom code you add to this class +' will be preserved when you regenerate your application. +' +' Typical customizations that may be done in this class include +' - adding custom event handlers +' - overriding base class methods + +Imports System.Data.SqlTypes +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + +Namespace Persons.Business + +''' +''' Provides access to the schema information and record data of a database table (or view). +''' See for additional information. +''' +''' +''' See for additional information. +''' +''' This class is implemented using the Singleton design pattern. +''' +''' +''' +''' +''' +''' +''' +''' + + Public Class View_PersonsView + Inherits BaseView_PersonsView + Implements System.Runtime.Serialization.ISerializable, ISingleton + + +#Region "ISerializable Members" + + ''' + ''' Overridden to use the class + ''' for deserialization of data. + ''' + ''' + ''' Since the class is implemented using the Singleton design pattern, + ''' this method must be overridden to prevent additional instances from being created during deserialization. + ''' + Protected Overridable Sub GetObjectData( _ + ByVal info As System.Runtime.Serialization.SerializationInfo, _ + ByVal context As System.Runtime.Serialization.StreamingContext _ + ) Implements System.Runtime.Serialization.ISerializable.GetObjectData + info.SetType(GetType(View_PersonsView_SerializationHelper)) 'No other values need to be added + End Sub + +#Region "Class View_PersonsView_SerializationHelper" + + Private Class View_PersonsView_SerializationHelper + Implements System.Runtime.Serialization.IObjectReference + + 'Method called after this object is deserialized + Public Function GetRealObject(ByVal context As System.Runtime.Serialization.StreamingContext) As Object _ + Implements System.Runtime.Serialization.IObjectReference.GetRealObject + Return View_PersonsView.Instance + End Function + End Class + +#End Region + +#End Region + + ''' + ''' References the only instance of the class. + ''' + ''' + ''' Since the class is implemented using the Singleton design pattern, + ''' this field is the only way to access an instance of the class. + ''' + Public Shared ReadOnly Instance As New View_PersonsView() + + Private Sub New() + MyBase.New() + End Sub + + +End Class +End Namespace diff --git a/App_Code/CrPdf.vb b/App_Code/CrPdf.vb new file mode 100644 index 0000000..b4af438 --- /dev/null +++ b/App_Code/CrPdf.vb @@ -0,0 +1,314 @@ +Imports Microsoft.VisualBasic +Imports CrystalDecisions.CrystalReports.Engine +Imports CrystalDecisions.Shared + + +Public Class CrPdf + +#Region "Get CR No param" + ''' + ''' Get Report with one parameter and Auto set Logo path, Logo.pdf must be in Reports folder. + ''' + ''' e.g:Me + ''' Report name in Reports Folder + ''' + Sub GetCr(ByVal sender As System.Web.UI.Control, ByVal reportName As String) + Dim report As New ReportDocument + Dim pf As ParameterField + report.Load(sender.Page.MapPath("../Reports/" & reportName)) + 'report.SetParameterValue(pName, pVal) + For Each pf In report.ParameterFields + If pf.Name = "Logo" Then + 'Set LogoPath + SetLogoPath(sender, report) + 'Define Logon to DB + End If + Next + 'Display report + DefineLogon(report) + DisplayReportAsPDF(sender, report) + + End Sub +#End Region + + +#Region "Get CR 1 param" + ''' + ''' Get Report with one parameter and Auto set Logo path, Logo.pdf must be in Reports folder. + ''' + ''' e.g:Me + ''' Report name in Reports Folder + ''' Parameter Name + ''' Parameter Value in String + ''' + Sub GetCr(ByVal sender As System.Web.UI.Control, ByVal reportName As String, ByVal pName As String, ByVal pVal As String) + Dim report As New ReportDocument() + Dim pf As ParameterField + report.Load(sender.Page.MapPath("../Reports/" & reportName)) + report.SetParameterValue(pName, pVal) + For Each pf In report.ParameterFields + If pf.Name = "Logo" Then + 'Set LogoPath + SetLogoPath(sender, report) + 'Define Logon to DB + End If + Next + 'Display report + DefineLogon(report) + DisplayReportAsPDF(sender, report) + + End Sub +#End Region + +#Region "Get Cr Array param" + ''' + ''' Get pdf report and send to browser + ''' + ''' e.g:me + ''' Report name with Folder e.g: "../Reports/report1.rpt" + ''' Array of parameter seperate with "," e.g: p(0)= "ClassName,1/1" + '''1(Default)=pdf, 2=Excel, 3=Word + ''' + ''' + Sub GetCr(ByVal sender As System.Web.UI.Control, ByVal reportName As String, ByVal param As Array, Optional ByVal ReportType As Integer = 1) + Try + Dim report As New ReportDocument() + report.Load(sender.Page.MapPath(reportName)) + 'Apply Parameter + Dim i, L As Integer + Dim reportParam As ParameterField + For i = 0 To param.Length - 1 + L = InStr(param(i), ",") + If param(i) <> Nothing Then + Dim pName As String = Left(param(i), L - 1) + Dim pVal = Mid(param(i), L + 1) + For Each reportParam In report.ParameterFields + If reportParam.Name = pName Then + Select Case report.ParameterFields(pName).ParameterValueType + Case Is = ParameterValueKind.StringParameter + pVal = CType(pVal, String) + Case Is = ParameterValueKind.NumberParameter + pVal = CType(pVal, Integer) + Case Is = ParameterValueKind.DateParameter + pVal = CType(pVal, Date) + End Select + report.SetParameterValue(pName, pVal) + End If + Next + End If + Next + + 'Define logon + DefineLogon(report) + 'Display report + Select Case ReportType + Case 1 + DisplayReportAsPDF(sender, report) + Case 2 + DisplayReportAsExcel(sender, report) + Case 3 + DisplayReportAsWord(sender, report) + End Select + + Catch ex As Exception + Dim errMsg As String = ex.Message.Replace(Chr(13).ToString(), "").Replace(Chr(10).ToString(), "") + errMsg += " Please modify the button click function in your code-behind." + BaseClasses.Utils.MiscUtils.RegisterJScriptAlert(sender, "BUTTON_CLICK_MESSAGE", errMsg) + End Try + + End Sub +#End Region + +#Region "Set Logo Path" + Sub SetLogoPath(ByVal sender As System.Web.UI.Control, ByVal report As CrystalDecisions.CrystalReports.Engine.ReportDocument) + Dim path As String = sender.Page.MapPath("../Reports/") + + For Each parameterField In report.ParameterFields + If parameterField.Name = "Logo" Then + path = path & "logo.jpg" + report.SetParameterValue("Logo", path) + End If + Next + + End Sub +#End Region + +#Region "Get Local Path" + ''' + ''' Get local path. + ''' + ''' sender=me + ''' ../Folder/filename + ''' Local Path + ''' + Function GetLocalPath(ByVal sender As System.Web.UI.Control, ByVal PathName As String) As String + Dim path As String = sender.Page.MapPath(PathName) + Return path + End Function + +#End Region + +#Region "Define Logon DB_Old (Not Used)" + Sub DefineLogon_Old(ByVal report As ReportDocument) + + ''define and locate required objects for db login + Dim db As CrystalDecisions.CrystalReports.Engine.Database = report.Database + Dim tables As CrystalDecisions.CrystalReports.Engine.Tables = db.Tables + Dim tableLoginInfo As CrystalDecisions.Shared.TableLogOnInfo = New CrystalDecisions.Shared.TableLogOnInfo() + + ''define connection information + Dim dbConnInfo As CrystalDecisions.Shared.ConnectionInfo = New CrystalDecisions.Shared.ConnectionInfo() + dbConnInfo.UserID = "esp" + dbConnInfo.Password = "somchartpete" + 'dbConnInfo.ServerName = "(local)" 'Environment.MachineName + + 'Replace ServerName by Web.config + Dim configString As String = System.Configuration.ConfigurationManager.AppSettings("DatabaseLibrary1").ToString + Dim SQLServerName As String = Mid(configString, InStr(configString, "=") + 1, InStr(configString, ";") - InStr(configString, "=") - 1) + dbConnInfo.ServerName = SQLServerName + + + + ''apply connection information to each table + Dim table As CrystalDecisions.CrystalReports.Engine.Table + For Each table In tables + tableLoginInfo = table.LogOnInfo + tableLoginInfo.ConnectionInfo = dbConnInfo + table.ApplyLogOnInfo(tableLoginInfo) + Next + + End Sub +#End Region + +#Region "Define Logon DB" + Sub DefineLogon(ByVal report As ReportDocument) + + ''define and locate required objects for db login + Dim db As CrystalDecisions.CrystalReports.Engine.Database = report.Database + Dim tables As CrystalDecisions.CrystalReports.Engine.Tables = db.Tables + Dim tableLoginInfo As CrystalDecisions.Shared.TableLogOnInfo = New CrystalDecisions.Shared.TableLogOnInfo() + + ''define connection information + Dim dbConnInfo As CrystalDecisions.Shared.ConnectionInfo = New CrystalDecisions.Shared.ConnectionInfo() + 'Dim configString As String = System.Configuration.ConfigurationManager.AppSettings("DatabaseLibrary1").ToString + Dim configString As String = System.Configuration.ConfigurationManager.ConnectionStrings("DatabasePersons1").ToString + 'For Each item In System.Configuration.ConfigurationManager.AppSettings + + 'Next + 'dbConnInfo.UserID = "esp" + 'dbConnInfo.Password = "somchartpete" + 'dbConnInfo.ServerName = "(local)" 'Environment.MachineName + 'configString = "Data Source=sqlcluster\obecdb1;Database=Library;Trusted_Connection=no;User Id=obeceis;Password=bopp@52" + Dim x() As String = configString.Split(";") + For Each y In x + If InStr(y, "Data Source") <> 0 Then + dbConnInfo.ServerName = Mid(y, InStr(y, "=") + 1) + End If + If InStr(y, "Database") <> 0 Then + dbConnInfo.DatabaseName = Mid(y, InStr(y, "=") + 1) + End If + If InStr(y, "User Id") <> 0 Then + dbConnInfo.UserID = Mid(y, InStr(y, "=") + 1) + End If + If InStr(y, "Password") <> 0 Then + dbConnInfo.Password = Mid(y, InStr(y, "=") + 1) + End If + Next + + + ''apply connection information to each table + Dim table As CrystalDecisions.CrystalReports.Engine.Table + For Each table In tables + tableLoginInfo = table.LogOnInfo + tableLoginInfo.ConnectionInfo = dbConnInfo + table.ApplyLogOnInfo(tableLoginInfo) + Next + report.DataSourceConnections(0).SetConnection(dbConnInfo.UserID, dbConnInfo.Password, dbConnInfo.ServerName, dbConnInfo.DatabaseName) + + End Sub +#End Region + + +#Region " ShowCrystalReport" + + ''' + '''Override the CrystalReportButton_Click and call DisplayReportAsPDF_CrystalReportButton function + ''' + ''' + Private Sub DisplayReportAsPDF(ByVal sender As System.Web.UI.Control, _ + ByVal reportObject As CrystalDecisions.CrystalReports.Engine.ReportDocument) + Try + ' Export as a stream + Dim stream As System.IO.Stream = reportObject.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat) + 'Dim stream As System.IO.Stream = reportObject.ExportToStream(CrystalDecisions.Shared.ExportFormatType.WordForWindows) + 'Dim stream As System.IO.Stream = reportObject.ExportToStream(CrystalDecisions.Shared.ExportFormatType.Excel) + Dim content() As Byte = New Byte(Convert.ToInt32(stream.Length)) {} + stream.Read(content, 0, content.Length) + + 'output as an attachment + ' BaseClasses.Utils.NetUtils.WriteResponseBinaryAttachment(sender.Page.Response, "report.pdf", content, 0, True) + BaseClasses.Utils.NetUtils.WriteResponseBinaryAttachment(sender.Page.Response, "report.pdf", content, 0, True) + 'BaseClasses.Utils.NetUtils.WriteResponseBinaryAttachment(sender.Page.Response, "report.xls", content, 0, True) + 'BaseClasses.Utils.NetUtils.WriteResponseBinaryAttachment(sender.Page.Response, "report.doc", content, 0, True) + Catch ex As Exception + Dim errMsg As String = ex.Message.Replace(Chr(13).ToString(), "").Replace(Chr(10).ToString(), "") + errMsg += " Please modify the button click function in your code-behind." + BaseClasses.Utils.MiscUtils.RegisterJScriptAlert(sender, "BUTTON_CLICK_MESSAGE", errMsg) + End Try + End Sub + + Private Sub DisplayReportAsExcel(ByVal sender As System.Web.UI.Control, _ + ByVal reportObject As CrystalDecisions.CrystalReports.Engine.ReportDocument) + Try + ' Export as a stream + Dim stream As System.IO.Stream = reportObject.ExportToStream(CrystalDecisions.Shared.ExportFormatType.Excel) + Dim content() As Byte = New Byte(Convert.ToInt32(stream.Length)) {} + stream.Read(content, 0, content.Length) + + 'output as an attachment + ' BaseClasses.Utils.NetUtils.WriteResponseBinaryAttachment(sender.Page.Response, "report.pdf", content, 0, True) + BaseClasses.Utils.NetUtils.WriteResponseBinaryAttachment(sender.Page.Response, "report.xls", content, 0, True) + 'BaseClasses.Utils.NetUtils.WriteResponseBinaryAttachment(sender.Page.Response, "report.doc", content, 0, True) + Catch ex As Exception + Dim errMsg As String = ex.Message.Replace(Chr(13).ToString(), "").Replace(Chr(10).ToString(), "") + errMsg += " Please modify the button click function in your code-behind." + BaseClasses.Utils.MiscUtils.RegisterJScriptAlert(sender, "BUTTON_CLICK_MESSAGE", errMsg) + End Try + End Sub + + Private Sub DisplayReportAsWord(ByVal sender As System.Web.UI.Control, _ + ByVal reportObject As CrystalDecisions.CrystalReports.Engine.ReportDocument) + Try + ' Export as a stream + Dim stream As System.IO.Stream = reportObject.ExportToStream(CrystalDecisions.Shared.ExportFormatType.WordForWindows) + Dim content() As Byte = New Byte(Convert.ToInt32(stream.Length)) {} + stream.Read(content, 0, content.Length) + + 'output as an attachment + ' BaseClasses.Utils.NetUtils.WriteResponseBinaryAttachment(sender.Page.Response, "report.pdf", content, 0, True) + 'BaseClasses.Utils.NetUtils.WriteResponseBinaryAttachment(sender.Page.Response, "report.pdf", content, 0, True) + 'BaseClasses.Utils.NetUtils.WriteResponseBinaryAttachment(sender.Page.Response, "report.xls", content, 0, True) + BaseClasses.Utils.NetUtils.WriteResponseBinaryAttachment(sender.Page.Response, "report.doc", content, 0, True) + Catch ex As Exception + Dim errMsg As String = ex.Message.Replace(Chr(13).ToString(), "").Replace(Chr(10).ToString(), "") + errMsg += " Please modify the button click function in your code-behind." + BaseClasses.Utils.MiscUtils.RegisterJScriptAlert(sender, "BUTTON_CLICK_MESSAGE", errMsg) + End Try + End Sub + + +#End Region + +#Region "Export pdf" + + Sub ExportPdf(ByVal report As ReportDocument) + + + End Sub + +#End Region + + + ' BaseClasses.Utils.MiscUtils.RegisterJScriptAlert(sender, "BUTTON_CLICK_MESSAGE", msg) + +End Class diff --git a/App_Code/Data Access Layer/Absent.xml b/App_Code/Data Access Layer/Absent.xml new file mode 100644 index 0000000..b976db3 --- /dev/null +++ b/App_Code/Data Access Layer/Absent.xml @@ -0,0 +1,115 @@ + + + + + AbsentId + %ISD_DEFAULT% + Number + tinyint + 3.0 + + + + + Y + Y + + + + + Y + N + N + N + N + Y + Y + N + + + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + Absent + %ISD_DEFAULT% + String + nvarchar + 50 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + Absent + 1 + dbo + Absent + Absent_ + DatabasePersons1 + RowNum + Y + Y + Y + Y + BinaryChecksum + Persons + \ No newline at end of file diff --git a/App_Code/Data Access Layer/AbsentDefinition.vb b/App_Code/Data Access Layer/AbsentDefinition.vb new file mode 100644 index 0000000..631a13a --- /dev/null +++ b/App_Code/Data Access Layer/AbsentDefinition.vb @@ -0,0 +1,126 @@ +Namespace Persons.Business +''' +''' Contains embedded schema and configuration data that is used by the +''' Persons.AbsentTable class +''' to initialize the class's TableDefinition. +''' +''' + +Public Class AbsentDefinition + +#Region "Definition (XML) for AbsentDefinition table" + 'Next 93 lines contain Table Definition (XML) for table "AbsentDefinition" + Private Shared _DefinitionString As String = "" +#End Region + + ''' + ''' Gets the embedded schema and configuration data for the + ''' + ''' class's TableDefinition. + ''' + ''' This function is only called once at runtime. + ''' An XML string. + Public Shared Function GetXMLString() As String + If _DefinitionString = "" Then + Dim tbf As System.Text.StringBuilder = New System.Text.StringBuilder() + tbf.Append("") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "AbsentId") + tbf.Append( "Absent") + tbf.Append( "Number") + tbf.Append( "tinyint") + tbf.Append( "3.0") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Absent") + tbf.Append( "Absent") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "50") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Absent") + tbf.Append( "1") + tbf.Append( "dbo") + tbf.Append( "Absent") + tbf.Append( "Absent_") + tbf.Append( "DatabasePersons1") + tbf.Append( "RowNum") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "BinaryChecksum") + tbf.Append( "Persons") + tbf.Append("") + _DefinitionString = tbf.ToString() + + End If + Return _DefinitionString + End Function + +End Class +End Namespace diff --git a/App_Code/Data Access Layer/AbsentSqlTable.vb b/App_Code/Data Access Layer/AbsentSqlTable.vb new file mode 100644 index 0000000..30d5930 --- /dev/null +++ b/App_Code/Data Access Layer/AbsentSqlTable.vb @@ -0,0 +1,47 @@ +' This is a "safe" class, meaning that it is created once +' and never overwritten. Any custom code you add to this class +' will be preserved when you regenerate your application. +' +' Typical customizations that may be done in this class include +' - overriding base class methods + +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + +Namespace Persons.Data + + ''' + ''' Used by the class to access and/or modify the database. + ''' + ''' + ''' This class is not intended to be instantiated directly. To obtain an instance of this class, + ''' use the methods of the class. + ''' + ''' + + Public Class AbsentSqlTable + Inherits BaseAbsentSqlTable + + 'The functions below may be overridden in order to implement your own + 'logic for creating, updating, deleting, and getting individual records, + 'or for running queries that return lists of records. + + ' Creates a new record. + ' Before calling this method, column values should be set using SetColumn(). + 'Public Overloads Overrides Function CreateRecord() As KeyValue + 'End Function + + ' Updates a record in the database. + ' Before calling this method, column values should be set using SetColumn(). + 'Protected Overrides Sub UpdateRecord() + 'End Sub + + ' Deletes a record defined by a primary key value. + 'Public Overloads Overrides Sub DeleteRecord(ByVal key As KeyValue) + 'End Sub + + ' Gets a record from the database. + 'Protected Overloads Overrides Sub GetRecord() + 'End Sub + End Class +End Namespace diff --git a/App_Code/Data Access Layer/Arm.xml b/App_Code/Data Access Layer/Arm.xml new file mode 100644 index 0000000..e736056 --- /dev/null +++ b/App_Code/Data Access Layer/Arm.xml @@ -0,0 +1,268 @@ + + + + + ArmId + %ISD_DEFAULT% + Number + int + 10.0 + + + + + Y + Y + + + + + Y + N + N + N + N + Y + Y + N + + + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + ArmyId + %ISD_DEFAULT% + Number + tinyint + 3.0 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + + + N + %ISD_DEFAULT% + + + Y + + FK_Arm_Army + Army + dbo + ArmyId + Army + Explicit + + Y + N + N + N + N + N + N + + + + + + + + + + + + + ArmSName + ชื่อย่อ + String + nvarchar + 50 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + ArmName + ชื่อเต็ม + String + nvarchar + 50 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + Party + พรรค + String + nvarchar + 50 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + Arm + 2 + dbo + Arm + Arm_ + DatabasePersons1 + RowNum + Y + Y + Y + Y + BinaryChecksum + Persons + \ No newline at end of file diff --git a/App_Code/Data Access Layer/ArmDefinition.vb b/App_Code/Data Access Layer/ArmDefinition.vb new file mode 100644 index 0000000..1ac435a --- /dev/null +++ b/App_Code/Data Access Layer/ArmDefinition.vb @@ -0,0 +1,248 @@ +Namespace Persons.Business +''' +''' Contains embedded schema and configuration data that is used by the +''' Persons.ArmTable class +''' to initialize the class's TableDefinition. +''' +''' + +Public Class ArmDefinition + +#Region "Definition (XML) for ArmDefinition table" + 'Next 215 lines contain Table Definition (XML) for table "ArmDefinition" + Private Shared _DefinitionString As String = "" +#End Region + + ''' + ''' Gets the embedded schema and configuration data for the + ''' + ''' class's TableDefinition. + ''' + ''' This function is only called once at runtime. + ''' An XML string. + Public Shared Function GetXMLString() As String + If _DefinitionString = "" Then + Dim tbf As System.Text.StringBuilder = New System.Text.StringBuilder() + tbf.Append("") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "ArmId") + tbf.Append( "Arm") + tbf.Append( "Number") + tbf.Append( "int") + tbf.Append( "10.0") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "ArmyId") + tbf.Append( "Army") + tbf.Append( "Number") + tbf.Append( "tinyint") + tbf.Append( "3.0") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "") + tbf.Append( "FK_Arm_Army") + tbf.Append( "Persons.Business.ArmyTable, App_Code") + tbf.Append( "dbo") + tbf.Append( "ArmyId") + tbf.Append( "Army") + tbf.Append( "Explicit") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "ArmSName") + tbf.Append( "ชื่อย่อ") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "50") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "ArmName") + tbf.Append( "ชื่อเต็ม") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "50") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Party") + tbf.Append( "พรรค") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "50") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Arm") + tbf.Append( "2") + tbf.Append( "dbo") + tbf.Append( "Arm") + tbf.Append( "Arm_") + tbf.Append( "DatabasePersons1") + tbf.Append( "RowNum") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "BinaryChecksum") + tbf.Append( "Persons") + tbf.Append("") + _DefinitionString = tbf.ToString() + + End If + Return _DefinitionString + End Function + +End Class +End Namespace diff --git a/App_Code/Data Access Layer/ArmSqlTable.vb b/App_Code/Data Access Layer/ArmSqlTable.vb new file mode 100644 index 0000000..583be42 --- /dev/null +++ b/App_Code/Data Access Layer/ArmSqlTable.vb @@ -0,0 +1,47 @@ +' This is a "safe" class, meaning that it is created once +' and never overwritten. Any custom code you add to this class +' will be preserved when you regenerate your application. +' +' Typical customizations that may be done in this class include +' - overriding base class methods + +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + +Namespace Persons.Data + + ''' + ''' Used by the class to access and/or modify the database. + ''' + ''' + ''' This class is not intended to be instantiated directly. To obtain an instance of this class, + ''' use the methods of the class. + ''' + ''' + + Public Class ArmSqlTable + Inherits BaseArmSqlTable + + 'The functions below may be overridden in order to implement your own + 'logic for creating, updating, deleting, and getting individual records, + 'or for running queries that return lists of records. + + ' Creates a new record. + ' Before calling this method, column values should be set using SetColumn(). + 'Public Overloads Overrides Function CreateRecord() As KeyValue + 'End Function + + ' Updates a record in the database. + ' Before calling this method, column values should be set using SetColumn(). + 'Protected Overrides Sub UpdateRecord() + 'End Sub + + ' Deletes a record defined by a primary key value. + 'Public Overloads Overrides Sub DeleteRecord(ByVal key As KeyValue) + 'End Sub + + ' Gets a record from the database. + 'Protected Overloads Overrides Sub GetRecord() + 'End Sub + End Class +End Namespace diff --git a/App_Code/Data Access Layer/Army.xml b/App_Code/Data Access Layer/Army.xml new file mode 100644 index 0000000..41eaeb2 --- /dev/null +++ b/App_Code/Data Access Layer/Army.xml @@ -0,0 +1,115 @@ + + + + + ArmyId + %ISD_DEFAULT% + Number + tinyint + 3.0 + + + + + Y + Y + + + + + Y + N + N + N + N + Y + Y + N + + + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + Army + เหล่าทัพ + String + nvarchar + 50 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + Army + 1 + dbo + Army + Army_ + DatabasePersons1 + RowNum + Y + Y + Y + Y + BinaryChecksum + Persons + \ No newline at end of file diff --git a/App_Code/Data Access Layer/ArmyDefinition.vb b/App_Code/Data Access Layer/ArmyDefinition.vb new file mode 100644 index 0000000..3f0bd4f --- /dev/null +++ b/App_Code/Data Access Layer/ArmyDefinition.vb @@ -0,0 +1,126 @@ +Namespace Persons.Business +''' +''' Contains embedded schema and configuration data that is used by the +''' Persons.ArmyTable class +''' to initialize the class's TableDefinition. +''' +''' + +Public Class ArmyDefinition + +#Region "Definition (XML) for ArmyDefinition table" + 'Next 93 lines contain Table Definition (XML) for table "ArmyDefinition" + Private Shared _DefinitionString As String = "" +#End Region + + ''' + ''' Gets the embedded schema and configuration data for the + ''' + ''' class's TableDefinition. + ''' + ''' This function is only called once at runtime. + ''' An XML string. + Public Shared Function GetXMLString() As String + If _DefinitionString = "" Then + Dim tbf As System.Text.StringBuilder = New System.Text.StringBuilder() + tbf.Append("") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "ArmyId") + tbf.Append( "Army") + tbf.Append( "Number") + tbf.Append( "tinyint") + tbf.Append( "3.0") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Army") + tbf.Append( "เหล่าทัพ") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "50") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Army") + tbf.Append( "1") + tbf.Append( "dbo") + tbf.Append( "Army") + tbf.Append( "Army_") + tbf.Append( "DatabasePersons1") + tbf.Append( "RowNum") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "BinaryChecksum") + tbf.Append( "Persons") + tbf.Append("") + _DefinitionString = tbf.ToString() + + End If + Return _DefinitionString + End Function + +End Class +End Namespace diff --git a/App_Code/Data Access Layer/ArmySqlTable.vb b/App_Code/Data Access Layer/ArmySqlTable.vb new file mode 100644 index 0000000..507d246 --- /dev/null +++ b/App_Code/Data Access Layer/ArmySqlTable.vb @@ -0,0 +1,47 @@ +' This is a "safe" class, meaning that it is created once +' and never overwritten. Any custom code you add to this class +' will be preserved when you regenerate your application. +' +' Typical customizations that may be done in this class include +' - overriding base class methods + +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + +Namespace Persons.Data + + ''' + ''' Used by the class to access and/or modify the database. + ''' + ''' + ''' This class is not intended to be instantiated directly. To obtain an instance of this class, + ''' use the methods of the class. + ''' + ''' + + Public Class ArmySqlTable + Inherits BaseArmySqlTable + + 'The functions below may be overridden in order to implement your own + 'logic for creating, updating, deleting, and getting individual records, + 'or for running queries that return lists of records. + + ' Creates a new record. + ' Before calling this method, column values should be set using SetColumn(). + 'Public Overloads Overrides Function CreateRecord() As KeyValue + 'End Function + + ' Updates a record in the database. + ' Before calling this method, column values should be set using SetColumn(). + 'Protected Overrides Sub UpdateRecord() + 'End Sub + + ' Deletes a record defined by a primary key value. + 'Public Overloads Overrides Sub DeleteRecord(ByVal key As KeyValue) + 'End Sub + + ' Gets a record from the database. + 'Protected Overloads Overrides Sub GetRecord() + 'End Sub + End Class +End Namespace diff --git a/App_Code/Data Access Layer/BaseAbsentSqlTable.vb b/App_Code/Data Access Layer/BaseAbsentSqlTable.vb new file mode 100644 index 0000000..8f413a2 --- /dev/null +++ b/App_Code/Data Access Layer/BaseAbsentSqlTable.vb @@ -0,0 +1,32 @@ +' This class is "generated" and will be overwritten. +' Your customizations should be made in AbsentSqlTable.vb + +Imports BaseClasses.Data +Imports BaseClasses +Imports BaseClasses.Data.SqlProvider + + +Namespace Persons.Data + +''' +''' The generated superclass for the class. +''' +''' +''' This class is not intended to be instantiated directly. To obtain an instance of this class, +''' use the methods of the class. +''' +''' +''' + +Public Class BaseAbsentSqlTable + Inherits DynamicSQLServerAdapter + + Public Sub New() + MyBase.New() + End Sub + + Public Sub New(ByVal connectionName As String) + MyBase.New(connectionName) + End Sub +End Class +End Namespace diff --git a/App_Code/Data Access Layer/BaseArmSqlTable.vb b/App_Code/Data Access Layer/BaseArmSqlTable.vb new file mode 100644 index 0000000..8de04ea --- /dev/null +++ b/App_Code/Data Access Layer/BaseArmSqlTable.vb @@ -0,0 +1,32 @@ +' This class is "generated" and will be overwritten. +' Your customizations should be made in ArmSqlTable.vb + +Imports BaseClasses.Data +Imports BaseClasses +Imports BaseClasses.Data.SqlProvider + + +Namespace Persons.Data + +''' +''' The generated superclass for the class. +''' +''' +''' This class is not intended to be instantiated directly. To obtain an instance of this class, +''' use the methods of the class. +''' +''' +''' + +Public Class BaseArmSqlTable + Inherits DynamicSQLServerAdapter + + Public Sub New() + MyBase.New() + End Sub + + Public Sub New(ByVal connectionName As String) + MyBase.New(connectionName) + End Sub +End Class +End Namespace diff --git a/App_Code/Data Access Layer/BaseArmySqlTable.vb b/App_Code/Data Access Layer/BaseArmySqlTable.vb new file mode 100644 index 0000000..3205ffa --- /dev/null +++ b/App_Code/Data Access Layer/BaseArmySqlTable.vb @@ -0,0 +1,32 @@ +' This class is "generated" and will be overwritten. +' Your customizations should be made in ArmySqlTable.vb + +Imports BaseClasses.Data +Imports BaseClasses +Imports BaseClasses.Data.SqlProvider + + +Namespace Persons.Data + +''' +''' The generated superclass for the class. +''' +''' +''' This class is not intended to be instantiated directly. To obtain an instance of this class, +''' use the methods of the class. +''' +''' +''' + +Public Class BaseArmySqlTable + Inherits DynamicSQLServerAdapter + + Public Sub New() + MyBase.New() + End Sub + + Public Sub New(ByVal connectionName As String) + MyBase.New(connectionName) + End Sub +End Class +End Namespace diff --git a/App_Code/Data Access Layer/BaseBloodIdSqlTable.vb b/App_Code/Data Access Layer/BaseBloodIdSqlTable.vb new file mode 100644 index 0000000..1a1fe55 --- /dev/null +++ b/App_Code/Data Access Layer/BaseBloodIdSqlTable.vb @@ -0,0 +1,32 @@ +' This class is "generated" and will be overwritten. +' Your customizations should be made in BloodIdSqlTable.vb + +Imports BaseClasses.Data +Imports BaseClasses +Imports BaseClasses.Data.SqlProvider + + +Namespace Persons.Data + +''' +''' The generated superclass for the class. +''' +''' +''' This class is not intended to be instantiated directly. To obtain an instance of this class, +''' use the methods of the class. +''' +''' +''' + +Public Class BaseBloodIdSqlTable + Inherits DynamicSQLServerAdapter + + Public Sub New() + MyBase.New() + End Sub + + Public Sub New(ByVal connectionName As String) + MyBase.New(connectionName) + End Sub +End Class +End Namespace diff --git a/App_Code/Data Access Layer/BaseBornSqlTable.vb b/App_Code/Data Access Layer/BaseBornSqlTable.vb new file mode 100644 index 0000000..f63d80c --- /dev/null +++ b/App_Code/Data Access Layer/BaseBornSqlTable.vb @@ -0,0 +1,32 @@ +' This class is "generated" and will be overwritten. +' Your customizations should be made in BornSqlTable.vb + +Imports BaseClasses.Data +Imports BaseClasses +Imports BaseClasses.Data.SqlProvider + + +Namespace Persons.Data + +''' +''' The generated superclass for the class. +''' +''' +''' This class is not intended to be instantiated directly. To obtain an instance of this class, +''' use the methods of the class. +''' +''' +''' + +Public Class BaseBornSqlTable + Inherits DynamicSQLServerAdapter + + Public Sub New() + MyBase.New() + End Sub + + Public Sub New(ByVal connectionName As String) + MyBase.New(connectionName) + End Sub +End Class +End Namespace diff --git a/App_Code/Data Access Layer/BaseCountrySqlTable.vb b/App_Code/Data Access Layer/BaseCountrySqlTable.vb new file mode 100644 index 0000000..94f8212 --- /dev/null +++ b/App_Code/Data Access Layer/BaseCountrySqlTable.vb @@ -0,0 +1,32 @@ +' This class is "generated" and will be overwritten. +' Your customizations should be made in CountrySqlTable.vb + +Imports BaseClasses.Data +Imports BaseClasses +Imports BaseClasses.Data.SqlProvider + + +Namespace Persons.Data + +''' +''' The generated superclass for the class. +''' +''' +''' This class is not intended to be instantiated directly. To obtain an instance of this class, +''' use the methods of the class. +''' +''' +''' + +Public Class BaseCountrySqlTable + Inherits DynamicSQLServerAdapter + + Public Sub New() + MyBase.New() + End Sub + + Public Sub New(ByVal connectionName As String) + MyBase.New(connectionName) + End Sub +End Class +End Namespace diff --git a/App_Code/Data Access Layer/BaseDeptSqlTable.vb b/App_Code/Data Access Layer/BaseDeptSqlTable.vb new file mode 100644 index 0000000..de420f9 --- /dev/null +++ b/App_Code/Data Access Layer/BaseDeptSqlTable.vb @@ -0,0 +1,32 @@ +' This class is "generated" and will be overwritten. +' Your customizations should be made in DeptSqlTable.vb + +Imports BaseClasses.Data +Imports BaseClasses +Imports BaseClasses.Data.SqlProvider + + +Namespace Persons.Data + +''' +''' The generated superclass for the class. +''' +''' +''' This class is not intended to be instantiated directly. To obtain an instance of this class, +''' use the methods of the class. +''' +''' +''' + +Public Class BaseDeptSqlTable + Inherits DynamicSQLServerAdapter + + Public Sub New() + MyBase.New() + End Sub + + Public Sub New(ByVal connectionName As String) + MyBase.New(connectionName) + End Sub +End Class +End Namespace diff --git a/App_Code/Data Access Layer/BaseEducationPeriodSqlTable.vb b/App_Code/Data Access Layer/BaseEducationPeriodSqlTable.vb new file mode 100644 index 0000000..8a0e5c6 --- /dev/null +++ b/App_Code/Data Access Layer/BaseEducationPeriodSqlTable.vb @@ -0,0 +1,32 @@ +' This class is "generated" and will be overwritten. +' Your customizations should be made in EducationPeriodSqlTable.vb + +Imports BaseClasses.Data +Imports BaseClasses +Imports BaseClasses.Data.SqlProvider + + +Namespace Persons.Data + +''' +''' The generated superclass for the class. +''' +''' +''' This class is not intended to be instantiated directly. To obtain an instance of this class, +''' use the methods of the class. +''' +''' +''' + +Public Class BaseEducationPeriodSqlTable + Inherits DynamicSQLServerAdapter + + Public Sub New() + MyBase.New() + End Sub + + Public Sub New(ByVal connectionName As String) + MyBase.New(connectionName) + End Sub +End Class +End Namespace diff --git a/App_Code/Data Access Layer/BaseEducationSqlTable.vb b/App_Code/Data Access Layer/BaseEducationSqlTable.vb new file mode 100644 index 0000000..a15e128 --- /dev/null +++ b/App_Code/Data Access Layer/BaseEducationSqlTable.vb @@ -0,0 +1,32 @@ +' This class is "generated" and will be overwritten. +' Your customizations should be made in EducationSqlTable.vb + +Imports BaseClasses.Data +Imports BaseClasses +Imports BaseClasses.Data.SqlProvider + + +Namespace Persons.Data + +''' +''' The generated superclass for the class. +''' +''' +''' This class is not intended to be instantiated directly. To obtain an instance of this class, +''' use the methods of the class. +''' +''' +''' + +Public Class BaseEducationSqlTable + Inherits DynamicSQLServerAdapter + + Public Sub New() + MyBase.New() + End Sub + + Public Sub New(ByVal connectionName As String) + MyBase.New(connectionName) + End Sub +End Class +End Namespace diff --git a/App_Code/Data Access Layer/BaseExTraSalarySqlTable.vb b/App_Code/Data Access Layer/BaseExTraSalarySqlTable.vb new file mode 100644 index 0000000..9af871d --- /dev/null +++ b/App_Code/Data Access Layer/BaseExTraSalarySqlTable.vb @@ -0,0 +1,32 @@ +' This class is "generated" and will be overwritten. +' Your customizations should be made in ExTraSalarySqlTable.vb + +Imports BaseClasses.Data +Imports BaseClasses +Imports BaseClasses.Data.SqlProvider + + +Namespace Persons.Data + +''' +''' The generated superclass for the class. +''' +''' +''' This class is not intended to be instantiated directly. To obtain an instance of this class, +''' use the methods of the class. +''' +''' +''' + +Public Class BaseExTraSalarySqlTable + Inherits DynamicSQLServerAdapter + + Public Sub New() + MyBase.New() + End Sub + + Public Sub New(ByVal connectionName As String) + MyBase.New(connectionName) + End Sub +End Class +End Namespace diff --git a/App_Code/Data Access Layer/BaseInsigniaSqlTable.vb b/App_Code/Data Access Layer/BaseInsigniaSqlTable.vb new file mode 100644 index 0000000..d9c6fda --- /dev/null +++ b/App_Code/Data Access Layer/BaseInsigniaSqlTable.vb @@ -0,0 +1,32 @@ +' This class is "generated" and will be overwritten. +' Your customizations should be made in InsigniaSqlTable.vb + +Imports BaseClasses.Data +Imports BaseClasses +Imports BaseClasses.Data.SqlProvider + + +Namespace Persons.Data + +''' +''' The generated superclass for the class. +''' +''' +''' This class is not intended to be instantiated directly. To obtain an instance of this class, +''' use the methods of the class. +''' +''' +''' + +Public Class BaseInsigniaSqlTable + Inherits DynamicSQLServerAdapter + + Public Sub New() + MyBase.New() + End Sub + + Public Sub New(ByVal connectionName As String) + MyBase.New(connectionName) + End Sub +End Class +End Namespace diff --git a/App_Code/Data Access Layer/BaseLanguageSqlTable.vb b/App_Code/Data Access Layer/BaseLanguageSqlTable.vb new file mode 100644 index 0000000..afebc19 --- /dev/null +++ b/App_Code/Data Access Layer/BaseLanguageSqlTable.vb @@ -0,0 +1,32 @@ +' This class is "generated" and will be overwritten. +' Your customizations should be made in LanguageSqlTable.vb + +Imports BaseClasses.Data +Imports BaseClasses +Imports BaseClasses.Data.SqlProvider + + +Namespace Persons.Data + +''' +''' The generated superclass for the class. +''' +''' +''' This class is not intended to be instantiated directly. To obtain an instance of this class, +''' use the methods of the class. +''' +''' +''' + +Public Class BaseLanguageSqlTable + Inherits DynamicSQLServerAdapter + + Public Sub New() + MyBase.New() + End Sub + + Public Sub New(ByVal connectionName As String) + MyBase.New(connectionName) + End Sub +End Class +End Namespace diff --git a/App_Code/Data Access Layer/BasePersonRelativeSqlTable.vb b/App_Code/Data Access Layer/BasePersonRelativeSqlTable.vb new file mode 100644 index 0000000..7e046f1 --- /dev/null +++ b/App_Code/Data Access Layer/BasePersonRelativeSqlTable.vb @@ -0,0 +1,32 @@ +' This class is "generated" and will be overwritten. +' Your customizations should be made in PersonRelativeSqlTable.vb + +Imports BaseClasses.Data +Imports BaseClasses +Imports BaseClasses.Data.SqlProvider + + +Namespace Persons.Data + +''' +''' The generated superclass for the class. +''' +''' +''' This class is not intended to be instantiated directly. To obtain an instance of this class, +''' use the methods of the class. +''' +''' +''' + +Public Class BasePersonRelativeSqlTable + Inherits DynamicSQLServerAdapter + + Public Sub New() + MyBase.New() + End Sub + + Public Sub New(ByVal connectionName As String) + MyBase.New(connectionName) + End Sub +End Class +End Namespace diff --git a/App_Code/Data Access Layer/BasePersonalDDSqlTable.vb b/App_Code/Data Access Layer/BasePersonalDDSqlTable.vb new file mode 100644 index 0000000..8974dfa --- /dev/null +++ b/App_Code/Data Access Layer/BasePersonalDDSqlTable.vb @@ -0,0 +1,32 @@ +' This class is "generated" and will be overwritten. +' Your customizations should be made in PersonalDDSqlTable.vb + +Imports BaseClasses.Data +Imports BaseClasses +Imports BaseClasses.Data.SqlProvider + + +Namespace Persons.Data + +''' +''' The generated superclass for the class. +''' +''' +''' This class is not intended to be instantiated directly. To obtain an instance of this class, +''' use the methods of the class. +''' +''' +''' + +Public Class BasePersonalDDSqlTable + Inherits DynamicSQLServerAdapter + + Public Sub New() + MyBase.New() + End Sub + + Public Sub New(ByVal connectionName As String) + MyBase.New(connectionName) + End Sub +End Class +End Namespace diff --git a/App_Code/Data Access Layer/BasePersonalDailyJobSqlTable.vb b/App_Code/Data Access Layer/BasePersonalDailyJobSqlTable.vb new file mode 100644 index 0000000..241dba6 --- /dev/null +++ b/App_Code/Data Access Layer/BasePersonalDailyJobSqlTable.vb @@ -0,0 +1,32 @@ +' This class is "generated" and will be overwritten. +' Your customizations should be made in PersonalDailyJobSqlTable.vb + +Imports BaseClasses.Data +Imports BaseClasses +Imports BaseClasses.Data.SqlProvider + + +Namespace Persons.Data + +''' +''' The generated superclass for the class. +''' +''' +''' This class is not intended to be instantiated directly. To obtain an instance of this class, +''' use the methods of the class. +''' +''' +''' + +Public Class BasePersonalDailyJobSqlTable + Inherits DynamicSQLServerAdapter + + Public Sub New() + MyBase.New() + End Sub + + Public Sub New(ByVal connectionName As String) + MyBase.New(connectionName) + End Sub +End Class +End Namespace diff --git a/App_Code/Data Access Layer/BasePersonalEducationSqlTable.vb b/App_Code/Data Access Layer/BasePersonalEducationSqlTable.vb new file mode 100644 index 0000000..f3db16b --- /dev/null +++ b/App_Code/Data Access Layer/BasePersonalEducationSqlTable.vb @@ -0,0 +1,32 @@ +' This class is "generated" and will be overwritten. +' Your customizations should be made in PersonalEducationSqlTable.vb + +Imports BaseClasses.Data +Imports BaseClasses +Imports BaseClasses.Data.SqlProvider + + +Namespace Persons.Data + +''' +''' The generated superclass for the class. +''' +''' +''' This class is not intended to be instantiated directly. To obtain an instance of this class, +''' use the methods of the class. +''' +''' +''' + +Public Class BasePersonalEducationSqlTable + Inherits DynamicSQLServerAdapter + + Public Sub New() + MyBase.New() + End Sub + + Public Sub New(ByVal connectionName As String) + MyBase.New(connectionName) + End Sub +End Class +End Namespace diff --git a/App_Code/Data Access Layer/BasePersonalExtWorkSqlTable.vb b/App_Code/Data Access Layer/BasePersonalExtWorkSqlTable.vb new file mode 100644 index 0000000..3b0e5d7 --- /dev/null +++ b/App_Code/Data Access Layer/BasePersonalExtWorkSqlTable.vb @@ -0,0 +1,32 @@ +' This class is "generated" and will be overwritten. +' Your customizations should be made in PersonalExtWorkSqlTable.vb + +Imports BaseClasses.Data +Imports BaseClasses +Imports BaseClasses.Data.SqlProvider + + +Namespace Persons.Data + +''' +''' The generated superclass for the class. +''' +''' +''' This class is not intended to be instantiated directly. To obtain an instance of this class, +''' use the methods of the class. +''' +''' +''' + +Public Class BasePersonalExtWorkSqlTable + Inherits DynamicSQLServerAdapter + + Public Sub New() + MyBase.New() + End Sub + + Public Sub New(ByVal connectionName As String) + MyBase.New(connectionName) + End Sub +End Class +End Namespace diff --git a/App_Code/Data Access Layer/BasePersonalExtraSalarySqlTable.vb b/App_Code/Data Access Layer/BasePersonalExtraSalarySqlTable.vb new file mode 100644 index 0000000..e9632da --- /dev/null +++ b/App_Code/Data Access Layer/BasePersonalExtraSalarySqlTable.vb @@ -0,0 +1,32 @@ +' This class is "generated" and will be overwritten. +' Your customizations should be made in PersonalExtraSalarySqlTable.vb + +Imports BaseClasses.Data +Imports BaseClasses +Imports BaseClasses.Data.SqlProvider + + +Namespace Persons.Data + +''' +''' The generated superclass for the class. +''' +''' +''' This class is not intended to be instantiated directly. To obtain an instance of this class, +''' use the methods of the class. +''' +''' +''' + +Public Class BasePersonalExtraSalarySqlTable + Inherits DynamicSQLServerAdapter + + Public Sub New() + MyBase.New() + End Sub + + Public Sub New(ByVal connectionName As String) + MyBase.New(connectionName) + End Sub +End Class +End Namespace diff --git a/App_Code/Data Access Layer/BasePersonalIdSqlTable.vb b/App_Code/Data Access Layer/BasePersonalIdSqlTable.vb new file mode 100644 index 0000000..ba7a3c6 --- /dev/null +++ b/App_Code/Data Access Layer/BasePersonalIdSqlTable.vb @@ -0,0 +1,32 @@ +' This class is "generated" and will be overwritten. +' Your customizations should be made in PersonalIdSqlTable.vb + +Imports BaseClasses.Data +Imports BaseClasses +Imports BaseClasses.Data.SqlProvider + + +Namespace Persons.Data + +''' +''' The generated superclass for the class. +''' +''' +''' This class is not intended to be instantiated directly. To obtain an instance of this class, +''' use the methods of the class. +''' +''' +''' + +Public Class BasePersonalIdSqlTable + Inherits DynamicSQLServerAdapter + + Public Sub New() + MyBase.New() + End Sub + + Public Sub New(ByVal connectionName As String) + MyBase.New(connectionName) + End Sub +End Class +End Namespace diff --git a/App_Code/Data Access Layer/BasePersonalInsigniaSqlTable.vb b/App_Code/Data Access Layer/BasePersonalInsigniaSqlTable.vb new file mode 100644 index 0000000..43123c9 --- /dev/null +++ b/App_Code/Data Access Layer/BasePersonalInsigniaSqlTable.vb @@ -0,0 +1,32 @@ +' This class is "generated" and will be overwritten. +' Your customizations should be made in PersonalInsigniaSqlTable.vb + +Imports BaseClasses.Data +Imports BaseClasses +Imports BaseClasses.Data.SqlProvider + + +Namespace Persons.Data + +''' +''' The generated superclass for the class. +''' +''' +''' This class is not intended to be instantiated directly. To obtain an instance of this class, +''' use the methods of the class. +''' +''' +''' + +Public Class BasePersonalInsigniaSqlTable + Inherits DynamicSQLServerAdapter + + Public Sub New() + MyBase.New() + End Sub + + Public Sub New(ByVal connectionName As String) + MyBase.New(connectionName) + End Sub +End Class +End Namespace diff --git a/App_Code/Data Access Layer/BasePersonalLanguageSkillSqlTable.vb b/App_Code/Data Access Layer/BasePersonalLanguageSkillSqlTable.vb new file mode 100644 index 0000000..59e645f --- /dev/null +++ b/App_Code/Data Access Layer/BasePersonalLanguageSkillSqlTable.vb @@ -0,0 +1,32 @@ +' This class is "generated" and will be overwritten. +' Your customizations should be made in PersonalLanguageSkillSqlTable.vb + +Imports BaseClasses.Data +Imports BaseClasses +Imports BaseClasses.Data.SqlProvider + + +Namespace Persons.Data + +''' +''' The generated superclass for the class. +''' +''' +''' This class is not intended to be instantiated directly. To obtain an instance of this class, +''' use the methods of the class. +''' +''' +''' + +Public Class BasePersonalLanguageSkillSqlTable + Inherits DynamicSQLServerAdapter + + Public Sub New() + MyBase.New() + End Sub + + Public Sub New(ByVal connectionName As String) + MyBase.New(connectionName) + End Sub +End Class +End Namespace diff --git a/App_Code/Data Access Layer/BasePersonalNameSqlTable.vb b/App_Code/Data Access Layer/BasePersonalNameSqlTable.vb new file mode 100644 index 0000000..1196d09 --- /dev/null +++ b/App_Code/Data Access Layer/BasePersonalNameSqlTable.vb @@ -0,0 +1,32 @@ +' This class is "generated" and will be overwritten. +' Your customizations should be made in PersonalNameSqlTable.vb + +Imports BaseClasses.Data +Imports BaseClasses +Imports BaseClasses.Data.SqlProvider + + +Namespace Persons.Data + +''' +''' The generated superclass for the class. +''' +''' +''' This class is not intended to be instantiated directly. To obtain an instance of this class, +''' use the methods of the class. +''' +''' +''' + +Public Class BasePersonalNameSqlTable + Inherits DynamicSQLServerAdapter + + Public Sub New() + MyBase.New() + End Sub + + Public Sub New(ByVal connectionName As String) + MyBase.New(connectionName) + End Sub +End Class +End Namespace diff --git a/App_Code/Data Access Layer/BasePersonalRankSqlTable.vb b/App_Code/Data Access Layer/BasePersonalRankSqlTable.vb new file mode 100644 index 0000000..26086f9 --- /dev/null +++ b/App_Code/Data Access Layer/BasePersonalRankSqlTable.vb @@ -0,0 +1,32 @@ +' This class is "generated" and will be overwritten. +' Your customizations should be made in PersonalRankSqlTable.vb + +Imports BaseClasses.Data +Imports BaseClasses +Imports BaseClasses.Data.SqlProvider + + +Namespace Persons.Data + +''' +''' The generated superclass for the class. +''' +''' +''' This class is not intended to be instantiated directly. To obtain an instance of this class, +''' use the methods of the class. +''' +''' +''' + +Public Class BasePersonalRankSqlTable + Inherits DynamicSQLServerAdapter + + Public Sub New() + MyBase.New() + End Sub + + Public Sub New(ByVal connectionName As String) + MyBase.New(connectionName) + End Sub +End Class +End Namespace diff --git a/App_Code/Data Access Layer/BasePersonalSalarySqlTable.vb b/App_Code/Data Access Layer/BasePersonalSalarySqlTable.vb new file mode 100644 index 0000000..8c45ef7 --- /dev/null +++ b/App_Code/Data Access Layer/BasePersonalSalarySqlTable.vb @@ -0,0 +1,32 @@ +' This class is "generated" and will be overwritten. +' Your customizations should be made in PersonalSalarySqlTable.vb + +Imports BaseClasses.Data +Imports BaseClasses +Imports BaseClasses.Data.SqlProvider + + +Namespace Persons.Data + +''' +''' The generated superclass for the class. +''' +''' +''' This class is not intended to be instantiated directly. To obtain an instance of this class, +''' use the methods of the class. +''' +''' +''' + +Public Class BasePersonalSalarySqlTable + Inherits DynamicSQLServerAdapter + + Public Sub New() + MyBase.New() + End Sub + + Public Sub New(ByVal connectionName As String) + MyBase.New(connectionName) + End Sub +End Class +End Namespace diff --git a/App_Code/Data Access Layer/BasePersonalSpecialSkillSqlTable.vb b/App_Code/Data Access Layer/BasePersonalSpecialSkillSqlTable.vb new file mode 100644 index 0000000..7c5fc51 --- /dev/null +++ b/App_Code/Data Access Layer/BasePersonalSpecialSkillSqlTable.vb @@ -0,0 +1,32 @@ +' This class is "generated" and will be overwritten. +' Your customizations should be made in PersonalSpecialSkillSqlTable.vb + +Imports BaseClasses.Data +Imports BaseClasses +Imports BaseClasses.Data.SqlProvider + + +Namespace Persons.Data + +''' +''' The generated superclass for the class. +''' +''' +''' This class is not intended to be instantiated directly. To obtain an instance of this class, +''' use the methods of the class. +''' +''' +''' + +Public Class BasePersonalSpecialSkillSqlTable + Inherits DynamicSQLServerAdapter + + Public Sub New() + MyBase.New() + End Sub + + Public Sub New(ByVal connectionName As String) + MyBase.New(connectionName) + End Sub +End Class +End Namespace diff --git a/App_Code/Data Access Layer/BasePersonalSportSkillSqlTable.vb b/App_Code/Data Access Layer/BasePersonalSportSkillSqlTable.vb new file mode 100644 index 0000000..c65fc0d --- /dev/null +++ b/App_Code/Data Access Layer/BasePersonalSportSkillSqlTable.vb @@ -0,0 +1,32 @@ +' This class is "generated" and will be overwritten. +' Your customizations should be made in PersonalSportSkillSqlTable.vb + +Imports BaseClasses.Data +Imports BaseClasses +Imports BaseClasses.Data.SqlProvider + + +Namespace Persons.Data + +''' +''' The generated superclass for the class. +''' +''' +''' This class is not intended to be instantiated directly. To obtain an instance of this class, +''' use the methods of the class. +''' +''' +''' + +Public Class BasePersonalSportSkillSqlTable + Inherits DynamicSQLServerAdapter + + Public Sub New() + MyBase.New() + End Sub + + Public Sub New(ByVal connectionName As String) + MyBase.New(connectionName) + End Sub +End Class +End Namespace diff --git a/App_Code/Data Access Layer/BasePersonalTitleSqlTable.vb b/App_Code/Data Access Layer/BasePersonalTitleSqlTable.vb new file mode 100644 index 0000000..7b655b6 --- /dev/null +++ b/App_Code/Data Access Layer/BasePersonalTitleSqlTable.vb @@ -0,0 +1,32 @@ +' This class is "generated" and will be overwritten. +' Your customizations should be made in PersonalTitleSqlTable.vb + +Imports BaseClasses.Data +Imports BaseClasses +Imports BaseClasses.Data.SqlProvider + + +Namespace Persons.Data + +''' +''' The generated superclass for the class. +''' +''' +''' This class is not intended to be instantiated directly. To obtain an instance of this class, +''' use the methods of the class. +''' +''' +''' + +Public Class BasePersonalTitleSqlTable + Inherits DynamicSQLServerAdapter + + Public Sub New() + MyBase.New() + End Sub + + Public Sub New(ByVal connectionName As String) + MyBase.New(connectionName) + End Sub +End Class +End Namespace diff --git a/App_Code/Data Access Layer/BaseRStatusSqlTable.vb b/App_Code/Data Access Layer/BaseRStatusSqlTable.vb new file mode 100644 index 0000000..824bb4e --- /dev/null +++ b/App_Code/Data Access Layer/BaseRStatusSqlTable.vb @@ -0,0 +1,32 @@ +' This class is "generated" and will be overwritten. +' Your customizations should be made in RStatusSqlTable.vb + +Imports BaseClasses.Data +Imports BaseClasses +Imports BaseClasses.Data.SqlProvider + + +Namespace Persons.Data + +''' +''' The generated superclass for the class. +''' +''' +''' This class is not intended to be instantiated directly. To obtain an instance of this class, +''' use the methods of the class. +''' +''' +''' + +Public Class BaseRStatusSqlTable + Inherits DynamicSQLServerAdapter + + Public Sub New() + MyBase.New() + End Sub + + Public Sub New(ByVal connectionName As String) + MyBase.New(connectionName) + End Sub +End Class +End Namespace diff --git a/App_Code/Data Access Layer/BaseRankSqlTable.vb b/App_Code/Data Access Layer/BaseRankSqlTable.vb new file mode 100644 index 0000000..41192cb --- /dev/null +++ b/App_Code/Data Access Layer/BaseRankSqlTable.vb @@ -0,0 +1,32 @@ +' This class is "generated" and will be overwritten. +' Your customizations should be made in RankSqlTable.vb + +Imports BaseClasses.Data +Imports BaseClasses +Imports BaseClasses.Data.SqlProvider + + +Namespace Persons.Data + +''' +''' The generated superclass for the class. +''' +''' +''' This class is not intended to be instantiated directly. To obtain an instance of this class, +''' use the methods of the class. +''' +''' +''' + +Public Class BaseRankSqlTable + Inherits DynamicSQLServerAdapter + + Public Sub New() + MyBase.New() + End Sub + + Public Sub New(ByVal connectionName As String) + MyBase.New(connectionName) + End Sub +End Class +End Namespace diff --git a/App_Code/Data Access Layer/BaseRelationSqlTable.vb b/App_Code/Data Access Layer/BaseRelationSqlTable.vb new file mode 100644 index 0000000..7517aed --- /dev/null +++ b/App_Code/Data Access Layer/BaseRelationSqlTable.vb @@ -0,0 +1,32 @@ +' This class is "generated" and will be overwritten. +' Your customizations should be made in RelationSqlTable.vb + +Imports BaseClasses.Data +Imports BaseClasses +Imports BaseClasses.Data.SqlProvider + + +Namespace Persons.Data + +''' +''' The generated superclass for the class. +''' +''' +''' This class is not intended to be instantiated directly. To obtain an instance of this class, +''' use the methods of the class. +''' +''' +''' + +Public Class BaseRelationSqlTable + Inherits DynamicSQLServerAdapter + + Public Sub New() + MyBase.New() + End Sub + + Public Sub New(ByVal connectionName As String) + MyBase.New(connectionName) + End Sub +End Class +End Namespace diff --git a/App_Code/Data Access Layer/BaseReportPropertiesSqlTable.vb b/App_Code/Data Access Layer/BaseReportPropertiesSqlTable.vb new file mode 100644 index 0000000..2c7522e --- /dev/null +++ b/App_Code/Data Access Layer/BaseReportPropertiesSqlTable.vb @@ -0,0 +1,32 @@ +' This class is "generated" and will be overwritten. +' Your customizations should be made in ReportPropertiesSqlTable.vb + +Imports BaseClasses.Data +Imports BaseClasses +Imports BaseClasses.Data.SqlProvider + + +Namespace Persons.Data + +''' +''' The generated superclass for the class. +''' +''' +''' This class is not intended to be instantiated directly. To obtain an instance of this class, +''' use the methods of the class. +''' +''' +''' + +Public Class BaseReportPropertiesSqlTable + Inherits DynamicSQLServerAdapter + + Public Sub New() + MyBase.New() + End Sub + + Public Sub New(ByVal connectionName As String) + MyBase.New(connectionName) + End Sub +End Class +End Namespace diff --git a/App_Code/Data Access Layer/BaseSectionSqlTable.vb b/App_Code/Data Access Layer/BaseSectionSqlTable.vb new file mode 100644 index 0000000..9f510b5 --- /dev/null +++ b/App_Code/Data Access Layer/BaseSectionSqlTable.vb @@ -0,0 +1,32 @@ +' This class is "generated" and will be overwritten. +' Your customizations should be made in SectionSqlTable.vb + +Imports BaseClasses.Data +Imports BaseClasses +Imports BaseClasses.Data.SqlProvider + + +Namespace Persons.Data + +''' +''' The generated superclass for the class. +''' +''' +''' This class is not intended to be instantiated directly. To obtain an instance of this class, +''' use the methods of the class. +''' +''' +''' + +Public Class BaseSectionSqlTable + Inherits DynamicSQLServerAdapter + + Public Sub New() + MyBase.New() + End Sub + + Public Sub New(ByVal connectionName As String) + MyBase.New(connectionName) + End Sub +End Class +End Namespace diff --git a/App_Code/Data Access Layer/BaseSexSqlTable.vb b/App_Code/Data Access Layer/BaseSexSqlTable.vb new file mode 100644 index 0000000..0b2af9d --- /dev/null +++ b/App_Code/Data Access Layer/BaseSexSqlTable.vb @@ -0,0 +1,32 @@ +' This class is "generated" and will be overwritten. +' Your customizations should be made in SexSqlTable.vb + +Imports BaseClasses.Data +Imports BaseClasses +Imports BaseClasses.Data.SqlProvider + + +Namespace Persons.Data + +''' +''' The generated superclass for the class. +''' +''' +''' This class is not intended to be instantiated directly. To obtain an instance of this class, +''' use the methods of the class. +''' +''' +''' + +Public Class BaseSexSqlTable + Inherits DynamicSQLServerAdapter + + Public Sub New() + MyBase.New() + End Sub + + Public Sub New(ByVal connectionName As String) + MyBase.New(connectionName) + End Sub +End Class +End Namespace diff --git a/App_Code/Data Access Layer/BaseShowPersonalIdTableSqlQuery.vb b/App_Code/Data Access Layer/BaseShowPersonalIdTableSqlQuery.vb new file mode 100644 index 0000000..ba666ff --- /dev/null +++ b/App_Code/Data Access Layer/BaseShowPersonalIdTableSqlQuery.vb @@ -0,0 +1,35 @@ +' This class is "generated" and will be overwritten. +' Your customizations should be made in ShowPersonalIdTableSqlQuery.vb + +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + +Namespace Persons.Data + +''' +''' The generated superclass for the class. +''' +''' +''' This class is not intended to be instantiated directly. To obtain an instance of this class, +''' use the methods of the class. +''' +''' This is a "generated" class, meaning that it may be overwritten when you regenerate your application. +''' Any changes you make to this class may not be preserved if you regenerate your application. +''' Instead, changes should be applied to the class. +''' +''' +''' +''' + +Public Class BaseShowPersonalIdTableSqlQuery + Inherits DynamicSQLServerAdapter + + Public Sub New() + End Sub + + Public Sub New(ByVal connectionName As String) + MyBase.New(connectionName) + End Sub +End Class +End Namespace diff --git a/App_Code/Data Access Layer/BaseSportSqlTable.vb b/App_Code/Data Access Layer/BaseSportSqlTable.vb new file mode 100644 index 0000000..4b7b3b9 --- /dev/null +++ b/App_Code/Data Access Layer/BaseSportSqlTable.vb @@ -0,0 +1,32 @@ +' This class is "generated" and will be overwritten. +' Your customizations should be made in SportSqlTable.vb + +Imports BaseClasses.Data +Imports BaseClasses +Imports BaseClasses.Data.SqlProvider + + +Namespace Persons.Data + +''' +''' The generated superclass for the class. +''' +''' +''' This class is not intended to be instantiated directly. To obtain an instance of this class, +''' use the methods of the class. +''' +''' +''' + +Public Class BaseSportSqlTable + Inherits DynamicSQLServerAdapter + + Public Sub New() + MyBase.New() + End Sub + + Public Sub New(ByVal connectionName As String) + MyBase.New(connectionName) + End Sub +End Class +End Namespace diff --git a/App_Code/Data Access Layer/BaseStatusSqlTable.vb b/App_Code/Data Access Layer/BaseStatusSqlTable.vb new file mode 100644 index 0000000..80d43cf --- /dev/null +++ b/App_Code/Data Access Layer/BaseStatusSqlTable.vb @@ -0,0 +1,32 @@ +' This class is "generated" and will be overwritten. +' Your customizations should be made in StatusSqlTable.vb + +Imports BaseClasses.Data +Imports BaseClasses +Imports BaseClasses.Data.SqlProvider + + +Namespace Persons.Data + +''' +''' The generated superclass for the class. +''' +''' +''' This class is not intended to be instantiated directly. To obtain an instance of this class, +''' use the methods of the class. +''' +''' +''' + +Public Class BaseStatusSqlTable + Inherits DynamicSQLServerAdapter + + Public Sub New() + MyBase.New() + End Sub + + Public Sub New(ByVal connectionName As String) + MyBase.New(connectionName) + End Sub +End Class +End Namespace diff --git a/App_Code/Data Access Layer/BaseTblRoleSqlTable.vb b/App_Code/Data Access Layer/BaseTblRoleSqlTable.vb new file mode 100644 index 0000000..12de399 --- /dev/null +++ b/App_Code/Data Access Layer/BaseTblRoleSqlTable.vb @@ -0,0 +1,32 @@ +' This class is "generated" and will be overwritten. +' Your customizations should be made in TblRoleSqlTable.vb + +Imports BaseClasses.Data +Imports BaseClasses +Imports BaseClasses.Data.SqlProvider + + +Namespace Persons.Data + +''' +''' The generated superclass for the class. +''' +''' +''' This class is not intended to be instantiated directly. To obtain an instance of this class, +''' use the methods of the class. +''' +''' +''' + +Public Class BaseTblRoleSqlTable + Inherits DynamicSQLServerAdapter + + Public Sub New() + MyBase.New() + End Sub + + Public Sub New(ByVal connectionName As String) + MyBase.New(connectionName) + End Sub +End Class +End Namespace diff --git a/App_Code/Data Access Layer/BaseTblUserRoleSqlTable.vb b/App_Code/Data Access Layer/BaseTblUserRoleSqlTable.vb new file mode 100644 index 0000000..943f1a4 --- /dev/null +++ b/App_Code/Data Access Layer/BaseTblUserRoleSqlTable.vb @@ -0,0 +1,32 @@ +' This class is "generated" and will be overwritten. +' Your customizations should be made in TblUserRoleSqlTable.vb + +Imports BaseClasses.Data +Imports BaseClasses +Imports BaseClasses.Data.SqlProvider + + +Namespace Persons.Data + +''' +''' The generated superclass for the class. +''' +''' +''' This class is not intended to be instantiated directly. To obtain an instance of this class, +''' use the methods of the class. +''' +''' +''' + +Public Class BaseTblUserRoleSqlTable + Inherits DynamicSQLServerAdapter + + Public Sub New() + MyBase.New() + End Sub + + Public Sub New(ByVal connectionName As String) + MyBase.New(connectionName) + End Sub +End Class +End Namespace diff --git a/App_Code/Data Access Layer/BaseView_MaxPersonalEducationSqlView.vb b/App_Code/Data Access Layer/BaseView_MaxPersonalEducationSqlView.vb new file mode 100644 index 0000000..1a84bbc --- /dev/null +++ b/App_Code/Data Access Layer/BaseView_MaxPersonalEducationSqlView.vb @@ -0,0 +1,32 @@ +' This class is "generated" and will be overwritten. +' Your customizations should be made in View_MaxPersonalEducationSqlView.vb + +Imports BaseClasses.Data +Imports BaseClasses +Imports BaseClasses.Data.SqlProvider + + +Namespace Persons.Data + +''' +''' The generated superclass for the class. +''' +''' +''' This class is not intended to be instantiated directly. To obtain an instance of this class, +''' use the methods of the class. +''' +''' +''' + +Public Class BaseView_MaxPersonalEducationSqlView + Inherits DynamicSQLServerAdapter + + Public Sub New() + MyBase.New() + End Sub + + Public Sub New(ByVal connectionName As String) + MyBase.New(connectionName) + End Sub +End Class +End Namespace diff --git a/App_Code/Data Access Layer/BaseView_PersonalEducationSqlView.vb b/App_Code/Data Access Layer/BaseView_PersonalEducationSqlView.vb new file mode 100644 index 0000000..734352c --- /dev/null +++ b/App_Code/Data Access Layer/BaseView_PersonalEducationSqlView.vb @@ -0,0 +1,31 @@ +' This class is "generated" and will be overwritten. +' Your customizations should be made in View_PersonalEducationSqlView.vb + +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + + +Namespace Persons.Data + +''' +''' The generated superclass for the class. +''' +''' +''' This class is not intended to be instantiated directly. To obtain an instance of this class, +''' use the methods of the class. +''' +''' +''' + +Public Class BaseView_PersonalEducationSqlView + Inherits DynamicSQLServerAdapter + + Public Sub New() + End Sub + + Public Sub New(ByVal connectionName As String) + MyBase.New(connectionName) + End Sub +End Class +End Namespace diff --git a/App_Code/Data Access Layer/BaseView_PersonsSqlView.vb b/App_Code/Data Access Layer/BaseView_PersonsSqlView.vb new file mode 100644 index 0000000..948e7c8 --- /dev/null +++ b/App_Code/Data Access Layer/BaseView_PersonsSqlView.vb @@ -0,0 +1,32 @@ +' This class is "generated" and will be overwritten. +' Your customizations should be made in View_PersonsSqlView.vb + +Imports BaseClasses.Data +Imports BaseClasses +Imports BaseClasses.Data.SqlProvider + + +Namespace Persons.Data + +''' +''' The generated superclass for the class. +''' +''' +''' This class is not intended to be instantiated directly. To obtain an instance of this class, +''' use the methods of the class. +''' +''' +''' + +Public Class BaseView_PersonsSqlView + Inherits DynamicSQLServerAdapter + + Public Sub New() + MyBase.New() + End Sub + + Public Sub New(ByVal connectionName As String) + MyBase.New(connectionName) + End Sub +End Class +End Namespace diff --git a/App_Code/Data Access Layer/BloodId.xml b/App_Code/Data Access Layer/BloodId.xml new file mode 100644 index 0000000..29ba981 --- /dev/null +++ b/App_Code/Data Access Layer/BloodId.xml @@ -0,0 +1,115 @@ + + + + + BloodId + %ISD_DEFAULT% + Number + tinyint + 3.0 + + + + + Y + Y + + + + + Y + N + N + N + N + Y + Y + N + + + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + BloodName + หมู่โลหิต + String + nvarchar + 50 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + BloodId + 1 + dbo + BloodId + BloodId_ + DatabasePersons1 + RowNum + Y + Y + Y + Y + BinaryChecksum + Persons + \ No newline at end of file diff --git a/App_Code/Data Access Layer/BloodIdDefinition.vb b/App_Code/Data Access Layer/BloodIdDefinition.vb new file mode 100644 index 0000000..86bb6bf --- /dev/null +++ b/App_Code/Data Access Layer/BloodIdDefinition.vb @@ -0,0 +1,126 @@ +Namespace Persons.Business +''' +''' Contains embedded schema and configuration data that is used by the +''' Persons.BloodIdTable class +''' to initialize the class's TableDefinition. +''' +''' + +Public Class BloodIdDefinition + +#Region "Definition (XML) for BloodIdDefinition table" + 'Next 93 lines contain Table Definition (XML) for table "BloodIdDefinition" + Private Shared _DefinitionString As String = "" +#End Region + + ''' + ''' Gets the embedded schema and configuration data for the + ''' + ''' class's TableDefinition. + ''' + ''' This function is only called once at runtime. + ''' An XML string. + Public Shared Function GetXMLString() As String + If _DefinitionString = "" Then + Dim tbf As System.Text.StringBuilder = New System.Text.StringBuilder() + tbf.Append("") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "BloodId") + tbf.Append( "Blood") + tbf.Append( "Number") + tbf.Append( "tinyint") + tbf.Append( "3.0") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "BloodName") + tbf.Append( "หมู่โลหิต") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "50") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "BloodId") + tbf.Append( "1") + tbf.Append( "dbo") + tbf.Append( "BloodId") + tbf.Append( "BloodId_") + tbf.Append( "DatabasePersons1") + tbf.Append( "RowNum") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "BinaryChecksum") + tbf.Append( "Persons") + tbf.Append("") + _DefinitionString = tbf.ToString() + + End If + Return _DefinitionString + End Function + +End Class +End Namespace diff --git a/App_Code/Data Access Layer/BloodIdSqlTable.vb b/App_Code/Data Access Layer/BloodIdSqlTable.vb new file mode 100644 index 0000000..4620809 --- /dev/null +++ b/App_Code/Data Access Layer/BloodIdSqlTable.vb @@ -0,0 +1,47 @@ +' This is a "safe" class, meaning that it is created once +' and never overwritten. Any custom code you add to this class +' will be preserved when you regenerate your application. +' +' Typical customizations that may be done in this class include +' - overriding base class methods + +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + +Namespace Persons.Data + + ''' + ''' Used by the class to access and/or modify the database. + ''' + ''' + ''' This class is not intended to be instantiated directly. To obtain an instance of this class, + ''' use the methods of the class. + ''' + ''' + + Public Class BloodIdSqlTable + Inherits BaseBloodIdSqlTable + + 'The functions below may be overridden in order to implement your own + 'logic for creating, updating, deleting, and getting individual records, + 'or for running queries that return lists of records. + + ' Creates a new record. + ' Before calling this method, column values should be set using SetColumn(). + 'Public Overloads Overrides Function CreateRecord() As KeyValue + 'End Function + + ' Updates a record in the database. + ' Before calling this method, column values should be set using SetColumn(). + 'Protected Overrides Sub UpdateRecord() + 'End Sub + + ' Deletes a record defined by a primary key value. + 'Public Overloads Overrides Sub DeleteRecord(ByVal key As KeyValue) + 'End Sub + + ' Gets a record from the database. + 'Protected Overloads Overrides Sub GetRecord() + 'End Sub + End Class +End Namespace diff --git a/App_Code/Data Access Layer/Born.xml b/App_Code/Data Access Layer/Born.xml new file mode 100644 index 0000000..fba37c6 --- /dev/null +++ b/App_Code/Data Access Layer/Born.xml @@ -0,0 +1,114 @@ + + + + + Born + %ISD_DEFAULT% + String + nvarchar + 25 + + + + + Y + Y + + + + + Y + N + N + N + N + Y + Y + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + BornDesc + %ISD_DEFAULT% + String + nvarchar + 150 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + Born + 1 + dbo + Born + Born_ + DatabasePersons1 + RowNum + Y + Y + Y + Y + BinaryChecksum + Persons + \ No newline at end of file diff --git a/App_Code/Data Access Layer/BornDefinition.vb b/App_Code/Data Access Layer/BornDefinition.vb new file mode 100644 index 0000000..4014a48 --- /dev/null +++ b/App_Code/Data Access Layer/BornDefinition.vb @@ -0,0 +1,126 @@ +Namespace Persons.Business +''' +''' Contains embedded schema and configuration data that is used by the +''' Persons.BornTable class +''' to initialize the class's TableDefinition. +''' +''' + +Public Class BornDefinition + +#Region "Definition (XML) for BornDefinition table" + 'Next 93 lines contain Table Definition (XML) for table "BornDefinition" + Private Shared _DefinitionString As String = "" +#End Region + + ''' + ''' Gets the embedded schema and configuration data for the + ''' + ''' class's TableDefinition. + ''' + ''' This function is only called once at runtime. + ''' An XML string. + Public Shared Function GetXMLString() As String + If _DefinitionString = "" Then + Dim tbf As System.Text.StringBuilder = New System.Text.StringBuilder() + tbf.Append("") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Born") + tbf.Append( "Born") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "25") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "BornDesc") + tbf.Append( "Born Desc") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "150") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Born") + tbf.Append( "1") + tbf.Append( "dbo") + tbf.Append( "Born") + tbf.Append( "Born_") + tbf.Append( "DatabasePersons1") + tbf.Append( "RowNum") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "BinaryChecksum") + tbf.Append( "Persons") + tbf.Append("") + _DefinitionString = tbf.ToString() + + End If + Return _DefinitionString + End Function + +End Class +End Namespace diff --git a/App_Code/Data Access Layer/BornSqlTable.vb b/App_Code/Data Access Layer/BornSqlTable.vb new file mode 100644 index 0000000..32bfa32 --- /dev/null +++ b/App_Code/Data Access Layer/BornSqlTable.vb @@ -0,0 +1,47 @@ +' This is a "safe" class, meaning that it is created once +' and never overwritten. Any custom code you add to this class +' will be preserved when you regenerate your application. +' +' Typical customizations that may be done in this class include +' - overriding base class methods + +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + +Namespace Persons.Data + + ''' + ''' Used by the class to access and/or modify the database. + ''' + ''' + ''' This class is not intended to be instantiated directly. To obtain an instance of this class, + ''' use the methods of the class. + ''' + ''' + + Public Class BornSqlTable + Inherits BaseBornSqlTable + + 'The functions below may be overridden in order to implement your own + 'logic for creating, updating, deleting, and getting individual records, + 'or for running queries that return lists of records. + + ' Creates a new record. + ' Before calling this method, column values should be set using SetColumn(). + 'Public Overloads Overrides Function CreateRecord() As KeyValue + 'End Function + + ' Updates a record in the database. + ' Before calling this method, column values should be set using SetColumn(). + 'Protected Overrides Sub UpdateRecord() + 'End Sub + + ' Deletes a record defined by a primary key value. + 'Public Overloads Overrides Sub DeleteRecord(ByVal key As KeyValue) + 'End Sub + + ' Gets a record from the database. + 'Protected Overloads Overrides Sub GetRecord() + 'End Sub + End Class +End Namespace diff --git a/App_Code/Data Access Layer/Country.xml b/App_Code/Data Access Layer/Country.xml new file mode 100644 index 0000000..054e66e --- /dev/null +++ b/App_Code/Data Access Layer/Country.xml @@ -0,0 +1,115 @@ + + + + + CountryId + %ISD_DEFAULT% + Number + smallint + 5.0 + + + + + Y + Y + + + + + Y + N + N + N + N + Y + Y + N + + + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + Country + %ISD_DEFAULT% + String + nvarchar + 50 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + Country + 1 + dbo + Country + Country_ + DatabasePersons1 + RowNum + Y + Y + Y + Y + BinaryChecksum + Persons + \ No newline at end of file diff --git a/App_Code/Data Access Layer/CountryDefinition.vb b/App_Code/Data Access Layer/CountryDefinition.vb new file mode 100644 index 0000000..afdc2d1 --- /dev/null +++ b/App_Code/Data Access Layer/CountryDefinition.vb @@ -0,0 +1,126 @@ +Namespace Persons.Business +''' +''' Contains embedded schema and configuration data that is used by the +''' Persons.CountryTable class +''' to initialize the class's TableDefinition. +''' +''' + +Public Class CountryDefinition + +#Region "Definition (XML) for CountryDefinition table" + 'Next 93 lines contain Table Definition (XML) for table "CountryDefinition" + Private Shared _DefinitionString As String = "" +#End Region + + ''' + ''' Gets the embedded schema and configuration data for the + ''' + ''' class's TableDefinition. + ''' + ''' This function is only called once at runtime. + ''' An XML string. + Public Shared Function GetXMLString() As String + If _DefinitionString = "" Then + Dim tbf As System.Text.StringBuilder = New System.Text.StringBuilder() + tbf.Append("") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "CountryId") + tbf.Append( "Country") + tbf.Append( "Number") + tbf.Append( "smallint") + tbf.Append( "5.0") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Country") + tbf.Append( "Country") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "50") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Country") + tbf.Append( "1") + tbf.Append( "dbo") + tbf.Append( "Country") + tbf.Append( "Country_") + tbf.Append( "DatabasePersons1") + tbf.Append( "RowNum") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "BinaryChecksum") + tbf.Append( "Persons") + tbf.Append("") + _DefinitionString = tbf.ToString() + + End If + Return _DefinitionString + End Function + +End Class +End Namespace diff --git a/App_Code/Data Access Layer/CountrySqlTable.vb b/App_Code/Data Access Layer/CountrySqlTable.vb new file mode 100644 index 0000000..aada564 --- /dev/null +++ b/App_Code/Data Access Layer/CountrySqlTable.vb @@ -0,0 +1,47 @@ +' This is a "safe" class, meaning that it is created once +' and never overwritten. Any custom code you add to this class +' will be preserved when you regenerate your application. +' +' Typical customizations that may be done in this class include +' - overriding base class methods + +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + +Namespace Persons.Data + + ''' + ''' Used by the class to access and/or modify the database. + ''' + ''' + ''' This class is not intended to be instantiated directly. To obtain an instance of this class, + ''' use the methods of the class. + ''' + ''' + + Public Class CountrySqlTable + Inherits BaseCountrySqlTable + + 'The functions below may be overridden in order to implement your own + 'logic for creating, updating, deleting, and getting individual records, + 'or for running queries that return lists of records. + + ' Creates a new record. + ' Before calling this method, column values should be set using SetColumn(). + 'Public Overloads Overrides Function CreateRecord() As KeyValue + 'End Function + + ' Updates a record in the database. + ' Before calling this method, column values should be set using SetColumn(). + 'Protected Overrides Sub UpdateRecord() + 'End Sub + + ' Deletes a record defined by a primary key value. + 'Public Overloads Overrides Sub DeleteRecord(ByVal key As KeyValue) + 'End Sub + + ' Gets a record from the database. + 'Protected Overloads Overrides Sub GetRecord() + 'End Sub + End Class +End Namespace diff --git a/App_Code/Data Access Layer/Dept.xml b/App_Code/Data Access Layer/Dept.xml new file mode 100644 index 0000000..bf62338 --- /dev/null +++ b/App_Code/Data Access Layer/Dept.xml @@ -0,0 +1,366 @@ + + + + + DeptId + %ISD_DEFAULT% + Number + smallint + 5.0 + + + + + Y + Y + + + + + Y + N + N + N + N + Y + Y + N + + + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + SectionId + ส่วนราชการ + Number + smallint + 5.0 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + + + N + %ISD_DEFAULT% + + + Y + + FK_Dept_Section + Section + dbo + SectionId + SectionAbbvrName + Explicit + + Y + N + N + N + N + N + N + + + + + + + + + + + + + Dept + กอง/แผนก + String + nvarchar + 100 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + DeptAbbvr + ชื่อย่ด + String + nvarchar + 25 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + ChiefId + ชื่อหัวหน้าแผนก/กอง + Number + int + 10.0 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + + + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + Position + ตำแหน่ง + String + nvarchar + 255 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + Sign + ลายเซ็นต์ + Image + image + 2147483647 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + + + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + Dept + 1 + dbo + Dept + Dept_ + DatabasePersons1 + RowNum + Y + Y + Y + Y + BinaryChecksum + Persons + \ No newline at end of file diff --git a/App_Code/Data Access Layer/DeptDefinition.vb b/App_Code/Data Access Layer/DeptDefinition.vb new file mode 100644 index 0000000..801d343 --- /dev/null +++ b/App_Code/Data Access Layer/DeptDefinition.vb @@ -0,0 +1,324 @@ +Namespace Persons.Business +''' +''' Contains embedded schema and configuration data that is used by the +''' Persons.DeptTable class +''' to initialize the class's TableDefinition. +''' +''' + +Public Class DeptDefinition + +#Region "Definition (XML) for DeptDefinition table" + 'Next 291 lines contain Table Definition (XML) for table "DeptDefinition" + Private Shared _DefinitionString As String = "" +#End Region + + ''' + ''' Gets the embedded schema and configuration data for the + ''' + ''' class's TableDefinition. + ''' + ''' This function is only called once at runtime. + ''' An XML string. + Public Shared Function GetXMLString() As String + If _DefinitionString = "" Then + Dim tbf As System.Text.StringBuilder = New System.Text.StringBuilder() + tbf.Append("") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "DeptId") + tbf.Append( "Dept") + tbf.Append( "Number") + tbf.Append( "smallint") + tbf.Append( "5.0") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "SectionId") + tbf.Append( "ส่วนราชการ") + tbf.Append( "Number") + tbf.Append( "smallint") + tbf.Append( "5.0") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "") + tbf.Append( "FK_Dept_Section") + tbf.Append( "Persons.Business.SectionTable, App_Code") + tbf.Append( "dbo") + tbf.Append( "SectionId") + tbf.Append( "SectionAbbvrName") + tbf.Append( "Explicit") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Dept") + tbf.Append( "กอง/แผนก") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "100") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "DeptAbbvr") + tbf.Append( "ชื่อย่ด") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "25") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "ChiefId") + tbf.Append( "ชื่อหัวหน้าแผนก/กอง") + tbf.Append( "Number") + tbf.Append( "int") + tbf.Append( "10.0") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Position") + tbf.Append( "ตำแหน่ง") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "255") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Sign") + tbf.Append( "ลายเซ็นต์") + tbf.Append( "Image") + tbf.Append( "image") + tbf.Append( "2147483647") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Dept") + tbf.Append( "1") + tbf.Append( "dbo") + tbf.Append( "Dept") + tbf.Append( "Dept_") + tbf.Append( "DatabasePersons1") + tbf.Append( "RowNum") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "BinaryChecksum") + tbf.Append( "Persons") + tbf.Append("") + _DefinitionString = tbf.ToString() + + End If + Return _DefinitionString + End Function + +End Class +End Namespace diff --git a/App_Code/Data Access Layer/DeptSqlTable.vb b/App_Code/Data Access Layer/DeptSqlTable.vb new file mode 100644 index 0000000..58ae85b --- /dev/null +++ b/App_Code/Data Access Layer/DeptSqlTable.vb @@ -0,0 +1,47 @@ +' This is a "safe" class, meaning that it is created once +' and never overwritten. Any custom code you add to this class +' will be preserved when you regenerate your application. +' +' Typical customizations that may be done in this class include +' - overriding base class methods + +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + +Namespace Persons.Data + + ''' + ''' Used by the class to access and/or modify the database. + ''' + ''' + ''' This class is not intended to be instantiated directly. To obtain an instance of this class, + ''' use the methods of the class. + ''' + ''' + + Public Class DeptSqlTable + Inherits BaseDeptSqlTable + + 'The functions below may be overridden in order to implement your own + 'logic for creating, updating, deleting, and getting individual records, + 'or for running queries that return lists of records. + + ' Creates a new record. + ' Before calling this method, column values should be set using SetColumn(). + 'Public Overloads Overrides Function CreateRecord() As KeyValue + 'End Function + + ' Updates a record in the database. + ' Before calling this method, column values should be set using SetColumn(). + 'Protected Overrides Sub UpdateRecord() + 'End Sub + + ' Deletes a record defined by a primary key value. + 'Public Overloads Overrides Sub DeleteRecord(ByVal key As KeyValue) + 'End Sub + + ' Gets a record from the database. + 'Protected Overloads Overrides Sub GetRecord() + 'End Sub + End Class +End Namespace diff --git a/App_Code/Data Access Layer/Education.xml b/App_Code/Data Access Layer/Education.xml new file mode 100644 index 0000000..cd75af1 --- /dev/null +++ b/App_Code/Data Access Layer/Education.xml @@ -0,0 +1,115 @@ + + + + + EducationId + %ISD_DEFAULT% + Number + smallint + 5.0 + + + + + Y + Y + + + + + Y + N + N + N + N + Y + Y + N + + + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + Level + ระดับการศึกษา + String + nvarchar + 50 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + Education + 1 + dbo + Education + Education_ + DatabasePersons1 + RowNum + Y + Y + Y + Y + BinaryChecksum + Persons + \ No newline at end of file diff --git a/App_Code/Data Access Layer/EducationDefinition.vb b/App_Code/Data Access Layer/EducationDefinition.vb new file mode 100644 index 0000000..cff5c41 --- /dev/null +++ b/App_Code/Data Access Layer/EducationDefinition.vb @@ -0,0 +1,126 @@ +Namespace Persons.Business +''' +''' Contains embedded schema and configuration data that is used by the +''' Persons.EducationTable class +''' to initialize the class's TableDefinition. +''' +''' + +Public Class EducationDefinition + +#Region "Definition (XML) for EducationDefinition table" + 'Next 93 lines contain Table Definition (XML) for table "EducationDefinition" + Private Shared _DefinitionString As String = "" +#End Region + + ''' + ''' Gets the embedded schema and configuration data for the + ''' + ''' class's TableDefinition. + ''' + ''' This function is only called once at runtime. + ''' An XML string. + Public Shared Function GetXMLString() As String + If _DefinitionString = "" Then + Dim tbf As System.Text.StringBuilder = New System.Text.StringBuilder() + tbf.Append("") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "EducationId") + tbf.Append( "Education") + tbf.Append( "Number") + tbf.Append( "smallint") + tbf.Append( "5.0") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Level") + tbf.Append( "ระดับการศึกษา") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "50") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Education") + tbf.Append( "1") + tbf.Append( "dbo") + tbf.Append( "Education") + tbf.Append( "Education_") + tbf.Append( "DatabasePersons1") + tbf.Append( "RowNum") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "BinaryChecksum") + tbf.Append( "Persons") + tbf.Append("") + _DefinitionString = tbf.ToString() + + End If + Return _DefinitionString + End Function + +End Class +End Namespace diff --git a/App_Code/Data Access Layer/EducationPeriod.xml b/App_Code/Data Access Layer/EducationPeriod.xml new file mode 100644 index 0000000..781abac --- /dev/null +++ b/App_Code/Data Access Layer/EducationPeriod.xml @@ -0,0 +1,115 @@ + + + + + PeriodId + %ISD_DEFAULT% + Number + tinyint + 3.0 + + + + + Y + Y + + + + + Y + N + N + N + N + Y + Y + N + + + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + Period + %ISD_DEFAULT% + String + nvarchar + 20 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + EducationPeriod + 1 + dbo + EducationPeriod + EducationPeriod_ + DatabasePersons1 + RowNum + Y + Y + Y + Y + BinaryChecksum + Persons + \ No newline at end of file diff --git a/App_Code/Data Access Layer/EducationPeriodDefinition.vb b/App_Code/Data Access Layer/EducationPeriodDefinition.vb new file mode 100644 index 0000000..9dc8d1a --- /dev/null +++ b/App_Code/Data Access Layer/EducationPeriodDefinition.vb @@ -0,0 +1,126 @@ +Namespace Persons.Business +''' +''' Contains embedded schema and configuration data that is used by the +''' Persons.EducationPeriodTable class +''' to initialize the class's TableDefinition. +''' +''' + +Public Class EducationPeriodDefinition + +#Region "Definition (XML) for EducationPeriodDefinition table" + 'Next 93 lines contain Table Definition (XML) for table "EducationPeriodDefinition" + Private Shared _DefinitionString As String = "" +#End Region + + ''' + ''' Gets the embedded schema and configuration data for the + ''' + ''' class's TableDefinition. + ''' + ''' This function is only called once at runtime. + ''' An XML string. + Public Shared Function GetXMLString() As String + If _DefinitionString = "" Then + Dim tbf As System.Text.StringBuilder = New System.Text.StringBuilder() + tbf.Append("") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "PeriodId") + tbf.Append( "Period") + tbf.Append( "Number") + tbf.Append( "tinyint") + tbf.Append( "3.0") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Period") + tbf.Append( "Period") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "20") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "EducationPeriod") + tbf.Append( "1") + tbf.Append( "dbo") + tbf.Append( "EducationPeriod") + tbf.Append( "EducationPeriod_") + tbf.Append( "DatabasePersons1") + tbf.Append( "RowNum") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "BinaryChecksum") + tbf.Append( "Persons") + tbf.Append("") + _DefinitionString = tbf.ToString() + + End If + Return _DefinitionString + End Function + +End Class +End Namespace diff --git a/App_Code/Data Access Layer/EducationPeriodSqlTable.vb b/App_Code/Data Access Layer/EducationPeriodSqlTable.vb new file mode 100644 index 0000000..8759ee9 --- /dev/null +++ b/App_Code/Data Access Layer/EducationPeriodSqlTable.vb @@ -0,0 +1,47 @@ +' This is a "safe" class, meaning that it is created once +' and never overwritten. Any custom code you add to this class +' will be preserved when you regenerate your application. +' +' Typical customizations that may be done in this class include +' - overriding base class methods + +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + +Namespace Persons.Data + + ''' + ''' Used by the class to access and/or modify the database. + ''' + ''' + ''' This class is not intended to be instantiated directly. To obtain an instance of this class, + ''' use the methods of the class. + ''' + ''' + + Public Class EducationPeriodSqlTable + Inherits BaseEducationPeriodSqlTable + + 'The functions below may be overridden in order to implement your own + 'logic for creating, updating, deleting, and getting individual records, + 'or for running queries that return lists of records. + + ' Creates a new record. + ' Before calling this method, column values should be set using SetColumn(). + 'Public Overloads Overrides Function CreateRecord() As KeyValue + 'End Function + + ' Updates a record in the database. + ' Before calling this method, column values should be set using SetColumn(). + 'Protected Overrides Sub UpdateRecord() + 'End Sub + + ' Deletes a record defined by a primary key value. + 'Public Overloads Overrides Sub DeleteRecord(ByVal key As KeyValue) + 'End Sub + + ' Gets a record from the database. + 'Protected Overloads Overrides Sub GetRecord() + 'End Sub + End Class +End Namespace diff --git a/App_Code/Data Access Layer/EducationSqlTable.vb b/App_Code/Data Access Layer/EducationSqlTable.vb new file mode 100644 index 0000000..65b7153 --- /dev/null +++ b/App_Code/Data Access Layer/EducationSqlTable.vb @@ -0,0 +1,47 @@ +' This is a "safe" class, meaning that it is created once +' and never overwritten. Any custom code you add to this class +' will be preserved when you regenerate your application. +' +' Typical customizations that may be done in this class include +' - overriding base class methods + +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + +Namespace Persons.Data + + ''' + ''' Used by the class to access and/or modify the database. + ''' + ''' + ''' This class is not intended to be instantiated directly. To obtain an instance of this class, + ''' use the methods of the class. + ''' + ''' + + Public Class EducationSqlTable + Inherits BaseEducationSqlTable + + 'The functions below may be overridden in order to implement your own + 'logic for creating, updating, deleting, and getting individual records, + 'or for running queries that return lists of records. + + ' Creates a new record. + ' Before calling this method, column values should be set using SetColumn(). + 'Public Overloads Overrides Function CreateRecord() As KeyValue + 'End Function + + ' Updates a record in the database. + ' Before calling this method, column values should be set using SetColumn(). + 'Protected Overrides Sub UpdateRecord() + 'End Sub + + ' Deletes a record defined by a primary key value. + 'Public Overloads Overrides Sub DeleteRecord(ByVal key As KeyValue) + 'End Sub + + ' Gets a record from the database. + 'Protected Overloads Overrides Sub GetRecord() + 'End Sub + End Class +End Namespace diff --git a/App_Code/Data Access Layer/ExTraSalary.xml b/App_Code/Data Access Layer/ExTraSalary.xml new file mode 100644 index 0000000..ff227ac --- /dev/null +++ b/App_Code/Data Access Layer/ExTraSalary.xml @@ -0,0 +1,358 @@ + + + + + ExtraSalaryId + %ISD_DEFAULT% + Number + int + 10.0 + + + + + Y + Y + + + + + Y + N + Y + Y + Y + N + Y + N + + + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + FullName + %ISD_DEFAULT% + String + nvarchar + 50 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + AbbvrName + %ISD_DEFAULT% + String + nvarchar + 35 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + OffAmout + %ISD_DEFAULT% + Number + int + 10.0 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + + + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + NonOffAmout + %ISD_DEFAULT% + Number + int + 10.0 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + + + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + PrivateAmout + %ISD_DEFAULT% + Number + int + 10.0 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + + + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + AppBy + %ISD_DEFAULT% + String + nvarchar + 50 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + ExTraSalary + 1 + dbo + ExTraSalary + ExTraSalary_ + DatabasePersons1 + RowNum + Y + Y + Y + Y + BinaryChecksum + Persons + \ No newline at end of file diff --git a/App_Code/Data Access Layer/ExTraSalaryDefinition.vb b/App_Code/Data Access Layer/ExTraSalaryDefinition.vb new file mode 100644 index 0000000..fee3ec8 --- /dev/null +++ b/App_Code/Data Access Layer/ExTraSalaryDefinition.vb @@ -0,0 +1,316 @@ +Namespace Persons.Business +''' +''' Contains embedded schema and configuration data that is used by the +''' Persons.ExTraSalaryTable class +''' to initialize the class's TableDefinition. +''' +''' + +Public Class ExTraSalaryDefinition + +#Region "Definition (XML) for ExTraSalaryDefinition table" + 'Next 283 lines contain Table Definition (XML) for table "ExTraSalaryDefinition" + Private Shared _DefinitionString As String = "" +#End Region + + ''' + ''' Gets the embedded schema and configuration data for the + ''' + ''' class's TableDefinition. + ''' + ''' This function is only called once at runtime. + ''' An XML string. + Public Shared Function GetXMLString() As String + If _DefinitionString = "" Then + Dim tbf As System.Text.StringBuilder = New System.Text.StringBuilder() + tbf.Append("") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "ExtraSalaryId") + tbf.Append( "Extra Salary") + tbf.Append( "Number") + tbf.Append( "int") + tbf.Append( "10.0") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "FullName") + tbf.Append( "Full Name") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "50") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "AbbvrName") + tbf.Append( "Abbvr Name") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "35") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "OffAmout") + tbf.Append( "Off Amout") + tbf.Append( "Number") + tbf.Append( "int") + tbf.Append( "10.0") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "NonOffAmout") + tbf.Append( "Non Off Amout") + tbf.Append( "Number") + tbf.Append( "int") + tbf.Append( "10.0") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "PrivateAmout") + tbf.Append( "Private Amout") + tbf.Append( "Number") + tbf.Append( "int") + tbf.Append( "10.0") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "AppBy") + tbf.Append( "App By") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "50") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "ExTraSalary") + tbf.Append( "1") + tbf.Append( "dbo") + tbf.Append( "ExTraSalary") + tbf.Append( "ExTraSalary_") + tbf.Append( "DatabasePersons1") + tbf.Append( "RowNum") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "BinaryChecksum") + tbf.Append( "Persons") + tbf.Append("") + _DefinitionString = tbf.ToString() + + End If + Return _DefinitionString + End Function + +End Class +End Namespace diff --git a/App_Code/Data Access Layer/ExTraSalarySqlTable.vb b/App_Code/Data Access Layer/ExTraSalarySqlTable.vb new file mode 100644 index 0000000..c57dea2 --- /dev/null +++ b/App_Code/Data Access Layer/ExTraSalarySqlTable.vb @@ -0,0 +1,47 @@ +' This is a "safe" class, meaning that it is created once +' and never overwritten. Any custom code you add to this class +' will be preserved when you regenerate your application. +' +' Typical customizations that may be done in this class include +' - overriding base class methods + +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + +Namespace Persons.Data + + ''' + ''' Used by the class to access and/or modify the database. + ''' + ''' + ''' This class is not intended to be instantiated directly. To obtain an instance of this class, + ''' use the methods of the class. + ''' + ''' + + Public Class ExTraSalarySqlTable + Inherits BaseExTraSalarySqlTable + + 'The functions below may be overridden in order to implement your own + 'logic for creating, updating, deleting, and getting individual records, + 'or for running queries that return lists of records. + + ' Creates a new record. + ' Before calling this method, column values should be set using SetColumn(). + 'Public Overloads Overrides Function CreateRecord() As KeyValue + 'End Function + + ' Updates a record in the database. + ' Before calling this method, column values should be set using SetColumn(). + 'Protected Overrides Sub UpdateRecord() + 'End Sub + + ' Deletes a record defined by a primary key value. + 'Public Overloads Overrides Sub DeleteRecord(ByVal key As KeyValue) + 'End Sub + + ' Gets a record from the database. + 'Protected Overloads Overrides Sub GetRecord() + 'End Sub + End Class +End Namespace diff --git a/App_Code/Data Access Layer/Insignia.xml b/App_Code/Data Access Layer/Insignia.xml new file mode 100644 index 0000000..01cc1c7 --- /dev/null +++ b/App_Code/Data Access Layer/Insignia.xml @@ -0,0 +1,163 @@ + + + + + InsigniaId + %ISD_DEFAULT% + Number + smallint + 5.0 + + + + + Y + Y + + + + + Y + N + N + N + N + Y + Y + N + + + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + InsigniaAbbr + ชื่อย่อ + String + nvarchar + 9 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + InsigniaName + ชื่อเต็ม + String + nvarchar + 50 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + Insignia + 1 + dbo + Insignia + Insignia_ + DatabasePersons1 + RowNum + Y + Y + Y + Y + BinaryChecksum + Persons + \ No newline at end of file diff --git a/App_Code/Data Access Layer/InsigniaDefinition.vb b/App_Code/Data Access Layer/InsigniaDefinition.vb new file mode 100644 index 0000000..a6f9721 --- /dev/null +++ b/App_Code/Data Access Layer/InsigniaDefinition.vb @@ -0,0 +1,164 @@ +Namespace Persons.Business +''' +''' Contains embedded schema and configuration data that is used by the +''' Persons.InsigniaTable class +''' to initialize the class's TableDefinition. +''' +''' + +Public Class InsigniaDefinition + +#Region "Definition (XML) for InsigniaDefinition table" + 'Next 131 lines contain Table Definition (XML) for table "InsigniaDefinition" + Private Shared _DefinitionString As String = "" +#End Region + + ''' + ''' Gets the embedded schema and configuration data for the + ''' + ''' class's TableDefinition. + ''' + ''' This function is only called once at runtime. + ''' An XML string. + Public Shared Function GetXMLString() As String + If _DefinitionString = "" Then + Dim tbf As System.Text.StringBuilder = New System.Text.StringBuilder() + tbf.Append("") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "InsigniaId") + tbf.Append( "Insignia") + tbf.Append( "Number") + tbf.Append( "smallint") + tbf.Append( "5.0") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "InsigniaAbbr") + tbf.Append( "ชื่อย่อ") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "9") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "InsigniaName") + tbf.Append( "ชื่อเต็ม") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "50") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Insignia") + tbf.Append( "1") + tbf.Append( "dbo") + tbf.Append( "Insignia") + tbf.Append( "Insignia_") + tbf.Append( "DatabasePersons1") + tbf.Append( "RowNum") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "BinaryChecksum") + tbf.Append( "Persons") + tbf.Append("") + _DefinitionString = tbf.ToString() + + End If + Return _DefinitionString + End Function + +End Class +End Namespace diff --git a/App_Code/Data Access Layer/InsigniaSqlTable.vb b/App_Code/Data Access Layer/InsigniaSqlTable.vb new file mode 100644 index 0000000..7e45a5b --- /dev/null +++ b/App_Code/Data Access Layer/InsigniaSqlTable.vb @@ -0,0 +1,47 @@ +' This is a "safe" class, meaning that it is created once +' and never overwritten. Any custom code you add to this class +' will be preserved when you regenerate your application. +' +' Typical customizations that may be done in this class include +' - overriding base class methods + +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + +Namespace Persons.Data + + ''' + ''' Used by the class to access and/or modify the database. + ''' + ''' + ''' This class is not intended to be instantiated directly. To obtain an instance of this class, + ''' use the methods of the class. + ''' + ''' + + Public Class InsigniaSqlTable + Inherits BaseInsigniaSqlTable + + 'The functions below may be overridden in order to implement your own + 'logic for creating, updating, deleting, and getting individual records, + 'or for running queries that return lists of records. + + ' Creates a new record. + ' Before calling this method, column values should be set using SetColumn(). + 'Public Overloads Overrides Function CreateRecord() As KeyValue + 'End Function + + ' Updates a record in the database. + ' Before calling this method, column values should be set using SetColumn(). + 'Protected Overrides Sub UpdateRecord() + 'End Sub + + ' Deletes a record defined by a primary key value. + 'Public Overloads Overrides Sub DeleteRecord(ByVal key As KeyValue) + 'End Sub + + ' Gets a record from the database. + 'Protected Overloads Overrides Sub GetRecord() + 'End Sub + End Class +End Namespace diff --git a/App_Code/Data Access Layer/Language.xml b/App_Code/Data Access Layer/Language.xml new file mode 100644 index 0000000..0e730c6 --- /dev/null +++ b/App_Code/Data Access Layer/Language.xml @@ -0,0 +1,115 @@ + + + + + LanguageId + %ISD_DEFAULT% + Number + int + 10.0 + + + + + Y + Y + + + + + Y + N + N + N + N + Y + Y + N + + + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + Language + ภาษา + String + nvarchar + 50 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + Language + 1 + dbo + Language + Language_ + DatabasePersons1 + RowNum + Y + Y + Y + Y + BinaryChecksum + Persons + \ No newline at end of file diff --git a/App_Code/Data Access Layer/LanguageDefinition.vb b/App_Code/Data Access Layer/LanguageDefinition.vb new file mode 100644 index 0000000..09f7134 --- /dev/null +++ b/App_Code/Data Access Layer/LanguageDefinition.vb @@ -0,0 +1,126 @@ +Namespace Persons.Business +''' +''' Contains embedded schema and configuration data that is used by the +''' Persons.LanguageTable class +''' to initialize the class's TableDefinition. +''' +''' + +Public Class LanguageDefinition + +#Region "Definition (XML) for LanguageDefinition table" + 'Next 93 lines contain Table Definition (XML) for table "LanguageDefinition" + Private Shared _DefinitionString As String = "" +#End Region + + ''' + ''' Gets the embedded schema and configuration data for the + ''' + ''' class's TableDefinition. + ''' + ''' This function is only called once at runtime. + ''' An XML string. + Public Shared Function GetXMLString() As String + If _DefinitionString = "" Then + Dim tbf As System.Text.StringBuilder = New System.Text.StringBuilder() + tbf.Append("") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "LanguageId") + tbf.Append( "Language") + tbf.Append( "Number") + tbf.Append( "int") + tbf.Append( "10.0") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Language") + tbf.Append( "ภาษา") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "50") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Language") + tbf.Append( "1") + tbf.Append( "dbo") + tbf.Append( "Language") + tbf.Append( "Language_") + tbf.Append( "DatabasePersons1") + tbf.Append( "RowNum") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "BinaryChecksum") + tbf.Append( "Persons") + tbf.Append("") + _DefinitionString = tbf.ToString() + + End If + Return _DefinitionString + End Function + +End Class +End Namespace diff --git a/App_Code/Data Access Layer/LanguageSqlTable.vb b/App_Code/Data Access Layer/LanguageSqlTable.vb new file mode 100644 index 0000000..3912d1b --- /dev/null +++ b/App_Code/Data Access Layer/LanguageSqlTable.vb @@ -0,0 +1,47 @@ +' This is a "safe" class, meaning that it is created once +' and never overwritten. Any custom code you add to this class +' will be preserved when you regenerate your application. +' +' Typical customizations that may be done in this class include +' - overriding base class methods + +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + +Namespace Persons.Data + + ''' + ''' Used by the class to access and/or modify the database. + ''' + ''' + ''' This class is not intended to be instantiated directly. To obtain an instance of this class, + ''' use the methods of the class. + ''' + ''' + + Public Class LanguageSqlTable + Inherits BaseLanguageSqlTable + + 'The functions below may be overridden in order to implement your own + 'logic for creating, updating, deleting, and getting individual records, + 'or for running queries that return lists of records. + + ' Creates a new record. + ' Before calling this method, column values should be set using SetColumn(). + 'Public Overloads Overrides Function CreateRecord() As KeyValue + 'End Function + + ' Updates a record in the database. + ' Before calling this method, column values should be set using SetColumn(). + 'Protected Overrides Sub UpdateRecord() + 'End Sub + + ' Deletes a record defined by a primary key value. + 'Public Overloads Overrides Sub DeleteRecord(ByVal key As KeyValue) + 'End Sub + + ' Gets a record from the database. + 'Protected Overloads Overrides Sub GetRecord() + 'End Sub + End Class +End Namespace diff --git a/App_Code/Data Access Layer/PersonRelative.xml b/App_Code/Data Access Layer/PersonRelative.xml new file mode 100644 index 0000000..b0ea53c --- /dev/null +++ b/App_Code/Data Access Layer/PersonRelative.xml @@ -0,0 +1,1248 @@ + + + + + RelativeId + %ISD_DEFAULT% + Number + int + 10.0 + + + + + Y + Y + + + + + Y + N + Y + Y + Y + N + Y + N + + + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + PersonalId + %ISD_DEFAULT% + String + nvarchar + 13 + + + + + N + N + + + + + N + N + N + N + N + Y + Y + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + + FK_PersonRelative_PersonalId + PersonalId + dbo + PersonalId + PersonalName + Explicit + + Y + N + N + N + N + N + N + + + + + + + + + + + + + RPreName + คำนำหน้า + String + nvarchar + 50 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + RFirstName + ชื่อ + String + nvarchar + 50 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + RLastName + นามสกุล + String + nvarchar + 50 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + ROrLastName + นามสกุลเดิม + String + nvarchar + 50 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + FName + ชื่อบิดา + String + nvarchar + 50 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + FLastName + นามสกุล + String + nvarchar + 50 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + MName + ชื่อมารดา + String + nvarchar + 50 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + MLastName + นามสกุล + String + nvarchar + 50 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + MOrLastName + นามสกุลเดิม + String + nvarchar + 50 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + ROrigin + เชื่อชาติ + String + nvarchar + 50 + ไทย + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + Y + + + + + + + + + + + + + RNationality + สัญชาติ + String + nvarchar + 50 + ไทย + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + Y + + + + + + + + + + + + + RReligion + ศาสนา + String + nvarchar + 50 + พุทธ + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + Y + + + + + + + + + + + + + RAddress + ที่อยู่ + String + nvarchar + 50 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + RAmphur + อำเภอ + String + nvarchar + 50 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + RProvince + จังหวัด + String + nvarchar + 50 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + RBirthDate + วันเกิด + Date + datetime + + + + + + + N + N + + + d MMM yy + g + N + N + N + N + N + N + N + N + + + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + RelationId + เป็น + Number + int + 10.0 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + + + N + %ISD_DEFAULT% + + + Y + + FK_PersonRelative_relation + relation + dbo + RelationId + Relation + Explicit + + Y + N + N + N + N + N + N + + + + + + + + + + + + + Ref + หลักฐาน + String + nvarchar + 100 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + RefDate + ลงวันที่ + Date + datetime + + + + + + + N + N + + + d MMM yy + g + N + N + N + N + N + N + N + N + + + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + RStatus + สถานภาพ + Number + tinyint + 3.0 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + + + N + %ISD_DEFAULT% + + + Y + + FK_PersonRelative_RStatus + RStatus + dbo + RStatusId + RStatus + Explicit + + Y + N + N + N + N + N + N + + + + + + + + + + + + + RStatusRef + หลักฐาน + String + nvarchar + 100 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + RStatusDate + ลงวันที่ + Date + datetime + + + + + + + N + N + + + d MMM yy + g + N + N + N + N + N + N + N + N + + + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + RRemark + หมายเหตุ + String + nvarchar + 50 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + PersonRelative + 1 + dbo + PersonRelative + PersonRelative_ + DatabasePersons1 + RowNum + Y + Y + Y + Y + BinaryChecksum + Persons + \ No newline at end of file diff --git a/App_Code/Data Access Layer/PersonRelativeDefinition.vb b/App_Code/Data Access Layer/PersonRelativeDefinition.vb new file mode 100644 index 0000000..dc57f5a --- /dev/null +++ b/App_Code/Data Access Layer/PersonRelativeDefinition.vb @@ -0,0 +1,1027 @@ +Namespace Persons.Business +''' +''' Contains embedded schema and configuration data that is used by the +''' Persons.PersonRelativeTable class +''' to initialize the class's TableDefinition. +''' +''' + +Public Class PersonRelativeDefinition + +#Region "Definition (XML) for PersonRelativeDefinition table" + 'Next 994 lines contain Table Definition (XML) for table "PersonRelativeDefinition" + Private Shared _DefinitionString As String = "" +#End Region + + ''' + ''' Gets the embedded schema and configuration data for the + ''' + ''' class's TableDefinition. + ''' + ''' This function is only called once at runtime. + ''' An XML string. + Public Shared Function GetXMLString() As String + If _DefinitionString = "" Then + Dim tbf As System.Text.StringBuilder = New System.Text.StringBuilder() + tbf.Append("") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "RelativeId") + tbf.Append( "Relative") + tbf.Append( "Number") + tbf.Append( "int") + tbf.Append( "10.0") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "PersonalId") + tbf.Append( "Personal") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "13") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "") + tbf.Append( "FK_PersonRelative_PersonalId") + tbf.Append( "Persons.Business.PersonalIdTable, App_Code") + tbf.Append( "dbo") + tbf.Append( "PersonalId") + tbf.Append( "PersonalName") + tbf.Append( "Explicit") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "RPreName") + tbf.Append( "คำนำหน้า") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "50") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "RFirstName") + tbf.Append( "ชื่อ") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "50") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "RLastName") + tbf.Append( "นามสกุล") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "50") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "ROrLastName") + tbf.Append( "นามสกุลเดิม") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "50") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "FName") + tbf.Append( "ชื่อบิดา") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "50") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "FLastName") + tbf.Append( "นามสกุล") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "50") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "MName") + tbf.Append( "ชื่อมารดา") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "50") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "MLastName") + tbf.Append( "นามสกุล") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "50") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "MOrLastName") + tbf.Append( "นามสกุลเดิม") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "50") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "ROrigin") + tbf.Append( "เชื่อชาติ") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "50") + tbf.Append( "ไทย") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Y") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "RNationality") + tbf.Append( "สัญชาติ") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "50") + tbf.Append( "ไทย") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Y") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "RReligion") + tbf.Append( "ศาสนา") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "50") + tbf.Append( "พุทธ") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Y") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "RAddress") + tbf.Append( "ที่อยู่") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "50") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "RAmphur") + tbf.Append( "อำเภอ") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "50") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "RProvince") + tbf.Append( "จังหวัด") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "50") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "RBirthDate") + tbf.Append( "วันเกิด") + tbf.Append( "Date") + tbf.Append( "datetime") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "d MMM yy") + tbf.Append( "g") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "RelationId") + tbf.Append( "เป็น") + tbf.Append( "Number") + tbf.Append( "int") + tbf.Append( "10.0") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "") + tbf.Append( "FK_PersonRelative_relation") + tbf.Append( "Persons.Business.RelationTable, App_Code") + tbf.Append( "dbo") + tbf.Append( "RelationId") + tbf.Append( "Relation") + tbf.Append( "Explicit") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Ref") + tbf.Append( "หลักฐาน") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "100") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "RefDate") + tbf.Append( "ลงวันที่") + tbf.Append( "Date") + tbf.Append( "datetime") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "d MMM yy") + tbf.Append( "g") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "RStatus") + tbf.Append( "สถานภาพ") + tbf.Append( "Number") + tbf.Append( "tinyint") + tbf.Append( "3.0") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "") + tbf.Append( "FK_PersonRelative_RStatus") + tbf.Append( "Persons.Business.RStatusTable, App_Code") + tbf.Append( "dbo") + tbf.Append( "RStatusId") + tbf.Append( "RStatus") + tbf.Append( "Explicit") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "RStatusRef") + tbf.Append( "หลักฐาน") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "100") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "RStatusDate") + tbf.Append( "ลงวันที่") + tbf.Append( "Date") + tbf.Append( "datetime") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "d MMM yy") + tbf.Append( "g") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "RRemark") + tbf.Append( "หมายเหตุ") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "50") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "PersonRelative") + tbf.Append( "1") + tbf.Append( "dbo") + tbf.Append( "PersonRelative") + tbf.Append( "PersonRelative_") + tbf.Append( "DatabasePersons1") + tbf.Append( "RowNum") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "BinaryChecksum") + tbf.Append( "Persons") + tbf.Append("") + _DefinitionString = tbf.ToString() + + End If + Return _DefinitionString + End Function + +End Class +End Namespace diff --git a/App_Code/Data Access Layer/PersonRelativeSqlTable.vb b/App_Code/Data Access Layer/PersonRelativeSqlTable.vb new file mode 100644 index 0000000..b1cedcb --- /dev/null +++ b/App_Code/Data Access Layer/PersonRelativeSqlTable.vb @@ -0,0 +1,47 @@ +' This is a "safe" class, meaning that it is created once +' and never overwritten. Any custom code you add to this class +' will be preserved when you regenerate your application. +' +' Typical customizations that may be done in this class include +' - overriding base class methods + +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + +Namespace Persons.Data + + ''' + ''' Used by the class to access and/or modify the database. + ''' + ''' + ''' This class is not intended to be instantiated directly. To obtain an instance of this class, + ''' use the methods of the class. + ''' + ''' + + Public Class PersonRelativeSqlTable + Inherits BasePersonRelativeSqlTable + + 'The functions below may be overridden in order to implement your own + 'logic for creating, updating, deleting, and getting individual records, + 'or for running queries that return lists of records. + + ' Creates a new record. + ' Before calling this method, column values should be set using SetColumn(). + 'Public Overloads Overrides Function CreateRecord() As KeyValue + 'End Function + + ' Updates a record in the database. + ' Before calling this method, column values should be set using SetColumn(). + 'Protected Overrides Sub UpdateRecord() + 'End Sub + + ' Deletes a record defined by a primary key value. + 'Public Overloads Overrides Sub DeleteRecord(ByVal key As KeyValue) + 'End Sub + + ' Gets a record from the database. + 'Protected Overloads Overrides Sub GetRecord() + 'End Sub + End Class +End Namespace diff --git a/App_Code/Data Access Layer/PersonalDD.xml b/App_Code/Data Access Layer/PersonalDD.xml new file mode 100644 index 0000000..9d31fba --- /dev/null +++ b/App_Code/Data Access Layer/PersonalDD.xml @@ -0,0 +1,369 @@ + + + + + id + %ISD_DEFAULT% + Number + int + 10.0 + + + + + Y + Y + + + + + Y + N + Y + Y + Y + N + Y + N + + + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + PersonalId + %ISD_DEFAULT% + String + nvarchar + 13 + + + + + N + N + + + + + N + N + N + N + N + Y + Y + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + + FK_PersonalDD_PersonalId + PersonalId + dbo + PersonalId + PersonalName + Explicit + + Y + N + N + N + N + N + N + + + + + + + + + + + + + StartDate + ตั้งแต่ + Date + datetime + + + + + + + N + N + + + d MMM yy + g + N + N + N + N + N + N + N + N + + + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + EndDate + ถึง + Date + datetime + + + + + + + N + N + + + d MMM yy + g + N + N + N + N + N + N + N + N + + + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + Mission + ภารกิจ + String + nvarchar + 150 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + Ref + คำสั่ง + String + nvarchar + 100 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + RefDate + ลงวันที่ + Date + datetime + + + + + + + N + N + + + d MMM yy + g + N + N + N + N + N + N + N + N + + + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + PersonalDD + 4 + dbo + PersonalDD + PersonalDD_ + DatabasePersons1 + RowNum + Y + Y + Y + Y + BinaryChecksum + Persons + \ No newline at end of file diff --git a/App_Code/Data Access Layer/PersonalDDDefinition.vb b/App_Code/Data Access Layer/PersonalDDDefinition.vb new file mode 100644 index 0000000..013d1b0 --- /dev/null +++ b/App_Code/Data Access Layer/PersonalDDDefinition.vb @@ -0,0 +1,327 @@ +Namespace Persons.Business +''' +''' Contains embedded schema and configuration data that is used by the +''' Persons.PersonalDDTable class +''' to initialize the class's TableDefinition. +''' +''' + +Public Class PersonalDDDefinition + +#Region "Definition (XML) for PersonalDDDefinition table" + 'Next 294 lines contain Table Definition (XML) for table "PersonalDDDefinition" + Private Shared _DefinitionString As String = "" +#End Region + + ''' + ''' Gets the embedded schema and configuration data for the + ''' + ''' class's TableDefinition. + ''' + ''' This function is only called once at runtime. + ''' An XML string. + Public Shared Function GetXMLString() As String + If _DefinitionString = "" Then + Dim tbf As System.Text.StringBuilder = New System.Text.StringBuilder() + tbf.Append("") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "id") + tbf.Append( "ID") + tbf.Append( "Number") + tbf.Append( "int") + tbf.Append( "10.0") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "PersonalId") + tbf.Append( "Personal") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "13") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "") + tbf.Append( "FK_PersonalDD_PersonalId") + tbf.Append( "Persons.Business.PersonalIdTable, App_Code") + tbf.Append( "dbo") + tbf.Append( "PersonalId") + tbf.Append( "PersonalName") + tbf.Append( "Explicit") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "StartDate") + tbf.Append( "ตั้งแต่") + tbf.Append( "Date") + tbf.Append( "datetime") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "d MMM yy") + tbf.Append( "g") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "EndDate") + tbf.Append( "ถึง") + tbf.Append( "Date") + tbf.Append( "datetime") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "d MMM yy") + tbf.Append( "g") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Mission") + tbf.Append( "ภารกิจ") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "150") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Ref") + tbf.Append( "คำสั่ง") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "100") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "RefDate") + tbf.Append( "ลงวันที่") + tbf.Append( "Date") + tbf.Append( "datetime") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "d MMM yy") + tbf.Append( "g") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "PersonalDD") + tbf.Append( "4") + tbf.Append( "dbo") + tbf.Append( "PersonalDD") + tbf.Append( "PersonalDD_") + tbf.Append( "DatabasePersons1") + tbf.Append( "RowNum") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "BinaryChecksum") + tbf.Append( "Persons") + tbf.Append("") + _DefinitionString = tbf.ToString() + + End If + Return _DefinitionString + End Function + +End Class +End Namespace diff --git a/App_Code/Data Access Layer/PersonalDDSqlTable.vb b/App_Code/Data Access Layer/PersonalDDSqlTable.vb new file mode 100644 index 0000000..2cc79ac --- /dev/null +++ b/App_Code/Data Access Layer/PersonalDDSqlTable.vb @@ -0,0 +1,47 @@ +' This is a "safe" class, meaning that it is created once +' and never overwritten. Any custom code you add to this class +' will be preserved when you regenerate your application. +' +' Typical customizations that may be done in this class include +' - overriding base class methods + +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + +Namespace Persons.Data + + ''' + ''' Used by the class to access and/or modify the database. + ''' + ''' + ''' This class is not intended to be instantiated directly. To obtain an instance of this class, + ''' use the methods of the class. + ''' + ''' + + Public Class PersonalDDSqlTable + Inherits BasePersonalDDSqlTable + + 'The functions below may be overridden in order to implement your own + 'logic for creating, updating, deleting, and getting individual records, + 'or for running queries that return lists of records. + + ' Creates a new record. + ' Before calling this method, column values should be set using SetColumn(). + 'Public Overloads Overrides Function CreateRecord() As KeyValue + 'End Function + + ' Updates a record in the database. + ' Before calling this method, column values should be set using SetColumn(). + 'Protected Overrides Sub UpdateRecord() + 'End Sub + + ' Deletes a record defined by a primary key value. + 'Public Overloads Overrides Sub DeleteRecord(ByVal key As KeyValue) + 'End Sub + + ' Gets a record from the database. + 'Protected Overloads Overrides Sub GetRecord() + 'End Sub + End Class +End Namespace diff --git a/App_Code/Data Access Layer/PersonalDailyJob.xml b/App_Code/Data Access Layer/PersonalDailyJob.xml new file mode 100644 index 0000000..88ca810 --- /dev/null +++ b/App_Code/Data Access Layer/PersonalDailyJob.xml @@ -0,0 +1,326 @@ + + + + + id + %ISD_DEFAULT% + Number + int + 10.0 + + + + + Y + Y + + + + + Y + N + Y + Y + Y + N + Y + N + + + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + PersonalId + %ISD_DEFAULT% + String + nvarchar + 13 + + + + + N + N + + + + + N + N + N + N + N + Y + Y + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + + FK_PersonalDailyJob_PersonalId + PersonalId + dbo + PersonalId + PersonalName + Explicit + + Y + N + N + N + N + N + N + + + + + + + + + + + + + Job + %ISD_DEFAULT% + String + nvarchar + 255 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + AbsentId + %ISD_DEFAULT% + Number + tinyint + 3.0 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + + + N + %ISD_DEFAULT% + + + Y + + FK_PersonalDailyJob_Absent + Absent + dbo + AbsentId + Absent + Explicit + + Y + N + N + N + N + N + N + + + + + + + + + + + + + JobDate + %ISD_DEFAULT% + Date + datetime + + + + + + + N + N + + + g + g + N + N + N + N + N + N + N + N + + + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + Remark + %ISD_DEFAULT% + String + nvarchar + 50 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + PersonalDailyJob + 1 + dbo + PersonalDailyJob + PersonalDailyJob_ + DatabasePersons1 + RowNum + Y + Y + Y + Y + BinaryChecksum + Persons + \ No newline at end of file diff --git a/App_Code/Data Access Layer/PersonalDailyJobDefinition.vb b/App_Code/Data Access Layer/PersonalDailyJobDefinition.vb new file mode 100644 index 0000000..cfd6cce --- /dev/null +++ b/App_Code/Data Access Layer/PersonalDailyJobDefinition.vb @@ -0,0 +1,295 @@ +Namespace Persons.Business +''' +''' Contains embedded schema and configuration data that is used by the +''' Persons.PersonalDailyJobTable class +''' to initialize the class's TableDefinition. +''' +''' + +Public Class PersonalDailyJobDefinition + +#Region "Definition (XML) for PersonalDailyJobDefinition table" + 'Next 262 lines contain Table Definition (XML) for table "PersonalDailyJobDefinition" + Private Shared _DefinitionString As String = "" +#End Region + + ''' + ''' Gets the embedded schema and configuration data for the + ''' + ''' class's TableDefinition. + ''' + ''' This function is only called once at runtime. + ''' An XML string. + Public Shared Function GetXMLString() As String + If _DefinitionString = "" Then + Dim tbf As System.Text.StringBuilder = New System.Text.StringBuilder() + tbf.Append("") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "id") + tbf.Append( "ID") + tbf.Append( "Number") + tbf.Append( "int") + tbf.Append( "10.0") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "PersonalId") + tbf.Append( "Personal") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "13") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "") + tbf.Append( "FK_PersonalDailyJob_PersonalId") + tbf.Append( "Persons.Business.PersonalIdTable, App_Code") + tbf.Append( "dbo") + tbf.Append( "PersonalId") + tbf.Append( "PersonalName") + tbf.Append( "Explicit") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Job") + tbf.Append( "Job") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "255") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "AbsentId") + tbf.Append( "Absent") + tbf.Append( "Number") + tbf.Append( "tinyint") + tbf.Append( "3.0") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "") + tbf.Append( "FK_PersonalDailyJob_Absent") + tbf.Append( "Persons.Business.AbsentTable, App_Code") + tbf.Append( "dbo") + tbf.Append( "AbsentId") + tbf.Append( "Absent") + tbf.Append( "Explicit") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "JobDate") + tbf.Append( "Job Date") + tbf.Append( "Date") + tbf.Append( "datetime") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "g") + tbf.Append( "g") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Remark") + tbf.Append( "Remark") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "50") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "PersonalDailyJob") + tbf.Append( "1") + tbf.Append( "dbo") + tbf.Append( "PersonalDailyJob") + tbf.Append( "PersonalDailyJob_") + tbf.Append( "DatabasePersons1") + tbf.Append( "RowNum") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "BinaryChecksum") + tbf.Append( "Persons") + tbf.Append("") + _DefinitionString = tbf.ToString() + + End If + Return _DefinitionString + End Function + +End Class +End Namespace diff --git a/App_Code/Data Access Layer/PersonalDailyJobSqlTable.vb b/App_Code/Data Access Layer/PersonalDailyJobSqlTable.vb new file mode 100644 index 0000000..c9d9f95 --- /dev/null +++ b/App_Code/Data Access Layer/PersonalDailyJobSqlTable.vb @@ -0,0 +1,47 @@ +' This is a "safe" class, meaning that it is created once +' and never overwritten. Any custom code you add to this class +' will be preserved when you regenerate your application. +' +' Typical customizations that may be done in this class include +' - overriding base class methods + +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + +Namespace Persons.Data + + ''' + ''' Used by the class to access and/or modify the database. + ''' + ''' + ''' This class is not intended to be instantiated directly. To obtain an instance of this class, + ''' use the methods of the class. + ''' + ''' + + Public Class PersonalDailyJobSqlTable + Inherits BasePersonalDailyJobSqlTable + + 'The functions below may be overridden in order to implement your own + 'logic for creating, updating, deleting, and getting individual records, + 'or for running queries that return lists of records. + + ' Creates a new record. + ' Before calling this method, column values should be set using SetColumn(). + 'Public Overloads Overrides Function CreateRecord() As KeyValue + 'End Function + + ' Updates a record in the database. + ' Before calling this method, column values should be set using SetColumn(). + 'Protected Overrides Sub UpdateRecord() + 'End Sub + + ' Deletes a record defined by a primary key value. + 'Public Overloads Overrides Sub DeleteRecord(ByVal key As KeyValue) + 'End Sub + + ' Gets a record from the database. + 'Protected Overloads Overrides Sub GetRecord() + 'End Sub + End Class +End Namespace diff --git a/App_Code/Data Access Layer/PersonalEducation.xml b/App_Code/Data Access Layer/PersonalEducation.xml new file mode 100644 index 0000000..272e9b5 --- /dev/null +++ b/App_Code/Data Access Layer/PersonalEducation.xml @@ -0,0 +1,972 @@ + + + + + EducationId + %ISD_DEFAULT% + Number + int + 10.0 + + + + + Y + Y + + + + + Y + N + Y + Y + Y + N + Y + N + + + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + PersonalId + ชื่อ นามสกุล + String + nvarchar + 13 + + + + + N + N + notrim, + + + N + N + N + N + N + Y + Y + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + + FK_PersonalEducation_PersonalId + PersonalId + dbo + PersonalId + PersonalName + Explicit + + Y + N + N + N + N + N + N + + + + + + + + + + + + + StartDate + ตั้งแต่ + Date + datetime + + + + + + + N + N + + + d MMM yy + g + N + N + N + N + N + N + N + N + + + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + EndDate + ถึง + Date + datetime + + + + + + + N + N + + + d MMM yy + g + N + N + N + N + N + N + N + N + + + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + Course + หลักสูตร + String + nvarchar + 60 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + CourseAbbr + คุณวุฒิ(สาขา) + String + nvarchar + 50 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + Institue + สถาบันการศึกษา + String + nvarchar + 60 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + Facultry + สาขาวิชา + String + nvarchar + 60 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + LevelId + ระดับการศึกษา + Number + smallint + 5.0 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + + + N + %ISD_DEFAULT% + + + Y + + FK_PersonalEducation_Education + Education + dbo + EducationId + Level + Explicit + + Y + N + N + N + N + N + N + + + + + + + + + + + + + EdYear + ปีที่จบการศึกษา + String + nvarchar + 4 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + EducationPeriod + ก่อน/หลัง รับราชการ + Number + tinyint + 3.0 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + + + N + %ISD_DEFAULT% + + + Y + Y + N + N + N + N + N + N + + + + + + + + + + + + VFK_PersonalEducation_EducationPeriod_1 + EducationPeriod + dbo + PeriodId + Period + Implicit + + + + EducationType + รร.ทหาร/พลเรือน + Number + tinyint + 3.0 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + + + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + COUNTRY + ประเทศ + Number + smallint + 5.0 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + + + N + %ISD_DEFAULT% + + + Y + + FK_PersonalEducation_Country + Country + dbo + CountryId + Country + Explicit + + Y + N + N + N + N + N + N + + + + + + + + + + + + + CourseNo + รุ่นที่ + String + nvarchar + 3 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + ScoreNo + ได้ลำดับที่ + String + nvarchar + 3 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + NoAll + จากทั้งหมด + String + nvarchar + 3 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + Score + ระดับคะแนน + String + nvarchar + 5 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + Command + คำสั้ง + String + nvarchar + 50 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + CommandDate + ลงวันที่ + Date + datetime + + + + + + + N + N + + + d MMM yy + g + N + N + N + N + N + N + N + N + + + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + PersonalEducation + 3 + dbo + PersonalEducation + PersonalEducation_ + DatabasePersons1 + RowNum + Y + Y + Y + Y + BinaryChecksum + Persons + \ No newline at end of file diff --git a/App_Code/Data Access Layer/PersonalEducationDefinition.vb b/App_Code/Data Access Layer/PersonalEducationDefinition.vb new file mode 100644 index 0000000..2fe5927 --- /dev/null +++ b/App_Code/Data Access Layer/PersonalEducationDefinition.vb @@ -0,0 +1,807 @@ +Namespace Persons.Business +''' +''' Contains embedded schema and configuration data that is used by the +''' Persons.PersonalEducationTable class +''' to initialize the class's TableDefinition. +''' +''' + +Public Class PersonalEducationDefinition + +#Region "Definition (XML) for PersonalEducationDefinition table" + 'Next 774 lines contain Table Definition (XML) for table "PersonalEducationDefinition" + Private Shared _DefinitionString As String = "" +#End Region + + ''' + ''' Gets the embedded schema and configuration data for the + ''' + ''' class's TableDefinition. + ''' + ''' This function is only called once at runtime. + ''' An XML string. + Public Shared Function GetXMLString() As String + If _DefinitionString = "" Then + Dim tbf As System.Text.StringBuilder = New System.Text.StringBuilder() + tbf.Append("") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "EducationId") + tbf.Append( "Education") + tbf.Append( "Number") + tbf.Append( "int") + tbf.Append( "10.0") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "PersonalId") + tbf.Append( "ชื่อ นามสกุล") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "13") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "notrim,") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "") + tbf.Append( "FK_PersonalEducation_PersonalId") + tbf.Append( "Persons.Business.PersonalIdTable, App_Code") + tbf.Append( "dbo") + tbf.Append( "PersonalId") + tbf.Append( "PersonalName") + tbf.Append( "Explicit") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "StartDate") + tbf.Append( "ตั้งแต่") + tbf.Append( "Date") + tbf.Append( "datetime") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "d MMM yy") + tbf.Append( "g") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "EndDate") + tbf.Append( "ถึง") + tbf.Append( "Date") + tbf.Append( "datetime") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "d MMM yy") + tbf.Append( "g") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Course") + tbf.Append( "หลักสูตร") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "60") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "CourseAbbr") + tbf.Append( "คุณวุฒิ(สาขา)") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "50") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Institue") + tbf.Append( "สถาบันการศึกษา") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "60") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Facultry") + tbf.Append( "สาขาวิชา") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "60") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "LevelId") + tbf.Append( "ระดับการศึกษา") + tbf.Append( "Number") + tbf.Append( "smallint") + tbf.Append( "5.0") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "") + tbf.Append( "FK_PersonalEducation_Education") + tbf.Append( "Persons.Business.EducationTable, App_Code") + tbf.Append( "dbo") + tbf.Append( "EducationId") + tbf.Append( "Level") + tbf.Append( "Explicit") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "EdYear") + tbf.Append( "ปีที่จบการศึกษา") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "4") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "EducationPeriod") + tbf.Append( "ก่อน/หลัง รับราชการ") + tbf.Append( "Number") + tbf.Append( "tinyint") + tbf.Append( "3.0") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "VFK_PersonalEducation_EducationPeriod_1") + tbf.Append( "Persons.Business.EducationPeriodTable, App_Code") + tbf.Append( "dbo") + tbf.Append( "PeriodId") + tbf.Append( "Period") + tbf.Append( "Implicit") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "EducationType") + tbf.Append( "รร.ทหาร/พลเรือน") + tbf.Append( "Number") + tbf.Append( "tinyint") + tbf.Append( "3.0") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "COUNTRY") + tbf.Append( "ประเทศ") + tbf.Append( "Number") + tbf.Append( "smallint") + tbf.Append( "5.0") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "") + tbf.Append( "FK_PersonalEducation_Country") + tbf.Append( "Persons.Business.CountryTable, App_Code") + tbf.Append( "dbo") + tbf.Append( "CountryId") + tbf.Append( "Country") + tbf.Append( "Explicit") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "CourseNo") + tbf.Append( "รุ่นที่") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "3") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "ScoreNo") + tbf.Append( "ได้ลำดับที่") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "3") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "NoAll") + tbf.Append( "จากทั้งหมด") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "3") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Score") + tbf.Append( "ระดับคะแนน") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "5") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Command") + tbf.Append( "คำสั้ง") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "50") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "CommandDate") + tbf.Append( "ลงวันที่") + tbf.Append( "Date") + tbf.Append( "datetime") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "d MMM yy") + tbf.Append( "g") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "PersonalEducation") + tbf.Append( "3") + tbf.Append( "dbo") + tbf.Append( "PersonalEducation") + tbf.Append( "PersonalEducation_") + tbf.Append( "DatabasePersons1") + tbf.Append( "RowNum") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "BinaryChecksum") + tbf.Append( "Persons") + tbf.Append("") + _DefinitionString = tbf.ToString() + + End If + Return _DefinitionString + End Function + +End Class +End Namespace diff --git a/App_Code/Data Access Layer/PersonalEducationSqlTable.vb b/App_Code/Data Access Layer/PersonalEducationSqlTable.vb new file mode 100644 index 0000000..1fd5828 --- /dev/null +++ b/App_Code/Data Access Layer/PersonalEducationSqlTable.vb @@ -0,0 +1,47 @@ +' This is a "safe" class, meaning that it is created once +' and never overwritten. Any custom code you add to this class +' will be preserved when you regenerate your application. +' +' Typical customizations that may be done in this class include +' - overriding base class methods + +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + +Namespace Persons.Data + + ''' + ''' Used by the class to access and/or modify the database. + ''' + ''' + ''' This class is not intended to be instantiated directly. To obtain an instance of this class, + ''' use the methods of the class. + ''' + ''' + + Public Class PersonalEducationSqlTable + Inherits BasePersonalEducationSqlTable + + 'The functions below may be overridden in order to implement your own + 'logic for creating, updating, deleting, and getting individual records, + 'or for running queries that return lists of records. + + ' Creates a new record. + ' Before calling this method, column values should be set using SetColumn(). + 'Public Overloads Overrides Function CreateRecord() As KeyValue + 'End Function + + ' Updates a record in the database. + ' Before calling this method, column values should be set using SetColumn(). + 'Protected Overrides Sub UpdateRecord() + 'End Sub + + ' Deletes a record defined by a primary key value. + 'Public Overloads Overrides Sub DeleteRecord(ByVal key As KeyValue) + 'End Sub + + ' Gets a record from the database. + 'Protected Overloads Overrides Sub GetRecord() + 'End Sub + End Class +End Namespace diff --git a/App_Code/Data Access Layer/PersonalExtWork.xml b/App_Code/Data Access Layer/PersonalExtWork.xml new file mode 100644 index 0000000..cfa4b73 --- /dev/null +++ b/App_Code/Data Access Layer/PersonalExtWork.xml @@ -0,0 +1,459 @@ + + + + + id + %ISD_DEFAULT% + Number + int + 10.0 + + + + + Y + Y + + + + + Y + N + Y + Y + Y + N + Y + N + + + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + PersonalId + %ISD_DEFAULT% + String + nvarchar + 13 + + + + + N + N + + + + + N + N + N + N + N + Y + Y + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + Y + N + N + N + N + N + N + + + + + + + + + + + + + Description + รายการปฏิบัติงาน + String + nvarchar + 255 + + + + + N + N + + + + + N + N + N + N + N + Y + Y + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + Place + ที่ + String + nvarchar + 255 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + Active + งานปัจจุบัน + Boolean + bit + + + + + + + N + N + + + + + N + N + N + N + N + N + N + N + + + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + BeginDate + ตั้งแต่วันที่ + Date + datetime + + + + + + + N + N + + + d MMM yy + d + N + N + N + N + N + N + N + N + + + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + EndDate + ถึงวันที่ + Date + datetime + + + + + + + N + N + + + d MMM yy + d + N + N + N + N + N + N + N + N + + + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + Command + คำสั่ง + String + nvarchar + 255 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + CommandDate + ลงวันที่ + Date + date + + + + + + + N + N + + + d MMM yy + d + N + N + N + N + N + N + N + N + + + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + PersonalExtWork + 4 + dbo + PersonalExtWork + PersonalExtWork_ + DatabasePersons1 + RowNum + Y + Y + Y + Y + BinaryChecksum + Persons + \ No newline at end of file diff --git a/App_Code/Data Access Layer/PersonalExtWorkDefinition.vb b/App_Code/Data Access Layer/PersonalExtWorkDefinition.vb new file mode 100644 index 0000000..69a122c --- /dev/null +++ b/App_Code/Data Access Layer/PersonalExtWorkDefinition.vb @@ -0,0 +1,395 @@ +Namespace Persons.Business +''' +''' Contains embedded schema and configuration data that is used by the +''' Persons.PersonalExtWorkTable class +''' to initialize the class's TableDefinition. +''' +''' + +Public Class PersonalExtWorkDefinition + +#Region "Definition (XML) for PersonalExtWorkDefinition table" + 'Next 362 lines contain Table Definition (XML) for table "PersonalExtWorkDefinition" + Private Shared _DefinitionString As String = "" +#End Region + + ''' + ''' Gets the embedded schema and configuration data for the + ''' + ''' class's TableDefinition. + ''' + ''' This function is only called once at runtime. + ''' An XML string. + Public Shared Function GetXMLString() As String + If _DefinitionString = "" Then + Dim tbf As System.Text.StringBuilder = New System.Text.StringBuilder() + tbf.Append("") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "id") + tbf.Append( "ID") + tbf.Append( "Number") + tbf.Append( "int") + tbf.Append( "10.0") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "PersonalId") + tbf.Append( "Personal") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "13") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Description") + tbf.Append( "รายการปฏิบัติงาน") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "255") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Place") + tbf.Append( "ที่") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "255") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Active") + tbf.Append( "งานปัจจุบัน") + tbf.Append( "Boolean") + tbf.Append( "bit") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "BeginDate") + tbf.Append( "ตั้งแต่วันที่") + tbf.Append( "Date") + tbf.Append( "datetime") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "d MMM yy") + tbf.Append( "d") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "EndDate") + tbf.Append( "ถึงวันที่") + tbf.Append( "Date") + tbf.Append( "datetime") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "d MMM yy") + tbf.Append( "d") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Command") + tbf.Append( "คำสั่ง") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "255") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "CommandDate") + tbf.Append( "ลงวันที่") + tbf.Append( "Date") + tbf.Append( "date") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "d MMM yy") + tbf.Append( "d") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "PersonalExtWork") + tbf.Append( "4") + tbf.Append( "dbo") + tbf.Append( "PersonalExtWork") + tbf.Append( "PersonalExtWork_") + tbf.Append( "DatabasePersons1") + tbf.Append( "RowNum") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "BinaryChecksum") + tbf.Append( "Persons") + tbf.Append("") + _DefinitionString = tbf.ToString() + + End If + Return _DefinitionString + End Function + +End Class +End Namespace diff --git a/App_Code/Data Access Layer/PersonalExtWorkSqlTable.vb b/App_Code/Data Access Layer/PersonalExtWorkSqlTable.vb new file mode 100644 index 0000000..377fd11 --- /dev/null +++ b/App_Code/Data Access Layer/PersonalExtWorkSqlTable.vb @@ -0,0 +1,47 @@ +' This is a "safe" class, meaning that it is created once +' and never overwritten. Any custom code you add to this class +' will be preserved when you regenerate your application. +' +' Typical customizations that may be done in this class include +' - overriding base class methods + +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + +Namespace Persons.Data + + ''' + ''' Used by the class to access and/or modify the database. + ''' + ''' + ''' This class is not intended to be instantiated directly. To obtain an instance of this class, + ''' use the methods of the class. + ''' + ''' + + Public Class PersonalExtWorkSqlTable + Inherits BasePersonalExtWorkSqlTable + + 'The functions below may be overridden in order to implement your own + 'logic for creating, updating, deleting, and getting individual records, + 'or for running queries that return lists of records. + + ' Creates a new record. + ' Before calling this method, column values should be set using SetColumn(). + 'Public Overloads Overrides Function CreateRecord() As KeyValue + 'End Function + + ' Updates a record in the database. + ' Before calling this method, column values should be set using SetColumn(). + 'Protected Overrides Sub UpdateRecord() + 'End Sub + + ' Deletes a record defined by a primary key value. + 'Public Overloads Overrides Sub DeleteRecord(ByVal key As KeyValue) + 'End Sub + + ' Gets a record from the database. + 'Protected Overloads Overrides Sub GetRecord() + 'End Sub + End Class +End Namespace diff --git a/App_Code/Data Access Layer/PersonalExtraSalary.xml b/App_Code/Data Access Layer/PersonalExtraSalary.xml new file mode 100644 index 0000000..9f8aec6 --- /dev/null +++ b/App_Code/Data Access Layer/PersonalExtraSalary.xml @@ -0,0 +1,377 @@ + + + + + Id + %ISD_DEFAULT% + Number + int + 10.0 + + + + + Y + Y + + + + + Y + N + Y + Y + Y + N + Y + N + + + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + PersonalId + %ISD_DEFAULT% + String + nvarchar + 13 + + + + + N + N + + + + + N + N + N + N + N + Y + Y + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + + FK_PersonalExtraSalary_PersonalId + PersonalId + dbo + PersonalId + PersonalName + Explicit + + Y + N + N + N + N + N + N + + + + + + + + + + + + + ExtraSalaryId + รายการ + Number + int + 10.0 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + + + N + %ISD_DEFAULT% + + + Y + + FK_PersonalExtraSalary_ExTraSalary + ExTraSalary + dbo + ExtraSalaryId + FullName + Explicit + + Y + N + N + N + N + N + N + + + + + + + + + + + + + Amout + จำนวนเงิน + Number + int + 10.0 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + + + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + StartDate + ตั้งแต่ + Date + datetime + + + + + + + N + N + + + g + g + N + N + N + N + N + N + N + N + + + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + Ref + คำสั่ง + String + nvarchar + 50 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + RefDate + ลงวันที่ + Date + datetime + + + + + + + N + N + + + g + g + N + N + N + N + N + N + N + N + + + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + PersonalExtraSalary + 1 + dbo + PersonalExtraSalary + PersonalExtraSalary_ + DatabasePersons1 + RowNum + Y + Y + Y + Y + BinaryChecksum + Persons + \ No newline at end of file diff --git a/App_Code/Data Access Layer/PersonalExtraSalaryDefinition.vb b/App_Code/Data Access Layer/PersonalExtraSalaryDefinition.vb new file mode 100644 index 0000000..3e7ab15 --- /dev/null +++ b/App_Code/Data Access Layer/PersonalExtraSalaryDefinition.vb @@ -0,0 +1,334 @@ +Namespace Persons.Business +''' +''' Contains embedded schema and configuration data that is used by the +''' Persons.PersonalExtraSalaryTable class +''' to initialize the class's TableDefinition. +''' +''' + +Public Class PersonalExtraSalaryDefinition + +#Region "Definition (XML) for PersonalExtraSalaryDefinition table" + 'Next 301 lines contain Table Definition (XML) for table "PersonalExtraSalaryDefinition" + Private Shared _DefinitionString As String = "" +#End Region + + ''' + ''' Gets the embedded schema and configuration data for the + ''' + ''' class's TableDefinition. + ''' + ''' This function is only called once at runtime. + ''' An XML string. + Public Shared Function GetXMLString() As String + If _DefinitionString = "" Then + Dim tbf As System.Text.StringBuilder = New System.Text.StringBuilder() + tbf.Append("") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Id") + tbf.Append( "Id") + tbf.Append( "Number") + tbf.Append( "int") + tbf.Append( "10.0") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "PersonalId") + tbf.Append( "Personal") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "13") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "") + tbf.Append( "FK_PersonalExtraSalary_PersonalId") + tbf.Append( "Persons.Business.PersonalIdTable, App_Code") + tbf.Append( "dbo") + tbf.Append( "PersonalId") + tbf.Append( "PersonalName") + tbf.Append( "Explicit") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "ExtraSalaryId") + tbf.Append( "รายการ") + tbf.Append( "Number") + tbf.Append( "int") + tbf.Append( "10.0") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "") + tbf.Append( "FK_PersonalExtraSalary_ExTraSalary") + tbf.Append( "Persons.Business.ExTraSalaryTable, App_Code") + tbf.Append( "dbo") + tbf.Append( "ExtraSalaryId") + tbf.Append( "FullName") + tbf.Append( "Explicit") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Amout") + tbf.Append( "จำนวนเงิน") + tbf.Append( "Number") + tbf.Append( "int") + tbf.Append( "10.0") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "StartDate") + tbf.Append( "ตั้งแต่") + tbf.Append( "Date") + tbf.Append( "datetime") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "g") + tbf.Append( "g") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Ref") + tbf.Append( "คำสั่ง") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "50") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "RefDate") + tbf.Append( "ลงวันที่") + tbf.Append( "Date") + tbf.Append( "datetime") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "g") + tbf.Append( "g") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "PersonalExtraSalary") + tbf.Append( "1") + tbf.Append( "dbo") + tbf.Append( "PersonalExtraSalary") + tbf.Append( "PersonalExtraSalary_") + tbf.Append( "DatabasePersons1") + tbf.Append( "RowNum") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "BinaryChecksum") + tbf.Append( "Persons") + tbf.Append("") + _DefinitionString = tbf.ToString() + + End If + Return _DefinitionString + End Function + +End Class +End Namespace diff --git a/App_Code/Data Access Layer/PersonalExtraSalarySqlTable.vb b/App_Code/Data Access Layer/PersonalExtraSalarySqlTable.vb new file mode 100644 index 0000000..194201b --- /dev/null +++ b/App_Code/Data Access Layer/PersonalExtraSalarySqlTable.vb @@ -0,0 +1,47 @@ +' This is a "safe" class, meaning that it is created once +' and never overwritten. Any custom code you add to this class +' will be preserved when you regenerate your application. +' +' Typical customizations that may be done in this class include +' - overriding base class methods + +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + +Namespace Persons.Data + + ''' + ''' Used by the class to access and/or modify the database. + ''' + ''' + ''' This class is not intended to be instantiated directly. To obtain an instance of this class, + ''' use the methods of the class. + ''' + ''' + + Public Class PersonalExtraSalarySqlTable + Inherits BasePersonalExtraSalarySqlTable + + 'The functions below may be overridden in order to implement your own + 'logic for creating, updating, deleting, and getting individual records, + 'or for running queries that return lists of records. + + ' Creates a new record. + ' Before calling this method, column values should be set using SetColumn(). + 'Public Overloads Overrides Function CreateRecord() As KeyValue + 'End Function + + ' Updates a record in the database. + ' Before calling this method, column values should be set using SetColumn(). + 'Protected Overrides Sub UpdateRecord() + 'End Sub + + ' Deletes a record defined by a primary key value. + 'Public Overloads Overrides Sub DeleteRecord(ByVal key As KeyValue) + 'End Sub + + ' Gets a record from the database. + 'Protected Overloads Overrides Sub GetRecord() + 'End Sub + End Class +End Namespace diff --git a/App_Code/Data Access Layer/PersonalId.xml b/App_Code/Data Access Layer/PersonalId.xml new file mode 100644 index 0000000..d67910a --- /dev/null +++ b/App_Code/Data Access Layer/PersonalId.xml @@ -0,0 +1,1977 @@ + + + + + PersonalId + เลขประจำตัวประชาชน + String + nvarchar + 13 + + + + + Y + Y + notrim, + + + Y + N + N + N + N + Y + Y + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + SectionId + ส่วนราชการ + Number + smallint + 5.0 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + + + N + %ISD_DEFAULT% + + + Y + Y + N + N + N + N + N + N + + + + + + + + + + + + VFK_PersonalId_SectionId_1 + Section + dbo + SectionId + SectionName + Implicit + + + + MId + เลขประจำตัวทหาร + String + nvarchar + 10 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + TId + หมายเลขผู้เสียภาษี + String + nvarchar + 10 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + ArmyId + เหล่าทัพ + Number + tinyint + 3.0 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + + + N + %ISD_DEFAULT% + + + Y + Y + N + N + N + N + N + N + + + + + + + + + + + + VFK_PersonalId_ArmyId_1 + Army + dbo + ArmyId + Army + Implicit + + + + RankId + ยศ/คำนำหน้า + Number + int + 10.0 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + + + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + PersonalName + ชื่อ + String + nvarchar + 50 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + PersonalLastName + นามสกุล + String + nvarchar + 50 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + Sex + เพศ + Number + smallint + 5.0 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + + + N + %ISD_DEFAULT% + + + Y + Y + N + N + N + N + N + N + + + + + + + + + + + + VFK_PersonalId_Sex_1 + Sex + dbo + SexId + Sex + Implicit + + + + BirthDate + วันเกิด + Date + datetime + + + + + + + N + N + + + d MMM yy + g + N + N + N + N + N + N + N + N + + + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + PlaceOfBirth + สถานที่เกิด + String + nvarchar + 255 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + 255 + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + BAmphur + อำเภอ + String + nvarchar + 50 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + BProvince + จังหวัด + String + nvarchar + 50 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + BloodId + หมู่โลหิต + Number + tinyint + 3.0 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + + + N + %ISD_DEFAULT% + + + Y + Y + N + N + N + N + N + N + + + + + + + + + + + + VFK_PersonalId_BloodId_1 + BloodId + dbo + BloodId + BloodName + Implicit + + + + Origin + เชื้อชาติ + String + nvarchar + 50 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + Nationality + สัญชาติ + String + nvarchar + 50 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + Religion + ศาสนา + String + nvarchar + 50 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + ArmId + เหล่า + Number + int + 10.0 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + + + N + %ISD_DEFAULT% + + + Y + Y + N + N + N + N + N + N + + + + + + + + + + + + VFK_PersonalId_ArmId_1 + Arm + dbo + ArmId + ArmSName + Implicit + + + + RegDate + วันขึ้นทะเบียนทหาร + Date + datetime + + + + + + + N + N + + + d MMM yy + g + N + N + N + N + N + N + N + N + + + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + RegNo1 + ทะเบียนทหาร(แถวบน) + String + nvarchar + 10 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + RegNo2 + ทะเบียนทหาร(แถวล่าง) + String + nvarchar + 10 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + OfficerDate + วันรับราชการ + Date + datetime + + + + + + + N + N + + + d MMM yy + d + N + N + N + N + N + N + N + N + + + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + Born + กำเนิด + String + nvarchar + 25 + + + + + N + N + notrim, + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + Y + N + N + N + N + N + N + + + + + + + + + + + + VFK_PersonalId_Born_1 + Born + dbo + Born + BornDesc + Implicit + + + + CremateMemId + หมาเลขสมาชิกฌาปนกิจ + String + nvarchar + 50 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + ArmyWelfareMemId + หมายเลขสมาชิกสหกรณ์ + String + nvarchar + 50 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + StatusId + สถานะการรับราชการ + Number + tinyint + 3.0 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + + + N + %ISD_DEFAULT% + + + Y + Y + N + N + N + N + N + N + + + + + + + + + + + + VFK_PersonalId_StatusId_1 + Status + dbo + StatusId + Status + Implicit + + + + Commission + หน้าที่รับผิดชอบ + String + nvarchar + 512 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + DeptId + สถานที่ปฏิบัติงาน + Number + smallint + 5.0 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + + + N + %ISD_DEFAULT% + + + Y + Y + N + N + N + N + N + N + + + + + + + + + + + + VFK_PersonalId_DeptId_1 + Dept + dbo + DeptId + Dept + Implicit + + + + Addr + ที่อยู่ + String + nvarchar + 255 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + 255 + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + Amphur + อำเภอ + String + nvarchar + 50 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + Province + จังหวัด + String + nvarchar + 50 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + PostCode + รหัสไปรษณีย์ + String + nvarchar + 10 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + Phone + โทรศัพท์บ้าน + String + nvarchar + 15 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + PhoneExt + ต่อภายใน + String + nvarchar + 25 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + MobilePhone + โทรศัพท์เคลื่อนที่ + String + nvarchar + 15 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + picture + รูปถ่าย (ขนาด 160 x 200 px) + Image + image + 2147483647 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + + + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + PictureName + ไฟล์รูป + String + nvarchar + 50 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + DateRank + %ISD_DEFAULT% + Date + datetime + + + + + + + N + N + + + d + d + N + N + N + N + N + N + N + N + + + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + DatePrevRank + %ISD_DEFAULT% + Date + datetime + + + + + + + N + N + + + d + d + N + N + N + N + N + N + N + N + + + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + PersonalId + 10 + dbo + PersonalId + PersonalId_ + DatabasePersons1 + RowNum + Y + Y + Y + Y + BinaryChecksum + Persons + Y + PersonalId + PersonalId + BirthDate + + + \ No newline at end of file diff --git a/App_Code/Data Access Layer/PersonalIdDefinition.vb b/App_Code/Data Access Layer/PersonalIdDefinition.vb new file mode 100644 index 0000000..33eb1c5 --- /dev/null +++ b/App_Code/Data Access Layer/PersonalIdDefinition.vb @@ -0,0 +1,1606 @@ +Namespace Persons.Business +''' +''' Contains embedded schema and configuration data that is used by the +''' Persons.PersonalIdTable class +''' to initialize the class's TableDefinition. +''' +''' + +Public Class PersonalIdDefinition + +#Region "Definition (XML) for PersonalIdDefinition table" + 'Next 1573 lines contain Table Definition (XML) for table "PersonalIdDefinition" + Private Shared _DefinitionString As String = "" +#End Region + + ''' + ''' Gets the embedded schema and configuration data for the + ''' + ''' class's TableDefinition. + ''' + ''' This function is only called once at runtime. + ''' An XML string. + Public Shared Function GetXMLString() As String + If _DefinitionString = "" Then + Dim tbf As System.Text.StringBuilder = New System.Text.StringBuilder() + tbf.Append("") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "PersonalId") + tbf.Append( "เลขประจำตัวประชาชน") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "13") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "notrim,") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "SectionId") + tbf.Append( "ส่วนราชการ") + tbf.Append( "Number") + tbf.Append( "smallint") + tbf.Append( "5.0") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "VFK_PersonalId_SectionId_1") + tbf.Append( "Persons.Business.SectionTable, App_Code") + tbf.Append( "dbo") + tbf.Append( "SectionId") + tbf.Append( "SectionName") + tbf.Append( "Implicit") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "MId") + tbf.Append( "เลขประจำตัวทหาร") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "10") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "TId") + tbf.Append( "หมายเลขผู้เสียภาษี") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "10") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "ArmyId") + tbf.Append( "เหล่าทัพ") + tbf.Append( "Number") + tbf.Append( "tinyint") + tbf.Append( "3.0") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "VFK_PersonalId_ArmyId_1") + tbf.Append( "Persons.Business.ArmyTable, App_Code") + tbf.Append( "dbo") + tbf.Append( "ArmyId") + tbf.Append( "Army") + tbf.Append( "Implicit") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "RankId") + tbf.Append( "ยศ/คำนำหน้า") + tbf.Append( "Number") + tbf.Append( "int") + tbf.Append( "10.0") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "PersonalName") + tbf.Append( "ชื่อ") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "50") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "PersonalLastName") + tbf.Append( "นามสกุล") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "50") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Sex") + tbf.Append( "เพศ") + tbf.Append( "Number") + tbf.Append( "smallint") + tbf.Append( "5.0") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "VFK_PersonalId_Sex_1") + tbf.Append( "Persons.Business.SexTable, App_Code") + tbf.Append( "dbo") + tbf.Append( "SexId") + tbf.Append( "Sex") + tbf.Append( "Implicit") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "BirthDate") + tbf.Append( "วันเกิด") + tbf.Append( "Date") + tbf.Append( "datetime") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "d MMM yy") + tbf.Append( "g") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "PlaceOfBirth") + tbf.Append( "สถานที่เกิด") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "255") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "255") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "BAmphur") + tbf.Append( "อำเภอ") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "50") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "BProvince") + tbf.Append( "จังหวัด") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "50") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "BloodId") + tbf.Append( "หมู่โลหิต") + tbf.Append( "Number") + tbf.Append( "tinyint") + tbf.Append( "3.0") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "VFK_PersonalId_BloodId_1") + tbf.Append( "Persons.Business.BloodIdTable, App_Code") + tbf.Append( "dbo") + tbf.Append( "BloodId") + tbf.Append( "BloodName") + tbf.Append( "Implicit") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Origin") + tbf.Append( "เชื้อชาติ") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "50") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Nationality") + tbf.Append( "สัญชาติ") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "50") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Religion") + tbf.Append( "ศาสนา") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "50") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "ArmId") + tbf.Append( "เหล่า") + tbf.Append( "Number") + tbf.Append( "int") + tbf.Append( "10.0") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "VFK_PersonalId_ArmId_1") + tbf.Append( "Persons.Business.ArmTable, App_Code") + tbf.Append( "dbo") + tbf.Append( "ArmId") + tbf.Append( "ArmSName") + tbf.Append( "Implicit") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "RegDate") + tbf.Append( "วันขึ้นทะเบียนทหาร") + tbf.Append( "Date") + tbf.Append( "datetime") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "d MMM yy") + tbf.Append( "g") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "RegNo1") + tbf.Append( "ทะเบียนทหาร(แถวบน)") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "10") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "RegNo2") + tbf.Append( "ทะเบียนทหาร(แถวล่าง)") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "10") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "OfficerDate") + tbf.Append( "วันรับราชการ") + tbf.Append( "Date") + tbf.Append( "datetime") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "d MMM yy") + tbf.Append( "d") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Born") + tbf.Append( "กำเนิด") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "25") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "notrim,") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "VFK_PersonalId_Born_1") + tbf.Append( "Persons.Business.BornTable, App_Code") + tbf.Append( "dbo") + tbf.Append( "Born") + tbf.Append( "BornDesc") + tbf.Append( "Implicit") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "CremateMemId") + tbf.Append( "หมาเลขสมาชิกฌาปนกิจ") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "50") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "ArmyWelfareMemId") + tbf.Append( "หมายเลขสมาชิกสหกรณ์") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "50") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "StatusId") + tbf.Append( "สถานะการรับราชการ") + tbf.Append( "Number") + tbf.Append( "tinyint") + tbf.Append( "3.0") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "VFK_PersonalId_StatusId_1") + tbf.Append( "Persons.Business.StatusTable, App_Code") + tbf.Append( "dbo") + tbf.Append( "StatusId") + tbf.Append( "Status") + tbf.Append( "Implicit") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Commission") + tbf.Append( "หน้าที่รับผิดชอบ") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "512") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "DeptId") + tbf.Append( "สถานที่ปฏิบัติงาน") + tbf.Append( "Number") + tbf.Append( "smallint") + tbf.Append( "5.0") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "VFK_PersonalId_DeptId_1") + tbf.Append( "Persons.Business.DeptTable, App_Code") + tbf.Append( "dbo") + tbf.Append( "DeptId") + tbf.Append( "Dept") + tbf.Append( "Implicit") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Addr") + tbf.Append( "ที่อยู่") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "255") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "255") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Amphur") + tbf.Append( "อำเภอ") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "50") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Province") + tbf.Append( "จังหวัด") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "50") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "PostCode") + tbf.Append( "รหัสไปรษณีย์") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "10") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Phone") + tbf.Append( "โทรศัพท์บ้าน") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "15") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "PhoneExt") + tbf.Append( "ต่อภายใน") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "25") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "MobilePhone") + tbf.Append( "โทรศัพท์เคลื่อนที่") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "15") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "picture") + tbf.Append( "รูปถ่าย (ขนาด 160 x 200 px)") + tbf.Append( "Image") + tbf.Append( "image") + tbf.Append( "2147483647") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "PictureName") + tbf.Append( "ไฟล์รูป") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "50") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "DateRank") + tbf.Append( "Date Rank") + tbf.Append( "Date") + tbf.Append( "datetime") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "d") + tbf.Append( "d") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "DatePrevRank") + tbf.Append( "Date Prev Rank") + tbf.Append( "Date") + tbf.Append( "datetime") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "d") + tbf.Append( "d") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "PersonalId") + tbf.Append( "10") + tbf.Append( "dbo") + tbf.Append( "PersonalId") + tbf.Append( "PersonalId_") + tbf.Append( "DatabasePersons1") + tbf.Append( "RowNum") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "BinaryChecksum") + tbf.Append( "Persons") + tbf.Append( "Y") + tbf.Append( "PersonalId") + tbf.Append( "PersonalId") + tbf.Append( "BirthDate") + tbf.Append( "") + tbf.Append("") + _DefinitionString = tbf.ToString() + + End If + Return _DefinitionString + End Function + +End Class +End Namespace diff --git a/App_Code/Data Access Layer/PersonalIdSqlTable.vb b/App_Code/Data Access Layer/PersonalIdSqlTable.vb new file mode 100644 index 0000000..bb3ed57 --- /dev/null +++ b/App_Code/Data Access Layer/PersonalIdSqlTable.vb @@ -0,0 +1,47 @@ +' This is a "safe" class, meaning that it is created once +' and never overwritten. Any custom code you add to this class +' will be preserved when you regenerate your application. +' +' Typical customizations that may be done in this class include +' - overriding base class methods + +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + +Namespace Persons.Data + + ''' + ''' Used by the class to access and/or modify the database. + ''' + ''' + ''' This class is not intended to be instantiated directly. To obtain an instance of this class, + ''' use the methods of the class. + ''' + ''' + + Public Class PersonalIdSqlTable + Inherits BasePersonalIdSqlTable + + 'The functions below may be overridden in order to implement your own + 'logic for creating, updating, deleting, and getting individual records, + 'or for running queries that return lists of records. + + ' Creates a new record. + ' Before calling this method, column values should be set using SetColumn(). + 'Public Overloads Overrides Function CreateRecord() As KeyValue + 'End Function + + ' Updates a record in the database. + ' Before calling this method, column values should be set using SetColumn(). + 'Protected Overrides Sub UpdateRecord() + 'End Sub + + ' Deletes a record defined by a primary key value. + 'Public Overloads Overrides Sub DeleteRecord(ByVal key As KeyValue) + 'End Sub + + ' Gets a record from the database. + 'Protected Overloads Overrides Sub GetRecord() + 'End Sub + End Class +End Namespace diff --git a/App_Code/Data Access Layer/PersonalInsignia.xml b/App_Code/Data Access Layer/PersonalInsignia.xml new file mode 100644 index 0000000..9738c77 --- /dev/null +++ b/App_Code/Data Access Layer/PersonalInsignia.xml @@ -0,0 +1,472 @@ + + + + + id + %ISD_DEFAULT% + Number + int + 10.0 + + + + + Y + Y + + + + + Y + N + Y + Y + Y + N + Y + N + + + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + PersonalId + %ISD_DEFAULT% + String + nvarchar + 13 + + + + + N + N + + + + + N + N + N + N + N + Y + Y + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + + FK_PersonalInsignia_PersonalId + PersonalId + dbo + PersonalId + PersonalName + Explicit + + Y + N + N + N + N + N + N + + + + + + + + + + + + + InsigniaDate + ตั้งแต่ + Date + datetime + + + + + + + N + N + + + d MMM yy + g + N + N + N + N + N + N + N + N + + + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + InsigniaId + เครื่องราชอิสริยาภรณ์ + Number + smallint + 5.0 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + + + N + %ISD_DEFAULT% + + + Y + + FK_PersonalInsignia_Insignia + Insignia + dbo + InsigniaId + InsigniaName + Explicit + + Y + N + N + N + N + N + N + + + + + + + + + + + + + GazetteNO + ราชกิจจา เล่มที่ + String + nvarchar + 3 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + GazetteSection + ตอนที่ + String + nvarchar + 3 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + GazettePage + หน้าที่ + String + nvarchar + 60 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + GazetteDate + ลงวันที่ + Date + datetime + + + + + + + N + N + + + d MMM yy + g + N + N + N + N + N + N + N + N + + + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + InsigniaReturn + การส่งคืน + String + nvarchar + 50 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + PersonalInsignia + 1 + dbo + PersonalInsignia + PersonalInsignia_ + DatabasePersons1 + RowNum + Y + Y + Y + Y + BinaryChecksum + Persons + \ No newline at end of file diff --git a/App_Code/Data Access Layer/PersonalInsigniaDefinition.vb b/App_Code/Data Access Layer/PersonalInsigniaDefinition.vb new file mode 100644 index 0000000..97ef497 --- /dev/null +++ b/App_Code/Data Access Layer/PersonalInsigniaDefinition.vb @@ -0,0 +1,410 @@ +Namespace Persons.Business +''' +''' Contains embedded schema and configuration data that is used by the +''' Persons.PersonalInsigniaTable class +''' to initialize the class's TableDefinition. +''' +''' + +Public Class PersonalInsigniaDefinition + +#Region "Definition (XML) for PersonalInsigniaDefinition table" + 'Next 377 lines contain Table Definition (XML) for table "PersonalInsigniaDefinition" + Private Shared _DefinitionString As String = "" +#End Region + + ''' + ''' Gets the embedded schema and configuration data for the + ''' + ''' class's TableDefinition. + ''' + ''' This function is only called once at runtime. + ''' An XML string. + Public Shared Function GetXMLString() As String + If _DefinitionString = "" Then + Dim tbf As System.Text.StringBuilder = New System.Text.StringBuilder() + tbf.Append("") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "id") + tbf.Append( "ID") + tbf.Append( "Number") + tbf.Append( "int") + tbf.Append( "10.0") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "PersonalId") + tbf.Append( "Personal") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "13") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "") + tbf.Append( "FK_PersonalInsignia_PersonalId") + tbf.Append( "Persons.Business.PersonalIdTable, App_Code") + tbf.Append( "dbo") + tbf.Append( "PersonalId") + tbf.Append( "PersonalName") + tbf.Append( "Explicit") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "InsigniaDate") + tbf.Append( "ตั้งแต่") + tbf.Append( "Date") + tbf.Append( "datetime") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "d MMM yy") + tbf.Append( "g") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "InsigniaId") + tbf.Append( "เครื่องราชอิสริยาภรณ์") + tbf.Append( "Number") + tbf.Append( "smallint") + tbf.Append( "5.0") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "") + tbf.Append( "FK_PersonalInsignia_Insignia") + tbf.Append( "Persons.Business.InsigniaTable, App_Code") + tbf.Append( "dbo") + tbf.Append( "InsigniaId") + tbf.Append( "InsigniaName") + tbf.Append( "Explicit") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "GazetteNO") + tbf.Append( "ราชกิจจา เล่มที่") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "3") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "GazetteSection") + tbf.Append( "ตอนที่") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "3") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "GazettePage") + tbf.Append( "หน้าที่") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "60") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "GazetteDate") + tbf.Append( "ลงวันที่") + tbf.Append( "Date") + tbf.Append( "datetime") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "d MMM yy") + tbf.Append( "g") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "InsigniaReturn") + tbf.Append( "การส่งคืน") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "50") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "PersonalInsignia") + tbf.Append( "1") + tbf.Append( "dbo") + tbf.Append( "PersonalInsignia") + tbf.Append( "PersonalInsignia_") + tbf.Append( "DatabasePersons1") + tbf.Append( "RowNum") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "BinaryChecksum") + tbf.Append( "Persons") + tbf.Append("") + _DefinitionString = tbf.ToString() + + End If + Return _DefinitionString + End Function + +End Class +End Namespace diff --git a/App_Code/Data Access Layer/PersonalInsigniaSqlTable.vb b/App_Code/Data Access Layer/PersonalInsigniaSqlTable.vb new file mode 100644 index 0000000..23383c0 --- /dev/null +++ b/App_Code/Data Access Layer/PersonalInsigniaSqlTable.vb @@ -0,0 +1,47 @@ +' This is a "safe" class, meaning that it is created once +' and never overwritten. Any custom code you add to this class +' will be preserved when you regenerate your application. +' +' Typical customizations that may be done in this class include +' - overriding base class methods + +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + +Namespace Persons.Data + + ''' + ''' Used by the class to access and/or modify the database. + ''' + ''' + ''' This class is not intended to be instantiated directly. To obtain an instance of this class, + ''' use the methods of the class. + ''' + ''' + + Public Class PersonalInsigniaSqlTable + Inherits BasePersonalInsigniaSqlTable + + 'The functions below may be overridden in order to implement your own + 'logic for creating, updating, deleting, and getting individual records, + 'or for running queries that return lists of records. + + ' Creates a new record. + ' Before calling this method, column values should be set using SetColumn(). + 'Public Overloads Overrides Function CreateRecord() As KeyValue + 'End Function + + ' Updates a record in the database. + ' Before calling this method, column values should be set using SetColumn(). + 'Protected Overrides Sub UpdateRecord() + 'End Sub + + ' Deletes a record defined by a primary key value. + 'Public Overloads Overrides Sub DeleteRecord(ByVal key As KeyValue) + 'End Sub + + ' Gets a record from the database. + 'Protected Overloads Overrides Sub GetRecord() + 'End Sub + End Class +End Namespace diff --git a/App_Code/Data Access Layer/PersonalLanguageSkill.xml b/App_Code/Data Access Layer/PersonalLanguageSkill.xml new file mode 100644 index 0000000..f09e324 --- /dev/null +++ b/App_Code/Data Access Layer/PersonalLanguageSkill.xml @@ -0,0 +1,228 @@ + + + + + id + %ISD_DEFAULT% + Number + int + 10.0 + + + + + Y + Y + + + + + Y + N + Y + Y + Y + N + Y + N + + + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + PersonalId + %ISD_DEFAULT% + String + nvarchar + 13 + + + + + N + N + + + + + N + N + N + N + N + Y + Y + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + + FK_PersonalLanguageSkill_PersonalId + PersonalId + dbo + PersonalId + PersonalName + Explicit + + Y + N + N + N + N + N + N + + + + + + + + + + + + + LanguageId + ภาษา + Number + int + 10.0 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + + + N + %ISD_DEFAULT% + + + Y + + FK_PersonalLanguageSkill_Language + Language + dbo + LanguageId + Language + Explicit + + Y + N + N + N + N + N + N + + + + + + + + + + + + + Level + ระดับความสามารถ + String + nvarchar + 50 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + PersonalLanguageSkill + 1 + dbo + PersonalLanguageSkill + PersonalLanguageSkill_ + DatabasePersons1 + RowNum + Y + Y + Y + Y + BinaryChecksum + Persons + \ No newline at end of file diff --git a/App_Code/Data Access Layer/PersonalLanguageSkillDefinition.vb b/App_Code/Data Access Layer/PersonalLanguageSkillDefinition.vb new file mode 100644 index 0000000..fe6447d --- /dev/null +++ b/App_Code/Data Access Layer/PersonalLanguageSkillDefinition.vb @@ -0,0 +1,218 @@ +Namespace Persons.Business +''' +''' Contains embedded schema and configuration data that is used by the +''' Persons.PersonalLanguageSkillTable class +''' to initialize the class's TableDefinition. +''' +''' + +Public Class PersonalLanguageSkillDefinition + +#Region "Definition (XML) for PersonalLanguageSkillDefinition table" + 'Next 185 lines contain Table Definition (XML) for table "PersonalLanguageSkillDefinition" + Private Shared _DefinitionString As String = "" +#End Region + + ''' + ''' Gets the embedded schema and configuration data for the + ''' + ''' class's TableDefinition. + ''' + ''' This function is only called once at runtime. + ''' An XML string. + Public Shared Function GetXMLString() As String + If _DefinitionString = "" Then + Dim tbf As System.Text.StringBuilder = New System.Text.StringBuilder() + tbf.Append("") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "id") + tbf.Append( "ID") + tbf.Append( "Number") + tbf.Append( "int") + tbf.Append( "10.0") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "PersonalId") + tbf.Append( "Personal") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "13") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "") + tbf.Append( "FK_PersonalLanguageSkill_PersonalId") + tbf.Append( "Persons.Business.PersonalIdTable, App_Code") + tbf.Append( "dbo") + tbf.Append( "PersonalId") + tbf.Append( "PersonalName") + tbf.Append( "Explicit") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "LanguageId") + tbf.Append( "ภาษา") + tbf.Append( "Number") + tbf.Append( "int") + tbf.Append( "10.0") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "") + tbf.Append( "FK_PersonalLanguageSkill_Language") + tbf.Append( "Persons.Business.LanguageTable, App_Code") + tbf.Append( "dbo") + tbf.Append( "LanguageId") + tbf.Append( "Language") + tbf.Append( "Explicit") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Level") + tbf.Append( "ระดับความสามารถ") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "50") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "PersonalLanguageSkill") + tbf.Append( "1") + tbf.Append( "dbo") + tbf.Append( "PersonalLanguageSkill") + tbf.Append( "PersonalLanguageSkill_") + tbf.Append( "DatabasePersons1") + tbf.Append( "RowNum") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "BinaryChecksum") + tbf.Append( "Persons") + tbf.Append("") + _DefinitionString = tbf.ToString() + + End If + Return _DefinitionString + End Function + +End Class +End Namespace diff --git a/App_Code/Data Access Layer/PersonalLanguageSkillSqlTable.vb b/App_Code/Data Access Layer/PersonalLanguageSkillSqlTable.vb new file mode 100644 index 0000000..bc280c6 --- /dev/null +++ b/App_Code/Data Access Layer/PersonalLanguageSkillSqlTable.vb @@ -0,0 +1,47 @@ +' This is a "safe" class, meaning that it is created once +' and never overwritten. Any custom code you add to this class +' will be preserved when you regenerate your application. +' +' Typical customizations that may be done in this class include +' - overriding base class methods + +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + +Namespace Persons.Data + + ''' + ''' Used by the class to access and/or modify the database. + ''' + ''' + ''' This class is not intended to be instantiated directly. To obtain an instance of this class, + ''' use the methods of the class. + ''' + ''' + + Public Class PersonalLanguageSkillSqlTable + Inherits BasePersonalLanguageSkillSqlTable + + 'The functions below may be overridden in order to implement your own + 'logic for creating, updating, deleting, and getting individual records, + 'or for running queries that return lists of records. + + ' Creates a new record. + ' Before calling this method, column values should be set using SetColumn(). + 'Public Overloads Overrides Function CreateRecord() As KeyValue + 'End Function + + ' Updates a record in the database. + ' Before calling this method, column values should be set using SetColumn(). + 'Protected Overrides Sub UpdateRecord() + 'End Sub + + ' Deletes a record defined by a primary key value. + 'Public Overloads Overrides Sub DeleteRecord(ByVal key As KeyValue) + 'End Sub + + ' Gets a record from the database. + 'Protected Overloads Overrides Sub GetRecord() + 'End Sub + End Class +End Namespace diff --git a/App_Code/Data Access Layer/PersonalName.xml b/App_Code/Data Access Layer/PersonalName.xml new file mode 100644 index 0000000..b00a52e --- /dev/null +++ b/App_Code/Data Access Layer/PersonalName.xml @@ -0,0 +1,317 @@ + + + + + id + %ISD_DEFAULT% + Number + int + 10.0 + + + + + Y + Y + + + + + Y + N + Y + Y + Y + N + Y + N + + + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + PersonalId + %ISD_DEFAULT% + String + nvarchar + 13 + + + + + N + N + + + + + N + N + N + N + N + Y + Y + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + + FK_PersonalName_PersonalId + PersonalId + dbo + PersonalId + PersonalName + Explicit + + Y + N + N + N + N + N + N + + + + + + + + + + + + + PersonalName + ชื่อ + String + nvarchar + 50 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + PersonalLastName + นามสกุล + String + nvarchar + 50 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + NameDate + ตั้งแต่ + Date + datetime + + + + + + + N + N + + + d MMM yy + g + N + N + N + N + N + N + N + N + + + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + Ref + หลักฐาน + String + nvarchar + 50 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + PersonalName + 1 + dbo + PersonalName + PersonalName_ + DatabasePersons1 + RowNum + Y + Y + Y + Y + BinaryChecksum + Persons + \ No newline at end of file diff --git a/App_Code/Data Access Layer/PersonalNameDefinition.vb b/App_Code/Data Access Layer/PersonalNameDefinition.vb new file mode 100644 index 0000000..6773a05 --- /dev/null +++ b/App_Code/Data Access Layer/PersonalNameDefinition.vb @@ -0,0 +1,287 @@ +Namespace Persons.Business +''' +''' Contains embedded schema and configuration data that is used by the +''' Persons.PersonalNameTable class +''' to initialize the class's TableDefinition. +''' +''' + +Public Class PersonalNameDefinition + +#Region "Definition (XML) for PersonalNameDefinition table" + 'Next 254 lines contain Table Definition (XML) for table "PersonalNameDefinition" + Private Shared _DefinitionString As String = "" +#End Region + + ''' + ''' Gets the embedded schema and configuration data for the + ''' + ''' class's TableDefinition. + ''' + ''' This function is only called once at runtime. + ''' An XML string. + Public Shared Function GetXMLString() As String + If _DefinitionString = "" Then + Dim tbf As System.Text.StringBuilder = New System.Text.StringBuilder() + tbf.Append("") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "id") + tbf.Append( "ID") + tbf.Append( "Number") + tbf.Append( "int") + tbf.Append( "10.0") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "PersonalId") + tbf.Append( "Personal") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "13") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "") + tbf.Append( "FK_PersonalName_PersonalId") + tbf.Append( "Persons.Business.PersonalIdTable, App_Code") + tbf.Append( "dbo") + tbf.Append( "PersonalId") + tbf.Append( "PersonalName") + tbf.Append( "Explicit") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "PersonalName") + tbf.Append( "ชื่อ") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "50") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "PersonalLastName") + tbf.Append( "นามสกุล") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "50") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "NameDate") + tbf.Append( "ตั้งแต่") + tbf.Append( "Date") + tbf.Append( "datetime") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "d MMM yy") + tbf.Append( "g") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Ref") + tbf.Append( "หลักฐาน") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "50") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "PersonalName") + tbf.Append( "1") + tbf.Append( "dbo") + tbf.Append( "PersonalName") + tbf.Append( "PersonalName_") + tbf.Append( "DatabasePersons1") + tbf.Append( "RowNum") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "BinaryChecksum") + tbf.Append( "Persons") + tbf.Append("") + _DefinitionString = tbf.ToString() + + End If + Return _DefinitionString + End Function + +End Class +End Namespace diff --git a/App_Code/Data Access Layer/PersonalNameSqlTable.vb b/App_Code/Data Access Layer/PersonalNameSqlTable.vb new file mode 100644 index 0000000..370fe0b --- /dev/null +++ b/App_Code/Data Access Layer/PersonalNameSqlTable.vb @@ -0,0 +1,47 @@ +' This is a "safe" class, meaning that it is created once +' and never overwritten. Any custom code you add to this class +' will be preserved when you regenerate your application. +' +' Typical customizations that may be done in this class include +' - overriding base class methods + +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + +Namespace Persons.Data + + ''' + ''' Used by the class to access and/or modify the database. + ''' + ''' + ''' This class is not intended to be instantiated directly. To obtain an instance of this class, + ''' use the methods of the class. + ''' + ''' + + Public Class PersonalNameSqlTable + Inherits BasePersonalNameSqlTable + + 'The functions below may be overridden in order to implement your own + 'logic for creating, updating, deleting, and getting individual records, + 'or for running queries that return lists of records. + + ' Creates a new record. + ' Before calling this method, column values should be set using SetColumn(). + 'Public Overloads Overrides Function CreateRecord() As KeyValue + 'End Function + + ' Updates a record in the database. + ' Before calling this method, column values should be set using SetColumn(). + 'Protected Overrides Sub UpdateRecord() + 'End Sub + + ' Deletes a record defined by a primary key value. + 'Public Overloads Overrides Sub DeleteRecord(ByVal key As KeyValue) + 'End Sub + + ' Gets a record from the database. + 'Protected Overloads Overrides Sub GetRecord() + 'End Sub + End Class +End Namespace diff --git a/App_Code/Data Access Layer/PersonalRank.xml b/App_Code/Data Access Layer/PersonalRank.xml new file mode 100644 index 0000000..f4250b4 --- /dev/null +++ b/App_Code/Data Access Layer/PersonalRank.xml @@ -0,0 +1,570 @@ + + + + + id + %ISD_DEFAULT% + Number + int + 10.0 + + + + + Y + Y + + + + + Y + N + Y + Y + Y + N + Y + N + + + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + PersonalId + %ISD_DEFAULT% + String + nvarchar + 13 + + + + + N + N + + + + + N + N + N + N + N + Y + Y + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + + FK_PersonalRank_PersonalId + PersonalId + dbo + PersonalId + PersonalName + Explicit + + Y + N + N + N + N + N + N + + + + + + + + + + + + + PreRank + ว่าที่ + Number + tinyint + 3.0 + + + (0) + N + N + + + + + N + N + N + N + N + N + Y + N + + + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + RankId + ยศ + Number + int + 10.0 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + + + N + %ISD_DEFAULT% + + + Y + Y + N + N + N + N + N + N + + + + + + + + + + + + VFK_PersonalRank_RankId_1 + Rank + dbo + RankId + ShortRank + Implicit + + + + RankDate + ตั้งแต่ + Date + datetime + + + + + + + N + N + + + d MMM yyyy + g + N + N + N + N + N + N + N + N + + + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + RefDate + ลงวันที่ + Date + datetime + + + + + + + N + N + + + d MMM yyyy + g + N + N + N + N + N + N + N + N + + + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + Ref + คำสั้ง + String + nvarchar + 100 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + GazetteNO + ราชกิจจา เล่มที่ + String + nvarchar + 50 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + GazetteSection + ตอนที่ + String + nvarchar + 50 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + GazettePage + หน้าที่ + String + nvarchar + 50 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + GazetteDate + ลงวันที่ + Date + datetime + + + + + + + N + N + + + d MMM yyyy + g + N + N + N + N + N + N + N + N + + + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + PersonalRank + 2 + dbo + PersonalRank + PersonalRank_ + DatabasePersons1 + RowNum + Y + Y + Y + Y + BinaryChecksum + Persons + \ No newline at end of file diff --git a/App_Code/Data Access Layer/PersonalRankDefinition.vb b/App_Code/Data Access Layer/PersonalRankDefinition.vb new file mode 100644 index 0000000..4843a60 --- /dev/null +++ b/App_Code/Data Access Layer/PersonalRankDefinition.vb @@ -0,0 +1,487 @@ +Namespace Persons.Business +''' +''' Contains embedded schema and configuration data that is used by the +''' Persons.PersonalRankTable class +''' to initialize the class's TableDefinition. +''' +''' + +Public Class PersonalRankDefinition + +#Region "Definition (XML) for PersonalRankDefinition table" + 'Next 454 lines contain Table Definition (XML) for table "PersonalRankDefinition" + Private Shared _DefinitionString As String = "" +#End Region + + ''' + ''' Gets the embedded schema and configuration data for the + ''' + ''' class's TableDefinition. + ''' + ''' This function is only called once at runtime. + ''' An XML string. + Public Shared Function GetXMLString() As String + If _DefinitionString = "" Then + Dim tbf As System.Text.StringBuilder = New System.Text.StringBuilder() + tbf.Append("") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "id") + tbf.Append( "ID") + tbf.Append( "Number") + tbf.Append( "int") + tbf.Append( "10.0") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "PersonalId") + tbf.Append( "Personal") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "13") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "") + tbf.Append( "FK_PersonalRank_PersonalId") + tbf.Append( "Persons.Business.PersonalIdTable, App_Code") + tbf.Append( "dbo") + tbf.Append( "PersonalId") + tbf.Append( "PersonalName") + tbf.Append( "Explicit") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "PreRank") + tbf.Append( "ว่าที่") + tbf.Append( "Number") + tbf.Append( "tinyint") + tbf.Append( "3.0") + tbf.Append( "") + tbf.Append( "(0)") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "RankId") + tbf.Append( "ยศ") + tbf.Append( "Number") + tbf.Append( "int") + tbf.Append( "10.0") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "VFK_PersonalRank_RankId_1") + tbf.Append( "Persons.Business.RankTable, App_Code") + tbf.Append( "dbo") + tbf.Append( "RankId") + tbf.Append( "ShortRank") + tbf.Append( "Implicit") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "RankDate") + tbf.Append( "ตั้งแต่") + tbf.Append( "Date") + tbf.Append( "datetime") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "d MMM yyyy") + tbf.Append( "g") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "RefDate") + tbf.Append( "ลงวันที่") + tbf.Append( "Date") + tbf.Append( "datetime") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "d MMM yyyy") + tbf.Append( "g") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Ref") + tbf.Append( "คำสั้ง") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "100") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "GazetteNO") + tbf.Append( "ราชกิจจา เล่มที่") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "50") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "GazetteSection") + tbf.Append( "ตอนที่") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "50") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "GazettePage") + tbf.Append( "หน้าที่") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "50") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "GazetteDate") + tbf.Append( "ลงวันที่") + tbf.Append( "Date") + tbf.Append( "datetime") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "d MMM yyyy") + tbf.Append( "g") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "PersonalRank") + tbf.Append( "2") + tbf.Append( "dbo") + tbf.Append( "PersonalRank") + tbf.Append( "PersonalRank_") + tbf.Append( "DatabasePersons1") + tbf.Append( "RowNum") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "BinaryChecksum") + tbf.Append( "Persons") + tbf.Append("") + _DefinitionString = tbf.ToString() + + End If + Return _DefinitionString + End Function + +End Class +End Namespace diff --git a/App_Code/Data Access Layer/PersonalRankSqlTable.vb b/App_Code/Data Access Layer/PersonalRankSqlTable.vb new file mode 100644 index 0000000..e796025 --- /dev/null +++ b/App_Code/Data Access Layer/PersonalRankSqlTable.vb @@ -0,0 +1,47 @@ +' This is a "safe" class, meaning that it is created once +' and never overwritten. Any custom code you add to this class +' will be preserved when you regenerate your application. +' +' Typical customizations that may be done in this class include +' - overriding base class methods + +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + +Namespace Persons.Data + + ''' + ''' Used by the class to access and/or modify the database. + ''' + ''' + ''' This class is not intended to be instantiated directly. To obtain an instance of this class, + ''' use the methods of the class. + ''' + ''' + + Public Class PersonalRankSqlTable + Inherits BasePersonalRankSqlTable + + 'The functions below may be overridden in order to implement your own + 'logic for creating, updating, deleting, and getting individual records, + 'or for running queries that return lists of records. + + ' Creates a new record. + ' Before calling this method, column values should be set using SetColumn(). + 'Public Overloads Overrides Function CreateRecord() As KeyValue + 'End Function + + ' Updates a record in the database. + ' Before calling this method, column values should be set using SetColumn(). + 'Protected Overrides Sub UpdateRecord() + 'End Sub + + ' Deletes a record defined by a primary key value. + 'Public Overloads Overrides Sub DeleteRecord(ByVal key As KeyValue) + 'End Sub + + ' Gets a record from the database. + 'Protected Overloads Overrides Sub GetRecord() + 'End Sub + End Class +End Namespace diff --git a/App_Code/Data Access Layer/PersonalSalary.xml b/App_Code/Data Access Layer/PersonalSalary.xml new file mode 100644 index 0000000..d031a06 --- /dev/null +++ b/App_Code/Data Access Layer/PersonalSalary.xml @@ -0,0 +1,660 @@ + + + + + id + %ISD_DEFAULT% + Number + int + 10.0 + + + + + Y + Y + + + + + Y + N + Y + Y + Y + N + Y + N + + + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + PersonalId + %ISD_DEFAULT% + String + nvarchar + 13 + + + + + Y + N + + + + + N + N + N + N + N + Y + Y + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + + FK_PersonalSalary_PersonalId + PersonalId + dbo + PersonalId + PersonalName + Explicit + + Y + N + N + N + N + N + N + + + + + + + + + + + + + SalaryDate + ตั้งแต่ + Date + datetime + + + + + + + Y + N + + + d MMM yyyy + d/M/yy + N + N + N + N + N + N + N + N + + + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + SalaryRank + ชั้น + String + nvarchar + 3 + + + + + Y + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + SalaryStep + ขั้น + Number + float + 53 + + + + + Y + N + + + + + N + N + N + N + N + N + N + N + + + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + SalaryYear + ประจำปี + String + nvarchar + 2 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + SalaryRound + %ISD_DEFAULT% + Number + numeric + 1.0 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + + + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + SalaryAmout + จำนวนเงิน + Currency + money + 19.4 + + + + + N + N + + + #,### + C + N + N + N + N + N + N + N + N + + + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + SalaryExtra_NotUsed + %ISD_DEFAULT% + String + nvarchar + 50 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + SalaryPlus + เงินเพิ่ม/ลด + Currency + money + 19.4 + + + + + N + N + + + ##### + C + N + N + N + N + N + N + N + N + + + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + PositionSalary + เงินประจำตำแหน่ง + Currency + money + 19.4 + + + + + N + N + + + ##### + C + N + N + N + N + N + N + N + N + + + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + SalaryCommand + คำสั้่ง + String + nvarchar + 50 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + CommandDate + ลงวันที่ + Date + datetime + + + + + + + N + N + + + d MMM yyyy + g + N + N + N + N + N + N + N + N + + + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + PersonalSalary + 5 + dbo + PersonalSalary + PersonalSalary_ + DatabasePersons1 + RowNum + Y + Y + Y + Y + BinaryChecksum + Persons + \ No newline at end of file diff --git a/App_Code/Data Access Layer/PersonalSalaryDefinition.vb b/App_Code/Data Access Layer/PersonalSalaryDefinition.vb new file mode 100644 index 0000000..b2a7c8f --- /dev/null +++ b/App_Code/Data Access Layer/PersonalSalaryDefinition.vb @@ -0,0 +1,557 @@ +Namespace Persons.Business +''' +''' Contains embedded schema and configuration data that is used by the +''' Persons.PersonalSalaryTable class +''' to initialize the class's TableDefinition. +''' +''' + +Public Class PersonalSalaryDefinition + +#Region "Definition (XML) for PersonalSalaryDefinition table" + 'Next 524 lines contain Table Definition (XML) for table "PersonalSalaryDefinition" + Private Shared _DefinitionString As String = "" +#End Region + + ''' + ''' Gets the embedded schema and configuration data for the + ''' + ''' class's TableDefinition. + ''' + ''' This function is only called once at runtime. + ''' An XML string. + Public Shared Function GetXMLString() As String + If _DefinitionString = "" Then + Dim tbf As System.Text.StringBuilder = New System.Text.StringBuilder() + tbf.Append("") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "id") + tbf.Append( "ID") + tbf.Append( "Number") + tbf.Append( "int") + tbf.Append( "10.0") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "PersonalId") + tbf.Append( "Personal") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "13") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "") + tbf.Append( "FK_PersonalSalary_PersonalId") + tbf.Append( "Persons.Business.PersonalIdTable, App_Code") + tbf.Append( "dbo") + tbf.Append( "PersonalId") + tbf.Append( "PersonalName") + tbf.Append( "Explicit") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "SalaryDate") + tbf.Append( "ตั้งแต่") + tbf.Append( "Date") + tbf.Append( "datetime") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "d MMM yyyy") + tbf.Append( "d/M/yy") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "SalaryRank") + tbf.Append( "ชั้น") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "3") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "SalaryStep") + tbf.Append( "ขั้น") + tbf.Append( "Number") + tbf.Append( "float") + tbf.Append( "53") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "SalaryYear") + tbf.Append( "ประจำปี") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "2") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "SalaryRound") + tbf.Append( "Salary Round") + tbf.Append( "Number") + tbf.Append( "numeric") + tbf.Append( "1.0") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "SalaryAmout") + tbf.Append( "จำนวนเงิน") + tbf.Append( "Currency") + tbf.Append( "money") + tbf.Append( "19.4") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "#,###") + tbf.Append( "C") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "SalaryExtra_NotUsed") + tbf.Append( "Salary Extra Not Used") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "50") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "SalaryPlus") + tbf.Append( "เงินเพิ่ม/ลด") + tbf.Append( "Currency") + tbf.Append( "money") + tbf.Append( "19.4") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "#####") + tbf.Append( "C") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "PositionSalary") + tbf.Append( "เงินประจำตำแหน่ง") + tbf.Append( "Currency") + tbf.Append( "money") + tbf.Append( "19.4") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "#####") + tbf.Append( "C") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "SalaryCommand") + tbf.Append( "คำสั้่ง") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "50") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "CommandDate") + tbf.Append( "ลงวันที่") + tbf.Append( "Date") + tbf.Append( "datetime") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "d MMM yyyy") + tbf.Append( "g") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "PersonalSalary") + tbf.Append( "5") + tbf.Append( "dbo") + tbf.Append( "PersonalSalary") + tbf.Append( "PersonalSalary_") + tbf.Append( "DatabasePersons1") + tbf.Append( "RowNum") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "BinaryChecksum") + tbf.Append( "Persons") + tbf.Append("") + _DefinitionString = tbf.ToString() + + End If + Return _DefinitionString + End Function + +End Class +End Namespace diff --git a/App_Code/Data Access Layer/PersonalSalarySqlTable.vb b/App_Code/Data Access Layer/PersonalSalarySqlTable.vb new file mode 100644 index 0000000..e1327e6 --- /dev/null +++ b/App_Code/Data Access Layer/PersonalSalarySqlTable.vb @@ -0,0 +1,47 @@ +' This is a "safe" class, meaning that it is created once +' and never overwritten. Any custom code you add to this class +' will be preserved when you regenerate your application. +' +' Typical customizations that may be done in this class include +' - overriding base class methods + +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + +Namespace Persons.Data + + ''' + ''' Used by the class to access and/or modify the database. + ''' + ''' + ''' This class is not intended to be instantiated directly. To obtain an instance of this class, + ''' use the methods of the class. + ''' + ''' + + Public Class PersonalSalarySqlTable + Inherits BasePersonalSalarySqlTable + + 'The functions below may be overridden in order to implement your own + 'logic for creating, updating, deleting, and getting individual records, + 'or for running queries that return lists of records. + + ' Creates a new record. + ' Before calling this method, column values should be set using SetColumn(). + 'Public Overloads Overrides Function CreateRecord() As KeyValue + 'End Function + + ' Updates a record in the database. + ' Before calling this method, column values should be set using SetColumn(). + 'Protected Overrides Sub UpdateRecord() + 'End Sub + + ' Deletes a record defined by a primary key value. + 'Public Overloads Overrides Sub DeleteRecord(ByVal key As KeyValue) + 'End Sub + + ' Gets a record from the database. + 'Protected Overloads Overrides Sub GetRecord() + 'End Sub + End Class +End Namespace diff --git a/App_Code/Data Access Layer/PersonalSpecialSkill.xml b/App_Code/Data Access Layer/PersonalSpecialSkill.xml new file mode 100644 index 0000000..47317a7 --- /dev/null +++ b/App_Code/Data Access Layer/PersonalSpecialSkill.xml @@ -0,0 +1,219 @@ + + + + + id + %ISD_DEFAULT% + Number + int + 10.0 + + + + + Y + Y + + + + + Y + N + Y + Y + Y + N + Y + N + + + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + PersonalId + %ISD_DEFAULT% + String + nvarchar + 13 + + + + + N + N + + + + + N + N + N + N + N + Y + Y + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + + FK_PersonalSpecialSkill_PersonalId + PersonalId + dbo + PersonalId + PersonalName + Explicit + + Y + N + N + N + N + N + N + + + + + + + + + + + + + Skill + รายละเอียด + String + nvarchar + 50 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + Level + ระดับความสามารถ + String + nvarchar + 50 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + PersonalSpecialSkill + 1 + dbo + PersonalSpecialSkill + PersonalSpecialSkill_ + DatabasePersons1 + RowNum + Y + Y + Y + Y + BinaryChecksum + Persons + \ No newline at end of file diff --git a/App_Code/Data Access Layer/PersonalSpecialSkillDefinition.vb b/App_Code/Data Access Layer/PersonalSpecialSkillDefinition.vb new file mode 100644 index 0000000..dd9b249 --- /dev/null +++ b/App_Code/Data Access Layer/PersonalSpecialSkillDefinition.vb @@ -0,0 +1,210 @@ +Namespace Persons.Business +''' +''' Contains embedded schema and configuration data that is used by the +''' Persons.PersonalSpecialSkillTable class +''' to initialize the class's TableDefinition. +''' +''' + +Public Class PersonalSpecialSkillDefinition + +#Region "Definition (XML) for PersonalSpecialSkillDefinition table" + 'Next 177 lines contain Table Definition (XML) for table "PersonalSpecialSkillDefinition" + Private Shared _DefinitionString As String = "" +#End Region + + ''' + ''' Gets the embedded schema and configuration data for the + ''' + ''' class's TableDefinition. + ''' + ''' This function is only called once at runtime. + ''' An XML string. + Public Shared Function GetXMLString() As String + If _DefinitionString = "" Then + Dim tbf As System.Text.StringBuilder = New System.Text.StringBuilder() + tbf.Append("") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "id") + tbf.Append( "ID") + tbf.Append( "Number") + tbf.Append( "int") + tbf.Append( "10.0") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "PersonalId") + tbf.Append( "Personal") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "13") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "") + tbf.Append( "FK_PersonalSpecialSkill_PersonalId") + tbf.Append( "Persons.Business.PersonalIdTable, App_Code") + tbf.Append( "dbo") + tbf.Append( "PersonalId") + tbf.Append( "PersonalName") + tbf.Append( "Explicit") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Skill") + tbf.Append( "รายละเอียด") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "50") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Level") + tbf.Append( "ระดับความสามารถ") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "50") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "PersonalSpecialSkill") + tbf.Append( "1") + tbf.Append( "dbo") + tbf.Append( "PersonalSpecialSkill") + tbf.Append( "PersonalSpecialSkill_") + tbf.Append( "DatabasePersons1") + tbf.Append( "RowNum") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "BinaryChecksum") + tbf.Append( "Persons") + tbf.Append("") + _DefinitionString = tbf.ToString() + + End If + Return _DefinitionString + End Function + +End Class +End Namespace diff --git a/App_Code/Data Access Layer/PersonalSpecialSkillSqlTable.vb b/App_Code/Data Access Layer/PersonalSpecialSkillSqlTable.vb new file mode 100644 index 0000000..4ba0c73 --- /dev/null +++ b/App_Code/Data Access Layer/PersonalSpecialSkillSqlTable.vb @@ -0,0 +1,47 @@ +' This is a "safe" class, meaning that it is created once +' and never overwritten. Any custom code you add to this class +' will be preserved when you regenerate your application. +' +' Typical customizations that may be done in this class include +' - overriding base class methods + +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + +Namespace Persons.Data + + ''' + ''' Used by the class to access and/or modify the database. + ''' + ''' + ''' This class is not intended to be instantiated directly. To obtain an instance of this class, + ''' use the methods of the class. + ''' + ''' + + Public Class PersonalSpecialSkillSqlTable + Inherits BasePersonalSpecialSkillSqlTable + + 'The functions below may be overridden in order to implement your own + 'logic for creating, updating, deleting, and getting individual records, + 'or for running queries that return lists of records. + + ' Creates a new record. + ' Before calling this method, column values should be set using SetColumn(). + 'Public Overloads Overrides Function CreateRecord() As KeyValue + 'End Function + + ' Updates a record in the database. + ' Before calling this method, column values should be set using SetColumn(). + 'Protected Overrides Sub UpdateRecord() + 'End Sub + + ' Deletes a record defined by a primary key value. + 'Public Overloads Overrides Sub DeleteRecord(ByVal key As KeyValue) + 'End Sub + + ' Gets a record from the database. + 'Protected Overloads Overrides Sub GetRecord() + 'End Sub + End Class +End Namespace diff --git a/App_Code/Data Access Layer/PersonalSportSkill.xml b/App_Code/Data Access Layer/PersonalSportSkill.xml new file mode 100644 index 0000000..a902b64 --- /dev/null +++ b/App_Code/Data Access Layer/PersonalSportSkill.xml @@ -0,0 +1,228 @@ + + + + + id + %ISD_DEFAULT% + Number + int + 10.0 + + + + + Y + Y + + + + + Y + N + Y + Y + Y + N + Y + N + + + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + PersonalId + %ISD_DEFAULT% + String + nvarchar + 13 + + + + + N + N + + + + + N + N + N + N + N + Y + Y + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + + FK_PersonalSportSkill_PersonalId + PersonalId + dbo + PersonalId + PersonalName + Explicit + + Y + N + N + N + N + N + N + + + + + + + + + + + + + SportId + ชนิดกีฬา + Number + smallint + 5.0 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + + + N + %ISD_DEFAULT% + + + Y + Y + N + N + N + N + N + N + + + + + + + + + + + + VFK_PersonalSportSkill_SportId_1 + Sport + dbo + SportId + SPORT + Implicit + + + + Level + ระดับความสามารถ + String + nvarchar + 50 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + PersonalSportSkill + 3 + dbo + PersonalSportSkill + PersonalSportSkill_ + DatabasePersons1 + RowNum + Y + Y + Y + Y + BinaryChecksum + Persons + \ No newline at end of file diff --git a/App_Code/Data Access Layer/PersonalSportSkillDefinition.vb b/App_Code/Data Access Layer/PersonalSportSkillDefinition.vb new file mode 100644 index 0000000..9905d7d --- /dev/null +++ b/App_Code/Data Access Layer/PersonalSportSkillDefinition.vb @@ -0,0 +1,218 @@ +Namespace Persons.Business +''' +''' Contains embedded schema and configuration data that is used by the +''' Persons.PersonalSportSkillTable class +''' to initialize the class's TableDefinition. +''' +''' + +Public Class PersonalSportSkillDefinition + +#Region "Definition (XML) for PersonalSportSkillDefinition table" + 'Next 185 lines contain Table Definition (XML) for table "PersonalSportSkillDefinition" + Private Shared _DefinitionString As String = "" +#End Region + + ''' + ''' Gets the embedded schema and configuration data for the + ''' + ''' class's TableDefinition. + ''' + ''' This function is only called once at runtime. + ''' An XML string. + Public Shared Function GetXMLString() As String + If _DefinitionString = "" Then + Dim tbf As System.Text.StringBuilder = New System.Text.StringBuilder() + tbf.Append("") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "id") + tbf.Append( "ID") + tbf.Append( "Number") + tbf.Append( "int") + tbf.Append( "10.0") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "PersonalId") + tbf.Append( "Personal") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "13") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "") + tbf.Append( "FK_PersonalSportSkill_PersonalId") + tbf.Append( "Persons.Business.PersonalIdTable, App_Code") + tbf.Append( "dbo") + tbf.Append( "PersonalId") + tbf.Append( "PersonalName") + tbf.Append( "Explicit") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "SportId") + tbf.Append( "ชนิดกีฬา") + tbf.Append( "Number") + tbf.Append( "smallint") + tbf.Append( "5.0") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "VFK_PersonalSportSkill_SportId_1") + tbf.Append( "Persons.Business.SportTable, App_Code") + tbf.Append( "dbo") + tbf.Append( "SportId") + tbf.Append( "SPORT") + tbf.Append( "Implicit") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Level") + tbf.Append( "ระดับความสามารถ") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "50") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "PersonalSportSkill") + tbf.Append( "3") + tbf.Append( "dbo") + tbf.Append( "PersonalSportSkill") + tbf.Append( "PersonalSportSkill_") + tbf.Append( "DatabasePersons1") + tbf.Append( "RowNum") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "BinaryChecksum") + tbf.Append( "Persons") + tbf.Append("") + _DefinitionString = tbf.ToString() + + End If + Return _DefinitionString + End Function + +End Class +End Namespace diff --git a/App_Code/Data Access Layer/PersonalSportSkillSqlTable.vb b/App_Code/Data Access Layer/PersonalSportSkillSqlTable.vb new file mode 100644 index 0000000..1991b39 --- /dev/null +++ b/App_Code/Data Access Layer/PersonalSportSkillSqlTable.vb @@ -0,0 +1,47 @@ +' This is a "safe" class, meaning that it is created once +' and never overwritten. Any custom code you add to this class +' will be preserved when you regenerate your application. +' +' Typical customizations that may be done in this class include +' - overriding base class methods + +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + +Namespace Persons.Data + + ''' + ''' Used by the class to access and/or modify the database. + ''' + ''' + ''' This class is not intended to be instantiated directly. To obtain an instance of this class, + ''' use the methods of the class. + ''' + ''' + + Public Class PersonalSportSkillSqlTable + Inherits BasePersonalSportSkillSqlTable + + 'The functions below may be overridden in order to implement your own + 'logic for creating, updating, deleting, and getting individual records, + 'or for running queries that return lists of records. + + ' Creates a new record. + ' Before calling this method, column values should be set using SetColumn(). + 'Public Overloads Overrides Function CreateRecord() As KeyValue + 'End Function + + ' Updates a record in the database. + ' Before calling this method, column values should be set using SetColumn(). + 'Protected Overrides Sub UpdateRecord() + 'End Sub + + ' Deletes a record defined by a primary key value. + 'Public Overloads Overrides Sub DeleteRecord(ByVal key As KeyValue) + 'End Sub + + ' Gets a record from the database. + 'Protected Overloads Overrides Sub GetRecord() + 'End Sub + End Class +End Namespace diff --git a/App_Code/Data Access Layer/PersonalTitle.xml b/App_Code/Data Access Layer/PersonalTitle.xml new file mode 100644 index 0000000..39a1861 --- /dev/null +++ b/App_Code/Data Access Layer/PersonalTitle.xml @@ -0,0 +1,512 @@ + + + + + id + %ISD_DEFAULT% + Number + int + 10.0 + + + + + Y + Y + + + + + Y + N + Y + Y + Y + N + Y + N + + + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + PersonalId + %ISD_DEFAULT% + String + nvarchar + 13 + + + + + Y + N + + + + + N + N + N + N + N + Y + Y + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + + FK_PersonalTitle_PersonalId + PersonalId + dbo + PersonalId + PersonalName + Explicit + + Y + N + N + N + N + N + N + + + + + + + + + + + + + TitleDate + ตั้งแต่ + Date + datetime + + + + + + + Y + N + + + d MMM yy + d + N + N + N + N + N + N + N + N + + + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + Ass + %ISD_DEFAULT% + Number + tinyint + 3.0 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + + + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + Title + ตำแหน่ง + String + nvarchar + 150 + + + + + Y + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + SkillNo + ชกท. + String + nvarchar + 6 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + TitleRank + ยศ + String + nvarchar + 10 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + Command + คำสั่ง + String + nvarchar + 50 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + CommandDate + ลงวันที่ + Date + datetime + + + + + + + N + N + + + d MMM yy + d + N + N + N + N + N + N + N + N + + + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + Dept + แผนก + String + nvarchar + 75 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + PersonalTitle + 3 + dbo + PersonalTitle + PersonalTitle_ + DatabasePersons1 + RowNum + Y + Y + Y + Y + BinaryChecksum + Persons + \ No newline at end of file diff --git a/App_Code/Data Access Layer/PersonalTitleDefinition.vb b/App_Code/Data Access Layer/PersonalTitleDefinition.vb new file mode 100644 index 0000000..91fce02 --- /dev/null +++ b/App_Code/Data Access Layer/PersonalTitleDefinition.vb @@ -0,0 +1,440 @@ +Namespace Persons.Business +''' +''' Contains embedded schema and configuration data that is used by the +''' Persons.PersonalTitleTable class +''' to initialize the class's TableDefinition. +''' +''' + +Public Class PersonalTitleDefinition + +#Region "Definition (XML) for PersonalTitleDefinition table" + 'Next 407 lines contain Table Definition (XML) for table "PersonalTitleDefinition" + Private Shared _DefinitionString As String = "" +#End Region + + ''' + ''' Gets the embedded schema and configuration data for the + ''' + ''' class's TableDefinition. + ''' + ''' This function is only called once at runtime. + ''' An XML string. + Public Shared Function GetXMLString() As String + If _DefinitionString = "" Then + Dim tbf As System.Text.StringBuilder = New System.Text.StringBuilder() + tbf.Append("") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "id") + tbf.Append( "ID") + tbf.Append( "Number") + tbf.Append( "int") + tbf.Append( "10.0") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "PersonalId") + tbf.Append( "Personal") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "13") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "") + tbf.Append( "FK_PersonalTitle_PersonalId") + tbf.Append( "Persons.Business.PersonalIdTable, App_Code") + tbf.Append( "dbo") + tbf.Append( "PersonalId") + tbf.Append( "PersonalName") + tbf.Append( "Explicit") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "TitleDate") + tbf.Append( "ตั้งแต่") + tbf.Append( "Date") + tbf.Append( "datetime") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "d MMM yy") + tbf.Append( "d") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Ass") + tbf.Append( "Ass") + tbf.Append( "Number") + tbf.Append( "tinyint") + tbf.Append( "3.0") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Title") + tbf.Append( "ตำแหน่ง") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "150") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "SkillNo") + tbf.Append( "ชกท.") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "6") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "TitleRank") + tbf.Append( "ยศ") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "10") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Command") + tbf.Append( "คำสั่ง") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "50") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "CommandDate") + tbf.Append( "ลงวันที่") + tbf.Append( "Date") + tbf.Append( "datetime") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "d MMM yy") + tbf.Append( "d") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Dept") + tbf.Append( "แผนก") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "75") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "PersonalTitle") + tbf.Append( "3") + tbf.Append( "dbo") + tbf.Append( "PersonalTitle") + tbf.Append( "PersonalTitle_") + tbf.Append( "DatabasePersons1") + tbf.Append( "RowNum") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "BinaryChecksum") + tbf.Append( "Persons") + tbf.Append("") + _DefinitionString = tbf.ToString() + + End If + Return _DefinitionString + End Function + +End Class +End Namespace diff --git a/App_Code/Data Access Layer/PersonalTitleSqlTable.vb b/App_Code/Data Access Layer/PersonalTitleSqlTable.vb new file mode 100644 index 0000000..13680cf --- /dev/null +++ b/App_Code/Data Access Layer/PersonalTitleSqlTable.vb @@ -0,0 +1,47 @@ +' This is a "safe" class, meaning that it is created once +' and never overwritten. Any custom code you add to this class +' will be preserved when you regenerate your application. +' +' Typical customizations that may be done in this class include +' - overriding base class methods + +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + +Namespace Persons.Data + + ''' + ''' Used by the class to access and/or modify the database. + ''' + ''' + ''' This class is not intended to be instantiated directly. To obtain an instance of this class, + ''' use the methods of the class. + ''' + ''' + + Public Class PersonalTitleSqlTable + Inherits BasePersonalTitleSqlTable + + 'The functions below may be overridden in order to implement your own + 'logic for creating, updating, deleting, and getting individual records, + 'or for running queries that return lists of records. + + ' Creates a new record. + ' Before calling this method, column values should be set using SetColumn(). + 'Public Overloads Overrides Function CreateRecord() As KeyValue + 'End Function + + ' Updates a record in the database. + ' Before calling this method, column values should be set using SetColumn(). + 'Protected Overrides Sub UpdateRecord() + 'End Sub + + ' Deletes a record defined by a primary key value. + 'Public Overloads Overrides Sub DeleteRecord(ByVal key As KeyValue) + 'End Sub + + ' Gets a record from the database. + 'Protected Overloads Overrides Sub GetRecord() + 'End Sub + End Class +End Namespace diff --git a/App_Code/Data Access Layer/RStatus.xml b/App_Code/Data Access Layer/RStatus.xml new file mode 100644 index 0000000..e01a154 --- /dev/null +++ b/App_Code/Data Access Layer/RStatus.xml @@ -0,0 +1,115 @@ + + + + + RStatusId + %ISD_DEFAULT% + Number + tinyint + 3.0 + + + + + Y + Y + + + + + Y + N + N + N + N + Y + Y + N + + + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + RStatus + สถานภาพรับราชการ + String + nvarchar + 50 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + RStatus + 1 + dbo + RStatus + RStatus_ + DatabasePersons1 + RowNum + Y + Y + Y + Y + BinaryChecksum + Persons + \ No newline at end of file diff --git a/App_Code/Data Access Layer/RStatusDefinition.vb b/App_Code/Data Access Layer/RStatusDefinition.vb new file mode 100644 index 0000000..59e3fad --- /dev/null +++ b/App_Code/Data Access Layer/RStatusDefinition.vb @@ -0,0 +1,126 @@ +Namespace Persons.Business +''' +''' Contains embedded schema and configuration data that is used by the +''' Persons.RStatusTable class +''' to initialize the class's TableDefinition. +''' +''' + +Public Class RStatusDefinition + +#Region "Definition (XML) for RStatusDefinition table" + 'Next 93 lines contain Table Definition (XML) for table "RStatusDefinition" + Private Shared _DefinitionString As String = "" +#End Region + + ''' + ''' Gets the embedded schema and configuration data for the + ''' + ''' class's TableDefinition. + ''' + ''' This function is only called once at runtime. + ''' An XML string. + Public Shared Function GetXMLString() As String + If _DefinitionString = "" Then + Dim tbf As System.Text.StringBuilder = New System.Text.StringBuilder() + tbf.Append("") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "RStatusId") + tbf.Append( "R Status") + tbf.Append( "Number") + tbf.Append( "tinyint") + tbf.Append( "3.0") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "RStatus") + tbf.Append( "สถานภาพรับราชการ") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "50") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "RStatus") + tbf.Append( "1") + tbf.Append( "dbo") + tbf.Append( "RStatus") + tbf.Append( "RStatus_") + tbf.Append( "DatabasePersons1") + tbf.Append( "RowNum") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "BinaryChecksum") + tbf.Append( "Persons") + tbf.Append("") + _DefinitionString = tbf.ToString() + + End If + Return _DefinitionString + End Function + +End Class +End Namespace diff --git a/App_Code/Data Access Layer/RStatusSqlTable.vb b/App_Code/Data Access Layer/RStatusSqlTable.vb new file mode 100644 index 0000000..3c5028b --- /dev/null +++ b/App_Code/Data Access Layer/RStatusSqlTable.vb @@ -0,0 +1,47 @@ +' This is a "safe" class, meaning that it is created once +' and never overwritten. Any custom code you add to this class +' will be preserved when you regenerate your application. +' +' Typical customizations that may be done in this class include +' - overriding base class methods + +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + +Namespace Persons.Data + + ''' + ''' Used by the class to access and/or modify the database. + ''' + ''' + ''' This class is not intended to be instantiated directly. To obtain an instance of this class, + ''' use the methods of the class. + ''' + ''' + + Public Class RStatusSqlTable + Inherits BaseRStatusSqlTable + + 'The functions below may be overridden in order to implement your own + 'logic for creating, updating, deleting, and getting individual records, + 'or for running queries that return lists of records. + + ' Creates a new record. + ' Before calling this method, column values should be set using SetColumn(). + 'Public Overloads Overrides Function CreateRecord() As KeyValue + 'End Function + + ' Updates a record in the database. + ' Before calling this method, column values should be set using SetColumn(). + 'Protected Overrides Sub UpdateRecord() + 'End Sub + + ' Deletes a record defined by a primary key value. + 'Public Overloads Overrides Sub DeleteRecord(ByVal key As KeyValue) + 'End Sub + + ' Gets a record from the database. + 'Protected Overloads Overrides Sub GetRecord() + 'End Sub + End Class +End Namespace diff --git a/App_Code/Data Access Layer/Rank.xml b/App_Code/Data Access Layer/Rank.xml new file mode 100644 index 0000000..40d4418 --- /dev/null +++ b/App_Code/Data Access Layer/Rank.xml @@ -0,0 +1,509 @@ + + + + + RankId + %ISD_DEFAULT% + Number + int + 10.0 + + + + + Y + Y + + + + + Y + N + N + N + N + Y + Y + N + + + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + RankLevel + %ISD_DEFAULT% + Number + int + 10.0 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + + + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + ArmyId + %ISD_DEFAULT% + Number + tinyint + 3.0 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + + + N + %ISD_DEFAULT% + + + Y + + FK_Rank_Army + Army + dbo + ArmyId + Army + Explicit + + Y + N + N + N + N + N + N + + + + + + + + + + + + + ShortRank + %ISD_DEFAULT% + String + nvarchar + 50 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + ShortRankNormal + %ISD_DEFAULT% + String + nvarchar + 50 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + EShortRank + %ISD_DEFAULT% + String + nvarchar + 50 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + RankName + %ISD_DEFAULT% + String + nvarchar + 50 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + ERankName + %ISD_DEFAULT% + String + nvarchar + 50 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + RankLevelName + %ISD_DEFAULT% + String + nvarchar + 50 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + suffix + %ISD_DEFAULT% + String + nvarchar + 50 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + Rank + 2 + dbo + Rank + Rank_ + DatabasePersons1 + RowNum + Y + Y + Y + Y + BinaryChecksum + Persons + \ No newline at end of file diff --git a/App_Code/Data Access Layer/RankDefinition.vb b/App_Code/Data Access Layer/RankDefinition.vb new file mode 100644 index 0000000..29e5cab --- /dev/null +++ b/App_Code/Data Access Layer/RankDefinition.vb @@ -0,0 +1,438 @@ +Namespace Persons.Business +''' +''' Contains embedded schema and configuration data that is used by the +''' Persons.RankTable class +''' to initialize the class's TableDefinition. +''' +''' + +Public Class RankDefinition + +#Region "Definition (XML) for RankDefinition table" + 'Next 405 lines contain Table Definition (XML) for table "RankDefinition" + Private Shared _DefinitionString As String = "" +#End Region + + ''' + ''' Gets the embedded schema and configuration data for the + ''' + ''' class's TableDefinition. + ''' + ''' This function is only called once at runtime. + ''' An XML string. + Public Shared Function GetXMLString() As String + If _DefinitionString = "" Then + Dim tbf As System.Text.StringBuilder = New System.Text.StringBuilder() + tbf.Append("") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "RankId") + tbf.Append( "Rank") + tbf.Append( "Number") + tbf.Append( "int") + tbf.Append( "10.0") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "RankLevel") + tbf.Append( "Rank Level") + tbf.Append( "Number") + tbf.Append( "int") + tbf.Append( "10.0") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "ArmyId") + tbf.Append( "Army") + tbf.Append( "Number") + tbf.Append( "tinyint") + tbf.Append( "3.0") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "") + tbf.Append( "FK_Rank_Army") + tbf.Append( "Persons.Business.ArmyTable, App_Code") + tbf.Append( "dbo") + tbf.Append( "ArmyId") + tbf.Append( "Army") + tbf.Append( "Explicit") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "ShortRank") + tbf.Append( "Short Rank") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "50") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "ShortRankNormal") + tbf.Append( "Short Rank Normal") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "50") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "EShortRank") + tbf.Append( "E Short Rank") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "50") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "RankName") + tbf.Append( "Rank Name") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "50") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "ERankName") + tbf.Append( "E Rank Name") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "50") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "RankLevelName") + tbf.Append( "Rank Level Name") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "50") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "suffix") + tbf.Append( "Suffix") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "50") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Rank") + tbf.Append( "2") + tbf.Append( "dbo") + tbf.Append( "Rank") + tbf.Append( "Rank_") + tbf.Append( "DatabasePersons1") + tbf.Append( "RowNum") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "BinaryChecksum") + tbf.Append( "Persons") + tbf.Append("") + _DefinitionString = tbf.ToString() + + End If + Return _DefinitionString + End Function + +End Class +End Namespace diff --git a/App_Code/Data Access Layer/RankSqlTable.vb b/App_Code/Data Access Layer/RankSqlTable.vb new file mode 100644 index 0000000..673564a --- /dev/null +++ b/App_Code/Data Access Layer/RankSqlTable.vb @@ -0,0 +1,47 @@ +' This is a "safe" class, meaning that it is created once +' and never overwritten. Any custom code you add to this class +' will be preserved when you regenerate your application. +' +' Typical customizations that may be done in this class include +' - overriding base class methods + +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + +Namespace Persons.Data + + ''' + ''' Used by the class to access and/or modify the database. + ''' + ''' + ''' This class is not intended to be instantiated directly. To obtain an instance of this class, + ''' use the methods of the class. + ''' + ''' + + Public Class RankSqlTable + Inherits BaseRankSqlTable + + 'The functions below may be overridden in order to implement your own + 'logic for creating, updating, deleting, and getting individual records, + 'or for running queries that return lists of records. + + ' Creates a new record. + ' Before calling this method, column values should be set using SetColumn(). + 'Public Overloads Overrides Function CreateRecord() As KeyValue + 'End Function + + ' Updates a record in the database. + ' Before calling this method, column values should be set using SetColumn(). + 'Protected Overrides Sub UpdateRecord() + 'End Sub + + ' Deletes a record defined by a primary key value. + 'Public Overloads Overrides Sub DeleteRecord(ByVal key As KeyValue) + 'End Sub + + ' Gets a record from the database. + 'Protected Overloads Overrides Sub GetRecord() + 'End Sub + End Class +End Namespace diff --git a/App_Code/Data Access Layer/RelationDefinition.vb b/App_Code/Data Access Layer/RelationDefinition.vb new file mode 100644 index 0000000..dadec18 --- /dev/null +++ b/App_Code/Data Access Layer/RelationDefinition.vb @@ -0,0 +1,126 @@ +Namespace Persons.Business +''' +''' Contains embedded schema and configuration data that is used by the +''' Persons.RelationTable class +''' to initialize the class's TableDefinition. +''' +''' + +Public Class RelationDefinition + +#Region "Definition (XML) for RelationDefinition table" + 'Next 93 lines contain Table Definition (XML) for table "RelationDefinition" + Private Shared _DefinitionString As String = "" +#End Region + + ''' + ''' Gets the embedded schema and configuration data for the + ''' + ''' class's TableDefinition. + ''' + ''' This function is only called once at runtime. + ''' An XML string. + Public Shared Function GetXMLString() As String + If _DefinitionString = "" Then + Dim tbf As System.Text.StringBuilder = New System.Text.StringBuilder() + tbf.Append("") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "RelationId") + tbf.Append( "Relation") + tbf.Append( "Number") + tbf.Append( "int") + tbf.Append( "10.0") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Relation") + tbf.Append( "ความสัมพันธ์") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "50") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "relation") + tbf.Append( "1") + tbf.Append( "dbo") + tbf.Append( "Relation") + tbf.Append( "Relation_") + tbf.Append( "DatabasePersons1") + tbf.Append( "RowNum") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "BinaryChecksum") + tbf.Append( "Persons") + tbf.Append("") + _DefinitionString = tbf.ToString() + + End If + Return _DefinitionString + End Function + +End Class +End Namespace diff --git a/App_Code/Data Access Layer/RelationSqlTable.vb b/App_Code/Data Access Layer/RelationSqlTable.vb new file mode 100644 index 0000000..14c3197 --- /dev/null +++ b/App_Code/Data Access Layer/RelationSqlTable.vb @@ -0,0 +1,47 @@ +' This is a "safe" class, meaning that it is created once +' and never overwritten. Any custom code you add to this class +' will be preserved when you regenerate your application. +' +' Typical customizations that may be done in this class include +' - overriding base class methods + +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + +Namespace Persons.Data + + ''' + ''' Used by the class to access and/or modify the database. + ''' + ''' + ''' This class is not intended to be instantiated directly. To obtain an instance of this class, + ''' use the methods of the class. + ''' + ''' + + Public Class RelationSqlTable + Inherits BaseRelationSqlTable + + 'The functions below may be overridden in order to implement your own + 'logic for creating, updating, deleting, and getting individual records, + 'or for running queries that return lists of records. + + ' Creates a new record. + ' Before calling this method, column values should be set using SetColumn(). + 'Public Overloads Overrides Function CreateRecord() As KeyValue + 'End Function + + ' Updates a record in the database. + ' Before calling this method, column values should be set using SetColumn(). + 'Protected Overrides Sub UpdateRecord() + 'End Sub + + ' Deletes a record defined by a primary key value. + 'Public Overloads Overrides Sub DeleteRecord(ByVal key As KeyValue) + 'End Sub + + ' Gets a record from the database. + 'Protected Overloads Overrides Sub GetRecord() + 'End Sub + End Class +End Namespace diff --git a/App_Code/Data Access Layer/ReportProperties.xml b/App_Code/Data Access Layer/ReportProperties.xml new file mode 100644 index 0000000..f63605f --- /dev/null +++ b/App_Code/Data Access Layer/ReportProperties.xml @@ -0,0 +1,646 @@ + + + + + ReportName + %ISD_DEFAULT% + String + nvarchar + 50 + + + + + Y + Y + + + + + Y + N + N + N + N + Y + Y + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + ReportDesc + %ISD_DEFAULT% + String + nvarchar + 255 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + Logo1 + %ISD_DEFAULT% + Image + image + 2147483647 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + + + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + Logo2 + %ISD_DEFAULT% + Image + image + 2147483647 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + + + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + Heading1 + %ISD_DEFAULT% + String + nvarchar + 255 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + Heading2 + %ISD_DEFAULT% + String + nvarchar + 255 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + Heading3 + %ISD_DEFAULT% + String + nvarchar + 255 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + MarginLeft + %ISD_DEFAULT% + Number + decimal + 18.0 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + + + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + MarginTop + %ISD_DEFAULT% + Number + decimal + 18.0 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + + + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + Footer1 + %ISD_DEFAULT% + String + nvarchar + 255 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + Footer2 + %ISD_DEFAULT% + String + nvarchar + 255 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + Footer3 + %ISD_DEFAULT% + String + nvarchar + 255 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + Footer4 + %ISD_DEFAULT% + String + nvarchar + 255 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + ReportProperties + 1 + dbo + ReportProperties + ReportProperties_ + DatabasePersons1 + RowNum + Y + Y + Y + Y + BinaryChecksum + Persons + \ No newline at end of file diff --git a/App_Code/Data Access Layer/ReportPropertiesDefinition.vb b/App_Code/Data Access Layer/ReportPropertiesDefinition.vb new file mode 100644 index 0000000..e60a0e0 --- /dev/null +++ b/App_Code/Data Access Layer/ReportPropertiesDefinition.vb @@ -0,0 +1,544 @@ +Namespace Persons.Business +''' +''' Contains embedded schema and configuration data that is used by the +''' Persons.ReportPropertiesTable class +''' to initialize the class's TableDefinition. +''' +''' + +Public Class ReportPropertiesDefinition + +#Region "Definition (XML) for ReportPropertiesDefinition table" + 'Next 511 lines contain Table Definition (XML) for table "ReportPropertiesDefinition" + Private Shared _DefinitionString As String = "" +#End Region + + ''' + ''' Gets the embedded schema and configuration data for the + ''' + ''' class's TableDefinition. + ''' + ''' This function is only called once at runtime. + ''' An XML string. + Public Shared Function GetXMLString() As String + If _DefinitionString = "" Then + Dim tbf As System.Text.StringBuilder = New System.Text.StringBuilder() + tbf.Append("") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "ReportName") + tbf.Append( "Report Name") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "50") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "ReportDesc") + tbf.Append( "Report Desc") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "255") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Logo1") + tbf.Append( "Logo 1") + tbf.Append( "Image") + tbf.Append( "image") + tbf.Append( "2147483647") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Logo2") + tbf.Append( "Logo 2") + tbf.Append( "Image") + tbf.Append( "image") + tbf.Append( "2147483647") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Heading1") + tbf.Append( "Heading 1") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "255") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Heading2") + tbf.Append( "Heading 2") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "255") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Heading3") + tbf.Append( "Heading 3") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "255") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "MarginLeft") + tbf.Append( "Margin Left") + tbf.Append( "Number") + tbf.Append( "decimal") + tbf.Append( "18.0") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "MarginTop") + tbf.Append( "Margin Top") + tbf.Append( "Number") + tbf.Append( "decimal") + tbf.Append( "18.0") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Footer1") + tbf.Append( "Footer 1") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "255") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Footer2") + tbf.Append( "Footer 2") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "255") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Footer3") + tbf.Append( "Footer 3") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "255") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Footer4") + tbf.Append( "Footer 4") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "255") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "ReportProperties") + tbf.Append( "1") + tbf.Append( "dbo") + tbf.Append( "ReportProperties") + tbf.Append( "ReportProperties_") + tbf.Append( "DatabasePersons1") + tbf.Append( "RowNum") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "BinaryChecksum") + tbf.Append( "Persons") + tbf.Append("") + _DefinitionString = tbf.ToString() + + End If + Return _DefinitionString + End Function + +End Class +End Namespace diff --git a/App_Code/Data Access Layer/ReportPropertiesSqlTable.vb b/App_Code/Data Access Layer/ReportPropertiesSqlTable.vb new file mode 100644 index 0000000..ee5cc01 --- /dev/null +++ b/App_Code/Data Access Layer/ReportPropertiesSqlTable.vb @@ -0,0 +1,47 @@ +' This is a "safe" class, meaning that it is created once +' and never overwritten. Any custom code you add to this class +' will be preserved when you regenerate your application. +' +' Typical customizations that may be done in this class include +' - overriding base class methods + +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + +Namespace Persons.Data + + ''' + ''' Used by the class to access and/or modify the database. + ''' + ''' + ''' This class is not intended to be instantiated directly. To obtain an instance of this class, + ''' use the methods of the class. + ''' + ''' + + Public Class ReportPropertiesSqlTable + Inherits BaseReportPropertiesSqlTable + + 'The functions below may be overridden in order to implement your own + 'logic for creating, updating, deleting, and getting individual records, + 'or for running queries that return lists of records. + + ' Creates a new record. + ' Before calling this method, column values should be set using SetColumn(). + 'Public Overloads Overrides Function CreateRecord() As KeyValue + 'End Function + + ' Updates a record in the database. + ' Before calling this method, column values should be set using SetColumn(). + 'Protected Overrides Sub UpdateRecord() + 'End Sub + + ' Deletes a record defined by a primary key value. + 'Public Overloads Overrides Sub DeleteRecord(ByVal key As KeyValue) + 'End Sub + + ' Gets a record from the database. + 'Protected Overloads Overrides Sub GetRecord() + 'End Sub + End Class +End Namespace diff --git a/App_Code/Data Access Layer/Section.xml b/App_Code/Data Access Layer/Section.xml new file mode 100644 index 0000000..c97d11c --- /dev/null +++ b/App_Code/Data Access Layer/Section.xml @@ -0,0 +1,2710 @@ + + + + + SectionId + %ISD_DEFAULT% + Number + smallint + 5.0 + + + + + Y + Y + + + + + Y + N + N + N + N + Y + Y + N + + + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + SectionName + ชื่อส่วนราชการ + String + nvarchar + 100 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + SectionAbbvrName + ชื่อย่อ + String + nvarchar + 25 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + SectionEName + %ISD_DEFAULT% + String + nvarchar + 50 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + MarshallFull + %ISD_DEFAULT% + Number + smallint + 5.0 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + + + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + MarShall + %ISD_DEFAULT% + Number + smallint + 5.0 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + + + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + GeneralFull + %ISD_DEFAULT% + Number + smallint + 5.0 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + + + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + General + %ISD_DEFAULT% + Number + smallint + 5.0 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + + + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + LtGeneralFull + %ISD_DEFAULT% + Number + smallint + 5.0 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + + + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + LtGeneral + %ISD_DEFAULT% + Number + smallint + 5.0 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + + + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + MjGeneralFull + %ISD_DEFAULT% + Number + smallint + 5.0 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + + + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + MjGeneral + %ISD_DEFAULT% + Number + smallint + 5.0 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + + + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + SpColonelFull + %ISD_DEFAULT% + Number + smallint + 5.0 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + + + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + SpColonel + %ISD_DEFAULT% + Number + smallint + 5.0 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + + + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + ColonelFull + %ISD_DEFAULT% + Number + smallint + 5.0 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + + + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + Colonel + %ISD_DEFAULT% + Number + smallint + 5.0 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + + + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + LtColonelFull + %ISD_DEFAULT% + Number + smallint + 5.0 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + + + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + LtColonel + %ISD_DEFAULT% + Number + smallint + 5.0 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + + + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + MajorFull + %ISD_DEFAULT% + Number + smallint + 5.0 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + + + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + Major + %ISD_DEFAULT% + Number + smallint + 5.0 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + + + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + CaptianFull + %ISD_DEFAULT% + Number + smallint + 5.0 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + + + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + Captian + %ISD_DEFAULT% + Number + smallint + 5.0 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + + + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + LieutenantFull + %ISD_DEFAULT% + Number + smallint + 5.0 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + + + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + Lieutenant + %ISD_DEFAULT% + Number + smallint + 5.0 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + + + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + SubLieutenantFull + %ISD_DEFAULT% + Number + smallint + 5.0 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + + + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + SubLieutenant + %ISD_DEFAULT% + Number + smallint + 5.0 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + + + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + Sm0Full + %ISD_DEFAULT% + Number + smallint + 5.0 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + + + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + Sm0 + %ISD_DEFAULT% + Number + smallint + 5.0 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + + + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + Sm1Full + %ISD_DEFAULT% + Number + smallint + 5.0 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + + + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + Sm1 + %ISD_DEFAULT% + Number + smallint + 5.0 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + + + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + Sm2Full + %ISD_DEFAULT% + Number + smallint + 5.0 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + + + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + Sm2 + %ISD_DEFAULT% + Number + smallint + 5.0 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + + + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + Sm3Full + %ISD_DEFAULT% + Number + smallint + 5.0 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + + + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + Sm3 + %ISD_DEFAULT% + Number + smallint + 5.0 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + + + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + SgtFull + %ISD_DEFAULT% + Number + smallint + 5.0 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + + + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + Sgt + %ISD_DEFAULT% + Number + smallint + 5.0 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + + + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + CptFull + %ISD_DEFAULT% + Number + smallint + 5.0 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + + + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + Cpt + %ISD_DEFAULT% + Number + smallint + 5.0 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + + + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + PtcFull + %ISD_DEFAULT% + Number + smallint + 5.0 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + + + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + Ptc + %ISD_DEFAULT% + Number + smallint + 5.0 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + + + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + PvtVolFull + %ISD_DEFAULT% + Number + smallint + 5.0 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + + + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + PvtVol + %ISD_DEFAULT% + Number + smallint + 5.0 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + + + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + Sm4Full + %ISD_DEFAULT% + Number + smallint + 5.0 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + + + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + Sm4 + %ISD_DEFAULT% + Number + smallint + 5.0 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + + + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + PvtFull + %ISD_DEFAULT% + Number + smallint + 5.0 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + + + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + Pvt + %ISD_DEFAULT% + Number + smallint + 5.0 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + + + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + Sm4Now + %ISD_DEFAULT% + Number + smallint + 5.0 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + + + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + Pvtst + %ISD_DEFAULT% + Number + smallint + 5.0 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + + + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + Pvtnd + %ISD_DEFAULT% + Number + smallint + 5.0 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + + + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + EmpFull + %ISD_DEFAULT% + Number + smallint + 5.0 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + + + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + Emp + %ISD_DEFAULT% + Number + smallint + 5.0 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + + + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + EmpOffFull + %ISD_DEFAULT% + Number + smallint + 5.0 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + + + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + EmpOff + %ISD_DEFAULT% + Number + smallint + 5.0 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + + + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + EmpTmpFull + %ISD_DEFAULT% + Number + smallint + 5.0 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + + + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + EmpTmp + %ISD_DEFAULT% + Number + smallint + 5.0 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + + + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + Section + 2 + dbo + Section + Section_ + DatabasePersons1 + RowNum + Y + Y + Y + Y + BinaryChecksum + Persons + \ No newline at end of file diff --git a/App_Code/Data Access Layer/SectionDefinition.vb b/App_Code/Data Access Layer/SectionDefinition.vb new file mode 100644 index 0000000..8d6ce99 --- /dev/null +++ b/App_Code/Data Access Layer/SectionDefinition.vb @@ -0,0 +1,2140 @@ +Namespace Persons.Business +''' +''' Contains embedded schema and configuration data that is used by the +''' Persons.SectionTable class +''' to initialize the class's TableDefinition. +''' +''' + +Public Class SectionDefinition + +#Region "Definition (XML) for SectionDefinition table" + 'Next 2107 lines contain Table Definition (XML) for table "SectionDefinition" + Private Shared _DefinitionString As String = "" +#End Region + + ''' + ''' Gets the embedded schema and configuration data for the + ''' + ''' class's TableDefinition. + ''' + ''' This function is only called once at runtime. + ''' An XML string. + Public Shared Function GetXMLString() As String + If _DefinitionString = "" Then + Dim tbf As System.Text.StringBuilder = New System.Text.StringBuilder() + tbf.Append("") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "SectionId") + tbf.Append( "Section") + tbf.Append( "Number") + tbf.Append( "smallint") + tbf.Append( "5.0") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "SectionName") + tbf.Append( "ชื่อส่วนราชการ") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "100") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "SectionAbbvrName") + tbf.Append( "ชื่อย่อ") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "25") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "SectionEName") + tbf.Append( "Section E Name") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "50") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "MarshallFull") + tbf.Append( "Marshall Full") + tbf.Append( "Number") + tbf.Append( "smallint") + tbf.Append( "5.0") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "MarShall") + tbf.Append( "Mar Shall") + tbf.Append( "Number") + tbf.Append( "smallint") + tbf.Append( "5.0") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "GeneralFull") + tbf.Append( "General Full") + tbf.Append( "Number") + tbf.Append( "smallint") + tbf.Append( "5.0") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "General") + tbf.Append( "General") + tbf.Append( "Number") + tbf.Append( "smallint") + tbf.Append( "5.0") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "LtGeneralFull") + tbf.Append( "Lt General Full") + tbf.Append( "Number") + tbf.Append( "smallint") + tbf.Append( "5.0") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "LtGeneral") + tbf.Append( "Lt General") + tbf.Append( "Number") + tbf.Append( "smallint") + tbf.Append( "5.0") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "MjGeneralFull") + tbf.Append( "Mj General Full") + tbf.Append( "Number") + tbf.Append( "smallint") + tbf.Append( "5.0") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "MjGeneral") + tbf.Append( "Mj General") + tbf.Append( "Number") + tbf.Append( "smallint") + tbf.Append( "5.0") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "SpColonelFull") + tbf.Append( "Sp Colonel Full") + tbf.Append( "Number") + tbf.Append( "smallint") + tbf.Append( "5.0") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "SpColonel") + tbf.Append( "Sp Colonel") + tbf.Append( "Number") + tbf.Append( "smallint") + tbf.Append( "5.0") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "ColonelFull") + tbf.Append( "Colonel Full") + tbf.Append( "Number") + tbf.Append( "smallint") + tbf.Append( "5.0") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Colonel") + tbf.Append( "Colonel") + tbf.Append( "Number") + tbf.Append( "smallint") + tbf.Append( "5.0") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "LtColonelFull") + tbf.Append( "Lt Colonel Full") + tbf.Append( "Number") + tbf.Append( "smallint") + tbf.Append( "5.0") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "LtColonel") + tbf.Append( "Lt Colonel") + tbf.Append( "Number") + tbf.Append( "smallint") + tbf.Append( "5.0") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "MajorFull") + tbf.Append( "Major Full") + tbf.Append( "Number") + tbf.Append( "smallint") + tbf.Append( "5.0") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Major") + tbf.Append( "Major") + tbf.Append( "Number") + tbf.Append( "smallint") + tbf.Append( "5.0") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "CaptianFull") + tbf.Append( "Captian Full") + tbf.Append( "Number") + tbf.Append( "smallint") + tbf.Append( "5.0") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Captian") + tbf.Append( "Captian") + tbf.Append( "Number") + tbf.Append( "smallint") + tbf.Append( "5.0") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "LieutenantFull") + tbf.Append( "Lieutenant Full") + tbf.Append( "Number") + tbf.Append( "smallint") + tbf.Append( "5.0") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Lieutenant") + tbf.Append( "Lieutenant") + tbf.Append( "Number") + tbf.Append( "smallint") + tbf.Append( "5.0") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "SubLieutenantFull") + tbf.Append( "Sub Lieutenant Full") + tbf.Append( "Number") + tbf.Append( "smallint") + tbf.Append( "5.0") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "SubLieutenant") + tbf.Append( "Sub Lieutenant") + tbf.Append( "Number") + tbf.Append( "smallint") + tbf.Append( "5.0") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Sm0Full") + tbf.Append( "Sm 0 Full") + tbf.Append( "Number") + tbf.Append( "smallint") + tbf.Append( "5.0") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Sm0") + tbf.Append( "Sm 0") + tbf.Append( "Number") + tbf.Append( "smallint") + tbf.Append( "5.0") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Sm1Full") + tbf.Append( "Sm 1 Full") + tbf.Append( "Number") + tbf.Append( "smallint") + tbf.Append( "5.0") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Sm1") + tbf.Append( "Sm 1") + tbf.Append( "Number") + tbf.Append( "smallint") + tbf.Append( "5.0") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Sm2Full") + tbf.Append( "Sm 2 Full") + tbf.Append( "Number") + tbf.Append( "smallint") + tbf.Append( "5.0") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Sm2") + tbf.Append( "Sm 2") + tbf.Append( "Number") + tbf.Append( "smallint") + tbf.Append( "5.0") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Sm3Full") + tbf.Append( "Sm 3 Full") + tbf.Append( "Number") + tbf.Append( "smallint") + tbf.Append( "5.0") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Sm3") + tbf.Append( "Sm 3") + tbf.Append( "Number") + tbf.Append( "smallint") + tbf.Append( "5.0") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "SgtFull") + tbf.Append( "Sgt Full") + tbf.Append( "Number") + tbf.Append( "smallint") + tbf.Append( "5.0") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Sgt") + tbf.Append( "Sgt") + tbf.Append( "Number") + tbf.Append( "smallint") + tbf.Append( "5.0") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "CptFull") + tbf.Append( "Cpt Full") + tbf.Append( "Number") + tbf.Append( "smallint") + tbf.Append( "5.0") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Cpt") + tbf.Append( "Cpt") + tbf.Append( "Number") + tbf.Append( "smallint") + tbf.Append( "5.0") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "PtcFull") + tbf.Append( "Ptc Full") + tbf.Append( "Number") + tbf.Append( "smallint") + tbf.Append( "5.0") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Ptc") + tbf.Append( "Ptc") + tbf.Append( "Number") + tbf.Append( "smallint") + tbf.Append( "5.0") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "PvtVolFull") + tbf.Append( "Pvt Vol Full") + tbf.Append( "Number") + tbf.Append( "smallint") + tbf.Append( "5.0") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "PvtVol") + tbf.Append( "Pvt Vol") + tbf.Append( "Number") + tbf.Append( "smallint") + tbf.Append( "5.0") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Sm4Full") + tbf.Append( "Sm 4 Full") + tbf.Append( "Number") + tbf.Append( "smallint") + tbf.Append( "5.0") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Sm4") + tbf.Append( "Sm 4") + tbf.Append( "Number") + tbf.Append( "smallint") + tbf.Append( "5.0") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "PvtFull") + tbf.Append( "Pvt Full") + tbf.Append( "Number") + tbf.Append( "smallint") + tbf.Append( "5.0") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Pvt") + tbf.Append( "Pvt") + tbf.Append( "Number") + tbf.Append( "smallint") + tbf.Append( "5.0") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Sm4Now") + tbf.Append( "Sm 4 Now") + tbf.Append( "Number") + tbf.Append( "smallint") + tbf.Append( "5.0") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Pvtst") + tbf.Append( "Pvtst") + tbf.Append( "Number") + tbf.Append( "smallint") + tbf.Append( "5.0") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Pvtnd") + tbf.Append( "Pvtnd") + tbf.Append( "Number") + tbf.Append( "smallint") + tbf.Append( "5.0") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "EmpFull") + tbf.Append( "Emp Full") + tbf.Append( "Number") + tbf.Append( "smallint") + tbf.Append( "5.0") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Emp") + tbf.Append( "Emp") + tbf.Append( "Number") + tbf.Append( "smallint") + tbf.Append( "5.0") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "EmpOffFull") + tbf.Append( "Emp Off Full") + tbf.Append( "Number") + tbf.Append( "smallint") + tbf.Append( "5.0") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "EmpOff") + tbf.Append( "Emp Off") + tbf.Append( "Number") + tbf.Append( "smallint") + tbf.Append( "5.0") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "EmpTmpFull") + tbf.Append( "Emp Tmp Full") + tbf.Append( "Number") + tbf.Append( "smallint") + tbf.Append( "5.0") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "EmpTmp") + tbf.Append( "Emp Tmp") + tbf.Append( "Number") + tbf.Append( "smallint") + tbf.Append( "5.0") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Section") + tbf.Append( "2") + tbf.Append( "dbo") + tbf.Append( "Section") + tbf.Append( "Section_") + tbf.Append( "DatabasePersons1") + tbf.Append( "RowNum") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "BinaryChecksum") + tbf.Append( "Persons") + tbf.Append("") + _DefinitionString = tbf.ToString() + + End If + Return _DefinitionString + End Function + +End Class +End Namespace diff --git a/App_Code/Data Access Layer/SectionSqlTable.vb b/App_Code/Data Access Layer/SectionSqlTable.vb new file mode 100644 index 0000000..928eb18 --- /dev/null +++ b/App_Code/Data Access Layer/SectionSqlTable.vb @@ -0,0 +1,47 @@ +' This is a "safe" class, meaning that it is created once +' and never overwritten. Any custom code you add to this class +' will be preserved when you regenerate your application. +' +' Typical customizations that may be done in this class include +' - overriding base class methods + +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + +Namespace Persons.Data + + ''' + ''' Used by the class to access and/or modify the database. + ''' + ''' + ''' This class is not intended to be instantiated directly. To obtain an instance of this class, + ''' use the methods of the class. + ''' + ''' + + Public Class SectionSqlTable + Inherits BaseSectionSqlTable + + 'The functions below may be overridden in order to implement your own + 'logic for creating, updating, deleting, and getting individual records, + 'or for running queries that return lists of records. + + ' Creates a new record. + ' Before calling this method, column values should be set using SetColumn(). + 'Public Overloads Overrides Function CreateRecord() As KeyValue + 'End Function + + ' Updates a record in the database. + ' Before calling this method, column values should be set using SetColumn(). + 'Protected Overrides Sub UpdateRecord() + 'End Sub + + ' Deletes a record defined by a primary key value. + 'Public Overloads Overrides Sub DeleteRecord(ByVal key As KeyValue) + 'End Sub + + ' Gets a record from the database. + 'Protected Overloads Overrides Sub GetRecord() + 'End Sub + End Class +End Namespace diff --git a/App_Code/Data Access Layer/Sex.xml b/App_Code/Data Access Layer/Sex.xml new file mode 100644 index 0000000..4636d51 --- /dev/null +++ b/App_Code/Data Access Layer/Sex.xml @@ -0,0 +1,115 @@ + + + + + SexId + %ISD_DEFAULT% + Number + smallint + 5.0 + + + + + Y + Y + + + + + Y + N + N + N + N + Y + Y + N + + + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + Sex + %ISD_DEFAULT% + String + nvarchar + 10 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + Sex + 1 + dbo + Sex + Sex_ + DatabasePersons1 + RowNum + Y + Y + Y + Y + BinaryChecksum + Persons + \ No newline at end of file diff --git a/App_Code/Data Access Layer/SexDefinition.vb b/App_Code/Data Access Layer/SexDefinition.vb new file mode 100644 index 0000000..418983d --- /dev/null +++ b/App_Code/Data Access Layer/SexDefinition.vb @@ -0,0 +1,126 @@ +Namespace Persons.Business +''' +''' Contains embedded schema and configuration data that is used by the +''' Persons.SexTable class +''' to initialize the class's TableDefinition. +''' +''' + +Public Class SexDefinition + +#Region "Definition (XML) for SexDefinition table" + 'Next 93 lines contain Table Definition (XML) for table "SexDefinition" + Private Shared _DefinitionString As String = "" +#End Region + + ''' + ''' Gets the embedded schema and configuration data for the + ''' + ''' class's TableDefinition. + ''' + ''' This function is only called once at runtime. + ''' An XML string. + Public Shared Function GetXMLString() As String + If _DefinitionString = "" Then + Dim tbf As System.Text.StringBuilder = New System.Text.StringBuilder() + tbf.Append("") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "SexId") + tbf.Append( "Sex") + tbf.Append( "Number") + tbf.Append( "smallint") + tbf.Append( "5.0") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Sex") + tbf.Append( "Sex") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "10") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Sex") + tbf.Append( "1") + tbf.Append( "dbo") + tbf.Append( "Sex") + tbf.Append( "Sex_") + tbf.Append( "DatabasePersons1") + tbf.Append( "RowNum") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "BinaryChecksum") + tbf.Append( "Persons") + tbf.Append("") + _DefinitionString = tbf.ToString() + + End If + Return _DefinitionString + End Function + +End Class +End Namespace diff --git a/App_Code/Data Access Layer/SexSqlTable.vb b/App_Code/Data Access Layer/SexSqlTable.vb new file mode 100644 index 0000000..c971900 --- /dev/null +++ b/App_Code/Data Access Layer/SexSqlTable.vb @@ -0,0 +1,47 @@ +' This is a "safe" class, meaning that it is created once +' and never overwritten. Any custom code you add to this class +' will be preserved when you regenerate your application. +' +' Typical customizations that may be done in this class include +' - overriding base class methods + +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + +Namespace Persons.Data + + ''' + ''' Used by the class to access and/or modify the database. + ''' + ''' + ''' This class is not intended to be instantiated directly. To obtain an instance of this class, + ''' use the methods of the class. + ''' + ''' + + Public Class SexSqlTable + Inherits BaseSexSqlTable + + 'The functions below may be overridden in order to implement your own + 'logic for creating, updating, deleting, and getting individual records, + 'or for running queries that return lists of records. + + ' Creates a new record. + ' Before calling this method, column values should be set using SetColumn(). + 'Public Overloads Overrides Function CreateRecord() As KeyValue + 'End Function + + ' Updates a record in the database. + ' Before calling this method, column values should be set using SetColumn(). + 'Protected Overrides Sub UpdateRecord() + 'End Sub + + ' Deletes a record defined by a primary key value. + 'Public Overloads Overrides Sub DeleteRecord(ByVal key As KeyValue) + 'End Sub + + ' Gets a record from the database. + 'Protected Overloads Overrides Sub GetRecord() + 'End Sub + End Class +End Namespace diff --git a/App_Code/Data Access Layer/Shared/BaseFormulaEvaluator.vb b/App_Code/Data Access Layer/Shared/BaseFormulaEvaluator.vb new file mode 100644 index 0000000..f0241d7 --- /dev/null +++ b/App_Code/Data Access Layer/Shared/BaseFormulaEvaluator.vb @@ -0,0 +1,379 @@ +Imports Microsoft.VisualBasic +Imports System.IO +Imports BaseClasses.Data +Imports Ciloci.Flee +Imports BaseClasses.Utils + +Namespace Persons.Data + + ''' + ''' The BaseFormulaEvaluator class evaluates a formula passed to the Evaluate function. + ''' + ''' + Public Class BaseFormulaEvaluator + ''' + ''' Evaluator class that actually evaluates the formula. + ''' This is available as a public property, so additional options + ''' can be added to the evaluator from the calling functions. + ''' + Protected _evaluator As ExpressionContext + Public ReadOnly Property Evaluator() As ExpressionContext + Get + Return _evaluator + End Get + End Property + + ''' + ''' The Variables collection allows the passing of the variables to the Evaluator + ''' + Public ReadOnly Property Variables() As Ciloci.Flee.VariableCollection + Get + Return Evaluator.Variables + End Get + End Property + + ''' + ''' DataSource object from which each of the variables are + ''' determined. This allows direct referencing of the + ''' fields in the DataSource. For example, if the DataSource + ''' is an Order_Details record, then the formula can use something like: + ''' = UnitPrice * Quantity * (1 - Discount) + ''' to calculate the Extended Price. + ''' + Private _dataSource As BaseRecord = Nothing + Public Property DataSource() As BaseRecord + Get + Return _dataSource + End Get + Set(ByVal value As BaseRecord) + _dataSource = value + End Set + End Property + + + + ''' + ''' Create a new evaluator and prepare for evaluation. + ''' + Public Sub New(Optional ByVal mainObj As Object = Nothing) + + ' pass mainObj to contructor so that formula like = mainObj. can be evaluated + If mainObj Is Nothing Then + _evaluator = New ExpressionContext() + Else + _evaluator = New ExpressionContext(mainObj) + End If + + + ' The order of adding types is important. First we add our own + ' formula functions, followed by the generic types. + + Evaluator.Imports.AddType(GetType(BaseFormulaUtils)) + + ' ADVANCED. For advanced usage, generic types can also be imported into + ' the formula evaluator. This is done by adding types of some generic types + ' such as Math, DateTime, Convert, and String. For example, if you add the + ' Convert type, you can then use Convert.ToDecimal("string"). The second + ' parameter to the AddType is the namespace that will be used in the formula. + ' These functions expect a certain type. For example, Math functions expect + ' a Double for the most part. If you pass a string, they will throw an exception. + ' As such, we have written separate functions in FormulaUtils that are more + ' loosely-typed than the standard libraries available here. + ' Examples: + Evaluator.Imports.AddType(GetType(Math), "Math") + Evaluator.Imports.AddType(GetType(DateTime), "DateTime") + Evaluator.Imports.AddType(GetType(Convert), "Convert") + Evaluator.Imports.AddType(GetType(String), "String") + + ' We want a loosely-typed evaluation language - so do not + ' type-check any variables. + Evaluator.Options.Checked = False + + ' Our policy is to always treat real numbers as Decimal instead of + ' Double or Single to make it consistent across the entire + ' evaluator. + Evaluator.Options.RealLiteralDataType = RealLiteralDataType.Decimal + + ' The variable event handler handles the variables based on the DataSource. + AddHandler _evaluator.Variables.ResolveVariableType, AddressOf variables_ResolveVariableType + AddHandler _evaluator.Variables.ResolveVariableValue, AddressOf variables_ResolveVariableValue + End Sub + + + + ''' + ''' Evaluate the expression passed in as the string + ''' + ''' The input whose absolute value is to be found. + ''' The result of the evaluation. Can we be any data type including string, datetime, decimal, etc. + Public Overridable Function Evaluate(ByVal expression As String) As Object + If IsNothing(expression) Then Return Nothing + If expression = "" Then Return "" + + ' Strip of the = in the front of the forumula - the Expression evaluator + ' does not need it. Also, make sure to trim the result to remove any + ' spaces in the front and the back. + expression = expression.TrimStart(New Char() {"="c, " "c}).Trim() + + + ' If there are any exceptions when parsing or evaluating, they are + ' thrown so that the end user can see the error. As such, there is no + ' Try-Catch block here. + Try + Dim eDynamic As IDynamicExpression = _evaluator.CompileDynamic(expression) + Return eDynamic.Evaluate() + Catch ex As Exception + Return "ERROR: " & ex.Message + End Try + End Function + + + ''' + ''' Return the type of the given variable if it exists in the data source. + ''' If the Return Type is Nothing, the evaluator assumes this is an invalid + ''' variable and tries other methods to get its value. + ''' + ''' The sender that sent this event. + ''' The event argument. Set e.VariableType. + Protected Sub variables_ResolveVariableType(ByVal sender As Object, ByVal e As ResolveVariableTypeEventArgs) + Dim col As BaseColumn + + ' Returning Nothing indicates that we do not recognize this variable. + e.VariableType = Nothing + + ' If no DataSource was set, we do not have variables that we can use + ' directly. + If IsNothing(DataSource) Then Return + + Try + ' Find a column in the datasource using a variable name. + col = DataSource.TableAccess.TableDefinition.ColumnList.GetByCodeName(e.VariableName) + If IsNothing(col) Then + ' if the variable name ended with "DefaultValue", remmove it and then try to get the column name again. + If BaseClasses.Utils.InvariantLCase(e.VariableName).EndsWith("defaultvalue") Then + col = DataSource.TableAccess.TableDefinition.ColumnList.GetByCodeName(e.VariableName.Substring(0, e.VariableName.Length - 12)) + End If + End If + + If IsNothing(col) Then + Return + End If + + Select Case col.ColumnType + Case BaseColumn.ColumnTypes.Number, _ + BaseColumn.ColumnTypes.Percentage, _ + BaseColumn.ColumnTypes.Star + ' By default, all our internal data types use Decimal. + ' This may result in problems when using the Math library + ' but it reduces the problem by allowing us to loosely-type + ' all data source properties. + e.VariableType = GetType(Decimal) + + Case BaseColumn.ColumnTypes.Currency + ' Convert currency into decimal to allow easier use in formulas + e.VariableType = GetType(Decimal) + + Case BaseColumn.ColumnTypes.Boolean + ' Boolean data types are maintained as Boolean and not + ' converted to Integer as the Binary data type is. + e.VariableType = GetType(Boolean) + + Case BaseColumn.ColumnTypes.Credit_Card_Date, _ + BaseColumn.ColumnTypes.Date + ' Use DateTme even for Credit Card Date. + e.VariableType = GetType(DateTime) + + Case BaseColumn.ColumnTypes.Country, _ + BaseColumn.ColumnTypes.Credit_Card_Number, _ + BaseColumn.ColumnTypes.Email, _ + BaseColumn.ColumnTypes.Password, _ + BaseColumn.ColumnTypes.String, _ + BaseColumn.ColumnTypes.Unique_Identifier, _ + BaseColumn.ColumnTypes.USA_Phone_Number, _ + BaseColumn.ColumnTypes.USA_State, _ + BaseColumn.ColumnTypes.USA_Zip_Code, _ + BaseColumn.ColumnTypes.Very_Large_String, _ + BaseColumn.ColumnTypes.Web_Url + ' For the purpose of formula's, all of the above field types + ' are treated as strings. + e.VariableType = GetType(String) + + Case BaseColumn.ColumnTypes.Binary, _ + BaseColumn.ColumnTypes.File, _ + BaseColumn.ColumnTypes.Image + ' For the purpose of formula's we ignore BLOB fields since they + ' cannot be used in any calculations or string functions. + e.VariableType = Nothing + + Case Else + ' Unknown data type. + e.VariableType = Nothing + End Select + + Catch ex As Exception + ' Ignore the error in case we cannot find the variable or its type - simply say that + ' the Variable Type is Nothing - implying that we do not recognize this variable. + End Try + End Sub + + + ''' + ''' Return the value of the given variable if it exists in the data source + ''' + ''' The input whose absolute value is to be found. + ''' The input whose absolute value is to be found. + Protected Sub variables_ResolveVariableValue(ByVal sender As Object, ByVal e As ResolveVariableValueEventArgs) + Dim col As BaseColumn + + ' Default value is Nothing + e.VariableValue = Nothing + + ' If no DataSource was set, we do not have variables that we can use + ' directly. We should not get here since the request for Type should have + ' caught this. + If IsNothing(DataSource) Then Return + + Try + + ' Find a column in the datasource using a variable name. + col = DataSource.TableAccess.TableDefinition.ColumnList.GetByCodeName(e.VariableName) + If IsNothing(col) Then + ' if the variable name ended with "DefaultValue", remmove it and then try to get the column name again. + If BaseClasses.Utils.InvariantLCase(e.VariableName).EndsWith("defaultvalue") Then + col = DataSource.TableAccess.TableDefinition.ColumnList.GetByCodeName(e.VariableName.Substring(0, e.VariableName.Length - 12)) + + Select Case col.ColumnType + Case BaseColumn.ColumnTypes.Number, _ + BaseColumn.ColumnTypes.Percentage, _ + BaseColumn.ColumnTypes.Star + ' The Number and Percentage values are saved as Single. So we first + ' retrieve the Single value and then convert to Decimal. Our policy is + ' always to return Decimal (never to return Single or Double) to be constent + ' and avoid type conversion in the evaluator. + e.VariableValue = BaseFormulaUtils.ParseDecimal(col.DefaultValue) + + Case BaseColumn.ColumnTypes.Currency + e.VariableValue = Me.DataSource.GetValue(col).ToDecimal + + Case BaseColumn.ColumnTypes.Boolean + e.VariableValue = col.DefaultValue + Case BaseColumn.ColumnTypes.Credit_Card_Date, _ + BaseColumn.ColumnTypes.Date + e.VariableValue = BaseFormulaUtils.ParseDate(col.DefaultValue) + + Case BaseColumn.ColumnTypes.Country, _ + BaseColumn.ColumnTypes.Credit_Card_Number, _ + BaseColumn.ColumnTypes.Email, _ + BaseColumn.ColumnTypes.Password, _ + BaseColumn.ColumnTypes.String, _ + BaseColumn.ColumnTypes.Unique_Identifier, _ + BaseColumn.ColumnTypes.USA_Phone_Number, _ + BaseColumn.ColumnTypes.USA_State, _ + BaseColumn.ColumnTypes.USA_Zip_Code, _ + BaseColumn.ColumnTypes.Very_Large_String, _ + BaseColumn.ColumnTypes.Web_Url + e.VariableValue = col.DefaultValue + + Case BaseColumn.ColumnTypes.File, _ + BaseColumn.ColumnTypes.Image + ' Can't do anything here. + e.VariableValue = Nothing + + Case Else + e.VariableValue = Nothing + End Select + End If + + + Else + + + Select Case col.ColumnType + Case BaseColumn.ColumnTypes.Number, _ + BaseColumn.ColumnTypes.Percentage, _ + BaseColumn.ColumnTypes.Star + ' The Number and Percentage values are saved as Single. So we first + ' retrieve the Single value and then convert to Decimal. Our policy is + ' always to return Decimal (never to return Single or Double) to be constent + ' and avoid type conversion in the evaluator. + e.VariableValue = Decimal.Parse(Me.DataSource.GetValue(col).ToDouble().ToString()) + + Case BaseColumn.ColumnTypes.Currency + e.VariableValue = Me.DataSource.GetValue(col).ToDecimal + + Case BaseColumn.ColumnTypes.Boolean + e.VariableValue = Me.DataSource.GetValue(col).ToBoolean + + Case BaseColumn.ColumnTypes.Credit_Card_Date, _ + BaseColumn.ColumnTypes.Date + e.VariableValue = Me.DataSource.GetValue(col).ToDateTime + + Case BaseColumn.ColumnTypes.Country, _ + BaseColumn.ColumnTypes.Credit_Card_Number, _ + BaseColumn.ColumnTypes.Email, _ + BaseColumn.ColumnTypes.Password, _ + BaseColumn.ColumnTypes.String, _ + BaseColumn.ColumnTypes.Unique_Identifier, _ + BaseColumn.ColumnTypes.USA_Phone_Number, _ + BaseColumn.ColumnTypes.USA_State, _ + BaseColumn.ColumnTypes.USA_Zip_Code, _ + BaseColumn.ColumnTypes.Very_Large_String, _ + BaseColumn.ColumnTypes.Web_Url + e.VariableValue = Me.DataSource.GetValue(col).ToString + + Case BaseColumn.ColumnTypes.File, _ + BaseColumn.ColumnTypes.Image + ' Can't do anything here. + e.VariableValue = Nothing + + Case Else + e.VariableValue = Nothing + End Select + + + End If + + + Catch ex As Exception + ' Ignore the error in case we cannot find the variable or its type - simply say that + ' the Variable Type is Nothing - implying that we do not recognize this variable. + End Try + End Sub + + 'This method returns true or false value stating whether to apply GlobalWhereClause to a particular page or not. + 'Use this method to exclude pages from applying Global Where Clauses sepcified in Batch Meister Wizard. + Public Shared Function ShouldApplyGlobalWhereClause(ByVal globalWhereClauseFormula As String) As Boolean + + If System.Web.HttpContext.Current Is Nothing Then + Return False + End If + + 'Comment out the following code if you want to apply GlobalWhereClause to SignIn and SignOut pages + If Not (BaseClasses.Configuration.ApplicationSettings.Current.AuthenticationType = BaseClasses.Configuration.SecurityConstants.None) Then + If Not BaseClasses.Configuration.ApplicationSettings.Current.SecurityDisabled Then + If globalWhereClauseFormula.ToLower().Contains("userid()") Or globalWhereClauseFormula.ToLower().Contains("username()") Or _ + globalWhereClauseFormula.ToLower().Contains("roles()") Then + + If (System.Web.HttpContext.Current.Request.Url.AbsolutePath.ToLower().Contains(BaseClasses.Configuration.ApplicationSettings.Current.SignInPageUrl.ToString().ToLower())) Then + Return False + End If + If (System.Web.HttpContext.Current.Request.Url.AbsolutePath.ToLower().Contains(BaseClasses.Configuration.ApplicationSettings.Current.SignedOutPageUrl.ToString().ToLower())) Then + Return False + End If + If (System.Web.HttpContext.Current.Request.Url.AbsolutePath.ToLower().Contains(BaseClasses.Configuration.ApplicationSettings.Current.ForgotUserPageUrl.ToString().ToLower())) Then + Return False + End If + If (System.Web.HttpContext.Current.Request.Url.AbsolutePath.ToLower().Contains(BaseClasses.Configuration.ApplicationSettings.Current.SendUserInfoEmailUrl.ToString().ToLower())) Then + Return False + End If + + End If + End If + End If + Return True + End Function + + + End Class + +End Namespace diff --git a/App_Code/Data Access Layer/Shared/BaseFormulaUtils.vb b/App_Code/Data Access Layer/Shared/BaseFormulaUtils.vb new file mode 100644 index 0000000..34e0e1e --- /dev/null +++ b/App_Code/Data Access Layer/Shared/BaseFormulaUtils.vb @@ -0,0 +1,1643 @@ +Option Strict On +Imports Microsoft.VisualBasic +Imports System.IO +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Utils + +Namespace Persons.Data + + ''' + ''' The FormulaUtils class contains a set of functions that are available + ''' in the Formula editor. You can specify any of these funct8ions after + ''' the = sign. + ''' For example, you can say: + ''' = IsEven(32) + ''' These functions throw an exception on an error. The formula evaluator + ''' catches this exception and returns the error string to the user interface. + ''' + ''' All of the functions operate as a Decimal. The Decimal data type is better + ''' then Double or Single since it provides a more accurate value as compared to + ''' Double, and a larger value as compared to a Single. All integers, doubles, etc. + ''' are converted to Decimals as part of these functions. + ''' + ''' Function names are not case sensitive. So you can use ROUND, Round, round, etc. + ''' + ''' + ''' + Public Class BaseFormulaUtils +#Region "DataSource Lookup Functions" + Public Shared Function Lookup(ByVal dataSourceName As DataSource, _ + ByVal rowNumber As Object, _ + ByVal id As Object, _ + ByVal idColumn As Object, _ + ByVal valueColumn As Object) As Object + Return dataSourceName.Lookup(rowNumber, id, idColumn, valueColumn) + + End Function + + Public Shared Function Lookup(ByVal dataSourceName As DataSource, _ + ByVal id As Object, ByVal format As String) As String + Dim val As Object = dataSourceName.Lookup(Nothing, id, Nothing, Nothing) + If val Is Nothing Then + val = "" + End If + Return BaseFormulaUtils.Format(val, format) + + End Function + + Public Shared Function Lookup(ByVal dataSourceName As DataSource, _ + ByVal id As Object) As String + Dim val As Object = dataSourceName.Lookup(Nothing, id, Nothing, Nothing) + If val Is Nothing Then + val = "" + End If + Return BaseFormulaUtils.Format(val, "") + + End Function + +#End Region + +#Region "Information Functions" + + ''' + ''' Check if the number is Even or not. + ''' The number can be specified as an integer (e.g., 37), a decimal + ''' value (e.g., 37.48), as a string with an optional currency symbol and + ''' separators ("1,234.56", "$1,234.56"), or as the value of a + ''' variable (e.g, UnitPrice). + ''' + ''' Number to be checked + ''' True if the input is even, False otherwise. + Public Shared Function IsEven(ByVal val As Object) As Boolean + Dim valDecimal As Decimal = 0 + Try + valDecimal = ParseDecimal(val) + Return (valDecimal Mod 2 = 0) + Catch ex As Exception + Throw New Exception("ISEVEN(" & GetStr(val) & "): " & ex.Message) + End Try + End Function + + ''' + ''' Check if the input is odd or not + ''' The number can be specified as an integer (e.g., 37), a decimal + ''' value (e.g., 37.48), as a string with an optional currency symbol and + ''' separators ("1,234.56", "$1,234.56"), or as the value of a + ''' variable (e.g, UnitPrice). + ''' + ''' Number to be checked + ''' True if the input is odd, False otherwise. + Public Shared Function IsOdd(ByVal val As Object) As Boolean + Dim valDecimal As Decimal + Try + valDecimal = ParseDecimal(val) + Return (valDecimal Mod 2 <> 0) + Catch ex As Exception + Throw New Exception("ISODD(" & GetStr(val) & "): " & ex.Message) + End Try + End Function + + ''' + ''' Check if the input is a number or not + ''' The number can be specified as an integer (e.g., 37), a decimal + ''' value (e.g., 37.48), as a string with an optional currency symbol and + ''' separators ("1,234.56", "$1,234.56"), or as the value of a + ''' variable (e.g, UnitPrice). + ''' + ''' Number to be checked + ''' True if the input is a number, False otherwise. + Public Shared Function IsNumber(ByVal val As Object) As Boolean + Dim valDecimal As Decimal + Try + valDecimal = ParseDecimal(val) + ' If we are successfully parsing the number, then return True + Return True + Catch + ' Ignore exception, just fall through and return false + End Try + Return False + End Function + + ''' + ''' Check if the input is logical or not + ''' + ''' Value to be checked + ''' True if the input is a boolean, False otherwise. + Public Shared Function IsLogical(ByVal val As Object) As Boolean + Dim valBoolean As Boolean + Try + valBoolean = Convert.ToBoolean(val) + ' If we are able to successfully convert the value, then return True + Return True + Catch + ' Ignore exception, just fall through and return false + End Try + Return False + End Function + + ''' + ''' Check if the input is null or not + ''' + ''' Value to be checked + ''' True if the input is null + Public Shared Function IsNull(ByVal val As Object) As Boolean + ' If val is nothing, then return True + Return (IsNothing(val)) + End Function + + ''' + ''' Check if the value entered is blank or not. A NULL value is considered blank. + ''' + ''' Value to be checked + ''' True if the input is blank + Public Shared Function IsBlank(ByVal val As Object) As Boolean + If IsNothing(val) Then Return True + + If val.GetType Is GetType(String) AndAlso CType(val, String).Trim.Length = 0 Then Return True + + Return False + End Function + + ''' + ''' Check if the value entered is a text or not + ''' + ''' Value to be checked + ''' True if the input is text + Public Shared Function IsText(ByVal val As Object) As Boolean + If IsNothing(val) Then Return False + + If (val.GetType() Is GetType(String)) Then Return True + + Return False + End Function + +#End Region + +#Region "Mathematical Functions" + + ''' + ''' Calculate the absolute value of the argument passed + ''' The number can be specified as an integer (e.g., 37), a decimal + ''' value (e.g., 37.48), as a string with an optional currency symbol and + ''' separators ("1,234.56", "$1,234.56"), or as the value of a + ''' variable (e.g, UnitPrice). + ''' + ''' The input whose absolute value is to be found. + ''' The absolute value of the number. + Public Shared Function Abs(ByVal val As Object) As Decimal + Try + Return Math.Abs(ParseDecimal(val)) + Catch ex As Exception + Throw New Exception("ABS(" & GetStr(val) & "): " & ex.Message) + End Try + End Function + + ''' + ''' Calculate the ceiling value of the argument passed + ''' The number can be specified as an integer (e.g., 37), a decimal + ''' value (e.g., 37.48), as a string with an optional currency symbol and + ''' separators ("1,234.56", "$1,234.56"), or as the value of a + ''' variable (e.g, UnitPrice). + ''' + ''' The input whose ceiling value is to be calculated. + ''' The ceiling value of the number. + Public Shared Function Ceiling(ByVal val As Object) As Decimal + Try + Return Math.Ceiling(ParseDecimal(val)) + Catch ex As Exception + Throw New Exception("CEILING(" & GetStr(val) & "): " & ex.Message) + End Try + End Function + + ''' + ''' Calculates the exponential value of the input + ''' The number can be specified as an integer (e.g., 37), a decimal + ''' value (e.g., 37.48), as a string with an optional currency symbol and + ''' separators ("1,234.56", "$1,234.56"), or as the value of a + ''' variable (e.g, UnitPrice). + ''' + ''' The input whose exponential value to be calculated + ''' + ''' The exponential value of the input + ''' + Public Shared Function Exp(ByVal val As Object) As Decimal + Try + Return Convert.ToDecimal(Math.Exp(ParseDecimal(val))) + Catch ex As Exception + Throw New Exception("EXP(" & GetStr(val) & "): " & ex.Message) + End Try + End Function + + ''' + ''' Calculates the floor value of the input + ''' The number can be specified as an integer (e.g., 37), a decimal + ''' value (e.g., 37.48), as a string with an optional currency symbol and + ''' separators ("1,234.56", "$1,234.56"), or as the value of a + ''' variable (e.g, UnitPrice). + ''' + ''' The input whose floor value to be calculated + ''' + ''' The floor value of the input + ''' + Public Shared Function Floor(ByVal val As Object) As Decimal + Try + Return Math.Floor(ParseDecimal(val)) + Catch ex As Exception + Throw New Exception("FLOOR(" & GetStr(val) & "): " & ex.Message) + End Try + End Function + + ''' + ''' Calculates the mod value of the division + ''' The number can be specified as an integer (e.g., 37), a decimal + ''' value (e.g., 37.48), as a string with an optional currency symbol and + ''' separators ("1,234.56", "$1,234.56"), or as the value of a + ''' variable (e.g, UnitPrice). + ''' + ''' The dividend + ''' The divisor + ''' + ''' The mod value of the division. + ''' + Public Shared Function Modulus(ByVal dividend As Object, ByVal divisor As Object) As Decimal + Dim dividendDecimal As Decimal = 0 + Dim divisorDecimal As Decimal = 0 + Try + dividendDecimal = ParseDecimal(dividend) + divisorDecimal = ParseDecimal(divisor) + Return dividendDecimal Mod divisorDecimal + Catch ex As Exception + Throw New Exception("MODULUS(" & GetStr(dividendDecimal) & ", " & GetStr(divisorDecimal) & "): " & ex.Message) + End Try + End Function + + ''' + ''' Calculate the value of val1 raised to the power of val2 + ''' The number can be specified as an integer (e.g., 37), a decimal + ''' value (e.g., 37.48), as a string with an optional currency symbol and + ''' separators ("1,234.56", "$1,234.56"), or as the value of a + ''' variable (e.g, UnitPrice). + ''' + ''' The base + ''' The power + ''' + ''' The val1 raised to the power of val2 + ''' + Public Shared Function Power(ByVal val1 As Object, ByVal val2 As Object) As Decimal + Try + Return Convert.ToDecimal(Math.Pow(ParseDecimal(val1), ParseDecimal(val2))) + Catch ex As Exception + Throw New Exception("POWER(" & GetStr(val1) & ", " & GetStr(val2) & "): " & ex.Message) + End Try + End Function + + ''' + ''' Return the value of PI as a Decimal. + ''' + Public Shared Function Pi() As Decimal + Return Convert.ToDecimal(Math.PI) + End Function + + ''' + ''' Calculate the quotient of the division + ''' The number(s) can be specified as an integer (e.g., 37), a decimal + ''' value (e.g., 37.48), as a string with an optional currency symbol and + ''' separators ("1,234.56", "$1,234.56"), or as the value of a + ''' variable (e.g, UnitPrice). + ''' + ''' The dividend of the division + ''' The divisor of the division + ''' + ''' The quotient of the division. + ''' + Public Shared Function Quotient(ByVal dividend As Object, ByVal divisor As Object) As Decimal + Try + ' \ is used for integer value of division + Return Convert.ToDecimal(CInt(dividend) \ CInt(divisor)) + Catch ex As Exception + Throw New Exception("QUOTIENT(" & GetStr(dividend) & ", " & GetStr(divisor) & "): " & ex.Message) + End Try + End Function + + ''' + ''' Round value up to the specified number of decimal places + ''' The number(s) can be specified as an integer (e.g., 37), a decimal + ''' value (e.g., 37.48), as a string with an optional currency symbol and + ''' separators ("1,234.56", "$1,234.56"), or as the value of a + ''' variable (e.g, UnitPrice). + ''' + ''' Number to be rounded + ''' Number of decimals to be rounded upto + ''' The rounded up value. + Public Shared Function Round(ByVal number As Object, ByVal numberOfDigits As Object) As Decimal + Try + Return Math.Round(ParseDecimal(number), CInt(ParseInteger(numberOfDigits))) + Catch ex As Exception + Throw New Exception("ROUND(" & GetStr(number) & ", " & GetStr(numberOfDigits) & "): " & ex.Message) + End Try + End Function + + ''' + ''' Calculate the square root value of the input + ''' The number(s) can be specified as an integer (e.g., 37), a decimal + ''' value (e.g., 37.48), as a string with an optional currency symbol and + ''' separators ("1,234.56", "$1,234.56"), or as the value of a + ''' variable (e.g, UnitPrice). + ''' + ''' The argument whose square root is to be calculated + ''' The square root. + Public Shared Function Sqrt(ByVal val As Object) As Decimal + Try + Return Convert.ToDecimal(Math.Sqrt(ParseDecimal(val))) + Catch ex As Exception + Throw New Exception("SQRT(" & GetStr(val) & "): " & ex.Message) + End Try + End Function + + ''' + ''' Calculate the truncated value of the input + ''' The number(s) can be specified as an integer (e.g., 37), a decimal + ''' value (e.g., 37.48), as a string with an optional currency symbol and + ''' separators ("1,234.56", "$1,234.56"), or as the value of a + ''' variable (e.g, UnitPrice). + ''' + ''' The argument whose truncated value is to be calculated + ''' The truncated value. + Public Shared Function Trunc(ByVal val As Object) As Decimal + Try + Return Convert.ToDecimal(Math.Truncate(ParseDecimal(val))) + Catch ex As Exception + Throw New Exception("TRUNC(" & GetStr(val) & "): " & ex.Message) + End Try + End Function + + ''' + ''' Calculate the logarithmic value to the specified base + ''' The number(s) can be specified as an integer (e.g., 37), a decimal + ''' value (e.g., 37.48), as a string with an optional currency symbol and + ''' separators ("1,234.56", "$1,234.56"), or as the value of a + ''' variable (e.g, UnitPrice). + ''' + ''' The argument whose log value is to be calculated + ''' The base of the log value + ''' The log value + Public Shared Function Log(ByVal val1 As Object, ByVal val2 As Object) As Decimal + Try + Return Convert.ToDecimal(Math.Log(ParseDecimal(val1), ParseDecimal(val2))) + Catch ex As Exception + Throw New Exception("LOG(" & GetStr(val1) & ", " & GetStr(val2) & "): " & ex.Message) + End Try + End Function + + ''' + ''' Calculate the logarithmic value to the base 10 + ''' The number(s) can be specified as an integer (e.g., 37), a decimal + ''' value (e.g., 37.48), as a string with an optional currency symbol and + ''' separators ("1,234.56", "$1,234.56"), or as the value of a + ''' variable (e.g, UnitPrice). + ''' + ''' The argument whose log value is to be calculated + ''' The log value. + Public Shared Function Log(ByVal val As Object) As Decimal + Try + Return Convert.ToDecimal(Math.Log10(ParseDecimal(val))) + Catch ex As Exception + Throw New Exception("LOG(" & GetStr(val) & "): " & ex.Message) + End Try + End Function + +#End Region + +#Region "Boolean Functions" + + ''' + ''' Calculate the AND value of the input array + ''' The value can be specified as a decimal value (e.g., 37.48), + ''' as a string (“True”), as a Boolean (e.g., True), as an expression (e.g., 1+1=2), + ''' or as the value of a variable (e.g, UnitPrice). + ''' + ''' The array of booleans whose AND value is to be calculated + ''' The and value. + Public Shared Function And1(ByVal ParamArray args As Object()) As Boolean + Dim andValue As Boolean = True + ' Iterate the loop to get the individual values from the group of parameters + For Each booleanValue As Object In args + If (Not IsNothing(booleanValue)) Then + Try + andValue = andValue AndAlso Convert.ToBoolean(booleanValue) + If (andValue = False) Then Return andValue + Catch + 'if a value is non-boolean, we will ignore this value. + End Try + End If + Next + Return andValue + End Function + + ''' + ''' Calculate the OR value of the input array + ''' The value can be specified as a decimal value (e.g., 37.48), + ''' as a string (“True”), as a Boolean (e.g., True), as an expression (e.g., 1+1=2), + ''' or as the value of a variable (e.g, UnitPrice). + ''' + ''' The array of booleans whose OR value is to be calculated + ''' The or value. + Public Shared Function Or1(ByVal ParamArray args As Object()) As Boolean + Dim orValue As Boolean = False + ' Iterate the loop to get the individual values from the group of parameters + For Each booleanValue As Object In args + If (Not IsNothing(booleanValue)) Then + Try + orValue = orValue OrElse Convert.ToBoolean(booleanValue) + If (orValue = False) Then Return orValue + Catch + 'if a value is non-boolean, we will ignore this value. + End Try + End If + Next + Return orValue + End Function + + ''' + ''' Calculate the NOT value of the specified boolean value + ''' + ''' The boolean value whose NOT is to be determined + ''' The not value. + Public Shared Function Not1(ByVal value As Object) As Boolean + Dim notValue As Boolean = False + Try + Return Not Convert.ToBoolean(value) + Catch ex As Exception + Throw New Exception("NOT1(" & GetStr(value) & "): " & ex.Message) + End Try + End Function +#End Region + +#Region "String Functions" + + ''' + ''' Return a character for the corresponding ascii value + ''' + ''' Ascii Value + ''' Charcter for the corresponding ascii value + Public Shared Function Character(ByVal val As Object) As Char + Try + Return Convert.ToChar(val) + Catch ex As Exception + Throw New Exception("CHARACTER(" & GetStr(val) & "): " & ex.Message) + End Try + End Function + + ''' + ''' Check if two strings are exactly same or not + ''' + ''' 1st String + ''' 2nd String + ''' True if the two strings are exactly same else returns false + Public Shared Function Exact(ByVal val1 As Object, ByVal val2 As Object) As Boolean + Try + val1 = GetStr(val1) + val2 = GetStr(val2) + If (val1.Equals(val2)) Then + Return True + Else : Return False + End If + Catch ex As Exception + Throw New Exception("EXACT(" & GetStr(val1) & ", " & GetStr(val2) & "): " & ex.Message) + End Try + End Function + + ''' + ''' Find the index of the occurrence of the 1st string in the 2nd string specified + ''' + ''' String to be searched + ''' String to be searched in + ''' The index of the occurrence of the 1st string in the 2nd string and -1 if the string not found + Public Shared Function Find(ByVal val1 As Object, ByVal val2 As Object) As Integer + Dim val1String As String = String.Empty + Dim val2String As String = String.Empty + Try + If Not IsNothing(val1) Then val1String = val1.ToString + If Not IsNothing(val2) Then val2String = val2.ToString + + Return val2String.IndexOf(val1String, 0) + Catch ex As Exception + Throw New Exception("FIND(" & GetStr(val1) & ", " & GetStr(val2) & "): " & ex.Message) + End Try + End Function + + ''' + ''' Find the index of the occurrence of the 1st string in the 2nd string, + ''' the search starts after a specified start position + ''' + ''' String to be searched + ''' String to be searched in + ''' The position after which the search should start + ''' The index of the occurrence of the 1st string in the 2nd string and -1 if the string is not found + Public Shared Function Find(ByVal val1 As Object, ByVal val2 As Object, ByVal index As Integer) As Integer + Dim val1String As String = String.Empty + Dim val2String As String = String.Empty + Try + If Not IsNothing(val1) Then val1String = val1.ToString + If Not IsNothing(val2) Then val2String = val2.ToString + + Return val2String.IndexOf(val1String, index) + Catch ex As Exception + Throw New Exception("FIND(" & GetStr(val1) & ", " & GetStr(val2) & ", " & index & "): " & ex.Message) + End Try + End Function + + ''' + ''' Returns the string from left till the index mentioned + ''' + ''' String to be operated upon + ''' The length of string to be returned + ''' The string of specified length from the start + Public Shared Function Left(ByVal str As Object, ByVal length As Integer) As String + Dim inputString As String = String.Empty + Try + If Not IsNothing(str) Then inputString = str.ToString + + Return inputString.Substring(0, length) + Catch ex As Exception + Throw New Exception("LEFT(" & GetStr(str) & ", " & length & "): " & ex.Message) + End Try + End Function + + ''' + ''' Returns the specified number of characters from the right end of the string + ''' + ''' String to be operated upon + ''' The number of characters + ''' The specified number of characters from the right end of the string + Public Shared Function Right(ByVal str As Object, ByVal length As Integer) As String + Dim inputString As String = String.Empty + Try + If Not IsNothing(str) Then inputString = str.ToString + + Return inputString.Substring(inputString.Length - length, length) + Catch ex As Exception + Throw New Exception("RIGHT(" & GetStr(str) & ", " & length & "): " & ex.Message) + End Try + End Function + + ''' + ''' Returns the left most character of the string + ''' + ''' String to be operated upon + ''' The first character of string + Public Shared Function Left(ByVal str As Object) As String + Dim inputString As String = String.Empty + Try + If Not IsNothing(str) Then inputString = str.ToString + Return inputString.Substring(0, 1) + Catch ex As Exception + Throw New Exception("LEFT(" & GetStr(str) & "): " & ex.Message) + End Try + End Function + + ''' + ''' Returns the right most character of the string + ''' + ''' String to be operated upon + ''' The last character of a string + Public Shared Function Right(ByVal str As Object) As String + Dim inputString As String = String.Empty + Try + If Not IsNothing(str) Then inputString = str.ToString + Return inputString.Substring(inputString.Length - 1, 1) + Catch ex As Exception + Throw New Exception("RIGHT(" & GetStr(str) & "): " & ex.Message) + End Try + End Function + + ''' + ''' Returns the length of the string + ''' + ''' String to be operated upon + ''' The length of the string + Public Shared Function Len(ByVal str As Object) As Integer + Dim inputString As String = String.Empty + Try + If Not IsNothing(str) Then inputString = str.ToString + Return inputString.Length + Catch ex As Exception + Throw New Exception("LEN(" & GetStr(str) & "): " & ex.Message) + End Try + End Function + + ''' + ''' Converts the string to lower case + ''' + ''' String to be operated upon + ''' The string which is lower case + Public Shared Function Lower(ByVal str As Object) As String + Dim inputString As String = String.Empty + Try + If Not IsNothing(str) Then inputString = str.ToString + Return inputString.ToLower() + Catch ex As Exception + Throw New Exception("LOWER(" & GetStr(str) & "): " & ex.Message) + End Try + End Function + + ''' + ''' Converts the string to upper case + ''' + ''' String to be operated upon + ''' The string which is upper case + Public Shared Function Upper(ByVal str As Object) As String + Dim inputString As String = String.Empty + Try + If Not IsNothing(str) Then inputString = str.ToString + Return inputString.ToUpper() + Catch ex As Exception + Throw New Exception("UPPER(" & GetStr(str) & "): " & ex.Message) + End Try + End Function + + ''' + ''' Retrieves the substring from the specified index and of specified length + ''' + ''' String to be operated upon + ''' The start index of retrieval + ''' Length of the string to be retrieved + ''' The substring + Public Shared Function Mid(ByVal str As Object, ByVal startIndex As Integer, ByVal length As Integer) As String + Dim inputString As String = String.Empty + Try + If Not IsNothing(str) Then inputString = str.ToString + Return inputString.Substring(startIndex, length) + Catch ex As Exception + Throw New Exception("MID(" & GetStr(str) & ", " & startIndex & ", " & length & "): " & ex.Message) + End Try + End Function + + ''' + ''' Retrieves the substring from the specified index and of specified length + ''' + ''' String to be operated upon + ''' The start index of retrieval + ''' Length of the string to be retrieved + ''' The substring + Public Shared Function Substring(ByVal str As Object, ByVal startIndex As Integer, ByVal length As Integer) As String + Dim inputString As String = String.Empty + Try + If Not IsNothing(str) Then inputString = str.ToString + Return inputString.Substring(startIndex, length) + Catch ex As Exception + Throw New Exception("SUBSTRING(" & GetStr(str) & ", " & startIndex & ", " & length & "): " & ex.Message) + End Try + End Function + + ''' + ''' Retrieves the substring from the specified index till the end of the string + ''' + ''' String to be operated upon + ''' The start index of retrieval + ''' The substring + Public Shared Function Substring(ByVal str As Object, ByVal startIndex As Integer) As String + Dim inputString As String = String.Empty + Try + If Not IsNothing(str) Then inputString = str.ToString + ' As we are using a 1 based indexing we are using .Length + ' which returns the exact length + Return inputString.Substring(startIndex, inputString.Length - startIndex) + Catch ex As Exception + Throw New Exception("SUBSTRING(" & GetStr(str) & ", " & startIndex & "): " & ex.Message) + End Try + End Function + + ''' + ''' Capitalizes the first character of the string passed. + ''' + ''' String to be operated upon + ''' The Capitalized string + Public Shared Function Capitalize(ByVal str As Object) As String + Dim inputString As String = String.Empty + Try + If Not IsNothing(str) Then inputString = str.ToString + ' As we are using a 1 based indexing we are using .Length + ' which returns the exact length + Return inputString.Substring(0, 1).ToUpper & inputString.Substring(1, inputString.Length - 1) + Catch ex As Exception + Throw New Exception("CAPITALIZE(" & GetStr(str) & "): " & ex.Message) + End Try + End Function + + ''' + ''' Replaces the specified part of a string with a new string + ''' + ''' String to be operated upon + ''' The start index of the part to be replaced + ''' The length of the part to be replaced + ''' The new string which replaces the old string. + ''' The replaced string + Public Shared Function Replace(ByVal oldString As Object, ByVal startIndex As Integer, ByVal length As Integer, ByVal newString As Object) As String + Dim inputString As String = String.Empty + Try + If Not IsNothing(oldString) Then inputString = oldString.ToString + Return inputString.Substring(0, startIndex) & newString.ToString & inputString.Substring(startIndex + length) + Catch ex As Exception + Throw New Exception("REPLACE(" & GetStr(oldString) & ", " & startIndex & ", " & length & "): " & ex.Message) + End Try + End Function + + ''' + ''' Repeats the specified text specified number of times + ''' + ''' Text to be repeated + ''' The number of times text is to be repeated + ''' The string with repeatetive text in it + Public Shared Function Rept(ByVal text As Object, ByVal numberOfTimes As Integer) As String + Dim textStr As String = String.Empty + Dim finalString As String = String.Empty + Dim i As Integer = 0 + ' We are using a 1 based indexing in this function + If Not IsNothing(text) Then textStr = text.ToString + Try + For i = 0 To numberOfTimes - 1 + finalString = finalString & textStr + Next + Return finalString + Catch ex As Exception + Throw New Exception("REPT(" & GetStr(text) & ", " & numberOfTimes & "): " & ex.Message) + End Try + End Function + + ''' + ''' Concatenates the arguments in the array + ''' + ''' Array of arguments + ''' Concatenated string + Public Shared Function Concatenate(ByVal ParamArray args As Object()) As String + Dim finalString As String = String.Empty + ' We are using a 1 based indexing in this function + Try + For Each str As Object In args + If Not IsNothing(str) Then finalString = finalString & str.ToString + Next + Return finalString + Catch ex As Exception + Throw New Exception("CONCATENATE(" & GetStr(args) & "): " & ex.Message) + End Try + End Function + + ''' + ''' Trims the leading and trailing spaces + ''' + ''' String to be operated upon + ''' Trimmed string + Public Shared Function Trim(ByVal str As Object) As String + Try + Dim finalString As String = String.Empty + If Not IsNothing(str) Then finalString = str.ToString.Trim() + Return finalString + Catch ex As Exception + Throw New Exception("TRIM(" & GetStr(str) & "): " & ex.Message) + End Try + End Function +#End Region + +#Region "DateTime Functions" + + ''' + ''' Retrieves the hours from the date + ''' + ''' The date to be operated upon + ''' The hour part of the date and if date is empty string then returns today's hours + Public Shared Function Hour(ByVal valDate As Object) As Decimal + Dim finalDate As DateTime = DateTime.Now + Try + If (Not DateTime.TryParse(valDate.ToString, finalDate)) Then Return DateTime.Now.Hour + Return finalDate.Hour + Catch ex As Exception + Throw New Exception("HOUR(" & GetStr(valDate) & "): " & ex.Message) + End Try + End Function + + ''' + ''' Retrieves the minutes from the date + ''' + ''' The date to be operated upon + ''' The minutes part of the date and if date is empty string then returns minutes now + Public Shared Function Minute(ByVal valDate As Object) As Decimal + Dim finalDate As DateTime = DateTime.Now + Try + If (Not DateTime.TryParse(valDate.ToString, finalDate)) Then Return DateTime.Now.Minute + Return finalDate.Minute + Catch ex As Exception + Throw New Exception("MINUTE(" & GetStr(valDate) & "): " & ex.Message) + End Try + End Function + + ''' + ''' Retrieves the years from the date + ''' + ''' The date to be operated upon + ''' The years part of the date and if date is empty string then returns years now + Public Shared Function Year(ByVal valDate As Object) As Decimal + Dim finalDate As DateTime = DateTime.Today + Try + If (Not DateTime.TryParse(valDate.ToString, finalDate)) Then Return DateTime.Now.Year + Return finalDate.Year + Catch ex As Exception + Throw New Exception("YEAR(" & GetStr(valDate) & "): " & ex.Message) + End Try + End Function + + ''' + ''' Retrieves the month from the date + ''' + ''' The date to be operated upon + ''' The month part of the date and if date is empty string then returns this month + Public Shared Function Month(ByVal valDate As Object) As Decimal + Dim finalDate As DateTime = DateTime.Today + Try + If (Not DateTime.TryParse(valDate.ToString, finalDate)) Then Return DateTime.Now.Month + Return finalDate.Month + Catch ex As Exception + Throw New Exception("MONTH(" & GetStr(valDate) & "): " & ex.Message) + End Try + End Function + + ''' + ''' Retrieves the seconds from the date + ''' + ''' The date to be operated upon + ''' The seconds part of the date and if date is empty string then returns seconds now + Public Shared Function Second(ByVal valDate As Object) As Decimal + Dim finalDate As DateTime = DateTime.Now + Try + If (Not DateTime.TryParse(valDate.ToString, finalDate)) Then Return DateTime.Now.Second + Return finalDate.Second + Catch ex As Exception + Throw New Exception("SECOND(" & GetStr(valDate) & "): " & ex.Message) + End Try + End Function + + ''' + ''' Retrieves the day from the date + ''' + ''' The date to be operated upon + ''' The day of the date and if date is empty string then returns this day + Public Shared Function Day(ByVal valDate As Object) As Decimal + Dim finalDate As DateTime = DateTime.Today + Try + If (Not DateTime.TryParse(valDate.ToString, finalDate)) Then Return DateTime.Now.Day + Return finalDate.Day + Catch ex As Exception + Throw New Exception("DAY(" & GetStr(valDate) & "): " & ex.Message) + End Try + End Function + + ''' + ''' Returns a datevalue specifying the hours minutes and seconds + ''' + ''' The number of hours + ''' The number of minutes + ''' The number of seconds + ''' The seconds part of the date and if date is empty string then returns seconds now + Public Shared Function Time1(ByVal valHour As Object, ByVal valMinute As Object, ByVal valSecond As Object) As DateTime + 'The date would be set relative to January 1 of the year 1. + Dim finalDate As DateTime = DateTime.Today + Try + If (Not finalDate = TimeSerial(Convert.ToInt32(valHour), Convert.ToInt32(valMinute), Convert.ToInt32(valSecond))) Then + Return DateTime.Today + End If + Return finalDate + Catch ex As Exception + Throw New Exception("TIME1(" & GetStr(valHour) & ", " & GetStr(valMinute) & ", " & GetStr(valSecond) & "): " & ex.Message) + End Try + End Function + + ''' + ''' Returns today's date with current time + ''' + ''' Today's date with current time. + Public Shared Function Now() As DateTime + Return DateTime.Now + End Function + + ''' + ''' Returns today's date, the time would be 12:00 AM + ''' + ''' Today's date, the time would be 12:00 AM + Public Shared Function Today() As DateTime + Return DateTime.Today + End Function + + ''' + ''' Retrieves yesterday's date + ''' + ''' Yesterday's date + Public Shared Function Yesterday() As DateTime + Return DateTime.Today.AddDays(-1) + End Function + + ''' + ''' Retrieve the date of start of the week + ''' + ''' The date to be operated upon + ''' The start date of the week + Public Shared Function StartOfWeek(ByVal valDate As Object) As DateTime + Dim inputDate As DateTime = DateTime.Today + If Not (DateTime.TryParse(valDate.ToString, inputDate)) Then inputDate = DateTime.Today + inputDate = inputDate.AddDays(0 - Convert.ToDouble(inputDate.DayOfWeek)) + Return New DateTime(inputDate.Year, inputDate.Month, inputDate.Day, 0, 0, 0) + End Function + + ''' + ''' Retrieve the date of end of the week + ''' + ''' The date to be operated upon + ''' The end date of the week + Public Shared Function EndOfWeek(ByVal valDate As Object) As DateTime + Dim inputDate As DateTime = DateTime.Today + If Not (DateTime.TryParse(valDate.ToString, inputDate)) Then inputDate = DateTime.Today + inputDate = inputDate.AddDays(6 - Convert.ToDouble(inputDate.DayOfWeek)) + Return New DateTime(inputDate.Year, inputDate.Month, inputDate.Day, 23, 59, 59) + End Function + + ''' + ''' Retrieve the start date of the current week + ''' + ''' The start date of the current week + Public Shared Function StartOfCurrentWeek() As DateTime + Dim inputDate As DateTime = DateTime.Today + inputDate = inputDate.AddDays(0 - Convert.ToDouble(inputDate.DayOfWeek)) + Return New DateTime(inputDate.Year, inputDate.Month, inputDate.Day, 0, 0, 0) + End Function + + ''' + ''' Retrieve the end date of the current week + ''' + ''' The end date of the current week + Public Shared Function EndOfCurrentWeek() As DateTime + Dim inputDate As DateTime = DateTime.Today + inputDate = inputDate.AddDays(6 - Convert.ToDouble(inputDate.DayOfWeek)) + Return New DateTime(inputDate.Year, inputDate.Month, inputDate.Day, 23, 59, 59) + End Function + + ''' + ''' Retrieve the start date of the previous week + ''' + ''' The start date of the previous week + Public Shared Function StartOfLastWeek() As DateTime + Dim inputDate As DateTime = DateTime.Today + inputDate = inputDate.AddDays(-7 - Convert.ToDouble(inputDate.DayOfWeek)) + Return New DateTime(inputDate.Year, inputDate.Month, inputDate.Day, 0, 0, 0) + End Function + + ''' + ''' Retrieve the end date of the previous week + ''' + ''' The end date of the previous week + Public Shared Function EndOfLastWeek() As DateTime + Dim inputDate As DateTime = DateTime.Today + inputDate = inputDate.AddDays(-1 - Convert.ToDouble(inputDate.DayOfWeek)) + Return New DateTime(inputDate.Year, inputDate.Month, inputDate.Day, 23, 59, 59) + End Function + + ''' + ''' Retrieve the start date of the month for the specified date + ''' + ''' The date whose start date of month is to be found + ''' The start date of the month + Public Shared Function StartOfMonth(ByVal valDate As Object) As DateTime + Dim inputDate As DateTime = DateTime.Today + If Not (DateTime.TryParse(valDate.ToString, inputDate)) Then inputDate = DateTime.Today + Dim startDate As DateTime = New DateTime(inputDate.Year, inputDate.Month, 1) + Return startDate + End Function + + ''' + ''' Retrieve the end date of the month for the specified date + ''' + ''' The date whose end date of month is to be found + ''' The end date of the month + Public Shared Function EndOfMonth(ByVal valDate As Object) As DateTime + Dim inputDate As DateTime = DateTime.Today + If Not (DateTime.TryParse(valDate.ToString, inputDate)) Then inputDate = DateTime.Today + Dim endDate As DateTime = inputDate.AddMonths(1) + endDate = New DateTime(endDate.Year, endDate.Month, 1, 23, 59, 59).AddDays(-1) + Return endDate + End Function + + ''' + ''' Retrieve the start date of the current month + ''' + ''' The start date of the current month + Public Shared Function StartOfCurrentMonth() As DateTime + Dim startDate As DateTime = New DateTime(DateTime.Today.Year, DateTime.Today.Month, 1) + Return startDate + End Function + + ''' + ''' Retrieve the end date of the current month + ''' + ''' The end date of the current month + Public Shared Function EndOfCurrentMonth() As DateTime + Dim endDate As DateTime = DateTime.Today.AddMonths(1) + endDate = New DateTime(endDate.Year, endDate.Month, 1, 23, 59, 59).AddDays(-1) + Return endDate + End Function + + ''' + ''' Retrieve the start date of the last month + ''' + ''' The start date of the last month + Public Shared Function StartOfLastMonth() As DateTime + Dim prevMonthDate As DateTime = DateTime.Today.AddMonths(-1) + Return New DateTime(prevMonthDate.Year, prevMonthDate.Month, 1) + End Function + + ''' + ''' Retrieve the end date of the last month + ''' + ''' The end date of the last month + Public Shared Function EndOfLastMonth() As DateTime + Dim endDate As DateTime = DateTime.Today + endDate = New DateTime(DateTime.Today.Year, DateTime.Today.Month, 1, 23, 59, 59) + endDate = endDate.AddDays(-1) + Return endDate + End Function + + ''' + ''' Retrieve the start date of the quarter for the specified date + ''' + ''' The date whose start date of quarter is to be found + ''' The start date of the quarter + Public Shared Function StartOfQuarter(ByVal valDate As Object) As DateTime + Dim inputDate As DateTime = DateTime.Today + If Not (DateTime.TryParse(valDate.ToString, inputDate)) Then inputDate = DateTime.Today + Dim quarter As Integer = (inputDate.Month - 1) \ 3 + 1 + Dim startQuarterDate As DateTime = New DateTime(inputDate.Year, 3 * quarter - 2, 1) + Return startQuarterDate + End Function + + ''' + ''' Retrieve the end date of the quarter for the specified date + ''' + ''' The date whose end date of quarter is to be found + ''' The end date of the quarter + Public Shared Function EndOfQuarter(ByVal valDate As Object) As DateTime + Dim inputDate As DateTime = DateTime.Today + If Not (DateTime.TryParse(valDate.ToString, inputDate)) Then inputDate = DateTime.Today + Dim quarter As Integer = (inputDate.Month - 1) \ 3 + 1 + Dim quarterLastDate As DateTime = New DateTime(inputDate.Year, 3 * quarter, 1, 23, 59, 59).AddMonths(1).AddDays(-1) + Return quarterLastDate + End Function + + ''' + ''' Retrieve the start date of the current quarter + ''' + ''' The start date of the current quarter + Public Shared Function StartOfCurrentQuarter() As DateTime + Dim dateToday As DateTime = DateTime.Today + Dim currQuarter As Integer = (DateTime.Today.Month - 1) \ 3 + 1 + Dim dtFirstDay As DateTime = New DateTime(DateTime.Today.Year, 3 * currQuarter - 2, 1) + Return dtFirstDay + End Function + + ''' + ''' Retrieve the end date of the current quarter + ''' + ''' The end date of the current quarter + Public Shared Function EndOfCurrentQuarter() As DateTime + Dim dateToday As DateTime = DateTime.Today + Dim currQuarter As Integer = (DateTime.Today.Month - 1) \ 3 + 1 + Dim quarterLastDate As DateTime = New DateTime(DateTime.Today.Year, 3 * currQuarter, 1, 23, 59, 59).AddMonths(1).AddDays(-1) + Return quarterLastDate + End Function + + ''' + ''' Retrieve the start date of the last quarter + ''' + ''' The start date of the last quarter + Public Shared Function StartOfLastQuarter() As DateTime + Dim currQuarter As Integer = (DateTime.Today.Month - 1) \ 3 + 1 + Dim lastQuarterStartDate As DateTime = New DateTime(DateTime.Today.Year, 3 * currQuarter - 2, 1).AddMonths(-3) + Return lastQuarterStartDate + End Function + + ''' + ''' Retrieve the end date of the last quarter + ''' + ''' The end date of the last quarter + Public Shared Function EndOfLastQuarter() As DateTime + Dim currQuarter As Integer = (DateTime.Today.Month - 1) \ 3 + 1 + Dim lastQuarterEndDate As DateTime = New DateTime(DateTime.Today.Year, 3 * currQuarter - 2, 1, 23, 59, 59).AddDays(-1) + Return lastQuarterEndDate + End Function + + ''' + ''' Retrieve the start date of the year for the specified date + ''' + ''' The date whose start date of year is to be found + ''' The start date of the year + Public Shared Function StartOfYear(ByVal valDate As Object) As DateTime + Dim inputDate As DateTime = DateTime.Today + If Not (DateTime.TryParse(valDate.ToString, inputDate)) Then inputDate = DateTime.Today + Dim dtFirstDate As DateTime = New DateTime(inputDate.Year, 1, 1) + Return dtFirstDate + End Function + + ''' + ''' Retrieve the end date of the year for the date passed + ''' + ''' The end date of the year + Public Shared Function EndOfYear(ByVal valDate As Object) As DateTime + Dim inputDate As DateTime = DateTime.Today + If Not (DateTime.TryParse(valDate.ToString, inputDate)) Then inputDate = DateTime.Today + Dim dtLastDate As DateTime = New DateTime(inputDate.Year, 12, 31, 23, 59, 59) + Return dtLastDate + End Function + + ''' + ''' Retrieve the start date of the current year + ''' + ''' The start date of the current year + Public Shared Function StartOfCurrentYear() As DateTime + Dim dtFirstDay As DateTime = New DateTime(DateTime.Today.Year, 1, 1) + Return dtFirstDay + End Function + + ''' + ''' Retrieve the end date of the current year + ''' + ''' The end date of the current year + Public Shared Function EndOfCurrentYear() As DateTime + Dim dtLastDay As DateTime = New DateTime(DateTime.Today.Year, 12, 31, 23, 59, 59) + Return dtLastDay + End Function + + ''' + ''' Retrieve the start date of the last year + ''' + ''' The start date of the last year + Public Shared Function StartOfLastYear() As DateTime + Dim dtFirstDay As DateTime = New DateTime(DateTime.Today.Year - 1, 1, 1) + Return dtFirstDay + End Function + + ''' + ''' Retrieve the end date of the last year + ''' + ''' The end date of the last year + Public Shared Function EndOfLastYear() As DateTime + Dim dtFirstDay As DateTime = New DateTime(DateTime.Today.Year - 1, 12, 31, 23, 59, 59) + Return dtFirstDay + End Function + +#End Region + +#Region "Format Functions" + + ''' + ''' Formats the arguments according to the format string + ''' + ''' The value to be formatted + ''' The format string needed to specify the format type + ''' The formatted string + Public Shared Function Format(ByVal val As Object, ByVal formatString As String) As String + Dim valDecimal As Decimal + Dim valDate As DateTime + If (IsNothing(val)) Then + Return String.Empty + End If + + Try + + Try + valDecimal = ParseDecimal(val) + Return valDecimal.ToString(formatString) + Catch + ' Ignore + End Try + + If DateTime.TryParse(val.ToString, valDate) Then + Return valDate.ToString(formatString) + End If + + Return ParseDecimal(val).ToString(formatString) + Catch + Return val.ToString + End Try + End Function +#End Region + +#Region "Parse Functions" + + ''' + ''' Converts the object to its Decimal equivalent. + ''' + ''' The value to be converted + ''' The converted value + Public Shared Function ParseDecimal(ByVal val As Object) As Decimal + Dim valDecimal As Decimal = 0 + Try + valDecimal = StringUtils.ParseDecimal(val) + Return valDecimal + Catch ex As Exception + Throw New Exception(("PARSEDECIMAL(" & GetStr(val) & "): ") + ex.Message) + End Try + End Function + + ''' + ''' Converts the object to its integer equivalent. + ''' + ''' The value to be converted + ''' The converted value + Public Shared Function ParseInteger(ByVal val As Object) As Integer + Dim valInteger As Integer = 0 + Try + valInteger = CInt(ParseDecimal(val)) + Return valInteger + Catch ex As Exception + Throw New Exception(("PARSEINTEGER(" & GetStr(val) & "): ") + ex.Message) + End Try + End Function + + ''' + ''' Converts the object to its date equivalent. + ''' + ''' The value to be converted + ''' The converted value. + Public Shared Function parseDate(ByVal val As Object) As DateTime + Dim valDate As DateTime = DateTime.Today + Try + valDate = DateTime.Parse(val.ToString()) + Return valDate + Catch ex As Exception + Throw New Exception(("PARSEDATE(" & GetStr(val) & "): ") + ex.Message) + End Try + End Function +#End Region + +#Region "Session, Cookie, URL and other Functions" + + ''' + ''' Return the value of the variable from the session. + ''' + ''' The name of the session variable + ''' The session variable value. + Public Shared Function Session(ByVal var As String) As String + If (IsNothing(var) OrElse IsNothing(System.Web.HttpContext.Current.Session(var))) Then Return String.Empty + Return System.Web.HttpContext.Current.Session(var).ToString + End Function + + ''' + ''' Return the value of the variable from the cookie. + ''' + ''' The name of the cookie variable + ''' The cookie variable value. + Public Shared Function Cookie(ByVal var As String) As String + If (IsNothing(var) OrElse IsNothing(System.Web.HttpContext.Current.Request.Cookies(var))) Then Return String.Empty + Return System.Web.HttpContext.Current.Request.Cookies(var).Value + End Function + + ''' + ''' Return the value of the variable from the cache. + ''' + ''' The name of the cache variable + ''' The cache variable value. + Public Shared Function Cache(ByVal var As String) As String + If (IsNothing(var) OrElse IsNothing(System.Web.HttpContext.Current.Cache(var))) Then Return String.Empty + Return System.Web.HttpContext.Current.Cache(var).ToString() + End Function + + ''' + ''' Return the value of the URL parameter passed to the current page. + ''' + ''' The name of the URL variable + ''' The URL variable value. + Public Shared Function URL(ByVal var As String) As String + Dim val As String + If (IsNothing(var)) Then Return String.Empty + + val = System.Web.HttpContext.Current.Request.QueryString.Item(var) + + ' It is possible that the URL value is encrypted - so try to + ' decrypt. If we do not get an exception, then we know it was + ' encrypted - otherwise if we get an exception, then the value was + ' not encrypted in the first place, so return the actual value. + Try + val = Decrypt(val) + Catch + ' Ignore exception and return original value + End Try + + If KeyValue.IsXmlKey(val) Then + ' URL values are typically passed as XML structures to handle composite keys. + ' If XML, then we will see if there is one element in the XML. If there is only one + ' element, we will return that element. Otherwise we will return the full XML. + Dim key As KeyValue = KeyValue.XmlToKey(val) + If key.Count = 1 Then + val = key.ColumnValue(0) + End If + End If + + Return val + End Function + + ''' + ''' Return the value of the URL parameter passed to the current page. + ''' If the URL is a Key Value pair, return the column value of the XML structure + ''' + ''' The name of the URL variable + ''' The URL variable value. + Public Shared Function URL(ByVal var As String, ByVal column As String) As String + Dim val As String + If (IsNothing(var)) Then Return String.Empty + + val = System.Web.HttpContext.Current.Request.QueryString.Item(var) + + ' It is possible that the URL value is encrypted - so try to + ' decrypt. If we do not get an exception, then we know it was + ' encrypted - otherwise if we get an exception, then the value was + ' not encrypted in the first place, so return the actual value. + Try + val = Decrypt(val) + Catch ex As Exception + ' Ignore exception and return original value + End Try + + If KeyValue.IsXmlKey(val) Then + ' URL values are typically passed as XML structures to handle composite keys. + ' If XML, then we will see if retrieve the value for the column name passed in + ' to the function. + Dim key As KeyValue = KeyValue.XmlToKey(val) + val = key.ColumnValueByName(column) + End If + + Return val + End Function + + ''' + ''' Return the value of the resource key. Only the application resources + ''' are returned by this function. Resources in the BaseClasses.resx file + ''' are not accessible through this function. + ''' + ''' The name of the resource key + ''' The resource value. + Public Shared Function Resource(ByVal var As String) As String + If (IsNothing(var)) Then Return String.Empty + Try + Dim appname As String = BaseClasses.Configuration.ApplicationSettings.Current.GetAppSetting(BaseClasses.Configuration.ApplicationSettings.ConfigurationKey.ApplicationName) + Dim resObj As Object = System.Web.HttpContext.GetGlobalResourceObject(appname, var) + If Not resObj Is Nothing Then + Return resObj.ToString() + End If + Catch + ' If we cannot find the resource, simply return the variable that was passed-in. + End Try + Return var + End Function + + ''' + ''' Return the encrypted value of the string passed in. Session is used for encryption + ''' + ''' The string to encrypt + ''' The encrypted value of the string. + Public Shared Function Encrypt(ByVal str As String) As String + If (IsNothing(str)) Then Return String.Empty + Dim CheckCrypto As New Crypto() + Return CheckCrypto.Encrypt(str) + End Function + + ''' + ''' Return the decrypted value of the string passed in. Session is used for decryption + ''' + ''' The string to decrypt + ''' The decrypted value of the string. + Public Shared Function Decrypt(ByVal str As String) As String + If (IsNothing(str)) Then Return String.Empty + Dim CheckCrypto As New Crypto() + Return CheckCrypto.Decrypt(str) + End Function + + ''' + ''' Return the encrypted value of the string passed in. + ''' + ''' The string to encrypt + ''' The encrypted value of the string. + Public Shared Function EncryptData(ByVal str As String) As String + If (IsNothing(str)) Then Return String.Empty + Dim CheckCrypto As New Crypto() + Return CheckCrypto.Encrypt(str, False) + End Function + + ''' + ''' Return the decrypted value of the string passed in. If first decryption fails, second attempt will use session. + ''' + ''' The string to decrypt + ''' The decrypted value of the string. + Public Shared Function DecryptData(ByVal str As String) As String + If (IsNothing(str)) Then Return String.Empty + Dim CheckCrypto As New Crypto() + Dim result As String = Nothing + Try + result = CheckCrypto.Decrypt(str, False) + Catch + End Try + Try + If result = str OrElse result Is Nothing OrElse result = "" Then + result = CheckCrypto.Decrypt(str, True) + End If + Catch + result = str + End Try + Return result + End Function + + ''' + ''' Return the currently logged in user id + ''' + ''' The user id of the currently logged in user. + Public Shared Function UserId() As String + Return BaseClasses.Utils.SecurityControls.GetCurrentUserID() + End Function + + ''' + ''' Return the currently logged in user ma,e + ''' + ''' The user name of the currently logged in user. + Public Shared Function UserName() As String + Return BaseClasses.Utils.SecurityControls.GetCurrentUserName() + End Function + + ''' + ''' Return the currently logged in user's roles. The roles are returned + ''' as a string array, so you can do something like + ''' = If("Engineering" in Roles(), "Good", "Bad") + ''' + ''' The roles of the currently logged in user. + Public Shared ReadOnly Property Roles() As String() + Get + Dim rStr As String = BaseClasses.Utils.SecurityControls.GetCurrentUserRoles() + If IsNothing(rStr) Then Return New String() {} + Return rStr.Split(";"c) + End Get + End Property + + + ''' + ''' Return the value of the column from the currently logged in user's database + ''' record. Allows access to any fields on the user record (e.g., email address) + ''' by simply doing something like UserRecord("EmailAddress") + ''' NOTE: This function ONLY applies to Database Role security. Does NOT + ''' apply to Active Directory, SharePoint, Windows Authentication or .NET Membership Roles + ''' + ''' The user record of the currently logged in user. + Public Shared Function UserRecord(ByVal colName As String) As Object + Dim rec As IUserIdentityRecord + rec = BaseClasses.Utils.SecurityControls.GetUserRecord() + If IsNothing(rec) Then Return String.Empty + + Dim col As BaseColumn + col = rec.TableAccess.TableDefinition.ColumnList.GetByCodeName(colName) + If IsNothing(col) Then Return String.Empty + + Return rec.GetValue(col).Value + End Function +#End Region + +#Region "Database Access Functions" + ''' + ''' Return the value of the column from the database record specified by the key. The + ''' key can be either an XML KeyValue structure or just a string that is the Id of the record. + ''' Only works for tables with a primary key or a virtual primary key. + ''' + ''' The value for the given field as an Object. + Public Shared Function GetColumnValue(ByVal tableName As String, ByVal key As Decimal, ByVal fieldName As String) As Object + Return GetColumnValue(tableName, key.ToString(), fieldName) + End Function + + + ''' + ''' Return the value of the column from the database record specified by the key. The + ''' key can be either an XML KeyValue structure or just a string that is the Id of the record. + ''' Only works for tables with a primary key or a virtual primary key. + ''' + ''' The value for the given field as an Object. + Public Shared Function GetColumnValue(ByVal tableName As String, ByVal key As String, ByVal fieldName As String) As Object + ' Find a specific value from the database for the given record. + Dim bt As PrimaryKeyTable + bt = CType(DatabaseObjects.GetTableObject(tableName), PrimaryKeyTable) + If IsNothing(bt) Then + Throw New Exception("GETCOLUMNVALUE(" & tableName & ", " & key & ", " & fieldName & "): " & Resource("Err:NoRecRetrieved")) + End If + + Dim rec As IRecord = Nothing + Try + ' Always start a transaction since we do not know if the calling function did. + rec = bt.GetRecordData(key, False) + Catch + ' Ignore exception - throw an exception below if no record received. + End Try + If IsNothing(rec) Then + Throw New Exception("GETCOLUMNVALUE(" & tableName & ", " & key & ", " & fieldName & "): " & Resource("Err:NoRecRetrieved")) + End If + + Dim col As BaseColumn = bt.TableDefinition.ColumnList.GetByCodeName(fieldName) + If IsNothing(col) Then + Throw New Exception("GETCOLUMNVALUE(" & tableName & ", " & key & ", " & fieldName & "): " & Resource("Err:NoRecRetrieved")) + End If + + ' The value can be null. In this case, return an empty string since + ' that is an acceptable value. + Dim fieldData As ColumnValue = rec.GetValue(col) + If IsNothing(fieldData) Then + Return String.Empty + End If + + Return fieldData.Value + + End Function + + ''' + ''' Return an array of values from the database. The values returned are DISTINCT values. + ''' For example, GetColumnValues("Employees", "City") will return a list of all Cities + ''' from the Employees table. There will be no duplicates in the list. + ''' You can use the IN operator to compare the values. You can also use the resulting array to display + ''' such as String.Join(", ", GetColumnValues("Employees", "City") + ''' to display: New York, Chicago, Los Angeles, San Francisco + ''' + ''' An array of values for the given field as an Object. + Public Shared Function GetColumnValues(ByVal tableName As String, ByVal fieldName As String) As String() + Return GetColumnValues(tableName, fieldName, String.Empty) + End Function + + ''' + ''' Return an array of values from the database. The values returned are DISTINCT values. + ''' For example, GetColumnValues("Employees", "City") will return a list of all Cities + ''' from the Employees table. There will be no duplicates in the list. + ''' This function adds a Where Clause. So you can say something like "Country = 'USA'" and in this + ''' case only cities in the US will be returned. + ''' You can use the IN operator to compare the values. You can also use the resulting array to display + ''' such as String.Join(", ", GetColumnValues("Employees", "City", "Country = 'USA'") + ''' to display: New York, Chicago, Los Angeles, San Francisco + ''' + ''' An array of values for the given field as an Object. + Public Shared Function GetColumnValues(ByVal tableName As String, ByVal fieldName As String, ByVal whereStr As String) As String() + ' Find the + Dim bt As PrimaryKeyTable + bt = CType(DatabaseObjects.GetTableObject(tableName), PrimaryKeyTable) + If IsNothing(bt) Then + Throw New Exception("GETCOLUMNVALUES(" & tableName & ", " & fieldName & ", " & whereStr & "): " & Resource("Err:NoRecRetrieved")) + End If + + Dim col As BaseColumn = bt.TableDefinition.ColumnList.GetByCodeName(fieldName) + If IsNothing(col) Then + Throw New Exception("GETCOLUMNVALUES(" & tableName & ", " & fieldName & ", " & whereStr & "): " & Resource("Err:NoRecRetrieved")) + End If + + Dim values As String() = Nothing + + Try + ' Always start a transaction since we do not know if the calling function did. + Dim sqlCol As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, True) + sqlCol.AddColumn(col) + + Dim wc As WhereClause = New WhereClause + If Not (IsNothing(whereStr)) AndAlso whereStr.Trim.Length > 0 Then + wc.iAND(whereStr) + End If + Dim join As BaseClasses.Data.BaseFilter = Nothing + values = bt.GetColumnValues(sqlCol, join, wc.GetFilter(), Nothing, Nothing, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) + + Catch + ' Ignore exception - throw an exception below if no record received. + End Try + + ' The value can be null. In this case, return an empty array since + ' that is an acceptable value. + If IsNothing(values) Then + values = New String() {} + End If + + Return values + + End Function +#End Region + +#Region "Private Convenience Functions" + ''' + ''' Convert an object to string + ''' + ''' The input to be converted + ''' The converted string. + Private Shared Function GetStr(ByVal str As Object) As String + If (IsNothing(str)) Then Return String.Empty + Return str.ToString + End Function + + +#End Region + + + End Class + +End Namespace diff --git a/App_Code/Data Access Layer/Shared/Crypto.vb b/App_Code/Data Access Layer/Shared/Crypto.vb new file mode 100644 index 0000000..1dd4b2d --- /dev/null +++ b/App_Code/Data Access Layer/Shared/Crypto.vb @@ -0,0 +1,280 @@ +Imports System.Security.Cryptography +Imports System.IO +Imports System.Text +Imports System.Web +Imports BaseClasses.Resources + +'SymmCrypto is a wrapper of System.Security.Cryptography.SymmetricAlgorithm classes +'and simplifies the interface. It supports customized SymmetricAlgorithm as well. +'Original Code from Frank Fang +'Revised by Jerome Howard to remove Bad Data errors, create seperate CryptoIV and +'use the maximum legal keysize for each encryption algorithm + +Namespace Persons.Data + + Public Class Crypto + '256 Bit IV Key that is truncated when a smaller keys are required + Private bytIV() As Byte = _ +{78, 90, 23, 7, 54, 109, 34, 231, 90, 66, 109, 185, 228, 143, 89, 77, 190, 89, 103, 148, 54, 4, 98, 67, 243, 162, 68, 201, 73, 59, 184, 52} + 'Supported .Net intrinsic SymmetricAlgorithm classes. + Public Enum Providers + DES + RC2 + Rijndael + End Enum + + Private _CryptoService As SymmetricAlgorithm + + Public Sub New() + ' Use the default provider of DES. + Me.New(Crypto.Providers.DES) + End Sub + + 'Constructor for using an intrinsic .Net SymmetricAlgorithm class. + Public Sub New(ByVal NetSelected As Providers) + Select Case NetSelected + Case Providers.DES + _CryptoService = New DESCryptoServiceProvider + Case Providers.RC2 + _CryptoService = New RC2CryptoServiceProvider + Case Providers.Rijndael + _CryptoService = New RijndaelManaged + End Select + End Sub + + 'Constructor for using a customized SymmetricAlgorithm class. + Public Sub New(ByVal ServiceProvider As SymmetricAlgorithm) + _CryptoService = ServiceProvider + End Sub + + 'Depending on the legal key size limitations of a specific CryptoService provider + 'and length of the private key provided, padding the secret key with a character + 'or triming it to meet the legal size of the algorithm. + Private Function GetLegalKey(ByVal Key As String) As Byte() + 'key sizes are in bits + Dim sTemp As String + Dim dValue As Integer + If (_CryptoService.LegalKeySizes.Length > 0) Then + Dim maxSize As Integer = _CryptoService.LegalKeySizes(0).MaxSize + dValue = CInt(maxSize / 8) + If Key.Length * 8 > maxSize Then + sTemp = Key.Substring(0, dValue) + Else + Dim moreSize As Integer = _CryptoService.LegalKeySizes(0).MinSize + Do While (Key.Length * 8 > moreSize) + moreSize += _CryptoService.LegalKeySizes(0).SkipSize + Loop + sTemp = Key.PadRight(dValue, "X".Chars(0)) + End If + Else + sTemp = Key + End If + + 'Ensure that the IV Block size is also correct for the specific CryptoService provider + If (_CryptoService.LegalBlockSizes.Length > 0) Then + Dim maxSize As Integer = _CryptoService.LegalBlockSizes(0).MaxSize + dValue = CInt(maxSize / 8) + ReDim Preserve bytIV(sTemp.Length - 1) + If sTemp.Length * 8 > maxSize Then + ReDim Preserve bytIV(dValue - 1) + End If + End If + 'convert the secret key to byte array + Return ASCIIEncoding.ASCII.GetBytes(sTemp) + End Function + + Public Overridable Function Encrypt(ByVal Source As String, Optional ByVal includeSession As Boolean = True) As String + If (Source Is Nothing) Then + Return "" + End If + Dim s As String = "" + Try + If includeSession Then + s = Me.Encrypt(Source, Me.GetCryptoKey(), False) + s = System.Web.HttpUtility.UrlEncode(s) + Else + s = Me.Encrypt(Source, Me.GetCryptoKeyWithoutSessionVariable(), False) + End If + Catch ex As Exception + ' In case of error, just return the source itself without encryption. + s = Source + End Try + Return s + End Function + + Public Function Encrypt(ByVal Source As String, ByVal Key As String, Optional ByVal Encoded As Boolean = True) As String + Return Me.Encrypt(Source, Key, System.Text.Encoding.ASCII, Encoded) + End Function + + Public Function Encrypt(ByVal Source As String, ByVal Key As String, ByVal Encoding As System.Text.Encoding, Optional ByVal Encoded As Boolean = True) As String + If Source Is Nothing OrElse Source.Trim.Length = 0 Then + Return Source + End If + + + If Encoded Then + Source = System.Web.HttpUtility.UrlEncode(Source) + End If + Dim bytIn As Byte() + + + If Encoding.EncodingName = System.Text.Encoding.ASCII.EncodingName Then + bytIn = System.Text.ASCIIEncoding.GetEncoding(System.Globalization.CultureInfo.CurrentUICulture.TextInfo.ANSICodePage).GetBytes(Source) + ElseIf Encoding.EncodingName = System.Text.Encoding.Unicode.EncodingName Then + bytIn = System.Text.UnicodeEncoding.GetEncoding(System.Globalization.CultureInfo.CurrentUICulture.TextInfo.ANSICodePage).GetBytes(Source) + Else + bytIn = System.Text.ASCIIEncoding.GetEncoding(System.Globalization.CultureInfo.CurrentUICulture.TextInfo.ANSICodePage).GetBytes(Source) + End If + '= System.Text.ASCIIEncoding.ASCII.GetBytes(Source) + Dim ms As MemoryStream = New MemoryStream + + 'set the keys + _CryptoService.Key = GetLegalKey(Key) + _CryptoService.IV = bytIV + + 'create an Encryptor from the Provider Service instance + Dim encrypto As ICryptoTransform = _CryptoService.CreateEncryptor() + + 'create Crypto Stream that transforms a stream using the encryption + Dim cs As CryptoStream = New CryptoStream(ms, encrypto, CryptoStreamMode.Write) + + 'write out encrypted content into MemoryStream + cs.Write(bytIn, 0, bytIn.Length) + cs.FlushFinalBlock() + cs.Close() + Dim bytOut() As Byte = ms.ToArray() + ms.Close() + + Return Convert.ToBase64String(bytOut) 'convert into Base64 so that the result can be used in xml + End Function + + Public Overridable Function Decrypt(ByVal Source As String, Optional ByVal includeSession As Boolean = True) As String + Dim s As String = "" + Try + ' First try decrypting as is. + If includeSession Then + s = Me.Decrypt(Source, Me.GetCryptoKey(), False) + s = System.Web.HttpUtility.UrlDecode(s) + Else + s = Me.Decrypt(Source, Me.GetCryptoKeyWithoutSessionVariable(), False) + End If + Catch ex As Exception + Try + ' If the first try of decrypting does not work, then + ' URL decode it and try again. This is to ensure that if + ' the encrypted key is passed through the URL, it needs to + ' be decoded first. + Source = System.Web.HttpUtility.UrlDecode(Source) + s = Me.Decrypt(Source, GetCryptoKey(), False) + Catch ex1 As Exception + ' In case of error, throw new Exception: do not allow to access encrypted page with non-encrypted URL + Throw New System.UriFormatException(RU.GetErrMsg(RU.ErrRes.GetRecords)) + End Try + End Try + + If ((Source IsNot Nothing AndAlso Source.Trim() <> "") AndAlso (s Is Nothing OrElse s.Trim() = "")) Then + Throw New System.UriFormatException(RU.GetErrMsg(RU.ErrRes.GetRecords)) + End If + + Return s + End Function + + Public Function Decrypt(ByVal Source As String, ByVal Key As String, Optional ByVal Encoded As Boolean = True) As String + Return Me.Decrypt(Source, Key, System.Text.Encoding.ASCII, Encoded) + End Function + + Public Function Decrypt(ByVal Source As String, ByVal Key As String, ByVal Encoding As System.Text.Encoding, Optional ByVal Encoded As Boolean = True) As String + If Source Is Nothing OrElse Source.Trim.Length = 0 Then + Return Source + End If + + 'convert from Base64 to binary + Dim bytIn As Byte() + Dim ms As MemoryStream + Try + bytIn = System.Convert.FromBase64String(Source) + ms = New MemoryStream(bytIn) + Catch ex As Exception + bytIn = System.Convert.FromBase64String(Source.Replace(" ", "+")) + ms = New MemoryStream(bytIn) + End Try + + Dim bytKey() As Byte = GetLegalKey(Key) + Dim bytTemp(bytIn.Length) As Byte + + 'set the private key + _CryptoService.Key = bytKey + _CryptoService.IV = bytIV + + 'create a Decryptor from the Provider Service instance + Dim encrypto As ICryptoTransform = _CryptoService.CreateDecryptor() + + 'create Crypto Stream that transforms a stream using the decryption + Dim cs As CryptoStream = New CryptoStream(ms, encrypto, CryptoStreamMode.Read) + Dim output As String = "" + Try + 'read out the result from the Crypto Stream + Dim sr As StreamReader + If Encoding.EncodingName = System.Text.Encoding.ASCII.EncodingName Then + sr = New StreamReader(cs, System.Text.ASCIIEncoding.GetEncoding(System.Globalization.CultureInfo.CurrentUICulture.TextInfo.ANSICodePage)) + ElseIf Encoding.EncodingName = System.Text.Encoding.Unicode.EncodingName Then + sr = New StreamReader(cs, System.Text.UnicodeEncoding.GetEncoding(System.Globalization.CultureInfo.CurrentUICulture.TextInfo.ANSICodePage)) + Else + sr = New StreamReader(cs, System.Text.ASCIIEncoding.GetEncoding(System.Globalization.CultureInfo.CurrentUICulture.TextInfo.ANSICodePage)) + End If + output = sr.ReadToEnd + sr.Close() + ms.Close() + cs.Close() + Catch ex As Exception + bytIn = System.Convert.FromBase64String(Source.Replace(" ", "+")) + ms = New MemoryStream(bytIn) + bytKey = GetLegalKey(Key) + + 'set the private key + _CryptoService.Key = bytKey + _CryptoService.IV = bytIV + encrypto = _CryptoService.CreateDecryptor() + + Try + 'create Crypto Stream that transforms a stream using the decryption + cs = New CryptoStream(ms, encrypto, CryptoStreamMode.Read) + Dim sr As StreamReader + If Encoding.EncodingName = System.Text.Encoding.ASCII.EncodingName Then + sr = New StreamReader(cs, System.Text.ASCIIEncoding.GetEncoding(System.Globalization.CultureInfo.CurrentUICulture.TextInfo.ANSICodePage)) + ElseIf Encoding.EncodingName = System.Text.Encoding.Unicode.EncodingName Then + sr = New StreamReader(cs, System.Text.UnicodeEncoding.GetEncoding(System.Globalization.CultureInfo.CurrentUICulture.TextInfo.ANSICodePage)) + Else + sr = New StreamReader(cs, System.Text.ASCIIEncoding.GetEncoding(System.Globalization.CultureInfo.CurrentUICulture.TextInfo.ANSICodePage)) + End If + output = sr.ReadToEnd + sr.Close() + ms.Close() + cs.Close() + Catch + End Try + + End Try + If Encoded Then + output = System.Web.HttpUtility.UrlDecode(output) + End If + Return output + End Function + + ' The URLEncryptionKey is specified in the web.config. The rightmost six characters of the current + ' Session Id are concatenated with the URLEncryptionKey to provide added protection. You can change + ' this to anything you like by changing this function for the application. + ' This function is private and not overridable because each page cannot have its own key - it must + ' be common across the entire application. + Private Function GetCryptoKey() As String + Return Left(System.Web.HttpContext.Current.Session.SessionID, 6) & BaseClasses.Configuration.ApplicationSettings.Current.URLEncryptionKey & Right(System.Web.HttpContext.Current.Session.SessionID, 6) + End Function + + Private Function GetCryptoKeyWithoutSessionVariable() As String + Return Left("ffx4ypamvvcs4knwbxxehl45", 6) & BaseClasses.Configuration.ApplicationSettings.Current.URLEncryptionKey & Right("ffx4ypamvvcs4knwbxxehl45", 6) + End Function + + + End Class + +End Namespace \ No newline at end of file diff --git a/App_Code/Data Access Layer/Shared/DatabaseObjects.vb b/App_Code/Data Access Layer/Shared/DatabaseObjects.vb new file mode 100644 index 0000000..a64fb9c --- /dev/null +++ b/App_Code/Data Access Layer/Shared/DatabaseObjects.vb @@ -0,0 +1,80 @@ +Imports BaseClasses +Imports BaseClasses.Data +Imports System.Text.RegularExpressions + + +''' +''' The DatabaseObjects class contains a set of functions that provide +''' access to the database by using table or field names. The class +''' allows conversion of names into the proper table object and +''' retrieval of values for field name. +''' +''' +Public Class DatabaseObjects + + Private Const ASSEMBLY_NAME As String = "App_Code" + Private Const BUSINESS_NAMESPACE As String = "Persons.Business" + + + ''' + ''' Returns the BaseTable object for the given table name. + ''' Determines if this is a Table, View or Query - and then + ''' calls GetType to retrieve and return the object. + ''' + ''' tableName whose object is desired + ''' A BaseTable object for the given table name. + Public Shared Function GetTableObject(ByVal tableName As String) As BaseTable + Dim expandedTableName As String = String.Empty + Dim TYPE_FORMAT As String = "{0}.{1}{2},{3}" + + Dim rgx As Regex = new Regex("[^a-zA-Z0-9]") + tableName = rgx.Replace(tableName, "_") + + ' First see if it is a table. + Try + expandedTableName = String.Format(TYPE_FORMAT, BUSINESS_NAMESPACE, tableName, "Table", ASSEMBLY_NAME) + Type.GetType(expandedTableName, True, True) + Catch + ' It was not really a table name - so reset and try again with a view or a query. + expandedTableName = String.Empty + End Try + + ' Check if it is a view. + If expandedTableName = String.Empty Then + Try + expandedTableName = String.Format(TYPE_FORMAT, BUSINESS_NAMESPACE, tableName, "View", ASSEMBLY_NAME) + Type.GetType(expandedTableName, True, True) + Catch + ' It was not really a view name - so reset and try again with a query. + expandedTableName = String.Empty + End Try + End If + + + ' Check if it is a query. + If expandedTableName = String.Empty Then + Try + expandedTableName = String.Format(TYPE_FORMAT, BUSINESS_NAMESPACE, tableName, "Query", ASSEMBLY_NAME) + Type.GetType(expandedTableName, True, True) + Catch + ' Still no luck. + expandedTableName = String.Empty + End Try + End If + + + If expandedTableName <> String.Empty Then + ' OK, looks like we found an object. + Try + Dim t As BaseTable = BaseTable.CreateInstance(expandedTableName) + Return t + Catch + ' Ignore, fall through and return Nothing + End Try + End If + + ' Could not find a table. + Return Nothing + End Function + +End Class diff --git a/App_Code/Data Access Layer/ShowPersonalIdTable.xml b/App_Code/Data Access Layer/ShowPersonalIdTable.xml new file mode 100644 index 0000000..7631b41 --- /dev/null +++ b/App_Code/Data Access Layer/ShowPersonalIdTable.xml @@ -0,0 +1,716 @@ + + + + + Addr + ที่อยู่ + String + nvarchar + 255 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + PersonalId + PersonalId + N + N + N + N + N + N + Y + N + + + + + + + + + + + + + Amphur + อำเภอ + String + nvarchar + 50 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + PersonalId + PersonalId + N + N + N + N + N + N + Y + N + + + + + + + + + + + + + BirthDate + วันเกิด + Date + datetime + + + + + + + N + N + + + d MMM yy + g + N + N + N + N + N + N + N + N + + + N + %ISD_DEFAULT% + PersonalId + PersonalId + N + N + N + N + N + N + Y + N + + + + + + + + + + + + + Born + กำเนิด + String + nvarchar + 25 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + PersonalId + PersonalId + N + N + N + N + N + N + Y + N + + + + + + + + + + + + + DeptId + สถานที่ปฏิบัติงาน + Number + smallint + 5.0 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + + + N + %ISD_DEFAULT% + PersonalId + PersonalId + N + N + N + N + N + N + Y + N + + + + + + + + + + + + + MobilePhone + โทรศัพท์เคลื่อนที่ + String + nvarchar + 15 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + PersonalId + PersonalId + N + N + N + N + N + N + Y + N + + + + + + + + + + + + + OfficerDate + วันรับราชการ + Date + datetime + + + + + + + N + N + + + d MMM yy + d + N + N + N + N + N + N + N + N + + + N + %ISD_DEFAULT% + PersonalId + PersonalId + N + N + N + N + N + N + Y + N + + + + + + + + + + + + + PersonalName + ชื่อ + String + nvarchar + 50 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + PersonalId + PersonalId + N + N + N + N + N + N + Y + N + + + + + + + + + + + + + picture + %ISD_DEFAULT% + Image + image + 2147483647 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + + + N + %ISD_DEFAULT% + PersonalId + PersonalId + N + N + N + N + N + N + Y + N + + + + + + + + + + + + + Province + จังหวัด + String + nvarchar + 50 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + PersonalId + PersonalId + N + N + N + N + N + N + Y + N + + + + + + + + + + + + + PersonalId + เลขประจำตัวประชาชน + String + nvarchar + 13 + + + + + Y + Y + notrim, + + + Y + N + N + N + N + Y + Y + N + Thai_CI_AS + N + %ISD_DEFAULT% + PersonalId + PersonalId + Y + Y + N + N + N + N + N + Y + N + + + + + + + + + + + + VFK_PersonalId_PersonalId + PersonalId + dbo + PersonalId + PersonalId + Implicit + + + + RankId + ยศ/คำนำหน้า + Number + int + 10.0 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + + + N + %ISD_DEFAULT% + PersonalId + PersonalId + N + N + N + N + N + N + Y + N + + + + + + + + + + + + + DateRank + %ISD_DEFAULT% + Date + datetime + + + + + + + N + N + + + d + d + N + N + N + N + N + N + N + N + + + N + %ISD_DEFAULT% + PersonalId + PersonalId + N + N + N + N + N + N + Y + N + + + + + + + + + + + + + PersonalLastName + นามสกุล + String + nvarchar + 50 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + PersonalId + PersonalId + N + N + N + N + N + N + Y + N + + + + + + + + + + + + + ShowPersonalIdTable + 6 + ShowPersonalIdTable + ShowPersonalIdTable_ + DatabasePersons1 + Persons + Y + Y + Y + Y + + + + PersonalId + PersonalId + + + ShowPersonalIdTable + ShowPersonalIdTable + + + + \ No newline at end of file diff --git a/App_Code/Data Access Layer/ShowPersonalIdTableDefinition.vb b/App_Code/Data Access Layer/ShowPersonalIdTableDefinition.vb new file mode 100644 index 0000000..107244b --- /dev/null +++ b/App_Code/Data Access Layer/ShowPersonalIdTableDefinition.vb @@ -0,0 +1,617 @@ +Namespace Persons.Business +''' +''' Contains embedded schema and configuration data that is used by the +''' Persons.ShowPersonalIdTableQuery class +''' to initialize the class's TableDefinition. +''' +''' + +Public Class ShowPersonalIdTableDefinition + +#Region "Definition (XML) for ShowPersonalIdTableDefinition table" + 'Next 584 lines contain Table Definition (XML) for table "ShowPersonalIdTableDefinition" + Private Shared _DefinitionString As String = "" +#End Region + + ''' + ''' Gets the embedded schema and configuration data for the + ''' + ''' class's TableDefinition. + ''' + ''' This function is only called once at runtime. + ''' An XML string. + Public Shared Function GetXMLString() As String + If _DefinitionString = "" Then + Dim tbf As System.Text.StringBuilder = New System.Text.StringBuilder() + tbf.Append("") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Addr") + tbf.Append( "ที่อยู่") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "255") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "PersonalId") + tbf.Append( "Persons.Business.PersonalIdTable, App_Code") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Amphur") + tbf.Append( "อำเภอ") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "50") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "PersonalId") + tbf.Append( "Persons.Business.PersonalIdTable, App_Code") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "BirthDate") + tbf.Append( "วันเกิด") + tbf.Append( "Date") + tbf.Append( "datetime") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "d MMM yy") + tbf.Append( "g") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "PersonalId") + tbf.Append( "Persons.Business.PersonalIdTable, App_Code") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Born") + tbf.Append( "กำเนิด") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "25") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "PersonalId") + tbf.Append( "Persons.Business.PersonalIdTable, App_Code") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "DeptId") + tbf.Append( "สถานที่ปฏิบัติงาน") + tbf.Append( "Number") + tbf.Append( "smallint") + tbf.Append( "5.0") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "PersonalId") + tbf.Append( "Persons.Business.PersonalIdTable, App_Code") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "MobilePhone") + tbf.Append( "โทรศัพท์เคลื่อนที่") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "15") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "PersonalId") + tbf.Append( "Persons.Business.PersonalIdTable, App_Code") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "OfficerDate") + tbf.Append( "วันรับราชการ") + tbf.Append( "Date") + tbf.Append( "datetime") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "d MMM yy") + tbf.Append( "d") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "PersonalId") + tbf.Append( "Persons.Business.PersonalIdTable, App_Code") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "PersonalName") + tbf.Append( "ชื่อ") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "50") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "PersonalId") + tbf.Append( "Persons.Business.PersonalIdTable, App_Code") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "picture") + tbf.Append( "Personal Picture") + tbf.Append( "Image") + tbf.Append( "image") + tbf.Append( "2147483647") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "PersonalId") + tbf.Append( "Persons.Business.PersonalIdTable, App_Code") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Province") + tbf.Append( "จังหวัด") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "50") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "PersonalId") + tbf.Append( "Persons.Business.PersonalIdTable, App_Code") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "PersonalId") + tbf.Append( "เลขประจำตัวประชาชน") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "13") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "notrim,") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "PersonalId") + tbf.Append( "Persons.Business.PersonalIdTable, App_Code") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "VFK_PersonalId_PersonalId") + tbf.Append( "Persons.Business.PersonalIdTable, App_Code") + tbf.Append( "dbo") + tbf.Append( "PersonalId") + tbf.Append( "PersonalId") + tbf.Append( "Implicit") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "RankId") + tbf.Append( "ยศ/คำนำหน้า") + tbf.Append( "Number") + tbf.Append( "int") + tbf.Append( "10.0") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "PersonalId") + tbf.Append( "Persons.Business.PersonalIdTable, App_Code") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "DateRank") + tbf.Append( "Personal Date Rank") + tbf.Append( "Date") + tbf.Append( "datetime") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "d") + tbf.Append( "d") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "PersonalId") + tbf.Append( "Persons.Business.PersonalIdTable, App_Code") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "PersonalLastName") + tbf.Append( "นามสกุล") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "50") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "PersonalId") + tbf.Append( "Persons.Business.PersonalIdTable, App_Code") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "ShowPersonalIdTable") + tbf.Append( "6") + tbf.Append( "ShowPersonalIdTable") + tbf.Append( "ShowPersonalIdTable_") + tbf.Append( "DatabasePersons1") + tbf.Append( "Persons") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "PersonalId") + tbf.Append( "PersonalId") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "ShowPersonalIdTable") + tbf.Append( "ShowPersonalIdTable") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append("") + _DefinitionString = tbf.ToString() + + End If + Return _DefinitionString + End Function + +End Class +End Namespace diff --git a/App_Code/Data Access Layer/ShowPersonalIdTableSqlQuery.vb b/App_Code/Data Access Layer/ShowPersonalIdTableSqlQuery.vb new file mode 100644 index 0000000..7043ad1 --- /dev/null +++ b/App_Code/Data Access Layer/ShowPersonalIdTableSqlQuery.vb @@ -0,0 +1,33 @@ +' This is a "safe" class, meaning that it is created once +' and never overwritten. Any custom code you add to this class +' will be preserved when you regenerate your application. +' +' Typical customizations that may be done in this class include +' - overriding base class methods + +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + +Namespace Persons.Data + +''' +''' Used by the class to access and/or modify the database. +''' +''' +''' This class is not intended to be instantiated directly. To obtain an instance of this class, +''' use the methods of the class. +''' +''' This is a "safe" class, meaning that it is generated once and never overwritten. +''' Any changes you make to this class will be preserved when you regenerate your application. +''' +''' +''' + +Public Class ShowPersonalIdTableSqlQuery + Inherits BaseShowPersonalIdTableSqlQuery + + 'The functions below may be overridden in order to implement your own + 'logic for running queries that return lists of records. + +End Class +End Namespace diff --git a/App_Code/Data Access Layer/Sport.xml b/App_Code/Data Access Layer/Sport.xml new file mode 100644 index 0000000..259fe44 --- /dev/null +++ b/App_Code/Data Access Layer/Sport.xml @@ -0,0 +1,115 @@ + + + + + SportId + %ISD_DEFAULT% + Number + smallint + 5.0 + + + + + Y + Y + + + + + Y + N + N + N + N + N + Y + N + + + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + SPORT + %ISD_DEFAULT% + String + nvarchar + 20 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + Sport + 3 + dbo + Sport + Sport_ + DatabasePersons1 + RowNum + Y + Y + Y + Y + BinaryChecksum + Persons + \ No newline at end of file diff --git a/App_Code/Data Access Layer/SportDefinition.vb b/App_Code/Data Access Layer/SportDefinition.vb new file mode 100644 index 0000000..da6c976 --- /dev/null +++ b/App_Code/Data Access Layer/SportDefinition.vb @@ -0,0 +1,126 @@ +Namespace Persons.Business +''' +''' Contains embedded schema and configuration data that is used by the +''' Persons.SportTable class +''' to initialize the class's TableDefinition. +''' +''' + +Public Class SportDefinition + +#Region "Definition (XML) for SportDefinition table" + 'Next 93 lines contain Table Definition (XML) for table "SportDefinition" + Private Shared _DefinitionString As String = "" +#End Region + + ''' + ''' Gets the embedded schema and configuration data for the + ''' + ''' class's TableDefinition. + ''' + ''' This function is only called once at runtime. + ''' An XML string. + Public Shared Function GetXMLString() As String + If _DefinitionString = "" Then + Dim tbf As System.Text.StringBuilder = New System.Text.StringBuilder() + tbf.Append("") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "SportId") + tbf.Append( "Sport") + tbf.Append( "Number") + tbf.Append( "smallint") + tbf.Append( "5.0") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "SPORT") + tbf.Append( "Sport") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "20") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Sport") + tbf.Append( "3") + tbf.Append( "dbo") + tbf.Append( "Sport") + tbf.Append( "Sport_") + tbf.Append( "DatabasePersons1") + tbf.Append( "RowNum") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "BinaryChecksum") + tbf.Append( "Persons") + tbf.Append("") + _DefinitionString = tbf.ToString() + + End If + Return _DefinitionString + End Function + +End Class +End Namespace diff --git a/App_Code/Data Access Layer/SportSqlTable.vb b/App_Code/Data Access Layer/SportSqlTable.vb new file mode 100644 index 0000000..a5cf499 --- /dev/null +++ b/App_Code/Data Access Layer/SportSqlTable.vb @@ -0,0 +1,47 @@ +' This is a "safe" class, meaning that it is created once +' and never overwritten. Any custom code you add to this class +' will be preserved when you regenerate your application. +' +' Typical customizations that may be done in this class include +' - overriding base class methods + +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + +Namespace Persons.Data + + ''' + ''' Used by the class to access and/or modify the database. + ''' + ''' + ''' This class is not intended to be instantiated directly. To obtain an instance of this class, + ''' use the methods of the class. + ''' + ''' + + Public Class SportSqlTable + Inherits BaseSportSqlTable + + 'The functions below may be overridden in order to implement your own + 'logic for creating, updating, deleting, and getting individual records, + 'or for running queries that return lists of records. + + ' Creates a new record. + ' Before calling this method, column values should be set using SetColumn(). + 'Public Overloads Overrides Function CreateRecord() As KeyValue + 'End Function + + ' Updates a record in the database. + ' Before calling this method, column values should be set using SetColumn(). + 'Protected Overrides Sub UpdateRecord() + 'End Sub + + ' Deletes a record defined by a primary key value. + 'Public Overloads Overrides Sub DeleteRecord(ByVal key As KeyValue) + 'End Sub + + ' Gets a record from the database. + 'Protected Overloads Overrides Sub GetRecord() + 'End Sub + End Class +End Namespace diff --git a/App_Code/Data Access Layer/Status.xml b/App_Code/Data Access Layer/Status.xml new file mode 100644 index 0000000..034a9c5 --- /dev/null +++ b/App_Code/Data Access Layer/Status.xml @@ -0,0 +1,115 @@ + + + + + StatusId + %ISD_DEFAULT% + Number + tinyint + 3.0 + + + + + Y + Y + + + + + Y + N + N + N + N + Y + Y + N + + + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + Status + %ISD_DEFAULT% + String + nvarchar + 50 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + Status + 1 + dbo + Status + Status_ + DatabasePersons1 + RowNum + Y + Y + Y + Y + BinaryChecksum + Persons + \ No newline at end of file diff --git a/App_Code/Data Access Layer/StatusDefinition.vb b/App_Code/Data Access Layer/StatusDefinition.vb new file mode 100644 index 0000000..6eae834 --- /dev/null +++ b/App_Code/Data Access Layer/StatusDefinition.vb @@ -0,0 +1,126 @@ +Namespace Persons.Business +''' +''' Contains embedded schema and configuration data that is used by the +''' Persons.StatusTable class +''' to initialize the class's TableDefinition. +''' +''' + +Public Class StatusDefinition + +#Region "Definition (XML) for StatusDefinition table" + 'Next 93 lines contain Table Definition (XML) for table "StatusDefinition" + Private Shared _DefinitionString As String = "" +#End Region + + ''' + ''' Gets the embedded schema and configuration data for the + ''' + ''' class's TableDefinition. + ''' + ''' This function is only called once at runtime. + ''' An XML string. + Public Shared Function GetXMLString() As String + If _DefinitionString = "" Then + Dim tbf As System.Text.StringBuilder = New System.Text.StringBuilder() + tbf.Append("") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "StatusId") + tbf.Append( "Status") + tbf.Append( "Number") + tbf.Append( "tinyint") + tbf.Append( "3.0") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Status") + tbf.Append( "Status") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "50") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Status") + tbf.Append( "1") + tbf.Append( "dbo") + tbf.Append( "Status") + tbf.Append( "Status_") + tbf.Append( "DatabasePersons1") + tbf.Append( "RowNum") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "BinaryChecksum") + tbf.Append( "Persons") + tbf.Append("") + _DefinitionString = tbf.ToString() + + End If + Return _DefinitionString + End Function + +End Class +End Namespace diff --git a/App_Code/Data Access Layer/StatusSqlTable.vb b/App_Code/Data Access Layer/StatusSqlTable.vb new file mode 100644 index 0000000..e5ec0b5 --- /dev/null +++ b/App_Code/Data Access Layer/StatusSqlTable.vb @@ -0,0 +1,47 @@ +' This is a "safe" class, meaning that it is created once +' and never overwritten. Any custom code you add to this class +' will be preserved when you regenerate your application. +' +' Typical customizations that may be done in this class include +' - overriding base class methods + +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + +Namespace Persons.Data + + ''' + ''' Used by the class to access and/or modify the database. + ''' + ''' + ''' This class is not intended to be instantiated directly. To obtain an instance of this class, + ''' use the methods of the class. + ''' + ''' + + Public Class StatusSqlTable + Inherits BaseStatusSqlTable + + 'The functions below may be overridden in order to implement your own + 'logic for creating, updating, deleting, and getting individual records, + 'or for running queries that return lists of records. + + ' Creates a new record. + ' Before calling this method, column values should be set using SetColumn(). + 'Public Overloads Overrides Function CreateRecord() As KeyValue + 'End Function + + ' Updates a record in the database. + ' Before calling this method, column values should be set using SetColumn(). + 'Protected Overrides Sub UpdateRecord() + 'End Sub + + ' Deletes a record defined by a primary key value. + 'Public Overloads Overrides Sub DeleteRecord(ByVal key As KeyValue) + 'End Sub + + ' Gets a record from the database. + 'Protected Overloads Overrides Sub GetRecord() + 'End Sub + End Class +End Namespace diff --git a/App_Code/Data Access Layer/TblRoleDefinition.vb b/App_Code/Data Access Layer/TblRoleDefinition.vb new file mode 100644 index 0000000..f945e04 --- /dev/null +++ b/App_Code/Data Access Layer/TblRoleDefinition.vb @@ -0,0 +1,126 @@ +Namespace Persons.Business +''' +''' Contains embedded schema and configuration data that is used by the +''' Persons.TblRoleTable class +''' to initialize the class's TableDefinition. +''' +''' + +Public Class TblRoleDefinition + +#Region "Definition (XML) for TblRoleDefinition table" + 'Next 93 lines contain Table Definition (XML) for table "TblRoleDefinition" + Private Shared _DefinitionString As String = "" +#End Region + + ''' + ''' Gets the embedded schema and configuration data for the + ''' + ''' class's TableDefinition. + ''' + ''' This function is only called once at runtime. + ''' An XML string. + Public Shared Function GetXMLString() As String + If _DefinitionString = "" Then + Dim tbf As System.Text.StringBuilder = New System.Text.StringBuilder() + tbf.Append("") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "RoleId") + tbf.Append( "Role") + tbf.Append( "Number") + tbf.Append( "tinyint") + tbf.Append( "3.0") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Role") + tbf.Append( "Role") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "50") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "tblRole") + tbf.Append( "1") + tbf.Append( "dbo") + tbf.Append( "TblRole") + tbf.Append( "TblRole_") + tbf.Append( "DatabasePersons1") + tbf.Append( "RowNum") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "BinaryChecksum") + tbf.Append( "Persons") + tbf.Append("") + _DefinitionString = tbf.ToString() + + End If + Return _DefinitionString + End Function + +End Class +End Namespace diff --git a/App_Code/Data Access Layer/TblRoleSqlTable.vb b/App_Code/Data Access Layer/TblRoleSqlTable.vb new file mode 100644 index 0000000..0518ee3 --- /dev/null +++ b/App_Code/Data Access Layer/TblRoleSqlTable.vb @@ -0,0 +1,47 @@ +' This is a "safe" class, meaning that it is created once +' and never overwritten. Any custom code you add to this class +' will be preserved when you regenerate your application. +' +' Typical customizations that may be done in this class include +' - overriding base class methods + +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + +Namespace Persons.Data + + ''' + ''' Used by the class to access and/or modify the database. + ''' + ''' + ''' This class is not intended to be instantiated directly. To obtain an instance of this class, + ''' use the methods of the class. + ''' + ''' + + Public Class TblRoleSqlTable + Inherits BaseTblRoleSqlTable + + 'The functions below may be overridden in order to implement your own + 'logic for creating, updating, deleting, and getting individual records, + 'or for running queries that return lists of records. + + ' Creates a new record. + ' Before calling this method, column values should be set using SetColumn(). + 'Public Overloads Overrides Function CreateRecord() As KeyValue + 'End Function + + ' Updates a record in the database. + ' Before calling this method, column values should be set using SetColumn(). + 'Protected Overrides Sub UpdateRecord() + 'End Sub + + ' Deletes a record defined by a primary key value. + 'Public Overloads Overrides Sub DeleteRecord(ByVal key As KeyValue) + 'End Sub + + ' Gets a record from the database. + 'Protected Overloads Overrides Sub GetRecord() + 'End Sub + End Class +End Namespace diff --git a/App_Code/Data Access Layer/TblUserRoleDefinition.vb b/App_Code/Data Access Layer/TblUserRoleDefinition.vb new file mode 100644 index 0000000..a035287 --- /dev/null +++ b/App_Code/Data Access Layer/TblUserRoleDefinition.vb @@ -0,0 +1,183 @@ +Namespace Persons.Business +''' +''' Contains embedded schema and configuration data that is used by the +''' Persons.TblUserRoleTable class +''' to initialize the class's TableDefinition. +''' +''' + +Public Class TblUserRoleDefinition + +#Region "Definition (XML) for TblUserRoleDefinition table" + 'Next 150 lines contain Table Definition (XML) for table "TblUserRoleDefinition" + Private Shared _DefinitionString As String = "" +#End Region + + ''' + ''' Gets the embedded schema and configuration data for the + ''' + ''' class's TableDefinition. + ''' + ''' This function is only called once at runtime. + ''' An XML string. + Public Shared Function GetXMLString() As String + If _DefinitionString = "" Then + Dim tbf As System.Text.StringBuilder = New System.Text.StringBuilder() + tbf.Append("") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "UserRoleId") + tbf.Append( "User Role") + tbf.Append( "Number") + tbf.Append( "int") + tbf.Append( "10.0") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "PersonalId") + tbf.Append( "Personal") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "13") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "") + tbf.Append( "FK_tblUserRole_PersonalId") + tbf.Append( "Persons.Business.PersonalIdTable, App_Code") + tbf.Append( "dbo") + tbf.Append( "PersonalId") + tbf.Append( "PersonalName") + tbf.Append( "Explicit") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "RoleId") + tbf.Append( "Role") + tbf.Append( "Number") + tbf.Append( "tinyint") + tbf.Append( "3.0") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "") + tbf.Append( "FK_tblUserRole_tblRole") + tbf.Append( "Persons.Business.TblRoleTable, App_Code") + tbf.Append( "dbo") + tbf.Append( "RoleId") + tbf.Append( "Role") + tbf.Append( "Explicit") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "tblUserRole") + tbf.Append( "1") + tbf.Append( "dbo") + tbf.Append( "TblUserRole") + tbf.Append( "TblUserRole_") + tbf.Append( "DatabasePersons1") + tbf.Append( "RowNum") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "BinaryChecksum") + tbf.Append( "Persons") + tbf.Append( "Y") + tbf.Append( "RoleId") + tbf.Append( "PersonalId") + tbf.Append("") + _DefinitionString = tbf.ToString() + + End If + Return _DefinitionString + End Function + +End Class +End Namespace diff --git a/App_Code/Data Access Layer/TblUserRoleSqlTable.vb b/App_Code/Data Access Layer/TblUserRoleSqlTable.vb new file mode 100644 index 0000000..df0a848 --- /dev/null +++ b/App_Code/Data Access Layer/TblUserRoleSqlTable.vb @@ -0,0 +1,47 @@ +' This is a "safe" class, meaning that it is created once +' and never overwritten. Any custom code you add to this class +' will be preserved when you regenerate your application. +' +' Typical customizations that may be done in this class include +' - overriding base class methods + +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + +Namespace Persons.Data + + ''' + ''' Used by the class to access and/or modify the database. + ''' + ''' + ''' This class is not intended to be instantiated directly. To obtain an instance of this class, + ''' use the methods of the class. + ''' + ''' + + Public Class TblUserRoleSqlTable + Inherits BaseTblUserRoleSqlTable + + 'The functions below may be overridden in order to implement your own + 'logic for creating, updating, deleting, and getting individual records, + 'or for running queries that return lists of records. + + ' Creates a new record. + ' Before calling this method, column values should be set using SetColumn(). + 'Public Overloads Overrides Function CreateRecord() As KeyValue + 'End Function + + ' Updates a record in the database. + ' Before calling this method, column values should be set using SetColumn(). + 'Protected Overrides Sub UpdateRecord() + 'End Sub + + ' Deletes a record defined by a primary key value. + 'Public Overloads Overrides Sub DeleteRecord(ByVal key As KeyValue) + 'End Sub + + ' Gets a record from the database. + 'Protected Overloads Overrides Sub GetRecord() + 'End Sub + End Class +End Namespace diff --git a/App_Code/Data Access Layer/View_MaxPersonalEducation.xml b/App_Code/Data Access Layer/View_MaxPersonalEducation.xml new file mode 100644 index 0000000..1aceb46 --- /dev/null +++ b/App_Code/Data Access Layer/View_MaxPersonalEducation.xml @@ -0,0 +1,1529 @@ + + + + + PersonalId + %ISD_DEFAULT% + String + nvarchar + 13 + + + + + N + N + notrim, + + + Y + N + N + N + N + Y + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + RankId + %ISD_DEFAULT% + Number + int + 10.0 + + + + + N + N + + + + + N + N + N + N + N + Y + Y + N + + + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + ShortRankNormal + %ISD_DEFAULT% + String + nvarchar + 50 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + PersonalName + %ISD_DEFAULT% + String + nvarchar + 50 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + PersonalLastName + %ISD_DEFAULT% + String + nvarchar + 50 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + SectionName + %ISD_DEFAULT% + String + nvarchar + 100 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + Level + ระดับการศึกษา + String + nvarchar + 50 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + StartDate + %ISD_DEFAULT% + Date + datetime + + + + + + + N + N + + + g + g + N + N + N + N + N + N + N + N + + + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + EndDate + %ISD_DEFAULT% + Date + datetime + + + + + + + N + N + + + g + g + N + N + N + N + N + N + N + N + + + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + Course + หลักสูตร + String + nvarchar + 60 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + CourseAbbr + คุณวุฒิ + String + nvarchar + 50 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + Institue + สถาบันการศึกษา + String + nvarchar + 60 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + Facultry + สาขาวิชา + String + nvarchar + 60 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + LevelId + %ISD_DEFAULT% + Number + smallint + 5.0 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + + + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + EdYear + ปีการศึกษา + String + nvarchar + 4 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + EducationPeriod + %ISD_DEFAULT% + Number + tinyint + 3.0 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + + + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + EducationType + %ISD_DEFAULT% + Number + tinyint + 3.0 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + + + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + CourseNo + %ISD_DEFAULT% + String + nvarchar + 3 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + ScoreNo + %ISD_DEFAULT% + String + nvarchar + 3 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + NoAll + %ISD_DEFAULT% + String + nvarchar + 3 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + Score + %ISD_DEFAULT% + String + nvarchar + 5 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + Command + %ISD_DEFAULT% + String + nvarchar + 50 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + CommandDate + %ISD_DEFAULT% + Date + datetime + + + + + + + N + N + + + g + g + N + N + N + N + N + N + N + N + + + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + Country + %ISD_DEFAULT% + Country + nvarchar + 50 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + DateRank + %ISD_DEFAULT% + Date + datetime + + + + + + + N + N + + + d + d + N + N + N + N + N + N + N + N + + + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + DatePrevRank + %ISD_DEFAULT% + Date + datetime + + + + + + + N + N + + + d + d + N + N + N + N + N + N + N + N + + + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + StatusId + %ISD_DEFAULT% + Number + tinyint + 3.0 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + + + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + RankLevelName + ระดับยศ + String + nvarchar + 50 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + SectionAbbvrName + หน่วย + String + nvarchar + 25 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + RankAndName + ยศ ชื่อ นามสกุล + String + nvarchar + 208 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + RankLevel + ระดับยศ + Number + int + 10.0 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + + + N + %ISD_DEFAULT% + + + Y + Y + N + N + N + N + N + N + + + + + + + + + + + + VFK_View_MaxPersonalEducation_RankLevel_1 + Rank + dbo + RankLevel + RankLevelName + Implicit + + + + View_MaxPersonalEducation + 6 + dbo + View_MaxPersonalEducation + View_MaxPersonalEducation_ + DatabasePersons1 + RowNum + Y + Y + Y + Y + Persons + \ No newline at end of file diff --git a/App_Code/Data Access Layer/View_MaxPersonalEducationDefinition.vb b/App_Code/Data Access Layer/View_MaxPersonalEducationDefinition.vb new file mode 100644 index 0000000..4d33fd0 --- /dev/null +++ b/App_Code/Data Access Layer/View_MaxPersonalEducationDefinition.vb @@ -0,0 +1,1241 @@ +Namespace Persons.Business +''' +''' Contains embedded schema and configuration data that is used by the +''' Persons.View_MaxPersonalEducationView class +''' to initialize the class's TableDefinition. +''' +''' + +Public Class View_MaxPersonalEducationDefinition + +#Region "Definition (XML) for View_MaxPersonalEducationDefinition table" + 'Next 1208 lines contain Table Definition (XML) for table "View_MaxPersonalEducationDefinition" + Private Shared _DefinitionString As String = "" +#End Region + + ''' + ''' Gets the embedded schema and configuration data for the + ''' + ''' class's TableDefinition. + ''' + ''' This function is only called once at runtime. + ''' An XML string. + Public Shared Function GetXMLString() As String + If _DefinitionString = "" Then + Dim tbf As System.Text.StringBuilder = New System.Text.StringBuilder() + tbf.Append("") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "PersonalId") + tbf.Append( "Personal") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "13") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "notrim,") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "RankId") + tbf.Append( "Rank") + tbf.Append( "Number") + tbf.Append( "int") + tbf.Append( "10.0") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "ShortRankNormal") + tbf.Append( "Short Rank Normal") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "50") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "PersonalName") + tbf.Append( "Personal Name") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "50") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "PersonalLastName") + tbf.Append( "Personal Last Name") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "50") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "SectionName") + tbf.Append( "Section Name") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "100") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Level") + tbf.Append( "ระดับการศึกษา") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "50") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "StartDate") + tbf.Append( "Start Date") + tbf.Append( "Date") + tbf.Append( "datetime") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "g") + tbf.Append( "g") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "EndDate") + tbf.Append( "End Date") + tbf.Append( "Date") + tbf.Append( "datetime") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "g") + tbf.Append( "g") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Course") + tbf.Append( "หลักสูตร") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "60") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "CourseAbbr") + tbf.Append( "คุณวุฒิ") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "50") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Institue") + tbf.Append( "สถาบันการศึกษา") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "60") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Facultry") + tbf.Append( "สาขาวิชา") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "60") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "LevelId") + tbf.Append( "Level") + tbf.Append( "Number") + tbf.Append( "smallint") + tbf.Append( "5.0") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "EdYear") + tbf.Append( "ปีการศึกษา") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "4") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "EducationPeriod") + tbf.Append( "Education Period") + tbf.Append( "Number") + tbf.Append( "tinyint") + tbf.Append( "3.0") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "EducationType") + tbf.Append( "Education Type") + tbf.Append( "Number") + tbf.Append( "tinyint") + tbf.Append( "3.0") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "CourseNo") + tbf.Append( "Course No") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "3") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "ScoreNo") + tbf.Append( "Score No") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "3") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "NoAll") + tbf.Append( "No All") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "3") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Score") + tbf.Append( "Score") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "5") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Command") + tbf.Append( "Command") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "50") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "CommandDate") + tbf.Append( "Command Date") + tbf.Append( "Date") + tbf.Append( "datetime") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "g") + tbf.Append( "g") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Country") + tbf.Append( "Country") + tbf.Append( "Country") + tbf.Append( "nvarchar") + tbf.Append( "50") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "DateRank") + tbf.Append( "Date Rank") + tbf.Append( "Date") + tbf.Append( "datetime") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "d") + tbf.Append( "d") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "DatePrevRank") + tbf.Append( "Date Prev Rank") + tbf.Append( "Date") + tbf.Append( "datetime") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "d") + tbf.Append( "d") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "StatusId") + tbf.Append( "Status") + tbf.Append( "Number") + tbf.Append( "tinyint") + tbf.Append( "3.0") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "RankLevelName") + tbf.Append( "ระดับยศ") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "50") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "SectionAbbvrName") + tbf.Append( "หน่วย") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "25") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "RankAndName") + tbf.Append( "ยศ ชื่อ นามสกุล") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "208") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "RankLevel") + tbf.Append( "ระดับยศ") + tbf.Append( "Number") + tbf.Append( "int") + tbf.Append( "10.0") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "VFK_View_MaxPersonalEducation_RankLevel_1") + tbf.Append( "Persons.Business.RankTable, App_Code") + tbf.Append( "dbo") + tbf.Append( "RankLevel") + tbf.Append( "RankLevelName") + tbf.Append( "Implicit") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "View_MaxPersonalEducation") + tbf.Append( "6") + tbf.Append( "dbo") + tbf.Append( "View_MaxPersonalEducation") + tbf.Append( "View_MaxPersonalEducation_") + tbf.Append( "DatabasePersons1") + tbf.Append( "RowNum") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "Persons") + tbf.Append("") + _DefinitionString = tbf.ToString() + + End If + Return _DefinitionString + End Function + +End Class +End Namespace diff --git a/App_Code/Data Access Layer/View_MaxPersonalEducationSqlView.vb b/App_Code/Data Access Layer/View_MaxPersonalEducationSqlView.vb new file mode 100644 index 0000000..2b4fb69 --- /dev/null +++ b/App_Code/Data Access Layer/View_MaxPersonalEducationSqlView.vb @@ -0,0 +1,33 @@ +' This is a "safe" class, meaning that it is created once +' and never overwritten. Any custom code you add to this class +' will be preserved when you regenerate your application. +' +' Typical customizations that may be done in this class include +' - overriding base class methods + +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + +Namespace Persons.Data + +''' +''' Used by the class to access and/or modify the database. +''' +''' +''' This class is not intended to be instantiated directly. To obtain an instance of this class, +''' use the methods of the class. +''' +''' This is a "safe" class, meaning that it is generated once and never overwritten. +''' Any changes you make to this class will be preserved when you regenerate your application. +''' +''' +''' + +Public Class View_MaxPersonalEducationSqlView + Inherits BaseView_MaxPersonalEducationSqlView + + 'The functions below may be overridden in order to implement your own + 'logic for running queries that return lists of records. + +End Class +End Namespace diff --git a/App_Code/Data Access Layer/View_PersonalEducation.xml b/App_Code/Data Access Layer/View_PersonalEducation.xml new file mode 100644 index 0000000..c7cf57d --- /dev/null +++ b/App_Code/Data Access Layer/View_PersonalEducation.xml @@ -0,0 +1,1132 @@ + + + + + PersonalId + %ISD_DEFAULT% + String + nvarchar + 13 + + + + + N + N + + + + + N + N + N + N + N + Y + Y + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + RankAndName + %ISD_DEFAULT% + String + nvarchar + 207 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + SectionId + %ISD_DEFAULT% + Number + smallint + 5.0 + + + + + N + N + + + + + N + N + N + N + N + Y + Y + N + + + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + SectionName + %ISD_DEFAULT% + String + nvarchar + 100 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + SectionAbbvrName + %ISD_DEFAULT% + String + nvarchar + 25 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + ShortRankNormal + %ISD_DEFAULT% + String + nvarchar + 50 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + StartDate + %ISD_DEFAULT% + Date + datetime + + + + + + + N + N + + + g + g + N + N + N + N + N + N + N + N + + + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + EndDate + %ISD_DEFAULT% + Date + datetime + + + + + + + N + N + + + g + g + N + N + N + N + N + N + N + N + + + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + Course + %ISD_DEFAULT% + String + nvarchar + 60 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + CourseAbbr + %ISD_DEFAULT% + String + nvarchar + 50 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + Institue + %ISD_DEFAULT% + String + nvarchar + 60 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + Facultry + %ISD_DEFAULT% + String + nvarchar + 60 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + LevelId + %ISD_DEFAULT% + Number + smallint + 5.0 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + + + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + EdYear + %ISD_DEFAULT% + String + nvarchar + 4 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + EducationPeriod + %ISD_DEFAULT% + Number + tinyint + 3.0 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + + + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + EducationType + %ISD_DEFAULT% + Number + tinyint + 3.0 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + + + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + COUNTRY + %ISD_DEFAULT% + Number + smallint + 5.0 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + + + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + CourseNo + %ISD_DEFAULT% + String + nvarchar + 3 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + ScoreNo + %ISD_DEFAULT% + String + nvarchar + 3 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + NoAll + %ISD_DEFAULT% + String + nvarchar + 3 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + Score + %ISD_DEFAULT% + String + nvarchar + 5 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + Command + %ISD_DEFAULT% + String + nvarchar + 50 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + CommandDate + %ISD_DEFAULT% + Date + datetime + + + + + + + N + N + + + g + g + N + N + N + N + N + N + N + N + + + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + View_PersonalEducation + 1 + dbo + View_PersonalEducation + View_PersonalEducation_ + DatabasePersons1 + RowNum + N + N + N + N + Persons + \ No newline at end of file diff --git a/App_Code/Data Access Layer/View_PersonalEducationDefinition.vb b/App_Code/Data Access Layer/View_PersonalEducationDefinition.vb new file mode 100644 index 0000000..77b2eb6 --- /dev/null +++ b/App_Code/Data Access Layer/View_PersonalEducationDefinition.vb @@ -0,0 +1,926 @@ +Namespace Persons.Business +''' +''' Contains embedded schema and configuration data that is used by the +''' Persons.View_PersonalEducationView class +''' to initialize the class's TableDefinition. +''' +''' + +Public Class View_PersonalEducationDefinition + +#Region "Definition (XML) for View_PersonalEducationDefinition table" + 'Next 893 lines contain Table Definition (XML) for table "View_PersonalEducationDefinition" + Private Shared _DefinitionString As String = "" +#End Region + + ''' + ''' Gets the embedded schema and configuration data for the + ''' + ''' class's TableDefinition. + ''' + ''' This function is only called once at runtime. + ''' An XML string. + Public Shared Function GetXMLString() As String + If _DefinitionString = "" Then + Dim tbf As System.Text.StringBuilder = New System.Text.StringBuilder() + tbf.Append("") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "PersonalId") + tbf.Append( "Personal") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "13") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "RankAndName") + tbf.Append( "Rank And Name") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "207") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "SectionId") + tbf.Append( "Section") + tbf.Append( "Number") + tbf.Append( "smallint") + tbf.Append( "5.0") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "SectionName") + tbf.Append( "Section Name") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "100") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "SectionAbbvrName") + tbf.Append( "Section Abbvr Name") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "25") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "ShortRankNormal") + tbf.Append( "Short Rank Normal") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "50") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "StartDate") + tbf.Append( "Start Date") + tbf.Append( "Date") + tbf.Append( "datetime") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "g") + tbf.Append( "g") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "EndDate") + tbf.Append( "End Date") + tbf.Append( "Date") + tbf.Append( "datetime") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "g") + tbf.Append( "g") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Course") + tbf.Append( "Course") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "60") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "CourseAbbr") + tbf.Append( "Course Abbr") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "50") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Institue") + tbf.Append( "Institue") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "60") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Facultry") + tbf.Append( "Facultry") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "60") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "LevelId") + tbf.Append( "Level") + tbf.Append( "Number") + tbf.Append( "smallint") + tbf.Append( "5.0") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "EdYear") + tbf.Append( "Ed Year") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "4") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "EducationPeriod") + tbf.Append( "Education Period") + tbf.Append( "Number") + tbf.Append( "tinyint") + tbf.Append( "3.0") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "EducationType") + tbf.Append( "Education Type") + tbf.Append( "Number") + tbf.Append( "tinyint") + tbf.Append( "3.0") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "COUNTRY") + tbf.Append( "Country") + tbf.Append( "Number") + tbf.Append( "smallint") + tbf.Append( "5.0") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "CourseNo") + tbf.Append( "Course No") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "3") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "ScoreNo") + tbf.Append( "Score No") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "3") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "NoAll") + tbf.Append( "No All") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "3") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Score") + tbf.Append( "Score") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "5") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Command") + tbf.Append( "Command") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "50") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "CommandDate") + tbf.Append( "Command Date") + tbf.Append( "Date") + tbf.Append( "datetime") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "g") + tbf.Append( "g") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "View_PersonalEducation") + tbf.Append( "1") + tbf.Append( "dbo") + tbf.Append( "View_PersonalEducation") + tbf.Append( "View_PersonalEducation_") + tbf.Append( "DatabasePersons1") + tbf.Append( "RowNum") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Persons") + tbf.Append("") + _DefinitionString = tbf.ToString() + + End If + Return _DefinitionString + End Function + +End Class +End Namespace diff --git a/App_Code/Data Access Layer/View_PersonalEducationSqlView.vb b/App_Code/Data Access Layer/View_PersonalEducationSqlView.vb new file mode 100644 index 0000000..7e80b01 --- /dev/null +++ b/App_Code/Data Access Layer/View_PersonalEducationSqlView.vb @@ -0,0 +1,33 @@ +' This is a "safe" class, meaning that it is created once +' and never overwritten. Any custom code you add to this class +' will be preserved when you regenerate your application. +' +' Typical customizations that may be done in this class include +' - overriding base class methods + +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + +Namespace Persons.Data + +''' +''' Used by the class to access and/or modify the database. +''' +''' +''' This class is not intended to be instantiated directly. To obtain an instance of this class, +''' use the methods of the class. +''' +''' This is a "safe" class, meaning that it is generated once and never overwritten. +''' Any changes you make to this class will be preserved when you regenerate your application. +''' +''' +''' + +Public Class View_PersonalEducationSqlView + Inherits BaseView_PersonalEducationSqlView + + 'The functions below may be overridden in order to implement your own + 'logic for running queries that return lists of records. + +End Class +End Namespace diff --git a/App_Code/Data Access Layer/View_Persons.xml b/App_Code/Data Access Layer/View_Persons.xml new file mode 100644 index 0000000..d9fb7c4 --- /dev/null +++ b/App_Code/Data Access Layer/View_Persons.xml @@ -0,0 +1,1256 @@ + + + + + PersonalId + %ISD_DEFAULT% + String + nvarchar + 13 + + + + + N + N + notrim, + + + Y + N + N + N + N + Y + Y + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + ArmyId + เหล่าทัพ + Number + tinyint + 3.0 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + + + N + %ISD_DEFAULT% + + + Y + Y + N + N + N + N + N + N + + + + + + + + + + + + VFK_View_Persons_ArmyId_1 + Army + dbo + ArmyId + Army + Implicit + + + + ArmSName + เหล่า + String + nvarchar + 50 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + SectionId + หน่วย + Number + smallint + 5.0 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + + + N + %ISD_DEFAULT% + + + Y + Y + N + N + N + N + N + N + + + + + + + + + + + + VFK_View_Persons_SectionId_1 + Section + dbo + SectionId + SectionAbbvrName + Implicit + + + + SectionAbbvrName + หน่วย + String + nvarchar + 25 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + DeptId + โรงงาน/กอง + Number + smallint + 5.0 + + + + + N + N + + + + + N + N + N + N + N + Y + N + N + + + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + DeptAbbvr + %ISD_DEFAULT% + String + nvarchar + 25 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + RankId + %ISD_DEFAULT% + Number + int + 10.0 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + + + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + PersonalName + ยศ ชื่อ นามสกุล + String + nvarchar + 50 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + PersonalLastName + %ISD_DEFAULT% + String + nvarchar + 50 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + BirthDate + %ISD_DEFAULT% + Date + datetime + + + + + + + N + N + + + g + g + N + N + N + N + N + N + N + N + + + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + Retire + เกษียณ + String + nchar + 4 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + Commission + หน้าที่/งานที่ปฏิบัติ + String + nvarchar + 2000 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + Born + กำเนิด + String + nvarchar + 25 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + DateRank + %ISD_DEFAULT% + Date + datetime + + + + + + + N + N + + + d + d + N + N + N + N + N + N + N + N + + + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + DatePrevRank + %ISD_DEFAULT% + Date + datetime + + + + + + + N + N + + + d + d + N + N + N + N + N + N + N + N + + + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + BProvince + จังหวัดที่เกิด + String + nvarchar + 50 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + SAmout + เงินเดือน + Currency + money + 19.4 + + + + + N + N + + + #,### + C + N + N + N + N + N + N + N + N + + + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + CEdu + คุณวุฒิ + String + nvarchar + 50 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + MobilePhone + โทร. + String + nvarchar + 15 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + picture + %ISD_DEFAULT% + Image + image + 2147483647 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + + + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + RankDate + วันที่ติดยศ + Date + date + + + + + + + N + N + + + d + d + N + N + N + N + N + N + N + N + + + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + Title + ตำแหน่ง + String + nvarchar + 50 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + RankLevel + ระดับยศ + Number + int + 10.0 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + + + N + %ISD_DEFAULT% + + + Y + Y + N + N + N + N + N + N + + + + + + + + + + + + VFK_View_Persons_RankLevel_1 + Rank + dbo + RankLevel + RankLevelName + Implicit + + + + RankAndName + %ISD_DEFAULT% + String + nvarchar + 208 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + View_Persons + 13 + dbo + View_Persons + View_Persons_ + DatabasePersons1 + RowNum + Y + Y + Y + Y + Persons + \ No newline at end of file diff --git a/App_Code/Data Access Layer/View_PersonsDefinition.vb b/App_Code/Data Access Layer/View_PersonsDefinition.vb new file mode 100644 index 0000000..7fa2ad6 --- /dev/null +++ b/App_Code/Data Access Layer/View_PersonsDefinition.vb @@ -0,0 +1,1029 @@ +Namespace Persons.Business +''' +''' Contains embedded schema and configuration data that is used by the +''' Persons.View_PersonsView class +''' to initialize the class's TableDefinition. +''' +''' + +Public Class View_PersonsDefinition + +#Region "Definition (XML) for View_PersonsDefinition table" + 'Next 996 lines contain Table Definition (XML) for table "View_PersonsDefinition" + Private Shared _DefinitionString As String = "" +#End Region + + ''' + ''' Gets the embedded schema and configuration data for the + ''' + ''' class's TableDefinition. + ''' + ''' This function is only called once at runtime. + ''' An XML string. + Public Shared Function GetXMLString() As String + If _DefinitionString = "" Then + Dim tbf As System.Text.StringBuilder = New System.Text.StringBuilder() + tbf.Append("") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "PersonalId") + tbf.Append( "Personal") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "13") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "notrim,") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "ArmyId") + tbf.Append( "เหล่าทัพ") + tbf.Append( "Number") + tbf.Append( "tinyint") + tbf.Append( "3.0") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "VFK_View_Persons_ArmyId_1") + tbf.Append( "Persons.Business.ArmyTable, App_Code") + tbf.Append( "dbo") + tbf.Append( "ArmyId") + tbf.Append( "Army") + tbf.Append( "Implicit") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "ArmSName") + tbf.Append( "เหล่า") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "50") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "SectionId") + tbf.Append( "หน่วย") + tbf.Append( "Number") + tbf.Append( "smallint") + tbf.Append( "5.0") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "VFK_View_Persons_SectionId_1") + tbf.Append( "Persons.Business.SectionTable, App_Code") + tbf.Append( "dbo") + tbf.Append( "SectionId") + tbf.Append( "SectionAbbvrName") + tbf.Append( "Implicit") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "SectionAbbvrName") + tbf.Append( "หน่วย") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "25") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "DeptId") + tbf.Append( "โรงงาน/กอง") + tbf.Append( "Number") + tbf.Append( "smallint") + tbf.Append( "5.0") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "DeptAbbvr") + tbf.Append( "Dept Abbvr") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "25") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "RankId") + tbf.Append( "Rank") + tbf.Append( "Number") + tbf.Append( "int") + tbf.Append( "10.0") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "PersonalName") + tbf.Append( "ยศ ชื่อ นามสกุล") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "50") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "PersonalLastName") + tbf.Append( "Personal Last Name") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "50") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "BirthDate") + tbf.Append( "Birth Date") + tbf.Append( "Date") + tbf.Append( "datetime") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "g") + tbf.Append( "g") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Retire") + tbf.Append( "เกษียณ") + tbf.Append( "String") + tbf.Append( "nchar") + tbf.Append( "4") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Commission") + tbf.Append( "หน้าที่/งานที่ปฏิบัติ") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "2000") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Born") + tbf.Append( "กำเนิด") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "25") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "DateRank") + tbf.Append( "Date Rank") + tbf.Append( "Date") + tbf.Append( "datetime") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "d") + tbf.Append( "d") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "DatePrevRank") + tbf.Append( "Date Prev Rank") + tbf.Append( "Date") + tbf.Append( "datetime") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "d") + tbf.Append( "d") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "BProvince") + tbf.Append( "จังหวัดที่เกิด") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "50") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "SAmout") + tbf.Append( "เงินเดือน") + tbf.Append( "Currency") + tbf.Append( "money") + tbf.Append( "19.4") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "#,###") + tbf.Append( "C") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "CEdu") + tbf.Append( "คุณวุฒิ") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "50") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "MobilePhone") + tbf.Append( "โทร.") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "15") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "picture") + tbf.Append( "Picture") + tbf.Append( "Image") + tbf.Append( "image") + tbf.Append( "2147483647") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "RankDate") + tbf.Append( "วันที่ติดยศ") + tbf.Append( "Date") + tbf.Append( "date") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "d") + tbf.Append( "d") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "Title") + tbf.Append( "ตำแหน่ง") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "50") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "RankLevel") + tbf.Append( "ระดับยศ") + tbf.Append( "Number") + tbf.Append( "int") + tbf.Append( "10.0") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "VFK_View_Persons_RankLevel_1") + tbf.Append( "Persons.Business.RankTable, App_Code") + tbf.Append( "dbo") + tbf.Append( "RankLevel") + tbf.Append( "RankLevelName") + tbf.Append( "Implicit") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "RankAndName") + tbf.Append( "Rank And Name") + tbf.Append( "String") + tbf.Append( "nvarchar") + tbf.Append( "208") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "Thai_CI_AS") + tbf.Append( "N") + tbf.Append( "%ISD_DEFAULT%") + tbf.Append( "") + tbf.Append( "Y") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "N") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "") + tbf.Append( "View_Persons") + tbf.Append( "13") + tbf.Append( "dbo") + tbf.Append( "View_Persons") + tbf.Append( "View_Persons_") + tbf.Append( "DatabasePersons1") + tbf.Append( "RowNum") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "Y") + tbf.Append( "Persons") + tbf.Append("") + _DefinitionString = tbf.ToString() + + End If + Return _DefinitionString + End Function + +End Class +End Namespace diff --git a/App_Code/Data Access Layer/View_PersonsSqlView.vb b/App_Code/Data Access Layer/View_PersonsSqlView.vb new file mode 100644 index 0000000..853cac2 --- /dev/null +++ b/App_Code/Data Access Layer/View_PersonsSqlView.vb @@ -0,0 +1,33 @@ +' This is a "safe" class, meaning that it is created once +' and never overwritten. Any custom code you add to this class +' will be preserved when you regenerate your application. +' +' Typical customizations that may be done in this class include +' - overriding base class methods + +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider + +Namespace Persons.Data + +''' +''' Used by the class to access and/or modify the database. +''' +''' +''' This class is not intended to be instantiated directly. To obtain an instance of this class, +''' use the methods of the class. +''' +''' This is a "safe" class, meaning that it is generated once and never overwritten. +''' Any changes you make to this class will be preserved when you regenerate your application. +''' +''' +''' + +Public Class View_PersonsSqlView + Inherits BaseView_PersonsSqlView + + 'The functions below may be overridden in order to implement your own + 'logic for running queries that return lists of records. + +End Class +End Namespace diff --git a/App_Code/Data Access Layer/relation.xml b/App_Code/Data Access Layer/relation.xml new file mode 100644 index 0000000..b3cf939 --- /dev/null +++ b/App_Code/Data Access Layer/relation.xml @@ -0,0 +1,115 @@ + + + + + RelationId + %ISD_DEFAULT% + Number + int + 10.0 + + + + + Y + Y + + + + + Y + N + N + N + N + Y + Y + N + + + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + Relation + ความสัมพันธ์ + String + nvarchar + 50 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + relation + 1 + dbo + Relation + Relation_ + DatabasePersons1 + RowNum + Y + Y + Y + Y + BinaryChecksum + Persons + \ No newline at end of file diff --git a/App_Code/Data Access Layer/tblRole.xml b/App_Code/Data Access Layer/tblRole.xml new file mode 100644 index 0000000..b732271 --- /dev/null +++ b/App_Code/Data Access Layer/tblRole.xml @@ -0,0 +1,115 @@ + + + + + RoleId + %ISD_DEFAULT% + Number + tinyint + 3.0 + + + + + Y + Y + + + + + Y + N + Y + Y + Y + N + Y + N + + + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + Role + %ISD_DEFAULT% + String + nvarchar + 50 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + tblRole + 1 + dbo + TblRole + TblRole_ + DatabasePersons1 + RowNum + Y + Y + Y + Y + BinaryChecksum + Persons + \ No newline at end of file diff --git a/App_Code/Data Access Layer/tblUserRole.xml b/App_Code/Data Access Layer/tblUserRole.xml new file mode 100644 index 0000000..fac77b6 --- /dev/null +++ b/App_Code/Data Access Layer/tblUserRole.xml @@ -0,0 +1,183 @@ + + + + + UserRoleId + %ISD_DEFAULT% + Number + int + 10.0 + + + + + Y + Y + + + + + Y + N + Y + Y + Y + N + Y + N + + + N + %ISD_DEFAULT% + + + Y + N + N + N + N + N + N + N + + + + + + + + + + + + + PersonalId + %ISD_DEFAULT% + String + nvarchar + 13 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + Thai_CI_AS + N + %ISD_DEFAULT% + + + Y + + FK_tblUserRole_PersonalId + PersonalId + dbo + PersonalId + PersonalName + Explicit + + Y + N + N + N + N + N + N + + + + + + + + + + + + + RoleId + %ISD_DEFAULT% + Number + tinyint + 3.0 + + + + + N + N + + + + + N + N + N + N + N + N + N + N + + + N + %ISD_DEFAULT% + + + Y + + FK_tblUserRole_tblRole + tblRole + dbo + RoleId + Role + Explicit + + Y + N + N + N + N + N + N + + + + + + + + + + + + + tblUserRole + 1 + dbo + TblUserRole + TblUserRole_ + DatabasePersons1 + RowNum + Y + Y + Y + Y + BinaryChecksum + Persons + Y + RoleId + PersonalId + \ No newline at end of file diff --git a/App_Code/Header and Footer/IEmailFooter.vb b/App_Code/Header and Footer/IEmailFooter.vb new file mode 100644 index 0000000..182ffa4 --- /dev/null +++ b/App_Code/Header and Footer/IEmailFooter.vb @@ -0,0 +1,23 @@ + +Imports Microsoft.VisualBasic +Imports BaseClasses.Utils.DbUtils + +Namespace Persons.UI + + + + Public Interface IEmailFooter + +#Region "Interface Properties" + + ReadOnly Property Copyright() As System.Web.UI.WebControls.Literal + Property Visible() as Boolean + + +#End Region + + End Interface + + +End Namespace + \ No newline at end of file diff --git a/App_Code/Header and Footer/IEmailHeader.vb b/App_Code/Header and Footer/IEmailHeader.vb new file mode 100644 index 0000000..7112b08 --- /dev/null +++ b/App_Code/Header and Footer/IEmailHeader.vb @@ -0,0 +1,23 @@ + +Imports Microsoft.VisualBasic +Imports BaseClasses.Utils.DbUtils + +Namespace Persons.UI + + + + Public Interface IEmailHeader + +#Region "Interface Properties" + + ReadOnly Property Logo() As System.Web.UI.WebControls.Image + Property Visible() as Boolean + + +#End Region + + End Interface + + +End Namespace + \ No newline at end of file diff --git a/App_Code/Header and Footer/IFooter.vb b/App_Code/Header and Footer/IFooter.vb new file mode 100644 index 0000000..34af0e9 --- /dev/null +++ b/App_Code/Header and Footer/IFooter.vb @@ -0,0 +1,23 @@ + +Imports Microsoft.VisualBasic +Imports BaseClasses.Utils.DbUtils + +Namespace Persons.UI + + + + Public Interface IFooter + +#Region "Interface Properties" + + ReadOnly Property Copyright() As System.Web.UI.WebControls.Literal + Property Visible() as Boolean + + +#End Region + + End Interface + + +End Namespace + \ No newline at end of file diff --git a/App_Code/Header and Footer/IHeader.vb b/App_Code/Header and Footer/IHeader.vb new file mode 100644 index 0000000..374bff3 --- /dev/null +++ b/App_Code/Header and Footer/IHeader.vb @@ -0,0 +1,33 @@ + +Imports Microsoft.VisualBasic +Imports BaseClasses.Utils.DbUtils + +Namespace Persons.UI + + + + Public Interface IHeader + +#Region "Interface Properties" + + ReadOnly Property Divider0() As System.Web.UI.WebControls.Image + ReadOnly Property Divider1() As System.Web.UI.WebControls.Image + ReadOnly Property Divider2() As System.Web.UI.WebControls.Image + ReadOnly Property LeftImage() As System.Web.UI.WebControls.Image + ReadOnly Property Logo() As System.Web.UI.WebControls.Image + ReadOnly Property RightImage() As System.Web.UI.WebControls.Image + ReadOnly Property SignIn() As System.Web.UI.WebControls.LinkButton + ReadOnly Property SignInBarPrintButton() As System.Web.UI.WebControls.Image + ReadOnly Property SIOImage() As System.Web.UI.WebControls.ImageButton + ReadOnly Property SkipNavigationLinks() As System.Web.UI.WebControls.HyperLink + ReadOnly Property UserStatusLbl() As System.Web.UI.WebControls.Label + Property Visible() as Boolean + + +#End Region + + End Interface + + +End Namespace + \ No newline at end of file diff --git a/App_Code/Menu Panels/IMenu.vb b/App_Code/Menu Panels/IMenu.vb new file mode 100644 index 0000000..5365f25 --- /dev/null +++ b/App_Code/Menu Panels/IMenu.vb @@ -0,0 +1,30 @@ + +Imports Microsoft.VisualBasic +Imports BaseClasses.Utils.DbUtils + +Namespace Persons.UI + + + + Public Interface IMenu + +#Region "Interface Properties" + + ReadOnly Property PersonalEducationMenuItem() As IMenu_Item + ReadOnly Property PersonalEducationMenuItemHilited() As IMenu_Item_Highlighted + ReadOnly Property PersonalIdMenuItem() As IMenu_Item + ReadOnly Property PersonalIdMenuItemHilited() As IMenu_Item_Highlighted + ReadOnly Property การศ_กษาส_งส_ดMenuItem() As IMenu_Item + ReadOnly Property การศ_กษาส_งส_ดMenuItemHilited() As IMenu_Item_Highlighted + ReadOnly Property ประว_ต_ส_วนบ_คคลMenuItem() As IMenu_Item + ReadOnly Property ประว_ต_ส_วนบ_คคลMenuItemHilited() As IMenu_Item_Highlighted + Property Visible() as Boolean + + +#End Region + + End Interface + + +End Namespace + \ No newline at end of file diff --git a/App_Code/Menu Panels/IMenu1.vb b/App_Code/Menu Panels/IMenu1.vb new file mode 100644 index 0000000..a286f5d --- /dev/null +++ b/App_Code/Menu Panels/IMenu1.vb @@ -0,0 +1,52 @@ + +Imports Microsoft.VisualBasic +Imports BaseClasses.Utils.DbUtils + +Namespace Persons.UI + + + + Public Interface IMenu1 + +#Region "Interface Properties" + + ReadOnly Property การปฏ_บ_ต_งานMenuItem() As IMenu_Item + ReadOnly Property การปฏ_บ_ต_งานMenuItemHilited() As IMenu_Item_Highlighted + ReadOnly Property การศ_กษาMenuItem() As IMenu_Item + ReadOnly Property การศ_กษาMenuItemHilited() As IMenu_Item_Highlighted + ReadOnly Property ความสามาถด_านก_ฬาMenuItem() As IMenu_Item + ReadOnly Property ความสามาถด_านก_ฬาMenuItemHilited() As IMenu_Item_Highlighted + ReadOnly Property ความสามารถด_านภาษาMenuItem() As IMenu_Item + ReadOnly Property ความสามารถด_านภาษาMenuItemHilited() As IMenu_Item_Highlighted + ReadOnly Property ความสามารถพ_เศษMenuItem() As IMenu_Item + ReadOnly Property ความสามารถพ_เศษMenuItemHilited() As IMenu_Item_Highlighted + ReadOnly Property เคร__องราชอ_สร_ยาภรณ_MenuItem() As IMenu_Item + ReadOnly Property เคร__องราชอ_สร_ยาภรณ_MenuItemHilited() As IMenu_Item_Highlighted + ReadOnly Property เง_นเด_อนMenuItem() As IMenu_Item + ReadOnly Property เง_นเด_อนMenuItemHilited() As IMenu_Item_Highlighted + ReadOnly Property เง_นเพ__มพ_เศษMenuItem() As IMenu_Item + ReadOnly Property เง_นเพ__มพ_เศษMenuItemHilited() As IMenu_Item_Highlighted + ReadOnly Property ตำแหน_งMenuItem() As IMenu_Item + ReadOnly Property ตำแหน_งMenuItemHilited() As IMenu_Item_Highlighted + ReadOnly Property บ_คคลท__เก__ยวข_องMenuItem() As IMenu_Item + ReadOnly Property บ_คคลท__เก__ยวข_องMenuItemHilited() As IMenu_Item_Highlighted + ReadOnly Property ประว_ต_ท__วไปMenuItem() As IMenu_Item + ReadOnly Property ประว_ต_ท__วไปMenuItemHilited() As IMenu_Item_Highlighted + ReadOnly Property เปล__ยนช__อMenuItem() As IMenu_Item + ReadOnly Property เปล__ยนช__อMenuItemHilited() As IMenu_Item_Highlighted + ReadOnly Property ยศMenuItem() As IMenu_Item + ReadOnly Property ยศMenuItemHilited() As IMenu_Item_Highlighted + ReadOnly Property ว_นทว_ค_ณMenuItem() As IMenu_Item + ReadOnly Property ว_นทว_ค_ณMenuItemHilited() As IMenu_Item_Highlighted + ReadOnly Property หน_าหล_กMenuItem() As IMenu_Item + ReadOnly Property หน_าหล_กMenuItemHilited() As IMenu_Item_Highlighted + Property Visible() as Boolean + + +#End Region + + End Interface + + +End Namespace + \ No newline at end of file diff --git a/App_Code/PersonRelative/EditPersonRelative.Controls.vb b/App_Code/PersonRelative/EditPersonRelative.Controls.vb new file mode 100644 index 0000000..ab2e22c --- /dev/null +++ b/App_Code/PersonRelative/EditPersonRelative.Controls.vb @@ -0,0 +1,2893 @@ + +' 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 + + \ No newline at end of file diff --git a/App_Code/PersonRelative/EditPersonRelativeTable.Controls.vb b/App_Code/PersonRelative/EditPersonRelativeTable.Controls.vb new file mode 100644 index 0000000..9a6022e --- /dev/null +++ b/App_Code/PersonRelative/EditPersonRelativeTable.Controls.vb @@ -0,0 +1,5357 @@ + +' This file implements the TableControl, TableControlRow, and RecordControl classes for the +' EditPersonRelativeTable.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.EditPersonRelativeTable + +#Region "Section 1: Place your customizations here." + + +Public Class PersonRelativeTableControlRow + Inherits BasePersonRelativeTableControlRow + ' The BasePersonRelativeTableControlRow implements code for a ROW within the + ' the PersonRelativeTableControl table. The BasePersonRelativeTableControlRow implements the DataBind and SaveData methods. + ' The loading of data is actually performed by the LoadData method in the base class of PersonRelativeTableControl. + + ' This is the ideal place to add your code customizations. For example, you can override the DataBind, + ' SaveData, GetUIData, and Validate methods. + Public Overrides Sub GetUIData() + + ' Call MyBase.GetUIData + MyBase.GetUIData() + + ' Get PersonalDD Record + Dim myRec As PersonRelativeRecord = Me.GetRecord + + ' Set PersonalId field value to new value string + myRec.PersonalId = Utils.SecurityControls.GetCurrentUserID + + End Sub + + +End Class + + + +Public Class PersonRelativeTableControl + Inherits BasePersonRelativeTableControl + + ' The BasePersonRelativeTableControl class implements the LoadData, DataBind, CreateWhereClause + ' and other methods to load and display the data in a table control. + + ' This is the ideal place to add your code customizations. You can override the LoadData and CreateWhereClause, + ' The PersonRelativeTableControlRow class offers another place where you can customize + ' the DataBind, GetUIData, SaveData and Validate methods specific to each row displayed on the table. + Public Overrides Function CreateOrderBy() As OrderBy + ' The CurrentSortOrder is initialized to the sort order on the + ' Query Wizard. It may be modified by the Click handler for any of + ' the column heading to sort or reverse sort by that column. + ' You can add your own sort order, or modify it on the Query Wizard. + Dim orderby As OrderBy = New OrderBy(False, False) + orderby.Add(PersonRelativeTable.RelationId, OrderByItem.OrderDir.Asc) + orderby.Add(PersonRelativeTable.RBirthDate, OrderByItem.OrderDir.Asc) + Return orderby + 'Return Me.CurrentSortOrder + End Function + +End Class + + + +#End Region + + + +#Region "Section 2: Do not modify this section." + + +' Base class for the PersonRelativeTableControlRow control on the EditPersonRelativeTable page. +' Do not modify this class. Instead override any method in PersonRelativeTableControlRow. +Public Class BasePersonRelativeTableControlRow + Inherits Persons.UI.BaseApplicationRecordControl + + ' To customize, override this method in PersonRelativeTableControlRow. + Protected Overridable Sub Control_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Init + + Me.ClearControlsFromSession() + End Sub + + ' To customize, override this method in PersonRelativeTableControlRow. + Protected Overridable Sub Control_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load + + 'Call LoadFocusScripts from repeater so that onfocus attribute could be added to elements + Me.Page.LoadFocusScripts(Me) + + ' Show confirmation message on Click + Me.PersonRelativeRowDeleteButton.Attributes.Add("onClick", "return (confirm('" & (CType(Me.Page,BaseApplicationPage)).GetResourceValue("DeleteRecordConfirm", "Persons") & "'));") + + + ' Register the event handlers. + + AddHandler Me.PersonRelativeRowDeleteButton.Click, AddressOf PersonRelativeRowDeleteButton_Click + + AddHandler Me.PersonRelativeRowEditButton.Click, AddressOf PersonRelativeRowEditButton_Click + + AddHandler Me.PersonalId.SelectedIndexChanged, AddressOf PersonalId_SelectedIndexChanged + + 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 + + ' Since this is a row in the table, the data for this row is loaded by the + ' LoadData method of the BasePersonRelativeTableControl when the data for the entire + ' table is loaded. + + Me.DataSource = New PersonRelativeRecord() + + + + End Sub + + ' Populate the UI controls using the DataSource. To customize, override this method in PersonRelativeTableControlRow. + 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() + SetFName() + SetMLastName() + SetMName() + SetMOrLastName() + SetPersonalId() + + + + SetRAddress() + SetRAmphur() + SetRBirthDate() + SetRef1() + SetRefDate() + SetRelationId() + SetRFirstName() + SetRLastName() + SetRNationality() + SetROrigin() + SetROrLastName() + SetRPreName() + SetRProvince() + SetRReligion() + SetRRemark() + SetRStatus() + SetRStatusDate() + SetRStatusRef() + + + 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() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.FLastName.ID) Then + + Me.FLastName.Text = Me.PreviousUIData(Me.FLastName.ID).ToString() + + Return + End If + + + ' 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() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.FName.ID) Then + + Me.FName.Text = Me.PreviousUIData(Me.FName.ID).ToString() + + Return + End If + + + ' 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() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.MLastName.ID) Then + + Me.MLastName.Text = Me.PreviousUIData(Me.MLastName.ID).ToString() + + Return + End If + + + ' 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() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.MName.ID) Then + + Me.MName.Text = Me.PreviousUIData(Me.MName.ID).ToString() + + Return + End If + + + ' 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() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.MOrLastName.ID) Then + + Me.MOrLastName.Text = Me.PreviousUIData(Me.MOrLastName.ID).ToString() + + Return + End If + + + ' 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 SetPersonalId() + + ' If selection was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.PersonalId.ID) Then + If Me.PreviousUIData(Me.PersonalId.ID) Is Nothing + Me.PopulatePersonalIdDropDownList(Nothing, 100) + Else + Me.PopulatePersonalIdDropDownList(Me.PreviousUIData(Me.PersonalId.ID).ToString(), 100) + End If + Return + End If + + + ' Set the PersonalId DropDownList on the webpage with value from the + ' PersonRelative database record. + + ' Me.DataSource is the PersonRelative record retrieved from the database. + ' Me.PersonalId is the ASP:DropDownList on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetPersonalId() + ' and add your own code before or after the call to the MyBase function. + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.PersonalIdSpecified Then + + ' If the PersonalId is non-NULL, then format the value. + ' The Format method will return the Display Foreign Key As (DFKA) value + Me.PopulatePersonalIdDropDownList(Me.DataSource.PersonalId, 100) + + Else + + ' PersonalId 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.PopulatePersonalIdDropDownList(Nothing, 100) + Else + Me.PopulatePersonalIdDropDownList(PersonRelativeTable.PersonalId.DefaultValue, 100) + End If + + End If + + End Sub + + Public Overridable Sub SetRAddress() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.RAddress.ID) Then + + Me.RAddress.Text = Me.PreviousUIData(Me.RAddress.ID).ToString() + + Return + End If + + + ' 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() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.RAmphur.ID) Then + + Me.RAmphur.Text = Me.PreviousUIData(Me.RAmphur.ID).ToString() + + Return + End If + + + ' 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() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.RBirthDate.ID) Then + + Me.RBirthDate.Text = Me.PreviousUIData(Me.RBirthDate.ID).ToString() + + Return + End If + + + ' 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 yyyy") + + 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 yyyy") + + End If + + End Sub + + Public Overridable Sub SetRef1() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.Ref1.ID) Then + + Me.Ref1.Text = Me.PreviousUIData(Me.Ref1.ID).ToString() + + Return + End If + + + ' 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() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.RefDate.ID) Then + + Me.RefDate.Text = Me.PreviousUIData(Me.RefDate.ID).ToString() + + Return + End If + + + ' 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 yyyy") + + 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 yyyy") + + End If + + End Sub + + Public Overridable Sub SetRelationId() + + ' If selection was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.RelationId.ID) Then + If Me.PreviousUIData(Me.RelationId.ID) Is Nothing + Me.PopulateRelationIdDropDownList(Nothing, 100) + Else + Me.PopulateRelationIdDropDownList(Me.PreviousUIData(Me.RelationId.ID).ToString(), 100) + End If + Return + End If + + + ' 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() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.RFirstName.ID) Then + + Me.RFirstName.Text = Me.PreviousUIData(Me.RFirstName.ID).ToString() + + Return + End If + + + ' 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() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.RLastName.ID) Then + + Me.RLastName.Text = Me.PreviousUIData(Me.RLastName.ID).ToString() + + Return + End If + + + ' 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() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.RNationality.ID) Then + + Me.RNationality.Text = Me.PreviousUIData(Me.RNationality.ID).ToString() + + Return + End If + + + ' 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() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.ROrigin.ID) Then + + Me.ROrigin.Text = Me.PreviousUIData(Me.ROrigin.ID).ToString() + + Return + End If + + + ' 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() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.ROrLastName.ID) Then + + Me.ROrLastName.Text = Me.PreviousUIData(Me.ROrLastName.ID).ToString() + + Return + End If + + + ' 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() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.RPreName.ID) Then + + Me.RPreName.Text = Me.PreviousUIData(Me.RPreName.ID).ToString() + + Return + End If + + + ' 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() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.RProvince.ID) Then + + Me.RProvince.Text = Me.PreviousUIData(Me.RProvince.ID).ToString() + + Return + End If + + + ' 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() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.RReligion.ID) Then + + Me.RReligion.Text = Me.PreviousUIData(Me.RReligion.ID).ToString() + + Return + End If + + + ' 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() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.RRemark.ID) Then + + Me.RRemark.Text = Me.PreviousUIData(Me.RRemark.ID).ToString() + + Return + End If + + + ' 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() + + ' If selection was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.RStatus.ID) Then + If Me.PreviousUIData(Me.RStatus.ID) Is Nothing + Me.PopulateRStatusDropDownList(Nothing, 100) + Else + Me.PopulateRStatusDropDownList(Me.PreviousUIData(Me.RStatus.ID).ToString(), 100) + End If + Return + End If + + + ' 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() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.RStatusDate.ID) Then + + Me.RStatusDate.Text = Me.PreviousUIData(Me.RStatusDate.ID).ToString() + + Return + End If + + + ' 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 yyyy") + + 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 yyyy") + + End If + + End Sub + + Public Overridable Sub SetRStatusRef() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.RStatusRef.ID) Then + + Me.RStatusRef.Text = Me.PreviousUIData(Me.RStatusRef.ID).ToString() + + Return + End If + + + ' 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 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 PersonRelativeTableControlRow. + Public Overridable Sub SaveData() + ' Saves the associated record in the database. + ' SaveData calls Validate and Get methods - so it may be more appropriate to + ' customize those methods. + + ' 1. Load the existing record from the database. Since we save the entire record, this ensures + ' that fields that are not displayed are also properly initialized. + Me.LoadData() + + + ' 2. Perform any custom validation. + Me.Validate() + + + ' 3. Set the values in the record with data from UI controls. + ' This calls the Get() method for each of the user interface controls. + Me.GetUIData() + + ' 4. Save in the database. + ' We should not save the record if the data did not change. This + ' will save a database hit and avoid triggering any database triggers. + + If Me.DataSource.IsAnyValueChanged Then + ' Save record to database but do not commit yet. + ' Auto generated ids are available after saving for use by child (dependent) records. + Me.DataSource.Save() + + DirectCast(GetParentControlObject(Me, "PersonRelativeTableControl"), PersonRelativeTableControl).DataChanged = True + DirectCast(GetParentControlObject(Me, "PersonRelativeTableControl"), PersonRelativeTableControl).ResetData = True + End If + + + ' update session or cookie by formula + + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + ' For Master-Detail relationships, save data on the Detail table(s) + + End Sub + + ' To customize, override this method in PersonRelativeTableControlRow. + 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() + GetPersonalId() + 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 GetPersonalId() + + ' Retrieve the value entered by the user on the PersonalId ASP:DropDownList, and + ' save it into the PersonalId field in DataSource PersonRelative record. + + ' Custom validation should be performed in Validate, not here. + + Me.DataSource.Parse(GetValueSelectedPageRequest(Me.PersonalId), PersonRelativeTable.PersonalId) + + 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 PersonRelativeTableControlRow. + + Public Overridable Function CreateWhereClause() As WhereClause + + Return Nothing + + End Function + + + + ' To customize, override this method in PersonRelativeTableControlRow. + 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) + + DirectCast(GetParentControlObject(Me, "PersonRelativeTableControl"), PersonRelativeTableControl).DataChanged = True + DirectCast(GetParentControlObject(Me, "PersonRelativeTableControl"), PersonRelativeTableControl).ResetData = True + End Sub + + Protected Overridable Sub Control_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.PreRender + ' PreRender event is raised just before page is being displayed. + Try + DbUtils.StartTransaction() + Me.RegisterPostback() + + If Not Me.Page.ErrorOnPage AndAlso (Me.Page.IsPageRefresh OrElse Me.DataChanged OrElse Me.ResetData) Then + + + ' Re-load the data and update the web page if necessary. + ' This is typically done during a postback (filter, search button, sort, pagination button). + ' In each of the other click handlers, simply set DataChanged to True to reload the data. + Me.LoadData() + Me.DataBind() + End If + + + Catch ex As Exception + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + Finally + DbUtils.EndTransaction() + End Try + End Sub + + + Protected Overrides Sub SaveControlsToSession() + MyBase.SaveControlsToSession() + + + 'Save pagination state to session. + + End Sub + + + + Protected Overrides Sub ClearControlsFromSession() + MyBase.ClearControlsFromSession() + + + + ' Clear pagination state from session. + + End Sub + + Protected Overrides Sub LoadViewState(ByVal savedState As Object) + MyBase.LoadViewState(savedState) + Dim isNewRecord As String = CType(ViewState("IsNewRecord"), String) + If Not isNewRecord Is Nothing AndAlso isNewRecord.Trim <> "" Then + Me.IsNewRecord = Boolean.Parse(isNewRecord) + End If + + Dim myCheckSum As String = CType(ViewState("CheckSum"), String) + If Not myCheckSum Is Nothing AndAlso myCheckSum.Trim <> "" Then + Me.CheckSum = myCheckSum + End If + + + ' Load view state for pagination control. + + End Sub + + Protected Overrides Function SaveViewState() As Object + ViewState("IsNewRecord") = Me.IsNewRecord.ToString() + ViewState("CheckSum") = Me.CheckSum + + + ' Load view state for pagination control. + + Return MyBase.SaveViewState() + End Function + + + + Public Overridable Function CreateWhereClause_PersonalIdDropDownList() 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 PersonalId table. + ' Examples: + ' wc.iAND(PersonalIdTable.PersonalName, BaseFilter.ComparisonOperator.EqualsTo, "XYZ") + ' wc.iAND(PersonalIdTable.Active, BaseFilter.ComparisonOperator.EqualsTo, "1") + + Dim wc As WhereClause = New WhereClause() + Return wc + + End Function + + + + 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 PersonalId list. + Protected Overridable Sub PopulatePersonalIdDropDownList( _ + ByVal selectedValue As String, _ + ByVal maxItems As Integer) + + Me.PersonalId.Items.Clear() + + + ' 1. Setup the static list items + + ' Add the Please Select item. + Me.PersonalId.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_PersonalIdDropDownList function. + ' It is better to customize the where clause there. + + Dim wc As WhereClause = CreateWhereClause_PersonalIdDropDownList() + ' Create the ORDER BY clause to sort based on the displayed value. + + + Dim orderBy As OrderBy = New OrderBy(false, false) + orderBy.Add(PersonalIdTable.PersonalName, OrderByItem.OrderDir.Asc) + + Dim variables As System.Collections.Generic.IDictionary(Of String, Object) = New System.Collections.Generic.Dictionary(Of String, Object) + + ' 3. Read a total of maxItems from the database and insert them + Dim itemValues() As PersonalIdRecord = 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 = PersonalIdTable.GetRecords(wc, orderBy, pageNum, maxItems) + For each itemValue As PersonalIdRecord In itemValues + ' Create the item and add to the list. + Dim cvalue As String = Nothing + Dim fvalue As String = Nothing + If itemValue.PersonalIdSpecified Then + cvalue = itemValue.PersonalId.ToString() + + If counter < maxItems AndAlso Me.PersonalId.Items.FindByValue(cvalue) Is Nothing Then + + Dim _isExpandableNonCompositeForeignKey As Boolean = PersonRelativeTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonRelativeTable.PersonalId) + If _isExpandableNonCompositeForeignKey AndAlso PersonRelativeTable.PersonalId.IsApplyDisplayAs Then + fvalue = PersonRelativeTable.GetDFKA(itemValue, PersonRelativeTable.PersonalId) + End If + If (Not _isExpandableNonCompositeForeignKey) Or (String.IsNullOrEmpty(fvalue)) Then + fvalue = itemValue.Format(PersonalIdTable.PersonalName) + End If + + If fvalue Is Nothing OrElse fvalue.Trim() = "" Then fvalue = cvalue + + If (IsNothing(fvalue)) Then + fvalue = "" + End If + + fvalue = fvalue.Trim() + + If ( fvalue.Length > 50 ) Then + fvalue = fvalue.Substring(0, 50) & "..." + End If + + Dim dupItem As ListItem = Me.PersonalId.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.PersonalId.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.PersonalId, selectedValue) AndAlso _ + Not SetSelectedDisplayText(Me.PersonalId, selectedValue)Then + + ' construct a whereclause to query a record with PersonalId.PersonalId = selectedValue + Dim filter2 As CompoundFilter = New CompoundFilter(CompoundFilter.CompoundingOperators.And_Operator, Nothing) + Dim whereClause2 As WhereClause = New WhereClause() + filter2.AddFilter(New BaseClasses.Data.ColumnValueFilter(PersonalIdTable.PersonalId, selectedValue, BaseClasses.Data.BaseFilter.ComparisonOperator.EqualsTo, False)) + whereClause2.AddFilter(filter2, CompoundFilter.CompoundingOperators.And_Operator) + + Try + ' Execute the query + Dim rc() As PersonalIdRecord = PersonalIdTable.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 PersonalIdRecord = DirectCast(rc(0), PersonalIdRecord) + ' Create the item and add to the list. + Dim cvalue As String = Nothing + Dim fvalue As String = Nothing + If itemValue.PersonalIdSpecified Then + cvalue = itemValue.PersonalId.ToString() + Dim _isExpandableNonCompositeForeignKey As Boolean = PersonRelativeTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonRelativeTable.PersonalId) + If _isExpandableNonCompositeForeignKey AndAlso PersonRelativeTable.PersonalId.IsApplyDisplayAs Then + fvalue = PersonRelativeTable.GetDFKA(itemValue, PersonRelativeTable.PersonalId) + End If + If (Not _isExpandableNonCompositeForeignKey) Or (String.IsNullOrEmpty(fvalue)) Then + fvalue = itemValue.Format(PersonalIdTable.PersonalName) + End If + + If fvalue Is Nothing OrElse fvalue.Trim() = "" Then fvalue = cvalue + Dim newItem As New ListItem(fvalue, cvalue) + Me.PersonalId.Items.Add(newItem) + SetSelectedValue(Me.PersonalId, selectedValue) + End If + End If + Catch + End Try + + End If + + + End Sub + + ' 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 + + ' event handler for ImageButton + Public Overridable Sub PersonRelativeRowDeleteButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + If(Not Me.Page.IsPageRefresh) Then + + Dim tc As PersonRelativeTableControl = DirectCast(GetParentControlObject(Me, "PersonRelativeTableControl"), PersonRelativeTableControl) + If Not (IsNothing(tc)) Then + If Not Me.IsNewRecord Then + tc.AddToDeletedRecordIds(DirectCast(Me, PersonRelativeTableControlRow)) + End If + Me.Visible = False + tc.SetFormulaControls() + End If + + End If + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonRelativeRowEditButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + ' The redirect URL is set on the Properties, Custom Properties or Actions. + ' The ModifyRedirectURL call resolves the parameters before the + ' Response.Redirect redirects the page to the URL. + ' Any code after the Response.Redirect call will not be executed, since the page is + ' redirected to the URL. + + + Dim url As String = "../PersonRelative/EditPersonRelative.aspx?PersonRelative={PK}" + + Dim shouldRedirect As Boolean = True + Dim TargetKey As String = Nothing + Dim DFKA As String = TargetKey + Dim id As String = DFKA + Dim value As String = id + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + url = Me.ModifyRedirectUrl(url, "",False) + url = Me.Page.ModifyRedirectUrl(url, "",False) + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + shouldRedirect = False + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + If shouldRedirect Then + Me.Page.ShouldSaveControlsToSession = True + Me.Page.Response.Redirect(url) + ElseIf Not TargetKey Is Nothing AndAlso _ + Not shouldRedirect Then + Me.Page.ShouldSaveControlsToSession = True + Me.Page.CloseWindow(True) + + End If + End Sub + + Protected Overridable Sub PersonalId_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()(PersonalId.ClientID & "_SelectedValue"), String) + Dim displayText As String = CType(Me.Page.Session()(PersonalId.ClientID & "_SelectedDisplayText"), String) + If displayText <> "" AndAlso val <> "" Then + Me.PersonalId.Items.Add(New ListItem(displayText, val)) + Me.PersonalId.SelectedIndex = Me.PersonalId.Items.Count - 1 + Me.Page.Session.Remove(PersonalId.ClientID & "_SelectedValue") + Me.Page.Session.Remove(PersonalId.ClientID & "_SelectedDisplayText") + 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("BasePersonRelativeTableControlRow_Rec"), String) + End Get + Set(ByVal value As String) + Me.ViewState("BasePersonRelativeTableControlRow_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 _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 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 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 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 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 PersonalId() As System.Web.UI.WebControls.DropDownList + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalId"), System.Web.UI.WebControls.DropDownList) + End Get + End Property + + Public ReadOnly Property PersonRelativeRecordRowSelection() As System.Web.UI.WebControls.CheckBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonRelativeRecordRowSelection"), System.Web.UI.WebControls.CheckBox) + End Get + End Property + + Public ReadOnly Property PersonRelativeRowDeleteButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonRelativeRowDeleteButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonRelativeRowEditButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonRelativeRowEditButton"), System.Web.UI.WebControls.ImageButton) + 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 + +#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 + + + +' Base class for the PersonRelativeTableControl control on the EditPersonRelativeTable page. +' Do not modify this class. Instead override any method in PersonRelativeTableControl. +Public Class BasePersonRelativeTableControl + Inherits Persons.UI.BaseApplicationTableControl + + + + Protected Overridable Sub Control_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Init + + + + ' Setup the filter and search events. + + + + ' Control Initializations. + ' Initialize the table's current sort order. + + If Me.InSession(Me, "Order_By") Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + Me.CurrentSortOrder.Add(PersonRelativeTable.RelationId, OrderByItem.OrderDir.Asc) + + Me.CurrentSortOrder.Add(PersonRelativeTable.RBirthDate, OrderByItem.OrderDir.Asc) + + End If + + + + ' Setup default pagination settings. + + Me.PageSize = CInt(Me.GetFromSession(Me, "Page_Size", "10")) + Me.PageIndex = CInt(Me.GetFromSession(Me, "Page_Index", "0")) + + + + Me.ClearControlsFromSession() + End Sub + + Protected Overridable Sub Control_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load + + SaveControlsToSession_Ajax() + + ' Show confirmation message on Click + Me.PersonRelativeDeleteButton.Attributes.Add("onClick", "return (confirm('" & (CType(Me.Page,BaseApplicationPage)).GetResourceValue("DeleteConfirm", "Persons") & "'));") + + ' Setup the pagination events. + + AddHandler Me.PersonRelativePagination.FirstPage.Click, AddressOf PersonRelativePagination_FirstPage_Click + + AddHandler Me.PersonRelativePagination.LastPage.Click, AddressOf PersonRelativePagination_LastPage_Click + + AddHandler Me.PersonRelativePagination.NextPage.Click, AddressOf PersonRelativePagination_NextPage_Click + + AddHandler Me.PersonRelativePagination.PageSizeButton.Click, AddressOf PersonRelativePagination_PageSizeButton_Click + + AddHandler Me.PersonRelativePagination.PreviousPage.Click, AddressOf PersonRelativePagination_PreviousPage_Click + + + ' Setup the sorting events. + + AddHandler Me.FLastNameLabel.Click, AddressOf FLastNameLabel_Click + + AddHandler Me.FNameLabel.Click, AddressOf FNameLabel_Click + + AddHandler Me.MLastNameLabel.Click, AddressOf MLastNameLabel_Click + + AddHandler Me.MNameLabel.Click, AddressOf MNameLabel_Click + + AddHandler Me.MOrLastNameLabel.Click, AddressOf MOrLastNameLabel_Click + + AddHandler Me.RAddressLabel.Click, AddressOf RAddressLabel_Click + + AddHandler Me.RAmphurLabel.Click, AddressOf RAmphurLabel_Click + + AddHandler Me.RBirthDateLabel.Click, AddressOf RBirthDateLabel_Click + + AddHandler Me.RefDateLabel.Click, AddressOf RefDateLabel_Click + + AddHandler Me.RefLabel.Click, AddressOf RefLabel_Click + + AddHandler Me.RelationIdLabel1.Click, AddressOf RelationIdLabel1_Click + + AddHandler Me.RFirstNameLabel.Click, AddressOf RFirstNameLabel_Click + + AddHandler Me.RLastNameLabel.Click, AddressOf RLastNameLabel_Click + + AddHandler Me.RNationalityLabel.Click, AddressOf RNationalityLabel_Click + + AddHandler Me.ROriginLabel.Click, AddressOf ROriginLabel_Click + + AddHandler Me.ROrLastNameLabel.Click, AddressOf ROrLastNameLabel_Click + + AddHandler Me.RPreNameLabel.Click, AddressOf RPreNameLabel_Click + + AddHandler Me.RProvinceLabel.Click, AddressOf RProvinceLabel_Click + + AddHandler Me.RReligionLabel.Click, AddressOf RReligionLabel_Click + + AddHandler Me.RRemarkLabel.Click, AddressOf RRemarkLabel_Click + + AddHandler Me.RStatusDateLabel.Click, AddressOf RStatusDateLabel_Click + + AddHandler Me.RStatusLabel.Click, AddressOf RStatusLabel_Click + + AddHandler Me.RStatusRefLabel.Click, AddressOf RStatusRefLabel_Click + + ' Setup the button events. + + AddHandler Me.PersonRelativeAddButton.Click, AddressOf PersonRelativeAddButton_Click + + AddHandler Me.PersonRelativeDeleteButton.Click, AddressOf PersonRelativeDeleteButton_Click + + AddHandler Me.PersonRelativeEditButton.Click, AddressOf PersonRelativeEditButton_Click + + AddHandler Me.PersonRelativeRefreshButton.Click, AddressOf PersonRelativeRefreshButton_Click + + AddHandler Me.PersonRelativeResetButton.Click, AddressOf PersonRelativeResetButton_Click + + AddHandler Me.PersonRelativeSaveButton.Click, AddressOf PersonRelativeSaveButton_Click + + Me.PersonRelativeSaveButton.Attributes.Add("onclick", "SubmitHRefOnce(this, """ & Me.Page.GetResourceValue("Txt:SaveRecord", "Persons") & """);") + + + ' Setup events for others + + End Sub + + + Public Overridable Sub LoadData() + + ' Read data from database. Returns an array of records that can be assigned + ' to the DataSource table control property. + Try + Dim joinFilter As CompoundFilter = CreateCompoundJoinFilter() + + ' The WHERE clause will be empty when displaying all records in table. + Dim wc As WhereClause = CreateWhereClause() + If wc IsNot Nothing AndAlso Not wc.RunQuery Then + ' Initialize an empty array of records + Dim alist As New ArrayList(0) + Me.DataSource = DirectCast(alist.ToArray(GetType(PersonRelativeRecord)), PersonRelativeRecord()) + ' Add records to the list if needed. + Me.AddNewRecords() + Me._TotalRecords = 0 + Me._TotalPages = 0 + Return + End If + + ' Call OrderBy to determine the order - either use the order defined + ' on the Query Wizard, or specified by user (by clicking on column heading) + Dim orderBy As OrderBy = CreateOrderBy() + + ' Get the pagesize from the pagesize control. + Me.GetPageSize() + + If Me.DisplayLastPage Then + Dim totalRecords As Integer = If(Me._TotalRecords < 0, PersonRelativeTable.GetRecordCount(CreateCompoundJoinFilter(), CreateWhereClause()), Me._TotalRecords) + + Dim totalPages As Integer = CInt(Math.Ceiling(totalRecords / Me.PageSize)) + + Me.PageIndex = totalPages - 1 + End If + + ' Make sure PageIndex (current page) and PageSize are within bounds. + If Me.PageIndex < 0 Then + Me.PageIndex = 0 + End If + If Me.PageSize < 1 Then + Me.PageSize = 1 + End If + + ' Retrieve the records and set the table DataSource. + ' Only PageSize records are fetched starting at PageIndex (zero based). + If Me.AddNewRecord > 0 Then + ' Make sure to preserve the previously entered data on new rows. + Dim postdata As New ArrayList + For Each rc As PersonRelativeTableControlRow In Me.GetRecordControls() + If Not rc.IsNewRecord Then + rc.DataSource = rc.GetRecord() + rc.GetUIData() + postdata.Add(rc.DataSource) + UIData.Add(rc.PreservedUIData()) + End If + Next + Me.DataSource = DirectCast(postdata.ToArray(GetType(PersonRelativeRecord)), PersonRelativeRecord()) + Else ' Get the records from the database + Me.DataSource = PersonRelativeTable.GetRecords(joinFilter, wc, orderBy, Me.PageIndex, Me.PageSize) + + End If + + ' if the datasource contains no records contained in database, then load the last page. + If (DbUtils.GetCreatedRecords(Me.DataSource).Length = 0 AndAlso Not Me.DisplayLastPage) Then + Me.DisplayLastPage = True + LoadData() + Else + + ' Add any new rows desired by the user. + Me.AddNewRecords() + + ' Turn off the ToggleAll checkbox + Me.PersonRelativeToggleAll.Checked = False + + + ' Initialize the page and grand totals. now + + End If + + Catch ex As Exception + ' Report the error message to the end user + Dim msg As String = ex.Message + If ex.InnerException IsNot Nothing Then + msg = msg & " InnerException: " & ex.InnerException.Message + End If + Throw New Exception(msg, ex.InnerException) + End Try + End Sub + + + + + Public Overrides Sub DataBind() + ' The DataBind method binds the user interface controls to the values + ' from the database record for each row in the table. To do this, it calls the + ' DataBind for each of the rows. + ' DataBind also populates any filters above the table, and sets the pagination + ' control to the correct number of records and the current page number. + + MyBase.DataBind() + + ' Make sure that the DataSource is initialized. + If Me.DataSource Is Nothing Then + Return + End If + + 'LoadData for DataSource for chart and report if they exist + + ' Improve performance by prefetching display as records. + Me.PreFetchForeignKeyValues() + + ' Setup the pagination controls. + BindPaginationControls() + + + + ' Bind the repeater with the list of records to expand the UI. + Dim rep As System.Web.UI.WebControls.Repeater = CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonRelativeTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return + rep.DataSource = DataSource() + rep.DataBind() + + Dim index As Integer = 0 + For Each repItem As System.Web.UI.WebControls.RepeaterItem In rep.Items + ' Loop through all rows in the table, set its DataSource and call DataBind(). + Dim recControl As PersonRelativeTableControlRow = DirectCast(repItem.FindControl("PersonRelativeTableControlRow"), PersonRelativeTableControlRow) + recControl.DataSource = Me.DataSource(index) + If Me.UIData.Count > index Then + recControl.PreviousUIData = Me.UIData(index) + End If + recControl.DataBind() + recControl.Visible = Not Me.InDeletedRecordIds(recControl) + + index += 1 + Next + + + + + ' Call the Set methods for each controls on the panel + + SetFLastNameLabel() + SetFNameLabel() + SetMLastNameLabel() + SetMNameLabel() + SetMOrLastNameLabel() + + + + + + + + SetPersonRelativeTableControlCollapsibleRegion() + SetPersonRelativeTableControlIcon() + SetPersonRelativeTableControlPanelExtender() + + + SetRAddressLabel() + SetRAmphurLabel() + SetRBirthDateLabel() + SetRefDateLabel() + SetRefLabel() + SetRelationIdLabel1() + SetRFirstNameLabel() + SetRLastNameLabel() + SetRNationalityLabel() + SetROriginLabel() + SetROrLastNameLabel() + SetRPreNameLabel() + SetRProvinceLabel() + SetRReligionLabel() + SetRRemarkLabel() + SetRStatusDateLabel() + SetRStatusLabel() + SetRStatusRefLabel() + ' setting the state of expand or collapse alternative rows + + + ' Load data for each record and table UI control. + ' Ordering is important because child controls get + ' their parent ids from their parent UI controls. + + + ' this method calls the set method for controls with special formula like running total, sum, rank, etc + SetFormulaControls() + End Sub + + Public Overridable Sub SetFormulaControls() + ' this method calls Set methods for the control that has special formula + + + + End Sub + + + Public Sub PreFetchForeignKeyValues() + If (IsNothing(Me.DataSource)) + Return + End If + + Me.Page.PregetDfkaRecords(PersonRelativeTable.PersonalId, Me.DataSource) + + Me.Page.PregetDfkaRecords(PersonRelativeTable.RelationId, Me.DataSource) + + Me.Page.PregetDfkaRecords(PersonRelativeTable.RStatus, Me.DataSource) + + End Sub + + + Public Overridable Sub RegisterPostback() + + Me.Page.RegisterPostBackTrigger(MiscUtils.FindControlRecursively(Me,"PersonRelativeSaveButton")) + + + End Sub + + Public EvaluateFormulaDelegate As BaseClasses.Data.DataSource.EvaluateFormulaDelegate = New BaseClasses.Data.DataSource.EvaluateFormulaDelegate(AddressOf Me.EvaluateFormula) + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean, ByVal e as FormulaEvaluator) As String + If e Is Nothing + e = New FormulaEvaluator() + End If + + e.Variables.Clear() + + + ' add variables for formula evaluation + If variables IsNot Nothing Then + Dim enumerator As System.Collections.Generic.IEnumerator(Of System.Collections.Generic.KeyValuePair(Of String, Object)) = variables.GetEnumerator() + While enumerator.MoveNext() + e.Variables.Add(enumerator.Current.Key, enumerator.Current.Value) + End While + End If + + If includeDS + + End If + + ' All variables referred to in the formula are expected to be + ' properties of the DataSource. For example, referring to + ' UnitPrice as a variable will refer to DataSource.UnitPrice + e.DataSource = dataSourceForEvaluate + + ' Define the calling control. This is used to add other + ' related table and record controls as variables. + e.CallingControl = Me + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + + If Not String.IsNullOrEmpty(format) AndAlso (String.IsNullOrEmpty(formula) OrElse formula.IndexOf("Format(") < 0) Then + Return FormulaUtils.Format(resultObj, format) + Else + Return resultObj.ToString() + End If + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format,variables ,includeDS, Nothing) + End Function + + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object)) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format, variables ,True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, format, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal e as FormulaEvaluator) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, variables, True, e) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal includeDS as Boolean) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, includeDS, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, True, Nothing) + End Function + + + + + Public Overridable Sub ResetControl() + + Me.CurrentSortOrder.Reset() + If (Me.InSession(Me, "Order_By")) Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + Me.CurrentSortOrder.Add(PersonRelativeTable.RelationId, OrderByItem.OrderDir.Asc) + + Me.CurrentSortOrder.Add(PersonRelativeTable.RBirthDate, OrderByItem.OrderDir.Asc) + + End If + + Me.PageIndex = 0 + End Sub + + Protected Overridable Sub BindPaginationControls() + ' Setup the pagination controls. + + ' Bind the pagination labels. + + If DbUtils.GetCreatedRecords(Me.DataSource).Length > 0 Then + + Me.PersonRelativePagination.CurrentPage.Text = (Me.PageIndex + 1).ToString() + Else + Me.PersonRelativePagination.CurrentPage.Text = "0" + End If + Me.PersonRelativePagination.PageSize.Text = Me.PageSize.ToString() + Me.PersonRelativePagination.TotalItems.Text = Me.TotalRecords.ToString() + Me.PersonRelativePagination.TotalPages.Text = Me.TotalPages.ToString() + + ' Bind the buttons for PersonRelativeTableControl pagination. + + Me.PersonRelativePagination.FirstPage.Enabled = Not (Me.PageIndex = 0) + If Me._TotalPages < 0 Then ' if the total pages is not determined yet, enable last and next buttons + Me.PersonRelativePagination.LastPage.Enabled = True + ElseIf Me._TotalPages = 0 ' if the total pages is determined and it is 0, enable last and next buttons + Me.PersonRelativePagination.LastPage.Enabled = False + Else ' if the total pages is the last page, disable last and next buttons + Me.PersonRelativePagination.LastPage.Enabled = Not (Me.PageIndex = Me.TotalPages - 1) + End If + + If Me._TotalPages < 0 Then ' if the total pages is not determined yet, enable last and next buttons + Me.PersonRelativePagination.NextPage.Enabled = True + ElseIf Me._TotalPages = 0 ' if the total pages is determined and it is 0, enable last and next buttons + Me.PersonRelativePagination.NextPage.Enabled = False + Else ' if the total pages is the last page, disable last and next buttons + Me.PersonRelativePagination.NextPage.Enabled = Not (Me.PageIndex = Me.TotalPages - 1) + End If + + Me.PersonRelativePagination.PreviousPage.Enabled = Not (Me.PageIndex = 0) + + + End Sub + + Public Overridable Sub SaveData() + ' Save the data from the entire table. Calls each row's Save Data + ' to save their data. This function is called by the Click handler of the + ' Save button. The button handler should Start/Commit/End a transaction. + + Dim recCtl As PersonRelativeTableControlRow + For Each recCtl In Me.GetRecordControls() + + If Me.InDeletedRecordIds(recCtl) Then + ' Delete any pending deletes. + recCtl.Delete() + Else + If recCtl.Visible Then + recCtl.SaveData() + End If + End If + + Next + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + ' Set IsNewRecord to False for all records - since everything has been saved and is no longer "new" + For Each recCtl In Me.GetRecordControls() + recCtl.IsNewRecord = False + Next + + + ' Set DeletedRecordsIds to Nothing since we have deleted all pending deletes. + Me.DeletedRecordIds = Nothing + + End Sub + + Public Overridable Function CreateCompoundJoinFilter() As CompoundFilter + Dim jFilter As CompoundFilter = New CompoundFilter() + + Return jFilter + + End Function + + + Public Overridable Function CreateOrderBy() As OrderBy + ' The CurrentSortOrder is initialized to the sort order on the + ' Query Wizard. It may be modified by the Click handler for any of + ' the column heading to sort or reverse sort by that column. + ' You can add your own sort order, or modify it on the Query Wizard. + Return Me.CurrentSortOrder + End Function + + Public Overridable Function CreateWhereClause() As WhereClause + 'This CreateWhereClause is used for loading the data. + 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 search criteria. + ' 3. User selected filter criteria. + + + ' Get the static clause defined at design time on the Table Panel Wizard + Dim qc As WhereClause = Me.CreateQueryClause() + If Not(IsNothing(qc)) Then + wc.iAND(qc) + End If + + Return wc + End Function + + + Public Overridable Function CreateWhereClause(ByVal searchText as String, ByVal fromSearchControl as String, ByVal AutoTypeAheadSearch as String, ByVal AutoTypeAheadWordSeparators as String) As WhereClause + ' This CreateWhereClause is used for loading list of suggestions for Auto Type-Ahead feature. + 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 search criteria. + ' 3. User selected filter criteria. + + Dim appRelativeVirtualPath As String = CType(HttpContext.Current.Session("AppRelativeVirtualPath"), String) + + ' Get the static clause defined at design time on the Table Panel Wizard + Dim qc As WhereClause = Me.CreateQueryClause() + If Not(IsNothing(qc)) Then + wc.iAND(qc) + End If + + ' Adds clauses if values are selected in Filter controls which are configured in the page. + + + Return wc + End Function + + Protected Overridable Function CreateQueryClause() As WhereClause + ' Create a where clause for the Static clause defined at design time. + Dim filter As CompoundFilter = New CompoundFilter(CompoundFilter.CompoundingOperators.And_Operator, Nothing) + Dim whereClause As WhereClause = New WhereClause() + + filter.AddFilter(New BaseClasses.Data.SignedInUserFilter(BaseClasses.Data.BaseTable.CreateInstance("Persons.Business.PersonRelativeTable, App_Code").TableDefinition.ColumnList.GetByUniqueName("PersonRelative_.PersonalId"), New BaseClasses.Data.IdentifierAliasInfo("PersonRelative_", Nothing), BaseClasses.Data.BaseFilter.ComparisonOperator.EqualsTo, False)) + + whereClause.AddFilter(filter, CompoundFilter.CompoundingOperators.And_Operator) + + Return whereClause + + End Function + + + Public Overridable Function FormatSuggestions(ByVal prefixText As String, ByVal resultItem As String, _ + ByVal columnLength As Integer, ByVal AutoTypeAheadDisplayFoundText As String, _ + ByVal autoTypeAheadSearch As String, ByVal AutoTypeAheadWordSeparators As String, _ + ByVal resultList As ArrayList) As Boolean + + 'Formats the resultItem and adds it to the list of suggestions. + Dim index As Integer = resultItem.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture).IndexOf(prefixText.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture)) + Dim itemToAdd As String = "" + Dim isFound As Boolean = False + Dim isAdded As Boolean = False + ' Get the index where prfixt is at the beginning of resultItem. If not found then, index of word which begins with prefixText. + If InvariantLCase(autoTypeAheadSearch).equals("wordsstartingwithsearchstring") And Not index = 0 Then + ' Expression to find word which contains AutoTypeAheadWordSeparators followed by prefixText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex( AutoTypeAheadWordSeparators + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + If regex1.IsMatch(resultItem) Then + index = regex1.Match(resultItem).Index + isFound = True + End If + ' If the prefixText is found immediatly after white space then starting of the word is found so don not search any further + If not resultItem(index).ToString() = " " Then + ' Expression to find beginning of the word which contains AutoTypeAheadWordSeparators followed by prefixText + Dim regex As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\\S*" + AutoTypeAheadWordSeparators + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + If regex.IsMatch(resultItem) Then + index = regex.Match(resultItem).Index + isFound = True + End If + End If + End If + + ' If autoTypeAheadSearch value is wordsstartingwithsearchstring then, extract the substring only if the prefixText is found at the + ' beginning of the resultItem (index = 0) or a word in resultItem is found starts with prefixText. + If index = 0 Or isFound Or InvariantLCase(autoTypeAheadSearch).Equals("anywhereinstring") then + If InvariantLCase(AutoTypeAheadDisplayFoundText).equals("atbeginningofmatchedstring") Then + ' Expression to find beginning of the word which contains prefixText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\\S*" + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + ' Find the beginning of the word which contains prefexText + If (StringUtils.InvariantLCase(autoTypeAheadSearch).Equals("anywhereinstring") AndAlso regex1.IsMatch(resultItem)) Then + index = regex1.Match(resultItem).Index + isFound = True + End If + ' Display string from the index till end of the string if sub string from index till end is less than columnLength value. + If Len(resultItem) - index <= columnLength Then + If index = 0 Then + itemToAdd = resultItem + Else + itemToAdd = "..." & resultItem.Substring(index, Len(resultItem) - index) + End If + Else + If index = 0 Then + itemToAdd = resultItem.Substring(index, (columnLength - 3)) & "..." + Else + 'Truncate the string to show only columnLength - 6 characters as begining and trailing "..." has to be appended. + itemToAdd = "..." & resultItem.Substring(index , columnLength - 6) & "..." + End If + End If + ElseIf InvariantLCase(AutoTypeAheadDisplayFoundText).equals("inmiddleofmatchedstring") Then + Dim subStringBeginIndex As Integer = CType(columnLength/2, Integer) + If Len(resultItem) <= columnLength Then + itemToAdd = resultItem + Else + ' Sanity check at end of the string + If index + Len(prefixText) = columnLength Then + itemToAdd = "..." & resultItem.Substring(index-columnLength,index) + ElseIf Len(resultItem) - index < subStringBeginIndex Then + ' Display string from the end till columnLength value if, index is closer to the end of the string. + itemToAdd = "..." & resultItem.Substring(Len(resultItem)-columnLength,Len(resultItem)) + ElseIf index <= subStringBeginIndex Then + ' Sanity chet at beginning of the string + itemToAdd = resultItem.Substring(0, columnLength) & "..." + Else + ' Display string containing text before the prefixText occures and text after the prefixText + itemToAdd = "..." & resultItem.Substring(index - subStringBeginIndex, columnLength) & "..." + End If + End If + ElseIf InvariantLCase(AutoTypeAheadDisplayFoundText).equals("atendofmatchedstring") Then + ' Expression to find ending of the word which contains prefexText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\s", System.Text.RegularExpressions.RegexOptions.IgnoreCase) + ' Find the ending of the word which contains prefexText + If regex1.IsMatch(resultItem, index + 1) Then + index = regex1.Match(resultItem, index + 1).Index + Else + ' If the word which contains prefexText is the last word in string, regex1.IsMatch returns false. + index = resultItem.Length + End If + If index > Len(resultItem) Then + index = Len(resultItem) + End If + ' If text from beginning of the string till index is less than columnLength value then, display string from the beginning till index. + If index <= columnLength Then + if index = Len(resultItem) Then 'Make decision to append "..." + itemToAdd = resultItem.Substring(0,index) + Else + itemToAdd = resultItem.Substring(0,index) & "..." + End If + Else + If index = Len(resultItem) Then + itemToAdd = "..." & resultItem.Substring(index - (columnLength - 3), (columnLength - 3)) + Else + 'Truncate the string to show only columnLength - 6 characters as begining and trailing "..." has to be appended. + itemToAdd = "..." & resultItem.Substring(index - (columnLength - 6), columnLength - 6) & "..." + End If + End If + End If + + ' Remove newline character from itemToAdd + Dim prefixTextIndex As Integer = itemToAdd.IndexOf(prefixText, StringComparison.CurrentCultureIgnoreCase) + ' If itemToAdd contains any newline after the search text then show text only till newline + Dim regex2 As System.Text.RegularExpressions.Regex = New System.Text.RegularExpressions.Regex("(" & vbCrLf & "|" & vbLf & ")", System.Text.RegularExpressions.RegexOptions.IgnoreCase) + Dim newLineIndexAfterPrefix As Integer = -1 + If regex2.IsMatch(itemToAdd, prefixTextIndex) Then + newLineIndexAfterPrefix = regex2.Match(itemToAdd, prefixTextIndex).Index + End If + If (newLineIndexAfterPrefix > -1) Then + If itemToAdd.EndsWith("...") Then + itemToAdd = (itemToAdd.Substring(0, newLineIndexAfterPrefix) + "...") + Else + itemToAdd = itemToAdd.Substring(0, newLineIndexAfterPrefix) + End If + End If + ' If itemToAdd contains any newline before search text then show text which comes after newline + Dim regex3 As System.Text.RegularExpressions.Regex = New System.Text.RegularExpressions.Regex("(" & vbCrLf & "|" & vbLf & ")", (System.Text.RegularExpressions.RegexOptions.IgnoreCase Or System.Text.RegularExpressions.RegexOptions.RightToLeft)) + Dim newLineIndexBeforePrefix As Integer = -1 + If regex3.IsMatch(itemToAdd, prefixTextIndex) Then + newLineIndexBeforePrefix = regex3.Match(itemToAdd, prefixTextIndex).Index + End If + If (newLineIndexBeforePrefix > -1) Then + If itemToAdd.StartsWith("...") Then + itemToAdd = ("..." + itemToAdd.Substring((newLineIndexBeforePrefix + regex3.Match(itemToAdd, prefixTextIndex).Length))) + Else + itemToAdd = itemToAdd.Substring((newLineIndexBeforePrefix + regex3.Match(itemToAdd, prefixTextIndex).Length)) + End If + End If + + If Not itemToAdd is nothing AndAlso Not resultList.Contains(itemToAdd) Then + + resultList.Add(itemToAdd) + + isAdded = true + End If + End If + Return isAdded + End Function + + + Protected Overridable Sub GetPageSize() + + If Me.PersonRelativePagination.PageSize.Text.Trim <> "" Then + Try + 'Me.PageSize = Integer.Parse(Me.PersonRelativePagination.PageSize.Text) + Catch ex As Exception + End Try + End If + End Sub + + Protected Overridable Sub AddNewRecords() + + Dim newRecordList As ArrayList = New ArrayList() + + Dim newUIDataList As System.Collections.Generic.List(Of Hashtable) = New System.Collections.Generic.List(Of Hashtable)() + + ' Loop though all the record controls and if the record control + ' does not have a unique record id set, then create a record + ' and add to the list. + If Not Me.ResetData Then + Dim rep As System.Web.UI.WebControls.Repeater = CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonRelativeTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return + + Dim repItem As System.Web.UI.WebControls.RepeaterItem + For Each repItem In rep.Items + ' Loop through all rows in the table, set its DataSource and call DataBind(). + + Dim recControl As PersonRelativeTableControlRow = DirectCast(repItem.FindControl("PersonRelativeTableControlRow"), PersonRelativeTableControlRow) + + If recControl.Visible AndAlso recControl.IsNewRecord() Then + + Dim rec As PersonRelativeRecord = New PersonRelativeRecord() + + If recControl.FLastName.Text <> "" Then + rec.Parse(recControl.FLastName.Text, PersonRelativeTable.FLastName) + End If + If recControl.FName.Text <> "" Then + rec.Parse(recControl.FName.Text, PersonRelativeTable.FName) + End If + If recControl.MLastName.Text <> "" Then + rec.Parse(recControl.MLastName.Text, PersonRelativeTable.MLastName) + End If + If recControl.MName.Text <> "" Then + rec.Parse(recControl.MName.Text, PersonRelativeTable.MName) + End If + If recControl.MOrLastName.Text <> "" Then + rec.Parse(recControl.MOrLastName.Text, PersonRelativeTable.MOrLastName) + End If + If MiscUtils.IsValueSelected(recControl.PersonalId) Then + rec.Parse(recControl.PersonalId.SelectedItem.Value, PersonRelativeTable.PersonalId) + End If + If recControl.RAddress.Text <> "" Then + rec.Parse(recControl.RAddress.Text, PersonRelativeTable.RAddress) + End If + If recControl.RAmphur.Text <> "" Then + rec.Parse(recControl.RAmphur.Text, PersonRelativeTable.RAmphur) + End If + If recControl.RBirthDate.Text <> "" Then + rec.Parse(recControl.RBirthDate.Text, PersonRelativeTable.RBirthDate) + End If + If recControl.Ref1.Text <> "" Then + rec.Parse(recControl.Ref1.Text, PersonRelativeTable.Ref0) + End If + If recControl.RefDate.Text <> "" Then + rec.Parse(recControl.RefDate.Text, PersonRelativeTable.RefDate) + End If + If MiscUtils.IsValueSelected(recControl.RelationId) Then + rec.Parse(recControl.RelationId.SelectedItem.Value, PersonRelativeTable.RelationId) + End If + If recControl.RFirstName.Text <> "" Then + rec.Parse(recControl.RFirstName.Text, PersonRelativeTable.RFirstName) + End If + If recControl.RLastName.Text <> "" Then + rec.Parse(recControl.RLastName.Text, PersonRelativeTable.RLastName) + End If + If recControl.RNationality.Text <> "" Then + rec.Parse(recControl.RNationality.Text, PersonRelativeTable.RNationality) + End If + If recControl.ROrigin.Text <> "" Then + rec.Parse(recControl.ROrigin.Text, PersonRelativeTable.ROrigin) + End If + If recControl.ROrLastName.Text <> "" Then + rec.Parse(recControl.ROrLastName.Text, PersonRelativeTable.ROrLastName) + End If + If recControl.RPreName.Text <> "" Then + rec.Parse(recControl.RPreName.Text, PersonRelativeTable.RPreName) + End If + If recControl.RProvince.Text <> "" Then + rec.Parse(recControl.RProvince.Text, PersonRelativeTable.RProvince) + End If + If recControl.RReligion.Text <> "" Then + rec.Parse(recControl.RReligion.Text, PersonRelativeTable.RReligion) + End If + If recControl.RRemark.Text <> "" Then + rec.Parse(recControl.RRemark.Text, PersonRelativeTable.RRemark) + End If + If MiscUtils.IsValueSelected(recControl.RStatus) Then + rec.Parse(recControl.RStatus.SelectedItem.Value, PersonRelativeTable.RStatus) + End If + If recControl.RStatusDate.Text <> "" Then + rec.Parse(recControl.RStatusDate.Text, PersonRelativeTable.RStatusDate) + End If + If recControl.RStatusRef.Text <> "" Then + rec.Parse(recControl.RStatusRef.Text, PersonRelativeTable.RStatusRef) + End If + newUIDataList.Add(recControl.PreservedUIData()) + newRecordList.Add(rec) + End If + Next + End If + + + ' Add any new record to the list. + Dim index As Integer = 0 + For index = 1 To Me.AddNewRecord + + newRecordList.Insert(0, New PersonRelativeRecord()) + newUIDataList.Insert(0, New Hashtable()) + + Next + Me.AddNewRecord = 0 + + ' Finally, add any new records to the DataSource. + If newRecordList.Count > 0 Then + + Dim finalList As ArrayList = New ArrayList(Me.DataSource) + finalList.InsertRange(0, newRecordList) + + Me.DataSource = DirectCast(finalList.ToArray(GetType(PersonRelativeRecord)), PersonRelativeRecord()) + + End If + + ' Add the existing UI data to this hash table + If newUIDataList.Count > 0 Then + Me.UIData.InsertRange(0, newUIDataList) + End If + + End Sub + + + Public Sub AddToDeletedRecordIds(ByVal rec As PersonRelativeTableControlRow) + If rec.IsNewRecord() Then + Return + End If + + If Not Me.DeletedRecordIds Is Nothing AndAlso Me.DeletedRecordIds.Trim <> "" Then + Me.DeletedRecordIds &= "," + End If + + Me.DeletedRecordIds &= "[" & rec.RecordUniqueId & "]" + End Sub + + Protected Overridable Function InDeletedRecordIds(ByVal rec As PersonRelativeTableControlRow) As Boolean + If Me.DeletedRecordIds Is Nothing OrElse Me.DeletedRecordIds.Trim = "" Then + Return False + End If + + Return Me.DeletedRecordIds.IndexOf("[" & rec.RecordUniqueId & "]") >= 0 + End Function + + Private _DeletedRecordIds As String + Public Property DeletedRecordIds() As String + Get + Return Me._DeletedRecordIds + End Get + Set(ByVal value As String) + Me._DeletedRecordIds = value + End Set + End Property + + + ' Create Set, WhereClause, and Populate Methods + + Public Overridable Sub 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 SetPersonRelativeTableControlCollapsibleRegion() + + End Sub + + Public Overridable Sub SetPersonRelativeTableControlIcon() + + End Sub + + Public Overridable Sub SetPersonRelativeTableControlPanelExtender() + + 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 SetRelationIdLabel1() + + 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 + + + + + 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. + Dim added As Boolean = Me.AddNewRecord > 0 + Me.LoadData() + Me.DataBind() + + If added Then + Me.SetFocusToAddedRow() + End If + + End If + + + + Catch ex As Exception + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + Finally + DbUtils.EndTransaction + End Try + End Sub + + 'this function sets focus to the first editable element in the new added row in the editable table + Protected Overridable Sub SetFocusToAddedRow() + Dim rep As System.Web.UI.WebControls.Repeater = CType(Me.FindControl("PersonRelativeTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing OrElse rep.Items.Count = 0 Then Return + Dim repItem As System.Web.UI.WebControls.RepeaterItem + For Each repItem In rep.Items + 'Load scripts to table rows + Me.Page.LoadFocusScripts(repItem) + Dim recControl As PersonRelativeTableControlRow = DirectCast(repItem.FindControl("PersonRelativeTableControlRow"), PersonRelativeTableControlRow) + If recControl.IsNewRecord Then + For Each field As Control In recControl.Controls + If field.Visible AndAlso Me.Page.IsControlEditable(field, False) Then + 'set focus on the first editable field in the new row + field.Focus() + Dim updPan As UpdatePanel = DirectCast(Me.Page.FindControlRecursively("UpdatePanel1"), UpdatePanel) + If Not updPan Is Nothing Then updPan.Update() + Return + End If + Next + Return + End If + Next + End Sub + + + Protected Overrides Sub SaveControlsToSession() + MyBase.SaveControlsToSession() + + ' Save filter controls to values to session. + + + 'Save pagination state to session. + + + + ' Save table control properties to the session. + If Not Me.CurrentSortOrder Is Nothing Then + Me.SaveToSession(Me, "Order_By", Me.CurrentSortOrder.ToXmlString()) + End If + + Me.SaveToSession(Me, "Page_Index", Me.PageIndex.ToString()) + Me.SaveToSession(Me, "Page_Size", Me.PageSize.ToString()) + + Me.SaveToSession(Me, "DeletedRecordIds", Me.DeletedRecordIds) + + End Sub + + Protected Sub SaveControlsToSession_Ajax() + ' Save filter controls to values to session. + + HttpContext.Current.Session("AppRelativeVirtualPath") = Me.Page.AppRelativeVirtualPath + + End Sub + + Protected Overrides Sub ClearControlsFromSession() + MyBase.ClearControlsFromSession() + + ' Clear filter controls values from the session. + + + ' Clear pagination state from session. + + + + ' Clear table properties from the session. + Me.RemoveFromSession(Me, "Order_By") + Me.RemoveFromSession(Me, "Page_Index") + Me.RemoveFromSession(Me, "Page_Size") + + Me.RemoveFromSession(Me, "DeletedRecordIds") + + End Sub + + Protected Overrides Sub LoadViewState(ByVal savedState As Object) + MyBase.LoadViewState(savedState) + + Dim orderByStr As String = CType(ViewState("PersonRelativeTableControl_OrderBy"), String) + + If orderByStr IsNot Nothing AndAlso orderByStr.Trim <> "" Then + Me.CurrentSortOrder = BaseClasses.Data.OrderBy.FromXmlString(orderByStr) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + End If + + Dim pageIndex As String = CType(ViewState("Page_Index"), String) + If pageIndex IsNot Nothing Then + Me.PageIndex = CInt(pageIndex) + End If + + Dim pageSize As String = CType(ViewState("Page_Size"), String) + If Not pageSize Is Nothing Then + Me.PageSize = CInt(pageSize) + End If + + + + ' Load view state for pagination control. + + Me.DeletedRecordIds = CType(Me.ViewState("DeletedRecordIds"), String) + + End Sub + + Protected Overrides Function SaveViewState() As Object + + If Me.CurrentSortOrder IsNot Nothing Then + Me.ViewState("PersonRelativeTableControl_OrderBy") = Me.CurrentSortOrder.ToXmlString() + End If + + Me.ViewState("Page_Index") = Me.PageIndex + Me.ViewState("Page_Size") = Me.PageSize + + Me.ViewState("DeletedRecordIds") = Me.DeletedRecordIds + + + ' Load view state for pagination control. + + + Return MyBase.SaveViewState() + End Function + + ' Generate the event handling functions for pagination events. + + ' event handler for ImageButton + Public Overridable Sub PersonRelativePagination_FirstPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.PageIndex = 0 + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonRelativePagination_LastPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.DisplayLastPage = True + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonRelativePagination_NextPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.PageIndex += 1 + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for LinkButton + Public Overridable Sub PersonRelativePagination_PageSizeButton_Click(ByVal sender As Object, ByVal args As EventArgs) + + Try + + Me.DataChanged = True + + Me.PageSize = Integer.Parse(Me.PersonRelativePagination.PageSize.Text) + + Me.PageIndex = Integer.Parse(Me.PersonRelativePagination.CurrentPage.Text) - 1 + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonRelativePagination_PreviousPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + If Me.PageIndex > 0 Then + Me.PageIndex -= 1 + Me.DataChanged = True + End If + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + + ' Generate the event handling functions for sorting events. + + Public Overridable Sub FLastNameLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by FLastName when clicked. + + ' Get previous sorting state for FLastName. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonRelativeTable.FLastName) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for FLastName. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonRelativeTable.FLastName, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by FLastName, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub FNameLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by FName when clicked. + + ' Get previous sorting state for FName. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonRelativeTable.FName) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for FName. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonRelativeTable.FName, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by FName, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub MLastNameLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by MLastName when clicked. + + ' Get previous sorting state for MLastName. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonRelativeTable.MLastName) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for MLastName. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonRelativeTable.MLastName, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by MLastName, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub MNameLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by MName when clicked. + + ' Get previous sorting state for MName. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonRelativeTable.MName) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for MName. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonRelativeTable.MName, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by MName, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub MOrLastNameLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by MOrLastName when clicked. + + ' Get previous sorting state for MOrLastName. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonRelativeTable.MOrLastName) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for MOrLastName. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonRelativeTable.MOrLastName, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by MOrLastName, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub RAddressLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by RAddress when clicked. + + ' Get previous sorting state for RAddress. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonRelativeTable.RAddress) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for RAddress. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonRelativeTable.RAddress, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by RAddress, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub RAmphurLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by RAmphur when clicked. + + ' Get previous sorting state for RAmphur. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonRelativeTable.RAmphur) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for RAmphur. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonRelativeTable.RAmphur, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by RAmphur, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub RBirthDateLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by RBirthDate when clicked. + + ' Get previous sorting state for RBirthDate. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonRelativeTable.RBirthDate) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for RBirthDate. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonRelativeTable.RBirthDate, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by RBirthDate, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub RefDateLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by RefDate when clicked. + + ' Get previous sorting state for RefDate. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonRelativeTable.RefDate) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for RefDate. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonRelativeTable.RefDate, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by RefDate, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub RefLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by Ref when clicked. + + ' Get previous sorting state for Ref. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonRelativeTable.Ref0) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for Ref. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonRelativeTable.Ref0, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by Ref, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub RelationIdLabel1_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by RelationId when clicked. + + ' Get previous sorting state for RelationId. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonRelativeTable.RelationId) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for RelationId. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonRelativeTable.RelationId, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by RelationId, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub RFirstNameLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by RFirstName when clicked. + + ' Get previous sorting state for RFirstName. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonRelativeTable.RFirstName) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for RFirstName. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonRelativeTable.RFirstName, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by RFirstName, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub RLastNameLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by RLastName when clicked. + + ' Get previous sorting state for RLastName. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonRelativeTable.RLastName) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for RLastName. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonRelativeTable.RLastName, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by RLastName, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub RNationalityLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by RNationality when clicked. + + ' Get previous sorting state for RNationality. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonRelativeTable.RNationality) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for RNationality. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonRelativeTable.RNationality, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by RNationality, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub ROriginLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by ROrigin when clicked. + + ' Get previous sorting state for ROrigin. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonRelativeTable.ROrigin) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for ROrigin. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonRelativeTable.ROrigin, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by ROrigin, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub ROrLastNameLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by ROrLastName when clicked. + + ' Get previous sorting state for ROrLastName. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonRelativeTable.ROrLastName) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for ROrLastName. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonRelativeTable.ROrLastName, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by ROrLastName, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub RPreNameLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by RPreName when clicked. + + ' Get previous sorting state for RPreName. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonRelativeTable.RPreName) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for RPreName. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonRelativeTable.RPreName, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by RPreName, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub RProvinceLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by RProvince when clicked. + + ' Get previous sorting state for RProvince. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonRelativeTable.RProvince) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for RProvince. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonRelativeTable.RProvince, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by RProvince, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub RReligionLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by RReligion when clicked. + + ' Get previous sorting state for RReligion. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonRelativeTable.RReligion) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for RReligion. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonRelativeTable.RReligion, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by RReligion, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub RRemarkLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by RRemark when clicked. + + ' Get previous sorting state for RRemark. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonRelativeTable.RRemark) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for RRemark. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonRelativeTable.RRemark, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by RRemark, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub RStatusDateLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by RStatusDate when clicked. + + ' Get previous sorting state for RStatusDate. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonRelativeTable.RStatusDate) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for RStatusDate. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonRelativeTable.RStatusDate, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by RStatusDate, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub RStatusLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by RStatus when clicked. + + ' Get previous sorting state for RStatus. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonRelativeTable.RStatus) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for RStatus. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonRelativeTable.RStatus, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by RStatus, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub RStatusRefLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by RStatusRef when clicked. + + ' Get previous sorting state for RStatusRef. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonRelativeTable.RStatusRef) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for RStatusRef. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonRelativeTable.RStatusRef, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by RStatusRef, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + + ' Generate the event handling functions for button events. + + ' event handler for ImageButton + Public Overridable Sub PersonRelativeAddButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + Me.AddNewRecord = 1 + Me.DataChanged = True + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonRelativeDeleteButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + If(Not Me.Page.IsPageRefresh) Then + + Me.DeleteSelectedRecords(True) + Me.SetFormulaControls() + + + End If + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonRelativeEditButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + ' The redirect URL is set on the Properties, Custom Properties or Actions. + ' The ModifyRedirectURL call resolves the parameters before the + ' Response.Redirect redirects the page to the URL. + ' Any code after the Response.Redirect call will not be executed, since the page is + ' redirected to the URL. + + + Dim url As String = "../PersonRelative/EditPersonRelative.aspx?PersonRelative={PK}" + + Dim shouldRedirect As Boolean = True + Dim TargetKey As String = Nothing + Dim DFKA As String = TargetKey + Dim id As String = DFKA + Dim value As String = id + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + url = Me.ModifyRedirectUrl(url, "",False) + url = Me.Page.ModifyRedirectUrl(url, "",False) + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + shouldRedirect = False + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + If shouldRedirect Then + Me.Page.ShouldSaveControlsToSession = True + Me.Page.Response.Redirect(url) + ElseIf Not TargetKey Is Nothing AndAlso _ + Not shouldRedirect Then + Me.Page.ShouldSaveControlsToSession = True + Me.Page.CloseWindow(True) + + End If + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonRelativeRefreshButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Dim PersonRelativeTableControlObj as PersonRelativeTableControl = DirectCast(Me.Page.FindControlRecursively("PersonRelativeTableControl"), PersonRelativeTableControl) + PersonRelativeTableControlObj.ResetData = True + + PersonRelativeTableControlObj.RemoveFromSession(PersonRelativeTableControlObj, "DeletedRecordIds") + PersonRelativeTableControlObj.DeletedRecordIds = Nothing + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonRelativeResetButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.CurrentSortOrder.Reset() + If Me.InSession(Me, "Order_By") Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + Me.CurrentSortOrder.Add(PersonRelativeTable.RelationId, OrderByItem.OrderDir.Asc) + + Me.CurrentSortOrder.Add(PersonRelativeTable.RBirthDate, OrderByItem.OrderDir.Asc) + + + End If + + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonRelativeSaveButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + + If (Not Me.Page.IsPageRefresh) Then + Me.SaveData() + End If + + Me.Page.CommitTransaction(sender) + ' Set IsNewRecord to False for all records - since everything has been saved and is no longer "new" + Dim recCtl As PersonRelativeTableControlRow + For Each recCtl in Me.GetRecordControls() + + recCtl.IsNewRecord = False + Next + + + ' Set DeletedRecordsIds to Nothing since we have deleted all pending deletes. + + Me.DeletedRecordIds = Nothing + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + + + ' Generate the event handling functions for filter and search events. + + + ' Generate the event handling functions for others + + + Private _UIData As New System.Collections.Generic.List(Of Hashtable) + Public Property UIData() As System.Collections.Generic.List(Of Hashtable) + Get + Return Me._UIData + End Get + Set(ByVal value As System.Collections.Generic.List(Of Hashtable)) + Me._UIData = value + End Set + End Property + + ' pagination properties + Protected _PageSize As Integer + Public Property PageSize() As Integer + Get + Return Me._PageSize + End Get + Set(ByVal value As Integer) + Me._PageSize = value + End Set + End Property + + Protected _PageIndex As Integer + Public Property PageIndex() As Integer + Get + ' Return the PageIndex + Return Me._PageIndex + End Get + Set(ByVal value As Integer) + Me._PageIndex = value + End Set + End Property + + Protected _TotalRecords As Integer = -1 + Public Property TotalRecords() As Integer + Get + If _TotalRecords < 0 + _TotalRecords = PersonRelativeTable.GetRecordCount(CreateCompoundJoinFilter(), CreateWhereClause()) + End If + Return Me._TotalRecords + End Get + Set(ByVal value As Integer) + If Me.PageSize > 0 Then + + Me.TotalPages = CInt(Math.Ceiling(value / Me.PageSize)) + + End If + Me._TotalRecords = value + End Set + End Property + + + + Protected _TotalPages As Integer = -1 + Public Property TotalPages() As Integer + Get + If _TotalPages < 0 Then + + Me.TotalPages = CInt(Math.Ceiling(TotalRecords / Me.PageSize)) + + End If + Return Me._TotalPages + End Get + Set(ByVal value As Integer) + Me._TotalPages = value + End Set + End Property + + Protected _DisplayLastPage As Boolean + Public Property DisplayLastPage() As Boolean + Get + Return Me._DisplayLastPage + End Get + Set(ByVal value As Boolean) + Me._DisplayLastPage = value + End Set + End Property + + Private _DataChanged As Boolean = False + Public Property DataChanged() As Boolean + Get + Return Me._DataChanged + End Get + Set(ByVal value As Boolean) + Me._DataChanged = value + End Set + End Property + + Private _ResetData As Boolean = False + Public Property ResetData() As Boolean + Get + Return Me._ResetData + End Get + Set(ByVal value As Boolean) + Me._ResetData = value + End Set + End Property + + Private _AddNewRecord As Integer = 0 + Public Property AddNewRecord() As Integer + Get + Return Me._AddNewRecord + End Get + Set(ByVal value As Integer) + Me._AddNewRecord = value + End Set + End Property + + + Private _CurrentSortOrder As OrderBy = Nothing + Public Property CurrentSortOrder() As OrderBy + Get + Return Me._CurrentSortOrder + End Get + Set(ByVal value As BaseClasses.Data.OrderBy) + Me._CurrentSortOrder = value + End Set + End Property + + Private _DataSource() As PersonRelativeRecord = Nothing + Public Property DataSource() As PersonRelativeRecord () + Get + Return Me._DataSource + End Get + Set(ByVal value() As PersonRelativeRecord) + Me._DataSource = value + End Set + End Property + +#Region "Helper Properties" + + Public ReadOnly Property FLastNameLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "FLastNameLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property FNameLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "FNameLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property MLastNameLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "MLastNameLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property MNameLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "MNameLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property MOrLastNameLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "MOrLastNameLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property PersonRelativeAddButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonRelativeAddButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonRelativeDeleteButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonRelativeDeleteButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonRelativeEditButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonRelativeEditButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonRelativePagination() As Persons.UI.IPagination + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonRelativePagination"), Persons.UI.IPagination) + End Get + End Property + + Public ReadOnly Property PersonRelativeRefreshButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonRelativeRefreshButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonRelativeResetButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonRelativeResetButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonRelativeSaveButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonRelativeSaveButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonRelativeTableControlCollapsibleRegion() As System.Web.UI.WebControls.Panel + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonRelativeTableControlCollapsibleRegion"), System.Web.UI.WebControls.Panel) + End Get + End Property + + Public ReadOnly Property PersonRelativeTableControlIcon() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonRelativeTableControlIcon"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonRelativeTableControlPanelExtender() As AjaxControlToolkit.CollapsiblePanelExtender + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonRelativeTableControlPanelExtender"), 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 PersonRelativeToggleAll() As System.Web.UI.WebControls.CheckBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonRelativeToggleAll"), System.Web.UI.WebControls.CheckBox) + End Get + End Property + + Public ReadOnly Property RAddressLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RAddressLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property RAmphurLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RAmphurLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property RBirthDateLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RBirthDateLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property RefDateLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RefDateLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property RefLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RefLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property RelationIdLabel1() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RelationIdLabel1"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property RFirstNameLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RFirstNameLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property RLastNameLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RLastNameLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property RNationalityLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RNationalityLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property ROriginLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "ROriginLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property ROrLastNameLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "ROrLastNameLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property RPreNameLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RPreNameLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property RProvinceLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RProvinceLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property RReligionLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RReligionLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property RRemarkLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RRemarkLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property RStatusDateLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RStatusDateLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property RStatusLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RStatusLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property RStatusRefLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RStatusRefLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + +#End Region + +#Region "Helper Functions" + + Public Overrides Overloads Function ModifyRedirectUrl(url As String, arg As String, ByVal bEncrypt As Boolean) As String + Return Me.Page.EvaluateExpressions(url, arg, bEncrypt, Me) + End Function + + Public Overrides Overloads Function EvaluateExpressions(url As String, arg As String, ByVal bEncrypt As Boolean) As String + Dim needToProcess As Boolean = AreAnyUrlParametersForMe(url, arg) + If (needToProcess) Then + Dim recCtl As PersonRelativeTableControlRow = Me.GetSelectedRecordControl() + If recCtl Is Nothing AndAlso url.IndexOf("{") >= 0 Then + ' Localization. + Throw New Exception(Page.GetResourceValue("Err:NoRecSelected", "Persons")) + End If + Dim rec As PersonRelativeRecord = Nothing + If recCtl IsNot Nothing Then + rec = recCtl.GetRecord() + End If + Return EvaluateExpressions(url, arg, rec, bEncrypt) + End If + Return url + End Function + + Public Overridable Function GetSelectedRecordIndex() As Integer + Dim counter As Integer = 0 + Dim recControl As PersonRelativeTableControlRow + For Each recControl In Me.GetRecordControls() + If recControl.PersonRelativeRecordRowSelection.Checked Then + Return counter + End If + counter += 1 + Next + Return -1 + End Function + + Public Overridable Function GetSelectedRecordControl() As PersonRelativeTableControlRow + Dim selectedList() As PersonRelativeTableControlRow = Me.GetSelectedRecordControls() + If selectedList.Length = 0 Then + Return Nothing + End If + Return selectedList(0) + + End Function + + Public Overridable Function GetSelectedRecordControls() As PersonRelativeTableControlRow() + + Dim selectedList As ArrayList = New ArrayList(25) + Dim recControl As PersonRelativeTableControlRow + For Each recControl In Me.GetRecordControls() + If recControl.PersonRelativeRecordRowSelection IsNot Nothing AndAlso recControl.PersonRelativeRecordRowSelection.Checked Then + selectedList.Add(recControl) + End If + Next + Return DirectCast(selectedList.ToArray(GetType(PersonRelativeTableControlRow)), PersonRelativeTableControlRow()) + + End Function + + Public Overridable Sub DeleteSelectedRecords(ByVal deferDeletion As Boolean) + Dim recList() As PersonRelativeTableControlRow = Me.GetSelectedRecordControls() + If recList.Length = 0 Then + ' Localization. + Throw New Exception(Page.GetResourceValue("Err:NoRecSelected", "Persons")) + End If + + Dim recCtl As PersonRelativeTableControlRow + For Each recCtl In recList + If deferDeletion Then + If Not recCtl.IsNewRecord Then + + Me.AddToDeletedRecordIds(recCtl) + + End If + recCtl.Visible = False + + recCtl.PersonRelativeRecordRowSelection.Checked = False + + Else + + recCtl.Delete() + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + End If + Next + End Sub + + Public Function GetRecordControls() As PersonRelativeTableControlRow() + Dim recList As ArrayList = New ArrayList() + Dim rep As System.Web.UI.WebControls.Repeater = CType(Me.FindControl("PersonRelativeTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return Nothing + Dim repItem As System.Web.UI.WebControls.RepeaterItem + + For Each repItem In rep.Items + + Dim recControl As PersonRelativeTableControlRow = DirectCast(repItem.FindControl("PersonRelativeTableControlRow"), PersonRelativeTableControlRow) + recList.Add(recControl) + + Next + + Return DirectCast(recList.ToArray(GetType(PersonRelativeTableControlRow)), PersonRelativeTableControlRow()) + 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 + + \ No newline at end of file diff --git a/App_Code/PersonalDD/EditPersonalDDTable.Controls.vb b/App_Code/PersonalDD/EditPersonalDDTable.Controls.vb new file mode 100644 index 0000000..bae50ba --- /dev/null +++ b/App_Code/PersonalDD/EditPersonalDDTable.Controls.vb @@ -0,0 +1,3027 @@ + +' This file implements the TableControl, TableControlRow, and RecordControl classes for the +' EditPersonalDDTable.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.EditPersonalDDTable + +#Region "Section 1: Place your customizations here." + + +Public Class PersonalDDTableControlRow + Inherits BasePersonalDDTableControlRow + ' The BasePersonalDDTableControlRow implements code for a ROW within the + ' the PersonalDDTableControl table. The BasePersonalDDTableControlRow implements the DataBind and SaveData methods. + ' The loading of data is actually performed by the LoadData method in the base class of PersonalDDTableControl. + + ' This is the ideal place to add your code customizations. For example, you can override the DataBind, + ' SaveData, GetUIData, and Validate methods. + + + + + + + + Public Overrides Sub GetUIData() + + ' Call MyBase.GetUIData + MyBase.GetUIData() + + ' Get PersonalDD Record + Dim myRec As PersonalDDRecord = Me.GetRecord + + ' Set PersonalId field value to new value string + myRec.PersonalId = Utils.SecurityControls.GetCurrentUserID + + End Sub + + + + + + End Class + + + + Public Class PersonalDDTableControl + Inherits BasePersonalDDTableControl + + ' The BasePersonalDDTableControl class implements the LoadData, DataBind, CreateWhereClause + ' and other methods to load and display the data in a table control. + + ' This is the ideal place to add your code customizations. You can override the LoadData and CreateWhereClause, + ' The PersonalDDTableControlRow class offers another place where you can customize + ' the DataBind, GetUIData, SaveData and Validate methods specific to each row displayed on the table. + + + ''' + ''' This method is called when PersonalDDAddButton is clicked. + ''' + Public Overrides Sub PersonalDDAddButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + MyBase.PersonalDDAddButton_Click(sender, args) + + End Sub + End Class + + + +#End Region + + + +#Region "Section 2: Do not modify this section." + + +' Base class for the PersonalDDTableControlRow control on the EditPersonalDDTable page. +' Do not modify this class. Instead override any method in PersonalDDTableControlRow. +Public Class BasePersonalDDTableControlRow + Inherits Persons.UI.BaseApplicationRecordControl + + ' To customize, override this method in PersonalDDTableControlRow. + Protected Overridable Sub Control_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Init + + Me.ClearControlsFromSession() + End Sub + + ' To customize, override this method in PersonalDDTableControlRow. + Protected Overridable Sub Control_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load + + 'Call LoadFocusScripts from repeater so that onfocus attribute could be added to elements + Me.Page.LoadFocusScripts(Me) + + ' Show confirmation message on Click + Me.PersonalDDRowDeleteButton.Attributes.Add("onClick", "return (confirm('" & (CType(Me.Page,BaseApplicationPage)).GetResourceValue("DeleteRecordConfirm", "Persons") & "'));") + + + ' Register the event handlers. + + AddHandler Me.PersonalDDRowDeleteButton.Click, AddressOf PersonalDDRowDeleteButton_Click + + AddHandler Me.PersonalId.SelectedIndexChanged, AddressOf PersonalId_SelectedIndexChanged + + AddHandler Me.EndDate.TextChanged, AddressOf EndDate_TextChanged + + AddHandler Me.Mission.TextChanged, AddressOf Mission_TextChanged + + AddHandler Me.Ref1.TextChanged, AddressOf Ref1_TextChanged + + AddHandler Me.RefDate.TextChanged, AddressOf RefDate_TextChanged + + AddHandler Me.StartDate.TextChanged, AddressOf StartDate_TextChanged + + + End Sub + + + Public Overridable Sub LoadData() + + ' Load the data from the database into the DataSource PersonalDD 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 = PersonalDDTable.GetRecord(Me.RecordUniqueId, True) + + Return + End If + + ' Since this is a row in the table, the data for this row is loaded by the + ' LoadData method of the BasePersonalDDTableControl when the data for the entire + ' table is loaded. + + Me.DataSource = New PersonalDDRecord() + + + + End Sub + + ' Populate the UI controls using the DataSource. To customize, override this method in PersonalDDTableControlRow. + 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 + + SetEndDate() + SetMission() + + + SetPersonalId() + SetRef1() + SetRefDate() + SetStartDate() + + + Me.IsNewRecord = True + + If Me.DataSource.IsCreated Then + Me.IsNewRecord = False + + Me.RecordUniqueId = Me.DataSource.GetID.ToXmlString() + End If + + ' Now load data for each record and table child UI controls. + ' Ordering is important because child controls get + ' their parent ids from their parent UI controls. + Dim shouldResetControl As Boolean = False + + End Sub + + + Public Overridable Sub SetEndDate() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.EndDate.ID) Then + + Me.EndDate.Text = Me.PreviousUIData(Me.EndDate.ID).ToString() + + Return + End If + + + ' Set the EndDate TextBox on the webpage with value from the + ' PersonalDD database record. + + ' Me.DataSource is the PersonalDD record retrieved from the database. + ' Me.EndDate is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetEndDate() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.EndDateSpecified Then + + ' If the EndDate is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalDDTable.EndDate, "d MMM yyyy") + + Me.EndDate.Text = formattedValue + + Else + + ' EndDate is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.EndDate.Text = PersonalDDTable.EndDate.Format(PersonalDDTable.EndDate.DefaultValue, "d MMM yyyy") + + End If + + End Sub + + Public Overridable Sub SetMission() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.Mission.ID) Then + + Me.Mission.Text = Me.PreviousUIData(Me.Mission.ID).ToString() + + Return + End If + + + ' Set the Mission TextBox on the webpage with value from the + ' PersonalDD database record. + + ' Me.DataSource is the PersonalDD record retrieved from the database. + ' Me.Mission is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetMission() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.MissionSpecified Then + + ' If the Mission is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalDDTable.Mission) + + Me.Mission.Text = formattedValue + + Else + + ' Mission is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.Mission.Text = PersonalDDTable.Mission.Format(PersonalDDTable.Mission.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetPersonalId() + + ' If selection was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.PersonalId.ID) Then + If Me.PreviousUIData(Me.PersonalId.ID) Is Nothing + Me.PopulatePersonalIdDropDownList(Nothing, 100) + Else + Me.PopulatePersonalIdDropDownList(Me.PreviousUIData(Me.PersonalId.ID).ToString(), 100) + End If + Return + End If + + + ' Set the PersonalId DropDownList on the webpage with value from the + ' PersonalDD database record. + + ' Me.DataSource is the PersonalDD record retrieved from the database. + ' Me.PersonalId is the ASP:DropDownList on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetPersonalId() + ' and add your own code before or after the call to the MyBase function. + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.PersonalIdSpecified Then + + ' If the PersonalId is non-NULL, then format the value. + ' The Format method will return the Display Foreign Key As (DFKA) value + Me.PopulatePersonalIdDropDownList(Me.DataSource.PersonalId, 100) + + Else + + ' PersonalId 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.PopulatePersonalIdDropDownList(Nothing, 100) + Else + Me.PopulatePersonalIdDropDownList(PersonalDDTable.PersonalId.DefaultValue, 100) + End If + + End If + + End Sub + + Public Overridable Sub SetRef1() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.Ref1.ID) Then + + Me.Ref1.Text = Me.PreviousUIData(Me.Ref1.ID).ToString() + + Return + End If + + + ' Set the Ref TextBox on the webpage with value from the + ' PersonalDD database record. + + ' Me.DataSource is the PersonalDD 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(PersonalDDTable.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 = PersonalDDTable.Ref0.Format(PersonalDDTable.Ref0.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetRefDate() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.RefDate.ID) Then + + Me.RefDate.Text = Me.PreviousUIData(Me.RefDate.ID).ToString() + + Return + End If + + + ' Set the RefDate TextBox on the webpage with value from the + ' PersonalDD database record. + + ' Me.DataSource is the PersonalDD 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(PersonalDDTable.RefDate, "d MMM yyyy") + + 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 = PersonalDDTable.RefDate.Format(PersonalDDTable.RefDate.DefaultValue, "d MMM yyyy") + + End If + + End Sub + + Public Overridable Sub SetStartDate() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.StartDate.ID) Then + + Me.StartDate.Text = Me.PreviousUIData(Me.StartDate.ID).ToString() + + Return + End If + + + ' Set the StartDate TextBox on the webpage with value from the + ' PersonalDD database record. + + ' Me.DataSource is the PersonalDD record retrieved from the database. + ' Me.StartDate is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetStartDate() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.StartDateSpecified Then + + ' If the StartDate is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalDDTable.StartDate, "d MMM yyyy") + + Me.StartDate.Text = formattedValue + + Else + + ' StartDate is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.StartDate.Text = PersonalDDTable.StartDate.Format(PersonalDDTable.StartDate.DefaultValue, "d MMM yyyy") + + End If + + End Sub + + + Public EvaluateFormulaDelegate As BaseClasses.Data.DataSource.EvaluateFormulaDelegate = New BaseClasses.Data.DataSource.EvaluateFormulaDelegate(AddressOf Me.EvaluateFormula) + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean, ByVal e As FormulaEvaluator) As String + If e Is Nothing Then + e = New FormulaEvaluator() + End If + + e.Variables.Clear() + + + ' add variables for formula evaluation + If variables IsNot Nothing Then + Dim enumerator As System.Collections.Generic.IEnumerator(Of System.Collections.Generic.KeyValuePair(Of String, Object)) = variables.GetEnumerator() + While enumerator.MoveNext() + e.Variables.Add(enumerator.Current.Key, enumerator.Current.Value) + End While + End If + + If includeDS + + End IF + + + ' Other variables referred to in the formula are expected to be + ' properties of the DataSource. For example, referring to + ' UnitPrice as a variable will refer to DataSource.UnitPrice + If dataSourceForEvaluate Is Nothing Then + + e.DataSource = Me.DataSource + + Else + e.DataSource = dataSourceForEvaluate + End If + + ' Define the calling control. This is used to add other + ' related table and record controls as variables. + e.CallingControl = Me + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + + If Not String.IsNullOrEmpty(format) AndAlso (String.IsNullOrEmpty(formula) OrElse formula.IndexOf("Format(") < 0) Then + Return FormulaUtils.Format(resultObj, format) + Else + Return resultObj.ToString() + End If + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format,variables ,includeDS, Nothing) + End Function + + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object)) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format, variables ,True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, format, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal e as FormulaEvaluator) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, variables, True, e) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal includeDS as Boolean) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, includeDS, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, True, Nothing) + End Function + + + Public Overridable Sub RegisterPostback() + + + End Sub + + + + ' To customize, override this method in PersonalDDTableControlRow. + Public Overridable Sub SaveData() + ' Saves the associated record in the database. + ' SaveData calls Validate and Get methods - so it may be more appropriate to + ' customize those methods. + + ' 1. Load the existing record from the database. Since we save the entire record, this ensures + ' that fields that are not displayed are also properly initialized. + Me.LoadData() + + + ' 2. Perform any custom validation. + Me.Validate() + + + ' 3. Set the values in the record with data from UI controls. + ' This calls the Get() method for each of the user interface controls. + Me.GetUIData() + + ' 4. Save in the database. + ' We should not save the record if the data did not change. This + ' will save a database hit and avoid triggering any database triggers. + + If Me.DataSource.IsAnyValueChanged Then + ' Save record to database but do not commit yet. + ' Auto generated ids are available after saving for use by child (dependent) records. + Me.DataSource.Save() + + DirectCast(GetParentControlObject(Me, "PersonalDDTableControl"), PersonalDDTableControl).DataChanged = True + DirectCast(GetParentControlObject(Me, "PersonalDDTableControl"), PersonalDDTableControl).ResetData = True + End If + + + ' update session or cookie by formula + + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + ' For Master-Detail relationships, save data on the Detail table(s) + + End Sub + + ' To customize, override this method in PersonalDDTableControlRow. + 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. + + GetEndDate() + GetMission() + GetPersonalId() + GetRef1() + GetRefDate() + GetStartDate() + End Sub + + + Public Overridable Sub GetEndDate() + + ' Retrieve the value entered by the user on the EndDate ASP:TextBox, and + ' save it into the EndDate field in DataSource PersonalDD 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.EndDate.Text, PersonalDDTable.EndDate) + + + End Sub + + Public Overridable Sub GetMission() + + ' Retrieve the value entered by the user on the Mission ASP:TextBox, and + ' save it into the Mission field in DataSource PersonalDD record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.Mission.Text, PersonalDDTable.Mission) + + + End Sub + + Public Overridable Sub GetPersonalId() + + ' Retrieve the value entered by the user on the PersonalId ASP:DropDownList, and + ' save it into the PersonalId field in DataSource PersonalDD record. + + ' Custom validation should be performed in Validate, not here. + + Me.DataSource.Parse(GetValueSelectedPageRequest(Me.PersonalId), PersonalDDTable.PersonalId) + + 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 PersonalDD record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.Ref1.Text, PersonalDDTable.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 PersonalDD 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, PersonalDDTable.RefDate) + + + End Sub + + Public Overridable Sub GetStartDate() + + ' Retrieve the value entered by the user on the StartDate ASP:TextBox, and + ' save it into the StartDate field in DataSource PersonalDD 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.StartDate.Text, PersonalDDTable.StartDate) + + + End Sub + + + ' To customize, override this method in PersonalDDTableControlRow. + + Public Overridable Function CreateWhereClause() As WhereClause + + Return Nothing + + End Function + + + + ' To customize, override this method in PersonalDDTableControlRow. + 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) + PersonalDDTable.DeleteRecord(pkValue) + + DirectCast(GetParentControlObject(Me, "PersonalDDTableControl"), PersonalDDTableControl).DataChanged = True + DirectCast(GetParentControlObject(Me, "PersonalDDTableControl"), PersonalDDTableControl).ResetData = True + End Sub + + Protected Overridable Sub Control_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.PreRender + ' PreRender event is raised just before page is being displayed. + Try + DbUtils.StartTransaction() + Me.RegisterPostback() + + If Not Me.Page.ErrorOnPage AndAlso (Me.Page.IsPageRefresh OrElse Me.DataChanged OrElse Me.ResetData) Then + + + ' Re-load the data and update the web page if necessary. + ' This is typically done during a postback (filter, search button, sort, pagination button). + ' In each of the other click handlers, simply set DataChanged to True to reload the data. + Me.LoadData() + Me.DataBind() + End If + + + Catch ex As Exception + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + Finally + DbUtils.EndTransaction() + End Try + End Sub + + + Protected Overrides Sub SaveControlsToSession() + MyBase.SaveControlsToSession() + + + 'Save pagination state to session. + + End Sub + + + + Protected Overrides Sub ClearControlsFromSession() + MyBase.ClearControlsFromSession() + + + + ' Clear pagination state from session. + + End Sub + + Protected Overrides Sub LoadViewState(ByVal savedState As Object) + MyBase.LoadViewState(savedState) + Dim isNewRecord As String = CType(ViewState("IsNewRecord"), String) + If Not isNewRecord Is Nothing AndAlso isNewRecord.Trim <> "" Then + Me.IsNewRecord = Boolean.Parse(isNewRecord) + End If + + Dim myCheckSum As String = CType(ViewState("CheckSum"), String) + If Not myCheckSum Is Nothing AndAlso myCheckSum.Trim <> "" Then + Me.CheckSum = myCheckSum + End If + + + ' Load view state for pagination control. + + End Sub + + Protected Overrides Function SaveViewState() As Object + ViewState("IsNewRecord") = Me.IsNewRecord.ToString() + ViewState("CheckSum") = Me.CheckSum + + + ' Load view state for pagination control. + + Return MyBase.SaveViewState() + End Function + + + + Public Overridable Function CreateWhereClause_PersonalIdDropDownList() 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 PersonalId table. + ' Examples: + ' wc.iAND(PersonalIdTable.PersonalName, BaseFilter.ComparisonOperator.EqualsTo, "XYZ") + ' wc.iAND(PersonalIdTable.Active, BaseFilter.ComparisonOperator.EqualsTo, "1") + + Dim wc As WhereClause = New WhereClause() + Return wc + + End Function + + + ' Fill the PersonalId list. + Protected Overridable Sub PopulatePersonalIdDropDownList( _ + ByVal selectedValue As String, _ + ByVal maxItems As Integer) + + Me.PersonalId.Items.Clear() + + + ' 1. Setup the static list items + + ' Add the Please Select item. + Me.PersonalId.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_PersonalIdDropDownList function. + ' It is better to customize the where clause there. + + Dim wc As WhereClause = CreateWhereClause_PersonalIdDropDownList() + ' Create the ORDER BY clause to sort based on the displayed value. + + + Dim orderBy As OrderBy = New OrderBy(false, false) + orderBy.Add(PersonalIdTable.PersonalName, OrderByItem.OrderDir.Asc) + + Dim variables As System.Collections.Generic.IDictionary(Of String, Object) = New System.Collections.Generic.Dictionary(Of String, Object) + + ' 3. Read a total of maxItems from the database and insert them + Dim itemValues() As PersonalIdRecord = 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 = PersonalIdTable.GetRecords(wc, orderBy, pageNum, maxItems) + For each itemValue As PersonalIdRecord In itemValues + ' Create the item and add to the list. + Dim cvalue As String = Nothing + Dim fvalue As String = Nothing + If itemValue.PersonalIdSpecified Then + cvalue = itemValue.PersonalId.ToString() + + If counter < maxItems AndAlso Me.PersonalId.Items.FindByValue(cvalue) Is Nothing Then + + Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalDDTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalDDTable.PersonalId) + If _isExpandableNonCompositeForeignKey AndAlso PersonalDDTable.PersonalId.IsApplyDisplayAs Then + fvalue = PersonalDDTable.GetDFKA(itemValue, PersonalDDTable.PersonalId) + End If + If (Not _isExpandableNonCompositeForeignKey) Or (String.IsNullOrEmpty(fvalue)) Then + fvalue = itemValue.Format(PersonalIdTable.PersonalName) + End If + + If fvalue Is Nothing OrElse fvalue.Trim() = "" Then fvalue = cvalue + + If (IsNothing(fvalue)) Then + fvalue = "" + End If + + fvalue = fvalue.Trim() + + If ( fvalue.Length > 50 ) Then + fvalue = fvalue.Substring(0, 50) & "..." + End If + + Dim dupItem As ListItem = Me.PersonalId.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.PersonalId.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.PersonalId, selectedValue) AndAlso _ + Not SetSelectedDisplayText(Me.PersonalId, selectedValue)Then + + ' construct a whereclause to query a record with PersonalId.PersonalId = selectedValue + Dim filter2 As CompoundFilter = New CompoundFilter(CompoundFilter.CompoundingOperators.And_Operator, Nothing) + Dim whereClause2 As WhereClause = New WhereClause() + filter2.AddFilter(New BaseClasses.Data.ColumnValueFilter(PersonalIdTable.PersonalId, selectedValue, BaseClasses.Data.BaseFilter.ComparisonOperator.EqualsTo, False)) + whereClause2.AddFilter(filter2, CompoundFilter.CompoundingOperators.And_Operator) + + Try + ' Execute the query + Dim rc() As PersonalIdRecord = PersonalIdTable.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 PersonalIdRecord = DirectCast(rc(0), PersonalIdRecord) + ' Create the item and add to the list. + Dim cvalue As String = Nothing + Dim fvalue As String = Nothing + If itemValue.PersonalIdSpecified Then + cvalue = itemValue.PersonalId.ToString() + Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalDDTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalDDTable.PersonalId) + If _isExpandableNonCompositeForeignKey AndAlso PersonalDDTable.PersonalId.IsApplyDisplayAs Then + fvalue = PersonalDDTable.GetDFKA(itemValue, PersonalDDTable.PersonalId) + End If + If (Not _isExpandableNonCompositeForeignKey) Or (String.IsNullOrEmpty(fvalue)) Then + fvalue = itemValue.Format(PersonalIdTable.PersonalName) + End If + + If fvalue Is Nothing OrElse fvalue.Trim() = "" Then fvalue = cvalue + Dim newItem As New ListItem(fvalue, cvalue) + Me.PersonalId.Items.Add(newItem) + SetSelectedValue(Me.PersonalId, selectedValue) + End If + End If + Catch + End Try + + End If + + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalDDRowDeleteButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + If(Not Me.Page.IsPageRefresh) Then + + Dim tc As PersonalDDTableControl = DirectCast(GetParentControlObject(Me, "PersonalDDTableControl"), PersonalDDTableControl) + If Not (IsNothing(tc)) Then + If Not Me.IsNewRecord Then + tc.AddToDeletedRecordIds(DirectCast(Me, PersonalDDTableControlRow)) + End If + Me.Visible = False + tc.SetFormulaControls() + End If + + End If + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + Protected Overridable Sub PersonalId_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()(PersonalId.ClientID & "_SelectedValue"), String) + Dim displayText As String = CType(Me.Page.Session()(PersonalId.ClientID & "_SelectedDisplayText"), String) + If displayText <> "" AndAlso val <> "" Then + Me.PersonalId.Items.Add(New ListItem(displayText, val)) + Me.PersonalId.SelectedIndex = Me.PersonalId.Items.Count - 1 + Me.Page.Session.Remove(PersonalId.ClientID & "_SelectedValue") + Me.Page.Session.Remove(PersonalId.ClientID & "_SelectedDisplayText") + End If + + + + + End Sub + + Protected Overridable Sub EndDate_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub Mission_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 StartDate_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("BasePersonalDDTableControlRow_Rec"), String) + End Get + Set(ByVal value As String) + Me.ViewState("BasePersonalDDTableControlRow_Rec") = value + End Set + End Property + + Private _DataSource As PersonalDDRecord + Public Property DataSource() As PersonalDDRecord + Get + Return Me._DataSource + End Get + + Set(ByVal value As PersonalDDRecord) + + Me._DataSource = value + End Set + End Property + + + + Private _checkSum As String + Public Overridable Property CheckSum() As String + Get + Return Me._checkSum + End Get + Set(ByVal value As String) + Me._checkSum = value + End Set + End Property + + Private _TotalPages As Integer + Public Property TotalPages() As Integer + Get + Return Me._TotalPages + End Get + Set(ByVal value As Integer) + Me._TotalPages = value + End Set + End Property + + Private _PageIndex As Integer + Public Property PageIndex() As Integer + Get + ' Return the PageIndex + Return Me._PageIndex + End Get + Set(ByVal value As Integer) + Me._PageIndex = value + End Set + End Property + + Private _DisplayLastPage As Boolean + Public Property DisplayLastPage() As Boolean + Get + Return Me._DisplayLastPage + End Get + Set(ByVal value As Boolean) + Me._DisplayLastPage = value + End Set + End Property + + + +#Region "Helper Properties" + + Public ReadOnly Property EndDate() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "EndDate"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property Mission() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Mission"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property PersonalDDRecordRowSelection() As System.Web.UI.WebControls.CheckBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalDDRecordRowSelection"), System.Web.UI.WebControls.CheckBox) + End Get + End Property + + Public ReadOnly Property PersonalDDRowDeleteButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalDDRowDeleteButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalId() As System.Web.UI.WebControls.DropDownList + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalId"), System.Web.UI.WebControls.DropDownList) + 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 StartDate() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "StartDate"), System.Web.UI.WebControls.TextBox) + 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 PersonalDDRecord = 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 PersonalDDRecord + If Not Me.DataSource Is Nothing Then + Return Me.DataSource + End If + + If Not Me.RecordUniqueId Is Nothing Then + + Return PersonalDDTable.GetRecord(Me.RecordUniqueId, True) + + End If + + ' Localization. + + Throw New Exception(Page.GetResourceValue("Err:RetrieveRec", "Persons")) + + End Function + + Public Shadows ReadOnly Property Page() As BaseApplicationPage + Get + Return DirectCast(MyBase.Page, BaseApplicationPage) + End Get + End Property + +#End Region + +End Class + + + +' Base class for the PersonalDDTableControl control on the EditPersonalDDTable page. +' Do not modify this class. Instead override any method in PersonalDDTableControl. +Public Class BasePersonalDDTableControl + Inherits Persons.UI.BaseApplicationTableControl + + + + Protected Overridable Sub Control_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Init + + + + ' Setup the filter and search events. + + + + ' Control Initializations. + ' Initialize the table's current sort order. + + If Me.InSession(Me, "Order_By") Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + Me.CurrentSortOrder.Add(PersonalDDTable.StartDate, OrderByItem.OrderDir.Asc) + + End If + + + + ' Setup default pagination settings. + + Me.PageSize = CInt(Me.GetFromSession(Me, "Page_Size", "10")) + Me.PageIndex = CInt(Me.GetFromSession(Me, "Page_Index", "0")) + + + + Me.ClearControlsFromSession() + End Sub + + Protected Overridable Sub Control_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load + + SaveControlsToSession_Ajax() + + ' Show confirmation message on Click + Me.PersonalDDDeleteButton.Attributes.Add("onClick", "return (confirm('" & (CType(Me.Page,BaseApplicationPage)).GetResourceValue("DeleteConfirm", "Persons") & "'));") + + ' Setup the pagination events. + + AddHandler Me.PersonalDDPagination.FirstPage.Click, AddressOf PersonalDDPagination_FirstPage_Click + + AddHandler Me.PersonalDDPagination.LastPage.Click, AddressOf PersonalDDPagination_LastPage_Click + + AddHandler Me.PersonalDDPagination.NextPage.Click, AddressOf PersonalDDPagination_NextPage_Click + + AddHandler Me.PersonalDDPagination.PageSizeButton.Click, AddressOf PersonalDDPagination_PageSizeButton_Click + + AddHandler Me.PersonalDDPagination.PreviousPage.Click, AddressOf PersonalDDPagination_PreviousPage_Click + + + ' Setup the sorting events. + + AddHandler Me.EndDateLabel.Click, AddressOf EndDateLabel_Click + + AddHandler Me.MissionLabel.Click, AddressOf MissionLabel_Click + + AddHandler Me.RefDateLabel.Click, AddressOf RefDateLabel_Click + + AddHandler Me.RefLabel.Click, AddressOf RefLabel_Click + + AddHandler Me.StartDateLabel1.Click, AddressOf StartDateLabel1_Click + + ' Setup the button events. + + AddHandler Me.PersonalDDAddButton.Click, AddressOf PersonalDDAddButton_Click + + AddHandler Me.PersonalDDDeleteButton.Click, AddressOf PersonalDDDeleteButton_Click + + AddHandler Me.PersonalDDEditButton.Click, AddressOf PersonalDDEditButton_Click + + AddHandler Me.PersonalDDRefreshButton.Click, AddressOf PersonalDDRefreshButton_Click + + AddHandler Me.PersonalDDResetButton.Click, AddressOf PersonalDDResetButton_Click + + AddHandler Me.PersonalDDSaveButton.Click, AddressOf PersonalDDSaveButton_Click + + Me.PersonalDDSaveButton.Attributes.Add("onclick", "SubmitHRefOnce(this, """ & Me.Page.GetResourceValue("Txt:SaveRecord", "Persons") & """);") + + + ' Setup events for others + + End Sub + + + Public Overridable Sub LoadData() + + ' Read data from database. Returns an array of records that can be assigned + ' to the DataSource table control property. + Try + Dim joinFilter As CompoundFilter = CreateCompoundJoinFilter() + + ' The WHERE clause will be empty when displaying all records in table. + Dim wc As WhereClause = CreateWhereClause() + If wc IsNot Nothing AndAlso Not wc.RunQuery Then + ' Initialize an empty array of records + Dim alist As New ArrayList(0) + Me.DataSource = DirectCast(alist.ToArray(GetType(PersonalDDRecord)), PersonalDDRecord()) + ' Add records to the list if needed. + Me.AddNewRecords() + Me._TotalRecords = 0 + Me._TotalPages = 0 + Return + End If + + ' Call OrderBy to determine the order - either use the order defined + ' on the Query Wizard, or specified by user (by clicking on column heading) + Dim orderBy As OrderBy = CreateOrderBy() + + ' Get the pagesize from the pagesize control. + Me.GetPageSize() + + If Me.DisplayLastPage Then + Dim totalRecords As Integer = If(Me._TotalRecords < 0, PersonalDDTable.GetRecordCount(CreateCompoundJoinFilter(), CreateWhereClause()), Me._TotalRecords) + + Dim totalPages As Integer = CInt(Math.Ceiling(totalRecords / Me.PageSize)) + + Me.PageIndex = totalPages - 1 + End If + + ' Make sure PageIndex (current page) and PageSize are within bounds. + If Me.PageIndex < 0 Then + Me.PageIndex = 0 + End If + If Me.PageSize < 1 Then + Me.PageSize = 1 + End If + + ' Retrieve the records and set the table DataSource. + ' Only PageSize records are fetched starting at PageIndex (zero based). + If Me.AddNewRecord > 0 Then + ' Make sure to preserve the previously entered data on new rows. + Dim postdata As New ArrayList + For Each rc As PersonalDDTableControlRow In Me.GetRecordControls() + If Not rc.IsNewRecord Then + rc.DataSource = rc.GetRecord() + rc.GetUIData() + postdata.Add(rc.DataSource) + UIData.Add(rc.PreservedUIData()) + End If + Next + Me.DataSource = DirectCast(postdata.ToArray(GetType(PersonalDDRecord)), PersonalDDRecord()) + Else ' Get the records from the database + Me.DataSource = PersonalDDTable.GetRecords(joinFilter, wc, orderBy, Me.PageIndex, Me.PageSize) + + End If + + ' if the datasource contains no records contained in database, then load the last page. + If (DbUtils.GetCreatedRecords(Me.DataSource).Length = 0 AndAlso Not Me.DisplayLastPage) Then + Me.DisplayLastPage = True + LoadData() + Else + + ' Add any new rows desired by the user. + Me.AddNewRecords() + + ' Turn off the ToggleAll checkbox + Me.PersonalDDToggleAll.Checked = False + + + ' Initialize the page and grand totals. now + + End If + + Catch ex As Exception + ' Report the error message to the end user + Dim msg As String = ex.Message + If ex.InnerException IsNot Nothing Then + msg = msg & " InnerException: " & ex.InnerException.Message + End If + Throw New Exception(msg, ex.InnerException) + End Try + End Sub + + + + + Public Overrides Sub DataBind() + ' The DataBind method binds the user interface controls to the values + ' from the database record for each row in the table. To do this, it calls the + ' DataBind for each of the rows. + ' DataBind also populates any filters above the table, and sets the pagination + ' control to the correct number of records and the current page number. + + MyBase.DataBind() + + ' Make sure that the DataSource is initialized. + If Me.DataSource Is Nothing Then + Return + End If + + 'LoadData for DataSource for chart and report if they exist + + ' Improve performance by prefetching display as records. + Me.PreFetchForeignKeyValues() + + ' Setup the pagination controls. + BindPaginationControls() + + + + ' Bind the repeater with the list of records to expand the UI. + Dim rep As System.Web.UI.WebControls.Repeater = CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalDDTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return + rep.DataSource = DataSource() + rep.DataBind() + + Dim index As Integer = 0 + For Each repItem As System.Web.UI.WebControls.RepeaterItem In rep.Items + ' Loop through all rows in the table, set its DataSource and call DataBind(). + Dim recControl As PersonalDDTableControlRow = DirectCast(repItem.FindControl("PersonalDDTableControlRow"), PersonalDDTableControlRow) + recControl.DataSource = Me.DataSource(index) + If Me.UIData.Count > index Then + recControl.PreviousUIData = Me.UIData(index) + End If + recControl.DataBind() + recControl.Visible = Not Me.InDeletedRecordIds(recControl) + + index += 1 + Next + + + + + ' Call the Set methods for each controls on the panel + + SetEndDateLabel() + SetMissionLabel() + + + + + + + + SetPersonalDDTableControlCollapsibleRegion() + SetPersonalDDTableControlIcon() + SetPersonalDDTableControlPanelExtender() + + + SetRefDateLabel() + SetRefLabel() + SetStartDateLabel1() + ' setting the state of expand or collapse alternative rows + + + ' Load data for each record and table UI control. + ' Ordering is important because child controls get + ' their parent ids from their parent UI controls. + + + ' this method calls the set method for controls with special formula like running total, sum, rank, etc + SetFormulaControls() + End Sub + + Public Overridable Sub SetFormulaControls() + ' this method calls Set methods for the control that has special formula + + + + End Sub + + + Public Sub PreFetchForeignKeyValues() + If (IsNothing(Me.DataSource)) + Return + End If + + Me.Page.PregetDfkaRecords(PersonalDDTable.PersonalId, Me.DataSource) + + End Sub + + + Public Overridable Sub RegisterPostback() + + Me.Page.RegisterPostBackTrigger(MiscUtils.FindControlRecursively(Me,"PersonalDDSaveButton")) + + + End Sub + + Public EvaluateFormulaDelegate As BaseClasses.Data.DataSource.EvaluateFormulaDelegate = New BaseClasses.Data.DataSource.EvaluateFormulaDelegate(AddressOf Me.EvaluateFormula) + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean, ByVal e as FormulaEvaluator) As String + If e Is Nothing + e = New FormulaEvaluator() + End If + + e.Variables.Clear() + + + ' add variables for formula evaluation + If variables IsNot Nothing Then + Dim enumerator As System.Collections.Generic.IEnumerator(Of System.Collections.Generic.KeyValuePair(Of String, Object)) = variables.GetEnumerator() + While enumerator.MoveNext() + e.Variables.Add(enumerator.Current.Key, enumerator.Current.Value) + End While + End If + + If includeDS + + End If + + ' All variables referred to in the formula are expected to be + ' properties of the DataSource. For example, referring to + ' UnitPrice as a variable will refer to DataSource.UnitPrice + e.DataSource = dataSourceForEvaluate + + ' Define the calling control. This is used to add other + ' related table and record controls as variables. + e.CallingControl = Me + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + + If Not String.IsNullOrEmpty(format) AndAlso (String.IsNullOrEmpty(formula) OrElse formula.IndexOf("Format(") < 0) Then + Return FormulaUtils.Format(resultObj, format) + Else + Return resultObj.ToString() + End If + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format,variables ,includeDS, Nothing) + End Function + + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object)) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format, variables ,True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, format, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal e as FormulaEvaluator) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, variables, True, e) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal includeDS as Boolean) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, includeDS, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, True, Nothing) + End Function + + + + + Public Overridable Sub ResetControl() + + Me.CurrentSortOrder.Reset() + If (Me.InSession(Me, "Order_By")) Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + Me.CurrentSortOrder.Add(PersonalDDTable.StartDate, OrderByItem.OrderDir.Asc) + + End If + + Me.PageIndex = 0 + End Sub + + Protected Overridable Sub BindPaginationControls() + ' Setup the pagination controls. + + ' Bind the pagination labels. + + If DbUtils.GetCreatedRecords(Me.DataSource).Length > 0 Then + + Me.PersonalDDPagination.CurrentPage.Text = (Me.PageIndex + 1).ToString() + Else + Me.PersonalDDPagination.CurrentPage.Text = "0" + End If + Me.PersonalDDPagination.PageSize.Text = Me.PageSize.ToString() + Me.PersonalDDPagination.TotalItems.Text = Me.TotalRecords.ToString() + Me.PersonalDDPagination.TotalPages.Text = Me.TotalPages.ToString() + + ' Bind the buttons for PersonalDDTableControl pagination. + + Me.PersonalDDPagination.FirstPage.Enabled = Not (Me.PageIndex = 0) + If Me._TotalPages < 0 Then ' if the total pages is not determined yet, enable last and next buttons + Me.PersonalDDPagination.LastPage.Enabled = True + ElseIf Me._TotalPages = 0 ' if the total pages is determined and it is 0, enable last and next buttons + Me.PersonalDDPagination.LastPage.Enabled = False + Else ' if the total pages is the last page, disable last and next buttons + Me.PersonalDDPagination.LastPage.Enabled = Not (Me.PageIndex = Me.TotalPages - 1) + End If + + If Me._TotalPages < 0 Then ' if the total pages is not determined yet, enable last and next buttons + Me.PersonalDDPagination.NextPage.Enabled = True + ElseIf Me._TotalPages = 0 ' if the total pages is determined and it is 0, enable last and next buttons + Me.PersonalDDPagination.NextPage.Enabled = False + Else ' if the total pages is the last page, disable last and next buttons + Me.PersonalDDPagination.NextPage.Enabled = Not (Me.PageIndex = Me.TotalPages - 1) + End If + + Me.PersonalDDPagination.PreviousPage.Enabled = Not (Me.PageIndex = 0) + + + End Sub + + Public Overridable Sub SaveData() + ' Save the data from the entire table. Calls each row's Save Data + ' to save their data. This function is called by the Click handler of the + ' Save button. The button handler should Start/Commit/End a transaction. + + Dim recCtl As PersonalDDTableControlRow + For Each recCtl In Me.GetRecordControls() + + If Me.InDeletedRecordIds(recCtl) Then + ' Delete any pending deletes. + recCtl.Delete() + Else + If recCtl.Visible Then + recCtl.SaveData() + End If + End If + + Next + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + ' Set IsNewRecord to False for all records - since everything has been saved and is no longer "new" + For Each recCtl In Me.GetRecordControls() + recCtl.IsNewRecord = False + Next + + + ' Set DeletedRecordsIds to Nothing since we have deleted all pending deletes. + Me.DeletedRecordIds = Nothing + + End Sub + + Public Overridable Function CreateCompoundJoinFilter() As CompoundFilter + Dim jFilter As CompoundFilter = New CompoundFilter() + + Return jFilter + + End Function + + + Public Overridable Function CreateOrderBy() As OrderBy + ' The CurrentSortOrder is initialized to the sort order on the + ' Query Wizard. It may be modified by the Click handler for any of + ' the column heading to sort or reverse sort by that column. + ' You can add your own sort order, or modify it on the Query Wizard. + Return Me.CurrentSortOrder + End Function + + Public Overridable Function CreateWhereClause() As WhereClause + 'This CreateWhereClause is used for loading the data. + PersonalDDTable.Instance.InnerFilter = Nothing + Dim wc As WhereClause = New WhereClause() + + ' Compose the WHERE clause consiting of: + ' 1. Static clause defined at design time. + ' 2. User selected search criteria. + ' 3. User selected filter criteria. + + + ' Get the static clause defined at design time on the Table Panel Wizard + Dim qc As WhereClause = Me.CreateQueryClause() + If Not(IsNothing(qc)) Then + wc.iAND(qc) + End If + + Return wc + End Function + + + Public Overridable Function CreateWhereClause(ByVal searchText as String, ByVal fromSearchControl as String, ByVal AutoTypeAheadSearch as String, ByVal AutoTypeAheadWordSeparators as String) As WhereClause + ' This CreateWhereClause is used for loading list of suggestions for Auto Type-Ahead feature. + PersonalDDTable.Instance.InnerFilter = Nothing + Dim wc As WhereClause = New WhereClause() + + ' Compose the WHERE clause consiting of: + ' 1. Static clause defined at design time. + ' 2. User selected search criteria. + ' 3. User selected filter criteria. + + Dim appRelativeVirtualPath As String = CType(HttpContext.Current.Session("AppRelativeVirtualPath"), String) + + ' Get the static clause defined at design time on the Table Panel Wizard + Dim qc As WhereClause = Me.CreateQueryClause() + If Not(IsNothing(qc)) Then + wc.iAND(qc) + End If + + ' Adds clauses if values are selected in Filter controls which are configured in the page. + + + Return wc + End Function + + Protected Overridable Function CreateQueryClause() As WhereClause + ' Create a where clause for the Static clause defined at design time. + Dim filter As CompoundFilter = New CompoundFilter(CompoundFilter.CompoundingOperators.And_Operator, Nothing) + Dim whereClause As WhereClause = New WhereClause() + + filter.AddFilter(New BaseClasses.Data.SignedInUserFilter(BaseClasses.Data.BaseTable.CreateInstance("Persons.Business.PersonalDDTable, App_Code").TableDefinition.ColumnList.GetByUniqueName("PersonalDD_.PersonalId"), New BaseClasses.Data.IdentifierAliasInfo("PersonalDD_", Nothing), BaseClasses.Data.BaseFilter.ComparisonOperator.EqualsTo, False)) + + whereClause.AddFilter(filter, CompoundFilter.CompoundingOperators.And_Operator) + + Return whereClause + + End Function + + + Public Overridable Function FormatSuggestions(ByVal prefixText As String, ByVal resultItem As String, _ + ByVal columnLength As Integer, ByVal AutoTypeAheadDisplayFoundText As String, _ + ByVal autoTypeAheadSearch As String, ByVal AutoTypeAheadWordSeparators As String, _ + ByVal resultList As ArrayList) As Boolean + + 'Formats the resultItem and adds it to the list of suggestions. + Dim index As Integer = resultItem.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture).IndexOf(prefixText.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture)) + Dim itemToAdd As String = "" + Dim isFound As Boolean = False + Dim isAdded As Boolean = False + ' Get the index where prfixt is at the beginning of resultItem. If not found then, index of word which begins with prefixText. + If InvariantLCase(autoTypeAheadSearch).equals("wordsstartingwithsearchstring") And Not index = 0 Then + ' Expression to find word which contains AutoTypeAheadWordSeparators followed by prefixText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex( AutoTypeAheadWordSeparators + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + If regex1.IsMatch(resultItem) Then + index = regex1.Match(resultItem).Index + isFound = True + End If + ' If the prefixText is found immediatly after white space then starting of the word is found so don not search any further + If not resultItem(index).ToString() = " " Then + ' Expression to find beginning of the word which contains AutoTypeAheadWordSeparators followed by prefixText + Dim regex As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\\S*" + AutoTypeAheadWordSeparators + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + If regex.IsMatch(resultItem) Then + index = regex.Match(resultItem).Index + isFound = True + End If + End If + End If + + ' If autoTypeAheadSearch value is wordsstartingwithsearchstring then, extract the substring only if the prefixText is found at the + ' beginning of the resultItem (index = 0) or a word in resultItem is found starts with prefixText. + If index = 0 Or isFound Or InvariantLCase(autoTypeAheadSearch).Equals("anywhereinstring") then + If InvariantLCase(AutoTypeAheadDisplayFoundText).equals("atbeginningofmatchedstring") Then + ' Expression to find beginning of the word which contains prefixText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\\S*" + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + ' Find the beginning of the word which contains prefexText + If (StringUtils.InvariantLCase(autoTypeAheadSearch).Equals("anywhereinstring") AndAlso regex1.IsMatch(resultItem)) Then + index = regex1.Match(resultItem).Index + isFound = True + End If + ' Display string from the index till end of the string if sub string from index till end is less than columnLength value. + If Len(resultItem) - index <= columnLength Then + If index = 0 Then + itemToAdd = resultItem + Else + itemToAdd = "..." & resultItem.Substring(index, Len(resultItem) - index) + End If + Else + If index = 0 Then + itemToAdd = resultItem.Substring(index, (columnLength - 3)) & "..." + Else + 'Truncate the string to show only columnLength - 6 characters as begining and trailing "..." has to be appended. + itemToAdd = "..." & resultItem.Substring(index , columnLength - 6) & "..." + End If + End If + ElseIf InvariantLCase(AutoTypeAheadDisplayFoundText).equals("inmiddleofmatchedstring") Then + Dim subStringBeginIndex As Integer = CType(columnLength/2, Integer) + If Len(resultItem) <= columnLength Then + itemToAdd = resultItem + Else + ' Sanity check at end of the string + If index + Len(prefixText) = columnLength Then + itemToAdd = "..." & resultItem.Substring(index-columnLength,index) + ElseIf Len(resultItem) - index < subStringBeginIndex Then + ' Display string from the end till columnLength value if, index is closer to the end of the string. + itemToAdd = "..." & resultItem.Substring(Len(resultItem)-columnLength,Len(resultItem)) + ElseIf index <= subStringBeginIndex Then + ' Sanity chet at beginning of the string + itemToAdd = resultItem.Substring(0, columnLength) & "..." + Else + ' Display string containing text before the prefixText occures and text after the prefixText + itemToAdd = "..." & resultItem.Substring(index - subStringBeginIndex, columnLength) & "..." + End If + End If + ElseIf InvariantLCase(AutoTypeAheadDisplayFoundText).equals("atendofmatchedstring") Then + ' Expression to find ending of the word which contains prefexText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\s", System.Text.RegularExpressions.RegexOptions.IgnoreCase) + ' Find the ending of the word which contains prefexText + If regex1.IsMatch(resultItem, index + 1) Then + index = regex1.Match(resultItem, index + 1).Index + Else + ' If the word which contains prefexText is the last word in string, regex1.IsMatch returns false. + index = resultItem.Length + End If + If index > Len(resultItem) Then + index = Len(resultItem) + End If + ' If text from beginning of the string till index is less than columnLength value then, display string from the beginning till index. + If index <= columnLength Then + if index = Len(resultItem) Then 'Make decision to append "..." + itemToAdd = resultItem.Substring(0,index) + Else + itemToAdd = resultItem.Substring(0,index) & "..." + End If + Else + If index = Len(resultItem) Then + itemToAdd = "..." & resultItem.Substring(index - (columnLength - 3), (columnLength - 3)) + Else + 'Truncate the string to show only columnLength - 6 characters as begining and trailing "..." has to be appended. + itemToAdd = "..." & resultItem.Substring(index - (columnLength - 6), columnLength - 6) & "..." + End If + End If + End If + + ' Remove newline character from itemToAdd + Dim prefixTextIndex As Integer = itemToAdd.IndexOf(prefixText, StringComparison.CurrentCultureIgnoreCase) + ' If itemToAdd contains any newline after the search text then show text only till newline + Dim regex2 As System.Text.RegularExpressions.Regex = New System.Text.RegularExpressions.Regex("(" & vbCrLf & "|" & vbLf & ")", System.Text.RegularExpressions.RegexOptions.IgnoreCase) + Dim newLineIndexAfterPrefix As Integer = -1 + If regex2.IsMatch(itemToAdd, prefixTextIndex) Then + newLineIndexAfterPrefix = regex2.Match(itemToAdd, prefixTextIndex).Index + End If + If (newLineIndexAfterPrefix > -1) Then + If itemToAdd.EndsWith("...") Then + itemToAdd = (itemToAdd.Substring(0, newLineIndexAfterPrefix) + "...") + Else + itemToAdd = itemToAdd.Substring(0, newLineIndexAfterPrefix) + End If + End If + ' If itemToAdd contains any newline before search text then show text which comes after newline + Dim regex3 As System.Text.RegularExpressions.Regex = New System.Text.RegularExpressions.Regex("(" & vbCrLf & "|" & vbLf & ")", (System.Text.RegularExpressions.RegexOptions.IgnoreCase Or System.Text.RegularExpressions.RegexOptions.RightToLeft)) + Dim newLineIndexBeforePrefix As Integer = -1 + If regex3.IsMatch(itemToAdd, prefixTextIndex) Then + newLineIndexBeforePrefix = regex3.Match(itemToAdd, prefixTextIndex).Index + End If + If (newLineIndexBeforePrefix > -1) Then + If itemToAdd.StartsWith("...") Then + itemToAdd = ("..." + itemToAdd.Substring((newLineIndexBeforePrefix + regex3.Match(itemToAdd, prefixTextIndex).Length))) + Else + itemToAdd = itemToAdd.Substring((newLineIndexBeforePrefix + regex3.Match(itemToAdd, prefixTextIndex).Length)) + End If + End If + + If Not itemToAdd is nothing AndAlso Not resultList.Contains(itemToAdd) Then + + resultList.Add(itemToAdd) + + isAdded = true + End If + End If + Return isAdded + End Function + + + Protected Overridable Sub GetPageSize() + + If Me.PersonalDDPagination.PageSize.Text.Trim <> "" Then + Try + 'Me.PageSize = Integer.Parse(Me.PersonalDDPagination.PageSize.Text) + Catch ex As Exception + End Try + End If + End Sub + + Protected Overridable Sub AddNewRecords() + + Dim newRecordList As ArrayList = New ArrayList() + + Dim newUIDataList As System.Collections.Generic.List(Of Hashtable) = New System.Collections.Generic.List(Of Hashtable)() + + ' Loop though all the record controls and if the record control + ' does not have a unique record id set, then create a record + ' and add to the list. + If Not Me.ResetData Then + Dim rep As System.Web.UI.WebControls.Repeater = CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalDDTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return + + Dim repItem As System.Web.UI.WebControls.RepeaterItem + For Each repItem In rep.Items + ' Loop through all rows in the table, set its DataSource and call DataBind(). + + Dim recControl As PersonalDDTableControlRow = DirectCast(repItem.FindControl("PersonalDDTableControlRow"), PersonalDDTableControlRow) + + If recControl.Visible AndAlso recControl.IsNewRecord() Then + + Dim rec As PersonalDDRecord = New PersonalDDRecord() + + If recControl.EndDate.Text <> "" Then + rec.Parse(recControl.EndDate.Text, PersonalDDTable.EndDate) + End If + If recControl.Mission.Text <> "" Then + rec.Parse(recControl.Mission.Text, PersonalDDTable.Mission) + End If + If MiscUtils.IsValueSelected(recControl.PersonalId) Then + rec.Parse(recControl.PersonalId.SelectedItem.Value, PersonalDDTable.PersonalId) + End If + If recControl.Ref1.Text <> "" Then + rec.Parse(recControl.Ref1.Text, PersonalDDTable.Ref0) + End If + If recControl.RefDate.Text <> "" Then + rec.Parse(recControl.RefDate.Text, PersonalDDTable.RefDate) + End If + If recControl.StartDate.Text <> "" Then + rec.Parse(recControl.StartDate.Text, PersonalDDTable.StartDate) + End If + newUIDataList.Add(recControl.PreservedUIData()) + newRecordList.Add(rec) + End If + Next + End If + + + ' Add any new record to the list. + Dim index As Integer = 0 + For index = 1 To Me.AddNewRecord + + newRecordList.Insert(0, New PersonalDDRecord()) + newUIDataList.Insert(0, New Hashtable()) + + Next + Me.AddNewRecord = 0 + + ' Finally, add any new records to the DataSource. + If newRecordList.Count > 0 Then + + Dim finalList As ArrayList = New ArrayList(Me.DataSource) + finalList.InsertRange(0, newRecordList) + + Me.DataSource = DirectCast(finalList.ToArray(GetType(PersonalDDRecord)), PersonalDDRecord()) + + End If + + ' Add the existing UI data to this hash table + If newUIDataList.Count > 0 Then + Me.UIData.InsertRange(0, newUIDataList) + End If + + End Sub + + + Public Sub AddToDeletedRecordIds(ByVal rec As PersonalDDTableControlRow) + If rec.IsNewRecord() Then + Return + End If + + If Not Me.DeletedRecordIds Is Nothing AndAlso Me.DeletedRecordIds.Trim <> "" Then + Me.DeletedRecordIds &= "," + End If + + Me.DeletedRecordIds &= "[" & rec.RecordUniqueId & "]" + End Sub + + Protected Overridable Function InDeletedRecordIds(ByVal rec As PersonalDDTableControlRow) As Boolean + If Me.DeletedRecordIds Is Nothing OrElse Me.DeletedRecordIds.Trim = "" Then + Return False + End If + + Return Me.DeletedRecordIds.IndexOf("[" & rec.RecordUniqueId & "]") >= 0 + End Function + + Private _DeletedRecordIds As String + Public Property DeletedRecordIds() As String + Get + Return Me._DeletedRecordIds + End Get + Set(ByVal value As String) + Me._DeletedRecordIds = value + End Set + End Property + + + ' Create Set, WhereClause, and Populate Methods + + Public Overridable Sub SetEndDateLabel() + + End Sub + + Public Overridable Sub SetMissionLabel() + + End Sub + + Public Overridable Sub SetPersonalDDTableControlCollapsibleRegion() + + End Sub + + Public Overridable Sub SetPersonalDDTableControlIcon() + + End Sub + + Public Overridable Sub SetPersonalDDTableControlPanelExtender() + + End Sub + + Public Overridable Sub SetRefDateLabel() + + End Sub + + Public Overridable Sub SetRefLabel() + + End Sub + + Public Overridable Sub SetStartDateLabel1() + + 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. + Dim added As Boolean = Me.AddNewRecord > 0 + Me.LoadData() + Me.DataBind() + + If added Then + Me.SetFocusToAddedRow() + End If + + End If + + + + Catch ex As Exception + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + Finally + DbUtils.EndTransaction + End Try + End Sub + + 'this function sets focus to the first editable element in the new added row in the editable table + Protected Overridable Sub SetFocusToAddedRow() + Dim rep As System.Web.UI.WebControls.Repeater = CType(Me.FindControl("PersonalDDTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing OrElse rep.Items.Count = 0 Then Return + Dim repItem As System.Web.UI.WebControls.RepeaterItem + For Each repItem In rep.Items + 'Load scripts to table rows + Me.Page.LoadFocusScripts(repItem) + Dim recControl As PersonalDDTableControlRow = DirectCast(repItem.FindControl("PersonalDDTableControlRow"), PersonalDDTableControlRow) + If recControl.IsNewRecord Then + For Each field As Control In recControl.Controls + If field.Visible AndAlso Me.Page.IsControlEditable(field, False) Then + 'set focus on the first editable field in the new row + field.Focus() + Dim updPan As UpdatePanel = DirectCast(Me.Page.FindControlRecursively("UpdatePanel1"), UpdatePanel) + If Not updPan Is Nothing Then updPan.Update() + Return + End If + Next + Return + End If + Next + End Sub + + + Protected Overrides Sub SaveControlsToSession() + MyBase.SaveControlsToSession() + + ' Save filter controls to values to session. + + + 'Save pagination state to session. + + + + ' Save table control properties to the session. + If Not Me.CurrentSortOrder Is Nothing Then + Me.SaveToSession(Me, "Order_By", Me.CurrentSortOrder.ToXmlString()) + End If + + Me.SaveToSession(Me, "Page_Index", Me.PageIndex.ToString()) + Me.SaveToSession(Me, "Page_Size", Me.PageSize.ToString()) + + Me.SaveToSession(Me, "DeletedRecordIds", Me.DeletedRecordIds) + + End Sub + + Protected Sub SaveControlsToSession_Ajax() + ' Save filter controls to values to session. + + HttpContext.Current.Session("AppRelativeVirtualPath") = Me.Page.AppRelativeVirtualPath + + End Sub + + Protected Overrides Sub ClearControlsFromSession() + MyBase.ClearControlsFromSession() + + ' Clear filter controls values from the session. + + + ' Clear pagination state from session. + + + + ' Clear table properties from the session. + Me.RemoveFromSession(Me, "Order_By") + Me.RemoveFromSession(Me, "Page_Index") + Me.RemoveFromSession(Me, "Page_Size") + + Me.RemoveFromSession(Me, "DeletedRecordIds") + + End Sub + + Protected Overrides Sub LoadViewState(ByVal savedState As Object) + MyBase.LoadViewState(savedState) + + Dim orderByStr As String = CType(ViewState("PersonalDDTableControl_OrderBy"), String) + + If orderByStr IsNot Nothing AndAlso orderByStr.Trim <> "" Then + Me.CurrentSortOrder = BaseClasses.Data.OrderBy.FromXmlString(orderByStr) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + End If + + Dim pageIndex As String = CType(ViewState("Page_Index"), String) + If pageIndex IsNot Nothing Then + Me.PageIndex = CInt(pageIndex) + End If + + Dim pageSize As String = CType(ViewState("Page_Size"), String) + If Not pageSize Is Nothing Then + Me.PageSize = CInt(pageSize) + End If + + + + ' Load view state for pagination control. + + Me.DeletedRecordIds = CType(Me.ViewState("DeletedRecordIds"), String) + + End Sub + + Protected Overrides Function SaveViewState() As Object + + If Me.CurrentSortOrder IsNot Nothing Then + Me.ViewState("PersonalDDTableControl_OrderBy") = Me.CurrentSortOrder.ToXmlString() + End If + + Me.ViewState("Page_Index") = Me.PageIndex + Me.ViewState("Page_Size") = Me.PageSize + + Me.ViewState("DeletedRecordIds") = Me.DeletedRecordIds + + + ' Load view state for pagination control. + + + Return MyBase.SaveViewState() + End Function + + ' Generate the event handling functions for pagination events. + + ' event handler for ImageButton + Public Overridable Sub PersonalDDPagination_FirstPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.PageIndex = 0 + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalDDPagination_LastPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.DisplayLastPage = True + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalDDPagination_NextPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.PageIndex += 1 + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for LinkButton + Public Overridable Sub PersonalDDPagination_PageSizeButton_Click(ByVal sender As Object, ByVal args As EventArgs) + + Try + + Me.DataChanged = True + + Me.PageSize = Integer.Parse(Me.PersonalDDPagination.PageSize.Text) + + Me.PageIndex = Integer.Parse(Me.PersonalDDPagination.CurrentPage.Text) - 1 + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalDDPagination_PreviousPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + If Me.PageIndex > 0 Then + Me.PageIndex -= 1 + Me.DataChanged = True + End If + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + + ' Generate the event handling functions for sorting events. + + Public Overridable Sub EndDateLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by EndDate when clicked. + + ' Get previous sorting state for EndDate. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalDDTable.EndDate) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for EndDate. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalDDTable.EndDate, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by EndDate, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub MissionLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by Mission when clicked. + + ' Get previous sorting state for Mission. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalDDTable.Mission) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for Mission. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalDDTable.Mission, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by Mission, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub RefDateLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by RefDate when clicked. + + ' Get previous sorting state for RefDate. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalDDTable.RefDate) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for RefDate. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalDDTable.RefDate, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by RefDate, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub RefLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by Ref when clicked. + + ' Get previous sorting state for Ref. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalDDTable.Ref0) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for Ref. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalDDTable.Ref0, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by Ref, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub StartDateLabel1_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by StartDate when clicked. + + ' Get previous sorting state for StartDate. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalDDTable.StartDate) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for StartDate. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalDDTable.StartDate, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by StartDate, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + + ' Generate the event handling functions for button events. + + ' event handler for ImageButton + Public Overridable Sub PersonalDDAddButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + Me.AddNewRecord = 1 + Me.DataChanged = True + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalDDDeleteButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + If(Not Me.Page.IsPageRefresh) Then + + Me.DeleteSelectedRecords(True) + Me.SetFormulaControls() + + + End If + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalDDEditButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + ' The redirect URL is set on the Properties, Custom Properties or Actions. + ' The ModifyRedirectURL call resolves the parameters before the + ' Response.Redirect redirects the page to the URL. + ' Any code after the Response.Redirect call will not be executed, since the page is + ' redirected to the URL. + + + Dim url As String = "../Shared/ConfigureEditRecord.aspx" + + Dim shouldRedirect As Boolean = True + Dim TargetKey As String = Nothing + Dim DFKA As String = TargetKey + Dim id As String = DFKA + Dim value As String = id + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + url = Me.ModifyRedirectUrl(url, "",False) + url = Me.Page.ModifyRedirectUrl(url, "",False) + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + shouldRedirect = False + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + If shouldRedirect Then + Me.Page.ShouldSaveControlsToSession = True + Me.Page.Response.Redirect(url) + ElseIf Not TargetKey Is Nothing AndAlso _ + Not shouldRedirect Then + Me.Page.ShouldSaveControlsToSession = True + Me.Page.CloseWindow(True) + + End If + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalDDRefreshButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Dim PersonalDDTableControlObj as PersonalDDTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalDDTableControl"), PersonalDDTableControl) + PersonalDDTableControlObj.ResetData = True + + PersonalDDTableControlObj.RemoveFromSession(PersonalDDTableControlObj, "DeletedRecordIds") + PersonalDDTableControlObj.DeletedRecordIds = Nothing + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalDDResetButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.CurrentSortOrder.Reset() + If Me.InSession(Me, "Order_By") Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + Me.CurrentSortOrder.Add(PersonalDDTable.StartDate, OrderByItem.OrderDir.Asc) + + + End If + + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalDDSaveButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + + If (Not Me.Page.IsPageRefresh) Then + Me.SaveData() + End If + + Me.Page.CommitTransaction(sender) + ' Set IsNewRecord to False for all records - since everything has been saved and is no longer "new" + Dim recCtl As PersonalDDTableControlRow + For Each recCtl in Me.GetRecordControls() + + recCtl.IsNewRecord = False + Next + + + ' Set DeletedRecordsIds to Nothing since we have deleted all pending deletes. + + Me.DeletedRecordIds = Nothing + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + + + ' Generate the event handling functions for filter and search events. + + + ' Generate the event handling functions for others + + + Private _UIData As New System.Collections.Generic.List(Of Hashtable) + Public Property UIData() As System.Collections.Generic.List(Of Hashtable) + Get + Return Me._UIData + End Get + Set(ByVal value As System.Collections.Generic.List(Of Hashtable)) + Me._UIData = value + End Set + End Property + + ' pagination properties + Protected _PageSize As Integer + Public Property PageSize() As Integer + Get + Return Me._PageSize + End Get + Set(ByVal value As Integer) + Me._PageSize = value + End Set + End Property + + Protected _PageIndex As Integer + Public Property PageIndex() As Integer + Get + ' Return the PageIndex + Return Me._PageIndex + End Get + Set(ByVal value As Integer) + Me._PageIndex = value + End Set + End Property + + Protected _TotalRecords As Integer = -1 + Public Property TotalRecords() As Integer + Get + If _TotalRecords < 0 + _TotalRecords = PersonalDDTable.GetRecordCount(CreateCompoundJoinFilter(), CreateWhereClause()) + End If + Return Me._TotalRecords + End Get + Set(ByVal value As Integer) + If Me.PageSize > 0 Then + + Me.TotalPages = CInt(Math.Ceiling(value / Me.PageSize)) + + End If + Me._TotalRecords = value + End Set + End Property + + + + Protected _TotalPages As Integer = -1 + Public Property TotalPages() As Integer + Get + If _TotalPages < 0 Then + + Me.TotalPages = CInt(Math.Ceiling(TotalRecords / Me.PageSize)) + + End If + Return Me._TotalPages + End Get + Set(ByVal value As Integer) + Me._TotalPages = value + End Set + End Property + + Protected _DisplayLastPage As Boolean + Public Property DisplayLastPage() As Boolean + Get + Return Me._DisplayLastPage + End Get + Set(ByVal value As Boolean) + Me._DisplayLastPage = value + End Set + End Property + + Private _DataChanged As Boolean = False + Public Property DataChanged() As Boolean + Get + Return Me._DataChanged + End Get + Set(ByVal value As Boolean) + Me._DataChanged = value + End Set + End Property + + Private _ResetData As Boolean = False + Public Property ResetData() As Boolean + Get + Return Me._ResetData + End Get + Set(ByVal value As Boolean) + Me._ResetData = value + End Set + End Property + + Private _AddNewRecord As Integer = 0 + Public Property AddNewRecord() As Integer + Get + Return Me._AddNewRecord + End Get + Set(ByVal value As Integer) + Me._AddNewRecord = value + End Set + End Property + + + Private _CurrentSortOrder As OrderBy = Nothing + Public Property CurrentSortOrder() As OrderBy + Get + Return Me._CurrentSortOrder + End Get + Set(ByVal value As BaseClasses.Data.OrderBy) + Me._CurrentSortOrder = value + End Set + End Property + + Private _DataSource() As PersonalDDRecord = Nothing + Public Property DataSource() As PersonalDDRecord () + Get + Return Me._DataSource + End Get + Set(ByVal value() As PersonalDDRecord) + Me._DataSource = value + End Set + End Property + +#Region "Helper Properties" + + Public ReadOnly Property EndDateLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "EndDateLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property MissionLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "MissionLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property PersonalDDAddButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalDDAddButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalDDDeleteButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalDDDeleteButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalDDEditButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalDDEditButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalDDPagination() As Persons.UI.IPagination + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalDDPagination"), Persons.UI.IPagination) + End Get + End Property + + Public ReadOnly Property PersonalDDRefreshButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalDDRefreshButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalDDResetButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalDDResetButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalDDSaveButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalDDSaveButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalDDTableControlCollapsibleRegion() As System.Web.UI.WebControls.Panel + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalDDTableControlCollapsibleRegion"), System.Web.UI.WebControls.Panel) + End Get + End Property + + Public ReadOnly Property PersonalDDTableControlIcon() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalDDTableControlIcon"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalDDTableControlPanelExtender() As AjaxControlToolkit.CollapsiblePanelExtender + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalDDTableControlPanelExtender"), AjaxControlToolkit.CollapsiblePanelExtender) + End Get + End Property + + Public ReadOnly Property PersonalDDTitle() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalDDTitle"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property PersonalDDToggleAll() As System.Web.UI.WebControls.CheckBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalDDToggleAll"), System.Web.UI.WebControls.CheckBox) + End Get + End Property + + Public ReadOnly Property RefDateLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RefDateLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property RefLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RefLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property StartDateLabel1() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "StartDateLabel1"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + +#End Region + +#Region "Helper Functions" + + Public Overrides Overloads Function ModifyRedirectUrl(url As String, arg As String, ByVal bEncrypt As Boolean) As String + Return Me.Page.EvaluateExpressions(url, arg, bEncrypt, Me) + End Function + + Public Overrides Overloads Function EvaluateExpressions(url As String, arg As String, ByVal bEncrypt As Boolean) As String + Dim needToProcess As Boolean = AreAnyUrlParametersForMe(url, arg) + If (needToProcess) Then + Dim recCtl As PersonalDDTableControlRow = Me.GetSelectedRecordControl() + If recCtl Is Nothing AndAlso url.IndexOf("{") >= 0 Then + ' Localization. + Throw New Exception(Page.GetResourceValue("Err:NoRecSelected", "Persons")) + End If + Dim rec As PersonalDDRecord = Nothing + If recCtl IsNot Nothing Then + rec = recCtl.GetRecord() + End If + Return EvaluateExpressions(url, arg, rec, bEncrypt) + End If + Return url + End Function + + Public Overridable Function GetSelectedRecordIndex() As Integer + Dim counter As Integer = 0 + Dim recControl As PersonalDDTableControlRow + For Each recControl In Me.GetRecordControls() + If recControl.PersonalDDRecordRowSelection.Checked Then + Return counter + End If + counter += 1 + Next + Return -1 + End Function + + Public Overridable Function GetSelectedRecordControl() As PersonalDDTableControlRow + Dim selectedList() As PersonalDDTableControlRow = Me.GetSelectedRecordControls() + If selectedList.Length = 0 Then + Return Nothing + End If + Return selectedList(0) + + End Function + + Public Overridable Function GetSelectedRecordControls() As PersonalDDTableControlRow() + + Dim selectedList As ArrayList = New ArrayList(25) + Dim recControl As PersonalDDTableControlRow + For Each recControl In Me.GetRecordControls() + If recControl.PersonalDDRecordRowSelection IsNot Nothing AndAlso recControl.PersonalDDRecordRowSelection.Checked Then + selectedList.Add(recControl) + End If + Next + Return DirectCast(selectedList.ToArray(GetType(PersonalDDTableControlRow)), PersonalDDTableControlRow()) + + End Function + + Public Overridable Sub DeleteSelectedRecords(ByVal deferDeletion As Boolean) + Dim recList() As PersonalDDTableControlRow = Me.GetSelectedRecordControls() + If recList.Length = 0 Then + ' Localization. + Throw New Exception(Page.GetResourceValue("Err:NoRecSelected", "Persons")) + End If + + Dim recCtl As PersonalDDTableControlRow + For Each recCtl In recList + If deferDeletion Then + If Not recCtl.IsNewRecord Then + + Me.AddToDeletedRecordIds(recCtl) + + End If + recCtl.Visible = False + + recCtl.PersonalDDRecordRowSelection.Checked = False + + Else + + recCtl.Delete() + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + End If + Next + End Sub + + Public Function GetRecordControls() As PersonalDDTableControlRow() + Dim recList As ArrayList = New ArrayList() + Dim rep As System.Web.UI.WebControls.Repeater = CType(Me.FindControl("PersonalDDTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return Nothing + Dim repItem As System.Web.UI.WebControls.RepeaterItem + + For Each repItem In rep.Items + + Dim recControl As PersonalDDTableControlRow = DirectCast(repItem.FindControl("PersonalDDTableControlRow"), PersonalDDTableControlRow) + recList.Add(recControl) + + Next + + Return DirectCast(recList.ToArray(GetType(PersonalDDTableControlRow)), PersonalDDTableControlRow()) + 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 + + \ No newline at end of file diff --git a/App_Code/PersonalEducation/AddPersonalEducation.Controls.vb b/App_Code/PersonalEducation/AddPersonalEducation.Controls.vb new file mode 100644 index 0000000..4029d45 --- /dev/null +++ b/App_Code/PersonalEducation/AddPersonalEducation.Controls.vb @@ -0,0 +1,2672 @@ + +' This file implements the TableControl, TableControlRow, and RecordControl classes for the +' AddPersonalEducation.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.AddPersonalEducation + +#Region "Section 1: Place your customizations here." + + +Public Class PersonalEducationRecordControl + Inherits BasePersonalEducationRecordControl + ' The BasePersonalEducationRecordControl 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 PersonalEducationRecordControl control on the AddPersonalEducation page. +' Do not modify this class. Instead override any method in PersonalEducationRecordControl. +Public Class BasePersonalEducationRecordControl + Inherits Persons.UI.BaseApplicationRecordControl + + ' To customize, override this method in PersonalEducationRecordControl. + 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 PersonalEducationRecordControl. + 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. + + Me.PersonalIdAddRecordLink.PostBackUrl = "../PersonalId/AddPersonalId.aspx" & "?Target=" & Me.PersonalId.ClientID & "&DFKA=" & HttpUtility.UrlEncode("PersonalName") + Me.PersonalIdAddRecordLink.Attributes.Item("onClick") = "window.open('" & Me.PersonalIdAddRecordLink.PostBackUrl & "','_blank', 'width=900, height=700, resizable, scrollbars, modal=yes'); return false;" + + AddHandler Me.COUNTRY.SelectedIndexChanged, AddressOf COUNTRY_SelectedIndexChanged + + AddHandler Me.LevelId.SelectedIndexChanged, AddressOf LevelId_SelectedIndexChanged + + AddHandler Me.PersonalId.SelectedIndexChanged, AddressOf PersonalId_SelectedIndexChanged + + AddHandler Me.Command.TextChanged, AddressOf Command_TextChanged + + AddHandler Me.CommandDate.TextChanged, AddressOf CommandDate_TextChanged + + AddHandler Me.Course.TextChanged, AddressOf Course_TextChanged + + AddHandler Me.CourseAbbr.TextChanged, AddressOf CourseAbbr_TextChanged + + AddHandler Me.CourseNo.TextChanged, AddressOf CourseNo_TextChanged + + AddHandler Me.EducationPeriod.TextChanged, AddressOf EducationPeriod_TextChanged + + AddHandler Me.EducationType.TextChanged, AddressOf EducationType_TextChanged + + AddHandler Me.EdYear.TextChanged, AddressOf EdYear_TextChanged + + AddHandler Me.EndDate.TextChanged, AddressOf EndDate_TextChanged + + AddHandler Me.Facultry.TextChanged, AddressOf Facultry_TextChanged + + AddHandler Me.Institue.TextChanged, AddressOf Institue_TextChanged + + AddHandler Me.NoAll.TextChanged, AddressOf NoAll_TextChanged + + AddHandler Me.Score.TextChanged, AddressOf Score_TextChanged + + AddHandler Me.ScoreNo.TextChanged, AddressOf ScoreNo_TextChanged + + AddHandler Me.StartDate.TextChanged, AddressOf StartDate_TextChanged + + + End Sub + + + Public Overridable Sub LoadData() + + ' Load the data from the database into the DataSource PersonalEducation record. + ' It is better to make changes to functions called by LoadData such as + ' CreateWhereClause, rather than making changes here. + + ' The RecordUniqueId is set the first time a record is loaded, and is + ' used during a PostBack to load the record. + + If Me.RecordUniqueId IsNot Nothing AndAlso Me.RecordUniqueId.Trim <> "" Then + Me.DataSource = PersonalEducationTable.GetRecord(Me.RecordUniqueId, True) + + Return + End If + + ' 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() + + ' 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 PersonalEducationRecord() + + Return + End If + + ' Retrieve the record from the database. It is possible + + Dim recList() As PersonalEducationRecord = PersonalEducationTable.GetRecords(wc, Nothing, 0, 2) + If recList.Length = 0 Then + ' There is no data for this Where clause. + wc.RunQuery = False + + Return + End If + + ' Set DataSource based on record retrieved from the database. + Me.DataSource = CType(PersonalEducationRecord.Copy(recList(0), False), PersonalEducationRecord) + + + + End Sub + + ' Populate the UI controls using the DataSource. To customize, override this method in PersonalEducationRecordControl. + Public Overrides Sub DataBind() + ' The DataBind method binds the user interface controls to the values + ' from the database record. To do this, it calls the Set methods for + ' each of the field displayed on the webpage. It is better to make + ' changes in the Set methods, rather than making changes here. + + MyBase.DataBind() + + ' Make sure that the DataSource is initialized. + If Me.DataSource Is Nothing Then + + Return + End If + + + 'LoadData for DataSource for chart and report if they exist + + + + ' Call the Set methods for each controls on the panel + + SetCommand() + SetCommandDate() + SetCommandDateLabel() + SetCommandLabel() + SetCOUNTRY() + SetCOUNTRYLabel() + SetCourse() + SetCourseAbbr() + SetCourseAbbrLabel() + SetCourseLabel() + SetCourseNo() + SetCourseNoLabel() + SetEducationPeriod() + SetEducationPeriodLabel() + SetEducationType() + SetEducationTypeLabel() + SetEdYear() + SetEdYearLabel() + SetEndDate() + SetEndDateLabel() + SetFacultry() + SetFacultryLabel() + SetInstitue() + SetInstitueLabel() + SetLevelId() + SetLevelIdLabel() + SetNoAll() + SetNoAllLabel() + SetPersonalEducationRecordControlCollapsibleRegion() + SetPersonalEducationRecordControlIcon() + SetPersonalEducationRecordControlPanelExtender() + + SetPersonalId() + + SetPersonalIdLabel() + SetScore() + SetScoreLabel() + SetScoreNo() + SetScoreNoLabel() + SetStartDate() + SetStartDateLabel() + + + Me.IsNewRecord = True + + If Me.DataSource.IsCreated Then + Me.IsNewRecord = False + + Me.RecordUniqueId = Me.DataSource.GetID.ToXmlString() + End If + + ' Now load data for each record and table child UI controls. + ' Ordering is important because child controls get + ' their parent ids from their parent UI controls. + Dim shouldResetControl As Boolean = False + + End Sub + + + Public Overridable Sub SetCommand() + + + ' Set the Command TextBox on the webpage with value from the + ' PersonalEducation database record. + + ' Me.DataSource is the PersonalEducation record retrieved from the database. + ' Me.Command is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetCommand() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.CommandSpecified Then + + ' If the Command is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalEducationTable.Command) + + Me.Command.Text = formattedValue + + Else + + ' Command is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.Command.Text = PersonalEducationTable.Command.Format(PersonalEducationTable.Command.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetCommandDate() + + + ' Set the CommandDate TextBox on the webpage with value from the + ' PersonalEducation database record. + + ' Me.DataSource is the PersonalEducation record retrieved from the database. + ' Me.CommandDate is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetCommandDate() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.CommandDateSpecified Then + + ' If the CommandDate is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalEducationTable.CommandDate, "d MMM yy") + + Me.CommandDate.Text = formattedValue + + Else + + ' CommandDate is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.CommandDate.Text = PersonalEducationTable.CommandDate.Format(PersonalEducationTable.CommandDate.DefaultValue, "d MMM yy") + + End If + + End Sub + + Public Overridable Sub SetCOUNTRY() + + + ' Set the COUNTRY DropDownList on the webpage with value from the + ' PersonalEducation database record. + + ' Me.DataSource is the PersonalEducation record retrieved from the database. + ' Me.COUNTRY is the ASP:DropDownList on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetCOUNTRY() + ' and add your own code before or after the call to the MyBase function. + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.COUNTRYSpecified Then + + ' If the COUNTRY is non-NULL, then format the value. + ' The Format method will return the Display Foreign Key As (DFKA) value + Me.PopulateCOUNTRYDropDownList(Me.DataSource.COUNTRY.ToString(), 100) + + Else + + ' COUNTRY 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.PopulateCOUNTRYDropDownList(Nothing, 100) + Else + Me.PopulateCOUNTRYDropDownList(PersonalEducationTable.COUNTRY.DefaultValue, 100) + End If + + End If + + End Sub + + Public Overridable Sub SetCourse() + + + ' Set the Course TextBox on the webpage with value from the + ' PersonalEducation database record. + + ' Me.DataSource is the PersonalEducation record retrieved from the database. + ' Me.Course is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetCourse() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.CourseSpecified Then + + ' If the Course is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalEducationTable.Course) + + Me.Course.Text = formattedValue + + Else + + ' Course is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.Course.Text = PersonalEducationTable.Course.Format(PersonalEducationTable.Course.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetCourseAbbr() + + + ' Set the CourseAbbr TextBox on the webpage with value from the + ' PersonalEducation database record. + + ' Me.DataSource is the PersonalEducation record retrieved from the database. + ' Me.CourseAbbr is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetCourseAbbr() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.CourseAbbrSpecified Then + + ' If the CourseAbbr is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalEducationTable.CourseAbbr) + + Me.CourseAbbr.Text = formattedValue + + Else + + ' CourseAbbr is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.CourseAbbr.Text = PersonalEducationTable.CourseAbbr.Format(PersonalEducationTable.CourseAbbr.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetCourseNo() + + + ' Set the CourseNo TextBox on the webpage with value from the + ' PersonalEducation database record. + + ' Me.DataSource is the PersonalEducation record retrieved from the database. + ' Me.CourseNo is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetCourseNo() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.CourseNoSpecified Then + + ' If the CourseNo is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalEducationTable.CourseNo) + + Me.CourseNo.Text = formattedValue + + Else + + ' CourseNo is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.CourseNo.Text = PersonalEducationTable.CourseNo.Format(PersonalEducationTable.CourseNo.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetEducationPeriod() + + + ' Set the EducationPeriod TextBox on the webpage with value from the + ' PersonalEducation database record. + + ' Me.DataSource is the PersonalEducation record retrieved from the database. + ' Me.EducationPeriod is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetEducationPeriod() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.EducationPeriodSpecified Then + + ' If the EducationPeriod is non-NULL, then format the value. + + ' The Format method will return the Display Foreign Key As (DFKA) value + Dim formattedValue As String = Me.DataSource.EducationPeriod.ToString() + + + Me.EducationPeriod.Text = formattedValue + + Else + + ' EducationPeriod is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.EducationPeriod.Text = PersonalEducationTable.EducationPeriod.DefaultValue + End If + + End Sub + + Public Overridable Sub SetEducationType() + + + ' Set the EducationType TextBox on the webpage with value from the + ' PersonalEducation database record. + + ' Me.DataSource is the PersonalEducation record retrieved from the database. + ' Me.EducationType is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetEducationType() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.EducationTypeSpecified Then + + ' If the EducationType is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalEducationTable.EducationType) + + Me.EducationType.Text = formattedValue + + Else + + ' EducationType is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.EducationType.Text = PersonalEducationTable.EducationType.Format(PersonalEducationTable.EducationType.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetEdYear() + + + ' Set the EdYear TextBox on the webpage with value from the + ' PersonalEducation database record. + + ' Me.DataSource is the PersonalEducation record retrieved from the database. + ' Me.EdYear is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetEdYear() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.EdYearSpecified Then + + ' If the EdYear is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalEducationTable.EdYear) + + Me.EdYear.Text = formattedValue + + Else + + ' EdYear is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.EdYear.Text = PersonalEducationTable.EdYear.Format(PersonalEducationTable.EdYear.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetEndDate() + + + ' Set the EndDate TextBox on the webpage with value from the + ' PersonalEducation database record. + + ' Me.DataSource is the PersonalEducation record retrieved from the database. + ' Me.EndDate is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetEndDate() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.EndDateSpecified Then + + ' If the EndDate is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalEducationTable.EndDate, "d MMM yy") + + Me.EndDate.Text = formattedValue + + Else + + ' EndDate is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.EndDate.Text = PersonalEducationTable.EndDate.Format(PersonalEducationTable.EndDate.DefaultValue, "d MMM yy") + + End If + + End Sub + + Public Overridable Sub SetFacultry() + + + ' Set the Facultry TextBox on the webpage with value from the + ' PersonalEducation database record. + + ' Me.DataSource is the PersonalEducation record retrieved from the database. + ' Me.Facultry is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetFacultry() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.FacultrySpecified Then + + ' If the Facultry is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalEducationTable.Facultry) + + Me.Facultry.Text = formattedValue + + Else + + ' Facultry is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.Facultry.Text = PersonalEducationTable.Facultry.Format(PersonalEducationTable.Facultry.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetInstitue() + + + ' Set the Institue TextBox on the webpage with value from the + ' PersonalEducation database record. + + ' Me.DataSource is the PersonalEducation record retrieved from the database. + ' Me.Institue is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetInstitue() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.InstitueSpecified Then + + ' If the Institue is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalEducationTable.Institue) + + Me.Institue.Text = formattedValue + + Else + + ' Institue is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.Institue.Text = PersonalEducationTable.Institue.Format(PersonalEducationTable.Institue.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetLevelId() + + + ' Set the LevelId DropDownList on the webpage with value from the + ' PersonalEducation database record. + + ' Me.DataSource is the PersonalEducation record retrieved from the database. + ' Me.LevelId is the ASP:DropDownList on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetLevelId() + ' and add your own code before or after the call to the MyBase function. + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.LevelIdSpecified Then + + ' If the LevelId is non-NULL, then format the value. + ' The Format method will return the Display Foreign Key As (DFKA) value + Me.PopulateLevelIdDropDownList(Me.DataSource.LevelId.ToString(), 100) + + Else + + ' LevelId 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.PopulateLevelIdDropDownList(Nothing, 100) + Else + Me.PopulateLevelIdDropDownList(PersonalEducationTable.LevelId.DefaultValue, 100) + End If + + End If + + End Sub + + Public Overridable Sub SetNoAll() + + + ' Set the NoAll TextBox on the webpage with value from the + ' PersonalEducation database record. + + ' Me.DataSource is the PersonalEducation record retrieved from the database. + ' Me.NoAll is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetNoAll() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.NoAllSpecified Then + + ' If the NoAll is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalEducationTable.NoAll) + + Me.NoAll.Text = formattedValue + + Else + + ' NoAll is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.NoAll.Text = PersonalEducationTable.NoAll.Format(PersonalEducationTable.NoAll.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetPersonalId() + + + ' Set the PersonalId DropDownList on the webpage with value from the + ' PersonalEducation database record. + + ' Me.DataSource is the PersonalEducation record retrieved from the database. + ' Me.PersonalId is the ASP:DropDownList on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetPersonalId() + ' and add your own code before or after the call to the MyBase function. + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.PersonalIdSpecified Then + + ' If the PersonalId is non-NULL, then format the value. + ' The Format method will return the Display Foreign Key As (DFKA) value + Me.PopulatePersonalIdDropDownList(Me.DataSource.PersonalId, 100) + + Else + + ' PersonalId 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.PopulatePersonalIdDropDownList(Nothing, 100) + Else + Me.PopulatePersonalIdDropDownList(PersonalEducationTable.PersonalId.DefaultValue, 100) + End If + + End If + + End Sub + + Public Overridable Sub SetScore() + + + ' Set the Score TextBox on the webpage with value from the + ' PersonalEducation database record. + + ' Me.DataSource is the PersonalEducation record retrieved from the database. + ' Me.Score is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetScore() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.ScoreSpecified Then + + ' If the Score is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalEducationTable.Score) + + Me.Score.Text = formattedValue + + Else + + ' Score is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.Score.Text = PersonalEducationTable.Score.Format(PersonalEducationTable.Score.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetScoreNo() + + + ' Set the ScoreNo TextBox on the webpage with value from the + ' PersonalEducation database record. + + ' Me.DataSource is the PersonalEducation record retrieved from the database. + ' Me.ScoreNo is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetScoreNo() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.ScoreNoSpecified Then + + ' If the ScoreNo is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalEducationTable.ScoreNo) + + Me.ScoreNo.Text = formattedValue + + Else + + ' ScoreNo is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.ScoreNo.Text = PersonalEducationTable.ScoreNo.Format(PersonalEducationTable.ScoreNo.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetStartDate() + + + ' Set the StartDate TextBox on the webpage with value from the + ' PersonalEducation database record. + + ' Me.DataSource is the PersonalEducation record retrieved from the database. + ' Me.StartDate is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetStartDate() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.StartDateSpecified Then + + ' If the StartDate is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalEducationTable.StartDate, "d MMM yy") + + Me.StartDate.Text = formattedValue + + Else + + ' StartDate is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.StartDate.Text = PersonalEducationTable.StartDate.Format(PersonalEducationTable.StartDate.DefaultValue, "d MMM yy") + + End If + + End Sub + + Public Overridable Sub SetCommandDateLabel() + + End Sub + + Public Overridable Sub SetCommandLabel() + + End Sub + + Public Overridable Sub SetCOUNTRYLabel() + + End Sub + + Public Overridable Sub SetCourseAbbrLabel() + + End Sub + + Public Overridable Sub SetCourseLabel() + + End Sub + + Public Overridable Sub SetCourseNoLabel() + + End Sub + + Public Overridable Sub SetEducationPeriodLabel() + + End Sub + + Public Overridable Sub SetEducationTypeLabel() + + End Sub + + Public Overridable Sub SetEdYearLabel() + + End Sub + + Public Overridable Sub SetEndDateLabel() + + End Sub + + Public Overridable Sub SetFacultryLabel() + + End Sub + + Public Overridable Sub SetInstitueLabel() + + End Sub + + Public Overridable Sub SetLevelIdLabel() + + End Sub + + Public Overridable Sub SetNoAllLabel() + + End Sub + + Public Overridable Sub SetPersonalEducationRecordControlCollapsibleRegion() + + End Sub + + Public Overridable Sub SetPersonalEducationRecordControlIcon() + + End Sub + + Public Overridable Sub SetPersonalEducationRecordControlPanelExtender() + + End Sub + + Public Overridable Sub SetPersonalIdLabel() + + End Sub + + Public Overridable Sub SetScoreLabel() + + End Sub + + Public Overridable Sub SetScoreNoLabel() + + End Sub + + Public Overridable Sub SetStartDateLabel() + + 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 PersonalEducationRecordControl. + Public Overridable Sub SaveData() + ' Saves the associated record in the database. + ' SaveData calls Validate and Get methods - so it may be more appropriate to + ' customize those methods. + + ' 1. Load the existing record from the database. Since we save the entire record, this ensures + ' that fields that are not displayed are also properly initialized. + Me.LoadData() + + + ' 2. Perform any custom validation. + Me.Validate() + + + ' 3. Set the values in the record with data from UI controls. + ' This calls the Get() method for each of the user interface controls. + Me.GetUIData() + + ' 4. Save in the database. + ' We should not save the record if the data did not change. This + ' will save a database hit and avoid triggering any database triggers. + + If Me.DataSource.IsAnyValueChanged Then + ' Save record to database but do not commit yet. + ' Auto generated ids are available after saving for use by child (dependent) records. + Me.DataSource.Save() + + 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 PersonalEducationRecordControl. + Public Overridable Sub GetUIData() + ' The GetUIData method retrieves the updated values from the user interface + ' controls into a database record in preparation for saving or updating. + ' To do this, it calls the Get methods for each of the field displayed on + ' the webpage. It is better to make changes in the Get methods, rather + ' than making changes here. + + ' Call the Get methods for each of the user interface controls. + + GetCommand() + GetCommandDate() + GetCOUNTRY() + GetCourse() + GetCourseAbbr() + GetCourseNo() + GetEducationPeriod() + GetEducationType() + GetEdYear() + GetEndDate() + GetFacultry() + GetInstitue() + GetLevelId() + GetNoAll() + GetPersonalId() + GetScore() + GetScoreNo() + GetStartDate() + End Sub + + + Public Overridable Sub GetCommand() + + ' Retrieve the value entered by the user on the Command ASP:TextBox, and + ' save it into the Command field in DataSource PersonalEducation record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.Command.Text, PersonalEducationTable.Command) + + + End Sub + + Public Overridable Sub GetCommandDate() + + ' Retrieve the value entered by the user on the CommandDate ASP:TextBox, and + ' save it into the CommandDate field in DataSource PersonalEducation 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.CommandDate.Text, PersonalEducationTable.CommandDate) + + + End Sub + + Public Overridable Sub GetCOUNTRY() + + ' Retrieve the value entered by the user on the COUNTRY ASP:DropDownList, and + ' save it into the COUNTRY field in DataSource PersonalEducation record. + + ' Custom validation should be performed in Validate, not here. + + Me.DataSource.Parse(GetValueSelectedPageRequest(Me.COUNTRY), PersonalEducationTable.COUNTRY) + + End Sub + + Public Overridable Sub GetCourse() + + ' Retrieve the value entered by the user on the Course ASP:TextBox, and + ' save it into the Course field in DataSource PersonalEducation record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.Course.Text, PersonalEducationTable.Course) + + + End Sub + + Public Overridable Sub GetCourseAbbr() + + ' Retrieve the value entered by the user on the CourseAbbr ASP:TextBox, and + ' save it into the CourseAbbr field in DataSource PersonalEducation record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.CourseAbbr.Text, PersonalEducationTable.CourseAbbr) + + + End Sub + + Public Overridable Sub GetCourseNo() + + ' Retrieve the value entered by the user on the CourseNo ASP:TextBox, and + ' save it into the CourseNo field in DataSource PersonalEducation record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.CourseNo.Text, PersonalEducationTable.CourseNo) + + + End Sub + + Public Overridable Sub GetEducationPeriod() + + ' Retrieve the value entered by the user on the EducationPeriod ASP:TextBox, and + ' save it into the EducationPeriod field in DataSource PersonalEducation record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.EducationPeriod.Text, PersonalEducationTable.EducationPeriod) + + + End Sub + + Public Overridable Sub GetEducationType() + + ' Retrieve the value entered by the user on the EducationType ASP:TextBox, and + ' save it into the EducationType field in DataSource PersonalEducation record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.EducationType.Text, PersonalEducationTable.EducationType) + + + End Sub + + Public Overridable Sub GetEdYear() + + ' Retrieve the value entered by the user on the EdYear ASP:TextBox, and + ' save it into the EdYear field in DataSource PersonalEducation record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.EdYear.Text, PersonalEducationTable.EdYear) + + + End Sub + + Public Overridable Sub GetEndDate() + + ' Retrieve the value entered by the user on the EndDate ASP:TextBox, and + ' save it into the EndDate field in DataSource PersonalEducation 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.EndDate.Text, PersonalEducationTable.EndDate) + + + End Sub + + Public Overridable Sub GetFacultry() + + ' Retrieve the value entered by the user on the Facultry ASP:TextBox, and + ' save it into the Facultry field in DataSource PersonalEducation record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.Facultry.Text, PersonalEducationTable.Facultry) + + + End Sub + + Public Overridable Sub GetInstitue() + + ' Retrieve the value entered by the user on the Institue ASP:TextBox, and + ' save it into the Institue field in DataSource PersonalEducation record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.Institue.Text, PersonalEducationTable.Institue) + + + End Sub + + Public Overridable Sub GetLevelId() + + ' Retrieve the value entered by the user on the LevelId ASP:DropDownList, and + ' save it into the LevelId field in DataSource PersonalEducation record. + + ' Custom validation should be performed in Validate, not here. + + Me.DataSource.Parse(GetValueSelectedPageRequest(Me.LevelId), PersonalEducationTable.LevelId) + + End Sub + + Public Overridable Sub GetNoAll() + + ' Retrieve the value entered by the user on the NoAll ASP:TextBox, and + ' save it into the NoAll field in DataSource PersonalEducation record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.NoAll.Text, PersonalEducationTable.NoAll) + + + End Sub + + Public Overridable Sub GetPersonalId() + + ' Retrieve the value entered by the user on the PersonalId ASP:DropDownList, and + ' save it into the PersonalId field in DataSource PersonalEducation record. + + ' Custom validation should be performed in Validate, not here. + + Me.DataSource.Parse(GetValueSelectedPageRequest(Me.PersonalId), PersonalEducationTable.PersonalId) + + End Sub + + Public Overridable Sub GetScore() + + ' Retrieve the value entered by the user on the Score ASP:TextBox, and + ' save it into the Score field in DataSource PersonalEducation record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.Score.Text, PersonalEducationTable.Score) + + + End Sub + + Public Overridable Sub GetScoreNo() + + ' Retrieve the value entered by the user on the ScoreNo ASP:TextBox, and + ' save it into the ScoreNo field in DataSource PersonalEducation record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.ScoreNo.Text, PersonalEducationTable.ScoreNo) + + + End Sub + + Public Overridable Sub GetStartDate() + + ' Retrieve the value entered by the user on the StartDate ASP:TextBox, and + ' save it into the StartDate field in DataSource PersonalEducation 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.StartDate.Text, PersonalEducationTable.StartDate) + + + End Sub + + + ' To customize, override this method in PersonalEducationRecordControl. + + Public Overridable Function CreateWhereClause() As WhereClause + + Dim wc As WhereClause + PersonalEducationTable.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("PersonalEducation") + If recId Is Nothing OrElse recId.Trim = "" Then + + Return Nothing + + End If + + HttpContext.Current.Session("QueryString in AddPersonalEducation") = 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(PersonalEducationTable.EducationId, BaseFilter.ComparisonOperator.EqualsTo, pkValue.GetColumnValueString(PersonalEducationTable.EducationId)) + + Else + ' The URL parameter contains the actual value, not an XML structure. + + wc.iAND(PersonalEducationTable.EducationId, 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 + PersonalEducationTable.Instance.InnerFilter = Nothing + Dim wc As WhereClause = New WhereClause() + + ' Compose the WHERE clause consiting of: + ' 1. Static clause defined at design time. + ' 2. User selected 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 PersonalEducationRecordControl. + Public Overridable Sub Validate() + ' Add custom validation for any control within this panel. + ' Example. If you have a State ASP:Textbox control + ' If Me.State.Text <> "CA" Then + ' Throw New Exception("State must be CA (California).") + ' End If + + ' The Validate method is common across all controls within + ' this panel so you can validate multiple fields, but report + ' one error message. + + + End Sub + + Public Overridable Sub Delete() + + If Me.IsNewRecord() Then + Return + End If + + Dim pkValue As KeyValue = KeyValue.XmlToKey(Me.RecordUniqueId) + PersonalEducationTable.DeleteRecord(pkValue) + + 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_COUNTRYDropDownList() 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 Country table. + ' Examples: + ' wc.iAND(CountryTable.Country, BaseFilter.ComparisonOperator.EqualsTo, "XYZ") + ' wc.iAND(CountryTable.Active, BaseFilter.ComparisonOperator.EqualsTo, "1") + + Dim wc As WhereClause = New WhereClause() + Return wc + + End Function + + + + Public Overridable Function CreateWhereClause_LevelIdDropDownList() 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 Education table. + ' Examples: + ' wc.iAND(EducationTable.Level, BaseFilter.ComparisonOperator.EqualsTo, "XYZ") + ' wc.iAND(EducationTable.Active, BaseFilter.ComparisonOperator.EqualsTo, "1") + + Dim wc As WhereClause = New WhereClause() + Return wc + + End Function + + + + Public Overridable Function CreateWhereClause_PersonalIdDropDownList() 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 PersonalId table. + ' Examples: + ' wc.iAND(PersonalIdTable.PersonalName, BaseFilter.ComparisonOperator.EqualsTo, "XYZ") + ' wc.iAND(PersonalIdTable.Active, BaseFilter.ComparisonOperator.EqualsTo, "1") + + Dim wc As WhereClause = New WhereClause() + Return wc + + End Function + + + ' Fill the COUNTRY list. + Protected Overridable Sub PopulateCOUNTRYDropDownList( _ + ByVal selectedValue As String, _ + ByVal maxItems As Integer) + + Me.COUNTRY.Items.Clear() + + + ' 1. Setup the static list items + + ' Add the Please Select item. + Me.COUNTRY.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_COUNTRYDropDownList function. + ' It is better to customize the where clause there. + + Dim wc As WhereClause = CreateWhereClause_COUNTRYDropDownList() + ' Create the ORDER BY clause to sort based on the displayed value. + + + Dim orderBy As OrderBy = New OrderBy(false, false) + orderBy.Add(CountryTable.Country, OrderByItem.OrderDir.Asc) + + Dim variables As System.Collections.Generic.IDictionary(Of String, Object) = New System.Collections.Generic.Dictionary(Of String, Object) + + ' 3. Read a total of maxItems from the database and insert them + Dim itemValues() As CountryRecord = 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 = CountryTable.GetRecords(wc, orderBy, pageNum, maxItems) + For each itemValue As CountryRecord In itemValues + ' Create the item and add to the list. + Dim cvalue As String = Nothing + Dim fvalue As String = Nothing + If itemValue.CountryIdSpecified Then + cvalue = itemValue.CountryId.ToString() + + If counter < maxItems AndAlso Me.COUNTRY.Items.FindByValue(cvalue) Is Nothing Then + + Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalEducationTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalEducationTable.COUNTRY) + If _isExpandableNonCompositeForeignKey AndAlso PersonalEducationTable.COUNTRY.IsApplyDisplayAs Then + fvalue = PersonalEducationTable.GetDFKA(itemValue, PersonalEducationTable.COUNTRY) + End If + If (Not _isExpandableNonCompositeForeignKey) Or (String.IsNullOrEmpty(fvalue)) Then + fvalue = itemValue.Format(CountryTable.Country) + End If + + If fvalue Is Nothing OrElse fvalue.Trim() = "" Then fvalue = cvalue + + If (IsNothing(fvalue)) Then + fvalue = "" + End If + + fvalue = fvalue.Trim() + + If ( fvalue.Length > 50 ) Then + fvalue = fvalue.Substring(0, 50) & "..." + End If + + Dim dupItem As ListItem = Me.COUNTRY.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.COUNTRY.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.COUNTRY, selectedValue) AndAlso _ + Not SetSelectedDisplayText(Me.COUNTRY, selectedValue)Then + + ' construct a whereclause to query a record with Country.CountryId = selectedValue + Dim filter2 As CompoundFilter = New CompoundFilter(CompoundFilter.CompoundingOperators.And_Operator, Nothing) + Dim whereClause2 As WhereClause = New WhereClause() + filter2.AddFilter(New BaseClasses.Data.ColumnValueFilter(CountryTable.CountryId, selectedValue, BaseClasses.Data.BaseFilter.ComparisonOperator.EqualsTo, False)) + whereClause2.AddFilter(filter2, CompoundFilter.CompoundingOperators.And_Operator) + + Try + ' Execute the query + Dim rc() As CountryRecord = CountryTable.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 CountryRecord = DirectCast(rc(0), CountryRecord) + ' Create the item and add to the list. + Dim cvalue As String = Nothing + Dim fvalue As String = Nothing + If itemValue.CountryIdSpecified Then + cvalue = itemValue.CountryId.ToString() + Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalEducationTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalEducationTable.COUNTRY) + If _isExpandableNonCompositeForeignKey AndAlso PersonalEducationTable.COUNTRY.IsApplyDisplayAs Then + fvalue = PersonalEducationTable.GetDFKA(itemValue, PersonalEducationTable.COUNTRY) + End If + If (Not _isExpandableNonCompositeForeignKey) Or (String.IsNullOrEmpty(fvalue)) Then + fvalue = itemValue.Format(CountryTable.Country) + End If + + If fvalue Is Nothing OrElse fvalue.Trim() = "" Then fvalue = cvalue + Dim newItem As New ListItem(fvalue, cvalue) + Me.COUNTRY.Items.Add(newItem) + SetSelectedValue(Me.COUNTRY, selectedValue) + End If + End If + Catch + End Try + + End If + + + End Sub + + ' Fill the LevelId list. + Protected Overridable Sub PopulateLevelIdDropDownList( _ + ByVal selectedValue As String, _ + ByVal maxItems As Integer) + + Me.LevelId.Items.Clear() + + + ' 1. Setup the static list items + + ' Add the Please Select item. + Me.LevelId.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_LevelIdDropDownList function. + ' It is better to customize the where clause there. + + Dim wc As WhereClause = CreateWhereClause_LevelIdDropDownList() + ' Create the ORDER BY clause to sort based on the displayed value. + + + Dim orderBy As OrderBy = New OrderBy(false, false) + orderBy.Add(EducationTable.Level, OrderByItem.OrderDir.Asc) + + Dim variables As System.Collections.Generic.IDictionary(Of String, Object) = New System.Collections.Generic.Dictionary(Of String, Object) + + ' 3. Read a total of maxItems from the database and insert them + Dim itemValues() As EducationRecord = 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 = EducationTable.GetRecords(wc, orderBy, pageNum, maxItems) + For each itemValue As EducationRecord In itemValues + ' Create the item and add to the list. + Dim cvalue As String = Nothing + Dim fvalue As String = Nothing + If itemValue.EducationIdSpecified Then + cvalue = itemValue.EducationId.ToString() + + If counter < maxItems AndAlso Me.LevelId.Items.FindByValue(cvalue) Is Nothing Then + + Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalEducationTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalEducationTable.LevelId) + If _isExpandableNonCompositeForeignKey AndAlso PersonalEducationTable.LevelId.IsApplyDisplayAs Then + fvalue = PersonalEducationTable.GetDFKA(itemValue, PersonalEducationTable.LevelId) + End If + If (Not _isExpandableNonCompositeForeignKey) Or (String.IsNullOrEmpty(fvalue)) Then + fvalue = itemValue.Format(EducationTable.Level) + End If + + If fvalue Is Nothing OrElse fvalue.Trim() = "" Then fvalue = cvalue + + If (IsNothing(fvalue)) Then + fvalue = "" + End If + + fvalue = fvalue.Trim() + + If ( fvalue.Length > 50 ) Then + fvalue = fvalue.Substring(0, 50) & "..." + End If + + Dim dupItem As ListItem = Me.LevelId.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.LevelId.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.LevelId, selectedValue) AndAlso _ + Not SetSelectedDisplayText(Me.LevelId, selectedValue)Then + + ' construct a whereclause to query a record with Education.EducationId = selectedValue + Dim filter2 As CompoundFilter = New CompoundFilter(CompoundFilter.CompoundingOperators.And_Operator, Nothing) + Dim whereClause2 As WhereClause = New WhereClause() + filter2.AddFilter(New BaseClasses.Data.ColumnValueFilter(EducationTable.EducationId, selectedValue, BaseClasses.Data.BaseFilter.ComparisonOperator.EqualsTo, False)) + whereClause2.AddFilter(filter2, CompoundFilter.CompoundingOperators.And_Operator) + + Try + ' Execute the query + Dim rc() As EducationRecord = EducationTable.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 EducationRecord = DirectCast(rc(0), EducationRecord) + ' Create the item and add to the list. + Dim cvalue As String = Nothing + Dim fvalue As String = Nothing + If itemValue.EducationIdSpecified Then + cvalue = itemValue.EducationId.ToString() + Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalEducationTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalEducationTable.LevelId) + If _isExpandableNonCompositeForeignKey AndAlso PersonalEducationTable.LevelId.IsApplyDisplayAs Then + fvalue = PersonalEducationTable.GetDFKA(itemValue, PersonalEducationTable.LevelId) + End If + If (Not _isExpandableNonCompositeForeignKey) Or (String.IsNullOrEmpty(fvalue)) Then + fvalue = itemValue.Format(EducationTable.Level) + End If + + If fvalue Is Nothing OrElse fvalue.Trim() = "" Then fvalue = cvalue + Dim newItem As New ListItem(fvalue, cvalue) + Me.LevelId.Items.Add(newItem) + SetSelectedValue(Me.LevelId, selectedValue) + End If + End If + Catch + End Try + + End If + + + End Sub + + ' Fill the PersonalId list. + Protected Overridable Sub PopulatePersonalIdDropDownList( _ + ByVal selectedValue As String, _ + ByVal maxItems As Integer) + + Me.PersonalId.Items.Clear() + + + ' 1. Setup the static list items + + ' Add the Please Select item. + Me.PersonalId.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_PersonalIdDropDownList function. + ' It is better to customize the where clause there. + + Dim wc As WhereClause = CreateWhereClause_PersonalIdDropDownList() + ' Create the ORDER BY clause to sort based on the displayed value. + + + Dim orderBy As OrderBy = New OrderBy(false, false) + orderBy.Add(PersonalIdTable.PersonalName, OrderByItem.OrderDir.Asc) + + Dim variables As System.Collections.Generic.IDictionary(Of String, Object) = New System.Collections.Generic.Dictionary(Of String, Object) + + ' 3. Read a total of maxItems from the database and insert them + Dim itemValues() As PersonalIdRecord = 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 = PersonalIdTable.GetRecords(wc, orderBy, pageNum, maxItems) + For each itemValue As PersonalIdRecord In itemValues + ' Create the item and add to the list. + Dim cvalue As String = Nothing + Dim fvalue As String = Nothing + If itemValue.PersonalIdSpecified Then + cvalue = itemValue.PersonalId.ToString() + + If counter < maxItems AndAlso Me.PersonalId.Items.FindByValue(cvalue) Is Nothing Then + + Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalEducationTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalEducationTable.PersonalId) + If _isExpandableNonCompositeForeignKey AndAlso PersonalEducationTable.PersonalId.IsApplyDisplayAs Then + fvalue = PersonalEducationTable.GetDFKA(itemValue, PersonalEducationTable.PersonalId) + End If + If (Not _isExpandableNonCompositeForeignKey) Or (String.IsNullOrEmpty(fvalue)) Then + fvalue = itemValue.Format(PersonalIdTable.PersonalName) + End If + + If fvalue Is Nothing OrElse fvalue.Trim() = "" Then fvalue = cvalue + + If (IsNothing(fvalue)) Then + fvalue = "" + End If + + fvalue = fvalue.Trim() + + If ( fvalue.Length > 50 ) Then + fvalue = fvalue.Substring(0, 50) & "..." + End If + + Dim dupItem As ListItem = Me.PersonalId.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.PersonalId.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.PersonalId, selectedValue) AndAlso _ + Not SetSelectedDisplayText(Me.PersonalId, selectedValue)Then + + ' construct a whereclause to query a record with PersonalId.PersonalId = selectedValue + Dim filter2 As CompoundFilter = New CompoundFilter(CompoundFilter.CompoundingOperators.And_Operator, Nothing) + Dim whereClause2 As WhereClause = New WhereClause() + filter2.AddFilter(New BaseClasses.Data.ColumnValueFilter(PersonalIdTable.PersonalId, selectedValue, BaseClasses.Data.BaseFilter.ComparisonOperator.EqualsTo, False)) + whereClause2.AddFilter(filter2, CompoundFilter.CompoundingOperators.And_Operator) + + Try + ' Execute the query + Dim rc() As PersonalIdRecord = PersonalIdTable.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 PersonalIdRecord = DirectCast(rc(0), PersonalIdRecord) + ' Create the item and add to the list. + Dim cvalue As String = Nothing + Dim fvalue As String = Nothing + If itemValue.PersonalIdSpecified Then + cvalue = itemValue.PersonalId.ToString() + Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalEducationTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalEducationTable.PersonalId) + If _isExpandableNonCompositeForeignKey AndAlso PersonalEducationTable.PersonalId.IsApplyDisplayAs Then + fvalue = PersonalEducationTable.GetDFKA(itemValue, PersonalEducationTable.PersonalId) + End If + If (Not _isExpandableNonCompositeForeignKey) Or (String.IsNullOrEmpty(fvalue)) Then + fvalue = itemValue.Format(PersonalIdTable.PersonalName) + End If + + If fvalue Is Nothing OrElse fvalue.Trim() = "" Then fvalue = cvalue + Dim newItem As New ListItem(fvalue, cvalue) + Me.PersonalId.Items.Add(newItem) + SetSelectedValue(Me.PersonalId, selectedValue) + End If + End If + Catch + End Try + + End If + + + End Sub + + Protected Overridable Sub COUNTRY_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()(COUNTRY.ClientID & "_SelectedValue"), String) + Dim displayText As String = CType(Me.Page.Session()(COUNTRY.ClientID & "_SelectedDisplayText"), String) + If displayText <> "" AndAlso val <> "" Then + Me.COUNTRY.Items.Add(New ListItem(displayText, val)) + Me.COUNTRY.SelectedIndex = Me.COUNTRY.Items.Count - 1 + Me.Page.Session.Remove(COUNTRY.ClientID & "_SelectedValue") + Me.Page.Session.Remove(COUNTRY.ClientID & "_SelectedDisplayText") + End If + + + + + End Sub + + Protected Overridable Sub LevelId_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()(LevelId.ClientID & "_SelectedValue"), String) + Dim displayText As String = CType(Me.Page.Session()(LevelId.ClientID & "_SelectedDisplayText"), String) + If displayText <> "" AndAlso val <> "" Then + Me.LevelId.Items.Add(New ListItem(displayText, val)) + Me.LevelId.SelectedIndex = Me.LevelId.Items.Count - 1 + Me.Page.Session.Remove(LevelId.ClientID & "_SelectedValue") + Me.Page.Session.Remove(LevelId.ClientID & "_SelectedDisplayText") + End If + + + + + End Sub + + Protected Overridable Sub PersonalId_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()(PersonalId.ClientID & "_SelectedValue"), String) + Dim displayText As String = CType(Me.Page.Session()(PersonalId.ClientID & "_SelectedDisplayText"), String) + If displayText <> "" AndAlso val <> "" Then + Me.PersonalId.Items.Add(New ListItem(displayText, val)) + Me.PersonalId.SelectedIndex = Me.PersonalId.Items.Count - 1 + Me.Page.Session.Remove(PersonalId.ClientID & "_SelectedValue") + Me.Page.Session.Remove(PersonalId.ClientID & "_SelectedDisplayText") + End If + + + + + End Sub + + Protected Overridable Sub Command_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub CommandDate_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub Course_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub CourseAbbr_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub CourseNo_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub EducationPeriod_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub EducationType_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub EdYear_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub EndDate_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub Facultry_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub Institue_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub NoAll_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub Score_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub ScoreNo_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub StartDate_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("BasePersonalEducationRecordControl_Rec"), String) + End Get + Set(ByVal value As String) + Me.ViewState("BasePersonalEducationRecordControl_Rec") = value + End Set + End Property + + Private _DataSource As PersonalEducationRecord + Public Property DataSource() As PersonalEducationRecord + Get + Return Me._DataSource + End Get + + Set(ByVal value As PersonalEducationRecord) + + Me._DataSource = value + End Set + End Property + + + + Private _checkSum As String + Public Overridable Property CheckSum() As String + Get + Return Me._checkSum + End Get + Set(ByVal value As String) + Me._checkSum = value + End Set + End Property + + Private _TotalPages As Integer + Public Property TotalPages() As Integer + Get + Return Me._TotalPages + End Get + Set(ByVal value As Integer) + Me._TotalPages = value + End Set + End Property + + Private _PageIndex As Integer + Public Property PageIndex() As Integer + Get + ' Return the PageIndex + Return Me._PageIndex + End Get + Set(ByVal value As Integer) + Me._PageIndex = value + End Set + End Property + + Private _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 Command() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Command"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property CommandDate() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "CommandDate"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property CommandDateLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "CommandDateLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property CommandLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "CommandLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property COUNTRY() As System.Web.UI.WebControls.DropDownList + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "COUNTRY"), System.Web.UI.WebControls.DropDownList) + End Get + End Property + + Public ReadOnly Property COUNTRYLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "COUNTRYLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property Course() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Course"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property CourseAbbr() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "CourseAbbr"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property CourseAbbrLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "CourseAbbrLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property CourseLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "CourseLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property CourseNo() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "CourseNo"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property CourseNoLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "CourseNoLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property EducationPeriod() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "EducationPeriod"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property EducationPeriodLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "EducationPeriodLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property EducationType() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "EducationType"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property EducationTypeLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "EducationTypeLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property EdYear() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "EdYear"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property EdYearLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "EdYearLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property EndDate() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "EndDate"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property EndDateLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "EndDateLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property Facultry() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Facultry"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property FacultryLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "FacultryLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property Institue() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Institue"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property InstitueLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "InstitueLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property LevelId() As System.Web.UI.WebControls.DropDownList + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "LevelId"), System.Web.UI.WebControls.DropDownList) + End Get + End Property + + Public ReadOnly Property LevelIdLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "LevelIdLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property NoAll() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "NoAll"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property NoAllLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "NoAllLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property PersonalEducationRecordControlCollapsibleRegion() As System.Web.UI.WebControls.Panel + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalEducationRecordControlCollapsibleRegion"), System.Web.UI.WebControls.Panel) + End Get + End Property + + Public ReadOnly Property PersonalEducationRecordControlIcon() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalEducationRecordControlIcon"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalEducationRecordControlPanelExtender() As AjaxControlToolkit.CollapsiblePanelExtender + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalEducationRecordControlPanelExtender"), AjaxControlToolkit.CollapsiblePanelExtender) + End Get + End Property + + Public ReadOnly Property PersonalEducationTitle() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalEducationTitle"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property PersonalId() As System.Web.UI.WebControls.DropDownList + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalId"), System.Web.UI.WebControls.DropDownList) + End Get + End Property + + Public ReadOnly Property PersonalIdAddRecordLink() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalIdAddRecordLink"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalIdLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalIdLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property Score() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Score"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property ScoreLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "ScoreLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property ScoreNo() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "ScoreNo"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property ScoreNoLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "ScoreNoLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property StartDate() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "StartDate"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property StartDateLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "StartDateLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + +#End Region + +#Region "Helper Functions" + + Public Overrides Overloads Function ModifyRedirectUrl(ByVal url As String, ByVal arg As String, ByVal bEncrypt As Boolean) As String + Return Me.Page.EvaluateExpressions(url, arg, bEncrypt, Me) + End Function + + Public Overrides Overloads Function EvaluateExpressions(ByVal url As String, ByVal arg As String, ByVal bEncrypt As Boolean) As String + + Dim rec As PersonalEducationRecord = Nothing + + + Try + rec = Me.GetRecord() + Catch ex As Exception + ' Do nothing + End Try + + If rec Is Nothing AndAlso url.IndexOf("{") >= 0 Then + ' Localization. + + Throw New Exception(Page.GetResourceValue("Err:RecDataSrcNotInitialized", "Persons")) + + End If + Return EvaluateExpressions(url, arg, rec, bEncrypt) + End Function + + + Public Overridable Function GetRecord() As PersonalEducationRecord + If Not Me.DataSource Is Nothing Then + Return Me.DataSource + End If + + + Return New PersonalEducationRecord() + + 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 + + \ No newline at end of file diff --git a/App_Code/PersonalEducation/EditPersonalEducation.Controls.vb b/App_Code/PersonalEducation/EditPersonalEducation.Controls.vb new file mode 100644 index 0000000..d98c955 --- /dev/null +++ b/App_Code/PersonalEducation/EditPersonalEducation.Controls.vb @@ -0,0 +1,2766 @@ + +' This file implements the TableControl, TableControlRow, and RecordControl classes for the +' EditPersonalEducation.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.EditPersonalEducation + +#Region "Section 1: Place your customizations here." + + +Public Class PersonalEducationRecordControl + Inherits BasePersonalEducationRecordControl + ' The BasePersonalEducationRecordControl implements the LoadData, DataBind and other + ' methods to load and display the data in a table control. + + Protected Overrides Sub PopulateEducationTypeDropDownList( _ + ByVal selectedValue As String, _ + ByVal maxItems As Integer) + + Me.EducationType.Items.Clear() + + Me.EducationType.Items.Add(New ListItem("พลเรือน", "1")) + Me.EducationType.Items.Add(New ListItem("ทหาร", "2")) + ' 3. Set the selected value (insert if not already present). + If Not selectedValue Is Nothing AndAlso _ + selectedValue.Trim <> "" AndAlso _ + Not SetSelectedValue(Me.EducationType, selectedValue) AndAlso _ + Not MiscUtils.SetSelectedValue(Me.EducationType, PersonalEducationTable.EducationType.Format(selectedValue)) Then + Dim fvalue As String = PersonalEducationTable.EducationType.Format(selectedValue) + Dim item As ListItem = New ListItem(fvalue, selectedValue) + item.Selected = True + Me.EducationType.Items.Insert(0, item) + End If + + + ' 4. Insert the language specific "Please Select" item at the top. + Me.EducationType.Items.Insert(0, New ListItem(Page.GetResourceValue("Txt:PleaseSelect", "Persons"), "--PLEASE_SELECT--")) + + End Sub + + +End Class + + + +#End Region + + + +#Region "Section 2: Do not modify this section." + + +' Base class for the PersonalEducationRecordControl control on the EditPersonalEducation page. +' Do not modify this class. Instead override any method in PersonalEducationRecordControl. +Public Class BasePersonalEducationRecordControl + Inherits Persons.UI.BaseApplicationRecordControl + + ' To customize, override this method in PersonalEducationRecordControl. + 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 PersonalEducationRecordControl. + 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.COUNTRY.SelectedIndexChanged, AddressOf COUNTRY_SelectedIndexChanged + + AddHandler Me.EducationPeriod.SelectedIndexChanged, AddressOf EducationPeriod_SelectedIndexChanged + + AddHandler Me.EducationType.SelectedIndexChanged, AddressOf EducationType_SelectedIndexChanged + + AddHandler Me.LevelId.SelectedIndexChanged, AddressOf LevelId_SelectedIndexChanged + + AddHandler Me.Command.TextChanged, AddressOf Command_TextChanged + + AddHandler Me.CommandDate.TextChanged, AddressOf CommandDate_TextChanged + + AddHandler Me.Course.TextChanged, AddressOf Course_TextChanged + + AddHandler Me.CourseAbbr.TextChanged, AddressOf CourseAbbr_TextChanged + + AddHandler Me.CourseNo.TextChanged, AddressOf CourseNo_TextChanged + + AddHandler Me.EdYear.TextChanged, AddressOf EdYear_TextChanged + + AddHandler Me.EndDate.TextChanged, AddressOf EndDate_TextChanged + + AddHandler Me.Facultry.TextChanged, AddressOf Facultry_TextChanged + + AddHandler Me.Institue.TextChanged, AddressOf Institue_TextChanged + + AddHandler Me.NoAll.TextChanged, AddressOf NoAll_TextChanged + + AddHandler Me.Score.TextChanged, AddressOf Score_TextChanged + + AddHandler Me.ScoreNo.TextChanged, AddressOf ScoreNo_TextChanged + + AddHandler Me.StartDate.TextChanged, AddressOf StartDate_TextChanged + + + End Sub + + + Public Overridable Sub LoadData() + + ' Load the data from the database into the DataSource PersonalEducation record. + ' It is better to make changes to functions called by LoadData such as + ' CreateWhereClause, rather than making changes here. + + ' The RecordUniqueId is set the first time a record is loaded, and is + ' used during a PostBack to load the record. + + If Me.RecordUniqueId IsNot Nothing AndAlso Me.RecordUniqueId.Trim <> "" Then + Me.DataSource = PersonalEducationTable.GetRecord(Me.RecordUniqueId, True) + + Return + End If + + ' 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, "PersonalEducationRecordControlPanel"), 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 PersonalEducationRecord() + + 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 PersonalEducationRecord = PersonalEducationTable.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 = PersonalEducationTable.GetRecord(recList(0).GetID.ToXmlString(), True) + + + + End Sub + + ' Populate the UI controls using the DataSource. To customize, override this method in PersonalEducationRecordControl. + Public Overrides Sub DataBind() + ' The DataBind method binds the user interface controls to the values + ' from the database record. To do this, it calls the Set methods for + ' each of the field displayed on the webpage. It is better to make + ' changes in the Set methods, rather than making changes here. + + MyBase.DataBind() + + ' Make sure that the DataSource is initialized. + If Me.DataSource Is Nothing Then + + Return + End If + + + 'LoadData for DataSource for chart and report if they exist + + + + ' Call the Set methods for each controls on the panel + + SetCommand() + SetCommandDate() + SetCommandDateLabel() + SetCommandLabel() + SetCOUNTRY() + SetCOUNTRYLabel() + SetCourse() + SetCourseAbbr() + SetCourseAbbrLabel() + SetCourseLabel() + SetCourseNo() + SetCourseNoLabel() + SetEducationPeriod() + SetEducationPeriodLabel() + SetEducationType() + SetEducationTypeLabel() + SetEdYear() + SetEdYearLabel() + SetEndDate() + SetEndDateLabel() + SetFacultry() + SetFacultryLabel() + SetInstitue() + SetInstitueLabel() + SetLevelId() + SetLevelIdLabel() + SetNoAll() + SetNoAllLabel() + SetPersonalEducationRecordControlCollapsibleRegion() + SetPersonalEducationRecordControlIcon() + SetPersonalEducationRecordControlPanelExtender() + + SetPersonalId() + SetPersonalIdLabel() + SetScore() + SetScoreLabel() + SetScoreNo() + SetScoreNoLabel() + SetStartDate() + SetStartDateLabel() + + + Me.IsNewRecord = True + + If Me.DataSource.IsCreated Then + Me.IsNewRecord = False + + Me.RecordUniqueId = Me.DataSource.GetID.ToXmlString() + End If + + ' Now load data for each record and table child UI controls. + ' Ordering is important because child controls get + ' their parent ids from their parent UI controls. + Dim shouldResetControl As Boolean = False + + End Sub + + + Public Overridable Sub SetCommand() + + + ' Set the Command TextBox on the webpage with value from the + ' PersonalEducation database record. + + ' Me.DataSource is the PersonalEducation record retrieved from the database. + ' Me.Command is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetCommand() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.CommandSpecified Then + + ' If the Command is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalEducationTable.Command) + + Me.Command.Text = formattedValue + + Else + + ' Command is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.Command.Text = PersonalEducationTable.Command.Format(PersonalEducationTable.Command.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetCommandDate() + + + ' Set the CommandDate TextBox on the webpage with value from the + ' PersonalEducation database record. + + ' Me.DataSource is the PersonalEducation record retrieved from the database. + ' Me.CommandDate is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetCommandDate() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.CommandDateSpecified Then + + ' If the CommandDate is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalEducationTable.CommandDate, "d MMM yy") + + Me.CommandDate.Text = formattedValue + + Else + + ' CommandDate is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.CommandDate.Text = PersonalEducationTable.CommandDate.Format(PersonalEducationTable.CommandDate.DefaultValue, "d MMM yy") + + End If + + End Sub + + Public Overridable Sub SetCOUNTRY() + + + ' Set the COUNTRY DropDownList on the webpage with value from the + ' PersonalEducation database record. + + ' Me.DataSource is the PersonalEducation record retrieved from the database. + ' Me.COUNTRY is the ASP:DropDownList on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetCOUNTRY() + ' and add your own code before or after the call to the MyBase function. + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.COUNTRYSpecified Then + + ' If the COUNTRY is non-NULL, then format the value. + ' The Format method will return the Display Foreign Key As (DFKA) value + Me.PopulateCOUNTRYDropDownList(Me.DataSource.COUNTRY.ToString(), 100) + + Else + + ' COUNTRY 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.PopulateCOUNTRYDropDownList(Nothing, 100) + Else + Me.PopulateCOUNTRYDropDownList(PersonalEducationTable.COUNTRY.DefaultValue, 100) + End If + + End If + + End Sub + + Public Overridable Sub SetCourse() + + + ' Set the Course TextBox on the webpage with value from the + ' PersonalEducation database record. + + ' Me.DataSource is the PersonalEducation record retrieved from the database. + ' Me.Course is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetCourse() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.CourseSpecified Then + + ' If the Course is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalEducationTable.Course) + + Me.Course.Text = formattedValue + + Else + + ' Course is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.Course.Text = PersonalEducationTable.Course.Format(PersonalEducationTable.Course.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetCourseAbbr() + + + ' Set the CourseAbbr TextBox on the webpage with value from the + ' PersonalEducation database record. + + ' Me.DataSource is the PersonalEducation record retrieved from the database. + ' Me.CourseAbbr is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetCourseAbbr() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.CourseAbbrSpecified Then + + ' If the CourseAbbr is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalEducationTable.CourseAbbr) + + Me.CourseAbbr.Text = formattedValue + + Else + + ' CourseAbbr is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.CourseAbbr.Text = PersonalEducationTable.CourseAbbr.Format(PersonalEducationTable.CourseAbbr.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetCourseNo() + + + ' Set the CourseNo TextBox on the webpage with value from the + ' PersonalEducation database record. + + ' Me.DataSource is the PersonalEducation record retrieved from the database. + ' Me.CourseNo is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetCourseNo() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.CourseNoSpecified Then + + ' If the CourseNo is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalEducationTable.CourseNo) + + Me.CourseNo.Text = formattedValue + + Else + + ' CourseNo is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.CourseNo.Text = PersonalEducationTable.CourseNo.Format(PersonalEducationTable.CourseNo.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetEducationPeriod() + + + ' Set the EducationPeriod DropDownList on the webpage with value from the + ' PersonalEducation database record. + + ' Me.DataSource is the PersonalEducation record retrieved from the database. + ' Me.EducationPeriod is the ASP:DropDownList on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetEducationPeriod() + ' and add your own code before or after the call to the MyBase function. + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.EducationPeriodSpecified Then + + ' If the EducationPeriod is non-NULL, then format the value. + ' The Format method will return the Display Foreign Key As (DFKA) value + Me.PopulateEducationPeriodDropDownList(Me.DataSource.EducationPeriod.ToString(), 100) + + Else + + ' EducationPeriod 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.PopulateEducationPeriodDropDownList(Nothing, 100) + Else + Me.PopulateEducationPeriodDropDownList(PersonalEducationTable.EducationPeriod.DefaultValue, 100) + End If + + End If + + End Sub + + Public Overridable Sub SetEducationType() + + + ' Set the EducationType DropDownList on the webpage with value from the + ' PersonalEducation database record. + + ' Me.DataSource is the PersonalEducation record retrieved from the database. + ' Me.EducationType is the ASP:DropDownList on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetEducationType() + ' and add your own code before or after the call to the MyBase function. + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.EducationTypeSpecified Then + + ' If the EducationType is non-NULL, then format the value. + ' The Format method will use the Display Format + Me.PopulateEducationTypeDropDownList(Me.DataSource.EducationType.ToString(), 100) + + Else + + ' EducationType 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.PopulateEducationTypeDropDownList(Nothing, 100) + Else + Me.PopulateEducationTypeDropDownList(PersonalEducationTable.EducationType.DefaultValue, 100) + End If + + End If + + End Sub + + Public Overridable Sub SetEdYear() + + + ' Set the EdYear TextBox on the webpage with value from the + ' PersonalEducation database record. + + ' Me.DataSource is the PersonalEducation record retrieved from the database. + ' Me.EdYear is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetEdYear() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.EdYearSpecified Then + + ' If the EdYear is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalEducationTable.EdYear) + + Me.EdYear.Text = formattedValue + + Else + + ' EdYear is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.EdYear.Text = PersonalEducationTable.EdYear.Format(PersonalEducationTable.EdYear.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetEndDate() + + + ' Set the EndDate TextBox on the webpage with value from the + ' PersonalEducation database record. + + ' Me.DataSource is the PersonalEducation record retrieved from the database. + ' Me.EndDate is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetEndDate() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.EndDateSpecified Then + + ' If the EndDate is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalEducationTable.EndDate, "d MMM yy") + + Me.EndDate.Text = formattedValue + + Else + + ' EndDate is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.EndDate.Text = PersonalEducationTable.EndDate.Format(PersonalEducationTable.EndDate.DefaultValue, "d MMM yy") + + End If + + End Sub + + Public Overridable Sub SetFacultry() + + + ' Set the Facultry TextBox on the webpage with value from the + ' PersonalEducation database record. + + ' Me.DataSource is the PersonalEducation record retrieved from the database. + ' Me.Facultry is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetFacultry() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.FacultrySpecified Then + + ' If the Facultry is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalEducationTable.Facultry) + + Me.Facultry.Text = formattedValue + + Else + + ' Facultry is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.Facultry.Text = PersonalEducationTable.Facultry.Format(PersonalEducationTable.Facultry.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetInstitue() + + + ' Set the Institue TextBox on the webpage with value from the + ' PersonalEducation database record. + + ' Me.DataSource is the PersonalEducation record retrieved from the database. + ' Me.Institue is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetInstitue() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.InstitueSpecified Then + + ' If the Institue is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalEducationTable.Institue) + + Me.Institue.Text = formattedValue + + Else + + ' Institue is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.Institue.Text = PersonalEducationTable.Institue.Format(PersonalEducationTable.Institue.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetLevelId() + + + ' Set the LevelId DropDownList on the webpage with value from the + ' PersonalEducation database record. + + ' Me.DataSource is the PersonalEducation record retrieved from the database. + ' Me.LevelId is the ASP:DropDownList on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetLevelId() + ' and add your own code before or after the call to the MyBase function. + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.LevelIdSpecified Then + + ' If the LevelId is non-NULL, then format the value. + ' The Format method will return the Display Foreign Key As (DFKA) value + Me.PopulateLevelIdDropDownList(Me.DataSource.LevelId.ToString(), 100) + + Else + + ' LevelId 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.PopulateLevelIdDropDownList(Nothing, 100) + Else + Me.PopulateLevelIdDropDownList(PersonalEducationTable.LevelId.DefaultValue, 100) + End If + + End If + + End Sub + + Public Overridable Sub SetNoAll() + + + ' Set the NoAll TextBox on the webpage with value from the + ' PersonalEducation database record. + + ' Me.DataSource is the PersonalEducation record retrieved from the database. + ' Me.NoAll is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetNoAll() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.NoAllSpecified Then + + ' If the NoAll is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalEducationTable.NoAll) + + Me.NoAll.Text = formattedValue + + Else + + ' NoAll is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.NoAll.Text = PersonalEducationTable.NoAll.Format(PersonalEducationTable.NoAll.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetPersonalId() + + + ' Set the PersonalId Label on the webpage with value from the + ' PersonalEducation database record. + + ' Me.DataSource is the PersonalEducation record retrieved from the database. + ' Me.PersonalId is the ASP:Label on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetPersonalId() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.PersonalIdSpecified Then + + ' If the PersonalId is non-NULL, then format the value. + + ' The Format method will return the Display Foreign Key As (DFKA) value + Dim formattedValue As String = "" + Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalEducationTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalEducationTable.PersonalId) + If _isExpandableNonCompositeForeignKey AndAlso PersonalEducationTable.PersonalId.IsApplyDisplayAs Then + + formattedValue = PersonalEducationTable.GetDFKA(Me.DataSource.PersonalId.ToString(),PersonalEducationTable.PersonalId, Nothing) + + if (formattedValue Is Nothing) Then + formattedValue = Me.DataSource.Format(PersonalEducationTable.PersonalId) + End If + Else + formattedValue = Me.DataSource.PersonalId.ToString() + End If + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.PersonalId.Text = formattedValue + + Else + + ' PersonalId is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.PersonalId.Text = PersonalEducationTable.PersonalId.Format(PersonalEducationTable.PersonalId.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetScore() + + + ' Set the Score TextBox on the webpage with value from the + ' PersonalEducation database record. + + ' Me.DataSource is the PersonalEducation record retrieved from the database. + ' Me.Score is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetScore() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.ScoreSpecified Then + + ' If the Score is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalEducationTable.Score) + + Me.Score.Text = formattedValue + + Else + + ' Score is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.Score.Text = PersonalEducationTable.Score.Format(PersonalEducationTable.Score.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetScoreNo() + + + ' Set the ScoreNo TextBox on the webpage with value from the + ' PersonalEducation database record. + + ' Me.DataSource is the PersonalEducation record retrieved from the database. + ' Me.ScoreNo is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetScoreNo() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.ScoreNoSpecified Then + + ' If the ScoreNo is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalEducationTable.ScoreNo) + + Me.ScoreNo.Text = formattedValue + + Else + + ' ScoreNo is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.ScoreNo.Text = PersonalEducationTable.ScoreNo.Format(PersonalEducationTable.ScoreNo.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetStartDate() + + + ' Set the StartDate TextBox on the webpage with value from the + ' PersonalEducation database record. + + ' Me.DataSource is the PersonalEducation record retrieved from the database. + ' Me.StartDate is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetStartDate() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.StartDateSpecified Then + + ' If the StartDate is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalEducationTable.StartDate, "d MMM yy") + + Me.StartDate.Text = formattedValue + + Else + + ' StartDate is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.StartDate.Text = PersonalEducationTable.StartDate.Format(PersonalEducationTable.StartDate.DefaultValue, "d MMM yy") + + End If + + End Sub + + Public Overridable Sub SetCommandDateLabel() + + End Sub + + Public Overridable Sub SetCommandLabel() + + End Sub + + Public Overridable Sub SetCOUNTRYLabel() + + End Sub + + Public Overridable Sub SetCourseAbbrLabel() + + End Sub + + Public Overridable Sub SetCourseLabel() + + End Sub + + Public Overridable Sub SetCourseNoLabel() + + End Sub + + Public Overridable Sub SetEducationPeriodLabel() + + End Sub + + Public Overridable Sub SetEducationTypeLabel() + + End Sub + + Public Overridable Sub SetEdYearLabel() + + End Sub + + Public Overridable Sub SetEndDateLabel() + + End Sub + + Public Overridable Sub SetFacultryLabel() + + End Sub + + Public Overridable Sub SetInstitueLabel() + + End Sub + + Public Overridable Sub SetLevelIdLabel() + + End Sub + + Public Overridable Sub SetNoAllLabel() + + End Sub + + Public Overridable Sub SetPersonalEducationRecordControlCollapsibleRegion() + + End Sub + + Public Overridable Sub SetPersonalEducationRecordControlIcon() + + End Sub + + Public Overridable Sub SetPersonalEducationRecordControlPanelExtender() + + End Sub + + Public Overridable Sub SetPersonalIdLabel() + + End Sub + + Public Overridable Sub SetScoreLabel() + + End Sub + + Public Overridable Sub SetScoreNoLabel() + + End Sub + + Public Overridable Sub SetStartDateLabel() + + 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 PersonalEducationRecordControl. + 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, "PersonalEducationRecordControlPanel"), 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 PersonalEducationRecordControl. + Public Overridable Sub GetUIData() + ' The GetUIData method retrieves the updated values from the user interface + ' controls into a database record in preparation for saving or updating. + ' To do this, it calls the Get methods for each of the field displayed on + ' the webpage. It is better to make changes in the Get methods, rather + ' than making changes here. + + ' Call the Get methods for each of the user interface controls. + + GetCommand() + GetCommandDate() + GetCOUNTRY() + GetCourse() + GetCourseAbbr() + GetCourseNo() + GetEducationPeriod() + GetEducationType() + GetEdYear() + GetEndDate() + GetFacultry() + GetInstitue() + GetLevelId() + GetNoAll() + GetPersonalId() + GetScore() + GetScoreNo() + GetStartDate() + End Sub + + + Public Overridable Sub GetCommand() + + ' Retrieve the value entered by the user on the Command ASP:TextBox, and + ' save it into the Command field in DataSource PersonalEducation record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.Command.Text, PersonalEducationTable.Command) + + + End Sub + + Public Overridable Sub GetCommandDate() + + ' Retrieve the value entered by the user on the CommandDate ASP:TextBox, and + ' save it into the CommandDate field in DataSource PersonalEducation 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.CommandDate.Text, PersonalEducationTable.CommandDate) + + + End Sub + + Public Overridable Sub GetCOUNTRY() + + ' Retrieve the value entered by the user on the COUNTRY ASP:DropDownList, and + ' save it into the COUNTRY field in DataSource PersonalEducation record. + + ' Custom validation should be performed in Validate, not here. + + Me.DataSource.Parse(GetValueSelectedPageRequest(Me.COUNTRY), PersonalEducationTable.COUNTRY) + + End Sub + + Public Overridable Sub GetCourse() + + ' Retrieve the value entered by the user on the Course ASP:TextBox, and + ' save it into the Course field in DataSource PersonalEducation record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.Course.Text, PersonalEducationTable.Course) + + + End Sub + + Public Overridable Sub GetCourseAbbr() + + ' Retrieve the value entered by the user on the CourseAbbr ASP:TextBox, and + ' save it into the CourseAbbr field in DataSource PersonalEducation record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.CourseAbbr.Text, PersonalEducationTable.CourseAbbr) + + + End Sub + + Public Overridable Sub GetCourseNo() + + ' Retrieve the value entered by the user on the CourseNo ASP:TextBox, and + ' save it into the CourseNo field in DataSource PersonalEducation record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.CourseNo.Text, PersonalEducationTable.CourseNo) + + + End Sub + + Public Overridable Sub GetEducationPeriod() + + ' Retrieve the value entered by the user on the EducationPeriod ASP:DropDownList, and + ' save it into the EducationPeriod field in DataSource PersonalEducation record. + + ' Custom validation should be performed in Validate, not here. + + Me.DataSource.Parse(GetValueSelectedPageRequest(Me.EducationPeriod), PersonalEducationTable.EducationPeriod) + + End Sub + + Public Overridable Sub GetEducationType() + + ' Retrieve the value entered by the user on the EducationType ASP:DropDownList, and + ' save it into the EducationType field in DataSource PersonalEducation record. + + ' Custom validation should be performed in Validate, not here. + + Me.DataSource.Parse(GetValueSelectedPageRequest(Me.EducationType), PersonalEducationTable.EducationType) + + End Sub + + Public Overridable Sub GetEdYear() + + ' Retrieve the value entered by the user on the EdYear ASP:TextBox, and + ' save it into the EdYear field in DataSource PersonalEducation record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.EdYear.Text, PersonalEducationTable.EdYear) + + + End Sub + + Public Overridable Sub GetEndDate() + + ' Retrieve the value entered by the user on the EndDate ASP:TextBox, and + ' save it into the EndDate field in DataSource PersonalEducation 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.EndDate.Text, PersonalEducationTable.EndDate) + + + End Sub + + Public Overridable Sub GetFacultry() + + ' Retrieve the value entered by the user on the Facultry ASP:TextBox, and + ' save it into the Facultry field in DataSource PersonalEducation record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.Facultry.Text, PersonalEducationTable.Facultry) + + + End Sub + + Public Overridable Sub GetInstitue() + + ' Retrieve the value entered by the user on the Institue ASP:TextBox, and + ' save it into the Institue field in DataSource PersonalEducation record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.Institue.Text, PersonalEducationTable.Institue) + + + End Sub + + Public Overridable Sub GetLevelId() + + ' Retrieve the value entered by the user on the LevelId ASP:DropDownList, and + ' save it into the LevelId field in DataSource PersonalEducation record. + + ' Custom validation should be performed in Validate, not here. + + Me.DataSource.Parse(GetValueSelectedPageRequest(Me.LevelId), PersonalEducationTable.LevelId) + + End Sub + + Public Overridable Sub GetNoAll() + + ' Retrieve the value entered by the user on the NoAll ASP:TextBox, and + ' save it into the NoAll field in DataSource PersonalEducation record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.NoAll.Text, PersonalEducationTable.NoAll) + + + End Sub + + Public Overridable Sub GetPersonalId() + + End Sub + + Public Overridable Sub GetScore() + + ' Retrieve the value entered by the user on the Score ASP:TextBox, and + ' save it into the Score field in DataSource PersonalEducation record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.Score.Text, PersonalEducationTable.Score) + + + End Sub + + Public Overridable Sub GetScoreNo() + + ' Retrieve the value entered by the user on the ScoreNo ASP:TextBox, and + ' save it into the ScoreNo field in DataSource PersonalEducation record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.ScoreNo.Text, PersonalEducationTable.ScoreNo) + + + End Sub + + Public Overridable Sub GetStartDate() + + ' Retrieve the value entered by the user on the StartDate ASP:TextBox, and + ' save it into the StartDate field in DataSource PersonalEducation 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.StartDate.Text, PersonalEducationTable.StartDate) + + + End Sub + + + ' To customize, override this method in PersonalEducationRecordControl. + + Public Overridable Function CreateWhereClause() As WhereClause + + Dim wc As WhereClause + PersonalEducationTable.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("PersonalEducation") + + 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}", "PersonalEducation")) + End If + HttpContext.Current.Session("QueryString in EditPersonalEducation") = 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(PersonalEducationTable.EducationId, BaseFilter.ComparisonOperator.EqualsTo, pkValue.GetColumnValueString(PersonalEducationTable.EducationId)) + + Else + ' The URL parameter contains the actual value, not an XML structure. + + wc.iAND(PersonalEducationTable.EducationId, 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 + PersonalEducationTable.Instance.InnerFilter = Nothing + Dim wc As WhereClause = New WhereClause() + + ' Compose the WHERE clause consiting of: + ' 1. Static clause defined at design time. + ' 2. User selected 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 PersonalEducationRecordControl. + Public Overridable Sub Validate() + ' Add custom validation for any control within this panel. + ' Example. If you have a State ASP:Textbox control + ' If Me.State.Text <> "CA" Then + ' Throw New Exception("State must be CA (California).") + ' End If + + ' The Validate method is common across all controls within + ' this panel so you can validate multiple fields, but report + ' one error message. + + + End Sub + + Public Overridable Sub Delete() + + If Me.IsNewRecord() Then + Return + End If + + Dim pkValue As KeyValue = KeyValue.XmlToKey(Me.RecordUniqueId) + PersonalEducationTable.DeleteRecord(pkValue) + + 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_COUNTRYDropDownList() 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 Country table. + ' Examples: + ' wc.iAND(CountryTable.Country, BaseFilter.ComparisonOperator.EqualsTo, "XYZ") + ' wc.iAND(CountryTable.Active, BaseFilter.ComparisonOperator.EqualsTo, "1") + + Dim wc As WhereClause = New WhereClause() + Return wc + + End Function + + + + Public Overridable Function CreateWhereClause_EducationPeriodDropDownList() 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 EducationPeriod table. + ' Examples: + ' wc.iAND(EducationPeriodTable.Period, BaseFilter.ComparisonOperator.EqualsTo, "XYZ") + ' wc.iAND(EducationPeriodTable.Active, BaseFilter.ComparisonOperator.EqualsTo, "1") + + Dim wc As WhereClause = New WhereClause() + Return wc + + End Function + + + + Public Overridable Function CreateWhereClause_EducationTypeDropDownList() As WhereClause + ' By default, we simply return a new WhereClause. + ' Add additional where clauses to restrict the items shown in the dropdown list. + + Dim wc As WhereClause = New WhereClause() + Return wc + + End Function + + + + Public Overridable Function CreateWhereClause_LevelIdDropDownList() 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 Education table. + ' Examples: + ' wc.iAND(EducationTable.Level, BaseFilter.ComparisonOperator.EqualsTo, "XYZ") + ' wc.iAND(EducationTable.Active, BaseFilter.ComparisonOperator.EqualsTo, "1") + + Dim wc As WhereClause = New WhereClause() + Return wc + + End Function + + + ' Fill the COUNTRY list. + Protected Overridable Sub PopulateCOUNTRYDropDownList( _ + ByVal selectedValue As String, _ + ByVal maxItems As Integer) + + Me.COUNTRY.Items.Clear() + + + ' 1. Setup the static list items + + ' Add the Please Select item. + Me.COUNTRY.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_COUNTRYDropDownList function. + ' It is better to customize the where clause there. + + Dim wc As WhereClause = CreateWhereClause_COUNTRYDropDownList() + ' Create the ORDER BY clause to sort based on the displayed value. + + + Dim orderBy As OrderBy = New OrderBy(false, false) + orderBy.Add(CountryTable.Country, OrderByItem.OrderDir.Asc) + + Dim variables As System.Collections.Generic.IDictionary(Of String, Object) = New System.Collections.Generic.Dictionary(Of String, Object) + + ' 3. Read a total of maxItems from the database and insert them + Dim itemValues() As CountryRecord = 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 = CountryTable.GetRecords(wc, orderBy, pageNum, maxItems) + For each itemValue As CountryRecord In itemValues + ' Create the item and add to the list. + Dim cvalue As String = Nothing + Dim fvalue As String = Nothing + If itemValue.CountryIdSpecified Then + cvalue = itemValue.CountryId.ToString() + + If counter < maxItems AndAlso Me.COUNTRY.Items.FindByValue(cvalue) Is Nothing Then + + Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalEducationTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalEducationTable.COUNTRY) + If _isExpandableNonCompositeForeignKey AndAlso PersonalEducationTable.COUNTRY.IsApplyDisplayAs Then + fvalue = PersonalEducationTable.GetDFKA(itemValue, PersonalEducationTable.COUNTRY) + End If + If (Not _isExpandableNonCompositeForeignKey) Or (String.IsNullOrEmpty(fvalue)) Then + fvalue = itemValue.Format(CountryTable.Country) + End If + + If fvalue Is Nothing OrElse fvalue.Trim() = "" Then fvalue = cvalue + + If (IsNothing(fvalue)) Then + fvalue = "" + End If + + fvalue = fvalue.Trim() + + If ( fvalue.Length > 50 ) Then + fvalue = fvalue.Substring(0, 50) & "..." + End If + + Dim dupItem As ListItem = Me.COUNTRY.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.COUNTRY.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.COUNTRY, selectedValue) AndAlso _ + Not SetSelectedDisplayText(Me.COUNTRY, selectedValue)Then + + ' construct a whereclause to query a record with Country.CountryId = selectedValue + Dim filter2 As CompoundFilter = New CompoundFilter(CompoundFilter.CompoundingOperators.And_Operator, Nothing) + Dim whereClause2 As WhereClause = New WhereClause() + filter2.AddFilter(New BaseClasses.Data.ColumnValueFilter(CountryTable.CountryId, selectedValue, BaseClasses.Data.BaseFilter.ComparisonOperator.EqualsTo, False)) + whereClause2.AddFilter(filter2, CompoundFilter.CompoundingOperators.And_Operator) + + Try + ' Execute the query + Dim rc() As CountryRecord = CountryTable.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 CountryRecord = DirectCast(rc(0), CountryRecord) + ' Create the item and add to the list. + Dim cvalue As String = Nothing + Dim fvalue As String = Nothing + If itemValue.CountryIdSpecified Then + cvalue = itemValue.CountryId.ToString() + Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalEducationTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalEducationTable.COUNTRY) + If _isExpandableNonCompositeForeignKey AndAlso PersonalEducationTable.COUNTRY.IsApplyDisplayAs Then + fvalue = PersonalEducationTable.GetDFKA(itemValue, PersonalEducationTable.COUNTRY) + End If + If (Not _isExpandableNonCompositeForeignKey) Or (String.IsNullOrEmpty(fvalue)) Then + fvalue = itemValue.Format(CountryTable.Country) + End If + + If fvalue Is Nothing OrElse fvalue.Trim() = "" Then fvalue = cvalue + Dim newItem As New ListItem(fvalue, cvalue) + Me.COUNTRY.Items.Add(newItem) + SetSelectedValue(Me.COUNTRY, selectedValue) + End If + End If + Catch + End Try + + End If + + + End Sub + + ' Fill the EducationPeriod list. + Protected Overridable Sub PopulateEducationPeriodDropDownList( _ + ByVal selectedValue As String, _ + ByVal maxItems As Integer) + + Me.EducationPeriod.Items.Clear() + + + ' 1. Setup the static list items + + ' Add the Please Select item. + Me.EducationPeriod.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_EducationPeriodDropDownList function. + ' It is better to customize the where clause there. + + Dim wc As WhereClause = CreateWhereClause_EducationPeriodDropDownList() + ' Create the ORDER BY clause to sort based on the displayed value. + + + Dim orderBy As OrderBy = New OrderBy(false, false) + orderBy.Add(EducationPeriodTable.Period, 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 EducationPeriodRecord = 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 = EducationPeriodTable.GetRecords(wc, orderBy, pageNum, maxItems) + For each itemValue As EducationPeriodRecord In itemValues + ' Create the item and add to the list. + Dim cvalue As String = Nothing + Dim fvalue As String = Nothing + If itemValue.PeriodIdSpecified Then + cvalue = itemValue.PeriodId.ToString() + + If counter < maxItems AndAlso Me.EducationPeriod.Items.FindByValue(cvalue) Is Nothing Then + + Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalEducationTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalEducationTable.EducationPeriod) + If _isExpandableNonCompositeForeignKey AndAlso PersonalEducationTable.EducationPeriod.IsApplyDisplayAs Then + fvalue = PersonalEducationTable.GetDFKA(itemValue, PersonalEducationTable.EducationPeriod) + End If + If (Not _isExpandableNonCompositeForeignKey) Or (String.IsNullOrEmpty(fvalue)) Then + fvalue = itemValue.Format(EducationPeriodTable.Period) + 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.EducationPeriod.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.EducationPeriod.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.EducationPeriod, selectedValue) AndAlso _ + Not SetSelectedDisplayText(Me.EducationPeriod, selectedValue)Then + + ' construct a whereclause to query a record with EducationPeriod.PeriodId = selectedValue + Dim filter2 As CompoundFilter = New CompoundFilter(CompoundFilter.CompoundingOperators.And_Operator, Nothing) + Dim whereClause2 As WhereClause = New WhereClause() + filter2.AddFilter(New BaseClasses.Data.ColumnValueFilter(EducationPeriodTable.PeriodId, selectedValue, BaseClasses.Data.BaseFilter.ComparisonOperator.EqualsTo, False)) + whereClause2.AddFilter(filter2, CompoundFilter.CompoundingOperators.And_Operator) + + Try + ' Execute the query + Dim rc() As EducationPeriodRecord = EducationPeriodTable.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 EducationPeriodRecord = DirectCast(rc(0), EducationPeriodRecord) + ' Create the item and add to the list. + Dim cvalue As String = Nothing + Dim fvalue As String = Nothing + If itemValue.PeriodIdSpecified Then + cvalue = itemValue.PeriodId.ToString() + Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalEducationTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalEducationTable.EducationPeriod) + If _isExpandableNonCompositeForeignKey AndAlso PersonalEducationTable.EducationPeriod.IsApplyDisplayAs Then + fvalue = PersonalEducationTable.GetDFKA(itemValue, PersonalEducationTable.EducationPeriod) + End If + If (Not _isExpandableNonCompositeForeignKey) Or (String.IsNullOrEmpty(fvalue)) Then + fvalue = itemValue.Format(EducationPeriodTable.Period) + End If + + If fvalue Is Nothing OrElse fvalue.Trim() = "" Then fvalue = cvalue + Dim newItem As New ListItem(fvalue, cvalue) + Me.EducationPeriod.Items.Add(newItem) + SetSelectedValue(Me.EducationPeriod, selectedValue) + End If + End If + Catch + End Try + + End If + + + End Sub + + ' Fill the EducationType list. + Protected Overridable Sub PopulateEducationTypeDropDownList( _ + ByVal selectedValue As String, _ + ByVal maxItems As Integer) + + Me.EducationType.Items.Clear() + + + ' 1. Setup the static list items + + Me.EducationType.Items.Add(New ListItem(Me.Page.ExpandResourceValue("{Txt:PleaseSelect}"), "--PLEASE_SELECT--")) + + Me.EducationType.Items.Add(New ListItem(Me.Page.ExpandResourceValue("1"), "1")) + + Me.EducationType.Items.Add(New ListItem(Me.Page.ExpandResourceValue("2"), "2")) + + ' Skip step 2 and 3 because no need to load data from database and insert data + + + ' 4. Set the selected value (insert if not already present). + + If Not selectedValue Is Nothing AndAlso _ + selectedValue.Trim <> "" AndAlso _ + Not SetSelectedValue(Me.EducationType, selectedValue) AndAlso _ + Not SetSelectedDisplayText(Me.EducationType, selectedValue) AndAlso _ + Not SetSelectedDisplayText(Me.EducationType, PersonalEducationTable.EducationType.Format(selectedValue))Then + Dim fvalue As String = PersonalEducationTable.EducationType.Format(selectedValue) + If fvalue Is Nothing OrElse fvalue.Trim() = "" Then fvalue = selectedValue + Dim item As ListItem = New ListItem(fvalue, selectedValue) + item.Selected = True + Me.EducationType.Items.Add(item) + End If + + + End Sub + + ' Fill the LevelId list. + Protected Overridable Sub PopulateLevelIdDropDownList( _ + ByVal selectedValue As String, _ + ByVal maxItems As Integer) + + Me.LevelId.Items.Clear() + + + ' 1. Setup the static list items + + ' Add the Please Select item. + Me.LevelId.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_LevelIdDropDownList function. + ' It is better to customize the where clause there. + + Dim wc As WhereClause = CreateWhereClause_LevelIdDropDownList() + ' Create the ORDER BY clause to sort based on the displayed value. + + + Dim orderBy As OrderBy = New OrderBy(false, false) + orderBy.Add(EducationTable.Level, OrderByItem.OrderDir.Asc) + + Dim variables As System.Collections.Generic.IDictionary(Of String, Object) = New System.Collections.Generic.Dictionary(Of String, Object) + + ' 3. Read a total of maxItems from the database and insert them + Dim itemValues() As EducationRecord = 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 = EducationTable.GetRecords(wc, orderBy, pageNum, maxItems) + For each itemValue As EducationRecord In itemValues + ' Create the item and add to the list. + Dim cvalue As String = Nothing + Dim fvalue As String = Nothing + If itemValue.EducationIdSpecified Then + cvalue = itemValue.EducationId.ToString() + + If counter < maxItems AndAlso Me.LevelId.Items.FindByValue(cvalue) Is Nothing Then + + Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalEducationTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalEducationTable.LevelId) + If _isExpandableNonCompositeForeignKey AndAlso PersonalEducationTable.LevelId.IsApplyDisplayAs Then + fvalue = PersonalEducationTable.GetDFKA(itemValue, PersonalEducationTable.LevelId) + End If + If (Not _isExpandableNonCompositeForeignKey) Or (String.IsNullOrEmpty(fvalue)) Then + fvalue = itemValue.Format(EducationTable.Level) + End If + + If fvalue Is Nothing OrElse fvalue.Trim() = "" Then fvalue = cvalue + + If (IsNothing(fvalue)) Then + fvalue = "" + End If + + fvalue = fvalue.Trim() + + If ( fvalue.Length > 50 ) Then + fvalue = fvalue.Substring(0, 50) & "..." + End If + + Dim dupItem As ListItem = Me.LevelId.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.LevelId.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.LevelId, selectedValue) AndAlso _ + Not SetSelectedDisplayText(Me.LevelId, selectedValue)Then + + ' construct a whereclause to query a record with Education.EducationId = selectedValue + Dim filter2 As CompoundFilter = New CompoundFilter(CompoundFilter.CompoundingOperators.And_Operator, Nothing) + Dim whereClause2 As WhereClause = New WhereClause() + filter2.AddFilter(New BaseClasses.Data.ColumnValueFilter(EducationTable.EducationId, selectedValue, BaseClasses.Data.BaseFilter.ComparisonOperator.EqualsTo, False)) + whereClause2.AddFilter(filter2, CompoundFilter.CompoundingOperators.And_Operator) + + Try + ' Execute the query + Dim rc() As EducationRecord = EducationTable.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 EducationRecord = DirectCast(rc(0), EducationRecord) + ' Create the item and add to the list. + Dim cvalue As String = Nothing + Dim fvalue As String = Nothing + If itemValue.EducationIdSpecified Then + cvalue = itemValue.EducationId.ToString() + Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalEducationTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalEducationTable.LevelId) + If _isExpandableNonCompositeForeignKey AndAlso PersonalEducationTable.LevelId.IsApplyDisplayAs Then + fvalue = PersonalEducationTable.GetDFKA(itemValue, PersonalEducationTable.LevelId) + End If + If (Not _isExpandableNonCompositeForeignKey) Or (String.IsNullOrEmpty(fvalue)) Then + fvalue = itemValue.Format(EducationTable.Level) + End If + + If fvalue Is Nothing OrElse fvalue.Trim() = "" Then fvalue = cvalue + Dim newItem As New ListItem(fvalue, cvalue) + Me.LevelId.Items.Add(newItem) + SetSelectedValue(Me.LevelId, selectedValue) + End If + End If + Catch + End Try + + End If + + + End Sub + + Protected Overridable Sub COUNTRY_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()(COUNTRY.ClientID & "_SelectedValue"), String) + Dim displayText As String = CType(Me.Page.Session()(COUNTRY.ClientID & "_SelectedDisplayText"), String) + If displayText <> "" AndAlso val <> "" Then + Me.COUNTRY.Items.Add(New ListItem(displayText, val)) + Me.COUNTRY.SelectedIndex = Me.COUNTRY.Items.Count - 1 + Me.Page.Session.Remove(COUNTRY.ClientID & "_SelectedValue") + Me.Page.Session.Remove(COUNTRY.ClientID & "_SelectedDisplayText") + End If + + + + + End Sub + + Protected Overridable Sub EducationPeriod_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()(EducationPeriod.ClientID & "_SelectedValue"), String) + Dim displayText As String = CType(Me.Page.Session()(EducationPeriod.ClientID & "_SelectedDisplayText"), String) + If displayText <> "" AndAlso val <> "" Then + Me.EducationPeriod.Items.Add(New ListItem(displayText, val)) + Me.EducationPeriod.SelectedIndex = Me.EducationPeriod.Items.Count - 1 + Me.Page.Session.Remove(EducationPeriod.ClientID & "_SelectedValue") + Me.Page.Session.Remove(EducationPeriod.ClientID & "_SelectedDisplayText") + End If + + + + + End Sub + + Protected Overridable Sub EducationType_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()(EducationType.ClientID & "_SelectedValue"), String) + Dim displayText As String = CType(Me.Page.Session()(EducationType.ClientID & "_SelectedDisplayText"), String) + If displayText <> "" AndAlso val <> "" Then + Me.EducationType.Items.Add(New ListItem(displayText, val)) + Me.EducationType.SelectedIndex = Me.EducationType.Items.Count - 1 + Me.Page.Session.Remove(EducationType.ClientID & "_SelectedValue") + Me.Page.Session.Remove(EducationType.ClientID & "_SelectedDisplayText") + End If + + + + + End Sub + + Protected Overridable Sub LevelId_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()(LevelId.ClientID & "_SelectedValue"), String) + Dim displayText As String = CType(Me.Page.Session()(LevelId.ClientID & "_SelectedDisplayText"), String) + If displayText <> "" AndAlso val <> "" Then + Me.LevelId.Items.Add(New ListItem(displayText, val)) + Me.LevelId.SelectedIndex = Me.LevelId.Items.Count - 1 + Me.Page.Session.Remove(LevelId.ClientID & "_SelectedValue") + Me.Page.Session.Remove(LevelId.ClientID & "_SelectedDisplayText") + End If + + + + + End Sub + + Protected Overridable Sub Command_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub CommandDate_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub Course_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub CourseAbbr_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub CourseNo_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub EdYear_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub EndDate_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub Facultry_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub Institue_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub NoAll_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub Score_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub ScoreNo_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub StartDate_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("BasePersonalEducationRecordControl_Rec"), String) + End Get + Set(ByVal value As String) + Me.ViewState("BasePersonalEducationRecordControl_Rec") = value + End Set + End Property + + Private _DataSource As PersonalEducationRecord + Public Property DataSource() As PersonalEducationRecord + Get + Return Me._DataSource + End Get + + Set(ByVal value As PersonalEducationRecord) + + Me._DataSource = value + End Set + End Property + + + + Private _checkSum As String + Public Overridable Property CheckSum() As String + Get + Return Me._checkSum + End Get + Set(ByVal value As String) + Me._checkSum = value + End Set + End Property + + Private _TotalPages As Integer + Public Property TotalPages() As Integer + Get + Return Me._TotalPages + End Get + Set(ByVal value As Integer) + Me._TotalPages = value + End Set + End Property + + Private _PageIndex As Integer + Public Property PageIndex() As Integer + Get + ' Return the PageIndex + Return Me._PageIndex + End Get + Set(ByVal value As Integer) + Me._PageIndex = value + End Set + End Property + + Private _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 Command() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Command"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property CommandDate() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "CommandDate"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property CommandDateLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "CommandDateLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property CommandLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "CommandLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property COUNTRY() As System.Web.UI.WebControls.DropDownList + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "COUNTRY"), System.Web.UI.WebControls.DropDownList) + End Get + End Property + + Public ReadOnly Property COUNTRYLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "COUNTRYLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property Course() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Course"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property CourseAbbr() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "CourseAbbr"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property CourseAbbrLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "CourseAbbrLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property CourseLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "CourseLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property CourseNo() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "CourseNo"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property CourseNoLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "CourseNoLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property EducationPeriod() As System.Web.UI.WebControls.DropDownList + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "EducationPeriod"), System.Web.UI.WebControls.DropDownList) + End Get + End Property + + Public ReadOnly Property EducationPeriodLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "EducationPeriodLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property EducationType() As System.Web.UI.WebControls.DropDownList + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "EducationType"), System.Web.UI.WebControls.DropDownList) + End Get + End Property + + Public ReadOnly Property EducationTypeLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "EducationTypeLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property EdYear() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "EdYear"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property EdYearLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "EdYearLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property EndDate() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "EndDate"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property EndDateLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "EndDateLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property Facultry() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Facultry"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property FacultryLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "FacultryLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property Institue() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Institue"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property InstitueLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "InstitueLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property LevelId() As System.Web.UI.WebControls.DropDownList + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "LevelId"), System.Web.UI.WebControls.DropDownList) + End Get + End Property + + Public ReadOnly Property LevelIdLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "LevelIdLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property NoAll() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "NoAll"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property NoAllLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "NoAllLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property PersonalEducationRecordControlCollapsibleRegion() As System.Web.UI.WebControls.Panel + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalEducationRecordControlCollapsibleRegion"), System.Web.UI.WebControls.Panel) + End Get + End Property + + Public ReadOnly Property PersonalEducationRecordControlIcon() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalEducationRecordControlIcon"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalEducationRecordControlPanelExtender() As AjaxControlToolkit.CollapsiblePanelExtender + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalEducationRecordControlPanelExtender"), AjaxControlToolkit.CollapsiblePanelExtender) + End Get + End Property + + Public ReadOnly Property PersonalEducationTitle() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalEducationTitle"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property PersonalId() As System.Web.UI.WebControls.Label + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalId"), System.Web.UI.WebControls.Label) + End Get + End Property + + Public ReadOnly Property PersonalIdLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalIdLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property Score() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Score"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property ScoreLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "ScoreLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property ScoreNo() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "ScoreNo"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property ScoreNoLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "ScoreNoLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property StartDate() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "StartDate"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property StartDateLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "StartDateLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + +#End Region + +#Region "Helper Functions" + + Public Overrides Overloads Function ModifyRedirectUrl(ByVal url As String, ByVal arg As String, ByVal bEncrypt As Boolean) As String + Return Me.Page.EvaluateExpressions(url, arg, bEncrypt, Me) + End Function + + Public Overrides Overloads Function EvaluateExpressions(ByVal url As String, ByVal arg As String, ByVal bEncrypt As Boolean) As String + + Dim rec As PersonalEducationRecord = Nothing + + + Try + rec = Me.GetRecord() + Catch ex As Exception + ' Do nothing + End Try + + If rec Is Nothing AndAlso url.IndexOf("{") >= 0 Then + ' Localization. + + Throw New Exception(Page.GetResourceValue("Err:RecDataSrcNotInitialized", "Persons")) + + End If + Return EvaluateExpressions(url, arg, rec, bEncrypt) + End Function + + + Public Overridable Function GetRecord() As PersonalEducationRecord + If Not Me.DataSource Is Nothing Then + Return Me.DataSource + End If + + If Not Me.RecordUniqueId Is Nothing Then + + Return PersonalEducationTable.GetRecord(Me.RecordUniqueId, True) + + End If + + ' Localization. + + Throw New Exception(Page.GetResourceValue("Err:RetrieveRec", "Persons")) + + End Function + + Public Shadows ReadOnly Property Page() As BaseApplicationPage + Get + Return DirectCast(MyBase.Page, BaseApplicationPage) + End Get + End Property + +#End Region + +End Class + + + +#End Region + + +End Namespace + + \ No newline at end of file diff --git a/App_Code/PersonalEducation/EditPersonalEducationTable.Controls.vb b/App_Code/PersonalEducation/EditPersonalEducationTable.Controls.vb new file mode 100644 index 0000000..a4327e6 --- /dev/null +++ b/App_Code/PersonalEducation/EditPersonalEducationTable.Controls.vb @@ -0,0 +1,5504 @@ + +' This file implements the TableControl, TableControlRow, and RecordControl classes for the +' EditPersonalEducationTable.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.EditPersonalEducationTable + +#Region "Section 1: Place your customizations here." + + +Public Class PersonalEducationTableControlRow + Inherits BasePersonalEducationTableControlRow + ' The BasePersonalEducationTableControlRow implements code for a ROW within the + ' the PersonalEducationTableControl table. The BasePersonalEducationTableControlRow implements the DataBind and SaveData methods. + ' The loading of data is actually performed by the LoadData method in the base class of PersonalEducationTableControl. + + ' This is the ideal place to add your code customizations. For example, you can override the DataBind, + ' SaveData, GetUIData, and Validate methods. + + +End Class + + + +Public Class PersonalEducationTableControl + Inherits BasePersonalEducationTableControl + + ' The BasePersonalEducationTableControl class implements the LoadData, DataBind, CreateWhereClause + ' and other methods to load and display the data in a table control. + + ' This is the ideal place to add your code customizations. You can override the LoadData and CreateWhereClause, + ' The PersonalEducationTableControlRow class offers another place where you can customize + ' the DataBind, GetUIData, SaveData and Validate methods specific to each row displayed on the table. + +End Class + + + +#End Region + + + +#Region "Section 2: Do not modify this section." + + +' Base class for the PersonalEducationTableControlRow control on the EditPersonalEducationTable page. +' Do not modify this class. Instead override any method in PersonalEducationTableControlRow. +Public Class BasePersonalEducationTableControlRow + Inherits Persons.UI.BaseApplicationRecordControl + + ' To customize, override this method in PersonalEducationTableControlRow. + Protected Overridable Sub Control_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Init + + Me.ClearControlsFromSession() + End Sub + + ' To customize, override this method in PersonalEducationTableControlRow. + Protected Overridable Sub Control_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load + + 'Call LoadFocusScripts from repeater so that onfocus attribute could be added to elements + Me.Page.LoadFocusScripts(Me) + + ' Show confirmation message on Click + Me.PersonalEducationRowDeleteButton.Attributes.Add("onClick", "return (confirm('" & (CType(Me.Page,BaseApplicationPage)).GetResourceValue("DeleteRecordConfirm", "Persons") & "'));") + + + ' Register the event handlers. + + AddHandler Me.PersonalEducationRowDeleteButton.Click, AddressOf PersonalEducationRowDeleteButton_Click + + AddHandler Me.PersonalEducationRowEditButton.Click, AddressOf PersonalEducationRowEditButton_Click + + AddHandler Me.PersonalEducationRowViewButton.Click, AddressOf PersonalEducationRowViewButton_Click + + Me.PersonalIdAddRecordLink.PostBackUrl = "../PersonalId/AddPersonalId.aspx" & "?Target=" & Me.PersonalId.ClientID & "&DFKA=" & HttpUtility.UrlEncode("PersonalName") + Me.PersonalIdAddRecordLink.Attributes.Item("onClick") = "window.open('" & Me.PersonalIdAddRecordLink.PostBackUrl & "','_blank', 'width=900, height=700, resizable, scrollbars, modal=yes'); return false;" + + AddHandler Me.COUNTRY.SelectedIndexChanged, AddressOf COUNTRY_SelectedIndexChanged + + AddHandler Me.EducationType1.SelectedIndexChanged, AddressOf EducationType1_SelectedIndexChanged + + AddHandler Me.LevelId.SelectedIndexChanged, AddressOf LevelId_SelectedIndexChanged + + AddHandler Me.PersonalId.SelectedIndexChanged, AddressOf PersonalId_SelectedIndexChanged + + AddHandler Me.Command.TextChanged, AddressOf Command_TextChanged + + AddHandler Me.CommandDate.TextChanged, AddressOf CommandDate_TextChanged + + AddHandler Me.Course.TextChanged, AddressOf Course_TextChanged + + AddHandler Me.CourseAbbr.TextChanged, AddressOf CourseAbbr_TextChanged + + AddHandler Me.CourseNo.TextChanged, AddressOf CourseNo_TextChanged + + AddHandler Me.EducationPeriod.TextChanged, AddressOf EducationPeriod_TextChanged + + AddHandler Me.EducationType.TextChanged, AddressOf EducationType_TextChanged + + AddHandler Me.EdYear.TextChanged, AddressOf EdYear_TextChanged + + AddHandler Me.EndDate.TextChanged, AddressOf EndDate_TextChanged + + AddHandler Me.Facultry.TextChanged, AddressOf Facultry_TextChanged + + AddHandler Me.Institue.TextChanged, AddressOf Institue_TextChanged + + AddHandler Me.NoAll.TextChanged, AddressOf NoAll_TextChanged + + AddHandler Me.Score.TextChanged, AddressOf Score_TextChanged + + AddHandler Me.ScoreNo.TextChanged, AddressOf ScoreNo_TextChanged + + AddHandler Me.StartDate.TextChanged, AddressOf StartDate_TextChanged + + + End Sub + + + Public Overridable Sub LoadData() + + ' Load the data from the database into the DataSource PersonalEducation record. + ' It is better to make changes to functions called by LoadData such as + ' CreateWhereClause, rather than making changes here. + + ' The RecordUniqueId is set the first time a record is loaded, and is + ' used during a PostBack to load the record. + + If Me.RecordUniqueId IsNot Nothing AndAlso Me.RecordUniqueId.Trim <> "" Then + Me.DataSource = PersonalEducationTable.GetRecord(Me.RecordUniqueId, True) + + Return + End If + + ' Since this is a row in the table, the data for this row is loaded by the + ' LoadData method of the BasePersonalEducationTableControl when the data for the entire + ' table is loaded. + + Me.DataSource = New PersonalEducationRecord() + + + + End Sub + + ' Populate the UI controls using the DataSource. To customize, override this method in PersonalEducationTableControlRow. + Public Overrides Sub DataBind() + ' The DataBind method binds the user interface controls to the values + ' from the database record. To do this, it calls the Set methods for + ' each of the field displayed on the webpage. It is better to make + ' changes in the Set methods, rather than making changes here. + + MyBase.DataBind() + + ' Make sure that the DataSource is initialized. + If Me.DataSource Is Nothing Then + + Return + End If + + + 'LoadData for DataSource for chart and report if they exist + + + + ' Call the Set methods for each controls on the panel + + SetCommand() + SetCommandDate() + SetCOUNTRY() + SetCourse() + SetCourseAbbr() + SetCourseNo() + SetEducationPeriod() + SetEducationType() + SetEducationType1() + SetEdYear() + SetEndDate() + SetFacultry() + SetInstitue() + SetLevelId() + SetNoAll() + + + + + SetPersonalId() + + SetScore() + SetScoreNo() + SetStartDate() + + + Me.IsNewRecord = True + + If Me.DataSource.IsCreated Then + Me.IsNewRecord = False + + Me.RecordUniqueId = Me.DataSource.GetID.ToXmlString() + End If + + ' Now load data for each record and table child UI controls. + ' Ordering is important because child controls get + ' their parent ids from their parent UI controls. + Dim shouldResetControl As Boolean = False + + End Sub + + + Public Overridable Sub SetCommand() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.Command.ID) Then + + Me.Command.Text = Me.PreviousUIData(Me.Command.ID).ToString() + + Return + End If + + + ' Set the Command TextBox on the webpage with value from the + ' PersonalEducation database record. + + ' Me.DataSource is the PersonalEducation record retrieved from the database. + ' Me.Command is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetCommand() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.CommandSpecified Then + + ' If the Command is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalEducationTable.Command) + + Me.Command.Text = formattedValue + + Else + + ' Command is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.Command.Text = PersonalEducationTable.Command.Format(PersonalEducationTable.Command.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetCommandDate() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.CommandDate.ID) Then + + Me.CommandDate.Text = Me.PreviousUIData(Me.CommandDate.ID).ToString() + + Return + End If + + + ' Set the CommandDate TextBox on the webpage with value from the + ' PersonalEducation database record. + + ' Me.DataSource is the PersonalEducation record retrieved from the database. + ' Me.CommandDate is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetCommandDate() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.CommandDateSpecified Then + + ' If the CommandDate is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalEducationTable.CommandDate, "d MMM yy") + + Me.CommandDate.Text = formattedValue + + Else + + ' CommandDate is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.CommandDate.Text = PersonalEducationTable.CommandDate.Format(PersonalEducationTable.CommandDate.DefaultValue, "d MMM yy") + + End If + + End Sub + + Public Overridable Sub SetCOUNTRY() + + ' If selection was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.COUNTRY.ID) Then + If Me.PreviousUIData(Me.COUNTRY.ID) Is Nothing + Me.PopulateCOUNTRYDropDownList(Nothing, 100) + Else + Me.PopulateCOUNTRYDropDownList(Me.PreviousUIData(Me.COUNTRY.ID).ToString(), 100) + End If + Return + End If + + + ' Set the COUNTRY DropDownList on the webpage with value from the + ' PersonalEducation database record. + + ' Me.DataSource is the PersonalEducation record retrieved from the database. + ' Me.COUNTRY is the ASP:DropDownList on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetCOUNTRY() + ' and add your own code before or after the call to the MyBase function. + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.COUNTRYSpecified Then + + ' If the COUNTRY is non-NULL, then format the value. + ' The Format method will return the Display Foreign Key As (DFKA) value + Me.PopulateCOUNTRYDropDownList(Me.DataSource.COUNTRY.ToString(), 100) + + Else + + ' COUNTRY 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.PopulateCOUNTRYDropDownList(Nothing, 100) + Else + Me.PopulateCOUNTRYDropDownList(PersonalEducationTable.COUNTRY.DefaultValue, 100) + End If + + End If + + End Sub + + Public Overridable Sub SetCourse() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.Course.ID) Then + + Me.Course.Text = Me.PreviousUIData(Me.Course.ID).ToString() + + Return + End If + + + ' Set the Course TextBox on the webpage with value from the + ' PersonalEducation database record. + + ' Me.DataSource is the PersonalEducation record retrieved from the database. + ' Me.Course is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetCourse() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.CourseSpecified Then + + ' If the Course is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalEducationTable.Course) + + Me.Course.Text = formattedValue + + Else + + ' Course is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.Course.Text = PersonalEducationTable.Course.Format(PersonalEducationTable.Course.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetCourseAbbr() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.CourseAbbr.ID) Then + + Me.CourseAbbr.Text = Me.PreviousUIData(Me.CourseAbbr.ID).ToString() + + Return + End If + + + ' Set the CourseAbbr TextBox on the webpage with value from the + ' PersonalEducation database record. + + ' Me.DataSource is the PersonalEducation record retrieved from the database. + ' Me.CourseAbbr is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetCourseAbbr() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.CourseAbbrSpecified Then + + ' If the CourseAbbr is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalEducationTable.CourseAbbr) + + Me.CourseAbbr.Text = formattedValue + + Else + + ' CourseAbbr is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.CourseAbbr.Text = PersonalEducationTable.CourseAbbr.Format(PersonalEducationTable.CourseAbbr.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetCourseNo() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.CourseNo.ID) Then + + Me.CourseNo.Text = Me.PreviousUIData(Me.CourseNo.ID).ToString() + + Return + End If + + + ' Set the CourseNo TextBox on the webpage with value from the + ' PersonalEducation database record. + + ' Me.DataSource is the PersonalEducation record retrieved from the database. + ' Me.CourseNo is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetCourseNo() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.CourseNoSpecified Then + + ' If the CourseNo is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalEducationTable.CourseNo) + + Me.CourseNo.Text = formattedValue + + Else + + ' CourseNo is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.CourseNo.Text = PersonalEducationTable.CourseNo.Format(PersonalEducationTable.CourseNo.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetEducationPeriod() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.EducationPeriod.ID) Then + + Me.EducationPeriod.Text = Me.PreviousUIData(Me.EducationPeriod.ID).ToString() + + Return + End If + + + ' Set the EducationPeriod TextBox on the webpage with value from the + ' PersonalEducation database record. + + ' Me.DataSource is the PersonalEducation record retrieved from the database. + ' Me.EducationPeriod is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetEducationPeriod() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.EducationPeriodSpecified Then + + ' If the EducationPeriod is non-NULL, then format the value. + + ' The Format method will return the Display Foreign Key As (DFKA) value + Dim formattedValue As String = Me.DataSource.EducationPeriod.ToString() + + + Me.EducationPeriod.Text = formattedValue + + Else + + ' EducationPeriod is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.EducationPeriod.Text = PersonalEducationTable.EducationPeriod.DefaultValue + End If + + End Sub + + Public Overridable Sub SetEducationType() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.EducationType.ID) Then + + Me.EducationType.Text = Me.PreviousUIData(Me.EducationType.ID).ToString() + + Return + End If + + + ' Set the EducationType TextBox on the webpage with value from the + ' PersonalEducation database record. + + ' Me.DataSource is the PersonalEducation record retrieved from the database. + ' Me.EducationType is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetEducationType() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.EducationTypeSpecified Then + + ' If the EducationType is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalEducationTable.EducationType) + + Me.EducationType.Text = formattedValue + + Else + + ' EducationType is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.EducationType.Text = PersonalEducationTable.EducationType.Format(PersonalEducationTable.EducationType.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetEducationType1() + + ' If selection was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.EducationType1.ID) Then + If Me.PreviousUIData(Me.EducationType1.ID) Is Nothing + Me.PopulateEducationType1DropDownList(Nothing, 100) + Else + Me.PopulateEducationType1DropDownList(Me.PreviousUIData(Me.EducationType1.ID).ToString(), 100) + End If + Return + End If + + + ' Set the EducationType DropDownList on the webpage with value from the + ' PersonalEducation database record. + + ' Me.DataSource is the PersonalEducation record retrieved from the database. + ' Me.EducationType1 is the ASP:DropDownList on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetEducationType1() + ' and add your own code before or after the call to the MyBase function. + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.EducationTypeSpecified Then + + ' If the EducationType is non-NULL, then format the value. + ' The Format method will use the Display Format + Me.PopulateEducationType1DropDownList(Me.DataSource.EducationType.ToString(), 100) + + Else + + ' EducationType 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.PopulateEducationType1DropDownList(Nothing, 100) + Else + Me.PopulateEducationType1DropDownList(PersonalEducationTable.EducationType.DefaultValue, 100) + End If + + End If + + End Sub + + Public Overridable Sub SetEdYear() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.EdYear.ID) Then + + Me.EdYear.Text = Me.PreviousUIData(Me.EdYear.ID).ToString() + + Return + End If + + + ' Set the EdYear TextBox on the webpage with value from the + ' PersonalEducation database record. + + ' Me.DataSource is the PersonalEducation record retrieved from the database. + ' Me.EdYear is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetEdYear() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.EdYearSpecified Then + + ' If the EdYear is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalEducationTable.EdYear) + + Me.EdYear.Text = formattedValue + + Else + + ' EdYear is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.EdYear.Text = PersonalEducationTable.EdYear.Format(PersonalEducationTable.EdYear.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetEndDate() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.EndDate.ID) Then + + Me.EndDate.Text = Me.PreviousUIData(Me.EndDate.ID).ToString() + + Return + End If + + + ' Set the EndDate TextBox on the webpage with value from the + ' PersonalEducation database record. + + ' Me.DataSource is the PersonalEducation record retrieved from the database. + ' Me.EndDate is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetEndDate() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.EndDateSpecified Then + + ' If the EndDate is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalEducationTable.EndDate, "d MMM yyyy") + + Me.EndDate.Text = formattedValue + + Else + + ' EndDate is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.EndDate.Text = PersonalEducationTable.EndDate.Format(PersonalEducationTable.EndDate.DefaultValue, "d MMM yyyy") + + End If + + End Sub + + Public Overridable Sub SetFacultry() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.Facultry.ID) Then + + Me.Facultry.Text = Me.PreviousUIData(Me.Facultry.ID).ToString() + + Return + End If + + + ' Set the Facultry TextBox on the webpage with value from the + ' PersonalEducation database record. + + ' Me.DataSource is the PersonalEducation record retrieved from the database. + ' Me.Facultry is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetFacultry() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.FacultrySpecified Then + + ' If the Facultry is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalEducationTable.Facultry) + + Me.Facultry.Text = formattedValue + + Else + + ' Facultry is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.Facultry.Text = PersonalEducationTable.Facultry.Format(PersonalEducationTable.Facultry.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetInstitue() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.Institue.ID) Then + + Me.Institue.Text = Me.PreviousUIData(Me.Institue.ID).ToString() + + Return + End If + + + ' Set the Institue TextBox on the webpage with value from the + ' PersonalEducation database record. + + ' Me.DataSource is the PersonalEducation record retrieved from the database. + ' Me.Institue is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetInstitue() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.InstitueSpecified Then + + ' If the Institue is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalEducationTable.Institue) + + Me.Institue.Text = formattedValue + + Else + + ' Institue is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.Institue.Text = PersonalEducationTable.Institue.Format(PersonalEducationTable.Institue.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetLevelId() + + ' If selection was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.LevelId.ID) Then + If Me.PreviousUIData(Me.LevelId.ID) Is Nothing + Me.PopulateLevelIdDropDownList(Nothing, 100) + Else + Me.PopulateLevelIdDropDownList(Me.PreviousUIData(Me.LevelId.ID).ToString(), 100) + End If + Return + End If + + + ' Set the LevelId DropDownList on the webpage with value from the + ' PersonalEducation database record. + + ' Me.DataSource is the PersonalEducation record retrieved from the database. + ' Me.LevelId is the ASP:DropDownList on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetLevelId() + ' and add your own code before or after the call to the MyBase function. + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.LevelIdSpecified Then + + ' If the LevelId is non-NULL, then format the value. + ' The Format method will return the Display Foreign Key As (DFKA) value + Me.PopulateLevelIdDropDownList(Me.DataSource.LevelId.ToString(), 100) + + Else + + ' LevelId 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.PopulateLevelIdDropDownList(Nothing, 100) + Else + Me.PopulateLevelIdDropDownList(PersonalEducationTable.LevelId.DefaultValue, 100) + End If + + End If + + End Sub + + Public Overridable Sub SetNoAll() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.NoAll.ID) Then + + Me.NoAll.Text = Me.PreviousUIData(Me.NoAll.ID).ToString() + + Return + End If + + + ' Set the NoAll TextBox on the webpage with value from the + ' PersonalEducation database record. + + ' Me.DataSource is the PersonalEducation record retrieved from the database. + ' Me.NoAll is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetNoAll() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.NoAllSpecified Then + + ' If the NoAll is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalEducationTable.NoAll) + + Me.NoAll.Text = formattedValue + + Else + + ' NoAll is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.NoAll.Text = PersonalEducationTable.NoAll.Format(PersonalEducationTable.NoAll.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetPersonalId() + + ' If selection was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.PersonalId.ID) Then + If Me.PreviousUIData(Me.PersonalId.ID) Is Nothing + Me.PopulatePersonalIdDropDownList(Nothing, 100) + Else + Me.PopulatePersonalIdDropDownList(Me.PreviousUIData(Me.PersonalId.ID).ToString(), 100) + End If + Return + End If + + + ' Set the PersonalId DropDownList on the webpage with value from the + ' PersonalEducation database record. + + ' Me.DataSource is the PersonalEducation record retrieved from the database. + ' Me.PersonalId is the ASP:DropDownList on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetPersonalId() + ' and add your own code before or after the call to the MyBase function. + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.PersonalIdSpecified Then + + ' If the PersonalId is non-NULL, then format the value. + ' The Format method will return the Display Foreign Key As (DFKA) value + Me.PopulatePersonalIdDropDownList(Me.DataSource.PersonalId, 100) + + Else + + ' PersonalId 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.PopulatePersonalIdDropDownList(Nothing, 100) + Else + Me.PopulatePersonalIdDropDownList(PersonalEducationTable.PersonalId.DefaultValue, 100) + End If + + End If + + End Sub + + Public Overridable Sub SetScore() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.Score.ID) Then + + Me.Score.Text = Me.PreviousUIData(Me.Score.ID).ToString() + + Return + End If + + + ' Set the Score TextBox on the webpage with value from the + ' PersonalEducation database record. + + ' Me.DataSource is the PersonalEducation record retrieved from the database. + ' Me.Score is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetScore() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.ScoreSpecified Then + + ' If the Score is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalEducationTable.Score) + + Me.Score.Text = formattedValue + + Else + + ' Score is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.Score.Text = PersonalEducationTable.Score.Format(PersonalEducationTable.Score.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetScoreNo() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.ScoreNo.ID) Then + + Me.ScoreNo.Text = Me.PreviousUIData(Me.ScoreNo.ID).ToString() + + Return + End If + + + ' Set the ScoreNo TextBox on the webpage with value from the + ' PersonalEducation database record. + + ' Me.DataSource is the PersonalEducation record retrieved from the database. + ' Me.ScoreNo is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetScoreNo() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.ScoreNoSpecified Then + + ' If the ScoreNo is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalEducationTable.ScoreNo) + + Me.ScoreNo.Text = formattedValue + + Else + + ' ScoreNo is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.ScoreNo.Text = PersonalEducationTable.ScoreNo.Format(PersonalEducationTable.ScoreNo.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetStartDate() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.StartDate.ID) Then + + Me.StartDate.Text = Me.PreviousUIData(Me.StartDate.ID).ToString() + + Return + End If + + + ' Set the StartDate TextBox on the webpage with value from the + ' PersonalEducation database record. + + ' Me.DataSource is the PersonalEducation record retrieved from the database. + ' Me.StartDate is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetStartDate() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.StartDateSpecified Then + + ' If the StartDate is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalEducationTable.StartDate, "d MMM yyyy") + + Me.StartDate.Text = formattedValue + + Else + + ' StartDate is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.StartDate.Text = PersonalEducationTable.StartDate.Format(PersonalEducationTable.StartDate.DefaultValue, "d MMM yyyy") + + End If + + End Sub + + + Public EvaluateFormulaDelegate As BaseClasses.Data.DataSource.EvaluateFormulaDelegate = New BaseClasses.Data.DataSource.EvaluateFormulaDelegate(AddressOf Me.EvaluateFormula) + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean, ByVal e As FormulaEvaluator) As String + If e Is Nothing Then + e = New FormulaEvaluator() + End If + + e.Variables.Clear() + + + ' add variables for formula evaluation + If variables IsNot Nothing Then + Dim enumerator As System.Collections.Generic.IEnumerator(Of System.Collections.Generic.KeyValuePair(Of String, Object)) = variables.GetEnumerator() + While enumerator.MoveNext() + e.Variables.Add(enumerator.Current.Key, enumerator.Current.Value) + End While + End If + + If includeDS + + End IF + + + ' Other variables referred to in the formula are expected to be + ' properties of the DataSource. For example, referring to + ' UnitPrice as a variable will refer to DataSource.UnitPrice + If dataSourceForEvaluate Is Nothing Then + + e.DataSource = Me.DataSource + + Else + e.DataSource = dataSourceForEvaluate + End If + + ' Define the calling control. This is used to add other + ' related table and record controls as variables. + e.CallingControl = Me + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + + If Not String.IsNullOrEmpty(format) AndAlso (String.IsNullOrEmpty(formula) OrElse formula.IndexOf("Format(") < 0) Then + Return FormulaUtils.Format(resultObj, format) + Else + Return resultObj.ToString() + End If + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format,variables ,includeDS, Nothing) + End Function + + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object)) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format, variables ,True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, format, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal e as FormulaEvaluator) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, variables, True, e) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal includeDS as Boolean) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, includeDS, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, True, Nothing) + End Function + + + Public Overridable Sub RegisterPostback() + + + End Sub + + + + ' To customize, override this method in PersonalEducationTableControlRow. + Public Overridable Sub SaveData() + ' Saves the associated record in the database. + ' SaveData calls Validate and Get methods - so it may be more appropriate to + ' customize those methods. + + ' 1. Load the existing record from the database. Since we save the entire record, this ensures + ' that fields that are not displayed are also properly initialized. + Me.LoadData() + + + ' 2. Perform any custom validation. + Me.Validate() + + + ' 3. Set the values in the record with data from UI controls. + ' This calls the Get() method for each of the user interface controls. + Me.GetUIData() + + ' 4. Save in the database. + ' We should not save the record if the data did not change. This + ' will save a database hit and avoid triggering any database triggers. + + If Me.DataSource.IsAnyValueChanged Then + ' Save record to database but do not commit yet. + ' Auto generated ids are available after saving for use by child (dependent) records. + Me.DataSource.Save() + + DirectCast(GetParentControlObject(Me, "PersonalEducationTableControl"), PersonalEducationTableControl).DataChanged = True + DirectCast(GetParentControlObject(Me, "PersonalEducationTableControl"), PersonalEducationTableControl).ResetData = True + End If + + + ' update session or cookie by formula + + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + ' For Master-Detail relationships, save data on the Detail table(s) + + End Sub + + ' To customize, override this method in PersonalEducationTableControlRow. + Public Overridable Sub GetUIData() + ' The GetUIData method retrieves the updated values from the user interface + ' controls into a database record in preparation for saving or updating. + ' To do this, it calls the Get methods for each of the field displayed on + ' the webpage. It is better to make changes in the Get methods, rather + ' than making changes here. + + ' Call the Get methods for each of the user interface controls. + + GetCommand() + GetCommandDate() + GetCOUNTRY() + GetCourse() + GetCourseAbbr() + GetCourseNo() + GetEducationPeriod() + GetEducationType() + GetEducationType1() + GetEdYear() + GetEndDate() + GetFacultry() + GetInstitue() + GetLevelId() + GetNoAll() + GetPersonalId() + GetScore() + GetScoreNo() + GetStartDate() + End Sub + + + Public Overridable Sub GetCommand() + + ' Retrieve the value entered by the user on the Command ASP:TextBox, and + ' save it into the Command field in DataSource PersonalEducation record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.Command.Text, PersonalEducationTable.Command) + + + End Sub + + Public Overridable Sub GetCommandDate() + + ' Retrieve the value entered by the user on the CommandDate ASP:TextBox, and + ' save it into the CommandDate field in DataSource PersonalEducation 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.CommandDate.Text, PersonalEducationTable.CommandDate) + + + End Sub + + Public Overridable Sub GetCOUNTRY() + + ' Retrieve the value entered by the user on the COUNTRY ASP:DropDownList, and + ' save it into the COUNTRY field in DataSource PersonalEducation record. + + ' Custom validation should be performed in Validate, not here. + + Me.DataSource.Parse(GetValueSelectedPageRequest(Me.COUNTRY), PersonalEducationTable.COUNTRY) + + End Sub + + Public Overridable Sub GetCourse() + + ' Retrieve the value entered by the user on the Course ASP:TextBox, and + ' save it into the Course field in DataSource PersonalEducation record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.Course.Text, PersonalEducationTable.Course) + + + End Sub + + Public Overridable Sub GetCourseAbbr() + + ' Retrieve the value entered by the user on the CourseAbbr ASP:TextBox, and + ' save it into the CourseAbbr field in DataSource PersonalEducation record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.CourseAbbr.Text, PersonalEducationTable.CourseAbbr) + + + End Sub + + Public Overridable Sub GetCourseNo() + + ' Retrieve the value entered by the user on the CourseNo ASP:TextBox, and + ' save it into the CourseNo field in DataSource PersonalEducation record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.CourseNo.Text, PersonalEducationTable.CourseNo) + + + End Sub + + Public Overridable Sub GetEducationPeriod() + + ' Retrieve the value entered by the user on the EducationPeriod ASP:TextBox, and + ' save it into the EducationPeriod field in DataSource PersonalEducation record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.EducationPeriod.Text, PersonalEducationTable.EducationPeriod) + + + End Sub + + Public Overridable Sub GetEducationType() + + ' Retrieve the value entered by the user on the EducationType ASP:TextBox, and + ' save it into the EducationType field in DataSource PersonalEducation record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.EducationType.Text, PersonalEducationTable.EducationType) + + + End Sub + + Public Overridable Sub GetEducationType1() + + ' Retrieve the value entered by the user on the EducationType ASP:DropDownList, and + ' save it into the EducationType field in DataSource PersonalEducation record. + + ' Custom validation should be performed in Validate, not here. + + Me.DataSource.Parse(GetValueSelectedPageRequest(Me.EducationType1), PersonalEducationTable.EducationType) + + End Sub + + Public Overridable Sub GetEdYear() + + ' Retrieve the value entered by the user on the EdYear ASP:TextBox, and + ' save it into the EdYear field in DataSource PersonalEducation record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.EdYear.Text, PersonalEducationTable.EdYear) + + + End Sub + + Public Overridable Sub GetEndDate() + + ' Retrieve the value entered by the user on the EndDate ASP:TextBox, and + ' save it into the EndDate field in DataSource PersonalEducation 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.EndDate.Text, PersonalEducationTable.EndDate) + + + End Sub + + Public Overridable Sub GetFacultry() + + ' Retrieve the value entered by the user on the Facultry ASP:TextBox, and + ' save it into the Facultry field in DataSource PersonalEducation record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.Facultry.Text, PersonalEducationTable.Facultry) + + + End Sub + + Public Overridable Sub GetInstitue() + + ' Retrieve the value entered by the user on the Institue ASP:TextBox, and + ' save it into the Institue field in DataSource PersonalEducation record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.Institue.Text, PersonalEducationTable.Institue) + + + End Sub + + Public Overridable Sub GetLevelId() + + ' Retrieve the value entered by the user on the LevelId ASP:DropDownList, and + ' save it into the LevelId field in DataSource PersonalEducation record. + + ' Custom validation should be performed in Validate, not here. + + Me.DataSource.Parse(GetValueSelectedPageRequest(Me.LevelId), PersonalEducationTable.LevelId) + + End Sub + + Public Overridable Sub GetNoAll() + + ' Retrieve the value entered by the user on the NoAll ASP:TextBox, and + ' save it into the NoAll field in DataSource PersonalEducation record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.NoAll.Text, PersonalEducationTable.NoAll) + + + End Sub + + Public Overridable Sub GetPersonalId() + + ' Retrieve the value entered by the user on the PersonalId ASP:DropDownList, and + ' save it into the PersonalId field in DataSource PersonalEducation record. + + ' Custom validation should be performed in Validate, not here. + + Me.DataSource.Parse(GetValueSelectedPageRequest(Me.PersonalId), PersonalEducationTable.PersonalId) + + End Sub + + Public Overridable Sub GetScore() + + ' Retrieve the value entered by the user on the Score ASP:TextBox, and + ' save it into the Score field in DataSource PersonalEducation record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.Score.Text, PersonalEducationTable.Score) + + + End Sub + + Public Overridable Sub GetScoreNo() + + ' Retrieve the value entered by the user on the ScoreNo ASP:TextBox, and + ' save it into the ScoreNo field in DataSource PersonalEducation record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.ScoreNo.Text, PersonalEducationTable.ScoreNo) + + + End Sub + + Public Overridable Sub GetStartDate() + + ' Retrieve the value entered by the user on the StartDate ASP:TextBox, and + ' save it into the StartDate field in DataSource PersonalEducation 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.StartDate.Text, PersonalEducationTable.StartDate) + + + End Sub + + + ' To customize, override this method in PersonalEducationTableControlRow. + + Public Overridable Function CreateWhereClause() As WhereClause + + Return Nothing + + End Function + + + + ' To customize, override this method in PersonalEducationTableControlRow. + Public Overridable Sub Validate() + ' Add custom validation for any control within this panel. + ' Example. If you have a State ASP:Textbox control + ' If Me.State.Text <> "CA" Then + ' Throw New Exception("State must be CA (California).") + ' End If + + ' The Validate method is common across all controls within + ' this panel so you can validate multiple fields, but report + ' one error message. + + + End Sub + + Public Overridable Sub Delete() + + If Me.IsNewRecord() Then + Return + End If + + Dim pkValue As KeyValue = KeyValue.XmlToKey(Me.RecordUniqueId) + PersonalEducationTable.DeleteRecord(pkValue) + + DirectCast(GetParentControlObject(Me, "PersonalEducationTableControl"), PersonalEducationTableControl).DataChanged = True + DirectCast(GetParentControlObject(Me, "PersonalEducationTableControl"), PersonalEducationTableControl).ResetData = True + End Sub + + Protected Overridable Sub Control_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.PreRender + ' PreRender event is raised just before page is being displayed. + Try + DbUtils.StartTransaction() + Me.RegisterPostback() + + If Not Me.Page.ErrorOnPage AndAlso (Me.Page.IsPageRefresh OrElse Me.DataChanged OrElse Me.ResetData) Then + + + ' Re-load the data and update the web page if necessary. + ' This is typically done during a postback (filter, search button, sort, pagination button). + ' In each of the other click handlers, simply set DataChanged to True to reload the data. + Me.LoadData() + Me.DataBind() + End If + + + Catch ex As Exception + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + Finally + DbUtils.EndTransaction() + End Try + End Sub + + + Protected Overrides Sub SaveControlsToSession() + MyBase.SaveControlsToSession() + + + 'Save pagination state to session. + + End Sub + + + + Protected Overrides Sub ClearControlsFromSession() + MyBase.ClearControlsFromSession() + + + + ' Clear pagination state from session. + + End Sub + + Protected Overrides Sub LoadViewState(ByVal savedState As Object) + MyBase.LoadViewState(savedState) + Dim isNewRecord As String = CType(ViewState("IsNewRecord"), String) + If Not isNewRecord Is Nothing AndAlso isNewRecord.Trim <> "" Then + Me.IsNewRecord = Boolean.Parse(isNewRecord) + End If + + Dim myCheckSum As String = CType(ViewState("CheckSum"), String) + If Not myCheckSum Is Nothing AndAlso myCheckSum.Trim <> "" Then + Me.CheckSum = myCheckSum + End If + + + ' Load view state for pagination control. + + End Sub + + Protected Overrides Function SaveViewState() As Object + ViewState("IsNewRecord") = Me.IsNewRecord.ToString() + ViewState("CheckSum") = Me.CheckSum + + + ' Load view state for pagination control. + + Return MyBase.SaveViewState() + End Function + + + + Public Overridable Function CreateWhereClause_COUNTRYDropDownList() 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 Country table. + ' Examples: + ' wc.iAND(CountryTable.Country, BaseFilter.ComparisonOperator.EqualsTo, "XYZ") + ' wc.iAND(CountryTable.Active, BaseFilter.ComparisonOperator.EqualsTo, "1") + + Dim wc As WhereClause = New WhereClause() + Return wc + + End Function + + + + Public Overridable Function CreateWhereClause_EducationType1DropDownList() As WhereClause + ' By default, we simply return a new WhereClause. + ' Add additional where clauses to restrict the items shown in the dropdown list. + + Dim wc As WhereClause = New WhereClause() + Return wc + + End Function + + + + Public Overridable Function CreateWhereClause_LevelIdDropDownList() 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 Education table. + ' Examples: + ' wc.iAND(EducationTable.Level, BaseFilter.ComparisonOperator.EqualsTo, "XYZ") + ' wc.iAND(EducationTable.Active, BaseFilter.ComparisonOperator.EqualsTo, "1") + + Dim wc As WhereClause = New WhereClause() + Return wc + + End Function + + + + Public Overridable Function CreateWhereClause_PersonalIdDropDownList() 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 PersonalId table. + ' Examples: + ' wc.iAND(PersonalIdTable.PersonalName, BaseFilter.ComparisonOperator.EqualsTo, "XYZ") + ' wc.iAND(PersonalIdTable.Active, BaseFilter.ComparisonOperator.EqualsTo, "1") + + Dim wc As WhereClause = New WhereClause() + Return wc + + End Function + + + ' Fill the COUNTRY list. + Protected Overridable Sub PopulateCOUNTRYDropDownList( _ + ByVal selectedValue As String, _ + ByVal maxItems As Integer) + + Me.COUNTRY.Items.Clear() + + + ' 1. Setup the static list items + + ' Add the Please Select item. + Me.COUNTRY.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_COUNTRYDropDownList function. + ' It is better to customize the where clause there. + + Dim wc As WhereClause = CreateWhereClause_COUNTRYDropDownList() + ' Create the ORDER BY clause to sort based on the displayed value. + + + Dim orderBy As OrderBy = New OrderBy(false, false) + orderBy.Add(CountryTable.Country, OrderByItem.OrderDir.Asc) + + Dim variables As System.Collections.Generic.IDictionary(Of String, Object) = New System.Collections.Generic.Dictionary(Of String, Object) + + ' 3. Read a total of maxItems from the database and insert them + Dim itemValues() As CountryRecord = 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 = CountryTable.GetRecords(wc, orderBy, pageNum, maxItems) + For each itemValue As CountryRecord In itemValues + ' Create the item and add to the list. + Dim cvalue As String = Nothing + Dim fvalue As String = Nothing + If itemValue.CountryIdSpecified Then + cvalue = itemValue.CountryId.ToString() + + If counter < maxItems AndAlso Me.COUNTRY.Items.FindByValue(cvalue) Is Nothing Then + + Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalEducationTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalEducationTable.COUNTRY) + If _isExpandableNonCompositeForeignKey AndAlso PersonalEducationTable.COUNTRY.IsApplyDisplayAs Then + fvalue = PersonalEducationTable.GetDFKA(itemValue, PersonalEducationTable.COUNTRY) + End If + If (Not _isExpandableNonCompositeForeignKey) Or (String.IsNullOrEmpty(fvalue)) Then + fvalue = itemValue.Format(CountryTable.Country) + End If + + If fvalue Is Nothing OrElse fvalue.Trim() = "" Then fvalue = cvalue + + If (IsNothing(fvalue)) Then + fvalue = "" + End If + + fvalue = fvalue.Trim() + + If ( fvalue.Length > 50 ) Then + fvalue = fvalue.Substring(0, 50) & "..." + End If + + Dim dupItem As ListItem = Me.COUNTRY.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.COUNTRY.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.COUNTRY, selectedValue) AndAlso _ + Not SetSelectedDisplayText(Me.COUNTRY, selectedValue)Then + + ' construct a whereclause to query a record with Country.CountryId = selectedValue + Dim filter2 As CompoundFilter = New CompoundFilter(CompoundFilter.CompoundingOperators.And_Operator, Nothing) + Dim whereClause2 As WhereClause = New WhereClause() + filter2.AddFilter(New BaseClasses.Data.ColumnValueFilter(CountryTable.CountryId, selectedValue, BaseClasses.Data.BaseFilter.ComparisonOperator.EqualsTo, False)) + whereClause2.AddFilter(filter2, CompoundFilter.CompoundingOperators.And_Operator) + + Try + ' Execute the query + Dim rc() As CountryRecord = CountryTable.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 CountryRecord = DirectCast(rc(0), CountryRecord) + ' Create the item and add to the list. + Dim cvalue As String = Nothing + Dim fvalue As String = Nothing + If itemValue.CountryIdSpecified Then + cvalue = itemValue.CountryId.ToString() + Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalEducationTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalEducationTable.COUNTRY) + If _isExpandableNonCompositeForeignKey AndAlso PersonalEducationTable.COUNTRY.IsApplyDisplayAs Then + fvalue = PersonalEducationTable.GetDFKA(itemValue, PersonalEducationTable.COUNTRY) + End If + If (Not _isExpandableNonCompositeForeignKey) Or (String.IsNullOrEmpty(fvalue)) Then + fvalue = itemValue.Format(CountryTable.Country) + End If + + If fvalue Is Nothing OrElse fvalue.Trim() = "" Then fvalue = cvalue + Dim newItem As New ListItem(fvalue, cvalue) + Me.COUNTRY.Items.Add(newItem) + SetSelectedValue(Me.COUNTRY, selectedValue) + End If + End If + Catch + End Try + + End If + + + End Sub + + ' Fill the EducationType1 list. + Protected Overridable Sub PopulateEducationType1DropDownList( _ + ByVal selectedValue As String, _ + ByVal maxItems As Integer) + + Me.EducationType1.Items.Clear() + + + ' 1. Setup the static list items + + Me.EducationType1.Items.Add(New ListItem(Me.Page.ExpandResourceValue("{Txt:PleaseSelect}"), "--PLEASE_SELECT--")) + + Me.EducationType1.Items.Add(New ListItem(Me.Page.ExpandResourceValue("1"), "1")) + + Me.EducationType1.Items.Add(New ListItem(Me.Page.ExpandResourceValue("2"), "2")) + + ' Skip step 2 and 3 because no need to load data from database and insert data + + + ' 4. Set the selected value (insert if not already present). + + If Not selectedValue Is Nothing AndAlso _ + selectedValue.Trim <> "" AndAlso _ + Not SetSelectedValue(Me.EducationType1, selectedValue) AndAlso _ + Not SetSelectedDisplayText(Me.EducationType1, selectedValue) AndAlso _ + Not SetSelectedDisplayText(Me.EducationType1, PersonalEducationTable.EducationType.Format(selectedValue))Then + Dim fvalue As String = PersonalEducationTable.EducationType.Format(selectedValue) + If fvalue Is Nothing OrElse fvalue.Trim() = "" Then fvalue = selectedValue + Dim item As ListItem = New ListItem(fvalue, selectedValue) + item.Selected = True + Me.EducationType1.Items.Add(item) + End If + + + End Sub + + ' Fill the LevelId list. + Protected Overridable Sub PopulateLevelIdDropDownList( _ + ByVal selectedValue As String, _ + ByVal maxItems As Integer) + + Me.LevelId.Items.Clear() + + + ' 1. Setup the static list items + + ' Add the Please Select item. + Me.LevelId.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_LevelIdDropDownList function. + ' It is better to customize the where clause there. + + Dim wc As WhereClause = CreateWhereClause_LevelIdDropDownList() + ' Create the ORDER BY clause to sort based on the displayed value. + + + Dim orderBy As OrderBy = New OrderBy(false, false) + orderBy.Add(EducationTable.Level, OrderByItem.OrderDir.Asc) + + Dim variables As System.Collections.Generic.IDictionary(Of String, Object) = New System.Collections.Generic.Dictionary(Of String, Object) + + ' 3. Read a total of maxItems from the database and insert them + Dim itemValues() As EducationRecord = 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 = EducationTable.GetRecords(wc, orderBy, pageNum, maxItems) + For each itemValue As EducationRecord In itemValues + ' Create the item and add to the list. + Dim cvalue As String = Nothing + Dim fvalue As String = Nothing + If itemValue.EducationIdSpecified Then + cvalue = itemValue.EducationId.ToString() + + If counter < maxItems AndAlso Me.LevelId.Items.FindByValue(cvalue) Is Nothing Then + + Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalEducationTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalEducationTable.LevelId) + If _isExpandableNonCompositeForeignKey AndAlso PersonalEducationTable.LevelId.IsApplyDisplayAs Then + fvalue = PersonalEducationTable.GetDFKA(itemValue, PersonalEducationTable.LevelId) + End If + If (Not _isExpandableNonCompositeForeignKey) Or (String.IsNullOrEmpty(fvalue)) Then + fvalue = itemValue.Format(EducationTable.Level) + End If + + If fvalue Is Nothing OrElse fvalue.Trim() = "" Then fvalue = cvalue + + If (IsNothing(fvalue)) Then + fvalue = "" + End If + + fvalue = fvalue.Trim() + + If ( fvalue.Length > 50 ) Then + fvalue = fvalue.Substring(0, 50) & "..." + End If + + Dim dupItem As ListItem = Me.LevelId.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.LevelId.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.LevelId, selectedValue) AndAlso _ + Not SetSelectedDisplayText(Me.LevelId, selectedValue)Then + + ' construct a whereclause to query a record with Education.EducationId = selectedValue + Dim filter2 As CompoundFilter = New CompoundFilter(CompoundFilter.CompoundingOperators.And_Operator, Nothing) + Dim whereClause2 As WhereClause = New WhereClause() + filter2.AddFilter(New BaseClasses.Data.ColumnValueFilter(EducationTable.EducationId, selectedValue, BaseClasses.Data.BaseFilter.ComparisonOperator.EqualsTo, False)) + whereClause2.AddFilter(filter2, CompoundFilter.CompoundingOperators.And_Operator) + + Try + ' Execute the query + Dim rc() As EducationRecord = EducationTable.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 EducationRecord = DirectCast(rc(0), EducationRecord) + ' Create the item and add to the list. + Dim cvalue As String = Nothing + Dim fvalue As String = Nothing + If itemValue.EducationIdSpecified Then + cvalue = itemValue.EducationId.ToString() + Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalEducationTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalEducationTable.LevelId) + If _isExpandableNonCompositeForeignKey AndAlso PersonalEducationTable.LevelId.IsApplyDisplayAs Then + fvalue = PersonalEducationTable.GetDFKA(itemValue, PersonalEducationTable.LevelId) + End If + If (Not _isExpandableNonCompositeForeignKey) Or (String.IsNullOrEmpty(fvalue)) Then + fvalue = itemValue.Format(EducationTable.Level) + End If + + If fvalue Is Nothing OrElse fvalue.Trim() = "" Then fvalue = cvalue + Dim newItem As New ListItem(fvalue, cvalue) + Me.LevelId.Items.Add(newItem) + SetSelectedValue(Me.LevelId, selectedValue) + End If + End If + Catch + End Try + + End If + + + End Sub + + ' Fill the PersonalId list. + Protected Overridable Sub PopulatePersonalIdDropDownList( _ + ByVal selectedValue As String, _ + ByVal maxItems As Integer) + + Me.PersonalId.Items.Clear() + + + ' 1. Setup the static list items + + ' Add the Please Select item. + Me.PersonalId.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_PersonalIdDropDownList function. + ' It is better to customize the where clause there. + + Dim wc As WhereClause = CreateWhereClause_PersonalIdDropDownList() + ' Create the ORDER BY clause to sort based on the displayed value. + + + Dim orderBy As OrderBy = New OrderBy(false, false) + orderBy.Add(PersonalIdTable.PersonalName, OrderByItem.OrderDir.Asc) + + Dim variables As System.Collections.Generic.IDictionary(Of String, Object) = New System.Collections.Generic.Dictionary(Of String, Object) + + ' 3. Read a total of maxItems from the database and insert them + Dim itemValues() As PersonalIdRecord = 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 = PersonalIdTable.GetRecords(wc, orderBy, pageNum, maxItems) + For each itemValue As PersonalIdRecord In itemValues + ' Create the item and add to the list. + Dim cvalue As String = Nothing + Dim fvalue As String = Nothing + If itemValue.PersonalIdSpecified Then + cvalue = itemValue.PersonalId.ToString() + + If counter < maxItems AndAlso Me.PersonalId.Items.FindByValue(cvalue) Is Nothing Then + + Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalEducationTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalEducationTable.PersonalId) + If _isExpandableNonCompositeForeignKey AndAlso PersonalEducationTable.PersonalId.IsApplyDisplayAs Then + fvalue = PersonalEducationTable.GetDFKA(itemValue, PersonalEducationTable.PersonalId) + End If + If (Not _isExpandableNonCompositeForeignKey) Or (String.IsNullOrEmpty(fvalue)) Then + fvalue = itemValue.Format(PersonalIdTable.PersonalName) + End If + + If fvalue Is Nothing OrElse fvalue.Trim() = "" Then fvalue = cvalue + + If (IsNothing(fvalue)) Then + fvalue = "" + End If + + fvalue = fvalue.Trim() + + If ( fvalue.Length > 50 ) Then + fvalue = fvalue.Substring(0, 50) & "..." + End If + + Dim dupItem As ListItem = Me.PersonalId.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.PersonalId.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.PersonalId, selectedValue) AndAlso _ + Not SetSelectedDisplayText(Me.PersonalId, selectedValue)Then + + ' construct a whereclause to query a record with PersonalId.PersonalId = selectedValue + Dim filter2 As CompoundFilter = New CompoundFilter(CompoundFilter.CompoundingOperators.And_Operator, Nothing) + Dim whereClause2 As WhereClause = New WhereClause() + filter2.AddFilter(New BaseClasses.Data.ColumnValueFilter(PersonalIdTable.PersonalId, selectedValue, BaseClasses.Data.BaseFilter.ComparisonOperator.EqualsTo, False)) + whereClause2.AddFilter(filter2, CompoundFilter.CompoundingOperators.And_Operator) + + Try + ' Execute the query + Dim rc() As PersonalIdRecord = PersonalIdTable.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 PersonalIdRecord = DirectCast(rc(0), PersonalIdRecord) + ' Create the item and add to the list. + Dim cvalue As String = Nothing + Dim fvalue As String = Nothing + If itemValue.PersonalIdSpecified Then + cvalue = itemValue.PersonalId.ToString() + Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalEducationTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalEducationTable.PersonalId) + If _isExpandableNonCompositeForeignKey AndAlso PersonalEducationTable.PersonalId.IsApplyDisplayAs Then + fvalue = PersonalEducationTable.GetDFKA(itemValue, PersonalEducationTable.PersonalId) + End If + If (Not _isExpandableNonCompositeForeignKey) Or (String.IsNullOrEmpty(fvalue)) Then + fvalue = itemValue.Format(PersonalIdTable.PersonalName) + End If + + If fvalue Is Nothing OrElse fvalue.Trim() = "" Then fvalue = cvalue + Dim newItem As New ListItem(fvalue, cvalue) + Me.PersonalId.Items.Add(newItem) + SetSelectedValue(Me.PersonalId, selectedValue) + End If + End If + Catch + End Try + + End If + + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalEducationRowDeleteButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + If(Not Me.Page.IsPageRefresh) Then + + Dim tc As PersonalEducationTableControl = DirectCast(GetParentControlObject(Me, "PersonalEducationTableControl"), PersonalEducationTableControl) + If Not (IsNothing(tc)) Then + If Not Me.IsNewRecord Then + tc.AddToDeletedRecordIds(DirectCast(Me, PersonalEducationTableControlRow)) + End If + Me.Visible = False + tc.SetFormulaControls() + End If + + End If + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalEducationRowEditButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + ' The redirect URL is set on the Properties, Custom Properties or Actions. + ' The ModifyRedirectURL call resolves the parameters before the + ' Response.Redirect redirects the page to the URL. + ' Any code after the Response.Redirect call will not be executed, since the page is + ' redirected to the URL. + + + Dim url As String = "../PersonalEducation/EditPersonalEducation.aspx?PersonalEducation={PK}" + + Dim shouldRedirect As Boolean = True + Dim TargetKey As String = Nothing + Dim DFKA As String = TargetKey + Dim id As String = DFKA + Dim value As String = id + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + url = Me.ModifyRedirectUrl(url, "",False) + url = Me.Page.ModifyRedirectUrl(url, "",False) + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + shouldRedirect = False + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + If shouldRedirect Then + Me.Page.ShouldSaveControlsToSession = True + Me.Page.Response.Redirect(url) + ElseIf Not TargetKey Is Nothing AndAlso _ + Not shouldRedirect Then + Me.Page.ShouldSaveControlsToSession = True + Me.Page.CloseWindow(True) + + End If + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalEducationRowViewButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + ' The redirect URL is set on the Properties, Custom Properties or Actions. + ' The ModifyRedirectURL call resolves the parameters before the + ' Response.Redirect redirects the page to the URL. + ' Any code after the Response.Redirect call will not be executed, since the page is + ' redirected to the URL. + + + Dim url As String = "../PersonalEducation/ShowPersonalEducation.aspx?PersonalEducation={PK}" + + Dim shouldRedirect As Boolean = True + Dim TargetKey As String = Nothing + Dim DFKA As String = TargetKey + Dim id As String = DFKA + Dim value As String = id + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + url = Me.ModifyRedirectUrl(url, "",False) + url = Me.Page.ModifyRedirectUrl(url, "",False) + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + shouldRedirect = False + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + If shouldRedirect Then + Me.Page.ShouldSaveControlsToSession = True + Me.Page.Response.Redirect(url) + ElseIf Not TargetKey Is Nothing AndAlso _ + Not shouldRedirect Then + Me.Page.ShouldSaveControlsToSession = True + Me.Page.CloseWindow(True) + + End If + End Sub + + Protected Overridable Sub COUNTRY_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()(COUNTRY.ClientID & "_SelectedValue"), String) + Dim displayText As String = CType(Me.Page.Session()(COUNTRY.ClientID & "_SelectedDisplayText"), String) + If displayText <> "" AndAlso val <> "" Then + Me.COUNTRY.Items.Add(New ListItem(displayText, val)) + Me.COUNTRY.SelectedIndex = Me.COUNTRY.Items.Count - 1 + Me.Page.Session.Remove(COUNTRY.ClientID & "_SelectedValue") + Me.Page.Session.Remove(COUNTRY.ClientID & "_SelectedDisplayText") + End If + + + + + End Sub + + Protected Overridable Sub EducationType1_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()(EducationType1.ClientID & "_SelectedValue"), String) + Dim displayText As String = CType(Me.Page.Session()(EducationType1.ClientID & "_SelectedDisplayText"), String) + If displayText <> "" AndAlso val <> "" Then + Me.EducationType1.Items.Add(New ListItem(displayText, val)) + Me.EducationType1.SelectedIndex = Me.EducationType1.Items.Count - 1 + Me.Page.Session.Remove(EducationType1.ClientID & "_SelectedValue") + Me.Page.Session.Remove(EducationType1.ClientID & "_SelectedDisplayText") + End If + + + + + End Sub + + Protected Overridable Sub LevelId_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()(LevelId.ClientID & "_SelectedValue"), String) + Dim displayText As String = CType(Me.Page.Session()(LevelId.ClientID & "_SelectedDisplayText"), String) + If displayText <> "" AndAlso val <> "" Then + Me.LevelId.Items.Add(New ListItem(displayText, val)) + Me.LevelId.SelectedIndex = Me.LevelId.Items.Count - 1 + Me.Page.Session.Remove(LevelId.ClientID & "_SelectedValue") + Me.Page.Session.Remove(LevelId.ClientID & "_SelectedDisplayText") + End If + + + + + End Sub + + Protected Overridable Sub PersonalId_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()(PersonalId.ClientID & "_SelectedValue"), String) + Dim displayText As String = CType(Me.Page.Session()(PersonalId.ClientID & "_SelectedDisplayText"), String) + If displayText <> "" AndAlso val <> "" Then + Me.PersonalId.Items.Add(New ListItem(displayText, val)) + Me.PersonalId.SelectedIndex = Me.PersonalId.Items.Count - 1 + Me.Page.Session.Remove(PersonalId.ClientID & "_SelectedValue") + Me.Page.Session.Remove(PersonalId.ClientID & "_SelectedDisplayText") + End If + + + + + End Sub + + Protected Overridable Sub Command_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub CommandDate_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub Course_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub CourseAbbr_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub CourseNo_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub EducationPeriod_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub EducationType_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub EdYear_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub EndDate_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub Facultry_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub Institue_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub NoAll_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub Score_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub ScoreNo_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub StartDate_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("BasePersonalEducationTableControlRow_Rec"), String) + End Get + Set(ByVal value As String) + Me.ViewState("BasePersonalEducationTableControlRow_Rec") = value + End Set + End Property + + Private _DataSource As PersonalEducationRecord + Public Property DataSource() As PersonalEducationRecord + Get + Return Me._DataSource + End Get + + Set(ByVal value As PersonalEducationRecord) + + Me._DataSource = value + End Set + End Property + + + + Private _checkSum As String + Public Overridable Property CheckSum() As String + Get + Return Me._checkSum + End Get + Set(ByVal value As String) + Me._checkSum = value + End Set + End Property + + Private _TotalPages As Integer + Public Property TotalPages() As Integer + Get + Return Me._TotalPages + End Get + Set(ByVal value As Integer) + Me._TotalPages = value + End Set + End Property + + Private _PageIndex As Integer + Public Property PageIndex() As Integer + Get + ' Return the PageIndex + Return Me._PageIndex + End Get + Set(ByVal value As Integer) + Me._PageIndex = value + End Set + End Property + + Private _DisplayLastPage As Boolean + Public Property DisplayLastPage() As Boolean + Get + Return Me._DisplayLastPage + End Get + Set(ByVal value As Boolean) + Me._DisplayLastPage = value + End Set + End Property + + + +#Region "Helper Properties" + + Public ReadOnly Property Command() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Command"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property CommandDate() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "CommandDate"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property COUNTRY() As System.Web.UI.WebControls.DropDownList + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "COUNTRY"), System.Web.UI.WebControls.DropDownList) + End Get + End Property + + Public ReadOnly Property Course() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Course"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property CourseAbbr() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "CourseAbbr"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property CourseNo() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "CourseNo"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property EducationPeriod() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "EducationPeriod"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property EducationType() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "EducationType"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property EducationType1() As System.Web.UI.WebControls.DropDownList + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "EducationType1"), System.Web.UI.WebControls.DropDownList) + End Get + End Property + + Public ReadOnly Property EdYear() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "EdYear"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property EndDate() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "EndDate"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property Facultry() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Facultry"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property Institue() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Institue"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property LevelId() As System.Web.UI.WebControls.DropDownList + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "LevelId"), System.Web.UI.WebControls.DropDownList) + End Get + End Property + + Public ReadOnly Property NoAll() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "NoAll"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property PersonalEducationRecordRowSelection() As System.Web.UI.WebControls.CheckBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalEducationRecordRowSelection"), System.Web.UI.WebControls.CheckBox) + End Get + End Property + + Public ReadOnly Property PersonalEducationRowDeleteButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalEducationRowDeleteButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalEducationRowEditButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalEducationRowEditButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalEducationRowViewButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalEducationRowViewButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalId() As System.Web.UI.WebControls.DropDownList + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalId"), System.Web.UI.WebControls.DropDownList) + End Get + End Property + + Public ReadOnly Property PersonalIdAddRecordLink() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalIdAddRecordLink"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property Score() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Score"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property ScoreNo() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "ScoreNo"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property StartDate() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "StartDate"), System.Web.UI.WebControls.TextBox) + End Get + End Property + +#End Region + +#Region "Helper Functions" + + Public Overrides Overloads Function ModifyRedirectUrl(ByVal url As String, ByVal arg As String, ByVal bEncrypt As Boolean) As String + Return Me.Page.EvaluateExpressions(url, arg, bEncrypt, Me) + End Function + + Public Overrides Overloads Function EvaluateExpressions(ByVal url As String, ByVal arg As String, ByVal bEncrypt As Boolean) As String + + Dim rec As PersonalEducationRecord = Nothing + + + Try + rec = Me.GetRecord() + Catch ex As Exception + ' Do nothing + End Try + + If rec Is Nothing AndAlso url.IndexOf("{") >= 0 Then + ' Localization. + + Throw New Exception(Page.GetResourceValue("Err:RecDataSrcNotInitialized", "Persons")) + + End If + Return EvaluateExpressions(url, arg, rec, bEncrypt) + End Function + + + Public Overridable Function GetRecord() As PersonalEducationRecord + If Not Me.DataSource Is Nothing Then + Return Me.DataSource + End If + + If Not Me.RecordUniqueId Is Nothing Then + + Return PersonalEducationTable.GetRecord(Me.RecordUniqueId, True) + + End If + + ' Localization. + + Throw New Exception(Page.GetResourceValue("Err:RetrieveRec", "Persons")) + + End Function + + Public Shadows ReadOnly Property Page() As BaseApplicationPage + Get + Return DirectCast(MyBase.Page, BaseApplicationPage) + End Get + End Property + +#End Region + +End Class + + + +' Base class for the PersonalEducationTableControl control on the EditPersonalEducationTable page. +' Do not modify this class. Instead override any method in PersonalEducationTableControl. +Public Class BasePersonalEducationTableControl + Inherits Persons.UI.BaseApplicationTableControl + + + + Protected Overridable Sub Control_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Init + + + + ' Setup the filter and search events. + + AddHandler Me.LevelIdFilter.SelectedIndexChanged, AddressOf LevelIdFilter_SelectedIndexChanged + AddHandler Me.PersonalIdFilter.SelectedIndexChanged, AddressOf PersonalIdFilter_SelectedIndexChanged + If Not Me.Page.IsPostBack Then + Dim initialVal As String = "" + If Me.InSession(Me.LevelIdFilter) + initialVal = Me.GetFromSession(Me.LevelIdFilter) + + End If + + If initialVal <> "" + + Me.LevelIdFilter.Items.Add(New ListItem(initialVal, initialVal)) + + Me.LevelIdFilter.SelectedValue = initialVal + + End If + + End If + If Not Me.Page.IsPostBack Then + Dim initialVal As String = "" + If Me.InSession(Me.PersonalEducationSearch) + initialVal = Me.GetFromSession(Me.PersonalEducationSearch) + + End If + + If initialVal <> "" + + Me.PersonalEducationSearch.Text = initialVal + + End If + + End If + If Not Me.Page.IsPostBack Then + Dim initialVal As String = "" + If Me.InSession(Me.PersonalIdFilter) + initialVal = Me.GetFromSession(Me.PersonalIdFilter) + + End If + + If initialVal <> "" + + Me.PersonalIdFilter.Items.Add(New ListItem(initialVal, initialVal)) + + Me.PersonalIdFilter.SelectedValue = initialVal + + End If + + End If + + + ' Control Initializations. + ' Initialize the table's current sort order. + + If Me.InSession(Me, "Order_By") Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + End If + + + + ' Setup default pagination settings. + + Me.PageSize = CInt(Me.GetFromSession(Me, "Page_Size", "10")) + Me.PageIndex = CInt(Me.GetFromSession(Me, "Page_Index", "0")) + + + + Me.ClearControlsFromSession() + End Sub + + Protected Overridable Sub Control_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load + + SaveControlsToSession_Ajax() + + ' Show confirmation message on Click + Me.PersonalEducationDeleteButton.Attributes.Add("onClick", "return (confirm('" & (CType(Me.Page,BaseApplicationPage)).GetResourceValue("DeleteConfirm", "Persons") & "'));") + + ' Setup the pagination events. + + AddHandler Me.PersonalEducationPagination.FirstPage.Click, AddressOf PersonalEducationPagination_FirstPage_Click + + AddHandler Me.PersonalEducationPagination.LastPage.Click, AddressOf PersonalEducationPagination_LastPage_Click + + AddHandler Me.PersonalEducationPagination.NextPage.Click, AddressOf PersonalEducationPagination_NextPage_Click + + AddHandler Me.PersonalEducationPagination.PageSizeButton.Click, AddressOf PersonalEducationPagination_PageSizeButton_Click + + AddHandler Me.PersonalEducationPagination.PreviousPage.Click, AddressOf PersonalEducationPagination_PreviousPage_Click + + + ' Setup the sorting events. + + AddHandler Me.CommandDateLabel.Click, AddressOf CommandDateLabel_Click + + AddHandler Me.CommandLabel.Click, AddressOf CommandLabel_Click + + AddHandler Me.COUNTRYLabel.Click, AddressOf COUNTRYLabel_Click + + AddHandler Me.CourseAbbrLabel.Click, AddressOf CourseAbbrLabel_Click + + AddHandler Me.CourseLabel.Click, AddressOf CourseLabel_Click + + AddHandler Me.CourseNoLabel.Click, AddressOf CourseNoLabel_Click + + AddHandler Me.EducationPeriodLabel.Click, AddressOf EducationPeriodLabel_Click + + AddHandler Me.EducationTypeLabel.Click, AddressOf EducationTypeLabel_Click + + AddHandler Me.EducationTypeLabel1.Click, AddressOf EducationTypeLabel1_Click + + AddHandler Me.EdYearLabel.Click, AddressOf EdYearLabel_Click + + AddHandler Me.EndDateLabel.Click, AddressOf EndDateLabel_Click + + AddHandler Me.FacultryLabel.Click, AddressOf FacultryLabel_Click + + AddHandler Me.InstitueLabel.Click, AddressOf InstitueLabel_Click + + AddHandler Me.LevelIdLabel1.Click, AddressOf LevelIdLabel1_Click + + AddHandler Me.NoAllLabel.Click, AddressOf NoAllLabel_Click + + AddHandler Me.PersonalIdLabel1.Click, AddressOf PersonalIdLabel1_Click + + AddHandler Me.ScoreLabel.Click, AddressOf ScoreLabel_Click + + AddHandler Me.ScoreNoLabel.Click, AddressOf ScoreNoLabel_Click + + AddHandler Me.StartDateLabel.Click, AddressOf StartDateLabel_Click + + ' Setup the button events. + + AddHandler Me.PersonalEducationAddButton.Click, AddressOf PersonalEducationAddButton_Click + + AddHandler Me.PersonalEducationDeleteButton.Click, AddressOf PersonalEducationDeleteButton_Click + + AddHandler Me.PersonalEducationEditButton.Click, AddressOf PersonalEducationEditButton_Click + + AddHandler Me.PersonalEducationRefreshButton.Click, AddressOf PersonalEducationRefreshButton_Click + + AddHandler Me.PersonalEducationResetButton.Click, AddressOf PersonalEducationResetButton_Click + + AddHandler Me.PersonalEducationSaveButton.Click, AddressOf PersonalEducationSaveButton_Click + + Me.PersonalEducationSaveButton.Attributes.Add("onclick", "SubmitHRefOnce(this, """ & Me.Page.GetResourceValue("Txt:SaveRecord", "Persons") & """);") + + AddHandler Me.PersonalEducationSearchButton.Button.Click, AddressOf PersonalEducationSearchButton_Click + + + ' Setup events for others + + End Sub + + + Public Overridable Sub LoadData() + + ' Read data from database. Returns an array of records that can be assigned + ' to the DataSource table control property. + Try + Dim joinFilter As CompoundFilter = CreateCompoundJoinFilter() + + ' The WHERE clause will be empty when displaying all records in table. + Dim wc As WhereClause = CreateWhereClause() + If wc IsNot Nothing AndAlso Not wc.RunQuery Then + ' Initialize an empty array of records + Dim alist As New ArrayList(0) + Me.DataSource = DirectCast(alist.ToArray(GetType(PersonalEducationRecord)), PersonalEducationRecord()) + ' Add records to the list if needed. + Me.AddNewRecords() + Me._TotalRecords = 0 + Me._TotalPages = 0 + Return + End If + + ' Call OrderBy to determine the order - either use the order defined + ' on the Query Wizard, or specified by user (by clicking on column heading) + Dim orderBy As OrderBy = CreateOrderBy() + + ' Get the pagesize from the pagesize control. + Me.GetPageSize() + + If Me.DisplayLastPage Then + Dim totalRecords As Integer = If(Me._TotalRecords < 0, PersonalEducationTable.GetRecordCount(CreateCompoundJoinFilter(), CreateWhereClause()), Me._TotalRecords) + + Dim totalPages As Integer = CInt(Math.Ceiling(totalRecords / Me.PageSize)) + + Me.PageIndex = totalPages - 1 + End If + + ' Make sure PageIndex (current page) and PageSize are within bounds. + If Me.PageIndex < 0 Then + Me.PageIndex = 0 + End If + If Me.PageSize < 1 Then + Me.PageSize = 1 + End If + + ' Retrieve the records and set the table DataSource. + ' Only PageSize records are fetched starting at PageIndex (zero based). + If Me.AddNewRecord > 0 Then + ' Make sure to preserve the previously entered data on new rows. + Dim postdata As New ArrayList + For Each rc As PersonalEducationTableControlRow In Me.GetRecordControls() + If Not rc.IsNewRecord Then + rc.DataSource = rc.GetRecord() + rc.GetUIData() + postdata.Add(rc.DataSource) + UIData.Add(rc.PreservedUIData()) + End If + Next + Me.DataSource = DirectCast(postdata.ToArray(GetType(PersonalEducationRecord)), PersonalEducationRecord()) + Else ' Get the records from the database + Me.DataSource = PersonalEducationTable.GetRecords(joinFilter, wc, orderBy, Me.PageIndex, Me.PageSize) + + End If + + ' if the datasource contains no records contained in database, then load the last page. + If (DbUtils.GetCreatedRecords(Me.DataSource).Length = 0 AndAlso Not Me.DisplayLastPage) Then + Me.DisplayLastPage = True + LoadData() + Else + + ' Add any new rows desired by the user. + Me.AddNewRecords() + + ' Turn off the ToggleAll checkbox + Me.PersonalEducationToggleAll.Checked = False + + + ' Initialize the page and grand totals. now + + End If + + Catch ex As Exception + ' Report the error message to the end user + Dim msg As String = ex.Message + If ex.InnerException IsNot Nothing Then + msg = msg & " InnerException: " & ex.InnerException.Message + End If + Throw New Exception(msg, ex.InnerException) + End Try + End Sub + + + + + Public Overrides Sub DataBind() + ' The DataBind method binds the user interface controls to the values + ' from the database record for each row in the table. To do this, it calls the + ' DataBind for each of the rows. + ' DataBind also populates any filters above the table, and sets the pagination + ' control to the correct number of records and the current page number. + + MyBase.DataBind() + + ' Make sure that the DataSource is initialized. + If Me.DataSource Is Nothing Then + Return + End If + + 'LoadData for DataSource for chart and report if they exist + + ' Improve performance by prefetching display as records. + Me.PreFetchForeignKeyValues() + + ' Setup the pagination controls. + BindPaginationControls() + + + + ' Bind the repeater with the list of records to expand the UI. + Dim rep As System.Web.UI.WebControls.Repeater = CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalEducationTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return + rep.DataSource = DataSource() + rep.DataBind() + + Dim index As Integer = 0 + For Each repItem As System.Web.UI.WebControls.RepeaterItem In rep.Items + ' Loop through all rows in the table, set its DataSource and call DataBind(). + Dim recControl As PersonalEducationTableControlRow = DirectCast(repItem.FindControl("PersonalEducationTableControlRow"), PersonalEducationTableControlRow) + recControl.DataSource = Me.DataSource(index) + If Me.UIData.Count > index Then + recControl.PreviousUIData = Me.UIData(index) + End If + recControl.DataBind() + recControl.Visible = Not Me.InDeletedRecordIds(recControl) + + index += 1 + Next + + + + + ' Call the Set methods for each controls on the panel + + SetCommandDateLabel() + SetCommandLabel() + SetCOUNTRYLabel() + SetCourseAbbrLabel() + SetCourseLabel() + SetCourseNoLabel() + SetEducationPeriodLabel() + SetEducationTypeLabel() + SetEducationTypeLabel1() + SetEdYearLabel() + SetEndDateLabel() + SetFacultryLabel() + SetInstitueLabel() + SetLevelIdFilter() + SetLevelIdLabel() + SetLevelIdLabel1() + SetNoAllLabel() + + + + + + + + SetPersonalEducationSearch() + + SetPersonalEducationTableControlCollapsibleRegion() + SetPersonalEducationTableControlIcon() + SetPersonalEducationTableControlPanelExtender() + + + SetPersonalIdFilter() + SetPersonalIdLabel() + SetPersonalIdLabel1() + SetScoreLabel() + SetScoreNoLabel() + SetStartDateLabel() + ' setting the state of expand or collapse alternative rows + + + ' Load data for each record and table UI control. + ' Ordering is important because child controls get + ' their parent ids from their parent UI controls. + + + ' this method calls the set method for controls with special formula like running total, sum, rank, etc + SetFormulaControls() + End Sub + + Public Overridable Sub SetFormulaControls() + ' this method calls Set methods for the control that has special formula + + + + End Sub + + + Public Sub PreFetchForeignKeyValues() + If (IsNothing(Me.DataSource)) + Return + End If + + Me.Page.PregetDfkaRecords(PersonalEducationTable.COUNTRY, Me.DataSource) + + Me.Page.PregetDfkaRecords(PersonalEducationTable.EducationPeriod, Me.DataSource) + + Me.Page.PregetDfkaRecords(PersonalEducationTable.LevelId, Me.DataSource) + + Me.Page.PregetDfkaRecords(PersonalEducationTable.PersonalId, Me.DataSource) + + End Sub + + + Public Overridable Sub RegisterPostback() + + Me.Page.RegisterPostBackTrigger(MiscUtils.FindControlRecursively(Me,"PersonalEducationSaveButton")) + + + End Sub + + Public EvaluateFormulaDelegate As BaseClasses.Data.DataSource.EvaluateFormulaDelegate = New BaseClasses.Data.DataSource.EvaluateFormulaDelegate(AddressOf Me.EvaluateFormula) + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean, ByVal e as FormulaEvaluator) As String + If e Is Nothing + e = New FormulaEvaluator() + End If + + e.Variables.Clear() + + + ' add variables for formula evaluation + If variables IsNot Nothing Then + Dim enumerator As System.Collections.Generic.IEnumerator(Of System.Collections.Generic.KeyValuePair(Of String, Object)) = variables.GetEnumerator() + While enumerator.MoveNext() + e.Variables.Add(enumerator.Current.Key, enumerator.Current.Value) + End While + End If + + If includeDS + + End If + + ' All variables referred to in the formula are expected to be + ' properties of the DataSource. For example, referring to + ' UnitPrice as a variable will refer to DataSource.UnitPrice + e.DataSource = dataSourceForEvaluate + + ' Define the calling control. This is used to add other + ' related table and record controls as variables. + e.CallingControl = Me + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + + If Not String.IsNullOrEmpty(format) AndAlso (String.IsNullOrEmpty(formula) OrElse formula.IndexOf("Format(") < 0) Then + Return FormulaUtils.Format(resultObj, format) + Else + Return resultObj.ToString() + End If + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format,variables ,includeDS, Nothing) + End Function + + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object)) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format, variables ,True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, format, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal e as FormulaEvaluator) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, variables, True, e) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal includeDS as Boolean) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, includeDS, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, True, Nothing) + End Function + + + + + Public Overridable Sub ResetControl() + + Me.LevelIdFilter.ClearSelection() + + Me.PersonalIdFilter.ClearSelection() + + Me.PersonalEducationSearch.Text = "" + + Me.CurrentSortOrder.Reset() + If (Me.InSession(Me, "Order_By")) Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + End If + + Me.PageIndex = 0 + End Sub + + Protected Overridable Sub BindPaginationControls() + ' Setup the pagination controls. + + ' Bind the pagination labels. + + If DbUtils.GetCreatedRecords(Me.DataSource).Length > 0 Then + + Me.PersonalEducationPagination.CurrentPage.Text = (Me.PageIndex + 1).ToString() + Else + Me.PersonalEducationPagination.CurrentPage.Text = "0" + End If + Me.PersonalEducationPagination.PageSize.Text = Me.PageSize.ToString() + Me.PersonalEducationPagination.TotalItems.Text = Me.TotalRecords.ToString() + Me.PersonalEducationPagination.TotalPages.Text = Me.TotalPages.ToString() + + ' Bind the buttons for PersonalEducationTableControl pagination. + + Me.PersonalEducationPagination.FirstPage.Enabled = Not (Me.PageIndex = 0) + If Me._TotalPages < 0 Then ' if the total pages is not determined yet, enable last and next buttons + Me.PersonalEducationPagination.LastPage.Enabled = True + ElseIf Me._TotalPages = 0 ' if the total pages is determined and it is 0, enable last and next buttons + Me.PersonalEducationPagination.LastPage.Enabled = False + Else ' if the total pages is the last page, disable last and next buttons + Me.PersonalEducationPagination.LastPage.Enabled = Not (Me.PageIndex = Me.TotalPages - 1) + End If + + If Me._TotalPages < 0 Then ' if the total pages is not determined yet, enable last and next buttons + Me.PersonalEducationPagination.NextPage.Enabled = True + ElseIf Me._TotalPages = 0 ' if the total pages is determined and it is 0, enable last and next buttons + Me.PersonalEducationPagination.NextPage.Enabled = False + Else ' if the total pages is the last page, disable last and next buttons + Me.PersonalEducationPagination.NextPage.Enabled = Not (Me.PageIndex = Me.TotalPages - 1) + End If + + Me.PersonalEducationPagination.PreviousPage.Enabled = Not (Me.PageIndex = 0) + + + End Sub + + Public Overridable Sub SaveData() + ' Save the data from the entire table. Calls each row's Save Data + ' to save their data. This function is called by the Click handler of the + ' Save button. The button handler should Start/Commit/End a transaction. + + Dim recCtl As PersonalEducationTableControlRow + For Each recCtl In Me.GetRecordControls() + + If Me.InDeletedRecordIds(recCtl) Then + ' Delete any pending deletes. + recCtl.Delete() + Else + If recCtl.Visible Then + recCtl.SaveData() + End If + End If + + Next + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + ' Set IsNewRecord to False for all records - since everything has been saved and is no longer "new" + For Each recCtl In Me.GetRecordControls() + recCtl.IsNewRecord = False + Next + + + ' Set DeletedRecordsIds to Nothing since we have deleted all pending deletes. + Me.DeletedRecordIds = Nothing + + End Sub + + Public Overridable Function CreateCompoundJoinFilter() As CompoundFilter + Dim jFilter As CompoundFilter = New CompoundFilter() + + Return jFilter + + End Function + + + Public Overridable Function CreateOrderBy() As OrderBy + ' The CurrentSortOrder is initialized to the sort order on the + ' Query Wizard. It may be modified by the Click handler for any of + ' the column heading to sort or reverse sort by that column. + ' You can add your own sort order, or modify it on the Query Wizard. + Return Me.CurrentSortOrder + End Function + + Public Overridable Function CreateWhereClause() As WhereClause + 'This CreateWhereClause is used for loading the data. + PersonalEducationTable.Instance.InnerFilter = Nothing + Dim wc As WhereClause = New WhereClause() + + ' Compose the WHERE clause consiting of: + ' 1. Static clause defined at design time. + ' 2. User selected search criteria. + ' 3. User selected filter criteria. + + + If IsValueSelected(Me.LevelIdFilter) Then + + wc.iAND(PersonalEducationTable.LevelId, BaseFilter.ComparisonOperator.EqualsTo, MiscUtils.GetSelectedValue(Me.LevelIdFilter, Me.GetFromSession(Me.LevelIdFilter)), False, False) + + End If + + + + If IsValueSelected(Me.PersonalEducationSearch) Then + If Me.PersonalEducationSearch.Text = BaseClasses.Resources.AppResources.GetResourceValue("Txt:SearchForEllipsis", Nothing) Then + Me.PersonalEducationSearch.Text = "" + Else + ' Strip "..." from begin and ending of the search text, otherwise the search will return 0 values as in database "..." is not stored. + + If Me.PersonalEducationSearch.Text.StartsWith("...") Then + Me.PersonalEducationSearch.Text = Me.PersonalEducationSearch.Text.SubString(3,Me.PersonalEducationSearch.Text.Length-3) + End If + If Me.PersonalEducationSearch.Text.EndsWith("...") then + Me.PersonalEducationSearch.Text = Me.PersonalEducationSearch.Text.SubString(0,Me.PersonalEducationSearch.Text.Length-3) + ' Strip the last word as well as it is likely only a partial word + Dim endindex As Integer = PersonalEducationSearch.Text.Length - 1 + While (Not Char.IsWhiteSpace(PersonalEducationSearch.Text(endindex)) AndAlso endindex > 0) + endindex -= 1 + End While + If endindex > 0 Then + PersonalEducationSearch.Text = PersonalEducationSearch.Text.Substring(0, endindex) + End If + End If + End If + + Dim formatedSearchText As String = MiscUtils.GetSelectedValue(Me.PersonalEducationSearch, Me.GetFromSession(Me.PersonalEducationSearch)) + + ' After stripping "..." see if the search text is null or empty. + If IsValueSelected(Me.PersonalEducationSearch) Then + ' These clauses are added depending on operator and fields selected in Control's property page, bindings tab. + + Dim search As WhereClause = New WhereClause() + + search.iOR(PersonalEducationTable.Course, BaseFilter.ComparisonOperator.Contains, MiscUtils.GetSelectedValue(Me.PersonalEducationSearch, Me.GetFromSession(Me.PersonalEducationSearch)), True, False) + + search.iOR(PersonalEducationTable.CourseAbbr, BaseFilter.ComparisonOperator.Contains, MiscUtils.GetSelectedValue(Me.PersonalEducationSearch, Me.GetFromSession(Me.PersonalEducationSearch)), True, False) + + wc.iAND(search) + + End If + End If + + If IsValueSelected(Me.PersonalIdFilter) Then + + wc.iAND(PersonalEducationTable.PersonalId, BaseFilter.ComparisonOperator.EqualsTo, MiscUtils.GetSelectedValue(Me.PersonalIdFilter, Me.GetFromSession(Me.PersonalIdFilter)), False, False) + + End If + + + + Return wc + End Function + + + Public Overridable Function CreateWhereClause(ByVal searchText as String, ByVal fromSearchControl as String, ByVal AutoTypeAheadSearch as String, ByVal AutoTypeAheadWordSeparators as String) As WhereClause + ' This CreateWhereClause is used for loading list of suggestions for Auto Type-Ahead feature. + PersonalEducationTable.Instance.InnerFilter = Nothing + Dim wc As WhereClause = New WhereClause() + + ' Compose the WHERE clause consiting of: + ' 1. Static clause defined at design time. + ' 2. User selected search criteria. + ' 3. User selected filter criteria. + + Dim appRelativeVirtualPath As String = CType(HttpContext.Current.Session("AppRelativeVirtualPath"), String) + + ' Adds clauses if values are selected in Filter controls which are configured in the page. + + Dim LevelIdFilterSelectedValue As String = CType(HttpContext.Current.Session()(HttpContext.Current.Session.SessionID & appRelativeVirtualPath & "LevelIdFilter_Ajax"), String) + If IsValueSelected(LevelIdFilterSelectedValue) Then + + wc.iAND(PersonalEducationTable.LevelId, BaseFilter.ComparisonOperator.EqualsTo, LevelIdFilterSelectedValue, false, False) + + End If + + If IsValueSelected(searchText) and fromSearchControl = "PersonalEducationSearch" Then + Dim formatedSearchText as String = searchText + ' Strip "..." from begin and ending of the search text, otherwise the search will return 0 values as in database "..." is not stored. + If searchText.StartsWith("...") Then + formatedSearchText = searchText.SubString(3,searchText.Length-3) + End If + If searchText.EndsWith("...") Then + formatedSearchText = searchText.SubString(0,searchText.Length-3) + ' Strip the last word as well as it is likely only a partial word + Dim endindex As Integer = searchText.Length - 1 + While (Not Char.IsWhiteSpace(searchText(endindex)) AndAlso endindex > 0) + endindex -= 1 + End While + If endindex > 0 Then + searchText = searchText.Substring(0, endindex) + End If + End If + 'After stripping "...", trim any leading and trailing whitespaces + formatedSearchText = formatedSearchText.Trim() + ' After stripping "..." see if the search text is null or empty. + If IsValueSelected(formatedSearchText) Then + ' These clauses are added depending on operator and fields selected in Control's property page, bindings tab. + + Dim search As WhereClause = New WhereClause() + + If InvariantLCase(AutoTypeAheadSearch).equals("wordsstartingwithsearchstring") Then + + search.iOR(PersonalEducationTable.Course, BaseFilter.ComparisonOperator.Starts_With, formatedSearchText, True, False) + search.iOR(PersonalEducationTable.Course, BaseFilter.ComparisonOperator.Contains, AutoTypeAheadWordSeparators & formatedSearchText, True, False) + + search.iOR(PersonalEducationTable.CourseAbbr, BaseFilter.ComparisonOperator.Starts_With, formatedSearchText, True, False) + search.iOR(PersonalEducationTable.CourseAbbr, BaseFilter.ComparisonOperator.Contains, AutoTypeAheadWordSeparators & formatedSearchText, True, False) + + Else + + search.iOR(PersonalEducationTable.Course, BaseFilter.ComparisonOperator.Contains, formatedSearchText, True, False) + search.iOR(PersonalEducationTable.CourseAbbr, BaseFilter.ComparisonOperator.Contains, formatedSearchText, True, False) + End If + wc.iAND(search) + + End If + End If + + Dim PersonalIdFilterSelectedValue As String = CType(HttpContext.Current.Session()(HttpContext.Current.Session.SessionID & appRelativeVirtualPath & "PersonalIdFilter_Ajax"), String) + If IsValueSelected(PersonalIdFilterSelectedValue) Then + + wc.iAND(PersonalEducationTable.PersonalId, BaseFilter.ComparisonOperator.EqualsTo, PersonalIdFilterSelectedValue, false, False) + + End If + + + Return wc + End Function + + Public Overridable Function GetAutoCompletionList_PersonalEducationSearch(ByVal prefixText As String, ByVal count As Integer) As String() + Dim resultList As ArrayList = New ArrayList + Dim wordList As ArrayList = New ArrayList + Dim iteration As Integer = 0 + + Dim filterJoin As CompoundFilter = CreateCompoundJoinFilter() + Dim wc As WhereClause = CreateWhereClause(prefixText,"PersonalEducationSearch", "WordsStartingWithSearchString", "[^a-zA-Z0-9]") + While (resultList.Count < count AndAlso iteration < 5) + ' Fetch 100 records in each iteration + Dim recordList () As Persons.Business.PersonalEducationRecord = PersonalEducationTable.GetRecords(filterJoin, wc, Nothing, iteration, 100) + Dim rec As PersonalEducationRecord = Nothing + Dim resultItem As String = "" + For Each rec In recordList + ' Exit the loop if recordList count has reached AutoTypeAheadListSize. + If resultList.Count >= count then + Exit For + End If + ' If the field is configured to Display as Foreign key, Format() method returns the + ' Display as Forien Key value instead of original field value. + ' Since search had to be done in multiple fields (selected in Control's page property, binding tab) in a record, + ' We need to find relevent field to display which matches the prefixText and is not already present in the result list. + + resultItem = rec.Format(PersonalEducationTable.Course) + If resultItem IsNot Nothing AndAlso resultItem.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture).Contains(prefixText.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture)) Then + + Dim isAdded As Boolean = FormatSuggestions(prefixText, resultItem, 50, "AtBeginningOfMatchedString", "WordsStartingWithSearchString", "[^a-zA-Z0-9]", resultList) + If isAdded Then + Continue For + End If + End If + + resultItem = rec.Format(PersonalEducationTable.CourseAbbr) + If resultItem IsNot Nothing AndAlso resultItem.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture).Contains(prefixText.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture)) Then + + Dim isAdded As Boolean = FormatSuggestions(prefixText, resultItem, 50, "AtBeginningOfMatchedString", "WordsStartingWithSearchString", "[^a-zA-Z0-9]", resultList) + If isAdded Then + Continue For + End If + End If + + Next + ' Exit the loop if number of records found is less as further iteration will not return any more records + If recordList .Length < 100 Then + Exit While + End If + iteration += 1 + End While + + resultList.Sort() + Dim result() As String = New String(resultList.Count - 1) {} + Array.Copy(resultList.ToArray, result, resultList.Count) + Return result + End Function + + + Public Overridable Function FormatSuggestions(ByVal prefixText As String, ByVal resultItem As String, _ + ByVal columnLength As Integer, ByVal AutoTypeAheadDisplayFoundText As String, _ + ByVal autoTypeAheadSearch As String, ByVal AutoTypeAheadWordSeparators As String, _ + ByVal resultList As ArrayList) As Boolean + + 'Formats the resultItem and adds it to the list of suggestions. + Dim index As Integer = resultItem.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture).IndexOf(prefixText.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture)) + Dim itemToAdd As String = "" + Dim isFound As Boolean = False + Dim isAdded As Boolean = False + ' Get the index where prfixt is at the beginning of resultItem. If not found then, index of word which begins with prefixText. + If InvariantLCase(autoTypeAheadSearch).equals("wordsstartingwithsearchstring") And Not index = 0 Then + ' Expression to find word which contains AutoTypeAheadWordSeparators followed by prefixText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex( AutoTypeAheadWordSeparators + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + If regex1.IsMatch(resultItem) Then + index = regex1.Match(resultItem).Index + isFound = True + End If + ' If the prefixText is found immediatly after white space then starting of the word is found so don not search any further + If not resultItem(index).ToString() = " " Then + ' Expression to find beginning of the word which contains AutoTypeAheadWordSeparators followed by prefixText + Dim regex As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\\S*" + AutoTypeAheadWordSeparators + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + If regex.IsMatch(resultItem) Then + index = regex.Match(resultItem).Index + isFound = True + End If + End If + End If + + ' If autoTypeAheadSearch value is wordsstartingwithsearchstring then, extract the substring only if the prefixText is found at the + ' beginning of the resultItem (index = 0) or a word in resultItem is found starts with prefixText. + If index = 0 Or isFound Or InvariantLCase(autoTypeAheadSearch).Equals("anywhereinstring") then + If InvariantLCase(AutoTypeAheadDisplayFoundText).equals("atbeginningofmatchedstring") Then + ' Expression to find beginning of the word which contains prefixText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\\S*" + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + ' Find the beginning of the word which contains prefexText + If (StringUtils.InvariantLCase(autoTypeAheadSearch).Equals("anywhereinstring") AndAlso regex1.IsMatch(resultItem)) Then + index = regex1.Match(resultItem).Index + isFound = True + End If + ' Display string from the index till end of the string if sub string from index till end is less than columnLength value. + If Len(resultItem) - index <= columnLength Then + If index = 0 Then + itemToAdd = resultItem + Else + itemToAdd = "..." & resultItem.Substring(index, Len(resultItem) - index) + End If + Else + If index = 0 Then + itemToAdd = resultItem.Substring(index, (columnLength - 3)) & "..." + Else + 'Truncate the string to show only columnLength - 6 characters as begining and trailing "..." has to be appended. + itemToAdd = "..." & resultItem.Substring(index , columnLength - 6) & "..." + End If + End If + ElseIf InvariantLCase(AutoTypeAheadDisplayFoundText).equals("inmiddleofmatchedstring") Then + Dim subStringBeginIndex As Integer = CType(columnLength/2, Integer) + If Len(resultItem) <= columnLength Then + itemToAdd = resultItem + Else + ' Sanity check at end of the string + If index + Len(prefixText) = columnLength Then + itemToAdd = "..." & resultItem.Substring(index-columnLength,index) + ElseIf Len(resultItem) - index < subStringBeginIndex Then + ' Display string from the end till columnLength value if, index is closer to the end of the string. + itemToAdd = "..." & resultItem.Substring(Len(resultItem)-columnLength,Len(resultItem)) + ElseIf index <= subStringBeginIndex Then + ' Sanity chet at beginning of the string + itemToAdd = resultItem.Substring(0, columnLength) & "..." + Else + ' Display string containing text before the prefixText occures and text after the prefixText + itemToAdd = "..." & resultItem.Substring(index - subStringBeginIndex, columnLength) & "..." + End If + End If + ElseIf InvariantLCase(AutoTypeAheadDisplayFoundText).equals("atendofmatchedstring") Then + ' Expression to find ending of the word which contains prefexText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\s", System.Text.RegularExpressions.RegexOptions.IgnoreCase) + ' Find the ending of the word which contains prefexText + If regex1.IsMatch(resultItem, index + 1) Then + index = regex1.Match(resultItem, index + 1).Index + Else + ' If the word which contains prefexText is the last word in string, regex1.IsMatch returns false. + index = resultItem.Length + End If + If index > Len(resultItem) Then + index = Len(resultItem) + End If + ' If text from beginning of the string till index is less than columnLength value then, display string from the beginning till index. + If index <= columnLength Then + if index = Len(resultItem) Then 'Make decision to append "..." + itemToAdd = resultItem.Substring(0,index) + Else + itemToAdd = resultItem.Substring(0,index) & "..." + End If + Else + If index = Len(resultItem) Then + itemToAdd = "..." & resultItem.Substring(index - (columnLength - 3), (columnLength - 3)) + Else + 'Truncate the string to show only columnLength - 6 characters as begining and trailing "..." has to be appended. + itemToAdd = "..." & resultItem.Substring(index - (columnLength - 6), columnLength - 6) & "..." + End If + End If + End If + + ' Remove newline character from itemToAdd + Dim prefixTextIndex As Integer = itemToAdd.IndexOf(prefixText, StringComparison.CurrentCultureIgnoreCase) + ' If itemToAdd contains any newline after the search text then show text only till newline + Dim regex2 As System.Text.RegularExpressions.Regex = New System.Text.RegularExpressions.Regex("(" & vbCrLf & "|" & vbLf & ")", System.Text.RegularExpressions.RegexOptions.IgnoreCase) + Dim newLineIndexAfterPrefix As Integer = -1 + If regex2.IsMatch(itemToAdd, prefixTextIndex) Then + newLineIndexAfterPrefix = regex2.Match(itemToAdd, prefixTextIndex).Index + End If + If (newLineIndexAfterPrefix > -1) Then + If itemToAdd.EndsWith("...") Then + itemToAdd = (itemToAdd.Substring(0, newLineIndexAfterPrefix) + "...") + Else + itemToAdd = itemToAdd.Substring(0, newLineIndexAfterPrefix) + End If + End If + ' If itemToAdd contains any newline before search text then show text which comes after newline + Dim regex3 As System.Text.RegularExpressions.Regex = New System.Text.RegularExpressions.Regex("(" & vbCrLf & "|" & vbLf & ")", (System.Text.RegularExpressions.RegexOptions.IgnoreCase Or System.Text.RegularExpressions.RegexOptions.RightToLeft)) + Dim newLineIndexBeforePrefix As Integer = -1 + If regex3.IsMatch(itemToAdd, prefixTextIndex) Then + newLineIndexBeforePrefix = regex3.Match(itemToAdd, prefixTextIndex).Index + End If + If (newLineIndexBeforePrefix > -1) Then + If itemToAdd.StartsWith("...") Then + itemToAdd = ("..." + itemToAdd.Substring((newLineIndexBeforePrefix + regex3.Match(itemToAdd, prefixTextIndex).Length))) + Else + itemToAdd = itemToAdd.Substring((newLineIndexBeforePrefix + regex3.Match(itemToAdd, prefixTextIndex).Length)) + End If + End If + + If Not itemToAdd is nothing AndAlso Not resultList.Contains(itemToAdd) Then + + resultList.Add(itemToAdd) + + isAdded = true + End If + End If + Return isAdded + End Function + + + Protected Overridable Sub GetPageSize() + + If Me.PersonalEducationPagination.PageSize.Text.Trim <> "" Then + Try + 'Me.PageSize = Integer.Parse(Me.PersonalEducationPagination.PageSize.Text) + Catch ex As Exception + End Try + End If + End Sub + + Protected Overridable Sub AddNewRecords() + + Dim newRecordList As ArrayList = New ArrayList() + + Dim newUIDataList As System.Collections.Generic.List(Of Hashtable) = New System.Collections.Generic.List(Of Hashtable)() + + ' Loop though all the record controls and if the record control + ' does not have a unique record id set, then create a record + ' and add to the list. + If Not Me.ResetData Then + Dim rep As System.Web.UI.WebControls.Repeater = CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalEducationTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return + + Dim repItem As System.Web.UI.WebControls.RepeaterItem + For Each repItem In rep.Items + ' Loop through all rows in the table, set its DataSource and call DataBind(). + + Dim recControl As PersonalEducationTableControlRow = DirectCast(repItem.FindControl("PersonalEducationTableControlRow"), PersonalEducationTableControlRow) + + If recControl.Visible AndAlso recControl.IsNewRecord() Then + + Dim rec As PersonalEducationRecord = New PersonalEducationRecord() + + If recControl.Command.Text <> "" Then + rec.Parse(recControl.Command.Text, PersonalEducationTable.Command) + End If + If recControl.CommandDate.Text <> "" Then + rec.Parse(recControl.CommandDate.Text, PersonalEducationTable.CommandDate) + End If + If MiscUtils.IsValueSelected(recControl.COUNTRY) Then + rec.Parse(recControl.COUNTRY.SelectedItem.Value, PersonalEducationTable.COUNTRY) + End If + If recControl.Course.Text <> "" Then + rec.Parse(recControl.Course.Text, PersonalEducationTable.Course) + End If + If recControl.CourseAbbr.Text <> "" Then + rec.Parse(recControl.CourseAbbr.Text, PersonalEducationTable.CourseAbbr) + End If + If recControl.CourseNo.Text <> "" Then + rec.Parse(recControl.CourseNo.Text, PersonalEducationTable.CourseNo) + End If + If recControl.EducationPeriod.Text <> "" Then + rec.Parse(recControl.EducationPeriod.Text, PersonalEducationTable.EducationPeriod) + End If + If recControl.EducationType.Text <> "" Then + rec.Parse(recControl.EducationType.Text, PersonalEducationTable.EducationType) + End If + If MiscUtils.IsValueSelected(recControl.EducationType1) Then + rec.Parse(recControl.EducationType1.SelectedItem.Value, PersonalEducationTable.EducationType) + End If + If recControl.EdYear.Text <> "" Then + rec.Parse(recControl.EdYear.Text, PersonalEducationTable.EdYear) + End If + If recControl.EndDate.Text <> "" Then + rec.Parse(recControl.EndDate.Text, PersonalEducationTable.EndDate) + End If + If recControl.Facultry.Text <> "" Then + rec.Parse(recControl.Facultry.Text, PersonalEducationTable.Facultry) + End If + If recControl.Institue.Text <> "" Then + rec.Parse(recControl.Institue.Text, PersonalEducationTable.Institue) + End If + If MiscUtils.IsValueSelected(recControl.LevelId) Then + rec.Parse(recControl.LevelId.SelectedItem.Value, PersonalEducationTable.LevelId) + End If + If recControl.NoAll.Text <> "" Then + rec.Parse(recControl.NoAll.Text, PersonalEducationTable.NoAll) + End If + If MiscUtils.IsValueSelected(recControl.PersonalId) Then + rec.Parse(recControl.PersonalId.SelectedItem.Value, PersonalEducationTable.PersonalId) + End If + If recControl.Score.Text <> "" Then + rec.Parse(recControl.Score.Text, PersonalEducationTable.Score) + End If + If recControl.ScoreNo.Text <> "" Then + rec.Parse(recControl.ScoreNo.Text, PersonalEducationTable.ScoreNo) + End If + If recControl.StartDate.Text <> "" Then + rec.Parse(recControl.StartDate.Text, PersonalEducationTable.StartDate) + End If + newUIDataList.Add(recControl.PreservedUIData()) + newRecordList.Add(rec) + End If + Next + End If + + + ' Add any new record to the list. + Dim index As Integer = 0 + For index = 1 To Me.AddNewRecord + + newRecordList.Insert(0, New PersonalEducationRecord()) + newUIDataList.Insert(0, New Hashtable()) + + Next + Me.AddNewRecord = 0 + + ' Finally, add any new records to the DataSource. + If newRecordList.Count > 0 Then + + Dim finalList As ArrayList = New ArrayList(Me.DataSource) + finalList.InsertRange(0, newRecordList) + + Me.DataSource = DirectCast(finalList.ToArray(GetType(PersonalEducationRecord)), PersonalEducationRecord()) + + End If + + ' Add the existing UI data to this hash table + If newUIDataList.Count > 0 Then + Me.UIData.InsertRange(0, newUIDataList) + End If + + End Sub + + + Public Sub AddToDeletedRecordIds(ByVal rec As PersonalEducationTableControlRow) + If rec.IsNewRecord() Then + Return + End If + + If Not Me.DeletedRecordIds Is Nothing AndAlso Me.DeletedRecordIds.Trim <> "" Then + Me.DeletedRecordIds &= "," + End If + + Me.DeletedRecordIds &= "[" & rec.RecordUniqueId & "]" + End Sub + + Protected Overridable Function InDeletedRecordIds(ByVal rec As PersonalEducationTableControlRow) As Boolean + If Me.DeletedRecordIds Is Nothing OrElse Me.DeletedRecordIds.Trim = "" Then + Return False + End If + + Return Me.DeletedRecordIds.IndexOf("[" & rec.RecordUniqueId & "]") >= 0 + End Function + + Private _DeletedRecordIds As String + Public Property DeletedRecordIds() As String + Get + Return Me._DeletedRecordIds + End Get + Set(ByVal value As String) + Me._DeletedRecordIds = value + End Set + End Property + + + ' Create Set, WhereClause, and Populate Methods + + Public Overridable Sub SetCommandDateLabel() + + End Sub + + Public Overridable Sub SetCommandLabel() + + End Sub + + Public Overridable Sub SetCOUNTRYLabel() + + End Sub + + Public Overridable Sub SetCourseAbbrLabel() + + End Sub + + Public Overridable Sub SetCourseLabel() + + End Sub + + Public Overridable Sub SetCourseNoLabel() + + End Sub + + Public Overridable Sub SetEducationPeriodLabel() + + End Sub + + Public Overridable Sub SetEducationTypeLabel() + + End Sub + + Public Overridable Sub SetEducationTypeLabel1() + + End Sub + + Public Overridable Sub SetEdYearLabel() + + End Sub + + Public Overridable Sub SetEndDateLabel() + + End Sub + + Public Overridable Sub SetFacultryLabel() + + End Sub + + Public Overridable Sub SetInstitueLabel() + + End Sub + + Public Overridable Sub SetLevelIdLabel() + + End Sub + + Public Overridable Sub SetLevelIdLabel1() + + End Sub + + Public Overridable Sub SetNoAllLabel() + + End Sub + + Public Overridable Sub SetPersonalEducationTableControlCollapsibleRegion() + + End Sub + + Public Overridable Sub SetPersonalEducationTableControlIcon() + + End Sub + + Public Overridable Sub SetPersonalEducationTableControlPanelExtender() + + End Sub + + Public Overridable Sub SetPersonalIdLabel() + + End Sub + + Public Overridable Sub SetPersonalIdLabel1() + + End Sub + + Public Overridable Sub SetScoreLabel() + + End Sub + + Public Overridable Sub SetScoreNoLabel() + + End Sub + + Public Overridable Sub SetStartDateLabel() + + End Sub + + Public Overridable Sub SetLevelIdFilter() + + Me.PopulateLevelIdFilter(GetSelectedValue(Me.LevelIdFilter, GetFromSession(Me.LevelIdFilter)), 500) + + End Sub + + Public Overridable Sub SetPersonalEducationSearch() + + End Sub + + Public Overridable Sub SetPersonalIdFilter() + + Me.PopulatePersonalIdFilter(GetSelectedValue(Me.PersonalIdFilter, GetFromSession(Me.PersonalIdFilter)), 500) + + End Sub + + ' Get the filters' data for LevelIdFilter + Protected Overridable Sub PopulateLevelIdFilter(ByVal selectedValue As String, ByVal maxItems As Integer) + + + Me.LevelIdFilter.Items.Clear() + + + + ' Set up the WHERE and the ORDER BY clause by calling the CreateWhereClause_LevelIdFilter function. + ' It is better to customize the where clause there. + + + + 'Setup the WHERE clause. + Dim wc As WhereClause = Me.CreateWhereClause_LevelIdFilter() + + ' Setup the static list items + + ' Add the All item. + Me.LevelIdFilter.Items.Insert(0, new ListItem(Me.Page.GetResourceValue("Txt:All", "Persons"), "--ANY--")) + + + Dim orderBy As OrderBy = New OrderBy(false, false) + orderBy.Add(EducationTable.Level, OrderByItem.OrderDir.Asc) + + Dim variables As System.Collections.Generic.IDictionary(Of String, Object) = New System.Collections.Generic.Dictionary(Of String, Object) + + + + Dim noValueFormat As String = Page.GetResourceValue("Txt:Other", "Persons") + + + Dim itemValues() As EducationRecord = Nothing + + If wc.RunQuery + Dim counter As Integer = 0 + Dim pageNum As Integer = 0 + Dim evaluator As New FormulaEvaluator + Dim listDuplicates As New ArrayList() + + + + Do + + itemValues = EducationTable.GetRecords(wc, orderBy, pageNum, maxItems) + + For each itemValue As EducationRecord In itemValues + ' Create the item and add to the list. + Dim cvalue As String = Nothing + Dim fvalue As String = Nothing + If itemValue.EducationIdSpecified Then + cvalue = itemValue.EducationId.ToString() + + If counter < maxItems AndAlso Me.LevelIdFilter.Items.FindByValue(cvalue) Is Nothing Then + + Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalEducationTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalEducationTable.LevelId) + If _isExpandableNonCompositeForeignKey AndAlso PersonalEducationTable.LevelId.IsApplyDisplayAs Then + fvalue = PersonalEducationTable.GetDFKA(itemValue, PersonalEducationTable.LevelId) + End If + If (Not _isExpandableNonCompositeForeignKey) Or (String.IsNullOrEmpty(fvalue)) Then + fvalue = itemValue.Format(EducationTable.Level) + End If + + If fvalue Is Nothing OrElse fvalue.Trim() = "" Then fvalue = cvalue + + If (IsNothing(fvalue)) Then + fvalue = "" + End If + + fvalue = fvalue.Trim() + + If ( fvalue.Length > 50 ) Then + fvalue = fvalue.Substring(0, 50) & "..." + End If + + Dim dupItem As ListItem = Me.LevelIdFilter.Items.FindByText(fvalue) + + If Not IsNothing(dupItem) Then + listDuplicates.Add(fvalue) + dupItem.Text = fvalue & " (ID " & dupItem.Value.Substring(0, Math.Min(dupItem.Value.Length,38)) & ")" + End If + + Dim newItem As ListItem = New ListItem(fvalue, cvalue) + Me.LevelIdFilter.Items.Add(newItem) + + If listDuplicates.Contains(fvalue) Then + newItem.Text = fvalue & " (ID " & cvalue.Substring(0, Math.Min(cvalue.Length,38)) & ")" + End If + + counter += 1 + End If + End If + Next + pageNum += 1 + Loop While (itemValues.Length = maxItems AndAlso counter < maxItems) + End If + + + + + + + ' Set the selected value. + SetSelectedValue(Me.LevelIdFilter, selectedValue) + + + End Sub + + ' Get the filters' data for PersonalIdFilter + Protected Overridable Sub PopulatePersonalIdFilter(ByVal selectedValue As String, ByVal maxItems As Integer) + + + Me.PersonalIdFilter.Items.Clear() + + + + ' Set up the WHERE and the ORDER BY clause by calling the CreateWhereClause_PersonalIdFilter function. + ' It is better to customize the where clause there. + + + + 'Setup the WHERE clause. + Dim wc As WhereClause = Me.CreateWhereClause_PersonalIdFilter() + + ' Setup the static list items + + ' Add the All item. + Me.PersonalIdFilter.Items.Insert(0, new ListItem(Me.Page.GetResourceValue("Txt:All", "Persons"), "--ANY--")) + + + Dim orderBy As OrderBy = New OrderBy(false, false) + orderBy.Add(PersonalIdTable.PersonalName, OrderByItem.OrderDir.Asc) + + Dim variables As System.Collections.Generic.IDictionary(Of String, Object) = New System.Collections.Generic.Dictionary(Of String, Object) + + + + Dim noValueFormat As String = Page.GetResourceValue("Txt:Other", "Persons") + + + Dim itemValues() As PersonalIdRecord = Nothing + + If wc.RunQuery + Dim counter As Integer = 0 + Dim pageNum As Integer = 0 + Dim evaluator As New FormulaEvaluator + Dim listDuplicates As New ArrayList() + + + + Do + + itemValues = PersonalIdTable.GetRecords(wc, orderBy, pageNum, maxItems) + + For each itemValue As PersonalIdRecord In itemValues + ' Create the item and add to the list. + Dim cvalue As String = Nothing + Dim fvalue As String = Nothing + If itemValue.PersonalIdSpecified Then + cvalue = itemValue.PersonalId.ToString() + + If counter < maxItems AndAlso Me.PersonalIdFilter.Items.FindByValue(cvalue) Is Nothing Then + + Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalEducationTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalEducationTable.PersonalId) + If _isExpandableNonCompositeForeignKey AndAlso PersonalEducationTable.PersonalId.IsApplyDisplayAs Then + fvalue = PersonalEducationTable.GetDFKA(itemValue, PersonalEducationTable.PersonalId) + End If + If (Not _isExpandableNonCompositeForeignKey) Or (String.IsNullOrEmpty(fvalue)) Then + fvalue = itemValue.Format(PersonalIdTable.PersonalName) + End If + + If fvalue Is Nothing OrElse fvalue.Trim() = "" Then fvalue = cvalue + + If (IsNothing(fvalue)) Then + fvalue = "" + End If + + fvalue = fvalue.Trim() + + If ( fvalue.Length > 50 ) Then + fvalue = fvalue.Substring(0, 50) & "..." + End If + + Dim dupItem As ListItem = Me.PersonalIdFilter.Items.FindByText(fvalue) + + If Not IsNothing(dupItem) Then + listDuplicates.Add(fvalue) + dupItem.Text = fvalue & " (ID " & dupItem.Value.Substring(0, Math.Min(dupItem.Value.Length,38)) & ")" + End If + + Dim newItem As ListItem = New ListItem(fvalue, cvalue) + Me.PersonalIdFilter.Items.Add(newItem) + + If listDuplicates.Contains(fvalue) Then + newItem.Text = fvalue & " (ID " & cvalue.Substring(0, Math.Min(cvalue.Length,38)) & ")" + End If + + counter += 1 + End If + End If + Next + pageNum += 1 + Loop While (itemValues.Length = maxItems AndAlso counter < maxItems) + End If + + + + + + + ' Set the selected value. + SetSelectedValue(Me.PersonalIdFilter, selectedValue) + + + End Sub + + Public Overridable Function CreateWhereClause_LevelIdFilter() As WhereClause + + ' Create a where clause for the filter LevelIdFilter. + ' This function is called by the Populate method to load the items + ' in the LevelIdFilterDropDownList + + Dim wc As WhereClause= New WhereClause() + Return wc + + End Function + + Public Overridable Function CreateWhereClause_PersonalIdFilter() As WhereClause + + ' Create a where clause for the filter PersonalIdFilter. + ' This function is called by the Populate method to load the items + ' in the PersonalIdFilterDropDownList + + Dim wc As WhereClause= New WhereClause() + Return wc + + End Function + + + + + Protected Overridable Sub Control_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.PreRender + ' PreRender event is raised just before page is being displayed. + Try + DbUtils.StartTransaction + Me.RegisterPostback() + + If Not Me.Page.ErrorOnPage AndAlso (Me.Page.IsPageRefresh OrElse Me.DataChanged OrElse Me.ResetData) Then + + + ' Re-load the data and update the web page if necessary. + ' This is typically done during a postback (filter, search button, sort, pagination button). + ' In each of the other click handlers, simply set DataChanged to True to reload the data. + Dim added As Boolean = Me.AddNewRecord > 0 + Me.LoadData() + Me.DataBind() + + If added Then + Me.SetFocusToAddedRow() + End If + + End If + + + + Catch ex As Exception + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + Finally + DbUtils.EndTransaction + End Try + End Sub + + 'this function sets focus to the first editable element in the new added row in the editable table + Protected Overridable Sub SetFocusToAddedRow() + Dim rep As System.Web.UI.WebControls.Repeater = CType(Me.FindControl("PersonalEducationTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing OrElse rep.Items.Count = 0 Then Return + Dim repItem As System.Web.UI.WebControls.RepeaterItem + For Each repItem In rep.Items + 'Load scripts to table rows + Me.Page.LoadFocusScripts(repItem) + Dim recControl As PersonalEducationTableControlRow = DirectCast(repItem.FindControl("PersonalEducationTableControlRow"), PersonalEducationTableControlRow) + If recControl.IsNewRecord Then + For Each field As Control In recControl.Controls + If field.Visible AndAlso Me.Page.IsControlEditable(field, False) Then + 'set focus on the first editable field in the new row + field.Focus() + Dim updPan As UpdatePanel = DirectCast(Me.Page.FindControlRecursively("UpdatePanel1"), UpdatePanel) + If Not updPan Is Nothing Then updPan.Update() + Return + End If + Next + Return + End If + Next + End Sub + + + Protected Overrides Sub SaveControlsToSession() + MyBase.SaveControlsToSession() + + ' Save filter controls to values to session. + + Me.SaveToSession(Me.LevelIdFilter, Me.LevelIdFilter.SelectedValue) + + Me.SaveToSession(Me.PersonalEducationSearch, Me.PersonalEducationSearch.Text) + + Me.SaveToSession(Me.PersonalIdFilter, Me.PersonalIdFilter.SelectedValue) + + + 'Save pagination state to session. + + + + ' Save table control properties to the session. + If Not Me.CurrentSortOrder Is Nothing Then + Me.SaveToSession(Me, "Order_By", Me.CurrentSortOrder.ToXmlString()) + End If + + Me.SaveToSession(Me, "Page_Index", Me.PageIndex.ToString()) + Me.SaveToSession(Me, "Page_Size", Me.PageSize.ToString()) + + Me.SaveToSession(Me, "DeletedRecordIds", Me.DeletedRecordIds) + + End Sub + + Protected Sub SaveControlsToSession_Ajax() + ' Save filter controls to values to session. + + Me.SaveToSession("LevelIdFilter_Ajax", Me.LevelIdFilter.SelectedValue) + + Me.SaveToSession("PersonalEducationSearch_Ajax", Me.PersonalEducationSearch.Text) + + Me.SaveToSession("PersonalIdFilter_Ajax", Me.PersonalIdFilter.SelectedValue) + + HttpContext.Current.Session("AppRelativeVirtualPath") = Me.Page.AppRelativeVirtualPath + + End Sub + + Protected Overrides Sub ClearControlsFromSession() + MyBase.ClearControlsFromSession() + + ' Clear filter controls values from the session. + + Me.RemoveFromSession(Me.LevelIdFilter) + Me.RemoveFromSession(Me.PersonalEducationSearch) + Me.RemoveFromSession(Me.PersonalIdFilter) + + ' Clear pagination state from session. + + + + ' Clear table properties from the session. + Me.RemoveFromSession(Me, "Order_By") + Me.RemoveFromSession(Me, "Page_Index") + Me.RemoveFromSession(Me, "Page_Size") + + Me.RemoveFromSession(Me, "DeletedRecordIds") + + End Sub + + Protected Overrides Sub LoadViewState(ByVal savedState As Object) + MyBase.LoadViewState(savedState) + + Dim orderByStr As String = CType(ViewState("PersonalEducationTableControl_OrderBy"), String) + + If orderByStr IsNot Nothing AndAlso orderByStr.Trim <> "" Then + Me.CurrentSortOrder = BaseClasses.Data.OrderBy.FromXmlString(orderByStr) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + End If + + Dim pageIndex As String = CType(ViewState("Page_Index"), String) + If pageIndex IsNot Nothing Then + Me.PageIndex = CInt(pageIndex) + End If + + Dim pageSize As String = CType(ViewState("Page_Size"), String) + If Not pageSize Is Nothing Then + Me.PageSize = CInt(pageSize) + End If + + + + ' Load view state for pagination control. + + Me.DeletedRecordIds = CType(Me.ViewState("DeletedRecordIds"), String) + + End Sub + + Protected Overrides Function SaveViewState() As Object + + If Me.CurrentSortOrder IsNot Nothing Then + Me.ViewState("PersonalEducationTableControl_OrderBy") = Me.CurrentSortOrder.ToXmlString() + End If + + Me.ViewState("Page_Index") = Me.PageIndex + Me.ViewState("Page_Size") = Me.PageSize + + Me.ViewState("DeletedRecordIds") = Me.DeletedRecordIds + + + ' Load view state for pagination control. + + + Return MyBase.SaveViewState() + End Function + + ' Generate the event handling functions for pagination events. + + ' event handler for ImageButton + Public Overridable Sub PersonalEducationPagination_FirstPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.PageIndex = 0 + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalEducationPagination_LastPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.DisplayLastPage = True + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalEducationPagination_NextPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.PageIndex += 1 + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for LinkButton + Public Overridable Sub PersonalEducationPagination_PageSizeButton_Click(ByVal sender As Object, ByVal args As EventArgs) + + Try + + Me.DataChanged = True + + Me.PageSize = Integer.Parse(Me.PersonalEducationPagination.PageSize.Text) + + Me.PageIndex = Integer.Parse(Me.PersonalEducationPagination.CurrentPage.Text) - 1 + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalEducationPagination_PreviousPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + If Me.PageIndex > 0 Then + Me.PageIndex -= 1 + Me.DataChanged = True + End If + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + + ' Generate the event handling functions for sorting events. + + Public Overridable Sub CommandDateLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by CommandDate when clicked. + + ' Get previous sorting state for CommandDate. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalEducationTable.CommandDate) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for CommandDate. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalEducationTable.CommandDate, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by CommandDate, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub CommandLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by Command when clicked. + + ' Get previous sorting state for Command. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalEducationTable.Command) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for Command. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalEducationTable.Command, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by Command, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub COUNTRYLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by COUNTRY when clicked. + + ' Get previous sorting state for COUNTRY. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalEducationTable.COUNTRY) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for COUNTRY. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalEducationTable.COUNTRY, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by COUNTRY, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub CourseAbbrLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by CourseAbbr when clicked. + + ' Get previous sorting state for CourseAbbr. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalEducationTable.CourseAbbr) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for CourseAbbr. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalEducationTable.CourseAbbr, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by CourseAbbr, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub CourseLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by Course when clicked. + + ' Get previous sorting state for Course. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalEducationTable.Course) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for Course. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalEducationTable.Course, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by Course, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub CourseNoLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by CourseNo when clicked. + + ' Get previous sorting state for CourseNo. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalEducationTable.CourseNo) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for CourseNo. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalEducationTable.CourseNo, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by CourseNo, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub EducationPeriodLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by EducationPeriod when clicked. + + ' Get previous sorting state for EducationPeriod. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalEducationTable.EducationPeriod) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for EducationPeriod. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalEducationTable.EducationPeriod, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by EducationPeriod, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub EducationTypeLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by EducationType when clicked. + + ' Get previous sorting state for EducationType. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalEducationTable.EducationType) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for EducationType. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalEducationTable.EducationType, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by EducationType, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub EducationTypeLabel1_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by EducationType when clicked. + + ' Get previous sorting state for EducationType. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalEducationTable.EducationType) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for EducationType. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalEducationTable.EducationType, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by EducationType, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub EdYearLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by EdYear when clicked. + + ' Get previous sorting state for EdYear. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalEducationTable.EdYear) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for EdYear. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalEducationTable.EdYear, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by EdYear, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub EndDateLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by EndDate when clicked. + + ' Get previous sorting state for EndDate. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalEducationTable.EndDate) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for EndDate. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalEducationTable.EndDate, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by EndDate, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub FacultryLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by Facultry when clicked. + + ' Get previous sorting state for Facultry. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalEducationTable.Facultry) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for Facultry. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalEducationTable.Facultry, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by Facultry, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub InstitueLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by Institue when clicked. + + ' Get previous sorting state for Institue. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalEducationTable.Institue) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for Institue. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalEducationTable.Institue, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by Institue, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub LevelIdLabel1_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by LevelId when clicked. + + ' Get previous sorting state for LevelId. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalEducationTable.LevelId) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for LevelId. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalEducationTable.LevelId, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by LevelId, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub NoAllLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by NoAll when clicked. + + ' Get previous sorting state for NoAll. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalEducationTable.NoAll) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for NoAll. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalEducationTable.NoAll, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by NoAll, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub PersonalIdLabel1_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by PersonalId when clicked. + + ' Get previous sorting state for PersonalId. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalEducationTable.PersonalId) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for PersonalId. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalEducationTable.PersonalId, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by PersonalId, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub ScoreLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by Score when clicked. + + ' Get previous sorting state for Score. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalEducationTable.Score) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for Score. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalEducationTable.Score, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by Score, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub ScoreNoLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by ScoreNo when clicked. + + ' Get previous sorting state for ScoreNo. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalEducationTable.ScoreNo) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for ScoreNo. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalEducationTable.ScoreNo, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by ScoreNo, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub StartDateLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by StartDate when clicked. + + ' Get previous sorting state for StartDate. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalEducationTable.StartDate) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for StartDate. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalEducationTable.StartDate, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by StartDate, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + + ' Generate the event handling functions for button events. + + ' event handler for ImageButton + Public Overridable Sub PersonalEducationAddButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + Me.AddNewRecord = 1 + Me.DataChanged = True + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalEducationDeleteButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + If(Not Me.Page.IsPageRefresh) Then + + Me.DeleteSelectedRecords(True) + Me.SetFormulaControls() + + + End If + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalEducationEditButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + ' The redirect URL is set on the Properties, Custom Properties or Actions. + ' The ModifyRedirectURL call resolves the parameters before the + ' Response.Redirect redirects the page to the URL. + ' Any code after the Response.Redirect call will not be executed, since the page is + ' redirected to the URL. + + + Dim url As String = "../PersonalEducation/EditPersonalEducation.aspx?PersonalEducation={PK}" + + Dim shouldRedirect As Boolean = True + Dim TargetKey As String = Nothing + Dim DFKA As String = TargetKey + Dim id As String = DFKA + Dim value As String = id + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + url = Me.ModifyRedirectUrl(url, "",False) + url = Me.Page.ModifyRedirectUrl(url, "",False) + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + shouldRedirect = False + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + If shouldRedirect Then + Me.Page.ShouldSaveControlsToSession = True + Me.Page.Response.Redirect(url) + ElseIf Not TargetKey Is Nothing AndAlso _ + Not shouldRedirect Then + Me.Page.ShouldSaveControlsToSession = True + Me.Page.CloseWindow(True) + + End If + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalEducationRefreshButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Dim PersonalEducationTableControlObj as PersonalEducationTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalEducationTableControl"), PersonalEducationTableControl) + PersonalEducationTableControlObj.ResetData = True + + PersonalEducationTableControlObj.RemoveFromSession(PersonalEducationTableControlObj, "DeletedRecordIds") + PersonalEducationTableControlObj.DeletedRecordIds = Nothing + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalEducationResetButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.LevelIdFilter.ClearSelection() + Me.PersonalIdFilter.ClearSelection() + Me.PersonalEducationSearch.Text = "" + Me.CurrentSortOrder.Reset() + If Me.InSession(Me, "Order_By") Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + + End If + + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalEducationSaveButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + + If (Not Me.Page.IsPageRefresh) Then + Me.SaveData() + End If + + Me.Page.CommitTransaction(sender) + ' Set IsNewRecord to False for all records - since everything has been saved and is no longer "new" + Dim recCtl As PersonalEducationTableControlRow + For Each recCtl in Me.GetRecordControls() + + recCtl.IsNewRecord = False + Next + + + ' Set DeletedRecordsIds to Nothing since we have deleted all pending deletes. + + Me.DeletedRecordIds = Nothing + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for Button with Layout + Public Overridable Sub PersonalEducationSearchButton_Click(ByVal sender As Object, ByVal args As EventArgs) + + Try + + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + + + ' Generate the event handling functions for filter and search events. + + ' event handler for FieldFilter + Protected Overridable Sub LevelIdFilter_SelectedIndexChanged(ByVal sender As Object, ByVal args As EventArgs) + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + + End Sub + + ' event handler for FieldFilter + Protected Overridable Sub PersonalIdFilter_SelectedIndexChanged(ByVal sender As Object, ByVal args As EventArgs) + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + + End Sub + + + ' Generate the event handling functions for others + + + Private _UIData As New System.Collections.Generic.List(Of Hashtable) + Public Property UIData() As System.Collections.Generic.List(Of Hashtable) + Get + Return Me._UIData + End Get + Set(ByVal value As System.Collections.Generic.List(Of Hashtable)) + Me._UIData = value + End Set + End Property + + ' pagination properties + Protected _PageSize As Integer + Public Property PageSize() As Integer + Get + Return Me._PageSize + End Get + Set(ByVal value As Integer) + Me._PageSize = value + End Set + End Property + + Protected _PageIndex As Integer + Public Property PageIndex() As Integer + Get + ' Return the PageIndex + Return Me._PageIndex + End Get + Set(ByVal value As Integer) + Me._PageIndex = value + End Set + End Property + + Protected _TotalRecords As Integer = -1 + Public Property TotalRecords() As Integer + Get + If _TotalRecords < 0 + _TotalRecords = PersonalEducationTable.GetRecordCount(CreateCompoundJoinFilter(), CreateWhereClause()) + End If + Return Me._TotalRecords + End Get + Set(ByVal value As Integer) + If Me.PageSize > 0 Then + + Me.TotalPages = CInt(Math.Ceiling(value / Me.PageSize)) + + End If + Me._TotalRecords = value + End Set + End Property + + + + Protected _TotalPages As Integer = -1 + Public Property TotalPages() As Integer + Get + If _TotalPages < 0 Then + + Me.TotalPages = CInt(Math.Ceiling(TotalRecords / Me.PageSize)) + + End If + Return Me._TotalPages + End Get + Set(ByVal value As Integer) + Me._TotalPages = value + End Set + End Property + + Protected _DisplayLastPage As Boolean + Public Property DisplayLastPage() As Boolean + Get + Return Me._DisplayLastPage + End Get + Set(ByVal value As Boolean) + Me._DisplayLastPage = value + End Set + End Property + + Private _DataChanged As Boolean = False + Public Property DataChanged() As Boolean + Get + Return Me._DataChanged + End Get + Set(ByVal value As Boolean) + Me._DataChanged = value + End Set + End Property + + Private _ResetData As Boolean = False + Public Property ResetData() As Boolean + Get + Return Me._ResetData + End Get + Set(ByVal value As Boolean) + Me._ResetData = value + End Set + End Property + + Private _AddNewRecord As Integer = 0 + Public Property AddNewRecord() As Integer + Get + Return Me._AddNewRecord + End Get + Set(ByVal value As Integer) + Me._AddNewRecord = value + End Set + End Property + + + Private _CurrentSortOrder As OrderBy = Nothing + Public Property CurrentSortOrder() As OrderBy + Get + Return Me._CurrentSortOrder + End Get + Set(ByVal value As BaseClasses.Data.OrderBy) + Me._CurrentSortOrder = value + End Set + End Property + + Private _DataSource() As PersonalEducationRecord = Nothing + Public Property DataSource() As PersonalEducationRecord () + Get + Return Me._DataSource + End Get + Set(ByVal value() As PersonalEducationRecord) + Me._DataSource = value + End Set + End Property + +#Region "Helper Properties" + + Public ReadOnly Property CommandDateLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "CommandDateLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property CommandLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "CommandLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property COUNTRYLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "COUNTRYLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property CourseAbbrLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "CourseAbbrLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property CourseLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "CourseLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property CourseNoLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "CourseNoLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property EducationPeriodLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "EducationPeriodLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property EducationTypeLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "EducationTypeLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property EducationTypeLabel1() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "EducationTypeLabel1"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property EdYearLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "EdYearLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property EndDateLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "EndDateLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property FacultryLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "FacultryLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property InstitueLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "InstitueLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property LevelIdFilter() As System.Web.UI.WebControls.DropDownList + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "LevelIdFilter"), System.Web.UI.WebControls.DropDownList) + End Get + End Property + + Public ReadOnly Property LevelIdLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "LevelIdLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property LevelIdLabel1() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "LevelIdLabel1"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property NoAllLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "NoAllLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property PersonalEducationAddButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalEducationAddButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalEducationDeleteButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalEducationDeleteButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalEducationEditButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalEducationEditButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalEducationPagination() As Persons.UI.IPagination + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalEducationPagination"), Persons.UI.IPagination) + End Get + End Property + + Public ReadOnly Property PersonalEducationRefreshButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalEducationRefreshButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalEducationResetButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalEducationResetButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalEducationSaveButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalEducationSaveButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalEducationSearch() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalEducationSearch"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property PersonalEducationSearchButton() As Persons.UI.IThemeButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalEducationSearchButton"), Persons.UI.IThemeButton) + End Get + End Property + + Public ReadOnly Property PersonalEducationTableControlCollapsibleRegion() As System.Web.UI.WebControls.Panel + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalEducationTableControlCollapsibleRegion"), System.Web.UI.WebControls.Panel) + End Get + End Property + + Public ReadOnly Property PersonalEducationTableControlIcon() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalEducationTableControlIcon"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalEducationTableControlPanelExtender() As AjaxControlToolkit.CollapsiblePanelExtender + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalEducationTableControlPanelExtender"), AjaxControlToolkit.CollapsiblePanelExtender) + End Get + End Property + + Public ReadOnly Property PersonalEducationTitle() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalEducationTitle"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property PersonalEducationToggleAll() As System.Web.UI.WebControls.CheckBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalEducationToggleAll"), System.Web.UI.WebControls.CheckBox) + End Get + End Property + + Public ReadOnly Property PersonalIdFilter() As System.Web.UI.WebControls.DropDownList + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalIdFilter"), System.Web.UI.WebControls.DropDownList) + End Get + End Property + + Public ReadOnly Property PersonalIdLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalIdLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property PersonalIdLabel1() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalIdLabel1"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property ScoreLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "ScoreLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property ScoreNoLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "ScoreNoLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property StartDateLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "StartDateLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + +#End Region + +#Region "Helper Functions" + + Public Overrides Overloads Function ModifyRedirectUrl(url As String, arg As String, ByVal bEncrypt As Boolean) As String + Return Me.Page.EvaluateExpressions(url, arg, bEncrypt, Me) + End Function + + Public Overrides Overloads Function EvaluateExpressions(url As String, arg As String, ByVal bEncrypt As Boolean) As String + Dim needToProcess As Boolean = AreAnyUrlParametersForMe(url, arg) + If (needToProcess) Then + Dim recCtl As PersonalEducationTableControlRow = Me.GetSelectedRecordControl() + If recCtl Is Nothing AndAlso url.IndexOf("{") >= 0 Then + ' Localization. + Throw New Exception(Page.GetResourceValue("Err:NoRecSelected", "Persons")) + End If + Dim rec As PersonalEducationRecord = Nothing + If recCtl IsNot Nothing Then + rec = recCtl.GetRecord() + End If + Return EvaluateExpressions(url, arg, rec, bEncrypt) + End If + Return url + End Function + + Public Overridable Function GetSelectedRecordIndex() As Integer + Dim counter As Integer = 0 + Dim recControl As PersonalEducationTableControlRow + For Each recControl In Me.GetRecordControls() + If recControl.PersonalEducationRecordRowSelection.Checked Then + Return counter + End If + counter += 1 + Next + Return -1 + End Function + + Public Overridable Function GetSelectedRecordControl() As PersonalEducationTableControlRow + Dim selectedList() As PersonalEducationTableControlRow = Me.GetSelectedRecordControls() + If selectedList.Length = 0 Then + Return Nothing + End If + Return selectedList(0) + + End Function + + Public Overridable Function GetSelectedRecordControls() As PersonalEducationTableControlRow() + + Dim selectedList As ArrayList = New ArrayList(25) + Dim recControl As PersonalEducationTableControlRow + For Each recControl In Me.GetRecordControls() + If recControl.PersonalEducationRecordRowSelection IsNot Nothing AndAlso recControl.PersonalEducationRecordRowSelection.Checked Then + selectedList.Add(recControl) + End If + Next + Return DirectCast(selectedList.ToArray(GetType(PersonalEducationTableControlRow)), PersonalEducationTableControlRow()) + + End Function + + Public Overridable Sub DeleteSelectedRecords(ByVal deferDeletion As Boolean) + Dim recList() As PersonalEducationTableControlRow = Me.GetSelectedRecordControls() + If recList.Length = 0 Then + ' Localization. + Throw New Exception(Page.GetResourceValue("Err:NoRecSelected", "Persons")) + End If + + Dim recCtl As PersonalEducationTableControlRow + For Each recCtl In recList + If deferDeletion Then + If Not recCtl.IsNewRecord Then + + Me.AddToDeletedRecordIds(recCtl) + + End If + recCtl.Visible = False + + recCtl.PersonalEducationRecordRowSelection.Checked = False + + Else + + recCtl.Delete() + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + End If + Next + End Sub + + Public Function GetRecordControls() As PersonalEducationTableControlRow() + Dim recList As ArrayList = New ArrayList() + Dim rep As System.Web.UI.WebControls.Repeater = CType(Me.FindControl("PersonalEducationTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return Nothing + Dim repItem As System.Web.UI.WebControls.RepeaterItem + + For Each repItem In rep.Items + + Dim recControl As PersonalEducationTableControlRow = DirectCast(repItem.FindControl("PersonalEducationTableControlRow"), PersonalEducationTableControlRow) + recList.Add(recControl) + + Next + + Return DirectCast(recList.ToArray(GetType(PersonalEducationTableControlRow)), PersonalEducationTableControlRow()) + End Function + + Public Shadows ReadOnly Property Page() As BaseApplicationPage + Get + Return DirectCast(MyBase.Page, BaseApplicationPage) + End Get + End Property + +#End Region + + + +End Class + + + +#End Region + + +End Namespace + + \ No newline at end of file diff --git a/App_Code/PersonalEducation/EditPersonalEducationTable2.Controls.vb b/App_Code/PersonalEducation/EditPersonalEducationTable2.Controls.vb new file mode 100644 index 0000000..84e06e1 --- /dev/null +++ b/App_Code/PersonalEducation/EditPersonalEducationTable2.Controls.vb @@ -0,0 +1,5007 @@ + +' This file implements the TableControl, TableControlRow, and RecordControl classes for the +' EditPersonalEducationTable2.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.EditPersonalEducationTable2 + +#Region "Section 1: Place your customizations here." + + +Public Class PersonalEducationTableControlRow + Inherits BasePersonalEducationTableControlRow + ' The BasePersonalEducationTableControlRow implements code for a ROW within the + ' the PersonalEducationTableControl table. The BasePersonalEducationTableControlRow implements the DataBind and SaveData methods. + ' The loading of data is actually performed by the LoadData method in the base class of PersonalEducationTableControl. + + ' This is the ideal place to add your code customizations. For example, you can override the DataBind, + ' SaveData, GetUIData, and Validate methods. + Public Overrides Sub GetUIData() + + ' Call MyBase.GetUIData + MyBase.GetUIData() + + ' Get PersonalDD Record + Dim myRec As PersonalEducationRecord = Me.GetRecord + + ' Set PersonalId field value to new value string + myRec.PersonalId = Utils.SecurityControls.GetCurrentUserID + + End Sub + + + + Protected Overrides Sub PopulateLevelIdDropDownList(ByVal selectedValue As String, ByVal maxItems As Integer) + + 'MyBase.PopulateLevelIdDropDownList(selectedValue, maxItems) + + + Dim wc As WhereClause = CreateWhereClause_LevelIdDropDownList() + Dim orderBy As OrderBy = New OrderBy(False, True) + orderBy.Add(EducationTable.EducationId, OrderByItem.OrderDir.Asc) + + ' 2. Read a total of maxItems from the database and insert them into the LevelIdDropDownList. + Me.LevelId.Items.Clear() + Dim itemValue As EducationRecord + For Each itemValue In EducationTable.GetRecords(wc, orderBy, 0, maxItems) + ' Create the item and add to the list. + Dim cvalue As String = Nothing + Dim fvalue As String = Nothing + If itemValue.EducationIdSpecified Then + cvalue = itemValue.EducationId.ToString() + fvalue = itemValue.Format(EducationTable.Level) + End If + + Dim item As ListItem = New ListItem(fvalue, cvalue) + Me.LevelId.Items.Add(item) + Next + + ' 3. Set the selected value (insert if not already present). + If Not selectedValue Is Nothing AndAlso _ + selectedValue.Trim <> "" AndAlso _ + Not SetSelectedValue(Me.LevelId, selectedValue) AndAlso _ + Not MiscUtils.SetSelectedValue(Me.LevelId, PersonalEducationTable.LevelId.Format(selectedValue)) Then + Dim fvalue As String = PersonalEducationTable.LevelId.Format(selectedValue) + Dim item As ListItem = New ListItem(fvalue, selectedValue) + item.Selected = True + Me.LevelId.Items.Insert(0, item) + End If + + + ' 4. Insert the language specific "Please Select" item at the top. + Me.LevelId.Items.Insert(0, New ListItem(Page.GetResourceValue("Txt:PleaseSelect", "Persons"), "--PLEASE_SELECT--")) + + End Sub + + Protected Overrides Sub PopulateEducationTypeDropDownList( _ + ByVal selectedValue As String, _ + ByVal maxItems As Integer) + + Me.EducationType.Items.Clear() + + ' Me.EducationType.Items.Add(New ListItem("", "0")) + Me.EducationType.Items.Add(New ListItem("พลเรือน", "1")) + Me.EducationType.Items.Add(New ListItem("ทหาร", "2")) + ' 3. Set the selected value (insert if not already present). + If Not selectedValue Is Nothing AndAlso _ + selectedValue.Trim <> "" AndAlso _ + Not SetSelectedValue(Me.EducationType, selectedValue) AndAlso _ + Not MiscUtils.SetSelectedValue(Me.EducationType, PersonalEducationTable.EducationType.Format(selectedValue)) Then + Dim fvalue As String = PersonalEducationTable.EducationType.Format(selectedValue) + Dim item As ListItem = New ListItem(fvalue, selectedValue) + item.Selected = True + Me.EducationType.Items.Insert(0, item) + End If + + + ' 4. Insert the language specific "Please Select" item at the top. + Me.EducationType.Items.Insert(0, New ListItem(Page.GetResourceValue("Txt:PleaseSelect", "Persons"), "--PLEASE_SELECT--")) + + End Sub + + + End Class + + + +Public Class PersonalEducationTableControl + Inherits BasePersonalEducationTableControl + + ' The BasePersonalEducationTableControl class implements the LoadData, DataBind, CreateWhereClause + ' and other methods to load and display the data in a table control. + + ' This is the ideal place to add your code customizations. You can override the LoadData and CreateWhereClause, + ' The PersonalEducationTableControlRow class offers another place where you can customize + ' the DataBind, GetUIData, SaveData and Validate methods specific to each row displayed on the table. + Public Overrides Function CreateOrderBy() As OrderBy + ' The CurrentSortOrder is initialized to the sort order on the + ' Query Wizard. It may be modified by the Click handler for any of + ' the column heading to sort or reverse sort by that column. + ' You can add your own sort order, or modify it on the Query Wizard. + 'Return Me.CurrentSortOrder + + Dim orderby As OrderBy = New OrderBy(False, False) + orderby.Add(PersonalEducationTable.EducationPeriod, OrderByItem.OrderDir.Asc) + orderby.Add(PersonalEducationTable.EdYear, OrderByItem.OrderDir.Asc) + orderby.Add(PersonalEducationTable.StartDate, OrderByItem.OrderDir.Asc) + orderby.Add(PersonalEducationTable.LevelId, OrderByItem.OrderDir.Asc) + Return orderby + End Function + +End Class + + + +#End Region + + + +#Region "Section 2: Do not modify this section." + + +' Base class for the PersonalEducationTableControlRow control on the EditPersonalEducationTable2 page. +' Do not modify this class. Instead override any method in PersonalEducationTableControlRow. +Public Class BasePersonalEducationTableControlRow + Inherits Persons.UI.BaseApplicationRecordControl + + ' To customize, override this method in PersonalEducationTableControlRow. + Protected Overridable Sub Control_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Init + + Me.ClearControlsFromSession() + End Sub + + ' To customize, override this method in PersonalEducationTableControlRow. + Protected Overridable Sub Control_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load + + 'Call LoadFocusScripts from repeater so that onfocus attribute could be added to elements + Me.Page.LoadFocusScripts(Me) + + ' Show confirmation message on Click + Me.PersonalEducationRowDeleteButton.Attributes.Add("onClick", "return (confirm('" & (CType(Me.Page,BaseApplicationPage)).GetResourceValue("DeleteRecordConfirm", "Persons") & "'));") + + + ' Register the event handlers. + + AddHandler Me.PersonalEducationRowDeleteButton.Click, AddressOf PersonalEducationRowDeleteButton_Click + + AddHandler Me.PersonalEducationRowEditButton.Click, AddressOf PersonalEducationRowEditButton_Click + + AddHandler Me.COUNTRY.SelectedIndexChanged, AddressOf COUNTRY_SelectedIndexChanged + + AddHandler Me.EducationPeriod.SelectedIndexChanged, AddressOf EducationPeriod_SelectedIndexChanged + + AddHandler Me.EducationType.SelectedIndexChanged, AddressOf EducationType_SelectedIndexChanged + + AddHandler Me.LevelId.SelectedIndexChanged, AddressOf LevelId_SelectedIndexChanged + + AddHandler Me.PersonalId.SelectedIndexChanged, AddressOf PersonalId_SelectedIndexChanged + + AddHandler Me.Command.TextChanged, AddressOf Command_TextChanged + + AddHandler Me.CommandDate.TextChanged, AddressOf CommandDate_TextChanged + + AddHandler Me.Course.TextChanged, AddressOf Course_TextChanged + + AddHandler Me.CourseAbbr.TextChanged, AddressOf CourseAbbr_TextChanged + + AddHandler Me.CourseNo.TextChanged, AddressOf CourseNo_TextChanged + + AddHandler Me.EdYear.TextChanged, AddressOf EdYear_TextChanged + + AddHandler Me.EndDate.TextChanged, AddressOf EndDate_TextChanged + + AddHandler Me.Facultry.TextChanged, AddressOf Facultry_TextChanged + + AddHandler Me.Institue.TextChanged, AddressOf Institue_TextChanged + + AddHandler Me.NoAll.TextChanged, AddressOf NoAll_TextChanged + + AddHandler Me.Score.TextChanged, AddressOf Score_TextChanged + + AddHandler Me.ScoreNo.TextChanged, AddressOf ScoreNo_TextChanged + + AddHandler Me.StartDate.TextChanged, AddressOf StartDate_TextChanged + + + End Sub + + + Public Overridable Sub LoadData() + + ' Load the data from the database into the DataSource PersonalEducation record. + ' It is better to make changes to functions called by LoadData such as + ' CreateWhereClause, rather than making changes here. + + ' The RecordUniqueId is set the first time a record is loaded, and is + ' used during a PostBack to load the record. + + If Me.RecordUniqueId IsNot Nothing AndAlso Me.RecordUniqueId.Trim <> "" Then + Me.DataSource = PersonalEducationTable.GetRecord(Me.RecordUniqueId, True) + + Return + End If + + ' Since this is a row in the table, the data for this row is loaded by the + ' LoadData method of the BasePersonalEducationTableControl when the data for the entire + ' table is loaded. + + Me.DataSource = New PersonalEducationRecord() + + + + End Sub + + ' Populate the UI controls using the DataSource. To customize, override this method in PersonalEducationTableControlRow. + Public Overrides Sub DataBind() + ' The DataBind method binds the user interface controls to the values + ' from the database record. To do this, it calls the Set methods for + ' each of the field displayed on the webpage. It is better to make + ' changes in the Set methods, rather than making changes here. + + MyBase.DataBind() + + ' Make sure that the DataSource is initialized. + If Me.DataSource Is Nothing Then + + Return + End If + + + 'LoadData for DataSource for chart and report if they exist + + + + ' Call the Set methods for each controls on the panel + + SetCommand() + SetCommandDate() + SetCOUNTRY() + SetCourse() + SetCourseAbbr() + SetCourseNo() + SetEducationPeriod() + SetEducationType() + SetEdYear() + SetEndDate() + SetFacultry() + SetInstitue() + SetLevelId() + SetNoAll() + + + + SetPersonalId() + SetScore() + SetScoreNo() + SetStartDate() + + + Me.IsNewRecord = True + + If Me.DataSource.IsCreated Then + Me.IsNewRecord = False + + Me.RecordUniqueId = Me.DataSource.GetID.ToXmlString() + End If + + ' Now load data for each record and table child UI controls. + ' Ordering is important because child controls get + ' their parent ids from their parent UI controls. + Dim shouldResetControl As Boolean = False + + End Sub + + + Public Overridable Sub SetCommand() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.Command.ID) Then + + Me.Command.Text = Me.PreviousUIData(Me.Command.ID).ToString() + + Return + End If + + + ' Set the Command TextBox on the webpage with value from the + ' PersonalEducation database record. + + ' Me.DataSource is the PersonalEducation record retrieved from the database. + ' Me.Command is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetCommand() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.CommandSpecified Then + + ' If the Command is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalEducationTable.Command) + + Me.Command.Text = formattedValue + + Else + + ' Command is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.Command.Text = PersonalEducationTable.Command.Format(PersonalEducationTable.Command.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetCommandDate() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.CommandDate.ID) Then + + Me.CommandDate.Text = Me.PreviousUIData(Me.CommandDate.ID).ToString() + + Return + End If + + + ' Set the CommandDate TextBox on the webpage with value from the + ' PersonalEducation database record. + + ' Me.DataSource is the PersonalEducation record retrieved from the database. + ' Me.CommandDate is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetCommandDate() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.CommandDateSpecified Then + + ' If the CommandDate is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalEducationTable.CommandDate, "d MMM yy") + + Me.CommandDate.Text = formattedValue + + Else + + ' CommandDate is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.CommandDate.Text = PersonalEducationTable.CommandDate.Format(PersonalEducationTable.CommandDate.DefaultValue, "d MMM yy") + + End If + + End Sub + + Public Overridable Sub SetCOUNTRY() + + ' If selection was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.COUNTRY.ID) Then + If Me.PreviousUIData(Me.COUNTRY.ID) Is Nothing + Me.PopulateCOUNTRYDropDownList(Nothing, 100) + Else + Me.PopulateCOUNTRYDropDownList(Me.PreviousUIData(Me.COUNTRY.ID).ToString(), 100) + End If + Return + End If + + + ' Set the COUNTRY DropDownList on the webpage with value from the + ' PersonalEducation database record. + + ' Me.DataSource is the PersonalEducation record retrieved from the database. + ' Me.COUNTRY is the ASP:DropDownList on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetCOUNTRY() + ' and add your own code before or after the call to the MyBase function. + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.COUNTRYSpecified Then + + ' If the COUNTRY is non-NULL, then format the value. + ' The Format method will return the Display Foreign Key As (DFKA) value + Me.PopulateCOUNTRYDropDownList(Me.DataSource.COUNTRY.ToString(), 100) + + Else + + ' COUNTRY 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.PopulateCOUNTRYDropDownList(Nothing, 100) + Else + Me.PopulateCOUNTRYDropDownList(PersonalEducationTable.COUNTRY.DefaultValue, 100) + End If + + End If + + End Sub + + Public Overridable Sub SetCourse() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.Course.ID) Then + + Me.Course.Text = Me.PreviousUIData(Me.Course.ID).ToString() + + Return + End If + + + ' Set the Course TextBox on the webpage with value from the + ' PersonalEducation database record. + + ' Me.DataSource is the PersonalEducation record retrieved from the database. + ' Me.Course is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetCourse() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.CourseSpecified Then + + ' If the Course is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalEducationTable.Course) + + Me.Course.Text = formattedValue + + Else + + ' Course is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.Course.Text = PersonalEducationTable.Course.Format(PersonalEducationTable.Course.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetCourseAbbr() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.CourseAbbr.ID) Then + + Me.CourseAbbr.Text = Me.PreviousUIData(Me.CourseAbbr.ID).ToString() + + Return + End If + + + ' Set the CourseAbbr TextBox on the webpage with value from the + ' PersonalEducation database record. + + ' Me.DataSource is the PersonalEducation record retrieved from the database. + ' Me.CourseAbbr is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetCourseAbbr() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.CourseAbbrSpecified Then + + ' If the CourseAbbr is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalEducationTable.CourseAbbr) + + Me.CourseAbbr.Text = formattedValue + + Else + + ' CourseAbbr is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.CourseAbbr.Text = PersonalEducationTable.CourseAbbr.Format(PersonalEducationTable.CourseAbbr.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetCourseNo() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.CourseNo.ID) Then + + Me.CourseNo.Text = Me.PreviousUIData(Me.CourseNo.ID).ToString() + + Return + End If + + + ' Set the CourseNo TextBox on the webpage with value from the + ' PersonalEducation database record. + + ' Me.DataSource is the PersonalEducation record retrieved from the database. + ' Me.CourseNo is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetCourseNo() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.CourseNoSpecified Then + + ' If the CourseNo is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalEducationTable.CourseNo) + + Me.CourseNo.Text = formattedValue + + Else + + ' CourseNo is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.CourseNo.Text = PersonalEducationTable.CourseNo.Format(PersonalEducationTable.CourseNo.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetEducationPeriod() + + ' If selection was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.EducationPeriod.ID) Then + If Me.PreviousUIData(Me.EducationPeriod.ID) Is Nothing + Me.PopulateEducationPeriodDropDownList(Nothing, 100) + Else + Me.PopulateEducationPeriodDropDownList(Me.PreviousUIData(Me.EducationPeriod.ID).ToString(), 100) + End If + Return + End If + + + ' Set the EducationPeriod DropDownList on the webpage with value from the + ' PersonalEducation database record. + + ' Me.DataSource is the PersonalEducation record retrieved from the database. + ' Me.EducationPeriod is the ASP:DropDownList on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetEducationPeriod() + ' and add your own code before or after the call to the MyBase function. + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.EducationPeriodSpecified Then + + ' If the EducationPeriod is non-NULL, then format the value. + ' The Format method will return the Display Foreign Key As (DFKA) value + Me.PopulateEducationPeriodDropDownList(Me.DataSource.EducationPeriod.ToString(), 100) + + Else + + ' EducationPeriod 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.PopulateEducationPeriodDropDownList(Nothing, 100) + Else + Me.PopulateEducationPeriodDropDownList(PersonalEducationTable.EducationPeriod.DefaultValue, 100) + End If + + End If + + End Sub + + Public Overridable Sub SetEducationType() + + ' If selection was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.EducationType.ID) Then + If Me.PreviousUIData(Me.EducationType.ID) Is Nothing + Me.PopulateEducationTypeDropDownList(Nothing, 100) + Else + Me.PopulateEducationTypeDropDownList(Me.PreviousUIData(Me.EducationType.ID).ToString(), 100) + End If + Return + End If + + + ' Set the EducationType DropDownList on the webpage with value from the + ' PersonalEducation database record. + + ' Me.DataSource is the PersonalEducation record retrieved from the database. + ' Me.EducationType is the ASP:DropDownList on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetEducationType() + ' and add your own code before or after the call to the MyBase function. + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.EducationTypeSpecified Then + + ' If the EducationType is non-NULL, then format the value. + ' The Format method will use the Display Format + Me.PopulateEducationTypeDropDownList(Me.DataSource.EducationType.ToString(), 100) + + Else + + ' EducationType 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.PopulateEducationTypeDropDownList(Nothing, 100) + Else + Me.PopulateEducationTypeDropDownList(PersonalEducationTable.EducationType.DefaultValue, 100) + End If + + End If + + End Sub + + Public Overridable Sub SetEdYear() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.EdYear.ID) Then + + Me.EdYear.Text = Me.PreviousUIData(Me.EdYear.ID).ToString() + + Return + End If + + + ' Set the EdYear TextBox on the webpage with value from the + ' PersonalEducation database record. + + ' Me.DataSource is the PersonalEducation record retrieved from the database. + ' Me.EdYear is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetEdYear() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.EdYearSpecified Then + + ' If the EdYear is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalEducationTable.EdYear) + + Me.EdYear.Text = formattedValue + + Else + + ' EdYear is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.EdYear.Text = PersonalEducationTable.EdYear.Format(PersonalEducationTable.EdYear.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetEndDate() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.EndDate.ID) Then + + Me.EndDate.Text = Me.PreviousUIData(Me.EndDate.ID).ToString() + + Return + End If + + + ' Set the EndDate TextBox on the webpage with value from the + ' PersonalEducation database record. + + ' Me.DataSource is the PersonalEducation record retrieved from the database. + ' Me.EndDate is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetEndDate() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.EndDateSpecified Then + + ' If the EndDate is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalEducationTable.EndDate, "d MMM yyyy") + + Me.EndDate.Text = formattedValue + + Else + + ' EndDate is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.EndDate.Text = PersonalEducationTable.EndDate.Format(PersonalEducationTable.EndDate.DefaultValue, "d MMM yyyy") + + End If + + End Sub + + Public Overridable Sub SetFacultry() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.Facultry.ID) Then + + Me.Facultry.Text = Me.PreviousUIData(Me.Facultry.ID).ToString() + + Return + End If + + + ' Set the Facultry TextBox on the webpage with value from the + ' PersonalEducation database record. + + ' Me.DataSource is the PersonalEducation record retrieved from the database. + ' Me.Facultry is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetFacultry() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.FacultrySpecified Then + + ' If the Facultry is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalEducationTable.Facultry) + + Me.Facultry.Text = formattedValue + + Else + + ' Facultry is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.Facultry.Text = PersonalEducationTable.Facultry.Format(PersonalEducationTable.Facultry.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetInstitue() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.Institue.ID) Then + + Me.Institue.Text = Me.PreviousUIData(Me.Institue.ID).ToString() + + Return + End If + + + ' Set the Institue TextBox on the webpage with value from the + ' PersonalEducation database record. + + ' Me.DataSource is the PersonalEducation record retrieved from the database. + ' Me.Institue is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetInstitue() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.InstitueSpecified Then + + ' If the Institue is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalEducationTable.Institue) + + Me.Institue.Text = formattedValue + + Else + + ' Institue is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.Institue.Text = PersonalEducationTable.Institue.Format(PersonalEducationTable.Institue.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetLevelId() + + ' If selection was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.LevelId.ID) Then + If Me.PreviousUIData(Me.LevelId.ID) Is Nothing + Me.PopulateLevelIdDropDownList(Nothing, 100) + Else + Me.PopulateLevelIdDropDownList(Me.PreviousUIData(Me.LevelId.ID).ToString(), 100) + End If + Return + End If + + + ' Set the LevelId DropDownList on the webpage with value from the + ' PersonalEducation database record. + + ' Me.DataSource is the PersonalEducation record retrieved from the database. + ' Me.LevelId is the ASP:DropDownList on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetLevelId() + ' and add your own code before or after the call to the MyBase function. + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.LevelIdSpecified Then + + ' If the LevelId is non-NULL, then format the value. + ' The Format method will return the Display Foreign Key As (DFKA) value + Me.PopulateLevelIdDropDownList(Me.DataSource.LevelId.ToString(), 100) + + Else + + ' LevelId 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.PopulateLevelIdDropDownList(Nothing, 100) + Else + Me.PopulateLevelIdDropDownList(PersonalEducationTable.LevelId.DefaultValue, 100) + End If + + End If + + End Sub + + Public Overridable Sub SetNoAll() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.NoAll.ID) Then + + Me.NoAll.Text = Me.PreviousUIData(Me.NoAll.ID).ToString() + + Return + End If + + + ' Set the NoAll TextBox on the webpage with value from the + ' PersonalEducation database record. + + ' Me.DataSource is the PersonalEducation record retrieved from the database. + ' Me.NoAll is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetNoAll() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.NoAllSpecified Then + + ' If the NoAll is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalEducationTable.NoAll) + + Me.NoAll.Text = formattedValue + + Else + + ' NoAll is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.NoAll.Text = PersonalEducationTable.NoAll.Format(PersonalEducationTable.NoAll.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetPersonalId() + + ' If selection was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.PersonalId.ID) Then + If Me.PreviousUIData(Me.PersonalId.ID) Is Nothing + Me.PopulatePersonalIdDropDownList(Nothing, 100) + Else + Me.PopulatePersonalIdDropDownList(Me.PreviousUIData(Me.PersonalId.ID).ToString(), 100) + End If + Return + End If + + + ' Set the PersonalId DropDownList on the webpage with value from the + ' PersonalEducation database record. + + ' Me.DataSource is the PersonalEducation record retrieved from the database. + ' Me.PersonalId is the ASP:DropDownList on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetPersonalId() + ' and add your own code before or after the call to the MyBase function. + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.PersonalIdSpecified Then + + ' If the PersonalId is non-NULL, then format the value. + ' The Format method will return the Display Foreign Key As (DFKA) value + Me.PopulatePersonalIdDropDownList(Me.DataSource.PersonalId, 100) + + Else + + ' PersonalId 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.PopulatePersonalIdDropDownList(Nothing, 100) + Else + Me.PopulatePersonalIdDropDownList(PersonalEducationTable.PersonalId.DefaultValue, 100) + End If + + End If + + End Sub + + Public Overridable Sub SetScore() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.Score.ID) Then + + Me.Score.Text = Me.PreviousUIData(Me.Score.ID).ToString() + + Return + End If + + + ' Set the Score TextBox on the webpage with value from the + ' PersonalEducation database record. + + ' Me.DataSource is the PersonalEducation record retrieved from the database. + ' Me.Score is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetScore() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.ScoreSpecified Then + + ' If the Score is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalEducationTable.Score) + + Me.Score.Text = formattedValue + + Else + + ' Score is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.Score.Text = PersonalEducationTable.Score.Format(PersonalEducationTable.Score.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetScoreNo() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.ScoreNo.ID) Then + + Me.ScoreNo.Text = Me.PreviousUIData(Me.ScoreNo.ID).ToString() + + Return + End If + + + ' Set the ScoreNo TextBox on the webpage with value from the + ' PersonalEducation database record. + + ' Me.DataSource is the PersonalEducation record retrieved from the database. + ' Me.ScoreNo is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetScoreNo() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.ScoreNoSpecified Then + + ' If the ScoreNo is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalEducationTable.ScoreNo) + + Me.ScoreNo.Text = formattedValue + + Else + + ' ScoreNo is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.ScoreNo.Text = PersonalEducationTable.ScoreNo.Format(PersonalEducationTable.ScoreNo.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetStartDate() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.StartDate.ID) Then + + Me.StartDate.Text = Me.PreviousUIData(Me.StartDate.ID).ToString() + + Return + End If + + + ' Set the StartDate TextBox on the webpage with value from the + ' PersonalEducation database record. + + ' Me.DataSource is the PersonalEducation record retrieved from the database. + ' Me.StartDate is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetStartDate() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.StartDateSpecified Then + + ' If the StartDate is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalEducationTable.StartDate, "d MMM yyyy") + + Me.StartDate.Text = formattedValue + + Else + + ' StartDate is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.StartDate.Text = PersonalEducationTable.StartDate.Format(PersonalEducationTable.StartDate.DefaultValue, "d MMM yyyy") + + End If + + End Sub + + + Public EvaluateFormulaDelegate As BaseClasses.Data.DataSource.EvaluateFormulaDelegate = New BaseClasses.Data.DataSource.EvaluateFormulaDelegate(AddressOf Me.EvaluateFormula) + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean, ByVal e As FormulaEvaluator) As String + If e Is Nothing Then + e = New FormulaEvaluator() + End If + + e.Variables.Clear() + + + ' add variables for formula evaluation + If variables IsNot Nothing Then + Dim enumerator As System.Collections.Generic.IEnumerator(Of System.Collections.Generic.KeyValuePair(Of String, Object)) = variables.GetEnumerator() + While enumerator.MoveNext() + e.Variables.Add(enumerator.Current.Key, enumerator.Current.Value) + End While + End If + + If includeDS + + End IF + + + ' Other variables referred to in the formula are expected to be + ' properties of the DataSource. For example, referring to + ' UnitPrice as a variable will refer to DataSource.UnitPrice + If dataSourceForEvaluate Is Nothing Then + + e.DataSource = Me.DataSource + + Else + e.DataSource = dataSourceForEvaluate + End If + + ' Define the calling control. This is used to add other + ' related table and record controls as variables. + e.CallingControl = Me + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + + If Not String.IsNullOrEmpty(format) AndAlso (String.IsNullOrEmpty(formula) OrElse formula.IndexOf("Format(") < 0) Then + Return FormulaUtils.Format(resultObj, format) + Else + Return resultObj.ToString() + End If + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format,variables ,includeDS, Nothing) + End Function + + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object)) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format, variables ,True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, format, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal e as FormulaEvaluator) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, variables, True, e) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal includeDS as Boolean) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, includeDS, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, True, Nothing) + End Function + + + Public Overridable Sub RegisterPostback() + + + End Sub + + + + ' To customize, override this method in PersonalEducationTableControlRow. + Public Overridable Sub SaveData() + ' Saves the associated record in the database. + ' SaveData calls Validate and Get methods - so it may be more appropriate to + ' customize those methods. + + ' 1. Load the existing record from the database. Since we save the entire record, this ensures + ' that fields that are not displayed are also properly initialized. + Me.LoadData() + + + ' 2. Perform any custom validation. + Me.Validate() + + + ' 3. Set the values in the record with data from UI controls. + ' This calls the Get() method for each of the user interface controls. + Me.GetUIData() + + ' 4. Save in the database. + ' We should not save the record if the data did not change. This + ' will save a database hit and avoid triggering any database triggers. + + If Me.DataSource.IsAnyValueChanged Then + ' Save record to database but do not commit yet. + ' Auto generated ids are available after saving for use by child (dependent) records. + Me.DataSource.Save() + + DirectCast(GetParentControlObject(Me, "PersonalEducationTableControl"), PersonalEducationTableControl).DataChanged = True + DirectCast(GetParentControlObject(Me, "PersonalEducationTableControl"), PersonalEducationTableControl).ResetData = True + End If + + + ' update session or cookie by formula + + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + ' For Master-Detail relationships, save data on the Detail table(s) + + End Sub + + ' To customize, override this method in PersonalEducationTableControlRow. + Public Overridable Sub GetUIData() + ' The GetUIData method retrieves the updated values from the user interface + ' controls into a database record in preparation for saving or updating. + ' To do this, it calls the Get methods for each of the field displayed on + ' the webpage. It is better to make changes in the Get methods, rather + ' than making changes here. + + ' Call the Get methods for each of the user interface controls. + + GetCommand() + GetCommandDate() + GetCOUNTRY() + GetCourse() + GetCourseAbbr() + GetCourseNo() + GetEducationPeriod() + GetEducationType() + GetEdYear() + GetEndDate() + GetFacultry() + GetInstitue() + GetLevelId() + GetNoAll() + GetPersonalId() + GetScore() + GetScoreNo() + GetStartDate() + End Sub + + + Public Overridable Sub GetCommand() + + ' Retrieve the value entered by the user on the Command ASP:TextBox, and + ' save it into the Command field in DataSource PersonalEducation record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.Command.Text, PersonalEducationTable.Command) + + + End Sub + + Public Overridable Sub GetCommandDate() + + ' Retrieve the value entered by the user on the CommandDate ASP:TextBox, and + ' save it into the CommandDate field in DataSource PersonalEducation 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.CommandDate.Text, PersonalEducationTable.CommandDate) + + + End Sub + + Public Overridable Sub GetCOUNTRY() + + ' Retrieve the value entered by the user on the COUNTRY ASP:DropDownList, and + ' save it into the COUNTRY field in DataSource PersonalEducation record. + + ' Custom validation should be performed in Validate, not here. + + Me.DataSource.Parse(GetValueSelectedPageRequest(Me.COUNTRY), PersonalEducationTable.COUNTRY) + + End Sub + + Public Overridable Sub GetCourse() + + ' Retrieve the value entered by the user on the Course ASP:TextBox, and + ' save it into the Course field in DataSource PersonalEducation record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.Course.Text, PersonalEducationTable.Course) + + + End Sub + + Public Overridable Sub GetCourseAbbr() + + ' Retrieve the value entered by the user on the CourseAbbr ASP:TextBox, and + ' save it into the CourseAbbr field in DataSource PersonalEducation record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.CourseAbbr.Text, PersonalEducationTable.CourseAbbr) + + + End Sub + + Public Overridable Sub GetCourseNo() + + ' Retrieve the value entered by the user on the CourseNo ASP:TextBox, and + ' save it into the CourseNo field in DataSource PersonalEducation record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.CourseNo.Text, PersonalEducationTable.CourseNo) + + + End Sub + + Public Overridable Sub GetEducationPeriod() + + ' Retrieve the value entered by the user on the EducationPeriod ASP:DropDownList, and + ' save it into the EducationPeriod field in DataSource PersonalEducation record. + + ' Custom validation should be performed in Validate, not here. + + Me.DataSource.Parse(GetValueSelectedPageRequest(Me.EducationPeriod), PersonalEducationTable.EducationPeriod) + + End Sub + + Public Overridable Sub GetEducationType() + + ' Retrieve the value entered by the user on the EducationType ASP:DropDownList, and + ' save it into the EducationType field in DataSource PersonalEducation record. + + ' Custom validation should be performed in Validate, not here. + + Me.DataSource.Parse(GetValueSelectedPageRequest(Me.EducationType), PersonalEducationTable.EducationType) + + End Sub + + Public Overridable Sub GetEdYear() + + ' Retrieve the value entered by the user on the EdYear ASP:TextBox, and + ' save it into the EdYear field in DataSource PersonalEducation record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.EdYear.Text, PersonalEducationTable.EdYear) + + + End Sub + + Public Overridable Sub GetEndDate() + + ' Retrieve the value entered by the user on the EndDate ASP:TextBox, and + ' save it into the EndDate field in DataSource PersonalEducation 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.EndDate.Text, PersonalEducationTable.EndDate) + + + End Sub + + Public Overridable Sub GetFacultry() + + ' Retrieve the value entered by the user on the Facultry ASP:TextBox, and + ' save it into the Facultry field in DataSource PersonalEducation record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.Facultry.Text, PersonalEducationTable.Facultry) + + + End Sub + + Public Overridable Sub GetInstitue() + + ' Retrieve the value entered by the user on the Institue ASP:TextBox, and + ' save it into the Institue field in DataSource PersonalEducation record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.Institue.Text, PersonalEducationTable.Institue) + + + End Sub + + Public Overridable Sub GetLevelId() + + ' Retrieve the value entered by the user on the LevelId ASP:DropDownList, and + ' save it into the LevelId field in DataSource PersonalEducation record. + + ' Custom validation should be performed in Validate, not here. + + Me.DataSource.Parse(GetValueSelectedPageRequest(Me.LevelId), PersonalEducationTable.LevelId) + + End Sub + + Public Overridable Sub GetNoAll() + + ' Retrieve the value entered by the user on the NoAll ASP:TextBox, and + ' save it into the NoAll field in DataSource PersonalEducation record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.NoAll.Text, PersonalEducationTable.NoAll) + + + End Sub + + Public Overridable Sub GetPersonalId() + + ' Retrieve the value entered by the user on the PersonalId ASP:DropDownList, and + ' save it into the PersonalId field in DataSource PersonalEducation record. + + ' Custom validation should be performed in Validate, not here. + + Me.DataSource.Parse(GetValueSelectedPageRequest(Me.PersonalId), PersonalEducationTable.PersonalId) + + End Sub + + Public Overridable Sub GetScore() + + ' Retrieve the value entered by the user on the Score ASP:TextBox, and + ' save it into the Score field in DataSource PersonalEducation record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.Score.Text, PersonalEducationTable.Score) + + + End Sub + + Public Overridable Sub GetScoreNo() + + ' Retrieve the value entered by the user on the ScoreNo ASP:TextBox, and + ' save it into the ScoreNo field in DataSource PersonalEducation record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.ScoreNo.Text, PersonalEducationTable.ScoreNo) + + + End Sub + + Public Overridable Sub GetStartDate() + + ' Retrieve the value entered by the user on the StartDate ASP:TextBox, and + ' save it into the StartDate field in DataSource PersonalEducation 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.StartDate.Text, PersonalEducationTable.StartDate) + + + End Sub + + + ' To customize, override this method in PersonalEducationTableControlRow. + + Public Overridable Function CreateWhereClause() As WhereClause + + Return Nothing + + End Function + + + + ' To customize, override this method in PersonalEducationTableControlRow. + Public Overridable Sub Validate() + ' Add custom validation for any control within this panel. + ' Example. If you have a State ASP:Textbox control + ' If Me.State.Text <> "CA" Then + ' Throw New Exception("State must be CA (California).") + ' End If + + ' The Validate method is common across all controls within + ' this panel so you can validate multiple fields, but report + ' one error message. + + + End Sub + + Public Overridable Sub Delete() + + If Me.IsNewRecord() Then + Return + End If + + Dim pkValue As KeyValue = KeyValue.XmlToKey(Me.RecordUniqueId) + PersonalEducationTable.DeleteRecord(pkValue) + + DirectCast(GetParentControlObject(Me, "PersonalEducationTableControl"), PersonalEducationTableControl).DataChanged = True + DirectCast(GetParentControlObject(Me, "PersonalEducationTableControl"), PersonalEducationTableControl).ResetData = True + End Sub + + Protected Overridable Sub Control_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.PreRender + ' PreRender event is raised just before page is being displayed. + Try + DbUtils.StartTransaction() + Me.RegisterPostback() + + If Not Me.Page.ErrorOnPage AndAlso (Me.Page.IsPageRefresh OrElse Me.DataChanged OrElse Me.ResetData) Then + + + ' Re-load the data and update the web page if necessary. + ' This is typically done during a postback (filter, search button, sort, pagination button). + ' In each of the other click handlers, simply set DataChanged to True to reload the data. + Me.LoadData() + Me.DataBind() + End If + + + Catch ex As Exception + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + Finally + DbUtils.EndTransaction() + End Try + End Sub + + + Protected Overrides Sub SaveControlsToSession() + MyBase.SaveControlsToSession() + + + 'Save pagination state to session. + + End Sub + + + + Protected Overrides Sub ClearControlsFromSession() + MyBase.ClearControlsFromSession() + + + + ' Clear pagination state from session. + + End Sub + + Protected Overrides Sub LoadViewState(ByVal savedState As Object) + MyBase.LoadViewState(savedState) + Dim isNewRecord As String = CType(ViewState("IsNewRecord"), String) + If Not isNewRecord Is Nothing AndAlso isNewRecord.Trim <> "" Then + Me.IsNewRecord = Boolean.Parse(isNewRecord) + End If + + Dim myCheckSum As String = CType(ViewState("CheckSum"), String) + If Not myCheckSum Is Nothing AndAlso myCheckSum.Trim <> "" Then + Me.CheckSum = myCheckSum + End If + + + ' Load view state for pagination control. + + End Sub + + Protected Overrides Function SaveViewState() As Object + ViewState("IsNewRecord") = Me.IsNewRecord.ToString() + ViewState("CheckSum") = Me.CheckSum + + + ' Load view state for pagination control. + + Return MyBase.SaveViewState() + End Function + + + + Public Overridable Function CreateWhereClause_COUNTRYDropDownList() 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 Country table. + ' Examples: + ' wc.iAND(CountryTable.Country, BaseFilter.ComparisonOperator.EqualsTo, "XYZ") + ' wc.iAND(CountryTable.Active, BaseFilter.ComparisonOperator.EqualsTo, "1") + + Dim wc As WhereClause = New WhereClause() + Return wc + + End Function + + + + Public Overridable Function CreateWhereClause_EducationPeriodDropDownList() 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 EducationPeriod table. + ' Examples: + ' wc.iAND(EducationPeriodTable.Period, BaseFilter.ComparisonOperator.EqualsTo, "XYZ") + ' wc.iAND(EducationPeriodTable.Active, BaseFilter.ComparisonOperator.EqualsTo, "1") + + Dim wc As WhereClause = New WhereClause() + Return wc + + End Function + + + + Public Overridable Function CreateWhereClause_EducationTypeDropDownList() As WhereClause + ' By default, we simply return a new WhereClause. + ' Add additional where clauses to restrict the items shown in the dropdown list. + + Dim wc As WhereClause = New WhereClause() + Return wc + + End Function + + + + Public Overridable Function CreateWhereClause_LevelIdDropDownList() 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 Education table. + ' Examples: + ' wc.iAND(EducationTable.Level, BaseFilter.ComparisonOperator.EqualsTo, "XYZ") + ' wc.iAND(EducationTable.Active, BaseFilter.ComparisonOperator.EqualsTo, "1") + + Dim wc As WhereClause = New WhereClause() + Return wc + + End Function + + + + Public Overridable Function CreateWhereClause_PersonalIdDropDownList() 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 PersonalId table. + ' Examples: + ' wc.iAND(PersonalIdTable.PersonalName, BaseFilter.ComparisonOperator.EqualsTo, "XYZ") + ' wc.iAND(PersonalIdTable.Active, BaseFilter.ComparisonOperator.EqualsTo, "1") + + Dim wc As WhereClause = New WhereClause() + Return wc + + End Function + + + ' Fill the COUNTRY list. + Protected Overridable Sub PopulateCOUNTRYDropDownList( _ + ByVal selectedValue As String, _ + ByVal maxItems As Integer) + + Me.COUNTRY.Items.Clear() + + + ' 1. Setup the static list items + + ' Add the Please Select item. + Me.COUNTRY.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_COUNTRYDropDownList function. + ' It is better to customize the where clause there. + + Dim wc As WhereClause = CreateWhereClause_COUNTRYDropDownList() + ' Create the ORDER BY clause to sort based on the displayed value. + + + Dim orderBy As OrderBy = New OrderBy(false, false) + orderBy.Add(CountryTable.Country, OrderByItem.OrderDir.Asc) + + Dim variables As System.Collections.Generic.IDictionary(Of String, Object) = New System.Collections.Generic.Dictionary(Of String, Object) + + ' 3. Read a total of maxItems from the database and insert them + Dim itemValues() As CountryRecord = 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 = CountryTable.GetRecords(wc, orderBy, pageNum, maxItems) + For each itemValue As CountryRecord In itemValues + ' Create the item and add to the list. + Dim cvalue As String = Nothing + Dim fvalue As String = Nothing + If itemValue.CountryIdSpecified Then + cvalue = itemValue.CountryId.ToString() + + If counter < maxItems AndAlso Me.COUNTRY.Items.FindByValue(cvalue) Is Nothing Then + + Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalEducationTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalEducationTable.COUNTRY) + If _isExpandableNonCompositeForeignKey AndAlso PersonalEducationTable.COUNTRY.IsApplyDisplayAs Then + fvalue = PersonalEducationTable.GetDFKA(itemValue, PersonalEducationTable.COUNTRY) + End If + If (Not _isExpandableNonCompositeForeignKey) Or (String.IsNullOrEmpty(fvalue)) Then + fvalue = itemValue.Format(CountryTable.Country) + End If + + If fvalue Is Nothing OrElse fvalue.Trim() = "" Then fvalue = cvalue + + If (IsNothing(fvalue)) Then + fvalue = "" + End If + + fvalue = fvalue.Trim() + + If ( fvalue.Length > 50 ) Then + fvalue = fvalue.Substring(0, 50) & "..." + End If + + Dim dupItem As ListItem = Me.COUNTRY.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.COUNTRY.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.COUNTRY, selectedValue) AndAlso _ + Not SetSelectedDisplayText(Me.COUNTRY, selectedValue)Then + + ' construct a whereclause to query a record with Country.CountryId = selectedValue + Dim filter2 As CompoundFilter = New CompoundFilter(CompoundFilter.CompoundingOperators.And_Operator, Nothing) + Dim whereClause2 As WhereClause = New WhereClause() + filter2.AddFilter(New BaseClasses.Data.ColumnValueFilter(CountryTable.CountryId, selectedValue, BaseClasses.Data.BaseFilter.ComparisonOperator.EqualsTo, False)) + whereClause2.AddFilter(filter2, CompoundFilter.CompoundingOperators.And_Operator) + + Try + ' Execute the query + Dim rc() As CountryRecord = CountryTable.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 CountryRecord = DirectCast(rc(0), CountryRecord) + ' Create the item and add to the list. + Dim cvalue As String = Nothing + Dim fvalue As String = Nothing + If itemValue.CountryIdSpecified Then + cvalue = itemValue.CountryId.ToString() + Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalEducationTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalEducationTable.COUNTRY) + If _isExpandableNonCompositeForeignKey AndAlso PersonalEducationTable.COUNTRY.IsApplyDisplayAs Then + fvalue = PersonalEducationTable.GetDFKA(itemValue, PersonalEducationTable.COUNTRY) + End If + If (Not _isExpandableNonCompositeForeignKey) Or (String.IsNullOrEmpty(fvalue)) Then + fvalue = itemValue.Format(CountryTable.Country) + End If + + If fvalue Is Nothing OrElse fvalue.Trim() = "" Then fvalue = cvalue + Dim newItem As New ListItem(fvalue, cvalue) + Me.COUNTRY.Items.Add(newItem) + SetSelectedValue(Me.COUNTRY, selectedValue) + End If + End If + Catch + End Try + + End If + + + End Sub + + ' Fill the EducationPeriod list. + Protected Overridable Sub PopulateEducationPeriodDropDownList( _ + ByVal selectedValue As String, _ + ByVal maxItems As Integer) + + Me.EducationPeriod.Items.Clear() + + + ' 1. Setup the static list items + + ' Add the Please Select item. + Me.EducationPeriod.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_EducationPeriodDropDownList function. + ' It is better to customize the where clause there. + + Dim wc As WhereClause = CreateWhereClause_EducationPeriodDropDownList() + ' Create the ORDER BY clause to sort based on the displayed value. + + + Dim orderBy As OrderBy = New OrderBy(false, false) + orderBy.Add(EducationPeriodTable.Period, 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 EducationPeriodRecord = 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 = EducationPeriodTable.GetRecords(wc, orderBy, pageNum, maxItems) + For each itemValue As EducationPeriodRecord In itemValues + ' Create the item and add to the list. + Dim cvalue As String = Nothing + Dim fvalue As String = Nothing + If itemValue.PeriodIdSpecified Then + cvalue = itemValue.PeriodId.ToString() + + If counter < maxItems AndAlso Me.EducationPeriod.Items.FindByValue(cvalue) Is Nothing Then + + Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalEducationTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalEducationTable.EducationPeriod) + If _isExpandableNonCompositeForeignKey AndAlso PersonalEducationTable.EducationPeriod.IsApplyDisplayAs Then + fvalue = PersonalEducationTable.GetDFKA(itemValue, PersonalEducationTable.EducationPeriod) + End If + If (Not _isExpandableNonCompositeForeignKey) Or (String.IsNullOrEmpty(fvalue)) Then + fvalue = itemValue.Format(EducationPeriodTable.Period) + 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.EducationPeriod.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.EducationPeriod.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.EducationPeriod, selectedValue) AndAlso _ + Not SetSelectedDisplayText(Me.EducationPeriod, selectedValue)Then + + ' construct a whereclause to query a record with EducationPeriod.PeriodId = selectedValue + Dim filter2 As CompoundFilter = New CompoundFilter(CompoundFilter.CompoundingOperators.And_Operator, Nothing) + Dim whereClause2 As WhereClause = New WhereClause() + filter2.AddFilter(New BaseClasses.Data.ColumnValueFilter(EducationPeriodTable.PeriodId, selectedValue, BaseClasses.Data.BaseFilter.ComparisonOperator.EqualsTo, False)) + whereClause2.AddFilter(filter2, CompoundFilter.CompoundingOperators.And_Operator) + + Try + ' Execute the query + Dim rc() As EducationPeriodRecord = EducationPeriodTable.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 EducationPeriodRecord = DirectCast(rc(0), EducationPeriodRecord) + ' Create the item and add to the list. + Dim cvalue As String = Nothing + Dim fvalue As String = Nothing + If itemValue.PeriodIdSpecified Then + cvalue = itemValue.PeriodId.ToString() + Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalEducationTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalEducationTable.EducationPeriod) + If _isExpandableNonCompositeForeignKey AndAlso PersonalEducationTable.EducationPeriod.IsApplyDisplayAs Then + fvalue = PersonalEducationTable.GetDFKA(itemValue, PersonalEducationTable.EducationPeriod) + End If + If (Not _isExpandableNonCompositeForeignKey) Or (String.IsNullOrEmpty(fvalue)) Then + fvalue = itemValue.Format(EducationPeriodTable.Period) + End If + + If fvalue Is Nothing OrElse fvalue.Trim() = "" Then fvalue = cvalue + Dim newItem As New ListItem(fvalue, cvalue) + Me.EducationPeriod.Items.Add(newItem) + SetSelectedValue(Me.EducationPeriod, selectedValue) + End If + End If + Catch + End Try + + End If + + + End Sub + + ' Fill the EducationType list. + Protected Overridable Sub PopulateEducationTypeDropDownList( _ + ByVal selectedValue As String, _ + ByVal maxItems As Integer) + + Me.EducationType.Items.Clear() + + + ' 1. Setup the static list items + + Me.EducationType.Items.Add(New ListItem(Me.Page.ExpandResourceValue("{Txt:PleaseSelect}"), "--PLEASE_SELECT--")) + + Me.EducationType.Items.Add(New ListItem(Me.Page.ExpandResourceValue("1"), "1")) + + Me.EducationType.Items.Add(New ListItem(Me.Page.ExpandResourceValue("2"), "2")) + + ' Skip step 2 and 3 because no need to load data from database and insert data + + + ' 4. Set the selected value (insert if not already present). + + If Not selectedValue Is Nothing AndAlso _ + selectedValue.Trim <> "" AndAlso _ + Not SetSelectedValue(Me.EducationType, selectedValue) AndAlso _ + Not SetSelectedDisplayText(Me.EducationType, selectedValue) AndAlso _ + Not SetSelectedDisplayText(Me.EducationType, PersonalEducationTable.EducationType.Format(selectedValue))Then + Dim fvalue As String = PersonalEducationTable.EducationType.Format(selectedValue) + If fvalue Is Nothing OrElse fvalue.Trim() = "" Then fvalue = selectedValue + Dim item As ListItem = New ListItem(fvalue, selectedValue) + item.Selected = True + Me.EducationType.Items.Add(item) + End If + + + End Sub + + ' Fill the LevelId list. + Protected Overridable Sub PopulateLevelIdDropDownList( _ + ByVal selectedValue As String, _ + ByVal maxItems As Integer) + + Me.LevelId.Items.Clear() + + + ' 1. Setup the static list items + + ' Add the Please Select item. + Me.LevelId.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_LevelIdDropDownList function. + ' It is better to customize the where clause there. + + Dim wc As WhereClause = CreateWhereClause_LevelIdDropDownList() + ' Create the ORDER BY clause to sort based on the displayed value. + + + Dim orderBy As OrderBy = New OrderBy(false, false) + orderBy.Add(EducationTable.Level, OrderByItem.OrderDir.Asc) + + Dim variables As System.Collections.Generic.IDictionary(Of String, Object) = New System.Collections.Generic.Dictionary(Of String, Object) + + ' 3. Read a total of maxItems from the database and insert them + Dim itemValues() As EducationRecord = 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 = EducationTable.GetRecords(wc, orderBy, pageNum, maxItems) + For each itemValue As EducationRecord In itemValues + ' Create the item and add to the list. + Dim cvalue As String = Nothing + Dim fvalue As String = Nothing + If itemValue.EducationIdSpecified Then + cvalue = itemValue.EducationId.ToString() + + If counter < maxItems AndAlso Me.LevelId.Items.FindByValue(cvalue) Is Nothing Then + + Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalEducationTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalEducationTable.LevelId) + If _isExpandableNonCompositeForeignKey AndAlso PersonalEducationTable.LevelId.IsApplyDisplayAs Then + fvalue = PersonalEducationTable.GetDFKA(itemValue, PersonalEducationTable.LevelId) + End If + If (Not _isExpandableNonCompositeForeignKey) Or (String.IsNullOrEmpty(fvalue)) Then + fvalue = itemValue.Format(EducationTable.Level) + End If + + If fvalue Is Nothing OrElse fvalue.Trim() = "" Then fvalue = cvalue + + If (IsNothing(fvalue)) Then + fvalue = "" + End If + + fvalue = fvalue.Trim() + + If ( fvalue.Length > 50 ) Then + fvalue = fvalue.Substring(0, 50) & "..." + End If + + Dim dupItem As ListItem = Me.LevelId.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.LevelId.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.LevelId, selectedValue) AndAlso _ + Not SetSelectedDisplayText(Me.LevelId, selectedValue)Then + + ' construct a whereclause to query a record with Education.EducationId = selectedValue + Dim filter2 As CompoundFilter = New CompoundFilter(CompoundFilter.CompoundingOperators.And_Operator, Nothing) + Dim whereClause2 As WhereClause = New WhereClause() + filter2.AddFilter(New BaseClasses.Data.ColumnValueFilter(EducationTable.EducationId, selectedValue, BaseClasses.Data.BaseFilter.ComparisonOperator.EqualsTo, False)) + whereClause2.AddFilter(filter2, CompoundFilter.CompoundingOperators.And_Operator) + + Try + ' Execute the query + Dim rc() As EducationRecord = EducationTable.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 EducationRecord = DirectCast(rc(0), EducationRecord) + ' Create the item and add to the list. + Dim cvalue As String = Nothing + Dim fvalue As String = Nothing + If itemValue.EducationIdSpecified Then + cvalue = itemValue.EducationId.ToString() + Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalEducationTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalEducationTable.LevelId) + If _isExpandableNonCompositeForeignKey AndAlso PersonalEducationTable.LevelId.IsApplyDisplayAs Then + fvalue = PersonalEducationTable.GetDFKA(itemValue, PersonalEducationTable.LevelId) + End If + If (Not _isExpandableNonCompositeForeignKey) Or (String.IsNullOrEmpty(fvalue)) Then + fvalue = itemValue.Format(EducationTable.Level) + End If + + If fvalue Is Nothing OrElse fvalue.Trim() = "" Then fvalue = cvalue + Dim newItem As New ListItem(fvalue, cvalue) + Me.LevelId.Items.Add(newItem) + SetSelectedValue(Me.LevelId, selectedValue) + End If + End If + Catch + End Try + + End If + + + End Sub + + ' Fill the PersonalId list. + Protected Overridable Sub PopulatePersonalIdDropDownList( _ + ByVal selectedValue As String, _ + ByVal maxItems As Integer) + + Me.PersonalId.Items.Clear() + + + ' 1. Setup the static list items + + ' Add the Please Select item. + Me.PersonalId.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_PersonalIdDropDownList function. + ' It is better to customize the where clause there. + + Dim wc As WhereClause = CreateWhereClause_PersonalIdDropDownList() + ' Create the ORDER BY clause to sort based on the displayed value. + + + Dim orderBy As OrderBy = New OrderBy(false, false) + orderBy.Add(PersonalIdTable.PersonalName, OrderByItem.OrderDir.Asc) + + Dim variables As System.Collections.Generic.IDictionary(Of String, Object) = New System.Collections.Generic.Dictionary(Of String, Object) + + ' 3. Read a total of maxItems from the database and insert them + Dim itemValues() As PersonalIdRecord = 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 = PersonalIdTable.GetRecords(wc, orderBy, pageNum, maxItems) + For each itemValue As PersonalIdRecord In itemValues + ' Create the item and add to the list. + Dim cvalue As String = Nothing + Dim fvalue As String = Nothing + If itemValue.PersonalIdSpecified Then + cvalue = itemValue.PersonalId.ToString() + + If counter < maxItems AndAlso Me.PersonalId.Items.FindByValue(cvalue) Is Nothing Then + + Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalEducationTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalEducationTable.PersonalId) + If _isExpandableNonCompositeForeignKey AndAlso PersonalEducationTable.PersonalId.IsApplyDisplayAs Then + fvalue = PersonalEducationTable.GetDFKA(itemValue, PersonalEducationTable.PersonalId) + End If + If (Not _isExpandableNonCompositeForeignKey) Or (String.IsNullOrEmpty(fvalue)) Then + fvalue = itemValue.Format(PersonalIdTable.PersonalName) + End If + + If fvalue Is Nothing OrElse fvalue.Trim() = "" Then fvalue = cvalue + + If (IsNothing(fvalue)) Then + fvalue = "" + End If + + fvalue = fvalue.Trim() + + If ( fvalue.Length > 50 ) Then + fvalue = fvalue.Substring(0, 50) & "..." + End If + + Dim dupItem As ListItem = Me.PersonalId.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.PersonalId.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.PersonalId, selectedValue) AndAlso _ + Not SetSelectedDisplayText(Me.PersonalId, selectedValue)Then + + ' construct a whereclause to query a record with PersonalId.PersonalId = selectedValue + Dim filter2 As CompoundFilter = New CompoundFilter(CompoundFilter.CompoundingOperators.And_Operator, Nothing) + Dim whereClause2 As WhereClause = New WhereClause() + filter2.AddFilter(New BaseClasses.Data.ColumnValueFilter(PersonalIdTable.PersonalId, selectedValue, BaseClasses.Data.BaseFilter.ComparisonOperator.EqualsTo, False)) + whereClause2.AddFilter(filter2, CompoundFilter.CompoundingOperators.And_Operator) + + Try + ' Execute the query + Dim rc() As PersonalIdRecord = PersonalIdTable.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 PersonalIdRecord = DirectCast(rc(0), PersonalIdRecord) + ' Create the item and add to the list. + Dim cvalue As String = Nothing + Dim fvalue As String = Nothing + If itemValue.PersonalIdSpecified Then + cvalue = itemValue.PersonalId.ToString() + Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalEducationTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalEducationTable.PersonalId) + If _isExpandableNonCompositeForeignKey AndAlso PersonalEducationTable.PersonalId.IsApplyDisplayAs Then + fvalue = PersonalEducationTable.GetDFKA(itemValue, PersonalEducationTable.PersonalId) + End If + If (Not _isExpandableNonCompositeForeignKey) Or (String.IsNullOrEmpty(fvalue)) Then + fvalue = itemValue.Format(PersonalIdTable.PersonalName) + End If + + If fvalue Is Nothing OrElse fvalue.Trim() = "" Then fvalue = cvalue + Dim newItem As New ListItem(fvalue, cvalue) + Me.PersonalId.Items.Add(newItem) + SetSelectedValue(Me.PersonalId, selectedValue) + End If + End If + Catch + End Try + + End If + + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalEducationRowDeleteButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + If(Not Me.Page.IsPageRefresh) Then + + Dim tc As PersonalEducationTableControl = DirectCast(GetParentControlObject(Me, "PersonalEducationTableControl"), PersonalEducationTableControl) + If Not (IsNothing(tc)) Then + If Not Me.IsNewRecord Then + tc.AddToDeletedRecordIds(DirectCast(Me, PersonalEducationTableControlRow)) + End If + Me.Visible = False + tc.SetFormulaControls() + End If + + End If + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalEducationRowEditButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + ' The redirect URL is set on the Properties, Custom Properties or Actions. + ' The ModifyRedirectURL call resolves the parameters before the + ' Response.Redirect redirects the page to the URL. + ' Any code after the Response.Redirect call will not be executed, since the page is + ' redirected to the URL. + + + Dim url As String = "../PersonalEducation/EditPersonalEducation.aspx?PersonalEducation={PK}" + + Dim shouldRedirect As Boolean = True + Dim TargetKey As String = Nothing + Dim DFKA As String = TargetKey + Dim id As String = DFKA + Dim value As String = id + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + url = Me.ModifyRedirectUrl(url, "",False) + url = Me.Page.ModifyRedirectUrl(url, "",False) + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + shouldRedirect = False + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + If shouldRedirect Then + Me.Page.ShouldSaveControlsToSession = True + Me.Page.Response.Redirect(url) + ElseIf Not TargetKey Is Nothing AndAlso _ + Not shouldRedirect Then + Me.Page.ShouldSaveControlsToSession = True + Me.Page.CloseWindow(True) + + End If + End Sub + + Protected Overridable Sub COUNTRY_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()(COUNTRY.ClientID & "_SelectedValue"), String) + Dim displayText As String = CType(Me.Page.Session()(COUNTRY.ClientID & "_SelectedDisplayText"), String) + If displayText <> "" AndAlso val <> "" Then + Me.COUNTRY.Items.Add(New ListItem(displayText, val)) + Me.COUNTRY.SelectedIndex = Me.COUNTRY.Items.Count - 1 + Me.Page.Session.Remove(COUNTRY.ClientID & "_SelectedValue") + Me.Page.Session.Remove(COUNTRY.ClientID & "_SelectedDisplayText") + End If + + + + + End Sub + + Protected Overridable Sub EducationPeriod_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()(EducationPeriod.ClientID & "_SelectedValue"), String) + Dim displayText As String = CType(Me.Page.Session()(EducationPeriod.ClientID & "_SelectedDisplayText"), String) + If displayText <> "" AndAlso val <> "" Then + Me.EducationPeriod.Items.Add(New ListItem(displayText, val)) + Me.EducationPeriod.SelectedIndex = Me.EducationPeriod.Items.Count - 1 + Me.Page.Session.Remove(EducationPeriod.ClientID & "_SelectedValue") + Me.Page.Session.Remove(EducationPeriod.ClientID & "_SelectedDisplayText") + End If + + + + + End Sub + + Protected Overridable Sub EducationType_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()(EducationType.ClientID & "_SelectedValue"), String) + Dim displayText As String = CType(Me.Page.Session()(EducationType.ClientID & "_SelectedDisplayText"), String) + If displayText <> "" AndAlso val <> "" Then + Me.EducationType.Items.Add(New ListItem(displayText, val)) + Me.EducationType.SelectedIndex = Me.EducationType.Items.Count - 1 + Me.Page.Session.Remove(EducationType.ClientID & "_SelectedValue") + Me.Page.Session.Remove(EducationType.ClientID & "_SelectedDisplayText") + End If + + + + + End Sub + + Protected Overridable Sub LevelId_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()(LevelId.ClientID & "_SelectedValue"), String) + Dim displayText As String = CType(Me.Page.Session()(LevelId.ClientID & "_SelectedDisplayText"), String) + If displayText <> "" AndAlso val <> "" Then + Me.LevelId.Items.Add(New ListItem(displayText, val)) + Me.LevelId.SelectedIndex = Me.LevelId.Items.Count - 1 + Me.Page.Session.Remove(LevelId.ClientID & "_SelectedValue") + Me.Page.Session.Remove(LevelId.ClientID & "_SelectedDisplayText") + End If + + + + + End Sub + + Protected Overridable Sub PersonalId_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()(PersonalId.ClientID & "_SelectedValue"), String) + Dim displayText As String = CType(Me.Page.Session()(PersonalId.ClientID & "_SelectedDisplayText"), String) + If displayText <> "" AndAlso val <> "" Then + Me.PersonalId.Items.Add(New ListItem(displayText, val)) + Me.PersonalId.SelectedIndex = Me.PersonalId.Items.Count - 1 + Me.Page.Session.Remove(PersonalId.ClientID & "_SelectedValue") + Me.Page.Session.Remove(PersonalId.ClientID & "_SelectedDisplayText") + End If + + + + + End Sub + + Protected Overridable Sub Command_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub CommandDate_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub Course_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub CourseAbbr_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub CourseNo_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub EdYear_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub EndDate_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub Facultry_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub Institue_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub NoAll_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub Score_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub ScoreNo_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub StartDate_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("BasePersonalEducationTableControlRow_Rec"), String) + End Get + Set(ByVal value As String) + Me.ViewState("BasePersonalEducationTableControlRow_Rec") = value + End Set + End Property + + Private _DataSource As PersonalEducationRecord + Public Property DataSource() As PersonalEducationRecord + Get + Return Me._DataSource + End Get + + Set(ByVal value As PersonalEducationRecord) + + Me._DataSource = value + End Set + End Property + + + + Private _checkSum As String + Public Overridable Property CheckSum() As String + Get + Return Me._checkSum + End Get + Set(ByVal value As String) + Me._checkSum = value + End Set + End Property + + Private _TotalPages As Integer + Public Property TotalPages() As Integer + Get + Return Me._TotalPages + End Get + Set(ByVal value As Integer) + Me._TotalPages = value + End Set + End Property + + Private _PageIndex As Integer + Public Property PageIndex() As Integer + Get + ' Return the PageIndex + Return Me._PageIndex + End Get + Set(ByVal value As Integer) + Me._PageIndex = value + End Set + End Property + + Private _DisplayLastPage As Boolean + Public Property DisplayLastPage() As Boolean + Get + Return Me._DisplayLastPage + End Get + Set(ByVal value As Boolean) + Me._DisplayLastPage = value + End Set + End Property + + + +#Region "Helper Properties" + + Public ReadOnly Property Command() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Command"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property CommandDate() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "CommandDate"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property COUNTRY() As System.Web.UI.WebControls.DropDownList + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "COUNTRY"), System.Web.UI.WebControls.DropDownList) + End Get + End Property + + Public ReadOnly Property Course() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Course"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property CourseAbbr() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "CourseAbbr"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property CourseNo() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "CourseNo"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property EducationPeriod() As System.Web.UI.WebControls.DropDownList + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "EducationPeriod"), System.Web.UI.WebControls.DropDownList) + End Get + End Property + + Public ReadOnly Property EducationType() As System.Web.UI.WebControls.DropDownList + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "EducationType"), System.Web.UI.WebControls.DropDownList) + End Get + End Property + + Public ReadOnly Property EdYear() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "EdYear"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property EndDate() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "EndDate"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property Facultry() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Facultry"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property Institue() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Institue"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property LevelId() As System.Web.UI.WebControls.DropDownList + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "LevelId"), System.Web.UI.WebControls.DropDownList) + End Get + End Property + + Public ReadOnly Property NoAll() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "NoAll"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property PersonalEducationRecordRowSelection() As System.Web.UI.WebControls.CheckBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalEducationRecordRowSelection"), System.Web.UI.WebControls.CheckBox) + End Get + End Property + + Public ReadOnly Property PersonalEducationRowDeleteButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalEducationRowDeleteButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalEducationRowEditButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalEducationRowEditButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalId() As System.Web.UI.WebControls.DropDownList + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalId"), System.Web.UI.WebControls.DropDownList) + End Get + End Property + + Public ReadOnly Property Score() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Score"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property ScoreNo() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "ScoreNo"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property StartDate() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "StartDate"), System.Web.UI.WebControls.TextBox) + End Get + End Property + +#End Region + +#Region "Helper Functions" + + Public Overrides Overloads Function ModifyRedirectUrl(ByVal url As String, ByVal arg As String, ByVal bEncrypt As Boolean) As String + Return Me.Page.EvaluateExpressions(url, arg, bEncrypt, Me) + End Function + + Public Overrides Overloads Function EvaluateExpressions(ByVal url As String, ByVal arg As String, ByVal bEncrypt As Boolean) As String + + Dim rec As PersonalEducationRecord = Nothing + + + Try + rec = Me.GetRecord() + Catch ex As Exception + ' Do nothing + End Try + + If rec Is Nothing AndAlso url.IndexOf("{") >= 0 Then + ' Localization. + + Throw New Exception(Page.GetResourceValue("Err:RecDataSrcNotInitialized", "Persons")) + + End If + Return EvaluateExpressions(url, arg, rec, bEncrypt) + End Function + + + Public Overridable Function GetRecord() As PersonalEducationRecord + If Not Me.DataSource Is Nothing Then + Return Me.DataSource + End If + + If Not Me.RecordUniqueId Is Nothing Then + + Return PersonalEducationTable.GetRecord(Me.RecordUniqueId, True) + + End If + + ' Localization. + + Throw New Exception(Page.GetResourceValue("Err:RetrieveRec", "Persons")) + + End Function + + Public Shadows ReadOnly Property Page() As BaseApplicationPage + Get + Return DirectCast(MyBase.Page, BaseApplicationPage) + End Get + End Property + +#End Region + +End Class + + + +' Base class for the PersonalEducationTableControl control on the EditPersonalEducationTable2 page. +' Do not modify this class. Instead override any method in PersonalEducationTableControl. +Public Class BasePersonalEducationTableControl + Inherits Persons.UI.BaseApplicationTableControl + + + + Protected Overridable Sub Control_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Init + + + + ' Setup the filter and search events. + + + + ' Control Initializations. + ' Initialize the table's current sort order. + + If Me.InSession(Me, "Order_By") Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + Me.CurrentSortOrder.Add(PersonalEducationTable.EducationPeriod, OrderByItem.OrderDir.Asc) + + Me.CurrentSortOrder.Add(PersonalEducationTable.StartDate, OrderByItem.OrderDir.Asc) + + End If + + + + ' Setup default pagination settings. + + Me.PageSize = CInt(Me.GetFromSession(Me, "Page_Size", "10")) + Me.PageIndex = CInt(Me.GetFromSession(Me, "Page_Index", "0")) + + + + Me.ClearControlsFromSession() + End Sub + + Protected Overridable Sub Control_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load + + SaveControlsToSession_Ajax() + + ' Show confirmation message on Click + Me.PersonalEducationDeleteButton.Attributes.Add("onClick", "return (confirm('" & (CType(Me.Page,BaseApplicationPage)).GetResourceValue("DeleteConfirm", "Persons") & "'));") + + ' Setup the pagination events. + + AddHandler Me.PersonalEducationPagination.FirstPage.Click, AddressOf PersonalEducationPagination_FirstPage_Click + + AddHandler Me.PersonalEducationPagination.LastPage.Click, AddressOf PersonalEducationPagination_LastPage_Click + + AddHandler Me.PersonalEducationPagination.NextPage.Click, AddressOf PersonalEducationPagination_NextPage_Click + + AddHandler Me.PersonalEducationPagination.PageSizeButton.Click, AddressOf PersonalEducationPagination_PageSizeButton_Click + + AddHandler Me.PersonalEducationPagination.PreviousPage.Click, AddressOf PersonalEducationPagination_PreviousPage_Click + + + ' Setup the sorting events. + + AddHandler Me.CommandDateLabel.Click, AddressOf CommandDateLabel_Click + + AddHandler Me.CommandLabel.Click, AddressOf CommandLabel_Click + + AddHandler Me.COUNTRYLabel.Click, AddressOf COUNTRYLabel_Click + + AddHandler Me.CourseAbbrLabel.Click, AddressOf CourseAbbrLabel_Click + + AddHandler Me.CourseLabel.Click, AddressOf CourseLabel_Click + + AddHandler Me.CourseNoLabel.Click, AddressOf CourseNoLabel_Click + + AddHandler Me.EducationPeriodLabel.Click, AddressOf EducationPeriodLabel_Click + + AddHandler Me.EducationTypeLabel.Click, AddressOf EducationTypeLabel_Click + + AddHandler Me.EdYearLabel.Click, AddressOf EdYearLabel_Click + + AddHandler Me.EndDateLabel.Click, AddressOf EndDateLabel_Click + + AddHandler Me.FacultryLabel.Click, AddressOf FacultryLabel_Click + + AddHandler Me.InstitueLabel.Click, AddressOf InstitueLabel_Click + + AddHandler Me.LevelIdLabel1.Click, AddressOf LevelIdLabel1_Click + + AddHandler Me.NoAllLabel.Click, AddressOf NoAllLabel_Click + + AddHandler Me.ScoreLabel.Click, AddressOf ScoreLabel_Click + + AddHandler Me.ScoreNoLabel.Click, AddressOf ScoreNoLabel_Click + + AddHandler Me.StartDateLabel.Click, AddressOf StartDateLabel_Click + + ' Setup the button events. + + AddHandler Me.PersonalEducationAddButton.Click, AddressOf PersonalEducationAddButton_Click + + AddHandler Me.PersonalEducationDeleteButton.Click, AddressOf PersonalEducationDeleteButton_Click + + AddHandler Me.PersonalEducationEditButton.Click, AddressOf PersonalEducationEditButton_Click + + AddHandler Me.PersonalEducationRefreshButton.Click, AddressOf PersonalEducationRefreshButton_Click + + AddHandler Me.PersonalEducationResetButton.Click, AddressOf PersonalEducationResetButton_Click + + AddHandler Me.PersonalEducationSaveButton.Click, AddressOf PersonalEducationSaveButton_Click + + Me.PersonalEducationSaveButton.Attributes.Add("onclick", "SubmitHRefOnce(this, """ & Me.Page.GetResourceValue("Txt:SaveRecord", "Persons") & """);") + + + ' Setup events for others + + End Sub + + + Public Overridable Sub LoadData() + + ' Read data from database. Returns an array of records that can be assigned + ' to the DataSource table control property. + Try + Dim joinFilter As CompoundFilter = CreateCompoundJoinFilter() + + ' The WHERE clause will be empty when displaying all records in table. + Dim wc As WhereClause = CreateWhereClause() + If wc IsNot Nothing AndAlso Not wc.RunQuery Then + ' Initialize an empty array of records + Dim alist As New ArrayList(0) + Me.DataSource = DirectCast(alist.ToArray(GetType(PersonalEducationRecord)), PersonalEducationRecord()) + ' Add records to the list if needed. + Me.AddNewRecords() + Me._TotalRecords = 0 + Me._TotalPages = 0 + Return + End If + + ' Call OrderBy to determine the order - either use the order defined + ' on the Query Wizard, or specified by user (by clicking on column heading) + Dim orderBy As OrderBy = CreateOrderBy() + + ' Get the pagesize from the pagesize control. + Me.GetPageSize() + + If Me.DisplayLastPage Then + Dim totalRecords As Integer = If(Me._TotalRecords < 0, PersonalEducationTable.GetRecordCount(CreateCompoundJoinFilter(), CreateWhereClause()), Me._TotalRecords) + + Dim totalPages As Integer = CInt(Math.Ceiling(totalRecords / Me.PageSize)) + + Me.PageIndex = totalPages - 1 + End If + + ' Make sure PageIndex (current page) and PageSize are within bounds. + If Me.PageIndex < 0 Then + Me.PageIndex = 0 + End If + If Me.PageSize < 1 Then + Me.PageSize = 1 + End If + + ' Retrieve the records and set the table DataSource. + ' Only PageSize records are fetched starting at PageIndex (zero based). + If Me.AddNewRecord > 0 Then + ' Make sure to preserve the previously entered data on new rows. + Dim postdata As New ArrayList + For Each rc As PersonalEducationTableControlRow In Me.GetRecordControls() + If Not rc.IsNewRecord Then + rc.DataSource = rc.GetRecord() + rc.GetUIData() + postdata.Add(rc.DataSource) + UIData.Add(rc.PreservedUIData()) + End If + Next + Me.DataSource = DirectCast(postdata.ToArray(GetType(PersonalEducationRecord)), PersonalEducationRecord()) + Else ' Get the records from the database + Me.DataSource = PersonalEducationTable.GetRecords(joinFilter, wc, orderBy, Me.PageIndex, Me.PageSize) + + End If + + ' if the datasource contains no records contained in database, then load the last page. + If (DbUtils.GetCreatedRecords(Me.DataSource).Length = 0 AndAlso Not Me.DisplayLastPage) Then + Me.DisplayLastPage = True + LoadData() + Else + + ' Add any new rows desired by the user. + Me.AddNewRecords() + + ' Turn off the ToggleAll checkbox + Me.PersonalEducationToggleAll.Checked = False + + + ' Initialize the page and grand totals. now + + End If + + Catch ex As Exception + ' Report the error message to the end user + Dim msg As String = ex.Message + If ex.InnerException IsNot Nothing Then + msg = msg & " InnerException: " & ex.InnerException.Message + End If + Throw New Exception(msg, ex.InnerException) + End Try + End Sub + + + + + Public Overrides Sub DataBind() + ' The DataBind method binds the user interface controls to the values + ' from the database record for each row in the table. To do this, it calls the + ' DataBind for each of the rows. + ' DataBind also populates any filters above the table, and sets the pagination + ' control to the correct number of records and the current page number. + + MyBase.DataBind() + + ' Make sure that the DataSource is initialized. + If Me.DataSource Is Nothing Then + Return + End If + + 'LoadData for DataSource for chart and report if they exist + + ' Improve performance by prefetching display as records. + Me.PreFetchForeignKeyValues() + + ' Setup the pagination controls. + BindPaginationControls() + + + + ' Bind the repeater with the list of records to expand the UI. + Dim rep As System.Web.UI.WebControls.Repeater = CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalEducationTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return + rep.DataSource = DataSource() + rep.DataBind() + + Dim index As Integer = 0 + For Each repItem As System.Web.UI.WebControls.RepeaterItem In rep.Items + ' Loop through all rows in the table, set its DataSource and call DataBind(). + Dim recControl As PersonalEducationTableControlRow = DirectCast(repItem.FindControl("PersonalEducationTableControlRow"), PersonalEducationTableControlRow) + recControl.DataSource = Me.DataSource(index) + If Me.UIData.Count > index Then + recControl.PreviousUIData = Me.UIData(index) + End If + recControl.DataBind() + recControl.Visible = Not Me.InDeletedRecordIds(recControl) + + index += 1 + Next + + + + + ' Call the Set methods for each controls on the panel + + SetCommandDateLabel() + SetCommandLabel() + SetCOUNTRYLabel() + SetCourseAbbrLabel() + SetCourseLabel() + SetCourseNoLabel() + SetEducationPeriodLabel() + SetEducationTypeLabel() + SetEdYearLabel() + SetEndDateLabel() + SetFacultryLabel() + SetInstitueLabel() + SetLevelIdLabel1() + SetNoAllLabel() + + + + + + + + SetPersonalEducationTableControlCollapsibleRegion() + SetPersonalEducationTableControlIcon() + SetPersonalEducationTableControlPanelExtender() + + + SetScoreLabel() + SetScoreNoLabel() + SetStartDateLabel() + ' setting the state of expand or collapse alternative rows + + + ' Load data for each record and table UI control. + ' Ordering is important because child controls get + ' their parent ids from their parent UI controls. + + + ' this method calls the set method for controls with special formula like running total, sum, rank, etc + SetFormulaControls() + End Sub + + Public Overridable Sub SetFormulaControls() + ' this method calls Set methods for the control that has special formula + + + + End Sub + + + Public Sub PreFetchForeignKeyValues() + If (IsNothing(Me.DataSource)) + Return + End If + + Me.Page.PregetDfkaRecords(PersonalEducationTable.COUNTRY, Me.DataSource) + + Me.Page.PregetDfkaRecords(PersonalEducationTable.EducationPeriod, Me.DataSource) + + Me.Page.PregetDfkaRecords(PersonalEducationTable.LevelId, Me.DataSource) + + Me.Page.PregetDfkaRecords(PersonalEducationTable.PersonalId, Me.DataSource) + + End Sub + + + Public Overridable Sub RegisterPostback() + + Me.Page.RegisterPostBackTrigger(MiscUtils.FindControlRecursively(Me,"PersonalEducationSaveButton")) + + + End Sub + + Public EvaluateFormulaDelegate As BaseClasses.Data.DataSource.EvaluateFormulaDelegate = New BaseClasses.Data.DataSource.EvaluateFormulaDelegate(AddressOf Me.EvaluateFormula) + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean, ByVal e as FormulaEvaluator) As String + If e Is Nothing + e = New FormulaEvaluator() + End If + + e.Variables.Clear() + + + ' add variables for formula evaluation + If variables IsNot Nothing Then + Dim enumerator As System.Collections.Generic.IEnumerator(Of System.Collections.Generic.KeyValuePair(Of String, Object)) = variables.GetEnumerator() + While enumerator.MoveNext() + e.Variables.Add(enumerator.Current.Key, enumerator.Current.Value) + End While + End If + + If includeDS + + End If + + ' All variables referred to in the formula are expected to be + ' properties of the DataSource. For example, referring to + ' UnitPrice as a variable will refer to DataSource.UnitPrice + e.DataSource = dataSourceForEvaluate + + ' Define the calling control. This is used to add other + ' related table and record controls as variables. + e.CallingControl = Me + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + + If Not String.IsNullOrEmpty(format) AndAlso (String.IsNullOrEmpty(formula) OrElse formula.IndexOf("Format(") < 0) Then + Return FormulaUtils.Format(resultObj, format) + Else + Return resultObj.ToString() + End If + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format,variables ,includeDS, Nothing) + End Function + + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object)) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format, variables ,True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, format, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal e as FormulaEvaluator) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, variables, True, e) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal includeDS as Boolean) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, includeDS, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, True, Nothing) + End Function + + + + + Public Overridable Sub ResetControl() + + Me.CurrentSortOrder.Reset() + If (Me.InSession(Me, "Order_By")) Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + Me.CurrentSortOrder.Add(PersonalEducationTable.EducationPeriod, OrderByItem.OrderDir.Asc) + + Me.CurrentSortOrder.Add(PersonalEducationTable.StartDate, OrderByItem.OrderDir.Asc) + + End If + + Me.PageIndex = 0 + End Sub + + Protected Overridable Sub BindPaginationControls() + ' Setup the pagination controls. + + ' Bind the pagination labels. + + If DbUtils.GetCreatedRecords(Me.DataSource).Length > 0 Then + + Me.PersonalEducationPagination.CurrentPage.Text = (Me.PageIndex + 1).ToString() + Else + Me.PersonalEducationPagination.CurrentPage.Text = "0" + End If + Me.PersonalEducationPagination.PageSize.Text = Me.PageSize.ToString() + Me.PersonalEducationPagination.TotalItems.Text = Me.TotalRecords.ToString() + Me.PersonalEducationPagination.TotalPages.Text = Me.TotalPages.ToString() + + ' Bind the buttons for PersonalEducationTableControl pagination. + + Me.PersonalEducationPagination.FirstPage.Enabled = Not (Me.PageIndex = 0) + If Me._TotalPages < 0 Then ' if the total pages is not determined yet, enable last and next buttons + Me.PersonalEducationPagination.LastPage.Enabled = True + ElseIf Me._TotalPages = 0 ' if the total pages is determined and it is 0, enable last and next buttons + Me.PersonalEducationPagination.LastPage.Enabled = False + Else ' if the total pages is the last page, disable last and next buttons + Me.PersonalEducationPagination.LastPage.Enabled = Not (Me.PageIndex = Me.TotalPages - 1) + End If + + If Me._TotalPages < 0 Then ' if the total pages is not determined yet, enable last and next buttons + Me.PersonalEducationPagination.NextPage.Enabled = True + ElseIf Me._TotalPages = 0 ' if the total pages is determined and it is 0, enable last and next buttons + Me.PersonalEducationPagination.NextPage.Enabled = False + Else ' if the total pages is the last page, disable last and next buttons + Me.PersonalEducationPagination.NextPage.Enabled = Not (Me.PageIndex = Me.TotalPages - 1) + End If + + Me.PersonalEducationPagination.PreviousPage.Enabled = Not (Me.PageIndex = 0) + + + End Sub + + Public Overridable Sub SaveData() + ' Save the data from the entire table. Calls each row's Save Data + ' to save their data. This function is called by the Click handler of the + ' Save button. The button handler should Start/Commit/End a transaction. + + Dim recCtl As PersonalEducationTableControlRow + For Each recCtl In Me.GetRecordControls() + + If Me.InDeletedRecordIds(recCtl) Then + ' Delete any pending deletes. + recCtl.Delete() + Else + If recCtl.Visible Then + recCtl.SaveData() + End If + End If + + Next + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + ' Set IsNewRecord to False for all records - since everything has been saved and is no longer "new" + For Each recCtl In Me.GetRecordControls() + recCtl.IsNewRecord = False + Next + + + ' Set DeletedRecordsIds to Nothing since we have deleted all pending deletes. + Me.DeletedRecordIds = Nothing + + End Sub + + Public Overridable Function CreateCompoundJoinFilter() As CompoundFilter + Dim jFilter As CompoundFilter = New CompoundFilter() + + Return jFilter + + End Function + + + Public Overridable Function CreateOrderBy() As OrderBy + ' The CurrentSortOrder is initialized to the sort order on the + ' Query Wizard. It may be modified by the Click handler for any of + ' the column heading to sort or reverse sort by that column. + ' You can add your own sort order, or modify it on the Query Wizard. + Return Me.CurrentSortOrder + End Function + + Public Overridable Function CreateWhereClause() As WhereClause + 'This CreateWhereClause is used for loading the data. + PersonalEducationTable.Instance.InnerFilter = Nothing + Dim wc As WhereClause = New WhereClause() + + ' Compose the WHERE clause consiting of: + ' 1. Static clause defined at design time. + ' 2. User selected search criteria. + ' 3. User selected filter criteria. + + + ' Get the static clause defined at design time on the Table Panel Wizard + Dim qc As WhereClause = Me.CreateQueryClause() + If Not(IsNothing(qc)) Then + wc.iAND(qc) + End If + + Return wc + End Function + + + Public Overridable Function CreateWhereClause(ByVal searchText as String, ByVal fromSearchControl as String, ByVal AutoTypeAheadSearch as String, ByVal AutoTypeAheadWordSeparators as String) As WhereClause + ' This CreateWhereClause is used for loading list of suggestions for Auto Type-Ahead feature. + PersonalEducationTable.Instance.InnerFilter = Nothing + Dim wc As WhereClause = New WhereClause() + + ' Compose the WHERE clause consiting of: + ' 1. Static clause defined at design time. + ' 2. User selected search criteria. + ' 3. User selected filter criteria. + + Dim appRelativeVirtualPath As String = CType(HttpContext.Current.Session("AppRelativeVirtualPath"), String) + + ' Get the static clause defined at design time on the Table Panel Wizard + Dim qc As WhereClause = Me.CreateQueryClause() + If Not(IsNothing(qc)) Then + wc.iAND(qc) + End If + + ' Adds clauses if values are selected in Filter controls which are configured in the page. + + + Return wc + End Function + + Protected Overridable Function CreateQueryClause() As WhereClause + ' Create a where clause for the Static clause defined at design time. + Dim filter As CompoundFilter = New CompoundFilter(CompoundFilter.CompoundingOperators.And_Operator, Nothing) + Dim whereClause As WhereClause = New WhereClause() + + filter.AddFilter(New BaseClasses.Data.SignedInUserFilter(BaseClasses.Data.BaseTable.CreateInstance("Persons.Business.PersonalEducationTable, App_Code").TableDefinition.ColumnList.GetByUniqueName("PersonalEducation_.PersonalId"), New BaseClasses.Data.IdentifierAliasInfo("PersonalEducation_", Nothing), BaseClasses.Data.BaseFilter.ComparisonOperator.EqualsTo, False)) + + whereClause.AddFilter(filter, CompoundFilter.CompoundingOperators.And_Operator) + + Return whereClause + + End Function + + + Public Overridable Function FormatSuggestions(ByVal prefixText As String, ByVal resultItem As String, _ + ByVal columnLength As Integer, ByVal AutoTypeAheadDisplayFoundText As String, _ + ByVal autoTypeAheadSearch As String, ByVal AutoTypeAheadWordSeparators As String, _ + ByVal resultList As ArrayList) As Boolean + + 'Formats the resultItem and adds it to the list of suggestions. + Dim index As Integer = resultItem.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture).IndexOf(prefixText.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture)) + Dim itemToAdd As String = "" + Dim isFound As Boolean = False + Dim isAdded As Boolean = False + ' Get the index where prfixt is at the beginning of resultItem. If not found then, index of word which begins with prefixText. + If InvariantLCase(autoTypeAheadSearch).equals("wordsstartingwithsearchstring") And Not index = 0 Then + ' Expression to find word which contains AutoTypeAheadWordSeparators followed by prefixText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex( AutoTypeAheadWordSeparators + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + If regex1.IsMatch(resultItem) Then + index = regex1.Match(resultItem).Index + isFound = True + End If + ' If the prefixText is found immediatly after white space then starting of the word is found so don not search any further + If not resultItem(index).ToString() = " " Then + ' Expression to find beginning of the word which contains AutoTypeAheadWordSeparators followed by prefixText + Dim regex As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\\S*" + AutoTypeAheadWordSeparators + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + If regex.IsMatch(resultItem) Then + index = regex.Match(resultItem).Index + isFound = True + End If + End If + End If + + ' If autoTypeAheadSearch value is wordsstartingwithsearchstring then, extract the substring only if the prefixText is found at the + ' beginning of the resultItem (index = 0) or a word in resultItem is found starts with prefixText. + If index = 0 Or isFound Or InvariantLCase(autoTypeAheadSearch).Equals("anywhereinstring") then + If InvariantLCase(AutoTypeAheadDisplayFoundText).equals("atbeginningofmatchedstring") Then + ' Expression to find beginning of the word which contains prefixText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\\S*" + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + ' Find the beginning of the word which contains prefexText + If (StringUtils.InvariantLCase(autoTypeAheadSearch).Equals("anywhereinstring") AndAlso regex1.IsMatch(resultItem)) Then + index = regex1.Match(resultItem).Index + isFound = True + End If + ' Display string from the index till end of the string if sub string from index till end is less than columnLength value. + If Len(resultItem) - index <= columnLength Then + If index = 0 Then + itemToAdd = resultItem + Else + itemToAdd = "..." & resultItem.Substring(index, Len(resultItem) - index) + End If + Else + If index = 0 Then + itemToAdd = resultItem.Substring(index, (columnLength - 3)) & "..." + Else + 'Truncate the string to show only columnLength - 6 characters as begining and trailing "..." has to be appended. + itemToAdd = "..." & resultItem.Substring(index , columnLength - 6) & "..." + End If + End If + ElseIf InvariantLCase(AutoTypeAheadDisplayFoundText).equals("inmiddleofmatchedstring") Then + Dim subStringBeginIndex As Integer = CType(columnLength/2, Integer) + If Len(resultItem) <= columnLength Then + itemToAdd = resultItem + Else + ' Sanity check at end of the string + If index + Len(prefixText) = columnLength Then + itemToAdd = "..." & resultItem.Substring(index-columnLength,index) + ElseIf Len(resultItem) - index < subStringBeginIndex Then + ' Display string from the end till columnLength value if, index is closer to the end of the string. + itemToAdd = "..." & resultItem.Substring(Len(resultItem)-columnLength,Len(resultItem)) + ElseIf index <= subStringBeginIndex Then + ' Sanity chet at beginning of the string + itemToAdd = resultItem.Substring(0, columnLength) & "..." + Else + ' Display string containing text before the prefixText occures and text after the prefixText + itemToAdd = "..." & resultItem.Substring(index - subStringBeginIndex, columnLength) & "..." + End If + End If + ElseIf InvariantLCase(AutoTypeAheadDisplayFoundText).equals("atendofmatchedstring") Then + ' Expression to find ending of the word which contains prefexText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\s", System.Text.RegularExpressions.RegexOptions.IgnoreCase) + ' Find the ending of the word which contains prefexText + If regex1.IsMatch(resultItem, index + 1) Then + index = regex1.Match(resultItem, index + 1).Index + Else + ' If the word which contains prefexText is the last word in string, regex1.IsMatch returns false. + index = resultItem.Length + End If + If index > Len(resultItem) Then + index = Len(resultItem) + End If + ' If text from beginning of the string till index is less than columnLength value then, display string from the beginning till index. + If index <= columnLength Then + if index = Len(resultItem) Then 'Make decision to append "..." + itemToAdd = resultItem.Substring(0,index) + Else + itemToAdd = resultItem.Substring(0,index) & "..." + End If + Else + If index = Len(resultItem) Then + itemToAdd = "..." & resultItem.Substring(index - (columnLength - 3), (columnLength - 3)) + Else + 'Truncate the string to show only columnLength - 6 characters as begining and trailing "..." has to be appended. + itemToAdd = "..." & resultItem.Substring(index - (columnLength - 6), columnLength - 6) & "..." + End If + End If + End If + + ' Remove newline character from itemToAdd + Dim prefixTextIndex As Integer = itemToAdd.IndexOf(prefixText, StringComparison.CurrentCultureIgnoreCase) + ' If itemToAdd contains any newline after the search text then show text only till newline + Dim regex2 As System.Text.RegularExpressions.Regex = New System.Text.RegularExpressions.Regex("(" & vbCrLf & "|" & vbLf & ")", System.Text.RegularExpressions.RegexOptions.IgnoreCase) + Dim newLineIndexAfterPrefix As Integer = -1 + If regex2.IsMatch(itemToAdd, prefixTextIndex) Then + newLineIndexAfterPrefix = regex2.Match(itemToAdd, prefixTextIndex).Index + End If + If (newLineIndexAfterPrefix > -1) Then + If itemToAdd.EndsWith("...") Then + itemToAdd = (itemToAdd.Substring(0, newLineIndexAfterPrefix) + "...") + Else + itemToAdd = itemToAdd.Substring(0, newLineIndexAfterPrefix) + End If + End If + ' If itemToAdd contains any newline before search text then show text which comes after newline + Dim regex3 As System.Text.RegularExpressions.Regex = New System.Text.RegularExpressions.Regex("(" & vbCrLf & "|" & vbLf & ")", (System.Text.RegularExpressions.RegexOptions.IgnoreCase Or System.Text.RegularExpressions.RegexOptions.RightToLeft)) + Dim newLineIndexBeforePrefix As Integer = -1 + If regex3.IsMatch(itemToAdd, prefixTextIndex) Then + newLineIndexBeforePrefix = regex3.Match(itemToAdd, prefixTextIndex).Index + End If + If (newLineIndexBeforePrefix > -1) Then + If itemToAdd.StartsWith("...") Then + itemToAdd = ("..." + itemToAdd.Substring((newLineIndexBeforePrefix + regex3.Match(itemToAdd, prefixTextIndex).Length))) + Else + itemToAdd = itemToAdd.Substring((newLineIndexBeforePrefix + regex3.Match(itemToAdd, prefixTextIndex).Length)) + End If + End If + + If Not itemToAdd is nothing AndAlso Not resultList.Contains(itemToAdd) Then + + resultList.Add(itemToAdd) + + isAdded = true + End If + End If + Return isAdded + End Function + + + Protected Overridable Sub GetPageSize() + + If Me.PersonalEducationPagination.PageSize.Text.Trim <> "" Then + Try + 'Me.PageSize = Integer.Parse(Me.PersonalEducationPagination.PageSize.Text) + Catch ex As Exception + End Try + End If + End Sub + + Protected Overridable Sub AddNewRecords() + + Dim newRecordList As ArrayList = New ArrayList() + + Dim newUIDataList As System.Collections.Generic.List(Of Hashtable) = New System.Collections.Generic.List(Of Hashtable)() + + ' Loop though all the record controls and if the record control + ' does not have a unique record id set, then create a record + ' and add to the list. + If Not Me.ResetData Then + Dim rep As System.Web.UI.WebControls.Repeater = CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalEducationTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return + + Dim repItem As System.Web.UI.WebControls.RepeaterItem + For Each repItem In rep.Items + ' Loop through all rows in the table, set its DataSource and call DataBind(). + + Dim recControl As PersonalEducationTableControlRow = DirectCast(repItem.FindControl("PersonalEducationTableControlRow"), PersonalEducationTableControlRow) + + If recControl.Visible AndAlso recControl.IsNewRecord() Then + + Dim rec As PersonalEducationRecord = New PersonalEducationRecord() + + If recControl.Command.Text <> "" Then + rec.Parse(recControl.Command.Text, PersonalEducationTable.Command) + End If + If recControl.CommandDate.Text <> "" Then + rec.Parse(recControl.CommandDate.Text, PersonalEducationTable.CommandDate) + End If + If MiscUtils.IsValueSelected(recControl.COUNTRY) Then + rec.Parse(recControl.COUNTRY.SelectedItem.Value, PersonalEducationTable.COUNTRY) + End If + If recControl.Course.Text <> "" Then + rec.Parse(recControl.Course.Text, PersonalEducationTable.Course) + End If + If recControl.CourseAbbr.Text <> "" Then + rec.Parse(recControl.CourseAbbr.Text, PersonalEducationTable.CourseAbbr) + End If + If recControl.CourseNo.Text <> "" Then + rec.Parse(recControl.CourseNo.Text, PersonalEducationTable.CourseNo) + End If + If MiscUtils.IsValueSelected(recControl.EducationPeriod) Then + rec.Parse(recControl.EducationPeriod.SelectedItem.Value, PersonalEducationTable.EducationPeriod) + End If + If MiscUtils.IsValueSelected(recControl.EducationType) Then + rec.Parse(recControl.EducationType.SelectedItem.Value, PersonalEducationTable.EducationType) + End If + If recControl.EdYear.Text <> "" Then + rec.Parse(recControl.EdYear.Text, PersonalEducationTable.EdYear) + End If + If recControl.EndDate.Text <> "" Then + rec.Parse(recControl.EndDate.Text, PersonalEducationTable.EndDate) + End If + If recControl.Facultry.Text <> "" Then + rec.Parse(recControl.Facultry.Text, PersonalEducationTable.Facultry) + End If + If recControl.Institue.Text <> "" Then + rec.Parse(recControl.Institue.Text, PersonalEducationTable.Institue) + End If + If MiscUtils.IsValueSelected(recControl.LevelId) Then + rec.Parse(recControl.LevelId.SelectedItem.Value, PersonalEducationTable.LevelId) + End If + If recControl.NoAll.Text <> "" Then + rec.Parse(recControl.NoAll.Text, PersonalEducationTable.NoAll) + End If + If MiscUtils.IsValueSelected(recControl.PersonalId) Then + rec.Parse(recControl.PersonalId.SelectedItem.Value, PersonalEducationTable.PersonalId) + End If + If recControl.Score.Text <> "" Then + rec.Parse(recControl.Score.Text, PersonalEducationTable.Score) + End If + If recControl.ScoreNo.Text <> "" Then + rec.Parse(recControl.ScoreNo.Text, PersonalEducationTable.ScoreNo) + End If + If recControl.StartDate.Text <> "" Then + rec.Parse(recControl.StartDate.Text, PersonalEducationTable.StartDate) + End If + newUIDataList.Add(recControl.PreservedUIData()) + newRecordList.Add(rec) + End If + Next + End If + + + ' Add any new record to the list. + Dim index As Integer = 0 + For index = 1 To Me.AddNewRecord + + newRecordList.Insert(0, New PersonalEducationRecord()) + newUIDataList.Insert(0, New Hashtable()) + + Next + Me.AddNewRecord = 0 + + ' Finally, add any new records to the DataSource. + If newRecordList.Count > 0 Then + + Dim finalList As ArrayList = New ArrayList(Me.DataSource) + finalList.InsertRange(0, newRecordList) + + Me.DataSource = DirectCast(finalList.ToArray(GetType(PersonalEducationRecord)), PersonalEducationRecord()) + + End If + + ' Add the existing UI data to this hash table + If newUIDataList.Count > 0 Then + Me.UIData.InsertRange(0, newUIDataList) + End If + + End Sub + + + Public Sub AddToDeletedRecordIds(ByVal rec As PersonalEducationTableControlRow) + If rec.IsNewRecord() Then + Return + End If + + If Not Me.DeletedRecordIds Is Nothing AndAlso Me.DeletedRecordIds.Trim <> "" Then + Me.DeletedRecordIds &= "," + End If + + Me.DeletedRecordIds &= "[" & rec.RecordUniqueId & "]" + End Sub + + Protected Overridable Function InDeletedRecordIds(ByVal rec As PersonalEducationTableControlRow) As Boolean + If Me.DeletedRecordIds Is Nothing OrElse Me.DeletedRecordIds.Trim = "" Then + Return False + End If + + Return Me.DeletedRecordIds.IndexOf("[" & rec.RecordUniqueId & "]") >= 0 + End Function + + Private _DeletedRecordIds As String + Public Property DeletedRecordIds() As String + Get + Return Me._DeletedRecordIds + End Get + Set(ByVal value As String) + Me._DeletedRecordIds = value + End Set + End Property + + + ' Create Set, WhereClause, and Populate Methods + + Public Overridable Sub SetCommandDateLabel() + + End Sub + + Public Overridable Sub SetCommandLabel() + + End Sub + + Public Overridable Sub SetCOUNTRYLabel() + + End Sub + + Public Overridable Sub SetCourseAbbrLabel() + + End Sub + + Public Overridable Sub SetCourseLabel() + + End Sub + + Public Overridable Sub SetCourseNoLabel() + + End Sub + + Public Overridable Sub SetEducationPeriodLabel() + + End Sub + + Public Overridable Sub SetEducationTypeLabel() + + End Sub + + Public Overridable Sub SetEdYearLabel() + + End Sub + + Public Overridable Sub SetEndDateLabel() + + End Sub + + Public Overridable Sub SetFacultryLabel() + + End Sub + + Public Overridable Sub SetInstitueLabel() + + End Sub + + Public Overridable Sub SetLevelIdLabel1() + + End Sub + + Public Overridable Sub SetNoAllLabel() + + End Sub + + Public Overridable Sub SetPersonalEducationTableControlCollapsibleRegion() + + End Sub + + Public Overridable Sub SetPersonalEducationTableControlIcon() + + End Sub + + Public Overridable Sub SetPersonalEducationTableControlPanelExtender() + + End Sub + + Public Overridable Sub SetScoreLabel() + + End Sub + + Public Overridable Sub SetScoreNoLabel() + + End Sub + + Public Overridable Sub SetStartDateLabel() + + 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. + Dim added As Boolean = Me.AddNewRecord > 0 + Me.LoadData() + Me.DataBind() + + If added Then + Me.SetFocusToAddedRow() + End If + + End If + + + + Catch ex As Exception + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + Finally + DbUtils.EndTransaction + End Try + End Sub + + 'this function sets focus to the first editable element in the new added row in the editable table + Protected Overridable Sub SetFocusToAddedRow() + Dim rep As System.Web.UI.WebControls.Repeater = CType(Me.FindControl("PersonalEducationTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing OrElse rep.Items.Count = 0 Then Return + Dim repItem As System.Web.UI.WebControls.RepeaterItem + For Each repItem In rep.Items + 'Load scripts to table rows + Me.Page.LoadFocusScripts(repItem) + Dim recControl As PersonalEducationTableControlRow = DirectCast(repItem.FindControl("PersonalEducationTableControlRow"), PersonalEducationTableControlRow) + If recControl.IsNewRecord Then + For Each field As Control In recControl.Controls + If field.Visible AndAlso Me.Page.IsControlEditable(field, False) Then + 'set focus on the first editable field in the new row + field.Focus() + Dim updPan As UpdatePanel = DirectCast(Me.Page.FindControlRecursively("UpdatePanel1"), UpdatePanel) + If Not updPan Is Nothing Then updPan.Update() + Return + End If + Next + Return + End If + Next + End Sub + + + Protected Overrides Sub SaveControlsToSession() + MyBase.SaveControlsToSession() + + ' Save filter controls to values to session. + + + 'Save pagination state to session. + + + + ' Save table control properties to the session. + If Not Me.CurrentSortOrder Is Nothing Then + Me.SaveToSession(Me, "Order_By", Me.CurrentSortOrder.ToXmlString()) + End If + + Me.SaveToSession(Me, "Page_Index", Me.PageIndex.ToString()) + Me.SaveToSession(Me, "Page_Size", Me.PageSize.ToString()) + + Me.SaveToSession(Me, "DeletedRecordIds", Me.DeletedRecordIds) + + End Sub + + Protected Sub SaveControlsToSession_Ajax() + ' Save filter controls to values to session. + + HttpContext.Current.Session("AppRelativeVirtualPath") = Me.Page.AppRelativeVirtualPath + + End Sub + + Protected Overrides Sub ClearControlsFromSession() + MyBase.ClearControlsFromSession() + + ' Clear filter controls values from the session. + + + ' Clear pagination state from session. + + + + ' Clear table properties from the session. + Me.RemoveFromSession(Me, "Order_By") + Me.RemoveFromSession(Me, "Page_Index") + Me.RemoveFromSession(Me, "Page_Size") + + Me.RemoveFromSession(Me, "DeletedRecordIds") + + End Sub + + Protected Overrides Sub LoadViewState(ByVal savedState As Object) + MyBase.LoadViewState(savedState) + + Dim orderByStr As String = CType(ViewState("PersonalEducationTableControl_OrderBy"), String) + + If orderByStr IsNot Nothing AndAlso orderByStr.Trim <> "" Then + Me.CurrentSortOrder = BaseClasses.Data.OrderBy.FromXmlString(orderByStr) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + End If + + Dim pageIndex As String = CType(ViewState("Page_Index"), String) + If pageIndex IsNot Nothing Then + Me.PageIndex = CInt(pageIndex) + End If + + Dim pageSize As String = CType(ViewState("Page_Size"), String) + If Not pageSize Is Nothing Then + Me.PageSize = CInt(pageSize) + End If + + + + ' Load view state for pagination control. + + Me.DeletedRecordIds = CType(Me.ViewState("DeletedRecordIds"), String) + + End Sub + + Protected Overrides Function SaveViewState() As Object + + If Me.CurrentSortOrder IsNot Nothing Then + Me.ViewState("PersonalEducationTableControl_OrderBy") = Me.CurrentSortOrder.ToXmlString() + End If + + Me.ViewState("Page_Index") = Me.PageIndex + Me.ViewState("Page_Size") = Me.PageSize + + Me.ViewState("DeletedRecordIds") = Me.DeletedRecordIds + + + ' Load view state for pagination control. + + + Return MyBase.SaveViewState() + End Function + + ' Generate the event handling functions for pagination events. + + ' event handler for ImageButton + Public Overridable Sub PersonalEducationPagination_FirstPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.PageIndex = 0 + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalEducationPagination_LastPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.DisplayLastPage = True + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalEducationPagination_NextPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.PageIndex += 1 + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for LinkButton + Public Overridable Sub PersonalEducationPagination_PageSizeButton_Click(ByVal sender As Object, ByVal args As EventArgs) + + Try + + Me.DataChanged = True + + Me.PageSize = Integer.Parse(Me.PersonalEducationPagination.PageSize.Text) + + Me.PageIndex = Integer.Parse(Me.PersonalEducationPagination.CurrentPage.Text) - 1 + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalEducationPagination_PreviousPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + If Me.PageIndex > 0 Then + Me.PageIndex -= 1 + Me.DataChanged = True + End If + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + + ' Generate the event handling functions for sorting events. + + Public Overridable Sub CommandDateLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by CommandDate when clicked. + + ' Get previous sorting state for CommandDate. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalEducationTable.CommandDate) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for CommandDate. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalEducationTable.CommandDate, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by CommandDate, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub CommandLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by Command when clicked. + + ' Get previous sorting state for Command. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalEducationTable.Command) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for Command. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalEducationTable.Command, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by Command, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub COUNTRYLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by COUNTRY when clicked. + + ' Get previous sorting state for COUNTRY. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalEducationTable.COUNTRY) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for COUNTRY. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalEducationTable.COUNTRY, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by COUNTRY, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub CourseAbbrLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by CourseAbbr when clicked. + + ' Get previous sorting state for CourseAbbr. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalEducationTable.CourseAbbr) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for CourseAbbr. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalEducationTable.CourseAbbr, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by CourseAbbr, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub CourseLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by Course when clicked. + + ' Get previous sorting state for Course. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalEducationTable.Course) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for Course. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalEducationTable.Course, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by Course, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub CourseNoLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by CourseNo when clicked. + + ' Get previous sorting state for CourseNo. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalEducationTable.CourseNo) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for CourseNo. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalEducationTable.CourseNo, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by CourseNo, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub EducationPeriodLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by EducationPeriod when clicked. + + ' Get previous sorting state for EducationPeriod. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalEducationTable.EducationPeriod) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for EducationPeriod. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalEducationTable.EducationPeriod, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by EducationPeriod, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub EducationTypeLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by EducationType when clicked. + + ' Get previous sorting state for EducationType. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalEducationTable.EducationType) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for EducationType. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalEducationTable.EducationType, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by EducationType, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub EdYearLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by EdYear when clicked. + + ' Get previous sorting state for EdYear. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalEducationTable.EdYear) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for EdYear. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalEducationTable.EdYear, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by EdYear, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub EndDateLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by EndDate when clicked. + + ' Get previous sorting state for EndDate. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalEducationTable.EndDate) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for EndDate. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalEducationTable.EndDate, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by EndDate, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub FacultryLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by Facultry when clicked. + + ' Get previous sorting state for Facultry. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalEducationTable.Facultry) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for Facultry. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalEducationTable.Facultry, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by Facultry, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub InstitueLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by Institue when clicked. + + ' Get previous sorting state for Institue. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalEducationTable.Institue) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for Institue. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalEducationTable.Institue, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by Institue, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub LevelIdLabel1_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by LevelId when clicked. + + ' Get previous sorting state for LevelId. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalEducationTable.LevelId) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for LevelId. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalEducationTable.LevelId, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by LevelId, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub NoAllLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by NoAll when clicked. + + ' Get previous sorting state for NoAll. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalEducationTable.NoAll) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for NoAll. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalEducationTable.NoAll, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by NoAll, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub ScoreLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by Score when clicked. + + ' Get previous sorting state for Score. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalEducationTable.Score) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for Score. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalEducationTable.Score, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by Score, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub ScoreNoLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by ScoreNo when clicked. + + ' Get previous sorting state for ScoreNo. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalEducationTable.ScoreNo) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for ScoreNo. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalEducationTable.ScoreNo, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by ScoreNo, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub StartDateLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by StartDate when clicked. + + ' Get previous sorting state for StartDate. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalEducationTable.StartDate) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for StartDate. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalEducationTable.StartDate, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by StartDate, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + + ' Generate the event handling functions for button events. + + ' event handler for ImageButton + Public Overridable Sub PersonalEducationAddButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + Me.AddNewRecord = 1 + Me.DataChanged = True + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalEducationDeleteButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + If(Not Me.Page.IsPageRefresh) Then + + Me.DeleteSelectedRecords(True) + Me.SetFormulaControls() + + + End If + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalEducationEditButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + ' The redirect URL is set on the Properties, Custom Properties or Actions. + ' The ModifyRedirectURL call resolves the parameters before the + ' Response.Redirect redirects the page to the URL. + ' Any code after the Response.Redirect call will not be executed, since the page is + ' redirected to the URL. + + + Dim url As String = "../PersonalEducation/EditPersonalEducation.aspx?PersonalEducation={PK}" + + Dim shouldRedirect As Boolean = True + Dim TargetKey As String = Nothing + Dim DFKA As String = TargetKey + Dim id As String = DFKA + Dim value As String = id + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + url = Me.ModifyRedirectUrl(url, "",False) + url = Me.Page.ModifyRedirectUrl(url, "",False) + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + shouldRedirect = False + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + If shouldRedirect Then + Me.Page.ShouldSaveControlsToSession = True + Me.Page.Response.Redirect(url) + ElseIf Not TargetKey Is Nothing AndAlso _ + Not shouldRedirect Then + Me.Page.ShouldSaveControlsToSession = True + Me.Page.CloseWindow(True) + + End If + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalEducationRefreshButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Dim PersonalEducationTableControlObj as PersonalEducationTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalEducationTableControl"), PersonalEducationTableControl) + PersonalEducationTableControlObj.ResetData = True + + PersonalEducationTableControlObj.RemoveFromSession(PersonalEducationTableControlObj, "DeletedRecordIds") + PersonalEducationTableControlObj.DeletedRecordIds = Nothing + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalEducationResetButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.CurrentSortOrder.Reset() + If Me.InSession(Me, "Order_By") Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + Me.CurrentSortOrder.Add(PersonalEducationTable.EducationPeriod, OrderByItem.OrderDir.Asc) + + Me.CurrentSortOrder.Add(PersonalEducationTable.StartDate, OrderByItem.OrderDir.Asc) + + + End If + + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalEducationSaveButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + + If (Not Me.Page.IsPageRefresh) Then + Me.SaveData() + End If + + Me.Page.CommitTransaction(sender) + ' Set IsNewRecord to False for all records - since everything has been saved and is no longer "new" + Dim recCtl As PersonalEducationTableControlRow + For Each recCtl in Me.GetRecordControls() + + recCtl.IsNewRecord = False + Next + + + ' Set DeletedRecordsIds to Nothing since we have deleted all pending deletes. + + Me.DeletedRecordIds = Nothing + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + + + ' Generate the event handling functions for filter and search events. + + + ' Generate the event handling functions for others + + + Private _UIData As New System.Collections.Generic.List(Of Hashtable) + Public Property UIData() As System.Collections.Generic.List(Of Hashtable) + Get + Return Me._UIData + End Get + Set(ByVal value As System.Collections.Generic.List(Of Hashtable)) + Me._UIData = value + End Set + End Property + + ' pagination properties + Protected _PageSize As Integer + Public Property PageSize() As Integer + Get + Return Me._PageSize + End Get + Set(ByVal value As Integer) + Me._PageSize = value + End Set + End Property + + Protected _PageIndex As Integer + Public Property PageIndex() As Integer + Get + ' Return the PageIndex + Return Me._PageIndex + End Get + Set(ByVal value As Integer) + Me._PageIndex = value + End Set + End Property + + Protected _TotalRecords As Integer = -1 + Public Property TotalRecords() As Integer + Get + If _TotalRecords < 0 + _TotalRecords = PersonalEducationTable.GetRecordCount(CreateCompoundJoinFilter(), CreateWhereClause()) + End If + Return Me._TotalRecords + End Get + Set(ByVal value As Integer) + If Me.PageSize > 0 Then + + Me.TotalPages = CInt(Math.Ceiling(value / Me.PageSize)) + + End If + Me._TotalRecords = value + End Set + End Property + + + + Protected _TotalPages As Integer = -1 + Public Property TotalPages() As Integer + Get + If _TotalPages < 0 Then + + Me.TotalPages = CInt(Math.Ceiling(TotalRecords / Me.PageSize)) + + End If + Return Me._TotalPages + End Get + Set(ByVal value As Integer) + Me._TotalPages = value + End Set + End Property + + Protected _DisplayLastPage As Boolean + Public Property DisplayLastPage() As Boolean + Get + Return Me._DisplayLastPage + End Get + Set(ByVal value As Boolean) + Me._DisplayLastPage = value + End Set + End Property + + Private _DataChanged As Boolean = False + Public Property DataChanged() As Boolean + Get + Return Me._DataChanged + End Get + Set(ByVal value As Boolean) + Me._DataChanged = value + End Set + End Property + + Private _ResetData As Boolean = False + Public Property ResetData() As Boolean + Get + Return Me._ResetData + End Get + Set(ByVal value As Boolean) + Me._ResetData = value + End Set + End Property + + Private _AddNewRecord As Integer = 0 + Public Property AddNewRecord() As Integer + Get + Return Me._AddNewRecord + End Get + Set(ByVal value As Integer) + Me._AddNewRecord = value + End Set + End Property + + + Private _CurrentSortOrder As OrderBy = Nothing + Public Property CurrentSortOrder() As OrderBy + Get + Return Me._CurrentSortOrder + End Get + Set(ByVal value As BaseClasses.Data.OrderBy) + Me._CurrentSortOrder = value + End Set + End Property + + Private _DataSource() As PersonalEducationRecord = Nothing + Public Property DataSource() As PersonalEducationRecord () + Get + Return Me._DataSource + End Get + Set(ByVal value() As PersonalEducationRecord) + Me._DataSource = value + End Set + End Property + +#Region "Helper Properties" + + Public ReadOnly Property CommandDateLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "CommandDateLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property CommandLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "CommandLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property COUNTRYLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "COUNTRYLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property CourseAbbrLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "CourseAbbrLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property CourseLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "CourseLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property CourseNoLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "CourseNoLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property EducationPeriodLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "EducationPeriodLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property EducationTypeLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "EducationTypeLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property EdYearLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "EdYearLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property EndDateLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "EndDateLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property FacultryLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "FacultryLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property InstitueLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "InstitueLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property LevelIdLabel1() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "LevelIdLabel1"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property NoAllLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "NoAllLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property PersonalEducationAddButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalEducationAddButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalEducationDeleteButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalEducationDeleteButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalEducationEditButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalEducationEditButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalEducationPagination() As Persons.UI.IPagination + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalEducationPagination"), Persons.UI.IPagination) + End Get + End Property + + Public ReadOnly Property PersonalEducationRefreshButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalEducationRefreshButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalEducationResetButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalEducationResetButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalEducationSaveButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalEducationSaveButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalEducationTableControlCollapsibleRegion() As System.Web.UI.WebControls.Panel + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalEducationTableControlCollapsibleRegion"), System.Web.UI.WebControls.Panel) + End Get + End Property + + Public ReadOnly Property PersonalEducationTableControlIcon() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalEducationTableControlIcon"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalEducationTableControlPanelExtender() As AjaxControlToolkit.CollapsiblePanelExtender + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalEducationTableControlPanelExtender"), AjaxControlToolkit.CollapsiblePanelExtender) + End Get + End Property + + Public ReadOnly Property PersonalEducationTitle() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalEducationTitle"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property PersonalEducationToggleAll() As System.Web.UI.WebControls.CheckBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalEducationToggleAll"), System.Web.UI.WebControls.CheckBox) + End Get + End Property + + Public ReadOnly Property ScoreLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "ScoreLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property ScoreNoLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "ScoreNoLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property StartDateLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "StartDateLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + +#End Region + +#Region "Helper Functions" + + Public Overrides Overloads Function ModifyRedirectUrl(url As String, arg As String, ByVal bEncrypt As Boolean) As String + Return Me.Page.EvaluateExpressions(url, arg, bEncrypt, Me) + End Function + + Public Overrides Overloads Function EvaluateExpressions(url As String, arg As String, ByVal bEncrypt As Boolean) As String + Dim needToProcess As Boolean = AreAnyUrlParametersForMe(url, arg) + If (needToProcess) Then + Dim recCtl As PersonalEducationTableControlRow = Me.GetSelectedRecordControl() + If recCtl Is Nothing AndAlso url.IndexOf("{") >= 0 Then + ' Localization. + Throw New Exception(Page.GetResourceValue("Err:NoRecSelected", "Persons")) + End If + Dim rec As PersonalEducationRecord = Nothing + If recCtl IsNot Nothing Then + rec = recCtl.GetRecord() + End If + Return EvaluateExpressions(url, arg, rec, bEncrypt) + End If + Return url + End Function + + Public Overridable Function GetSelectedRecordIndex() As Integer + Dim counter As Integer = 0 + Dim recControl As PersonalEducationTableControlRow + For Each recControl In Me.GetRecordControls() + If recControl.PersonalEducationRecordRowSelection.Checked Then + Return counter + End If + counter += 1 + Next + Return -1 + End Function + + Public Overridable Function GetSelectedRecordControl() As PersonalEducationTableControlRow + Dim selectedList() As PersonalEducationTableControlRow = Me.GetSelectedRecordControls() + If selectedList.Length = 0 Then + Return Nothing + End If + Return selectedList(0) + + End Function + + Public Overridable Function GetSelectedRecordControls() As PersonalEducationTableControlRow() + + Dim selectedList As ArrayList = New ArrayList(25) + Dim recControl As PersonalEducationTableControlRow + For Each recControl In Me.GetRecordControls() + If recControl.PersonalEducationRecordRowSelection IsNot Nothing AndAlso recControl.PersonalEducationRecordRowSelection.Checked Then + selectedList.Add(recControl) + End If + Next + Return DirectCast(selectedList.ToArray(GetType(PersonalEducationTableControlRow)), PersonalEducationTableControlRow()) + + End Function + + Public Overridable Sub DeleteSelectedRecords(ByVal deferDeletion As Boolean) + Dim recList() As PersonalEducationTableControlRow = Me.GetSelectedRecordControls() + If recList.Length = 0 Then + ' Localization. + Throw New Exception(Page.GetResourceValue("Err:NoRecSelected", "Persons")) + End If + + Dim recCtl As PersonalEducationTableControlRow + For Each recCtl In recList + If deferDeletion Then + If Not recCtl.IsNewRecord Then + + Me.AddToDeletedRecordIds(recCtl) + + End If + recCtl.Visible = False + + recCtl.PersonalEducationRecordRowSelection.Checked = False + + Else + + recCtl.Delete() + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + End If + Next + End Sub + + Public Function GetRecordControls() As PersonalEducationTableControlRow() + Dim recList As ArrayList = New ArrayList() + Dim rep As System.Web.UI.WebControls.Repeater = CType(Me.FindControl("PersonalEducationTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return Nothing + Dim repItem As System.Web.UI.WebControls.RepeaterItem + + For Each repItem In rep.Items + + Dim recControl As PersonalEducationTableControlRow = DirectCast(repItem.FindControl("PersonalEducationTableControlRow"), PersonalEducationTableControlRow) + recList.Add(recControl) + + Next + + Return DirectCast(recList.ToArray(GetType(PersonalEducationTableControlRow)), PersonalEducationTableControlRow()) + End Function + + Public Shadows ReadOnly Property Page() As BaseApplicationPage + Get + Return DirectCast(MyBase.Page, BaseApplicationPage) + End Get + End Property + +#End Region + + + +End Class + + + +#End Region + + +End Namespace + + \ No newline at end of file diff --git a/App_Code/PersonalEducation/ShowPersonalEducation.Controls.vb b/App_Code/PersonalEducation/ShowPersonalEducation.Controls.vb new file mode 100644 index 0000000..6697dea --- /dev/null +++ b/App_Code/PersonalEducation/ShowPersonalEducation.Controls.vb @@ -0,0 +1,2233 @@ + +' This file implements the TableControl, TableControlRow, and RecordControl classes for the +' ShowPersonalEducation.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.ShowPersonalEducation + +#Region "Section 1: Place your customizations here." + + +Public Class PersonalEducationRecordControl + Inherits BasePersonalEducationRecordControl + ' The BasePersonalEducationRecordControl 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 PersonalEducationRecordControl control on the ShowPersonalEducation page. +' Do not modify this class. Instead override any method in PersonalEducationRecordControl. +Public Class BasePersonalEducationRecordControl + Inherits Persons.UI.BaseApplicationRecordControl + + ' To customize, override this method in PersonalEducationRecordControl. + 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 PersonalEducationRecordControl. + 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.PersonalEducationDialogEditButton.Click, AddressOf PersonalEducationDialogEditButton_Click + + AddHandler Me.PersonalId.Click, AddressOf PersonalId_Click + + + End Sub + + + Public Overridable Sub LoadData() + + ' Load the data from the database into the DataSource PersonalEducation record. + ' It is better to make changes to functions called by LoadData such as + ' CreateWhereClause, rather than making changes here. + + ' The RecordUniqueId is set the first time a record is loaded, and is + ' used during a PostBack to load the record. + + If Me.RecordUniqueId IsNot Nothing AndAlso Me.RecordUniqueId.Trim <> "" Then + Me.DataSource = PersonalEducationTable.GetRecord(Me.RecordUniqueId, True) + + Return + End If + + ' 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, "PersonalEducationRecordControlPanel"), 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 PersonalEducationRecord() + + 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 PersonalEducationRecord = PersonalEducationTable.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 = PersonalEducationTable.GetRecord(recList(0).GetID.ToXmlString(), True) + + + + End Sub + + ' Populate the UI controls using the DataSource. To customize, override this method in PersonalEducationRecordControl. + Public Overrides Sub DataBind() + ' The DataBind method binds the user interface controls to the values + ' from the database record. To do this, it calls the Set methods for + ' each of the field displayed on the webpage. It is better to make + ' changes in the Set methods, rather than making changes here. + + MyBase.DataBind() + + ' Make sure that the DataSource is initialized. + If Me.DataSource Is Nothing Then + + Return + End If + + + 'LoadData for DataSource for chart and report if they exist + + + + ' Call the Set methods for each controls on the panel + + SetCommand() + SetCommandDate() + SetCommandDateLabel() + SetCommandLabel() + SetCOUNTRY() + SetCOUNTRYLabel() + SetCourse() + SetCourseAbbr() + SetCourseAbbrLabel() + SetCourseLabel() + SetCourseNo() + SetCourseNoLabel() + SetEducationPeriod() + SetEducationPeriodLabel() + SetEducationType() + SetEducationTypeLabel() + SetEdYear() + SetEdYearLabel() + SetEndDate() + SetEndDateLabel() + SetFacultry() + SetFacultryLabel() + SetInstitue() + SetInstitueLabel() + SetLevelId() + SetLevelIdLabel() + SetNoAll() + SetNoAllLabel() + + SetPersonalEducationRecordControlCollapsibleRegion() + SetPersonalEducationRecordControlIcon() + SetPersonalEducationRecordControlPanelExtender() + + SetPersonalId() + SetPersonalIdLabel() + SetScore() + SetScoreLabel() + SetScoreNo() + SetScoreNoLabel() + SetStartDate() + SetStartDateLabel() + + + Me.IsNewRecord = True + + If Me.DataSource.IsCreated Then + Me.IsNewRecord = False + + Me.RecordUniqueId = Me.DataSource.GetID.ToXmlString() + End If + + ' Now load data for each record and table child UI controls. + ' Ordering is important because child controls get + ' their parent ids from their parent UI controls. + Dim shouldResetControl As Boolean = False + + End Sub + + + Public Overridable Sub SetCommand() + + + ' Set the Command Literal on the webpage with value from the + ' PersonalEducation database record. + + ' Me.DataSource is the PersonalEducation record retrieved from the database. + ' Me.Command is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetCommand() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.CommandSpecified Then + + ' If the Command is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalEducationTable.Command) + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.Command.Text = formattedValue + + Else + + ' Command is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.Command.Text = PersonalEducationTable.Command.Format(PersonalEducationTable.Command.DefaultValue) + + End If + + ' If the Command is NULL or blank, then use the value specified + ' on Properties. + If Me.Command.Text Is Nothing _ + OrElse Me.Command.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.Command.Text = " " + End If + + End Sub + + Public Overridable Sub SetCommandDate() + + + ' Set the CommandDate Literal on the webpage with value from the + ' PersonalEducation database record. + + ' Me.DataSource is the PersonalEducation record retrieved from the database. + ' Me.CommandDate is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetCommandDate() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.CommandDateSpecified Then + + ' If the CommandDate is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalEducationTable.CommandDate, "d MMM yy") + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.CommandDate.Text = formattedValue + + Else + + ' CommandDate is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.CommandDate.Text = PersonalEducationTable.CommandDate.Format(PersonalEducationTable.CommandDate.DefaultValue, "d MMM yy") + + End If + + ' If the CommandDate is NULL or blank, then use the value specified + ' on Properties. + If Me.CommandDate.Text Is Nothing _ + OrElse Me.CommandDate.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.CommandDate.Text = " " + End If + + End Sub + + Public Overridable Sub SetCOUNTRY() + + + ' Set the COUNTRY Literal on the webpage with value from the + ' PersonalEducation database record. + + ' Me.DataSource is the PersonalEducation record retrieved from the database. + ' Me.COUNTRY is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetCOUNTRY() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.COUNTRYSpecified Then + + ' If the COUNTRY is non-NULL, then format the value. + + ' The Format method will return the Display Foreign Key As (DFKA) value + Dim formattedValue As String = "" + Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalEducationTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalEducationTable.COUNTRY) + If _isExpandableNonCompositeForeignKey AndAlso PersonalEducationTable.COUNTRY.IsApplyDisplayAs Then + + formattedValue = PersonalEducationTable.GetDFKA(Me.DataSource.COUNTRY.ToString(),PersonalEducationTable.COUNTRY, Nothing) + + if (formattedValue Is Nothing) Then + formattedValue = Me.DataSource.Format(PersonalEducationTable.COUNTRY) + End If + Else + formattedValue = Me.DataSource.COUNTRY.ToString() + End If + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.COUNTRY.Text = formattedValue + + Else + + ' COUNTRY is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.COUNTRY.Text = PersonalEducationTable.COUNTRY.Format(PersonalEducationTable.COUNTRY.DefaultValue) + + End If + + ' If the COUNTRY is NULL or blank, then use the value specified + ' on Properties. + If Me.COUNTRY.Text Is Nothing _ + OrElse Me.COUNTRY.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.COUNTRY.Text = " " + End If + + End Sub + + Public Overridable Sub SetCourse() + + + ' Set the Course Literal on the webpage with value from the + ' PersonalEducation database record. + + ' Me.DataSource is the PersonalEducation record retrieved from the database. + ' Me.Course is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetCourse() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.CourseSpecified Then + + ' If the Course is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalEducationTable.Course) + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.Course.Text = formattedValue + + Else + + ' Course is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.Course.Text = PersonalEducationTable.Course.Format(PersonalEducationTable.Course.DefaultValue) + + End If + + ' If the Course is NULL or blank, then use the value specified + ' on Properties. + If Me.Course.Text Is Nothing _ + OrElse Me.Course.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.Course.Text = " " + End If + + End Sub + + Public Overridable Sub SetCourseAbbr() + + + ' Set the CourseAbbr Literal on the webpage with value from the + ' PersonalEducation database record. + + ' Me.DataSource is the PersonalEducation record retrieved from the database. + ' Me.CourseAbbr is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetCourseAbbr() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.CourseAbbrSpecified Then + + ' If the CourseAbbr is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalEducationTable.CourseAbbr) + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.CourseAbbr.Text = formattedValue + + Else + + ' CourseAbbr is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.CourseAbbr.Text = PersonalEducationTable.CourseAbbr.Format(PersonalEducationTable.CourseAbbr.DefaultValue) + + End If + + ' If the CourseAbbr is NULL or blank, then use the value specified + ' on Properties. + If Me.CourseAbbr.Text Is Nothing _ + OrElse Me.CourseAbbr.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.CourseAbbr.Text = " " + End If + + End Sub + + Public Overridable Sub SetCourseNo() + + + ' Set the CourseNo Literal on the webpage with value from the + ' PersonalEducation database record. + + ' Me.DataSource is the PersonalEducation record retrieved from the database. + ' Me.CourseNo is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetCourseNo() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.CourseNoSpecified Then + + ' If the CourseNo is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalEducationTable.CourseNo) + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.CourseNo.Text = formattedValue + + Else + + ' CourseNo is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.CourseNo.Text = PersonalEducationTable.CourseNo.Format(PersonalEducationTable.CourseNo.DefaultValue) + + End If + + ' If the CourseNo is NULL or blank, then use the value specified + ' on Properties. + If Me.CourseNo.Text Is Nothing _ + OrElse Me.CourseNo.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.CourseNo.Text = " " + End If + + End Sub + + Public Overridable Sub SetEducationPeriod() + + + ' Set the EducationPeriod Literal on the webpage with value from the + ' PersonalEducation database record. + + ' Me.DataSource is the PersonalEducation record retrieved from the database. + ' Me.EducationPeriod is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetEducationPeriod() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.EducationPeriodSpecified Then + + ' If the EducationPeriod is non-NULL, then format the value. + + ' The Format method will return the Display Foreign Key As (DFKA) value + Dim formattedValue As String = "" + Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalEducationTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalEducationTable.EducationPeriod) + If _isExpandableNonCompositeForeignKey AndAlso PersonalEducationTable.EducationPeriod.IsApplyDisplayAs Then + + formattedValue = PersonalEducationTable.GetDFKA(Me.DataSource.EducationPeriod.ToString(),PersonalEducationTable.EducationPeriod, Nothing) + + if (formattedValue Is Nothing) Then + formattedValue = Me.DataSource.Format(PersonalEducationTable.EducationPeriod) + End If + Else + formattedValue = Me.DataSource.EducationPeriod.ToString() + End If + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.EducationPeriod.Text = formattedValue + + Else + + ' EducationPeriod is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.EducationPeriod.Text = PersonalEducationTable.EducationPeriod.Format(PersonalEducationTable.EducationPeriod.DefaultValue) + + End If + + ' If the EducationPeriod is NULL or blank, then use the value specified + ' on Properties. + If Me.EducationPeriod.Text Is Nothing _ + OrElse Me.EducationPeriod.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.EducationPeriod.Text = " " + End If + + End Sub + + Public Overridable Sub SetEducationType() + + + ' Set the EducationType Literal on the webpage with value from the + ' PersonalEducation database record. + + ' Me.DataSource is the PersonalEducation record retrieved from the database. + ' Me.EducationType is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetEducationType() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.EducationTypeSpecified Then + + ' If the EducationType is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalEducationTable.EducationType) + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.EducationType.Text = formattedValue + + Else + + ' EducationType is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.EducationType.Text = PersonalEducationTable.EducationType.Format(PersonalEducationTable.EducationType.DefaultValue) + + End If + + ' If the EducationType is NULL or blank, then use the value specified + ' on Properties. + If Me.EducationType.Text Is Nothing _ + OrElse Me.EducationType.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.EducationType.Text = " " + End If + + End Sub + + Public Overridable Sub SetEdYear() + + + ' Set the EdYear Literal on the webpage with value from the + ' PersonalEducation database record. + + ' Me.DataSource is the PersonalEducation record retrieved from the database. + ' Me.EdYear is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetEdYear() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.EdYearSpecified Then + + ' If the EdYear is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalEducationTable.EdYear) + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.EdYear.Text = formattedValue + + Else + + ' EdYear is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.EdYear.Text = PersonalEducationTable.EdYear.Format(PersonalEducationTable.EdYear.DefaultValue) + + End If + + ' If the EdYear is NULL or blank, then use the value specified + ' on Properties. + If Me.EdYear.Text Is Nothing _ + OrElse Me.EdYear.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.EdYear.Text = " " + End If + + End Sub + + Public Overridable Sub SetEndDate() + + + ' Set the EndDate Literal on the webpage with value from the + ' PersonalEducation database record. + + ' Me.DataSource is the PersonalEducation record retrieved from the database. + ' Me.EndDate is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetEndDate() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.EndDateSpecified Then + + ' If the EndDate is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalEducationTable.EndDate, "d MMM yy") + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.EndDate.Text = formattedValue + + Else + + ' EndDate is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.EndDate.Text = PersonalEducationTable.EndDate.Format(PersonalEducationTable.EndDate.DefaultValue, "d MMM yy") + + End If + + ' If the EndDate is NULL or blank, then use the value specified + ' on Properties. + If Me.EndDate.Text Is Nothing _ + OrElse Me.EndDate.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.EndDate.Text = " " + End If + + End Sub + + Public Overridable Sub SetFacultry() + + + ' Set the Facultry Literal on the webpage with value from the + ' PersonalEducation database record. + + ' Me.DataSource is the PersonalEducation record retrieved from the database. + ' Me.Facultry is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetFacultry() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.FacultrySpecified Then + + ' If the Facultry is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalEducationTable.Facultry) + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.Facultry.Text = formattedValue + + Else + + ' Facultry is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.Facultry.Text = PersonalEducationTable.Facultry.Format(PersonalEducationTable.Facultry.DefaultValue) + + End If + + ' If the Facultry is NULL or blank, then use the value specified + ' on Properties. + If Me.Facultry.Text Is Nothing _ + OrElse Me.Facultry.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.Facultry.Text = " " + End If + + End Sub + + Public Overridable Sub SetInstitue() + + + ' Set the Institue Literal on the webpage with value from the + ' PersonalEducation database record. + + ' Me.DataSource is the PersonalEducation record retrieved from the database. + ' Me.Institue is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetInstitue() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.InstitueSpecified Then + + ' If the Institue is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalEducationTable.Institue) + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.Institue.Text = formattedValue + + Else + + ' Institue is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.Institue.Text = PersonalEducationTable.Institue.Format(PersonalEducationTable.Institue.DefaultValue) + + End If + + ' If the Institue is NULL or blank, then use the value specified + ' on Properties. + If Me.Institue.Text Is Nothing _ + OrElse Me.Institue.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.Institue.Text = " " + End If + + End Sub + + Public Overridable Sub SetLevelId() + + + ' Set the LevelId Literal on the webpage with value from the + ' PersonalEducation database record. + + ' Me.DataSource is the PersonalEducation record retrieved from the database. + ' Me.LevelId is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetLevelId() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.LevelIdSpecified Then + + ' If the LevelId is non-NULL, then format the value. + + ' The Format method will return the Display Foreign Key As (DFKA) value + Dim formattedValue As String = "" + Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalEducationTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalEducationTable.LevelId) + If _isExpandableNonCompositeForeignKey AndAlso PersonalEducationTable.LevelId.IsApplyDisplayAs Then + + formattedValue = PersonalEducationTable.GetDFKA(Me.DataSource.LevelId.ToString(),PersonalEducationTable.LevelId, Nothing) + + if (formattedValue Is Nothing) Then + formattedValue = Me.DataSource.Format(PersonalEducationTable.LevelId) + End If + Else + formattedValue = Me.DataSource.LevelId.ToString() + End If + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.LevelId.Text = formattedValue + + Else + + ' LevelId is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.LevelId.Text = PersonalEducationTable.LevelId.Format(PersonalEducationTable.LevelId.DefaultValue) + + End If + + ' If the LevelId is NULL or blank, then use the value specified + ' on Properties. + If Me.LevelId.Text Is Nothing _ + OrElse Me.LevelId.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.LevelId.Text = " " + End If + + End Sub + + Public Overridable Sub SetNoAll() + + + ' Set the NoAll Literal on the webpage with value from the + ' PersonalEducation database record. + + ' Me.DataSource is the PersonalEducation record retrieved from the database. + ' Me.NoAll is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetNoAll() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.NoAllSpecified Then + + ' If the NoAll is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalEducationTable.NoAll) + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.NoAll.Text = formattedValue + + Else + + ' NoAll is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.NoAll.Text = PersonalEducationTable.NoAll.Format(PersonalEducationTable.NoAll.DefaultValue) + + End If + + ' If the NoAll is NULL or blank, then use the value specified + ' on Properties. + If Me.NoAll.Text Is Nothing _ + OrElse Me.NoAll.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.NoAll.Text = " " + End If + + End Sub + + Public Overridable Sub SetPersonalId() + + + ' Set the PersonalId LinkButton on the webpage with value from the + ' PersonalEducation database record. + + ' Me.DataSource is the PersonalEducation record retrieved from the database. + ' Me.PersonalId is the ASP:LinkButton on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetPersonalId() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.PersonalIdSpecified Then + + ' If the PersonalId is non-NULL, then format the value. + + ' The Format method will return the Display Foreign Key As (DFKA) value + Dim formattedValue As String = "" + Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalEducationTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalEducationTable.PersonalId) + If _isExpandableNonCompositeForeignKey AndAlso PersonalEducationTable.PersonalId.IsApplyDisplayAs Then + + formattedValue = PersonalEducationTable.GetDFKA(Me.DataSource.PersonalId.ToString(),PersonalEducationTable.PersonalId, Nothing) + + if (formattedValue Is Nothing) Then + formattedValue = Me.DataSource.Format(PersonalEducationTable.PersonalId) + End If + Else + formattedValue = Me.DataSource.PersonalId.ToString() + End If + + Me.PersonalId.Text = formattedValue + + Me.PersonalId.ToolTip = "Go to " & Me.PersonalId.Text.Replace("", "") + + Else + + ' PersonalId is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.PersonalId.Text = PersonalEducationTable.PersonalId.Format(PersonalEducationTable.PersonalId.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetScore() + + + ' Set the Score Literal on the webpage with value from the + ' PersonalEducation database record. + + ' Me.DataSource is the PersonalEducation record retrieved from the database. + ' Me.Score is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetScore() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.ScoreSpecified Then + + ' If the Score is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalEducationTable.Score) + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.Score.Text = formattedValue + + Else + + ' Score is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.Score.Text = PersonalEducationTable.Score.Format(PersonalEducationTable.Score.DefaultValue) + + End If + + ' If the Score is NULL or blank, then use the value specified + ' on Properties. + If Me.Score.Text Is Nothing _ + OrElse Me.Score.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.Score.Text = " " + End If + + End Sub + + Public Overridable Sub SetScoreNo() + + + ' Set the ScoreNo Literal on the webpage with value from the + ' PersonalEducation database record. + + ' Me.DataSource is the PersonalEducation record retrieved from the database. + ' Me.ScoreNo is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetScoreNo() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.ScoreNoSpecified Then + + ' If the ScoreNo is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalEducationTable.ScoreNo) + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.ScoreNo.Text = formattedValue + + Else + + ' ScoreNo is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.ScoreNo.Text = PersonalEducationTable.ScoreNo.Format(PersonalEducationTable.ScoreNo.DefaultValue) + + End If + + ' If the ScoreNo is NULL or blank, then use the value specified + ' on Properties. + If Me.ScoreNo.Text Is Nothing _ + OrElse Me.ScoreNo.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.ScoreNo.Text = " " + End If + + End Sub + + Public Overridable Sub SetStartDate() + + + ' Set the StartDate Literal on the webpage with value from the + ' PersonalEducation database record. + + ' Me.DataSource is the PersonalEducation record retrieved from the database. + ' Me.StartDate is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetStartDate() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.StartDateSpecified Then + + ' If the StartDate is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalEducationTable.StartDate, "d MMM yy") + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.StartDate.Text = formattedValue + + Else + + ' StartDate is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.StartDate.Text = PersonalEducationTable.StartDate.Format(PersonalEducationTable.StartDate.DefaultValue, "d MMM yy") + + End If + + ' If the StartDate is NULL or blank, then use the value specified + ' on Properties. + If Me.StartDate.Text Is Nothing _ + OrElse Me.StartDate.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.StartDate.Text = " " + End If + + End Sub + + Public Overridable Sub SetCommandDateLabel() + + End Sub + + Public Overridable Sub SetCommandLabel() + + End Sub + + Public Overridable Sub SetCOUNTRYLabel() + + End Sub + + Public Overridable Sub SetCourseAbbrLabel() + + End Sub + + Public Overridable Sub SetCourseLabel() + + End Sub + + Public Overridable Sub SetCourseNoLabel() + + End Sub + + Public Overridable Sub SetEducationPeriodLabel() + + End Sub + + Public Overridable Sub SetEducationTypeLabel() + + End Sub + + Public Overridable Sub SetEdYearLabel() + + End Sub + + Public Overridable Sub SetEndDateLabel() + + End Sub + + Public Overridable Sub SetFacultryLabel() + + End Sub + + Public Overridable Sub SetInstitueLabel() + + End Sub + + Public Overridable Sub SetLevelIdLabel() + + End Sub + + Public Overridable Sub SetNoAllLabel() + + End Sub + + Public Overridable Sub SetPersonalEducationRecordControlCollapsibleRegion() + + End Sub + + Public Overridable Sub SetPersonalEducationRecordControlIcon() + + End Sub + + Public Overridable Sub SetPersonalEducationRecordControlPanelExtender() + + End Sub + + Public Overridable Sub SetPersonalIdLabel() + + End Sub + + Public Overridable Sub SetScoreLabel() + + End Sub + + Public Overridable Sub SetScoreNoLabel() + + End Sub + + Public Overridable Sub SetStartDateLabel() + + 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 PersonalEducationRecordControl. + 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, "PersonalEducationRecordControlPanel"), 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 PersonalEducationRecordControl. + Public Overridable Sub GetUIData() + ' The GetUIData method retrieves the updated values from the user interface + ' controls into a database record in preparation for saving or updating. + ' To do this, it calls the Get methods for each of the field displayed on + ' the webpage. It is better to make changes in the Get methods, rather + ' than making changes here. + + ' Call the Get methods for each of the user interface controls. + + GetCommand() + GetCommandDate() + GetCOUNTRY() + GetCourse() + GetCourseAbbr() + GetCourseNo() + GetEducationPeriod() + GetEducationType() + GetEdYear() + GetEndDate() + GetFacultry() + GetInstitue() + GetLevelId() + GetNoAll() + GetPersonalId() + GetScore() + GetScoreNo() + GetStartDate() + End Sub + + + Public Overridable Sub GetCommand() + + End Sub + + Public Overridable Sub GetCommandDate() + + End Sub + + Public Overridable Sub GetCOUNTRY() + + End Sub + + Public Overridable Sub GetCourse() + + End Sub + + Public Overridable Sub GetCourseAbbr() + + End Sub + + Public Overridable Sub GetCourseNo() + + End Sub + + Public Overridable Sub GetEducationPeriod() + + End Sub + + Public Overridable Sub GetEducationType() + + End Sub + + Public Overridable Sub GetEdYear() + + End Sub + + Public Overridable Sub GetEndDate() + + End Sub + + Public Overridable Sub GetFacultry() + + End Sub + + Public Overridable Sub GetInstitue() + + End Sub + + Public Overridable Sub GetLevelId() + + End Sub + + Public Overridable Sub GetNoAll() + + End Sub + + Public Overridable Sub GetPersonalId() + + End Sub + + Public Overridable Sub GetScore() + + End Sub + + Public Overridable Sub GetScoreNo() + + End Sub + + Public Overridable Sub GetStartDate() + + End Sub + + + ' To customize, override this method in PersonalEducationRecordControl. + + Public Overridable Function CreateWhereClause() As WhereClause + + Dim wc As WhereClause + PersonalEducationTable.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("PersonalEducation") + + 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}", "PersonalEducation")) + End If + HttpContext.Current.Session("QueryString in ShowPersonalEducation") = 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(PersonalEducationTable.EducationId, BaseFilter.ComparisonOperator.EqualsTo, pkValue.GetColumnValueString(PersonalEducationTable.EducationId)) + + Else + ' The URL parameter contains the actual value, not an XML structure. + + wc.iAND(PersonalEducationTable.EducationId, 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 + PersonalEducationTable.Instance.InnerFilter = Nothing + Dim wc As WhereClause = New WhereClause() + + ' Compose the WHERE clause consiting of: + ' 1. Static clause defined at design time. + ' 2. User selected 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 PersonalEducationRecordControl. + Public Overridable Sub Validate() + ' Add custom validation for any control within this panel. + ' Example. If you have a State ASP:Textbox control + ' If Me.State.Text <> "CA" Then + ' Throw New Exception("State must be CA (California).") + ' End If + + ' The Validate method is common across all controls within + ' this panel so you can validate multiple fields, but report + ' one error message. + + + End Sub + + Public Overridable Sub Delete() + + If Me.IsNewRecord() Then + Return + End If + + Dim pkValue As KeyValue = KeyValue.XmlToKey(Me.RecordUniqueId) + PersonalEducationTable.DeleteRecord(pkValue) + + 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. + + ' event handler for ImageButton + Public Overridable Sub PersonalEducationDialogEditButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + ' The redirect URL is set on the Properties, Custom Properties or Actions. + ' The ModifyRedirectURL call resolves the parameters before the + ' Response.Redirect redirects the page to the URL. + ' Any code after the Response.Redirect call will not be executed, since the page is + ' redirected to the URL. + + + Dim url As String = "../PersonalEducation/EditPersonalEducation.aspx?PersonalEducation={PK}" + + Dim shouldRedirect As Boolean = True + Dim TargetKey As String = Nothing + Dim DFKA As String = TargetKey + Dim id As String = DFKA + Dim value As String = id + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + url = Me.ModifyRedirectUrl(url, "",False) + url = Me.Page.ModifyRedirectUrl(url, "",False) + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + shouldRedirect = False + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + If shouldRedirect Then + Me.Page.ShouldSaveControlsToSession = True + Me.Page.Response.Redirect(url) + ElseIf Not TargetKey Is Nothing AndAlso _ + Not shouldRedirect Then + Me.Page.ShouldSaveControlsToSession = True + Me.Page.CloseWindow(True) + + End If + End Sub + + ' event handler for LinkButton + Public Overridable Sub PersonalId_Click(ByVal sender As Object, ByVal args As EventArgs) + + ' The redirect URL is set on the Properties, Custom Properties or Actions. + ' The ModifyRedirectURL call resolves the parameters before the + ' Response.Redirect redirects the page to the URL. + ' Any code after the Response.Redirect call will not be executed, since the page is + ' redirected to the URL. + + + Dim url As String = "../PersonalId/ShowPersonalId.aspx?PersonalId={PersonalEducationRecordControl:FK:FK_PersonalEducation_PersonalId}" + + Dim shouldRedirect As Boolean = True + Dim TargetKey As String = Nothing + Dim DFKA As String = TargetKey + Dim id As String = DFKA + Dim value As String = id + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + url = Me.ModifyRedirectUrl(url, "",False) + url = Me.Page.ModifyRedirectUrl(url, "",False) + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + shouldRedirect = False + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + If shouldRedirect Then + Me.Page.ShouldSaveControlsToSession = True + Me.Page.Response.Redirect(url) + ElseIf Not TargetKey Is Nothing AndAlso _ + Not shouldRedirect Then + Me.Page.ShouldSaveControlsToSession = True + Me.Page.CloseWindow(True) + + End If + End Sub + + + Private _PreviousUIData As New Hashtable + Public Overridable Property PreviousUIData() As Hashtable + Get + Return _PreviousUIData + End Get + Set(ByVal value As Hashtable) + _PreviousUIData = value + End Set + End Property + + Private _IsNewRecord As Boolean = True + Public Overridable Property IsNewRecord() As Boolean + Get + Return Me._IsNewRecord + End Get + Set(ByVal value As Boolean) + Me._IsNewRecord = value + End Set + End Property + + Private _DataChanged As Boolean = False + Public Overridable Property DataChanged() As Boolean + Get + Return Me._DataChanged + End Get + Set(ByVal Value As Boolean) + Me._DataChanged = Value + End Set + End Property + + Private _ResetData As Boolean = False + Public Overridable Property ResetData() As Boolean + Get + Return Me._ResetData + End Get + Set(ByVal Value As Boolean) + Me._ResetData = Value + End Set + End Property + + Public Property RecordUniqueId() As String + Get + Return CType(Me.ViewState("BasePersonalEducationRecordControl_Rec"), String) + End Get + Set(ByVal value As String) + Me.ViewState("BasePersonalEducationRecordControl_Rec") = value + End Set + End Property + + Private _DataSource As PersonalEducationRecord + Public Property DataSource() As PersonalEducationRecord + Get + Return Me._DataSource + End Get + + Set(ByVal value As PersonalEducationRecord) + + Me._DataSource = value + End Set + End Property + + + + Private _checkSum As String + Public Overridable Property CheckSum() As String + Get + Return Me._checkSum + End Get + Set(ByVal value As String) + Me._checkSum = value + End Set + End Property + + Private _TotalPages As Integer + Public Property TotalPages() As Integer + Get + Return Me._TotalPages + End Get + Set(ByVal value As Integer) + Me._TotalPages = value + End Set + End Property + + Private _PageIndex As Integer + Public Property PageIndex() As Integer + Get + ' Return the PageIndex + Return Me._PageIndex + End Get + Set(ByVal value As Integer) + Me._PageIndex = value + End Set + End Property + + Private _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 Command() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Command"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property CommandDate() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "CommandDate"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property CommandDateLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "CommandDateLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property CommandLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "CommandLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property COUNTRY() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "COUNTRY"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property COUNTRYLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "COUNTRYLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property Course() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Course"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property CourseAbbr() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "CourseAbbr"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property CourseAbbrLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "CourseAbbrLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property CourseLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "CourseLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property CourseNo() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "CourseNo"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property CourseNoLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "CourseNoLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property EducationPeriod() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "EducationPeriod"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property EducationPeriodLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "EducationPeriodLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property EducationType() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "EducationType"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property EducationTypeLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "EducationTypeLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property EdYear() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "EdYear"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property EdYearLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "EdYearLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property EndDate() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "EndDate"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property EndDateLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "EndDateLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property Facultry() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Facultry"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property FacultryLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "FacultryLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property Institue() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Institue"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property InstitueLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "InstitueLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property LevelId() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "LevelId"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property LevelIdLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "LevelIdLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property NoAll() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "NoAll"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property NoAllLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "NoAllLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property PersonalEducationDialogEditButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalEducationDialogEditButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalEducationRecordControlCollapsibleRegion() As System.Web.UI.WebControls.Panel + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalEducationRecordControlCollapsibleRegion"), System.Web.UI.WebControls.Panel) + End Get + End Property + + Public ReadOnly Property PersonalEducationRecordControlIcon() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalEducationRecordControlIcon"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalEducationRecordControlPanelExtender() As AjaxControlToolkit.CollapsiblePanelExtender + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalEducationRecordControlPanelExtender"), AjaxControlToolkit.CollapsiblePanelExtender) + End Get + End Property + + Public ReadOnly Property PersonalEducationTitle() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalEducationTitle"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property PersonalId() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalId"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property PersonalIdLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalIdLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property Score() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Score"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property ScoreLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "ScoreLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property ScoreNo() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "ScoreNo"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property ScoreNoLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "ScoreNoLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property StartDate() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "StartDate"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property StartDateLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "StartDateLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + +#End Region + +#Region "Helper Functions" + + Public Overrides Overloads Function ModifyRedirectUrl(ByVal url As String, ByVal arg As String, ByVal bEncrypt As Boolean) As String + Return Me.Page.EvaluateExpressions(url, arg, bEncrypt, Me) + End Function + + Public Overrides Overloads Function EvaluateExpressions(ByVal url As String, ByVal arg As String, ByVal bEncrypt As Boolean) As String + + Dim rec As PersonalEducationRecord = Nothing + + + Try + rec = Me.GetRecord() + Catch ex As Exception + ' Do nothing + End Try + + If rec Is Nothing AndAlso url.IndexOf("{") >= 0 Then + ' Localization. + + Throw New Exception(Page.GetResourceValue("Err:RecDataSrcNotInitialized", "Persons")) + + End If + Return EvaluateExpressions(url, arg, rec, bEncrypt) + End Function + + + Public Overridable Function GetRecord() As PersonalEducationRecord + If Not Me.DataSource Is Nothing Then + Return Me.DataSource + End If + + If Not Me.RecordUniqueId Is Nothing Then + + Return PersonalEducationTable.GetRecord(Me.RecordUniqueId, True) + + End If + + ' Localization. + + Throw New Exception(Page.GetResourceValue("Err:RetrieveRec", "Persons")) + + End Function + + Public Shadows ReadOnly Property Page() As BaseApplicationPage + Get + Return DirectCast(MyBase.Page, BaseApplicationPage) + End Get + End Property + +#End Region + +End Class + + + +#End Region + + +End Namespace + + \ No newline at end of file diff --git a/App_Code/PersonalEducation/ShowPersonalEducationTable.Controls.vb b/App_Code/PersonalEducation/ShowPersonalEducationTable.Controls.vb new file mode 100644 index 0000000..c69b8d8 --- /dev/null +++ b/App_Code/PersonalEducation/ShowPersonalEducationTable.Controls.vb @@ -0,0 +1,5432 @@ + +' This file implements the TableControl, TableControlRow, and RecordControl classes for the +' ShowPersonalEducationTable.aspx page. The Row or RecordControl classes are the +' ideal place to add code customizations. For example, you can override the LoadData, +' CreateWhereClause, DataBind, SaveData, GetUIData, and Validate methods. + +#Region "Imports statements" + +Option Strict On +Imports Microsoft.VisualBasic +Imports BaseClasses.Web.UI.WebControls +Imports System +Imports System.Collections +Imports System.Collections.Generic + +Imports System.Web +Imports System.Web.UI +Imports System.Web.UI.WebControls +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Utils +Imports ReportTools.ReportCreator +Imports ReportTools.Shared + + + +Imports Persons.Business +Imports Persons.Data + + +#End Region + + +Namespace Persons.UI.Controls.ShowPersonalEducationTable + +#Region "Section 1: Place your customizations here." + + +Public Class PersonalEducationTableControlRow + Inherits BasePersonalEducationTableControlRow + ' The BasePersonalEducationTableControlRow implements code for a ROW within the + ' the PersonalEducationTableControl table. The BasePersonalEducationTableControlRow implements the DataBind and SaveData methods. + ' The loading of data is actually performed by the LoadData method in the base class of PersonalEducationTableControl. + + ' This is the ideal place to add your code customizations. For example, you can override the DataBind, + ' SaveData, GetUIData, and Validate methods. + + + Private Sub PersonalEducationTableControlRow_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.PreRender + Me.PersonalId.Text = Ps.GetName(Me.DataSource.PersonalId) + End Sub + End Class + + + +Public Class PersonalEducationTableControl + Inherits BasePersonalEducationTableControl + + Protected Overrides Sub PopulateCOUNTRYFilter(ByVal selectedValue As String, ByVal maxItems As Integer) + + 'Setup the WHERE clause. + Dim wc As WhereClause = Me.CreateWhereClause_COUNTRYFilter() + Dim orderBy As OrderBy = New OrderBy(False, True) + orderBy.Add(CountryTable.CountryId, OrderByItem.OrderDir.Asc) + + Dim noValueFormat As String = Page.GetResourceValue("Txt:Other", "Persons") + + + Me.COUNTRYFilter.Items.Clear() + Dim itemValue As CountryRecord + For Each itemValue In CountryTable.GetRecords(wc, orderBy, 0, maxItems) + ' Create the item and add to the list. + Dim cvalue As String = Nothing + Dim fvalue As String = noValueFormat + If itemValue.CountryIdSpecified Then + cvalue = itemValue.CountryId.ToString() + fvalue = itemValue.Format(CountryTable.Country) + End If + + Dim item As ListItem = New ListItem(fvalue, cvalue) + If Me.COUNTRYFilter.Items.IndexOf(item) < 0 Then + Me.COUNTRYFilter.Items.Add(item) + End If + Next + + ' Add the All item. + Me.COUNTRYFilter.Items.Insert(0, New ListItem(Page.GetResourceValue("Txt:All", "Persons"), "--ANY--")) + + ' Set the selected value. + SetSelectedValue(Me.COUNTRYFilter, selectedValue) + + + End Sub + +End Class + + + +#End Region + + + +#Region "Section 2: Do not modify this section." + + +' Base class for the PersonalEducationTableControlRow control on the ShowPersonalEducationTable page. +' Do not modify this class. Instead override any method in PersonalEducationTableControlRow. +Public Class BasePersonalEducationTableControlRow + Inherits Persons.UI.BaseApplicationRecordControl + + ' To customize, override this method in PersonalEducationTableControlRow. + Protected Overridable Sub Control_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Init + + Me.ClearControlsFromSession() + End Sub + + ' To customize, override this method in PersonalEducationTableControlRow. + Protected Overridable Sub Control_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load + + 'Call LoadFocusScripts from repeater so that onfocus attribute could be added to elements + Me.Page.LoadFocusScripts(Me) + + ' Show confirmation message on Click + Me.PersonalEducationRowDeleteButton.Attributes.Add("onClick", "return (confirm('" & (CType(Me.Page,BaseApplicationPage)).GetResourceValue("DeleteRecordConfirm", "Persons") & "'));") + + + ' Register the event handlers. + + AddHandler Me.PersonalEducationRowCopyButton.Click, AddressOf PersonalEducationRowCopyButton_Click + + AddHandler Me.PersonalEducationRowDeleteButton.Click, AddressOf PersonalEducationRowDeleteButton_Click + + AddHandler Me.PersonalEducationRowEditButton.Click, AddressOf PersonalEducationRowEditButton_Click + + AddHandler Me.PersonalEducationRowViewButton.Click, AddressOf PersonalEducationRowViewButton_Click + + AddHandler Me.PersonalId.Click, AddressOf PersonalId_Click + + + End Sub + + + Public Overridable Sub LoadData() + + ' Load the data from the database into the DataSource PersonalEducation record. + ' It is better to make changes to functions called by LoadData such as + ' CreateWhereClause, rather than making changes here. + + ' The RecordUniqueId is set the first time a record is loaded, and is + ' used during a PostBack to load the record. + + If Me.RecordUniqueId IsNot Nothing AndAlso Me.RecordUniqueId.Trim <> "" Then + Me.DataSource = PersonalEducationTable.GetRecord(Me.RecordUniqueId, True) + + Return + End If + + ' Since this is a row in the table, the data for this row is loaded by the + ' LoadData method of the BasePersonalEducationTableControl when the data for the entire + ' table is loaded. + + Me.DataSource = New PersonalEducationRecord() + + + + End Sub + + ' Populate the UI controls using the DataSource. To customize, override this method in PersonalEducationTableControlRow. + Public Overrides Sub DataBind() + ' The DataBind method binds the user interface controls to the values + ' from the database record. To do this, it calls the Set methods for + ' each of the field displayed on the webpage. It is better to make + ' changes in the Set methods, rather than making changes here. + + MyBase.DataBind() + + ' Make sure that the DataSource is initialized. + If Me.DataSource Is Nothing Then + + Return + End If + + + 'LoadData for DataSource for chart and report if they exist + + + + ' Call the Set methods for each controls on the panel + + SetCommand() + SetCommandDate() + SetCOUNTRY() + SetCourse() + SetCourseAbbr() + SetCourseNo() + SetEducationPeriod() + SetEducationType() + SetEdYear() + SetEndDate() + SetFacultry() + SetInstitue() + SetLevelId() + SetNoAll() + + + + + + SetPersonalId() + SetScore() + SetScoreNo() + SetStartDate() + + + Me.IsNewRecord = True + + If Me.DataSource.IsCreated Then + Me.IsNewRecord = False + + Me.RecordUniqueId = Me.DataSource.GetID.ToXmlString() + End If + + ' Now load data for each record and table child UI controls. + ' Ordering is important because child controls get + ' their parent ids from their parent UI controls. + Dim shouldResetControl As Boolean = False + + End Sub + + + Public Overridable Sub SetCommand() + + + ' Set the Command Literal on the webpage with value from the + ' PersonalEducation database record. + + ' Me.DataSource is the PersonalEducation record retrieved from the database. + ' Me.Command is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetCommand() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.CommandSpecified Then + + ' If the Command is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalEducationTable.Command) + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.Command.Text = formattedValue + + Else + + ' Command is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.Command.Text = PersonalEducationTable.Command.Format(PersonalEducationTable.Command.DefaultValue) + + End If + + ' If the Command is NULL or blank, then use the value specified + ' on Properties. + If Me.Command.Text Is Nothing _ + OrElse Me.Command.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.Command.Text = " " + End If + + End Sub + + Public Overridable Sub SetCommandDate() + + + ' Set the CommandDate Literal on the webpage with value from the + ' PersonalEducation database record. + + ' Me.DataSource is the PersonalEducation record retrieved from the database. + ' Me.CommandDate is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetCommandDate() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.CommandDateSpecified Then + + ' If the CommandDate is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalEducationTable.CommandDate, "d MMM yy") + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.CommandDate.Text = formattedValue + + Else + + ' CommandDate is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.CommandDate.Text = PersonalEducationTable.CommandDate.Format(PersonalEducationTable.CommandDate.DefaultValue, "d MMM yy") + + End If + + ' If the CommandDate is NULL or blank, then use the value specified + ' on Properties. + If Me.CommandDate.Text Is Nothing _ + OrElse Me.CommandDate.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.CommandDate.Text = " " + End If + + End Sub + + Public Overridable Sub SetCOUNTRY() + + + ' Set the COUNTRY Literal on the webpage with value from the + ' PersonalEducation database record. + + ' Me.DataSource is the PersonalEducation record retrieved from the database. + ' Me.COUNTRY is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetCOUNTRY() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.COUNTRYSpecified Then + + ' If the COUNTRY is non-NULL, then format the value. + + ' The Format method will return the Display Foreign Key As (DFKA) value + Dim formattedValue As String = "" + Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalEducationTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalEducationTable.COUNTRY) + If _isExpandableNonCompositeForeignKey AndAlso PersonalEducationTable.COUNTRY.IsApplyDisplayAs Then + + formattedValue = PersonalEducationTable.GetDFKA(Me.DataSource.COUNTRY.ToString(),PersonalEducationTable.COUNTRY, Nothing) + + if (formattedValue Is Nothing) Then + formattedValue = Me.DataSource.Format(PersonalEducationTable.COUNTRY) + End If + Else + formattedValue = Me.DataSource.COUNTRY.ToString() + End If + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.COUNTRY.Text = formattedValue + + Else + + ' COUNTRY is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.COUNTRY.Text = PersonalEducationTable.COUNTRY.Format(PersonalEducationTable.COUNTRY.DefaultValue) + + End If + + ' If the COUNTRY is NULL or blank, then use the value specified + ' on Properties. + If Me.COUNTRY.Text Is Nothing _ + OrElse Me.COUNTRY.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.COUNTRY.Text = " " + End If + + End Sub + + Public Overridable Sub SetCourse() + + + ' Set the Course Literal on the webpage with value from the + ' PersonalEducation database record. + + ' Me.DataSource is the PersonalEducation record retrieved from the database. + ' Me.Course is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetCourse() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.CourseSpecified Then + + ' If the Course is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalEducationTable.Course) + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.Course.Text = formattedValue + + Else + + ' Course is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.Course.Text = PersonalEducationTable.Course.Format(PersonalEducationTable.Course.DefaultValue) + + End If + + ' If the Course is NULL or blank, then use the value specified + ' on Properties. + If Me.Course.Text Is Nothing _ + OrElse Me.Course.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.Course.Text = " " + End If + + End Sub + + Public Overridable Sub SetCourseAbbr() + + + ' Set the CourseAbbr Literal on the webpage with value from the + ' PersonalEducation database record. + + ' Me.DataSource is the PersonalEducation record retrieved from the database. + ' Me.CourseAbbr is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetCourseAbbr() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.CourseAbbrSpecified Then + + ' If the CourseAbbr is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalEducationTable.CourseAbbr) + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.CourseAbbr.Text = formattedValue + + Else + + ' CourseAbbr is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.CourseAbbr.Text = PersonalEducationTable.CourseAbbr.Format(PersonalEducationTable.CourseAbbr.DefaultValue) + + End If + + ' If the CourseAbbr is NULL or blank, then use the value specified + ' on Properties. + If Me.CourseAbbr.Text Is Nothing _ + OrElse Me.CourseAbbr.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.CourseAbbr.Text = " " + End If + + End Sub + + Public Overridable Sub SetCourseNo() + + + ' Set the CourseNo Literal on the webpage with value from the + ' PersonalEducation database record. + + ' Me.DataSource is the PersonalEducation record retrieved from the database. + ' Me.CourseNo is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetCourseNo() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.CourseNoSpecified Then + + ' If the CourseNo is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalEducationTable.CourseNo) + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.CourseNo.Text = formattedValue + + Else + + ' CourseNo is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.CourseNo.Text = PersonalEducationTable.CourseNo.Format(PersonalEducationTable.CourseNo.DefaultValue) + + End If + + ' If the CourseNo is NULL or blank, then use the value specified + ' on Properties. + If Me.CourseNo.Text Is Nothing _ + OrElse Me.CourseNo.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.CourseNo.Text = " " + End If + + End Sub + + Public Overridable Sub SetEducationPeriod() + + + ' Set the EducationPeriod Literal on the webpage with value from the + ' PersonalEducation database record. + + ' Me.DataSource is the PersonalEducation record retrieved from the database. + ' Me.EducationPeriod is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetEducationPeriod() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.EducationPeriodSpecified Then + + ' If the EducationPeriod is non-NULL, then format the value. + + ' The Format method will return the Display Foreign Key As (DFKA) value + Dim formattedValue As String = "" + Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalEducationTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalEducationTable.EducationPeriod) + If _isExpandableNonCompositeForeignKey AndAlso PersonalEducationTable.EducationPeriod.IsApplyDisplayAs Then + + formattedValue = PersonalEducationTable.GetDFKA(Me.DataSource.EducationPeriod.ToString(),PersonalEducationTable.EducationPeriod, Nothing) + + if (formattedValue Is Nothing) Then + formattedValue = Me.DataSource.Format(PersonalEducationTable.EducationPeriod) + End If + Else + formattedValue = Me.DataSource.EducationPeriod.ToString() + End If + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.EducationPeriod.Text = formattedValue + + Else + + ' EducationPeriod is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.EducationPeriod.Text = PersonalEducationTable.EducationPeriod.Format(PersonalEducationTable.EducationPeriod.DefaultValue) + + End If + + ' If the EducationPeriod is NULL or blank, then use the value specified + ' on Properties. + If Me.EducationPeriod.Text Is Nothing _ + OrElse Me.EducationPeriod.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.EducationPeriod.Text = " " + End If + + End Sub + + Public Overridable Sub SetEducationType() + + + ' Set the EducationType Literal on the webpage with value from the + ' PersonalEducation database record. + + ' Me.DataSource is the PersonalEducation record retrieved from the database. + ' Me.EducationType is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetEducationType() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.EducationTypeSpecified Then + + ' If the EducationType is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalEducationTable.EducationType) + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.EducationType.Text = formattedValue + + Else + + ' EducationType is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.EducationType.Text = PersonalEducationTable.EducationType.Format(PersonalEducationTable.EducationType.DefaultValue) + + End If + + ' If the EducationType is NULL or blank, then use the value specified + ' on Properties. + If Me.EducationType.Text Is Nothing _ + OrElse Me.EducationType.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.EducationType.Text = " " + End If + + End Sub + + Public Overridable Sub SetEdYear() + + + ' Set the EdYear Literal on the webpage with value from the + ' PersonalEducation database record. + + ' Me.DataSource is the PersonalEducation record retrieved from the database. + ' Me.EdYear is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetEdYear() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.EdYearSpecified Then + + ' If the EdYear is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalEducationTable.EdYear) + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.EdYear.Text = formattedValue + + Else + + ' EdYear is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.EdYear.Text = PersonalEducationTable.EdYear.Format(PersonalEducationTable.EdYear.DefaultValue) + + End If + + ' If the EdYear is NULL or blank, then use the value specified + ' on Properties. + If Me.EdYear.Text Is Nothing _ + OrElse Me.EdYear.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.EdYear.Text = " " + End If + + End Sub + + Public Overridable Sub SetEndDate() + + + ' Set the EndDate Literal on the webpage with value from the + ' PersonalEducation database record. + + ' Me.DataSource is the PersonalEducation record retrieved from the database. + ' Me.EndDate is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetEndDate() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.EndDateSpecified Then + + ' If the EndDate is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalEducationTable.EndDate, "d MMM yy") + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.EndDate.Text = formattedValue + + Else + + ' EndDate is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.EndDate.Text = PersonalEducationTable.EndDate.Format(PersonalEducationTable.EndDate.DefaultValue, "d MMM yy") + + End If + + ' If the EndDate is NULL or blank, then use the value specified + ' on Properties. + If Me.EndDate.Text Is Nothing _ + OrElse Me.EndDate.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.EndDate.Text = " " + End If + + End Sub + + Public Overridable Sub SetFacultry() + + + ' Set the Facultry Literal on the webpage with value from the + ' PersonalEducation database record. + + ' Me.DataSource is the PersonalEducation record retrieved from the database. + ' Me.Facultry is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetFacultry() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.FacultrySpecified Then + + ' If the Facultry is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalEducationTable.Facultry) + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.Facultry.Text = formattedValue + + Else + + ' Facultry is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.Facultry.Text = PersonalEducationTable.Facultry.Format(PersonalEducationTable.Facultry.DefaultValue) + + End If + + ' If the Facultry is NULL or blank, then use the value specified + ' on Properties. + If Me.Facultry.Text Is Nothing _ + OrElse Me.Facultry.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.Facultry.Text = " " + End If + + End Sub + + Public Overridable Sub SetInstitue() + + + ' Set the Institue Literal on the webpage with value from the + ' PersonalEducation database record. + + ' Me.DataSource is the PersonalEducation record retrieved from the database. + ' Me.Institue is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetInstitue() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.InstitueSpecified Then + + ' If the Institue is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalEducationTable.Institue) + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.Institue.Text = formattedValue + + Else + + ' Institue is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.Institue.Text = PersonalEducationTable.Institue.Format(PersonalEducationTable.Institue.DefaultValue) + + End If + + ' If the Institue is NULL or blank, then use the value specified + ' on Properties. + If Me.Institue.Text Is Nothing _ + OrElse Me.Institue.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.Institue.Text = " " + End If + + End Sub + + Public Overridable Sub SetLevelId() + + + ' Set the LevelId Literal on the webpage with value from the + ' PersonalEducation database record. + + ' Me.DataSource is the PersonalEducation record retrieved from the database. + ' Me.LevelId is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetLevelId() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.LevelIdSpecified Then + + ' If the LevelId is non-NULL, then format the value. + + ' The Format method will return the Display Foreign Key As (DFKA) value + Dim formattedValue As String = "" + Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalEducationTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalEducationTable.LevelId) + If _isExpandableNonCompositeForeignKey AndAlso PersonalEducationTable.LevelId.IsApplyDisplayAs Then + + formattedValue = PersonalEducationTable.GetDFKA(Me.DataSource.LevelId.ToString(),PersonalEducationTable.LevelId, Nothing) + + if (formattedValue Is Nothing) Then + formattedValue = Me.DataSource.Format(PersonalEducationTable.LevelId) + End If + Else + formattedValue = Me.DataSource.LevelId.ToString() + End If + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.LevelId.Text = formattedValue + + Else + + ' LevelId is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.LevelId.Text = PersonalEducationTable.LevelId.Format(PersonalEducationTable.LevelId.DefaultValue) + + End If + + ' If the LevelId is NULL or blank, then use the value specified + ' on Properties. + If Me.LevelId.Text Is Nothing _ + OrElse Me.LevelId.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.LevelId.Text = " " + End If + + End Sub + + Public Overridable Sub SetNoAll() + + + ' Set the NoAll Literal on the webpage with value from the + ' PersonalEducation database record. + + ' Me.DataSource is the PersonalEducation record retrieved from the database. + ' Me.NoAll is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetNoAll() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.NoAllSpecified Then + + ' If the NoAll is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalEducationTable.NoAll) + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.NoAll.Text = formattedValue + + Else + + ' NoAll is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.NoAll.Text = PersonalEducationTable.NoAll.Format(PersonalEducationTable.NoAll.DefaultValue) + + End If + + ' If the NoAll is NULL or blank, then use the value specified + ' on Properties. + If Me.NoAll.Text Is Nothing _ + OrElse Me.NoAll.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.NoAll.Text = " " + End If + + End Sub + + Public Overridable Sub SetPersonalId() + + + ' Set the PersonalId LinkButton on the webpage with value from the + ' PersonalEducation database record. + + ' Me.DataSource is the PersonalEducation record retrieved from the database. + ' Me.PersonalId is the ASP:LinkButton on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetPersonalId() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.PersonalIdSpecified Then + + ' If the PersonalId is non-NULL, then format the value. + + ' The Format method will return the Display Foreign Key As (DFKA) value + Dim formattedValue As String = "" + Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalEducationTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalEducationTable.PersonalId) + If _isExpandableNonCompositeForeignKey AndAlso PersonalEducationTable.PersonalId.IsApplyDisplayAs Then + + formattedValue = PersonalEducationTable.GetDFKA(Me.DataSource.PersonalId.ToString(),PersonalEducationTable.PersonalId, Nothing) + + if (formattedValue Is Nothing) Then + formattedValue = Me.DataSource.Format(PersonalEducationTable.PersonalId) + End If + Else + formattedValue = Me.DataSource.PersonalId.ToString() + End If + + Me.PersonalId.Text = formattedValue + + Me.PersonalId.ToolTip = "Go to " & Me.PersonalId.Text.Replace("", "") + + Else + + ' PersonalId is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.PersonalId.Text = PersonalEducationTable.PersonalId.Format(PersonalEducationTable.PersonalId.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetScore() + + + ' Set the Score Literal on the webpage with value from the + ' PersonalEducation database record. + + ' Me.DataSource is the PersonalEducation record retrieved from the database. + ' Me.Score is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetScore() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.ScoreSpecified Then + + ' If the Score is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalEducationTable.Score) + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.Score.Text = formattedValue + + Else + + ' Score is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.Score.Text = PersonalEducationTable.Score.Format(PersonalEducationTable.Score.DefaultValue) + + End If + + ' If the Score is NULL or blank, then use the value specified + ' on Properties. + If Me.Score.Text Is Nothing _ + OrElse Me.Score.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.Score.Text = " " + End If + + End Sub + + Public Overridable Sub SetScoreNo() + + + ' Set the ScoreNo Literal on the webpage with value from the + ' PersonalEducation database record. + + ' Me.DataSource is the PersonalEducation record retrieved from the database. + ' Me.ScoreNo is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetScoreNo() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.ScoreNoSpecified Then + + ' If the ScoreNo is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalEducationTable.ScoreNo) + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.ScoreNo.Text = formattedValue + + Else + + ' ScoreNo is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.ScoreNo.Text = PersonalEducationTable.ScoreNo.Format(PersonalEducationTable.ScoreNo.DefaultValue) + + End If + + ' If the ScoreNo is NULL or blank, then use the value specified + ' on Properties. + If Me.ScoreNo.Text Is Nothing _ + OrElse Me.ScoreNo.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.ScoreNo.Text = " " + End If + + End Sub + + Public Overridable Sub SetStartDate() + + + ' Set the StartDate Literal on the webpage with value from the + ' PersonalEducation database record. + + ' Me.DataSource is the PersonalEducation record retrieved from the database. + ' Me.StartDate is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetStartDate() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.StartDateSpecified Then + + ' If the StartDate is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalEducationTable.StartDate, "d MMM yy") + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.StartDate.Text = formattedValue + + Else + + ' StartDate is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.StartDate.Text = PersonalEducationTable.StartDate.Format(PersonalEducationTable.StartDate.DefaultValue, "d MMM yy") + + End If + + ' If the StartDate is NULL or blank, then use the value specified + ' on Properties. + If Me.StartDate.Text Is Nothing _ + OrElse Me.StartDate.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.StartDate.Text = " " + End If + + End Sub + + + Public EvaluateFormulaDelegate As BaseClasses.Data.DataSource.EvaluateFormulaDelegate = New BaseClasses.Data.DataSource.EvaluateFormulaDelegate(AddressOf Me.EvaluateFormula) + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean, ByVal e As FormulaEvaluator) As String + If e Is Nothing Then + e = New FormulaEvaluator() + End If + + e.Variables.Clear() + + + ' add variables for formula evaluation + If variables IsNot Nothing Then + Dim enumerator As System.Collections.Generic.IEnumerator(Of System.Collections.Generic.KeyValuePair(Of String, Object)) = variables.GetEnumerator() + While enumerator.MoveNext() + e.Variables.Add(enumerator.Current.Key, enumerator.Current.Value) + End While + End If + + If includeDS + + End IF + + + ' Other variables referred to in the formula are expected to be + ' properties of the DataSource. For example, referring to + ' UnitPrice as a variable will refer to DataSource.UnitPrice + If dataSourceForEvaluate Is Nothing Then + + e.DataSource = Me.DataSource + + Else + e.DataSource = dataSourceForEvaluate + End If + + ' Define the calling control. This is used to add other + ' related table and record controls as variables. + e.CallingControl = Me + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + + If Not String.IsNullOrEmpty(format) AndAlso (String.IsNullOrEmpty(formula) OrElse formula.IndexOf("Format(") < 0) Then + Return FormulaUtils.Format(resultObj, format) + Else + Return resultObj.ToString() + End If + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format,variables ,includeDS, Nothing) + End Function + + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object)) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format, variables ,True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, format, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal e as FormulaEvaluator) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, variables, True, e) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal includeDS as Boolean) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, includeDS, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, True, Nothing) + End Function + + + Public Overridable Sub RegisterPostback() + + + End Sub + + + + ' To customize, override this method in PersonalEducationTableControlRow. + Public Overridable Sub SaveData() + ' Saves the associated record in the database. + ' SaveData calls Validate and Get methods - so it may be more appropriate to + ' customize those methods. + + ' 1. Load the existing record from the database. Since we save the entire record, this ensures + ' that fields that are not displayed are also properly initialized. + Me.LoadData() + + + ' 2. Perform any custom validation. + Me.Validate() + + + ' 3. Set the values in the record with data from UI controls. + ' This calls the Get() method for each of the user interface controls. + Me.GetUIData() + + ' 4. Save in the database. + ' We should not save the record if the data did not change. This + ' will save a database hit and avoid triggering any database triggers. + + If Me.DataSource.IsAnyValueChanged Then + ' Save record to database but do not commit yet. + ' Auto generated ids are available after saving for use by child (dependent) records. + Me.DataSource.Save() + + DirectCast(GetParentControlObject(Me, "PersonalEducationTableControl"), PersonalEducationTableControl).DataChanged = True + DirectCast(GetParentControlObject(Me, "PersonalEducationTableControl"), PersonalEducationTableControl).ResetData = True + End If + + + ' update session or cookie by formula + + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + ' For Master-Detail relationships, save data on the Detail table(s) + + End Sub + + ' To customize, override this method in PersonalEducationTableControlRow. + Public Overridable Sub GetUIData() + ' The GetUIData method retrieves the updated values from the user interface + ' controls into a database record in preparation for saving or updating. + ' To do this, it calls the Get methods for each of the field displayed on + ' the webpage. It is better to make changes in the Get methods, rather + ' than making changes here. + + ' Call the Get methods for each of the user interface controls. + + GetCommand() + GetCommandDate() + GetCOUNTRY() + GetCourse() + GetCourseAbbr() + GetCourseNo() + GetEducationPeriod() + GetEducationType() + GetEdYear() + GetEndDate() + GetFacultry() + GetInstitue() + GetLevelId() + GetNoAll() + GetPersonalId() + GetScore() + GetScoreNo() + GetStartDate() + End Sub + + + Public Overridable Sub GetCommand() + + End Sub + + Public Overridable Sub GetCommandDate() + + End Sub + + Public Overridable Sub GetCOUNTRY() + + End Sub + + Public Overridable Sub GetCourse() + + End Sub + + Public Overridable Sub GetCourseAbbr() + + End Sub + + Public Overridable Sub GetCourseNo() + + End Sub + + Public Overridable Sub GetEducationPeriod() + + End Sub + + Public Overridable Sub GetEducationType() + + End Sub + + Public Overridable Sub GetEdYear() + + End Sub + + Public Overridable Sub GetEndDate() + + End Sub + + Public Overridable Sub GetFacultry() + + End Sub + + Public Overridable Sub GetInstitue() + + End Sub + + Public Overridable Sub GetLevelId() + + End Sub + + Public Overridable Sub GetNoAll() + + End Sub + + Public Overridable Sub GetPersonalId() + + End Sub + + Public Overridable Sub GetScore() + + End Sub + + Public Overridable Sub GetScoreNo() + + End Sub + + Public Overridable Sub GetStartDate() + + End Sub + + + ' To customize, override this method in PersonalEducationTableControlRow. + + Public Overridable Function CreateWhereClause() As WhereClause + + Return Nothing + + End Function + + + + ' To customize, override this method in PersonalEducationTableControlRow. + Public Overridable Sub Validate() + ' Add custom validation for any control within this panel. + ' Example. If you have a State ASP:Textbox control + ' If Me.State.Text <> "CA" Then + ' Throw New Exception("State must be CA (California).") + ' End If + + ' The Validate method is common across all controls within + ' this panel so you can validate multiple fields, but report + ' one error message. + + + End Sub + + Public Overridable Sub Delete() + + If Me.IsNewRecord() Then + Return + End If + + Dim pkValue As KeyValue = KeyValue.XmlToKey(Me.RecordUniqueId) + PersonalEducationTable.DeleteRecord(pkValue) + + DirectCast(GetParentControlObject(Me, "PersonalEducationTableControl"), PersonalEducationTableControl).DataChanged = True + DirectCast(GetParentControlObject(Me, "PersonalEducationTableControl"), PersonalEducationTableControl).ResetData = True + End Sub + + Protected Overridable Sub Control_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.PreRender + ' PreRender event is raised just before page is being displayed. + Try + DbUtils.StartTransaction() + Me.RegisterPostback() + + If Not Me.Page.ErrorOnPage AndAlso (Me.Page.IsPageRefresh OrElse Me.DataChanged OrElse Me.ResetData) Then + + + ' Re-load the data and update the web page if necessary. + ' This is typically done during a postback (filter, search button, sort, pagination button). + ' In each of the other click handlers, simply set DataChanged to True to reload the data. + Me.LoadData() + Me.DataBind() + End If + + + Catch ex As Exception + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + Finally + DbUtils.EndTransaction() + End Try + End Sub + + + Protected Overrides Sub SaveControlsToSession() + MyBase.SaveControlsToSession() + + + 'Save pagination state to session. + + End Sub + + + + Protected Overrides Sub ClearControlsFromSession() + MyBase.ClearControlsFromSession() + + + + ' Clear pagination state from session. + + End Sub + + Protected Overrides Sub LoadViewState(ByVal savedState As Object) + MyBase.LoadViewState(savedState) + Dim isNewRecord As String = CType(ViewState("IsNewRecord"), String) + If Not isNewRecord Is Nothing AndAlso isNewRecord.Trim <> "" Then + Me.IsNewRecord = Boolean.Parse(isNewRecord) + End If + + Dim myCheckSum As String = CType(ViewState("CheckSum"), String) + If Not myCheckSum Is Nothing AndAlso myCheckSum.Trim <> "" Then + Me.CheckSum = myCheckSum + End If + + + ' Load view state for pagination control. + + End Sub + + Protected Overrides Function SaveViewState() As Object + ViewState("IsNewRecord") = Me.IsNewRecord.ToString() + ViewState("CheckSum") = Me.CheckSum + + + ' Load view state for pagination control. + + Return MyBase.SaveViewState() + End Function + + + ' event handler for ImageButton + Public Overridable Sub PersonalEducationRowCopyButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + ' The redirect URL is set on the Properties, Custom Properties or Actions. + ' The ModifyRedirectURL call resolves the parameters before the + ' Response.Redirect redirects the page to the URL. + ' Any code after the Response.Redirect call will not be executed, since the page is + ' redirected to the URL. + + + Dim url As String = "../PersonalEducation/AddPersonalEducation.aspx?PersonalEducation={PK}" + + Dim shouldRedirect As Boolean = True + Dim TargetKey As String = Nothing + Dim DFKA As String = TargetKey + Dim id As String = DFKA + Dim value As String = id + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + url = Me.ModifyRedirectUrl(url, "",False) + url = Me.Page.ModifyRedirectUrl(url, "",False) + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + shouldRedirect = False + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + If shouldRedirect Then + Me.Page.ShouldSaveControlsToSession = True + Me.Page.Response.Redirect(url) + ElseIf Not TargetKey Is Nothing AndAlso _ + Not shouldRedirect Then + Me.Page.ShouldSaveControlsToSession = True + Me.Page.CloseWindow(True) + + End If + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalEducationRowDeleteButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + If(Not Me.Page.IsPageRefresh) Then + + Me.Delete() + + End If + Me.Page.CommitTransaction(sender) + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalEducationRowEditButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + ' The redirect URL is set on the Properties, Custom Properties or Actions. + ' The ModifyRedirectURL call resolves the parameters before the + ' Response.Redirect redirects the page to the URL. + ' Any code after the Response.Redirect call will not be executed, since the page is + ' redirected to the URL. + + + Dim url As String = "../PersonalEducation/EditPersonalEducation.aspx?PersonalEducation={PK}" + + Dim shouldRedirect As Boolean = True + Dim TargetKey As String = Nothing + Dim DFKA As String = TargetKey + Dim id As String = DFKA + Dim value As String = id + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + url = Me.ModifyRedirectUrl(url, "",False) + url = Me.Page.ModifyRedirectUrl(url, "",False) + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + shouldRedirect = False + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + If shouldRedirect Then + Me.Page.ShouldSaveControlsToSession = True + Me.Page.Response.Redirect(url) + ElseIf Not TargetKey Is Nothing AndAlso _ + Not shouldRedirect Then + Me.Page.ShouldSaveControlsToSession = True + Me.Page.CloseWindow(True) + + End If + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalEducationRowViewButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + ' The redirect URL is set on the Properties, Custom Properties or Actions. + ' The ModifyRedirectURL call resolves the parameters before the + ' Response.Redirect redirects the page to the URL. + ' Any code after the Response.Redirect call will not be executed, since the page is + ' redirected to the URL. + + + Dim url As String = "../PersonalEducation/ShowPersonalEducation.aspx?PersonalEducation={PK}" + + Dim shouldRedirect As Boolean = True + Dim TargetKey As String = Nothing + Dim DFKA As String = TargetKey + Dim id As String = DFKA + Dim value As String = id + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + url = Me.ModifyRedirectUrl(url, "",False) + url = Me.Page.ModifyRedirectUrl(url, "",False) + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + shouldRedirect = False + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + If shouldRedirect Then + Me.Page.ShouldSaveControlsToSession = True + Me.Page.Response.Redirect(url) + ElseIf Not TargetKey Is Nothing AndAlso _ + Not shouldRedirect Then + Me.Page.ShouldSaveControlsToSession = True + Me.Page.CloseWindow(True) + + End If + End Sub + + ' event handler for LinkButton + Public Overridable Sub PersonalId_Click(ByVal sender As Object, ByVal args As EventArgs) + + ' The redirect URL is set on the Properties, Custom Properties or Actions. + ' The ModifyRedirectURL call resolves the parameters before the + ' Response.Redirect redirects the page to the URL. + ' Any code after the Response.Redirect call will not be executed, since the page is + ' redirected to the URL. + + + Dim url As String = "../PersonalId/ShowPersonalId.aspx?PersonalId={PersonalEducationTableControlRow:FK:FK_PersonalEducation_PersonalId}" + + Dim shouldRedirect As Boolean = True + Dim TargetKey As String = Nothing + Dim DFKA As String = TargetKey + Dim id As String = DFKA + Dim value As String = id + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + url = Me.ModifyRedirectUrl(url, "",False) + url = Me.Page.ModifyRedirectUrl(url, "",False) + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + shouldRedirect = False + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + If shouldRedirect Then + Me.Page.ShouldSaveControlsToSession = True + Me.Page.Response.Redirect(url) + ElseIf Not TargetKey Is Nothing AndAlso _ + Not shouldRedirect Then + Me.Page.ShouldSaveControlsToSession = True + Me.Page.CloseWindow(True) + + End If + End Sub + + + Private _PreviousUIData As New Hashtable + Public Overridable Property PreviousUIData() As Hashtable + Get + Return _PreviousUIData + End Get + Set(ByVal value As Hashtable) + _PreviousUIData = value + End Set + End Property + + Private _IsNewRecord As Boolean = True + Public Overridable Property IsNewRecord() As Boolean + Get + Return Me._IsNewRecord + End Get + Set(ByVal value As Boolean) + Me._IsNewRecord = value + End Set + End Property + + Private _DataChanged As Boolean = False + Public Overridable Property DataChanged() As Boolean + Get + Return Me._DataChanged + End Get + Set(ByVal Value As Boolean) + Me._DataChanged = Value + End Set + End Property + + Private _ResetData As Boolean = False + Public Overridable Property ResetData() As Boolean + Get + Return Me._ResetData + End Get + Set(ByVal Value As Boolean) + Me._ResetData = Value + End Set + End Property + + Public Property RecordUniqueId() As String + Get + Return CType(Me.ViewState("BasePersonalEducationTableControlRow_Rec"), String) + End Get + Set(ByVal value As String) + Me.ViewState("BasePersonalEducationTableControlRow_Rec") = value + End Set + End Property + + Private _DataSource As PersonalEducationRecord + Public Property DataSource() As PersonalEducationRecord + Get + Return Me._DataSource + End Get + + Set(ByVal value As PersonalEducationRecord) + + Me._DataSource = value + End Set + End Property + + + + Private _checkSum As String + Public Overridable Property CheckSum() As String + Get + Return Me._checkSum + End Get + Set(ByVal value As String) + Me._checkSum = value + End Set + End Property + + Private _TotalPages As Integer + Public Property TotalPages() As Integer + Get + Return Me._TotalPages + End Get + Set(ByVal value As Integer) + Me._TotalPages = value + End Set + End Property + + Private _PageIndex As Integer + Public Property PageIndex() As Integer + Get + ' Return the PageIndex + Return Me._PageIndex + End Get + Set(ByVal value As Integer) + Me._PageIndex = value + End Set + End Property + + Private _DisplayLastPage As Boolean + Public Property DisplayLastPage() As Boolean + Get + Return Me._DisplayLastPage + End Get + Set(ByVal value As Boolean) + Me._DisplayLastPage = value + End Set + End Property + + + +#Region "Helper Properties" + + Public ReadOnly Property Command() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Command"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property CommandDate() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "CommandDate"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property COUNTRY() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "COUNTRY"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property Course() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Course"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property CourseAbbr() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "CourseAbbr"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property CourseNo() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "CourseNo"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property EducationPeriod() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "EducationPeriod"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property EducationType() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "EducationType"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property EdYear() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "EdYear"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property EndDate() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "EndDate"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property Facultry() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Facultry"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property Institue() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Institue"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property LevelId() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "LevelId"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property NoAll() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "NoAll"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property PersonalEducationRecordRowSelection() As System.Web.UI.WebControls.CheckBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalEducationRecordRowSelection"), System.Web.UI.WebControls.CheckBox) + End Get + End Property + + Public ReadOnly Property PersonalEducationRowCopyButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalEducationRowCopyButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalEducationRowDeleteButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalEducationRowDeleteButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalEducationRowEditButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalEducationRowEditButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalEducationRowViewButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalEducationRowViewButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalId() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalId"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property Score() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Score"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property ScoreNo() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "ScoreNo"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property StartDate() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "StartDate"), System.Web.UI.WebControls.Literal) + End Get + End Property + +#End Region + +#Region "Helper Functions" + + Public Overrides Overloads Function ModifyRedirectUrl(ByVal url As String, ByVal arg As String, ByVal bEncrypt As Boolean) As String + Return Me.Page.EvaluateExpressions(url, arg, bEncrypt, Me) + End Function + + Public Overrides Overloads Function EvaluateExpressions(ByVal url As String, ByVal arg As String, ByVal bEncrypt As Boolean) As String + + Dim rec As PersonalEducationRecord = Nothing + + + Try + rec = Me.GetRecord() + Catch ex As Exception + ' Do nothing + End Try + + If rec Is Nothing AndAlso url.IndexOf("{") >= 0 Then + ' Localization. + + Throw New Exception(Page.GetResourceValue("Err:RecDataSrcNotInitialized", "Persons")) + + End If + Return EvaluateExpressions(url, arg, rec, bEncrypt) + End Function + + + Public Overridable Function GetRecord() As PersonalEducationRecord + If Not Me.DataSource Is Nothing Then + Return Me.DataSource + End If + + If Not Me.RecordUniqueId Is Nothing Then + + Return PersonalEducationTable.GetRecord(Me.RecordUniqueId, True) + + End If + + ' Localization. + + Throw New Exception(Page.GetResourceValue("Err:RetrieveRec", "Persons")) + + End Function + + Public Shadows ReadOnly Property Page() As BaseApplicationPage + Get + Return DirectCast(MyBase.Page, BaseApplicationPage) + End Get + End Property + +#End Region + +End Class + + + +' Base class for the PersonalEducationTableControl control on the ShowPersonalEducationTable page. +' Do not modify this class. Instead override any method in PersonalEducationTableControl. +Public Class BasePersonalEducationTableControl + Inherits Persons.UI.BaseApplicationTableControl + + + + Protected Overridable Sub Control_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Init + + + + ' Setup the filter and search events. + + AddHandler Me.COUNTRYFilter.SelectedIndexChanged, AddressOf COUNTRYFilter_SelectedIndexChanged + AddHandler Me.LevelIdFilter.SelectedIndexChanged, AddressOf LevelIdFilter_SelectedIndexChanged + AddHandler Me.PersonalIdFilter.SelectedIndexChanged, AddressOf PersonalIdFilter_SelectedIndexChanged + If Not Me.Page.IsPostBack Then + Dim initialVal As String = "" + If Me.InSession(Me.COUNTRYFilter) + initialVal = Me.GetFromSession(Me.COUNTRYFilter) + + End If + + If initialVal <> "" + + Me.COUNTRYFilter.Items.Add(New ListItem(initialVal, initialVal)) + + Me.COUNTRYFilter.SelectedValue = initialVal + + End If + + End If + If Not Me.Page.IsPostBack Then + Dim initialVal As String = "" + If Me.InSession(Me.LevelIdFilter) + initialVal = Me.GetFromSession(Me.LevelIdFilter) + + End If + + If initialVal <> "" + + Me.LevelIdFilter.Items.Add(New ListItem(initialVal, initialVal)) + + Me.LevelIdFilter.SelectedValue = initialVal + + End If + + End If + If Not Me.Page.IsPostBack Then + Dim initialVal As String = "" + If Me.InSession(Me.PersonalEducationSearch) + initialVal = Me.GetFromSession(Me.PersonalEducationSearch) + + End If + + If initialVal <> "" + + Me.PersonalEducationSearch.Text = initialVal + + End If + + End If + If Not Me.Page.IsPostBack Then + Dim initialVal As String = "" + If Me.InSession(Me.PersonalIdFilter) + initialVal = Me.GetFromSession(Me.PersonalIdFilter) + + End If + + If initialVal <> "" + + Me.PersonalIdFilter.Items.Add(New ListItem(initialVal, initialVal)) + + Me.PersonalIdFilter.SelectedValue = initialVal + + End If + + End If + + + ' Control Initializations. + ' Initialize the table's current sort order. + + If Me.InSession(Me, "Order_By") Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + Me.CurrentSortOrder.Add(PersonalEducationTable.PersonalId, OrderByItem.OrderDir.Asc) + + Me.CurrentSortOrder.Add(PersonalEducationTable.StartDate, OrderByItem.OrderDir.Asc) + + End If + + + + ' Setup default pagination settings. + + Me.PageSize = CInt(Me.GetFromSession(Me, "Page_Size", "10")) + Me.PageIndex = CInt(Me.GetFromSession(Me, "Page_Index", "0")) + + + + Me.ClearControlsFromSession() + End Sub + + Protected Overridable Sub Control_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load + + SaveControlsToSession_Ajax() + + ' Setup the pagination events. + + AddHandler Me.PersonalEducationPagination.FirstPage.Click, AddressOf PersonalEducationPagination_FirstPage_Click + + AddHandler Me.PersonalEducationPagination.LastPage.Click, AddressOf PersonalEducationPagination_LastPage_Click + + AddHandler Me.PersonalEducationPagination.NextPage.Click, AddressOf PersonalEducationPagination_NextPage_Click + + AddHandler Me.PersonalEducationPagination.PageSizeButton.Click, AddressOf PersonalEducationPagination_PageSizeButton_Click + + AddHandler Me.PersonalEducationPagination.PreviousPage.Click, AddressOf PersonalEducationPagination_PreviousPage_Click + + + ' Setup the sorting events. + + AddHandler Me.CommandDateLabel.Click, AddressOf CommandDateLabel_Click + + AddHandler Me.CommandLabel.Click, AddressOf CommandLabel_Click + + AddHandler Me.COUNTRYLabel.Click, AddressOf COUNTRYLabel_Click + + AddHandler Me.CourseAbbrLabel.Click, AddressOf CourseAbbrLabel_Click + + AddHandler Me.CourseLabel.Click, AddressOf CourseLabel_Click + + AddHandler Me.CourseNoLabel.Click, AddressOf CourseNoLabel_Click + + AddHandler Me.EducationPeriodLabel.Click, AddressOf EducationPeriodLabel_Click + + AddHandler Me.EducationTypeLabel.Click, AddressOf EducationTypeLabel_Click + + AddHandler Me.EdYearLabel.Click, AddressOf EdYearLabel_Click + + AddHandler Me.EndDateLabel.Click, AddressOf EndDateLabel_Click + + AddHandler Me.FacultryLabel.Click, AddressOf FacultryLabel_Click + + AddHandler Me.InstitueLabel.Click, AddressOf InstitueLabel_Click + + AddHandler Me.LevelIdLabel1.Click, AddressOf LevelIdLabel1_Click + + AddHandler Me.NoAllLabel.Click, AddressOf NoAllLabel_Click + + AddHandler Me.PersonalIdLabel1.Click, AddressOf PersonalIdLabel1_Click + + AddHandler Me.ScoreLabel.Click, AddressOf ScoreLabel_Click + + AddHandler Me.ScoreNoLabel.Click, AddressOf ScoreNoLabel_Click + + AddHandler Me.StartDateLabel.Click, AddressOf StartDateLabel_Click + + ' Setup the button events. + + AddHandler Me.PersonalEducationExportCSVButton.Click, AddressOf PersonalEducationExportCSVButton_Click + + AddHandler Me.PersonalEducationExportExcelButton.Click, AddressOf PersonalEducationExportExcelButton_Click + + AddHandler Me.PersonalEducationNewButton.Click, AddressOf PersonalEducationNewButton_Click + + AddHandler Me.PersonalEducationPDFButton.Click, AddressOf PersonalEducationPDFButton_Click + + AddHandler Me.PersonalEducationRefreshButton.Click, AddressOf PersonalEducationRefreshButton_Click + + AddHandler Me.PersonalEducationResetButton.Click, AddressOf PersonalEducationResetButton_Click + + AddHandler Me.PersonalEducationWordButton.Click, AddressOf PersonalEducationWordButton_Click + + AddHandler Me.PersonalEducationSearchButton.Button.Click, AddressOf PersonalEducationSearchButton_Click + + + ' Setup events for others + + End Sub + + + Public Overridable Sub LoadData() + + ' Read data from database. Returns an array of records that can be assigned + ' to the DataSource table control property. + Try + Dim joinFilter As CompoundFilter = CreateCompoundJoinFilter() + + ' The WHERE clause will be empty when displaying all records in table. + Dim wc As WhereClause = CreateWhereClause() + If wc IsNot Nothing AndAlso Not wc.RunQuery Then + ' Initialize an empty array of records + Dim alist As New ArrayList(0) + Me.DataSource = DirectCast(alist.ToArray(GetType(PersonalEducationRecord)), PersonalEducationRecord()) + ' Add records to the list if needed. + Me.AddNewRecords() + Me._TotalRecords = 0 + Me._TotalPages = 0 + Return + End If + + ' Call OrderBy to determine the order - either use the order defined + ' on the Query Wizard, or specified by user (by clicking on column heading) + Dim orderBy As OrderBy = CreateOrderBy() + + ' Get the pagesize from the pagesize control. + Me.GetPageSize() + + If Me.DisplayLastPage Then + Dim totalRecords As Integer = If(Me._TotalRecords < 0, PersonalEducationTable.GetRecordCount(CreateCompoundJoinFilter(), CreateWhereClause()), Me._TotalRecords) + + Dim totalPages As Integer = CInt(Math.Ceiling(totalRecords / Me.PageSize)) + + Me.PageIndex = totalPages - 1 + End If + + ' Make sure PageIndex (current page) and PageSize are within bounds. + If Me.PageIndex < 0 Then + Me.PageIndex = 0 + End If + If Me.PageSize < 1 Then + Me.PageSize = 1 + End If + + ' Retrieve the records and set the table DataSource. + ' Only PageSize records are fetched starting at PageIndex (zero based). + If Me.AddNewRecord > 0 Then + ' Make sure to preserve the previously entered data on new rows. + Dim postdata As New ArrayList + For Each rc As PersonalEducationTableControlRow In Me.GetRecordControls() + If Not rc.IsNewRecord Then + rc.DataSource = rc.GetRecord() + rc.GetUIData() + postdata.Add(rc.DataSource) + UIData.Add(rc.PreservedUIData()) + End If + Next + Me.DataSource = DirectCast(postdata.ToArray(GetType(PersonalEducationRecord)), PersonalEducationRecord()) + Else ' Get the records from the database + Me.DataSource = PersonalEducationTable.GetRecords(joinFilter, wc, orderBy, Me.PageIndex, Me.PageSize) + + End If + + ' if the datasource contains no records contained in database, then load the last page. + If (DbUtils.GetCreatedRecords(Me.DataSource).Length = 0 AndAlso Not Me.DisplayLastPage) Then + Me.DisplayLastPage = True + LoadData() + Else + + ' Add any new rows desired by the user. + Me.AddNewRecords() + + ' Turn off the ToggleAll checkbox + Me.PersonalEducationToggleAll.Checked = False + + + ' Initialize the page and grand totals. now + + End If + + Catch ex As Exception + ' Report the error message to the end user + Dim msg As String = ex.Message + If ex.InnerException IsNot Nothing Then + msg = msg & " InnerException: " & ex.InnerException.Message + End If + Throw New Exception(msg, ex.InnerException) + End Try + End Sub + + + + + Public Overrides Sub DataBind() + ' The DataBind method binds the user interface controls to the values + ' from the database record for each row in the table. To do this, it calls the + ' DataBind for each of the rows. + ' DataBind also populates any filters above the table, and sets the pagination + ' control to the correct number of records and the current page number. + + MyBase.DataBind() + + ' Make sure that the DataSource is initialized. + If Me.DataSource Is Nothing Then + Return + End If + + 'LoadData for DataSource for chart and report if they exist + + ' Improve performance by prefetching display as records. + Me.PreFetchForeignKeyValues() + + ' Setup the pagination controls. + BindPaginationControls() + + + + ' Bind the repeater with the list of records to expand the UI. + Dim rep As System.Web.UI.WebControls.Repeater = CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalEducationTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return + rep.DataSource = DataSource() + rep.DataBind() + + Dim index As Integer = 0 + For Each repItem As System.Web.UI.WebControls.RepeaterItem In rep.Items + ' Loop through all rows in the table, set its DataSource and call DataBind(). + Dim recControl As PersonalEducationTableControlRow = DirectCast(repItem.FindControl("PersonalEducationTableControlRow"), PersonalEducationTableControlRow) + recControl.DataSource = Me.DataSource(index) + If Me.UIData.Count > index Then + recControl.PreviousUIData = Me.UIData(index) + End If + recControl.DataBind() + recControl.Visible = Not Me.InDeletedRecordIds(recControl) + + index += 1 + Next + + + + + ' Call the Set methods for each controls on the panel + + SetCommandDateLabel() + SetCommandLabel() + SetCOUNTRYFilter() + SetCOUNTRYLabel() + SetCOUNTRYLabel1() + SetCourseAbbrLabel() + SetCourseLabel() + SetCourseNoLabel() + SetEducationPeriodLabel() + SetEducationTypeLabel() + SetEdYearLabel() + SetEndDateLabel() + SetFacultryLabel() + SetInstitueLabel() + SetLevelIdFilter() + SetLevelIdLabel() + SetLevelIdLabel1() + SetNoAllLabel() + + + + + + + + SetPersonalEducationSearch() + + SetPersonalEducationTableControlCollapsibleRegion() + SetPersonalEducationTableControlIcon() + SetPersonalEducationTableControlPanelExtender() + + + + SetPersonalIdFilter() + SetPersonalIdLabel() + SetPersonalIdLabel1() + SetScoreLabel() + SetScoreNoLabel() + SetStartDateLabel() + ' setting the state of expand or collapse alternative rows + + + ' Load data for each record and table UI control. + ' Ordering is important because child controls get + ' their parent ids from their parent UI controls. + + + ' this method calls the set method for controls with special formula like running total, sum, rank, etc + SetFormulaControls() + End Sub + + Public Overridable Sub SetFormulaControls() + ' this method calls Set methods for the control that has special formula + + + + End Sub + + + Public Sub PreFetchForeignKeyValues() + If (IsNothing(Me.DataSource)) + Return + End If + + Me.Page.PregetDfkaRecords(PersonalEducationTable.COUNTRY, Me.DataSource) + + Me.Page.PregetDfkaRecords(PersonalEducationTable.EducationPeriod, Me.DataSource) + + Me.Page.PregetDfkaRecords(PersonalEducationTable.LevelId, Me.DataSource) + + Me.Page.PregetDfkaRecords(PersonalEducationTable.PersonalId, Me.DataSource) + + End Sub + + + Public Overridable Sub RegisterPostback() + + Me.Page.RegisterPostBackTrigger(MiscUtils.FindControlRecursively(Me,"PersonalEducationExportCSVButton")) + + Me.Page.RegisterPostBackTrigger(MiscUtils.FindControlRecursively(Me,"PersonalEducationExportExcelButton")) + + Me.Page.RegisterPostBackTrigger(MiscUtils.FindControlRecursively(Me,"PersonalEducationPDFButton")) + + Me.Page.RegisterPostBackTrigger(MiscUtils.FindControlRecursively(Me,"PersonalEducationWordButton")) + + + End Sub + + Public EvaluateFormulaDelegate As BaseClasses.Data.DataSource.EvaluateFormulaDelegate = New BaseClasses.Data.DataSource.EvaluateFormulaDelegate(AddressOf Me.EvaluateFormula) + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean, ByVal e as FormulaEvaluator) As String + If e Is Nothing + e = New FormulaEvaluator() + End If + + e.Variables.Clear() + + + ' add variables for formula evaluation + If variables IsNot Nothing Then + Dim enumerator As System.Collections.Generic.IEnumerator(Of System.Collections.Generic.KeyValuePair(Of String, Object)) = variables.GetEnumerator() + While enumerator.MoveNext() + e.Variables.Add(enumerator.Current.Key, enumerator.Current.Value) + End While + End If + + If includeDS + + End If + + ' All variables referred to in the formula are expected to be + ' properties of the DataSource. For example, referring to + ' UnitPrice as a variable will refer to DataSource.UnitPrice + e.DataSource = dataSourceForEvaluate + + ' Define the calling control. This is used to add other + ' related table and record controls as variables. + e.CallingControl = Me + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + + If Not String.IsNullOrEmpty(format) AndAlso (String.IsNullOrEmpty(formula) OrElse formula.IndexOf("Format(") < 0) Then + Return FormulaUtils.Format(resultObj, format) + Else + Return resultObj.ToString() + End If + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format,variables ,includeDS, Nothing) + End Function + + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object)) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format, variables ,True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, format, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal e as FormulaEvaluator) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, variables, True, e) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal includeDS as Boolean) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, includeDS, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, True, Nothing) + End Function + + + + + Public Overridable Sub ResetControl() + + Me.COUNTRYFilter.ClearSelection() + + Me.LevelIdFilter.ClearSelection() + + Me.PersonalIdFilter.ClearSelection() + + Me.PersonalEducationSearch.Text = "" + + Me.CurrentSortOrder.Reset() + If (Me.InSession(Me, "Order_By")) Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + Me.CurrentSortOrder.Add(PersonalEducationTable.PersonalId, OrderByItem.OrderDir.Asc) + + Me.CurrentSortOrder.Add(PersonalEducationTable.StartDate, OrderByItem.OrderDir.Asc) + + End If + + Me.PageIndex = 0 + End Sub + + Protected Overridable Sub BindPaginationControls() + ' Setup the pagination controls. + + ' Bind the pagination labels. + + If DbUtils.GetCreatedRecords(Me.DataSource).Length > 0 Then + + Me.PersonalEducationPagination.CurrentPage.Text = (Me.PageIndex + 1).ToString() + Else + Me.PersonalEducationPagination.CurrentPage.Text = "0" + End If + Me.PersonalEducationPagination.PageSize.Text = Me.PageSize.ToString() + Me.PersonalEducationPagination.TotalItems.Text = Me.TotalRecords.ToString() + Me.PersonalEducationPagination.TotalPages.Text = Me.TotalPages.ToString() + + ' Bind the buttons for PersonalEducationTableControl pagination. + + Me.PersonalEducationPagination.FirstPage.Enabled = Not (Me.PageIndex = 0) + If Me._TotalPages < 0 Then ' if the total pages is not determined yet, enable last and next buttons + Me.PersonalEducationPagination.LastPage.Enabled = True + ElseIf Me._TotalPages = 0 ' if the total pages is determined and it is 0, enable last and next buttons + Me.PersonalEducationPagination.LastPage.Enabled = False + Else ' if the total pages is the last page, disable last and next buttons + Me.PersonalEducationPagination.LastPage.Enabled = Not (Me.PageIndex = Me.TotalPages - 1) + End If + + If Me._TotalPages < 0 Then ' if the total pages is not determined yet, enable last and next buttons + Me.PersonalEducationPagination.NextPage.Enabled = True + ElseIf Me._TotalPages = 0 ' if the total pages is determined and it is 0, enable last and next buttons + Me.PersonalEducationPagination.NextPage.Enabled = False + Else ' if the total pages is the last page, disable last and next buttons + Me.PersonalEducationPagination.NextPage.Enabled = Not (Me.PageIndex = Me.TotalPages - 1) + End If + + Me.PersonalEducationPagination.PreviousPage.Enabled = Not (Me.PageIndex = 0) + + + End Sub + + Public Overridable Sub SaveData() + ' Save the data from the entire table. Calls each row's Save Data + ' to save their data. This function is called by the Click handler of the + ' Save button. The button handler should Start/Commit/End a transaction. + + Dim recCtl As PersonalEducationTableControlRow + For Each recCtl In Me.GetRecordControls() + + If Me.InDeletedRecordIds(recCtl) Then + ' Delete any pending deletes. + recCtl.Delete() + Else + If recCtl.Visible Then + recCtl.SaveData() + End If + End If + + Next + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + ' Set IsNewRecord to False for all records - since everything has been saved and is no longer "new" + For Each recCtl In Me.GetRecordControls() + recCtl.IsNewRecord = False + Next + + + ' Set DeletedRecordsIds to Nothing since we have deleted all pending deletes. + Me.DeletedRecordIds = Nothing + + End Sub + + Public Overridable Function CreateCompoundJoinFilter() As CompoundFilter + Dim jFilter As CompoundFilter = New CompoundFilter() + + Return jFilter + + End Function + + + Public Overridable Function CreateOrderBy() As OrderBy + ' The CurrentSortOrder is initialized to the sort order on the + ' Query Wizard. It may be modified by the Click handler for any of + ' the column heading to sort or reverse sort by that column. + ' You can add your own sort order, or modify it on the Query Wizard. + Return Me.CurrentSortOrder + End Function + + Public Overridable Function CreateWhereClause() As WhereClause + 'This CreateWhereClause is used for loading the data. + PersonalEducationTable.Instance.InnerFilter = Nothing + Dim wc As WhereClause = New WhereClause() + + ' Compose the WHERE clause consiting of: + ' 1. Static clause defined at design time. + ' 2. User selected search criteria. + ' 3. User selected filter criteria. + + + If IsValueSelected(Me.COUNTRYFilter) Then + + wc.iAND(PersonalEducationTable.COUNTRY, BaseFilter.ComparisonOperator.Not_Equals, MiscUtils.GetSelectedValue(Me.COUNTRYFilter, Me.GetFromSession(Me.COUNTRYFilter)), False, False) + + End If + + + + If IsValueSelected(Me.LevelIdFilter) Then + + wc.iAND(PersonalEducationTable.LevelId, BaseFilter.ComparisonOperator.EqualsTo, MiscUtils.GetSelectedValue(Me.LevelIdFilter, Me.GetFromSession(Me.LevelIdFilter)), False, False) + + End If + + + + If IsValueSelected(Me.PersonalEducationSearch) Then + If Me.PersonalEducationSearch.Text = BaseClasses.Resources.AppResources.GetResourceValue("Txt:SearchForEllipsis", Nothing) Then + Me.PersonalEducationSearch.Text = "" + Else + ' Strip "..." from begin and ending of the search text, otherwise the search will return 0 values as in database "..." is not stored. + + If Me.PersonalEducationSearch.Text.StartsWith("...") Then + Me.PersonalEducationSearch.Text = Me.PersonalEducationSearch.Text.SubString(3,Me.PersonalEducationSearch.Text.Length-3) + End If + If Me.PersonalEducationSearch.Text.EndsWith("...") then + Me.PersonalEducationSearch.Text = Me.PersonalEducationSearch.Text.SubString(0,Me.PersonalEducationSearch.Text.Length-3) + ' Strip the last word as well as it is likely only a partial word + Dim endindex As Integer = PersonalEducationSearch.Text.Length - 1 + While (Not Char.IsWhiteSpace(PersonalEducationSearch.Text(endindex)) AndAlso endindex > 0) + endindex -= 1 + End While + If endindex > 0 Then + PersonalEducationSearch.Text = PersonalEducationSearch.Text.Substring(0, endindex) + End If + End If + End If + + Dim formatedSearchText As String = MiscUtils.GetSelectedValue(Me.PersonalEducationSearch, Me.GetFromSession(Me.PersonalEducationSearch)) + + ' After stripping "..." see if the search text is null or empty. + If IsValueSelected(Me.PersonalEducationSearch) Then + ' These clauses are added depending on operator and fields selected in Control's property page, bindings tab. + + Dim search As WhereClause = New WhereClause() + + search.iOR(PersonalEducationTable.PersonalId, BaseFilter.ComparisonOperator.Contains, MiscUtils.GetSelectedValue(Me.PersonalEducationSearch, Me.GetFromSession(Me.PersonalEducationSearch)), True, False) + + wc.iAND(search) + + End If + End If + + If IsValueSelected(Me.PersonalIdFilter) Then + + wc.iAND(PersonalEducationTable.PersonalId, BaseFilter.ComparisonOperator.EqualsTo, MiscUtils.GetSelectedValue(Me.PersonalIdFilter, Me.GetFromSession(Me.PersonalIdFilter)), False, False) + + End If + + + + Return wc + End Function + + + Public Overridable Function CreateWhereClause(ByVal searchText as String, ByVal fromSearchControl as String, ByVal AutoTypeAheadSearch as String, ByVal AutoTypeAheadWordSeparators as String) As WhereClause + ' This CreateWhereClause is used for loading list of suggestions for Auto Type-Ahead feature. + PersonalEducationTable.Instance.InnerFilter = Nothing + Dim wc As WhereClause = New WhereClause() + + ' Compose the WHERE clause consiting of: + ' 1. Static clause defined at design time. + ' 2. User selected search criteria. + ' 3. User selected filter criteria. + + Dim appRelativeVirtualPath As String = CType(HttpContext.Current.Session("AppRelativeVirtualPath"), String) + + ' Adds clauses if values are selected in Filter controls which are configured in the page. + + Dim COUNTRYFilterSelectedValue As String = CType(HttpContext.Current.Session()(HttpContext.Current.Session.SessionID & appRelativeVirtualPath & "COUNTRYFilter_Ajax"), String) + If IsValueSelected(COUNTRYFilterSelectedValue) Then + + wc.iAND(PersonalEducationTable.COUNTRY, BaseFilter.ComparisonOperator.Not_Equals, COUNTRYFilterSelectedValue, false, False) + + End If + + Dim LevelIdFilterSelectedValue As String = CType(HttpContext.Current.Session()(HttpContext.Current.Session.SessionID & appRelativeVirtualPath & "LevelIdFilter_Ajax"), String) + If IsValueSelected(LevelIdFilterSelectedValue) Then + + wc.iAND(PersonalEducationTable.LevelId, BaseFilter.ComparisonOperator.EqualsTo, LevelIdFilterSelectedValue, false, False) + + End If + + If IsValueSelected(searchText) and fromSearchControl = "PersonalEducationSearch" Then + Dim formatedSearchText as String = searchText + ' Strip "..." from begin and ending of the search text, otherwise the search will return 0 values as in database "..." is not stored. + If searchText.StartsWith("...") Then + formatedSearchText = searchText.SubString(3,searchText.Length-3) + End If + If searchText.EndsWith("...") Then + formatedSearchText = searchText.SubString(0,searchText.Length-3) + ' Strip the last word as well as it is likely only a partial word + Dim endindex As Integer = searchText.Length - 1 + While (Not Char.IsWhiteSpace(searchText(endindex)) AndAlso endindex > 0) + endindex -= 1 + End While + If endindex > 0 Then + searchText = searchText.Substring(0, endindex) + End If + End If + 'After stripping "...", trim any leading and trailing whitespaces + formatedSearchText = formatedSearchText.Trim() + ' After stripping "..." see if the search text is null or empty. + If IsValueSelected(formatedSearchText) Then + ' These clauses are added depending on operator and fields selected in Control's property page, bindings tab. + + Dim search As WhereClause = New WhereClause() + + If InvariantLCase(AutoTypeAheadSearch).equals("wordsstartingwithsearchstring") Then + + search.iOR(PersonalEducationTable.PersonalId, BaseFilter.ComparisonOperator.Starts_With, formatedSearchText, True, False) + search.iOR(PersonalEducationTable.PersonalId, BaseFilter.ComparisonOperator.Contains, AutoTypeAheadWordSeparators & formatedSearchText, True, False) + + Else + + search.iOR(PersonalEducationTable.PersonalId, BaseFilter.ComparisonOperator.Contains, formatedSearchText, True, False) + End If + wc.iAND(search) + + End If + End If + + Dim PersonalIdFilterSelectedValue As String = CType(HttpContext.Current.Session()(HttpContext.Current.Session.SessionID & appRelativeVirtualPath & "PersonalIdFilter_Ajax"), String) + If IsValueSelected(PersonalIdFilterSelectedValue) Then + + wc.iAND(PersonalEducationTable.PersonalId, BaseFilter.ComparisonOperator.EqualsTo, PersonalIdFilterSelectedValue, false, False) + + End If + + + Return wc + End Function + + Public Overridable Function GetAutoCompletionList_PersonalEducationSearch(ByVal prefixText As String, ByVal count As Integer) As String() + Dim resultList As ArrayList = New ArrayList + Dim wordList As ArrayList = New ArrayList + Dim iteration As Integer = 0 + + Dim filterJoin As CompoundFilter = CreateCompoundJoinFilter() + Dim wc As WhereClause = CreateWhereClause(prefixText,"PersonalEducationSearch", "WordsStartingWithSearchString", "[^a-zA-Z0-9]") + While (resultList.Count < count AndAlso iteration < 5) + ' Fetch 100 records in each iteration + Dim recordList () As Persons.Business.PersonalEducationRecord = PersonalEducationTable.GetRecords(filterJoin, wc, Nothing, iteration, 100) + Dim rec As PersonalEducationRecord = Nothing + Dim resultItem As String = "" + For Each rec In recordList + ' Exit the loop if recordList count has reached AutoTypeAheadListSize. + If resultList.Count >= count then + Exit For + End If + ' If the field is configured to Display as Foreign key, Format() method returns the + ' Display as Forien Key value instead of original field value. + ' Since search had to be done in multiple fields (selected in Control's page property, binding tab) in a record, + ' We need to find relevent field to display which matches the prefixText and is not already present in the result list. + + resultItem = rec.Format(PersonalEducationTable.PersonalId) + If resultItem IsNot Nothing AndAlso resultItem.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture).Contains(prefixText.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture)) Then + + Dim isAdded As Boolean = FormatSuggestions(prefixText, resultItem, 50, "AtBeginningOfMatchedString", "WordsStartingWithSearchString", "[^a-zA-Z0-9]", resultList) + If isAdded Then + Continue For + End If + End If + + Next + ' Exit the loop if number of records found is less as further iteration will not return any more records + If recordList .Length < 100 Then + Exit While + End If + iteration += 1 + End While + + resultList.Sort() + Dim result() As String = New String(resultList.Count - 1) {} + Array.Copy(resultList.ToArray, result, resultList.Count) + Return result + End Function + + + Public Overridable Function FormatSuggestions(ByVal prefixText As String, ByVal resultItem As String, _ + ByVal columnLength As Integer, ByVal AutoTypeAheadDisplayFoundText As String, _ + ByVal autoTypeAheadSearch As String, ByVal AutoTypeAheadWordSeparators As String, _ + ByVal resultList As ArrayList) As Boolean + + 'Formats the resultItem and adds it to the list of suggestions. + Dim index As Integer = resultItem.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture).IndexOf(prefixText.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture)) + Dim itemToAdd As String = "" + Dim isFound As Boolean = False + Dim isAdded As Boolean = False + ' Get the index where prfixt is at the beginning of resultItem. If not found then, index of word which begins with prefixText. + If InvariantLCase(autoTypeAheadSearch).equals("wordsstartingwithsearchstring") And Not index = 0 Then + ' Expression to find word which contains AutoTypeAheadWordSeparators followed by prefixText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex( AutoTypeAheadWordSeparators + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + If regex1.IsMatch(resultItem) Then + index = regex1.Match(resultItem).Index + isFound = True + End If + ' If the prefixText is found immediatly after white space then starting of the word is found so don not search any further + If not resultItem(index).ToString() = " " Then + ' Expression to find beginning of the word which contains AutoTypeAheadWordSeparators followed by prefixText + Dim regex As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\\S*" + AutoTypeAheadWordSeparators + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + If regex.IsMatch(resultItem) Then + index = regex.Match(resultItem).Index + isFound = True + End If + End If + End If + + ' If autoTypeAheadSearch value is wordsstartingwithsearchstring then, extract the substring only if the prefixText is found at the + ' beginning of the resultItem (index = 0) or a word in resultItem is found starts with prefixText. + If index = 0 Or isFound Or InvariantLCase(autoTypeAheadSearch).Equals("anywhereinstring") then + If InvariantLCase(AutoTypeAheadDisplayFoundText).equals("atbeginningofmatchedstring") Then + ' Expression to find beginning of the word which contains prefixText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\\S*" + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + ' Find the beginning of the word which contains prefexText + If (StringUtils.InvariantLCase(autoTypeAheadSearch).Equals("anywhereinstring") AndAlso regex1.IsMatch(resultItem)) Then + index = regex1.Match(resultItem).Index + isFound = True + End If + ' Display string from the index till end of the string if sub string from index till end is less than columnLength value. + If Len(resultItem) - index <= columnLength Then + If index = 0 Then + itemToAdd = resultItem + Else + itemToAdd = "..." & resultItem.Substring(index, Len(resultItem) - index) + End If + Else + If index = 0 Then + itemToAdd = resultItem.Substring(index, (columnLength - 3)) & "..." + Else + 'Truncate the string to show only columnLength - 6 characters as begining and trailing "..." has to be appended. + itemToAdd = "..." & resultItem.Substring(index , columnLength - 6) & "..." + End If + End If + ElseIf InvariantLCase(AutoTypeAheadDisplayFoundText).equals("inmiddleofmatchedstring") Then + Dim subStringBeginIndex As Integer = CType(columnLength/2, Integer) + If Len(resultItem) <= columnLength Then + itemToAdd = resultItem + Else + ' Sanity check at end of the string + If index + Len(prefixText) = columnLength Then + itemToAdd = "..." & resultItem.Substring(index-columnLength,index) + ElseIf Len(resultItem) - index < subStringBeginIndex Then + ' Display string from the end till columnLength value if, index is closer to the end of the string. + itemToAdd = "..." & resultItem.Substring(Len(resultItem)-columnLength,Len(resultItem)) + ElseIf index <= subStringBeginIndex Then + ' Sanity chet at beginning of the string + itemToAdd = resultItem.Substring(0, columnLength) & "..." + Else + ' Display string containing text before the prefixText occures and text after the prefixText + itemToAdd = "..." & resultItem.Substring(index - subStringBeginIndex, columnLength) & "..." + End If + End If + ElseIf InvariantLCase(AutoTypeAheadDisplayFoundText).equals("atendofmatchedstring") Then + ' Expression to find ending of the word which contains prefexText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\s", System.Text.RegularExpressions.RegexOptions.IgnoreCase) + ' Find the ending of the word which contains prefexText + If regex1.IsMatch(resultItem, index + 1) Then + index = regex1.Match(resultItem, index + 1).Index + Else + ' If the word which contains prefexText is the last word in string, regex1.IsMatch returns false. + index = resultItem.Length + End If + If index > Len(resultItem) Then + index = Len(resultItem) + End If + ' If text from beginning of the string till index is less than columnLength value then, display string from the beginning till index. + If index <= columnLength Then + if index = Len(resultItem) Then 'Make decision to append "..." + itemToAdd = resultItem.Substring(0,index) + Else + itemToAdd = resultItem.Substring(0,index) & "..." + End If + Else + If index = Len(resultItem) Then + itemToAdd = "..." & resultItem.Substring(index - (columnLength - 3), (columnLength - 3)) + Else + 'Truncate the string to show only columnLength - 6 characters as begining and trailing "..." has to be appended. + itemToAdd = "..." & resultItem.Substring(index - (columnLength - 6), columnLength - 6) & "..." + End If + End If + End If + + ' Remove newline character from itemToAdd + Dim prefixTextIndex As Integer = itemToAdd.IndexOf(prefixText, StringComparison.CurrentCultureIgnoreCase) + ' If itemToAdd contains any newline after the search text then show text only till newline + Dim regex2 As System.Text.RegularExpressions.Regex = New System.Text.RegularExpressions.Regex("(" & vbCrLf & "|" & vbLf & ")", System.Text.RegularExpressions.RegexOptions.IgnoreCase) + Dim newLineIndexAfterPrefix As Integer = -1 + If regex2.IsMatch(itemToAdd, prefixTextIndex) Then + newLineIndexAfterPrefix = regex2.Match(itemToAdd, prefixTextIndex).Index + End If + If (newLineIndexAfterPrefix > -1) Then + If itemToAdd.EndsWith("...") Then + itemToAdd = (itemToAdd.Substring(0, newLineIndexAfterPrefix) + "...") + Else + itemToAdd = itemToAdd.Substring(0, newLineIndexAfterPrefix) + End If + End If + ' If itemToAdd contains any newline before search text then show text which comes after newline + Dim regex3 As System.Text.RegularExpressions.Regex = New System.Text.RegularExpressions.Regex("(" & vbCrLf & "|" & vbLf & ")", (System.Text.RegularExpressions.RegexOptions.IgnoreCase Or System.Text.RegularExpressions.RegexOptions.RightToLeft)) + Dim newLineIndexBeforePrefix As Integer = -1 + If regex3.IsMatch(itemToAdd, prefixTextIndex) Then + newLineIndexBeforePrefix = regex3.Match(itemToAdd, prefixTextIndex).Index + End If + If (newLineIndexBeforePrefix > -1) Then + If itemToAdd.StartsWith("...") Then + itemToAdd = ("..." + itemToAdd.Substring((newLineIndexBeforePrefix + regex3.Match(itemToAdd, prefixTextIndex).Length))) + Else + itemToAdd = itemToAdd.Substring((newLineIndexBeforePrefix + regex3.Match(itemToAdd, prefixTextIndex).Length)) + End If + End If + + If Not itemToAdd is nothing AndAlso Not resultList.Contains(itemToAdd) Then + + resultList.Add(itemToAdd) + + isAdded = true + End If + End If + Return isAdded + End Function + + + Protected Overridable Sub GetPageSize() + + If Me.PersonalEducationPagination.PageSize.Text.Trim <> "" Then + Try + 'Me.PageSize = Integer.Parse(Me.PersonalEducationPagination.PageSize.Text) + Catch ex As Exception + End Try + End If + End Sub + + Protected Overridable Sub AddNewRecords() + + Dim newRecordList As ArrayList = New ArrayList() + + Dim newUIDataList As System.Collections.Generic.List(Of Hashtable) = New System.Collections.Generic.List(Of Hashtable)() + + ' Loop though all the record controls and if the record control + ' does not have a unique record id set, then create a record + ' and add to the list. + If Not Me.ResetData Then + Dim rep As System.Web.UI.WebControls.Repeater = CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalEducationTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return + + Dim repItem As System.Web.UI.WebControls.RepeaterItem + For Each repItem In rep.Items + ' Loop through all rows in the table, set its DataSource and call DataBind(). + + Dim recControl As PersonalEducationTableControlRow = DirectCast(repItem.FindControl("PersonalEducationTableControlRow"), PersonalEducationTableControlRow) + + If recControl.Visible AndAlso recControl.IsNewRecord() Then + + Dim rec As PersonalEducationRecord = New PersonalEducationRecord() + + If recControl.Command.Text <> "" Then + rec.Parse(recControl.Command.Text, PersonalEducationTable.Command) + End If + If recControl.CommandDate.Text <> "" Then + rec.Parse(recControl.CommandDate.Text, PersonalEducationTable.CommandDate) + End If + If recControl.COUNTRY.Text <> "" Then + rec.Parse(recControl.COUNTRY.Text, PersonalEducationTable.COUNTRY) + End If + If recControl.Course.Text <> "" Then + rec.Parse(recControl.Course.Text, PersonalEducationTable.Course) + End If + If recControl.CourseAbbr.Text <> "" Then + rec.Parse(recControl.CourseAbbr.Text, PersonalEducationTable.CourseAbbr) + End If + If recControl.CourseNo.Text <> "" Then + rec.Parse(recControl.CourseNo.Text, PersonalEducationTable.CourseNo) + End If + If recControl.EducationPeriod.Text <> "" Then + rec.Parse(recControl.EducationPeriod.Text, PersonalEducationTable.EducationPeriod) + End If + If recControl.EducationType.Text <> "" Then + rec.Parse(recControl.EducationType.Text, PersonalEducationTable.EducationType) + End If + If recControl.EdYear.Text <> "" Then + rec.Parse(recControl.EdYear.Text, PersonalEducationTable.EdYear) + End If + If recControl.EndDate.Text <> "" Then + rec.Parse(recControl.EndDate.Text, PersonalEducationTable.EndDate) + End If + If recControl.Facultry.Text <> "" Then + rec.Parse(recControl.Facultry.Text, PersonalEducationTable.Facultry) + End If + If recControl.Institue.Text <> "" Then + rec.Parse(recControl.Institue.Text, PersonalEducationTable.Institue) + End If + If recControl.LevelId.Text <> "" Then + rec.Parse(recControl.LevelId.Text, PersonalEducationTable.LevelId) + End If + If recControl.NoAll.Text <> "" Then + rec.Parse(recControl.NoAll.Text, PersonalEducationTable.NoAll) + End If + If recControl.PersonalId.Text <> "" Then + rec.Parse(recControl.PersonalId.Text, PersonalEducationTable.PersonalId) + End If + If recControl.Score.Text <> "" Then + rec.Parse(recControl.Score.Text, PersonalEducationTable.Score) + End If + If recControl.ScoreNo.Text <> "" Then + rec.Parse(recControl.ScoreNo.Text, PersonalEducationTable.ScoreNo) + End If + If recControl.StartDate.Text <> "" Then + rec.Parse(recControl.StartDate.Text, PersonalEducationTable.StartDate) + End If + newUIDataList.Add(recControl.PreservedUIData()) + newRecordList.Add(rec) + End If + Next + End If + + + ' Add any new record to the list. + Dim index As Integer = 0 + For index = 1 To Me.AddNewRecord + + newRecordList.Insert(0, New PersonalEducationRecord()) + newUIDataList.Insert(0, New Hashtable()) + + Next + Me.AddNewRecord = 0 + + ' Finally, add any new records to the DataSource. + If newRecordList.Count > 0 Then + + Dim finalList As ArrayList = New ArrayList(Me.DataSource) + finalList.InsertRange(0, newRecordList) + + Me.DataSource = DirectCast(finalList.ToArray(GetType(PersonalEducationRecord)), PersonalEducationRecord()) + + End If + + ' Add the existing UI data to this hash table + If newUIDataList.Count > 0 Then + Me.UIData.InsertRange(0, newUIDataList) + End If + + End Sub + + + Public Sub AddToDeletedRecordIds(ByVal rec As PersonalEducationTableControlRow) + If rec.IsNewRecord() Then + Return + End If + + If Not Me.DeletedRecordIds Is Nothing AndAlso Me.DeletedRecordIds.Trim <> "" Then + Me.DeletedRecordIds &= "," + End If + + Me.DeletedRecordIds &= "[" & rec.RecordUniqueId & "]" + End Sub + + Protected Overridable Function InDeletedRecordIds(ByVal rec As PersonalEducationTableControlRow) As Boolean + If Me.DeletedRecordIds Is Nothing OrElse Me.DeletedRecordIds.Trim = "" Then + Return False + End If + + Return Me.DeletedRecordIds.IndexOf("[" & rec.RecordUniqueId & "]") >= 0 + End Function + + Private _DeletedRecordIds As String + Public Property DeletedRecordIds() As String + Get + Return Me._DeletedRecordIds + End Get + Set(ByVal value As String) + Me._DeletedRecordIds = value + End Set + End Property + + + ' Create Set, WhereClause, and Populate Methods + + Public Overridable Sub SetCommandDateLabel() + + End Sub + + Public Overridable Sub SetCommandLabel() + + End Sub + + Public Overridable Sub SetCOUNTRYLabel() + + End Sub + + Public Overridable Sub SetCOUNTRYLabel1() + + 'Code for the text property is generated inside the .aspx file. + 'To override this property you can uncomment the following property and add your own value. + 'Me.COUNTRYLabel1.Text = "Some value" + + End Sub + + Public Overridable Sub SetCourseAbbrLabel() + + End Sub + + Public Overridable Sub SetCourseLabel() + + End Sub + + Public Overridable Sub SetCourseNoLabel() + + End Sub + + Public Overridable Sub SetEducationPeriodLabel() + + End Sub + + Public Overridable Sub SetEducationTypeLabel() + + End Sub + + Public Overridable Sub SetEdYearLabel() + + End Sub + + Public Overridable Sub SetEndDateLabel() + + End Sub + + Public Overridable Sub SetFacultryLabel() + + End Sub + + Public Overridable Sub SetInstitueLabel() + + End Sub + + Public Overridable Sub SetLevelIdLabel() + + End Sub + + Public Overridable Sub SetLevelIdLabel1() + + End Sub + + Public Overridable Sub SetNoAllLabel() + + End Sub + + Public Overridable Sub SetPersonalEducationTableControlCollapsibleRegion() + + End Sub + + Public Overridable Sub SetPersonalEducationTableControlIcon() + + End Sub + + Public Overridable Sub SetPersonalEducationTableControlPanelExtender() + + End Sub + + Public Overridable Sub SetPersonalIdLabel() + + End Sub + + Public Overridable Sub SetPersonalIdLabel1() + + End Sub + + Public Overridable Sub SetScoreLabel() + + End Sub + + Public Overridable Sub SetScoreNoLabel() + + End Sub + + Public Overridable Sub SetStartDateLabel() + + End Sub + + Public Overridable Sub SetCOUNTRYFilter() + + Me.PopulateCOUNTRYFilter(GetSelectedValue(Me.COUNTRYFilter, GetFromSession(Me.COUNTRYFilter)), 500) + + End Sub + + Public Overridable Sub SetLevelIdFilter() + + Me.PopulateLevelIdFilter(GetSelectedValue(Me.LevelIdFilter, GetFromSession(Me.LevelIdFilter)), 500) + + End Sub + + Public Overridable Sub SetPersonalEducationSearch() + + End Sub + + Public Overridable Sub SetPersonalIdFilter() + + Me.PopulatePersonalIdFilter(GetSelectedValue(Me.PersonalIdFilter, GetFromSession(Me.PersonalIdFilter)), 500) + + End Sub + + ' Get the filters' data for COUNTRYFilter + Protected Overridable Sub PopulateCOUNTRYFilter(ByVal selectedValue As String, ByVal maxItems As Integer) + + + Me.COUNTRYFilter.Items.Clear() + + + + ' Set up the WHERE and the ORDER BY clause by calling the CreateWhereClause_COUNTRYFilter function. + ' It is better to customize the where clause there. + + + + 'Setup the WHERE clause. + Dim wc As WhereClause = Me.CreateWhereClause_COUNTRYFilter() + + ' Setup the static list items + + ' Add the All item. + Me.COUNTRYFilter.Items.Insert(0, new ListItem(Me.Page.GetResourceValue("Txt:All", "Persons"), "--ANY--")) + + + Dim orderBy As OrderBy = New OrderBy(false, false) + orderBy.Add(CountryTable.Country, OrderByItem.OrderDir.Asc) + + Dim variables As System.Collections.Generic.IDictionary(Of String, Object) = New System.Collections.Generic.Dictionary(Of String, Object) + + + + Dim noValueFormat As String = Page.GetResourceValue("Txt:Other", "Persons") + + + Dim itemValues() As CountryRecord = Nothing + + If wc.RunQuery + Dim counter As Integer = 0 + Dim pageNum As Integer = 0 + Dim evaluator As New FormulaEvaluator + Dim listDuplicates As New ArrayList() + + + + Do + + itemValues = CountryTable.GetRecords(wc, orderBy, pageNum, maxItems) + + For each itemValue As CountryRecord In itemValues + ' Create the item and add to the list. + Dim cvalue As String = Nothing + Dim fvalue As String = Nothing + If itemValue.CountryIdSpecified Then + cvalue = itemValue.CountryId.ToString() + + If counter < maxItems AndAlso Me.COUNTRYFilter.Items.FindByValue(cvalue) Is Nothing Then + + Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalEducationTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalEducationTable.COUNTRY) + If _isExpandableNonCompositeForeignKey AndAlso PersonalEducationTable.COUNTRY.IsApplyDisplayAs Then + fvalue = PersonalEducationTable.GetDFKA(itemValue, PersonalEducationTable.COUNTRY) + End If + If (Not _isExpandableNonCompositeForeignKey) Or (String.IsNullOrEmpty(fvalue)) Then + fvalue = itemValue.Format(CountryTable.Country) + End If + + If fvalue Is Nothing OrElse fvalue.Trim() = "" Then fvalue = cvalue + + If (IsNothing(fvalue)) Then + fvalue = "" + End If + + fvalue = fvalue.Trim() + + If ( fvalue.Length > 50 ) Then + fvalue = fvalue.Substring(0, 50) & "..." + End If + + Dim dupItem As ListItem = Me.COUNTRYFilter.Items.FindByText(fvalue) + + If Not IsNothing(dupItem) Then + listDuplicates.Add(fvalue) + dupItem.Text = fvalue & " (ID " & dupItem.Value.Substring(0, Math.Min(dupItem.Value.Length,38)) & ")" + End If + + Dim newItem As ListItem = New ListItem(fvalue, cvalue) + Me.COUNTRYFilter.Items.Add(newItem) + + If listDuplicates.Contains(fvalue) Then + newItem.Text = fvalue & " (ID " & cvalue.Substring(0, Math.Min(cvalue.Length,38)) & ")" + End If + + counter += 1 + End If + End If + Next + pageNum += 1 + Loop While (itemValues.Length = maxItems AndAlso counter < maxItems) + End If + + + + + + + ' Set the selected value. + SetSelectedValue(Me.COUNTRYFilter, selectedValue) + + + End Sub + + ' Get the filters' data for LevelIdFilter + Protected Overridable Sub PopulateLevelIdFilter(ByVal selectedValue As String, ByVal maxItems As Integer) + + + Me.LevelIdFilter.Items.Clear() + + + + ' Set up the WHERE and the ORDER BY clause by calling the CreateWhereClause_LevelIdFilter function. + ' It is better to customize the where clause there. + + + + 'Setup the WHERE clause. + Dim wc As WhereClause = Me.CreateWhereClause_LevelIdFilter() + + ' Setup the static list items + + ' Add the All item. + Me.LevelIdFilter.Items.Insert(0, new ListItem(Me.Page.GetResourceValue("Txt:All", "Persons"), "--ANY--")) + + + Dim orderBy As OrderBy = New OrderBy(false, false) + orderBy.Add(EducationTable.Level, OrderByItem.OrderDir.Asc) + + Dim variables As System.Collections.Generic.IDictionary(Of String, Object) = New System.Collections.Generic.Dictionary(Of String, Object) + + + + Dim noValueFormat As String = Page.GetResourceValue("Txt:Other", "Persons") + + + Dim itemValues() As EducationRecord = Nothing + + If wc.RunQuery + Dim counter As Integer = 0 + Dim pageNum As Integer = 0 + Dim evaluator As New FormulaEvaluator + Dim listDuplicates As New ArrayList() + + + + Do + + itemValues = EducationTable.GetRecords(wc, orderBy, pageNum, maxItems) + + For each itemValue As EducationRecord In itemValues + ' Create the item and add to the list. + Dim cvalue As String = Nothing + Dim fvalue As String = Nothing + If itemValue.EducationIdSpecified Then + cvalue = itemValue.EducationId.ToString() + + If counter < maxItems AndAlso Me.LevelIdFilter.Items.FindByValue(cvalue) Is Nothing Then + + Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalEducationTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalEducationTable.LevelId) + If _isExpandableNonCompositeForeignKey AndAlso PersonalEducationTable.LevelId.IsApplyDisplayAs Then + fvalue = PersonalEducationTable.GetDFKA(itemValue, PersonalEducationTable.LevelId) + End If + If (Not _isExpandableNonCompositeForeignKey) Or (String.IsNullOrEmpty(fvalue)) Then + fvalue = itemValue.Format(EducationTable.Level) + End If + + If fvalue Is Nothing OrElse fvalue.Trim() = "" Then fvalue = cvalue + + If (IsNothing(fvalue)) Then + fvalue = "" + End If + + fvalue = fvalue.Trim() + + If ( fvalue.Length > 50 ) Then + fvalue = fvalue.Substring(0, 50) & "..." + End If + + Dim dupItem As ListItem = Me.LevelIdFilter.Items.FindByText(fvalue) + + If Not IsNothing(dupItem) Then + listDuplicates.Add(fvalue) + dupItem.Text = fvalue & " (ID " & dupItem.Value.Substring(0, Math.Min(dupItem.Value.Length,38)) & ")" + End If + + Dim newItem As ListItem = New ListItem(fvalue, cvalue) + Me.LevelIdFilter.Items.Add(newItem) + + If listDuplicates.Contains(fvalue) Then + newItem.Text = fvalue & " (ID " & cvalue.Substring(0, Math.Min(cvalue.Length,38)) & ")" + End If + + counter += 1 + End If + End If + Next + pageNum += 1 + Loop While (itemValues.Length = maxItems AndAlso counter < maxItems) + End If + + + + + + + ' Set the selected value. + SetSelectedValue(Me.LevelIdFilter, selectedValue) + + + End Sub + + ' Get the filters' data for PersonalIdFilter + Protected Overridable Sub PopulatePersonalIdFilter(ByVal selectedValue As String, ByVal maxItems As Integer) + + + Me.PersonalIdFilter.Items.Clear() + + + + ' Set up the WHERE and the ORDER BY clause by calling the CreateWhereClause_PersonalIdFilter function. + ' It is better to customize the where clause there. + + + + 'Setup the WHERE clause. + Dim wc As WhereClause = Me.CreateWhereClause_PersonalIdFilter() + + ' Setup the static list items + + ' Add the All item. + Me.PersonalIdFilter.Items.Insert(0, new ListItem(Me.Page.GetResourceValue("Txt:All", "Persons"), "--ANY--")) + + + Dim orderBy As OrderBy = New OrderBy(false, false) + orderBy.Add(PersonalIdTable.PersonalName, OrderByItem.OrderDir.Asc) + + Dim variables As System.Collections.Generic.IDictionary(Of String, Object) = New System.Collections.Generic.Dictionary(Of String, Object) + + + + Dim noValueFormat As String = Page.GetResourceValue("Txt:Other", "Persons") + + + Dim itemValues() As PersonalIdRecord = Nothing + + If wc.RunQuery + Dim counter As Integer = 0 + Dim pageNum As Integer = 0 + Dim evaluator As New FormulaEvaluator + Dim listDuplicates As New ArrayList() + + + + Do + + itemValues = PersonalIdTable.GetRecords(wc, orderBy, pageNum, maxItems) + + For each itemValue As PersonalIdRecord In itemValues + ' Create the item and add to the list. + Dim cvalue As String = Nothing + Dim fvalue As String = Nothing + If itemValue.PersonalIdSpecified Then + cvalue = itemValue.PersonalId.ToString() + + If counter < maxItems AndAlso Me.PersonalIdFilter.Items.FindByValue(cvalue) Is Nothing Then + + Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalEducationTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalEducationTable.PersonalId) + If _isExpandableNonCompositeForeignKey AndAlso PersonalEducationTable.PersonalId.IsApplyDisplayAs Then + fvalue = PersonalEducationTable.GetDFKA(itemValue, PersonalEducationTable.PersonalId) + End If + If (Not _isExpandableNonCompositeForeignKey) Or (String.IsNullOrEmpty(fvalue)) Then + fvalue = itemValue.Format(PersonalIdTable.PersonalName) + End If + + If fvalue Is Nothing OrElse fvalue.Trim() = "" Then fvalue = cvalue + + If (IsNothing(fvalue)) Then + fvalue = "" + End If + + fvalue = fvalue.Trim() + + If ( fvalue.Length > 50 ) Then + fvalue = fvalue.Substring(0, 50) & "..." + End If + + Dim dupItem As ListItem = Me.PersonalIdFilter.Items.FindByText(fvalue) + + If Not IsNothing(dupItem) Then + listDuplicates.Add(fvalue) + dupItem.Text = fvalue & " (ID " & dupItem.Value.Substring(0, Math.Min(dupItem.Value.Length,38)) & ")" + End If + + Dim newItem As ListItem = New ListItem(fvalue, cvalue) + Me.PersonalIdFilter.Items.Add(newItem) + + If listDuplicates.Contains(fvalue) Then + newItem.Text = fvalue & " (ID " & cvalue.Substring(0, Math.Min(cvalue.Length,38)) & ")" + End If + + counter += 1 + End If + End If + Next + pageNum += 1 + Loop While (itemValues.Length = maxItems AndAlso counter < maxItems) + End If + + + + + + + ' Set the selected value. + SetSelectedValue(Me.PersonalIdFilter, selectedValue) + + + End Sub + + Public Overridable Function CreateWhereClause_COUNTRYFilter() As WhereClause + + ' Create a where clause for the filter COUNTRYFilter. + ' This function is called by the Populate method to load the items + ' in the COUNTRYFilterDropDownList + + Dim wc As WhereClause= New WhereClause() + Return wc + + End Function + + Public Overridable Function CreateWhereClause_LevelIdFilter() As WhereClause + + ' Create a where clause for the filter LevelIdFilter. + ' This function is called by the Populate method to load the items + ' in the LevelIdFilterDropDownList + + Dim wc As WhereClause= New WhereClause() + Return wc + + End Function + + Public Overridable Function CreateWhereClause_PersonalIdFilter() As WhereClause + + ' Create a where clause for the filter PersonalIdFilter. + ' This function is called by the Populate method to load the items + ' in the PersonalIdFilterDropDownList + + Dim wc As WhereClause= New WhereClause() + Return wc + + End Function + + + + + Protected Overridable Sub Control_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.PreRender + ' PreRender event is raised just before page is being displayed. + Try + DbUtils.StartTransaction + Me.RegisterPostback() + + If Not Me.Page.ErrorOnPage AndAlso (Me.Page.IsPageRefresh OrElse Me.DataChanged OrElse Me.ResetData) Then + + + ' Re-load the data and update the web page if necessary. + ' This is typically done during a postback (filter, search button, sort, pagination button). + ' In each of the other click handlers, simply set DataChanged to True to reload the data. + + Me.LoadData() + Me.DataBind() + + End If + + + + Catch ex As Exception + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + Finally + DbUtils.EndTransaction + End Try + End Sub + + + Protected Overrides Sub SaveControlsToSession() + MyBase.SaveControlsToSession() + + ' Save filter controls to values to session. + + Me.SaveToSession(Me.COUNTRYFilter, Me.COUNTRYFilter.SelectedValue) + + Me.SaveToSession(Me.LevelIdFilter, Me.LevelIdFilter.SelectedValue) + + Me.SaveToSession(Me.PersonalEducationSearch, Me.PersonalEducationSearch.Text) + + Me.SaveToSession(Me.PersonalIdFilter, Me.PersonalIdFilter.SelectedValue) + + + 'Save pagination state to session. + + + + ' Save table control properties to the session. + If Not Me.CurrentSortOrder Is Nothing Then + Me.SaveToSession(Me, "Order_By", Me.CurrentSortOrder.ToXmlString()) + End If + + Me.SaveToSession(Me, "Page_Index", Me.PageIndex.ToString()) + Me.SaveToSession(Me, "Page_Size", Me.PageSize.ToString()) + + Me.SaveToSession(Me, "DeletedRecordIds", Me.DeletedRecordIds) + + End Sub + + Protected Sub SaveControlsToSession_Ajax() + ' Save filter controls to values to session. + + Me.SaveToSession("COUNTRYFilter_Ajax", Me.COUNTRYFilter.SelectedValue) + + Me.SaveToSession("LevelIdFilter_Ajax", Me.LevelIdFilter.SelectedValue) + + Me.SaveToSession("PersonalEducationSearch_Ajax", Me.PersonalEducationSearch.Text) + + Me.SaveToSession("PersonalIdFilter_Ajax", Me.PersonalIdFilter.SelectedValue) + + HttpContext.Current.Session("AppRelativeVirtualPath") = Me.Page.AppRelativeVirtualPath + + End Sub + + Protected Overrides Sub ClearControlsFromSession() + MyBase.ClearControlsFromSession() + + ' Clear filter controls values from the session. + + Me.RemoveFromSession(Me.COUNTRYFilter) + Me.RemoveFromSession(Me.LevelIdFilter) + Me.RemoveFromSession(Me.PersonalEducationSearch) + Me.RemoveFromSession(Me.PersonalIdFilter) + + ' Clear pagination state from session. + + + + ' Clear table properties from the session. + Me.RemoveFromSession(Me, "Order_By") + Me.RemoveFromSession(Me, "Page_Index") + Me.RemoveFromSession(Me, "Page_Size") + + Me.RemoveFromSession(Me, "DeletedRecordIds") + + End Sub + + Protected Overrides Sub LoadViewState(ByVal savedState As Object) + MyBase.LoadViewState(savedState) + + Dim orderByStr As String = CType(ViewState("PersonalEducationTableControl_OrderBy"), String) + + If orderByStr IsNot Nothing AndAlso orderByStr.Trim <> "" Then + Me.CurrentSortOrder = BaseClasses.Data.OrderBy.FromXmlString(orderByStr) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + End If + + Dim pageIndex As String = CType(ViewState("Page_Index"), String) + If pageIndex IsNot Nothing Then + Me.PageIndex = CInt(pageIndex) + End If + + Dim pageSize As String = CType(ViewState("Page_Size"), String) + If Not pageSize Is Nothing Then + Me.PageSize = CInt(pageSize) + End If + + + + ' Load view state for pagination control. + + Me.DeletedRecordIds = CType(Me.ViewState("DeletedRecordIds"), String) + + End Sub + + Protected Overrides Function SaveViewState() As Object + + If Me.CurrentSortOrder IsNot Nothing Then + Me.ViewState("PersonalEducationTableControl_OrderBy") = Me.CurrentSortOrder.ToXmlString() + End If + + Me.ViewState("Page_Index") = Me.PageIndex + Me.ViewState("Page_Size") = Me.PageSize + + Me.ViewState("DeletedRecordIds") = Me.DeletedRecordIds + + + ' Load view state for pagination control. + + + Return MyBase.SaveViewState() + End Function + + ' Generate the event handling functions for pagination events. + + ' event handler for ImageButton + Public Overridable Sub PersonalEducationPagination_FirstPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.PageIndex = 0 + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalEducationPagination_LastPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.DisplayLastPage = True + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalEducationPagination_NextPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.PageIndex += 1 + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for LinkButton + Public Overridable Sub PersonalEducationPagination_PageSizeButton_Click(ByVal sender As Object, ByVal args As EventArgs) + + Try + + Me.DataChanged = True + + Me.PageSize = Integer.Parse(Me.PersonalEducationPagination.PageSize.Text) + + Me.PageIndex = Integer.Parse(Me.PersonalEducationPagination.CurrentPage.Text) - 1 + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalEducationPagination_PreviousPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + If Me.PageIndex > 0 Then + Me.PageIndex -= 1 + Me.DataChanged = True + End If + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + + ' Generate the event handling functions for sorting events. + + Public Overridable Sub CommandDateLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by CommandDate when clicked. + + ' Get previous sorting state for CommandDate. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalEducationTable.CommandDate) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for CommandDate. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalEducationTable.CommandDate, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by CommandDate, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub CommandLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by Command when clicked. + + ' Get previous sorting state for Command. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalEducationTable.Command) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for Command. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalEducationTable.Command, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by Command, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub COUNTRYLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by COUNTRY when clicked. + + ' Get previous sorting state for COUNTRY. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalEducationTable.COUNTRY) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for COUNTRY. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalEducationTable.COUNTRY, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by COUNTRY, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub CourseAbbrLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by CourseAbbr when clicked. + + ' Get previous sorting state for CourseAbbr. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalEducationTable.CourseAbbr) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for CourseAbbr. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalEducationTable.CourseAbbr, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by CourseAbbr, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub CourseLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by Course when clicked. + + ' Get previous sorting state for Course. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalEducationTable.Course) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for Course. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalEducationTable.Course, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by Course, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub CourseNoLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by CourseNo when clicked. + + ' Get previous sorting state for CourseNo. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalEducationTable.CourseNo) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for CourseNo. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalEducationTable.CourseNo, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by CourseNo, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub EducationPeriodLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by EducationPeriod when clicked. + + ' Get previous sorting state for EducationPeriod. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalEducationTable.EducationPeriod) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for EducationPeriod. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalEducationTable.EducationPeriod, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by EducationPeriod, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub EducationTypeLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by EducationType when clicked. + + ' Get previous sorting state for EducationType. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalEducationTable.EducationType) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for EducationType. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalEducationTable.EducationType, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by EducationType, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub EdYearLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by EdYear when clicked. + + ' Get previous sorting state for EdYear. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalEducationTable.EdYear) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for EdYear. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalEducationTable.EdYear, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by EdYear, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub EndDateLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by EndDate when clicked. + + ' Get previous sorting state for EndDate. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalEducationTable.EndDate) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for EndDate. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalEducationTable.EndDate, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by EndDate, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub FacultryLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by Facultry when clicked. + + ' Get previous sorting state for Facultry. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalEducationTable.Facultry) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for Facultry. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalEducationTable.Facultry, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by Facultry, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub InstitueLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by Institue when clicked. + + ' Get previous sorting state for Institue. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalEducationTable.Institue) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for Institue. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalEducationTable.Institue, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by Institue, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub LevelIdLabel1_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by LevelId when clicked. + + ' Get previous sorting state for LevelId. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalEducationTable.LevelId) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for LevelId. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalEducationTable.LevelId, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by LevelId, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub NoAllLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by NoAll when clicked. + + ' Get previous sorting state for NoAll. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalEducationTable.NoAll) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for NoAll. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalEducationTable.NoAll, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by NoAll, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub PersonalIdLabel1_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by PersonalId when clicked. + + ' Get previous sorting state for PersonalId. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalEducationTable.PersonalId) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for PersonalId. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalEducationTable.PersonalId, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by PersonalId, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub ScoreLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by Score when clicked. + + ' Get previous sorting state for Score. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalEducationTable.Score) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for Score. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalEducationTable.Score, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by Score, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub ScoreNoLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by ScoreNo when clicked. + + ' Get previous sorting state for ScoreNo. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalEducationTable.ScoreNo) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for ScoreNo. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalEducationTable.ScoreNo, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by ScoreNo, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub StartDateLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by StartDate when clicked. + + ' Get previous sorting state for StartDate. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalEducationTable.StartDate) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for StartDate. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalEducationTable.StartDate, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by StartDate, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + + ' Generate the event handling functions for button events. + + ' event handler for ImageButton + Public Overridable Sub PersonalEducationExportCSVButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + ' Build the where clause based on the current filter and search criteria + ' Create the Order By clause based on the user's current sorting preference. + + Dim wc As WhereClause = CreateWhereClause + Dim orderBy As OrderBy = Nothing + + orderBy = CreateOrderBy + + ' Add each of the columns in order of export. + Dim columns() as BaseColumn = New BaseColumn() { _ + PersonalEducationTable.PersonalId, _ + PersonalEducationTable.StartDate, _ + PersonalEducationTable.EndDate, _ + PersonalEducationTable.Course, _ + PersonalEducationTable.CourseAbbr, _ + PersonalEducationTable.Institue, _ + PersonalEducationTable.Facultry, _ + PersonalEducationTable.LevelId, _ + PersonalEducationTable.EdYear, _ + PersonalEducationTable.EducationPeriod, _ + PersonalEducationTable.EducationType, _ + PersonalEducationTable.COUNTRY, _ + PersonalEducationTable.CourseNo, _ + PersonalEducationTable.ScoreNo, _ + PersonalEducationTable.NoAll, _ + PersonalEducationTable.Score, _ + PersonalEducationTable.Command, _ + PersonalEducationTable.CommandDate, _ + Nothing} + Dim exportData as ExportDataToCSV = New ExportDataToCSV(PersonalEducationTable.Instance, wc, orderBy, columns) + + Dim done As Boolean = False + + Dim totalRowsReturned As Integer = 0 + Dim join As CompoundFilter = CreateCompoundJoinFilter() + Dim data As DataForExport = New DataForExport(PersonalEducationTable.Instance, wc, orderBy, columns, join) + + 'Check for Export Data Threshold + Dim exportRawValues As Boolean = False + Me.TotalRecords = PersonalEducationTable.GetRecordCount(join, wc) + If Me.TotalRecords > 10000 Then + exportRawValues = True + End If + exportData.StartExport(Me.Page.Response, exportRawValues) + + ' Read pageSize records at a time and write out the CSV file. + While (Not done) + Dim recList As ArrayList = data.GetRows(exportData.pageSize) + If recList Is Nothing Then + Exit While 'no more records we are done + End If + + totalRowsReturned = recList.Count + For Each rec As BaseRecord In recList + For Each col As BaseColumn In data.ColumnList + If col Is Nothing Then + Continue For + End If + + If Not data.IncludeInExport(col) Then + Continue For + End If + + Dim val As String = "" + + If exportRawValues Then + val = rec.GetValue(col).ToString() + Else + Dim _isExpandableNonCompositeForeignKey As Boolean = col.TableDefinition.IsExpandableNonCompositeForeignKey(col) + If _isExpandableNonCompositeForeignKey AndAlso col.IsApplyDisplayAs Then + val = PersonalEducationTable.GetDFKA(rec.GetValue(col).ToString(), col, Nothing) + End If + If (Not _isExpandableNonCompositeForeignKey) Or (String.IsNullOrEmpty(val)) Then + val = exportData.GetDataForExport(col, rec) + End If + End If + exportData.WriteColumnData(val, data.IsString(col)) + + Next col + exportData.WriteNewRow() + Next rec + + ' If we already are below the pageSize, then we are done. + If totalRowsReturned < exportData.pageSize Then + done = True + End If + End While + exportData.FinishExport(Me.Page.Response) + + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalEducationExportExcelButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + ' To customize the columns or the format, override this function in Section 1 of the page + ' and modify it to your liking. + ' Build the where clause based on the current filter and search criteria + ' Create the Order By clause based on the user's current sorting preference. + + Dim wc As WhereClause = CreateWhereClause + Dim orderBy As OrderBy = Nothing + + orderBy = CreateOrderBy + + Dim done As Boolean = False + Dim val As Object = "" + ' Read pageSize records at a time and write out the Excel file. + Dim totalRowsReturned As Integer = 0 + + Me.TotalRecords = PersonalEducationTable.GetRecordCount(wc) + If Me.TotalRecords > 10000 Then + + ' Add each of the columns in order of export. + Dim columns() as BaseColumn = New BaseColumn() { _ + PersonalEducationTable.PersonalId, _ + PersonalEducationTable.StartDate, _ + PersonalEducationTable.EndDate, _ + PersonalEducationTable.Course, _ + PersonalEducationTable.CourseAbbr, _ + PersonalEducationTable.Institue, _ + PersonalEducationTable.Facultry, _ + PersonalEducationTable.LevelId, _ + PersonalEducationTable.EdYear, _ + PersonalEducationTable.EducationPeriod, _ + PersonalEducationTable.EducationType, _ + PersonalEducationTable.COUNTRY, _ + PersonalEducationTable.CourseNo, _ + PersonalEducationTable.ScoreNo, _ + PersonalEducationTable.NoAll, _ + PersonalEducationTable.Score, _ + PersonalEducationTable.Command, _ + PersonalEducationTable.CommandDate, _ + Nothing} + Dim exportData as ExportDataToCSV = New ExportDataToCSV(PersonalEducationTable.Instance, wc, orderBy, columns) + exportData.StartExport(Me.Page.Response, True) + + Dim dataForCSV As DataForExport = New DataForExport(PersonalEducationTable.Instance, wc, orderBy, columns) + + ' Read pageSize records at a time and write out the CSV file. + While (Not done) + Dim recList As ArrayList = dataForCSV.GetRows(exportData.pageSize) + If recList Is Nothing Then + Exit While 'no more records we are done + End If + + totalRowsReturned = recList.Count + For Each rec As BaseRecord In recList + For Each col As BaseColumn In dataForCSV.ColumnList + If col Is Nothing Then + Continue For + End If + + If Not dataForCSV.IncludeInExport(col) Then + Continue For + End If + + val = rec.GetValue(col).ToString() + exportData.WriteColumnData(val, dataForCSV.IsString(col)) + + Next col + exportData.WriteNewRow() + Next rec + + ' If we already are below the pageSize, then we are done. + If totalRowsReturned < exportData.pageSize Then + done = True + End If + End While + exportData.FinishExport(Me.Page.Response) + Else + + ' Create an instance of the Excel report class with the table class, where clause and order by. + Dim excelReport As ExportDataToExcel = New ExportDataToExcel(PersonalEducationTable.Instance, wc, orderBy) + ' Add each of the columns in order of export. + ' To customize the data type, change the second parameter of the new ExcelColumn to be + ' a format string from Excel's Format Cell menu. For example "dddd, mmmm dd, yyyy h:mm AM/PM;@", "#,##0.00" + + If Me.Page.Response Is Nothing Then + Return + End If + + excelReport.CreateExcelBook() + + Dim width As Integer = 0 + Dim columnCounter As Integer = 0 + Dim data As DataForExport = New DataForExport(PersonalEducationTable.Instance, wc, orderBy, Nothing) + data.ColumnList.Add(New ExcelColumn(PersonalEducationTable.PersonalId, "Default")) + data.ColumnList.Add(New ExcelColumn(PersonalEducationTable.StartDate, "Short Date")) + data.ColumnList.Add(New ExcelColumn(PersonalEducationTable.EndDate, "Short Date")) + data.ColumnList.Add(New ExcelColumn(PersonalEducationTable.Course, "Default")) + data.ColumnList.Add(New ExcelColumn(PersonalEducationTable.CourseAbbr, "Default")) + data.ColumnList.Add(New ExcelColumn(PersonalEducationTable.Institue, "Default")) + data.ColumnList.Add(New ExcelColumn(PersonalEducationTable.Facultry, "Default")) + data.ColumnList.Add(New ExcelColumn(PersonalEducationTable.LevelId, "Default")) + data.ColumnList.Add(New ExcelColumn(PersonalEducationTable.EdYear, "Default")) + data.ColumnList.Add(New ExcelColumn(PersonalEducationTable.EducationPeriod, "Default")) + data.ColumnList.Add(New ExcelColumn(PersonalEducationTable.EducationType, "0")) + data.ColumnList.Add(New ExcelColumn(PersonalEducationTable.COUNTRY, "Default")) + data.ColumnList.Add(New ExcelColumn(PersonalEducationTable.CourseNo, "Default")) + data.ColumnList.Add(New ExcelColumn(PersonalEducationTable.ScoreNo, "Default")) + data.ColumnList.Add(New ExcelColumn(PersonalEducationTable.NoAll, "Default")) + data.ColumnList.Add(New ExcelColumn(PersonalEducationTable.Score, "Default")) + data.ColumnList.Add(New ExcelColumn(PersonalEducationTable.Command, "Default")) + data.ColumnList.Add(New ExcelColumn(PersonalEducationTable.CommandDate, "Short Date")) + + + For Each col As ExcelColumn In data.ColumnList + width = excelReport.GetExcelCellWidth(col) + If data.IncludeInExport(col) Then + excelReport.AddColumnToExcelBook(columnCounter, col.ToString(), excelReport.GetExcelDataType(col), width, excelReport.GetDisplayFormat(col)) + columnCounter = columnCounter + 1 + End If + Next col + + While (Not done) + Dim recList As ArrayList = data.GetRows(excelReport.pageSize) + + If recList Is Nothing Then + Exit While 'no more records we are done + End If + + totalRowsReturned = recList.Count + + For Each rec As BaseRecord In recList + excelReport.AddRowToExcelBook() + columnCounter = 0 + + For Each col As ExcelColumn In data.ColumnList + If Not data.IncludeInExport(col) Then + Continue For + End If + + Dim _isExpandableNonCompositeForeignKey As Boolean = col.DisplayColumn.TableDefinition.IsExpandableNonCompositeForeignKey(col.DisplayColumn) + If _isExpandableNonCompositeForeignKey AndAlso col.DisplayColumn.IsApplyDisplayAs Then + val = PersonalEducationTable.GetDFKA(rec.GetValue(col.DisplayColumn).ToString(), col.DisplayColumn, Nothing) + If val Is Nothing Then + val = rec.Format(col.DisplayColumn) + End If + Else + val = excelReport.GetValueForExcelExport(col, rec) + End If + excelReport.AddCellToExcelRow(columnCounter, excelReport.GetExcelDataType(col), val, col.DisplayFormat) + + columnCounter = columnCounter + 1 + Next col + Next rec + + ' If we already are below the pageSize, then we are done. + If totalRowsReturned < excelReport.pageSize Then + done = True + End If + End While + + excelReport.SaveExcelBook(Me.Page.Response) + End If + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalEducationNewButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + ' The redirect URL is set on the Properties, Custom Properties or Actions. + ' The ModifyRedirectURL call resolves the parameters before the + ' Response.Redirect redirects the page to the URL. + ' Any code after the Response.Redirect call will not be executed, since the page is + ' redirected to the URL. + + + Dim url As String = "../PersonalEducation/AddPersonalEducation.aspx" + + Dim shouldRedirect As Boolean = True + Dim TargetKey As String = Nothing + Dim DFKA As String = TargetKey + Dim id As String = DFKA + Dim value As String = id + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + url = Me.ModifyRedirectUrl(url, "",False) + url = Me.Page.ModifyRedirectUrl(url, "",False) + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + shouldRedirect = False + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + If shouldRedirect Then + Me.Page.ShouldSaveControlsToSession = True + Me.Page.Response.Redirect(url) + ElseIf Not TargetKey Is Nothing AndAlso _ + Not shouldRedirect Then + Me.Page.ShouldSaveControlsToSession = True + Me.Page.CloseWindow(True) + + End If + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalEducationPDFButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + Dim report As PDFReport = New PDFReport() + report.SpecificReportFileName = Page.Server.MapPath("ShowPersonalEducationTable.PersonalEducationPDFButton.report") + ' report.Title replaces the value tag of page header and footer containing ${ReportTitle} + report.Title = "PersonalEducation" + ' If ShowPersonalEducationTable.PersonalEducationPDFButton.report specifies a valid report template, + ' AddColumn method will generate a report template. + ' Each AddColumn method-call specifies a column + ' The 1st parameter represents the text of the column header + ' The 2nd parameter represents the horizontal alignment of the column header + ' The 3rd parameter represents the text format of the column detail + ' The 4th parameter represents the horizontal alignment of the column detail + ' The 5th parameter represents the relative width of the column + report.AddColumn(PersonalEducationTable.PersonalId.Name, ReportEnum.Align.Left, "${PersonalId}", ReportEnum.Align.Left, 30) + report.AddColumn(PersonalEducationTable.StartDate.Name, ReportEnum.Align.Left, "${StartDate}", ReportEnum.Align.Left, 20) + report.AddColumn(PersonalEducationTable.EndDate.Name, ReportEnum.Align.Left, "${EndDate}", ReportEnum.Align.Left, 20) + report.AddColumn(PersonalEducationTable.Course.Name, ReportEnum.Align.Left, "${Course}", ReportEnum.Align.Left, 30) + report.AddColumn(PersonalEducationTable.CourseAbbr.Name, ReportEnum.Align.Left, "${CourseAbbr}", ReportEnum.Align.Left, 30) + report.AddColumn(PersonalEducationTable.Institue.Name, ReportEnum.Align.Left, "${Institue}", ReportEnum.Align.Left, 30) + report.AddColumn(PersonalEducationTable.Facultry.Name, ReportEnum.Align.Left, "${Facultry}", ReportEnum.Align.Left, 30) + report.AddColumn(PersonalEducationTable.LevelId.Name, ReportEnum.Align.Left, "${LevelId}", ReportEnum.Align.Left, 30) + report.AddColumn(PersonalEducationTable.EdYear.Name, ReportEnum.Align.Left, "${EdYear}", ReportEnum.Align.Left, 15) + report.AddColumn(PersonalEducationTable.EducationPeriod.Name, ReportEnum.Align.Left, "${EducationPeriod}", ReportEnum.Align.Left, 20) + report.AddColumn(PersonalEducationTable.EducationType.Name, ReportEnum.Align.Right, "${EducationType}", ReportEnum.Align.Right, 15) + report.AddColumn(PersonalEducationTable.COUNTRY.Name, ReportEnum.Align.Left, "${COUNTRY}", ReportEnum.Align.Left, 30) + report.AddColumn(PersonalEducationTable.CourseNo.Name, ReportEnum.Align.Left, "${CourseNo}", ReportEnum.Align.Left, 15) + report.AddColumn(PersonalEducationTable.ScoreNo.Name, ReportEnum.Align.Left, "${ScoreNo}", ReportEnum.Align.Left, 15) + report.AddColumn(PersonalEducationTable.NoAll.Name, ReportEnum.Align.Left, "${NoAll}", ReportEnum.Align.Left, 15) + report.AddColumn(PersonalEducationTable.Score.Name, ReportEnum.Align.Left, "${Score}", ReportEnum.Align.Left, 15) + report.AddColumn(PersonalEducationTable.Command.Name, ReportEnum.Align.Left, "${Command}", ReportEnum.Align.Left, 30) + report.AddColumn(PersonalEducationTable.CommandDate.Name, ReportEnum.Align.Left, "${CommandDate}", ReportEnum.Align.Left, 20) + + + Dim rowsPerQuery As Integer = 5000 + Dim recordCount As Integer = 0 + + report.Page = Page.GetResourceValue("Txt:Page", "Persons") + report.ApplicationPath = Me.Page.MapPath(Page.Request.ApplicationPath) + + Dim whereClause As WhereClause = CreateWhereClause + Dim orderBy As OrderBy = CreateOrderBy + Dim joinFilter As BaseFilter = CreateCompoundJoinFilter() + + Dim pageNum As Integer = 0 + Dim totalRows As Integer = PersonalEducationTable.GetRecordCount(joinFilter,whereClause) + Dim columns As ColumnList = PersonalEducationTable.GetColumnList() + Dim records As PersonalEducationRecord() = Nothing + + Do + + records = PersonalEducationTable.GetRecords(joinFilter,whereClause, orderBy, pageNum, rowsPerQuery) + If Not (records Is Nothing) AndAlso records.Length > 0 AndAlso whereClause.RunQuery Then + For Each record As PersonalEducationRecord In records + + ' AddData method takes four parameters + ' The 1st parameters represent the data format + ' The 2nd parameters represent the data value + ' The 3rd parameters represent the default alignment of column using the data + ' The 4th parameters represent the maximum length of the data value being shown + If BaseClasses.Utils.MiscUtils.IsNull(record.PersonalId) Then + report.AddData("${PersonalId}", "",ReportEnum.Align.Left) + Else + Dim _isExpandableNonCompositeForeignKey as Boolean + Dim _DFKA as String = "" + _isExpandableNonCompositeForeignKey = PersonalEducationTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalEducationTable.PersonalId) + _DFKA = PersonalEducationTable.GetDFKA(record.PersonalId.ToString(), PersonalEducationTable.PersonalId,Nothing) + If _isExpandableNonCompositeForeignKey AndAlso (not _DFKA Is Nothing) AndAlso PersonalEducationTable.PersonalId.IsApplyDisplayAs Then + report.AddData("${PersonalId}", _DFKA,ReportEnum.Align.Left) + Else + report.AddData("${PersonalId}", record.Format(PersonalEducationTable.PersonalId), ReportEnum.Align.Left) + End If + End If + report.AddData("${StartDate}", record.Format(PersonalEducationTable.StartDate), ReportEnum.Align.Left, 100) + report.AddData("${EndDate}", record.Format(PersonalEducationTable.EndDate), ReportEnum.Align.Left, 100) + report.AddData("${Course}", record.Format(PersonalEducationTable.Course), ReportEnum.Align.Left, 100) + report.AddData("${CourseAbbr}", record.Format(PersonalEducationTable.CourseAbbr), ReportEnum.Align.Left, 100) + report.AddData("${Institue}", record.Format(PersonalEducationTable.Institue), ReportEnum.Align.Left, 100) + report.AddData("${Facultry}", record.Format(PersonalEducationTable.Facultry), ReportEnum.Align.Left, 100) + If BaseClasses.Utils.MiscUtils.IsNull(record.LevelId) Then + report.AddData("${LevelId}", "",ReportEnum.Align.Left, 100) + Else + Dim _isExpandableNonCompositeForeignKey as Boolean + Dim _DFKA as String = "" + _isExpandableNonCompositeForeignKey = PersonalEducationTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalEducationTable.LevelId) + _DFKA = PersonalEducationTable.GetDFKA(record.LevelId.ToString(), PersonalEducationTable.LevelId,Nothing) + If _isExpandableNonCompositeForeignKey AndAlso (not _DFKA Is Nothing) AndAlso PersonalEducationTable.LevelId.IsApplyDisplayAs Then + report.AddData("${LevelId}", _DFKA,ReportEnum.Align.Left, 100) + Else + report.AddData("${LevelId}", record.Format(PersonalEducationTable.LevelId), ReportEnum.Align.Left, 100) + End If + End If + report.AddData("${EdYear}", record.Format(PersonalEducationTable.EdYear), ReportEnum.Align.Left, 100) + If BaseClasses.Utils.MiscUtils.IsNull(record.EducationPeriod) Then + report.AddData("${EducationPeriod}", "",ReportEnum.Align.Left, 100) + Else + Dim _isExpandableNonCompositeForeignKey as Boolean + Dim _DFKA as String = "" + _isExpandableNonCompositeForeignKey = PersonalEducationTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalEducationTable.EducationPeriod) + _DFKA = PersonalEducationTable.GetDFKA(record.EducationPeriod.ToString(), PersonalEducationTable.EducationPeriod,Nothing) + If _isExpandableNonCompositeForeignKey AndAlso (not _DFKA Is Nothing) AndAlso PersonalEducationTable.EducationPeriod.IsApplyDisplayAs Then + report.AddData("${EducationPeriod}", _DFKA,ReportEnum.Align.Left, 100) + Else + report.AddData("${EducationPeriod}", record.Format(PersonalEducationTable.EducationPeriod), ReportEnum.Align.Left, 100) + End If + End If + report.AddData("${EducationType}", record.Format(PersonalEducationTable.EducationType), ReportEnum.Align.Right, 100) + If BaseClasses.Utils.MiscUtils.IsNull(record.COUNTRY) Then + report.AddData("${COUNTRY}", "",ReportEnum.Align.Left, 100) + Else + Dim _isExpandableNonCompositeForeignKey as Boolean + Dim _DFKA as String = "" + _isExpandableNonCompositeForeignKey = PersonalEducationTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalEducationTable.COUNTRY) + _DFKA = PersonalEducationTable.GetDFKA(record.COUNTRY.ToString(), PersonalEducationTable.COUNTRY,Nothing) + If _isExpandableNonCompositeForeignKey AndAlso (not _DFKA Is Nothing) AndAlso PersonalEducationTable.COUNTRY.IsApplyDisplayAs Then + report.AddData("${COUNTRY}", _DFKA,ReportEnum.Align.Left, 100) + Else + report.AddData("${COUNTRY}", record.Format(PersonalEducationTable.COUNTRY), ReportEnum.Align.Left, 100) + End If + End If + report.AddData("${CourseNo}", record.Format(PersonalEducationTable.CourseNo), ReportEnum.Align.Left, 100) + report.AddData("${ScoreNo}", record.Format(PersonalEducationTable.ScoreNo), ReportEnum.Align.Left, 100) + report.AddData("${NoAll}", record.Format(PersonalEducationTable.NoAll), ReportEnum.Align.Left, 100) + report.AddData("${Score}", record.Format(PersonalEducationTable.Score), ReportEnum.Align.Left, 100) + report.AddData("${Command}", record.Format(PersonalEducationTable.Command), ReportEnum.Align.Left, 100) + report.AddData("${CommandDate}", record.Format(PersonalEducationTable.CommandDate), ReportEnum.Align.Left, 100) + + report.WriteRow + Next + pageNum = pageNum + 1 + recordCount += records.Length + End If + Loop While Not (records Is Nothing) AndAlso recordCount < totalRows AndAlso whereClause.RunQuery + + report.Close + BaseClasses.Utils.NetUtils.WriteResponseBinaryAttachment(Me.Page.Response, report.Title + ".pdf", report.ReportInByteArray, 0, true) + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalEducationRefreshButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Dim PersonalEducationTableControlObj as PersonalEducationTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalEducationTableControl"), PersonalEducationTableControl) + PersonalEducationTableControlObj.ResetData = True + + PersonalEducationTableControlObj.RemoveFromSession(PersonalEducationTableControlObj, "DeletedRecordIds") + PersonalEducationTableControlObj.DeletedRecordIds = Nothing + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalEducationResetButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.COUNTRYFilter.ClearSelection() + Me.LevelIdFilter.ClearSelection() + Me.PersonalIdFilter.ClearSelection() + Me.PersonalEducationSearch.Text = "" + Me.CurrentSortOrder.Reset() + If Me.InSession(Me, "Order_By") Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + Me.CurrentSortOrder.Add(PersonalEducationTable.PersonalId, OrderByItem.OrderDir.Asc) + + Me.CurrentSortOrder.Add(PersonalEducationTable.StartDate, OrderByItem.OrderDir.Asc) + + + End If + + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalEducationWordButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + Dim report As WordReport = New WordReport + report.SpecificReportFileName = Page.Server.MapPath("ShowPersonalEducationTable.PersonalEducationWordButton.word") + ' report.Title replaces the value tag of page header and footer containing ${ReportTitle} + report.Title = "PersonalEducation" + ' If ShowPersonalEducationTable.PersonalEducationWordButton.report specifies a valid report template, + ' AddColumn method will generate a report template. + ' Each AddColumn method-call specifies a column + ' The 1st parameter represents the text of the column header + ' The 2nd parameter represents the horizontal alignment of the column header + ' The 3rd parameter represents the text format of the column detail + ' The 4th parameter represents the horizontal alignment of the column detail + ' The 5th parameter represents the relative width of the column + report.AddColumn(PersonalEducationTable.PersonalId.Name, ReportEnum.Align.Left, "${PersonalId}", ReportEnum.Align.Left, 30) + report.AddColumn(PersonalEducationTable.StartDate.Name, ReportEnum.Align.Left, "${StartDate}", ReportEnum.Align.Left, 20) + report.AddColumn(PersonalEducationTable.EndDate.Name, ReportEnum.Align.Left, "${EndDate}", ReportEnum.Align.Left, 20) + report.AddColumn(PersonalEducationTable.Course.Name, ReportEnum.Align.Left, "${Course}", ReportEnum.Align.Left, 30) + report.AddColumn(PersonalEducationTable.CourseAbbr.Name, ReportEnum.Align.Left, "${CourseAbbr}", ReportEnum.Align.Left, 30) + report.AddColumn(PersonalEducationTable.Institue.Name, ReportEnum.Align.Left, "${Institue}", ReportEnum.Align.Left, 30) + report.AddColumn(PersonalEducationTable.Facultry.Name, ReportEnum.Align.Left, "${Facultry}", ReportEnum.Align.Left, 30) + report.AddColumn(PersonalEducationTable.LevelId.Name, ReportEnum.Align.Left, "${LevelId}", ReportEnum.Align.Left, 30) + report.AddColumn(PersonalEducationTable.EdYear.Name, ReportEnum.Align.Left, "${EdYear}", ReportEnum.Align.Left, 15) + report.AddColumn(PersonalEducationTable.EducationPeriod.Name, ReportEnum.Align.Left, "${EducationPeriod}", ReportEnum.Align.Left, 20) + report.AddColumn(PersonalEducationTable.EducationType.Name, ReportEnum.Align.Right, "${EducationType}", ReportEnum.Align.Right, 15) + report.AddColumn(PersonalEducationTable.COUNTRY.Name, ReportEnum.Align.Left, "${COUNTRY}", ReportEnum.Align.Left, 30) + report.AddColumn(PersonalEducationTable.CourseNo.Name, ReportEnum.Align.Left, "${CourseNo}", ReportEnum.Align.Left, 15) + report.AddColumn(PersonalEducationTable.ScoreNo.Name, ReportEnum.Align.Left, "${ScoreNo}", ReportEnum.Align.Left, 15) + report.AddColumn(PersonalEducationTable.NoAll.Name, ReportEnum.Align.Left, "${NoAll}", ReportEnum.Align.Left, 15) + report.AddColumn(PersonalEducationTable.Score.Name, ReportEnum.Align.Left, "${Score}", ReportEnum.Align.Left, 15) + report.AddColumn(PersonalEducationTable.Command.Name, ReportEnum.Align.Left, "${Command}", ReportEnum.Align.Left, 30) + report.AddColumn(PersonalEducationTable.CommandDate.Name, ReportEnum.Align.Left, "${CommandDate}", ReportEnum.Align.Left, 20) + + Dim whereClause As WhereClause = CreateWhereClause + + Dim orderBy As OrderBy = CreateOrderBy + Dim joinFilter As BaseFilter = CreateCompoundJoinFilter() + + Dim rowsPerQuery As Integer = 5000 + Dim pageNum As Integer = 0 + Dim recordCount As Integer = 0 + Dim totalRows As Integer = PersonalEducationTable.GetRecordCount(joinFilter,whereClause) + + report.Page = Page.GetResourceValue("Txt:Page", "Persons") + report.ApplicationPath = Me.Page.MapPath(Page.Request.ApplicationPath) + + Dim columns As ColumnList = PersonalEducationTable.GetColumnList() + Dim records As PersonalEducationRecord() = Nothing + Do + records = PersonalEducationTable.GetRecords(joinFilter,whereClause, orderBy, pageNum, rowsPerQuery) + + If Not (records Is Nothing) AndAlso records.Length > 0 AndAlso whereClause.RunQuery Then + For Each record As PersonalEducationRecord In records + ' AddData method takes four parameters + ' The 1st parameters represent the data format + ' The 2nd parameters represent the data value + ' The 3rd parameters represent the default alignment of column using the data + ' The 4th parameters represent the maximum length of the data value being shown + If BaseClasses.Utils.MiscUtils.IsNull(record.PersonalId) Then + report.AddData("${PersonalId}", "",ReportEnum.Align.Left) + Else + Dim _isExpandableNonCompositeForeignKey as Boolean + Dim _DFKA as String = "" + _isExpandableNonCompositeForeignKey = PersonalEducationTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalEducationTable.PersonalId) + _DFKA = PersonalEducationTable.GetDFKA(record.PersonalId.ToString(), PersonalEducationTable.PersonalId,Nothing) + If _isExpandableNonCompositeForeignKey AndAlso (not _DFKA Is Nothing) AndAlso PersonalEducationTable.PersonalId.IsApplyDisplayAs Then + report.AddData("${PersonalId}", _DFKA,ReportEnum.Align.Left) + Else + report.AddData("${PersonalId}", record.Format(PersonalEducationTable.PersonalId), ReportEnum.Align.Left) + End If + End If + report.AddData("${StartDate}", record.Format(PersonalEducationTable.StartDate), ReportEnum.Align.Left, 100) + report.AddData("${EndDate}", record.Format(PersonalEducationTable.EndDate), ReportEnum.Align.Left, 100) + report.AddData("${Course}", record.Format(PersonalEducationTable.Course), ReportEnum.Align.Left, 100) + report.AddData("${CourseAbbr}", record.Format(PersonalEducationTable.CourseAbbr), ReportEnum.Align.Left, 100) + report.AddData("${Institue}", record.Format(PersonalEducationTable.Institue), ReportEnum.Align.Left, 100) + report.AddData("${Facultry}", record.Format(PersonalEducationTable.Facultry), ReportEnum.Align.Left, 100) + If BaseClasses.Utils.MiscUtils.IsNull(record.LevelId) Then + report.AddData("${LevelId}", "",ReportEnum.Align.Left, 100) + Else + Dim _isExpandableNonCompositeForeignKey as Boolean + Dim _DFKA as String = "" + _isExpandableNonCompositeForeignKey = PersonalEducationTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalEducationTable.LevelId) + _DFKA = PersonalEducationTable.GetDFKA(record.LevelId.ToString(), PersonalEducationTable.LevelId,Nothing) + If _isExpandableNonCompositeForeignKey AndAlso (not _DFKA Is Nothing) AndAlso PersonalEducationTable.LevelId.IsApplyDisplayAs Then + report.AddData("${LevelId}", _DFKA,ReportEnum.Align.Left, 100) + Else + report.AddData("${LevelId}", record.Format(PersonalEducationTable.LevelId), ReportEnum.Align.Left, 100) + End If + End If + report.AddData("${EdYear}", record.Format(PersonalEducationTable.EdYear), ReportEnum.Align.Left, 100) + If BaseClasses.Utils.MiscUtils.IsNull(record.EducationPeriod) Then + report.AddData("${EducationPeriod}", "",ReportEnum.Align.Left, 100) + Else + Dim _isExpandableNonCompositeForeignKey as Boolean + Dim _DFKA as String = "" + _isExpandableNonCompositeForeignKey = PersonalEducationTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalEducationTable.EducationPeriod) + _DFKA = PersonalEducationTable.GetDFKA(record.EducationPeriod.ToString(), PersonalEducationTable.EducationPeriod,Nothing) + If _isExpandableNonCompositeForeignKey AndAlso (not _DFKA Is Nothing) AndAlso PersonalEducationTable.EducationPeriod.IsApplyDisplayAs Then + report.AddData("${EducationPeriod}", _DFKA,ReportEnum.Align.Left, 100) + Else + report.AddData("${EducationPeriod}", record.Format(PersonalEducationTable.EducationPeriod), ReportEnum.Align.Left, 100) + End If + End If + report.AddData("${EducationType}", record.Format(PersonalEducationTable.EducationType), ReportEnum.Align.Right, 100) + If BaseClasses.Utils.MiscUtils.IsNull(record.COUNTRY) Then + report.AddData("${COUNTRY}", "",ReportEnum.Align.Left, 100) + Else + Dim _isExpandableNonCompositeForeignKey as Boolean + Dim _DFKA as String = "" + _isExpandableNonCompositeForeignKey = PersonalEducationTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalEducationTable.COUNTRY) + _DFKA = PersonalEducationTable.GetDFKA(record.COUNTRY.ToString(), PersonalEducationTable.COUNTRY,Nothing) + If _isExpandableNonCompositeForeignKey AndAlso (not _DFKA Is Nothing) AndAlso PersonalEducationTable.COUNTRY.IsApplyDisplayAs Then + report.AddData("${COUNTRY}", _DFKA,ReportEnum.Align.Left, 100) + Else + report.AddData("${COUNTRY}", record.Format(PersonalEducationTable.COUNTRY), ReportEnum.Align.Left, 100) + End If + End If + report.AddData("${CourseNo}", record.Format(PersonalEducationTable.CourseNo), ReportEnum.Align.Left, 100) + report.AddData("${ScoreNo}", record.Format(PersonalEducationTable.ScoreNo), ReportEnum.Align.Left, 100) + report.AddData("${NoAll}", record.Format(PersonalEducationTable.NoAll), ReportEnum.Align.Left, 100) + report.AddData("${Score}", record.Format(PersonalEducationTable.Score), ReportEnum.Align.Left, 100) + report.AddData("${Command}", record.Format(PersonalEducationTable.Command), ReportEnum.Align.Left, 100) + report.AddData("${CommandDate}", record.Format(PersonalEducationTable.CommandDate), ReportEnum.Align.Left, 100) + + report.WriteRow + Next + pageNum = pageNum + 1 + recordCount += records.Length + End If + Loop While Not (records Is Nothing) AndAlso recordCount < totalRows AndAlso whereClause.RunQuery + report.save + BaseClasses.Utils.NetUtils.WriteResponseBinaryAttachment(Me.Page.Response, report.Title + ".doc", report.ReportInByteArray, 0, true) + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for Button with Layout + Public Overridable Sub PersonalEducationSearchButton_Click(ByVal sender As Object, ByVal args As EventArgs) + + Try + + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + + + ' Generate the event handling functions for filter and search events. + + ' event handler for FieldFilter + Protected Overridable Sub COUNTRYFilter_SelectedIndexChanged(ByVal sender As Object, ByVal args As EventArgs) + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + + End Sub + + ' event handler for FieldFilter + Protected Overridable Sub LevelIdFilter_SelectedIndexChanged(ByVal sender As Object, ByVal args As EventArgs) + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + + End Sub + + ' event handler for FieldFilter + Protected Overridable Sub PersonalIdFilter_SelectedIndexChanged(ByVal sender As Object, ByVal args As EventArgs) + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + + End Sub + + + ' Generate the event handling functions for others + + + Private _UIData As New System.Collections.Generic.List(Of Hashtable) + Public Property UIData() As System.Collections.Generic.List(Of Hashtable) + Get + Return Me._UIData + End Get + Set(ByVal value As System.Collections.Generic.List(Of Hashtable)) + Me._UIData = value + End Set + End Property + + ' pagination properties + Protected _PageSize As Integer + Public Property PageSize() As Integer + Get + Return Me._PageSize + End Get + Set(ByVal value As Integer) + Me._PageSize = value + End Set + End Property + + Protected _PageIndex As Integer + Public Property PageIndex() As Integer + Get + ' Return the PageIndex + Return Me._PageIndex + End Get + Set(ByVal value As Integer) + Me._PageIndex = value + End Set + End Property + + Protected _TotalRecords As Integer = -1 + Public Property TotalRecords() As Integer + Get + If _TotalRecords < 0 + _TotalRecords = PersonalEducationTable.GetRecordCount(CreateCompoundJoinFilter(), CreateWhereClause()) + End If + Return Me._TotalRecords + End Get + Set(ByVal value As Integer) + If Me.PageSize > 0 Then + + Me.TotalPages = CInt(Math.Ceiling(value / Me.PageSize)) + + End If + Me._TotalRecords = value + End Set + End Property + + + + Protected _TotalPages As Integer = -1 + Public Property TotalPages() As Integer + Get + If _TotalPages < 0 Then + + Me.TotalPages = CInt(Math.Ceiling(TotalRecords / Me.PageSize)) + + End If + Return Me._TotalPages + End Get + Set(ByVal value As Integer) + Me._TotalPages = value + End Set + End Property + + Protected _DisplayLastPage As Boolean + Public Property DisplayLastPage() As Boolean + Get + Return Me._DisplayLastPage + End Get + Set(ByVal value As Boolean) + Me._DisplayLastPage = value + End Set + End Property + + Private _DataChanged As Boolean = False + Public Property DataChanged() As Boolean + Get + Return Me._DataChanged + End Get + Set(ByVal value As Boolean) + Me._DataChanged = value + End Set + End Property + + Private _ResetData As Boolean = False + Public Property ResetData() As Boolean + Get + Return Me._ResetData + End Get + Set(ByVal value As Boolean) + Me._ResetData = value + End Set + End Property + + Private _AddNewRecord As Integer = 0 + Public Property AddNewRecord() As Integer + Get + Return Me._AddNewRecord + End Get + Set(ByVal value As Integer) + Me._AddNewRecord = value + End Set + End Property + + + Private _CurrentSortOrder As OrderBy = Nothing + Public Property CurrentSortOrder() As OrderBy + Get + Return Me._CurrentSortOrder + End Get + Set(ByVal value As BaseClasses.Data.OrderBy) + Me._CurrentSortOrder = value + End Set + End Property + + Private _DataSource() As PersonalEducationRecord = Nothing + Public Property DataSource() As PersonalEducationRecord () + Get + Return Me._DataSource + End Get + Set(ByVal value() As PersonalEducationRecord) + Me._DataSource = value + End Set + End Property + +#Region "Helper Properties" + + Public ReadOnly Property CommandDateLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "CommandDateLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property CommandLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "CommandLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property COUNTRYFilter() As System.Web.UI.WebControls.DropDownList + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "COUNTRYFilter"), System.Web.UI.WebControls.DropDownList) + End Get + End Property + + Public ReadOnly Property COUNTRYLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "COUNTRYLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property COUNTRYLabel1() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "COUNTRYLabel1"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property CourseAbbrLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "CourseAbbrLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property CourseLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "CourseLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property CourseNoLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "CourseNoLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property EducationPeriodLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "EducationPeriodLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property EducationTypeLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "EducationTypeLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property EdYearLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "EdYearLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property EndDateLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "EndDateLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property FacultryLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "FacultryLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property InstitueLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "InstitueLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property LevelIdFilter() As System.Web.UI.WebControls.DropDownList + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "LevelIdFilter"), System.Web.UI.WebControls.DropDownList) + End Get + End Property + + Public ReadOnly Property LevelIdLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "LevelIdLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property LevelIdLabel1() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "LevelIdLabel1"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property NoAllLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "NoAllLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property PersonalEducationExportCSVButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalEducationExportCSVButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalEducationExportExcelButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalEducationExportExcelButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalEducationNewButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalEducationNewButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalEducationPagination() As Persons.UI.IPagination + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalEducationPagination"), Persons.UI.IPagination) + End Get + End Property + + Public ReadOnly Property PersonalEducationPDFButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalEducationPDFButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalEducationRefreshButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalEducationRefreshButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalEducationResetButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalEducationResetButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalEducationSearch() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalEducationSearch"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property PersonalEducationSearchButton() As Persons.UI.IThemeButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalEducationSearchButton"), Persons.UI.IThemeButton) + End Get + End Property + + Public ReadOnly Property PersonalEducationTableControlCollapsibleRegion() As System.Web.UI.WebControls.Panel + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalEducationTableControlCollapsibleRegion"), System.Web.UI.WebControls.Panel) + End Get + End Property + + Public ReadOnly Property PersonalEducationTableControlIcon() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalEducationTableControlIcon"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalEducationTableControlPanelExtender() As AjaxControlToolkit.CollapsiblePanelExtender + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalEducationTableControlPanelExtender"), AjaxControlToolkit.CollapsiblePanelExtender) + End Get + End Property + + Public ReadOnly Property PersonalEducationTitle() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalEducationTitle"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property PersonalEducationToggleAll() As System.Web.UI.WebControls.CheckBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalEducationToggleAll"), System.Web.UI.WebControls.CheckBox) + End Get + End Property + + Public ReadOnly Property PersonalEducationWordButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalEducationWordButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalIdFilter() As System.Web.UI.WebControls.DropDownList + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalIdFilter"), System.Web.UI.WebControls.DropDownList) + End Get + End Property + + Public ReadOnly Property PersonalIdLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalIdLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property PersonalIdLabel1() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalIdLabel1"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property ScoreLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "ScoreLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property ScoreNoLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "ScoreNoLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property StartDateLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "StartDateLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + +#End Region + +#Region "Helper Functions" + + Public Overrides Overloads Function ModifyRedirectUrl(url As String, arg As String, ByVal bEncrypt As Boolean) As String + Return Me.Page.EvaluateExpressions(url, arg, bEncrypt, Me) + End Function + + Public Overrides Overloads Function EvaluateExpressions(url As String, arg As String, ByVal bEncrypt As Boolean) As String + Dim needToProcess As Boolean = AreAnyUrlParametersForMe(url, arg) + If (needToProcess) Then + Dim recCtl As PersonalEducationTableControlRow = Me.GetSelectedRecordControl() + If recCtl Is Nothing AndAlso url.IndexOf("{") >= 0 Then + ' Localization. + Throw New Exception(Page.GetResourceValue("Err:NoRecSelected", "Persons")) + End If + Dim rec As PersonalEducationRecord = Nothing + If recCtl IsNot Nothing Then + rec = recCtl.GetRecord() + End If + Return EvaluateExpressions(url, arg, rec, bEncrypt) + End If + Return url + End Function + + Public Overridable Function GetSelectedRecordIndex() As Integer + Dim counter As Integer = 0 + Dim recControl As PersonalEducationTableControlRow + For Each recControl In Me.GetRecordControls() + If recControl.PersonalEducationRecordRowSelection.Checked Then + Return counter + End If + counter += 1 + Next + Return -1 + End Function + + Public Overridable Function GetSelectedRecordControl() As PersonalEducationTableControlRow + Dim selectedList() As PersonalEducationTableControlRow = Me.GetSelectedRecordControls() + If selectedList.Length = 0 Then + Return Nothing + End If + Return selectedList(0) + + End Function + + Public Overridable Function GetSelectedRecordControls() As PersonalEducationTableControlRow() + + Dim selectedList As ArrayList = New ArrayList(25) + Dim recControl As PersonalEducationTableControlRow + For Each recControl In Me.GetRecordControls() + If recControl.PersonalEducationRecordRowSelection IsNot Nothing AndAlso recControl.PersonalEducationRecordRowSelection.Checked Then + selectedList.Add(recControl) + End If + Next + Return DirectCast(selectedList.ToArray(GetType(PersonalEducationTableControlRow)), PersonalEducationTableControlRow()) + + End Function + + Public Overridable Sub DeleteSelectedRecords(ByVal deferDeletion As Boolean) + Dim recList() As PersonalEducationTableControlRow = Me.GetSelectedRecordControls() + If recList.Length = 0 Then + ' Localization. + Throw New Exception(Page.GetResourceValue("Err:NoRecSelected", "Persons")) + End If + + Dim recCtl As PersonalEducationTableControlRow + For Each recCtl In recList + If deferDeletion Then + If Not recCtl.IsNewRecord Then + + Me.AddToDeletedRecordIds(recCtl) + + End If + recCtl.Visible = False + + recCtl.PersonalEducationRecordRowSelection.Checked = False + + Else + + recCtl.Delete() + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + End If + Next + End Sub + + Public Function GetRecordControls() As PersonalEducationTableControlRow() + Dim recList As ArrayList = New ArrayList() + Dim rep As System.Web.UI.WebControls.Repeater = CType(Me.FindControl("PersonalEducationTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return Nothing + Dim repItem As System.Web.UI.WebControls.RepeaterItem + + For Each repItem In rep.Items + + Dim recControl As PersonalEducationTableControlRow = DirectCast(repItem.FindControl("PersonalEducationTableControlRow"), PersonalEducationTableControlRow) + recList.Add(recControl) + + Next + + Return DirectCast(recList.ToArray(GetType(PersonalEducationTableControlRow)), PersonalEducationTableControlRow()) + End Function + + Public Shadows ReadOnly Property Page() As BaseApplicationPage + Get + Return DirectCast(MyBase.Page, BaseApplicationPage) + End Get + End Property + +#End Region + + + +End Class + + + +#End Region + + +End Namespace + + \ No newline at end of file diff --git a/App_Code/PersonalEducation/ShowPersonalEducationTable1.Controls.vb b/App_Code/PersonalEducation/ShowPersonalEducationTable1.Controls.vb new file mode 100644 index 0000000..266733c --- /dev/null +++ b/App_Code/PersonalEducation/ShowPersonalEducationTable1.Controls.vb @@ -0,0 +1,4469 @@ + +' This file implements the TableControl, TableControlRow, and RecordControl classes for the +' ShowPersonalEducationTable1.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.ShowPersonalEducationTable1 + +#Region "Section 1: Place your customizations here." + + +Public Class PersonalEducationTableControlRow + Inherits BasePersonalEducationTableControlRow + ' The BasePersonalEducationTableControlRow implements code for a ROW within the + ' the PersonalEducationTableControl table. The BasePersonalEducationTableControlRow implements the DataBind and SaveData methods. + ' The loading of data is actually performed by the LoadData method in the base class of PersonalEducationTableControl. + + ' This is the ideal place to add your code customizations. For example, you can override the DataBind, + ' SaveData, GetUIData, and Validate methods. + + +End Class + + + +Public Class PersonalEducationTableControl + Inherits BasePersonalEducationTableControl + + ' The BasePersonalEducationTableControl class implements the LoadData, DataBind, CreateWhereClause + ' and other methods to load and display the data in a table control. + + ' This is the ideal place to add your code customizations. You can override the LoadData and CreateWhereClause, + ' The PersonalEducationTableControlRow class offers another place where you can customize + ' the DataBind, GetUIData, SaveData and Validate methods specific to each row displayed on the table. + +End Class + + + + +Public Class PersonalIdTableControl + Inherits BasePersonalIdTableControl + + Private Sub PersonalIdTableControl_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Init + Me.CurrentSortOrder.Reset() + 'Me.CurrentSortOrder = New OrderBy(True, True) + Me.CurrentSortOrder.Add(PersonalIdTable.RankId, OrderByItem.OrderDir.Asc) + Me.CurrentSortOrder.Add(PersonalIdTable.DateRank, OrderByItem.OrderDir.Asc) + Me.CurrentSortOrder.Add(PersonalIdTable.DatePrevRank, OrderByItem.OrderDir.Asc) + + End Sub + + ' The BasePersonalIdTableControl class implements the LoadData, DataBind, CreateWhereClause + ' and other methods to load and display the data in a table control. + + ' This is the ideal place to add your code customizations. You can override the LoadData and CreateWhereClause, + ' The PersonalIdTableControlRow class offers another place where you can customize + ' the DataBind, GetUIData, SaveData and Validate methods specific to each row displayed on the table. + + Private Sub PersonalIdTableControl_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load + Me.CurrentSortOrder.Reset() + 'Me.CurrentSortOrder = New OrderBy(True, True) + Me.CurrentSortOrder.Add(PersonalIdTable.RankId, OrderByItem.OrderDir.Asc) + Me.CurrentSortOrder.Add(PersonalIdTable.DateRank, OrderByItem.OrderDir.Asc) + Me.CurrentSortOrder.Add(PersonalIdTable.DatePrevRank, OrderByItem.OrderDir.Asc) + + + End Sub + + + End Class +Public Class PersonalIdTableControlRow + Inherits BasePersonalIdTableControlRow + ' The BasePersonalIdTableControlRow implements code for a ROW within the + ' the PersonalIdTableControl table. The BasePersonalIdTableControlRow implements the DataBind and SaveData methods. + ' The loading of data is actually performed by the LoadData method in the base class of PersonalIdTableControl. + + ' This is the ideal place to add your code customizations. For example, you can override the DataBind, + ' SaveData, GetUIData, and Validate methods. + + + Private Sub PersonalIdTableControlRow_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.PreRender + Me.PersonalId.Text = Ps.GetName(Me.PersonalId.Text) + End Sub + End Class +#End Region + + + +#Region "Section 2: Do not modify this section." + + +' Base class for the PersonalEducationTableControlRow control on the ShowPersonalEducationTable1 page. +' Do not modify this class. Instead override any method in PersonalEducationTableControlRow. +Public Class BasePersonalEducationTableControlRow + Inherits Persons.UI.BaseApplicationRecordControl + + ' To customize, override this method in PersonalEducationTableControlRow. + Protected Overridable Sub Control_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Init + + Me.ClearControlsFromSession() + End Sub + + ' To customize, override this method in PersonalEducationTableControlRow. + Protected Overridable Sub Control_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load + + 'Call LoadFocusScripts from repeater so that onfocus attribute could be added to elements + Me.Page.LoadFocusScripts(Me) + + + ' Register the event handlers. + + + End Sub + + + Public Overridable Sub LoadData() + + ' Load the data from the database into the DataSource PersonalEducation record. + ' It is better to make changes to functions called by LoadData such as + ' CreateWhereClause, rather than making changes here. + + ' The RecordUniqueId is set the first time a record is loaded, and is + ' used during a PostBack to load the record. + + If Me.RecordUniqueId IsNot Nothing AndAlso Me.RecordUniqueId.Trim <> "" Then + Me.DataSource = PersonalEducationTable.GetRecord(Me.RecordUniqueId, True) + + Return + End If + + ' Since this is a row in the table, the data for this row is loaded by the + ' LoadData method of the BasePersonalEducationTableControl when the data for the entire + ' table is loaded. + + Me.DataSource = New PersonalEducationRecord() + + + + End Sub + + ' Populate the UI controls using the DataSource. To customize, override this method in PersonalEducationTableControlRow. + Public Overrides Sub DataBind() + ' The DataBind method binds the user interface controls to the values + ' from the database record. To do this, it calls the Set methods for + ' each of the field displayed on the webpage. It is better to make + ' changes in the Set methods, rather than making changes here. + + MyBase.DataBind() + + ' Make sure that the DataSource is initialized. + If Me.DataSource Is Nothing Then + + Return + End If + + + 'LoadData for DataSource for chart and report if they exist + + + + ' Call the Set methods for each controls on the panel + + SetCOUNTRY() + SetCourse() + SetCourseAbbr() + SetEducationType() + SetEdYear() + SetEndDate() + SetFacultry() + SetInstitue() + SetLevelId() + SetStartDate() + + + Me.IsNewRecord = True + + If Me.DataSource.IsCreated Then + Me.IsNewRecord = False + + Me.RecordUniqueId = Me.DataSource.GetID.ToXmlString() + End If + + ' Now load data for each record and table child UI controls. + ' Ordering is important because child controls get + ' their parent ids from their parent UI controls. + Dim shouldResetControl As Boolean = False + + End Sub + + + Public Overridable Sub SetCOUNTRY() + + + ' Set the COUNTRY Literal on the webpage with value from the + ' PersonalEducation database record. + + ' Me.DataSource is the PersonalEducation record retrieved from the database. + ' Me.COUNTRY is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetCOUNTRY() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.COUNTRYSpecified Then + + ' If the COUNTRY is non-NULL, then format the value. + + ' The Format method will return the Display Foreign Key As (DFKA) value + Dim formattedValue As String = "" + Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalEducationTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalEducationTable.COUNTRY) + If _isExpandableNonCompositeForeignKey AndAlso PersonalEducationTable.COUNTRY.IsApplyDisplayAs Then + + formattedValue = PersonalEducationTable.GetDFKA(Me.DataSource.COUNTRY.ToString(),PersonalEducationTable.COUNTRY, Nothing) + + if (formattedValue Is Nothing) Then + formattedValue = Me.DataSource.Format(PersonalEducationTable.COUNTRY) + End If + Else + formattedValue = Me.DataSource.COUNTRY.ToString() + End If + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.COUNTRY.Text = formattedValue + + Else + + ' COUNTRY is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.COUNTRY.Text = PersonalEducationTable.COUNTRY.Format(PersonalEducationTable.COUNTRY.DefaultValue) + + End If + + ' If the COUNTRY is NULL or blank, then use the value specified + ' on Properties. + If Me.COUNTRY.Text Is Nothing _ + OrElse Me.COUNTRY.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.COUNTRY.Text = " " + End If + + End Sub + + Public Overridable Sub SetCourse() + + + ' Set the Course Literal on the webpage with value from the + ' PersonalEducation database record. + + ' Me.DataSource is the PersonalEducation record retrieved from the database. + ' Me.Course is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetCourse() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.CourseSpecified Then + + ' If the Course is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalEducationTable.Course) + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.Course.Text = formattedValue + + Else + + ' Course is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.Course.Text = PersonalEducationTable.Course.Format(PersonalEducationTable.Course.DefaultValue) + + End If + + ' If the Course is NULL or blank, then use the value specified + ' on Properties. + If Me.Course.Text Is Nothing _ + OrElse Me.Course.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.Course.Text = " " + End If + + End Sub + + Public Overridable Sub SetCourseAbbr() + + + ' Set the CourseAbbr Literal on the webpage with value from the + ' PersonalEducation database record. + + ' Me.DataSource is the PersonalEducation record retrieved from the database. + ' Me.CourseAbbr is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetCourseAbbr() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.CourseAbbrSpecified Then + + ' If the CourseAbbr is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalEducationTable.CourseAbbr) + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.CourseAbbr.Text = formattedValue + + Else + + ' CourseAbbr is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.CourseAbbr.Text = PersonalEducationTable.CourseAbbr.Format(PersonalEducationTable.CourseAbbr.DefaultValue) + + End If + + ' If the CourseAbbr is NULL or blank, then use the value specified + ' on Properties. + If Me.CourseAbbr.Text Is Nothing _ + OrElse Me.CourseAbbr.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.CourseAbbr.Text = " " + End If + + End Sub + + Public Overridable Sub SetEducationType() + + + ' Set the EducationType Literal on the webpage with value from the + ' PersonalEducation database record. + + ' Me.DataSource is the PersonalEducation record retrieved from the database. + ' Me.EducationType is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetEducationType() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.EducationTypeSpecified Then + + ' If the EducationType is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalEducationTable.EducationType) + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.EducationType.Text = formattedValue + + Else + + ' EducationType is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.EducationType.Text = PersonalEducationTable.EducationType.Format(PersonalEducationTable.EducationType.DefaultValue) + + End If + + ' If the EducationType is NULL or blank, then use the value specified + ' on Properties. + If Me.EducationType.Text Is Nothing _ + OrElse Me.EducationType.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.EducationType.Text = " " + End If + + End Sub + + Public Overridable Sub SetEdYear() + + + ' Set the EdYear Literal on the webpage with value from the + ' PersonalEducation database record. + + ' Me.DataSource is the PersonalEducation record retrieved from the database. + ' Me.EdYear is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetEdYear() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.EdYearSpecified Then + + ' If the EdYear is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalEducationTable.EdYear) + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.EdYear.Text = formattedValue + + Else + + ' EdYear is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.EdYear.Text = PersonalEducationTable.EdYear.Format(PersonalEducationTable.EdYear.DefaultValue) + + End If + + ' If the EdYear is NULL or blank, then use the value specified + ' on Properties. + If Me.EdYear.Text Is Nothing _ + OrElse Me.EdYear.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.EdYear.Text = " " + End If + + End Sub + + Public Overridable Sub SetEndDate() + + + ' Set the EndDate Literal on the webpage with value from the + ' PersonalEducation database record. + + ' Me.DataSource is the PersonalEducation record retrieved from the database. + ' Me.EndDate is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetEndDate() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.EndDateSpecified Then + + ' If the EndDate is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalEducationTable.EndDate, "d MMM yy") + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.EndDate.Text = formattedValue + + Else + + ' EndDate is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.EndDate.Text = PersonalEducationTable.EndDate.Format(PersonalEducationTable.EndDate.DefaultValue, "d MMM yy") + + End If + + ' If the EndDate is NULL or blank, then use the value specified + ' on Properties. + If Me.EndDate.Text Is Nothing _ + OrElse Me.EndDate.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.EndDate.Text = " " + End If + + End Sub + + Public Overridable Sub SetFacultry() + + + ' Set the Facultry Literal on the webpage with value from the + ' PersonalEducation database record. + + ' Me.DataSource is the PersonalEducation record retrieved from the database. + ' Me.Facultry is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetFacultry() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.FacultrySpecified Then + + ' If the Facultry is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalEducationTable.Facultry) + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.Facultry.Text = formattedValue + + Else + + ' Facultry is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.Facultry.Text = PersonalEducationTable.Facultry.Format(PersonalEducationTable.Facultry.DefaultValue) + + End If + + ' If the Facultry is NULL or blank, then use the value specified + ' on Properties. + If Me.Facultry.Text Is Nothing _ + OrElse Me.Facultry.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.Facultry.Text = " " + End If + + End Sub + + Public Overridable Sub SetInstitue() + + + ' Set the Institue Literal on the webpage with value from the + ' PersonalEducation database record. + + ' Me.DataSource is the PersonalEducation record retrieved from the database. + ' Me.Institue is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetInstitue() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.InstitueSpecified Then + + ' If the Institue is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalEducationTable.Institue) + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.Institue.Text = formattedValue + + Else + + ' Institue is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.Institue.Text = PersonalEducationTable.Institue.Format(PersonalEducationTable.Institue.DefaultValue) + + End If + + ' If the Institue is NULL or blank, then use the value specified + ' on Properties. + If Me.Institue.Text Is Nothing _ + OrElse Me.Institue.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.Institue.Text = " " + End If + + End Sub + + Public Overridable Sub SetLevelId() + + + ' Set the LevelId Literal on the webpage with value from the + ' PersonalEducation database record. + + ' Me.DataSource is the PersonalEducation record retrieved from the database. + ' Me.LevelId is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetLevelId() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.LevelIdSpecified Then + + ' If the LevelId is non-NULL, then format the value. + + ' The Format method will return the Display Foreign Key As (DFKA) value + Dim formattedValue As String = "" + Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalEducationTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalEducationTable.LevelId) + If _isExpandableNonCompositeForeignKey AndAlso PersonalEducationTable.LevelId.IsApplyDisplayAs Then + + formattedValue = PersonalEducationTable.GetDFKA(Me.DataSource.LevelId.ToString(),PersonalEducationTable.LevelId, Nothing) + + if (formattedValue Is Nothing) Then + formattedValue = Me.DataSource.Format(PersonalEducationTable.LevelId) + End If + Else + formattedValue = Me.DataSource.LevelId.ToString() + End If + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.LevelId.Text = formattedValue + + Else + + ' LevelId is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.LevelId.Text = PersonalEducationTable.LevelId.Format(PersonalEducationTable.LevelId.DefaultValue) + + End If + + ' If the LevelId is NULL or blank, then use the value specified + ' on Properties. + If Me.LevelId.Text Is Nothing _ + OrElse Me.LevelId.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.LevelId.Text = " " + End If + + End Sub + + Public Overridable Sub SetStartDate() + + + ' Set the StartDate Literal on the webpage with value from the + ' PersonalEducation database record. + + ' Me.DataSource is the PersonalEducation record retrieved from the database. + ' Me.StartDate is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetStartDate() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.StartDateSpecified Then + + ' If the StartDate is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalEducationTable.StartDate, "d MMM yy") + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.StartDate.Text = formattedValue + + Else + + ' StartDate is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.StartDate.Text = PersonalEducationTable.StartDate.Format(PersonalEducationTable.StartDate.DefaultValue, "d MMM yy") + + End If + + ' If the StartDate is NULL or blank, then use the value specified + ' on Properties. + If Me.StartDate.Text Is Nothing _ + OrElse Me.StartDate.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.StartDate.Text = " " + End If + + End Sub + + + Public EvaluateFormulaDelegate As BaseClasses.Data.DataSource.EvaluateFormulaDelegate = New BaseClasses.Data.DataSource.EvaluateFormulaDelegate(AddressOf Me.EvaluateFormula) + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean, ByVal e As FormulaEvaluator) As String + If e Is Nothing Then + e = New FormulaEvaluator() + End If + + e.Variables.Clear() + + + ' add variables for formula evaluation + If variables IsNot Nothing Then + Dim enumerator As System.Collections.Generic.IEnumerator(Of System.Collections.Generic.KeyValuePair(Of String, Object)) = variables.GetEnumerator() + While enumerator.MoveNext() + e.Variables.Add(enumerator.Current.Key, enumerator.Current.Value) + End While + End If + + If includeDS + + End IF + + + ' Other variables referred to in the formula are expected to be + ' properties of the DataSource. For example, referring to + ' UnitPrice as a variable will refer to DataSource.UnitPrice + If dataSourceForEvaluate Is Nothing Then + + e.DataSource = Me.DataSource + + Else + e.DataSource = dataSourceForEvaluate + End If + + ' Define the calling control. This is used to add other + ' related table and record controls as variables. + e.CallingControl = Me + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + + If Not String.IsNullOrEmpty(format) AndAlso (String.IsNullOrEmpty(formula) OrElse formula.IndexOf("Format(") < 0) Then + Return FormulaUtils.Format(resultObj, format) + Else + Return resultObj.ToString() + End If + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format,variables ,includeDS, Nothing) + End Function + + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object)) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format, variables ,True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, format, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal e as FormulaEvaluator) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, variables, True, e) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal includeDS as Boolean) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, includeDS, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, True, Nothing) + End Function + + + Public Overridable Sub RegisterPostback() + + + End Sub + + + + ' To customize, override this method in PersonalEducationTableControlRow. + Public Overridable Sub SaveData() + ' Saves the associated record in the database. + ' SaveData calls Validate and Get methods - so it may be more appropriate to + ' customize those methods. + + ' 1. Load the existing record from the database. Since we save the entire record, this ensures + ' that fields that are not displayed are also properly initialized. + Me.LoadData() + + Dim parentCtrl As PersonalIdTableControlRow + + + parentCtrl = DirectCast(MiscUtils.GetParentControlObject(Me, "PersonalIdTableControlRow"), PersonalIdTableControlRow) + + If (Not IsNothing(parentCtrl) AndAlso IsNothing(parentCtrl.DataSource)) + ' Load the record if it is not loaded yet. + parentCtrl.LoadData() + End If + If (IsNothing(parentCtrl) OrElse IsNothing(parentCtrl.DataSource)) + ' Get the error message from the application resource file. + Throw New Exception(Page.GetResourceValue("Err:NoParentRecId", "Persons")) + End If + + Me.DataSource.PersonalId = parentCtrl.DataSource.PersonalId + + ' 2. Perform any custom validation. + Me.Validate() + + + ' 3. Set the values in the record with data from UI controls. + ' This calls the Get() method for each of the user interface controls. + Me.GetUIData() + + ' 4. Save in the database. + ' We should not save the record if the data did not change. This + ' will save a database hit and avoid triggering any database triggers. + + If Me.DataSource.IsAnyValueChanged Then + ' Save record to database but do not commit yet. + ' Auto generated ids are available after saving for use by child (dependent) records. + Me.DataSource.Save() + + DirectCast(GetParentControlObject(Me, "PersonalEducationTableControl"), PersonalEducationTableControl).DataChanged = True + DirectCast(GetParentControlObject(Me, "PersonalEducationTableControl"), PersonalEducationTableControl).ResetData = True + End If + + + ' update session or cookie by formula + + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + ' For Master-Detail relationships, save data on the Detail table(s) + + End Sub + + ' To customize, override this method in PersonalEducationTableControlRow. + Public Overridable Sub GetUIData() + ' The GetUIData method retrieves the updated values from the user interface + ' controls into a database record in preparation for saving or updating. + ' To do this, it calls the Get methods for each of the field displayed on + ' the webpage. It is better to make changes in the Get methods, rather + ' than making changes here. + + ' Call the Get methods for each of the user interface controls. + + GetCOUNTRY() + GetCourse() + GetCourseAbbr() + GetEducationType() + GetEdYear() + GetEndDate() + GetFacultry() + GetInstitue() + GetLevelId() + GetStartDate() + End Sub + + + Public Overridable Sub GetCOUNTRY() + + End Sub + + Public Overridable Sub GetCourse() + + End Sub + + Public Overridable Sub GetCourseAbbr() + + End Sub + + Public Overridable Sub GetEducationType() + + End Sub + + Public Overridable Sub GetEdYear() + + End Sub + + Public Overridable Sub GetEndDate() + + End Sub + + Public Overridable Sub GetFacultry() + + End Sub + + Public Overridable Sub GetInstitue() + + End Sub + + Public Overridable Sub GetLevelId() + + End Sub + + Public Overridable Sub GetStartDate() + + End Sub + + + ' To customize, override this method in PersonalEducationTableControlRow. + + Public Overridable Function CreateWhereClause() As WhereClause + + Return Nothing + + End Function + + + + ' To customize, override this method in PersonalEducationTableControlRow. + Public Overridable Sub Validate() + ' Add custom validation for any control within this panel. + ' Example. If you have a State ASP:Textbox control + ' If Me.State.Text <> "CA" Then + ' Throw New Exception("State must be CA (California).") + ' End If + + ' The Validate method is common across all controls within + ' this panel so you can validate multiple fields, but report + ' one error message. + + + End Sub + + Public Overridable Sub Delete() + + If Me.IsNewRecord() Then + Return + End If + + Dim pkValue As KeyValue = KeyValue.XmlToKey(Me.RecordUniqueId) + PersonalEducationTable.DeleteRecord(pkValue) + + DirectCast(GetParentControlObject(Me, "PersonalEducationTableControl"), PersonalEducationTableControl).DataChanged = True + DirectCast(GetParentControlObject(Me, "PersonalEducationTableControl"), PersonalEducationTableControl).ResetData = True + End Sub + + Protected Overridable Sub Control_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.PreRender + ' PreRender event is raised just before page is being displayed. + Try + DbUtils.StartTransaction() + Me.RegisterPostback() + + If Not Me.Page.ErrorOnPage AndAlso (Me.Page.IsPageRefresh OrElse Me.DataChanged OrElse Me.ResetData) Then + + + ' Re-load the data and update the web page if necessary. + ' This is typically done during a postback (filter, search button, sort, pagination button). + ' In each of the other click handlers, simply set DataChanged to True to reload the data. + Me.LoadData() + Me.DataBind() + End If + + + Catch ex As Exception + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + Finally + DbUtils.EndTransaction() + End Try + End Sub + + + Protected Overrides Sub SaveControlsToSession() + MyBase.SaveControlsToSession() + + + 'Save pagination state to session. + + End Sub + + + + Protected Overrides Sub ClearControlsFromSession() + MyBase.ClearControlsFromSession() + + + + ' Clear pagination state from session. + + End Sub + + Protected Overrides Sub LoadViewState(ByVal savedState As Object) + MyBase.LoadViewState(savedState) + Dim isNewRecord As String = CType(ViewState("IsNewRecord"), String) + If Not isNewRecord Is Nothing AndAlso isNewRecord.Trim <> "" Then + Me.IsNewRecord = Boolean.Parse(isNewRecord) + End If + + Dim myCheckSum As String = CType(ViewState("CheckSum"), String) + If Not myCheckSum Is Nothing AndAlso myCheckSum.Trim <> "" Then + Me.CheckSum = myCheckSum + End If + + + ' Load view state for pagination control. + + End Sub + + Protected Overrides Function SaveViewState() As Object + ViewState("IsNewRecord") = Me.IsNewRecord.ToString() + ViewState("CheckSum") = Me.CheckSum + + + ' Load view state for pagination control. + + Return MyBase.SaveViewState() + End Function + + + + Private _PreviousUIData As New Hashtable + Public Overridable Property PreviousUIData() As Hashtable + Get + Return _PreviousUIData + End Get + Set(ByVal value As Hashtable) + _PreviousUIData = value + End Set + End Property + + Private _IsNewRecord As Boolean = True + Public Overridable Property IsNewRecord() As Boolean + Get + Return Me._IsNewRecord + End Get + Set(ByVal value As Boolean) + Me._IsNewRecord = value + End Set + End Property + + Private _DataChanged As Boolean = False + Public Overridable Property DataChanged() As Boolean + Get + Return Me._DataChanged + End Get + Set(ByVal Value As Boolean) + Me._DataChanged = Value + End Set + End Property + + Private _ResetData As Boolean = False + Public Overridable Property ResetData() As Boolean + Get + Return Me._ResetData + End Get + Set(ByVal Value As Boolean) + Me._ResetData = Value + End Set + End Property + + Public Property RecordUniqueId() As String + Get + Return CType(Me.ViewState("BasePersonalEducationTableControlRow_Rec"), String) + End Get + Set(ByVal value As String) + Me.ViewState("BasePersonalEducationTableControlRow_Rec") = value + End Set + End Property + + Private _DataSource As PersonalEducationRecord + Public Property DataSource() As PersonalEducationRecord + Get + Return Me._DataSource + End Get + + Set(ByVal value As PersonalEducationRecord) + + Me._DataSource = value + End Set + End Property + + + + Private _checkSum As String + Public Overridable Property CheckSum() As String + Get + Return Me._checkSum + End Get + Set(ByVal value As String) + Me._checkSum = value + End Set + End Property + + Private _TotalPages As Integer + Public Property TotalPages() As Integer + Get + Return Me._TotalPages + End Get + Set(ByVal value As Integer) + Me._TotalPages = value + End Set + End Property + + Private _PageIndex As Integer + Public Property PageIndex() As Integer + Get + ' Return the PageIndex + Return Me._PageIndex + End Get + Set(ByVal value As Integer) + Me._PageIndex = value + End Set + End Property + + Private _DisplayLastPage As Boolean + Public Property DisplayLastPage() As Boolean + Get + Return Me._DisplayLastPage + End Get + Set(ByVal value As Boolean) + Me._DisplayLastPage = value + End Set + End Property + + + +#Region "Helper Properties" + + Public ReadOnly Property COUNTRY() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "COUNTRY"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property Course() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Course"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property CourseAbbr() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "CourseAbbr"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property EducationType() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "EducationType"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property EdYear() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "EdYear"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property EndDate() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "EndDate"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property Facultry() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Facultry"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property Institue() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Institue"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property LevelId() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "LevelId"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property StartDate() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "StartDate"), System.Web.UI.WebControls.Literal) + End Get + End Property + +#End Region + +#Region "Helper Functions" + + Public Overrides Overloads Function ModifyRedirectUrl(ByVal url As String, ByVal arg As String, ByVal bEncrypt As Boolean) As String + Return Me.Page.EvaluateExpressions(url, arg, bEncrypt, Me) + End Function + + Public Overrides Overloads Function EvaluateExpressions(ByVal url As String, ByVal arg As String, ByVal bEncrypt As Boolean) As String + + Dim rec As PersonalEducationRecord = Nothing + + + Try + rec = Me.GetRecord() + Catch ex As Exception + ' Do nothing + End Try + + If rec Is Nothing AndAlso url.IndexOf("{") >= 0 Then + ' Localization. + + Throw New Exception(Page.GetResourceValue("Err:RecDataSrcNotInitialized", "Persons")) + + End If + Return EvaluateExpressions(url, arg, rec, bEncrypt) + End Function + + + Public Overridable Function GetRecord() As PersonalEducationRecord + If Not Me.DataSource Is Nothing Then + Return Me.DataSource + End If + + If Not Me.RecordUniqueId Is Nothing Then + + Return PersonalEducationTable.GetRecord(Me.RecordUniqueId, True) + + End If + + ' Localization. + + Return Nothing + + End Function + + Public Shadows ReadOnly Property Page() As BaseApplicationPage + Get + Return DirectCast(MyBase.Page, BaseApplicationPage) + End Get + End Property + +#End Region + +End Class + + + +' Base class for the PersonalEducationTableControl control on the ShowPersonalEducationTable1 page. +' Do not modify this class. Instead override any method in PersonalEducationTableControl. +Public Class BasePersonalEducationTableControl + Inherits Persons.UI.BaseApplicationTableControl + + + + Protected Overridable Sub Control_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Init + + + + ' Setup the filter and search events. + + + + ' Control Initializations. + ' Initialize the table's current sort order. + + If Me.InSession(Me, "Order_By") Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + Me.CurrentSortOrder.Add(PersonalEducationTable.StartDate, OrderByItem.OrderDir.Asc) + + Me.CurrentSortOrder.Add(PersonalEducationTable.EdYear, OrderByItem.OrderDir.Asc) + + End If + + + + ' Setup default pagination settings. + + Me.PageSize = CInt(Me.GetFromSession(Me, "Page_Size", "100")) + Me.PageIndex = CInt(Me.GetFromSession(Me, "Page_Index", "0")) + + + + Me.ClearControlsFromSession() + End Sub + + Protected Overridable Sub Control_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load + + SaveControlsToSession_Ajax() + + ' Setup the pagination events. + + + ' Setup the sorting events. + + ' Setup the button events. + + + ' Setup events for others + + End Sub + + + Public Overridable Sub LoadData() + + ' Read data from database. Returns an array of records that can be assigned + ' to the DataSource table control property. + Try + Dim joinFilter As CompoundFilter = CreateCompoundJoinFilter() + + ' The WHERE clause will be empty when displaying all records in table. + Dim wc As WhereClause = CreateWhereClause() + If wc IsNot Nothing AndAlso Not wc.RunQuery Then + ' Initialize an empty array of records + Dim alist As New ArrayList(0) + Me.DataSource = DirectCast(alist.ToArray(GetType(PersonalEducationRecord)), PersonalEducationRecord()) + ' Add records to the list if needed. + Me.AddNewRecords() + Me._TotalRecords = 0 + Me._TotalPages = 0 + Return + End If + + ' Call OrderBy to determine the order - either use the order defined + ' on the Query Wizard, or specified by user (by clicking on column heading) + Dim orderBy As OrderBy = CreateOrderBy() + + ' Get the pagesize from the pagesize control. + Me.GetPageSize() + + If Me.DisplayLastPage Then + Dim totalRecords As Integer = If(Me._TotalRecords < 0, PersonalEducationTable.GetRecordCount(CreateCompoundJoinFilter(), CreateWhereClause()), Me._TotalRecords) + + Dim totalPages As Integer = CInt(Math.Ceiling(totalRecords / Me.PageSize)) + + Me.PageIndex = totalPages - 1 + End If + + ' Make sure PageIndex (current page) and PageSize are within bounds. + If Me.PageIndex < 0 Then + Me.PageIndex = 0 + End If + If Me.PageSize < 1 Then + Me.PageSize = 1 + End If + + ' Retrieve the records and set the table DataSource. + ' Only PageSize records are fetched starting at PageIndex (zero based). + If Me.AddNewRecord > 0 Then + ' Make sure to preserve the previously entered data on new rows. + Dim postdata As New ArrayList + For Each rc As PersonalEducationTableControlRow In Me.GetRecordControls() + If Not rc.IsNewRecord Then + rc.DataSource = rc.GetRecord() + rc.GetUIData() + postdata.Add(rc.DataSource) + UIData.Add(rc.PreservedUIData()) + End If + Next + Me.DataSource = DirectCast(postdata.ToArray(GetType(PersonalEducationRecord)), PersonalEducationRecord()) + Else ' Get the records from the database + Me.DataSource = PersonalEducationTable.GetRecords(joinFilter, wc, orderBy, Me.PageIndex, Me.PageSize) + + End If + + ' if the datasource contains no records contained in database, then load the last page. + If (DbUtils.GetCreatedRecords(Me.DataSource).Length = 0 AndAlso Not Me.DisplayLastPage) Then + Me.DisplayLastPage = True + LoadData() + Else + + ' Add any new rows desired by the user. + Me.AddNewRecords() + + + ' Initialize the page and grand totals. now + + End If + + Catch ex As Exception + ' Report the error message to the end user + Dim msg As String = ex.Message + If ex.InnerException IsNot Nothing Then + msg = msg & " InnerException: " & ex.InnerException.Message + End If + Throw New Exception(msg, ex.InnerException) + End Try + End Sub + + + + + Public Overrides Sub DataBind() + ' The DataBind method binds the user interface controls to the values + ' from the database record for each row in the table. To do this, it calls the + ' DataBind for each of the rows. + ' DataBind also populates any filters above the table, and sets the pagination + ' control to the correct number of records and the current page number. + + MyBase.DataBind() + + ' Make sure that the DataSource is initialized. + If Me.DataSource Is Nothing Then + Return + End If + + 'LoadData for DataSource for chart and report if they exist + + ' Improve performance by prefetching display as records. + Me.PreFetchForeignKeyValues() + + ' Setup the pagination controls. + BindPaginationControls() + + + + ' Bind the repeater with the list of records to expand the UI. + Dim rep As System.Web.UI.WebControls.Repeater = CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalEducationTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return + rep.DataSource = DataSource() + rep.DataBind() + + Dim index As Integer = 0 + For Each repItem As System.Web.UI.WebControls.RepeaterItem In rep.Items + ' Loop through all rows in the table, set its DataSource and call DataBind(). + Dim recControl As PersonalEducationTableControlRow = DirectCast(repItem.FindControl("PersonalEducationTableControlRow"), PersonalEducationTableControlRow) + recControl.DataSource = Me.DataSource(index) + If Me.UIData.Count > index Then + recControl.PreviousUIData = Me.UIData(index) + End If + recControl.DataBind() + recControl.Visible = Not Me.InDeletedRecordIds(recControl) + + index += 1 + Next + + + + + ' Call the Set methods for each controls on the panel + + SetCOUNTRYLabel() + SetCourseAbbrLabel() + SetCourseLabel() + SetEducationTypeLabel() + SetEdYearLabel() + SetEndDateLabel() + SetFacultryLabel() + SetInstitueLabel() + SetLevelIdLabel1() + SetPersonalEducationTableControlCollapsibleRegion() + SetStartDateLabel() + ' setting the state of expand or collapse alternative rows + + + ' Load data for each record and table UI control. + ' Ordering is important because child controls get + ' their parent ids from their parent UI controls. + + + ' this method calls the set method for controls with special formula like running total, sum, rank, etc + SetFormulaControls() + End Sub + + Public Overridable Sub SetFormulaControls() + ' this method calls Set methods for the control that has special formula + + + + End Sub + + + Public Sub PreFetchForeignKeyValues() + If (IsNothing(Me.DataSource)) + Return + End If + + Me.Page.PregetDfkaRecords(PersonalEducationTable.COUNTRY, Me.DataSource) + + Me.Page.PregetDfkaRecords(PersonalEducationTable.LevelId, Me.DataSource) + + End Sub + + + Public Overridable Sub RegisterPostback() + + + End Sub + + Public EvaluateFormulaDelegate As BaseClasses.Data.DataSource.EvaluateFormulaDelegate = New BaseClasses.Data.DataSource.EvaluateFormulaDelegate(AddressOf Me.EvaluateFormula) + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean, ByVal e as FormulaEvaluator) As String + If e Is Nothing + e = New FormulaEvaluator() + End If + + e.Variables.Clear() + + + ' add variables for formula evaluation + If variables IsNot Nothing Then + Dim enumerator As System.Collections.Generic.IEnumerator(Of System.Collections.Generic.KeyValuePair(Of String, Object)) = variables.GetEnumerator() + While enumerator.MoveNext() + e.Variables.Add(enumerator.Current.Key, enumerator.Current.Value) + End While + End If + + If includeDS + + End If + + ' All variables referred to in the formula are expected to be + ' properties of the DataSource. For example, referring to + ' UnitPrice as a variable will refer to DataSource.UnitPrice + e.DataSource = dataSourceForEvaluate + + ' Define the calling control. This is used to add other + ' related table and record controls as variables. + e.CallingControl = Me + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + + If Not String.IsNullOrEmpty(format) AndAlso (String.IsNullOrEmpty(formula) OrElse formula.IndexOf("Format(") < 0) Then + Return FormulaUtils.Format(resultObj, format) + Else + Return resultObj.ToString() + End If + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format,variables ,includeDS, Nothing) + End Function + + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object)) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format, variables ,True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, format, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal e as FormulaEvaluator) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, variables, True, e) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal includeDS as Boolean) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, includeDS, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, True, Nothing) + End Function + + + + + Public Overridable Sub ResetControl() + + Me.CurrentSortOrder.Reset() + If (Me.InSession(Me, "Order_By")) Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + Me.CurrentSortOrder.Add(PersonalEducationTable.StartDate, OrderByItem.OrderDir.Asc) + + Me.CurrentSortOrder.Add(PersonalEducationTable.EdYear, OrderByItem.OrderDir.Asc) + + End If + + Me.PageIndex = 0 + End Sub + + Protected Overridable Sub BindPaginationControls() + ' Setup the pagination controls. + + ' Bind the pagination labels. + + + ' Bind the buttons for PersonalEducationTableControl pagination. + + + + End Sub + + Public Overridable Sub SaveData() + ' Save the data from the entire table. Calls each row's Save Data + ' to save their data. This function is called by the Click handler of the + ' Save button. The button handler should Start/Commit/End a transaction. + + Dim recCtl As PersonalEducationTableControlRow + For Each recCtl In Me.GetRecordControls() + + If Me.InDeletedRecordIds(recCtl) Then + ' Delete any pending deletes. + recCtl.Delete() + Else + If recCtl.Visible Then + recCtl.SaveData() + End If + End If + + Next + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + ' Set IsNewRecord to False for all records - since everything has been saved and is no longer "new" + For Each recCtl In Me.GetRecordControls() + recCtl.IsNewRecord = False + Next + + + ' Set DeletedRecordsIds to Nothing since we have deleted all pending deletes. + Me.DeletedRecordIds = Nothing + + End Sub + + Public Overridable Function CreateCompoundJoinFilter() As CompoundFilter + Dim jFilter As CompoundFilter = New CompoundFilter() + + Return jFilter + + End Function + + + Public Overridable Function CreateOrderBy() As OrderBy + ' The CurrentSortOrder is initialized to the sort order on the + ' Query Wizard. It may be modified by the Click handler for any of + ' the column heading to sort or reverse sort by that column. + ' You can add your own sort order, or modify it on the Query Wizard. + Return Me.CurrentSortOrder + End Function + + Public Overridable Function CreateWhereClause() As WhereClause + 'This CreateWhereClause is used for loading the data. + PersonalEducationTable.Instance.InnerFilter = Nothing + Dim wc As WhereClause = New WhereClause() + + ' Compose the WHERE clause consiting of: + ' 1. Static clause defined at design time. + ' 2. User selected search criteria. + ' 3. User selected filter criteria. + + + Dim selectedRecordKeyValue as KeyValue = New KeyValue() + + Dim personalIdRecordObj as KeyValue + personalIdRecordObj = Nothing + + Dim personalIdTableControlObjRow As PersonalIdTableControlRow = DirectCast(MiscUtils.GetParentControlObject(Me, "PersonalIdTableControlRow") ,PersonalIdTableControlRow) + + If (Not IsNothing(personalIdTableControlObjRow) AndAlso Not IsNothing(personalIdTableControlObjRow.GetRecord()) AndAlso Not IsNothing(personalIdTableControlObjRow.GetRecord().PersonalId)) + wc.iAND(PersonalEducationTable.PersonalId, BaseFilter.ComparisonOperator.EqualsTo, personalIdTableControlObjRow.GetRecord().PersonalId.ToString()) + Else + wc.RunQuery = False + Return wc + End If + + HttpContext.Current.Session("PersonalEducationTableControlWhereClause") = selectedRecordKeyValue.ToXmlString() + + Return wc + End Function + + + Public Overridable Function CreateWhereClause(ByVal searchText as String, ByVal fromSearchControl as String, ByVal AutoTypeAheadSearch as String, ByVal AutoTypeAheadWordSeparators as String) As WhereClause + ' This CreateWhereClause is used for loading list of suggestions for Auto Type-Ahead feature. + PersonalEducationTable.Instance.InnerFilter = Nothing + Dim wc As WhereClause = New WhereClause() + + ' Compose the WHERE clause consiting of: + ' 1. Static clause defined at design time. + ' 2. User selected search criteria. + ' 3. User selected filter criteria. + + Dim appRelativeVirtualPath As String = CType(HttpContext.Current.Session("AppRelativeVirtualPath"), String) + + Dim selectedRecordInPersonalIdTableControl as String = DirectCast(HttpContext.Current.Session("PersonalEducationTableControlWhereClause"), String) + + If Not selectedRecordInPersonalIdTableControl Is Nothing AndAlso KeyValue.IsXmlKey(selectedRecordInPersonalIdTableControl) Then + Dim selectedRecordKeyValue as KeyValue = KeyValue.XmlToKey(selectedRecordInPersonalIdTableControl) + + If Not IsNothing(selectedRecordKeyValue) AndAlso selectedRecordKeyValue.ContainsColumn(PersonalEducationTable.PersonalId) Then + wc.iAND(PersonalEducationTable.PersonalId, BaseFilter.ComparisonOperator.EqualsTo, selectedRecordKeyValue.GetColumnValue(PersonalEducationTable.PersonalId).ToString()) + End If + + End If + + ' Adds clauses if values are selected in Filter controls which are configured in the page. + + + Return wc + End Function + + + Public Overridable Function FormatSuggestions(ByVal prefixText As String, ByVal resultItem As String, _ + ByVal columnLength As Integer, ByVal AutoTypeAheadDisplayFoundText As String, _ + ByVal autoTypeAheadSearch As String, ByVal AutoTypeAheadWordSeparators As String, _ + ByVal resultList As ArrayList) As Boolean + + 'Formats the resultItem and adds it to the list of suggestions. + Dim index As Integer = resultItem.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture).IndexOf(prefixText.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture)) + Dim itemToAdd As String = "" + Dim isFound As Boolean = False + Dim isAdded As Boolean = False + ' Get the index where prfixt is at the beginning of resultItem. If not found then, index of word which begins with prefixText. + If InvariantLCase(autoTypeAheadSearch).equals("wordsstartingwithsearchstring") And Not index = 0 Then + ' Expression to find word which contains AutoTypeAheadWordSeparators followed by prefixText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex( AutoTypeAheadWordSeparators + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + If regex1.IsMatch(resultItem) Then + index = regex1.Match(resultItem).Index + isFound = True + End If + ' If the prefixText is found immediatly after white space then starting of the word is found so don not search any further + If not resultItem(index).ToString() = " " Then + ' Expression to find beginning of the word which contains AutoTypeAheadWordSeparators followed by prefixText + Dim regex As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\\S*" + AutoTypeAheadWordSeparators + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + If regex.IsMatch(resultItem) Then + index = regex.Match(resultItem).Index + isFound = True + End If + End If + End If + + ' If autoTypeAheadSearch value is wordsstartingwithsearchstring then, extract the substring only if the prefixText is found at the + ' beginning of the resultItem (index = 0) or a word in resultItem is found starts with prefixText. + If index = 0 Or isFound Or InvariantLCase(autoTypeAheadSearch).Equals("anywhereinstring") then + If InvariantLCase(AutoTypeAheadDisplayFoundText).equals("atbeginningofmatchedstring") Then + ' Expression to find beginning of the word which contains prefixText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\\S*" + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + ' Find the beginning of the word which contains prefexText + If (StringUtils.InvariantLCase(autoTypeAheadSearch).Equals("anywhereinstring") AndAlso regex1.IsMatch(resultItem)) Then + index = regex1.Match(resultItem).Index + isFound = True + End If + ' Display string from the index till end of the string if sub string from index till end is less than columnLength value. + If Len(resultItem) - index <= columnLength Then + If index = 0 Then + itemToAdd = resultItem + Else + itemToAdd = "..." & resultItem.Substring(index, Len(resultItem) - index) + End If + Else + If index = 0 Then + itemToAdd = resultItem.Substring(index, (columnLength - 3)) & "..." + Else + 'Truncate the string to show only columnLength - 6 characters as begining and trailing "..." has to be appended. + itemToAdd = "..." & resultItem.Substring(index , columnLength - 6) & "..." + End If + End If + ElseIf InvariantLCase(AutoTypeAheadDisplayFoundText).equals("inmiddleofmatchedstring") Then + Dim subStringBeginIndex As Integer = CType(columnLength/2, Integer) + If Len(resultItem) <= columnLength Then + itemToAdd = resultItem + Else + ' Sanity check at end of the string + If index + Len(prefixText) = columnLength Then + itemToAdd = "..." & resultItem.Substring(index-columnLength,index) + ElseIf Len(resultItem) - index < subStringBeginIndex Then + ' Display string from the end till columnLength value if, index is closer to the end of the string. + itemToAdd = "..." & resultItem.Substring(Len(resultItem)-columnLength,Len(resultItem)) + ElseIf index <= subStringBeginIndex Then + ' Sanity chet at beginning of the string + itemToAdd = resultItem.Substring(0, columnLength) & "..." + Else + ' Display string containing text before the prefixText occures and text after the prefixText + itemToAdd = "..." & resultItem.Substring(index - subStringBeginIndex, columnLength) & "..." + End If + End If + ElseIf InvariantLCase(AutoTypeAheadDisplayFoundText).equals("atendofmatchedstring") Then + ' Expression to find ending of the word which contains prefexText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\s", System.Text.RegularExpressions.RegexOptions.IgnoreCase) + ' Find the ending of the word which contains prefexText + If regex1.IsMatch(resultItem, index + 1) Then + index = regex1.Match(resultItem, index + 1).Index + Else + ' If the word which contains prefexText is the last word in string, regex1.IsMatch returns false. + index = resultItem.Length + End If + If index > Len(resultItem) Then + index = Len(resultItem) + End If + ' If text from beginning of the string till index is less than columnLength value then, display string from the beginning till index. + If index <= columnLength Then + if index = Len(resultItem) Then 'Make decision to append "..." + itemToAdd = resultItem.Substring(0,index) + Else + itemToAdd = resultItem.Substring(0,index) & "..." + End If + Else + If index = Len(resultItem) Then + itemToAdd = "..." & resultItem.Substring(index - (columnLength - 3), (columnLength - 3)) + Else + 'Truncate the string to show only columnLength - 6 characters as begining and trailing "..." has to be appended. + itemToAdd = "..." & resultItem.Substring(index - (columnLength - 6), columnLength - 6) & "..." + End If + End If + End If + + ' Remove newline character from itemToAdd + Dim prefixTextIndex As Integer = itemToAdd.IndexOf(prefixText, StringComparison.CurrentCultureIgnoreCase) + ' If itemToAdd contains any newline after the search text then show text only till newline + Dim regex2 As System.Text.RegularExpressions.Regex = New System.Text.RegularExpressions.Regex("(" & vbCrLf & "|" & vbLf & ")", System.Text.RegularExpressions.RegexOptions.IgnoreCase) + Dim newLineIndexAfterPrefix As Integer = -1 + If regex2.IsMatch(itemToAdd, prefixTextIndex) Then + newLineIndexAfterPrefix = regex2.Match(itemToAdd, prefixTextIndex).Index + End If + If (newLineIndexAfterPrefix > -1) Then + If itemToAdd.EndsWith("...") Then + itemToAdd = (itemToAdd.Substring(0, newLineIndexAfterPrefix) + "...") + Else + itemToAdd = itemToAdd.Substring(0, newLineIndexAfterPrefix) + End If + End If + ' If itemToAdd contains any newline before search text then show text which comes after newline + Dim regex3 As System.Text.RegularExpressions.Regex = New System.Text.RegularExpressions.Regex("(" & vbCrLf & "|" & vbLf & ")", (System.Text.RegularExpressions.RegexOptions.IgnoreCase Or System.Text.RegularExpressions.RegexOptions.RightToLeft)) + Dim newLineIndexBeforePrefix As Integer = -1 + If regex3.IsMatch(itemToAdd, prefixTextIndex) Then + newLineIndexBeforePrefix = regex3.Match(itemToAdd, prefixTextIndex).Index + End If + If (newLineIndexBeforePrefix > -1) Then + If itemToAdd.StartsWith("...") Then + itemToAdd = ("..." + itemToAdd.Substring((newLineIndexBeforePrefix + regex3.Match(itemToAdd, prefixTextIndex).Length))) + Else + itemToAdd = itemToAdd.Substring((newLineIndexBeforePrefix + regex3.Match(itemToAdd, prefixTextIndex).Length)) + End If + End If + + If Not itemToAdd is nothing AndAlso Not resultList.Contains(itemToAdd) Then + + resultList.Add(itemToAdd) + + isAdded = true + End If + End If + Return isAdded + End Function + + + Protected Overridable Sub GetPageSize() + + End Sub + + Protected Overridable Sub AddNewRecords() + + Dim newRecordList As ArrayList = New ArrayList() + + Dim newUIDataList As System.Collections.Generic.List(Of Hashtable) = New System.Collections.Generic.List(Of Hashtable)() + + ' Loop though all the record controls and if the record control + ' does not have a unique record id set, then create a record + ' and add to the list. + If Not Me.ResetData Then + Dim rep As System.Web.UI.WebControls.Repeater = CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalEducationTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return + + Dim repItem As System.Web.UI.WebControls.RepeaterItem + For Each repItem In rep.Items + ' Loop through all rows in the table, set its DataSource and call DataBind(). + + Dim recControl As PersonalEducationTableControlRow = DirectCast(repItem.FindControl("PersonalEducationTableControlRow"), PersonalEducationTableControlRow) + + If recControl.Visible AndAlso recControl.IsNewRecord() Then + + Dim rec As PersonalEducationRecord = New PersonalEducationRecord() + + If recControl.COUNTRY.Text <> "" Then + rec.Parse(recControl.COUNTRY.Text, PersonalEducationTable.COUNTRY) + End If + If recControl.Course.Text <> "" Then + rec.Parse(recControl.Course.Text, PersonalEducationTable.Course) + End If + If recControl.CourseAbbr.Text <> "" Then + rec.Parse(recControl.CourseAbbr.Text, PersonalEducationTable.CourseAbbr) + End If + If recControl.EducationType.Text <> "" Then + rec.Parse(recControl.EducationType.Text, PersonalEducationTable.EducationType) + End If + If recControl.EdYear.Text <> "" Then + rec.Parse(recControl.EdYear.Text, PersonalEducationTable.EdYear) + End If + If recControl.EndDate.Text <> "" Then + rec.Parse(recControl.EndDate.Text, PersonalEducationTable.EndDate) + End If + If recControl.Facultry.Text <> "" Then + rec.Parse(recControl.Facultry.Text, PersonalEducationTable.Facultry) + End If + If recControl.Institue.Text <> "" Then + rec.Parse(recControl.Institue.Text, PersonalEducationTable.Institue) + End If + If recControl.LevelId.Text <> "" Then + rec.Parse(recControl.LevelId.Text, PersonalEducationTable.LevelId) + End If + If recControl.StartDate.Text <> "" Then + rec.Parse(recControl.StartDate.Text, PersonalEducationTable.StartDate) + End If + newUIDataList.Add(recControl.PreservedUIData()) + newRecordList.Add(rec) + End If + Next + End If + + + ' Add any new record to the list. + Dim index As Integer = 0 + For index = 1 To Me.AddNewRecord + + newRecordList.Insert(0, New PersonalEducationRecord()) + newUIDataList.Insert(0, New Hashtable()) + + Next + Me.AddNewRecord = 0 + + ' Finally, add any new records to the DataSource. + If newRecordList.Count > 0 Then + + Dim finalList As ArrayList = New ArrayList(Me.DataSource) + finalList.InsertRange(0, newRecordList) + + Me.DataSource = DirectCast(finalList.ToArray(GetType(PersonalEducationRecord)), PersonalEducationRecord()) + + End If + + ' Add the existing UI data to this hash table + If newUIDataList.Count > 0 Then + Me.UIData.InsertRange(0, newUIDataList) + End If + + End Sub + + + Public Sub AddToDeletedRecordIds(ByVal rec As PersonalEducationTableControlRow) + If rec.IsNewRecord() Then + Return + End If + + If Not Me.DeletedRecordIds Is Nothing AndAlso Me.DeletedRecordIds.Trim <> "" Then + Me.DeletedRecordIds &= "," + End If + + Me.DeletedRecordIds &= "[" & rec.RecordUniqueId & "]" + End Sub + + Protected Overridable Function InDeletedRecordIds(ByVal rec As PersonalEducationTableControlRow) As Boolean + If Me.DeletedRecordIds Is Nothing OrElse Me.DeletedRecordIds.Trim = "" Then + Return False + End If + + Return Me.DeletedRecordIds.IndexOf("[" & rec.RecordUniqueId & "]") >= 0 + End Function + + Private _DeletedRecordIds As String + Public Property DeletedRecordIds() As String + Get + Return Me._DeletedRecordIds + End Get + Set(ByVal value As String) + Me._DeletedRecordIds = value + End Set + End Property + + + ' Create Set, WhereClause, and Populate Methods + + Public Overridable Sub SetCOUNTRYLabel() + + End Sub + + Public Overridable Sub SetCourseAbbrLabel() + + End Sub + + Public Overridable Sub SetCourseLabel() + + End Sub + + Public Overridable Sub SetEducationTypeLabel() + + End Sub + + Public Overridable Sub SetEdYearLabel() + + End Sub + + Public Overridable Sub SetEndDateLabel() + + End Sub + + Public Overridable Sub SetFacultryLabel() + + End Sub + + Public Overridable Sub SetInstitueLabel() + + End Sub + + Public Overridable Sub SetLevelIdLabel1() + + End Sub + + Public Overridable Sub SetPersonalEducationTableControlCollapsibleRegion() + + End Sub + + Public Overridable Sub SetStartDateLabel() + + End Sub + + + + + Protected Overridable Sub Control_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.PreRender + ' PreRender event is raised just before page is being displayed. + Try + DbUtils.StartTransaction + Me.RegisterPostback() + + If Not Me.Page.ErrorOnPage AndAlso (Me.Page.IsPageRefresh OrElse Me.DataChanged OrElse Me.ResetData) Then + + + ' Re-load the data and update the web page if necessary. + ' This is typically done during a postback (filter, search button, sort, pagination button). + ' In each of the other click handlers, simply set DataChanged to True to reload the data. + + Me.LoadData() + Me.DataBind() + + End If + + + + Catch ex As Exception + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + Finally + DbUtils.EndTransaction + End Try + End Sub + + + Protected Overrides Sub SaveControlsToSession() + MyBase.SaveControlsToSession() + + ' Save filter controls to values to session. + + + 'Save pagination state to session. + + + + ' Save table control properties to the session. + If Not Me.CurrentSortOrder Is Nothing Then + Me.SaveToSession(Me, "Order_By", Me.CurrentSortOrder.ToXmlString()) + End If + + Me.SaveToSession(Me, "Page_Index", Me.PageIndex.ToString()) + Me.SaveToSession(Me, "Page_Size", Me.PageSize.ToString()) + + Me.SaveToSession(Me, "DeletedRecordIds", Me.DeletedRecordIds) + + End Sub + + Protected Sub SaveControlsToSession_Ajax() + ' Save filter controls to values to session. + + HttpContext.Current.Session("AppRelativeVirtualPath") = Me.Page.AppRelativeVirtualPath + + End Sub + + Protected Overrides Sub ClearControlsFromSession() + MyBase.ClearControlsFromSession() + + ' Clear filter controls values from the session. + + + ' Clear pagination state from session. + + + + ' Clear table properties from the session. + Me.RemoveFromSession(Me, "Order_By") + Me.RemoveFromSession(Me, "Page_Index") + Me.RemoveFromSession(Me, "Page_Size") + + Me.RemoveFromSession(Me, "DeletedRecordIds") + + End Sub + + Protected Overrides Sub LoadViewState(ByVal savedState As Object) + MyBase.LoadViewState(savedState) + + Dim orderByStr As String = CType(ViewState("PersonalEducationTableControl_OrderBy"), String) + + If orderByStr IsNot Nothing AndAlso orderByStr.Trim <> "" Then + Me.CurrentSortOrder = BaseClasses.Data.OrderBy.FromXmlString(orderByStr) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + End If + + Dim pageIndex As String = CType(ViewState("Page_Index"), String) + If pageIndex IsNot Nothing Then + Me.PageIndex = CInt(pageIndex) + End If + + Dim pageSize As String = CType(ViewState("Page_Size"), String) + If Not pageSize Is Nothing Then + Me.PageSize = CInt(pageSize) + End If + + + + ' Load view state for pagination control. + + Me.DeletedRecordIds = CType(Me.ViewState("DeletedRecordIds"), String) + + End Sub + + Protected Overrides Function SaveViewState() As Object + + If Me.CurrentSortOrder IsNot Nothing Then + Me.ViewState("PersonalEducationTableControl_OrderBy") = Me.CurrentSortOrder.ToXmlString() + End If + + Me.ViewState("Page_Index") = Me.PageIndex + Me.ViewState("Page_Size") = Me.PageSize + + Me.ViewState("DeletedRecordIds") = Me.DeletedRecordIds + + + ' Load view state for pagination control. + + + Return MyBase.SaveViewState() + End Function + + ' Generate the event handling functions for pagination events. + + + ' Generate the event handling functions for sorting events. + + + ' Generate the event handling functions for button events. + + + + ' Generate the event handling functions for filter and search events. + + + ' Generate the event handling functions for others + + + Private _UIData As New System.Collections.Generic.List(Of Hashtable) + Public Property UIData() As System.Collections.Generic.List(Of Hashtable) + Get + Return Me._UIData + End Get + Set(ByVal value As System.Collections.Generic.List(Of Hashtable)) + Me._UIData = value + End Set + End Property + + ' pagination properties + Protected _PageSize As Integer + Public Property PageSize() As Integer + Get + Return Me._PageSize + End Get + Set(ByVal value As Integer) + Me._PageSize = value + End Set + End Property + + Protected _PageIndex As Integer + Public Property PageIndex() As Integer + Get + ' Return the PageIndex + Return Me._PageIndex + End Get + Set(ByVal value As Integer) + Me._PageIndex = value + End Set + End Property + + Protected _TotalRecords As Integer = -1 + Public Property TotalRecords() As Integer + Get + If _TotalRecords < 0 + _TotalRecords = PersonalEducationTable.GetRecordCount(CreateCompoundJoinFilter(), CreateWhereClause()) + End If + Return Me._TotalRecords + End Get + Set(ByVal value As Integer) + If Me.PageSize > 0 Then + + Me.TotalPages = CInt(Math.Ceiling(value / Me.PageSize)) + + End If + Me._TotalRecords = value + End Set + End Property + + + + Protected _TotalPages As Integer = -1 + Public Property TotalPages() As Integer + Get + If _TotalPages < 0 Then + + Me.TotalPages = CInt(Math.Ceiling(TotalRecords / Me.PageSize)) + + End If + Return Me._TotalPages + End Get + Set(ByVal value As Integer) + Me._TotalPages = value + End Set + End Property + + Protected _DisplayLastPage As Boolean + Public Property DisplayLastPage() As Boolean + Get + Return Me._DisplayLastPage + End Get + Set(ByVal value As Boolean) + Me._DisplayLastPage = value + End Set + End Property + + Private _DataChanged As Boolean = False + Public Property DataChanged() As Boolean + Get + Return Me._DataChanged + End Get + Set(ByVal value As Boolean) + Me._DataChanged = value + End Set + End Property + + Private _ResetData As Boolean = False + Public Property ResetData() As Boolean + Get + Return Me._ResetData + End Get + Set(ByVal value As Boolean) + Me._ResetData = value + End Set + End Property + + Private _AddNewRecord As Integer = 0 + Public Property AddNewRecord() As Integer + Get + Return Me._AddNewRecord + End Get + Set(ByVal value As Integer) + Me._AddNewRecord = value + End Set + End Property + + + Private _CurrentSortOrder As OrderBy = Nothing + Public Property CurrentSortOrder() As OrderBy + Get + Return Me._CurrentSortOrder + End Get + Set(ByVal value As BaseClasses.Data.OrderBy) + Me._CurrentSortOrder = value + End Set + End Property + + Private _DataSource() As PersonalEducationRecord = Nothing + Public Property DataSource() As PersonalEducationRecord () + Get + Return Me._DataSource + End Get + Set(ByVal value() As PersonalEducationRecord) + Me._DataSource = value + End Set + End Property + +#Region "Helper Properties" + + Public ReadOnly Property COUNTRYLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "COUNTRYLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property CourseAbbrLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "CourseAbbrLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property CourseLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "CourseLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property EducationTypeLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "EducationTypeLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property EdYearLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "EdYearLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property EndDateLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "EndDateLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property FacultryLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "FacultryLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property InstitueLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "InstitueLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property LevelIdLabel1() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "LevelIdLabel1"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property PersonalEducationTableControlCollapsibleRegion() As System.Web.UI.WebControls.Panel + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalEducationTableControlCollapsibleRegion"), System.Web.UI.WebControls.Panel) + End Get + End Property + + Public ReadOnly Property StartDateLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "StartDateLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + +#End Region + +#Region "Helper Functions" + + Public Overrides Overloads Function ModifyRedirectUrl(url As String, arg As String, ByVal bEncrypt As Boolean) As String + Return Me.Page.EvaluateExpressions(url, arg, bEncrypt, Me) + End Function + + Public Overrides Overloads Function EvaluateExpressions(url As String, arg As String, ByVal bEncrypt As Boolean) As String + Dim needToProcess As Boolean = AreAnyUrlParametersForMe(url, arg) + If (needToProcess) Then + Dim recCtl As PersonalEducationTableControlRow = Me.GetSelectedRecordControl() + If recCtl Is Nothing AndAlso url.IndexOf("{") >= 0 Then + ' Localization. + Throw New Exception(Page.GetResourceValue("Err:NoRecSelected", "Persons")) + End If + Dim rec As PersonalEducationRecord = Nothing + If recCtl IsNot Nothing Then + rec = recCtl.GetRecord() + End If + Return EvaluateExpressions(url, arg, rec, bEncrypt) + End If + Return url + End Function + + Public Overridable Function GetSelectedRecordControl() As PersonalEducationTableControlRow + Return Nothing + + End Function + + Public Overridable Function GetSelectedRecordControls() As PersonalEducationTableControlRow() + + Return DirectCast((new ArrayList()).ToArray(GetType(PersonalEducationTableControlRow)), PersonalEducationTableControlRow()) + + End Function + + Public Overridable Sub DeleteSelectedRecords(ByVal deferDeletion As Boolean) + Dim recList() As PersonalEducationTableControlRow = Me.GetSelectedRecordControls() + If recList.Length = 0 Then + ' Localization. + Throw New Exception(Page.GetResourceValue("Err:NoRecSelected", "Persons")) + End If + + Dim recCtl As PersonalEducationTableControlRow + For Each recCtl In recList + If deferDeletion Then + If Not recCtl.IsNewRecord Then + + Me.AddToDeletedRecordIds(recCtl) + + End If + recCtl.Visible = False + + Else + + recCtl.Delete() + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + End If + Next + End Sub + + Public Function GetRecordControls() As PersonalEducationTableControlRow() + Dim recList As ArrayList = New ArrayList() + Dim rep As System.Web.UI.WebControls.Repeater = CType(Me.FindControl("PersonalEducationTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return Nothing + Dim repItem As System.Web.UI.WebControls.RepeaterItem + + For Each repItem In rep.Items + + Dim recControl As PersonalEducationTableControlRow = DirectCast(repItem.FindControl("PersonalEducationTableControlRow"), PersonalEducationTableControlRow) + recList.Add(recControl) + + Next + + Return DirectCast(recList.ToArray(GetType(PersonalEducationTableControlRow)), PersonalEducationTableControlRow()) + End Function + + Public Shadows ReadOnly Property Page() As BaseApplicationPage + Get + Return DirectCast(MyBase.Page, BaseApplicationPage) + End Get + End Property + +#End Region + + + +End Class + + +' Base class for the PersonalIdTableControlRow control on the ShowPersonalEducationTable1 page. +' Do not modify this class. Instead override any method in PersonalIdTableControlRow. +Public Class BasePersonalIdTableControlRow + Inherits Persons.UI.BaseApplicationRecordControl + + ' To customize, override this method in PersonalIdTableControlRow. + Protected Overridable Sub Control_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Init + + Me.ClearControlsFromSession() + End Sub + + ' To customize, override this method in PersonalIdTableControlRow. + Protected Overridable Sub Control_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load + + 'Call LoadFocusScripts from repeater so that onfocus attribute could be added to elements + Me.Page.LoadFocusScripts(Me) + + + ' Register the event handlers. + + + End Sub + + + Public Overridable Sub LoadData() + + ' Load the data from the database into the DataSource PersonalId record. + ' It is better to make changes to functions called by LoadData such as + ' CreateWhereClause, rather than making changes here. + + ' 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 = PersonalIdTable.GetRecord(Me.RecordUniqueId, True) + + Return + End If + + ' Since this is a row in the table, the data for this row is loaded by the + ' LoadData method of the BasePersonalIdTableControl when the data for the entire + ' table is loaded. + + Me.DataSource = New PersonalIdRecord() + + + + End Sub + + ' Populate the UI controls using the DataSource. To customize, override this method in PersonalIdTableControlRow. + Public Overrides Sub DataBind() + ' The DataBind method binds the user interface controls to the values + ' from the database record. To do this, it calls the Set methods for + ' each of the field displayed on the webpage. It is better to make + ' changes in the Set methods, rather than making changes here. + + MyBase.DataBind() + + ' Make sure that the DataSource is initialized. + If Me.DataSource Is Nothing Then + + Return + End If + + + 'LoadData for DataSource for chart and report if they exist + + + + ' Call the Set methods for each controls on the panel + + + SetPersonalId() + + + 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 + + Dim recPersonalEducationTableControl as PersonalEducationTableControl = DirectCast(MiscUtils.FindControlRecursively(Me, "PersonalEducationTableControl"), PersonalEducationTableControl) + + recPersonalEducationTableControl.LoadData() + recPersonalEducationTableControl.DataBind() + + End Sub + + + Public Overridable Sub SetPersonalId() + + + ' Set the PersonalId Literal on the webpage with value from the + ' PersonalId database record. + + ' Me.DataSource is the PersonalId record retrieved from the database. + ' Me.PersonalId is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetPersonalId() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.PersonalIdSpecified Then + + ' If the PersonalId is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalIdTable.PersonalId) + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.PersonalId.Text = formattedValue + + Else + + ' PersonalId is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.PersonalId.Text = PersonalIdTable.PersonalId.Format(PersonalIdTable.PersonalId.DefaultValue) + + End If + + ' If the PersonalId is NULL or blank, then use the value specified + ' on Properties. + If Me.PersonalId.Text Is Nothing _ + OrElse Me.PersonalId.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.PersonalId.Text = " " + End If + + End Sub + + + Public EvaluateFormulaDelegate As BaseClasses.Data.DataSource.EvaluateFormulaDelegate = New BaseClasses.Data.DataSource.EvaluateFormulaDelegate(AddressOf Me.EvaluateFormula) + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean, ByVal e As FormulaEvaluator) As String + If e Is Nothing Then + e = New FormulaEvaluator() + End If + + e.Variables.Clear() + + + ' add variables for formula evaluation + If variables IsNot Nothing Then + Dim enumerator As System.Collections.Generic.IEnumerator(Of System.Collections.Generic.KeyValuePair(Of String, Object)) = variables.GetEnumerator() + While enumerator.MoveNext() + e.Variables.Add(enumerator.Current.Key, enumerator.Current.Value) + End While + End If + + If includeDS + + End IF + + + ' Other variables referred to in the formula are expected to be + ' properties of the DataSource. For example, referring to + ' UnitPrice as a variable will refer to DataSource.UnitPrice + If dataSourceForEvaluate Is Nothing Then + + e.DataSource = Me.DataSource + + Else + e.DataSource = dataSourceForEvaluate + End If + + ' Define the calling control. This is used to add other + ' related table and record controls as variables. + e.CallingControl = Me + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + + If Not String.IsNullOrEmpty(format) AndAlso (String.IsNullOrEmpty(formula) OrElse formula.IndexOf("Format(") < 0) Then + Return FormulaUtils.Format(resultObj, format) + Else + Return resultObj.ToString() + End If + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format,variables ,includeDS, Nothing) + End Function + + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object)) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format, variables ,True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, format, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal e as FormulaEvaluator) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, variables, True, e) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal includeDS as Boolean) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, includeDS, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, True, Nothing) + End Function + + + Public Overridable Sub RegisterPostback() + + + End Sub + + + + ' To customize, override this method in PersonalIdTableControlRow. + Public Overridable Sub SaveData() + ' Saves the associated record in the database. + ' SaveData calls Validate and Get methods - so it may be more appropriate to + ' customize those methods. + + ' 1. Load the existing record from the database. Since we save the entire record, this ensures + ' that fields that are not displayed are also properly initialized. + Me.LoadData() + + + ' 2. Perform any custom validation. + Me.Validate() + + + ' 3. Set the values in the record with data from UI controls. + ' This calls the Get() method for each of the user interface controls. + Me.GetUIData() + + ' 4. Save in the database. + ' We should not save the record if the data did not change. This + ' will save a database hit and avoid triggering any database triggers. + + If Me.DataSource.IsAnyValueChanged Then + ' Save record to database but do not commit yet. + ' Auto generated ids are available after saving for use by child (dependent) records. + Me.DataSource.Save() + + DirectCast(GetParentControlObject(Me, "PersonalIdTableControl"), PersonalIdTableControl).DataChanged = True + DirectCast(GetParentControlObject(Me, "PersonalIdTableControl"), PersonalIdTableControl).ResetData = True + End If + + + ' update session or cookie by formula + + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + ' For Master-Detail relationships, save data on the Detail table(s) + + Dim recPersonalEducationTableControl as PersonalEducationTableControl = DirectCast(MiscUtils.FindControlRecursively(Me, "PersonalEducationTableControl"), PersonalEducationTableControl) + recPersonalEducationTableControl.SaveData() + + End Sub + + ' To customize, override this method in PersonalIdTableControlRow. + Public Overridable Sub GetUIData() + ' The GetUIData method retrieves the updated values from the user interface + ' controls into a database record in preparation for saving or updating. + ' To do this, it calls the Get methods for each of the field displayed on + ' the webpage. It is better to make changes in the Get methods, rather + ' than making changes here. + + ' Call the Get methods for each of the user interface controls. + + GetPersonalId() + End Sub + + + Public Overridable Sub GetPersonalId() + + End Sub + + + ' To customize, override this method in PersonalIdTableControlRow. + + Public Overridable Function CreateWhereClause() As WhereClause + + Return Nothing + + End Function + + + + ' To customize, override this method in PersonalIdTableControlRow. + Public Overridable Sub Validate() + ' Add custom validation for any control within this panel. + ' Example. If you have a State ASP:Textbox control + ' If Me.State.Text <> "CA" Then + ' Throw New Exception("State must be CA (California).") + ' End If + + ' The Validate method is common across all controls within + ' this panel so you can validate multiple fields, but report + ' one error message. + + + End Sub + + Public Overridable Sub Delete() + + If Me.IsNewRecord() Then + Return + End If + + Dim pkValue As KeyValue = KeyValue.XmlToKey(Me.RecordUniqueId) + PersonalIdTable.DeleteRecord(pkValue) + + DirectCast(GetParentControlObject(Me, "PersonalIdTableControl"), PersonalIdTableControl).DataChanged = True + DirectCast(GetParentControlObject(Me, "PersonalIdTableControl"), PersonalIdTableControl).ResetData = True + End Sub + + Protected Overridable Sub Control_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.PreRender + ' PreRender event is raised just before page is being displayed. + Try + DbUtils.StartTransaction() + Me.RegisterPostback() + + If Not Me.Page.ErrorOnPage AndAlso (Me.Page.IsPageRefresh OrElse Me.DataChanged OrElse Me.ResetData) Then + + + ' Re-load the data and update the web page if necessary. + ' This is typically done during a postback (filter, search button, sort, pagination button). + ' In each of the other click handlers, simply set DataChanged to True to reload the data. + Me.LoadData() + Me.DataBind() + End If + + + Catch ex As Exception + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + Finally + DbUtils.EndTransaction() + End Try + End Sub + + + Protected Overrides Sub SaveControlsToSession() + MyBase.SaveControlsToSession() + + + 'Save pagination state to session. + + End Sub + + + + Protected Overrides Sub ClearControlsFromSession() + MyBase.ClearControlsFromSession() + + + + ' Clear pagination state from session. + + End Sub + + Protected Overrides Sub LoadViewState(ByVal savedState As Object) + MyBase.LoadViewState(savedState) + Dim isNewRecord As String = CType(ViewState("IsNewRecord"), String) + If Not isNewRecord Is Nothing AndAlso isNewRecord.Trim <> "" Then + Me.IsNewRecord = Boolean.Parse(isNewRecord) + End If + + Dim myCheckSum As String = CType(ViewState("CheckSum"), String) + If Not myCheckSum Is Nothing AndAlso myCheckSum.Trim <> "" Then + Me.CheckSum = myCheckSum + End If + + + ' Load view state for pagination control. + + End Sub + + Protected Overrides Function SaveViewState() As Object + ViewState("IsNewRecord") = Me.IsNewRecord.ToString() + ViewState("CheckSum") = Me.CheckSum + + + ' Load view state for pagination control. + + Return MyBase.SaveViewState() + End Function + + + + 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("BasePersonalIdTableControlRow_Rec"), String) + End Get + Set(ByVal value As String) + Me.ViewState("BasePersonalIdTableControlRow_Rec") = value + End Set + End Property + + Private _DataSource As PersonalIdRecord + Public Property DataSource() As PersonalIdRecord + Get + Return Me._DataSource + End Get + + Set(ByVal value As PersonalIdRecord) + + Me._DataSource = value + End Set + End Property + + + + Private _checkSum As String + Public Overridable Property CheckSum() As String + Get + Return Me._checkSum + End Get + Set(ByVal value As String) + Me._checkSum = value + End Set + End Property + + Private _TotalPages As Integer + Public Property TotalPages() As Integer + Get + Return Me._TotalPages + End Get + Set(ByVal value As Integer) + Me._TotalPages = value + End Set + End Property + + Private _PageIndex As Integer + Public Property PageIndex() As Integer + Get + ' Return the PageIndex + Return Me._PageIndex + End Get + Set(ByVal value As Integer) + Me._PageIndex = value + End Set + End Property + + Private _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 PersonalEducationTableControl() As PersonalEducationTableControl + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalEducationTableControl"), PersonalEducationTableControl) + End Get + End Property + + Public ReadOnly Property PersonalId() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalId"), System.Web.UI.WebControls.Literal) + End Get + End Property + +#End Region + +#Region "Helper Functions" + + Public Overrides Overloads Function ModifyRedirectUrl(ByVal url As String, ByVal arg As String, ByVal bEncrypt As Boolean) As String + Return Me.Page.EvaluateExpressions(url, arg, bEncrypt, Me) + End Function + + Public Overrides Overloads Function EvaluateExpressions(ByVal url As String, ByVal arg As String, ByVal bEncrypt As Boolean) As String + + Dim rec As PersonalIdRecord = Nothing + + + Try + rec = Me.GetRecord() + Catch ex As Exception + ' Do nothing + End Try + + If rec Is Nothing AndAlso url.IndexOf("{") >= 0 Then + ' Localization. + + Throw New Exception(Page.GetResourceValue("Err:RecDataSrcNotInitialized", "Persons")) + + End If + Return EvaluateExpressions(url, arg, rec, bEncrypt) + End Function + + + Public Overridable Function GetRecord() As PersonalIdRecord + If Not Me.DataSource Is Nothing Then + Return Me.DataSource + End If + + If Not Me.RecordUniqueId Is Nothing Then + + Return PersonalIdTable.GetRecord(Me.RecordUniqueId, True) + + End If + + ' Localization. + + Throw New Exception(Page.GetResourceValue("Err:RetrieveRec", "Persons")) + + End Function + + Public Shadows ReadOnly Property Page() As BaseApplicationPage + Get + Return DirectCast(MyBase.Page, BaseApplicationPage) + End Get + End Property + +#End Region + +End Class + + + +' Base class for the PersonalIdTableControl control on the ShowPersonalEducationTable1 page. +' Do not modify this class. Instead override any method in PersonalIdTableControl. +Public Class BasePersonalIdTableControl + Inherits Persons.UI.BaseApplicationTableControl + + + + Protected Overridable Sub Control_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Init + + + + ' Setup the filter and search events. + + If Not Me.Page.IsPostBack Then + Dim initialVal As String = "" + If Me.InSession(Me.PersonalIdSearch1) + initialVal = Me.GetFromSession(Me.PersonalIdSearch1) + + End If + + If initialVal <> "" + + Me.PersonalIdSearch1.Text = initialVal + + End If + + End If + + + ' Control Initializations. + ' Initialize the table's current sort order. + + If Me.InSession(Me, "Order_By") Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + End If + + + + ' Setup default pagination settings. + + Me.PageSize = CInt(Me.GetFromSession(Me, "Page_Size", "10")) + Me.PageIndex = CInt(Me.GetFromSession(Me, "Page_Index", "0")) + + + + Me.ClearControlsFromSession() + End Sub + + Protected Overridable Sub Control_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load + + SaveControlsToSession_Ajax() + + ' Setup the pagination events. + + AddHandler Me.PersonalIdPagination.FirstPage.Click, AddressOf PersonalIdPagination_FirstPage_Click + + AddHandler Me.PersonalIdPagination.LastPage.Click, AddressOf PersonalIdPagination_LastPage_Click + + AddHandler Me.PersonalIdPagination.NextPage.Click, AddressOf PersonalIdPagination_NextPage_Click + + AddHandler Me.PersonalIdPagination.PageSizeButton.Click, AddressOf PersonalIdPagination_PageSizeButton_Click + + AddHandler Me.PersonalIdPagination.PreviousPage.Click, AddressOf PersonalIdPagination_PreviousPage_Click + + + ' Setup the sorting events. + + ' Setup the button events. + + AddHandler Me.PersonalIdSearchButton1.Button.Click, AddressOf PersonalIdSearchButton1_Click + + + ' Setup events for others + + End Sub + + + Public Overridable Sub LoadData() + + ' Read data from database. Returns an array of records that can be assigned + ' to the DataSource table control property. + Try + Dim joinFilter As CompoundFilter = CreateCompoundJoinFilter() + + ' The WHERE clause will be empty when displaying all records in table. + Dim wc As WhereClause = CreateWhereClause() + If wc IsNot Nothing AndAlso Not wc.RunQuery Then + ' Initialize an empty array of records + Dim alist As New ArrayList(0) + Me.DataSource = DirectCast(alist.ToArray(GetType(PersonalIdRecord)), PersonalIdRecord()) + ' Add records to the list if needed. + Me.AddNewRecords() + Me._TotalRecords = 0 + Me._TotalPages = 0 + Return + End If + + ' Call OrderBy to determine the order - either use the order defined + ' on the Query Wizard, or specified by user (by clicking on column heading) + Dim orderBy As OrderBy = CreateOrderBy() + + ' Get the pagesize from the pagesize control. + Me.GetPageSize() + + If Me.DisplayLastPage Then + Dim totalRecords As Integer = If(Me._TotalRecords < 0, PersonalIdTable.GetRecordCount(CreateCompoundJoinFilter(), CreateWhereClause()), Me._TotalRecords) + + Dim totalPages As Integer = CInt(Math.Ceiling(totalRecords / Me.PageSize)) + + Me.PageIndex = totalPages - 1 + End If + + ' Make sure PageIndex (current page) and PageSize are within bounds. + If Me.PageIndex < 0 Then + Me.PageIndex = 0 + End If + If Me.PageSize < 1 Then + Me.PageSize = 1 + End If + + ' Retrieve the records and set the table DataSource. + ' Only PageSize records are fetched starting at PageIndex (zero based). + If Me.AddNewRecord > 0 Then + ' Make sure to preserve the previously entered data on new rows. + Dim postdata As New ArrayList + For Each rc As PersonalIdTableControlRow In Me.GetRecordControls() + If Not rc.IsNewRecord Then + rc.DataSource = rc.GetRecord() + rc.GetUIData() + postdata.Add(rc.DataSource) + UIData.Add(rc.PreservedUIData()) + End If + Next + Me.DataSource = DirectCast(postdata.ToArray(GetType(PersonalIdRecord)), PersonalIdRecord()) + Else ' Get the records from the database + Me.DataSource = PersonalIdTable.GetRecords(joinFilter, wc, orderBy, Me.PageIndex, Me.PageSize) + + End If + + ' if the datasource contains no records contained in database, then load the last page. + If (DbUtils.GetCreatedRecords(Me.DataSource).Length = 0 AndAlso Not Me.DisplayLastPage) Then + Me.DisplayLastPage = True + LoadData() + Else + + ' Add any new rows desired by the user. + Me.AddNewRecords() + + + ' Initialize the page and grand totals. now + + End If + + Catch ex As Exception + ' Report the error message to the end user + Dim msg As String = ex.Message + If ex.InnerException IsNot Nothing Then + msg = msg & " InnerException: " & ex.InnerException.Message + End If + Throw New Exception(msg, ex.InnerException) + End Try + End Sub + + + + + Public Overrides Sub DataBind() + ' The DataBind method binds the user interface controls to the values + ' from the database record for each row in the table. To do this, it calls the + ' DataBind for each of the rows. + ' DataBind also populates any filters above the table, and sets the pagination + ' control to the correct number of records and the current page number. + + MyBase.DataBind() + + ' Make sure that the DataSource is initialized. + If Me.DataSource Is Nothing Then + Return + End If + + 'LoadData for DataSource for chart and report if they exist + + ' Setup the pagination controls. + BindPaginationControls() + + + + ' Bind the repeater with the list of records to expand the UI. + Dim rep As System.Web.UI.WebControls.Repeater = CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalIdTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return + rep.DataSource = DataSource() + rep.DataBind() + + Dim index As Integer = 0 + For Each repItem As System.Web.UI.WebControls.RepeaterItem In rep.Items + ' Loop through all rows in the table, set its DataSource and call DataBind(). + Dim recControl As PersonalIdTableControlRow = DirectCast(repItem.FindControl("PersonalIdTableControlRow"), PersonalIdTableControlRow) + recControl.DataSource = Me.DataSource(index) + If Me.UIData.Count > index Then + recControl.PreviousUIData = Me.UIData(index) + End If + recControl.DataBind() + recControl.Visible = Not Me.InDeletedRecordIds(recControl) + + index += 1 + Next + + + + + ' Call the Set methods for each controls on the panel + + SetPersonalIdLabel() + + SetPersonalIdSearch1() + + SetPersonalIdTableControlCollapsibleRegion() + SetPersonalIdTableControlIcon() + SetPersonalIdTableControlPanelExtender() + + ' setting the state of expand or collapse alternative rows + + + ' Load data for each record and table UI control. + ' Ordering is important because child controls get + ' their parent ids from their parent UI controls. + + + ' this method calls the set method for controls with special formula like running total, sum, rank, etc + SetFormulaControls() + End Sub + + Public Overridable Sub SetFormulaControls() + ' this method calls Set methods for the control that has special formula + + + + End Sub + + + + Public Overridable Sub RegisterPostback() + + + End Sub + + Public EvaluateFormulaDelegate As BaseClasses.Data.DataSource.EvaluateFormulaDelegate = New BaseClasses.Data.DataSource.EvaluateFormulaDelegate(AddressOf Me.EvaluateFormula) + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean, ByVal e as FormulaEvaluator) As String + If e Is Nothing + e = New FormulaEvaluator() + End If + + e.Variables.Clear() + + + ' add variables for formula evaluation + If variables IsNot Nothing Then + Dim enumerator As System.Collections.Generic.IEnumerator(Of System.Collections.Generic.KeyValuePair(Of String, Object)) = variables.GetEnumerator() + While enumerator.MoveNext() + e.Variables.Add(enumerator.Current.Key, enumerator.Current.Value) + End While + End If + + If includeDS + + End If + + ' All variables referred to in the formula are expected to be + ' properties of the DataSource. For example, referring to + ' UnitPrice as a variable will refer to DataSource.UnitPrice + e.DataSource = dataSourceForEvaluate + + ' Define the calling control. This is used to add other + ' related table and record controls as variables. + e.CallingControl = Me + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + + If Not String.IsNullOrEmpty(format) AndAlso (String.IsNullOrEmpty(formula) OrElse formula.IndexOf("Format(") < 0) Then + Return FormulaUtils.Format(resultObj, format) + Else + Return resultObj.ToString() + End If + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format,variables ,includeDS, Nothing) + End Function + + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object)) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format, variables ,True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, format, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal e as FormulaEvaluator) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, variables, True, e) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal includeDS as Boolean) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, includeDS, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, True, Nothing) + End Function + + + + + Public Overridable Sub ResetControl() + + Me.PersonalIdSearch1.Text = "" + + Me.CurrentSortOrder.Reset() + If (Me.InSession(Me, "Order_By")) Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + End If + + Me.PageIndex = 0 + End Sub + + Protected Overridable Sub BindPaginationControls() + ' Setup the pagination controls. + + ' Bind the pagination labels. + + If DbUtils.GetCreatedRecords(Me.DataSource).Length > 0 Then + + Me.PersonalIdPagination.CurrentPage.Text = (Me.PageIndex + 1).ToString() + Else + Me.PersonalIdPagination.CurrentPage.Text = "0" + End If + Me.PersonalIdPagination.PageSize.Text = Me.PageSize.ToString() + Me.PersonalIdPagination.TotalItems.Text = Me.TotalRecords.ToString() + Me.PersonalIdPagination.TotalPages.Text = Me.TotalPages.ToString() + + ' Bind the buttons for PersonalIdTableControl pagination. + + Me.PersonalIdPagination.FirstPage.Enabled = Not (Me.PageIndex = 0) + If Me._TotalPages < 0 Then ' if the total pages is not determined yet, enable last and next buttons + Me.PersonalIdPagination.LastPage.Enabled = True + ElseIf Me._TotalPages = 0 ' if the total pages is determined and it is 0, enable last and next buttons + Me.PersonalIdPagination.LastPage.Enabled = False + Else ' if the total pages is the last page, disable last and next buttons + Me.PersonalIdPagination.LastPage.Enabled = Not (Me.PageIndex = Me.TotalPages - 1) + End If + + If Me._TotalPages < 0 Then ' if the total pages is not determined yet, enable last and next buttons + Me.PersonalIdPagination.NextPage.Enabled = True + ElseIf Me._TotalPages = 0 ' if the total pages is determined and it is 0, enable last and next buttons + Me.PersonalIdPagination.NextPage.Enabled = False + Else ' if the total pages is the last page, disable last and next buttons + Me.PersonalIdPagination.NextPage.Enabled = Not (Me.PageIndex = Me.TotalPages - 1) + End If + + Me.PersonalIdPagination.PreviousPage.Enabled = Not (Me.PageIndex = 0) + + + End Sub + + Public Overridable Sub SaveData() + ' Save the data from the entire table. Calls each row's Save Data + ' to save their data. This function is called by the Click handler of the + ' Save button. The button handler should Start/Commit/End a transaction. + + Dim recCtl As PersonalIdTableControlRow + For Each recCtl In Me.GetRecordControls() + + If Me.InDeletedRecordIds(recCtl) Then + ' Delete any pending deletes. + recCtl.Delete() + Else + If recCtl.Visible Then + recCtl.SaveData() + End If + End If + + Next + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + ' Set IsNewRecord to False for all records - since everything has been saved and is no longer "new" + For Each recCtl In Me.GetRecordControls() + recCtl.IsNewRecord = False + Next + + + ' Set DeletedRecordsIds to Nothing since we have deleted all pending deletes. + Me.DeletedRecordIds = Nothing + + End Sub + + Public Overridable Function CreateCompoundJoinFilter() As CompoundFilter + Dim jFilter As CompoundFilter = New CompoundFilter() + + Return jFilter + + End Function + + + Public Overridable Function CreateOrderBy() As OrderBy + ' The CurrentSortOrder is initialized to the sort order on the + ' Query Wizard. It may be modified by the Click handler for any of + ' the column heading to sort or reverse sort by that column. + ' You can add your own sort order, or modify it on the Query Wizard. + Return Me.CurrentSortOrder + End Function + + Public Overridable Function CreateWhereClause() As WhereClause + 'This CreateWhereClause is used for loading the data. + PersonalIdTable.Instance.InnerFilter = Nothing + Dim wc As WhereClause = New WhereClause() + + ' Compose the WHERE clause consiting of: + ' 1. Static clause defined at design time. + ' 2. User selected search criteria. + ' 3. User selected filter criteria. + + + ' Get the static clause defined at design time on the Table Panel Wizard + Dim qc As WhereClause = Me.CreateQueryClause() + If Not(IsNothing(qc)) Then + wc.iAND(qc) + End If + + If IsValueSelected(Me.PersonalIdSearch1) Then + If Me.PersonalIdSearch1.Text = BaseClasses.Resources.AppResources.GetResourceValue("Txt:SearchForEllipsis", Nothing) Then + Me.PersonalIdSearch1.Text = "" + Else + ' Strip "..." from begin and ending of the search text, otherwise the search will return 0 values as in database "..." is not stored. + + If Me.PersonalIdSearch1.Text.StartsWith("...") Then + Me.PersonalIdSearch1.Text = Me.PersonalIdSearch1.Text.SubString(3,Me.PersonalIdSearch1.Text.Length-3) + End If + If Me.PersonalIdSearch1.Text.EndsWith("...") then + Me.PersonalIdSearch1.Text = Me.PersonalIdSearch1.Text.SubString(0,Me.PersonalIdSearch1.Text.Length-3) + ' Strip the last word as well as it is likely only a partial word + Dim endindex As Integer = PersonalIdSearch1.Text.Length - 1 + While (Not Char.IsWhiteSpace(PersonalIdSearch1.Text(endindex)) AndAlso endindex > 0) + endindex -= 1 + End While + If endindex > 0 Then + PersonalIdSearch1.Text = PersonalIdSearch1.Text.Substring(0, endindex) + End If + End If + End If + + Dim formatedSearchText As String = MiscUtils.GetSelectedValue(Me.PersonalIdSearch1, Me.GetFromSession(Me.PersonalIdSearch1)) + + ' After stripping "..." see if the search text is null or empty. + If IsValueSelected(Me.PersonalIdSearch1) Then + ' These clauses are added depending on operator and fields selected in Control's property page, bindings tab. + + Dim search As WhereClause = New WhereClause() + + search.iOR(PersonalIdTable.PersonalName, BaseFilter.ComparisonOperator.Contains, MiscUtils.GetSelectedValue(Me.PersonalIdSearch1, Me.GetFromSession(Me.PersonalIdSearch1)), True, False) + + search.iOR(PersonalIdTable.PersonalLastName, BaseFilter.ComparisonOperator.Contains, MiscUtils.GetSelectedValue(Me.PersonalIdSearch1, Me.GetFromSession(Me.PersonalIdSearch1)), True, False) + + wc.iAND(search) + + End If + End If + + Return wc + End Function + + + Public Overridable Function CreateWhereClause(ByVal searchText as String, ByVal fromSearchControl as String, ByVal AutoTypeAheadSearch as String, ByVal AutoTypeAheadWordSeparators as String) As WhereClause + ' This CreateWhereClause is used for loading list of suggestions for Auto Type-Ahead feature. + PersonalIdTable.Instance.InnerFilter = Nothing + Dim wc As WhereClause = New WhereClause() + + ' Compose the WHERE clause consiting of: + ' 1. Static clause defined at design time. + ' 2. User selected search criteria. + ' 3. User selected filter criteria. + + Dim appRelativeVirtualPath As String = CType(HttpContext.Current.Session("AppRelativeVirtualPath"), String) + + ' Get the static clause defined at design time on the Table Panel Wizard + Dim qc As WhereClause = Me.CreateQueryClause() + If Not(IsNothing(qc)) Then + wc.iAND(qc) + End If + + ' Adds clauses if values are selected in Filter controls which are configured in the page. + + If IsValueSelected(searchText) and fromSearchControl = "PersonalIdSearch1" Then + Dim formatedSearchText as String = searchText + ' Strip "..." from begin and ending of the search text, otherwise the search will return 0 values as in database "..." is not stored. + If searchText.StartsWith("...") Then + formatedSearchText = searchText.SubString(3,searchText.Length-3) + End If + If searchText.EndsWith("...") Then + formatedSearchText = searchText.SubString(0,searchText.Length-3) + ' Strip the last word as well as it is likely only a partial word + Dim endindex As Integer = searchText.Length - 1 + While (Not Char.IsWhiteSpace(searchText(endindex)) AndAlso endindex > 0) + endindex -= 1 + End While + If endindex > 0 Then + searchText = searchText.Substring(0, endindex) + End If + End If + 'After stripping "...", trim any leading and trailing whitespaces + formatedSearchText = formatedSearchText.Trim() + ' After stripping "..." see if the search text is null or empty. + If IsValueSelected(formatedSearchText) Then + ' These clauses are added depending on operator and fields selected in Control's property page, bindings tab. + + Dim search As WhereClause = New WhereClause() + + If InvariantLCase(AutoTypeAheadSearch).equals("wordsstartingwithsearchstring") Then + + search.iOR(PersonalIdTable.PersonalName, BaseFilter.ComparisonOperator.Starts_With, formatedSearchText, True, False) + search.iOR(PersonalIdTable.PersonalName, BaseFilter.ComparisonOperator.Contains, AutoTypeAheadWordSeparators & formatedSearchText, True, False) + + search.iOR(PersonalIdTable.PersonalLastName, BaseFilter.ComparisonOperator.Starts_With, formatedSearchText, True, False) + search.iOR(PersonalIdTable.PersonalLastName, BaseFilter.ComparisonOperator.Contains, AutoTypeAheadWordSeparators & formatedSearchText, True, False) + + Else + + search.iOR(PersonalIdTable.PersonalName, BaseFilter.ComparisonOperator.Contains, formatedSearchText, True, False) + search.iOR(PersonalIdTable.PersonalLastName, BaseFilter.ComparisonOperator.Contains, formatedSearchText, True, False) + End If + wc.iAND(search) + + End If + End If + + + Return wc + End Function + + Protected Overridable Function CreateQueryClause() As WhereClause + ' Create a where clause for the Static clause defined at design time. + Dim filter As CompoundFilter = New CompoundFilter(CompoundFilter.CompoundingOperators.And_Operator, Nothing) + Dim whereClause As WhereClause = New WhereClause() + + filter.AddFilter(New BaseClasses.Data.ColumnValueFilter(BaseClasses.Data.BaseTable.CreateInstance("Persons.Business.PersonalIdTable, App_Code").TableDefinition.ColumnList.GetByUniqueName("PersonalId_.StatusId"), "1", BaseClasses.Data.BaseFilter.ComparisonOperator.Not_Equals, False)) + filter.AddFilter(New BaseClasses.Data.ColumnValueFilter(BaseClasses.Data.BaseTable.CreateInstance("Persons.Business.PersonalIdTable, App_Code").TableDefinition.ColumnList.GetByUniqueName("PersonalId_.StatusId"), "8", BaseClasses.Data.BaseFilter.ComparisonOperator.Not_Equals, False)) + + whereClause.AddFilter(filter, CompoundFilter.CompoundingOperators.And_Operator) + + Return whereClause + + End Function + + Public Overridable Function GetAutoCompletionList_PersonalIdSearch1(ByVal prefixText As String, ByVal count As Integer) As String() + Dim resultList As ArrayList = New ArrayList + Dim wordList As ArrayList = New ArrayList + Dim iteration As Integer = 0 + + Dim filterJoin As CompoundFilter = CreateCompoundJoinFilter() + Dim wc As WhereClause = CreateWhereClause(prefixText,"PersonalIdSearch1", "WordsStartingWithSearchString", "[^a-zA-Z0-9]") + While (resultList.Count < count AndAlso iteration < 5) + ' Fetch 100 records in each iteration + Dim recordList () As Persons.Business.PersonalIdRecord = PersonalIdTable.GetRecords(filterJoin, wc, Nothing, iteration, 100) + Dim rec As PersonalIdRecord = Nothing + Dim resultItem As String = "" + For Each rec In recordList + ' Exit the loop if recordList count has reached AutoTypeAheadListSize. + If resultList.Count >= count then + Exit For + End If + ' If the field is configured to Display as Foreign key, Format() method returns the + ' Display as Forien Key value instead of original field value. + ' Since search had to be done in multiple fields (selected in Control's page property, binding tab) in a record, + ' We need to find relevent field to display which matches the prefixText and is not already present in the result list. + + resultItem = rec.Format(PersonalIdTable.PersonalName) + If resultItem IsNot Nothing AndAlso resultItem.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture).Contains(prefixText.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture)) Then + + Dim isAdded As Boolean = FormatSuggestions(prefixText, resultItem, 50, "AtBeginningOfMatchedString", "WordsStartingWithSearchString", "[^a-zA-Z0-9]", resultList) + If isAdded Then + Continue For + End If + End If + + resultItem = rec.Format(PersonalIdTable.PersonalLastName) + If resultItem IsNot Nothing AndAlso resultItem.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture).Contains(prefixText.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture)) Then + + Dim isAdded As Boolean = FormatSuggestions(prefixText, resultItem, 50, "AtBeginningOfMatchedString", "WordsStartingWithSearchString", "[^a-zA-Z0-9]", resultList) + If isAdded Then + Continue For + End If + End If + + Next + ' Exit the loop if number of records found is less as further iteration will not return any more records + If recordList .Length < 100 Then + Exit While + End If + iteration += 1 + End While + + resultList.Sort() + Dim result() As String = New String(resultList.Count - 1) {} + Array.Copy(resultList.ToArray, result, resultList.Count) + Return result + End Function + + + Public Overridable Function FormatSuggestions(ByVal prefixText As String, ByVal resultItem As String, _ + ByVal columnLength As Integer, ByVal AutoTypeAheadDisplayFoundText As String, _ + ByVal autoTypeAheadSearch As String, ByVal AutoTypeAheadWordSeparators As String, _ + ByVal resultList As ArrayList) As Boolean + + 'Formats the resultItem and adds it to the list of suggestions. + Dim index As Integer = resultItem.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture).IndexOf(prefixText.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture)) + Dim itemToAdd As String = "" + Dim isFound As Boolean = False + Dim isAdded As Boolean = False + ' Get the index where prfixt is at the beginning of resultItem. If not found then, index of word which begins with prefixText. + If InvariantLCase(autoTypeAheadSearch).equals("wordsstartingwithsearchstring") And Not index = 0 Then + ' Expression to find word which contains AutoTypeAheadWordSeparators followed by prefixText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex( AutoTypeAheadWordSeparators + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + If regex1.IsMatch(resultItem) Then + index = regex1.Match(resultItem).Index + isFound = True + End If + ' If the prefixText is found immediatly after white space then starting of the word is found so don not search any further + If not resultItem(index).ToString() = " " Then + ' Expression to find beginning of the word which contains AutoTypeAheadWordSeparators followed by prefixText + Dim regex As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\\S*" + AutoTypeAheadWordSeparators + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + If regex.IsMatch(resultItem) Then + index = regex.Match(resultItem).Index + isFound = True + End If + End If + End If + + ' If autoTypeAheadSearch value is wordsstartingwithsearchstring then, extract the substring only if the prefixText is found at the + ' beginning of the resultItem (index = 0) or a word in resultItem is found starts with prefixText. + If index = 0 Or isFound Or InvariantLCase(autoTypeAheadSearch).Equals("anywhereinstring") then + If InvariantLCase(AutoTypeAheadDisplayFoundText).equals("atbeginningofmatchedstring") Then + ' Expression to find beginning of the word which contains prefixText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\\S*" + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + ' Find the beginning of the word which contains prefexText + If (StringUtils.InvariantLCase(autoTypeAheadSearch).Equals("anywhereinstring") AndAlso regex1.IsMatch(resultItem)) Then + index = regex1.Match(resultItem).Index + isFound = True + End If + ' Display string from the index till end of the string if sub string from index till end is less than columnLength value. + If Len(resultItem) - index <= columnLength Then + If index = 0 Then + itemToAdd = resultItem + Else + itemToAdd = "..." & resultItem.Substring(index, Len(resultItem) - index) + End If + Else + If index = 0 Then + itemToAdd = resultItem.Substring(index, (columnLength - 3)) & "..." + Else + 'Truncate the string to show only columnLength - 6 characters as begining and trailing "..." has to be appended. + itemToAdd = "..." & resultItem.Substring(index , columnLength - 6) & "..." + End If + End If + ElseIf InvariantLCase(AutoTypeAheadDisplayFoundText).equals("inmiddleofmatchedstring") Then + Dim subStringBeginIndex As Integer = CType(columnLength/2, Integer) + If Len(resultItem) <= columnLength Then + itemToAdd = resultItem + Else + ' Sanity check at end of the string + If index + Len(prefixText) = columnLength Then + itemToAdd = "..." & resultItem.Substring(index-columnLength,index) + ElseIf Len(resultItem) - index < subStringBeginIndex Then + ' Display string from the end till columnLength value if, index is closer to the end of the string. + itemToAdd = "..." & resultItem.Substring(Len(resultItem)-columnLength,Len(resultItem)) + ElseIf index <= subStringBeginIndex Then + ' Sanity chet at beginning of the string + itemToAdd = resultItem.Substring(0, columnLength) & "..." + Else + ' Display string containing text before the prefixText occures and text after the prefixText + itemToAdd = "..." & resultItem.Substring(index - subStringBeginIndex, columnLength) & "..." + End If + End If + ElseIf InvariantLCase(AutoTypeAheadDisplayFoundText).equals("atendofmatchedstring") Then + ' Expression to find ending of the word which contains prefexText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\s", System.Text.RegularExpressions.RegexOptions.IgnoreCase) + ' Find the ending of the word which contains prefexText + If regex1.IsMatch(resultItem, index + 1) Then + index = regex1.Match(resultItem, index + 1).Index + Else + ' If the word which contains prefexText is the last word in string, regex1.IsMatch returns false. + index = resultItem.Length + End If + If index > Len(resultItem) Then + index = Len(resultItem) + End If + ' If text from beginning of the string till index is less than columnLength value then, display string from the beginning till index. + If index <= columnLength Then + if index = Len(resultItem) Then 'Make decision to append "..." + itemToAdd = resultItem.Substring(0,index) + Else + itemToAdd = resultItem.Substring(0,index) & "..." + End If + Else + If index = Len(resultItem) Then + itemToAdd = "..." & resultItem.Substring(index - (columnLength - 3), (columnLength - 3)) + Else + 'Truncate the string to show only columnLength - 6 characters as begining and trailing "..." has to be appended. + itemToAdd = "..." & resultItem.Substring(index - (columnLength - 6), columnLength - 6) & "..." + End If + End If + End If + + ' Remove newline character from itemToAdd + Dim prefixTextIndex As Integer = itemToAdd.IndexOf(prefixText, StringComparison.CurrentCultureIgnoreCase) + ' If itemToAdd contains any newline after the search text then show text only till newline + Dim regex2 As System.Text.RegularExpressions.Regex = New System.Text.RegularExpressions.Regex("(" & vbCrLf & "|" & vbLf & ")", System.Text.RegularExpressions.RegexOptions.IgnoreCase) + Dim newLineIndexAfterPrefix As Integer = -1 + If regex2.IsMatch(itemToAdd, prefixTextIndex) Then + newLineIndexAfterPrefix = regex2.Match(itemToAdd, prefixTextIndex).Index + End If + If (newLineIndexAfterPrefix > -1) Then + If itemToAdd.EndsWith("...") Then + itemToAdd = (itemToAdd.Substring(0, newLineIndexAfterPrefix) + "...") + Else + itemToAdd = itemToAdd.Substring(0, newLineIndexAfterPrefix) + End If + End If + ' If itemToAdd contains any newline before search text then show text which comes after newline + Dim regex3 As System.Text.RegularExpressions.Regex = New System.Text.RegularExpressions.Regex("(" & vbCrLf & "|" & vbLf & ")", (System.Text.RegularExpressions.RegexOptions.IgnoreCase Or System.Text.RegularExpressions.RegexOptions.RightToLeft)) + Dim newLineIndexBeforePrefix As Integer = -1 + If regex3.IsMatch(itemToAdd, prefixTextIndex) Then + newLineIndexBeforePrefix = regex3.Match(itemToAdd, prefixTextIndex).Index + End If + If (newLineIndexBeforePrefix > -1) Then + If itemToAdd.StartsWith("...") Then + itemToAdd = ("..." + itemToAdd.Substring((newLineIndexBeforePrefix + regex3.Match(itemToAdd, prefixTextIndex).Length))) + Else + itemToAdd = itemToAdd.Substring((newLineIndexBeforePrefix + regex3.Match(itemToAdd, prefixTextIndex).Length)) + End If + End If + + If Not itemToAdd is nothing AndAlso Not resultList.Contains(itemToAdd) Then + + resultList.Add(itemToAdd) + + isAdded = true + End If + End If + Return isAdded + End Function + + + Protected Overridable Sub GetPageSize() + + If Me.PersonalIdPagination.PageSize.Text.Trim <> "" Then + Try + 'Me.PageSize = Integer.Parse(Me.PersonalIdPagination.PageSize.Text) + Catch ex As Exception + End Try + End If + End Sub + + Protected Overridable Sub AddNewRecords() + + Dim newRecordList As ArrayList = New ArrayList() + + Dim newUIDataList As System.Collections.Generic.List(Of Hashtable) = New System.Collections.Generic.List(Of Hashtable)() + + ' Loop though all the record controls and if the record control + ' does not have a unique record id set, then create a record + ' and add to the list. + If Not Me.ResetData Then + Dim rep As System.Web.UI.WebControls.Repeater = CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalIdTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return + + Dim repItem As System.Web.UI.WebControls.RepeaterItem + For Each repItem In rep.Items + ' Loop through all rows in the table, set its DataSource and call DataBind(). + + Dim recControl As PersonalIdTableControlRow = DirectCast(repItem.FindControl("PersonalIdTableControlRow"), PersonalIdTableControlRow) + + If recControl.Visible AndAlso recControl.IsNewRecord() Then + + Dim rec As PersonalIdRecord = New PersonalIdRecord() + + If recControl.PersonalId.Text <> "" Then + rec.Parse(recControl.PersonalId.Text, PersonalIdTable.PersonalId) + End If + newUIDataList.Add(recControl.PreservedUIData()) + newRecordList.Add(rec) + End If + Next + End If + + + ' Add any new record to the list. + Dim index As Integer = 0 + For index = 1 To Me.AddNewRecord + + newRecordList.Insert(0, New PersonalIdRecord()) + newUIDataList.Insert(0, New Hashtable()) + + Next + Me.AddNewRecord = 0 + + ' Finally, add any new records to the DataSource. + If newRecordList.Count > 0 Then + + Dim finalList As ArrayList = New ArrayList(Me.DataSource) + finalList.InsertRange(0, newRecordList) + + Me.DataSource = DirectCast(finalList.ToArray(GetType(PersonalIdRecord)), PersonalIdRecord()) + + End If + + ' Add the existing UI data to this hash table + If newUIDataList.Count > 0 Then + Me.UIData.InsertRange(0, newUIDataList) + End If + + End Sub + + + Public Sub AddToDeletedRecordIds(ByVal rec As PersonalIdTableControlRow) + If rec.IsNewRecord() Then + Return + End If + + If Not Me.DeletedRecordIds Is Nothing AndAlso Me.DeletedRecordIds.Trim <> "" Then + Me.DeletedRecordIds &= "," + End If + + Me.DeletedRecordIds &= "[" & rec.RecordUniqueId & "]" + End Sub + + Protected Overridable Function InDeletedRecordIds(ByVal rec As PersonalIdTableControlRow) As Boolean + If Me.DeletedRecordIds Is Nothing OrElse Me.DeletedRecordIds.Trim = "" Then + Return False + End If + + Return Me.DeletedRecordIds.IndexOf("[" & rec.RecordUniqueId & "]") >= 0 + End Function + + Private _DeletedRecordIds As String + Public Property DeletedRecordIds() As String + Get + Return Me._DeletedRecordIds + End Get + Set(ByVal value As String) + Me._DeletedRecordIds = value + End Set + End Property + + + ' Create Set, WhereClause, and Populate Methods + + Public Overridable Sub SetPersonalIdLabel() + + End Sub + + Public Overridable Sub SetPersonalIdTableControlCollapsibleRegion() + + End Sub + + Public Overridable Sub SetPersonalIdTableControlIcon() + + End Sub + + Public Overridable Sub SetPersonalIdTableControlPanelExtender() + + End Sub + + Public Overridable Sub SetPersonalIdSearch1() + + End Sub + + + + + Protected Overridable Sub Control_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.PreRender + ' PreRender event is raised just before page is being displayed. + Try + DbUtils.StartTransaction + Me.RegisterPostback() + + If Not Me.Page.ErrorOnPage AndAlso (Me.Page.IsPageRefresh OrElse Me.DataChanged OrElse Me.ResetData) Then + + + ' Re-load the data and update the web page if necessary. + ' This is typically done during a postback (filter, search button, sort, pagination button). + ' In each of the other click handlers, simply set DataChanged to True to reload the data. + + Me.LoadData() + Me.DataBind() + + End If + + + + Catch ex As Exception + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + Finally + DbUtils.EndTransaction + End Try + End Sub + + + Protected Overrides Sub SaveControlsToSession() + MyBase.SaveControlsToSession() + + ' Save filter controls to values to session. + + Me.SaveToSession(Me.PersonalIdSearch1, Me.PersonalIdSearch1.Text) + + + 'Save pagination state to session. + + + + ' Save table control properties to the session. + If Not Me.CurrentSortOrder Is Nothing Then + Me.SaveToSession(Me, "Order_By", Me.CurrentSortOrder.ToXmlString()) + End If + + Me.SaveToSession(Me, "Page_Index", Me.PageIndex.ToString()) + Me.SaveToSession(Me, "Page_Size", Me.PageSize.ToString()) + + Me.SaveToSession(Me, "DeletedRecordIds", Me.DeletedRecordIds) + + End Sub + + Protected Sub SaveControlsToSession_Ajax() + ' Save filter controls to values to session. + + Me.SaveToSession("PersonalIdSearch1_Ajax", Me.PersonalIdSearch1.Text) + + HttpContext.Current.Session("AppRelativeVirtualPath") = Me.Page.AppRelativeVirtualPath + + End Sub + + Protected Overrides Sub ClearControlsFromSession() + MyBase.ClearControlsFromSession() + + ' Clear filter controls values from the session. + + Me.RemoveFromSession(Me.PersonalIdSearch1) + + ' Clear pagination state from session. + + + + ' Clear table properties from the session. + Me.RemoveFromSession(Me, "Order_By") + Me.RemoveFromSession(Me, "Page_Index") + Me.RemoveFromSession(Me, "Page_Size") + + Me.RemoveFromSession(Me, "DeletedRecordIds") + + End Sub + + Protected Overrides Sub LoadViewState(ByVal savedState As Object) + MyBase.LoadViewState(savedState) + + Dim orderByStr As String = CType(ViewState("PersonalIdTableControl_OrderBy"), String) + + If orderByStr IsNot Nothing AndAlso orderByStr.Trim <> "" Then + Me.CurrentSortOrder = BaseClasses.Data.OrderBy.FromXmlString(orderByStr) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + End If + + Dim pageIndex As String = CType(ViewState("Page_Index"), String) + If pageIndex IsNot Nothing Then + Me.PageIndex = CInt(pageIndex) + End If + + Dim pageSize As String = CType(ViewState("Page_Size"), String) + If Not pageSize Is Nothing Then + Me.PageSize = CInt(pageSize) + End If + + + + ' Load view state for pagination control. + + Me.DeletedRecordIds = CType(Me.ViewState("DeletedRecordIds"), String) + + End Sub + + Protected Overrides Function SaveViewState() As Object + + If Me.CurrentSortOrder IsNot Nothing Then + Me.ViewState("PersonalIdTableControl_OrderBy") = Me.CurrentSortOrder.ToXmlString() + End If + + Me.ViewState("Page_Index") = Me.PageIndex + Me.ViewState("Page_Size") = Me.PageSize + + Me.ViewState("DeletedRecordIds") = Me.DeletedRecordIds + + + ' Load view state for pagination control. + + + Return MyBase.SaveViewState() + End Function + + ' Generate the event handling functions for pagination events. + + ' event handler for ImageButton + Public Overridable Sub PersonalIdPagination_FirstPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.PageIndex = 0 + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalIdPagination_LastPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.DisplayLastPage = True + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalIdPagination_NextPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.PageIndex += 1 + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for LinkButton + Public Overridable Sub PersonalIdPagination_PageSizeButton_Click(ByVal sender As Object, ByVal args As EventArgs) + + Try + + Me.DataChanged = True + + Me.PageSize = Integer.Parse(Me.PersonalIdPagination.PageSize.Text) + + Me.PageIndex = Integer.Parse(Me.PersonalIdPagination.CurrentPage.Text) - 1 + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalIdPagination_PreviousPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + If Me.PageIndex > 0 Then + Me.PageIndex -= 1 + Me.DataChanged = True + End If + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + + ' Generate the event handling functions for sorting events. + + + ' Generate the event handling functions for button events. + + ' event handler for Button with Layout + Public Overridable Sub PersonalIdSearchButton1_Click(ByVal sender As Object, ByVal args As EventArgs) + + Try + + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + + + ' Generate the event handling functions for filter and search events. + + + ' Generate the event handling functions for others + + + Private _UIData As New System.Collections.Generic.List(Of Hashtable) + Public Property UIData() As System.Collections.Generic.List(Of Hashtable) + Get + Return Me._UIData + End Get + Set(ByVal value As System.Collections.Generic.List(Of Hashtable)) + Me._UIData = value + End Set + End Property + + ' pagination properties + Protected _PageSize As Integer + Public Property PageSize() As Integer + Get + Return Me._PageSize + End Get + Set(ByVal value As Integer) + Me._PageSize = value + End Set + End Property + + Protected _PageIndex As Integer + Public Property PageIndex() As Integer + Get + ' Return the PageIndex + Return Me._PageIndex + End Get + Set(ByVal value As Integer) + Me._PageIndex = value + End Set + End Property + + Protected _TotalRecords As Integer = -1 + Public Property TotalRecords() As Integer + Get + If _TotalRecords < 0 + _TotalRecords = PersonalIdTable.GetRecordCount(CreateCompoundJoinFilter(), CreateWhereClause()) + End If + Return Me._TotalRecords + End Get + Set(ByVal value As Integer) + If Me.PageSize > 0 Then + + Me.TotalPages = CInt(Math.Ceiling(value / Me.PageSize)) + + End If + Me._TotalRecords = value + End Set + End Property + + + + Protected _TotalPages As Integer = -1 + Public Property TotalPages() As Integer + Get + If _TotalPages < 0 Then + + Me.TotalPages = CInt(Math.Ceiling(TotalRecords / Me.PageSize)) + + End If + Return Me._TotalPages + End Get + Set(ByVal value As Integer) + Me._TotalPages = value + End Set + End Property + + Protected _DisplayLastPage As Boolean + Public Property DisplayLastPage() As Boolean + Get + Return Me._DisplayLastPage + End Get + Set(ByVal value As Boolean) + Me._DisplayLastPage = value + End Set + End Property + + Private _DataChanged As Boolean = False + Public Property DataChanged() As Boolean + Get + Return Me._DataChanged + End Get + Set(ByVal value As Boolean) + Me._DataChanged = value + End Set + End Property + + Private _ResetData As Boolean = False + Public Property ResetData() As Boolean + Get + Return Me._ResetData + End Get + Set(ByVal value As Boolean) + Me._ResetData = value + End Set + End Property + + Private _AddNewRecord As Integer = 0 + Public Property AddNewRecord() As Integer + Get + Return Me._AddNewRecord + End Get + Set(ByVal value As Integer) + Me._AddNewRecord = value + End Set + End Property + + + Private _CurrentSortOrder As OrderBy = Nothing + Public Property CurrentSortOrder() As OrderBy + Get + Return Me._CurrentSortOrder + End Get + Set(ByVal value As BaseClasses.Data.OrderBy) + Me._CurrentSortOrder = value + End Set + End Property + + Private _DataSource() As PersonalIdRecord = Nothing + Public Property DataSource() As PersonalIdRecord () + Get + Return Me._DataSource + End Get + Set(ByVal value() As PersonalIdRecord) + Me._DataSource = value + End Set + End Property + +#Region "Helper Properties" + + Public ReadOnly Property PersonalIdLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalIdLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property PersonalIdPagination() As Persons.UI.IPagination + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalIdPagination"), Persons.UI.IPagination) + End Get + End Property + + Public ReadOnly Property PersonalIdSearch1() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalIdSearch1"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property PersonalIdSearchButton1() As Persons.UI.IThemeButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalIdSearchButton1"), Persons.UI.IThemeButton) + End Get + End Property + + Public ReadOnly Property PersonalIdTableControlCollapsibleRegion() As System.Web.UI.WebControls.Panel + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalIdTableControlCollapsibleRegion"), System.Web.UI.WebControls.Panel) + End Get + End Property + + Public ReadOnly Property PersonalIdTableControlIcon() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalIdTableControlIcon"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalIdTableControlPanelExtender() As AjaxControlToolkit.CollapsiblePanelExtender + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalIdTableControlPanelExtender"), AjaxControlToolkit.CollapsiblePanelExtender) + End Get + End Property + + Public ReadOnly Property PersonalIdTitle() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalIdTitle"), System.Web.UI.WebControls.Literal) + End Get + End Property + +#End Region + +#Region "Helper Functions" + + Public Overrides Overloads Function ModifyRedirectUrl(url As String, arg As String, ByVal bEncrypt As Boolean) As String + Return Me.Page.EvaluateExpressions(url, arg, bEncrypt, Me) + End Function + + Public Overrides Overloads Function EvaluateExpressions(url As String, arg As String, ByVal bEncrypt As Boolean) As String + Dim needToProcess As Boolean = AreAnyUrlParametersForMe(url, arg) + If (needToProcess) Then + Dim recCtl As PersonalIdTableControlRow = Me.GetSelectedRecordControl() + If recCtl Is Nothing AndAlso url.IndexOf("{") >= 0 Then + ' Localization. + Throw New Exception(Page.GetResourceValue("Err:NoRecSelected", "Persons")) + End If + Dim rec As PersonalIdRecord = Nothing + If recCtl IsNot Nothing Then + rec = recCtl.GetRecord() + End If + Return EvaluateExpressions(url, arg, rec, bEncrypt) + End If + Return url + End Function + + Public Overridable Function GetSelectedRecordControl() As PersonalIdTableControlRow + Return Nothing + + End Function + + Public Overridable Function GetSelectedRecordControls() As PersonalIdTableControlRow() + + Return DirectCast((new ArrayList()).ToArray(GetType(PersonalIdTableControlRow)), PersonalIdTableControlRow()) + + End Function + + Public Overridable Sub DeleteSelectedRecords(ByVal deferDeletion As Boolean) + Dim recList() As PersonalIdTableControlRow = Me.GetSelectedRecordControls() + If recList.Length = 0 Then + ' Localization. + Throw New Exception(Page.GetResourceValue("Err:NoRecSelected", "Persons")) + End If + + Dim recCtl As PersonalIdTableControlRow + For Each recCtl In recList + If deferDeletion Then + If Not recCtl.IsNewRecord Then + + Me.AddToDeletedRecordIds(recCtl) + + End If + recCtl.Visible = False + + Else + + recCtl.Delete() + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + End If + Next + End Sub + + Public Function GetRecordControls() As PersonalIdTableControlRow() + Dim recList As ArrayList = New ArrayList() + Dim rep As System.Web.UI.WebControls.Repeater = CType(Me.FindControl("PersonalIdTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return Nothing + Dim repItem As System.Web.UI.WebControls.RepeaterItem + + For Each repItem In rep.Items + + Dim recControl As PersonalIdTableControlRow = DirectCast(repItem.FindControl("PersonalIdTableControlRow"), PersonalIdTableControlRow) + recList.Add(recControl) + + Next + + Return DirectCast(recList.ToArray(GetType(PersonalIdTableControlRow)), PersonalIdTableControlRow()) + 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 + + \ No newline at end of file diff --git a/App_Code/PersonalEducation/ShowViewMaxPersonalEducation.Controls.vb b/App_Code/PersonalEducation/ShowViewMaxPersonalEducation.Controls.vb new file mode 100644 index 0000000..dfcc6c6 --- /dev/null +++ b/App_Code/PersonalEducation/ShowViewMaxPersonalEducation.Controls.vb @@ -0,0 +1,4405 @@ + +' This file implements the TableControl, TableControlRow, and RecordControl classes for the +' ShowViewMaxPersonalEducation.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.ShowViewMaxPersonalEducation + +#Region "Section 1: Place your customizations here." + + +Public Class View_MaxPersonalEducationTableControlRow + Inherits BaseView_MaxPersonalEducationTableControlRow + ' The BaseView_MaxPersonalEducationTableControlRow implements code for a ROW within the + ' the View_MaxPersonalEducationTableControl table. The BaseView_MaxPersonalEducationTableControlRow implements the DataBind and SaveData methods. + ' The loading of data is actually performed by the LoadData method in the base class of View_MaxPersonalEducationTableControl. + + ' This is the ideal place to add your code customizations. For example, you can override the DataBind, + ' SaveData, GetUIData, and Validate methods. + + +End Class + + + +Public Class View_MaxPersonalEducationTableControl + Inherits BaseView_MaxPersonalEducationTableControl + + + + Private Sub View_MaxPersonalEducationTableControl_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Init + MyBase.Control_Init(sender, e) + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(View_MaxPersonalEducationView.RankId, OrderByItem.OrderDir.Asc) + Me.CurrentSortOrder.Add(View_MaxPersonalEducationView.DateRank, OrderByItem.OrderDir.Asc) + Me.CurrentSortOrder.Add(View_MaxPersonalEducationView.DatePrevRank, OrderByItem.OrderDir.Asc) + End Sub + + Protected Overrides Sub PopulateRankLevelFromFilter(ByVal selectedValue As String, ByVal maxItems As Integer) + + ' Setup the WHERE clause, including the base table if needed. + + Dim wc As WhereClause = Me.CreateWhereClause_RankLevelFromFilter() + + Dim orderBy As OrderBy = New OrderBy(False, True) + orderBy.Add(View_MaxPersonalEducationView.RankLevel, OrderByItem.OrderDir.Asc) + + Dim values() As String = View_MaxPersonalEducationView.GetValues(View_MaxPersonalEducationView.RankLevel, wc, orderBy, maxItems) + + Me.RankLevelFromFilter.Items.Clear() + Dim itemValue As String + + For Each itemValue In values + ' Create the item and add to the list. + Dim fvalue As String + + If (View_MaxPersonalEducationView.RankLevel.IsColumnValueTypeBoolean()) Then + fvalue = itemValue + Else + fvalue = View_MaxPersonalEducationView.RankLevel.Format(itemValue) + End If + + Dim item As ListItem = New ListItem(fvalue, itemValue) + Me.RankLevelFromFilter.Items.Add(item) + Next + + ' Add the All item. + Me.RankLevelFromFilter.Items.Insert(0, New ListItem(Page.GetResourceValue("Txt:All", "Persons"), "--ANY--")) + + ' Set the selected value. + SetSelectedValue(Me.RankLevelFromFilter, selectedValue) + + + End Sub + + + Private Sub View_MaxPersonalEducationTableControl_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(View_MaxPersonalEducationView.RankId, OrderByItem.OrderDir.Asc) + Me.CurrentSortOrder.Add(View_MaxPersonalEducationView.DateRank, OrderByItem.OrderDir.Asc) + Me.CurrentSortOrder.Add(View_MaxPersonalEducationView.DatePrevRank, OrderByItem.OrderDir.Asc) + + End Sub + End Class + + + +#End Region + + + +#Region "Section 2: Do not modify this section." + + +' Base class for the View_MaxPersonalEducationTableControlRow control on the ShowViewMaxPersonalEducation page. +' Do not modify this class. Instead override any method in View_MaxPersonalEducationTableControlRow. +Public Class BaseView_MaxPersonalEducationTableControlRow + Inherits Persons.UI.BaseApplicationRecordControl + + ' To customize, override this method in View_MaxPersonalEducationTableControlRow. + Protected Overridable Sub Control_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Init + + Me.ClearControlsFromSession() + End Sub + + ' To customize, override this method in View_MaxPersonalEducationTableControlRow. + Protected Overridable Sub Control_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load + + 'Call LoadFocusScripts from repeater so that onfocus attribute could be added to elements + Me.Page.LoadFocusScripts(Me) + + + ' Register the event handlers. + + + End Sub + + + Public Overridable Sub LoadData() + + ' Load the data from the database into the DataSource View_MaxPersonalEducation 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 = View_MaxPersonalEducationView.GetRecord(Me.RecordUniqueId, True) + + Return + End If + + ' Since this is a row in the table, the data for this row is loaded by the + ' LoadData method of the BaseView_MaxPersonalEducationTableControl when the data for the entire + ' table is loaded. + + Me.DataSource = New View_MaxPersonalEducationRecord() + + + + End Sub + + ' Populate the UI controls using the DataSource. To customize, override this method in View_MaxPersonalEducationTableControlRow. + 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 + + SetCountry() + SetCourse() + SetCourseAbbr() + SetEdYear() + SetFacultry() + SetInstitue() + SetLevel() + SetRankAndName() + SetSectionAbbvrName() + + + 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 SetCountry() + + + ' Set the Country Literal on the webpage with value from the + ' View_MaxPersonalEducation database record. + + ' Me.DataSource is the View_MaxPersonalEducation record retrieved from the database. + ' Me.Country is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetCountry() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.CountrySpecified Then + + ' If the Country is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(View_MaxPersonalEducationView.Country) + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.Country.Text = formattedValue + + Else + + ' Country is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.Country.Text = View_MaxPersonalEducationView.Country.Format(View_MaxPersonalEducationView.Country.DefaultValue) + + End If + + ' If the Country is NULL or blank, then use the value specified + ' on Properties. + If Me.Country.Text Is Nothing _ + OrElse Me.Country.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.Country.Text = " " + End If + + End Sub + + Public Overridable Sub SetCourse() + + + ' Set the Course Literal on the webpage with value from the + ' View_MaxPersonalEducation database record. + + ' Me.DataSource is the View_MaxPersonalEducation record retrieved from the database. + ' Me.Course is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetCourse() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.CourseSpecified Then + + ' If the Course is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(View_MaxPersonalEducationView.Course) + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.Course.Text = formattedValue + + Else + + ' Course is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.Course.Text = View_MaxPersonalEducationView.Course.Format(View_MaxPersonalEducationView.Course.DefaultValue) + + End If + + ' If the Course is NULL or blank, then use the value specified + ' on Properties. + If Me.Course.Text Is Nothing _ + OrElse Me.Course.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.Course.Text = " " + End If + + End Sub + + Public Overridable Sub SetCourseAbbr() + + + ' Set the CourseAbbr Literal on the webpage with value from the + ' View_MaxPersonalEducation database record. + + ' Me.DataSource is the View_MaxPersonalEducation record retrieved from the database. + ' Me.CourseAbbr is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetCourseAbbr() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.CourseAbbrSpecified Then + + ' If the CourseAbbr is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(View_MaxPersonalEducationView.CourseAbbr) + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.CourseAbbr.Text = formattedValue + + Else + + ' CourseAbbr is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.CourseAbbr.Text = View_MaxPersonalEducationView.CourseAbbr.Format(View_MaxPersonalEducationView.CourseAbbr.DefaultValue) + + End If + + ' If the CourseAbbr is NULL or blank, then use the value specified + ' on Properties. + If Me.CourseAbbr.Text Is Nothing _ + OrElse Me.CourseAbbr.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.CourseAbbr.Text = " " + End If + + End Sub + + Public Overridable Sub SetEdYear() + + + ' Set the EdYear Literal on the webpage with value from the + ' View_MaxPersonalEducation database record. + + ' Me.DataSource is the View_MaxPersonalEducation record retrieved from the database. + ' Me.EdYear is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetEdYear() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.EdYearSpecified Then + + ' If the EdYear is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(View_MaxPersonalEducationView.EdYear) + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.EdYear.Text = formattedValue + + Else + + ' EdYear is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.EdYear.Text = View_MaxPersonalEducationView.EdYear.Format(View_MaxPersonalEducationView.EdYear.DefaultValue) + + End If + + ' If the EdYear is NULL or blank, then use the value specified + ' on Properties. + If Me.EdYear.Text Is Nothing _ + OrElse Me.EdYear.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.EdYear.Text = " " + End If + + End Sub + + Public Overridable Sub SetFacultry() + + + ' Set the Facultry Literal on the webpage with value from the + ' View_MaxPersonalEducation database record. + + ' Me.DataSource is the View_MaxPersonalEducation record retrieved from the database. + ' Me.Facultry is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetFacultry() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.FacultrySpecified Then + + ' If the Facultry is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(View_MaxPersonalEducationView.Facultry) + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.Facultry.Text = formattedValue + + Else + + ' Facultry is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.Facultry.Text = View_MaxPersonalEducationView.Facultry.Format(View_MaxPersonalEducationView.Facultry.DefaultValue) + + End If + + ' If the Facultry is NULL or blank, then use the value specified + ' on Properties. + If Me.Facultry.Text Is Nothing _ + OrElse Me.Facultry.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.Facultry.Text = " " + End If + + End Sub + + Public Overridable Sub SetInstitue() + + + ' Set the Institue Literal on the webpage with value from the + ' View_MaxPersonalEducation database record. + + ' Me.DataSource is the View_MaxPersonalEducation record retrieved from the database. + ' Me.Institue is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetInstitue() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.InstitueSpecified Then + + ' If the Institue is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(View_MaxPersonalEducationView.Institue) + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.Institue.Text = formattedValue + + Else + + ' Institue is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.Institue.Text = View_MaxPersonalEducationView.Institue.Format(View_MaxPersonalEducationView.Institue.DefaultValue) + + End If + + ' If the Institue is NULL or blank, then use the value specified + ' on Properties. + If Me.Institue.Text Is Nothing _ + OrElse Me.Institue.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.Institue.Text = " " + End If + + End Sub + + Public Overridable Sub SetLevel() + + + ' Set the Level Literal on the webpage with value from the + ' View_MaxPersonalEducation database record. + + ' Me.DataSource is the View_MaxPersonalEducation record retrieved from the database. + ' Me.Level is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetLevel() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.LevelSpecified Then + + ' If the Level is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(View_MaxPersonalEducationView.Level) + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.Level.Text = formattedValue + + Else + + ' Level is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.Level.Text = View_MaxPersonalEducationView.Level.Format(View_MaxPersonalEducationView.Level.DefaultValue) + + End If + + ' If the Level is NULL or blank, then use the value specified + ' on Properties. + If Me.Level.Text Is Nothing _ + OrElse Me.Level.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.Level.Text = " " + End If + + End Sub + + Public Overridable Sub SetRankAndName() + + + ' Set the RankAndName Literal on the webpage with value from the + ' View_MaxPersonalEducation database record. + + ' Me.DataSource is the View_MaxPersonalEducation record retrieved from the database. + ' Me.RankAndName is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetRankAndName() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.RankAndNameSpecified Then + + ' If the RankAndName is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(View_MaxPersonalEducationView.RankAndName) + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.RankAndName.Text = formattedValue + + Else + + ' RankAndName is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.RankAndName.Text = View_MaxPersonalEducationView.RankAndName.Format(View_MaxPersonalEducationView.RankAndName.DefaultValue) + + End If + + ' If the RankAndName is NULL or blank, then use the value specified + ' on Properties. + If Me.RankAndName.Text Is Nothing _ + OrElse Me.RankAndName.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.RankAndName.Text = " " + End If + + End Sub + + Public Overridable Sub SetSectionAbbvrName() + + + ' Set the SectionAbbvrName Literal on the webpage with value from the + ' View_MaxPersonalEducation database record. + + ' Me.DataSource is the View_MaxPersonalEducation record retrieved from the database. + ' Me.SectionAbbvrName is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetSectionAbbvrName() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.SectionAbbvrNameSpecified Then + + ' If the SectionAbbvrName is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(View_MaxPersonalEducationView.SectionAbbvrName) + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.SectionAbbvrName.Text = formattedValue + + Else + + ' SectionAbbvrName is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.SectionAbbvrName.Text = View_MaxPersonalEducationView.SectionAbbvrName.Format(View_MaxPersonalEducationView.SectionAbbvrName.DefaultValue) + + End If + + ' If the SectionAbbvrName is NULL or blank, then use the value specified + ' on Properties. + If Me.SectionAbbvrName.Text Is Nothing _ + OrElse Me.SectionAbbvrName.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.SectionAbbvrName.Text = " " + End If + + End Sub + + + Public EvaluateFormulaDelegate As BaseClasses.Data.DataSource.EvaluateFormulaDelegate = New BaseClasses.Data.DataSource.EvaluateFormulaDelegate(AddressOf Me.EvaluateFormula) + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean, ByVal e As FormulaEvaluator) As String + If e Is Nothing Then + e = New FormulaEvaluator() + End If + + e.Variables.Clear() + + + ' add variables for formula evaluation + If variables IsNot Nothing Then + Dim enumerator As System.Collections.Generic.IEnumerator(Of System.Collections.Generic.KeyValuePair(Of String, Object)) = variables.GetEnumerator() + While enumerator.MoveNext() + e.Variables.Add(enumerator.Current.Key, enumerator.Current.Value) + End While + End If + + If includeDS + + End IF + + + ' Other variables referred to in the formula are expected to be + ' properties of the DataSource. For example, referring to + ' UnitPrice as a variable will refer to DataSource.UnitPrice + If dataSourceForEvaluate Is Nothing Then + + e.DataSource = Me.DataSource + + Else + e.DataSource = dataSourceForEvaluate + End If + + ' Define the calling control. This is used to add other + ' related table and record controls as variables. + e.CallingControl = Me + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + + If Not String.IsNullOrEmpty(format) AndAlso (String.IsNullOrEmpty(formula) OrElse formula.IndexOf("Format(") < 0) Then + Return FormulaUtils.Format(resultObj, format) + Else + Return resultObj.ToString() + End If + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format,variables ,includeDS, Nothing) + End Function + + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object)) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format, variables ,True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, format, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal e as FormulaEvaluator) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, variables, True, e) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal includeDS as Boolean) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, includeDS, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, True, Nothing) + End Function + + + Public Overridable Sub RegisterPostback() + + + End Sub + + + + ' To customize, override this method in View_MaxPersonalEducationTableControlRow. + Public Overridable Sub SaveData() + ' Saves the associated record in the database. + ' SaveData calls Validate and Get methods - so it may be more appropriate to + ' customize those methods. + + ' 1. Load the existing record from the database. Since we save the entire record, this ensures + ' that fields that are not displayed are also properly initialized. + Me.LoadData() + + + ' 2. Perform any custom validation. + Me.Validate() + + + ' 3. Set the values in the record with data from UI controls. + ' This calls the Get() method for each of the user interface controls. + Me.GetUIData() + + ' 4. Save in the database. + ' We should not save the record if the data did not change. This + ' will save a database hit and avoid triggering any database triggers. + + If Me.DataSource.IsAnyValueChanged Then + ' Save record to database but do not commit yet. + ' Auto generated ids are available after saving for use by child (dependent) records. + Me.DataSource.Save() + + DirectCast(GetParentControlObject(Me, "View_MaxPersonalEducationTableControl"), View_MaxPersonalEducationTableControl).DataChanged = True + DirectCast(GetParentControlObject(Me, "View_MaxPersonalEducationTableControl"), View_MaxPersonalEducationTableControl).ResetData = True + End If + + + ' update session or cookie by formula + + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + ' For Master-Detail relationships, save data on the Detail table(s) + + End Sub + + ' To customize, override this method in View_MaxPersonalEducationTableControlRow. + 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. + + GetCountry() + GetCourse() + GetCourseAbbr() + GetEdYear() + GetFacultry() + GetInstitue() + GetLevel() + GetRankAndName() + GetSectionAbbvrName() + End Sub + + + Public Overridable Sub GetCountry() + + End Sub + + Public Overridable Sub GetCourse() + + End Sub + + Public Overridable Sub GetCourseAbbr() + + End Sub + + Public Overridable Sub GetEdYear() + + End Sub + + Public Overridable Sub GetFacultry() + + End Sub + + Public Overridable Sub GetInstitue() + + End Sub + + Public Overridable Sub GetLevel() + + End Sub + + Public Overridable Sub GetRankAndName() + + End Sub + + Public Overridable Sub GetSectionAbbvrName() + + End Sub + + + ' To customize, override this method in View_MaxPersonalEducationTableControlRow. + + Public Overridable Function CreateWhereClause() As WhereClause + + Return Nothing + + End Function + + + + ' To customize, override this method in View_MaxPersonalEducationTableControlRow. + 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) + View_MaxPersonalEducationView.DeleteRecord(pkValue) + + DirectCast(GetParentControlObject(Me, "View_MaxPersonalEducationTableControl"), View_MaxPersonalEducationTableControl).DataChanged = True + DirectCast(GetParentControlObject(Me, "View_MaxPersonalEducationTableControl"), View_MaxPersonalEducationTableControl).ResetData = True + End Sub + + Protected Overridable Sub Control_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.PreRender + ' PreRender event is raised just before page is being displayed. + Try + DbUtils.StartTransaction() + Me.RegisterPostback() + + If Not Me.Page.ErrorOnPage AndAlso (Me.Page.IsPageRefresh OrElse Me.DataChanged OrElse Me.ResetData) Then + + ' Call the Set methods for each controls on the panel that use resultset + + + ' 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 + + + + 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("BaseView_MaxPersonalEducationTableControlRow_Rec"), String) + End Get + Set(ByVal value As String) + Me.ViewState("BaseView_MaxPersonalEducationTableControlRow_Rec") = value + End Set + End Property + + Private _DataSource As View_MaxPersonalEducationRecord + Public Property DataSource() As View_MaxPersonalEducationRecord + Get + Return Me._DataSource + End Get + + Set(ByVal value As View_MaxPersonalEducationRecord) + + Me._DataSource = value + End Set + End Property + + + + Private _checkSum As String + Public Overridable Property CheckSum() As String + Get + Return Me._checkSum + End Get + Set(ByVal value As String) + Me._checkSum = value + End Set + End Property + + Private _TotalPages As Integer + Public Property TotalPages() As Integer + Get + Return Me._TotalPages + End Get + Set(ByVal value As Integer) + Me._TotalPages = value + End Set + End Property + + Private _PageIndex As Integer + Public Property PageIndex() As Integer + Get + ' Return the PageIndex + Return Me._PageIndex + End Get + Set(ByVal value As Integer) + Me._PageIndex = value + End Set + End Property + + Private _DisplayLastPage As Boolean + Public Property DisplayLastPage() As Boolean + Get + Return Me._DisplayLastPage + End Get + Set(ByVal value As Boolean) + Me._DisplayLastPage = value + End Set + End Property + + + +#Region "Helper Properties" + + Public ReadOnly Property Country() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Country"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property Course() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Course"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property CourseAbbr() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "CourseAbbr"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property EdYear() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "EdYear"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property Facultry() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Facultry"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property Institue() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Institue"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property Level() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Level"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property RankAndName() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RankAndName"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property SectionAbbvrName() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "SectionAbbvrName"), 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 View_MaxPersonalEducationRecord = 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 View_MaxPersonalEducationRecord + If Not Me.DataSource Is Nothing Then + Return Me.DataSource + End If + + If Not Me.RecordUniqueId Is Nothing Then + + Return View_MaxPersonalEducationView.GetRecord(Me.RecordUniqueId, True) + + End If + + ' Localization. + + Throw New Exception(Page.GetResourceValue("Err:RetrieveRec", "Persons")) + + End Function + + Public Shadows ReadOnly Property Page() As BaseApplicationPage + Get + Return DirectCast(MyBase.Page, BaseApplicationPage) + End Get + End Property + +#End Region + +End Class + + + +' Base class for the View_MaxPersonalEducationTableControl control on the ShowViewMaxPersonalEducation page. +' Do not modify this class. Instead override any method in View_MaxPersonalEducationTableControl. +Public Class BaseView_MaxPersonalEducationTableControl + Inherits Persons.UI.BaseApplicationTableControl + + + + Protected Overridable Sub Control_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Init + + + + ' Setup the filter and search events. + + AddHandler Me.CourseAbbrFilter.SelectedIndexChanged, AddressOf CourseAbbrFilter_SelectedIndexChanged + AddHandler Me.FacultryFilter.SelectedIndexChanged, AddressOf FacultryFilter_SelectedIndexChanged + AddHandler Me.LevelFilter.SelectedIndexChanged, AddressOf LevelFilter_SelectedIndexChanged + AddHandler Me.RankLevelFromFilter.SelectedIndexChanged, AddressOf RankLevelFromFilter_SelectedIndexChanged + AddHandler Me.SectionAbbvrNameFilter.SelectedIndexChanged, AddressOf SectionAbbvrNameFilter_SelectedIndexChanged + If Not Me.Page.IsPostBack Then + Dim initialVal As String = "" + If Me.InSession(Me.CourseAbbrFilter) + initialVal = Me.GetFromSession(Me.CourseAbbrFilter) + + End If + + If initialVal <> "" + + Me.CourseAbbrFilter.Items.Add(New ListItem(initialVal, initialVal)) + + Me.CourseAbbrFilter.SelectedValue = initialVal + + End If + + End If + If Not Me.Page.IsPostBack Then + Dim initialVal As String = "" + If Me.InSession(Me.FacultryFilter) + initialVal = Me.GetFromSession(Me.FacultryFilter) + + End If + + If initialVal <> "" + + Me.FacultryFilter.Items.Add(New ListItem(initialVal, initialVal)) + + Me.FacultryFilter.SelectedValue = initialVal + + End If + + End If + If Not Me.Page.IsPostBack Then + Dim initialVal As String = "" + If Me.InSession(Me.LevelFilter) + initialVal = Me.GetFromSession(Me.LevelFilter) + + End If + + If initialVal <> "" + + Me.LevelFilter.Items.Add(New ListItem(initialVal, initialVal)) + + Me.LevelFilter.SelectedValue = initialVal + + End If + + End If + If Not Me.Page.IsPostBack Then + Dim initialVal As String = "" + If Me.InSession(Me.RankLevelFromFilter) + initialVal = Me.GetFromSession(Me.RankLevelFromFilter) + + End If + + If initialVal <> "" + + Me.RankLevelFromFilter.Items.Add(New ListItem(initialVal, initialVal)) + + Me.RankLevelFromFilter.SelectedValue = initialVal + + End If + + End If + If Not Me.Page.IsPostBack Then + Dim initialVal As String = "" + If Me.InSession(Me.SectionAbbvrNameFilter) + initialVal = Me.GetFromSession(Me.SectionAbbvrNameFilter) + + End If + + If initialVal <> "" + + Me.SectionAbbvrNameFilter.Items.Add(New ListItem(initialVal, initialVal)) + + Me.SectionAbbvrNameFilter.SelectedValue = initialVal + + End If + + End If + If Not Me.Page.IsPostBack Then + Dim initialVal As String = "" + If Me.InSession(Me.View_MaxPersonalEducationSearch1) + initialVal = Me.GetFromSession(Me.View_MaxPersonalEducationSearch1) + + End If + + If initialVal <> "" + + Me.View_MaxPersonalEducationSearch1.Text = initialVal + + End If + + End If + + + ' Control Initializations. + ' Initialize the table's current sort order. + + If Me.InSession(Me, "Order_By") Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + End If + + + + ' Setup default pagination settings. + + Me.PageSize = CInt(Me.GetFromSession(Me, "Page_Size", "10")) + Me.PageIndex = CInt(Me.GetFromSession(Me, "Page_Index", "0")) + + + + Me.ClearControlsFromSession() + End Sub + + Protected Overridable Sub Control_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load + + SaveControlsToSession_Ajax() + + ' Setup the pagination events. + + AddHandler Me.View_MaxPersonalEducationPagination.FirstPage.Click, AddressOf View_MaxPersonalEducationPagination_FirstPage_Click + + AddHandler Me.View_MaxPersonalEducationPagination.LastPage.Click, AddressOf View_MaxPersonalEducationPagination_LastPage_Click + + AddHandler Me.View_MaxPersonalEducationPagination.NextPage.Click, AddressOf View_MaxPersonalEducationPagination_NextPage_Click + + AddHandler Me.View_MaxPersonalEducationPagination.PageSizeButton.Click, AddressOf View_MaxPersonalEducationPagination_PageSizeButton_Click + + AddHandler Me.View_MaxPersonalEducationPagination.PreviousPage.Click, AddressOf View_MaxPersonalEducationPagination_PreviousPage_Click + + + ' Setup the sorting events. + + AddHandler Me.SectionAbbvrNameLabel.Click, AddressOf SectionAbbvrNameLabel_Click + + ' Setup the button events. + + AddHandler Me.View_MaxPersonalEducationExportCSVButton.Click, AddressOf View_MaxPersonalEducationExportCSVButton_Click + + AddHandler Me.View_MaxPersonalEducationExportExcelButton.Click, AddressOf View_MaxPersonalEducationExportExcelButton_Click + + AddHandler Me.View_MaxPersonalEducationPDFButton.Click, AddressOf View_MaxPersonalEducationPDFButton_Click + + AddHandler Me.View_MaxPersonalEducationRefreshButton.Click, AddressOf View_MaxPersonalEducationRefreshButton_Click + + AddHandler Me.View_MaxPersonalEducationResetButton.Click, AddressOf View_MaxPersonalEducationResetButton_Click + + AddHandler Me.View_MaxPersonalEducationWordButton.Click, AddressOf View_MaxPersonalEducationWordButton_Click + + AddHandler Me.View_MaxPersonalEducationSearchButton1.Button.Click, AddressOf View_MaxPersonalEducationSearchButton1_Click + + + ' Setup events for others + + End Sub + + + Public Overridable Sub LoadData() + + ' Read data from database. Returns an array of records that can be assigned + ' to the DataSource table control property. + Try + Dim joinFilter As CompoundFilter = CreateCompoundJoinFilter() + + ' The WHERE clause will be empty when displaying all records in table. + Dim wc As WhereClause = CreateWhereClause() + If wc IsNot Nothing AndAlso Not wc.RunQuery Then + ' Initialize an empty array of records + Dim alist As New ArrayList(0) + Me.DataSource = DirectCast(alist.ToArray(GetType(View_MaxPersonalEducationRecord)), View_MaxPersonalEducationRecord()) + ' Add records to the list if needed. + Me.AddNewRecords() + Me._TotalRecords = 0 + Me._TotalPages = 0 + Return + End If + + ' Call OrderBy to determine the order - either use the order defined + ' on the Query Wizard, or specified by user (by clicking on column heading) + Dim orderBy As OrderBy = CreateOrderBy() + + ' Get the pagesize from the pagesize control. + Me.GetPageSize() + + If Me.DisplayLastPage Then + Dim totalRecords As Integer = If(Me._TotalRecords < 0, View_MaxPersonalEducationView.GetRecordCount(CreateCompoundJoinFilter(), CreateWhereClause()), Me._TotalRecords) + + Dim totalPages As Integer = CInt(Math.Ceiling(totalRecords / Me.PageSize)) + + Me.PageIndex = totalPages - 1 + End If + + ' Make sure PageIndex (current page) and PageSize are within bounds. + If Me.PageIndex < 0 Then + Me.PageIndex = 0 + End If + If Me.PageSize < 1 Then + Me.PageSize = 1 + End If + + ' Retrieve the records and set the table DataSource. + ' Only PageSize records are fetched starting at PageIndex (zero based). + If Me.AddNewRecord > 0 Then + ' Make sure to preserve the previously entered data on new rows. + Dim postdata As New ArrayList + For Each rc As View_MaxPersonalEducationTableControlRow In Me.GetRecordControls() + If Not rc.IsNewRecord Then + rc.DataSource = rc.GetRecord() + rc.GetUIData() + postdata.Add(rc.DataSource) + UIData.Add(rc.PreservedUIData()) + End If + Next + Me.DataSource = DirectCast(postdata.ToArray(GetType(View_MaxPersonalEducationRecord)), View_MaxPersonalEducationRecord()) + Else ' Get the records from the database + Me.DataSource = View_MaxPersonalEducationView.GetRecords(joinFilter, wc, orderBy, Me.PageIndex, Me.PageSize) + + End If + + ' if the datasource contains no records contained in database, then load the last page. + If (DbUtils.GetCreatedRecords(Me.DataSource).Length = 0 AndAlso Not Me.DisplayLastPage) Then + Me.DisplayLastPage = True + LoadData() + Else + + ' Add any new rows desired by the user. + Me.AddNewRecords() + + + ' Initialize the page and grand totals. now + + End If + + Catch ex As Exception + ' Report the error message to the end user + Dim msg As String = ex.Message + If ex.InnerException IsNot Nothing Then + msg = msg & " InnerException: " & ex.InnerException.Message + End If + Throw New Exception(msg, ex.InnerException) + End Try + End Sub + + + + + Public Overrides Sub DataBind() + ' The DataBind method binds the user interface controls to the values + ' from the database record for each row in the table. To do this, it calls the + ' DataBind for each of the rows. + ' DataBind also populates any filters above the table, and sets the pagination + ' control to the correct number of records and the current page number. + + MyBase.DataBind() + + ' Make sure that the DataSource is initialized. + If Me.DataSource Is Nothing Then + Return + End If + + 'LoadData for DataSource for chart and report if they exist + + ' Setup the pagination controls. + BindPaginationControls() + + + + ' Bind the repeater with the list of records to expand the UI. + Dim rep As System.Web.UI.WebControls.Repeater = CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "View_MaxPersonalEducationTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return + rep.DataSource = DataSource() + rep.DataBind() + + Dim index As Integer = 0 + For Each repItem As System.Web.UI.WebControls.RepeaterItem In rep.Items + ' Loop through all rows in the table, set its DataSource and call DataBind(). + Dim recControl As View_MaxPersonalEducationTableControlRow = DirectCast(repItem.FindControl("View_MaxPersonalEducationTableControlRow"), View_MaxPersonalEducationTableControlRow) + recControl.DataSource = Me.DataSource(index) + If Me.UIData.Count > index Then + recControl.PreviousUIData = Me.UIData(index) + End If + recControl.DataBind() + recControl.Visible = Not Me.InDeletedRecordIds(recControl) + + index += 1 + Next + + + + + ' Call the Set methods for each controls on the panel + + SetCountryLabel() + SetCourseAbbrFilter() + SetCourseAbbrLabel() + SetCourseAbbrLabel1() + SetCourseLabel() + SetEdYearLabel() + SetFacultryFilter() + SetFacultryLabel() + SetFacultryLabel1() + SetInstitueLabel() + SetLevelFilter() + SetLevelLabel() + SetLevelLabel1() + SetPersonalNameLabel() + SetRankLevelFromFilter() + SetRankLevelLabel() + SetSectionAbbvrNameFilter() + SetSectionAbbvrNameLabel() + SetSectionAbbvrNameLabel1() + + + + + + + SetView_MaxPersonalEducationSearch1() + + SetView_MaxPersonalEducationTableControlCollapsibleRegion() + SetView_MaxPersonalEducationTableControlIcon() + SetView_MaxPersonalEducationTableControlPanelExtender() + + + ' setting the state of expand or collapse alternative rows + + + ' Load data for each record and table UI control. + ' Ordering is important because child controls get + ' their parent ids from their parent UI controls. + + + ' this method calls the set method for controls with special formula like running total, sum, rank, etc + SetFormulaControls() + End Sub + + Public Overridable Sub SetFormulaControls() + ' this method calls Set methods for the control that has special formula + + + + End Sub + + + + Public Overridable Sub RegisterPostback() + + Me.Page.RegisterPostBackTrigger(MiscUtils.FindControlRecursively(Me,"View_MaxPersonalEducationExportCSVButton")) + + Me.Page.RegisterPostBackTrigger(MiscUtils.FindControlRecursively(Me,"View_MaxPersonalEducationExportExcelButton")) + + Me.Page.RegisterPostBackTrigger(MiscUtils.FindControlRecursively(Me,"View_MaxPersonalEducationPDFButton")) + + Me.Page.RegisterPostBackTrigger(MiscUtils.FindControlRecursively(Me,"View_MaxPersonalEducationWordButton")) + + + End Sub + + Public EvaluateFormulaDelegate As BaseClasses.Data.DataSource.EvaluateFormulaDelegate = New BaseClasses.Data.DataSource.EvaluateFormulaDelegate(AddressOf Me.EvaluateFormula) + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean, ByVal e as FormulaEvaluator) As String + If e Is Nothing + e = New FormulaEvaluator() + End If + + e.Variables.Clear() + + + ' add variables for formula evaluation + If variables IsNot Nothing Then + Dim enumerator As System.Collections.Generic.IEnumerator(Of System.Collections.Generic.KeyValuePair(Of String, Object)) = variables.GetEnumerator() + While enumerator.MoveNext() + e.Variables.Add(enumerator.Current.Key, enumerator.Current.Value) + End While + End If + + If includeDS + + End If + + ' All variables referred to in the formula are expected to be + ' properties of the DataSource. For example, referring to + ' UnitPrice as a variable will refer to DataSource.UnitPrice + e.DataSource = dataSourceForEvaluate + + ' Define the calling control. This is used to add other + ' related table and record controls as variables. + e.CallingControl = Me + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + + If Not String.IsNullOrEmpty(format) AndAlso (String.IsNullOrEmpty(formula) OrElse formula.IndexOf("Format(") < 0) Then + Return FormulaUtils.Format(resultObj, format) + Else + Return resultObj.ToString() + End If + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format,variables ,includeDS, Nothing) + End Function + + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object)) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format, variables ,True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, format, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal e as FormulaEvaluator) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, variables, True, e) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal includeDS as Boolean) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, includeDS, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, True, Nothing) + End Function + + + + + Public Overridable Sub ResetControl() + + Me.CourseAbbrFilter.ClearSelection() + + Me.FacultryFilter.ClearSelection() + + Me.LevelFilter.ClearSelection() + + Me.RankLevelFromFilter.ClearSelection() + + Me.SectionAbbvrNameFilter.ClearSelection() + + Me.View_MaxPersonalEducationSearch1.Text = "" + + Me.CurrentSortOrder.Reset() + If (Me.InSession(Me, "Order_By")) Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + End If + + Me.PageIndex = 0 + End Sub + + Protected Overridable Sub BindPaginationControls() + ' Setup the pagination controls. + + ' Bind the pagination labels. + + If DbUtils.GetCreatedRecords(Me.DataSource).Length > 0 Then + + Me.View_MaxPersonalEducationPagination.CurrentPage.Text = (Me.PageIndex + 1).ToString() + Else + Me.View_MaxPersonalEducationPagination.CurrentPage.Text = "0" + End If + Me.View_MaxPersonalEducationPagination.PageSize.Text = Me.PageSize.ToString() + Me.View_MaxPersonalEducationPagination.TotalItems.Text = Me.TotalRecords.ToString() + Me.View_MaxPersonalEducationPagination.TotalPages.Text = Me.TotalPages.ToString() + + ' Bind the buttons for View_MaxPersonalEducationTableControl pagination. + + Me.View_MaxPersonalEducationPagination.FirstPage.Enabled = Not (Me.PageIndex = 0) + If Me._TotalPages < 0 Then ' if the total pages is not determined yet, enable last and next buttons + Me.View_MaxPersonalEducationPagination.LastPage.Enabled = True + ElseIf Me._TotalPages = 0 ' if the total pages is determined and it is 0, enable last and next buttons + Me.View_MaxPersonalEducationPagination.LastPage.Enabled = False + Else ' if the total pages is the last page, disable last and next buttons + Me.View_MaxPersonalEducationPagination.LastPage.Enabled = Not (Me.PageIndex = Me.TotalPages - 1) + End If + + If Me._TotalPages < 0 Then ' if the total pages is not determined yet, enable last and next buttons + Me.View_MaxPersonalEducationPagination.NextPage.Enabled = True + ElseIf Me._TotalPages = 0 ' if the total pages is determined and it is 0, enable last and next buttons + Me.View_MaxPersonalEducationPagination.NextPage.Enabled = False + Else ' if the total pages is the last page, disable last and next buttons + Me.View_MaxPersonalEducationPagination.NextPage.Enabled = Not (Me.PageIndex = Me.TotalPages - 1) + End If + + Me.View_MaxPersonalEducationPagination.PreviousPage.Enabled = Not (Me.PageIndex = 0) + + + End Sub + + Public Overridable Sub SaveData() + ' Save the data from the entire table. Calls each row's Save Data + ' to save their data. This function is called by the Click handler of the + ' Save button. The button handler should Start/Commit/End a transaction. + + Dim recCtl As View_MaxPersonalEducationTableControlRow + For Each recCtl In Me.GetRecordControls() + + If Me.InDeletedRecordIds(recCtl) Then + ' Delete any pending deletes. + recCtl.Delete() + Else + If recCtl.Visible Then + recCtl.SaveData() + End If + End If + + Next + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + ' Set IsNewRecord to False for all records - since everything has been saved and is no longer "new" + For Each recCtl In Me.GetRecordControls() + recCtl.IsNewRecord = False + Next + + + ' Set DeletedRecordsIds to Nothing since we have deleted all pending deletes. + Me.DeletedRecordIds = Nothing + + End Sub + + Public Overridable Function CreateCompoundJoinFilter() As CompoundFilter + Dim jFilter As CompoundFilter = New CompoundFilter() + + Return jFilter + + End Function + + + Public Overridable Function CreateOrderBy() As OrderBy + ' The CurrentSortOrder is initialized to the sort order on the + ' Query Wizard. It may be modified by the Click handler for any of + ' the column heading to sort or reverse sort by that column. + ' You can add your own sort order, or modify it on the Query Wizard. + Return Me.CurrentSortOrder + End Function + + Public Overridable Function CreateWhereClause() As WhereClause + 'This CreateWhereClause is used for loading the data. + View_MaxPersonalEducationView.Instance.InnerFilter = Nothing + Dim wc As WhereClause = New WhereClause() + + ' Compose the WHERE clause consiting of: + ' 1. Static clause defined at design time. + ' 2. User selected search criteria. + ' 3. User selected filter criteria. + + + If IsValueSelected(Me.CourseAbbrFilter) Then + + wc.iAND(View_MaxPersonalEducationView.CourseAbbr, BaseFilter.ComparisonOperator.EqualsTo, MiscUtils.GetSelectedValue(Me.CourseAbbrFilter, Me.GetFromSession(Me.CourseAbbrFilter)), False, False) + + End If + + + + If IsValueSelected(Me.FacultryFilter) Then + + wc.iAND(View_MaxPersonalEducationView.Facultry, BaseFilter.ComparisonOperator.EqualsTo, MiscUtils.GetSelectedValue(Me.FacultryFilter, Me.GetFromSession(Me.FacultryFilter)), False, False) + + End If + + + + If IsValueSelected(Me.LevelFilter) Then + + wc.iAND(View_MaxPersonalEducationView.Level, BaseFilter.ComparisonOperator.EqualsTo, MiscUtils.GetSelectedValue(Me.LevelFilter, Me.GetFromSession(Me.LevelFilter)), False, False) + + End If + + + + If IsValueSelected(Me.RankLevelFromFilter) Then + + wc.iAND(View_MaxPersonalEducationView.RankLevel, BaseFilter.ComparisonOperator.EqualsTo, MiscUtils.GetSelectedValue(Me.RankLevelFromFilter, Me.GetFromSession(Me.RankLevelFromFilter)), False, False) + + End If + + + + If IsValueSelected(Me.SectionAbbvrNameFilter) Then + + wc.iAND(View_MaxPersonalEducationView.SectionAbbvrName, BaseFilter.ComparisonOperator.EqualsTo, MiscUtils.GetSelectedValue(Me.SectionAbbvrNameFilter, Me.GetFromSession(Me.SectionAbbvrNameFilter)), False, False) + + End If + + + + If IsValueSelected(Me.View_MaxPersonalEducationSearch1) Then + If Me.View_MaxPersonalEducationSearch1.Text = BaseClasses.Resources.AppResources.GetResourceValue("Txt:SearchForEllipsis", Nothing) Then + Me.View_MaxPersonalEducationSearch1.Text = "" + Else + ' Strip "..." from begin and ending of the search text, otherwise the search will return 0 values as in database "..." is not stored. + + If Me.View_MaxPersonalEducationSearch1.Text.StartsWith("...") Then + Me.View_MaxPersonalEducationSearch1.Text = Me.View_MaxPersonalEducationSearch1.Text.SubString(3,Me.View_MaxPersonalEducationSearch1.Text.Length-3) + End If + If Me.View_MaxPersonalEducationSearch1.Text.EndsWith("...") then + Me.View_MaxPersonalEducationSearch1.Text = Me.View_MaxPersonalEducationSearch1.Text.SubString(0,Me.View_MaxPersonalEducationSearch1.Text.Length-3) + ' Strip the last word as well as it is likely only a partial word + Dim endindex As Integer = View_MaxPersonalEducationSearch1.Text.Length - 1 + While (Not Char.IsWhiteSpace(View_MaxPersonalEducationSearch1.Text(endindex)) AndAlso endindex > 0) + endindex -= 1 + End While + If endindex > 0 Then + View_MaxPersonalEducationSearch1.Text = View_MaxPersonalEducationSearch1.Text.Substring(0, endindex) + End If + End If + End If + + Dim formatedSearchText As String = MiscUtils.GetSelectedValue(Me.View_MaxPersonalEducationSearch1, Me.GetFromSession(Me.View_MaxPersonalEducationSearch1)) + + ' After stripping "..." see if the search text is null or empty. + If IsValueSelected(Me.View_MaxPersonalEducationSearch1) Then + ' These clauses are added depending on operator and fields selected in Control's property page, bindings tab. + + Dim search As WhereClause = New WhereClause() + + search.iOR(View_MaxPersonalEducationView.Course, BaseFilter.ComparisonOperator.Contains, MiscUtils.GetSelectedValue(Me.View_MaxPersonalEducationSearch1, Me.GetFromSession(Me.View_MaxPersonalEducationSearch1)), True, False) + + search.iOR(View_MaxPersonalEducationView.CourseAbbr, BaseFilter.ComparisonOperator.Contains, MiscUtils.GetSelectedValue(Me.View_MaxPersonalEducationSearch1, Me.GetFromSession(Me.View_MaxPersonalEducationSearch1)), True, False) + + search.iOR(View_MaxPersonalEducationView.Facultry, BaseFilter.ComparisonOperator.Contains, MiscUtils.GetSelectedValue(Me.View_MaxPersonalEducationSearch1, Me.GetFromSession(Me.View_MaxPersonalEducationSearch1)), True, False) + + wc.iAND(search) + + End If + End If + + Return wc + End Function + + + Public Overridable Function CreateWhereClause(ByVal searchText as String, ByVal fromSearchControl as String, ByVal AutoTypeAheadSearch as String, ByVal AutoTypeAheadWordSeparators as String) As WhereClause + ' This CreateWhereClause is used for loading list of suggestions for Auto Type-Ahead feature. + View_MaxPersonalEducationView.Instance.InnerFilter = Nothing + Dim wc As WhereClause = New WhereClause() + + ' Compose the WHERE clause consiting of: + ' 1. Static clause defined at design time. + ' 2. User selected search criteria. + ' 3. User selected filter criteria. + + Dim appRelativeVirtualPath As String = CType(HttpContext.Current.Session("AppRelativeVirtualPath"), String) + + ' Adds clauses if values are selected in Filter controls which are configured in the page. + + Dim CourseAbbrFilterSelectedValue As String = CType(HttpContext.Current.Session()(HttpContext.Current.Session.SessionID & appRelativeVirtualPath & "CourseAbbrFilter_Ajax"), String) + If IsValueSelected(CourseAbbrFilterSelectedValue) Then + + wc.iAND(View_MaxPersonalEducationView.CourseAbbr, BaseFilter.ComparisonOperator.EqualsTo, CourseAbbrFilterSelectedValue, false, False) + + End If + + Dim FacultryFilterSelectedValue As String = CType(HttpContext.Current.Session()(HttpContext.Current.Session.SessionID & appRelativeVirtualPath & "FacultryFilter_Ajax"), String) + If IsValueSelected(FacultryFilterSelectedValue) Then + + wc.iAND(View_MaxPersonalEducationView.Facultry, BaseFilter.ComparisonOperator.EqualsTo, FacultryFilterSelectedValue, false, False) + + End If + + Dim LevelFilterSelectedValue As String = CType(HttpContext.Current.Session()(HttpContext.Current.Session.SessionID & appRelativeVirtualPath & "LevelFilter_Ajax"), String) + If IsValueSelected(LevelFilterSelectedValue) Then + + wc.iAND(View_MaxPersonalEducationView.Level, BaseFilter.ComparisonOperator.EqualsTo, LevelFilterSelectedValue, false, False) + + End If + + Dim RankLevelFromFilterSelectedValue As String = CType(HttpContext.Current.Session()(HttpContext.Current.Session.SessionID & appRelativeVirtualPath & "RankLevelFromFilter_Ajax"), String) + If IsValueSelected(RankLevelFromFilterSelectedValue) Then + + wc.iAND(View_MaxPersonalEducationView.RankLevel, BaseFilter.ComparisonOperator.EqualsTo, RankLevelFromFilterSelectedValue, false, False) + + End If + + Dim SectionAbbvrNameFilterSelectedValue As String = CType(HttpContext.Current.Session()(HttpContext.Current.Session.SessionID & appRelativeVirtualPath & "SectionAbbvrNameFilter_Ajax"), String) + If IsValueSelected(SectionAbbvrNameFilterSelectedValue) Then + + wc.iAND(View_MaxPersonalEducationView.SectionAbbvrName, BaseFilter.ComparisonOperator.EqualsTo, SectionAbbvrNameFilterSelectedValue, false, False) + + End If + + If IsValueSelected(searchText) and fromSearchControl = "View_MaxPersonalEducationSearch1" Then + Dim formatedSearchText as String = searchText + ' Strip "..." from begin and ending of the search text, otherwise the search will return 0 values as in database "..." is not stored. + If searchText.StartsWith("...") Then + formatedSearchText = searchText.SubString(3,searchText.Length-3) + End If + If searchText.EndsWith("...") Then + formatedSearchText = searchText.SubString(0,searchText.Length-3) + ' Strip the last word as well as it is likely only a partial word + Dim endindex As Integer = searchText.Length - 1 + While (Not Char.IsWhiteSpace(searchText(endindex)) AndAlso endindex > 0) + endindex -= 1 + End While + If endindex > 0 Then + searchText = searchText.Substring(0, endindex) + End If + End If + 'After stripping "...", trim any leading and trailing whitespaces + formatedSearchText = formatedSearchText.Trim() + ' After stripping "..." see if the search text is null or empty. + If IsValueSelected(formatedSearchText) Then + ' These clauses are added depending on operator and fields selected in Control's property page, bindings tab. + + Dim search As WhereClause = New WhereClause() + + If InvariantLCase(AutoTypeAheadSearch).equals("wordsstartingwithsearchstring") Then + + search.iOR(View_MaxPersonalEducationView.Course, BaseFilter.ComparisonOperator.Starts_With, formatedSearchText, True, False) + search.iOR(View_MaxPersonalEducationView.Course, BaseFilter.ComparisonOperator.Contains, AutoTypeAheadWordSeparators & formatedSearchText, True, False) + + search.iOR(View_MaxPersonalEducationView.CourseAbbr, BaseFilter.ComparisonOperator.Starts_With, formatedSearchText, True, False) + search.iOR(View_MaxPersonalEducationView.CourseAbbr, BaseFilter.ComparisonOperator.Contains, AutoTypeAheadWordSeparators & formatedSearchText, True, False) + + search.iOR(View_MaxPersonalEducationView.Facultry, BaseFilter.ComparisonOperator.Starts_With, formatedSearchText, True, False) + search.iOR(View_MaxPersonalEducationView.Facultry, BaseFilter.ComparisonOperator.Contains, AutoTypeAheadWordSeparators & formatedSearchText, True, False) + + Else + + search.iOR(View_MaxPersonalEducationView.Course, BaseFilter.ComparisonOperator.Contains, formatedSearchText, True, False) + search.iOR(View_MaxPersonalEducationView.CourseAbbr, BaseFilter.ComparisonOperator.Contains, formatedSearchText, True, False) + search.iOR(View_MaxPersonalEducationView.Facultry, BaseFilter.ComparisonOperator.Contains, formatedSearchText, True, False) + End If + wc.iAND(search) + + End If + End If + + + Return wc + End Function + + Public Overridable Function GetAutoCompletionList_View_MaxPersonalEducationSearch1(ByVal prefixText As String, ByVal count As Integer) As String() + Dim resultList As ArrayList = New ArrayList + Dim wordList As ArrayList = New ArrayList + Dim iteration As Integer = 0 + + Dim filterJoin As CompoundFilter = CreateCompoundJoinFilter() + Dim wc As WhereClause = CreateWhereClause(prefixText,"View_MaxPersonalEducationSearch1", "WordsStartingWithSearchString", "[^a-zA-Z0-9]") + While (resultList.Count < count AndAlso iteration < 5) + ' Fetch 100 records in each iteration + Dim recordList () As Persons.Business.View_MaxPersonalEducationRecord = View_MaxPersonalEducationView.GetRecords(filterJoin, wc, Nothing, iteration, 100) + Dim rec As View_MaxPersonalEducationRecord = Nothing + Dim resultItem As String = "" + For Each rec In recordList + ' Exit the loop if recordList count has reached AutoTypeAheadListSize. + If resultList.Count >= count then + Exit For + End If + ' If the field is configured to Display as Foreign key, Format() method returns the + ' Display as Forien Key value instead of original field value. + ' Since search had to be done in multiple fields (selected in Control's page property, binding tab) in a record, + ' We need to find relevent field to display which matches the prefixText and is not already present in the result list. + + resultItem = rec.Format(View_MaxPersonalEducationView.Course) + If resultItem IsNot Nothing AndAlso resultItem.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture).Contains(prefixText.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture)) Then + + Dim isAdded As Boolean = FormatSuggestions(prefixText, resultItem, 50, "AtBeginningOfMatchedString", "WordsStartingWithSearchString", "[^a-zA-Z0-9]", resultList) + If isAdded Then + Continue For + End If + End If + + resultItem = rec.Format(View_MaxPersonalEducationView.CourseAbbr) + If resultItem IsNot Nothing AndAlso resultItem.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture).Contains(prefixText.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture)) Then + + Dim isAdded As Boolean = FormatSuggestions(prefixText, resultItem, 50, "AtBeginningOfMatchedString", "WordsStartingWithSearchString", "[^a-zA-Z0-9]", resultList) + If isAdded Then + Continue For + End If + End If + + resultItem = rec.Format(View_MaxPersonalEducationView.Facultry) + If resultItem IsNot Nothing AndAlso resultItem.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture).Contains(prefixText.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture)) Then + + Dim isAdded As Boolean = FormatSuggestions(prefixText, resultItem, 50, "AtBeginningOfMatchedString", "WordsStartingWithSearchString", "[^a-zA-Z0-9]", resultList) + If isAdded Then + Continue For + End If + End If + + Next + ' Exit the loop if number of records found is less as further iteration will not return any more records + If recordList .Length < 100 Then + Exit While + End If + iteration += 1 + End While + + resultList.Sort() + Dim result() As String = New String(resultList.Count - 1) {} + Array.Copy(resultList.ToArray, result, resultList.Count) + Return result + End Function + + + Public Overridable Function FormatSuggestions(ByVal prefixText As String, ByVal resultItem As String, _ + ByVal columnLength As Integer, ByVal AutoTypeAheadDisplayFoundText As String, _ + ByVal autoTypeAheadSearch As String, ByVal AutoTypeAheadWordSeparators As String, _ + ByVal resultList As ArrayList) As Boolean + + 'Formats the resultItem and adds it to the list of suggestions. + Dim index As Integer = resultItem.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture).IndexOf(prefixText.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture)) + Dim itemToAdd As String = "" + Dim isFound As Boolean = False + Dim isAdded As Boolean = False + ' Get the index where prfixt is at the beginning of resultItem. If not found then, index of word which begins with prefixText. + If InvariantLCase(autoTypeAheadSearch).equals("wordsstartingwithsearchstring") And Not index = 0 Then + ' Expression to find word which contains AutoTypeAheadWordSeparators followed by prefixText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex( AutoTypeAheadWordSeparators + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + If regex1.IsMatch(resultItem) Then + index = regex1.Match(resultItem).Index + isFound = True + End If + ' If the prefixText is found immediatly after white space then starting of the word is found so don not search any further + If not resultItem(index).ToString() = " " Then + ' Expression to find beginning of the word which contains AutoTypeAheadWordSeparators followed by prefixText + Dim regex As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\\S*" + AutoTypeAheadWordSeparators + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + If regex.IsMatch(resultItem) Then + index = regex.Match(resultItem).Index + isFound = True + End If + End If + End If + + ' If autoTypeAheadSearch value is wordsstartingwithsearchstring then, extract the substring only if the prefixText is found at the + ' beginning of the resultItem (index = 0) or a word in resultItem is found starts with prefixText. + If index = 0 Or isFound Or InvariantLCase(autoTypeAheadSearch).Equals("anywhereinstring") then + If InvariantLCase(AutoTypeAheadDisplayFoundText).equals("atbeginningofmatchedstring") Then + ' Expression to find beginning of the word which contains prefixText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\\S*" + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + ' Find the beginning of the word which contains prefexText + If (StringUtils.InvariantLCase(autoTypeAheadSearch).Equals("anywhereinstring") AndAlso regex1.IsMatch(resultItem)) Then + index = regex1.Match(resultItem).Index + isFound = True + End If + ' Display string from the index till end of the string if sub string from index till end is less than columnLength value. + If Len(resultItem) - index <= columnLength Then + If index = 0 Then + itemToAdd = resultItem + Else + itemToAdd = "..." & resultItem.Substring(index, Len(resultItem) - index) + End If + Else + If index = 0 Then + itemToAdd = resultItem.Substring(index, (columnLength - 3)) & "..." + Else + 'Truncate the string to show only columnLength - 6 characters as begining and trailing "..." has to be appended. + itemToAdd = "..." & resultItem.Substring(index , columnLength - 6) & "..." + End If + End If + ElseIf InvariantLCase(AutoTypeAheadDisplayFoundText).equals("inmiddleofmatchedstring") Then + Dim subStringBeginIndex As Integer = CType(columnLength/2, Integer) + If Len(resultItem) <= columnLength Then + itemToAdd = resultItem + Else + ' Sanity check at end of the string + If index + Len(prefixText) = columnLength Then + itemToAdd = "..." & resultItem.Substring(index-columnLength,index) + ElseIf Len(resultItem) - index < subStringBeginIndex Then + ' Display string from the end till columnLength value if, index is closer to the end of the string. + itemToAdd = "..." & resultItem.Substring(Len(resultItem)-columnLength,Len(resultItem)) + ElseIf index <= subStringBeginIndex Then + ' Sanity chet at beginning of the string + itemToAdd = resultItem.Substring(0, columnLength) & "..." + Else + ' Display string containing text before the prefixText occures and text after the prefixText + itemToAdd = "..." & resultItem.Substring(index - subStringBeginIndex, columnLength) & "..." + End If + End If + ElseIf InvariantLCase(AutoTypeAheadDisplayFoundText).equals("atendofmatchedstring") Then + ' Expression to find ending of the word which contains prefexText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\s", System.Text.RegularExpressions.RegexOptions.IgnoreCase) + ' Find the ending of the word which contains prefexText + If regex1.IsMatch(resultItem, index + 1) Then + index = regex1.Match(resultItem, index + 1).Index + Else + ' If the word which contains prefexText is the last word in string, regex1.IsMatch returns false. + index = resultItem.Length + End If + If index > Len(resultItem) Then + index = Len(resultItem) + End If + ' If text from beginning of the string till index is less than columnLength value then, display string from the beginning till index. + If index <= columnLength Then + if index = Len(resultItem) Then 'Make decision to append "..." + itemToAdd = resultItem.Substring(0,index) + Else + itemToAdd = resultItem.Substring(0,index) & "..." + End If + Else + If index = Len(resultItem) Then + itemToAdd = "..." & resultItem.Substring(index - (columnLength - 3), (columnLength - 3)) + Else + 'Truncate the string to show only columnLength - 6 characters as begining and trailing "..." has to be appended. + itemToAdd = "..." & resultItem.Substring(index - (columnLength - 6), columnLength - 6) & "..." + End If + End If + End If + + ' Remove newline character from itemToAdd + Dim prefixTextIndex As Integer = itemToAdd.IndexOf(prefixText, StringComparison.CurrentCultureIgnoreCase) + ' If itemToAdd contains any newline after the search text then show text only till newline + Dim regex2 As System.Text.RegularExpressions.Regex = New System.Text.RegularExpressions.Regex("(" & vbCrLf & "|" & vbLf & ")", System.Text.RegularExpressions.RegexOptions.IgnoreCase) + Dim newLineIndexAfterPrefix As Integer = -1 + If regex2.IsMatch(itemToAdd, prefixTextIndex) Then + newLineIndexAfterPrefix = regex2.Match(itemToAdd, prefixTextIndex).Index + End If + If (newLineIndexAfterPrefix > -1) Then + If itemToAdd.EndsWith("...") Then + itemToAdd = (itemToAdd.Substring(0, newLineIndexAfterPrefix) + "...") + Else + itemToAdd = itemToAdd.Substring(0, newLineIndexAfterPrefix) + End If + End If + ' If itemToAdd contains any newline before search text then show text which comes after newline + Dim regex3 As System.Text.RegularExpressions.Regex = New System.Text.RegularExpressions.Regex("(" & vbCrLf & "|" & vbLf & ")", (System.Text.RegularExpressions.RegexOptions.IgnoreCase Or System.Text.RegularExpressions.RegexOptions.RightToLeft)) + Dim newLineIndexBeforePrefix As Integer = -1 + If regex3.IsMatch(itemToAdd, prefixTextIndex) Then + newLineIndexBeforePrefix = regex3.Match(itemToAdd, prefixTextIndex).Index + End If + If (newLineIndexBeforePrefix > -1) Then + If itemToAdd.StartsWith("...") Then + itemToAdd = ("..." + itemToAdd.Substring((newLineIndexBeforePrefix + regex3.Match(itemToAdd, prefixTextIndex).Length))) + Else + itemToAdd = itemToAdd.Substring((newLineIndexBeforePrefix + regex3.Match(itemToAdd, prefixTextIndex).Length)) + End If + End If + + If Not itemToAdd is nothing AndAlso Not resultList.Contains(itemToAdd) Then + + resultList.Add(itemToAdd) + + isAdded = true + End If + End If + Return isAdded + End Function + + + Protected Overridable Sub GetPageSize() + + If Me.View_MaxPersonalEducationPagination.PageSize.Text.Trim <> "" Then + Try + 'Me.PageSize = Integer.Parse(Me.View_MaxPersonalEducationPagination.PageSize.Text) + Catch ex As Exception + End Try + End If + End Sub + + Protected Overridable Sub AddNewRecords() + + Dim newRecordList As ArrayList = New ArrayList() + + Dim newUIDataList As System.Collections.Generic.List(Of Hashtable) = New System.Collections.Generic.List(Of Hashtable)() + + ' Loop though all the record controls and if the record control + ' does not have a unique record id set, then create a record + ' and add to the list. + If Not Me.ResetData Then + Dim rep As System.Web.UI.WebControls.Repeater = CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "View_MaxPersonalEducationTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return + + Dim repItem As System.Web.UI.WebControls.RepeaterItem + For Each repItem In rep.Items + ' Loop through all rows in the table, set its DataSource and call DataBind(). + + Dim recControl As View_MaxPersonalEducationTableControlRow = DirectCast(repItem.FindControl("View_MaxPersonalEducationTableControlRow"), View_MaxPersonalEducationTableControlRow) + + If recControl.Visible AndAlso recControl.IsNewRecord() Then + + Dim rec As View_MaxPersonalEducationRecord = New View_MaxPersonalEducationRecord() + + If recControl.Country.Text <> "" Then + rec.Parse(recControl.Country.Text, View_MaxPersonalEducationView.Country) + End If + If recControl.Course.Text <> "" Then + rec.Parse(recControl.Course.Text, View_MaxPersonalEducationView.Course) + End If + If recControl.CourseAbbr.Text <> "" Then + rec.Parse(recControl.CourseAbbr.Text, View_MaxPersonalEducationView.CourseAbbr) + End If + If recControl.EdYear.Text <> "" Then + rec.Parse(recControl.EdYear.Text, View_MaxPersonalEducationView.EdYear) + End If + If recControl.Facultry.Text <> "" Then + rec.Parse(recControl.Facultry.Text, View_MaxPersonalEducationView.Facultry) + End If + If recControl.Institue.Text <> "" Then + rec.Parse(recControl.Institue.Text, View_MaxPersonalEducationView.Institue) + End If + If recControl.Level.Text <> "" Then + rec.Parse(recControl.Level.Text, View_MaxPersonalEducationView.Level) + End If + If recControl.RankAndName.Text <> "" Then + rec.Parse(recControl.RankAndName.Text, View_MaxPersonalEducationView.RankAndName) + End If + If recControl.SectionAbbvrName.Text <> "" Then + rec.Parse(recControl.SectionAbbvrName.Text, View_MaxPersonalEducationView.SectionAbbvrName) + End If + newUIDataList.Add(recControl.PreservedUIData()) + newRecordList.Add(rec) + End If + Next + End If + + + ' Add any new record to the list. + Dim index As Integer = 0 + For index = 1 To Me.AddNewRecord + + newRecordList.Insert(0, New View_MaxPersonalEducationRecord()) + newUIDataList.Insert(0, New Hashtable()) + + Next + Me.AddNewRecord = 0 + + ' Finally, add any new records to the DataSource. + If newRecordList.Count > 0 Then + + Dim finalList As ArrayList = New ArrayList(Me.DataSource) + finalList.InsertRange(0, newRecordList) + + Me.DataSource = DirectCast(finalList.ToArray(GetType(View_MaxPersonalEducationRecord)), View_MaxPersonalEducationRecord()) + + End If + + ' Add the existing UI data to this hash table + If newUIDataList.Count > 0 Then + Me.UIData.InsertRange(0, newUIDataList) + End If + + End Sub + + + Public Sub AddToDeletedRecordIds(ByVal rec As View_MaxPersonalEducationTableControlRow) + If rec.IsNewRecord() Then + Return + End If + + If Not Me.DeletedRecordIds Is Nothing AndAlso Me.DeletedRecordIds.Trim <> "" Then + Me.DeletedRecordIds &= "," + End If + + Me.DeletedRecordIds &= "[" & rec.RecordUniqueId & "]" + End Sub + + Protected Overridable Function InDeletedRecordIds(ByVal rec As View_MaxPersonalEducationTableControlRow) As Boolean + If Me.DeletedRecordIds Is Nothing OrElse Me.DeletedRecordIds.Trim = "" Then + Return False + End If + + Return Me.DeletedRecordIds.IndexOf("[" & rec.RecordUniqueId & "]") >= 0 + End Function + + Private _DeletedRecordIds As String + Public Property DeletedRecordIds() As String + Get + Return Me._DeletedRecordIds + End Get + Set(ByVal value As String) + Me._DeletedRecordIds = value + End Set + End Property + + + ' Create Set, WhereClause, and Populate Methods + + Public Overridable Sub SetCountryLabel() + + End Sub + + Public Overridable Sub SetCourseAbbrLabel() + + End Sub + + Public Overridable Sub SetCourseAbbrLabel1() + + End Sub + + Public Overridable Sub SetCourseLabel() + + End Sub + + Public Overridable Sub SetEdYearLabel() + + End Sub + + Public Overridable Sub SetFacultryLabel() + + End Sub + + Public Overridable Sub SetFacultryLabel1() + + End Sub + + Public Overridable Sub SetInstitueLabel() + + End Sub + + Public Overridable Sub SetLevelLabel() + + End Sub + + Public Overridable Sub SetLevelLabel1() + + End Sub + + Public Overridable Sub SetPersonalNameLabel() + + End Sub + + Public Overridable Sub SetRankLevelLabel() + + End Sub + + Public Overridable Sub SetSectionAbbvrNameLabel() + + End Sub + + Public Overridable Sub SetSectionAbbvrNameLabel1() + + End Sub + + Public Overridable Sub SetView_MaxPersonalEducationTableControlCollapsibleRegion() + + End Sub + + Public Overridable Sub SetView_MaxPersonalEducationTableControlIcon() + + End Sub + + Public Overridable Sub SetView_MaxPersonalEducationTableControlPanelExtender() + + End Sub + + Public Overridable Sub SetCourseAbbrFilter() + + Me.PopulateCourseAbbrFilter(GetSelectedValue(Me.CourseAbbrFilter, GetFromSession(Me.CourseAbbrFilter)), 500) + + End Sub + + Public Overridable Sub SetFacultryFilter() + + Me.PopulateFacultryFilter(GetSelectedValue(Me.FacultryFilter, GetFromSession(Me.FacultryFilter)), 500) + + End Sub + + Public Overridable Sub SetLevelFilter() + + Me.PopulateLevelFilter(GetSelectedValue(Me.LevelFilter, GetFromSession(Me.LevelFilter)), 500) + + End Sub + + Public Overridable Sub SetRankLevelFromFilter() + + Me.PopulateRankLevelFromFilter(GetSelectedValue(Me.RankLevelFromFilter, GetFromSession(Me.RankLevelFromFilter)), 500) + + End Sub + + Public Overridable Sub SetSectionAbbvrNameFilter() + + Me.PopulateSectionAbbvrNameFilter(GetSelectedValue(Me.SectionAbbvrNameFilter, GetFromSession(Me.SectionAbbvrNameFilter)), 500) + + End Sub + + Public Overridable Sub SetView_MaxPersonalEducationSearch1() + + End Sub + + ' Get the filters' data for CourseAbbrFilter + Protected Overridable Sub PopulateCourseAbbrFilter(ByVal selectedValue As String, ByVal maxItems As Integer) + + + Me.CourseAbbrFilter.Items.Clear() + + + + ' Set up the WHERE and the ORDER BY clause by calling the CreateWhereClause_CourseAbbrFilter function. + ' It is better to customize the where clause there. + + ' Setup the WHERE clause, including the base table if needed. + + Dim wc As WhereClause = Me.CreateWhereClause_CourseAbbrFilter() + + ' Setup the static list items + + ' Add the All item. + Me.CourseAbbrFilter.Items.Insert(0, new ListItem(Me.Page.GetResourceValue("Txt:All", "Persons"), "--ANY--")) + + + + Dim orderBy As OrderBy = New OrderBy(False, False) + orderBy.Add(View_MaxPersonalEducationView.CourseAbbr, OrderByItem.OrderDir.Asc) + + + Dim joinFilter As CompoundFilter = CreateCompoundJoinFilter() + Dim values() As String = View_MaxPersonalEducationView.GetValues(View_MaxPersonalEducationView.CourseAbbr, joinFilter, wc, orderBy, maxItems) + + Dim cvalue As String + + Dim listDuplicates As New ArrayList() + For Each cvalue In values + ' Create the item and add to the list. + Dim fvalue As String + + If ( View_MaxPersonalEducationView.CourseAbbr.IsColumnValueTypeBoolean()) Then + fvalue = cvalue + Else + fvalue = View_MaxPersonalEducationView.CourseAbbr.Format(cvalue) + End If + + 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.CourseAbbrFilter.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.CourseAbbrFilter.Items.Add(newItem) + + If listDuplicates.Contains(fvalue) Then + newItem.Text = fvalue & " (ID " & cvalue.Substring(0, Math.Min(cvalue.Length,38)) & ")" + End If + + Next + + + + ' Set the selected value. + SetSelectedValue(Me.CourseAbbrFilter, selectedValue) + + + End Sub + + ' Get the filters' data for FacultryFilter + Protected Overridable Sub PopulateFacultryFilter(ByVal selectedValue As String, ByVal maxItems As Integer) + + + Me.FacultryFilter.Items.Clear() + + + + ' Set up the WHERE and the ORDER BY clause by calling the CreateWhereClause_FacultryFilter function. + ' It is better to customize the where clause there. + + ' Setup the WHERE clause, including the base table if needed. + + Dim wc As WhereClause = Me.CreateWhereClause_FacultryFilter() + + ' Setup the static list items + + ' Add the All item. + Me.FacultryFilter.Items.Insert(0, new ListItem(Me.Page.GetResourceValue("Txt:All", "Persons"), "--ANY--")) + + + + Dim orderBy As OrderBy = New OrderBy(False, False) + orderBy.Add(View_MaxPersonalEducationView.Facultry, OrderByItem.OrderDir.Asc) + + + Dim joinFilter As CompoundFilter = CreateCompoundJoinFilter() + Dim values() As String = View_MaxPersonalEducationView.GetValues(View_MaxPersonalEducationView.Facultry, joinFilter, wc, orderBy, maxItems) + + Dim cvalue As String + + Dim listDuplicates As New ArrayList() + For Each cvalue In values + ' Create the item and add to the list. + Dim fvalue As String + + If ( View_MaxPersonalEducationView.Facultry.IsColumnValueTypeBoolean()) Then + fvalue = cvalue + Else + fvalue = View_MaxPersonalEducationView.Facultry.Format(cvalue) + End If + + 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.FacultryFilter.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.FacultryFilter.Items.Add(newItem) + + If listDuplicates.Contains(fvalue) Then + newItem.Text = fvalue & " (ID " & cvalue.Substring(0, Math.Min(cvalue.Length,38)) & ")" + End If + + Next + + + + ' Set the selected value. + SetSelectedValue(Me.FacultryFilter, selectedValue) + + + End Sub + + ' Get the filters' data for LevelFilter + Protected Overridable Sub PopulateLevelFilter(ByVal selectedValue As String, ByVal maxItems As Integer) + + + Me.LevelFilter.Items.Clear() + + + + ' Set up the WHERE and the ORDER BY clause by calling the CreateWhereClause_LevelFilter function. + ' It is better to customize the where clause there. + + ' Setup the WHERE clause, including the base table if needed. + + Dim wc As WhereClause = Me.CreateWhereClause_LevelFilter() + + ' Setup the static list items + + ' Add the All item. + Me.LevelFilter.Items.Insert(0, new ListItem(Me.Page.GetResourceValue("Txt:All", "Persons"), "--ANY--")) + + + + Dim orderBy As OrderBy = New OrderBy(False, False) + orderBy.Add(View_MaxPersonalEducationView.Level, OrderByItem.OrderDir.Asc) + + + Dim joinFilter As CompoundFilter = CreateCompoundJoinFilter() + Dim values() As String = View_MaxPersonalEducationView.GetValues(View_MaxPersonalEducationView.Level, joinFilter, wc, orderBy, maxItems) + + Dim cvalue As String + + Dim listDuplicates As New ArrayList() + For Each cvalue In values + ' Create the item and add to the list. + Dim fvalue As String + + If ( View_MaxPersonalEducationView.Level.IsColumnValueTypeBoolean()) Then + fvalue = cvalue + Else + fvalue = View_MaxPersonalEducationView.Level.Format(cvalue) + End If + + 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.LevelFilter.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.LevelFilter.Items.Add(newItem) + + If listDuplicates.Contains(fvalue) Then + newItem.Text = fvalue & " (ID " & cvalue.Substring(0, Math.Min(cvalue.Length,38)) & ")" + End If + + Next + + + + ' Set the selected value. + SetSelectedValue(Me.LevelFilter, selectedValue) + + + End Sub + + ' Get the filters' data for RankLevelFromFilter + Protected Overridable Sub PopulateRankLevelFromFilter(ByVal selectedValue As String, ByVal maxItems As Integer) + + + Me.RankLevelFromFilter.Items.Clear() + + + + ' Set up the WHERE and the ORDER BY clause by calling the CreateWhereClause_RankLevelFromFilter function. + ' It is better to customize the where clause there. + + ' Setup the WHERE clause, including the base table if needed. + + Dim wc As WhereClause = Me.CreateWhereClause_RankLevelFromFilter() + + ' Setup the static list items + + ' Add the All item. + Me.RankLevelFromFilter.Items.Insert(0, new ListItem(Me.Page.GetResourceValue("Txt:All", "Persons"), "--ANY--")) + + + + Dim orderBy As OrderBy = New OrderBy(False, False) + orderBy.Add(View_MaxPersonalEducationView.RankLevel, OrderByItem.OrderDir.Asc) + + + Dim joinFilter As CompoundFilter = CreateCompoundJoinFilter() + Dim values() As String = View_MaxPersonalEducationView.GetValues(View_MaxPersonalEducationView.RankLevel, joinFilter, wc, orderBy, maxItems) + + Me.Page.PregetDfkaRecords(View_MaxPersonalEducationView.RankLevel, values) + Dim cvalue As String + + Dim itemsList As New System.Web.UI.WebControls.ListItemCollection + Dim listDuplicates As New ArrayList() + For Each cvalue In values + ' Create the item and add to the list. + + Dim fvalue As String = "" + Dim _isExpandableNonCompositeForeignKey As Boolean = View_MaxPersonalEducationView.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(View_MaxPersonalEducationView.RankLevel) + If _isExpandableNonCompositeForeignKey AndAlso View_MaxPersonalEducationView.RankLevel.IsApplyDisplayAs Then + fvalue = View_MaxPersonalEducationView.GetDFKA(cvalue,View_MaxPersonalEducationView.RankLevel,Nothing) + End If + If (Not _isExpandableNonCompositeForeignKey) Or (String.IsNullOrEmpty(fvalue)) Then + fvalue = View_MaxPersonalEducationView.RankLevel.Format(cvalue) + End If + If cvalue IsNot Nothing or fvalue IsNot Nothing + ' store the list item in a collection and sort later + 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.RankLevelFromFilter.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) + RankLevelFromFilter.Items.Add(newItem) + + If listDuplicates.Contains(fvalue) Then + newItem.Text = fvalue & " (ID " & cvalue.Substring(0, Math.Min(cvalue.Length,38)) & ")" + End If + End If + Next + + ' sort the collection and then add to the filter control + RankLevelFromFilter.Items.AddRange(GetSortListItem(itemsList)) + + + + + ' Set the selected value. + SetSelectedValue(Me.RankLevelFromFilter, selectedValue) + + + End Sub + + ' Get the filters' data for SectionAbbvrNameFilter + Protected Overridable Sub PopulateSectionAbbvrNameFilter(ByVal selectedValue As String, ByVal maxItems As Integer) + + + Me.SectionAbbvrNameFilter.Items.Clear() + + + + ' Set up the WHERE and the ORDER BY clause by calling the CreateWhereClause_SectionAbbvrNameFilter function. + ' It is better to customize the where clause there. + + ' Setup the WHERE clause, including the base table if needed. + + Dim wc As WhereClause = Me.CreateWhereClause_SectionAbbvrNameFilter() + + ' Setup the static list items + + ' Add the All item. + Me.SectionAbbvrNameFilter.Items.Insert(0, new ListItem(Me.Page.GetResourceValue("Txt:All", "Persons"), "--ANY--")) + + + + Dim orderBy As OrderBy = New OrderBy(False, False) + orderBy.Add(View_MaxPersonalEducationView.SectionAbbvrName, OrderByItem.OrderDir.Asc) + + + Dim values() As String = View_MaxPersonalEducationView.GetValues(View_MaxPersonalEducationView.SectionAbbvrName, wc, orderBy, maxItems) + + Dim cvalue As String + + Dim listDuplicates As New ArrayList() + For Each cvalue In values + ' Create the item and add to the list. + Dim fvalue As String + + If ( View_MaxPersonalEducationView.SectionAbbvrName.IsColumnValueTypeBoolean()) Then + fvalue = cvalue + Else + fvalue = View_MaxPersonalEducationView.SectionAbbvrName.Format(cvalue) + End If + + 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.SectionAbbvrNameFilter.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.SectionAbbvrNameFilter.Items.Add(newItem) + + If listDuplicates.Contains(fvalue) Then + newItem.Text = fvalue & " (ID " & cvalue.Substring(0, Math.Min(cvalue.Length,38)) & ")" + End If + + Next + + + + ' Set the selected value. + SetSelectedValue(Me.SectionAbbvrNameFilter, selectedValue) + + + End Sub + + Public Overridable Function CreateWhereClause_CourseAbbrFilter() As WhereClause + + ' Create a where clause for the filter CourseAbbrFilter. + ' This function is called by the Populate method to load the items + ' in the CourseAbbrFilterDropDownList + + Dim wc As WhereClause = New WhereClause() + + If IsValueSelected(Me.FacultryFilter) Then + + wc.iAND(View_MaxPersonalEducationView.Facultry, BaseFilter.ComparisonOperator.EqualsTo, MiscUtils.GetSelectedValue(Me.FacultryFilter, Me.GetFromSession(Me.FacultryFilter)), False, False) + + End If + + + + If IsValueSelected(Me.LevelFilter) Then + + wc.iAND(View_MaxPersonalEducationView.Level, BaseFilter.ComparisonOperator.EqualsTo, MiscUtils.GetSelectedValue(Me.LevelFilter, Me.GetFromSession(Me.LevelFilter)), False, False) + + End If + + + + If IsValueSelected(Me.RankLevelFromFilter) Then + + wc.iAND(View_MaxPersonalEducationView.RankLevel, BaseFilter.ComparisonOperator.EqualsTo, MiscUtils.GetSelectedValue(Me.RankLevelFromFilter, Me.GetFromSession(Me.RankLevelFromFilter)), False, False) + + End If + + + + If IsValueSelected(Me.SectionAbbvrNameFilter) Then + + wc.iAND(View_MaxPersonalEducationView.SectionAbbvrName, BaseFilter.ComparisonOperator.EqualsTo, MiscUtils.GetSelectedValue(Me.SectionAbbvrNameFilter, Me.GetFromSession(Me.SectionAbbvrNameFilter)), False, False) + + End If + + + + If IsValueSelected(Me.View_MaxPersonalEducationSearch1) Then + If Me.View_MaxPersonalEducationSearch1.Text = BaseClasses.Resources.AppResources.GetResourceValue("Txt:SearchForEllipsis", Nothing) Then + Me.View_MaxPersonalEducationSearch1.Text = "" + Else + ' Strip "..." from begin and ending of the search text, otherwise the search will return 0 values as in database "..." is not stored. + + If Me.View_MaxPersonalEducationSearch1.Text.StartsWith("...") Then + Me.View_MaxPersonalEducationSearch1.Text = Me.View_MaxPersonalEducationSearch1.Text.SubString(3,Me.View_MaxPersonalEducationSearch1.Text.Length-3) + End If + If Me.View_MaxPersonalEducationSearch1.Text.EndsWith("...") then + Me.View_MaxPersonalEducationSearch1.Text = Me.View_MaxPersonalEducationSearch1.Text.SubString(0,Me.View_MaxPersonalEducationSearch1.Text.Length-3) + ' Strip the last word as well as it is likely only a partial word + Dim endindex As Integer = View_MaxPersonalEducationSearch1.Text.Length - 1 + While (Not Char.IsWhiteSpace(View_MaxPersonalEducationSearch1.Text(endindex)) AndAlso endindex > 0) + endindex -= 1 + End While + If endindex > 0 Then + View_MaxPersonalEducationSearch1.Text = View_MaxPersonalEducationSearch1.Text.Substring(0, endindex) + End If + End If + End If + + Dim formatedSearchText As String = MiscUtils.GetSelectedValue(Me.View_MaxPersonalEducationSearch1, Me.GetFromSession(Me.View_MaxPersonalEducationSearch1)) + + ' After stripping "..." see if the search text is null or empty. + If IsValueSelected(Me.View_MaxPersonalEducationSearch1) Then + ' These clauses are added depending on operator and fields selected in Control's property page, bindings tab. + + Dim search As WhereClause = New WhereClause() + + search.iOR(View_MaxPersonalEducationView.Course, BaseFilter.ComparisonOperator.Contains, MiscUtils.GetSelectedValue(Me.View_MaxPersonalEducationSearch1, Me.GetFromSession(Me.View_MaxPersonalEducationSearch1)), True, False) + + search.iOR(View_MaxPersonalEducationView.CourseAbbr, BaseFilter.ComparisonOperator.Contains, MiscUtils.GetSelectedValue(Me.View_MaxPersonalEducationSearch1, Me.GetFromSession(Me.View_MaxPersonalEducationSearch1)), True, False) + + search.iOR(View_MaxPersonalEducationView.Facultry, BaseFilter.ComparisonOperator.Contains, MiscUtils.GetSelectedValue(Me.View_MaxPersonalEducationSearch1, Me.GetFromSession(Me.View_MaxPersonalEducationSearch1)), True, False) + + wc.iAND(search) + + End If + End If + + Dim wc1 As WhereClause = Me.CreateWhereClause + If wc1.Count > 0 Then + wc.AddFilter(wc1.GetFilter(), CompoundFilter.CompoundingOperators.And_Operator) + End If + + Return wc + End Function + + Public Overridable Function CreateWhereClause_FacultryFilter() As WhereClause + + ' Create a where clause for the filter FacultryFilter. + ' This function is called by the Populate method to load the items + ' in the FacultryFilterDropDownList + + Dim wc As WhereClause = New WhereClause() + + If IsValueSelected(Me.CourseAbbrFilter) Then + + wc.iAND(View_MaxPersonalEducationView.CourseAbbr, BaseFilter.ComparisonOperator.EqualsTo, MiscUtils.GetSelectedValue(Me.CourseAbbrFilter, Me.GetFromSession(Me.CourseAbbrFilter)), False, False) + + End If + + + + If IsValueSelected(Me.LevelFilter) Then + + wc.iAND(View_MaxPersonalEducationView.Level, BaseFilter.ComparisonOperator.EqualsTo, MiscUtils.GetSelectedValue(Me.LevelFilter, Me.GetFromSession(Me.LevelFilter)), False, False) + + End If + + + + If IsValueSelected(Me.RankLevelFromFilter) Then + + wc.iAND(View_MaxPersonalEducationView.RankLevel, BaseFilter.ComparisonOperator.EqualsTo, MiscUtils.GetSelectedValue(Me.RankLevelFromFilter, Me.GetFromSession(Me.RankLevelFromFilter)), False, False) + + End If + + + + If IsValueSelected(Me.SectionAbbvrNameFilter) Then + + wc.iAND(View_MaxPersonalEducationView.SectionAbbvrName, BaseFilter.ComparisonOperator.EqualsTo, MiscUtils.GetSelectedValue(Me.SectionAbbvrNameFilter, Me.GetFromSession(Me.SectionAbbvrNameFilter)), False, False) + + End If + + + + If IsValueSelected(Me.View_MaxPersonalEducationSearch1) Then + If Me.View_MaxPersonalEducationSearch1.Text = BaseClasses.Resources.AppResources.GetResourceValue("Txt:SearchForEllipsis", Nothing) Then + Me.View_MaxPersonalEducationSearch1.Text = "" + Else + ' Strip "..." from begin and ending of the search text, otherwise the search will return 0 values as in database "..." is not stored. + + If Me.View_MaxPersonalEducationSearch1.Text.StartsWith("...") Then + Me.View_MaxPersonalEducationSearch1.Text = Me.View_MaxPersonalEducationSearch1.Text.SubString(3,Me.View_MaxPersonalEducationSearch1.Text.Length-3) + End If + If Me.View_MaxPersonalEducationSearch1.Text.EndsWith("...") then + Me.View_MaxPersonalEducationSearch1.Text = Me.View_MaxPersonalEducationSearch1.Text.SubString(0,Me.View_MaxPersonalEducationSearch1.Text.Length-3) + ' Strip the last word as well as it is likely only a partial word + Dim endindex As Integer = View_MaxPersonalEducationSearch1.Text.Length - 1 + While (Not Char.IsWhiteSpace(View_MaxPersonalEducationSearch1.Text(endindex)) AndAlso endindex > 0) + endindex -= 1 + End While + If endindex > 0 Then + View_MaxPersonalEducationSearch1.Text = View_MaxPersonalEducationSearch1.Text.Substring(0, endindex) + End If + End If + End If + + Dim formatedSearchText As String = MiscUtils.GetSelectedValue(Me.View_MaxPersonalEducationSearch1, Me.GetFromSession(Me.View_MaxPersonalEducationSearch1)) + + ' After stripping "..." see if the search text is null or empty. + If IsValueSelected(Me.View_MaxPersonalEducationSearch1) Then + ' These clauses are added depending on operator and fields selected in Control's property page, bindings tab. + + Dim search As WhereClause = New WhereClause() + + search.iOR(View_MaxPersonalEducationView.Course, BaseFilter.ComparisonOperator.Contains, MiscUtils.GetSelectedValue(Me.View_MaxPersonalEducationSearch1, Me.GetFromSession(Me.View_MaxPersonalEducationSearch1)), True, False) + + search.iOR(View_MaxPersonalEducationView.CourseAbbr, BaseFilter.ComparisonOperator.Contains, MiscUtils.GetSelectedValue(Me.View_MaxPersonalEducationSearch1, Me.GetFromSession(Me.View_MaxPersonalEducationSearch1)), True, False) + + search.iOR(View_MaxPersonalEducationView.Facultry, BaseFilter.ComparisonOperator.Contains, MiscUtils.GetSelectedValue(Me.View_MaxPersonalEducationSearch1, Me.GetFromSession(Me.View_MaxPersonalEducationSearch1)), True, False) + + wc.iAND(search) + + End If + End If + + Dim wc1 As WhereClause = Me.CreateWhereClause + If wc1.Count > 0 Then + wc.AddFilter(wc1.GetFilter(), CompoundFilter.CompoundingOperators.And_Operator) + End If + + Return wc + End Function + + Public Overridable Function CreateWhereClause_LevelFilter() As WhereClause + + ' Create a where clause for the filter LevelFilter. + ' This function is called by the Populate method to load the items + ' in the LevelFilterDropDownList + + Dim wc As WhereClause = New WhereClause() + + If IsValueSelected(Me.CourseAbbrFilter) Then + + wc.iAND(View_MaxPersonalEducationView.CourseAbbr, BaseFilter.ComparisonOperator.EqualsTo, MiscUtils.GetSelectedValue(Me.CourseAbbrFilter, Me.GetFromSession(Me.CourseAbbrFilter)), False, False) + + End If + + + + If IsValueSelected(Me.FacultryFilter) Then + + wc.iAND(View_MaxPersonalEducationView.Facultry, BaseFilter.ComparisonOperator.EqualsTo, MiscUtils.GetSelectedValue(Me.FacultryFilter, Me.GetFromSession(Me.FacultryFilter)), False, False) + + End If + + + + If IsValueSelected(Me.RankLevelFromFilter) Then + + wc.iAND(View_MaxPersonalEducationView.RankLevel, BaseFilter.ComparisonOperator.EqualsTo, MiscUtils.GetSelectedValue(Me.RankLevelFromFilter, Me.GetFromSession(Me.RankLevelFromFilter)), False, False) + + End If + + + + If IsValueSelected(Me.SectionAbbvrNameFilter) Then + + wc.iAND(View_MaxPersonalEducationView.SectionAbbvrName, BaseFilter.ComparisonOperator.EqualsTo, MiscUtils.GetSelectedValue(Me.SectionAbbvrNameFilter, Me.GetFromSession(Me.SectionAbbvrNameFilter)), False, False) + + End If + + + + If IsValueSelected(Me.View_MaxPersonalEducationSearch1) Then + If Me.View_MaxPersonalEducationSearch1.Text = BaseClasses.Resources.AppResources.GetResourceValue("Txt:SearchForEllipsis", Nothing) Then + Me.View_MaxPersonalEducationSearch1.Text = "" + Else + ' Strip "..." from begin and ending of the search text, otherwise the search will return 0 values as in database "..." is not stored. + + If Me.View_MaxPersonalEducationSearch1.Text.StartsWith("...") Then + Me.View_MaxPersonalEducationSearch1.Text = Me.View_MaxPersonalEducationSearch1.Text.SubString(3,Me.View_MaxPersonalEducationSearch1.Text.Length-3) + End If + If Me.View_MaxPersonalEducationSearch1.Text.EndsWith("...") then + Me.View_MaxPersonalEducationSearch1.Text = Me.View_MaxPersonalEducationSearch1.Text.SubString(0,Me.View_MaxPersonalEducationSearch1.Text.Length-3) + ' Strip the last word as well as it is likely only a partial word + Dim endindex As Integer = View_MaxPersonalEducationSearch1.Text.Length - 1 + While (Not Char.IsWhiteSpace(View_MaxPersonalEducationSearch1.Text(endindex)) AndAlso endindex > 0) + endindex -= 1 + End While + If endindex > 0 Then + View_MaxPersonalEducationSearch1.Text = View_MaxPersonalEducationSearch1.Text.Substring(0, endindex) + End If + End If + End If + + Dim formatedSearchText As String = MiscUtils.GetSelectedValue(Me.View_MaxPersonalEducationSearch1, Me.GetFromSession(Me.View_MaxPersonalEducationSearch1)) + + ' After stripping "..." see if the search text is null or empty. + If IsValueSelected(Me.View_MaxPersonalEducationSearch1) Then + ' These clauses are added depending on operator and fields selected in Control's property page, bindings tab. + + Dim search As WhereClause = New WhereClause() + + search.iOR(View_MaxPersonalEducationView.Course, BaseFilter.ComparisonOperator.Contains, MiscUtils.GetSelectedValue(Me.View_MaxPersonalEducationSearch1, Me.GetFromSession(Me.View_MaxPersonalEducationSearch1)), True, False) + + search.iOR(View_MaxPersonalEducationView.CourseAbbr, BaseFilter.ComparisonOperator.Contains, MiscUtils.GetSelectedValue(Me.View_MaxPersonalEducationSearch1, Me.GetFromSession(Me.View_MaxPersonalEducationSearch1)), True, False) + + search.iOR(View_MaxPersonalEducationView.Facultry, BaseFilter.ComparisonOperator.Contains, MiscUtils.GetSelectedValue(Me.View_MaxPersonalEducationSearch1, Me.GetFromSession(Me.View_MaxPersonalEducationSearch1)), True, False) + + wc.iAND(search) + + End If + End If + + Dim wc1 As WhereClause = Me.CreateWhereClause + If wc1.Count > 0 Then + wc.AddFilter(wc1.GetFilter(), CompoundFilter.CompoundingOperators.And_Operator) + End If + + Return wc + End Function + + Public Overridable Function CreateWhereClause_RankLevelFromFilter() As WhereClause + + ' Create a where clause for the filter RankLevelFromFilter. + ' This function is called by the Populate method to load the items + ' in the RankLevelFromFilterDropDownList + + Dim wc As WhereClause = New WhereClause() + + If IsValueSelected(Me.CourseAbbrFilter) Then + + wc.iAND(View_MaxPersonalEducationView.CourseAbbr, BaseFilter.ComparisonOperator.EqualsTo, MiscUtils.GetSelectedValue(Me.CourseAbbrFilter, Me.GetFromSession(Me.CourseAbbrFilter)), False, False) + + End If + + + + If IsValueSelected(Me.FacultryFilter) Then + + wc.iAND(View_MaxPersonalEducationView.Facultry, BaseFilter.ComparisonOperator.EqualsTo, MiscUtils.GetSelectedValue(Me.FacultryFilter, Me.GetFromSession(Me.FacultryFilter)), False, False) + + End If + + + + If IsValueSelected(Me.LevelFilter) Then + + wc.iAND(View_MaxPersonalEducationView.Level, BaseFilter.ComparisonOperator.EqualsTo, MiscUtils.GetSelectedValue(Me.LevelFilter, Me.GetFromSession(Me.LevelFilter)), False, False) + + End If + + + + If IsValueSelected(Me.SectionAbbvrNameFilter) Then + + wc.iAND(View_MaxPersonalEducationView.SectionAbbvrName, BaseFilter.ComparisonOperator.EqualsTo, MiscUtils.GetSelectedValue(Me.SectionAbbvrNameFilter, Me.GetFromSession(Me.SectionAbbvrNameFilter)), False, False) + + End If + + + + If IsValueSelected(Me.View_MaxPersonalEducationSearch1) Then + If Me.View_MaxPersonalEducationSearch1.Text = BaseClasses.Resources.AppResources.GetResourceValue("Txt:SearchForEllipsis", Nothing) Then + Me.View_MaxPersonalEducationSearch1.Text = "" + Else + ' Strip "..." from begin and ending of the search text, otherwise the search will return 0 values as in database "..." is not stored. + + If Me.View_MaxPersonalEducationSearch1.Text.StartsWith("...") Then + Me.View_MaxPersonalEducationSearch1.Text = Me.View_MaxPersonalEducationSearch1.Text.SubString(3,Me.View_MaxPersonalEducationSearch1.Text.Length-3) + End If + If Me.View_MaxPersonalEducationSearch1.Text.EndsWith("...") then + Me.View_MaxPersonalEducationSearch1.Text = Me.View_MaxPersonalEducationSearch1.Text.SubString(0,Me.View_MaxPersonalEducationSearch1.Text.Length-3) + ' Strip the last word as well as it is likely only a partial word + Dim endindex As Integer = View_MaxPersonalEducationSearch1.Text.Length - 1 + While (Not Char.IsWhiteSpace(View_MaxPersonalEducationSearch1.Text(endindex)) AndAlso endindex > 0) + endindex -= 1 + End While + If endindex > 0 Then + View_MaxPersonalEducationSearch1.Text = View_MaxPersonalEducationSearch1.Text.Substring(0, endindex) + End If + End If + End If + + Dim formatedSearchText As String = MiscUtils.GetSelectedValue(Me.View_MaxPersonalEducationSearch1, Me.GetFromSession(Me.View_MaxPersonalEducationSearch1)) + + ' After stripping "..." see if the search text is null or empty. + If IsValueSelected(Me.View_MaxPersonalEducationSearch1) Then + ' These clauses are added depending on operator and fields selected in Control's property page, bindings tab. + + Dim search As WhereClause = New WhereClause() + + search.iOR(View_MaxPersonalEducationView.Course, BaseFilter.ComparisonOperator.Contains, MiscUtils.GetSelectedValue(Me.View_MaxPersonalEducationSearch1, Me.GetFromSession(Me.View_MaxPersonalEducationSearch1)), True, False) + + search.iOR(View_MaxPersonalEducationView.CourseAbbr, BaseFilter.ComparisonOperator.Contains, MiscUtils.GetSelectedValue(Me.View_MaxPersonalEducationSearch1, Me.GetFromSession(Me.View_MaxPersonalEducationSearch1)), True, False) + + search.iOR(View_MaxPersonalEducationView.Facultry, BaseFilter.ComparisonOperator.Contains, MiscUtils.GetSelectedValue(Me.View_MaxPersonalEducationSearch1, Me.GetFromSession(Me.View_MaxPersonalEducationSearch1)), True, False) + + wc.iAND(search) + + End If + End If + + Dim wc1 As WhereClause = Me.CreateWhereClause + If wc1.Count > 0 Then + wc.AddFilter(wc1.GetFilter(), CompoundFilter.CompoundingOperators.And_Operator) + End If + + Return wc + End Function + + Public Overridable Function CreateWhereClause_SectionAbbvrNameFilter() As WhereClause + + ' Create a where clause for the filter SectionAbbvrNameFilter. + ' This function is called by the Populate method to load the items + ' in the SectionAbbvrNameFilterDropDownList + + Dim wc As WhereClause= New WhereClause() + Return wc + + End Function + + + + + Protected Overridable Sub Control_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.PreRender + ' PreRender event is raised just before page is being displayed. + Try + DbUtils.StartTransaction + Me.RegisterPostback() + + If Not Me.Page.ErrorOnPage AndAlso (Me.Page.IsPageRefresh OrElse Me.DataChanged OrElse Me.ResetData) Then + + ' Call the Set methods for each controls on the panel that use resultset + + SetCourseAbbrFilter() + SetFacultryFilter() + SetLevelFilter() + SetRankLevelFromFilter() + + ' Re-load the data and update the web page if necessary. + ' This is typically done during a postback (filter, search button, sort, pagination button). + ' In each of the other click handlers, simply set DataChanged to True to reload the data. + + Me.LoadData() + Me.DataBind() + + End If + + + + Catch ex As Exception + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + Finally + DbUtils.EndTransaction + End Try + End Sub + + + Protected Overrides Sub SaveControlsToSession() + MyBase.SaveControlsToSession() + + ' Save filter controls to values to session. + + Me.SaveToSession(Me.CourseAbbrFilter, Me.CourseAbbrFilter.SelectedValue) + + Me.SaveToSession(Me.FacultryFilter, Me.FacultryFilter.SelectedValue) + + Me.SaveToSession(Me.LevelFilter, Me.LevelFilter.SelectedValue) + + Me.SaveToSession(Me.RankLevelFromFilter, Me.RankLevelFromFilter.SelectedValue) + + Me.SaveToSession(Me.SectionAbbvrNameFilter, Me.SectionAbbvrNameFilter.SelectedValue) + + Me.SaveToSession(Me.View_MaxPersonalEducationSearch1, Me.View_MaxPersonalEducationSearch1.Text) + + + 'Save pagination state to session. + + + + ' Save table control properties to the session. + If Not Me.CurrentSortOrder Is Nothing Then + Me.SaveToSession(Me, "Order_By", Me.CurrentSortOrder.ToXmlString()) + End If + + Me.SaveToSession(Me, "Page_Index", Me.PageIndex.ToString()) + Me.SaveToSession(Me, "Page_Size", Me.PageSize.ToString()) + + Me.SaveToSession(Me, "DeletedRecordIds", Me.DeletedRecordIds) + + End Sub + + Protected Sub SaveControlsToSession_Ajax() + ' Save filter controls to values to session. + + Me.SaveToSession("CourseAbbrFilter_Ajax", Me.CourseAbbrFilter.SelectedValue) + + Me.SaveToSession("FacultryFilter_Ajax", Me.FacultryFilter.SelectedValue) + + Me.SaveToSession("LevelFilter_Ajax", Me.LevelFilter.SelectedValue) + + Me.SaveToSession("RankLevelFromFilter_Ajax", Me.RankLevelFromFilter.SelectedValue) + + Me.SaveToSession("SectionAbbvrNameFilter_Ajax", Me.SectionAbbvrNameFilter.SelectedValue) + + Me.SaveToSession("View_MaxPersonalEducationSearch1_Ajax", Me.View_MaxPersonalEducationSearch1.Text) + + HttpContext.Current.Session("AppRelativeVirtualPath") = Me.Page.AppRelativeVirtualPath + + End Sub + + Protected Overrides Sub ClearControlsFromSession() + MyBase.ClearControlsFromSession() + + ' Clear filter controls values from the session. + + Me.RemoveFromSession(Me.CourseAbbrFilter) + Me.RemoveFromSession(Me.FacultryFilter) + Me.RemoveFromSession(Me.LevelFilter) + Me.RemoveFromSession(Me.RankLevelFromFilter) + Me.RemoveFromSession(Me.SectionAbbvrNameFilter) + Me.RemoveFromSession(Me.View_MaxPersonalEducationSearch1) + + ' Clear pagination state from session. + + + + ' Clear table properties from the session. + Me.RemoveFromSession(Me, "Order_By") + Me.RemoveFromSession(Me, "Page_Index") + Me.RemoveFromSession(Me, "Page_Size") + + Me.RemoveFromSession(Me, "DeletedRecordIds") + + End Sub + + Protected Overrides Sub LoadViewState(ByVal savedState As Object) + MyBase.LoadViewState(savedState) + + Dim orderByStr As String = CType(ViewState("View_MaxPersonalEducationTableControl_OrderBy"), String) + + If orderByStr IsNot Nothing AndAlso orderByStr.Trim <> "" Then + Me.CurrentSortOrder = BaseClasses.Data.OrderBy.FromXmlString(orderByStr) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + End If + + Dim pageIndex As String = CType(ViewState("Page_Index"), String) + If pageIndex IsNot Nothing Then + Me.PageIndex = CInt(pageIndex) + End If + + Dim pageSize As String = CType(ViewState("Page_Size"), String) + If Not pageSize Is Nothing Then + Me.PageSize = CInt(pageSize) + End If + + + + ' Load view state for pagination control. + + Me.DeletedRecordIds = CType(Me.ViewState("DeletedRecordIds"), String) + + End Sub + + Protected Overrides Function SaveViewState() As Object + + If Me.CurrentSortOrder IsNot Nothing Then + Me.ViewState("View_MaxPersonalEducationTableControl_OrderBy") = Me.CurrentSortOrder.ToXmlString() + End If + + Me.ViewState("Page_Index") = Me.PageIndex + Me.ViewState("Page_Size") = Me.PageSize + + Me.ViewState("DeletedRecordIds") = Me.DeletedRecordIds + + + ' Load view state for pagination control. + + + Return MyBase.SaveViewState() + End Function + + ' Generate the event handling functions for pagination events. + + ' event handler for ImageButton + Public Overridable Sub View_MaxPersonalEducationPagination_FirstPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.PageIndex = 0 + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub View_MaxPersonalEducationPagination_LastPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.DisplayLastPage = True + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub View_MaxPersonalEducationPagination_NextPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.PageIndex += 1 + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for LinkButton + Public Overridable Sub View_MaxPersonalEducationPagination_PageSizeButton_Click(ByVal sender As Object, ByVal args As EventArgs) + + Try + + Me.DataChanged = True + + Me.PageSize = Integer.Parse(Me.View_MaxPersonalEducationPagination.PageSize.Text) + + Me.PageIndex = Integer.Parse(Me.View_MaxPersonalEducationPagination.CurrentPage.Text) - 1 + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub View_MaxPersonalEducationPagination_PreviousPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + If Me.PageIndex > 0 Then + Me.PageIndex -= 1 + Me.DataChanged = True + End If + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + + ' Generate the event handling functions for sorting events. + + Public Overridable Sub SectionAbbvrNameLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by SectionAbbvrName when clicked. + + ' Get previous sorting state for SectionAbbvrName. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(View_MaxPersonalEducationView.SectionAbbvrName) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for SectionAbbvrName. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(View_MaxPersonalEducationView.SectionAbbvrName, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by SectionAbbvrName, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + + ' Generate the event handling functions for button events. + + ' event handler for ImageButton + Public Overridable Sub View_MaxPersonalEducationExportCSVButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + ' Build the where clause based on the current filter and search criteria + ' Create the Order By clause based on the user's current sorting preference. + + Dim wc As WhereClause = CreateWhereClause + Dim orderBy As OrderBy = Nothing + + orderBy = CreateOrderBy + + ' Add each of the columns in order of export. + Dim columns() as BaseColumn = New BaseColumn() { _ + View_MaxPersonalEducationView.Level, _ + View_MaxPersonalEducationView.Course, _ + View_MaxPersonalEducationView.CourseAbbr, _ + View_MaxPersonalEducationView.Institue, _ + View_MaxPersonalEducationView.Facultry, _ + View_MaxPersonalEducationView.EdYear, _ + View_MaxPersonalEducationView.Country, _ + View_MaxPersonalEducationView.SectionAbbvrName, _ + View_MaxPersonalEducationView.RankAndName, _ + Nothing} + Dim exportData as ExportDataToCSV = New ExportDataToCSV(View_MaxPersonalEducationView.Instance, wc, orderBy, columns) + + Dim done As Boolean = False + + Dim totalRowsReturned As Integer = 0 + Dim join As CompoundFilter = CreateCompoundJoinFilter() + Dim data As DataForExport = New DataForExport(View_MaxPersonalEducationView.Instance, wc, orderBy, columns, join) + + 'Check for Export Data Threshold + Dim exportRawValues As Boolean = False + Me.TotalRecords = View_MaxPersonalEducationView.GetRecordCount(join, wc) + If Me.TotalRecords > 10000 Then + exportRawValues = True + End If + exportData.StartExport(Me.Page.Response, exportRawValues) + + ' Read pageSize records at a time and write out the CSV file. + While (Not done) + Dim recList As ArrayList = data.GetRows(exportData.pageSize) + If recList Is Nothing Then + Exit While 'no more records we are done + End If + + totalRowsReturned = recList.Count + For Each rec As BaseRecord In recList + For Each col As BaseColumn In data.ColumnList + If col Is Nothing Then + Continue For + End If + + If Not data.IncludeInExport(col) Then + Continue For + End If + + Dim val As String = "" + + If exportRawValues Then + val = rec.GetValue(col).ToString() + Else + Dim _isExpandableNonCompositeForeignKey As Boolean = col.TableDefinition.IsExpandableNonCompositeForeignKey(col) + If _isExpandableNonCompositeForeignKey AndAlso col.IsApplyDisplayAs Then + val = View_MaxPersonalEducationView.GetDFKA(rec.GetValue(col).ToString(), col, Nothing) + End If + If (Not _isExpandableNonCompositeForeignKey) Or (String.IsNullOrEmpty(val)) Then + val = exportData.GetDataForExport(col, rec) + End If + End If + exportData.WriteColumnData(val, data.IsString(col)) + + Next col + exportData.WriteNewRow() + Next rec + + ' If we already are below the pageSize, then we are done. + If totalRowsReturned < exportData.pageSize Then + done = True + End If + End While + exportData.FinishExport(Me.Page.Response) + + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub View_MaxPersonalEducationExportExcelButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + ' To customize the columns or the format, override this function in Section 1 of the page + ' and modify it to your liking. + ' Build the where clause based on the current filter and search criteria + ' Create the Order By clause based on the user's current sorting preference. + + Dim wc As WhereClause = CreateWhereClause + Dim orderBy As OrderBy = Nothing + + orderBy = CreateOrderBy + + Dim done As Boolean = False + Dim val As Object = "" + ' Read pageSize records at a time and write out the Excel file. + Dim totalRowsReturned As Integer = 0 + + Me.TotalRecords = View_MaxPersonalEducationView.GetRecordCount(wc) + If Me.TotalRecords > 10000 Then + + ' Add each of the columns in order of export. + Dim columns() as BaseColumn = New BaseColumn() { _ + View_MaxPersonalEducationView.Level, _ + View_MaxPersonalEducationView.Course, _ + View_MaxPersonalEducationView.CourseAbbr, _ + View_MaxPersonalEducationView.Institue, _ + View_MaxPersonalEducationView.Facultry, _ + View_MaxPersonalEducationView.EdYear, _ + View_MaxPersonalEducationView.Country, _ + View_MaxPersonalEducationView.SectionAbbvrName, _ + View_MaxPersonalEducationView.RankAndName, _ + Nothing} + Dim exportData as ExportDataToCSV = New ExportDataToCSV(View_MaxPersonalEducationView.Instance, wc, orderBy, columns) + exportData.StartExport(Me.Page.Response, True) + + Dim dataForCSV As DataForExport = New DataForExport(View_MaxPersonalEducationView.Instance, wc, orderBy, columns) + + ' Read pageSize records at a time and write out the CSV file. + While (Not done) + Dim recList As ArrayList = dataForCSV.GetRows(exportData.pageSize) + If recList Is Nothing Then + Exit While 'no more records we are done + End If + + totalRowsReturned = recList.Count + For Each rec As BaseRecord In recList + For Each col As BaseColumn In dataForCSV.ColumnList + If col Is Nothing Then + Continue For + End If + + If Not dataForCSV.IncludeInExport(col) Then + Continue For + End If + + val = rec.GetValue(col).ToString() + exportData.WriteColumnData(val, dataForCSV.IsString(col)) + + Next col + exportData.WriteNewRow() + Next rec + + ' If we already are below the pageSize, then we are done. + If totalRowsReturned < exportData.pageSize Then + done = True + End If + End While + exportData.FinishExport(Me.Page.Response) + Else + + ' Create an instance of the Excel report class with the table class, where clause and order by. + Dim excelReport As ExportDataToExcel = New ExportDataToExcel(View_MaxPersonalEducationView.Instance, wc, orderBy) + ' Add each of the columns in order of export. + ' To customize the data type, change the second parameter of the new ExcelColumn to be + ' a format string from Excel's Format Cell menu. For example "dddd, mmmm dd, yyyy h:mm AM/PM;@", "#,##0.00" + + If Me.Page.Response Is Nothing Then + Return + End If + + excelReport.CreateExcelBook() + + Dim width As Integer = 0 + Dim columnCounter As Integer = 0 + Dim data As DataForExport = New DataForExport(View_MaxPersonalEducationView.Instance, wc, orderBy, Nothing) + data.ColumnList.Add(New ExcelColumn(View_MaxPersonalEducationView.Level, "Default")) + data.ColumnList.Add(New ExcelColumn(View_MaxPersonalEducationView.Course, "Default")) + data.ColumnList.Add(New ExcelColumn(View_MaxPersonalEducationView.CourseAbbr, "Default")) + data.ColumnList.Add(New ExcelColumn(View_MaxPersonalEducationView.Institue, "Default")) + data.ColumnList.Add(New ExcelColumn(View_MaxPersonalEducationView.Facultry, "Default")) + data.ColumnList.Add(New ExcelColumn(View_MaxPersonalEducationView.EdYear, "Default")) + data.ColumnList.Add(New ExcelColumn(View_MaxPersonalEducationView.Country, "Default")) + data.ColumnList.Add(New ExcelColumn(View_MaxPersonalEducationView.SectionAbbvrName, "Default")) + data.ColumnList.Add(New ExcelColumn(View_MaxPersonalEducationView.RankAndName, "Default")) + + + For Each col As ExcelColumn In data.ColumnList + width = excelReport.GetExcelCellWidth(col) + If data.IncludeInExport(col) Then + excelReport.AddColumnToExcelBook(columnCounter, col.ToString(), excelReport.GetExcelDataType(col), width, excelReport.GetDisplayFormat(col)) + columnCounter = columnCounter + 1 + End If + Next col + + While (Not done) + Dim recList As ArrayList = data.GetRows(excelReport.pageSize) + + If recList Is Nothing Then + Exit While 'no more records we are done + End If + + totalRowsReturned = recList.Count + + For Each rec As BaseRecord In recList + excelReport.AddRowToExcelBook() + columnCounter = 0 + + For Each col As ExcelColumn In data.ColumnList + If Not data.IncludeInExport(col) Then + Continue For + End If + + Dim _isExpandableNonCompositeForeignKey As Boolean = col.DisplayColumn.TableDefinition.IsExpandableNonCompositeForeignKey(col.DisplayColumn) + If _isExpandableNonCompositeForeignKey AndAlso col.DisplayColumn.IsApplyDisplayAs Then + val = View_MaxPersonalEducationView.GetDFKA(rec.GetValue(col.DisplayColumn).ToString(), col.DisplayColumn, Nothing) + If val Is Nothing Then + val = rec.Format(col.DisplayColumn) + End If + Else + val = excelReport.GetValueForExcelExport(col, rec) + End If + excelReport.AddCellToExcelRow(columnCounter, excelReport.GetExcelDataType(col), val, col.DisplayFormat) + + columnCounter = columnCounter + 1 + Next col + Next rec + + ' If we already are below the pageSize, then we are done. + If totalRowsReturned < excelReport.pageSize Then + done = True + End If + End While + + excelReport.SaveExcelBook(Me.Page.Response) + End If + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub View_MaxPersonalEducationPDFButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + Dim report As PDFReport = New PDFReport() + report.SpecificReportFileName = Page.Server.MapPath("ShowViewMaxPersonalEducation.View_MaxPersonalEducationPDFButton.report") + ' report.Title replaces the value tag of page header and footer containing ${ReportTitle} + report.Title = "View_MaxPersonalEducation" + ' If ShowViewMaxPersonalEducation.View_MaxPersonalEducationPDFButton.report specifies a valid report template, + ' AddColumn method will generate a report template. + ' Each AddColumn method-call specifies a column + ' The 1st parameter represents the text of the column header + ' The 2nd parameter represents the horizontal alignment of the column header + ' The 3rd parameter represents the text format of the column detail + ' The 4th parameter represents the horizontal alignment of the column detail + ' The 5th parameter represents the relative width of the column + report.AddColumn(View_MaxPersonalEducationView.Level.Name, ReportEnum.Align.Left, "${Level}", ReportEnum.Align.Left, 30) + report.AddColumn(View_MaxPersonalEducationView.Course.Name, ReportEnum.Align.Left, "${Course}", ReportEnum.Align.Left, 30) + report.AddColumn(View_MaxPersonalEducationView.CourseAbbr.Name, ReportEnum.Align.Left, "${CourseAbbr}", ReportEnum.Align.Left, 30) + report.AddColumn(View_MaxPersonalEducationView.Institue.Name, ReportEnum.Align.Left, "${Institue}", ReportEnum.Align.Left, 30) + report.AddColumn(View_MaxPersonalEducationView.Facultry.Name, ReportEnum.Align.Left, "${Facultry}", ReportEnum.Align.Left, 30) + report.AddColumn(View_MaxPersonalEducationView.EdYear.Name, ReportEnum.Align.Left, "${EdYear}", ReportEnum.Align.Left, 15) + report.AddColumn(View_MaxPersonalEducationView.Country.Name, ReportEnum.Align.Left, "${Country}", ReportEnum.Align.Left, 30) + report.AddColumn(View_MaxPersonalEducationView.SectionAbbvrName.Name, ReportEnum.Align.Left, "${SectionAbbvrName}", ReportEnum.Align.Left, 20) + report.AddColumn(View_MaxPersonalEducationView.RankAndName.Name, ReportEnum.Align.Left, "${RankAndName}", ReportEnum.Align.Left, 30) + + + Dim rowsPerQuery As Integer = 5000 + Dim recordCount As Integer = 0 + + report.Page = Page.GetResourceValue("Txt:Page", "Persons") + report.ApplicationPath = Me.Page.MapPath(Page.Request.ApplicationPath) + + Dim whereClause As WhereClause = CreateWhereClause + Dim orderBy As OrderBy = CreateOrderBy + Dim joinFilter As BaseFilter = CreateCompoundJoinFilter() + + Dim pageNum As Integer = 0 + Dim totalRows As Integer = View_MaxPersonalEducationView.GetRecordCount(joinFilter,whereClause) + Dim columns As ColumnList = View_MaxPersonalEducationView.GetColumnList() + Dim records As View_MaxPersonalEducationRecord() = Nothing + + Do + + records = View_MaxPersonalEducationView.GetRecords(joinFilter,whereClause, orderBy, pageNum, rowsPerQuery) + If Not (records Is Nothing) AndAlso records.Length > 0 AndAlso whereClause.RunQuery Then + For Each record As View_MaxPersonalEducationRecord In records + + ' AddData method takes four parameters + ' The 1st parameters represent the data format + ' The 2nd parameters represent the data value + ' The 3rd parameters represent the default alignment of column using the data + ' The 4th parameters represent the maximum length of the data value being shown + report.AddData("${Level}", record.Format(View_MaxPersonalEducationView.Level), ReportEnum.Align.Left, 100) + report.AddData("${Course}", record.Format(View_MaxPersonalEducationView.Course), ReportEnum.Align.Left, 100) + report.AddData("${CourseAbbr}", record.Format(View_MaxPersonalEducationView.CourseAbbr), ReportEnum.Align.Left, 100) + report.AddData("${Institue}", record.Format(View_MaxPersonalEducationView.Institue), ReportEnum.Align.Left, 100) + report.AddData("${Facultry}", record.Format(View_MaxPersonalEducationView.Facultry), ReportEnum.Align.Left, 100) + report.AddData("${EdYear}", record.Format(View_MaxPersonalEducationView.EdYear), ReportEnum.Align.Left, 100) + report.AddData("${Country}", record.Format(View_MaxPersonalEducationView.Country), ReportEnum.Align.Left, 100) + report.AddData("${SectionAbbvrName}", record.Format(View_MaxPersonalEducationView.SectionAbbvrName), ReportEnum.Align.Left, 100) + report.AddData("${RankAndName}", record.Format(View_MaxPersonalEducationView.RankAndName), ReportEnum.Align.Left) + + report.WriteRow + Next + pageNum = pageNum + 1 + recordCount += records.Length + End If + Loop While Not (records Is Nothing) AndAlso recordCount < totalRows AndAlso whereClause.RunQuery + + report.Close + BaseClasses.Utils.NetUtils.WriteResponseBinaryAttachment(Me.Page.Response, report.Title + ".pdf", report.ReportInByteArray, 0, true) + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub View_MaxPersonalEducationRefreshButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Dim View_MaxPersonalEducationTableControlObj as View_MaxPersonalEducationTableControl = DirectCast(Me.Page.FindControlRecursively("View_MaxPersonalEducationTableControl"), View_MaxPersonalEducationTableControl) + View_MaxPersonalEducationTableControlObj.ResetData = True + + View_MaxPersonalEducationTableControlObj.RemoveFromSession(View_MaxPersonalEducationTableControlObj, "DeletedRecordIds") + View_MaxPersonalEducationTableControlObj.DeletedRecordIds = Nothing + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub View_MaxPersonalEducationResetButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.CourseAbbrFilter.ClearSelection() + Me.FacultryFilter.ClearSelection() + Me.LevelFilter.ClearSelection() + Me.RankLevelFromFilter.ClearSelection() + Me.SectionAbbvrNameFilter.ClearSelection() + Me.View_MaxPersonalEducationSearch1.Text = "" + Me.CurrentSortOrder.Reset() + If Me.InSession(Me, "Order_By") Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + + End If + + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub View_MaxPersonalEducationWordButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + Dim report As WordReport = New WordReport + report.SpecificReportFileName = Page.Server.MapPath("ShowViewMaxPersonalEducation.View_MaxPersonalEducationWordButton.word") + ' report.Title replaces the value tag of page header and footer containing ${ReportTitle} + report.Title = "View_MaxPersonalEducation" + ' If ShowViewMaxPersonalEducation.View_MaxPersonalEducationWordButton.report specifies a valid report template, + ' AddColumn method will generate a report template. + ' Each AddColumn method-call specifies a column + ' The 1st parameter represents the text of the column header + ' The 2nd parameter represents the horizontal alignment of the column header + ' The 3rd parameter represents the text format of the column detail + ' The 4th parameter represents the horizontal alignment of the column detail + ' The 5th parameter represents the relative width of the column + report.AddColumn(View_MaxPersonalEducationView.Level.Name, ReportEnum.Align.Left, "${Level}", ReportEnum.Align.Left, 30) + report.AddColumn(View_MaxPersonalEducationView.Course.Name, ReportEnum.Align.Left, "${Course}", ReportEnum.Align.Left, 30) + report.AddColumn(View_MaxPersonalEducationView.CourseAbbr.Name, ReportEnum.Align.Left, "${CourseAbbr}", ReportEnum.Align.Left, 30) + report.AddColumn(View_MaxPersonalEducationView.Institue.Name, ReportEnum.Align.Left, "${Institue}", ReportEnum.Align.Left, 30) + report.AddColumn(View_MaxPersonalEducationView.Facultry.Name, ReportEnum.Align.Left, "${Facultry}", ReportEnum.Align.Left, 30) + report.AddColumn(View_MaxPersonalEducationView.EdYear.Name, ReportEnum.Align.Left, "${EdYear}", ReportEnum.Align.Left, 15) + report.AddColumn(View_MaxPersonalEducationView.Country.Name, ReportEnum.Align.Left, "${Country}", ReportEnum.Align.Left, 30) + report.AddColumn(View_MaxPersonalEducationView.SectionAbbvrName.Name, ReportEnum.Align.Left, "${SectionAbbvrName}", ReportEnum.Align.Left, 20) + report.AddColumn(View_MaxPersonalEducationView.RankAndName.Name, ReportEnum.Align.Left, "${RankAndName}", ReportEnum.Align.Left, 30) + + Dim whereClause As WhereClause = CreateWhereClause + + Dim orderBy As OrderBy = CreateOrderBy + Dim joinFilter As BaseFilter = CreateCompoundJoinFilter() + + Dim rowsPerQuery As Integer = 5000 + Dim pageNum As Integer = 0 + Dim recordCount As Integer = 0 + Dim totalRows As Integer = View_MaxPersonalEducationView.GetRecordCount(joinFilter,whereClause) + + report.Page = Page.GetResourceValue("Txt:Page", "Persons") + report.ApplicationPath = Me.Page.MapPath(Page.Request.ApplicationPath) + + Dim columns As ColumnList = View_MaxPersonalEducationView.GetColumnList() + Dim records As View_MaxPersonalEducationRecord() = Nothing + Do + records = View_MaxPersonalEducationView.GetRecords(joinFilter,whereClause, orderBy, pageNum, rowsPerQuery) + + If Not (records Is Nothing) AndAlso records.Length > 0 AndAlso whereClause.RunQuery Then + For Each record As View_MaxPersonalEducationRecord In records + ' AddData method takes four parameters + ' The 1st parameters represent the data format + ' The 2nd parameters represent the data value + ' The 3rd parameters represent the default alignment of column using the data + ' The 4th parameters represent the maximum length of the data value being shown + report.AddData("${Level}", record.Format(View_MaxPersonalEducationView.Level), ReportEnum.Align.Left, 100) + report.AddData("${Course}", record.Format(View_MaxPersonalEducationView.Course), ReportEnum.Align.Left, 100) + report.AddData("${CourseAbbr}", record.Format(View_MaxPersonalEducationView.CourseAbbr), ReportEnum.Align.Left, 100) + report.AddData("${Institue}", record.Format(View_MaxPersonalEducationView.Institue), ReportEnum.Align.Left, 100) + report.AddData("${Facultry}", record.Format(View_MaxPersonalEducationView.Facultry), ReportEnum.Align.Left, 100) + report.AddData("${EdYear}", record.Format(View_MaxPersonalEducationView.EdYear), ReportEnum.Align.Left, 100) + report.AddData("${Country}", record.Format(View_MaxPersonalEducationView.Country), ReportEnum.Align.Left, 100) + report.AddData("${SectionAbbvrName}", record.Format(View_MaxPersonalEducationView.SectionAbbvrName), ReportEnum.Align.Left, 100) + report.AddData("${RankAndName}", record.Format(View_MaxPersonalEducationView.RankAndName), ReportEnum.Align.Left) + + report.WriteRow + Next + pageNum = pageNum + 1 + recordCount += records.Length + End If + Loop While Not (records Is Nothing) AndAlso recordCount < totalRows AndAlso whereClause.RunQuery + report.save + BaseClasses.Utils.NetUtils.WriteResponseBinaryAttachment(Me.Page.Response, report.Title + ".doc", report.ReportInByteArray, 0, true) + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for Button with Layout + Public Overridable Sub View_MaxPersonalEducationSearchButton1_Click(ByVal sender As Object, ByVal args As EventArgs) + + Try + + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + + + ' Generate the event handling functions for filter and search events. + + ' event handler for FieldFilter + Protected Overridable Sub CourseAbbrFilter_SelectedIndexChanged(ByVal sender As Object, ByVal args As EventArgs) + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + + End Sub + + ' event handler for FieldFilter + Protected Overridable Sub FacultryFilter_SelectedIndexChanged(ByVal sender As Object, ByVal args As EventArgs) + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + + End Sub + + ' event handler for FieldFilter + Protected Overridable Sub LevelFilter_SelectedIndexChanged(ByVal sender As Object, ByVal args As EventArgs) + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + + End Sub + + ' event handler for FieldFilter + Protected Overridable Sub RankLevelFromFilter_SelectedIndexChanged(ByVal sender As Object, ByVal args As EventArgs) + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + + End Sub + + ' event handler for FieldFilter + Protected Overridable Sub SectionAbbvrNameFilter_SelectedIndexChanged(ByVal sender As Object, ByVal args As EventArgs) + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + + End Sub + + + ' Generate the event handling functions for others + + + Private _UIData As New System.Collections.Generic.List(Of Hashtable) + Public Property UIData() As System.Collections.Generic.List(Of Hashtable) + Get + Return Me._UIData + End Get + Set(ByVal value As System.Collections.Generic.List(Of Hashtable)) + Me._UIData = value + End Set + End Property + + ' pagination properties + Protected _PageSize As Integer + Public Property PageSize() As Integer + Get + Return Me._PageSize + End Get + Set(ByVal value As Integer) + Me._PageSize = value + End Set + End Property + + Protected _PageIndex As Integer + Public Property PageIndex() As Integer + Get + ' Return the PageIndex + Return Me._PageIndex + End Get + Set(ByVal value As Integer) + Me._PageIndex = value + End Set + End Property + + Protected _TotalRecords As Integer = -1 + Public Property TotalRecords() As Integer + Get + If _TotalRecords < 0 + _TotalRecords = View_MaxPersonalEducationView.GetRecordCount(CreateCompoundJoinFilter(), CreateWhereClause()) + End If + Return Me._TotalRecords + End Get + Set(ByVal value As Integer) + If Me.PageSize > 0 Then + + Me.TotalPages = CInt(Math.Ceiling(value / Me.PageSize)) + + End If + Me._TotalRecords = value + End Set + End Property + + + + Protected _TotalPages As Integer = -1 + Public Property TotalPages() As Integer + Get + If _TotalPages < 0 Then + + Me.TotalPages = CInt(Math.Ceiling(TotalRecords / Me.PageSize)) + + End If + Return Me._TotalPages + End Get + Set(ByVal value As Integer) + Me._TotalPages = value + End Set + End Property + + Protected _DisplayLastPage As Boolean + Public Property DisplayLastPage() As Boolean + Get + Return Me._DisplayLastPage + End Get + Set(ByVal value As Boolean) + Me._DisplayLastPage = value + End Set + End Property + + Private _DataChanged As Boolean = False + Public Property DataChanged() As Boolean + Get + Return Me._DataChanged + End Get + Set(ByVal value As Boolean) + Me._DataChanged = value + End Set + End Property + + Private _ResetData As Boolean = False + Public Property ResetData() As Boolean + Get + Return Me._ResetData + End Get + Set(ByVal value As Boolean) + Me._ResetData = value + End Set + End Property + + Private _AddNewRecord As Integer = 0 + Public Property AddNewRecord() As Integer + Get + Return Me._AddNewRecord + End Get + Set(ByVal value As Integer) + Me._AddNewRecord = value + End Set + End Property + + + Private _CurrentSortOrder As OrderBy = Nothing + Public Property CurrentSortOrder() As OrderBy + Get + Return Me._CurrentSortOrder + End Get + Set(ByVal value As BaseClasses.Data.OrderBy) + Me._CurrentSortOrder = value + End Set + End Property + + Private _DataSource() As View_MaxPersonalEducationRecord = Nothing + Public Property DataSource() As View_MaxPersonalEducationRecord () + Get + Return Me._DataSource + End Get + Set(ByVal value() As View_MaxPersonalEducationRecord) + Me._DataSource = value + End Set + End Property + +#Region "Helper Properties" + + Public ReadOnly Property CountryLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "CountryLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property CourseAbbrFilter() As System.Web.UI.WebControls.DropDownList + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "CourseAbbrFilter"), System.Web.UI.WebControls.DropDownList) + End Get + End Property + + Public ReadOnly Property CourseAbbrLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "CourseAbbrLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property CourseAbbrLabel1() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "CourseAbbrLabel1"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property CourseLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "CourseLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property EdYearLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "EdYearLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property FacultryFilter() As System.Web.UI.WebControls.DropDownList + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "FacultryFilter"), System.Web.UI.WebControls.DropDownList) + End Get + End Property + + Public ReadOnly Property FacultryLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "FacultryLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property FacultryLabel1() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "FacultryLabel1"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property InstitueLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "InstitueLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property LevelFilter() As System.Web.UI.WebControls.DropDownList + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "LevelFilter"), System.Web.UI.WebControls.DropDownList) + End Get + End Property + + Public ReadOnly Property LevelLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "LevelLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property LevelLabel1() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "LevelLabel1"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property PersonalNameLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalNameLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property RankLevelFromFilter() As System.Web.UI.WebControls.DropDownList + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RankLevelFromFilter"), System.Web.UI.WebControls.DropDownList) + End Get + End Property + + Public ReadOnly Property RankLevelLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RankLevelLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property SectionAbbvrNameFilter() As System.Web.UI.WebControls.DropDownList + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "SectionAbbvrNameFilter"), System.Web.UI.WebControls.DropDownList) + End Get + End Property + + Public ReadOnly Property SectionAbbvrNameLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "SectionAbbvrNameLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property SectionAbbvrNameLabel1() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "SectionAbbvrNameLabel1"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property View_MaxPersonalEducationExportCSVButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "View_MaxPersonalEducationExportCSVButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property View_MaxPersonalEducationExportExcelButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "View_MaxPersonalEducationExportExcelButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property View_MaxPersonalEducationPagination() As Persons.UI.IPagination + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "View_MaxPersonalEducationPagination"), Persons.UI.IPagination) + End Get + End Property + + Public ReadOnly Property View_MaxPersonalEducationPDFButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "View_MaxPersonalEducationPDFButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property View_MaxPersonalEducationRefreshButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "View_MaxPersonalEducationRefreshButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property View_MaxPersonalEducationResetButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "View_MaxPersonalEducationResetButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property View_MaxPersonalEducationSearch1() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "View_MaxPersonalEducationSearch1"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property View_MaxPersonalEducationSearchButton1() As Persons.UI.IThemeButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "View_MaxPersonalEducationSearchButton1"), Persons.UI.IThemeButton) + End Get + End Property + + Public ReadOnly Property View_MaxPersonalEducationTableControlCollapsibleRegion() As System.Web.UI.WebControls.Panel + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "View_MaxPersonalEducationTableControlCollapsibleRegion"), System.Web.UI.WebControls.Panel) + End Get + End Property + + Public ReadOnly Property View_MaxPersonalEducationTableControlIcon() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "View_MaxPersonalEducationTableControlIcon"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property View_MaxPersonalEducationTableControlPanelExtender() As AjaxControlToolkit.CollapsiblePanelExtender + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "View_MaxPersonalEducationTableControlPanelExtender"), AjaxControlToolkit.CollapsiblePanelExtender) + End Get + End Property + + Public ReadOnly Property View_MaxPersonalEducationTitle() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "View_MaxPersonalEducationTitle"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property View_MaxPersonalEducationWordButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "View_MaxPersonalEducationWordButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + +#End Region + +#Region "Helper Functions" + + Public Overrides Overloads Function ModifyRedirectUrl(url As String, arg As String, ByVal bEncrypt As Boolean) As String + Return Me.Page.EvaluateExpressions(url, arg, bEncrypt, Me) + End Function + + Public Overrides Overloads Function EvaluateExpressions(url As String, arg As String, ByVal bEncrypt As Boolean) As String + Dim needToProcess As Boolean = AreAnyUrlParametersForMe(url, arg) + If (needToProcess) Then + Dim recCtl As View_MaxPersonalEducationTableControlRow = Me.GetSelectedRecordControl() + If recCtl Is Nothing AndAlso url.IndexOf("{") >= 0 Then + ' Localization. + Throw New Exception(Page.GetResourceValue("Err:NoRecSelected", "Persons")) + End If + Dim rec As View_MaxPersonalEducationRecord = Nothing + If recCtl IsNot Nothing Then + rec = recCtl.GetRecord() + End If + Return EvaluateExpressions(url, arg, rec, bEncrypt) + End If + Return url + End Function + + Public Overridable Function GetSelectedRecordControl() As View_MaxPersonalEducationTableControlRow + Return Nothing + + End Function + + Public Overridable Function GetSelectedRecordControls() As View_MaxPersonalEducationTableControlRow() + + Return DirectCast((new ArrayList()).ToArray(GetType(View_MaxPersonalEducationTableControlRow)), View_MaxPersonalEducationTableControlRow()) + + End Function + + Public Overridable Sub DeleteSelectedRecords(ByVal deferDeletion As Boolean) + Dim recList() As View_MaxPersonalEducationTableControlRow = Me.GetSelectedRecordControls() + If recList.Length = 0 Then + ' Localization. + Throw New Exception(Page.GetResourceValue("Err:NoRecSelected", "Persons")) + End If + + Dim recCtl As View_MaxPersonalEducationTableControlRow + For Each recCtl In recList + If deferDeletion Then + If Not recCtl.IsNewRecord Then + + Me.AddToDeletedRecordIds(recCtl) + + End If + recCtl.Visible = False + + Else + + recCtl.Delete() + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + End If + Next + End Sub + + Public Function GetRecordControls() As View_MaxPersonalEducationTableControlRow() + Dim recList As ArrayList = New ArrayList() + Dim rep As System.Web.UI.WebControls.Repeater = CType(Me.FindControl("View_MaxPersonalEducationTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return Nothing + Dim repItem As System.Web.UI.WebControls.RepeaterItem + + For Each repItem In rep.Items + + Dim recControl As View_MaxPersonalEducationTableControlRow = DirectCast(repItem.FindControl("View_MaxPersonalEducationTableControlRow"), View_MaxPersonalEducationTableControlRow) + recList.Add(recControl) + + Next + + Return DirectCast(recList.ToArray(GetType(View_MaxPersonalEducationTableControlRow)), View_MaxPersonalEducationTableControlRow()) + 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 + + \ No newline at end of file diff --git a/App_Code/PersonalExtWork/AddPersonalExtWork.Controls.vb b/App_Code/PersonalExtWork/AddPersonalExtWork.Controls.vb new file mode 100644 index 0000000..42ac2c1 --- /dev/null +++ b/App_Code/PersonalExtWork/AddPersonalExtWork.Controls.vb @@ -0,0 +1,1376 @@ + +' This file implements the TableControl, TableControlRow, and RecordControl classes for the +' AddPersonalExtWork.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.AddPersonalExtWork + +#Region "Section 1: Place your customizations here." + + +Public Class PersonalExtWorkRecordControl + Inherits BasePersonalExtWorkRecordControl + ' The BasePersonalExtWorkRecordControl 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 PersonalExtWorkRecordControl control on the AddPersonalExtWork page. +' Do not modify this class. Instead override any method in PersonalExtWorkRecordControl. +Public Class BasePersonalExtWorkRecordControl + Inherits Persons.UI.BaseApplicationRecordControl + + ' To customize, override this method in PersonalExtWorkRecordControl. + 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 PersonalExtWorkRecordControl. + 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.BeginDate.TextChanged, AddressOf BeginDate_TextChanged + + AddHandler Me.Command.TextChanged, AddressOf Command_TextChanged + + AddHandler Me.CommandDate.TextChanged, AddressOf CommandDate_TextChanged + + AddHandler Me.Description.TextChanged, AddressOf Description_TextChanged + + AddHandler Me.EndDate.TextChanged, AddressOf EndDate_TextChanged + + AddHandler Me.PersonalId.TextChanged, AddressOf PersonalId_TextChanged + + AddHandler Me.Place.TextChanged, AddressOf Place_TextChanged + + + End Sub + + + Public Overridable Sub LoadData() + + ' Load the data from the database into the DataSource PersonalExtWork 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 = PersonalExtWorkTable.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() + + ' 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 PersonalExtWorkRecord() + + Return + End If + + ' Retrieve the record from the database. It is possible + + Dim recList() As PersonalExtWorkRecord = PersonalExtWorkTable.GetRecords(wc, Nothing, 0, 2) + If recList.Length = 0 Then + ' There is no data for this Where clause. + wc.RunQuery = False + + Return + End If + + ' Set DataSource based on record retrieved from the database. + Me.DataSource = CType(PersonalExtWorkRecord.Copy(recList(0), False), PersonalExtWorkRecord) + + + + End Sub + + ' Populate the UI controls using the DataSource. To customize, override this method in PersonalExtWorkRecordControl. + 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 + + SetBeginDate() + SetBeginDateLabel() + SetCommand() + SetCommandDate() + SetCommandDateLabel() + SetCommandLabel() + SetDescription() + SetDescriptionLabel() + SetEndDate() + SetEndDateLabel() + SetPersonalExtWorkRecordControlCollapsibleRegion() + SetPersonalExtWorkRecordControlIcon() + SetPersonalExtWorkRecordControlPanelExtender() + + SetPersonalId() + SetPersonalIdLabel() + SetPlace() + SetPlaceLabel() + + + 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 SetBeginDate() + + + ' Set the BeginDate TextBox on the webpage with value from the + ' PersonalExtWork database record. + + ' Me.DataSource is the PersonalExtWork record retrieved from the database. + ' Me.BeginDate is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetBeginDate() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.BeginDateSpecified Then + + ' If the BeginDate is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalExtWorkTable.BeginDate, "d MMM yy") + + Me.BeginDate.Text = formattedValue + + Else + + ' BeginDate is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.BeginDate.Text = PersonalExtWorkTable.BeginDate.Format(PersonalExtWorkTable.BeginDate.DefaultValue, "d MMM yy") + + End If + + End Sub + + Public Overridable Sub SetCommand() + + + ' Set the Command TextBox on the webpage with value from the + ' PersonalExtWork database record. + + ' Me.DataSource is the PersonalExtWork record retrieved from the database. + ' Me.Command is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetCommand() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.CommandSpecified Then + + ' If the Command is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalExtWorkTable.Command) + + Me.Command.Text = formattedValue + + Else + + ' Command is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.Command.Text = PersonalExtWorkTable.Command.Format(PersonalExtWorkTable.Command.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetCommandDate() + + + ' Set the CommandDate TextBox on the webpage with value from the + ' PersonalExtWork database record. + + ' Me.DataSource is the PersonalExtWork record retrieved from the database. + ' Me.CommandDate is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetCommandDate() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.CommandDateSpecified Then + + ' If the CommandDate is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalExtWorkTable.CommandDate, "d MMM yy") + + Me.CommandDate.Text = formattedValue + + Else + + ' CommandDate is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.CommandDate.Text = PersonalExtWorkTable.CommandDate.Format(PersonalExtWorkTable.CommandDate.DefaultValue, "d MMM yy") + + End If + + End Sub + + Public Overridable Sub SetDescription() + + + ' Set the Description TextBox on the webpage with value from the + ' PersonalExtWork database record. + + ' Me.DataSource is the PersonalExtWork record retrieved from the database. + ' Me.Description is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetDescription() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.DescriptionSpecified Then + + ' If the Description is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalExtWorkTable.Description) + + Me.Description.Text = formattedValue + + Else + + ' Description is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.Description.Text = PersonalExtWorkTable.Description.Format(PersonalExtWorkTable.Description.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetEndDate() + + + ' Set the EndDate TextBox on the webpage with value from the + ' PersonalExtWork database record. + + ' Me.DataSource is the PersonalExtWork record retrieved from the database. + ' Me.EndDate is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetEndDate() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.EndDateSpecified Then + + ' If the EndDate is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalExtWorkTable.EndDate, "d MMM yy") + + Me.EndDate.Text = formattedValue + + Else + + ' EndDate is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.EndDate.Text = PersonalExtWorkTable.EndDate.Format(PersonalExtWorkTable.EndDate.DefaultValue, "d MMM yy") + + End If + + End Sub + + Public Overridable Sub SetPersonalId() + + + ' Set the PersonalId TextBox on the webpage with value from the + ' PersonalExtWork database record. + + ' Me.DataSource is the PersonalExtWork record retrieved from the database. + ' Me.PersonalId is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetPersonalId() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.PersonalIdSpecified Then + + ' If the PersonalId is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalExtWorkTable.PersonalId) + + Me.PersonalId.Text = formattedValue + + Else + + ' PersonalId is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.PersonalId.Text = PersonalExtWorkTable.PersonalId.Format(PersonalExtWorkTable.PersonalId.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetPlace() + + + ' Set the Place TextBox on the webpage with value from the + ' PersonalExtWork database record. + + ' Me.DataSource is the PersonalExtWork record retrieved from the database. + ' Me.Place is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetPlace() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.PlaceSpecified Then + + ' If the Place is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalExtWorkTable.Place) + + Me.Place.Text = formattedValue + + Else + + ' Place is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.Place.Text = PersonalExtWorkTable.Place.Format(PersonalExtWorkTable.Place.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetBeginDateLabel() + + End Sub + + Public Overridable Sub SetCommandDateLabel() + + End Sub + + Public Overridable Sub SetCommandLabel() + + End Sub + + Public Overridable Sub SetDescriptionLabel() + + End Sub + + Public Overridable Sub SetEndDateLabel() + + End Sub + + Public Overridable Sub SetPersonalExtWorkRecordControlCollapsibleRegion() + + End Sub + + Public Overridable Sub SetPersonalExtWorkRecordControlIcon() + + End Sub + + Public Overridable Sub SetPersonalExtWorkRecordControlPanelExtender() + + End Sub + + Public Overridable Sub SetPersonalIdLabel() + + End Sub + + Public Overridable Sub SetPlaceLabel() + + 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 PersonalExtWorkRecordControl. + Public Overridable Sub SaveData() + ' Saves the associated record in the database. + ' SaveData calls Validate and Get methods - so it may be more appropriate to + ' customize those methods. + + ' 1. Load the existing record from the database. Since we save the entire record, this ensures + ' that fields that are not displayed are also properly initialized. + Me.LoadData() + + + ' 2. Perform any custom validation. + Me.Validate() + + + ' 3. Set the values in the record with data from UI controls. + ' This calls the Get() method for each of the user interface controls. + Me.GetUIData() + + ' 4. Save in the database. + ' We should not save the record if the data did not change. This + ' will save a database hit and avoid triggering any database triggers. + + If Me.DataSource.IsAnyValueChanged Then + ' Save record to database but do not commit yet. + ' Auto generated ids are available after saving for use by child (dependent) records. + Me.DataSource.Save() + + 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 PersonalExtWorkRecordControl. + 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. + + GetBeginDate() + GetCommand() + GetCommandDate() + GetDescription() + GetEndDate() + GetPersonalId() + GetPlace() + End Sub + + + Public Overridable Sub GetBeginDate() + + ' Retrieve the value entered by the user on the BeginDate ASP:TextBox, and + ' save it into the BeginDate field in DataSource PersonalExtWork 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.BeginDate.Text, PersonalExtWorkTable.BeginDate) + + + End Sub + + Public Overridable Sub GetCommand() + + ' Retrieve the value entered by the user on the Command ASP:TextBox, and + ' save it into the Command field in DataSource PersonalExtWork record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.Command.Text, PersonalExtWorkTable.Command) + + + End Sub + + Public Overridable Sub GetCommandDate() + + ' Retrieve the value entered by the user on the CommandDate ASP:TextBox, and + ' save it into the CommandDate field in DataSource PersonalExtWork 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.CommandDate.Text, PersonalExtWorkTable.CommandDate) + + + End Sub + + Public Overridable Sub GetDescription() + + ' Retrieve the value entered by the user on the Description ASP:TextBox, and + ' save it into the Description field in DataSource PersonalExtWork record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.Description.Text, PersonalExtWorkTable.Description) + + + End Sub + + Public Overridable Sub GetEndDate() + + ' Retrieve the value entered by the user on the EndDate ASP:TextBox, and + ' save it into the EndDate field in DataSource PersonalExtWork 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.EndDate.Text, PersonalExtWorkTable.EndDate) + + + End Sub + + Public Overridable Sub GetPersonalId() + + ' Retrieve the value entered by the user on the PersonalId ASP:TextBox, and + ' save it into the PersonalId field in DataSource PersonalExtWork record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.PersonalId.Text, PersonalExtWorkTable.PersonalId) + + + End Sub + + Public Overridable Sub GetPlace() + + ' Retrieve the value entered by the user on the Place ASP:TextBox, and + ' save it into the Place field in DataSource PersonalExtWork record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.Place.Text, PersonalExtWorkTable.Place) + + + End Sub + + + ' To customize, override this method in PersonalExtWorkRecordControl. + + Public Overridable Function CreateWhereClause() As WhereClause + + Dim wc As WhereClause + PersonalExtWorkTable.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("PersonalExtWork") + If recId Is Nothing OrElse recId.Trim = "" Then + + Return Nothing + + End If + + HttpContext.Current.Session("QueryString in AddPersonalExtWork") = 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(PersonalExtWorkTable.id0, BaseFilter.ComparisonOperator.EqualsTo, pkValue.GetColumnValueString(PersonalExtWorkTable.id0)) + + Else + ' The URL parameter contains the actual value, not an XML structure. + + wc.iAND(PersonalExtWorkTable.id0, 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 + PersonalExtWorkTable.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 PersonalExtWorkRecordControl. + 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) + PersonalExtWorkTable.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. + + Protected Overridable Sub BeginDate_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub Command_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub CommandDate_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub Description_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub EndDate_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub PersonalId_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub Place_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("BasePersonalExtWorkRecordControl_Rec"), String) + End Get + Set(ByVal value As String) + Me.ViewState("BasePersonalExtWorkRecordControl_Rec") = value + End Set + End Property + + Private _DataSource As PersonalExtWorkRecord + Public Property DataSource() As PersonalExtWorkRecord + Get + Return Me._DataSource + End Get + + Set(ByVal value As PersonalExtWorkRecord) + + 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 BeginDate() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "BeginDate"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property BeginDateLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "BeginDateLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property Command() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Command"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property CommandDate() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "CommandDate"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property CommandDateLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "CommandDateLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property CommandLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "CommandLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property Description() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Description"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property DescriptionLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "DescriptionLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property EndDate() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "EndDate"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property EndDateLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "EndDateLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property PersonalExtWorkRecordControlCollapsibleRegion() As System.Web.UI.WebControls.Panel + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalExtWorkRecordControlCollapsibleRegion"), System.Web.UI.WebControls.Panel) + End Get + End Property + + Public ReadOnly Property PersonalExtWorkRecordControlIcon() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalExtWorkRecordControlIcon"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalExtWorkRecordControlPanelExtender() As AjaxControlToolkit.CollapsiblePanelExtender + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalExtWorkRecordControlPanelExtender"), AjaxControlToolkit.CollapsiblePanelExtender) + End Get + End Property + + Public ReadOnly Property PersonalExtWorkTitle() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalExtWorkTitle"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property PersonalId() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalId"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property PersonalIdLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalIdLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property Place() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Place"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property PlaceLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PlaceLabel"), 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 PersonalExtWorkRecord = 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 PersonalExtWorkRecord + If Not Me.DataSource Is Nothing Then + Return Me.DataSource + End If + + + Return New PersonalExtWorkRecord() + + 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 + + \ No newline at end of file diff --git a/App_Code/PersonalExtWork/EditPersonalExtWork.Controls.vb b/App_Code/PersonalExtWork/EditPersonalExtWork.Controls.vb new file mode 100644 index 0000000..8a5794c --- /dev/null +++ b/App_Code/PersonalExtWork/EditPersonalExtWork.Controls.vb @@ -0,0 +1,1403 @@ + +' This file implements the TableControl, TableControlRow, and RecordControl classes for the +' EditPersonalExtWork.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.EditPersonalExtWork + +#Region "Section 1: Place your customizations here." + + +Public Class PersonalExtWorkRecordControl + Inherits BasePersonalExtWorkRecordControl + ' The BasePersonalExtWorkRecordControl 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 PersonalExtWorkRecordControl control on the EditPersonalExtWork page. +' Do not modify this class. Instead override any method in PersonalExtWorkRecordControl. +Public Class BasePersonalExtWorkRecordControl + Inherits Persons.UI.BaseApplicationRecordControl + + ' To customize, override this method in PersonalExtWorkRecordControl. + 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 PersonalExtWorkRecordControl. + 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.BeginDate.TextChanged, AddressOf BeginDate_TextChanged + + AddHandler Me.Command.TextChanged, AddressOf Command_TextChanged + + AddHandler Me.CommandDate.TextChanged, AddressOf CommandDate_TextChanged + + AddHandler Me.Description.TextChanged, AddressOf Description_TextChanged + + AddHandler Me.EndDate.TextChanged, AddressOf EndDate_TextChanged + + AddHandler Me.PersonalId.TextChanged, AddressOf PersonalId_TextChanged + + AddHandler Me.Place.TextChanged, AddressOf Place_TextChanged + + + End Sub + + + Public Overridable Sub LoadData() + + ' Load the data from the database into the DataSource PersonalExtWork 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 = PersonalExtWorkTable.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, "PersonalExtWorkRecordControlPanel"), 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 PersonalExtWorkRecord() + + 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 PersonalExtWorkRecord = PersonalExtWorkTable.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 = PersonalExtWorkTable.GetRecord(recList(0).GetID.ToXmlString(), True) + + + + End Sub + + ' Populate the UI controls using the DataSource. To customize, override this method in PersonalExtWorkRecordControl. + 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 + + SetBeginDate() + SetBeginDateLabel() + SetCommand() + SetCommandDate() + SetCommandDateLabel() + SetCommandLabel() + SetDescription() + SetDescriptionLabel() + SetEndDate() + SetEndDateLabel() + SetPersonalExtWorkRecordControlCollapsibleRegion() + SetPersonalExtWorkRecordControlIcon() + SetPersonalExtWorkRecordControlPanelExtender() + + SetPersonalId() + SetPersonalIdLabel() + SetPlace() + SetPlaceLabel() + + + 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 SetBeginDate() + + + ' Set the BeginDate TextBox on the webpage with value from the + ' PersonalExtWork database record. + + ' Me.DataSource is the PersonalExtWork record retrieved from the database. + ' Me.BeginDate is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetBeginDate() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.BeginDateSpecified Then + + ' If the BeginDate is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalExtWorkTable.BeginDate, "d MMM yy") + + Me.BeginDate.Text = formattedValue + + Else + + ' BeginDate is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.BeginDate.Text = PersonalExtWorkTable.BeginDate.Format(PersonalExtWorkTable.BeginDate.DefaultValue, "d MMM yy") + + End If + + End Sub + + Public Overridable Sub SetCommand() + + + ' Set the Command TextBox on the webpage with value from the + ' PersonalExtWork database record. + + ' Me.DataSource is the PersonalExtWork record retrieved from the database. + ' Me.Command is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetCommand() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.CommandSpecified Then + + ' If the Command is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalExtWorkTable.Command) + + Me.Command.Text = formattedValue + + Else + + ' Command is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.Command.Text = PersonalExtWorkTable.Command.Format(PersonalExtWorkTable.Command.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetCommandDate() + + + ' Set the CommandDate TextBox on the webpage with value from the + ' PersonalExtWork database record. + + ' Me.DataSource is the PersonalExtWork record retrieved from the database. + ' Me.CommandDate is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetCommandDate() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.CommandDateSpecified Then + + ' If the CommandDate is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalExtWorkTable.CommandDate, "d MMM yy") + + Me.CommandDate.Text = formattedValue + + Else + + ' CommandDate is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.CommandDate.Text = PersonalExtWorkTable.CommandDate.Format(PersonalExtWorkTable.CommandDate.DefaultValue, "d MMM yy") + + End If + + End Sub + + Public Overridable Sub SetDescription() + + + ' Set the Description TextBox on the webpage with value from the + ' PersonalExtWork database record. + + ' Me.DataSource is the PersonalExtWork record retrieved from the database. + ' Me.Description is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetDescription() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.DescriptionSpecified Then + + ' If the Description is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalExtWorkTable.Description) + + Me.Description.Text = formattedValue + + Else + + ' Description is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.Description.Text = PersonalExtWorkTable.Description.Format(PersonalExtWorkTable.Description.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetEndDate() + + + ' Set the EndDate TextBox on the webpage with value from the + ' PersonalExtWork database record. + + ' Me.DataSource is the PersonalExtWork record retrieved from the database. + ' Me.EndDate is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetEndDate() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.EndDateSpecified Then + + ' If the EndDate is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalExtWorkTable.EndDate, "d MMM yy") + + Me.EndDate.Text = formattedValue + + Else + + ' EndDate is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.EndDate.Text = PersonalExtWorkTable.EndDate.Format(PersonalExtWorkTable.EndDate.DefaultValue, "d MMM yy") + + End If + + End Sub + + Public Overridable Sub SetPersonalId() + + + ' Set the PersonalId TextBox on the webpage with value from the + ' PersonalExtWork database record. + + ' Me.DataSource is the PersonalExtWork record retrieved from the database. + ' Me.PersonalId is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetPersonalId() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.PersonalIdSpecified Then + + ' If the PersonalId is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalExtWorkTable.PersonalId) + + Me.PersonalId.Text = formattedValue + + Else + + ' PersonalId is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.PersonalId.Text = PersonalExtWorkTable.PersonalId.Format(PersonalExtWorkTable.PersonalId.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetPlace() + + + ' Set the Place TextBox on the webpage with value from the + ' PersonalExtWork database record. + + ' Me.DataSource is the PersonalExtWork record retrieved from the database. + ' Me.Place is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetPlace() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.PlaceSpecified Then + + ' If the Place is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalExtWorkTable.Place) + + Me.Place.Text = formattedValue + + Else + + ' Place is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.Place.Text = PersonalExtWorkTable.Place.Format(PersonalExtWorkTable.Place.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetBeginDateLabel() + + End Sub + + Public Overridable Sub SetCommandDateLabel() + + End Sub + + Public Overridable Sub SetCommandLabel() + + End Sub + + Public Overridable Sub SetDescriptionLabel() + + End Sub + + Public Overridable Sub SetEndDateLabel() + + End Sub + + Public Overridable Sub SetPersonalExtWorkRecordControlCollapsibleRegion() + + End Sub + + Public Overridable Sub SetPersonalExtWorkRecordControlIcon() + + End Sub + + Public Overridable Sub SetPersonalExtWorkRecordControlPanelExtender() + + End Sub + + Public Overridable Sub SetPersonalIdLabel() + + End Sub + + Public Overridable Sub SetPlaceLabel() + + 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 PersonalExtWorkRecordControl. + 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, "PersonalExtWorkRecordControlPanel"), 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 PersonalExtWorkRecordControl. + 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. + + GetBeginDate() + GetCommand() + GetCommandDate() + GetDescription() + GetEndDate() + GetPersonalId() + GetPlace() + End Sub + + + Public Overridable Sub GetBeginDate() + + ' Retrieve the value entered by the user on the BeginDate ASP:TextBox, and + ' save it into the BeginDate field in DataSource PersonalExtWork 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.BeginDate.Text, PersonalExtWorkTable.BeginDate) + + + End Sub + + Public Overridable Sub GetCommand() + + ' Retrieve the value entered by the user on the Command ASP:TextBox, and + ' save it into the Command field in DataSource PersonalExtWork record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.Command.Text, PersonalExtWorkTable.Command) + + + End Sub + + Public Overridable Sub GetCommandDate() + + ' Retrieve the value entered by the user on the CommandDate ASP:TextBox, and + ' save it into the CommandDate field in DataSource PersonalExtWork 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.CommandDate.Text, PersonalExtWorkTable.CommandDate) + + + End Sub + + Public Overridable Sub GetDescription() + + ' Retrieve the value entered by the user on the Description ASP:TextBox, and + ' save it into the Description field in DataSource PersonalExtWork record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.Description.Text, PersonalExtWorkTable.Description) + + + End Sub + + Public Overridable Sub GetEndDate() + + ' Retrieve the value entered by the user on the EndDate ASP:TextBox, and + ' save it into the EndDate field in DataSource PersonalExtWork 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.EndDate.Text, PersonalExtWorkTable.EndDate) + + + End Sub + + Public Overridable Sub GetPersonalId() + + ' Retrieve the value entered by the user on the PersonalId ASP:TextBox, and + ' save it into the PersonalId field in DataSource PersonalExtWork record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.PersonalId.Text, PersonalExtWorkTable.PersonalId) + + + End Sub + + Public Overridable Sub GetPlace() + + ' Retrieve the value entered by the user on the Place ASP:TextBox, and + ' save it into the Place field in DataSource PersonalExtWork record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.Place.Text, PersonalExtWorkTable.Place) + + + End Sub + + + ' To customize, override this method in PersonalExtWorkRecordControl. + + Public Overridable Function CreateWhereClause() As WhereClause + + Dim wc As WhereClause + PersonalExtWorkTable.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("PersonalExtWork") + + 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}", "PersonalExtWork")) + End If + HttpContext.Current.Session("QueryString in EditPersonalExtWork") = 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(PersonalExtWorkTable.id0, BaseFilter.ComparisonOperator.EqualsTo, pkValue.GetColumnValueString(PersonalExtWorkTable.id0)) + + Else + ' The URL parameter contains the actual value, not an XML structure. + + wc.iAND(PersonalExtWorkTable.id0, 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 + PersonalExtWorkTable.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 PersonalExtWorkRecordControl. + 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) + PersonalExtWorkTable.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. + + Protected Overridable Sub BeginDate_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub Command_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub CommandDate_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub Description_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub EndDate_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub PersonalId_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub Place_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("BasePersonalExtWorkRecordControl_Rec"), String) + End Get + Set(ByVal value As String) + Me.ViewState("BasePersonalExtWorkRecordControl_Rec") = value + End Set + End Property + + Private _DataSource As PersonalExtWorkRecord + Public Property DataSource() As PersonalExtWorkRecord + Get + Return Me._DataSource + End Get + + Set(ByVal value As PersonalExtWorkRecord) + + 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 BeginDate() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "BeginDate"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property BeginDateLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "BeginDateLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property Command() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Command"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property CommandDate() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "CommandDate"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property CommandDateLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "CommandDateLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property CommandLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "CommandLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property Description() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Description"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property DescriptionLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "DescriptionLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property EndDate() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "EndDate"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property EndDateLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "EndDateLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property PersonalExtWorkRecordControlCollapsibleRegion() As System.Web.UI.WebControls.Panel + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalExtWorkRecordControlCollapsibleRegion"), System.Web.UI.WebControls.Panel) + End Get + End Property + + Public ReadOnly Property PersonalExtWorkRecordControlIcon() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalExtWorkRecordControlIcon"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalExtWorkRecordControlPanelExtender() As AjaxControlToolkit.CollapsiblePanelExtender + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalExtWorkRecordControlPanelExtender"), AjaxControlToolkit.CollapsiblePanelExtender) + End Get + End Property + + Public ReadOnly Property PersonalExtWorkTitle() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalExtWorkTitle"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property PersonalId() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalId"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property PersonalIdLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalIdLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property Place() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Place"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property PlaceLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PlaceLabel"), 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 PersonalExtWorkRecord = 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 PersonalExtWorkRecord + If Not Me.DataSource Is Nothing Then + Return Me.DataSource + End If + + If Not Me.RecordUniqueId Is Nothing Then + + Return PersonalExtWorkTable.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 + + \ No newline at end of file diff --git a/App_Code/PersonalExtWork/EditPersonalExtWorkTable.Controls.vb b/App_Code/PersonalExtWork/EditPersonalExtWorkTable.Controls.vb new file mode 100644 index 0000000..d9b12b6 --- /dev/null +++ b/App_Code/PersonalExtWork/EditPersonalExtWorkTable.Controls.vb @@ -0,0 +1,3565 @@ + +' This file implements the TableControl, TableControlRow, and RecordControl classes for the +' EditPersonalExtWorkTable.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.EditPersonalExtWorkTable + +#Region "Section 1: Place your customizations here." + + +Public Class PersonalExtWorkTableControlRow + Inherits BasePersonalExtWorkTableControlRow + ' The BasePersonalExtWorkTableControlRow implements code for a ROW within the + ' the PersonalExtWorkTableControl table. The BasePersonalExtWorkTableControlRow implements the DataBind and SaveData methods. + ' The loading of data is actually performed by the LoadData method in the base class of PersonalExtWorkTableControl. + + ' This is the ideal place to add your code customizations. For example, you can override the DataBind, + ' SaveData, GetUIData, and Validate methods. + + +End Class + + + +Public Class PersonalExtWorkTableControl + Inherits BasePersonalExtWorkTableControl + + ' The BasePersonalExtWorkTableControl class implements the LoadData, DataBind, CreateWhereClause + ' and other methods to load and display the data in a table control. + + ' This is the ideal place to add your code customizations. You can override the LoadData and CreateWhereClause, + ' The PersonalExtWorkTableControlRow class offers another place where you can customize + ' the DataBind, GetUIData, SaveData and Validate methods specific to each row displayed on the table. + +End Class + + + +#End Region + + + +#Region "Section 2: Do not modify this section." + + +' Base class for the PersonalExtWorkTableControlRow control on the EditPersonalExtWorkTable page. +' Do not modify this class. Instead override any method in PersonalExtWorkTableControlRow. +Public Class BasePersonalExtWorkTableControlRow + Inherits Persons.UI.BaseApplicationRecordControl + + ' To customize, override this method in PersonalExtWorkTableControlRow. + Protected Overridable Sub Control_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Init + + Me.ClearControlsFromSession() + End Sub + + ' To customize, override this method in PersonalExtWorkTableControlRow. + Protected Overridable Sub Control_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load + + 'Call LoadFocusScripts from repeater so that onfocus attribute could be added to elements + Me.Page.LoadFocusScripts(Me) + + ' Show confirmation message on Click + Me.PersonalExtWorkRowDeleteButton.Attributes.Add("onClick", "return (confirm('" & (CType(Me.Page,BaseApplicationPage)).GetResourceValue("DeleteRecordConfirm", "Persons") & "'));") + + + ' Register the event handlers. + + AddHandler Me.PersonalExtWorkRowDeleteButton.Click, AddressOf PersonalExtWorkRowDeleteButton_Click + + AddHandler Me.PersonalExtWorkRowEditButton.Click, AddressOf PersonalExtWorkRowEditButton_Click + + AddHandler Me.PersonalExtWorkRowViewButton.Click, AddressOf PersonalExtWorkRowViewButton_Click + + AddHandler Me.BeginDate.TextChanged, AddressOf BeginDate_TextChanged + + AddHandler Me.Command.TextChanged, AddressOf Command_TextChanged + + AddHandler Me.CommandDate.TextChanged, AddressOf CommandDate_TextChanged + + AddHandler Me.Description.TextChanged, AddressOf Description_TextChanged + + AddHandler Me.EndDate.TextChanged, AddressOf EndDate_TextChanged + + AddHandler Me.PersonalId.TextChanged, AddressOf PersonalId_TextChanged + + AddHandler Me.Place.TextChanged, AddressOf Place_TextChanged + + + End Sub + + + Public Overridable Sub LoadData() + + ' Load the data from the database into the DataSource PersonalExtWork 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 = PersonalExtWorkTable.GetRecord(Me.RecordUniqueId, True) + + Return + End If + + ' Since this is a row in the table, the data for this row is loaded by the + ' LoadData method of the BasePersonalExtWorkTableControl when the data for the entire + ' table is loaded. + + Me.DataSource = New PersonalExtWorkRecord() + + + + End Sub + + ' Populate the UI controls using the DataSource. To customize, override this method in PersonalExtWorkTableControlRow. + 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 + + SetBeginDate() + SetCommand() + SetCommandDate() + SetDescription() + SetEndDate() + + + + + SetPersonalId() + SetPlace() + + + 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 SetBeginDate() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.BeginDate.ID) Then + + Me.BeginDate.Text = Me.PreviousUIData(Me.BeginDate.ID).ToString() + + Return + End If + + + ' Set the BeginDate TextBox on the webpage with value from the + ' PersonalExtWork database record. + + ' Me.DataSource is the PersonalExtWork record retrieved from the database. + ' Me.BeginDate is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetBeginDate() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.BeginDateSpecified Then + + ' If the BeginDate is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalExtWorkTable.BeginDate, "d MMM yyyy") + + Me.BeginDate.Text = formattedValue + + Else + + ' BeginDate is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.BeginDate.Text = PersonalExtWorkTable.BeginDate.Format(PersonalExtWorkTable.BeginDate.DefaultValue, "d MMM yyyy") + + End If + + End Sub + + Public Overridable Sub SetCommand() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.Command.ID) Then + + Me.Command.Text = Me.PreviousUIData(Me.Command.ID).ToString() + + Return + End If + + + ' Set the Command TextBox on the webpage with value from the + ' PersonalExtWork database record. + + ' Me.DataSource is the PersonalExtWork record retrieved from the database. + ' Me.Command is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetCommand() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.CommandSpecified Then + + ' If the Command is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalExtWorkTable.Command) + + Me.Command.Text = formattedValue + + Else + + ' Command is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.Command.Text = PersonalExtWorkTable.Command.Format(PersonalExtWorkTable.Command.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetCommandDate() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.CommandDate.ID) Then + + Me.CommandDate.Text = Me.PreviousUIData(Me.CommandDate.ID).ToString() + + Return + End If + + + ' Set the CommandDate TextBox on the webpage with value from the + ' PersonalExtWork database record. + + ' Me.DataSource is the PersonalExtWork record retrieved from the database. + ' Me.CommandDate is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetCommandDate() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.CommandDateSpecified Then + + ' If the CommandDate is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalExtWorkTable.CommandDate, "d MMM yyyy") + + Me.CommandDate.Text = formattedValue + + Else + + ' CommandDate is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.CommandDate.Text = PersonalExtWorkTable.CommandDate.Format(PersonalExtWorkTable.CommandDate.DefaultValue, "d MMM yyyy") + + End If + + End Sub + + Public Overridable Sub SetDescription() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.Description.ID) Then + + Me.Description.Text = Me.PreviousUIData(Me.Description.ID).ToString() + + Return + End If + + + ' Set the Description TextBox on the webpage with value from the + ' PersonalExtWork database record. + + ' Me.DataSource is the PersonalExtWork record retrieved from the database. + ' Me.Description is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetDescription() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.DescriptionSpecified Then + + ' If the Description is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalExtWorkTable.Description) + + Me.Description.Text = formattedValue + + Else + + ' Description is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.Description.Text = PersonalExtWorkTable.Description.Format(PersonalExtWorkTable.Description.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetEndDate() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.EndDate.ID) Then + + Me.EndDate.Text = Me.PreviousUIData(Me.EndDate.ID).ToString() + + Return + End If + + + ' Set the EndDate TextBox on the webpage with value from the + ' PersonalExtWork database record. + + ' Me.DataSource is the PersonalExtWork record retrieved from the database. + ' Me.EndDate is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetEndDate() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.EndDateSpecified Then + + ' If the EndDate is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalExtWorkTable.EndDate, "d MMM yyyy") + + Me.EndDate.Text = formattedValue + + Else + + ' EndDate is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.EndDate.Text = PersonalExtWorkTable.EndDate.Format(PersonalExtWorkTable.EndDate.DefaultValue, "d MMM yyyy") + + End If + + End Sub + + Public Overridable Sub SetPersonalId() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.PersonalId.ID) Then + + Me.PersonalId.Text = Me.PreviousUIData(Me.PersonalId.ID).ToString() + + Return + End If + + + ' Set the PersonalId TextBox on the webpage with value from the + ' PersonalExtWork database record. + + ' Me.DataSource is the PersonalExtWork record retrieved from the database. + ' Me.PersonalId is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetPersonalId() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.PersonalIdSpecified Then + + ' If the PersonalId is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalExtWorkTable.PersonalId) + + Me.PersonalId.Text = formattedValue + + Else + + ' PersonalId is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.PersonalId.Text = PersonalExtWorkTable.PersonalId.Format(PersonalExtWorkTable.PersonalId.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetPlace() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.Place.ID) Then + + Me.Place.Text = Me.PreviousUIData(Me.Place.ID).ToString() + + Return + End If + + + ' Set the Place TextBox on the webpage with value from the + ' PersonalExtWork database record. + + ' Me.DataSource is the PersonalExtWork record retrieved from the database. + ' Me.Place is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetPlace() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.PlaceSpecified Then + + ' If the Place is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalExtWorkTable.Place) + + Me.Place.Text = formattedValue + + Else + + ' Place is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.Place.Text = PersonalExtWorkTable.Place.Format(PersonalExtWorkTable.Place.DefaultValue) + + End If + + End Sub + + + Public EvaluateFormulaDelegate As BaseClasses.Data.DataSource.EvaluateFormulaDelegate = New BaseClasses.Data.DataSource.EvaluateFormulaDelegate(AddressOf Me.EvaluateFormula) + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean, ByVal e As FormulaEvaluator) As String + If e Is Nothing Then + e = New FormulaEvaluator() + End If + + e.Variables.Clear() + + + ' add variables for formula evaluation + If variables IsNot Nothing Then + Dim enumerator As System.Collections.Generic.IEnumerator(Of System.Collections.Generic.KeyValuePair(Of String, Object)) = variables.GetEnumerator() + While enumerator.MoveNext() + e.Variables.Add(enumerator.Current.Key, enumerator.Current.Value) + End While + End If + + If includeDS + + End IF + + + ' Other variables referred to in the formula are expected to be + ' properties of the DataSource. For example, referring to + ' UnitPrice as a variable will refer to DataSource.UnitPrice + If dataSourceForEvaluate Is Nothing Then + + e.DataSource = Me.DataSource + + Else + e.DataSource = dataSourceForEvaluate + End If + + ' Define the calling control. This is used to add other + ' related table and record controls as variables. + e.CallingControl = Me + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + + If Not String.IsNullOrEmpty(format) AndAlso (String.IsNullOrEmpty(formula) OrElse formula.IndexOf("Format(") < 0) Then + Return FormulaUtils.Format(resultObj, format) + Else + Return resultObj.ToString() + End If + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format,variables ,includeDS, Nothing) + End Function + + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object)) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format, variables ,True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, format, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal e as FormulaEvaluator) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, variables, True, e) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal includeDS as Boolean) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, includeDS, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, True, Nothing) + End Function + + + Public Overridable Sub RegisterPostback() + + + End Sub + + + + ' To customize, override this method in PersonalExtWorkTableControlRow. + Public Overridable Sub SaveData() + ' Saves the associated record in the database. + ' SaveData calls Validate and Get methods - so it may be more appropriate to + ' customize those methods. + + ' 1. Load the existing record from the database. Since we save the entire record, this ensures + ' that fields that are not displayed are also properly initialized. + Me.LoadData() + + + ' 2. Perform any custom validation. + Me.Validate() + + + ' 3. Set the values in the record with data from UI controls. + ' This calls the Get() method for each of the user interface controls. + Me.GetUIData() + + ' 4. Save in the database. + ' We should not save the record if the data did not change. This + ' will save a database hit and avoid triggering any database triggers. + + If Me.DataSource.IsAnyValueChanged Then + ' Save record to database but do not commit yet. + ' Auto generated ids are available after saving for use by child (dependent) records. + Me.DataSource.Save() + + DirectCast(GetParentControlObject(Me, "PersonalExtWorkTableControl"), PersonalExtWorkTableControl).DataChanged = True + DirectCast(GetParentControlObject(Me, "PersonalExtWorkTableControl"), PersonalExtWorkTableControl).ResetData = True + End If + + + ' update session or cookie by formula + + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + ' For Master-Detail relationships, save data on the Detail table(s) + + End Sub + + ' To customize, override this method in PersonalExtWorkTableControlRow. + 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. + + GetBeginDate() + GetCommand() + GetCommandDate() + GetDescription() + GetEndDate() + GetPersonalId() + GetPlace() + End Sub + + + Public Overridable Sub GetBeginDate() + + ' Retrieve the value entered by the user on the BeginDate ASP:TextBox, and + ' save it into the BeginDate field in DataSource PersonalExtWork 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.BeginDate.Text, PersonalExtWorkTable.BeginDate) + + + End Sub + + Public Overridable Sub GetCommand() + + ' Retrieve the value entered by the user on the Command ASP:TextBox, and + ' save it into the Command field in DataSource PersonalExtWork record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.Command.Text, PersonalExtWorkTable.Command) + + + End Sub + + Public Overridable Sub GetCommandDate() + + ' Retrieve the value entered by the user on the CommandDate ASP:TextBox, and + ' save it into the CommandDate field in DataSource PersonalExtWork 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.CommandDate.Text, PersonalExtWorkTable.CommandDate) + + + End Sub + + Public Overridable Sub GetDescription() + + ' Retrieve the value entered by the user on the Description ASP:TextBox, and + ' save it into the Description field in DataSource PersonalExtWork record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.Description.Text, PersonalExtWorkTable.Description) + + + End Sub + + Public Overridable Sub GetEndDate() + + ' Retrieve the value entered by the user on the EndDate ASP:TextBox, and + ' save it into the EndDate field in DataSource PersonalExtWork 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.EndDate.Text, PersonalExtWorkTable.EndDate) + + + End Sub + + Public Overridable Sub GetPersonalId() + + ' Retrieve the value entered by the user on the PersonalId ASP:TextBox, and + ' save it into the PersonalId field in DataSource PersonalExtWork record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.PersonalId.Text, PersonalExtWorkTable.PersonalId) + + + End Sub + + Public Overridable Sub GetPlace() + + ' Retrieve the value entered by the user on the Place ASP:TextBox, and + ' save it into the Place field in DataSource PersonalExtWork record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.Place.Text, PersonalExtWorkTable.Place) + + + End Sub + + + ' To customize, override this method in PersonalExtWorkTableControlRow. + + Public Overridable Function CreateWhereClause() As WhereClause + + Return Nothing + + End Function + + + + ' To customize, override this method in PersonalExtWorkTableControlRow. + 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) + PersonalExtWorkTable.DeleteRecord(pkValue) + + DirectCast(GetParentControlObject(Me, "PersonalExtWorkTableControl"), PersonalExtWorkTableControl).DataChanged = True + DirectCast(GetParentControlObject(Me, "PersonalExtWorkTableControl"), PersonalExtWorkTableControl).ResetData = True + End Sub + + Protected Overridable Sub Control_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.PreRender + ' PreRender event is raised just before page is being displayed. + Try + DbUtils.StartTransaction() + Me.RegisterPostback() + + If Not Me.Page.ErrorOnPage AndAlso (Me.Page.IsPageRefresh OrElse Me.DataChanged OrElse Me.ResetData) Then + + + ' Re-load the data and update the web page if necessary. + ' This is typically done during a postback (filter, search button, sort, pagination button). + ' In each of the other click handlers, simply set DataChanged to True to reload the data. + Me.LoadData() + Me.DataBind() + End If + + + Catch ex As Exception + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + Finally + DbUtils.EndTransaction() + End Try + End Sub + + + Protected Overrides Sub SaveControlsToSession() + MyBase.SaveControlsToSession() + + + 'Save pagination state to session. + + End Sub + + + + Protected Overrides Sub ClearControlsFromSession() + MyBase.ClearControlsFromSession() + + + + ' Clear pagination state from session. + + End Sub + + Protected Overrides Sub LoadViewState(ByVal savedState As Object) + MyBase.LoadViewState(savedState) + Dim isNewRecord As String = CType(ViewState("IsNewRecord"), String) + If Not isNewRecord Is Nothing AndAlso isNewRecord.Trim <> "" Then + Me.IsNewRecord = Boolean.Parse(isNewRecord) + End If + + Dim myCheckSum As String = CType(ViewState("CheckSum"), String) + If Not myCheckSum Is Nothing AndAlso myCheckSum.Trim <> "" Then + Me.CheckSum = myCheckSum + End If + + + ' Load view state for pagination control. + + End Sub + + Protected Overrides Function SaveViewState() As Object + ViewState("IsNewRecord") = Me.IsNewRecord.ToString() + ViewState("CheckSum") = Me.CheckSum + + + ' Load view state for pagination control. + + Return MyBase.SaveViewState() + End Function + + + ' event handler for ImageButton + Public Overridable Sub PersonalExtWorkRowDeleteButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + If(Not Me.Page.IsPageRefresh) Then + + Dim tc As PersonalExtWorkTableControl = DirectCast(GetParentControlObject(Me, "PersonalExtWorkTableControl"), PersonalExtWorkTableControl) + If Not (IsNothing(tc)) Then + If Not Me.IsNewRecord Then + tc.AddToDeletedRecordIds(DirectCast(Me, PersonalExtWorkTableControlRow)) + End If + Me.Visible = False + tc.SetFormulaControls() + End If + + End If + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalExtWorkRowEditButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + ' The redirect URL is set on the Properties, Custom Properties or Actions. + ' The ModifyRedirectURL call resolves the parameters before the + ' Response.Redirect redirects the page to the URL. + ' Any code after the Response.Redirect call will not be executed, since the page is + ' redirected to the URL. + + + Dim url As String = "../PersonalExtWork/EditPersonalExtWork.aspx?PersonalExtWork={PK}" + + Dim shouldRedirect As Boolean = True + Dim TargetKey As String = Nothing + Dim DFKA As String = TargetKey + Dim id As String = DFKA + Dim value As String = id + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + url = Me.ModifyRedirectUrl(url, "",False) + url = Me.Page.ModifyRedirectUrl(url, "",False) + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + shouldRedirect = False + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + If shouldRedirect Then + Me.Page.ShouldSaveControlsToSession = True + Me.Page.Response.Redirect(url) + ElseIf Not TargetKey Is Nothing AndAlso _ + Not shouldRedirect Then + Me.Page.ShouldSaveControlsToSession = True + Me.Page.CloseWindow(True) + + End If + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalExtWorkRowViewButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + ' The redirect URL is set on the Properties, Custom Properties or Actions. + ' The ModifyRedirectURL call resolves the parameters before the + ' Response.Redirect redirects the page to the URL. + ' Any code after the Response.Redirect call will not be executed, since the page is + ' redirected to the URL. + + + Dim url As String = "../PersonalExtWork/ShowPersonalExtWork.aspx?PersonalExtWork={PK}" + + Dim shouldRedirect As Boolean = True + Dim TargetKey As String = Nothing + Dim DFKA As String = TargetKey + Dim id As String = DFKA + Dim value As String = id + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + url = Me.ModifyRedirectUrl(url, "",False) + url = Me.Page.ModifyRedirectUrl(url, "",False) + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + shouldRedirect = False + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + If shouldRedirect Then + Me.Page.ShouldSaveControlsToSession = True + Me.Page.Response.Redirect(url) + ElseIf Not TargetKey Is Nothing AndAlso _ + Not shouldRedirect Then + Me.Page.ShouldSaveControlsToSession = True + Me.Page.CloseWindow(True) + + End If + End Sub + + Protected Overridable Sub BeginDate_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub Command_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub CommandDate_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub Description_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub EndDate_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub PersonalId_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub Place_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("BasePersonalExtWorkTableControlRow_Rec"), String) + End Get + Set(ByVal value As String) + Me.ViewState("BasePersonalExtWorkTableControlRow_Rec") = value + End Set + End Property + + Private _DataSource As PersonalExtWorkRecord + Public Property DataSource() As PersonalExtWorkRecord + Get + Return Me._DataSource + End Get + + Set(ByVal value As PersonalExtWorkRecord) + + Me._DataSource = value + End Set + End Property + + + + Private _checkSum As String + Public Overridable Property CheckSum() As String + Get + Return Me._checkSum + End Get + Set(ByVal value As String) + Me._checkSum = value + End Set + End Property + + Private _TotalPages As Integer + Public Property TotalPages() As Integer + Get + Return Me._TotalPages + End Get + Set(ByVal value As Integer) + Me._TotalPages = value + End Set + End Property + + Private _PageIndex As Integer + Public Property PageIndex() As Integer + Get + ' Return the PageIndex + Return Me._PageIndex + End Get + Set(ByVal value As Integer) + Me._PageIndex = value + End Set + End Property + + Private _DisplayLastPage As Boolean + Public Property DisplayLastPage() As Boolean + Get + Return Me._DisplayLastPage + End Get + Set(ByVal value As Boolean) + Me._DisplayLastPage = value + End Set + End Property + + + +#Region "Helper Properties" + + Public ReadOnly Property BeginDate() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "BeginDate"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property Command() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Command"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property CommandDate() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "CommandDate"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property Description() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Description"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property EndDate() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "EndDate"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property PersonalExtWorkRecordRowSelection() As System.Web.UI.WebControls.CheckBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalExtWorkRecordRowSelection"), System.Web.UI.WebControls.CheckBox) + End Get + End Property + + Public ReadOnly Property PersonalExtWorkRowDeleteButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalExtWorkRowDeleteButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalExtWorkRowEditButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalExtWorkRowEditButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalExtWorkRowViewButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalExtWorkRowViewButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalId() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalId"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property Place() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Place"), System.Web.UI.WebControls.TextBox) + 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 PersonalExtWorkRecord = 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 PersonalExtWorkRecord + If Not Me.DataSource Is Nothing Then + Return Me.DataSource + End If + + If Not Me.RecordUniqueId Is Nothing Then + + Return PersonalExtWorkTable.GetRecord(Me.RecordUniqueId, True) + + End If + + ' Localization. + + Throw New Exception(Page.GetResourceValue("Err:RetrieveRec", "Persons")) + + End Function + + Public Shadows ReadOnly Property Page() As BaseApplicationPage + Get + Return DirectCast(MyBase.Page, BaseApplicationPage) + End Get + End Property + +#End Region + +End Class + + + +' Base class for the PersonalExtWorkTableControl control on the EditPersonalExtWorkTable page. +' Do not modify this class. Instead override any method in PersonalExtWorkTableControl. +Public Class BasePersonalExtWorkTableControl + Inherits Persons.UI.BaseApplicationTableControl + + + + Protected Overridable Sub Control_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Init + + + + ' Setup the filter and search events. + + AddHandler Me.DescriptionFilter.SelectedIndexChanged, AddressOf DescriptionFilter_SelectedIndexChanged + AddHandler Me.PersonalIdFilter.SelectedIndexChanged, AddressOf PersonalIdFilter_SelectedIndexChanged + If Not Me.Page.IsPostBack Then + Dim initialVal As String = "" + If Me.InSession(Me.DescriptionFilter) + initialVal = Me.GetFromSession(Me.DescriptionFilter) + + End If + + If initialVal <> "" + + Me.DescriptionFilter.Items.Add(New ListItem(initialVal, initialVal)) + + Me.DescriptionFilter.SelectedValue = initialVal + + End If + + End If + If Not Me.Page.IsPostBack Then + Dim initialVal As String = "" + If Me.InSession(Me.PersonalExtWorkSearch) + initialVal = Me.GetFromSession(Me.PersonalExtWorkSearch) + + End If + + If initialVal <> "" + + Me.PersonalExtWorkSearch.Text = initialVal + + End If + + End If + If Not Me.Page.IsPostBack Then + Dim initialVal As String = "" + If Me.InSession(Me.PersonalIdFilter) + initialVal = Me.GetFromSession(Me.PersonalIdFilter) + + End If + + If initialVal <> "" + + Me.PersonalIdFilter.Items.Add(New ListItem(initialVal, initialVal)) + + Me.PersonalIdFilter.SelectedValue = initialVal + + End If + + End If + + + ' Control Initializations. + ' Initialize the table's current sort order. + + If Me.InSession(Me, "Order_By") Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + End If + + + + ' Setup default pagination settings. + + Me.PageSize = CInt(Me.GetFromSession(Me, "Page_Size", "10")) + Me.PageIndex = CInt(Me.GetFromSession(Me, "Page_Index", "0")) + + + + Me.ClearControlsFromSession() + End Sub + + Protected Overridable Sub Control_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load + + SaveControlsToSession_Ajax() + + ' Show confirmation message on Click + Me.PersonalExtWorkDeleteButton.Attributes.Add("onClick", "return (confirm('" & (CType(Me.Page,BaseApplicationPage)).GetResourceValue("DeleteConfirm", "Persons") & "'));") + + ' Setup the pagination events. + + AddHandler Me.PersonalExtWorkPagination.FirstPage.Click, AddressOf PersonalExtWorkPagination_FirstPage_Click + + AddHandler Me.PersonalExtWorkPagination.LastPage.Click, AddressOf PersonalExtWorkPagination_LastPage_Click + + AddHandler Me.PersonalExtWorkPagination.NextPage.Click, AddressOf PersonalExtWorkPagination_NextPage_Click + + AddHandler Me.PersonalExtWorkPagination.PageSizeButton.Click, AddressOf PersonalExtWorkPagination_PageSizeButton_Click + + AddHandler Me.PersonalExtWorkPagination.PreviousPage.Click, AddressOf PersonalExtWorkPagination_PreviousPage_Click + + + ' Setup the sorting events. + + AddHandler Me.BeginDateLabel.Click, AddressOf BeginDateLabel_Click + + AddHandler Me.CommandDateLabel.Click, AddressOf CommandDateLabel_Click + + AddHandler Me.CommandLabel.Click, AddressOf CommandLabel_Click + + AddHandler Me.DescriptionLabel1.Click, AddressOf DescriptionLabel1_Click + + AddHandler Me.EndDateLabel.Click, AddressOf EndDateLabel_Click + + AddHandler Me.PersonalIdLabel1.Click, AddressOf PersonalIdLabel1_Click + + AddHandler Me.PlaceLabel.Click, AddressOf PlaceLabel_Click + + ' Setup the button events. + + AddHandler Me.PersonalExtWorkAddButton.Click, AddressOf PersonalExtWorkAddButton_Click + + AddHandler Me.PersonalExtWorkDeleteButton.Click, AddressOf PersonalExtWorkDeleteButton_Click + + AddHandler Me.PersonalExtWorkEditButton.Click, AddressOf PersonalExtWorkEditButton_Click + + AddHandler Me.PersonalExtWorkRefreshButton.Click, AddressOf PersonalExtWorkRefreshButton_Click + + AddHandler Me.PersonalExtWorkResetButton.Click, AddressOf PersonalExtWorkResetButton_Click + + AddHandler Me.PersonalExtWorkSaveButton.Click, AddressOf PersonalExtWorkSaveButton_Click + + Me.PersonalExtWorkSaveButton.Attributes.Add("onclick", "SubmitHRefOnce(this, """ & Me.Page.GetResourceValue("Txt:SaveRecord", "Persons") & """);") + + AddHandler Me.PersonalExtWorkSearchButton.Button.Click, AddressOf PersonalExtWorkSearchButton_Click + + + ' Setup events for others + + End Sub + + + Public Overridable Sub LoadData() + + ' Read data from database. Returns an array of records that can be assigned + ' to the DataSource table control property. + Try + Dim joinFilter As CompoundFilter = CreateCompoundJoinFilter() + + ' The WHERE clause will be empty when displaying all records in table. + Dim wc As WhereClause = CreateWhereClause() + If wc IsNot Nothing AndAlso Not wc.RunQuery Then + ' Initialize an empty array of records + Dim alist As New ArrayList(0) + Me.DataSource = DirectCast(alist.ToArray(GetType(PersonalExtWorkRecord)), PersonalExtWorkRecord()) + ' Add records to the list if needed. + Me.AddNewRecords() + Me._TotalRecords = 0 + Me._TotalPages = 0 + Return + End If + + ' Call OrderBy to determine the order - either use the order defined + ' on the Query Wizard, or specified by user (by clicking on column heading) + Dim orderBy As OrderBy = CreateOrderBy() + + ' Get the pagesize from the pagesize control. + Me.GetPageSize() + + If Me.DisplayLastPage Then + Dim totalRecords As Integer = If(Me._TotalRecords < 0, PersonalExtWorkTable.GetRecordCount(CreateCompoundJoinFilter(), CreateWhereClause()), Me._TotalRecords) + + Dim totalPages As Integer = CInt(Math.Ceiling(totalRecords / Me.PageSize)) + + Me.PageIndex = totalPages - 1 + End If + + ' Make sure PageIndex (current page) and PageSize are within bounds. + If Me.PageIndex < 0 Then + Me.PageIndex = 0 + End If + If Me.PageSize < 1 Then + Me.PageSize = 1 + End If + + ' Retrieve the records and set the table DataSource. + ' Only PageSize records are fetched starting at PageIndex (zero based). + If Me.AddNewRecord > 0 Then + ' Make sure to preserve the previously entered data on new rows. + Dim postdata As New ArrayList + For Each rc As PersonalExtWorkTableControlRow In Me.GetRecordControls() + If Not rc.IsNewRecord Then + rc.DataSource = rc.GetRecord() + rc.GetUIData() + postdata.Add(rc.DataSource) + UIData.Add(rc.PreservedUIData()) + End If + Next + Me.DataSource = DirectCast(postdata.ToArray(GetType(PersonalExtWorkRecord)), PersonalExtWorkRecord()) + Else ' Get the records from the database + Me.DataSource = PersonalExtWorkTable.GetRecords(joinFilter, wc, orderBy, Me.PageIndex, Me.PageSize) + + End If + + ' if the datasource contains no records contained in database, then load the last page. + If (DbUtils.GetCreatedRecords(Me.DataSource).Length = 0 AndAlso Not Me.DisplayLastPage) Then + Me.DisplayLastPage = True + LoadData() + Else + + ' Add any new rows desired by the user. + Me.AddNewRecords() + + ' Turn off the ToggleAll checkbox + Me.PersonalExtWorkToggleAll.Checked = False + + + ' Initialize the page and grand totals. now + + End If + + Catch ex As Exception + ' Report the error message to the end user + Dim msg As String = ex.Message + If ex.InnerException IsNot Nothing Then + msg = msg & " InnerException: " & ex.InnerException.Message + End If + Throw New Exception(msg, ex.InnerException) + End Try + End Sub + + + + + Public Overrides Sub DataBind() + ' The DataBind method binds the user interface controls to the values + ' from the database record for each row in the table. To do this, it calls the + ' DataBind for each of the rows. + ' DataBind also populates any filters above the table, and sets the pagination + ' control to the correct number of records and the current page number. + + MyBase.DataBind() + + ' Make sure that the DataSource is initialized. + If Me.DataSource Is Nothing Then + Return + End If + + 'LoadData for DataSource for chart and report if they exist + + ' Setup the pagination controls. + BindPaginationControls() + + + + ' Bind the repeater with the list of records to expand the UI. + Dim rep As System.Web.UI.WebControls.Repeater = CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalExtWorkTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return + rep.DataSource = DataSource() + rep.DataBind() + + Dim index As Integer = 0 + For Each repItem As System.Web.UI.WebControls.RepeaterItem In rep.Items + ' Loop through all rows in the table, set its DataSource and call DataBind(). + Dim recControl As PersonalExtWorkTableControlRow = DirectCast(repItem.FindControl("PersonalExtWorkTableControlRow"), PersonalExtWorkTableControlRow) + recControl.DataSource = Me.DataSource(index) + If Me.UIData.Count > index Then + recControl.PreviousUIData = Me.UIData(index) + End If + recControl.DataBind() + recControl.Visible = Not Me.InDeletedRecordIds(recControl) + + index += 1 + Next + + + + + ' Call the Set methods for each controls on the panel + + SetBeginDateLabel() + SetCommandDateLabel() + SetCommandLabel() + SetDescriptionFilter() + SetDescriptionLabel() + SetDescriptionLabel1() + SetEndDateLabel() + + + + + + + + SetPersonalExtWorkSearch() + + SetPersonalExtWorkTableControlCollapsibleRegion() + SetPersonalExtWorkTableControlIcon() + SetPersonalExtWorkTableControlPanelExtender() + + + SetPersonalIdFilter() + SetPersonalIdLabel() + SetPersonalIdLabel1() + SetPlaceLabel() + ' setting the state of expand or collapse alternative rows + + + ' Load data for each record and table UI control. + ' Ordering is important because child controls get + ' their parent ids from their parent UI controls. + + + ' this method calls the set method for controls with special formula like running total, sum, rank, etc + SetFormulaControls() + End Sub + + Public Overridable Sub SetFormulaControls() + ' this method calls Set methods for the control that has special formula + + + + End Sub + + + + Public Overridable Sub RegisterPostback() + + Me.Page.RegisterPostBackTrigger(MiscUtils.FindControlRecursively(Me,"PersonalExtWorkSaveButton")) + + + End Sub + + Public EvaluateFormulaDelegate As BaseClasses.Data.DataSource.EvaluateFormulaDelegate = New BaseClasses.Data.DataSource.EvaluateFormulaDelegate(AddressOf Me.EvaluateFormula) + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean, ByVal e as FormulaEvaluator) As String + If e Is Nothing + e = New FormulaEvaluator() + End If + + e.Variables.Clear() + + + ' add variables for formula evaluation + If variables IsNot Nothing Then + Dim enumerator As System.Collections.Generic.IEnumerator(Of System.Collections.Generic.KeyValuePair(Of String, Object)) = variables.GetEnumerator() + While enumerator.MoveNext() + e.Variables.Add(enumerator.Current.Key, enumerator.Current.Value) + End While + End If + + If includeDS + + End If + + ' All variables referred to in the formula are expected to be + ' properties of the DataSource. For example, referring to + ' UnitPrice as a variable will refer to DataSource.UnitPrice + e.DataSource = dataSourceForEvaluate + + ' Define the calling control. This is used to add other + ' related table and record controls as variables. + e.CallingControl = Me + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + + If Not String.IsNullOrEmpty(format) AndAlso (String.IsNullOrEmpty(formula) OrElse formula.IndexOf("Format(") < 0) Then + Return FormulaUtils.Format(resultObj, format) + Else + Return resultObj.ToString() + End If + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format,variables ,includeDS, Nothing) + End Function + + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object)) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format, variables ,True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, format, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal e as FormulaEvaluator) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, variables, True, e) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal includeDS as Boolean) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, includeDS, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, True, Nothing) + End Function + + + + + Public Overridable Sub ResetControl() + + Me.DescriptionFilter.ClearSelection() + + Me.PersonalIdFilter.ClearSelection() + + Me.PersonalExtWorkSearch.Text = "" + + Me.CurrentSortOrder.Reset() + If (Me.InSession(Me, "Order_By")) Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + End If + + Me.PageIndex = 0 + End Sub + + Protected Overridable Sub BindPaginationControls() + ' Setup the pagination controls. + + ' Bind the pagination labels. + + If DbUtils.GetCreatedRecords(Me.DataSource).Length > 0 Then + + Me.PersonalExtWorkPagination.CurrentPage.Text = (Me.PageIndex + 1).ToString() + Else + Me.PersonalExtWorkPagination.CurrentPage.Text = "0" + End If + Me.PersonalExtWorkPagination.PageSize.Text = Me.PageSize.ToString() + Me.PersonalExtWorkPagination.TotalItems.Text = Me.TotalRecords.ToString() + Me.PersonalExtWorkPagination.TotalPages.Text = Me.TotalPages.ToString() + + ' Bind the buttons for PersonalExtWorkTableControl pagination. + + Me.PersonalExtWorkPagination.FirstPage.Enabled = Not (Me.PageIndex = 0) + If Me._TotalPages < 0 Then ' if the total pages is not determined yet, enable last and next buttons + Me.PersonalExtWorkPagination.LastPage.Enabled = True + ElseIf Me._TotalPages = 0 ' if the total pages is determined and it is 0, enable last and next buttons + Me.PersonalExtWorkPagination.LastPage.Enabled = False + Else ' if the total pages is the last page, disable last and next buttons + Me.PersonalExtWorkPagination.LastPage.Enabled = Not (Me.PageIndex = Me.TotalPages - 1) + End If + + If Me._TotalPages < 0 Then ' if the total pages is not determined yet, enable last and next buttons + Me.PersonalExtWorkPagination.NextPage.Enabled = True + ElseIf Me._TotalPages = 0 ' if the total pages is determined and it is 0, enable last and next buttons + Me.PersonalExtWorkPagination.NextPage.Enabled = False + Else ' if the total pages is the last page, disable last and next buttons + Me.PersonalExtWorkPagination.NextPage.Enabled = Not (Me.PageIndex = Me.TotalPages - 1) + End If + + Me.PersonalExtWorkPagination.PreviousPage.Enabled = Not (Me.PageIndex = 0) + + + End Sub + + Public Overridable Sub SaveData() + ' Save the data from the entire table. Calls each row's Save Data + ' to save their data. This function is called by the Click handler of the + ' Save button. The button handler should Start/Commit/End a transaction. + + Dim recCtl As PersonalExtWorkTableControlRow + For Each recCtl In Me.GetRecordControls() + + If Me.InDeletedRecordIds(recCtl) Then + ' Delete any pending deletes. + recCtl.Delete() + Else + If recCtl.Visible Then + recCtl.SaveData() + End If + End If + + Next + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + ' Set IsNewRecord to False for all records - since everything has been saved and is no longer "new" + For Each recCtl In Me.GetRecordControls() + recCtl.IsNewRecord = False + Next + + + ' Set DeletedRecordsIds to Nothing since we have deleted all pending deletes. + Me.DeletedRecordIds = Nothing + + End Sub + + Public Overridable Function CreateCompoundJoinFilter() As CompoundFilter + Dim jFilter As CompoundFilter = New CompoundFilter() + + Return jFilter + + End Function + + + Public Overridable Function CreateOrderBy() As OrderBy + ' The CurrentSortOrder is initialized to the sort order on the + ' Query Wizard. It may be modified by the Click handler for any of + ' the column heading to sort or reverse sort by that column. + ' You can add your own sort order, or modify it on the Query Wizard. + Return Me.CurrentSortOrder + End Function + + Public Overridable Function CreateWhereClause() As WhereClause + 'This CreateWhereClause is used for loading the data. + PersonalExtWorkTable.Instance.InnerFilter = Nothing + Dim wc As WhereClause = New WhereClause() + + ' Compose the WHERE clause consiting of: + ' 1. Static clause defined at design time. + ' 2. User selected search criteria. + ' 3. User selected filter criteria. + + + If IsValueSelected(Me.DescriptionFilter) Then + + wc.iAND(PersonalExtWorkTable.Description, BaseFilter.ComparisonOperator.EqualsTo, MiscUtils.GetSelectedValue(Me.DescriptionFilter, Me.GetFromSession(Me.DescriptionFilter)), False, False) + + End If + + + + If IsValueSelected(Me.PersonalExtWorkSearch) Then + If Me.PersonalExtWorkSearch.Text = BaseClasses.Resources.AppResources.GetResourceValue("Txt:SearchForEllipsis", Nothing) Then + Me.PersonalExtWorkSearch.Text = "" + Else + ' Strip "..." from begin and ending of the search text, otherwise the search will return 0 values as in database "..." is not stored. + + If Me.PersonalExtWorkSearch.Text.StartsWith("...") Then + Me.PersonalExtWorkSearch.Text = Me.PersonalExtWorkSearch.Text.SubString(3,Me.PersonalExtWorkSearch.Text.Length-3) + End If + If Me.PersonalExtWorkSearch.Text.EndsWith("...") then + Me.PersonalExtWorkSearch.Text = Me.PersonalExtWorkSearch.Text.SubString(0,Me.PersonalExtWorkSearch.Text.Length-3) + ' Strip the last word as well as it is likely only a partial word + Dim endindex As Integer = PersonalExtWorkSearch.Text.Length - 1 + While (Not Char.IsWhiteSpace(PersonalExtWorkSearch.Text(endindex)) AndAlso endindex > 0) + endindex -= 1 + End While + If endindex > 0 Then + PersonalExtWorkSearch.Text = PersonalExtWorkSearch.Text.Substring(0, endindex) + End If + End If + End If + + Dim formatedSearchText As String = MiscUtils.GetSelectedValue(Me.PersonalExtWorkSearch, Me.GetFromSession(Me.PersonalExtWorkSearch)) + + ' After stripping "..." see if the search text is null or empty. + If IsValueSelected(Me.PersonalExtWorkSearch) Then + ' These clauses are added depending on operator and fields selected in Control's property page, bindings tab. + + Dim search As WhereClause = New WhereClause() + + search.iOR(PersonalExtWorkTable.PersonalId, BaseFilter.ComparisonOperator.Contains, MiscUtils.GetSelectedValue(Me.PersonalExtWorkSearch, Me.GetFromSession(Me.PersonalExtWorkSearch)), True, False) + + search.iOR(PersonalExtWorkTable.Description, BaseFilter.ComparisonOperator.Contains, MiscUtils.GetSelectedValue(Me.PersonalExtWorkSearch, Me.GetFromSession(Me.PersonalExtWorkSearch)), True, False) + + wc.iAND(search) + + End If + End If + + If IsValueSelected(Me.PersonalIdFilter) Then + + wc.iAND(PersonalExtWorkTable.PersonalId, BaseFilter.ComparisonOperator.EqualsTo, MiscUtils.GetSelectedValue(Me.PersonalIdFilter, Me.GetFromSession(Me.PersonalIdFilter)), False, False) + + End If + + + + Return wc + End Function + + + Public Overridable Function CreateWhereClause(ByVal searchText as String, ByVal fromSearchControl as String, ByVal AutoTypeAheadSearch as String, ByVal AutoTypeAheadWordSeparators as String) As WhereClause + ' This CreateWhereClause is used for loading list of suggestions for Auto Type-Ahead feature. + PersonalExtWorkTable.Instance.InnerFilter = Nothing + Dim wc As WhereClause = New WhereClause() + + ' Compose the WHERE clause consiting of: + ' 1. Static clause defined at design time. + ' 2. User selected search criteria. + ' 3. User selected filter criteria. + + Dim appRelativeVirtualPath As String = CType(HttpContext.Current.Session("AppRelativeVirtualPath"), String) + + ' Adds clauses if values are selected in Filter controls which are configured in the page. + + Dim DescriptionFilterSelectedValue As String = CType(HttpContext.Current.Session()(HttpContext.Current.Session.SessionID & appRelativeVirtualPath & "DescriptionFilter_Ajax"), String) + If IsValueSelected(DescriptionFilterSelectedValue) Then + + wc.iAND(PersonalExtWorkTable.Description, BaseFilter.ComparisonOperator.EqualsTo, DescriptionFilterSelectedValue, false, False) + + End If + + If IsValueSelected(searchText) and fromSearchControl = "PersonalExtWorkSearch" Then + Dim formatedSearchText as String = searchText + ' Strip "..." from begin and ending of the search text, otherwise the search will return 0 values as in database "..." is not stored. + If searchText.StartsWith("...") Then + formatedSearchText = searchText.SubString(3,searchText.Length-3) + End If + If searchText.EndsWith("...") Then + formatedSearchText = searchText.SubString(0,searchText.Length-3) + ' Strip the last word as well as it is likely only a partial word + Dim endindex As Integer = searchText.Length - 1 + While (Not Char.IsWhiteSpace(searchText(endindex)) AndAlso endindex > 0) + endindex -= 1 + End While + If endindex > 0 Then + searchText = searchText.Substring(0, endindex) + End If + End If + 'After stripping "...", trim any leading and trailing whitespaces + formatedSearchText = formatedSearchText.Trim() + ' After stripping "..." see if the search text is null or empty. + If IsValueSelected(formatedSearchText) Then + ' These clauses are added depending on operator and fields selected in Control's property page, bindings tab. + + Dim search As WhereClause = New WhereClause() + + If InvariantLCase(AutoTypeAheadSearch).equals("wordsstartingwithsearchstring") Then + + search.iOR(PersonalExtWorkTable.PersonalId, BaseFilter.ComparisonOperator.Starts_With, formatedSearchText, True, False) + search.iOR(PersonalExtWorkTable.PersonalId, BaseFilter.ComparisonOperator.Contains, AutoTypeAheadWordSeparators & formatedSearchText, True, False) + + search.iOR(PersonalExtWorkTable.Description, BaseFilter.ComparisonOperator.Starts_With, formatedSearchText, True, False) + search.iOR(PersonalExtWorkTable.Description, BaseFilter.ComparisonOperator.Contains, AutoTypeAheadWordSeparators & formatedSearchText, True, False) + + Else + + search.iOR(PersonalExtWorkTable.PersonalId, BaseFilter.ComparisonOperator.Contains, formatedSearchText, True, False) + search.iOR(PersonalExtWorkTable.Description, BaseFilter.ComparisonOperator.Contains, formatedSearchText, True, False) + End If + wc.iAND(search) + + End If + End If + + Dim PersonalIdFilterSelectedValue As String = CType(HttpContext.Current.Session()(HttpContext.Current.Session.SessionID & appRelativeVirtualPath & "PersonalIdFilter_Ajax"), String) + If IsValueSelected(PersonalIdFilterSelectedValue) Then + + wc.iAND(PersonalExtWorkTable.PersonalId, BaseFilter.ComparisonOperator.EqualsTo, PersonalIdFilterSelectedValue, false, False) + + End If + + + Return wc + End Function + + Public Overridable Function GetAutoCompletionList_PersonalExtWorkSearch(ByVal prefixText As String, ByVal count As Integer) As String() + Dim resultList As ArrayList = New ArrayList + Dim wordList As ArrayList = New ArrayList + Dim iteration As Integer = 0 + + Dim filterJoin As CompoundFilter = CreateCompoundJoinFilter() + Dim wc As WhereClause = CreateWhereClause(prefixText,"PersonalExtWorkSearch", "WordsStartingWithSearchString", "[^a-zA-Z0-9]") + While (resultList.Count < count AndAlso iteration < 5) + ' Fetch 100 records in each iteration + Dim recordList () As Persons.Business.PersonalExtWorkRecord = PersonalExtWorkTable.GetRecords(filterJoin, wc, Nothing, iteration, 100) + Dim rec As PersonalExtWorkRecord = Nothing + Dim resultItem As String = "" + For Each rec In recordList + ' Exit the loop if recordList count has reached AutoTypeAheadListSize. + If resultList.Count >= count then + Exit For + End If + ' If the field is configured to Display as Foreign key, Format() method returns the + ' Display as Forien Key value instead of original field value. + ' Since search had to be done in multiple fields (selected in Control's page property, binding tab) in a record, + ' We need to find relevent field to display which matches the prefixText and is not already present in the result list. + + resultItem = rec.Format(PersonalExtWorkTable.PersonalId) + If resultItem IsNot Nothing AndAlso resultItem.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture).Contains(prefixText.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture)) Then + + Dim isAdded As Boolean = FormatSuggestions(prefixText, resultItem, 50, "AtBeginningOfMatchedString", "WordsStartingWithSearchString", "[^a-zA-Z0-9]", resultList) + If isAdded Then + Continue For + End If + End If + + resultItem = rec.Format(PersonalExtWorkTable.Description) + If resultItem IsNot Nothing AndAlso resultItem.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture).Contains(prefixText.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture)) Then + + Dim isAdded As Boolean = FormatSuggestions(prefixText, resultItem, 50, "AtBeginningOfMatchedString", "WordsStartingWithSearchString", "[^a-zA-Z0-9]", resultList) + If isAdded Then + Continue For + End If + End If + + Next + ' Exit the loop if number of records found is less as further iteration will not return any more records + If recordList .Length < 100 Then + Exit While + End If + iteration += 1 + End While + + resultList.Sort() + Dim result() As String = New String(resultList.Count - 1) {} + Array.Copy(resultList.ToArray, result, resultList.Count) + Return result + End Function + + + Public Overridable Function FormatSuggestions(ByVal prefixText As String, ByVal resultItem As String, _ + ByVal columnLength As Integer, ByVal AutoTypeAheadDisplayFoundText As String, _ + ByVal autoTypeAheadSearch As String, ByVal AutoTypeAheadWordSeparators As String, _ + ByVal resultList As ArrayList) As Boolean + + 'Formats the resultItem and adds it to the list of suggestions. + Dim index As Integer = resultItem.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture).IndexOf(prefixText.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture)) + Dim itemToAdd As String = "" + Dim isFound As Boolean = False + Dim isAdded As Boolean = False + ' Get the index where prfixt is at the beginning of resultItem. If not found then, index of word which begins with prefixText. + If InvariantLCase(autoTypeAheadSearch).equals("wordsstartingwithsearchstring") And Not index = 0 Then + ' Expression to find word which contains AutoTypeAheadWordSeparators followed by prefixText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex( AutoTypeAheadWordSeparators + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + If regex1.IsMatch(resultItem) Then + index = regex1.Match(resultItem).Index + isFound = True + End If + ' If the prefixText is found immediatly after white space then starting of the word is found so don not search any further + If not resultItem(index).ToString() = " " Then + ' Expression to find beginning of the word which contains AutoTypeAheadWordSeparators followed by prefixText + Dim regex As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\\S*" + AutoTypeAheadWordSeparators + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + If regex.IsMatch(resultItem) Then + index = regex.Match(resultItem).Index + isFound = True + End If + End If + End If + + ' If autoTypeAheadSearch value is wordsstartingwithsearchstring then, extract the substring only if the prefixText is found at the + ' beginning of the resultItem (index = 0) or a word in resultItem is found starts with prefixText. + If index = 0 Or isFound Or InvariantLCase(autoTypeAheadSearch).Equals("anywhereinstring") then + If InvariantLCase(AutoTypeAheadDisplayFoundText).equals("atbeginningofmatchedstring") Then + ' Expression to find beginning of the word which contains prefixText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\\S*" + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + ' Find the beginning of the word which contains prefexText + If (StringUtils.InvariantLCase(autoTypeAheadSearch).Equals("anywhereinstring") AndAlso regex1.IsMatch(resultItem)) Then + index = regex1.Match(resultItem).Index + isFound = True + End If + ' Display string from the index till end of the string if sub string from index till end is less than columnLength value. + If Len(resultItem) - index <= columnLength Then + If index = 0 Then + itemToAdd = resultItem + Else + itemToAdd = "..." & resultItem.Substring(index, Len(resultItem) - index) + End If + Else + If index = 0 Then + itemToAdd = resultItem.Substring(index, (columnLength - 3)) & "..." + Else + 'Truncate the string to show only columnLength - 6 characters as begining and trailing "..." has to be appended. + itemToAdd = "..." & resultItem.Substring(index , columnLength - 6) & "..." + End If + End If + ElseIf InvariantLCase(AutoTypeAheadDisplayFoundText).equals("inmiddleofmatchedstring") Then + Dim subStringBeginIndex As Integer = CType(columnLength/2, Integer) + If Len(resultItem) <= columnLength Then + itemToAdd = resultItem + Else + ' Sanity check at end of the string + If index + Len(prefixText) = columnLength Then + itemToAdd = "..." & resultItem.Substring(index-columnLength,index) + ElseIf Len(resultItem) - index < subStringBeginIndex Then + ' Display string from the end till columnLength value if, index is closer to the end of the string. + itemToAdd = "..." & resultItem.Substring(Len(resultItem)-columnLength,Len(resultItem)) + ElseIf index <= subStringBeginIndex Then + ' Sanity chet at beginning of the string + itemToAdd = resultItem.Substring(0, columnLength) & "..." + Else + ' Display string containing text before the prefixText occures and text after the prefixText + itemToAdd = "..." & resultItem.Substring(index - subStringBeginIndex, columnLength) & "..." + End If + End If + ElseIf InvariantLCase(AutoTypeAheadDisplayFoundText).equals("atendofmatchedstring") Then + ' Expression to find ending of the word which contains prefexText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\s", System.Text.RegularExpressions.RegexOptions.IgnoreCase) + ' Find the ending of the word which contains prefexText + If regex1.IsMatch(resultItem, index + 1) Then + index = regex1.Match(resultItem, index + 1).Index + Else + ' If the word which contains prefexText is the last word in string, regex1.IsMatch returns false. + index = resultItem.Length + End If + If index > Len(resultItem) Then + index = Len(resultItem) + End If + ' If text from beginning of the string till index is less than columnLength value then, display string from the beginning till index. + If index <= columnLength Then + if index = Len(resultItem) Then 'Make decision to append "..." + itemToAdd = resultItem.Substring(0,index) + Else + itemToAdd = resultItem.Substring(0,index) & "..." + End If + Else + If index = Len(resultItem) Then + itemToAdd = "..." & resultItem.Substring(index - (columnLength - 3), (columnLength - 3)) + Else + 'Truncate the string to show only columnLength - 6 characters as begining and trailing "..." has to be appended. + itemToAdd = "..." & resultItem.Substring(index - (columnLength - 6), columnLength - 6) & "..." + End If + End If + End If + + ' Remove newline character from itemToAdd + Dim prefixTextIndex As Integer = itemToAdd.IndexOf(prefixText, StringComparison.CurrentCultureIgnoreCase) + ' If itemToAdd contains any newline after the search text then show text only till newline + Dim regex2 As System.Text.RegularExpressions.Regex = New System.Text.RegularExpressions.Regex("(" & vbCrLf & "|" & vbLf & ")", System.Text.RegularExpressions.RegexOptions.IgnoreCase) + Dim newLineIndexAfterPrefix As Integer = -1 + If regex2.IsMatch(itemToAdd, prefixTextIndex) Then + newLineIndexAfterPrefix = regex2.Match(itemToAdd, prefixTextIndex).Index + End If + If (newLineIndexAfterPrefix > -1) Then + If itemToAdd.EndsWith("...") Then + itemToAdd = (itemToAdd.Substring(0, newLineIndexAfterPrefix) + "...") + Else + itemToAdd = itemToAdd.Substring(0, newLineIndexAfterPrefix) + End If + End If + ' If itemToAdd contains any newline before search text then show text which comes after newline + Dim regex3 As System.Text.RegularExpressions.Regex = New System.Text.RegularExpressions.Regex("(" & vbCrLf & "|" & vbLf & ")", (System.Text.RegularExpressions.RegexOptions.IgnoreCase Or System.Text.RegularExpressions.RegexOptions.RightToLeft)) + Dim newLineIndexBeforePrefix As Integer = -1 + If regex3.IsMatch(itemToAdd, prefixTextIndex) Then + newLineIndexBeforePrefix = regex3.Match(itemToAdd, prefixTextIndex).Index + End If + If (newLineIndexBeforePrefix > -1) Then + If itemToAdd.StartsWith("...") Then + itemToAdd = ("..." + itemToAdd.Substring((newLineIndexBeforePrefix + regex3.Match(itemToAdd, prefixTextIndex).Length))) + Else + itemToAdd = itemToAdd.Substring((newLineIndexBeforePrefix + regex3.Match(itemToAdd, prefixTextIndex).Length)) + End If + End If + + If Not itemToAdd is nothing AndAlso Not resultList.Contains(itemToAdd) Then + + resultList.Add(itemToAdd) + + isAdded = true + End If + End If + Return isAdded + End Function + + + Protected Overridable Sub GetPageSize() + + If Me.PersonalExtWorkPagination.PageSize.Text.Trim <> "" Then + Try + 'Me.PageSize = Integer.Parse(Me.PersonalExtWorkPagination.PageSize.Text) + Catch ex As Exception + End Try + End If + End Sub + + Protected Overridable Sub AddNewRecords() + + Dim newRecordList As ArrayList = New ArrayList() + + Dim newUIDataList As System.Collections.Generic.List(Of Hashtable) = New System.Collections.Generic.List(Of Hashtable)() + + ' Loop though all the record controls and if the record control + ' does not have a unique record id set, then create a record + ' and add to the list. + If Not Me.ResetData Then + Dim rep As System.Web.UI.WebControls.Repeater = CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalExtWorkTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return + + Dim repItem As System.Web.UI.WebControls.RepeaterItem + For Each repItem In rep.Items + ' Loop through all rows in the table, set its DataSource and call DataBind(). + + Dim recControl As PersonalExtWorkTableControlRow = DirectCast(repItem.FindControl("PersonalExtWorkTableControlRow"), PersonalExtWorkTableControlRow) + + If recControl.Visible AndAlso recControl.IsNewRecord() Then + + Dim rec As PersonalExtWorkRecord = New PersonalExtWorkRecord() + + If recControl.BeginDate.Text <> "" Then + rec.Parse(recControl.BeginDate.Text, PersonalExtWorkTable.BeginDate) + End If + If recControl.Command.Text <> "" Then + rec.Parse(recControl.Command.Text, PersonalExtWorkTable.Command) + End If + If recControl.CommandDate.Text <> "" Then + rec.Parse(recControl.CommandDate.Text, PersonalExtWorkTable.CommandDate) + End If + If recControl.Description.Text <> "" Then + rec.Parse(recControl.Description.Text, PersonalExtWorkTable.Description) + End If + If recControl.EndDate.Text <> "" Then + rec.Parse(recControl.EndDate.Text, PersonalExtWorkTable.EndDate) + End If + If recControl.PersonalId.Text <> "" Then + rec.Parse(recControl.PersonalId.Text, PersonalExtWorkTable.PersonalId) + End If + If recControl.Place.Text <> "" Then + rec.Parse(recControl.Place.Text, PersonalExtWorkTable.Place) + End If + newUIDataList.Add(recControl.PreservedUIData()) + newRecordList.Add(rec) + End If + Next + End If + + + ' Add any new record to the list. + Dim index As Integer = 0 + For index = 1 To Me.AddNewRecord + + newRecordList.Insert(0, New PersonalExtWorkRecord()) + newUIDataList.Insert(0, New Hashtable()) + + Next + Me.AddNewRecord = 0 + + ' Finally, add any new records to the DataSource. + If newRecordList.Count > 0 Then + + Dim finalList As ArrayList = New ArrayList(Me.DataSource) + finalList.InsertRange(0, newRecordList) + + Me.DataSource = DirectCast(finalList.ToArray(GetType(PersonalExtWorkRecord)), PersonalExtWorkRecord()) + + End If + + ' Add the existing UI data to this hash table + If newUIDataList.Count > 0 Then + Me.UIData.InsertRange(0, newUIDataList) + End If + + End Sub + + + Public Sub AddToDeletedRecordIds(ByVal rec As PersonalExtWorkTableControlRow) + If rec.IsNewRecord() Then + Return + End If + + If Not Me.DeletedRecordIds Is Nothing AndAlso Me.DeletedRecordIds.Trim <> "" Then + Me.DeletedRecordIds &= "," + End If + + Me.DeletedRecordIds &= "[" & rec.RecordUniqueId & "]" + End Sub + + Protected Overridable Function InDeletedRecordIds(ByVal rec As PersonalExtWorkTableControlRow) As Boolean + If Me.DeletedRecordIds Is Nothing OrElse Me.DeletedRecordIds.Trim = "" Then + Return False + End If + + Return Me.DeletedRecordIds.IndexOf("[" & rec.RecordUniqueId & "]") >= 0 + End Function + + Private _DeletedRecordIds As String + Public Property DeletedRecordIds() As String + Get + Return Me._DeletedRecordIds + End Get + Set(ByVal value As String) + Me._DeletedRecordIds = value + End Set + End Property + + + ' Create Set, WhereClause, and Populate Methods + + Public Overridable Sub SetBeginDateLabel() + + End Sub + + Public Overridable Sub SetCommandDateLabel() + + End Sub + + Public Overridable Sub SetCommandLabel() + + End Sub + + Public Overridable Sub SetDescriptionLabel() + + End Sub + + Public Overridable Sub SetDescriptionLabel1() + + End Sub + + Public Overridable Sub SetEndDateLabel() + + End Sub + + Public Overridable Sub SetPersonalExtWorkTableControlCollapsibleRegion() + + End Sub + + Public Overridable Sub SetPersonalExtWorkTableControlIcon() + + End Sub + + Public Overridable Sub SetPersonalExtWorkTableControlPanelExtender() + + End Sub + + Public Overridable Sub SetPersonalIdLabel() + + End Sub + + Public Overridable Sub SetPersonalIdLabel1() + + End Sub + + Public Overridable Sub SetPlaceLabel() + + End Sub + + Public Overridable Sub SetDescriptionFilter() + + Me.PopulateDescriptionFilter(GetSelectedValue(Me.DescriptionFilter, GetFromSession(Me.DescriptionFilter)), 500) + + End Sub + + Public Overridable Sub SetPersonalExtWorkSearch() + + End Sub + + Public Overridable Sub SetPersonalIdFilter() + + Me.PopulatePersonalIdFilter(GetSelectedValue(Me.PersonalIdFilter, GetFromSession(Me.PersonalIdFilter)), 500) + + End Sub + + ' Get the filters' data for DescriptionFilter + Protected Overridable Sub PopulateDescriptionFilter(ByVal selectedValue As String, ByVal maxItems As Integer) + + + Me.DescriptionFilter.Items.Clear() + + + + ' Set up the WHERE and the ORDER BY clause by calling the CreateWhereClause_DescriptionFilter function. + ' It is better to customize the where clause there. + + ' Setup the WHERE clause, including the base table if needed. + + Dim wc As WhereClause = Me.CreateWhereClause_DescriptionFilter() + + ' Setup the static list items + + ' Add the All item. + Me.DescriptionFilter.Items.Insert(0, new ListItem(Me.Page.GetResourceValue("Txt:All", "Persons"), "--ANY--")) + + + + Dim orderBy As OrderBy = New OrderBy(False, False) + orderBy.Add(PersonalExtWorkTable.Description, OrderByItem.OrderDir.Asc) + + + Dim values() As String = PersonalExtWorkTable.GetValues(PersonalExtWorkTable.Description, wc, orderBy, maxItems) + + Dim cvalue As String + + Dim listDuplicates As New ArrayList() + For Each cvalue In values + ' Create the item and add to the list. + Dim fvalue As String + + If ( PersonalExtWorkTable.Description.IsColumnValueTypeBoolean()) Then + fvalue = cvalue + Else + fvalue = PersonalExtWorkTable.Description.Format(cvalue) + End If + + 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.DescriptionFilter.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.DescriptionFilter.Items.Add(newItem) + + If listDuplicates.Contains(fvalue) Then + newItem.Text = fvalue & " (ID " & cvalue.Substring(0, Math.Min(cvalue.Length,38)) & ")" + End If + + Next + + + + ' Set the selected value. + SetSelectedValue(Me.DescriptionFilter, selectedValue) + + + End Sub + + ' Get the filters' data for PersonalIdFilter + Protected Overridable Sub PopulatePersonalIdFilter(ByVal selectedValue As String, ByVal maxItems As Integer) + + + Me.PersonalIdFilter.Items.Clear() + + + + ' Set up the WHERE and the ORDER BY clause by calling the CreateWhereClause_PersonalIdFilter function. + ' It is better to customize the where clause there. + + ' Setup the WHERE clause, including the base table if needed. + + Dim wc As WhereClause = Me.CreateWhereClause_PersonalIdFilter() + + ' Setup the static list items + + ' Add the All item. + Me.PersonalIdFilter.Items.Insert(0, new ListItem(Me.Page.GetResourceValue("Txt:All", "Persons"), "--ANY--")) + + + + Dim orderBy As OrderBy = New OrderBy(False, False) + orderBy.Add(PersonalExtWorkTable.PersonalId, OrderByItem.OrderDir.Asc) + + + Dim values() As String = PersonalExtWorkTable.GetValues(PersonalExtWorkTable.PersonalId, wc, orderBy, maxItems) + + Dim cvalue As String + + Dim listDuplicates As New ArrayList() + For Each cvalue In values + ' Create the item and add to the list. + Dim fvalue As String + + If ( PersonalExtWorkTable.PersonalId.IsColumnValueTypeBoolean()) Then + fvalue = cvalue + Else + fvalue = PersonalExtWorkTable.PersonalId.Format(cvalue) + End If + + If (IsNothing(fvalue)) Then + fvalue = "" + End If + + fvalue = fvalue.Trim() + + If ( fvalue.Length > 50 ) Then + fvalue = fvalue.Substring(0, 50) & "..." + End If + + Dim dupItem As ListItem = Me.PersonalIdFilter.Items.FindByText(fvalue) + + If Not IsNothing(dupItem) Then + listDuplicates.Add(fvalue) + dupItem.Text = fvalue & " (ID " & dupItem.Value.Substring(0, Math.Min(dupItem.Value.Length,38)) & ")" + End If + + Dim newItem As ListItem = New ListItem(fvalue, cvalue) + Me.PersonalIdFilter.Items.Add(newItem) + + If listDuplicates.Contains(fvalue) Then + newItem.Text = fvalue & " (ID " & cvalue.Substring(0, Math.Min(cvalue.Length,38)) & ")" + End If + + Next + + + + ' Set the selected value. + SetSelectedValue(Me.PersonalIdFilter, selectedValue) + + + End Sub + + Public Overridable Function CreateWhereClause_DescriptionFilter() As WhereClause + + ' Create a where clause for the filter DescriptionFilter. + ' This function is called by the Populate method to load the items + ' in the DescriptionFilterDropDownList + + Dim wc As WhereClause= New WhereClause() + Return wc + + End Function + + Public Overridable Function CreateWhereClause_PersonalIdFilter() As WhereClause + + ' Create a where clause for the filter PersonalIdFilter. + ' This function is called by the Populate method to load the items + ' in the PersonalIdFilterDropDownList + + Dim wc As WhereClause= New WhereClause() + Return wc + + End Function + + + + + Protected Overridable Sub Control_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.PreRender + ' PreRender event is raised just before page is being displayed. + Try + DbUtils.StartTransaction + Me.RegisterPostback() + + If Not Me.Page.ErrorOnPage AndAlso (Me.Page.IsPageRefresh OrElse Me.DataChanged OrElse Me.ResetData) Then + + + ' Re-load the data and update the web page if necessary. + ' This is typically done during a postback (filter, search button, sort, pagination button). + ' In each of the other click handlers, simply set DataChanged to True to reload the data. + Dim added As Boolean = Me.AddNewRecord > 0 + Me.LoadData() + Me.DataBind() + + If added Then + Me.SetFocusToAddedRow() + End If + + End If + + + + Catch ex As Exception + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + Finally + DbUtils.EndTransaction + End Try + End Sub + + 'this function sets focus to the first editable element in the new added row in the editable table + Protected Overridable Sub SetFocusToAddedRow() + Dim rep As System.Web.UI.WebControls.Repeater = CType(Me.FindControl("PersonalExtWorkTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing OrElse rep.Items.Count = 0 Then Return + Dim repItem As System.Web.UI.WebControls.RepeaterItem + For Each repItem In rep.Items + 'Load scripts to table rows + Me.Page.LoadFocusScripts(repItem) + Dim recControl As PersonalExtWorkTableControlRow = DirectCast(repItem.FindControl("PersonalExtWorkTableControlRow"), PersonalExtWorkTableControlRow) + If recControl.IsNewRecord Then + For Each field As Control In recControl.Controls + If field.Visible AndAlso Me.Page.IsControlEditable(field, False) Then + 'set focus on the first editable field in the new row + field.Focus() + Dim updPan As UpdatePanel = DirectCast(Me.Page.FindControlRecursively("UpdatePanel1"), UpdatePanel) + If Not updPan Is Nothing Then updPan.Update() + Return + End If + Next + Return + End If + Next + End Sub + + + Protected Overrides Sub SaveControlsToSession() + MyBase.SaveControlsToSession() + + ' Save filter controls to values to session. + + Me.SaveToSession(Me.DescriptionFilter, Me.DescriptionFilter.SelectedValue) + + Me.SaveToSession(Me.PersonalExtWorkSearch, Me.PersonalExtWorkSearch.Text) + + Me.SaveToSession(Me.PersonalIdFilter, Me.PersonalIdFilter.SelectedValue) + + + 'Save pagination state to session. + + + + ' Save table control properties to the session. + If Not Me.CurrentSortOrder Is Nothing Then + Me.SaveToSession(Me, "Order_By", Me.CurrentSortOrder.ToXmlString()) + End If + + Me.SaveToSession(Me, "Page_Index", Me.PageIndex.ToString()) + Me.SaveToSession(Me, "Page_Size", Me.PageSize.ToString()) + + Me.SaveToSession(Me, "DeletedRecordIds", Me.DeletedRecordIds) + + End Sub + + Protected Sub SaveControlsToSession_Ajax() + ' Save filter controls to values to session. + + Me.SaveToSession("DescriptionFilter_Ajax", Me.DescriptionFilter.SelectedValue) + + Me.SaveToSession("PersonalExtWorkSearch_Ajax", Me.PersonalExtWorkSearch.Text) + + Me.SaveToSession("PersonalIdFilter_Ajax", Me.PersonalIdFilter.SelectedValue) + + HttpContext.Current.Session("AppRelativeVirtualPath") = Me.Page.AppRelativeVirtualPath + + End Sub + + Protected Overrides Sub ClearControlsFromSession() + MyBase.ClearControlsFromSession() + + ' Clear filter controls values from the session. + + Me.RemoveFromSession(Me.DescriptionFilter) + Me.RemoveFromSession(Me.PersonalExtWorkSearch) + Me.RemoveFromSession(Me.PersonalIdFilter) + + ' Clear pagination state from session. + + + + ' Clear table properties from the session. + Me.RemoveFromSession(Me, "Order_By") + Me.RemoveFromSession(Me, "Page_Index") + Me.RemoveFromSession(Me, "Page_Size") + + Me.RemoveFromSession(Me, "DeletedRecordIds") + + End Sub + + Protected Overrides Sub LoadViewState(ByVal savedState As Object) + MyBase.LoadViewState(savedState) + + Dim orderByStr As String = CType(ViewState("PersonalExtWorkTableControl_OrderBy"), String) + + If orderByStr IsNot Nothing AndAlso orderByStr.Trim <> "" Then + Me.CurrentSortOrder = BaseClasses.Data.OrderBy.FromXmlString(orderByStr) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + End If + + Dim pageIndex As String = CType(ViewState("Page_Index"), String) + If pageIndex IsNot Nothing Then + Me.PageIndex = CInt(pageIndex) + End If + + Dim pageSize As String = CType(ViewState("Page_Size"), String) + If Not pageSize Is Nothing Then + Me.PageSize = CInt(pageSize) + End If + + + + ' Load view state for pagination control. + + Me.DeletedRecordIds = CType(Me.ViewState("DeletedRecordIds"), String) + + End Sub + + Protected Overrides Function SaveViewState() As Object + + If Me.CurrentSortOrder IsNot Nothing Then + Me.ViewState("PersonalExtWorkTableControl_OrderBy") = Me.CurrentSortOrder.ToXmlString() + End If + + Me.ViewState("Page_Index") = Me.PageIndex + Me.ViewState("Page_Size") = Me.PageSize + + Me.ViewState("DeletedRecordIds") = Me.DeletedRecordIds + + + ' Load view state for pagination control. + + + Return MyBase.SaveViewState() + End Function + + ' Generate the event handling functions for pagination events. + + ' event handler for ImageButton + Public Overridable Sub PersonalExtWorkPagination_FirstPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.PageIndex = 0 + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalExtWorkPagination_LastPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.DisplayLastPage = True + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalExtWorkPagination_NextPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.PageIndex += 1 + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for LinkButton + Public Overridable Sub PersonalExtWorkPagination_PageSizeButton_Click(ByVal sender As Object, ByVal args As EventArgs) + + Try + + Me.DataChanged = True + + Me.PageSize = Integer.Parse(Me.PersonalExtWorkPagination.PageSize.Text) + + Me.PageIndex = Integer.Parse(Me.PersonalExtWorkPagination.CurrentPage.Text) - 1 + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalExtWorkPagination_PreviousPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + If Me.PageIndex > 0 Then + Me.PageIndex -= 1 + Me.DataChanged = True + End If + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + + ' Generate the event handling functions for sorting events. + + Public Overridable Sub BeginDateLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by BeginDate when clicked. + + ' Get previous sorting state for BeginDate. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalExtWorkTable.BeginDate) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for BeginDate. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalExtWorkTable.BeginDate, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by BeginDate, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub CommandDateLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by CommandDate when clicked. + + ' Get previous sorting state for CommandDate. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalExtWorkTable.CommandDate) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for CommandDate. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalExtWorkTable.CommandDate, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by CommandDate, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub CommandLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by Command when clicked. + + ' Get previous sorting state for Command. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalExtWorkTable.Command) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for Command. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalExtWorkTable.Command, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by Command, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub DescriptionLabel1_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by Description when clicked. + + ' Get previous sorting state for Description. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalExtWorkTable.Description) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for Description. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalExtWorkTable.Description, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by Description, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub EndDateLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by EndDate when clicked. + + ' Get previous sorting state for EndDate. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalExtWorkTable.EndDate) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for EndDate. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalExtWorkTable.EndDate, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by EndDate, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub PersonalIdLabel1_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by PersonalId when clicked. + + ' Get previous sorting state for PersonalId. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalExtWorkTable.PersonalId) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for PersonalId. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalExtWorkTable.PersonalId, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by PersonalId, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub PlaceLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by Place when clicked. + + ' Get previous sorting state for Place. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalExtWorkTable.Place) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for Place. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalExtWorkTable.Place, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by Place, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + + ' Generate the event handling functions for button events. + + ' event handler for ImageButton + Public Overridable Sub PersonalExtWorkAddButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + Me.AddNewRecord = 1 + Me.DataChanged = True + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalExtWorkDeleteButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + If(Not Me.Page.IsPageRefresh) Then + + Me.DeleteSelectedRecords(True) + Me.SetFormulaControls() + + + End If + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalExtWorkEditButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + ' The redirect URL is set on the Properties, Custom Properties or Actions. + ' The ModifyRedirectURL call resolves the parameters before the + ' Response.Redirect redirects the page to the URL. + ' Any code after the Response.Redirect call will not be executed, since the page is + ' redirected to the URL. + + + Dim url As String = "../PersonalExtWork/EditPersonalExtWork.aspx?PersonalExtWork={PK}" + + Dim shouldRedirect As Boolean = True + Dim TargetKey As String = Nothing + Dim DFKA As String = TargetKey + Dim id As String = DFKA + Dim value As String = id + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + url = Me.ModifyRedirectUrl(url, "",False) + url = Me.Page.ModifyRedirectUrl(url, "",False) + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + shouldRedirect = False + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + If shouldRedirect Then + Me.Page.ShouldSaveControlsToSession = True + Me.Page.Response.Redirect(url) + ElseIf Not TargetKey Is Nothing AndAlso _ + Not shouldRedirect Then + Me.Page.ShouldSaveControlsToSession = True + Me.Page.CloseWindow(True) + + End If + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalExtWorkRefreshButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Dim PersonalExtWorkTableControlObj as PersonalExtWorkTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalExtWorkTableControl"), PersonalExtWorkTableControl) + PersonalExtWorkTableControlObj.ResetData = True + + PersonalExtWorkTableControlObj.RemoveFromSession(PersonalExtWorkTableControlObj, "DeletedRecordIds") + PersonalExtWorkTableControlObj.DeletedRecordIds = Nothing + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalExtWorkResetButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.DescriptionFilter.ClearSelection() + Me.PersonalIdFilter.ClearSelection() + Me.PersonalExtWorkSearch.Text = "" + Me.CurrentSortOrder.Reset() + If Me.InSession(Me, "Order_By") Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + + End If + + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalExtWorkSaveButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + + If (Not Me.Page.IsPageRefresh) Then + Me.SaveData() + End If + + Me.Page.CommitTransaction(sender) + ' Set IsNewRecord to False for all records - since everything has been saved and is no longer "new" + Dim recCtl As PersonalExtWorkTableControlRow + For Each recCtl in Me.GetRecordControls() + + recCtl.IsNewRecord = False + Next + + + ' Set DeletedRecordsIds to Nothing since we have deleted all pending deletes. + + Me.DeletedRecordIds = Nothing + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for Button with Layout + Public Overridable Sub PersonalExtWorkSearchButton_Click(ByVal sender As Object, ByVal args As EventArgs) + + Try + + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + + + ' Generate the event handling functions for filter and search events. + + ' event handler for FieldFilter + Protected Overridable Sub DescriptionFilter_SelectedIndexChanged(ByVal sender As Object, ByVal args As EventArgs) + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + + End Sub + + ' event handler for FieldFilter + Protected Overridable Sub PersonalIdFilter_SelectedIndexChanged(ByVal sender As Object, ByVal args As EventArgs) + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + + End Sub + + + ' Generate the event handling functions for others + + + Private _UIData As New System.Collections.Generic.List(Of Hashtable) + Public Property UIData() As System.Collections.Generic.List(Of Hashtable) + Get + Return Me._UIData + End Get + Set(ByVal value As System.Collections.Generic.List(Of Hashtable)) + Me._UIData = value + End Set + End Property + + ' pagination properties + Protected _PageSize As Integer + Public Property PageSize() As Integer + Get + Return Me._PageSize + End Get + Set(ByVal value As Integer) + Me._PageSize = value + End Set + End Property + + Protected _PageIndex As Integer + Public Property PageIndex() As Integer + Get + ' Return the PageIndex + Return Me._PageIndex + End Get + Set(ByVal value As Integer) + Me._PageIndex = value + End Set + End Property + + Protected _TotalRecords As Integer = -1 + Public Property TotalRecords() As Integer + Get + If _TotalRecords < 0 + _TotalRecords = PersonalExtWorkTable.GetRecordCount(CreateCompoundJoinFilter(), CreateWhereClause()) + End If + Return Me._TotalRecords + End Get + Set(ByVal value As Integer) + If Me.PageSize > 0 Then + + Me.TotalPages = CInt(Math.Ceiling(value / Me.PageSize)) + + End If + Me._TotalRecords = value + End Set + End Property + + + + Protected _TotalPages As Integer = -1 + Public Property TotalPages() As Integer + Get + If _TotalPages < 0 Then + + Me.TotalPages = CInt(Math.Ceiling(TotalRecords / Me.PageSize)) + + End If + Return Me._TotalPages + End Get + Set(ByVal value As Integer) + Me._TotalPages = value + End Set + End Property + + Protected _DisplayLastPage As Boolean + Public Property DisplayLastPage() As Boolean + Get + Return Me._DisplayLastPage + End Get + Set(ByVal value As Boolean) + Me._DisplayLastPage = value + End Set + End Property + + Private _DataChanged As Boolean = False + Public Property DataChanged() As Boolean + Get + Return Me._DataChanged + End Get + Set(ByVal value As Boolean) + Me._DataChanged = value + End Set + End Property + + Private _ResetData As Boolean = False + Public Property ResetData() As Boolean + Get + Return Me._ResetData + End Get + Set(ByVal value As Boolean) + Me._ResetData = value + End Set + End Property + + Private _AddNewRecord As Integer = 0 + Public Property AddNewRecord() As Integer + Get + Return Me._AddNewRecord + End Get + Set(ByVal value As Integer) + Me._AddNewRecord = value + End Set + End Property + + + Private _CurrentSortOrder As OrderBy = Nothing + Public Property CurrentSortOrder() As OrderBy + Get + Return Me._CurrentSortOrder + End Get + Set(ByVal value As BaseClasses.Data.OrderBy) + Me._CurrentSortOrder = value + End Set + End Property + + Private _DataSource() As PersonalExtWorkRecord = Nothing + Public Property DataSource() As PersonalExtWorkRecord () + Get + Return Me._DataSource + End Get + Set(ByVal value() As PersonalExtWorkRecord) + Me._DataSource = value + End Set + End Property + +#Region "Helper Properties" + + Public ReadOnly Property BeginDateLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "BeginDateLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property CommandDateLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "CommandDateLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property CommandLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "CommandLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property DescriptionFilter() As System.Web.UI.WebControls.DropDownList + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "DescriptionFilter"), System.Web.UI.WebControls.DropDownList) + End Get + End Property + + Public ReadOnly Property DescriptionLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "DescriptionLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property DescriptionLabel1() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "DescriptionLabel1"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property EndDateLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "EndDateLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property PersonalExtWorkAddButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalExtWorkAddButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalExtWorkDeleteButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalExtWorkDeleteButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalExtWorkEditButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalExtWorkEditButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalExtWorkPagination() As Persons.UI.IPagination + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalExtWorkPagination"), Persons.UI.IPagination) + End Get + End Property + + Public ReadOnly Property PersonalExtWorkRefreshButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalExtWorkRefreshButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalExtWorkResetButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalExtWorkResetButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalExtWorkSaveButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalExtWorkSaveButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalExtWorkSearch() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalExtWorkSearch"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property PersonalExtWorkSearchButton() As Persons.UI.IThemeButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalExtWorkSearchButton"), Persons.UI.IThemeButton) + End Get + End Property + + Public ReadOnly Property PersonalExtWorkTableControlCollapsibleRegion() As System.Web.UI.WebControls.Panel + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalExtWorkTableControlCollapsibleRegion"), System.Web.UI.WebControls.Panel) + End Get + End Property + + Public ReadOnly Property PersonalExtWorkTableControlIcon() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalExtWorkTableControlIcon"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalExtWorkTableControlPanelExtender() As AjaxControlToolkit.CollapsiblePanelExtender + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalExtWorkTableControlPanelExtender"), AjaxControlToolkit.CollapsiblePanelExtender) + End Get + End Property + + Public ReadOnly Property PersonalExtWorkTitle() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalExtWorkTitle"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property PersonalExtWorkToggleAll() As System.Web.UI.WebControls.CheckBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalExtWorkToggleAll"), System.Web.UI.WebControls.CheckBox) + End Get + End Property + + Public ReadOnly Property PersonalIdFilter() As System.Web.UI.WebControls.DropDownList + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalIdFilter"), System.Web.UI.WebControls.DropDownList) + End Get + End Property + + Public ReadOnly Property PersonalIdLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalIdLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property PersonalIdLabel1() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalIdLabel1"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property PlaceLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PlaceLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + +#End Region + +#Region "Helper Functions" + + Public Overrides Overloads Function ModifyRedirectUrl(url As String, arg As String, ByVal bEncrypt As Boolean) As String + Return Me.Page.EvaluateExpressions(url, arg, bEncrypt, Me) + End Function + + Public Overrides Overloads Function EvaluateExpressions(url As String, arg As String, ByVal bEncrypt As Boolean) As String + Dim needToProcess As Boolean = AreAnyUrlParametersForMe(url, arg) + If (needToProcess) Then + Dim recCtl As PersonalExtWorkTableControlRow = Me.GetSelectedRecordControl() + If recCtl Is Nothing AndAlso url.IndexOf("{") >= 0 Then + ' Localization. + Throw New Exception(Page.GetResourceValue("Err:NoRecSelected", "Persons")) + End If + Dim rec As PersonalExtWorkRecord = Nothing + If recCtl IsNot Nothing Then + rec = recCtl.GetRecord() + End If + Return EvaluateExpressions(url, arg, rec, bEncrypt) + End If + Return url + End Function + + Public Overridable Function GetSelectedRecordIndex() As Integer + Dim counter As Integer = 0 + Dim recControl As PersonalExtWorkTableControlRow + For Each recControl In Me.GetRecordControls() + If recControl.PersonalExtWorkRecordRowSelection.Checked Then + Return counter + End If + counter += 1 + Next + Return -1 + End Function + + Public Overridable Function GetSelectedRecordControl() As PersonalExtWorkTableControlRow + Dim selectedList() As PersonalExtWorkTableControlRow = Me.GetSelectedRecordControls() + If selectedList.Length = 0 Then + Return Nothing + End If + Return selectedList(0) + + End Function + + Public Overridable Function GetSelectedRecordControls() As PersonalExtWorkTableControlRow() + + Dim selectedList As ArrayList = New ArrayList(25) + Dim recControl As PersonalExtWorkTableControlRow + For Each recControl In Me.GetRecordControls() + If recControl.PersonalExtWorkRecordRowSelection IsNot Nothing AndAlso recControl.PersonalExtWorkRecordRowSelection.Checked Then + selectedList.Add(recControl) + End If + Next + Return DirectCast(selectedList.ToArray(GetType(PersonalExtWorkTableControlRow)), PersonalExtWorkTableControlRow()) + + End Function + + Public Overridable Sub DeleteSelectedRecords(ByVal deferDeletion As Boolean) + Dim recList() As PersonalExtWorkTableControlRow = Me.GetSelectedRecordControls() + If recList.Length = 0 Then + ' Localization. + Throw New Exception(Page.GetResourceValue("Err:NoRecSelected", "Persons")) + End If + + Dim recCtl As PersonalExtWorkTableControlRow + For Each recCtl In recList + If deferDeletion Then + If Not recCtl.IsNewRecord Then + + Me.AddToDeletedRecordIds(recCtl) + + End If + recCtl.Visible = False + + recCtl.PersonalExtWorkRecordRowSelection.Checked = False + + Else + + recCtl.Delete() + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + End If + Next + End Sub + + Public Function GetRecordControls() As PersonalExtWorkTableControlRow() + Dim recList As ArrayList = New ArrayList() + Dim rep As System.Web.UI.WebControls.Repeater = CType(Me.FindControl("PersonalExtWorkTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return Nothing + Dim repItem As System.Web.UI.WebControls.RepeaterItem + + For Each repItem In rep.Items + + Dim recControl As PersonalExtWorkTableControlRow = DirectCast(repItem.FindControl("PersonalExtWorkTableControlRow"), PersonalExtWorkTableControlRow) + recList.Add(recControl) + + Next + + Return DirectCast(recList.ToArray(GetType(PersonalExtWorkTableControlRow)), PersonalExtWorkTableControlRow()) + 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 + + \ No newline at end of file diff --git a/App_Code/PersonalExtWork/EditPersonalExtWorkTable2.Controls.vb b/App_Code/PersonalExtWork/EditPersonalExtWorkTable2.Controls.vb new file mode 100644 index 0000000..4855c60 --- /dev/null +++ b/App_Code/PersonalExtWork/EditPersonalExtWorkTable2.Controls.vb @@ -0,0 +1,3131 @@ + +' This file implements the TableControl, TableControlRow, and RecordControl classes for the +' EditPersonalExtWorkTable2.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.EditPersonalExtWorkTable2 + +#Region "Section 1: Place your customizations here." + + +Public Class PersonalExtWorkTableControlRow + Inherits BasePersonalExtWorkTableControlRow + ' The BasePersonalExtWorkTableControlRow implements code for a ROW within the + ' the PersonalExtWorkTableControl table. The BasePersonalExtWorkTableControlRow implements the DataBind and SaveData methods. + ' The loading of data is actually performed by the LoadData method in the base class of PersonalExtWorkTableControl. + + ' This is the ideal place to add your code customizations. For example, you can override the DataBind, + ' SaveData, GetUIData, and Validate methods. + Public Overrides Sub GetUIData() + + ' Call MyBase.GetUIData + MyBase.GetUIData() + + ' Get PersonalDD Record + Dim myRec As PersonalExtWorkRecord = Me.GetRecord + + ' Set PersonalId field value to new value string + myRec.PersonalId = Utils.SecurityControls.GetCurrentUserID + + End Sub + + +End Class + + + +Public Class PersonalExtWorkTableControl + Inherits BasePersonalExtWorkTableControl + + ' The BasePersonalExtWorkTableControl class implements the LoadData, DataBind, CreateWhereClause + ' and other methods to load and display the data in a table control. + + ' This is the ideal place to add your code customizations. You can override the LoadData and CreateWhereClause, + ' The PersonalExtWorkTableControlRow class offers another place where you can customize + ' the DataBind, GetUIData, SaveData and Validate methods specific to each row displayed on the table. + +End Class + + + +#End Region + + + +#Region "Section 2: Do not modify this section." + + +' Base class for the PersonalExtWorkTableControlRow control on the EditPersonalExtWorkTable2 page. +' Do not modify this class. Instead override any method in PersonalExtWorkTableControlRow. +Public Class BasePersonalExtWorkTableControlRow + Inherits Persons.UI.BaseApplicationRecordControl + + ' To customize, override this method in PersonalExtWorkTableControlRow. + Protected Overridable Sub Control_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Init + + Me.ClearControlsFromSession() + End Sub + + ' To customize, override this method in PersonalExtWorkTableControlRow. + Protected Overridable Sub Control_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load + + 'Call LoadFocusScripts from repeater so that onfocus attribute could be added to elements + Me.Page.LoadFocusScripts(Me) + + ' Show confirmation message on Click + Me.PersonalExtWorkRowDeleteButton.Attributes.Add("onClick", "return (confirm('" & (CType(Me.Page,BaseApplicationPage)).GetResourceValue("DeleteRecordConfirm", "Persons") & "'));") + + + ' Register the event handlers. + + AddHandler Me.PersonalExtWorkRowDeleteButton.Click, AddressOf PersonalExtWorkRowDeleteButton_Click + + AddHandler Me.PersonalId.SelectedIndexChanged, AddressOf PersonalId_SelectedIndexChanged + + AddHandler Me.Active.CheckedChanged, AddressOf Active_CheckedChanged + + AddHandler Me.BeginDate.TextChanged, AddressOf BeginDate_TextChanged + + AddHandler Me.Command.TextChanged, AddressOf Command_TextChanged + + AddHandler Me.CommandDate.TextChanged, AddressOf CommandDate_TextChanged + + AddHandler Me.Description.TextChanged, AddressOf Description_TextChanged + + AddHandler Me.EndDate.TextChanged, AddressOf EndDate_TextChanged + + AddHandler Me.Place.TextChanged, AddressOf Place_TextChanged + + + End Sub + + + Public Overridable Sub LoadData() + + ' Load the data from the database into the DataSource PersonalExtWork 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 = PersonalExtWorkTable.GetRecord(Me.RecordUniqueId, True) + + Return + End If + + ' Since this is a row in the table, the data for this row is loaded by the + ' LoadData method of the BasePersonalExtWorkTableControl when the data for the entire + ' table is loaded. + + Me.DataSource = New PersonalExtWorkRecord() + + + + End Sub + + ' Populate the UI controls using the DataSource. To customize, override this method in PersonalExtWorkTableControlRow. + 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 + + SetActive() + SetBeginDate() + SetCommand() + SetCommandDate() + SetDescription() + SetEndDate() + + + SetPersonalId() + SetPlace() + + + 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 SetActive() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.Active.ID) Then + Me.Active.Checked = Convert.ToBoolean(Me.PreviousUIData(Me.Active.ID)) + Return + End If + + + ' Set the Active CheckBox on the webpage with value from the + ' PersonalExtWork database record. + + ' Me.DataSource is the PersonalExtWork record retrieved from the database. + ' Me.Active is the ASP:CheckBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetActive() + ' and add your own code before or after the call to the MyBase function. + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.ActiveSpecified Then + + ' If the Active is non-NULL, then format the value. + ' The Format method will use the Display Format + Me.Active.Checked = Me.DataSource.Active + Else + + ' Active is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + If Not Me.DataSource.IsCreated Then + Me.Active.Checked = PersonalExtWorkTable.Active.ParseValue(PersonalExtWorkTable.Active.DefaultValue).ToBoolean() + End If + + End If + + End Sub + + Public Overridable Sub SetBeginDate() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.BeginDate.ID) Then + + Me.BeginDate.Text = Me.PreviousUIData(Me.BeginDate.ID).ToString() + + Return + End If + + + ' Set the BeginDate TextBox on the webpage with value from the + ' PersonalExtWork database record. + + ' Me.DataSource is the PersonalExtWork record retrieved from the database. + ' Me.BeginDate is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetBeginDate() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.BeginDateSpecified Then + + ' If the BeginDate is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalExtWorkTable.BeginDate, "d MMM yyyy") + + Me.BeginDate.Text = formattedValue + + Else + + ' BeginDate is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.BeginDate.Text = PersonalExtWorkTable.BeginDate.Format(PersonalExtWorkTable.BeginDate.DefaultValue, "d MMM yyyy") + + End If + + End Sub + + Public Overridable Sub SetCommand() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.Command.ID) Then + + Me.Command.Text = Me.PreviousUIData(Me.Command.ID).ToString() + + Return + End If + + + ' Set the Command TextBox on the webpage with value from the + ' PersonalExtWork database record. + + ' Me.DataSource is the PersonalExtWork record retrieved from the database. + ' Me.Command is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetCommand() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.CommandSpecified Then + + ' If the Command is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalExtWorkTable.Command) + + Me.Command.Text = formattedValue + + Else + + ' Command is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.Command.Text = PersonalExtWorkTable.Command.Format(PersonalExtWorkTable.Command.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetCommandDate() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.CommandDate.ID) Then + + Me.CommandDate.Text = Me.PreviousUIData(Me.CommandDate.ID).ToString() + + Return + End If + + + ' Set the CommandDate TextBox on the webpage with value from the + ' PersonalExtWork database record. + + ' Me.DataSource is the PersonalExtWork record retrieved from the database. + ' Me.CommandDate is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetCommandDate() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.CommandDateSpecified Then + + ' If the CommandDate is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalExtWorkTable.CommandDate, "d MMM yy") + + Me.CommandDate.Text = formattedValue + + Else + + ' CommandDate is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.CommandDate.Text = PersonalExtWorkTable.CommandDate.Format(PersonalExtWorkTable.CommandDate.DefaultValue, "d MMM yy") + + End If + + End Sub + + Public Overridable Sub SetDescription() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.Description.ID) Then + + Me.Description.Text = Me.PreviousUIData(Me.Description.ID).ToString() + + Return + End If + + + ' Set the Description TextBox on the webpage with value from the + ' PersonalExtWork database record. + + ' Me.DataSource is the PersonalExtWork record retrieved from the database. + ' Me.Description is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetDescription() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.DescriptionSpecified Then + + ' If the Description is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalExtWorkTable.Description) + + Me.Description.Text = formattedValue + + Else + + ' Description is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.Description.Text = PersonalExtWorkTable.Description.Format(PersonalExtWorkTable.Description.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetEndDate() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.EndDate.ID) Then + + Me.EndDate.Text = Me.PreviousUIData(Me.EndDate.ID).ToString() + + Return + End If + + + ' Set the EndDate TextBox on the webpage with value from the + ' PersonalExtWork database record. + + ' Me.DataSource is the PersonalExtWork record retrieved from the database. + ' Me.EndDate is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetEndDate() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.EndDateSpecified Then + + ' If the EndDate is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalExtWorkTable.EndDate, "d MMM yyyy") + + Me.EndDate.Text = formattedValue + + Else + + ' EndDate is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.EndDate.Text = PersonalExtWorkTable.EndDate.Format(PersonalExtWorkTable.EndDate.DefaultValue, "d MMM yyyy") + + End If + + End Sub + + Public Overridable Sub SetPersonalId() + + ' If selection was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.PersonalId.ID) Then + If Me.PreviousUIData(Me.PersonalId.ID) Is Nothing + Me.PopulatePersonalIdDropDownList(Nothing, 100) + Else + Me.PopulatePersonalIdDropDownList(Me.PreviousUIData(Me.PersonalId.ID).ToString(), 100) + End If + Return + End If + + + ' Set the PersonalId DropDownList on the webpage with value from the + ' PersonalExtWork database record. + + ' Me.DataSource is the PersonalExtWork record retrieved from the database. + ' Me.PersonalId is the ASP:DropDownList on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetPersonalId() + ' and add your own code before or after the call to the MyBase function. + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.PersonalIdSpecified Then + + ' If the PersonalId is non-NULL, then format the value. + ' The Format method will use the Display Format + Me.PopulatePersonalIdDropDownList(Me.DataSource.PersonalId, 100) + + Else + + ' PersonalId 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.PopulatePersonalIdDropDownList(Nothing, 100) + Else + Me.PopulatePersonalIdDropDownList(PersonalExtWorkTable.PersonalId.DefaultValue, 100) + End If + + End If + + End Sub + + Public Overridable Sub SetPlace() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.Place.ID) Then + + Me.Place.Text = Me.PreviousUIData(Me.Place.ID).ToString() + + Return + End If + + + ' Set the Place TextBox on the webpage with value from the + ' PersonalExtWork database record. + + ' Me.DataSource is the PersonalExtWork record retrieved from the database. + ' Me.Place is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetPlace() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.PlaceSpecified Then + + ' If the Place is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalExtWorkTable.Place) + + Me.Place.Text = formattedValue + + Else + + ' Place is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.Place.Text = PersonalExtWorkTable.Place.Format(PersonalExtWorkTable.Place.DefaultValue) + + End If + + End Sub + + + Public EvaluateFormulaDelegate As BaseClasses.Data.DataSource.EvaluateFormulaDelegate = New BaseClasses.Data.DataSource.EvaluateFormulaDelegate(AddressOf Me.EvaluateFormula) + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean, ByVal e As FormulaEvaluator) As String + If e Is Nothing Then + e = New FormulaEvaluator() + End If + + e.Variables.Clear() + + + ' add variables for formula evaluation + If variables IsNot Nothing Then + Dim enumerator As System.Collections.Generic.IEnumerator(Of System.Collections.Generic.KeyValuePair(Of String, Object)) = variables.GetEnumerator() + While enumerator.MoveNext() + e.Variables.Add(enumerator.Current.Key, enumerator.Current.Value) + End While + End If + + If includeDS + + End IF + + + ' Other variables referred to in the formula are expected to be + ' properties of the DataSource. For example, referring to + ' UnitPrice as a variable will refer to DataSource.UnitPrice + If dataSourceForEvaluate Is Nothing Then + + e.DataSource = Me.DataSource + + Else + e.DataSource = dataSourceForEvaluate + End If + + ' Define the calling control. This is used to add other + ' related table and record controls as variables. + e.CallingControl = Me + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + + If Not String.IsNullOrEmpty(format) AndAlso (String.IsNullOrEmpty(formula) OrElse formula.IndexOf("Format(") < 0) Then + Return FormulaUtils.Format(resultObj, format) + Else + Return resultObj.ToString() + End If + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format,variables ,includeDS, Nothing) + End Function + + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object)) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format, variables ,True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, format, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal e as FormulaEvaluator) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, variables, True, e) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal includeDS as Boolean) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, includeDS, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, True, Nothing) + End Function + + + Public Overridable Sub RegisterPostback() + + + End Sub + + + + ' To customize, override this method in PersonalExtWorkTableControlRow. + Public Overridable Sub SaveData() + ' Saves the associated record in the database. + ' SaveData calls Validate and Get methods - so it may be more appropriate to + ' customize those methods. + + ' 1. Load the existing record from the database. Since we save the entire record, this ensures + ' that fields that are not displayed are also properly initialized. + Me.LoadData() + + + ' 2. Perform any custom validation. + Me.Validate() + + + ' 3. Set the values in the record with data from UI controls. + ' This calls the Get() method for each of the user interface controls. + Me.GetUIData() + + ' 4. Save in the database. + ' We should not save the record if the data did not change. This + ' will save a database hit and avoid triggering any database triggers. + + If Me.DataSource.IsAnyValueChanged Then + ' Save record to database but do not commit yet. + ' Auto generated ids are available after saving for use by child (dependent) records. + Me.DataSource.Save() + + DirectCast(GetParentControlObject(Me, "PersonalExtWorkTableControl"), PersonalExtWorkTableControl).DataChanged = True + DirectCast(GetParentControlObject(Me, "PersonalExtWorkTableControl"), PersonalExtWorkTableControl).ResetData = True + End If + + + ' update session or cookie by formula + + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + ' For Master-Detail relationships, save data on the Detail table(s) + + End Sub + + ' To customize, override this method in PersonalExtWorkTableControlRow. + 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. + + GetActive() + GetBeginDate() + GetCommand() + GetCommandDate() + GetDescription() + GetEndDate() + GetPersonalId() + GetPlace() + End Sub + + + Public Overridable Sub GetActive() + + + ' Retrieve the value entered by the user on the Active ASP:CheckBox, and + ' save it into the Active field in DataSource PersonalExtWork record. + ' Custom validation should be performed in Validate, not here. + + + Me.DataSource.Active = Me.Active.Checked + + End Sub + + Public Overridable Sub GetBeginDate() + + ' Retrieve the value entered by the user on the BeginDate ASP:TextBox, and + ' save it into the BeginDate field in DataSource PersonalExtWork 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.BeginDate.Text, PersonalExtWorkTable.BeginDate) + + + End Sub + + Public Overridable Sub GetCommand() + + ' Retrieve the value entered by the user on the Command ASP:TextBox, and + ' save it into the Command field in DataSource PersonalExtWork record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.Command.Text, PersonalExtWorkTable.Command) + + + End Sub + + Public Overridable Sub GetCommandDate() + + ' Retrieve the value entered by the user on the CommandDate ASP:TextBox, and + ' save it into the CommandDate field in DataSource PersonalExtWork 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.CommandDate.Text, PersonalExtWorkTable.CommandDate) + + + End Sub + + Public Overridable Sub GetDescription() + + ' Retrieve the value entered by the user on the Description ASP:TextBox, and + ' save it into the Description field in DataSource PersonalExtWork record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.Description.Text, PersonalExtWorkTable.Description) + + + End Sub + + Public Overridable Sub GetEndDate() + + ' Retrieve the value entered by the user on the EndDate ASP:TextBox, and + ' save it into the EndDate field in DataSource PersonalExtWork 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.EndDate.Text, PersonalExtWorkTable.EndDate) + + + End Sub + + Public Overridable Sub GetPersonalId() + + ' Retrieve the value entered by the user on the PersonalId ASP:DropDownList, and + ' save it into the PersonalId field in DataSource PersonalExtWork record. + + ' Custom validation should be performed in Validate, not here. + + Me.DataSource.Parse(GetValueSelectedPageRequest(Me.PersonalId), PersonalExtWorkTable.PersonalId) + + End Sub + + Public Overridable Sub GetPlace() + + ' Retrieve the value entered by the user on the Place ASP:TextBox, and + ' save it into the Place field in DataSource PersonalExtWork record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.Place.Text, PersonalExtWorkTable.Place) + + + End Sub + + + ' To customize, override this method in PersonalExtWorkTableControlRow. + + Public Overridable Function CreateWhereClause() As WhereClause + + Return Nothing + + End Function + + + + ' To customize, override this method in PersonalExtWorkTableControlRow. + 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) + PersonalExtWorkTable.DeleteRecord(pkValue) + + DirectCast(GetParentControlObject(Me, "PersonalExtWorkTableControl"), PersonalExtWorkTableControl).DataChanged = True + DirectCast(GetParentControlObject(Me, "PersonalExtWorkTableControl"), PersonalExtWorkTableControl).ResetData = True + End Sub + + Protected Overridable Sub Control_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.PreRender + ' PreRender event is raised just before page is being displayed. + Try + DbUtils.StartTransaction() + Me.RegisterPostback() + + If Not Me.Page.ErrorOnPage AndAlso (Me.Page.IsPageRefresh OrElse Me.DataChanged OrElse Me.ResetData) Then + + + ' Re-load the data and update the web page if necessary. + ' This is typically done during a postback (filter, search button, sort, pagination button). + ' In each of the other click handlers, simply set DataChanged to True to reload the data. + Me.LoadData() + Me.DataBind() + End If + + + Catch ex As Exception + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + Finally + DbUtils.EndTransaction() + End Try + End Sub + + + Protected Overrides Sub SaveControlsToSession() + MyBase.SaveControlsToSession() + + + 'Save pagination state to session. + + End Sub + + + + Protected Overrides Sub ClearControlsFromSession() + MyBase.ClearControlsFromSession() + + + + ' Clear pagination state from session. + + End Sub + + Protected Overrides Sub LoadViewState(ByVal savedState As Object) + MyBase.LoadViewState(savedState) + Dim isNewRecord As String = CType(ViewState("IsNewRecord"), String) + If Not isNewRecord Is Nothing AndAlso isNewRecord.Trim <> "" Then + Me.IsNewRecord = Boolean.Parse(isNewRecord) + End If + + Dim myCheckSum As String = CType(ViewState("CheckSum"), String) + If Not myCheckSum Is Nothing AndAlso myCheckSum.Trim <> "" Then + Me.CheckSum = myCheckSum + End If + + + ' Load view state for pagination control. + + End Sub + + Protected Overrides Function SaveViewState() As Object + ViewState("IsNewRecord") = Me.IsNewRecord.ToString() + ViewState("CheckSum") = Me.CheckSum + + + ' Load view state for pagination control. + + Return MyBase.SaveViewState() + End Function + + + + Public Overridable Function CreateWhereClause_PersonalIdDropDownList() As WhereClause + ' By default, we simply return a new WhereClause. + ' Add additional where clauses to restrict the items shown in the dropdown list. + + Dim wc As WhereClause = New WhereClause() + Return wc + + End Function + + + ' Fill the PersonalId list. + Protected Overridable Sub PopulatePersonalIdDropDownList( _ + ByVal selectedValue As String, _ + ByVal maxItems As Integer) + + Me.PersonalId.Items.Clear() + + + ' 1. Setup the static list items + + ' Add the Please Select item. + Me.PersonalId.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_PersonalIdDropDownList function. + ' It is better to customize the where clause there. + + Dim wc As WhereClause = CreateWhereClause_PersonalIdDropDownList() + ' Create the ORDER BY clause to sort based on the displayed value. + + + ' 3. Read a total of maxItems from the database and insert them + Dim orderBy As OrderBy = New OrderBy(False, False) + orderBy.Add(PersonalExtWorkTable.PersonalId, OrderByItem.OrderDir.Asc) + + Dim itemValue As String + Dim listDuplicates As New ArrayList() + + For Each itemValue In PersonalExtWorkTable.GetValues(PersonalExtWorkTable.PersonalId, wc, orderBy, maxItems) + ' Create the dropdown list item and add it to the list. + Dim fvalue As String = PersonalExtWorkTable.PersonalId.Format(itemValue) + If fvalue Is Nothing OrElse fvalue.Trim() = "" Then fvalue = itemValue + Dim dupItem As ListItem = Me.PersonalId.Items.FindByText(fvalue) + + If Not IsNothing(dupItem) Then + listDuplicates.Add(fvalue) + dupItem.Text = fvalue & " (ID " & dupItem.Value & ")" + End If + + Dim newItem As ListItem = New ListItem(fvalue, itemValue) + Me.PersonalId.Items.Add(newItem) + + If listDuplicates.Contains(fvalue) Then + newItem.Text = fvalue & " (ID " & itemValue & ")" + End If + Next + + + ' 4. Set the selected value (insert if not already present). + + If Not selectedValue Is Nothing AndAlso _ + selectedValue.Trim <> "" AndAlso _ + Not SetSelectedValue(Me.PersonalId, selectedValue) AndAlso _ + Not SetSelectedDisplayText(Me.PersonalId, selectedValue) AndAlso _ + Not SetSelectedDisplayText(Me.PersonalId, PersonalExtWorkTable.PersonalId.Format(selectedValue))Then + Dim fvalue As String = PersonalExtWorkTable.PersonalId.Format(selectedValue) + If fvalue Is Nothing OrElse fvalue.Trim() = "" Then fvalue = selectedValue + Dim item As ListItem = New ListItem(fvalue, selectedValue) + item.Selected = True + Me.PersonalId.Items.Add(item) + End If + + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalExtWorkRowDeleteButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + If(Not Me.Page.IsPageRefresh) Then + + Dim tc As PersonalExtWorkTableControl = DirectCast(GetParentControlObject(Me, "PersonalExtWorkTableControl"), PersonalExtWorkTableControl) + If Not (IsNothing(tc)) Then + If Not Me.IsNewRecord Then + tc.AddToDeletedRecordIds(DirectCast(Me, PersonalExtWorkTableControlRow)) + End If + Me.Visible = False + tc.SetFormulaControls() + End If + + End If + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + Protected Overridable Sub PersonalId_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()(PersonalId.ClientID & "_SelectedValue"), String) + Dim displayText As String = CType(Me.Page.Session()(PersonalId.ClientID & "_SelectedDisplayText"), String) + If displayText <> "" AndAlso val <> "" Then + Me.PersonalId.Items.Add(New ListItem(displayText, val)) + Me.PersonalId.SelectedIndex = Me.PersonalId.Items.Count - 1 + Me.Page.Session.Remove(PersonalId.ClientID & "_SelectedValue") + Me.Page.Session.Remove(PersonalId.ClientID & "_SelectedDisplayText") + End If + + + + + End Sub + + Protected Overridable Sub Active_CheckedChanged(ByVal sender As Object, ByVal args As EventArgs) + + + End Sub + + Protected Overridable Sub BeginDate_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub Command_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub CommandDate_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub Description_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub EndDate_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub Place_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("BasePersonalExtWorkTableControlRow_Rec"), String) + End Get + Set(ByVal value As String) + Me.ViewState("BasePersonalExtWorkTableControlRow_Rec") = value + End Set + End Property + + Private _DataSource As PersonalExtWorkRecord + Public Property DataSource() As PersonalExtWorkRecord + Get + Return Me._DataSource + End Get + + Set(ByVal value As PersonalExtWorkRecord) + + Me._DataSource = value + End Set + End Property + + + + Private _checkSum As String + Public Overridable Property CheckSum() As String + Get + Return Me._checkSum + End Get + Set(ByVal value As String) + Me._checkSum = value + End Set + End Property + + Private _TotalPages As Integer + Public Property TotalPages() As Integer + Get + Return Me._TotalPages + End Get + Set(ByVal value As Integer) + Me._TotalPages = value + End Set + End Property + + Private _PageIndex As Integer + Public Property PageIndex() As Integer + Get + ' Return the PageIndex + Return Me._PageIndex + End Get + Set(ByVal value As Integer) + Me._PageIndex = value + End Set + End Property + + Private _DisplayLastPage As Boolean + Public Property DisplayLastPage() As Boolean + Get + Return Me._DisplayLastPage + End Get + Set(ByVal value As Boolean) + Me._DisplayLastPage = value + End Set + End Property + + + +#Region "Helper Properties" + + Public ReadOnly Property Active() As System.Web.UI.WebControls.CheckBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Active"), System.Web.UI.WebControls.CheckBox) + End Get + End Property + + Public ReadOnly Property BeginDate() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "BeginDate"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property Command() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Command"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property CommandDate() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "CommandDate"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property Description() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Description"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property EndDate() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "EndDate"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property PersonalExtWorkRecordRowSelection() As System.Web.UI.WebControls.CheckBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalExtWorkRecordRowSelection"), System.Web.UI.WebControls.CheckBox) + End Get + End Property + + Public ReadOnly Property PersonalExtWorkRowDeleteButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalExtWorkRowDeleteButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalId() As System.Web.UI.WebControls.DropDownList + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalId"), System.Web.UI.WebControls.DropDownList) + End Get + End Property + + Public ReadOnly Property Place() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Place"), System.Web.UI.WebControls.TextBox) + 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 PersonalExtWorkRecord = 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 PersonalExtWorkRecord + If Not Me.DataSource Is Nothing Then + Return Me.DataSource + End If + + If Not Me.RecordUniqueId Is Nothing Then + + Return PersonalExtWorkTable.GetRecord(Me.RecordUniqueId, True) + + End If + + ' Localization. + + Throw New Exception(Page.GetResourceValue("Err:RetrieveRec", "Persons")) + + End Function + + Public Shadows ReadOnly Property Page() As BaseApplicationPage + Get + Return DirectCast(MyBase.Page, BaseApplicationPage) + End Get + End Property + +#End Region + +End Class + + + +' Base class for the PersonalExtWorkTableControl control on the EditPersonalExtWorkTable2 page. +' Do not modify this class. Instead override any method in PersonalExtWorkTableControl. +Public Class BasePersonalExtWorkTableControl + Inherits Persons.UI.BaseApplicationTableControl + + + + Protected Overridable Sub Control_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Init + + + + ' Setup the filter and search events. + + + + ' Control Initializations. + ' Initialize the table's current sort order. + + If Me.InSession(Me, "Order_By") Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + Me.CurrentSortOrder.Add(PersonalExtWorkTable.BeginDate, OrderByItem.OrderDir.Asc) + + End If + + + + ' Setup default pagination settings. + + Me.PageSize = CInt(Me.GetFromSession(Me, "Page_Size", "10")) + Me.PageIndex = CInt(Me.GetFromSession(Me, "Page_Index", "0")) + + + + Me.ClearControlsFromSession() + End Sub + + Protected Overridable Sub Control_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load + + SaveControlsToSession_Ajax() + + ' Show confirmation message on Click + Me.PersonalExtWorkDeleteButton.Attributes.Add("onClick", "return (confirm('" & (CType(Me.Page,BaseApplicationPage)).GetResourceValue("DeleteConfirm", "Persons") & "'));") + + ' Setup the pagination events. + + AddHandler Me.PersonalExtWorkPagination.FirstPage.Click, AddressOf PersonalExtWorkPagination_FirstPage_Click + + AddHandler Me.PersonalExtWorkPagination.LastPage.Click, AddressOf PersonalExtWorkPagination_LastPage_Click + + AddHandler Me.PersonalExtWorkPagination.NextPage.Click, AddressOf PersonalExtWorkPagination_NextPage_Click + + AddHandler Me.PersonalExtWorkPagination.PageSizeButton.Click, AddressOf PersonalExtWorkPagination_PageSizeButton_Click + + AddHandler Me.PersonalExtWorkPagination.PreviousPage.Click, AddressOf PersonalExtWorkPagination_PreviousPage_Click + + + ' Setup the sorting events. + + AddHandler Me.ActiveLabel.Click, AddressOf ActiveLabel_Click + + AddHandler Me.BeginDateLabel.Click, AddressOf BeginDateLabel_Click + + AddHandler Me.CommandDateLabel.Click, AddressOf CommandDateLabel_Click + + AddHandler Me.CommandLabel.Click, AddressOf CommandLabel_Click + + AddHandler Me.DescriptionLabel1.Click, AddressOf DescriptionLabel1_Click + + AddHandler Me.EndDateLabel.Click, AddressOf EndDateLabel_Click + + AddHandler Me.PlaceLabel.Click, AddressOf PlaceLabel_Click + + ' Setup the button events. + + AddHandler Me.PersonalExtWorkAddButton.Click, AddressOf PersonalExtWorkAddButton_Click + + AddHandler Me.PersonalExtWorkDeleteButton.Click, AddressOf PersonalExtWorkDeleteButton_Click + + AddHandler Me.PersonalExtWorkEditButton.Click, AddressOf PersonalExtWorkEditButton_Click + + AddHandler Me.PersonalExtWorkRefreshButton.Click, AddressOf PersonalExtWorkRefreshButton_Click + + AddHandler Me.PersonalExtWorkResetButton.Click, AddressOf PersonalExtWorkResetButton_Click + + AddHandler Me.PersonalExtWorkSaveButton.Click, AddressOf PersonalExtWorkSaveButton_Click + + Me.PersonalExtWorkSaveButton.Attributes.Add("onclick", "SubmitHRefOnce(this, """ & Me.Page.GetResourceValue("Txt:SaveRecord", "Persons") & """);") + + + ' Setup events for others + + End Sub + + + Public Overridable Sub LoadData() + + ' Read data from database. Returns an array of records that can be assigned + ' to the DataSource table control property. + Try + Dim joinFilter As CompoundFilter = CreateCompoundJoinFilter() + + ' The WHERE clause will be empty when displaying all records in table. + Dim wc As WhereClause = CreateWhereClause() + If wc IsNot Nothing AndAlso Not wc.RunQuery Then + ' Initialize an empty array of records + Dim alist As New ArrayList(0) + Me.DataSource = DirectCast(alist.ToArray(GetType(PersonalExtWorkRecord)), PersonalExtWorkRecord()) + ' Add records to the list if needed. + Me.AddNewRecords() + Me._TotalRecords = 0 + Me._TotalPages = 0 + Return + End If + + ' Call OrderBy to determine the order - either use the order defined + ' on the Query Wizard, or specified by user (by clicking on column heading) + Dim orderBy As OrderBy = CreateOrderBy() + + ' Get the pagesize from the pagesize control. + Me.GetPageSize() + + If Me.DisplayLastPage Then + Dim totalRecords As Integer = If(Me._TotalRecords < 0, PersonalExtWorkTable.GetRecordCount(CreateCompoundJoinFilter(), CreateWhereClause()), Me._TotalRecords) + + Dim totalPages As Integer = CInt(Math.Ceiling(totalRecords / Me.PageSize)) + + Me.PageIndex = totalPages - 1 + End If + + ' Make sure PageIndex (current page) and PageSize are within bounds. + If Me.PageIndex < 0 Then + Me.PageIndex = 0 + End If + If Me.PageSize < 1 Then + Me.PageSize = 1 + End If + + ' Retrieve the records and set the table DataSource. + ' Only PageSize records are fetched starting at PageIndex (zero based). + If Me.AddNewRecord > 0 Then + ' Make sure to preserve the previously entered data on new rows. + Dim postdata As New ArrayList + For Each rc As PersonalExtWorkTableControlRow In Me.GetRecordControls() + If Not rc.IsNewRecord Then + rc.DataSource = rc.GetRecord() + rc.GetUIData() + postdata.Add(rc.DataSource) + UIData.Add(rc.PreservedUIData()) + End If + Next + Me.DataSource = DirectCast(postdata.ToArray(GetType(PersonalExtWorkRecord)), PersonalExtWorkRecord()) + Else ' Get the records from the database + Me.DataSource = PersonalExtWorkTable.GetRecords(joinFilter, wc, orderBy, Me.PageIndex, Me.PageSize) + + End If + + ' if the datasource contains no records contained in database, then load the last page. + If (DbUtils.GetCreatedRecords(Me.DataSource).Length = 0 AndAlso Not Me.DisplayLastPage) Then + Me.DisplayLastPage = True + LoadData() + Else + + ' Add any new rows desired by the user. + Me.AddNewRecords() + + ' Turn off the ToggleAll checkbox + Me.PersonalExtWorkToggleAll.Checked = False + + + ' Initialize the page and grand totals. now + + End If + + Catch ex As Exception + ' Report the error message to the end user + Dim msg As String = ex.Message + If ex.InnerException IsNot Nothing Then + msg = msg & " InnerException: " & ex.InnerException.Message + End If + Throw New Exception(msg, ex.InnerException) + End Try + End Sub + + + + + Public Overrides Sub DataBind() + ' The DataBind method binds the user interface controls to the values + ' from the database record for each row in the table. To do this, it calls the + ' DataBind for each of the rows. + ' DataBind also populates any filters above the table, and sets the pagination + ' control to the correct number of records and the current page number. + + MyBase.DataBind() + + ' Make sure that the DataSource is initialized. + If Me.DataSource Is Nothing Then + Return + End If + + 'LoadData for DataSource for chart and report if they exist + + ' Setup the pagination controls. + BindPaginationControls() + + + + ' Bind the repeater with the list of records to expand the UI. + Dim rep As System.Web.UI.WebControls.Repeater = CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalExtWorkTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return + rep.DataSource = DataSource() + rep.DataBind() + + Dim index As Integer = 0 + For Each repItem As System.Web.UI.WebControls.RepeaterItem In rep.Items + ' Loop through all rows in the table, set its DataSource and call DataBind(). + Dim recControl As PersonalExtWorkTableControlRow = DirectCast(repItem.FindControl("PersonalExtWorkTableControlRow"), PersonalExtWorkTableControlRow) + recControl.DataSource = Me.DataSource(index) + If Me.UIData.Count > index Then + recControl.PreviousUIData = Me.UIData(index) + End If + recControl.DataBind() + recControl.Visible = Not Me.InDeletedRecordIds(recControl) + + index += 1 + Next + + + + + ' Call the Set methods for each controls on the panel + + SetActiveLabel() + SetBeginDateLabel() + SetCommandDateLabel() + SetCommandLabel() + SetDescriptionLabel1() + SetEndDateLabel() + + + + + + + + SetPersonalExtWorkTableControlCollapsibleRegion() + SetPersonalExtWorkTableControlIcon() + SetPersonalExtWorkTableControlPanelExtender() + + + SetPlaceLabel() + ' setting the state of expand or collapse alternative rows + + + ' Load data for each record and table UI control. + ' Ordering is important because child controls get + ' their parent ids from their parent UI controls. + + + ' this method calls the set method for controls with special formula like running total, sum, rank, etc + SetFormulaControls() + End Sub + + Public Overridable Sub SetFormulaControls() + ' this method calls Set methods for the control that has special formula + + + + End Sub + + + + Public Overridable Sub RegisterPostback() + + Me.Page.RegisterPostBackTrigger(MiscUtils.FindControlRecursively(Me,"PersonalExtWorkSaveButton")) + + + End Sub + + Public EvaluateFormulaDelegate As BaseClasses.Data.DataSource.EvaluateFormulaDelegate = New BaseClasses.Data.DataSource.EvaluateFormulaDelegate(AddressOf Me.EvaluateFormula) + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean, ByVal e as FormulaEvaluator) As String + If e Is Nothing + e = New FormulaEvaluator() + End If + + e.Variables.Clear() + + + ' add variables for formula evaluation + If variables IsNot Nothing Then + Dim enumerator As System.Collections.Generic.IEnumerator(Of System.Collections.Generic.KeyValuePair(Of String, Object)) = variables.GetEnumerator() + While enumerator.MoveNext() + e.Variables.Add(enumerator.Current.Key, enumerator.Current.Value) + End While + End If + + If includeDS + + End If + + ' All variables referred to in the formula are expected to be + ' properties of the DataSource. For example, referring to + ' UnitPrice as a variable will refer to DataSource.UnitPrice + e.DataSource = dataSourceForEvaluate + + ' Define the calling control. This is used to add other + ' related table and record controls as variables. + e.CallingControl = Me + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + + If Not String.IsNullOrEmpty(format) AndAlso (String.IsNullOrEmpty(formula) OrElse formula.IndexOf("Format(") < 0) Then + Return FormulaUtils.Format(resultObj, format) + Else + Return resultObj.ToString() + End If + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format,variables ,includeDS, Nothing) + End Function + + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object)) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format, variables ,True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, format, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal e as FormulaEvaluator) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, variables, True, e) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal includeDS as Boolean) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, includeDS, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, True, Nothing) + End Function + + + + + Public Overridable Sub ResetControl() + + Me.CurrentSortOrder.Reset() + If (Me.InSession(Me, "Order_By")) Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + Me.CurrentSortOrder.Add(PersonalExtWorkTable.BeginDate, OrderByItem.OrderDir.Asc) + + End If + + Me.PageIndex = 0 + End Sub + + Protected Overridable Sub BindPaginationControls() + ' Setup the pagination controls. + + ' Bind the pagination labels. + + If DbUtils.GetCreatedRecords(Me.DataSource).Length > 0 Then + + Me.PersonalExtWorkPagination.CurrentPage.Text = (Me.PageIndex + 1).ToString() + Else + Me.PersonalExtWorkPagination.CurrentPage.Text = "0" + End If + Me.PersonalExtWorkPagination.PageSize.Text = Me.PageSize.ToString() + Me.PersonalExtWorkPagination.TotalItems.Text = Me.TotalRecords.ToString() + Me.PersonalExtWorkPagination.TotalPages.Text = Me.TotalPages.ToString() + + ' Bind the buttons for PersonalExtWorkTableControl pagination. + + Me.PersonalExtWorkPagination.FirstPage.Enabled = Not (Me.PageIndex = 0) + If Me._TotalPages < 0 Then ' if the total pages is not determined yet, enable last and next buttons + Me.PersonalExtWorkPagination.LastPage.Enabled = True + ElseIf Me._TotalPages = 0 ' if the total pages is determined and it is 0, enable last and next buttons + Me.PersonalExtWorkPagination.LastPage.Enabled = False + Else ' if the total pages is the last page, disable last and next buttons + Me.PersonalExtWorkPagination.LastPage.Enabled = Not (Me.PageIndex = Me.TotalPages - 1) + End If + + If Me._TotalPages < 0 Then ' if the total pages is not determined yet, enable last and next buttons + Me.PersonalExtWorkPagination.NextPage.Enabled = True + ElseIf Me._TotalPages = 0 ' if the total pages is determined and it is 0, enable last and next buttons + Me.PersonalExtWorkPagination.NextPage.Enabled = False + Else ' if the total pages is the last page, disable last and next buttons + Me.PersonalExtWorkPagination.NextPage.Enabled = Not (Me.PageIndex = Me.TotalPages - 1) + End If + + Me.PersonalExtWorkPagination.PreviousPage.Enabled = Not (Me.PageIndex = 0) + + + End Sub + + Public Overridable Sub SaveData() + ' Save the data from the entire table. Calls each row's Save Data + ' to save their data. This function is called by the Click handler of the + ' Save button. The button handler should Start/Commit/End a transaction. + + Dim recCtl As PersonalExtWorkTableControlRow + For Each recCtl In Me.GetRecordControls() + + If Me.InDeletedRecordIds(recCtl) Then + ' Delete any pending deletes. + recCtl.Delete() + Else + If recCtl.Visible Then + recCtl.SaveData() + End If + End If + + Next + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + ' Set IsNewRecord to False for all records - since everything has been saved and is no longer "new" + For Each recCtl In Me.GetRecordControls() + recCtl.IsNewRecord = False + Next + + + ' Set DeletedRecordsIds to Nothing since we have deleted all pending deletes. + Me.DeletedRecordIds = Nothing + + End Sub + + Public Overridable Function CreateCompoundJoinFilter() As CompoundFilter + Dim jFilter As CompoundFilter = New CompoundFilter() + + Return jFilter + + End Function + + + Public Overridable Function CreateOrderBy() As OrderBy + ' The CurrentSortOrder is initialized to the sort order on the + ' Query Wizard. It may be modified by the Click handler for any of + ' the column heading to sort or reverse sort by that column. + ' You can add your own sort order, or modify it on the Query Wizard. + Return Me.CurrentSortOrder + End Function + + Public Overridable Function CreateWhereClause() As WhereClause + 'This CreateWhereClause is used for loading the data. + PersonalExtWorkTable.Instance.InnerFilter = Nothing + Dim wc As WhereClause = New WhereClause() + + ' Compose the WHERE clause consiting of: + ' 1. Static clause defined at design time. + ' 2. User selected search criteria. + ' 3. User selected filter criteria. + + + ' Get the static clause defined at design time on the Table Panel Wizard + Dim qc As WhereClause = Me.CreateQueryClause() + If Not(IsNothing(qc)) Then + wc.iAND(qc) + End If + + Return wc + End Function + + + Public Overridable Function CreateWhereClause(ByVal searchText as String, ByVal fromSearchControl as String, ByVal AutoTypeAheadSearch as String, ByVal AutoTypeAheadWordSeparators as String) As WhereClause + ' This CreateWhereClause is used for loading list of suggestions for Auto Type-Ahead feature. + PersonalExtWorkTable.Instance.InnerFilter = Nothing + Dim wc As WhereClause = New WhereClause() + + ' Compose the WHERE clause consiting of: + ' 1. Static clause defined at design time. + ' 2. User selected search criteria. + ' 3. User selected filter criteria. + + Dim appRelativeVirtualPath As String = CType(HttpContext.Current.Session("AppRelativeVirtualPath"), String) + + ' Get the static clause defined at design time on the Table Panel Wizard + Dim qc As WhereClause = Me.CreateQueryClause() + If Not(IsNothing(qc)) Then + wc.iAND(qc) + End If + + ' Adds clauses if values are selected in Filter controls which are configured in the page. + + + Return wc + End Function + + Protected Overridable Function CreateQueryClause() As WhereClause + ' Create a where clause for the Static clause defined at design time. + Dim filter As CompoundFilter = New CompoundFilter(CompoundFilter.CompoundingOperators.And_Operator, Nothing) + Dim whereClause As WhereClause = New WhereClause() + + filter.AddFilter(New BaseClasses.Data.SignedInUserFilter(BaseClasses.Data.BaseTable.CreateInstance("Persons.Business.PersonalExtWorkTable, App_Code").TableDefinition.ColumnList.GetByUniqueName("PersonalExtWork_.PersonalId"), New BaseClasses.Data.IdentifierAliasInfo("PersonalExtWork_", Nothing), BaseClasses.Data.BaseFilter.ComparisonOperator.EqualsTo, False)) + + whereClause.AddFilter(filter, CompoundFilter.CompoundingOperators.And_Operator) + + Return whereClause + + End Function + + + Public Overridable Function FormatSuggestions(ByVal prefixText As String, ByVal resultItem As String, _ + ByVal columnLength As Integer, ByVal AutoTypeAheadDisplayFoundText As String, _ + ByVal autoTypeAheadSearch As String, ByVal AutoTypeAheadWordSeparators As String, _ + ByVal resultList As ArrayList) As Boolean + + 'Formats the resultItem and adds it to the list of suggestions. + Dim index As Integer = resultItem.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture).IndexOf(prefixText.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture)) + Dim itemToAdd As String = "" + Dim isFound As Boolean = False + Dim isAdded As Boolean = False + ' Get the index where prfixt is at the beginning of resultItem. If not found then, index of word which begins with prefixText. + If InvariantLCase(autoTypeAheadSearch).equals("wordsstartingwithsearchstring") And Not index = 0 Then + ' Expression to find word which contains AutoTypeAheadWordSeparators followed by prefixText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex( AutoTypeAheadWordSeparators + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + If regex1.IsMatch(resultItem) Then + index = regex1.Match(resultItem).Index + isFound = True + End If + ' If the prefixText is found immediatly after white space then starting of the word is found so don not search any further + If not resultItem(index).ToString() = " " Then + ' Expression to find beginning of the word which contains AutoTypeAheadWordSeparators followed by prefixText + Dim regex As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\\S*" + AutoTypeAheadWordSeparators + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + If regex.IsMatch(resultItem) Then + index = regex.Match(resultItem).Index + isFound = True + End If + End If + End If + + ' If autoTypeAheadSearch value is wordsstartingwithsearchstring then, extract the substring only if the prefixText is found at the + ' beginning of the resultItem (index = 0) or a word in resultItem is found starts with prefixText. + If index = 0 Or isFound Or InvariantLCase(autoTypeAheadSearch).Equals("anywhereinstring") then + If InvariantLCase(AutoTypeAheadDisplayFoundText).equals("atbeginningofmatchedstring") Then + ' Expression to find beginning of the word which contains prefixText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\\S*" + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + ' Find the beginning of the word which contains prefexText + If (StringUtils.InvariantLCase(autoTypeAheadSearch).Equals("anywhereinstring") AndAlso regex1.IsMatch(resultItem)) Then + index = regex1.Match(resultItem).Index + isFound = True + End If + ' Display string from the index till end of the string if sub string from index till end is less than columnLength value. + If Len(resultItem) - index <= columnLength Then + If index = 0 Then + itemToAdd = resultItem + Else + itemToAdd = "..." & resultItem.Substring(index, Len(resultItem) - index) + End If + Else + If index = 0 Then + itemToAdd = resultItem.Substring(index, (columnLength - 3)) & "..." + Else + 'Truncate the string to show only columnLength - 6 characters as begining and trailing "..." has to be appended. + itemToAdd = "..." & resultItem.Substring(index , columnLength - 6) & "..." + End If + End If + ElseIf InvariantLCase(AutoTypeAheadDisplayFoundText).equals("inmiddleofmatchedstring") Then + Dim subStringBeginIndex As Integer = CType(columnLength/2, Integer) + If Len(resultItem) <= columnLength Then + itemToAdd = resultItem + Else + ' Sanity check at end of the string + If index + Len(prefixText) = columnLength Then + itemToAdd = "..." & resultItem.Substring(index-columnLength,index) + ElseIf Len(resultItem) - index < subStringBeginIndex Then + ' Display string from the end till columnLength value if, index is closer to the end of the string. + itemToAdd = "..." & resultItem.Substring(Len(resultItem)-columnLength,Len(resultItem)) + ElseIf index <= subStringBeginIndex Then + ' Sanity chet at beginning of the string + itemToAdd = resultItem.Substring(0, columnLength) & "..." + Else + ' Display string containing text before the prefixText occures and text after the prefixText + itemToAdd = "..." & resultItem.Substring(index - subStringBeginIndex, columnLength) & "..." + End If + End If + ElseIf InvariantLCase(AutoTypeAheadDisplayFoundText).equals("atendofmatchedstring") Then + ' Expression to find ending of the word which contains prefexText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\s", System.Text.RegularExpressions.RegexOptions.IgnoreCase) + ' Find the ending of the word which contains prefexText + If regex1.IsMatch(resultItem, index + 1) Then + index = regex1.Match(resultItem, index + 1).Index + Else + ' If the word which contains prefexText is the last word in string, regex1.IsMatch returns false. + index = resultItem.Length + End If + If index > Len(resultItem) Then + index = Len(resultItem) + End If + ' If text from beginning of the string till index is less than columnLength value then, display string from the beginning till index. + If index <= columnLength Then + if index = Len(resultItem) Then 'Make decision to append "..." + itemToAdd = resultItem.Substring(0,index) + Else + itemToAdd = resultItem.Substring(0,index) & "..." + End If + Else + If index = Len(resultItem) Then + itemToAdd = "..." & resultItem.Substring(index - (columnLength - 3), (columnLength - 3)) + Else + 'Truncate the string to show only columnLength - 6 characters as begining and trailing "..." has to be appended. + itemToAdd = "..." & resultItem.Substring(index - (columnLength - 6), columnLength - 6) & "..." + End If + End If + End If + + ' Remove newline character from itemToAdd + Dim prefixTextIndex As Integer = itemToAdd.IndexOf(prefixText, StringComparison.CurrentCultureIgnoreCase) + ' If itemToAdd contains any newline after the search text then show text only till newline + Dim regex2 As System.Text.RegularExpressions.Regex = New System.Text.RegularExpressions.Regex("(" & vbCrLf & "|" & vbLf & ")", System.Text.RegularExpressions.RegexOptions.IgnoreCase) + Dim newLineIndexAfterPrefix As Integer = -1 + If regex2.IsMatch(itemToAdd, prefixTextIndex) Then + newLineIndexAfterPrefix = regex2.Match(itemToAdd, prefixTextIndex).Index + End If + If (newLineIndexAfterPrefix > -1) Then + If itemToAdd.EndsWith("...") Then + itemToAdd = (itemToAdd.Substring(0, newLineIndexAfterPrefix) + "...") + Else + itemToAdd = itemToAdd.Substring(0, newLineIndexAfterPrefix) + End If + End If + ' If itemToAdd contains any newline before search text then show text which comes after newline + Dim regex3 As System.Text.RegularExpressions.Regex = New System.Text.RegularExpressions.Regex("(" & vbCrLf & "|" & vbLf & ")", (System.Text.RegularExpressions.RegexOptions.IgnoreCase Or System.Text.RegularExpressions.RegexOptions.RightToLeft)) + Dim newLineIndexBeforePrefix As Integer = -1 + If regex3.IsMatch(itemToAdd, prefixTextIndex) Then + newLineIndexBeforePrefix = regex3.Match(itemToAdd, prefixTextIndex).Index + End If + If (newLineIndexBeforePrefix > -1) Then + If itemToAdd.StartsWith("...") Then + itemToAdd = ("..." + itemToAdd.Substring((newLineIndexBeforePrefix + regex3.Match(itemToAdd, prefixTextIndex).Length))) + Else + itemToAdd = itemToAdd.Substring((newLineIndexBeforePrefix + regex3.Match(itemToAdd, prefixTextIndex).Length)) + End If + End If + + If Not itemToAdd is nothing AndAlso Not resultList.Contains(itemToAdd) Then + + resultList.Add(itemToAdd) + + isAdded = true + End If + End If + Return isAdded + End Function + + + Protected Overridable Sub GetPageSize() + + If Me.PersonalExtWorkPagination.PageSize.Text.Trim <> "" Then + Try + 'Me.PageSize = Integer.Parse(Me.PersonalExtWorkPagination.PageSize.Text) + Catch ex As Exception + End Try + End If + End Sub + + Protected Overridable Sub AddNewRecords() + + Dim newRecordList As ArrayList = New ArrayList() + + Dim newUIDataList As System.Collections.Generic.List(Of Hashtable) = New System.Collections.Generic.List(Of Hashtable)() + + ' Loop though all the record controls and if the record control + ' does not have a unique record id set, then create a record + ' and add to the list. + If Not Me.ResetData Then + Dim rep As System.Web.UI.WebControls.Repeater = CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalExtWorkTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return + + Dim repItem As System.Web.UI.WebControls.RepeaterItem + For Each repItem In rep.Items + ' Loop through all rows in the table, set its DataSource and call DataBind(). + + Dim recControl As PersonalExtWorkTableControlRow = DirectCast(repItem.FindControl("PersonalExtWorkTableControlRow"), PersonalExtWorkTableControlRow) + + If recControl.Visible AndAlso recControl.IsNewRecord() Then + + Dim rec As PersonalExtWorkRecord = New PersonalExtWorkRecord() + + rec.Active = recControl.Active.Checked + + If recControl.BeginDate.Text <> "" Then + rec.Parse(recControl.BeginDate.Text, PersonalExtWorkTable.BeginDate) + End If + If recControl.Command.Text <> "" Then + rec.Parse(recControl.Command.Text, PersonalExtWorkTable.Command) + End If + If recControl.CommandDate.Text <> "" Then + rec.Parse(recControl.CommandDate.Text, PersonalExtWorkTable.CommandDate) + End If + If recControl.Description.Text <> "" Then + rec.Parse(recControl.Description.Text, PersonalExtWorkTable.Description) + End If + If recControl.EndDate.Text <> "" Then + rec.Parse(recControl.EndDate.Text, PersonalExtWorkTable.EndDate) + End If + If MiscUtils.IsValueSelected(recControl.PersonalId) Then + rec.Parse(recControl.PersonalId.SelectedItem.Value, PersonalExtWorkTable.PersonalId) + End If + If recControl.Place.Text <> "" Then + rec.Parse(recControl.Place.Text, PersonalExtWorkTable.Place) + End If + newUIDataList.Add(recControl.PreservedUIData()) + newRecordList.Add(rec) + End If + Next + End If + + + ' Add any new record to the list. + Dim index As Integer = 0 + For index = 1 To Me.AddNewRecord + + newRecordList.Insert(0, New PersonalExtWorkRecord()) + newUIDataList.Insert(0, New Hashtable()) + + Next + Me.AddNewRecord = 0 + + ' Finally, add any new records to the DataSource. + If newRecordList.Count > 0 Then + + Dim finalList As ArrayList = New ArrayList(Me.DataSource) + finalList.InsertRange(0, newRecordList) + + Me.DataSource = DirectCast(finalList.ToArray(GetType(PersonalExtWorkRecord)), PersonalExtWorkRecord()) + + End If + + ' Add the existing UI data to this hash table + If newUIDataList.Count > 0 Then + Me.UIData.InsertRange(0, newUIDataList) + End If + + End Sub + + + Public Sub AddToDeletedRecordIds(ByVal rec As PersonalExtWorkTableControlRow) + If rec.IsNewRecord() Then + Return + End If + + If Not Me.DeletedRecordIds Is Nothing AndAlso Me.DeletedRecordIds.Trim <> "" Then + Me.DeletedRecordIds &= "," + End If + + Me.DeletedRecordIds &= "[" & rec.RecordUniqueId & "]" + End Sub + + Protected Overridable Function InDeletedRecordIds(ByVal rec As PersonalExtWorkTableControlRow) As Boolean + If Me.DeletedRecordIds Is Nothing OrElse Me.DeletedRecordIds.Trim = "" Then + Return False + End If + + Return Me.DeletedRecordIds.IndexOf("[" & rec.RecordUniqueId & "]") >= 0 + End Function + + Private _DeletedRecordIds As String + Public Property DeletedRecordIds() As String + Get + Return Me._DeletedRecordIds + End Get + Set(ByVal value As String) + Me._DeletedRecordIds = value + End Set + End Property + + + ' Create Set, WhereClause, and Populate Methods + + Public Overridable Sub SetActiveLabel() + + End Sub + + Public Overridable Sub SetBeginDateLabel() + + End Sub + + Public Overridable Sub SetCommandDateLabel() + + End Sub + + Public Overridable Sub SetCommandLabel() + + End Sub + + Public Overridable Sub SetDescriptionLabel1() + + End Sub + + Public Overridable Sub SetEndDateLabel() + + End Sub + + Public Overridable Sub SetPersonalExtWorkTableControlCollapsibleRegion() + + End Sub + + Public Overridable Sub SetPersonalExtWorkTableControlIcon() + + End Sub + + Public Overridable Sub SetPersonalExtWorkTableControlPanelExtender() + + End Sub + + Public Overridable Sub SetPlaceLabel() + + 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. + Dim added As Boolean = Me.AddNewRecord > 0 + Me.LoadData() + Me.DataBind() + + If added Then + Me.SetFocusToAddedRow() + End If + + End If + + + + Catch ex As Exception + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + Finally + DbUtils.EndTransaction + End Try + End Sub + + 'this function sets focus to the first editable element in the new added row in the editable table + Protected Overridable Sub SetFocusToAddedRow() + Dim rep As System.Web.UI.WebControls.Repeater = CType(Me.FindControl("PersonalExtWorkTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing OrElse rep.Items.Count = 0 Then Return + Dim repItem As System.Web.UI.WebControls.RepeaterItem + For Each repItem In rep.Items + 'Load scripts to table rows + Me.Page.LoadFocusScripts(repItem) + Dim recControl As PersonalExtWorkTableControlRow = DirectCast(repItem.FindControl("PersonalExtWorkTableControlRow"), PersonalExtWorkTableControlRow) + If recControl.IsNewRecord Then + For Each field As Control In recControl.Controls + If field.Visible AndAlso Me.Page.IsControlEditable(field, False) Then + 'set focus on the first editable field in the new row + field.Focus() + Dim updPan As UpdatePanel = DirectCast(Me.Page.FindControlRecursively("UpdatePanel1"), UpdatePanel) + If Not updPan Is Nothing Then updPan.Update() + Return + End If + Next + Return + End If + Next + End Sub + + + Protected Overrides Sub SaveControlsToSession() + MyBase.SaveControlsToSession() + + ' Save filter controls to values to session. + + + 'Save pagination state to session. + + + + ' Save table control properties to the session. + If Not Me.CurrentSortOrder Is Nothing Then + Me.SaveToSession(Me, "Order_By", Me.CurrentSortOrder.ToXmlString()) + End If + + Me.SaveToSession(Me, "Page_Index", Me.PageIndex.ToString()) + Me.SaveToSession(Me, "Page_Size", Me.PageSize.ToString()) + + Me.SaveToSession(Me, "DeletedRecordIds", Me.DeletedRecordIds) + + End Sub + + Protected Sub SaveControlsToSession_Ajax() + ' Save filter controls to values to session. + + HttpContext.Current.Session("AppRelativeVirtualPath") = Me.Page.AppRelativeVirtualPath + + End Sub + + Protected Overrides Sub ClearControlsFromSession() + MyBase.ClearControlsFromSession() + + ' Clear filter controls values from the session. + + + ' Clear pagination state from session. + + + + ' Clear table properties from the session. + Me.RemoveFromSession(Me, "Order_By") + Me.RemoveFromSession(Me, "Page_Index") + Me.RemoveFromSession(Me, "Page_Size") + + Me.RemoveFromSession(Me, "DeletedRecordIds") + + End Sub + + Protected Overrides Sub LoadViewState(ByVal savedState As Object) + MyBase.LoadViewState(savedState) + + Dim orderByStr As String = CType(ViewState("PersonalExtWorkTableControl_OrderBy"), String) + + If orderByStr IsNot Nothing AndAlso orderByStr.Trim <> "" Then + Me.CurrentSortOrder = BaseClasses.Data.OrderBy.FromXmlString(orderByStr) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + End If + + Dim pageIndex As String = CType(ViewState("Page_Index"), String) + If pageIndex IsNot Nothing Then + Me.PageIndex = CInt(pageIndex) + End If + + Dim pageSize As String = CType(ViewState("Page_Size"), String) + If Not pageSize Is Nothing Then + Me.PageSize = CInt(pageSize) + End If + + + + ' Load view state for pagination control. + + Me.DeletedRecordIds = CType(Me.ViewState("DeletedRecordIds"), String) + + End Sub + + Protected Overrides Function SaveViewState() As Object + + If Me.CurrentSortOrder IsNot Nothing Then + Me.ViewState("PersonalExtWorkTableControl_OrderBy") = Me.CurrentSortOrder.ToXmlString() + End If + + Me.ViewState("Page_Index") = Me.PageIndex + Me.ViewState("Page_Size") = Me.PageSize + + Me.ViewState("DeletedRecordIds") = Me.DeletedRecordIds + + + ' Load view state for pagination control. + + + Return MyBase.SaveViewState() + End Function + + ' Generate the event handling functions for pagination events. + + ' event handler for ImageButton + Public Overridable Sub PersonalExtWorkPagination_FirstPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.PageIndex = 0 + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalExtWorkPagination_LastPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.DisplayLastPage = True + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalExtWorkPagination_NextPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.PageIndex += 1 + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for LinkButton + Public Overridable Sub PersonalExtWorkPagination_PageSizeButton_Click(ByVal sender As Object, ByVal args As EventArgs) + + Try + + Me.DataChanged = True + + Me.PageSize = Integer.Parse(Me.PersonalExtWorkPagination.PageSize.Text) + + Me.PageIndex = Integer.Parse(Me.PersonalExtWorkPagination.CurrentPage.Text) - 1 + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalExtWorkPagination_PreviousPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + If Me.PageIndex > 0 Then + Me.PageIndex -= 1 + Me.DataChanged = True + End If + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + + ' Generate the event handling functions for sorting events. + + Public Overridable Sub ActiveLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by Active when clicked. + + ' Get previous sorting state for Active. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalExtWorkTable.Active) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for Active. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalExtWorkTable.Active, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by Active, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub BeginDateLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by BeginDate when clicked. + + ' Get previous sorting state for BeginDate. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalExtWorkTable.BeginDate) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for BeginDate. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalExtWorkTable.BeginDate, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by BeginDate, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub CommandDateLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by CommandDate when clicked. + + ' Get previous sorting state for CommandDate. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalExtWorkTable.CommandDate) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for CommandDate. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalExtWorkTable.CommandDate, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by CommandDate, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub CommandLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by Command when clicked. + + ' Get previous sorting state for Command. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalExtWorkTable.Command) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for Command. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalExtWorkTable.Command, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by Command, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub DescriptionLabel1_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by Description when clicked. + + ' Get previous sorting state for Description. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalExtWorkTable.Description) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for Description. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalExtWorkTable.Description, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by Description, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub EndDateLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by EndDate when clicked. + + ' Get previous sorting state for EndDate. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalExtWorkTable.EndDate) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for EndDate. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalExtWorkTable.EndDate, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by EndDate, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub PlaceLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by Place when clicked. + + ' Get previous sorting state for Place. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalExtWorkTable.Place) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for Place. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalExtWorkTable.Place, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by Place, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + + ' Generate the event handling functions for button events. + + ' event handler for ImageButton + Public Overridable Sub PersonalExtWorkAddButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + Me.AddNewRecord = 1 + Me.DataChanged = True + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalExtWorkDeleteButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + If(Not Me.Page.IsPageRefresh) Then + + Me.DeleteSelectedRecords(True) + Me.SetFormulaControls() + + + End If + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalExtWorkEditButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + ' The redirect URL is set on the Properties, Custom Properties or Actions. + ' The ModifyRedirectURL call resolves the parameters before the + ' Response.Redirect redirects the page to the URL. + ' Any code after the Response.Redirect call will not be executed, since the page is + ' redirected to the URL. + + + Dim url As String = "../PersonalExtWork/EditPersonalExtWork.aspx?PersonalExtWork={PK}" + + Dim shouldRedirect As Boolean = True + Dim TargetKey As String = Nothing + Dim DFKA As String = TargetKey + Dim id As String = DFKA + Dim value As String = id + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + url = Me.ModifyRedirectUrl(url, "",False) + url = Me.Page.ModifyRedirectUrl(url, "",False) + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + shouldRedirect = False + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + If shouldRedirect Then + Me.Page.ShouldSaveControlsToSession = True + Me.Page.Response.Redirect(url) + ElseIf Not TargetKey Is Nothing AndAlso _ + Not shouldRedirect Then + Me.Page.ShouldSaveControlsToSession = True + Me.Page.CloseWindow(True) + + End If + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalExtWorkRefreshButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Dim PersonalExtWorkTableControlObj as PersonalExtWorkTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalExtWorkTableControl"), PersonalExtWorkTableControl) + PersonalExtWorkTableControlObj.ResetData = True + + PersonalExtWorkTableControlObj.RemoveFromSession(PersonalExtWorkTableControlObj, "DeletedRecordIds") + PersonalExtWorkTableControlObj.DeletedRecordIds = Nothing + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalExtWorkResetButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.CurrentSortOrder.Reset() + If Me.InSession(Me, "Order_By") Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + Me.CurrentSortOrder.Add(PersonalExtWorkTable.BeginDate, OrderByItem.OrderDir.Asc) + + + End If + + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalExtWorkSaveButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + + If (Not Me.Page.IsPageRefresh) Then + Me.SaveData() + End If + + Me.Page.CommitTransaction(sender) + ' Set IsNewRecord to False for all records - since everything has been saved and is no longer "new" + Dim recCtl As PersonalExtWorkTableControlRow + For Each recCtl in Me.GetRecordControls() + + recCtl.IsNewRecord = False + Next + + + ' Set DeletedRecordsIds to Nothing since we have deleted all pending deletes. + + Me.DeletedRecordIds = Nothing + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + + + ' Generate the event handling functions for filter and search events. + + + ' Generate the event handling functions for others + + + Private _UIData As New System.Collections.Generic.List(Of Hashtable) + Public Property UIData() As System.Collections.Generic.List(Of Hashtable) + Get + Return Me._UIData + End Get + Set(ByVal value As System.Collections.Generic.List(Of Hashtable)) + Me._UIData = value + End Set + End Property + + ' pagination properties + Protected _PageSize As Integer + Public Property PageSize() As Integer + Get + Return Me._PageSize + End Get + Set(ByVal value As Integer) + Me._PageSize = value + End Set + End Property + + Protected _PageIndex As Integer + Public Property PageIndex() As Integer + Get + ' Return the PageIndex + Return Me._PageIndex + End Get + Set(ByVal value As Integer) + Me._PageIndex = value + End Set + End Property + + Protected _TotalRecords As Integer = -1 + Public Property TotalRecords() As Integer + Get + If _TotalRecords < 0 + _TotalRecords = PersonalExtWorkTable.GetRecordCount(CreateCompoundJoinFilter(), CreateWhereClause()) + End If + Return Me._TotalRecords + End Get + Set(ByVal value As Integer) + If Me.PageSize > 0 Then + + Me.TotalPages = CInt(Math.Ceiling(value / Me.PageSize)) + + End If + Me._TotalRecords = value + End Set + End Property + + + + Protected _TotalPages As Integer = -1 + Public Property TotalPages() As Integer + Get + If _TotalPages < 0 Then + + Me.TotalPages = CInt(Math.Ceiling(TotalRecords / Me.PageSize)) + + End If + Return Me._TotalPages + End Get + Set(ByVal value As Integer) + Me._TotalPages = value + End Set + End Property + + Protected _DisplayLastPage As Boolean + Public Property DisplayLastPage() As Boolean + Get + Return Me._DisplayLastPage + End Get + Set(ByVal value As Boolean) + Me._DisplayLastPage = value + End Set + End Property + + Private _DataChanged As Boolean = False + Public Property DataChanged() As Boolean + Get + Return Me._DataChanged + End Get + Set(ByVal value As Boolean) + Me._DataChanged = value + End Set + End Property + + Private _ResetData As Boolean = False + Public Property ResetData() As Boolean + Get + Return Me._ResetData + End Get + Set(ByVal value As Boolean) + Me._ResetData = value + End Set + End Property + + Private _AddNewRecord As Integer = 0 + Public Property AddNewRecord() As Integer + Get + Return Me._AddNewRecord + End Get + Set(ByVal value As Integer) + Me._AddNewRecord = value + End Set + End Property + + + Private _CurrentSortOrder As OrderBy = Nothing + Public Property CurrentSortOrder() As OrderBy + Get + Return Me._CurrentSortOrder + End Get + Set(ByVal value As BaseClasses.Data.OrderBy) + Me._CurrentSortOrder = value + End Set + End Property + + Private _DataSource() As PersonalExtWorkRecord = Nothing + Public Property DataSource() As PersonalExtWorkRecord () + Get + Return Me._DataSource + End Get + Set(ByVal value() As PersonalExtWorkRecord) + Me._DataSource = value + End Set + End Property + +#Region "Helper Properties" + + Public ReadOnly Property ActiveLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "ActiveLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property BeginDateLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "BeginDateLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property CommandDateLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "CommandDateLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property CommandLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "CommandLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property DescriptionLabel1() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "DescriptionLabel1"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property EndDateLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "EndDateLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property PersonalExtWorkAddButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalExtWorkAddButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalExtWorkDeleteButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalExtWorkDeleteButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalExtWorkEditButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalExtWorkEditButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalExtWorkPagination() As Persons.UI.IPagination + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalExtWorkPagination"), Persons.UI.IPagination) + End Get + End Property + + Public ReadOnly Property PersonalExtWorkRefreshButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalExtWorkRefreshButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalExtWorkResetButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalExtWorkResetButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalExtWorkSaveButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalExtWorkSaveButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalExtWorkTableControlCollapsibleRegion() As System.Web.UI.WebControls.Panel + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalExtWorkTableControlCollapsibleRegion"), System.Web.UI.WebControls.Panel) + End Get + End Property + + Public ReadOnly Property PersonalExtWorkTableControlIcon() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalExtWorkTableControlIcon"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalExtWorkTableControlPanelExtender() As AjaxControlToolkit.CollapsiblePanelExtender + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalExtWorkTableControlPanelExtender"), AjaxControlToolkit.CollapsiblePanelExtender) + End Get + End Property + + Public ReadOnly Property PersonalExtWorkTitle() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalExtWorkTitle"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property PersonalExtWorkToggleAll() As System.Web.UI.WebControls.CheckBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalExtWorkToggleAll"), System.Web.UI.WebControls.CheckBox) + End Get + End Property + + Public ReadOnly Property PlaceLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PlaceLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + +#End Region + +#Region "Helper Functions" + + Public Overrides Overloads Function ModifyRedirectUrl(url As String, arg As String, ByVal bEncrypt As Boolean) As String + Return Me.Page.EvaluateExpressions(url, arg, bEncrypt, Me) + End Function + + Public Overrides Overloads Function EvaluateExpressions(url As String, arg As String, ByVal bEncrypt As Boolean) As String + Dim needToProcess As Boolean = AreAnyUrlParametersForMe(url, arg) + If (needToProcess) Then + Dim recCtl As PersonalExtWorkTableControlRow = Me.GetSelectedRecordControl() + If recCtl Is Nothing AndAlso url.IndexOf("{") >= 0 Then + ' Localization. + Throw New Exception(Page.GetResourceValue("Err:NoRecSelected", "Persons")) + End If + Dim rec As PersonalExtWorkRecord = Nothing + If recCtl IsNot Nothing Then + rec = recCtl.GetRecord() + End If + Return EvaluateExpressions(url, arg, rec, bEncrypt) + End If + Return url + End Function + + Public Overridable Function GetSelectedRecordIndex() As Integer + Dim counter As Integer = 0 + Dim recControl As PersonalExtWorkTableControlRow + For Each recControl In Me.GetRecordControls() + If recControl.PersonalExtWorkRecordRowSelection.Checked Then + Return counter + End If + counter += 1 + Next + Return -1 + End Function + + Public Overridable Function GetSelectedRecordControl() As PersonalExtWorkTableControlRow + Dim selectedList() As PersonalExtWorkTableControlRow = Me.GetSelectedRecordControls() + If selectedList.Length = 0 Then + Return Nothing + End If + Return selectedList(0) + + End Function + + Public Overridable Function GetSelectedRecordControls() As PersonalExtWorkTableControlRow() + + Dim selectedList As ArrayList = New ArrayList(25) + Dim recControl As PersonalExtWorkTableControlRow + For Each recControl In Me.GetRecordControls() + If recControl.PersonalExtWorkRecordRowSelection IsNot Nothing AndAlso recControl.PersonalExtWorkRecordRowSelection.Checked Then + selectedList.Add(recControl) + End If + Next + Return DirectCast(selectedList.ToArray(GetType(PersonalExtWorkTableControlRow)), PersonalExtWorkTableControlRow()) + + End Function + + Public Overridable Sub DeleteSelectedRecords(ByVal deferDeletion As Boolean) + Dim recList() As PersonalExtWorkTableControlRow = Me.GetSelectedRecordControls() + If recList.Length = 0 Then + ' Localization. + Throw New Exception(Page.GetResourceValue("Err:NoRecSelected", "Persons")) + End If + + Dim recCtl As PersonalExtWorkTableControlRow + For Each recCtl In recList + If deferDeletion Then + If Not recCtl.IsNewRecord Then + + Me.AddToDeletedRecordIds(recCtl) + + End If + recCtl.Visible = False + + recCtl.PersonalExtWorkRecordRowSelection.Checked = False + + Else + + recCtl.Delete() + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + End If + Next + End Sub + + Public Function GetRecordControls() As PersonalExtWorkTableControlRow() + Dim recList As ArrayList = New ArrayList() + Dim rep As System.Web.UI.WebControls.Repeater = CType(Me.FindControl("PersonalExtWorkTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return Nothing + Dim repItem As System.Web.UI.WebControls.RepeaterItem + + For Each repItem In rep.Items + + Dim recControl As PersonalExtWorkTableControlRow = DirectCast(repItem.FindControl("PersonalExtWorkTableControlRow"), PersonalExtWorkTableControlRow) + recList.Add(recControl) + + Next + + Return DirectCast(recList.ToArray(GetType(PersonalExtWorkTableControlRow)), PersonalExtWorkTableControlRow()) + 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 + + \ No newline at end of file diff --git a/App_Code/PersonalExtWork/ShowPersonalExtWork.Controls.vb b/App_Code/PersonalExtWork/ShowPersonalExtWork.Controls.vb new file mode 100644 index 0000000..7743945 --- /dev/null +++ b/App_Code/PersonalExtWork/ShowPersonalExtWork.Controls.vb @@ -0,0 +1,1532 @@ + +' This file implements the TableControl, TableControlRow, and RecordControl classes for the +' ShowPersonalExtWork.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.ShowPersonalExtWork + +#Region "Section 1: Place your customizations here." + + +Public Class PersonalExtWorkRecordControl + Inherits BasePersonalExtWorkRecordControl + ' The BasePersonalExtWorkRecordControl 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 PersonalExtWorkRecordControl control on the ShowPersonalExtWork page. +' Do not modify this class. Instead override any method in PersonalExtWorkRecordControl. +Public Class BasePersonalExtWorkRecordControl + Inherits Persons.UI.BaseApplicationRecordControl + + ' To customize, override this method in PersonalExtWorkRecordControl. + 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 PersonalExtWorkRecordControl. + 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.PersonalExtWorkDialogEditButton.Click, AddressOf PersonalExtWorkDialogEditButton_Click + + + End Sub + + + Public Overridable Sub LoadData() + + ' Load the data from the database into the DataSource PersonalExtWork 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 = PersonalExtWorkTable.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, "PersonalExtWorkRecordControlPanel"), 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 PersonalExtWorkRecord() + + 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 PersonalExtWorkRecord = PersonalExtWorkTable.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 = PersonalExtWorkTable.GetRecord(recList(0).GetID.ToXmlString(), True) + + + + End Sub + + ' Populate the UI controls using the DataSource. To customize, override this method in PersonalExtWorkRecordControl. + 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 + + SetBeginDate() + SetBeginDateLabel() + SetCommand() + SetCommandDate() + SetCommandDateLabel() + SetCommandLabel() + SetDescription() + SetDescriptionLabel() + SetEndDate() + SetEndDateLabel() + + SetPersonalExtWorkRecordControlCollapsibleRegion() + SetPersonalExtWorkRecordControlIcon() + SetPersonalExtWorkRecordControlPanelExtender() + + SetPersonalId() + SetPersonalIdLabel() + SetPlace() + SetPlaceLabel() + + + 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 SetBeginDate() + + + ' Set the BeginDate Literal on the webpage with value from the + ' PersonalExtWork database record. + + ' Me.DataSource is the PersonalExtWork record retrieved from the database. + ' Me.BeginDate is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetBeginDate() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.BeginDateSpecified Then + + ' If the BeginDate is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalExtWorkTable.BeginDate, "d MMM yy") + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.BeginDate.Text = formattedValue + + Else + + ' BeginDate is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.BeginDate.Text = PersonalExtWorkTable.BeginDate.Format(PersonalExtWorkTable.BeginDate.DefaultValue, "d MMM yy") + + End If + + ' If the BeginDate is NULL or blank, then use the value specified + ' on Properties. + If Me.BeginDate.Text Is Nothing _ + OrElse Me.BeginDate.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.BeginDate.Text = " " + End If + + End Sub + + Public Overridable Sub SetCommand() + + + ' Set the Command Literal on the webpage with value from the + ' PersonalExtWork database record. + + ' Me.DataSource is the PersonalExtWork record retrieved from the database. + ' Me.Command is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetCommand() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.CommandSpecified Then + + ' If the Command is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalExtWorkTable.Command) + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + If Not formattedValue is Nothing Then + Dim popupThreshold as Integer = CType(100, Integer) + + Dim maxLength as Integer = Len(formattedValue) + If (maxLength > CType(100, Integer)) Then + ' Truncate based on FieldMaxLength on Properties. + maxLength = CType(100, Integer) + + End If + + ' For fields values larger than the PopupTheshold on Properties, display a popup. + If Len(formattedValue) >= popupThreshold Then + + Dim name As String = HttpUtility.HtmlEncode(PersonalExtWorkTable.Command.Name) + + If Not HttpUtility.HtmlEncode("%ISD_DEFAULT%").Equals("%ISD_DEFAULT%") Then + name = HttpUtility.HtmlEncode(Me.Page.GetResourceValue("%ISD_DEFAULT%")) + End If + + + + formattedValue= "" & NetUtils.EncodeStringForHtmlDisplay(formattedValue.Substring(0, maxLength)) + + If (maxLength = CType(100, Integer)) Then + formattedValue = formattedValue & "..." & "" + Else + formattedValue = formattedValue & "" + + End If + Else + If maxLength = CType(100, Integer) Then + formattedValue= NetUtils.EncodeStringForHtmlDisplay(formattedValue.SubString(0,MaxLength)) + formattedValue = formattedValue & "..." + + End If + End If + End If + + Me.Command.Text = formattedValue + + Else + + ' Command is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.Command.Text = PersonalExtWorkTable.Command.Format(PersonalExtWorkTable.Command.DefaultValue) + + End If + + ' If the Command is NULL or blank, then use the value specified + ' on Properties. + If Me.Command.Text Is Nothing _ + OrElse Me.Command.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.Command.Text = " " + End If + + End Sub + + Public Overridable Sub SetCommandDate() + + + ' Set the CommandDate Literal on the webpage with value from the + ' PersonalExtWork database record. + + ' Me.DataSource is the PersonalExtWork record retrieved from the database. + ' Me.CommandDate is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetCommandDate() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.CommandDateSpecified Then + + ' If the CommandDate is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalExtWorkTable.CommandDate, "d MMM yy") + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.CommandDate.Text = formattedValue + + Else + + ' CommandDate is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.CommandDate.Text = PersonalExtWorkTable.CommandDate.Format(PersonalExtWorkTable.CommandDate.DefaultValue, "d MMM yy") + + End If + + ' If the CommandDate is NULL or blank, then use the value specified + ' on Properties. + If Me.CommandDate.Text Is Nothing _ + OrElse Me.CommandDate.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.CommandDate.Text = " " + End If + + End Sub + + Public Overridable Sub SetDescription() + + + ' Set the Description Literal on the webpage with value from the + ' PersonalExtWork database record. + + ' Me.DataSource is the PersonalExtWork record retrieved from the database. + ' Me.Description is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetDescription() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.DescriptionSpecified Then + + ' If the Description is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalExtWorkTable.Description) + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + If Not formattedValue is Nothing Then + Dim popupThreshold as Integer = CType(100, Integer) + + Dim maxLength as Integer = Len(formattedValue) + If (maxLength > CType(100, Integer)) Then + ' Truncate based on FieldMaxLength on Properties. + maxLength = CType(100, Integer) + + End If + + ' For fields values larger than the PopupTheshold on Properties, display a popup. + If Len(formattedValue) >= popupThreshold Then + + Dim name As String = HttpUtility.HtmlEncode(PersonalExtWorkTable.Description.Name) + + If Not HttpUtility.HtmlEncode("%ISD_DEFAULT%").Equals("%ISD_DEFAULT%") Then + name = HttpUtility.HtmlEncode(Me.Page.GetResourceValue("%ISD_DEFAULT%")) + End If + + + + formattedValue= "" & NetUtils.EncodeStringForHtmlDisplay(formattedValue.Substring(0, maxLength)) + + If (maxLength = CType(100, Integer)) Then + formattedValue = formattedValue & "..." & "" + Else + formattedValue = formattedValue & "" + + End If + Else + If maxLength = CType(100, Integer) Then + formattedValue= NetUtils.EncodeStringForHtmlDisplay(formattedValue.SubString(0,MaxLength)) + formattedValue = formattedValue & "..." + + End If + End If + End If + + Me.Description.Text = formattedValue + + Else + + ' Description is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.Description.Text = PersonalExtWorkTable.Description.Format(PersonalExtWorkTable.Description.DefaultValue) + + End If + + ' If the Description is NULL or blank, then use the value specified + ' on Properties. + If Me.Description.Text Is Nothing _ + OrElse Me.Description.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.Description.Text = " " + End If + + End Sub + + Public Overridable Sub SetEndDate() + + + ' Set the EndDate Literal on the webpage with value from the + ' PersonalExtWork database record. + + ' Me.DataSource is the PersonalExtWork record retrieved from the database. + ' Me.EndDate is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetEndDate() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.EndDateSpecified Then + + ' If the EndDate is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalExtWorkTable.EndDate, "d MMM yy") + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.EndDate.Text = formattedValue + + Else + + ' EndDate is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.EndDate.Text = PersonalExtWorkTable.EndDate.Format(PersonalExtWorkTable.EndDate.DefaultValue, "d MMM yy") + + End If + + ' If the EndDate is NULL or blank, then use the value specified + ' on Properties. + If Me.EndDate.Text Is Nothing _ + OrElse Me.EndDate.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.EndDate.Text = " " + End If + + End Sub + + Public Overridable Sub SetPersonalId() + + + ' Set the PersonalId Literal on the webpage with value from the + ' PersonalExtWork database record. + + ' Me.DataSource is the PersonalExtWork record retrieved from the database. + ' Me.PersonalId is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetPersonalId() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.PersonalIdSpecified Then + + ' If the PersonalId is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalExtWorkTable.PersonalId) + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.PersonalId.Text = formattedValue + + Else + + ' PersonalId is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.PersonalId.Text = PersonalExtWorkTable.PersonalId.Format(PersonalExtWorkTable.PersonalId.DefaultValue) + + End If + + ' If the PersonalId is NULL or blank, then use the value specified + ' on Properties. + If Me.PersonalId.Text Is Nothing _ + OrElse Me.PersonalId.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.PersonalId.Text = " " + End If + + End Sub + + Public Overridable Sub SetPlace() + + + ' Set the Place Literal on the webpage with value from the + ' PersonalExtWork database record. + + ' Me.DataSource is the PersonalExtWork record retrieved from the database. + ' Me.Place is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetPlace() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.PlaceSpecified Then + + ' If the Place is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalExtWorkTable.Place) + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + If Not formattedValue is Nothing Then + Dim popupThreshold as Integer = CType(100, Integer) + + Dim maxLength as Integer = Len(formattedValue) + If (maxLength > CType(100, Integer)) Then + ' Truncate based on FieldMaxLength on Properties. + maxLength = CType(100, Integer) + + End If + + ' For fields values larger than the PopupTheshold on Properties, display a popup. + If Len(formattedValue) >= popupThreshold Then + + Dim name As String = HttpUtility.HtmlEncode(PersonalExtWorkTable.Place.Name) + + If Not HttpUtility.HtmlEncode("%ISD_DEFAULT%").Equals("%ISD_DEFAULT%") Then + name = HttpUtility.HtmlEncode(Me.Page.GetResourceValue("%ISD_DEFAULT%")) + End If + + + + formattedValue= "" & NetUtils.EncodeStringForHtmlDisplay(formattedValue.Substring(0, maxLength)) + + If (maxLength = CType(100, Integer)) Then + formattedValue = formattedValue & "..." & "" + Else + formattedValue = formattedValue & "" + + End If + Else + If maxLength = CType(100, Integer) Then + formattedValue= NetUtils.EncodeStringForHtmlDisplay(formattedValue.SubString(0,MaxLength)) + formattedValue = formattedValue & "..." + + End If + End If + End If + + Me.Place.Text = formattedValue + + Else + + ' Place is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.Place.Text = PersonalExtWorkTable.Place.Format(PersonalExtWorkTable.Place.DefaultValue) + + End If + + ' If the Place is NULL or blank, then use the value specified + ' on Properties. + If Me.Place.Text Is Nothing _ + OrElse Me.Place.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.Place.Text = " " + End If + + End Sub + + Public Overridable Sub SetBeginDateLabel() + + End Sub + + Public Overridable Sub SetCommandDateLabel() + + End Sub + + Public Overridable Sub SetCommandLabel() + + End Sub + + Public Overridable Sub SetDescriptionLabel() + + End Sub + + Public Overridable Sub SetEndDateLabel() + + End Sub + + Public Overridable Sub SetPersonalExtWorkRecordControlCollapsibleRegion() + + End Sub + + Public Overridable Sub SetPersonalExtWorkRecordControlIcon() + + End Sub + + Public Overridable Sub SetPersonalExtWorkRecordControlPanelExtender() + + End Sub + + Public Overridable Sub SetPersonalIdLabel() + + End Sub + + Public Overridable Sub SetPlaceLabel() + + 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 PersonalExtWorkRecordControl. + 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, "PersonalExtWorkRecordControlPanel"), 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 PersonalExtWorkRecordControl. + 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. + + GetBeginDate() + GetCommand() + GetCommandDate() + GetDescription() + GetEndDate() + GetPersonalId() + GetPlace() + End Sub + + + Public Overridable Sub GetBeginDate() + + End Sub + + Public Overridable Sub GetCommand() + + End Sub + + Public Overridable Sub GetCommandDate() + + End Sub + + Public Overridable Sub GetDescription() + + End Sub + + Public Overridable Sub GetEndDate() + + End Sub + + Public Overridable Sub GetPersonalId() + + End Sub + + Public Overridable Sub GetPlace() + + End Sub + + + ' To customize, override this method in PersonalExtWorkRecordControl. + + Public Overridable Function CreateWhereClause() As WhereClause + + Dim wc As WhereClause + PersonalExtWorkTable.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("PersonalExtWork") + + 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}", "PersonalExtWork")) + End If + HttpContext.Current.Session("QueryString in ShowPersonalExtWork") = 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(PersonalExtWorkTable.id0, BaseFilter.ComparisonOperator.EqualsTo, pkValue.GetColumnValueString(PersonalExtWorkTable.id0)) + + Else + ' The URL parameter contains the actual value, not an XML structure. + + wc.iAND(PersonalExtWorkTable.id0, 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 + PersonalExtWorkTable.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 PersonalExtWorkRecordControl. + 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) + PersonalExtWorkTable.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. + + ' event handler for ImageButton + Public Overridable Sub PersonalExtWorkDialogEditButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + ' The redirect URL is set on the Properties, Custom Properties or Actions. + ' The ModifyRedirectURL call resolves the parameters before the + ' Response.Redirect redirects the page to the URL. + ' Any code after the Response.Redirect call will not be executed, since the page is + ' redirected to the URL. + + + Dim url As String = "../PersonalExtWork/EditPersonalExtWork.aspx?PersonalExtWork={PK}" + + Dim shouldRedirect As Boolean = True + Dim TargetKey As String = Nothing + Dim DFKA As String = TargetKey + Dim id As String = DFKA + Dim value As String = id + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + url = Me.ModifyRedirectUrl(url, "",False) + url = Me.Page.ModifyRedirectUrl(url, "",False) + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + shouldRedirect = False + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + If shouldRedirect Then + Me.Page.ShouldSaveControlsToSession = True + Me.Page.Response.Redirect(url) + ElseIf Not TargetKey Is Nothing AndAlso _ + Not shouldRedirect Then + Me.Page.ShouldSaveControlsToSession = True + Me.Page.CloseWindow(True) + + End If + End Sub + + + 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("BasePersonalExtWorkRecordControl_Rec"), String) + End Get + Set(ByVal value As String) + Me.ViewState("BasePersonalExtWorkRecordControl_Rec") = value + End Set + End Property + + Private _DataSource As PersonalExtWorkRecord + Public Property DataSource() As PersonalExtWorkRecord + Get + Return Me._DataSource + End Get + + Set(ByVal value As PersonalExtWorkRecord) + + 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 BeginDate() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "BeginDate"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property BeginDateLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "BeginDateLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property Command() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Command"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property CommandDate() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "CommandDate"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property CommandDateLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "CommandDateLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property CommandLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "CommandLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property Description() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Description"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property DescriptionLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "DescriptionLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property EndDate() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "EndDate"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property EndDateLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "EndDateLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property PersonalExtWorkDialogEditButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalExtWorkDialogEditButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalExtWorkRecordControlCollapsibleRegion() As System.Web.UI.WebControls.Panel + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalExtWorkRecordControlCollapsibleRegion"), System.Web.UI.WebControls.Panel) + End Get + End Property + + Public ReadOnly Property PersonalExtWorkRecordControlIcon() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalExtWorkRecordControlIcon"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalExtWorkRecordControlPanelExtender() As AjaxControlToolkit.CollapsiblePanelExtender + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalExtWorkRecordControlPanelExtender"), AjaxControlToolkit.CollapsiblePanelExtender) + End Get + End Property + + Public ReadOnly Property PersonalExtWorkTitle() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalExtWorkTitle"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property PersonalId() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalId"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property PersonalIdLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalIdLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property Place() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Place"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property PlaceLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PlaceLabel"), 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 PersonalExtWorkRecord = 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 PersonalExtWorkRecord + If Not Me.DataSource Is Nothing Then + Return Me.DataSource + End If + + If Not Me.RecordUniqueId Is Nothing Then + + Return PersonalExtWorkTable.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 + + \ No newline at end of file diff --git a/App_Code/PersonalExtWork/ShowPersonalExtWorkTable.Controls.vb b/App_Code/PersonalExtWork/ShowPersonalExtWorkTable.Controls.vb new file mode 100644 index 0000000..327ef69 --- /dev/null +++ b/App_Code/PersonalExtWork/ShowPersonalExtWorkTable.Controls.vb @@ -0,0 +1,4139 @@ + +' This file implements the TableControl, TableControlRow, and RecordControl classes for the +' ShowPersonalExtWorkTable.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.ShowPersonalExtWorkTable + +#Region "Section 1: Place your customizations here." + + +Public Class PersonalExtWorkTableControlRow + Inherits BasePersonalExtWorkTableControlRow + ' The BasePersonalExtWorkTableControlRow implements code for a ROW within the + ' the PersonalExtWorkTableControl table. The BasePersonalExtWorkTableControlRow implements the DataBind and SaveData methods. + ' The loading of data is actually performed by the LoadData method in the base class of PersonalExtWorkTableControl. + + ' This is the ideal place to add your code customizations. For example, you can override the DataBind, + ' SaveData, GetUIData, and Validate methods. + + +End Class + + + +Public Class PersonalExtWorkTableControl + Inherits BasePersonalExtWorkTableControl + + ' The BasePersonalExtWorkTableControl class implements the LoadData, DataBind, CreateWhereClause + ' and other methods to load and display the data in a table control. + + ' This is the ideal place to add your code customizations. You can override the LoadData and CreateWhereClause, + ' The PersonalExtWorkTableControlRow class offers another place where you can customize + ' the DataBind, GetUIData, SaveData and Validate methods specific to each row displayed on the table. + +End Class + + + +#End Region + + + +#Region "Section 2: Do not modify this section." + + +' Base class for the PersonalExtWorkTableControlRow control on the ShowPersonalExtWorkTable page. +' Do not modify this class. Instead override any method in PersonalExtWorkTableControlRow. +Public Class BasePersonalExtWorkTableControlRow + Inherits Persons.UI.BaseApplicationRecordControl + + ' To customize, override this method in PersonalExtWorkTableControlRow. + Protected Overridable Sub Control_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Init + + Me.ClearControlsFromSession() + End Sub + + ' To customize, override this method in PersonalExtWorkTableControlRow. + Protected Overridable Sub Control_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load + + 'Call LoadFocusScripts from repeater so that onfocus attribute could be added to elements + Me.Page.LoadFocusScripts(Me) + + ' Show confirmation message on Click + Me.PersonalExtWorkRowDeleteButton.Attributes.Add("onClick", "return (confirm('" & (CType(Me.Page,BaseApplicationPage)).GetResourceValue("DeleteRecordConfirm", "Persons") & "'));") + + + ' Register the event handlers. + + AddHandler Me.PersonalExtWorkRowCopyButton.Click, AddressOf PersonalExtWorkRowCopyButton_Click + + AddHandler Me.PersonalExtWorkRowDeleteButton.Click, AddressOf PersonalExtWorkRowDeleteButton_Click + + AddHandler Me.PersonalExtWorkRowEditButton.Click, AddressOf PersonalExtWorkRowEditButton_Click + + AddHandler Me.PersonalExtWorkRowViewButton.Click, AddressOf PersonalExtWorkRowViewButton_Click + + + End Sub + + + Public Overridable Sub LoadData() + + ' Load the data from the database into the DataSource PersonalExtWork 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 = PersonalExtWorkTable.GetRecord(Me.RecordUniqueId, True) + + Return + End If + + ' Since this is a row in the table, the data for this row is loaded by the + ' LoadData method of the BasePersonalExtWorkTableControl when the data for the entire + ' table is loaded. + + Me.DataSource = New PersonalExtWorkRecord() + + + + End Sub + + ' Populate the UI controls using the DataSource. To customize, override this method in PersonalExtWorkTableControlRow. + 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 + + SetBeginDate() + SetCommand() + SetCommandDate() + SetDescription() + SetEndDate() + + + + + + SetPersonalId() + SetPlace() + + + 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 SetBeginDate() + + + ' Set the BeginDate Literal on the webpage with value from the + ' PersonalExtWork database record. + + ' Me.DataSource is the PersonalExtWork record retrieved from the database. + ' Me.BeginDate is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetBeginDate() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.BeginDateSpecified Then + + ' If the BeginDate is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalExtWorkTable.BeginDate, "d MMM yy") + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.BeginDate.Text = formattedValue + + Else + + ' BeginDate is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.BeginDate.Text = PersonalExtWorkTable.BeginDate.Format(PersonalExtWorkTable.BeginDate.DefaultValue, "d MMM yy") + + End If + + ' If the BeginDate is NULL or blank, then use the value specified + ' on Properties. + If Me.BeginDate.Text Is Nothing _ + OrElse Me.BeginDate.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.BeginDate.Text = " " + End If + + End Sub + + Public Overridable Sub SetCommand() + + + ' Set the Command Literal on the webpage with value from the + ' PersonalExtWork database record. + + ' Me.DataSource is the PersonalExtWork record retrieved from the database. + ' Me.Command is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetCommand() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.CommandSpecified Then + + ' If the Command is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalExtWorkTable.Command) + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + If Not formattedValue is Nothing Then + Dim popupThreshold as Integer = CType(100, Integer) + + Dim maxLength as Integer = Len(formattedValue) + If (maxLength > CType(100, Integer)) Then + ' Truncate based on FieldMaxLength on Properties. + maxLength = CType(100, Integer) + + End If + + ' For fields values larger than the PopupTheshold on Properties, display a popup. + If Len(formattedValue) >= popupThreshold Then + + Dim name As String = HttpUtility.HtmlEncode(PersonalExtWorkTable.Command.Name) + + If Not HttpUtility.HtmlEncode("%ISD_DEFAULT%").Equals("%ISD_DEFAULT%") Then + name = HttpUtility.HtmlEncode(Me.Page.GetResourceValue("%ISD_DEFAULT%")) + End If + + + + formattedValue= "" & NetUtils.EncodeStringForHtmlDisplay(formattedValue.Substring(0, maxLength)) + + If (maxLength = CType(100, Integer)) Then + formattedValue = formattedValue & "..." & "" + Else + formattedValue = formattedValue & "" + + End If + Else + If maxLength = CType(100, Integer) Then + formattedValue= NetUtils.EncodeStringForHtmlDisplay(formattedValue.SubString(0,MaxLength)) + formattedValue = formattedValue & "..." + + End If + End If + End If + + Me.Command.Text = formattedValue + + Else + + ' Command is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.Command.Text = PersonalExtWorkTable.Command.Format(PersonalExtWorkTable.Command.DefaultValue) + + End If + + ' If the Command is NULL or blank, then use the value specified + ' on Properties. + If Me.Command.Text Is Nothing _ + OrElse Me.Command.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.Command.Text = " " + End If + + End Sub + + Public Overridable Sub SetCommandDate() + + + ' Set the CommandDate Literal on the webpage with value from the + ' PersonalExtWork database record. + + ' Me.DataSource is the PersonalExtWork record retrieved from the database. + ' Me.CommandDate is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetCommandDate() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.CommandDateSpecified Then + + ' If the CommandDate is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalExtWorkTable.CommandDate, "d MMM yy") + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.CommandDate.Text = formattedValue + + Else + + ' CommandDate is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.CommandDate.Text = PersonalExtWorkTable.CommandDate.Format(PersonalExtWorkTable.CommandDate.DefaultValue, "d MMM yy") + + End If + + ' If the CommandDate is NULL or blank, then use the value specified + ' on Properties. + If Me.CommandDate.Text Is Nothing _ + OrElse Me.CommandDate.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.CommandDate.Text = " " + End If + + End Sub + + Public Overridable Sub SetDescription() + + + ' Set the Description Literal on the webpage with value from the + ' PersonalExtWork database record. + + ' Me.DataSource is the PersonalExtWork record retrieved from the database. + ' Me.Description is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetDescription() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.DescriptionSpecified Then + + ' If the Description is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalExtWorkTable.Description) + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + If Not formattedValue is Nothing Then + Dim popupThreshold as Integer = CType(100, Integer) + + Dim maxLength as Integer = Len(formattedValue) + If (maxLength > CType(100, Integer)) Then + ' Truncate based on FieldMaxLength on Properties. + maxLength = CType(100, Integer) + + End If + + ' For fields values larger than the PopupTheshold on Properties, display a popup. + If Len(formattedValue) >= popupThreshold Then + + Dim name As String = HttpUtility.HtmlEncode(PersonalExtWorkTable.Description.Name) + + If Not HttpUtility.HtmlEncode("%ISD_DEFAULT%").Equals("%ISD_DEFAULT%") Then + name = HttpUtility.HtmlEncode(Me.Page.GetResourceValue("%ISD_DEFAULT%")) + End If + + + + formattedValue= "" & NetUtils.EncodeStringForHtmlDisplay(formattedValue.Substring(0, maxLength)) + + If (maxLength = CType(100, Integer)) Then + formattedValue = formattedValue & "..." & "" + Else + formattedValue = formattedValue & "" + + End If + Else + If maxLength = CType(100, Integer) Then + formattedValue= NetUtils.EncodeStringForHtmlDisplay(formattedValue.SubString(0,MaxLength)) + formattedValue = formattedValue & "..." + + End If + End If + End If + + Me.Description.Text = formattedValue + + Else + + ' Description is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.Description.Text = PersonalExtWorkTable.Description.Format(PersonalExtWorkTable.Description.DefaultValue) + + End If + + ' If the Description is NULL or blank, then use the value specified + ' on Properties. + If Me.Description.Text Is Nothing _ + OrElse Me.Description.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.Description.Text = " " + End If + + End Sub + + Public Overridable Sub SetEndDate() + + + ' Set the EndDate Literal on the webpage with value from the + ' PersonalExtWork database record. + + ' Me.DataSource is the PersonalExtWork record retrieved from the database. + ' Me.EndDate is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetEndDate() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.EndDateSpecified Then + + ' If the EndDate is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalExtWorkTable.EndDate, "d MMM yy") + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.EndDate.Text = formattedValue + + Else + + ' EndDate is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.EndDate.Text = PersonalExtWorkTable.EndDate.Format(PersonalExtWorkTable.EndDate.DefaultValue, "d MMM yy") + + End If + + ' If the EndDate is NULL or blank, then use the value specified + ' on Properties. + If Me.EndDate.Text Is Nothing _ + OrElse Me.EndDate.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.EndDate.Text = " " + End If + + End Sub + + Public Overridable Sub SetPersonalId() + + + ' Set the PersonalId Literal on the webpage with value from the + ' PersonalExtWork database record. + + ' Me.DataSource is the PersonalExtWork record retrieved from the database. + ' Me.PersonalId is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetPersonalId() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.PersonalIdSpecified Then + + ' If the PersonalId is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalExtWorkTable.PersonalId) + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.PersonalId.Text = formattedValue + + Else + + ' PersonalId is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.PersonalId.Text = PersonalExtWorkTable.PersonalId.Format(PersonalExtWorkTable.PersonalId.DefaultValue) + + End If + + ' If the PersonalId is NULL or blank, then use the value specified + ' on Properties. + If Me.PersonalId.Text Is Nothing _ + OrElse Me.PersonalId.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.PersonalId.Text = " " + End If + + End Sub + + Public Overridable Sub SetPlace() + + + ' Set the Place Literal on the webpage with value from the + ' PersonalExtWork database record. + + ' Me.DataSource is the PersonalExtWork record retrieved from the database. + ' Me.Place is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetPlace() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.PlaceSpecified Then + + ' If the Place is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalExtWorkTable.Place) + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + If Not formattedValue is Nothing Then + Dim popupThreshold as Integer = CType(100, Integer) + + Dim maxLength as Integer = Len(formattedValue) + If (maxLength > CType(100, Integer)) Then + ' Truncate based on FieldMaxLength on Properties. + maxLength = CType(100, Integer) + + End If + + ' For fields values larger than the PopupTheshold on Properties, display a popup. + If Len(formattedValue) >= popupThreshold Then + + Dim name As String = HttpUtility.HtmlEncode(PersonalExtWorkTable.Place.Name) + + If Not HttpUtility.HtmlEncode("%ISD_DEFAULT%").Equals("%ISD_DEFAULT%") Then + name = HttpUtility.HtmlEncode(Me.Page.GetResourceValue("%ISD_DEFAULT%")) + End If + + + + formattedValue= "" & NetUtils.EncodeStringForHtmlDisplay(formattedValue.Substring(0, maxLength)) + + If (maxLength = CType(100, Integer)) Then + formattedValue = formattedValue & "..." & "" + Else + formattedValue = formattedValue & "" + + End If + Else + If maxLength = CType(100, Integer) Then + formattedValue= NetUtils.EncodeStringForHtmlDisplay(formattedValue.SubString(0,MaxLength)) + formattedValue = formattedValue & "..." + + End If + End If + End If + + Me.Place.Text = formattedValue + + Else + + ' Place is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.Place.Text = PersonalExtWorkTable.Place.Format(PersonalExtWorkTable.Place.DefaultValue) + + End If + + ' If the Place is NULL or blank, then use the value specified + ' on Properties. + If Me.Place.Text Is Nothing _ + OrElse Me.Place.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.Place.Text = " " + End If + + End Sub + + + Public EvaluateFormulaDelegate As BaseClasses.Data.DataSource.EvaluateFormulaDelegate = New BaseClasses.Data.DataSource.EvaluateFormulaDelegate(AddressOf Me.EvaluateFormula) + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean, ByVal e As FormulaEvaluator) As String + If e Is Nothing Then + e = New FormulaEvaluator() + End If + + e.Variables.Clear() + + + ' add variables for formula evaluation + If variables IsNot Nothing Then + Dim enumerator As System.Collections.Generic.IEnumerator(Of System.Collections.Generic.KeyValuePair(Of String, Object)) = variables.GetEnumerator() + While enumerator.MoveNext() + e.Variables.Add(enumerator.Current.Key, enumerator.Current.Value) + End While + End If + + If includeDS + + End IF + + + ' Other variables referred to in the formula are expected to be + ' properties of the DataSource. For example, referring to + ' UnitPrice as a variable will refer to DataSource.UnitPrice + If dataSourceForEvaluate Is Nothing Then + + e.DataSource = Me.DataSource + + Else + e.DataSource = dataSourceForEvaluate + End If + + ' Define the calling control. This is used to add other + ' related table and record controls as variables. + e.CallingControl = Me + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + + If Not String.IsNullOrEmpty(format) AndAlso (String.IsNullOrEmpty(formula) OrElse formula.IndexOf("Format(") < 0) Then + Return FormulaUtils.Format(resultObj, format) + Else + Return resultObj.ToString() + End If + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format,variables ,includeDS, Nothing) + End Function + + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object)) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format, variables ,True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, format, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal e as FormulaEvaluator) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, variables, True, e) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal includeDS as Boolean) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, includeDS, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, True, Nothing) + End Function + + + Public Overridable Sub RegisterPostback() + + + End Sub + + + + ' To customize, override this method in PersonalExtWorkTableControlRow. + Public Overridable Sub SaveData() + ' Saves the associated record in the database. + ' SaveData calls Validate and Get methods - so it may be more appropriate to + ' customize those methods. + + ' 1. Load the existing record from the database. Since we save the entire record, this ensures + ' that fields that are not displayed are also properly initialized. + Me.LoadData() + + + ' 2. Perform any custom validation. + Me.Validate() + + + ' 3. Set the values in the record with data from UI controls. + ' This calls the Get() method for each of the user interface controls. + Me.GetUIData() + + ' 4. Save in the database. + ' We should not save the record if the data did not change. This + ' will save a database hit and avoid triggering any database triggers. + + If Me.DataSource.IsAnyValueChanged Then + ' Save record to database but do not commit yet. + ' Auto generated ids are available after saving for use by child (dependent) records. + Me.DataSource.Save() + + DirectCast(GetParentControlObject(Me, "PersonalExtWorkTableControl"), PersonalExtWorkTableControl).DataChanged = True + DirectCast(GetParentControlObject(Me, "PersonalExtWorkTableControl"), PersonalExtWorkTableControl).ResetData = True + End If + + + ' update session or cookie by formula + + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + ' For Master-Detail relationships, save data on the Detail table(s) + + End Sub + + ' To customize, override this method in PersonalExtWorkTableControlRow. + 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. + + GetBeginDate() + GetCommand() + GetCommandDate() + GetDescription() + GetEndDate() + GetPersonalId() + GetPlace() + End Sub + + + Public Overridable Sub GetBeginDate() + + End Sub + + Public Overridable Sub GetCommand() + + End Sub + + Public Overridable Sub GetCommandDate() + + End Sub + + Public Overridable Sub GetDescription() + + End Sub + + Public Overridable Sub GetEndDate() + + End Sub + + Public Overridable Sub GetPersonalId() + + End Sub + + Public Overridable Sub GetPlace() + + End Sub + + + ' To customize, override this method in PersonalExtWorkTableControlRow. + + Public Overridable Function CreateWhereClause() As WhereClause + + Return Nothing + + End Function + + + + ' To customize, override this method in PersonalExtWorkTableControlRow. + 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) + PersonalExtWorkTable.DeleteRecord(pkValue) + + DirectCast(GetParentControlObject(Me, "PersonalExtWorkTableControl"), PersonalExtWorkTableControl).DataChanged = True + DirectCast(GetParentControlObject(Me, "PersonalExtWorkTableControl"), PersonalExtWorkTableControl).ResetData = True + End Sub + + Protected Overridable Sub Control_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.PreRender + ' PreRender event is raised just before page is being displayed. + Try + DbUtils.StartTransaction() + Me.RegisterPostback() + + If Not Me.Page.ErrorOnPage AndAlso (Me.Page.IsPageRefresh OrElse Me.DataChanged OrElse Me.ResetData) Then + + + ' Re-load the data and update the web page if necessary. + ' This is typically done during a postback (filter, search button, sort, pagination button). + ' In each of the other click handlers, simply set DataChanged to True to reload the data. + Me.LoadData() + Me.DataBind() + End If + + + Catch ex As Exception + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + Finally + DbUtils.EndTransaction() + End Try + End Sub + + + Protected Overrides Sub SaveControlsToSession() + MyBase.SaveControlsToSession() + + + 'Save pagination state to session. + + End Sub + + + + Protected Overrides Sub ClearControlsFromSession() + MyBase.ClearControlsFromSession() + + + + ' Clear pagination state from session. + + End Sub + + Protected Overrides Sub LoadViewState(ByVal savedState As Object) + MyBase.LoadViewState(savedState) + Dim isNewRecord As String = CType(ViewState("IsNewRecord"), String) + If Not isNewRecord Is Nothing AndAlso isNewRecord.Trim <> "" Then + Me.IsNewRecord = Boolean.Parse(isNewRecord) + End If + + Dim myCheckSum As String = CType(ViewState("CheckSum"), String) + If Not myCheckSum Is Nothing AndAlso myCheckSum.Trim <> "" Then + Me.CheckSum = myCheckSum + End If + + + ' Load view state for pagination control. + + End Sub + + Protected Overrides Function SaveViewState() As Object + ViewState("IsNewRecord") = Me.IsNewRecord.ToString() + ViewState("CheckSum") = Me.CheckSum + + + ' Load view state for pagination control. + + Return MyBase.SaveViewState() + End Function + + + ' event handler for ImageButton + Public Overridable Sub PersonalExtWorkRowCopyButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + ' The redirect URL is set on the Properties, Custom Properties or Actions. + ' The ModifyRedirectURL call resolves the parameters before the + ' Response.Redirect redirects the page to the URL. + ' Any code after the Response.Redirect call will not be executed, since the page is + ' redirected to the URL. + + + Dim url As String = "../PersonalExtWork/AddPersonalExtWork.aspx?PersonalExtWork={PK}" + + Dim shouldRedirect As Boolean = True + Dim TargetKey As String = Nothing + Dim DFKA As String = TargetKey + Dim id As String = DFKA + Dim value As String = id + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + url = Me.ModifyRedirectUrl(url, "",False) + url = Me.Page.ModifyRedirectUrl(url, "",False) + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + shouldRedirect = False + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + If shouldRedirect Then + Me.Page.ShouldSaveControlsToSession = True + Me.Page.Response.Redirect(url) + ElseIf Not TargetKey Is Nothing AndAlso _ + Not shouldRedirect Then + Me.Page.ShouldSaveControlsToSession = True + Me.Page.CloseWindow(True) + + End If + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalExtWorkRowDeleteButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + If(Not Me.Page.IsPageRefresh) Then + + Me.Delete() + + End If + Me.Page.CommitTransaction(sender) + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalExtWorkRowEditButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + ' The redirect URL is set on the Properties, Custom Properties or Actions. + ' The ModifyRedirectURL call resolves the parameters before the + ' Response.Redirect redirects the page to the URL. + ' Any code after the Response.Redirect call will not be executed, since the page is + ' redirected to the URL. + + + Dim url As String = "../PersonalExtWork/EditPersonalExtWork.aspx?PersonalExtWork={PK}" + + Dim shouldRedirect As Boolean = True + Dim TargetKey As String = Nothing + Dim DFKA As String = TargetKey + Dim id As String = DFKA + Dim value As String = id + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + url = Me.ModifyRedirectUrl(url, "",False) + url = Me.Page.ModifyRedirectUrl(url, "",False) + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + shouldRedirect = False + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + If shouldRedirect Then + Me.Page.ShouldSaveControlsToSession = True + Me.Page.Response.Redirect(url) + ElseIf Not TargetKey Is Nothing AndAlso _ + Not shouldRedirect Then + Me.Page.ShouldSaveControlsToSession = True + Me.Page.CloseWindow(True) + + End If + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalExtWorkRowViewButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + ' The redirect URL is set on the Properties, Custom Properties or Actions. + ' The ModifyRedirectURL call resolves the parameters before the + ' Response.Redirect redirects the page to the URL. + ' Any code after the Response.Redirect call will not be executed, since the page is + ' redirected to the URL. + + + Dim url As String = "../PersonalExtWork/ShowPersonalExtWork.aspx?PersonalExtWork={PK}" + + Dim shouldRedirect As Boolean = True + Dim TargetKey As String = Nothing + Dim DFKA As String = TargetKey + Dim id As String = DFKA + Dim value As String = id + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + url = Me.ModifyRedirectUrl(url, "",False) + url = Me.Page.ModifyRedirectUrl(url, "",False) + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + shouldRedirect = False + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + If shouldRedirect Then + Me.Page.ShouldSaveControlsToSession = True + Me.Page.Response.Redirect(url) + ElseIf Not TargetKey Is Nothing AndAlso _ + Not shouldRedirect Then + Me.Page.ShouldSaveControlsToSession = True + Me.Page.CloseWindow(True) + + End If + End Sub + + + 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("BasePersonalExtWorkTableControlRow_Rec"), String) + End Get + Set(ByVal value As String) + Me.ViewState("BasePersonalExtWorkTableControlRow_Rec") = value + End Set + End Property + + Private _DataSource As PersonalExtWorkRecord + Public Property DataSource() As PersonalExtWorkRecord + Get + Return Me._DataSource + End Get + + Set(ByVal value As PersonalExtWorkRecord) + + Me._DataSource = value + End Set + End Property + + + + Private _checkSum As String + Public Overridable Property CheckSum() As String + Get + Return Me._checkSum + End Get + Set(ByVal value As String) + Me._checkSum = value + End Set + End Property + + Private _TotalPages As Integer + Public Property TotalPages() As Integer + Get + Return Me._TotalPages + End Get + Set(ByVal value As Integer) + Me._TotalPages = value + End Set + End Property + + Private _PageIndex As Integer + Public Property PageIndex() As Integer + Get + ' Return the PageIndex + Return Me._PageIndex + End Get + Set(ByVal value As Integer) + Me._PageIndex = value + End Set + End Property + + Private _DisplayLastPage As Boolean + Public Property DisplayLastPage() As Boolean + Get + Return Me._DisplayLastPage + End Get + Set(ByVal value As Boolean) + Me._DisplayLastPage = value + End Set + End Property + + + +#Region "Helper Properties" + + Public ReadOnly Property BeginDate() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "BeginDate"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property Command() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Command"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property CommandDate() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "CommandDate"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property Description() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Description"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property EndDate() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "EndDate"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property PersonalExtWorkRecordRowSelection() As System.Web.UI.WebControls.CheckBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalExtWorkRecordRowSelection"), System.Web.UI.WebControls.CheckBox) + End Get + End Property + + Public ReadOnly Property PersonalExtWorkRowCopyButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalExtWorkRowCopyButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalExtWorkRowDeleteButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalExtWorkRowDeleteButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalExtWorkRowEditButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalExtWorkRowEditButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalExtWorkRowViewButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalExtWorkRowViewButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalId() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalId"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property Place() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Place"), 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 PersonalExtWorkRecord = 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 PersonalExtWorkRecord + If Not Me.DataSource Is Nothing Then + Return Me.DataSource + End If + + If Not Me.RecordUniqueId Is Nothing Then + + Return PersonalExtWorkTable.GetRecord(Me.RecordUniqueId, True) + + End If + + ' Localization. + + Throw New Exception(Page.GetResourceValue("Err:RetrieveRec", "Persons")) + + End Function + + Public Shadows ReadOnly Property Page() As BaseApplicationPage + Get + Return DirectCast(MyBase.Page, BaseApplicationPage) + End Get + End Property + +#End Region + +End Class + + + +' Base class for the PersonalExtWorkTableControl control on the ShowPersonalExtWorkTable page. +' Do not modify this class. Instead override any method in PersonalExtWorkTableControl. +Public Class BasePersonalExtWorkTableControl + Inherits Persons.UI.BaseApplicationTableControl + + + + Protected Overridable Sub Control_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Init + + + + ' Setup the filter and search events. + + AddHandler Me.DescriptionFilter.SelectedIndexChanged, AddressOf DescriptionFilter_SelectedIndexChanged + AddHandler Me.PersonalIdFilter.SelectedIndexChanged, AddressOf PersonalIdFilter_SelectedIndexChanged + If Not Me.Page.IsPostBack Then + Dim initialVal As String = "" + If Me.InSession(Me.DescriptionFilter) + initialVal = Me.GetFromSession(Me.DescriptionFilter) + + End If + + If initialVal <> "" + + Me.DescriptionFilter.Items.Add(New ListItem(initialVal, initialVal)) + + Me.DescriptionFilter.SelectedValue = initialVal + + End If + + End If + If Not Me.Page.IsPostBack Then + Dim initialVal As String = "" + If Me.InSession(Me.PersonalExtWorkSearch) + initialVal = Me.GetFromSession(Me.PersonalExtWorkSearch) + + End If + + If initialVal <> "" + + Me.PersonalExtWorkSearch.Text = initialVal + + End If + + End If + If Not Me.Page.IsPostBack Then + Dim initialVal As String = "" + If Me.InSession(Me.PersonalIdFilter) + initialVal = Me.GetFromSession(Me.PersonalIdFilter) + + End If + + If initialVal <> "" + + Me.PersonalIdFilter.Items.Add(New ListItem(initialVal, initialVal)) + + Me.PersonalIdFilter.SelectedValue = initialVal + + End If + + End If + + + ' Control Initializations. + ' Initialize the table's current sort order. + + If Me.InSession(Me, "Order_By") Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + End If + + + + ' Setup default pagination settings. + + Me.PageSize = CInt(Me.GetFromSession(Me, "Page_Size", "10")) + Me.PageIndex = CInt(Me.GetFromSession(Me, "Page_Index", "0")) + + + + Me.ClearControlsFromSession() + End Sub + + Protected Overridable Sub Control_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load + + SaveControlsToSession_Ajax() + + ' Show confirmation message on Click + Me.PersonalExtWorkDeleteButton.Attributes.Add("onClick", "return (confirm('" & (CType(Me.Page,BaseApplicationPage)).GetResourceValue("DeleteConfirm", "Persons") & "'));") + + ' Setup the pagination events. + + AddHandler Me.PersonalExtWorkPagination.FirstPage.Click, AddressOf PersonalExtWorkPagination_FirstPage_Click + + AddHandler Me.PersonalExtWorkPagination.LastPage.Click, AddressOf PersonalExtWorkPagination_LastPage_Click + + AddHandler Me.PersonalExtWorkPagination.NextPage.Click, AddressOf PersonalExtWorkPagination_NextPage_Click + + AddHandler Me.PersonalExtWorkPagination.PageSizeButton.Click, AddressOf PersonalExtWorkPagination_PageSizeButton_Click + + AddHandler Me.PersonalExtWorkPagination.PreviousPage.Click, AddressOf PersonalExtWorkPagination_PreviousPage_Click + + + ' Setup the sorting events. + + AddHandler Me.BeginDateLabel.Click, AddressOf BeginDateLabel_Click + + AddHandler Me.CommandDateLabel.Click, AddressOf CommandDateLabel_Click + + AddHandler Me.CommandLabel.Click, AddressOf CommandLabel_Click + + AddHandler Me.DescriptionLabel1.Click, AddressOf DescriptionLabel1_Click + + AddHandler Me.EndDateLabel.Click, AddressOf EndDateLabel_Click + + AddHandler Me.PersonalIdLabel1.Click, AddressOf PersonalIdLabel1_Click + + AddHandler Me.PlaceLabel.Click, AddressOf PlaceLabel_Click + + ' Setup the button events. + + AddHandler Me.PersonalExtWorkCopyButton.Click, AddressOf PersonalExtWorkCopyButton_Click + + AddHandler Me.PersonalExtWorkDeleteButton.Click, AddressOf PersonalExtWorkDeleteButton_Click + + AddHandler Me.PersonalExtWorkEditButton.Click, AddressOf PersonalExtWorkEditButton_Click + + AddHandler Me.PersonalExtWorkExportCSVButton.Click, AddressOf PersonalExtWorkExportCSVButton_Click + + AddHandler Me.PersonalExtWorkExportExcelButton.Click, AddressOf PersonalExtWorkExportExcelButton_Click + + Me.PersonalExtWorkImportButton.PostBackUrl = "../Shared/SelectFileToImport.aspx?TableName=PersonalExtWork" + Me.PersonalExtWorkImportButton.Attributes.Item("onClick") = "window.open('" & Me.Page.EncryptUrlParameter(Me.PersonalExtWorkImportButton.PostBackUrl) & "','importWindow', 'width=700, height=500,top=' +(screen.availHeight-500)/2 + ',left=' + (screen.availWidth-700)/2+ ', resizable=yes, scrollbars=yes,modal=yes'); return false;" + + AddHandler Me.PersonalExtWorkImportButton.Click, AddressOf PersonalExtWorkImportButton_Click + + AddHandler Me.PersonalExtWorkNewButton.Click, AddressOf PersonalExtWorkNewButton_Click + + AddHandler Me.PersonalExtWorkPDFButton.Click, AddressOf PersonalExtWorkPDFButton_Click + + AddHandler Me.PersonalExtWorkRefreshButton.Click, AddressOf PersonalExtWorkRefreshButton_Click + + AddHandler Me.PersonalExtWorkResetButton.Click, AddressOf PersonalExtWorkResetButton_Click + + AddHandler Me.PersonalExtWorkWordButton.Click, AddressOf PersonalExtWorkWordButton_Click + + AddHandler Me.PersonalExtWorkSearchButton.Button.Click, AddressOf PersonalExtWorkSearchButton_Click + + + ' Setup events for others + + End Sub + + + Public Overridable Sub LoadData() + + ' Read data from database. Returns an array of records that can be assigned + ' to the DataSource table control property. + Try + Dim joinFilter As CompoundFilter = CreateCompoundJoinFilter() + + ' The WHERE clause will be empty when displaying all records in table. + Dim wc As WhereClause = CreateWhereClause() + If wc IsNot Nothing AndAlso Not wc.RunQuery Then + ' Initialize an empty array of records + Dim alist As New ArrayList(0) + Me.DataSource = DirectCast(alist.ToArray(GetType(PersonalExtWorkRecord)), PersonalExtWorkRecord()) + ' Add records to the list if needed. + Me.AddNewRecords() + Me._TotalRecords = 0 + Me._TotalPages = 0 + Return + End If + + ' Call OrderBy to determine the order - either use the order defined + ' on the Query Wizard, or specified by user (by clicking on column heading) + Dim orderBy As OrderBy = CreateOrderBy() + + ' Get the pagesize from the pagesize control. + Me.GetPageSize() + + If Me.DisplayLastPage Then + Dim totalRecords As Integer = If(Me._TotalRecords < 0, PersonalExtWorkTable.GetRecordCount(CreateCompoundJoinFilter(), CreateWhereClause()), Me._TotalRecords) + + Dim totalPages As Integer = CInt(Math.Ceiling(totalRecords / Me.PageSize)) + + Me.PageIndex = totalPages - 1 + End If + + ' Make sure PageIndex (current page) and PageSize are within bounds. + If Me.PageIndex < 0 Then + Me.PageIndex = 0 + End If + If Me.PageSize < 1 Then + Me.PageSize = 1 + End If + + ' Retrieve the records and set the table DataSource. + ' Only PageSize records are fetched starting at PageIndex (zero based). + If Me.AddNewRecord > 0 Then + ' Make sure to preserve the previously entered data on new rows. + Dim postdata As New ArrayList + For Each rc As PersonalExtWorkTableControlRow In Me.GetRecordControls() + If Not rc.IsNewRecord Then + rc.DataSource = rc.GetRecord() + rc.GetUIData() + postdata.Add(rc.DataSource) + UIData.Add(rc.PreservedUIData()) + End If + Next + Me.DataSource = DirectCast(postdata.ToArray(GetType(PersonalExtWorkRecord)), PersonalExtWorkRecord()) + Else ' Get the records from the database + Me.DataSource = PersonalExtWorkTable.GetRecords(joinFilter, wc, orderBy, Me.PageIndex, Me.PageSize) + + End If + + ' if the datasource contains no records contained in database, then load the last page. + If (DbUtils.GetCreatedRecords(Me.DataSource).Length = 0 AndAlso Not Me.DisplayLastPage) Then + Me.DisplayLastPage = True + LoadData() + Else + + ' Add any new rows desired by the user. + Me.AddNewRecords() + + ' Turn off the ToggleAll checkbox + Me.PersonalExtWorkToggleAll.Checked = False + + + ' Initialize the page and grand totals. now + + End If + + Catch ex As Exception + ' Report the error message to the end user + Dim msg As String = ex.Message + If ex.InnerException IsNot Nothing Then + msg = msg & " InnerException: " & ex.InnerException.Message + End If + Throw New Exception(msg, ex.InnerException) + End Try + End Sub + + + + + Public Overrides Sub DataBind() + ' The DataBind method binds the user interface controls to the values + ' from the database record for each row in the table. To do this, it calls the + ' DataBind for each of the rows. + ' DataBind also populates any filters above the table, and sets the pagination + ' control to the correct number of records and the current page number. + + MyBase.DataBind() + + ' Make sure that the DataSource is initialized. + If Me.DataSource Is Nothing Then + Return + End If + + 'LoadData for DataSource for chart and report if they exist + + ' Setup the pagination controls. + BindPaginationControls() + + + + ' Bind the repeater with the list of records to expand the UI. + Dim rep As System.Web.UI.WebControls.Repeater = CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalExtWorkTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return + rep.DataSource = DataSource() + rep.DataBind() + + Dim index As Integer = 0 + For Each repItem As System.Web.UI.WebControls.RepeaterItem In rep.Items + ' Loop through all rows in the table, set its DataSource and call DataBind(). + Dim recControl As PersonalExtWorkTableControlRow = DirectCast(repItem.FindControl("PersonalExtWorkTableControlRow"), PersonalExtWorkTableControlRow) + recControl.DataSource = Me.DataSource(index) + If Me.UIData.Count > index Then + recControl.PreviousUIData = Me.UIData(index) + End If + recControl.DataBind() + recControl.Visible = Not Me.InDeletedRecordIds(recControl) + + index += 1 + Next + + + + + ' Call the Set methods for each controls on the panel + + SetBeginDateLabel() + SetCommandDateLabel() + SetCommandLabel() + SetDescriptionFilter() + SetDescriptionLabel() + SetDescriptionLabel1() + SetEndDateLabel() + + + + + + + + + + + + SetPersonalExtWorkSearch() + + SetPersonalExtWorkTableControlCollapsibleRegion() + SetPersonalExtWorkTableControlIcon() + SetPersonalExtWorkTableControlPanelExtender() + + + + SetPersonalIdFilter() + SetPersonalIdLabel() + SetPersonalIdLabel1() + SetPlaceLabel() + ' setting the state of expand or collapse alternative rows + + + ' Load data for each record and table UI control. + ' Ordering is important because child controls get + ' their parent ids from their parent UI controls. + + + ' this method calls the set method for controls with special formula like running total, sum, rank, etc + SetFormulaControls() + End Sub + + Public Overridable Sub SetFormulaControls() + ' this method calls Set methods for the control that has special formula + + + + End Sub + + + + Public Overridable Sub RegisterPostback() + + Me.Page.RegisterPostBackTrigger(MiscUtils.FindControlRecursively(Me,"PersonalExtWorkExportCSVButton")) + + Me.Page.RegisterPostBackTrigger(MiscUtils.FindControlRecursively(Me,"PersonalExtWorkExportExcelButton")) + + Me.Page.RegisterPostBackTrigger(MiscUtils.FindControlRecursively(Me,"PersonalExtWorkPDFButton")) + + Me.Page.RegisterPostBackTrigger(MiscUtils.FindControlRecursively(Me,"PersonalExtWorkWordButton")) + + + End Sub + + Public EvaluateFormulaDelegate As BaseClasses.Data.DataSource.EvaluateFormulaDelegate = New BaseClasses.Data.DataSource.EvaluateFormulaDelegate(AddressOf Me.EvaluateFormula) + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean, ByVal e as FormulaEvaluator) As String + If e Is Nothing + e = New FormulaEvaluator() + End If + + e.Variables.Clear() + + + ' add variables for formula evaluation + If variables IsNot Nothing Then + Dim enumerator As System.Collections.Generic.IEnumerator(Of System.Collections.Generic.KeyValuePair(Of String, Object)) = variables.GetEnumerator() + While enumerator.MoveNext() + e.Variables.Add(enumerator.Current.Key, enumerator.Current.Value) + End While + End If + + If includeDS + + End If + + ' All variables referred to in the formula are expected to be + ' properties of the DataSource. For example, referring to + ' UnitPrice as a variable will refer to DataSource.UnitPrice + e.DataSource = dataSourceForEvaluate + + ' Define the calling control. This is used to add other + ' related table and record controls as variables. + e.CallingControl = Me + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + + If Not String.IsNullOrEmpty(format) AndAlso (String.IsNullOrEmpty(formula) OrElse formula.IndexOf("Format(") < 0) Then + Return FormulaUtils.Format(resultObj, format) + Else + Return resultObj.ToString() + End If + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format,variables ,includeDS, Nothing) + End Function + + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object)) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format, variables ,True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, format, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal e as FormulaEvaluator) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, variables, True, e) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal includeDS as Boolean) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, includeDS, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, True, Nothing) + End Function + + + + + Public Overridable Sub ResetControl() + + Me.DescriptionFilter.ClearSelection() + + Me.PersonalIdFilter.ClearSelection() + + Me.PersonalExtWorkSearch.Text = "" + + Me.CurrentSortOrder.Reset() + If (Me.InSession(Me, "Order_By")) Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + End If + + Me.PageIndex = 0 + End Sub + + Protected Overridable Sub BindPaginationControls() + ' Setup the pagination controls. + + ' Bind the pagination labels. + + If DbUtils.GetCreatedRecords(Me.DataSource).Length > 0 Then + + Me.PersonalExtWorkPagination.CurrentPage.Text = (Me.PageIndex + 1).ToString() + Else + Me.PersonalExtWorkPagination.CurrentPage.Text = "0" + End If + Me.PersonalExtWorkPagination.PageSize.Text = Me.PageSize.ToString() + Me.PersonalExtWorkPagination.TotalItems.Text = Me.TotalRecords.ToString() + Me.PersonalExtWorkPagination.TotalPages.Text = Me.TotalPages.ToString() + + ' Bind the buttons for PersonalExtWorkTableControl pagination. + + Me.PersonalExtWorkPagination.FirstPage.Enabled = Not (Me.PageIndex = 0) + If Me._TotalPages < 0 Then ' if the total pages is not determined yet, enable last and next buttons + Me.PersonalExtWorkPagination.LastPage.Enabled = True + ElseIf Me._TotalPages = 0 ' if the total pages is determined and it is 0, enable last and next buttons + Me.PersonalExtWorkPagination.LastPage.Enabled = False + Else ' if the total pages is the last page, disable last and next buttons + Me.PersonalExtWorkPagination.LastPage.Enabled = Not (Me.PageIndex = Me.TotalPages - 1) + End If + + If Me._TotalPages < 0 Then ' if the total pages is not determined yet, enable last and next buttons + Me.PersonalExtWorkPagination.NextPage.Enabled = True + ElseIf Me._TotalPages = 0 ' if the total pages is determined and it is 0, enable last and next buttons + Me.PersonalExtWorkPagination.NextPage.Enabled = False + Else ' if the total pages is the last page, disable last and next buttons + Me.PersonalExtWorkPagination.NextPage.Enabled = Not (Me.PageIndex = Me.TotalPages - 1) + End If + + Me.PersonalExtWorkPagination.PreviousPage.Enabled = Not (Me.PageIndex = 0) + + + End Sub + + Public Overridable Sub SaveData() + ' Save the data from the entire table. Calls each row's Save Data + ' to save their data. This function is called by the Click handler of the + ' Save button. The button handler should Start/Commit/End a transaction. + + Dim recCtl As PersonalExtWorkTableControlRow + For Each recCtl In Me.GetRecordControls() + + If Me.InDeletedRecordIds(recCtl) Then + ' Delete any pending deletes. + recCtl.Delete() + Else + If recCtl.Visible Then + recCtl.SaveData() + End If + End If + + Next + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + ' Set IsNewRecord to False for all records - since everything has been saved and is no longer "new" + For Each recCtl In Me.GetRecordControls() + recCtl.IsNewRecord = False + Next + + + ' Set DeletedRecordsIds to Nothing since we have deleted all pending deletes. + Me.DeletedRecordIds = Nothing + + End Sub + + Public Overridable Function CreateCompoundJoinFilter() As CompoundFilter + Dim jFilter As CompoundFilter = New CompoundFilter() + + Return jFilter + + End Function + + + Public Overridable Function CreateOrderBy() As OrderBy + ' The CurrentSortOrder is initialized to the sort order on the + ' Query Wizard. It may be modified by the Click handler for any of + ' the column heading to sort or reverse sort by that column. + ' You can add your own sort order, or modify it on the Query Wizard. + Return Me.CurrentSortOrder + End Function + + Public Overridable Function CreateWhereClause() As WhereClause + 'This CreateWhereClause is used for loading the data. + PersonalExtWorkTable.Instance.InnerFilter = Nothing + Dim wc As WhereClause = New WhereClause() + + ' Compose the WHERE clause consiting of: + ' 1. Static clause defined at design time. + ' 2. User selected search criteria. + ' 3. User selected filter criteria. + + + If IsValueSelected(Me.DescriptionFilter) Then + + wc.iAND(PersonalExtWorkTable.Description, BaseFilter.ComparisonOperator.EqualsTo, MiscUtils.GetSelectedValue(Me.DescriptionFilter, Me.GetFromSession(Me.DescriptionFilter)), False, False) + + End If + + + + If IsValueSelected(Me.PersonalExtWorkSearch) Then + If Me.PersonalExtWorkSearch.Text = BaseClasses.Resources.AppResources.GetResourceValue("Txt:SearchForEllipsis", Nothing) Then + Me.PersonalExtWorkSearch.Text = "" + Else + ' Strip "..." from begin and ending of the search text, otherwise the search will return 0 values as in database "..." is not stored. + + If Me.PersonalExtWorkSearch.Text.StartsWith("...") Then + Me.PersonalExtWorkSearch.Text = Me.PersonalExtWorkSearch.Text.SubString(3,Me.PersonalExtWorkSearch.Text.Length-3) + End If + If Me.PersonalExtWorkSearch.Text.EndsWith("...") then + Me.PersonalExtWorkSearch.Text = Me.PersonalExtWorkSearch.Text.SubString(0,Me.PersonalExtWorkSearch.Text.Length-3) + ' Strip the last word as well as it is likely only a partial word + Dim endindex As Integer = PersonalExtWorkSearch.Text.Length - 1 + While (Not Char.IsWhiteSpace(PersonalExtWorkSearch.Text(endindex)) AndAlso endindex > 0) + endindex -= 1 + End While + If endindex > 0 Then + PersonalExtWorkSearch.Text = PersonalExtWorkSearch.Text.Substring(0, endindex) + End If + End If + End If + + Dim formatedSearchText As String = MiscUtils.GetSelectedValue(Me.PersonalExtWorkSearch, Me.GetFromSession(Me.PersonalExtWorkSearch)) + + ' After stripping "..." see if the search text is null or empty. + If IsValueSelected(Me.PersonalExtWorkSearch) Then + ' These clauses are added depending on operator and fields selected in Control's property page, bindings tab. + + Dim search As WhereClause = New WhereClause() + + search.iOR(PersonalExtWorkTable.PersonalId, BaseFilter.ComparisonOperator.Contains, MiscUtils.GetSelectedValue(Me.PersonalExtWorkSearch, Me.GetFromSession(Me.PersonalExtWorkSearch)), True, False) + + search.iOR(PersonalExtWorkTable.Description, BaseFilter.ComparisonOperator.Contains, MiscUtils.GetSelectedValue(Me.PersonalExtWorkSearch, Me.GetFromSession(Me.PersonalExtWorkSearch)), True, False) + + wc.iAND(search) + + End If + End If + + If IsValueSelected(Me.PersonalIdFilter) Then + + wc.iAND(PersonalExtWorkTable.PersonalId, BaseFilter.ComparisonOperator.EqualsTo, MiscUtils.GetSelectedValue(Me.PersonalIdFilter, Me.GetFromSession(Me.PersonalIdFilter)), False, False) + + End If + + + + Return wc + End Function + + + Public Overridable Function CreateWhereClause(ByVal searchText as String, ByVal fromSearchControl as String, ByVal AutoTypeAheadSearch as String, ByVal AutoTypeAheadWordSeparators as String) As WhereClause + ' This CreateWhereClause is used for loading list of suggestions for Auto Type-Ahead feature. + PersonalExtWorkTable.Instance.InnerFilter = Nothing + Dim wc As WhereClause = New WhereClause() + + ' Compose the WHERE clause consiting of: + ' 1. Static clause defined at design time. + ' 2. User selected search criteria. + ' 3. User selected filter criteria. + + Dim appRelativeVirtualPath As String = CType(HttpContext.Current.Session("AppRelativeVirtualPath"), String) + + ' Adds clauses if values are selected in Filter controls which are configured in the page. + + Dim DescriptionFilterSelectedValue As String = CType(HttpContext.Current.Session()(HttpContext.Current.Session.SessionID & appRelativeVirtualPath & "DescriptionFilter_Ajax"), String) + If IsValueSelected(DescriptionFilterSelectedValue) Then + + wc.iAND(PersonalExtWorkTable.Description, BaseFilter.ComparisonOperator.EqualsTo, DescriptionFilterSelectedValue, false, False) + + End If + + If IsValueSelected(searchText) and fromSearchControl = "PersonalExtWorkSearch" Then + Dim formatedSearchText as String = searchText + ' Strip "..." from begin and ending of the search text, otherwise the search will return 0 values as in database "..." is not stored. + If searchText.StartsWith("...") Then + formatedSearchText = searchText.SubString(3,searchText.Length-3) + End If + If searchText.EndsWith("...") Then + formatedSearchText = searchText.SubString(0,searchText.Length-3) + ' Strip the last word as well as it is likely only a partial word + Dim endindex As Integer = searchText.Length - 1 + While (Not Char.IsWhiteSpace(searchText(endindex)) AndAlso endindex > 0) + endindex -= 1 + End While + If endindex > 0 Then + searchText = searchText.Substring(0, endindex) + End If + End If + 'After stripping "...", trim any leading and trailing whitespaces + formatedSearchText = formatedSearchText.Trim() + ' After stripping "..." see if the search text is null or empty. + If IsValueSelected(formatedSearchText) Then + ' These clauses are added depending on operator and fields selected in Control's property page, bindings tab. + + Dim search As WhereClause = New WhereClause() + + If InvariantLCase(AutoTypeAheadSearch).equals("wordsstartingwithsearchstring") Then + + search.iOR(PersonalExtWorkTable.PersonalId, BaseFilter.ComparisonOperator.Starts_With, formatedSearchText, True, False) + search.iOR(PersonalExtWorkTable.PersonalId, BaseFilter.ComparisonOperator.Contains, AutoTypeAheadWordSeparators & formatedSearchText, True, False) + + search.iOR(PersonalExtWorkTable.Description, BaseFilter.ComparisonOperator.Starts_With, formatedSearchText, True, False) + search.iOR(PersonalExtWorkTable.Description, BaseFilter.ComparisonOperator.Contains, AutoTypeAheadWordSeparators & formatedSearchText, True, False) + + Else + + search.iOR(PersonalExtWorkTable.PersonalId, BaseFilter.ComparisonOperator.Contains, formatedSearchText, True, False) + search.iOR(PersonalExtWorkTable.Description, BaseFilter.ComparisonOperator.Contains, formatedSearchText, True, False) + End If + wc.iAND(search) + + End If + End If + + Dim PersonalIdFilterSelectedValue As String = CType(HttpContext.Current.Session()(HttpContext.Current.Session.SessionID & appRelativeVirtualPath & "PersonalIdFilter_Ajax"), String) + If IsValueSelected(PersonalIdFilterSelectedValue) Then + + wc.iAND(PersonalExtWorkTable.PersonalId, BaseFilter.ComparisonOperator.EqualsTo, PersonalIdFilterSelectedValue, false, False) + + End If + + + Return wc + End Function + + Public Overridable Function GetAutoCompletionList_PersonalExtWorkSearch(ByVal prefixText As String, ByVal count As Integer) As String() + Dim resultList As ArrayList = New ArrayList + Dim wordList As ArrayList = New ArrayList + Dim iteration As Integer = 0 + + Dim filterJoin As CompoundFilter = CreateCompoundJoinFilter() + Dim wc As WhereClause = CreateWhereClause(prefixText,"PersonalExtWorkSearch", "WordsStartingWithSearchString", "[^a-zA-Z0-9]") + While (resultList.Count < count AndAlso iteration < 5) + ' Fetch 100 records in each iteration + Dim recordList () As Persons.Business.PersonalExtWorkRecord = PersonalExtWorkTable.GetRecords(filterJoin, wc, Nothing, iteration, 100) + Dim rec As PersonalExtWorkRecord = Nothing + Dim resultItem As String = "" + For Each rec In recordList + ' Exit the loop if recordList count has reached AutoTypeAheadListSize. + If resultList.Count >= count then + Exit For + End If + ' If the field is configured to Display as Foreign key, Format() method returns the + ' Display as Forien Key value instead of original field value. + ' Since search had to be done in multiple fields (selected in Control's page property, binding tab) in a record, + ' We need to find relevent field to display which matches the prefixText and is not already present in the result list. + + resultItem = rec.Format(PersonalExtWorkTable.PersonalId) + If resultItem IsNot Nothing AndAlso resultItem.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture).Contains(prefixText.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture)) Then + + Dim isAdded As Boolean = FormatSuggestions(prefixText, resultItem, 50, "AtBeginningOfMatchedString", "WordsStartingWithSearchString", "[^a-zA-Z0-9]", resultList) + If isAdded Then + Continue For + End If + End If + + resultItem = rec.Format(PersonalExtWorkTable.Description) + If resultItem IsNot Nothing AndAlso resultItem.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture).Contains(prefixText.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture)) Then + + Dim isAdded As Boolean = FormatSuggestions(prefixText, resultItem, 50, "AtBeginningOfMatchedString", "WordsStartingWithSearchString", "[^a-zA-Z0-9]", resultList) + If isAdded Then + Continue For + End If + End If + + Next + ' Exit the loop if number of records found is less as further iteration will not return any more records + If recordList .Length < 100 Then + Exit While + End If + iteration += 1 + End While + + resultList.Sort() + Dim result() As String = New String(resultList.Count - 1) {} + Array.Copy(resultList.ToArray, result, resultList.Count) + Return result + End Function + + + Public Overridable Function FormatSuggestions(ByVal prefixText As String, ByVal resultItem As String, _ + ByVal columnLength As Integer, ByVal AutoTypeAheadDisplayFoundText As String, _ + ByVal autoTypeAheadSearch As String, ByVal AutoTypeAheadWordSeparators As String, _ + ByVal resultList As ArrayList) As Boolean + + 'Formats the resultItem and adds it to the list of suggestions. + Dim index As Integer = resultItem.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture).IndexOf(prefixText.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture)) + Dim itemToAdd As String = "" + Dim isFound As Boolean = False + Dim isAdded As Boolean = False + ' Get the index where prfixt is at the beginning of resultItem. If not found then, index of word which begins with prefixText. + If InvariantLCase(autoTypeAheadSearch).equals("wordsstartingwithsearchstring") And Not index = 0 Then + ' Expression to find word which contains AutoTypeAheadWordSeparators followed by prefixText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex( AutoTypeAheadWordSeparators + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + If regex1.IsMatch(resultItem) Then + index = regex1.Match(resultItem).Index + isFound = True + End If + ' If the prefixText is found immediatly after white space then starting of the word is found so don not search any further + If not resultItem(index).ToString() = " " Then + ' Expression to find beginning of the word which contains AutoTypeAheadWordSeparators followed by prefixText + Dim regex As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\\S*" + AutoTypeAheadWordSeparators + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + If regex.IsMatch(resultItem) Then + index = regex.Match(resultItem).Index + isFound = True + End If + End If + End If + + ' If autoTypeAheadSearch value is wordsstartingwithsearchstring then, extract the substring only if the prefixText is found at the + ' beginning of the resultItem (index = 0) or a word in resultItem is found starts with prefixText. + If index = 0 Or isFound Or InvariantLCase(autoTypeAheadSearch).Equals("anywhereinstring") then + If InvariantLCase(AutoTypeAheadDisplayFoundText).equals("atbeginningofmatchedstring") Then + ' Expression to find beginning of the word which contains prefixText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\\S*" + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + ' Find the beginning of the word which contains prefexText + If (StringUtils.InvariantLCase(autoTypeAheadSearch).Equals("anywhereinstring") AndAlso regex1.IsMatch(resultItem)) Then + index = regex1.Match(resultItem).Index + isFound = True + End If + ' Display string from the index till end of the string if sub string from index till end is less than columnLength value. + If Len(resultItem) - index <= columnLength Then + If index = 0 Then + itemToAdd = resultItem + Else + itemToAdd = "..." & resultItem.Substring(index, Len(resultItem) - index) + End If + Else + If index = 0 Then + itemToAdd = resultItem.Substring(index, (columnLength - 3)) & "..." + Else + 'Truncate the string to show only columnLength - 6 characters as begining and trailing "..." has to be appended. + itemToAdd = "..." & resultItem.Substring(index , columnLength - 6) & "..." + End If + End If + ElseIf InvariantLCase(AutoTypeAheadDisplayFoundText).equals("inmiddleofmatchedstring") Then + Dim subStringBeginIndex As Integer = CType(columnLength/2, Integer) + If Len(resultItem) <= columnLength Then + itemToAdd = resultItem + Else + ' Sanity check at end of the string + If index + Len(prefixText) = columnLength Then + itemToAdd = "..." & resultItem.Substring(index-columnLength,index) + ElseIf Len(resultItem) - index < subStringBeginIndex Then + ' Display string from the end till columnLength value if, index is closer to the end of the string. + itemToAdd = "..." & resultItem.Substring(Len(resultItem)-columnLength,Len(resultItem)) + ElseIf index <= subStringBeginIndex Then + ' Sanity chet at beginning of the string + itemToAdd = resultItem.Substring(0, columnLength) & "..." + Else + ' Display string containing text before the prefixText occures and text after the prefixText + itemToAdd = "..." & resultItem.Substring(index - subStringBeginIndex, columnLength) & "..." + End If + End If + ElseIf InvariantLCase(AutoTypeAheadDisplayFoundText).equals("atendofmatchedstring") Then + ' Expression to find ending of the word which contains prefexText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\s", System.Text.RegularExpressions.RegexOptions.IgnoreCase) + ' Find the ending of the word which contains prefexText + If regex1.IsMatch(resultItem, index + 1) Then + index = regex1.Match(resultItem, index + 1).Index + Else + ' If the word which contains prefexText is the last word in string, regex1.IsMatch returns false. + index = resultItem.Length + End If + If index > Len(resultItem) Then + index = Len(resultItem) + End If + ' If text from beginning of the string till index is less than columnLength value then, display string from the beginning till index. + If index <= columnLength Then + if index = Len(resultItem) Then 'Make decision to append "..." + itemToAdd = resultItem.Substring(0,index) + Else + itemToAdd = resultItem.Substring(0,index) & "..." + End If + Else + If index = Len(resultItem) Then + itemToAdd = "..." & resultItem.Substring(index - (columnLength - 3), (columnLength - 3)) + Else + 'Truncate the string to show only columnLength - 6 characters as begining and trailing "..." has to be appended. + itemToAdd = "..." & resultItem.Substring(index - (columnLength - 6), columnLength - 6) & "..." + End If + End If + End If + + ' Remove newline character from itemToAdd + Dim prefixTextIndex As Integer = itemToAdd.IndexOf(prefixText, StringComparison.CurrentCultureIgnoreCase) + ' If itemToAdd contains any newline after the search text then show text only till newline + Dim regex2 As System.Text.RegularExpressions.Regex = New System.Text.RegularExpressions.Regex("(" & vbCrLf & "|" & vbLf & ")", System.Text.RegularExpressions.RegexOptions.IgnoreCase) + Dim newLineIndexAfterPrefix As Integer = -1 + If regex2.IsMatch(itemToAdd, prefixTextIndex) Then + newLineIndexAfterPrefix = regex2.Match(itemToAdd, prefixTextIndex).Index + End If + If (newLineIndexAfterPrefix > -1) Then + If itemToAdd.EndsWith("...") Then + itemToAdd = (itemToAdd.Substring(0, newLineIndexAfterPrefix) + "...") + Else + itemToAdd = itemToAdd.Substring(0, newLineIndexAfterPrefix) + End If + End If + ' If itemToAdd contains any newline before search text then show text which comes after newline + Dim regex3 As System.Text.RegularExpressions.Regex = New System.Text.RegularExpressions.Regex("(" & vbCrLf & "|" & vbLf & ")", (System.Text.RegularExpressions.RegexOptions.IgnoreCase Or System.Text.RegularExpressions.RegexOptions.RightToLeft)) + Dim newLineIndexBeforePrefix As Integer = -1 + If regex3.IsMatch(itemToAdd, prefixTextIndex) Then + newLineIndexBeforePrefix = regex3.Match(itemToAdd, prefixTextIndex).Index + End If + If (newLineIndexBeforePrefix > -1) Then + If itemToAdd.StartsWith("...") Then + itemToAdd = ("..." + itemToAdd.Substring((newLineIndexBeforePrefix + regex3.Match(itemToAdd, prefixTextIndex).Length))) + Else + itemToAdd = itemToAdd.Substring((newLineIndexBeforePrefix + regex3.Match(itemToAdd, prefixTextIndex).Length)) + End If + End If + + If Not itemToAdd is nothing AndAlso Not resultList.Contains(itemToAdd) Then + + resultList.Add(itemToAdd) + + isAdded = true + End If + End If + Return isAdded + End Function + + + Protected Overridable Sub GetPageSize() + + If Me.PersonalExtWorkPagination.PageSize.Text.Trim <> "" Then + Try + 'Me.PageSize = Integer.Parse(Me.PersonalExtWorkPagination.PageSize.Text) + Catch ex As Exception + End Try + End If + End Sub + + Protected Overridable Sub AddNewRecords() + + Dim newRecordList As ArrayList = New ArrayList() + + Dim newUIDataList As System.Collections.Generic.List(Of Hashtable) = New System.Collections.Generic.List(Of Hashtable)() + + ' Loop though all the record controls and if the record control + ' does not have a unique record id set, then create a record + ' and add to the list. + If Not Me.ResetData Then + Dim rep As System.Web.UI.WebControls.Repeater = CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalExtWorkTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return + + Dim repItem As System.Web.UI.WebControls.RepeaterItem + For Each repItem In rep.Items + ' Loop through all rows in the table, set its DataSource and call DataBind(). + + Dim recControl As PersonalExtWorkTableControlRow = DirectCast(repItem.FindControl("PersonalExtWorkTableControlRow"), PersonalExtWorkTableControlRow) + + If recControl.Visible AndAlso recControl.IsNewRecord() Then + + Dim rec As PersonalExtWorkRecord = New PersonalExtWorkRecord() + + If recControl.BeginDate.Text <> "" Then + rec.Parse(recControl.BeginDate.Text, PersonalExtWorkTable.BeginDate) + End If + If recControl.Command.Text <> "" Then + rec.Parse(recControl.Command.Text, PersonalExtWorkTable.Command) + End If + If recControl.CommandDate.Text <> "" Then + rec.Parse(recControl.CommandDate.Text, PersonalExtWorkTable.CommandDate) + End If + If recControl.Description.Text <> "" Then + rec.Parse(recControl.Description.Text, PersonalExtWorkTable.Description) + End If + If recControl.EndDate.Text <> "" Then + rec.Parse(recControl.EndDate.Text, PersonalExtWorkTable.EndDate) + End If + If recControl.PersonalId.Text <> "" Then + rec.Parse(recControl.PersonalId.Text, PersonalExtWorkTable.PersonalId) + End If + If recControl.Place.Text <> "" Then + rec.Parse(recControl.Place.Text, PersonalExtWorkTable.Place) + End If + newUIDataList.Add(recControl.PreservedUIData()) + newRecordList.Add(rec) + End If + Next + End If + + + ' Add any new record to the list. + Dim index As Integer = 0 + For index = 1 To Me.AddNewRecord + + newRecordList.Insert(0, New PersonalExtWorkRecord()) + newUIDataList.Insert(0, New Hashtable()) + + Next + Me.AddNewRecord = 0 + + ' Finally, add any new records to the DataSource. + If newRecordList.Count > 0 Then + + Dim finalList As ArrayList = New ArrayList(Me.DataSource) + finalList.InsertRange(0, newRecordList) + + Me.DataSource = DirectCast(finalList.ToArray(GetType(PersonalExtWorkRecord)), PersonalExtWorkRecord()) + + End If + + ' Add the existing UI data to this hash table + If newUIDataList.Count > 0 Then + Me.UIData.InsertRange(0, newUIDataList) + End If + + End Sub + + + Public Sub AddToDeletedRecordIds(ByVal rec As PersonalExtWorkTableControlRow) + If rec.IsNewRecord() Then + Return + End If + + If Not Me.DeletedRecordIds Is Nothing AndAlso Me.DeletedRecordIds.Trim <> "" Then + Me.DeletedRecordIds &= "," + End If + + Me.DeletedRecordIds &= "[" & rec.RecordUniqueId & "]" + End Sub + + Protected Overridable Function InDeletedRecordIds(ByVal rec As PersonalExtWorkTableControlRow) As Boolean + If Me.DeletedRecordIds Is Nothing OrElse Me.DeletedRecordIds.Trim = "" Then + Return False + End If + + Return Me.DeletedRecordIds.IndexOf("[" & rec.RecordUniqueId & "]") >= 0 + End Function + + Private _DeletedRecordIds As String + Public Property DeletedRecordIds() As String + Get + Return Me._DeletedRecordIds + End Get + Set(ByVal value As String) + Me._DeletedRecordIds = value + End Set + End Property + + + ' Create Set, WhereClause, and Populate Methods + + Public Overridable Sub SetBeginDateLabel() + + End Sub + + Public Overridable Sub SetCommandDateLabel() + + End Sub + + Public Overridable Sub SetCommandLabel() + + End Sub + + Public Overridable Sub SetDescriptionLabel() + + End Sub + + Public Overridable Sub SetDescriptionLabel1() + + End Sub + + Public Overridable Sub SetEndDateLabel() + + End Sub + + Public Overridable Sub SetPersonalExtWorkTableControlCollapsibleRegion() + + End Sub + + Public Overridable Sub SetPersonalExtWorkTableControlIcon() + + End Sub + + Public Overridable Sub SetPersonalExtWorkTableControlPanelExtender() + + End Sub + + Public Overridable Sub SetPersonalIdLabel() + + End Sub + + Public Overridable Sub SetPersonalIdLabel1() + + End Sub + + Public Overridable Sub SetPlaceLabel() + + End Sub + + Public Overridable Sub SetDescriptionFilter() + + Me.PopulateDescriptionFilter(GetSelectedValue(Me.DescriptionFilter, GetFromSession(Me.DescriptionFilter)), 500) + + End Sub + + Public Overridable Sub SetPersonalExtWorkSearch() + + End Sub + + Public Overridable Sub SetPersonalIdFilter() + + Me.PopulatePersonalIdFilter(GetSelectedValue(Me.PersonalIdFilter, GetFromSession(Me.PersonalIdFilter)), 500) + + End Sub + + ' Get the filters' data for DescriptionFilter + Protected Overridable Sub PopulateDescriptionFilter(ByVal selectedValue As String, ByVal maxItems As Integer) + + + Me.DescriptionFilter.Items.Clear() + + + + ' Set up the WHERE and the ORDER BY clause by calling the CreateWhereClause_DescriptionFilter function. + ' It is better to customize the where clause there. + + ' Setup the WHERE clause, including the base table if needed. + + Dim wc As WhereClause = Me.CreateWhereClause_DescriptionFilter() + + ' Setup the static list items + + ' Add the All item. + Me.DescriptionFilter.Items.Insert(0, new ListItem(Me.Page.GetResourceValue("Txt:All", "Persons"), "--ANY--")) + + + + Dim orderBy As OrderBy = New OrderBy(False, False) + orderBy.Add(PersonalExtWorkTable.Description, OrderByItem.OrderDir.Asc) + + + Dim values() As String = PersonalExtWorkTable.GetValues(PersonalExtWorkTable.Description, wc, orderBy, maxItems) + + Dim cvalue As String + + Dim listDuplicates As New ArrayList() + For Each cvalue In values + ' Create the item and add to the list. + Dim fvalue As String + + If ( PersonalExtWorkTable.Description.IsColumnValueTypeBoolean()) Then + fvalue = cvalue + Else + fvalue = PersonalExtWorkTable.Description.Format(cvalue) + End If + + 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.DescriptionFilter.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.DescriptionFilter.Items.Add(newItem) + + If listDuplicates.Contains(fvalue) Then + newItem.Text = fvalue & " (ID " & cvalue.Substring(0, Math.Min(cvalue.Length,38)) & ")" + End If + + Next + + + + ' Set the selected value. + SetSelectedValue(Me.DescriptionFilter, selectedValue) + + + End Sub + + ' Get the filters' data for PersonalIdFilter + Protected Overridable Sub PopulatePersonalIdFilter(ByVal selectedValue As String, ByVal maxItems As Integer) + + + Me.PersonalIdFilter.Items.Clear() + + + + ' Set up the WHERE and the ORDER BY clause by calling the CreateWhereClause_PersonalIdFilter function. + ' It is better to customize the where clause there. + + ' Setup the WHERE clause, including the base table if needed. + + Dim wc As WhereClause = Me.CreateWhereClause_PersonalIdFilter() + + ' Setup the static list items + + ' Add the All item. + Me.PersonalIdFilter.Items.Insert(0, new ListItem(Me.Page.GetResourceValue("Txt:All", "Persons"), "--ANY--")) + + + + Dim orderBy As OrderBy = New OrderBy(False, False) + orderBy.Add(PersonalExtWorkTable.PersonalId, OrderByItem.OrderDir.Asc) + + + Dim values() As String = PersonalExtWorkTable.GetValues(PersonalExtWorkTable.PersonalId, wc, orderBy, maxItems) + + Dim cvalue As String + + Dim listDuplicates As New ArrayList() + For Each cvalue In values + ' Create the item and add to the list. + Dim fvalue As String + + If ( PersonalExtWorkTable.PersonalId.IsColumnValueTypeBoolean()) Then + fvalue = cvalue + Else + fvalue = PersonalExtWorkTable.PersonalId.Format(cvalue) + End If + + If (IsNothing(fvalue)) Then + fvalue = "" + End If + + fvalue = fvalue.Trim() + + If ( fvalue.Length > 50 ) Then + fvalue = fvalue.Substring(0, 50) & "..." + End If + + Dim dupItem As ListItem = Me.PersonalIdFilter.Items.FindByText(fvalue) + + If Not IsNothing(dupItem) Then + listDuplicates.Add(fvalue) + dupItem.Text = fvalue & " (ID " & dupItem.Value.Substring(0, Math.Min(dupItem.Value.Length,38)) & ")" + End If + + Dim newItem As ListItem = New ListItem(fvalue, cvalue) + Me.PersonalIdFilter.Items.Add(newItem) + + If listDuplicates.Contains(fvalue) Then + newItem.Text = fvalue & " (ID " & cvalue.Substring(0, Math.Min(cvalue.Length,38)) & ")" + End If + + Next + + + + ' Set the selected value. + SetSelectedValue(Me.PersonalIdFilter, selectedValue) + + + End Sub + + Public Overridable Function CreateWhereClause_DescriptionFilter() As WhereClause + + ' Create a where clause for the filter DescriptionFilter. + ' This function is called by the Populate method to load the items + ' in the DescriptionFilterDropDownList + + Dim wc As WhereClause= New WhereClause() + Return wc + + End Function + + Public Overridable Function CreateWhereClause_PersonalIdFilter() As WhereClause + + ' Create a where clause for the filter PersonalIdFilter. + ' This function is called by the Populate method to load the items + ' in the PersonalIdFilterDropDownList + + Dim wc As WhereClause= New WhereClause() + Return wc + + End Function + + + + + Protected Overridable Sub Control_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.PreRender + ' PreRender event is raised just before page is being displayed. + Try + DbUtils.StartTransaction + Me.RegisterPostback() + + If Not Me.Page.ErrorOnPage AndAlso (Me.Page.IsPageRefresh OrElse Me.DataChanged OrElse Me.ResetData) Then + + + ' Re-load the data and update the web page if necessary. + ' This is typically done during a postback (filter, search button, sort, pagination button). + ' In each of the other click handlers, simply set DataChanged to True to reload the data. + + Me.LoadData() + Me.DataBind() + + End If + + + + Catch ex As Exception + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + Finally + DbUtils.EndTransaction + End Try + End Sub + + + Protected Overrides Sub SaveControlsToSession() + MyBase.SaveControlsToSession() + + ' Save filter controls to values to session. + + Me.SaveToSession(Me.DescriptionFilter, Me.DescriptionFilter.SelectedValue) + + Me.SaveToSession(Me.PersonalExtWorkSearch, Me.PersonalExtWorkSearch.Text) + + Me.SaveToSession(Me.PersonalIdFilter, Me.PersonalIdFilter.SelectedValue) + + + 'Save pagination state to session. + + + + ' Save table control properties to the session. + If Not Me.CurrentSortOrder Is Nothing Then + Me.SaveToSession(Me, "Order_By", Me.CurrentSortOrder.ToXmlString()) + End If + + Me.SaveToSession(Me, "Page_Index", Me.PageIndex.ToString()) + Me.SaveToSession(Me, "Page_Size", Me.PageSize.ToString()) + + Me.SaveToSession(Me, "DeletedRecordIds", Me.DeletedRecordIds) + + End Sub + + Protected Sub SaveControlsToSession_Ajax() + ' Save filter controls to values to session. + + Me.SaveToSession("DescriptionFilter_Ajax", Me.DescriptionFilter.SelectedValue) + + Me.SaveToSession("PersonalExtWorkSearch_Ajax", Me.PersonalExtWorkSearch.Text) + + Me.SaveToSession("PersonalIdFilter_Ajax", Me.PersonalIdFilter.SelectedValue) + + HttpContext.Current.Session("AppRelativeVirtualPath") = Me.Page.AppRelativeVirtualPath + + End Sub + + Protected Overrides Sub ClearControlsFromSession() + MyBase.ClearControlsFromSession() + + ' Clear filter controls values from the session. + + Me.RemoveFromSession(Me.DescriptionFilter) + Me.RemoveFromSession(Me.PersonalExtWorkSearch) + Me.RemoveFromSession(Me.PersonalIdFilter) + + ' Clear pagination state from session. + + + + ' Clear table properties from the session. + Me.RemoveFromSession(Me, "Order_By") + Me.RemoveFromSession(Me, "Page_Index") + Me.RemoveFromSession(Me, "Page_Size") + + Me.RemoveFromSession(Me, "DeletedRecordIds") + + End Sub + + Protected Overrides Sub LoadViewState(ByVal savedState As Object) + MyBase.LoadViewState(savedState) + + Dim orderByStr As String = CType(ViewState("PersonalExtWorkTableControl_OrderBy"), String) + + If orderByStr IsNot Nothing AndAlso orderByStr.Trim <> "" Then + Me.CurrentSortOrder = BaseClasses.Data.OrderBy.FromXmlString(orderByStr) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + End If + + Dim pageIndex As String = CType(ViewState("Page_Index"), String) + If pageIndex IsNot Nothing Then + Me.PageIndex = CInt(pageIndex) + End If + + Dim pageSize As String = CType(ViewState("Page_Size"), String) + If Not pageSize Is Nothing Then + Me.PageSize = CInt(pageSize) + End If + + + + ' Load view state for pagination control. + + Me.DeletedRecordIds = CType(Me.ViewState("DeletedRecordIds"), String) + + End Sub + + Protected Overrides Function SaveViewState() As Object + + If Me.CurrentSortOrder IsNot Nothing Then + Me.ViewState("PersonalExtWorkTableControl_OrderBy") = Me.CurrentSortOrder.ToXmlString() + End If + + Me.ViewState("Page_Index") = Me.PageIndex + Me.ViewState("Page_Size") = Me.PageSize + + Me.ViewState("DeletedRecordIds") = Me.DeletedRecordIds + + + ' Load view state for pagination control. + + + Return MyBase.SaveViewState() + End Function + + ' Generate the event handling functions for pagination events. + + ' event handler for ImageButton + Public Overridable Sub PersonalExtWorkPagination_FirstPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.PageIndex = 0 + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalExtWorkPagination_LastPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.DisplayLastPage = True + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalExtWorkPagination_NextPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.PageIndex += 1 + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for LinkButton + Public Overridable Sub PersonalExtWorkPagination_PageSizeButton_Click(ByVal sender As Object, ByVal args As EventArgs) + + Try + + Me.DataChanged = True + + Me.PageSize = Integer.Parse(Me.PersonalExtWorkPagination.PageSize.Text) + + Me.PageIndex = Integer.Parse(Me.PersonalExtWorkPagination.CurrentPage.Text) - 1 + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalExtWorkPagination_PreviousPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + If Me.PageIndex > 0 Then + Me.PageIndex -= 1 + Me.DataChanged = True + End If + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + + ' Generate the event handling functions for sorting events. + + Public Overridable Sub BeginDateLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by BeginDate when clicked. + + ' Get previous sorting state for BeginDate. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalExtWorkTable.BeginDate) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for BeginDate. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalExtWorkTable.BeginDate, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by BeginDate, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub CommandDateLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by CommandDate when clicked. + + ' Get previous sorting state for CommandDate. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalExtWorkTable.CommandDate) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for CommandDate. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalExtWorkTable.CommandDate, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by CommandDate, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub CommandLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by Command when clicked. + + ' Get previous sorting state for Command. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalExtWorkTable.Command) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for Command. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalExtWorkTable.Command, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by Command, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub DescriptionLabel1_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by Description when clicked. + + ' Get previous sorting state for Description. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalExtWorkTable.Description) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for Description. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalExtWorkTable.Description, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by Description, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub EndDateLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by EndDate when clicked. + + ' Get previous sorting state for EndDate. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalExtWorkTable.EndDate) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for EndDate. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalExtWorkTable.EndDate, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by EndDate, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub PersonalIdLabel1_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by PersonalId when clicked. + + ' Get previous sorting state for PersonalId. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalExtWorkTable.PersonalId) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for PersonalId. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalExtWorkTable.PersonalId, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by PersonalId, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub PlaceLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by Place when clicked. + + ' Get previous sorting state for Place. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalExtWorkTable.Place) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for Place. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalExtWorkTable.Place, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by Place, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + + ' Generate the event handling functions for button events. + + ' event handler for ImageButton + Public Overridable Sub PersonalExtWorkCopyButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + ' The redirect URL is set on the Properties, Custom Properties or Actions. + ' The ModifyRedirectURL call resolves the parameters before the + ' Response.Redirect redirects the page to the URL. + ' Any code after the Response.Redirect call will not be executed, since the page is + ' redirected to the URL. + + + Dim url As String = "../PersonalExtWork/AddPersonalExtWork.aspx?PersonalExtWork={PK}" + + Dim shouldRedirect As Boolean = True + Dim TargetKey As String = Nothing + Dim DFKA As String = TargetKey + Dim id As String = DFKA + Dim value As String = id + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + url = Me.ModifyRedirectUrl(url, "",False) + url = Me.Page.ModifyRedirectUrl(url, "",False) + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + shouldRedirect = False + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + If shouldRedirect Then + Me.Page.ShouldSaveControlsToSession = True + Me.Page.Response.Redirect(url) + ElseIf Not TargetKey Is Nothing AndAlso _ + Not shouldRedirect Then + Me.Page.ShouldSaveControlsToSession = True + Me.Page.CloseWindow(True) + + End If + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalExtWorkDeleteButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + If(Not Me.Page.IsPageRefresh) Then + + Me.DeleteSelectedRecords(False) + Me.SetFormulaControls() + + + End If + Me.Page.CommitTransaction(sender) + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalExtWorkEditButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + ' The redirect URL is set on the Properties, Custom Properties or Actions. + ' The ModifyRedirectURL call resolves the parameters before the + ' Response.Redirect redirects the page to the URL. + ' Any code after the Response.Redirect call will not be executed, since the page is + ' redirected to the URL. + + + Dim url As String = "../PersonalExtWork/EditPersonalExtWork.aspx?PersonalExtWork={PK}" + + Dim shouldRedirect As Boolean = True + Dim TargetKey As String = Nothing + Dim DFKA As String = TargetKey + Dim id As String = DFKA + Dim value As String = id + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + url = Me.ModifyRedirectUrl(url, "",False) + url = Me.Page.ModifyRedirectUrl(url, "",False) + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + shouldRedirect = False + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + If shouldRedirect Then + Me.Page.ShouldSaveControlsToSession = True + Me.Page.Response.Redirect(url) + ElseIf Not TargetKey Is Nothing AndAlso _ + Not shouldRedirect Then + Me.Page.ShouldSaveControlsToSession = True + Me.Page.CloseWindow(True) + + End If + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalExtWorkExportCSVButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + ' Build the where clause based on the current filter and search criteria + ' Create the Order By clause based on the user's current sorting preference. + + Dim wc As WhereClause = CreateWhereClause + Dim orderBy As OrderBy = Nothing + + orderBy = CreateOrderBy + + ' Add each of the columns in order of export. + Dim columns() as BaseColumn = New BaseColumn() { _ + PersonalExtWorkTable.PersonalId, _ + PersonalExtWorkTable.Description, _ + PersonalExtWorkTable.Place, _ + PersonalExtWorkTable.BeginDate, _ + PersonalExtWorkTable.EndDate, _ + PersonalExtWorkTable.Command, _ + PersonalExtWorkTable.CommandDate, _ + Nothing} + Dim exportData as ExportDataToCSV = New ExportDataToCSV(PersonalExtWorkTable.Instance, wc, orderBy, columns) + + Dim done As Boolean = False + + Dim totalRowsReturned As Integer = 0 + Dim join As CompoundFilter = CreateCompoundJoinFilter() + Dim data As DataForExport = New DataForExport(PersonalExtWorkTable.Instance, wc, orderBy, columns, join) + + 'Check for Export Data Threshold + Dim exportRawValues As Boolean = False + Me.TotalRecords = PersonalExtWorkTable.GetRecordCount(join, wc) + If Me.TotalRecords > 10000 Then + exportRawValues = True + End If + exportData.StartExport(Me.Page.Response, exportRawValues) + + ' Read pageSize records at a time and write out the CSV file. + While (Not done) + Dim recList As ArrayList = data.GetRows(exportData.pageSize) + If recList Is Nothing Then + Exit While 'no more records we are done + End If + + totalRowsReturned = recList.Count + For Each rec As BaseRecord In recList + For Each col As BaseColumn In data.ColumnList + If col Is Nothing Then + Continue For + End If + + If Not data.IncludeInExport(col) Then + Continue For + End If + + Dim val As String = "" + + If exportRawValues Then + val = rec.GetValue(col).ToString() + Else + Dim _isExpandableNonCompositeForeignKey As Boolean = col.TableDefinition.IsExpandableNonCompositeForeignKey(col) + If _isExpandableNonCompositeForeignKey AndAlso col.IsApplyDisplayAs Then + val = PersonalExtWorkTable.GetDFKA(rec.GetValue(col).ToString(), col, Nothing) + End If + If (Not _isExpandableNonCompositeForeignKey) Or (String.IsNullOrEmpty(val)) Then + val = exportData.GetDataForExport(col, rec) + End If + End If + exportData.WriteColumnData(val, data.IsString(col)) + + Next col + exportData.WriteNewRow() + Next rec + + ' If we already are below the pageSize, then we are done. + If totalRowsReturned < exportData.pageSize Then + done = True + End If + End While + exportData.FinishExport(Me.Page.Response) + + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalExtWorkExportExcelButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + ' To customize the columns or the format, override this function in Section 1 of the page + ' and modify it to your liking. + ' Build the where clause based on the current filter and search criteria + ' Create the Order By clause based on the user's current sorting preference. + + Dim wc As WhereClause = CreateWhereClause + Dim orderBy As OrderBy = Nothing + + orderBy = CreateOrderBy + + Dim done As Boolean = False + Dim val As Object = "" + ' Read pageSize records at a time and write out the Excel file. + Dim totalRowsReturned As Integer = 0 + + Me.TotalRecords = PersonalExtWorkTable.GetRecordCount(wc) + If Me.TotalRecords > 10000 Then + + ' Add each of the columns in order of export. + Dim columns() as BaseColumn = New BaseColumn() { _ + PersonalExtWorkTable.PersonalId, _ + PersonalExtWorkTable.Description, _ + PersonalExtWorkTable.Place, _ + PersonalExtWorkTable.BeginDate, _ + PersonalExtWorkTable.EndDate, _ + PersonalExtWorkTable.Command, _ + PersonalExtWorkTable.CommandDate, _ + Nothing} + Dim exportData as ExportDataToCSV = New ExportDataToCSV(PersonalExtWorkTable.Instance, wc, orderBy, columns) + exportData.StartExport(Me.Page.Response, True) + + Dim dataForCSV As DataForExport = New DataForExport(PersonalExtWorkTable.Instance, wc, orderBy, columns) + + ' Read pageSize records at a time and write out the CSV file. + While (Not done) + Dim recList As ArrayList = dataForCSV.GetRows(exportData.pageSize) + If recList Is Nothing Then + Exit While 'no more records we are done + End If + + totalRowsReturned = recList.Count + For Each rec As BaseRecord In recList + For Each col As BaseColumn In dataForCSV.ColumnList + If col Is Nothing Then + Continue For + End If + + If Not dataForCSV.IncludeInExport(col) Then + Continue For + End If + + val = rec.GetValue(col).ToString() + exportData.WriteColumnData(val, dataForCSV.IsString(col)) + + Next col + exportData.WriteNewRow() + Next rec + + ' If we already are below the pageSize, then we are done. + If totalRowsReturned < exportData.pageSize Then + done = True + End If + End While + exportData.FinishExport(Me.Page.Response) + Else + + ' Create an instance of the Excel report class with the table class, where clause and order by. + Dim excelReport As ExportDataToExcel = New ExportDataToExcel(PersonalExtWorkTable.Instance, wc, orderBy) + ' Add each of the columns in order of export. + ' To customize the data type, change the second parameter of the new ExcelColumn to be + ' a format string from Excel's Format Cell menu. For example "dddd, mmmm dd, yyyy h:mm AM/PM;@", "#,##0.00" + + If Me.Page.Response Is Nothing Then + Return + End If + + excelReport.CreateExcelBook() + + Dim width As Integer = 0 + Dim columnCounter As Integer = 0 + Dim data As DataForExport = New DataForExport(PersonalExtWorkTable.Instance, wc, orderBy, Nothing) + data.ColumnList.Add(New ExcelColumn(PersonalExtWorkTable.PersonalId, "Default")) + data.ColumnList.Add(New ExcelColumn(PersonalExtWorkTable.Description, "Default")) + data.ColumnList.Add(New ExcelColumn(PersonalExtWorkTable.Place, "Default")) + data.ColumnList.Add(New ExcelColumn(PersonalExtWorkTable.BeginDate, "Short Date")) + data.ColumnList.Add(New ExcelColumn(PersonalExtWorkTable.EndDate, "Short Date")) + data.ColumnList.Add(New ExcelColumn(PersonalExtWorkTable.Command, "Default")) + data.ColumnList.Add(New ExcelColumn(PersonalExtWorkTable.CommandDate, "Short Date")) + + + For Each col As ExcelColumn In data.ColumnList + width = excelReport.GetExcelCellWidth(col) + If data.IncludeInExport(col) Then + excelReport.AddColumnToExcelBook(columnCounter, col.ToString(), excelReport.GetExcelDataType(col), width, excelReport.GetDisplayFormat(col)) + columnCounter = columnCounter + 1 + End If + Next col + + While (Not done) + Dim recList As ArrayList = data.GetRows(excelReport.pageSize) + + If recList Is Nothing Then + Exit While 'no more records we are done + End If + + totalRowsReturned = recList.Count + + For Each rec As BaseRecord In recList + excelReport.AddRowToExcelBook() + columnCounter = 0 + + For Each col As ExcelColumn In data.ColumnList + If Not data.IncludeInExport(col) Then + Continue For + End If + + Dim _isExpandableNonCompositeForeignKey As Boolean = col.DisplayColumn.TableDefinition.IsExpandableNonCompositeForeignKey(col.DisplayColumn) + If _isExpandableNonCompositeForeignKey AndAlso col.DisplayColumn.IsApplyDisplayAs Then + val = PersonalExtWorkTable.GetDFKA(rec.GetValue(col.DisplayColumn).ToString(), col.DisplayColumn, Nothing) + If val Is Nothing Then + val = rec.Format(col.DisplayColumn) + End If + Else + val = excelReport.GetValueForExcelExport(col, rec) + End If + excelReport.AddCellToExcelRow(columnCounter, excelReport.GetExcelDataType(col), val, col.DisplayFormat) + + columnCounter = columnCounter + 1 + Next col + Next rec + + ' If we already are below the pageSize, then we are done. + If totalRowsReturned < excelReport.pageSize Then + done = True + End If + End While + + excelReport.SaveExcelBook(Me.Page.Response) + End If + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalExtWorkImportButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalExtWorkNewButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + ' The redirect URL is set on the Properties, Custom Properties or Actions. + ' The ModifyRedirectURL call resolves the parameters before the + ' Response.Redirect redirects the page to the URL. + ' Any code after the Response.Redirect call will not be executed, since the page is + ' redirected to the URL. + + + Dim url As String = "../PersonalExtWork/AddPersonalExtWork.aspx" + + Dim shouldRedirect As Boolean = True + Dim TargetKey As String = Nothing + Dim DFKA As String = TargetKey + Dim id As String = DFKA + Dim value As String = id + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + url = Me.ModifyRedirectUrl(url, "",False) + url = Me.Page.ModifyRedirectUrl(url, "",False) + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + shouldRedirect = False + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + If shouldRedirect Then + Me.Page.ShouldSaveControlsToSession = True + Me.Page.Response.Redirect(url) + ElseIf Not TargetKey Is Nothing AndAlso _ + Not shouldRedirect Then + Me.Page.ShouldSaveControlsToSession = True + Me.Page.CloseWindow(True) + + End If + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalExtWorkPDFButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + Dim report As PDFReport = New PDFReport() + report.SpecificReportFileName = Page.Server.MapPath("ShowPersonalExtWorkTable.PersonalExtWorkPDFButton.report") + ' report.Title replaces the value tag of page header and footer containing ${ReportTitle} + report.Title = "PersonalExtWork" + ' If ShowPersonalExtWorkTable.PersonalExtWorkPDFButton.report specifies a valid report template, + ' AddColumn method will generate a report template. + ' Each AddColumn method-call specifies a column + ' The 1st parameter represents the text of the column header + ' The 2nd parameter represents the horizontal alignment of the column header + ' The 3rd parameter represents the text format of the column detail + ' The 4th parameter represents the horizontal alignment of the column detail + ' The 5th parameter represents the relative width of the column + report.AddColumn(PersonalExtWorkTable.PersonalId.Name, ReportEnum.Align.Left, "${PersonalId}", ReportEnum.Align.Left, 15) + report.AddColumn(PersonalExtWorkTable.Description.Name, ReportEnum.Align.Left, "${Description}", ReportEnum.Align.Left, 30) + report.AddColumn(PersonalExtWorkTable.Place.Name, ReportEnum.Align.Left, "${Place}", ReportEnum.Align.Left, 30) + report.AddColumn(PersonalExtWorkTable.BeginDate.Name, ReportEnum.Align.Left, "${BeginDate}", ReportEnum.Align.Left, 20) + report.AddColumn(PersonalExtWorkTable.EndDate.Name, ReportEnum.Align.Left, "${EndDate}", ReportEnum.Align.Left, 20) + report.AddColumn(PersonalExtWorkTable.Command.Name, ReportEnum.Align.Left, "${Command}", ReportEnum.Align.Left, 30) + report.AddColumn(PersonalExtWorkTable.CommandDate.Name, ReportEnum.Align.Left, "${CommandDate}", ReportEnum.Align.Left, 20) + + + Dim rowsPerQuery As Integer = 5000 + Dim recordCount As Integer = 0 + + report.Page = Page.GetResourceValue("Txt:Page", "Persons") + report.ApplicationPath = Me.Page.MapPath(Page.Request.ApplicationPath) + + Dim whereClause As WhereClause = CreateWhereClause + Dim orderBy As OrderBy = CreateOrderBy + Dim joinFilter As BaseFilter = CreateCompoundJoinFilter() + + Dim pageNum As Integer = 0 + Dim totalRows As Integer = PersonalExtWorkTable.GetRecordCount(joinFilter,whereClause) + Dim columns As ColumnList = PersonalExtWorkTable.GetColumnList() + Dim records As PersonalExtWorkRecord() = Nothing + + Do + + records = PersonalExtWorkTable.GetRecords(joinFilter,whereClause, orderBy, pageNum, rowsPerQuery) + If Not (records Is Nothing) AndAlso records.Length > 0 AndAlso whereClause.RunQuery Then + For Each record As PersonalExtWorkRecord In records + + ' AddData method takes four parameters + ' The 1st parameters represent the data format + ' The 2nd parameters represent the data value + ' The 3rd parameters represent the default alignment of column using the data + ' The 4th parameters represent the maximum length of the data value being shown + report.AddData("${PersonalId}", record.Format(PersonalExtWorkTable.PersonalId), ReportEnum.Align.Left, 100) + report.AddData("${Description}", record.Format(PersonalExtWorkTable.Description), ReportEnum.Align.Left, 100) + report.AddData("${Place}", record.Format(PersonalExtWorkTable.Place), ReportEnum.Align.Left, 100) + report.AddData("${BeginDate}", record.Format(PersonalExtWorkTable.BeginDate), ReportEnum.Align.Left, 100) + report.AddData("${EndDate}", record.Format(PersonalExtWorkTable.EndDate), ReportEnum.Align.Left, 100) + report.AddData("${Command}", record.Format(PersonalExtWorkTable.Command), ReportEnum.Align.Left, 100) + report.AddData("${CommandDate}", record.Format(PersonalExtWorkTable.CommandDate), ReportEnum.Align.Left, 100) + + report.WriteRow + Next + pageNum = pageNum + 1 + recordCount += records.Length + End If + Loop While Not (records Is Nothing) AndAlso recordCount < totalRows AndAlso whereClause.RunQuery + + report.Close + BaseClasses.Utils.NetUtils.WriteResponseBinaryAttachment(Me.Page.Response, report.Title + ".pdf", report.ReportInByteArray, 0, true) + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalExtWorkRefreshButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Dim PersonalExtWorkTableControlObj as PersonalExtWorkTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalExtWorkTableControl"), PersonalExtWorkTableControl) + PersonalExtWorkTableControlObj.ResetData = True + + PersonalExtWorkTableControlObj.RemoveFromSession(PersonalExtWorkTableControlObj, "DeletedRecordIds") + PersonalExtWorkTableControlObj.DeletedRecordIds = Nothing + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalExtWorkResetButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.DescriptionFilter.ClearSelection() + Me.PersonalIdFilter.ClearSelection() + Me.PersonalExtWorkSearch.Text = "" + Me.CurrentSortOrder.Reset() + If Me.InSession(Me, "Order_By") Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + + End If + + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalExtWorkWordButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + Dim report As WordReport = New WordReport + report.SpecificReportFileName = Page.Server.MapPath("ShowPersonalExtWorkTable.PersonalExtWorkWordButton.word") + ' report.Title replaces the value tag of page header and footer containing ${ReportTitle} + report.Title = "PersonalExtWork" + ' If ShowPersonalExtWorkTable.PersonalExtWorkWordButton.report specifies a valid report template, + ' AddColumn method will generate a report template. + ' Each AddColumn method-call specifies a column + ' The 1st parameter represents the text of the column header + ' The 2nd parameter represents the horizontal alignment of the column header + ' The 3rd parameter represents the text format of the column detail + ' The 4th parameter represents the horizontal alignment of the column detail + ' The 5th parameter represents the relative width of the column + report.AddColumn(PersonalExtWorkTable.PersonalId.Name, ReportEnum.Align.Left, "${PersonalId}", ReportEnum.Align.Left, 15) + report.AddColumn(PersonalExtWorkTable.Description.Name, ReportEnum.Align.Left, "${Description}", ReportEnum.Align.Left, 30) + report.AddColumn(PersonalExtWorkTable.Place.Name, ReportEnum.Align.Left, "${Place}", ReportEnum.Align.Left, 30) + report.AddColumn(PersonalExtWorkTable.BeginDate.Name, ReportEnum.Align.Left, "${BeginDate}", ReportEnum.Align.Left, 20) + report.AddColumn(PersonalExtWorkTable.EndDate.Name, ReportEnum.Align.Left, "${EndDate}", ReportEnum.Align.Left, 20) + report.AddColumn(PersonalExtWorkTable.Command.Name, ReportEnum.Align.Left, "${Command}", ReportEnum.Align.Left, 30) + report.AddColumn(PersonalExtWorkTable.CommandDate.Name, ReportEnum.Align.Left, "${CommandDate}", ReportEnum.Align.Left, 20) + + Dim whereClause As WhereClause = CreateWhereClause + + Dim orderBy As OrderBy = CreateOrderBy + Dim joinFilter As BaseFilter = CreateCompoundJoinFilter() + + Dim rowsPerQuery As Integer = 5000 + Dim pageNum As Integer = 0 + Dim recordCount As Integer = 0 + Dim totalRows As Integer = PersonalExtWorkTable.GetRecordCount(joinFilter,whereClause) + + report.Page = Page.GetResourceValue("Txt:Page", "Persons") + report.ApplicationPath = Me.Page.MapPath(Page.Request.ApplicationPath) + + Dim columns As ColumnList = PersonalExtWorkTable.GetColumnList() + Dim records As PersonalExtWorkRecord() = Nothing + Do + records = PersonalExtWorkTable.GetRecords(joinFilter,whereClause, orderBy, pageNum, rowsPerQuery) + + If Not (records Is Nothing) AndAlso records.Length > 0 AndAlso whereClause.RunQuery Then + For Each record As PersonalExtWorkRecord In records + ' AddData method takes four parameters + ' The 1st parameters represent the data format + ' The 2nd parameters represent the data value + ' The 3rd parameters represent the default alignment of column using the data + ' The 4th parameters represent the maximum length of the data value being shown + report.AddData("${PersonalId}", record.Format(PersonalExtWorkTable.PersonalId), ReportEnum.Align.Left, 100) + report.AddData("${Description}", record.Format(PersonalExtWorkTable.Description), ReportEnum.Align.Left, 100) + report.AddData("${Place}", record.Format(PersonalExtWorkTable.Place), ReportEnum.Align.Left, 100) + report.AddData("${BeginDate}", record.Format(PersonalExtWorkTable.BeginDate), ReportEnum.Align.Left, 100) + report.AddData("${EndDate}", record.Format(PersonalExtWorkTable.EndDate), ReportEnum.Align.Left, 100) + report.AddData("${Command}", record.Format(PersonalExtWorkTable.Command), ReportEnum.Align.Left, 100) + report.AddData("${CommandDate}", record.Format(PersonalExtWorkTable.CommandDate), ReportEnum.Align.Left, 100) + + report.WriteRow + Next + pageNum = pageNum + 1 + recordCount += records.Length + End If + Loop While Not (records Is Nothing) AndAlso recordCount < totalRows AndAlso whereClause.RunQuery + report.save + BaseClasses.Utils.NetUtils.WriteResponseBinaryAttachment(Me.Page.Response, report.Title + ".doc", report.ReportInByteArray, 0, true) + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for Button with Layout + Public Overridable Sub PersonalExtWorkSearchButton_Click(ByVal sender As Object, ByVal args As EventArgs) + + Try + + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + + + ' Generate the event handling functions for filter and search events. + + ' event handler for FieldFilter + Protected Overridable Sub DescriptionFilter_SelectedIndexChanged(ByVal sender As Object, ByVal args As EventArgs) + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + + End Sub + + ' event handler for FieldFilter + Protected Overridable Sub PersonalIdFilter_SelectedIndexChanged(ByVal sender As Object, ByVal args As EventArgs) + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + + End Sub + + + ' Generate the event handling functions for others + + + Private _UIData As New System.Collections.Generic.List(Of Hashtable) + Public Property UIData() As System.Collections.Generic.List(Of Hashtable) + Get + Return Me._UIData + End Get + Set(ByVal value As System.Collections.Generic.List(Of Hashtable)) + Me._UIData = value + End Set + End Property + + ' pagination properties + Protected _PageSize As Integer + Public Property PageSize() As Integer + Get + Return Me._PageSize + End Get + Set(ByVal value As Integer) + Me._PageSize = value + End Set + End Property + + Protected _PageIndex As Integer + Public Property PageIndex() As Integer + Get + ' Return the PageIndex + Return Me._PageIndex + End Get + Set(ByVal value As Integer) + Me._PageIndex = value + End Set + End Property + + Protected _TotalRecords As Integer = -1 + Public Property TotalRecords() As Integer + Get + If _TotalRecords < 0 + _TotalRecords = PersonalExtWorkTable.GetRecordCount(CreateCompoundJoinFilter(), CreateWhereClause()) + End If + Return Me._TotalRecords + End Get + Set(ByVal value As Integer) + If Me.PageSize > 0 Then + + Me.TotalPages = CInt(Math.Ceiling(value / Me.PageSize)) + + End If + Me._TotalRecords = value + End Set + End Property + + + + Protected _TotalPages As Integer = -1 + Public Property TotalPages() As Integer + Get + If _TotalPages < 0 Then + + Me.TotalPages = CInt(Math.Ceiling(TotalRecords / Me.PageSize)) + + End If + Return Me._TotalPages + End Get + Set(ByVal value As Integer) + Me._TotalPages = value + End Set + End Property + + Protected _DisplayLastPage As Boolean + Public Property DisplayLastPage() As Boolean + Get + Return Me._DisplayLastPage + End Get + Set(ByVal value As Boolean) + Me._DisplayLastPage = value + End Set + End Property + + Private _DataChanged As Boolean = False + Public Property DataChanged() As Boolean + Get + Return Me._DataChanged + End Get + Set(ByVal value As Boolean) + Me._DataChanged = value + End Set + End Property + + Private _ResetData As Boolean = False + Public Property ResetData() As Boolean + Get + Return Me._ResetData + End Get + Set(ByVal value As Boolean) + Me._ResetData = value + End Set + End Property + + Private _AddNewRecord As Integer = 0 + Public Property AddNewRecord() As Integer + Get + Return Me._AddNewRecord + End Get + Set(ByVal value As Integer) + Me._AddNewRecord = value + End Set + End Property + + + Private _CurrentSortOrder As OrderBy = Nothing + Public Property CurrentSortOrder() As OrderBy + Get + Return Me._CurrentSortOrder + End Get + Set(ByVal value As BaseClasses.Data.OrderBy) + Me._CurrentSortOrder = value + End Set + End Property + + Private _DataSource() As PersonalExtWorkRecord = Nothing + Public Property DataSource() As PersonalExtWorkRecord () + Get + Return Me._DataSource + End Get + Set(ByVal value() As PersonalExtWorkRecord) + Me._DataSource = value + End Set + End Property + +#Region "Helper Properties" + + Public ReadOnly Property BeginDateLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "BeginDateLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property CommandDateLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "CommandDateLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property CommandLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "CommandLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property DescriptionFilter() As System.Web.UI.WebControls.DropDownList + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "DescriptionFilter"), System.Web.UI.WebControls.DropDownList) + End Get + End Property + + Public ReadOnly Property DescriptionLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "DescriptionLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property DescriptionLabel1() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "DescriptionLabel1"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property EndDateLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "EndDateLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property PersonalExtWorkCopyButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalExtWorkCopyButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalExtWorkDeleteButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalExtWorkDeleteButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalExtWorkEditButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalExtWorkEditButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalExtWorkExportCSVButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalExtWorkExportCSVButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalExtWorkExportExcelButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalExtWorkExportExcelButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalExtWorkImportButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalExtWorkImportButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalExtWorkNewButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalExtWorkNewButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalExtWorkPagination() As Persons.UI.IPagination + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalExtWorkPagination"), Persons.UI.IPagination) + End Get + End Property + + Public ReadOnly Property PersonalExtWorkPDFButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalExtWorkPDFButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalExtWorkRefreshButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalExtWorkRefreshButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalExtWorkResetButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalExtWorkResetButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalExtWorkSearch() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalExtWorkSearch"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property PersonalExtWorkSearchButton() As Persons.UI.IThemeButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalExtWorkSearchButton"), Persons.UI.IThemeButton) + End Get + End Property + + Public ReadOnly Property PersonalExtWorkTableControlCollapsibleRegion() As System.Web.UI.WebControls.Panel + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalExtWorkTableControlCollapsibleRegion"), System.Web.UI.WebControls.Panel) + End Get + End Property + + Public ReadOnly Property PersonalExtWorkTableControlIcon() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalExtWorkTableControlIcon"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalExtWorkTableControlPanelExtender() As AjaxControlToolkit.CollapsiblePanelExtender + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalExtWorkTableControlPanelExtender"), AjaxControlToolkit.CollapsiblePanelExtender) + End Get + End Property + + Public ReadOnly Property PersonalExtWorkTitle() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalExtWorkTitle"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property PersonalExtWorkToggleAll() As System.Web.UI.WebControls.CheckBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalExtWorkToggleAll"), System.Web.UI.WebControls.CheckBox) + End Get + End Property + + Public ReadOnly Property PersonalExtWorkWordButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalExtWorkWordButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalIdFilter() As System.Web.UI.WebControls.DropDownList + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalIdFilter"), System.Web.UI.WebControls.DropDownList) + End Get + End Property + + Public ReadOnly Property PersonalIdLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalIdLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property PersonalIdLabel1() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalIdLabel1"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property PlaceLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PlaceLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + +#End Region + +#Region "Helper Functions" + + Public Overrides Overloads Function ModifyRedirectUrl(url As String, arg As String, ByVal bEncrypt As Boolean) As String + Return Me.Page.EvaluateExpressions(url, arg, bEncrypt, Me) + End Function + + Public Overrides Overloads Function EvaluateExpressions(url As String, arg As String, ByVal bEncrypt As Boolean) As String + Dim needToProcess As Boolean = AreAnyUrlParametersForMe(url, arg) + If (needToProcess) Then + Dim recCtl As PersonalExtWorkTableControlRow = Me.GetSelectedRecordControl() + If recCtl Is Nothing AndAlso url.IndexOf("{") >= 0 Then + ' Localization. + Throw New Exception(Page.GetResourceValue("Err:NoRecSelected", "Persons")) + End If + Dim rec As PersonalExtWorkRecord = Nothing + If recCtl IsNot Nothing Then + rec = recCtl.GetRecord() + End If + Return EvaluateExpressions(url, arg, rec, bEncrypt) + End If + Return url + End Function + + Public Overridable Function GetSelectedRecordIndex() As Integer + Dim counter As Integer = 0 + Dim recControl As PersonalExtWorkTableControlRow + For Each recControl In Me.GetRecordControls() + If recControl.PersonalExtWorkRecordRowSelection.Checked Then + Return counter + End If + counter += 1 + Next + Return -1 + End Function + + Public Overridable Function GetSelectedRecordControl() As PersonalExtWorkTableControlRow + Dim selectedList() As PersonalExtWorkTableControlRow = Me.GetSelectedRecordControls() + If selectedList.Length = 0 Then + Return Nothing + End If + Return selectedList(0) + + End Function + + Public Overridable Function GetSelectedRecordControls() As PersonalExtWorkTableControlRow() + + Dim selectedList As ArrayList = New ArrayList(25) + Dim recControl As PersonalExtWorkTableControlRow + For Each recControl In Me.GetRecordControls() + If recControl.PersonalExtWorkRecordRowSelection IsNot Nothing AndAlso recControl.PersonalExtWorkRecordRowSelection.Checked Then + selectedList.Add(recControl) + End If + Next + Return DirectCast(selectedList.ToArray(GetType(PersonalExtWorkTableControlRow)), PersonalExtWorkTableControlRow()) + + End Function + + Public Overridable Sub DeleteSelectedRecords(ByVal deferDeletion As Boolean) + Dim recList() As PersonalExtWorkTableControlRow = Me.GetSelectedRecordControls() + If recList.Length = 0 Then + ' Localization. + Throw New Exception(Page.GetResourceValue("Err:NoRecSelected", "Persons")) + End If + + Dim recCtl As PersonalExtWorkTableControlRow + For Each recCtl In recList + If deferDeletion Then + If Not recCtl.IsNewRecord Then + + Me.AddToDeletedRecordIds(recCtl) + + End If + recCtl.Visible = False + + recCtl.PersonalExtWorkRecordRowSelection.Checked = False + + Else + + recCtl.Delete() + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + End If + Next + End Sub + + Public Function GetRecordControls() As PersonalExtWorkTableControlRow() + Dim recList As ArrayList = New ArrayList() + Dim rep As System.Web.UI.WebControls.Repeater = CType(Me.FindControl("PersonalExtWorkTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return Nothing + Dim repItem As System.Web.UI.WebControls.RepeaterItem + + For Each repItem In rep.Items + + Dim recControl As PersonalExtWorkTableControlRow = DirectCast(repItem.FindControl("PersonalExtWorkTableControlRow"), PersonalExtWorkTableControlRow) + recList.Add(recControl) + + Next + + Return DirectCast(recList.ToArray(GetType(PersonalExtWorkTableControlRow)), PersonalExtWorkTableControlRow()) + 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 + + \ No newline at end of file diff --git a/App_Code/PersonalExtraSalary/EditPersonalExtraSalaryTable.Controls.vb b/App_Code/PersonalExtraSalary/EditPersonalExtraSalaryTable.Controls.vb new file mode 100644 index 0000000..1537ac8 --- /dev/null +++ b/App_Code/PersonalExtraSalary/EditPersonalExtraSalaryTable.Controls.vb @@ -0,0 +1,3171 @@ + +' This file implements the TableControl, TableControlRow, and RecordControl classes for the +' EditPersonalExtraSalaryTable.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.EditPersonalExtraSalaryTable + +#Region "Section 1: Place your customizations here." + + +Public Class PersonalExtraSalaryTableControlRow + Inherits BasePersonalExtraSalaryTableControlRow + ' The BasePersonalExtraSalaryTableControlRow implements code for a ROW within the + ' the PersonalExtraSalaryTableControl table. The BasePersonalExtraSalaryTableControlRow implements the DataBind and SaveData methods. + ' The loading of data is actually performed by the LoadData method in the base class of PersonalExtraSalaryTableControl. + + ' This is the ideal place to add your code customizations. For example, you can override the DataBind, + ' SaveData, GetUIData, and Validate methods. + Public Overrides Sub GetUIData() + + ' Call MyBase.GetUIData + MyBase.GetUIData() + + ' Get PersonalDD Record + Dim myRec As PersonalExtraSalaryRecord = Me.GetRecord + + ' Set PersonalId field value to new value string + myRec.PersonalId = Utils.SecurityControls.GetCurrentUserID + + End Sub + + +End Class + + + +Public Class PersonalExtraSalaryTableControl + Inherits BasePersonalExtraSalaryTableControl + + ' The BasePersonalExtraSalaryTableControl class implements the LoadData, DataBind, CreateWhereClause + ' and other methods to load and display the data in a table control. + + ' This is the ideal place to add your code customizations. You can override the LoadData and CreateWhereClause, + ' The PersonalExtraSalaryTableControlRow class offers another place where you can customize + ' the DataBind, GetUIData, SaveData and Validate methods specific to each row displayed on the table. + +End Class + + + +#End Region + + + +#Region "Section 2: Do not modify this section." + + +' Base class for the PersonalExtraSalaryTableControlRow control on the EditPersonalExtraSalaryTable page. +' Do not modify this class. Instead override any method in PersonalExtraSalaryTableControlRow. +Public Class BasePersonalExtraSalaryTableControlRow + Inherits Persons.UI.BaseApplicationRecordControl + + ' To customize, override this method in PersonalExtraSalaryTableControlRow. + Protected Overridable Sub Control_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Init + + Me.ClearControlsFromSession() + End Sub + + ' To customize, override this method in PersonalExtraSalaryTableControlRow. + Protected Overridable Sub Control_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load + + 'Call LoadFocusScripts from repeater so that onfocus attribute could be added to elements + Me.Page.LoadFocusScripts(Me) + + ' Show confirmation message on Click + Me.PersonalExtraSalaryRowDeleteButton.Attributes.Add("onClick", "return (confirm('" & (CType(Me.Page,BaseApplicationPage)).GetResourceValue("DeleteRecordConfirm", "Persons") & "'));") + + + ' Register the event handlers. + + AddHandler Me.PersonalExtraSalaryRowDeleteButton.Click, AddressOf PersonalExtraSalaryRowDeleteButton_Click + + AddHandler Me.ExtraSalaryId.SelectedIndexChanged, AddressOf ExtraSalaryId_SelectedIndexChanged + + AddHandler Me.PersonalId.SelectedIndexChanged, AddressOf PersonalId_SelectedIndexChanged + + AddHandler Me.Amout.TextChanged, AddressOf Amout_TextChanged + + AddHandler Me.Ref1.TextChanged, AddressOf Ref1_TextChanged + + AddHandler Me.RefDate.TextChanged, AddressOf RefDate_TextChanged + + AddHandler Me.StartDate.TextChanged, AddressOf StartDate_TextChanged + + + End Sub + + + Public Overridable Sub LoadData() + + ' Load the data from the database into the DataSource PersonalExtraSalary 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 = PersonalExtraSalaryTable.GetRecord(Me.RecordUniqueId, True) + + Return + End If + + ' Since this is a row in the table, the data for this row is loaded by the + ' LoadData method of the BasePersonalExtraSalaryTableControl when the data for the entire + ' table is loaded. + + Me.DataSource = New PersonalExtraSalaryRecord() + + + + End Sub + + ' Populate the UI controls using the DataSource. To customize, override this method in PersonalExtraSalaryTableControlRow. + 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 + + SetAmout() + SetExtraSalaryId() + + + SetPersonalId() + SetRef1() + SetRefDate() + SetStartDate() + + + Me.IsNewRecord = True + + If Me.DataSource.IsCreated Then + Me.IsNewRecord = False + + Me.RecordUniqueId = Me.DataSource.GetID.ToXmlString() + End If + + ' Now load data for each record and table child UI controls. + ' Ordering is important because child controls get + ' their parent ids from their parent UI controls. + Dim shouldResetControl As Boolean = False + + End Sub + + + Public Overridable Sub SetAmout() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.Amout.ID) Then + + Me.Amout.Text = Me.PreviousUIData(Me.Amout.ID).ToString() + + Return + End If + + + ' Set the Amout TextBox on the webpage with value from the + ' PersonalExtraSalary database record. + + ' Me.DataSource is the PersonalExtraSalary record retrieved from the database. + ' Me.Amout is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetAmout() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.AmoutSpecified Then + + ' If the Amout is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalExtraSalaryTable.Amout) + + Me.Amout.Text = formattedValue + + Else + + ' Amout is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.Amout.Text = PersonalExtraSalaryTable.Amout.Format(PersonalExtraSalaryTable.Amout.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetExtraSalaryId() + + ' If selection was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.ExtraSalaryId.ID) Then + If Me.PreviousUIData(Me.ExtraSalaryId.ID) Is Nothing + Me.PopulateExtraSalaryIdDropDownList(Nothing, 100) + Else + Me.PopulateExtraSalaryIdDropDownList(Me.PreviousUIData(Me.ExtraSalaryId.ID).ToString(), 100) + End If + Return + End If + + + ' Set the ExtraSalaryId DropDownList on the webpage with value from the + ' PersonalExtraSalary database record. + + ' Me.DataSource is the PersonalExtraSalary record retrieved from the database. + ' Me.ExtraSalaryId is the ASP:DropDownList on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetExtraSalaryId() + ' and add your own code before or after the call to the MyBase function. + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.ExtraSalaryIdSpecified Then + + ' If the ExtraSalaryId is non-NULL, then format the value. + ' The Format method will return the Display Foreign Key As (DFKA) value + Me.PopulateExtraSalaryIdDropDownList(Me.DataSource.ExtraSalaryId.ToString(), 100) + + Else + + ' ExtraSalaryId 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.PopulateExtraSalaryIdDropDownList(Nothing, 100) + Else + Me.PopulateExtraSalaryIdDropDownList(PersonalExtraSalaryTable.ExtraSalaryId.DefaultValue, 100) + End If + + End If + + End Sub + + Public Overridable Sub SetPersonalId() + + ' If selection was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.PersonalId.ID) Then + If Me.PreviousUIData(Me.PersonalId.ID) Is Nothing + Me.PopulatePersonalIdDropDownList(Nothing, 100) + Else + Me.PopulatePersonalIdDropDownList(Me.PreviousUIData(Me.PersonalId.ID).ToString(), 100) + End If + Return + End If + + + ' Set the PersonalId DropDownList on the webpage with value from the + ' PersonalExtraSalary database record. + + ' Me.DataSource is the PersonalExtraSalary record retrieved from the database. + ' Me.PersonalId is the ASP:DropDownList on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetPersonalId() + ' and add your own code before or after the call to the MyBase function. + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.PersonalIdSpecified Then + + ' If the PersonalId is non-NULL, then format the value. + ' The Format method will return the Display Foreign Key As (DFKA) value + Me.PopulatePersonalIdDropDownList(Me.DataSource.PersonalId, 100) + + Else + + ' PersonalId 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.PopulatePersonalIdDropDownList(Nothing, 100) + Else + Me.PopulatePersonalIdDropDownList(PersonalExtraSalaryTable.PersonalId.DefaultValue, 100) + End If + + End If + + End Sub + + Public Overridable Sub SetRef1() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.Ref1.ID) Then + + Me.Ref1.Text = Me.PreviousUIData(Me.Ref1.ID).ToString() + + Return + End If + + + ' Set the Ref TextBox on the webpage with value from the + ' PersonalExtraSalary database record. + + ' Me.DataSource is the PersonalExtraSalary 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(PersonalExtraSalaryTable.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 = PersonalExtraSalaryTable.Ref0.Format(PersonalExtraSalaryTable.Ref0.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetRefDate() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.RefDate.ID) Then + + Me.RefDate.Text = Me.PreviousUIData(Me.RefDate.ID).ToString() + + Return + End If + + + ' Set the RefDate TextBox on the webpage with value from the + ' PersonalExtraSalary database record. + + ' Me.DataSource is the PersonalExtraSalary 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(PersonalExtraSalaryTable.RefDate, "d MMM yyyy") + + 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 = PersonalExtraSalaryTable.RefDate.Format(PersonalExtraSalaryTable.RefDate.DefaultValue, "d MMM yyyy") + + End If + + End Sub + + Public Overridable Sub SetStartDate() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.StartDate.ID) Then + + Me.StartDate.Text = Me.PreviousUIData(Me.StartDate.ID).ToString() + + Return + End If + + + ' Set the StartDate TextBox on the webpage with value from the + ' PersonalExtraSalary database record. + + ' Me.DataSource is the PersonalExtraSalary record retrieved from the database. + ' Me.StartDate is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetStartDate() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.StartDateSpecified Then + + ' If the StartDate is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalExtraSalaryTable.StartDate, "d MMM yyyy") + + Me.StartDate.Text = formattedValue + + Else + + ' StartDate is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.StartDate.Text = PersonalExtraSalaryTable.StartDate.Format(PersonalExtraSalaryTable.StartDate.DefaultValue, "d MMM yyyy") + + End If + + End Sub + + + Public EvaluateFormulaDelegate As BaseClasses.Data.DataSource.EvaluateFormulaDelegate = New BaseClasses.Data.DataSource.EvaluateFormulaDelegate(AddressOf Me.EvaluateFormula) + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean, ByVal e As FormulaEvaluator) As String + If e Is Nothing Then + e = New FormulaEvaluator() + End If + + e.Variables.Clear() + + + ' add variables for formula evaluation + If variables IsNot Nothing Then + Dim enumerator As System.Collections.Generic.IEnumerator(Of System.Collections.Generic.KeyValuePair(Of String, Object)) = variables.GetEnumerator() + While enumerator.MoveNext() + e.Variables.Add(enumerator.Current.Key, enumerator.Current.Value) + End While + End If + + If includeDS + + End IF + + + ' Other variables referred to in the formula are expected to be + ' properties of the DataSource. For example, referring to + ' UnitPrice as a variable will refer to DataSource.UnitPrice + If dataSourceForEvaluate Is Nothing Then + + e.DataSource = Me.DataSource + + Else + e.DataSource = dataSourceForEvaluate + End If + + ' Define the calling control. This is used to add other + ' related table and record controls as variables. + e.CallingControl = Me + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + + If Not String.IsNullOrEmpty(format) AndAlso (String.IsNullOrEmpty(formula) OrElse formula.IndexOf("Format(") < 0) Then + Return FormulaUtils.Format(resultObj, format) + Else + Return resultObj.ToString() + End If + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format,variables ,includeDS, Nothing) + End Function + + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object)) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format, variables ,True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, format, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal e as FormulaEvaluator) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, variables, True, e) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal includeDS as Boolean) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, includeDS, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, True, Nothing) + End Function + + + Public Overridable Sub RegisterPostback() + + + End Sub + + + + ' To customize, override this method in PersonalExtraSalaryTableControlRow. + Public Overridable Sub SaveData() + ' Saves the associated record in the database. + ' SaveData calls Validate and Get methods - so it may be more appropriate to + ' customize those methods. + + ' 1. Load the existing record from the database. Since we save the entire record, this ensures + ' that fields that are not displayed are also properly initialized. + Me.LoadData() + + + ' 2. Perform any custom validation. + Me.Validate() + + + ' 3. Set the values in the record with data from UI controls. + ' This calls the Get() method for each of the user interface controls. + Me.GetUIData() + + ' 4. Save in the database. + ' We should not save the record if the data did not change. This + ' will save a database hit and avoid triggering any database triggers. + + If Me.DataSource.IsAnyValueChanged Then + ' Save record to database but do not commit yet. + ' Auto generated ids are available after saving for use by child (dependent) records. + Me.DataSource.Save() + + DirectCast(GetParentControlObject(Me, "PersonalExtraSalaryTableControl"), PersonalExtraSalaryTableControl).DataChanged = True + DirectCast(GetParentControlObject(Me, "PersonalExtraSalaryTableControl"), PersonalExtraSalaryTableControl).ResetData = True + End If + + + ' update session or cookie by formula + + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + ' For Master-Detail relationships, save data on the Detail table(s) + + End Sub + + ' To customize, override this method in PersonalExtraSalaryTableControlRow. + 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. + + GetAmout() + GetExtraSalaryId() + GetPersonalId() + GetRef1() + GetRefDate() + GetStartDate() + End Sub + + + Public Overridable Sub GetAmout() + + ' Retrieve the value entered by the user on the Amout ASP:TextBox, and + ' save it into the Amout field in DataSource PersonalExtraSalary record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.Amout.Text, PersonalExtraSalaryTable.Amout) + + + End Sub + + Public Overridable Sub GetExtraSalaryId() + + ' Retrieve the value entered by the user on the ExtraSalaryId ASP:DropDownList, and + ' save it into the ExtraSalaryId field in DataSource PersonalExtraSalary record. + + ' Custom validation should be performed in Validate, not here. + + Me.DataSource.Parse(GetValueSelectedPageRequest(Me.ExtraSalaryId), PersonalExtraSalaryTable.ExtraSalaryId) + + End Sub + + Public Overridable Sub GetPersonalId() + + ' Retrieve the value entered by the user on the PersonalId ASP:DropDownList, and + ' save it into the PersonalId field in DataSource PersonalExtraSalary record. + + ' Custom validation should be performed in Validate, not here. + + Me.DataSource.Parse(GetValueSelectedPageRequest(Me.PersonalId), PersonalExtraSalaryTable.PersonalId) + + 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 PersonalExtraSalary record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.Ref1.Text, PersonalExtraSalaryTable.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 PersonalExtraSalary 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, PersonalExtraSalaryTable.RefDate) + + + End Sub + + Public Overridable Sub GetStartDate() + + ' Retrieve the value entered by the user on the StartDate ASP:TextBox, and + ' save it into the StartDate field in DataSource PersonalExtraSalary 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.StartDate.Text, PersonalExtraSalaryTable.StartDate) + + + End Sub + + + ' To customize, override this method in PersonalExtraSalaryTableControlRow. + + Public Overridable Function CreateWhereClause() As WhereClause + + Return Nothing + + End Function + + + + ' To customize, override this method in PersonalExtraSalaryTableControlRow. + 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) + PersonalExtraSalaryTable.DeleteRecord(pkValue) + + DirectCast(GetParentControlObject(Me, "PersonalExtraSalaryTableControl"), PersonalExtraSalaryTableControl).DataChanged = True + DirectCast(GetParentControlObject(Me, "PersonalExtraSalaryTableControl"), PersonalExtraSalaryTableControl).ResetData = True + End Sub + + Protected Overridable Sub Control_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.PreRender + ' PreRender event is raised just before page is being displayed. + Try + DbUtils.StartTransaction() + Me.RegisterPostback() + + If Not Me.Page.ErrorOnPage AndAlso (Me.Page.IsPageRefresh OrElse Me.DataChanged OrElse Me.ResetData) Then + + + ' Re-load the data and update the web page if necessary. + ' This is typically done during a postback (filter, search button, sort, pagination button). + ' In each of the other click handlers, simply set DataChanged to True to reload the data. + Me.LoadData() + Me.DataBind() + End If + + + Catch ex As Exception + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + Finally + DbUtils.EndTransaction() + End Try + End Sub + + + Protected Overrides Sub SaveControlsToSession() + MyBase.SaveControlsToSession() + + + 'Save pagination state to session. + + End Sub + + + + Protected Overrides Sub ClearControlsFromSession() + MyBase.ClearControlsFromSession() + + + + ' Clear pagination state from session. + + End Sub + + Protected Overrides Sub LoadViewState(ByVal savedState As Object) + MyBase.LoadViewState(savedState) + Dim isNewRecord As String = CType(ViewState("IsNewRecord"), String) + If Not isNewRecord Is Nothing AndAlso isNewRecord.Trim <> "" Then + Me.IsNewRecord = Boolean.Parse(isNewRecord) + End If + + Dim myCheckSum As String = CType(ViewState("CheckSum"), String) + If Not myCheckSum Is Nothing AndAlso myCheckSum.Trim <> "" Then + Me.CheckSum = myCheckSum + End If + + + ' Load view state for pagination control. + + End Sub + + Protected Overrides Function SaveViewState() As Object + ViewState("IsNewRecord") = Me.IsNewRecord.ToString() + ViewState("CheckSum") = Me.CheckSum + + + ' Load view state for pagination control. + + Return MyBase.SaveViewState() + End Function + + + + Public Overridable Function CreateWhereClause_ExtraSalaryIdDropDownList() 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 ExTraSalary table. + ' Examples: + ' wc.iAND(ExTraSalaryTable.FullName, BaseFilter.ComparisonOperator.EqualsTo, "XYZ") + ' wc.iAND(ExTraSalaryTable.Active, BaseFilter.ComparisonOperator.EqualsTo, "1") + + Dim wc As WhereClause = New WhereClause() + Return wc + + End Function + + + + Public Overridable Function CreateWhereClause_PersonalIdDropDownList() 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 PersonalId table. + ' Examples: + ' wc.iAND(PersonalIdTable.PersonalName, BaseFilter.ComparisonOperator.EqualsTo, "XYZ") + ' wc.iAND(PersonalIdTable.Active, BaseFilter.ComparisonOperator.EqualsTo, "1") + + Dim wc As WhereClause = New WhereClause() + Return wc + + End Function + + + ' Fill the ExtraSalaryId list. + Protected Overridable Sub PopulateExtraSalaryIdDropDownList( _ + ByVal selectedValue As String, _ + ByVal maxItems As Integer) + + Me.ExtraSalaryId.Items.Clear() + + + ' 1. Setup the static list items + + ' Add the Please Select item. + Me.ExtraSalaryId.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_ExtraSalaryIdDropDownList function. + ' It is better to customize the where clause there. + + Dim wc As WhereClause = CreateWhereClause_ExtraSalaryIdDropDownList() + ' Create the ORDER BY clause to sort based on the displayed value. + + + Dim orderBy As OrderBy = New OrderBy(false, false) + orderBy.Add(ExTraSalaryTable.FullName, 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 ExTraSalaryRecord = 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 = ExTraSalaryTable.GetRecords(wc, orderBy, pageNum, maxItems) + For each itemValue As ExTraSalaryRecord In itemValues + ' Create the item and add to the list. + Dim cvalue As String = Nothing + Dim fvalue As String = Nothing + If itemValue.ExtraSalaryIdSpecified Then + cvalue = itemValue.ExtraSalaryId.ToString() + + If counter < maxItems AndAlso Me.ExtraSalaryId.Items.FindByValue(cvalue) Is Nothing Then + + Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalExtraSalaryTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalExtraSalaryTable.ExtraSalaryId) + If _isExpandableNonCompositeForeignKey AndAlso PersonalExtraSalaryTable.ExtraSalaryId.IsApplyDisplayAs Then + fvalue = PersonalExtraSalaryTable.GetDFKA(itemValue, PersonalExtraSalaryTable.ExtraSalaryId) + End If + If (Not _isExpandableNonCompositeForeignKey) Or (String.IsNullOrEmpty(fvalue)) Then + fvalue = itemValue.Format(ExTraSalaryTable.FullName) + 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.ExtraSalaryId.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.ExtraSalaryId.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.ExtraSalaryId, selectedValue) AndAlso _ + Not SetSelectedDisplayText(Me.ExtraSalaryId, selectedValue)Then + + ' construct a whereclause to query a record with ExTraSalary.ExtraSalaryId = selectedValue + Dim filter2 As CompoundFilter = New CompoundFilter(CompoundFilter.CompoundingOperators.And_Operator, Nothing) + Dim whereClause2 As WhereClause = New WhereClause() + filter2.AddFilter(New BaseClasses.Data.ColumnValueFilter(ExTraSalaryTable.ExtraSalaryId, selectedValue, BaseClasses.Data.BaseFilter.ComparisonOperator.EqualsTo, False)) + whereClause2.AddFilter(filter2, CompoundFilter.CompoundingOperators.And_Operator) + + Try + ' Execute the query + Dim rc() As ExTraSalaryRecord = ExTraSalaryTable.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 ExTraSalaryRecord = DirectCast(rc(0), ExTraSalaryRecord) + ' Create the item and add to the list. + Dim cvalue As String = Nothing + Dim fvalue As String = Nothing + If itemValue.ExtraSalaryIdSpecified Then + cvalue = itemValue.ExtraSalaryId.ToString() + Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalExtraSalaryTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalExtraSalaryTable.ExtraSalaryId) + If _isExpandableNonCompositeForeignKey AndAlso PersonalExtraSalaryTable.ExtraSalaryId.IsApplyDisplayAs Then + fvalue = PersonalExtraSalaryTable.GetDFKA(itemValue, PersonalExtraSalaryTable.ExtraSalaryId) + End If + If (Not _isExpandableNonCompositeForeignKey) Or (String.IsNullOrEmpty(fvalue)) Then + fvalue = itemValue.Format(ExTraSalaryTable.FullName) + End If + + If fvalue Is Nothing OrElse fvalue.Trim() = "" Then fvalue = cvalue + Dim newItem As New ListItem(fvalue, cvalue) + Me.ExtraSalaryId.Items.Add(newItem) + SetSelectedValue(Me.ExtraSalaryId, selectedValue) + End If + End If + Catch + End Try + + End If + + + End Sub + + ' Fill the PersonalId list. + Protected Overridable Sub PopulatePersonalIdDropDownList( _ + ByVal selectedValue As String, _ + ByVal maxItems As Integer) + + Me.PersonalId.Items.Clear() + + + ' 1. Setup the static list items + + ' Add the Please Select item. + Me.PersonalId.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_PersonalIdDropDownList function. + ' It is better to customize the where clause there. + + Dim wc As WhereClause = CreateWhereClause_PersonalIdDropDownList() + ' Create the ORDER BY clause to sort based on the displayed value. + + + Dim orderBy As OrderBy = New OrderBy(false, false) + orderBy.Add(PersonalIdTable.PersonalName, OrderByItem.OrderDir.Asc) + + Dim variables As System.Collections.Generic.IDictionary(Of String, Object) = New System.Collections.Generic.Dictionary(Of String, Object) + + ' 3. Read a total of maxItems from the database and insert them + Dim itemValues() As PersonalIdRecord = 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 = PersonalIdTable.GetRecords(wc, orderBy, pageNum, maxItems) + For each itemValue As PersonalIdRecord In itemValues + ' Create the item and add to the list. + Dim cvalue As String = Nothing + Dim fvalue As String = Nothing + If itemValue.PersonalIdSpecified Then + cvalue = itemValue.PersonalId.ToString() + + If counter < maxItems AndAlso Me.PersonalId.Items.FindByValue(cvalue) Is Nothing Then + + Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalExtraSalaryTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalExtraSalaryTable.PersonalId) + If _isExpandableNonCompositeForeignKey AndAlso PersonalExtraSalaryTable.PersonalId.IsApplyDisplayAs Then + fvalue = PersonalExtraSalaryTable.GetDFKA(itemValue, PersonalExtraSalaryTable.PersonalId) + End If + If (Not _isExpandableNonCompositeForeignKey) Or (String.IsNullOrEmpty(fvalue)) Then + fvalue = itemValue.Format(PersonalIdTable.PersonalName) + End If + + If fvalue Is Nothing OrElse fvalue.Trim() = "" Then fvalue = cvalue + + If (IsNothing(fvalue)) Then + fvalue = "" + End If + + fvalue = fvalue.Trim() + + If ( fvalue.Length > 50 ) Then + fvalue = fvalue.Substring(0, 50) & "..." + End If + + Dim dupItem As ListItem = Me.PersonalId.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.PersonalId.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.PersonalId, selectedValue) AndAlso _ + Not SetSelectedDisplayText(Me.PersonalId, selectedValue)Then + + ' construct a whereclause to query a record with PersonalId.PersonalId = selectedValue + Dim filter2 As CompoundFilter = New CompoundFilter(CompoundFilter.CompoundingOperators.And_Operator, Nothing) + Dim whereClause2 As WhereClause = New WhereClause() + filter2.AddFilter(New BaseClasses.Data.ColumnValueFilter(PersonalIdTable.PersonalId, selectedValue, BaseClasses.Data.BaseFilter.ComparisonOperator.EqualsTo, False)) + whereClause2.AddFilter(filter2, CompoundFilter.CompoundingOperators.And_Operator) + + Try + ' Execute the query + Dim rc() As PersonalIdRecord = PersonalIdTable.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 PersonalIdRecord = DirectCast(rc(0), PersonalIdRecord) + ' Create the item and add to the list. + Dim cvalue As String = Nothing + Dim fvalue As String = Nothing + If itemValue.PersonalIdSpecified Then + cvalue = itemValue.PersonalId.ToString() + Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalExtraSalaryTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalExtraSalaryTable.PersonalId) + If _isExpandableNonCompositeForeignKey AndAlso PersonalExtraSalaryTable.PersonalId.IsApplyDisplayAs Then + fvalue = PersonalExtraSalaryTable.GetDFKA(itemValue, PersonalExtraSalaryTable.PersonalId) + End If + If (Not _isExpandableNonCompositeForeignKey) Or (String.IsNullOrEmpty(fvalue)) Then + fvalue = itemValue.Format(PersonalIdTable.PersonalName) + End If + + If fvalue Is Nothing OrElse fvalue.Trim() = "" Then fvalue = cvalue + Dim newItem As New ListItem(fvalue, cvalue) + Me.PersonalId.Items.Add(newItem) + SetSelectedValue(Me.PersonalId, selectedValue) + End If + End If + Catch + End Try + + End If + + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalExtraSalaryRowDeleteButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + If(Not Me.Page.IsPageRefresh) Then + + Dim tc As PersonalExtraSalaryTableControl = DirectCast(GetParentControlObject(Me, "PersonalExtraSalaryTableControl"), PersonalExtraSalaryTableControl) + If Not (IsNothing(tc)) Then + If Not Me.IsNewRecord Then + tc.AddToDeletedRecordIds(DirectCast(Me, PersonalExtraSalaryTableControlRow)) + End If + Me.Visible = False + tc.SetFormulaControls() + End If + + End If + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + Protected Overridable Sub ExtraSalaryId_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()(ExtraSalaryId.ClientID & "_SelectedValue"), String) + Dim displayText As String = CType(Me.Page.Session()(ExtraSalaryId.ClientID & "_SelectedDisplayText"), String) + If displayText <> "" AndAlso val <> "" Then + Me.ExtraSalaryId.Items.Add(New ListItem(displayText, val)) + Me.ExtraSalaryId.SelectedIndex = Me.ExtraSalaryId.Items.Count - 1 + Me.Page.Session.Remove(ExtraSalaryId.ClientID & "_SelectedValue") + Me.Page.Session.Remove(ExtraSalaryId.ClientID & "_SelectedDisplayText") + End If + + + + + End Sub + + Protected Overridable Sub PersonalId_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()(PersonalId.ClientID & "_SelectedValue"), String) + Dim displayText As String = CType(Me.Page.Session()(PersonalId.ClientID & "_SelectedDisplayText"), String) + If displayText <> "" AndAlso val <> "" Then + Me.PersonalId.Items.Add(New ListItem(displayText, val)) + Me.PersonalId.SelectedIndex = Me.PersonalId.Items.Count - 1 + Me.Page.Session.Remove(PersonalId.ClientID & "_SelectedValue") + Me.Page.Session.Remove(PersonalId.ClientID & "_SelectedDisplayText") + End If + + + + + End Sub + + Protected Overridable Sub Amout_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 StartDate_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("BasePersonalExtraSalaryTableControlRow_Rec"), String) + End Get + Set(ByVal value As String) + Me.ViewState("BasePersonalExtraSalaryTableControlRow_Rec") = value + End Set + End Property + + Private _DataSource As PersonalExtraSalaryRecord + Public Property DataSource() As PersonalExtraSalaryRecord + Get + Return Me._DataSource + End Get + + Set(ByVal value As PersonalExtraSalaryRecord) + + Me._DataSource = value + End Set + End Property + + + + Private _checkSum As String + Public Overridable Property CheckSum() As String + Get + Return Me._checkSum + End Get + Set(ByVal value As String) + Me._checkSum = value + End Set + End Property + + Private _TotalPages As Integer + Public Property TotalPages() As Integer + Get + Return Me._TotalPages + End Get + Set(ByVal value As Integer) + Me._TotalPages = value + End Set + End Property + + Private _PageIndex As Integer + Public Property PageIndex() As Integer + Get + ' Return the PageIndex + Return Me._PageIndex + End Get + Set(ByVal value As Integer) + Me._PageIndex = value + End Set + End Property + + Private _DisplayLastPage As Boolean + Public Property DisplayLastPage() As Boolean + Get + Return Me._DisplayLastPage + End Get + Set(ByVal value As Boolean) + Me._DisplayLastPage = value + End Set + End Property + + + +#Region "Helper Properties" + + Public ReadOnly Property Amout() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Amout"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property ExtraSalaryId() As System.Web.UI.WebControls.DropDownList + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "ExtraSalaryId"), System.Web.UI.WebControls.DropDownList) + End Get + End Property + + Public ReadOnly Property PersonalExtraSalaryRecordRowSelection() As System.Web.UI.WebControls.CheckBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalExtraSalaryRecordRowSelection"), System.Web.UI.WebControls.CheckBox) + End Get + End Property + + Public ReadOnly Property PersonalExtraSalaryRowDeleteButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalExtraSalaryRowDeleteButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalId() As System.Web.UI.WebControls.DropDownList + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalId"), System.Web.UI.WebControls.DropDownList) + 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 StartDate() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "StartDate"), System.Web.UI.WebControls.TextBox) + 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 PersonalExtraSalaryRecord = 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 PersonalExtraSalaryRecord + If Not Me.DataSource Is Nothing Then + Return Me.DataSource + End If + + If Not Me.RecordUniqueId Is Nothing Then + + Return PersonalExtraSalaryTable.GetRecord(Me.RecordUniqueId, True) + + End If + + ' Localization. + + Throw New Exception(Page.GetResourceValue("Err:RetrieveRec", "Persons")) + + End Function + + Public Shadows ReadOnly Property Page() As BaseApplicationPage + Get + Return DirectCast(MyBase.Page, BaseApplicationPage) + End Get + End Property + +#End Region + +End Class + + + +' Base class for the PersonalExtraSalaryTableControl control on the EditPersonalExtraSalaryTable page. +' Do not modify this class. Instead override any method in PersonalExtraSalaryTableControl. +Public Class BasePersonalExtraSalaryTableControl + Inherits Persons.UI.BaseApplicationTableControl + + + + Protected Overridable Sub Control_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Init + + + + ' Setup the filter and search events. + + + + ' Control Initializations. + ' Initialize the table's current sort order. + + If Me.InSession(Me, "Order_By") Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + Me.CurrentSortOrder.Add(PersonalExtraSalaryTable.StartDate, OrderByItem.OrderDir.Asc) + + End If + + + + ' Setup default pagination settings. + + Me.PageSize = CInt(Me.GetFromSession(Me, "Page_Size", "10")) + Me.PageIndex = CInt(Me.GetFromSession(Me, "Page_Index", "0")) + + + + Me.ClearControlsFromSession() + End Sub + + Protected Overridable Sub Control_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load + + SaveControlsToSession_Ajax() + + ' Show confirmation message on Click + Me.PersonalExtraSalaryDeleteButton.Attributes.Add("onClick", "return (confirm('" & (CType(Me.Page,BaseApplicationPage)).GetResourceValue("DeleteConfirm", "Persons") & "'));") + + ' Setup the pagination events. + + AddHandler Me.PersonalExtraSalaryPagination.FirstPage.Click, AddressOf PersonalExtraSalaryPagination_FirstPage_Click + + AddHandler Me.PersonalExtraSalaryPagination.LastPage.Click, AddressOf PersonalExtraSalaryPagination_LastPage_Click + + AddHandler Me.PersonalExtraSalaryPagination.NextPage.Click, AddressOf PersonalExtraSalaryPagination_NextPage_Click + + AddHandler Me.PersonalExtraSalaryPagination.PageSizeButton.Click, AddressOf PersonalExtraSalaryPagination_PageSizeButton_Click + + AddHandler Me.PersonalExtraSalaryPagination.PreviousPage.Click, AddressOf PersonalExtraSalaryPagination_PreviousPage_Click + + + ' Setup the sorting events. + + AddHandler Me.AmoutLabel.Click, AddressOf AmoutLabel_Click + + AddHandler Me.ExtraSalaryIdLabel1.Click, AddressOf ExtraSalaryIdLabel1_Click + + AddHandler Me.RefDateLabel.Click, AddressOf RefDateLabel_Click + + AddHandler Me.RefLabel.Click, AddressOf RefLabel_Click + + AddHandler Me.StartDateLabel.Click, AddressOf StartDateLabel_Click + + ' Setup the button events. + + AddHandler Me.PersonalExtraSalaryAddButton.Click, AddressOf PersonalExtraSalaryAddButton_Click + + AddHandler Me.PersonalExtraSalaryDeleteButton.Click, AddressOf PersonalExtraSalaryDeleteButton_Click + + AddHandler Me.PersonalExtraSalaryEditButton.Click, AddressOf PersonalExtraSalaryEditButton_Click + + AddHandler Me.PersonalExtraSalaryRefreshButton.Click, AddressOf PersonalExtraSalaryRefreshButton_Click + + AddHandler Me.PersonalExtraSalaryResetButton.Click, AddressOf PersonalExtraSalaryResetButton_Click + + AddHandler Me.PersonalExtraSalarySaveButton.Click, AddressOf PersonalExtraSalarySaveButton_Click + + Me.PersonalExtraSalarySaveButton.Attributes.Add("onclick", "SubmitHRefOnce(this, """ & Me.Page.GetResourceValue("Txt:SaveRecord", "Persons") & """);") + + + ' Setup events for others + + End Sub + + + Public Overridable Sub LoadData() + + ' Read data from database. Returns an array of records that can be assigned + ' to the DataSource table control property. + Try + Dim joinFilter As CompoundFilter = CreateCompoundJoinFilter() + + ' The WHERE clause will be empty when displaying all records in table. + Dim wc As WhereClause = CreateWhereClause() + If wc IsNot Nothing AndAlso Not wc.RunQuery Then + ' Initialize an empty array of records + Dim alist As New ArrayList(0) + Me.DataSource = DirectCast(alist.ToArray(GetType(PersonalExtraSalaryRecord)), PersonalExtraSalaryRecord()) + ' Add records to the list if needed. + Me.AddNewRecords() + Me._TotalRecords = 0 + Me._TotalPages = 0 + Return + End If + + ' Call OrderBy to determine the order - either use the order defined + ' on the Query Wizard, or specified by user (by clicking on column heading) + Dim orderBy As OrderBy = CreateOrderBy() + + ' Get the pagesize from the pagesize control. + Me.GetPageSize() + + If Me.DisplayLastPage Then + Dim totalRecords As Integer = If(Me._TotalRecords < 0, PersonalExtraSalaryTable.GetRecordCount(CreateCompoundJoinFilter(), CreateWhereClause()), Me._TotalRecords) + + Dim totalPages As Integer = CInt(Math.Ceiling(totalRecords / Me.PageSize)) + + Me.PageIndex = totalPages - 1 + End If + + ' Make sure PageIndex (current page) and PageSize are within bounds. + If Me.PageIndex < 0 Then + Me.PageIndex = 0 + End If + If Me.PageSize < 1 Then + Me.PageSize = 1 + End If + + ' Retrieve the records and set the table DataSource. + ' Only PageSize records are fetched starting at PageIndex (zero based). + If Me.AddNewRecord > 0 Then + ' Make sure to preserve the previously entered data on new rows. + Dim postdata As New ArrayList + For Each rc As PersonalExtraSalaryTableControlRow In Me.GetRecordControls() + If Not rc.IsNewRecord Then + rc.DataSource = rc.GetRecord() + rc.GetUIData() + postdata.Add(rc.DataSource) + UIData.Add(rc.PreservedUIData()) + End If + Next + Me.DataSource = DirectCast(postdata.ToArray(GetType(PersonalExtraSalaryRecord)), PersonalExtraSalaryRecord()) + Else ' Get the records from the database + Me.DataSource = PersonalExtraSalaryTable.GetRecords(joinFilter, wc, orderBy, Me.PageIndex, Me.PageSize) + + End If + + ' if the datasource contains no records contained in database, then load the last page. + If (DbUtils.GetCreatedRecords(Me.DataSource).Length = 0 AndAlso Not Me.DisplayLastPage) Then + Me.DisplayLastPage = True + LoadData() + Else + + ' Add any new rows desired by the user. + Me.AddNewRecords() + + ' Turn off the ToggleAll checkbox + Me.PersonalExtraSalaryToggleAll.Checked = False + + + ' Initialize the page and grand totals. now + + End If + + Catch ex As Exception + ' Report the error message to the end user + Dim msg As String = ex.Message + If ex.InnerException IsNot Nothing Then + msg = msg & " InnerException: " & ex.InnerException.Message + End If + Throw New Exception(msg, ex.InnerException) + End Try + End Sub + + + + + Public Overrides Sub DataBind() + ' The DataBind method binds the user interface controls to the values + ' from the database record for each row in the table. To do this, it calls the + ' DataBind for each of the rows. + ' DataBind also populates any filters above the table, and sets the pagination + ' control to the correct number of records and the current page number. + + MyBase.DataBind() + + ' Make sure that the DataSource is initialized. + If Me.DataSource Is Nothing Then + Return + End If + + 'LoadData for DataSource for chart and report if they exist + + ' Improve performance by prefetching display as records. + Me.PreFetchForeignKeyValues() + + ' Setup the pagination controls. + BindPaginationControls() + + + + ' Bind the repeater with the list of records to expand the UI. + Dim rep As System.Web.UI.WebControls.Repeater = CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalExtraSalaryTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return + rep.DataSource = DataSource() + rep.DataBind() + + Dim index As Integer = 0 + For Each repItem As System.Web.UI.WebControls.RepeaterItem In rep.Items + ' Loop through all rows in the table, set its DataSource and call DataBind(). + Dim recControl As PersonalExtraSalaryTableControlRow = DirectCast(repItem.FindControl("PersonalExtraSalaryTableControlRow"), PersonalExtraSalaryTableControlRow) + recControl.DataSource = Me.DataSource(index) + If Me.UIData.Count > index Then + recControl.PreviousUIData = Me.UIData(index) + End If + recControl.DataBind() + recControl.Visible = Not Me.InDeletedRecordIds(recControl) + + index += 1 + Next + + + + + ' Call the Set methods for each controls on the panel + + SetAmoutLabel() + SetExtraSalaryIdLabel1() + + + + + + + + SetPersonalExtraSalaryTableControlCollapsibleRegion() + SetPersonalExtraSalaryTableControlIcon() + SetPersonalExtraSalaryTableControlPanelExtender() + + + SetRefDateLabel() + SetRefLabel() + SetStartDateLabel() + ' setting the state of expand or collapse alternative rows + + + ' Load data for each record and table UI control. + ' Ordering is important because child controls get + ' their parent ids from their parent UI controls. + + + ' this method calls the set method for controls with special formula like running total, sum, rank, etc + SetFormulaControls() + End Sub + + Public Overridable Sub SetFormulaControls() + ' this method calls Set methods for the control that has special formula + + + + End Sub + + + Public Sub PreFetchForeignKeyValues() + If (IsNothing(Me.DataSource)) + Return + End If + + Me.Page.PregetDfkaRecords(PersonalExtraSalaryTable.ExtraSalaryId, Me.DataSource) + + Me.Page.PregetDfkaRecords(PersonalExtraSalaryTable.PersonalId, Me.DataSource) + + End Sub + + + Public Overridable Sub RegisterPostback() + + Me.Page.RegisterPostBackTrigger(MiscUtils.FindControlRecursively(Me,"PersonalExtraSalarySaveButton")) + + + End Sub + + Public EvaluateFormulaDelegate As BaseClasses.Data.DataSource.EvaluateFormulaDelegate = New BaseClasses.Data.DataSource.EvaluateFormulaDelegate(AddressOf Me.EvaluateFormula) + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean, ByVal e as FormulaEvaluator) As String + If e Is Nothing + e = New FormulaEvaluator() + End If + + e.Variables.Clear() + + + ' add variables for formula evaluation + If variables IsNot Nothing Then + Dim enumerator As System.Collections.Generic.IEnumerator(Of System.Collections.Generic.KeyValuePair(Of String, Object)) = variables.GetEnumerator() + While enumerator.MoveNext() + e.Variables.Add(enumerator.Current.Key, enumerator.Current.Value) + End While + End If + + If includeDS + + End If + + ' All variables referred to in the formula are expected to be + ' properties of the DataSource. For example, referring to + ' UnitPrice as a variable will refer to DataSource.UnitPrice + e.DataSource = dataSourceForEvaluate + + ' Define the calling control. This is used to add other + ' related table and record controls as variables. + e.CallingControl = Me + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + + If Not String.IsNullOrEmpty(format) AndAlso (String.IsNullOrEmpty(formula) OrElse formula.IndexOf("Format(") < 0) Then + Return FormulaUtils.Format(resultObj, format) + Else + Return resultObj.ToString() + End If + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format,variables ,includeDS, Nothing) + End Function + + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object)) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format, variables ,True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, format, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal e as FormulaEvaluator) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, variables, True, e) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal includeDS as Boolean) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, includeDS, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, True, Nothing) + End Function + + + + + Public Overridable Sub ResetControl() + + Me.CurrentSortOrder.Reset() + If (Me.InSession(Me, "Order_By")) Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + Me.CurrentSortOrder.Add(PersonalExtraSalaryTable.StartDate, OrderByItem.OrderDir.Asc) + + End If + + Me.PageIndex = 0 + End Sub + + Protected Overridable Sub BindPaginationControls() + ' Setup the pagination controls. + + ' Bind the pagination labels. + + If DbUtils.GetCreatedRecords(Me.DataSource).Length > 0 Then + + Me.PersonalExtraSalaryPagination.CurrentPage.Text = (Me.PageIndex + 1).ToString() + Else + Me.PersonalExtraSalaryPagination.CurrentPage.Text = "0" + End If + Me.PersonalExtraSalaryPagination.PageSize.Text = Me.PageSize.ToString() + Me.PersonalExtraSalaryPagination.TotalItems.Text = Me.TotalRecords.ToString() + Me.PersonalExtraSalaryPagination.TotalPages.Text = Me.TotalPages.ToString() + + ' Bind the buttons for PersonalExtraSalaryTableControl pagination. + + Me.PersonalExtraSalaryPagination.FirstPage.Enabled = Not (Me.PageIndex = 0) + If Me._TotalPages < 0 Then ' if the total pages is not determined yet, enable last and next buttons + Me.PersonalExtraSalaryPagination.LastPage.Enabled = True + ElseIf Me._TotalPages = 0 ' if the total pages is determined and it is 0, enable last and next buttons + Me.PersonalExtraSalaryPagination.LastPage.Enabled = False + Else ' if the total pages is the last page, disable last and next buttons + Me.PersonalExtraSalaryPagination.LastPage.Enabled = Not (Me.PageIndex = Me.TotalPages - 1) + End If + + If Me._TotalPages < 0 Then ' if the total pages is not determined yet, enable last and next buttons + Me.PersonalExtraSalaryPagination.NextPage.Enabled = True + ElseIf Me._TotalPages = 0 ' if the total pages is determined and it is 0, enable last and next buttons + Me.PersonalExtraSalaryPagination.NextPage.Enabled = False + Else ' if the total pages is the last page, disable last and next buttons + Me.PersonalExtraSalaryPagination.NextPage.Enabled = Not (Me.PageIndex = Me.TotalPages - 1) + End If + + Me.PersonalExtraSalaryPagination.PreviousPage.Enabled = Not (Me.PageIndex = 0) + + + End Sub + + Public Overridable Sub SaveData() + ' Save the data from the entire table. Calls each row's Save Data + ' to save their data. This function is called by the Click handler of the + ' Save button. The button handler should Start/Commit/End a transaction. + + Dim recCtl As PersonalExtraSalaryTableControlRow + For Each recCtl In Me.GetRecordControls() + + If Me.InDeletedRecordIds(recCtl) Then + ' Delete any pending deletes. + recCtl.Delete() + Else + If recCtl.Visible Then + recCtl.SaveData() + End If + End If + + Next + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + ' Set IsNewRecord to False for all records - since everything has been saved and is no longer "new" + For Each recCtl In Me.GetRecordControls() + recCtl.IsNewRecord = False + Next + + + ' Set DeletedRecordsIds to Nothing since we have deleted all pending deletes. + Me.DeletedRecordIds = Nothing + + End Sub + + Public Overridable Function CreateCompoundJoinFilter() As CompoundFilter + Dim jFilter As CompoundFilter = New CompoundFilter() + + Return jFilter + + End Function + + + Public Overridable Function CreateOrderBy() As OrderBy + ' The CurrentSortOrder is initialized to the sort order on the + ' Query Wizard. It may be modified by the Click handler for any of + ' the column heading to sort or reverse sort by that column. + ' You can add your own sort order, or modify it on the Query Wizard. + Return Me.CurrentSortOrder + End Function + + Public Overridable Function CreateWhereClause() As WhereClause + 'This CreateWhereClause is used for loading the data. + PersonalExtraSalaryTable.Instance.InnerFilter = Nothing + Dim wc As WhereClause = New WhereClause() + + ' Compose the WHERE clause consiting of: + ' 1. Static clause defined at design time. + ' 2. User selected search criteria. + ' 3. User selected filter criteria. + + + ' Get the static clause defined at design time on the Table Panel Wizard + Dim qc As WhereClause = Me.CreateQueryClause() + If Not(IsNothing(qc)) Then + wc.iAND(qc) + End If + + Return wc + End Function + + + Public Overridable Function CreateWhereClause(ByVal searchText as String, ByVal fromSearchControl as String, ByVal AutoTypeAheadSearch as String, ByVal AutoTypeAheadWordSeparators as String) As WhereClause + ' This CreateWhereClause is used for loading list of suggestions for Auto Type-Ahead feature. + PersonalExtraSalaryTable.Instance.InnerFilter = Nothing + Dim wc As WhereClause = New WhereClause() + + ' Compose the WHERE clause consiting of: + ' 1. Static clause defined at design time. + ' 2. User selected search criteria. + ' 3. User selected filter criteria. + + Dim appRelativeVirtualPath As String = CType(HttpContext.Current.Session("AppRelativeVirtualPath"), String) + + ' Get the static clause defined at design time on the Table Panel Wizard + Dim qc As WhereClause = Me.CreateQueryClause() + If Not(IsNothing(qc)) Then + wc.iAND(qc) + End If + + ' Adds clauses if values are selected in Filter controls which are configured in the page. + + + Return wc + End Function + + Protected Overridable Function CreateQueryClause() As WhereClause + ' Create a where clause for the Static clause defined at design time. + Dim filter As CompoundFilter = New CompoundFilter(CompoundFilter.CompoundingOperators.And_Operator, Nothing) + Dim whereClause As WhereClause = New WhereClause() + + filter.AddFilter(New BaseClasses.Data.SignedInUserFilter(BaseClasses.Data.BaseTable.CreateInstance("Persons.Business.PersonalExtraSalaryTable, App_Code").TableDefinition.ColumnList.GetByUniqueName("PersonalExtraSalary_.PersonalId"), New BaseClasses.Data.IdentifierAliasInfo("PersonalExtraSalary_", Nothing), BaseClasses.Data.BaseFilter.ComparisonOperator.EqualsTo, False)) + + whereClause.AddFilter(filter, CompoundFilter.CompoundingOperators.And_Operator) + + Return whereClause + + End Function + + + Public Overridable Function FormatSuggestions(ByVal prefixText As String, ByVal resultItem As String, _ + ByVal columnLength As Integer, ByVal AutoTypeAheadDisplayFoundText As String, _ + ByVal autoTypeAheadSearch As String, ByVal AutoTypeAheadWordSeparators As String, _ + ByVal resultList As ArrayList) As Boolean + + 'Formats the resultItem and adds it to the list of suggestions. + Dim index As Integer = resultItem.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture).IndexOf(prefixText.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture)) + Dim itemToAdd As String = "" + Dim isFound As Boolean = False + Dim isAdded As Boolean = False + ' Get the index where prfixt is at the beginning of resultItem. If not found then, index of word which begins with prefixText. + If InvariantLCase(autoTypeAheadSearch).equals("wordsstartingwithsearchstring") And Not index = 0 Then + ' Expression to find word which contains AutoTypeAheadWordSeparators followed by prefixText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex( AutoTypeAheadWordSeparators + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + If regex1.IsMatch(resultItem) Then + index = regex1.Match(resultItem).Index + isFound = True + End If + ' If the prefixText is found immediatly after white space then starting of the word is found so don not search any further + If not resultItem(index).ToString() = " " Then + ' Expression to find beginning of the word which contains AutoTypeAheadWordSeparators followed by prefixText + Dim regex As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\\S*" + AutoTypeAheadWordSeparators + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + If regex.IsMatch(resultItem) Then + index = regex.Match(resultItem).Index + isFound = True + End If + End If + End If + + ' If autoTypeAheadSearch value is wordsstartingwithsearchstring then, extract the substring only if the prefixText is found at the + ' beginning of the resultItem (index = 0) or a word in resultItem is found starts with prefixText. + If index = 0 Or isFound Or InvariantLCase(autoTypeAheadSearch).Equals("anywhereinstring") then + If InvariantLCase(AutoTypeAheadDisplayFoundText).equals("atbeginningofmatchedstring") Then + ' Expression to find beginning of the word which contains prefixText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\\S*" + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + ' Find the beginning of the word which contains prefexText + If (StringUtils.InvariantLCase(autoTypeAheadSearch).Equals("anywhereinstring") AndAlso regex1.IsMatch(resultItem)) Then + index = regex1.Match(resultItem).Index + isFound = True + End If + ' Display string from the index till end of the string if sub string from index till end is less than columnLength value. + If Len(resultItem) - index <= columnLength Then + If index = 0 Then + itemToAdd = resultItem + Else + itemToAdd = "..." & resultItem.Substring(index, Len(resultItem) - index) + End If + Else + If index = 0 Then + itemToAdd = resultItem.Substring(index, (columnLength - 3)) & "..." + Else + 'Truncate the string to show only columnLength - 6 characters as begining and trailing "..." has to be appended. + itemToAdd = "..." & resultItem.Substring(index , columnLength - 6) & "..." + End If + End If + ElseIf InvariantLCase(AutoTypeAheadDisplayFoundText).equals("inmiddleofmatchedstring") Then + Dim subStringBeginIndex As Integer = CType(columnLength/2, Integer) + If Len(resultItem) <= columnLength Then + itemToAdd = resultItem + Else + ' Sanity check at end of the string + If index + Len(prefixText) = columnLength Then + itemToAdd = "..." & resultItem.Substring(index-columnLength,index) + ElseIf Len(resultItem) - index < subStringBeginIndex Then + ' Display string from the end till columnLength value if, index is closer to the end of the string. + itemToAdd = "..." & resultItem.Substring(Len(resultItem)-columnLength,Len(resultItem)) + ElseIf index <= subStringBeginIndex Then + ' Sanity chet at beginning of the string + itemToAdd = resultItem.Substring(0, columnLength) & "..." + Else + ' Display string containing text before the prefixText occures and text after the prefixText + itemToAdd = "..." & resultItem.Substring(index - subStringBeginIndex, columnLength) & "..." + End If + End If + ElseIf InvariantLCase(AutoTypeAheadDisplayFoundText).equals("atendofmatchedstring") Then + ' Expression to find ending of the word which contains prefexText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\s", System.Text.RegularExpressions.RegexOptions.IgnoreCase) + ' Find the ending of the word which contains prefexText + If regex1.IsMatch(resultItem, index + 1) Then + index = regex1.Match(resultItem, index + 1).Index + Else + ' If the word which contains prefexText is the last word in string, regex1.IsMatch returns false. + index = resultItem.Length + End If + If index > Len(resultItem) Then + index = Len(resultItem) + End If + ' If text from beginning of the string till index is less than columnLength value then, display string from the beginning till index. + If index <= columnLength Then + if index = Len(resultItem) Then 'Make decision to append "..." + itemToAdd = resultItem.Substring(0,index) + Else + itemToAdd = resultItem.Substring(0,index) & "..." + End If + Else + If index = Len(resultItem) Then + itemToAdd = "..." & resultItem.Substring(index - (columnLength - 3), (columnLength - 3)) + Else + 'Truncate the string to show only columnLength - 6 characters as begining and trailing "..." has to be appended. + itemToAdd = "..." & resultItem.Substring(index - (columnLength - 6), columnLength - 6) & "..." + End If + End If + End If + + ' Remove newline character from itemToAdd + Dim prefixTextIndex As Integer = itemToAdd.IndexOf(prefixText, StringComparison.CurrentCultureIgnoreCase) + ' If itemToAdd contains any newline after the search text then show text only till newline + Dim regex2 As System.Text.RegularExpressions.Regex = New System.Text.RegularExpressions.Regex("(" & vbCrLf & "|" & vbLf & ")", System.Text.RegularExpressions.RegexOptions.IgnoreCase) + Dim newLineIndexAfterPrefix As Integer = -1 + If regex2.IsMatch(itemToAdd, prefixTextIndex) Then + newLineIndexAfterPrefix = regex2.Match(itemToAdd, prefixTextIndex).Index + End If + If (newLineIndexAfterPrefix > -1) Then + If itemToAdd.EndsWith("...") Then + itemToAdd = (itemToAdd.Substring(0, newLineIndexAfterPrefix) + "...") + Else + itemToAdd = itemToAdd.Substring(0, newLineIndexAfterPrefix) + End If + End If + ' If itemToAdd contains any newline before search text then show text which comes after newline + Dim regex3 As System.Text.RegularExpressions.Regex = New System.Text.RegularExpressions.Regex("(" & vbCrLf & "|" & vbLf & ")", (System.Text.RegularExpressions.RegexOptions.IgnoreCase Or System.Text.RegularExpressions.RegexOptions.RightToLeft)) + Dim newLineIndexBeforePrefix As Integer = -1 + If regex3.IsMatch(itemToAdd, prefixTextIndex) Then + newLineIndexBeforePrefix = regex3.Match(itemToAdd, prefixTextIndex).Index + End If + If (newLineIndexBeforePrefix > -1) Then + If itemToAdd.StartsWith("...") Then + itemToAdd = ("..." + itemToAdd.Substring((newLineIndexBeforePrefix + regex3.Match(itemToAdd, prefixTextIndex).Length))) + Else + itemToAdd = itemToAdd.Substring((newLineIndexBeforePrefix + regex3.Match(itemToAdd, prefixTextIndex).Length)) + End If + End If + + If Not itemToAdd is nothing AndAlso Not resultList.Contains(itemToAdd) Then + + resultList.Add(itemToAdd) + + isAdded = true + End If + End If + Return isAdded + End Function + + + Protected Overridable Sub GetPageSize() + + If Me.PersonalExtraSalaryPagination.PageSize.Text.Trim <> "" Then + Try + 'Me.PageSize = Integer.Parse(Me.PersonalExtraSalaryPagination.PageSize.Text) + Catch ex As Exception + End Try + End If + End Sub + + Protected Overridable Sub AddNewRecords() + + Dim newRecordList As ArrayList = New ArrayList() + + Dim newUIDataList As System.Collections.Generic.List(Of Hashtable) = New System.Collections.Generic.List(Of Hashtable)() + + ' Loop though all the record controls and if the record control + ' does not have a unique record id set, then create a record + ' and add to the list. + If Not Me.ResetData Then + Dim rep As System.Web.UI.WebControls.Repeater = CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalExtraSalaryTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return + + Dim repItem As System.Web.UI.WebControls.RepeaterItem + For Each repItem In rep.Items + ' Loop through all rows in the table, set its DataSource and call DataBind(). + + Dim recControl As PersonalExtraSalaryTableControlRow = DirectCast(repItem.FindControl("PersonalExtraSalaryTableControlRow"), PersonalExtraSalaryTableControlRow) + + If recControl.Visible AndAlso recControl.IsNewRecord() Then + + Dim rec As PersonalExtraSalaryRecord = New PersonalExtraSalaryRecord() + + If recControl.Amout.Text <> "" Then + rec.Parse(recControl.Amout.Text, PersonalExtraSalaryTable.Amout) + End If + If MiscUtils.IsValueSelected(recControl.ExtraSalaryId) Then + rec.Parse(recControl.ExtraSalaryId.SelectedItem.Value, PersonalExtraSalaryTable.ExtraSalaryId) + End If + If MiscUtils.IsValueSelected(recControl.PersonalId) Then + rec.Parse(recControl.PersonalId.SelectedItem.Value, PersonalExtraSalaryTable.PersonalId) + End If + If recControl.Ref1.Text <> "" Then + rec.Parse(recControl.Ref1.Text, PersonalExtraSalaryTable.Ref0) + End If + If recControl.RefDate.Text <> "" Then + rec.Parse(recControl.RefDate.Text, PersonalExtraSalaryTable.RefDate) + End If + If recControl.StartDate.Text <> "" Then + rec.Parse(recControl.StartDate.Text, PersonalExtraSalaryTable.StartDate) + End If + newUIDataList.Add(recControl.PreservedUIData()) + newRecordList.Add(rec) + End If + Next + End If + + + ' Add any new record to the list. + Dim index As Integer = 0 + For index = 1 To Me.AddNewRecord + + newRecordList.Insert(0, New PersonalExtraSalaryRecord()) + newUIDataList.Insert(0, New Hashtable()) + + Next + Me.AddNewRecord = 0 + + ' Finally, add any new records to the DataSource. + If newRecordList.Count > 0 Then + + Dim finalList As ArrayList = New ArrayList(Me.DataSource) + finalList.InsertRange(0, newRecordList) + + Me.DataSource = DirectCast(finalList.ToArray(GetType(PersonalExtraSalaryRecord)), PersonalExtraSalaryRecord()) + + End If + + ' Add the existing UI data to this hash table + If newUIDataList.Count > 0 Then + Me.UIData.InsertRange(0, newUIDataList) + End If + + End Sub + + + Public Sub AddToDeletedRecordIds(ByVal rec As PersonalExtraSalaryTableControlRow) + If rec.IsNewRecord() Then + Return + End If + + If Not Me.DeletedRecordIds Is Nothing AndAlso Me.DeletedRecordIds.Trim <> "" Then + Me.DeletedRecordIds &= "," + End If + + Me.DeletedRecordIds &= "[" & rec.RecordUniqueId & "]" + End Sub + + Protected Overridable Function InDeletedRecordIds(ByVal rec As PersonalExtraSalaryTableControlRow) As Boolean + If Me.DeletedRecordIds Is Nothing OrElse Me.DeletedRecordIds.Trim = "" Then + Return False + End If + + Return Me.DeletedRecordIds.IndexOf("[" & rec.RecordUniqueId & "]") >= 0 + End Function + + Private _DeletedRecordIds As String + Public Property DeletedRecordIds() As String + Get + Return Me._DeletedRecordIds + End Get + Set(ByVal value As String) + Me._DeletedRecordIds = value + End Set + End Property + + + ' Create Set, WhereClause, and Populate Methods + + Public Overridable Sub SetAmoutLabel() + + End Sub + + Public Overridable Sub SetExtraSalaryIdLabel1() + + End Sub + + Public Overridable Sub SetPersonalExtraSalaryTableControlCollapsibleRegion() + + End Sub + + Public Overridable Sub SetPersonalExtraSalaryTableControlIcon() + + End Sub + + Public Overridable Sub SetPersonalExtraSalaryTableControlPanelExtender() + + End Sub + + Public Overridable Sub SetRefDateLabel() + + End Sub + + Public Overridable Sub SetRefLabel() + + End Sub + + Public Overridable Sub SetStartDateLabel() + + 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. + Dim added As Boolean = Me.AddNewRecord > 0 + Me.LoadData() + Me.DataBind() + + If added Then + Me.SetFocusToAddedRow() + End If + + End If + + + + Catch ex As Exception + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + Finally + DbUtils.EndTransaction + End Try + End Sub + + 'this function sets focus to the first editable element in the new added row in the editable table + Protected Overridable Sub SetFocusToAddedRow() + Dim rep As System.Web.UI.WebControls.Repeater = CType(Me.FindControl("PersonalExtraSalaryTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing OrElse rep.Items.Count = 0 Then Return + Dim repItem As System.Web.UI.WebControls.RepeaterItem + For Each repItem In rep.Items + 'Load scripts to table rows + Me.Page.LoadFocusScripts(repItem) + Dim recControl As PersonalExtraSalaryTableControlRow = DirectCast(repItem.FindControl("PersonalExtraSalaryTableControlRow"), PersonalExtraSalaryTableControlRow) + If recControl.IsNewRecord Then + For Each field As Control In recControl.Controls + If field.Visible AndAlso Me.Page.IsControlEditable(field, False) Then + 'set focus on the first editable field in the new row + field.Focus() + Dim updPan As UpdatePanel = DirectCast(Me.Page.FindControlRecursively("UpdatePanel1"), UpdatePanel) + If Not updPan Is Nothing Then updPan.Update() + Return + End If + Next + Return + End If + Next + End Sub + + + Protected Overrides Sub SaveControlsToSession() + MyBase.SaveControlsToSession() + + ' Save filter controls to values to session. + + + 'Save pagination state to session. + + + + ' Save table control properties to the session. + If Not Me.CurrentSortOrder Is Nothing Then + Me.SaveToSession(Me, "Order_By", Me.CurrentSortOrder.ToXmlString()) + End If + + Me.SaveToSession(Me, "Page_Index", Me.PageIndex.ToString()) + Me.SaveToSession(Me, "Page_Size", Me.PageSize.ToString()) + + Me.SaveToSession(Me, "DeletedRecordIds", Me.DeletedRecordIds) + + End Sub + + Protected Sub SaveControlsToSession_Ajax() + ' Save filter controls to values to session. + + HttpContext.Current.Session("AppRelativeVirtualPath") = Me.Page.AppRelativeVirtualPath + + End Sub + + Protected Overrides Sub ClearControlsFromSession() + MyBase.ClearControlsFromSession() + + ' Clear filter controls values from the session. + + + ' Clear pagination state from session. + + + + ' Clear table properties from the session. + Me.RemoveFromSession(Me, "Order_By") + Me.RemoveFromSession(Me, "Page_Index") + Me.RemoveFromSession(Me, "Page_Size") + + Me.RemoveFromSession(Me, "DeletedRecordIds") + + End Sub + + Protected Overrides Sub LoadViewState(ByVal savedState As Object) + MyBase.LoadViewState(savedState) + + Dim orderByStr As String = CType(ViewState("PersonalExtraSalaryTableControl_OrderBy"), String) + + If orderByStr IsNot Nothing AndAlso orderByStr.Trim <> "" Then + Me.CurrentSortOrder = BaseClasses.Data.OrderBy.FromXmlString(orderByStr) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + End If + + Dim pageIndex As String = CType(ViewState("Page_Index"), String) + If pageIndex IsNot Nothing Then + Me.PageIndex = CInt(pageIndex) + End If + + Dim pageSize As String = CType(ViewState("Page_Size"), String) + If Not pageSize Is Nothing Then + Me.PageSize = CInt(pageSize) + End If + + + + ' Load view state for pagination control. + + Me.DeletedRecordIds = CType(Me.ViewState("DeletedRecordIds"), String) + + End Sub + + Protected Overrides Function SaveViewState() As Object + + If Me.CurrentSortOrder IsNot Nothing Then + Me.ViewState("PersonalExtraSalaryTableControl_OrderBy") = Me.CurrentSortOrder.ToXmlString() + End If + + Me.ViewState("Page_Index") = Me.PageIndex + Me.ViewState("Page_Size") = Me.PageSize + + Me.ViewState("DeletedRecordIds") = Me.DeletedRecordIds + + + ' Load view state for pagination control. + + + Return MyBase.SaveViewState() + End Function + + ' Generate the event handling functions for pagination events. + + ' event handler for ImageButton + Public Overridable Sub PersonalExtraSalaryPagination_FirstPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.PageIndex = 0 + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalExtraSalaryPagination_LastPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.DisplayLastPage = True + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalExtraSalaryPagination_NextPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.PageIndex += 1 + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for LinkButton + Public Overridable Sub PersonalExtraSalaryPagination_PageSizeButton_Click(ByVal sender As Object, ByVal args As EventArgs) + + Try + + Me.DataChanged = True + + Me.PageSize = Integer.Parse(Me.PersonalExtraSalaryPagination.PageSize.Text) + + Me.PageIndex = Integer.Parse(Me.PersonalExtraSalaryPagination.CurrentPage.Text) - 1 + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalExtraSalaryPagination_PreviousPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + If Me.PageIndex > 0 Then + Me.PageIndex -= 1 + Me.DataChanged = True + End If + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + + ' Generate the event handling functions for sorting events. + + Public Overridable Sub AmoutLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by Amout when clicked. + + ' Get previous sorting state for Amout. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalExtraSalaryTable.Amout) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for Amout. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalExtraSalaryTable.Amout, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by Amout, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub ExtraSalaryIdLabel1_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by ExtraSalaryId when clicked. + + ' Get previous sorting state for ExtraSalaryId. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalExtraSalaryTable.ExtraSalaryId) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for ExtraSalaryId. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalExtraSalaryTable.ExtraSalaryId, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by ExtraSalaryId, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub RefDateLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by RefDate when clicked. + + ' Get previous sorting state for RefDate. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalExtraSalaryTable.RefDate) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for RefDate. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalExtraSalaryTable.RefDate, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by RefDate, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub RefLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by Ref when clicked. + + ' Get previous sorting state for Ref. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalExtraSalaryTable.Ref0) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for Ref. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalExtraSalaryTable.Ref0, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by Ref, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub StartDateLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by StartDate when clicked. + + ' Get previous sorting state for StartDate. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalExtraSalaryTable.StartDate) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for StartDate. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalExtraSalaryTable.StartDate, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by StartDate, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + + ' Generate the event handling functions for button events. + + ' event handler for ImageButton + Public Overridable Sub PersonalExtraSalaryAddButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + Me.AddNewRecord = 1 + Me.DataChanged = True + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalExtraSalaryDeleteButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + If(Not Me.Page.IsPageRefresh) Then + + Me.DeleteSelectedRecords(True) + Me.SetFormulaControls() + + + End If + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalExtraSalaryEditButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + ' The redirect URL is set on the Properties, Custom Properties or Actions. + ' The ModifyRedirectURL call resolves the parameters before the + ' Response.Redirect redirects the page to the URL. + ' Any code after the Response.Redirect call will not be executed, since the page is + ' redirected to the URL. + + + Dim url As String = "../Shared/ConfigureEditRecord.aspx" + + Dim shouldRedirect As Boolean = True + Dim TargetKey As String = Nothing + Dim DFKA As String = TargetKey + Dim id As String = DFKA + Dim value As String = id + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + url = Me.ModifyRedirectUrl(url, "",False) + url = Me.Page.ModifyRedirectUrl(url, "",False) + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + shouldRedirect = False + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + If shouldRedirect Then + Me.Page.ShouldSaveControlsToSession = True + Me.Page.Response.Redirect(url) + ElseIf Not TargetKey Is Nothing AndAlso _ + Not shouldRedirect Then + Me.Page.ShouldSaveControlsToSession = True + Me.Page.CloseWindow(True) + + End If + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalExtraSalaryRefreshButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Dim PersonalExtraSalaryTableControlObj as PersonalExtraSalaryTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalExtraSalaryTableControl"), PersonalExtraSalaryTableControl) + PersonalExtraSalaryTableControlObj.ResetData = True + + PersonalExtraSalaryTableControlObj.RemoveFromSession(PersonalExtraSalaryTableControlObj, "DeletedRecordIds") + PersonalExtraSalaryTableControlObj.DeletedRecordIds = Nothing + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalExtraSalaryResetButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.CurrentSortOrder.Reset() + If Me.InSession(Me, "Order_By") Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + Me.CurrentSortOrder.Add(PersonalExtraSalaryTable.StartDate, OrderByItem.OrderDir.Asc) + + + End If + + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalExtraSalarySaveButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + + If (Not Me.Page.IsPageRefresh) Then + Me.SaveData() + End If + + Me.Page.CommitTransaction(sender) + ' Set IsNewRecord to False for all records - since everything has been saved and is no longer "new" + Dim recCtl As PersonalExtraSalaryTableControlRow + For Each recCtl in Me.GetRecordControls() + + recCtl.IsNewRecord = False + Next + + + ' Set DeletedRecordsIds to Nothing since we have deleted all pending deletes. + + Me.DeletedRecordIds = Nothing + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + + + ' Generate the event handling functions for filter and search events. + + + ' Generate the event handling functions for others + + + Private _UIData As New System.Collections.Generic.List(Of Hashtable) + Public Property UIData() As System.Collections.Generic.List(Of Hashtable) + Get + Return Me._UIData + End Get + Set(ByVal value As System.Collections.Generic.List(Of Hashtable)) + Me._UIData = value + End Set + End Property + + ' pagination properties + Protected _PageSize As Integer + Public Property PageSize() As Integer + Get + Return Me._PageSize + End Get + Set(ByVal value As Integer) + Me._PageSize = value + End Set + End Property + + Protected _PageIndex As Integer + Public Property PageIndex() As Integer + Get + ' Return the PageIndex + Return Me._PageIndex + End Get + Set(ByVal value As Integer) + Me._PageIndex = value + End Set + End Property + + Protected _TotalRecords As Integer = -1 + Public Property TotalRecords() As Integer + Get + If _TotalRecords < 0 + _TotalRecords = PersonalExtraSalaryTable.GetRecordCount(CreateCompoundJoinFilter(), CreateWhereClause()) + End If + Return Me._TotalRecords + End Get + Set(ByVal value As Integer) + If Me.PageSize > 0 Then + + Me.TotalPages = CInt(Math.Ceiling(value / Me.PageSize)) + + End If + Me._TotalRecords = value + End Set + End Property + + + + Protected _TotalPages As Integer = -1 + Public Property TotalPages() As Integer + Get + If _TotalPages < 0 Then + + Me.TotalPages = CInt(Math.Ceiling(TotalRecords / Me.PageSize)) + + End If + Return Me._TotalPages + End Get + Set(ByVal value As Integer) + Me._TotalPages = value + End Set + End Property + + Protected _DisplayLastPage As Boolean + Public Property DisplayLastPage() As Boolean + Get + Return Me._DisplayLastPage + End Get + Set(ByVal value As Boolean) + Me._DisplayLastPage = value + End Set + End Property + + Private _DataChanged As Boolean = False + Public Property DataChanged() As Boolean + Get + Return Me._DataChanged + End Get + Set(ByVal value As Boolean) + Me._DataChanged = value + End Set + End Property + + Private _ResetData As Boolean = False + Public Property ResetData() As Boolean + Get + Return Me._ResetData + End Get + Set(ByVal value As Boolean) + Me._ResetData = value + End Set + End Property + + Private _AddNewRecord As Integer = 0 + Public Property AddNewRecord() As Integer + Get + Return Me._AddNewRecord + End Get + Set(ByVal value As Integer) + Me._AddNewRecord = value + End Set + End Property + + + Private _CurrentSortOrder As OrderBy = Nothing + Public Property CurrentSortOrder() As OrderBy + Get + Return Me._CurrentSortOrder + End Get + Set(ByVal value As BaseClasses.Data.OrderBy) + Me._CurrentSortOrder = value + End Set + End Property + + Private _DataSource() As PersonalExtraSalaryRecord = Nothing + Public Property DataSource() As PersonalExtraSalaryRecord () + Get + Return Me._DataSource + End Get + Set(ByVal value() As PersonalExtraSalaryRecord) + Me._DataSource = value + End Set + End Property + +#Region "Helper Properties" + + Public ReadOnly Property AmoutLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "AmoutLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property ExtraSalaryIdLabel1() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "ExtraSalaryIdLabel1"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property PersonalExtraSalaryAddButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalExtraSalaryAddButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalExtraSalaryDeleteButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalExtraSalaryDeleteButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalExtraSalaryEditButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalExtraSalaryEditButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalExtraSalaryPagination() As Persons.UI.IPagination + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalExtraSalaryPagination"), Persons.UI.IPagination) + End Get + End Property + + Public ReadOnly Property PersonalExtraSalaryRefreshButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalExtraSalaryRefreshButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalExtraSalaryResetButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalExtraSalaryResetButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalExtraSalarySaveButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalExtraSalarySaveButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalExtraSalaryTableControlCollapsibleRegion() As System.Web.UI.WebControls.Panel + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalExtraSalaryTableControlCollapsibleRegion"), System.Web.UI.WebControls.Panel) + End Get + End Property + + Public ReadOnly Property PersonalExtraSalaryTableControlIcon() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalExtraSalaryTableControlIcon"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalExtraSalaryTableControlPanelExtender() As AjaxControlToolkit.CollapsiblePanelExtender + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalExtraSalaryTableControlPanelExtender"), AjaxControlToolkit.CollapsiblePanelExtender) + End Get + End Property + + Public ReadOnly Property PersonalExtraSalaryTitle() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalExtraSalaryTitle"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property PersonalExtraSalaryToggleAll() As System.Web.UI.WebControls.CheckBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalExtraSalaryToggleAll"), System.Web.UI.WebControls.CheckBox) + End Get + End Property + + Public ReadOnly Property RefDateLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RefDateLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property RefLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RefLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property StartDateLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "StartDateLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + +#End Region + +#Region "Helper Functions" + + Public Overrides Overloads Function ModifyRedirectUrl(url As String, arg As String, ByVal bEncrypt As Boolean) As String + Return Me.Page.EvaluateExpressions(url, arg, bEncrypt, Me) + End Function + + Public Overrides Overloads Function EvaluateExpressions(url As String, arg As String, ByVal bEncrypt As Boolean) As String + Dim needToProcess As Boolean = AreAnyUrlParametersForMe(url, arg) + If (needToProcess) Then + Dim recCtl As PersonalExtraSalaryTableControlRow = Me.GetSelectedRecordControl() + If recCtl Is Nothing AndAlso url.IndexOf("{") >= 0 Then + ' Localization. + Throw New Exception(Page.GetResourceValue("Err:NoRecSelected", "Persons")) + End If + Dim rec As PersonalExtraSalaryRecord = Nothing + If recCtl IsNot Nothing Then + rec = recCtl.GetRecord() + End If + Return EvaluateExpressions(url, arg, rec, bEncrypt) + End If + Return url + End Function + + Public Overridable Function GetSelectedRecordIndex() As Integer + Dim counter As Integer = 0 + Dim recControl As PersonalExtraSalaryTableControlRow + For Each recControl In Me.GetRecordControls() + If recControl.PersonalExtraSalaryRecordRowSelection.Checked Then + Return counter + End If + counter += 1 + Next + Return -1 + End Function + + Public Overridable Function GetSelectedRecordControl() As PersonalExtraSalaryTableControlRow + Dim selectedList() As PersonalExtraSalaryTableControlRow = Me.GetSelectedRecordControls() + If selectedList.Length = 0 Then + Return Nothing + End If + Return selectedList(0) + + End Function + + Public Overridable Function GetSelectedRecordControls() As PersonalExtraSalaryTableControlRow() + + Dim selectedList As ArrayList = New ArrayList(25) + Dim recControl As PersonalExtraSalaryTableControlRow + For Each recControl In Me.GetRecordControls() + If recControl.PersonalExtraSalaryRecordRowSelection IsNot Nothing AndAlso recControl.PersonalExtraSalaryRecordRowSelection.Checked Then + selectedList.Add(recControl) + End If + Next + Return DirectCast(selectedList.ToArray(GetType(PersonalExtraSalaryTableControlRow)), PersonalExtraSalaryTableControlRow()) + + End Function + + Public Overridable Sub DeleteSelectedRecords(ByVal deferDeletion As Boolean) + Dim recList() As PersonalExtraSalaryTableControlRow = Me.GetSelectedRecordControls() + If recList.Length = 0 Then + ' Localization. + Throw New Exception(Page.GetResourceValue("Err:NoRecSelected", "Persons")) + End If + + Dim recCtl As PersonalExtraSalaryTableControlRow + For Each recCtl In recList + If deferDeletion Then + If Not recCtl.IsNewRecord Then + + Me.AddToDeletedRecordIds(recCtl) + + End If + recCtl.Visible = False + + recCtl.PersonalExtraSalaryRecordRowSelection.Checked = False + + Else + + recCtl.Delete() + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + End If + Next + End Sub + + Public Function GetRecordControls() As PersonalExtraSalaryTableControlRow() + Dim recList As ArrayList = New ArrayList() + Dim rep As System.Web.UI.WebControls.Repeater = CType(Me.FindControl("PersonalExtraSalaryTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return Nothing + Dim repItem As System.Web.UI.WebControls.RepeaterItem + + For Each repItem In rep.Items + + Dim recControl As PersonalExtraSalaryTableControlRow = DirectCast(repItem.FindControl("PersonalExtraSalaryTableControlRow"), PersonalExtraSalaryTableControlRow) + recList.Add(recControl) + + Next + + Return DirectCast(recList.ToArray(GetType(PersonalExtraSalaryTableControlRow)), PersonalExtraSalaryTableControlRow()) + 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 + + \ No newline at end of file diff --git a/App_Code/PersonalId/AddPersonalId.Controls.vb b/App_Code/PersonalId/AddPersonalId.Controls.vb new file mode 100644 index 0000000..dc83a8c --- /dev/null +++ b/App_Code/PersonalId/AddPersonalId.Controls.vb @@ -0,0 +1,46241 @@ + +' This file implements the TableControl, TableControlRow, and RecordControl classes for the +' AddPersonalId.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.AddPersonalId + +#Region "Section 1: Place your customizations here." + + +Public Class PersonalDailyJobTableControlRow + Inherits BasePersonalDailyJobTableControlRow + ' The BasePersonalDailyJobTableControlRow implements code for a ROW within the + ' the PersonalDailyJobTableControl table. The BasePersonalDailyJobTableControlRow implements the DataBind and SaveData methods. + ' The loading of data is actually performed by the LoadData method in the base class of PersonalDailyJobTableControl. + + ' This is the ideal place to add your code customizations. For example, you can override the DataBind, + ' SaveData, GetUIData, and Validate methods. + + +End Class + + + +Public Class PersonalDailyJobTableControl + Inherits BasePersonalDailyJobTableControl + + ' The BasePersonalDailyJobTableControl class implements the LoadData, DataBind, CreateWhereClause + ' and other methods to load and display the data in a table control. + + ' This is the ideal place to add your code customizations. You can override the LoadData and CreateWhereClause, + ' The PersonalDailyJobTableControlRow class offers another place where you can customize + ' the DataBind, GetUIData, SaveData and Validate methods specific to each row displayed on the table. + +End Class + + +Public Class PersonalDDTableControlRow + Inherits BasePersonalDDTableControlRow + ' The BasePersonalDDTableControlRow implements code for a ROW within the + ' the PersonalDDTableControl table. The BasePersonalDDTableControlRow implements the DataBind and SaveData methods. + ' The loading of data is actually performed by the LoadData method in the base class of PersonalDDTableControl. + + ' This is the ideal place to add your code customizations. For example, you can override the DataBind, + ' SaveData, GetUIData, and Validate methods. + + +End Class + + + +Public Class PersonalDDTableControl + Inherits BasePersonalDDTableControl + + ' The BasePersonalDDTableControl class implements the LoadData, DataBind, CreateWhereClause + ' and other methods to load and display the data in a table control. + + ' This is the ideal place to add your code customizations. You can override the LoadData and CreateWhereClause, + ' The PersonalDDTableControlRow class offers another place where you can customize + ' the DataBind, GetUIData, SaveData and Validate methods specific to each row displayed on the table. + +End Class + + +Public Class PersonalEducationTableControlRow + Inherits BasePersonalEducationTableControlRow + ' The BasePersonalEducationTableControlRow implements code for a ROW within the + ' the PersonalEducationTableControl table. The BasePersonalEducationTableControlRow implements the DataBind and SaveData methods. + ' The loading of data is actually performed by the LoadData method in the base class of PersonalEducationTableControl. + + ' This is the ideal place to add your code customizations. For example, you can override the DataBind, + ' SaveData, GetUIData, and Validate methods. + + +End Class + + + +Public Class PersonalEducationTableControl + Inherits BasePersonalEducationTableControl + + ' The BasePersonalEducationTableControl class implements the LoadData, DataBind, CreateWhereClause + ' and other methods to load and display the data in a table control. + + ' This is the ideal place to add your code customizations. You can override the LoadData and CreateWhereClause, + ' The PersonalEducationTableControlRow class offers another place where you can customize + ' the DataBind, GetUIData, SaveData and Validate methods specific to each row displayed on the table. + +End Class + + +Public Class PersonalExtWorkTableControlRow + Inherits BasePersonalExtWorkTableControlRow + ' The BasePersonalExtWorkTableControlRow implements code for a ROW within the + ' the PersonalExtWorkTableControl table. The BasePersonalExtWorkTableControlRow implements the DataBind and SaveData methods. + ' The loading of data is actually performed by the LoadData method in the base class of PersonalExtWorkTableControl. + + ' This is the ideal place to add your code customizations. For example, you can override the DataBind, + ' SaveData, GetUIData, and Validate methods. + + +End Class + + + +Public Class PersonalExtWorkTableControl + Inherits BasePersonalExtWorkTableControl + + ' The BasePersonalExtWorkTableControl class implements the LoadData, DataBind, CreateWhereClause + ' and other methods to load and display the data in a table control. + + ' This is the ideal place to add your code customizations. You can override the LoadData and CreateWhereClause, + ' The PersonalExtWorkTableControlRow class offers another place where you can customize + ' the DataBind, GetUIData, SaveData and Validate methods specific to each row displayed on the table. + +End Class + + +Public Class PersonalInsigniaTableControlRow + Inherits BasePersonalInsigniaTableControlRow + ' The BasePersonalInsigniaTableControlRow implements code for a ROW within the + ' the PersonalInsigniaTableControl table. The BasePersonalInsigniaTableControlRow implements the DataBind and SaveData methods. + ' The loading of data is actually performed by the LoadData method in the base class of PersonalInsigniaTableControl. + + ' This is the ideal place to add your code customizations. For example, you can override the DataBind, + ' SaveData, GetUIData, and Validate methods. + + +End Class + + + +Public Class PersonalInsigniaTableControl + Inherits BasePersonalInsigniaTableControl + + ' The BasePersonalInsigniaTableControl class implements the LoadData, DataBind, CreateWhereClause + ' and other methods to load and display the data in a table control. + + ' This is the ideal place to add your code customizations. You can override the LoadData and CreateWhereClause, + ' The PersonalInsigniaTableControlRow class offers another place where you can customize + ' the DataBind, GetUIData, SaveData and Validate methods specific to each row displayed on the table. + +End Class + + +Public Class PersonalLanguageSkillTableControlRow + Inherits BasePersonalLanguageSkillTableControlRow + ' The BasePersonalLanguageSkillTableControlRow implements code for a ROW within the + ' the PersonalLanguageSkillTableControl table. The BasePersonalLanguageSkillTableControlRow implements the DataBind and SaveData methods. + ' The loading of data is actually performed by the LoadData method in the base class of PersonalLanguageSkillTableControl. + + ' This is the ideal place to add your code customizations. For example, you can override the DataBind, + ' SaveData, GetUIData, and Validate methods. + + +End Class + + + +Public Class PersonalLanguageSkillTableControl + Inherits BasePersonalLanguageSkillTableControl + + ' The BasePersonalLanguageSkillTableControl class implements the LoadData, DataBind, CreateWhereClause + ' and other methods to load and display the data in a table control. + + ' This is the ideal place to add your code customizations. You can override the LoadData and CreateWhereClause, + ' The PersonalLanguageSkillTableControlRow class offers another place where you can customize + ' the DataBind, GetUIData, SaveData and Validate methods specific to each row displayed on the table. + +End Class + + +Public Class PersonalNameTableControlRow + Inherits BasePersonalNameTableControlRow + ' The BasePersonalNameTableControlRow implements code for a ROW within the + ' the PersonalNameTableControl table. The BasePersonalNameTableControlRow implements the DataBind and SaveData methods. + ' The loading of data is actually performed by the LoadData method in the base class of PersonalNameTableControl. + + ' This is the ideal place to add your code customizations. For example, you can override the DataBind, + ' SaveData, GetUIData, and Validate methods. + + +End Class + + + +Public Class PersonalNameTableControl + Inherits BasePersonalNameTableControl + + ' The BasePersonalNameTableControl class implements the LoadData, DataBind, CreateWhereClause + ' and other methods to load and display the data in a table control. + + ' This is the ideal place to add your code customizations. You can override the LoadData and CreateWhereClause, + ' The PersonalNameTableControlRow class offers another place where you can customize + ' the DataBind, GetUIData, SaveData and Validate methods specific to each row displayed on the table. + +End Class + + +Public Class PersonalRankTableControlRow + Inherits BasePersonalRankTableControlRow + ' The BasePersonalRankTableControlRow implements code for a ROW within the + ' the PersonalRankTableControl table. The BasePersonalRankTableControlRow implements the DataBind and SaveData methods. + ' The loading of data is actually performed by the LoadData method in the base class of PersonalRankTableControl. + + ' This is the ideal place to add your code customizations. For example, you can override the DataBind, + ' SaveData, GetUIData, and Validate methods. + + +End Class + + + +Public Class PersonalRankTableControl + Inherits BasePersonalRankTableControl + + ' The BasePersonalRankTableControl class implements the LoadData, DataBind, CreateWhereClause + ' and other methods to load and display the data in a table control. + + ' This is the ideal place to add your code customizations. You can override the LoadData and CreateWhereClause, + ' The PersonalRankTableControlRow class offers another place where you can customize + ' the DataBind, GetUIData, SaveData and Validate methods specific to each row displayed on the table. + +End Class + + +Public Class PersonalSalaryTableControlRow + Inherits BasePersonalSalaryTableControlRow + ' The BasePersonalSalaryTableControlRow implements code for a ROW within the + ' the PersonalSalaryTableControl table. The BasePersonalSalaryTableControlRow implements the DataBind and SaveData methods. + ' The loading of data is actually performed by the LoadData method in the base class of PersonalSalaryTableControl. + + ' This is the ideal place to add your code customizations. For example, you can override the DataBind, + ' SaveData, GetUIData, and Validate methods. + + +End Class + + + +Public Class PersonalSalaryTableControl + Inherits BasePersonalSalaryTableControl + + ' The BasePersonalSalaryTableControl class implements the LoadData, DataBind, CreateWhereClause + ' and other methods to load and display the data in a table control. + + ' This is the ideal place to add your code customizations. You can override the LoadData and CreateWhereClause, + ' The PersonalSalaryTableControlRow class offers another place where you can customize + ' the DataBind, GetUIData, SaveData and Validate methods specific to each row displayed on the table. + +End Class + + +Public Class PersonalSpecialSkillTableControlRow + Inherits BasePersonalSpecialSkillTableControlRow + ' The BasePersonalSpecialSkillTableControlRow implements code for a ROW within the + ' the PersonalSpecialSkillTableControl table. The BasePersonalSpecialSkillTableControlRow implements the DataBind and SaveData methods. + ' The loading of data is actually performed by the LoadData method in the base class of PersonalSpecialSkillTableControl. + + ' This is the ideal place to add your code customizations. For example, you can override the DataBind, + ' SaveData, GetUIData, and Validate methods. + + +End Class + + + +Public Class PersonalSpecialSkillTableControl + Inherits BasePersonalSpecialSkillTableControl + + ' The BasePersonalSpecialSkillTableControl class implements the LoadData, DataBind, CreateWhereClause + ' and other methods to load and display the data in a table control. + + ' This is the ideal place to add your code customizations. You can override the LoadData and CreateWhereClause, + ' The PersonalSpecialSkillTableControlRow class offers another place where you can customize + ' the DataBind, GetUIData, SaveData and Validate methods specific to each row displayed on the table. + +End Class + + +Public Class PersonalSportSkillTableControlRow + Inherits BasePersonalSportSkillTableControlRow + ' The BasePersonalSportSkillTableControlRow implements code for a ROW within the + ' the PersonalSportSkillTableControl table. The BasePersonalSportSkillTableControlRow implements the DataBind and SaveData methods. + ' The loading of data is actually performed by the LoadData method in the base class of PersonalSportSkillTableControl. + + ' This is the ideal place to add your code customizations. For example, you can override the DataBind, + ' SaveData, GetUIData, and Validate methods. + + +End Class + + + +Public Class PersonalSportSkillTableControl + Inherits BasePersonalSportSkillTableControl + + ' The BasePersonalSportSkillTableControl class implements the LoadData, DataBind, CreateWhereClause + ' and other methods to load and display the data in a table control. + + ' This is the ideal place to add your code customizations. You can override the LoadData and CreateWhereClause, + ' The PersonalSportSkillTableControlRow class offers another place where you can customize + ' the DataBind, GetUIData, SaveData and Validate methods specific to each row displayed on the table. + +End Class + + +Public Class PersonalTitleTableControlRow + Inherits BasePersonalTitleTableControlRow + ' The BasePersonalTitleTableControlRow implements code for a ROW within the + ' the PersonalTitleTableControl table. The BasePersonalTitleTableControlRow implements the DataBind and SaveData methods. + ' The loading of data is actually performed by the LoadData method in the base class of PersonalTitleTableControl. + + ' This is the ideal place to add your code customizations. For example, you can override the DataBind, + ' SaveData, GetUIData, and Validate methods. + + +End Class + + + +Public Class PersonalTitleTableControl + Inherits BasePersonalTitleTableControl + + ' The BasePersonalTitleTableControl class implements the LoadData, DataBind, CreateWhereClause + ' and other methods to load and display the data in a table control. + + ' This is the ideal place to add your code customizations. You can override the LoadData and CreateWhereClause, + ' The PersonalTitleTableControlRow class offers another place where you can customize + ' the DataBind, GetUIData, SaveData and Validate methods specific to each row displayed on the table. + +End Class + + +Public Class PersonRelativeTableControlRow + Inherits BasePersonRelativeTableControlRow + ' The BasePersonRelativeTableControlRow implements code for a ROW within the + ' the PersonRelativeTableControl table. The BasePersonRelativeTableControlRow implements the DataBind and SaveData methods. + ' The loading of data is actually performed by the LoadData method in the base class of PersonRelativeTableControl. + + ' This is the ideal place to add your code customizations. For example, you can override the DataBind, + ' SaveData, GetUIData, and Validate methods. + + +End Class + + + +Public Class PersonRelativeTableControl + Inherits BasePersonRelativeTableControl + + ' The BasePersonRelativeTableControl class implements the LoadData, DataBind, CreateWhereClause + ' and other methods to load and display the data in a table control. + + ' This is the ideal place to add your code customizations. You can override the LoadData and CreateWhereClause, + ' The PersonRelativeTableControlRow class offers another place where you can customize + ' the DataBind, GetUIData, SaveData and Validate methods specific to each row displayed on the table. + +End Class + + +Public Class ShowPersonalIdTableTableControlRow + Inherits BaseShowPersonalIdTableTableControlRow + ' The BaseShowPersonalIdTableTableControlRow implements code for a ROW within the + ' the ShowPersonalIdTableTableControl table. The BaseShowPersonalIdTableTableControlRow implements the DataBind and SaveData methods. + ' The loading of data is actually performed by the LoadData method in the base class of ShowPersonalIdTableTableControl. + + ' This is the ideal place to add your code customizations. For example, you can override the DataBind, + ' SaveData, GetUIData, and Validate methods. + + +End Class + + + +Public Class ShowPersonalIdTableTableControl + Inherits BaseShowPersonalIdTableTableControl + + ' The BaseShowPersonalIdTableTableControl class implements the LoadData, DataBind, CreateWhereClause + ' and other methods to load and display the data in a table control. + + ' This is the ideal place to add your code customizations. You can override the LoadData and CreateWhereClause, + ' The ShowPersonalIdTableTableControlRow class offers another place where you can customize + ' the DataBind, GetUIData, SaveData and Validate methods specific to each row displayed on the table. + +End Class + + +Public Class PersonalIdRecordControl + Inherits BasePersonalIdRecordControl + ' The BasePersonalIdRecordControl implements the LoadData, DataBind and other + ' methods to load and display the data in a table control. + + ' This is the ideal place to add your code customizations. For example, you can override the LoadData, + ' CreateWhereClause, DataBind, SaveData, GetUIData, and Validate methods. + + +End Class + + + +#End Region + + + +#Region "Section 2: Do not modify this section." + + +' Base class for the PersonalDailyJobTableControlRow control on the AddPersonalId page. +' Do not modify this class. Instead override any method in PersonalDailyJobTableControlRow. +Public Class BasePersonalDailyJobTableControlRow + Inherits Persons.UI.BaseApplicationRecordControl + + ' To customize, override this method in PersonalDailyJobTableControlRow. + Protected Overridable Sub Control_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Init + + Me.ClearControlsFromSession() + End Sub + + ' To customize, override this method in PersonalDailyJobTableControlRow. + Protected Overridable Sub Control_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load + + 'Call LoadFocusScripts from repeater so that onfocus attribute could be added to elements + Me.Page.LoadFocusScripts(Me) + + ' Show confirmation message on Click + Me.PersonalDailyJobRowDeleteButton.Attributes.Add("onClick", "return (confirm('" & (CType(Me.Page,BaseApplicationPage)).GetResourceValue("DeleteRecordConfirm", "Persons") & "'));") + + + ' Register the event handlers. + + AddHandler Me.PersonalDailyJobRowDeleteButton.Click, AddressOf PersonalDailyJobRowDeleteButton_Click + + AddHandler Me.AbsentId.SelectedIndexChanged, AddressOf AbsentId_SelectedIndexChanged + + AddHandler Me.Job.TextChanged, AddressOf Job_TextChanged + + AddHandler Me.JobDate.TextChanged, AddressOf JobDate_TextChanged + + AddHandler Me.Remark.TextChanged, AddressOf Remark_TextChanged + + + End Sub + + + Public Overridable Sub LoadData() + + ' Load the data from the database into the DataSource PersonalDailyJob 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 = PersonalDailyJobTable.GetRecord(Me.RecordUniqueId, True) + + Return + End If + + ' Since this is a row in the table, the data for this row is loaded by the + ' LoadData method of the BasePersonalDailyJobTableControl when the data for the entire + ' table is loaded. + + Me.DataSource = New PersonalDailyJobRecord() + + + + End Sub + + ' Populate the UI controls using the DataSource. To customize, override this method in PersonalDailyJobTableControlRow. + 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 + + SetAbsentId() + SetJob() + SetJobDate() + + + SetRemark() + + + 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 SetAbsentId() + + ' If selection was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.AbsentId.ID) Then + If Me.PreviousUIData(Me.AbsentId.ID) Is Nothing + Me.PopulateAbsentIdDropDownList(Nothing, 100) + Else + Me.PopulateAbsentIdDropDownList(Me.PreviousUIData(Me.AbsentId.ID).ToString(), 100) + End If + Return + End If + + + ' Set the AbsentId DropDownList on the webpage with value from the + ' PersonalDailyJob database record. + + ' Me.DataSource is the PersonalDailyJob record retrieved from the database. + ' Me.AbsentId is the ASP:DropDownList on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetAbsentId() + ' and add your own code before or after the call to the MyBase function. + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.AbsentIdSpecified Then + + ' If the AbsentId is non-NULL, then format the value. + ' The Format method will return the Display Foreign Key As (DFKA) value + Me.PopulateAbsentIdDropDownList(Me.DataSource.AbsentId.ToString(), 100) + + Else + + ' AbsentId 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.PopulateAbsentIdDropDownList(Nothing, 100) + Else + Me.PopulateAbsentIdDropDownList(PersonalDailyJobTable.AbsentId.DefaultValue, 100) + End If + + End If + + End Sub + + Public Overridable Sub SetJob() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.Job.ID) Then + + Me.Job.Text = Me.PreviousUIData(Me.Job.ID).ToString() + + Return + End If + + + ' Set the Job TextBox on the webpage with value from the + ' PersonalDailyJob database record. + + ' Me.DataSource is the PersonalDailyJob record retrieved from the database. + ' Me.Job is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetJob() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.JobSpecified Then + + ' If the Job is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalDailyJobTable.Job) + + Me.Job.Text = formattedValue + + Else + + ' Job is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.Job.Text = PersonalDailyJobTable.Job.Format(PersonalDailyJobTable.Job.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetJobDate() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.JobDate.ID) Then + + Me.JobDate.Text = Me.PreviousUIData(Me.JobDate.ID).ToString() + + Return + End If + + + ' Set the JobDate TextBox on the webpage with value from the + ' PersonalDailyJob database record. + + ' Me.DataSource is the PersonalDailyJob record retrieved from the database. + ' Me.JobDate is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetJobDate() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.JobDateSpecified Then + + ' If the JobDate is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalDailyJobTable.JobDate, "g") + + Me.JobDate.Text = formattedValue + + Else + + ' JobDate is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.JobDate.Text = PersonalDailyJobTable.JobDate.Format(PersonalDailyJobTable.JobDate.DefaultValue, "g") + + End If + + End Sub + + Public Overridable Sub SetRemark() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.Remark.ID) Then + + Me.Remark.Text = Me.PreviousUIData(Me.Remark.ID).ToString() + + Return + End If + + + ' Set the Remark TextBox on the webpage with value from the + ' PersonalDailyJob database record. + + ' Me.DataSource is the PersonalDailyJob record retrieved from the database. + ' Me.Remark is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetRemark() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.RemarkSpecified Then + + ' If the Remark is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalDailyJobTable.Remark) + + Me.Remark.Text = formattedValue + + Else + + ' Remark is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.Remark.Text = PersonalDailyJobTable.Remark.Format(PersonalDailyJobTable.Remark.DefaultValue) + + End If + + End Sub + + + Public EvaluateFormulaDelegate As BaseClasses.Data.DataSource.EvaluateFormulaDelegate = New BaseClasses.Data.DataSource.EvaluateFormulaDelegate(AddressOf Me.EvaluateFormula) + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean, ByVal e As FormulaEvaluator) As String + If e Is Nothing Then + e = New FormulaEvaluator() + End If + + e.Variables.Clear() + + + ' add variables for formula evaluation + If variables IsNot Nothing Then + Dim enumerator As System.Collections.Generic.IEnumerator(Of System.Collections.Generic.KeyValuePair(Of String, Object)) = variables.GetEnumerator() + While enumerator.MoveNext() + e.Variables.Add(enumerator.Current.Key, enumerator.Current.Value) + End While + End If + + If includeDS + + End IF + + + ' Other variables referred to in the formula are expected to be + ' properties of the DataSource. For example, referring to + ' UnitPrice as a variable will refer to DataSource.UnitPrice + If dataSourceForEvaluate Is Nothing Then + + e.DataSource = Me.DataSource + + Else + e.DataSource = dataSourceForEvaluate + End If + + ' Define the calling control. This is used to add other + ' related table and record controls as variables. + e.CallingControl = Me + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + + If Not String.IsNullOrEmpty(format) AndAlso (String.IsNullOrEmpty(formula) OrElse formula.IndexOf("Format(") < 0) Then + Return FormulaUtils.Format(resultObj, format) + Else + Return resultObj.ToString() + End If + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format,variables ,includeDS, Nothing) + End Function + + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object)) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format, variables ,True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, format, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal e as FormulaEvaluator) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, variables, True, e) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal includeDS as Boolean) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, includeDS, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, True, Nothing) + End Function + + + Public Overridable Sub RegisterPostback() + + + End Sub + + + + ' To customize, override this method in PersonalDailyJobTableControlRow. + 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 parentCtrl As PersonalIdRecordControl + + + parentCtrl = DirectCast(Me.Page.FindControlRecursively("PersonalIdRecordControl"), PersonalIdRecordControl) + + If (Not IsNothing(parentCtrl) AndAlso IsNothing(parentCtrl.DataSource)) + ' Load the record if it is not loaded yet. + parentCtrl.LoadData() + End If + If (IsNothing(parentCtrl) OrElse IsNothing(parentCtrl.DataSource)) + ' Get the error message from the application resource file. + Throw New Exception(Page.GetResourceValue("Err:NoParentRecId", "Persons")) + End If + + Me.DataSource.PersonalId = parentCtrl.DataSource.PersonalId + + ' 2. Perform any custom validation. + Me.Validate() + + + ' 3. Set the values in the record with data from UI controls. + ' This calls the Get() method for each of the user interface controls. + Me.GetUIData() + + ' 4. Save in the database. + ' We should not save the record if the data did not change. This + ' will save a database hit and avoid triggering any database triggers. + + If Me.DataSource.IsAnyValueChanged Then + ' Save record to database but do not commit yet. + ' Auto generated ids are available after saving for use by child (dependent) records. + Me.DataSource.Save() + + DirectCast(GetParentControlObject(Me, "PersonalDailyJobTableControl"), PersonalDailyJobTableControl).DataChanged = True + DirectCast(GetParentControlObject(Me, "PersonalDailyJobTableControl"), PersonalDailyJobTableControl).ResetData = True + End If + + + ' update session or cookie by formula + + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + ' For Master-Detail relationships, save data on the Detail table(s) + + End Sub + + ' To customize, override this method in PersonalDailyJobTableControlRow. + 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. + + GetAbsentId() + GetJob() + GetJobDate() + GetRemark() + End Sub + + + Public Overridable Sub GetAbsentId() + + ' Retrieve the value entered by the user on the AbsentId ASP:DropDownList, and + ' save it into the AbsentId field in DataSource PersonalDailyJob record. + + ' Custom validation should be performed in Validate, not here. + + Me.DataSource.Parse(GetValueSelectedPageRequest(Me.AbsentId), PersonalDailyJobTable.AbsentId) + + End Sub + + Public Overridable Sub GetJob() + + ' Retrieve the value entered by the user on the Job ASP:TextBox, and + ' save it into the Job field in DataSource PersonalDailyJob record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.Job.Text, PersonalDailyJobTable.Job) + + + End Sub + + Public Overridable Sub GetJobDate() + + ' Retrieve the value entered by the user on the JobDate ASP:TextBox, and + ' save it into the JobDate field in DataSource PersonalDailyJob 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.JobDate.Text, PersonalDailyJobTable.JobDate) + + + End Sub + + Public Overridable Sub GetRemark() + + ' Retrieve the value entered by the user on the Remark ASP:TextBox, and + ' save it into the Remark field in DataSource PersonalDailyJob record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.Remark.Text, PersonalDailyJobTable.Remark) + + + End Sub + + + ' To customize, override this method in PersonalDailyJobTableControlRow. + + Public Overridable Function CreateWhereClause() As WhereClause + + Return Nothing + + End Function + + + + ' To customize, override this method in PersonalDailyJobTableControlRow. + 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) + PersonalDailyJobTable.DeleteRecord(pkValue) + + DirectCast(GetParentControlObject(Me, "PersonalDailyJobTableControl"), PersonalDailyJobTableControl).DataChanged = True + DirectCast(GetParentControlObject(Me, "PersonalDailyJobTableControl"), PersonalDailyJobTableControl).ResetData = True + End Sub + + Protected Overridable Sub Control_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.PreRender + ' PreRender event is raised just before page is being displayed. + Try + DbUtils.StartTransaction() + Me.RegisterPostback() + + If Not Me.Page.ErrorOnPage AndAlso (Me.Page.IsPageRefresh OrElse Me.DataChanged OrElse Me.ResetData) Then + + + ' Re-load the data and update the web page if necessary. + ' This is typically done during a postback (filter, search button, sort, pagination button). + ' In each of the other click handlers, simply set DataChanged to True to reload the data. + Me.LoadData() + Me.DataBind() + End If + + + Catch ex As Exception + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + Finally + DbUtils.EndTransaction() + End Try + End Sub + + + Protected Overrides Sub SaveControlsToSession() + MyBase.SaveControlsToSession() + + + 'Save pagination state to session. + + End Sub + + + + Protected Overrides Sub ClearControlsFromSession() + MyBase.ClearControlsFromSession() + + + + ' Clear pagination state from session. + + End Sub + + Protected Overrides Sub LoadViewState(ByVal savedState As Object) + MyBase.LoadViewState(savedState) + Dim isNewRecord As String = CType(ViewState("IsNewRecord"), String) + If Not isNewRecord Is Nothing AndAlso isNewRecord.Trim <> "" Then + Me.IsNewRecord = Boolean.Parse(isNewRecord) + End If + + Dim myCheckSum As String = CType(ViewState("CheckSum"), String) + If Not myCheckSum Is Nothing AndAlso myCheckSum.Trim <> "" Then + Me.CheckSum = myCheckSum + End If + + + ' Load view state for pagination control. + + End Sub + + Protected Overrides Function SaveViewState() As Object + ViewState("IsNewRecord") = Me.IsNewRecord.ToString() + ViewState("CheckSum") = Me.CheckSum + + + ' Load view state for pagination control. + + Return MyBase.SaveViewState() + End Function + + + + Public Overridable Function CreateWhereClause_AbsentIdDropDownList() 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 Absent table. + ' Examples: + ' wc.iAND(AbsentTable.Absent, BaseFilter.ComparisonOperator.EqualsTo, "XYZ") + ' wc.iAND(AbsentTable.Active, BaseFilter.ComparisonOperator.EqualsTo, "1") + + Dim wc As WhereClause = New WhereClause() + Return wc + + End Function + + + ' Fill the AbsentId list. + Protected Overridable Sub PopulateAbsentIdDropDownList( _ + ByVal selectedValue As String, _ + ByVal maxItems As Integer) + + Me.AbsentId.Items.Clear() + + + ' 1. Setup the static list items + + ' Add the Please Select item. + Me.AbsentId.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_AbsentIdDropDownList function. + ' It is better to customize the where clause there. + + Dim wc As WhereClause = CreateWhereClause_AbsentIdDropDownList() + ' Create the ORDER BY clause to sort based on the displayed value. + + + Dim orderBy As OrderBy = New OrderBy(false, false) + orderBy.Add(AbsentTable.Absent, 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 AbsentRecord = 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 = AbsentTable.GetRecords(wc, orderBy, pageNum, maxItems) + For each itemValue As AbsentRecord In itemValues + ' Create the item and add to the list. + Dim cvalue As String = Nothing + Dim fvalue As String = Nothing + If itemValue.AbsentIdSpecified Then + cvalue = itemValue.AbsentId.ToString() + + If counter < maxItems AndAlso Me.AbsentId.Items.FindByValue(cvalue) Is Nothing Then + + Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalDailyJobTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalDailyJobTable.AbsentId) + If _isExpandableNonCompositeForeignKey AndAlso PersonalDailyJobTable.AbsentId.IsApplyDisplayAs Then + fvalue = PersonalDailyJobTable.GetDFKA(itemValue, PersonalDailyJobTable.AbsentId) + End If + If (Not _isExpandableNonCompositeForeignKey) Or (String.IsNullOrEmpty(fvalue)) Then + fvalue = itemValue.Format(AbsentTable.Absent) + 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.AbsentId.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.AbsentId.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.AbsentId, selectedValue) AndAlso _ + Not SetSelectedDisplayText(Me.AbsentId, selectedValue)Then + + ' construct a whereclause to query a record with Absent.AbsentId = selectedValue + Dim filter2 As CompoundFilter = New CompoundFilter(CompoundFilter.CompoundingOperators.And_Operator, Nothing) + Dim whereClause2 As WhereClause = New WhereClause() + filter2.AddFilter(New BaseClasses.Data.ColumnValueFilter(AbsentTable.AbsentId, selectedValue, BaseClasses.Data.BaseFilter.ComparisonOperator.EqualsTo, False)) + whereClause2.AddFilter(filter2, CompoundFilter.CompoundingOperators.And_Operator) + + Try + ' Execute the query + Dim rc() As AbsentRecord = AbsentTable.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 AbsentRecord = DirectCast(rc(0), AbsentRecord) + ' Create the item and add to the list. + Dim cvalue As String = Nothing + Dim fvalue As String = Nothing + If itemValue.AbsentIdSpecified Then + cvalue = itemValue.AbsentId.ToString() + Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalDailyJobTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalDailyJobTable.AbsentId) + If _isExpandableNonCompositeForeignKey AndAlso PersonalDailyJobTable.AbsentId.IsApplyDisplayAs Then + fvalue = PersonalDailyJobTable.GetDFKA(itemValue, PersonalDailyJobTable.AbsentId) + End If + If (Not _isExpandableNonCompositeForeignKey) Or (String.IsNullOrEmpty(fvalue)) Then + fvalue = itemValue.Format(AbsentTable.Absent) + End If + + If fvalue Is Nothing OrElse fvalue.Trim() = "" Then fvalue = cvalue + Dim newItem As New ListItem(fvalue, cvalue) + Me.AbsentId.Items.Add(newItem) + SetSelectedValue(Me.AbsentId, selectedValue) + End If + End If + Catch + End Try + + End If + + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalDailyJobRowDeleteButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + If(Not Me.Page.IsPageRefresh) Then + + Dim tc As PersonalDailyJobTableControl = DirectCast(GetParentControlObject(Me, "PersonalDailyJobTableControl"), PersonalDailyJobTableControl) + If Not (IsNothing(tc)) Then + If Not Me.IsNewRecord Then + tc.AddToDeletedRecordIds(DirectCast(Me, PersonalDailyJobTableControlRow)) + End If + Me.Visible = False + tc.SetFormulaControls() + End If + + End If + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + Protected Overridable Sub AbsentId_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()(AbsentId.ClientID & "_SelectedValue"), String) + Dim displayText As String = CType(Me.Page.Session()(AbsentId.ClientID & "_SelectedDisplayText"), String) + If displayText <> "" AndAlso val <> "" Then + Me.AbsentId.Items.Add(New ListItem(displayText, val)) + Me.AbsentId.SelectedIndex = Me.AbsentId.Items.Count - 1 + Me.Page.Session.Remove(AbsentId.ClientID & "_SelectedValue") + Me.Page.Session.Remove(AbsentId.ClientID & "_SelectedDisplayText") + End If + + + + + End Sub + + Protected Overridable Sub Job_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub JobDate_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub Remark_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("BasePersonalDailyJobTableControlRow_Rec"), String) + End Get + Set(ByVal value As String) + Me.ViewState("BasePersonalDailyJobTableControlRow_Rec") = value + End Set + End Property + + Private _DataSource As PersonalDailyJobRecord + Public Property DataSource() As PersonalDailyJobRecord + Get + Return Me._DataSource + End Get + + Set(ByVal value As PersonalDailyJobRecord) + + Me._DataSource = value + End Set + End Property + + + + Private _checkSum As String + Public Overridable Property CheckSum() As String + Get + Return Me._checkSum + End Get + Set(ByVal value As String) + Me._checkSum = value + End Set + End Property + + Private _TotalPages As Integer + Public Property TotalPages() As Integer + Get + Return Me._TotalPages + End Get + Set(ByVal value As Integer) + Me._TotalPages = value + End Set + End Property + + Private _PageIndex As Integer + Public Property PageIndex() As Integer + Get + ' Return the PageIndex + Return Me._PageIndex + End Get + Set(ByVal value As Integer) + Me._PageIndex = value + End Set + End Property + + Private _DisplayLastPage As Boolean + Public Property DisplayLastPage() As Boolean + Get + Return Me._DisplayLastPage + End Get + Set(ByVal value As Boolean) + Me._DisplayLastPage = value + End Set + End Property + + + +#Region "Helper Properties" + + Public ReadOnly Property AbsentId() As System.Web.UI.WebControls.DropDownList + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "AbsentId"), System.Web.UI.WebControls.DropDownList) + End Get + End Property + + Public ReadOnly Property Job() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Job"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property JobDate() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "JobDate"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property PersonalDailyJobRecordRowSelection() As System.Web.UI.WebControls.CheckBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalDailyJobRecordRowSelection"), System.Web.UI.WebControls.CheckBox) + End Get + End Property + + Public ReadOnly Property PersonalDailyJobRowDeleteButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalDailyJobRowDeleteButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property Remark() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Remark"), System.Web.UI.WebControls.TextBox) + 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 PersonalDailyJobRecord = 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 PersonalDailyJobRecord + If Not Me.DataSource Is Nothing Then + Return Me.DataSource + End If + + If Not Me.RecordUniqueId Is Nothing Then + + Return PersonalDailyJobTable.GetRecord(Me.RecordUniqueId, True) + + End If + + ' Localization. + + Return Nothing + + End Function + + Public Shadows ReadOnly Property Page() As BaseApplicationPage + Get + Return DirectCast(MyBase.Page, BaseApplicationPage) + End Get + End Property + +#End Region + +End Class + + + +' Base class for the PersonalDailyJobTableControl control on the AddPersonalId page. +' Do not modify this class. Instead override any method in PersonalDailyJobTableControl. +Public Class BasePersonalDailyJobTableControl + Inherits Persons.UI.BaseApplicationTableControl + + + + Protected Overridable Sub Control_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Init + + + + ' Setup the filter and search events. + + + + ' Control Initializations. + ' Initialize the table's current sort order. + + If Me.InSession(Me, "Order_By") Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + End If + + + + ' Setup default pagination settings. + + Me.PageSize = CInt(Me.GetFromSession(Me, "Page_Size", "10")) + Me.PageIndex = CInt(Me.GetFromSession(Me, "Page_Index", "0")) + + + + Me.ClearControlsFromSession() + End Sub + + Protected Overridable Sub Control_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load + + SaveControlsToSession_Ajax() + + ' Show confirmation message on Click + Me.PersonalDailyJobDeleteButton.Attributes.Add("onClick", "return (confirm('" & (CType(Me.Page,BaseApplicationPage)).GetResourceValue("DeleteConfirm", "Persons") & "'));") + + ' Setup the pagination events. + + AddHandler Me.PersonalDailyJobPagination.FirstPage.Click, AddressOf PersonalDailyJobPagination_FirstPage_Click + + AddHandler Me.PersonalDailyJobPagination.LastPage.Click, AddressOf PersonalDailyJobPagination_LastPage_Click + + AddHandler Me.PersonalDailyJobPagination.NextPage.Click, AddressOf PersonalDailyJobPagination_NextPage_Click + + AddHandler Me.PersonalDailyJobPagination.PageSizeButton.Click, AddressOf PersonalDailyJobPagination_PageSizeButton_Click + + AddHandler Me.PersonalDailyJobPagination.PreviousPage.Click, AddressOf PersonalDailyJobPagination_PreviousPage_Click + + + ' Setup the sorting events. + + AddHandler Me.AbsentIdLabel1.Click, AddressOf AbsentIdLabel1_Click + + AddHandler Me.JobDateLabel.Click, AddressOf JobDateLabel_Click + + AddHandler Me.JobLabel1.Click, AddressOf JobLabel1_Click + + AddHandler Me.RemarkLabel.Click, AddressOf RemarkLabel_Click + + ' Setup the button events. + + AddHandler Me.PersonalDailyJobAddButton.Click, AddressOf PersonalDailyJobAddButton_Click + + AddHandler Me.PersonalDailyJobDeleteButton.Click, AddressOf PersonalDailyJobDeleteButton_Click + + AddHandler Me.PersonalDailyJobResetButton.Click, AddressOf PersonalDailyJobResetButton_Click + + + ' Setup events for others + + End Sub + + + Public Overridable Sub LoadData() + + ' Read data from database. Returns an array of records that can be assigned + ' to the DataSource table control property. + Try + Dim joinFilter As CompoundFilter = CreateCompoundJoinFilter() + + ' The WHERE clause will be empty when displaying all records in table. + Dim wc As WhereClause = CreateWhereClause() + If wc IsNot Nothing AndAlso Not wc.RunQuery Then + ' Initialize an empty array of records + Dim alist As New ArrayList(0) + Me.DataSource = DirectCast(alist.ToArray(GetType(PersonalDailyJobRecord)), PersonalDailyJobRecord()) + ' Add records to the list if needed. + Me.AddNewRecords() + Me._TotalRecords = 0 + Me._TotalPages = 0 + Return + End If + + ' Call OrderBy to determine the order - either use the order defined + ' on the Query Wizard, or specified by user (by clicking on column heading) + Dim orderBy As OrderBy = CreateOrderBy() + + ' Get the pagesize from the pagesize control. + Me.GetPageSize() + + If Me.DisplayLastPage Then + Dim totalRecords As Integer = If(Me._TotalRecords < 0, PersonalDailyJobTable.GetRecordCount(CreateCompoundJoinFilter(), CreateWhereClause()), Me._TotalRecords) + + Dim totalPages As Integer = CInt(Math.Ceiling(totalRecords / Me.PageSize)) + + Me.PageIndex = totalPages - 1 + End If + + ' Make sure PageIndex (current page) and PageSize are within bounds. + If Me.PageIndex < 0 Then + Me.PageIndex = 0 + End If + If Me.PageSize < 1 Then + Me.PageSize = 1 + End If + + ' Retrieve the records and set the table DataSource. + ' Only PageSize records are fetched starting at PageIndex (zero based). + If Me.AddNewRecord > 0 Then + ' Make sure to preserve the previously entered data on new rows. + Dim postdata As New ArrayList + For Each rc As PersonalDailyJobTableControlRow In Me.GetRecordControls() + If Not rc.IsNewRecord Then + rc.DataSource = rc.GetRecord() + rc.GetUIData() + postdata.Add(rc.DataSource) + UIData.Add(rc.PreservedUIData()) + End If + Next + Me.DataSource = DirectCast(postdata.ToArray(GetType(PersonalDailyJobRecord)), PersonalDailyJobRecord()) + Else ' Get the records from the database + Me.DataSource = PersonalDailyJobTable.GetRecords(joinFilter, wc, orderBy, Me.PageIndex, Me.PageSize) + + End If + + ' if the datasource contains no records contained in database, then load the last page. + If (DbUtils.GetCreatedRecords(Me.DataSource).Length = 0 AndAlso Not Me.DisplayLastPage) Then + Me.DisplayLastPage = True + LoadData() + Else + + ' Add any new rows desired by the user. + Me.AddNewRecords() + + ' Turn off the ToggleAll checkbox + Me.PersonalDailyJobToggleAll.Checked = False + + + ' Initialize the page and grand totals. now + + End If + + Catch ex As Exception + ' Report the error message to the end user + Dim msg As String = ex.Message + If ex.InnerException IsNot Nothing Then + msg = msg & " InnerException: " & ex.InnerException.Message + End If + Throw New Exception(msg, ex.InnerException) + End Try + End Sub + + + + + Public Overrides Sub DataBind() + ' The DataBind method binds the user interface controls to the values + ' from the database record for each row in the table. To do this, it calls the + ' DataBind for each of the rows. + ' DataBind also populates any filters above the table, and sets the pagination + ' control to the correct number of records and the current page number. + + MyBase.DataBind() + + ' Make sure that the DataSource is initialized. + If Me.DataSource Is Nothing Then + Return + End If + + 'LoadData for DataSource for chart and report if they exist + + ' Improve performance by prefetching display as records. + Me.PreFetchForeignKeyValues() + + ' Setup the pagination controls. + BindPaginationControls() + + + + ' Bind the repeater with the list of records to expand the UI. + Dim rep As System.Web.UI.WebControls.Repeater = CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalDailyJobTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return + rep.DataSource = DataSource() + rep.DataBind() + + Dim index As Integer = 0 + For Each repItem As System.Web.UI.WebControls.RepeaterItem In rep.Items + ' Loop through all rows in the table, set its DataSource and call DataBind(). + Dim recControl As PersonalDailyJobTableControlRow = DirectCast(repItem.FindControl("PersonalDailyJobTableControlRow"), PersonalDailyJobTableControlRow) + recControl.DataSource = Me.DataSource(index) + If Me.UIData.Count > index Then + recControl.PreviousUIData = Me.UIData(index) + End If + recControl.DataBind() + recControl.Visible = Not Me.InDeletedRecordIds(recControl) + + index += 1 + Next + + + + + ' Call the Set methods for each controls on the panel + + SetAbsentIdLabel1() + SetJobDateLabel() + SetJobLabel1() + + + + + SetPersonalDailyJobTableControlCollapsibleRegion() + + SetRemarkLabel() + ' setting the state of expand or collapse alternative rows + + + ' Load data for each record and table UI control. + ' Ordering is important because child controls get + ' their parent ids from their parent UI controls. + + + ' this method calls the set method for controls with special formula like running total, sum, rank, etc + SetFormulaControls() + End Sub + + Public Overridable Sub SetFormulaControls() + ' this method calls Set methods for the control that has special formula + + + + End Sub + + + Public Sub PreFetchForeignKeyValues() + If (IsNothing(Me.DataSource)) + Return + End If + + Me.Page.PregetDfkaRecords(PersonalDailyJobTable.AbsentId, Me.DataSource) + + End Sub + + + Public Overridable Sub RegisterPostback() + + + End Sub + + Public EvaluateFormulaDelegate As BaseClasses.Data.DataSource.EvaluateFormulaDelegate = New BaseClasses.Data.DataSource.EvaluateFormulaDelegate(AddressOf Me.EvaluateFormula) + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean, ByVal e as FormulaEvaluator) As String + If e Is Nothing + e = New FormulaEvaluator() + End If + + e.Variables.Clear() + + + ' add variables for formula evaluation + If variables IsNot Nothing Then + Dim enumerator As System.Collections.Generic.IEnumerator(Of System.Collections.Generic.KeyValuePair(Of String, Object)) = variables.GetEnumerator() + While enumerator.MoveNext() + e.Variables.Add(enumerator.Current.Key, enumerator.Current.Value) + End While + End If + + If includeDS + + End If + + ' All variables referred to in the formula are expected to be + ' properties of the DataSource. For example, referring to + ' UnitPrice as a variable will refer to DataSource.UnitPrice + e.DataSource = dataSourceForEvaluate + + ' Define the calling control. This is used to add other + ' related table and record controls as variables. + e.CallingControl = Me + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + + If Not String.IsNullOrEmpty(format) AndAlso (String.IsNullOrEmpty(formula) OrElse formula.IndexOf("Format(") < 0) Then + Return FormulaUtils.Format(resultObj, format) + Else + Return resultObj.ToString() + End If + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format,variables ,includeDS, Nothing) + End Function + + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object)) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format, variables ,True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, format, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal e as FormulaEvaluator) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, variables, True, e) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal includeDS as Boolean) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, includeDS, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, True, Nothing) + End Function + + + + + Public Overridable Sub ResetControl() + + Me.CurrentSortOrder.Reset() + If (Me.InSession(Me, "Order_By")) Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + End If + + Me.PageIndex = 0 + End Sub + + Protected Overridable Sub BindPaginationControls() + ' Setup the pagination controls. + + ' Bind the pagination labels. + + If DbUtils.GetCreatedRecords(Me.DataSource).Length > 0 Then + + Me.PersonalDailyJobPagination.CurrentPage.Text = (Me.PageIndex + 1).ToString() + Else + Me.PersonalDailyJobPagination.CurrentPage.Text = "0" + End If + Me.PersonalDailyJobPagination.PageSize.Text = Me.PageSize.ToString() + Me.PersonalDailyJobPagination.TotalItems.Text = Me.TotalRecords.ToString() + Me.PersonalDailyJobPagination.TotalPages.Text = Me.TotalPages.ToString() + + ' Bind the buttons for PersonalDailyJobTableControl pagination. + + Me.PersonalDailyJobPagination.FirstPage.Enabled = Not (Me.PageIndex = 0) + If Me._TotalPages < 0 Then ' if the total pages is not determined yet, enable last and next buttons + Me.PersonalDailyJobPagination.LastPage.Enabled = True + ElseIf Me._TotalPages = 0 ' if the total pages is determined and it is 0, enable last and next buttons + Me.PersonalDailyJobPagination.LastPage.Enabled = False + Else ' if the total pages is the last page, disable last and next buttons + Me.PersonalDailyJobPagination.LastPage.Enabled = Not (Me.PageIndex = Me.TotalPages - 1) + End If + + If Me._TotalPages < 0 Then ' if the total pages is not determined yet, enable last and next buttons + Me.PersonalDailyJobPagination.NextPage.Enabled = True + ElseIf Me._TotalPages = 0 ' if the total pages is determined and it is 0, enable last and next buttons + Me.PersonalDailyJobPagination.NextPage.Enabled = False + Else ' if the total pages is the last page, disable last and next buttons + Me.PersonalDailyJobPagination.NextPage.Enabled = Not (Me.PageIndex = Me.TotalPages - 1) + End If + + Me.PersonalDailyJobPagination.PreviousPage.Enabled = Not (Me.PageIndex = 0) + + + End Sub + + Public Overridable Sub SaveData() + ' Save the data from the entire table. Calls each row's Save Data + ' to save their data. This function is called by the Click handler of the + ' Save button. The button handler should Start/Commit/End a transaction. + + Dim recCtl As PersonalDailyJobTableControlRow + For Each recCtl In Me.GetRecordControls() + + If Me.InDeletedRecordIds(recCtl) Then + ' Delete any pending deletes. + recCtl.Delete() + Else + If recCtl.Visible Then + recCtl.SaveData() + End If + End If + + Next + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + ' Set IsNewRecord to False for all records - since everything has been saved and is no longer "new" + For Each recCtl In Me.GetRecordControls() + recCtl.IsNewRecord = False + Next + + + ' Set DeletedRecordsIds to Nothing since we have deleted all pending deletes. + Me.DeletedRecordIds = Nothing + + End Sub + + Public Overridable Function CreateCompoundJoinFilter() As CompoundFilter + Dim jFilter As CompoundFilter = New CompoundFilter() + + Return jFilter + + End Function + + + Public Overridable Function CreateOrderBy() As OrderBy + ' The CurrentSortOrder is initialized to the sort order on the + ' Query Wizard. It may be modified by the Click handler for any of + ' the column heading to sort or reverse sort by that column. + ' You can add your own sort order, or modify it on the Query Wizard. + Return Me.CurrentSortOrder + End Function + + Public Overridable Function CreateWhereClause() As WhereClause + 'This CreateWhereClause is used for loading the data. + PersonalDailyJobTable.Instance.InnerFilter = Nothing + Dim wc As WhereClause = New WhereClause() + + ' Compose the WHERE clause consiting of: + ' 1. Static clause defined at design time. + ' 2. User selected search criteria. + ' 3. User selected filter criteria. + + + Dim selectedRecordKeyValue as KeyValue = New KeyValue() + + Dim personalIdRecordControlObj As Persons.UI.Controls.AddPersonalId.PersonalIdRecordControl = DirectCast(MiscUtils.FindControlRecursively(Me.Page, "PersonalIdRecordControl"), Persons.UI.Controls.AddPersonalId.PersonalIdRecordControl) + + If (Not IsNothing(personalIdRecordControlObj) AndAlso Not IsNothing(personalIdRecordControlObj.GetRecord()) AndAlso personalIdRecordControlObj.GetRecord().IsCreated AndAlso Not IsNothing(personalIdRecordControlObj.GetRecord().PersonalId)) + wc.iAND(PersonalDailyJobTable.PersonalId, BaseFilter.ComparisonOperator.EqualsTo, personalIdRecordControlObj.GetRecord().PersonalId.ToString()) + selectedRecordKeyValue.AddElement(PersonalDailyJobTable.PersonalId.InternalName, personalIdRecordControlObj.GetRecord().PersonalId.ToString()) + Else + wc.RunQuery = False + Return wc + End If + + HttpContext.Current.Session("PersonalDailyJobTableControlWhereClause") = selectedRecordKeyValue.ToXmlString() + + Return wc + End Function + + + Public Overridable Function CreateWhereClause(ByVal searchText as String, ByVal fromSearchControl as String, ByVal AutoTypeAheadSearch as String, ByVal AutoTypeAheadWordSeparators as String) As WhereClause + ' This CreateWhereClause is used for loading list of suggestions for Auto Type-Ahead feature. + PersonalDailyJobTable.Instance.InnerFilter = Nothing + Dim wc As WhereClause = New WhereClause() + + ' Compose the WHERE clause consiting of: + ' 1. Static clause defined at design time. + ' 2. User selected search criteria. + ' 3. User selected filter criteria. + + Dim appRelativeVirtualPath As String = CType(HttpContext.Current.Session("AppRelativeVirtualPath"), String) + + Dim selectedRecordInPersonalIdRecordControl as String = DirectCast(HttpContext.Current.Session("PersonalDailyJobTableControlWhereClause"), String) + + If Not selectedRecordInPersonalIdRecordControl Is Nothing AndAlso KeyValue.IsXmlKey(selectedRecordInPersonalIdRecordControl) Then + Dim selectedRecordKeyValue as KeyValue = KeyValue.XmlToKey(selectedRecordInPersonalIdRecordControl) + + If Not IsNothing(selectedRecordKeyValue) AndAlso selectedRecordKeyValue.ContainsColumn(PersonalDailyJobTable.PersonalId) Then + wc.iAND(PersonalDailyJobTable.PersonalId, BaseFilter.ComparisonOperator.EqualsTo, selectedRecordKeyValue.GetColumnValue(PersonalDailyJobTable.PersonalId).ToString()) + End If + + End If + + ' Adds clauses if values are selected in Filter controls which are configured in the page. + + + Return wc + End Function + + + Public Overridable Function FormatSuggestions(ByVal prefixText As String, ByVal resultItem As String, _ + ByVal columnLength As Integer, ByVal AutoTypeAheadDisplayFoundText As String, _ + ByVal autoTypeAheadSearch As String, ByVal AutoTypeAheadWordSeparators As String, _ + ByVal resultList As ArrayList) As Boolean + + 'Formats the resultItem and adds it to the list of suggestions. + Dim index As Integer = resultItem.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture).IndexOf(prefixText.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture)) + Dim itemToAdd As String = "" + Dim isFound As Boolean = False + Dim isAdded As Boolean = False + ' Get the index where prfixt is at the beginning of resultItem. If not found then, index of word which begins with prefixText. + If InvariantLCase(autoTypeAheadSearch).equals("wordsstartingwithsearchstring") And Not index = 0 Then + ' Expression to find word which contains AutoTypeAheadWordSeparators followed by prefixText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex( AutoTypeAheadWordSeparators + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + If regex1.IsMatch(resultItem) Then + index = regex1.Match(resultItem).Index + isFound = True + End If + ' If the prefixText is found immediatly after white space then starting of the word is found so don not search any further + If not resultItem(index).ToString() = " " Then + ' Expression to find beginning of the word which contains AutoTypeAheadWordSeparators followed by prefixText + Dim regex As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\\S*" + AutoTypeAheadWordSeparators + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + If regex.IsMatch(resultItem) Then + index = regex.Match(resultItem).Index + isFound = True + End If + End If + End If + + ' If autoTypeAheadSearch value is wordsstartingwithsearchstring then, extract the substring only if the prefixText is found at the + ' beginning of the resultItem (index = 0) or a word in resultItem is found starts with prefixText. + If index = 0 Or isFound Or InvariantLCase(autoTypeAheadSearch).Equals("anywhereinstring") then + If InvariantLCase(AutoTypeAheadDisplayFoundText).equals("atbeginningofmatchedstring") Then + ' Expression to find beginning of the word which contains prefixText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\\S*" + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + ' Find the beginning of the word which contains prefexText + If (StringUtils.InvariantLCase(autoTypeAheadSearch).Equals("anywhereinstring") AndAlso regex1.IsMatch(resultItem)) Then + index = regex1.Match(resultItem).Index + isFound = True + End If + ' Display string from the index till end of the string if sub string from index till end is less than columnLength value. + If Len(resultItem) - index <= columnLength Then + If index = 0 Then + itemToAdd = resultItem + Else + itemToAdd = "..." & resultItem.Substring(index, Len(resultItem) - index) + End If + Else + If index = 0 Then + itemToAdd = resultItem.Substring(index, (columnLength - 3)) & "..." + Else + 'Truncate the string to show only columnLength - 6 characters as begining and trailing "..." has to be appended. + itemToAdd = "..." & resultItem.Substring(index , columnLength - 6) & "..." + End If + End If + ElseIf InvariantLCase(AutoTypeAheadDisplayFoundText).equals("inmiddleofmatchedstring") Then + Dim subStringBeginIndex As Integer = CType(columnLength/2, Integer) + If Len(resultItem) <= columnLength Then + itemToAdd = resultItem + Else + ' Sanity check at end of the string + If index + Len(prefixText) = columnLength Then + itemToAdd = "..." & resultItem.Substring(index-columnLength,index) + ElseIf Len(resultItem) - index < subStringBeginIndex Then + ' Display string from the end till columnLength value if, index is closer to the end of the string. + itemToAdd = "..." & resultItem.Substring(Len(resultItem)-columnLength,Len(resultItem)) + ElseIf index <= subStringBeginIndex Then + ' Sanity chet at beginning of the string + itemToAdd = resultItem.Substring(0, columnLength) & "..." + Else + ' Display string containing text before the prefixText occures and text after the prefixText + itemToAdd = "..." & resultItem.Substring(index - subStringBeginIndex, columnLength) & "..." + End If + End If + ElseIf InvariantLCase(AutoTypeAheadDisplayFoundText).equals("atendofmatchedstring") Then + ' Expression to find ending of the word which contains prefexText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\s", System.Text.RegularExpressions.RegexOptions.IgnoreCase) + ' Find the ending of the word which contains prefexText + If regex1.IsMatch(resultItem, index + 1) Then + index = regex1.Match(resultItem, index + 1).Index + Else + ' If the word which contains prefexText is the last word in string, regex1.IsMatch returns false. + index = resultItem.Length + End If + If index > Len(resultItem) Then + index = Len(resultItem) + End If + ' If text from beginning of the string till index is less than columnLength value then, display string from the beginning till index. + If index <= columnLength Then + if index = Len(resultItem) Then 'Make decision to append "..." + itemToAdd = resultItem.Substring(0,index) + Else + itemToAdd = resultItem.Substring(0,index) & "..." + End If + Else + If index = Len(resultItem) Then + itemToAdd = "..." & resultItem.Substring(index - (columnLength - 3), (columnLength - 3)) + Else + 'Truncate the string to show only columnLength - 6 characters as begining and trailing "..." has to be appended. + itemToAdd = "..." & resultItem.Substring(index - (columnLength - 6), columnLength - 6) & "..." + End If + End If + End If + + ' Remove newline character from itemToAdd + Dim prefixTextIndex As Integer = itemToAdd.IndexOf(prefixText, StringComparison.CurrentCultureIgnoreCase) + ' If itemToAdd contains any newline after the search text then show text only till newline + Dim regex2 As System.Text.RegularExpressions.Regex = New System.Text.RegularExpressions.Regex("(" & vbCrLf & "|" & vbLf & ")", System.Text.RegularExpressions.RegexOptions.IgnoreCase) + Dim newLineIndexAfterPrefix As Integer = -1 + If regex2.IsMatch(itemToAdd, prefixTextIndex) Then + newLineIndexAfterPrefix = regex2.Match(itemToAdd, prefixTextIndex).Index + End If + If (newLineIndexAfterPrefix > -1) Then + If itemToAdd.EndsWith("...") Then + itemToAdd = (itemToAdd.Substring(0, newLineIndexAfterPrefix) + "...") + Else + itemToAdd = itemToAdd.Substring(0, newLineIndexAfterPrefix) + End If + End If + ' If itemToAdd contains any newline before search text then show text which comes after newline + Dim regex3 As System.Text.RegularExpressions.Regex = New System.Text.RegularExpressions.Regex("(" & vbCrLf & "|" & vbLf & ")", (System.Text.RegularExpressions.RegexOptions.IgnoreCase Or System.Text.RegularExpressions.RegexOptions.RightToLeft)) + Dim newLineIndexBeforePrefix As Integer = -1 + If regex3.IsMatch(itemToAdd, prefixTextIndex) Then + newLineIndexBeforePrefix = regex3.Match(itemToAdd, prefixTextIndex).Index + End If + If (newLineIndexBeforePrefix > -1) Then + If itemToAdd.StartsWith("...") Then + itemToAdd = ("..." + itemToAdd.Substring((newLineIndexBeforePrefix + regex3.Match(itemToAdd, prefixTextIndex).Length))) + Else + itemToAdd = itemToAdd.Substring((newLineIndexBeforePrefix + regex3.Match(itemToAdd, prefixTextIndex).Length)) + End If + End If + + If Not itemToAdd is nothing AndAlso Not resultList.Contains(itemToAdd) Then + + resultList.Add(itemToAdd) + + isAdded = true + End If + End If + Return isAdded + End Function + + + Protected Overridable Sub GetPageSize() + + If Me.PersonalDailyJobPagination.PageSize.Text.Trim <> "" Then + Try + 'Me.PageSize = Integer.Parse(Me.PersonalDailyJobPagination.PageSize.Text) + Catch ex As Exception + End Try + End If + End Sub + + Protected Overridable Sub AddNewRecords() + + Dim newRecordList As ArrayList = New ArrayList() + + Dim newUIDataList As System.Collections.Generic.List(Of Hashtable) = New System.Collections.Generic.List(Of Hashtable)() + + ' Loop though all the record controls and if the record control + ' does not have a unique record id set, then create a record + ' and add to the list. + If Not Me.ResetData Then + Dim rep As System.Web.UI.WebControls.Repeater = CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalDailyJobTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return + + Dim repItem As System.Web.UI.WebControls.RepeaterItem + For Each repItem In rep.Items + ' Loop through all rows in the table, set its DataSource and call DataBind(). + + Dim recControl As PersonalDailyJobTableControlRow = DirectCast(repItem.FindControl("PersonalDailyJobTableControlRow"), PersonalDailyJobTableControlRow) + + If recControl.Visible AndAlso recControl.IsNewRecord() Then + + Dim rec As PersonalDailyJobRecord = New PersonalDailyJobRecord() + + If MiscUtils.IsValueSelected(recControl.AbsentId) Then + rec.Parse(recControl.AbsentId.SelectedItem.Value, PersonalDailyJobTable.AbsentId) + End If + If recControl.Job.Text <> "" Then + rec.Parse(recControl.Job.Text, PersonalDailyJobTable.Job) + End If + If recControl.JobDate.Text <> "" Then + rec.Parse(recControl.JobDate.Text, PersonalDailyJobTable.JobDate) + End If + If recControl.Remark.Text <> "" Then + rec.Parse(recControl.Remark.Text, PersonalDailyJobTable.Remark) + End If + newUIDataList.Add(recControl.PreservedUIData()) + newRecordList.Add(rec) + End If + Next + End If + + + ' Add any new record to the list. + Dim index As Integer = 0 + For index = 1 To Me.AddNewRecord + + newRecordList.Insert(0, New PersonalDailyJobRecord()) + newUIDataList.Insert(0, New Hashtable()) + + Next + Me.AddNewRecord = 0 + + ' Finally, add any new records to the DataSource. + If newRecordList.Count > 0 Then + + Dim finalList As ArrayList = New ArrayList(Me.DataSource) + finalList.InsertRange(0, newRecordList) + + Me.DataSource = DirectCast(finalList.ToArray(GetType(PersonalDailyJobRecord)), PersonalDailyJobRecord()) + + End If + + ' Add the existing UI data to this hash table + If newUIDataList.Count > 0 Then + Me.UIData.InsertRange(0, newUIDataList) + End If + + End Sub + + + Public Sub AddToDeletedRecordIds(ByVal rec As PersonalDailyJobTableControlRow) + If rec.IsNewRecord() Then + Return + End If + + If Not Me.DeletedRecordIds Is Nothing AndAlso Me.DeletedRecordIds.Trim <> "" Then + Me.DeletedRecordIds &= "," + End If + + Me.DeletedRecordIds &= "[" & rec.RecordUniqueId & "]" + End Sub + + Protected Overridable Function InDeletedRecordIds(ByVal rec As PersonalDailyJobTableControlRow) As Boolean + If Me.DeletedRecordIds Is Nothing OrElse Me.DeletedRecordIds.Trim = "" Then + Return False + End If + + Return Me.DeletedRecordIds.IndexOf("[" & rec.RecordUniqueId & "]") >= 0 + End Function + + Private _DeletedRecordIds As String + Public Property DeletedRecordIds() As String + Get + Return Me._DeletedRecordIds + End Get + Set(ByVal value As String) + Me._DeletedRecordIds = value + End Set + End Property + + + ' Create Set, WhereClause, and Populate Methods + + Public Overridable Sub SetAbsentIdLabel1() + + End Sub + + Public Overridable Sub SetJobDateLabel() + + End Sub + + Public Overridable Sub SetJobLabel1() + + End Sub + + Public Overridable Sub SetPersonalDailyJobTableControlCollapsibleRegion() + + End Sub + + Public Overridable Sub SetRemarkLabel() + + 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. + Dim added As Boolean = Me.AddNewRecord > 0 + Me.LoadData() + Me.DataBind() + + If added Then + Me.SetFocusToAddedRow() + End If + + End If + + + + Catch ex As Exception + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + Finally + DbUtils.EndTransaction + End Try + End Sub + + 'this function sets focus to the first editable element in the new added row in the editable table + Protected Overridable Sub SetFocusToAddedRow() + Dim rep As System.Web.UI.WebControls.Repeater = CType(Me.FindControl("PersonalDailyJobTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing OrElse rep.Items.Count = 0 Then Return + Dim repItem As System.Web.UI.WebControls.RepeaterItem + For Each repItem In rep.Items + 'Load scripts to table rows + Me.Page.LoadFocusScripts(repItem) + Dim recControl As PersonalDailyJobTableControlRow = DirectCast(repItem.FindControl("PersonalDailyJobTableControlRow"), PersonalDailyJobTableControlRow) + If recControl.IsNewRecord Then + For Each field As Control In recControl.Controls + If field.Visible AndAlso Me.Page.IsControlEditable(field, False) Then + 'set focus on the first editable field in the new row + field.Focus() + Dim updPan As UpdatePanel = DirectCast(Me.Page.FindControlRecursively("UpdatePanel1"), UpdatePanel) + If Not updPan Is Nothing Then updPan.Update() + Return + End If + Next + Return + End If + Next + End Sub + + + Protected Overrides Sub SaveControlsToSession() + MyBase.SaveControlsToSession() + + ' Save filter controls to values to session. + + + 'Save pagination state to session. + + + + ' Save table control properties to the session. + If Not Me.CurrentSortOrder Is Nothing Then + Me.SaveToSession(Me, "Order_By", Me.CurrentSortOrder.ToXmlString()) + End If + + Me.SaveToSession(Me, "Page_Index", Me.PageIndex.ToString()) + Me.SaveToSession(Me, "Page_Size", Me.PageSize.ToString()) + + Me.SaveToSession(Me, "DeletedRecordIds", Me.DeletedRecordIds) + + End Sub + + Protected Sub SaveControlsToSession_Ajax() + ' Save filter controls to values to session. + + HttpContext.Current.Session("AppRelativeVirtualPath") = Me.Page.AppRelativeVirtualPath + + End Sub + + Protected Overrides Sub ClearControlsFromSession() + MyBase.ClearControlsFromSession() + + ' Clear filter controls values from the session. + + + ' Clear pagination state from session. + + + + ' Clear table properties from the session. + Me.RemoveFromSession(Me, "Order_By") + Me.RemoveFromSession(Me, "Page_Index") + Me.RemoveFromSession(Me, "Page_Size") + + Me.RemoveFromSession(Me, "DeletedRecordIds") + + End Sub + + Protected Overrides Sub LoadViewState(ByVal savedState As Object) + MyBase.LoadViewState(savedState) + + Dim orderByStr As String = CType(ViewState("PersonalDailyJobTableControl_OrderBy"), String) + + If orderByStr IsNot Nothing AndAlso orderByStr.Trim <> "" Then + Me.CurrentSortOrder = BaseClasses.Data.OrderBy.FromXmlString(orderByStr) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + End If + + Dim pageIndex As String = CType(ViewState("Page_Index"), String) + If pageIndex IsNot Nothing Then + Me.PageIndex = CInt(pageIndex) + End If + + Dim pageSize As String = CType(ViewState("Page_Size"), String) + If Not pageSize Is Nothing Then + Me.PageSize = CInt(pageSize) + End If + + + + ' Load view state for pagination control. + + Me.DeletedRecordIds = CType(Me.ViewState("DeletedRecordIds"), String) + + End Sub + + Protected Overrides Function SaveViewState() As Object + + If Me.CurrentSortOrder IsNot Nothing Then + Me.ViewState("PersonalDailyJobTableControl_OrderBy") = Me.CurrentSortOrder.ToXmlString() + End If + + Me.ViewState("Page_Index") = Me.PageIndex + Me.ViewState("Page_Size") = Me.PageSize + + Me.ViewState("DeletedRecordIds") = Me.DeletedRecordIds + + + ' Load view state for pagination control. + + + Return MyBase.SaveViewState() + End Function + + ' Generate the event handling functions for pagination events. + + ' event handler for ImageButton + Public Overridable Sub PersonalDailyJobPagination_FirstPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.PageIndex = 0 + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalDailyJobPagination_LastPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.DisplayLastPage = True + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalDailyJobPagination_NextPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.PageIndex += 1 + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for LinkButton + Public Overridable Sub PersonalDailyJobPagination_PageSizeButton_Click(ByVal sender As Object, ByVal args As EventArgs) + + Try + + Me.DataChanged = True + + Me.PageSize = Integer.Parse(Me.PersonalDailyJobPagination.PageSize.Text) + + Me.PageIndex = Integer.Parse(Me.PersonalDailyJobPagination.CurrentPage.Text) - 1 + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalDailyJobPagination_PreviousPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + If Me.PageIndex > 0 Then + Me.PageIndex -= 1 + Me.DataChanged = True + End If + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + + ' Generate the event handling functions for sorting events. + + Public Overridable Sub AbsentIdLabel1_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by AbsentId when clicked. + + ' Get previous sorting state for AbsentId. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalDailyJobTable.AbsentId) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for AbsentId. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalDailyJobTable.AbsentId, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by AbsentId, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub JobDateLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by JobDate when clicked. + + ' Get previous sorting state for JobDate. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalDailyJobTable.JobDate) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for JobDate. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalDailyJobTable.JobDate, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by JobDate, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub JobLabel1_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by Job when clicked. + + ' Get previous sorting state for Job. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalDailyJobTable.Job) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for Job. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalDailyJobTable.Job, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by Job, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub RemarkLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by Remark when clicked. + + ' Get previous sorting state for Remark. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalDailyJobTable.Remark) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for Remark. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalDailyJobTable.Remark, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by Remark, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + + ' Generate the event handling functions for button events. + + ' event handler for ImageButton + Public Overridable Sub PersonalDailyJobAddButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + Me.AddNewRecord = 1 + Me.DataChanged = True + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalDailyJobDeleteButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + If(Not Me.Page.IsPageRefresh) Then + + Me.DeleteSelectedRecords(True) + Me.SetFormulaControls() + + + End If + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalDailyJobResetButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.CurrentSortOrder.Reset() + If Me.InSession(Me, "Order_By") Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + + End If + + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + + + ' Generate the event handling functions for filter and search events. + + + ' Generate the event handling functions for others + + + Private _UIData As New System.Collections.Generic.List(Of Hashtable) + Public Property UIData() As System.Collections.Generic.List(Of Hashtable) + Get + Return Me._UIData + End Get + Set(ByVal value As System.Collections.Generic.List(Of Hashtable)) + Me._UIData = value + End Set + End Property + + ' pagination properties + Protected _PageSize As Integer + Public Property PageSize() As Integer + Get + Return Me._PageSize + End Get + Set(ByVal value As Integer) + Me._PageSize = value + End Set + End Property + + Protected _PageIndex As Integer + Public Property PageIndex() As Integer + Get + ' Return the PageIndex + Return Me._PageIndex + End Get + Set(ByVal value As Integer) + Me._PageIndex = value + End Set + End Property + + Protected _TotalRecords As Integer = -1 + Public Property TotalRecords() As Integer + Get + If _TotalRecords < 0 + _TotalRecords = PersonalDailyJobTable.GetRecordCount(CreateCompoundJoinFilter(), CreateWhereClause()) + End If + Return Me._TotalRecords + End Get + Set(ByVal value As Integer) + If Me.PageSize > 0 Then + + Me.TotalPages = CInt(Math.Ceiling(value / Me.PageSize)) + + End If + Me._TotalRecords = value + End Set + End Property + + + + Protected _TotalPages As Integer = -1 + Public Property TotalPages() As Integer + Get + If _TotalPages < 0 Then + + Me.TotalPages = CInt(Math.Ceiling(TotalRecords / Me.PageSize)) + + End If + Return Me._TotalPages + End Get + Set(ByVal value As Integer) + Me._TotalPages = value + End Set + End Property + + Protected _DisplayLastPage As Boolean + Public Property DisplayLastPage() As Boolean + Get + Return Me._DisplayLastPage + End Get + Set(ByVal value As Boolean) + Me._DisplayLastPage = value + End Set + End Property + + Private _DataChanged As Boolean = False + Public Property DataChanged() As Boolean + Get + Return Me._DataChanged + End Get + Set(ByVal value As Boolean) + Me._DataChanged = value + End Set + End Property + + Private _ResetData As Boolean = False + Public Property ResetData() As Boolean + Get + Return Me._ResetData + End Get + Set(ByVal value As Boolean) + Me._ResetData = value + End Set + End Property + + Private _AddNewRecord As Integer = 0 + Public Property AddNewRecord() As Integer + Get + Return Me._AddNewRecord + End Get + Set(ByVal value As Integer) + Me._AddNewRecord = value + End Set + End Property + + + Private _CurrentSortOrder As OrderBy = Nothing + Public Property CurrentSortOrder() As OrderBy + Get + Return Me._CurrentSortOrder + End Get + Set(ByVal value As BaseClasses.Data.OrderBy) + Me._CurrentSortOrder = value + End Set + End Property + + Private _DataSource() As PersonalDailyJobRecord = Nothing + Public Property DataSource() As PersonalDailyJobRecord () + Get + Return Me._DataSource + End Get + Set(ByVal value() As PersonalDailyJobRecord) + Me._DataSource = value + End Set + End Property + +#Region "Helper Properties" + + Public ReadOnly Property AbsentIdLabel1() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "AbsentIdLabel1"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property JobDateLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "JobDateLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property JobLabel1() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "JobLabel1"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property PersonalDailyJobAddButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalDailyJobAddButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalDailyJobDeleteButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalDailyJobDeleteButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalDailyJobPagination() As Persons.UI.IPagination + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalDailyJobPagination"), Persons.UI.IPagination) + End Get + End Property + + Public ReadOnly Property PersonalDailyJobResetButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalDailyJobResetButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalDailyJobTableControlCollapsibleRegion() As System.Web.UI.WebControls.Panel + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalDailyJobTableControlCollapsibleRegion"), System.Web.UI.WebControls.Panel) + End Get + End Property + + Public ReadOnly Property PersonalDailyJobToggleAll() As System.Web.UI.WebControls.CheckBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalDailyJobToggleAll"), System.Web.UI.WebControls.CheckBox) + End Get + End Property + + Public ReadOnly Property RemarkLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RemarkLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + +#End Region + +#Region "Helper Functions" + + Public Overrides Overloads Function ModifyRedirectUrl(url As String, arg As String, ByVal bEncrypt As Boolean) As String + Return Me.Page.EvaluateExpressions(url, arg, bEncrypt, Me) + End Function + + Public Overrides Overloads Function EvaluateExpressions(url As String, arg As String, ByVal bEncrypt As Boolean) As String + Dim needToProcess As Boolean = AreAnyUrlParametersForMe(url, arg) + If (needToProcess) Then + Dim recCtl As PersonalDailyJobTableControlRow = Me.GetSelectedRecordControl() + If recCtl Is Nothing AndAlso url.IndexOf("{") >= 0 Then + ' Localization. + Throw New Exception(Page.GetResourceValue("Err:NoRecSelected", "Persons")) + End If + Dim rec As PersonalDailyJobRecord = Nothing + If recCtl IsNot Nothing Then + rec = recCtl.GetRecord() + End If + Return EvaluateExpressions(url, arg, rec, bEncrypt) + End If + Return url + End Function + + Public Overridable Function GetSelectedRecordIndex() As Integer + Dim counter As Integer = 0 + Dim recControl As PersonalDailyJobTableControlRow + For Each recControl In Me.GetRecordControls() + If recControl.PersonalDailyJobRecordRowSelection.Checked Then + Return counter + End If + counter += 1 + Next + Return -1 + End Function + + Public Overridable Function GetSelectedRecordControl() As PersonalDailyJobTableControlRow + Dim selectedList() As PersonalDailyJobTableControlRow = Me.GetSelectedRecordControls() + If selectedList.Length = 0 Then + Return Nothing + End If + Return selectedList(0) + + End Function + + Public Overridable Function GetSelectedRecordControls() As PersonalDailyJobTableControlRow() + + Dim selectedList As ArrayList = New ArrayList(25) + Dim recControl As PersonalDailyJobTableControlRow + For Each recControl In Me.GetRecordControls() + If recControl.PersonalDailyJobRecordRowSelection IsNot Nothing AndAlso recControl.PersonalDailyJobRecordRowSelection.Checked Then + selectedList.Add(recControl) + End If + Next + Return DirectCast(selectedList.ToArray(GetType(PersonalDailyJobTableControlRow)), PersonalDailyJobTableControlRow()) + + End Function + + Public Overridable Sub DeleteSelectedRecords(ByVal deferDeletion As Boolean) + Dim recList() As PersonalDailyJobTableControlRow = Me.GetSelectedRecordControls() + If recList.Length = 0 Then + ' Localization. + Throw New Exception(Page.GetResourceValue("Err:NoRecSelected", "Persons")) + End If + + Dim recCtl As PersonalDailyJobTableControlRow + For Each recCtl In recList + If deferDeletion Then + If Not recCtl.IsNewRecord Then + + Me.AddToDeletedRecordIds(recCtl) + + End If + recCtl.Visible = False + + recCtl.PersonalDailyJobRecordRowSelection.Checked = False + + Else + + recCtl.Delete() + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + End If + Next + End Sub + + Public Function GetRecordControls() As PersonalDailyJobTableControlRow() + Dim recList As ArrayList = New ArrayList() + Dim rep As System.Web.UI.WebControls.Repeater = CType(Me.FindControl("PersonalDailyJobTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return Nothing + Dim repItem As System.Web.UI.WebControls.RepeaterItem + + For Each repItem In rep.Items + + Dim recControl As PersonalDailyJobTableControlRow = DirectCast(repItem.FindControl("PersonalDailyJobTableControlRow"), PersonalDailyJobTableControlRow) + recList.Add(recControl) + + Next + + Return DirectCast(recList.ToArray(GetType(PersonalDailyJobTableControlRow)), PersonalDailyJobTableControlRow()) + End Function + + Public Shadows ReadOnly Property Page() As BaseApplicationPage + Get + Return DirectCast(MyBase.Page, BaseApplicationPage) + End Get + End Property + +#End Region + + + +End Class + + +' Base class for the PersonalDDTableControlRow control on the AddPersonalId page. +' Do not modify this class. Instead override any method in PersonalDDTableControlRow. +Public Class BasePersonalDDTableControlRow + Inherits Persons.UI.BaseApplicationRecordControl + + ' To customize, override this method in PersonalDDTableControlRow. + Protected Overridable Sub Control_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Init + + Me.ClearControlsFromSession() + End Sub + + ' To customize, override this method in PersonalDDTableControlRow. + Protected Overridable Sub Control_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load + + 'Call LoadFocusScripts from repeater so that onfocus attribute could be added to elements + Me.Page.LoadFocusScripts(Me) + + ' Show confirmation message on Click + Me.PersonalDDRowDeleteButton.Attributes.Add("onClick", "return (confirm('" & (CType(Me.Page,BaseApplicationPage)).GetResourceValue("DeleteRecordConfirm", "Persons") & "'));") + + + ' Register the event handlers. + + AddHandler Me.PersonalDDRowDeleteButton.Click, AddressOf PersonalDDRowDeleteButton_Click + + AddHandler Me.EndDate.TextChanged, AddressOf EndDate_TextChanged + + AddHandler Me.Mission.TextChanged, AddressOf Mission_TextChanged + + AddHandler Me.Ref1.TextChanged, AddressOf Ref1_TextChanged + + AddHandler Me.RefDate.TextChanged, AddressOf RefDate_TextChanged + + AddHandler Me.StartDate.TextChanged, AddressOf StartDate_TextChanged + + + End Sub + + + Public Overridable Sub LoadData() + + ' Load the data from the database into the DataSource PersonalDD 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 = PersonalDDTable.GetRecord(Me.RecordUniqueId, True) + + Return + End If + + ' Since this is a row in the table, the data for this row is loaded by the + ' LoadData method of the BasePersonalDDTableControl when the data for the entire + ' table is loaded. + + Me.DataSource = New PersonalDDRecord() + + + + End Sub + + ' Populate the UI controls using the DataSource. To customize, override this method in PersonalDDTableControlRow. + 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 + + SetEndDate() + SetMission() + + + SetRef1() + SetRefDate() + SetStartDate() + + + Me.IsNewRecord = True + + If Me.DataSource.IsCreated Then + Me.IsNewRecord = False + + Me.RecordUniqueId = Me.DataSource.GetID.ToXmlString() + End If + + ' Now load data for each record and table child UI controls. + ' Ordering is important because child controls get + ' their parent ids from their parent UI controls. + Dim shouldResetControl As Boolean = False + + End Sub + + + Public Overridable Sub SetEndDate() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.EndDate.ID) Then + + Me.EndDate.Text = Me.PreviousUIData(Me.EndDate.ID).ToString() + + Return + End If + + + ' Set the EndDate TextBox on the webpage with value from the + ' PersonalDD database record. + + ' Me.DataSource is the PersonalDD record retrieved from the database. + ' Me.EndDate is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetEndDate() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.EndDateSpecified Then + + ' If the EndDate is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalDDTable.EndDate, "d MMM yy") + + Me.EndDate.Text = formattedValue + + Else + + ' EndDate is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.EndDate.Text = PersonalDDTable.EndDate.Format(PersonalDDTable.EndDate.DefaultValue, "d MMM yy") + + End If + + End Sub + + Public Overridable Sub SetMission() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.Mission.ID) Then + + Me.Mission.Text = Me.PreviousUIData(Me.Mission.ID).ToString() + + Return + End If + + + ' Set the Mission TextBox on the webpage with value from the + ' PersonalDD database record. + + ' Me.DataSource is the PersonalDD record retrieved from the database. + ' Me.Mission is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetMission() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.MissionSpecified Then + + ' If the Mission is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalDDTable.Mission) + + Me.Mission.Text = formattedValue + + Else + + ' Mission is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.Mission.Text = PersonalDDTable.Mission.Format(PersonalDDTable.Mission.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetRef1() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.Ref1.ID) Then + + Me.Ref1.Text = Me.PreviousUIData(Me.Ref1.ID).ToString() + + Return + End If + + + ' Set the Ref TextBox on the webpage with value from the + ' PersonalDD database record. + + ' Me.DataSource is the PersonalDD 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(PersonalDDTable.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 = PersonalDDTable.Ref0.Format(PersonalDDTable.Ref0.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetRefDate() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.RefDate.ID) Then + + Me.RefDate.Text = Me.PreviousUIData(Me.RefDate.ID).ToString() + + Return + End If + + + ' Set the RefDate TextBox on the webpage with value from the + ' PersonalDD database record. + + ' Me.DataSource is the PersonalDD 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(PersonalDDTable.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 = PersonalDDTable.RefDate.Format(PersonalDDTable.RefDate.DefaultValue, "d MMM yy") + + End If + + End Sub + + Public Overridable Sub SetStartDate() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.StartDate.ID) Then + + Me.StartDate.Text = Me.PreviousUIData(Me.StartDate.ID).ToString() + + Return + End If + + + ' Set the StartDate TextBox on the webpage with value from the + ' PersonalDD database record. + + ' Me.DataSource is the PersonalDD record retrieved from the database. + ' Me.StartDate is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetStartDate() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.StartDateSpecified Then + + ' If the StartDate is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalDDTable.StartDate, "d MMM yy") + + Me.StartDate.Text = formattedValue + + Else + + ' StartDate is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.StartDate.Text = PersonalDDTable.StartDate.Format(PersonalDDTable.StartDate.DefaultValue, "d MMM yy") + + End If + + End Sub + + + Public EvaluateFormulaDelegate As BaseClasses.Data.DataSource.EvaluateFormulaDelegate = New BaseClasses.Data.DataSource.EvaluateFormulaDelegate(AddressOf Me.EvaluateFormula) + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean, ByVal e As FormulaEvaluator) As String + If e Is Nothing Then + e = New FormulaEvaluator() + End If + + e.Variables.Clear() + + + ' add variables for formula evaluation + If variables IsNot Nothing Then + Dim enumerator As System.Collections.Generic.IEnumerator(Of System.Collections.Generic.KeyValuePair(Of String, Object)) = variables.GetEnumerator() + While enumerator.MoveNext() + e.Variables.Add(enumerator.Current.Key, enumerator.Current.Value) + End While + End If + + If includeDS + + End IF + + + ' Other variables referred to in the formula are expected to be + ' properties of the DataSource. For example, referring to + ' UnitPrice as a variable will refer to DataSource.UnitPrice + If dataSourceForEvaluate Is Nothing Then + + e.DataSource = Me.DataSource + + Else + e.DataSource = dataSourceForEvaluate + End If + + ' Define the calling control. This is used to add other + ' related table and record controls as variables. + e.CallingControl = Me + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + + If Not String.IsNullOrEmpty(format) AndAlso (String.IsNullOrEmpty(formula) OrElse formula.IndexOf("Format(") < 0) Then + Return FormulaUtils.Format(resultObj, format) + Else + Return resultObj.ToString() + End If + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format,variables ,includeDS, Nothing) + End Function + + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object)) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format, variables ,True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, format, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal e as FormulaEvaluator) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, variables, True, e) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal includeDS as Boolean) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, includeDS, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, True, Nothing) + End Function + + + Public Overridable Sub RegisterPostback() + + + End Sub + + + + ' To customize, override this method in PersonalDDTableControlRow. + 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 parentCtrl As PersonalIdRecordControl + + + parentCtrl = DirectCast(Me.Page.FindControlRecursively("PersonalIdRecordControl"), PersonalIdRecordControl) + + If (Not IsNothing(parentCtrl) AndAlso IsNothing(parentCtrl.DataSource)) + ' Load the record if it is not loaded yet. + parentCtrl.LoadData() + End If + If (IsNothing(parentCtrl) OrElse IsNothing(parentCtrl.DataSource)) + ' Get the error message from the application resource file. + Throw New Exception(Page.GetResourceValue("Err:NoParentRecId", "Persons")) + End If + + Me.DataSource.PersonalId = parentCtrl.DataSource.PersonalId + + ' 2. Perform any custom validation. + Me.Validate() + + + ' 3. Set the values in the record with data from UI controls. + ' This calls the Get() method for each of the user interface controls. + Me.GetUIData() + + ' 4. Save in the database. + ' We should not save the record if the data did not change. This + ' will save a database hit and avoid triggering any database triggers. + + If Me.DataSource.IsAnyValueChanged Then + ' Save record to database but do not commit yet. + ' Auto generated ids are available after saving for use by child (dependent) records. + Me.DataSource.Save() + + DirectCast(GetParentControlObject(Me, "PersonalDDTableControl"), PersonalDDTableControl).DataChanged = True + DirectCast(GetParentControlObject(Me, "PersonalDDTableControl"), PersonalDDTableControl).ResetData = True + End If + + + ' update session or cookie by formula + + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + ' For Master-Detail relationships, save data on the Detail table(s) + + End Sub + + ' To customize, override this method in PersonalDDTableControlRow. + 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. + + GetEndDate() + GetMission() + GetRef1() + GetRefDate() + GetStartDate() + End Sub + + + Public Overridable Sub GetEndDate() + + ' Retrieve the value entered by the user on the EndDate ASP:TextBox, and + ' save it into the EndDate field in DataSource PersonalDD 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.EndDate.Text, PersonalDDTable.EndDate) + + + End Sub + + Public Overridable Sub GetMission() + + ' Retrieve the value entered by the user on the Mission ASP:TextBox, and + ' save it into the Mission field in DataSource PersonalDD record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.Mission.Text, PersonalDDTable.Mission) + + + 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 PersonalDD record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.Ref1.Text, PersonalDDTable.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 PersonalDD 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, PersonalDDTable.RefDate) + + + End Sub + + Public Overridable Sub GetStartDate() + + ' Retrieve the value entered by the user on the StartDate ASP:TextBox, and + ' save it into the StartDate field in DataSource PersonalDD 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.StartDate.Text, PersonalDDTable.StartDate) + + + End Sub + + + ' To customize, override this method in PersonalDDTableControlRow. + + Public Overridable Function CreateWhereClause() As WhereClause + + Return Nothing + + End Function + + + + ' To customize, override this method in PersonalDDTableControlRow. + 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) + PersonalDDTable.DeleteRecord(pkValue) + + DirectCast(GetParentControlObject(Me, "PersonalDDTableControl"), PersonalDDTableControl).DataChanged = True + DirectCast(GetParentControlObject(Me, "PersonalDDTableControl"), PersonalDDTableControl).ResetData = True + End Sub + + Protected Overridable Sub Control_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.PreRender + ' PreRender event is raised just before page is being displayed. + Try + DbUtils.StartTransaction() + Me.RegisterPostback() + + If Not Me.Page.ErrorOnPage AndAlso (Me.Page.IsPageRefresh OrElse Me.DataChanged OrElse Me.ResetData) Then + + + ' Re-load the data and update the web page if necessary. + ' This is typically done during a postback (filter, search button, sort, pagination button). + ' In each of the other click handlers, simply set DataChanged to True to reload the data. + Me.LoadData() + Me.DataBind() + End If + + + Catch ex As Exception + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + Finally + DbUtils.EndTransaction() + End Try + End Sub + + + Protected Overrides Sub SaveControlsToSession() + MyBase.SaveControlsToSession() + + + 'Save pagination state to session. + + End Sub + + + + Protected Overrides Sub ClearControlsFromSession() + MyBase.ClearControlsFromSession() + + + + ' Clear pagination state from session. + + End Sub + + Protected Overrides Sub LoadViewState(ByVal savedState As Object) + MyBase.LoadViewState(savedState) + Dim isNewRecord As String = CType(ViewState("IsNewRecord"), String) + If Not isNewRecord Is Nothing AndAlso isNewRecord.Trim <> "" Then + Me.IsNewRecord = Boolean.Parse(isNewRecord) + End If + + Dim myCheckSum As String = CType(ViewState("CheckSum"), String) + If Not myCheckSum Is Nothing AndAlso myCheckSum.Trim <> "" Then + Me.CheckSum = myCheckSum + End If + + + ' Load view state for pagination control. + + End Sub + + Protected Overrides Function SaveViewState() As Object + ViewState("IsNewRecord") = Me.IsNewRecord.ToString() + ViewState("CheckSum") = Me.CheckSum + + + ' Load view state for pagination control. + + Return MyBase.SaveViewState() + End Function + + + ' event handler for ImageButton + Public Overridable Sub PersonalDDRowDeleteButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + If(Not Me.Page.IsPageRefresh) Then + + Dim tc As PersonalDDTableControl = DirectCast(GetParentControlObject(Me, "PersonalDDTableControl"), PersonalDDTableControl) + If Not (IsNothing(tc)) Then + If Not Me.IsNewRecord Then + tc.AddToDeletedRecordIds(DirectCast(Me, PersonalDDTableControlRow)) + End If + Me.Visible = False + tc.SetFormulaControls() + End If + + End If + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + Protected Overridable Sub EndDate_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub Mission_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 StartDate_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("BasePersonalDDTableControlRow_Rec"), String) + End Get + Set(ByVal value As String) + Me.ViewState("BasePersonalDDTableControlRow_Rec") = value + End Set + End Property + + Private _DataSource As PersonalDDRecord + Public Property DataSource() As PersonalDDRecord + Get + Return Me._DataSource + End Get + + Set(ByVal value As PersonalDDRecord) + + Me._DataSource = value + End Set + End Property + + + + Private _checkSum As String + Public Overridable Property CheckSum() As String + Get + Return Me._checkSum + End Get + Set(ByVal value As String) + Me._checkSum = value + End Set + End Property + + Private _TotalPages As Integer + Public Property TotalPages() As Integer + Get + Return Me._TotalPages + End Get + Set(ByVal value As Integer) + Me._TotalPages = value + End Set + End Property + + Private _PageIndex As Integer + Public Property PageIndex() As Integer + Get + ' Return the PageIndex + Return Me._PageIndex + End Get + Set(ByVal value As Integer) + Me._PageIndex = value + End Set + End Property + + Private _DisplayLastPage As Boolean + Public Property DisplayLastPage() As Boolean + Get + Return Me._DisplayLastPage + End Get + Set(ByVal value As Boolean) + Me._DisplayLastPage = value + End Set + End Property + + + +#Region "Helper Properties" + + Public ReadOnly Property EndDate() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "EndDate"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property Mission() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Mission"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property PersonalDDRecordRowSelection() As System.Web.UI.WebControls.CheckBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalDDRecordRowSelection"), System.Web.UI.WebControls.CheckBox) + End Get + End Property + + Public ReadOnly Property PersonalDDRowDeleteButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalDDRowDeleteButton"), System.Web.UI.WebControls.ImageButton) + 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 StartDate() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "StartDate"), System.Web.UI.WebControls.TextBox) + 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 PersonalDDRecord = 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 PersonalDDRecord + If Not Me.DataSource Is Nothing Then + Return Me.DataSource + End If + + If Not Me.RecordUniqueId Is Nothing Then + + Return PersonalDDTable.GetRecord(Me.RecordUniqueId, True) + + End If + + ' Localization. + + Return Nothing + + End Function + + Public Shadows ReadOnly Property Page() As BaseApplicationPage + Get + Return DirectCast(MyBase.Page, BaseApplicationPage) + End Get + End Property + +#End Region + +End Class + + + +' Base class for the PersonalDDTableControl control on the AddPersonalId page. +' Do not modify this class. Instead override any method in PersonalDDTableControl. +Public Class BasePersonalDDTableControl + Inherits Persons.UI.BaseApplicationTableControl + + + + Protected Overridable Sub Control_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Init + + + + ' Setup the filter and search events. + + + + ' Control Initializations. + ' Initialize the table's current sort order. + + If Me.InSession(Me, "Order_By") Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + End If + + + + ' Setup default pagination settings. + + Me.PageSize = CInt(Me.GetFromSession(Me, "Page_Size", "10")) + Me.PageIndex = CInt(Me.GetFromSession(Me, "Page_Index", "0")) + + + + Me.ClearControlsFromSession() + End Sub + + Protected Overridable Sub Control_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load + + SaveControlsToSession_Ajax() + + ' Show confirmation message on Click + Me.PersonalDDDeleteButton.Attributes.Add("onClick", "return (confirm('" & (CType(Me.Page,BaseApplicationPage)).GetResourceValue("DeleteConfirm", "Persons") & "'));") + + ' Setup the pagination events. + + AddHandler Me.PersonalDDPagination.FirstPage.Click, AddressOf PersonalDDPagination_FirstPage_Click + + AddHandler Me.PersonalDDPagination.LastPage.Click, AddressOf PersonalDDPagination_LastPage_Click + + AddHandler Me.PersonalDDPagination.NextPage.Click, AddressOf PersonalDDPagination_NextPage_Click + + AddHandler Me.PersonalDDPagination.PageSizeButton.Click, AddressOf PersonalDDPagination_PageSizeButton_Click + + AddHandler Me.PersonalDDPagination.PreviousPage.Click, AddressOf PersonalDDPagination_PreviousPage_Click + + + ' Setup the sorting events. + + AddHandler Me.EndDateLabel1.Click, AddressOf EndDateLabel1_Click + + AddHandler Me.MissionLabel.Click, AddressOf MissionLabel_Click + + AddHandler Me.RefDateLabel.Click, AddressOf RefDateLabel_Click + + AddHandler Me.RefLabel.Click, AddressOf RefLabel_Click + + AddHandler Me.StartDateLabel1.Click, AddressOf StartDateLabel1_Click + + ' Setup the button events. + + AddHandler Me.PersonalDDAddButton.Click, AddressOf PersonalDDAddButton_Click + + AddHandler Me.PersonalDDDeleteButton.Click, AddressOf PersonalDDDeleteButton_Click + + AddHandler Me.PersonalDDResetButton.Click, AddressOf PersonalDDResetButton_Click + + + ' Setup events for others + + End Sub + + + Public Overridable Sub LoadData() + + ' Read data from database. Returns an array of records that can be assigned + ' to the DataSource table control property. + Try + Dim joinFilter As CompoundFilter = CreateCompoundJoinFilter() + + ' The WHERE clause will be empty when displaying all records in table. + Dim wc As WhereClause = CreateWhereClause() + If wc IsNot Nothing AndAlso Not wc.RunQuery Then + ' Initialize an empty array of records + Dim alist As New ArrayList(0) + Me.DataSource = DirectCast(alist.ToArray(GetType(PersonalDDRecord)), PersonalDDRecord()) + ' Add records to the list if needed. + Me.AddNewRecords() + Me._TotalRecords = 0 + Me._TotalPages = 0 + Return + End If + + ' Call OrderBy to determine the order - either use the order defined + ' on the Query Wizard, or specified by user (by clicking on column heading) + Dim orderBy As OrderBy = CreateOrderBy() + + ' Get the pagesize from the pagesize control. + Me.GetPageSize() + + If Me.DisplayLastPage Then + Dim totalRecords As Integer = If(Me._TotalRecords < 0, PersonalDDTable.GetRecordCount(CreateCompoundJoinFilter(), CreateWhereClause()), Me._TotalRecords) + + Dim totalPages As Integer = CInt(Math.Ceiling(totalRecords / Me.PageSize)) + + Me.PageIndex = totalPages - 1 + End If + + ' Make sure PageIndex (current page) and PageSize are within bounds. + If Me.PageIndex < 0 Then + Me.PageIndex = 0 + End If + If Me.PageSize < 1 Then + Me.PageSize = 1 + End If + + ' Retrieve the records and set the table DataSource. + ' Only PageSize records are fetched starting at PageIndex (zero based). + If Me.AddNewRecord > 0 Then + ' Make sure to preserve the previously entered data on new rows. + Dim postdata As New ArrayList + For Each rc As PersonalDDTableControlRow In Me.GetRecordControls() + If Not rc.IsNewRecord Then + rc.DataSource = rc.GetRecord() + rc.GetUIData() + postdata.Add(rc.DataSource) + UIData.Add(rc.PreservedUIData()) + End If + Next + Me.DataSource = DirectCast(postdata.ToArray(GetType(PersonalDDRecord)), PersonalDDRecord()) + Else ' Get the records from the database + Me.DataSource = PersonalDDTable.GetRecords(joinFilter, wc, orderBy, Me.PageIndex, Me.PageSize) + + End If + + ' if the datasource contains no records contained in database, then load the last page. + If (DbUtils.GetCreatedRecords(Me.DataSource).Length = 0 AndAlso Not Me.DisplayLastPage) Then + Me.DisplayLastPage = True + LoadData() + Else + + ' Add any new rows desired by the user. + Me.AddNewRecords() + + ' Turn off the ToggleAll checkbox + Me.PersonalDDToggleAll.Checked = False + + + ' Initialize the page and grand totals. now + + End If + + Catch ex As Exception + ' Report the error message to the end user + Dim msg As String = ex.Message + If ex.InnerException IsNot Nothing Then + msg = msg & " InnerException: " & ex.InnerException.Message + End If + Throw New Exception(msg, ex.InnerException) + End Try + End Sub + + + + + Public Overrides Sub DataBind() + ' The DataBind method binds the user interface controls to the values + ' from the database record for each row in the table. To do this, it calls the + ' DataBind for each of the rows. + ' DataBind also populates any filters above the table, and sets the pagination + ' control to the correct number of records and the current page number. + + MyBase.DataBind() + + ' Make sure that the DataSource is initialized. + If Me.DataSource Is Nothing Then + Return + End If + + 'LoadData for DataSource for chart and report if they exist + + ' Setup the pagination controls. + BindPaginationControls() + + + + ' Bind the repeater with the list of records to expand the UI. + Dim rep As System.Web.UI.WebControls.Repeater = CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalDDTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return + rep.DataSource = DataSource() + rep.DataBind() + + Dim index As Integer = 0 + For Each repItem As System.Web.UI.WebControls.RepeaterItem In rep.Items + ' Loop through all rows in the table, set its DataSource and call DataBind(). + Dim recControl As PersonalDDTableControlRow = DirectCast(repItem.FindControl("PersonalDDTableControlRow"), PersonalDDTableControlRow) + recControl.DataSource = Me.DataSource(index) + If Me.UIData.Count > index Then + recControl.PreviousUIData = Me.UIData(index) + End If + recControl.DataBind() + recControl.Visible = Not Me.InDeletedRecordIds(recControl) + + index += 1 + Next + + + + + ' Call the Set methods for each controls on the panel + + SetEndDateLabel1() + SetMissionLabel() + + + + + SetPersonalDDTableControlCollapsibleRegion() + + SetRefDateLabel() + SetRefLabel() + SetStartDateLabel1() + ' setting the state of expand or collapse alternative rows + + + ' Load data for each record and table UI control. + ' Ordering is important because child controls get + ' their parent ids from their parent UI controls. + + + ' this method calls the set method for controls with special formula like running total, sum, rank, etc + SetFormulaControls() + End Sub + + Public Overridable Sub SetFormulaControls() + ' this method calls Set methods for the control that has special formula + + + + End Sub + + + + Public Overridable Sub RegisterPostback() + + + End Sub + + Public EvaluateFormulaDelegate As BaseClasses.Data.DataSource.EvaluateFormulaDelegate = New BaseClasses.Data.DataSource.EvaluateFormulaDelegate(AddressOf Me.EvaluateFormula) + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean, ByVal e as FormulaEvaluator) As String + If e Is Nothing + e = New FormulaEvaluator() + End If + + e.Variables.Clear() + + + ' add variables for formula evaluation + If variables IsNot Nothing Then + Dim enumerator As System.Collections.Generic.IEnumerator(Of System.Collections.Generic.KeyValuePair(Of String, Object)) = variables.GetEnumerator() + While enumerator.MoveNext() + e.Variables.Add(enumerator.Current.Key, enumerator.Current.Value) + End While + End If + + If includeDS + + End If + + ' All variables referred to in the formula are expected to be + ' properties of the DataSource. For example, referring to + ' UnitPrice as a variable will refer to DataSource.UnitPrice + e.DataSource = dataSourceForEvaluate + + ' Define the calling control. This is used to add other + ' related table and record controls as variables. + e.CallingControl = Me + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + + If Not String.IsNullOrEmpty(format) AndAlso (String.IsNullOrEmpty(formula) OrElse formula.IndexOf("Format(") < 0) Then + Return FormulaUtils.Format(resultObj, format) + Else + Return resultObj.ToString() + End If + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format,variables ,includeDS, Nothing) + End Function + + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object)) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format, variables ,True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, format, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal e as FormulaEvaluator) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, variables, True, e) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal includeDS as Boolean) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, includeDS, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, True, Nothing) + End Function + + + + + Public Overridable Sub ResetControl() + + Me.CurrentSortOrder.Reset() + If (Me.InSession(Me, "Order_By")) Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + End If + + Me.PageIndex = 0 + End Sub + + Protected Overridable Sub BindPaginationControls() + ' Setup the pagination controls. + + ' Bind the pagination labels. + + If DbUtils.GetCreatedRecords(Me.DataSource).Length > 0 Then + + Me.PersonalDDPagination.CurrentPage.Text = (Me.PageIndex + 1).ToString() + Else + Me.PersonalDDPagination.CurrentPage.Text = "0" + End If + Me.PersonalDDPagination.PageSize.Text = Me.PageSize.ToString() + Me.PersonalDDPagination.TotalItems.Text = Me.TotalRecords.ToString() + Me.PersonalDDPagination.TotalPages.Text = Me.TotalPages.ToString() + + ' Bind the buttons for PersonalDDTableControl pagination. + + Me.PersonalDDPagination.FirstPage.Enabled = Not (Me.PageIndex = 0) + If Me._TotalPages < 0 Then ' if the total pages is not determined yet, enable last and next buttons + Me.PersonalDDPagination.LastPage.Enabled = True + ElseIf Me._TotalPages = 0 ' if the total pages is determined and it is 0, enable last and next buttons + Me.PersonalDDPagination.LastPage.Enabled = False + Else ' if the total pages is the last page, disable last and next buttons + Me.PersonalDDPagination.LastPage.Enabled = Not (Me.PageIndex = Me.TotalPages - 1) + End If + + If Me._TotalPages < 0 Then ' if the total pages is not determined yet, enable last and next buttons + Me.PersonalDDPagination.NextPage.Enabled = True + ElseIf Me._TotalPages = 0 ' if the total pages is determined and it is 0, enable last and next buttons + Me.PersonalDDPagination.NextPage.Enabled = False + Else ' if the total pages is the last page, disable last and next buttons + Me.PersonalDDPagination.NextPage.Enabled = Not (Me.PageIndex = Me.TotalPages - 1) + End If + + Me.PersonalDDPagination.PreviousPage.Enabled = Not (Me.PageIndex = 0) + + + End Sub + + Public Overridable Sub SaveData() + ' Save the data from the entire table. Calls each row's Save Data + ' to save their data. This function is called by the Click handler of the + ' Save button. The button handler should Start/Commit/End a transaction. + + Dim recCtl As PersonalDDTableControlRow + For Each recCtl In Me.GetRecordControls() + + If Me.InDeletedRecordIds(recCtl) Then + ' Delete any pending deletes. + recCtl.Delete() + Else + If recCtl.Visible Then + recCtl.SaveData() + End If + End If + + Next + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + ' Set IsNewRecord to False for all records - since everything has been saved and is no longer "new" + For Each recCtl In Me.GetRecordControls() + recCtl.IsNewRecord = False + Next + + + ' Set DeletedRecordsIds to Nothing since we have deleted all pending deletes. + Me.DeletedRecordIds = Nothing + + End Sub + + Public Overridable Function CreateCompoundJoinFilter() As CompoundFilter + Dim jFilter As CompoundFilter = New CompoundFilter() + + Return jFilter + + End Function + + + Public Overridable Function CreateOrderBy() As OrderBy + ' The CurrentSortOrder is initialized to the sort order on the + ' Query Wizard. It may be modified by the Click handler for any of + ' the column heading to sort or reverse sort by that column. + ' You can add your own sort order, or modify it on the Query Wizard. + Return Me.CurrentSortOrder + End Function + + Public Overridable Function CreateWhereClause() As WhereClause + 'This CreateWhereClause is used for loading the data. + PersonalDDTable.Instance.InnerFilter = Nothing + Dim wc As WhereClause = New WhereClause() + + ' Compose the WHERE clause consiting of: + ' 1. Static clause defined at design time. + ' 2. User selected search criteria. + ' 3. User selected filter criteria. + + + Dim selectedRecordKeyValue as KeyValue = New KeyValue() + + Dim personalIdRecordControlObj As Persons.UI.Controls.AddPersonalId.PersonalIdRecordControl = DirectCast(MiscUtils.FindControlRecursively(Me.Page, "PersonalIdRecordControl"), Persons.UI.Controls.AddPersonalId.PersonalIdRecordControl) + + If (Not IsNothing(personalIdRecordControlObj) AndAlso Not IsNothing(personalIdRecordControlObj.GetRecord()) AndAlso personalIdRecordControlObj.GetRecord().IsCreated AndAlso Not IsNothing(personalIdRecordControlObj.GetRecord().PersonalId)) + wc.iAND(PersonalDDTable.PersonalId, BaseFilter.ComparisonOperator.EqualsTo, personalIdRecordControlObj.GetRecord().PersonalId.ToString()) + selectedRecordKeyValue.AddElement(PersonalDDTable.PersonalId.InternalName, personalIdRecordControlObj.GetRecord().PersonalId.ToString()) + Else + wc.RunQuery = False + Return wc + End If + + HttpContext.Current.Session("PersonalDDTableControlWhereClause") = selectedRecordKeyValue.ToXmlString() + + Return wc + End Function + + + Public Overridable Function CreateWhereClause(ByVal searchText as String, ByVal fromSearchControl as String, ByVal AutoTypeAheadSearch as String, ByVal AutoTypeAheadWordSeparators as String) As WhereClause + ' This CreateWhereClause is used for loading list of suggestions for Auto Type-Ahead feature. + PersonalDDTable.Instance.InnerFilter = Nothing + Dim wc As WhereClause = New WhereClause() + + ' Compose the WHERE clause consiting of: + ' 1. Static clause defined at design time. + ' 2. User selected search criteria. + ' 3. User selected filter criteria. + + Dim appRelativeVirtualPath As String = CType(HttpContext.Current.Session("AppRelativeVirtualPath"), String) + + Dim selectedRecordInPersonalIdRecordControl as String = DirectCast(HttpContext.Current.Session("PersonalDDTableControlWhereClause"), String) + + If Not selectedRecordInPersonalIdRecordControl Is Nothing AndAlso KeyValue.IsXmlKey(selectedRecordInPersonalIdRecordControl) Then + Dim selectedRecordKeyValue as KeyValue = KeyValue.XmlToKey(selectedRecordInPersonalIdRecordControl) + + If Not IsNothing(selectedRecordKeyValue) AndAlso selectedRecordKeyValue.ContainsColumn(PersonalDDTable.PersonalId) Then + wc.iAND(PersonalDDTable.PersonalId, BaseFilter.ComparisonOperator.EqualsTo, selectedRecordKeyValue.GetColumnValue(PersonalDDTable.PersonalId).ToString()) + End If + + End If + + ' Adds clauses if values are selected in Filter controls which are configured in the page. + + + Return wc + End Function + + + Public Overridable Function FormatSuggestions(ByVal prefixText As String, ByVal resultItem As String, _ + ByVal columnLength As Integer, ByVal AutoTypeAheadDisplayFoundText As String, _ + ByVal autoTypeAheadSearch As String, ByVal AutoTypeAheadWordSeparators As String, _ + ByVal resultList As ArrayList) As Boolean + + 'Formats the resultItem and adds it to the list of suggestions. + Dim index As Integer = resultItem.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture).IndexOf(prefixText.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture)) + Dim itemToAdd As String = "" + Dim isFound As Boolean = False + Dim isAdded As Boolean = False + ' Get the index where prfixt is at the beginning of resultItem. If not found then, index of word which begins with prefixText. + If InvariantLCase(autoTypeAheadSearch).equals("wordsstartingwithsearchstring") And Not index = 0 Then + ' Expression to find word which contains AutoTypeAheadWordSeparators followed by prefixText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex( AutoTypeAheadWordSeparators + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + If regex1.IsMatch(resultItem) Then + index = regex1.Match(resultItem).Index + isFound = True + End If + ' If the prefixText is found immediatly after white space then starting of the word is found so don not search any further + If not resultItem(index).ToString() = " " Then + ' Expression to find beginning of the word which contains AutoTypeAheadWordSeparators followed by prefixText + Dim regex As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\\S*" + AutoTypeAheadWordSeparators + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + If regex.IsMatch(resultItem) Then + index = regex.Match(resultItem).Index + isFound = True + End If + End If + End If + + ' If autoTypeAheadSearch value is wordsstartingwithsearchstring then, extract the substring only if the prefixText is found at the + ' beginning of the resultItem (index = 0) or a word in resultItem is found starts with prefixText. + If index = 0 Or isFound Or InvariantLCase(autoTypeAheadSearch).Equals("anywhereinstring") then + If InvariantLCase(AutoTypeAheadDisplayFoundText).equals("atbeginningofmatchedstring") Then + ' Expression to find beginning of the word which contains prefixText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\\S*" + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + ' Find the beginning of the word which contains prefexText + If (StringUtils.InvariantLCase(autoTypeAheadSearch).Equals("anywhereinstring") AndAlso regex1.IsMatch(resultItem)) Then + index = regex1.Match(resultItem).Index + isFound = True + End If + ' Display string from the index till end of the string if sub string from index till end is less than columnLength value. + If Len(resultItem) - index <= columnLength Then + If index = 0 Then + itemToAdd = resultItem + Else + itemToAdd = "..." & resultItem.Substring(index, Len(resultItem) - index) + End If + Else + If index = 0 Then + itemToAdd = resultItem.Substring(index, (columnLength - 3)) & "..." + Else + 'Truncate the string to show only columnLength - 6 characters as begining and trailing "..." has to be appended. + itemToAdd = "..." & resultItem.Substring(index , columnLength - 6) & "..." + End If + End If + ElseIf InvariantLCase(AutoTypeAheadDisplayFoundText).equals("inmiddleofmatchedstring") Then + Dim subStringBeginIndex As Integer = CType(columnLength/2, Integer) + If Len(resultItem) <= columnLength Then + itemToAdd = resultItem + Else + ' Sanity check at end of the string + If index + Len(prefixText) = columnLength Then + itemToAdd = "..." & resultItem.Substring(index-columnLength,index) + ElseIf Len(resultItem) - index < subStringBeginIndex Then + ' Display string from the end till columnLength value if, index is closer to the end of the string. + itemToAdd = "..." & resultItem.Substring(Len(resultItem)-columnLength,Len(resultItem)) + ElseIf index <= subStringBeginIndex Then + ' Sanity chet at beginning of the string + itemToAdd = resultItem.Substring(0, columnLength) & "..." + Else + ' Display string containing text before the prefixText occures and text after the prefixText + itemToAdd = "..." & resultItem.Substring(index - subStringBeginIndex, columnLength) & "..." + End If + End If + ElseIf InvariantLCase(AutoTypeAheadDisplayFoundText).equals("atendofmatchedstring") Then + ' Expression to find ending of the word which contains prefexText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\s", System.Text.RegularExpressions.RegexOptions.IgnoreCase) + ' Find the ending of the word which contains prefexText + If regex1.IsMatch(resultItem, index + 1) Then + index = regex1.Match(resultItem, index + 1).Index + Else + ' If the word which contains prefexText is the last word in string, regex1.IsMatch returns false. + index = resultItem.Length + End If + If index > Len(resultItem) Then + index = Len(resultItem) + End If + ' If text from beginning of the string till index is less than columnLength value then, display string from the beginning till index. + If index <= columnLength Then + if index = Len(resultItem) Then 'Make decision to append "..." + itemToAdd = resultItem.Substring(0,index) + Else + itemToAdd = resultItem.Substring(0,index) & "..." + End If + Else + If index = Len(resultItem) Then + itemToAdd = "..." & resultItem.Substring(index - (columnLength - 3), (columnLength - 3)) + Else + 'Truncate the string to show only columnLength - 6 characters as begining and trailing "..." has to be appended. + itemToAdd = "..." & resultItem.Substring(index - (columnLength - 6), columnLength - 6) & "..." + End If + End If + End If + + ' Remove newline character from itemToAdd + Dim prefixTextIndex As Integer = itemToAdd.IndexOf(prefixText, StringComparison.CurrentCultureIgnoreCase) + ' If itemToAdd contains any newline after the search text then show text only till newline + Dim regex2 As System.Text.RegularExpressions.Regex = New System.Text.RegularExpressions.Regex("(" & vbCrLf & "|" & vbLf & ")", System.Text.RegularExpressions.RegexOptions.IgnoreCase) + Dim newLineIndexAfterPrefix As Integer = -1 + If regex2.IsMatch(itemToAdd, prefixTextIndex) Then + newLineIndexAfterPrefix = regex2.Match(itemToAdd, prefixTextIndex).Index + End If + If (newLineIndexAfterPrefix > -1) Then + If itemToAdd.EndsWith("...") Then + itemToAdd = (itemToAdd.Substring(0, newLineIndexAfterPrefix) + "...") + Else + itemToAdd = itemToAdd.Substring(0, newLineIndexAfterPrefix) + End If + End If + ' If itemToAdd contains any newline before search text then show text which comes after newline + Dim regex3 As System.Text.RegularExpressions.Regex = New System.Text.RegularExpressions.Regex("(" & vbCrLf & "|" & vbLf & ")", (System.Text.RegularExpressions.RegexOptions.IgnoreCase Or System.Text.RegularExpressions.RegexOptions.RightToLeft)) + Dim newLineIndexBeforePrefix As Integer = -1 + If regex3.IsMatch(itemToAdd, prefixTextIndex) Then + newLineIndexBeforePrefix = regex3.Match(itemToAdd, prefixTextIndex).Index + End If + If (newLineIndexBeforePrefix > -1) Then + If itemToAdd.StartsWith("...") Then + itemToAdd = ("..." + itemToAdd.Substring((newLineIndexBeforePrefix + regex3.Match(itemToAdd, prefixTextIndex).Length))) + Else + itemToAdd = itemToAdd.Substring((newLineIndexBeforePrefix + regex3.Match(itemToAdd, prefixTextIndex).Length)) + End If + End If + + If Not itemToAdd is nothing AndAlso Not resultList.Contains(itemToAdd) Then + + resultList.Add(itemToAdd) + + isAdded = true + End If + End If + Return isAdded + End Function + + + Protected Overridable Sub GetPageSize() + + If Me.PersonalDDPagination.PageSize.Text.Trim <> "" Then + Try + 'Me.PageSize = Integer.Parse(Me.PersonalDDPagination.PageSize.Text) + Catch ex As Exception + End Try + End If + End Sub + + Protected Overridable Sub AddNewRecords() + + Dim newRecordList As ArrayList = New ArrayList() + + Dim newUIDataList As System.Collections.Generic.List(Of Hashtable) = New System.Collections.Generic.List(Of Hashtable)() + + ' Loop though all the record controls and if the record control + ' does not have a unique record id set, then create a record + ' and add to the list. + If Not Me.ResetData Then + Dim rep As System.Web.UI.WebControls.Repeater = CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalDDTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return + + Dim repItem As System.Web.UI.WebControls.RepeaterItem + For Each repItem In rep.Items + ' Loop through all rows in the table, set its DataSource and call DataBind(). + + Dim recControl As PersonalDDTableControlRow = DirectCast(repItem.FindControl("PersonalDDTableControlRow"), PersonalDDTableControlRow) + + If recControl.Visible AndAlso recControl.IsNewRecord() Then + + Dim rec As PersonalDDRecord = New PersonalDDRecord() + + If recControl.EndDate.Text <> "" Then + rec.Parse(recControl.EndDate.Text, PersonalDDTable.EndDate) + End If + If recControl.Mission.Text <> "" Then + rec.Parse(recControl.Mission.Text, PersonalDDTable.Mission) + End If + If recControl.Ref1.Text <> "" Then + rec.Parse(recControl.Ref1.Text, PersonalDDTable.Ref0) + End If + If recControl.RefDate.Text <> "" Then + rec.Parse(recControl.RefDate.Text, PersonalDDTable.RefDate) + End If + If recControl.StartDate.Text <> "" Then + rec.Parse(recControl.StartDate.Text, PersonalDDTable.StartDate) + End If + newUIDataList.Add(recControl.PreservedUIData()) + newRecordList.Add(rec) + End If + Next + End If + + + ' Add any new record to the list. + Dim index As Integer = 0 + For index = 1 To Me.AddNewRecord + + newRecordList.Insert(0, New PersonalDDRecord()) + newUIDataList.Insert(0, New Hashtable()) + + Next + Me.AddNewRecord = 0 + + ' Finally, add any new records to the DataSource. + If newRecordList.Count > 0 Then + + Dim finalList As ArrayList = New ArrayList(Me.DataSource) + finalList.InsertRange(0, newRecordList) + + Me.DataSource = DirectCast(finalList.ToArray(GetType(PersonalDDRecord)), PersonalDDRecord()) + + End If + + ' Add the existing UI data to this hash table + If newUIDataList.Count > 0 Then + Me.UIData.InsertRange(0, newUIDataList) + End If + + End Sub + + + Public Sub AddToDeletedRecordIds(ByVal rec As PersonalDDTableControlRow) + If rec.IsNewRecord() Then + Return + End If + + If Not Me.DeletedRecordIds Is Nothing AndAlso Me.DeletedRecordIds.Trim <> "" Then + Me.DeletedRecordIds &= "," + End If + + Me.DeletedRecordIds &= "[" & rec.RecordUniqueId & "]" + End Sub + + Protected Overridable Function InDeletedRecordIds(ByVal rec As PersonalDDTableControlRow) As Boolean + If Me.DeletedRecordIds Is Nothing OrElse Me.DeletedRecordIds.Trim = "" Then + Return False + End If + + Return Me.DeletedRecordIds.IndexOf("[" & rec.RecordUniqueId & "]") >= 0 + End Function + + Private _DeletedRecordIds As String + Public Property DeletedRecordIds() As String + Get + Return Me._DeletedRecordIds + End Get + Set(ByVal value As String) + Me._DeletedRecordIds = value + End Set + End Property + + + ' Create Set, WhereClause, and Populate Methods + + Public Overridable Sub SetEndDateLabel1() + + End Sub + + Public Overridable Sub SetMissionLabel() + + End Sub + + Public Overridable Sub SetPersonalDDTableControlCollapsibleRegion() + + End Sub + + Public Overridable Sub SetRefDateLabel() + + End Sub + + Public Overridable Sub SetRefLabel() + + End Sub + + Public Overridable Sub SetStartDateLabel1() + + 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. + Dim added As Boolean = Me.AddNewRecord > 0 + Me.LoadData() + Me.DataBind() + + If added Then + Me.SetFocusToAddedRow() + End If + + End If + + + + Catch ex As Exception + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + Finally + DbUtils.EndTransaction + End Try + End Sub + + 'this function sets focus to the first editable element in the new added row in the editable table + Protected Overridable Sub SetFocusToAddedRow() + Dim rep As System.Web.UI.WebControls.Repeater = CType(Me.FindControl("PersonalDDTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing OrElse rep.Items.Count = 0 Then Return + Dim repItem As System.Web.UI.WebControls.RepeaterItem + For Each repItem In rep.Items + 'Load scripts to table rows + Me.Page.LoadFocusScripts(repItem) + Dim recControl As PersonalDDTableControlRow = DirectCast(repItem.FindControl("PersonalDDTableControlRow"), PersonalDDTableControlRow) + If recControl.IsNewRecord Then + For Each field As Control In recControl.Controls + If field.Visible AndAlso Me.Page.IsControlEditable(field, False) Then + 'set focus on the first editable field in the new row + field.Focus() + Dim updPan As UpdatePanel = DirectCast(Me.Page.FindControlRecursively("UpdatePanel1"), UpdatePanel) + If Not updPan Is Nothing Then updPan.Update() + Return + End If + Next + Return + End If + Next + End Sub + + + Protected Overrides Sub SaveControlsToSession() + MyBase.SaveControlsToSession() + + ' Save filter controls to values to session. + + + 'Save pagination state to session. + + + + ' Save table control properties to the session. + If Not Me.CurrentSortOrder Is Nothing Then + Me.SaveToSession(Me, "Order_By", Me.CurrentSortOrder.ToXmlString()) + End If + + Me.SaveToSession(Me, "Page_Index", Me.PageIndex.ToString()) + Me.SaveToSession(Me, "Page_Size", Me.PageSize.ToString()) + + Me.SaveToSession(Me, "DeletedRecordIds", Me.DeletedRecordIds) + + End Sub + + Protected Sub SaveControlsToSession_Ajax() + ' Save filter controls to values to session. + + HttpContext.Current.Session("AppRelativeVirtualPath") = Me.Page.AppRelativeVirtualPath + + End Sub + + Protected Overrides Sub ClearControlsFromSession() + MyBase.ClearControlsFromSession() + + ' Clear filter controls values from the session. + + + ' Clear pagination state from session. + + + + ' Clear table properties from the session. + Me.RemoveFromSession(Me, "Order_By") + Me.RemoveFromSession(Me, "Page_Index") + Me.RemoveFromSession(Me, "Page_Size") + + Me.RemoveFromSession(Me, "DeletedRecordIds") + + End Sub + + Protected Overrides Sub LoadViewState(ByVal savedState As Object) + MyBase.LoadViewState(savedState) + + Dim orderByStr As String = CType(ViewState("PersonalDDTableControl_OrderBy"), String) + + If orderByStr IsNot Nothing AndAlso orderByStr.Trim <> "" Then + Me.CurrentSortOrder = BaseClasses.Data.OrderBy.FromXmlString(orderByStr) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + End If + + Dim pageIndex As String = CType(ViewState("Page_Index"), String) + If pageIndex IsNot Nothing Then + Me.PageIndex = CInt(pageIndex) + End If + + Dim pageSize As String = CType(ViewState("Page_Size"), String) + If Not pageSize Is Nothing Then + Me.PageSize = CInt(pageSize) + End If + + + + ' Load view state for pagination control. + + Me.DeletedRecordIds = CType(Me.ViewState("DeletedRecordIds"), String) + + End Sub + + Protected Overrides Function SaveViewState() As Object + + If Me.CurrentSortOrder IsNot Nothing Then + Me.ViewState("PersonalDDTableControl_OrderBy") = Me.CurrentSortOrder.ToXmlString() + End If + + Me.ViewState("Page_Index") = Me.PageIndex + Me.ViewState("Page_Size") = Me.PageSize + + Me.ViewState("DeletedRecordIds") = Me.DeletedRecordIds + + + ' Load view state for pagination control. + + + Return MyBase.SaveViewState() + End Function + + ' Generate the event handling functions for pagination events. + + ' event handler for ImageButton + Public Overridable Sub PersonalDDPagination_FirstPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.PageIndex = 0 + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalDDPagination_LastPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.DisplayLastPage = True + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalDDPagination_NextPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.PageIndex += 1 + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for LinkButton + Public Overridable Sub PersonalDDPagination_PageSizeButton_Click(ByVal sender As Object, ByVal args As EventArgs) + + Try + + Me.DataChanged = True + + Me.PageSize = Integer.Parse(Me.PersonalDDPagination.PageSize.Text) + + Me.PageIndex = Integer.Parse(Me.PersonalDDPagination.CurrentPage.Text) - 1 + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalDDPagination_PreviousPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + If Me.PageIndex > 0 Then + Me.PageIndex -= 1 + Me.DataChanged = True + End If + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + + ' Generate the event handling functions for sorting events. + + Public Overridable Sub EndDateLabel1_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by EndDate when clicked. + + ' Get previous sorting state for EndDate. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalDDTable.EndDate) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for EndDate. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalDDTable.EndDate, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by EndDate, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub MissionLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by Mission when clicked. + + ' Get previous sorting state for Mission. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalDDTable.Mission) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for Mission. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalDDTable.Mission, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by Mission, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub RefDateLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by RefDate when clicked. + + ' Get previous sorting state for RefDate. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalDDTable.RefDate) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for RefDate. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalDDTable.RefDate, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by RefDate, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub RefLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by Ref when clicked. + + ' Get previous sorting state for Ref. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalDDTable.Ref0) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for Ref. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalDDTable.Ref0, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by Ref, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub StartDateLabel1_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by StartDate when clicked. + + ' Get previous sorting state for StartDate. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalDDTable.StartDate) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for StartDate. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalDDTable.StartDate, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by StartDate, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + + ' Generate the event handling functions for button events. + + ' event handler for ImageButton + Public Overridable Sub PersonalDDAddButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + Me.AddNewRecord = 1 + Me.DataChanged = True + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalDDDeleteButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + If(Not Me.Page.IsPageRefresh) Then + + Me.DeleteSelectedRecords(True) + Me.SetFormulaControls() + + + End If + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalDDResetButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.CurrentSortOrder.Reset() + If Me.InSession(Me, "Order_By") Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + + End If + + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + + + ' Generate the event handling functions for filter and search events. + + + ' Generate the event handling functions for others + + + Private _UIData As New System.Collections.Generic.List(Of Hashtable) + Public Property UIData() As System.Collections.Generic.List(Of Hashtable) + Get + Return Me._UIData + End Get + Set(ByVal value As System.Collections.Generic.List(Of Hashtable)) + Me._UIData = value + End Set + End Property + + ' pagination properties + Protected _PageSize As Integer + Public Property PageSize() As Integer + Get + Return Me._PageSize + End Get + Set(ByVal value As Integer) + Me._PageSize = value + End Set + End Property + + Protected _PageIndex As Integer + Public Property PageIndex() As Integer + Get + ' Return the PageIndex + Return Me._PageIndex + End Get + Set(ByVal value As Integer) + Me._PageIndex = value + End Set + End Property + + Protected _TotalRecords As Integer = -1 + Public Property TotalRecords() As Integer + Get + If _TotalRecords < 0 + _TotalRecords = PersonalDDTable.GetRecordCount(CreateCompoundJoinFilter(), CreateWhereClause()) + End If + Return Me._TotalRecords + End Get + Set(ByVal value As Integer) + If Me.PageSize > 0 Then + + Me.TotalPages = CInt(Math.Ceiling(value / Me.PageSize)) + + End If + Me._TotalRecords = value + End Set + End Property + + + + Protected _TotalPages As Integer = -1 + Public Property TotalPages() As Integer + Get + If _TotalPages < 0 Then + + Me.TotalPages = CInt(Math.Ceiling(TotalRecords / Me.PageSize)) + + End If + Return Me._TotalPages + End Get + Set(ByVal value As Integer) + Me._TotalPages = value + End Set + End Property + + Protected _DisplayLastPage As Boolean + Public Property DisplayLastPage() As Boolean + Get + Return Me._DisplayLastPage + End Get + Set(ByVal value As Boolean) + Me._DisplayLastPage = value + End Set + End Property + + Private _DataChanged As Boolean = False + Public Property DataChanged() As Boolean + Get + Return Me._DataChanged + End Get + Set(ByVal value As Boolean) + Me._DataChanged = value + End Set + End Property + + Private _ResetData As Boolean = False + Public Property ResetData() As Boolean + Get + Return Me._ResetData + End Get + Set(ByVal value As Boolean) + Me._ResetData = value + End Set + End Property + + Private _AddNewRecord As Integer = 0 + Public Property AddNewRecord() As Integer + Get + Return Me._AddNewRecord + End Get + Set(ByVal value As Integer) + Me._AddNewRecord = value + End Set + End Property + + + Private _CurrentSortOrder As OrderBy = Nothing + Public Property CurrentSortOrder() As OrderBy + Get + Return Me._CurrentSortOrder + End Get + Set(ByVal value As BaseClasses.Data.OrderBy) + Me._CurrentSortOrder = value + End Set + End Property + + Private _DataSource() As PersonalDDRecord = Nothing + Public Property DataSource() As PersonalDDRecord () + Get + Return Me._DataSource + End Get + Set(ByVal value() As PersonalDDRecord) + Me._DataSource = value + End Set + End Property + +#Region "Helper Properties" + + Public ReadOnly Property EndDateLabel1() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "EndDateLabel1"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property MissionLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "MissionLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property PersonalDDAddButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalDDAddButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalDDDeleteButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalDDDeleteButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalDDPagination() As Persons.UI.IPagination + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalDDPagination"), Persons.UI.IPagination) + End Get + End Property + + Public ReadOnly Property PersonalDDResetButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalDDResetButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalDDTableControlCollapsibleRegion() As System.Web.UI.WebControls.Panel + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalDDTableControlCollapsibleRegion"), System.Web.UI.WebControls.Panel) + End Get + End Property + + Public ReadOnly Property PersonalDDToggleAll() As System.Web.UI.WebControls.CheckBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalDDToggleAll"), System.Web.UI.WebControls.CheckBox) + End Get + End Property + + Public ReadOnly Property RefDateLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RefDateLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property RefLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RefLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property StartDateLabel1() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "StartDateLabel1"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + +#End Region + +#Region "Helper Functions" + + Public Overrides Overloads Function ModifyRedirectUrl(url As String, arg As String, ByVal bEncrypt As Boolean) As String + Return Me.Page.EvaluateExpressions(url, arg, bEncrypt, Me) + End Function + + Public Overrides Overloads Function EvaluateExpressions(url As String, arg As String, ByVal bEncrypt As Boolean) As String + Dim needToProcess As Boolean = AreAnyUrlParametersForMe(url, arg) + If (needToProcess) Then + Dim recCtl As PersonalDDTableControlRow = Me.GetSelectedRecordControl() + If recCtl Is Nothing AndAlso url.IndexOf("{") >= 0 Then + ' Localization. + Throw New Exception(Page.GetResourceValue("Err:NoRecSelected", "Persons")) + End If + Dim rec As PersonalDDRecord = Nothing + If recCtl IsNot Nothing Then + rec = recCtl.GetRecord() + End If + Return EvaluateExpressions(url, arg, rec, bEncrypt) + End If + Return url + End Function + + Public Overridable Function GetSelectedRecordIndex() As Integer + Dim counter As Integer = 0 + Dim recControl As PersonalDDTableControlRow + For Each recControl In Me.GetRecordControls() + If recControl.PersonalDDRecordRowSelection.Checked Then + Return counter + End If + counter += 1 + Next + Return -1 + End Function + + Public Overridable Function GetSelectedRecordControl() As PersonalDDTableControlRow + Dim selectedList() As PersonalDDTableControlRow = Me.GetSelectedRecordControls() + If selectedList.Length = 0 Then + Return Nothing + End If + Return selectedList(0) + + End Function + + Public Overridable Function GetSelectedRecordControls() As PersonalDDTableControlRow() + + Dim selectedList As ArrayList = New ArrayList(25) + Dim recControl As PersonalDDTableControlRow + For Each recControl In Me.GetRecordControls() + If recControl.PersonalDDRecordRowSelection IsNot Nothing AndAlso recControl.PersonalDDRecordRowSelection.Checked Then + selectedList.Add(recControl) + End If + Next + Return DirectCast(selectedList.ToArray(GetType(PersonalDDTableControlRow)), PersonalDDTableControlRow()) + + End Function + + Public Overridable Sub DeleteSelectedRecords(ByVal deferDeletion As Boolean) + Dim recList() As PersonalDDTableControlRow = Me.GetSelectedRecordControls() + If recList.Length = 0 Then + ' Localization. + Throw New Exception(Page.GetResourceValue("Err:NoRecSelected", "Persons")) + End If + + Dim recCtl As PersonalDDTableControlRow + For Each recCtl In recList + If deferDeletion Then + If Not recCtl.IsNewRecord Then + + Me.AddToDeletedRecordIds(recCtl) + + End If + recCtl.Visible = False + + recCtl.PersonalDDRecordRowSelection.Checked = False + + Else + + recCtl.Delete() + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + End If + Next + End Sub + + Public Function GetRecordControls() As PersonalDDTableControlRow() + Dim recList As ArrayList = New ArrayList() + Dim rep As System.Web.UI.WebControls.Repeater = CType(Me.FindControl("PersonalDDTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return Nothing + Dim repItem As System.Web.UI.WebControls.RepeaterItem + + For Each repItem In rep.Items + + Dim recControl As PersonalDDTableControlRow = DirectCast(repItem.FindControl("PersonalDDTableControlRow"), PersonalDDTableControlRow) + recList.Add(recControl) + + Next + + Return DirectCast(recList.ToArray(GetType(PersonalDDTableControlRow)), PersonalDDTableControlRow()) + End Function + + Public Shadows ReadOnly Property Page() As BaseApplicationPage + Get + Return DirectCast(MyBase.Page, BaseApplicationPage) + End Get + End Property + +#End Region + + + +End Class + + +' Base class for the PersonalEducationTableControlRow control on the AddPersonalId page. +' Do not modify this class. Instead override any method in PersonalEducationTableControlRow. +Public Class BasePersonalEducationTableControlRow + Inherits Persons.UI.BaseApplicationRecordControl + + ' To customize, override this method in PersonalEducationTableControlRow. + Protected Overridable Sub Control_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Init + + Me.ClearControlsFromSession() + End Sub + + ' To customize, override this method in PersonalEducationTableControlRow. + Protected Overridable Sub Control_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load + + 'Call LoadFocusScripts from repeater so that onfocus attribute could be added to elements + Me.Page.LoadFocusScripts(Me) + + ' Show confirmation message on Click + Me.PersonalEducationRowDeleteButton.Attributes.Add("onClick", "return (confirm('" & (CType(Me.Page,BaseApplicationPage)).GetResourceValue("DeleteRecordConfirm", "Persons") & "'));") + + + ' Register the event handlers. + + AddHandler Me.PersonalEducationRowDeleteButton.Click, AddressOf PersonalEducationRowDeleteButton_Click + + AddHandler Me.COUNTRY.SelectedIndexChanged, AddressOf COUNTRY_SelectedIndexChanged + + AddHandler Me.LevelId.SelectedIndexChanged, AddressOf LevelId_SelectedIndexChanged + + AddHandler Me.Command.TextChanged, AddressOf Command_TextChanged + + AddHandler Me.CommandDate.TextChanged, AddressOf CommandDate_TextChanged + + AddHandler Me.Course.TextChanged, AddressOf Course_TextChanged + + AddHandler Me.CourseAbbr.TextChanged, AddressOf CourseAbbr_TextChanged + + AddHandler Me.CourseNo.TextChanged, AddressOf CourseNo_TextChanged + + AddHandler Me.EducationPeriod.TextChanged, AddressOf EducationPeriod_TextChanged + + AddHandler Me.EducationType.TextChanged, AddressOf EducationType_TextChanged + + AddHandler Me.EdYear.TextChanged, AddressOf EdYear_TextChanged + + AddHandler Me.EndDate1.TextChanged, AddressOf EndDate1_TextChanged + + AddHandler Me.Facultry.TextChanged, AddressOf Facultry_TextChanged + + AddHandler Me.Institue.TextChanged, AddressOf Institue_TextChanged + + AddHandler Me.NoAll.TextChanged, AddressOf NoAll_TextChanged + + AddHandler Me.Score.TextChanged, AddressOf Score_TextChanged + + AddHandler Me.ScoreNo.TextChanged, AddressOf ScoreNo_TextChanged + + AddHandler Me.StartDate1.TextChanged, AddressOf StartDate1_TextChanged + + + End Sub + + + Public Overridable Sub LoadData() + + ' Load the data from the database into the DataSource PersonalEducation record. + ' It is better to make changes to functions called by LoadData such as + ' CreateWhereClause, rather than making changes here. + + ' The RecordUniqueId is set the first time a record is loaded, and is + ' used during a PostBack to load the record. + + If Me.RecordUniqueId IsNot Nothing AndAlso Me.RecordUniqueId.Trim <> "" Then + Me.DataSource = PersonalEducationTable.GetRecord(Me.RecordUniqueId, True) + + Return + End If + + ' Since this is a row in the table, the data for this row is loaded by the + ' LoadData method of the BasePersonalEducationTableControl when the data for the entire + ' table is loaded. + + Me.DataSource = New PersonalEducationRecord() + + + + End Sub + + ' Populate the UI controls using the DataSource. To customize, override this method in PersonalEducationTableControlRow. + Public Overrides Sub DataBind() + ' The DataBind method binds the user interface controls to the values + ' from the database record. To do this, it calls the Set methods for + ' each of the field displayed on the webpage. It is better to make + ' changes in the Set methods, rather than making changes here. + + MyBase.DataBind() + + ' Make sure that the DataSource is initialized. + If Me.DataSource Is Nothing Then + + Return + End If + + + 'LoadData for DataSource for chart and report if they exist + + + + ' Call the Set methods for each controls on the panel + + SetCommand() + SetCommandDate() + SetCOUNTRY() + SetCourse() + SetCourseAbbr() + SetCourseNo() + SetEducationPeriod() + SetEducationType() + SetEdYear() + SetEndDate1() + SetFacultry() + SetInstitue() + SetLevelId() + SetNoAll() + + + SetScore() + SetScoreNo() + SetStartDate1() + + + Me.IsNewRecord = True + + If Me.DataSource.IsCreated Then + Me.IsNewRecord = False + + Me.RecordUniqueId = Me.DataSource.GetID.ToXmlString() + End If + + ' Now load data for each record and table child UI controls. + ' Ordering is important because child controls get + ' their parent ids from their parent UI controls. + Dim shouldResetControl As Boolean = False + + End Sub + + + Public Overridable Sub SetCommand() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.Command.ID) Then + + Me.Command.Text = Me.PreviousUIData(Me.Command.ID).ToString() + + Return + End If + + + ' Set the Command TextBox on the webpage with value from the + ' PersonalEducation database record. + + ' Me.DataSource is the PersonalEducation record retrieved from the database. + ' Me.Command is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetCommand() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.CommandSpecified Then + + ' If the Command is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalEducationTable.Command) + + Me.Command.Text = formattedValue + + Else + + ' Command is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.Command.Text = PersonalEducationTable.Command.Format(PersonalEducationTable.Command.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetCommandDate() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.CommandDate.ID) Then + + Me.CommandDate.Text = Me.PreviousUIData(Me.CommandDate.ID).ToString() + + Return + End If + + + ' Set the CommandDate TextBox on the webpage with value from the + ' PersonalEducation database record. + + ' Me.DataSource is the PersonalEducation record retrieved from the database. + ' Me.CommandDate is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetCommandDate() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.CommandDateSpecified Then + + ' If the CommandDate is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalEducationTable.CommandDate, "d MMM yy") + + Me.CommandDate.Text = formattedValue + + Else + + ' CommandDate is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.CommandDate.Text = PersonalEducationTable.CommandDate.Format(PersonalEducationTable.CommandDate.DefaultValue, "d MMM yy") + + End If + + End Sub + + Public Overridable Sub SetCOUNTRY() + + ' If selection was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.COUNTRY.ID) Then + If Me.PreviousUIData(Me.COUNTRY.ID) Is Nothing + Me.PopulateCOUNTRYDropDownList(Nothing, 100) + Else + Me.PopulateCOUNTRYDropDownList(Me.PreviousUIData(Me.COUNTRY.ID).ToString(), 100) + End If + Return + End If + + + ' Set the COUNTRY DropDownList on the webpage with value from the + ' PersonalEducation database record. + + ' Me.DataSource is the PersonalEducation record retrieved from the database. + ' Me.COUNTRY is the ASP:DropDownList on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetCOUNTRY() + ' and add your own code before or after the call to the MyBase function. + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.COUNTRYSpecified Then + + ' If the COUNTRY is non-NULL, then format the value. + ' The Format method will return the Display Foreign Key As (DFKA) value + Me.PopulateCOUNTRYDropDownList(Me.DataSource.COUNTRY.ToString(), 100) + + Else + + ' COUNTRY 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.PopulateCOUNTRYDropDownList(Nothing, 100) + Else + Me.PopulateCOUNTRYDropDownList(PersonalEducationTable.COUNTRY.DefaultValue, 100) + End If + + End If + + End Sub + + Public Overridable Sub SetCourse() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.Course.ID) Then + + Me.Course.Text = Me.PreviousUIData(Me.Course.ID).ToString() + + Return + End If + + + ' Set the Course TextBox on the webpage with value from the + ' PersonalEducation database record. + + ' Me.DataSource is the PersonalEducation record retrieved from the database. + ' Me.Course is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetCourse() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.CourseSpecified Then + + ' If the Course is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalEducationTable.Course) + + Me.Course.Text = formattedValue + + Else + + ' Course is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.Course.Text = PersonalEducationTable.Course.Format(PersonalEducationTable.Course.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetCourseAbbr() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.CourseAbbr.ID) Then + + Me.CourseAbbr.Text = Me.PreviousUIData(Me.CourseAbbr.ID).ToString() + + Return + End If + + + ' Set the CourseAbbr TextBox on the webpage with value from the + ' PersonalEducation database record. + + ' Me.DataSource is the PersonalEducation record retrieved from the database. + ' Me.CourseAbbr is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetCourseAbbr() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.CourseAbbrSpecified Then + + ' If the CourseAbbr is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalEducationTable.CourseAbbr) + + Me.CourseAbbr.Text = formattedValue + + Else + + ' CourseAbbr is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.CourseAbbr.Text = PersonalEducationTable.CourseAbbr.Format(PersonalEducationTable.CourseAbbr.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetCourseNo() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.CourseNo.ID) Then + + Me.CourseNo.Text = Me.PreviousUIData(Me.CourseNo.ID).ToString() + + Return + End If + + + ' Set the CourseNo TextBox on the webpage with value from the + ' PersonalEducation database record. + + ' Me.DataSource is the PersonalEducation record retrieved from the database. + ' Me.CourseNo is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetCourseNo() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.CourseNoSpecified Then + + ' If the CourseNo is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalEducationTable.CourseNo) + + Me.CourseNo.Text = formattedValue + + Else + + ' CourseNo is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.CourseNo.Text = PersonalEducationTable.CourseNo.Format(PersonalEducationTable.CourseNo.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetEducationPeriod() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.EducationPeriod.ID) Then + + Me.EducationPeriod.Text = Me.PreviousUIData(Me.EducationPeriod.ID).ToString() + + Return + End If + + + ' Set the EducationPeriod TextBox on the webpage with value from the + ' PersonalEducation database record. + + ' Me.DataSource is the PersonalEducation record retrieved from the database. + ' Me.EducationPeriod is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetEducationPeriod() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.EducationPeriodSpecified Then + + ' If the EducationPeriod is non-NULL, then format the value. + + ' The Format method will return the Display Foreign Key As (DFKA) value + Dim formattedValue As String = Me.DataSource.EducationPeriod.ToString() + + + Me.EducationPeriod.Text = formattedValue + + Else + + ' EducationPeriod is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.EducationPeriod.Text = PersonalEducationTable.EducationPeriod.DefaultValue + End If + + End Sub + + Public Overridable Sub SetEducationType() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.EducationType.ID) Then + + Me.EducationType.Text = Me.PreviousUIData(Me.EducationType.ID).ToString() + + Return + End If + + + ' Set the EducationType TextBox on the webpage with value from the + ' PersonalEducation database record. + + ' Me.DataSource is the PersonalEducation record retrieved from the database. + ' Me.EducationType is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetEducationType() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.EducationTypeSpecified Then + + ' If the EducationType is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalEducationTable.EducationType) + + Me.EducationType.Text = formattedValue + + Else + + ' EducationType is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.EducationType.Text = PersonalEducationTable.EducationType.Format(PersonalEducationTable.EducationType.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetEdYear() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.EdYear.ID) Then + + Me.EdYear.Text = Me.PreviousUIData(Me.EdYear.ID).ToString() + + Return + End If + + + ' Set the EdYear TextBox on the webpage with value from the + ' PersonalEducation database record. + + ' Me.DataSource is the PersonalEducation record retrieved from the database. + ' Me.EdYear is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetEdYear() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.EdYearSpecified Then + + ' If the EdYear is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalEducationTable.EdYear) + + Me.EdYear.Text = formattedValue + + Else + + ' EdYear is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.EdYear.Text = PersonalEducationTable.EdYear.Format(PersonalEducationTable.EdYear.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetEndDate1() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.EndDate1.ID) Then + + Me.EndDate1.Text = Me.PreviousUIData(Me.EndDate1.ID).ToString() + + Return + End If + + + ' Set the EndDate TextBox on the webpage with value from the + ' PersonalEducation database record. + + ' Me.DataSource is the PersonalEducation record retrieved from the database. + ' Me.EndDate1 is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetEndDate1() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.EndDateSpecified Then + + ' If the EndDate is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalEducationTable.EndDate, "d MMM yy") + + Me.EndDate1.Text = formattedValue + + Else + + ' EndDate is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.EndDate1.Text = PersonalEducationTable.EndDate.Format(PersonalEducationTable.EndDate.DefaultValue, "d MMM yy") + + End If + + End Sub + + Public Overridable Sub SetFacultry() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.Facultry.ID) Then + + Me.Facultry.Text = Me.PreviousUIData(Me.Facultry.ID).ToString() + + Return + End If + + + ' Set the Facultry TextBox on the webpage with value from the + ' PersonalEducation database record. + + ' Me.DataSource is the PersonalEducation record retrieved from the database. + ' Me.Facultry is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetFacultry() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.FacultrySpecified Then + + ' If the Facultry is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalEducationTable.Facultry) + + Me.Facultry.Text = formattedValue + + Else + + ' Facultry is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.Facultry.Text = PersonalEducationTable.Facultry.Format(PersonalEducationTable.Facultry.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetInstitue() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.Institue.ID) Then + + Me.Institue.Text = Me.PreviousUIData(Me.Institue.ID).ToString() + + Return + End If + + + ' Set the Institue TextBox on the webpage with value from the + ' PersonalEducation database record. + + ' Me.DataSource is the PersonalEducation record retrieved from the database. + ' Me.Institue is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetInstitue() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.InstitueSpecified Then + + ' If the Institue is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalEducationTable.Institue) + + Me.Institue.Text = formattedValue + + Else + + ' Institue is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.Institue.Text = PersonalEducationTable.Institue.Format(PersonalEducationTable.Institue.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetLevelId() + + ' If selection was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.LevelId.ID) Then + If Me.PreviousUIData(Me.LevelId.ID) Is Nothing + Me.PopulateLevelIdDropDownList(Nothing, 100) + Else + Me.PopulateLevelIdDropDownList(Me.PreviousUIData(Me.LevelId.ID).ToString(), 100) + End If + Return + End If + + + ' Set the LevelId DropDownList on the webpage with value from the + ' PersonalEducation database record. + + ' Me.DataSource is the PersonalEducation record retrieved from the database. + ' Me.LevelId is the ASP:DropDownList on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetLevelId() + ' and add your own code before or after the call to the MyBase function. + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.LevelIdSpecified Then + + ' If the LevelId is non-NULL, then format the value. + ' The Format method will return the Display Foreign Key As (DFKA) value + Me.PopulateLevelIdDropDownList(Me.DataSource.LevelId.ToString(), 100) + + Else + + ' LevelId 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.PopulateLevelIdDropDownList(Nothing, 100) + Else + Me.PopulateLevelIdDropDownList(PersonalEducationTable.LevelId.DefaultValue, 100) + End If + + End If + + End Sub + + Public Overridable Sub SetNoAll() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.NoAll.ID) Then + + Me.NoAll.Text = Me.PreviousUIData(Me.NoAll.ID).ToString() + + Return + End If + + + ' Set the NoAll TextBox on the webpage with value from the + ' PersonalEducation database record. + + ' Me.DataSource is the PersonalEducation record retrieved from the database. + ' Me.NoAll is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetNoAll() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.NoAllSpecified Then + + ' If the NoAll is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalEducationTable.NoAll) + + Me.NoAll.Text = formattedValue + + Else + + ' NoAll is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.NoAll.Text = PersonalEducationTable.NoAll.Format(PersonalEducationTable.NoAll.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetScore() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.Score.ID) Then + + Me.Score.Text = Me.PreviousUIData(Me.Score.ID).ToString() + + Return + End If + + + ' Set the Score TextBox on the webpage with value from the + ' PersonalEducation database record. + + ' Me.DataSource is the PersonalEducation record retrieved from the database. + ' Me.Score is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetScore() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.ScoreSpecified Then + + ' If the Score is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalEducationTable.Score) + + Me.Score.Text = formattedValue + + Else + + ' Score is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.Score.Text = PersonalEducationTable.Score.Format(PersonalEducationTable.Score.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetScoreNo() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.ScoreNo.ID) Then + + Me.ScoreNo.Text = Me.PreviousUIData(Me.ScoreNo.ID).ToString() + + Return + End If + + + ' Set the ScoreNo TextBox on the webpage with value from the + ' PersonalEducation database record. + + ' Me.DataSource is the PersonalEducation record retrieved from the database. + ' Me.ScoreNo is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetScoreNo() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.ScoreNoSpecified Then + + ' If the ScoreNo is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalEducationTable.ScoreNo) + + Me.ScoreNo.Text = formattedValue + + Else + + ' ScoreNo is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.ScoreNo.Text = PersonalEducationTable.ScoreNo.Format(PersonalEducationTable.ScoreNo.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetStartDate1() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.StartDate1.ID) Then + + Me.StartDate1.Text = Me.PreviousUIData(Me.StartDate1.ID).ToString() + + Return + End If + + + ' Set the StartDate TextBox on the webpage with value from the + ' PersonalEducation database record. + + ' Me.DataSource is the PersonalEducation record retrieved from the database. + ' Me.StartDate1 is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetStartDate1() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.StartDateSpecified Then + + ' If the StartDate is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalEducationTable.StartDate, "d MMM yy") + + Me.StartDate1.Text = formattedValue + + Else + + ' StartDate is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.StartDate1.Text = PersonalEducationTable.StartDate.Format(PersonalEducationTable.StartDate.DefaultValue, "d MMM yy") + + End If + + End Sub + + + Public EvaluateFormulaDelegate As BaseClasses.Data.DataSource.EvaluateFormulaDelegate = New BaseClasses.Data.DataSource.EvaluateFormulaDelegate(AddressOf Me.EvaluateFormula) + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean, ByVal e As FormulaEvaluator) As String + If e Is Nothing Then + e = New FormulaEvaluator() + End If + + e.Variables.Clear() + + + ' add variables for formula evaluation + If variables IsNot Nothing Then + Dim enumerator As System.Collections.Generic.IEnumerator(Of System.Collections.Generic.KeyValuePair(Of String, Object)) = variables.GetEnumerator() + While enumerator.MoveNext() + e.Variables.Add(enumerator.Current.Key, enumerator.Current.Value) + End While + End If + + If includeDS + + End IF + + + ' Other variables referred to in the formula are expected to be + ' properties of the DataSource. For example, referring to + ' UnitPrice as a variable will refer to DataSource.UnitPrice + If dataSourceForEvaluate Is Nothing Then + + e.DataSource = Me.DataSource + + Else + e.DataSource = dataSourceForEvaluate + End If + + ' Define the calling control. This is used to add other + ' related table and record controls as variables. + e.CallingControl = Me + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + + If Not String.IsNullOrEmpty(format) AndAlso (String.IsNullOrEmpty(formula) OrElse formula.IndexOf("Format(") < 0) Then + Return FormulaUtils.Format(resultObj, format) + Else + Return resultObj.ToString() + End If + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format,variables ,includeDS, Nothing) + End Function + + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object)) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format, variables ,True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, format, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal e as FormulaEvaluator) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, variables, True, e) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal includeDS as Boolean) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, includeDS, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, True, Nothing) + End Function + + + Public Overridable Sub RegisterPostback() + + + End Sub + + + + ' To customize, override this method in PersonalEducationTableControlRow. + Public Overridable Sub SaveData() + ' Saves the associated record in the database. + ' SaveData calls Validate and Get methods - so it may be more appropriate to + ' customize those methods. + + ' 1. Load the existing record from the database. Since we save the entire record, this ensures + ' that fields that are not displayed are also properly initialized. + Me.LoadData() + + Dim parentCtrl As PersonalIdRecordControl + + + parentCtrl = DirectCast(Me.Page.FindControlRecursively("PersonalIdRecordControl"), PersonalIdRecordControl) + + If (Not IsNothing(parentCtrl) AndAlso IsNothing(parentCtrl.DataSource)) + ' Load the record if it is not loaded yet. + parentCtrl.LoadData() + End If + If (IsNothing(parentCtrl) OrElse IsNothing(parentCtrl.DataSource)) + ' Get the error message from the application resource file. + Throw New Exception(Page.GetResourceValue("Err:NoParentRecId", "Persons")) + End If + + Me.DataSource.PersonalId = parentCtrl.DataSource.PersonalId + + ' 2. Perform any custom validation. + Me.Validate() + + + ' 3. Set the values in the record with data from UI controls. + ' This calls the Get() method for each of the user interface controls. + Me.GetUIData() + + ' 4. Save in the database. + ' We should not save the record if the data did not change. This + ' will save a database hit and avoid triggering any database triggers. + + If Me.DataSource.IsAnyValueChanged Then + ' Save record to database but do not commit yet. + ' Auto generated ids are available after saving for use by child (dependent) records. + Me.DataSource.Save() + + DirectCast(GetParentControlObject(Me, "PersonalEducationTableControl"), PersonalEducationTableControl).DataChanged = True + DirectCast(GetParentControlObject(Me, "PersonalEducationTableControl"), PersonalEducationTableControl).ResetData = True + End If + + + ' update session or cookie by formula + + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + ' For Master-Detail relationships, save data on the Detail table(s) + + End Sub + + ' To customize, override this method in PersonalEducationTableControlRow. + Public Overridable Sub GetUIData() + ' The GetUIData method retrieves the updated values from the user interface + ' controls into a database record in preparation for saving or updating. + ' To do this, it calls the Get methods for each of the field displayed on + ' the webpage. It is better to make changes in the Get methods, rather + ' than making changes here. + + ' Call the Get methods for each of the user interface controls. + + GetCommand() + GetCommandDate() + GetCOUNTRY() + GetCourse() + GetCourseAbbr() + GetCourseNo() + GetEducationPeriod() + GetEducationType() + GetEdYear() + GetEndDate1() + GetFacultry() + GetInstitue() + GetLevelId() + GetNoAll() + GetScore() + GetScoreNo() + GetStartDate1() + End Sub + + + Public Overridable Sub GetCommand() + + ' Retrieve the value entered by the user on the Command ASP:TextBox, and + ' save it into the Command field in DataSource PersonalEducation record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.Command.Text, PersonalEducationTable.Command) + + + End Sub + + Public Overridable Sub GetCommandDate() + + ' Retrieve the value entered by the user on the CommandDate ASP:TextBox, and + ' save it into the CommandDate field in DataSource PersonalEducation 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.CommandDate.Text, PersonalEducationTable.CommandDate) + + + End Sub + + Public Overridable Sub GetCOUNTRY() + + ' Retrieve the value entered by the user on the COUNTRY ASP:DropDownList, and + ' save it into the COUNTRY field in DataSource PersonalEducation record. + + ' Custom validation should be performed in Validate, not here. + + Me.DataSource.Parse(GetValueSelectedPageRequest(Me.COUNTRY), PersonalEducationTable.COUNTRY) + + End Sub + + Public Overridable Sub GetCourse() + + ' Retrieve the value entered by the user on the Course ASP:TextBox, and + ' save it into the Course field in DataSource PersonalEducation record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.Course.Text, PersonalEducationTable.Course) + + + End Sub + + Public Overridable Sub GetCourseAbbr() + + ' Retrieve the value entered by the user on the CourseAbbr ASP:TextBox, and + ' save it into the CourseAbbr field in DataSource PersonalEducation record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.CourseAbbr.Text, PersonalEducationTable.CourseAbbr) + + + End Sub + + Public Overridable Sub GetCourseNo() + + ' Retrieve the value entered by the user on the CourseNo ASP:TextBox, and + ' save it into the CourseNo field in DataSource PersonalEducation record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.CourseNo.Text, PersonalEducationTable.CourseNo) + + + End Sub + + Public Overridable Sub GetEducationPeriod() + + ' Retrieve the value entered by the user on the EducationPeriod ASP:TextBox, and + ' save it into the EducationPeriod field in DataSource PersonalEducation record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.EducationPeriod.Text, PersonalEducationTable.EducationPeriod) + + + End Sub + + Public Overridable Sub GetEducationType() + + ' Retrieve the value entered by the user on the EducationType ASP:TextBox, and + ' save it into the EducationType field in DataSource PersonalEducation record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.EducationType.Text, PersonalEducationTable.EducationType) + + + End Sub + + Public Overridable Sub GetEdYear() + + ' Retrieve the value entered by the user on the EdYear ASP:TextBox, and + ' save it into the EdYear field in DataSource PersonalEducation record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.EdYear.Text, PersonalEducationTable.EdYear) + + + End Sub + + Public Overridable Sub GetEndDate1() + + ' Retrieve the value entered by the user on the EndDate ASP:TextBox, and + ' save it into the EndDate field in DataSource PersonalEducation 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.EndDate1.Text, PersonalEducationTable.EndDate) + + + End Sub + + Public Overridable Sub GetFacultry() + + ' Retrieve the value entered by the user on the Facultry ASP:TextBox, and + ' save it into the Facultry field in DataSource PersonalEducation record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.Facultry.Text, PersonalEducationTable.Facultry) + + + End Sub + + Public Overridable Sub GetInstitue() + + ' Retrieve the value entered by the user on the Institue ASP:TextBox, and + ' save it into the Institue field in DataSource PersonalEducation record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.Institue.Text, PersonalEducationTable.Institue) + + + End Sub + + Public Overridable Sub GetLevelId() + + ' Retrieve the value entered by the user on the LevelId ASP:DropDownList, and + ' save it into the LevelId field in DataSource PersonalEducation record. + + ' Custom validation should be performed in Validate, not here. + + Me.DataSource.Parse(GetValueSelectedPageRequest(Me.LevelId), PersonalEducationTable.LevelId) + + End Sub + + Public Overridable Sub GetNoAll() + + ' Retrieve the value entered by the user on the NoAll ASP:TextBox, and + ' save it into the NoAll field in DataSource PersonalEducation record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.NoAll.Text, PersonalEducationTable.NoAll) + + + End Sub + + Public Overridable Sub GetScore() + + ' Retrieve the value entered by the user on the Score ASP:TextBox, and + ' save it into the Score field in DataSource PersonalEducation record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.Score.Text, PersonalEducationTable.Score) + + + End Sub + + Public Overridable Sub GetScoreNo() + + ' Retrieve the value entered by the user on the ScoreNo ASP:TextBox, and + ' save it into the ScoreNo field in DataSource PersonalEducation record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.ScoreNo.Text, PersonalEducationTable.ScoreNo) + + + End Sub + + Public Overridable Sub GetStartDate1() + + ' Retrieve the value entered by the user on the StartDate ASP:TextBox, and + ' save it into the StartDate field in DataSource PersonalEducation 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.StartDate1.Text, PersonalEducationTable.StartDate) + + + End Sub + + + ' To customize, override this method in PersonalEducationTableControlRow. + + Public Overridable Function CreateWhereClause() As WhereClause + + Return Nothing + + End Function + + + + ' To customize, override this method in PersonalEducationTableControlRow. + Public Overridable Sub Validate() + ' Add custom validation for any control within this panel. + ' Example. If you have a State ASP:Textbox control + ' If Me.State.Text <> "CA" Then + ' Throw New Exception("State must be CA (California).") + ' End If + + ' The Validate method is common across all controls within + ' this panel so you can validate multiple fields, but report + ' one error message. + + + End Sub + + Public Overridable Sub Delete() + + If Me.IsNewRecord() Then + Return + End If + + Dim pkValue As KeyValue = KeyValue.XmlToKey(Me.RecordUniqueId) + PersonalEducationTable.DeleteRecord(pkValue) + + DirectCast(GetParentControlObject(Me, "PersonalEducationTableControl"), PersonalEducationTableControl).DataChanged = True + DirectCast(GetParentControlObject(Me, "PersonalEducationTableControl"), PersonalEducationTableControl).ResetData = True + End Sub + + Protected Overridable Sub Control_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.PreRender + ' PreRender event is raised just before page is being displayed. + Try + DbUtils.StartTransaction() + Me.RegisterPostback() + + If Not Me.Page.ErrorOnPage AndAlso (Me.Page.IsPageRefresh OrElse Me.DataChanged OrElse Me.ResetData) Then + + + ' Re-load the data and update the web page if necessary. + ' This is typically done during a postback (filter, search button, sort, pagination button). + ' In each of the other click handlers, simply set DataChanged to True to reload the data. + Me.LoadData() + Me.DataBind() + End If + + + Catch ex As Exception + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + Finally + DbUtils.EndTransaction() + End Try + End Sub + + + Protected Overrides Sub SaveControlsToSession() + MyBase.SaveControlsToSession() + + + 'Save pagination state to session. + + End Sub + + + + Protected Overrides Sub ClearControlsFromSession() + MyBase.ClearControlsFromSession() + + + + ' Clear pagination state from session. + + End Sub + + Protected Overrides Sub LoadViewState(ByVal savedState As Object) + MyBase.LoadViewState(savedState) + Dim isNewRecord As String = CType(ViewState("IsNewRecord"), String) + If Not isNewRecord Is Nothing AndAlso isNewRecord.Trim <> "" Then + Me.IsNewRecord = Boolean.Parse(isNewRecord) + End If + + Dim myCheckSum As String = CType(ViewState("CheckSum"), String) + If Not myCheckSum Is Nothing AndAlso myCheckSum.Trim <> "" Then + Me.CheckSum = myCheckSum + End If + + + ' Load view state for pagination control. + + End Sub + + Protected Overrides Function SaveViewState() As Object + ViewState("IsNewRecord") = Me.IsNewRecord.ToString() + ViewState("CheckSum") = Me.CheckSum + + + ' Load view state for pagination control. + + Return MyBase.SaveViewState() + End Function + + + + Public Overridable Function CreateWhereClause_COUNTRYDropDownList() 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 Country table. + ' Examples: + ' wc.iAND(CountryTable.Country, BaseFilter.ComparisonOperator.EqualsTo, "XYZ") + ' wc.iAND(CountryTable.Active, BaseFilter.ComparisonOperator.EqualsTo, "1") + + Dim wc As WhereClause = New WhereClause() + Return wc + + End Function + + + + Public Overridable Function CreateWhereClause_LevelIdDropDownList() 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 Education table. + ' Examples: + ' wc.iAND(EducationTable.Level, BaseFilter.ComparisonOperator.EqualsTo, "XYZ") + ' wc.iAND(EducationTable.Active, BaseFilter.ComparisonOperator.EqualsTo, "1") + + Dim wc As WhereClause = New WhereClause() + Return wc + + End Function + + + ' Fill the COUNTRY list. + Protected Overridable Sub PopulateCOUNTRYDropDownList( _ + ByVal selectedValue As String, _ + ByVal maxItems As Integer) + + Me.COUNTRY.Items.Clear() + + + ' 1. Setup the static list items + + ' Add the Please Select item. + Me.COUNTRY.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_COUNTRYDropDownList function. + ' It is better to customize the where clause there. + + Dim wc As WhereClause = CreateWhereClause_COUNTRYDropDownList() + ' Create the ORDER BY clause to sort based on the displayed value. + + + Dim orderBy As OrderBy = New OrderBy(false, false) + orderBy.Add(CountryTable.Country, OrderByItem.OrderDir.Asc) + + Dim variables As System.Collections.Generic.IDictionary(Of String, Object) = New System.Collections.Generic.Dictionary(Of String, Object) + + ' 3. Read a total of maxItems from the database and insert them + Dim itemValues() As CountryRecord = 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 = CountryTable.GetRecords(wc, orderBy, pageNum, maxItems) + For each itemValue As CountryRecord In itemValues + ' Create the item and add to the list. + Dim cvalue As String = Nothing + Dim fvalue As String = Nothing + If itemValue.CountryIdSpecified Then + cvalue = itemValue.CountryId.ToString() + + If counter < maxItems AndAlso Me.COUNTRY.Items.FindByValue(cvalue) Is Nothing Then + + Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalEducationTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalEducationTable.COUNTRY) + If _isExpandableNonCompositeForeignKey AndAlso PersonalEducationTable.COUNTRY.IsApplyDisplayAs Then + fvalue = PersonalEducationTable.GetDFKA(itemValue, PersonalEducationTable.COUNTRY) + End If + If (Not _isExpandableNonCompositeForeignKey) Or (String.IsNullOrEmpty(fvalue)) Then + fvalue = itemValue.Format(CountryTable.Country) + End If + + If fvalue Is Nothing OrElse fvalue.Trim() = "" Then fvalue = cvalue + + If (IsNothing(fvalue)) Then + fvalue = "" + End If + + fvalue = fvalue.Trim() + + If ( fvalue.Length > 50 ) Then + fvalue = fvalue.Substring(0, 50) & "..." + End If + + Dim dupItem As ListItem = Me.COUNTRY.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.COUNTRY.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.COUNTRY, selectedValue) AndAlso _ + Not SetSelectedDisplayText(Me.COUNTRY, selectedValue)Then + + ' construct a whereclause to query a record with Country.CountryId = selectedValue + Dim filter2 As CompoundFilter = New CompoundFilter(CompoundFilter.CompoundingOperators.And_Operator, Nothing) + Dim whereClause2 As WhereClause = New WhereClause() + filter2.AddFilter(New BaseClasses.Data.ColumnValueFilter(CountryTable.CountryId, selectedValue, BaseClasses.Data.BaseFilter.ComparisonOperator.EqualsTo, False)) + whereClause2.AddFilter(filter2, CompoundFilter.CompoundingOperators.And_Operator) + + Try + ' Execute the query + Dim rc() As CountryRecord = CountryTable.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 CountryRecord = DirectCast(rc(0), CountryRecord) + ' Create the item and add to the list. + Dim cvalue As String = Nothing + Dim fvalue As String = Nothing + If itemValue.CountryIdSpecified Then + cvalue = itemValue.CountryId.ToString() + Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalEducationTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalEducationTable.COUNTRY) + If _isExpandableNonCompositeForeignKey AndAlso PersonalEducationTable.COUNTRY.IsApplyDisplayAs Then + fvalue = PersonalEducationTable.GetDFKA(itemValue, PersonalEducationTable.COUNTRY) + End If + If (Not _isExpandableNonCompositeForeignKey) Or (String.IsNullOrEmpty(fvalue)) Then + fvalue = itemValue.Format(CountryTable.Country) + End If + + If fvalue Is Nothing OrElse fvalue.Trim() = "" Then fvalue = cvalue + Dim newItem As New ListItem(fvalue, cvalue) + Me.COUNTRY.Items.Add(newItem) + SetSelectedValue(Me.COUNTRY, selectedValue) + End If + End If + Catch + End Try + + End If + + + End Sub + + ' Fill the LevelId list. + Protected Overridable Sub PopulateLevelIdDropDownList( _ + ByVal selectedValue As String, _ + ByVal maxItems As Integer) + + Me.LevelId.Items.Clear() + + + ' 1. Setup the static list items + + ' Add the Please Select item. + Me.LevelId.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_LevelIdDropDownList function. + ' It is better to customize the where clause there. + + Dim wc As WhereClause = CreateWhereClause_LevelIdDropDownList() + ' Create the ORDER BY clause to sort based on the displayed value. + + + Dim orderBy As OrderBy = New OrderBy(false, false) + orderBy.Add(EducationTable.Level, OrderByItem.OrderDir.Asc) + + Dim variables As System.Collections.Generic.IDictionary(Of String, Object) = New System.Collections.Generic.Dictionary(Of String, Object) + + ' 3. Read a total of maxItems from the database and insert them + Dim itemValues() As EducationRecord = 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 = EducationTable.GetRecords(wc, orderBy, pageNum, maxItems) + For each itemValue As EducationRecord In itemValues + ' Create the item and add to the list. + Dim cvalue As String = Nothing + Dim fvalue As String = Nothing + If itemValue.EducationIdSpecified Then + cvalue = itemValue.EducationId.ToString() + + If counter < maxItems AndAlso Me.LevelId.Items.FindByValue(cvalue) Is Nothing Then + + Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalEducationTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalEducationTable.LevelId) + If _isExpandableNonCompositeForeignKey AndAlso PersonalEducationTable.LevelId.IsApplyDisplayAs Then + fvalue = PersonalEducationTable.GetDFKA(itemValue, PersonalEducationTable.LevelId) + End If + If (Not _isExpandableNonCompositeForeignKey) Or (String.IsNullOrEmpty(fvalue)) Then + fvalue = itemValue.Format(EducationTable.Level) + End If + + If fvalue Is Nothing OrElse fvalue.Trim() = "" Then fvalue = cvalue + + If (IsNothing(fvalue)) Then + fvalue = "" + End If + + fvalue = fvalue.Trim() + + If ( fvalue.Length > 50 ) Then + fvalue = fvalue.Substring(0, 50) & "..." + End If + + Dim dupItem As ListItem = Me.LevelId.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.LevelId.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.LevelId, selectedValue) AndAlso _ + Not SetSelectedDisplayText(Me.LevelId, selectedValue)Then + + ' construct a whereclause to query a record with Education.EducationId = selectedValue + Dim filter2 As CompoundFilter = New CompoundFilter(CompoundFilter.CompoundingOperators.And_Operator, Nothing) + Dim whereClause2 As WhereClause = New WhereClause() + filter2.AddFilter(New BaseClasses.Data.ColumnValueFilter(EducationTable.EducationId, selectedValue, BaseClasses.Data.BaseFilter.ComparisonOperator.EqualsTo, False)) + whereClause2.AddFilter(filter2, CompoundFilter.CompoundingOperators.And_Operator) + + Try + ' Execute the query + Dim rc() As EducationRecord = EducationTable.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 EducationRecord = DirectCast(rc(0), EducationRecord) + ' Create the item and add to the list. + Dim cvalue As String = Nothing + Dim fvalue As String = Nothing + If itemValue.EducationIdSpecified Then + cvalue = itemValue.EducationId.ToString() + Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalEducationTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalEducationTable.LevelId) + If _isExpandableNonCompositeForeignKey AndAlso PersonalEducationTable.LevelId.IsApplyDisplayAs Then + fvalue = PersonalEducationTable.GetDFKA(itemValue, PersonalEducationTable.LevelId) + End If + If (Not _isExpandableNonCompositeForeignKey) Or (String.IsNullOrEmpty(fvalue)) Then + fvalue = itemValue.Format(EducationTable.Level) + End If + + If fvalue Is Nothing OrElse fvalue.Trim() = "" Then fvalue = cvalue + Dim newItem As New ListItem(fvalue, cvalue) + Me.LevelId.Items.Add(newItem) + SetSelectedValue(Me.LevelId, selectedValue) + End If + End If + Catch + End Try + + End If + + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalEducationRowDeleteButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + If(Not Me.Page.IsPageRefresh) Then + + Dim tc As PersonalEducationTableControl = DirectCast(GetParentControlObject(Me, "PersonalEducationTableControl"), PersonalEducationTableControl) + If Not (IsNothing(tc)) Then + If Not Me.IsNewRecord Then + tc.AddToDeletedRecordIds(DirectCast(Me, PersonalEducationTableControlRow)) + End If + Me.Visible = False + tc.SetFormulaControls() + End If + + End If + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + Protected Overridable Sub COUNTRY_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()(COUNTRY.ClientID & "_SelectedValue"), String) + Dim displayText As String = CType(Me.Page.Session()(COUNTRY.ClientID & "_SelectedDisplayText"), String) + If displayText <> "" AndAlso val <> "" Then + Me.COUNTRY.Items.Add(New ListItem(displayText, val)) + Me.COUNTRY.SelectedIndex = Me.COUNTRY.Items.Count - 1 + Me.Page.Session.Remove(COUNTRY.ClientID & "_SelectedValue") + Me.Page.Session.Remove(COUNTRY.ClientID & "_SelectedDisplayText") + End If + + + + + End Sub + + Protected Overridable Sub LevelId_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()(LevelId.ClientID & "_SelectedValue"), String) + Dim displayText As String = CType(Me.Page.Session()(LevelId.ClientID & "_SelectedDisplayText"), String) + If displayText <> "" AndAlso val <> "" Then + Me.LevelId.Items.Add(New ListItem(displayText, val)) + Me.LevelId.SelectedIndex = Me.LevelId.Items.Count - 1 + Me.Page.Session.Remove(LevelId.ClientID & "_SelectedValue") + Me.Page.Session.Remove(LevelId.ClientID & "_SelectedDisplayText") + End If + + + + + End Sub + + Protected Overridable Sub Command_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub CommandDate_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub Course_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub CourseAbbr_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub CourseNo_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub EducationPeriod_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub EducationType_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub EdYear_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub EndDate1_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub Facultry_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub Institue_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub NoAll_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub Score_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub ScoreNo_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub StartDate1_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("BasePersonalEducationTableControlRow_Rec"), String) + End Get + Set(ByVal value As String) + Me.ViewState("BasePersonalEducationTableControlRow_Rec") = value + End Set + End Property + + Private _DataSource As PersonalEducationRecord + Public Property DataSource() As PersonalEducationRecord + Get + Return Me._DataSource + End Get + + Set(ByVal value As PersonalEducationRecord) + + Me._DataSource = value + End Set + End Property + + + + Private _checkSum As String + Public Overridable Property CheckSum() As String + Get + Return Me._checkSum + End Get + Set(ByVal value As String) + Me._checkSum = value + End Set + End Property + + Private _TotalPages As Integer + Public Property TotalPages() As Integer + Get + Return Me._TotalPages + End Get + Set(ByVal value As Integer) + Me._TotalPages = value + End Set + End Property + + Private _PageIndex As Integer + Public Property PageIndex() As Integer + Get + ' Return the PageIndex + Return Me._PageIndex + End Get + Set(ByVal value As Integer) + Me._PageIndex = value + End Set + End Property + + Private _DisplayLastPage As Boolean + Public Property DisplayLastPage() As Boolean + Get + Return Me._DisplayLastPage + End Get + Set(ByVal value As Boolean) + Me._DisplayLastPage = value + End Set + End Property + + + +#Region "Helper Properties" + + Public ReadOnly Property Command() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Command"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property CommandDate() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "CommandDate"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property COUNTRY() As System.Web.UI.WebControls.DropDownList + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "COUNTRY"), System.Web.UI.WebControls.DropDownList) + End Get + End Property + + Public ReadOnly Property Course() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Course"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property CourseAbbr() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "CourseAbbr"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property CourseNo() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "CourseNo"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property EducationPeriod() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "EducationPeriod"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property EducationType() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "EducationType"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property EdYear() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "EdYear"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property EndDate1() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "EndDate1"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property Facultry() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Facultry"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property Institue() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Institue"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property LevelId() As System.Web.UI.WebControls.DropDownList + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "LevelId"), System.Web.UI.WebControls.DropDownList) + End Get + End Property + + Public ReadOnly Property NoAll() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "NoAll"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property PersonalEducationRecordRowSelection() As System.Web.UI.WebControls.CheckBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalEducationRecordRowSelection"), System.Web.UI.WebControls.CheckBox) + End Get + End Property + + Public ReadOnly Property PersonalEducationRowDeleteButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalEducationRowDeleteButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property Score() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Score"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property ScoreNo() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "ScoreNo"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property StartDate1() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "StartDate1"), System.Web.UI.WebControls.TextBox) + End Get + End Property + +#End Region + +#Region "Helper Functions" + + Public Overrides Overloads Function ModifyRedirectUrl(ByVal url As String, ByVal arg As String, ByVal bEncrypt As Boolean) As String + Return Me.Page.EvaluateExpressions(url, arg, bEncrypt, Me) + End Function + + Public Overrides Overloads Function EvaluateExpressions(ByVal url As String, ByVal arg As String, ByVal bEncrypt As Boolean) As String + + Dim rec As PersonalEducationRecord = Nothing + + + Try + rec = Me.GetRecord() + Catch ex As Exception + ' Do nothing + End Try + + If rec Is Nothing AndAlso url.IndexOf("{") >= 0 Then + ' Localization. + + Throw New Exception(Page.GetResourceValue("Err:RecDataSrcNotInitialized", "Persons")) + + End If + Return EvaluateExpressions(url, arg, rec, bEncrypt) + End Function + + + Public Overridable Function GetRecord() As PersonalEducationRecord + If Not Me.DataSource Is Nothing Then + Return Me.DataSource + End If + + If Not Me.RecordUniqueId Is Nothing Then + + Return PersonalEducationTable.GetRecord(Me.RecordUniqueId, True) + + End If + + ' Localization. + + Return Nothing + + End Function + + Public Shadows ReadOnly Property Page() As BaseApplicationPage + Get + Return DirectCast(MyBase.Page, BaseApplicationPage) + End Get + End Property + +#End Region + +End Class + + + +' Base class for the PersonalEducationTableControl control on the AddPersonalId page. +' Do not modify this class. Instead override any method in PersonalEducationTableControl. +Public Class BasePersonalEducationTableControl + Inherits Persons.UI.BaseApplicationTableControl + + + + Protected Overridable Sub Control_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Init + + + + ' Setup the filter and search events. + + + + ' Control Initializations. + ' Initialize the table's current sort order. + + If Me.InSession(Me, "Order_By") Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + End If + + + + ' Setup default pagination settings. + + Me.PageSize = CInt(Me.GetFromSession(Me, "Page_Size", "10")) + Me.PageIndex = CInt(Me.GetFromSession(Me, "Page_Index", "0")) + + + + Me.ClearControlsFromSession() + End Sub + + Protected Overridable Sub Control_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load + + SaveControlsToSession_Ajax() + + ' Show confirmation message on Click + Me.PersonalEducationDeleteButton.Attributes.Add("onClick", "return (confirm('" & (CType(Me.Page,BaseApplicationPage)).GetResourceValue("DeleteConfirm", "Persons") & "'));") + + ' Setup the pagination events. + + AddHandler Me.PersonalEducationPagination.FirstPage.Click, AddressOf PersonalEducationPagination_FirstPage_Click + + AddHandler Me.PersonalEducationPagination.LastPage.Click, AddressOf PersonalEducationPagination_LastPage_Click + + AddHandler Me.PersonalEducationPagination.NextPage.Click, AddressOf PersonalEducationPagination_NextPage_Click + + AddHandler Me.PersonalEducationPagination.PageSizeButton.Click, AddressOf PersonalEducationPagination_PageSizeButton_Click + + AddHandler Me.PersonalEducationPagination.PreviousPage.Click, AddressOf PersonalEducationPagination_PreviousPage_Click + + + ' Setup the sorting events. + + AddHandler Me.CommandDateLabel.Click, AddressOf CommandDateLabel_Click + + AddHandler Me.CommandLabel.Click, AddressOf CommandLabel_Click + + AddHandler Me.COUNTRYLabel1.Click, AddressOf COUNTRYLabel1_Click + + AddHandler Me.CourseAbbrLabel.Click, AddressOf CourseAbbrLabel_Click + + AddHandler Me.CourseLabel.Click, AddressOf CourseLabel_Click + + AddHandler Me.CourseNoLabel.Click, AddressOf CourseNoLabel_Click + + AddHandler Me.EducationPeriodLabel.Click, AddressOf EducationPeriodLabel_Click + + AddHandler Me.EducationTypeLabel.Click, AddressOf EducationTypeLabel_Click + + AddHandler Me.EdYearLabel.Click, AddressOf EdYearLabel_Click + + AddHandler Me.EndDateLabel2.Click, AddressOf EndDateLabel2_Click + + AddHandler Me.FacultryLabel.Click, AddressOf FacultryLabel_Click + + AddHandler Me.InstitueLabel.Click, AddressOf InstitueLabel_Click + + AddHandler Me.LevelIdLabel1.Click, AddressOf LevelIdLabel1_Click + + AddHandler Me.NoAllLabel.Click, AddressOf NoAllLabel_Click + + AddHandler Me.ScoreLabel.Click, AddressOf ScoreLabel_Click + + AddHandler Me.ScoreNoLabel.Click, AddressOf ScoreNoLabel_Click + + AddHandler Me.StartDateLabel2.Click, AddressOf StartDateLabel2_Click + + ' Setup the button events. + + AddHandler Me.PersonalEducationAddButton.Click, AddressOf PersonalEducationAddButton_Click + + AddHandler Me.PersonalEducationDeleteButton.Click, AddressOf PersonalEducationDeleteButton_Click + + AddHandler Me.PersonalEducationResetButton.Click, AddressOf PersonalEducationResetButton_Click + + + ' Setup events for others + + End Sub + + + Public Overridable Sub LoadData() + + ' Read data from database. Returns an array of records that can be assigned + ' to the DataSource table control property. + Try + Dim joinFilter As CompoundFilter = CreateCompoundJoinFilter() + + ' The WHERE clause will be empty when displaying all records in table. + Dim wc As WhereClause = CreateWhereClause() + If wc IsNot Nothing AndAlso Not wc.RunQuery Then + ' Initialize an empty array of records + Dim alist As New ArrayList(0) + Me.DataSource = DirectCast(alist.ToArray(GetType(PersonalEducationRecord)), PersonalEducationRecord()) + ' Add records to the list if needed. + Me.AddNewRecords() + Me._TotalRecords = 0 + Me._TotalPages = 0 + Return + End If + + ' Call OrderBy to determine the order - either use the order defined + ' on the Query Wizard, or specified by user (by clicking on column heading) + Dim orderBy As OrderBy = CreateOrderBy() + + ' Get the pagesize from the pagesize control. + Me.GetPageSize() + + If Me.DisplayLastPage Then + Dim totalRecords As Integer = If(Me._TotalRecords < 0, PersonalEducationTable.GetRecordCount(CreateCompoundJoinFilter(), CreateWhereClause()), Me._TotalRecords) + + Dim totalPages As Integer = CInt(Math.Ceiling(totalRecords / Me.PageSize)) + + Me.PageIndex = totalPages - 1 + End If + + ' Make sure PageIndex (current page) and PageSize are within bounds. + If Me.PageIndex < 0 Then + Me.PageIndex = 0 + End If + If Me.PageSize < 1 Then + Me.PageSize = 1 + End If + + ' Retrieve the records and set the table DataSource. + ' Only PageSize records are fetched starting at PageIndex (zero based). + If Me.AddNewRecord > 0 Then + ' Make sure to preserve the previously entered data on new rows. + Dim postdata As New ArrayList + For Each rc As PersonalEducationTableControlRow In Me.GetRecordControls() + If Not rc.IsNewRecord Then + rc.DataSource = rc.GetRecord() + rc.GetUIData() + postdata.Add(rc.DataSource) + UIData.Add(rc.PreservedUIData()) + End If + Next + Me.DataSource = DirectCast(postdata.ToArray(GetType(PersonalEducationRecord)), PersonalEducationRecord()) + Else ' Get the records from the database + Me.DataSource = PersonalEducationTable.GetRecords(joinFilter, wc, orderBy, Me.PageIndex, Me.PageSize) + + End If + + ' if the datasource contains no records contained in database, then load the last page. + If (DbUtils.GetCreatedRecords(Me.DataSource).Length = 0 AndAlso Not Me.DisplayLastPage) Then + Me.DisplayLastPage = True + LoadData() + Else + + ' Add any new rows desired by the user. + Me.AddNewRecords() + + ' Turn off the ToggleAll checkbox + Me.PersonalEducationToggleAll.Checked = False + + + ' Initialize the page and grand totals. now + + End If + + Catch ex As Exception + ' Report the error message to the end user + Dim msg As String = ex.Message + If ex.InnerException IsNot Nothing Then + msg = msg & " InnerException: " & ex.InnerException.Message + End If + Throw New Exception(msg, ex.InnerException) + End Try + End Sub + + + + + Public Overrides Sub DataBind() + ' The DataBind method binds the user interface controls to the values + ' from the database record for each row in the table. To do this, it calls the + ' DataBind for each of the rows. + ' DataBind also populates any filters above the table, and sets the pagination + ' control to the correct number of records and the current page number. + + MyBase.DataBind() + + ' Make sure that the DataSource is initialized. + If Me.DataSource Is Nothing Then + Return + End If + + 'LoadData for DataSource for chart and report if they exist + + ' Improve performance by prefetching display as records. + Me.PreFetchForeignKeyValues() + + ' Setup the pagination controls. + BindPaginationControls() + + + + ' Bind the repeater with the list of records to expand the UI. + Dim rep As System.Web.UI.WebControls.Repeater = CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalEducationTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return + rep.DataSource = DataSource() + rep.DataBind() + + Dim index As Integer = 0 + For Each repItem As System.Web.UI.WebControls.RepeaterItem In rep.Items + ' Loop through all rows in the table, set its DataSource and call DataBind(). + Dim recControl As PersonalEducationTableControlRow = DirectCast(repItem.FindControl("PersonalEducationTableControlRow"), PersonalEducationTableControlRow) + recControl.DataSource = Me.DataSource(index) + If Me.UIData.Count > index Then + recControl.PreviousUIData = Me.UIData(index) + End If + recControl.DataBind() + recControl.Visible = Not Me.InDeletedRecordIds(recControl) + + index += 1 + Next + + + + + ' Call the Set methods for each controls on the panel + + SetCommandDateLabel() + SetCommandLabel() + SetCOUNTRYLabel1() + SetCourseAbbrLabel() + SetCourseLabel() + SetCourseNoLabel() + SetEducationPeriodLabel() + SetEducationTypeLabel() + SetEdYearLabel() + SetEndDateLabel2() + SetFacultryLabel() + SetInstitueLabel() + SetLevelIdLabel1() + SetNoAllLabel() + + + + + SetPersonalEducationTableControlCollapsibleRegion() + + SetScoreLabel() + SetScoreNoLabel() + SetStartDateLabel2() + ' setting the state of expand or collapse alternative rows + + + ' Load data for each record and table UI control. + ' Ordering is important because child controls get + ' their parent ids from their parent UI controls. + + + ' this method calls the set method for controls with special formula like running total, sum, rank, etc + SetFormulaControls() + End Sub + + Public Overridable Sub SetFormulaControls() + ' this method calls Set methods for the control that has special formula + + + + End Sub + + + Public Sub PreFetchForeignKeyValues() + If (IsNothing(Me.DataSource)) + Return + End If + + Me.Page.PregetDfkaRecords(PersonalEducationTable.COUNTRY, Me.DataSource) + + Me.Page.PregetDfkaRecords(PersonalEducationTable.EducationPeriod, Me.DataSource) + + Me.Page.PregetDfkaRecords(PersonalEducationTable.LevelId, Me.DataSource) + + End Sub + + + Public Overridable Sub RegisterPostback() + + + End Sub + + Public EvaluateFormulaDelegate As BaseClasses.Data.DataSource.EvaluateFormulaDelegate = New BaseClasses.Data.DataSource.EvaluateFormulaDelegate(AddressOf Me.EvaluateFormula) + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean, ByVal e as FormulaEvaluator) As String + If e Is Nothing + e = New FormulaEvaluator() + End If + + e.Variables.Clear() + + + ' add variables for formula evaluation + If variables IsNot Nothing Then + Dim enumerator As System.Collections.Generic.IEnumerator(Of System.Collections.Generic.KeyValuePair(Of String, Object)) = variables.GetEnumerator() + While enumerator.MoveNext() + e.Variables.Add(enumerator.Current.Key, enumerator.Current.Value) + End While + End If + + If includeDS + + End If + + ' All variables referred to in the formula are expected to be + ' properties of the DataSource. For example, referring to + ' UnitPrice as a variable will refer to DataSource.UnitPrice + e.DataSource = dataSourceForEvaluate + + ' Define the calling control. This is used to add other + ' related table and record controls as variables. + e.CallingControl = Me + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + + If Not String.IsNullOrEmpty(format) AndAlso (String.IsNullOrEmpty(formula) OrElse formula.IndexOf("Format(") < 0) Then + Return FormulaUtils.Format(resultObj, format) + Else + Return resultObj.ToString() + End If + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format,variables ,includeDS, Nothing) + End Function + + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object)) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format, variables ,True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, format, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal e as FormulaEvaluator) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, variables, True, e) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal includeDS as Boolean) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, includeDS, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, True, Nothing) + End Function + + + + + Public Overridable Sub ResetControl() + + Me.CurrentSortOrder.Reset() + If (Me.InSession(Me, "Order_By")) Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + End If + + Me.PageIndex = 0 + End Sub + + Protected Overridable Sub BindPaginationControls() + ' Setup the pagination controls. + + ' Bind the pagination labels. + + If DbUtils.GetCreatedRecords(Me.DataSource).Length > 0 Then + + Me.PersonalEducationPagination.CurrentPage.Text = (Me.PageIndex + 1).ToString() + Else + Me.PersonalEducationPagination.CurrentPage.Text = "0" + End If + Me.PersonalEducationPagination.PageSize.Text = Me.PageSize.ToString() + Me.PersonalEducationPagination.TotalItems.Text = Me.TotalRecords.ToString() + Me.PersonalEducationPagination.TotalPages.Text = Me.TotalPages.ToString() + + ' Bind the buttons for PersonalEducationTableControl pagination. + + Me.PersonalEducationPagination.FirstPage.Enabled = Not (Me.PageIndex = 0) + If Me._TotalPages < 0 Then ' if the total pages is not determined yet, enable last and next buttons + Me.PersonalEducationPagination.LastPage.Enabled = True + ElseIf Me._TotalPages = 0 ' if the total pages is determined and it is 0, enable last and next buttons + Me.PersonalEducationPagination.LastPage.Enabled = False + Else ' if the total pages is the last page, disable last and next buttons + Me.PersonalEducationPagination.LastPage.Enabled = Not (Me.PageIndex = Me.TotalPages - 1) + End If + + If Me._TotalPages < 0 Then ' if the total pages is not determined yet, enable last and next buttons + Me.PersonalEducationPagination.NextPage.Enabled = True + ElseIf Me._TotalPages = 0 ' if the total pages is determined and it is 0, enable last and next buttons + Me.PersonalEducationPagination.NextPage.Enabled = False + Else ' if the total pages is the last page, disable last and next buttons + Me.PersonalEducationPagination.NextPage.Enabled = Not (Me.PageIndex = Me.TotalPages - 1) + End If + + Me.PersonalEducationPagination.PreviousPage.Enabled = Not (Me.PageIndex = 0) + + + End Sub + + Public Overridable Sub SaveData() + ' Save the data from the entire table. Calls each row's Save Data + ' to save their data. This function is called by the Click handler of the + ' Save button. The button handler should Start/Commit/End a transaction. + + Dim recCtl As PersonalEducationTableControlRow + For Each recCtl In Me.GetRecordControls() + + If Me.InDeletedRecordIds(recCtl) Then + ' Delete any pending deletes. + recCtl.Delete() + Else + If recCtl.Visible Then + recCtl.SaveData() + End If + End If + + Next + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + ' Set IsNewRecord to False for all records - since everything has been saved and is no longer "new" + For Each recCtl In Me.GetRecordControls() + recCtl.IsNewRecord = False + Next + + + ' Set DeletedRecordsIds to Nothing since we have deleted all pending deletes. + Me.DeletedRecordIds = Nothing + + End Sub + + Public Overridable Function CreateCompoundJoinFilter() As CompoundFilter + Dim jFilter As CompoundFilter = New CompoundFilter() + + Return jFilter + + End Function + + + Public Overridable Function CreateOrderBy() As OrderBy + ' The CurrentSortOrder is initialized to the sort order on the + ' Query Wizard. It may be modified by the Click handler for any of + ' the column heading to sort or reverse sort by that column. + ' You can add your own sort order, or modify it on the Query Wizard. + Return Me.CurrentSortOrder + End Function + + Public Overridable Function CreateWhereClause() As WhereClause + 'This CreateWhereClause is used for loading the data. + PersonalEducationTable.Instance.InnerFilter = Nothing + Dim wc As WhereClause = New WhereClause() + + ' Compose the WHERE clause consiting of: + ' 1. Static clause defined at design time. + ' 2. User selected search criteria. + ' 3. User selected filter criteria. + + + Dim selectedRecordKeyValue as KeyValue = New KeyValue() + + Dim personalIdRecordControlObj As Persons.UI.Controls.AddPersonalId.PersonalIdRecordControl = DirectCast(MiscUtils.FindControlRecursively(Me.Page, "PersonalIdRecordControl"), Persons.UI.Controls.AddPersonalId.PersonalIdRecordControl) + + If (Not IsNothing(personalIdRecordControlObj) AndAlso Not IsNothing(personalIdRecordControlObj.GetRecord()) AndAlso personalIdRecordControlObj.GetRecord().IsCreated AndAlso Not IsNothing(personalIdRecordControlObj.GetRecord().PersonalId)) + wc.iAND(PersonalEducationTable.PersonalId, BaseFilter.ComparisonOperator.EqualsTo, personalIdRecordControlObj.GetRecord().PersonalId.ToString()) + selectedRecordKeyValue.AddElement(PersonalEducationTable.PersonalId.InternalName, personalIdRecordControlObj.GetRecord().PersonalId.ToString()) + Else + wc.RunQuery = False + Return wc + End If + + HttpContext.Current.Session("PersonalEducationTableControlWhereClause") = selectedRecordKeyValue.ToXmlString() + + Return wc + End Function + + + Public Overridable Function CreateWhereClause(ByVal searchText as String, ByVal fromSearchControl as String, ByVal AutoTypeAheadSearch as String, ByVal AutoTypeAheadWordSeparators as String) As WhereClause + ' This CreateWhereClause is used for loading list of suggestions for Auto Type-Ahead feature. + PersonalEducationTable.Instance.InnerFilter = Nothing + Dim wc As WhereClause = New WhereClause() + + ' Compose the WHERE clause consiting of: + ' 1. Static clause defined at design time. + ' 2. User selected search criteria. + ' 3. User selected filter criteria. + + Dim appRelativeVirtualPath As String = CType(HttpContext.Current.Session("AppRelativeVirtualPath"), String) + + Dim selectedRecordInPersonalIdRecordControl as String = DirectCast(HttpContext.Current.Session("PersonalEducationTableControlWhereClause"), String) + + If Not selectedRecordInPersonalIdRecordControl Is Nothing AndAlso KeyValue.IsXmlKey(selectedRecordInPersonalIdRecordControl) Then + Dim selectedRecordKeyValue as KeyValue = KeyValue.XmlToKey(selectedRecordInPersonalIdRecordControl) + + If Not IsNothing(selectedRecordKeyValue) AndAlso selectedRecordKeyValue.ContainsColumn(PersonalEducationTable.PersonalId) Then + wc.iAND(PersonalEducationTable.PersonalId, BaseFilter.ComparisonOperator.EqualsTo, selectedRecordKeyValue.GetColumnValue(PersonalEducationTable.PersonalId).ToString()) + End If + + End If + + ' Adds clauses if values are selected in Filter controls which are configured in the page. + + + Return wc + End Function + + + Public Overridable Function FormatSuggestions(ByVal prefixText As String, ByVal resultItem As String, _ + ByVal columnLength As Integer, ByVal AutoTypeAheadDisplayFoundText As String, _ + ByVal autoTypeAheadSearch As String, ByVal AutoTypeAheadWordSeparators As String, _ + ByVal resultList As ArrayList) As Boolean + + 'Formats the resultItem and adds it to the list of suggestions. + Dim index As Integer = resultItem.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture).IndexOf(prefixText.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture)) + Dim itemToAdd As String = "" + Dim isFound As Boolean = False + Dim isAdded As Boolean = False + ' Get the index where prfixt is at the beginning of resultItem. If not found then, index of word which begins with prefixText. + If InvariantLCase(autoTypeAheadSearch).equals("wordsstartingwithsearchstring") And Not index = 0 Then + ' Expression to find word which contains AutoTypeAheadWordSeparators followed by prefixText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex( AutoTypeAheadWordSeparators + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + If regex1.IsMatch(resultItem) Then + index = regex1.Match(resultItem).Index + isFound = True + End If + ' If the prefixText is found immediatly after white space then starting of the word is found so don not search any further + If not resultItem(index).ToString() = " " Then + ' Expression to find beginning of the word which contains AutoTypeAheadWordSeparators followed by prefixText + Dim regex As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\\S*" + AutoTypeAheadWordSeparators + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + If regex.IsMatch(resultItem) Then + index = regex.Match(resultItem).Index + isFound = True + End If + End If + End If + + ' If autoTypeAheadSearch value is wordsstartingwithsearchstring then, extract the substring only if the prefixText is found at the + ' beginning of the resultItem (index = 0) or a word in resultItem is found starts with prefixText. + If index = 0 Or isFound Or InvariantLCase(autoTypeAheadSearch).Equals("anywhereinstring") then + If InvariantLCase(AutoTypeAheadDisplayFoundText).equals("atbeginningofmatchedstring") Then + ' Expression to find beginning of the word which contains prefixText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\\S*" + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + ' Find the beginning of the word which contains prefexText + If (StringUtils.InvariantLCase(autoTypeAheadSearch).Equals("anywhereinstring") AndAlso regex1.IsMatch(resultItem)) Then + index = regex1.Match(resultItem).Index + isFound = True + End If + ' Display string from the index till end of the string if sub string from index till end is less than columnLength value. + If Len(resultItem) - index <= columnLength Then + If index = 0 Then + itemToAdd = resultItem + Else + itemToAdd = "..." & resultItem.Substring(index, Len(resultItem) - index) + End If + Else + If index = 0 Then + itemToAdd = resultItem.Substring(index, (columnLength - 3)) & "..." + Else + 'Truncate the string to show only columnLength - 6 characters as begining and trailing "..." has to be appended. + itemToAdd = "..." & resultItem.Substring(index , columnLength - 6) & "..." + End If + End If + ElseIf InvariantLCase(AutoTypeAheadDisplayFoundText).equals("inmiddleofmatchedstring") Then + Dim subStringBeginIndex As Integer = CType(columnLength/2, Integer) + If Len(resultItem) <= columnLength Then + itemToAdd = resultItem + Else + ' Sanity check at end of the string + If index + Len(prefixText) = columnLength Then + itemToAdd = "..." & resultItem.Substring(index-columnLength,index) + ElseIf Len(resultItem) - index < subStringBeginIndex Then + ' Display string from the end till columnLength value if, index is closer to the end of the string. + itemToAdd = "..." & resultItem.Substring(Len(resultItem)-columnLength,Len(resultItem)) + ElseIf index <= subStringBeginIndex Then + ' Sanity chet at beginning of the string + itemToAdd = resultItem.Substring(0, columnLength) & "..." + Else + ' Display string containing text before the prefixText occures and text after the prefixText + itemToAdd = "..." & resultItem.Substring(index - subStringBeginIndex, columnLength) & "..." + End If + End If + ElseIf InvariantLCase(AutoTypeAheadDisplayFoundText).equals("atendofmatchedstring") Then + ' Expression to find ending of the word which contains prefexText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\s", System.Text.RegularExpressions.RegexOptions.IgnoreCase) + ' Find the ending of the word which contains prefexText + If regex1.IsMatch(resultItem, index + 1) Then + index = regex1.Match(resultItem, index + 1).Index + Else + ' If the word which contains prefexText is the last word in string, regex1.IsMatch returns false. + index = resultItem.Length + End If + If index > Len(resultItem) Then + index = Len(resultItem) + End If + ' If text from beginning of the string till index is less than columnLength value then, display string from the beginning till index. + If index <= columnLength Then + if index = Len(resultItem) Then 'Make decision to append "..." + itemToAdd = resultItem.Substring(0,index) + Else + itemToAdd = resultItem.Substring(0,index) & "..." + End If + Else + If index = Len(resultItem) Then + itemToAdd = "..." & resultItem.Substring(index - (columnLength - 3), (columnLength - 3)) + Else + 'Truncate the string to show only columnLength - 6 characters as begining and trailing "..." has to be appended. + itemToAdd = "..." & resultItem.Substring(index - (columnLength - 6), columnLength - 6) & "..." + End If + End If + End If + + ' Remove newline character from itemToAdd + Dim prefixTextIndex As Integer = itemToAdd.IndexOf(prefixText, StringComparison.CurrentCultureIgnoreCase) + ' If itemToAdd contains any newline after the search text then show text only till newline + Dim regex2 As System.Text.RegularExpressions.Regex = New System.Text.RegularExpressions.Regex("(" & vbCrLf & "|" & vbLf & ")", System.Text.RegularExpressions.RegexOptions.IgnoreCase) + Dim newLineIndexAfterPrefix As Integer = -1 + If regex2.IsMatch(itemToAdd, prefixTextIndex) Then + newLineIndexAfterPrefix = regex2.Match(itemToAdd, prefixTextIndex).Index + End If + If (newLineIndexAfterPrefix > -1) Then + If itemToAdd.EndsWith("...") Then + itemToAdd = (itemToAdd.Substring(0, newLineIndexAfterPrefix) + "...") + Else + itemToAdd = itemToAdd.Substring(0, newLineIndexAfterPrefix) + End If + End If + ' If itemToAdd contains any newline before search text then show text which comes after newline + Dim regex3 As System.Text.RegularExpressions.Regex = New System.Text.RegularExpressions.Regex("(" & vbCrLf & "|" & vbLf & ")", (System.Text.RegularExpressions.RegexOptions.IgnoreCase Or System.Text.RegularExpressions.RegexOptions.RightToLeft)) + Dim newLineIndexBeforePrefix As Integer = -1 + If regex3.IsMatch(itemToAdd, prefixTextIndex) Then + newLineIndexBeforePrefix = regex3.Match(itemToAdd, prefixTextIndex).Index + End If + If (newLineIndexBeforePrefix > -1) Then + If itemToAdd.StartsWith("...") Then + itemToAdd = ("..." + itemToAdd.Substring((newLineIndexBeforePrefix + regex3.Match(itemToAdd, prefixTextIndex).Length))) + Else + itemToAdd = itemToAdd.Substring((newLineIndexBeforePrefix + regex3.Match(itemToAdd, prefixTextIndex).Length)) + End If + End If + + If Not itemToAdd is nothing AndAlso Not resultList.Contains(itemToAdd) Then + + resultList.Add(itemToAdd) + + isAdded = true + End If + End If + Return isAdded + End Function + + + Protected Overridable Sub GetPageSize() + + If Me.PersonalEducationPagination.PageSize.Text.Trim <> "" Then + Try + 'Me.PageSize = Integer.Parse(Me.PersonalEducationPagination.PageSize.Text) + Catch ex As Exception + End Try + End If + End Sub + + Protected Overridable Sub AddNewRecords() + + Dim newRecordList As ArrayList = New ArrayList() + + Dim newUIDataList As System.Collections.Generic.List(Of Hashtable) = New System.Collections.Generic.List(Of Hashtable)() + + ' Loop though all the record controls and if the record control + ' does not have a unique record id set, then create a record + ' and add to the list. + If Not Me.ResetData Then + Dim rep As System.Web.UI.WebControls.Repeater = CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalEducationTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return + + Dim repItem As System.Web.UI.WebControls.RepeaterItem + For Each repItem In rep.Items + ' Loop through all rows in the table, set its DataSource and call DataBind(). + + Dim recControl As PersonalEducationTableControlRow = DirectCast(repItem.FindControl("PersonalEducationTableControlRow"), PersonalEducationTableControlRow) + + If recControl.Visible AndAlso recControl.IsNewRecord() Then + + Dim rec As PersonalEducationRecord = New PersonalEducationRecord() + + If recControl.Command.Text <> "" Then + rec.Parse(recControl.Command.Text, PersonalEducationTable.Command) + End If + If recControl.CommandDate.Text <> "" Then + rec.Parse(recControl.CommandDate.Text, PersonalEducationTable.CommandDate) + End If + If MiscUtils.IsValueSelected(recControl.COUNTRY) Then + rec.Parse(recControl.COUNTRY.SelectedItem.Value, PersonalEducationTable.COUNTRY) + End If + If recControl.Course.Text <> "" Then + rec.Parse(recControl.Course.Text, PersonalEducationTable.Course) + End If + If recControl.CourseAbbr.Text <> "" Then + rec.Parse(recControl.CourseAbbr.Text, PersonalEducationTable.CourseAbbr) + End If + If recControl.CourseNo.Text <> "" Then + rec.Parse(recControl.CourseNo.Text, PersonalEducationTable.CourseNo) + End If + If recControl.EducationPeriod.Text <> "" Then + rec.Parse(recControl.EducationPeriod.Text, PersonalEducationTable.EducationPeriod) + End If + If recControl.EducationType.Text <> "" Then + rec.Parse(recControl.EducationType.Text, PersonalEducationTable.EducationType) + End If + If recControl.EdYear.Text <> "" Then + rec.Parse(recControl.EdYear.Text, PersonalEducationTable.EdYear) + End If + If recControl.EndDate1.Text <> "" Then + rec.Parse(recControl.EndDate1.Text, PersonalEducationTable.EndDate) + End If + If recControl.Facultry.Text <> "" Then + rec.Parse(recControl.Facultry.Text, PersonalEducationTable.Facultry) + End If + If recControl.Institue.Text <> "" Then + rec.Parse(recControl.Institue.Text, PersonalEducationTable.Institue) + End If + If MiscUtils.IsValueSelected(recControl.LevelId) Then + rec.Parse(recControl.LevelId.SelectedItem.Value, PersonalEducationTable.LevelId) + End If + If recControl.NoAll.Text <> "" Then + rec.Parse(recControl.NoAll.Text, PersonalEducationTable.NoAll) + End If + If recControl.Score.Text <> "" Then + rec.Parse(recControl.Score.Text, PersonalEducationTable.Score) + End If + If recControl.ScoreNo.Text <> "" Then + rec.Parse(recControl.ScoreNo.Text, PersonalEducationTable.ScoreNo) + End If + If recControl.StartDate1.Text <> "" Then + rec.Parse(recControl.StartDate1.Text, PersonalEducationTable.StartDate) + End If + newUIDataList.Add(recControl.PreservedUIData()) + newRecordList.Add(rec) + End If + Next + End If + + + ' Add any new record to the list. + Dim index As Integer = 0 + For index = 1 To Me.AddNewRecord + + newRecordList.Insert(0, New PersonalEducationRecord()) + newUIDataList.Insert(0, New Hashtable()) + + Next + Me.AddNewRecord = 0 + + ' Finally, add any new records to the DataSource. + If newRecordList.Count > 0 Then + + Dim finalList As ArrayList = New ArrayList(Me.DataSource) + finalList.InsertRange(0, newRecordList) + + Me.DataSource = DirectCast(finalList.ToArray(GetType(PersonalEducationRecord)), PersonalEducationRecord()) + + End If + + ' Add the existing UI data to this hash table + If newUIDataList.Count > 0 Then + Me.UIData.InsertRange(0, newUIDataList) + End If + + End Sub + + + Public Sub AddToDeletedRecordIds(ByVal rec As PersonalEducationTableControlRow) + If rec.IsNewRecord() Then + Return + End If + + If Not Me.DeletedRecordIds Is Nothing AndAlso Me.DeletedRecordIds.Trim <> "" Then + Me.DeletedRecordIds &= "," + End If + + Me.DeletedRecordIds &= "[" & rec.RecordUniqueId & "]" + End Sub + + Protected Overridable Function InDeletedRecordIds(ByVal rec As PersonalEducationTableControlRow) As Boolean + If Me.DeletedRecordIds Is Nothing OrElse Me.DeletedRecordIds.Trim = "" Then + Return False + End If + + Return Me.DeletedRecordIds.IndexOf("[" & rec.RecordUniqueId & "]") >= 0 + End Function + + Private _DeletedRecordIds As String + Public Property DeletedRecordIds() As String + Get + Return Me._DeletedRecordIds + End Get + Set(ByVal value As String) + Me._DeletedRecordIds = value + End Set + End Property + + + ' Create Set, WhereClause, and Populate Methods + + Public Overridable Sub SetCommandDateLabel() + + End Sub + + Public Overridable Sub SetCommandLabel() + + End Sub + + Public Overridable Sub SetCOUNTRYLabel1() + + End Sub + + Public Overridable Sub SetCourseAbbrLabel() + + End Sub + + Public Overridable Sub SetCourseLabel() + + End Sub + + Public Overridable Sub SetCourseNoLabel() + + End Sub + + Public Overridable Sub SetEducationPeriodLabel() + + End Sub + + Public Overridable Sub SetEducationTypeLabel() + + End Sub + + Public Overridable Sub SetEdYearLabel() + + End Sub + + Public Overridable Sub SetEndDateLabel2() + + End Sub + + Public Overridable Sub SetFacultryLabel() + + End Sub + + Public Overridable Sub SetInstitueLabel() + + End Sub + + Public Overridable Sub SetLevelIdLabel1() + + End Sub + + Public Overridable Sub SetNoAllLabel() + + End Sub + + Public Overridable Sub SetPersonalEducationTableControlCollapsibleRegion() + + End Sub + + Public Overridable Sub SetScoreLabel() + + End Sub + + Public Overridable Sub SetScoreNoLabel() + + End Sub + + Public Overridable Sub SetStartDateLabel2() + + 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. + Dim added As Boolean = Me.AddNewRecord > 0 + Me.LoadData() + Me.DataBind() + + If added Then + Me.SetFocusToAddedRow() + End If + + End If + + + + Catch ex As Exception + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + Finally + DbUtils.EndTransaction + End Try + End Sub + + 'this function sets focus to the first editable element in the new added row in the editable table + Protected Overridable Sub SetFocusToAddedRow() + Dim rep As System.Web.UI.WebControls.Repeater = CType(Me.FindControl("PersonalEducationTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing OrElse rep.Items.Count = 0 Then Return + Dim repItem As System.Web.UI.WebControls.RepeaterItem + For Each repItem In rep.Items + 'Load scripts to table rows + Me.Page.LoadFocusScripts(repItem) + Dim recControl As PersonalEducationTableControlRow = DirectCast(repItem.FindControl("PersonalEducationTableControlRow"), PersonalEducationTableControlRow) + If recControl.IsNewRecord Then + For Each field As Control In recControl.Controls + If field.Visible AndAlso Me.Page.IsControlEditable(field, False) Then + 'set focus on the first editable field in the new row + field.Focus() + Dim updPan As UpdatePanel = DirectCast(Me.Page.FindControlRecursively("UpdatePanel1"), UpdatePanel) + If Not updPan Is Nothing Then updPan.Update() + Return + End If + Next + Return + End If + Next + End Sub + + + Protected Overrides Sub SaveControlsToSession() + MyBase.SaveControlsToSession() + + ' Save filter controls to values to session. + + + 'Save pagination state to session. + + + + ' Save table control properties to the session. + If Not Me.CurrentSortOrder Is Nothing Then + Me.SaveToSession(Me, "Order_By", Me.CurrentSortOrder.ToXmlString()) + End If + + Me.SaveToSession(Me, "Page_Index", Me.PageIndex.ToString()) + Me.SaveToSession(Me, "Page_Size", Me.PageSize.ToString()) + + Me.SaveToSession(Me, "DeletedRecordIds", Me.DeletedRecordIds) + + End Sub + + Protected Sub SaveControlsToSession_Ajax() + ' Save filter controls to values to session. + + HttpContext.Current.Session("AppRelativeVirtualPath") = Me.Page.AppRelativeVirtualPath + + End Sub + + Protected Overrides Sub ClearControlsFromSession() + MyBase.ClearControlsFromSession() + + ' Clear filter controls values from the session. + + + ' Clear pagination state from session. + + + + ' Clear table properties from the session. + Me.RemoveFromSession(Me, "Order_By") + Me.RemoveFromSession(Me, "Page_Index") + Me.RemoveFromSession(Me, "Page_Size") + + Me.RemoveFromSession(Me, "DeletedRecordIds") + + End Sub + + Protected Overrides Sub LoadViewState(ByVal savedState As Object) + MyBase.LoadViewState(savedState) + + Dim orderByStr As String = CType(ViewState("PersonalEducationTableControl_OrderBy"), String) + + If orderByStr IsNot Nothing AndAlso orderByStr.Trim <> "" Then + Me.CurrentSortOrder = BaseClasses.Data.OrderBy.FromXmlString(orderByStr) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + End If + + Dim pageIndex As String = CType(ViewState("Page_Index"), String) + If pageIndex IsNot Nothing Then + Me.PageIndex = CInt(pageIndex) + End If + + Dim pageSize As String = CType(ViewState("Page_Size"), String) + If Not pageSize Is Nothing Then + Me.PageSize = CInt(pageSize) + End If + + + + ' Load view state for pagination control. + + Me.DeletedRecordIds = CType(Me.ViewState("DeletedRecordIds"), String) + + End Sub + + Protected Overrides Function SaveViewState() As Object + + If Me.CurrentSortOrder IsNot Nothing Then + Me.ViewState("PersonalEducationTableControl_OrderBy") = Me.CurrentSortOrder.ToXmlString() + End If + + Me.ViewState("Page_Index") = Me.PageIndex + Me.ViewState("Page_Size") = Me.PageSize + + Me.ViewState("DeletedRecordIds") = Me.DeletedRecordIds + + + ' Load view state for pagination control. + + + Return MyBase.SaveViewState() + End Function + + ' Generate the event handling functions for pagination events. + + ' event handler for ImageButton + Public Overridable Sub PersonalEducationPagination_FirstPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.PageIndex = 0 + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalEducationPagination_LastPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.DisplayLastPage = True + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalEducationPagination_NextPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.PageIndex += 1 + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for LinkButton + Public Overridable Sub PersonalEducationPagination_PageSizeButton_Click(ByVal sender As Object, ByVal args As EventArgs) + + Try + + Me.DataChanged = True + + Me.PageSize = Integer.Parse(Me.PersonalEducationPagination.PageSize.Text) + + Me.PageIndex = Integer.Parse(Me.PersonalEducationPagination.CurrentPage.Text) - 1 + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalEducationPagination_PreviousPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + If Me.PageIndex > 0 Then + Me.PageIndex -= 1 + Me.DataChanged = True + End If + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + + ' Generate the event handling functions for sorting events. + + Public Overridable Sub CommandDateLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by CommandDate when clicked. + + ' Get previous sorting state for CommandDate. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalEducationTable.CommandDate) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for CommandDate. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalEducationTable.CommandDate, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by CommandDate, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub CommandLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by Command when clicked. + + ' Get previous sorting state for Command. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalEducationTable.Command) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for Command. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalEducationTable.Command, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by Command, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub COUNTRYLabel1_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by COUNTRY when clicked. + + ' Get previous sorting state for COUNTRY. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalEducationTable.COUNTRY) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for COUNTRY. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalEducationTable.COUNTRY, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by COUNTRY, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub CourseAbbrLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by CourseAbbr when clicked. + + ' Get previous sorting state for CourseAbbr. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalEducationTable.CourseAbbr) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for CourseAbbr. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalEducationTable.CourseAbbr, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by CourseAbbr, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub CourseLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by Course when clicked. + + ' Get previous sorting state for Course. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalEducationTable.Course) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for Course. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalEducationTable.Course, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by Course, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub CourseNoLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by CourseNo when clicked. + + ' Get previous sorting state for CourseNo. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalEducationTable.CourseNo) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for CourseNo. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalEducationTable.CourseNo, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by CourseNo, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub EducationPeriodLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by EducationPeriod when clicked. + + ' Get previous sorting state for EducationPeriod. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalEducationTable.EducationPeriod) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for EducationPeriod. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalEducationTable.EducationPeriod, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by EducationPeriod, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub EducationTypeLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by EducationType when clicked. + + ' Get previous sorting state for EducationType. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalEducationTable.EducationType) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for EducationType. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalEducationTable.EducationType, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by EducationType, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub EdYearLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by EdYear when clicked. + + ' Get previous sorting state for EdYear. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalEducationTable.EdYear) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for EdYear. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalEducationTable.EdYear, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by EdYear, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub EndDateLabel2_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by EndDate when clicked. + + ' Get previous sorting state for EndDate. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalEducationTable.EndDate) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for EndDate. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalEducationTable.EndDate, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by EndDate, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub FacultryLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by Facultry when clicked. + + ' Get previous sorting state for Facultry. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalEducationTable.Facultry) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for Facultry. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalEducationTable.Facultry, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by Facultry, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub InstitueLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by Institue when clicked. + + ' Get previous sorting state for Institue. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalEducationTable.Institue) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for Institue. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalEducationTable.Institue, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by Institue, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub LevelIdLabel1_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by LevelId when clicked. + + ' Get previous sorting state for LevelId. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalEducationTable.LevelId) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for LevelId. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalEducationTable.LevelId, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by LevelId, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub NoAllLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by NoAll when clicked. + + ' Get previous sorting state for NoAll. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalEducationTable.NoAll) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for NoAll. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalEducationTable.NoAll, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by NoAll, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub ScoreLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by Score when clicked. + + ' Get previous sorting state for Score. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalEducationTable.Score) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for Score. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalEducationTable.Score, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by Score, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub ScoreNoLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by ScoreNo when clicked. + + ' Get previous sorting state for ScoreNo. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalEducationTable.ScoreNo) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for ScoreNo. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalEducationTable.ScoreNo, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by ScoreNo, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub StartDateLabel2_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by StartDate when clicked. + + ' Get previous sorting state for StartDate. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalEducationTable.StartDate) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for StartDate. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalEducationTable.StartDate, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by StartDate, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + + ' Generate the event handling functions for button events. + + ' event handler for ImageButton + Public Overridable Sub PersonalEducationAddButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + Me.AddNewRecord = 1 + Me.DataChanged = True + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalEducationDeleteButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + If(Not Me.Page.IsPageRefresh) Then + + Me.DeleteSelectedRecords(True) + Me.SetFormulaControls() + + + End If + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalEducationResetButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.CurrentSortOrder.Reset() + If Me.InSession(Me, "Order_By") Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + + End If + + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + + + ' Generate the event handling functions for filter and search events. + + + ' Generate the event handling functions for others + + + Private _UIData As New System.Collections.Generic.List(Of Hashtable) + Public Property UIData() As System.Collections.Generic.List(Of Hashtable) + Get + Return Me._UIData + End Get + Set(ByVal value As System.Collections.Generic.List(Of Hashtable)) + Me._UIData = value + End Set + End Property + + ' pagination properties + Protected _PageSize As Integer + Public Property PageSize() As Integer + Get + Return Me._PageSize + End Get + Set(ByVal value As Integer) + Me._PageSize = value + End Set + End Property + + Protected _PageIndex As Integer + Public Property PageIndex() As Integer + Get + ' Return the PageIndex + Return Me._PageIndex + End Get + Set(ByVal value As Integer) + Me._PageIndex = value + End Set + End Property + + Protected _TotalRecords As Integer = -1 + Public Property TotalRecords() As Integer + Get + If _TotalRecords < 0 + _TotalRecords = PersonalEducationTable.GetRecordCount(CreateCompoundJoinFilter(), CreateWhereClause()) + End If + Return Me._TotalRecords + End Get + Set(ByVal value As Integer) + If Me.PageSize > 0 Then + + Me.TotalPages = CInt(Math.Ceiling(value / Me.PageSize)) + + End If + Me._TotalRecords = value + End Set + End Property + + + + Protected _TotalPages As Integer = -1 + Public Property TotalPages() As Integer + Get + If _TotalPages < 0 Then + + Me.TotalPages = CInt(Math.Ceiling(TotalRecords / Me.PageSize)) + + End If + Return Me._TotalPages + End Get + Set(ByVal value As Integer) + Me._TotalPages = value + End Set + End Property + + Protected _DisplayLastPage As Boolean + Public Property DisplayLastPage() As Boolean + Get + Return Me._DisplayLastPage + End Get + Set(ByVal value As Boolean) + Me._DisplayLastPage = value + End Set + End Property + + Private _DataChanged As Boolean = False + Public Property DataChanged() As Boolean + Get + Return Me._DataChanged + End Get + Set(ByVal value As Boolean) + Me._DataChanged = value + End Set + End Property + + Private _ResetData As Boolean = False + Public Property ResetData() As Boolean + Get + Return Me._ResetData + End Get + Set(ByVal value As Boolean) + Me._ResetData = value + End Set + End Property + + Private _AddNewRecord As Integer = 0 + Public Property AddNewRecord() As Integer + Get + Return Me._AddNewRecord + End Get + Set(ByVal value As Integer) + Me._AddNewRecord = value + End Set + End Property + + + Private _CurrentSortOrder As OrderBy = Nothing + Public Property CurrentSortOrder() As OrderBy + Get + Return Me._CurrentSortOrder + End Get + Set(ByVal value As BaseClasses.Data.OrderBy) + Me._CurrentSortOrder = value + End Set + End Property + + Private _DataSource() As PersonalEducationRecord = Nothing + Public Property DataSource() As PersonalEducationRecord () + Get + Return Me._DataSource + End Get + Set(ByVal value() As PersonalEducationRecord) + Me._DataSource = value + End Set + End Property + +#Region "Helper Properties" + + Public ReadOnly Property CommandDateLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "CommandDateLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property CommandLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "CommandLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property COUNTRYLabel1() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "COUNTRYLabel1"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property CourseAbbrLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "CourseAbbrLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property CourseLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "CourseLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property CourseNoLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "CourseNoLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property EducationPeriodLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "EducationPeriodLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property EducationTypeLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "EducationTypeLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property EdYearLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "EdYearLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property EndDateLabel2() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "EndDateLabel2"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property FacultryLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "FacultryLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property InstitueLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "InstitueLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property LevelIdLabel1() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "LevelIdLabel1"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property NoAllLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "NoAllLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property PersonalEducationAddButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalEducationAddButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalEducationDeleteButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalEducationDeleteButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalEducationPagination() As Persons.UI.IPagination + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalEducationPagination"), Persons.UI.IPagination) + End Get + End Property + + Public ReadOnly Property PersonalEducationResetButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalEducationResetButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalEducationTableControlCollapsibleRegion() As System.Web.UI.WebControls.Panel + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalEducationTableControlCollapsibleRegion"), System.Web.UI.WebControls.Panel) + End Get + End Property + + Public ReadOnly Property PersonalEducationToggleAll() As System.Web.UI.WebControls.CheckBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalEducationToggleAll"), System.Web.UI.WebControls.CheckBox) + End Get + End Property + + Public ReadOnly Property ScoreLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "ScoreLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property ScoreNoLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "ScoreNoLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property StartDateLabel2() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "StartDateLabel2"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + +#End Region + +#Region "Helper Functions" + + Public Overrides Overloads Function ModifyRedirectUrl(url As String, arg As String, ByVal bEncrypt As Boolean) As String + Return Me.Page.EvaluateExpressions(url, arg, bEncrypt, Me) + End Function + + Public Overrides Overloads Function EvaluateExpressions(url As String, arg As String, ByVal bEncrypt As Boolean) As String + Dim needToProcess As Boolean = AreAnyUrlParametersForMe(url, arg) + If (needToProcess) Then + Dim recCtl As PersonalEducationTableControlRow = Me.GetSelectedRecordControl() + If recCtl Is Nothing AndAlso url.IndexOf("{") >= 0 Then + ' Localization. + Throw New Exception(Page.GetResourceValue("Err:NoRecSelected", "Persons")) + End If + Dim rec As PersonalEducationRecord = Nothing + If recCtl IsNot Nothing Then + rec = recCtl.GetRecord() + End If + Return EvaluateExpressions(url, arg, rec, bEncrypt) + End If + Return url + End Function + + Public Overridable Function GetSelectedRecordIndex() As Integer + Dim counter As Integer = 0 + Dim recControl As PersonalEducationTableControlRow + For Each recControl In Me.GetRecordControls() + If recControl.PersonalEducationRecordRowSelection.Checked Then + Return counter + End If + counter += 1 + Next + Return -1 + End Function + + Public Overridable Function GetSelectedRecordControl() As PersonalEducationTableControlRow + Dim selectedList() As PersonalEducationTableControlRow = Me.GetSelectedRecordControls() + If selectedList.Length = 0 Then + Return Nothing + End If + Return selectedList(0) + + End Function + + Public Overridable Function GetSelectedRecordControls() As PersonalEducationTableControlRow() + + Dim selectedList As ArrayList = New ArrayList(25) + Dim recControl As PersonalEducationTableControlRow + For Each recControl In Me.GetRecordControls() + If recControl.PersonalEducationRecordRowSelection IsNot Nothing AndAlso recControl.PersonalEducationRecordRowSelection.Checked Then + selectedList.Add(recControl) + End If + Next + Return DirectCast(selectedList.ToArray(GetType(PersonalEducationTableControlRow)), PersonalEducationTableControlRow()) + + End Function + + Public Overridable Sub DeleteSelectedRecords(ByVal deferDeletion As Boolean) + Dim recList() As PersonalEducationTableControlRow = Me.GetSelectedRecordControls() + If recList.Length = 0 Then + ' Localization. + Throw New Exception(Page.GetResourceValue("Err:NoRecSelected", "Persons")) + End If + + Dim recCtl As PersonalEducationTableControlRow + For Each recCtl In recList + If deferDeletion Then + If Not recCtl.IsNewRecord Then + + Me.AddToDeletedRecordIds(recCtl) + + End If + recCtl.Visible = False + + recCtl.PersonalEducationRecordRowSelection.Checked = False + + Else + + recCtl.Delete() + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + End If + Next + End Sub + + Public Function GetRecordControls() As PersonalEducationTableControlRow() + Dim recList As ArrayList = New ArrayList() + Dim rep As System.Web.UI.WebControls.Repeater = CType(Me.FindControl("PersonalEducationTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return Nothing + Dim repItem As System.Web.UI.WebControls.RepeaterItem + + For Each repItem In rep.Items + + Dim recControl As PersonalEducationTableControlRow = DirectCast(repItem.FindControl("PersonalEducationTableControlRow"), PersonalEducationTableControlRow) + recList.Add(recControl) + + Next + + Return DirectCast(recList.ToArray(GetType(PersonalEducationTableControlRow)), PersonalEducationTableControlRow()) + End Function + + Public Shadows ReadOnly Property Page() As BaseApplicationPage + Get + Return DirectCast(MyBase.Page, BaseApplicationPage) + End Get + End Property + +#End Region + + + +End Class + + +' Base class for the PersonalExtWorkTableControlRow control on the AddPersonalId page. +' Do not modify this class. Instead override any method in PersonalExtWorkTableControlRow. +Public Class BasePersonalExtWorkTableControlRow + Inherits Persons.UI.BaseApplicationRecordControl + + ' To customize, override this method in PersonalExtWorkTableControlRow. + Protected Overridable Sub Control_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Init + + Me.ClearControlsFromSession() + End Sub + + ' To customize, override this method in PersonalExtWorkTableControlRow. + Protected Overridable Sub Control_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load + + 'Call LoadFocusScripts from repeater so that onfocus attribute could be added to elements + Me.Page.LoadFocusScripts(Me) + + ' Show confirmation message on Click + Me.PersonalExtWorkRowDeleteButton.Attributes.Add("onClick", "return (confirm('" & (CType(Me.Page,BaseApplicationPage)).GetResourceValue("DeleteRecordConfirm", "Persons") & "'));") + + + ' Register the event handlers. + + AddHandler Me.PersonalExtWorkRowDeleteButton.Click, AddressOf PersonalExtWorkRowDeleteButton_Click + + AddHandler Me.Active.CheckedChanged, AddressOf Active_CheckedChanged + + AddHandler Me.BeginDate.TextChanged, AddressOf BeginDate_TextChanged + + AddHandler Me.Command1.TextChanged, AddressOf Command1_TextChanged + + AddHandler Me.CommandDate1.TextChanged, AddressOf CommandDate1_TextChanged + + AddHandler Me.Description.TextChanged, AddressOf Description_TextChanged + + AddHandler Me.EndDate2.TextChanged, AddressOf EndDate2_TextChanged + + AddHandler Me.Place.TextChanged, AddressOf Place_TextChanged + + + End Sub + + + Public Overridable Sub LoadData() + + ' Load the data from the database into the DataSource PersonalExtWork 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 = PersonalExtWorkTable.GetRecord(Me.RecordUniqueId, True) + + Return + End If + + ' Since this is a row in the table, the data for this row is loaded by the + ' LoadData method of the BasePersonalExtWorkTableControl when the data for the entire + ' table is loaded. + + Me.DataSource = New PersonalExtWorkRecord() + + + + End Sub + + ' Populate the UI controls using the DataSource. To customize, override this method in PersonalExtWorkTableControlRow. + 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 + + SetActive() + SetBeginDate() + SetCommand1() + SetCommandDate1() + SetDescription() + SetEndDate2() + + + SetPlace() + + + 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 SetActive() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.Active.ID) Then + Me.Active.Checked = Convert.ToBoolean(Me.PreviousUIData(Me.Active.ID)) + Return + End If + + + ' Set the Active CheckBox on the webpage with value from the + ' PersonalExtWork database record. + + ' Me.DataSource is the PersonalExtWork record retrieved from the database. + ' Me.Active is the ASP:CheckBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetActive() + ' and add your own code before or after the call to the MyBase function. + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.ActiveSpecified Then + + ' If the Active is non-NULL, then format the value. + ' The Format method will use the Display Format + Me.Active.Checked = Me.DataSource.Active + Else + + ' Active is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + If Not Me.DataSource.IsCreated Then + Me.Active.Checked = PersonalExtWorkTable.Active.ParseValue(PersonalExtWorkTable.Active.DefaultValue).ToBoolean() + End If + + End If + + End Sub + + Public Overridable Sub SetBeginDate() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.BeginDate.ID) Then + + Me.BeginDate.Text = Me.PreviousUIData(Me.BeginDate.ID).ToString() + + Return + End If + + + ' Set the BeginDate TextBox on the webpage with value from the + ' PersonalExtWork database record. + + ' Me.DataSource is the PersonalExtWork record retrieved from the database. + ' Me.BeginDate is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetBeginDate() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.BeginDateSpecified Then + + ' If the BeginDate is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalExtWorkTable.BeginDate, "d MMM yy") + + Me.BeginDate.Text = formattedValue + + Else + + ' BeginDate is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.BeginDate.Text = PersonalExtWorkTable.BeginDate.Format(PersonalExtWorkTable.BeginDate.DefaultValue, "d MMM yy") + + End If + + End Sub + + Public Overridable Sub SetCommand1() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.Command1.ID) Then + + Me.Command1.Text = Me.PreviousUIData(Me.Command1.ID).ToString() + + Return + End If + + + ' Set the Command TextBox on the webpage with value from the + ' PersonalExtWork database record. + + ' Me.DataSource is the PersonalExtWork record retrieved from the database. + ' Me.Command1 is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetCommand1() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.CommandSpecified Then + + ' If the Command is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalExtWorkTable.Command) + + Me.Command1.Text = formattedValue + + Else + + ' Command is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.Command1.Text = PersonalExtWorkTable.Command.Format(PersonalExtWorkTable.Command.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetCommandDate1() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.CommandDate1.ID) Then + + Me.CommandDate1.Text = Me.PreviousUIData(Me.CommandDate1.ID).ToString() + + Return + End If + + + ' Set the CommandDate TextBox on the webpage with value from the + ' PersonalExtWork database record. + + ' Me.DataSource is the PersonalExtWork record retrieved from the database. + ' Me.CommandDate1 is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetCommandDate1() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.CommandDateSpecified Then + + ' If the CommandDate is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalExtWorkTable.CommandDate, "d MMM yy") + + Me.CommandDate1.Text = formattedValue + + Else + + ' CommandDate is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.CommandDate1.Text = PersonalExtWorkTable.CommandDate.Format(PersonalExtWorkTable.CommandDate.DefaultValue, "d MMM yy") + + End If + + End Sub + + Public Overridable Sub SetDescription() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.Description.ID) Then + + Me.Description.Text = Me.PreviousUIData(Me.Description.ID).ToString() + + Return + End If + + + ' Set the Description TextBox on the webpage with value from the + ' PersonalExtWork database record. + + ' Me.DataSource is the PersonalExtWork record retrieved from the database. + ' Me.Description is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetDescription() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.DescriptionSpecified Then + + ' If the Description is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalExtWorkTable.Description) + + Me.Description.Text = formattedValue + + Else + + ' Description is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.Description.Text = PersonalExtWorkTable.Description.Format(PersonalExtWorkTable.Description.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetEndDate2() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.EndDate2.ID) Then + + Me.EndDate2.Text = Me.PreviousUIData(Me.EndDate2.ID).ToString() + + Return + End If + + + ' Set the EndDate TextBox on the webpage with value from the + ' PersonalExtWork database record. + + ' Me.DataSource is the PersonalExtWork record retrieved from the database. + ' Me.EndDate2 is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetEndDate2() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.EndDateSpecified Then + + ' If the EndDate is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalExtWorkTable.EndDate, "d MMM yy") + + Me.EndDate2.Text = formattedValue + + Else + + ' EndDate is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.EndDate2.Text = PersonalExtWorkTable.EndDate.Format(PersonalExtWorkTable.EndDate.DefaultValue, "d MMM yy") + + End If + + End Sub + + Public Overridable Sub SetPlace() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.Place.ID) Then + + Me.Place.Text = Me.PreviousUIData(Me.Place.ID).ToString() + + Return + End If + + + ' Set the Place TextBox on the webpage with value from the + ' PersonalExtWork database record. + + ' Me.DataSource is the PersonalExtWork record retrieved from the database. + ' Me.Place is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetPlace() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.PlaceSpecified Then + + ' If the Place is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalExtWorkTable.Place) + + Me.Place.Text = formattedValue + + Else + + ' Place is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.Place.Text = PersonalExtWorkTable.Place.Format(PersonalExtWorkTable.Place.DefaultValue) + + End If + + End Sub + + + Public EvaluateFormulaDelegate As BaseClasses.Data.DataSource.EvaluateFormulaDelegate = New BaseClasses.Data.DataSource.EvaluateFormulaDelegate(AddressOf Me.EvaluateFormula) + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean, ByVal e As FormulaEvaluator) As String + If e Is Nothing Then + e = New FormulaEvaluator() + End If + + e.Variables.Clear() + + + ' add variables for formula evaluation + If variables IsNot Nothing Then + Dim enumerator As System.Collections.Generic.IEnumerator(Of System.Collections.Generic.KeyValuePair(Of String, Object)) = variables.GetEnumerator() + While enumerator.MoveNext() + e.Variables.Add(enumerator.Current.Key, enumerator.Current.Value) + End While + End If + + If includeDS + + End IF + + + ' Other variables referred to in the formula are expected to be + ' properties of the DataSource. For example, referring to + ' UnitPrice as a variable will refer to DataSource.UnitPrice + If dataSourceForEvaluate Is Nothing Then + + e.DataSource = Me.DataSource + + Else + e.DataSource = dataSourceForEvaluate + End If + + ' Define the calling control. This is used to add other + ' related table and record controls as variables. + e.CallingControl = Me + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + + If Not String.IsNullOrEmpty(format) AndAlso (String.IsNullOrEmpty(formula) OrElse formula.IndexOf("Format(") < 0) Then + Return FormulaUtils.Format(resultObj, format) + Else + Return resultObj.ToString() + End If + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format,variables ,includeDS, Nothing) + End Function + + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object)) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format, variables ,True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, format, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal e as FormulaEvaluator) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, variables, True, e) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal includeDS as Boolean) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, includeDS, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, True, Nothing) + End Function + + + Public Overridable Sub RegisterPostback() + + + End Sub + + + + ' To customize, override this method in PersonalExtWorkTableControlRow. + 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 parentCtrl As PersonalIdRecordControl + + + parentCtrl = DirectCast(Me.Page.FindControlRecursively("PersonalIdRecordControl"), PersonalIdRecordControl) + + If (Not IsNothing(parentCtrl) AndAlso IsNothing(parentCtrl.DataSource)) + ' Load the record if it is not loaded yet. + parentCtrl.LoadData() + End If + If (IsNothing(parentCtrl) OrElse IsNothing(parentCtrl.DataSource)) + ' Get the error message from the application resource file. + Throw New Exception(Page.GetResourceValue("Err:NoParentRecId", "Persons")) + End If + + Me.DataSource.PersonalId = parentCtrl.DataSource.PersonalId + + ' 2. Perform any custom validation. + Me.Validate() + + + ' 3. Set the values in the record with data from UI controls. + ' This calls the Get() method for each of the user interface controls. + Me.GetUIData() + + ' 4. Save in the database. + ' We should not save the record if the data did not change. This + ' will save a database hit and avoid triggering any database triggers. + + If Me.DataSource.IsAnyValueChanged Then + ' Save record to database but do not commit yet. + ' Auto generated ids are available after saving for use by child (dependent) records. + Me.DataSource.Save() + + DirectCast(GetParentControlObject(Me, "PersonalExtWorkTableControl"), PersonalExtWorkTableControl).DataChanged = True + DirectCast(GetParentControlObject(Me, "PersonalExtWorkTableControl"), PersonalExtWorkTableControl).ResetData = True + End If + + + ' update session or cookie by formula + + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + ' For Master-Detail relationships, save data on the Detail table(s) + + End Sub + + ' To customize, override this method in PersonalExtWorkTableControlRow. + 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. + + GetActive() + GetBeginDate() + GetCommand1() + GetCommandDate1() + GetDescription() + GetEndDate2() + GetPlace() + End Sub + + + Public Overridable Sub GetActive() + + + ' Retrieve the value entered by the user on the Active ASP:CheckBox, and + ' save it into the Active field in DataSource PersonalExtWork record. + ' Custom validation should be performed in Validate, not here. + + + Me.DataSource.Active = Me.Active.Checked + + End Sub + + Public Overridable Sub GetBeginDate() + + ' Retrieve the value entered by the user on the BeginDate ASP:TextBox, and + ' save it into the BeginDate field in DataSource PersonalExtWork 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.BeginDate.Text, PersonalExtWorkTable.BeginDate) + + + End Sub + + Public Overridable Sub GetCommand1() + + ' Retrieve the value entered by the user on the Command ASP:TextBox, and + ' save it into the Command field in DataSource PersonalExtWork record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.Command1.Text, PersonalExtWorkTable.Command) + + + End Sub + + Public Overridable Sub GetCommandDate1() + + ' Retrieve the value entered by the user on the CommandDate ASP:TextBox, and + ' save it into the CommandDate field in DataSource PersonalExtWork 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.CommandDate1.Text, PersonalExtWorkTable.CommandDate) + + + End Sub + + Public Overridable Sub GetDescription() + + ' Retrieve the value entered by the user on the Description ASP:TextBox, and + ' save it into the Description field in DataSource PersonalExtWork record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.Description.Text, PersonalExtWorkTable.Description) + + + End Sub + + Public Overridable Sub GetEndDate2() + + ' Retrieve the value entered by the user on the EndDate ASP:TextBox, and + ' save it into the EndDate field in DataSource PersonalExtWork 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.EndDate2.Text, PersonalExtWorkTable.EndDate) + + + End Sub + + Public Overridable Sub GetPlace() + + ' Retrieve the value entered by the user on the Place ASP:TextBox, and + ' save it into the Place field in DataSource PersonalExtWork record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.Place.Text, PersonalExtWorkTable.Place) + + + End Sub + + + ' To customize, override this method in PersonalExtWorkTableControlRow. + + Public Overridable Function CreateWhereClause() As WhereClause + + Return Nothing + + End Function + + + + ' To customize, override this method in PersonalExtWorkTableControlRow. + 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) + PersonalExtWorkTable.DeleteRecord(pkValue) + + DirectCast(GetParentControlObject(Me, "PersonalExtWorkTableControl"), PersonalExtWorkTableControl).DataChanged = True + DirectCast(GetParentControlObject(Me, "PersonalExtWorkTableControl"), PersonalExtWorkTableControl).ResetData = True + End Sub + + Protected Overridable Sub Control_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.PreRender + ' PreRender event is raised just before page is being displayed. + Try + DbUtils.StartTransaction() + Me.RegisterPostback() + + If Not Me.Page.ErrorOnPage AndAlso (Me.Page.IsPageRefresh OrElse Me.DataChanged OrElse Me.ResetData) Then + + + ' Re-load the data and update the web page if necessary. + ' This is typically done during a postback (filter, search button, sort, pagination button). + ' In each of the other click handlers, simply set DataChanged to True to reload the data. + Me.LoadData() + Me.DataBind() + End If + + + Catch ex As Exception + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + Finally + DbUtils.EndTransaction() + End Try + End Sub + + + Protected Overrides Sub SaveControlsToSession() + MyBase.SaveControlsToSession() + + + 'Save pagination state to session. + + End Sub + + + + Protected Overrides Sub ClearControlsFromSession() + MyBase.ClearControlsFromSession() + + + + ' Clear pagination state from session. + + End Sub + + Protected Overrides Sub LoadViewState(ByVal savedState As Object) + MyBase.LoadViewState(savedState) + Dim isNewRecord As String = CType(ViewState("IsNewRecord"), String) + If Not isNewRecord Is Nothing AndAlso isNewRecord.Trim <> "" Then + Me.IsNewRecord = Boolean.Parse(isNewRecord) + End If + + Dim myCheckSum As String = CType(ViewState("CheckSum"), String) + If Not myCheckSum Is Nothing AndAlso myCheckSum.Trim <> "" Then + Me.CheckSum = myCheckSum + End If + + + ' Load view state for pagination control. + + End Sub + + Protected Overrides Function SaveViewState() As Object + ViewState("IsNewRecord") = Me.IsNewRecord.ToString() + ViewState("CheckSum") = Me.CheckSum + + + ' Load view state for pagination control. + + Return MyBase.SaveViewState() + End Function + + + ' event handler for ImageButton + Public Overridable Sub PersonalExtWorkRowDeleteButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + If(Not Me.Page.IsPageRefresh) Then + + Dim tc As PersonalExtWorkTableControl = DirectCast(GetParentControlObject(Me, "PersonalExtWorkTableControl"), PersonalExtWorkTableControl) + If Not (IsNothing(tc)) Then + If Not Me.IsNewRecord Then + tc.AddToDeletedRecordIds(DirectCast(Me, PersonalExtWorkTableControlRow)) + End If + Me.Visible = False + tc.SetFormulaControls() + End If + + End If + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + Protected Overridable Sub Active_CheckedChanged(ByVal sender As Object, ByVal args As EventArgs) + + + End Sub + + Protected Overridable Sub BeginDate_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub Command1_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub CommandDate1_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub Description_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub EndDate2_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub Place_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("BasePersonalExtWorkTableControlRow_Rec"), String) + End Get + Set(ByVal value As String) + Me.ViewState("BasePersonalExtWorkTableControlRow_Rec") = value + End Set + End Property + + Private _DataSource As PersonalExtWorkRecord + Public Property DataSource() As PersonalExtWorkRecord + Get + Return Me._DataSource + End Get + + Set(ByVal value As PersonalExtWorkRecord) + + Me._DataSource = value + End Set + End Property + + + + Private _checkSum As String + Public Overridable Property CheckSum() As String + Get + Return Me._checkSum + End Get + Set(ByVal value As String) + Me._checkSum = value + End Set + End Property + + Private _TotalPages As Integer + Public Property TotalPages() As Integer + Get + Return Me._TotalPages + End Get + Set(ByVal value As Integer) + Me._TotalPages = value + End Set + End Property + + Private _PageIndex As Integer + Public Property PageIndex() As Integer + Get + ' Return the PageIndex + Return Me._PageIndex + End Get + Set(ByVal value As Integer) + Me._PageIndex = value + End Set + End Property + + Private _DisplayLastPage As Boolean + Public Property DisplayLastPage() As Boolean + Get + Return Me._DisplayLastPage + End Get + Set(ByVal value As Boolean) + Me._DisplayLastPage = value + End Set + End Property + + + +#Region "Helper Properties" + + Public ReadOnly Property Active() As System.Web.UI.WebControls.CheckBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Active"), System.Web.UI.WebControls.CheckBox) + End Get + End Property + + Public ReadOnly Property BeginDate() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "BeginDate"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property Command1() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Command1"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property CommandDate1() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "CommandDate1"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property Description() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Description"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property EndDate2() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "EndDate2"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property PersonalExtWorkRecordRowSelection() As System.Web.UI.WebControls.CheckBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalExtWorkRecordRowSelection"), System.Web.UI.WebControls.CheckBox) + End Get + End Property + + Public ReadOnly Property PersonalExtWorkRowDeleteButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalExtWorkRowDeleteButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property Place() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Place"), System.Web.UI.WebControls.TextBox) + 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 PersonalExtWorkRecord = 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 PersonalExtWorkRecord + If Not Me.DataSource Is Nothing Then + Return Me.DataSource + End If + + If Not Me.RecordUniqueId Is Nothing Then + + Return PersonalExtWorkTable.GetRecord(Me.RecordUniqueId, True) + + End If + + ' Localization. + + Return Nothing + + End Function + + Public Shadows ReadOnly Property Page() As BaseApplicationPage + Get + Return DirectCast(MyBase.Page, BaseApplicationPage) + End Get + End Property + +#End Region + +End Class + + + +' Base class for the PersonalExtWorkTableControl control on the AddPersonalId page. +' Do not modify this class. Instead override any method in PersonalExtWorkTableControl. +Public Class BasePersonalExtWorkTableControl + Inherits Persons.UI.BaseApplicationTableControl + + + + Protected Overridable Sub Control_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Init + + + + ' Setup the filter and search events. + + + + ' Control Initializations. + ' Initialize the table's current sort order. + + If Me.InSession(Me, "Order_By") Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + End If + + + + ' Setup default pagination settings. + + Me.PageSize = CInt(Me.GetFromSession(Me, "Page_Size", "10")) + Me.PageIndex = CInt(Me.GetFromSession(Me, "Page_Index", "0")) + + + + Me.ClearControlsFromSession() + End Sub + + Protected Overridable Sub Control_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load + + SaveControlsToSession_Ajax() + + ' Show confirmation message on Click + Me.PersonalExtWorkDeleteButton.Attributes.Add("onClick", "return (confirm('" & (CType(Me.Page,BaseApplicationPage)).GetResourceValue("DeleteConfirm", "Persons") & "'));") + + ' Setup the pagination events. + + AddHandler Me.PersonalExtWorkPagination.FirstPage.Click, AddressOf PersonalExtWorkPagination_FirstPage_Click + + AddHandler Me.PersonalExtWorkPagination.LastPage.Click, AddressOf PersonalExtWorkPagination_LastPage_Click + + AddHandler Me.PersonalExtWorkPagination.NextPage.Click, AddressOf PersonalExtWorkPagination_NextPage_Click + + AddHandler Me.PersonalExtWorkPagination.PageSizeButton.Click, AddressOf PersonalExtWorkPagination_PageSizeButton_Click + + AddHandler Me.PersonalExtWorkPagination.PreviousPage.Click, AddressOf PersonalExtWorkPagination_PreviousPage_Click + + + ' Setup the sorting events. + + AddHandler Me.ActiveLabel.Click, AddressOf ActiveLabel_Click + + AddHandler Me.BeginDateLabel.Click, AddressOf BeginDateLabel_Click + + AddHandler Me.CommandDateLabel1.Click, AddressOf CommandDateLabel1_Click + + AddHandler Me.CommandLabel1.Click, AddressOf CommandLabel1_Click + + AddHandler Me.DescriptionLabel1.Click, AddressOf DescriptionLabel1_Click + + AddHandler Me.EndDateLabel3.Click, AddressOf EndDateLabel3_Click + + AddHandler Me.PlaceLabel1.Click, AddressOf PlaceLabel1_Click + + ' Setup the button events. + + AddHandler Me.PersonalExtWorkAddButton.Click, AddressOf PersonalExtWorkAddButton_Click + + AddHandler Me.PersonalExtWorkDeleteButton.Click, AddressOf PersonalExtWorkDeleteButton_Click + + AddHandler Me.PersonalExtWorkResetButton.Click, AddressOf PersonalExtWorkResetButton_Click + + + ' Setup events for others + + End Sub + + + Public Overridable Sub LoadData() + + ' Read data from database. Returns an array of records that can be assigned + ' to the DataSource table control property. + Try + Dim joinFilter As CompoundFilter = CreateCompoundJoinFilter() + + ' The WHERE clause will be empty when displaying all records in table. + Dim wc As WhereClause = CreateWhereClause() + If wc IsNot Nothing AndAlso Not wc.RunQuery Then + ' Initialize an empty array of records + Dim alist As New ArrayList(0) + Me.DataSource = DirectCast(alist.ToArray(GetType(PersonalExtWorkRecord)), PersonalExtWorkRecord()) + ' Add records to the list if needed. + Me.AddNewRecords() + Me._TotalRecords = 0 + Me._TotalPages = 0 + Return + End If + + ' Call OrderBy to determine the order - either use the order defined + ' on the Query Wizard, or specified by user (by clicking on column heading) + Dim orderBy As OrderBy = CreateOrderBy() + + ' Get the pagesize from the pagesize control. + Me.GetPageSize() + + If Me.DisplayLastPage Then + Dim totalRecords As Integer = If(Me._TotalRecords < 0, PersonalExtWorkTable.GetRecordCount(CreateCompoundJoinFilter(), CreateWhereClause()), Me._TotalRecords) + + Dim totalPages As Integer = CInt(Math.Ceiling(totalRecords / Me.PageSize)) + + Me.PageIndex = totalPages - 1 + End If + + ' Make sure PageIndex (current page) and PageSize are within bounds. + If Me.PageIndex < 0 Then + Me.PageIndex = 0 + End If + If Me.PageSize < 1 Then + Me.PageSize = 1 + End If + + ' Retrieve the records and set the table DataSource. + ' Only PageSize records are fetched starting at PageIndex (zero based). + If Me.AddNewRecord > 0 Then + ' Make sure to preserve the previously entered data on new rows. + Dim postdata As New ArrayList + For Each rc As PersonalExtWorkTableControlRow In Me.GetRecordControls() + If Not rc.IsNewRecord Then + rc.DataSource = rc.GetRecord() + rc.GetUIData() + postdata.Add(rc.DataSource) + UIData.Add(rc.PreservedUIData()) + End If + Next + Me.DataSource = DirectCast(postdata.ToArray(GetType(PersonalExtWorkRecord)), PersonalExtWorkRecord()) + Else ' Get the records from the database + Me.DataSource = PersonalExtWorkTable.GetRecords(joinFilter, wc, orderBy, Me.PageIndex, Me.PageSize) + + End If + + ' if the datasource contains no records contained in database, then load the last page. + If (DbUtils.GetCreatedRecords(Me.DataSource).Length = 0 AndAlso Not Me.DisplayLastPage) Then + Me.DisplayLastPage = True + LoadData() + Else + + ' Add any new rows desired by the user. + Me.AddNewRecords() + + ' Turn off the ToggleAll checkbox + Me.PersonalExtWorkToggleAll.Checked = False + + + ' Initialize the page and grand totals. now + + End If + + Catch ex As Exception + ' Report the error message to the end user + Dim msg As String = ex.Message + If ex.InnerException IsNot Nothing Then + msg = msg & " InnerException: " & ex.InnerException.Message + End If + Throw New Exception(msg, ex.InnerException) + End Try + End Sub + + + + + Public Overrides Sub DataBind() + ' The DataBind method binds the user interface controls to the values + ' from the database record for each row in the table. To do this, it calls the + ' DataBind for each of the rows. + ' DataBind also populates any filters above the table, and sets the pagination + ' control to the correct number of records and the current page number. + + MyBase.DataBind() + + ' Make sure that the DataSource is initialized. + If Me.DataSource Is Nothing Then + Return + End If + + 'LoadData for DataSource for chart and report if they exist + + ' Setup the pagination controls. + BindPaginationControls() + + + + ' Bind the repeater with the list of records to expand the UI. + Dim rep As System.Web.UI.WebControls.Repeater = CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalExtWorkTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return + rep.DataSource = DataSource() + rep.DataBind() + + Dim index As Integer = 0 + For Each repItem As System.Web.UI.WebControls.RepeaterItem In rep.Items + ' Loop through all rows in the table, set its DataSource and call DataBind(). + Dim recControl As PersonalExtWorkTableControlRow = DirectCast(repItem.FindControl("PersonalExtWorkTableControlRow"), PersonalExtWorkTableControlRow) + recControl.DataSource = Me.DataSource(index) + If Me.UIData.Count > index Then + recControl.PreviousUIData = Me.UIData(index) + End If + recControl.DataBind() + recControl.Visible = Not Me.InDeletedRecordIds(recControl) + + index += 1 + Next + + + + + ' Call the Set methods for each controls on the panel + + SetActiveLabel() + SetBeginDateLabel() + SetCommandDateLabel1() + SetCommandLabel1() + SetDescriptionLabel1() + SetEndDateLabel3() + + + + + SetPersonalExtWorkTableControlCollapsibleRegion() + + SetPlaceLabel1() + ' setting the state of expand or collapse alternative rows + + + ' Load data for each record and table UI control. + ' Ordering is important because child controls get + ' their parent ids from their parent UI controls. + + + ' this method calls the set method for controls with special formula like running total, sum, rank, etc + SetFormulaControls() + End Sub + + Public Overridable Sub SetFormulaControls() + ' this method calls Set methods for the control that has special formula + + + + End Sub + + + + Public Overridable Sub RegisterPostback() + + + End Sub + + Public EvaluateFormulaDelegate As BaseClasses.Data.DataSource.EvaluateFormulaDelegate = New BaseClasses.Data.DataSource.EvaluateFormulaDelegate(AddressOf Me.EvaluateFormula) + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean, ByVal e as FormulaEvaluator) As String + If e Is Nothing + e = New FormulaEvaluator() + End If + + e.Variables.Clear() + + + ' add variables for formula evaluation + If variables IsNot Nothing Then + Dim enumerator As System.Collections.Generic.IEnumerator(Of System.Collections.Generic.KeyValuePair(Of String, Object)) = variables.GetEnumerator() + While enumerator.MoveNext() + e.Variables.Add(enumerator.Current.Key, enumerator.Current.Value) + End While + End If + + If includeDS + + End If + + ' All variables referred to in the formula are expected to be + ' properties of the DataSource. For example, referring to + ' UnitPrice as a variable will refer to DataSource.UnitPrice + e.DataSource = dataSourceForEvaluate + + ' Define the calling control. This is used to add other + ' related table and record controls as variables. + e.CallingControl = Me + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + + If Not String.IsNullOrEmpty(format) AndAlso (String.IsNullOrEmpty(formula) OrElse formula.IndexOf("Format(") < 0) Then + Return FormulaUtils.Format(resultObj, format) + Else + Return resultObj.ToString() + End If + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format,variables ,includeDS, Nothing) + End Function + + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object)) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format, variables ,True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, format, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal e as FormulaEvaluator) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, variables, True, e) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal includeDS as Boolean) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, includeDS, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, True, Nothing) + End Function + + + + + Public Overridable Sub ResetControl() + + Me.CurrentSortOrder.Reset() + If (Me.InSession(Me, "Order_By")) Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + End If + + Me.PageIndex = 0 + End Sub + + Protected Overridable Sub BindPaginationControls() + ' Setup the pagination controls. + + ' Bind the pagination labels. + + If DbUtils.GetCreatedRecords(Me.DataSource).Length > 0 Then + + Me.PersonalExtWorkPagination.CurrentPage.Text = (Me.PageIndex + 1).ToString() + Else + Me.PersonalExtWorkPagination.CurrentPage.Text = "0" + End If + Me.PersonalExtWorkPagination.PageSize.Text = Me.PageSize.ToString() + Me.PersonalExtWorkPagination.TotalItems.Text = Me.TotalRecords.ToString() + Me.PersonalExtWorkPagination.TotalPages.Text = Me.TotalPages.ToString() + + ' Bind the buttons for PersonalExtWorkTableControl pagination. + + Me.PersonalExtWorkPagination.FirstPage.Enabled = Not (Me.PageIndex = 0) + If Me._TotalPages < 0 Then ' if the total pages is not determined yet, enable last and next buttons + Me.PersonalExtWorkPagination.LastPage.Enabled = True + ElseIf Me._TotalPages = 0 ' if the total pages is determined and it is 0, enable last and next buttons + Me.PersonalExtWorkPagination.LastPage.Enabled = False + Else ' if the total pages is the last page, disable last and next buttons + Me.PersonalExtWorkPagination.LastPage.Enabled = Not (Me.PageIndex = Me.TotalPages - 1) + End If + + If Me._TotalPages < 0 Then ' if the total pages is not determined yet, enable last and next buttons + Me.PersonalExtWorkPagination.NextPage.Enabled = True + ElseIf Me._TotalPages = 0 ' if the total pages is determined and it is 0, enable last and next buttons + Me.PersonalExtWorkPagination.NextPage.Enabled = False + Else ' if the total pages is the last page, disable last and next buttons + Me.PersonalExtWorkPagination.NextPage.Enabled = Not (Me.PageIndex = Me.TotalPages - 1) + End If + + Me.PersonalExtWorkPagination.PreviousPage.Enabled = Not (Me.PageIndex = 0) + + + End Sub + + Public Overridable Sub SaveData() + ' Save the data from the entire table. Calls each row's Save Data + ' to save their data. This function is called by the Click handler of the + ' Save button. The button handler should Start/Commit/End a transaction. + + Dim recCtl As PersonalExtWorkTableControlRow + For Each recCtl In Me.GetRecordControls() + + If Me.InDeletedRecordIds(recCtl) Then + ' Delete any pending deletes. + recCtl.Delete() + Else + If recCtl.Visible Then + recCtl.SaveData() + End If + End If + + Next + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + ' Set IsNewRecord to False for all records - since everything has been saved and is no longer "new" + For Each recCtl In Me.GetRecordControls() + recCtl.IsNewRecord = False + Next + + + ' Set DeletedRecordsIds to Nothing since we have deleted all pending deletes. + Me.DeletedRecordIds = Nothing + + End Sub + + Public Overridable Function CreateCompoundJoinFilter() As CompoundFilter + Dim jFilter As CompoundFilter = New CompoundFilter() + + Return jFilter + + End Function + + + Public Overridable Function CreateOrderBy() As OrderBy + ' The CurrentSortOrder is initialized to the sort order on the + ' Query Wizard. It may be modified by the Click handler for any of + ' the column heading to sort or reverse sort by that column. + ' You can add your own sort order, or modify it on the Query Wizard. + Return Me.CurrentSortOrder + End Function + + Public Overridable Function CreateWhereClause() As WhereClause + 'This CreateWhereClause is used for loading the data. + PersonalExtWorkTable.Instance.InnerFilter = Nothing + Dim wc As WhereClause = New WhereClause() + + ' Compose the WHERE clause consiting of: + ' 1. Static clause defined at design time. + ' 2. User selected search criteria. + ' 3. User selected filter criteria. + + + Dim selectedRecordKeyValue as KeyValue = New KeyValue() + + Dim personalIdRecordControlObj As Persons.UI.Controls.AddPersonalId.PersonalIdRecordControl = DirectCast(MiscUtils.FindControlRecursively(Me.Page, "PersonalIdRecordControl"), Persons.UI.Controls.AddPersonalId.PersonalIdRecordControl) + + If (Not IsNothing(personalIdRecordControlObj) AndAlso Not IsNothing(personalIdRecordControlObj.GetRecord()) AndAlso personalIdRecordControlObj.GetRecord().IsCreated AndAlso Not IsNothing(personalIdRecordControlObj.GetRecord().PersonalId)) + wc.iAND(PersonalExtWorkTable.PersonalId, BaseFilter.ComparisonOperator.EqualsTo, personalIdRecordControlObj.GetRecord().PersonalId.ToString()) + selectedRecordKeyValue.AddElement(PersonalExtWorkTable.PersonalId.InternalName, personalIdRecordControlObj.GetRecord().PersonalId.ToString()) + Else + wc.RunQuery = False + Return wc + End If + + HttpContext.Current.Session("PersonalExtWorkTableControlWhereClause") = selectedRecordKeyValue.ToXmlString() + + Return wc + End Function + + + Public Overridable Function CreateWhereClause(ByVal searchText as String, ByVal fromSearchControl as String, ByVal AutoTypeAheadSearch as String, ByVal AutoTypeAheadWordSeparators as String) As WhereClause + ' This CreateWhereClause is used for loading list of suggestions for Auto Type-Ahead feature. + PersonalExtWorkTable.Instance.InnerFilter = Nothing + Dim wc As WhereClause = New WhereClause() + + ' Compose the WHERE clause consiting of: + ' 1. Static clause defined at design time. + ' 2. User selected search criteria. + ' 3. User selected filter criteria. + + Dim appRelativeVirtualPath As String = CType(HttpContext.Current.Session("AppRelativeVirtualPath"), String) + + Dim selectedRecordInPersonalIdRecordControl as String = DirectCast(HttpContext.Current.Session("PersonalExtWorkTableControlWhereClause"), String) + + If Not selectedRecordInPersonalIdRecordControl Is Nothing AndAlso KeyValue.IsXmlKey(selectedRecordInPersonalIdRecordControl) Then + Dim selectedRecordKeyValue as KeyValue = KeyValue.XmlToKey(selectedRecordInPersonalIdRecordControl) + + If Not IsNothing(selectedRecordKeyValue) AndAlso selectedRecordKeyValue.ContainsColumn(PersonalExtWorkTable.PersonalId) Then + wc.iAND(PersonalExtWorkTable.PersonalId, BaseFilter.ComparisonOperator.EqualsTo, selectedRecordKeyValue.GetColumnValue(PersonalExtWorkTable.PersonalId).ToString()) + End If + + End If + + ' Adds clauses if values are selected in Filter controls which are configured in the page. + + + Return wc + End Function + + + Public Overridable Function FormatSuggestions(ByVal prefixText As String, ByVal resultItem As String, _ + ByVal columnLength As Integer, ByVal AutoTypeAheadDisplayFoundText As String, _ + ByVal autoTypeAheadSearch As String, ByVal AutoTypeAheadWordSeparators As String, _ + ByVal resultList As ArrayList) As Boolean + + 'Formats the resultItem and adds it to the list of suggestions. + Dim index As Integer = resultItem.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture).IndexOf(prefixText.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture)) + Dim itemToAdd As String = "" + Dim isFound As Boolean = False + Dim isAdded As Boolean = False + ' Get the index where prfixt is at the beginning of resultItem. If not found then, index of word which begins with prefixText. + If InvariantLCase(autoTypeAheadSearch).equals("wordsstartingwithsearchstring") And Not index = 0 Then + ' Expression to find word which contains AutoTypeAheadWordSeparators followed by prefixText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex( AutoTypeAheadWordSeparators + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + If regex1.IsMatch(resultItem) Then + index = regex1.Match(resultItem).Index + isFound = True + End If + ' If the prefixText is found immediatly after white space then starting of the word is found so don not search any further + If not resultItem(index).ToString() = " " Then + ' Expression to find beginning of the word which contains AutoTypeAheadWordSeparators followed by prefixText + Dim regex As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\\S*" + AutoTypeAheadWordSeparators + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + If regex.IsMatch(resultItem) Then + index = regex.Match(resultItem).Index + isFound = True + End If + End If + End If + + ' If autoTypeAheadSearch value is wordsstartingwithsearchstring then, extract the substring only if the prefixText is found at the + ' beginning of the resultItem (index = 0) or a word in resultItem is found starts with prefixText. + If index = 0 Or isFound Or InvariantLCase(autoTypeAheadSearch).Equals("anywhereinstring") then + If InvariantLCase(AutoTypeAheadDisplayFoundText).equals("atbeginningofmatchedstring") Then + ' Expression to find beginning of the word which contains prefixText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\\S*" + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + ' Find the beginning of the word which contains prefexText + If (StringUtils.InvariantLCase(autoTypeAheadSearch).Equals("anywhereinstring") AndAlso regex1.IsMatch(resultItem)) Then + index = regex1.Match(resultItem).Index + isFound = True + End If + ' Display string from the index till end of the string if sub string from index till end is less than columnLength value. + If Len(resultItem) - index <= columnLength Then + If index = 0 Then + itemToAdd = resultItem + Else + itemToAdd = "..." & resultItem.Substring(index, Len(resultItem) - index) + End If + Else + If index = 0 Then + itemToAdd = resultItem.Substring(index, (columnLength - 3)) & "..." + Else + 'Truncate the string to show only columnLength - 6 characters as begining and trailing "..." has to be appended. + itemToAdd = "..." & resultItem.Substring(index , columnLength - 6) & "..." + End If + End If + ElseIf InvariantLCase(AutoTypeAheadDisplayFoundText).equals("inmiddleofmatchedstring") Then + Dim subStringBeginIndex As Integer = CType(columnLength/2, Integer) + If Len(resultItem) <= columnLength Then + itemToAdd = resultItem + Else + ' Sanity check at end of the string + If index + Len(prefixText) = columnLength Then + itemToAdd = "..." & resultItem.Substring(index-columnLength,index) + ElseIf Len(resultItem) - index < subStringBeginIndex Then + ' Display string from the end till columnLength value if, index is closer to the end of the string. + itemToAdd = "..." & resultItem.Substring(Len(resultItem)-columnLength,Len(resultItem)) + ElseIf index <= subStringBeginIndex Then + ' Sanity chet at beginning of the string + itemToAdd = resultItem.Substring(0, columnLength) & "..." + Else + ' Display string containing text before the prefixText occures and text after the prefixText + itemToAdd = "..." & resultItem.Substring(index - subStringBeginIndex, columnLength) & "..." + End If + End If + ElseIf InvariantLCase(AutoTypeAheadDisplayFoundText).equals("atendofmatchedstring") Then + ' Expression to find ending of the word which contains prefexText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\s", System.Text.RegularExpressions.RegexOptions.IgnoreCase) + ' Find the ending of the word which contains prefexText + If regex1.IsMatch(resultItem, index + 1) Then + index = regex1.Match(resultItem, index + 1).Index + Else + ' If the word which contains prefexText is the last word in string, regex1.IsMatch returns false. + index = resultItem.Length + End If + If index > Len(resultItem) Then + index = Len(resultItem) + End If + ' If text from beginning of the string till index is less than columnLength value then, display string from the beginning till index. + If index <= columnLength Then + if index = Len(resultItem) Then 'Make decision to append "..." + itemToAdd = resultItem.Substring(0,index) + Else + itemToAdd = resultItem.Substring(0,index) & "..." + End If + Else + If index = Len(resultItem) Then + itemToAdd = "..." & resultItem.Substring(index - (columnLength - 3), (columnLength - 3)) + Else + 'Truncate the string to show only columnLength - 6 characters as begining and trailing "..." has to be appended. + itemToAdd = "..." & resultItem.Substring(index - (columnLength - 6), columnLength - 6) & "..." + End If + End If + End If + + ' Remove newline character from itemToAdd + Dim prefixTextIndex As Integer = itemToAdd.IndexOf(prefixText, StringComparison.CurrentCultureIgnoreCase) + ' If itemToAdd contains any newline after the search text then show text only till newline + Dim regex2 As System.Text.RegularExpressions.Regex = New System.Text.RegularExpressions.Regex("(" & vbCrLf & "|" & vbLf & ")", System.Text.RegularExpressions.RegexOptions.IgnoreCase) + Dim newLineIndexAfterPrefix As Integer = -1 + If regex2.IsMatch(itemToAdd, prefixTextIndex) Then + newLineIndexAfterPrefix = regex2.Match(itemToAdd, prefixTextIndex).Index + End If + If (newLineIndexAfterPrefix > -1) Then + If itemToAdd.EndsWith("...") Then + itemToAdd = (itemToAdd.Substring(0, newLineIndexAfterPrefix) + "...") + Else + itemToAdd = itemToAdd.Substring(0, newLineIndexAfterPrefix) + End If + End If + ' If itemToAdd contains any newline before search text then show text which comes after newline + Dim regex3 As System.Text.RegularExpressions.Regex = New System.Text.RegularExpressions.Regex("(" & vbCrLf & "|" & vbLf & ")", (System.Text.RegularExpressions.RegexOptions.IgnoreCase Or System.Text.RegularExpressions.RegexOptions.RightToLeft)) + Dim newLineIndexBeforePrefix As Integer = -1 + If regex3.IsMatch(itemToAdd, prefixTextIndex) Then + newLineIndexBeforePrefix = regex3.Match(itemToAdd, prefixTextIndex).Index + End If + If (newLineIndexBeforePrefix > -1) Then + If itemToAdd.StartsWith("...") Then + itemToAdd = ("..." + itemToAdd.Substring((newLineIndexBeforePrefix + regex3.Match(itemToAdd, prefixTextIndex).Length))) + Else + itemToAdd = itemToAdd.Substring((newLineIndexBeforePrefix + regex3.Match(itemToAdd, prefixTextIndex).Length)) + End If + End If + + If Not itemToAdd is nothing AndAlso Not resultList.Contains(itemToAdd) Then + + resultList.Add(itemToAdd) + + isAdded = true + End If + End If + Return isAdded + End Function + + + Protected Overridable Sub GetPageSize() + + If Me.PersonalExtWorkPagination.PageSize.Text.Trim <> "" Then + Try + 'Me.PageSize = Integer.Parse(Me.PersonalExtWorkPagination.PageSize.Text) + Catch ex As Exception + End Try + End If + End Sub + + Protected Overridable Sub AddNewRecords() + + Dim newRecordList As ArrayList = New ArrayList() + + Dim newUIDataList As System.Collections.Generic.List(Of Hashtable) = New System.Collections.Generic.List(Of Hashtable)() + + ' Loop though all the record controls and if the record control + ' does not have a unique record id set, then create a record + ' and add to the list. + If Not Me.ResetData Then + Dim rep As System.Web.UI.WebControls.Repeater = CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalExtWorkTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return + + Dim repItem As System.Web.UI.WebControls.RepeaterItem + For Each repItem In rep.Items + ' Loop through all rows in the table, set its DataSource and call DataBind(). + + Dim recControl As PersonalExtWorkTableControlRow = DirectCast(repItem.FindControl("PersonalExtWorkTableControlRow"), PersonalExtWorkTableControlRow) + + If recControl.Visible AndAlso recControl.IsNewRecord() Then + + Dim rec As PersonalExtWorkRecord = New PersonalExtWorkRecord() + + rec.Active = recControl.Active.Checked + + If recControl.BeginDate.Text <> "" Then + rec.Parse(recControl.BeginDate.Text, PersonalExtWorkTable.BeginDate) + End If + If recControl.Command1.Text <> "" Then + rec.Parse(recControl.Command1.Text, PersonalExtWorkTable.Command) + End If + If recControl.CommandDate1.Text <> "" Then + rec.Parse(recControl.CommandDate1.Text, PersonalExtWorkTable.CommandDate) + End If + If recControl.Description.Text <> "" Then + rec.Parse(recControl.Description.Text, PersonalExtWorkTable.Description) + End If + If recControl.EndDate2.Text <> "" Then + rec.Parse(recControl.EndDate2.Text, PersonalExtWorkTable.EndDate) + End If + If recControl.Place.Text <> "" Then + rec.Parse(recControl.Place.Text, PersonalExtWorkTable.Place) + End If + newUIDataList.Add(recControl.PreservedUIData()) + newRecordList.Add(rec) + End If + Next + End If + + + ' Add any new record to the list. + Dim index As Integer = 0 + For index = 1 To Me.AddNewRecord + + newRecordList.Insert(0, New PersonalExtWorkRecord()) + newUIDataList.Insert(0, New Hashtable()) + + Next + Me.AddNewRecord = 0 + + ' Finally, add any new records to the DataSource. + If newRecordList.Count > 0 Then + + Dim finalList As ArrayList = New ArrayList(Me.DataSource) + finalList.InsertRange(0, newRecordList) + + Me.DataSource = DirectCast(finalList.ToArray(GetType(PersonalExtWorkRecord)), PersonalExtWorkRecord()) + + End If + + ' Add the existing UI data to this hash table + If newUIDataList.Count > 0 Then + Me.UIData.InsertRange(0, newUIDataList) + End If + + End Sub + + + Public Sub AddToDeletedRecordIds(ByVal rec As PersonalExtWorkTableControlRow) + If rec.IsNewRecord() Then + Return + End If + + If Not Me.DeletedRecordIds Is Nothing AndAlso Me.DeletedRecordIds.Trim <> "" Then + Me.DeletedRecordIds &= "," + End If + + Me.DeletedRecordIds &= "[" & rec.RecordUniqueId & "]" + End Sub + + Protected Overridable Function InDeletedRecordIds(ByVal rec As PersonalExtWorkTableControlRow) As Boolean + If Me.DeletedRecordIds Is Nothing OrElse Me.DeletedRecordIds.Trim = "" Then + Return False + End If + + Return Me.DeletedRecordIds.IndexOf("[" & rec.RecordUniqueId & "]") >= 0 + End Function + + Private _DeletedRecordIds As String + Public Property DeletedRecordIds() As String + Get + Return Me._DeletedRecordIds + End Get + Set(ByVal value As String) + Me._DeletedRecordIds = value + End Set + End Property + + + ' Create Set, WhereClause, and Populate Methods + + Public Overridable Sub SetActiveLabel() + + End Sub + + Public Overridable Sub SetBeginDateLabel() + + End Sub + + Public Overridable Sub SetCommandDateLabel1() + + End Sub + + Public Overridable Sub SetCommandLabel1() + + End Sub + + Public Overridable Sub SetDescriptionLabel1() + + End Sub + + Public Overridable Sub SetEndDateLabel3() + + End Sub + + Public Overridable Sub SetPersonalExtWorkTableControlCollapsibleRegion() + + End Sub + + Public Overridable Sub SetPlaceLabel1() + + 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. + Dim added As Boolean = Me.AddNewRecord > 0 + Me.LoadData() + Me.DataBind() + + If added Then + Me.SetFocusToAddedRow() + End If + + End If + + + + Catch ex As Exception + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + Finally + DbUtils.EndTransaction + End Try + End Sub + + 'this function sets focus to the first editable element in the new added row in the editable table + Protected Overridable Sub SetFocusToAddedRow() + Dim rep As System.Web.UI.WebControls.Repeater = CType(Me.FindControl("PersonalExtWorkTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing OrElse rep.Items.Count = 0 Then Return + Dim repItem As System.Web.UI.WebControls.RepeaterItem + For Each repItem In rep.Items + 'Load scripts to table rows + Me.Page.LoadFocusScripts(repItem) + Dim recControl As PersonalExtWorkTableControlRow = DirectCast(repItem.FindControl("PersonalExtWorkTableControlRow"), PersonalExtWorkTableControlRow) + If recControl.IsNewRecord Then + For Each field As Control In recControl.Controls + If field.Visible AndAlso Me.Page.IsControlEditable(field, False) Then + 'set focus on the first editable field in the new row + field.Focus() + Dim updPan As UpdatePanel = DirectCast(Me.Page.FindControlRecursively("UpdatePanel1"), UpdatePanel) + If Not updPan Is Nothing Then updPan.Update() + Return + End If + Next + Return + End If + Next + End Sub + + + Protected Overrides Sub SaveControlsToSession() + MyBase.SaveControlsToSession() + + ' Save filter controls to values to session. + + + 'Save pagination state to session. + + + + ' Save table control properties to the session. + If Not Me.CurrentSortOrder Is Nothing Then + Me.SaveToSession(Me, "Order_By", Me.CurrentSortOrder.ToXmlString()) + End If + + Me.SaveToSession(Me, "Page_Index", Me.PageIndex.ToString()) + Me.SaveToSession(Me, "Page_Size", Me.PageSize.ToString()) + + Me.SaveToSession(Me, "DeletedRecordIds", Me.DeletedRecordIds) + + End Sub + + Protected Sub SaveControlsToSession_Ajax() + ' Save filter controls to values to session. + + HttpContext.Current.Session("AppRelativeVirtualPath") = Me.Page.AppRelativeVirtualPath + + End Sub + + Protected Overrides Sub ClearControlsFromSession() + MyBase.ClearControlsFromSession() + + ' Clear filter controls values from the session. + + + ' Clear pagination state from session. + + + + ' Clear table properties from the session. + Me.RemoveFromSession(Me, "Order_By") + Me.RemoveFromSession(Me, "Page_Index") + Me.RemoveFromSession(Me, "Page_Size") + + Me.RemoveFromSession(Me, "DeletedRecordIds") + + End Sub + + Protected Overrides Sub LoadViewState(ByVal savedState As Object) + MyBase.LoadViewState(savedState) + + Dim orderByStr As String = CType(ViewState("PersonalExtWorkTableControl_OrderBy"), String) + + If orderByStr IsNot Nothing AndAlso orderByStr.Trim <> "" Then + Me.CurrentSortOrder = BaseClasses.Data.OrderBy.FromXmlString(orderByStr) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + End If + + Dim pageIndex As String = CType(ViewState("Page_Index"), String) + If pageIndex IsNot Nothing Then + Me.PageIndex = CInt(pageIndex) + End If + + Dim pageSize As String = CType(ViewState("Page_Size"), String) + If Not pageSize Is Nothing Then + Me.PageSize = CInt(pageSize) + End If + + + + ' Load view state for pagination control. + + Me.DeletedRecordIds = CType(Me.ViewState("DeletedRecordIds"), String) + + End Sub + + Protected Overrides Function SaveViewState() As Object + + If Me.CurrentSortOrder IsNot Nothing Then + Me.ViewState("PersonalExtWorkTableControl_OrderBy") = Me.CurrentSortOrder.ToXmlString() + End If + + Me.ViewState("Page_Index") = Me.PageIndex + Me.ViewState("Page_Size") = Me.PageSize + + Me.ViewState("DeletedRecordIds") = Me.DeletedRecordIds + + + ' Load view state for pagination control. + + + Return MyBase.SaveViewState() + End Function + + ' Generate the event handling functions for pagination events. + + ' event handler for ImageButton + Public Overridable Sub PersonalExtWorkPagination_FirstPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.PageIndex = 0 + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalExtWorkPagination_LastPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.DisplayLastPage = True + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalExtWorkPagination_NextPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.PageIndex += 1 + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for LinkButton + Public Overridable Sub PersonalExtWorkPagination_PageSizeButton_Click(ByVal sender As Object, ByVal args As EventArgs) + + Try + + Me.DataChanged = True + + Me.PageSize = Integer.Parse(Me.PersonalExtWorkPagination.PageSize.Text) + + Me.PageIndex = Integer.Parse(Me.PersonalExtWorkPagination.CurrentPage.Text) - 1 + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalExtWorkPagination_PreviousPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + If Me.PageIndex > 0 Then + Me.PageIndex -= 1 + Me.DataChanged = True + End If + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + + ' Generate the event handling functions for sorting events. + + Public Overridable Sub ActiveLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by Active when clicked. + + ' Get previous sorting state for Active. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalExtWorkTable.Active) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for Active. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalExtWorkTable.Active, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by Active, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub BeginDateLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by BeginDate when clicked. + + ' Get previous sorting state for BeginDate. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalExtWorkTable.BeginDate) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for BeginDate. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalExtWorkTable.BeginDate, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by BeginDate, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub CommandDateLabel1_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by CommandDate when clicked. + + ' Get previous sorting state for CommandDate. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalExtWorkTable.CommandDate) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for CommandDate. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalExtWorkTable.CommandDate, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by CommandDate, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub CommandLabel1_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by Command when clicked. + + ' Get previous sorting state for Command. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalExtWorkTable.Command) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for Command. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalExtWorkTable.Command, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by Command, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub DescriptionLabel1_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by Description when clicked. + + ' Get previous sorting state for Description. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalExtWorkTable.Description) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for Description. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalExtWorkTable.Description, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by Description, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub EndDateLabel3_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by EndDate when clicked. + + ' Get previous sorting state for EndDate. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalExtWorkTable.EndDate) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for EndDate. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalExtWorkTable.EndDate, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by EndDate, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub PlaceLabel1_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by Place when clicked. + + ' Get previous sorting state for Place. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalExtWorkTable.Place) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for Place. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalExtWorkTable.Place, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by Place, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + + ' Generate the event handling functions for button events. + + ' event handler for ImageButton + Public Overridable Sub PersonalExtWorkAddButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + Me.AddNewRecord = 1 + Me.DataChanged = True + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalExtWorkDeleteButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + If(Not Me.Page.IsPageRefresh) Then + + Me.DeleteSelectedRecords(True) + Me.SetFormulaControls() + + + End If + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalExtWorkResetButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.CurrentSortOrder.Reset() + If Me.InSession(Me, "Order_By") Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + + End If + + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + + + ' Generate the event handling functions for filter and search events. + + + ' Generate the event handling functions for others + + + Private _UIData As New System.Collections.Generic.List(Of Hashtable) + Public Property UIData() As System.Collections.Generic.List(Of Hashtable) + Get + Return Me._UIData + End Get + Set(ByVal value As System.Collections.Generic.List(Of Hashtable)) + Me._UIData = value + End Set + End Property + + ' pagination properties + Protected _PageSize As Integer + Public Property PageSize() As Integer + Get + Return Me._PageSize + End Get + Set(ByVal value As Integer) + Me._PageSize = value + End Set + End Property + + Protected _PageIndex As Integer + Public Property PageIndex() As Integer + Get + ' Return the PageIndex + Return Me._PageIndex + End Get + Set(ByVal value As Integer) + Me._PageIndex = value + End Set + End Property + + Protected _TotalRecords As Integer = -1 + Public Property TotalRecords() As Integer + Get + If _TotalRecords < 0 + _TotalRecords = PersonalExtWorkTable.GetRecordCount(CreateCompoundJoinFilter(), CreateWhereClause()) + End If + Return Me._TotalRecords + End Get + Set(ByVal value As Integer) + If Me.PageSize > 0 Then + + Me.TotalPages = CInt(Math.Ceiling(value / Me.PageSize)) + + End If + Me._TotalRecords = value + End Set + End Property + + + + Protected _TotalPages As Integer = -1 + Public Property TotalPages() As Integer + Get + If _TotalPages < 0 Then + + Me.TotalPages = CInt(Math.Ceiling(TotalRecords / Me.PageSize)) + + End If + Return Me._TotalPages + End Get + Set(ByVal value As Integer) + Me._TotalPages = value + End Set + End Property + + Protected _DisplayLastPage As Boolean + Public Property DisplayLastPage() As Boolean + Get + Return Me._DisplayLastPage + End Get + Set(ByVal value As Boolean) + Me._DisplayLastPage = value + End Set + End Property + + Private _DataChanged As Boolean = False + Public Property DataChanged() As Boolean + Get + Return Me._DataChanged + End Get + Set(ByVal value As Boolean) + Me._DataChanged = value + End Set + End Property + + Private _ResetData As Boolean = False + Public Property ResetData() As Boolean + Get + Return Me._ResetData + End Get + Set(ByVal value As Boolean) + Me._ResetData = value + End Set + End Property + + Private _AddNewRecord As Integer = 0 + Public Property AddNewRecord() As Integer + Get + Return Me._AddNewRecord + End Get + Set(ByVal value As Integer) + Me._AddNewRecord = value + End Set + End Property + + + Private _CurrentSortOrder As OrderBy = Nothing + Public Property CurrentSortOrder() As OrderBy + Get + Return Me._CurrentSortOrder + End Get + Set(ByVal value As BaseClasses.Data.OrderBy) + Me._CurrentSortOrder = value + End Set + End Property + + Private _DataSource() As PersonalExtWorkRecord = Nothing + Public Property DataSource() As PersonalExtWorkRecord () + Get + Return Me._DataSource + End Get + Set(ByVal value() As PersonalExtWorkRecord) + Me._DataSource = value + End Set + End Property + +#Region "Helper Properties" + + Public ReadOnly Property ActiveLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "ActiveLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property BeginDateLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "BeginDateLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property CommandDateLabel1() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "CommandDateLabel1"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property CommandLabel1() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "CommandLabel1"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property DescriptionLabel1() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "DescriptionLabel1"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property EndDateLabel3() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "EndDateLabel3"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property PersonalExtWorkAddButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalExtWorkAddButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalExtWorkDeleteButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalExtWorkDeleteButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalExtWorkPagination() As Persons.UI.IPagination + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalExtWorkPagination"), Persons.UI.IPagination) + End Get + End Property + + Public ReadOnly Property PersonalExtWorkResetButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalExtWorkResetButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalExtWorkTableControlCollapsibleRegion() As System.Web.UI.WebControls.Panel + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalExtWorkTableControlCollapsibleRegion"), System.Web.UI.WebControls.Panel) + End Get + End Property + + Public ReadOnly Property PersonalExtWorkToggleAll() As System.Web.UI.WebControls.CheckBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalExtWorkToggleAll"), System.Web.UI.WebControls.CheckBox) + End Get + End Property + + Public ReadOnly Property PlaceLabel1() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PlaceLabel1"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + +#End Region + +#Region "Helper Functions" + + Public Overrides Overloads Function ModifyRedirectUrl(url As String, arg As String, ByVal bEncrypt As Boolean) As String + Return Me.Page.EvaluateExpressions(url, arg, bEncrypt, Me) + End Function + + Public Overrides Overloads Function EvaluateExpressions(url As String, arg As String, ByVal bEncrypt As Boolean) As String + Dim needToProcess As Boolean = AreAnyUrlParametersForMe(url, arg) + If (needToProcess) Then + Dim recCtl As PersonalExtWorkTableControlRow = Me.GetSelectedRecordControl() + If recCtl Is Nothing AndAlso url.IndexOf("{") >= 0 Then + ' Localization. + Throw New Exception(Page.GetResourceValue("Err:NoRecSelected", "Persons")) + End If + Dim rec As PersonalExtWorkRecord = Nothing + If recCtl IsNot Nothing Then + rec = recCtl.GetRecord() + End If + Return EvaluateExpressions(url, arg, rec, bEncrypt) + End If + Return url + End Function + + Public Overridable Function GetSelectedRecordIndex() As Integer + Dim counter As Integer = 0 + Dim recControl As PersonalExtWorkTableControlRow + For Each recControl In Me.GetRecordControls() + If recControl.PersonalExtWorkRecordRowSelection.Checked Then + Return counter + End If + counter += 1 + Next + Return -1 + End Function + + Public Overridable Function GetSelectedRecordControl() As PersonalExtWorkTableControlRow + Dim selectedList() As PersonalExtWorkTableControlRow = Me.GetSelectedRecordControls() + If selectedList.Length = 0 Then + Return Nothing + End If + Return selectedList(0) + + End Function + + Public Overridable Function GetSelectedRecordControls() As PersonalExtWorkTableControlRow() + + Dim selectedList As ArrayList = New ArrayList(25) + Dim recControl As PersonalExtWorkTableControlRow + For Each recControl In Me.GetRecordControls() + If recControl.PersonalExtWorkRecordRowSelection IsNot Nothing AndAlso recControl.PersonalExtWorkRecordRowSelection.Checked Then + selectedList.Add(recControl) + End If + Next + Return DirectCast(selectedList.ToArray(GetType(PersonalExtWorkTableControlRow)), PersonalExtWorkTableControlRow()) + + End Function + + Public Overridable Sub DeleteSelectedRecords(ByVal deferDeletion As Boolean) + Dim recList() As PersonalExtWorkTableControlRow = Me.GetSelectedRecordControls() + If recList.Length = 0 Then + ' Localization. + Throw New Exception(Page.GetResourceValue("Err:NoRecSelected", "Persons")) + End If + + Dim recCtl As PersonalExtWorkTableControlRow + For Each recCtl In recList + If deferDeletion Then + If Not recCtl.IsNewRecord Then + + Me.AddToDeletedRecordIds(recCtl) + + End If + recCtl.Visible = False + + recCtl.PersonalExtWorkRecordRowSelection.Checked = False + + Else + + recCtl.Delete() + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + End If + Next + End Sub + + Public Function GetRecordControls() As PersonalExtWorkTableControlRow() + Dim recList As ArrayList = New ArrayList() + Dim rep As System.Web.UI.WebControls.Repeater = CType(Me.FindControl("PersonalExtWorkTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return Nothing + Dim repItem As System.Web.UI.WebControls.RepeaterItem + + For Each repItem In rep.Items + + Dim recControl As PersonalExtWorkTableControlRow = DirectCast(repItem.FindControl("PersonalExtWorkTableControlRow"), PersonalExtWorkTableControlRow) + recList.Add(recControl) + + Next + + Return DirectCast(recList.ToArray(GetType(PersonalExtWorkTableControlRow)), PersonalExtWorkTableControlRow()) + End Function + + Public Shadows ReadOnly Property Page() As BaseApplicationPage + Get + Return DirectCast(MyBase.Page, BaseApplicationPage) + End Get + End Property + +#End Region + + + +End Class + + +' Base class for the PersonalInsigniaTableControlRow control on the AddPersonalId page. +' Do not modify this class. Instead override any method in PersonalInsigniaTableControlRow. +Public Class BasePersonalInsigniaTableControlRow + Inherits Persons.UI.BaseApplicationRecordControl + + ' To customize, override this method in PersonalInsigniaTableControlRow. + Protected Overridable Sub Control_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Init + + Me.ClearControlsFromSession() + End Sub + + ' To customize, override this method in PersonalInsigniaTableControlRow. + Protected Overridable Sub Control_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load + + 'Call LoadFocusScripts from repeater so that onfocus attribute could be added to elements + Me.Page.LoadFocusScripts(Me) + + ' Show confirmation message on Click + Me.PersonalInsigniaRowDeleteButton.Attributes.Add("onClick", "return (confirm('" & (CType(Me.Page,BaseApplicationPage)).GetResourceValue("DeleteRecordConfirm", "Persons") & "'));") + + + ' Register the event handlers. + + AddHandler Me.PersonalInsigniaRowDeleteButton.Click, AddressOf PersonalInsigniaRowDeleteButton_Click + + AddHandler Me.InsigniaId.SelectedIndexChanged, AddressOf InsigniaId_SelectedIndexChanged + + AddHandler Me.GazetteDate.TextChanged, AddressOf GazetteDate_TextChanged + + AddHandler Me.GazetteNO.TextChanged, AddressOf GazetteNO_TextChanged + + AddHandler Me.GazettePage.TextChanged, AddressOf GazettePage_TextChanged + + AddHandler Me.GazetteSection.TextChanged, AddressOf GazetteSection_TextChanged + + AddHandler Me.InsigniaDate.TextChanged, AddressOf InsigniaDate_TextChanged + + AddHandler Me.InsigniaReturn.TextChanged, AddressOf InsigniaReturn_TextChanged + + + End Sub + + + Public Overridable Sub LoadData() + + ' Load the data from the database into the DataSource PersonalInsignia 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 = PersonalInsigniaTable.GetRecord(Me.RecordUniqueId, True) + + Return + End If + + ' Since this is a row in the table, the data for this row is loaded by the + ' LoadData method of the BasePersonalInsigniaTableControl when the data for the entire + ' table is loaded. + + Me.DataSource = New PersonalInsigniaRecord() + + + + End Sub + + ' Populate the UI controls using the DataSource. To customize, override this method in PersonalInsigniaTableControlRow. + 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 + + SetGazetteDate() + SetGazetteNO() + SetGazettePage() + SetGazetteSection() + SetInsigniaDate() + SetInsigniaId() + SetInsigniaReturn() + + + + + 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 SetGazetteDate() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.GazetteDate.ID) Then + + Me.GazetteDate.Text = Me.PreviousUIData(Me.GazetteDate.ID).ToString() + + Return + End If + + + ' Set the GazetteDate TextBox on the webpage with value from the + ' PersonalInsignia database record. + + ' Me.DataSource is the PersonalInsignia record retrieved from the database. + ' Me.GazetteDate is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetGazetteDate() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.GazetteDateSpecified Then + + ' If the GazetteDate is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalInsigniaTable.GazetteDate, "d MMM yy") + + Me.GazetteDate.Text = formattedValue + + Else + + ' GazetteDate is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.GazetteDate.Text = PersonalInsigniaTable.GazetteDate.Format(PersonalInsigniaTable.GazetteDate.DefaultValue, "d MMM yy") + + End If + + End Sub + + Public Overridable Sub SetGazetteNO() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.GazetteNO.ID) Then + + Me.GazetteNO.Text = Me.PreviousUIData(Me.GazetteNO.ID).ToString() + + Return + End If + + + ' Set the GazetteNO TextBox on the webpage with value from the + ' PersonalInsignia database record. + + ' Me.DataSource is the PersonalInsignia record retrieved from the database. + ' Me.GazetteNO is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetGazetteNO() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.GazetteNOSpecified Then + + ' If the GazetteNO is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalInsigniaTable.GazetteNO) + + Me.GazetteNO.Text = formattedValue + + Else + + ' GazetteNO is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.GazetteNO.Text = PersonalInsigniaTable.GazetteNO.Format(PersonalInsigniaTable.GazetteNO.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetGazettePage() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.GazettePage.ID) Then + + Me.GazettePage.Text = Me.PreviousUIData(Me.GazettePage.ID).ToString() + + Return + End If + + + ' Set the GazettePage TextBox on the webpage with value from the + ' PersonalInsignia database record. + + ' Me.DataSource is the PersonalInsignia record retrieved from the database. + ' Me.GazettePage is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetGazettePage() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.GazettePageSpecified Then + + ' If the GazettePage is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalInsigniaTable.GazettePage) + + Me.GazettePage.Text = formattedValue + + Else + + ' GazettePage is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.GazettePage.Text = PersonalInsigniaTable.GazettePage.Format(PersonalInsigniaTable.GazettePage.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetGazetteSection() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.GazetteSection.ID) Then + + Me.GazetteSection.Text = Me.PreviousUIData(Me.GazetteSection.ID).ToString() + + Return + End If + + + ' Set the GazetteSection TextBox on the webpage with value from the + ' PersonalInsignia database record. + + ' Me.DataSource is the PersonalInsignia record retrieved from the database. + ' Me.GazetteSection is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetGazetteSection() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.GazetteSectionSpecified Then + + ' If the GazetteSection is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalInsigniaTable.GazetteSection) + + Me.GazetteSection.Text = formattedValue + + Else + + ' GazetteSection is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.GazetteSection.Text = PersonalInsigniaTable.GazetteSection.Format(PersonalInsigniaTable.GazetteSection.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetInsigniaDate() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.InsigniaDate.ID) Then + + Me.InsigniaDate.Text = Me.PreviousUIData(Me.InsigniaDate.ID).ToString() + + Return + End If + + + ' Set the InsigniaDate TextBox on the webpage with value from the + ' PersonalInsignia database record. + + ' Me.DataSource is the PersonalInsignia record retrieved from the database. + ' Me.InsigniaDate is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetInsigniaDate() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.InsigniaDateSpecified Then + + ' If the InsigniaDate is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalInsigniaTable.InsigniaDate, "d MMM yy") + + Me.InsigniaDate.Text = formattedValue + + Else + + ' InsigniaDate is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.InsigniaDate.Text = PersonalInsigniaTable.InsigniaDate.Format(PersonalInsigniaTable.InsigniaDate.DefaultValue, "d MMM yy") + + End If + + End Sub + + Public Overridable Sub SetInsigniaId() + + ' If selection was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.InsigniaId.ID) Then + If Me.PreviousUIData(Me.InsigniaId.ID) Is Nothing + Me.PopulateInsigniaIdDropDownList(Nothing, 100) + Else + Me.PopulateInsigniaIdDropDownList(Me.PreviousUIData(Me.InsigniaId.ID).ToString(), 100) + End If + Return + End If + + + ' Set the InsigniaId DropDownList on the webpage with value from the + ' PersonalInsignia database record. + + ' Me.DataSource is the PersonalInsignia record retrieved from the database. + ' Me.InsigniaId is the ASP:DropDownList on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetInsigniaId() + ' and add your own code before or after the call to the MyBase function. + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.InsigniaIdSpecified Then + + ' If the InsigniaId is non-NULL, then format the value. + ' The Format method will return the Display Foreign Key As (DFKA) value + Me.PopulateInsigniaIdDropDownList(Me.DataSource.InsigniaId.ToString(), 100) + + Else + + ' InsigniaId 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.PopulateInsigniaIdDropDownList(Nothing, 100) + Else + Me.PopulateInsigniaIdDropDownList(PersonalInsigniaTable.InsigniaId.DefaultValue, 100) + End If + + End If + + End Sub + + Public Overridable Sub SetInsigniaReturn() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.InsigniaReturn.ID) Then + + Me.InsigniaReturn.Text = Me.PreviousUIData(Me.InsigniaReturn.ID).ToString() + + Return + End If + + + ' Set the InsigniaReturn TextBox on the webpage with value from the + ' PersonalInsignia database record. + + ' Me.DataSource is the PersonalInsignia record retrieved from the database. + ' Me.InsigniaReturn is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetInsigniaReturn() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.InsigniaReturnSpecified Then + + ' If the InsigniaReturn is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalInsigniaTable.InsigniaReturn) + + Me.InsigniaReturn.Text = formattedValue + + Else + + ' InsigniaReturn is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.InsigniaReturn.Text = PersonalInsigniaTable.InsigniaReturn.Format(PersonalInsigniaTable.InsigniaReturn.DefaultValue) + + End If + + End Sub + + + Public EvaluateFormulaDelegate As BaseClasses.Data.DataSource.EvaluateFormulaDelegate = New BaseClasses.Data.DataSource.EvaluateFormulaDelegate(AddressOf Me.EvaluateFormula) + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean, ByVal e As FormulaEvaluator) As String + If e Is Nothing Then + e = New FormulaEvaluator() + End If + + e.Variables.Clear() + + + ' add variables for formula evaluation + If variables IsNot Nothing Then + Dim enumerator As System.Collections.Generic.IEnumerator(Of System.Collections.Generic.KeyValuePair(Of String, Object)) = variables.GetEnumerator() + While enumerator.MoveNext() + e.Variables.Add(enumerator.Current.Key, enumerator.Current.Value) + End While + End If + + If includeDS + + End IF + + + ' Other variables referred to in the formula are expected to be + ' properties of the DataSource. For example, referring to + ' UnitPrice as a variable will refer to DataSource.UnitPrice + If dataSourceForEvaluate Is Nothing Then + + e.DataSource = Me.DataSource + + Else + e.DataSource = dataSourceForEvaluate + End If + + ' Define the calling control. This is used to add other + ' related table and record controls as variables. + e.CallingControl = Me + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + + If Not String.IsNullOrEmpty(format) AndAlso (String.IsNullOrEmpty(formula) OrElse formula.IndexOf("Format(") < 0) Then + Return FormulaUtils.Format(resultObj, format) + Else + Return resultObj.ToString() + End If + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format,variables ,includeDS, Nothing) + End Function + + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object)) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format, variables ,True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, format, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal e as FormulaEvaluator) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, variables, True, e) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal includeDS as Boolean) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, includeDS, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, True, Nothing) + End Function + + + Public Overridable Sub RegisterPostback() + + + End Sub + + + + ' To customize, override this method in PersonalInsigniaTableControlRow. + 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 parentCtrl As PersonalIdRecordControl + + + parentCtrl = DirectCast(Me.Page.FindControlRecursively("PersonalIdRecordControl"), PersonalIdRecordControl) + + If (Not IsNothing(parentCtrl) AndAlso IsNothing(parentCtrl.DataSource)) + ' Load the record if it is not loaded yet. + parentCtrl.LoadData() + End If + If (IsNothing(parentCtrl) OrElse IsNothing(parentCtrl.DataSource)) + ' Get the error message from the application resource file. + Throw New Exception(Page.GetResourceValue("Err:NoParentRecId", "Persons")) + End If + + Me.DataSource.PersonalId = parentCtrl.DataSource.PersonalId + + ' 2. Perform any custom validation. + Me.Validate() + + + ' 3. Set the values in the record with data from UI controls. + ' This calls the Get() method for each of the user interface controls. + Me.GetUIData() + + ' 4. Save in the database. + ' We should not save the record if the data did not change. This + ' will save a database hit and avoid triggering any database triggers. + + If Me.DataSource.IsAnyValueChanged Then + ' Save record to database but do not commit yet. + ' Auto generated ids are available after saving for use by child (dependent) records. + Me.DataSource.Save() + + DirectCast(GetParentControlObject(Me, "PersonalInsigniaTableControl"), PersonalInsigniaTableControl).DataChanged = True + DirectCast(GetParentControlObject(Me, "PersonalInsigniaTableControl"), PersonalInsigniaTableControl).ResetData = True + End If + + + ' update session or cookie by formula + + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + ' For Master-Detail relationships, save data on the Detail table(s) + + End Sub + + ' To customize, override this method in PersonalInsigniaTableControlRow. + 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. + + GetGazetteDate() + GetGazetteNO() + GetGazettePage() + GetGazetteSection() + GetInsigniaDate() + GetInsigniaId() + GetInsigniaReturn() + End Sub + + + Public Overridable Sub GetGazetteDate() + + ' Retrieve the value entered by the user on the GazetteDate ASP:TextBox, and + ' save it into the GazetteDate field in DataSource PersonalInsignia 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.GazetteDate.Text, PersonalInsigniaTable.GazetteDate) + + + End Sub + + Public Overridable Sub GetGazetteNO() + + ' Retrieve the value entered by the user on the GazetteNO ASP:TextBox, and + ' save it into the GazetteNO field in DataSource PersonalInsignia record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.GazetteNO.Text, PersonalInsigniaTable.GazetteNO) + + + End Sub + + Public Overridable Sub GetGazettePage() + + ' Retrieve the value entered by the user on the GazettePage ASP:TextBox, and + ' save it into the GazettePage field in DataSource PersonalInsignia record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.GazettePage.Text, PersonalInsigniaTable.GazettePage) + + + End Sub + + Public Overridable Sub GetGazetteSection() + + ' Retrieve the value entered by the user on the GazetteSection ASP:TextBox, and + ' save it into the GazetteSection field in DataSource PersonalInsignia record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.GazetteSection.Text, PersonalInsigniaTable.GazetteSection) + + + End Sub + + Public Overridable Sub GetInsigniaDate() + + ' Retrieve the value entered by the user on the InsigniaDate ASP:TextBox, and + ' save it into the InsigniaDate field in DataSource PersonalInsignia 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.InsigniaDate.Text, PersonalInsigniaTable.InsigniaDate) + + + End Sub + + Public Overridable Sub GetInsigniaId() + + ' Retrieve the value entered by the user on the InsigniaId ASP:DropDownList, and + ' save it into the InsigniaId field in DataSource PersonalInsignia record. + + ' Custom validation should be performed in Validate, not here. + + Me.DataSource.Parse(GetValueSelectedPageRequest(Me.InsigniaId), PersonalInsigniaTable.InsigniaId) + + End Sub + + Public Overridable Sub GetInsigniaReturn() + + ' Retrieve the value entered by the user on the InsigniaReturn ASP:TextBox, and + ' save it into the InsigniaReturn field in DataSource PersonalInsignia record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.InsigniaReturn.Text, PersonalInsigniaTable.InsigniaReturn) + + + End Sub + + + ' To customize, override this method in PersonalInsigniaTableControlRow. + + Public Overridable Function CreateWhereClause() As WhereClause + + Return Nothing + + End Function + + + + ' To customize, override this method in PersonalInsigniaTableControlRow. + 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) + PersonalInsigniaTable.DeleteRecord(pkValue) + + DirectCast(GetParentControlObject(Me, "PersonalInsigniaTableControl"), PersonalInsigniaTableControl).DataChanged = True + DirectCast(GetParentControlObject(Me, "PersonalInsigniaTableControl"), PersonalInsigniaTableControl).ResetData = True + End Sub + + Protected Overridable Sub Control_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.PreRender + ' PreRender event is raised just before page is being displayed. + Try + DbUtils.StartTransaction() + Me.RegisterPostback() + + If Not Me.Page.ErrorOnPage AndAlso (Me.Page.IsPageRefresh OrElse Me.DataChanged OrElse Me.ResetData) Then + + + ' Re-load the data and update the web page if necessary. + ' This is typically done during a postback (filter, search button, sort, pagination button). + ' In each of the other click handlers, simply set DataChanged to True to reload the data. + Me.LoadData() + Me.DataBind() + End If + + + Catch ex As Exception + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + Finally + DbUtils.EndTransaction() + End Try + End Sub + + + Protected Overrides Sub SaveControlsToSession() + MyBase.SaveControlsToSession() + + + 'Save pagination state to session. + + End Sub + + + + Protected Overrides Sub ClearControlsFromSession() + MyBase.ClearControlsFromSession() + + + + ' Clear pagination state from session. + + End Sub + + Protected Overrides Sub LoadViewState(ByVal savedState As Object) + MyBase.LoadViewState(savedState) + Dim isNewRecord As String = CType(ViewState("IsNewRecord"), String) + If Not isNewRecord Is Nothing AndAlso isNewRecord.Trim <> "" Then + Me.IsNewRecord = Boolean.Parse(isNewRecord) + End If + + Dim myCheckSum As String = CType(ViewState("CheckSum"), String) + If Not myCheckSum Is Nothing AndAlso myCheckSum.Trim <> "" Then + Me.CheckSum = myCheckSum + End If + + + ' Load view state for pagination control. + + End Sub + + Protected Overrides Function SaveViewState() As Object + ViewState("IsNewRecord") = Me.IsNewRecord.ToString() + ViewState("CheckSum") = Me.CheckSum + + + ' Load view state for pagination control. + + Return MyBase.SaveViewState() + End Function + + + + Public Overridable Function CreateWhereClause_InsigniaIdDropDownList() 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 Insignia table. + ' Examples: + ' wc.iAND(InsigniaTable.InsigniaName, BaseFilter.ComparisonOperator.EqualsTo, "XYZ") + ' wc.iAND(InsigniaTable.Active, BaseFilter.ComparisonOperator.EqualsTo, "1") + + Dim wc As WhereClause = New WhereClause() + Return wc + + End Function + + + ' Fill the InsigniaId list. + Protected Overridable Sub PopulateInsigniaIdDropDownList( _ + ByVal selectedValue As String, _ + ByVal maxItems As Integer) + + Me.InsigniaId.Items.Clear() + + + ' 1. Setup the static list items + + ' Add the Please Select item. + Me.InsigniaId.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_InsigniaIdDropDownList function. + ' It is better to customize the where clause there. + + Dim wc As WhereClause = CreateWhereClause_InsigniaIdDropDownList() + ' Create the ORDER BY clause to sort based on the displayed value. + + + Dim orderBy As OrderBy = New OrderBy(false, false) + orderBy.Add(InsigniaTable.InsigniaName, 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 InsigniaRecord = 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 = InsigniaTable.GetRecords(wc, orderBy, pageNum, maxItems) + For each itemValue As InsigniaRecord In itemValues + ' Create the item and add to the list. + Dim cvalue As String = Nothing + Dim fvalue As String = Nothing + If itemValue.InsigniaIdSpecified Then + cvalue = itemValue.InsigniaId.ToString() + + If counter < maxItems AndAlso Me.InsigniaId.Items.FindByValue(cvalue) Is Nothing Then + + Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalInsigniaTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalInsigniaTable.InsigniaId) + If _isExpandableNonCompositeForeignKey AndAlso PersonalInsigniaTable.InsigniaId.IsApplyDisplayAs Then + fvalue = PersonalInsigniaTable.GetDFKA(itemValue, PersonalInsigniaTable.InsigniaId) + End If + If (Not _isExpandableNonCompositeForeignKey) Or (String.IsNullOrEmpty(fvalue)) Then + fvalue = itemValue.Format(InsigniaTable.InsigniaName) + 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.InsigniaId.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.InsigniaId.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.InsigniaId, selectedValue) AndAlso _ + Not SetSelectedDisplayText(Me.InsigniaId, selectedValue)Then + + ' construct a whereclause to query a record with Insignia.InsigniaId = selectedValue + Dim filter2 As CompoundFilter = New CompoundFilter(CompoundFilter.CompoundingOperators.And_Operator, Nothing) + Dim whereClause2 As WhereClause = New WhereClause() + filter2.AddFilter(New BaseClasses.Data.ColumnValueFilter(InsigniaTable.InsigniaId, selectedValue, BaseClasses.Data.BaseFilter.ComparisonOperator.EqualsTo, False)) + whereClause2.AddFilter(filter2, CompoundFilter.CompoundingOperators.And_Operator) + + Try + ' Execute the query + Dim rc() As InsigniaRecord = InsigniaTable.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 InsigniaRecord = DirectCast(rc(0), InsigniaRecord) + ' Create the item and add to the list. + Dim cvalue As String = Nothing + Dim fvalue As String = Nothing + If itemValue.InsigniaIdSpecified Then + cvalue = itemValue.InsigniaId.ToString() + Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalInsigniaTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalInsigniaTable.InsigniaId) + If _isExpandableNonCompositeForeignKey AndAlso PersonalInsigniaTable.InsigniaId.IsApplyDisplayAs Then + fvalue = PersonalInsigniaTable.GetDFKA(itemValue, PersonalInsigniaTable.InsigniaId) + End If + If (Not _isExpandableNonCompositeForeignKey) Or (String.IsNullOrEmpty(fvalue)) Then + fvalue = itemValue.Format(InsigniaTable.InsigniaName) + End If + + If fvalue Is Nothing OrElse fvalue.Trim() = "" Then fvalue = cvalue + Dim newItem As New ListItem(fvalue, cvalue) + Me.InsigniaId.Items.Add(newItem) + SetSelectedValue(Me.InsigniaId, selectedValue) + End If + End If + Catch + End Try + + End If + + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalInsigniaRowDeleteButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + If(Not Me.Page.IsPageRefresh) Then + + Dim tc As PersonalInsigniaTableControl = DirectCast(GetParentControlObject(Me, "PersonalInsigniaTableControl"), PersonalInsigniaTableControl) + If Not (IsNothing(tc)) Then + If Not Me.IsNewRecord Then + tc.AddToDeletedRecordIds(DirectCast(Me, PersonalInsigniaTableControlRow)) + End If + Me.Visible = False + tc.SetFormulaControls() + End If + + End If + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + Protected Overridable Sub InsigniaId_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()(InsigniaId.ClientID & "_SelectedValue"), String) + Dim displayText As String = CType(Me.Page.Session()(InsigniaId.ClientID & "_SelectedDisplayText"), String) + If displayText <> "" AndAlso val <> "" Then + Me.InsigniaId.Items.Add(New ListItem(displayText, val)) + Me.InsigniaId.SelectedIndex = Me.InsigniaId.Items.Count - 1 + Me.Page.Session.Remove(InsigniaId.ClientID & "_SelectedValue") + Me.Page.Session.Remove(InsigniaId.ClientID & "_SelectedDisplayText") + End If + + + + + End Sub + + Protected Overridable Sub GazetteDate_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub GazetteNO_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub GazettePage_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub GazetteSection_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub InsigniaDate_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub InsigniaReturn_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("BasePersonalInsigniaTableControlRow_Rec"), String) + End Get + Set(ByVal value As String) + Me.ViewState("BasePersonalInsigniaTableControlRow_Rec") = value + End Set + End Property + + Private _DataSource As PersonalInsigniaRecord + Public Property DataSource() As PersonalInsigniaRecord + Get + Return Me._DataSource + End Get + + Set(ByVal value As PersonalInsigniaRecord) + + Me._DataSource = value + End Set + End Property + + + + Private _checkSum As String + Public Overridable Property CheckSum() As String + Get + Return Me._checkSum + End Get + Set(ByVal value As String) + Me._checkSum = value + End Set + End Property + + Private _TotalPages As Integer + Public Property TotalPages() As Integer + Get + Return Me._TotalPages + End Get + Set(ByVal value As Integer) + Me._TotalPages = value + End Set + End Property + + Private _PageIndex As Integer + Public Property PageIndex() As Integer + Get + ' Return the PageIndex + Return Me._PageIndex + End Get + Set(ByVal value As Integer) + Me._PageIndex = value + End Set + End Property + + Private _DisplayLastPage As Boolean + Public Property DisplayLastPage() As Boolean + Get + Return Me._DisplayLastPage + End Get + Set(ByVal value As Boolean) + Me._DisplayLastPage = value + End Set + End Property + + + +#Region "Helper Properties" + + Public ReadOnly Property GazetteDate() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "GazetteDate"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property GazetteNO() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "GazetteNO"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property GazettePage() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "GazettePage"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property GazetteSection() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "GazetteSection"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property InsigniaDate() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "InsigniaDate"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property InsigniaId() As System.Web.UI.WebControls.DropDownList + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "InsigniaId"), System.Web.UI.WebControls.DropDownList) + End Get + End Property + + Public ReadOnly Property InsigniaReturn() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "InsigniaReturn"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property PersonalInsigniaRecordRowSelection() As System.Web.UI.WebControls.CheckBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalInsigniaRecordRowSelection"), System.Web.UI.WebControls.CheckBox) + End Get + End Property + + Public ReadOnly Property PersonalInsigniaRowDeleteButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalInsigniaRowDeleteButton"), System.Web.UI.WebControls.ImageButton) + 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 PersonalInsigniaRecord = 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 PersonalInsigniaRecord + If Not Me.DataSource Is Nothing Then + Return Me.DataSource + End If + + If Not Me.RecordUniqueId Is Nothing Then + + Return PersonalInsigniaTable.GetRecord(Me.RecordUniqueId, True) + + End If + + ' Localization. + + Return Nothing + + End Function + + Public Shadows ReadOnly Property Page() As BaseApplicationPage + Get + Return DirectCast(MyBase.Page, BaseApplicationPage) + End Get + End Property + +#End Region + +End Class + + + +' Base class for the PersonalInsigniaTableControl control on the AddPersonalId page. +' Do not modify this class. Instead override any method in PersonalInsigniaTableControl. +Public Class BasePersonalInsigniaTableControl + Inherits Persons.UI.BaseApplicationTableControl + + + + Protected Overridable Sub Control_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Init + + + + ' Setup the filter and search events. + + + + ' Control Initializations. + ' Initialize the table's current sort order. + + If Me.InSession(Me, "Order_By") Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + End If + + + + ' Setup default pagination settings. + + Me.PageSize = CInt(Me.GetFromSession(Me, "Page_Size", "10")) + Me.PageIndex = CInt(Me.GetFromSession(Me, "Page_Index", "0")) + + + + Me.ClearControlsFromSession() + End Sub + + Protected Overridable Sub Control_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load + + SaveControlsToSession_Ajax() + + ' Show confirmation message on Click + Me.PersonalInsigniaDeleteButton.Attributes.Add("onClick", "return (confirm('" & (CType(Me.Page,BaseApplicationPage)).GetResourceValue("DeleteConfirm", "Persons") & "'));") + + ' Setup the pagination events. + + AddHandler Me.PersonalInsigniaPagination.FirstPage.Click, AddressOf PersonalInsigniaPagination_FirstPage_Click + + AddHandler Me.PersonalInsigniaPagination.LastPage.Click, AddressOf PersonalInsigniaPagination_LastPage_Click + + AddHandler Me.PersonalInsigniaPagination.NextPage.Click, AddressOf PersonalInsigniaPagination_NextPage_Click + + AddHandler Me.PersonalInsigniaPagination.PageSizeButton.Click, AddressOf PersonalInsigniaPagination_PageSizeButton_Click + + AddHandler Me.PersonalInsigniaPagination.PreviousPage.Click, AddressOf PersonalInsigniaPagination_PreviousPage_Click + + + ' Setup the sorting events. + + AddHandler Me.GazetteDateLabel.Click, AddressOf GazetteDateLabel_Click + + AddHandler Me.GazetteNOLabel.Click, AddressOf GazetteNOLabel_Click + + AddHandler Me.GazettePageLabel.Click, AddressOf GazettePageLabel_Click + + AddHandler Me.GazetteSectionLabel.Click, AddressOf GazetteSectionLabel_Click + + AddHandler Me.InsigniaDateLabel1.Click, AddressOf InsigniaDateLabel1_Click + + AddHandler Me.InsigniaIdLabel1.Click, AddressOf InsigniaIdLabel1_Click + + AddHandler Me.InsigniaReturnLabel.Click, AddressOf InsigniaReturnLabel_Click + + ' Setup the button events. + + AddHandler Me.PersonalInsigniaAddButton.Click, AddressOf PersonalInsigniaAddButton_Click + + AddHandler Me.PersonalInsigniaDeleteButton.Click, AddressOf PersonalInsigniaDeleteButton_Click + + AddHandler Me.PersonalInsigniaResetButton.Click, AddressOf PersonalInsigniaResetButton_Click + + + ' Setup events for others + + End Sub + + + Public Overridable Sub LoadData() + + ' Read data from database. Returns an array of records that can be assigned + ' to the DataSource table control property. + Try + Dim joinFilter As CompoundFilter = CreateCompoundJoinFilter() + + ' The WHERE clause will be empty when displaying all records in table. + Dim wc As WhereClause = CreateWhereClause() + If wc IsNot Nothing AndAlso Not wc.RunQuery Then + ' Initialize an empty array of records + Dim alist As New ArrayList(0) + Me.DataSource = DirectCast(alist.ToArray(GetType(PersonalInsigniaRecord)), PersonalInsigniaRecord()) + ' Add records to the list if needed. + Me.AddNewRecords() + Me._TotalRecords = 0 + Me._TotalPages = 0 + Return + End If + + ' Call OrderBy to determine the order - either use the order defined + ' on the Query Wizard, or specified by user (by clicking on column heading) + Dim orderBy As OrderBy = CreateOrderBy() + + ' Get the pagesize from the pagesize control. + Me.GetPageSize() + + If Me.DisplayLastPage Then + Dim totalRecords As Integer = If(Me._TotalRecords < 0, PersonalInsigniaTable.GetRecordCount(CreateCompoundJoinFilter(), CreateWhereClause()), Me._TotalRecords) + + Dim totalPages As Integer = CInt(Math.Ceiling(totalRecords / Me.PageSize)) + + Me.PageIndex = totalPages - 1 + End If + + ' Make sure PageIndex (current page) and PageSize are within bounds. + If Me.PageIndex < 0 Then + Me.PageIndex = 0 + End If + If Me.PageSize < 1 Then + Me.PageSize = 1 + End If + + ' Retrieve the records and set the table DataSource. + ' Only PageSize records are fetched starting at PageIndex (zero based). + If Me.AddNewRecord > 0 Then + ' Make sure to preserve the previously entered data on new rows. + Dim postdata As New ArrayList + For Each rc As PersonalInsigniaTableControlRow In Me.GetRecordControls() + If Not rc.IsNewRecord Then + rc.DataSource = rc.GetRecord() + rc.GetUIData() + postdata.Add(rc.DataSource) + UIData.Add(rc.PreservedUIData()) + End If + Next + Me.DataSource = DirectCast(postdata.ToArray(GetType(PersonalInsigniaRecord)), PersonalInsigniaRecord()) + Else ' Get the records from the database + Me.DataSource = PersonalInsigniaTable.GetRecords(joinFilter, wc, orderBy, Me.PageIndex, Me.PageSize) + + End If + + ' if the datasource contains no records contained in database, then load the last page. + If (DbUtils.GetCreatedRecords(Me.DataSource).Length = 0 AndAlso Not Me.DisplayLastPage) Then + Me.DisplayLastPage = True + LoadData() + Else + + ' Add any new rows desired by the user. + Me.AddNewRecords() + + ' Turn off the ToggleAll checkbox + Me.PersonalInsigniaToggleAll.Checked = False + + + ' Initialize the page and grand totals. now + + End If + + Catch ex As Exception + ' Report the error message to the end user + Dim msg As String = ex.Message + If ex.InnerException IsNot Nothing Then + msg = msg & " InnerException: " & ex.InnerException.Message + End If + Throw New Exception(msg, ex.InnerException) + End Try + End Sub + + + + + Public Overrides Sub DataBind() + ' The DataBind method binds the user interface controls to the values + ' from the database record for each row in the table. To do this, it calls the + ' DataBind for each of the rows. + ' DataBind also populates any filters above the table, and sets the pagination + ' control to the correct number of records and the current page number. + + MyBase.DataBind() + + ' Make sure that the DataSource is initialized. + If Me.DataSource Is Nothing Then + Return + End If + + 'LoadData for DataSource for chart and report if they exist + + ' Improve performance by prefetching display as records. + Me.PreFetchForeignKeyValues() + + ' Setup the pagination controls. + BindPaginationControls() + + + + ' Bind the repeater with the list of records to expand the UI. + Dim rep As System.Web.UI.WebControls.Repeater = CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalInsigniaTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return + rep.DataSource = DataSource() + rep.DataBind() + + Dim index As Integer = 0 + For Each repItem As System.Web.UI.WebControls.RepeaterItem In rep.Items + ' Loop through all rows in the table, set its DataSource and call DataBind(). + Dim recControl As PersonalInsigniaTableControlRow = DirectCast(repItem.FindControl("PersonalInsigniaTableControlRow"), PersonalInsigniaTableControlRow) + recControl.DataSource = Me.DataSource(index) + If Me.UIData.Count > index Then + recControl.PreviousUIData = Me.UIData(index) + End If + recControl.DataBind() + recControl.Visible = Not Me.InDeletedRecordIds(recControl) + + index += 1 + Next + + + + + ' Call the Set methods for each controls on the panel + + SetGazetteDateLabel() + SetGazetteNOLabel() + SetGazettePageLabel() + SetGazetteSectionLabel() + SetInsigniaDateLabel1() + SetInsigniaIdLabel1() + SetInsigniaReturnLabel() + + + + + SetPersonalInsigniaTableControlCollapsibleRegion() + + ' setting the state of expand or collapse alternative rows + + + ' Load data for each record and table UI control. + ' Ordering is important because child controls get + ' their parent ids from their parent UI controls. + + + ' this method calls the set method for controls with special formula like running total, sum, rank, etc + SetFormulaControls() + End Sub + + Public Overridable Sub SetFormulaControls() + ' this method calls Set methods for the control that has special formula + + + + End Sub + + + Public Sub PreFetchForeignKeyValues() + If (IsNothing(Me.DataSource)) + Return + End If + + Me.Page.PregetDfkaRecords(PersonalInsigniaTable.InsigniaId, Me.DataSource) + + End Sub + + + Public Overridable Sub RegisterPostback() + + + End Sub + + Public EvaluateFormulaDelegate As BaseClasses.Data.DataSource.EvaluateFormulaDelegate = New BaseClasses.Data.DataSource.EvaluateFormulaDelegate(AddressOf Me.EvaluateFormula) + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean, ByVal e as FormulaEvaluator) As String + If e Is Nothing + e = New FormulaEvaluator() + End If + + e.Variables.Clear() + + + ' add variables for formula evaluation + If variables IsNot Nothing Then + Dim enumerator As System.Collections.Generic.IEnumerator(Of System.Collections.Generic.KeyValuePair(Of String, Object)) = variables.GetEnumerator() + While enumerator.MoveNext() + e.Variables.Add(enumerator.Current.Key, enumerator.Current.Value) + End While + End If + + If includeDS + + End If + + ' All variables referred to in the formula are expected to be + ' properties of the DataSource. For example, referring to + ' UnitPrice as a variable will refer to DataSource.UnitPrice + e.DataSource = dataSourceForEvaluate + + ' Define the calling control. This is used to add other + ' related table and record controls as variables. + e.CallingControl = Me + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + + If Not String.IsNullOrEmpty(format) AndAlso (String.IsNullOrEmpty(formula) OrElse formula.IndexOf("Format(") < 0) Then + Return FormulaUtils.Format(resultObj, format) + Else + Return resultObj.ToString() + End If + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format,variables ,includeDS, Nothing) + End Function + + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object)) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format, variables ,True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, format, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal e as FormulaEvaluator) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, variables, True, e) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal includeDS as Boolean) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, includeDS, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, True, Nothing) + End Function + + + + + Public Overridable Sub ResetControl() + + Me.CurrentSortOrder.Reset() + If (Me.InSession(Me, "Order_By")) Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + End If + + Me.PageIndex = 0 + End Sub + + Protected Overridable Sub BindPaginationControls() + ' Setup the pagination controls. + + ' Bind the pagination labels. + + If DbUtils.GetCreatedRecords(Me.DataSource).Length > 0 Then + + Me.PersonalInsigniaPagination.CurrentPage.Text = (Me.PageIndex + 1).ToString() + Else + Me.PersonalInsigniaPagination.CurrentPage.Text = "0" + End If + Me.PersonalInsigniaPagination.PageSize.Text = Me.PageSize.ToString() + Me.PersonalInsigniaPagination.TotalItems.Text = Me.TotalRecords.ToString() + Me.PersonalInsigniaPagination.TotalPages.Text = Me.TotalPages.ToString() + + ' Bind the buttons for PersonalInsigniaTableControl pagination. + + Me.PersonalInsigniaPagination.FirstPage.Enabled = Not (Me.PageIndex = 0) + If Me._TotalPages < 0 Then ' if the total pages is not determined yet, enable last and next buttons + Me.PersonalInsigniaPagination.LastPage.Enabled = True + ElseIf Me._TotalPages = 0 ' if the total pages is determined and it is 0, enable last and next buttons + Me.PersonalInsigniaPagination.LastPage.Enabled = False + Else ' if the total pages is the last page, disable last and next buttons + Me.PersonalInsigniaPagination.LastPage.Enabled = Not (Me.PageIndex = Me.TotalPages - 1) + End If + + If Me._TotalPages < 0 Then ' if the total pages is not determined yet, enable last and next buttons + Me.PersonalInsigniaPagination.NextPage.Enabled = True + ElseIf Me._TotalPages = 0 ' if the total pages is determined and it is 0, enable last and next buttons + Me.PersonalInsigniaPagination.NextPage.Enabled = False + Else ' if the total pages is the last page, disable last and next buttons + Me.PersonalInsigniaPagination.NextPage.Enabled = Not (Me.PageIndex = Me.TotalPages - 1) + End If + + Me.PersonalInsigniaPagination.PreviousPage.Enabled = Not (Me.PageIndex = 0) + + + End Sub + + Public Overridable Sub SaveData() + ' Save the data from the entire table. Calls each row's Save Data + ' to save their data. This function is called by the Click handler of the + ' Save button. The button handler should Start/Commit/End a transaction. + + Dim recCtl As PersonalInsigniaTableControlRow + For Each recCtl In Me.GetRecordControls() + + If Me.InDeletedRecordIds(recCtl) Then + ' Delete any pending deletes. + recCtl.Delete() + Else + If recCtl.Visible Then + recCtl.SaveData() + End If + End If + + Next + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + ' Set IsNewRecord to False for all records - since everything has been saved and is no longer "new" + For Each recCtl In Me.GetRecordControls() + recCtl.IsNewRecord = False + Next + + + ' Set DeletedRecordsIds to Nothing since we have deleted all pending deletes. + Me.DeletedRecordIds = Nothing + + End Sub + + Public Overridable Function CreateCompoundJoinFilter() As CompoundFilter + Dim jFilter As CompoundFilter = New CompoundFilter() + + Return jFilter + + End Function + + + Public Overridable Function CreateOrderBy() As OrderBy + ' The CurrentSortOrder is initialized to the sort order on the + ' Query Wizard. It may be modified by the Click handler for any of + ' the column heading to sort or reverse sort by that column. + ' You can add your own sort order, or modify it on the Query Wizard. + Return Me.CurrentSortOrder + End Function + + Public Overridable Function CreateWhereClause() As WhereClause + 'This CreateWhereClause is used for loading the data. + PersonalInsigniaTable.Instance.InnerFilter = Nothing + Dim wc As WhereClause = New WhereClause() + + ' Compose the WHERE clause consiting of: + ' 1. Static clause defined at design time. + ' 2. User selected search criteria. + ' 3. User selected filter criteria. + + + Dim selectedRecordKeyValue as KeyValue = New KeyValue() + + Dim personalIdRecordControlObj As Persons.UI.Controls.AddPersonalId.PersonalIdRecordControl = DirectCast(MiscUtils.FindControlRecursively(Me.Page, "PersonalIdRecordControl"), Persons.UI.Controls.AddPersonalId.PersonalIdRecordControl) + + If (Not IsNothing(personalIdRecordControlObj) AndAlso Not IsNothing(personalIdRecordControlObj.GetRecord()) AndAlso personalIdRecordControlObj.GetRecord().IsCreated AndAlso Not IsNothing(personalIdRecordControlObj.GetRecord().PersonalId)) + wc.iAND(PersonalInsigniaTable.PersonalId, BaseFilter.ComparisonOperator.EqualsTo, personalIdRecordControlObj.GetRecord().PersonalId.ToString()) + selectedRecordKeyValue.AddElement(PersonalInsigniaTable.PersonalId.InternalName, personalIdRecordControlObj.GetRecord().PersonalId.ToString()) + Else + wc.RunQuery = False + Return wc + End If + + HttpContext.Current.Session("PersonalInsigniaTableControlWhereClause") = selectedRecordKeyValue.ToXmlString() + + Return wc + End Function + + + Public Overridable Function CreateWhereClause(ByVal searchText as String, ByVal fromSearchControl as String, ByVal AutoTypeAheadSearch as String, ByVal AutoTypeAheadWordSeparators as String) As WhereClause + ' This CreateWhereClause is used for loading list of suggestions for Auto Type-Ahead feature. + PersonalInsigniaTable.Instance.InnerFilter = Nothing + Dim wc As WhereClause = New WhereClause() + + ' Compose the WHERE clause consiting of: + ' 1. Static clause defined at design time. + ' 2. User selected search criteria. + ' 3. User selected filter criteria. + + Dim appRelativeVirtualPath As String = CType(HttpContext.Current.Session("AppRelativeVirtualPath"), String) + + Dim selectedRecordInPersonalIdRecordControl as String = DirectCast(HttpContext.Current.Session("PersonalInsigniaTableControlWhereClause"), String) + + If Not selectedRecordInPersonalIdRecordControl Is Nothing AndAlso KeyValue.IsXmlKey(selectedRecordInPersonalIdRecordControl) Then + Dim selectedRecordKeyValue as KeyValue = KeyValue.XmlToKey(selectedRecordInPersonalIdRecordControl) + + If Not IsNothing(selectedRecordKeyValue) AndAlso selectedRecordKeyValue.ContainsColumn(PersonalInsigniaTable.PersonalId) Then + wc.iAND(PersonalInsigniaTable.PersonalId, BaseFilter.ComparisonOperator.EqualsTo, selectedRecordKeyValue.GetColumnValue(PersonalInsigniaTable.PersonalId).ToString()) + End If + + End If + + ' Adds clauses if values are selected in Filter controls which are configured in the page. + + + Return wc + End Function + + + Public Overridable Function FormatSuggestions(ByVal prefixText As String, ByVal resultItem As String, _ + ByVal columnLength As Integer, ByVal AutoTypeAheadDisplayFoundText As String, _ + ByVal autoTypeAheadSearch As String, ByVal AutoTypeAheadWordSeparators As String, _ + ByVal resultList As ArrayList) As Boolean + + 'Formats the resultItem and adds it to the list of suggestions. + Dim index As Integer = resultItem.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture).IndexOf(prefixText.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture)) + Dim itemToAdd As String = "" + Dim isFound As Boolean = False + Dim isAdded As Boolean = False + ' Get the index where prfixt is at the beginning of resultItem. If not found then, index of word which begins with prefixText. + If InvariantLCase(autoTypeAheadSearch).equals("wordsstartingwithsearchstring") And Not index = 0 Then + ' Expression to find word which contains AutoTypeAheadWordSeparators followed by prefixText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex( AutoTypeAheadWordSeparators + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + If regex1.IsMatch(resultItem) Then + index = regex1.Match(resultItem).Index + isFound = True + End If + ' If the prefixText is found immediatly after white space then starting of the word is found so don not search any further + If not resultItem(index).ToString() = " " Then + ' Expression to find beginning of the word which contains AutoTypeAheadWordSeparators followed by prefixText + Dim regex As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\\S*" + AutoTypeAheadWordSeparators + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + If regex.IsMatch(resultItem) Then + index = regex.Match(resultItem).Index + isFound = True + End If + End If + End If + + ' If autoTypeAheadSearch value is wordsstartingwithsearchstring then, extract the substring only if the prefixText is found at the + ' beginning of the resultItem (index = 0) or a word in resultItem is found starts with prefixText. + If index = 0 Or isFound Or InvariantLCase(autoTypeAheadSearch).Equals("anywhereinstring") then + If InvariantLCase(AutoTypeAheadDisplayFoundText).equals("atbeginningofmatchedstring") Then + ' Expression to find beginning of the word which contains prefixText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\\S*" + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + ' Find the beginning of the word which contains prefexText + If (StringUtils.InvariantLCase(autoTypeAheadSearch).Equals("anywhereinstring") AndAlso regex1.IsMatch(resultItem)) Then + index = regex1.Match(resultItem).Index + isFound = True + End If + ' Display string from the index till end of the string if sub string from index till end is less than columnLength value. + If Len(resultItem) - index <= columnLength Then + If index = 0 Then + itemToAdd = resultItem + Else + itemToAdd = "..." & resultItem.Substring(index, Len(resultItem) - index) + End If + Else + If index = 0 Then + itemToAdd = resultItem.Substring(index, (columnLength - 3)) & "..." + Else + 'Truncate the string to show only columnLength - 6 characters as begining and trailing "..." has to be appended. + itemToAdd = "..." & resultItem.Substring(index , columnLength - 6) & "..." + End If + End If + ElseIf InvariantLCase(AutoTypeAheadDisplayFoundText).equals("inmiddleofmatchedstring") Then + Dim subStringBeginIndex As Integer = CType(columnLength/2, Integer) + If Len(resultItem) <= columnLength Then + itemToAdd = resultItem + Else + ' Sanity check at end of the string + If index + Len(prefixText) = columnLength Then + itemToAdd = "..." & resultItem.Substring(index-columnLength,index) + ElseIf Len(resultItem) - index < subStringBeginIndex Then + ' Display string from the end till columnLength value if, index is closer to the end of the string. + itemToAdd = "..." & resultItem.Substring(Len(resultItem)-columnLength,Len(resultItem)) + ElseIf index <= subStringBeginIndex Then + ' Sanity chet at beginning of the string + itemToAdd = resultItem.Substring(0, columnLength) & "..." + Else + ' Display string containing text before the prefixText occures and text after the prefixText + itemToAdd = "..." & resultItem.Substring(index - subStringBeginIndex, columnLength) & "..." + End If + End If + ElseIf InvariantLCase(AutoTypeAheadDisplayFoundText).equals("atendofmatchedstring") Then + ' Expression to find ending of the word which contains prefexText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\s", System.Text.RegularExpressions.RegexOptions.IgnoreCase) + ' Find the ending of the word which contains prefexText + If regex1.IsMatch(resultItem, index + 1) Then + index = regex1.Match(resultItem, index + 1).Index + Else + ' If the word which contains prefexText is the last word in string, regex1.IsMatch returns false. + index = resultItem.Length + End If + If index > Len(resultItem) Then + index = Len(resultItem) + End If + ' If text from beginning of the string till index is less than columnLength value then, display string from the beginning till index. + If index <= columnLength Then + if index = Len(resultItem) Then 'Make decision to append "..." + itemToAdd = resultItem.Substring(0,index) + Else + itemToAdd = resultItem.Substring(0,index) & "..." + End If + Else + If index = Len(resultItem) Then + itemToAdd = "..." & resultItem.Substring(index - (columnLength - 3), (columnLength - 3)) + Else + 'Truncate the string to show only columnLength - 6 characters as begining and trailing "..." has to be appended. + itemToAdd = "..." & resultItem.Substring(index - (columnLength - 6), columnLength - 6) & "..." + End If + End If + End If + + ' Remove newline character from itemToAdd + Dim prefixTextIndex As Integer = itemToAdd.IndexOf(prefixText, StringComparison.CurrentCultureIgnoreCase) + ' If itemToAdd contains any newline after the search text then show text only till newline + Dim regex2 As System.Text.RegularExpressions.Regex = New System.Text.RegularExpressions.Regex("(" & vbCrLf & "|" & vbLf & ")", System.Text.RegularExpressions.RegexOptions.IgnoreCase) + Dim newLineIndexAfterPrefix As Integer = -1 + If regex2.IsMatch(itemToAdd, prefixTextIndex) Then + newLineIndexAfterPrefix = regex2.Match(itemToAdd, prefixTextIndex).Index + End If + If (newLineIndexAfterPrefix > -1) Then + If itemToAdd.EndsWith("...") Then + itemToAdd = (itemToAdd.Substring(0, newLineIndexAfterPrefix) + "...") + Else + itemToAdd = itemToAdd.Substring(0, newLineIndexAfterPrefix) + End If + End If + ' If itemToAdd contains any newline before search text then show text which comes after newline + Dim regex3 As System.Text.RegularExpressions.Regex = New System.Text.RegularExpressions.Regex("(" & vbCrLf & "|" & vbLf & ")", (System.Text.RegularExpressions.RegexOptions.IgnoreCase Or System.Text.RegularExpressions.RegexOptions.RightToLeft)) + Dim newLineIndexBeforePrefix As Integer = -1 + If regex3.IsMatch(itemToAdd, prefixTextIndex) Then + newLineIndexBeforePrefix = regex3.Match(itemToAdd, prefixTextIndex).Index + End If + If (newLineIndexBeforePrefix > -1) Then + If itemToAdd.StartsWith("...") Then + itemToAdd = ("..." + itemToAdd.Substring((newLineIndexBeforePrefix + regex3.Match(itemToAdd, prefixTextIndex).Length))) + Else + itemToAdd = itemToAdd.Substring((newLineIndexBeforePrefix + regex3.Match(itemToAdd, prefixTextIndex).Length)) + End If + End If + + If Not itemToAdd is nothing AndAlso Not resultList.Contains(itemToAdd) Then + + resultList.Add(itemToAdd) + + isAdded = true + End If + End If + Return isAdded + End Function + + + Protected Overridable Sub GetPageSize() + + If Me.PersonalInsigniaPagination.PageSize.Text.Trim <> "" Then + Try + 'Me.PageSize = Integer.Parse(Me.PersonalInsigniaPagination.PageSize.Text) + Catch ex As Exception + End Try + End If + End Sub + + Protected Overridable Sub AddNewRecords() + + Dim newRecordList As ArrayList = New ArrayList() + + Dim newUIDataList As System.Collections.Generic.List(Of Hashtable) = New System.Collections.Generic.List(Of Hashtable)() + + ' Loop though all the record controls and if the record control + ' does not have a unique record id set, then create a record + ' and add to the list. + If Not Me.ResetData Then + Dim rep As System.Web.UI.WebControls.Repeater = CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalInsigniaTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return + + Dim repItem As System.Web.UI.WebControls.RepeaterItem + For Each repItem In rep.Items + ' Loop through all rows in the table, set its DataSource and call DataBind(). + + Dim recControl As PersonalInsigniaTableControlRow = DirectCast(repItem.FindControl("PersonalInsigniaTableControlRow"), PersonalInsigniaTableControlRow) + + If recControl.Visible AndAlso recControl.IsNewRecord() Then + + Dim rec As PersonalInsigniaRecord = New PersonalInsigniaRecord() + + If recControl.GazetteDate.Text <> "" Then + rec.Parse(recControl.GazetteDate.Text, PersonalInsigniaTable.GazetteDate) + End If + If recControl.GazetteNO.Text <> "" Then + rec.Parse(recControl.GazetteNO.Text, PersonalInsigniaTable.GazetteNO) + End If + If recControl.GazettePage.Text <> "" Then + rec.Parse(recControl.GazettePage.Text, PersonalInsigniaTable.GazettePage) + End If + If recControl.GazetteSection.Text <> "" Then + rec.Parse(recControl.GazetteSection.Text, PersonalInsigniaTable.GazetteSection) + End If + If recControl.InsigniaDate.Text <> "" Then + rec.Parse(recControl.InsigniaDate.Text, PersonalInsigniaTable.InsigniaDate) + End If + If MiscUtils.IsValueSelected(recControl.InsigniaId) Then + rec.Parse(recControl.InsigniaId.SelectedItem.Value, PersonalInsigniaTable.InsigniaId) + End If + If recControl.InsigniaReturn.Text <> "" Then + rec.Parse(recControl.InsigniaReturn.Text, PersonalInsigniaTable.InsigniaReturn) + End If + newUIDataList.Add(recControl.PreservedUIData()) + newRecordList.Add(rec) + End If + Next + End If + + + ' Add any new record to the list. + Dim index As Integer = 0 + For index = 1 To Me.AddNewRecord + + newRecordList.Insert(0, New PersonalInsigniaRecord()) + newUIDataList.Insert(0, New Hashtable()) + + Next + Me.AddNewRecord = 0 + + ' Finally, add any new records to the DataSource. + If newRecordList.Count > 0 Then + + Dim finalList As ArrayList = New ArrayList(Me.DataSource) + finalList.InsertRange(0, newRecordList) + + Me.DataSource = DirectCast(finalList.ToArray(GetType(PersonalInsigniaRecord)), PersonalInsigniaRecord()) + + End If + + ' Add the existing UI data to this hash table + If newUIDataList.Count > 0 Then + Me.UIData.InsertRange(0, newUIDataList) + End If + + End Sub + + + Public Sub AddToDeletedRecordIds(ByVal rec As PersonalInsigniaTableControlRow) + If rec.IsNewRecord() Then + Return + End If + + If Not Me.DeletedRecordIds Is Nothing AndAlso Me.DeletedRecordIds.Trim <> "" Then + Me.DeletedRecordIds &= "," + End If + + Me.DeletedRecordIds &= "[" & rec.RecordUniqueId & "]" + End Sub + + Protected Overridable Function InDeletedRecordIds(ByVal rec As PersonalInsigniaTableControlRow) As Boolean + If Me.DeletedRecordIds Is Nothing OrElse Me.DeletedRecordIds.Trim = "" Then + Return False + End If + + Return Me.DeletedRecordIds.IndexOf("[" & rec.RecordUniqueId & "]") >= 0 + End Function + + Private _DeletedRecordIds As String + Public Property DeletedRecordIds() As String + Get + Return Me._DeletedRecordIds + End Get + Set(ByVal value As String) + Me._DeletedRecordIds = value + End Set + End Property + + + ' Create Set, WhereClause, and Populate Methods + + Public Overridable Sub SetGazetteDateLabel() + + End Sub + + Public Overridable Sub SetGazetteNOLabel() + + End Sub + + Public Overridable Sub SetGazettePageLabel() + + End Sub + + Public Overridable Sub SetGazetteSectionLabel() + + End Sub + + Public Overridable Sub SetInsigniaDateLabel1() + + End Sub + + Public Overridable Sub SetInsigniaIdLabel1() + + End Sub + + Public Overridable Sub SetInsigniaReturnLabel() + + End Sub + + Public Overridable Sub SetPersonalInsigniaTableControlCollapsibleRegion() + + 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. + Dim added As Boolean = Me.AddNewRecord > 0 + Me.LoadData() + Me.DataBind() + + If added Then + Me.SetFocusToAddedRow() + End If + + End If + + + + Catch ex As Exception + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + Finally + DbUtils.EndTransaction + End Try + End Sub + + 'this function sets focus to the first editable element in the new added row in the editable table + Protected Overridable Sub SetFocusToAddedRow() + Dim rep As System.Web.UI.WebControls.Repeater = CType(Me.FindControl("PersonalInsigniaTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing OrElse rep.Items.Count = 0 Then Return + Dim repItem As System.Web.UI.WebControls.RepeaterItem + For Each repItem In rep.Items + 'Load scripts to table rows + Me.Page.LoadFocusScripts(repItem) + Dim recControl As PersonalInsigniaTableControlRow = DirectCast(repItem.FindControl("PersonalInsigniaTableControlRow"), PersonalInsigniaTableControlRow) + If recControl.IsNewRecord Then + For Each field As Control In recControl.Controls + If field.Visible AndAlso Me.Page.IsControlEditable(field, False) Then + 'set focus on the first editable field in the new row + field.Focus() + Dim updPan As UpdatePanel = DirectCast(Me.Page.FindControlRecursively("UpdatePanel1"), UpdatePanel) + If Not updPan Is Nothing Then updPan.Update() + Return + End If + Next + Return + End If + Next + End Sub + + + Protected Overrides Sub SaveControlsToSession() + MyBase.SaveControlsToSession() + + ' Save filter controls to values to session. + + + 'Save pagination state to session. + + + + ' Save table control properties to the session. + If Not Me.CurrentSortOrder Is Nothing Then + Me.SaveToSession(Me, "Order_By", Me.CurrentSortOrder.ToXmlString()) + End If + + Me.SaveToSession(Me, "Page_Index", Me.PageIndex.ToString()) + Me.SaveToSession(Me, "Page_Size", Me.PageSize.ToString()) + + Me.SaveToSession(Me, "DeletedRecordIds", Me.DeletedRecordIds) + + End Sub + + Protected Sub SaveControlsToSession_Ajax() + ' Save filter controls to values to session. + + HttpContext.Current.Session("AppRelativeVirtualPath") = Me.Page.AppRelativeVirtualPath + + End Sub + + Protected Overrides Sub ClearControlsFromSession() + MyBase.ClearControlsFromSession() + + ' Clear filter controls values from the session. + + + ' Clear pagination state from session. + + + + ' Clear table properties from the session. + Me.RemoveFromSession(Me, "Order_By") + Me.RemoveFromSession(Me, "Page_Index") + Me.RemoveFromSession(Me, "Page_Size") + + Me.RemoveFromSession(Me, "DeletedRecordIds") + + End Sub + + Protected Overrides Sub LoadViewState(ByVal savedState As Object) + MyBase.LoadViewState(savedState) + + Dim orderByStr As String = CType(ViewState("PersonalInsigniaTableControl_OrderBy"), String) + + If orderByStr IsNot Nothing AndAlso orderByStr.Trim <> "" Then + Me.CurrentSortOrder = BaseClasses.Data.OrderBy.FromXmlString(orderByStr) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + End If + + Dim pageIndex As String = CType(ViewState("Page_Index"), String) + If pageIndex IsNot Nothing Then + Me.PageIndex = CInt(pageIndex) + End If + + Dim pageSize As String = CType(ViewState("Page_Size"), String) + If Not pageSize Is Nothing Then + Me.PageSize = CInt(pageSize) + End If + + + + ' Load view state for pagination control. + + Me.DeletedRecordIds = CType(Me.ViewState("DeletedRecordIds"), String) + + End Sub + + Protected Overrides Function SaveViewState() As Object + + If Me.CurrentSortOrder IsNot Nothing Then + Me.ViewState("PersonalInsigniaTableControl_OrderBy") = Me.CurrentSortOrder.ToXmlString() + End If + + Me.ViewState("Page_Index") = Me.PageIndex + Me.ViewState("Page_Size") = Me.PageSize + + Me.ViewState("DeletedRecordIds") = Me.DeletedRecordIds + + + ' Load view state for pagination control. + + + Return MyBase.SaveViewState() + End Function + + ' Generate the event handling functions for pagination events. + + ' event handler for ImageButton + Public Overridable Sub PersonalInsigniaPagination_FirstPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.PageIndex = 0 + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalInsigniaPagination_LastPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.DisplayLastPage = True + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalInsigniaPagination_NextPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.PageIndex += 1 + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for LinkButton + Public Overridable Sub PersonalInsigniaPagination_PageSizeButton_Click(ByVal sender As Object, ByVal args As EventArgs) + + Try + + Me.DataChanged = True + + Me.PageSize = Integer.Parse(Me.PersonalInsigniaPagination.PageSize.Text) + + Me.PageIndex = Integer.Parse(Me.PersonalInsigniaPagination.CurrentPage.Text) - 1 + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalInsigniaPagination_PreviousPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + If Me.PageIndex > 0 Then + Me.PageIndex -= 1 + Me.DataChanged = True + End If + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + + ' Generate the event handling functions for sorting events. + + Public Overridable Sub GazetteDateLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by GazetteDate when clicked. + + ' Get previous sorting state for GazetteDate. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalInsigniaTable.GazetteDate) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for GazetteDate. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalInsigniaTable.GazetteDate, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by GazetteDate, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub GazetteNOLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by GazetteNO when clicked. + + ' Get previous sorting state for GazetteNO. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalInsigniaTable.GazetteNO) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for GazetteNO. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalInsigniaTable.GazetteNO, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by GazetteNO, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub GazettePageLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by GazettePage when clicked. + + ' Get previous sorting state for GazettePage. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalInsigniaTable.GazettePage) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for GazettePage. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalInsigniaTable.GazettePage, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by GazettePage, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub GazetteSectionLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by GazetteSection when clicked. + + ' Get previous sorting state for GazetteSection. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalInsigniaTable.GazetteSection) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for GazetteSection. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalInsigniaTable.GazetteSection, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by GazetteSection, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub InsigniaDateLabel1_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by InsigniaDate when clicked. + + ' Get previous sorting state for InsigniaDate. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalInsigniaTable.InsigniaDate) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for InsigniaDate. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalInsigniaTable.InsigniaDate, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by InsigniaDate, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub InsigniaIdLabel1_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by InsigniaId when clicked. + + ' Get previous sorting state for InsigniaId. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalInsigniaTable.InsigniaId) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for InsigniaId. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalInsigniaTable.InsigniaId, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by InsigniaId, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub InsigniaReturnLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by InsigniaReturn when clicked. + + ' Get previous sorting state for InsigniaReturn. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalInsigniaTable.InsigniaReturn) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for InsigniaReturn. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalInsigniaTable.InsigniaReturn, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by InsigniaReturn, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + + ' Generate the event handling functions for button events. + + ' event handler for ImageButton + Public Overridable Sub PersonalInsigniaAddButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + Me.AddNewRecord = 1 + Me.DataChanged = True + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalInsigniaDeleteButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + If(Not Me.Page.IsPageRefresh) Then + + Me.DeleteSelectedRecords(True) + Me.SetFormulaControls() + + + End If + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalInsigniaResetButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.CurrentSortOrder.Reset() + If Me.InSession(Me, "Order_By") Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + + End If + + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + + + ' Generate the event handling functions for filter and search events. + + + ' Generate the event handling functions for others + + + Private _UIData As New System.Collections.Generic.List(Of Hashtable) + Public Property UIData() As System.Collections.Generic.List(Of Hashtable) + Get + Return Me._UIData + End Get + Set(ByVal value As System.Collections.Generic.List(Of Hashtable)) + Me._UIData = value + End Set + End Property + + ' pagination properties + Protected _PageSize As Integer + Public Property PageSize() As Integer + Get + Return Me._PageSize + End Get + Set(ByVal value As Integer) + Me._PageSize = value + End Set + End Property + + Protected _PageIndex As Integer + Public Property PageIndex() As Integer + Get + ' Return the PageIndex + Return Me._PageIndex + End Get + Set(ByVal value As Integer) + Me._PageIndex = value + End Set + End Property + + Protected _TotalRecords As Integer = -1 + Public Property TotalRecords() As Integer + Get + If _TotalRecords < 0 + _TotalRecords = PersonalInsigniaTable.GetRecordCount(CreateCompoundJoinFilter(), CreateWhereClause()) + End If + Return Me._TotalRecords + End Get + Set(ByVal value As Integer) + If Me.PageSize > 0 Then + + Me.TotalPages = CInt(Math.Ceiling(value / Me.PageSize)) + + End If + Me._TotalRecords = value + End Set + End Property + + + + Protected _TotalPages As Integer = -1 + Public Property TotalPages() As Integer + Get + If _TotalPages < 0 Then + + Me.TotalPages = CInt(Math.Ceiling(TotalRecords / Me.PageSize)) + + End If + Return Me._TotalPages + End Get + Set(ByVal value As Integer) + Me._TotalPages = value + End Set + End Property + + Protected _DisplayLastPage As Boolean + Public Property DisplayLastPage() As Boolean + Get + Return Me._DisplayLastPage + End Get + Set(ByVal value As Boolean) + Me._DisplayLastPage = value + End Set + End Property + + Private _DataChanged As Boolean = False + Public Property DataChanged() As Boolean + Get + Return Me._DataChanged + End Get + Set(ByVal value As Boolean) + Me._DataChanged = value + End Set + End Property + + Private _ResetData As Boolean = False + Public Property ResetData() As Boolean + Get + Return Me._ResetData + End Get + Set(ByVal value As Boolean) + Me._ResetData = value + End Set + End Property + + Private _AddNewRecord As Integer = 0 + Public Property AddNewRecord() As Integer + Get + Return Me._AddNewRecord + End Get + Set(ByVal value As Integer) + Me._AddNewRecord = value + End Set + End Property + + + Private _CurrentSortOrder As OrderBy = Nothing + Public Property CurrentSortOrder() As OrderBy + Get + Return Me._CurrentSortOrder + End Get + Set(ByVal value As BaseClasses.Data.OrderBy) + Me._CurrentSortOrder = value + End Set + End Property + + Private _DataSource() As PersonalInsigniaRecord = Nothing + Public Property DataSource() As PersonalInsigniaRecord () + Get + Return Me._DataSource + End Get + Set(ByVal value() As PersonalInsigniaRecord) + Me._DataSource = value + End Set + End Property + +#Region "Helper Properties" + + Public ReadOnly Property GazetteDateLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "GazetteDateLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property GazetteNOLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "GazetteNOLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property GazettePageLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "GazettePageLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property GazetteSectionLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "GazetteSectionLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property InsigniaDateLabel1() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "InsigniaDateLabel1"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property InsigniaIdLabel1() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "InsigniaIdLabel1"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property InsigniaReturnLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "InsigniaReturnLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property PersonalInsigniaAddButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalInsigniaAddButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalInsigniaDeleteButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalInsigniaDeleteButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalInsigniaPagination() As Persons.UI.IPagination + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalInsigniaPagination"), Persons.UI.IPagination) + End Get + End Property + + Public ReadOnly Property PersonalInsigniaResetButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalInsigniaResetButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalInsigniaTableControlCollapsibleRegion() As System.Web.UI.WebControls.Panel + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalInsigniaTableControlCollapsibleRegion"), System.Web.UI.WebControls.Panel) + End Get + End Property + + Public ReadOnly Property PersonalInsigniaToggleAll() As System.Web.UI.WebControls.CheckBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalInsigniaToggleAll"), System.Web.UI.WebControls.CheckBox) + End Get + End Property + +#End Region + +#Region "Helper Functions" + + Public Overrides Overloads Function ModifyRedirectUrl(url As String, arg As String, ByVal bEncrypt As Boolean) As String + Return Me.Page.EvaluateExpressions(url, arg, bEncrypt, Me) + End Function + + Public Overrides Overloads Function EvaluateExpressions(url As String, arg As String, ByVal bEncrypt As Boolean) As String + Dim needToProcess As Boolean = AreAnyUrlParametersForMe(url, arg) + If (needToProcess) Then + Dim recCtl As PersonalInsigniaTableControlRow = Me.GetSelectedRecordControl() + If recCtl Is Nothing AndAlso url.IndexOf("{") >= 0 Then + ' Localization. + Throw New Exception(Page.GetResourceValue("Err:NoRecSelected", "Persons")) + End If + Dim rec As PersonalInsigniaRecord = Nothing + If recCtl IsNot Nothing Then + rec = recCtl.GetRecord() + End If + Return EvaluateExpressions(url, arg, rec, bEncrypt) + End If + Return url + End Function + + Public Overridable Function GetSelectedRecordIndex() As Integer + Dim counter As Integer = 0 + Dim recControl As PersonalInsigniaTableControlRow + For Each recControl In Me.GetRecordControls() + If recControl.PersonalInsigniaRecordRowSelection.Checked Then + Return counter + End If + counter += 1 + Next + Return -1 + End Function + + Public Overridable Function GetSelectedRecordControl() As PersonalInsigniaTableControlRow + Dim selectedList() As PersonalInsigniaTableControlRow = Me.GetSelectedRecordControls() + If selectedList.Length = 0 Then + Return Nothing + End If + Return selectedList(0) + + End Function + + Public Overridable Function GetSelectedRecordControls() As PersonalInsigniaTableControlRow() + + Dim selectedList As ArrayList = New ArrayList(25) + Dim recControl As PersonalInsigniaTableControlRow + For Each recControl In Me.GetRecordControls() + If recControl.PersonalInsigniaRecordRowSelection IsNot Nothing AndAlso recControl.PersonalInsigniaRecordRowSelection.Checked Then + selectedList.Add(recControl) + End If + Next + Return DirectCast(selectedList.ToArray(GetType(PersonalInsigniaTableControlRow)), PersonalInsigniaTableControlRow()) + + End Function + + Public Overridable Sub DeleteSelectedRecords(ByVal deferDeletion As Boolean) + Dim recList() As PersonalInsigniaTableControlRow = Me.GetSelectedRecordControls() + If recList.Length = 0 Then + ' Localization. + Throw New Exception(Page.GetResourceValue("Err:NoRecSelected", "Persons")) + End If + + Dim recCtl As PersonalInsigniaTableControlRow + For Each recCtl In recList + If deferDeletion Then + If Not recCtl.IsNewRecord Then + + Me.AddToDeletedRecordIds(recCtl) + + End If + recCtl.Visible = False + + recCtl.PersonalInsigniaRecordRowSelection.Checked = False + + Else + + recCtl.Delete() + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + End If + Next + End Sub + + Public Function GetRecordControls() As PersonalInsigniaTableControlRow() + Dim recList As ArrayList = New ArrayList() + Dim rep As System.Web.UI.WebControls.Repeater = CType(Me.FindControl("PersonalInsigniaTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return Nothing + Dim repItem As System.Web.UI.WebControls.RepeaterItem + + For Each repItem In rep.Items + + Dim recControl As PersonalInsigniaTableControlRow = DirectCast(repItem.FindControl("PersonalInsigniaTableControlRow"), PersonalInsigniaTableControlRow) + recList.Add(recControl) + + Next + + Return DirectCast(recList.ToArray(GetType(PersonalInsigniaTableControlRow)), PersonalInsigniaTableControlRow()) + End Function + + Public Shadows ReadOnly Property Page() As BaseApplicationPage + Get + Return DirectCast(MyBase.Page, BaseApplicationPage) + End Get + End Property + +#End Region + + + +End Class + + +' Base class for the PersonalLanguageSkillTableControlRow control on the AddPersonalId page. +' Do not modify this class. Instead override any method in PersonalLanguageSkillTableControlRow. +Public Class BasePersonalLanguageSkillTableControlRow + Inherits Persons.UI.BaseApplicationRecordControl + + ' To customize, override this method in PersonalLanguageSkillTableControlRow. + Protected Overridable Sub Control_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Init + + Me.ClearControlsFromSession() + End Sub + + ' To customize, override this method in PersonalLanguageSkillTableControlRow. + Protected Overridable Sub Control_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load + + 'Call LoadFocusScripts from repeater so that onfocus attribute could be added to elements + Me.Page.LoadFocusScripts(Me) + + ' Show confirmation message on Click + Me.PersonalLanguageSkillRowDeleteButton.Attributes.Add("onClick", "return (confirm('" & (CType(Me.Page,BaseApplicationPage)).GetResourceValue("DeleteRecordConfirm", "Persons") & "'));") + + + ' Register the event handlers. + + AddHandler Me.PersonalLanguageSkillRowDeleteButton.Click, AddressOf PersonalLanguageSkillRowDeleteButton_Click + + AddHandler Me.LanguageId.SelectedIndexChanged, AddressOf LanguageId_SelectedIndexChanged + + AddHandler Me.Level.TextChanged, AddressOf Level_TextChanged + + + End Sub + + + Public Overridable Sub LoadData() + + ' Load the data from the database into the DataSource PersonalLanguageSkill 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 = PersonalLanguageSkillTable.GetRecord(Me.RecordUniqueId, True) + + Return + End If + + ' Since this is a row in the table, the data for this row is loaded by the + ' LoadData method of the BasePersonalLanguageSkillTableControl when the data for the entire + ' table is loaded. + + Me.DataSource = New PersonalLanguageSkillRecord() + + + + End Sub + + ' Populate the UI controls using the DataSource. To customize, override this method in PersonalLanguageSkillTableControlRow. + 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 + + SetLanguageId() + SetLevel() + + + + + 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 SetLanguageId() + + ' If selection was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.LanguageId.ID) Then + If Me.PreviousUIData(Me.LanguageId.ID) Is Nothing + Me.PopulateLanguageIdDropDownList(Nothing, 100) + Else + Me.PopulateLanguageIdDropDownList(Me.PreviousUIData(Me.LanguageId.ID).ToString(), 100) + End If + Return + End If + + + ' Set the LanguageId DropDownList on the webpage with value from the + ' PersonalLanguageSkill database record. + + ' Me.DataSource is the PersonalLanguageSkill record retrieved from the database. + ' Me.LanguageId is the ASP:DropDownList on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetLanguageId() + ' and add your own code before or after the call to the MyBase function. + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.LanguageIdSpecified Then + + ' If the LanguageId is non-NULL, then format the value. + ' The Format method will return the Display Foreign Key As (DFKA) value + Me.PopulateLanguageIdDropDownList(Me.DataSource.LanguageId.ToString(), 100) + + Else + + ' LanguageId 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.PopulateLanguageIdDropDownList(Nothing, 100) + Else + Me.PopulateLanguageIdDropDownList(PersonalLanguageSkillTable.LanguageId.DefaultValue, 100) + End If + + End If + + End Sub + + Public Overridable Sub SetLevel() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.Level.ID) Then + + Me.Level.Text = Me.PreviousUIData(Me.Level.ID).ToString() + + Return + End If + + + ' Set the Level TextBox on the webpage with value from the + ' PersonalLanguageSkill database record. + + ' Me.DataSource is the PersonalLanguageSkill record retrieved from the database. + ' Me.Level is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetLevel() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.LevelSpecified Then + + ' If the Level is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalLanguageSkillTable.Level) + + Me.Level.Text = formattedValue + + Else + + ' Level is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.Level.Text = PersonalLanguageSkillTable.Level.Format(PersonalLanguageSkillTable.Level.DefaultValue) + + End If + + End Sub + + + Public EvaluateFormulaDelegate As BaseClasses.Data.DataSource.EvaluateFormulaDelegate = New BaseClasses.Data.DataSource.EvaluateFormulaDelegate(AddressOf Me.EvaluateFormula) + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean, ByVal e As FormulaEvaluator) As String + If e Is Nothing Then + e = New FormulaEvaluator() + End If + + e.Variables.Clear() + + + ' add variables for formula evaluation + If variables IsNot Nothing Then + Dim enumerator As System.Collections.Generic.IEnumerator(Of System.Collections.Generic.KeyValuePair(Of String, Object)) = variables.GetEnumerator() + While enumerator.MoveNext() + e.Variables.Add(enumerator.Current.Key, enumerator.Current.Value) + End While + End If + + If includeDS + + End IF + + + ' Other variables referred to in the formula are expected to be + ' properties of the DataSource. For example, referring to + ' UnitPrice as a variable will refer to DataSource.UnitPrice + If dataSourceForEvaluate Is Nothing Then + + e.DataSource = Me.DataSource + + Else + e.DataSource = dataSourceForEvaluate + End If + + ' Define the calling control. This is used to add other + ' related table and record controls as variables. + e.CallingControl = Me + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + + If Not String.IsNullOrEmpty(format) AndAlso (String.IsNullOrEmpty(formula) OrElse formula.IndexOf("Format(") < 0) Then + Return FormulaUtils.Format(resultObj, format) + Else + Return resultObj.ToString() + End If + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format,variables ,includeDS, Nothing) + End Function + + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object)) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format, variables ,True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, format, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal e as FormulaEvaluator) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, variables, True, e) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal includeDS as Boolean) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, includeDS, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, True, Nothing) + End Function + + + Public Overridable Sub RegisterPostback() + + + End Sub + + + + ' To customize, override this method in PersonalLanguageSkillTableControlRow. + 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 parentCtrl As PersonalIdRecordControl + + + parentCtrl = DirectCast(Me.Page.FindControlRecursively("PersonalIdRecordControl"), PersonalIdRecordControl) + + If (Not IsNothing(parentCtrl) AndAlso IsNothing(parentCtrl.DataSource)) + ' Load the record if it is not loaded yet. + parentCtrl.LoadData() + End If + If (IsNothing(parentCtrl) OrElse IsNothing(parentCtrl.DataSource)) + ' Get the error message from the application resource file. + Throw New Exception(Page.GetResourceValue("Err:NoParentRecId", "Persons")) + End If + + Me.DataSource.PersonalId = parentCtrl.DataSource.PersonalId + + ' 2. Perform any custom validation. + Me.Validate() + + + ' 3. Set the values in the record with data from UI controls. + ' This calls the Get() method for each of the user interface controls. + Me.GetUIData() + + ' 4. Save in the database. + ' We should not save the record if the data did not change. This + ' will save a database hit and avoid triggering any database triggers. + + If Me.DataSource.IsAnyValueChanged Then + ' Save record to database but do not commit yet. + ' Auto generated ids are available after saving for use by child (dependent) records. + Me.DataSource.Save() + + DirectCast(GetParentControlObject(Me, "PersonalLanguageSkillTableControl"), PersonalLanguageSkillTableControl).DataChanged = True + DirectCast(GetParentControlObject(Me, "PersonalLanguageSkillTableControl"), PersonalLanguageSkillTableControl).ResetData = True + End If + + + ' update session or cookie by formula + + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + ' For Master-Detail relationships, save data on the Detail table(s) + + End Sub + + ' To customize, override this method in PersonalLanguageSkillTableControlRow. + 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. + + GetLanguageId() + GetLevel() + End Sub + + + Public Overridable Sub GetLanguageId() + + ' Retrieve the value entered by the user on the LanguageId ASP:DropDownList, and + ' save it into the LanguageId field in DataSource PersonalLanguageSkill record. + + ' Custom validation should be performed in Validate, not here. + + Me.DataSource.Parse(GetValueSelectedPageRequest(Me.LanguageId), PersonalLanguageSkillTable.LanguageId) + + End Sub + + Public Overridable Sub GetLevel() + + ' Retrieve the value entered by the user on the Level ASP:TextBox, and + ' save it into the Level field in DataSource PersonalLanguageSkill record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.Level.Text, PersonalLanguageSkillTable.Level) + + + End Sub + + + ' To customize, override this method in PersonalLanguageSkillTableControlRow. + + Public Overridable Function CreateWhereClause() As WhereClause + + Return Nothing + + End Function + + + + ' To customize, override this method in PersonalLanguageSkillTableControlRow. + 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) + PersonalLanguageSkillTable.DeleteRecord(pkValue) + + DirectCast(GetParentControlObject(Me, "PersonalLanguageSkillTableControl"), PersonalLanguageSkillTableControl).DataChanged = True + DirectCast(GetParentControlObject(Me, "PersonalLanguageSkillTableControl"), PersonalLanguageSkillTableControl).ResetData = True + End Sub + + Protected Overridable Sub Control_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.PreRender + ' PreRender event is raised just before page is being displayed. + Try + DbUtils.StartTransaction() + Me.RegisterPostback() + + If Not Me.Page.ErrorOnPage AndAlso (Me.Page.IsPageRefresh OrElse Me.DataChanged OrElse Me.ResetData) Then + + + ' Re-load the data and update the web page if necessary. + ' This is typically done during a postback (filter, search button, sort, pagination button). + ' In each of the other click handlers, simply set DataChanged to True to reload the data. + Me.LoadData() + Me.DataBind() + End If + + + Catch ex As Exception + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + Finally + DbUtils.EndTransaction() + End Try + End Sub + + + Protected Overrides Sub SaveControlsToSession() + MyBase.SaveControlsToSession() + + + 'Save pagination state to session. + + End Sub + + + + Protected Overrides Sub ClearControlsFromSession() + MyBase.ClearControlsFromSession() + + + + ' Clear pagination state from session. + + End Sub + + Protected Overrides Sub LoadViewState(ByVal savedState As Object) + MyBase.LoadViewState(savedState) + Dim isNewRecord As String = CType(ViewState("IsNewRecord"), String) + If Not isNewRecord Is Nothing AndAlso isNewRecord.Trim <> "" Then + Me.IsNewRecord = Boolean.Parse(isNewRecord) + End If + + Dim myCheckSum As String = CType(ViewState("CheckSum"), String) + If Not myCheckSum Is Nothing AndAlso myCheckSum.Trim <> "" Then + Me.CheckSum = myCheckSum + End If + + + ' Load view state for pagination control. + + End Sub + + Protected Overrides Function SaveViewState() As Object + ViewState("IsNewRecord") = Me.IsNewRecord.ToString() + ViewState("CheckSum") = Me.CheckSum + + + ' Load view state for pagination control. + + Return MyBase.SaveViewState() + End Function + + + + Public Overridable Function CreateWhereClause_LanguageIdDropDownList() 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 Language table. + ' Examples: + ' wc.iAND(LanguageTable.Language0, BaseFilter.ComparisonOperator.EqualsTo, "XYZ") + ' wc.iAND(LanguageTable.Active, BaseFilter.ComparisonOperator.EqualsTo, "1") + + Dim wc As WhereClause = New WhereClause() + Return wc + + End Function + + + ' Fill the LanguageId list. + Protected Overridable Sub PopulateLanguageIdDropDownList( _ + ByVal selectedValue As String, _ + ByVal maxItems As Integer) + + Me.LanguageId.Items.Clear() + + + ' 1. Setup the static list items + + ' Add the Please Select item. + Me.LanguageId.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_LanguageIdDropDownList function. + ' It is better to customize the where clause there. + + Dim wc As WhereClause = CreateWhereClause_LanguageIdDropDownList() + ' Create the ORDER BY clause to sort based on the displayed value. + + + Dim orderBy As OrderBy = New OrderBy(false, false) + orderBy.Add(LanguageTable.Language0, 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 LanguageRecord = 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 = LanguageTable.GetRecords(wc, orderBy, pageNum, maxItems) + For each itemValue As LanguageRecord In itemValues + ' Create the item and add to the list. + Dim cvalue As String = Nothing + Dim fvalue As String = Nothing + If itemValue.LanguageIdSpecified Then + cvalue = itemValue.LanguageId.ToString() + + If counter < maxItems AndAlso Me.LanguageId.Items.FindByValue(cvalue) Is Nothing Then + + Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalLanguageSkillTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalLanguageSkillTable.LanguageId) + If _isExpandableNonCompositeForeignKey AndAlso PersonalLanguageSkillTable.LanguageId.IsApplyDisplayAs Then + fvalue = PersonalLanguageSkillTable.GetDFKA(itemValue, PersonalLanguageSkillTable.LanguageId) + End If + If (Not _isExpandableNonCompositeForeignKey) Or (String.IsNullOrEmpty(fvalue)) Then + fvalue = itemValue.Format(LanguageTable.Language0) + 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.LanguageId.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.LanguageId.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.LanguageId, selectedValue) AndAlso _ + Not SetSelectedDisplayText(Me.LanguageId, selectedValue)Then + + ' construct a whereclause to query a record with Language.LanguageId = selectedValue + Dim filter2 As CompoundFilter = New CompoundFilter(CompoundFilter.CompoundingOperators.And_Operator, Nothing) + Dim whereClause2 As WhereClause = New WhereClause() + filter2.AddFilter(New BaseClasses.Data.ColumnValueFilter(LanguageTable.LanguageId, selectedValue, BaseClasses.Data.BaseFilter.ComparisonOperator.EqualsTo, False)) + whereClause2.AddFilter(filter2, CompoundFilter.CompoundingOperators.And_Operator) + + Try + ' Execute the query + Dim rc() As LanguageRecord = LanguageTable.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 LanguageRecord = DirectCast(rc(0), LanguageRecord) + ' Create the item and add to the list. + Dim cvalue As String = Nothing + Dim fvalue As String = Nothing + If itemValue.LanguageIdSpecified Then + cvalue = itemValue.LanguageId.ToString() + Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalLanguageSkillTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalLanguageSkillTable.LanguageId) + If _isExpandableNonCompositeForeignKey AndAlso PersonalLanguageSkillTable.LanguageId.IsApplyDisplayAs Then + fvalue = PersonalLanguageSkillTable.GetDFKA(itemValue, PersonalLanguageSkillTable.LanguageId) + End If + If (Not _isExpandableNonCompositeForeignKey) Or (String.IsNullOrEmpty(fvalue)) Then + fvalue = itemValue.Format(LanguageTable.Language0) + End If + + If fvalue Is Nothing OrElse fvalue.Trim() = "" Then fvalue = cvalue + Dim newItem As New ListItem(fvalue, cvalue) + Me.LanguageId.Items.Add(newItem) + SetSelectedValue(Me.LanguageId, selectedValue) + End If + End If + Catch + End Try + + End If + + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalLanguageSkillRowDeleteButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + If(Not Me.Page.IsPageRefresh) Then + + Dim tc As PersonalLanguageSkillTableControl = DirectCast(GetParentControlObject(Me, "PersonalLanguageSkillTableControl"), PersonalLanguageSkillTableControl) + If Not (IsNothing(tc)) Then + If Not Me.IsNewRecord Then + tc.AddToDeletedRecordIds(DirectCast(Me, PersonalLanguageSkillTableControlRow)) + End If + Me.Visible = False + tc.SetFormulaControls() + End If + + End If + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + Protected Overridable Sub LanguageId_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()(LanguageId.ClientID & "_SelectedValue"), String) + Dim displayText As String = CType(Me.Page.Session()(LanguageId.ClientID & "_SelectedDisplayText"), String) + If displayText <> "" AndAlso val <> "" Then + Me.LanguageId.Items.Add(New ListItem(displayText, val)) + Me.LanguageId.SelectedIndex = Me.LanguageId.Items.Count - 1 + Me.Page.Session.Remove(LanguageId.ClientID & "_SelectedValue") + Me.Page.Session.Remove(LanguageId.ClientID & "_SelectedDisplayText") + End If + + + + + End Sub + + Protected Overridable Sub Level_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("BasePersonalLanguageSkillTableControlRow_Rec"), String) + End Get + Set(ByVal value As String) + Me.ViewState("BasePersonalLanguageSkillTableControlRow_Rec") = value + End Set + End Property + + Private _DataSource As PersonalLanguageSkillRecord + Public Property DataSource() As PersonalLanguageSkillRecord + Get + Return Me._DataSource + End Get + + Set(ByVal value As PersonalLanguageSkillRecord) + + Me._DataSource = value + End Set + End Property + + + + Private _checkSum As String + Public Overridable Property CheckSum() As String + Get + Return Me._checkSum + End Get + Set(ByVal value As String) + Me._checkSum = value + End Set + End Property + + Private _TotalPages As Integer + Public Property TotalPages() As Integer + Get + Return Me._TotalPages + End Get + Set(ByVal value As Integer) + Me._TotalPages = value + End Set + End Property + + Private _PageIndex As Integer + Public Property PageIndex() As Integer + Get + ' Return the PageIndex + Return Me._PageIndex + End Get + Set(ByVal value As Integer) + Me._PageIndex = value + End Set + End Property + + Private _DisplayLastPage As Boolean + Public Property DisplayLastPage() As Boolean + Get + Return Me._DisplayLastPage + End Get + Set(ByVal value As Boolean) + Me._DisplayLastPage = value + End Set + End Property + + + +#Region "Helper Properties" + + Public ReadOnly Property LanguageId() As System.Web.UI.WebControls.DropDownList + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "LanguageId"), System.Web.UI.WebControls.DropDownList) + End Get + End Property + + Public ReadOnly Property Level() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Level"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property PersonalLanguageSkillRecordRowSelection() As System.Web.UI.WebControls.CheckBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalLanguageSkillRecordRowSelection"), System.Web.UI.WebControls.CheckBox) + End Get + End Property + + Public ReadOnly Property PersonalLanguageSkillRowDeleteButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalLanguageSkillRowDeleteButton"), System.Web.UI.WebControls.ImageButton) + 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 PersonalLanguageSkillRecord = 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 PersonalLanguageSkillRecord + If Not Me.DataSource Is Nothing Then + Return Me.DataSource + End If + + If Not Me.RecordUniqueId Is Nothing Then + + Return PersonalLanguageSkillTable.GetRecord(Me.RecordUniqueId, True) + + End If + + ' Localization. + + Return Nothing + + End Function + + Public Shadows ReadOnly Property Page() As BaseApplicationPage + Get + Return DirectCast(MyBase.Page, BaseApplicationPage) + End Get + End Property + +#End Region + +End Class + + + +' Base class for the PersonalLanguageSkillTableControl control on the AddPersonalId page. +' Do not modify this class. Instead override any method in PersonalLanguageSkillTableControl. +Public Class BasePersonalLanguageSkillTableControl + Inherits Persons.UI.BaseApplicationTableControl + + + + Protected Overridable Sub Control_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Init + + + + ' Setup the filter and search events. + + + + ' Control Initializations. + ' Initialize the table's current sort order. + + If Me.InSession(Me, "Order_By") Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + End If + + + + ' Setup default pagination settings. + + Me.PageSize = CInt(Me.GetFromSession(Me, "Page_Size", "10")) + Me.PageIndex = CInt(Me.GetFromSession(Me, "Page_Index", "0")) + + + + Me.ClearControlsFromSession() + End Sub + + Protected Overridable Sub Control_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load + + SaveControlsToSession_Ajax() + + ' Show confirmation message on Click + Me.PersonalLanguageSkillDeleteButton.Attributes.Add("onClick", "return (confirm('" & (CType(Me.Page,BaseApplicationPage)).GetResourceValue("DeleteConfirm", "Persons") & "'));") + + ' Setup the pagination events. + + AddHandler Me.PersonalLanguageSkillPagination.FirstPage.Click, AddressOf PersonalLanguageSkillPagination_FirstPage_Click + + AddHandler Me.PersonalLanguageSkillPagination.LastPage.Click, AddressOf PersonalLanguageSkillPagination_LastPage_Click + + AddHandler Me.PersonalLanguageSkillPagination.NextPage.Click, AddressOf PersonalLanguageSkillPagination_NextPage_Click + + AddHandler Me.PersonalLanguageSkillPagination.PageSizeButton.Click, AddressOf PersonalLanguageSkillPagination_PageSizeButton_Click + + AddHandler Me.PersonalLanguageSkillPagination.PreviousPage.Click, AddressOf PersonalLanguageSkillPagination_PreviousPage_Click + + + ' Setup the sorting events. + + AddHandler Me.LanguageIdLabel1.Click, AddressOf LanguageIdLabel1_Click + + AddHandler Me.LevelLabel1.Click, AddressOf LevelLabel1_Click + + ' Setup the button events. + + AddHandler Me.PersonalLanguageSkillAddButton.Click, AddressOf PersonalLanguageSkillAddButton_Click + + AddHandler Me.PersonalLanguageSkillDeleteButton.Click, AddressOf PersonalLanguageSkillDeleteButton_Click + + AddHandler Me.PersonalLanguageSkillResetButton.Click, AddressOf PersonalLanguageSkillResetButton_Click + + + ' Setup events for others + + End Sub + + + Public Overridable Sub LoadData() + + ' Read data from database. Returns an array of records that can be assigned + ' to the DataSource table control property. + Try + Dim joinFilter As CompoundFilter = CreateCompoundJoinFilter() + + ' The WHERE clause will be empty when displaying all records in table. + Dim wc As WhereClause = CreateWhereClause() + If wc IsNot Nothing AndAlso Not wc.RunQuery Then + ' Initialize an empty array of records + Dim alist As New ArrayList(0) + Me.DataSource = DirectCast(alist.ToArray(GetType(PersonalLanguageSkillRecord)), PersonalLanguageSkillRecord()) + ' Add records to the list if needed. + Me.AddNewRecords() + Me._TotalRecords = 0 + Me._TotalPages = 0 + Return + End If + + ' Call OrderBy to determine the order - either use the order defined + ' on the Query Wizard, or specified by user (by clicking on column heading) + Dim orderBy As OrderBy = CreateOrderBy() + + ' Get the pagesize from the pagesize control. + Me.GetPageSize() + + If Me.DisplayLastPage Then + Dim totalRecords As Integer = If(Me._TotalRecords < 0, PersonalLanguageSkillTable.GetRecordCount(CreateCompoundJoinFilter(), CreateWhereClause()), Me._TotalRecords) + + Dim totalPages As Integer = CInt(Math.Ceiling(totalRecords / Me.PageSize)) + + Me.PageIndex = totalPages - 1 + End If + + ' Make sure PageIndex (current page) and PageSize are within bounds. + If Me.PageIndex < 0 Then + Me.PageIndex = 0 + End If + If Me.PageSize < 1 Then + Me.PageSize = 1 + End If + + ' Retrieve the records and set the table DataSource. + ' Only PageSize records are fetched starting at PageIndex (zero based). + If Me.AddNewRecord > 0 Then + ' Make sure to preserve the previously entered data on new rows. + Dim postdata As New ArrayList + For Each rc As PersonalLanguageSkillTableControlRow In Me.GetRecordControls() + If Not rc.IsNewRecord Then + rc.DataSource = rc.GetRecord() + rc.GetUIData() + postdata.Add(rc.DataSource) + UIData.Add(rc.PreservedUIData()) + End If + Next + Me.DataSource = DirectCast(postdata.ToArray(GetType(PersonalLanguageSkillRecord)), PersonalLanguageSkillRecord()) + Else ' Get the records from the database + Me.DataSource = PersonalLanguageSkillTable.GetRecords(joinFilter, wc, orderBy, Me.PageIndex, Me.PageSize) + + End If + + ' if the datasource contains no records contained in database, then load the last page. + If (DbUtils.GetCreatedRecords(Me.DataSource).Length = 0 AndAlso Not Me.DisplayLastPage) Then + Me.DisplayLastPage = True + LoadData() + Else + + ' Add any new rows desired by the user. + Me.AddNewRecords() + + ' Turn off the ToggleAll checkbox + Me.PersonalLanguageSkillToggleAll.Checked = False + + + ' Initialize the page and grand totals. now + + End If + + Catch ex As Exception + ' Report the error message to the end user + Dim msg As String = ex.Message + If ex.InnerException IsNot Nothing Then + msg = msg & " InnerException: " & ex.InnerException.Message + End If + Throw New Exception(msg, ex.InnerException) + End Try + End Sub + + + + + Public Overrides Sub DataBind() + ' The DataBind method binds the user interface controls to the values + ' from the database record for each row in the table. To do this, it calls the + ' DataBind for each of the rows. + ' DataBind also populates any filters above the table, and sets the pagination + ' control to the correct number of records and the current page number. + + MyBase.DataBind() + + ' Make sure that the DataSource is initialized. + If Me.DataSource Is Nothing Then + Return + End If + + 'LoadData for DataSource for chart and report if they exist + + ' Improve performance by prefetching display as records. + Me.PreFetchForeignKeyValues() + + ' Setup the pagination controls. + BindPaginationControls() + + + + ' Bind the repeater with the list of records to expand the UI. + Dim rep As System.Web.UI.WebControls.Repeater = CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalLanguageSkillTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return + rep.DataSource = DataSource() + rep.DataBind() + + Dim index As Integer = 0 + For Each repItem As System.Web.UI.WebControls.RepeaterItem In rep.Items + ' Loop through all rows in the table, set its DataSource and call DataBind(). + Dim recControl As PersonalLanguageSkillTableControlRow = DirectCast(repItem.FindControl("PersonalLanguageSkillTableControlRow"), PersonalLanguageSkillTableControlRow) + recControl.DataSource = Me.DataSource(index) + If Me.UIData.Count > index Then + recControl.PreviousUIData = Me.UIData(index) + End If + recControl.DataBind() + recControl.Visible = Not Me.InDeletedRecordIds(recControl) + + index += 1 + Next + + + + + ' Call the Set methods for each controls on the panel + + SetLanguageIdLabel1() + SetLevelLabel1() + + + + + SetPersonalLanguageSkillTableControlCollapsibleRegion() + + ' setting the state of expand or collapse alternative rows + + + ' Load data for each record and table UI control. + ' Ordering is important because child controls get + ' their parent ids from their parent UI controls. + + + ' this method calls the set method for controls with special formula like running total, sum, rank, etc + SetFormulaControls() + End Sub + + Public Overridable Sub SetFormulaControls() + ' this method calls Set methods for the control that has special formula + + + + End Sub + + + Public Sub PreFetchForeignKeyValues() + If (IsNothing(Me.DataSource)) + Return + End If + + Me.Page.PregetDfkaRecords(PersonalLanguageSkillTable.LanguageId, Me.DataSource) + + End Sub + + + Public Overridable Sub RegisterPostback() + + + End Sub + + Public EvaluateFormulaDelegate As BaseClasses.Data.DataSource.EvaluateFormulaDelegate = New BaseClasses.Data.DataSource.EvaluateFormulaDelegate(AddressOf Me.EvaluateFormula) + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean, ByVal e as FormulaEvaluator) As String + If e Is Nothing + e = New FormulaEvaluator() + End If + + e.Variables.Clear() + + + ' add variables for formula evaluation + If variables IsNot Nothing Then + Dim enumerator As System.Collections.Generic.IEnumerator(Of System.Collections.Generic.KeyValuePair(Of String, Object)) = variables.GetEnumerator() + While enumerator.MoveNext() + e.Variables.Add(enumerator.Current.Key, enumerator.Current.Value) + End While + End If + + If includeDS + + End If + + ' All variables referred to in the formula are expected to be + ' properties of the DataSource. For example, referring to + ' UnitPrice as a variable will refer to DataSource.UnitPrice + e.DataSource = dataSourceForEvaluate + + ' Define the calling control. This is used to add other + ' related table and record controls as variables. + e.CallingControl = Me + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + + If Not String.IsNullOrEmpty(format) AndAlso (String.IsNullOrEmpty(formula) OrElse formula.IndexOf("Format(") < 0) Then + Return FormulaUtils.Format(resultObj, format) + Else + Return resultObj.ToString() + End If + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format,variables ,includeDS, Nothing) + End Function + + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object)) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format, variables ,True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, format, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal e as FormulaEvaluator) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, variables, True, e) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal includeDS as Boolean) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, includeDS, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, True, Nothing) + End Function + + + + + Public Overridable Sub ResetControl() + + Me.CurrentSortOrder.Reset() + If (Me.InSession(Me, "Order_By")) Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + End If + + Me.PageIndex = 0 + End Sub + + Protected Overridable Sub BindPaginationControls() + ' Setup the pagination controls. + + ' Bind the pagination labels. + + If DbUtils.GetCreatedRecords(Me.DataSource).Length > 0 Then + + Me.PersonalLanguageSkillPagination.CurrentPage.Text = (Me.PageIndex + 1).ToString() + Else + Me.PersonalLanguageSkillPagination.CurrentPage.Text = "0" + End If + Me.PersonalLanguageSkillPagination.PageSize.Text = Me.PageSize.ToString() + Me.PersonalLanguageSkillPagination.TotalItems.Text = Me.TotalRecords.ToString() + Me.PersonalLanguageSkillPagination.TotalPages.Text = Me.TotalPages.ToString() + + ' Bind the buttons for PersonalLanguageSkillTableControl pagination. + + Me.PersonalLanguageSkillPagination.FirstPage.Enabled = Not (Me.PageIndex = 0) + If Me._TotalPages < 0 Then ' if the total pages is not determined yet, enable last and next buttons + Me.PersonalLanguageSkillPagination.LastPage.Enabled = True + ElseIf Me._TotalPages = 0 ' if the total pages is determined and it is 0, enable last and next buttons + Me.PersonalLanguageSkillPagination.LastPage.Enabled = False + Else ' if the total pages is the last page, disable last and next buttons + Me.PersonalLanguageSkillPagination.LastPage.Enabled = Not (Me.PageIndex = Me.TotalPages - 1) + End If + + If Me._TotalPages < 0 Then ' if the total pages is not determined yet, enable last and next buttons + Me.PersonalLanguageSkillPagination.NextPage.Enabled = True + ElseIf Me._TotalPages = 0 ' if the total pages is determined and it is 0, enable last and next buttons + Me.PersonalLanguageSkillPagination.NextPage.Enabled = False + Else ' if the total pages is the last page, disable last and next buttons + Me.PersonalLanguageSkillPagination.NextPage.Enabled = Not (Me.PageIndex = Me.TotalPages - 1) + End If + + Me.PersonalLanguageSkillPagination.PreviousPage.Enabled = Not (Me.PageIndex = 0) + + + End Sub + + Public Overridable Sub SaveData() + ' Save the data from the entire table. Calls each row's Save Data + ' to save their data. This function is called by the Click handler of the + ' Save button. The button handler should Start/Commit/End a transaction. + + Dim recCtl As PersonalLanguageSkillTableControlRow + For Each recCtl In Me.GetRecordControls() + + If Me.InDeletedRecordIds(recCtl) Then + ' Delete any pending deletes. + recCtl.Delete() + Else + If recCtl.Visible Then + recCtl.SaveData() + End If + End If + + Next + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + ' Set IsNewRecord to False for all records - since everything has been saved and is no longer "new" + For Each recCtl In Me.GetRecordControls() + recCtl.IsNewRecord = False + Next + + + ' Set DeletedRecordsIds to Nothing since we have deleted all pending deletes. + Me.DeletedRecordIds = Nothing + + End Sub + + Public Overridable Function CreateCompoundJoinFilter() As CompoundFilter + Dim jFilter As CompoundFilter = New CompoundFilter() + + Return jFilter + + End Function + + + Public Overridable Function CreateOrderBy() As OrderBy + ' The CurrentSortOrder is initialized to the sort order on the + ' Query Wizard. It may be modified by the Click handler for any of + ' the column heading to sort or reverse sort by that column. + ' You can add your own sort order, or modify it on the Query Wizard. + Return Me.CurrentSortOrder + End Function + + Public Overridable Function CreateWhereClause() As WhereClause + 'This CreateWhereClause is used for loading the data. + PersonalLanguageSkillTable.Instance.InnerFilter = Nothing + Dim wc As WhereClause = New WhereClause() + + ' Compose the WHERE clause consiting of: + ' 1. Static clause defined at design time. + ' 2. User selected search criteria. + ' 3. User selected filter criteria. + + + Dim selectedRecordKeyValue as KeyValue = New KeyValue() + + Dim personalIdRecordControlObj As Persons.UI.Controls.AddPersonalId.PersonalIdRecordControl = DirectCast(MiscUtils.FindControlRecursively(Me.Page, "PersonalIdRecordControl"), Persons.UI.Controls.AddPersonalId.PersonalIdRecordControl) + + If (Not IsNothing(personalIdRecordControlObj) AndAlso Not IsNothing(personalIdRecordControlObj.GetRecord()) AndAlso personalIdRecordControlObj.GetRecord().IsCreated AndAlso Not IsNothing(personalIdRecordControlObj.GetRecord().PersonalId)) + wc.iAND(PersonalLanguageSkillTable.PersonalId, BaseFilter.ComparisonOperator.EqualsTo, personalIdRecordControlObj.GetRecord().PersonalId.ToString()) + selectedRecordKeyValue.AddElement(PersonalLanguageSkillTable.PersonalId.InternalName, personalIdRecordControlObj.GetRecord().PersonalId.ToString()) + Else + wc.RunQuery = False + Return wc + End If + + HttpContext.Current.Session("PersonalLanguageSkillTableControlWhereClause") = selectedRecordKeyValue.ToXmlString() + + Return wc + End Function + + + Public Overridable Function CreateWhereClause(ByVal searchText as String, ByVal fromSearchControl as String, ByVal AutoTypeAheadSearch as String, ByVal AutoTypeAheadWordSeparators as String) As WhereClause + ' This CreateWhereClause is used for loading list of suggestions for Auto Type-Ahead feature. + PersonalLanguageSkillTable.Instance.InnerFilter = Nothing + Dim wc As WhereClause = New WhereClause() + + ' Compose the WHERE clause consiting of: + ' 1. Static clause defined at design time. + ' 2. User selected search criteria. + ' 3. User selected filter criteria. + + Dim appRelativeVirtualPath As String = CType(HttpContext.Current.Session("AppRelativeVirtualPath"), String) + + Dim selectedRecordInPersonalIdRecordControl as String = DirectCast(HttpContext.Current.Session("PersonalLanguageSkillTableControlWhereClause"), String) + + If Not selectedRecordInPersonalIdRecordControl Is Nothing AndAlso KeyValue.IsXmlKey(selectedRecordInPersonalIdRecordControl) Then + Dim selectedRecordKeyValue as KeyValue = KeyValue.XmlToKey(selectedRecordInPersonalIdRecordControl) + + If Not IsNothing(selectedRecordKeyValue) AndAlso selectedRecordKeyValue.ContainsColumn(PersonalLanguageSkillTable.PersonalId) Then + wc.iAND(PersonalLanguageSkillTable.PersonalId, BaseFilter.ComparisonOperator.EqualsTo, selectedRecordKeyValue.GetColumnValue(PersonalLanguageSkillTable.PersonalId).ToString()) + End If + + End If + + ' Adds clauses if values are selected in Filter controls which are configured in the page. + + + Return wc + End Function + + + Public Overridable Function FormatSuggestions(ByVal prefixText As String, ByVal resultItem As String, _ + ByVal columnLength As Integer, ByVal AutoTypeAheadDisplayFoundText As String, _ + ByVal autoTypeAheadSearch As String, ByVal AutoTypeAheadWordSeparators As String, _ + ByVal resultList As ArrayList) As Boolean + + 'Formats the resultItem and adds it to the list of suggestions. + Dim index As Integer = resultItem.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture).IndexOf(prefixText.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture)) + Dim itemToAdd As String = "" + Dim isFound As Boolean = False + Dim isAdded As Boolean = False + ' Get the index where prfixt is at the beginning of resultItem. If not found then, index of word which begins with prefixText. + If InvariantLCase(autoTypeAheadSearch).equals("wordsstartingwithsearchstring") And Not index = 0 Then + ' Expression to find word which contains AutoTypeAheadWordSeparators followed by prefixText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex( AutoTypeAheadWordSeparators + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + If regex1.IsMatch(resultItem) Then + index = regex1.Match(resultItem).Index + isFound = True + End If + ' If the prefixText is found immediatly after white space then starting of the word is found so don not search any further + If not resultItem(index).ToString() = " " Then + ' Expression to find beginning of the word which contains AutoTypeAheadWordSeparators followed by prefixText + Dim regex As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\\S*" + AutoTypeAheadWordSeparators + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + If regex.IsMatch(resultItem) Then + index = regex.Match(resultItem).Index + isFound = True + End If + End If + End If + + ' If autoTypeAheadSearch value is wordsstartingwithsearchstring then, extract the substring only if the prefixText is found at the + ' beginning of the resultItem (index = 0) or a word in resultItem is found starts with prefixText. + If index = 0 Or isFound Or InvariantLCase(autoTypeAheadSearch).Equals("anywhereinstring") then + If InvariantLCase(AutoTypeAheadDisplayFoundText).equals("atbeginningofmatchedstring") Then + ' Expression to find beginning of the word which contains prefixText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\\S*" + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + ' Find the beginning of the word which contains prefexText + If (StringUtils.InvariantLCase(autoTypeAheadSearch).Equals("anywhereinstring") AndAlso regex1.IsMatch(resultItem)) Then + index = regex1.Match(resultItem).Index + isFound = True + End If + ' Display string from the index till end of the string if sub string from index till end is less than columnLength value. + If Len(resultItem) - index <= columnLength Then + If index = 0 Then + itemToAdd = resultItem + Else + itemToAdd = "..." & resultItem.Substring(index, Len(resultItem) - index) + End If + Else + If index = 0 Then + itemToAdd = resultItem.Substring(index, (columnLength - 3)) & "..." + Else + 'Truncate the string to show only columnLength - 6 characters as begining and trailing "..." has to be appended. + itemToAdd = "..." & resultItem.Substring(index , columnLength - 6) & "..." + End If + End If + ElseIf InvariantLCase(AutoTypeAheadDisplayFoundText).equals("inmiddleofmatchedstring") Then + Dim subStringBeginIndex As Integer = CType(columnLength/2, Integer) + If Len(resultItem) <= columnLength Then + itemToAdd = resultItem + Else + ' Sanity check at end of the string + If index + Len(prefixText) = columnLength Then + itemToAdd = "..." & resultItem.Substring(index-columnLength,index) + ElseIf Len(resultItem) - index < subStringBeginIndex Then + ' Display string from the end till columnLength value if, index is closer to the end of the string. + itemToAdd = "..." & resultItem.Substring(Len(resultItem)-columnLength,Len(resultItem)) + ElseIf index <= subStringBeginIndex Then + ' Sanity chet at beginning of the string + itemToAdd = resultItem.Substring(0, columnLength) & "..." + Else + ' Display string containing text before the prefixText occures and text after the prefixText + itemToAdd = "..." & resultItem.Substring(index - subStringBeginIndex, columnLength) & "..." + End If + End If + ElseIf InvariantLCase(AutoTypeAheadDisplayFoundText).equals("atendofmatchedstring") Then + ' Expression to find ending of the word which contains prefexText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\s", System.Text.RegularExpressions.RegexOptions.IgnoreCase) + ' Find the ending of the word which contains prefexText + If regex1.IsMatch(resultItem, index + 1) Then + index = regex1.Match(resultItem, index + 1).Index + Else + ' If the word which contains prefexText is the last word in string, regex1.IsMatch returns false. + index = resultItem.Length + End If + If index > Len(resultItem) Then + index = Len(resultItem) + End If + ' If text from beginning of the string till index is less than columnLength value then, display string from the beginning till index. + If index <= columnLength Then + if index = Len(resultItem) Then 'Make decision to append "..." + itemToAdd = resultItem.Substring(0,index) + Else + itemToAdd = resultItem.Substring(0,index) & "..." + End If + Else + If index = Len(resultItem) Then + itemToAdd = "..." & resultItem.Substring(index - (columnLength - 3), (columnLength - 3)) + Else + 'Truncate the string to show only columnLength - 6 characters as begining and trailing "..." has to be appended. + itemToAdd = "..." & resultItem.Substring(index - (columnLength - 6), columnLength - 6) & "..." + End If + End If + End If + + ' Remove newline character from itemToAdd + Dim prefixTextIndex As Integer = itemToAdd.IndexOf(prefixText, StringComparison.CurrentCultureIgnoreCase) + ' If itemToAdd contains any newline after the search text then show text only till newline + Dim regex2 As System.Text.RegularExpressions.Regex = New System.Text.RegularExpressions.Regex("(" & vbCrLf & "|" & vbLf & ")", System.Text.RegularExpressions.RegexOptions.IgnoreCase) + Dim newLineIndexAfterPrefix As Integer = -1 + If regex2.IsMatch(itemToAdd, prefixTextIndex) Then + newLineIndexAfterPrefix = regex2.Match(itemToAdd, prefixTextIndex).Index + End If + If (newLineIndexAfterPrefix > -1) Then + If itemToAdd.EndsWith("...") Then + itemToAdd = (itemToAdd.Substring(0, newLineIndexAfterPrefix) + "...") + Else + itemToAdd = itemToAdd.Substring(0, newLineIndexAfterPrefix) + End If + End If + ' If itemToAdd contains any newline before search text then show text which comes after newline + Dim regex3 As System.Text.RegularExpressions.Regex = New System.Text.RegularExpressions.Regex("(" & vbCrLf & "|" & vbLf & ")", (System.Text.RegularExpressions.RegexOptions.IgnoreCase Or System.Text.RegularExpressions.RegexOptions.RightToLeft)) + Dim newLineIndexBeforePrefix As Integer = -1 + If regex3.IsMatch(itemToAdd, prefixTextIndex) Then + newLineIndexBeforePrefix = regex3.Match(itemToAdd, prefixTextIndex).Index + End If + If (newLineIndexBeforePrefix > -1) Then + If itemToAdd.StartsWith("...") Then + itemToAdd = ("..." + itemToAdd.Substring((newLineIndexBeforePrefix + regex3.Match(itemToAdd, prefixTextIndex).Length))) + Else + itemToAdd = itemToAdd.Substring((newLineIndexBeforePrefix + regex3.Match(itemToAdd, prefixTextIndex).Length)) + End If + End If + + If Not itemToAdd is nothing AndAlso Not resultList.Contains(itemToAdd) Then + + resultList.Add(itemToAdd) + + isAdded = true + End If + End If + Return isAdded + End Function + + + Protected Overridable Sub GetPageSize() + + If Me.PersonalLanguageSkillPagination.PageSize.Text.Trim <> "" Then + Try + 'Me.PageSize = Integer.Parse(Me.PersonalLanguageSkillPagination.PageSize.Text) + Catch ex As Exception + End Try + End If + End Sub + + Protected Overridable Sub AddNewRecords() + + Dim newRecordList As ArrayList = New ArrayList() + + Dim newUIDataList As System.Collections.Generic.List(Of Hashtable) = New System.Collections.Generic.List(Of Hashtable)() + + ' Loop though all the record controls and if the record control + ' does not have a unique record id set, then create a record + ' and add to the list. + If Not Me.ResetData Then + Dim rep As System.Web.UI.WebControls.Repeater = CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalLanguageSkillTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return + + Dim repItem As System.Web.UI.WebControls.RepeaterItem + For Each repItem In rep.Items + ' Loop through all rows in the table, set its DataSource and call DataBind(). + + Dim recControl As PersonalLanguageSkillTableControlRow = DirectCast(repItem.FindControl("PersonalLanguageSkillTableControlRow"), PersonalLanguageSkillTableControlRow) + + If recControl.Visible AndAlso recControl.IsNewRecord() Then + + Dim rec As PersonalLanguageSkillRecord = New PersonalLanguageSkillRecord() + + If MiscUtils.IsValueSelected(recControl.LanguageId) Then + rec.Parse(recControl.LanguageId.SelectedItem.Value, PersonalLanguageSkillTable.LanguageId) + End If + If recControl.Level.Text <> "" Then + rec.Parse(recControl.Level.Text, PersonalLanguageSkillTable.Level) + End If + newUIDataList.Add(recControl.PreservedUIData()) + newRecordList.Add(rec) + End If + Next + End If + + + ' Add any new record to the list. + Dim index As Integer = 0 + For index = 1 To Me.AddNewRecord + + newRecordList.Insert(0, New PersonalLanguageSkillRecord()) + newUIDataList.Insert(0, New Hashtable()) + + Next + Me.AddNewRecord = 0 + + ' Finally, add any new records to the DataSource. + If newRecordList.Count > 0 Then + + Dim finalList As ArrayList = New ArrayList(Me.DataSource) + finalList.InsertRange(0, newRecordList) + + Me.DataSource = DirectCast(finalList.ToArray(GetType(PersonalLanguageSkillRecord)), PersonalLanguageSkillRecord()) + + End If + + ' Add the existing UI data to this hash table + If newUIDataList.Count > 0 Then + Me.UIData.InsertRange(0, newUIDataList) + End If + + End Sub + + + Public Sub AddToDeletedRecordIds(ByVal rec As PersonalLanguageSkillTableControlRow) + If rec.IsNewRecord() Then + Return + End If + + If Not Me.DeletedRecordIds Is Nothing AndAlso Me.DeletedRecordIds.Trim <> "" Then + Me.DeletedRecordIds &= "," + End If + + Me.DeletedRecordIds &= "[" & rec.RecordUniqueId & "]" + End Sub + + Protected Overridable Function InDeletedRecordIds(ByVal rec As PersonalLanguageSkillTableControlRow) As Boolean + If Me.DeletedRecordIds Is Nothing OrElse Me.DeletedRecordIds.Trim = "" Then + Return False + End If + + Return Me.DeletedRecordIds.IndexOf("[" & rec.RecordUniqueId & "]") >= 0 + End Function + + Private _DeletedRecordIds As String + Public Property DeletedRecordIds() As String + Get + Return Me._DeletedRecordIds + End Get + Set(ByVal value As String) + Me._DeletedRecordIds = value + End Set + End Property + + + ' Create Set, WhereClause, and Populate Methods + + Public Overridable Sub SetLanguageIdLabel1() + + End Sub + + Public Overridable Sub SetLevelLabel1() + + End Sub + + Public Overridable Sub SetPersonalLanguageSkillTableControlCollapsibleRegion() + + 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. + Dim added As Boolean = Me.AddNewRecord > 0 + Me.LoadData() + Me.DataBind() + + If added Then + Me.SetFocusToAddedRow() + End If + + End If + + + + Catch ex As Exception + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + Finally + DbUtils.EndTransaction + End Try + End Sub + + 'this function sets focus to the first editable element in the new added row in the editable table + Protected Overridable Sub SetFocusToAddedRow() + Dim rep As System.Web.UI.WebControls.Repeater = CType(Me.FindControl("PersonalLanguageSkillTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing OrElse rep.Items.Count = 0 Then Return + Dim repItem As System.Web.UI.WebControls.RepeaterItem + For Each repItem In rep.Items + 'Load scripts to table rows + Me.Page.LoadFocusScripts(repItem) + Dim recControl As PersonalLanguageSkillTableControlRow = DirectCast(repItem.FindControl("PersonalLanguageSkillTableControlRow"), PersonalLanguageSkillTableControlRow) + If recControl.IsNewRecord Then + For Each field As Control In recControl.Controls + If field.Visible AndAlso Me.Page.IsControlEditable(field, False) Then + 'set focus on the first editable field in the new row + field.Focus() + Dim updPan As UpdatePanel = DirectCast(Me.Page.FindControlRecursively("UpdatePanel1"), UpdatePanel) + If Not updPan Is Nothing Then updPan.Update() + Return + End If + Next + Return + End If + Next + End Sub + + + Protected Overrides Sub SaveControlsToSession() + MyBase.SaveControlsToSession() + + ' Save filter controls to values to session. + + + 'Save pagination state to session. + + + + ' Save table control properties to the session. + If Not Me.CurrentSortOrder Is Nothing Then + Me.SaveToSession(Me, "Order_By", Me.CurrentSortOrder.ToXmlString()) + End If + + Me.SaveToSession(Me, "Page_Index", Me.PageIndex.ToString()) + Me.SaveToSession(Me, "Page_Size", Me.PageSize.ToString()) + + Me.SaveToSession(Me, "DeletedRecordIds", Me.DeletedRecordIds) + + End Sub + + Protected Sub SaveControlsToSession_Ajax() + ' Save filter controls to values to session. + + HttpContext.Current.Session("AppRelativeVirtualPath") = Me.Page.AppRelativeVirtualPath + + End Sub + + Protected Overrides Sub ClearControlsFromSession() + MyBase.ClearControlsFromSession() + + ' Clear filter controls values from the session. + + + ' Clear pagination state from session. + + + + ' Clear table properties from the session. + Me.RemoveFromSession(Me, "Order_By") + Me.RemoveFromSession(Me, "Page_Index") + Me.RemoveFromSession(Me, "Page_Size") + + Me.RemoveFromSession(Me, "DeletedRecordIds") + + End Sub + + Protected Overrides Sub LoadViewState(ByVal savedState As Object) + MyBase.LoadViewState(savedState) + + Dim orderByStr As String = CType(ViewState("PersonalLanguageSkillTableControl_OrderBy"), String) + + If orderByStr IsNot Nothing AndAlso orderByStr.Trim <> "" Then + Me.CurrentSortOrder = BaseClasses.Data.OrderBy.FromXmlString(orderByStr) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + End If + + Dim pageIndex As String = CType(ViewState("Page_Index"), String) + If pageIndex IsNot Nothing Then + Me.PageIndex = CInt(pageIndex) + End If + + Dim pageSize As String = CType(ViewState("Page_Size"), String) + If Not pageSize Is Nothing Then + Me.PageSize = CInt(pageSize) + End If + + + + ' Load view state for pagination control. + + Me.DeletedRecordIds = CType(Me.ViewState("DeletedRecordIds"), String) + + End Sub + + Protected Overrides Function SaveViewState() As Object + + If Me.CurrentSortOrder IsNot Nothing Then + Me.ViewState("PersonalLanguageSkillTableControl_OrderBy") = Me.CurrentSortOrder.ToXmlString() + End If + + Me.ViewState("Page_Index") = Me.PageIndex + Me.ViewState("Page_Size") = Me.PageSize + + Me.ViewState("DeletedRecordIds") = Me.DeletedRecordIds + + + ' Load view state for pagination control. + + + Return MyBase.SaveViewState() + End Function + + ' Generate the event handling functions for pagination events. + + ' event handler for ImageButton + Public Overridable Sub PersonalLanguageSkillPagination_FirstPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.PageIndex = 0 + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalLanguageSkillPagination_LastPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.DisplayLastPage = True + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalLanguageSkillPagination_NextPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.PageIndex += 1 + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for LinkButton + Public Overridable Sub PersonalLanguageSkillPagination_PageSizeButton_Click(ByVal sender As Object, ByVal args As EventArgs) + + Try + + Me.DataChanged = True + + Me.PageSize = Integer.Parse(Me.PersonalLanguageSkillPagination.PageSize.Text) + + Me.PageIndex = Integer.Parse(Me.PersonalLanguageSkillPagination.CurrentPage.Text) - 1 + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalLanguageSkillPagination_PreviousPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + If Me.PageIndex > 0 Then + Me.PageIndex -= 1 + Me.DataChanged = True + End If + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + + ' Generate the event handling functions for sorting events. + + Public Overridable Sub LanguageIdLabel1_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by LanguageId when clicked. + + ' Get previous sorting state for LanguageId. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalLanguageSkillTable.LanguageId) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for LanguageId. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalLanguageSkillTable.LanguageId, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by LanguageId, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub LevelLabel1_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by Level when clicked. + + ' Get previous sorting state for Level. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalLanguageSkillTable.Level) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for Level. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalLanguageSkillTable.Level, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by Level, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + + ' Generate the event handling functions for button events. + + ' event handler for ImageButton + Public Overridable Sub PersonalLanguageSkillAddButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + Me.AddNewRecord = 1 + Me.DataChanged = True + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalLanguageSkillDeleteButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + If(Not Me.Page.IsPageRefresh) Then + + Me.DeleteSelectedRecords(True) + Me.SetFormulaControls() + + + End If + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalLanguageSkillResetButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.CurrentSortOrder.Reset() + If Me.InSession(Me, "Order_By") Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + + End If + + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + + + ' Generate the event handling functions for filter and search events. + + + ' Generate the event handling functions for others + + + Private _UIData As New System.Collections.Generic.List(Of Hashtable) + Public Property UIData() As System.Collections.Generic.List(Of Hashtable) + Get + Return Me._UIData + End Get + Set(ByVal value As System.Collections.Generic.List(Of Hashtable)) + Me._UIData = value + End Set + End Property + + ' pagination properties + Protected _PageSize As Integer + Public Property PageSize() As Integer + Get + Return Me._PageSize + End Get + Set(ByVal value As Integer) + Me._PageSize = value + End Set + End Property + + Protected _PageIndex As Integer + Public Property PageIndex() As Integer + Get + ' Return the PageIndex + Return Me._PageIndex + End Get + Set(ByVal value As Integer) + Me._PageIndex = value + End Set + End Property + + Protected _TotalRecords As Integer = -1 + Public Property TotalRecords() As Integer + Get + If _TotalRecords < 0 + _TotalRecords = PersonalLanguageSkillTable.GetRecordCount(CreateCompoundJoinFilter(), CreateWhereClause()) + End If + Return Me._TotalRecords + End Get + Set(ByVal value As Integer) + If Me.PageSize > 0 Then + + Me.TotalPages = CInt(Math.Ceiling(value / Me.PageSize)) + + End If + Me._TotalRecords = value + End Set + End Property + + + + Protected _TotalPages As Integer = -1 + Public Property TotalPages() As Integer + Get + If _TotalPages < 0 Then + + Me.TotalPages = CInt(Math.Ceiling(TotalRecords / Me.PageSize)) + + End If + Return Me._TotalPages + End Get + Set(ByVal value As Integer) + Me._TotalPages = value + End Set + End Property + + Protected _DisplayLastPage As Boolean + Public Property DisplayLastPage() As Boolean + Get + Return Me._DisplayLastPage + End Get + Set(ByVal value As Boolean) + Me._DisplayLastPage = value + End Set + End Property + + Private _DataChanged As Boolean = False + Public Property DataChanged() As Boolean + Get + Return Me._DataChanged + End Get + Set(ByVal value As Boolean) + Me._DataChanged = value + End Set + End Property + + Private _ResetData As Boolean = False + Public Property ResetData() As Boolean + Get + Return Me._ResetData + End Get + Set(ByVal value As Boolean) + Me._ResetData = value + End Set + End Property + + Private _AddNewRecord As Integer = 0 + Public Property AddNewRecord() As Integer + Get + Return Me._AddNewRecord + End Get + Set(ByVal value As Integer) + Me._AddNewRecord = value + End Set + End Property + + + Private _CurrentSortOrder As OrderBy = Nothing + Public Property CurrentSortOrder() As OrderBy + Get + Return Me._CurrentSortOrder + End Get + Set(ByVal value As BaseClasses.Data.OrderBy) + Me._CurrentSortOrder = value + End Set + End Property + + Private _DataSource() As PersonalLanguageSkillRecord = Nothing + Public Property DataSource() As PersonalLanguageSkillRecord () + Get + Return Me._DataSource + End Get + Set(ByVal value() As PersonalLanguageSkillRecord) + Me._DataSource = value + End Set + End Property + +#Region "Helper Properties" + + Public ReadOnly Property LanguageIdLabel1() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "LanguageIdLabel1"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property LevelLabel1() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "LevelLabel1"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property PersonalLanguageSkillAddButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalLanguageSkillAddButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalLanguageSkillDeleteButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalLanguageSkillDeleteButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalLanguageSkillPagination() As Persons.UI.IPagination + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalLanguageSkillPagination"), Persons.UI.IPagination) + End Get + End Property + + Public ReadOnly Property PersonalLanguageSkillResetButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalLanguageSkillResetButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalLanguageSkillTableControlCollapsibleRegion() As System.Web.UI.WebControls.Panel + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalLanguageSkillTableControlCollapsibleRegion"), System.Web.UI.WebControls.Panel) + End Get + End Property + + Public ReadOnly Property PersonalLanguageSkillToggleAll() As System.Web.UI.WebControls.CheckBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalLanguageSkillToggleAll"), System.Web.UI.WebControls.CheckBox) + End Get + End Property + +#End Region + +#Region "Helper Functions" + + Public Overrides Overloads Function ModifyRedirectUrl(url As String, arg As String, ByVal bEncrypt As Boolean) As String + Return Me.Page.EvaluateExpressions(url, arg, bEncrypt, Me) + End Function + + Public Overrides Overloads Function EvaluateExpressions(url As String, arg As String, ByVal bEncrypt As Boolean) As String + Dim needToProcess As Boolean = AreAnyUrlParametersForMe(url, arg) + If (needToProcess) Then + Dim recCtl As PersonalLanguageSkillTableControlRow = Me.GetSelectedRecordControl() + If recCtl Is Nothing AndAlso url.IndexOf("{") >= 0 Then + ' Localization. + Throw New Exception(Page.GetResourceValue("Err:NoRecSelected", "Persons")) + End If + Dim rec As PersonalLanguageSkillRecord = Nothing + If recCtl IsNot Nothing Then + rec = recCtl.GetRecord() + End If + Return EvaluateExpressions(url, arg, rec, bEncrypt) + End If + Return url + End Function + + Public Overridable Function GetSelectedRecordIndex() As Integer + Dim counter As Integer = 0 + Dim recControl As PersonalLanguageSkillTableControlRow + For Each recControl In Me.GetRecordControls() + If recControl.PersonalLanguageSkillRecordRowSelection.Checked Then + Return counter + End If + counter += 1 + Next + Return -1 + End Function + + Public Overridable Function GetSelectedRecordControl() As PersonalLanguageSkillTableControlRow + Dim selectedList() As PersonalLanguageSkillTableControlRow = Me.GetSelectedRecordControls() + If selectedList.Length = 0 Then + Return Nothing + End If + Return selectedList(0) + + End Function + + Public Overridable Function GetSelectedRecordControls() As PersonalLanguageSkillTableControlRow() + + Dim selectedList As ArrayList = New ArrayList(25) + Dim recControl As PersonalLanguageSkillTableControlRow + For Each recControl In Me.GetRecordControls() + If recControl.PersonalLanguageSkillRecordRowSelection IsNot Nothing AndAlso recControl.PersonalLanguageSkillRecordRowSelection.Checked Then + selectedList.Add(recControl) + End If + Next + Return DirectCast(selectedList.ToArray(GetType(PersonalLanguageSkillTableControlRow)), PersonalLanguageSkillTableControlRow()) + + End Function + + Public Overridable Sub DeleteSelectedRecords(ByVal deferDeletion As Boolean) + Dim recList() As PersonalLanguageSkillTableControlRow = Me.GetSelectedRecordControls() + If recList.Length = 0 Then + ' Localization. + Throw New Exception(Page.GetResourceValue("Err:NoRecSelected", "Persons")) + End If + + Dim recCtl As PersonalLanguageSkillTableControlRow + For Each recCtl In recList + If deferDeletion Then + If Not recCtl.IsNewRecord Then + + Me.AddToDeletedRecordIds(recCtl) + + End If + recCtl.Visible = False + + recCtl.PersonalLanguageSkillRecordRowSelection.Checked = False + + Else + + recCtl.Delete() + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + End If + Next + End Sub + + Public Function GetRecordControls() As PersonalLanguageSkillTableControlRow() + Dim recList As ArrayList = New ArrayList() + Dim rep As System.Web.UI.WebControls.Repeater = CType(Me.FindControl("PersonalLanguageSkillTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return Nothing + Dim repItem As System.Web.UI.WebControls.RepeaterItem + + For Each repItem In rep.Items + + Dim recControl As PersonalLanguageSkillTableControlRow = DirectCast(repItem.FindControl("PersonalLanguageSkillTableControlRow"), PersonalLanguageSkillTableControlRow) + recList.Add(recControl) + + Next + + Return DirectCast(recList.ToArray(GetType(PersonalLanguageSkillTableControlRow)), PersonalLanguageSkillTableControlRow()) + End Function + + Public Shadows ReadOnly Property Page() As BaseApplicationPage + Get + Return DirectCast(MyBase.Page, BaseApplicationPage) + End Get + End Property + +#End Region + + + +End Class + + +' Base class for the PersonalNameTableControlRow control on the AddPersonalId page. +' Do not modify this class. Instead override any method in PersonalNameTableControlRow. +Public Class BasePersonalNameTableControlRow + Inherits Persons.UI.BaseApplicationRecordControl + + ' To customize, override this method in PersonalNameTableControlRow. + Protected Overridable Sub Control_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Init + + Me.ClearControlsFromSession() + End Sub + + ' To customize, override this method in PersonalNameTableControlRow. + Protected Overridable Sub Control_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load + + 'Call LoadFocusScripts from repeater so that onfocus attribute could be added to elements + Me.Page.LoadFocusScripts(Me) + + ' Show confirmation message on Click + Me.PersonalNameRowDeleteButton.Attributes.Add("onClick", "return (confirm('" & (CType(Me.Page,BaseApplicationPage)).GetResourceValue("DeleteRecordConfirm", "Persons") & "'));") + + + ' Register the event handlers. + + AddHandler Me.PersonalNameRowDeleteButton.Click, AddressOf PersonalNameRowDeleteButton_Click + + AddHandler Me.NameDate.TextChanged, AddressOf NameDate_TextChanged + + AddHandler Me.PersonalLastName1.TextChanged, AddressOf PersonalLastName1_TextChanged + + AddHandler Me.PersonalName1.TextChanged, AddressOf PersonalName1_TextChanged + + AddHandler Me.Ref2.TextChanged, AddressOf Ref2_TextChanged + + + End Sub + + + Public Overridable Sub LoadData() + + ' Load the data from the database into the DataSource PersonalName 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 = PersonalNameTable.GetRecord(Me.RecordUniqueId, True) + + Return + End If + + ' Since this is a row in the table, the data for this row is loaded by the + ' LoadData method of the BasePersonalNameTableControl when the data for the entire + ' table is loaded. + + Me.DataSource = New PersonalNameRecord() + + + + End Sub + + ' Populate the UI controls using the DataSource. To customize, override this method in PersonalNameTableControlRow. + 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 + + SetNameDate() + SetPersonalLastName1() + SetPersonalName1() + + + SetRef2() + + + 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 SetNameDate() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.NameDate.ID) Then + + Me.NameDate.Text = Me.PreviousUIData(Me.NameDate.ID).ToString() + + Return + End If + + + ' Set the NameDate TextBox on the webpage with value from the + ' PersonalName database record. + + ' Me.DataSource is the PersonalName record retrieved from the database. + ' Me.NameDate is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetNameDate() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.NameDateSpecified Then + + ' If the NameDate is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalNameTable.NameDate, "d MMM yy") + + Me.NameDate.Text = formattedValue + + Else + + ' NameDate is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.NameDate.Text = PersonalNameTable.NameDate.Format(PersonalNameTable.NameDate.DefaultValue, "d MMM yy") + + End If + + End Sub + + Public Overridable Sub SetPersonalLastName1() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.PersonalLastName1.ID) Then + + Me.PersonalLastName1.Text = Me.PreviousUIData(Me.PersonalLastName1.ID).ToString() + + Return + End If + + + ' Set the PersonalLastName TextBox on the webpage with value from the + ' PersonalName database record. + + ' Me.DataSource is the PersonalName record retrieved from the database. + ' Me.PersonalLastName1 is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetPersonalLastName1() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.PersonalLastNameSpecified Then + + ' If the PersonalLastName is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalNameTable.PersonalLastName) + + Me.PersonalLastName1.Text = formattedValue + + Else + + ' PersonalLastName is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.PersonalLastName1.Text = PersonalNameTable.PersonalLastName.Format(PersonalNameTable.PersonalLastName.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetPersonalName1() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.PersonalName1.ID) Then + + Me.PersonalName1.Text = Me.PreviousUIData(Me.PersonalName1.ID).ToString() + + Return + End If + + + ' Set the PersonalName TextBox on the webpage with value from the + ' PersonalName database record. + + ' Me.DataSource is the PersonalName record retrieved from the database. + ' Me.PersonalName1 is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetPersonalName1() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.PersonalNameSpecified Then + + ' If the PersonalName is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalNameTable.PersonalName) + + Me.PersonalName1.Text = formattedValue + + Else + + ' PersonalName is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.PersonalName1.Text = PersonalNameTable.PersonalName.Format(PersonalNameTable.PersonalName.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetRef2() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.Ref2.ID) Then + + Me.Ref2.Text = Me.PreviousUIData(Me.Ref2.ID).ToString() + + Return + End If + + + ' Set the Ref TextBox on the webpage with value from the + ' PersonalName database record. + + ' Me.DataSource is the PersonalName record retrieved from the database. + ' Me.Ref2 is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetRef2() + ' 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(PersonalNameTable.Ref0) + + Me.Ref2.Text = formattedValue + + Else + + ' Ref is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.Ref2.Text = PersonalNameTable.Ref0.Format(PersonalNameTable.Ref0.DefaultValue) + + End If + + End Sub + + + Public EvaluateFormulaDelegate As BaseClasses.Data.DataSource.EvaluateFormulaDelegate = New BaseClasses.Data.DataSource.EvaluateFormulaDelegate(AddressOf Me.EvaluateFormula) + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean, ByVal e As FormulaEvaluator) As String + If e Is Nothing Then + e = New FormulaEvaluator() + End If + + e.Variables.Clear() + + + ' add variables for formula evaluation + If variables IsNot Nothing Then + Dim enumerator As System.Collections.Generic.IEnumerator(Of System.Collections.Generic.KeyValuePair(Of String, Object)) = variables.GetEnumerator() + While enumerator.MoveNext() + e.Variables.Add(enumerator.Current.Key, enumerator.Current.Value) + End While + End If + + If includeDS + + End IF + + + ' Other variables referred to in the formula are expected to be + ' properties of the DataSource. For example, referring to + ' UnitPrice as a variable will refer to DataSource.UnitPrice + If dataSourceForEvaluate Is Nothing Then + + e.DataSource = Me.DataSource + + Else + e.DataSource = dataSourceForEvaluate + End If + + ' Define the calling control. This is used to add other + ' related table and record controls as variables. + e.CallingControl = Me + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + + If Not String.IsNullOrEmpty(format) AndAlso (String.IsNullOrEmpty(formula) OrElse formula.IndexOf("Format(") < 0) Then + Return FormulaUtils.Format(resultObj, format) + Else + Return resultObj.ToString() + End If + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format,variables ,includeDS, Nothing) + End Function + + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object)) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format, variables ,True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, format, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal e as FormulaEvaluator) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, variables, True, e) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal includeDS as Boolean) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, includeDS, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, True, Nothing) + End Function + + + Public Overridable Sub RegisterPostback() + + + End Sub + + + + ' To customize, override this method in PersonalNameTableControlRow. + 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 parentCtrl As PersonalIdRecordControl + + + parentCtrl = DirectCast(Me.Page.FindControlRecursively("PersonalIdRecordControl"), PersonalIdRecordControl) + + If (Not IsNothing(parentCtrl) AndAlso IsNothing(parentCtrl.DataSource)) + ' Load the record if it is not loaded yet. + parentCtrl.LoadData() + End If + If (IsNothing(parentCtrl) OrElse IsNothing(parentCtrl.DataSource)) + ' Get the error message from the application resource file. + Throw New Exception(Page.GetResourceValue("Err:NoParentRecId", "Persons")) + End If + + Me.DataSource.PersonalId = parentCtrl.DataSource.PersonalId + + ' 2. Perform any custom validation. + Me.Validate() + + + ' 3. Set the values in the record with data from UI controls. + ' This calls the Get() method for each of the user interface controls. + Me.GetUIData() + + ' 4. Save in the database. + ' We should not save the record if the data did not change. This + ' will save a database hit and avoid triggering any database triggers. + + If Me.DataSource.IsAnyValueChanged Then + ' Save record to database but do not commit yet. + ' Auto generated ids are available after saving for use by child (dependent) records. + Me.DataSource.Save() + + DirectCast(GetParentControlObject(Me, "PersonalNameTableControl"), PersonalNameTableControl).DataChanged = True + DirectCast(GetParentControlObject(Me, "PersonalNameTableControl"), PersonalNameTableControl).ResetData = True + End If + + + ' update session or cookie by formula + + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + ' For Master-Detail relationships, save data on the Detail table(s) + + End Sub + + ' To customize, override this method in PersonalNameTableControlRow. + 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. + + GetNameDate() + GetPersonalLastName1() + GetPersonalName1() + GetRef2() + End Sub + + + Public Overridable Sub GetNameDate() + + ' Retrieve the value entered by the user on the NameDate ASP:TextBox, and + ' save it into the NameDate field in DataSource PersonalName 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.NameDate.Text, PersonalNameTable.NameDate) + + + End Sub + + Public Overridable Sub GetPersonalLastName1() + + ' Retrieve the value entered by the user on the PersonalLastName ASP:TextBox, and + ' save it into the PersonalLastName field in DataSource PersonalName record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.PersonalLastName1.Text, PersonalNameTable.PersonalLastName) + + + End Sub + + Public Overridable Sub GetPersonalName1() + + ' Retrieve the value entered by the user on the PersonalName ASP:TextBox, and + ' save it into the PersonalName field in DataSource PersonalName record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.PersonalName1.Text, PersonalNameTable.PersonalName) + + + End Sub + + Public Overridable Sub GetRef2() + + ' Retrieve the value entered by the user on the Ref ASP:TextBox, and + ' save it into the Ref field in DataSource PersonalName record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.Ref2.Text, PersonalNameTable.Ref0) + + + End Sub + + + ' To customize, override this method in PersonalNameTableControlRow. + + Public Overridable Function CreateWhereClause() As WhereClause + + Return Nothing + + End Function + + + + ' To customize, override this method in PersonalNameTableControlRow. + 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) + PersonalNameTable.DeleteRecord(pkValue) + + DirectCast(GetParentControlObject(Me, "PersonalNameTableControl"), PersonalNameTableControl).DataChanged = True + DirectCast(GetParentControlObject(Me, "PersonalNameTableControl"), PersonalNameTableControl).ResetData = True + End Sub + + Protected Overridable Sub Control_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.PreRender + ' PreRender event is raised just before page is being displayed. + Try + DbUtils.StartTransaction() + Me.RegisterPostback() + + If Not Me.Page.ErrorOnPage AndAlso (Me.Page.IsPageRefresh OrElse Me.DataChanged OrElse Me.ResetData) Then + + + ' Re-load the data and update the web page if necessary. + ' This is typically done during a postback (filter, search button, sort, pagination button). + ' In each of the other click handlers, simply set DataChanged to True to reload the data. + Me.LoadData() + Me.DataBind() + End If + + + Catch ex As Exception + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + Finally + DbUtils.EndTransaction() + End Try + End Sub + + + Protected Overrides Sub SaveControlsToSession() + MyBase.SaveControlsToSession() + + + 'Save pagination state to session. + + End Sub + + + + Protected Overrides Sub ClearControlsFromSession() + MyBase.ClearControlsFromSession() + + + + ' Clear pagination state from session. + + End Sub + + Protected Overrides Sub LoadViewState(ByVal savedState As Object) + MyBase.LoadViewState(savedState) + Dim isNewRecord As String = CType(ViewState("IsNewRecord"), String) + If Not isNewRecord Is Nothing AndAlso isNewRecord.Trim <> "" Then + Me.IsNewRecord = Boolean.Parse(isNewRecord) + End If + + Dim myCheckSum As String = CType(ViewState("CheckSum"), String) + If Not myCheckSum Is Nothing AndAlso myCheckSum.Trim <> "" Then + Me.CheckSum = myCheckSum + End If + + + ' Load view state for pagination control. + + End Sub + + Protected Overrides Function SaveViewState() As Object + ViewState("IsNewRecord") = Me.IsNewRecord.ToString() + ViewState("CheckSum") = Me.CheckSum + + + ' Load view state for pagination control. + + Return MyBase.SaveViewState() + End Function + + + ' event handler for ImageButton + Public Overridable Sub PersonalNameRowDeleteButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + If(Not Me.Page.IsPageRefresh) Then + + Dim tc As PersonalNameTableControl = DirectCast(GetParentControlObject(Me, "PersonalNameTableControl"), PersonalNameTableControl) + If Not (IsNothing(tc)) Then + If Not Me.IsNewRecord Then + tc.AddToDeletedRecordIds(DirectCast(Me, PersonalNameTableControlRow)) + End If + Me.Visible = False + tc.SetFormulaControls() + End If + + End If + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + Protected Overridable Sub NameDate_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub PersonalLastName1_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub PersonalName1_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub Ref2_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("BasePersonalNameTableControlRow_Rec"), String) + End Get + Set(ByVal value As String) + Me.ViewState("BasePersonalNameTableControlRow_Rec") = value + End Set + End Property + + Private _DataSource As PersonalNameRecord + Public Property DataSource() As PersonalNameRecord + Get + Return Me._DataSource + End Get + + Set(ByVal value As PersonalNameRecord) + + Me._DataSource = value + End Set + End Property + + + + Private _checkSum As String + Public Overridable Property CheckSum() As String + Get + Return Me._checkSum + End Get + Set(ByVal value As String) + Me._checkSum = value + End Set + End Property + + Private _TotalPages As Integer + Public Property TotalPages() As Integer + Get + Return Me._TotalPages + End Get + Set(ByVal value As Integer) + Me._TotalPages = value + End Set + End Property + + Private _PageIndex As Integer + Public Property PageIndex() As Integer + Get + ' Return the PageIndex + Return Me._PageIndex + End Get + Set(ByVal value As Integer) + Me._PageIndex = value + End Set + End Property + + Private _DisplayLastPage As Boolean + Public Property DisplayLastPage() As Boolean + Get + Return Me._DisplayLastPage + End Get + Set(ByVal value As Boolean) + Me._DisplayLastPage = value + End Set + End Property + + + +#Region "Helper Properties" + + Public ReadOnly Property NameDate() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "NameDate"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property PersonalLastName1() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalLastName1"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property PersonalName1() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalName1"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property PersonalNameRecordRowSelection() As System.Web.UI.WebControls.CheckBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalNameRecordRowSelection"), System.Web.UI.WebControls.CheckBox) + End Get + End Property + + Public ReadOnly Property PersonalNameRowDeleteButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalNameRowDeleteButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property Ref2() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Ref2"), System.Web.UI.WebControls.TextBox) + 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 PersonalNameRecord = 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 PersonalNameRecord + If Not Me.DataSource Is Nothing Then + Return Me.DataSource + End If + + If Not Me.RecordUniqueId Is Nothing Then + + Return PersonalNameTable.GetRecord(Me.RecordUniqueId, True) + + End If + + ' Localization. + + Return Nothing + + End Function + + Public Shadows ReadOnly Property Page() As BaseApplicationPage + Get + Return DirectCast(MyBase.Page, BaseApplicationPage) + End Get + End Property + +#End Region + +End Class + + + +' Base class for the PersonalNameTableControl control on the AddPersonalId page. +' Do not modify this class. Instead override any method in PersonalNameTableControl. +Public Class BasePersonalNameTableControl + Inherits Persons.UI.BaseApplicationTableControl + + + + Protected Overridable Sub Control_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Init + + + + ' Setup the filter and search events. + + + + ' Control Initializations. + ' Initialize the table's current sort order. + + If Me.InSession(Me, "Order_By") Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + End If + + + + ' Setup default pagination settings. + + Me.PageSize = CInt(Me.GetFromSession(Me, "Page_Size", "10")) + Me.PageIndex = CInt(Me.GetFromSession(Me, "Page_Index", "0")) + + + + Me.ClearControlsFromSession() + End Sub + + Protected Overridable Sub Control_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load + + SaveControlsToSession_Ajax() + + ' Show confirmation message on Click + Me.PersonalNameDeleteButton.Attributes.Add("onClick", "return (confirm('" & (CType(Me.Page,BaseApplicationPage)).GetResourceValue("DeleteConfirm", "Persons") & "'));") + + ' Setup the pagination events. + + AddHandler Me.PersonalNamePagination.FirstPage.Click, AddressOf PersonalNamePagination_FirstPage_Click + + AddHandler Me.PersonalNamePagination.LastPage.Click, AddressOf PersonalNamePagination_LastPage_Click + + AddHandler Me.PersonalNamePagination.NextPage.Click, AddressOf PersonalNamePagination_NextPage_Click + + AddHandler Me.PersonalNamePagination.PageSizeButton.Click, AddressOf PersonalNamePagination_PageSizeButton_Click + + AddHandler Me.PersonalNamePagination.PreviousPage.Click, AddressOf PersonalNamePagination_PreviousPage_Click + + + ' Setup the sorting events. + + AddHandler Me.NameDateLabel.Click, AddressOf NameDateLabel_Click + + AddHandler Me.PersonalLastNameLabel2.Click, AddressOf PersonalLastNameLabel2_Click + + AddHandler Me.PersonalNameLabel2.Click, AddressOf PersonalNameLabel2_Click + + AddHandler Me.RefLabel1.Click, AddressOf RefLabel1_Click + + ' Setup the button events. + + AddHandler Me.PersonalNameAddButton.Click, AddressOf PersonalNameAddButton_Click + + AddHandler Me.PersonalNameDeleteButton.Click, AddressOf PersonalNameDeleteButton_Click + + AddHandler Me.PersonalNameResetButton.Click, AddressOf PersonalNameResetButton_Click + + + ' Setup events for others + + End Sub + + + Public Overridable Sub LoadData() + + ' Read data from database. Returns an array of records that can be assigned + ' to the DataSource table control property. + Try + Dim joinFilter As CompoundFilter = CreateCompoundJoinFilter() + + ' The WHERE clause will be empty when displaying all records in table. + Dim wc As WhereClause = CreateWhereClause() + If wc IsNot Nothing AndAlso Not wc.RunQuery Then + ' Initialize an empty array of records + Dim alist As New ArrayList(0) + Me.DataSource = DirectCast(alist.ToArray(GetType(PersonalNameRecord)), PersonalNameRecord()) + ' Add records to the list if needed. + Me.AddNewRecords() + Me._TotalRecords = 0 + Me._TotalPages = 0 + Return + End If + + ' Call OrderBy to determine the order - either use the order defined + ' on the Query Wizard, or specified by user (by clicking on column heading) + Dim orderBy As OrderBy = CreateOrderBy() + + ' Get the pagesize from the pagesize control. + Me.GetPageSize() + + If Me.DisplayLastPage Then + Dim totalRecords As Integer = If(Me._TotalRecords < 0, PersonalNameTable.GetRecordCount(CreateCompoundJoinFilter(), CreateWhereClause()), Me._TotalRecords) + + Dim totalPages As Integer = CInt(Math.Ceiling(totalRecords / Me.PageSize)) + + Me.PageIndex = totalPages - 1 + End If + + ' Make sure PageIndex (current page) and PageSize are within bounds. + If Me.PageIndex < 0 Then + Me.PageIndex = 0 + End If + If Me.PageSize < 1 Then + Me.PageSize = 1 + End If + + ' Retrieve the records and set the table DataSource. + ' Only PageSize records are fetched starting at PageIndex (zero based). + If Me.AddNewRecord > 0 Then + ' Make sure to preserve the previously entered data on new rows. + Dim postdata As New ArrayList + For Each rc As PersonalNameTableControlRow In Me.GetRecordControls() + If Not rc.IsNewRecord Then + rc.DataSource = rc.GetRecord() + rc.GetUIData() + postdata.Add(rc.DataSource) + UIData.Add(rc.PreservedUIData()) + End If + Next + Me.DataSource = DirectCast(postdata.ToArray(GetType(PersonalNameRecord)), PersonalNameRecord()) + Else ' Get the records from the database + Me.DataSource = PersonalNameTable.GetRecords(joinFilter, wc, orderBy, Me.PageIndex, Me.PageSize) + + End If + + ' if the datasource contains no records contained in database, then load the last page. + If (DbUtils.GetCreatedRecords(Me.DataSource).Length = 0 AndAlso Not Me.DisplayLastPage) Then + Me.DisplayLastPage = True + LoadData() + Else + + ' Add any new rows desired by the user. + Me.AddNewRecords() + + ' Turn off the ToggleAll checkbox + Me.PersonalNameToggleAll.Checked = False + + + ' Initialize the page and grand totals. now + + End If + + Catch ex As Exception + ' Report the error message to the end user + Dim msg As String = ex.Message + If ex.InnerException IsNot Nothing Then + msg = msg & " InnerException: " & ex.InnerException.Message + End If + Throw New Exception(msg, ex.InnerException) + End Try + End Sub + + + + + Public Overrides Sub DataBind() + ' The DataBind method binds the user interface controls to the values + ' from the database record for each row in the table. To do this, it calls the + ' DataBind for each of the rows. + ' DataBind also populates any filters above the table, and sets the pagination + ' control to the correct number of records and the current page number. + + MyBase.DataBind() + + ' Make sure that the DataSource is initialized. + If Me.DataSource Is Nothing Then + Return + End If + + 'LoadData for DataSource for chart and report if they exist + + ' Setup the pagination controls. + BindPaginationControls() + + + + ' Bind the repeater with the list of records to expand the UI. + Dim rep As System.Web.UI.WebControls.Repeater = CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalNameTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return + rep.DataSource = DataSource() + rep.DataBind() + + Dim index As Integer = 0 + For Each repItem As System.Web.UI.WebControls.RepeaterItem In rep.Items + ' Loop through all rows in the table, set its DataSource and call DataBind(). + Dim recControl As PersonalNameTableControlRow = DirectCast(repItem.FindControl("PersonalNameTableControlRow"), PersonalNameTableControlRow) + recControl.DataSource = Me.DataSource(index) + If Me.UIData.Count > index Then + recControl.PreviousUIData = Me.UIData(index) + End If + recControl.DataBind() + recControl.Visible = Not Me.InDeletedRecordIds(recControl) + + index += 1 + Next + + + + + ' Call the Set methods for each controls on the panel + + SetNameDateLabel() + SetPersonalLastNameLabel2() + + + SetPersonalNameLabel2() + + + SetPersonalNameTableControlCollapsibleRegion() + + SetRefLabel1() + ' setting the state of expand or collapse alternative rows + + + ' Load data for each record and table UI control. + ' Ordering is important because child controls get + ' their parent ids from their parent UI controls. + + + ' this method calls the set method for controls with special formula like running total, sum, rank, etc + SetFormulaControls() + End Sub + + Public Overridable Sub SetFormulaControls() + ' this method calls Set methods for the control that has special formula + + + + End Sub + + + + Public Overridable Sub RegisterPostback() + + + End Sub + + Public EvaluateFormulaDelegate As BaseClasses.Data.DataSource.EvaluateFormulaDelegate = New BaseClasses.Data.DataSource.EvaluateFormulaDelegate(AddressOf Me.EvaluateFormula) + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean, ByVal e as FormulaEvaluator) As String + If e Is Nothing + e = New FormulaEvaluator() + End If + + e.Variables.Clear() + + + ' add variables for formula evaluation + If variables IsNot Nothing Then + Dim enumerator As System.Collections.Generic.IEnumerator(Of System.Collections.Generic.KeyValuePair(Of String, Object)) = variables.GetEnumerator() + While enumerator.MoveNext() + e.Variables.Add(enumerator.Current.Key, enumerator.Current.Value) + End While + End If + + If includeDS + + End If + + ' All variables referred to in the formula are expected to be + ' properties of the DataSource. For example, referring to + ' UnitPrice as a variable will refer to DataSource.UnitPrice + e.DataSource = dataSourceForEvaluate + + ' Define the calling control. This is used to add other + ' related table and record controls as variables. + e.CallingControl = Me + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + + If Not String.IsNullOrEmpty(format) AndAlso (String.IsNullOrEmpty(formula) OrElse formula.IndexOf("Format(") < 0) Then + Return FormulaUtils.Format(resultObj, format) + Else + Return resultObj.ToString() + End If + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format,variables ,includeDS, Nothing) + End Function + + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object)) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format, variables ,True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, format, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal e as FormulaEvaluator) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, variables, True, e) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal includeDS as Boolean) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, includeDS, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, True, Nothing) + End Function + + + + + Public Overridable Sub ResetControl() + + Me.CurrentSortOrder.Reset() + If (Me.InSession(Me, "Order_By")) Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + End If + + Me.PageIndex = 0 + End Sub + + Protected Overridable Sub BindPaginationControls() + ' Setup the pagination controls. + + ' Bind the pagination labels. + + If DbUtils.GetCreatedRecords(Me.DataSource).Length > 0 Then + + Me.PersonalNamePagination.CurrentPage.Text = (Me.PageIndex + 1).ToString() + Else + Me.PersonalNamePagination.CurrentPage.Text = "0" + End If + Me.PersonalNamePagination.PageSize.Text = Me.PageSize.ToString() + Me.PersonalNamePagination.TotalItems.Text = Me.TotalRecords.ToString() + Me.PersonalNamePagination.TotalPages.Text = Me.TotalPages.ToString() + + ' Bind the buttons for PersonalNameTableControl pagination. + + Me.PersonalNamePagination.FirstPage.Enabled = Not (Me.PageIndex = 0) + If Me._TotalPages < 0 Then ' if the total pages is not determined yet, enable last and next buttons + Me.PersonalNamePagination.LastPage.Enabled = True + ElseIf Me._TotalPages = 0 ' if the total pages is determined and it is 0, enable last and next buttons + Me.PersonalNamePagination.LastPage.Enabled = False + Else ' if the total pages is the last page, disable last and next buttons + Me.PersonalNamePagination.LastPage.Enabled = Not (Me.PageIndex = Me.TotalPages - 1) + End If + + If Me._TotalPages < 0 Then ' if the total pages is not determined yet, enable last and next buttons + Me.PersonalNamePagination.NextPage.Enabled = True + ElseIf Me._TotalPages = 0 ' if the total pages is determined and it is 0, enable last and next buttons + Me.PersonalNamePagination.NextPage.Enabled = False + Else ' if the total pages is the last page, disable last and next buttons + Me.PersonalNamePagination.NextPage.Enabled = Not (Me.PageIndex = Me.TotalPages - 1) + End If + + Me.PersonalNamePagination.PreviousPage.Enabled = Not (Me.PageIndex = 0) + + + End Sub + + Public Overridable Sub SaveData() + ' Save the data from the entire table. Calls each row's Save Data + ' to save their data. This function is called by the Click handler of the + ' Save button. The button handler should Start/Commit/End a transaction. + + Dim recCtl As PersonalNameTableControlRow + For Each recCtl In Me.GetRecordControls() + + If Me.InDeletedRecordIds(recCtl) Then + ' Delete any pending deletes. + recCtl.Delete() + Else + If recCtl.Visible Then + recCtl.SaveData() + End If + End If + + Next + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + ' Set IsNewRecord to False for all records - since everything has been saved and is no longer "new" + For Each recCtl In Me.GetRecordControls() + recCtl.IsNewRecord = False + Next + + + ' Set DeletedRecordsIds to Nothing since we have deleted all pending deletes. + Me.DeletedRecordIds = Nothing + + End Sub + + Public Overridable Function CreateCompoundJoinFilter() As CompoundFilter + Dim jFilter As CompoundFilter = New CompoundFilter() + + Return jFilter + + End Function + + + Public Overridable Function CreateOrderBy() As OrderBy + ' The CurrentSortOrder is initialized to the sort order on the + ' Query Wizard. It may be modified by the Click handler for any of + ' the column heading to sort or reverse sort by that column. + ' You can add your own sort order, or modify it on the Query Wizard. + Return Me.CurrentSortOrder + End Function + + Public Overridable Function CreateWhereClause() As WhereClause + 'This CreateWhereClause is used for loading the data. + PersonalNameTable.Instance.InnerFilter = Nothing + Dim wc As WhereClause = New WhereClause() + + ' Compose the WHERE clause consiting of: + ' 1. Static clause defined at design time. + ' 2. User selected search criteria. + ' 3. User selected filter criteria. + + + Dim selectedRecordKeyValue as KeyValue = New KeyValue() + + Dim personalIdRecordControlObj As Persons.UI.Controls.AddPersonalId.PersonalIdRecordControl = DirectCast(MiscUtils.FindControlRecursively(Me.Page, "PersonalIdRecordControl"), Persons.UI.Controls.AddPersonalId.PersonalIdRecordControl) + + If (Not IsNothing(personalIdRecordControlObj) AndAlso Not IsNothing(personalIdRecordControlObj.GetRecord()) AndAlso personalIdRecordControlObj.GetRecord().IsCreated AndAlso Not IsNothing(personalIdRecordControlObj.GetRecord().PersonalId)) + wc.iAND(PersonalNameTable.PersonalId, BaseFilter.ComparisonOperator.EqualsTo, personalIdRecordControlObj.GetRecord().PersonalId.ToString()) + selectedRecordKeyValue.AddElement(PersonalNameTable.PersonalId.InternalName, personalIdRecordControlObj.GetRecord().PersonalId.ToString()) + Else + wc.RunQuery = False + Return wc + End If + + HttpContext.Current.Session("PersonalNameTableControlWhereClause") = selectedRecordKeyValue.ToXmlString() + + Return wc + End Function + + + Public Overridable Function CreateWhereClause(ByVal searchText as String, ByVal fromSearchControl as String, ByVal AutoTypeAheadSearch as String, ByVal AutoTypeAheadWordSeparators as String) As WhereClause + ' This CreateWhereClause is used for loading list of suggestions for Auto Type-Ahead feature. + PersonalNameTable.Instance.InnerFilter = Nothing + Dim wc As WhereClause = New WhereClause() + + ' Compose the WHERE clause consiting of: + ' 1. Static clause defined at design time. + ' 2. User selected search criteria. + ' 3. User selected filter criteria. + + Dim appRelativeVirtualPath As String = CType(HttpContext.Current.Session("AppRelativeVirtualPath"), String) + + Dim selectedRecordInPersonalIdRecordControl as String = DirectCast(HttpContext.Current.Session("PersonalNameTableControlWhereClause"), String) + + If Not selectedRecordInPersonalIdRecordControl Is Nothing AndAlso KeyValue.IsXmlKey(selectedRecordInPersonalIdRecordControl) Then + Dim selectedRecordKeyValue as KeyValue = KeyValue.XmlToKey(selectedRecordInPersonalIdRecordControl) + + If Not IsNothing(selectedRecordKeyValue) AndAlso selectedRecordKeyValue.ContainsColumn(PersonalNameTable.PersonalId) Then + wc.iAND(PersonalNameTable.PersonalId, BaseFilter.ComparisonOperator.EqualsTo, selectedRecordKeyValue.GetColumnValue(PersonalNameTable.PersonalId).ToString()) + End If + + End If + + ' Adds clauses if values are selected in Filter controls which are configured in the page. + + + Return wc + End Function + + + Public Overridable Function FormatSuggestions(ByVal prefixText As String, ByVal resultItem As String, _ + ByVal columnLength As Integer, ByVal AutoTypeAheadDisplayFoundText As String, _ + ByVal autoTypeAheadSearch As String, ByVal AutoTypeAheadWordSeparators As String, _ + ByVal resultList As ArrayList) As Boolean + + 'Formats the resultItem and adds it to the list of suggestions. + Dim index As Integer = resultItem.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture).IndexOf(prefixText.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture)) + Dim itemToAdd As String = "" + Dim isFound As Boolean = False + Dim isAdded As Boolean = False + ' Get the index where prfixt is at the beginning of resultItem. If not found then, index of word which begins with prefixText. + If InvariantLCase(autoTypeAheadSearch).equals("wordsstartingwithsearchstring") And Not index = 0 Then + ' Expression to find word which contains AutoTypeAheadWordSeparators followed by prefixText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex( AutoTypeAheadWordSeparators + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + If regex1.IsMatch(resultItem) Then + index = regex1.Match(resultItem).Index + isFound = True + End If + ' If the prefixText is found immediatly after white space then starting of the word is found so don not search any further + If not resultItem(index).ToString() = " " Then + ' Expression to find beginning of the word which contains AutoTypeAheadWordSeparators followed by prefixText + Dim regex As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\\S*" + AutoTypeAheadWordSeparators + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + If regex.IsMatch(resultItem) Then + index = regex.Match(resultItem).Index + isFound = True + End If + End If + End If + + ' If autoTypeAheadSearch value is wordsstartingwithsearchstring then, extract the substring only if the prefixText is found at the + ' beginning of the resultItem (index = 0) or a word in resultItem is found starts with prefixText. + If index = 0 Or isFound Or InvariantLCase(autoTypeAheadSearch).Equals("anywhereinstring") then + If InvariantLCase(AutoTypeAheadDisplayFoundText).equals("atbeginningofmatchedstring") Then + ' Expression to find beginning of the word which contains prefixText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\\S*" + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + ' Find the beginning of the word which contains prefexText + If (StringUtils.InvariantLCase(autoTypeAheadSearch).Equals("anywhereinstring") AndAlso regex1.IsMatch(resultItem)) Then + index = regex1.Match(resultItem).Index + isFound = True + End If + ' Display string from the index till end of the string if sub string from index till end is less than columnLength value. + If Len(resultItem) - index <= columnLength Then + If index = 0 Then + itemToAdd = resultItem + Else + itemToAdd = "..." & resultItem.Substring(index, Len(resultItem) - index) + End If + Else + If index = 0 Then + itemToAdd = resultItem.Substring(index, (columnLength - 3)) & "..." + Else + 'Truncate the string to show only columnLength - 6 characters as begining and trailing "..." has to be appended. + itemToAdd = "..." & resultItem.Substring(index , columnLength - 6) & "..." + End If + End If + ElseIf InvariantLCase(AutoTypeAheadDisplayFoundText).equals("inmiddleofmatchedstring") Then + Dim subStringBeginIndex As Integer = CType(columnLength/2, Integer) + If Len(resultItem) <= columnLength Then + itemToAdd = resultItem + Else + ' Sanity check at end of the string + If index + Len(prefixText) = columnLength Then + itemToAdd = "..." & resultItem.Substring(index-columnLength,index) + ElseIf Len(resultItem) - index < subStringBeginIndex Then + ' Display string from the end till columnLength value if, index is closer to the end of the string. + itemToAdd = "..." & resultItem.Substring(Len(resultItem)-columnLength,Len(resultItem)) + ElseIf index <= subStringBeginIndex Then + ' Sanity chet at beginning of the string + itemToAdd = resultItem.Substring(0, columnLength) & "..." + Else + ' Display string containing text before the prefixText occures and text after the prefixText + itemToAdd = "..." & resultItem.Substring(index - subStringBeginIndex, columnLength) & "..." + End If + End If + ElseIf InvariantLCase(AutoTypeAheadDisplayFoundText).equals("atendofmatchedstring") Then + ' Expression to find ending of the word which contains prefexText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\s", System.Text.RegularExpressions.RegexOptions.IgnoreCase) + ' Find the ending of the word which contains prefexText + If regex1.IsMatch(resultItem, index + 1) Then + index = regex1.Match(resultItem, index + 1).Index + Else + ' If the word which contains prefexText is the last word in string, regex1.IsMatch returns false. + index = resultItem.Length + End If + If index > Len(resultItem) Then + index = Len(resultItem) + End If + ' If text from beginning of the string till index is less than columnLength value then, display string from the beginning till index. + If index <= columnLength Then + if index = Len(resultItem) Then 'Make decision to append "..." + itemToAdd = resultItem.Substring(0,index) + Else + itemToAdd = resultItem.Substring(0,index) & "..." + End If + Else + If index = Len(resultItem) Then + itemToAdd = "..." & resultItem.Substring(index - (columnLength - 3), (columnLength - 3)) + Else + 'Truncate the string to show only columnLength - 6 characters as begining and trailing "..." has to be appended. + itemToAdd = "..." & resultItem.Substring(index - (columnLength - 6), columnLength - 6) & "..." + End If + End If + End If + + ' Remove newline character from itemToAdd + Dim prefixTextIndex As Integer = itemToAdd.IndexOf(prefixText, StringComparison.CurrentCultureIgnoreCase) + ' If itemToAdd contains any newline after the search text then show text only till newline + Dim regex2 As System.Text.RegularExpressions.Regex = New System.Text.RegularExpressions.Regex("(" & vbCrLf & "|" & vbLf & ")", System.Text.RegularExpressions.RegexOptions.IgnoreCase) + Dim newLineIndexAfterPrefix As Integer = -1 + If regex2.IsMatch(itemToAdd, prefixTextIndex) Then + newLineIndexAfterPrefix = regex2.Match(itemToAdd, prefixTextIndex).Index + End If + If (newLineIndexAfterPrefix > -1) Then + If itemToAdd.EndsWith("...") Then + itemToAdd = (itemToAdd.Substring(0, newLineIndexAfterPrefix) + "...") + Else + itemToAdd = itemToAdd.Substring(0, newLineIndexAfterPrefix) + End If + End If + ' If itemToAdd contains any newline before search text then show text which comes after newline + Dim regex3 As System.Text.RegularExpressions.Regex = New System.Text.RegularExpressions.Regex("(" & vbCrLf & "|" & vbLf & ")", (System.Text.RegularExpressions.RegexOptions.IgnoreCase Or System.Text.RegularExpressions.RegexOptions.RightToLeft)) + Dim newLineIndexBeforePrefix As Integer = -1 + If regex3.IsMatch(itemToAdd, prefixTextIndex) Then + newLineIndexBeforePrefix = regex3.Match(itemToAdd, prefixTextIndex).Index + End If + If (newLineIndexBeforePrefix > -1) Then + If itemToAdd.StartsWith("...") Then + itemToAdd = ("..." + itemToAdd.Substring((newLineIndexBeforePrefix + regex3.Match(itemToAdd, prefixTextIndex).Length))) + Else + itemToAdd = itemToAdd.Substring((newLineIndexBeforePrefix + regex3.Match(itemToAdd, prefixTextIndex).Length)) + End If + End If + + If Not itemToAdd is nothing AndAlso Not resultList.Contains(itemToAdd) Then + + resultList.Add(itemToAdd) + + isAdded = true + End If + End If + Return isAdded + End Function + + + Protected Overridable Sub GetPageSize() + + If Me.PersonalNamePagination.PageSize.Text.Trim <> "" Then + Try + 'Me.PageSize = Integer.Parse(Me.PersonalNamePagination.PageSize.Text) + Catch ex As Exception + End Try + End If + End Sub + + Protected Overridable Sub AddNewRecords() + + Dim newRecordList As ArrayList = New ArrayList() + + Dim newUIDataList As System.Collections.Generic.List(Of Hashtable) = New System.Collections.Generic.List(Of Hashtable)() + + ' Loop though all the record controls and if the record control + ' does not have a unique record id set, then create a record + ' and add to the list. + If Not Me.ResetData Then + Dim rep As System.Web.UI.WebControls.Repeater = CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalNameTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return + + Dim repItem As System.Web.UI.WebControls.RepeaterItem + For Each repItem In rep.Items + ' Loop through all rows in the table, set its DataSource and call DataBind(). + + Dim recControl As PersonalNameTableControlRow = DirectCast(repItem.FindControl("PersonalNameTableControlRow"), PersonalNameTableControlRow) + + If recControl.Visible AndAlso recControl.IsNewRecord() Then + + Dim rec As PersonalNameRecord = New PersonalNameRecord() + + If recControl.NameDate.Text <> "" Then + rec.Parse(recControl.NameDate.Text, PersonalNameTable.NameDate) + End If + If recControl.PersonalLastName1.Text <> "" Then + rec.Parse(recControl.PersonalLastName1.Text, PersonalNameTable.PersonalLastName) + End If + If recControl.PersonalName1.Text <> "" Then + rec.Parse(recControl.PersonalName1.Text, PersonalNameTable.PersonalName) + End If + If recControl.Ref2.Text <> "" Then + rec.Parse(recControl.Ref2.Text, PersonalNameTable.Ref0) + End If + newUIDataList.Add(recControl.PreservedUIData()) + newRecordList.Add(rec) + End If + Next + End If + + + ' Add any new record to the list. + Dim index As Integer = 0 + For index = 1 To Me.AddNewRecord + + newRecordList.Insert(0, New PersonalNameRecord()) + newUIDataList.Insert(0, New Hashtable()) + + Next + Me.AddNewRecord = 0 + + ' Finally, add any new records to the DataSource. + If newRecordList.Count > 0 Then + + Dim finalList As ArrayList = New ArrayList(Me.DataSource) + finalList.InsertRange(0, newRecordList) + + Me.DataSource = DirectCast(finalList.ToArray(GetType(PersonalNameRecord)), PersonalNameRecord()) + + End If + + ' Add the existing UI data to this hash table + If newUIDataList.Count > 0 Then + Me.UIData.InsertRange(0, newUIDataList) + End If + + End Sub + + + Public Sub AddToDeletedRecordIds(ByVal rec As PersonalNameTableControlRow) + If rec.IsNewRecord() Then + Return + End If + + If Not Me.DeletedRecordIds Is Nothing AndAlso Me.DeletedRecordIds.Trim <> "" Then + Me.DeletedRecordIds &= "," + End If + + Me.DeletedRecordIds &= "[" & rec.RecordUniqueId & "]" + End Sub + + Protected Overridable Function InDeletedRecordIds(ByVal rec As PersonalNameTableControlRow) As Boolean + If Me.DeletedRecordIds Is Nothing OrElse Me.DeletedRecordIds.Trim = "" Then + Return False + End If + + Return Me.DeletedRecordIds.IndexOf("[" & rec.RecordUniqueId & "]") >= 0 + End Function + + Private _DeletedRecordIds As String + Public Property DeletedRecordIds() As String + Get + Return Me._DeletedRecordIds + End Get + Set(ByVal value As String) + Me._DeletedRecordIds = value + End Set + End Property + + + ' Create Set, WhereClause, and Populate Methods + + Public Overridable Sub SetNameDateLabel() + + End Sub + + Public Overridable Sub SetPersonalLastNameLabel2() + + End Sub + + Public Overridable Sub SetPersonalNameLabel2() + + End Sub + + Public Overridable Sub SetPersonalNameTableControlCollapsibleRegion() + + End Sub + + Public Overridable Sub SetRefLabel1() + + 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. + Dim added As Boolean = Me.AddNewRecord > 0 + Me.LoadData() + Me.DataBind() + + If added Then + Me.SetFocusToAddedRow() + End If + + End If + + + + Catch ex As Exception + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + Finally + DbUtils.EndTransaction + End Try + End Sub + + 'this function sets focus to the first editable element in the new added row in the editable table + Protected Overridable Sub SetFocusToAddedRow() + Dim rep As System.Web.UI.WebControls.Repeater = CType(Me.FindControl("PersonalNameTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing OrElse rep.Items.Count = 0 Then Return + Dim repItem As System.Web.UI.WebControls.RepeaterItem + For Each repItem In rep.Items + 'Load scripts to table rows + Me.Page.LoadFocusScripts(repItem) + Dim recControl As PersonalNameTableControlRow = DirectCast(repItem.FindControl("PersonalNameTableControlRow"), PersonalNameTableControlRow) + If recControl.IsNewRecord Then + For Each field As Control In recControl.Controls + If field.Visible AndAlso Me.Page.IsControlEditable(field, False) Then + 'set focus on the first editable field in the new row + field.Focus() + Dim updPan As UpdatePanel = DirectCast(Me.Page.FindControlRecursively("UpdatePanel1"), UpdatePanel) + If Not updPan Is Nothing Then updPan.Update() + Return + End If + Next + Return + End If + Next + End Sub + + + Protected Overrides Sub SaveControlsToSession() + MyBase.SaveControlsToSession() + + ' Save filter controls to values to session. + + + 'Save pagination state to session. + + + + ' Save table control properties to the session. + If Not Me.CurrentSortOrder Is Nothing Then + Me.SaveToSession(Me, "Order_By", Me.CurrentSortOrder.ToXmlString()) + End If + + Me.SaveToSession(Me, "Page_Index", Me.PageIndex.ToString()) + Me.SaveToSession(Me, "Page_Size", Me.PageSize.ToString()) + + Me.SaveToSession(Me, "DeletedRecordIds", Me.DeletedRecordIds) + + End Sub + + Protected Sub SaveControlsToSession_Ajax() + ' Save filter controls to values to session. + + HttpContext.Current.Session("AppRelativeVirtualPath") = Me.Page.AppRelativeVirtualPath + + End Sub + + Protected Overrides Sub ClearControlsFromSession() + MyBase.ClearControlsFromSession() + + ' Clear filter controls values from the session. + + + ' Clear pagination state from session. + + + + ' Clear table properties from the session. + Me.RemoveFromSession(Me, "Order_By") + Me.RemoveFromSession(Me, "Page_Index") + Me.RemoveFromSession(Me, "Page_Size") + + Me.RemoveFromSession(Me, "DeletedRecordIds") + + End Sub + + Protected Overrides Sub LoadViewState(ByVal savedState As Object) + MyBase.LoadViewState(savedState) + + Dim orderByStr As String = CType(ViewState("PersonalNameTableControl_OrderBy"), String) + + If orderByStr IsNot Nothing AndAlso orderByStr.Trim <> "" Then + Me.CurrentSortOrder = BaseClasses.Data.OrderBy.FromXmlString(orderByStr) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + End If + + Dim pageIndex As String = CType(ViewState("Page_Index"), String) + If pageIndex IsNot Nothing Then + Me.PageIndex = CInt(pageIndex) + End If + + Dim pageSize As String = CType(ViewState("Page_Size"), String) + If Not pageSize Is Nothing Then + Me.PageSize = CInt(pageSize) + End If + + + + ' Load view state for pagination control. + + Me.DeletedRecordIds = CType(Me.ViewState("DeletedRecordIds"), String) + + End Sub + + Protected Overrides Function SaveViewState() As Object + + If Me.CurrentSortOrder IsNot Nothing Then + Me.ViewState("PersonalNameTableControl_OrderBy") = Me.CurrentSortOrder.ToXmlString() + End If + + Me.ViewState("Page_Index") = Me.PageIndex + Me.ViewState("Page_Size") = Me.PageSize + + Me.ViewState("DeletedRecordIds") = Me.DeletedRecordIds + + + ' Load view state for pagination control. + + + Return MyBase.SaveViewState() + End Function + + ' Generate the event handling functions for pagination events. + + ' event handler for ImageButton + Public Overridable Sub PersonalNamePagination_FirstPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.PageIndex = 0 + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalNamePagination_LastPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.DisplayLastPage = True + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalNamePagination_NextPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.PageIndex += 1 + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for LinkButton + Public Overridable Sub PersonalNamePagination_PageSizeButton_Click(ByVal sender As Object, ByVal args As EventArgs) + + Try + + Me.DataChanged = True + + Me.PageSize = Integer.Parse(Me.PersonalNamePagination.PageSize.Text) + + Me.PageIndex = Integer.Parse(Me.PersonalNamePagination.CurrentPage.Text) - 1 + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalNamePagination_PreviousPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + If Me.PageIndex > 0 Then + Me.PageIndex -= 1 + Me.DataChanged = True + End If + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + + ' Generate the event handling functions for sorting events. + + Public Overridable Sub NameDateLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by NameDate when clicked. + + ' Get previous sorting state for NameDate. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalNameTable.NameDate) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for NameDate. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalNameTable.NameDate, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by NameDate, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub PersonalLastNameLabel2_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by PersonalLastName when clicked. + + ' Get previous sorting state for PersonalLastName. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalNameTable.PersonalLastName) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for PersonalLastName. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalNameTable.PersonalLastName, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by PersonalLastName, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub PersonalNameLabel2_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by PersonalName when clicked. + + ' Get previous sorting state for PersonalName. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalNameTable.PersonalName) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for PersonalName. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalNameTable.PersonalName, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by PersonalName, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub RefLabel1_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by Ref when clicked. + + ' Get previous sorting state for Ref. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalNameTable.Ref0) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for Ref. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalNameTable.Ref0, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by Ref, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + + ' Generate the event handling functions for button events. + + ' event handler for ImageButton + Public Overridable Sub PersonalNameAddButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + Me.AddNewRecord = 1 + Me.DataChanged = True + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalNameDeleteButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + If(Not Me.Page.IsPageRefresh) Then + + Me.DeleteSelectedRecords(True) + Me.SetFormulaControls() + + + End If + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalNameResetButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.CurrentSortOrder.Reset() + If Me.InSession(Me, "Order_By") Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + + End If + + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + + + ' Generate the event handling functions for filter and search events. + + + ' Generate the event handling functions for others + + + Private _UIData As New System.Collections.Generic.List(Of Hashtable) + Public Property UIData() As System.Collections.Generic.List(Of Hashtable) + Get + Return Me._UIData + End Get + Set(ByVal value As System.Collections.Generic.List(Of Hashtable)) + Me._UIData = value + End Set + End Property + + ' pagination properties + Protected _PageSize As Integer + Public Property PageSize() As Integer + Get + Return Me._PageSize + End Get + Set(ByVal value As Integer) + Me._PageSize = value + End Set + End Property + + Protected _PageIndex As Integer + Public Property PageIndex() As Integer + Get + ' Return the PageIndex + Return Me._PageIndex + End Get + Set(ByVal value As Integer) + Me._PageIndex = value + End Set + End Property + + Protected _TotalRecords As Integer = -1 + Public Property TotalRecords() As Integer + Get + If _TotalRecords < 0 + _TotalRecords = PersonalNameTable.GetRecordCount(CreateCompoundJoinFilter(), CreateWhereClause()) + End If + Return Me._TotalRecords + End Get + Set(ByVal value As Integer) + If Me.PageSize > 0 Then + + Me.TotalPages = CInt(Math.Ceiling(value / Me.PageSize)) + + End If + Me._TotalRecords = value + End Set + End Property + + + + Protected _TotalPages As Integer = -1 + Public Property TotalPages() As Integer + Get + If _TotalPages < 0 Then + + Me.TotalPages = CInt(Math.Ceiling(TotalRecords / Me.PageSize)) + + End If + Return Me._TotalPages + End Get + Set(ByVal value As Integer) + Me._TotalPages = value + End Set + End Property + + Protected _DisplayLastPage As Boolean + Public Property DisplayLastPage() As Boolean + Get + Return Me._DisplayLastPage + End Get + Set(ByVal value As Boolean) + Me._DisplayLastPage = value + End Set + End Property + + Private _DataChanged As Boolean = False + Public Property DataChanged() As Boolean + Get + Return Me._DataChanged + End Get + Set(ByVal value As Boolean) + Me._DataChanged = value + End Set + End Property + + Private _ResetData As Boolean = False + Public Property ResetData() As Boolean + Get + Return Me._ResetData + End Get + Set(ByVal value As Boolean) + Me._ResetData = value + End Set + End Property + + Private _AddNewRecord As Integer = 0 + Public Property AddNewRecord() As Integer + Get + Return Me._AddNewRecord + End Get + Set(ByVal value As Integer) + Me._AddNewRecord = value + End Set + End Property + + + Private _CurrentSortOrder As OrderBy = Nothing + Public Property CurrentSortOrder() As OrderBy + Get + Return Me._CurrentSortOrder + End Get + Set(ByVal value As BaseClasses.Data.OrderBy) + Me._CurrentSortOrder = value + End Set + End Property + + Private _DataSource() As PersonalNameRecord = Nothing + Public Property DataSource() As PersonalNameRecord () + Get + Return Me._DataSource + End Get + Set(ByVal value() As PersonalNameRecord) + Me._DataSource = value + End Set + End Property + +#Region "Helper Properties" + + Public ReadOnly Property NameDateLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "NameDateLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property PersonalLastNameLabel2() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalLastNameLabel2"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property PersonalNameAddButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalNameAddButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalNameDeleteButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalNameDeleteButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalNameLabel2() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalNameLabel2"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property PersonalNamePagination() As Persons.UI.IPagination + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalNamePagination"), Persons.UI.IPagination) + End Get + End Property + + Public ReadOnly Property PersonalNameResetButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalNameResetButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalNameTableControlCollapsibleRegion() As System.Web.UI.WebControls.Panel + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalNameTableControlCollapsibleRegion"), System.Web.UI.WebControls.Panel) + End Get + End Property + + Public ReadOnly Property PersonalNameToggleAll() As System.Web.UI.WebControls.CheckBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalNameToggleAll"), System.Web.UI.WebControls.CheckBox) + End Get + End Property + + Public ReadOnly Property RefLabel1() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RefLabel1"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + +#End Region + +#Region "Helper Functions" + + Public Overrides Overloads Function ModifyRedirectUrl(url As String, arg As String, ByVal bEncrypt As Boolean) As String + Return Me.Page.EvaluateExpressions(url, arg, bEncrypt, Me) + End Function + + Public Overrides Overloads Function EvaluateExpressions(url As String, arg As String, ByVal bEncrypt As Boolean) As String + Dim needToProcess As Boolean = AreAnyUrlParametersForMe(url, arg) + If (needToProcess) Then + Dim recCtl As PersonalNameTableControlRow = Me.GetSelectedRecordControl() + If recCtl Is Nothing AndAlso url.IndexOf("{") >= 0 Then + ' Localization. + Throw New Exception(Page.GetResourceValue("Err:NoRecSelected", "Persons")) + End If + Dim rec As PersonalNameRecord = Nothing + If recCtl IsNot Nothing Then + rec = recCtl.GetRecord() + End If + Return EvaluateExpressions(url, arg, rec, bEncrypt) + End If + Return url + End Function + + Public Overridable Function GetSelectedRecordIndex() As Integer + Dim counter As Integer = 0 + Dim recControl As PersonalNameTableControlRow + For Each recControl In Me.GetRecordControls() + If recControl.PersonalNameRecordRowSelection.Checked Then + Return counter + End If + counter += 1 + Next + Return -1 + End Function + + Public Overridable Function GetSelectedRecordControl() As PersonalNameTableControlRow + Dim selectedList() As PersonalNameTableControlRow = Me.GetSelectedRecordControls() + If selectedList.Length = 0 Then + Return Nothing + End If + Return selectedList(0) + + End Function + + Public Overridable Function GetSelectedRecordControls() As PersonalNameTableControlRow() + + Dim selectedList As ArrayList = New ArrayList(25) + Dim recControl As PersonalNameTableControlRow + For Each recControl In Me.GetRecordControls() + If recControl.PersonalNameRecordRowSelection IsNot Nothing AndAlso recControl.PersonalNameRecordRowSelection.Checked Then + selectedList.Add(recControl) + End If + Next + Return DirectCast(selectedList.ToArray(GetType(PersonalNameTableControlRow)), PersonalNameTableControlRow()) + + End Function + + Public Overridable Sub DeleteSelectedRecords(ByVal deferDeletion As Boolean) + Dim recList() As PersonalNameTableControlRow = Me.GetSelectedRecordControls() + If recList.Length = 0 Then + ' Localization. + Throw New Exception(Page.GetResourceValue("Err:NoRecSelected", "Persons")) + End If + + Dim recCtl As PersonalNameTableControlRow + For Each recCtl In recList + If deferDeletion Then + If Not recCtl.IsNewRecord Then + + Me.AddToDeletedRecordIds(recCtl) + + End If + recCtl.Visible = False + + recCtl.PersonalNameRecordRowSelection.Checked = False + + Else + + recCtl.Delete() + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + End If + Next + End Sub + + Public Function GetRecordControls() As PersonalNameTableControlRow() + Dim recList As ArrayList = New ArrayList() + Dim rep As System.Web.UI.WebControls.Repeater = CType(Me.FindControl("PersonalNameTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return Nothing + Dim repItem As System.Web.UI.WebControls.RepeaterItem + + For Each repItem In rep.Items + + Dim recControl As PersonalNameTableControlRow = DirectCast(repItem.FindControl("PersonalNameTableControlRow"), PersonalNameTableControlRow) + recList.Add(recControl) + + Next + + Return DirectCast(recList.ToArray(GetType(PersonalNameTableControlRow)), PersonalNameTableControlRow()) + End Function + + Public Shadows ReadOnly Property Page() As BaseApplicationPage + Get + Return DirectCast(MyBase.Page, BaseApplicationPage) + End Get + End Property + +#End Region + + + +End Class + + +' Base class for the PersonalRankTableControlRow control on the AddPersonalId page. +' Do not modify this class. Instead override any method in PersonalRankTableControlRow. +Public Class BasePersonalRankTableControlRow + Inherits Persons.UI.BaseApplicationRecordControl + + ' To customize, override this method in PersonalRankTableControlRow. + Protected Overridable Sub Control_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Init + + Me.ClearControlsFromSession() + End Sub + + ' To customize, override this method in PersonalRankTableControlRow. + Protected Overridable Sub Control_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load + + 'Call LoadFocusScripts from repeater so that onfocus attribute could be added to elements + Me.Page.LoadFocusScripts(Me) + + ' Show confirmation message on Click + Me.PersonalRankRowDeleteButton.Attributes.Add("onClick", "return (confirm('" & (CType(Me.Page,BaseApplicationPage)).GetResourceValue("DeleteRecordConfirm", "Persons") & "'));") + + + ' Register the event handlers. + + AddHandler Me.PersonalRankRowDeleteButton.Click, AddressOf PersonalRankRowDeleteButton_Click + + AddHandler Me.RankId1.SelectedIndexChanged, AddressOf RankId1_SelectedIndexChanged + + AddHandler Me.GazetteDate1.TextChanged, AddressOf GazetteDate1_TextChanged + + AddHandler Me.GazetteNO1.TextChanged, AddressOf GazetteNO1_TextChanged + + AddHandler Me.GazettePage1.TextChanged, AddressOf GazettePage1_TextChanged + + AddHandler Me.GazetteSection1.TextChanged, AddressOf GazetteSection1_TextChanged + + AddHandler Me.PreRank.TextChanged, AddressOf PreRank_TextChanged + + AddHandler Me.RankDate.TextChanged, AddressOf RankDate_TextChanged + + AddHandler Me.Ref3.TextChanged, AddressOf Ref3_TextChanged + + AddHandler Me.RefDate1.TextChanged, AddressOf RefDate1_TextChanged + + + End Sub + + + Public Overridable Sub LoadData() + + ' Load the data from the database into the DataSource PersonalRank 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 = PersonalRankTable.GetRecord(Me.RecordUniqueId, True) + + Return + End If + + ' Since this is a row in the table, the data for this row is loaded by the + ' LoadData method of the BasePersonalRankTableControl when the data for the entire + ' table is loaded. + + Me.DataSource = New PersonalRankRecord() + + + + End Sub + + ' Populate the UI controls using the DataSource. To customize, override this method in PersonalRankTableControlRow. + 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 + + SetGazetteDate1() + SetGazetteNO1() + SetGazettePage1() + SetGazetteSection1() + + + SetPreRank() + SetRankDate() + SetRankId1() + SetRef3() + SetRefDate1() + + + 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 SetGazetteDate1() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.GazetteDate1.ID) Then + + Me.GazetteDate1.Text = Me.PreviousUIData(Me.GazetteDate1.ID).ToString() + + Return + End If + + + ' Set the GazetteDate TextBox on the webpage with value from the + ' PersonalRank database record. + + ' Me.DataSource is the PersonalRank record retrieved from the database. + ' Me.GazetteDate1 is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetGazetteDate1() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.GazetteDateSpecified Then + + ' If the GazetteDate is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalRankTable.GazetteDate, "d MMM yyyy") + + Me.GazetteDate1.Text = formattedValue + + Else + + ' GazetteDate is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.GazetteDate1.Text = PersonalRankTable.GazetteDate.Format(PersonalRankTable.GazetteDate.DefaultValue, "d MMM yyyy") + + End If + + End Sub + + Public Overridable Sub SetGazetteNO1() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.GazetteNO1.ID) Then + + Me.GazetteNO1.Text = Me.PreviousUIData(Me.GazetteNO1.ID).ToString() + + Return + End If + + + ' Set the GazetteNO TextBox on the webpage with value from the + ' PersonalRank database record. + + ' Me.DataSource is the PersonalRank record retrieved from the database. + ' Me.GazetteNO1 is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetGazetteNO1() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.GazetteNOSpecified Then + + ' If the GazetteNO is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalRankTable.GazetteNO) + + Me.GazetteNO1.Text = formattedValue + + Else + + ' GazetteNO is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.GazetteNO1.Text = PersonalRankTable.GazetteNO.Format(PersonalRankTable.GazetteNO.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetGazettePage1() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.GazettePage1.ID) Then + + Me.GazettePage1.Text = Me.PreviousUIData(Me.GazettePage1.ID).ToString() + + Return + End If + + + ' Set the GazettePage TextBox on the webpage with value from the + ' PersonalRank database record. + + ' Me.DataSource is the PersonalRank record retrieved from the database. + ' Me.GazettePage1 is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetGazettePage1() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.GazettePageSpecified Then + + ' If the GazettePage is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalRankTable.GazettePage) + + Me.GazettePage1.Text = formattedValue + + Else + + ' GazettePage is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.GazettePage1.Text = PersonalRankTable.GazettePage.Format(PersonalRankTable.GazettePage.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetGazetteSection1() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.GazetteSection1.ID) Then + + Me.GazetteSection1.Text = Me.PreviousUIData(Me.GazetteSection1.ID).ToString() + + Return + End If + + + ' Set the GazetteSection TextBox on the webpage with value from the + ' PersonalRank database record. + + ' Me.DataSource is the PersonalRank record retrieved from the database. + ' Me.GazetteSection1 is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetGazetteSection1() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.GazetteSectionSpecified Then + + ' If the GazetteSection is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalRankTable.GazetteSection) + + Me.GazetteSection1.Text = formattedValue + + Else + + ' GazetteSection is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.GazetteSection1.Text = PersonalRankTable.GazetteSection.Format(PersonalRankTable.GazetteSection.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetPreRank() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.PreRank.ID) Then + + Me.PreRank.Text = Me.PreviousUIData(Me.PreRank.ID).ToString() + + Return + End If + + + ' Set the PreRank TextBox on the webpage with value from the + ' PersonalRank database record. + + ' Me.DataSource is the PersonalRank record retrieved from the database. + ' Me.PreRank is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetPreRank() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.PreRankSpecified Then + + ' If the PreRank is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalRankTable.PreRank) + + Me.PreRank.Text = formattedValue + + Else + + ' PreRank is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.PreRank.Text = PersonalRankTable.PreRank.Format(PersonalRankTable.PreRank.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetRankDate() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.RankDate.ID) Then + + Me.RankDate.Text = Me.PreviousUIData(Me.RankDate.ID).ToString() + + Return + End If + + + ' Set the RankDate TextBox on the webpage with value from the + ' PersonalRank database record. + + ' Me.DataSource is the PersonalRank record retrieved from the database. + ' Me.RankDate is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetRankDate() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.RankDateSpecified Then + + ' If the RankDate is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalRankTable.RankDate, "d MMM yyyy") + + Me.RankDate.Text = formattedValue + + Else + + ' RankDate is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.RankDate.Text = PersonalRankTable.RankDate.Format(PersonalRankTable.RankDate.DefaultValue, "d MMM yyyy") + + End If + + End Sub + + Public Overridable Sub SetRankId1() + + ' If selection was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.RankId1.ID) Then + If Me.PreviousUIData(Me.RankId1.ID) Is Nothing + Me.PopulateRankId1DropDownList(Nothing, 100) + Else + Me.PopulateRankId1DropDownList(Me.PreviousUIData(Me.RankId1.ID).ToString(), 100) + End If + Return + End If + + + ' Set the RankId DropDownList on the webpage with value from the + ' PersonalRank database record. + + ' Me.DataSource is the PersonalRank record retrieved from the database. + ' Me.RankId1 is the ASP:DropDownList on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetRankId1() + ' and add your own code before or after the call to the MyBase function. + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.RankIdSpecified Then + + ' If the RankId is non-NULL, then format the value. + ' The Format method will return the Display Foreign Key As (DFKA) value + Me.PopulateRankId1DropDownList(Me.DataSource.RankId.ToString(), 100) + + Else + + ' RankId 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.PopulateRankId1DropDownList(Nothing, 100) + Else + Me.PopulateRankId1DropDownList(PersonalRankTable.RankId.DefaultValue, 100) + End If + + End If + + End Sub + + Public Overridable Sub SetRef3() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.Ref3.ID) Then + + Me.Ref3.Text = Me.PreviousUIData(Me.Ref3.ID).ToString() + + Return + End If + + + ' Set the Ref TextBox on the webpage with value from the + ' PersonalRank database record. + + ' Me.DataSource is the PersonalRank record retrieved from the database. + ' Me.Ref3 is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetRef3() + ' 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(PersonalRankTable.Ref0) + + Me.Ref3.Text = formattedValue + + Else + + ' Ref is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.Ref3.Text = PersonalRankTable.Ref0.Format(PersonalRankTable.Ref0.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetRefDate1() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.RefDate1.ID) Then + + Me.RefDate1.Text = Me.PreviousUIData(Me.RefDate1.ID).ToString() + + Return + End If + + + ' Set the RefDate TextBox on the webpage with value from the + ' PersonalRank database record. + + ' Me.DataSource is the PersonalRank record retrieved from the database. + ' Me.RefDate1 is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetRefDate1() + ' 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(PersonalRankTable.RefDate, "d MMM yyyy") + + Me.RefDate1.Text = formattedValue + + Else + + ' RefDate is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.RefDate1.Text = PersonalRankTable.RefDate.Format(PersonalRankTable.RefDate.DefaultValue, "d MMM yyyy") + + End If + + End Sub + + + Public EvaluateFormulaDelegate As BaseClasses.Data.DataSource.EvaluateFormulaDelegate = New BaseClasses.Data.DataSource.EvaluateFormulaDelegate(AddressOf Me.EvaluateFormula) + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean, ByVal e As FormulaEvaluator) As String + If e Is Nothing Then + e = New FormulaEvaluator() + End If + + e.Variables.Clear() + + + ' add variables for formula evaluation + If variables IsNot Nothing Then + Dim enumerator As System.Collections.Generic.IEnumerator(Of System.Collections.Generic.KeyValuePair(Of String, Object)) = variables.GetEnumerator() + While enumerator.MoveNext() + e.Variables.Add(enumerator.Current.Key, enumerator.Current.Value) + End While + End If + + If includeDS + + End IF + + + ' Other variables referred to in the formula are expected to be + ' properties of the DataSource. For example, referring to + ' UnitPrice as a variable will refer to DataSource.UnitPrice + If dataSourceForEvaluate Is Nothing Then + + e.DataSource = Me.DataSource + + Else + e.DataSource = dataSourceForEvaluate + End If + + ' Define the calling control. This is used to add other + ' related table and record controls as variables. + e.CallingControl = Me + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + + If Not String.IsNullOrEmpty(format) AndAlso (String.IsNullOrEmpty(formula) OrElse formula.IndexOf("Format(") < 0) Then + Return FormulaUtils.Format(resultObj, format) + Else + Return resultObj.ToString() + End If + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format,variables ,includeDS, Nothing) + End Function + + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object)) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format, variables ,True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, format, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal e as FormulaEvaluator) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, variables, True, e) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal includeDS as Boolean) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, includeDS, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, True, Nothing) + End Function + + + Public Overridable Sub RegisterPostback() + + + End Sub + + + + ' To customize, override this method in PersonalRankTableControlRow. + 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 parentCtrl As PersonalIdRecordControl + + + parentCtrl = DirectCast(Me.Page.FindControlRecursively("PersonalIdRecordControl"), PersonalIdRecordControl) + + If (Not IsNothing(parentCtrl) AndAlso IsNothing(parentCtrl.DataSource)) + ' Load the record if it is not loaded yet. + parentCtrl.LoadData() + End If + If (IsNothing(parentCtrl) OrElse IsNothing(parentCtrl.DataSource)) + ' Get the error message from the application resource file. + Throw New Exception(Page.GetResourceValue("Err:NoParentRecId", "Persons")) + End If + + Me.DataSource.PersonalId = parentCtrl.DataSource.PersonalId + + ' 2. Perform any custom validation. + Me.Validate() + + + ' 3. Set the values in the record with data from UI controls. + ' This calls the Get() method for each of the user interface controls. + Me.GetUIData() + + ' 4. Save in the database. + ' We should not save the record if the data did not change. This + ' will save a database hit and avoid triggering any database triggers. + + If Me.DataSource.IsAnyValueChanged Then + ' Save record to database but do not commit yet. + ' Auto generated ids are available after saving for use by child (dependent) records. + Me.DataSource.Save() + + DirectCast(GetParentControlObject(Me, "PersonalRankTableControl"), PersonalRankTableControl).DataChanged = True + DirectCast(GetParentControlObject(Me, "PersonalRankTableControl"), PersonalRankTableControl).ResetData = True + End If + + + ' update session or cookie by formula + + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + ' For Master-Detail relationships, save data on the Detail table(s) + + End Sub + + ' To customize, override this method in PersonalRankTableControlRow. + 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. + + GetGazetteDate1() + GetGazetteNO1() + GetGazettePage1() + GetGazetteSection1() + GetPreRank() + GetRankDate() + GetRankId1() + GetRef3() + GetRefDate1() + End Sub + + + Public Overridable Sub GetGazetteDate1() + + ' Retrieve the value entered by the user on the GazetteDate ASP:TextBox, and + ' save it into the GazetteDate field in DataSource PersonalRank 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.GazetteDate1.Text, PersonalRankTable.GazetteDate) + + + End Sub + + Public Overridable Sub GetGazetteNO1() + + ' Retrieve the value entered by the user on the GazetteNO ASP:TextBox, and + ' save it into the GazetteNO field in DataSource PersonalRank record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.GazetteNO1.Text, PersonalRankTable.GazetteNO) + + + End Sub + + Public Overridable Sub GetGazettePage1() + + ' Retrieve the value entered by the user on the GazettePage ASP:TextBox, and + ' save it into the GazettePage field in DataSource PersonalRank record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.GazettePage1.Text, PersonalRankTable.GazettePage) + + + End Sub + + Public Overridable Sub GetGazetteSection1() + + ' Retrieve the value entered by the user on the GazetteSection ASP:TextBox, and + ' save it into the GazetteSection field in DataSource PersonalRank record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.GazetteSection1.Text, PersonalRankTable.GazetteSection) + + + End Sub + + Public Overridable Sub GetPreRank() + + ' Retrieve the value entered by the user on the PreRank ASP:TextBox, and + ' save it into the PreRank field in DataSource PersonalRank record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.PreRank.Text, PersonalRankTable.PreRank) + + + End Sub + + Public Overridable Sub GetRankDate() + + ' Retrieve the value entered by the user on the RankDate ASP:TextBox, and + ' save it into the RankDate field in DataSource PersonalRank 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.RankDate.Text, PersonalRankTable.RankDate) + + + End Sub + + Public Overridable Sub GetRankId1() + + ' Retrieve the value entered by the user on the RankId ASP:DropDownList, and + ' save it into the RankId field in DataSource PersonalRank record. + + ' Custom validation should be performed in Validate, not here. + + Me.DataSource.Parse(GetValueSelectedPageRequest(Me.RankId1), PersonalRankTable.RankId) + + End Sub + + Public Overridable Sub GetRef3() + + ' Retrieve the value entered by the user on the Ref ASP:TextBox, and + ' save it into the Ref field in DataSource PersonalRank record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.Ref3.Text, PersonalRankTable.Ref0) + + + End Sub + + Public Overridable Sub GetRefDate1() + + ' Retrieve the value entered by the user on the RefDate ASP:TextBox, and + ' save it into the RefDate field in DataSource PersonalRank 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.RefDate1.Text, PersonalRankTable.RefDate) + + + End Sub + + + ' To customize, override this method in PersonalRankTableControlRow. + + Public Overridable Function CreateWhereClause() As WhereClause + + Return Nothing + + End Function + + + + ' To customize, override this method in PersonalRankTableControlRow. + 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) + PersonalRankTable.DeleteRecord(pkValue) + + DirectCast(GetParentControlObject(Me, "PersonalRankTableControl"), PersonalRankTableControl).DataChanged = True + DirectCast(GetParentControlObject(Me, "PersonalRankTableControl"), PersonalRankTableControl).ResetData = True + End Sub + + Protected Overridable Sub Control_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.PreRender + ' PreRender event is raised just before page is being displayed. + Try + DbUtils.StartTransaction() + Me.RegisterPostback() + + If Not Me.Page.ErrorOnPage AndAlso (Me.Page.IsPageRefresh OrElse Me.DataChanged OrElse Me.ResetData) Then + + + ' Re-load the data and update the web page if necessary. + ' This is typically done during a postback (filter, search button, sort, pagination button). + ' In each of the other click handlers, simply set DataChanged to True to reload the data. + Me.LoadData() + Me.DataBind() + End If + + + Catch ex As Exception + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + Finally + DbUtils.EndTransaction() + End Try + End Sub + + + Protected Overrides Sub SaveControlsToSession() + MyBase.SaveControlsToSession() + + + 'Save pagination state to session. + + End Sub + + + + Protected Overrides Sub ClearControlsFromSession() + MyBase.ClearControlsFromSession() + + + + ' Clear pagination state from session. + + End Sub + + Protected Overrides Sub LoadViewState(ByVal savedState As Object) + MyBase.LoadViewState(savedState) + Dim isNewRecord As String = CType(ViewState("IsNewRecord"), String) + If Not isNewRecord Is Nothing AndAlso isNewRecord.Trim <> "" Then + Me.IsNewRecord = Boolean.Parse(isNewRecord) + End If + + Dim myCheckSum As String = CType(ViewState("CheckSum"), String) + If Not myCheckSum Is Nothing AndAlso myCheckSum.Trim <> "" Then + Me.CheckSum = myCheckSum + End If + + + ' Load view state for pagination control. + + End Sub + + Protected Overrides Function SaveViewState() As Object + ViewState("IsNewRecord") = Me.IsNewRecord.ToString() + ViewState("CheckSum") = Me.CheckSum + + + ' Load view state for pagination control. + + Return MyBase.SaveViewState() + End Function + + + + Public Overridable Function CreateWhereClause_RankId1DropDownList() 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 Rank table. + ' Examples: + ' wc.iAND(RankTable.ShortRank, BaseFilter.ComparisonOperator.EqualsTo, "XYZ") + ' wc.iAND(RankTable.Active, BaseFilter.ComparisonOperator.EqualsTo, "1") + + Dim wc As WhereClause = New WhereClause() + Return wc + + End Function + + + ' Fill the RankId1 list. + Protected Overridable Sub PopulateRankId1DropDownList( _ + ByVal selectedValue As String, _ + ByVal maxItems As Integer) + + Me.RankId1.Items.Clear() + + + ' 1. Setup the static list items + + ' Add the Please Select item. + Me.RankId1.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_RankId1DropDownList function. + ' It is better to customize the where clause there. + + Dim wc As WhereClause = CreateWhereClause_RankId1DropDownList() + ' Create the ORDER BY clause to sort based on the displayed value. + + + Dim orderBy As OrderBy = New OrderBy(false, false) + orderBy.Add(RankTable.ShortRank, 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 RankRecord = 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 = RankTable.GetRecords(wc, orderBy, pageNum, maxItems) + For each itemValue As RankRecord In itemValues + ' Create the item and add to the list. + Dim cvalue As String = Nothing + Dim fvalue As String = Nothing + If itemValue.RankIdSpecified Then + cvalue = itemValue.RankId.ToString() + + If counter < maxItems AndAlso Me.RankId1.Items.FindByValue(cvalue) Is Nothing Then + + Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalRankTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalRankTable.RankId) + If _isExpandableNonCompositeForeignKey AndAlso PersonalRankTable.RankId.IsApplyDisplayAs Then + fvalue = PersonalRankTable.GetDFKA(itemValue, PersonalRankTable.RankId) + End If + If (Not _isExpandableNonCompositeForeignKey) Or (String.IsNullOrEmpty(fvalue)) Then + fvalue = itemValue.Format(RankTable.ShortRank) + 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.RankId1.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.RankId1.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.RankId1, selectedValue) AndAlso _ + Not SetSelectedDisplayText(Me.RankId1, selectedValue)Then + + ' construct a whereclause to query a record with Rank.RankId = selectedValue + Dim filter2 As CompoundFilter = New CompoundFilter(CompoundFilter.CompoundingOperators.And_Operator, Nothing) + Dim whereClause2 As WhereClause = New WhereClause() + filter2.AddFilter(New BaseClasses.Data.ColumnValueFilter(RankTable.RankId, selectedValue, BaseClasses.Data.BaseFilter.ComparisonOperator.EqualsTo, False)) + whereClause2.AddFilter(filter2, CompoundFilter.CompoundingOperators.And_Operator) + + Try + ' Execute the query + Dim rc() As RankRecord = RankTable.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 RankRecord = DirectCast(rc(0), RankRecord) + ' Create the item and add to the list. + Dim cvalue As String = Nothing + Dim fvalue As String = Nothing + If itemValue.RankIdSpecified Then + cvalue = itemValue.RankId.ToString() + Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalRankTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalRankTable.RankId) + If _isExpandableNonCompositeForeignKey AndAlso PersonalRankTable.RankId.IsApplyDisplayAs Then + fvalue = PersonalRankTable.GetDFKA(itemValue, PersonalRankTable.RankId) + End If + If (Not _isExpandableNonCompositeForeignKey) Or (String.IsNullOrEmpty(fvalue)) Then + fvalue = itemValue.Format(RankTable.ShortRank) + End If + + If fvalue Is Nothing OrElse fvalue.Trim() = "" Then fvalue = cvalue + Dim newItem As New ListItem(fvalue, cvalue) + Me.RankId1.Items.Add(newItem) + SetSelectedValue(Me.RankId1, selectedValue) + End If + End If + Catch + End Try + + End If + + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalRankRowDeleteButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + If(Not Me.Page.IsPageRefresh) Then + + Dim tc As PersonalRankTableControl = DirectCast(GetParentControlObject(Me, "PersonalRankTableControl"), PersonalRankTableControl) + If Not (IsNothing(tc)) Then + If Not Me.IsNewRecord Then + tc.AddToDeletedRecordIds(DirectCast(Me, PersonalRankTableControlRow)) + End If + Me.Visible = False + tc.SetFormulaControls() + End If + + End If + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + Protected Overridable Sub RankId1_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()(RankId1.ClientID & "_SelectedValue"), String) + Dim displayText As String = CType(Me.Page.Session()(RankId1.ClientID & "_SelectedDisplayText"), String) + If displayText <> "" AndAlso val <> "" Then + Me.RankId1.Items.Add(New ListItem(displayText, val)) + Me.RankId1.SelectedIndex = Me.RankId1.Items.Count - 1 + Me.Page.Session.Remove(RankId1.ClientID & "_SelectedValue") + Me.Page.Session.Remove(RankId1.ClientID & "_SelectedDisplayText") + End If + + + + + End Sub + + Protected Overridable Sub GazetteDate1_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub GazetteNO1_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub GazettePage1_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub GazetteSection1_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub PreRank_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub RankDate_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub Ref3_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub RefDate1_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("BasePersonalRankTableControlRow_Rec"), String) + End Get + Set(ByVal value As String) + Me.ViewState("BasePersonalRankTableControlRow_Rec") = value + End Set + End Property + + Private _DataSource As PersonalRankRecord + Public Property DataSource() As PersonalRankRecord + Get + Return Me._DataSource + End Get + + Set(ByVal value As PersonalRankRecord) + + Me._DataSource = value + End Set + End Property + + + + Private _checkSum As String + Public Overridable Property CheckSum() As String + Get + Return Me._checkSum + End Get + Set(ByVal value As String) + Me._checkSum = value + End Set + End Property + + Private _TotalPages As Integer + Public Property TotalPages() As Integer + Get + Return Me._TotalPages + End Get + Set(ByVal value As Integer) + Me._TotalPages = value + End Set + End Property + + Private _PageIndex As Integer + Public Property PageIndex() As Integer + Get + ' Return the PageIndex + Return Me._PageIndex + End Get + Set(ByVal value As Integer) + Me._PageIndex = value + End Set + End Property + + Private _DisplayLastPage As Boolean + Public Property DisplayLastPage() As Boolean + Get + Return Me._DisplayLastPage + End Get + Set(ByVal value As Boolean) + Me._DisplayLastPage = value + End Set + End Property + + + +#Region "Helper Properties" + + Public ReadOnly Property GazetteDate1() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "GazetteDate1"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property GazetteNO1() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "GazetteNO1"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property GazettePage1() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "GazettePage1"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property GazetteSection1() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "GazetteSection1"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property PersonalRankRecordRowSelection() As System.Web.UI.WebControls.CheckBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalRankRecordRowSelection"), System.Web.UI.WebControls.CheckBox) + End Get + End Property + + Public ReadOnly Property PersonalRankRowDeleteButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalRankRowDeleteButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PreRank() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PreRank"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property RankDate() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RankDate"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property RankId1() As System.Web.UI.WebControls.DropDownList + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RankId1"), System.Web.UI.WebControls.DropDownList) + End Get + End Property + + Public ReadOnly Property Ref3() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Ref3"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property RefDate1() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RefDate1"), System.Web.UI.WebControls.TextBox) + 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 PersonalRankRecord = 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 PersonalRankRecord + If Not Me.DataSource Is Nothing Then + Return Me.DataSource + End If + + If Not Me.RecordUniqueId Is Nothing Then + + Return PersonalRankTable.GetRecord(Me.RecordUniqueId, True) + + End If + + ' Localization. + + Return Nothing + + End Function + + Public Shadows ReadOnly Property Page() As BaseApplicationPage + Get + Return DirectCast(MyBase.Page, BaseApplicationPage) + End Get + End Property + +#End Region + +End Class + + + +' Base class for the PersonalRankTableControl control on the AddPersonalId page. +' Do not modify this class. Instead override any method in PersonalRankTableControl. +Public Class BasePersonalRankTableControl + Inherits Persons.UI.BaseApplicationTableControl + + + + Protected Overridable Sub Control_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Init + + + + ' Setup the filter and search events. + + + + ' Control Initializations. + ' Initialize the table's current sort order. + + If Me.InSession(Me, "Order_By") Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + End If + + + + ' Setup default pagination settings. + + Me.PageSize = CInt(Me.GetFromSession(Me, "Page_Size", "10")) + Me.PageIndex = CInt(Me.GetFromSession(Me, "Page_Index", "0")) + + + + Me.ClearControlsFromSession() + End Sub + + Protected Overridable Sub Control_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load + + SaveControlsToSession_Ajax() + + ' Show confirmation message on Click + Me.PersonalRankDeleteButton.Attributes.Add("onClick", "return (confirm('" & (CType(Me.Page,BaseApplicationPage)).GetResourceValue("DeleteConfirm", "Persons") & "'));") + + ' Setup the pagination events. + + AddHandler Me.PersonalRankPagination.FirstPage.Click, AddressOf PersonalRankPagination_FirstPage_Click + + AddHandler Me.PersonalRankPagination.LastPage.Click, AddressOf PersonalRankPagination_LastPage_Click + + AddHandler Me.PersonalRankPagination.NextPage.Click, AddressOf PersonalRankPagination_NextPage_Click + + AddHandler Me.PersonalRankPagination.PageSizeButton.Click, AddressOf PersonalRankPagination_PageSizeButton_Click + + AddHandler Me.PersonalRankPagination.PreviousPage.Click, AddressOf PersonalRankPagination_PreviousPage_Click + + + ' Setup the sorting events. + + AddHandler Me.GazetteDateLabel1.Click, AddressOf GazetteDateLabel1_Click + + AddHandler Me.GazetteNOLabel1.Click, AddressOf GazetteNOLabel1_Click + + AddHandler Me.GazettePageLabel1.Click, AddressOf GazettePageLabel1_Click + + AddHandler Me.GazetteSectionLabel1.Click, AddressOf GazetteSectionLabel1_Click + + AddHandler Me.PreRankLabel1.Click, AddressOf PreRankLabel1_Click + + AddHandler Me.RankDateLabel.Click, AddressOf RankDateLabel_Click + + AddHandler Me.RankIdLabel2.Click, AddressOf RankIdLabel2_Click + + AddHandler Me.RefDateLabel1.Click, AddressOf RefDateLabel1_Click + + AddHandler Me.RefLabel2.Click, AddressOf RefLabel2_Click + + ' Setup the button events. + + AddHandler Me.PersonalRankAddButton.Click, AddressOf PersonalRankAddButton_Click + + AddHandler Me.PersonalRankDeleteButton.Click, AddressOf PersonalRankDeleteButton_Click + + AddHandler Me.PersonalRankResetButton.Click, AddressOf PersonalRankResetButton_Click + + + ' Setup events for others + + End Sub + + + Public Overridable Sub LoadData() + + ' Read data from database. Returns an array of records that can be assigned + ' to the DataSource table control property. + Try + Dim joinFilter As CompoundFilter = CreateCompoundJoinFilter() + + ' The WHERE clause will be empty when displaying all records in table. + Dim wc As WhereClause = CreateWhereClause() + If wc IsNot Nothing AndAlso Not wc.RunQuery Then + ' Initialize an empty array of records + Dim alist As New ArrayList(0) + Me.DataSource = DirectCast(alist.ToArray(GetType(PersonalRankRecord)), PersonalRankRecord()) + ' Add records to the list if needed. + Me.AddNewRecords() + Me._TotalRecords = 0 + Me._TotalPages = 0 + Return + End If + + ' Call OrderBy to determine the order - either use the order defined + ' on the Query Wizard, or specified by user (by clicking on column heading) + Dim orderBy As OrderBy = CreateOrderBy() + + ' Get the pagesize from the pagesize control. + Me.GetPageSize() + + If Me.DisplayLastPage Then + Dim totalRecords As Integer = If(Me._TotalRecords < 0, PersonalRankTable.GetRecordCount(CreateCompoundJoinFilter(), CreateWhereClause()), Me._TotalRecords) + + Dim totalPages As Integer = CInt(Math.Ceiling(totalRecords / Me.PageSize)) + + Me.PageIndex = totalPages - 1 + End If + + ' Make sure PageIndex (current page) and PageSize are within bounds. + If Me.PageIndex < 0 Then + Me.PageIndex = 0 + End If + If Me.PageSize < 1 Then + Me.PageSize = 1 + End If + + ' Retrieve the records and set the table DataSource. + ' Only PageSize records are fetched starting at PageIndex (zero based). + If Me.AddNewRecord > 0 Then + ' Make sure to preserve the previously entered data on new rows. + Dim postdata As New ArrayList + For Each rc As PersonalRankTableControlRow In Me.GetRecordControls() + If Not rc.IsNewRecord Then + rc.DataSource = rc.GetRecord() + rc.GetUIData() + postdata.Add(rc.DataSource) + UIData.Add(rc.PreservedUIData()) + End If + Next + Me.DataSource = DirectCast(postdata.ToArray(GetType(PersonalRankRecord)), PersonalRankRecord()) + Else ' Get the records from the database + Me.DataSource = PersonalRankTable.GetRecords(joinFilter, wc, orderBy, Me.PageIndex, Me.PageSize) + + End If + + ' if the datasource contains no records contained in database, then load the last page. + If (DbUtils.GetCreatedRecords(Me.DataSource).Length = 0 AndAlso Not Me.DisplayLastPage) Then + Me.DisplayLastPage = True + LoadData() + Else + + ' Add any new rows desired by the user. + Me.AddNewRecords() + + ' Turn off the ToggleAll checkbox + Me.PersonalRankToggleAll.Checked = False + + + ' Initialize the page and grand totals. now + + End If + + Catch ex As Exception + ' Report the error message to the end user + Dim msg As String = ex.Message + If ex.InnerException IsNot Nothing Then + msg = msg & " InnerException: " & ex.InnerException.Message + End If + Throw New Exception(msg, ex.InnerException) + End Try + End Sub + + + + + Public Overrides Sub DataBind() + ' The DataBind method binds the user interface controls to the values + ' from the database record for each row in the table. To do this, it calls the + ' DataBind for each of the rows. + ' DataBind also populates any filters above the table, and sets the pagination + ' control to the correct number of records and the current page number. + + MyBase.DataBind() + + ' Make sure that the DataSource is initialized. + If Me.DataSource Is Nothing Then + Return + End If + + 'LoadData for DataSource for chart and report if they exist + + ' Improve performance by prefetching display as records. + Me.PreFetchForeignKeyValues() + + ' Setup the pagination controls. + BindPaginationControls() + + + + ' Bind the repeater with the list of records to expand the UI. + Dim rep As System.Web.UI.WebControls.Repeater = CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalRankTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return + rep.DataSource = DataSource() + rep.DataBind() + + Dim index As Integer = 0 + For Each repItem As System.Web.UI.WebControls.RepeaterItem In rep.Items + ' Loop through all rows in the table, set its DataSource and call DataBind(). + Dim recControl As PersonalRankTableControlRow = DirectCast(repItem.FindControl("PersonalRankTableControlRow"), PersonalRankTableControlRow) + recControl.DataSource = Me.DataSource(index) + If Me.UIData.Count > index Then + recControl.PreviousUIData = Me.UIData(index) + End If + recControl.DataBind() + recControl.Visible = Not Me.InDeletedRecordIds(recControl) + + index += 1 + Next + + + + + ' Call the Set methods for each controls on the panel + + SetGazetteDateLabel1() + SetGazetteNOLabel1() + SetGazettePageLabel1() + SetGazetteSectionLabel1() + + + + + SetPersonalRankTableControlCollapsibleRegion() + + SetPreRankLabel1() + SetRankDateLabel() + SetRankIdLabel2() + SetRefDateLabel1() + SetRefLabel2() + ' setting the state of expand or collapse alternative rows + + + ' Load data for each record and table UI control. + ' Ordering is important because child controls get + ' their parent ids from their parent UI controls. + + + ' this method calls the set method for controls with special formula like running total, sum, rank, etc + SetFormulaControls() + End Sub + + Public Overridable Sub SetFormulaControls() + ' this method calls Set methods for the control that has special formula + + + + End Sub + + + Public Sub PreFetchForeignKeyValues() + If (IsNothing(Me.DataSource)) + Return + End If + + Me.Page.PregetDfkaRecords(PersonalRankTable.RankId, Me.DataSource) + + End Sub + + + Public Overridable Sub RegisterPostback() + + + End Sub + + Public EvaluateFormulaDelegate As BaseClasses.Data.DataSource.EvaluateFormulaDelegate = New BaseClasses.Data.DataSource.EvaluateFormulaDelegate(AddressOf Me.EvaluateFormula) + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean, ByVal e as FormulaEvaluator) As String + If e Is Nothing + e = New FormulaEvaluator() + End If + + e.Variables.Clear() + + + ' add variables for formula evaluation + If variables IsNot Nothing Then + Dim enumerator As System.Collections.Generic.IEnumerator(Of System.Collections.Generic.KeyValuePair(Of String, Object)) = variables.GetEnumerator() + While enumerator.MoveNext() + e.Variables.Add(enumerator.Current.Key, enumerator.Current.Value) + End While + End If + + If includeDS + + End If + + ' All variables referred to in the formula are expected to be + ' properties of the DataSource. For example, referring to + ' UnitPrice as a variable will refer to DataSource.UnitPrice + e.DataSource = dataSourceForEvaluate + + ' Define the calling control. This is used to add other + ' related table and record controls as variables. + e.CallingControl = Me + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + + If Not String.IsNullOrEmpty(format) AndAlso (String.IsNullOrEmpty(formula) OrElse formula.IndexOf("Format(") < 0) Then + Return FormulaUtils.Format(resultObj, format) + Else + Return resultObj.ToString() + End If + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format,variables ,includeDS, Nothing) + End Function + + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object)) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format, variables ,True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, format, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal e as FormulaEvaluator) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, variables, True, e) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal includeDS as Boolean) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, includeDS, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, True, Nothing) + End Function + + + + + Public Overridable Sub ResetControl() + + Me.CurrentSortOrder.Reset() + If (Me.InSession(Me, "Order_By")) Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + End If + + Me.PageIndex = 0 + End Sub + + Protected Overridable Sub BindPaginationControls() + ' Setup the pagination controls. + + ' Bind the pagination labels. + + If DbUtils.GetCreatedRecords(Me.DataSource).Length > 0 Then + + Me.PersonalRankPagination.CurrentPage.Text = (Me.PageIndex + 1).ToString() + Else + Me.PersonalRankPagination.CurrentPage.Text = "0" + End If + Me.PersonalRankPagination.PageSize.Text = Me.PageSize.ToString() + Me.PersonalRankPagination.TotalItems.Text = Me.TotalRecords.ToString() + Me.PersonalRankPagination.TotalPages.Text = Me.TotalPages.ToString() + + ' Bind the buttons for PersonalRankTableControl pagination. + + Me.PersonalRankPagination.FirstPage.Enabled = Not (Me.PageIndex = 0) + If Me._TotalPages < 0 Then ' if the total pages is not determined yet, enable last and next buttons + Me.PersonalRankPagination.LastPage.Enabled = True + ElseIf Me._TotalPages = 0 ' if the total pages is determined and it is 0, enable last and next buttons + Me.PersonalRankPagination.LastPage.Enabled = False + Else ' if the total pages is the last page, disable last and next buttons + Me.PersonalRankPagination.LastPage.Enabled = Not (Me.PageIndex = Me.TotalPages - 1) + End If + + If Me._TotalPages < 0 Then ' if the total pages is not determined yet, enable last and next buttons + Me.PersonalRankPagination.NextPage.Enabled = True + ElseIf Me._TotalPages = 0 ' if the total pages is determined and it is 0, enable last and next buttons + Me.PersonalRankPagination.NextPage.Enabled = False + Else ' if the total pages is the last page, disable last and next buttons + Me.PersonalRankPagination.NextPage.Enabled = Not (Me.PageIndex = Me.TotalPages - 1) + End If + + Me.PersonalRankPagination.PreviousPage.Enabled = Not (Me.PageIndex = 0) + + + End Sub + + Public Overridable Sub SaveData() + ' Save the data from the entire table. Calls each row's Save Data + ' to save their data. This function is called by the Click handler of the + ' Save button. The button handler should Start/Commit/End a transaction. + + Dim recCtl As PersonalRankTableControlRow + For Each recCtl In Me.GetRecordControls() + + If Me.InDeletedRecordIds(recCtl) Then + ' Delete any pending deletes. + recCtl.Delete() + Else + If recCtl.Visible Then + recCtl.SaveData() + End If + End If + + Next + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + ' Set IsNewRecord to False for all records - since everything has been saved and is no longer "new" + For Each recCtl In Me.GetRecordControls() + recCtl.IsNewRecord = False + Next + + + ' Set DeletedRecordsIds to Nothing since we have deleted all pending deletes. + Me.DeletedRecordIds = Nothing + + End Sub + + Public Overridable Function CreateCompoundJoinFilter() As CompoundFilter + Dim jFilter As CompoundFilter = New CompoundFilter() + + Return jFilter + + End Function + + + Public Overridable Function CreateOrderBy() As OrderBy + ' The CurrentSortOrder is initialized to the sort order on the + ' Query Wizard. It may be modified by the Click handler for any of + ' the column heading to sort or reverse sort by that column. + ' You can add your own sort order, or modify it on the Query Wizard. + Return Me.CurrentSortOrder + End Function + + Public Overridable Function CreateWhereClause() As WhereClause + 'This CreateWhereClause is used for loading the data. + PersonalRankTable.Instance.InnerFilter = Nothing + Dim wc As WhereClause = New WhereClause() + + ' Compose the WHERE clause consiting of: + ' 1. Static clause defined at design time. + ' 2. User selected search criteria. + ' 3. User selected filter criteria. + + + Dim selectedRecordKeyValue as KeyValue = New KeyValue() + + Dim personalIdRecordControlObj As Persons.UI.Controls.AddPersonalId.PersonalIdRecordControl = DirectCast(MiscUtils.FindControlRecursively(Me.Page, "PersonalIdRecordControl"), Persons.UI.Controls.AddPersonalId.PersonalIdRecordControl) + + If (Not IsNothing(personalIdRecordControlObj) AndAlso Not IsNothing(personalIdRecordControlObj.GetRecord()) AndAlso personalIdRecordControlObj.GetRecord().IsCreated AndAlso Not IsNothing(personalIdRecordControlObj.GetRecord().PersonalId)) + wc.iAND(PersonalRankTable.PersonalId, BaseFilter.ComparisonOperator.EqualsTo, personalIdRecordControlObj.GetRecord().PersonalId.ToString()) + selectedRecordKeyValue.AddElement(PersonalRankTable.PersonalId.InternalName, personalIdRecordControlObj.GetRecord().PersonalId.ToString()) + Else + wc.RunQuery = False + Return wc + End If + + HttpContext.Current.Session("PersonalRankTableControlWhereClause") = selectedRecordKeyValue.ToXmlString() + + Return wc + End Function + + + Public Overridable Function CreateWhereClause(ByVal searchText as String, ByVal fromSearchControl as String, ByVal AutoTypeAheadSearch as String, ByVal AutoTypeAheadWordSeparators as String) As WhereClause + ' This CreateWhereClause is used for loading list of suggestions for Auto Type-Ahead feature. + PersonalRankTable.Instance.InnerFilter = Nothing + Dim wc As WhereClause = New WhereClause() + + ' Compose the WHERE clause consiting of: + ' 1. Static clause defined at design time. + ' 2. User selected search criteria. + ' 3. User selected filter criteria. + + Dim appRelativeVirtualPath As String = CType(HttpContext.Current.Session("AppRelativeVirtualPath"), String) + + Dim selectedRecordInPersonalIdRecordControl as String = DirectCast(HttpContext.Current.Session("PersonalRankTableControlWhereClause"), String) + + If Not selectedRecordInPersonalIdRecordControl Is Nothing AndAlso KeyValue.IsXmlKey(selectedRecordInPersonalIdRecordControl) Then + Dim selectedRecordKeyValue as KeyValue = KeyValue.XmlToKey(selectedRecordInPersonalIdRecordControl) + + If Not IsNothing(selectedRecordKeyValue) AndAlso selectedRecordKeyValue.ContainsColumn(PersonalRankTable.PersonalId) Then + wc.iAND(PersonalRankTable.PersonalId, BaseFilter.ComparisonOperator.EqualsTo, selectedRecordKeyValue.GetColumnValue(PersonalRankTable.PersonalId).ToString()) + End If + + End If + + ' Adds clauses if values are selected in Filter controls which are configured in the page. + + + Return wc + End Function + + + Public Overridable Function FormatSuggestions(ByVal prefixText As String, ByVal resultItem As String, _ + ByVal columnLength As Integer, ByVal AutoTypeAheadDisplayFoundText As String, _ + ByVal autoTypeAheadSearch As String, ByVal AutoTypeAheadWordSeparators As String, _ + ByVal resultList As ArrayList) As Boolean + + 'Formats the resultItem and adds it to the list of suggestions. + Dim index As Integer = resultItem.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture).IndexOf(prefixText.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture)) + Dim itemToAdd As String = "" + Dim isFound As Boolean = False + Dim isAdded As Boolean = False + ' Get the index where prfixt is at the beginning of resultItem. If not found then, index of word which begins with prefixText. + If InvariantLCase(autoTypeAheadSearch).equals("wordsstartingwithsearchstring") And Not index = 0 Then + ' Expression to find word which contains AutoTypeAheadWordSeparators followed by prefixText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex( AutoTypeAheadWordSeparators + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + If regex1.IsMatch(resultItem) Then + index = regex1.Match(resultItem).Index + isFound = True + End If + ' If the prefixText is found immediatly after white space then starting of the word is found so don not search any further + If not resultItem(index).ToString() = " " Then + ' Expression to find beginning of the word which contains AutoTypeAheadWordSeparators followed by prefixText + Dim regex As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\\S*" + AutoTypeAheadWordSeparators + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + If regex.IsMatch(resultItem) Then + index = regex.Match(resultItem).Index + isFound = True + End If + End If + End If + + ' If autoTypeAheadSearch value is wordsstartingwithsearchstring then, extract the substring only if the prefixText is found at the + ' beginning of the resultItem (index = 0) or a word in resultItem is found starts with prefixText. + If index = 0 Or isFound Or InvariantLCase(autoTypeAheadSearch).Equals("anywhereinstring") then + If InvariantLCase(AutoTypeAheadDisplayFoundText).equals("atbeginningofmatchedstring") Then + ' Expression to find beginning of the word which contains prefixText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\\S*" + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + ' Find the beginning of the word which contains prefexText + If (StringUtils.InvariantLCase(autoTypeAheadSearch).Equals("anywhereinstring") AndAlso regex1.IsMatch(resultItem)) Then + index = regex1.Match(resultItem).Index + isFound = True + End If + ' Display string from the index till end of the string if sub string from index till end is less than columnLength value. + If Len(resultItem) - index <= columnLength Then + If index = 0 Then + itemToAdd = resultItem + Else + itemToAdd = "..." & resultItem.Substring(index, Len(resultItem) - index) + End If + Else + If index = 0 Then + itemToAdd = resultItem.Substring(index, (columnLength - 3)) & "..." + Else + 'Truncate the string to show only columnLength - 6 characters as begining and trailing "..." has to be appended. + itemToAdd = "..." & resultItem.Substring(index , columnLength - 6) & "..." + End If + End If + ElseIf InvariantLCase(AutoTypeAheadDisplayFoundText).equals("inmiddleofmatchedstring") Then + Dim subStringBeginIndex As Integer = CType(columnLength/2, Integer) + If Len(resultItem) <= columnLength Then + itemToAdd = resultItem + Else + ' Sanity check at end of the string + If index + Len(prefixText) = columnLength Then + itemToAdd = "..." & resultItem.Substring(index-columnLength,index) + ElseIf Len(resultItem) - index < subStringBeginIndex Then + ' Display string from the end till columnLength value if, index is closer to the end of the string. + itemToAdd = "..." & resultItem.Substring(Len(resultItem)-columnLength,Len(resultItem)) + ElseIf index <= subStringBeginIndex Then + ' Sanity chet at beginning of the string + itemToAdd = resultItem.Substring(0, columnLength) & "..." + Else + ' Display string containing text before the prefixText occures and text after the prefixText + itemToAdd = "..." & resultItem.Substring(index - subStringBeginIndex, columnLength) & "..." + End If + End If + ElseIf InvariantLCase(AutoTypeAheadDisplayFoundText).equals("atendofmatchedstring") Then + ' Expression to find ending of the word which contains prefexText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\s", System.Text.RegularExpressions.RegexOptions.IgnoreCase) + ' Find the ending of the word which contains prefexText + If regex1.IsMatch(resultItem, index + 1) Then + index = regex1.Match(resultItem, index + 1).Index + Else + ' If the word which contains prefexText is the last word in string, regex1.IsMatch returns false. + index = resultItem.Length + End If + If index > Len(resultItem) Then + index = Len(resultItem) + End If + ' If text from beginning of the string till index is less than columnLength value then, display string from the beginning till index. + If index <= columnLength Then + if index = Len(resultItem) Then 'Make decision to append "..." + itemToAdd = resultItem.Substring(0,index) + Else + itemToAdd = resultItem.Substring(0,index) & "..." + End If + Else + If index = Len(resultItem) Then + itemToAdd = "..." & resultItem.Substring(index - (columnLength - 3), (columnLength - 3)) + Else + 'Truncate the string to show only columnLength - 6 characters as begining and trailing "..." has to be appended. + itemToAdd = "..." & resultItem.Substring(index - (columnLength - 6), columnLength - 6) & "..." + End If + End If + End If + + ' Remove newline character from itemToAdd + Dim prefixTextIndex As Integer = itemToAdd.IndexOf(prefixText, StringComparison.CurrentCultureIgnoreCase) + ' If itemToAdd contains any newline after the search text then show text only till newline + Dim regex2 As System.Text.RegularExpressions.Regex = New System.Text.RegularExpressions.Regex("(" & vbCrLf & "|" & vbLf & ")", System.Text.RegularExpressions.RegexOptions.IgnoreCase) + Dim newLineIndexAfterPrefix As Integer = -1 + If regex2.IsMatch(itemToAdd, prefixTextIndex) Then + newLineIndexAfterPrefix = regex2.Match(itemToAdd, prefixTextIndex).Index + End If + If (newLineIndexAfterPrefix > -1) Then + If itemToAdd.EndsWith("...") Then + itemToAdd = (itemToAdd.Substring(0, newLineIndexAfterPrefix) + "...") + Else + itemToAdd = itemToAdd.Substring(0, newLineIndexAfterPrefix) + End If + End If + ' If itemToAdd contains any newline before search text then show text which comes after newline + Dim regex3 As System.Text.RegularExpressions.Regex = New System.Text.RegularExpressions.Regex("(" & vbCrLf & "|" & vbLf & ")", (System.Text.RegularExpressions.RegexOptions.IgnoreCase Or System.Text.RegularExpressions.RegexOptions.RightToLeft)) + Dim newLineIndexBeforePrefix As Integer = -1 + If regex3.IsMatch(itemToAdd, prefixTextIndex) Then + newLineIndexBeforePrefix = regex3.Match(itemToAdd, prefixTextIndex).Index + End If + If (newLineIndexBeforePrefix > -1) Then + If itemToAdd.StartsWith("...") Then + itemToAdd = ("..." + itemToAdd.Substring((newLineIndexBeforePrefix + regex3.Match(itemToAdd, prefixTextIndex).Length))) + Else + itemToAdd = itemToAdd.Substring((newLineIndexBeforePrefix + regex3.Match(itemToAdd, prefixTextIndex).Length)) + End If + End If + + If Not itemToAdd is nothing AndAlso Not resultList.Contains(itemToAdd) Then + + resultList.Add(itemToAdd) + + isAdded = true + End If + End If + Return isAdded + End Function + + + Protected Overridable Sub GetPageSize() + + If Me.PersonalRankPagination.PageSize.Text.Trim <> "" Then + Try + 'Me.PageSize = Integer.Parse(Me.PersonalRankPagination.PageSize.Text) + Catch ex As Exception + End Try + End If + End Sub + + Protected Overridable Sub AddNewRecords() + + Dim newRecordList As ArrayList = New ArrayList() + + Dim newUIDataList As System.Collections.Generic.List(Of Hashtable) = New System.Collections.Generic.List(Of Hashtable)() + + ' Loop though all the record controls and if the record control + ' does not have a unique record id set, then create a record + ' and add to the list. + If Not Me.ResetData Then + Dim rep As System.Web.UI.WebControls.Repeater = CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalRankTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return + + Dim repItem As System.Web.UI.WebControls.RepeaterItem + For Each repItem In rep.Items + ' Loop through all rows in the table, set its DataSource and call DataBind(). + + Dim recControl As PersonalRankTableControlRow = DirectCast(repItem.FindControl("PersonalRankTableControlRow"), PersonalRankTableControlRow) + + If recControl.Visible AndAlso recControl.IsNewRecord() Then + + Dim rec As PersonalRankRecord = New PersonalRankRecord() + + If recControl.GazetteDate1.Text <> "" Then + rec.Parse(recControl.GazetteDate1.Text, PersonalRankTable.GazetteDate) + End If + If recControl.GazetteNO1.Text <> "" Then + rec.Parse(recControl.GazetteNO1.Text, PersonalRankTable.GazetteNO) + End If + If recControl.GazettePage1.Text <> "" Then + rec.Parse(recControl.GazettePage1.Text, PersonalRankTable.GazettePage) + End If + If recControl.GazetteSection1.Text <> "" Then + rec.Parse(recControl.GazetteSection1.Text, PersonalRankTable.GazetteSection) + End If + If recControl.PreRank.Text <> "" Then + rec.Parse(recControl.PreRank.Text, PersonalRankTable.PreRank) + End If + If recControl.RankDate.Text <> "" Then + rec.Parse(recControl.RankDate.Text, PersonalRankTable.RankDate) + End If + If MiscUtils.IsValueSelected(recControl.RankId1) Then + rec.Parse(recControl.RankId1.SelectedItem.Value, PersonalRankTable.RankId) + End If + If recControl.Ref3.Text <> "" Then + rec.Parse(recControl.Ref3.Text, PersonalRankTable.Ref0) + End If + If recControl.RefDate1.Text <> "" Then + rec.Parse(recControl.RefDate1.Text, PersonalRankTable.RefDate) + End If + newUIDataList.Add(recControl.PreservedUIData()) + newRecordList.Add(rec) + End If + Next + End If + + + ' Add any new record to the list. + Dim index As Integer = 0 + For index = 1 To Me.AddNewRecord + + newRecordList.Insert(0, New PersonalRankRecord()) + newUIDataList.Insert(0, New Hashtable()) + + Next + Me.AddNewRecord = 0 + + ' Finally, add any new records to the DataSource. + If newRecordList.Count > 0 Then + + Dim finalList As ArrayList = New ArrayList(Me.DataSource) + finalList.InsertRange(0, newRecordList) + + Me.DataSource = DirectCast(finalList.ToArray(GetType(PersonalRankRecord)), PersonalRankRecord()) + + End If + + ' Add the existing UI data to this hash table + If newUIDataList.Count > 0 Then + Me.UIData.InsertRange(0, newUIDataList) + End If + + End Sub + + + Public Sub AddToDeletedRecordIds(ByVal rec As PersonalRankTableControlRow) + If rec.IsNewRecord() Then + Return + End If + + If Not Me.DeletedRecordIds Is Nothing AndAlso Me.DeletedRecordIds.Trim <> "" Then + Me.DeletedRecordIds &= "," + End If + + Me.DeletedRecordIds &= "[" & rec.RecordUniqueId & "]" + End Sub + + Protected Overridable Function InDeletedRecordIds(ByVal rec As PersonalRankTableControlRow) As Boolean + If Me.DeletedRecordIds Is Nothing OrElse Me.DeletedRecordIds.Trim = "" Then + Return False + End If + + Return Me.DeletedRecordIds.IndexOf("[" & rec.RecordUniqueId & "]") >= 0 + End Function + + Private _DeletedRecordIds As String + Public Property DeletedRecordIds() As String + Get + Return Me._DeletedRecordIds + End Get + Set(ByVal value As String) + Me._DeletedRecordIds = value + End Set + End Property + + + ' Create Set, WhereClause, and Populate Methods + + Public Overridable Sub SetGazetteDateLabel1() + + End Sub + + Public Overridable Sub SetGazetteNOLabel1() + + End Sub + + Public Overridable Sub SetGazettePageLabel1() + + End Sub + + Public Overridable Sub SetGazetteSectionLabel1() + + End Sub + + Public Overridable Sub SetPersonalRankTableControlCollapsibleRegion() + + End Sub + + Public Overridable Sub SetPreRankLabel1() + + End Sub + + Public Overridable Sub SetRankDateLabel() + + End Sub + + Public Overridable Sub SetRankIdLabel2() + + End Sub + + Public Overridable Sub SetRefDateLabel1() + + End Sub + + Public Overridable Sub SetRefLabel2() + + 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. + Dim added As Boolean = Me.AddNewRecord > 0 + Me.LoadData() + Me.DataBind() + + If added Then + Me.SetFocusToAddedRow() + End If + + End If + + + + Catch ex As Exception + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + Finally + DbUtils.EndTransaction + End Try + End Sub + + 'this function sets focus to the first editable element in the new added row in the editable table + Protected Overridable Sub SetFocusToAddedRow() + Dim rep As System.Web.UI.WebControls.Repeater = CType(Me.FindControl("PersonalRankTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing OrElse rep.Items.Count = 0 Then Return + Dim repItem As System.Web.UI.WebControls.RepeaterItem + For Each repItem In rep.Items + 'Load scripts to table rows + Me.Page.LoadFocusScripts(repItem) + Dim recControl As PersonalRankTableControlRow = DirectCast(repItem.FindControl("PersonalRankTableControlRow"), PersonalRankTableControlRow) + If recControl.IsNewRecord Then + For Each field As Control In recControl.Controls + If field.Visible AndAlso Me.Page.IsControlEditable(field, False) Then + 'set focus on the first editable field in the new row + field.Focus() + Dim updPan As UpdatePanel = DirectCast(Me.Page.FindControlRecursively("UpdatePanel1"), UpdatePanel) + If Not updPan Is Nothing Then updPan.Update() + Return + End If + Next + Return + End If + Next + End Sub + + + Protected Overrides Sub SaveControlsToSession() + MyBase.SaveControlsToSession() + + ' Save filter controls to values to session. + + + 'Save pagination state to session. + + + + ' Save table control properties to the session. + If Not Me.CurrentSortOrder Is Nothing Then + Me.SaveToSession(Me, "Order_By", Me.CurrentSortOrder.ToXmlString()) + End If + + Me.SaveToSession(Me, "Page_Index", Me.PageIndex.ToString()) + Me.SaveToSession(Me, "Page_Size", Me.PageSize.ToString()) + + Me.SaveToSession(Me, "DeletedRecordIds", Me.DeletedRecordIds) + + End Sub + + Protected Sub SaveControlsToSession_Ajax() + ' Save filter controls to values to session. + + HttpContext.Current.Session("AppRelativeVirtualPath") = Me.Page.AppRelativeVirtualPath + + End Sub + + Protected Overrides Sub ClearControlsFromSession() + MyBase.ClearControlsFromSession() + + ' Clear filter controls values from the session. + + + ' Clear pagination state from session. + + + + ' Clear table properties from the session. + Me.RemoveFromSession(Me, "Order_By") + Me.RemoveFromSession(Me, "Page_Index") + Me.RemoveFromSession(Me, "Page_Size") + + Me.RemoveFromSession(Me, "DeletedRecordIds") + + End Sub + + Protected Overrides Sub LoadViewState(ByVal savedState As Object) + MyBase.LoadViewState(savedState) + + Dim orderByStr As String = CType(ViewState("PersonalRankTableControl_OrderBy"), String) + + If orderByStr IsNot Nothing AndAlso orderByStr.Trim <> "" Then + Me.CurrentSortOrder = BaseClasses.Data.OrderBy.FromXmlString(orderByStr) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + End If + + Dim pageIndex As String = CType(ViewState("Page_Index"), String) + If pageIndex IsNot Nothing Then + Me.PageIndex = CInt(pageIndex) + End If + + Dim pageSize As String = CType(ViewState("Page_Size"), String) + If Not pageSize Is Nothing Then + Me.PageSize = CInt(pageSize) + End If + + + + ' Load view state for pagination control. + + Me.DeletedRecordIds = CType(Me.ViewState("DeletedRecordIds"), String) + + End Sub + + Protected Overrides Function SaveViewState() As Object + + If Me.CurrentSortOrder IsNot Nothing Then + Me.ViewState("PersonalRankTableControl_OrderBy") = Me.CurrentSortOrder.ToXmlString() + End If + + Me.ViewState("Page_Index") = Me.PageIndex + Me.ViewState("Page_Size") = Me.PageSize + + Me.ViewState("DeletedRecordIds") = Me.DeletedRecordIds + + + ' Load view state for pagination control. + + + Return MyBase.SaveViewState() + End Function + + ' Generate the event handling functions for pagination events. + + ' event handler for ImageButton + Public Overridable Sub PersonalRankPagination_FirstPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.PageIndex = 0 + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalRankPagination_LastPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.DisplayLastPage = True + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalRankPagination_NextPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.PageIndex += 1 + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for LinkButton + Public Overridable Sub PersonalRankPagination_PageSizeButton_Click(ByVal sender As Object, ByVal args As EventArgs) + + Try + + Me.DataChanged = True + + Me.PageSize = Integer.Parse(Me.PersonalRankPagination.PageSize.Text) + + Me.PageIndex = Integer.Parse(Me.PersonalRankPagination.CurrentPage.Text) - 1 + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalRankPagination_PreviousPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + If Me.PageIndex > 0 Then + Me.PageIndex -= 1 + Me.DataChanged = True + End If + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + + ' Generate the event handling functions for sorting events. + + Public Overridable Sub GazetteDateLabel1_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by GazetteDate when clicked. + + ' Get previous sorting state for GazetteDate. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalRankTable.GazetteDate) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for GazetteDate. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalRankTable.GazetteDate, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by GazetteDate, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub GazetteNOLabel1_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by GazetteNO when clicked. + + ' Get previous sorting state for GazetteNO. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalRankTable.GazetteNO) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for GazetteNO. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalRankTable.GazetteNO, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by GazetteNO, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub GazettePageLabel1_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by GazettePage when clicked. + + ' Get previous sorting state for GazettePage. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalRankTable.GazettePage) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for GazettePage. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalRankTable.GazettePage, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by GazettePage, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub GazetteSectionLabel1_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by GazetteSection when clicked. + + ' Get previous sorting state for GazetteSection. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalRankTable.GazetteSection) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for GazetteSection. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalRankTable.GazetteSection, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by GazetteSection, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub PreRankLabel1_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by PreRank when clicked. + + ' Get previous sorting state for PreRank. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalRankTable.PreRank) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for PreRank. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalRankTable.PreRank, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by PreRank, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub RankDateLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by RankDate when clicked. + + ' Get previous sorting state for RankDate. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalRankTable.RankDate) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for RankDate. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalRankTable.RankDate, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by RankDate, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub RankIdLabel2_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by RankId when clicked. + + ' Get previous sorting state for RankId. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalRankTable.RankId) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for RankId. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalRankTable.RankId, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by RankId, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub RefDateLabel1_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by RefDate when clicked. + + ' Get previous sorting state for RefDate. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalRankTable.RefDate) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for RefDate. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalRankTable.RefDate, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by RefDate, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub RefLabel2_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by Ref when clicked. + + ' Get previous sorting state for Ref. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalRankTable.Ref0) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for Ref. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalRankTable.Ref0, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by Ref, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + + ' Generate the event handling functions for button events. + + ' event handler for ImageButton + Public Overridable Sub PersonalRankAddButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + Me.AddNewRecord = 1 + Me.DataChanged = True + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalRankDeleteButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + If(Not Me.Page.IsPageRefresh) Then + + Me.DeleteSelectedRecords(True) + Me.SetFormulaControls() + + + End If + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalRankResetButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.CurrentSortOrder.Reset() + If Me.InSession(Me, "Order_By") Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + + End If + + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + + + ' Generate the event handling functions for filter and search events. + + + ' Generate the event handling functions for others + + + Private _UIData As New System.Collections.Generic.List(Of Hashtable) + Public Property UIData() As System.Collections.Generic.List(Of Hashtable) + Get + Return Me._UIData + End Get + Set(ByVal value As System.Collections.Generic.List(Of Hashtable)) + Me._UIData = value + End Set + End Property + + ' pagination properties + Protected _PageSize As Integer + Public Property PageSize() As Integer + Get + Return Me._PageSize + End Get + Set(ByVal value As Integer) + Me._PageSize = value + End Set + End Property + + Protected _PageIndex As Integer + Public Property PageIndex() As Integer + Get + ' Return the PageIndex + Return Me._PageIndex + End Get + Set(ByVal value As Integer) + Me._PageIndex = value + End Set + End Property + + Protected _TotalRecords As Integer = -1 + Public Property TotalRecords() As Integer + Get + If _TotalRecords < 0 + _TotalRecords = PersonalRankTable.GetRecordCount(CreateCompoundJoinFilter(), CreateWhereClause()) + End If + Return Me._TotalRecords + End Get + Set(ByVal value As Integer) + If Me.PageSize > 0 Then + + Me.TotalPages = CInt(Math.Ceiling(value / Me.PageSize)) + + End If + Me._TotalRecords = value + End Set + End Property + + + + Protected _TotalPages As Integer = -1 + Public Property TotalPages() As Integer + Get + If _TotalPages < 0 Then + + Me.TotalPages = CInt(Math.Ceiling(TotalRecords / Me.PageSize)) + + End If + Return Me._TotalPages + End Get + Set(ByVal value As Integer) + Me._TotalPages = value + End Set + End Property + + Protected _DisplayLastPage As Boolean + Public Property DisplayLastPage() As Boolean + Get + Return Me._DisplayLastPage + End Get + Set(ByVal value As Boolean) + Me._DisplayLastPage = value + End Set + End Property + + Private _DataChanged As Boolean = False + Public Property DataChanged() As Boolean + Get + Return Me._DataChanged + End Get + Set(ByVal value As Boolean) + Me._DataChanged = value + End Set + End Property + + Private _ResetData As Boolean = False + Public Property ResetData() As Boolean + Get + Return Me._ResetData + End Get + Set(ByVal value As Boolean) + Me._ResetData = value + End Set + End Property + + Private _AddNewRecord As Integer = 0 + Public Property AddNewRecord() As Integer + Get + Return Me._AddNewRecord + End Get + Set(ByVal value As Integer) + Me._AddNewRecord = value + End Set + End Property + + + Private _CurrentSortOrder As OrderBy = Nothing + Public Property CurrentSortOrder() As OrderBy + Get + Return Me._CurrentSortOrder + End Get + Set(ByVal value As BaseClasses.Data.OrderBy) + Me._CurrentSortOrder = value + End Set + End Property + + Private _DataSource() As PersonalRankRecord = Nothing + Public Property DataSource() As PersonalRankRecord () + Get + Return Me._DataSource + End Get + Set(ByVal value() As PersonalRankRecord) + Me._DataSource = value + End Set + End Property + +#Region "Helper Properties" + + Public ReadOnly Property GazetteDateLabel1() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "GazetteDateLabel1"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property GazetteNOLabel1() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "GazetteNOLabel1"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property GazettePageLabel1() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "GazettePageLabel1"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property GazetteSectionLabel1() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "GazetteSectionLabel1"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property PersonalRankAddButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalRankAddButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalRankDeleteButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalRankDeleteButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalRankPagination() As Persons.UI.IPagination + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalRankPagination"), Persons.UI.IPagination) + End Get + End Property + + Public ReadOnly Property PersonalRankResetButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalRankResetButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalRankTableControlCollapsibleRegion() As System.Web.UI.WebControls.Panel + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalRankTableControlCollapsibleRegion"), System.Web.UI.WebControls.Panel) + End Get + End Property + + Public ReadOnly Property PersonalRankToggleAll() As System.Web.UI.WebControls.CheckBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalRankToggleAll"), System.Web.UI.WebControls.CheckBox) + End Get + End Property + + Public ReadOnly Property PreRankLabel1() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PreRankLabel1"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property RankDateLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RankDateLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property RankIdLabel2() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RankIdLabel2"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property RefDateLabel1() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RefDateLabel1"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property RefLabel2() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RefLabel2"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + +#End Region + +#Region "Helper Functions" + + Public Overrides Overloads Function ModifyRedirectUrl(url As String, arg As String, ByVal bEncrypt As Boolean) As String + Return Me.Page.EvaluateExpressions(url, arg, bEncrypt, Me) + End Function + + Public Overrides Overloads Function EvaluateExpressions(url As String, arg As String, ByVal bEncrypt As Boolean) As String + Dim needToProcess As Boolean = AreAnyUrlParametersForMe(url, arg) + If (needToProcess) Then + Dim recCtl As PersonalRankTableControlRow = Me.GetSelectedRecordControl() + If recCtl Is Nothing AndAlso url.IndexOf("{") >= 0 Then + ' Localization. + Throw New Exception(Page.GetResourceValue("Err:NoRecSelected", "Persons")) + End If + Dim rec As PersonalRankRecord = Nothing + If recCtl IsNot Nothing Then + rec = recCtl.GetRecord() + End If + Return EvaluateExpressions(url, arg, rec, bEncrypt) + End If + Return url + End Function + + Public Overridable Function GetSelectedRecordIndex() As Integer + Dim counter As Integer = 0 + Dim recControl As PersonalRankTableControlRow + For Each recControl In Me.GetRecordControls() + If recControl.PersonalRankRecordRowSelection.Checked Then + Return counter + End If + counter += 1 + Next + Return -1 + End Function + + Public Overridable Function GetSelectedRecordControl() As PersonalRankTableControlRow + Dim selectedList() As PersonalRankTableControlRow = Me.GetSelectedRecordControls() + If selectedList.Length = 0 Then + Return Nothing + End If + Return selectedList(0) + + End Function + + Public Overridable Function GetSelectedRecordControls() As PersonalRankTableControlRow() + + Dim selectedList As ArrayList = New ArrayList(25) + Dim recControl As PersonalRankTableControlRow + For Each recControl In Me.GetRecordControls() + If recControl.PersonalRankRecordRowSelection IsNot Nothing AndAlso recControl.PersonalRankRecordRowSelection.Checked Then + selectedList.Add(recControl) + End If + Next + Return DirectCast(selectedList.ToArray(GetType(PersonalRankTableControlRow)), PersonalRankTableControlRow()) + + End Function + + Public Overridable Sub DeleteSelectedRecords(ByVal deferDeletion As Boolean) + Dim recList() As PersonalRankTableControlRow = Me.GetSelectedRecordControls() + If recList.Length = 0 Then + ' Localization. + Throw New Exception(Page.GetResourceValue("Err:NoRecSelected", "Persons")) + End If + + Dim recCtl As PersonalRankTableControlRow + For Each recCtl In recList + If deferDeletion Then + If Not recCtl.IsNewRecord Then + + Me.AddToDeletedRecordIds(recCtl) + + End If + recCtl.Visible = False + + recCtl.PersonalRankRecordRowSelection.Checked = False + + Else + + recCtl.Delete() + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + End If + Next + End Sub + + Public Function GetRecordControls() As PersonalRankTableControlRow() + Dim recList As ArrayList = New ArrayList() + Dim rep As System.Web.UI.WebControls.Repeater = CType(Me.FindControl("PersonalRankTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return Nothing + Dim repItem As System.Web.UI.WebControls.RepeaterItem + + For Each repItem In rep.Items + + Dim recControl As PersonalRankTableControlRow = DirectCast(repItem.FindControl("PersonalRankTableControlRow"), PersonalRankTableControlRow) + recList.Add(recControl) + + Next + + Return DirectCast(recList.ToArray(GetType(PersonalRankTableControlRow)), PersonalRankTableControlRow()) + End Function + + Public Shadows ReadOnly Property Page() As BaseApplicationPage + Get + Return DirectCast(MyBase.Page, BaseApplicationPage) + End Get + End Property + +#End Region + + + +End Class + + +' Base class for the PersonalSalaryTableControlRow control on the AddPersonalId page. +' Do not modify this class. Instead override any method in PersonalSalaryTableControlRow. +Public Class BasePersonalSalaryTableControlRow + Inherits Persons.UI.BaseApplicationRecordControl + + ' To customize, override this method in PersonalSalaryTableControlRow. + Protected Overridable Sub Control_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Init + + Me.ClearControlsFromSession() + End Sub + + ' To customize, override this method in PersonalSalaryTableControlRow. + Protected Overridable Sub Control_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load + + 'Call LoadFocusScripts from repeater so that onfocus attribute could be added to elements + Me.Page.LoadFocusScripts(Me) + + ' Show confirmation message on Click + Me.PersonalSalaryRowDeleteButton.Attributes.Add("onClick", "return (confirm('" & (CType(Me.Page,BaseApplicationPage)).GetResourceValue("DeleteRecordConfirm", "Persons") & "'));") + + + ' Register the event handlers. + + AddHandler Me.PersonalSalaryRowDeleteButton.Click, AddressOf PersonalSalaryRowDeleteButton_Click + + AddHandler Me.CommandDate2.TextChanged, AddressOf CommandDate2_TextChanged + + AddHandler Me.PositionSalary.TextChanged, AddressOf PositionSalary_TextChanged + + AddHandler Me.SalaryAmout.TextChanged, AddressOf SalaryAmout_TextChanged + + AddHandler Me.SalaryCommand.TextChanged, AddressOf SalaryCommand_TextChanged + + AddHandler Me.SalaryDate.TextChanged, AddressOf SalaryDate_TextChanged + + AddHandler Me.SalaryExtra_NotUsed.TextChanged, AddressOf SalaryExtra_NotUsed_TextChanged + + AddHandler Me.SalaryPlus.TextChanged, AddressOf SalaryPlus_TextChanged + + AddHandler Me.SalaryRank.TextChanged, AddressOf SalaryRank_TextChanged + + AddHandler Me.SalaryRound.TextChanged, AddressOf SalaryRound_TextChanged + + AddHandler Me.SalaryStep.TextChanged, AddressOf SalaryStep_TextChanged + + AddHandler Me.SalaryYear.TextChanged, AddressOf SalaryYear_TextChanged + + + End Sub + + + Public Overridable Sub LoadData() + + ' Load the data from the database into the DataSource PersonalSalary 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 = PersonalSalaryTable.GetRecord(Me.RecordUniqueId, True) + + Return + End If + + ' Since this is a row in the table, the data for this row is loaded by the + ' LoadData method of the BasePersonalSalaryTableControl when the data for the entire + ' table is loaded. + + Me.DataSource = New PersonalSalaryRecord() + + + + End Sub + + ' Populate the UI controls using the DataSource. To customize, override this method in PersonalSalaryTableControlRow. + 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 + + SetCommandDate2() + + + SetPositionSalary() + SetSalaryAmout() + SetSalaryCommand() + SetSalaryDate() + SetSalaryExtra_NotUsed() + SetSalaryPlus() + SetSalaryRank() + SetSalaryRound() + SetSalaryStep() + SetSalaryYear() + + + 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 SetCommandDate2() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.CommandDate2.ID) Then + + Me.CommandDate2.Text = Me.PreviousUIData(Me.CommandDate2.ID).ToString() + + Return + End If + + + ' Set the CommandDate TextBox on the webpage with value from the + ' PersonalSalary database record. + + ' Me.DataSource is the PersonalSalary record retrieved from the database. + ' Me.CommandDate2 is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetCommandDate2() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.CommandDateSpecified Then + + ' If the CommandDate is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalSalaryTable.CommandDate, "d MMM yyyy") + + Me.CommandDate2.Text = formattedValue + + Else + + ' CommandDate is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.CommandDate2.Text = PersonalSalaryTable.CommandDate.Format(PersonalSalaryTable.CommandDate.DefaultValue, "d MMM yyyy") + + End If + + End Sub + + Public Overridable Sub SetPositionSalary() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.PositionSalary.ID) Then + + Me.PositionSalary.Text = Me.PreviousUIData(Me.PositionSalary.ID).ToString() + + Return + End If + + + ' Set the PositionSalary TextBox on the webpage with value from the + ' PersonalSalary database record. + + ' Me.DataSource is the PersonalSalary record retrieved from the database. + ' Me.PositionSalary is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetPositionSalary() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.PositionSalarySpecified Then + + ' If the PositionSalary is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalSalaryTable.PositionSalary, "#####") + + Me.PositionSalary.Text = formattedValue + + Else + + ' PositionSalary is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.PositionSalary.Text = PersonalSalaryTable.PositionSalary.Format(PersonalSalaryTable.PositionSalary.DefaultValue, "#####") + + End If + + End Sub + + Public Overridable Sub SetSalaryAmout() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.SalaryAmout.ID) Then + + Me.SalaryAmout.Text = Me.PreviousUIData(Me.SalaryAmout.ID).ToString() + + Return + End If + + + ' Set the SalaryAmout TextBox on the webpage with value from the + ' PersonalSalary database record. + + ' Me.DataSource is the PersonalSalary record retrieved from the database. + ' Me.SalaryAmout is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetSalaryAmout() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.SalaryAmoutSpecified Then + + ' If the SalaryAmout is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalSalaryTable.SalaryAmout, "#,###") + + Me.SalaryAmout.Text = formattedValue + + Else + + ' SalaryAmout is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.SalaryAmout.Text = PersonalSalaryTable.SalaryAmout.Format(PersonalSalaryTable.SalaryAmout.DefaultValue, "#,###") + + End If + + End Sub + + Public Overridable Sub SetSalaryCommand() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.SalaryCommand.ID) Then + + Me.SalaryCommand.Text = Me.PreviousUIData(Me.SalaryCommand.ID).ToString() + + Return + End If + + + ' Set the SalaryCommand TextBox on the webpage with value from the + ' PersonalSalary database record. + + ' Me.DataSource is the PersonalSalary record retrieved from the database. + ' Me.SalaryCommand is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetSalaryCommand() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.SalaryCommandSpecified Then + + ' If the SalaryCommand is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalSalaryTable.SalaryCommand) + + Me.SalaryCommand.Text = formattedValue + + Else + + ' SalaryCommand is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.SalaryCommand.Text = PersonalSalaryTable.SalaryCommand.Format(PersonalSalaryTable.SalaryCommand.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetSalaryDate() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.SalaryDate.ID) Then + + Me.SalaryDate.Text = Me.PreviousUIData(Me.SalaryDate.ID).ToString() + + Return + End If + + + ' Set the SalaryDate TextBox on the webpage with value from the + ' PersonalSalary database record. + + ' Me.DataSource is the PersonalSalary record retrieved from the database. + ' Me.SalaryDate is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetSalaryDate() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.SalaryDateSpecified Then + + ' If the SalaryDate is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalSalaryTable.SalaryDate, "d MMM yyyy") + + Me.SalaryDate.Text = formattedValue + + Else + + ' SalaryDate is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.SalaryDate.Text = PersonalSalaryTable.SalaryDate.Format(PersonalSalaryTable.SalaryDate.DefaultValue, "d MMM yyyy") + + End If + + End Sub + + Public Overridable Sub SetSalaryExtra_NotUsed() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.SalaryExtra_NotUsed.ID) Then + + Me.SalaryExtra_NotUsed.Text = Me.PreviousUIData(Me.SalaryExtra_NotUsed.ID).ToString() + + Return + End If + + + ' Set the SalaryExtra_NotUsed TextBox on the webpage with value from the + ' PersonalSalary database record. + + ' Me.DataSource is the PersonalSalary record retrieved from the database. + ' Me.SalaryExtra_NotUsed is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetSalaryExtra_NotUsed() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.SalaryExtra_NotUsedSpecified Then + + ' If the SalaryExtra_NotUsed is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalSalaryTable.SalaryExtra_NotUsed) + + Me.SalaryExtra_NotUsed.Text = formattedValue + + Else + + ' SalaryExtra_NotUsed is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.SalaryExtra_NotUsed.Text = PersonalSalaryTable.SalaryExtra_NotUsed.Format(PersonalSalaryTable.SalaryExtra_NotUsed.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetSalaryPlus() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.SalaryPlus.ID) Then + + Me.SalaryPlus.Text = Me.PreviousUIData(Me.SalaryPlus.ID).ToString() + + Return + End If + + + ' Set the SalaryPlus TextBox on the webpage with value from the + ' PersonalSalary database record. + + ' Me.DataSource is the PersonalSalary record retrieved from the database. + ' Me.SalaryPlus is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetSalaryPlus() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.SalaryPlusSpecified Then + + ' If the SalaryPlus is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalSalaryTable.SalaryPlus, "#####") + + Me.SalaryPlus.Text = formattedValue + + Else + + ' SalaryPlus is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.SalaryPlus.Text = PersonalSalaryTable.SalaryPlus.Format(PersonalSalaryTable.SalaryPlus.DefaultValue, "#####") + + End If + + End Sub + + Public Overridable Sub SetSalaryRank() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.SalaryRank.ID) Then + + Me.SalaryRank.Text = Me.PreviousUIData(Me.SalaryRank.ID).ToString() + + Return + End If + + + ' Set the SalaryRank TextBox on the webpage with value from the + ' PersonalSalary database record. + + ' Me.DataSource is the PersonalSalary record retrieved from the database. + ' Me.SalaryRank is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetSalaryRank() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.SalaryRankSpecified Then + + ' If the SalaryRank is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalSalaryTable.SalaryRank) + + Me.SalaryRank.Text = formattedValue + + Else + + ' SalaryRank is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.SalaryRank.Text = PersonalSalaryTable.SalaryRank.Format(PersonalSalaryTable.SalaryRank.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetSalaryRound() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.SalaryRound.ID) Then + + Me.SalaryRound.Text = Me.PreviousUIData(Me.SalaryRound.ID).ToString() + + Return + End If + + + ' Set the SalaryRound TextBox on the webpage with value from the + ' PersonalSalary database record. + + ' Me.DataSource is the PersonalSalary record retrieved from the database. + ' Me.SalaryRound is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetSalaryRound() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.SalaryRoundSpecified Then + + ' If the SalaryRound is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalSalaryTable.SalaryRound) + + Me.SalaryRound.Text = formattedValue + + Else + + ' SalaryRound is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.SalaryRound.Text = PersonalSalaryTable.SalaryRound.Format(PersonalSalaryTable.SalaryRound.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetSalaryStep() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.SalaryStep.ID) Then + + Me.SalaryStep.Text = Me.PreviousUIData(Me.SalaryStep.ID).ToString() + + Return + End If + + + ' Set the SalaryStep TextBox on the webpage with value from the + ' PersonalSalary database record. + + ' Me.DataSource is the PersonalSalary record retrieved from the database. + ' Me.SalaryStep is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetSalaryStep() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.SalaryStepSpecified Then + + ' If the SalaryStep is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalSalaryTable.SalaryStep) + + Me.SalaryStep.Text = formattedValue + + Else + + ' SalaryStep is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.SalaryStep.Text = PersonalSalaryTable.SalaryStep.Format(PersonalSalaryTable.SalaryStep.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetSalaryYear() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.SalaryYear.ID) Then + + Me.SalaryYear.Text = Me.PreviousUIData(Me.SalaryYear.ID).ToString() + + Return + End If + + + ' Set the SalaryYear TextBox on the webpage with value from the + ' PersonalSalary database record. + + ' Me.DataSource is the PersonalSalary record retrieved from the database. + ' Me.SalaryYear is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetSalaryYear() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.SalaryYearSpecified Then + + ' If the SalaryYear is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalSalaryTable.SalaryYear) + + Me.SalaryYear.Text = formattedValue + + Else + + ' SalaryYear is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.SalaryYear.Text = PersonalSalaryTable.SalaryYear.Format(PersonalSalaryTable.SalaryYear.DefaultValue) + + End If + + End Sub + + + Public EvaluateFormulaDelegate As BaseClasses.Data.DataSource.EvaluateFormulaDelegate = New BaseClasses.Data.DataSource.EvaluateFormulaDelegate(AddressOf Me.EvaluateFormula) + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean, ByVal e As FormulaEvaluator) As String + If e Is Nothing Then + e = New FormulaEvaluator() + End If + + e.Variables.Clear() + + + ' add variables for formula evaluation + If variables IsNot Nothing Then + Dim enumerator As System.Collections.Generic.IEnumerator(Of System.Collections.Generic.KeyValuePair(Of String, Object)) = variables.GetEnumerator() + While enumerator.MoveNext() + e.Variables.Add(enumerator.Current.Key, enumerator.Current.Value) + End While + End If + + If includeDS + + End IF + + + ' Other variables referred to in the formula are expected to be + ' properties of the DataSource. For example, referring to + ' UnitPrice as a variable will refer to DataSource.UnitPrice + If dataSourceForEvaluate Is Nothing Then + + e.DataSource = Me.DataSource + + Else + e.DataSource = dataSourceForEvaluate + End If + + ' Define the calling control. This is used to add other + ' related table and record controls as variables. + e.CallingControl = Me + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + + If Not String.IsNullOrEmpty(format) AndAlso (String.IsNullOrEmpty(formula) OrElse formula.IndexOf("Format(") < 0) Then + Return FormulaUtils.Format(resultObj, format) + Else + Return resultObj.ToString() + End If + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format,variables ,includeDS, Nothing) + End Function + + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object)) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format, variables ,True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, format, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal e as FormulaEvaluator) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, variables, True, e) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal includeDS as Boolean) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, includeDS, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, True, Nothing) + End Function + + + Public Overridable Sub RegisterPostback() + + + End Sub + + + + ' To customize, override this method in PersonalSalaryTableControlRow. + 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 parentCtrl As PersonalIdRecordControl + + + parentCtrl = DirectCast(Me.Page.FindControlRecursively("PersonalIdRecordControl"), PersonalIdRecordControl) + + If (Not IsNothing(parentCtrl) AndAlso IsNothing(parentCtrl.DataSource)) + ' Load the record if it is not loaded yet. + parentCtrl.LoadData() + End If + If (IsNothing(parentCtrl) OrElse IsNothing(parentCtrl.DataSource)) + ' Get the error message from the application resource file. + Throw New Exception(Page.GetResourceValue("Err:NoParentRecId", "Persons")) + End If + + Me.DataSource.PersonalId = parentCtrl.DataSource.PersonalId + + ' 2. Perform any custom validation. + Me.Validate() + + + ' 3. Set the values in the record with data from UI controls. + ' This calls the Get() method for each of the user interface controls. + Me.GetUIData() + + ' 4. Save in the database. + ' We should not save the record if the data did not change. This + ' will save a database hit and avoid triggering any database triggers. + + If Me.DataSource.IsAnyValueChanged Then + ' Save record to database but do not commit yet. + ' Auto generated ids are available after saving for use by child (dependent) records. + Me.DataSource.Save() + + DirectCast(GetParentControlObject(Me, "PersonalSalaryTableControl"), PersonalSalaryTableControl).DataChanged = True + DirectCast(GetParentControlObject(Me, "PersonalSalaryTableControl"), PersonalSalaryTableControl).ResetData = True + End If + + + ' update session or cookie by formula + + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + ' For Master-Detail relationships, save data on the Detail table(s) + + End Sub + + ' To customize, override this method in PersonalSalaryTableControlRow. + 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. + + GetCommandDate2() + GetPositionSalary() + GetSalaryAmout() + GetSalaryCommand() + GetSalaryDate() + GetSalaryExtra_NotUsed() + GetSalaryPlus() + GetSalaryRank() + GetSalaryRound() + GetSalaryStep() + GetSalaryYear() + End Sub + + + Public Overridable Sub GetCommandDate2() + + ' Retrieve the value entered by the user on the CommandDate ASP:TextBox, and + ' save it into the CommandDate field in DataSource PersonalSalary 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.CommandDate2.Text, PersonalSalaryTable.CommandDate) + + + End Sub + + Public Overridable Sub GetPositionSalary() + + ' Retrieve the value entered by the user on the PositionSalary ASP:TextBox, and + ' save it into the PositionSalary field in DataSource PersonalSalary record. + ' Parse will also validate the amount to ensure it is of the proper format + ' and valid. The format is verified based on the current culture + ' settings including the currency symbol and decimal separator + ' (no currency conversion is performed). + ' 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.PositionSalary.Text, PersonalSalaryTable.PositionSalary) + + + End Sub + + Public Overridable Sub GetSalaryAmout() + + ' Retrieve the value entered by the user on the SalaryAmout ASP:TextBox, and + ' save it into the SalaryAmout field in DataSource PersonalSalary record. + ' Parse will also validate the amount to ensure it is of the proper format + ' and valid. The format is verified based on the current culture + ' settings including the currency symbol and decimal separator + ' (no currency conversion is performed). + ' 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.SalaryAmout.Text, PersonalSalaryTable.SalaryAmout) + + + End Sub + + Public Overridable Sub GetSalaryCommand() + + ' Retrieve the value entered by the user on the SalaryCommand ASP:TextBox, and + ' save it into the SalaryCommand field in DataSource PersonalSalary record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.SalaryCommand.Text, PersonalSalaryTable.SalaryCommand) + + + End Sub + + Public Overridable Sub GetSalaryDate() + + ' Retrieve the value entered by the user on the SalaryDate ASP:TextBox, and + ' save it into the SalaryDate field in DataSource PersonalSalary 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.SalaryDate.Text, PersonalSalaryTable.SalaryDate) + + + End Sub + + Public Overridable Sub GetSalaryExtra_NotUsed() + + ' Retrieve the value entered by the user on the SalaryExtra_NotUsed ASP:TextBox, and + ' save it into the SalaryExtra_NotUsed field in DataSource PersonalSalary record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.SalaryExtra_NotUsed.Text, PersonalSalaryTable.SalaryExtra_NotUsed) + + + End Sub + + Public Overridable Sub GetSalaryPlus() + + ' Retrieve the value entered by the user on the SalaryPlus ASP:TextBox, and + ' save it into the SalaryPlus field in DataSource PersonalSalary record. + ' Parse will also validate the amount to ensure it is of the proper format + ' and valid. The format is verified based on the current culture + ' settings including the currency symbol and decimal separator + ' (no currency conversion is performed). + ' 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.SalaryPlus.Text, PersonalSalaryTable.SalaryPlus) + + + End Sub + + Public Overridable Sub GetSalaryRank() + + ' Retrieve the value entered by the user on the SalaryRank ASP:TextBox, and + ' save it into the SalaryRank field in DataSource PersonalSalary record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.SalaryRank.Text, PersonalSalaryTable.SalaryRank) + + + End Sub + + Public Overridable Sub GetSalaryRound() + + ' Retrieve the value entered by the user on the SalaryRound ASP:TextBox, and + ' save it into the SalaryRound field in DataSource PersonalSalary record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.SalaryRound.Text, PersonalSalaryTable.SalaryRound) + + + End Sub + + Public Overridable Sub GetSalaryStep() + + ' Retrieve the value entered by the user on the SalaryStep ASP:TextBox, and + ' save it into the SalaryStep field in DataSource PersonalSalary record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.SalaryStep.Text, PersonalSalaryTable.SalaryStep) + + + End Sub + + Public Overridable Sub GetSalaryYear() + + ' Retrieve the value entered by the user on the SalaryYear ASP:TextBox, and + ' save it into the SalaryYear field in DataSource PersonalSalary record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.SalaryYear.Text, PersonalSalaryTable.SalaryYear) + + + End Sub + + + ' To customize, override this method in PersonalSalaryTableControlRow. + + Public Overridable Function CreateWhereClause() As WhereClause + + Return Nothing + + End Function + + + + ' To customize, override this method in PersonalSalaryTableControlRow. + 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) + PersonalSalaryTable.DeleteRecord(pkValue) + + DirectCast(GetParentControlObject(Me, "PersonalSalaryTableControl"), PersonalSalaryTableControl).DataChanged = True + DirectCast(GetParentControlObject(Me, "PersonalSalaryTableControl"), PersonalSalaryTableControl).ResetData = True + End Sub + + Protected Overridable Sub Control_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.PreRender + ' PreRender event is raised just before page is being displayed. + Try + DbUtils.StartTransaction() + Me.RegisterPostback() + + If Not Me.Page.ErrorOnPage AndAlso (Me.Page.IsPageRefresh OrElse Me.DataChanged OrElse Me.ResetData) Then + + + ' Re-load the data and update the web page if necessary. + ' This is typically done during a postback (filter, search button, sort, pagination button). + ' In each of the other click handlers, simply set DataChanged to True to reload the data. + Me.LoadData() + Me.DataBind() + End If + + + Catch ex As Exception + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + Finally + DbUtils.EndTransaction() + End Try + End Sub + + + Protected Overrides Sub SaveControlsToSession() + MyBase.SaveControlsToSession() + + + 'Save pagination state to session. + + End Sub + + + + Protected Overrides Sub ClearControlsFromSession() + MyBase.ClearControlsFromSession() + + + + ' Clear pagination state from session. + + End Sub + + Protected Overrides Sub LoadViewState(ByVal savedState As Object) + MyBase.LoadViewState(savedState) + Dim isNewRecord As String = CType(ViewState("IsNewRecord"), String) + If Not isNewRecord Is Nothing AndAlso isNewRecord.Trim <> "" Then + Me.IsNewRecord = Boolean.Parse(isNewRecord) + End If + + Dim myCheckSum As String = CType(ViewState("CheckSum"), String) + If Not myCheckSum Is Nothing AndAlso myCheckSum.Trim <> "" Then + Me.CheckSum = myCheckSum + End If + + + ' Load view state for pagination control. + + End Sub + + Protected Overrides Function SaveViewState() As Object + ViewState("IsNewRecord") = Me.IsNewRecord.ToString() + ViewState("CheckSum") = Me.CheckSum + + + ' Load view state for pagination control. + + Return MyBase.SaveViewState() + End Function + + + ' event handler for ImageButton + Public Overridable Sub PersonalSalaryRowDeleteButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + If(Not Me.Page.IsPageRefresh) Then + + Dim tc As PersonalSalaryTableControl = DirectCast(GetParentControlObject(Me, "PersonalSalaryTableControl"), PersonalSalaryTableControl) + If Not (IsNothing(tc)) Then + If Not Me.IsNewRecord Then + tc.AddToDeletedRecordIds(DirectCast(Me, PersonalSalaryTableControlRow)) + End If + Me.Visible = False + tc.SetFormulaControls() + End If + + End If + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + Protected Overridable Sub CommandDate2_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub PositionSalary_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub SalaryAmout_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub SalaryCommand_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub SalaryDate_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub SalaryExtra_NotUsed_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub SalaryPlus_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub SalaryRank_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub SalaryRound_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub SalaryStep_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub SalaryYear_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("BasePersonalSalaryTableControlRow_Rec"), String) + End Get + Set(ByVal value As String) + Me.ViewState("BasePersonalSalaryTableControlRow_Rec") = value + End Set + End Property + + Private _DataSource As PersonalSalaryRecord + Public Property DataSource() As PersonalSalaryRecord + Get + Return Me._DataSource + End Get + + Set(ByVal value As PersonalSalaryRecord) + + Me._DataSource = value + End Set + End Property + + + + Private _checkSum As String + Public Overridable Property CheckSum() As String + Get + Return Me._checkSum + End Get + Set(ByVal value As String) + Me._checkSum = value + End Set + End Property + + Private _TotalPages As Integer + Public Property TotalPages() As Integer + Get + Return Me._TotalPages + End Get + Set(ByVal value As Integer) + Me._TotalPages = value + End Set + End Property + + Private _PageIndex As Integer + Public Property PageIndex() As Integer + Get + ' Return the PageIndex + Return Me._PageIndex + End Get + Set(ByVal value As Integer) + Me._PageIndex = value + End Set + End Property + + Private _DisplayLastPage As Boolean + Public Property DisplayLastPage() As Boolean + Get + Return Me._DisplayLastPage + End Get + Set(ByVal value As Boolean) + Me._DisplayLastPage = value + End Set + End Property + + + +#Region "Helper Properties" + + Public ReadOnly Property CommandDate2() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "CommandDate2"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property PersonalSalaryRecordRowSelection() As System.Web.UI.WebControls.CheckBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalSalaryRecordRowSelection"), System.Web.UI.WebControls.CheckBox) + End Get + End Property + + Public ReadOnly Property PersonalSalaryRowDeleteButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalSalaryRowDeleteButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PositionSalary() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PositionSalary"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property SalaryAmout() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "SalaryAmout"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property SalaryCommand() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "SalaryCommand"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property SalaryDate() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "SalaryDate"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property SalaryExtra_NotUsed() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "SalaryExtra_NotUsed"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property SalaryPlus() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "SalaryPlus"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property SalaryRank() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "SalaryRank"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property SalaryRound() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "SalaryRound"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property SalaryStep() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "SalaryStep"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property SalaryYear() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "SalaryYear"), System.Web.UI.WebControls.TextBox) + 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 PersonalSalaryRecord = 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 PersonalSalaryRecord + If Not Me.DataSource Is Nothing Then + Return Me.DataSource + End If + + If Not Me.RecordUniqueId Is Nothing Then + + Return PersonalSalaryTable.GetRecord(Me.RecordUniqueId, True) + + End If + + ' Localization. + + Return Nothing + + End Function + + Public Shadows ReadOnly Property Page() As BaseApplicationPage + Get + Return DirectCast(MyBase.Page, BaseApplicationPage) + End Get + End Property + +#End Region + +End Class + + + +' Base class for the PersonalSalaryTableControl control on the AddPersonalId page. +' Do not modify this class. Instead override any method in PersonalSalaryTableControl. +Public Class BasePersonalSalaryTableControl + Inherits Persons.UI.BaseApplicationTableControl + + + + Protected Overridable Sub Control_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Init + + + + ' Setup the filter and search events. + + + + ' Control Initializations. + ' Initialize the table's current sort order. + + If Me.InSession(Me, "Order_By") Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + End If + + + + ' Setup default pagination settings. + + Me.PageSize = CInt(Me.GetFromSession(Me, "Page_Size", "10")) + Me.PageIndex = CInt(Me.GetFromSession(Me, "Page_Index", "0")) + + + + Me.ClearControlsFromSession() + End Sub + + Protected Overridable Sub Control_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load + + SaveControlsToSession_Ajax() + + ' Show confirmation message on Click + Me.PersonalSalaryDeleteButton.Attributes.Add("onClick", "return (confirm('" & (CType(Me.Page,BaseApplicationPage)).GetResourceValue("DeleteConfirm", "Persons") & "'));") + + ' Setup the pagination events. + + AddHandler Me.PersonalSalaryPagination.FirstPage.Click, AddressOf PersonalSalaryPagination_FirstPage_Click + + AddHandler Me.PersonalSalaryPagination.LastPage.Click, AddressOf PersonalSalaryPagination_LastPage_Click + + AddHandler Me.PersonalSalaryPagination.NextPage.Click, AddressOf PersonalSalaryPagination_NextPage_Click + + AddHandler Me.PersonalSalaryPagination.PageSizeButton.Click, AddressOf PersonalSalaryPagination_PageSizeButton_Click + + AddHandler Me.PersonalSalaryPagination.PreviousPage.Click, AddressOf PersonalSalaryPagination_PreviousPage_Click + + + ' Setup the sorting events. + + AddHandler Me.CommandDateLabel2.Click, AddressOf CommandDateLabel2_Click + + AddHandler Me.PositionSalaryLabel.Click, AddressOf PositionSalaryLabel_Click + + AddHandler Me.SalaryAmoutLabel.Click, AddressOf SalaryAmoutLabel_Click + + AddHandler Me.SalaryCommandLabel.Click, AddressOf SalaryCommandLabel_Click + + AddHandler Me.SalaryDateLabel1.Click, AddressOf SalaryDateLabel1_Click + + AddHandler Me.SalaryExtra_NotUsedLabel.Click, AddressOf SalaryExtra_NotUsedLabel_Click + + AddHandler Me.SalaryPlusLabel.Click, AddressOf SalaryPlusLabel_Click + + AddHandler Me.SalaryRankLabel1.Click, AddressOf SalaryRankLabel1_Click + + AddHandler Me.SalaryRoundLabel.Click, AddressOf SalaryRoundLabel_Click + + AddHandler Me.SalaryStepLabel.Click, AddressOf SalaryStepLabel_Click + + AddHandler Me.SalaryYearLabel.Click, AddressOf SalaryYearLabel_Click + + ' Setup the button events. + + AddHandler Me.PersonalSalaryAddButton.Click, AddressOf PersonalSalaryAddButton_Click + + AddHandler Me.PersonalSalaryDeleteButton.Click, AddressOf PersonalSalaryDeleteButton_Click + + AddHandler Me.PersonalSalaryResetButton.Click, AddressOf PersonalSalaryResetButton_Click + + + ' Setup events for others + + End Sub + + + Public Overridable Sub LoadData() + + ' Read data from database. Returns an array of records that can be assigned + ' to the DataSource table control property. + Try + Dim joinFilter As CompoundFilter = CreateCompoundJoinFilter() + + ' The WHERE clause will be empty when displaying all records in table. + Dim wc As WhereClause = CreateWhereClause() + If wc IsNot Nothing AndAlso Not wc.RunQuery Then + ' Initialize an empty array of records + Dim alist As New ArrayList(0) + Me.DataSource = DirectCast(alist.ToArray(GetType(PersonalSalaryRecord)), PersonalSalaryRecord()) + ' Add records to the list if needed. + Me.AddNewRecords() + Me._TotalRecords = 0 + Me._TotalPages = 0 + Return + End If + + ' Call OrderBy to determine the order - either use the order defined + ' on the Query Wizard, or specified by user (by clicking on column heading) + Dim orderBy As OrderBy = CreateOrderBy() + + ' Get the pagesize from the pagesize control. + Me.GetPageSize() + + If Me.DisplayLastPage Then + Dim totalRecords As Integer = If(Me._TotalRecords < 0, PersonalSalaryTable.GetRecordCount(CreateCompoundJoinFilter(), CreateWhereClause()), Me._TotalRecords) + + Dim totalPages As Integer = CInt(Math.Ceiling(totalRecords / Me.PageSize)) + + Me.PageIndex = totalPages - 1 + End If + + ' Make sure PageIndex (current page) and PageSize are within bounds. + If Me.PageIndex < 0 Then + Me.PageIndex = 0 + End If + If Me.PageSize < 1 Then + Me.PageSize = 1 + End If + + ' Retrieve the records and set the table DataSource. + ' Only PageSize records are fetched starting at PageIndex (zero based). + If Me.AddNewRecord > 0 Then + ' Make sure to preserve the previously entered data on new rows. + Dim postdata As New ArrayList + For Each rc As PersonalSalaryTableControlRow In Me.GetRecordControls() + If Not rc.IsNewRecord Then + rc.DataSource = rc.GetRecord() + rc.GetUIData() + postdata.Add(rc.DataSource) + UIData.Add(rc.PreservedUIData()) + End If + Next + Me.DataSource = DirectCast(postdata.ToArray(GetType(PersonalSalaryRecord)), PersonalSalaryRecord()) + Else ' Get the records from the database + Me.DataSource = PersonalSalaryTable.GetRecords(joinFilter, wc, orderBy, Me.PageIndex, Me.PageSize) + + End If + + ' if the datasource contains no records contained in database, then load the last page. + If (DbUtils.GetCreatedRecords(Me.DataSource).Length = 0 AndAlso Not Me.DisplayLastPage) Then + Me.DisplayLastPage = True + LoadData() + Else + + ' Add any new rows desired by the user. + Me.AddNewRecords() + + ' Turn off the ToggleAll checkbox + Me.PersonalSalaryToggleAll.Checked = False + + + ' Initialize the page and grand totals. now + + End If + + Catch ex As Exception + ' Report the error message to the end user + Dim msg As String = ex.Message + If ex.InnerException IsNot Nothing Then + msg = msg & " InnerException: " & ex.InnerException.Message + End If + Throw New Exception(msg, ex.InnerException) + End Try + End Sub + + + + + Public Overrides Sub DataBind() + ' The DataBind method binds the user interface controls to the values + ' from the database record for each row in the table. To do this, it calls the + ' DataBind for each of the rows. + ' DataBind also populates any filters above the table, and sets the pagination + ' control to the correct number of records and the current page number. + + MyBase.DataBind() + + ' Make sure that the DataSource is initialized. + If Me.DataSource Is Nothing Then + Return + End If + + 'LoadData for DataSource for chart and report if they exist + + ' Setup the pagination controls. + BindPaginationControls() + + + + ' Bind the repeater with the list of records to expand the UI. + Dim rep As System.Web.UI.WebControls.Repeater = CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalSalaryTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return + rep.DataSource = DataSource() + rep.DataBind() + + Dim index As Integer = 0 + For Each repItem As System.Web.UI.WebControls.RepeaterItem In rep.Items + ' Loop through all rows in the table, set its DataSource and call DataBind(). + Dim recControl As PersonalSalaryTableControlRow = DirectCast(repItem.FindControl("PersonalSalaryTableControlRow"), PersonalSalaryTableControlRow) + recControl.DataSource = Me.DataSource(index) + If Me.UIData.Count > index Then + recControl.PreviousUIData = Me.UIData(index) + End If + recControl.DataBind() + recControl.Visible = Not Me.InDeletedRecordIds(recControl) + + index += 1 + Next + + + + + ' Call the Set methods for each controls on the panel + + SetCommandDateLabel2() + + + + + SetPersonalSalaryTableControlCollapsibleRegion() + + SetPositionSalaryLabel() + SetSalaryAmoutLabel() + SetSalaryCommandLabel() + SetSalaryDateLabel1() + SetSalaryExtra_NotUsedLabel() + SetSalaryPlusLabel() + SetSalaryRankLabel1() + SetSalaryRoundLabel() + SetSalaryStepLabel() + SetSalaryYearLabel() + ' setting the state of expand or collapse alternative rows + + + ' Load data for each record and table UI control. + ' Ordering is important because child controls get + ' their parent ids from their parent UI controls. + + + ' this method calls the set method for controls with special formula like running total, sum, rank, etc + SetFormulaControls() + End Sub + + Public Overridable Sub SetFormulaControls() + ' this method calls Set methods for the control that has special formula + + + + End Sub + + + + Public Overridable Sub RegisterPostback() + + + End Sub + + Public EvaluateFormulaDelegate As BaseClasses.Data.DataSource.EvaluateFormulaDelegate = New BaseClasses.Data.DataSource.EvaluateFormulaDelegate(AddressOf Me.EvaluateFormula) + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean, ByVal e as FormulaEvaluator) As String + If e Is Nothing + e = New FormulaEvaluator() + End If + + e.Variables.Clear() + + + ' add variables for formula evaluation + If variables IsNot Nothing Then + Dim enumerator As System.Collections.Generic.IEnumerator(Of System.Collections.Generic.KeyValuePair(Of String, Object)) = variables.GetEnumerator() + While enumerator.MoveNext() + e.Variables.Add(enumerator.Current.Key, enumerator.Current.Value) + End While + End If + + If includeDS + + End If + + ' All variables referred to in the formula are expected to be + ' properties of the DataSource. For example, referring to + ' UnitPrice as a variable will refer to DataSource.UnitPrice + e.DataSource = dataSourceForEvaluate + + ' Define the calling control. This is used to add other + ' related table and record controls as variables. + e.CallingControl = Me + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + + If Not String.IsNullOrEmpty(format) AndAlso (String.IsNullOrEmpty(formula) OrElse formula.IndexOf("Format(") < 0) Then + Return FormulaUtils.Format(resultObj, format) + Else + Return resultObj.ToString() + End If + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format,variables ,includeDS, Nothing) + End Function + + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object)) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format, variables ,True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, format, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal e as FormulaEvaluator) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, variables, True, e) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal includeDS as Boolean) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, includeDS, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, True, Nothing) + End Function + + + + + Public Overridable Sub ResetControl() + + Me.CurrentSortOrder.Reset() + If (Me.InSession(Me, "Order_By")) Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + End If + + Me.PageIndex = 0 + End Sub + + Protected Overridable Sub BindPaginationControls() + ' Setup the pagination controls. + + ' Bind the pagination labels. + + If DbUtils.GetCreatedRecords(Me.DataSource).Length > 0 Then + + Me.PersonalSalaryPagination.CurrentPage.Text = (Me.PageIndex + 1).ToString() + Else + Me.PersonalSalaryPagination.CurrentPage.Text = "0" + End If + Me.PersonalSalaryPagination.PageSize.Text = Me.PageSize.ToString() + Me.PersonalSalaryPagination.TotalItems.Text = Me.TotalRecords.ToString() + Me.PersonalSalaryPagination.TotalPages.Text = Me.TotalPages.ToString() + + ' Bind the buttons for PersonalSalaryTableControl pagination. + + Me.PersonalSalaryPagination.FirstPage.Enabled = Not (Me.PageIndex = 0) + If Me._TotalPages < 0 Then ' if the total pages is not determined yet, enable last and next buttons + Me.PersonalSalaryPagination.LastPage.Enabled = True + ElseIf Me._TotalPages = 0 ' if the total pages is determined and it is 0, enable last and next buttons + Me.PersonalSalaryPagination.LastPage.Enabled = False + Else ' if the total pages is the last page, disable last and next buttons + Me.PersonalSalaryPagination.LastPage.Enabled = Not (Me.PageIndex = Me.TotalPages - 1) + End If + + If Me._TotalPages < 0 Then ' if the total pages is not determined yet, enable last and next buttons + Me.PersonalSalaryPagination.NextPage.Enabled = True + ElseIf Me._TotalPages = 0 ' if the total pages is determined and it is 0, enable last and next buttons + Me.PersonalSalaryPagination.NextPage.Enabled = False + Else ' if the total pages is the last page, disable last and next buttons + Me.PersonalSalaryPagination.NextPage.Enabled = Not (Me.PageIndex = Me.TotalPages - 1) + End If + + Me.PersonalSalaryPagination.PreviousPage.Enabled = Not (Me.PageIndex = 0) + + + End Sub + + Public Overridable Sub SaveData() + ' Save the data from the entire table. Calls each row's Save Data + ' to save their data. This function is called by the Click handler of the + ' Save button. The button handler should Start/Commit/End a transaction. + + Dim recCtl As PersonalSalaryTableControlRow + For Each recCtl In Me.GetRecordControls() + + If Me.InDeletedRecordIds(recCtl) Then + ' Delete any pending deletes. + recCtl.Delete() + Else + If recCtl.Visible Then + recCtl.SaveData() + End If + End If + + Next + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + ' Set IsNewRecord to False for all records - since everything has been saved and is no longer "new" + For Each recCtl In Me.GetRecordControls() + recCtl.IsNewRecord = False + Next + + + ' Set DeletedRecordsIds to Nothing since we have deleted all pending deletes. + Me.DeletedRecordIds = Nothing + + End Sub + + Public Overridable Function CreateCompoundJoinFilter() As CompoundFilter + Dim jFilter As CompoundFilter = New CompoundFilter() + + Return jFilter + + End Function + + + Public Overridable Function CreateOrderBy() As OrderBy + ' The CurrentSortOrder is initialized to the sort order on the + ' Query Wizard. It may be modified by the Click handler for any of + ' the column heading to sort or reverse sort by that column. + ' You can add your own sort order, or modify it on the Query Wizard. + Return Me.CurrentSortOrder + End Function + + Public Overridable Function CreateWhereClause() As WhereClause + 'This CreateWhereClause is used for loading the data. + PersonalSalaryTable.Instance.InnerFilter = Nothing + Dim wc As WhereClause = New WhereClause() + + ' Compose the WHERE clause consiting of: + ' 1. Static clause defined at design time. + ' 2. User selected search criteria. + ' 3. User selected filter criteria. + + + Dim selectedRecordKeyValue as KeyValue = New KeyValue() + + Dim personalIdRecordControlObj As Persons.UI.Controls.AddPersonalId.PersonalIdRecordControl = DirectCast(MiscUtils.FindControlRecursively(Me.Page, "PersonalIdRecordControl"), Persons.UI.Controls.AddPersonalId.PersonalIdRecordControl) + + If (Not IsNothing(personalIdRecordControlObj) AndAlso Not IsNothing(personalIdRecordControlObj.GetRecord()) AndAlso personalIdRecordControlObj.GetRecord().IsCreated AndAlso Not IsNothing(personalIdRecordControlObj.GetRecord().PersonalId)) + wc.iAND(PersonalSalaryTable.PersonalId, BaseFilter.ComparisonOperator.EqualsTo, personalIdRecordControlObj.GetRecord().PersonalId.ToString()) + selectedRecordKeyValue.AddElement(PersonalSalaryTable.PersonalId.InternalName, personalIdRecordControlObj.GetRecord().PersonalId.ToString()) + Else + wc.RunQuery = False + Return wc + End If + + HttpContext.Current.Session("PersonalSalaryTableControlWhereClause") = selectedRecordKeyValue.ToXmlString() + + Return wc + End Function + + + Public Overridable Function CreateWhereClause(ByVal searchText as String, ByVal fromSearchControl as String, ByVal AutoTypeAheadSearch as String, ByVal AutoTypeAheadWordSeparators as String) As WhereClause + ' This CreateWhereClause is used for loading list of suggestions for Auto Type-Ahead feature. + PersonalSalaryTable.Instance.InnerFilter = Nothing + Dim wc As WhereClause = New WhereClause() + + ' Compose the WHERE clause consiting of: + ' 1. Static clause defined at design time. + ' 2. User selected search criteria. + ' 3. User selected filter criteria. + + Dim appRelativeVirtualPath As String = CType(HttpContext.Current.Session("AppRelativeVirtualPath"), String) + + Dim selectedRecordInPersonalIdRecordControl as String = DirectCast(HttpContext.Current.Session("PersonalSalaryTableControlWhereClause"), String) + + If Not selectedRecordInPersonalIdRecordControl Is Nothing AndAlso KeyValue.IsXmlKey(selectedRecordInPersonalIdRecordControl) Then + Dim selectedRecordKeyValue as KeyValue = KeyValue.XmlToKey(selectedRecordInPersonalIdRecordControl) + + If Not IsNothing(selectedRecordKeyValue) AndAlso selectedRecordKeyValue.ContainsColumn(PersonalSalaryTable.PersonalId) Then + wc.iAND(PersonalSalaryTable.PersonalId, BaseFilter.ComparisonOperator.EqualsTo, selectedRecordKeyValue.GetColumnValue(PersonalSalaryTable.PersonalId).ToString()) + End If + + End If + + ' Adds clauses if values are selected in Filter controls which are configured in the page. + + + Return wc + End Function + + + Public Overridable Function FormatSuggestions(ByVal prefixText As String, ByVal resultItem As String, _ + ByVal columnLength As Integer, ByVal AutoTypeAheadDisplayFoundText As String, _ + ByVal autoTypeAheadSearch As String, ByVal AutoTypeAheadWordSeparators As String, _ + ByVal resultList As ArrayList) As Boolean + + 'Formats the resultItem and adds it to the list of suggestions. + Dim index As Integer = resultItem.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture).IndexOf(prefixText.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture)) + Dim itemToAdd As String = "" + Dim isFound As Boolean = False + Dim isAdded As Boolean = False + ' Get the index where prfixt is at the beginning of resultItem. If not found then, index of word which begins with prefixText. + If InvariantLCase(autoTypeAheadSearch).equals("wordsstartingwithsearchstring") And Not index = 0 Then + ' Expression to find word which contains AutoTypeAheadWordSeparators followed by prefixText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex( AutoTypeAheadWordSeparators + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + If regex1.IsMatch(resultItem) Then + index = regex1.Match(resultItem).Index + isFound = True + End If + ' If the prefixText is found immediatly after white space then starting of the word is found so don not search any further + If not resultItem(index).ToString() = " " Then + ' Expression to find beginning of the word which contains AutoTypeAheadWordSeparators followed by prefixText + Dim regex As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\\S*" + AutoTypeAheadWordSeparators + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + If regex.IsMatch(resultItem) Then + index = regex.Match(resultItem).Index + isFound = True + End If + End If + End If + + ' If autoTypeAheadSearch value is wordsstartingwithsearchstring then, extract the substring only if the prefixText is found at the + ' beginning of the resultItem (index = 0) or a word in resultItem is found starts with prefixText. + If index = 0 Or isFound Or InvariantLCase(autoTypeAheadSearch).Equals("anywhereinstring") then + If InvariantLCase(AutoTypeAheadDisplayFoundText).equals("atbeginningofmatchedstring") Then + ' Expression to find beginning of the word which contains prefixText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\\S*" + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + ' Find the beginning of the word which contains prefexText + If (StringUtils.InvariantLCase(autoTypeAheadSearch).Equals("anywhereinstring") AndAlso regex1.IsMatch(resultItem)) Then + index = regex1.Match(resultItem).Index + isFound = True + End If + ' Display string from the index till end of the string if sub string from index till end is less than columnLength value. + If Len(resultItem) - index <= columnLength Then + If index = 0 Then + itemToAdd = resultItem + Else + itemToAdd = "..." & resultItem.Substring(index, Len(resultItem) - index) + End If + Else + If index = 0 Then + itemToAdd = resultItem.Substring(index, (columnLength - 3)) & "..." + Else + 'Truncate the string to show only columnLength - 6 characters as begining and trailing "..." has to be appended. + itemToAdd = "..." & resultItem.Substring(index , columnLength - 6) & "..." + End If + End If + ElseIf InvariantLCase(AutoTypeAheadDisplayFoundText).equals("inmiddleofmatchedstring") Then + Dim subStringBeginIndex As Integer = CType(columnLength/2, Integer) + If Len(resultItem) <= columnLength Then + itemToAdd = resultItem + Else + ' Sanity check at end of the string + If index + Len(prefixText) = columnLength Then + itemToAdd = "..." & resultItem.Substring(index-columnLength,index) + ElseIf Len(resultItem) - index < subStringBeginIndex Then + ' Display string from the end till columnLength value if, index is closer to the end of the string. + itemToAdd = "..." & resultItem.Substring(Len(resultItem)-columnLength,Len(resultItem)) + ElseIf index <= subStringBeginIndex Then + ' Sanity chet at beginning of the string + itemToAdd = resultItem.Substring(0, columnLength) & "..." + Else + ' Display string containing text before the prefixText occures and text after the prefixText + itemToAdd = "..." & resultItem.Substring(index - subStringBeginIndex, columnLength) & "..." + End If + End If + ElseIf InvariantLCase(AutoTypeAheadDisplayFoundText).equals("atendofmatchedstring") Then + ' Expression to find ending of the word which contains prefexText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\s", System.Text.RegularExpressions.RegexOptions.IgnoreCase) + ' Find the ending of the word which contains prefexText + If regex1.IsMatch(resultItem, index + 1) Then + index = regex1.Match(resultItem, index + 1).Index + Else + ' If the word which contains prefexText is the last word in string, regex1.IsMatch returns false. + index = resultItem.Length + End If + If index > Len(resultItem) Then + index = Len(resultItem) + End If + ' If text from beginning of the string till index is less than columnLength value then, display string from the beginning till index. + If index <= columnLength Then + if index = Len(resultItem) Then 'Make decision to append "..." + itemToAdd = resultItem.Substring(0,index) + Else + itemToAdd = resultItem.Substring(0,index) & "..." + End If + Else + If index = Len(resultItem) Then + itemToAdd = "..." & resultItem.Substring(index - (columnLength - 3), (columnLength - 3)) + Else + 'Truncate the string to show only columnLength - 6 characters as begining and trailing "..." has to be appended. + itemToAdd = "..." & resultItem.Substring(index - (columnLength - 6), columnLength - 6) & "..." + End If + End If + End If + + ' Remove newline character from itemToAdd + Dim prefixTextIndex As Integer = itemToAdd.IndexOf(prefixText, StringComparison.CurrentCultureIgnoreCase) + ' If itemToAdd contains any newline after the search text then show text only till newline + Dim regex2 As System.Text.RegularExpressions.Regex = New System.Text.RegularExpressions.Regex("(" & vbCrLf & "|" & vbLf & ")", System.Text.RegularExpressions.RegexOptions.IgnoreCase) + Dim newLineIndexAfterPrefix As Integer = -1 + If regex2.IsMatch(itemToAdd, prefixTextIndex) Then + newLineIndexAfterPrefix = regex2.Match(itemToAdd, prefixTextIndex).Index + End If + If (newLineIndexAfterPrefix > -1) Then + If itemToAdd.EndsWith("...") Then + itemToAdd = (itemToAdd.Substring(0, newLineIndexAfterPrefix) + "...") + Else + itemToAdd = itemToAdd.Substring(0, newLineIndexAfterPrefix) + End If + End If + ' If itemToAdd contains any newline before search text then show text which comes after newline + Dim regex3 As System.Text.RegularExpressions.Regex = New System.Text.RegularExpressions.Regex("(" & vbCrLf & "|" & vbLf & ")", (System.Text.RegularExpressions.RegexOptions.IgnoreCase Or System.Text.RegularExpressions.RegexOptions.RightToLeft)) + Dim newLineIndexBeforePrefix As Integer = -1 + If regex3.IsMatch(itemToAdd, prefixTextIndex) Then + newLineIndexBeforePrefix = regex3.Match(itemToAdd, prefixTextIndex).Index + End If + If (newLineIndexBeforePrefix > -1) Then + If itemToAdd.StartsWith("...") Then + itemToAdd = ("..." + itemToAdd.Substring((newLineIndexBeforePrefix + regex3.Match(itemToAdd, prefixTextIndex).Length))) + Else + itemToAdd = itemToAdd.Substring((newLineIndexBeforePrefix + regex3.Match(itemToAdd, prefixTextIndex).Length)) + End If + End If + + If Not itemToAdd is nothing AndAlso Not resultList.Contains(itemToAdd) Then + + resultList.Add(itemToAdd) + + isAdded = true + End If + End If + Return isAdded + End Function + + + Protected Overridable Sub GetPageSize() + + If Me.PersonalSalaryPagination.PageSize.Text.Trim <> "" Then + Try + 'Me.PageSize = Integer.Parse(Me.PersonalSalaryPagination.PageSize.Text) + Catch ex As Exception + End Try + End If + End Sub + + Protected Overridable Sub AddNewRecords() + + Dim newRecordList As ArrayList = New ArrayList() + + Dim newUIDataList As System.Collections.Generic.List(Of Hashtable) = New System.Collections.Generic.List(Of Hashtable)() + + ' Loop though all the record controls and if the record control + ' does not have a unique record id set, then create a record + ' and add to the list. + If Not Me.ResetData Then + Dim rep As System.Web.UI.WebControls.Repeater = CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalSalaryTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return + + Dim repItem As System.Web.UI.WebControls.RepeaterItem + For Each repItem In rep.Items + ' Loop through all rows in the table, set its DataSource and call DataBind(). + + Dim recControl As PersonalSalaryTableControlRow = DirectCast(repItem.FindControl("PersonalSalaryTableControlRow"), PersonalSalaryTableControlRow) + + If recControl.Visible AndAlso recControl.IsNewRecord() Then + + Dim rec As PersonalSalaryRecord = New PersonalSalaryRecord() + + If recControl.CommandDate2.Text <> "" Then + rec.Parse(recControl.CommandDate2.Text, PersonalSalaryTable.CommandDate) + End If + If recControl.PositionSalary.Text <> "" Then + rec.Parse(recControl.PositionSalary.Text, PersonalSalaryTable.PositionSalary) + End If + If recControl.SalaryAmout.Text <> "" Then + rec.Parse(recControl.SalaryAmout.Text, PersonalSalaryTable.SalaryAmout) + End If + If recControl.SalaryCommand.Text <> "" Then + rec.Parse(recControl.SalaryCommand.Text, PersonalSalaryTable.SalaryCommand) + End If + If recControl.SalaryDate.Text <> "" Then + rec.Parse(recControl.SalaryDate.Text, PersonalSalaryTable.SalaryDate) + End If + If recControl.SalaryExtra_NotUsed.Text <> "" Then + rec.Parse(recControl.SalaryExtra_NotUsed.Text, PersonalSalaryTable.SalaryExtra_NotUsed) + End If + If recControl.SalaryPlus.Text <> "" Then + rec.Parse(recControl.SalaryPlus.Text, PersonalSalaryTable.SalaryPlus) + End If + If recControl.SalaryRank.Text <> "" Then + rec.Parse(recControl.SalaryRank.Text, PersonalSalaryTable.SalaryRank) + End If + If recControl.SalaryRound.Text <> "" Then + rec.Parse(recControl.SalaryRound.Text, PersonalSalaryTable.SalaryRound) + End If + If recControl.SalaryStep.Text <> "" Then + rec.Parse(recControl.SalaryStep.Text, PersonalSalaryTable.SalaryStep) + End If + If recControl.SalaryYear.Text <> "" Then + rec.Parse(recControl.SalaryYear.Text, PersonalSalaryTable.SalaryYear) + End If + newUIDataList.Add(recControl.PreservedUIData()) + newRecordList.Add(rec) + End If + Next + End If + + + ' Add any new record to the list. + Dim index As Integer = 0 + For index = 1 To Me.AddNewRecord + + newRecordList.Insert(0, New PersonalSalaryRecord()) + newUIDataList.Insert(0, New Hashtable()) + + Next + Me.AddNewRecord = 0 + + ' Finally, add any new records to the DataSource. + If newRecordList.Count > 0 Then + + Dim finalList As ArrayList = New ArrayList(Me.DataSource) + finalList.InsertRange(0, newRecordList) + + Me.DataSource = DirectCast(finalList.ToArray(GetType(PersonalSalaryRecord)), PersonalSalaryRecord()) + + End If + + ' Add the existing UI data to this hash table + If newUIDataList.Count > 0 Then + Me.UIData.InsertRange(0, newUIDataList) + End If + + End Sub + + + Public Sub AddToDeletedRecordIds(ByVal rec As PersonalSalaryTableControlRow) + If rec.IsNewRecord() Then + Return + End If + + If Not Me.DeletedRecordIds Is Nothing AndAlso Me.DeletedRecordIds.Trim <> "" Then + Me.DeletedRecordIds &= "," + End If + + Me.DeletedRecordIds &= "[" & rec.RecordUniqueId & "]" + End Sub + + Protected Overridable Function InDeletedRecordIds(ByVal rec As PersonalSalaryTableControlRow) As Boolean + If Me.DeletedRecordIds Is Nothing OrElse Me.DeletedRecordIds.Trim = "" Then + Return False + End If + + Return Me.DeletedRecordIds.IndexOf("[" & rec.RecordUniqueId & "]") >= 0 + End Function + + Private _DeletedRecordIds As String + Public Property DeletedRecordIds() As String + Get + Return Me._DeletedRecordIds + End Get + Set(ByVal value As String) + Me._DeletedRecordIds = value + End Set + End Property + + + ' Create Set, WhereClause, and Populate Methods + + Public Overridable Sub SetCommandDateLabel2() + + End Sub + + Public Overridable Sub SetPersonalSalaryTableControlCollapsibleRegion() + + End Sub + + Public Overridable Sub SetPositionSalaryLabel() + + End Sub + + Public Overridable Sub SetSalaryAmoutLabel() + + End Sub + + Public Overridable Sub SetSalaryCommandLabel() + + End Sub + + Public Overridable Sub SetSalaryDateLabel1() + + End Sub + + Public Overridable Sub SetSalaryExtra_NotUsedLabel() + + End Sub + + Public Overridable Sub SetSalaryPlusLabel() + + End Sub + + Public Overridable Sub SetSalaryRankLabel1() + + End Sub + + Public Overridable Sub SetSalaryRoundLabel() + + End Sub + + Public Overridable Sub SetSalaryStepLabel() + + End Sub + + Public Overridable Sub SetSalaryYearLabel() + + 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. + Dim added As Boolean = Me.AddNewRecord > 0 + Me.LoadData() + Me.DataBind() + + If added Then + Me.SetFocusToAddedRow() + End If + + End If + + + + Catch ex As Exception + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + Finally + DbUtils.EndTransaction + End Try + End Sub + + 'this function sets focus to the first editable element in the new added row in the editable table + Protected Overridable Sub SetFocusToAddedRow() + Dim rep As System.Web.UI.WebControls.Repeater = CType(Me.FindControl("PersonalSalaryTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing OrElse rep.Items.Count = 0 Then Return + Dim repItem As System.Web.UI.WebControls.RepeaterItem + For Each repItem In rep.Items + 'Load scripts to table rows + Me.Page.LoadFocusScripts(repItem) + Dim recControl As PersonalSalaryTableControlRow = DirectCast(repItem.FindControl("PersonalSalaryTableControlRow"), PersonalSalaryTableControlRow) + If recControl.IsNewRecord Then + For Each field As Control In recControl.Controls + If field.Visible AndAlso Me.Page.IsControlEditable(field, False) Then + 'set focus on the first editable field in the new row + field.Focus() + Dim updPan As UpdatePanel = DirectCast(Me.Page.FindControlRecursively("UpdatePanel1"), UpdatePanel) + If Not updPan Is Nothing Then updPan.Update() + Return + End If + Next + Return + End If + Next + End Sub + + + Protected Overrides Sub SaveControlsToSession() + MyBase.SaveControlsToSession() + + ' Save filter controls to values to session. + + + 'Save pagination state to session. + + + + ' Save table control properties to the session. + If Not Me.CurrentSortOrder Is Nothing Then + Me.SaveToSession(Me, "Order_By", Me.CurrentSortOrder.ToXmlString()) + End If + + Me.SaveToSession(Me, "Page_Index", Me.PageIndex.ToString()) + Me.SaveToSession(Me, "Page_Size", Me.PageSize.ToString()) + + Me.SaveToSession(Me, "DeletedRecordIds", Me.DeletedRecordIds) + + End Sub + + Protected Sub SaveControlsToSession_Ajax() + ' Save filter controls to values to session. + + HttpContext.Current.Session("AppRelativeVirtualPath") = Me.Page.AppRelativeVirtualPath + + End Sub + + Protected Overrides Sub ClearControlsFromSession() + MyBase.ClearControlsFromSession() + + ' Clear filter controls values from the session. + + + ' Clear pagination state from session. + + + + ' Clear table properties from the session. + Me.RemoveFromSession(Me, "Order_By") + Me.RemoveFromSession(Me, "Page_Index") + Me.RemoveFromSession(Me, "Page_Size") + + Me.RemoveFromSession(Me, "DeletedRecordIds") + + End Sub + + Protected Overrides Sub LoadViewState(ByVal savedState As Object) + MyBase.LoadViewState(savedState) + + Dim orderByStr As String = CType(ViewState("PersonalSalaryTableControl_OrderBy"), String) + + If orderByStr IsNot Nothing AndAlso orderByStr.Trim <> "" Then + Me.CurrentSortOrder = BaseClasses.Data.OrderBy.FromXmlString(orderByStr) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + End If + + Dim pageIndex As String = CType(ViewState("Page_Index"), String) + If pageIndex IsNot Nothing Then + Me.PageIndex = CInt(pageIndex) + End If + + Dim pageSize As String = CType(ViewState("Page_Size"), String) + If Not pageSize Is Nothing Then + Me.PageSize = CInt(pageSize) + End If + + + + ' Load view state for pagination control. + + Me.DeletedRecordIds = CType(Me.ViewState("DeletedRecordIds"), String) + + End Sub + + Protected Overrides Function SaveViewState() As Object + + If Me.CurrentSortOrder IsNot Nothing Then + Me.ViewState("PersonalSalaryTableControl_OrderBy") = Me.CurrentSortOrder.ToXmlString() + End If + + Me.ViewState("Page_Index") = Me.PageIndex + Me.ViewState("Page_Size") = Me.PageSize + + Me.ViewState("DeletedRecordIds") = Me.DeletedRecordIds + + + ' Load view state for pagination control. + + + Return MyBase.SaveViewState() + End Function + + ' Generate the event handling functions for pagination events. + + ' event handler for ImageButton + Public Overridable Sub PersonalSalaryPagination_FirstPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.PageIndex = 0 + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalSalaryPagination_LastPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.DisplayLastPage = True + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalSalaryPagination_NextPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.PageIndex += 1 + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for LinkButton + Public Overridable Sub PersonalSalaryPagination_PageSizeButton_Click(ByVal sender As Object, ByVal args As EventArgs) + + Try + + Me.DataChanged = True + + Me.PageSize = Integer.Parse(Me.PersonalSalaryPagination.PageSize.Text) + + Me.PageIndex = Integer.Parse(Me.PersonalSalaryPagination.CurrentPage.Text) - 1 + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalSalaryPagination_PreviousPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + If Me.PageIndex > 0 Then + Me.PageIndex -= 1 + Me.DataChanged = True + End If + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + + ' Generate the event handling functions for sorting events. + + Public Overridable Sub CommandDateLabel2_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by CommandDate when clicked. + + ' Get previous sorting state for CommandDate. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalSalaryTable.CommandDate) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for CommandDate. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalSalaryTable.CommandDate, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by CommandDate, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub PositionSalaryLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by PositionSalary when clicked. + + ' Get previous sorting state for PositionSalary. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalSalaryTable.PositionSalary) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for PositionSalary. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalSalaryTable.PositionSalary, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by PositionSalary, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub SalaryAmoutLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by SalaryAmout when clicked. + + ' Get previous sorting state for SalaryAmout. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalSalaryTable.SalaryAmout) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for SalaryAmout. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalSalaryTable.SalaryAmout, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by SalaryAmout, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub SalaryCommandLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by SalaryCommand when clicked. + + ' Get previous sorting state for SalaryCommand. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalSalaryTable.SalaryCommand) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for SalaryCommand. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalSalaryTable.SalaryCommand, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by SalaryCommand, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub SalaryDateLabel1_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by SalaryDate when clicked. + + ' Get previous sorting state for SalaryDate. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalSalaryTable.SalaryDate) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for SalaryDate. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalSalaryTable.SalaryDate, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by SalaryDate, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub SalaryExtra_NotUsedLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by SalaryExtra_NotUsed when clicked. + + ' Get previous sorting state for SalaryExtra_NotUsed. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalSalaryTable.SalaryExtra_NotUsed) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for SalaryExtra_NotUsed. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalSalaryTable.SalaryExtra_NotUsed, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by SalaryExtra_NotUsed, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub SalaryPlusLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by SalaryPlus when clicked. + + ' Get previous sorting state for SalaryPlus. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalSalaryTable.SalaryPlus) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for SalaryPlus. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalSalaryTable.SalaryPlus, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by SalaryPlus, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub SalaryRankLabel1_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by SalaryRank when clicked. + + ' Get previous sorting state for SalaryRank. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalSalaryTable.SalaryRank) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for SalaryRank. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalSalaryTable.SalaryRank, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by SalaryRank, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub SalaryRoundLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by SalaryRound when clicked. + + ' Get previous sorting state for SalaryRound. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalSalaryTable.SalaryRound) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for SalaryRound. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalSalaryTable.SalaryRound, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by SalaryRound, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub SalaryStepLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by SalaryStep when clicked. + + ' Get previous sorting state for SalaryStep. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalSalaryTable.SalaryStep) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for SalaryStep. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalSalaryTable.SalaryStep, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by SalaryStep, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub SalaryYearLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by SalaryYear when clicked. + + ' Get previous sorting state for SalaryYear. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalSalaryTable.SalaryYear) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for SalaryYear. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalSalaryTable.SalaryYear, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by SalaryYear, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + + ' Generate the event handling functions for button events. + + ' event handler for ImageButton + Public Overridable Sub PersonalSalaryAddButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + Me.AddNewRecord = 1 + Me.DataChanged = True + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalSalaryDeleteButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + If(Not Me.Page.IsPageRefresh) Then + + Me.DeleteSelectedRecords(True) + Me.SetFormulaControls() + + + End If + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalSalaryResetButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.CurrentSortOrder.Reset() + If Me.InSession(Me, "Order_By") Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + + End If + + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + + + ' Generate the event handling functions for filter and search events. + + + ' Generate the event handling functions for others + + + Private _UIData As New System.Collections.Generic.List(Of Hashtable) + Public Property UIData() As System.Collections.Generic.List(Of Hashtable) + Get + Return Me._UIData + End Get + Set(ByVal value As System.Collections.Generic.List(Of Hashtable)) + Me._UIData = value + End Set + End Property + + ' pagination properties + Protected _PageSize As Integer + Public Property PageSize() As Integer + Get + Return Me._PageSize + End Get + Set(ByVal value As Integer) + Me._PageSize = value + End Set + End Property + + Protected _PageIndex As Integer + Public Property PageIndex() As Integer + Get + ' Return the PageIndex + Return Me._PageIndex + End Get + Set(ByVal value As Integer) + Me._PageIndex = value + End Set + End Property + + Protected _TotalRecords As Integer = -1 + Public Property TotalRecords() As Integer + Get + If _TotalRecords < 0 + _TotalRecords = PersonalSalaryTable.GetRecordCount(CreateCompoundJoinFilter(), CreateWhereClause()) + End If + Return Me._TotalRecords + End Get + Set(ByVal value As Integer) + If Me.PageSize > 0 Then + + Me.TotalPages = CInt(Math.Ceiling(value / Me.PageSize)) + + End If + Me._TotalRecords = value + End Set + End Property + + + + Protected _TotalPages As Integer = -1 + Public Property TotalPages() As Integer + Get + If _TotalPages < 0 Then + + Me.TotalPages = CInt(Math.Ceiling(TotalRecords / Me.PageSize)) + + End If + Return Me._TotalPages + End Get + Set(ByVal value As Integer) + Me._TotalPages = value + End Set + End Property + + Protected _DisplayLastPage As Boolean + Public Property DisplayLastPage() As Boolean + Get + Return Me._DisplayLastPage + End Get + Set(ByVal value As Boolean) + Me._DisplayLastPage = value + End Set + End Property + + Private _DataChanged As Boolean = False + Public Property DataChanged() As Boolean + Get + Return Me._DataChanged + End Get + Set(ByVal value As Boolean) + Me._DataChanged = value + End Set + End Property + + Private _ResetData As Boolean = False + Public Property ResetData() As Boolean + Get + Return Me._ResetData + End Get + Set(ByVal value As Boolean) + Me._ResetData = value + End Set + End Property + + Private _AddNewRecord As Integer = 0 + Public Property AddNewRecord() As Integer + Get + Return Me._AddNewRecord + End Get + Set(ByVal value As Integer) + Me._AddNewRecord = value + End Set + End Property + + + Private _CurrentSortOrder As OrderBy = Nothing + Public Property CurrentSortOrder() As OrderBy + Get + Return Me._CurrentSortOrder + End Get + Set(ByVal value As BaseClasses.Data.OrderBy) + Me._CurrentSortOrder = value + End Set + End Property + + Private _DataSource() As PersonalSalaryRecord = Nothing + Public Property DataSource() As PersonalSalaryRecord () + Get + Return Me._DataSource + End Get + Set(ByVal value() As PersonalSalaryRecord) + Me._DataSource = value + End Set + End Property + +#Region "Helper Properties" + + Public ReadOnly Property CommandDateLabel2() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "CommandDateLabel2"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property PersonalSalaryAddButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalSalaryAddButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalSalaryDeleteButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalSalaryDeleteButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalSalaryPagination() As Persons.UI.IPagination + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalSalaryPagination"), Persons.UI.IPagination) + End Get + End Property + + Public ReadOnly Property PersonalSalaryResetButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalSalaryResetButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalSalaryTableControlCollapsibleRegion() As System.Web.UI.WebControls.Panel + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalSalaryTableControlCollapsibleRegion"), System.Web.UI.WebControls.Panel) + End Get + End Property + + Public ReadOnly Property PersonalSalaryToggleAll() As System.Web.UI.WebControls.CheckBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalSalaryToggleAll"), System.Web.UI.WebControls.CheckBox) + End Get + End Property + + Public ReadOnly Property PositionSalaryLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PositionSalaryLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property SalaryAmoutLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "SalaryAmoutLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property SalaryCommandLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "SalaryCommandLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property SalaryDateLabel1() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "SalaryDateLabel1"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property SalaryExtra_NotUsedLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "SalaryExtra_NotUsedLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property SalaryPlusLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "SalaryPlusLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property SalaryRankLabel1() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "SalaryRankLabel1"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property SalaryRoundLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "SalaryRoundLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property SalaryStepLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "SalaryStepLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property SalaryYearLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "SalaryYearLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + +#End Region + +#Region "Helper Functions" + + Public Overrides Overloads Function ModifyRedirectUrl(url As String, arg As String, ByVal bEncrypt As Boolean) As String + Return Me.Page.EvaluateExpressions(url, arg, bEncrypt, Me) + End Function + + Public Overrides Overloads Function EvaluateExpressions(url As String, arg As String, ByVal bEncrypt As Boolean) As String + Dim needToProcess As Boolean = AreAnyUrlParametersForMe(url, arg) + If (needToProcess) Then + Dim recCtl As PersonalSalaryTableControlRow = Me.GetSelectedRecordControl() + If recCtl Is Nothing AndAlso url.IndexOf("{") >= 0 Then + ' Localization. + Throw New Exception(Page.GetResourceValue("Err:NoRecSelected", "Persons")) + End If + Dim rec As PersonalSalaryRecord = Nothing + If recCtl IsNot Nothing Then + rec = recCtl.GetRecord() + End If + Return EvaluateExpressions(url, arg, rec, bEncrypt) + End If + Return url + End Function + + Public Overridable Function GetSelectedRecordIndex() As Integer + Dim counter As Integer = 0 + Dim recControl As PersonalSalaryTableControlRow + For Each recControl In Me.GetRecordControls() + If recControl.PersonalSalaryRecordRowSelection.Checked Then + Return counter + End If + counter += 1 + Next + Return -1 + End Function + + Public Overridable Function GetSelectedRecordControl() As PersonalSalaryTableControlRow + Dim selectedList() As PersonalSalaryTableControlRow = Me.GetSelectedRecordControls() + If selectedList.Length = 0 Then + Return Nothing + End If + Return selectedList(0) + + End Function + + Public Overridable Function GetSelectedRecordControls() As PersonalSalaryTableControlRow() + + Dim selectedList As ArrayList = New ArrayList(25) + Dim recControl As PersonalSalaryTableControlRow + For Each recControl In Me.GetRecordControls() + If recControl.PersonalSalaryRecordRowSelection IsNot Nothing AndAlso recControl.PersonalSalaryRecordRowSelection.Checked Then + selectedList.Add(recControl) + End If + Next + Return DirectCast(selectedList.ToArray(GetType(PersonalSalaryTableControlRow)), PersonalSalaryTableControlRow()) + + End Function + + Public Overridable Sub DeleteSelectedRecords(ByVal deferDeletion As Boolean) + Dim recList() As PersonalSalaryTableControlRow = Me.GetSelectedRecordControls() + If recList.Length = 0 Then + ' Localization. + Throw New Exception(Page.GetResourceValue("Err:NoRecSelected", "Persons")) + End If + + Dim recCtl As PersonalSalaryTableControlRow + For Each recCtl In recList + If deferDeletion Then + If Not recCtl.IsNewRecord Then + + Me.AddToDeletedRecordIds(recCtl) + + End If + recCtl.Visible = False + + recCtl.PersonalSalaryRecordRowSelection.Checked = False + + Else + + recCtl.Delete() + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + End If + Next + End Sub + + Public Function GetRecordControls() As PersonalSalaryTableControlRow() + Dim recList As ArrayList = New ArrayList() + Dim rep As System.Web.UI.WebControls.Repeater = CType(Me.FindControl("PersonalSalaryTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return Nothing + Dim repItem As System.Web.UI.WebControls.RepeaterItem + + For Each repItem In rep.Items + + Dim recControl As PersonalSalaryTableControlRow = DirectCast(repItem.FindControl("PersonalSalaryTableControlRow"), PersonalSalaryTableControlRow) + recList.Add(recControl) + + Next + + Return DirectCast(recList.ToArray(GetType(PersonalSalaryTableControlRow)), PersonalSalaryTableControlRow()) + End Function + + Public Shadows ReadOnly Property Page() As BaseApplicationPage + Get + Return DirectCast(MyBase.Page, BaseApplicationPage) + End Get + End Property + +#End Region + + + +End Class + + +' Base class for the PersonalSpecialSkillTableControlRow control on the AddPersonalId page. +' Do not modify this class. Instead override any method in PersonalSpecialSkillTableControlRow. +Public Class BasePersonalSpecialSkillTableControlRow + Inherits Persons.UI.BaseApplicationRecordControl + + ' To customize, override this method in PersonalSpecialSkillTableControlRow. + Protected Overridable Sub Control_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Init + + Me.ClearControlsFromSession() + End Sub + + ' To customize, override this method in PersonalSpecialSkillTableControlRow. + Protected Overridable Sub Control_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load + + 'Call LoadFocusScripts from repeater so that onfocus attribute could be added to elements + Me.Page.LoadFocusScripts(Me) + + ' Show confirmation message on Click + Me.PersonalSpecialSkillRowDeleteButton.Attributes.Add("onClick", "return (confirm('" & (CType(Me.Page,BaseApplicationPage)).GetResourceValue("DeleteRecordConfirm", "Persons") & "'));") + + + ' Register the event handlers. + + AddHandler Me.PersonalSpecialSkillRowDeleteButton.Click, AddressOf PersonalSpecialSkillRowDeleteButton_Click + + AddHandler Me.Level1.TextChanged, AddressOf Level1_TextChanged + + AddHandler Me.Skill.TextChanged, AddressOf Skill_TextChanged + + + End Sub + + + Public Overridable Sub LoadData() + + ' Load the data from the database into the DataSource PersonalSpecialSkill 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 = PersonalSpecialSkillTable.GetRecord(Me.RecordUniqueId, True) + + Return + End If + + ' Since this is a row in the table, the data for this row is loaded by the + ' LoadData method of the BasePersonalSpecialSkillTableControl when the data for the entire + ' table is loaded. + + Me.DataSource = New PersonalSpecialSkillRecord() + + + + End Sub + + ' Populate the UI controls using the DataSource. To customize, override this method in PersonalSpecialSkillTableControlRow. + 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 + + SetLevel1() + + + SetSkill() + + + 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 SetLevel1() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.Level1.ID) Then + + Me.Level1.Text = Me.PreviousUIData(Me.Level1.ID).ToString() + + Return + End If + + + ' Set the Level TextBox on the webpage with value from the + ' PersonalSpecialSkill database record. + + ' Me.DataSource is the PersonalSpecialSkill record retrieved from the database. + ' Me.Level1 is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetLevel1() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.LevelSpecified Then + + ' If the Level is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalSpecialSkillTable.Level) + + Me.Level1.Text = formattedValue + + Else + + ' Level is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.Level1.Text = PersonalSpecialSkillTable.Level.Format(PersonalSpecialSkillTable.Level.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetSkill() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.Skill.ID) Then + + Me.Skill.Text = Me.PreviousUIData(Me.Skill.ID).ToString() + + Return + End If + + + ' Set the Skill TextBox on the webpage with value from the + ' PersonalSpecialSkill database record. + + ' Me.DataSource is the PersonalSpecialSkill record retrieved from the database. + ' Me.Skill is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetSkill() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.SkillSpecified Then + + ' If the Skill is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalSpecialSkillTable.Skill) + + Me.Skill.Text = formattedValue + + Else + + ' Skill is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.Skill.Text = PersonalSpecialSkillTable.Skill.Format(PersonalSpecialSkillTable.Skill.DefaultValue) + + End If + + End Sub + + + Public EvaluateFormulaDelegate As BaseClasses.Data.DataSource.EvaluateFormulaDelegate = New BaseClasses.Data.DataSource.EvaluateFormulaDelegate(AddressOf Me.EvaluateFormula) + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean, ByVal e As FormulaEvaluator) As String + If e Is Nothing Then + e = New FormulaEvaluator() + End If + + e.Variables.Clear() + + + ' add variables for formula evaluation + If variables IsNot Nothing Then + Dim enumerator As System.Collections.Generic.IEnumerator(Of System.Collections.Generic.KeyValuePair(Of String, Object)) = variables.GetEnumerator() + While enumerator.MoveNext() + e.Variables.Add(enumerator.Current.Key, enumerator.Current.Value) + End While + End If + + If includeDS + + End IF + + + ' Other variables referred to in the formula are expected to be + ' properties of the DataSource. For example, referring to + ' UnitPrice as a variable will refer to DataSource.UnitPrice + If dataSourceForEvaluate Is Nothing Then + + e.DataSource = Me.DataSource + + Else + e.DataSource = dataSourceForEvaluate + End If + + ' Define the calling control. This is used to add other + ' related table and record controls as variables. + e.CallingControl = Me + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + + If Not String.IsNullOrEmpty(format) AndAlso (String.IsNullOrEmpty(formula) OrElse formula.IndexOf("Format(") < 0) Then + Return FormulaUtils.Format(resultObj, format) + Else + Return resultObj.ToString() + End If + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format,variables ,includeDS, Nothing) + End Function + + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object)) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format, variables ,True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, format, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal e as FormulaEvaluator) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, variables, True, e) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal includeDS as Boolean) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, includeDS, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, True, Nothing) + End Function + + + Public Overridable Sub RegisterPostback() + + + End Sub + + + + ' To customize, override this method in PersonalSpecialSkillTableControlRow. + 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 parentCtrl As PersonalIdRecordControl + + + parentCtrl = DirectCast(Me.Page.FindControlRecursively("PersonalIdRecordControl"), PersonalIdRecordControl) + + If (Not IsNothing(parentCtrl) AndAlso IsNothing(parentCtrl.DataSource)) + ' Load the record if it is not loaded yet. + parentCtrl.LoadData() + End If + If (IsNothing(parentCtrl) OrElse IsNothing(parentCtrl.DataSource)) + ' Get the error message from the application resource file. + Throw New Exception(Page.GetResourceValue("Err:NoParentRecId", "Persons")) + End If + + Me.DataSource.PersonalId = parentCtrl.DataSource.PersonalId + + ' 2. Perform any custom validation. + Me.Validate() + + + ' 3. Set the values in the record with data from UI controls. + ' This calls the Get() method for each of the user interface controls. + Me.GetUIData() + + ' 4. Save in the database. + ' We should not save the record if the data did not change. This + ' will save a database hit and avoid triggering any database triggers. + + If Me.DataSource.IsAnyValueChanged Then + ' Save record to database but do not commit yet. + ' Auto generated ids are available after saving for use by child (dependent) records. + Me.DataSource.Save() + + DirectCast(GetParentControlObject(Me, "PersonalSpecialSkillTableControl"), PersonalSpecialSkillTableControl).DataChanged = True + DirectCast(GetParentControlObject(Me, "PersonalSpecialSkillTableControl"), PersonalSpecialSkillTableControl).ResetData = True + End If + + + ' update session or cookie by formula + + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + ' For Master-Detail relationships, save data on the Detail table(s) + + End Sub + + ' To customize, override this method in PersonalSpecialSkillTableControlRow. + 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. + + GetLevel1() + GetSkill() + End Sub + + + Public Overridable Sub GetLevel1() + + ' Retrieve the value entered by the user on the Level ASP:TextBox, and + ' save it into the Level field in DataSource PersonalSpecialSkill record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.Level1.Text, PersonalSpecialSkillTable.Level) + + + End Sub + + Public Overridable Sub GetSkill() + + ' Retrieve the value entered by the user on the Skill ASP:TextBox, and + ' save it into the Skill field in DataSource PersonalSpecialSkill record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.Skill.Text, PersonalSpecialSkillTable.Skill) + + + End Sub + + + ' To customize, override this method in PersonalSpecialSkillTableControlRow. + + Public Overridable Function CreateWhereClause() As WhereClause + + Return Nothing + + End Function + + + + ' To customize, override this method in PersonalSpecialSkillTableControlRow. + 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) + PersonalSpecialSkillTable.DeleteRecord(pkValue) + + DirectCast(GetParentControlObject(Me, "PersonalSpecialSkillTableControl"), PersonalSpecialSkillTableControl).DataChanged = True + DirectCast(GetParentControlObject(Me, "PersonalSpecialSkillTableControl"), PersonalSpecialSkillTableControl).ResetData = True + End Sub + + Protected Overridable Sub Control_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.PreRender + ' PreRender event is raised just before page is being displayed. + Try + DbUtils.StartTransaction() + Me.RegisterPostback() + + If Not Me.Page.ErrorOnPage AndAlso (Me.Page.IsPageRefresh OrElse Me.DataChanged OrElse Me.ResetData) Then + + + ' Re-load the data and update the web page if necessary. + ' This is typically done during a postback (filter, search button, sort, pagination button). + ' In each of the other click handlers, simply set DataChanged to True to reload the data. + Me.LoadData() + Me.DataBind() + End If + + + Catch ex As Exception + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + Finally + DbUtils.EndTransaction() + End Try + End Sub + + + Protected Overrides Sub SaveControlsToSession() + MyBase.SaveControlsToSession() + + + 'Save pagination state to session. + + End Sub + + + + Protected Overrides Sub ClearControlsFromSession() + MyBase.ClearControlsFromSession() + + + + ' Clear pagination state from session. + + End Sub + + Protected Overrides Sub LoadViewState(ByVal savedState As Object) + MyBase.LoadViewState(savedState) + Dim isNewRecord As String = CType(ViewState("IsNewRecord"), String) + If Not isNewRecord Is Nothing AndAlso isNewRecord.Trim <> "" Then + Me.IsNewRecord = Boolean.Parse(isNewRecord) + End If + + Dim myCheckSum As String = CType(ViewState("CheckSum"), String) + If Not myCheckSum Is Nothing AndAlso myCheckSum.Trim <> "" Then + Me.CheckSum = myCheckSum + End If + + + ' Load view state for pagination control. + + End Sub + + Protected Overrides Function SaveViewState() As Object + ViewState("IsNewRecord") = Me.IsNewRecord.ToString() + ViewState("CheckSum") = Me.CheckSum + + + ' Load view state for pagination control. + + Return MyBase.SaveViewState() + End Function + + + ' event handler for ImageButton + Public Overridable Sub PersonalSpecialSkillRowDeleteButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + If(Not Me.Page.IsPageRefresh) Then + + Dim tc As PersonalSpecialSkillTableControl = DirectCast(GetParentControlObject(Me, "PersonalSpecialSkillTableControl"), PersonalSpecialSkillTableControl) + If Not (IsNothing(tc)) Then + If Not Me.IsNewRecord Then + tc.AddToDeletedRecordIds(DirectCast(Me, PersonalSpecialSkillTableControlRow)) + End If + Me.Visible = False + tc.SetFormulaControls() + End If + + End If + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + Protected Overridable Sub Level1_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub Skill_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("BasePersonalSpecialSkillTableControlRow_Rec"), String) + End Get + Set(ByVal value As String) + Me.ViewState("BasePersonalSpecialSkillTableControlRow_Rec") = value + End Set + End Property + + Private _DataSource As PersonalSpecialSkillRecord + Public Property DataSource() As PersonalSpecialSkillRecord + Get + Return Me._DataSource + End Get + + Set(ByVal value As PersonalSpecialSkillRecord) + + Me._DataSource = value + End Set + End Property + + + + Private _checkSum As String + Public Overridable Property CheckSum() As String + Get + Return Me._checkSum + End Get + Set(ByVal value As String) + Me._checkSum = value + End Set + End Property + + Private _TotalPages As Integer + Public Property TotalPages() As Integer + Get + Return Me._TotalPages + End Get + Set(ByVal value As Integer) + Me._TotalPages = value + End Set + End Property + + Private _PageIndex As Integer + Public Property PageIndex() As Integer + Get + ' Return the PageIndex + Return Me._PageIndex + End Get + Set(ByVal value As Integer) + Me._PageIndex = value + End Set + End Property + + Private _DisplayLastPage As Boolean + Public Property DisplayLastPage() As Boolean + Get + Return Me._DisplayLastPage + End Get + Set(ByVal value As Boolean) + Me._DisplayLastPage = value + End Set + End Property + + + +#Region "Helper Properties" + + Public ReadOnly Property Level1() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Level1"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property PersonalSpecialSkillRecordRowSelection() As System.Web.UI.WebControls.CheckBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalSpecialSkillRecordRowSelection"), System.Web.UI.WebControls.CheckBox) + End Get + End Property + + Public ReadOnly Property PersonalSpecialSkillRowDeleteButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalSpecialSkillRowDeleteButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property Skill() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Skill"), System.Web.UI.WebControls.TextBox) + 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 PersonalSpecialSkillRecord = 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 PersonalSpecialSkillRecord + If Not Me.DataSource Is Nothing Then + Return Me.DataSource + End If + + If Not Me.RecordUniqueId Is Nothing Then + + Return PersonalSpecialSkillTable.GetRecord(Me.RecordUniqueId, True) + + End If + + ' Localization. + + Return Nothing + + End Function + + Public Shadows ReadOnly Property Page() As BaseApplicationPage + Get + Return DirectCast(MyBase.Page, BaseApplicationPage) + End Get + End Property + +#End Region + +End Class + + + +' Base class for the PersonalSpecialSkillTableControl control on the AddPersonalId page. +' Do not modify this class. Instead override any method in PersonalSpecialSkillTableControl. +Public Class BasePersonalSpecialSkillTableControl + Inherits Persons.UI.BaseApplicationTableControl + + + + Protected Overridable Sub Control_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Init + + + + ' Setup the filter and search events. + + + + ' Control Initializations. + ' Initialize the table's current sort order. + + If Me.InSession(Me, "Order_By") Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + End If + + + + ' Setup default pagination settings. + + Me.PageSize = CInt(Me.GetFromSession(Me, "Page_Size", "10")) + Me.PageIndex = CInt(Me.GetFromSession(Me, "Page_Index", "0")) + + + + Me.ClearControlsFromSession() + End Sub + + Protected Overridable Sub Control_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load + + SaveControlsToSession_Ajax() + + ' Show confirmation message on Click + Me.PersonalSpecialSkillDeleteButton.Attributes.Add("onClick", "return (confirm('" & (CType(Me.Page,BaseApplicationPage)).GetResourceValue("DeleteConfirm", "Persons") & "'));") + + ' Setup the pagination events. + + AddHandler Me.PersonalSpecialSkillPagination.FirstPage.Click, AddressOf PersonalSpecialSkillPagination_FirstPage_Click + + AddHandler Me.PersonalSpecialSkillPagination.LastPage.Click, AddressOf PersonalSpecialSkillPagination_LastPage_Click + + AddHandler Me.PersonalSpecialSkillPagination.NextPage.Click, AddressOf PersonalSpecialSkillPagination_NextPage_Click + + AddHandler Me.PersonalSpecialSkillPagination.PageSizeButton.Click, AddressOf PersonalSpecialSkillPagination_PageSizeButton_Click + + AddHandler Me.PersonalSpecialSkillPagination.PreviousPage.Click, AddressOf PersonalSpecialSkillPagination_PreviousPage_Click + + + ' Setup the sorting events. + + AddHandler Me.LevelLabel3.Click, AddressOf LevelLabel3_Click + + AddHandler Me.SkillLabel1.Click, AddressOf SkillLabel1_Click + + ' Setup the button events. + + AddHandler Me.PersonalSpecialSkillAddButton.Click, AddressOf PersonalSpecialSkillAddButton_Click + + AddHandler Me.PersonalSpecialSkillDeleteButton.Click, AddressOf PersonalSpecialSkillDeleteButton_Click + + AddHandler Me.PersonalSpecialSkillResetButton.Click, AddressOf PersonalSpecialSkillResetButton_Click + + + ' Setup events for others + + End Sub + + + Public Overridable Sub LoadData() + + ' Read data from database. Returns an array of records that can be assigned + ' to the DataSource table control property. + Try + Dim joinFilter As CompoundFilter = CreateCompoundJoinFilter() + + ' The WHERE clause will be empty when displaying all records in table. + Dim wc As WhereClause = CreateWhereClause() + If wc IsNot Nothing AndAlso Not wc.RunQuery Then + ' Initialize an empty array of records + Dim alist As New ArrayList(0) + Me.DataSource = DirectCast(alist.ToArray(GetType(PersonalSpecialSkillRecord)), PersonalSpecialSkillRecord()) + ' Add records to the list if needed. + Me.AddNewRecords() + Me._TotalRecords = 0 + Me._TotalPages = 0 + Return + End If + + ' Call OrderBy to determine the order - either use the order defined + ' on the Query Wizard, or specified by user (by clicking on column heading) + Dim orderBy As OrderBy = CreateOrderBy() + + ' Get the pagesize from the pagesize control. + Me.GetPageSize() + + If Me.DisplayLastPage Then + Dim totalRecords As Integer = If(Me._TotalRecords < 0, PersonalSpecialSkillTable.GetRecordCount(CreateCompoundJoinFilter(), CreateWhereClause()), Me._TotalRecords) + + Dim totalPages As Integer = CInt(Math.Ceiling(totalRecords / Me.PageSize)) + + Me.PageIndex = totalPages - 1 + End If + + ' Make sure PageIndex (current page) and PageSize are within bounds. + If Me.PageIndex < 0 Then + Me.PageIndex = 0 + End If + If Me.PageSize < 1 Then + Me.PageSize = 1 + End If + + ' Retrieve the records and set the table DataSource. + ' Only PageSize records are fetched starting at PageIndex (zero based). + If Me.AddNewRecord > 0 Then + ' Make sure to preserve the previously entered data on new rows. + Dim postdata As New ArrayList + For Each rc As PersonalSpecialSkillTableControlRow In Me.GetRecordControls() + If Not rc.IsNewRecord Then + rc.DataSource = rc.GetRecord() + rc.GetUIData() + postdata.Add(rc.DataSource) + UIData.Add(rc.PreservedUIData()) + End If + Next + Me.DataSource = DirectCast(postdata.ToArray(GetType(PersonalSpecialSkillRecord)), PersonalSpecialSkillRecord()) + Else ' Get the records from the database + Me.DataSource = PersonalSpecialSkillTable.GetRecords(joinFilter, wc, orderBy, Me.PageIndex, Me.PageSize) + + End If + + ' if the datasource contains no records contained in database, then load the last page. + If (DbUtils.GetCreatedRecords(Me.DataSource).Length = 0 AndAlso Not Me.DisplayLastPage) Then + Me.DisplayLastPage = True + LoadData() + Else + + ' Add any new rows desired by the user. + Me.AddNewRecords() + + ' Turn off the ToggleAll checkbox + Me.PersonalSpecialSkillToggleAll.Checked = False + + + ' Initialize the page and grand totals. now + + End If + + Catch ex As Exception + ' Report the error message to the end user + Dim msg As String = ex.Message + If ex.InnerException IsNot Nothing Then + msg = msg & " InnerException: " & ex.InnerException.Message + End If + Throw New Exception(msg, ex.InnerException) + End Try + End Sub + + + + + Public Overrides Sub DataBind() + ' The DataBind method binds the user interface controls to the values + ' from the database record for each row in the table. To do this, it calls the + ' DataBind for each of the rows. + ' DataBind also populates any filters above the table, and sets the pagination + ' control to the correct number of records and the current page number. + + MyBase.DataBind() + + ' Make sure that the DataSource is initialized. + If Me.DataSource Is Nothing Then + Return + End If + + 'LoadData for DataSource for chart and report if they exist + + ' Setup the pagination controls. + BindPaginationControls() + + + + ' Bind the repeater with the list of records to expand the UI. + Dim rep As System.Web.UI.WebControls.Repeater = CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalSpecialSkillTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return + rep.DataSource = DataSource() + rep.DataBind() + + Dim index As Integer = 0 + For Each repItem As System.Web.UI.WebControls.RepeaterItem In rep.Items + ' Loop through all rows in the table, set its DataSource and call DataBind(). + Dim recControl As PersonalSpecialSkillTableControlRow = DirectCast(repItem.FindControl("PersonalSpecialSkillTableControlRow"), PersonalSpecialSkillTableControlRow) + recControl.DataSource = Me.DataSource(index) + If Me.UIData.Count > index Then + recControl.PreviousUIData = Me.UIData(index) + End If + recControl.DataBind() + recControl.Visible = Not Me.InDeletedRecordIds(recControl) + + index += 1 + Next + + + + + ' Call the Set methods for each controls on the panel + + SetLevelLabel3() + + + + + SetPersonalSpecialSkillTableControlCollapsibleRegion() + + SetSkillLabel1() + ' setting the state of expand or collapse alternative rows + + + ' Load data for each record and table UI control. + ' Ordering is important because child controls get + ' their parent ids from their parent UI controls. + + + ' this method calls the set method for controls with special formula like running total, sum, rank, etc + SetFormulaControls() + End Sub + + Public Overridable Sub SetFormulaControls() + ' this method calls Set methods for the control that has special formula + + + + End Sub + + + + Public Overridable Sub RegisterPostback() + + + End Sub + + Public EvaluateFormulaDelegate As BaseClasses.Data.DataSource.EvaluateFormulaDelegate = New BaseClasses.Data.DataSource.EvaluateFormulaDelegate(AddressOf Me.EvaluateFormula) + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean, ByVal e as FormulaEvaluator) As String + If e Is Nothing + e = New FormulaEvaluator() + End If + + e.Variables.Clear() + + + ' add variables for formula evaluation + If variables IsNot Nothing Then + Dim enumerator As System.Collections.Generic.IEnumerator(Of System.Collections.Generic.KeyValuePair(Of String, Object)) = variables.GetEnumerator() + While enumerator.MoveNext() + e.Variables.Add(enumerator.Current.Key, enumerator.Current.Value) + End While + End If + + If includeDS + + End If + + ' All variables referred to in the formula are expected to be + ' properties of the DataSource. For example, referring to + ' UnitPrice as a variable will refer to DataSource.UnitPrice + e.DataSource = dataSourceForEvaluate + + ' Define the calling control. This is used to add other + ' related table and record controls as variables. + e.CallingControl = Me + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + + If Not String.IsNullOrEmpty(format) AndAlso (String.IsNullOrEmpty(formula) OrElse formula.IndexOf("Format(") < 0) Then + Return FormulaUtils.Format(resultObj, format) + Else + Return resultObj.ToString() + End If + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format,variables ,includeDS, Nothing) + End Function + + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object)) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format, variables ,True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, format, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal e as FormulaEvaluator) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, variables, True, e) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal includeDS as Boolean) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, includeDS, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, True, Nothing) + End Function + + + + + Public Overridable Sub ResetControl() + + Me.CurrentSortOrder.Reset() + If (Me.InSession(Me, "Order_By")) Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + End If + + Me.PageIndex = 0 + End Sub + + Protected Overridable Sub BindPaginationControls() + ' Setup the pagination controls. + + ' Bind the pagination labels. + + If DbUtils.GetCreatedRecords(Me.DataSource).Length > 0 Then + + Me.PersonalSpecialSkillPagination.CurrentPage.Text = (Me.PageIndex + 1).ToString() + Else + Me.PersonalSpecialSkillPagination.CurrentPage.Text = "0" + End If + Me.PersonalSpecialSkillPagination.PageSize.Text = Me.PageSize.ToString() + Me.PersonalSpecialSkillPagination.TotalItems.Text = Me.TotalRecords.ToString() + Me.PersonalSpecialSkillPagination.TotalPages.Text = Me.TotalPages.ToString() + + ' Bind the buttons for PersonalSpecialSkillTableControl pagination. + + Me.PersonalSpecialSkillPagination.FirstPage.Enabled = Not (Me.PageIndex = 0) + If Me._TotalPages < 0 Then ' if the total pages is not determined yet, enable last and next buttons + Me.PersonalSpecialSkillPagination.LastPage.Enabled = True + ElseIf Me._TotalPages = 0 ' if the total pages is determined and it is 0, enable last and next buttons + Me.PersonalSpecialSkillPagination.LastPage.Enabled = False + Else ' if the total pages is the last page, disable last and next buttons + Me.PersonalSpecialSkillPagination.LastPage.Enabled = Not (Me.PageIndex = Me.TotalPages - 1) + End If + + If Me._TotalPages < 0 Then ' if the total pages is not determined yet, enable last and next buttons + Me.PersonalSpecialSkillPagination.NextPage.Enabled = True + ElseIf Me._TotalPages = 0 ' if the total pages is determined and it is 0, enable last and next buttons + Me.PersonalSpecialSkillPagination.NextPage.Enabled = False + Else ' if the total pages is the last page, disable last and next buttons + Me.PersonalSpecialSkillPagination.NextPage.Enabled = Not (Me.PageIndex = Me.TotalPages - 1) + End If + + Me.PersonalSpecialSkillPagination.PreviousPage.Enabled = Not (Me.PageIndex = 0) + + + End Sub + + Public Overridable Sub SaveData() + ' Save the data from the entire table. Calls each row's Save Data + ' to save their data. This function is called by the Click handler of the + ' Save button. The button handler should Start/Commit/End a transaction. + + Dim recCtl As PersonalSpecialSkillTableControlRow + For Each recCtl In Me.GetRecordControls() + + If Me.InDeletedRecordIds(recCtl) Then + ' Delete any pending deletes. + recCtl.Delete() + Else + If recCtl.Visible Then + recCtl.SaveData() + End If + End If + + Next + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + ' Set IsNewRecord to False for all records - since everything has been saved and is no longer "new" + For Each recCtl In Me.GetRecordControls() + recCtl.IsNewRecord = False + Next + + + ' Set DeletedRecordsIds to Nothing since we have deleted all pending deletes. + Me.DeletedRecordIds = Nothing + + End Sub + + Public Overridable Function CreateCompoundJoinFilter() As CompoundFilter + Dim jFilter As CompoundFilter = New CompoundFilter() + + Return jFilter + + End Function + + + Public Overridable Function CreateOrderBy() As OrderBy + ' The CurrentSortOrder is initialized to the sort order on the + ' Query Wizard. It may be modified by the Click handler for any of + ' the column heading to sort or reverse sort by that column. + ' You can add your own sort order, or modify it on the Query Wizard. + Return Me.CurrentSortOrder + End Function + + Public Overridable Function CreateWhereClause() As WhereClause + 'This CreateWhereClause is used for loading the data. + PersonalSpecialSkillTable.Instance.InnerFilter = Nothing + Dim wc As WhereClause = New WhereClause() + + ' Compose the WHERE clause consiting of: + ' 1. Static clause defined at design time. + ' 2. User selected search criteria. + ' 3. User selected filter criteria. + + + Dim selectedRecordKeyValue as KeyValue = New KeyValue() + + Dim personalIdRecordControlObj As Persons.UI.Controls.AddPersonalId.PersonalIdRecordControl = DirectCast(MiscUtils.FindControlRecursively(Me.Page, "PersonalIdRecordControl"), Persons.UI.Controls.AddPersonalId.PersonalIdRecordControl) + + If (Not IsNothing(personalIdRecordControlObj) AndAlso Not IsNothing(personalIdRecordControlObj.GetRecord()) AndAlso personalIdRecordControlObj.GetRecord().IsCreated AndAlso Not IsNothing(personalIdRecordControlObj.GetRecord().PersonalId)) + wc.iAND(PersonalSpecialSkillTable.PersonalId, BaseFilter.ComparisonOperator.EqualsTo, personalIdRecordControlObj.GetRecord().PersonalId.ToString()) + selectedRecordKeyValue.AddElement(PersonalSpecialSkillTable.PersonalId.InternalName, personalIdRecordControlObj.GetRecord().PersonalId.ToString()) + Else + wc.RunQuery = False + Return wc + End If + + HttpContext.Current.Session("PersonalSpecialSkillTableControlWhereClause") = selectedRecordKeyValue.ToXmlString() + + Return wc + End Function + + + Public Overridable Function CreateWhereClause(ByVal searchText as String, ByVal fromSearchControl as String, ByVal AutoTypeAheadSearch as String, ByVal AutoTypeAheadWordSeparators as String) As WhereClause + ' This CreateWhereClause is used for loading list of suggestions for Auto Type-Ahead feature. + PersonalSpecialSkillTable.Instance.InnerFilter = Nothing + Dim wc As WhereClause = New WhereClause() + + ' Compose the WHERE clause consiting of: + ' 1. Static clause defined at design time. + ' 2. User selected search criteria. + ' 3. User selected filter criteria. + + Dim appRelativeVirtualPath As String = CType(HttpContext.Current.Session("AppRelativeVirtualPath"), String) + + Dim selectedRecordInPersonalIdRecordControl as String = DirectCast(HttpContext.Current.Session("PersonalSpecialSkillTableControlWhereClause"), String) + + If Not selectedRecordInPersonalIdRecordControl Is Nothing AndAlso KeyValue.IsXmlKey(selectedRecordInPersonalIdRecordControl) Then + Dim selectedRecordKeyValue as KeyValue = KeyValue.XmlToKey(selectedRecordInPersonalIdRecordControl) + + If Not IsNothing(selectedRecordKeyValue) AndAlso selectedRecordKeyValue.ContainsColumn(PersonalSpecialSkillTable.PersonalId) Then + wc.iAND(PersonalSpecialSkillTable.PersonalId, BaseFilter.ComparisonOperator.EqualsTo, selectedRecordKeyValue.GetColumnValue(PersonalSpecialSkillTable.PersonalId).ToString()) + End If + + End If + + ' Adds clauses if values are selected in Filter controls which are configured in the page. + + + Return wc + End Function + + + Public Overridable Function FormatSuggestions(ByVal prefixText As String, ByVal resultItem As String, _ + ByVal columnLength As Integer, ByVal AutoTypeAheadDisplayFoundText As String, _ + ByVal autoTypeAheadSearch As String, ByVal AutoTypeAheadWordSeparators As String, _ + ByVal resultList As ArrayList) As Boolean + + 'Formats the resultItem and adds it to the list of suggestions. + Dim index As Integer = resultItem.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture).IndexOf(prefixText.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture)) + Dim itemToAdd As String = "" + Dim isFound As Boolean = False + Dim isAdded As Boolean = False + ' Get the index where prfixt is at the beginning of resultItem. If not found then, index of word which begins with prefixText. + If InvariantLCase(autoTypeAheadSearch).equals("wordsstartingwithsearchstring") And Not index = 0 Then + ' Expression to find word which contains AutoTypeAheadWordSeparators followed by prefixText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex( AutoTypeAheadWordSeparators + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + If regex1.IsMatch(resultItem) Then + index = regex1.Match(resultItem).Index + isFound = True + End If + ' If the prefixText is found immediatly after white space then starting of the word is found so don not search any further + If not resultItem(index).ToString() = " " Then + ' Expression to find beginning of the word which contains AutoTypeAheadWordSeparators followed by prefixText + Dim regex As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\\S*" + AutoTypeAheadWordSeparators + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + If regex.IsMatch(resultItem) Then + index = regex.Match(resultItem).Index + isFound = True + End If + End If + End If + + ' If autoTypeAheadSearch value is wordsstartingwithsearchstring then, extract the substring only if the prefixText is found at the + ' beginning of the resultItem (index = 0) or a word in resultItem is found starts with prefixText. + If index = 0 Or isFound Or InvariantLCase(autoTypeAheadSearch).Equals("anywhereinstring") then + If InvariantLCase(AutoTypeAheadDisplayFoundText).equals("atbeginningofmatchedstring") Then + ' Expression to find beginning of the word which contains prefixText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\\S*" + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + ' Find the beginning of the word which contains prefexText + If (StringUtils.InvariantLCase(autoTypeAheadSearch).Equals("anywhereinstring") AndAlso regex1.IsMatch(resultItem)) Then + index = regex1.Match(resultItem).Index + isFound = True + End If + ' Display string from the index till end of the string if sub string from index till end is less than columnLength value. + If Len(resultItem) - index <= columnLength Then + If index = 0 Then + itemToAdd = resultItem + Else + itemToAdd = "..." & resultItem.Substring(index, Len(resultItem) - index) + End If + Else + If index = 0 Then + itemToAdd = resultItem.Substring(index, (columnLength - 3)) & "..." + Else + 'Truncate the string to show only columnLength - 6 characters as begining and trailing "..." has to be appended. + itemToAdd = "..." & resultItem.Substring(index , columnLength - 6) & "..." + End If + End If + ElseIf InvariantLCase(AutoTypeAheadDisplayFoundText).equals("inmiddleofmatchedstring") Then + Dim subStringBeginIndex As Integer = CType(columnLength/2, Integer) + If Len(resultItem) <= columnLength Then + itemToAdd = resultItem + Else + ' Sanity check at end of the string + If index + Len(prefixText) = columnLength Then + itemToAdd = "..." & resultItem.Substring(index-columnLength,index) + ElseIf Len(resultItem) - index < subStringBeginIndex Then + ' Display string from the end till columnLength value if, index is closer to the end of the string. + itemToAdd = "..." & resultItem.Substring(Len(resultItem)-columnLength,Len(resultItem)) + ElseIf index <= subStringBeginIndex Then + ' Sanity chet at beginning of the string + itemToAdd = resultItem.Substring(0, columnLength) & "..." + Else + ' Display string containing text before the prefixText occures and text after the prefixText + itemToAdd = "..." & resultItem.Substring(index - subStringBeginIndex, columnLength) & "..." + End If + End If + ElseIf InvariantLCase(AutoTypeAheadDisplayFoundText).equals("atendofmatchedstring") Then + ' Expression to find ending of the word which contains prefexText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\s", System.Text.RegularExpressions.RegexOptions.IgnoreCase) + ' Find the ending of the word which contains prefexText + If regex1.IsMatch(resultItem, index + 1) Then + index = regex1.Match(resultItem, index + 1).Index + Else + ' If the word which contains prefexText is the last word in string, regex1.IsMatch returns false. + index = resultItem.Length + End If + If index > Len(resultItem) Then + index = Len(resultItem) + End If + ' If text from beginning of the string till index is less than columnLength value then, display string from the beginning till index. + If index <= columnLength Then + if index = Len(resultItem) Then 'Make decision to append "..." + itemToAdd = resultItem.Substring(0,index) + Else + itemToAdd = resultItem.Substring(0,index) & "..." + End If + Else + If index = Len(resultItem) Then + itemToAdd = "..." & resultItem.Substring(index - (columnLength - 3), (columnLength - 3)) + Else + 'Truncate the string to show only columnLength - 6 characters as begining and trailing "..." has to be appended. + itemToAdd = "..." & resultItem.Substring(index - (columnLength - 6), columnLength - 6) & "..." + End If + End If + End If + + ' Remove newline character from itemToAdd + Dim prefixTextIndex As Integer = itemToAdd.IndexOf(prefixText, StringComparison.CurrentCultureIgnoreCase) + ' If itemToAdd contains any newline after the search text then show text only till newline + Dim regex2 As System.Text.RegularExpressions.Regex = New System.Text.RegularExpressions.Regex("(" & vbCrLf & "|" & vbLf & ")", System.Text.RegularExpressions.RegexOptions.IgnoreCase) + Dim newLineIndexAfterPrefix As Integer = -1 + If regex2.IsMatch(itemToAdd, prefixTextIndex) Then + newLineIndexAfterPrefix = regex2.Match(itemToAdd, prefixTextIndex).Index + End If + If (newLineIndexAfterPrefix > -1) Then + If itemToAdd.EndsWith("...") Then + itemToAdd = (itemToAdd.Substring(0, newLineIndexAfterPrefix) + "...") + Else + itemToAdd = itemToAdd.Substring(0, newLineIndexAfterPrefix) + End If + End If + ' If itemToAdd contains any newline before search text then show text which comes after newline + Dim regex3 As System.Text.RegularExpressions.Regex = New System.Text.RegularExpressions.Regex("(" & vbCrLf & "|" & vbLf & ")", (System.Text.RegularExpressions.RegexOptions.IgnoreCase Or System.Text.RegularExpressions.RegexOptions.RightToLeft)) + Dim newLineIndexBeforePrefix As Integer = -1 + If regex3.IsMatch(itemToAdd, prefixTextIndex) Then + newLineIndexBeforePrefix = regex3.Match(itemToAdd, prefixTextIndex).Index + End If + If (newLineIndexBeforePrefix > -1) Then + If itemToAdd.StartsWith("...") Then + itemToAdd = ("..." + itemToAdd.Substring((newLineIndexBeforePrefix + regex3.Match(itemToAdd, prefixTextIndex).Length))) + Else + itemToAdd = itemToAdd.Substring((newLineIndexBeforePrefix + regex3.Match(itemToAdd, prefixTextIndex).Length)) + End If + End If + + If Not itemToAdd is nothing AndAlso Not resultList.Contains(itemToAdd) Then + + resultList.Add(itemToAdd) + + isAdded = true + End If + End If + Return isAdded + End Function + + + Protected Overridable Sub GetPageSize() + + If Me.PersonalSpecialSkillPagination.PageSize.Text.Trim <> "" Then + Try + 'Me.PageSize = Integer.Parse(Me.PersonalSpecialSkillPagination.PageSize.Text) + Catch ex As Exception + End Try + End If + End Sub + + Protected Overridable Sub AddNewRecords() + + Dim newRecordList As ArrayList = New ArrayList() + + Dim newUIDataList As System.Collections.Generic.List(Of Hashtable) = New System.Collections.Generic.List(Of Hashtable)() + + ' Loop though all the record controls and if the record control + ' does not have a unique record id set, then create a record + ' and add to the list. + If Not Me.ResetData Then + Dim rep As System.Web.UI.WebControls.Repeater = CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalSpecialSkillTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return + + Dim repItem As System.Web.UI.WebControls.RepeaterItem + For Each repItem In rep.Items + ' Loop through all rows in the table, set its DataSource and call DataBind(). + + Dim recControl As PersonalSpecialSkillTableControlRow = DirectCast(repItem.FindControl("PersonalSpecialSkillTableControlRow"), PersonalSpecialSkillTableControlRow) + + If recControl.Visible AndAlso recControl.IsNewRecord() Then + + Dim rec As PersonalSpecialSkillRecord = New PersonalSpecialSkillRecord() + + If recControl.Level1.Text <> "" Then + rec.Parse(recControl.Level1.Text, PersonalSpecialSkillTable.Level) + End If + If recControl.Skill.Text <> "" Then + rec.Parse(recControl.Skill.Text, PersonalSpecialSkillTable.Skill) + End If + newUIDataList.Add(recControl.PreservedUIData()) + newRecordList.Add(rec) + End If + Next + End If + + + ' Add any new record to the list. + Dim index As Integer = 0 + For index = 1 To Me.AddNewRecord + + newRecordList.Insert(0, New PersonalSpecialSkillRecord()) + newUIDataList.Insert(0, New Hashtable()) + + Next + Me.AddNewRecord = 0 + + ' Finally, add any new records to the DataSource. + If newRecordList.Count > 0 Then + + Dim finalList As ArrayList = New ArrayList(Me.DataSource) + finalList.InsertRange(0, newRecordList) + + Me.DataSource = DirectCast(finalList.ToArray(GetType(PersonalSpecialSkillRecord)), PersonalSpecialSkillRecord()) + + End If + + ' Add the existing UI data to this hash table + If newUIDataList.Count > 0 Then + Me.UIData.InsertRange(0, newUIDataList) + End If + + End Sub + + + Public Sub AddToDeletedRecordIds(ByVal rec As PersonalSpecialSkillTableControlRow) + If rec.IsNewRecord() Then + Return + End If + + If Not Me.DeletedRecordIds Is Nothing AndAlso Me.DeletedRecordIds.Trim <> "" Then + Me.DeletedRecordIds &= "," + End If + + Me.DeletedRecordIds &= "[" & rec.RecordUniqueId & "]" + End Sub + + Protected Overridable Function InDeletedRecordIds(ByVal rec As PersonalSpecialSkillTableControlRow) As Boolean + If Me.DeletedRecordIds Is Nothing OrElse Me.DeletedRecordIds.Trim = "" Then + Return False + End If + + Return Me.DeletedRecordIds.IndexOf("[" & rec.RecordUniqueId & "]") >= 0 + End Function + + Private _DeletedRecordIds As String + Public Property DeletedRecordIds() As String + Get + Return Me._DeletedRecordIds + End Get + Set(ByVal value As String) + Me._DeletedRecordIds = value + End Set + End Property + + + ' Create Set, WhereClause, and Populate Methods + + Public Overridable Sub SetLevelLabel3() + + End Sub + + Public Overridable Sub SetPersonalSpecialSkillTableControlCollapsibleRegion() + + End Sub + + Public Overridable Sub SetSkillLabel1() + + 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. + Dim added As Boolean = Me.AddNewRecord > 0 + Me.LoadData() + Me.DataBind() + + If added Then + Me.SetFocusToAddedRow() + End If + + End If + + + + Catch ex As Exception + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + Finally + DbUtils.EndTransaction + End Try + End Sub + + 'this function sets focus to the first editable element in the new added row in the editable table + Protected Overridable Sub SetFocusToAddedRow() + Dim rep As System.Web.UI.WebControls.Repeater = CType(Me.FindControl("PersonalSpecialSkillTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing OrElse rep.Items.Count = 0 Then Return + Dim repItem As System.Web.UI.WebControls.RepeaterItem + For Each repItem In rep.Items + 'Load scripts to table rows + Me.Page.LoadFocusScripts(repItem) + Dim recControl As PersonalSpecialSkillTableControlRow = DirectCast(repItem.FindControl("PersonalSpecialSkillTableControlRow"), PersonalSpecialSkillTableControlRow) + If recControl.IsNewRecord Then + For Each field As Control In recControl.Controls + If field.Visible AndAlso Me.Page.IsControlEditable(field, False) Then + 'set focus on the first editable field in the new row + field.Focus() + Dim updPan As UpdatePanel = DirectCast(Me.Page.FindControlRecursively("UpdatePanel1"), UpdatePanel) + If Not updPan Is Nothing Then updPan.Update() + Return + End If + Next + Return + End If + Next + End Sub + + + Protected Overrides Sub SaveControlsToSession() + MyBase.SaveControlsToSession() + + ' Save filter controls to values to session. + + + 'Save pagination state to session. + + + + ' Save table control properties to the session. + If Not Me.CurrentSortOrder Is Nothing Then + Me.SaveToSession(Me, "Order_By", Me.CurrentSortOrder.ToXmlString()) + End If + + Me.SaveToSession(Me, "Page_Index", Me.PageIndex.ToString()) + Me.SaveToSession(Me, "Page_Size", Me.PageSize.ToString()) + + Me.SaveToSession(Me, "DeletedRecordIds", Me.DeletedRecordIds) + + End Sub + + Protected Sub SaveControlsToSession_Ajax() + ' Save filter controls to values to session. + + HttpContext.Current.Session("AppRelativeVirtualPath") = Me.Page.AppRelativeVirtualPath + + End Sub + + Protected Overrides Sub ClearControlsFromSession() + MyBase.ClearControlsFromSession() + + ' Clear filter controls values from the session. + + + ' Clear pagination state from session. + + + + ' Clear table properties from the session. + Me.RemoveFromSession(Me, "Order_By") + Me.RemoveFromSession(Me, "Page_Index") + Me.RemoveFromSession(Me, "Page_Size") + + Me.RemoveFromSession(Me, "DeletedRecordIds") + + End Sub + + Protected Overrides Sub LoadViewState(ByVal savedState As Object) + MyBase.LoadViewState(savedState) + + Dim orderByStr As String = CType(ViewState("PersonalSpecialSkillTableControl_OrderBy"), String) + + If orderByStr IsNot Nothing AndAlso orderByStr.Trim <> "" Then + Me.CurrentSortOrder = BaseClasses.Data.OrderBy.FromXmlString(orderByStr) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + End If + + Dim pageIndex As String = CType(ViewState("Page_Index"), String) + If pageIndex IsNot Nothing Then + Me.PageIndex = CInt(pageIndex) + End If + + Dim pageSize As String = CType(ViewState("Page_Size"), String) + If Not pageSize Is Nothing Then + Me.PageSize = CInt(pageSize) + End If + + + + ' Load view state for pagination control. + + Me.DeletedRecordIds = CType(Me.ViewState("DeletedRecordIds"), String) + + End Sub + + Protected Overrides Function SaveViewState() As Object + + If Me.CurrentSortOrder IsNot Nothing Then + Me.ViewState("PersonalSpecialSkillTableControl_OrderBy") = Me.CurrentSortOrder.ToXmlString() + End If + + Me.ViewState("Page_Index") = Me.PageIndex + Me.ViewState("Page_Size") = Me.PageSize + + Me.ViewState("DeletedRecordIds") = Me.DeletedRecordIds + + + ' Load view state for pagination control. + + + Return MyBase.SaveViewState() + End Function + + ' Generate the event handling functions for pagination events. + + ' event handler for ImageButton + Public Overridable Sub PersonalSpecialSkillPagination_FirstPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.PageIndex = 0 + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalSpecialSkillPagination_LastPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.DisplayLastPage = True + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalSpecialSkillPagination_NextPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.PageIndex += 1 + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for LinkButton + Public Overridable Sub PersonalSpecialSkillPagination_PageSizeButton_Click(ByVal sender As Object, ByVal args As EventArgs) + + Try + + Me.DataChanged = True + + Me.PageSize = Integer.Parse(Me.PersonalSpecialSkillPagination.PageSize.Text) + + Me.PageIndex = Integer.Parse(Me.PersonalSpecialSkillPagination.CurrentPage.Text) - 1 + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalSpecialSkillPagination_PreviousPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + If Me.PageIndex > 0 Then + Me.PageIndex -= 1 + Me.DataChanged = True + End If + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + + ' Generate the event handling functions for sorting events. + + Public Overridable Sub LevelLabel3_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by Level when clicked. + + ' Get previous sorting state for Level. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalSpecialSkillTable.Level) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for Level. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalSpecialSkillTable.Level, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by Level, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub SkillLabel1_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by Skill when clicked. + + ' Get previous sorting state for Skill. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalSpecialSkillTable.Skill) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for Skill. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalSpecialSkillTable.Skill, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by Skill, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + + ' Generate the event handling functions for button events. + + ' event handler for ImageButton + Public Overridable Sub PersonalSpecialSkillAddButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + Me.AddNewRecord = 1 + Me.DataChanged = True + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalSpecialSkillDeleteButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + If(Not Me.Page.IsPageRefresh) Then + + Me.DeleteSelectedRecords(True) + Me.SetFormulaControls() + + + End If + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalSpecialSkillResetButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.CurrentSortOrder.Reset() + If Me.InSession(Me, "Order_By") Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + + End If + + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + + + ' Generate the event handling functions for filter and search events. + + + ' Generate the event handling functions for others + + + Private _UIData As New System.Collections.Generic.List(Of Hashtable) + Public Property UIData() As System.Collections.Generic.List(Of Hashtable) + Get + Return Me._UIData + End Get + Set(ByVal value As System.Collections.Generic.List(Of Hashtable)) + Me._UIData = value + End Set + End Property + + ' pagination properties + Protected _PageSize As Integer + Public Property PageSize() As Integer + Get + Return Me._PageSize + End Get + Set(ByVal value As Integer) + Me._PageSize = value + End Set + End Property + + Protected _PageIndex As Integer + Public Property PageIndex() As Integer + Get + ' Return the PageIndex + Return Me._PageIndex + End Get + Set(ByVal value As Integer) + Me._PageIndex = value + End Set + End Property + + Protected _TotalRecords As Integer = -1 + Public Property TotalRecords() As Integer + Get + If _TotalRecords < 0 + _TotalRecords = PersonalSpecialSkillTable.GetRecordCount(CreateCompoundJoinFilter(), CreateWhereClause()) + End If + Return Me._TotalRecords + End Get + Set(ByVal value As Integer) + If Me.PageSize > 0 Then + + Me.TotalPages = CInt(Math.Ceiling(value / Me.PageSize)) + + End If + Me._TotalRecords = value + End Set + End Property + + + + Protected _TotalPages As Integer = -1 + Public Property TotalPages() As Integer + Get + If _TotalPages < 0 Then + + Me.TotalPages = CInt(Math.Ceiling(TotalRecords / Me.PageSize)) + + End If + Return Me._TotalPages + End Get + Set(ByVal value As Integer) + Me._TotalPages = value + End Set + End Property + + Protected _DisplayLastPage As Boolean + Public Property DisplayLastPage() As Boolean + Get + Return Me._DisplayLastPage + End Get + Set(ByVal value As Boolean) + Me._DisplayLastPage = value + End Set + End Property + + Private _DataChanged As Boolean = False + Public Property DataChanged() As Boolean + Get + Return Me._DataChanged + End Get + Set(ByVal value As Boolean) + Me._DataChanged = value + End Set + End Property + + Private _ResetData As Boolean = False + Public Property ResetData() As Boolean + Get + Return Me._ResetData + End Get + Set(ByVal value As Boolean) + Me._ResetData = value + End Set + End Property + + Private _AddNewRecord As Integer = 0 + Public Property AddNewRecord() As Integer + Get + Return Me._AddNewRecord + End Get + Set(ByVal value As Integer) + Me._AddNewRecord = value + End Set + End Property + + + Private _CurrentSortOrder As OrderBy = Nothing + Public Property CurrentSortOrder() As OrderBy + Get + Return Me._CurrentSortOrder + End Get + Set(ByVal value As BaseClasses.Data.OrderBy) + Me._CurrentSortOrder = value + End Set + End Property + + Private _DataSource() As PersonalSpecialSkillRecord = Nothing + Public Property DataSource() As PersonalSpecialSkillRecord () + Get + Return Me._DataSource + End Get + Set(ByVal value() As PersonalSpecialSkillRecord) + Me._DataSource = value + End Set + End Property + +#Region "Helper Properties" + + Public ReadOnly Property LevelLabel3() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "LevelLabel3"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property PersonalSpecialSkillAddButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalSpecialSkillAddButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalSpecialSkillDeleteButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalSpecialSkillDeleteButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalSpecialSkillPagination() As Persons.UI.IPagination + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalSpecialSkillPagination"), Persons.UI.IPagination) + End Get + End Property + + Public ReadOnly Property PersonalSpecialSkillResetButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalSpecialSkillResetButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalSpecialSkillTableControlCollapsibleRegion() As System.Web.UI.WebControls.Panel + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalSpecialSkillTableControlCollapsibleRegion"), System.Web.UI.WebControls.Panel) + End Get + End Property + + Public ReadOnly Property PersonalSpecialSkillToggleAll() As System.Web.UI.WebControls.CheckBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalSpecialSkillToggleAll"), System.Web.UI.WebControls.CheckBox) + End Get + End Property + + Public ReadOnly Property SkillLabel1() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "SkillLabel1"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + +#End Region + +#Region "Helper Functions" + + Public Overrides Overloads Function ModifyRedirectUrl(url As String, arg As String, ByVal bEncrypt As Boolean) As String + Return Me.Page.EvaluateExpressions(url, arg, bEncrypt, Me) + End Function + + Public Overrides Overloads Function EvaluateExpressions(url As String, arg As String, ByVal bEncrypt As Boolean) As String + Dim needToProcess As Boolean = AreAnyUrlParametersForMe(url, arg) + If (needToProcess) Then + Dim recCtl As PersonalSpecialSkillTableControlRow = Me.GetSelectedRecordControl() + If recCtl Is Nothing AndAlso url.IndexOf("{") >= 0 Then + ' Localization. + Throw New Exception(Page.GetResourceValue("Err:NoRecSelected", "Persons")) + End If + Dim rec As PersonalSpecialSkillRecord = Nothing + If recCtl IsNot Nothing Then + rec = recCtl.GetRecord() + End If + Return EvaluateExpressions(url, arg, rec, bEncrypt) + End If + Return url + End Function + + Public Overridable Function GetSelectedRecordIndex() As Integer + Dim counter As Integer = 0 + Dim recControl As PersonalSpecialSkillTableControlRow + For Each recControl In Me.GetRecordControls() + If recControl.PersonalSpecialSkillRecordRowSelection.Checked Then + Return counter + End If + counter += 1 + Next + Return -1 + End Function + + Public Overridable Function GetSelectedRecordControl() As PersonalSpecialSkillTableControlRow + Dim selectedList() As PersonalSpecialSkillTableControlRow = Me.GetSelectedRecordControls() + If selectedList.Length = 0 Then + Return Nothing + End If + Return selectedList(0) + + End Function + + Public Overridable Function GetSelectedRecordControls() As PersonalSpecialSkillTableControlRow() + + Dim selectedList As ArrayList = New ArrayList(25) + Dim recControl As PersonalSpecialSkillTableControlRow + For Each recControl In Me.GetRecordControls() + If recControl.PersonalSpecialSkillRecordRowSelection IsNot Nothing AndAlso recControl.PersonalSpecialSkillRecordRowSelection.Checked Then + selectedList.Add(recControl) + End If + Next + Return DirectCast(selectedList.ToArray(GetType(PersonalSpecialSkillTableControlRow)), PersonalSpecialSkillTableControlRow()) + + End Function + + Public Overridable Sub DeleteSelectedRecords(ByVal deferDeletion As Boolean) + Dim recList() As PersonalSpecialSkillTableControlRow = Me.GetSelectedRecordControls() + If recList.Length = 0 Then + ' Localization. + Throw New Exception(Page.GetResourceValue("Err:NoRecSelected", "Persons")) + End If + + Dim recCtl As PersonalSpecialSkillTableControlRow + For Each recCtl In recList + If deferDeletion Then + If Not recCtl.IsNewRecord Then + + Me.AddToDeletedRecordIds(recCtl) + + End If + recCtl.Visible = False + + recCtl.PersonalSpecialSkillRecordRowSelection.Checked = False + + Else + + recCtl.Delete() + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + End If + Next + End Sub + + Public Function GetRecordControls() As PersonalSpecialSkillTableControlRow() + Dim recList As ArrayList = New ArrayList() + Dim rep As System.Web.UI.WebControls.Repeater = CType(Me.FindControl("PersonalSpecialSkillTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return Nothing + Dim repItem As System.Web.UI.WebControls.RepeaterItem + + For Each repItem In rep.Items + + Dim recControl As PersonalSpecialSkillTableControlRow = DirectCast(repItem.FindControl("PersonalSpecialSkillTableControlRow"), PersonalSpecialSkillTableControlRow) + recList.Add(recControl) + + Next + + Return DirectCast(recList.ToArray(GetType(PersonalSpecialSkillTableControlRow)), PersonalSpecialSkillTableControlRow()) + End Function + + Public Shadows ReadOnly Property Page() As BaseApplicationPage + Get + Return DirectCast(MyBase.Page, BaseApplicationPage) + End Get + End Property + +#End Region + + + +End Class + + +' Base class for the PersonalSportSkillTableControlRow control on the AddPersonalId page. +' Do not modify this class. Instead override any method in PersonalSportSkillTableControlRow. +Public Class BasePersonalSportSkillTableControlRow + Inherits Persons.UI.BaseApplicationRecordControl + + ' To customize, override this method in PersonalSportSkillTableControlRow. + Protected Overridable Sub Control_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Init + + Me.ClearControlsFromSession() + End Sub + + ' To customize, override this method in PersonalSportSkillTableControlRow. + Protected Overridable Sub Control_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load + + 'Call LoadFocusScripts from repeater so that onfocus attribute could be added to elements + Me.Page.LoadFocusScripts(Me) + + ' Show confirmation message on Click + Me.PersonalSportSkillRowDeleteButton.Attributes.Add("onClick", "return (confirm('" & (CType(Me.Page,BaseApplicationPage)).GetResourceValue("DeleteRecordConfirm", "Persons") & "'));") + + + ' Register the event handlers. + + AddHandler Me.PersonalSportSkillRowDeleteButton.Click, AddressOf PersonalSportSkillRowDeleteButton_Click + + AddHandler Me.Level2.TextChanged, AddressOf Level2_TextChanged + + AddHandler Me.SportId.TextChanged, AddressOf SportId_TextChanged + + + End Sub + + + Public Overridable Sub LoadData() + + ' Load the data from the database into the DataSource PersonalSportSkill 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 = PersonalSportSkillTable.GetRecord(Me.RecordUniqueId, True) + + Return + End If + + ' Since this is a row in the table, the data for this row is loaded by the + ' LoadData method of the BasePersonalSportSkillTableControl when the data for the entire + ' table is loaded. + + Me.DataSource = New PersonalSportSkillRecord() + + + + End Sub + + ' Populate the UI controls using the DataSource. To customize, override this method in PersonalSportSkillTableControlRow. + 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 + + SetLevel2() + + + SetSportId() + + + 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 SetLevel2() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.Level2.ID) Then + + Me.Level2.Text = Me.PreviousUIData(Me.Level2.ID).ToString() + + Return + End If + + + ' Set the Level TextBox on the webpage with value from the + ' PersonalSportSkill database record. + + ' Me.DataSource is the PersonalSportSkill record retrieved from the database. + ' Me.Level2 is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetLevel2() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.LevelSpecified Then + + ' If the Level is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalSportSkillTable.Level) + + Me.Level2.Text = formattedValue + + Else + + ' Level is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.Level2.Text = PersonalSportSkillTable.Level.Format(PersonalSportSkillTable.Level.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetSportId() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.SportId.ID) Then + + Me.SportId.Text = Me.PreviousUIData(Me.SportId.ID).ToString() + + Return + End If + + + ' Set the SportId TextBox on the webpage with value from the + ' PersonalSportSkill database record. + + ' Me.DataSource is the PersonalSportSkill record retrieved from the database. + ' Me.SportId is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetSportId() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.SportIdSpecified Then + + ' If the SportId is non-NULL, then format the value. + + ' The Format method will return the Display Foreign Key As (DFKA) value + Dim formattedValue As String = Me.DataSource.SportId.ToString() + + + Me.SportId.Text = formattedValue + + Else + + ' SportId is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.SportId.Text = PersonalSportSkillTable.SportId.DefaultValue + End If + + End Sub + + + Public EvaluateFormulaDelegate As BaseClasses.Data.DataSource.EvaluateFormulaDelegate = New BaseClasses.Data.DataSource.EvaluateFormulaDelegate(AddressOf Me.EvaluateFormula) + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean, ByVal e As FormulaEvaluator) As String + If e Is Nothing Then + e = New FormulaEvaluator() + End If + + e.Variables.Clear() + + + ' add variables for formula evaluation + If variables IsNot Nothing Then + Dim enumerator As System.Collections.Generic.IEnumerator(Of System.Collections.Generic.KeyValuePair(Of String, Object)) = variables.GetEnumerator() + While enumerator.MoveNext() + e.Variables.Add(enumerator.Current.Key, enumerator.Current.Value) + End While + End If + + If includeDS + + End IF + + + ' Other variables referred to in the formula are expected to be + ' properties of the DataSource. For example, referring to + ' UnitPrice as a variable will refer to DataSource.UnitPrice + If dataSourceForEvaluate Is Nothing Then + + e.DataSource = Me.DataSource + + Else + e.DataSource = dataSourceForEvaluate + End If + + ' Define the calling control. This is used to add other + ' related table and record controls as variables. + e.CallingControl = Me + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + + If Not String.IsNullOrEmpty(format) AndAlso (String.IsNullOrEmpty(formula) OrElse formula.IndexOf("Format(") < 0) Then + Return FormulaUtils.Format(resultObj, format) + Else + Return resultObj.ToString() + End If + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format,variables ,includeDS, Nothing) + End Function + + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object)) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format, variables ,True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, format, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal e as FormulaEvaluator) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, variables, True, e) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal includeDS as Boolean) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, includeDS, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, True, Nothing) + End Function + + + Public Overridable Sub RegisterPostback() + + + End Sub + + + + ' To customize, override this method in PersonalSportSkillTableControlRow. + 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 parentCtrl As PersonalIdRecordControl + + + parentCtrl = DirectCast(Me.Page.FindControlRecursively("PersonalIdRecordControl"), PersonalIdRecordControl) + + If (Not IsNothing(parentCtrl) AndAlso IsNothing(parentCtrl.DataSource)) + ' Load the record if it is not loaded yet. + parentCtrl.LoadData() + End If + If (IsNothing(parentCtrl) OrElse IsNothing(parentCtrl.DataSource)) + ' Get the error message from the application resource file. + Throw New Exception(Page.GetResourceValue("Err:NoParentRecId", "Persons")) + End If + + Me.DataSource.PersonalId = parentCtrl.DataSource.PersonalId + + ' 2. Perform any custom validation. + Me.Validate() + + + ' 3. Set the values in the record with data from UI controls. + ' This calls the Get() method for each of the user interface controls. + Me.GetUIData() + + ' 4. Save in the database. + ' We should not save the record if the data did not change. This + ' will save a database hit and avoid triggering any database triggers. + + If Me.DataSource.IsAnyValueChanged Then + ' Save record to database but do not commit yet. + ' Auto generated ids are available after saving for use by child (dependent) records. + Me.DataSource.Save() + + DirectCast(GetParentControlObject(Me, "PersonalSportSkillTableControl"), PersonalSportSkillTableControl).DataChanged = True + DirectCast(GetParentControlObject(Me, "PersonalSportSkillTableControl"), PersonalSportSkillTableControl).ResetData = True + End If + + + ' update session or cookie by formula + + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + ' For Master-Detail relationships, save data on the Detail table(s) + + End Sub + + ' To customize, override this method in PersonalSportSkillTableControlRow. + 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. + + GetLevel2() + GetSportId() + End Sub + + + Public Overridable Sub GetLevel2() + + ' Retrieve the value entered by the user on the Level ASP:TextBox, and + ' save it into the Level field in DataSource PersonalSportSkill record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.Level2.Text, PersonalSportSkillTable.Level) + + + End Sub + + Public Overridable Sub GetSportId() + + ' Retrieve the value entered by the user on the SportId ASP:TextBox, and + ' save it into the SportId field in DataSource PersonalSportSkill record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.SportId.Text, PersonalSportSkillTable.SportId) + + + End Sub + + + ' To customize, override this method in PersonalSportSkillTableControlRow. + + Public Overridable Function CreateWhereClause() As WhereClause + + Return Nothing + + End Function + + + + ' To customize, override this method in PersonalSportSkillTableControlRow. + 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) + PersonalSportSkillTable.DeleteRecord(pkValue) + + DirectCast(GetParentControlObject(Me, "PersonalSportSkillTableControl"), PersonalSportSkillTableControl).DataChanged = True + DirectCast(GetParentControlObject(Me, "PersonalSportSkillTableControl"), PersonalSportSkillTableControl).ResetData = True + End Sub + + Protected Overridable Sub Control_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.PreRender + ' PreRender event is raised just before page is being displayed. + Try + DbUtils.StartTransaction() + Me.RegisterPostback() + + If Not Me.Page.ErrorOnPage AndAlso (Me.Page.IsPageRefresh OrElse Me.DataChanged OrElse Me.ResetData) Then + + + ' Re-load the data and update the web page if necessary. + ' This is typically done during a postback (filter, search button, sort, pagination button). + ' In each of the other click handlers, simply set DataChanged to True to reload the data. + Me.LoadData() + Me.DataBind() + End If + + + Catch ex As Exception + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + Finally + DbUtils.EndTransaction() + End Try + End Sub + + + Protected Overrides Sub SaveControlsToSession() + MyBase.SaveControlsToSession() + + + 'Save pagination state to session. + + End Sub + + + + Protected Overrides Sub ClearControlsFromSession() + MyBase.ClearControlsFromSession() + + + + ' Clear pagination state from session. + + End Sub + + Protected Overrides Sub LoadViewState(ByVal savedState As Object) + MyBase.LoadViewState(savedState) + Dim isNewRecord As String = CType(ViewState("IsNewRecord"), String) + If Not isNewRecord Is Nothing AndAlso isNewRecord.Trim <> "" Then + Me.IsNewRecord = Boolean.Parse(isNewRecord) + End If + + Dim myCheckSum As String = CType(ViewState("CheckSum"), String) + If Not myCheckSum Is Nothing AndAlso myCheckSum.Trim <> "" Then + Me.CheckSum = myCheckSum + End If + + + ' Load view state for pagination control. + + End Sub + + Protected Overrides Function SaveViewState() As Object + ViewState("IsNewRecord") = Me.IsNewRecord.ToString() + ViewState("CheckSum") = Me.CheckSum + + + ' Load view state for pagination control. + + Return MyBase.SaveViewState() + End Function + + + ' event handler for ImageButton + Public Overridable Sub PersonalSportSkillRowDeleteButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + If(Not Me.Page.IsPageRefresh) Then + + Dim tc As PersonalSportSkillTableControl = DirectCast(GetParentControlObject(Me, "PersonalSportSkillTableControl"), PersonalSportSkillTableControl) + If Not (IsNothing(tc)) Then + If Not Me.IsNewRecord Then + tc.AddToDeletedRecordIds(DirectCast(Me, PersonalSportSkillTableControlRow)) + End If + Me.Visible = False + tc.SetFormulaControls() + End If + + End If + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + Protected Overridable Sub Level2_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub SportId_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("BasePersonalSportSkillTableControlRow_Rec"), String) + End Get + Set(ByVal value As String) + Me.ViewState("BasePersonalSportSkillTableControlRow_Rec") = value + End Set + End Property + + Private _DataSource As PersonalSportSkillRecord + Public Property DataSource() As PersonalSportSkillRecord + Get + Return Me._DataSource + End Get + + Set(ByVal value As PersonalSportSkillRecord) + + Me._DataSource = value + End Set + End Property + + + + Private _checkSum As String + Public Overridable Property CheckSum() As String + Get + Return Me._checkSum + End Get + Set(ByVal value As String) + Me._checkSum = value + End Set + End Property + + Private _TotalPages As Integer + Public Property TotalPages() As Integer + Get + Return Me._TotalPages + End Get + Set(ByVal value As Integer) + Me._TotalPages = value + End Set + End Property + + Private _PageIndex As Integer + Public Property PageIndex() As Integer + Get + ' Return the PageIndex + Return Me._PageIndex + End Get + Set(ByVal value As Integer) + Me._PageIndex = value + End Set + End Property + + Private _DisplayLastPage As Boolean + Public Property DisplayLastPage() As Boolean + Get + Return Me._DisplayLastPage + End Get + Set(ByVal value As Boolean) + Me._DisplayLastPage = value + End Set + End Property + + + +#Region "Helper Properties" + + Public ReadOnly Property Level2() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Level2"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property PersonalSportSkillRecordRowSelection() As System.Web.UI.WebControls.CheckBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalSportSkillRecordRowSelection"), System.Web.UI.WebControls.CheckBox) + End Get + End Property + + Public ReadOnly Property PersonalSportSkillRowDeleteButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalSportSkillRowDeleteButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property SportId() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "SportId"), System.Web.UI.WebControls.TextBox) + 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 PersonalSportSkillRecord = 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 PersonalSportSkillRecord + If Not Me.DataSource Is Nothing Then + Return Me.DataSource + End If + + If Not Me.RecordUniqueId Is Nothing Then + + Return PersonalSportSkillTable.GetRecord(Me.RecordUniqueId, True) + + End If + + ' Localization. + + Return Nothing + + End Function + + Public Shadows ReadOnly Property Page() As BaseApplicationPage + Get + Return DirectCast(MyBase.Page, BaseApplicationPage) + End Get + End Property + +#End Region + +End Class + + + +' Base class for the PersonalSportSkillTableControl control on the AddPersonalId page. +' Do not modify this class. Instead override any method in PersonalSportSkillTableControl. +Public Class BasePersonalSportSkillTableControl + Inherits Persons.UI.BaseApplicationTableControl + + + + Protected Overridable Sub Control_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Init + + + + ' Setup the filter and search events. + + + + ' Control Initializations. + ' Initialize the table's current sort order. + + If Me.InSession(Me, "Order_By") Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + End If + + + + ' Setup default pagination settings. + + Me.PageSize = CInt(Me.GetFromSession(Me, "Page_Size", "10")) + Me.PageIndex = CInt(Me.GetFromSession(Me, "Page_Index", "0")) + + + + Me.ClearControlsFromSession() + End Sub + + Protected Overridable Sub Control_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load + + SaveControlsToSession_Ajax() + + ' Show confirmation message on Click + Me.PersonalSportSkillDeleteButton.Attributes.Add("onClick", "return (confirm('" & (CType(Me.Page,BaseApplicationPage)).GetResourceValue("DeleteConfirm", "Persons") & "'));") + + ' Setup the pagination events. + + AddHandler Me.PersonalSportSkillPagination.FirstPage.Click, AddressOf PersonalSportSkillPagination_FirstPage_Click + + AddHandler Me.PersonalSportSkillPagination.LastPage.Click, AddressOf PersonalSportSkillPagination_LastPage_Click + + AddHandler Me.PersonalSportSkillPagination.NextPage.Click, AddressOf PersonalSportSkillPagination_NextPage_Click + + AddHandler Me.PersonalSportSkillPagination.PageSizeButton.Click, AddressOf PersonalSportSkillPagination_PageSizeButton_Click + + AddHandler Me.PersonalSportSkillPagination.PreviousPage.Click, AddressOf PersonalSportSkillPagination_PreviousPage_Click + + + ' Setup the sorting events. + + AddHandler Me.LevelLabel5.Click, AddressOf LevelLabel5_Click + + AddHandler Me.SportIdLabel1.Click, AddressOf SportIdLabel1_Click + + ' Setup the button events. + + AddHandler Me.PersonalSportSkillAddButton.Click, AddressOf PersonalSportSkillAddButton_Click + + AddHandler Me.PersonalSportSkillDeleteButton.Click, AddressOf PersonalSportSkillDeleteButton_Click + + AddHandler Me.PersonalSportSkillResetButton.Click, AddressOf PersonalSportSkillResetButton_Click + + + ' Setup events for others + + End Sub + + + Public Overridable Sub LoadData() + + ' Read data from database. Returns an array of records that can be assigned + ' to the DataSource table control property. + Try + Dim joinFilter As CompoundFilter = CreateCompoundJoinFilter() + + ' The WHERE clause will be empty when displaying all records in table. + Dim wc As WhereClause = CreateWhereClause() + If wc IsNot Nothing AndAlso Not wc.RunQuery Then + ' Initialize an empty array of records + Dim alist As New ArrayList(0) + Me.DataSource = DirectCast(alist.ToArray(GetType(PersonalSportSkillRecord)), PersonalSportSkillRecord()) + ' Add records to the list if needed. + Me.AddNewRecords() + Me._TotalRecords = 0 + Me._TotalPages = 0 + Return + End If + + ' Call OrderBy to determine the order - either use the order defined + ' on the Query Wizard, or specified by user (by clicking on column heading) + Dim orderBy As OrderBy = CreateOrderBy() + + ' Get the pagesize from the pagesize control. + Me.GetPageSize() + + If Me.DisplayLastPage Then + Dim totalRecords As Integer = If(Me._TotalRecords < 0, PersonalSportSkillTable.GetRecordCount(CreateCompoundJoinFilter(), CreateWhereClause()), Me._TotalRecords) + + Dim totalPages As Integer = CInt(Math.Ceiling(totalRecords / Me.PageSize)) + + Me.PageIndex = totalPages - 1 + End If + + ' Make sure PageIndex (current page) and PageSize are within bounds. + If Me.PageIndex < 0 Then + Me.PageIndex = 0 + End If + If Me.PageSize < 1 Then + Me.PageSize = 1 + End If + + ' Retrieve the records and set the table DataSource. + ' Only PageSize records are fetched starting at PageIndex (zero based). + If Me.AddNewRecord > 0 Then + ' Make sure to preserve the previously entered data on new rows. + Dim postdata As New ArrayList + For Each rc As PersonalSportSkillTableControlRow In Me.GetRecordControls() + If Not rc.IsNewRecord Then + rc.DataSource = rc.GetRecord() + rc.GetUIData() + postdata.Add(rc.DataSource) + UIData.Add(rc.PreservedUIData()) + End If + Next + Me.DataSource = DirectCast(postdata.ToArray(GetType(PersonalSportSkillRecord)), PersonalSportSkillRecord()) + Else ' Get the records from the database + Me.DataSource = PersonalSportSkillTable.GetRecords(joinFilter, wc, orderBy, Me.PageIndex, Me.PageSize) + + End If + + ' if the datasource contains no records contained in database, then load the last page. + If (DbUtils.GetCreatedRecords(Me.DataSource).Length = 0 AndAlso Not Me.DisplayLastPage) Then + Me.DisplayLastPage = True + LoadData() + Else + + ' Add any new rows desired by the user. + Me.AddNewRecords() + + ' Turn off the ToggleAll checkbox + Me.PersonalSportSkillToggleAll.Checked = False + + + ' Initialize the page and grand totals. now + + End If + + Catch ex As Exception + ' Report the error message to the end user + Dim msg As String = ex.Message + If ex.InnerException IsNot Nothing Then + msg = msg & " InnerException: " & ex.InnerException.Message + End If + Throw New Exception(msg, ex.InnerException) + End Try + End Sub + + + + + Public Overrides Sub DataBind() + ' The DataBind method binds the user interface controls to the values + ' from the database record for each row in the table. To do this, it calls the + ' DataBind for each of the rows. + ' DataBind also populates any filters above the table, and sets the pagination + ' control to the correct number of records and the current page number. + + MyBase.DataBind() + + ' Make sure that the DataSource is initialized. + If Me.DataSource Is Nothing Then + Return + End If + + 'LoadData for DataSource for chart and report if they exist + + ' Improve performance by prefetching display as records. + Me.PreFetchForeignKeyValues() + + ' Setup the pagination controls. + BindPaginationControls() + + + + ' Bind the repeater with the list of records to expand the UI. + Dim rep As System.Web.UI.WebControls.Repeater = CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalSportSkillTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return + rep.DataSource = DataSource() + rep.DataBind() + + Dim index As Integer = 0 + For Each repItem As System.Web.UI.WebControls.RepeaterItem In rep.Items + ' Loop through all rows in the table, set its DataSource and call DataBind(). + Dim recControl As PersonalSportSkillTableControlRow = DirectCast(repItem.FindControl("PersonalSportSkillTableControlRow"), PersonalSportSkillTableControlRow) + recControl.DataSource = Me.DataSource(index) + If Me.UIData.Count > index Then + recControl.PreviousUIData = Me.UIData(index) + End If + recControl.DataBind() + recControl.Visible = Not Me.InDeletedRecordIds(recControl) + + index += 1 + Next + + + + + ' Call the Set methods for each controls on the panel + + SetLevelLabel5() + + + + + SetPersonalSportSkillTableControlCollapsibleRegion() + + SetSportIdLabel1() + ' setting the state of expand or collapse alternative rows + + + ' Load data for each record and table UI control. + ' Ordering is important because child controls get + ' their parent ids from their parent UI controls. + + + ' this method calls the set method for controls with special formula like running total, sum, rank, etc + SetFormulaControls() + End Sub + + Public Overridable Sub SetFormulaControls() + ' this method calls Set methods for the control that has special formula + + + + End Sub + + + Public Sub PreFetchForeignKeyValues() + If (IsNothing(Me.DataSource)) + Return + End If + + Me.Page.PregetDfkaRecords(PersonalSportSkillTable.SportId, Me.DataSource) + + End Sub + + + Public Overridable Sub RegisterPostback() + + + End Sub + + Public EvaluateFormulaDelegate As BaseClasses.Data.DataSource.EvaluateFormulaDelegate = New BaseClasses.Data.DataSource.EvaluateFormulaDelegate(AddressOf Me.EvaluateFormula) + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean, ByVal e as FormulaEvaluator) As String + If e Is Nothing + e = New FormulaEvaluator() + End If + + e.Variables.Clear() + + + ' add variables for formula evaluation + If variables IsNot Nothing Then + Dim enumerator As System.Collections.Generic.IEnumerator(Of System.Collections.Generic.KeyValuePair(Of String, Object)) = variables.GetEnumerator() + While enumerator.MoveNext() + e.Variables.Add(enumerator.Current.Key, enumerator.Current.Value) + End While + End If + + If includeDS + + End If + + ' All variables referred to in the formula are expected to be + ' properties of the DataSource. For example, referring to + ' UnitPrice as a variable will refer to DataSource.UnitPrice + e.DataSource = dataSourceForEvaluate + + ' Define the calling control. This is used to add other + ' related table and record controls as variables. + e.CallingControl = Me + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + + If Not String.IsNullOrEmpty(format) AndAlso (String.IsNullOrEmpty(formula) OrElse formula.IndexOf("Format(") < 0) Then + Return FormulaUtils.Format(resultObj, format) + Else + Return resultObj.ToString() + End If + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format,variables ,includeDS, Nothing) + End Function + + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object)) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format, variables ,True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, format, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal e as FormulaEvaluator) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, variables, True, e) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal includeDS as Boolean) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, includeDS, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, True, Nothing) + End Function + + + + + Public Overridable Sub ResetControl() + + Me.CurrentSortOrder.Reset() + If (Me.InSession(Me, "Order_By")) Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + End If + + Me.PageIndex = 0 + End Sub + + Protected Overridable Sub BindPaginationControls() + ' Setup the pagination controls. + + ' Bind the pagination labels. + + If DbUtils.GetCreatedRecords(Me.DataSource).Length > 0 Then + + Me.PersonalSportSkillPagination.CurrentPage.Text = (Me.PageIndex + 1).ToString() + Else + Me.PersonalSportSkillPagination.CurrentPage.Text = "0" + End If + Me.PersonalSportSkillPagination.PageSize.Text = Me.PageSize.ToString() + Me.PersonalSportSkillPagination.TotalItems.Text = Me.TotalRecords.ToString() + Me.PersonalSportSkillPagination.TotalPages.Text = Me.TotalPages.ToString() + + ' Bind the buttons for PersonalSportSkillTableControl pagination. + + Me.PersonalSportSkillPagination.FirstPage.Enabled = Not (Me.PageIndex = 0) + If Me._TotalPages < 0 Then ' if the total pages is not determined yet, enable last and next buttons + Me.PersonalSportSkillPagination.LastPage.Enabled = True + ElseIf Me._TotalPages = 0 ' if the total pages is determined and it is 0, enable last and next buttons + Me.PersonalSportSkillPagination.LastPage.Enabled = False + Else ' if the total pages is the last page, disable last and next buttons + Me.PersonalSportSkillPagination.LastPage.Enabled = Not (Me.PageIndex = Me.TotalPages - 1) + End If + + If Me._TotalPages < 0 Then ' if the total pages is not determined yet, enable last and next buttons + Me.PersonalSportSkillPagination.NextPage.Enabled = True + ElseIf Me._TotalPages = 0 ' if the total pages is determined and it is 0, enable last and next buttons + Me.PersonalSportSkillPagination.NextPage.Enabled = False + Else ' if the total pages is the last page, disable last and next buttons + Me.PersonalSportSkillPagination.NextPage.Enabled = Not (Me.PageIndex = Me.TotalPages - 1) + End If + + Me.PersonalSportSkillPagination.PreviousPage.Enabled = Not (Me.PageIndex = 0) + + + End Sub + + Public Overridable Sub SaveData() + ' Save the data from the entire table. Calls each row's Save Data + ' to save their data. This function is called by the Click handler of the + ' Save button. The button handler should Start/Commit/End a transaction. + + Dim recCtl As PersonalSportSkillTableControlRow + For Each recCtl In Me.GetRecordControls() + + If Me.InDeletedRecordIds(recCtl) Then + ' Delete any pending deletes. + recCtl.Delete() + Else + If recCtl.Visible Then + recCtl.SaveData() + End If + End If + + Next + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + ' Set IsNewRecord to False for all records - since everything has been saved and is no longer "new" + For Each recCtl In Me.GetRecordControls() + recCtl.IsNewRecord = False + Next + + + ' Set DeletedRecordsIds to Nothing since we have deleted all pending deletes. + Me.DeletedRecordIds = Nothing + + End Sub + + Public Overridable Function CreateCompoundJoinFilter() As CompoundFilter + Dim jFilter As CompoundFilter = New CompoundFilter() + + Return jFilter + + End Function + + + Public Overridable Function CreateOrderBy() As OrderBy + ' The CurrentSortOrder is initialized to the sort order on the + ' Query Wizard. It may be modified by the Click handler for any of + ' the column heading to sort or reverse sort by that column. + ' You can add your own sort order, or modify it on the Query Wizard. + Return Me.CurrentSortOrder + End Function + + Public Overridable Function CreateWhereClause() As WhereClause + 'This CreateWhereClause is used for loading the data. + PersonalSportSkillTable.Instance.InnerFilter = Nothing + Dim wc As WhereClause = New WhereClause() + + ' Compose the WHERE clause consiting of: + ' 1. Static clause defined at design time. + ' 2. User selected search criteria. + ' 3. User selected filter criteria. + + + Dim selectedRecordKeyValue as KeyValue = New KeyValue() + + Dim personalIdRecordControlObj As Persons.UI.Controls.AddPersonalId.PersonalIdRecordControl = DirectCast(MiscUtils.FindControlRecursively(Me.Page, "PersonalIdRecordControl"), Persons.UI.Controls.AddPersonalId.PersonalIdRecordControl) + + If (Not IsNothing(personalIdRecordControlObj) AndAlso Not IsNothing(personalIdRecordControlObj.GetRecord()) AndAlso personalIdRecordControlObj.GetRecord().IsCreated AndAlso Not IsNothing(personalIdRecordControlObj.GetRecord().PersonalId)) + wc.iAND(PersonalSportSkillTable.PersonalId, BaseFilter.ComparisonOperator.EqualsTo, personalIdRecordControlObj.GetRecord().PersonalId.ToString()) + selectedRecordKeyValue.AddElement(PersonalSportSkillTable.PersonalId.InternalName, personalIdRecordControlObj.GetRecord().PersonalId.ToString()) + Else + wc.RunQuery = False + Return wc + End If + + HttpContext.Current.Session("PersonalSportSkillTableControlWhereClause") = selectedRecordKeyValue.ToXmlString() + + Return wc + End Function + + + Public Overridable Function CreateWhereClause(ByVal searchText as String, ByVal fromSearchControl as String, ByVal AutoTypeAheadSearch as String, ByVal AutoTypeAheadWordSeparators as String) As WhereClause + ' This CreateWhereClause is used for loading list of suggestions for Auto Type-Ahead feature. + PersonalSportSkillTable.Instance.InnerFilter = Nothing + Dim wc As WhereClause = New WhereClause() + + ' Compose the WHERE clause consiting of: + ' 1. Static clause defined at design time. + ' 2. User selected search criteria. + ' 3. User selected filter criteria. + + Dim appRelativeVirtualPath As String = CType(HttpContext.Current.Session("AppRelativeVirtualPath"), String) + + Dim selectedRecordInPersonalIdRecordControl as String = DirectCast(HttpContext.Current.Session("PersonalSportSkillTableControlWhereClause"), String) + + If Not selectedRecordInPersonalIdRecordControl Is Nothing AndAlso KeyValue.IsXmlKey(selectedRecordInPersonalIdRecordControl) Then + Dim selectedRecordKeyValue as KeyValue = KeyValue.XmlToKey(selectedRecordInPersonalIdRecordControl) + + If Not IsNothing(selectedRecordKeyValue) AndAlso selectedRecordKeyValue.ContainsColumn(PersonalSportSkillTable.PersonalId) Then + wc.iAND(PersonalSportSkillTable.PersonalId, BaseFilter.ComparisonOperator.EqualsTo, selectedRecordKeyValue.GetColumnValue(PersonalSportSkillTable.PersonalId).ToString()) + End If + + End If + + ' Adds clauses if values are selected in Filter controls which are configured in the page. + + + Return wc + End Function + + + Public Overridable Function FormatSuggestions(ByVal prefixText As String, ByVal resultItem As String, _ + ByVal columnLength As Integer, ByVal AutoTypeAheadDisplayFoundText As String, _ + ByVal autoTypeAheadSearch As String, ByVal AutoTypeAheadWordSeparators As String, _ + ByVal resultList As ArrayList) As Boolean + + 'Formats the resultItem and adds it to the list of suggestions. + Dim index As Integer = resultItem.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture).IndexOf(prefixText.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture)) + Dim itemToAdd As String = "" + Dim isFound As Boolean = False + Dim isAdded As Boolean = False + ' Get the index where prfixt is at the beginning of resultItem. If not found then, index of word which begins with prefixText. + If InvariantLCase(autoTypeAheadSearch).equals("wordsstartingwithsearchstring") And Not index = 0 Then + ' Expression to find word which contains AutoTypeAheadWordSeparators followed by prefixText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex( AutoTypeAheadWordSeparators + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + If regex1.IsMatch(resultItem) Then + index = regex1.Match(resultItem).Index + isFound = True + End If + ' If the prefixText is found immediatly after white space then starting of the word is found so don not search any further + If not resultItem(index).ToString() = " " Then + ' Expression to find beginning of the word which contains AutoTypeAheadWordSeparators followed by prefixText + Dim regex As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\\S*" + AutoTypeAheadWordSeparators + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + If regex.IsMatch(resultItem) Then + index = regex.Match(resultItem).Index + isFound = True + End If + End If + End If + + ' If autoTypeAheadSearch value is wordsstartingwithsearchstring then, extract the substring only if the prefixText is found at the + ' beginning of the resultItem (index = 0) or a word in resultItem is found starts with prefixText. + If index = 0 Or isFound Or InvariantLCase(autoTypeAheadSearch).Equals("anywhereinstring") then + If InvariantLCase(AutoTypeAheadDisplayFoundText).equals("atbeginningofmatchedstring") Then + ' Expression to find beginning of the word which contains prefixText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\\S*" + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + ' Find the beginning of the word which contains prefexText + If (StringUtils.InvariantLCase(autoTypeAheadSearch).Equals("anywhereinstring") AndAlso regex1.IsMatch(resultItem)) Then + index = regex1.Match(resultItem).Index + isFound = True + End If + ' Display string from the index till end of the string if sub string from index till end is less than columnLength value. + If Len(resultItem) - index <= columnLength Then + If index = 0 Then + itemToAdd = resultItem + Else + itemToAdd = "..." & resultItem.Substring(index, Len(resultItem) - index) + End If + Else + If index = 0 Then + itemToAdd = resultItem.Substring(index, (columnLength - 3)) & "..." + Else + 'Truncate the string to show only columnLength - 6 characters as begining and trailing "..." has to be appended. + itemToAdd = "..." & resultItem.Substring(index , columnLength - 6) & "..." + End If + End If + ElseIf InvariantLCase(AutoTypeAheadDisplayFoundText).equals("inmiddleofmatchedstring") Then + Dim subStringBeginIndex As Integer = CType(columnLength/2, Integer) + If Len(resultItem) <= columnLength Then + itemToAdd = resultItem + Else + ' Sanity check at end of the string + If index + Len(prefixText) = columnLength Then + itemToAdd = "..." & resultItem.Substring(index-columnLength,index) + ElseIf Len(resultItem) - index < subStringBeginIndex Then + ' Display string from the end till columnLength value if, index is closer to the end of the string. + itemToAdd = "..." & resultItem.Substring(Len(resultItem)-columnLength,Len(resultItem)) + ElseIf index <= subStringBeginIndex Then + ' Sanity chet at beginning of the string + itemToAdd = resultItem.Substring(0, columnLength) & "..." + Else + ' Display string containing text before the prefixText occures and text after the prefixText + itemToAdd = "..." & resultItem.Substring(index - subStringBeginIndex, columnLength) & "..." + End If + End If + ElseIf InvariantLCase(AutoTypeAheadDisplayFoundText).equals("atendofmatchedstring") Then + ' Expression to find ending of the word which contains prefexText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\s", System.Text.RegularExpressions.RegexOptions.IgnoreCase) + ' Find the ending of the word which contains prefexText + If regex1.IsMatch(resultItem, index + 1) Then + index = regex1.Match(resultItem, index + 1).Index + Else + ' If the word which contains prefexText is the last word in string, regex1.IsMatch returns false. + index = resultItem.Length + End If + If index > Len(resultItem) Then + index = Len(resultItem) + End If + ' If text from beginning of the string till index is less than columnLength value then, display string from the beginning till index. + If index <= columnLength Then + if index = Len(resultItem) Then 'Make decision to append "..." + itemToAdd = resultItem.Substring(0,index) + Else + itemToAdd = resultItem.Substring(0,index) & "..." + End If + Else + If index = Len(resultItem) Then + itemToAdd = "..." & resultItem.Substring(index - (columnLength - 3), (columnLength - 3)) + Else + 'Truncate the string to show only columnLength - 6 characters as begining and trailing "..." has to be appended. + itemToAdd = "..." & resultItem.Substring(index - (columnLength - 6), columnLength - 6) & "..." + End If + End If + End If + + ' Remove newline character from itemToAdd + Dim prefixTextIndex As Integer = itemToAdd.IndexOf(prefixText, StringComparison.CurrentCultureIgnoreCase) + ' If itemToAdd contains any newline after the search text then show text only till newline + Dim regex2 As System.Text.RegularExpressions.Regex = New System.Text.RegularExpressions.Regex("(" & vbCrLf & "|" & vbLf & ")", System.Text.RegularExpressions.RegexOptions.IgnoreCase) + Dim newLineIndexAfterPrefix As Integer = -1 + If regex2.IsMatch(itemToAdd, prefixTextIndex) Then + newLineIndexAfterPrefix = regex2.Match(itemToAdd, prefixTextIndex).Index + End If + If (newLineIndexAfterPrefix > -1) Then + If itemToAdd.EndsWith("...") Then + itemToAdd = (itemToAdd.Substring(0, newLineIndexAfterPrefix) + "...") + Else + itemToAdd = itemToAdd.Substring(0, newLineIndexAfterPrefix) + End If + End If + ' If itemToAdd contains any newline before search text then show text which comes after newline + Dim regex3 As System.Text.RegularExpressions.Regex = New System.Text.RegularExpressions.Regex("(" & vbCrLf & "|" & vbLf & ")", (System.Text.RegularExpressions.RegexOptions.IgnoreCase Or System.Text.RegularExpressions.RegexOptions.RightToLeft)) + Dim newLineIndexBeforePrefix As Integer = -1 + If regex3.IsMatch(itemToAdd, prefixTextIndex) Then + newLineIndexBeforePrefix = regex3.Match(itemToAdd, prefixTextIndex).Index + End If + If (newLineIndexBeforePrefix > -1) Then + If itemToAdd.StartsWith("...") Then + itemToAdd = ("..." + itemToAdd.Substring((newLineIndexBeforePrefix + regex3.Match(itemToAdd, prefixTextIndex).Length))) + Else + itemToAdd = itemToAdd.Substring((newLineIndexBeforePrefix + regex3.Match(itemToAdd, prefixTextIndex).Length)) + End If + End If + + If Not itemToAdd is nothing AndAlso Not resultList.Contains(itemToAdd) Then + + resultList.Add(itemToAdd) + + isAdded = true + End If + End If + Return isAdded + End Function + + + Protected Overridable Sub GetPageSize() + + If Me.PersonalSportSkillPagination.PageSize.Text.Trim <> "" Then + Try + 'Me.PageSize = Integer.Parse(Me.PersonalSportSkillPagination.PageSize.Text) + Catch ex As Exception + End Try + End If + End Sub + + Protected Overridable Sub AddNewRecords() + + Dim newRecordList As ArrayList = New ArrayList() + + Dim newUIDataList As System.Collections.Generic.List(Of Hashtable) = New System.Collections.Generic.List(Of Hashtable)() + + ' Loop though all the record controls and if the record control + ' does not have a unique record id set, then create a record + ' and add to the list. + If Not Me.ResetData Then + Dim rep As System.Web.UI.WebControls.Repeater = CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalSportSkillTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return + + Dim repItem As System.Web.UI.WebControls.RepeaterItem + For Each repItem In rep.Items + ' Loop through all rows in the table, set its DataSource and call DataBind(). + + Dim recControl As PersonalSportSkillTableControlRow = DirectCast(repItem.FindControl("PersonalSportSkillTableControlRow"), PersonalSportSkillTableControlRow) + + If recControl.Visible AndAlso recControl.IsNewRecord() Then + + Dim rec As PersonalSportSkillRecord = New PersonalSportSkillRecord() + + If recControl.Level2.Text <> "" Then + rec.Parse(recControl.Level2.Text, PersonalSportSkillTable.Level) + End If + If recControl.SportId.Text <> "" Then + rec.Parse(recControl.SportId.Text, PersonalSportSkillTable.SportId) + End If + newUIDataList.Add(recControl.PreservedUIData()) + newRecordList.Add(rec) + End If + Next + End If + + + ' Add any new record to the list. + Dim index As Integer = 0 + For index = 1 To Me.AddNewRecord + + newRecordList.Insert(0, New PersonalSportSkillRecord()) + newUIDataList.Insert(0, New Hashtable()) + + Next + Me.AddNewRecord = 0 + + ' Finally, add any new records to the DataSource. + If newRecordList.Count > 0 Then + + Dim finalList As ArrayList = New ArrayList(Me.DataSource) + finalList.InsertRange(0, newRecordList) + + Me.DataSource = DirectCast(finalList.ToArray(GetType(PersonalSportSkillRecord)), PersonalSportSkillRecord()) + + End If + + ' Add the existing UI data to this hash table + If newUIDataList.Count > 0 Then + Me.UIData.InsertRange(0, newUIDataList) + End If + + End Sub + + + Public Sub AddToDeletedRecordIds(ByVal rec As PersonalSportSkillTableControlRow) + If rec.IsNewRecord() Then + Return + End If + + If Not Me.DeletedRecordIds Is Nothing AndAlso Me.DeletedRecordIds.Trim <> "" Then + Me.DeletedRecordIds &= "," + End If + + Me.DeletedRecordIds &= "[" & rec.RecordUniqueId & "]" + End Sub + + Protected Overridable Function InDeletedRecordIds(ByVal rec As PersonalSportSkillTableControlRow) As Boolean + If Me.DeletedRecordIds Is Nothing OrElse Me.DeletedRecordIds.Trim = "" Then + Return False + End If + + Return Me.DeletedRecordIds.IndexOf("[" & rec.RecordUniqueId & "]") >= 0 + End Function + + Private _DeletedRecordIds As String + Public Property DeletedRecordIds() As String + Get + Return Me._DeletedRecordIds + End Get + Set(ByVal value As String) + Me._DeletedRecordIds = value + End Set + End Property + + + ' Create Set, WhereClause, and Populate Methods + + Public Overridable Sub SetLevelLabel5() + + End Sub + + Public Overridable Sub SetPersonalSportSkillTableControlCollapsibleRegion() + + End Sub + + Public Overridable Sub SetSportIdLabel1() + + 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. + Dim added As Boolean = Me.AddNewRecord > 0 + Me.LoadData() + Me.DataBind() + + If added Then + Me.SetFocusToAddedRow() + End If + + End If + + + + Catch ex As Exception + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + Finally + DbUtils.EndTransaction + End Try + End Sub + + 'this function sets focus to the first editable element in the new added row in the editable table + Protected Overridable Sub SetFocusToAddedRow() + Dim rep As System.Web.UI.WebControls.Repeater = CType(Me.FindControl("PersonalSportSkillTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing OrElse rep.Items.Count = 0 Then Return + Dim repItem As System.Web.UI.WebControls.RepeaterItem + For Each repItem In rep.Items + 'Load scripts to table rows + Me.Page.LoadFocusScripts(repItem) + Dim recControl As PersonalSportSkillTableControlRow = DirectCast(repItem.FindControl("PersonalSportSkillTableControlRow"), PersonalSportSkillTableControlRow) + If recControl.IsNewRecord Then + For Each field As Control In recControl.Controls + If field.Visible AndAlso Me.Page.IsControlEditable(field, False) Then + 'set focus on the first editable field in the new row + field.Focus() + Dim updPan As UpdatePanel = DirectCast(Me.Page.FindControlRecursively("UpdatePanel1"), UpdatePanel) + If Not updPan Is Nothing Then updPan.Update() + Return + End If + Next + Return + End If + Next + End Sub + + + Protected Overrides Sub SaveControlsToSession() + MyBase.SaveControlsToSession() + + ' Save filter controls to values to session. + + + 'Save pagination state to session. + + + + ' Save table control properties to the session. + If Not Me.CurrentSortOrder Is Nothing Then + Me.SaveToSession(Me, "Order_By", Me.CurrentSortOrder.ToXmlString()) + End If + + Me.SaveToSession(Me, "Page_Index", Me.PageIndex.ToString()) + Me.SaveToSession(Me, "Page_Size", Me.PageSize.ToString()) + + Me.SaveToSession(Me, "DeletedRecordIds", Me.DeletedRecordIds) + + End Sub + + Protected Sub SaveControlsToSession_Ajax() + ' Save filter controls to values to session. + + HttpContext.Current.Session("AppRelativeVirtualPath") = Me.Page.AppRelativeVirtualPath + + End Sub + + Protected Overrides Sub ClearControlsFromSession() + MyBase.ClearControlsFromSession() + + ' Clear filter controls values from the session. + + + ' Clear pagination state from session. + + + + ' Clear table properties from the session. + Me.RemoveFromSession(Me, "Order_By") + Me.RemoveFromSession(Me, "Page_Index") + Me.RemoveFromSession(Me, "Page_Size") + + Me.RemoveFromSession(Me, "DeletedRecordIds") + + End Sub + + Protected Overrides Sub LoadViewState(ByVal savedState As Object) + MyBase.LoadViewState(savedState) + + Dim orderByStr As String = CType(ViewState("PersonalSportSkillTableControl_OrderBy"), String) + + If orderByStr IsNot Nothing AndAlso orderByStr.Trim <> "" Then + Me.CurrentSortOrder = BaseClasses.Data.OrderBy.FromXmlString(orderByStr) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + End If + + Dim pageIndex As String = CType(ViewState("Page_Index"), String) + If pageIndex IsNot Nothing Then + Me.PageIndex = CInt(pageIndex) + End If + + Dim pageSize As String = CType(ViewState("Page_Size"), String) + If Not pageSize Is Nothing Then + Me.PageSize = CInt(pageSize) + End If + + + + ' Load view state for pagination control. + + Me.DeletedRecordIds = CType(Me.ViewState("DeletedRecordIds"), String) + + End Sub + + Protected Overrides Function SaveViewState() As Object + + If Me.CurrentSortOrder IsNot Nothing Then + Me.ViewState("PersonalSportSkillTableControl_OrderBy") = Me.CurrentSortOrder.ToXmlString() + End If + + Me.ViewState("Page_Index") = Me.PageIndex + Me.ViewState("Page_Size") = Me.PageSize + + Me.ViewState("DeletedRecordIds") = Me.DeletedRecordIds + + + ' Load view state for pagination control. + + + Return MyBase.SaveViewState() + End Function + + ' Generate the event handling functions for pagination events. + + ' event handler for ImageButton + Public Overridable Sub PersonalSportSkillPagination_FirstPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.PageIndex = 0 + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalSportSkillPagination_LastPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.DisplayLastPage = True + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalSportSkillPagination_NextPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.PageIndex += 1 + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for LinkButton + Public Overridable Sub PersonalSportSkillPagination_PageSizeButton_Click(ByVal sender As Object, ByVal args As EventArgs) + + Try + + Me.DataChanged = True + + Me.PageSize = Integer.Parse(Me.PersonalSportSkillPagination.PageSize.Text) + + Me.PageIndex = Integer.Parse(Me.PersonalSportSkillPagination.CurrentPage.Text) - 1 + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalSportSkillPagination_PreviousPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + If Me.PageIndex > 0 Then + Me.PageIndex -= 1 + Me.DataChanged = True + End If + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + + ' Generate the event handling functions for sorting events. + + Public Overridable Sub LevelLabel5_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by Level when clicked. + + ' Get previous sorting state for Level. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalSportSkillTable.Level) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for Level. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalSportSkillTable.Level, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by Level, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub SportIdLabel1_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by SportId when clicked. + + ' Get previous sorting state for SportId. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalSportSkillTable.SportId) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for SportId. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalSportSkillTable.SportId, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by SportId, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + + ' Generate the event handling functions for button events. + + ' event handler for ImageButton + Public Overridable Sub PersonalSportSkillAddButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + Me.AddNewRecord = 1 + Me.DataChanged = True + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalSportSkillDeleteButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + If(Not Me.Page.IsPageRefresh) Then + + Me.DeleteSelectedRecords(True) + Me.SetFormulaControls() + + + End If + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalSportSkillResetButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.CurrentSortOrder.Reset() + If Me.InSession(Me, "Order_By") Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + + End If + + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + + + ' Generate the event handling functions for filter and search events. + + + ' Generate the event handling functions for others + + + Private _UIData As New System.Collections.Generic.List(Of Hashtable) + Public Property UIData() As System.Collections.Generic.List(Of Hashtable) + Get + Return Me._UIData + End Get + Set(ByVal value As System.Collections.Generic.List(Of Hashtable)) + Me._UIData = value + End Set + End Property + + ' pagination properties + Protected _PageSize As Integer + Public Property PageSize() As Integer + Get + Return Me._PageSize + End Get + Set(ByVal value As Integer) + Me._PageSize = value + End Set + End Property + + Protected _PageIndex As Integer + Public Property PageIndex() As Integer + Get + ' Return the PageIndex + Return Me._PageIndex + End Get + Set(ByVal value As Integer) + Me._PageIndex = value + End Set + End Property + + Protected _TotalRecords As Integer = -1 + Public Property TotalRecords() As Integer + Get + If _TotalRecords < 0 + _TotalRecords = PersonalSportSkillTable.GetRecordCount(CreateCompoundJoinFilter(), CreateWhereClause()) + End If + Return Me._TotalRecords + End Get + Set(ByVal value As Integer) + If Me.PageSize > 0 Then + + Me.TotalPages = CInt(Math.Ceiling(value / Me.PageSize)) + + End If + Me._TotalRecords = value + End Set + End Property + + + + Protected _TotalPages As Integer = -1 + Public Property TotalPages() As Integer + Get + If _TotalPages < 0 Then + + Me.TotalPages = CInt(Math.Ceiling(TotalRecords / Me.PageSize)) + + End If + Return Me._TotalPages + End Get + Set(ByVal value As Integer) + Me._TotalPages = value + End Set + End Property + + Protected _DisplayLastPage As Boolean + Public Property DisplayLastPage() As Boolean + Get + Return Me._DisplayLastPage + End Get + Set(ByVal value As Boolean) + Me._DisplayLastPage = value + End Set + End Property + + Private _DataChanged As Boolean = False + Public Property DataChanged() As Boolean + Get + Return Me._DataChanged + End Get + Set(ByVal value As Boolean) + Me._DataChanged = value + End Set + End Property + + Private _ResetData As Boolean = False + Public Property ResetData() As Boolean + Get + Return Me._ResetData + End Get + Set(ByVal value As Boolean) + Me._ResetData = value + End Set + End Property + + Private _AddNewRecord As Integer = 0 + Public Property AddNewRecord() As Integer + Get + Return Me._AddNewRecord + End Get + Set(ByVal value As Integer) + Me._AddNewRecord = value + End Set + End Property + + + Private _CurrentSortOrder As OrderBy = Nothing + Public Property CurrentSortOrder() As OrderBy + Get + Return Me._CurrentSortOrder + End Get + Set(ByVal value As BaseClasses.Data.OrderBy) + Me._CurrentSortOrder = value + End Set + End Property + + Private _DataSource() As PersonalSportSkillRecord = Nothing + Public Property DataSource() As PersonalSportSkillRecord () + Get + Return Me._DataSource + End Get + Set(ByVal value() As PersonalSportSkillRecord) + Me._DataSource = value + End Set + End Property + +#Region "Helper Properties" + + Public ReadOnly Property LevelLabel5() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "LevelLabel5"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property PersonalSportSkillAddButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalSportSkillAddButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalSportSkillDeleteButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalSportSkillDeleteButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalSportSkillPagination() As Persons.UI.IPagination + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalSportSkillPagination"), Persons.UI.IPagination) + End Get + End Property + + Public ReadOnly Property PersonalSportSkillResetButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalSportSkillResetButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalSportSkillTableControlCollapsibleRegion() As System.Web.UI.WebControls.Panel + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalSportSkillTableControlCollapsibleRegion"), System.Web.UI.WebControls.Panel) + End Get + End Property + + Public ReadOnly Property PersonalSportSkillToggleAll() As System.Web.UI.WebControls.CheckBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalSportSkillToggleAll"), System.Web.UI.WebControls.CheckBox) + End Get + End Property + + Public ReadOnly Property SportIdLabel1() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "SportIdLabel1"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + +#End Region + +#Region "Helper Functions" + + Public Overrides Overloads Function ModifyRedirectUrl(url As String, arg As String, ByVal bEncrypt As Boolean) As String + Return Me.Page.EvaluateExpressions(url, arg, bEncrypt, Me) + End Function + + Public Overrides Overloads Function EvaluateExpressions(url As String, arg As String, ByVal bEncrypt As Boolean) As String + Dim needToProcess As Boolean = AreAnyUrlParametersForMe(url, arg) + If (needToProcess) Then + Dim recCtl As PersonalSportSkillTableControlRow = Me.GetSelectedRecordControl() + If recCtl Is Nothing AndAlso url.IndexOf("{") >= 0 Then + ' Localization. + Throw New Exception(Page.GetResourceValue("Err:NoRecSelected", "Persons")) + End If + Dim rec As PersonalSportSkillRecord = Nothing + If recCtl IsNot Nothing Then + rec = recCtl.GetRecord() + End If + Return EvaluateExpressions(url, arg, rec, bEncrypt) + End If + Return url + End Function + + Public Overridable Function GetSelectedRecordIndex() As Integer + Dim counter As Integer = 0 + Dim recControl As PersonalSportSkillTableControlRow + For Each recControl In Me.GetRecordControls() + If recControl.PersonalSportSkillRecordRowSelection.Checked Then + Return counter + End If + counter += 1 + Next + Return -1 + End Function + + Public Overridable Function GetSelectedRecordControl() As PersonalSportSkillTableControlRow + Dim selectedList() As PersonalSportSkillTableControlRow = Me.GetSelectedRecordControls() + If selectedList.Length = 0 Then + Return Nothing + End If + Return selectedList(0) + + End Function + + Public Overridable Function GetSelectedRecordControls() As PersonalSportSkillTableControlRow() + + Dim selectedList As ArrayList = New ArrayList(25) + Dim recControl As PersonalSportSkillTableControlRow + For Each recControl In Me.GetRecordControls() + If recControl.PersonalSportSkillRecordRowSelection IsNot Nothing AndAlso recControl.PersonalSportSkillRecordRowSelection.Checked Then + selectedList.Add(recControl) + End If + Next + Return DirectCast(selectedList.ToArray(GetType(PersonalSportSkillTableControlRow)), PersonalSportSkillTableControlRow()) + + End Function + + Public Overridable Sub DeleteSelectedRecords(ByVal deferDeletion As Boolean) + Dim recList() As PersonalSportSkillTableControlRow = Me.GetSelectedRecordControls() + If recList.Length = 0 Then + ' Localization. + Throw New Exception(Page.GetResourceValue("Err:NoRecSelected", "Persons")) + End If + + Dim recCtl As PersonalSportSkillTableControlRow + For Each recCtl In recList + If deferDeletion Then + If Not recCtl.IsNewRecord Then + + Me.AddToDeletedRecordIds(recCtl) + + End If + recCtl.Visible = False + + recCtl.PersonalSportSkillRecordRowSelection.Checked = False + + Else + + recCtl.Delete() + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + End If + Next + End Sub + + Public Function GetRecordControls() As PersonalSportSkillTableControlRow() + Dim recList As ArrayList = New ArrayList() + Dim rep As System.Web.UI.WebControls.Repeater = CType(Me.FindControl("PersonalSportSkillTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return Nothing + Dim repItem As System.Web.UI.WebControls.RepeaterItem + + For Each repItem In rep.Items + + Dim recControl As PersonalSportSkillTableControlRow = DirectCast(repItem.FindControl("PersonalSportSkillTableControlRow"), PersonalSportSkillTableControlRow) + recList.Add(recControl) + + Next + + Return DirectCast(recList.ToArray(GetType(PersonalSportSkillTableControlRow)), PersonalSportSkillTableControlRow()) + End Function + + Public Shadows ReadOnly Property Page() As BaseApplicationPage + Get + Return DirectCast(MyBase.Page, BaseApplicationPage) + End Get + End Property + +#End Region + + + +End Class + + +' Base class for the PersonalTitleTableControlRow control on the AddPersonalId page. +' Do not modify this class. Instead override any method in PersonalTitleTableControlRow. +Public Class BasePersonalTitleTableControlRow + Inherits Persons.UI.BaseApplicationRecordControl + + ' To customize, override this method in PersonalTitleTableControlRow. + Protected Overridable Sub Control_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Init + + Me.ClearControlsFromSession() + End Sub + + ' To customize, override this method in PersonalTitleTableControlRow. + Protected Overridable Sub Control_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load + + 'Call LoadFocusScripts from repeater so that onfocus attribute could be added to elements + Me.Page.LoadFocusScripts(Me) + + ' Show confirmation message on Click + Me.PersonalTitleRowDeleteButton.Attributes.Add("onClick", "return (confirm('" & (CType(Me.Page,BaseApplicationPage)).GetResourceValue("DeleteRecordConfirm", "Persons") & "'));") + + + ' Register the event handlers. + + AddHandler Me.PersonalTitleRowDeleteButton.Click, AddressOf PersonalTitleRowDeleteButton_Click + + AddHandler Me.Ass.TextChanged, AddressOf Ass_TextChanged + + AddHandler Me.Command2.TextChanged, AddressOf Command2_TextChanged + + AddHandler Me.CommandDate3.TextChanged, AddressOf CommandDate3_TextChanged + + AddHandler Me.Dept.TextChanged, AddressOf Dept_TextChanged + + AddHandler Me.SkillNo.TextChanged, AddressOf SkillNo_TextChanged + + AddHandler Me.Title.TextChanged, AddressOf Title_TextChanged + + AddHandler Me.TitleDate.TextChanged, AddressOf TitleDate_TextChanged + + AddHandler Me.TitleRank.TextChanged, AddressOf TitleRank_TextChanged + + + End Sub + + + Public Overridable Sub LoadData() + + ' Load the data from the database into the DataSource PersonalTitle 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 = PersonalTitleTable.GetRecord(Me.RecordUniqueId, True) + + Return + End If + + ' Since this is a row in the table, the data for this row is loaded by the + ' LoadData method of the BasePersonalTitleTableControl when the data for the entire + ' table is loaded. + + Me.DataSource = New PersonalTitleRecord() + + + + End Sub + + ' Populate the UI controls using the DataSource. To customize, override this method in PersonalTitleTableControlRow. + 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 + + SetAss() + SetCommand2() + SetCommandDate3() + SetDept() + + + SetSkillNo() + SetTitle() + SetTitleDate() + SetTitleRank() + + + 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 SetAss() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.Ass.ID) Then + + Me.Ass.Text = Me.PreviousUIData(Me.Ass.ID).ToString() + + Return + End If + + + ' Set the Ass TextBox on the webpage with value from the + ' PersonalTitle database record. + + ' Me.DataSource is the PersonalTitle record retrieved from the database. + ' Me.Ass is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetAss() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.AssSpecified Then + + ' If the Ass is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalTitleTable.Ass) + + Me.Ass.Text = formattedValue + + Else + + ' Ass is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.Ass.Text = PersonalTitleTable.Ass.Format(PersonalTitleTable.Ass.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetCommand2() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.Command2.ID) Then + + Me.Command2.Text = Me.PreviousUIData(Me.Command2.ID).ToString() + + Return + End If + + + ' Set the Command TextBox on the webpage with value from the + ' PersonalTitle database record. + + ' Me.DataSource is the PersonalTitle record retrieved from the database. + ' Me.Command2 is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetCommand2() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.CommandSpecified Then + + ' If the Command is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalTitleTable.Command) + + Me.Command2.Text = formattedValue + + Else + + ' Command is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.Command2.Text = PersonalTitleTable.Command.Format(PersonalTitleTable.Command.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetCommandDate3() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.CommandDate3.ID) Then + + Me.CommandDate3.Text = Me.PreviousUIData(Me.CommandDate3.ID).ToString() + + Return + End If + + + ' Set the CommandDate TextBox on the webpage with value from the + ' PersonalTitle database record. + + ' Me.DataSource is the PersonalTitle record retrieved from the database. + ' Me.CommandDate3 is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetCommandDate3() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.CommandDateSpecified Then + + ' If the CommandDate is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalTitleTable.CommandDate, "d MMM yy") + + Me.CommandDate3.Text = formattedValue + + Else + + ' CommandDate is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.CommandDate3.Text = PersonalTitleTable.CommandDate.Format(PersonalTitleTable.CommandDate.DefaultValue, "d MMM yy") + + End If + + End Sub + + Public Overridable Sub SetDept() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.Dept.ID) Then + + Me.Dept.Text = Me.PreviousUIData(Me.Dept.ID).ToString() + + Return + End If + + + ' Set the Dept TextBox on the webpage with value from the + ' PersonalTitle database record. + + ' Me.DataSource is the PersonalTitle record retrieved from the database. + ' Me.Dept is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetDept() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.DeptSpecified Then + + ' If the Dept is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalTitleTable.Dept) + + Me.Dept.Text = formattedValue + + Else + + ' Dept is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.Dept.Text = PersonalTitleTable.Dept.Format(PersonalTitleTable.Dept.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetSkillNo() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.SkillNo.ID) Then + + Me.SkillNo.Text = Me.PreviousUIData(Me.SkillNo.ID).ToString() + + Return + End If + + + ' Set the SkillNo TextBox on the webpage with value from the + ' PersonalTitle database record. + + ' Me.DataSource is the PersonalTitle record retrieved from the database. + ' Me.SkillNo is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetSkillNo() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.SkillNoSpecified Then + + ' If the SkillNo is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalTitleTable.SkillNo) + + Me.SkillNo.Text = formattedValue + + Else + + ' SkillNo is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.SkillNo.Text = PersonalTitleTable.SkillNo.Format(PersonalTitleTable.SkillNo.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetTitle() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.Title.ID) Then + + Me.Title.Text = Me.PreviousUIData(Me.Title.ID).ToString() + + Return + End If + + + ' Set the Title TextBox on the webpage with value from the + ' PersonalTitle database record. + + ' Me.DataSource is the PersonalTitle record retrieved from the database. + ' Me.Title is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetTitle() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.TitleSpecified Then + + ' If the Title is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalTitleTable.Title) + + Me.Title.Text = formattedValue + + Else + + ' Title is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.Title.Text = PersonalTitleTable.Title.Format(PersonalTitleTable.Title.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetTitleDate() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.TitleDate.ID) Then + + Me.TitleDate.Text = Me.PreviousUIData(Me.TitleDate.ID).ToString() + + Return + End If + + + ' Set the TitleDate TextBox on the webpage with value from the + ' PersonalTitle database record. + + ' Me.DataSource is the PersonalTitle record retrieved from the database. + ' Me.TitleDate is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetTitleDate() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.TitleDateSpecified Then + + ' If the TitleDate is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalTitleTable.TitleDate, "d MMM yy") + + Me.TitleDate.Text = formattedValue + + Else + + ' TitleDate is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.TitleDate.Text = PersonalTitleTable.TitleDate.Format(PersonalTitleTable.TitleDate.DefaultValue, "d MMM yy") + + End If + + End Sub + + Public Overridable Sub SetTitleRank() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.TitleRank.ID) Then + + Me.TitleRank.Text = Me.PreviousUIData(Me.TitleRank.ID).ToString() + + Return + End If + + + ' Set the TitleRank TextBox on the webpage with value from the + ' PersonalTitle database record. + + ' Me.DataSource is the PersonalTitle record retrieved from the database. + ' Me.TitleRank is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetTitleRank() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.TitleRankSpecified Then + + ' If the TitleRank is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalTitleTable.TitleRank) + + Me.TitleRank.Text = formattedValue + + Else + + ' TitleRank is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.TitleRank.Text = PersonalTitleTable.TitleRank.Format(PersonalTitleTable.TitleRank.DefaultValue) + + End If + + End Sub + + + Public EvaluateFormulaDelegate As BaseClasses.Data.DataSource.EvaluateFormulaDelegate = New BaseClasses.Data.DataSource.EvaluateFormulaDelegate(AddressOf Me.EvaluateFormula) + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean, ByVal e As FormulaEvaluator) As String + If e Is Nothing Then + e = New FormulaEvaluator() + End If + + e.Variables.Clear() + + + ' add variables for formula evaluation + If variables IsNot Nothing Then + Dim enumerator As System.Collections.Generic.IEnumerator(Of System.Collections.Generic.KeyValuePair(Of String, Object)) = variables.GetEnumerator() + While enumerator.MoveNext() + e.Variables.Add(enumerator.Current.Key, enumerator.Current.Value) + End While + End If + + If includeDS + + End IF + + + ' Other variables referred to in the formula are expected to be + ' properties of the DataSource. For example, referring to + ' UnitPrice as a variable will refer to DataSource.UnitPrice + If dataSourceForEvaluate Is Nothing Then + + e.DataSource = Me.DataSource + + Else + e.DataSource = dataSourceForEvaluate + End If + + ' Define the calling control. This is used to add other + ' related table and record controls as variables. + e.CallingControl = Me + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + + If Not String.IsNullOrEmpty(format) AndAlso (String.IsNullOrEmpty(formula) OrElse formula.IndexOf("Format(") < 0) Then + Return FormulaUtils.Format(resultObj, format) + Else + Return resultObj.ToString() + End If + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format,variables ,includeDS, Nothing) + End Function + + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object)) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format, variables ,True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, format, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal e as FormulaEvaluator) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, variables, True, e) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal includeDS as Boolean) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, includeDS, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, True, Nothing) + End Function + + + Public Overridable Sub RegisterPostback() + + + End Sub + + + + ' To customize, override this method in PersonalTitleTableControlRow. + 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 parentCtrl As PersonalIdRecordControl + + + parentCtrl = DirectCast(Me.Page.FindControlRecursively("PersonalIdRecordControl"), PersonalIdRecordControl) + + If (Not IsNothing(parentCtrl) AndAlso IsNothing(parentCtrl.DataSource)) + ' Load the record if it is not loaded yet. + parentCtrl.LoadData() + End If + If (IsNothing(parentCtrl) OrElse IsNothing(parentCtrl.DataSource)) + ' Get the error message from the application resource file. + Throw New Exception(Page.GetResourceValue("Err:NoParentRecId", "Persons")) + End If + + Me.DataSource.PersonalId = parentCtrl.DataSource.PersonalId + + ' 2. Perform any custom validation. + Me.Validate() + + + ' 3. Set the values in the record with data from UI controls. + ' This calls the Get() method for each of the user interface controls. + Me.GetUIData() + + ' 4. Save in the database. + ' We should not save the record if the data did not change. This + ' will save a database hit and avoid triggering any database triggers. + + If Me.DataSource.IsAnyValueChanged Then + ' Save record to database but do not commit yet. + ' Auto generated ids are available after saving for use by child (dependent) records. + Me.DataSource.Save() + + DirectCast(GetParentControlObject(Me, "PersonalTitleTableControl"), PersonalTitleTableControl).DataChanged = True + DirectCast(GetParentControlObject(Me, "PersonalTitleTableControl"), PersonalTitleTableControl).ResetData = True + End If + + + ' update session or cookie by formula + + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + ' For Master-Detail relationships, save data on the Detail table(s) + + End Sub + + ' To customize, override this method in PersonalTitleTableControlRow. + 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. + + GetAss() + GetCommand2() + GetCommandDate3() + GetDept() + GetSkillNo() + GetTitle() + GetTitleDate() + GetTitleRank() + End Sub + + + Public Overridable Sub GetAss() + + ' Retrieve the value entered by the user on the Ass ASP:TextBox, and + ' save it into the Ass field in DataSource PersonalTitle record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.Ass.Text, PersonalTitleTable.Ass) + + + End Sub + + Public Overridable Sub GetCommand2() + + ' Retrieve the value entered by the user on the Command ASP:TextBox, and + ' save it into the Command field in DataSource PersonalTitle record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.Command2.Text, PersonalTitleTable.Command) + + + End Sub + + Public Overridable Sub GetCommandDate3() + + ' Retrieve the value entered by the user on the CommandDate ASP:TextBox, and + ' save it into the CommandDate field in DataSource PersonalTitle 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.CommandDate3.Text, PersonalTitleTable.CommandDate) + + + End Sub + + Public Overridable Sub GetDept() + + ' Retrieve the value entered by the user on the Dept ASP:TextBox, and + ' save it into the Dept field in DataSource PersonalTitle record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.Dept.Text, PersonalTitleTable.Dept) + + + End Sub + + Public Overridable Sub GetSkillNo() + + ' Retrieve the value entered by the user on the SkillNo ASP:TextBox, and + ' save it into the SkillNo field in DataSource PersonalTitle record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.SkillNo.Text, PersonalTitleTable.SkillNo) + + + End Sub + + Public Overridable Sub GetTitle() + + ' Retrieve the value entered by the user on the Title ASP:TextBox, and + ' save it into the Title field in DataSource PersonalTitle record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.Title.Text, PersonalTitleTable.Title) + + + End Sub + + Public Overridable Sub GetTitleDate() + + ' Retrieve the value entered by the user on the TitleDate ASP:TextBox, and + ' save it into the TitleDate field in DataSource PersonalTitle 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.TitleDate.Text, PersonalTitleTable.TitleDate) + + + End Sub + + Public Overridable Sub GetTitleRank() + + ' Retrieve the value entered by the user on the TitleRank ASP:TextBox, and + ' save it into the TitleRank field in DataSource PersonalTitle record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.TitleRank.Text, PersonalTitleTable.TitleRank) + + + End Sub + + + ' To customize, override this method in PersonalTitleTableControlRow. + + Public Overridable Function CreateWhereClause() As WhereClause + + Return Nothing + + End Function + + + + ' To customize, override this method in PersonalTitleTableControlRow. + 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) + PersonalTitleTable.DeleteRecord(pkValue) + + DirectCast(GetParentControlObject(Me, "PersonalTitleTableControl"), PersonalTitleTableControl).DataChanged = True + DirectCast(GetParentControlObject(Me, "PersonalTitleTableControl"), PersonalTitleTableControl).ResetData = True + End Sub + + Protected Overridable Sub Control_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.PreRender + ' PreRender event is raised just before page is being displayed. + Try + DbUtils.StartTransaction() + Me.RegisterPostback() + + If Not Me.Page.ErrorOnPage AndAlso (Me.Page.IsPageRefresh OrElse Me.DataChanged OrElse Me.ResetData) Then + + + ' Re-load the data and update the web page if necessary. + ' This is typically done during a postback (filter, search button, sort, pagination button). + ' In each of the other click handlers, simply set DataChanged to True to reload the data. + Me.LoadData() + Me.DataBind() + End If + + + Catch ex As Exception + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + Finally + DbUtils.EndTransaction() + End Try + End Sub + + + Protected Overrides Sub SaveControlsToSession() + MyBase.SaveControlsToSession() + + + 'Save pagination state to session. + + End Sub + + + + Protected Overrides Sub ClearControlsFromSession() + MyBase.ClearControlsFromSession() + + + + ' Clear pagination state from session. + + End Sub + + Protected Overrides Sub LoadViewState(ByVal savedState As Object) + MyBase.LoadViewState(savedState) + Dim isNewRecord As String = CType(ViewState("IsNewRecord"), String) + If Not isNewRecord Is Nothing AndAlso isNewRecord.Trim <> "" Then + Me.IsNewRecord = Boolean.Parse(isNewRecord) + End If + + Dim myCheckSum As String = CType(ViewState("CheckSum"), String) + If Not myCheckSum Is Nothing AndAlso myCheckSum.Trim <> "" Then + Me.CheckSum = myCheckSum + End If + + + ' Load view state for pagination control. + + End Sub + + Protected Overrides Function SaveViewState() As Object + ViewState("IsNewRecord") = Me.IsNewRecord.ToString() + ViewState("CheckSum") = Me.CheckSum + + + ' Load view state for pagination control. + + Return MyBase.SaveViewState() + End Function + + + ' event handler for ImageButton + Public Overridable Sub PersonalTitleRowDeleteButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + If(Not Me.Page.IsPageRefresh) Then + + Dim tc As PersonalTitleTableControl = DirectCast(GetParentControlObject(Me, "PersonalTitleTableControl"), PersonalTitleTableControl) + If Not (IsNothing(tc)) Then + If Not Me.IsNewRecord Then + tc.AddToDeletedRecordIds(DirectCast(Me, PersonalTitleTableControlRow)) + End If + Me.Visible = False + tc.SetFormulaControls() + End If + + End If + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + Protected Overridable Sub Ass_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub Command2_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub CommandDate3_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub Dept_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub SkillNo_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub Title_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub TitleDate_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub TitleRank_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("BasePersonalTitleTableControlRow_Rec"), String) + End Get + Set(ByVal value As String) + Me.ViewState("BasePersonalTitleTableControlRow_Rec") = value + End Set + End Property + + Private _DataSource As PersonalTitleRecord + Public Property DataSource() As PersonalTitleRecord + Get + Return Me._DataSource + End Get + + Set(ByVal value As PersonalTitleRecord) + + Me._DataSource = value + End Set + End Property + + + + Private _checkSum As String + Public Overridable Property CheckSum() As String + Get + Return Me._checkSum + End Get + Set(ByVal value As String) + Me._checkSum = value + End Set + End Property + + Private _TotalPages As Integer + Public Property TotalPages() As Integer + Get + Return Me._TotalPages + End Get + Set(ByVal value As Integer) + Me._TotalPages = value + End Set + End Property + + Private _PageIndex As Integer + Public Property PageIndex() As Integer + Get + ' Return the PageIndex + Return Me._PageIndex + End Get + Set(ByVal value As Integer) + Me._PageIndex = value + End Set + End Property + + Private _DisplayLastPage As Boolean + Public Property DisplayLastPage() As Boolean + Get + Return Me._DisplayLastPage + End Get + Set(ByVal value As Boolean) + Me._DisplayLastPage = value + End Set + End Property + + + +#Region "Helper Properties" + + Public ReadOnly Property Ass() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Ass"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property Command2() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Command2"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property CommandDate3() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "CommandDate3"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property Dept() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Dept"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property PersonalTitleRecordRowSelection() As System.Web.UI.WebControls.CheckBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalTitleRecordRowSelection"), System.Web.UI.WebControls.CheckBox) + End Get + End Property + + Public ReadOnly Property PersonalTitleRowDeleteButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalTitleRowDeleteButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property SkillNo() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "SkillNo"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property Title() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Title"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property TitleDate() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "TitleDate"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property TitleRank() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "TitleRank"), System.Web.UI.WebControls.TextBox) + 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 PersonalTitleRecord = 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 PersonalTitleRecord + If Not Me.DataSource Is Nothing Then + Return Me.DataSource + End If + + If Not Me.RecordUniqueId Is Nothing Then + + Return PersonalTitleTable.GetRecord(Me.RecordUniqueId, True) + + End If + + ' Localization. + + Return Nothing + + End Function + + Public Shadows ReadOnly Property Page() As BaseApplicationPage + Get + Return DirectCast(MyBase.Page, BaseApplicationPage) + End Get + End Property + +#End Region + +End Class + + + +' Base class for the PersonalTitleTableControl control on the AddPersonalId page. +' Do not modify this class. Instead override any method in PersonalTitleTableControl. +Public Class BasePersonalTitleTableControl + Inherits Persons.UI.BaseApplicationTableControl + + + + Protected Overridable Sub Control_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Init + + + + ' Setup the filter and search events. + + + + ' Control Initializations. + ' Initialize the table's current sort order. + + If Me.InSession(Me, "Order_By") Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + End If + + + + ' Setup default pagination settings. + + Me.PageSize = CInt(Me.GetFromSession(Me, "Page_Size", "10")) + Me.PageIndex = CInt(Me.GetFromSession(Me, "Page_Index", "0")) + + + + Me.ClearControlsFromSession() + End Sub + + Protected Overridable Sub Control_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load + + SaveControlsToSession_Ajax() + + ' Show confirmation message on Click + Me.PersonalTitleDeleteButton.Attributes.Add("onClick", "return (confirm('" & (CType(Me.Page,BaseApplicationPage)).GetResourceValue("DeleteConfirm", "Persons") & "'));") + + ' Setup the pagination events. + + AddHandler Me.PersonalTitlePagination.FirstPage.Click, AddressOf PersonalTitlePagination_FirstPage_Click + + AddHandler Me.PersonalTitlePagination.LastPage.Click, AddressOf PersonalTitlePagination_LastPage_Click + + AddHandler Me.PersonalTitlePagination.NextPage.Click, AddressOf PersonalTitlePagination_NextPage_Click + + AddHandler Me.PersonalTitlePagination.PageSizeButton.Click, AddressOf PersonalTitlePagination_PageSizeButton_Click + + AddHandler Me.PersonalTitlePagination.PreviousPage.Click, AddressOf PersonalTitlePagination_PreviousPage_Click + + + ' Setup the sorting events. + + AddHandler Me.AssLabel1.Click, AddressOf AssLabel1_Click + + AddHandler Me.CommandDateLabel3.Click, AddressOf CommandDateLabel3_Click + + AddHandler Me.CommandLabel2.Click, AddressOf CommandLabel2_Click + + AddHandler Me.DeptLabel.Click, AddressOf DeptLabel_Click + + AddHandler Me.SkillNoLabel.Click, AddressOf SkillNoLabel_Click + + AddHandler Me.TitleDateLabel1.Click, AddressOf TitleDateLabel1_Click + + AddHandler Me.TitleLabel.Click, AddressOf TitleLabel_Click + + AddHandler Me.TitleRankLabel.Click, AddressOf TitleRankLabel_Click + + ' Setup the button events. + + AddHandler Me.PersonalTitleAddButton.Click, AddressOf PersonalTitleAddButton_Click + + AddHandler Me.PersonalTitleDeleteButton.Click, AddressOf PersonalTitleDeleteButton_Click + + AddHandler Me.PersonalTitleResetButton.Click, AddressOf PersonalTitleResetButton_Click + + + ' Setup events for others + + End Sub + + + Public Overridable Sub LoadData() + + ' Read data from database. Returns an array of records that can be assigned + ' to the DataSource table control property. + Try + Dim joinFilter As CompoundFilter = CreateCompoundJoinFilter() + + ' The WHERE clause will be empty when displaying all records in table. + Dim wc As WhereClause = CreateWhereClause() + If wc IsNot Nothing AndAlso Not wc.RunQuery Then + ' Initialize an empty array of records + Dim alist As New ArrayList(0) + Me.DataSource = DirectCast(alist.ToArray(GetType(PersonalTitleRecord)), PersonalTitleRecord()) + ' Add records to the list if needed. + Me.AddNewRecords() + Me._TotalRecords = 0 + Me._TotalPages = 0 + Return + End If + + ' Call OrderBy to determine the order - either use the order defined + ' on the Query Wizard, or specified by user (by clicking on column heading) + Dim orderBy As OrderBy = CreateOrderBy() + + ' Get the pagesize from the pagesize control. + Me.GetPageSize() + + If Me.DisplayLastPage Then + Dim totalRecords As Integer = If(Me._TotalRecords < 0, PersonalTitleTable.GetRecordCount(CreateCompoundJoinFilter(), CreateWhereClause()), Me._TotalRecords) + + Dim totalPages As Integer = CInt(Math.Ceiling(totalRecords / Me.PageSize)) + + Me.PageIndex = totalPages - 1 + End If + + ' Make sure PageIndex (current page) and PageSize are within bounds. + If Me.PageIndex < 0 Then + Me.PageIndex = 0 + End If + If Me.PageSize < 1 Then + Me.PageSize = 1 + End If + + ' Retrieve the records and set the table DataSource. + ' Only PageSize records are fetched starting at PageIndex (zero based). + If Me.AddNewRecord > 0 Then + ' Make sure to preserve the previously entered data on new rows. + Dim postdata As New ArrayList + For Each rc As PersonalTitleTableControlRow In Me.GetRecordControls() + If Not rc.IsNewRecord Then + rc.DataSource = rc.GetRecord() + rc.GetUIData() + postdata.Add(rc.DataSource) + UIData.Add(rc.PreservedUIData()) + End If + Next + Me.DataSource = DirectCast(postdata.ToArray(GetType(PersonalTitleRecord)), PersonalTitleRecord()) + Else ' Get the records from the database + Me.DataSource = PersonalTitleTable.GetRecords(joinFilter, wc, orderBy, Me.PageIndex, Me.PageSize) + + End If + + ' if the datasource contains no records contained in database, then load the last page. + If (DbUtils.GetCreatedRecords(Me.DataSource).Length = 0 AndAlso Not Me.DisplayLastPage) Then + Me.DisplayLastPage = True + LoadData() + Else + + ' Add any new rows desired by the user. + Me.AddNewRecords() + + ' Turn off the ToggleAll checkbox + Me.PersonalTitleToggleAll.Checked = False + + + ' Initialize the page and grand totals. now + + End If + + Catch ex As Exception + ' Report the error message to the end user + Dim msg As String = ex.Message + If ex.InnerException IsNot Nothing Then + msg = msg & " InnerException: " & ex.InnerException.Message + End If + Throw New Exception(msg, ex.InnerException) + End Try + End Sub + + + + + Public Overrides Sub DataBind() + ' The DataBind method binds the user interface controls to the values + ' from the database record for each row in the table. To do this, it calls the + ' DataBind for each of the rows. + ' DataBind also populates any filters above the table, and sets the pagination + ' control to the correct number of records and the current page number. + + MyBase.DataBind() + + ' Make sure that the DataSource is initialized. + If Me.DataSource Is Nothing Then + Return + End If + + 'LoadData for DataSource for chart and report if they exist + + ' Setup the pagination controls. + BindPaginationControls() + + + + ' Bind the repeater with the list of records to expand the UI. + Dim rep As System.Web.UI.WebControls.Repeater = CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalTitleTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return + rep.DataSource = DataSource() + rep.DataBind() + + Dim index As Integer = 0 + For Each repItem As System.Web.UI.WebControls.RepeaterItem In rep.Items + ' Loop through all rows in the table, set its DataSource and call DataBind(). + Dim recControl As PersonalTitleTableControlRow = DirectCast(repItem.FindControl("PersonalTitleTableControlRow"), PersonalTitleTableControlRow) + recControl.DataSource = Me.DataSource(index) + If Me.UIData.Count > index Then + recControl.PreviousUIData = Me.UIData(index) + End If + recControl.DataBind() + recControl.Visible = Not Me.InDeletedRecordIds(recControl) + + index += 1 + Next + + + + + ' Call the Set methods for each controls on the panel + + SetAssLabel1() + SetCommandDateLabel3() + SetCommandLabel2() + SetDeptLabel() + + + + + SetPersonalTitleTableControlCollapsibleRegion() + + SetSkillNoLabel() + SetTitleDateLabel1() + SetTitleLabel() + SetTitleRankLabel() + ' setting the state of expand or collapse alternative rows + + + ' Load data for each record and table UI control. + ' Ordering is important because child controls get + ' their parent ids from their parent UI controls. + + + ' this method calls the set method for controls with special formula like running total, sum, rank, etc + SetFormulaControls() + End Sub + + Public Overridable Sub SetFormulaControls() + ' this method calls Set methods for the control that has special formula + + + + End Sub + + + + Public Overridable Sub RegisterPostback() + + + End Sub + + Public EvaluateFormulaDelegate As BaseClasses.Data.DataSource.EvaluateFormulaDelegate = New BaseClasses.Data.DataSource.EvaluateFormulaDelegate(AddressOf Me.EvaluateFormula) + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean, ByVal e as FormulaEvaluator) As String + If e Is Nothing + e = New FormulaEvaluator() + End If + + e.Variables.Clear() + + + ' add variables for formula evaluation + If variables IsNot Nothing Then + Dim enumerator As System.Collections.Generic.IEnumerator(Of System.Collections.Generic.KeyValuePair(Of String, Object)) = variables.GetEnumerator() + While enumerator.MoveNext() + e.Variables.Add(enumerator.Current.Key, enumerator.Current.Value) + End While + End If + + If includeDS + + End If + + ' All variables referred to in the formula are expected to be + ' properties of the DataSource. For example, referring to + ' UnitPrice as a variable will refer to DataSource.UnitPrice + e.DataSource = dataSourceForEvaluate + + ' Define the calling control. This is used to add other + ' related table and record controls as variables. + e.CallingControl = Me + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + + If Not String.IsNullOrEmpty(format) AndAlso (String.IsNullOrEmpty(formula) OrElse formula.IndexOf("Format(") < 0) Then + Return FormulaUtils.Format(resultObj, format) + Else + Return resultObj.ToString() + End If + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format,variables ,includeDS, Nothing) + End Function + + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object)) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format, variables ,True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, format, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal e as FormulaEvaluator) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, variables, True, e) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal includeDS as Boolean) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, includeDS, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, True, Nothing) + End Function + + + + + Public Overridable Sub ResetControl() + + Me.CurrentSortOrder.Reset() + If (Me.InSession(Me, "Order_By")) Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + End If + + Me.PageIndex = 0 + End Sub + + Protected Overridable Sub BindPaginationControls() + ' Setup the pagination controls. + + ' Bind the pagination labels. + + If DbUtils.GetCreatedRecords(Me.DataSource).Length > 0 Then + + Me.PersonalTitlePagination.CurrentPage.Text = (Me.PageIndex + 1).ToString() + Else + Me.PersonalTitlePagination.CurrentPage.Text = "0" + End If + Me.PersonalTitlePagination.PageSize.Text = Me.PageSize.ToString() + Me.PersonalTitlePagination.TotalItems.Text = Me.TotalRecords.ToString() + Me.PersonalTitlePagination.TotalPages.Text = Me.TotalPages.ToString() + + ' Bind the buttons for PersonalTitleTableControl pagination. + + Me.PersonalTitlePagination.FirstPage.Enabled = Not (Me.PageIndex = 0) + If Me._TotalPages < 0 Then ' if the total pages is not determined yet, enable last and next buttons + Me.PersonalTitlePagination.LastPage.Enabled = True + ElseIf Me._TotalPages = 0 ' if the total pages is determined and it is 0, enable last and next buttons + Me.PersonalTitlePagination.LastPage.Enabled = False + Else ' if the total pages is the last page, disable last and next buttons + Me.PersonalTitlePagination.LastPage.Enabled = Not (Me.PageIndex = Me.TotalPages - 1) + End If + + If Me._TotalPages < 0 Then ' if the total pages is not determined yet, enable last and next buttons + Me.PersonalTitlePagination.NextPage.Enabled = True + ElseIf Me._TotalPages = 0 ' if the total pages is determined and it is 0, enable last and next buttons + Me.PersonalTitlePagination.NextPage.Enabled = False + Else ' if the total pages is the last page, disable last and next buttons + Me.PersonalTitlePagination.NextPage.Enabled = Not (Me.PageIndex = Me.TotalPages - 1) + End If + + Me.PersonalTitlePagination.PreviousPage.Enabled = Not (Me.PageIndex = 0) + + + End Sub + + Public Overridable Sub SaveData() + ' Save the data from the entire table. Calls each row's Save Data + ' to save their data. This function is called by the Click handler of the + ' Save button. The button handler should Start/Commit/End a transaction. + + Dim recCtl As PersonalTitleTableControlRow + For Each recCtl In Me.GetRecordControls() + + If Me.InDeletedRecordIds(recCtl) Then + ' Delete any pending deletes. + recCtl.Delete() + Else + If recCtl.Visible Then + recCtl.SaveData() + End If + End If + + Next + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + ' Set IsNewRecord to False for all records - since everything has been saved and is no longer "new" + For Each recCtl In Me.GetRecordControls() + recCtl.IsNewRecord = False + Next + + + ' Set DeletedRecordsIds to Nothing since we have deleted all pending deletes. + Me.DeletedRecordIds = Nothing + + End Sub + + Public Overridable Function CreateCompoundJoinFilter() As CompoundFilter + Dim jFilter As CompoundFilter = New CompoundFilter() + + Return jFilter + + End Function + + + Public Overridable Function CreateOrderBy() As OrderBy + ' The CurrentSortOrder is initialized to the sort order on the + ' Query Wizard. It may be modified by the Click handler for any of + ' the column heading to sort or reverse sort by that column. + ' You can add your own sort order, or modify it on the Query Wizard. + Return Me.CurrentSortOrder + End Function + + Public Overridable Function CreateWhereClause() As WhereClause + 'This CreateWhereClause is used for loading the data. + PersonalTitleTable.Instance.InnerFilter = Nothing + Dim wc As WhereClause = New WhereClause() + + ' Compose the WHERE clause consiting of: + ' 1. Static clause defined at design time. + ' 2. User selected search criteria. + ' 3. User selected filter criteria. + + + Dim selectedRecordKeyValue as KeyValue = New KeyValue() + + Dim personalIdRecordControlObj As Persons.UI.Controls.AddPersonalId.PersonalIdRecordControl = DirectCast(MiscUtils.FindControlRecursively(Me.Page, "PersonalIdRecordControl"), Persons.UI.Controls.AddPersonalId.PersonalIdRecordControl) + + If (Not IsNothing(personalIdRecordControlObj) AndAlso Not IsNothing(personalIdRecordControlObj.GetRecord()) AndAlso personalIdRecordControlObj.GetRecord().IsCreated AndAlso Not IsNothing(personalIdRecordControlObj.GetRecord().PersonalId)) + wc.iAND(PersonalTitleTable.PersonalId, BaseFilter.ComparisonOperator.EqualsTo, personalIdRecordControlObj.GetRecord().PersonalId.ToString()) + selectedRecordKeyValue.AddElement(PersonalTitleTable.PersonalId.InternalName, personalIdRecordControlObj.GetRecord().PersonalId.ToString()) + Else + wc.RunQuery = False + Return wc + End If + + HttpContext.Current.Session("PersonalTitleTableControlWhereClause") = selectedRecordKeyValue.ToXmlString() + + Return wc + End Function + + + Public Overridable Function CreateWhereClause(ByVal searchText as String, ByVal fromSearchControl as String, ByVal AutoTypeAheadSearch as String, ByVal AutoTypeAheadWordSeparators as String) As WhereClause + ' This CreateWhereClause is used for loading list of suggestions for Auto Type-Ahead feature. + PersonalTitleTable.Instance.InnerFilter = Nothing + Dim wc As WhereClause = New WhereClause() + + ' Compose the WHERE clause consiting of: + ' 1. Static clause defined at design time. + ' 2. User selected search criteria. + ' 3. User selected filter criteria. + + Dim appRelativeVirtualPath As String = CType(HttpContext.Current.Session("AppRelativeVirtualPath"), String) + + Dim selectedRecordInPersonalIdRecordControl as String = DirectCast(HttpContext.Current.Session("PersonalTitleTableControlWhereClause"), String) + + If Not selectedRecordInPersonalIdRecordControl Is Nothing AndAlso KeyValue.IsXmlKey(selectedRecordInPersonalIdRecordControl) Then + Dim selectedRecordKeyValue as KeyValue = KeyValue.XmlToKey(selectedRecordInPersonalIdRecordControl) + + If Not IsNothing(selectedRecordKeyValue) AndAlso selectedRecordKeyValue.ContainsColumn(PersonalTitleTable.PersonalId) Then + wc.iAND(PersonalTitleTable.PersonalId, BaseFilter.ComparisonOperator.EqualsTo, selectedRecordKeyValue.GetColumnValue(PersonalTitleTable.PersonalId).ToString()) + End If + + End If + + ' Adds clauses if values are selected in Filter controls which are configured in the page. + + + Return wc + End Function + + + Public Overridable Function FormatSuggestions(ByVal prefixText As String, ByVal resultItem As String, _ + ByVal columnLength As Integer, ByVal AutoTypeAheadDisplayFoundText As String, _ + ByVal autoTypeAheadSearch As String, ByVal AutoTypeAheadWordSeparators As String, _ + ByVal resultList As ArrayList) As Boolean + + 'Formats the resultItem and adds it to the list of suggestions. + Dim index As Integer = resultItem.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture).IndexOf(prefixText.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture)) + Dim itemToAdd As String = "" + Dim isFound As Boolean = False + Dim isAdded As Boolean = False + ' Get the index where prfixt is at the beginning of resultItem. If not found then, index of word which begins with prefixText. + If InvariantLCase(autoTypeAheadSearch).equals("wordsstartingwithsearchstring") And Not index = 0 Then + ' Expression to find word which contains AutoTypeAheadWordSeparators followed by prefixText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex( AutoTypeAheadWordSeparators + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + If regex1.IsMatch(resultItem) Then + index = regex1.Match(resultItem).Index + isFound = True + End If + ' If the prefixText is found immediatly after white space then starting of the word is found so don not search any further + If not resultItem(index).ToString() = " " Then + ' Expression to find beginning of the word which contains AutoTypeAheadWordSeparators followed by prefixText + Dim regex As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\\S*" + AutoTypeAheadWordSeparators + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + If regex.IsMatch(resultItem) Then + index = regex.Match(resultItem).Index + isFound = True + End If + End If + End If + + ' If autoTypeAheadSearch value is wordsstartingwithsearchstring then, extract the substring only if the prefixText is found at the + ' beginning of the resultItem (index = 0) or a word in resultItem is found starts with prefixText. + If index = 0 Or isFound Or InvariantLCase(autoTypeAheadSearch).Equals("anywhereinstring") then + If InvariantLCase(AutoTypeAheadDisplayFoundText).equals("atbeginningofmatchedstring") Then + ' Expression to find beginning of the word which contains prefixText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\\S*" + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + ' Find the beginning of the word which contains prefexText + If (StringUtils.InvariantLCase(autoTypeAheadSearch).Equals("anywhereinstring") AndAlso regex1.IsMatch(resultItem)) Then + index = regex1.Match(resultItem).Index + isFound = True + End If + ' Display string from the index till end of the string if sub string from index till end is less than columnLength value. + If Len(resultItem) - index <= columnLength Then + If index = 0 Then + itemToAdd = resultItem + Else + itemToAdd = "..." & resultItem.Substring(index, Len(resultItem) - index) + End If + Else + If index = 0 Then + itemToAdd = resultItem.Substring(index, (columnLength - 3)) & "..." + Else + 'Truncate the string to show only columnLength - 6 characters as begining and trailing "..." has to be appended. + itemToAdd = "..." & resultItem.Substring(index , columnLength - 6) & "..." + End If + End If + ElseIf InvariantLCase(AutoTypeAheadDisplayFoundText).equals("inmiddleofmatchedstring") Then + Dim subStringBeginIndex As Integer = CType(columnLength/2, Integer) + If Len(resultItem) <= columnLength Then + itemToAdd = resultItem + Else + ' Sanity check at end of the string + If index + Len(prefixText) = columnLength Then + itemToAdd = "..." & resultItem.Substring(index-columnLength,index) + ElseIf Len(resultItem) - index < subStringBeginIndex Then + ' Display string from the end till columnLength value if, index is closer to the end of the string. + itemToAdd = "..." & resultItem.Substring(Len(resultItem)-columnLength,Len(resultItem)) + ElseIf index <= subStringBeginIndex Then + ' Sanity chet at beginning of the string + itemToAdd = resultItem.Substring(0, columnLength) & "..." + Else + ' Display string containing text before the prefixText occures and text after the prefixText + itemToAdd = "..." & resultItem.Substring(index - subStringBeginIndex, columnLength) & "..." + End If + End If + ElseIf InvariantLCase(AutoTypeAheadDisplayFoundText).equals("atendofmatchedstring") Then + ' Expression to find ending of the word which contains prefexText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\s", System.Text.RegularExpressions.RegexOptions.IgnoreCase) + ' Find the ending of the word which contains prefexText + If regex1.IsMatch(resultItem, index + 1) Then + index = regex1.Match(resultItem, index + 1).Index + Else + ' If the word which contains prefexText is the last word in string, regex1.IsMatch returns false. + index = resultItem.Length + End If + If index > Len(resultItem) Then + index = Len(resultItem) + End If + ' If text from beginning of the string till index is less than columnLength value then, display string from the beginning till index. + If index <= columnLength Then + if index = Len(resultItem) Then 'Make decision to append "..." + itemToAdd = resultItem.Substring(0,index) + Else + itemToAdd = resultItem.Substring(0,index) & "..." + End If + Else + If index = Len(resultItem) Then + itemToAdd = "..." & resultItem.Substring(index - (columnLength - 3), (columnLength - 3)) + Else + 'Truncate the string to show only columnLength - 6 characters as begining and trailing "..." has to be appended. + itemToAdd = "..." & resultItem.Substring(index - (columnLength - 6), columnLength - 6) & "..." + End If + End If + End If + + ' Remove newline character from itemToAdd + Dim prefixTextIndex As Integer = itemToAdd.IndexOf(prefixText, StringComparison.CurrentCultureIgnoreCase) + ' If itemToAdd contains any newline after the search text then show text only till newline + Dim regex2 As System.Text.RegularExpressions.Regex = New System.Text.RegularExpressions.Regex("(" & vbCrLf & "|" & vbLf & ")", System.Text.RegularExpressions.RegexOptions.IgnoreCase) + Dim newLineIndexAfterPrefix As Integer = -1 + If regex2.IsMatch(itemToAdd, prefixTextIndex) Then + newLineIndexAfterPrefix = regex2.Match(itemToAdd, prefixTextIndex).Index + End If + If (newLineIndexAfterPrefix > -1) Then + If itemToAdd.EndsWith("...") Then + itemToAdd = (itemToAdd.Substring(0, newLineIndexAfterPrefix) + "...") + Else + itemToAdd = itemToAdd.Substring(0, newLineIndexAfterPrefix) + End If + End If + ' If itemToAdd contains any newline before search text then show text which comes after newline + Dim regex3 As System.Text.RegularExpressions.Regex = New System.Text.RegularExpressions.Regex("(" & vbCrLf & "|" & vbLf & ")", (System.Text.RegularExpressions.RegexOptions.IgnoreCase Or System.Text.RegularExpressions.RegexOptions.RightToLeft)) + Dim newLineIndexBeforePrefix As Integer = -1 + If regex3.IsMatch(itemToAdd, prefixTextIndex) Then + newLineIndexBeforePrefix = regex3.Match(itemToAdd, prefixTextIndex).Index + End If + If (newLineIndexBeforePrefix > -1) Then + If itemToAdd.StartsWith("...") Then + itemToAdd = ("..." + itemToAdd.Substring((newLineIndexBeforePrefix + regex3.Match(itemToAdd, prefixTextIndex).Length))) + Else + itemToAdd = itemToAdd.Substring((newLineIndexBeforePrefix + regex3.Match(itemToAdd, prefixTextIndex).Length)) + End If + End If + + If Not itemToAdd is nothing AndAlso Not resultList.Contains(itemToAdd) Then + + resultList.Add(itemToAdd) + + isAdded = true + End If + End If + Return isAdded + End Function + + + Protected Overridable Sub GetPageSize() + + If Me.PersonalTitlePagination.PageSize.Text.Trim <> "" Then + Try + 'Me.PageSize = Integer.Parse(Me.PersonalTitlePagination.PageSize.Text) + Catch ex As Exception + End Try + End If + End Sub + + Protected Overridable Sub AddNewRecords() + + Dim newRecordList As ArrayList = New ArrayList() + + Dim newUIDataList As System.Collections.Generic.List(Of Hashtable) = New System.Collections.Generic.List(Of Hashtable)() + + ' Loop though all the record controls and if the record control + ' does not have a unique record id set, then create a record + ' and add to the list. + If Not Me.ResetData Then + Dim rep As System.Web.UI.WebControls.Repeater = CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalTitleTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return + + Dim repItem As System.Web.UI.WebControls.RepeaterItem + For Each repItem In rep.Items + ' Loop through all rows in the table, set its DataSource and call DataBind(). + + Dim recControl As PersonalTitleTableControlRow = DirectCast(repItem.FindControl("PersonalTitleTableControlRow"), PersonalTitleTableControlRow) + + If recControl.Visible AndAlso recControl.IsNewRecord() Then + + Dim rec As PersonalTitleRecord = New PersonalTitleRecord() + + If recControl.Ass.Text <> "" Then + rec.Parse(recControl.Ass.Text, PersonalTitleTable.Ass) + End If + If recControl.Command2.Text <> "" Then + rec.Parse(recControl.Command2.Text, PersonalTitleTable.Command) + End If + If recControl.CommandDate3.Text <> "" Then + rec.Parse(recControl.CommandDate3.Text, PersonalTitleTable.CommandDate) + End If + If recControl.Dept.Text <> "" Then + rec.Parse(recControl.Dept.Text, PersonalTitleTable.Dept) + End If + If recControl.SkillNo.Text <> "" Then + rec.Parse(recControl.SkillNo.Text, PersonalTitleTable.SkillNo) + End If + If recControl.Title.Text <> "" Then + rec.Parse(recControl.Title.Text, PersonalTitleTable.Title) + End If + If recControl.TitleDate.Text <> "" Then + rec.Parse(recControl.TitleDate.Text, PersonalTitleTable.TitleDate) + End If + If recControl.TitleRank.Text <> "" Then + rec.Parse(recControl.TitleRank.Text, PersonalTitleTable.TitleRank) + End If + newUIDataList.Add(recControl.PreservedUIData()) + newRecordList.Add(rec) + End If + Next + End If + + + ' Add any new record to the list. + Dim index As Integer = 0 + For index = 1 To Me.AddNewRecord + + newRecordList.Insert(0, New PersonalTitleRecord()) + newUIDataList.Insert(0, New Hashtable()) + + Next + Me.AddNewRecord = 0 + + ' Finally, add any new records to the DataSource. + If newRecordList.Count > 0 Then + + Dim finalList As ArrayList = New ArrayList(Me.DataSource) + finalList.InsertRange(0, newRecordList) + + Me.DataSource = DirectCast(finalList.ToArray(GetType(PersonalTitleRecord)), PersonalTitleRecord()) + + End If + + ' Add the existing UI data to this hash table + If newUIDataList.Count > 0 Then + Me.UIData.InsertRange(0, newUIDataList) + End If + + End Sub + + + Public Sub AddToDeletedRecordIds(ByVal rec As PersonalTitleTableControlRow) + If rec.IsNewRecord() Then + Return + End If + + If Not Me.DeletedRecordIds Is Nothing AndAlso Me.DeletedRecordIds.Trim <> "" Then + Me.DeletedRecordIds &= "," + End If + + Me.DeletedRecordIds &= "[" & rec.RecordUniqueId & "]" + End Sub + + Protected Overridable Function InDeletedRecordIds(ByVal rec As PersonalTitleTableControlRow) As Boolean + If Me.DeletedRecordIds Is Nothing OrElse Me.DeletedRecordIds.Trim = "" Then + Return False + End If + + Return Me.DeletedRecordIds.IndexOf("[" & rec.RecordUniqueId & "]") >= 0 + End Function + + Private _DeletedRecordIds As String + Public Property DeletedRecordIds() As String + Get + Return Me._DeletedRecordIds + End Get + Set(ByVal value As String) + Me._DeletedRecordIds = value + End Set + End Property + + + ' Create Set, WhereClause, and Populate Methods + + Public Overridable Sub SetAssLabel1() + + End Sub + + Public Overridable Sub SetCommandDateLabel3() + + End Sub + + Public Overridable Sub SetCommandLabel2() + + End Sub + + Public Overridable Sub SetDeptLabel() + + End Sub + + Public Overridable Sub SetPersonalTitleTableControlCollapsibleRegion() + + End Sub + + Public Overridable Sub SetSkillNoLabel() + + End Sub + + Public Overridable Sub SetTitleDateLabel1() + + End Sub + + Public Overridable Sub SetTitleLabel() + + End Sub + + Public Overridable Sub SetTitleRankLabel() + + 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. + Dim added As Boolean = Me.AddNewRecord > 0 + Me.LoadData() + Me.DataBind() + + If added Then + Me.SetFocusToAddedRow() + End If + + End If + + + + Catch ex As Exception + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + Finally + DbUtils.EndTransaction + End Try + End Sub + + 'this function sets focus to the first editable element in the new added row in the editable table + Protected Overridable Sub SetFocusToAddedRow() + Dim rep As System.Web.UI.WebControls.Repeater = CType(Me.FindControl("PersonalTitleTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing OrElse rep.Items.Count = 0 Then Return + Dim repItem As System.Web.UI.WebControls.RepeaterItem + For Each repItem In rep.Items + 'Load scripts to table rows + Me.Page.LoadFocusScripts(repItem) + Dim recControl As PersonalTitleTableControlRow = DirectCast(repItem.FindControl("PersonalTitleTableControlRow"), PersonalTitleTableControlRow) + If recControl.IsNewRecord Then + For Each field As Control In recControl.Controls + If field.Visible AndAlso Me.Page.IsControlEditable(field, False) Then + 'set focus on the first editable field in the new row + field.Focus() + Dim updPan As UpdatePanel = DirectCast(Me.Page.FindControlRecursively("UpdatePanel1"), UpdatePanel) + If Not updPan Is Nothing Then updPan.Update() + Return + End If + Next + Return + End If + Next + End Sub + + + Protected Overrides Sub SaveControlsToSession() + MyBase.SaveControlsToSession() + + ' Save filter controls to values to session. + + + 'Save pagination state to session. + + + + ' Save table control properties to the session. + If Not Me.CurrentSortOrder Is Nothing Then + Me.SaveToSession(Me, "Order_By", Me.CurrentSortOrder.ToXmlString()) + End If + + Me.SaveToSession(Me, "Page_Index", Me.PageIndex.ToString()) + Me.SaveToSession(Me, "Page_Size", Me.PageSize.ToString()) + + Me.SaveToSession(Me, "DeletedRecordIds", Me.DeletedRecordIds) + + End Sub + + Protected Sub SaveControlsToSession_Ajax() + ' Save filter controls to values to session. + + HttpContext.Current.Session("AppRelativeVirtualPath") = Me.Page.AppRelativeVirtualPath + + End Sub + + Protected Overrides Sub ClearControlsFromSession() + MyBase.ClearControlsFromSession() + + ' Clear filter controls values from the session. + + + ' Clear pagination state from session. + + + + ' Clear table properties from the session. + Me.RemoveFromSession(Me, "Order_By") + Me.RemoveFromSession(Me, "Page_Index") + Me.RemoveFromSession(Me, "Page_Size") + + Me.RemoveFromSession(Me, "DeletedRecordIds") + + End Sub + + Protected Overrides Sub LoadViewState(ByVal savedState As Object) + MyBase.LoadViewState(savedState) + + Dim orderByStr As String = CType(ViewState("PersonalTitleTableControl_OrderBy"), String) + + If orderByStr IsNot Nothing AndAlso orderByStr.Trim <> "" Then + Me.CurrentSortOrder = BaseClasses.Data.OrderBy.FromXmlString(orderByStr) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + End If + + Dim pageIndex As String = CType(ViewState("Page_Index"), String) + If pageIndex IsNot Nothing Then + Me.PageIndex = CInt(pageIndex) + End If + + Dim pageSize As String = CType(ViewState("Page_Size"), String) + If Not pageSize Is Nothing Then + Me.PageSize = CInt(pageSize) + End If + + + + ' Load view state for pagination control. + + Me.DeletedRecordIds = CType(Me.ViewState("DeletedRecordIds"), String) + + End Sub + + Protected Overrides Function SaveViewState() As Object + + If Me.CurrentSortOrder IsNot Nothing Then + Me.ViewState("PersonalTitleTableControl_OrderBy") = Me.CurrentSortOrder.ToXmlString() + End If + + Me.ViewState("Page_Index") = Me.PageIndex + Me.ViewState("Page_Size") = Me.PageSize + + Me.ViewState("DeletedRecordIds") = Me.DeletedRecordIds + + + ' Load view state for pagination control. + + + Return MyBase.SaveViewState() + End Function + + ' Generate the event handling functions for pagination events. + + ' event handler for ImageButton + Public Overridable Sub PersonalTitlePagination_FirstPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.PageIndex = 0 + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalTitlePagination_LastPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.DisplayLastPage = True + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalTitlePagination_NextPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.PageIndex += 1 + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for LinkButton + Public Overridable Sub PersonalTitlePagination_PageSizeButton_Click(ByVal sender As Object, ByVal args As EventArgs) + + Try + + Me.DataChanged = True + + Me.PageSize = Integer.Parse(Me.PersonalTitlePagination.PageSize.Text) + + Me.PageIndex = Integer.Parse(Me.PersonalTitlePagination.CurrentPage.Text) - 1 + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalTitlePagination_PreviousPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + If Me.PageIndex > 0 Then + Me.PageIndex -= 1 + Me.DataChanged = True + End If + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + + ' Generate the event handling functions for sorting events. + + Public Overridable Sub AssLabel1_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by Ass when clicked. + + ' Get previous sorting state for Ass. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalTitleTable.Ass) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for Ass. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalTitleTable.Ass, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by Ass, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub CommandDateLabel3_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by CommandDate when clicked. + + ' Get previous sorting state for CommandDate. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalTitleTable.CommandDate) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for CommandDate. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalTitleTable.CommandDate, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by CommandDate, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub CommandLabel2_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by Command when clicked. + + ' Get previous sorting state for Command. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalTitleTable.Command) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for Command. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalTitleTable.Command, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by Command, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub DeptLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by Dept when clicked. + + ' Get previous sorting state for Dept. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalTitleTable.Dept) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for Dept. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalTitleTable.Dept, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by Dept, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub SkillNoLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by SkillNo when clicked. + + ' Get previous sorting state for SkillNo. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalTitleTable.SkillNo) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for SkillNo. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalTitleTable.SkillNo, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by SkillNo, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub TitleDateLabel1_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by TitleDate when clicked. + + ' Get previous sorting state for TitleDate. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalTitleTable.TitleDate) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for TitleDate. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalTitleTable.TitleDate, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by TitleDate, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub TitleLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by Title when clicked. + + ' Get previous sorting state for Title. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalTitleTable.Title) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for Title. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalTitleTable.Title, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by Title, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub TitleRankLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by TitleRank when clicked. + + ' Get previous sorting state for TitleRank. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalTitleTable.TitleRank) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for TitleRank. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalTitleTable.TitleRank, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by TitleRank, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + + ' Generate the event handling functions for button events. + + ' event handler for ImageButton + Public Overridable Sub PersonalTitleAddButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + Me.AddNewRecord = 1 + Me.DataChanged = True + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalTitleDeleteButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + If(Not Me.Page.IsPageRefresh) Then + + Me.DeleteSelectedRecords(True) + Me.SetFormulaControls() + + + End If + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalTitleResetButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.CurrentSortOrder.Reset() + If Me.InSession(Me, "Order_By") Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + + End If + + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + + + ' Generate the event handling functions for filter and search events. + + + ' Generate the event handling functions for others + + + Private _UIData As New System.Collections.Generic.List(Of Hashtable) + Public Property UIData() As System.Collections.Generic.List(Of Hashtable) + Get + Return Me._UIData + End Get + Set(ByVal value As System.Collections.Generic.List(Of Hashtable)) + Me._UIData = value + End Set + End Property + + ' pagination properties + Protected _PageSize As Integer + Public Property PageSize() As Integer + Get + Return Me._PageSize + End Get + Set(ByVal value As Integer) + Me._PageSize = value + End Set + End Property + + Protected _PageIndex As Integer + Public Property PageIndex() As Integer + Get + ' Return the PageIndex + Return Me._PageIndex + End Get + Set(ByVal value As Integer) + Me._PageIndex = value + End Set + End Property + + Protected _TotalRecords As Integer = -1 + Public Property TotalRecords() As Integer + Get + If _TotalRecords < 0 + _TotalRecords = PersonalTitleTable.GetRecordCount(CreateCompoundJoinFilter(), CreateWhereClause()) + End If + Return Me._TotalRecords + End Get + Set(ByVal value As Integer) + If Me.PageSize > 0 Then + + Me.TotalPages = CInt(Math.Ceiling(value / Me.PageSize)) + + End If + Me._TotalRecords = value + End Set + End Property + + + + Protected _TotalPages As Integer = -1 + Public Property TotalPages() As Integer + Get + If _TotalPages < 0 Then + + Me.TotalPages = CInt(Math.Ceiling(TotalRecords / Me.PageSize)) + + End If + Return Me._TotalPages + End Get + Set(ByVal value As Integer) + Me._TotalPages = value + End Set + End Property + + Protected _DisplayLastPage As Boolean + Public Property DisplayLastPage() As Boolean + Get + Return Me._DisplayLastPage + End Get + Set(ByVal value As Boolean) + Me._DisplayLastPage = value + End Set + End Property + + Private _DataChanged As Boolean = False + Public Property DataChanged() As Boolean + Get + Return Me._DataChanged + End Get + Set(ByVal value As Boolean) + Me._DataChanged = value + End Set + End Property + + Private _ResetData As Boolean = False + Public Property ResetData() As Boolean + Get + Return Me._ResetData + End Get + Set(ByVal value As Boolean) + Me._ResetData = value + End Set + End Property + + Private _AddNewRecord As Integer = 0 + Public Property AddNewRecord() As Integer + Get + Return Me._AddNewRecord + End Get + Set(ByVal value As Integer) + Me._AddNewRecord = value + End Set + End Property + + + Private _CurrentSortOrder As OrderBy = Nothing + Public Property CurrentSortOrder() As OrderBy + Get + Return Me._CurrentSortOrder + End Get + Set(ByVal value As BaseClasses.Data.OrderBy) + Me._CurrentSortOrder = value + End Set + End Property + + Private _DataSource() As PersonalTitleRecord = Nothing + Public Property DataSource() As PersonalTitleRecord () + Get + Return Me._DataSource + End Get + Set(ByVal value() As PersonalTitleRecord) + Me._DataSource = value + End Set + End Property + +#Region "Helper Properties" + + Public ReadOnly Property AssLabel1() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "AssLabel1"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property CommandDateLabel3() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "CommandDateLabel3"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property CommandLabel2() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "CommandLabel2"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property DeptLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "DeptLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property PersonalTitleAddButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalTitleAddButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalTitleDeleteButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalTitleDeleteButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalTitlePagination() As Persons.UI.IPagination + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalTitlePagination"), Persons.UI.IPagination) + End Get + End Property + + Public ReadOnly Property PersonalTitleResetButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalTitleResetButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalTitleTableControlCollapsibleRegion() As System.Web.UI.WebControls.Panel + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalTitleTableControlCollapsibleRegion"), System.Web.UI.WebControls.Panel) + End Get + End Property + + Public ReadOnly Property PersonalTitleToggleAll() As System.Web.UI.WebControls.CheckBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalTitleToggleAll"), System.Web.UI.WebControls.CheckBox) + End Get + End Property + + Public ReadOnly Property SkillNoLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "SkillNoLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property TitleDateLabel1() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "TitleDateLabel1"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property TitleLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "TitleLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property TitleRankLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "TitleRankLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + +#End Region + +#Region "Helper Functions" + + Public Overrides Overloads Function ModifyRedirectUrl(url As String, arg As String, ByVal bEncrypt As Boolean) As String + Return Me.Page.EvaluateExpressions(url, arg, bEncrypt, Me) + End Function + + Public Overrides Overloads Function EvaluateExpressions(url As String, arg As String, ByVal bEncrypt As Boolean) As String + Dim needToProcess As Boolean = AreAnyUrlParametersForMe(url, arg) + If (needToProcess) Then + Dim recCtl As PersonalTitleTableControlRow = Me.GetSelectedRecordControl() + If recCtl Is Nothing AndAlso url.IndexOf("{") >= 0 Then + ' Localization. + Throw New Exception(Page.GetResourceValue("Err:NoRecSelected", "Persons")) + End If + Dim rec As PersonalTitleRecord = Nothing + If recCtl IsNot Nothing Then + rec = recCtl.GetRecord() + End If + Return EvaluateExpressions(url, arg, rec, bEncrypt) + End If + Return url + End Function + + Public Overridable Function GetSelectedRecordIndex() As Integer + Dim counter As Integer = 0 + Dim recControl As PersonalTitleTableControlRow + For Each recControl In Me.GetRecordControls() + If recControl.PersonalTitleRecordRowSelection.Checked Then + Return counter + End If + counter += 1 + Next + Return -1 + End Function + + Public Overridable Function GetSelectedRecordControl() As PersonalTitleTableControlRow + Dim selectedList() As PersonalTitleTableControlRow = Me.GetSelectedRecordControls() + If selectedList.Length = 0 Then + Return Nothing + End If + Return selectedList(0) + + End Function + + Public Overridable Function GetSelectedRecordControls() As PersonalTitleTableControlRow() + + Dim selectedList As ArrayList = New ArrayList(25) + Dim recControl As PersonalTitleTableControlRow + For Each recControl In Me.GetRecordControls() + If recControl.PersonalTitleRecordRowSelection IsNot Nothing AndAlso recControl.PersonalTitleRecordRowSelection.Checked Then + selectedList.Add(recControl) + End If + Next + Return DirectCast(selectedList.ToArray(GetType(PersonalTitleTableControlRow)), PersonalTitleTableControlRow()) + + End Function + + Public Overridable Sub DeleteSelectedRecords(ByVal deferDeletion As Boolean) + Dim recList() As PersonalTitleTableControlRow = Me.GetSelectedRecordControls() + If recList.Length = 0 Then + ' Localization. + Throw New Exception(Page.GetResourceValue("Err:NoRecSelected", "Persons")) + End If + + Dim recCtl As PersonalTitleTableControlRow + For Each recCtl In recList + If deferDeletion Then + If Not recCtl.IsNewRecord Then + + Me.AddToDeletedRecordIds(recCtl) + + End If + recCtl.Visible = False + + recCtl.PersonalTitleRecordRowSelection.Checked = False + + Else + + recCtl.Delete() + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + End If + Next + End Sub + + Public Function GetRecordControls() As PersonalTitleTableControlRow() + Dim recList As ArrayList = New ArrayList() + Dim rep As System.Web.UI.WebControls.Repeater = CType(Me.FindControl("PersonalTitleTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return Nothing + Dim repItem As System.Web.UI.WebControls.RepeaterItem + + For Each repItem In rep.Items + + Dim recControl As PersonalTitleTableControlRow = DirectCast(repItem.FindControl("PersonalTitleTableControlRow"), PersonalTitleTableControlRow) + recList.Add(recControl) + + Next + + Return DirectCast(recList.ToArray(GetType(PersonalTitleTableControlRow)), PersonalTitleTableControlRow()) + End Function + + Public Shadows ReadOnly Property Page() As BaseApplicationPage + Get + Return DirectCast(MyBase.Page, BaseApplicationPage) + End Get + End Property + +#End Region + + + +End Class + + +' Base class for the PersonRelativeTableControlRow control on the AddPersonalId page. +' Do not modify this class. Instead override any method in PersonRelativeTableControlRow. +Public Class BasePersonRelativeTableControlRow + Inherits Persons.UI.BaseApplicationRecordControl + + ' To customize, override this method in PersonRelativeTableControlRow. + Protected Overridable Sub Control_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Init + + Me.ClearControlsFromSession() + End Sub + + ' To customize, override this method in PersonRelativeTableControlRow. + Protected Overridable Sub Control_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load + + 'Call LoadFocusScripts from repeater so that onfocus attribute could be added to elements + Me.Page.LoadFocusScripts(Me) + + ' Show confirmation message on Click + Me.PersonRelativeRowDeleteButton.Attributes.Add("onClick", "return (confirm('" & (CType(Me.Page,BaseApplicationPage)).GetResourceValue("DeleteRecordConfirm", "Persons") & "'));") + + + ' Register the event handlers. + + AddHandler Me.PersonRelativeRowDeleteButton.Click, AddressOf PersonRelativeRowDeleteButton_Click + + 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.Ref4.TextChanged, AddressOf Ref4_TextChanged + + AddHandler Me.RefDate2.TextChanged, AddressOf RefDate2_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 + + ' Since this is a row in the table, the data for this row is loaded by the + ' LoadData method of the BasePersonRelativeTableControl when the data for the entire + ' table is loaded. + + Me.DataSource = New PersonRelativeRecord() + + + + End Sub + + ' Populate the UI controls using the DataSource. To customize, override this method in PersonRelativeTableControlRow. + 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() + SetFName() + SetMLastName() + SetMName() + SetMOrLastName() + + + SetRAddress() + SetRAmphur() + SetRBirthDate() + SetRef4() + SetRefDate2() + SetRelationId() + SetRFirstName() + SetRLastName() + SetRNationality() + SetROrigin() + SetROrLastName() + SetRPreName() + SetRProvince() + SetRReligion() + SetRRemark() + SetRStatus() + SetRStatusDate() + SetRStatusRef() + + + 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() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.FLastName.ID) Then + + Me.FLastName.Text = Me.PreviousUIData(Me.FLastName.ID).ToString() + + Return + End If + + + ' 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() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.FName.ID) Then + + Me.FName.Text = Me.PreviousUIData(Me.FName.ID).ToString() + + Return + End If + + + ' 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() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.MLastName.ID) Then + + Me.MLastName.Text = Me.PreviousUIData(Me.MLastName.ID).ToString() + + Return + End If + + + ' 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() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.MName.ID) Then + + Me.MName.Text = Me.PreviousUIData(Me.MName.ID).ToString() + + Return + End If + + + ' 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() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.MOrLastName.ID) Then + + Me.MOrLastName.Text = Me.PreviousUIData(Me.MOrLastName.ID).ToString() + + Return + End If + + + ' 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() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.RAddress.ID) Then + + Me.RAddress.Text = Me.PreviousUIData(Me.RAddress.ID).ToString() + + Return + End If + + + ' 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() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.RAmphur.ID) Then + + Me.RAmphur.Text = Me.PreviousUIData(Me.RAmphur.ID).ToString() + + Return + End If + + + ' 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() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.RBirthDate.ID) Then + + Me.RBirthDate.Text = Me.PreviousUIData(Me.RBirthDate.ID).ToString() + + Return + End If + + + ' 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 SetRef4() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.Ref4.ID) Then + + Me.Ref4.Text = Me.PreviousUIData(Me.Ref4.ID).ToString() + + Return + End If + + + ' 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.Ref4 is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetRef4() + ' 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.Ref4.Text = formattedValue + + Else + + ' Ref is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.Ref4.Text = PersonRelativeTable.Ref0.Format(PersonRelativeTable.Ref0.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetRefDate2() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.RefDate2.ID) Then + + Me.RefDate2.Text = Me.PreviousUIData(Me.RefDate2.ID).ToString() + + Return + End If + + + ' 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.RefDate2 is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetRefDate2() + ' 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.RefDate2.Text = formattedValue + + Else + + ' RefDate is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.RefDate2.Text = PersonRelativeTable.RefDate.Format(PersonRelativeTable.RefDate.DefaultValue, "d MMM yy") + + End If + + End Sub + + Public Overridable Sub SetRelationId() + + ' If selection was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.RelationId.ID) Then + If Me.PreviousUIData(Me.RelationId.ID) Is Nothing + Me.PopulateRelationIdDropDownList(Nothing, 100) + Else + Me.PopulateRelationIdDropDownList(Me.PreviousUIData(Me.RelationId.ID).ToString(), 100) + End If + Return + End If + + + ' 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() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.RFirstName.ID) Then + + Me.RFirstName.Text = Me.PreviousUIData(Me.RFirstName.ID).ToString() + + Return + End If + + + ' 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() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.RLastName.ID) Then + + Me.RLastName.Text = Me.PreviousUIData(Me.RLastName.ID).ToString() + + Return + End If + + + ' 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() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.RNationality.ID) Then + + Me.RNationality.Text = Me.PreviousUIData(Me.RNationality.ID).ToString() + + Return + End If + + + ' 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() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.ROrigin.ID) Then + + Me.ROrigin.Text = Me.PreviousUIData(Me.ROrigin.ID).ToString() + + Return + End If + + + ' 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() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.ROrLastName.ID) Then + + Me.ROrLastName.Text = Me.PreviousUIData(Me.ROrLastName.ID).ToString() + + Return + End If + + + ' 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() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.RPreName.ID) Then + + Me.RPreName.Text = Me.PreviousUIData(Me.RPreName.ID).ToString() + + Return + End If + + + ' 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() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.RProvince.ID) Then + + Me.RProvince.Text = Me.PreviousUIData(Me.RProvince.ID).ToString() + + Return + End If + + + ' 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() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.RReligion.ID) Then + + Me.RReligion.Text = Me.PreviousUIData(Me.RReligion.ID).ToString() + + Return + End If + + + ' 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() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.RRemark.ID) Then + + Me.RRemark.Text = Me.PreviousUIData(Me.RRemark.ID).ToString() + + Return + End If + + + ' 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() + + ' If selection was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.RStatus.ID) Then + If Me.PreviousUIData(Me.RStatus.ID) Is Nothing + Me.PopulateRStatusDropDownList(Nothing, 100) + Else + Me.PopulateRStatusDropDownList(Me.PreviousUIData(Me.RStatus.ID).ToString(), 100) + End If + Return + End If + + + ' 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() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.RStatusDate.ID) Then + + Me.RStatusDate.Text = Me.PreviousUIData(Me.RStatusDate.ID).ToString() + + Return + End If + + + ' 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() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.RStatusRef.ID) Then + + Me.RStatusRef.Text = Me.PreviousUIData(Me.RStatusRef.ID).ToString() + + Return + End If + + + ' 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 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 PersonRelativeTableControlRow. + 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 parentCtrl As PersonalIdRecordControl + + + parentCtrl = DirectCast(Me.Page.FindControlRecursively("PersonalIdRecordControl"), PersonalIdRecordControl) + + If (Not IsNothing(parentCtrl) AndAlso IsNothing(parentCtrl.DataSource)) + ' Load the record if it is not loaded yet. + parentCtrl.LoadData() + End If + If (IsNothing(parentCtrl) OrElse IsNothing(parentCtrl.DataSource)) + ' Get the error message from the application resource file. + Throw New Exception(Page.GetResourceValue("Err:NoParentRecId", "Persons")) + End If + + Me.DataSource.PersonalId = parentCtrl.DataSource.PersonalId + + ' 2. Perform any custom validation. + Me.Validate() + + + ' 3. Set the values in the record with data from UI controls. + ' This calls the Get() method for each of the user interface controls. + Me.GetUIData() + + ' 4. Save in the database. + ' We should not save the record if the data did not change. This + ' will save a database hit and avoid triggering any database triggers. + + If Me.DataSource.IsAnyValueChanged Then + ' Save record to database but do not commit yet. + ' Auto generated ids are available after saving for use by child (dependent) records. + Me.DataSource.Save() + + DirectCast(GetParentControlObject(Me, "PersonRelativeTableControl"), PersonRelativeTableControl).DataChanged = True + DirectCast(GetParentControlObject(Me, "PersonRelativeTableControl"), PersonRelativeTableControl).ResetData = True + End If + + + ' update session or cookie by formula + + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + ' For Master-Detail relationships, save data on the Detail table(s) + + End Sub + + ' To customize, override this method in PersonRelativeTableControlRow. + 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() + GetRef4() + GetRefDate2() + 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 GetRef4() + + ' 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.Ref4.Text, PersonRelativeTable.Ref0) + + + End Sub + + Public Overridable Sub GetRefDate2() + + ' 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.RefDate2.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 PersonRelativeTableControlRow. + + Public Overridable Function CreateWhereClause() As WhereClause + + Return Nothing + + End Function + + + + ' To customize, override this method in PersonRelativeTableControlRow. + 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) + + DirectCast(GetParentControlObject(Me, "PersonRelativeTableControl"), PersonRelativeTableControl).DataChanged = True + DirectCast(GetParentControlObject(Me, "PersonRelativeTableControl"), PersonRelativeTableControl).ResetData = True + End Sub + + Protected Overridable Sub Control_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.PreRender + ' PreRender event is raised just before page is being displayed. + Try + DbUtils.StartTransaction() + Me.RegisterPostback() + + If Not Me.Page.ErrorOnPage AndAlso (Me.Page.IsPageRefresh OrElse Me.DataChanged OrElse Me.ResetData) Then + + + ' Re-load the data and update the web page if necessary. + ' This is typically done during a postback (filter, search button, sort, pagination button). + ' In each of the other click handlers, simply set DataChanged to True to reload the data. + Me.LoadData() + Me.DataBind() + End If + + + Catch ex As Exception + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + Finally + DbUtils.EndTransaction() + End Try + End Sub + + + Protected Overrides Sub SaveControlsToSession() + MyBase.SaveControlsToSession() + + + 'Save pagination state to session. + + End Sub + + + + Protected Overrides Sub ClearControlsFromSession() + MyBase.ClearControlsFromSession() + + + + ' Clear pagination state from session. + + End Sub + + Protected Overrides Sub LoadViewState(ByVal savedState As Object) + MyBase.LoadViewState(savedState) + Dim isNewRecord As String = CType(ViewState("IsNewRecord"), String) + If Not isNewRecord Is Nothing AndAlso isNewRecord.Trim <> "" Then + Me.IsNewRecord = Boolean.Parse(isNewRecord) + End If + + Dim myCheckSum As String = CType(ViewState("CheckSum"), String) + If Not myCheckSum Is Nothing AndAlso myCheckSum.Trim <> "" Then + Me.CheckSum = myCheckSum + End If + + + ' Load view state for pagination control. + + End Sub + + Protected Overrides Function SaveViewState() As Object + ViewState("IsNewRecord") = Me.IsNewRecord.ToString() + ViewState("CheckSum") = Me.CheckSum + + + ' Load view state for pagination control. + + Return MyBase.SaveViewState() + End Function + + + + 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 + + ' event handler for ImageButton + Public Overridable Sub PersonRelativeRowDeleteButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + If(Not Me.Page.IsPageRefresh) Then + + Dim tc As PersonRelativeTableControl = DirectCast(GetParentControlObject(Me, "PersonRelativeTableControl"), PersonRelativeTableControl) + If Not (IsNothing(tc)) Then + If Not Me.IsNewRecord Then + tc.AddToDeletedRecordIds(DirectCast(Me, PersonRelativeTableControlRow)) + End If + Me.Visible = False + tc.SetFormulaControls() + End If + + End If + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + 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 Ref4_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub RefDate2_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("BasePersonRelativeTableControlRow_Rec"), String) + End Get + Set(ByVal value As String) + Me.ViewState("BasePersonRelativeTableControlRow_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 _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 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 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 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 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 PersonRelativeRecordRowSelection() As System.Web.UI.WebControls.CheckBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonRelativeRecordRowSelection"), System.Web.UI.WebControls.CheckBox) + End Get + End Property + + Public ReadOnly Property PersonRelativeRowDeleteButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonRelativeRowDeleteButton"), System.Web.UI.WebControls.ImageButton) + 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 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 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 Ref4() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Ref4"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property RefDate2() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RefDate2"), System.Web.UI.WebControls.TextBox) + 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 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 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 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 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 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 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 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 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 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 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 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 + +#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. + + Return Nothing + + End Function + + Public Shadows ReadOnly Property Page() As BaseApplicationPage + Get + Return DirectCast(MyBase.Page, BaseApplicationPage) + End Get + End Property + +#End Region + +End Class + + + +' Base class for the PersonRelativeTableControl control on the AddPersonalId page. +' Do not modify this class. Instead override any method in PersonRelativeTableControl. +Public Class BasePersonRelativeTableControl + Inherits Persons.UI.BaseApplicationTableControl + + + + Protected Overridable Sub Control_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Init + + + + ' Setup the filter and search events. + + + + ' Control Initializations. + ' Initialize the table's current sort order. + + If Me.InSession(Me, "Order_By") Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + End If + + + + ' Setup default pagination settings. + + Me.PageSize = CInt(Me.GetFromSession(Me, "Page_Size", "10")) + Me.PageIndex = CInt(Me.GetFromSession(Me, "Page_Index", "0")) + + + + Me.ClearControlsFromSession() + End Sub + + Protected Overridable Sub Control_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load + + SaveControlsToSession_Ajax() + + ' Show confirmation message on Click + Me.PersonRelativeDeleteButton.Attributes.Add("onClick", "return (confirm('" & (CType(Me.Page,BaseApplicationPage)).GetResourceValue("DeleteConfirm", "Persons") & "'));") + + ' Setup the pagination events. + + AddHandler Me.PersonRelativePagination.FirstPage.Click, AddressOf PersonRelativePagination_FirstPage_Click + + AddHandler Me.PersonRelativePagination.LastPage.Click, AddressOf PersonRelativePagination_LastPage_Click + + AddHandler Me.PersonRelativePagination.NextPage.Click, AddressOf PersonRelativePagination_NextPage_Click + + AddHandler Me.PersonRelativePagination.PageSizeButton.Click, AddressOf PersonRelativePagination_PageSizeButton_Click + + AddHandler Me.PersonRelativePagination.PreviousPage.Click, AddressOf PersonRelativePagination_PreviousPage_Click + + + ' Setup the sorting events. + + AddHandler Me.FLastNameLabel.Click, AddressOf FLastNameLabel_Click + + AddHandler Me.FNameLabel.Click, AddressOf FNameLabel_Click + + AddHandler Me.MLastNameLabel.Click, AddressOf MLastNameLabel_Click + + AddHandler Me.MNameLabel.Click, AddressOf MNameLabel_Click + + AddHandler Me.MOrLastNameLabel.Click, AddressOf MOrLastNameLabel_Click + + AddHandler Me.RAddressLabel.Click, AddressOf RAddressLabel_Click + + AddHandler Me.RAmphurLabel.Click, AddressOf RAmphurLabel_Click + + AddHandler Me.RBirthDateLabel.Click, AddressOf RBirthDateLabel_Click + + AddHandler Me.RefDateLabel2.Click, AddressOf RefDateLabel2_Click + + AddHandler Me.RefLabel3.Click, AddressOf RefLabel3_Click + + AddHandler Me.RelationIdLabel1.Click, AddressOf RelationIdLabel1_Click + + AddHandler Me.RFirstNameLabel.Click, AddressOf RFirstNameLabel_Click + + AddHandler Me.RLastNameLabel.Click, AddressOf RLastNameLabel_Click + + AddHandler Me.RNationalityLabel.Click, AddressOf RNationalityLabel_Click + + AddHandler Me.ROriginLabel.Click, AddressOf ROriginLabel_Click + + AddHandler Me.ROrLastNameLabel.Click, AddressOf ROrLastNameLabel_Click + + AddHandler Me.RPreNameLabel.Click, AddressOf RPreNameLabel_Click + + AddHandler Me.RProvinceLabel.Click, AddressOf RProvinceLabel_Click + + AddHandler Me.RReligionLabel.Click, AddressOf RReligionLabel_Click + + AddHandler Me.RRemarkLabel.Click, AddressOf RRemarkLabel_Click + + AddHandler Me.RStatusDateLabel.Click, AddressOf RStatusDateLabel_Click + + AddHandler Me.RStatusLabel1.Click, AddressOf RStatusLabel1_Click + + AddHandler Me.RStatusRefLabel.Click, AddressOf RStatusRefLabel_Click + + ' Setup the button events. + + AddHandler Me.PersonRelativeAddButton.Click, AddressOf PersonRelativeAddButton_Click + + AddHandler Me.PersonRelativeDeleteButton.Click, AddressOf PersonRelativeDeleteButton_Click + + AddHandler Me.PersonRelativeResetButton.Click, AddressOf PersonRelativeResetButton_Click + + + ' Setup events for others + + End Sub + + + Public Overridable Sub LoadData() + + ' Read data from database. Returns an array of records that can be assigned + ' to the DataSource table control property. + Try + Dim joinFilter As CompoundFilter = CreateCompoundJoinFilter() + + ' The WHERE clause will be empty when displaying all records in table. + Dim wc As WhereClause = CreateWhereClause() + If wc IsNot Nothing AndAlso Not wc.RunQuery Then + ' Initialize an empty array of records + Dim alist As New ArrayList(0) + Me.DataSource = DirectCast(alist.ToArray(GetType(PersonRelativeRecord)), PersonRelativeRecord()) + ' Add records to the list if needed. + Me.AddNewRecords() + Me._TotalRecords = 0 + Me._TotalPages = 0 + Return + End If + + ' Call OrderBy to determine the order - either use the order defined + ' on the Query Wizard, or specified by user (by clicking on column heading) + Dim orderBy As OrderBy = CreateOrderBy() + + ' Get the pagesize from the pagesize control. + Me.GetPageSize() + + If Me.DisplayLastPage Then + Dim totalRecords As Integer = If(Me._TotalRecords < 0, PersonRelativeTable.GetRecordCount(CreateCompoundJoinFilter(), CreateWhereClause()), Me._TotalRecords) + + Dim totalPages As Integer = CInt(Math.Ceiling(totalRecords / Me.PageSize)) + + Me.PageIndex = totalPages - 1 + End If + + ' Make sure PageIndex (current page) and PageSize are within bounds. + If Me.PageIndex < 0 Then + Me.PageIndex = 0 + End If + If Me.PageSize < 1 Then + Me.PageSize = 1 + End If + + ' Retrieve the records and set the table DataSource. + ' Only PageSize records are fetched starting at PageIndex (zero based). + If Me.AddNewRecord > 0 Then + ' Make sure to preserve the previously entered data on new rows. + Dim postdata As New ArrayList + For Each rc As PersonRelativeTableControlRow In Me.GetRecordControls() + If Not rc.IsNewRecord Then + rc.DataSource = rc.GetRecord() + rc.GetUIData() + postdata.Add(rc.DataSource) + UIData.Add(rc.PreservedUIData()) + End If + Next + Me.DataSource = DirectCast(postdata.ToArray(GetType(PersonRelativeRecord)), PersonRelativeRecord()) + Else ' Get the records from the database + Me.DataSource = PersonRelativeTable.GetRecords(joinFilter, wc, orderBy, Me.PageIndex, Me.PageSize) + + End If + + ' if the datasource contains no records contained in database, then load the last page. + If (DbUtils.GetCreatedRecords(Me.DataSource).Length = 0 AndAlso Not Me.DisplayLastPage) Then + Me.DisplayLastPage = True + LoadData() + Else + + ' Add any new rows desired by the user. + Me.AddNewRecords() + + ' Turn off the ToggleAll checkbox + Me.PersonRelativeToggleAll.Checked = False + + + ' Initialize the page and grand totals. now + + End If + + Catch ex As Exception + ' Report the error message to the end user + Dim msg As String = ex.Message + If ex.InnerException IsNot Nothing Then + msg = msg & " InnerException: " & ex.InnerException.Message + End If + Throw New Exception(msg, ex.InnerException) + End Try + End Sub + + + + + Public Overrides Sub DataBind() + ' The DataBind method binds the user interface controls to the values + ' from the database record for each row in the table. To do this, it calls the + ' DataBind for each of the rows. + ' DataBind also populates any filters above the table, and sets the pagination + ' control to the correct number of records and the current page number. + + MyBase.DataBind() + + ' Make sure that the DataSource is initialized. + If Me.DataSource Is Nothing Then + Return + End If + + 'LoadData for DataSource for chart and report if they exist + + ' Improve performance by prefetching display as records. + Me.PreFetchForeignKeyValues() + + ' Setup the pagination controls. + BindPaginationControls() + + + + ' Bind the repeater with the list of records to expand the UI. + Dim rep As System.Web.UI.WebControls.Repeater = CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonRelativeTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return + rep.DataSource = DataSource() + rep.DataBind() + + Dim index As Integer = 0 + For Each repItem As System.Web.UI.WebControls.RepeaterItem In rep.Items + ' Loop through all rows in the table, set its DataSource and call DataBind(). + Dim recControl As PersonRelativeTableControlRow = DirectCast(repItem.FindControl("PersonRelativeTableControlRow"), PersonRelativeTableControlRow) + recControl.DataSource = Me.DataSource(index) + If Me.UIData.Count > index Then + recControl.PreviousUIData = Me.UIData(index) + End If + recControl.DataBind() + recControl.Visible = Not Me.InDeletedRecordIds(recControl) + + index += 1 + Next + + + + + ' Call the Set methods for each controls on the panel + + SetFLastNameLabel() + SetFNameLabel() + SetMLastNameLabel() + SetMNameLabel() + SetMOrLastNameLabel() + + + + + SetPersonRelativeTableControlCollapsibleRegion() + + SetRAddressLabel() + SetRAmphurLabel() + SetRBirthDateLabel() + SetRefDateLabel2() + SetRefLabel3() + SetRelationIdLabel1() + SetRFirstNameLabel() + SetRLastNameLabel() + SetRNationalityLabel() + SetROriginLabel() + SetROrLastNameLabel() + SetRPreNameLabel() + SetRProvinceLabel() + SetRReligionLabel() + SetRRemarkLabel() + SetRStatusDateLabel() + SetRStatusLabel1() + SetRStatusRefLabel() + ' setting the state of expand or collapse alternative rows + + + ' Load data for each record and table UI control. + ' Ordering is important because child controls get + ' their parent ids from their parent UI controls. + + + ' this method calls the set method for controls with special formula like running total, sum, rank, etc + SetFormulaControls() + End Sub + + Public Overridable Sub SetFormulaControls() + ' this method calls Set methods for the control that has special formula + + + + End Sub + + + Public Sub PreFetchForeignKeyValues() + If (IsNothing(Me.DataSource)) + Return + End If + + Me.Page.PregetDfkaRecords(PersonRelativeTable.RelationId, Me.DataSource) + + Me.Page.PregetDfkaRecords(PersonRelativeTable.RStatus, Me.DataSource) + + End Sub + + + Public Overridable Sub RegisterPostback() + + + End Sub + + Public EvaluateFormulaDelegate As BaseClasses.Data.DataSource.EvaluateFormulaDelegate = New BaseClasses.Data.DataSource.EvaluateFormulaDelegate(AddressOf Me.EvaluateFormula) + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean, ByVal e as FormulaEvaluator) As String + If e Is Nothing + e = New FormulaEvaluator() + End If + + e.Variables.Clear() + + + ' add variables for formula evaluation + If variables IsNot Nothing Then + Dim enumerator As System.Collections.Generic.IEnumerator(Of System.Collections.Generic.KeyValuePair(Of String, Object)) = variables.GetEnumerator() + While enumerator.MoveNext() + e.Variables.Add(enumerator.Current.Key, enumerator.Current.Value) + End While + End If + + If includeDS + + End If + + ' All variables referred to in the formula are expected to be + ' properties of the DataSource. For example, referring to + ' UnitPrice as a variable will refer to DataSource.UnitPrice + e.DataSource = dataSourceForEvaluate + + ' Define the calling control. This is used to add other + ' related table and record controls as variables. + e.CallingControl = Me + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + + If Not String.IsNullOrEmpty(format) AndAlso (String.IsNullOrEmpty(formula) OrElse formula.IndexOf("Format(") < 0) Then + Return FormulaUtils.Format(resultObj, format) + Else + Return resultObj.ToString() + End If + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format,variables ,includeDS, Nothing) + End Function + + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object)) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format, variables ,True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, format, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal e as FormulaEvaluator) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, variables, True, e) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal includeDS as Boolean) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, includeDS, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, True, Nothing) + End Function + + + + + Public Overridable Sub ResetControl() + + Me.CurrentSortOrder.Reset() + If (Me.InSession(Me, "Order_By")) Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + End If + + Me.PageIndex = 0 + End Sub + + Protected Overridable Sub BindPaginationControls() + ' Setup the pagination controls. + + ' Bind the pagination labels. + + If DbUtils.GetCreatedRecords(Me.DataSource).Length > 0 Then + + Me.PersonRelativePagination.CurrentPage.Text = (Me.PageIndex + 1).ToString() + Else + Me.PersonRelativePagination.CurrentPage.Text = "0" + End If + Me.PersonRelativePagination.PageSize.Text = Me.PageSize.ToString() + Me.PersonRelativePagination.TotalItems.Text = Me.TotalRecords.ToString() + Me.PersonRelativePagination.TotalPages.Text = Me.TotalPages.ToString() + + ' Bind the buttons for PersonRelativeTableControl pagination. + + Me.PersonRelativePagination.FirstPage.Enabled = Not (Me.PageIndex = 0) + If Me._TotalPages < 0 Then ' if the total pages is not determined yet, enable last and next buttons + Me.PersonRelativePagination.LastPage.Enabled = True + ElseIf Me._TotalPages = 0 ' if the total pages is determined and it is 0, enable last and next buttons + Me.PersonRelativePagination.LastPage.Enabled = False + Else ' if the total pages is the last page, disable last and next buttons + Me.PersonRelativePagination.LastPage.Enabled = Not (Me.PageIndex = Me.TotalPages - 1) + End If + + If Me._TotalPages < 0 Then ' if the total pages is not determined yet, enable last and next buttons + Me.PersonRelativePagination.NextPage.Enabled = True + ElseIf Me._TotalPages = 0 ' if the total pages is determined and it is 0, enable last and next buttons + Me.PersonRelativePagination.NextPage.Enabled = False + Else ' if the total pages is the last page, disable last and next buttons + Me.PersonRelativePagination.NextPage.Enabled = Not (Me.PageIndex = Me.TotalPages - 1) + End If + + Me.PersonRelativePagination.PreviousPage.Enabled = Not (Me.PageIndex = 0) + + + End Sub + + Public Overridable Sub SaveData() + ' Save the data from the entire table. Calls each row's Save Data + ' to save their data. This function is called by the Click handler of the + ' Save button. The button handler should Start/Commit/End a transaction. + + Dim recCtl As PersonRelativeTableControlRow + For Each recCtl In Me.GetRecordControls() + + If Me.InDeletedRecordIds(recCtl) Then + ' Delete any pending deletes. + recCtl.Delete() + Else + If recCtl.Visible Then + recCtl.SaveData() + End If + End If + + Next + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + ' Set IsNewRecord to False for all records - since everything has been saved and is no longer "new" + For Each recCtl In Me.GetRecordControls() + recCtl.IsNewRecord = False + Next + + + ' Set DeletedRecordsIds to Nothing since we have deleted all pending deletes. + Me.DeletedRecordIds = Nothing + + End Sub + + Public Overridable Function CreateCompoundJoinFilter() As CompoundFilter + Dim jFilter As CompoundFilter = New CompoundFilter() + + Return jFilter + + End Function + + + Public Overridable Function CreateOrderBy() As OrderBy + ' The CurrentSortOrder is initialized to the sort order on the + ' Query Wizard. It may be modified by the Click handler for any of + ' the column heading to sort or reverse sort by that column. + ' You can add your own sort order, or modify it on the Query Wizard. + Return Me.CurrentSortOrder + End Function + + Public Overridable Function CreateWhereClause() As WhereClause + 'This CreateWhereClause is used for loading the data. + 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 search criteria. + ' 3. User selected filter criteria. + + + Dim selectedRecordKeyValue as KeyValue = New KeyValue() + + Dim personalIdRecordControlObj As Persons.UI.Controls.AddPersonalId.PersonalIdRecordControl = DirectCast(MiscUtils.FindControlRecursively(Me.Page, "PersonalIdRecordControl"), Persons.UI.Controls.AddPersonalId.PersonalIdRecordControl) + + If (Not IsNothing(personalIdRecordControlObj) AndAlso Not IsNothing(personalIdRecordControlObj.GetRecord()) AndAlso personalIdRecordControlObj.GetRecord().IsCreated AndAlso Not IsNothing(personalIdRecordControlObj.GetRecord().PersonalId)) + wc.iAND(PersonRelativeTable.PersonalId, BaseFilter.ComparisonOperator.EqualsTo, personalIdRecordControlObj.GetRecord().PersonalId.ToString()) + selectedRecordKeyValue.AddElement(PersonRelativeTable.PersonalId.InternalName, personalIdRecordControlObj.GetRecord().PersonalId.ToString()) + Else + wc.RunQuery = False + Return wc + End If + + HttpContext.Current.Session("PersonRelativeTableControlWhereClause") = selectedRecordKeyValue.ToXmlString() + + Return wc + End Function + + + Public Overridable Function CreateWhereClause(ByVal searchText as String, ByVal fromSearchControl as String, ByVal AutoTypeAheadSearch as String, ByVal AutoTypeAheadWordSeparators as String) As WhereClause + ' This CreateWhereClause is used for loading list of suggestions for Auto Type-Ahead feature. + 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 search criteria. + ' 3. User selected filter criteria. + + Dim appRelativeVirtualPath As String = CType(HttpContext.Current.Session("AppRelativeVirtualPath"), String) + + Dim selectedRecordInPersonalIdRecordControl as String = DirectCast(HttpContext.Current.Session("PersonRelativeTableControlWhereClause"), String) + + If Not selectedRecordInPersonalIdRecordControl Is Nothing AndAlso KeyValue.IsXmlKey(selectedRecordInPersonalIdRecordControl) Then + Dim selectedRecordKeyValue as KeyValue = KeyValue.XmlToKey(selectedRecordInPersonalIdRecordControl) + + If Not IsNothing(selectedRecordKeyValue) AndAlso selectedRecordKeyValue.ContainsColumn(PersonRelativeTable.PersonalId) Then + wc.iAND(PersonRelativeTable.PersonalId, BaseFilter.ComparisonOperator.EqualsTo, selectedRecordKeyValue.GetColumnValue(PersonRelativeTable.PersonalId).ToString()) + End If + + End If + + ' Adds clauses if values are selected in Filter controls which are configured in the page. + + + Return wc + End Function + + + Public Overridable Function FormatSuggestions(ByVal prefixText As String, ByVal resultItem As String, _ + ByVal columnLength As Integer, ByVal AutoTypeAheadDisplayFoundText As String, _ + ByVal autoTypeAheadSearch As String, ByVal AutoTypeAheadWordSeparators As String, _ + ByVal resultList As ArrayList) As Boolean + + 'Formats the resultItem and adds it to the list of suggestions. + Dim index As Integer = resultItem.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture).IndexOf(prefixText.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture)) + Dim itemToAdd As String = "" + Dim isFound As Boolean = False + Dim isAdded As Boolean = False + ' Get the index where prfixt is at the beginning of resultItem. If not found then, index of word which begins with prefixText. + If InvariantLCase(autoTypeAheadSearch).equals("wordsstartingwithsearchstring") And Not index = 0 Then + ' Expression to find word which contains AutoTypeAheadWordSeparators followed by prefixText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex( AutoTypeAheadWordSeparators + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + If regex1.IsMatch(resultItem) Then + index = regex1.Match(resultItem).Index + isFound = True + End If + ' If the prefixText is found immediatly after white space then starting of the word is found so don not search any further + If not resultItem(index).ToString() = " " Then + ' Expression to find beginning of the word which contains AutoTypeAheadWordSeparators followed by prefixText + Dim regex As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\\S*" + AutoTypeAheadWordSeparators + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + If regex.IsMatch(resultItem) Then + index = regex.Match(resultItem).Index + isFound = True + End If + End If + End If + + ' If autoTypeAheadSearch value is wordsstartingwithsearchstring then, extract the substring only if the prefixText is found at the + ' beginning of the resultItem (index = 0) or a word in resultItem is found starts with prefixText. + If index = 0 Or isFound Or InvariantLCase(autoTypeAheadSearch).Equals("anywhereinstring") then + If InvariantLCase(AutoTypeAheadDisplayFoundText).equals("atbeginningofmatchedstring") Then + ' Expression to find beginning of the word which contains prefixText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\\S*" + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + ' Find the beginning of the word which contains prefexText + If (StringUtils.InvariantLCase(autoTypeAheadSearch).Equals("anywhereinstring") AndAlso regex1.IsMatch(resultItem)) Then + index = regex1.Match(resultItem).Index + isFound = True + End If + ' Display string from the index till end of the string if sub string from index till end is less than columnLength value. + If Len(resultItem) - index <= columnLength Then + If index = 0 Then + itemToAdd = resultItem + Else + itemToAdd = "..." & resultItem.Substring(index, Len(resultItem) - index) + End If + Else + If index = 0 Then + itemToAdd = resultItem.Substring(index, (columnLength - 3)) & "..." + Else + 'Truncate the string to show only columnLength - 6 characters as begining and trailing "..." has to be appended. + itemToAdd = "..." & resultItem.Substring(index , columnLength - 6) & "..." + End If + End If + ElseIf InvariantLCase(AutoTypeAheadDisplayFoundText).equals("inmiddleofmatchedstring") Then + Dim subStringBeginIndex As Integer = CType(columnLength/2, Integer) + If Len(resultItem) <= columnLength Then + itemToAdd = resultItem + Else + ' Sanity check at end of the string + If index + Len(prefixText) = columnLength Then + itemToAdd = "..." & resultItem.Substring(index-columnLength,index) + ElseIf Len(resultItem) - index < subStringBeginIndex Then + ' Display string from the end till columnLength value if, index is closer to the end of the string. + itemToAdd = "..." & resultItem.Substring(Len(resultItem)-columnLength,Len(resultItem)) + ElseIf index <= subStringBeginIndex Then + ' Sanity chet at beginning of the string + itemToAdd = resultItem.Substring(0, columnLength) & "..." + Else + ' Display string containing text before the prefixText occures and text after the prefixText + itemToAdd = "..." & resultItem.Substring(index - subStringBeginIndex, columnLength) & "..." + End If + End If + ElseIf InvariantLCase(AutoTypeAheadDisplayFoundText).equals("atendofmatchedstring") Then + ' Expression to find ending of the word which contains prefexText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\s", System.Text.RegularExpressions.RegexOptions.IgnoreCase) + ' Find the ending of the word which contains prefexText + If regex1.IsMatch(resultItem, index + 1) Then + index = regex1.Match(resultItem, index + 1).Index + Else + ' If the word which contains prefexText is the last word in string, regex1.IsMatch returns false. + index = resultItem.Length + End If + If index > Len(resultItem) Then + index = Len(resultItem) + End If + ' If text from beginning of the string till index is less than columnLength value then, display string from the beginning till index. + If index <= columnLength Then + if index = Len(resultItem) Then 'Make decision to append "..." + itemToAdd = resultItem.Substring(0,index) + Else + itemToAdd = resultItem.Substring(0,index) & "..." + End If + Else + If index = Len(resultItem) Then + itemToAdd = "..." & resultItem.Substring(index - (columnLength - 3), (columnLength - 3)) + Else + 'Truncate the string to show only columnLength - 6 characters as begining and trailing "..." has to be appended. + itemToAdd = "..." & resultItem.Substring(index - (columnLength - 6), columnLength - 6) & "..." + End If + End If + End If + + ' Remove newline character from itemToAdd + Dim prefixTextIndex As Integer = itemToAdd.IndexOf(prefixText, StringComparison.CurrentCultureIgnoreCase) + ' If itemToAdd contains any newline after the search text then show text only till newline + Dim regex2 As System.Text.RegularExpressions.Regex = New System.Text.RegularExpressions.Regex("(" & vbCrLf & "|" & vbLf & ")", System.Text.RegularExpressions.RegexOptions.IgnoreCase) + Dim newLineIndexAfterPrefix As Integer = -1 + If regex2.IsMatch(itemToAdd, prefixTextIndex) Then + newLineIndexAfterPrefix = regex2.Match(itemToAdd, prefixTextIndex).Index + End If + If (newLineIndexAfterPrefix > -1) Then + If itemToAdd.EndsWith("...") Then + itemToAdd = (itemToAdd.Substring(0, newLineIndexAfterPrefix) + "...") + Else + itemToAdd = itemToAdd.Substring(0, newLineIndexAfterPrefix) + End If + End If + ' If itemToAdd contains any newline before search text then show text which comes after newline + Dim regex3 As System.Text.RegularExpressions.Regex = New System.Text.RegularExpressions.Regex("(" & vbCrLf & "|" & vbLf & ")", (System.Text.RegularExpressions.RegexOptions.IgnoreCase Or System.Text.RegularExpressions.RegexOptions.RightToLeft)) + Dim newLineIndexBeforePrefix As Integer = -1 + If regex3.IsMatch(itemToAdd, prefixTextIndex) Then + newLineIndexBeforePrefix = regex3.Match(itemToAdd, prefixTextIndex).Index + End If + If (newLineIndexBeforePrefix > -1) Then + If itemToAdd.StartsWith("...") Then + itemToAdd = ("..." + itemToAdd.Substring((newLineIndexBeforePrefix + regex3.Match(itemToAdd, prefixTextIndex).Length))) + Else + itemToAdd = itemToAdd.Substring((newLineIndexBeforePrefix + regex3.Match(itemToAdd, prefixTextIndex).Length)) + End If + End If + + If Not itemToAdd is nothing AndAlso Not resultList.Contains(itemToAdd) Then + + resultList.Add(itemToAdd) + + isAdded = true + End If + End If + Return isAdded + End Function + + + Protected Overridable Sub GetPageSize() + + If Me.PersonRelativePagination.PageSize.Text.Trim <> "" Then + Try + 'Me.PageSize = Integer.Parse(Me.PersonRelativePagination.PageSize.Text) + Catch ex As Exception + End Try + End If + End Sub + + Protected Overridable Sub AddNewRecords() + + Dim newRecordList As ArrayList = New ArrayList() + + Dim newUIDataList As System.Collections.Generic.List(Of Hashtable) = New System.Collections.Generic.List(Of Hashtable)() + + ' Loop though all the record controls and if the record control + ' does not have a unique record id set, then create a record + ' and add to the list. + If Not Me.ResetData Then + Dim rep As System.Web.UI.WebControls.Repeater = CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonRelativeTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return + + Dim repItem As System.Web.UI.WebControls.RepeaterItem + For Each repItem In rep.Items + ' Loop through all rows in the table, set its DataSource and call DataBind(). + + Dim recControl As PersonRelativeTableControlRow = DirectCast(repItem.FindControl("PersonRelativeTableControlRow"), PersonRelativeTableControlRow) + + If recControl.Visible AndAlso recControl.IsNewRecord() Then + + Dim rec As PersonRelativeRecord = New PersonRelativeRecord() + + If recControl.FLastName.Text <> "" Then + rec.Parse(recControl.FLastName.Text, PersonRelativeTable.FLastName) + End If + If recControl.FName.Text <> "" Then + rec.Parse(recControl.FName.Text, PersonRelativeTable.FName) + End If + If recControl.MLastName.Text <> "" Then + rec.Parse(recControl.MLastName.Text, PersonRelativeTable.MLastName) + End If + If recControl.MName.Text <> "" Then + rec.Parse(recControl.MName.Text, PersonRelativeTable.MName) + End If + If recControl.MOrLastName.Text <> "" Then + rec.Parse(recControl.MOrLastName.Text, PersonRelativeTable.MOrLastName) + End If + If recControl.RAddress.Text <> "" Then + rec.Parse(recControl.RAddress.Text, PersonRelativeTable.RAddress) + End If + If recControl.RAmphur.Text <> "" Then + rec.Parse(recControl.RAmphur.Text, PersonRelativeTable.RAmphur) + End If + If recControl.RBirthDate.Text <> "" Then + rec.Parse(recControl.RBirthDate.Text, PersonRelativeTable.RBirthDate) + End If + If recControl.Ref4.Text <> "" Then + rec.Parse(recControl.Ref4.Text, PersonRelativeTable.Ref0) + End If + If recControl.RefDate2.Text <> "" Then + rec.Parse(recControl.RefDate2.Text, PersonRelativeTable.RefDate) + End If + If MiscUtils.IsValueSelected(recControl.RelationId) Then + rec.Parse(recControl.RelationId.SelectedItem.Value, PersonRelativeTable.RelationId) + End If + If recControl.RFirstName.Text <> "" Then + rec.Parse(recControl.RFirstName.Text, PersonRelativeTable.RFirstName) + End If + If recControl.RLastName.Text <> "" Then + rec.Parse(recControl.RLastName.Text, PersonRelativeTable.RLastName) + End If + If recControl.RNationality.Text <> "" Then + rec.Parse(recControl.RNationality.Text, PersonRelativeTable.RNationality) + End If + If recControl.ROrigin.Text <> "" Then + rec.Parse(recControl.ROrigin.Text, PersonRelativeTable.ROrigin) + End If + If recControl.ROrLastName.Text <> "" Then + rec.Parse(recControl.ROrLastName.Text, PersonRelativeTable.ROrLastName) + End If + If recControl.RPreName.Text <> "" Then + rec.Parse(recControl.RPreName.Text, PersonRelativeTable.RPreName) + End If + If recControl.RProvince.Text <> "" Then + rec.Parse(recControl.RProvince.Text, PersonRelativeTable.RProvince) + End If + If recControl.RReligion.Text <> "" Then + rec.Parse(recControl.RReligion.Text, PersonRelativeTable.RReligion) + End If + If recControl.RRemark.Text <> "" Then + rec.Parse(recControl.RRemark.Text, PersonRelativeTable.RRemark) + End If + If MiscUtils.IsValueSelected(recControl.RStatus) Then + rec.Parse(recControl.RStatus.SelectedItem.Value, PersonRelativeTable.RStatus) + End If + If recControl.RStatusDate.Text <> "" Then + rec.Parse(recControl.RStatusDate.Text, PersonRelativeTable.RStatusDate) + End If + If recControl.RStatusRef.Text <> "" Then + rec.Parse(recControl.RStatusRef.Text, PersonRelativeTable.RStatusRef) + End If + newUIDataList.Add(recControl.PreservedUIData()) + newRecordList.Add(rec) + End If + Next + End If + + + ' Add any new record to the list. + Dim index As Integer = 0 + For index = 1 To Me.AddNewRecord + + newRecordList.Insert(0, New PersonRelativeRecord()) + newUIDataList.Insert(0, New Hashtable()) + + Next + Me.AddNewRecord = 0 + + ' Finally, add any new records to the DataSource. + If newRecordList.Count > 0 Then + + Dim finalList As ArrayList = New ArrayList(Me.DataSource) + finalList.InsertRange(0, newRecordList) + + Me.DataSource = DirectCast(finalList.ToArray(GetType(PersonRelativeRecord)), PersonRelativeRecord()) + + End If + + ' Add the existing UI data to this hash table + If newUIDataList.Count > 0 Then + Me.UIData.InsertRange(0, newUIDataList) + End If + + End Sub + + + Public Sub AddToDeletedRecordIds(ByVal rec As PersonRelativeTableControlRow) + If rec.IsNewRecord() Then + Return + End If + + If Not Me.DeletedRecordIds Is Nothing AndAlso Me.DeletedRecordIds.Trim <> "" Then + Me.DeletedRecordIds &= "," + End If + + Me.DeletedRecordIds &= "[" & rec.RecordUniqueId & "]" + End Sub + + Protected Overridable Function InDeletedRecordIds(ByVal rec As PersonRelativeTableControlRow) As Boolean + If Me.DeletedRecordIds Is Nothing OrElse Me.DeletedRecordIds.Trim = "" Then + Return False + End If + + Return Me.DeletedRecordIds.IndexOf("[" & rec.RecordUniqueId & "]") >= 0 + End Function + + Private _DeletedRecordIds As String + Public Property DeletedRecordIds() As String + Get + Return Me._DeletedRecordIds + End Get + Set(ByVal value As String) + Me._DeletedRecordIds = value + End Set + End Property + + + ' Create Set, WhereClause, and Populate Methods + + Public Overridable Sub 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 SetPersonRelativeTableControlCollapsibleRegion() + + End Sub + + Public Overridable Sub SetRAddressLabel() + + End Sub + + Public Overridable Sub SetRAmphurLabel() + + End Sub + + Public Overridable Sub SetRBirthDateLabel() + + End Sub + + Public Overridable Sub SetRefDateLabel2() + + End Sub + + Public Overridable Sub SetRefLabel3() + + End Sub + + Public Overridable Sub SetRelationIdLabel1() + + 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 SetRStatusLabel1() + + End Sub + + Public Overridable Sub SetRStatusRefLabel() + + 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. + Dim added As Boolean = Me.AddNewRecord > 0 + Me.LoadData() + Me.DataBind() + + If added Then + Me.SetFocusToAddedRow() + End If + + End If + + + + Catch ex As Exception + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + Finally + DbUtils.EndTransaction + End Try + End Sub + + 'this function sets focus to the first editable element in the new added row in the editable table + Protected Overridable Sub SetFocusToAddedRow() + Dim rep As System.Web.UI.WebControls.Repeater = CType(Me.FindControl("PersonRelativeTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing OrElse rep.Items.Count = 0 Then Return + Dim repItem As System.Web.UI.WebControls.RepeaterItem + For Each repItem In rep.Items + 'Load scripts to table rows + Me.Page.LoadFocusScripts(repItem) + Dim recControl As PersonRelativeTableControlRow = DirectCast(repItem.FindControl("PersonRelativeTableControlRow"), PersonRelativeTableControlRow) + If recControl.IsNewRecord Then + For Each field As Control In recControl.Controls + If field.Visible AndAlso Me.Page.IsControlEditable(field, False) Then + 'set focus on the first editable field in the new row + field.Focus() + Dim updPan As UpdatePanel = DirectCast(Me.Page.FindControlRecursively("UpdatePanel1"), UpdatePanel) + If Not updPan Is Nothing Then updPan.Update() + Return + End If + Next + Return + End If + Next + End Sub + + + Protected Overrides Sub SaveControlsToSession() + MyBase.SaveControlsToSession() + + ' Save filter controls to values to session. + + + 'Save pagination state to session. + + + + ' Save table control properties to the session. + If Not Me.CurrentSortOrder Is Nothing Then + Me.SaveToSession(Me, "Order_By", Me.CurrentSortOrder.ToXmlString()) + End If + + Me.SaveToSession(Me, "Page_Index", Me.PageIndex.ToString()) + Me.SaveToSession(Me, "Page_Size", Me.PageSize.ToString()) + + Me.SaveToSession(Me, "DeletedRecordIds", Me.DeletedRecordIds) + + End Sub + + Protected Sub SaveControlsToSession_Ajax() + ' Save filter controls to values to session. + + HttpContext.Current.Session("AppRelativeVirtualPath") = Me.Page.AppRelativeVirtualPath + + End Sub + + Protected Overrides Sub ClearControlsFromSession() + MyBase.ClearControlsFromSession() + + ' Clear filter controls values from the session. + + + ' Clear pagination state from session. + + + + ' Clear table properties from the session. + Me.RemoveFromSession(Me, "Order_By") + Me.RemoveFromSession(Me, "Page_Index") + Me.RemoveFromSession(Me, "Page_Size") + + Me.RemoveFromSession(Me, "DeletedRecordIds") + + End Sub + + Protected Overrides Sub LoadViewState(ByVal savedState As Object) + MyBase.LoadViewState(savedState) + + Dim orderByStr As String = CType(ViewState("PersonRelativeTableControl_OrderBy"), String) + + If orderByStr IsNot Nothing AndAlso orderByStr.Trim <> "" Then + Me.CurrentSortOrder = BaseClasses.Data.OrderBy.FromXmlString(orderByStr) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + End If + + Dim pageIndex As String = CType(ViewState("Page_Index"), String) + If pageIndex IsNot Nothing Then + Me.PageIndex = CInt(pageIndex) + End If + + Dim pageSize As String = CType(ViewState("Page_Size"), String) + If Not pageSize Is Nothing Then + Me.PageSize = CInt(pageSize) + End If + + + + ' Load view state for pagination control. + + Me.DeletedRecordIds = CType(Me.ViewState("DeletedRecordIds"), String) + + End Sub + + Protected Overrides Function SaveViewState() As Object + + If Me.CurrentSortOrder IsNot Nothing Then + Me.ViewState("PersonRelativeTableControl_OrderBy") = Me.CurrentSortOrder.ToXmlString() + End If + + Me.ViewState("Page_Index") = Me.PageIndex + Me.ViewState("Page_Size") = Me.PageSize + + Me.ViewState("DeletedRecordIds") = Me.DeletedRecordIds + + + ' Load view state for pagination control. + + + Return MyBase.SaveViewState() + End Function + + ' Generate the event handling functions for pagination events. + + ' event handler for ImageButton + Public Overridable Sub PersonRelativePagination_FirstPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.PageIndex = 0 + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonRelativePagination_LastPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.DisplayLastPage = True + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonRelativePagination_NextPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.PageIndex += 1 + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for LinkButton + Public Overridable Sub PersonRelativePagination_PageSizeButton_Click(ByVal sender As Object, ByVal args As EventArgs) + + Try + + Me.DataChanged = True + + Me.PageSize = Integer.Parse(Me.PersonRelativePagination.PageSize.Text) + + Me.PageIndex = Integer.Parse(Me.PersonRelativePagination.CurrentPage.Text) - 1 + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonRelativePagination_PreviousPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + If Me.PageIndex > 0 Then + Me.PageIndex -= 1 + Me.DataChanged = True + End If + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + + ' Generate the event handling functions for sorting events. + + Public Overridable Sub FLastNameLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by FLastName when clicked. + + ' Get previous sorting state for FLastName. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonRelativeTable.FLastName) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for FLastName. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonRelativeTable.FLastName, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by FLastName, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub FNameLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by FName when clicked. + + ' Get previous sorting state for FName. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonRelativeTable.FName) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for FName. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonRelativeTable.FName, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by FName, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub MLastNameLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by MLastName when clicked. + + ' Get previous sorting state for MLastName. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonRelativeTable.MLastName) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for MLastName. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonRelativeTable.MLastName, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by MLastName, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub MNameLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by MName when clicked. + + ' Get previous sorting state for MName. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonRelativeTable.MName) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for MName. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonRelativeTable.MName, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by MName, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub MOrLastNameLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by MOrLastName when clicked. + + ' Get previous sorting state for MOrLastName. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonRelativeTable.MOrLastName) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for MOrLastName. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonRelativeTable.MOrLastName, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by MOrLastName, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub RAddressLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by RAddress when clicked. + + ' Get previous sorting state for RAddress. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonRelativeTable.RAddress) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for RAddress. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonRelativeTable.RAddress, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by RAddress, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub RAmphurLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by RAmphur when clicked. + + ' Get previous sorting state for RAmphur. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonRelativeTable.RAmphur) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for RAmphur. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonRelativeTable.RAmphur, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by RAmphur, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub RBirthDateLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by RBirthDate when clicked. + + ' Get previous sorting state for RBirthDate. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonRelativeTable.RBirthDate) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for RBirthDate. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonRelativeTable.RBirthDate, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by RBirthDate, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub RefDateLabel2_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by RefDate when clicked. + + ' Get previous sorting state for RefDate. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonRelativeTable.RefDate) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for RefDate. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonRelativeTable.RefDate, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by RefDate, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub RefLabel3_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by Ref when clicked. + + ' Get previous sorting state for Ref. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonRelativeTable.Ref0) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for Ref. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonRelativeTable.Ref0, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by Ref, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub RelationIdLabel1_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by RelationId when clicked. + + ' Get previous sorting state for RelationId. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonRelativeTable.RelationId) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for RelationId. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonRelativeTable.RelationId, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by RelationId, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub RFirstNameLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by RFirstName when clicked. + + ' Get previous sorting state for RFirstName. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonRelativeTable.RFirstName) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for RFirstName. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonRelativeTable.RFirstName, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by RFirstName, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub RLastNameLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by RLastName when clicked. + + ' Get previous sorting state for RLastName. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonRelativeTable.RLastName) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for RLastName. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonRelativeTable.RLastName, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by RLastName, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub RNationalityLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by RNationality when clicked. + + ' Get previous sorting state for RNationality. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonRelativeTable.RNationality) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for RNationality. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonRelativeTable.RNationality, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by RNationality, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub ROriginLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by ROrigin when clicked. + + ' Get previous sorting state for ROrigin. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonRelativeTable.ROrigin) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for ROrigin. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonRelativeTable.ROrigin, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by ROrigin, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub ROrLastNameLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by ROrLastName when clicked. + + ' Get previous sorting state for ROrLastName. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonRelativeTable.ROrLastName) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for ROrLastName. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonRelativeTable.ROrLastName, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by ROrLastName, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub RPreNameLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by RPreName when clicked. + + ' Get previous sorting state for RPreName. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonRelativeTable.RPreName) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for RPreName. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonRelativeTable.RPreName, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by RPreName, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub RProvinceLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by RProvince when clicked. + + ' Get previous sorting state for RProvince. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonRelativeTable.RProvince) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for RProvince. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonRelativeTable.RProvince, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by RProvince, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub RReligionLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by RReligion when clicked. + + ' Get previous sorting state for RReligion. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonRelativeTable.RReligion) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for RReligion. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonRelativeTable.RReligion, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by RReligion, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub RRemarkLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by RRemark when clicked. + + ' Get previous sorting state for RRemark. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonRelativeTable.RRemark) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for RRemark. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonRelativeTable.RRemark, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by RRemark, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub RStatusDateLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by RStatusDate when clicked. + + ' Get previous sorting state for RStatusDate. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonRelativeTable.RStatusDate) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for RStatusDate. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonRelativeTable.RStatusDate, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by RStatusDate, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub RStatusLabel1_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by RStatus when clicked. + + ' Get previous sorting state for RStatus. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonRelativeTable.RStatus) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for RStatus. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonRelativeTable.RStatus, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by RStatus, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub RStatusRefLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by RStatusRef when clicked. + + ' Get previous sorting state for RStatusRef. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonRelativeTable.RStatusRef) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for RStatusRef. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonRelativeTable.RStatusRef, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by RStatusRef, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + + ' Generate the event handling functions for button events. + + ' event handler for ImageButton + Public Overridable Sub PersonRelativeAddButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + Me.AddNewRecord = 1 + Me.DataChanged = True + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonRelativeDeleteButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + If(Not Me.Page.IsPageRefresh) Then + + Me.DeleteSelectedRecords(True) + Me.SetFormulaControls() + + + End If + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonRelativeResetButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.CurrentSortOrder.Reset() + If Me.InSession(Me, "Order_By") Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + + End If + + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + + + ' Generate the event handling functions for filter and search events. + + + ' Generate the event handling functions for others + + + Private _UIData As New System.Collections.Generic.List(Of Hashtable) + Public Property UIData() As System.Collections.Generic.List(Of Hashtable) + Get + Return Me._UIData + End Get + Set(ByVal value As System.Collections.Generic.List(Of Hashtable)) + Me._UIData = value + End Set + End Property + + ' pagination properties + Protected _PageSize As Integer + Public Property PageSize() As Integer + Get + Return Me._PageSize + End Get + Set(ByVal value As Integer) + Me._PageSize = value + End Set + End Property + + Protected _PageIndex As Integer + Public Property PageIndex() As Integer + Get + ' Return the PageIndex + Return Me._PageIndex + End Get + Set(ByVal value As Integer) + Me._PageIndex = value + End Set + End Property + + Protected _TotalRecords As Integer = -1 + Public Property TotalRecords() As Integer + Get + If _TotalRecords < 0 + _TotalRecords = PersonRelativeTable.GetRecordCount(CreateCompoundJoinFilter(), CreateWhereClause()) + End If + Return Me._TotalRecords + End Get + Set(ByVal value As Integer) + If Me.PageSize > 0 Then + + Me.TotalPages = CInt(Math.Ceiling(value / Me.PageSize)) + + End If + Me._TotalRecords = value + End Set + End Property + + + + Protected _TotalPages As Integer = -1 + Public Property TotalPages() As Integer + Get + If _TotalPages < 0 Then + + Me.TotalPages = CInt(Math.Ceiling(TotalRecords / Me.PageSize)) + + End If + Return Me._TotalPages + End Get + Set(ByVal value As Integer) + Me._TotalPages = value + End Set + End Property + + Protected _DisplayLastPage As Boolean + Public Property DisplayLastPage() As Boolean + Get + Return Me._DisplayLastPage + End Get + Set(ByVal value As Boolean) + Me._DisplayLastPage = value + End Set + End Property + + Private _DataChanged As Boolean = False + Public Property DataChanged() As Boolean + Get + Return Me._DataChanged + End Get + Set(ByVal value As Boolean) + Me._DataChanged = value + End Set + End Property + + Private _ResetData As Boolean = False + Public Property ResetData() As Boolean + Get + Return Me._ResetData + End Get + Set(ByVal value As Boolean) + Me._ResetData = value + End Set + End Property + + Private _AddNewRecord As Integer = 0 + Public Property AddNewRecord() As Integer + Get + Return Me._AddNewRecord + End Get + Set(ByVal value As Integer) + Me._AddNewRecord = value + End Set + End Property + + + Private _CurrentSortOrder As OrderBy = Nothing + Public Property CurrentSortOrder() As OrderBy + Get + Return Me._CurrentSortOrder + End Get + Set(ByVal value As BaseClasses.Data.OrderBy) + Me._CurrentSortOrder = value + End Set + End Property + + Private _DataSource() As PersonRelativeRecord = Nothing + Public Property DataSource() As PersonRelativeRecord () + Get + Return Me._DataSource + End Get + Set(ByVal value() As PersonRelativeRecord) + Me._DataSource = value + End Set + End Property + +#Region "Helper Properties" + + Public ReadOnly Property FLastNameLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "FLastNameLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property FNameLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "FNameLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property MLastNameLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "MLastNameLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property MNameLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "MNameLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property MOrLastNameLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "MOrLastNameLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property PersonRelativeAddButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonRelativeAddButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonRelativeDeleteButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonRelativeDeleteButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonRelativePagination() As Persons.UI.IPagination + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonRelativePagination"), Persons.UI.IPagination) + End Get + End Property + + Public ReadOnly Property PersonRelativeResetButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonRelativeResetButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonRelativeTableControlCollapsibleRegion() As System.Web.UI.WebControls.Panel + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonRelativeTableControlCollapsibleRegion"), System.Web.UI.WebControls.Panel) + End Get + End Property + + Public ReadOnly Property PersonRelativeToggleAll() As System.Web.UI.WebControls.CheckBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonRelativeToggleAll"), System.Web.UI.WebControls.CheckBox) + End Get + End Property + + Public ReadOnly Property RAddressLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RAddressLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property RAmphurLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RAmphurLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property RBirthDateLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RBirthDateLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property RefDateLabel2() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RefDateLabel2"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property RefLabel3() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RefLabel3"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property RelationIdLabel1() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RelationIdLabel1"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property RFirstNameLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RFirstNameLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property RLastNameLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RLastNameLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property RNationalityLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RNationalityLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property ROriginLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "ROriginLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property ROrLastNameLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "ROrLastNameLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property RPreNameLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RPreNameLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property RProvinceLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RProvinceLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property RReligionLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RReligionLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property RRemarkLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RRemarkLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property RStatusDateLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RStatusDateLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property RStatusLabel1() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RStatusLabel1"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property RStatusRefLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RStatusRefLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + +#End Region + +#Region "Helper Functions" + + Public Overrides Overloads Function ModifyRedirectUrl(url As String, arg As String, ByVal bEncrypt As Boolean) As String + Return Me.Page.EvaluateExpressions(url, arg, bEncrypt, Me) + End Function + + Public Overrides Overloads Function EvaluateExpressions(url As String, arg As String, ByVal bEncrypt As Boolean) As String + Dim needToProcess As Boolean = AreAnyUrlParametersForMe(url, arg) + If (needToProcess) Then + Dim recCtl As PersonRelativeTableControlRow = Me.GetSelectedRecordControl() + If recCtl Is Nothing AndAlso url.IndexOf("{") >= 0 Then + ' Localization. + Throw New Exception(Page.GetResourceValue("Err:NoRecSelected", "Persons")) + End If + Dim rec As PersonRelativeRecord = Nothing + If recCtl IsNot Nothing Then + rec = recCtl.GetRecord() + End If + Return EvaluateExpressions(url, arg, rec, bEncrypt) + End If + Return url + End Function + + Public Overridable Function GetSelectedRecordIndex() As Integer + Dim counter As Integer = 0 + Dim recControl As PersonRelativeTableControlRow + For Each recControl In Me.GetRecordControls() + If recControl.PersonRelativeRecordRowSelection.Checked Then + Return counter + End If + counter += 1 + Next + Return -1 + End Function + + Public Overridable Function GetSelectedRecordControl() As PersonRelativeTableControlRow + Dim selectedList() As PersonRelativeTableControlRow = Me.GetSelectedRecordControls() + If selectedList.Length = 0 Then + Return Nothing + End If + Return selectedList(0) + + End Function + + Public Overridable Function GetSelectedRecordControls() As PersonRelativeTableControlRow() + + Dim selectedList As ArrayList = New ArrayList(25) + Dim recControl As PersonRelativeTableControlRow + For Each recControl In Me.GetRecordControls() + If recControl.PersonRelativeRecordRowSelection IsNot Nothing AndAlso recControl.PersonRelativeRecordRowSelection.Checked Then + selectedList.Add(recControl) + End If + Next + Return DirectCast(selectedList.ToArray(GetType(PersonRelativeTableControlRow)), PersonRelativeTableControlRow()) + + End Function + + Public Overridable Sub DeleteSelectedRecords(ByVal deferDeletion As Boolean) + Dim recList() As PersonRelativeTableControlRow = Me.GetSelectedRecordControls() + If recList.Length = 0 Then + ' Localization. + Throw New Exception(Page.GetResourceValue("Err:NoRecSelected", "Persons")) + End If + + Dim recCtl As PersonRelativeTableControlRow + For Each recCtl In recList + If deferDeletion Then + If Not recCtl.IsNewRecord Then + + Me.AddToDeletedRecordIds(recCtl) + + End If + recCtl.Visible = False + + recCtl.PersonRelativeRecordRowSelection.Checked = False + + Else + + recCtl.Delete() + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + End If + Next + End Sub + + Public Function GetRecordControls() As PersonRelativeTableControlRow() + Dim recList As ArrayList = New ArrayList() + Dim rep As System.Web.UI.WebControls.Repeater = CType(Me.FindControl("PersonRelativeTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return Nothing + Dim repItem As System.Web.UI.WebControls.RepeaterItem + + For Each repItem In rep.Items + + Dim recControl As PersonRelativeTableControlRow = DirectCast(repItem.FindControl("PersonRelativeTableControlRow"), PersonRelativeTableControlRow) + recList.Add(recControl) + + Next + + Return DirectCast(recList.ToArray(GetType(PersonRelativeTableControlRow)), PersonRelativeTableControlRow()) + End Function + + Public Shadows ReadOnly Property Page() As BaseApplicationPage + Get + Return DirectCast(MyBase.Page, BaseApplicationPage) + End Get + End Property + +#End Region + + + +End Class + + +' Base class for the ShowPersonalIdTableTableControlRow control on the AddPersonalId page. +' Do not modify this class. Instead override any method in ShowPersonalIdTableTableControlRow. +Public Class BaseShowPersonalIdTableTableControlRow + Inherits Persons.UI.BaseApplicationRecordControl + + ' To customize, override this method in ShowPersonalIdTableTableControlRow. + Protected Overridable Sub Control_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Init + + Me.ClearControlsFromSession() + End Sub + + ' To customize, override this method in ShowPersonalIdTableTableControlRow. + Protected Overridable Sub Control_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load + + 'Call LoadFocusScripts from repeater so that onfocus attribute could be added to elements + Me.Page.LoadFocusScripts(Me) + + + ' Register the event handlers. + + AddHandler Me.PersonalId_RankId.SelectedIndexChanged, AddressOf PersonalId_RankId_SelectedIndexChanged + + AddHandler Me.PersonalId_Addr.TextChanged, AddressOf PersonalId_Addr_TextChanged + + AddHandler Me.PersonalId_Amphur.TextChanged, AddressOf PersonalId_Amphur_TextChanged + + AddHandler Me.PersonalId_BirthDate.TextChanged, AddressOf PersonalId_BirthDate_TextChanged + + AddHandler Me.PersonalId_Born.TextChanged, AddressOf PersonalId_Born_TextChanged + + AddHandler Me.PersonalId_DateRank.TextChanged, AddressOf PersonalId_DateRank_TextChanged + + AddHandler Me.PersonalId_DeptId.TextChanged, AddressOf PersonalId_DeptId_TextChanged + + AddHandler Me.PersonalId_MobilePhone.TextChanged, AddressOf PersonalId_MobilePhone_TextChanged + + AddHandler Me.PersonalId_OfficerDate.TextChanged, AddressOf PersonalId_OfficerDate_TextChanged + + AddHandler Me.PersonalId_PersonalLastName.TextChanged, AddressOf PersonalId_PersonalLastName_TextChanged + + AddHandler Me.PersonalId_PersonalName.TextChanged, AddressOf PersonalId_PersonalName_TextChanged + + AddHandler Me.PersonalId_Province.TextChanged, AddressOf PersonalId_Province_TextChanged + + + End Sub + + + Public Overridable Sub LoadData() + + ' Load the data from the database into the DataSource ShowPersonalIdTable 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 = ShowPersonalIdTableQuery.GetRecord(Me.RecordUniqueId, True) + + Return + End If + + ' Since this is a row in the table, the data for this row is loaded by the + ' LoadData method of the BaseShowPersonalIdTableTableControl when the data for the entire + ' table is loaded. + + Me.DataSource = New ShowPersonalIdTableRecord() + + + + End Sub + + ' Populate the UI controls using the DataSource. To customize, override this method in ShowPersonalIdTableTableControlRow. + Public Overrides Sub DataBind() + ' The DataBind method binds the user interface controls to the values + ' from the database record. To do this, it calls the Set methods for + ' each of the field displayed on the webpage. It is better to make + ' changes in the Set methods, rather than making changes here. + + MyBase.DataBind() + + ' Make sure that the DataSource is initialized. + If Me.DataSource Is Nothing Then + + Return + End If + + + 'LoadData for DataSource for chart and report if they exist + + + + ' Call the Set methods for each controls on the panel + + SetPersonalId_Addr() + SetPersonalId_Amphur() + SetPersonalId_BirthDate() + SetPersonalId_Born() + SetPersonalId_DateRank() + SetPersonalId_DeptId() + SetPersonalId_MobilePhone() + SetPersonalId_OfficerDate() + SetPersonalId_PersonalLastName() + SetPersonalId_PersonalName() + + SetPersonalId_pictureImage() + SetPersonalId_Province() + SetPersonalId_RankId() + + + + Me.IsNewRecord = True + + If Me.DataSource.IsCreated Then + Me.IsNewRecord = False + + Me.RecordUniqueId = Me.DataSource.GetID.ToXmlString() + End If + + ' Now load data for each record and table child UI controls. + ' Ordering is important because child controls get + ' their parent ids from their parent UI controls. + Dim shouldResetControl As Boolean = False + + End Sub + + + Public Overridable Sub SetPersonalId_Addr() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.PersonalId_Addr.ID) Then + + Me.PersonalId_Addr.Text = Me.PreviousUIData(Me.PersonalId_Addr.ID).ToString() + + Return + End If + + + ' Set the PersonalId.Addr TextBox on the webpage with value from the + ' ShowPersonalIdTable database record. + + ' Me.DataSource is the ShowPersonalIdTable record retrieved from the database. + ' Me.PersonalId_Addr is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetPersonalId_Addr() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.Addr_PersonalIdSpecified Then + + ' If the PersonalId.Addr is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(ShowPersonalIdTableQuery.Addr_PersonalId) + + Me.PersonalId_Addr.Text = formattedValue + + Else + + ' PersonalId.Addr is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.PersonalId_Addr.Text = ShowPersonalIdTableQuery.Addr_PersonalId.Format(ShowPersonalIdTableQuery.Addr_PersonalId.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetPersonalId_Amphur() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.PersonalId_Amphur.ID) Then + + Me.PersonalId_Amphur.Text = Me.PreviousUIData(Me.PersonalId_Amphur.ID).ToString() + + Return + End If + + + ' Set the PersonalId.Amphur TextBox on the webpage with value from the + ' ShowPersonalIdTable database record. + + ' Me.DataSource is the ShowPersonalIdTable record retrieved from the database. + ' Me.PersonalId_Amphur is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetPersonalId_Amphur() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.Amphur_PersonalIdSpecified Then + + ' If the PersonalId.Amphur is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(ShowPersonalIdTableQuery.Amphur_PersonalId) + + Me.PersonalId_Amphur.Text = formattedValue + + Else + + ' PersonalId.Amphur is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.PersonalId_Amphur.Text = ShowPersonalIdTableQuery.Amphur_PersonalId.Format(ShowPersonalIdTableQuery.Amphur_PersonalId.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetPersonalId_BirthDate() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.PersonalId_BirthDate.ID) Then + + Me.PersonalId_BirthDate.Text = Me.PreviousUIData(Me.PersonalId_BirthDate.ID).ToString() + + Return + End If + + + ' Set the PersonalId.BirthDate TextBox on the webpage with value from the + ' ShowPersonalIdTable database record. + + ' Me.DataSource is the ShowPersonalIdTable record retrieved from the database. + ' Me.PersonalId_BirthDate is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetPersonalId_BirthDate() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.BirthDate_PersonalIdSpecified Then + + ' If the PersonalId.BirthDate is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(ShowPersonalIdTableQuery.BirthDate_PersonalId, "d MMM yy") + + Me.PersonalId_BirthDate.Text = formattedValue + + Else + + ' PersonalId.BirthDate is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.PersonalId_BirthDate.Text = ShowPersonalIdTableQuery.BirthDate_PersonalId.Format(ShowPersonalIdTableQuery.BirthDate_PersonalId.DefaultValue, "d MMM yy") + + End If + + End Sub + + Public Overridable Sub SetPersonalId_Born() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.PersonalId_Born.ID) Then + + Me.PersonalId_Born.Text = Me.PreviousUIData(Me.PersonalId_Born.ID).ToString() + + Return + End If + + + ' Set the PersonalId.Born TextBox on the webpage with value from the + ' ShowPersonalIdTable database record. + + ' Me.DataSource is the ShowPersonalIdTable record retrieved from the database. + ' Me.PersonalId_Born is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetPersonalId_Born() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.Born_PersonalIdSpecified Then + + ' If the PersonalId.Born is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(ShowPersonalIdTableQuery.Born_PersonalId) + + Me.PersonalId_Born.Text = formattedValue + + Else + + ' PersonalId.Born is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.PersonalId_Born.Text = ShowPersonalIdTableQuery.Born_PersonalId.Format(ShowPersonalIdTableQuery.Born_PersonalId.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetPersonalId_DateRank() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.PersonalId_DateRank.ID) Then + + Me.PersonalId_DateRank.Text = Me.PreviousUIData(Me.PersonalId_DateRank.ID).ToString() + + Return + End If + + + ' Set the PersonalId.DateRank TextBox on the webpage with value from the + ' ShowPersonalIdTable database record. + + ' Me.DataSource is the ShowPersonalIdTable record retrieved from the database. + ' Me.PersonalId_DateRank is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetPersonalId_DateRank() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.DateRank_PersonalIdSpecified Then + + ' If the PersonalId.DateRank is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(ShowPersonalIdTableQuery.DateRank_PersonalId, "d") + + Me.PersonalId_DateRank.Text = formattedValue + + Else + + ' PersonalId.DateRank is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.PersonalId_DateRank.Text = ShowPersonalIdTableQuery.DateRank_PersonalId.Format(ShowPersonalIdTableQuery.DateRank_PersonalId.DefaultValue, "d") + + End If + + End Sub + + Public Overridable Sub SetPersonalId_DeptId() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.PersonalId_DeptId.ID) Then + + Me.PersonalId_DeptId.Text = Me.PreviousUIData(Me.PersonalId_DeptId.ID).ToString() + + Return + End If + + + ' Set the PersonalId.DeptId TextBox on the webpage with value from the + ' ShowPersonalIdTable database record. + + ' Me.DataSource is the ShowPersonalIdTable record retrieved from the database. + ' Me.PersonalId_DeptId is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetPersonalId_DeptId() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.DeptId_PersonalIdSpecified Then + + ' If the PersonalId.DeptId is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(ShowPersonalIdTableQuery.DeptId_PersonalId) + + Me.PersonalId_DeptId.Text = formattedValue + + Else + + ' PersonalId.DeptId is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.PersonalId_DeptId.Text = ShowPersonalIdTableQuery.DeptId_PersonalId.Format(ShowPersonalIdTableQuery.DeptId_PersonalId.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetPersonalId_MobilePhone() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.PersonalId_MobilePhone.ID) Then + + Me.PersonalId_MobilePhone.Text = Me.PreviousUIData(Me.PersonalId_MobilePhone.ID).ToString() + + Return + End If + + + ' Set the PersonalId.MobilePhone TextBox on the webpage with value from the + ' ShowPersonalIdTable database record. + + ' Me.DataSource is the ShowPersonalIdTable record retrieved from the database. + ' Me.PersonalId_MobilePhone is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetPersonalId_MobilePhone() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.MobilePhone_PersonalIdSpecified Then + + ' If the PersonalId.MobilePhone is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(ShowPersonalIdTableQuery.MobilePhone_PersonalId) + + Me.PersonalId_MobilePhone.Text = formattedValue + + Else + + ' PersonalId.MobilePhone is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.PersonalId_MobilePhone.Text = ShowPersonalIdTableQuery.MobilePhone_PersonalId.Format(ShowPersonalIdTableQuery.MobilePhone_PersonalId.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetPersonalId_OfficerDate() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.PersonalId_OfficerDate.ID) Then + + Me.PersonalId_OfficerDate.Text = Me.PreviousUIData(Me.PersonalId_OfficerDate.ID).ToString() + + Return + End If + + + ' Set the PersonalId.OfficerDate TextBox on the webpage with value from the + ' ShowPersonalIdTable database record. + + ' Me.DataSource is the ShowPersonalIdTable record retrieved from the database. + ' Me.PersonalId_OfficerDate is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetPersonalId_OfficerDate() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.OfficerDate_PersonalIdSpecified Then + + ' If the PersonalId.OfficerDate is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(ShowPersonalIdTableQuery.OfficerDate_PersonalId, "d MMM yy") + + Me.PersonalId_OfficerDate.Text = formattedValue + + Else + + ' PersonalId.OfficerDate is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.PersonalId_OfficerDate.Text = ShowPersonalIdTableQuery.OfficerDate_PersonalId.Format(ShowPersonalIdTableQuery.OfficerDate_PersonalId.DefaultValue, "d MMM yy") + + End If + + End Sub + + Public Overridable Sub SetPersonalId_PersonalLastName() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.PersonalId_PersonalLastName.ID) Then + + Me.PersonalId_PersonalLastName.Text = Me.PreviousUIData(Me.PersonalId_PersonalLastName.ID).ToString() + + Return + End If + + + ' Set the PersonalId.PersonalLastName TextBox on the webpage with value from the + ' ShowPersonalIdTable database record. + + ' Me.DataSource is the ShowPersonalIdTable record retrieved from the database. + ' Me.PersonalId_PersonalLastName is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetPersonalId_PersonalLastName() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.PersonalLastName_PersonalIdSpecified Then + + ' If the PersonalId.PersonalLastName is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(ShowPersonalIdTableQuery.PersonalLastName_PersonalId) + + Me.PersonalId_PersonalLastName.Text = formattedValue + + Else + + ' PersonalId.PersonalLastName is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.PersonalId_PersonalLastName.Text = ShowPersonalIdTableQuery.PersonalLastName_PersonalId.Format(ShowPersonalIdTableQuery.PersonalLastName_PersonalId.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetPersonalId_PersonalName() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.PersonalId_PersonalName.ID) Then + + Me.PersonalId_PersonalName.Text = Me.PreviousUIData(Me.PersonalId_PersonalName.ID).ToString() + + Return + End If + + + ' Set the PersonalId.PersonalName TextBox on the webpage with value from the + ' ShowPersonalIdTable database record. + + ' Me.DataSource is the ShowPersonalIdTable record retrieved from the database. + ' Me.PersonalId_PersonalName is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetPersonalId_PersonalName() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.PersonalName_PersonalIdSpecified Then + + ' If the PersonalId.PersonalName is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(ShowPersonalIdTableQuery.PersonalName_PersonalId) + + Me.PersonalId_PersonalName.Text = formattedValue + + Else + + ' PersonalId.PersonalName is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.PersonalId_PersonalName.Text = ShowPersonalIdTableQuery.PersonalName_PersonalId.Format(ShowPersonalIdTableQuery.PersonalName_PersonalId.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetPersonalId_pictureImage() + ' Set the PersonalId.picture Image on the webpage with value from the + ' ShowPersonalIdTable database record. + + ' Me.DataSource is the ShowPersonalIdTable record retrieved from the database. + ' Me.PersonalId_pictureImage is the ASP:Image on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetPersonalId_pictureImage() + ' and add your own code before or after the call to the MyBase function. + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.picture_PersonalIdSpecified Then + + ' If the PersonalId.picture is non-NULL, then format the value. + ' The Format method will use the Display Format + Me.PersonalId_pictureImage.Attributes.Add("onclick", "gPersist=true;") + Me.PersonalId_pictureImage.Attributes.Add("onmouseout","detailRolloverPopupClose();") + + Dim name As String = HttpUtility.HtmlEncode(ShowPersonalIdTableQuery.picture_PersonalId.Name) + + If Not HttpUtility.HtmlEncode("%ISD_DEFAULT%").Equals("%ISD_DEFAULT%") Then + name = HttpUtility.HtmlEncode(Me.Page.GetResourceValue("%ISD_DEFAULT%")) + End If + + Me.PersonalId_pictureImage.Attributes.Add("onmouseover","SaveMousePosition(event);delayRolloverPopup(""PageMethods.GetImage(\""" & Me.Page.Encrypt("ShowPersonalIdTable") _ + & "\"", \""" & Me.Page.Encrypt(HttpUtility.UrlEncode(Me.DataSource.GetID().ToString())) _ + & "\"", \""" & Me.Page.Encrypt("PersonalId.picture") & "\"", \""" & NetUtils.EncodeStringForHtmlDisplay(name.Substring(0, name.Length)) & "\"", false, 200," _ + & " 300, true, PopupDisplayWindowCallBackWith20);"",500);") + + ' Shrunk image size specified by ImagePercentSize on Properties. + Me.PersonalId_pictureImage.ImageUrl = Me.DataSource.FormatImageUrl(ShowPersonalIdTableQuery.picture_PersonalId, Me.Page.Encrypt("ShowPersonalIdTable"), Me.Page.Encrypt("PersonalId.picture"), Me.Page.Encrypt(Me.DataSource.GetID().ToXmlString()), 20) + + Me.PersonalId_pictureImage.Visible = True + Else + ' PersonalId.picture is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + Me.PersonalId_pictureImage.Visible = False + End If + End Sub + + Public Overridable Sub SetPersonalId_Province() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.PersonalId_Province.ID) Then + + Me.PersonalId_Province.Text = Me.PreviousUIData(Me.PersonalId_Province.ID).ToString() + + Return + End If + + + ' Set the PersonalId.Province TextBox on the webpage with value from the + ' ShowPersonalIdTable database record. + + ' Me.DataSource is the ShowPersonalIdTable record retrieved from the database. + ' Me.PersonalId_Province is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetPersonalId_Province() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.Province_PersonalIdSpecified Then + + ' If the PersonalId.Province is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(ShowPersonalIdTableQuery.Province_PersonalId) + + Me.PersonalId_Province.Text = formattedValue + + Else + + ' PersonalId.Province is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.PersonalId_Province.Text = ShowPersonalIdTableQuery.Province_PersonalId.Format(ShowPersonalIdTableQuery.Province_PersonalId.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetPersonalId_RankId() + + ' If selection was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.PersonalId_RankId.ID) Then + If Me.PreviousUIData(Me.PersonalId_RankId.ID) Is Nothing + Me.PopulatePersonalId_RankIdDropDownList(Nothing, 100) + Else + Me.PopulatePersonalId_RankIdDropDownList(Me.PreviousUIData(Me.PersonalId_RankId.ID).ToString(), 100) + End If + Return + End If + + + ' Set the PersonalId.RankId DropDownList on the webpage with value from the + ' ShowPersonalIdTable database record. + + ' Me.DataSource is the ShowPersonalIdTable record retrieved from the database. + ' Me.PersonalId_RankId is the ASP:DropDownList on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetPersonalId_RankId() + ' and add your own code before or after the call to the MyBase function. + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.RankId_PersonalIdSpecified Then + + ' If the PersonalId.RankId is non-NULL, then format the value. + ' The Format method will use the Display Format + Me.PopulatePersonalId_RankIdDropDownList(Me.DataSource.RankId_PersonalId.ToString(), 100) + + Else + + ' PersonalId.RankId 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.PopulatePersonalId_RankIdDropDownList(Nothing, 100) + Else + Me.PopulatePersonalId_RankIdDropDownList(ShowPersonalIdTableQuery.RankId_PersonalId.DefaultValue, 100) + End If + + End If + + End Sub + + + Public EvaluateFormulaDelegate As BaseClasses.Data.DataSource.EvaluateFormulaDelegate = New BaseClasses.Data.DataSource.EvaluateFormulaDelegate(AddressOf Me.EvaluateFormula) + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean, ByVal e As FormulaEvaluator) As String + If e Is Nothing Then + e = New FormulaEvaluator() + End If + + e.Variables.Clear() + + + ' add variables for formula evaluation + If variables IsNot Nothing Then + Dim enumerator As System.Collections.Generic.IEnumerator(Of System.Collections.Generic.KeyValuePair(Of String, Object)) = variables.GetEnumerator() + While enumerator.MoveNext() + e.Variables.Add(enumerator.Current.Key, enumerator.Current.Value) + End While + End If + + If includeDS + + End IF + + + ' Other variables referred to in the formula are expected to be + ' properties of the DataSource. For example, referring to + ' UnitPrice as a variable will refer to DataSource.UnitPrice + If dataSourceForEvaluate Is Nothing Then + + e.DataSource = Me.DataSource + + Else + e.DataSource = dataSourceForEvaluate + End If + + ' Define the calling control. This is used to add other + ' related table and record controls as variables. + e.CallingControl = Me + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + + If Not String.IsNullOrEmpty(format) AndAlso (String.IsNullOrEmpty(formula) OrElse formula.IndexOf("Format(") < 0) Then + Return FormulaUtils.Format(resultObj, format) + Else + Return resultObj.ToString() + End If + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format,variables ,includeDS, Nothing) + End Function + + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object)) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format, variables ,True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, format, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal e as FormulaEvaluator) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, variables, True, e) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal includeDS as Boolean) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, includeDS, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, True, Nothing) + End Function + + + Public Overridable Sub RegisterPostback() + + + End Sub + + + + ' To customize, override this method in ShowPersonalIdTableTableControlRow. + 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 parentCtrl As PersonalIdRecordControl + + + parentCtrl = DirectCast(Me.Page.FindControlRecursively("PersonalIdRecordControl"), PersonalIdRecordControl) + + If (Not IsNothing(parentCtrl) AndAlso IsNothing(parentCtrl.DataSource)) + ' Load the record if it is not loaded yet. + parentCtrl.LoadData() + End If + If (IsNothing(parentCtrl) OrElse IsNothing(parentCtrl.DataSource)) + ' Get the error message from the application resource file. + Throw New Exception(Page.GetResourceValue("Err:NoParentRecId", "Persons")) + End If + + Me.DataSource.PersonalId_PersonalId = parentCtrl.DataSource.PersonalId + + ' 2. Perform any custom validation. + Me.Validate() + + + ' 3. Set the values in the record with data from UI controls. + ' This calls the Get() method for each of the user interface controls. + Me.GetUIData() + + ' 4. Save in the database. + ' We should not save the record if the data did not change. This + ' will save a database hit and avoid triggering any database triggers. + + If Me.DataSource.IsAnyValueChanged Then + ' Save record to database but do not commit yet. + ' Auto generated ids are available after saving for use by child (dependent) records. + Me.DataSource.Save() + + DirectCast(GetParentControlObject(Me, "ShowPersonalIdTableTableControl"), ShowPersonalIdTableTableControl).DataChanged = True + DirectCast(GetParentControlObject(Me, "ShowPersonalIdTableTableControl"), ShowPersonalIdTableTableControl).ResetData = True + End If + + + ' update session or cookie by formula + + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + ' For Master-Detail relationships, save data on the Detail table(s) + + End Sub + + ' To customize, override this method in ShowPersonalIdTableTableControlRow. + Public Overridable Sub GetUIData() + ' The GetUIData method retrieves the updated values from the user interface + ' controls into a database record in preparation for saving or updating. + ' To do this, it calls the Get methods for each of the field displayed on + ' the webpage. It is better to make changes in the Get methods, rather + ' than making changes here. + + ' Call the Get methods for each of the user interface controls. + + GetPersonalId_Addr() + GetPersonalId_Amphur() + GetPersonalId_BirthDate() + GetPersonalId_Born() + GetPersonalId_DateRank() + GetPersonalId_DeptId() + GetPersonalId_MobilePhone() + GetPersonalId_OfficerDate() + GetPersonalId_PersonalLastName() + GetPersonalId_PersonalName() + GetPersonalId_picture() + GetPersonalId_Province() + GetPersonalId_RankId() + End Sub + + + Public Overridable Sub GetPersonalId_Addr() + + ' Retrieve the value entered by the user on the PersonalId.Addr ASP:TextBox, and + ' save it into the PersonalId.Addr field in DataSource ShowPersonalIdTable record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.PersonalId_Addr.Text, ShowPersonalIdTableQuery.Addr_PersonalId) + + + End Sub + + Public Overridable Sub GetPersonalId_Amphur() + + ' Retrieve the value entered by the user on the PersonalId.Amphur ASP:TextBox, and + ' save it into the PersonalId.Amphur field in DataSource ShowPersonalIdTable record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.PersonalId_Amphur.Text, ShowPersonalIdTableQuery.Amphur_PersonalId) + + + End Sub + + Public Overridable Sub GetPersonalId_BirthDate() + + ' Retrieve the value entered by the user on the PersonalId.BirthDate ASP:TextBox, and + ' save it into the PersonalId.BirthDate field in DataSource ShowPersonalIdTable 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.PersonalId_BirthDate.Text, ShowPersonalIdTableQuery.BirthDate_PersonalId) + + + End Sub + + Public Overridable Sub GetPersonalId_Born() + + ' Retrieve the value entered by the user on the PersonalId.Born ASP:TextBox, and + ' save it into the PersonalId.Born field in DataSource ShowPersonalIdTable record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.PersonalId_Born.Text, ShowPersonalIdTableQuery.Born_PersonalId) + + + End Sub + + Public Overridable Sub GetPersonalId_DateRank() + + ' Retrieve the value entered by the user on the PersonalId.DateRank ASP:TextBox, and + ' save it into the PersonalId.DateRank field in DataSource ShowPersonalIdTable 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.PersonalId_DateRank.Text, ShowPersonalIdTableQuery.DateRank_PersonalId) + + + End Sub + + Public Overridable Sub GetPersonalId_DeptId() + + ' Retrieve the value entered by the user on the PersonalId.DeptId ASP:TextBox, and + ' save it into the PersonalId.DeptId field in DataSource ShowPersonalIdTable record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.PersonalId_DeptId.Text, ShowPersonalIdTableQuery.DeptId_PersonalId) + + + End Sub + + Public Overridable Sub GetPersonalId_MobilePhone() + + ' Retrieve the value entered by the user on the PersonalId.MobilePhone ASP:TextBox, and + ' save it into the PersonalId.MobilePhone field in DataSource ShowPersonalIdTable record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.PersonalId_MobilePhone.Text, ShowPersonalIdTableQuery.MobilePhone_PersonalId) + + + End Sub + + Public Overridable Sub GetPersonalId_OfficerDate() + + ' Retrieve the value entered by the user on the PersonalId.OfficerDate ASP:TextBox, and + ' save it into the PersonalId.OfficerDate field in DataSource ShowPersonalIdTable 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.PersonalId_OfficerDate.Text, ShowPersonalIdTableQuery.OfficerDate_PersonalId) + + + End Sub + + Public Overridable Sub GetPersonalId_PersonalLastName() + + ' Retrieve the value entered by the user on the PersonalId.PersonalLastName ASP:TextBox, and + ' save it into the PersonalId.PersonalLastName field in DataSource ShowPersonalIdTable record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.PersonalId_PersonalLastName.Text, ShowPersonalIdTableQuery.PersonalLastName_PersonalId) + + + End Sub + + Public Overridable Sub GetPersonalId_PersonalName() + + ' Retrieve the value entered by the user on the PersonalId.PersonalName ASP:TextBox, and + ' save it into the PersonalId.PersonalName field in DataSource ShowPersonalIdTable record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.PersonalId_PersonalName.Text, ShowPersonalIdTableQuery.PersonalName_PersonalId) + + + End Sub + + Public Overridable Sub GetPersonalId_picture() + ' Retrieve the value entered by the user on the PersonalId.picture ASP:FileUpload, and + ' save it into the PersonalId.picture field in DataSource ShowPersonalIdTable record. + ' Custom validation should be performed in Validate, not here. + + If Not Me.PersonalId_picture.PostedFile is Nothing then + If Me.PersonalId_picture.PostedFile.FileName.Length > 0 AndAlso Me.PersonalId_picture.PostedFile.ContentLength > 0 Then + ' Retrieve the file contents and store them in picture_PersonalId field. + Me.DataSource.Parse(MiscUtils.GetFileContent(Me.PersonalId_picture.PostedFile), ShowPersonalIdTableQuery.picture_PersonalId) + + End If + End If + End Sub + + Public Overridable Sub GetPersonalId_Province() + + ' Retrieve the value entered by the user on the PersonalId.Province ASP:TextBox, and + ' save it into the PersonalId.Province field in DataSource ShowPersonalIdTable record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.PersonalId_Province.Text, ShowPersonalIdTableQuery.Province_PersonalId) + + + End Sub + + Public Overridable Sub GetPersonalId_RankId() + + ' Retrieve the value entered by the user on the PersonalId.RankId ASP:DropDownList, and + ' save it into the PersonalId.RankId field in DataSource ShowPersonalIdTable record. + + ' Custom validation should be performed in Validate, not here. + + Me.DataSource.Parse(GetValueSelectedPageRequest(Me.PersonalId_RankId), ShowPersonalIdTableQuery.RankId_PersonalId) + + End Sub + + + ' To customize, override this method in ShowPersonalIdTableTableControlRow. + + Public Overridable Function CreateWhereClause() As WhereClause + + Return Nothing + + End Function + + + + ' To customize, override this method in ShowPersonalIdTableTableControlRow. + 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) + ShowPersonalIdTableQuery.DeleteRecord(pkValue) + + DirectCast(GetParentControlObject(Me, "ShowPersonalIdTableTableControl"), ShowPersonalIdTableTableControl).DataChanged = True + DirectCast(GetParentControlObject(Me, "ShowPersonalIdTableTableControl"), ShowPersonalIdTableTableControl).ResetData = True + End Sub + + Protected Overridable Sub Control_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.PreRender + ' PreRender event is raised just before page is being displayed. + Try + DbUtils.StartTransaction() + Me.RegisterPostback() + + If Not Me.Page.ErrorOnPage AndAlso (Me.Page.IsPageRefresh OrElse Me.DataChanged OrElse Me.ResetData) Then + + + ' Re-load the data and update the web page if necessary. + ' This is typically done during a postback (filter, search button, sort, pagination button). + ' In each of the other click handlers, simply set DataChanged to True to reload the data. + Me.LoadData() + Me.DataBind() + End If + + + Catch ex As Exception + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + Finally + DbUtils.EndTransaction() + End Try + End Sub + + + Protected Overrides Sub SaveControlsToSession() + MyBase.SaveControlsToSession() + + + 'Save pagination state to session. + + End Sub + + + + Protected Overrides Sub ClearControlsFromSession() + MyBase.ClearControlsFromSession() + + + + ' Clear pagination state from session. + + End Sub + + Protected Overrides Sub LoadViewState(ByVal savedState As Object) + MyBase.LoadViewState(savedState) + Dim isNewRecord As String = CType(ViewState("IsNewRecord"), String) + If Not isNewRecord Is Nothing AndAlso isNewRecord.Trim <> "" Then + Me.IsNewRecord = Boolean.Parse(isNewRecord) + End If + + Dim myCheckSum As String = CType(ViewState("CheckSum"), String) + If Not myCheckSum Is Nothing AndAlso myCheckSum.Trim <> "" Then + Me.CheckSum = myCheckSum + End If + + + ' Load view state for pagination control. + + End Sub + + Protected Overrides Function SaveViewState() As Object + ViewState("IsNewRecord") = Me.IsNewRecord.ToString() + ViewState("CheckSum") = Me.CheckSum + + + ' Load view state for pagination control. + + Return MyBase.SaveViewState() + End Function + + + + Public Overridable Function CreateWhereClause_PersonalId_RankIdDropDownList() As WhereClause + ' By default, we simply return a new WhereClause. + ' Add additional where clauses to restrict the items shown in the dropdown list. + + Dim wc As WhereClause = New WhereClause() + Return wc + + End Function + + + ' Fill the PersonalId_RankId list. + Protected Overridable Sub PopulatePersonalId_RankIdDropDownList( _ + ByVal selectedValue As String, _ + ByVal maxItems As Integer) + + Me.PersonalId_RankId.Items.Clear() + + + ' 1. Setup the static list items + + ' Add the Please Select item. + Me.PersonalId_RankId.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_PersonalId_RankIdDropDownList function. + ' It is better to customize the where clause there. + + Dim wc As WhereClause = CreateWhereClause_PersonalId_RankIdDropDownList() + ' Create the ORDER BY clause to sort based on the displayed value. + + + ' 3. Read a total of maxItems from the database and insert them + Dim orderBy As OrderBy = New OrderBy(False, False) + orderBy.Add(ShowPersonalIdTableQuery.RankId_PersonalId, OrderByItem.OrderDir.Asc) + + Dim itemValue As String + Dim listDuplicates As New ArrayList() + + For Each itemValue In ShowPersonalIdTableQuery.GetValues(ShowPersonalIdTableQuery.RankId_PersonalId, wc, orderBy, maxItems) + ' Create the dropdown list item and add it to the list. + Dim fvalue As String = ShowPersonalIdTableQuery.RankId_PersonalId.Format(itemValue) + If fvalue Is Nothing OrElse fvalue.Trim() = "" Then fvalue = itemValue + Dim dupItem As ListItem = Me.PersonalId_RankId.Items.FindByText(fvalue) + + If Not IsNothing(dupItem) Then + listDuplicates.Add(fvalue) + dupItem.Text = fvalue & " (ID " & dupItem.Value & ")" + End If + + Dim newItem As ListItem = New ListItem(fvalue, itemValue) + Me.PersonalId_RankId.Items.Add(newItem) + + If listDuplicates.Contains(fvalue) Then + newItem.Text = fvalue & " (ID " & itemValue & ")" + End If + Next + + + ' 4. Set the selected value (insert if not already present). + + If Not selectedValue Is Nothing AndAlso _ + selectedValue.Trim <> "" AndAlso _ + Not SetSelectedValue(Me.PersonalId_RankId, selectedValue) AndAlso _ + Not SetSelectedDisplayText(Me.PersonalId_RankId, selectedValue) AndAlso _ + Not SetSelectedDisplayText(Me.PersonalId_RankId, ShowPersonalIdTableQuery.RankId_PersonalId.Format(selectedValue))Then + Dim fvalue As String = ShowPersonalIdTableQuery.RankId_PersonalId.Format(selectedValue) + If fvalue Is Nothing OrElse fvalue.Trim() = "" Then fvalue = selectedValue + Dim item As ListItem = New ListItem(fvalue, selectedValue) + item.Selected = True + Me.PersonalId_RankId.Items.Add(item) + End If + + + End Sub + + Protected Overridable Sub PersonalId_RankId_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()(PersonalId_RankId.ClientID & "_SelectedValue"), String) + Dim displayText As String = CType(Me.Page.Session()(PersonalId_RankId.ClientID & "_SelectedDisplayText"), String) + If displayText <> "" AndAlso val <> "" Then + Me.PersonalId_RankId.Items.Add(New ListItem(displayText, val)) + Me.PersonalId_RankId.SelectedIndex = Me.PersonalId_RankId.Items.Count - 1 + Me.Page.Session.Remove(PersonalId_RankId.ClientID & "_SelectedValue") + Me.Page.Session.Remove(PersonalId_RankId.ClientID & "_SelectedDisplayText") + End If + + + + + End Sub + + Protected Overridable Sub PersonalId_Addr_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub PersonalId_Amphur_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub PersonalId_BirthDate_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub PersonalId_Born_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub PersonalId_DateRank_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub PersonalId_DeptId_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub PersonalId_MobilePhone_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub PersonalId_OfficerDate_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub PersonalId_PersonalLastName_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub PersonalId_PersonalName_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub PersonalId_Province_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("BaseShowPersonalIdTableTableControlRow_Rec"), String) + End Get + Set(ByVal value As String) + Me.ViewState("BaseShowPersonalIdTableTableControlRow_Rec") = value + End Set + End Property + + Private _DataSource As ShowPersonalIdTableRecord + Public Property DataSource() As ShowPersonalIdTableRecord + Get + Return Me._DataSource + End Get + + Set(ByVal value As ShowPersonalIdTableRecord) + + Me._DataSource = value + End Set + End Property + + + + Private _checkSum As String + Public Overridable Property CheckSum() As String + Get + Return Me._checkSum + End Get + Set(ByVal value As String) + Me._checkSum = value + End Set + End Property + + Private _TotalPages As Integer + Public Property TotalPages() As Integer + Get + Return Me._TotalPages + End Get + Set(ByVal value As Integer) + Me._TotalPages = value + End Set + End Property + + Private _PageIndex As Integer + Public Property PageIndex() As Integer + Get + ' Return the PageIndex + Return Me._PageIndex + End Get + Set(ByVal value As Integer) + Me._PageIndex = value + End Set + End Property + + Private _DisplayLastPage As Boolean + Public Property DisplayLastPage() As Boolean + Get + Return Me._DisplayLastPage + End Get + Set(ByVal value As Boolean) + Me._DisplayLastPage = value + End Set + End Property + + + +#Region "Helper Properties" + + Public ReadOnly Property PersonalId_Addr() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalId_Addr"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property PersonalId_Amphur() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalId_Amphur"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property PersonalId_BirthDate() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalId_BirthDate"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property PersonalId_Born() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalId_Born"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property PersonalId_DateRank() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalId_DateRank"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property PersonalId_DeptId() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalId_DeptId"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property PersonalId_MobilePhone() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalId_MobilePhone"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property PersonalId_OfficerDate() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalId_OfficerDate"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property PersonalId_PersonalLastName() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalId_PersonalLastName"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property PersonalId_PersonalName() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalId_PersonalName"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property PersonalId_picture() As System.Web.UI.WebControls.FileUpload + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalId_picture"), System.Web.UI.WebControls.FileUpload) + End Get + End Property + + Public ReadOnly Property PersonalId_pictureImage() As System.Web.UI.WebControls.Image + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalId_pictureImage"), System.Web.UI.WebControls.Image) + End Get + End Property + + Public ReadOnly Property PersonalId_Province() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalId_Province"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property PersonalId_RankId() As System.Web.UI.WebControls.DropDownList + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalId_RankId"), System.Web.UI.WebControls.DropDownList) + End Get + End Property + + Public ReadOnly Property ShowPersonalIdTableRecordRowSelection() As System.Web.UI.WebControls.CheckBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "ShowPersonalIdTableRecordRowSelection"), System.Web.UI.WebControls.CheckBox) + 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 ShowPersonalIdTableRecord = 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 ShowPersonalIdTableRecord + If Not Me.DataSource Is Nothing Then + Return Me.DataSource + End If + + If Not Me.RecordUniqueId Is Nothing Then + + Return ShowPersonalIdTableQuery.GetRecord(Me.RecordUniqueId, True) + + End If + + ' Localization. + + Return Nothing + + End Function + + Public Shadows ReadOnly Property Page() As BaseApplicationPage + Get + Return DirectCast(MyBase.Page, BaseApplicationPage) + End Get + End Property + +#End Region + +End Class + + + +' Base class for the ShowPersonalIdTableTableControl control on the AddPersonalId page. +' Do not modify this class. Instead override any method in ShowPersonalIdTableTableControl. +Public Class BaseShowPersonalIdTableTableControl + Inherits Persons.UI.BaseApplicationTableControl + + + + Protected Overridable Sub Control_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Init + + + + ' Setup the filter and search events. + + + + ' Control Initializations. + ' Initialize the table's current sort order. + + If Me.InSession(Me, "Order_By") Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + End If + + + + ' Setup default pagination settings. + + Me.PageSize = CInt(Me.GetFromSession(Me, "Page_Size", "10")) + Me.PageIndex = CInt(Me.GetFromSession(Me, "Page_Index", "0")) + + + + Me.ClearControlsFromSession() + End Sub + + Protected Overridable Sub Control_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load + + SaveControlsToSession_Ajax() + + ' Setup the pagination events. + + AddHandler Me.ShowPersonalIdTablePagination.FirstPage.Click, AddressOf ShowPersonalIdTablePagination_FirstPage_Click + + AddHandler Me.ShowPersonalIdTablePagination.LastPage.Click, AddressOf ShowPersonalIdTablePagination_LastPage_Click + + AddHandler Me.ShowPersonalIdTablePagination.NextPage.Click, AddressOf ShowPersonalIdTablePagination_NextPage_Click + + AddHandler Me.ShowPersonalIdTablePagination.PageSizeButton.Click, AddressOf ShowPersonalIdTablePagination_PageSizeButton_Click + + AddHandler Me.ShowPersonalIdTablePagination.PreviousPage.Click, AddressOf ShowPersonalIdTablePagination_PreviousPage_Click + + + ' Setup the sorting events. + + AddHandler Me.PersonalId_AddrLabel.Click, AddressOf PersonalId_AddrLabel_Click + + AddHandler Me.PersonalId_AmphurLabel.Click, AddressOf PersonalId_AmphurLabel_Click + + AddHandler Me.PersonalId_BirthDateLabel.Click, AddressOf PersonalId_BirthDateLabel_Click + + AddHandler Me.PersonalId_BornLabel.Click, AddressOf PersonalId_BornLabel_Click + + AddHandler Me.PersonalId_DateRankLabel.Click, AddressOf PersonalId_DateRankLabel_Click + + AddHandler Me.PersonalId_DeptIdLabel.Click, AddressOf PersonalId_DeptIdLabel_Click + + AddHandler Me.PersonalId_MobilePhoneLabel.Click, AddressOf PersonalId_MobilePhoneLabel_Click + + AddHandler Me.PersonalId_OfficerDateLabel.Click, AddressOf PersonalId_OfficerDateLabel_Click + + AddHandler Me.PersonalId_PersonalLastNameLabel.Click, AddressOf PersonalId_PersonalLastNameLabel_Click + + AddHandler Me.PersonalId_PersonalNameLabel.Click, AddressOf PersonalId_PersonalNameLabel_Click + + AddHandler Me.PersonalId_ProvinceLabel.Click, AddressOf PersonalId_ProvinceLabel_Click + + AddHandler Me.PersonalId_RankIdLabel.Click, AddressOf PersonalId_RankIdLabel_Click + + ' Setup the button events. + + AddHandler Me.ShowPersonalIdTableAddButton.Click, AddressOf ShowPersonalIdTableAddButton_Click + + AddHandler Me.ShowPersonalIdTableResetButton.Click, AddressOf ShowPersonalIdTableResetButton_Click + + + ' Setup events for others + + End Sub + + + Public Overridable Sub LoadData() + + ' Read data from database. Returns an array of records that can be assigned + ' to the DataSource table control property. + Try + Dim joinFilter As CompoundFilter = CreateCompoundJoinFilter() + + ' The WHERE clause will be empty when displaying all records in table. + Dim wc As WhereClause = CreateWhereClause() + If wc IsNot Nothing AndAlso Not wc.RunQuery Then + ' Initialize an empty array of records + Dim alist As New ArrayList(0) + Me.DataSource = DirectCast(alist.ToArray(GetType(ShowPersonalIdTableRecord)), ShowPersonalIdTableRecord()) + ' Add records to the list if needed. + Me.AddNewRecords() + Me._TotalRecords = 0 + Me._TotalPages = 0 + Return + End If + + ' Call OrderBy to determine the order - either use the order defined + ' on the Query Wizard, or specified by user (by clicking on column heading) + Dim orderBy As OrderBy = CreateOrderBy() + + ' Get the pagesize from the pagesize control. + Me.GetPageSize() + + If Me.DisplayLastPage Then + Dim totalRecords As Integer = If(Me._TotalRecords < 0, ShowPersonalIdTableQuery.GetRecordCount(CreateCompoundJoinFilter(), CreateWhereClause()), Me._TotalRecords) + + Dim totalPages As Integer = CInt(Math.Ceiling(totalRecords / Me.PageSize)) + + Me.PageIndex = totalPages - 1 + End If + + ' Make sure PageIndex (current page) and PageSize are within bounds. + If Me.PageIndex < 0 Then + Me.PageIndex = 0 + End If + If Me.PageSize < 1 Then + Me.PageSize = 1 + End If + + ' Retrieve the records and set the table DataSource. + ' Only PageSize records are fetched starting at PageIndex (zero based). + If Me.AddNewRecord > 0 Then + ' Make sure to preserve the previously entered data on new rows. + Dim postdata As New ArrayList + For Each rc As ShowPersonalIdTableTableControlRow In Me.GetRecordControls() + If Not rc.IsNewRecord Then + rc.DataSource = rc.GetRecord() + rc.GetUIData() + postdata.Add(rc.DataSource) + UIData.Add(rc.PreservedUIData()) + End If + Next + Me.DataSource = DirectCast(postdata.ToArray(GetType(ShowPersonalIdTableRecord)), ShowPersonalIdTableRecord()) + Else ' Get the records from the database + Me.DataSource = ShowPersonalIdTableQuery.GetRecords(joinFilter, wc, orderBy, Me.PageIndex, Me.PageSize) + + End If + + ' if the datasource contains no records contained in database, then load the last page. + If (DbUtils.GetCreatedRecords(Me.DataSource).Length = 0 AndAlso Not Me.DisplayLastPage) Then + Me.DisplayLastPage = True + LoadData() + Else + + ' Add any new rows desired by the user. + Me.AddNewRecords() + + ' Turn off the ToggleAll checkbox + Me.ShowPersonalIdTableToggleAll.Checked = False + + + ' Initialize the page and grand totals. now + + End If + + Catch ex As Exception + ' Report the error message to the end user + Dim msg As String = ex.Message + If ex.InnerException IsNot Nothing Then + msg = msg & " InnerException: " & ex.InnerException.Message + End If + Throw New Exception(msg, ex.InnerException) + End Try + End Sub + + + + + Public Overrides Sub DataBind() + ' The DataBind method binds the user interface controls to the values + ' from the database record for each row in the table. To do this, it calls the + ' DataBind for each of the rows. + ' DataBind also populates any filters above the table, and sets the pagination + ' control to the correct number of records and the current page number. + + MyBase.DataBind() + + ' Make sure that the DataSource is initialized. + If Me.DataSource Is Nothing Then + Return + End If + + 'LoadData for DataSource for chart and report if they exist + + ' Setup the pagination controls. + BindPaginationControls() + + + + ' Bind the repeater with the list of records to expand the UI. + Dim rep As System.Web.UI.WebControls.Repeater = CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "ShowPersonalIdTableTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return + rep.DataSource = DataSource() + rep.DataBind() + + Dim index As Integer = 0 + For Each repItem As System.Web.UI.WebControls.RepeaterItem In rep.Items + ' Loop through all rows in the table, set its DataSource and call DataBind(). + Dim recControl As ShowPersonalIdTableTableControlRow = DirectCast(repItem.FindControl("ShowPersonalIdTableTableControlRow"), ShowPersonalIdTableTableControlRow) + recControl.DataSource = Me.DataSource(index) + If Me.UIData.Count > index Then + recControl.PreviousUIData = Me.UIData(index) + End If + recControl.DataBind() + recControl.Visible = Not Me.InDeletedRecordIds(recControl) + + index += 1 + Next + + + + + ' Call the Set methods for each controls on the panel + + SetPersonalId_AddrLabel() + SetPersonalId_AmphurLabel() + SetPersonalId_BirthDateLabel() + SetPersonalId_BornLabel() + SetPersonalId_DateRankLabel() + SetPersonalId_DeptIdLabel() + SetPersonalId_MobilePhoneLabel() + SetPersonalId_OfficerDateLabel() + SetPersonalId_PersonalLastNameLabel() + SetPersonalId_PersonalNameLabel() + SetPersonalId_pictureLabel() + SetPersonalId_ProvinceLabel() + SetPersonalId_RankIdLabel() + + + + SetShowPersonalIdTableTableControlCollapsibleRegion() + + ' setting the state of expand or collapse alternative rows + + + ' Load data for each record and table UI control. + ' Ordering is important because child controls get + ' their parent ids from their parent UI controls. + + + ' this method calls the set method for controls with special formula like running total, sum, rank, etc + SetFormulaControls() + End Sub + + Public Overridable Sub SetFormulaControls() + ' this method calls Set methods for the control that has special formula + + + + End Sub + + + + Public Overridable Sub RegisterPostback() + + + End Sub + + Public EvaluateFormulaDelegate As BaseClasses.Data.DataSource.EvaluateFormulaDelegate = New BaseClasses.Data.DataSource.EvaluateFormulaDelegate(AddressOf Me.EvaluateFormula) + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean, ByVal e as FormulaEvaluator) As String + If e Is Nothing + e = New FormulaEvaluator() + End If + + e.Variables.Clear() + + + ' add variables for formula evaluation + If variables IsNot Nothing Then + Dim enumerator As System.Collections.Generic.IEnumerator(Of System.Collections.Generic.KeyValuePair(Of String, Object)) = variables.GetEnumerator() + While enumerator.MoveNext() + e.Variables.Add(enumerator.Current.Key, enumerator.Current.Value) + End While + End If + + If includeDS + + End If + + ' All variables referred to in the formula are expected to be + ' properties of the DataSource. For example, referring to + ' UnitPrice as a variable will refer to DataSource.UnitPrice + e.DataSource = dataSourceForEvaluate + + ' Define the calling control. This is used to add other + ' related table and record controls as variables. + e.CallingControl = Me + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + + If Not String.IsNullOrEmpty(format) AndAlso (String.IsNullOrEmpty(formula) OrElse formula.IndexOf("Format(") < 0) Then + Return FormulaUtils.Format(resultObj, format) + Else + Return resultObj.ToString() + End If + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format,variables ,includeDS, Nothing) + End Function + + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object)) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format, variables ,True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, format, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal e as FormulaEvaluator) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, variables, True, e) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal includeDS as Boolean) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, includeDS, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, True, Nothing) + End Function + + + + + Public Overridable Sub ResetControl() + + Me.CurrentSortOrder.Reset() + If (Me.InSession(Me, "Order_By")) Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + End If + + Me.PageIndex = 0 + End Sub + + Protected Overridable Sub BindPaginationControls() + ' Setup the pagination controls. + + ' Bind the pagination labels. + + If DbUtils.GetCreatedRecords(Me.DataSource).Length > 0 Then + + Me.ShowPersonalIdTablePagination.CurrentPage.Text = (Me.PageIndex + 1).ToString() + Else + Me.ShowPersonalIdTablePagination.CurrentPage.Text = "0" + End If + Me.ShowPersonalIdTablePagination.PageSize.Text = Me.PageSize.ToString() + Me.ShowPersonalIdTablePagination.TotalItems.Text = Me.TotalRecords.ToString() + Me.ShowPersonalIdTablePagination.TotalPages.Text = Me.TotalPages.ToString() + + ' Bind the buttons for ShowPersonalIdTableTableControl pagination. + + Me.ShowPersonalIdTablePagination.FirstPage.Enabled = Not (Me.PageIndex = 0) + If Me._TotalPages < 0 Then ' if the total pages is not determined yet, enable last and next buttons + Me.ShowPersonalIdTablePagination.LastPage.Enabled = True + ElseIf Me._TotalPages = 0 ' if the total pages is determined and it is 0, enable last and next buttons + Me.ShowPersonalIdTablePagination.LastPage.Enabled = False + Else ' if the total pages is the last page, disable last and next buttons + Me.ShowPersonalIdTablePagination.LastPage.Enabled = Not (Me.PageIndex = Me.TotalPages - 1) + End If + + If Me._TotalPages < 0 Then ' if the total pages is not determined yet, enable last and next buttons + Me.ShowPersonalIdTablePagination.NextPage.Enabled = True + ElseIf Me._TotalPages = 0 ' if the total pages is determined and it is 0, enable last and next buttons + Me.ShowPersonalIdTablePagination.NextPage.Enabled = False + Else ' if the total pages is the last page, disable last and next buttons + Me.ShowPersonalIdTablePagination.NextPage.Enabled = Not (Me.PageIndex = Me.TotalPages - 1) + End If + + Me.ShowPersonalIdTablePagination.PreviousPage.Enabled = Not (Me.PageIndex = 0) + + + End Sub + + Public Overridable Sub SaveData() + ' Save the data from the entire table. Calls each row's Save Data + ' to save their data. This function is called by the Click handler of the + ' Save button. The button handler should Start/Commit/End a transaction. + + Dim recCtl As ShowPersonalIdTableTableControlRow + For Each recCtl In Me.GetRecordControls() + + If Me.InDeletedRecordIds(recCtl) Then + ' Delete any pending deletes. + recCtl.Delete() + Else + If recCtl.Visible Then + recCtl.SaveData() + End If + End If + + Next + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + ' Set IsNewRecord to False for all records - since everything has been saved and is no longer "new" + For Each recCtl In Me.GetRecordControls() + recCtl.IsNewRecord = False + Next + + + ' Set DeletedRecordsIds to Nothing since we have deleted all pending deletes. + Me.DeletedRecordIds = Nothing + + End Sub + + Public Overridable Function CreateCompoundJoinFilter() As CompoundFilter + Dim jFilter As CompoundFilter = New CompoundFilter() + + Return jFilter + + End Function + + + Public Overridable Function CreateOrderBy() As OrderBy + ' The CurrentSortOrder is initialized to the sort order on the + ' Query Wizard. It may be modified by the Click handler for any of + ' the column heading to sort or reverse sort by that column. + ' You can add your own sort order, or modify it on the Query Wizard. + Return Me.CurrentSortOrder + End Function + + Public Overridable Function CreateWhereClause() As WhereClause + 'This CreateWhereClause is used for loading the data. + ShowPersonalIdTableQuery.Instance.InnerFilter = Nothing + Dim wc As WhereClause = New WhereClause() + + ' Compose the WHERE clause consiting of: + ' 1. Static clause defined at design time. + ' 2. User selected search criteria. + ' 3. User selected filter criteria. + + + Dim selectedRecordKeyValue as KeyValue = New KeyValue() + + Dim personalIdRecordControlObj As Persons.UI.Controls.AddPersonalId.PersonalIdRecordControl = DirectCast(MiscUtils.FindControlRecursively(Me.Page, "PersonalIdRecordControl"), Persons.UI.Controls.AddPersonalId.PersonalIdRecordControl) + + If (Not IsNothing(personalIdRecordControlObj) AndAlso Not IsNothing(personalIdRecordControlObj.GetRecord()) AndAlso personalIdRecordControlObj.GetRecord().IsCreated AndAlso Not IsNothing(personalIdRecordControlObj.GetRecord().PersonalId)) + wc.iAND(ShowPersonalIdTableQuery.PersonalId_PersonalId, BaseFilter.ComparisonOperator.EqualsTo, personalIdRecordControlObj.GetRecord().PersonalId.ToString()) + selectedRecordKeyValue.AddElement(ShowPersonalIdTableQuery.PersonalId_PersonalId.UniqueName, personalIdRecordControlObj.GetRecord().PersonalId.ToString()) + Else + wc.RunQuery = False + Return wc + End If + + HttpContext.Current.Session("ShowPersonalIdTableTableControlWhereClause") = selectedRecordKeyValue.ToXmlString() + + Return wc + End Function + + + Public Overridable Function CreateWhereClause(ByVal searchText as String, ByVal fromSearchControl as String, ByVal AutoTypeAheadSearch as String, ByVal AutoTypeAheadWordSeparators as String) As WhereClause + ' This CreateWhereClause is used for loading list of suggestions for Auto Type-Ahead feature. + ShowPersonalIdTableQuery.Instance.InnerFilter = Nothing + Dim wc As WhereClause = New WhereClause() + + ' Compose the WHERE clause consiting of: + ' 1. Static clause defined at design time. + ' 2. User selected search criteria. + ' 3. User selected filter criteria. + + Dim appRelativeVirtualPath As String = CType(HttpContext.Current.Session("AppRelativeVirtualPath"), String) + + Dim selectedRecordInPersonalIdRecordControl as String = DirectCast(HttpContext.Current.Session("ShowPersonalIdTableTableControlWhereClause"), String) + + If Not selectedRecordInPersonalIdRecordControl Is Nothing AndAlso KeyValue.IsXmlKey(selectedRecordInPersonalIdRecordControl) Then + Dim selectedRecordKeyValue as KeyValue = KeyValue.XmlToKey(selectedRecordInPersonalIdRecordControl) + + If Not IsNothing(selectedRecordKeyValue) AndAlso selectedRecordKeyValue.ContainsColumn(ShowPersonalIdTableQuery.PersonalId_PersonalId) Then + wc.iAND(ShowPersonalIdTableQuery.PersonalId_PersonalId, BaseFilter.ComparisonOperator.EqualsTo, selectedRecordKeyValue.GetColumnValue(ShowPersonalIdTableQuery.PersonalId_PersonalId).ToString()) + End If + + End If + + ' Adds clauses if values are selected in Filter controls which are configured in the page. + + + Return wc + End Function + + + Public Overridable Function FormatSuggestions(ByVal prefixText As String, ByVal resultItem As String, _ + ByVal columnLength As Integer, ByVal AutoTypeAheadDisplayFoundText As String, _ + ByVal autoTypeAheadSearch As String, ByVal AutoTypeAheadWordSeparators As String, _ + ByVal resultList As ArrayList) As Boolean + + 'Formats the resultItem and adds it to the list of suggestions. + Dim index As Integer = resultItem.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture).IndexOf(prefixText.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture)) + Dim itemToAdd As String = "" + Dim isFound As Boolean = False + Dim isAdded As Boolean = False + ' Get the index where prfixt is at the beginning of resultItem. If not found then, index of word which begins with prefixText. + If InvariantLCase(autoTypeAheadSearch).equals("wordsstartingwithsearchstring") And Not index = 0 Then + ' Expression to find word which contains AutoTypeAheadWordSeparators followed by prefixText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex( AutoTypeAheadWordSeparators + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + If regex1.IsMatch(resultItem) Then + index = regex1.Match(resultItem).Index + isFound = True + End If + ' If the prefixText is found immediatly after white space then starting of the word is found so don not search any further + If not resultItem(index).ToString() = " " Then + ' Expression to find beginning of the word which contains AutoTypeAheadWordSeparators followed by prefixText + Dim regex As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\\S*" + AutoTypeAheadWordSeparators + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + If regex.IsMatch(resultItem) Then + index = regex.Match(resultItem).Index + isFound = True + End If + End If + End If + + ' If autoTypeAheadSearch value is wordsstartingwithsearchstring then, extract the substring only if the prefixText is found at the + ' beginning of the resultItem (index = 0) or a word in resultItem is found starts with prefixText. + If index = 0 Or isFound Or InvariantLCase(autoTypeAheadSearch).Equals("anywhereinstring") then + If InvariantLCase(AutoTypeAheadDisplayFoundText).equals("atbeginningofmatchedstring") Then + ' Expression to find beginning of the word which contains prefixText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\\S*" + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + ' Find the beginning of the word which contains prefexText + If (StringUtils.InvariantLCase(autoTypeAheadSearch).Equals("anywhereinstring") AndAlso regex1.IsMatch(resultItem)) Then + index = regex1.Match(resultItem).Index + isFound = True + End If + ' Display string from the index till end of the string if sub string from index till end is less than columnLength value. + If Len(resultItem) - index <= columnLength Then + If index = 0 Then + itemToAdd = resultItem + Else + itemToAdd = "..." & resultItem.Substring(index, Len(resultItem) - index) + End If + Else + If index = 0 Then + itemToAdd = resultItem.Substring(index, (columnLength - 3)) & "..." + Else + 'Truncate the string to show only columnLength - 6 characters as begining and trailing "..." has to be appended. + itemToAdd = "..." & resultItem.Substring(index , columnLength - 6) & "..." + End If + End If + ElseIf InvariantLCase(AutoTypeAheadDisplayFoundText).equals("inmiddleofmatchedstring") Then + Dim subStringBeginIndex As Integer = CType(columnLength/2, Integer) + If Len(resultItem) <= columnLength Then + itemToAdd = resultItem + Else + ' Sanity check at end of the string + If index + Len(prefixText) = columnLength Then + itemToAdd = "..." & resultItem.Substring(index-columnLength,index) + ElseIf Len(resultItem) - index < subStringBeginIndex Then + ' Display string from the end till columnLength value if, index is closer to the end of the string. + itemToAdd = "..." & resultItem.Substring(Len(resultItem)-columnLength,Len(resultItem)) + ElseIf index <= subStringBeginIndex Then + ' Sanity chet at beginning of the string + itemToAdd = resultItem.Substring(0, columnLength) & "..." + Else + ' Display string containing text before the prefixText occures and text after the prefixText + itemToAdd = "..." & resultItem.Substring(index - subStringBeginIndex, columnLength) & "..." + End If + End If + ElseIf InvariantLCase(AutoTypeAheadDisplayFoundText).equals("atendofmatchedstring") Then + ' Expression to find ending of the word which contains prefexText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\s", System.Text.RegularExpressions.RegexOptions.IgnoreCase) + ' Find the ending of the word which contains prefexText + If regex1.IsMatch(resultItem, index + 1) Then + index = regex1.Match(resultItem, index + 1).Index + Else + ' If the word which contains prefexText is the last word in string, regex1.IsMatch returns false. + index = resultItem.Length + End If + If index > Len(resultItem) Then + index = Len(resultItem) + End If + ' If text from beginning of the string till index is less than columnLength value then, display string from the beginning till index. + If index <= columnLength Then + if index = Len(resultItem) Then 'Make decision to append "..." + itemToAdd = resultItem.Substring(0,index) + Else + itemToAdd = resultItem.Substring(0,index) & "..." + End If + Else + If index = Len(resultItem) Then + itemToAdd = "..." & resultItem.Substring(index - (columnLength - 3), (columnLength - 3)) + Else + 'Truncate the string to show only columnLength - 6 characters as begining and trailing "..." has to be appended. + itemToAdd = "..." & resultItem.Substring(index - (columnLength - 6), columnLength - 6) & "..." + End If + End If + End If + + ' Remove newline character from itemToAdd + Dim prefixTextIndex As Integer = itemToAdd.IndexOf(prefixText, StringComparison.CurrentCultureIgnoreCase) + ' If itemToAdd contains any newline after the search text then show text only till newline + Dim regex2 As System.Text.RegularExpressions.Regex = New System.Text.RegularExpressions.Regex("(" & vbCrLf & "|" & vbLf & ")", System.Text.RegularExpressions.RegexOptions.IgnoreCase) + Dim newLineIndexAfterPrefix As Integer = -1 + If regex2.IsMatch(itemToAdd, prefixTextIndex) Then + newLineIndexAfterPrefix = regex2.Match(itemToAdd, prefixTextIndex).Index + End If + If (newLineIndexAfterPrefix > -1) Then + If itemToAdd.EndsWith("...") Then + itemToAdd = (itemToAdd.Substring(0, newLineIndexAfterPrefix) + "...") + Else + itemToAdd = itemToAdd.Substring(0, newLineIndexAfterPrefix) + End If + End If + ' If itemToAdd contains any newline before search text then show text which comes after newline + Dim regex3 As System.Text.RegularExpressions.Regex = New System.Text.RegularExpressions.Regex("(" & vbCrLf & "|" & vbLf & ")", (System.Text.RegularExpressions.RegexOptions.IgnoreCase Or System.Text.RegularExpressions.RegexOptions.RightToLeft)) + Dim newLineIndexBeforePrefix As Integer = -1 + If regex3.IsMatch(itemToAdd, prefixTextIndex) Then + newLineIndexBeforePrefix = regex3.Match(itemToAdd, prefixTextIndex).Index + End If + If (newLineIndexBeforePrefix > -1) Then + If itemToAdd.StartsWith("...") Then + itemToAdd = ("..." + itemToAdd.Substring((newLineIndexBeforePrefix + regex3.Match(itemToAdd, prefixTextIndex).Length))) + Else + itemToAdd = itemToAdd.Substring((newLineIndexBeforePrefix + regex3.Match(itemToAdd, prefixTextIndex).Length)) + End If + End If + + If Not itemToAdd is nothing AndAlso Not resultList.Contains(itemToAdd) Then + + resultList.Add(itemToAdd) + + isAdded = true + End If + End If + Return isAdded + End Function + + + Protected Overridable Sub GetPageSize() + + If Me.ShowPersonalIdTablePagination.PageSize.Text.Trim <> "" Then + Try + 'Me.PageSize = Integer.Parse(Me.ShowPersonalIdTablePagination.PageSize.Text) + Catch ex As Exception + End Try + End If + End Sub + + Protected Overridable Sub AddNewRecords() + + Dim newRecordList As ArrayList = New ArrayList() + + Dim newUIDataList As System.Collections.Generic.List(Of Hashtable) = New System.Collections.Generic.List(Of Hashtable)() + + ' Loop though all the record controls and if the record control + ' does not have a unique record id set, then create a record + ' and add to the list. + If Not Me.ResetData Then + Dim rep As System.Web.UI.WebControls.Repeater = CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "ShowPersonalIdTableTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return + + Dim repItem As System.Web.UI.WebControls.RepeaterItem + For Each repItem In rep.Items + ' Loop through all rows in the table, set its DataSource and call DataBind(). + + Dim recControl As ShowPersonalIdTableTableControlRow = DirectCast(repItem.FindControl("ShowPersonalIdTableTableControlRow"), ShowPersonalIdTableTableControlRow) + + If recControl.Visible AndAlso recControl.IsNewRecord() Then + + Dim rec As ShowPersonalIdTableRecord = New ShowPersonalIdTableRecord() + + If recControl.PersonalId_Addr.Text <> "" Then + rec.Parse(recControl.PersonalId_Addr.Text, ShowPersonalIdTableQuery.Addr_PersonalId) + End If + If recControl.PersonalId_Amphur.Text <> "" Then + rec.Parse(recControl.PersonalId_Amphur.Text, ShowPersonalIdTableQuery.Amphur_PersonalId) + End If + If recControl.PersonalId_BirthDate.Text <> "" Then + rec.Parse(recControl.PersonalId_BirthDate.Text, ShowPersonalIdTableQuery.BirthDate_PersonalId) + End If + If recControl.PersonalId_Born.Text <> "" Then + rec.Parse(recControl.PersonalId_Born.Text, ShowPersonalIdTableQuery.Born_PersonalId) + End If + If recControl.PersonalId_DateRank.Text <> "" Then + rec.Parse(recControl.PersonalId_DateRank.Text, ShowPersonalIdTableQuery.DateRank_PersonalId) + End If + If recControl.PersonalId_DeptId.Text <> "" Then + rec.Parse(recControl.PersonalId_DeptId.Text, ShowPersonalIdTableQuery.DeptId_PersonalId) + End If + If recControl.PersonalId_MobilePhone.Text <> "" Then + rec.Parse(recControl.PersonalId_MobilePhone.Text, ShowPersonalIdTableQuery.MobilePhone_PersonalId) + End If + If recControl.PersonalId_OfficerDate.Text <> "" Then + rec.Parse(recControl.PersonalId_OfficerDate.Text, ShowPersonalIdTableQuery.OfficerDate_PersonalId) + End If + If recControl.PersonalId_PersonalLastName.Text <> "" Then + rec.Parse(recControl.PersonalId_PersonalLastName.Text, ShowPersonalIdTableQuery.PersonalLastName_PersonalId) + End If + If recControl.PersonalId_PersonalName.Text <> "" Then + rec.Parse(recControl.PersonalId_PersonalName.Text, ShowPersonalIdTableQuery.PersonalName_PersonalId) + End If + If recControl.PersonalId_Province.Text <> "" Then + rec.Parse(recControl.PersonalId_Province.Text, ShowPersonalIdTableQuery.Province_PersonalId) + End If + If MiscUtils.IsValueSelected(recControl.PersonalId_RankId) Then + rec.Parse(recControl.PersonalId_RankId.SelectedItem.Value, ShowPersonalIdTableQuery.RankId_PersonalId) + End If + newUIDataList.Add(recControl.PreservedUIData()) + newRecordList.Add(rec) + End If + Next + End If + + + ' Add any new record to the list. + Dim index As Integer = 0 + For index = 1 To Me.AddNewRecord + + newRecordList.Insert(0, New ShowPersonalIdTableRecord()) + newUIDataList.Insert(0, New Hashtable()) + + Next + Me.AddNewRecord = 0 + + ' Finally, add any new records to the DataSource. + If newRecordList.Count > 0 Then + + Dim finalList As ArrayList = New ArrayList(Me.DataSource) + finalList.InsertRange(0, newRecordList) + + Me.DataSource = DirectCast(finalList.ToArray(GetType(ShowPersonalIdTableRecord)), ShowPersonalIdTableRecord()) + + End If + + ' Add the existing UI data to this hash table + If newUIDataList.Count > 0 Then + Me.UIData.InsertRange(0, newUIDataList) + End If + + End Sub + + + Public Sub AddToDeletedRecordIds(ByVal rec As ShowPersonalIdTableTableControlRow) + If rec.IsNewRecord() Then + Return + End If + + If Not Me.DeletedRecordIds Is Nothing AndAlso Me.DeletedRecordIds.Trim <> "" Then + Me.DeletedRecordIds &= "," + End If + + Me.DeletedRecordIds &= "[" & rec.RecordUniqueId & "]" + End Sub + + Protected Overridable Function InDeletedRecordIds(ByVal rec As ShowPersonalIdTableTableControlRow) As Boolean + If Me.DeletedRecordIds Is Nothing OrElse Me.DeletedRecordIds.Trim = "" Then + Return False + End If + + Return Me.DeletedRecordIds.IndexOf("[" & rec.RecordUniqueId & "]") >= 0 + End Function + + Private _DeletedRecordIds As String + Public Property DeletedRecordIds() As String + Get + Return Me._DeletedRecordIds + End Get + Set(ByVal value As String) + Me._DeletedRecordIds = value + End Set + End Property + + + ' Create Set, WhereClause, and Populate Methods + + Public Overridable Sub SetPersonalId_AddrLabel() + + End Sub + + Public Overridable Sub SetPersonalId_AmphurLabel() + + End Sub + + Public Overridable Sub SetPersonalId_BirthDateLabel() + + End Sub + + Public Overridable Sub SetPersonalId_BornLabel() + + End Sub + + Public Overridable Sub SetPersonalId_DateRankLabel() + + End Sub + + Public Overridable Sub SetPersonalId_DeptIdLabel() + + End Sub + + Public Overridable Sub SetPersonalId_MobilePhoneLabel() + + End Sub + + Public Overridable Sub SetPersonalId_OfficerDateLabel() + + End Sub + + Public Overridable Sub SetPersonalId_PersonalLastNameLabel() + + End Sub + + Public Overridable Sub SetPersonalId_PersonalNameLabel() + + End Sub + + Public Overridable Sub SetPersonalId_pictureLabel() + + End Sub + + Public Overridable Sub SetPersonalId_ProvinceLabel() + + End Sub + + Public Overridable Sub SetPersonalId_RankIdLabel() + + End Sub + + Public Overridable Sub SetShowPersonalIdTableTableControlCollapsibleRegion() + + 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. + Dim added As Boolean = Me.AddNewRecord > 0 + Me.LoadData() + Me.DataBind() + + If added Then + Me.SetFocusToAddedRow() + End If + + End If + + + + Catch ex As Exception + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + Finally + DbUtils.EndTransaction + End Try + End Sub + + 'this function sets focus to the first editable element in the new added row in the editable table + Protected Overridable Sub SetFocusToAddedRow() + Dim rep As System.Web.UI.WebControls.Repeater = CType(Me.FindControl("ShowPersonalIdTableTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing OrElse rep.Items.Count = 0 Then Return + Dim repItem As System.Web.UI.WebControls.RepeaterItem + For Each repItem In rep.Items + 'Load scripts to table rows + Me.Page.LoadFocusScripts(repItem) + Dim recControl As ShowPersonalIdTableTableControlRow = DirectCast(repItem.FindControl("ShowPersonalIdTableTableControlRow"), ShowPersonalIdTableTableControlRow) + If recControl.IsNewRecord Then + For Each field As Control In recControl.Controls + If field.Visible AndAlso Me.Page.IsControlEditable(field, False) Then + 'set focus on the first editable field in the new row + field.Focus() + Dim updPan As UpdatePanel = DirectCast(Me.Page.FindControlRecursively("UpdatePanel1"), UpdatePanel) + If Not updPan Is Nothing Then updPan.Update() + Return + End If + Next + Return + End If + Next + End Sub + + + Protected Overrides Sub SaveControlsToSession() + MyBase.SaveControlsToSession() + + ' Save filter controls to values to session. + + + 'Save pagination state to session. + + + + ' Save table control properties to the session. + If Not Me.CurrentSortOrder Is Nothing Then + Me.SaveToSession(Me, "Order_By", Me.CurrentSortOrder.ToXmlString()) + End If + + Me.SaveToSession(Me, "Page_Index", Me.PageIndex.ToString()) + Me.SaveToSession(Me, "Page_Size", Me.PageSize.ToString()) + + Me.SaveToSession(Me, "DeletedRecordIds", Me.DeletedRecordIds) + + End Sub + + Protected Sub SaveControlsToSession_Ajax() + ' Save filter controls to values to session. + + HttpContext.Current.Session("AppRelativeVirtualPath") = Me.Page.AppRelativeVirtualPath + + End Sub + + Protected Overrides Sub ClearControlsFromSession() + MyBase.ClearControlsFromSession() + + ' Clear filter controls values from the session. + + + ' Clear pagination state from session. + + + + ' Clear table properties from the session. + Me.RemoveFromSession(Me, "Order_By") + Me.RemoveFromSession(Me, "Page_Index") + Me.RemoveFromSession(Me, "Page_Size") + + Me.RemoveFromSession(Me, "DeletedRecordIds") + + End Sub + + Protected Overrides Sub LoadViewState(ByVal savedState As Object) + MyBase.LoadViewState(savedState) + + Dim orderByStr As String = CType(ViewState("ShowPersonalIdTableTableControl_OrderBy"), String) + + If orderByStr IsNot Nothing AndAlso orderByStr.Trim <> "" Then + Me.CurrentSortOrder = BaseClasses.Data.OrderBy.FromXmlString(orderByStr) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + End If + + Dim pageIndex As String = CType(ViewState("Page_Index"), String) + If pageIndex IsNot Nothing Then + Me.PageIndex = CInt(pageIndex) + End If + + Dim pageSize As String = CType(ViewState("Page_Size"), String) + If Not pageSize Is Nothing Then + Me.PageSize = CInt(pageSize) + End If + + + + ' Load view state for pagination control. + + Me.DeletedRecordIds = CType(Me.ViewState("DeletedRecordIds"), String) + + End Sub + + Protected Overrides Function SaveViewState() As Object + + If Me.CurrentSortOrder IsNot Nothing Then + Me.ViewState("ShowPersonalIdTableTableControl_OrderBy") = Me.CurrentSortOrder.ToXmlString() + End If + + Me.ViewState("Page_Index") = Me.PageIndex + Me.ViewState("Page_Size") = Me.PageSize + + Me.ViewState("DeletedRecordIds") = Me.DeletedRecordIds + + + ' Load view state for pagination control. + + + Return MyBase.SaveViewState() + End Function + + ' Generate the event handling functions for pagination events. + + ' event handler for ImageButton + Public Overridable Sub ShowPersonalIdTablePagination_FirstPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.PageIndex = 0 + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub ShowPersonalIdTablePagination_LastPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.DisplayLastPage = True + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub ShowPersonalIdTablePagination_NextPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.PageIndex += 1 + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for LinkButton + Public Overridable Sub ShowPersonalIdTablePagination_PageSizeButton_Click(ByVal sender As Object, ByVal args As EventArgs) + + Try + + Me.DataChanged = True + + Me.PageSize = Integer.Parse(Me.ShowPersonalIdTablePagination.PageSize.Text) + + Me.PageIndex = Integer.Parse(Me.ShowPersonalIdTablePagination.CurrentPage.Text) - 1 + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub ShowPersonalIdTablePagination_PreviousPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + If Me.PageIndex > 0 Then + Me.PageIndex -= 1 + Me.DataChanged = True + End If + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + + ' Generate the event handling functions for sorting events. + + Public Overridable Sub PersonalId_AddrLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by PersonalId.Addr when clicked. + + ' Get previous sorting state for PersonalId.Addr. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(ShowPersonalIdTableQuery.Addr_PersonalId) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for PersonalId.Addr. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(ShowPersonalIdTableQuery.Addr_PersonalId, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by PersonalId.Addr, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub PersonalId_AmphurLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by PersonalId.Amphur when clicked. + + ' Get previous sorting state for PersonalId.Amphur. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(ShowPersonalIdTableQuery.Amphur_PersonalId) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for PersonalId.Amphur. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(ShowPersonalIdTableQuery.Amphur_PersonalId, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by PersonalId.Amphur, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub PersonalId_BirthDateLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by PersonalId.BirthDate when clicked. + + ' Get previous sorting state for PersonalId.BirthDate. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(ShowPersonalIdTableQuery.BirthDate_PersonalId) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for PersonalId.BirthDate. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(ShowPersonalIdTableQuery.BirthDate_PersonalId, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by PersonalId.BirthDate, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub PersonalId_BornLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by PersonalId.Born when clicked. + + ' Get previous sorting state for PersonalId.Born. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(ShowPersonalIdTableQuery.Born_PersonalId) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for PersonalId.Born. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(ShowPersonalIdTableQuery.Born_PersonalId, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by PersonalId.Born, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub PersonalId_DateRankLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by PersonalId.DateRank when clicked. + + ' Get previous sorting state for PersonalId.DateRank. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(ShowPersonalIdTableQuery.DateRank_PersonalId) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for PersonalId.DateRank. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(ShowPersonalIdTableQuery.DateRank_PersonalId, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by PersonalId.DateRank, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub PersonalId_DeptIdLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by PersonalId.DeptId when clicked. + + ' Get previous sorting state for PersonalId.DeptId. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(ShowPersonalIdTableQuery.DeptId_PersonalId) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for PersonalId.DeptId. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(ShowPersonalIdTableQuery.DeptId_PersonalId, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by PersonalId.DeptId, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub PersonalId_MobilePhoneLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by PersonalId.MobilePhone when clicked. + + ' Get previous sorting state for PersonalId.MobilePhone. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(ShowPersonalIdTableQuery.MobilePhone_PersonalId) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for PersonalId.MobilePhone. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(ShowPersonalIdTableQuery.MobilePhone_PersonalId, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by PersonalId.MobilePhone, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub PersonalId_OfficerDateLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by PersonalId.OfficerDate when clicked. + + ' Get previous sorting state for PersonalId.OfficerDate. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(ShowPersonalIdTableQuery.OfficerDate_PersonalId) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for PersonalId.OfficerDate. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(ShowPersonalIdTableQuery.OfficerDate_PersonalId, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by PersonalId.OfficerDate, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub PersonalId_PersonalLastNameLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by PersonalId.PersonalLastName when clicked. + + ' Get previous sorting state for PersonalId.PersonalLastName. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(ShowPersonalIdTableQuery.PersonalLastName_PersonalId) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for PersonalId.PersonalLastName. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(ShowPersonalIdTableQuery.PersonalLastName_PersonalId, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by PersonalId.PersonalLastName, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub PersonalId_PersonalNameLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by PersonalId.PersonalName when clicked. + + ' Get previous sorting state for PersonalId.PersonalName. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(ShowPersonalIdTableQuery.PersonalName_PersonalId) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for PersonalId.PersonalName. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(ShowPersonalIdTableQuery.PersonalName_PersonalId, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by PersonalId.PersonalName, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub PersonalId_ProvinceLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by PersonalId.Province when clicked. + + ' Get previous sorting state for PersonalId.Province. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(ShowPersonalIdTableQuery.Province_PersonalId) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for PersonalId.Province. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(ShowPersonalIdTableQuery.Province_PersonalId, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by PersonalId.Province, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub PersonalId_RankIdLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by PersonalId.RankId when clicked. + + ' Get previous sorting state for PersonalId.RankId. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(ShowPersonalIdTableQuery.RankId_PersonalId) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for PersonalId.RankId. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(ShowPersonalIdTableQuery.RankId_PersonalId, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by PersonalId.RankId, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + + ' Generate the event handling functions for button events. + + ' event handler for ImageButton + Public Overridable Sub ShowPersonalIdTableAddButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + Me.AddNewRecord = 1 + Me.DataChanged = True + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub ShowPersonalIdTableResetButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.CurrentSortOrder.Reset() + If Me.InSession(Me, "Order_By") Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + + End If + + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + + + ' Generate the event handling functions for filter and search events. + + + ' Generate the event handling functions for others + + + Private _UIData As New System.Collections.Generic.List(Of Hashtable) + Public Property UIData() As System.Collections.Generic.List(Of Hashtable) + Get + Return Me._UIData + End Get + Set(ByVal value As System.Collections.Generic.List(Of Hashtable)) + Me._UIData = value + End Set + End Property + + ' pagination properties + Protected _PageSize As Integer + Public Property PageSize() As Integer + Get + Return Me._PageSize + End Get + Set(ByVal value As Integer) + Me._PageSize = value + End Set + End Property + + Protected _PageIndex As Integer + Public Property PageIndex() As Integer + Get + ' Return the PageIndex + Return Me._PageIndex + End Get + Set(ByVal value As Integer) + Me._PageIndex = value + End Set + End Property + + Protected _TotalRecords As Integer = -1 + Public Property TotalRecords() As Integer + Get + If _TotalRecords < 0 + _TotalRecords = ShowPersonalIdTableQuery.GetRecordCount(CreateCompoundJoinFilter(), CreateWhereClause()) + End If + Return Me._TotalRecords + End Get + Set(ByVal value As Integer) + If Me.PageSize > 0 Then + + Me.TotalPages = CInt(Math.Ceiling(value / Me.PageSize)) + + End If + Me._TotalRecords = value + End Set + End Property + + + + Protected _TotalPages As Integer = -1 + Public Property TotalPages() As Integer + Get + If _TotalPages < 0 Then + + Me.TotalPages = CInt(Math.Ceiling(TotalRecords / Me.PageSize)) + + End If + Return Me._TotalPages + End Get + Set(ByVal value As Integer) + Me._TotalPages = value + End Set + End Property + + Protected _DisplayLastPage As Boolean + Public Property DisplayLastPage() As Boolean + Get + Return Me._DisplayLastPage + End Get + Set(ByVal value As Boolean) + Me._DisplayLastPage = value + End Set + End Property + + Private _DataChanged As Boolean = False + Public Property DataChanged() As Boolean + Get + Return Me._DataChanged + End Get + Set(ByVal value As Boolean) + Me._DataChanged = value + End Set + End Property + + Private _ResetData As Boolean = False + Public Property ResetData() As Boolean + Get + Return Me._ResetData + End Get + Set(ByVal value As Boolean) + Me._ResetData = value + End Set + End Property + + Private _AddNewRecord As Integer = 0 + Public Property AddNewRecord() As Integer + Get + Return Me._AddNewRecord + End Get + Set(ByVal value As Integer) + Me._AddNewRecord = value + End Set + End Property + + + Private _CurrentSortOrder As OrderBy = Nothing + Public Property CurrentSortOrder() As OrderBy + Get + Return Me._CurrentSortOrder + End Get + Set(ByVal value As BaseClasses.Data.OrderBy) + Me._CurrentSortOrder = value + End Set + End Property + + Private _DataSource() As ShowPersonalIdTableRecord = Nothing + Public Property DataSource() As ShowPersonalIdTableRecord () + Get + Return Me._DataSource + End Get + Set(ByVal value() As ShowPersonalIdTableRecord) + Me._DataSource = value + End Set + End Property + +#Region "Helper Properties" + + Public ReadOnly Property PersonalId_AddrLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalId_AddrLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property PersonalId_AmphurLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalId_AmphurLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property PersonalId_BirthDateLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalId_BirthDateLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property PersonalId_BornLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalId_BornLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property PersonalId_DateRankLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalId_DateRankLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property PersonalId_DeptIdLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalId_DeptIdLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property PersonalId_MobilePhoneLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalId_MobilePhoneLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property PersonalId_OfficerDateLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalId_OfficerDateLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property PersonalId_PersonalLastNameLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalId_PersonalLastNameLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property PersonalId_PersonalNameLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalId_PersonalNameLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property PersonalId_pictureLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalId_pictureLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property PersonalId_ProvinceLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalId_ProvinceLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property PersonalId_RankIdLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalId_RankIdLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property ShowPersonalIdTableAddButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "ShowPersonalIdTableAddButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property ShowPersonalIdTablePagination() As Persons.UI.IPagination + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "ShowPersonalIdTablePagination"), Persons.UI.IPagination) + End Get + End Property + + Public ReadOnly Property ShowPersonalIdTableResetButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "ShowPersonalIdTableResetButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property ShowPersonalIdTableTableControlCollapsibleRegion() As System.Web.UI.WebControls.Panel + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "ShowPersonalIdTableTableControlCollapsibleRegion"), System.Web.UI.WebControls.Panel) + End Get + End Property + + Public ReadOnly Property ShowPersonalIdTableToggleAll() As System.Web.UI.WebControls.CheckBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "ShowPersonalIdTableToggleAll"), System.Web.UI.WebControls.CheckBox) + End Get + End Property + +#End Region + +#Region "Helper Functions" + + Public Overrides Overloads Function ModifyRedirectUrl(url As String, arg As String, ByVal bEncrypt As Boolean) As String + Return Me.Page.EvaluateExpressions(url, arg, bEncrypt, Me) + End Function + + Public Overrides Overloads Function EvaluateExpressions(url As String, arg As String, ByVal bEncrypt As Boolean) As String + Dim needToProcess As Boolean = AreAnyUrlParametersForMe(url, arg) + If (needToProcess) Then + Dim recCtl As ShowPersonalIdTableTableControlRow = Me.GetSelectedRecordControl() + If recCtl Is Nothing AndAlso url.IndexOf("{") >= 0 Then + ' Localization. + Throw New Exception(Page.GetResourceValue("Err:NoRecSelected", "Persons")) + End If + Dim rec As ShowPersonalIdTableRecord = Nothing + If recCtl IsNot Nothing Then + rec = recCtl.GetRecord() + End If + Return EvaluateExpressions(url, arg, rec, bEncrypt) + End If + Return url + End Function + + Public Overridable Function GetSelectedRecordIndex() As Integer + Dim counter As Integer = 0 + Dim recControl As ShowPersonalIdTableTableControlRow + For Each recControl In Me.GetRecordControls() + If recControl.ShowPersonalIdTableRecordRowSelection.Checked Then + Return counter + End If + counter += 1 + Next + Return -1 + End Function + + Public Overridable Function GetSelectedRecordControl() As ShowPersonalIdTableTableControlRow + Dim selectedList() As ShowPersonalIdTableTableControlRow = Me.GetSelectedRecordControls() + If selectedList.Length = 0 Then + Return Nothing + End If + Return selectedList(0) + + End Function + + Public Overridable Function GetSelectedRecordControls() As ShowPersonalIdTableTableControlRow() + + Dim selectedList As ArrayList = New ArrayList(25) + Dim recControl As ShowPersonalIdTableTableControlRow + For Each recControl In Me.GetRecordControls() + If recControl.ShowPersonalIdTableRecordRowSelection IsNot Nothing AndAlso recControl.ShowPersonalIdTableRecordRowSelection.Checked Then + selectedList.Add(recControl) + End If + Next + Return DirectCast(selectedList.ToArray(GetType(ShowPersonalIdTableTableControlRow)), ShowPersonalIdTableTableControlRow()) + + End Function + + Public Overridable Sub DeleteSelectedRecords(ByVal deferDeletion As Boolean) + Dim recList() As ShowPersonalIdTableTableControlRow = Me.GetSelectedRecordControls() + If recList.Length = 0 Then + ' Localization. + Throw New Exception(Page.GetResourceValue("Err:NoRecSelected", "Persons")) + End If + + Dim recCtl As ShowPersonalIdTableTableControlRow + For Each recCtl In recList + If deferDeletion Then + If Not recCtl.IsNewRecord Then + + Me.AddToDeletedRecordIds(recCtl) + + End If + recCtl.Visible = False + + recCtl.ShowPersonalIdTableRecordRowSelection.Checked = False + + Else + + recCtl.Delete() + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + End If + Next + End Sub + + Public Function GetRecordControls() As ShowPersonalIdTableTableControlRow() + Dim recList As ArrayList = New ArrayList() + Dim rep As System.Web.UI.WebControls.Repeater = CType(Me.FindControl("ShowPersonalIdTableTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return Nothing + Dim repItem As System.Web.UI.WebControls.RepeaterItem + + For Each repItem In rep.Items + + Dim recControl As ShowPersonalIdTableTableControlRow = DirectCast(repItem.FindControl("ShowPersonalIdTableTableControlRow"), ShowPersonalIdTableTableControlRow) + recList.Add(recControl) + + Next + + Return DirectCast(recList.ToArray(GetType(ShowPersonalIdTableTableControlRow)), ShowPersonalIdTableTableControlRow()) + End Function + + Public Shadows ReadOnly Property Page() As BaseApplicationPage + Get + Return DirectCast(MyBase.Page, BaseApplicationPage) + End Get + End Property + +#End Region + + + +End Class + + +' Base class for the PersonalIdRecordControl control on the AddPersonalId page. +' Do not modify this class. Instead override any method in PersonalIdRecordControl. +Public Class BasePersonalIdRecordControl + Inherits Persons.UI.BaseApplicationRecordControl + + ' To customize, override this method in PersonalIdRecordControl. + Protected Overridable Sub Control_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Init + + ' Setup the filter and search events. + + Me.ClearControlsFromSession() + End Sub + + ' To customize, override this method in PersonalIdRecordControl. + Protected Overridable Sub Control_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load + + Me.Page.ClientScript.RegisterOnSubmitStatement(Commission.GetType(), "Commission", "FCKUpdateLinkedField('" + Commission.ClientID + "');") + + ' Setup the pagination events. + + + ' Register the event handlers. + + AddHandler Me.ArmId.SelectedIndexChanged, AddressOf ArmId_SelectedIndexChanged + + AddHandler Me.ArmyId.SelectedIndexChanged, AddressOf ArmyId_SelectedIndexChanged + + AddHandler Me.BloodId.SelectedIndexChanged, AddressOf BloodId_SelectedIndexChanged + + AddHandler Me.RankId.SelectedIndexChanged, AddressOf RankId_SelectedIndexChanged + + AddHandler Me.SectionId.SelectedIndexChanged, AddressOf SectionId_SelectedIndexChanged + + AddHandler Me.StatusId.SelectedIndexChanged, AddressOf StatusId_SelectedIndexChanged + + AddHandler Me.Addr.TextChanged, AddressOf Addr_TextChanged + + AddHandler Me.Amphur.TextChanged, AddressOf Amphur_TextChanged + + AddHandler Me.ArmyWelfareMemId.TextChanged, AddressOf ArmyWelfareMemId_TextChanged + + AddHandler Me.BAmphur.TextChanged, AddressOf BAmphur_TextChanged + + AddHandler Me.BirthDate.TextChanged, AddressOf BirthDate_TextChanged + + AddHandler Me.Born.TextChanged, AddressOf Born_TextChanged + + AddHandler Me.BProvince.TextChanged, AddressOf BProvince_TextChanged + + AddHandler Me.CremateMemId.TextChanged, AddressOf CremateMemId_TextChanged + + AddHandler Me.DatePrevRank.TextChanged, AddressOf DatePrevRank_TextChanged + + AddHandler Me.DateRank.TextChanged, AddressOf DateRank_TextChanged + + AddHandler Me.DeptId.TextChanged, AddressOf DeptId_TextChanged + + AddHandler Me.MId.TextChanged, AddressOf MId_TextChanged + + AddHandler Me.MobilePhone.TextChanged, AddressOf MobilePhone_TextChanged + + AddHandler Me.Nationality.TextChanged, AddressOf Nationality_TextChanged + + AddHandler Me.OfficerDate.TextChanged, AddressOf OfficerDate_TextChanged + + AddHandler Me.Origin.TextChanged, AddressOf Origin_TextChanged + + AddHandler Me.PersonalId.TextChanged, AddressOf PersonalId_TextChanged + + AddHandler Me.PersonalLastName.TextChanged, AddressOf PersonalLastName_TextChanged + + AddHandler Me.PersonalName.TextChanged, AddressOf PersonalName_TextChanged + + AddHandler Me.Phone.TextChanged, AddressOf Phone_TextChanged + + AddHandler Me.PhoneExt.TextChanged, AddressOf PhoneExt_TextChanged + + AddHandler Me.PlaceOfBirth.TextChanged, AddressOf PlaceOfBirth_TextChanged + + AddHandler Me.PostCode.TextChanged, AddressOf PostCode_TextChanged + + AddHandler Me.Province.TextChanged, AddressOf Province_TextChanged + + AddHandler Me.RegDate.TextChanged, AddressOf RegDate_TextChanged + + AddHandler Me.RegNo1.TextChanged, AddressOf RegNo1_TextChanged + + AddHandler Me.RegNo2.TextChanged, AddressOf RegNo2_TextChanged + + AddHandler Me.Religion.TextChanged, AddressOf Religion_TextChanged + + AddHandler Me.Sex.TextChanged, AddressOf Sex_TextChanged + + AddHandler Me.TId.TextChanged, AddressOf TId_TextChanged + + + End Sub + + + Public Overridable Sub LoadData() + + ' Load the data from the database into the DataSource PersonalId record. + ' It is better to make changes to functions called by LoadData such as + ' CreateWhereClause, rather than making changes here. + + ' 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 = PersonalIdTable.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() + + ' If there is no Where clause, then simply create a new, blank record. + + If wc Is Nothing OrElse Not wc.RunQuery Then + Me.DataSource = New PersonalIdRecord() + + Return + End If + + ' Retrieve the record from the database. It is possible + + Dim recList() As PersonalIdRecord = PersonalIdTable.GetRecords(wc, Nothing, 0, 2) + If recList.Length = 0 Then + ' There is no data for this Where clause. + wc.RunQuery = False + + Return + End If + + ' Set DataSource based on record retrieved from the database. + Me.DataSource = CType(PersonalIdRecord.Copy(recList(0), False), PersonalIdRecord) + + + + End Sub + + ' Populate the UI controls using the DataSource. To customize, override this method in PersonalIdRecordControl. + Public Overrides Sub DataBind() + ' The DataBind method binds the user interface controls to the values + ' from the database record. To do this, it calls the Set methods for + ' each of the field displayed on the webpage. It is better to make + ' changes in the Set methods, rather than making changes here. + + MyBase.DataBind() + + ' Make sure that the DataSource is initialized. + If Me.DataSource Is Nothing Then + + Return + End If + + + 'LoadData for DataSource for chart and report if they exist + + + + ' Call the Set methods for each controls on the panel + + SetAddr() + SetAddrLabel() + SetAmphur() + SetAmphurLabel() + SetArmId() + SetArmIdLabel() + SetArmyId() + SetArmyIdLabel() + SetArmyWelfareMemId() + SetArmyWelfareMemIdLabel() + SetBAmphur() + SetBAmphurLabel() + SetBirthDate() + SetBirthDateLabel() + SetBloodId() + SetBloodIdLabel() + SetBorn() + SetBornLabel() + SetBProvince() + SetBProvinceLabel() + SetCommission() + SetCommissionLabel() + SetCremateMemId() + SetCremateMemIdLabel() + SetDatePrevRank() + SetDatePrevRankLabel() + SetDateRank() + SetDateRankLabel() + SetDeptId() + SetDeptIdLabel() + SetMId() + SetMIdLabel() + SetMobilePhone() + SetMobilePhoneLabel() + SetNationality() + SetNationalityLabel() + SetOfficerDate() + SetOfficerDateLabel() + SetOrigin() + SetOriginLabel() + SetPersonalId() + SetPersonalIdLabel() + SetPersonalIdRecordControlCollapsibleRegion() + SetPersonalIdRecordControlIcon() + SetPersonalIdRecordControlPanelExtender() + + SetPersonalLastName() + SetPersonalLastNameLabel() + SetPersonalName() + SetPersonalNameLabel() + SetPhone() + SetPhoneExt() + SetPhoneExtLabel() + SetPhoneLabel() + + SetpictureLabel() + SetPlaceOfBirth() + SetPlaceOfBirthLabel() + SetPostCode() + SetPostCodeLabel() + SetProvince() + SetProvinceLabel() + SetRankId() + SetRankIdLabel() + SetRegDate() + SetRegDateLabel() + SetRegNo1() + SetRegNo1Label() + SetRegNo2() + SetRegNo2Label() + SetReligion() + SetReligionLabel() + SetSectionId() + SetSectionIdLabel() + SetSex() + SetSexLabel() + SetStatusId() + SetStatusIdLabel() + SetTId() + SetTIdLabel() + + + 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 + + Dim recPersonalDailyJobTableControl as PersonalDailyJobTableControl = DirectCast(MiscUtils.FindControlRecursively(Me.Page, "PersonalDailyJobTableControl"), PersonalDailyJobTableControl) + + If (shouldResetControl OrElse Me.Page.IsPageRefresh) + recPersonalDailyJobTableControl.ResetControl() + End IF + + recPersonalDailyJobTableControl.LoadData() + recPersonalDailyJobTableControl.DataBind() + + Dim recPersonalDDTableControl as PersonalDDTableControl = DirectCast(MiscUtils.FindControlRecursively(Me.Page, "PersonalDDTableControl"), PersonalDDTableControl) + + If (shouldResetControl OrElse Me.Page.IsPageRefresh) + recPersonalDDTableControl.ResetControl() + End IF + + recPersonalDDTableControl.LoadData() + recPersonalDDTableControl.DataBind() + + Dim recPersonalEducationTableControl as PersonalEducationTableControl = DirectCast(MiscUtils.FindControlRecursively(Me.Page, "PersonalEducationTableControl"), PersonalEducationTableControl) + + If (shouldResetControl OrElse Me.Page.IsPageRefresh) + recPersonalEducationTableControl.ResetControl() + End IF + + recPersonalEducationTableControl.LoadData() + recPersonalEducationTableControl.DataBind() + + Dim recPersonalExtWorkTableControl as PersonalExtWorkTableControl = DirectCast(MiscUtils.FindControlRecursively(Me.Page, "PersonalExtWorkTableControl"), PersonalExtWorkTableControl) + + If (shouldResetControl OrElse Me.Page.IsPageRefresh) + recPersonalExtWorkTableControl.ResetControl() + End IF + + recPersonalExtWorkTableControl.LoadData() + recPersonalExtWorkTableControl.DataBind() + + Dim recPersonalInsigniaTableControl as PersonalInsigniaTableControl = DirectCast(MiscUtils.FindControlRecursively(Me.Page, "PersonalInsigniaTableControl"), PersonalInsigniaTableControl) + + If (shouldResetControl OrElse Me.Page.IsPageRefresh) + recPersonalInsigniaTableControl.ResetControl() + End IF + + recPersonalInsigniaTableControl.LoadData() + recPersonalInsigniaTableControl.DataBind() + + Dim recPersonalLanguageSkillTableControl as PersonalLanguageSkillTableControl = DirectCast(MiscUtils.FindControlRecursively(Me.Page, "PersonalLanguageSkillTableControl"), PersonalLanguageSkillTableControl) + + If (shouldResetControl OrElse Me.Page.IsPageRefresh) + recPersonalLanguageSkillTableControl.ResetControl() + End IF + + recPersonalLanguageSkillTableControl.LoadData() + recPersonalLanguageSkillTableControl.DataBind() + + Dim recPersonalNameTableControl as PersonalNameTableControl = DirectCast(MiscUtils.FindControlRecursively(Me.Page, "PersonalNameTableControl"), PersonalNameTableControl) + + If (shouldResetControl OrElse Me.Page.IsPageRefresh) + recPersonalNameTableControl.ResetControl() + End IF + + recPersonalNameTableControl.LoadData() + recPersonalNameTableControl.DataBind() + + Dim recPersonalRankTableControl as PersonalRankTableControl = DirectCast(MiscUtils.FindControlRecursively(Me.Page, "PersonalRankTableControl"), PersonalRankTableControl) + + If (shouldResetControl OrElse Me.Page.IsPageRefresh) + recPersonalRankTableControl.ResetControl() + End IF + + recPersonalRankTableControl.LoadData() + recPersonalRankTableControl.DataBind() + + Dim recPersonalSalaryTableControl as PersonalSalaryTableControl = DirectCast(MiscUtils.FindControlRecursively(Me.Page, "PersonalSalaryTableControl"), PersonalSalaryTableControl) + + If (shouldResetControl OrElse Me.Page.IsPageRefresh) + recPersonalSalaryTableControl.ResetControl() + End IF + + recPersonalSalaryTableControl.LoadData() + recPersonalSalaryTableControl.DataBind() + + Dim recPersonalSpecialSkillTableControl as PersonalSpecialSkillTableControl = DirectCast(MiscUtils.FindControlRecursively(Me.Page, "PersonalSpecialSkillTableControl"), PersonalSpecialSkillTableControl) + + If (shouldResetControl OrElse Me.Page.IsPageRefresh) + recPersonalSpecialSkillTableControl.ResetControl() + End IF + + recPersonalSpecialSkillTableControl.LoadData() + recPersonalSpecialSkillTableControl.DataBind() + + Dim recPersonalSportSkillTableControl as PersonalSportSkillTableControl = DirectCast(MiscUtils.FindControlRecursively(Me.Page, "PersonalSportSkillTableControl"), PersonalSportSkillTableControl) + + If (shouldResetControl OrElse Me.Page.IsPageRefresh) + recPersonalSportSkillTableControl.ResetControl() + End IF + + recPersonalSportSkillTableControl.LoadData() + recPersonalSportSkillTableControl.DataBind() + + Dim recPersonalTitleTableControl as PersonalTitleTableControl = DirectCast(MiscUtils.FindControlRecursively(Me.Page, "PersonalTitleTableControl"), PersonalTitleTableControl) + + If (shouldResetControl OrElse Me.Page.IsPageRefresh) + recPersonalTitleTableControl.ResetControl() + End IF + + recPersonalTitleTableControl.LoadData() + recPersonalTitleTableControl.DataBind() + + Dim recPersonRelativeTableControl as PersonRelativeTableControl = DirectCast(MiscUtils.FindControlRecursively(Me.Page, "PersonRelativeTableControl"), PersonRelativeTableControl) + + If (shouldResetControl OrElse Me.Page.IsPageRefresh) + recPersonRelativeTableControl.ResetControl() + End IF + + recPersonRelativeTableControl.LoadData() + recPersonRelativeTableControl.DataBind() + + Dim recShowPersonalIdTableTableControl as ShowPersonalIdTableTableControl = DirectCast(MiscUtils.FindControlRecursively(Me.Page, "ShowPersonalIdTableTableControl"), ShowPersonalIdTableTableControl) + + If (shouldResetControl OrElse Me.Page.IsPageRefresh) + recShowPersonalIdTableTableControl.ResetControl() + End IF + + recShowPersonalIdTableTableControl.LoadData() + recShowPersonalIdTableTableControl.DataBind() + + End Sub + + + Public Overridable Sub SetAddr() + + + ' Set the Addr TextBox on the webpage with value from the + ' PersonalId database record. + + ' Me.DataSource is the PersonalId record retrieved from the database. + ' Me.Addr is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetAddr() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.AddrSpecified Then + + ' If the Addr is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalIdTable.Addr) + + Me.Addr.Text = formattedValue + + Else + + ' Addr is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.Addr.Text = PersonalIdTable.Addr.Format(PersonalIdTable.Addr.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetAmphur() + + + ' Set the Amphur TextBox on the webpage with value from the + ' PersonalId database record. + + ' Me.DataSource is the PersonalId record retrieved from the database. + ' Me.Amphur is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetAmphur() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.AmphurSpecified Then + + ' If the Amphur is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalIdTable.Amphur) + + Me.Amphur.Text = formattedValue + + Else + + ' Amphur is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.Amphur.Text = PersonalIdTable.Amphur.Format(PersonalIdTable.Amphur.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetArmId() + + + ' Set the ArmId DropDownList on the webpage with value from the + ' PersonalId database record. + + ' Me.DataSource is the PersonalId record retrieved from the database. + ' Me.ArmId is the ASP:DropDownList on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetArmId() + ' and add your own code before or after the call to the MyBase function. + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.ArmIdSpecified Then + + ' If the ArmId is non-NULL, then format the value. + ' The Format method will return the Display Foreign Key As (DFKA) value + Me.PopulateArmIdDropDownList(Me.DataSource.ArmId.ToString(), 100) + + Else + + ' ArmId 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.PopulateArmIdDropDownList(Nothing, 100) + Else + Me.PopulateArmIdDropDownList(PersonalIdTable.ArmId.DefaultValue, 100) + End If + + End If + + End Sub + + Public Overridable Sub SetArmyId() + + + ' Set the ArmyId DropDownList on the webpage with value from the + ' PersonalId database record. + + ' Me.DataSource is the PersonalId record retrieved from the database. + ' Me.ArmyId is the ASP:DropDownList on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetArmyId() + ' and add your own code before or after the call to the MyBase function. + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.ArmyIdSpecified Then + + ' If the ArmyId is non-NULL, then format the value. + ' The Format method will return the Display Foreign Key As (DFKA) value + Me.PopulateArmyIdDropDownList(Me.DataSource.ArmyId.ToString(), 100) + + Else + + ' ArmyId 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.PopulateArmyIdDropDownList(Nothing, 100) + Else + Me.PopulateArmyIdDropDownList(PersonalIdTable.ArmyId.DefaultValue, 100) + End If + + End If + + End Sub + + Public Overridable Sub SetArmyWelfareMemId() + + + ' Set the ArmyWelfareMemId TextBox on the webpage with value from the + ' PersonalId database record. + + ' Me.DataSource is the PersonalId record retrieved from the database. + ' Me.ArmyWelfareMemId is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetArmyWelfareMemId() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.ArmyWelfareMemIdSpecified Then + + ' If the ArmyWelfareMemId is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalIdTable.ArmyWelfareMemId) + + Me.ArmyWelfareMemId.Text = formattedValue + + Else + + ' ArmyWelfareMemId is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.ArmyWelfareMemId.Text = PersonalIdTable.ArmyWelfareMemId.Format(PersonalIdTable.ArmyWelfareMemId.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetBAmphur() + + + ' Set the BAmphur TextBox on the webpage with value from the + ' PersonalId database record. + + ' Me.DataSource is the PersonalId record retrieved from the database. + ' Me.BAmphur is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetBAmphur() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.BAmphurSpecified Then + + ' If the BAmphur is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalIdTable.BAmphur) + + Me.BAmphur.Text = formattedValue + + Else + + ' BAmphur is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.BAmphur.Text = PersonalIdTable.BAmphur.Format(PersonalIdTable.BAmphur.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetBirthDate() + + + ' Set the BirthDate TextBox on the webpage with value from the + ' PersonalId database record. + + ' Me.DataSource is the PersonalId record retrieved from the database. + ' Me.BirthDate is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetBirthDate() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.BirthDateSpecified Then + + ' If the BirthDate is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalIdTable.BirthDate, "d MMM yy") + + Me.BirthDate.Text = formattedValue + + Else + + ' BirthDate is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.BirthDate.Text = PersonalIdTable.BirthDate.Format(PersonalIdTable.BirthDate.DefaultValue, "d MMM yy") + + End If + + End Sub + + Public Overridable Sub SetBloodId() + + + ' Set the BloodId DropDownList on the webpage with value from the + ' PersonalId database record. + + ' Me.DataSource is the PersonalId record retrieved from the database. + ' Me.BloodId is the ASP:DropDownList on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetBloodId() + ' and add your own code before or after the call to the MyBase function. + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.BloodIdSpecified Then + + ' If the BloodId is non-NULL, then format the value. + ' The Format method will return the Display Foreign Key As (DFKA) value + Me.PopulateBloodIdDropDownList(Me.DataSource.BloodId.ToString(), 100) + + Else + + ' BloodId 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.PopulateBloodIdDropDownList(Nothing, 100) + Else + Me.PopulateBloodIdDropDownList(PersonalIdTable.BloodId.DefaultValue, 100) + End If + + End If + + End Sub + + Public Overridable Sub SetBorn() + + + ' Set the Born TextBox on the webpage with value from the + ' PersonalId database record. + + ' Me.DataSource is the PersonalId record retrieved from the database. + ' Me.Born is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetBorn() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.BornSpecified Then + + ' If the Born is non-NULL, then format the value. + + ' The Format method will return the Display Foreign Key As (DFKA) value + Dim formattedValue As String = Me.DataSource.Born.ToString() + + + Me.Born.Text = formattedValue + + Else + + ' Born is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.Born.Text = PersonalIdTable.Born.DefaultValue + End If + + End Sub + + Public Overridable Sub SetBProvince() + + + ' Set the BProvince TextBox on the webpage with value from the + ' PersonalId database record. + + ' Me.DataSource is the PersonalId record retrieved from the database. + ' Me.BProvince is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetBProvince() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.BProvinceSpecified Then + + ' If the BProvince is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalIdTable.BProvince) + + Me.BProvince.Text = formattedValue + + Else + + ' BProvince is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.BProvince.Text = PersonalIdTable.BProvince.Format(PersonalIdTable.BProvince.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetCommission() + + + ' Set the Commission TextBox on the webpage with value from the + ' PersonalId database record. + + ' Me.DataSource is the PersonalId record retrieved from the database. + ' Me.Commission is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetCommission() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.CommissionSpecified Then + + ' If the Commission is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalIdTable.Commission) + + Me.Commission.Value = formattedValue + Me.Commission.DefaultLanguage = System.Threading.Thread.CurrentThread.CurrentUICulture.Name + + Else + + ' Commission is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.Commission.DefaultLanguage = System.Threading.Thread.CurrentThread.CurrentUICulture.Name + Me.Commission.Value = PersonalIdTable.Commission.Format(PersonalIdTable.Commission.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetCremateMemId() + + + ' Set the CremateMemId TextBox on the webpage with value from the + ' PersonalId database record. + + ' Me.DataSource is the PersonalId record retrieved from the database. + ' Me.CremateMemId is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetCremateMemId() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.CremateMemIdSpecified Then + + ' If the CremateMemId is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalIdTable.CremateMemId) + + Me.CremateMemId.Text = formattedValue + + Else + + ' CremateMemId is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.CremateMemId.Text = PersonalIdTable.CremateMemId.Format(PersonalIdTable.CremateMemId.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetDatePrevRank() + + + ' Set the DatePrevRank TextBox on the webpage with value from the + ' PersonalId database record. + + ' Me.DataSource is the PersonalId record retrieved from the database. + ' Me.DatePrevRank is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetDatePrevRank() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.DatePrevRankSpecified Then + + ' If the DatePrevRank is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalIdTable.DatePrevRank, "d") + + Me.DatePrevRank.Text = formattedValue + + Else + + ' DatePrevRank is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.DatePrevRank.Text = PersonalIdTable.DatePrevRank.Format(PersonalIdTable.DatePrevRank.DefaultValue, "d") + + End If + + End Sub + + Public Overridable Sub SetDateRank() + + + ' Set the DateRank TextBox on the webpage with value from the + ' PersonalId database record. + + ' Me.DataSource is the PersonalId record retrieved from the database. + ' Me.DateRank is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetDateRank() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.DateRankSpecified Then + + ' If the DateRank is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalIdTable.DateRank, "d") + + Me.DateRank.Text = formattedValue + + Else + + ' DateRank is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.DateRank.Text = PersonalIdTable.DateRank.Format(PersonalIdTable.DateRank.DefaultValue, "d") + + End If + + End Sub + + Public Overridable Sub SetDeptId() + + + ' Set the DeptId TextBox on the webpage with value from the + ' PersonalId database record. + + ' Me.DataSource is the PersonalId record retrieved from the database. + ' Me.DeptId is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetDeptId() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.DeptIdSpecified Then + + ' If the DeptId is non-NULL, then format the value. + + ' The Format method will return the Display Foreign Key As (DFKA) value + Dim formattedValue As String = Me.DataSource.DeptId.ToString() + + + Me.DeptId.Text = formattedValue + + Else + + ' DeptId is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.DeptId.Text = PersonalIdTable.DeptId.DefaultValue + End If + + End Sub + + Public Overridable Sub SetMId() + + + ' Set the MId TextBox on the webpage with value from the + ' PersonalId database record. + + ' Me.DataSource is the PersonalId record retrieved from the database. + ' Me.MId is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetMId() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.MIdSpecified Then + + ' If the MId is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalIdTable.MId) + + Me.MId.Text = formattedValue + + Else + + ' MId is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.MId.Text = PersonalIdTable.MId.Format(PersonalIdTable.MId.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetMobilePhone() + + + ' Set the MobilePhone TextBox on the webpage with value from the + ' PersonalId database record. + + ' Me.DataSource is the PersonalId record retrieved from the database. + ' Me.MobilePhone is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetMobilePhone() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.MobilePhoneSpecified Then + + ' If the MobilePhone is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalIdTable.MobilePhone) + + Me.MobilePhone.Text = formattedValue + + Else + + ' MobilePhone is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.MobilePhone.Text = PersonalIdTable.MobilePhone.Format(PersonalIdTable.MobilePhone.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetNationality() + + + ' Set the Nationality TextBox on the webpage with value from the + ' PersonalId database record. + + ' Me.DataSource is the PersonalId record retrieved from the database. + ' Me.Nationality is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetNationality() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.NationalitySpecified Then + + ' If the Nationality is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalIdTable.Nationality) + + Me.Nationality.Text = formattedValue + + Else + + ' Nationality is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.Nationality.Text = PersonalIdTable.Nationality.Format(PersonalIdTable.Nationality.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetOfficerDate() + + + ' Set the OfficerDate TextBox on the webpage with value from the + ' PersonalId database record. + + ' Me.DataSource is the PersonalId record retrieved from the database. + ' Me.OfficerDate is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetOfficerDate() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.OfficerDateSpecified Then + + ' If the OfficerDate is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalIdTable.OfficerDate, "d MMM yy") + + Me.OfficerDate.Text = formattedValue + + Else + + ' OfficerDate is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.OfficerDate.Text = PersonalIdTable.OfficerDate.Format(PersonalIdTable.OfficerDate.DefaultValue, "d MMM yy") + + End If + + End Sub + + Public Overridable Sub SetOrigin() + + + ' Set the Origin TextBox on the webpage with value from the + ' PersonalId database record. + + ' Me.DataSource is the PersonalId record retrieved from the database. + ' Me.Origin is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetOrigin() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.OriginSpecified Then + + ' If the Origin is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalIdTable.Origin) + + Me.Origin.Text = formattedValue + + Else + + ' Origin is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.Origin.Text = PersonalIdTable.Origin.Format(PersonalIdTable.Origin.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetPersonalId() + + + ' Set the PersonalId TextBox on the webpage with value from the + ' PersonalId database record. + + ' Me.DataSource is the PersonalId record retrieved from the database. + ' Me.PersonalId is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetPersonalId() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.PersonalIdSpecified Then + + ' If the PersonalId is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalIdTable.PersonalId) + + Me.PersonalId.Text = formattedValue + + Else + + ' PersonalId is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.PersonalId.Text = PersonalIdTable.PersonalId.Format(PersonalIdTable.PersonalId.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetPersonalLastName() + + + ' Set the PersonalLastName TextBox on the webpage with value from the + ' PersonalId database record. + + ' Me.DataSource is the PersonalId record retrieved from the database. + ' Me.PersonalLastName is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetPersonalLastName() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.PersonalLastNameSpecified Then + + ' If the PersonalLastName is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalIdTable.PersonalLastName) + + Me.PersonalLastName.Text = formattedValue + + Else + + ' PersonalLastName is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.PersonalLastName.Text = PersonalIdTable.PersonalLastName.Format(PersonalIdTable.PersonalLastName.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetPersonalName() + + + ' Set the PersonalName TextBox on the webpage with value from the + ' PersonalId database record. + + ' Me.DataSource is the PersonalId record retrieved from the database. + ' Me.PersonalName is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetPersonalName() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.PersonalNameSpecified Then + + ' If the PersonalName is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalIdTable.PersonalName) + + Me.PersonalName.Text = formattedValue + + Else + + ' PersonalName is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.PersonalName.Text = PersonalIdTable.PersonalName.Format(PersonalIdTable.PersonalName.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetPhone() + + + ' Set the Phone TextBox on the webpage with value from the + ' PersonalId database record. + + ' Me.DataSource is the PersonalId record retrieved from the database. + ' Me.Phone is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetPhone() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.PhoneSpecified Then + + ' If the Phone is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalIdTable.Phone) + + Me.Phone.Text = formattedValue + + Else + + ' Phone is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.Phone.Text = PersonalIdTable.Phone.Format(PersonalIdTable.Phone.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetPhoneExt() + + + ' Set the PhoneExt TextBox on the webpage with value from the + ' PersonalId database record. + + ' Me.DataSource is the PersonalId record retrieved from the database. + ' Me.PhoneExt is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetPhoneExt() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.PhoneExtSpecified Then + + ' If the PhoneExt is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalIdTable.PhoneExt) + + Me.PhoneExt.Text = formattedValue + + Else + + ' PhoneExt is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.PhoneExt.Text = PersonalIdTable.PhoneExt.Format(PersonalIdTable.PhoneExt.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetPlaceOfBirth() + + + ' Set the PlaceOfBirth TextBox on the webpage with value from the + ' PersonalId database record. + + ' Me.DataSource is the PersonalId record retrieved from the database. + ' Me.PlaceOfBirth is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetPlaceOfBirth() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.PlaceOfBirthSpecified Then + + ' If the PlaceOfBirth is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalIdTable.PlaceOfBirth) + + Me.PlaceOfBirth.Text = formattedValue + + Else + + ' PlaceOfBirth is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.PlaceOfBirth.Text = PersonalIdTable.PlaceOfBirth.Format(PersonalIdTable.PlaceOfBirth.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetPostCode() + + + ' Set the PostCode TextBox on the webpage with value from the + ' PersonalId database record. + + ' Me.DataSource is the PersonalId record retrieved from the database. + ' Me.PostCode is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetPostCode() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.PostCodeSpecified Then + + ' If the PostCode is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalIdTable.PostCode) + + Me.PostCode.Text = formattedValue + + Else + + ' PostCode is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.PostCode.Text = PersonalIdTable.PostCode.Format(PersonalIdTable.PostCode.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetProvince() + + + ' Set the Province TextBox on the webpage with value from the + ' PersonalId database record. + + ' Me.DataSource is the PersonalId record retrieved from the database. + ' Me.Province is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetProvince() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.ProvinceSpecified Then + + ' If the Province is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalIdTable.Province) + + Me.Province.Text = formattedValue + + Else + + ' Province is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.Province.Text = PersonalIdTable.Province.Format(PersonalIdTable.Province.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetRankId() + + + ' Set the RankId DropDownList on the webpage with value from the + ' PersonalId database record. + + ' Me.DataSource is the PersonalId record retrieved from the database. + ' Me.RankId is the ASP:DropDownList on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetRankId() + ' and add your own code before or after the call to the MyBase function. + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.RankIdSpecified Then + + ' If the RankId is non-NULL, then format the value. + ' The Format method will use the Display Format + Me.PopulateRankIdDropDownList(Me.DataSource.RankId.ToString(), 100) + + Else + + ' RankId 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.PopulateRankIdDropDownList(Nothing, 100) + Else + Me.PopulateRankIdDropDownList(PersonalIdTable.RankId.DefaultValue, 100) + End If + + End If + + End Sub + + Public Overridable Sub SetRegDate() + + + ' Set the RegDate TextBox on the webpage with value from the + ' PersonalId database record. + + ' Me.DataSource is the PersonalId record retrieved from the database. + ' Me.RegDate is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetRegDate() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.RegDateSpecified Then + + ' If the RegDate is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalIdTable.RegDate, "d MMM yy") + + Me.RegDate.Text = formattedValue + + Else + + ' RegDate is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.RegDate.Text = PersonalIdTable.RegDate.Format(PersonalIdTable.RegDate.DefaultValue, "d MMM yy") + + End If + + End Sub + + Public Overridable Sub SetRegNo1() + + + ' Set the RegNo1 TextBox on the webpage with value from the + ' PersonalId database record. + + ' Me.DataSource is the PersonalId record retrieved from the database. + ' Me.RegNo1 is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetRegNo1() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.RegNo1Specified Then + + ' If the RegNo1 is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalIdTable.RegNo1) + + Me.RegNo1.Text = formattedValue + + Else + + ' RegNo1 is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.RegNo1.Text = PersonalIdTable.RegNo1.Format(PersonalIdTable.RegNo1.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetRegNo2() + + + ' Set the RegNo2 TextBox on the webpage with value from the + ' PersonalId database record. + + ' Me.DataSource is the PersonalId record retrieved from the database. + ' Me.RegNo2 is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetRegNo2() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.RegNo2Specified Then + + ' If the RegNo2 is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalIdTable.RegNo2) + + Me.RegNo2.Text = formattedValue + + Else + + ' RegNo2 is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.RegNo2.Text = PersonalIdTable.RegNo2.Format(PersonalIdTable.RegNo2.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetReligion() + + + ' Set the Religion TextBox on the webpage with value from the + ' PersonalId database record. + + ' Me.DataSource is the PersonalId record retrieved from the database. + ' Me.Religion is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetReligion() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.ReligionSpecified Then + + ' If the Religion is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalIdTable.Religion) + + Me.Religion.Text = formattedValue + + Else + + ' Religion is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.Religion.Text = PersonalIdTable.Religion.Format(PersonalIdTable.Religion.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetSectionId() + + + ' Set the SectionId DropDownList on the webpage with value from the + ' PersonalId database record. + + ' Me.DataSource is the PersonalId record retrieved from the database. + ' Me.SectionId is the ASP:DropDownList on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetSectionId() + ' and add your own code before or after the call to the MyBase function. + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.SectionIdSpecified Then + + ' If the SectionId is non-NULL, then format the value. + ' The Format method will return the Display Foreign Key As (DFKA) value + Me.PopulateSectionIdDropDownList(Me.DataSource.SectionId.ToString(), 100) + + Else + + ' SectionId 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.PopulateSectionIdDropDownList(Nothing, 100) + Else + Me.PopulateSectionIdDropDownList(PersonalIdTable.SectionId.DefaultValue, 100) + End If + + End If + + End Sub + + Public Overridable Sub SetSex() + + + ' Set the Sex TextBox on the webpage with value from the + ' PersonalId database record. + + ' Me.DataSource is the PersonalId record retrieved from the database. + ' Me.Sex is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetSex() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.SexSpecified Then + + ' If the Sex is non-NULL, then format the value. + + ' The Format method will return the Display Foreign Key As (DFKA) value + Dim formattedValue As String = Me.DataSource.Sex.ToString() + + + Me.Sex.Text = formattedValue + + Else + + ' Sex is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.Sex.Text = PersonalIdTable.Sex.DefaultValue + End If + + End Sub + + Public Overridable Sub SetStatusId() + + + ' Set the StatusId DropDownList on the webpage with value from the + ' PersonalId database record. + + ' Me.DataSource is the PersonalId record retrieved from the database. + ' Me.StatusId is the ASP:DropDownList on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetStatusId() + ' and add your own code before or after the call to the MyBase function. + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.StatusIdSpecified Then + + ' If the StatusId is non-NULL, then format the value. + ' The Format method will return the Display Foreign Key As (DFKA) value + Me.PopulateStatusIdDropDownList(Me.DataSource.StatusId.ToString(), 100) + + Else + + ' StatusId 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.PopulateStatusIdDropDownList(Nothing, 100) + Else + Me.PopulateStatusIdDropDownList(PersonalIdTable.StatusId.DefaultValue, 100) + End If + + End If + + End Sub + + Public Overridable Sub SetTId() + + + ' Set the TId TextBox on the webpage with value from the + ' PersonalId database record. + + ' Me.DataSource is the PersonalId record retrieved from the database. + ' Me.TId is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetTId() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.TIdSpecified Then + + ' If the TId is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalIdTable.TId) + + Me.TId.Text = formattedValue + + Else + + ' TId is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.TId.Text = PersonalIdTable.TId.Format(PersonalIdTable.TId.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetAddrLabel() + + End Sub + + Public Overridable Sub SetAmphurLabel() + + End Sub + + Public Overridable Sub SetArmIdLabel() + + End Sub + + Public Overridable Sub SetArmyIdLabel() + + End Sub + + Public Overridable Sub SetArmyWelfareMemIdLabel() + + End Sub + + Public Overridable Sub SetBAmphurLabel() + + End Sub + + Public Overridable Sub SetBirthDateLabel() + + End Sub + + Public Overridable Sub SetBloodIdLabel() + + End Sub + + Public Overridable Sub SetBornLabel() + + End Sub + + Public Overridable Sub SetBProvinceLabel() + + End Sub + + Public Overridable Sub SetCommissionLabel() + + End Sub + + Public Overridable Sub SetCremateMemIdLabel() + + End Sub + + Public Overridable Sub SetDatePrevRankLabel() + + End Sub + + Public Overridable Sub SetDateRankLabel() + + End Sub + + Public Overridable Sub SetDeptIdLabel() + + End Sub + + Public Overridable Sub SetMIdLabel() + + End Sub + + Public Overridable Sub SetMobilePhoneLabel() + + End Sub + + Public Overridable Sub SetNationalityLabel() + + End Sub + + Public Overridable Sub SetOfficerDateLabel() + + End Sub + + Public Overridable Sub SetOriginLabel() + + End Sub + + Public Overridable Sub SetPersonalIdLabel() + + End Sub + + Public Overridable Sub SetPersonalIdRecordControlCollapsibleRegion() + + End Sub + + Public Overridable Sub SetPersonalIdRecordControlIcon() + + End Sub + + Public Overridable Sub SetPersonalIdRecordControlPanelExtender() + + End Sub + + Public Overridable Sub SetPersonalLastNameLabel() + + End Sub + + Public Overridable Sub SetPersonalNameLabel() + + End Sub + + Public Overridable Sub SetPhoneExtLabel() + + End Sub + + Public Overridable Sub SetPhoneLabel() + + End Sub + + Public Overridable Sub SetpictureLabel() + + End Sub + + Public Overridable Sub SetPlaceOfBirthLabel() + + End Sub + + Public Overridable Sub SetPostCodeLabel() + + End Sub + + Public Overridable Sub SetProvinceLabel() + + End Sub + + Public Overridable Sub SetRankIdLabel() + + End Sub + + Public Overridable Sub SetRegDateLabel() + + End Sub + + Public Overridable Sub SetRegNo1Label() + + End Sub + + Public Overridable Sub SetRegNo2Label() + + End Sub + + Public Overridable Sub SetReligionLabel() + + End Sub + + Public Overridable Sub SetSectionIdLabel() + + End Sub + + Public Overridable Sub SetSexLabel() + + End Sub + + Public Overridable Sub SetStatusIdLabel() + + End Sub + + Public Overridable Sub SetTIdLabel() + + 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 PersonalIdRecordControl. + Public Overridable Sub SaveData() + ' Saves the associated record in the database. + ' SaveData calls Validate and Get methods - so it may be more appropriate to + ' customize those methods. + + ' 1. Load the existing record from the database. Since we save the entire record, this ensures + ' that fields that are not displayed are also properly initialized. + Me.LoadData() + + + ' 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) + + Dim recPersonalDailyJobTableControl as PersonalDailyJobTableControl = DirectCast(MiscUtils.FindControlRecursively(Me.Page, "PersonalDailyJobTableControl"), PersonalDailyJobTableControl) + recPersonalDailyJobTableControl.SaveData() + + Dim recPersonalDDTableControl as PersonalDDTableControl = DirectCast(MiscUtils.FindControlRecursively(Me.Page, "PersonalDDTableControl"), PersonalDDTableControl) + recPersonalDDTableControl.SaveData() + + Dim recPersonalEducationTableControl as PersonalEducationTableControl = DirectCast(MiscUtils.FindControlRecursively(Me.Page, "PersonalEducationTableControl"), PersonalEducationTableControl) + recPersonalEducationTableControl.SaveData() + + Dim recPersonalExtWorkTableControl as PersonalExtWorkTableControl = DirectCast(MiscUtils.FindControlRecursively(Me.Page, "PersonalExtWorkTableControl"), PersonalExtWorkTableControl) + recPersonalExtWorkTableControl.SaveData() + + Dim recPersonalInsigniaTableControl as PersonalInsigniaTableControl = DirectCast(MiscUtils.FindControlRecursively(Me.Page, "PersonalInsigniaTableControl"), PersonalInsigniaTableControl) + recPersonalInsigniaTableControl.SaveData() + + Dim recPersonalLanguageSkillTableControl as PersonalLanguageSkillTableControl = DirectCast(MiscUtils.FindControlRecursively(Me.Page, "PersonalLanguageSkillTableControl"), PersonalLanguageSkillTableControl) + recPersonalLanguageSkillTableControl.SaveData() + + Dim recPersonalNameTableControl as PersonalNameTableControl = DirectCast(MiscUtils.FindControlRecursively(Me.Page, "PersonalNameTableControl"), PersonalNameTableControl) + recPersonalNameTableControl.SaveData() + + Dim recPersonalRankTableControl as PersonalRankTableControl = DirectCast(MiscUtils.FindControlRecursively(Me.Page, "PersonalRankTableControl"), PersonalRankTableControl) + recPersonalRankTableControl.SaveData() + + Dim recPersonalSalaryTableControl as PersonalSalaryTableControl = DirectCast(MiscUtils.FindControlRecursively(Me.Page, "PersonalSalaryTableControl"), PersonalSalaryTableControl) + recPersonalSalaryTableControl.SaveData() + + Dim recPersonalSpecialSkillTableControl as PersonalSpecialSkillTableControl = DirectCast(MiscUtils.FindControlRecursively(Me.Page, "PersonalSpecialSkillTableControl"), PersonalSpecialSkillTableControl) + recPersonalSpecialSkillTableControl.SaveData() + + Dim recPersonalSportSkillTableControl as PersonalSportSkillTableControl = DirectCast(MiscUtils.FindControlRecursively(Me.Page, "PersonalSportSkillTableControl"), PersonalSportSkillTableControl) + recPersonalSportSkillTableControl.SaveData() + + Dim recPersonalTitleTableControl as PersonalTitleTableControl = DirectCast(MiscUtils.FindControlRecursively(Me.Page, "PersonalTitleTableControl"), PersonalTitleTableControl) + recPersonalTitleTableControl.SaveData() + + Dim recPersonRelativeTableControl as PersonRelativeTableControl = DirectCast(MiscUtils.FindControlRecursively(Me.Page, "PersonRelativeTableControl"), PersonRelativeTableControl) + recPersonRelativeTableControl.SaveData() + + Dim recShowPersonalIdTableTableControl as ShowPersonalIdTableTableControl = DirectCast(MiscUtils.FindControlRecursively(Me.Page, "ShowPersonalIdTableTableControl"), ShowPersonalIdTableTableControl) + recShowPersonalIdTableTableControl.SaveData() + + End Sub + + ' To customize, override this method in PersonalIdRecordControl. + Public Overridable Sub GetUIData() + ' The GetUIData method retrieves the updated values from the user interface + ' controls into a database record in preparation for saving or updating. + ' To do this, it calls the Get methods for each of the field displayed on + ' the webpage. It is better to make changes in the Get methods, rather + ' than making changes here. + + ' Call the Get methods for each of the user interface controls. + + GetAddr() + GetAmphur() + GetArmId() + GetArmyId() + GetArmyWelfareMemId() + GetBAmphur() + GetBirthDate() + GetBloodId() + GetBorn() + GetBProvince() + GetCommission() + GetCremateMemId() + GetDatePrevRank() + GetDateRank() + GetDeptId() + GetMId() + GetMobilePhone() + GetNationality() + GetOfficerDate() + GetOrigin() + GetPersonalId() + GetPersonalLastName() + GetPersonalName() + GetPhone() + GetPhoneExt() + Getpicture() + GetPlaceOfBirth() + GetPostCode() + GetProvince() + GetRankId() + GetRegDate() + GetRegNo1() + GetRegNo2() + GetReligion() + GetSectionId() + GetSex() + GetStatusId() + GetTId() + End Sub + + + Public Overridable Sub GetAddr() + + ' Retrieve the value entered by the user on the Addr ASP:TextBox, and + ' save it into the Addr field in DataSource PersonalId record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.Addr.Text, PersonalIdTable.Addr) + + + End Sub + + Public Overridable Sub GetAmphur() + + ' Retrieve the value entered by the user on the Amphur ASP:TextBox, and + ' save it into the Amphur field in DataSource PersonalId record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.Amphur.Text, PersonalIdTable.Amphur) + + + End Sub + + Public Overridable Sub GetArmId() + + ' Retrieve the value entered by the user on the ArmId ASP:DropDownList, and + ' save it into the ArmId field in DataSource PersonalId record. + + ' Custom validation should be performed in Validate, not here. + + Me.DataSource.Parse(GetValueSelectedPageRequest(Me.ArmId), PersonalIdTable.ArmId) + + End Sub + + Public Overridable Sub GetArmyId() + + ' Retrieve the value entered by the user on the ArmyId ASP:DropDownList, and + ' save it into the ArmyId field in DataSource PersonalId record. + + ' Custom validation should be performed in Validate, not here. + + Me.DataSource.Parse(GetValueSelectedPageRequest(Me.ArmyId), PersonalIdTable.ArmyId) + + End Sub + + Public Overridable Sub GetArmyWelfareMemId() + + ' Retrieve the value entered by the user on the ArmyWelfareMemId ASP:TextBox, and + ' save it into the ArmyWelfareMemId field in DataSource PersonalId record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.ArmyWelfareMemId.Text, PersonalIdTable.ArmyWelfareMemId) + + + End Sub + + Public Overridable Sub GetBAmphur() + + ' Retrieve the value entered by the user on the BAmphur ASP:TextBox, and + ' save it into the BAmphur field in DataSource PersonalId record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.BAmphur.Text, PersonalIdTable.BAmphur) + + + End Sub + + Public Overridable Sub GetBirthDate() + + ' Retrieve the value entered by the user on the BirthDate ASP:TextBox, and + ' save it into the BirthDate field in DataSource PersonalId 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.BirthDate.Text, PersonalIdTable.BirthDate) + + + End Sub + + Public Overridable Sub GetBloodId() + + ' Retrieve the value entered by the user on the BloodId ASP:DropDownList, and + ' save it into the BloodId field in DataSource PersonalId record. + + ' Custom validation should be performed in Validate, not here. + + Me.DataSource.Parse(GetValueSelectedPageRequest(Me.BloodId), PersonalIdTable.BloodId) + + End Sub + + Public Overridable Sub GetBorn() + + ' Retrieve the value entered by the user on the Born ASP:TextBox, and + ' save it into the Born field in DataSource PersonalId record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.Born.Text, PersonalIdTable.Born) + + + End Sub + + Public Overridable Sub GetBProvince() + + ' Retrieve the value entered by the user on the BProvince ASP:TextBox, and + ' save it into the BProvince field in DataSource PersonalId record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.BProvince.Text, PersonalIdTable.BProvince) + + + End Sub + + Public Overridable Sub GetCommission() + + ' Retrieve the value entered by the user on the Commission ASP:TextBox, and + ' save it into the Commission field in DataSource PersonalId record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.Commission.Value, PersonalIdTable.Commission) + + + End Sub + + Public Overridable Sub GetCremateMemId() + + ' Retrieve the value entered by the user on the CremateMemId ASP:TextBox, and + ' save it into the CremateMemId field in DataSource PersonalId record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.CremateMemId.Text, PersonalIdTable.CremateMemId) + + + End Sub + + Public Overridable Sub GetDatePrevRank() + + ' Retrieve the value entered by the user on the DatePrevRank ASP:TextBox, and + ' save it into the DatePrevRank field in DataSource PersonalId 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.DatePrevRank.Text, PersonalIdTable.DatePrevRank) + + + End Sub + + Public Overridable Sub GetDateRank() + + ' Retrieve the value entered by the user on the DateRank ASP:TextBox, and + ' save it into the DateRank field in DataSource PersonalId 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.DateRank.Text, PersonalIdTable.DateRank) + + + End Sub + + Public Overridable Sub GetDeptId() + + ' Retrieve the value entered by the user on the DeptId ASP:TextBox, and + ' save it into the DeptId field in DataSource PersonalId record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.DeptId.Text, PersonalIdTable.DeptId) + + + End Sub + + Public Overridable Sub GetMId() + + ' Retrieve the value entered by the user on the MId ASP:TextBox, and + ' save it into the MId field in DataSource PersonalId record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.MId.Text, PersonalIdTable.MId) + + + End Sub + + Public Overridable Sub GetMobilePhone() + + ' Retrieve the value entered by the user on the MobilePhone ASP:TextBox, and + ' save it into the MobilePhone field in DataSource PersonalId record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.MobilePhone.Text, PersonalIdTable.MobilePhone) + + + End Sub + + Public Overridable Sub GetNationality() + + ' Retrieve the value entered by the user on the Nationality ASP:TextBox, and + ' save it into the Nationality field in DataSource PersonalId record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.Nationality.Text, PersonalIdTable.Nationality) + + + End Sub + + Public Overridable Sub GetOfficerDate() + + ' Retrieve the value entered by the user on the OfficerDate ASP:TextBox, and + ' save it into the OfficerDate field in DataSource PersonalId 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.OfficerDate.Text, PersonalIdTable.OfficerDate) + + + End Sub + + Public Overridable Sub GetOrigin() + + ' Retrieve the value entered by the user on the Origin ASP:TextBox, and + ' save it into the Origin field in DataSource PersonalId record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.Origin.Text, PersonalIdTable.Origin) + + + End Sub + + Public Overridable Sub GetPersonalId() + + ' Retrieve the value entered by the user on the PersonalId ASP:TextBox, and + ' save it into the PersonalId field in DataSource PersonalId record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.PersonalId.Text, PersonalIdTable.PersonalId) + + + End Sub + + Public Overridable Sub GetPersonalLastName() + + ' Retrieve the value entered by the user on the PersonalLastName ASP:TextBox, and + ' save it into the PersonalLastName field in DataSource PersonalId record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.PersonalLastName.Text, PersonalIdTable.PersonalLastName) + + + End Sub + + Public Overridable Sub GetPersonalName() + + ' Retrieve the value entered by the user on the PersonalName ASP:TextBox, and + ' save it into the PersonalName field in DataSource PersonalId record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.PersonalName.Text, PersonalIdTable.PersonalName) + + + End Sub + + Public Overridable Sub GetPhone() + + ' Retrieve the value entered by the user on the Phone ASP:TextBox, and + ' save it into the Phone field in DataSource PersonalId record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.Phone.Text, PersonalIdTable.Phone) + + + End Sub + + Public Overridable Sub GetPhoneExt() + + ' Retrieve the value entered by the user on the PhoneExt ASP:TextBox, and + ' save it into the PhoneExt field in DataSource PersonalId record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.PhoneExt.Text, PersonalIdTable.PhoneExt) + + + End Sub + + Public Overridable Sub Getpicture() + ' Retrieve the value entered by the user on the picture ASP:FileUpload, and + ' save it into the picture field in DataSource PersonalId record. + ' Custom validation should be performed in Validate, not here. + + If Not Me.picture.PostedFile is Nothing then + If Me.picture.PostedFile.FileName.Length > 0 AndAlso Me.picture.PostedFile.ContentLength > 0 Then + ' Retrieve the file contents and store them in picture field. + Me.DataSource.Parse(MiscUtils.GetFileContent(Me.picture.PostedFile), PersonalIdTable.picture) + + ' If there is a FileName companion field specified, then save the file name as well. + ' Strip off the path and just save the part after the last \ + Dim path As String = Me.picture.PostedFile.FileName + Dim LastIndex As Integer = path.LastIndexOf("\") + + Me.DataSource.PictureName = path.Substring(LastIndex + 1).Replace("'", "_") + + End If + End If + End Sub + + Public Overridable Sub GetPlaceOfBirth() + + ' Retrieve the value entered by the user on the PlaceOfBirth ASP:TextBox, and + ' save it into the PlaceOfBirth field in DataSource PersonalId record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.PlaceOfBirth.Text, PersonalIdTable.PlaceOfBirth) + + + End Sub + + Public Overridable Sub GetPostCode() + + ' Retrieve the value entered by the user on the PostCode ASP:TextBox, and + ' save it into the PostCode field in DataSource PersonalId record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.PostCode.Text, PersonalIdTable.PostCode) + + + End Sub + + Public Overridable Sub GetProvince() + + ' Retrieve the value entered by the user on the Province ASP:TextBox, and + ' save it into the Province field in DataSource PersonalId record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.Province.Text, PersonalIdTable.Province) + + + End Sub + + Public Overridable Sub GetRankId() + + ' Retrieve the value entered by the user on the RankId ASP:DropDownList, and + ' save it into the RankId field in DataSource PersonalId record. + + ' Custom validation should be performed in Validate, not here. + + Me.DataSource.Parse(GetValueSelectedPageRequest(Me.RankId), PersonalIdTable.RankId) + + End Sub + + Public Overridable Sub GetRegDate() + + ' Retrieve the value entered by the user on the RegDate ASP:TextBox, and + ' save it into the RegDate field in DataSource PersonalId 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.RegDate.Text, PersonalIdTable.RegDate) + + + End Sub + + Public Overridable Sub GetRegNo1() + + ' Retrieve the value entered by the user on the RegNo1 ASP:TextBox, and + ' save it into the RegNo1 field in DataSource PersonalId record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.RegNo1.Text, PersonalIdTable.RegNo1) + + + End Sub + + Public Overridable Sub GetRegNo2() + + ' Retrieve the value entered by the user on the RegNo2 ASP:TextBox, and + ' save it into the RegNo2 field in DataSource PersonalId record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.RegNo2.Text, PersonalIdTable.RegNo2) + + + End Sub + + Public Overridable Sub GetReligion() + + ' Retrieve the value entered by the user on the Religion ASP:TextBox, and + ' save it into the Religion field in DataSource PersonalId record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.Religion.Text, PersonalIdTable.Religion) + + + End Sub + + Public Overridable Sub GetSectionId() + + ' Retrieve the value entered by the user on the SectionId ASP:DropDownList, and + ' save it into the SectionId field in DataSource PersonalId record. + + ' Custom validation should be performed in Validate, not here. + + Me.DataSource.Parse(GetValueSelectedPageRequest(Me.SectionId), PersonalIdTable.SectionId) + + End Sub + + Public Overridable Sub GetSex() + + ' Retrieve the value entered by the user on the Sex ASP:TextBox, and + ' save it into the Sex field in DataSource PersonalId record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.Sex.Text, PersonalIdTable.Sex) + + + End Sub + + Public Overridable Sub GetStatusId() + + ' Retrieve the value entered by the user on the StatusId ASP:DropDownList, and + ' save it into the StatusId field in DataSource PersonalId record. + + ' Custom validation should be performed in Validate, not here. + + Me.DataSource.Parse(GetValueSelectedPageRequest(Me.StatusId), PersonalIdTable.StatusId) + + End Sub + + Public Overridable Sub GetTId() + + ' Retrieve the value entered by the user on the TId ASP:TextBox, and + ' save it into the TId field in DataSource PersonalId record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.TId.Text, PersonalIdTable.TId) + + + End Sub + + + ' To customize, override this method in PersonalIdRecordControl. + + Public Overridable Function CreateWhereClause() As WhereClause + + Dim wc As WhereClause + PersonalIdTable.Instance.InnerFilter = Nothing + wc = New WhereClause() + + ' Compose the WHERE clause consiting of: + ' 1. Static clause defined at design time. + ' 2. User selected filter criteria. + ' 3. User selected search criteria. + + ' Retrieve the record id from the URL parameter. + Dim recId As String = Me.Page.Request.QueryString.Item("PersonalId") + If recId Is Nothing OrElse recId.Trim = "" Then + + Return Nothing + + End If + + HttpContext.Current.Session("QueryString in AddPersonalId") = recId + + If KeyValue.IsXmlKey(recId) Then + ' Keys are typically passed as XML structures to handle composite keys. + ' If XML, then add a Where clause based on the Primary Key in the XML. + Dim pkValue As KeyValue = KeyValue.XmlToKey(recId) + + wc.iAND(PersonalIdTable.PersonalId, BaseFilter.ComparisonOperator.EqualsTo, pkValue.GetColumnValueString(PersonalIdTable.PersonalId)) + + Else + ' The URL parameter contains the actual value, not an XML structure. + + wc.iAND(PersonalIdTable.PersonalId, BaseFilter.ComparisonOperator.EqualsTo, recId) + + End If + + Return wc + + End Function + + ' This CreateWhereClause is used for loading list of suggestions for Auto Type-Ahead feature. + + Public Overridable Function CreateWhereClause(ByVal searchText As String, ByVal fromSearchControl As String, ByVal AutoTypeAheadSearch As String, ByVal AutoTypeAheadWordSeparators As String) As WhereClause + PersonalIdTable.Instance.InnerFilter = Nothing + Dim wc As WhereClause = New WhereClause() + + ' Compose the WHERE clause consiting of: + ' 1. Static clause defined at design time. + ' 2. User selected filter criteria. + ' 3. User selected search criteria. + Dim appRelativeVirtualPath As String = CType(HttpContext.Current.Session("AppRelativeVirtualPath"), String) + + + ' Adds clauses if values are selected in Filter controls which are configured in the page. + + + + 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 PersonalIdRecordControl. + Public Overridable Sub Validate() + ' Add custom validation for any control within this panel. + ' Example. If you have a State ASP:Textbox control + ' If Me.State.Text <> "CA" Then + ' Throw New Exception("State must be CA (California).") + ' End If + + ' The Validate method is common across all controls within + ' this panel so you can validate multiple fields, but report + ' one error message. + + + End Sub + + Public Overridable Sub Delete() + + If Me.IsNewRecord() Then + Return + End If + + Dim pkValue As KeyValue = KeyValue.XmlToKey(Me.RecordUniqueId) + PersonalIdTable.DeleteRecord(pkValue) + + End Sub + + Protected Overridable Sub Control_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.PreRender + ' PreRender event is raised just before page is being displayed. + Try + DbUtils.StartTransaction() + Me.RegisterPostback() + + If Not Me.Page.ErrorOnPage AndAlso (Me.Page.IsPageRefresh OrElse Me.DataChanged OrElse Me.ResetData) Then + + + ' Re-load the data and update the web page if necessary. + ' This is typically done during a postback (filter, search button, sort, pagination button). + ' In each of the other click handlers, simply set DataChanged to True to reload the data. + Me.LoadData() + Me.DataBind() + End If + + + Catch ex As Exception + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + Finally + DbUtils.EndTransaction() + End Try + End Sub + + + Protected Overrides Sub SaveControlsToSession() + MyBase.SaveControlsToSession() + + + 'Save 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_ArmIdDropDownList() 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 Arm table. + ' Examples: + ' wc.iAND(ArmTable.ArmSName, BaseFilter.ComparisonOperator.EqualsTo, "XYZ") + ' wc.iAND(ArmTable.Active, BaseFilter.ComparisonOperator.EqualsTo, "1") + + Dim wc As WhereClause = New WhereClause() + Return wc + + End Function + + + + Public Overridable Function CreateWhereClause_ArmyIdDropDownList() 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 Army table. + ' Examples: + ' wc.iAND(ArmyTable.Army, BaseFilter.ComparisonOperator.EqualsTo, "XYZ") + ' wc.iAND(ArmyTable.Active, BaseFilter.ComparisonOperator.EqualsTo, "1") + + Dim wc As WhereClause = New WhereClause() + Return wc + + End Function + + + + Public Overridable Function CreateWhereClause_BloodIdDropDownList() 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 BloodId table. + ' Examples: + ' wc.iAND(BloodIdTable.BloodName, BaseFilter.ComparisonOperator.EqualsTo, "XYZ") + ' wc.iAND(BloodIdTable.Active, BaseFilter.ComparisonOperator.EqualsTo, "1") + + Dim wc As WhereClause = New WhereClause() + Return wc + + End Function + + + + Public Overridable Function CreateWhereClause_RankIdDropDownList() As WhereClause + ' By default, we simply return a new WhereClause. + ' Add additional where clauses to restrict the items shown in the dropdown list. + + Dim wc As WhereClause = New WhereClause() + Return wc + + End Function + + + + Public Overridable Function CreateWhereClause_SectionIdDropDownList() 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 Section table. + ' Examples: + ' wc.iAND(SectionTable.SectionName, BaseFilter.ComparisonOperator.EqualsTo, "XYZ") + ' wc.iAND(SectionTable.Active, BaseFilter.ComparisonOperator.EqualsTo, "1") + + Dim wc As WhereClause = New WhereClause() + Return wc + + End Function + + + + Public Overridable Function CreateWhereClause_StatusIdDropDownList() 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 Status table. + ' Examples: + ' wc.iAND(StatusTable.Status, BaseFilter.ComparisonOperator.EqualsTo, "XYZ") + ' wc.iAND(StatusTable.Active, BaseFilter.ComparisonOperator.EqualsTo, "1") + + Dim wc As WhereClause = New WhereClause() + Return wc + + End Function + + + ' Fill the ArmId list. + Protected Overridable Sub PopulateArmIdDropDownList( _ + ByVal selectedValue As String, _ + ByVal maxItems As Integer) + + Me.ArmId.Items.Clear() + + + ' 1. Setup the static list items + + ' Add the Please Select item. + Me.ArmId.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_ArmIdDropDownList function. + ' It is better to customize the where clause there. + + Dim wc As WhereClause = CreateWhereClause_ArmIdDropDownList() + ' Create the ORDER BY clause to sort based on the displayed value. + + + Dim orderBy As OrderBy = New OrderBy(false, false) + orderBy.Add(ArmTable.ArmSName, 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 ArmRecord = 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 = ArmTable.GetRecords(wc, orderBy, pageNum, maxItems) + For each itemValue As ArmRecord In itemValues + ' Create the item and add to the list. + Dim cvalue As String = Nothing + Dim fvalue As String = Nothing + If itemValue.ArmIdSpecified Then + cvalue = itemValue.ArmId.ToString() + + If counter < maxItems AndAlso Me.ArmId.Items.FindByValue(cvalue) Is Nothing Then + + Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalIdTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalIdTable.ArmId) + If _isExpandableNonCompositeForeignKey AndAlso PersonalIdTable.ArmId.IsApplyDisplayAs Then + fvalue = PersonalIdTable.GetDFKA(itemValue, PersonalIdTable.ArmId) + End If + If (Not _isExpandableNonCompositeForeignKey) Or (String.IsNullOrEmpty(fvalue)) Then + fvalue = itemValue.Format(ArmTable.ArmSName) + 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.ArmId.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.ArmId.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.ArmId, selectedValue) AndAlso _ + Not SetSelectedDisplayText(Me.ArmId, selectedValue)Then + + ' construct a whereclause to query a record with Arm.ArmId = selectedValue + Dim filter2 As CompoundFilter = New CompoundFilter(CompoundFilter.CompoundingOperators.And_Operator, Nothing) + Dim whereClause2 As WhereClause = New WhereClause() + filter2.AddFilter(New BaseClasses.Data.ColumnValueFilter(ArmTable.ArmId, selectedValue, BaseClasses.Data.BaseFilter.ComparisonOperator.EqualsTo, False)) + whereClause2.AddFilter(filter2, CompoundFilter.CompoundingOperators.And_Operator) + + Try + ' Execute the query + Dim rc() As ArmRecord = ArmTable.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 ArmRecord = DirectCast(rc(0), ArmRecord) + ' Create the item and add to the list. + Dim cvalue As String = Nothing + Dim fvalue As String = Nothing + If itemValue.ArmIdSpecified Then + cvalue = itemValue.ArmId.ToString() + Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalIdTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalIdTable.ArmId) + If _isExpandableNonCompositeForeignKey AndAlso PersonalIdTable.ArmId.IsApplyDisplayAs Then + fvalue = PersonalIdTable.GetDFKA(itemValue, PersonalIdTable.ArmId) + End If + If (Not _isExpandableNonCompositeForeignKey) Or (String.IsNullOrEmpty(fvalue)) Then + fvalue = itemValue.Format(ArmTable.ArmSName) + End If + + If fvalue Is Nothing OrElse fvalue.Trim() = "" Then fvalue = cvalue + Dim newItem As New ListItem(fvalue, cvalue) + Me.ArmId.Items.Add(newItem) + SetSelectedValue(Me.ArmId, selectedValue) + End If + End If + Catch + End Try + + End If + + + End Sub + + ' Fill the ArmyId list. + Protected Overridable Sub PopulateArmyIdDropDownList( _ + ByVal selectedValue As String, _ + ByVal maxItems As Integer) + + Me.ArmyId.Items.Clear() + + + ' 1. Setup the static list items + + ' Add the Please Select item. + Me.ArmyId.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_ArmyIdDropDownList function. + ' It is better to customize the where clause there. + + Dim wc As WhereClause = CreateWhereClause_ArmyIdDropDownList() + ' Create the ORDER BY clause to sort based on the displayed value. + + + Dim orderBy As OrderBy = New OrderBy(false, false) + orderBy.Add(ArmyTable.Army, 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 ArmyRecord = 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 = ArmyTable.GetRecords(wc, orderBy, pageNum, maxItems) + For each itemValue As ArmyRecord In itemValues + ' Create the item and add to the list. + Dim cvalue As String = Nothing + Dim fvalue As String = Nothing + If itemValue.ArmyIdSpecified Then + cvalue = itemValue.ArmyId.ToString() + + If counter < maxItems AndAlso Me.ArmyId.Items.FindByValue(cvalue) Is Nothing Then + + Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalIdTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalIdTable.ArmyId) + If _isExpandableNonCompositeForeignKey AndAlso PersonalIdTable.ArmyId.IsApplyDisplayAs Then + fvalue = PersonalIdTable.GetDFKA(itemValue, PersonalIdTable.ArmyId) + End If + If (Not _isExpandableNonCompositeForeignKey) Or (String.IsNullOrEmpty(fvalue)) Then + fvalue = itemValue.Format(ArmyTable.Army) + 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.ArmyId.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.ArmyId.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.ArmyId, selectedValue) AndAlso _ + Not SetSelectedDisplayText(Me.ArmyId, selectedValue)Then + + ' construct a whereclause to query a record with Army.ArmyId = selectedValue + Dim filter2 As CompoundFilter = New CompoundFilter(CompoundFilter.CompoundingOperators.And_Operator, Nothing) + Dim whereClause2 As WhereClause = New WhereClause() + filter2.AddFilter(New BaseClasses.Data.ColumnValueFilter(ArmyTable.ArmyId, selectedValue, BaseClasses.Data.BaseFilter.ComparisonOperator.EqualsTo, False)) + whereClause2.AddFilter(filter2, CompoundFilter.CompoundingOperators.And_Operator) + + Try + ' Execute the query + Dim rc() As ArmyRecord = ArmyTable.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 ArmyRecord = DirectCast(rc(0), ArmyRecord) + ' Create the item and add to the list. + Dim cvalue As String = Nothing + Dim fvalue As String = Nothing + If itemValue.ArmyIdSpecified Then + cvalue = itemValue.ArmyId.ToString() + Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalIdTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalIdTable.ArmyId) + If _isExpandableNonCompositeForeignKey AndAlso PersonalIdTable.ArmyId.IsApplyDisplayAs Then + fvalue = PersonalIdTable.GetDFKA(itemValue, PersonalIdTable.ArmyId) + End If + If (Not _isExpandableNonCompositeForeignKey) Or (String.IsNullOrEmpty(fvalue)) Then + fvalue = itemValue.Format(ArmyTable.Army) + End If + + If fvalue Is Nothing OrElse fvalue.Trim() = "" Then fvalue = cvalue + Dim newItem As New ListItem(fvalue, cvalue) + Me.ArmyId.Items.Add(newItem) + SetSelectedValue(Me.ArmyId, selectedValue) + End If + End If + Catch + End Try + + End If + + + End Sub + + ' Fill the BloodId list. + Protected Overridable Sub PopulateBloodIdDropDownList( _ + ByVal selectedValue As String, _ + ByVal maxItems As Integer) + + Me.BloodId.Items.Clear() + + + ' 1. Setup the static list items + + ' Add the Please Select item. + Me.BloodId.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_BloodIdDropDownList function. + ' It is better to customize the where clause there. + + Dim wc As WhereClause = CreateWhereClause_BloodIdDropDownList() + ' Create the ORDER BY clause to sort based on the displayed value. + + + Dim orderBy As OrderBy = New OrderBy(false, false) + orderBy.Add(BloodIdTable.BloodName, 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 BloodIdRecord = 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 = BloodIdTable.GetRecords(wc, orderBy, pageNum, maxItems) + For each itemValue As BloodIdRecord In itemValues + ' Create the item and add to the list. + Dim cvalue As String = Nothing + Dim fvalue As String = Nothing + If itemValue.BloodIdSpecified Then + cvalue = itemValue.BloodId.ToString() + + If counter < maxItems AndAlso Me.BloodId.Items.FindByValue(cvalue) Is Nothing Then + + Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalIdTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalIdTable.BloodId) + If _isExpandableNonCompositeForeignKey AndAlso PersonalIdTable.BloodId.IsApplyDisplayAs Then + fvalue = PersonalIdTable.GetDFKA(itemValue, PersonalIdTable.BloodId) + End If + If (Not _isExpandableNonCompositeForeignKey) Or (String.IsNullOrEmpty(fvalue)) Then + fvalue = itemValue.Format(BloodIdTable.BloodName) + 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.BloodId.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.BloodId.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.BloodId, selectedValue) AndAlso _ + Not SetSelectedDisplayText(Me.BloodId, selectedValue)Then + + ' construct a whereclause to query a record with BloodId.BloodId = selectedValue + Dim filter2 As CompoundFilter = New CompoundFilter(CompoundFilter.CompoundingOperators.And_Operator, Nothing) + Dim whereClause2 As WhereClause = New WhereClause() + filter2.AddFilter(New BaseClasses.Data.ColumnValueFilter(BloodIdTable.BloodId, selectedValue, BaseClasses.Data.BaseFilter.ComparisonOperator.EqualsTo, False)) + whereClause2.AddFilter(filter2, CompoundFilter.CompoundingOperators.And_Operator) + + Try + ' Execute the query + Dim rc() As BloodIdRecord = BloodIdTable.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 BloodIdRecord = DirectCast(rc(0), BloodIdRecord) + ' Create the item and add to the list. + Dim cvalue As String = Nothing + Dim fvalue As String = Nothing + If itemValue.BloodIdSpecified Then + cvalue = itemValue.BloodId.ToString() + Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalIdTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalIdTable.BloodId) + If _isExpandableNonCompositeForeignKey AndAlso PersonalIdTable.BloodId.IsApplyDisplayAs Then + fvalue = PersonalIdTable.GetDFKA(itemValue, PersonalIdTable.BloodId) + End If + If (Not _isExpandableNonCompositeForeignKey) Or (String.IsNullOrEmpty(fvalue)) Then + fvalue = itemValue.Format(BloodIdTable.BloodName) + End If + + If fvalue Is Nothing OrElse fvalue.Trim() = "" Then fvalue = cvalue + Dim newItem As New ListItem(fvalue, cvalue) + Me.BloodId.Items.Add(newItem) + SetSelectedValue(Me.BloodId, selectedValue) + End If + End If + Catch + End Try + + End If + + + End Sub + + ' Fill the RankId list. + Protected Overridable Sub PopulateRankIdDropDownList( _ + ByVal selectedValue As String, _ + ByVal maxItems As Integer) + + Me.RankId.Items.Clear() + + + ' 1. Setup the static list items + + ' Add the Please Select item. + Me.RankId.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_RankIdDropDownList function. + ' It is better to customize the where clause there. + + Dim wc As WhereClause = CreateWhereClause_RankIdDropDownList() + ' Create the ORDER BY clause to sort based on the displayed value. + + + ' 3. Read a total of maxItems from the database and insert them + Dim orderBy As OrderBy = New OrderBy(False, False) + orderBy.Add(PersonalIdTable.RankId, OrderByItem.OrderDir.Asc) + + Dim itemValue As String + Dim listDuplicates As New ArrayList() + + For Each itemValue In PersonalIdTable.GetValues(PersonalIdTable.RankId, wc, orderBy, maxItems) + ' Create the dropdown list item and add it to the list. + Dim fvalue As String = PersonalIdTable.RankId.Format(itemValue) + If fvalue Is Nothing OrElse fvalue.Trim() = "" Then fvalue = itemValue + Dim dupItem As ListItem = Me.RankId.Items.FindByText(fvalue) + + If Not IsNothing(dupItem) Then + listDuplicates.Add(fvalue) + dupItem.Text = fvalue & " (ID " & dupItem.Value & ")" + End If + + Dim newItem As ListItem = New ListItem(fvalue, itemValue) + Me.RankId.Items.Add(newItem) + + If listDuplicates.Contains(fvalue) Then + newItem.Text = fvalue & " (ID " & itemValue & ")" + End If + Next + + + ' 4. Set the selected value (insert if not already present). + + If Not selectedValue Is Nothing AndAlso _ + selectedValue.Trim <> "" AndAlso _ + Not SetSelectedValue(Me.RankId, selectedValue) AndAlso _ + Not SetSelectedDisplayText(Me.RankId, selectedValue) AndAlso _ + Not SetSelectedDisplayText(Me.RankId, PersonalIdTable.RankId.Format(selectedValue))Then + Dim fvalue As String = PersonalIdTable.RankId.Format(selectedValue) + If fvalue Is Nothing OrElse fvalue.Trim() = "" Then fvalue = selectedValue + Dim item As ListItem = New ListItem(fvalue, selectedValue) + item.Selected = True + Me.RankId.Items.Add(item) + End If + + + End Sub + + ' Fill the SectionId list. + Protected Overridable Sub PopulateSectionIdDropDownList( _ + ByVal selectedValue As String, _ + ByVal maxItems As Integer) + + Me.SectionId.Items.Clear() + + + ' 1. Setup the static list items + + ' Add the Please Select item. + Me.SectionId.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_SectionIdDropDownList function. + ' It is better to customize the where clause there. + + Dim wc As WhereClause = CreateWhereClause_SectionIdDropDownList() + ' Create the ORDER BY clause to sort based on the displayed value. + + + Dim orderBy As OrderBy = New OrderBy(false, false) + orderBy.Add(SectionTable.SectionName, 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 SectionRecord = 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 = SectionTable.GetRecords(wc, orderBy, pageNum, maxItems) + For each itemValue As SectionRecord In itemValues + ' Create the item and add to the list. + Dim cvalue As String = Nothing + Dim fvalue As String = Nothing + If itemValue.SectionIdSpecified Then + cvalue = itemValue.SectionId.ToString() + + If counter < maxItems AndAlso Me.SectionId.Items.FindByValue(cvalue) Is Nothing Then + + Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalIdTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalIdTable.SectionId) + If _isExpandableNonCompositeForeignKey AndAlso PersonalIdTable.SectionId.IsApplyDisplayAs Then + fvalue = PersonalIdTable.GetDFKA(itemValue, PersonalIdTable.SectionId) + End If + If (Not _isExpandableNonCompositeForeignKey) Or (String.IsNullOrEmpty(fvalue)) Then + fvalue = itemValue.Format(SectionTable.SectionName) + 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.SectionId.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.SectionId.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.SectionId, selectedValue) AndAlso _ + Not SetSelectedDisplayText(Me.SectionId, selectedValue)Then + + ' construct a whereclause to query a record with Section.SectionId = selectedValue + Dim filter2 As CompoundFilter = New CompoundFilter(CompoundFilter.CompoundingOperators.And_Operator, Nothing) + Dim whereClause2 As WhereClause = New WhereClause() + filter2.AddFilter(New BaseClasses.Data.ColumnValueFilter(SectionTable.SectionId, selectedValue, BaseClasses.Data.BaseFilter.ComparisonOperator.EqualsTo, False)) + whereClause2.AddFilter(filter2, CompoundFilter.CompoundingOperators.And_Operator) + + Try + ' Execute the query + Dim rc() As SectionRecord = SectionTable.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 SectionRecord = DirectCast(rc(0), SectionRecord) + ' Create the item and add to the list. + Dim cvalue As String = Nothing + Dim fvalue As String = Nothing + If itemValue.SectionIdSpecified Then + cvalue = itemValue.SectionId.ToString() + Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalIdTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalIdTable.SectionId) + If _isExpandableNonCompositeForeignKey AndAlso PersonalIdTable.SectionId.IsApplyDisplayAs Then + fvalue = PersonalIdTable.GetDFKA(itemValue, PersonalIdTable.SectionId) + End If + If (Not _isExpandableNonCompositeForeignKey) Or (String.IsNullOrEmpty(fvalue)) Then + fvalue = itemValue.Format(SectionTable.SectionName) + End If + + If fvalue Is Nothing OrElse fvalue.Trim() = "" Then fvalue = cvalue + Dim newItem As New ListItem(fvalue, cvalue) + Me.SectionId.Items.Add(newItem) + SetSelectedValue(Me.SectionId, selectedValue) + End If + End If + Catch + End Try + + End If + + + End Sub + + ' Fill the StatusId list. + Protected Overridable Sub PopulateStatusIdDropDownList( _ + ByVal selectedValue As String, _ + ByVal maxItems As Integer) + + Me.StatusId.Items.Clear() + + + ' 1. Setup the static list items + + ' Add the Please Select item. + Me.StatusId.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_StatusIdDropDownList function. + ' It is better to customize the where clause there. + + Dim wc As WhereClause = CreateWhereClause_StatusIdDropDownList() + ' Create the ORDER BY clause to sort based on the displayed value. + + + Dim orderBy As OrderBy = New OrderBy(false, false) + orderBy.Add(StatusTable.Status, 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 StatusRecord = 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 = StatusTable.GetRecords(wc, orderBy, pageNum, maxItems) + For each itemValue As StatusRecord In itemValues + ' Create the item and add to the list. + Dim cvalue As String = Nothing + Dim fvalue As String = Nothing + If itemValue.StatusIdSpecified Then + cvalue = itemValue.StatusId.ToString() + + If counter < maxItems AndAlso Me.StatusId.Items.FindByValue(cvalue) Is Nothing Then + + Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalIdTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalIdTable.StatusId) + If _isExpandableNonCompositeForeignKey AndAlso PersonalIdTable.StatusId.IsApplyDisplayAs Then + fvalue = PersonalIdTable.GetDFKA(itemValue, PersonalIdTable.StatusId) + End If + If (Not _isExpandableNonCompositeForeignKey) Or (String.IsNullOrEmpty(fvalue)) Then + fvalue = itemValue.Format(StatusTable.Status) + 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.StatusId.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.StatusId.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.StatusId, selectedValue) AndAlso _ + Not SetSelectedDisplayText(Me.StatusId, selectedValue)Then + + ' construct a whereclause to query a record with Status.StatusId = selectedValue + Dim filter2 As CompoundFilter = New CompoundFilter(CompoundFilter.CompoundingOperators.And_Operator, Nothing) + Dim whereClause2 As WhereClause = New WhereClause() + filter2.AddFilter(New BaseClasses.Data.ColumnValueFilter(StatusTable.StatusId, selectedValue, BaseClasses.Data.BaseFilter.ComparisonOperator.EqualsTo, False)) + whereClause2.AddFilter(filter2, CompoundFilter.CompoundingOperators.And_Operator) + + Try + ' Execute the query + Dim rc() As StatusRecord = StatusTable.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 StatusRecord = DirectCast(rc(0), StatusRecord) + ' Create the item and add to the list. + Dim cvalue As String = Nothing + Dim fvalue As String = Nothing + If itemValue.StatusIdSpecified Then + cvalue = itemValue.StatusId.ToString() + Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalIdTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalIdTable.StatusId) + If _isExpandableNonCompositeForeignKey AndAlso PersonalIdTable.StatusId.IsApplyDisplayAs Then + fvalue = PersonalIdTable.GetDFKA(itemValue, PersonalIdTable.StatusId) + End If + If (Not _isExpandableNonCompositeForeignKey) Or (String.IsNullOrEmpty(fvalue)) Then + fvalue = itemValue.Format(StatusTable.Status) + End If + + If fvalue Is Nothing OrElse fvalue.Trim() = "" Then fvalue = cvalue + Dim newItem As New ListItem(fvalue, cvalue) + Me.StatusId.Items.Add(newItem) + SetSelectedValue(Me.StatusId, selectedValue) + End If + End If + Catch + End Try + + End If + + + End Sub + + Protected Overridable Sub ArmId_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()(ArmId.ClientID & "_SelectedValue"), String) + Dim displayText As String = CType(Me.Page.Session()(ArmId.ClientID & "_SelectedDisplayText"), String) + If displayText <> "" AndAlso val <> "" Then + Me.ArmId.Items.Add(New ListItem(displayText, val)) + Me.ArmId.SelectedIndex = Me.ArmId.Items.Count - 1 + Me.Page.Session.Remove(ArmId.ClientID & "_SelectedValue") + Me.Page.Session.Remove(ArmId.ClientID & "_SelectedDisplayText") + End If + + + + + End Sub + + Protected Overridable Sub ArmyId_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()(ArmyId.ClientID & "_SelectedValue"), String) + Dim displayText As String = CType(Me.Page.Session()(ArmyId.ClientID & "_SelectedDisplayText"), String) + If displayText <> "" AndAlso val <> "" Then + Me.ArmyId.Items.Add(New ListItem(displayText, val)) + Me.ArmyId.SelectedIndex = Me.ArmyId.Items.Count - 1 + Me.Page.Session.Remove(ArmyId.ClientID & "_SelectedValue") + Me.Page.Session.Remove(ArmyId.ClientID & "_SelectedDisplayText") + End If + + + + + End Sub + + Protected Overridable Sub BloodId_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()(BloodId.ClientID & "_SelectedValue"), String) + Dim displayText As String = CType(Me.Page.Session()(BloodId.ClientID & "_SelectedDisplayText"), String) + If displayText <> "" AndAlso val <> "" Then + Me.BloodId.Items.Add(New ListItem(displayText, val)) + Me.BloodId.SelectedIndex = Me.BloodId.Items.Count - 1 + Me.Page.Session.Remove(BloodId.ClientID & "_SelectedValue") + Me.Page.Session.Remove(BloodId.ClientID & "_SelectedDisplayText") + End If + + + + + End Sub + + Protected Overridable Sub RankId_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()(RankId.ClientID & "_SelectedValue"), String) + Dim displayText As String = CType(Me.Page.Session()(RankId.ClientID & "_SelectedDisplayText"), String) + If displayText <> "" AndAlso val <> "" Then + Me.RankId.Items.Add(New ListItem(displayText, val)) + Me.RankId.SelectedIndex = Me.RankId.Items.Count - 1 + Me.Page.Session.Remove(RankId.ClientID & "_SelectedValue") + Me.Page.Session.Remove(RankId.ClientID & "_SelectedDisplayText") + End If + + + + + End Sub + + Protected Overridable Sub SectionId_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()(SectionId.ClientID & "_SelectedValue"), String) + Dim displayText As String = CType(Me.Page.Session()(SectionId.ClientID & "_SelectedDisplayText"), String) + If displayText <> "" AndAlso val <> "" Then + Me.SectionId.Items.Add(New ListItem(displayText, val)) + Me.SectionId.SelectedIndex = Me.SectionId.Items.Count - 1 + Me.Page.Session.Remove(SectionId.ClientID & "_SelectedValue") + Me.Page.Session.Remove(SectionId.ClientID & "_SelectedDisplayText") + End If + + + + + End Sub + + Protected Overridable Sub StatusId_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()(StatusId.ClientID & "_SelectedValue"), String) + Dim displayText As String = CType(Me.Page.Session()(StatusId.ClientID & "_SelectedDisplayText"), String) + If displayText <> "" AndAlso val <> "" Then + Me.StatusId.Items.Add(New ListItem(displayText, val)) + Me.StatusId.SelectedIndex = Me.StatusId.Items.Count - 1 + Me.Page.Session.Remove(StatusId.ClientID & "_SelectedValue") + Me.Page.Session.Remove(StatusId.ClientID & "_SelectedDisplayText") + End If + + + + + End Sub + + Protected Overridable Sub Addr_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub Amphur_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub ArmyWelfareMemId_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub BAmphur_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub BirthDate_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub Born_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub BProvince_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub Commission_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + ' this event handler is not supported since Commission is a fck editor. + + End Sub + + Protected Overridable Sub CremateMemId_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub DatePrevRank_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub DateRank_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub DeptId_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub MId_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub MobilePhone_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub Nationality_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub OfficerDate_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub Origin_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub PersonalId_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub PersonalLastName_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub PersonalName_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub Phone_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub PhoneExt_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub PlaceOfBirth_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub PostCode_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub Province_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub RegDate_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub RegNo1_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub RegNo2_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub Religion_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub Sex_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub TId_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + + Private _PreviousUIData As New Hashtable + Public Overridable Property PreviousUIData() As Hashtable + Get + Return _PreviousUIData + End Get + Set(ByVal value As Hashtable) + _PreviousUIData = value + End Set + End Property + + Private _IsNewRecord As Boolean = True + Public Overridable Property IsNewRecord() As Boolean + Get + Return Me._IsNewRecord + End Get + Set(ByVal value As Boolean) + Me._IsNewRecord = value + End Set + End Property + + Private _DataChanged As Boolean = False + Public Overridable Property DataChanged() As Boolean + Get + Return Me._DataChanged + End Get + Set(ByVal Value As Boolean) + Me._DataChanged = Value + End Set + End Property + + Private _ResetData As Boolean = False + Public Overridable Property ResetData() As Boolean + Get + Return Me._ResetData + End Get + Set(ByVal Value As Boolean) + Me._ResetData = Value + End Set + End Property + + Public Property RecordUniqueId() As String + Get + Return CType(Me.ViewState("BasePersonalIdRecordControl_Rec"), String) + End Get + Set(ByVal value As String) + Me.ViewState("BasePersonalIdRecordControl_Rec") = value + End Set + End Property + + Private _DataSource As PersonalIdRecord + Public Property DataSource() As PersonalIdRecord + Get + Return Me._DataSource + End Get + + Set(ByVal value As PersonalIdRecord) + + Me._DataSource = value + End Set + End Property + + + + Private _checkSum As String + Public Overridable Property CheckSum() As String + Get + Return Me._checkSum + End Get + Set(ByVal value As String) + Me._checkSum = value + End Set + End Property + + Private _TotalPages As Integer + Public Property TotalPages() As Integer + Get + Return Me._TotalPages + End Get + Set(ByVal value As Integer) + Me._TotalPages = value + End Set + End Property + + Private _PageIndex As Integer + Public Property PageIndex() As Integer + Get + ' Return the PageIndex + Return Me._PageIndex + End Get + Set(ByVal value As Integer) + Me._PageIndex = value + End Set + End Property + + Private _PageSize As Integer + Public Property PageSize() As Integer + Get + Return Me._PageSize + End Get + Set(ByVal value As Integer) + Me._PageSize = value + End Set + End Property + + Private _TotalRecords As Integer + Public Property TotalRecords() As Integer + Get + Return Me._TotalRecords + End Get + Set(ByVal value As Integer) + If Me.PageSize > 0 Then + Me.TotalPages = CInt(Math.Ceiling(value / Me.PageSize)) + End If + + Me._TotalRecords = value + End Set + End Property + + Private _DisplayLastPage As Boolean + Public Property DisplayLastPage() As Boolean + Get + Return Me._DisplayLastPage + End Get + Set(ByVal value As Boolean) + Me._DisplayLastPage = value + End Set + End Property + + + +#Region "Helper Properties" + + Public ReadOnly Property Addr() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Addr"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property AddrLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "AddrLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property Amphur() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Amphur"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property AmphurLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "AmphurLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property ArmId() As System.Web.UI.WebControls.DropDownList + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "ArmId"), System.Web.UI.WebControls.DropDownList) + End Get + End Property + + Public ReadOnly Property ArmIdLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "ArmIdLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property ArmyId() As System.Web.UI.WebControls.DropDownList + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "ArmyId"), System.Web.UI.WebControls.DropDownList) + End Get + End Property + + Public ReadOnly Property ArmyIdLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "ArmyIdLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property ArmyWelfareMemId() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "ArmyWelfareMemId"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property ArmyWelfareMemIdLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "ArmyWelfareMemIdLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property BAmphur() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "BAmphur"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property BAmphurLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "BAmphurLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property BirthDate() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "BirthDate"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property BirthDateLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "BirthDateLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property BloodId() As System.Web.UI.WebControls.DropDownList + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "BloodId"), System.Web.UI.WebControls.DropDownList) + End Get + End Property + + Public ReadOnly Property BloodIdLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "BloodIdLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property Born() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Born"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property BornLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "BornLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property BProvince() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "BProvince"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property BProvinceLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "BProvinceLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property Commission() As FredCK.FCKeditorV2.FCKeditor + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Commission"), FredCK.FCKeditorV2.FCKeditor) + End Get + End Property + + Public ReadOnly Property CommissionLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "CommissionLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property CremateMemId() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "CremateMemId"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property CremateMemIdLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "CremateMemIdLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property DatePrevRank() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "DatePrevRank"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property DatePrevRankLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "DatePrevRankLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property DateRank() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "DateRank"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property DateRankLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "DateRankLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property DeptId() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "DeptId"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property DeptIdLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "DeptIdLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property MId() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "MId"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property MIdLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "MIdLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property MobilePhone() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "MobilePhone"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property MobilePhoneLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "MobilePhoneLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property Nationality() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Nationality"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property NationalityLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "NationalityLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property OfficerDate() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "OfficerDate"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property OfficerDateLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "OfficerDateLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property Origin() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Origin"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property OriginLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "OriginLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property PersonalId() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalId"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property PersonalIdLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalIdLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property PersonalIdRecordControlCollapsibleRegion() As System.Web.UI.WebControls.Panel + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalIdRecordControlCollapsibleRegion"), System.Web.UI.WebControls.Panel) + End Get + End Property + + Public ReadOnly Property PersonalIdRecordControlIcon() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalIdRecordControlIcon"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalIdRecordControlPanelExtender() As AjaxControlToolkit.CollapsiblePanelExtender + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalIdRecordControlPanelExtender"), AjaxControlToolkit.CollapsiblePanelExtender) + End Get + End Property + + Public ReadOnly Property PersonalIdTitle() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalIdTitle"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property PersonalLastName() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalLastName"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property PersonalLastNameLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalLastNameLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property PersonalName() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalName"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property PersonalNameLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalNameLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property Phone() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Phone"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property PhoneExt() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PhoneExt"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property PhoneExtLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PhoneExtLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property PhoneLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PhoneLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property picture() As System.Web.UI.WebControls.FileUpload + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "picture"), System.Web.UI.WebControls.FileUpload) + End Get + End Property + + Public ReadOnly Property pictureLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "pictureLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property PlaceOfBirth() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PlaceOfBirth"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property PlaceOfBirthLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PlaceOfBirthLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property PostCode() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PostCode"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property PostCodeLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PostCodeLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property Province() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Province"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property ProvinceLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "ProvinceLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property RankId() As System.Web.UI.WebControls.DropDownList + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RankId"), System.Web.UI.WebControls.DropDownList) + End Get + End Property + + Public ReadOnly Property RankIdLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RankIdLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property RegDate() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RegDate"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property RegDateLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RegDateLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property RegNo1() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RegNo1"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property RegNo1Label() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RegNo1Label"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property RegNo2() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RegNo2"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property RegNo2Label() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RegNo2Label"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property Religion() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Religion"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property ReligionLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "ReligionLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property SectionId() As System.Web.UI.WebControls.DropDownList + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "SectionId"), System.Web.UI.WebControls.DropDownList) + End Get + End Property + + Public ReadOnly Property SectionIdLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "SectionIdLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property Sex() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Sex"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property SexLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "SexLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property StatusId() As System.Web.UI.WebControls.DropDownList + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "StatusId"), System.Web.UI.WebControls.DropDownList) + End Get + End Property + + Public ReadOnly Property StatusIdLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "StatusIdLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property TId() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "TId"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property TIdLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "TIdLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + +#End Region + +#Region "Helper Functions" + + Public Overrides Overloads Function ModifyRedirectUrl(ByVal url As String, ByVal arg As String, ByVal bEncrypt As Boolean) As String + Return Me.Page.EvaluateExpressions(url, arg, bEncrypt, Me) + End Function + + Public Overrides Overloads Function EvaluateExpressions(ByVal url As String, ByVal arg As String, ByVal bEncrypt As Boolean) As String + + Dim rec As PersonalIdRecord = Nothing + + + Try + rec = Me.GetRecord() + Catch ex As Exception + ' Do nothing + End Try + + If rec Is Nothing AndAlso url.IndexOf("{") >= 0 Then + ' Localization. + + Throw New Exception(Page.GetResourceValue("Err:RecDataSrcNotInitialized", "Persons")) + + End If + Return EvaluateExpressions(url, arg, rec, bEncrypt) + End Function + + + Public Overridable Function GetRecord() As PersonalIdRecord + If Not Me.DataSource Is Nothing Then + Return Me.DataSource + End If + + + Return New PersonalIdRecord() + + 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 + + \ No newline at end of file diff --git a/App_Code/PersonalId/EditPersonalId.Controls.vb b/App_Code/PersonalId/EditPersonalId.Controls.vb new file mode 100644 index 0000000..1dd7596 --- /dev/null +++ b/App_Code/PersonalId/EditPersonalId.Controls.vb @@ -0,0 +1,42371 @@ + +' This file implements the TableControl, TableControlRow, and RecordControl classes for the +' EditPersonalId.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.EditPersonalId + +#Region "Section 1: Place your customizations here." + + + +Public Class PersonalDDTableControlRow + Inherits BasePersonalDDTableControlRow + ' The BasePersonalDDTableControlRow implements code for a ROW within the + ' the PersonalDDTableControl table. The BasePersonalDDTableControlRow implements the DataBind and SaveData methods. + ' The loading of data is actually performed by the LoadData method in the base class of PersonalDDTableControl. + + ' This is the ideal place to add your code customizations. For example, you can override the DataBind, + ' SaveData, GetUIData, and Validate methods. + + +End Class + + + +Public Class PersonalDDTableControl + Inherits BasePersonalDDTableControl + + ' The BasePersonalDDTableControl class implements the LoadData, DataBind, CreateWhereClause + ' and other methods to load and display the data in a table control. + + ' This is the ideal place to add your code customizations. You can override the LoadData and CreateWhereClause, + ' The PersonalDDTableControlRow class offers another place where you can customize + ' the DataBind, GetUIData, SaveData and Validate methods specific to each row displayed on the table. + +End Class + + +Public Class PersonalEducationTableControlRow + Inherits BasePersonalEducationTableControlRow + ' The BasePersonalEducationTableControlRow implements code for a ROW within the + ' the PersonalEducationTableControl table. The BasePersonalEducationTableControlRow implements the DataBind and SaveData methods. + ' The loading of data is actually performed by the LoadData method in the base class of PersonalEducationTableControl. + 'Protected Overrides Sub PopulateEducationPeriodDropDownList( _ + ' ByVal selectedValue As String, _ + ' ByVal maxItems As Integer) + ' + ' Me.EducationPeriod.Items.Clear() + ' + ' Me.EducationPeriod.Items.Add(New ListItem("ก่อน", "1")) + ' Me.EducationPeriod.Items.Add(New ListItem("หลัง", "2")) + '' 3. Set the selected value (insert if not already present). + ' If Not selectedValue Is Nothing AndAlso _ + ' selectedValue.Trim <> "" AndAlso _ + ' Not SetSelectedValue(Me.EducationPeriod, selectedValue) AndAlso _ + ' Not MiscUtils.SetSelectedValue(Me.EducationPeriod, PersonalEducationTable.EducationPeriod.Format(selectedValue)) Then + 'Dim fvalue As String = PersonalEducationTable.EducationPeriod.Format(selectedValue) + 'Dim item As ListItem = New ListItem(fvalue, selectedValue) + ' item.Selected = True + ' Me.EducationPeriod.Items.Insert(0, item) + ' End If + ' + ' + '' 4. Insert the language specific "Please Select" item at the top. + ' Me.EducationPeriod.Items.Insert(0, New ListItem(Page.GetResourceValue("Txt:PleaseSelect", "Persons"), "--PLEASE_SELECT--")) + ' + 'End Sub + + +End Class + + + +Public Class PersonalEducationTableControl + Inherits BasePersonalEducationTableControl + + ' The BasePersonalEducationTableControl class implements the LoadData, DataBind, CreateWhereClause + ' and other methods to load and display the data in a table control. + + ' This is the ideal place to add your code customizations. You can override the LoadData and CreateWhereClause, + ' The PersonalEducationTableControlRow class offers another place where you can customize + ' the DataBind, GetUIData, SaveData and Validate methods specific to each row displayed on the table. + +End Class + + +Public Class PersonalExtWorkTableControlRow + Inherits BasePersonalExtWorkTableControlRow + ' The BasePersonalExtWorkTableControlRow implements code for a ROW within the + ' the PersonalExtWorkTableControl table. The BasePersonalExtWorkTableControlRow implements the DataBind and SaveData methods. + ' The loading of data is actually performed by the LoadData method in the base class of PersonalExtWorkTableControl. + + ' This is the ideal place to add your code customizations. For example, you can override the DataBind, + ' SaveData, GetUIData, and Validate methods. + + +End Class + + + +Public Class PersonalExtWorkTableControl + Inherits BasePersonalExtWorkTableControl + + ' The BasePersonalExtWorkTableControl class implements the LoadData, DataBind, CreateWhereClause + ' and other methods to load and display the data in a table control. + + ' This is the ideal place to add your code customizations. You can override the LoadData and CreateWhereClause, + ' The PersonalExtWorkTableControlRow class offers another place where you can customize + ' the DataBind, GetUIData, SaveData and Validate methods specific to each row displayed on the table. + +End Class + + +Public Class PersonalInsigniaTableControlRow + Inherits BasePersonalInsigniaTableControlRow + ' The BasePersonalInsigniaTableControlRow implements code for a ROW within the + ' the PersonalInsigniaTableControl table. The BasePersonalInsigniaTableControlRow implements the DataBind and SaveData methods. + ' The loading of data is actually performed by the LoadData method in the base class of PersonalInsigniaTableControl. + + ' This is the ideal place to add your code customizations. For example, you can override the DataBind, + ' SaveData, GetUIData, and Validate methods. + + +End Class + + + +Public Class PersonalInsigniaTableControl + Inherits BasePersonalInsigniaTableControl + + ' The BasePersonalInsigniaTableControl class implements the LoadData, DataBind, CreateWhereClause + ' and other methods to load and display the data in a table control. + + ' This is the ideal place to add your code customizations. You can override the LoadData and CreateWhereClause, + ' The PersonalInsigniaTableControlRow class offers another place where you can customize + ' the DataBind, GetUIData, SaveData and Validate methods specific to each row displayed on the table. + +End Class + + +Public Class PersonalLanguageSkillTableControlRow + Inherits BasePersonalLanguageSkillTableControlRow + ' The BasePersonalLanguageSkillTableControlRow implements code for a ROW within the + ' the PersonalLanguageSkillTableControl table. The BasePersonalLanguageSkillTableControlRow implements the DataBind and SaveData methods. + ' The loading of data is actually performed by the LoadData method in the base class of PersonalLanguageSkillTableControl. + + ' This is the ideal place to add your code customizations. For example, you can override the DataBind, + ' SaveData, GetUIData, and Validate methods. + + +End Class + + + +Public Class PersonalLanguageSkillTableControl + Inherits BasePersonalLanguageSkillTableControl + + ' The BasePersonalLanguageSkillTableControl class implements the LoadData, DataBind, CreateWhereClause + ' and other methods to load and display the data in a table control. + + ' This is the ideal place to add your code customizations. You can override the LoadData and CreateWhereClause, + ' The PersonalLanguageSkillTableControlRow class offers another place where you can customize + ' the DataBind, GetUIData, SaveData and Validate methods specific to each row displayed on the table. + +End Class + + +Public Class PersonalNameTableControlRow + Inherits BasePersonalNameTableControlRow + ' The BasePersonalNameTableControlRow implements code for a ROW within the + ' the PersonalNameTableControl table. The BasePersonalNameTableControlRow implements the DataBind and SaveData methods. + ' The loading of data is actually performed by the LoadData method in the base class of PersonalNameTableControl. + + ' This is the ideal place to add your code customizations. For example, you can override the DataBind, + ' SaveData, GetUIData, and Validate methods. + + +End Class + + + +Public Class PersonalNameTableControl + Inherits BasePersonalNameTableControl + + ' The BasePersonalNameTableControl class implements the LoadData, DataBind, CreateWhereClause + ' and other methods to load and display the data in a table control. + + ' This is the ideal place to add your code customizations. You can override the LoadData and CreateWhereClause, + ' The PersonalNameTableControlRow class offers another place where you can customize + ' the DataBind, GetUIData, SaveData and Validate methods specific to each row displayed on the table. + +End Class + + +Public Class PersonalRankTableControlRow + Inherits BasePersonalRankTableControlRow + + Protected Overrides Sub PopulateRankId1DropDownList( _ + ByVal selectedValue As String, _ + ByVal maxItems As Integer) + + Dim wc As WhereClause = CreateWhereClause_RankId1DropDownList() + wc.iAND(RankTable.RankId, BaseFilter.ComparisonOperator.Less_Than, "61") + wc.iOR(RankTable.RankId, BaseFilter.ComparisonOperator.Greater_Than, "69") + + Dim orderBy As OrderBy = New OrderBy(False, True) + orderBy.Add(RankTable.ArmyId, OrderByItem.OrderDir.Asc) + orderBy.Add(RankTable.RankId, OrderByItem.OrderDir.Asc) + + + ' 2. Read a total of maxItems from the database and insert them into the RankId1DropDownList. + Me.RankId1.Items.Clear() + Dim itemValue As RankRecord + For Each itemValue In RankTable.GetRecords(wc, orderBy, 0, maxItems) + ' Create the item and add to the list. + Dim cvalue As String = Nothing + Dim fvalue As String = Nothing + If itemValue.RankIdSpecified Then + cvalue = itemValue.RankId.ToString() + fvalue = itemValue.Format(RankTable.ArmyId) & " - " & itemValue.Format(RankTable.RankName) + End If + + Dim item As ListItem = New ListItem(fvalue, cvalue) + Me.RankId1.Items.Add(item) + Next + + ' 3. Set the selected value (insert if not already present). + If Not selectedValue Is Nothing AndAlso _ + selectedValue.Trim <> "" AndAlso _ + Not SetSelectedValue(Me.RankId1, selectedValue) AndAlso _ + Not MiscUtils.SetSelectedValue(Me.RankId1, PersonalRankTable.RankId.Format(selectedValue)) Then + Dim fvalue As String = PersonalRankTable.RankId.Format(selectedValue) + Dim item As ListItem = New ListItem(fvalue, selectedValue) + item.Selected = True + Me.RankId1.Items.Insert(0, item) + End If + + + ' 4. Insert the language specific "Please Select" item at the top. + Me.RankId1.Items.Insert(0, New ListItem(Page.GetResourceValue("Txt:PleaseSelect", "Persons"), "--PLEASE_SELECT--")) + + End Sub + + +End Class + + + +Public Class PersonalRankTableControl + Inherits BasePersonalRankTableControl + + Public Overrides Function CreateOrderBy() As OrderBy + ' The CurrentSortOrder is initialized to the sort order on the + ' Query Wizard. It may be modified by the Click handler for any of + ' the column heading to sort or reverse sort by that column. + ' You can add your own sort order, or modify it on the Query Wizard. + Dim orderby As OrderBy = New OrderBy(False, False) + orderby.Add(PersonalRankTable.RankId, OrderByItem.OrderDir.Desc) + orderby.Add(PersonalRankTable.PreRank, OrderByItem.OrderDir.Desc) + Return orderby + 'Return Me.CurrentSortOrder + End Function + + +End Class + + +Public Class PersonalSalaryTableControlRow + Inherits BasePersonalSalaryTableControlRow + ' The BasePersonalSalaryTableControlRow implements code for a ROW within the + ' the PersonalSalaryTableControl table. The BasePersonalSalaryTableControlRow implements the DataBind and SaveData methods. + ' The loading of data is actually performed by the LoadData method in the base class of PersonalSalaryTableControl. + + ' This is the ideal place to add your code customizations. For example, you can override the DataBind, + ' SaveData, GetUIData, and Validate methods. + + +End Class + + + +Public Class PersonalSalaryTableControl + Inherits BasePersonalSalaryTableControl + + ' The BasePersonalSalaryTableControl class implements the LoadData, DataBind, CreateWhereClause + ' and other methods to load and display the data in a table control. + + ' This is the ideal place to add your code customizations. You can override the LoadData and CreateWhereClause, + ' The PersonalSalaryTableControlRow class offers another place where you can customize + ' the DataBind, GetUIData, SaveData and Validate methods specific to each row displayed on the table. + +End Class + + +Public Class PersonalSpecialSkillTableControlRow + Inherits BasePersonalSpecialSkillTableControlRow + ' The BasePersonalSpecialSkillTableControlRow implements code for a ROW within the + ' the PersonalSpecialSkillTableControl table. The BasePersonalSpecialSkillTableControlRow implements the DataBind and SaveData methods. + ' The loading of data is actually performed by the LoadData method in the base class of PersonalSpecialSkillTableControl. + + ' This is the ideal place to add your code customizations. For example, you can override the DataBind, + ' SaveData, GetUIData, and Validate methods. + + +End Class + + + +Public Class PersonalSpecialSkillTableControl + Inherits BasePersonalSpecialSkillTableControl + + ' The BasePersonalSpecialSkillTableControl class implements the LoadData, DataBind, CreateWhereClause + ' and other methods to load and display the data in a table control. + + ' This is the ideal place to add your code customizations. You can override the LoadData and CreateWhereClause, + ' The PersonalSpecialSkillTableControlRow class offers another place where you can customize + ' the DataBind, GetUIData, SaveData and Validate methods specific to each row displayed on the table. + +End Class + + + + +Public Class PersonalTitleTableControlRow + Inherits BasePersonalTitleTableControlRow + ' The BasePersonalTitleTableControlRow implements code for a ROW within the + ' the PersonalTitleTableControl table. The BasePersonalTitleTableControlRow implements the DataBind and SaveData methods. + ' The loading of data is actually performed by the LoadData method in the base class of PersonalTitleTableControl. + + ' This is the ideal place to add your code customizations. For example, you can override the DataBind, + ' SaveData, GetUIData, and Validate methods. + + +End Class + + + +Public Class PersonalTitleTableControl + Inherits BasePersonalTitleTableControl + + ' The BasePersonalTitleTableControl class implements the LoadData, DataBind, CreateWhereClause + ' and other methods to load and display the data in a table control. + + ' This is the ideal place to add your code customizations. You can override the LoadData and CreateWhereClause, + ' The PersonalTitleTableControlRow class offers another place where you can customize + ' the DataBind, GetUIData, SaveData and Validate methods specific to each row displayed on the table. + +End Class + + + + +Public Class PersonalIdRecordControl + Inherits BasePersonalIdRecordControl + ' The BasePersonalIdRecordControl implements the LoadData, DataBind and other + ' methods to load and display the data in a table control. + + Protected Overrides Sub PopulateRankIdDropDownList( _ + ByVal selectedValue As String, _ + ByVal maxItems As Integer) + + ' Populate the RankIdDropDownList with the + ' foreign key values from the Rank table. + + ' This is a four step process. + ' 1. Set up the WHERE and the ORDER BY clause to read from the Rank. + ' 2. Read a total of maxItems from the database and insert them into the RankIdDropDownList. + ' 3. Set the selected value (insert if not already present). + ' 4. Insert the language specific "Please Select" item at the top. + + ' 1. Set up the WHERE and the ORDER BY clause by calling the CreateWhereClause_RankIdDropDownList function. + ' It is better to customize the where clause there. + Dim wc As WhereClause = CreateWhereClause_RankIdDropDownList() + wc.iAND(RankTable.RankId, BaseFilter.ComparisonOperator.Less_Than, "61") + wc.iOR(RankTable.RankId, BaseFilter.ComparisonOperator.Greater_Than, "69") + + Dim orderBy As OrderBy = New OrderBy(False, True) + orderBy.Add(RankTable.ArmyId, OrderByItem.OrderDir.Asc) + orderBy.Add(RankTable.RankId, OrderByItem.OrderDir.Asc) + + ' 2. Read a total of maxItems from the database and insert them into the RankIdDropDownList. + Me.RankId.Items.Clear() + Dim itemValue As RankRecord + For Each itemValue In RankTable.GetRecords(wc, orderBy, 0, maxItems) + ' Create the item and add to the list. + Dim cvalue As String = Nothing + Dim fvalue As String = Nothing + If itemValue.RankIdSpecified Then + cvalue = itemValue.RankId.ToString() + fvalue = itemValue.Format(RankTable.ArmyId) & " - " & itemValue.Format(RankTable.RankName) + End If + + Dim item As ListItem = New ListItem(fvalue, cvalue) + Me.RankId.Items.Add(item) + Next + + ' 3. Set the selected value (insert if not already present). + If Not selectedValue Is Nothing AndAlso _ + selectedValue.Trim <> "" AndAlso _ + Not SetSelectedValue(Me.RankId, selectedValue) AndAlso _ + Not MiscUtils.SetSelectedValue(Me.RankId, PersonalIdTable.RankId.Format(selectedValue)) Then + Dim fvalue As String = PersonalIdTable.RankId.Format(selectedValue) + Dim item As ListItem = New ListItem(fvalue, selectedValue) + item.Selected = True + Me.RankId.Items.Insert(0, item) + End If + + + ' 4. Insert the language specific "Please Select" item at the top. + Me.RankId.Items.Insert(0, New ListItem(Page.GetResourceValue("Txt:PleaseSelect", "Persons"), "--PLEASE_SELECT--")) + + End Sub + + Protected Overrides Sub PopulateArmIdDropDownList( _ + ByVal selectedValue As String, _ + ByVal maxItems As Integer) + + ' Populate the ArmIdDropDownList with the + ' foreign key values from the Arm table. + + ' This is a four step process. + ' 1. Set up the WHERE and the ORDER BY clause to read from the Arm. + ' 2. Read a total of maxItems from the database and insert them into the ArmIdDropDownList. + ' 3. Set the selected value (insert if not already present). + ' 4. Insert the language specific "Please Select" item at the top. + + ' 1. Set up the WHERE and the ORDER BY clause by calling the CreateWhereClause_ArmIdDropDownList function. + ' It is better to customize the where clause there. + Dim wc As WhereClause = CreateWhereClause_ArmIdDropDownList() + ' wc.iAND (PersonalIdTable .ArmyId ,BaseFilter.ComparisonOperator.EqualsTo ,Me.ArmyId .Text + Dim orderBy As OrderBy = New OrderBy(False, True) + orderBy.Add(ArmTable.ArmId, OrderByItem.OrderDir.Asc) + + ' 2. Read a total of maxItems from the database and insert them into the ArmIdDropDownList. + Me.ArmId.Items.Clear() + Dim itemValue As ArmRecord + For Each itemValue In ArmTable.GetRecords(wc, orderBy, 0, maxItems) + ' Create the item and add to the list. + Dim cvalue As String = Nothing + Dim fvalue As String = Nothing + If itemValue.ArmIdSpecified Then + cvalue = itemValue.ArmId.ToString() + fvalue = itemValue.Format(ArmTable.ArmyId) & " - " & itemValue.Format(ArmTable.ArmName) + End If + + Dim item As ListItem = New ListItem(fvalue, cvalue) + Me.ArmId.Items.Add(item) + Next + + ' 3. Set the selected value (insert if not already present). + If Not selectedValue Is Nothing AndAlso _ + selectedValue.Trim <> "" AndAlso _ + Not SetSelectedValue(Me.ArmId, selectedValue) AndAlso _ + Not MiscUtils.SetSelectedValue(Me.ArmId, PersonalIdTable.ArmId.Format(selectedValue)) Then + Dim fvalue As String = PersonalIdTable.ArmId.Format(selectedValue) + Dim item As ListItem = New ListItem(fvalue, selectedValue) + item.Selected = True + Me.ArmId.Items.Insert(0, item) + End If + + + ' 4. Insert the language specific "Please Select" item at the top. + Me.ArmId.Items.Insert(0, New ListItem(Page.GetResourceValue("Txt:PleaseSelect", "Persons"), "--PLEASE_SELECT--")) + + + + End Sub + + + Private Sub PersonalIdRecordControl_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load + AddHandler Me.PersonalId.TextChanged, AddressOf PersonalId_TextChanged + + End Sub + + Private Sub PersonalId_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) + 'update PersonalId + ' Ps.ChingePID(Me.DataSource.PersonalId, Me.PersonalId.Text) + 'Me.DataChanged = True + 'Me.SaveData() + Try + DbUtils.StartTransaction() + Dim Rec As PersonalIdRecord = Me.GetRecord + If Me.PersonalId.Text <> Rec.PersonalId Then + If Ps.IsPid(Me.PersonalId.Text) Then + Ps.ChingePID(Rec.PersonalId, Me.PersonalId.Text) + DbUtils.CommitTransaction() + 'Me.Page.CurrentSecurity.SetUser(Me.PersonalName.Text, Me.PersonalId.Text) + Me.Page.RedirectToLoginPage() + Else + Throw New Exception("กรอกรหัสประจำตัวประชาชนไม่ถูกต้อง") + End If + End If + Catch ex As ApplicationException + MiscUtils.RegisterJScriptAlert(Me, "", ex.Message) + End Try + + + End Sub + + + Protected Overrides Sub PopulateDeptIdDropDownList( _ + ByVal selectedValue As String, _ + ByVal maxItems As Integer) + + ' Populate the DeptIdDropDownList with the + ' foreign key values from the Dept table. + + ' This is a four step process. + ' 1. Set up the WHERE and the ORDER BY clause to read from the Dept. + ' 2. Read a total of maxItems from the database and insert them into the DeptIdDropDownList. + ' 3. Set the selected value (insert if not already present). + ' 4. Insert the language specific "Please Select" item at the top. + + ' 1. Set up the WHERE and the ORDER BY clause by calling the CreateWhereClause_DeptIdDropDownList function. + ' It is better to customize the where clause there. + Dim wc As WhereClause = CreateWhereClause_DeptIdDropDownList() + Dim orderBy As OrderBy = New OrderBy(False, True) + orderBy.Add(DeptTable.SectionId, OrderByItem.OrderDir.Asc) + orderBy.Add(DeptTable.Dept, OrderByItem.OrderDir.Asc) + + ' 2. Read a total of maxItems from the database and insert them into the DeptIdDropDownList. + Me.DeptId.Items.Clear() + Dim itemValue As DeptRecord + For Each itemValue In DeptTable.GetRecords(wc, orderBy, 0, maxItems) + ' Create the item and add to the list. + Dim cvalue As String = Nothing + Dim fvalue As String = Nothing + If itemValue.DeptIdSpecified Then + cvalue = itemValue.DeptId.ToString() + fvalue = itemValue.Format(DeptTable.SectionId) & " - " & itemValue.Format(DeptTable.Dept) + End If + + Dim item As ListItem = New ListItem(fvalue, cvalue) + Me.DeptId.Items.Add(item) + Next + + ' 3. Set the selected value (insert if not already present). + If Not selectedValue Is Nothing AndAlso _ + selectedValue.Trim <> "" AndAlso _ + Not SetSelectedValue(Me.DeptId, selectedValue) AndAlso _ + Not MiscUtils.SetSelectedValue(Me.DeptId, PersonalIdTable.DeptId.Format(selectedValue)) Then + Dim fvalue As String = PersonalIdTable.DeptId.Format(selectedValue) + Dim item As ListItem = New ListItem(fvalue, selectedValue) + item.Selected = True + Me.DeptId.Items.Insert(0, item) + End If + + + ' 4. Insert the language specific "Please Select" item at the top. + Me.DeptId.Items.Insert(0, New ListItem(Page.GetResourceValue("Txt:PleaseSelect", "Persons"), "--PLEASE_SELECT--")) + + End Sub + + + + End Class + + + +Public Class PersonalSportSkillTableControl1 + Inherits BasePersonalSportSkillTableControl1 + + ' The BasePersonalSportSkillTableControl1 class implements the LoadData, DataBind, CreateWhereClause + ' and other methods to load and display the data in a table control. + + ' This is the ideal place to add your code customizations. You can override the LoadData and CreateWhereClause, + ' The PersonalSportSkillTableControl1Row class offers another place where you can customize + ' the DataBind, GetUIData, SaveData and Validate methods specific to each row displayed on the table. + +End Class +Public Class PersonalSportSkillTableControl1Row + Inherits BasePersonalSportSkillTableControl1Row + ' The BasePersonalSportSkillTableControl1Row implements code for a ROW within the + ' the PersonalSportSkillTableControl1 table. The BasePersonalSportSkillTableControl1Row implements the DataBind and SaveData methods. + ' The loading of data is actually performed by the LoadData method in the base class of PersonalSportSkillTableControl1. + + ' This is the ideal place to add your code customizations. For example, you can override the DataBind, + ' SaveData, GetUIData, and Validate methods. + + + End Class +Public Class PersonRelativeTableControl + Inherits BasePersonRelativeTableControl + + Public Overrides Function CreateOrderBy() As OrderBy + ' The CurrentSortOrder is initialized to the sort order on the + ' Query Wizard. It may be modified by the Click handler for any of + ' the column heading to sort or reverse sort by that column. + ' You can add your own sort order, or modify it on the Query Wizard. + Dim orderby As OrderBy = New OrderBy(False, False) + orderby.Add(PersonRelativeTable.RelationId, OrderByItem.OrderDir.Asc) + orderby.Add(PersonRelativeTable.RBirthDate, OrderByItem.OrderDir.Asc) + Return orderby + 'Return Me.CurrentSortOrder + End Function + + +End Class +Public Class PersonRelativeTableControlRow + Inherits BasePersonRelativeTableControlRow + ' The BasePersonRelativeTableControlRow implements code for a ROW within the + ' the PersonRelativeTableControl table. The BasePersonRelativeTableControlRow implements the DataBind and SaveData methods. + ' The loading of data is actually performed by the LoadData method in the base class of PersonRelativeTableControl. + + ' This is the ideal place to add your code customizations. For example, you can override the DataBind, + ' SaveData, GetUIData, and Validate methods. + + +End Class +#End Region + + + +#Region "Section 2: Do not modify this section." + + +' Base class for the PersonalDDTableControlRow control on the EditPersonalId page. +' Do not modify this class. Instead override any method in PersonalDDTableControlRow. +Public Class BasePersonalDDTableControlRow + Inherits Persons.UI.BaseApplicationRecordControl + + ' To customize, override this method in PersonalDDTableControlRow. + Protected Overridable Sub Control_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Init + + Me.ClearControlsFromSession() + End Sub + + ' To customize, override this method in PersonalDDTableControlRow. + Protected Overridable Sub Control_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load + + 'Call LoadFocusScripts from repeater so that onfocus attribute could be added to elements + Me.Page.LoadFocusScripts(Me) + + ' Show confirmation message on Click + Me.PersonalDDRowDeleteButton.Attributes.Add("onClick", "return (confirm('" & (CType(Me.Page,BaseApplicationPage)).GetResourceValue("DeleteRecordConfirm", "Persons") & "'));") + + + ' Register the event handlers. + + AddHandler Me.PersonalDDRowDeleteButton.Click, AddressOf PersonalDDRowDeleteButton_Click + + AddHandler Me.PersonalDDRowEditButton.Click, AddressOf PersonalDDRowEditButton_Click + + AddHandler Me.PersonalDDRowViewButton.Click, AddressOf PersonalDDRowViewButton_Click + + AddHandler Me.EndDate.TextChanged, AddressOf EndDate_TextChanged + + AddHandler Me.Mission.TextChanged, AddressOf Mission_TextChanged + + AddHandler Me.Ref1.TextChanged, AddressOf Ref1_TextChanged + + AddHandler Me.RefDate.TextChanged, AddressOf RefDate_TextChanged + + AddHandler Me.StartDate.TextChanged, AddressOf StartDate_TextChanged + + + End Sub + + + Public Overridable Sub LoadData() + + ' Load the data from the database into the DataSource PersonalDD 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 = PersonalDDTable.GetRecord(Me.RecordUniqueId, True) + + Return + End If + + ' Since this is a row in the table, the data for this row is loaded by the + ' LoadData method of the BasePersonalDDTableControl when the data for the entire + ' table is loaded. + + Me.DataSource = New PersonalDDRecord() + + + + End Sub + + ' Populate the UI controls using the DataSource. To customize, override this method in PersonalDDTableControlRow. + 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 + + SetEndDate() + SetMission() + + + + + SetRef1() + SetRefDate() + SetStartDate() + + + Me.IsNewRecord = True + + If Me.DataSource.IsCreated Then + Me.IsNewRecord = False + + Me.RecordUniqueId = Me.DataSource.GetID.ToXmlString() + End If + + ' Now load data for each record and table child UI controls. + ' Ordering is important because child controls get + ' their parent ids from their parent UI controls. + Dim shouldResetControl As Boolean = False + + End Sub + + + Public Overridable Sub SetEndDate() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.EndDate.ID) Then + + Me.EndDate.Text = Me.PreviousUIData(Me.EndDate.ID).ToString() + + Return + End If + + + ' Set the EndDate TextBox on the webpage with value from the + ' PersonalDD database record. + + ' Me.DataSource is the PersonalDD record retrieved from the database. + ' Me.EndDate is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetEndDate() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.EndDateSpecified Then + + ' If the EndDate is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalDDTable.EndDate, "d MMM yy") + + Me.EndDate.Text = formattedValue + + Else + + ' EndDate is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.EndDate.Text = PersonalDDTable.EndDate.Format(PersonalDDTable.EndDate.DefaultValue, "d MMM yy") + + End If + + End Sub + + Public Overridable Sub SetMission() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.Mission.ID) Then + + Me.Mission.Text = Me.PreviousUIData(Me.Mission.ID).ToString() + + Return + End If + + + ' Set the Mission TextBox on the webpage with value from the + ' PersonalDD database record. + + ' Me.DataSource is the PersonalDD record retrieved from the database. + ' Me.Mission is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetMission() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.MissionSpecified Then + + ' If the Mission is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalDDTable.Mission) + + Me.Mission.Text = formattedValue + + Else + + ' Mission is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.Mission.Text = PersonalDDTable.Mission.Format(PersonalDDTable.Mission.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetRef1() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.Ref1.ID) Then + + Me.Ref1.Text = Me.PreviousUIData(Me.Ref1.ID).ToString() + + Return + End If + + + ' Set the Ref TextBox on the webpage with value from the + ' PersonalDD database record. + + ' Me.DataSource is the PersonalDD 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(PersonalDDTable.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 = PersonalDDTable.Ref0.Format(PersonalDDTable.Ref0.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetRefDate() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.RefDate.ID) Then + + Me.RefDate.Text = Me.PreviousUIData(Me.RefDate.ID).ToString() + + Return + End If + + + ' Set the RefDate TextBox on the webpage with value from the + ' PersonalDD database record. + + ' Me.DataSource is the PersonalDD 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(PersonalDDTable.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 = PersonalDDTable.RefDate.Format(PersonalDDTable.RefDate.DefaultValue, "d MMM yy") + + End If + + End Sub + + Public Overridable Sub SetStartDate() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.StartDate.ID) Then + + Me.StartDate.Text = Me.PreviousUIData(Me.StartDate.ID).ToString() + + Return + End If + + + ' Set the StartDate TextBox on the webpage with value from the + ' PersonalDD database record. + + ' Me.DataSource is the PersonalDD record retrieved from the database. + ' Me.StartDate is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetStartDate() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.StartDateSpecified Then + + ' If the StartDate is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalDDTable.StartDate, "d MMM yy") + + Me.StartDate.Text = formattedValue + + Else + + ' StartDate is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.StartDate.Text = PersonalDDTable.StartDate.Format(PersonalDDTable.StartDate.DefaultValue, "d MMM yy") + + End If + + End Sub + + + Public EvaluateFormulaDelegate As BaseClasses.Data.DataSource.EvaluateFormulaDelegate = New BaseClasses.Data.DataSource.EvaluateFormulaDelegate(AddressOf Me.EvaluateFormula) + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean, ByVal e As FormulaEvaluator) As String + If e Is Nothing Then + e = New FormulaEvaluator() + End If + + e.Variables.Clear() + + + ' add variables for formula evaluation + If variables IsNot Nothing Then + Dim enumerator As System.Collections.Generic.IEnumerator(Of System.Collections.Generic.KeyValuePair(Of String, Object)) = variables.GetEnumerator() + While enumerator.MoveNext() + e.Variables.Add(enumerator.Current.Key, enumerator.Current.Value) + End While + End If + + If includeDS + + End IF + + + ' Other variables referred to in the formula are expected to be + ' properties of the DataSource. For example, referring to + ' UnitPrice as a variable will refer to DataSource.UnitPrice + If dataSourceForEvaluate Is Nothing Then + + e.DataSource = Me.DataSource + + Else + e.DataSource = dataSourceForEvaluate + End If + + ' Define the calling control. This is used to add other + ' related table and record controls as variables. + e.CallingControl = Me + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + + If Not String.IsNullOrEmpty(format) AndAlso (String.IsNullOrEmpty(formula) OrElse formula.IndexOf("Format(") < 0) Then + Return FormulaUtils.Format(resultObj, format) + Else + Return resultObj.ToString() + End If + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format,variables ,includeDS, Nothing) + End Function + + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object)) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format, variables ,True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, format, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal e as FormulaEvaluator) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, variables, True, e) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal includeDS as Boolean) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, includeDS, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, True, Nothing) + End Function + + + Public Overridable Sub RegisterPostback() + + + End Sub + + + + ' To customize, override this method in PersonalDDTableControlRow. + 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 parentCtrl As PersonalIdRecordControl + + + parentCtrl = DirectCast(Me.Page.FindControlRecursively("PersonalIdRecordControl"), PersonalIdRecordControl) + + If (Not IsNothing(parentCtrl) AndAlso IsNothing(parentCtrl.DataSource)) + ' Load the record if it is not loaded yet. + parentCtrl.LoadData() + End If + If (IsNothing(parentCtrl) OrElse IsNothing(parentCtrl.DataSource)) + ' Get the error message from the application resource file. + Throw New Exception(Page.GetResourceValue("Err:NoParentRecId", "Persons")) + End If + + Me.DataSource.PersonalId = parentCtrl.DataSource.PersonalId + + ' 2. Perform any custom validation. + Me.Validate() + + + ' 3. Set the values in the record with data from UI controls. + ' This calls the Get() method for each of the user interface controls. + Me.GetUIData() + + ' 4. Save in the database. + ' We should not save the record if the data did not change. This + ' will save a database hit and avoid triggering any database triggers. + + If Me.DataSource.IsAnyValueChanged Then + ' Save record to database but do not commit yet. + ' Auto generated ids are available after saving for use by child (dependent) records. + Me.DataSource.Save() + + DirectCast(GetParentControlObject(Me, "PersonalDDTableControl"), PersonalDDTableControl).DataChanged = True + DirectCast(GetParentControlObject(Me, "PersonalDDTableControl"), PersonalDDTableControl).ResetData = True + End If + + + ' update session or cookie by formula + + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + ' For Master-Detail relationships, save data on the Detail table(s) + + End Sub + + ' To customize, override this method in PersonalDDTableControlRow. + 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. + + GetEndDate() + GetMission() + GetRef1() + GetRefDate() + GetStartDate() + End Sub + + + Public Overridable Sub GetEndDate() + + ' Retrieve the value entered by the user on the EndDate ASP:TextBox, and + ' save it into the EndDate field in DataSource PersonalDD 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.EndDate.Text, PersonalDDTable.EndDate) + + + End Sub + + Public Overridable Sub GetMission() + + ' Retrieve the value entered by the user on the Mission ASP:TextBox, and + ' save it into the Mission field in DataSource PersonalDD record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.Mission.Text, PersonalDDTable.Mission) + + + 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 PersonalDD record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.Ref1.Text, PersonalDDTable.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 PersonalDD 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, PersonalDDTable.RefDate) + + + End Sub + + Public Overridable Sub GetStartDate() + + ' Retrieve the value entered by the user on the StartDate ASP:TextBox, and + ' save it into the StartDate field in DataSource PersonalDD 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.StartDate.Text, PersonalDDTable.StartDate) + + + End Sub + + + ' To customize, override this method in PersonalDDTableControlRow. + + Public Overridable Function CreateWhereClause() As WhereClause + + Return Nothing + + End Function + + + + ' To customize, override this method in PersonalDDTableControlRow. + 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) + PersonalDDTable.DeleteRecord(pkValue) + + DirectCast(GetParentControlObject(Me, "PersonalDDTableControl"), PersonalDDTableControl).DataChanged = True + DirectCast(GetParentControlObject(Me, "PersonalDDTableControl"), PersonalDDTableControl).ResetData = True + End Sub + + Protected Overridable Sub Control_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.PreRender + ' PreRender event is raised just before page is being displayed. + Try + DbUtils.StartTransaction() + Me.RegisterPostback() + + If Not Me.Page.ErrorOnPage AndAlso (Me.Page.IsPageRefresh OrElse Me.DataChanged OrElse Me.ResetData) Then + + + ' Re-load the data and update the web page if necessary. + ' This is typically done during a postback (filter, search button, sort, pagination button). + ' In each of the other click handlers, simply set DataChanged to True to reload the data. + Me.LoadData() + Me.DataBind() + End If + + + Catch ex As Exception + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + Finally + DbUtils.EndTransaction() + End Try + End Sub + + + Protected Overrides Sub SaveControlsToSession() + MyBase.SaveControlsToSession() + + + 'Save pagination state to session. + + End Sub + + + + Protected Overrides Sub ClearControlsFromSession() + MyBase.ClearControlsFromSession() + + + + ' Clear pagination state from session. + + End Sub + + Protected Overrides Sub LoadViewState(ByVal savedState As Object) + MyBase.LoadViewState(savedState) + Dim isNewRecord As String = CType(ViewState("IsNewRecord"), String) + If Not isNewRecord Is Nothing AndAlso isNewRecord.Trim <> "" Then + Me.IsNewRecord = Boolean.Parse(isNewRecord) + End If + + Dim myCheckSum As String = CType(ViewState("CheckSum"), String) + If Not myCheckSum Is Nothing AndAlso myCheckSum.Trim <> "" Then + Me.CheckSum = myCheckSum + End If + + + ' Load view state for pagination control. + + End Sub + + Protected Overrides Function SaveViewState() As Object + ViewState("IsNewRecord") = Me.IsNewRecord.ToString() + ViewState("CheckSum") = Me.CheckSum + + + ' Load view state for pagination control. + + Return MyBase.SaveViewState() + End Function + + + ' event handler for ImageButton + Public Overridable Sub PersonalDDRowDeleteButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + If(Not Me.Page.IsPageRefresh) Then + + Dim tc As PersonalDDTableControl = DirectCast(GetParentControlObject(Me, "PersonalDDTableControl"), PersonalDDTableControl) + If Not (IsNothing(tc)) Then + If Not Me.IsNewRecord Then + tc.AddToDeletedRecordIds(DirectCast(Me, PersonalDDTableControlRow)) + End If + Me.Visible = False + tc.SetFormulaControls() + End If + + End If + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalDDRowEditButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + ' The redirect URL is set on the Properties, Custom Properties or Actions. + ' The ModifyRedirectURL call resolves the parameters before the + ' Response.Redirect redirects the page to the URL. + ' Any code after the Response.Redirect call will not be executed, since the page is + ' redirected to the URL. + + + Dim url As String = "../Shared/ConfigureEditRecord.aspx" + + Dim shouldRedirect As Boolean = True + Dim TargetKey As String = Nothing + Dim DFKA As String = TargetKey + Dim id As String = DFKA + Dim value As String = id + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + url = Me.ModifyRedirectUrl(url, "",False) + url = Me.Page.ModifyRedirectUrl(url, "",False) + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + shouldRedirect = False + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + If shouldRedirect Then + Me.Page.ShouldSaveControlsToSession = True + Me.Page.Response.Redirect(url) + ElseIf Not TargetKey Is Nothing AndAlso _ + Not shouldRedirect Then + Me.Page.ShouldSaveControlsToSession = True + Me.Page.CloseWindow(True) + + End If + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalDDRowViewButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + ' The redirect URL is set on the Properties, Custom Properties or Actions. + ' The ModifyRedirectURL call resolves the parameters before the + ' Response.Redirect redirects the page to the URL. + ' Any code after the Response.Redirect call will not be executed, since the page is + ' redirected to the URL. + + + Dim url As String = "../Shared/ConfigureViewRecord.aspx" + + Dim shouldRedirect As Boolean = True + Dim TargetKey As String = Nothing + Dim DFKA As String = TargetKey + Dim id As String = DFKA + Dim value As String = id + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + url = Me.ModifyRedirectUrl(url, "",False) + url = Me.Page.ModifyRedirectUrl(url, "",False) + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + shouldRedirect = False + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + If shouldRedirect Then + Me.Page.ShouldSaveControlsToSession = True + Me.Page.Response.Redirect(url) + ElseIf Not TargetKey Is Nothing AndAlso _ + Not shouldRedirect Then + Me.Page.ShouldSaveControlsToSession = True + Me.Page.CloseWindow(True) + + End If + End Sub + + Protected Overridable Sub EndDate_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub Mission_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 StartDate_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("BasePersonalDDTableControlRow_Rec"), String) + End Get + Set(ByVal value As String) + Me.ViewState("BasePersonalDDTableControlRow_Rec") = value + End Set + End Property + + Private _DataSource As PersonalDDRecord + Public Property DataSource() As PersonalDDRecord + Get + Return Me._DataSource + End Get + + Set(ByVal value As PersonalDDRecord) + + Me._DataSource = value + End Set + End Property + + + + Private _checkSum As String + Public Overridable Property CheckSum() As String + Get + Return Me._checkSum + End Get + Set(ByVal value As String) + Me._checkSum = value + End Set + End Property + + Private _TotalPages As Integer + Public Property TotalPages() As Integer + Get + Return Me._TotalPages + End Get + Set(ByVal value As Integer) + Me._TotalPages = value + End Set + End Property + + Private _PageIndex As Integer + Public Property PageIndex() As Integer + Get + ' Return the PageIndex + Return Me._PageIndex + End Get + Set(ByVal value As Integer) + Me._PageIndex = value + End Set + End Property + + Private _DisplayLastPage As Boolean + Public Property DisplayLastPage() As Boolean + Get + Return Me._DisplayLastPage + End Get + Set(ByVal value As Boolean) + Me._DisplayLastPage = value + End Set + End Property + + + +#Region "Helper Properties" + + Public ReadOnly Property EndDate() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "EndDate"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property Mission() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Mission"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property PersonalDDRecordRowSelection() As System.Web.UI.WebControls.CheckBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalDDRecordRowSelection"), System.Web.UI.WebControls.CheckBox) + End Get + End Property + + Public ReadOnly Property PersonalDDRowDeleteButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalDDRowDeleteButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalDDRowEditButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalDDRowEditButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalDDRowViewButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalDDRowViewButton"), System.Web.UI.WebControls.ImageButton) + 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 StartDate() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "StartDate"), System.Web.UI.WebControls.TextBox) + 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 PersonalDDRecord = 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 PersonalDDRecord + If Not Me.DataSource Is Nothing Then + Return Me.DataSource + End If + + If Not Me.RecordUniqueId Is Nothing Then + + Return PersonalDDTable.GetRecord(Me.RecordUniqueId, True) + + End If + + ' Localization. + + Return Nothing + + End Function + + Public Shadows ReadOnly Property Page() As BaseApplicationPage + Get + Return DirectCast(MyBase.Page, BaseApplicationPage) + End Get + End Property + +#End Region + +End Class + + + +' Base class for the PersonalDDTableControl control on the EditPersonalId page. +' Do not modify this class. Instead override any method in PersonalDDTableControl. +Public Class BasePersonalDDTableControl + Inherits Persons.UI.BaseApplicationTableControl + + + + Protected Overridable Sub Control_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Init + + + + ' Setup the filter and search events. + + + + ' Control Initializations. + ' Initialize the table's current sort order. + + If Me.InSession(Me, "Order_By") Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + Me.CurrentSortOrder.Add(PersonalDDTable.StartDate, OrderByItem.OrderDir.Asc) + + End If + + + + ' Setup default pagination settings. + + Me.PageSize = CInt(Me.GetFromSession(Me, "Page_Size", "10")) + Me.PageIndex = CInt(Me.GetFromSession(Me, "Page_Index", "0")) + + + + Me.ClearControlsFromSession() + End Sub + + Protected Overridable Sub Control_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load + + SaveControlsToSession_Ajax() + + ' Show confirmation message on Click + Me.PersonalDDDeleteButton.Attributes.Add("onClick", "return (confirm('" & (CType(Me.Page,BaseApplicationPage)).GetResourceValue("DeleteConfirm", "Persons") & "'));") + + ' Setup the pagination events. + + AddHandler Me.PersonalDDPagination.FirstPage.Click, AddressOf PersonalDDPagination_FirstPage_Click + + AddHandler Me.PersonalDDPagination.LastPage.Click, AddressOf PersonalDDPagination_LastPage_Click + + AddHandler Me.PersonalDDPagination.NextPage.Click, AddressOf PersonalDDPagination_NextPage_Click + + AddHandler Me.PersonalDDPagination.PageSizeButton.Click, AddressOf PersonalDDPagination_PageSizeButton_Click + + AddHandler Me.PersonalDDPagination.PreviousPage.Click, AddressOf PersonalDDPagination_PreviousPage_Click + + + ' Setup the sorting events. + + AddHandler Me.EndDateLabel1.Click, AddressOf EndDateLabel1_Click + + AddHandler Me.MissionLabel.Click, AddressOf MissionLabel_Click + + AddHandler Me.RefDateLabel.Click, AddressOf RefDateLabel_Click + + AddHandler Me.RefLabel.Click, AddressOf RefLabel_Click + + AddHandler Me.StartDateLabel1.Click, AddressOf StartDateLabel1_Click + + ' Setup the button events. + + AddHandler Me.PersonalDDAddButton.Click, AddressOf PersonalDDAddButton_Click + + AddHandler Me.PersonalDDDeleteButton.Click, AddressOf PersonalDDDeleteButton_Click + + AddHandler Me.PersonalDDEditButton.Click, AddressOf PersonalDDEditButton_Click + + AddHandler Me.PersonalDDResetButton.Click, AddressOf PersonalDDResetButton_Click + + + ' Setup events for others + + End Sub + + + Public Overridable Sub LoadData() + + ' Read data from database. Returns an array of records that can be assigned + ' to the DataSource table control property. + Try + Dim joinFilter As CompoundFilter = CreateCompoundJoinFilter() + + ' The WHERE clause will be empty when displaying all records in table. + Dim wc As WhereClause = CreateWhereClause() + If wc IsNot Nothing AndAlso Not wc.RunQuery Then + ' Initialize an empty array of records + Dim alist As New ArrayList(0) + Me.DataSource = DirectCast(alist.ToArray(GetType(PersonalDDRecord)), PersonalDDRecord()) + ' Add records to the list if needed. + Me.AddNewRecords() + Me._TotalRecords = 0 + Me._TotalPages = 0 + Return + End If + + ' Call OrderBy to determine the order - either use the order defined + ' on the Query Wizard, or specified by user (by clicking on column heading) + Dim orderBy As OrderBy = CreateOrderBy() + + ' Get the pagesize from the pagesize control. + Me.GetPageSize() + + If Me.DisplayLastPage Then + Dim totalRecords As Integer = If(Me._TotalRecords < 0, PersonalDDTable.GetRecordCount(CreateCompoundJoinFilter(), CreateWhereClause()), Me._TotalRecords) + + Dim totalPages As Integer = CInt(Math.Ceiling(totalRecords / Me.PageSize)) + + Me.PageIndex = totalPages - 1 + End If + + ' Make sure PageIndex (current page) and PageSize are within bounds. + If Me.PageIndex < 0 Then + Me.PageIndex = 0 + End If + If Me.PageSize < 1 Then + Me.PageSize = 1 + End If + + ' Retrieve the records and set the table DataSource. + ' Only PageSize records are fetched starting at PageIndex (zero based). + If Me.AddNewRecord > 0 Then + ' Make sure to preserve the previously entered data on new rows. + Dim postdata As New ArrayList + For Each rc As PersonalDDTableControlRow In Me.GetRecordControls() + If Not rc.IsNewRecord Then + rc.DataSource = rc.GetRecord() + rc.GetUIData() + postdata.Add(rc.DataSource) + UIData.Add(rc.PreservedUIData()) + End If + Next + Me.DataSource = DirectCast(postdata.ToArray(GetType(PersonalDDRecord)), PersonalDDRecord()) + Else ' Get the records from the database + Me.DataSource = PersonalDDTable.GetRecords(joinFilter, wc, orderBy, Me.PageIndex, Me.PageSize) + + End If + + ' if the datasource contains no records contained in database, then load the last page. + If (DbUtils.GetCreatedRecords(Me.DataSource).Length = 0 AndAlso Not Me.DisplayLastPage) Then + Me.DisplayLastPage = True + LoadData() + Else + + ' Add any new rows desired by the user. + Me.AddNewRecords() + + ' Turn off the ToggleAll checkbox + Me.PersonalDDToggleAll.Checked = False + + + ' Initialize the page and grand totals. now + + End If + + Catch ex As Exception + ' Report the error message to the end user + Dim msg As String = ex.Message + If ex.InnerException IsNot Nothing Then + msg = msg & " InnerException: " & ex.InnerException.Message + End If + Throw New Exception(msg, ex.InnerException) + End Try + End Sub + + + + + Public Overrides Sub DataBind() + ' The DataBind method binds the user interface controls to the values + ' from the database record for each row in the table. To do this, it calls the + ' DataBind for each of the rows. + ' DataBind also populates any filters above the table, and sets the pagination + ' control to the correct number of records and the current page number. + + MyBase.DataBind() + + ' Make sure that the DataSource is initialized. + If Me.DataSource Is Nothing Then + Return + End If + + 'LoadData for DataSource for chart and report if they exist + + ' Setup the pagination controls. + BindPaginationControls() + + + + ' Bind the repeater with the list of records to expand the UI. + Dim rep As System.Web.UI.WebControls.Repeater = CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalDDTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return + rep.DataSource = DataSource() + rep.DataBind() + + Dim index As Integer = 0 + For Each repItem As System.Web.UI.WebControls.RepeaterItem In rep.Items + ' Loop through all rows in the table, set its DataSource and call DataBind(). + Dim recControl As PersonalDDTableControlRow = DirectCast(repItem.FindControl("PersonalDDTableControlRow"), PersonalDDTableControlRow) + recControl.DataSource = Me.DataSource(index) + If Me.UIData.Count > index Then + recControl.PreviousUIData = Me.UIData(index) + End If + recControl.DataBind() + recControl.Visible = Not Me.InDeletedRecordIds(recControl) + + index += 1 + Next + + + + + ' Call the Set methods for each controls on the panel + + SetEndDateLabel1() + SetMissionLabel() + + + + + + SetPersonalDDTableControlCollapsibleRegion() + + SetRefDateLabel() + SetRefLabel() + SetStartDateLabel1() + ' setting the state of expand or collapse alternative rows + + + ' Load data for each record and table UI control. + ' Ordering is important because child controls get + ' their parent ids from their parent UI controls. + + + ' this method calls the set method for controls with special formula like running total, sum, rank, etc + SetFormulaControls() + End Sub + + Public Overridable Sub SetFormulaControls() + ' this method calls Set methods for the control that has special formula + + + + End Sub + + + + Public Overridable Sub RegisterPostback() + + + End Sub + + Public EvaluateFormulaDelegate As BaseClasses.Data.DataSource.EvaluateFormulaDelegate = New BaseClasses.Data.DataSource.EvaluateFormulaDelegate(AddressOf Me.EvaluateFormula) + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean, ByVal e as FormulaEvaluator) As String + If e Is Nothing + e = New FormulaEvaluator() + End If + + e.Variables.Clear() + + + ' add variables for formula evaluation + If variables IsNot Nothing Then + Dim enumerator As System.Collections.Generic.IEnumerator(Of System.Collections.Generic.KeyValuePair(Of String, Object)) = variables.GetEnumerator() + While enumerator.MoveNext() + e.Variables.Add(enumerator.Current.Key, enumerator.Current.Value) + End While + End If + + If includeDS + + End If + + ' All variables referred to in the formula are expected to be + ' properties of the DataSource. For example, referring to + ' UnitPrice as a variable will refer to DataSource.UnitPrice + e.DataSource = dataSourceForEvaluate + + ' Define the calling control. This is used to add other + ' related table and record controls as variables. + e.CallingControl = Me + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + + If Not String.IsNullOrEmpty(format) AndAlso (String.IsNullOrEmpty(formula) OrElse formula.IndexOf("Format(") < 0) Then + Return FormulaUtils.Format(resultObj, format) + Else + Return resultObj.ToString() + End If + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format,variables ,includeDS, Nothing) + End Function + + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object)) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format, variables ,True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, format, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal e as FormulaEvaluator) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, variables, True, e) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal includeDS as Boolean) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, includeDS, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, True, Nothing) + End Function + + + + + Public Overridable Sub ResetControl() + + Me.CurrentSortOrder.Reset() + If (Me.InSession(Me, "Order_By")) Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + Me.CurrentSortOrder.Add(PersonalDDTable.StartDate, OrderByItem.OrderDir.Asc) + + End If + + Me.PageIndex = 0 + End Sub + + Protected Overridable Sub BindPaginationControls() + ' Setup the pagination controls. + + ' Bind the pagination labels. + + If DbUtils.GetCreatedRecords(Me.DataSource).Length > 0 Then + + Me.PersonalDDPagination.CurrentPage.Text = (Me.PageIndex + 1).ToString() + Else + Me.PersonalDDPagination.CurrentPage.Text = "0" + End If + Me.PersonalDDPagination.PageSize.Text = Me.PageSize.ToString() + Me.PersonalDDPagination.TotalItems.Text = Me.TotalRecords.ToString() + Me.PersonalDDPagination.TotalPages.Text = Me.TotalPages.ToString() + + ' Bind the buttons for PersonalDDTableControl pagination. + + Me.PersonalDDPagination.FirstPage.Enabled = Not (Me.PageIndex = 0) + If Me._TotalPages < 0 Then ' if the total pages is not determined yet, enable last and next buttons + Me.PersonalDDPagination.LastPage.Enabled = True + ElseIf Me._TotalPages = 0 ' if the total pages is determined and it is 0, enable last and next buttons + Me.PersonalDDPagination.LastPage.Enabled = False + Else ' if the total pages is the last page, disable last and next buttons + Me.PersonalDDPagination.LastPage.Enabled = Not (Me.PageIndex = Me.TotalPages - 1) + End If + + If Me._TotalPages < 0 Then ' if the total pages is not determined yet, enable last and next buttons + Me.PersonalDDPagination.NextPage.Enabled = True + ElseIf Me._TotalPages = 0 ' if the total pages is determined and it is 0, enable last and next buttons + Me.PersonalDDPagination.NextPage.Enabled = False + Else ' if the total pages is the last page, disable last and next buttons + Me.PersonalDDPagination.NextPage.Enabled = Not (Me.PageIndex = Me.TotalPages - 1) + End If + + Me.PersonalDDPagination.PreviousPage.Enabled = Not (Me.PageIndex = 0) + + + End Sub + + Public Overridable Sub SaveData() + ' Save the data from the entire table. Calls each row's Save Data + ' to save their data. This function is called by the Click handler of the + ' Save button. The button handler should Start/Commit/End a transaction. + + Dim recCtl As PersonalDDTableControlRow + For Each recCtl In Me.GetRecordControls() + + If Me.InDeletedRecordIds(recCtl) Then + ' Delete any pending deletes. + recCtl.Delete() + Else + If recCtl.Visible Then + recCtl.SaveData() + End If + End If + + Next + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + ' Set IsNewRecord to False for all records - since everything has been saved and is no longer "new" + For Each recCtl In Me.GetRecordControls() + recCtl.IsNewRecord = False + Next + + + ' Set DeletedRecordsIds to Nothing since we have deleted all pending deletes. + Me.DeletedRecordIds = Nothing + + End Sub + + Public Overridable Function CreateCompoundJoinFilter() As CompoundFilter + Dim jFilter As CompoundFilter = New CompoundFilter() + + Return jFilter + + End Function + + + Public Overridable Function CreateOrderBy() As OrderBy + ' The CurrentSortOrder is initialized to the sort order on the + ' Query Wizard. It may be modified by the Click handler for any of + ' the column heading to sort or reverse sort by that column. + ' You can add your own sort order, or modify it on the Query Wizard. + Return Me.CurrentSortOrder + End Function + + Public Overridable Function CreateWhereClause() As WhereClause + 'This CreateWhereClause is used for loading the data. + PersonalDDTable.Instance.InnerFilter = Nothing + Dim wc As WhereClause = New WhereClause() + + ' Compose the WHERE clause consiting of: + ' 1. Static clause defined at design time. + ' 2. User selected search criteria. + ' 3. User selected filter criteria. + + + Dim selectedRecordKeyValue as KeyValue = New KeyValue() + + Dim personalIdRecordControlObj As Persons.UI.Controls.EditPersonalId.PersonalIdRecordControl = DirectCast(MiscUtils.FindControlRecursively(Me.Page, "PersonalIdRecordControl"), Persons.UI.Controls.EditPersonalId.PersonalIdRecordControl) + + If (Not IsNothing(personalIdRecordControlObj) AndAlso Not IsNothing(personalIdRecordControlObj.GetRecord()) AndAlso personalIdRecordControlObj.GetRecord().IsCreated AndAlso Not IsNothing(personalIdRecordControlObj.GetRecord().PersonalId)) + wc.iAND(PersonalDDTable.PersonalId, BaseFilter.ComparisonOperator.EqualsTo, personalIdRecordControlObj.GetRecord().PersonalId.ToString()) + selectedRecordKeyValue.AddElement(PersonalDDTable.PersonalId.InternalName, personalIdRecordControlObj.GetRecord().PersonalId.ToString()) + Else + wc.RunQuery = False + Return wc + End If + + HttpContext.Current.Session("PersonalDDTableControlWhereClause") = selectedRecordKeyValue.ToXmlString() + + Return wc + End Function + + + Public Overridable Function CreateWhereClause(ByVal searchText as String, ByVal fromSearchControl as String, ByVal AutoTypeAheadSearch as String, ByVal AutoTypeAheadWordSeparators as String) As WhereClause + ' This CreateWhereClause is used for loading list of suggestions for Auto Type-Ahead feature. + PersonalDDTable.Instance.InnerFilter = Nothing + Dim wc As WhereClause = New WhereClause() + + ' Compose the WHERE clause consiting of: + ' 1. Static clause defined at design time. + ' 2. User selected search criteria. + ' 3. User selected filter criteria. + + Dim appRelativeVirtualPath As String = CType(HttpContext.Current.Session("AppRelativeVirtualPath"), String) + + Dim selectedRecordInPersonalIdRecordControl as String = DirectCast(HttpContext.Current.Session("PersonalDDTableControlWhereClause"), String) + + If Not selectedRecordInPersonalIdRecordControl Is Nothing AndAlso KeyValue.IsXmlKey(selectedRecordInPersonalIdRecordControl) Then + Dim selectedRecordKeyValue as KeyValue = KeyValue.XmlToKey(selectedRecordInPersonalIdRecordControl) + + If Not IsNothing(selectedRecordKeyValue) AndAlso selectedRecordKeyValue.ContainsColumn(PersonalDDTable.PersonalId) Then + wc.iAND(PersonalDDTable.PersonalId, BaseFilter.ComparisonOperator.EqualsTo, selectedRecordKeyValue.GetColumnValue(PersonalDDTable.PersonalId).ToString()) + End If + + End If + + ' Adds clauses if values are selected in Filter controls which are configured in the page. + + + Return wc + End Function + + + Public Overridable Function FormatSuggestions(ByVal prefixText As String, ByVal resultItem As String, _ + ByVal columnLength As Integer, ByVal AutoTypeAheadDisplayFoundText As String, _ + ByVal autoTypeAheadSearch As String, ByVal AutoTypeAheadWordSeparators As String, _ + ByVal resultList As ArrayList) As Boolean + + 'Formats the resultItem and adds it to the list of suggestions. + Dim index As Integer = resultItem.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture).IndexOf(prefixText.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture)) + Dim itemToAdd As String = "" + Dim isFound As Boolean = False + Dim isAdded As Boolean = False + ' Get the index where prfixt is at the beginning of resultItem. If not found then, index of word which begins with prefixText. + If InvariantLCase(autoTypeAheadSearch).equals("wordsstartingwithsearchstring") And Not index = 0 Then + ' Expression to find word which contains AutoTypeAheadWordSeparators followed by prefixText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex( AutoTypeAheadWordSeparators + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + If regex1.IsMatch(resultItem) Then + index = regex1.Match(resultItem).Index + isFound = True + End If + ' If the prefixText is found immediatly after white space then starting of the word is found so don not search any further + If not resultItem(index).ToString() = " " Then + ' Expression to find beginning of the word which contains AutoTypeAheadWordSeparators followed by prefixText + Dim regex As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\\S*" + AutoTypeAheadWordSeparators + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + If regex.IsMatch(resultItem) Then + index = regex.Match(resultItem).Index + isFound = True + End If + End If + End If + + ' If autoTypeAheadSearch value is wordsstartingwithsearchstring then, extract the substring only if the prefixText is found at the + ' beginning of the resultItem (index = 0) or a word in resultItem is found starts with prefixText. + If index = 0 Or isFound Or InvariantLCase(autoTypeAheadSearch).Equals("anywhereinstring") then + If InvariantLCase(AutoTypeAheadDisplayFoundText).equals("atbeginningofmatchedstring") Then + ' Expression to find beginning of the word which contains prefixText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\\S*" + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + ' Find the beginning of the word which contains prefexText + If (StringUtils.InvariantLCase(autoTypeAheadSearch).Equals("anywhereinstring") AndAlso regex1.IsMatch(resultItem)) Then + index = regex1.Match(resultItem).Index + isFound = True + End If + ' Display string from the index till end of the string if sub string from index till end is less than columnLength value. + If Len(resultItem) - index <= columnLength Then + If index = 0 Then + itemToAdd = resultItem + Else + itemToAdd = "..." & resultItem.Substring(index, Len(resultItem) - index) + End If + Else + If index = 0 Then + itemToAdd = resultItem.Substring(index, (columnLength - 3)) & "..." + Else + 'Truncate the string to show only columnLength - 6 characters as begining and trailing "..." has to be appended. + itemToAdd = "..." & resultItem.Substring(index , columnLength - 6) & "..." + End If + End If + ElseIf InvariantLCase(AutoTypeAheadDisplayFoundText).equals("inmiddleofmatchedstring") Then + Dim subStringBeginIndex As Integer = CType(columnLength/2, Integer) + If Len(resultItem) <= columnLength Then + itemToAdd = resultItem + Else + ' Sanity check at end of the string + If index + Len(prefixText) = columnLength Then + itemToAdd = "..." & resultItem.Substring(index-columnLength,index) + ElseIf Len(resultItem) - index < subStringBeginIndex Then + ' Display string from the end till columnLength value if, index is closer to the end of the string. + itemToAdd = "..." & resultItem.Substring(Len(resultItem)-columnLength,Len(resultItem)) + ElseIf index <= subStringBeginIndex Then + ' Sanity chet at beginning of the string + itemToAdd = resultItem.Substring(0, columnLength) & "..." + Else + ' Display string containing text before the prefixText occures and text after the prefixText + itemToAdd = "..." & resultItem.Substring(index - subStringBeginIndex, columnLength) & "..." + End If + End If + ElseIf InvariantLCase(AutoTypeAheadDisplayFoundText).equals("atendofmatchedstring") Then + ' Expression to find ending of the word which contains prefexText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\s", System.Text.RegularExpressions.RegexOptions.IgnoreCase) + ' Find the ending of the word which contains prefexText + If regex1.IsMatch(resultItem, index + 1) Then + index = regex1.Match(resultItem, index + 1).Index + Else + ' If the word which contains prefexText is the last word in string, regex1.IsMatch returns false. + index = resultItem.Length + End If + If index > Len(resultItem) Then + index = Len(resultItem) + End If + ' If text from beginning of the string till index is less than columnLength value then, display string from the beginning till index. + If index <= columnLength Then + if index = Len(resultItem) Then 'Make decision to append "..." + itemToAdd = resultItem.Substring(0,index) + Else + itemToAdd = resultItem.Substring(0,index) & "..." + End If + Else + If index = Len(resultItem) Then + itemToAdd = "..." & resultItem.Substring(index - (columnLength - 3), (columnLength - 3)) + Else + 'Truncate the string to show only columnLength - 6 characters as begining and trailing "..." has to be appended. + itemToAdd = "..." & resultItem.Substring(index - (columnLength - 6), columnLength - 6) & "..." + End If + End If + End If + + ' Remove newline character from itemToAdd + Dim prefixTextIndex As Integer = itemToAdd.IndexOf(prefixText, StringComparison.CurrentCultureIgnoreCase) + ' If itemToAdd contains any newline after the search text then show text only till newline + Dim regex2 As System.Text.RegularExpressions.Regex = New System.Text.RegularExpressions.Regex("(" & vbCrLf & "|" & vbLf & ")", System.Text.RegularExpressions.RegexOptions.IgnoreCase) + Dim newLineIndexAfterPrefix As Integer = -1 + If regex2.IsMatch(itemToAdd, prefixTextIndex) Then + newLineIndexAfterPrefix = regex2.Match(itemToAdd, prefixTextIndex).Index + End If + If (newLineIndexAfterPrefix > -1) Then + If itemToAdd.EndsWith("...") Then + itemToAdd = (itemToAdd.Substring(0, newLineIndexAfterPrefix) + "...") + Else + itemToAdd = itemToAdd.Substring(0, newLineIndexAfterPrefix) + End If + End If + ' If itemToAdd contains any newline before search text then show text which comes after newline + Dim regex3 As System.Text.RegularExpressions.Regex = New System.Text.RegularExpressions.Regex("(" & vbCrLf & "|" & vbLf & ")", (System.Text.RegularExpressions.RegexOptions.IgnoreCase Or System.Text.RegularExpressions.RegexOptions.RightToLeft)) + Dim newLineIndexBeforePrefix As Integer = -1 + If regex3.IsMatch(itemToAdd, prefixTextIndex) Then + newLineIndexBeforePrefix = regex3.Match(itemToAdd, prefixTextIndex).Index + End If + If (newLineIndexBeforePrefix > -1) Then + If itemToAdd.StartsWith("...") Then + itemToAdd = ("..." + itemToAdd.Substring((newLineIndexBeforePrefix + regex3.Match(itemToAdd, prefixTextIndex).Length))) + Else + itemToAdd = itemToAdd.Substring((newLineIndexBeforePrefix + regex3.Match(itemToAdd, prefixTextIndex).Length)) + End If + End If + + If Not itemToAdd is nothing AndAlso Not resultList.Contains(itemToAdd) Then + + resultList.Add(itemToAdd) + + isAdded = true + End If + End If + Return isAdded + End Function + + + Protected Overridable Sub GetPageSize() + + If Me.PersonalDDPagination.PageSize.Text.Trim <> "" Then + Try + 'Me.PageSize = Integer.Parse(Me.PersonalDDPagination.PageSize.Text) + Catch ex As Exception + End Try + End If + End Sub + + Protected Overridable Sub AddNewRecords() + + Dim newRecordList As ArrayList = New ArrayList() + + Dim newUIDataList As System.Collections.Generic.List(Of Hashtable) = New System.Collections.Generic.List(Of Hashtable)() + + ' Loop though all the record controls and if the record control + ' does not have a unique record id set, then create a record + ' and add to the list. + If Not Me.ResetData Then + Dim rep As System.Web.UI.WebControls.Repeater = CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalDDTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return + + Dim repItem As System.Web.UI.WebControls.RepeaterItem + For Each repItem In rep.Items + ' Loop through all rows in the table, set its DataSource and call DataBind(). + + Dim recControl As PersonalDDTableControlRow = DirectCast(repItem.FindControl("PersonalDDTableControlRow"), PersonalDDTableControlRow) + + If recControl.Visible AndAlso recControl.IsNewRecord() Then + + Dim rec As PersonalDDRecord = New PersonalDDRecord() + + If recControl.EndDate.Text <> "" Then + rec.Parse(recControl.EndDate.Text, PersonalDDTable.EndDate) + End If + If recControl.Mission.Text <> "" Then + rec.Parse(recControl.Mission.Text, PersonalDDTable.Mission) + End If + If recControl.Ref1.Text <> "" Then + rec.Parse(recControl.Ref1.Text, PersonalDDTable.Ref0) + End If + If recControl.RefDate.Text <> "" Then + rec.Parse(recControl.RefDate.Text, PersonalDDTable.RefDate) + End If + If recControl.StartDate.Text <> "" Then + rec.Parse(recControl.StartDate.Text, PersonalDDTable.StartDate) + End If + newUIDataList.Add(recControl.PreservedUIData()) + newRecordList.Add(rec) + End If + Next + End If + + + ' Add any new record to the list. + Dim index As Integer = 0 + For index = 1 To Me.AddNewRecord + + newRecordList.Insert(0, New PersonalDDRecord()) + newUIDataList.Insert(0, New Hashtable()) + + Next + Me.AddNewRecord = 0 + + ' Finally, add any new records to the DataSource. + If newRecordList.Count > 0 Then + + Dim finalList As ArrayList = New ArrayList(Me.DataSource) + finalList.InsertRange(0, newRecordList) + + Me.DataSource = DirectCast(finalList.ToArray(GetType(PersonalDDRecord)), PersonalDDRecord()) + + End If + + ' Add the existing UI data to this hash table + If newUIDataList.Count > 0 Then + Me.UIData.InsertRange(0, newUIDataList) + End If + + End Sub + + + Public Sub AddToDeletedRecordIds(ByVal rec As PersonalDDTableControlRow) + If rec.IsNewRecord() Then + Return + End If + + If Not Me.DeletedRecordIds Is Nothing AndAlso Me.DeletedRecordIds.Trim <> "" Then + Me.DeletedRecordIds &= "," + End If + + Me.DeletedRecordIds &= "[" & rec.RecordUniqueId & "]" + End Sub + + Protected Overridable Function InDeletedRecordIds(ByVal rec As PersonalDDTableControlRow) As Boolean + If Me.DeletedRecordIds Is Nothing OrElse Me.DeletedRecordIds.Trim = "" Then + Return False + End If + + Return Me.DeletedRecordIds.IndexOf("[" & rec.RecordUniqueId & "]") >= 0 + End Function + + Private _DeletedRecordIds As String + Public Property DeletedRecordIds() As String + Get + Return Me._DeletedRecordIds + End Get + Set(ByVal value As String) + Me._DeletedRecordIds = value + End Set + End Property + + + ' Create Set, WhereClause, and Populate Methods + + Public Overridable Sub SetEndDateLabel1() + + End Sub + + Public Overridable Sub SetMissionLabel() + + End Sub + + Public Overridable Sub SetPersonalDDTableControlCollapsibleRegion() + + End Sub + + Public Overridable Sub SetRefDateLabel() + + End Sub + + Public Overridable Sub SetRefLabel() + + End Sub + + Public Overridable Sub SetStartDateLabel1() + + 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. + Dim added As Boolean = Me.AddNewRecord > 0 + Me.LoadData() + Me.DataBind() + + If added Then + Me.SetFocusToAddedRow() + End If + + End If + + + + Catch ex As Exception + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + Finally + DbUtils.EndTransaction + End Try + End Sub + + 'this function sets focus to the first editable element in the new added row in the editable table + Protected Overridable Sub SetFocusToAddedRow() + Dim rep As System.Web.UI.WebControls.Repeater = CType(Me.FindControl("PersonalDDTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing OrElse rep.Items.Count = 0 Then Return + Dim repItem As System.Web.UI.WebControls.RepeaterItem + For Each repItem In rep.Items + 'Load scripts to table rows + Me.Page.LoadFocusScripts(repItem) + Dim recControl As PersonalDDTableControlRow = DirectCast(repItem.FindControl("PersonalDDTableControlRow"), PersonalDDTableControlRow) + If recControl.IsNewRecord Then + For Each field As Control In recControl.Controls + If field.Visible AndAlso Me.Page.IsControlEditable(field, False) Then + 'set focus on the first editable field in the new row + field.Focus() + Dim updPan As UpdatePanel = DirectCast(Me.Page.FindControlRecursively("UpdatePanel1"), UpdatePanel) + If Not updPan Is Nothing Then updPan.Update() + Return + End If + Next + Return + End If + Next + End Sub + + + Protected Overrides Sub SaveControlsToSession() + MyBase.SaveControlsToSession() + + ' Save filter controls to values to session. + + + 'Save pagination state to session. + + + + ' Save table control properties to the session. + If Not Me.CurrentSortOrder Is Nothing Then + Me.SaveToSession(Me, "Order_By", Me.CurrentSortOrder.ToXmlString()) + End If + + Me.SaveToSession(Me, "Page_Index", Me.PageIndex.ToString()) + Me.SaveToSession(Me, "Page_Size", Me.PageSize.ToString()) + + Me.SaveToSession(Me, "DeletedRecordIds", Me.DeletedRecordIds) + + End Sub + + Protected Sub SaveControlsToSession_Ajax() + ' Save filter controls to values to session. + + HttpContext.Current.Session("AppRelativeVirtualPath") = Me.Page.AppRelativeVirtualPath + + End Sub + + Protected Overrides Sub ClearControlsFromSession() + MyBase.ClearControlsFromSession() + + ' Clear filter controls values from the session. + + + ' Clear pagination state from session. + + + + ' Clear table properties from the session. + Me.RemoveFromSession(Me, "Order_By") + Me.RemoveFromSession(Me, "Page_Index") + Me.RemoveFromSession(Me, "Page_Size") + + Me.RemoveFromSession(Me, "DeletedRecordIds") + + End Sub + + Protected Overrides Sub LoadViewState(ByVal savedState As Object) + MyBase.LoadViewState(savedState) + + Dim orderByStr As String = CType(ViewState("PersonalDDTableControl_OrderBy"), String) + + If orderByStr IsNot Nothing AndAlso orderByStr.Trim <> "" Then + Me.CurrentSortOrder = BaseClasses.Data.OrderBy.FromXmlString(orderByStr) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + End If + + Dim pageIndex As String = CType(ViewState("Page_Index"), String) + If pageIndex IsNot Nothing Then + Me.PageIndex = CInt(pageIndex) + End If + + Dim pageSize As String = CType(ViewState("Page_Size"), String) + If Not pageSize Is Nothing Then + Me.PageSize = CInt(pageSize) + End If + + + + ' Load view state for pagination control. + + Me.DeletedRecordIds = CType(Me.ViewState("DeletedRecordIds"), String) + + End Sub + + Protected Overrides Function SaveViewState() As Object + + If Me.CurrentSortOrder IsNot Nothing Then + Me.ViewState("PersonalDDTableControl_OrderBy") = Me.CurrentSortOrder.ToXmlString() + End If + + Me.ViewState("Page_Index") = Me.PageIndex + Me.ViewState("Page_Size") = Me.PageSize + + Me.ViewState("DeletedRecordIds") = Me.DeletedRecordIds + + + ' Load view state for pagination control. + + + Return MyBase.SaveViewState() + End Function + + ' Generate the event handling functions for pagination events. + + ' event handler for ImageButton + Public Overridable Sub PersonalDDPagination_FirstPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.PageIndex = 0 + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalDDPagination_LastPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.DisplayLastPage = True + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalDDPagination_NextPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.PageIndex += 1 + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for LinkButton + Public Overridable Sub PersonalDDPagination_PageSizeButton_Click(ByVal sender As Object, ByVal args As EventArgs) + + Try + + Me.DataChanged = True + + Me.PageSize = Integer.Parse(Me.PersonalDDPagination.PageSize.Text) + + Me.PageIndex = Integer.Parse(Me.PersonalDDPagination.CurrentPage.Text) - 1 + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalDDPagination_PreviousPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + If Me.PageIndex > 0 Then + Me.PageIndex -= 1 + Me.DataChanged = True + End If + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + + ' Generate the event handling functions for sorting events. + + Public Overridable Sub EndDateLabel1_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by EndDate when clicked. + + ' Get previous sorting state for EndDate. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalDDTable.EndDate) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for EndDate. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalDDTable.EndDate, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by EndDate, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub MissionLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by Mission when clicked. + + ' Get previous sorting state for Mission. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalDDTable.Mission) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for Mission. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalDDTable.Mission, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by Mission, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub RefDateLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by RefDate when clicked. + + ' Get previous sorting state for RefDate. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalDDTable.RefDate) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for RefDate. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalDDTable.RefDate, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by RefDate, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub RefLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by Ref when clicked. + + ' Get previous sorting state for Ref. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalDDTable.Ref0) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for Ref. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalDDTable.Ref0, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by Ref, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub StartDateLabel1_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by StartDate when clicked. + + ' Get previous sorting state for StartDate. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalDDTable.StartDate) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for StartDate. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalDDTable.StartDate, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by StartDate, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + + ' Generate the event handling functions for button events. + + ' event handler for ImageButton + Public Overridable Sub PersonalDDAddButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + Me.AddNewRecord = 1 + Me.DataChanged = True + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalDDDeleteButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + If(Not Me.Page.IsPageRefresh) Then + + Me.DeleteSelectedRecords(True) + Me.SetFormulaControls() + + + End If + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalDDEditButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + ' The redirect URL is set on the Properties, Custom Properties or Actions. + ' The ModifyRedirectURL call resolves the parameters before the + ' Response.Redirect redirects the page to the URL. + ' Any code after the Response.Redirect call will not be executed, since the page is + ' redirected to the URL. + + + Dim url As String = "../Shared/ConfigureEditRecord.aspx" + + Dim shouldRedirect As Boolean = True + Dim TargetKey As String = Nothing + Dim DFKA As String = TargetKey + Dim id As String = DFKA + Dim value As String = id + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + url = Me.ModifyRedirectUrl(url, "",False) + url = Me.Page.ModifyRedirectUrl(url, "",False) + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + shouldRedirect = False + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + If shouldRedirect Then + Me.Page.ShouldSaveControlsToSession = True + Me.Page.Response.Redirect(url) + ElseIf Not TargetKey Is Nothing AndAlso _ + Not shouldRedirect Then + Me.Page.ShouldSaveControlsToSession = True + Me.Page.CloseWindow(True) + + End If + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalDDResetButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.CurrentSortOrder.Reset() + If Me.InSession(Me, "Order_By") Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + Me.CurrentSortOrder.Add(PersonalDDTable.StartDate, OrderByItem.OrderDir.Asc) + + + End If + + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + + + ' Generate the event handling functions for filter and search events. + + + ' Generate the event handling functions for others + + + Private _UIData As New System.Collections.Generic.List(Of Hashtable) + Public Property UIData() As System.Collections.Generic.List(Of Hashtable) + Get + Return Me._UIData + End Get + Set(ByVal value As System.Collections.Generic.List(Of Hashtable)) + Me._UIData = value + End Set + End Property + + ' pagination properties + Protected _PageSize As Integer + Public Property PageSize() As Integer + Get + Return Me._PageSize + End Get + Set(ByVal value As Integer) + Me._PageSize = value + End Set + End Property + + Protected _PageIndex As Integer + Public Property PageIndex() As Integer + Get + ' Return the PageIndex + Return Me._PageIndex + End Get + Set(ByVal value As Integer) + Me._PageIndex = value + End Set + End Property + + Protected _TotalRecords As Integer = -1 + Public Property TotalRecords() As Integer + Get + If _TotalRecords < 0 + _TotalRecords = PersonalDDTable.GetRecordCount(CreateCompoundJoinFilter(), CreateWhereClause()) + End If + Return Me._TotalRecords + End Get + Set(ByVal value As Integer) + If Me.PageSize > 0 Then + + Me.TotalPages = CInt(Math.Ceiling(value / Me.PageSize)) + + End If + Me._TotalRecords = value + End Set + End Property + + + + Protected _TotalPages As Integer = -1 + Public Property TotalPages() As Integer + Get + If _TotalPages < 0 Then + + Me.TotalPages = CInt(Math.Ceiling(TotalRecords / Me.PageSize)) + + End If + Return Me._TotalPages + End Get + Set(ByVal value As Integer) + Me._TotalPages = value + End Set + End Property + + Protected _DisplayLastPage As Boolean + Public Property DisplayLastPage() As Boolean + Get + Return Me._DisplayLastPage + End Get + Set(ByVal value As Boolean) + Me._DisplayLastPage = value + End Set + End Property + + Private _DataChanged As Boolean = False + Public Property DataChanged() As Boolean + Get + Return Me._DataChanged + End Get + Set(ByVal value As Boolean) + Me._DataChanged = value + End Set + End Property + + Private _ResetData As Boolean = False + Public Property ResetData() As Boolean + Get + Return Me._ResetData + End Get + Set(ByVal value As Boolean) + Me._ResetData = value + End Set + End Property + + Private _AddNewRecord As Integer = 0 + Public Property AddNewRecord() As Integer + Get + Return Me._AddNewRecord + End Get + Set(ByVal value As Integer) + Me._AddNewRecord = value + End Set + End Property + + + Private _CurrentSortOrder As OrderBy = Nothing + Public Property CurrentSortOrder() As OrderBy + Get + Return Me._CurrentSortOrder + End Get + Set(ByVal value As BaseClasses.Data.OrderBy) + Me._CurrentSortOrder = value + End Set + End Property + + Private _DataSource() As PersonalDDRecord = Nothing + Public Property DataSource() As PersonalDDRecord () + Get + Return Me._DataSource + End Get + Set(ByVal value() As PersonalDDRecord) + Me._DataSource = value + End Set + End Property + +#Region "Helper Properties" + + Public ReadOnly Property EndDateLabel1() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "EndDateLabel1"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property MissionLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "MissionLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property PersonalDDAddButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalDDAddButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalDDDeleteButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalDDDeleteButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalDDEditButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalDDEditButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalDDPagination() As Persons.UI.IPagination + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalDDPagination"), Persons.UI.IPagination) + End Get + End Property + + Public ReadOnly Property PersonalDDResetButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalDDResetButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalDDTableControlCollapsibleRegion() As System.Web.UI.WebControls.Panel + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalDDTableControlCollapsibleRegion"), System.Web.UI.WebControls.Panel) + End Get + End Property + + Public ReadOnly Property PersonalDDToggleAll() As System.Web.UI.WebControls.CheckBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalDDToggleAll"), System.Web.UI.WebControls.CheckBox) + End Get + End Property + + Public ReadOnly Property RefDateLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RefDateLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property RefLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RefLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property StartDateLabel1() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "StartDateLabel1"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + +#End Region + +#Region "Helper Functions" + + Public Overrides Overloads Function ModifyRedirectUrl(url As String, arg As String, ByVal bEncrypt As Boolean) As String + Return Me.Page.EvaluateExpressions(url, arg, bEncrypt, Me) + End Function + + Public Overrides Overloads Function EvaluateExpressions(url As String, arg As String, ByVal bEncrypt As Boolean) As String + Dim needToProcess As Boolean = AreAnyUrlParametersForMe(url, arg) + If (needToProcess) Then + Dim recCtl As PersonalDDTableControlRow = Me.GetSelectedRecordControl() + If recCtl Is Nothing AndAlso url.IndexOf("{") >= 0 Then + ' Localization. + Throw New Exception(Page.GetResourceValue("Err:NoRecSelected", "Persons")) + End If + Dim rec As PersonalDDRecord = Nothing + If recCtl IsNot Nothing Then + rec = recCtl.GetRecord() + End If + Return EvaluateExpressions(url, arg, rec, bEncrypt) + End If + Return url + End Function + + Public Overridable Function GetSelectedRecordIndex() As Integer + Dim counter As Integer = 0 + Dim recControl As PersonalDDTableControlRow + For Each recControl In Me.GetRecordControls() + If recControl.PersonalDDRecordRowSelection.Checked Then + Return counter + End If + counter += 1 + Next + Return -1 + End Function + + Public Overridable Function GetSelectedRecordControl() As PersonalDDTableControlRow + Dim selectedList() As PersonalDDTableControlRow = Me.GetSelectedRecordControls() + If selectedList.Length = 0 Then + Return Nothing + End If + Return selectedList(0) + + End Function + + Public Overridable Function GetSelectedRecordControls() As PersonalDDTableControlRow() + + Dim selectedList As ArrayList = New ArrayList(25) + Dim recControl As PersonalDDTableControlRow + For Each recControl In Me.GetRecordControls() + If recControl.PersonalDDRecordRowSelection IsNot Nothing AndAlso recControl.PersonalDDRecordRowSelection.Checked Then + selectedList.Add(recControl) + End If + Next + Return DirectCast(selectedList.ToArray(GetType(PersonalDDTableControlRow)), PersonalDDTableControlRow()) + + End Function + + Public Overridable Sub DeleteSelectedRecords(ByVal deferDeletion As Boolean) + Dim recList() As PersonalDDTableControlRow = Me.GetSelectedRecordControls() + If recList.Length = 0 Then + ' Localization. + Throw New Exception(Page.GetResourceValue("Err:NoRecSelected", "Persons")) + End If + + Dim recCtl As PersonalDDTableControlRow + For Each recCtl In recList + If deferDeletion Then + If Not recCtl.IsNewRecord Then + + Me.AddToDeletedRecordIds(recCtl) + + End If + recCtl.Visible = False + + recCtl.PersonalDDRecordRowSelection.Checked = False + + Else + + recCtl.Delete() + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + End If + Next + End Sub + + Public Function GetRecordControls() As PersonalDDTableControlRow() + Dim recList As ArrayList = New ArrayList() + Dim rep As System.Web.UI.WebControls.Repeater = CType(Me.FindControl("PersonalDDTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return Nothing + Dim repItem As System.Web.UI.WebControls.RepeaterItem + + For Each repItem In rep.Items + + Dim recControl As PersonalDDTableControlRow = DirectCast(repItem.FindControl("PersonalDDTableControlRow"), PersonalDDTableControlRow) + recList.Add(recControl) + + Next + + Return DirectCast(recList.ToArray(GetType(PersonalDDTableControlRow)), PersonalDDTableControlRow()) + End Function + + Public Shadows ReadOnly Property Page() As BaseApplicationPage + Get + Return DirectCast(MyBase.Page, BaseApplicationPage) + End Get + End Property + +#End Region + + + +End Class + + +' Base class for the PersonalEducationTableControlRow control on the EditPersonalId page. +' Do not modify this class. Instead override any method in PersonalEducationTableControlRow. +Public Class BasePersonalEducationTableControlRow + Inherits Persons.UI.BaseApplicationRecordControl + + ' To customize, override this method in PersonalEducationTableControlRow. + Protected Overridable Sub Control_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Init + + Me.ClearControlsFromSession() + End Sub + + ' To customize, override this method in PersonalEducationTableControlRow. + Protected Overridable Sub Control_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load + + 'Call LoadFocusScripts from repeater so that onfocus attribute could be added to elements + Me.Page.LoadFocusScripts(Me) + + ' Show confirmation message on Click + Me.PersonalEducationRowDeleteButton.Attributes.Add("onClick", "return (confirm('" & (CType(Me.Page,BaseApplicationPage)).GetResourceValue("DeleteRecordConfirm", "Persons") & "'));") + + + ' Register the event handlers. + + AddHandler Me.PersonalEducationRowDeleteButton.Click, AddressOf PersonalEducationRowDeleteButton_Click + + AddHandler Me.PersonalEducationRowEditButton.Click, AddressOf PersonalEducationRowEditButton_Click + + AddHandler Me.PersonalEducationRowViewButton.Click, AddressOf PersonalEducationRowViewButton_Click + + AddHandler Me.COUNTRY.SelectedIndexChanged, AddressOf COUNTRY_SelectedIndexChanged + + AddHandler Me.EducationPeriod.SelectedIndexChanged, AddressOf EducationPeriod_SelectedIndexChanged + + AddHandler Me.LevelId.SelectedIndexChanged, AddressOf LevelId_SelectedIndexChanged + + AddHandler Me.Command.TextChanged, AddressOf Command_TextChanged + + AddHandler Me.CommandDate.TextChanged, AddressOf CommandDate_TextChanged + + AddHandler Me.Course.TextChanged, AddressOf Course_TextChanged + + AddHandler Me.CourseAbbr.TextChanged, AddressOf CourseAbbr_TextChanged + + AddHandler Me.CourseNo.TextChanged, AddressOf CourseNo_TextChanged + + AddHandler Me.EdYear.TextChanged, AddressOf EdYear_TextChanged + + AddHandler Me.EndDate1.TextChanged, AddressOf EndDate1_TextChanged + + AddHandler Me.Facultry.TextChanged, AddressOf Facultry_TextChanged + + AddHandler Me.Institue.TextChanged, AddressOf Institue_TextChanged + + AddHandler Me.NoAll.TextChanged, AddressOf NoAll_TextChanged + + AddHandler Me.Score.TextChanged, AddressOf Score_TextChanged + + AddHandler Me.ScoreNo.TextChanged, AddressOf ScoreNo_TextChanged + + AddHandler Me.StartDate1.TextChanged, AddressOf StartDate1_TextChanged + + + End Sub + + + Public Overridable Sub LoadData() + + ' Load the data from the database into the DataSource PersonalEducation record. + ' It is better to make changes to functions called by LoadData such as + ' CreateWhereClause, rather than making changes here. + + ' The RecordUniqueId is set the first time a record is loaded, and is + ' used during a PostBack to load the record. + + If Me.RecordUniqueId IsNot Nothing AndAlso Me.RecordUniqueId.Trim <> "" Then + Me.DataSource = PersonalEducationTable.GetRecord(Me.RecordUniqueId, True) + + Return + End If + + ' Since this is a row in the table, the data for this row is loaded by the + ' LoadData method of the BasePersonalEducationTableControl when the data for the entire + ' table is loaded. + + Me.DataSource = New PersonalEducationRecord() + + + + End Sub + + ' Populate the UI controls using the DataSource. To customize, override this method in PersonalEducationTableControlRow. + Public Overrides Sub DataBind() + ' The DataBind method binds the user interface controls to the values + ' from the database record. To do this, it calls the Set methods for + ' each of the field displayed on the webpage. It is better to make + ' changes in the Set methods, rather than making changes here. + + MyBase.DataBind() + + ' Make sure that the DataSource is initialized. + If Me.DataSource Is Nothing Then + + Return + End If + + + 'LoadData for DataSource for chart and report if they exist + + + + ' Call the Set methods for each controls on the panel + + SetCommand() + SetCommandDate() + SetCOUNTRY() + SetCourse() + SetCourseAbbr() + SetCourseNo() + SetEducationPeriod() + SetEdYear() + SetEndDate1() + SetFacultry() + SetInstitue() + SetLevelId() + SetNoAll() + + + + + SetScore() + SetScoreNo() + SetStartDate1() + + + Me.IsNewRecord = True + + If Me.DataSource.IsCreated Then + Me.IsNewRecord = False + + Me.RecordUniqueId = Me.DataSource.GetID.ToXmlString() + End If + + ' Now load data for each record and table child UI controls. + ' Ordering is important because child controls get + ' their parent ids from their parent UI controls. + Dim shouldResetControl As Boolean = False + + End Sub + + + Public Overridable Sub SetCommand() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.Command.ID) Then + + Me.Command.Text = Me.PreviousUIData(Me.Command.ID).ToString() + + Return + End If + + + ' Set the Command TextBox on the webpage with value from the + ' PersonalEducation database record. + + ' Me.DataSource is the PersonalEducation record retrieved from the database. + ' Me.Command is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetCommand() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.CommandSpecified Then + + ' If the Command is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalEducationTable.Command) + + Me.Command.Text = formattedValue + + Else + + ' Command is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.Command.Text = PersonalEducationTable.Command.Format(PersonalEducationTable.Command.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetCommandDate() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.CommandDate.ID) Then + + Me.CommandDate.Text = Me.PreviousUIData(Me.CommandDate.ID).ToString() + + Return + End If + + + ' Set the CommandDate TextBox on the webpage with value from the + ' PersonalEducation database record. + + ' Me.DataSource is the PersonalEducation record retrieved from the database. + ' Me.CommandDate is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetCommandDate() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.CommandDateSpecified Then + + ' If the CommandDate is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalEducationTable.CommandDate, "d MMM yy") + + Me.CommandDate.Text = formattedValue + + Else + + ' CommandDate is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.CommandDate.Text = PersonalEducationTable.CommandDate.Format(PersonalEducationTable.CommandDate.DefaultValue, "d MMM yy") + + End If + + End Sub + + Public Overridable Sub SetCOUNTRY() + + ' If selection was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.COUNTRY.ID) Then + If Me.PreviousUIData(Me.COUNTRY.ID) Is Nothing + Me.PopulateCOUNTRYDropDownList(Nothing, 100) + Else + Me.PopulateCOUNTRYDropDownList(Me.PreviousUIData(Me.COUNTRY.ID).ToString(), 100) + End If + Return + End If + + + ' Set the COUNTRY DropDownList on the webpage with value from the + ' PersonalEducation database record. + + ' Me.DataSource is the PersonalEducation record retrieved from the database. + ' Me.COUNTRY is the ASP:DropDownList on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetCOUNTRY() + ' and add your own code before or after the call to the MyBase function. + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.COUNTRYSpecified Then + + ' If the COUNTRY is non-NULL, then format the value. + ' The Format method will return the Display Foreign Key As (DFKA) value + Me.PopulateCOUNTRYDropDownList(Me.DataSource.COUNTRY.ToString(), 100) + + Else + + ' COUNTRY 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.PopulateCOUNTRYDropDownList(Nothing, 100) + Else + Me.PopulateCOUNTRYDropDownList(PersonalEducationTable.COUNTRY.DefaultValue, 100) + End If + + End If + + End Sub + + Public Overridable Sub SetCourse() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.Course.ID) Then + + Me.Course.Text = Me.PreviousUIData(Me.Course.ID).ToString() + + Return + End If + + + ' Set the Course TextBox on the webpage with value from the + ' PersonalEducation database record. + + ' Me.DataSource is the PersonalEducation record retrieved from the database. + ' Me.Course is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetCourse() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.CourseSpecified Then + + ' If the Course is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalEducationTable.Course) + + Me.Course.Text = formattedValue + + Else + + ' Course is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.Course.Text = PersonalEducationTable.Course.Format(PersonalEducationTable.Course.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetCourseAbbr() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.CourseAbbr.ID) Then + + Me.CourseAbbr.Text = Me.PreviousUIData(Me.CourseAbbr.ID).ToString() + + Return + End If + + + ' Set the CourseAbbr TextBox on the webpage with value from the + ' PersonalEducation database record. + + ' Me.DataSource is the PersonalEducation record retrieved from the database. + ' Me.CourseAbbr is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetCourseAbbr() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.CourseAbbrSpecified Then + + ' If the CourseAbbr is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalEducationTable.CourseAbbr) + + Me.CourseAbbr.Text = formattedValue + + Else + + ' CourseAbbr is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.CourseAbbr.Text = PersonalEducationTable.CourseAbbr.Format(PersonalEducationTable.CourseAbbr.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetCourseNo() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.CourseNo.ID) Then + + Me.CourseNo.Text = Me.PreviousUIData(Me.CourseNo.ID).ToString() + + Return + End If + + + ' Set the CourseNo TextBox on the webpage with value from the + ' PersonalEducation database record. + + ' Me.DataSource is the PersonalEducation record retrieved from the database. + ' Me.CourseNo is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetCourseNo() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.CourseNoSpecified Then + + ' If the CourseNo is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalEducationTable.CourseNo) + + Me.CourseNo.Text = formattedValue + + Else + + ' CourseNo is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.CourseNo.Text = PersonalEducationTable.CourseNo.Format(PersonalEducationTable.CourseNo.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetEducationPeriod() + + ' If selection was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.EducationPeriod.ID) Then + If Me.PreviousUIData(Me.EducationPeriod.ID) Is Nothing + Me.PopulateEducationPeriodDropDownList(Nothing, 100) + Else + Me.PopulateEducationPeriodDropDownList(Me.PreviousUIData(Me.EducationPeriod.ID).ToString(), 100) + End If + Return + End If + + + ' Set the EducationPeriod DropDownList on the webpage with value from the + ' PersonalEducation database record. + + ' Me.DataSource is the PersonalEducation record retrieved from the database. + ' Me.EducationPeriod is the ASP:DropDownList on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetEducationPeriod() + ' and add your own code before or after the call to the MyBase function. + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.EducationPeriodSpecified Then + + ' If the EducationPeriod is non-NULL, then format the value. + ' The Format method will return the Display Foreign Key As (DFKA) value + Me.PopulateEducationPeriodDropDownList(Me.DataSource.EducationPeriod.ToString(), 100) + + Else + + ' EducationPeriod 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.PopulateEducationPeriodDropDownList(Nothing, 100) + Else + Me.PopulateEducationPeriodDropDownList(PersonalEducationTable.EducationPeriod.DefaultValue, 100) + End If + + End If + + End Sub + + Public Overridable Sub SetEdYear() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.EdYear.ID) Then + + Me.EdYear.Text = Me.PreviousUIData(Me.EdYear.ID).ToString() + + Return + End If + + + ' Set the EdYear TextBox on the webpage with value from the + ' PersonalEducation database record. + + ' Me.DataSource is the PersonalEducation record retrieved from the database. + ' Me.EdYear is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetEdYear() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.EdYearSpecified Then + + ' If the EdYear is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalEducationTable.EdYear) + + Me.EdYear.Text = formattedValue + + Else + + ' EdYear is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.EdYear.Text = PersonalEducationTable.EdYear.Format(PersonalEducationTable.EdYear.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetEndDate1() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.EndDate1.ID) Then + + Me.EndDate1.Text = Me.PreviousUIData(Me.EndDate1.ID).ToString() + + Return + End If + + + ' Set the EndDate TextBox on the webpage with value from the + ' PersonalEducation database record. + + ' Me.DataSource is the PersonalEducation record retrieved from the database. + ' Me.EndDate1 is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetEndDate1() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.EndDateSpecified Then + + ' If the EndDate is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalEducationTable.EndDate, "d MMM yy") + + Me.EndDate1.Text = formattedValue + + Else + + ' EndDate is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.EndDate1.Text = PersonalEducationTable.EndDate.Format(PersonalEducationTable.EndDate.DefaultValue, "d MMM yy") + + End If + + End Sub + + Public Overridable Sub SetFacultry() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.Facultry.ID) Then + + Me.Facultry.Text = Me.PreviousUIData(Me.Facultry.ID).ToString() + + Return + End If + + + ' Set the Facultry TextBox on the webpage with value from the + ' PersonalEducation database record. + + ' Me.DataSource is the PersonalEducation record retrieved from the database. + ' Me.Facultry is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetFacultry() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.FacultrySpecified Then + + ' If the Facultry is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalEducationTable.Facultry) + + Me.Facultry.Text = formattedValue + + Else + + ' Facultry is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.Facultry.Text = PersonalEducationTable.Facultry.Format(PersonalEducationTable.Facultry.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetInstitue() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.Institue.ID) Then + + Me.Institue.Text = Me.PreviousUIData(Me.Institue.ID).ToString() + + Return + End If + + + ' Set the Institue TextBox on the webpage with value from the + ' PersonalEducation database record. + + ' Me.DataSource is the PersonalEducation record retrieved from the database. + ' Me.Institue is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetInstitue() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.InstitueSpecified Then + + ' If the Institue is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalEducationTable.Institue) + + Me.Institue.Text = formattedValue + + Else + + ' Institue is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.Institue.Text = PersonalEducationTable.Institue.Format(PersonalEducationTable.Institue.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetLevelId() + + ' If selection was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.LevelId.ID) Then + If Me.PreviousUIData(Me.LevelId.ID) Is Nothing + Me.PopulateLevelIdDropDownList(Nothing, 100) + Else + Me.PopulateLevelIdDropDownList(Me.PreviousUIData(Me.LevelId.ID).ToString(), 100) + End If + Return + End If + + + ' Set the LevelId DropDownList on the webpage with value from the + ' PersonalEducation database record. + + ' Me.DataSource is the PersonalEducation record retrieved from the database. + ' Me.LevelId is the ASP:DropDownList on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetLevelId() + ' and add your own code before or after the call to the MyBase function. + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.LevelIdSpecified Then + + ' If the LevelId is non-NULL, then format the value. + ' The Format method will return the Display Foreign Key As (DFKA) value + Me.PopulateLevelIdDropDownList(Me.DataSource.LevelId.ToString(), 100) + + Else + + ' LevelId 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.PopulateLevelIdDropDownList(Nothing, 100) + Else + Me.PopulateLevelIdDropDownList(PersonalEducationTable.LevelId.DefaultValue, 100) + End If + + End If + + End Sub + + Public Overridable Sub SetNoAll() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.NoAll.ID) Then + + Me.NoAll.Text = Me.PreviousUIData(Me.NoAll.ID).ToString() + + Return + End If + + + ' Set the NoAll TextBox on the webpage with value from the + ' PersonalEducation database record. + + ' Me.DataSource is the PersonalEducation record retrieved from the database. + ' Me.NoAll is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetNoAll() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.NoAllSpecified Then + + ' If the NoAll is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalEducationTable.NoAll) + + Me.NoAll.Text = formattedValue + + Else + + ' NoAll is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.NoAll.Text = PersonalEducationTable.NoAll.Format(PersonalEducationTable.NoAll.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetScore() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.Score.ID) Then + + Me.Score.Text = Me.PreviousUIData(Me.Score.ID).ToString() + + Return + End If + + + ' Set the Score TextBox on the webpage with value from the + ' PersonalEducation database record. + + ' Me.DataSource is the PersonalEducation record retrieved from the database. + ' Me.Score is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetScore() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.ScoreSpecified Then + + ' If the Score is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalEducationTable.Score) + + Me.Score.Text = formattedValue + + Else + + ' Score is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.Score.Text = PersonalEducationTable.Score.Format(PersonalEducationTable.Score.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetScoreNo() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.ScoreNo.ID) Then + + Me.ScoreNo.Text = Me.PreviousUIData(Me.ScoreNo.ID).ToString() + + Return + End If + + + ' Set the ScoreNo TextBox on the webpage with value from the + ' PersonalEducation database record. + + ' Me.DataSource is the PersonalEducation record retrieved from the database. + ' Me.ScoreNo is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetScoreNo() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.ScoreNoSpecified Then + + ' If the ScoreNo is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalEducationTable.ScoreNo) + + Me.ScoreNo.Text = formattedValue + + Else + + ' ScoreNo is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.ScoreNo.Text = PersonalEducationTable.ScoreNo.Format(PersonalEducationTable.ScoreNo.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetStartDate1() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.StartDate1.ID) Then + + Me.StartDate1.Text = Me.PreviousUIData(Me.StartDate1.ID).ToString() + + Return + End If + + + ' Set the StartDate TextBox on the webpage with value from the + ' PersonalEducation database record. + + ' Me.DataSource is the PersonalEducation record retrieved from the database. + ' Me.StartDate1 is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetStartDate1() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.StartDateSpecified Then + + ' If the StartDate is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalEducationTable.StartDate, "d MMM yy") + + Me.StartDate1.Text = formattedValue + + Else + + ' StartDate is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.StartDate1.Text = PersonalEducationTable.StartDate.Format(PersonalEducationTable.StartDate.DefaultValue, "d MMM yy") + + End If + + End Sub + + + Public EvaluateFormulaDelegate As BaseClasses.Data.DataSource.EvaluateFormulaDelegate = New BaseClasses.Data.DataSource.EvaluateFormulaDelegate(AddressOf Me.EvaluateFormula) + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean, ByVal e As FormulaEvaluator) As String + If e Is Nothing Then + e = New FormulaEvaluator() + End If + + e.Variables.Clear() + + + ' add variables for formula evaluation + If variables IsNot Nothing Then + Dim enumerator As System.Collections.Generic.IEnumerator(Of System.Collections.Generic.KeyValuePair(Of String, Object)) = variables.GetEnumerator() + While enumerator.MoveNext() + e.Variables.Add(enumerator.Current.Key, enumerator.Current.Value) + End While + End If + + If includeDS + + End IF + + + ' Other variables referred to in the formula are expected to be + ' properties of the DataSource. For example, referring to + ' UnitPrice as a variable will refer to DataSource.UnitPrice + If dataSourceForEvaluate Is Nothing Then + + e.DataSource = Me.DataSource + + Else + e.DataSource = dataSourceForEvaluate + End If + + ' Define the calling control. This is used to add other + ' related table and record controls as variables. + e.CallingControl = Me + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + + If Not String.IsNullOrEmpty(format) AndAlso (String.IsNullOrEmpty(formula) OrElse formula.IndexOf("Format(") < 0) Then + Return FormulaUtils.Format(resultObj, format) + Else + Return resultObj.ToString() + End If + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format,variables ,includeDS, Nothing) + End Function + + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object)) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format, variables ,True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, format, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal e as FormulaEvaluator) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, variables, True, e) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal includeDS as Boolean) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, includeDS, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, True, Nothing) + End Function + + + Public Overridable Sub RegisterPostback() + + + End Sub + + + + ' To customize, override this method in PersonalEducationTableControlRow. + Public Overridable Sub SaveData() + ' Saves the associated record in the database. + ' SaveData calls Validate and Get methods - so it may be more appropriate to + ' customize those methods. + + ' 1. Load the existing record from the database. Since we save the entire record, this ensures + ' that fields that are not displayed are also properly initialized. + Me.LoadData() + + Dim parentCtrl As PersonalIdRecordControl + + + parentCtrl = DirectCast(Me.Page.FindControlRecursively("PersonalIdRecordControl"), PersonalIdRecordControl) + + If (Not IsNothing(parentCtrl) AndAlso IsNothing(parentCtrl.DataSource)) + ' Load the record if it is not loaded yet. + parentCtrl.LoadData() + End If + If (IsNothing(parentCtrl) OrElse IsNothing(parentCtrl.DataSource)) + ' Get the error message from the application resource file. + Throw New Exception(Page.GetResourceValue("Err:NoParentRecId", "Persons")) + End If + + Me.DataSource.PersonalId = parentCtrl.DataSource.PersonalId + + ' 2. Perform any custom validation. + Me.Validate() + + + ' 3. Set the values in the record with data from UI controls. + ' This calls the Get() method for each of the user interface controls. + Me.GetUIData() + + ' 4. Save in the database. + ' We should not save the record if the data did not change. This + ' will save a database hit and avoid triggering any database triggers. + + If Me.DataSource.IsAnyValueChanged Then + ' Save record to database but do not commit yet. + ' Auto generated ids are available after saving for use by child (dependent) records. + Me.DataSource.Save() + + DirectCast(GetParentControlObject(Me, "PersonalEducationTableControl"), PersonalEducationTableControl).DataChanged = True + DirectCast(GetParentControlObject(Me, "PersonalEducationTableControl"), PersonalEducationTableControl).ResetData = True + End If + + + ' update session or cookie by formula + + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + ' For Master-Detail relationships, save data on the Detail table(s) + + End Sub + + ' To customize, override this method in PersonalEducationTableControlRow. + Public Overridable Sub GetUIData() + ' The GetUIData method retrieves the updated values from the user interface + ' controls into a database record in preparation for saving or updating. + ' To do this, it calls the Get methods for each of the field displayed on + ' the webpage. It is better to make changes in the Get methods, rather + ' than making changes here. + + ' Call the Get methods for each of the user interface controls. + + GetCommand() + GetCommandDate() + GetCOUNTRY() + GetCourse() + GetCourseAbbr() + GetCourseNo() + GetEducationPeriod() + GetEdYear() + GetEndDate1() + GetFacultry() + GetInstitue() + GetLevelId() + GetNoAll() + GetScore() + GetScoreNo() + GetStartDate1() + End Sub + + + Public Overridable Sub GetCommand() + + ' Retrieve the value entered by the user on the Command ASP:TextBox, and + ' save it into the Command field in DataSource PersonalEducation record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.Command.Text, PersonalEducationTable.Command) + + + End Sub + + Public Overridable Sub GetCommandDate() + + ' Retrieve the value entered by the user on the CommandDate ASP:TextBox, and + ' save it into the CommandDate field in DataSource PersonalEducation 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.CommandDate.Text, PersonalEducationTable.CommandDate) + + + End Sub + + Public Overridable Sub GetCOUNTRY() + + ' Retrieve the value entered by the user on the COUNTRY ASP:DropDownList, and + ' save it into the COUNTRY field in DataSource PersonalEducation record. + + ' Custom validation should be performed in Validate, not here. + + Me.DataSource.Parse(GetValueSelectedPageRequest(Me.COUNTRY), PersonalEducationTable.COUNTRY) + + End Sub + + Public Overridable Sub GetCourse() + + ' Retrieve the value entered by the user on the Course ASP:TextBox, and + ' save it into the Course field in DataSource PersonalEducation record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.Course.Text, PersonalEducationTable.Course) + + + End Sub + + Public Overridable Sub GetCourseAbbr() + + ' Retrieve the value entered by the user on the CourseAbbr ASP:TextBox, and + ' save it into the CourseAbbr field in DataSource PersonalEducation record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.CourseAbbr.Text, PersonalEducationTable.CourseAbbr) + + + End Sub + + Public Overridable Sub GetCourseNo() + + ' Retrieve the value entered by the user on the CourseNo ASP:TextBox, and + ' save it into the CourseNo field in DataSource PersonalEducation record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.CourseNo.Text, PersonalEducationTable.CourseNo) + + + End Sub + + Public Overridable Sub GetEducationPeriod() + + ' Retrieve the value entered by the user on the EducationPeriod ASP:DropDownList, and + ' save it into the EducationPeriod field in DataSource PersonalEducation record. + + ' Custom validation should be performed in Validate, not here. + + Me.DataSource.Parse(GetValueSelectedPageRequest(Me.EducationPeriod), PersonalEducationTable.EducationPeriod) + + End Sub + + Public Overridable Sub GetEdYear() + + ' Retrieve the value entered by the user on the EdYear ASP:TextBox, and + ' save it into the EdYear field in DataSource PersonalEducation record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.EdYear.Text, PersonalEducationTable.EdYear) + + + End Sub + + Public Overridable Sub GetEndDate1() + + ' Retrieve the value entered by the user on the EndDate ASP:TextBox, and + ' save it into the EndDate field in DataSource PersonalEducation 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.EndDate1.Text, PersonalEducationTable.EndDate) + + + End Sub + + Public Overridable Sub GetFacultry() + + ' Retrieve the value entered by the user on the Facultry ASP:TextBox, and + ' save it into the Facultry field in DataSource PersonalEducation record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.Facultry.Text, PersonalEducationTable.Facultry) + + + End Sub + + Public Overridable Sub GetInstitue() + + ' Retrieve the value entered by the user on the Institue ASP:TextBox, and + ' save it into the Institue field in DataSource PersonalEducation record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.Institue.Text, PersonalEducationTable.Institue) + + + End Sub + + Public Overridable Sub GetLevelId() + + ' Retrieve the value entered by the user on the LevelId ASP:DropDownList, and + ' save it into the LevelId field in DataSource PersonalEducation record. + + ' Custom validation should be performed in Validate, not here. + + Me.DataSource.Parse(GetValueSelectedPageRequest(Me.LevelId), PersonalEducationTable.LevelId) + + End Sub + + Public Overridable Sub GetNoAll() + + ' Retrieve the value entered by the user on the NoAll ASP:TextBox, and + ' save it into the NoAll field in DataSource PersonalEducation record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.NoAll.Text, PersonalEducationTable.NoAll) + + + End Sub + + Public Overridable Sub GetScore() + + ' Retrieve the value entered by the user on the Score ASP:TextBox, and + ' save it into the Score field in DataSource PersonalEducation record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.Score.Text, PersonalEducationTable.Score) + + + End Sub + + Public Overridable Sub GetScoreNo() + + ' Retrieve the value entered by the user on the ScoreNo ASP:TextBox, and + ' save it into the ScoreNo field in DataSource PersonalEducation record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.ScoreNo.Text, PersonalEducationTable.ScoreNo) + + + End Sub + + Public Overridable Sub GetStartDate1() + + ' Retrieve the value entered by the user on the StartDate ASP:TextBox, and + ' save it into the StartDate field in DataSource PersonalEducation 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.StartDate1.Text, PersonalEducationTable.StartDate) + + + End Sub + + + ' To customize, override this method in PersonalEducationTableControlRow. + + Public Overridable Function CreateWhereClause() As WhereClause + + Return Nothing + + End Function + + + + ' To customize, override this method in PersonalEducationTableControlRow. + Public Overridable Sub Validate() + ' Add custom validation for any control within this panel. + ' Example. If you have a State ASP:Textbox control + ' If Me.State.Text <> "CA" Then + ' Throw New Exception("State must be CA (California).") + ' End If + + ' The Validate method is common across all controls within + ' this panel so you can validate multiple fields, but report + ' one error message. + + + End Sub + + Public Overridable Sub Delete() + + If Me.IsNewRecord() Then + Return + End If + + Dim pkValue As KeyValue = KeyValue.XmlToKey(Me.RecordUniqueId) + PersonalEducationTable.DeleteRecord(pkValue) + + DirectCast(GetParentControlObject(Me, "PersonalEducationTableControl"), PersonalEducationTableControl).DataChanged = True + DirectCast(GetParentControlObject(Me, "PersonalEducationTableControl"), PersonalEducationTableControl).ResetData = True + End Sub + + Protected Overridable Sub Control_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.PreRender + ' PreRender event is raised just before page is being displayed. + Try + DbUtils.StartTransaction() + Me.RegisterPostback() + + If Not Me.Page.ErrorOnPage AndAlso (Me.Page.IsPageRefresh OrElse Me.DataChanged OrElse Me.ResetData) Then + + + ' Re-load the data and update the web page if necessary. + ' This is typically done during a postback (filter, search button, sort, pagination button). + ' In each of the other click handlers, simply set DataChanged to True to reload the data. + Me.LoadData() + Me.DataBind() + End If + + + Catch ex As Exception + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + Finally + DbUtils.EndTransaction() + End Try + End Sub + + + Protected Overrides Sub SaveControlsToSession() + MyBase.SaveControlsToSession() + + + 'Save pagination state to session. + + End Sub + + + + Protected Overrides Sub ClearControlsFromSession() + MyBase.ClearControlsFromSession() + + + + ' Clear pagination state from session. + + End Sub + + Protected Overrides Sub LoadViewState(ByVal savedState As Object) + MyBase.LoadViewState(savedState) + Dim isNewRecord As String = CType(ViewState("IsNewRecord"), String) + If Not isNewRecord Is Nothing AndAlso isNewRecord.Trim <> "" Then + Me.IsNewRecord = Boolean.Parse(isNewRecord) + End If + + Dim myCheckSum As String = CType(ViewState("CheckSum"), String) + If Not myCheckSum Is Nothing AndAlso myCheckSum.Trim <> "" Then + Me.CheckSum = myCheckSum + End If + + + ' Load view state for pagination control. + + End Sub + + Protected Overrides Function SaveViewState() As Object + ViewState("IsNewRecord") = Me.IsNewRecord.ToString() + ViewState("CheckSum") = Me.CheckSum + + + ' Load view state for pagination control. + + Return MyBase.SaveViewState() + End Function + + + + Public Overridable Function CreateWhereClause_COUNTRYDropDownList() 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 Country table. + ' Examples: + ' wc.iAND(CountryTable.Country, BaseFilter.ComparisonOperator.EqualsTo, "XYZ") + ' wc.iAND(CountryTable.Active, BaseFilter.ComparisonOperator.EqualsTo, "1") + + Dim wc As WhereClause = New WhereClause() + Return wc + + End Function + + + + Public Overridable Function CreateWhereClause_EducationPeriodDropDownList() 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 EducationPeriod table. + ' Examples: + ' wc.iAND(EducationPeriodTable.Period, BaseFilter.ComparisonOperator.EqualsTo, "XYZ") + ' wc.iAND(EducationPeriodTable.Active, BaseFilter.ComparisonOperator.EqualsTo, "1") + + Dim wc As WhereClause = New WhereClause() + Return wc + + End Function + + + + Public Overridable Function CreateWhereClause_LevelIdDropDownList() 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 Education table. + ' Examples: + ' wc.iAND(EducationTable.Level, BaseFilter.ComparisonOperator.EqualsTo, "XYZ") + ' wc.iAND(EducationTable.Active, BaseFilter.ComparisonOperator.EqualsTo, "1") + + Dim wc As WhereClause = New WhereClause() + Return wc + + End Function + + + ' Fill the COUNTRY list. + Protected Overridable Sub PopulateCOUNTRYDropDownList( _ + ByVal selectedValue As String, _ + ByVal maxItems As Integer) + + Me.COUNTRY.Items.Clear() + + + ' 1. Setup the static list items + + ' Add the Please Select item. + Me.COUNTRY.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_COUNTRYDropDownList function. + ' It is better to customize the where clause there. + + Dim wc As WhereClause = CreateWhereClause_COUNTRYDropDownList() + ' Create the ORDER BY clause to sort based on the displayed value. + + + Dim orderBy As OrderBy = New OrderBy(false, false) + orderBy.Add(CountryTable.Country, OrderByItem.OrderDir.Asc) + + Dim variables As System.Collections.Generic.IDictionary(Of String, Object) = New System.Collections.Generic.Dictionary(Of String, Object) + + ' 3. Read a total of maxItems from the database and insert them + Dim itemValues() As CountryRecord = 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 = CountryTable.GetRecords(wc, orderBy, pageNum, maxItems) + For each itemValue As CountryRecord In itemValues + ' Create the item and add to the list. + Dim cvalue As String = Nothing + Dim fvalue As String = Nothing + If itemValue.CountryIdSpecified Then + cvalue = itemValue.CountryId.ToString() + + If counter < maxItems AndAlso Me.COUNTRY.Items.FindByValue(cvalue) Is Nothing Then + + Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalEducationTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalEducationTable.COUNTRY) + If _isExpandableNonCompositeForeignKey AndAlso PersonalEducationTable.COUNTRY.IsApplyDisplayAs Then + fvalue = PersonalEducationTable.GetDFKA(itemValue, PersonalEducationTable.COUNTRY) + End If + If (Not _isExpandableNonCompositeForeignKey) Or (String.IsNullOrEmpty(fvalue)) Then + fvalue = itemValue.Format(CountryTable.Country) + End If + + If fvalue Is Nothing OrElse fvalue.Trim() = "" Then fvalue = cvalue + + If (IsNothing(fvalue)) Then + fvalue = "" + End If + + fvalue = fvalue.Trim() + + If ( fvalue.Length > 50 ) Then + fvalue = fvalue.Substring(0, 50) & "..." + End If + + Dim dupItem As ListItem = Me.COUNTRY.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.COUNTRY.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.COUNTRY, selectedValue) AndAlso _ + Not SetSelectedDisplayText(Me.COUNTRY, selectedValue)Then + + ' construct a whereclause to query a record with Country.CountryId = selectedValue + Dim filter2 As CompoundFilter = New CompoundFilter(CompoundFilter.CompoundingOperators.And_Operator, Nothing) + Dim whereClause2 As WhereClause = New WhereClause() + filter2.AddFilter(New BaseClasses.Data.ColumnValueFilter(CountryTable.CountryId, selectedValue, BaseClasses.Data.BaseFilter.ComparisonOperator.EqualsTo, False)) + whereClause2.AddFilter(filter2, CompoundFilter.CompoundingOperators.And_Operator) + + Try + ' Execute the query + Dim rc() As CountryRecord = CountryTable.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 CountryRecord = DirectCast(rc(0), CountryRecord) + ' Create the item and add to the list. + Dim cvalue As String = Nothing + Dim fvalue As String = Nothing + If itemValue.CountryIdSpecified Then + cvalue = itemValue.CountryId.ToString() + Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalEducationTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalEducationTable.COUNTRY) + If _isExpandableNonCompositeForeignKey AndAlso PersonalEducationTable.COUNTRY.IsApplyDisplayAs Then + fvalue = PersonalEducationTable.GetDFKA(itemValue, PersonalEducationTable.COUNTRY) + End If + If (Not _isExpandableNonCompositeForeignKey) Or (String.IsNullOrEmpty(fvalue)) Then + fvalue = itemValue.Format(CountryTable.Country) + End If + + If fvalue Is Nothing OrElse fvalue.Trim() = "" Then fvalue = cvalue + Dim newItem As New ListItem(fvalue, cvalue) + Me.COUNTRY.Items.Add(newItem) + SetSelectedValue(Me.COUNTRY, selectedValue) + End If + End If + Catch + End Try + + End If + + + End Sub + + ' Fill the EducationPeriod list. + Protected Overridable Sub PopulateEducationPeriodDropDownList( _ + ByVal selectedValue As String, _ + ByVal maxItems As Integer) + + Me.EducationPeriod.Items.Clear() + + + ' 1. Setup the static list items + + Me.EducationPeriod.Items.Add(New ListItem(Me.Page.ExpandResourceValue("{Txt:PleaseSelect}"), "--PLEASE_SELECT--")) + + Me.EducationPeriod.Items.Add(New ListItem(Me.Page.ExpandResourceValue("1,ก่อน"), "1,ก่อน")) + + Me.EducationPeriod.Items.Add(New ListItem(Me.Page.ExpandResourceValue("2,หลัง"), "2,หลัง")) + + ' Skip step 2 and 3 because no need to load data from database and insert data + + + ' 4. Set the selected value (insert if not already present). + + If Not selectedValue Is Nothing AndAlso _ + selectedValue.Trim <> "" AndAlso _ + Not SetSelectedValue(Me.EducationPeriod, selectedValue) AndAlso _ + Not SetSelectedDisplayText(Me.EducationPeriod, selectedValue)Then + + ' construct a whereclause to query a record with EducationPeriod.PeriodId = selectedValue + Dim filter2 As CompoundFilter = New CompoundFilter(CompoundFilter.CompoundingOperators.And_Operator, Nothing) + Dim whereClause2 As WhereClause = New WhereClause() + filter2.AddFilter(New BaseClasses.Data.ColumnValueFilter(EducationPeriodTable.PeriodId, selectedValue, BaseClasses.Data.BaseFilter.ComparisonOperator.EqualsTo, False)) + whereClause2.AddFilter(filter2, CompoundFilter.CompoundingOperators.And_Operator) + + Try + ' Execute the query + Dim rc() As EducationPeriodRecord = EducationPeriodTable.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 EducationPeriodRecord = DirectCast(rc(0), EducationPeriodRecord) + ' Create the item and add to the list. + Dim cvalue As String = Nothing + Dim fvalue As String = Nothing + If itemValue.PeriodIdSpecified Then + cvalue = itemValue.PeriodId.ToString() + Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalEducationTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalEducationTable.EducationPeriod) + If _isExpandableNonCompositeForeignKey AndAlso PersonalEducationTable.EducationPeriod.IsApplyDisplayAs Then + fvalue = PersonalEducationTable.GetDFKA(itemValue, PersonalEducationTable.EducationPeriod) + End If + If (Not _isExpandableNonCompositeForeignKey) Or (String.IsNullOrEmpty(fvalue)) Then + fvalue = itemValue.Format(EducationPeriodTable.Period) + End If + + If fvalue Is Nothing OrElse fvalue.Trim() = "" Then fvalue = cvalue + Dim newItem As New ListItem(fvalue, cvalue) + Me.EducationPeriod.Items.Add(newItem) + SetSelectedValue(Me.EducationPeriod, selectedValue) + End If + End If + Catch + End Try + + End If + + + End Sub + + ' Fill the LevelId list. + Protected Overridable Sub PopulateLevelIdDropDownList( _ + ByVal selectedValue As String, _ + ByVal maxItems As Integer) + + Me.LevelId.Items.Clear() + + + ' 1. Setup the static list items + + ' Add the Please Select item. + Me.LevelId.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_LevelIdDropDownList function. + ' It is better to customize the where clause there. + + Dim wc As WhereClause = CreateWhereClause_LevelIdDropDownList() + ' Create the ORDER BY clause to sort based on the displayed value. + + + Dim orderBy As OrderBy = New OrderBy(false, false) + orderBy.Add(EducationTable.Level, OrderByItem.OrderDir.Asc) + + Dim variables As System.Collections.Generic.IDictionary(Of String, Object) = New System.Collections.Generic.Dictionary(Of String, Object) + + ' 3. Read a total of maxItems from the database and insert them + Dim itemValues() As EducationRecord = 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 = EducationTable.GetRecords(wc, orderBy, pageNum, maxItems) + For each itemValue As EducationRecord In itemValues + ' Create the item and add to the list. + Dim cvalue As String = Nothing + Dim fvalue As String = Nothing + If itemValue.EducationIdSpecified Then + cvalue = itemValue.EducationId.ToString() + + If counter < maxItems AndAlso Me.LevelId.Items.FindByValue(cvalue) Is Nothing Then + + Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalEducationTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalEducationTable.LevelId) + If _isExpandableNonCompositeForeignKey AndAlso PersonalEducationTable.LevelId.IsApplyDisplayAs Then + fvalue = PersonalEducationTable.GetDFKA(itemValue, PersonalEducationTable.LevelId) + End If + If (Not _isExpandableNonCompositeForeignKey) Or (String.IsNullOrEmpty(fvalue)) Then + fvalue = itemValue.Format(EducationTable.Level) + End If + + If fvalue Is Nothing OrElse fvalue.Trim() = "" Then fvalue = cvalue + + If (IsNothing(fvalue)) Then + fvalue = "" + End If + + fvalue = fvalue.Trim() + + If ( fvalue.Length > 50 ) Then + fvalue = fvalue.Substring(0, 50) & "..." + End If + + Dim dupItem As ListItem = Me.LevelId.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.LevelId.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.LevelId, selectedValue) AndAlso _ + Not SetSelectedDisplayText(Me.LevelId, selectedValue)Then + + ' construct a whereclause to query a record with Education.EducationId = selectedValue + Dim filter2 As CompoundFilter = New CompoundFilter(CompoundFilter.CompoundingOperators.And_Operator, Nothing) + Dim whereClause2 As WhereClause = New WhereClause() + filter2.AddFilter(New BaseClasses.Data.ColumnValueFilter(EducationTable.EducationId, selectedValue, BaseClasses.Data.BaseFilter.ComparisonOperator.EqualsTo, False)) + whereClause2.AddFilter(filter2, CompoundFilter.CompoundingOperators.And_Operator) + + Try + ' Execute the query + Dim rc() As EducationRecord = EducationTable.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 EducationRecord = DirectCast(rc(0), EducationRecord) + ' Create the item and add to the list. + Dim cvalue As String = Nothing + Dim fvalue As String = Nothing + If itemValue.EducationIdSpecified Then + cvalue = itemValue.EducationId.ToString() + Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalEducationTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalEducationTable.LevelId) + If _isExpandableNonCompositeForeignKey AndAlso PersonalEducationTable.LevelId.IsApplyDisplayAs Then + fvalue = PersonalEducationTable.GetDFKA(itemValue, PersonalEducationTable.LevelId) + End If + If (Not _isExpandableNonCompositeForeignKey) Or (String.IsNullOrEmpty(fvalue)) Then + fvalue = itemValue.Format(EducationTable.Level) + End If + + If fvalue Is Nothing OrElse fvalue.Trim() = "" Then fvalue = cvalue + Dim newItem As New ListItem(fvalue, cvalue) + Me.LevelId.Items.Add(newItem) + SetSelectedValue(Me.LevelId, selectedValue) + End If + End If + Catch + End Try + + End If + + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalEducationRowDeleteButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + If(Not Me.Page.IsPageRefresh) Then + + Dim tc As PersonalEducationTableControl = DirectCast(GetParentControlObject(Me, "PersonalEducationTableControl"), PersonalEducationTableControl) + If Not (IsNothing(tc)) Then + If Not Me.IsNewRecord Then + tc.AddToDeletedRecordIds(DirectCast(Me, PersonalEducationTableControlRow)) + End If + Me.Visible = False + tc.SetFormulaControls() + End If + + End If + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalEducationRowEditButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + ' The redirect URL is set on the Properties, Custom Properties or Actions. + ' The ModifyRedirectURL call resolves the parameters before the + ' Response.Redirect redirects the page to the URL. + ' Any code after the Response.Redirect call will not be executed, since the page is + ' redirected to the URL. + + + Dim url As String = "../PersonalEducation/EditPersonalEducation.aspx?PersonalEducation={PK}" + + Dim shouldRedirect As Boolean = True + Dim TargetKey As String = Nothing + Dim DFKA As String = TargetKey + Dim id As String = DFKA + Dim value As String = id + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + url = Me.ModifyRedirectUrl(url, "",False) + url = Me.Page.ModifyRedirectUrl(url, "",False) + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + shouldRedirect = False + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + If shouldRedirect Then + Me.Page.ShouldSaveControlsToSession = True + Me.Page.Response.Redirect(url) + ElseIf Not TargetKey Is Nothing AndAlso _ + Not shouldRedirect Then + Me.Page.ShouldSaveControlsToSession = True + Me.Page.CloseWindow(True) + + End If + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalEducationRowViewButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + ' The redirect URL is set on the Properties, Custom Properties or Actions. + ' The ModifyRedirectURL call resolves the parameters before the + ' Response.Redirect redirects the page to the URL. + ' Any code after the Response.Redirect call will not be executed, since the page is + ' redirected to the URL. + + + Dim url As String = "../PersonalEducation/ShowPersonalEducation.aspx?PersonalEducation={PK}" + + Dim shouldRedirect As Boolean = True + Dim TargetKey As String = Nothing + Dim DFKA As String = TargetKey + Dim id As String = DFKA + Dim value As String = id + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + url = Me.ModifyRedirectUrl(url, "",False) + url = Me.Page.ModifyRedirectUrl(url, "",False) + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + shouldRedirect = False + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + If shouldRedirect Then + Me.Page.ShouldSaveControlsToSession = True + Me.Page.Response.Redirect(url) + ElseIf Not TargetKey Is Nothing AndAlso _ + Not shouldRedirect Then + Me.Page.ShouldSaveControlsToSession = True + Me.Page.CloseWindow(True) + + End If + End Sub + + Protected Overridable Sub COUNTRY_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()(COUNTRY.ClientID & "_SelectedValue"), String) + Dim displayText As String = CType(Me.Page.Session()(COUNTRY.ClientID & "_SelectedDisplayText"), String) + If displayText <> "" AndAlso val <> "" Then + Me.COUNTRY.Items.Add(New ListItem(displayText, val)) + Me.COUNTRY.SelectedIndex = Me.COUNTRY.Items.Count - 1 + Me.Page.Session.Remove(COUNTRY.ClientID & "_SelectedValue") + Me.Page.Session.Remove(COUNTRY.ClientID & "_SelectedDisplayText") + End If + + + + + End Sub + + Protected Overridable Sub EducationPeriod_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()(EducationPeriod.ClientID & "_SelectedValue"), String) + Dim displayText As String = CType(Me.Page.Session()(EducationPeriod.ClientID & "_SelectedDisplayText"), String) + If displayText <> "" AndAlso val <> "" Then + Me.EducationPeriod.Items.Add(New ListItem(displayText, val)) + Me.EducationPeriod.SelectedIndex = Me.EducationPeriod.Items.Count - 1 + Me.Page.Session.Remove(EducationPeriod.ClientID & "_SelectedValue") + Me.Page.Session.Remove(EducationPeriod.ClientID & "_SelectedDisplayText") + End If + + + + + End Sub + + Protected Overridable Sub LevelId_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()(LevelId.ClientID & "_SelectedValue"), String) + Dim displayText As String = CType(Me.Page.Session()(LevelId.ClientID & "_SelectedDisplayText"), String) + If displayText <> "" AndAlso val <> "" Then + Me.LevelId.Items.Add(New ListItem(displayText, val)) + Me.LevelId.SelectedIndex = Me.LevelId.Items.Count - 1 + Me.Page.Session.Remove(LevelId.ClientID & "_SelectedValue") + Me.Page.Session.Remove(LevelId.ClientID & "_SelectedDisplayText") + End If + + + + + End Sub + + Protected Overridable Sub Command_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub CommandDate_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub Course_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub CourseAbbr_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub CourseNo_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub EdYear_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub EndDate1_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub Facultry_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub Institue_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub NoAll_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub Score_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub ScoreNo_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub StartDate1_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("BasePersonalEducationTableControlRow_Rec"), String) + End Get + Set(ByVal value As String) + Me.ViewState("BasePersonalEducationTableControlRow_Rec") = value + End Set + End Property + + Private _DataSource As PersonalEducationRecord + Public Property DataSource() As PersonalEducationRecord + Get + Return Me._DataSource + End Get + + Set(ByVal value As PersonalEducationRecord) + + Me._DataSource = value + End Set + End Property + + + + Private _checkSum As String + Public Overridable Property CheckSum() As String + Get + Return Me._checkSum + End Get + Set(ByVal value As String) + Me._checkSum = value + End Set + End Property + + Private _TotalPages As Integer + Public Property TotalPages() As Integer + Get + Return Me._TotalPages + End Get + Set(ByVal value As Integer) + Me._TotalPages = value + End Set + End Property + + Private _PageIndex As Integer + Public Property PageIndex() As Integer + Get + ' Return the PageIndex + Return Me._PageIndex + End Get + Set(ByVal value As Integer) + Me._PageIndex = value + End Set + End Property + + Private _DisplayLastPage As Boolean + Public Property DisplayLastPage() As Boolean + Get + Return Me._DisplayLastPage + End Get + Set(ByVal value As Boolean) + Me._DisplayLastPage = value + End Set + End Property + + + +#Region "Helper Properties" + + Public ReadOnly Property Command() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Command"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property CommandDate() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "CommandDate"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property COUNTRY() As System.Web.UI.WebControls.DropDownList + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "COUNTRY"), System.Web.UI.WebControls.DropDownList) + End Get + End Property + + Public ReadOnly Property Course() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Course"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property CourseAbbr() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "CourseAbbr"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property CourseNo() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "CourseNo"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property EducationPeriod() As System.Web.UI.WebControls.DropDownList + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "EducationPeriod"), System.Web.UI.WebControls.DropDownList) + End Get + End Property + + Public ReadOnly Property EdYear() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "EdYear"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property EndDate1() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "EndDate1"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property Facultry() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Facultry"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property Institue() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Institue"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property LevelId() As System.Web.UI.WebControls.DropDownList + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "LevelId"), System.Web.UI.WebControls.DropDownList) + End Get + End Property + + Public ReadOnly Property NoAll() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "NoAll"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property PersonalEducationRecordRowSelection() As System.Web.UI.WebControls.CheckBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalEducationRecordRowSelection"), System.Web.UI.WebControls.CheckBox) + End Get + End Property + + Public ReadOnly Property PersonalEducationRowDeleteButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalEducationRowDeleteButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalEducationRowEditButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalEducationRowEditButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalEducationRowViewButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalEducationRowViewButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property Score() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Score"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property ScoreNo() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "ScoreNo"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property StartDate1() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "StartDate1"), System.Web.UI.WebControls.TextBox) + End Get + End Property + +#End Region + +#Region "Helper Functions" + + Public Overrides Overloads Function ModifyRedirectUrl(ByVal url As String, ByVal arg As String, ByVal bEncrypt As Boolean) As String + Return Me.Page.EvaluateExpressions(url, arg, bEncrypt, Me) + End Function + + Public Overrides Overloads Function EvaluateExpressions(ByVal url As String, ByVal arg As String, ByVal bEncrypt As Boolean) As String + + Dim rec As PersonalEducationRecord = Nothing + + + Try + rec = Me.GetRecord() + Catch ex As Exception + ' Do nothing + End Try + + If rec Is Nothing AndAlso url.IndexOf("{") >= 0 Then + ' Localization. + + Throw New Exception(Page.GetResourceValue("Err:RecDataSrcNotInitialized", "Persons")) + + End If + Return EvaluateExpressions(url, arg, rec, bEncrypt) + End Function + + + Public Overridable Function GetRecord() As PersonalEducationRecord + If Not Me.DataSource Is Nothing Then + Return Me.DataSource + End If + + If Not Me.RecordUniqueId Is Nothing Then + + Return PersonalEducationTable.GetRecord(Me.RecordUniqueId, True) + + End If + + ' Localization. + + Return Nothing + + End Function + + Public Shadows ReadOnly Property Page() As BaseApplicationPage + Get + Return DirectCast(MyBase.Page, BaseApplicationPage) + End Get + End Property + +#End Region + +End Class + + + +' Base class for the PersonalEducationTableControl control on the EditPersonalId page. +' Do not modify this class. Instead override any method in PersonalEducationTableControl. +Public Class BasePersonalEducationTableControl + Inherits Persons.UI.BaseApplicationTableControl + + + + Protected Overridable Sub Control_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Init + + + + ' Setup the filter and search events. + + + + ' Control Initializations. + ' Initialize the table's current sort order. + + If Me.InSession(Me, "Order_By") Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + Me.CurrentSortOrder.Add(PersonalEducationTable.EducationPeriod, OrderByItem.OrderDir.Asc) + + Me.CurrentSortOrder.Add(PersonalEducationTable.StartDate, OrderByItem.OrderDir.Asc) + + End If + + + + ' Setup default pagination settings. + + Me.PageSize = CInt(Me.GetFromSession(Me, "Page_Size", "10")) + Me.PageIndex = CInt(Me.GetFromSession(Me, "Page_Index", "0")) + + + + Me.ClearControlsFromSession() + End Sub + + Protected Overridable Sub Control_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load + + SaveControlsToSession_Ajax() + + ' Show confirmation message on Click + Me.PersonalEducationDeleteButton.Attributes.Add("onClick", "return (confirm('" & (CType(Me.Page,BaseApplicationPage)).GetResourceValue("DeleteConfirm", "Persons") & "'));") + + ' Setup the pagination events. + + AddHandler Me.PersonalEducationPagination.FirstPage.Click, AddressOf PersonalEducationPagination_FirstPage_Click + + AddHandler Me.PersonalEducationPagination.LastPage.Click, AddressOf PersonalEducationPagination_LastPage_Click + + AddHandler Me.PersonalEducationPagination.NextPage.Click, AddressOf PersonalEducationPagination_NextPage_Click + + AddHandler Me.PersonalEducationPagination.PageSizeButton.Click, AddressOf PersonalEducationPagination_PageSizeButton_Click + + AddHandler Me.PersonalEducationPagination.PreviousPage.Click, AddressOf PersonalEducationPagination_PreviousPage_Click + + + ' Setup the sorting events. + + AddHandler Me.CommandDateLabel.Click, AddressOf CommandDateLabel_Click + + AddHandler Me.CommandLabel.Click, AddressOf CommandLabel_Click + + AddHandler Me.COUNTRYLabel1.Click, AddressOf COUNTRYLabel1_Click + + AddHandler Me.CourseAbbrLabel.Click, AddressOf CourseAbbrLabel_Click + + AddHandler Me.CourseLabel.Click, AddressOf CourseLabel_Click + + AddHandler Me.CourseNoLabel.Click, AddressOf CourseNoLabel_Click + + AddHandler Me.EducationPeriodLabel.Click, AddressOf EducationPeriodLabel_Click + + AddHandler Me.EdYearLabel.Click, AddressOf EdYearLabel_Click + + AddHandler Me.EndDateLabel2.Click, AddressOf EndDateLabel2_Click + + AddHandler Me.FacultryLabel.Click, AddressOf FacultryLabel_Click + + AddHandler Me.InstitueLabel.Click, AddressOf InstitueLabel_Click + + AddHandler Me.LevelIdLabel1.Click, AddressOf LevelIdLabel1_Click + + AddHandler Me.NoAllLabel.Click, AddressOf NoAllLabel_Click + + AddHandler Me.ScoreLabel.Click, AddressOf ScoreLabel_Click + + AddHandler Me.ScoreNoLabel.Click, AddressOf ScoreNoLabel_Click + + AddHandler Me.StartDateLabel2.Click, AddressOf StartDateLabel2_Click + + ' Setup the button events. + + AddHandler Me.PersonalEducationAddButton.Click, AddressOf PersonalEducationAddButton_Click + + AddHandler Me.PersonalEducationDeleteButton.Click, AddressOf PersonalEducationDeleteButton_Click + + AddHandler Me.PersonalEducationEditButton.Click, AddressOf PersonalEducationEditButton_Click + + AddHandler Me.PersonalEducationResetButton.Click, AddressOf PersonalEducationResetButton_Click + + + ' Setup events for others + + End Sub + + + Public Overridable Sub LoadData() + + ' Read data from database. Returns an array of records that can be assigned + ' to the DataSource table control property. + Try + Dim joinFilter As CompoundFilter = CreateCompoundJoinFilter() + + ' The WHERE clause will be empty when displaying all records in table. + Dim wc As WhereClause = CreateWhereClause() + If wc IsNot Nothing AndAlso Not wc.RunQuery Then + ' Initialize an empty array of records + Dim alist As New ArrayList(0) + Me.DataSource = DirectCast(alist.ToArray(GetType(PersonalEducationRecord)), PersonalEducationRecord()) + ' Add records to the list if needed. + Me.AddNewRecords() + Me._TotalRecords = 0 + Me._TotalPages = 0 + Return + End If + + ' Call OrderBy to determine the order - either use the order defined + ' on the Query Wizard, or specified by user (by clicking on column heading) + Dim orderBy As OrderBy = CreateOrderBy() + + ' Get the pagesize from the pagesize control. + Me.GetPageSize() + + If Me.DisplayLastPage Then + Dim totalRecords As Integer = If(Me._TotalRecords < 0, PersonalEducationTable.GetRecordCount(CreateCompoundJoinFilter(), CreateWhereClause()), Me._TotalRecords) + + Dim totalPages As Integer = CInt(Math.Ceiling(totalRecords / Me.PageSize)) + + Me.PageIndex = totalPages - 1 + End If + + ' Make sure PageIndex (current page) and PageSize are within bounds. + If Me.PageIndex < 0 Then + Me.PageIndex = 0 + End If + If Me.PageSize < 1 Then + Me.PageSize = 1 + End If + + ' Retrieve the records and set the table DataSource. + ' Only PageSize records are fetched starting at PageIndex (zero based). + If Me.AddNewRecord > 0 Then + ' Make sure to preserve the previously entered data on new rows. + Dim postdata As New ArrayList + For Each rc As PersonalEducationTableControlRow In Me.GetRecordControls() + If Not rc.IsNewRecord Then + rc.DataSource = rc.GetRecord() + rc.GetUIData() + postdata.Add(rc.DataSource) + UIData.Add(rc.PreservedUIData()) + End If + Next + Me.DataSource = DirectCast(postdata.ToArray(GetType(PersonalEducationRecord)), PersonalEducationRecord()) + Else ' Get the records from the database + Me.DataSource = PersonalEducationTable.GetRecords(joinFilter, wc, orderBy, Me.PageIndex, Me.PageSize) + + End If + + ' if the datasource contains no records contained in database, then load the last page. + If (DbUtils.GetCreatedRecords(Me.DataSource).Length = 0 AndAlso Not Me.DisplayLastPage) Then + Me.DisplayLastPage = True + LoadData() + Else + + ' Add any new rows desired by the user. + Me.AddNewRecords() + + ' Turn off the ToggleAll checkbox + Me.PersonalEducationToggleAll.Checked = False + + + ' Initialize the page and grand totals. now + + End If + + Catch ex As Exception + ' Report the error message to the end user + Dim msg As String = ex.Message + If ex.InnerException IsNot Nothing Then + msg = msg & " InnerException: " & ex.InnerException.Message + End If + Throw New Exception(msg, ex.InnerException) + End Try + End Sub + + + + + Public Overrides Sub DataBind() + ' The DataBind method binds the user interface controls to the values + ' from the database record for each row in the table. To do this, it calls the + ' DataBind for each of the rows. + ' DataBind also populates any filters above the table, and sets the pagination + ' control to the correct number of records and the current page number. + + MyBase.DataBind() + + ' Make sure that the DataSource is initialized. + If Me.DataSource Is Nothing Then + Return + End If + + 'LoadData for DataSource for chart and report if they exist + + ' Improve performance by prefetching display as records. + Me.PreFetchForeignKeyValues() + + ' Setup the pagination controls. + BindPaginationControls() + + + + ' Bind the repeater with the list of records to expand the UI. + Dim rep As System.Web.UI.WebControls.Repeater = CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalEducationTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return + rep.DataSource = DataSource() + rep.DataBind() + + Dim index As Integer = 0 + For Each repItem As System.Web.UI.WebControls.RepeaterItem In rep.Items + ' Loop through all rows in the table, set its DataSource and call DataBind(). + Dim recControl As PersonalEducationTableControlRow = DirectCast(repItem.FindControl("PersonalEducationTableControlRow"), PersonalEducationTableControlRow) + recControl.DataSource = Me.DataSource(index) + If Me.UIData.Count > index Then + recControl.PreviousUIData = Me.UIData(index) + End If + recControl.DataBind() + recControl.Visible = Not Me.InDeletedRecordIds(recControl) + + index += 1 + Next + + + + + ' Call the Set methods for each controls on the panel + + SetCommandDateLabel() + SetCommandLabel() + SetCOUNTRYLabel1() + SetCourseAbbrLabel() + SetCourseLabel() + SetCourseNoLabel() + SetEducationPeriodLabel() + SetEdYearLabel() + SetEndDateLabel2() + SetFacultryLabel() + SetInstitueLabel() + SetLevelIdLabel1() + SetNoAllLabel() + + + + + + SetPersonalEducationTableControlCollapsibleRegion() + + SetScoreLabel() + SetScoreNoLabel() + SetStartDateLabel2() + ' setting the state of expand or collapse alternative rows + + + ' Load data for each record and table UI control. + ' Ordering is important because child controls get + ' their parent ids from their parent UI controls. + + + ' this method calls the set method for controls with special formula like running total, sum, rank, etc + SetFormulaControls() + End Sub + + Public Overridable Sub SetFormulaControls() + ' this method calls Set methods for the control that has special formula + + + + End Sub + + + Public Sub PreFetchForeignKeyValues() + If (IsNothing(Me.DataSource)) + Return + End If + + Me.Page.PregetDfkaRecords(PersonalEducationTable.COUNTRY, Me.DataSource) + + Me.Page.PregetDfkaRecords(PersonalEducationTable.EducationPeriod, Me.DataSource) + + Me.Page.PregetDfkaRecords(PersonalEducationTable.LevelId, Me.DataSource) + + End Sub + + + Public Overridable Sub RegisterPostback() + + + End Sub + + Public EvaluateFormulaDelegate As BaseClasses.Data.DataSource.EvaluateFormulaDelegate = New BaseClasses.Data.DataSource.EvaluateFormulaDelegate(AddressOf Me.EvaluateFormula) + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean, ByVal e as FormulaEvaluator) As String + If e Is Nothing + e = New FormulaEvaluator() + End If + + e.Variables.Clear() + + + ' add variables for formula evaluation + If variables IsNot Nothing Then + Dim enumerator As System.Collections.Generic.IEnumerator(Of System.Collections.Generic.KeyValuePair(Of String, Object)) = variables.GetEnumerator() + While enumerator.MoveNext() + e.Variables.Add(enumerator.Current.Key, enumerator.Current.Value) + End While + End If + + If includeDS + + End If + + ' All variables referred to in the formula are expected to be + ' properties of the DataSource. For example, referring to + ' UnitPrice as a variable will refer to DataSource.UnitPrice + e.DataSource = dataSourceForEvaluate + + ' Define the calling control. This is used to add other + ' related table and record controls as variables. + e.CallingControl = Me + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + + If Not String.IsNullOrEmpty(format) AndAlso (String.IsNullOrEmpty(formula) OrElse formula.IndexOf("Format(") < 0) Then + Return FormulaUtils.Format(resultObj, format) + Else + Return resultObj.ToString() + End If + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format,variables ,includeDS, Nothing) + End Function + + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object)) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format, variables ,True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, format, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal e as FormulaEvaluator) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, variables, True, e) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal includeDS as Boolean) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, includeDS, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, True, Nothing) + End Function + + + + + Public Overridable Sub ResetControl() + + Me.CurrentSortOrder.Reset() + If (Me.InSession(Me, "Order_By")) Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + Me.CurrentSortOrder.Add(PersonalEducationTable.EducationPeriod, OrderByItem.OrderDir.Asc) + + Me.CurrentSortOrder.Add(PersonalEducationTable.StartDate, OrderByItem.OrderDir.Asc) + + End If + + Me.PageIndex = 0 + End Sub + + Protected Overridable Sub BindPaginationControls() + ' Setup the pagination controls. + + ' Bind the pagination labels. + + If DbUtils.GetCreatedRecords(Me.DataSource).Length > 0 Then + + Me.PersonalEducationPagination.CurrentPage.Text = (Me.PageIndex + 1).ToString() + Else + Me.PersonalEducationPagination.CurrentPage.Text = "0" + End If + Me.PersonalEducationPagination.PageSize.Text = Me.PageSize.ToString() + Me.PersonalEducationPagination.TotalItems.Text = Me.TotalRecords.ToString() + Me.PersonalEducationPagination.TotalPages.Text = Me.TotalPages.ToString() + + ' Bind the buttons for PersonalEducationTableControl pagination. + + Me.PersonalEducationPagination.FirstPage.Enabled = Not (Me.PageIndex = 0) + If Me._TotalPages < 0 Then ' if the total pages is not determined yet, enable last and next buttons + Me.PersonalEducationPagination.LastPage.Enabled = True + ElseIf Me._TotalPages = 0 ' if the total pages is determined and it is 0, enable last and next buttons + Me.PersonalEducationPagination.LastPage.Enabled = False + Else ' if the total pages is the last page, disable last and next buttons + Me.PersonalEducationPagination.LastPage.Enabled = Not (Me.PageIndex = Me.TotalPages - 1) + End If + + If Me._TotalPages < 0 Then ' if the total pages is not determined yet, enable last and next buttons + Me.PersonalEducationPagination.NextPage.Enabled = True + ElseIf Me._TotalPages = 0 ' if the total pages is determined and it is 0, enable last and next buttons + Me.PersonalEducationPagination.NextPage.Enabled = False + Else ' if the total pages is the last page, disable last and next buttons + Me.PersonalEducationPagination.NextPage.Enabled = Not (Me.PageIndex = Me.TotalPages - 1) + End If + + Me.PersonalEducationPagination.PreviousPage.Enabled = Not (Me.PageIndex = 0) + + + End Sub + + Public Overridable Sub SaveData() + ' Save the data from the entire table. Calls each row's Save Data + ' to save their data. This function is called by the Click handler of the + ' Save button. The button handler should Start/Commit/End a transaction. + + Dim recCtl As PersonalEducationTableControlRow + For Each recCtl In Me.GetRecordControls() + + If Me.InDeletedRecordIds(recCtl) Then + ' Delete any pending deletes. + recCtl.Delete() + Else + If recCtl.Visible Then + recCtl.SaveData() + End If + End If + + Next + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + ' Set IsNewRecord to False for all records - since everything has been saved and is no longer "new" + For Each recCtl In Me.GetRecordControls() + recCtl.IsNewRecord = False + Next + + + ' Set DeletedRecordsIds to Nothing since we have deleted all pending deletes. + Me.DeletedRecordIds = Nothing + + End Sub + + Public Overridable Function CreateCompoundJoinFilter() As CompoundFilter + Dim jFilter As CompoundFilter = New CompoundFilter() + + Return jFilter + + End Function + + + Public Overridable Function CreateOrderBy() As OrderBy + ' The CurrentSortOrder is initialized to the sort order on the + ' Query Wizard. It may be modified by the Click handler for any of + ' the column heading to sort or reverse sort by that column. + ' You can add your own sort order, or modify it on the Query Wizard. + Return Me.CurrentSortOrder + End Function + + Public Overridable Function CreateWhereClause() As WhereClause + 'This CreateWhereClause is used for loading the data. + PersonalEducationTable.Instance.InnerFilter = Nothing + Dim wc As WhereClause = New WhereClause() + + ' Compose the WHERE clause consiting of: + ' 1. Static clause defined at design time. + ' 2. User selected search criteria. + ' 3. User selected filter criteria. + + + Dim selectedRecordKeyValue as KeyValue = New KeyValue() + + Dim personalIdRecordControlObj As Persons.UI.Controls.EditPersonalId.PersonalIdRecordControl = DirectCast(MiscUtils.FindControlRecursively(Me.Page, "PersonalIdRecordControl"), Persons.UI.Controls.EditPersonalId.PersonalIdRecordControl) + + If (Not IsNothing(personalIdRecordControlObj) AndAlso Not IsNothing(personalIdRecordControlObj.GetRecord()) AndAlso personalIdRecordControlObj.GetRecord().IsCreated AndAlso Not IsNothing(personalIdRecordControlObj.GetRecord().PersonalId)) + wc.iAND(PersonalEducationTable.PersonalId, BaseFilter.ComparisonOperator.EqualsTo, personalIdRecordControlObj.GetRecord().PersonalId.ToString()) + selectedRecordKeyValue.AddElement(PersonalEducationTable.PersonalId.InternalName, personalIdRecordControlObj.GetRecord().PersonalId.ToString()) + Else + wc.RunQuery = False + Return wc + End If + + HttpContext.Current.Session("PersonalEducationTableControlWhereClause") = selectedRecordKeyValue.ToXmlString() + + Return wc + End Function + + + Public Overridable Function CreateWhereClause(ByVal searchText as String, ByVal fromSearchControl as String, ByVal AutoTypeAheadSearch as String, ByVal AutoTypeAheadWordSeparators as String) As WhereClause + ' This CreateWhereClause is used for loading list of suggestions for Auto Type-Ahead feature. + PersonalEducationTable.Instance.InnerFilter = Nothing + Dim wc As WhereClause = New WhereClause() + + ' Compose the WHERE clause consiting of: + ' 1. Static clause defined at design time. + ' 2. User selected search criteria. + ' 3. User selected filter criteria. + + Dim appRelativeVirtualPath As String = CType(HttpContext.Current.Session("AppRelativeVirtualPath"), String) + + Dim selectedRecordInPersonalIdRecordControl as String = DirectCast(HttpContext.Current.Session("PersonalEducationTableControlWhereClause"), String) + + If Not selectedRecordInPersonalIdRecordControl Is Nothing AndAlso KeyValue.IsXmlKey(selectedRecordInPersonalIdRecordControl) Then + Dim selectedRecordKeyValue as KeyValue = KeyValue.XmlToKey(selectedRecordInPersonalIdRecordControl) + + If Not IsNothing(selectedRecordKeyValue) AndAlso selectedRecordKeyValue.ContainsColumn(PersonalEducationTable.PersonalId) Then + wc.iAND(PersonalEducationTable.PersonalId, BaseFilter.ComparisonOperator.EqualsTo, selectedRecordKeyValue.GetColumnValue(PersonalEducationTable.PersonalId).ToString()) + End If + + End If + + ' Adds clauses if values are selected in Filter controls which are configured in the page. + + + Return wc + End Function + + + Public Overridable Function FormatSuggestions(ByVal prefixText As String, ByVal resultItem As String, _ + ByVal columnLength As Integer, ByVal AutoTypeAheadDisplayFoundText As String, _ + ByVal autoTypeAheadSearch As String, ByVal AutoTypeAheadWordSeparators As String, _ + ByVal resultList As ArrayList) As Boolean + + 'Formats the resultItem and adds it to the list of suggestions. + Dim index As Integer = resultItem.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture).IndexOf(prefixText.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture)) + Dim itemToAdd As String = "" + Dim isFound As Boolean = False + Dim isAdded As Boolean = False + ' Get the index where prfixt is at the beginning of resultItem. If not found then, index of word which begins with prefixText. + If InvariantLCase(autoTypeAheadSearch).equals("wordsstartingwithsearchstring") And Not index = 0 Then + ' Expression to find word which contains AutoTypeAheadWordSeparators followed by prefixText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex( AutoTypeAheadWordSeparators + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + If regex1.IsMatch(resultItem) Then + index = regex1.Match(resultItem).Index + isFound = True + End If + ' If the prefixText is found immediatly after white space then starting of the word is found so don not search any further + If not resultItem(index).ToString() = " " Then + ' Expression to find beginning of the word which contains AutoTypeAheadWordSeparators followed by prefixText + Dim regex As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\\S*" + AutoTypeAheadWordSeparators + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + If regex.IsMatch(resultItem) Then + index = regex.Match(resultItem).Index + isFound = True + End If + End If + End If + + ' If autoTypeAheadSearch value is wordsstartingwithsearchstring then, extract the substring only if the prefixText is found at the + ' beginning of the resultItem (index = 0) or a word in resultItem is found starts with prefixText. + If index = 0 Or isFound Or InvariantLCase(autoTypeAheadSearch).Equals("anywhereinstring") then + If InvariantLCase(AutoTypeAheadDisplayFoundText).equals("atbeginningofmatchedstring") Then + ' Expression to find beginning of the word which contains prefixText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\\S*" + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + ' Find the beginning of the word which contains prefexText + If (StringUtils.InvariantLCase(autoTypeAheadSearch).Equals("anywhereinstring") AndAlso regex1.IsMatch(resultItem)) Then + index = regex1.Match(resultItem).Index + isFound = True + End If + ' Display string from the index till end of the string if sub string from index till end is less than columnLength value. + If Len(resultItem) - index <= columnLength Then + If index = 0 Then + itemToAdd = resultItem + Else + itemToAdd = "..." & resultItem.Substring(index, Len(resultItem) - index) + End If + Else + If index = 0 Then + itemToAdd = resultItem.Substring(index, (columnLength - 3)) & "..." + Else + 'Truncate the string to show only columnLength - 6 characters as begining and trailing "..." has to be appended. + itemToAdd = "..." & resultItem.Substring(index , columnLength - 6) & "..." + End If + End If + ElseIf InvariantLCase(AutoTypeAheadDisplayFoundText).equals("inmiddleofmatchedstring") Then + Dim subStringBeginIndex As Integer = CType(columnLength/2, Integer) + If Len(resultItem) <= columnLength Then + itemToAdd = resultItem + Else + ' Sanity check at end of the string + If index + Len(prefixText) = columnLength Then + itemToAdd = "..." & resultItem.Substring(index-columnLength,index) + ElseIf Len(resultItem) - index < subStringBeginIndex Then + ' Display string from the end till columnLength value if, index is closer to the end of the string. + itemToAdd = "..." & resultItem.Substring(Len(resultItem)-columnLength,Len(resultItem)) + ElseIf index <= subStringBeginIndex Then + ' Sanity chet at beginning of the string + itemToAdd = resultItem.Substring(0, columnLength) & "..." + Else + ' Display string containing text before the prefixText occures and text after the prefixText + itemToAdd = "..." & resultItem.Substring(index - subStringBeginIndex, columnLength) & "..." + End If + End If + ElseIf InvariantLCase(AutoTypeAheadDisplayFoundText).equals("atendofmatchedstring") Then + ' Expression to find ending of the word which contains prefexText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\s", System.Text.RegularExpressions.RegexOptions.IgnoreCase) + ' Find the ending of the word which contains prefexText + If regex1.IsMatch(resultItem, index + 1) Then + index = regex1.Match(resultItem, index + 1).Index + Else + ' If the word which contains prefexText is the last word in string, regex1.IsMatch returns false. + index = resultItem.Length + End If + If index > Len(resultItem) Then + index = Len(resultItem) + End If + ' If text from beginning of the string till index is less than columnLength value then, display string from the beginning till index. + If index <= columnLength Then + if index = Len(resultItem) Then 'Make decision to append "..." + itemToAdd = resultItem.Substring(0,index) + Else + itemToAdd = resultItem.Substring(0,index) & "..." + End If + Else + If index = Len(resultItem) Then + itemToAdd = "..." & resultItem.Substring(index - (columnLength - 3), (columnLength - 3)) + Else + 'Truncate the string to show only columnLength - 6 characters as begining and trailing "..." has to be appended. + itemToAdd = "..." & resultItem.Substring(index - (columnLength - 6), columnLength - 6) & "..." + End If + End If + End If + + ' Remove newline character from itemToAdd + Dim prefixTextIndex As Integer = itemToAdd.IndexOf(prefixText, StringComparison.CurrentCultureIgnoreCase) + ' If itemToAdd contains any newline after the search text then show text only till newline + Dim regex2 As System.Text.RegularExpressions.Regex = New System.Text.RegularExpressions.Regex("(" & vbCrLf & "|" & vbLf & ")", System.Text.RegularExpressions.RegexOptions.IgnoreCase) + Dim newLineIndexAfterPrefix As Integer = -1 + If regex2.IsMatch(itemToAdd, prefixTextIndex) Then + newLineIndexAfterPrefix = regex2.Match(itemToAdd, prefixTextIndex).Index + End If + If (newLineIndexAfterPrefix > -1) Then + If itemToAdd.EndsWith("...") Then + itemToAdd = (itemToAdd.Substring(0, newLineIndexAfterPrefix) + "...") + Else + itemToAdd = itemToAdd.Substring(0, newLineIndexAfterPrefix) + End If + End If + ' If itemToAdd contains any newline before search text then show text which comes after newline + Dim regex3 As System.Text.RegularExpressions.Regex = New System.Text.RegularExpressions.Regex("(" & vbCrLf & "|" & vbLf & ")", (System.Text.RegularExpressions.RegexOptions.IgnoreCase Or System.Text.RegularExpressions.RegexOptions.RightToLeft)) + Dim newLineIndexBeforePrefix As Integer = -1 + If regex3.IsMatch(itemToAdd, prefixTextIndex) Then + newLineIndexBeforePrefix = regex3.Match(itemToAdd, prefixTextIndex).Index + End If + If (newLineIndexBeforePrefix > -1) Then + If itemToAdd.StartsWith("...") Then + itemToAdd = ("..." + itemToAdd.Substring((newLineIndexBeforePrefix + regex3.Match(itemToAdd, prefixTextIndex).Length))) + Else + itemToAdd = itemToAdd.Substring((newLineIndexBeforePrefix + regex3.Match(itemToAdd, prefixTextIndex).Length)) + End If + End If + + If Not itemToAdd is nothing AndAlso Not resultList.Contains(itemToAdd) Then + + resultList.Add(itemToAdd) + + isAdded = true + End If + End If + Return isAdded + End Function + + + Protected Overridable Sub GetPageSize() + + If Me.PersonalEducationPagination.PageSize.Text.Trim <> "" Then + Try + 'Me.PageSize = Integer.Parse(Me.PersonalEducationPagination.PageSize.Text) + Catch ex As Exception + End Try + End If + End Sub + + Protected Overridable Sub AddNewRecords() + + Dim newRecordList As ArrayList = New ArrayList() + + Dim newUIDataList As System.Collections.Generic.List(Of Hashtable) = New System.Collections.Generic.List(Of Hashtable)() + + ' Loop though all the record controls and if the record control + ' does not have a unique record id set, then create a record + ' and add to the list. + If Not Me.ResetData Then + Dim rep As System.Web.UI.WebControls.Repeater = CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalEducationTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return + + Dim repItem As System.Web.UI.WebControls.RepeaterItem + For Each repItem In rep.Items + ' Loop through all rows in the table, set its DataSource and call DataBind(). + + Dim recControl As PersonalEducationTableControlRow = DirectCast(repItem.FindControl("PersonalEducationTableControlRow"), PersonalEducationTableControlRow) + + If recControl.Visible AndAlso recControl.IsNewRecord() Then + + Dim rec As PersonalEducationRecord = New PersonalEducationRecord() + + If recControl.Command.Text <> "" Then + rec.Parse(recControl.Command.Text, PersonalEducationTable.Command) + End If + If recControl.CommandDate.Text <> "" Then + rec.Parse(recControl.CommandDate.Text, PersonalEducationTable.CommandDate) + End If + If MiscUtils.IsValueSelected(recControl.COUNTRY) Then + rec.Parse(recControl.COUNTRY.SelectedItem.Value, PersonalEducationTable.COUNTRY) + End If + If recControl.Course.Text <> "" Then + rec.Parse(recControl.Course.Text, PersonalEducationTable.Course) + End If + If recControl.CourseAbbr.Text <> "" Then + rec.Parse(recControl.CourseAbbr.Text, PersonalEducationTable.CourseAbbr) + End If + If recControl.CourseNo.Text <> "" Then + rec.Parse(recControl.CourseNo.Text, PersonalEducationTable.CourseNo) + End If + If MiscUtils.IsValueSelected(recControl.EducationPeriod) Then + rec.Parse(recControl.EducationPeriod.SelectedItem.Value, PersonalEducationTable.EducationPeriod) + End If + If recControl.EdYear.Text <> "" Then + rec.Parse(recControl.EdYear.Text, PersonalEducationTable.EdYear) + End If + If recControl.EndDate1.Text <> "" Then + rec.Parse(recControl.EndDate1.Text, PersonalEducationTable.EndDate) + End If + If recControl.Facultry.Text <> "" Then + rec.Parse(recControl.Facultry.Text, PersonalEducationTable.Facultry) + End If + If recControl.Institue.Text <> "" Then + rec.Parse(recControl.Institue.Text, PersonalEducationTable.Institue) + End If + If MiscUtils.IsValueSelected(recControl.LevelId) Then + rec.Parse(recControl.LevelId.SelectedItem.Value, PersonalEducationTable.LevelId) + End If + If recControl.NoAll.Text <> "" Then + rec.Parse(recControl.NoAll.Text, PersonalEducationTable.NoAll) + End If + If recControl.Score.Text <> "" Then + rec.Parse(recControl.Score.Text, PersonalEducationTable.Score) + End If + If recControl.ScoreNo.Text <> "" Then + rec.Parse(recControl.ScoreNo.Text, PersonalEducationTable.ScoreNo) + End If + If recControl.StartDate1.Text <> "" Then + rec.Parse(recControl.StartDate1.Text, PersonalEducationTable.StartDate) + End If + newUIDataList.Add(recControl.PreservedUIData()) + newRecordList.Add(rec) + End If + Next + End If + + + ' Add any new record to the list. + Dim index As Integer = 0 + For index = 1 To Me.AddNewRecord + + newRecordList.Insert(0, New PersonalEducationRecord()) + newUIDataList.Insert(0, New Hashtable()) + + Next + Me.AddNewRecord = 0 + + ' Finally, add any new records to the DataSource. + If newRecordList.Count > 0 Then + + Dim finalList As ArrayList = New ArrayList(Me.DataSource) + finalList.InsertRange(0, newRecordList) + + Me.DataSource = DirectCast(finalList.ToArray(GetType(PersonalEducationRecord)), PersonalEducationRecord()) + + End If + + ' Add the existing UI data to this hash table + If newUIDataList.Count > 0 Then + Me.UIData.InsertRange(0, newUIDataList) + End If + + End Sub + + + Public Sub AddToDeletedRecordIds(ByVal rec As PersonalEducationTableControlRow) + If rec.IsNewRecord() Then + Return + End If + + If Not Me.DeletedRecordIds Is Nothing AndAlso Me.DeletedRecordIds.Trim <> "" Then + Me.DeletedRecordIds &= "," + End If + + Me.DeletedRecordIds &= "[" & rec.RecordUniqueId & "]" + End Sub + + Protected Overridable Function InDeletedRecordIds(ByVal rec As PersonalEducationTableControlRow) As Boolean + If Me.DeletedRecordIds Is Nothing OrElse Me.DeletedRecordIds.Trim = "" Then + Return False + End If + + Return Me.DeletedRecordIds.IndexOf("[" & rec.RecordUniqueId & "]") >= 0 + End Function + + Private _DeletedRecordIds As String + Public Property DeletedRecordIds() As String + Get + Return Me._DeletedRecordIds + End Get + Set(ByVal value As String) + Me._DeletedRecordIds = value + End Set + End Property + + + ' Create Set, WhereClause, and Populate Methods + + Public Overridable Sub SetCommandDateLabel() + + End Sub + + Public Overridable Sub SetCommandLabel() + + End Sub + + Public Overridable Sub SetCOUNTRYLabel1() + + End Sub + + Public Overridable Sub SetCourseAbbrLabel() + + End Sub + + Public Overridable Sub SetCourseLabel() + + End Sub + + Public Overridable Sub SetCourseNoLabel() + + End Sub + + Public Overridable Sub SetEducationPeriodLabel() + + End Sub + + Public Overridable Sub SetEdYearLabel() + + End Sub + + Public Overridable Sub SetEndDateLabel2() + + End Sub + + Public Overridable Sub SetFacultryLabel() + + End Sub + + Public Overridable Sub SetInstitueLabel() + + End Sub + + Public Overridable Sub SetLevelIdLabel1() + + End Sub + + Public Overridable Sub SetNoAllLabel() + + End Sub + + Public Overridable Sub SetPersonalEducationTableControlCollapsibleRegion() + + End Sub + + Public Overridable Sub SetScoreLabel() + + End Sub + + Public Overridable Sub SetScoreNoLabel() + + End Sub + + Public Overridable Sub SetStartDateLabel2() + + 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. + Dim added As Boolean = Me.AddNewRecord > 0 + Me.LoadData() + Me.DataBind() + + If added Then + Me.SetFocusToAddedRow() + End If + + End If + + + + Catch ex As Exception + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + Finally + DbUtils.EndTransaction + End Try + End Sub + + 'this function sets focus to the first editable element in the new added row in the editable table + Protected Overridable Sub SetFocusToAddedRow() + Dim rep As System.Web.UI.WebControls.Repeater = CType(Me.FindControl("PersonalEducationTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing OrElse rep.Items.Count = 0 Then Return + Dim repItem As System.Web.UI.WebControls.RepeaterItem + For Each repItem In rep.Items + 'Load scripts to table rows + Me.Page.LoadFocusScripts(repItem) + Dim recControl As PersonalEducationTableControlRow = DirectCast(repItem.FindControl("PersonalEducationTableControlRow"), PersonalEducationTableControlRow) + If recControl.IsNewRecord Then + For Each field As Control In recControl.Controls + If field.Visible AndAlso Me.Page.IsControlEditable(field, False) Then + 'set focus on the first editable field in the new row + field.Focus() + Dim updPan As UpdatePanel = DirectCast(Me.Page.FindControlRecursively("UpdatePanel1"), UpdatePanel) + If Not updPan Is Nothing Then updPan.Update() + Return + End If + Next + Return + End If + Next + End Sub + + + Protected Overrides Sub SaveControlsToSession() + MyBase.SaveControlsToSession() + + ' Save filter controls to values to session. + + + 'Save pagination state to session. + + + + ' Save table control properties to the session. + If Not Me.CurrentSortOrder Is Nothing Then + Me.SaveToSession(Me, "Order_By", Me.CurrentSortOrder.ToXmlString()) + End If + + Me.SaveToSession(Me, "Page_Index", Me.PageIndex.ToString()) + Me.SaveToSession(Me, "Page_Size", Me.PageSize.ToString()) + + Me.SaveToSession(Me, "DeletedRecordIds", Me.DeletedRecordIds) + + End Sub + + Protected Sub SaveControlsToSession_Ajax() + ' Save filter controls to values to session. + + HttpContext.Current.Session("AppRelativeVirtualPath") = Me.Page.AppRelativeVirtualPath + + End Sub + + Protected Overrides Sub ClearControlsFromSession() + MyBase.ClearControlsFromSession() + + ' Clear filter controls values from the session. + + + ' Clear pagination state from session. + + + + ' Clear table properties from the session. + Me.RemoveFromSession(Me, "Order_By") + Me.RemoveFromSession(Me, "Page_Index") + Me.RemoveFromSession(Me, "Page_Size") + + Me.RemoveFromSession(Me, "DeletedRecordIds") + + End Sub + + Protected Overrides Sub LoadViewState(ByVal savedState As Object) + MyBase.LoadViewState(savedState) + + Dim orderByStr As String = CType(ViewState("PersonalEducationTableControl_OrderBy"), String) + + If orderByStr IsNot Nothing AndAlso orderByStr.Trim <> "" Then + Me.CurrentSortOrder = BaseClasses.Data.OrderBy.FromXmlString(orderByStr) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + End If + + Dim pageIndex As String = CType(ViewState("Page_Index"), String) + If pageIndex IsNot Nothing Then + Me.PageIndex = CInt(pageIndex) + End If + + Dim pageSize As String = CType(ViewState("Page_Size"), String) + If Not pageSize Is Nothing Then + Me.PageSize = CInt(pageSize) + End If + + + + ' Load view state for pagination control. + + Me.DeletedRecordIds = CType(Me.ViewState("DeletedRecordIds"), String) + + End Sub + + Protected Overrides Function SaveViewState() As Object + + If Me.CurrentSortOrder IsNot Nothing Then + Me.ViewState("PersonalEducationTableControl_OrderBy") = Me.CurrentSortOrder.ToXmlString() + End If + + Me.ViewState("Page_Index") = Me.PageIndex + Me.ViewState("Page_Size") = Me.PageSize + + Me.ViewState("DeletedRecordIds") = Me.DeletedRecordIds + + + ' Load view state for pagination control. + + + Return MyBase.SaveViewState() + End Function + + ' Generate the event handling functions for pagination events. + + ' event handler for ImageButton + Public Overridable Sub PersonalEducationPagination_FirstPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.PageIndex = 0 + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalEducationPagination_LastPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.DisplayLastPage = True + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalEducationPagination_NextPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.PageIndex += 1 + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for LinkButton + Public Overridable Sub PersonalEducationPagination_PageSizeButton_Click(ByVal sender As Object, ByVal args As EventArgs) + + Try + + Me.DataChanged = True + + Me.PageSize = Integer.Parse(Me.PersonalEducationPagination.PageSize.Text) + + Me.PageIndex = Integer.Parse(Me.PersonalEducationPagination.CurrentPage.Text) - 1 + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalEducationPagination_PreviousPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + If Me.PageIndex > 0 Then + Me.PageIndex -= 1 + Me.DataChanged = True + End If + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + + ' Generate the event handling functions for sorting events. + + Public Overridable Sub CommandDateLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by CommandDate when clicked. + + ' Get previous sorting state for CommandDate. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalEducationTable.CommandDate) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for CommandDate. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalEducationTable.CommandDate, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by CommandDate, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub CommandLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by Command when clicked. + + ' Get previous sorting state for Command. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalEducationTable.Command) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for Command. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalEducationTable.Command, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by Command, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub COUNTRYLabel1_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by COUNTRY when clicked. + + ' Get previous sorting state for COUNTRY. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalEducationTable.COUNTRY) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for COUNTRY. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalEducationTable.COUNTRY, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by COUNTRY, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub CourseAbbrLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by CourseAbbr when clicked. + + ' Get previous sorting state for CourseAbbr. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalEducationTable.CourseAbbr) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for CourseAbbr. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalEducationTable.CourseAbbr, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by CourseAbbr, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub CourseLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by Course when clicked. + + ' Get previous sorting state for Course. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalEducationTable.Course) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for Course. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalEducationTable.Course, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by Course, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub CourseNoLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by CourseNo when clicked. + + ' Get previous sorting state for CourseNo. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalEducationTable.CourseNo) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for CourseNo. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalEducationTable.CourseNo, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by CourseNo, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub EducationPeriodLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by EducationPeriod when clicked. + + ' Get previous sorting state for EducationPeriod. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalEducationTable.EducationPeriod) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for EducationPeriod. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalEducationTable.EducationPeriod, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by EducationPeriod, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub EdYearLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by EdYear when clicked. + + ' Get previous sorting state for EdYear. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalEducationTable.EdYear) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for EdYear. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalEducationTable.EdYear, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by EdYear, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub EndDateLabel2_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by EndDate when clicked. + + ' Get previous sorting state for EndDate. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalEducationTable.EndDate) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for EndDate. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalEducationTable.EndDate, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by EndDate, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub FacultryLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by Facultry when clicked. + + ' Get previous sorting state for Facultry. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalEducationTable.Facultry) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for Facultry. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalEducationTable.Facultry, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by Facultry, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub InstitueLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by Institue when clicked. + + ' Get previous sorting state for Institue. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalEducationTable.Institue) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for Institue. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalEducationTable.Institue, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by Institue, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub LevelIdLabel1_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by LevelId when clicked. + + ' Get previous sorting state for LevelId. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalEducationTable.LevelId) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for LevelId. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalEducationTable.LevelId, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by LevelId, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub NoAllLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by NoAll when clicked. + + ' Get previous sorting state for NoAll. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalEducationTable.NoAll) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for NoAll. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalEducationTable.NoAll, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by NoAll, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub ScoreLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by Score when clicked. + + ' Get previous sorting state for Score. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalEducationTable.Score) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for Score. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalEducationTable.Score, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by Score, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub ScoreNoLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by ScoreNo when clicked. + + ' Get previous sorting state for ScoreNo. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalEducationTable.ScoreNo) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for ScoreNo. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalEducationTable.ScoreNo, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by ScoreNo, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub StartDateLabel2_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by StartDate when clicked. + + ' Get previous sorting state for StartDate. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalEducationTable.StartDate) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for StartDate. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalEducationTable.StartDate, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by StartDate, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + + ' Generate the event handling functions for button events. + + ' event handler for ImageButton + Public Overridable Sub PersonalEducationAddButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + Me.AddNewRecord = 1 + Me.DataChanged = True + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalEducationDeleteButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + If(Not Me.Page.IsPageRefresh) Then + + Me.DeleteSelectedRecords(True) + Me.SetFormulaControls() + + + End If + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalEducationEditButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + ' The redirect URL is set on the Properties, Custom Properties or Actions. + ' The ModifyRedirectURL call resolves the parameters before the + ' Response.Redirect redirects the page to the URL. + ' Any code after the Response.Redirect call will not be executed, since the page is + ' redirected to the URL. + + + Dim url As String = "../PersonalEducation/EditPersonalEducation.aspx?PersonalEducation={PK}" + + Dim shouldRedirect As Boolean = True + Dim TargetKey As String = Nothing + Dim DFKA As String = TargetKey + Dim id As String = DFKA + Dim value As String = id + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + url = Me.ModifyRedirectUrl(url, "",False) + url = Me.Page.ModifyRedirectUrl(url, "",False) + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + shouldRedirect = False + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + If shouldRedirect Then + Me.Page.ShouldSaveControlsToSession = True + Me.Page.Response.Redirect(url) + ElseIf Not TargetKey Is Nothing AndAlso _ + Not shouldRedirect Then + Me.Page.ShouldSaveControlsToSession = True + Me.Page.CloseWindow(True) + + End If + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalEducationResetButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.CurrentSortOrder.Reset() + If Me.InSession(Me, "Order_By") Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + Me.CurrentSortOrder.Add(PersonalEducationTable.EducationPeriod, OrderByItem.OrderDir.Asc) + + Me.CurrentSortOrder.Add(PersonalEducationTable.StartDate, OrderByItem.OrderDir.Asc) + + + End If + + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + + + ' Generate the event handling functions for filter and search events. + + + ' Generate the event handling functions for others + + + Private _UIData As New System.Collections.Generic.List(Of Hashtable) + Public Property UIData() As System.Collections.Generic.List(Of Hashtable) + Get + Return Me._UIData + End Get + Set(ByVal value As System.Collections.Generic.List(Of Hashtable)) + Me._UIData = value + End Set + End Property + + ' pagination properties + Protected _PageSize As Integer + Public Property PageSize() As Integer + Get + Return Me._PageSize + End Get + Set(ByVal value As Integer) + Me._PageSize = value + End Set + End Property + + Protected _PageIndex As Integer + Public Property PageIndex() As Integer + Get + ' Return the PageIndex + Return Me._PageIndex + End Get + Set(ByVal value As Integer) + Me._PageIndex = value + End Set + End Property + + Protected _TotalRecords As Integer = -1 + Public Property TotalRecords() As Integer + Get + If _TotalRecords < 0 + _TotalRecords = PersonalEducationTable.GetRecordCount(CreateCompoundJoinFilter(), CreateWhereClause()) + End If + Return Me._TotalRecords + End Get + Set(ByVal value As Integer) + If Me.PageSize > 0 Then + + Me.TotalPages = CInt(Math.Ceiling(value / Me.PageSize)) + + End If + Me._TotalRecords = value + End Set + End Property + + + + Protected _TotalPages As Integer = -1 + Public Property TotalPages() As Integer + Get + If _TotalPages < 0 Then + + Me.TotalPages = CInt(Math.Ceiling(TotalRecords / Me.PageSize)) + + End If + Return Me._TotalPages + End Get + Set(ByVal value As Integer) + Me._TotalPages = value + End Set + End Property + + Protected _DisplayLastPage As Boolean + Public Property DisplayLastPage() As Boolean + Get + Return Me._DisplayLastPage + End Get + Set(ByVal value As Boolean) + Me._DisplayLastPage = value + End Set + End Property + + Private _DataChanged As Boolean = False + Public Property DataChanged() As Boolean + Get + Return Me._DataChanged + End Get + Set(ByVal value As Boolean) + Me._DataChanged = value + End Set + End Property + + Private _ResetData As Boolean = False + Public Property ResetData() As Boolean + Get + Return Me._ResetData + End Get + Set(ByVal value As Boolean) + Me._ResetData = value + End Set + End Property + + Private _AddNewRecord As Integer = 0 + Public Property AddNewRecord() As Integer + Get + Return Me._AddNewRecord + End Get + Set(ByVal value As Integer) + Me._AddNewRecord = value + End Set + End Property + + + Private _CurrentSortOrder As OrderBy = Nothing + Public Property CurrentSortOrder() As OrderBy + Get + Return Me._CurrentSortOrder + End Get + Set(ByVal value As BaseClasses.Data.OrderBy) + Me._CurrentSortOrder = value + End Set + End Property + + Private _DataSource() As PersonalEducationRecord = Nothing + Public Property DataSource() As PersonalEducationRecord () + Get + Return Me._DataSource + End Get + Set(ByVal value() As PersonalEducationRecord) + Me._DataSource = value + End Set + End Property + +#Region "Helper Properties" + + Public ReadOnly Property CommandDateLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "CommandDateLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property CommandLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "CommandLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property COUNTRYLabel1() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "COUNTRYLabel1"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property CourseAbbrLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "CourseAbbrLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property CourseLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "CourseLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property CourseNoLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "CourseNoLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property EducationPeriodLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "EducationPeriodLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property EdYearLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "EdYearLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property EndDateLabel2() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "EndDateLabel2"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property FacultryLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "FacultryLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property InstitueLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "InstitueLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property LevelIdLabel1() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "LevelIdLabel1"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property NoAllLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "NoAllLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property PersonalEducationAddButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalEducationAddButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalEducationDeleteButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalEducationDeleteButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalEducationEditButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalEducationEditButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalEducationPagination() As Persons.UI.IPagination + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalEducationPagination"), Persons.UI.IPagination) + End Get + End Property + + Public ReadOnly Property PersonalEducationResetButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalEducationResetButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalEducationTableControlCollapsibleRegion() As System.Web.UI.WebControls.Panel + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalEducationTableControlCollapsibleRegion"), System.Web.UI.WebControls.Panel) + End Get + End Property + + Public ReadOnly Property PersonalEducationToggleAll() As System.Web.UI.WebControls.CheckBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalEducationToggleAll"), System.Web.UI.WebControls.CheckBox) + End Get + End Property + + Public ReadOnly Property ScoreLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "ScoreLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property ScoreNoLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "ScoreNoLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property StartDateLabel2() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "StartDateLabel2"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + +#End Region + +#Region "Helper Functions" + + Public Overrides Overloads Function ModifyRedirectUrl(url As String, arg As String, ByVal bEncrypt As Boolean) As String + Return Me.Page.EvaluateExpressions(url, arg, bEncrypt, Me) + End Function + + Public Overrides Overloads Function EvaluateExpressions(url As String, arg As String, ByVal bEncrypt As Boolean) As String + Dim needToProcess As Boolean = AreAnyUrlParametersForMe(url, arg) + If (needToProcess) Then + Dim recCtl As PersonalEducationTableControlRow = Me.GetSelectedRecordControl() + If recCtl Is Nothing AndAlso url.IndexOf("{") >= 0 Then + ' Localization. + Throw New Exception(Page.GetResourceValue("Err:NoRecSelected", "Persons")) + End If + Dim rec As PersonalEducationRecord = Nothing + If recCtl IsNot Nothing Then + rec = recCtl.GetRecord() + End If + Return EvaluateExpressions(url, arg, rec, bEncrypt) + End If + Return url + End Function + + Public Overridable Function GetSelectedRecordIndex() As Integer + Dim counter As Integer = 0 + Dim recControl As PersonalEducationTableControlRow + For Each recControl In Me.GetRecordControls() + If recControl.PersonalEducationRecordRowSelection.Checked Then + Return counter + End If + counter += 1 + Next + Return -1 + End Function + + Public Overridable Function GetSelectedRecordControl() As PersonalEducationTableControlRow + Dim selectedList() As PersonalEducationTableControlRow = Me.GetSelectedRecordControls() + If selectedList.Length = 0 Then + Return Nothing + End If + Return selectedList(0) + + End Function + + Public Overridable Function GetSelectedRecordControls() As PersonalEducationTableControlRow() + + Dim selectedList As ArrayList = New ArrayList(25) + Dim recControl As PersonalEducationTableControlRow + For Each recControl In Me.GetRecordControls() + If recControl.PersonalEducationRecordRowSelection IsNot Nothing AndAlso recControl.PersonalEducationRecordRowSelection.Checked Then + selectedList.Add(recControl) + End If + Next + Return DirectCast(selectedList.ToArray(GetType(PersonalEducationTableControlRow)), PersonalEducationTableControlRow()) + + End Function + + Public Overridable Sub DeleteSelectedRecords(ByVal deferDeletion As Boolean) + Dim recList() As PersonalEducationTableControlRow = Me.GetSelectedRecordControls() + If recList.Length = 0 Then + ' Localization. + Throw New Exception(Page.GetResourceValue("Err:NoRecSelected", "Persons")) + End If + + Dim recCtl As PersonalEducationTableControlRow + For Each recCtl In recList + If deferDeletion Then + If Not recCtl.IsNewRecord Then + + Me.AddToDeletedRecordIds(recCtl) + + End If + recCtl.Visible = False + + recCtl.PersonalEducationRecordRowSelection.Checked = False + + Else + + recCtl.Delete() + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + End If + Next + End Sub + + Public Function GetRecordControls() As PersonalEducationTableControlRow() + Dim recList As ArrayList = New ArrayList() + Dim rep As System.Web.UI.WebControls.Repeater = CType(Me.FindControl("PersonalEducationTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return Nothing + Dim repItem As System.Web.UI.WebControls.RepeaterItem + + For Each repItem In rep.Items + + Dim recControl As PersonalEducationTableControlRow = DirectCast(repItem.FindControl("PersonalEducationTableControlRow"), PersonalEducationTableControlRow) + recList.Add(recControl) + + Next + + Return DirectCast(recList.ToArray(GetType(PersonalEducationTableControlRow)), PersonalEducationTableControlRow()) + End Function + + Public Shadows ReadOnly Property Page() As BaseApplicationPage + Get + Return DirectCast(MyBase.Page, BaseApplicationPage) + End Get + End Property + +#End Region + + + +End Class + + +' Base class for the PersonalExtWorkTableControlRow control on the EditPersonalId page. +' Do not modify this class. Instead override any method in PersonalExtWorkTableControlRow. +Public Class BasePersonalExtWorkTableControlRow + Inherits Persons.UI.BaseApplicationRecordControl + + ' To customize, override this method in PersonalExtWorkTableControlRow. + Protected Overridable Sub Control_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Init + + Me.ClearControlsFromSession() + End Sub + + ' To customize, override this method in PersonalExtWorkTableControlRow. + Protected Overridable Sub Control_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load + + 'Call LoadFocusScripts from repeater so that onfocus attribute could be added to elements + Me.Page.LoadFocusScripts(Me) + + ' Show confirmation message on Click + Me.PersonalExtWorkRowDeleteButton.Attributes.Add("onClick", "return (confirm('" & (CType(Me.Page,BaseApplicationPage)).GetResourceValue("DeleteRecordConfirm", "Persons") & "'));") + + + ' Register the event handlers. + + AddHandler Me.PersonalExtWorkRowDeleteButton.Click, AddressOf PersonalExtWorkRowDeleteButton_Click + + AddHandler Me.PersonalExtWorkRowEditButton.Click, AddressOf PersonalExtWorkRowEditButton_Click + + AddHandler Me.PersonalExtWorkRowViewButton.Click, AddressOf PersonalExtWorkRowViewButton_Click + + AddHandler Me.Active.CheckedChanged, AddressOf Active_CheckedChanged + + AddHandler Me.BeginDate.TextChanged, AddressOf BeginDate_TextChanged + + AddHandler Me.Command1.TextChanged, AddressOf Command1_TextChanged + + AddHandler Me.CommandDate1.TextChanged, AddressOf CommandDate1_TextChanged + + AddHandler Me.Description.TextChanged, AddressOf Description_TextChanged + + AddHandler Me.EndDate2.TextChanged, AddressOf EndDate2_TextChanged + + AddHandler Me.Place.TextChanged, AddressOf Place_TextChanged + + + End Sub + + + Public Overridable Sub LoadData() + + ' Load the data from the database into the DataSource PersonalExtWork 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 = PersonalExtWorkTable.GetRecord(Me.RecordUniqueId, True) + + Return + End If + + ' Since this is a row in the table, the data for this row is loaded by the + ' LoadData method of the BasePersonalExtWorkTableControl when the data for the entire + ' table is loaded. + + Me.DataSource = New PersonalExtWorkRecord() + + + + End Sub + + ' Populate the UI controls using the DataSource. To customize, override this method in PersonalExtWorkTableControlRow. + 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 + + SetActive() + SetBeginDate() + SetCommand1() + SetCommandDate1() + SetDescription() + SetEndDate2() + + + + + SetPlace() + + + 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 SetActive() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.Active.ID) Then + Me.Active.Checked = Convert.ToBoolean(Me.PreviousUIData(Me.Active.ID)) + Return + End If + + + ' Set the Active CheckBox on the webpage with value from the + ' PersonalExtWork database record. + + ' Me.DataSource is the PersonalExtWork record retrieved from the database. + ' Me.Active is the ASP:CheckBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetActive() + ' and add your own code before or after the call to the MyBase function. + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.ActiveSpecified Then + + ' If the Active is non-NULL, then format the value. + ' The Format method will use the Display Format + Me.Active.Checked = Me.DataSource.Active + Else + + ' Active is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + If Not Me.DataSource.IsCreated Then + Me.Active.Checked = PersonalExtWorkTable.Active.ParseValue(PersonalExtWorkTable.Active.DefaultValue).ToBoolean() + End If + + End If + + End Sub + + Public Overridable Sub SetBeginDate() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.BeginDate.ID) Then + + Me.BeginDate.Text = Me.PreviousUIData(Me.BeginDate.ID).ToString() + + Return + End If + + + ' Set the BeginDate TextBox on the webpage with value from the + ' PersonalExtWork database record. + + ' Me.DataSource is the PersonalExtWork record retrieved from the database. + ' Me.BeginDate is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetBeginDate() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.BeginDateSpecified Then + + ' If the BeginDate is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalExtWorkTable.BeginDate, "d MMM yy") + + Me.BeginDate.Text = formattedValue + + Else + + ' BeginDate is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.BeginDate.Text = PersonalExtWorkTable.BeginDate.Format(PersonalExtWorkTable.BeginDate.DefaultValue, "d MMM yy") + + End If + + End Sub + + Public Overridable Sub SetCommand1() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.Command1.ID) Then + + Me.Command1.Text = Me.PreviousUIData(Me.Command1.ID).ToString() + + Return + End If + + + ' Set the Command TextBox on the webpage with value from the + ' PersonalExtWork database record. + + ' Me.DataSource is the PersonalExtWork record retrieved from the database. + ' Me.Command1 is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetCommand1() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.CommandSpecified Then + + ' If the Command is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalExtWorkTable.Command) + + Me.Command1.Text = formattedValue + + Else + + ' Command is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.Command1.Text = PersonalExtWorkTable.Command.Format(PersonalExtWorkTable.Command.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetCommandDate1() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.CommandDate1.ID) Then + + Me.CommandDate1.Text = Me.PreviousUIData(Me.CommandDate1.ID).ToString() + + Return + End If + + + ' Set the CommandDate TextBox on the webpage with value from the + ' PersonalExtWork database record. + + ' Me.DataSource is the PersonalExtWork record retrieved from the database. + ' Me.CommandDate1 is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetCommandDate1() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.CommandDateSpecified Then + + ' If the CommandDate is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalExtWorkTable.CommandDate, "d MMM yy") + + Me.CommandDate1.Text = formattedValue + + Else + + ' CommandDate is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.CommandDate1.Text = PersonalExtWorkTable.CommandDate.Format(PersonalExtWorkTable.CommandDate.DefaultValue, "d MMM yy") + + End If + + End Sub + + Public Overridable Sub SetDescription() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.Description.ID) Then + + Me.Description.Text = Me.PreviousUIData(Me.Description.ID).ToString() + + Return + End If + + + ' Set the Description TextBox on the webpage with value from the + ' PersonalExtWork database record. + + ' Me.DataSource is the PersonalExtWork record retrieved from the database. + ' Me.Description is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetDescription() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.DescriptionSpecified Then + + ' If the Description is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalExtWorkTable.Description) + + Me.Description.Text = formattedValue + + Else + + ' Description is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.Description.Text = PersonalExtWorkTable.Description.Format(PersonalExtWorkTable.Description.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetEndDate2() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.EndDate2.ID) Then + + Me.EndDate2.Text = Me.PreviousUIData(Me.EndDate2.ID).ToString() + + Return + End If + + + ' Set the EndDate TextBox on the webpage with value from the + ' PersonalExtWork database record. + + ' Me.DataSource is the PersonalExtWork record retrieved from the database. + ' Me.EndDate2 is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetEndDate2() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.EndDateSpecified Then + + ' If the EndDate is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalExtWorkTable.EndDate, "d MMM yy") + + Me.EndDate2.Text = formattedValue + + Else + + ' EndDate is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.EndDate2.Text = PersonalExtWorkTable.EndDate.Format(PersonalExtWorkTable.EndDate.DefaultValue, "d MMM yy") + + End If + + End Sub + + Public Overridable Sub SetPlace() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.Place.ID) Then + + Me.Place.Text = Me.PreviousUIData(Me.Place.ID).ToString() + + Return + End If + + + ' Set the Place TextBox on the webpage with value from the + ' PersonalExtWork database record. + + ' Me.DataSource is the PersonalExtWork record retrieved from the database. + ' Me.Place is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetPlace() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.PlaceSpecified Then + + ' If the Place is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalExtWorkTable.Place) + + Me.Place.Text = formattedValue + + Else + + ' Place is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.Place.Text = PersonalExtWorkTable.Place.Format(PersonalExtWorkTable.Place.DefaultValue) + + End If + + End Sub + + + Public EvaluateFormulaDelegate As BaseClasses.Data.DataSource.EvaluateFormulaDelegate = New BaseClasses.Data.DataSource.EvaluateFormulaDelegate(AddressOf Me.EvaluateFormula) + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean, ByVal e As FormulaEvaluator) As String + If e Is Nothing Then + e = New FormulaEvaluator() + End If + + e.Variables.Clear() + + + ' add variables for formula evaluation + If variables IsNot Nothing Then + Dim enumerator As System.Collections.Generic.IEnumerator(Of System.Collections.Generic.KeyValuePair(Of String, Object)) = variables.GetEnumerator() + While enumerator.MoveNext() + e.Variables.Add(enumerator.Current.Key, enumerator.Current.Value) + End While + End If + + If includeDS + + End IF + + + ' Other variables referred to in the formula are expected to be + ' properties of the DataSource. For example, referring to + ' UnitPrice as a variable will refer to DataSource.UnitPrice + If dataSourceForEvaluate Is Nothing Then + + e.DataSource = Me.DataSource + + Else + e.DataSource = dataSourceForEvaluate + End If + + ' Define the calling control. This is used to add other + ' related table and record controls as variables. + e.CallingControl = Me + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + + If Not String.IsNullOrEmpty(format) AndAlso (String.IsNullOrEmpty(formula) OrElse formula.IndexOf("Format(") < 0) Then + Return FormulaUtils.Format(resultObj, format) + Else + Return resultObj.ToString() + End If + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format,variables ,includeDS, Nothing) + End Function + + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object)) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format, variables ,True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, format, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal e as FormulaEvaluator) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, variables, True, e) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal includeDS as Boolean) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, includeDS, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, True, Nothing) + End Function + + + Public Overridable Sub RegisterPostback() + + + End Sub + + + + ' To customize, override this method in PersonalExtWorkTableControlRow. + 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 parentCtrl As PersonalIdRecordControl + + + parentCtrl = DirectCast(Me.Page.FindControlRecursively("PersonalIdRecordControl"), PersonalIdRecordControl) + + If (Not IsNothing(parentCtrl) AndAlso IsNothing(parentCtrl.DataSource)) + ' Load the record if it is not loaded yet. + parentCtrl.LoadData() + End If + If (IsNothing(parentCtrl) OrElse IsNothing(parentCtrl.DataSource)) + ' Get the error message from the application resource file. + Throw New Exception(Page.GetResourceValue("Err:NoParentRecId", "Persons")) + End If + + Me.DataSource.PersonalId = parentCtrl.DataSource.PersonalId + + ' 2. Perform any custom validation. + Me.Validate() + + + ' 3. Set the values in the record with data from UI controls. + ' This calls the Get() method for each of the user interface controls. + Me.GetUIData() + + ' 4. Save in the database. + ' We should not save the record if the data did not change. This + ' will save a database hit and avoid triggering any database triggers. + + If Me.DataSource.IsAnyValueChanged Then + ' Save record to database but do not commit yet. + ' Auto generated ids are available after saving for use by child (dependent) records. + Me.DataSource.Save() + + DirectCast(GetParentControlObject(Me, "PersonalExtWorkTableControl"), PersonalExtWorkTableControl).DataChanged = True + DirectCast(GetParentControlObject(Me, "PersonalExtWorkTableControl"), PersonalExtWorkTableControl).ResetData = True + End If + + + ' update session or cookie by formula + + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + ' For Master-Detail relationships, save data on the Detail table(s) + + End Sub + + ' To customize, override this method in PersonalExtWorkTableControlRow. + 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. + + GetActive() + GetBeginDate() + GetCommand1() + GetCommandDate1() + GetDescription() + GetEndDate2() + GetPlace() + End Sub + + + Public Overridable Sub GetActive() + + + ' Retrieve the value entered by the user on the Active ASP:CheckBox, and + ' save it into the Active field in DataSource PersonalExtWork record. + ' Custom validation should be performed in Validate, not here. + + + Me.DataSource.Active = Me.Active.Checked + + End Sub + + Public Overridable Sub GetBeginDate() + + ' Retrieve the value entered by the user on the BeginDate ASP:TextBox, and + ' save it into the BeginDate field in DataSource PersonalExtWork 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.BeginDate.Text, PersonalExtWorkTable.BeginDate) + + + End Sub + + Public Overridable Sub GetCommand1() + + ' Retrieve the value entered by the user on the Command ASP:TextBox, and + ' save it into the Command field in DataSource PersonalExtWork record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.Command1.Text, PersonalExtWorkTable.Command) + + + End Sub + + Public Overridable Sub GetCommandDate1() + + ' Retrieve the value entered by the user on the CommandDate ASP:TextBox, and + ' save it into the CommandDate field in DataSource PersonalExtWork 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.CommandDate1.Text, PersonalExtWorkTable.CommandDate) + + + End Sub + + Public Overridable Sub GetDescription() + + ' Retrieve the value entered by the user on the Description ASP:TextBox, and + ' save it into the Description field in DataSource PersonalExtWork record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.Description.Text, PersonalExtWorkTable.Description) + + + End Sub + + Public Overridable Sub GetEndDate2() + + ' Retrieve the value entered by the user on the EndDate ASP:TextBox, and + ' save it into the EndDate field in DataSource PersonalExtWork 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.EndDate2.Text, PersonalExtWorkTable.EndDate) + + + End Sub + + Public Overridable Sub GetPlace() + + ' Retrieve the value entered by the user on the Place ASP:TextBox, and + ' save it into the Place field in DataSource PersonalExtWork record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.Place.Text, PersonalExtWorkTable.Place) + + + End Sub + + + ' To customize, override this method in PersonalExtWorkTableControlRow. + + Public Overridable Function CreateWhereClause() As WhereClause + + Return Nothing + + End Function + + + + ' To customize, override this method in PersonalExtWorkTableControlRow. + 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) + PersonalExtWorkTable.DeleteRecord(pkValue) + + DirectCast(GetParentControlObject(Me, "PersonalExtWorkTableControl"), PersonalExtWorkTableControl).DataChanged = True + DirectCast(GetParentControlObject(Me, "PersonalExtWorkTableControl"), PersonalExtWorkTableControl).ResetData = True + End Sub + + Protected Overridable Sub Control_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.PreRender + ' PreRender event is raised just before page is being displayed. + Try + DbUtils.StartTransaction() + Me.RegisterPostback() + + If Not Me.Page.ErrorOnPage AndAlso (Me.Page.IsPageRefresh OrElse Me.DataChanged OrElse Me.ResetData) Then + + + ' Re-load the data and update the web page if necessary. + ' This is typically done during a postback (filter, search button, sort, pagination button). + ' In each of the other click handlers, simply set DataChanged to True to reload the data. + Me.LoadData() + Me.DataBind() + End If + + + Catch ex As Exception + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + Finally + DbUtils.EndTransaction() + End Try + End Sub + + + Protected Overrides Sub SaveControlsToSession() + MyBase.SaveControlsToSession() + + + 'Save pagination state to session. + + End Sub + + + + Protected Overrides Sub ClearControlsFromSession() + MyBase.ClearControlsFromSession() + + + + ' Clear pagination state from session. + + End Sub + + Protected Overrides Sub LoadViewState(ByVal savedState As Object) + MyBase.LoadViewState(savedState) + Dim isNewRecord As String = CType(ViewState("IsNewRecord"), String) + If Not isNewRecord Is Nothing AndAlso isNewRecord.Trim <> "" Then + Me.IsNewRecord = Boolean.Parse(isNewRecord) + End If + + Dim myCheckSum As String = CType(ViewState("CheckSum"), String) + If Not myCheckSum Is Nothing AndAlso myCheckSum.Trim <> "" Then + Me.CheckSum = myCheckSum + End If + + + ' Load view state for pagination control. + + End Sub + + Protected Overrides Function SaveViewState() As Object + ViewState("IsNewRecord") = Me.IsNewRecord.ToString() + ViewState("CheckSum") = Me.CheckSum + + + ' Load view state for pagination control. + + Return MyBase.SaveViewState() + End Function + + + ' event handler for ImageButton + Public Overridable Sub PersonalExtWorkRowDeleteButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + If(Not Me.Page.IsPageRefresh) Then + + Dim tc As PersonalExtWorkTableControl = DirectCast(GetParentControlObject(Me, "PersonalExtWorkTableControl"), PersonalExtWorkTableControl) + If Not (IsNothing(tc)) Then + If Not Me.IsNewRecord Then + tc.AddToDeletedRecordIds(DirectCast(Me, PersonalExtWorkTableControlRow)) + End If + Me.Visible = False + tc.SetFormulaControls() + End If + + End If + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalExtWorkRowEditButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + ' The redirect URL is set on the Properties, Custom Properties or Actions. + ' The ModifyRedirectURL call resolves the parameters before the + ' Response.Redirect redirects the page to the URL. + ' Any code after the Response.Redirect call will not be executed, since the page is + ' redirected to the URL. + + + Dim url As String = "../PersonalExtWork/EditPersonalExtWork.aspx?PersonalExtWork={PK}" + + Dim shouldRedirect As Boolean = True + Dim TargetKey As String = Nothing + Dim DFKA As String = TargetKey + Dim id As String = DFKA + Dim value As String = id + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + url = Me.ModifyRedirectUrl(url, "",False) + url = Me.Page.ModifyRedirectUrl(url, "",False) + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + shouldRedirect = False + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + If shouldRedirect Then + Me.Page.ShouldSaveControlsToSession = True + Me.Page.Response.Redirect(url) + ElseIf Not TargetKey Is Nothing AndAlso _ + Not shouldRedirect Then + Me.Page.ShouldSaveControlsToSession = True + Me.Page.CloseWindow(True) + + End If + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalExtWorkRowViewButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + ' The redirect URL is set on the Properties, Custom Properties or Actions. + ' The ModifyRedirectURL call resolves the parameters before the + ' Response.Redirect redirects the page to the URL. + ' Any code after the Response.Redirect call will not be executed, since the page is + ' redirected to the URL. + + + Dim url As String = "../PersonalExtWork/ShowPersonalExtWork.aspx?PersonalExtWork={PK}" + + Dim shouldRedirect As Boolean = True + Dim TargetKey As String = Nothing + Dim DFKA As String = TargetKey + Dim id As String = DFKA + Dim value As String = id + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + url = Me.ModifyRedirectUrl(url, "",False) + url = Me.Page.ModifyRedirectUrl(url, "",False) + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + shouldRedirect = False + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + If shouldRedirect Then + Me.Page.ShouldSaveControlsToSession = True + Me.Page.Response.Redirect(url) + ElseIf Not TargetKey Is Nothing AndAlso _ + Not shouldRedirect Then + Me.Page.ShouldSaveControlsToSession = True + Me.Page.CloseWindow(True) + + End If + End Sub + + Protected Overridable Sub Active_CheckedChanged(ByVal sender As Object, ByVal args As EventArgs) + + + End Sub + + Protected Overridable Sub BeginDate_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub Command1_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub CommandDate1_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub Description_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub EndDate2_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub Place_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("BasePersonalExtWorkTableControlRow_Rec"), String) + End Get + Set(ByVal value As String) + Me.ViewState("BasePersonalExtWorkTableControlRow_Rec") = value + End Set + End Property + + Private _DataSource As PersonalExtWorkRecord + Public Property DataSource() As PersonalExtWorkRecord + Get + Return Me._DataSource + End Get + + Set(ByVal value As PersonalExtWorkRecord) + + Me._DataSource = value + End Set + End Property + + + + Private _checkSum As String + Public Overridable Property CheckSum() As String + Get + Return Me._checkSum + End Get + Set(ByVal value As String) + Me._checkSum = value + End Set + End Property + + Private _TotalPages As Integer + Public Property TotalPages() As Integer + Get + Return Me._TotalPages + End Get + Set(ByVal value As Integer) + Me._TotalPages = value + End Set + End Property + + Private _PageIndex As Integer + Public Property PageIndex() As Integer + Get + ' Return the PageIndex + Return Me._PageIndex + End Get + Set(ByVal value As Integer) + Me._PageIndex = value + End Set + End Property + + Private _DisplayLastPage As Boolean + Public Property DisplayLastPage() As Boolean + Get + Return Me._DisplayLastPage + End Get + Set(ByVal value As Boolean) + Me._DisplayLastPage = value + End Set + End Property + + + +#Region "Helper Properties" + + Public ReadOnly Property Active() As System.Web.UI.WebControls.CheckBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Active"), System.Web.UI.WebControls.CheckBox) + End Get + End Property + + Public ReadOnly Property BeginDate() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "BeginDate"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property Command1() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Command1"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property CommandDate1() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "CommandDate1"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property Description() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Description"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property EndDate2() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "EndDate2"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property PersonalExtWorkRecordRowSelection() As System.Web.UI.WebControls.CheckBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalExtWorkRecordRowSelection"), System.Web.UI.WebControls.CheckBox) + End Get + End Property + + Public ReadOnly Property PersonalExtWorkRowDeleteButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalExtWorkRowDeleteButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalExtWorkRowEditButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalExtWorkRowEditButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalExtWorkRowViewButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalExtWorkRowViewButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property Place() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Place"), System.Web.UI.WebControls.TextBox) + 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 PersonalExtWorkRecord = 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 PersonalExtWorkRecord + If Not Me.DataSource Is Nothing Then + Return Me.DataSource + End If + + If Not Me.RecordUniqueId Is Nothing Then + + Return PersonalExtWorkTable.GetRecord(Me.RecordUniqueId, True) + + End If + + ' Localization. + + Return Nothing + + End Function + + Public Shadows ReadOnly Property Page() As BaseApplicationPage + Get + Return DirectCast(MyBase.Page, BaseApplicationPage) + End Get + End Property + +#End Region + +End Class + + + +' Base class for the PersonalExtWorkTableControl control on the EditPersonalId page. +' Do not modify this class. Instead override any method in PersonalExtWorkTableControl. +Public Class BasePersonalExtWorkTableControl + Inherits Persons.UI.BaseApplicationTableControl + + + + Protected Overridable Sub Control_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Init + + + + ' Setup the filter and search events. + + + + ' Control Initializations. + ' Initialize the table's current sort order. + + If Me.InSession(Me, "Order_By") Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + End If + + + + ' Setup default pagination settings. + + Me.PageSize = CInt(Me.GetFromSession(Me, "Page_Size", "10")) + Me.PageIndex = CInt(Me.GetFromSession(Me, "Page_Index", "0")) + + + + Me.ClearControlsFromSession() + End Sub + + Protected Overridable Sub Control_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load + + SaveControlsToSession_Ajax() + + ' Show confirmation message on Click + Me.PersonalExtWorkDeleteButton.Attributes.Add("onClick", "return (confirm('" & (CType(Me.Page,BaseApplicationPage)).GetResourceValue("DeleteConfirm", "Persons") & "'));") + + ' Setup the pagination events. + + AddHandler Me.PersonalExtWorkPagination.FirstPage.Click, AddressOf PersonalExtWorkPagination_FirstPage_Click + + AddHandler Me.PersonalExtWorkPagination.LastPage.Click, AddressOf PersonalExtWorkPagination_LastPage_Click + + AddHandler Me.PersonalExtWorkPagination.NextPage.Click, AddressOf PersonalExtWorkPagination_NextPage_Click + + AddHandler Me.PersonalExtWorkPagination.PageSizeButton.Click, AddressOf PersonalExtWorkPagination_PageSizeButton_Click + + AddHandler Me.PersonalExtWorkPagination.PreviousPage.Click, AddressOf PersonalExtWorkPagination_PreviousPage_Click + + + ' Setup the sorting events. + + AddHandler Me.ActiveLabel.Click, AddressOf ActiveLabel_Click + + AddHandler Me.BeginDateLabel.Click, AddressOf BeginDateLabel_Click + + AddHandler Me.CommandDateLabel1.Click, AddressOf CommandDateLabel1_Click + + AddHandler Me.CommandLabel1.Click, AddressOf CommandLabel1_Click + + AddHandler Me.DescriptionLabel1.Click, AddressOf DescriptionLabel1_Click + + AddHandler Me.EndDateLabel3.Click, AddressOf EndDateLabel3_Click + + AddHandler Me.PlaceLabel1.Click, AddressOf PlaceLabel1_Click + + ' Setup the button events. + + AddHandler Me.PersonalExtWorkAddButton.Click, AddressOf PersonalExtWorkAddButton_Click + + AddHandler Me.PersonalExtWorkDeleteButton.Click, AddressOf PersonalExtWorkDeleteButton_Click + + AddHandler Me.PersonalExtWorkEditButton.Click, AddressOf PersonalExtWorkEditButton_Click + + AddHandler Me.PersonalExtWorkResetButton.Click, AddressOf PersonalExtWorkResetButton_Click + + + ' Setup events for others + + End Sub + + + Public Overridable Sub LoadData() + + ' Read data from database. Returns an array of records that can be assigned + ' to the DataSource table control property. + Try + Dim joinFilter As CompoundFilter = CreateCompoundJoinFilter() + + ' The WHERE clause will be empty when displaying all records in table. + Dim wc As WhereClause = CreateWhereClause() + If wc IsNot Nothing AndAlso Not wc.RunQuery Then + ' Initialize an empty array of records + Dim alist As New ArrayList(0) + Me.DataSource = DirectCast(alist.ToArray(GetType(PersonalExtWorkRecord)), PersonalExtWorkRecord()) + ' Add records to the list if needed. + Me.AddNewRecords() + Me._TotalRecords = 0 + Me._TotalPages = 0 + Return + End If + + ' Call OrderBy to determine the order - either use the order defined + ' on the Query Wizard, or specified by user (by clicking on column heading) + Dim orderBy As OrderBy = CreateOrderBy() + + ' Get the pagesize from the pagesize control. + Me.GetPageSize() + + If Me.DisplayLastPage Then + Dim totalRecords As Integer = If(Me._TotalRecords < 0, PersonalExtWorkTable.GetRecordCount(CreateCompoundJoinFilter(), CreateWhereClause()), Me._TotalRecords) + + Dim totalPages As Integer = CInt(Math.Ceiling(totalRecords / Me.PageSize)) + + Me.PageIndex = totalPages - 1 + End If + + ' Make sure PageIndex (current page) and PageSize are within bounds. + If Me.PageIndex < 0 Then + Me.PageIndex = 0 + End If + If Me.PageSize < 1 Then + Me.PageSize = 1 + End If + + ' Retrieve the records and set the table DataSource. + ' Only PageSize records are fetched starting at PageIndex (zero based). + If Me.AddNewRecord > 0 Then + ' Make sure to preserve the previously entered data on new rows. + Dim postdata As New ArrayList + For Each rc As PersonalExtWorkTableControlRow In Me.GetRecordControls() + If Not rc.IsNewRecord Then + rc.DataSource = rc.GetRecord() + rc.GetUIData() + postdata.Add(rc.DataSource) + UIData.Add(rc.PreservedUIData()) + End If + Next + Me.DataSource = DirectCast(postdata.ToArray(GetType(PersonalExtWorkRecord)), PersonalExtWorkRecord()) + Else ' Get the records from the database + Me.DataSource = PersonalExtWorkTable.GetRecords(joinFilter, wc, orderBy, Me.PageIndex, Me.PageSize) + + End If + + ' if the datasource contains no records contained in database, then load the last page. + If (DbUtils.GetCreatedRecords(Me.DataSource).Length = 0 AndAlso Not Me.DisplayLastPage) Then + Me.DisplayLastPage = True + LoadData() + Else + + ' Add any new rows desired by the user. + Me.AddNewRecords() + + ' Turn off the ToggleAll checkbox + Me.PersonalExtWorkToggleAll.Checked = False + + + ' Initialize the page and grand totals. now + + End If + + Catch ex As Exception + ' Report the error message to the end user + Dim msg As String = ex.Message + If ex.InnerException IsNot Nothing Then + msg = msg & " InnerException: " & ex.InnerException.Message + End If + Throw New Exception(msg, ex.InnerException) + End Try + End Sub + + + + + Public Overrides Sub DataBind() + ' The DataBind method binds the user interface controls to the values + ' from the database record for each row in the table. To do this, it calls the + ' DataBind for each of the rows. + ' DataBind also populates any filters above the table, and sets the pagination + ' control to the correct number of records and the current page number. + + MyBase.DataBind() + + ' Make sure that the DataSource is initialized. + If Me.DataSource Is Nothing Then + Return + End If + + 'LoadData for DataSource for chart and report if they exist + + ' Setup the pagination controls. + BindPaginationControls() + + + + ' Bind the repeater with the list of records to expand the UI. + Dim rep As System.Web.UI.WebControls.Repeater = CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalExtWorkTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return + rep.DataSource = DataSource() + rep.DataBind() + + Dim index As Integer = 0 + For Each repItem As System.Web.UI.WebControls.RepeaterItem In rep.Items + ' Loop through all rows in the table, set its DataSource and call DataBind(). + Dim recControl As PersonalExtWorkTableControlRow = DirectCast(repItem.FindControl("PersonalExtWorkTableControlRow"), PersonalExtWorkTableControlRow) + recControl.DataSource = Me.DataSource(index) + If Me.UIData.Count > index Then + recControl.PreviousUIData = Me.UIData(index) + End If + recControl.DataBind() + recControl.Visible = Not Me.InDeletedRecordIds(recControl) + + index += 1 + Next + + + + + ' Call the Set methods for each controls on the panel + + SetActiveLabel() + SetBeginDateLabel() + SetCommandDateLabel1() + SetCommandLabel1() + SetDescriptionLabel1() + SetEndDateLabel3() + + + + + + SetPersonalExtWorkTableControlCollapsibleRegion() + + SetPlaceLabel1() + ' setting the state of expand or collapse alternative rows + + + ' Load data for each record and table UI control. + ' Ordering is important because child controls get + ' their parent ids from their parent UI controls. + + + ' this method calls the set method for controls with special formula like running total, sum, rank, etc + SetFormulaControls() + End Sub + + Public Overridable Sub SetFormulaControls() + ' this method calls Set methods for the control that has special formula + + + + End Sub + + + + Public Overridable Sub RegisterPostback() + + + End Sub + + Public EvaluateFormulaDelegate As BaseClasses.Data.DataSource.EvaluateFormulaDelegate = New BaseClasses.Data.DataSource.EvaluateFormulaDelegate(AddressOf Me.EvaluateFormula) + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean, ByVal e as FormulaEvaluator) As String + If e Is Nothing + e = New FormulaEvaluator() + End If + + e.Variables.Clear() + + + ' add variables for formula evaluation + If variables IsNot Nothing Then + Dim enumerator As System.Collections.Generic.IEnumerator(Of System.Collections.Generic.KeyValuePair(Of String, Object)) = variables.GetEnumerator() + While enumerator.MoveNext() + e.Variables.Add(enumerator.Current.Key, enumerator.Current.Value) + End While + End If + + If includeDS + + End If + + ' All variables referred to in the formula are expected to be + ' properties of the DataSource. For example, referring to + ' UnitPrice as a variable will refer to DataSource.UnitPrice + e.DataSource = dataSourceForEvaluate + + ' Define the calling control. This is used to add other + ' related table and record controls as variables. + e.CallingControl = Me + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + + If Not String.IsNullOrEmpty(format) AndAlso (String.IsNullOrEmpty(formula) OrElse formula.IndexOf("Format(") < 0) Then + Return FormulaUtils.Format(resultObj, format) + Else + Return resultObj.ToString() + End If + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format,variables ,includeDS, Nothing) + End Function + + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object)) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format, variables ,True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, format, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal e as FormulaEvaluator) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, variables, True, e) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal includeDS as Boolean) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, includeDS, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, True, Nothing) + End Function + + + + + Public Overridable Sub ResetControl() + + Me.CurrentSortOrder.Reset() + If (Me.InSession(Me, "Order_By")) Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + End If + + Me.PageIndex = 0 + End Sub + + Protected Overridable Sub BindPaginationControls() + ' Setup the pagination controls. + + ' Bind the pagination labels. + + If DbUtils.GetCreatedRecords(Me.DataSource).Length > 0 Then + + Me.PersonalExtWorkPagination.CurrentPage.Text = (Me.PageIndex + 1).ToString() + Else + Me.PersonalExtWorkPagination.CurrentPage.Text = "0" + End If + Me.PersonalExtWorkPagination.PageSize.Text = Me.PageSize.ToString() + Me.PersonalExtWorkPagination.TotalItems.Text = Me.TotalRecords.ToString() + Me.PersonalExtWorkPagination.TotalPages.Text = Me.TotalPages.ToString() + + ' Bind the buttons for PersonalExtWorkTableControl pagination. + + Me.PersonalExtWorkPagination.FirstPage.Enabled = Not (Me.PageIndex = 0) + If Me._TotalPages < 0 Then ' if the total pages is not determined yet, enable last and next buttons + Me.PersonalExtWorkPagination.LastPage.Enabled = True + ElseIf Me._TotalPages = 0 ' if the total pages is determined and it is 0, enable last and next buttons + Me.PersonalExtWorkPagination.LastPage.Enabled = False + Else ' if the total pages is the last page, disable last and next buttons + Me.PersonalExtWorkPagination.LastPage.Enabled = Not (Me.PageIndex = Me.TotalPages - 1) + End If + + If Me._TotalPages < 0 Then ' if the total pages is not determined yet, enable last and next buttons + Me.PersonalExtWorkPagination.NextPage.Enabled = True + ElseIf Me._TotalPages = 0 ' if the total pages is determined and it is 0, enable last and next buttons + Me.PersonalExtWorkPagination.NextPage.Enabled = False + Else ' if the total pages is the last page, disable last and next buttons + Me.PersonalExtWorkPagination.NextPage.Enabled = Not (Me.PageIndex = Me.TotalPages - 1) + End If + + Me.PersonalExtWorkPagination.PreviousPage.Enabled = Not (Me.PageIndex = 0) + + + End Sub + + Public Overridable Sub SaveData() + ' Save the data from the entire table. Calls each row's Save Data + ' to save their data. This function is called by the Click handler of the + ' Save button. The button handler should Start/Commit/End a transaction. + + Dim recCtl As PersonalExtWorkTableControlRow + For Each recCtl In Me.GetRecordControls() + + If Me.InDeletedRecordIds(recCtl) Then + ' Delete any pending deletes. + recCtl.Delete() + Else + If recCtl.Visible Then + recCtl.SaveData() + End If + End If + + Next + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + ' Set IsNewRecord to False for all records - since everything has been saved and is no longer "new" + For Each recCtl In Me.GetRecordControls() + recCtl.IsNewRecord = False + Next + + + ' Set DeletedRecordsIds to Nothing since we have deleted all pending deletes. + Me.DeletedRecordIds = Nothing + + End Sub + + Public Overridable Function CreateCompoundJoinFilter() As CompoundFilter + Dim jFilter As CompoundFilter = New CompoundFilter() + + Return jFilter + + End Function + + + Public Overridable Function CreateOrderBy() As OrderBy + ' The CurrentSortOrder is initialized to the sort order on the + ' Query Wizard. It may be modified by the Click handler for any of + ' the column heading to sort or reverse sort by that column. + ' You can add your own sort order, or modify it on the Query Wizard. + Return Me.CurrentSortOrder + End Function + + Public Overridable Function CreateWhereClause() As WhereClause + 'This CreateWhereClause is used for loading the data. + PersonalExtWorkTable.Instance.InnerFilter = Nothing + Dim wc As WhereClause = New WhereClause() + + ' Compose the WHERE clause consiting of: + ' 1. Static clause defined at design time. + ' 2. User selected search criteria. + ' 3. User selected filter criteria. + + + Dim selectedRecordKeyValue as KeyValue = New KeyValue() + + Dim personalIdRecordControlObj As Persons.UI.Controls.EditPersonalId.PersonalIdRecordControl = DirectCast(MiscUtils.FindControlRecursively(Me.Page, "PersonalIdRecordControl"), Persons.UI.Controls.EditPersonalId.PersonalIdRecordControl) + + If (Not IsNothing(personalIdRecordControlObj) AndAlso Not IsNothing(personalIdRecordControlObj.GetRecord()) AndAlso personalIdRecordControlObj.GetRecord().IsCreated AndAlso Not IsNothing(personalIdRecordControlObj.GetRecord().PersonalId)) + wc.iAND(PersonalExtWorkTable.PersonalId, BaseFilter.ComparisonOperator.EqualsTo, personalIdRecordControlObj.GetRecord().PersonalId.ToString()) + selectedRecordKeyValue.AddElement(PersonalExtWorkTable.PersonalId.InternalName, personalIdRecordControlObj.GetRecord().PersonalId.ToString()) + Else + wc.RunQuery = False + Return wc + End If + + HttpContext.Current.Session("PersonalExtWorkTableControlWhereClause") = selectedRecordKeyValue.ToXmlString() + + Return wc + End Function + + + Public Overridable Function CreateWhereClause(ByVal searchText as String, ByVal fromSearchControl as String, ByVal AutoTypeAheadSearch as String, ByVal AutoTypeAheadWordSeparators as String) As WhereClause + ' This CreateWhereClause is used for loading list of suggestions for Auto Type-Ahead feature. + PersonalExtWorkTable.Instance.InnerFilter = Nothing + Dim wc As WhereClause = New WhereClause() + + ' Compose the WHERE clause consiting of: + ' 1. Static clause defined at design time. + ' 2. User selected search criteria. + ' 3. User selected filter criteria. + + Dim appRelativeVirtualPath As String = CType(HttpContext.Current.Session("AppRelativeVirtualPath"), String) + + Dim selectedRecordInPersonalIdRecordControl as String = DirectCast(HttpContext.Current.Session("PersonalExtWorkTableControlWhereClause"), String) + + If Not selectedRecordInPersonalIdRecordControl Is Nothing AndAlso KeyValue.IsXmlKey(selectedRecordInPersonalIdRecordControl) Then + Dim selectedRecordKeyValue as KeyValue = KeyValue.XmlToKey(selectedRecordInPersonalIdRecordControl) + + If Not IsNothing(selectedRecordKeyValue) AndAlso selectedRecordKeyValue.ContainsColumn(PersonalExtWorkTable.PersonalId) Then + wc.iAND(PersonalExtWorkTable.PersonalId, BaseFilter.ComparisonOperator.EqualsTo, selectedRecordKeyValue.GetColumnValue(PersonalExtWorkTable.PersonalId).ToString()) + End If + + End If + + ' Adds clauses if values are selected in Filter controls which are configured in the page. + + + Return wc + End Function + + + Public Overridable Function FormatSuggestions(ByVal prefixText As String, ByVal resultItem As String, _ + ByVal columnLength As Integer, ByVal AutoTypeAheadDisplayFoundText As String, _ + ByVal autoTypeAheadSearch As String, ByVal AutoTypeAheadWordSeparators As String, _ + ByVal resultList As ArrayList) As Boolean + + 'Formats the resultItem and adds it to the list of suggestions. + Dim index As Integer = resultItem.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture).IndexOf(prefixText.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture)) + Dim itemToAdd As String = "" + Dim isFound As Boolean = False + Dim isAdded As Boolean = False + ' Get the index where prfixt is at the beginning of resultItem. If not found then, index of word which begins with prefixText. + If InvariantLCase(autoTypeAheadSearch).equals("wordsstartingwithsearchstring") And Not index = 0 Then + ' Expression to find word which contains AutoTypeAheadWordSeparators followed by prefixText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex( AutoTypeAheadWordSeparators + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + If regex1.IsMatch(resultItem) Then + index = regex1.Match(resultItem).Index + isFound = True + End If + ' If the prefixText is found immediatly after white space then starting of the word is found so don not search any further + If not resultItem(index).ToString() = " " Then + ' Expression to find beginning of the word which contains AutoTypeAheadWordSeparators followed by prefixText + Dim regex As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\\S*" + AutoTypeAheadWordSeparators + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + If regex.IsMatch(resultItem) Then + index = regex.Match(resultItem).Index + isFound = True + End If + End If + End If + + ' If autoTypeAheadSearch value is wordsstartingwithsearchstring then, extract the substring only if the prefixText is found at the + ' beginning of the resultItem (index = 0) or a word in resultItem is found starts with prefixText. + If index = 0 Or isFound Or InvariantLCase(autoTypeAheadSearch).Equals("anywhereinstring") then + If InvariantLCase(AutoTypeAheadDisplayFoundText).equals("atbeginningofmatchedstring") Then + ' Expression to find beginning of the word which contains prefixText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\\S*" + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + ' Find the beginning of the word which contains prefexText + If (StringUtils.InvariantLCase(autoTypeAheadSearch).Equals("anywhereinstring") AndAlso regex1.IsMatch(resultItem)) Then + index = regex1.Match(resultItem).Index + isFound = True + End If + ' Display string from the index till end of the string if sub string from index till end is less than columnLength value. + If Len(resultItem) - index <= columnLength Then + If index = 0 Then + itemToAdd = resultItem + Else + itemToAdd = "..." & resultItem.Substring(index, Len(resultItem) - index) + End If + Else + If index = 0 Then + itemToAdd = resultItem.Substring(index, (columnLength - 3)) & "..." + Else + 'Truncate the string to show only columnLength - 6 characters as begining and trailing "..." has to be appended. + itemToAdd = "..." & resultItem.Substring(index , columnLength - 6) & "..." + End If + End If + ElseIf InvariantLCase(AutoTypeAheadDisplayFoundText).equals("inmiddleofmatchedstring") Then + Dim subStringBeginIndex As Integer = CType(columnLength/2, Integer) + If Len(resultItem) <= columnLength Then + itemToAdd = resultItem + Else + ' Sanity check at end of the string + If index + Len(prefixText) = columnLength Then + itemToAdd = "..." & resultItem.Substring(index-columnLength,index) + ElseIf Len(resultItem) - index < subStringBeginIndex Then + ' Display string from the end till columnLength value if, index is closer to the end of the string. + itemToAdd = "..." & resultItem.Substring(Len(resultItem)-columnLength,Len(resultItem)) + ElseIf index <= subStringBeginIndex Then + ' Sanity chet at beginning of the string + itemToAdd = resultItem.Substring(0, columnLength) & "..." + Else + ' Display string containing text before the prefixText occures and text after the prefixText + itemToAdd = "..." & resultItem.Substring(index - subStringBeginIndex, columnLength) & "..." + End If + End If + ElseIf InvariantLCase(AutoTypeAheadDisplayFoundText).equals("atendofmatchedstring") Then + ' Expression to find ending of the word which contains prefexText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\s", System.Text.RegularExpressions.RegexOptions.IgnoreCase) + ' Find the ending of the word which contains prefexText + If regex1.IsMatch(resultItem, index + 1) Then + index = regex1.Match(resultItem, index + 1).Index + Else + ' If the word which contains prefexText is the last word in string, regex1.IsMatch returns false. + index = resultItem.Length + End If + If index > Len(resultItem) Then + index = Len(resultItem) + End If + ' If text from beginning of the string till index is less than columnLength value then, display string from the beginning till index. + If index <= columnLength Then + if index = Len(resultItem) Then 'Make decision to append "..." + itemToAdd = resultItem.Substring(0,index) + Else + itemToAdd = resultItem.Substring(0,index) & "..." + End If + Else + If index = Len(resultItem) Then + itemToAdd = "..." & resultItem.Substring(index - (columnLength - 3), (columnLength - 3)) + Else + 'Truncate the string to show only columnLength - 6 characters as begining and trailing "..." has to be appended. + itemToAdd = "..." & resultItem.Substring(index - (columnLength - 6), columnLength - 6) & "..." + End If + End If + End If + + ' Remove newline character from itemToAdd + Dim prefixTextIndex As Integer = itemToAdd.IndexOf(prefixText, StringComparison.CurrentCultureIgnoreCase) + ' If itemToAdd contains any newline after the search text then show text only till newline + Dim regex2 As System.Text.RegularExpressions.Regex = New System.Text.RegularExpressions.Regex("(" & vbCrLf & "|" & vbLf & ")", System.Text.RegularExpressions.RegexOptions.IgnoreCase) + Dim newLineIndexAfterPrefix As Integer = -1 + If regex2.IsMatch(itemToAdd, prefixTextIndex) Then + newLineIndexAfterPrefix = regex2.Match(itemToAdd, prefixTextIndex).Index + End If + If (newLineIndexAfterPrefix > -1) Then + If itemToAdd.EndsWith("...") Then + itemToAdd = (itemToAdd.Substring(0, newLineIndexAfterPrefix) + "...") + Else + itemToAdd = itemToAdd.Substring(0, newLineIndexAfterPrefix) + End If + End If + ' If itemToAdd contains any newline before search text then show text which comes after newline + Dim regex3 As System.Text.RegularExpressions.Regex = New System.Text.RegularExpressions.Regex("(" & vbCrLf & "|" & vbLf & ")", (System.Text.RegularExpressions.RegexOptions.IgnoreCase Or System.Text.RegularExpressions.RegexOptions.RightToLeft)) + Dim newLineIndexBeforePrefix As Integer = -1 + If regex3.IsMatch(itemToAdd, prefixTextIndex) Then + newLineIndexBeforePrefix = regex3.Match(itemToAdd, prefixTextIndex).Index + End If + If (newLineIndexBeforePrefix > -1) Then + If itemToAdd.StartsWith("...") Then + itemToAdd = ("..." + itemToAdd.Substring((newLineIndexBeforePrefix + regex3.Match(itemToAdd, prefixTextIndex).Length))) + Else + itemToAdd = itemToAdd.Substring((newLineIndexBeforePrefix + regex3.Match(itemToAdd, prefixTextIndex).Length)) + End If + End If + + If Not itemToAdd is nothing AndAlso Not resultList.Contains(itemToAdd) Then + + resultList.Add(itemToAdd) + + isAdded = true + End If + End If + Return isAdded + End Function + + + Protected Overridable Sub GetPageSize() + + If Me.PersonalExtWorkPagination.PageSize.Text.Trim <> "" Then + Try + 'Me.PageSize = Integer.Parse(Me.PersonalExtWorkPagination.PageSize.Text) + Catch ex As Exception + End Try + End If + End Sub + + Protected Overridable Sub AddNewRecords() + + Dim newRecordList As ArrayList = New ArrayList() + + Dim newUIDataList As System.Collections.Generic.List(Of Hashtable) = New System.Collections.Generic.List(Of Hashtable)() + + ' Loop though all the record controls and if the record control + ' does not have a unique record id set, then create a record + ' and add to the list. + If Not Me.ResetData Then + Dim rep As System.Web.UI.WebControls.Repeater = CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalExtWorkTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return + + Dim repItem As System.Web.UI.WebControls.RepeaterItem + For Each repItem In rep.Items + ' Loop through all rows in the table, set its DataSource and call DataBind(). + + Dim recControl As PersonalExtWorkTableControlRow = DirectCast(repItem.FindControl("PersonalExtWorkTableControlRow"), PersonalExtWorkTableControlRow) + + If recControl.Visible AndAlso recControl.IsNewRecord() Then + + Dim rec As PersonalExtWorkRecord = New PersonalExtWorkRecord() + + rec.Active = recControl.Active.Checked + + If recControl.BeginDate.Text <> "" Then + rec.Parse(recControl.BeginDate.Text, PersonalExtWorkTable.BeginDate) + End If + If recControl.Command1.Text <> "" Then + rec.Parse(recControl.Command1.Text, PersonalExtWorkTable.Command) + End If + If recControl.CommandDate1.Text <> "" Then + rec.Parse(recControl.CommandDate1.Text, PersonalExtWorkTable.CommandDate) + End If + If recControl.Description.Text <> "" Then + rec.Parse(recControl.Description.Text, PersonalExtWorkTable.Description) + End If + If recControl.EndDate2.Text <> "" Then + rec.Parse(recControl.EndDate2.Text, PersonalExtWorkTable.EndDate) + End If + If recControl.Place.Text <> "" Then + rec.Parse(recControl.Place.Text, PersonalExtWorkTable.Place) + End If + newUIDataList.Add(recControl.PreservedUIData()) + newRecordList.Add(rec) + End If + Next + End If + + + ' Add any new record to the list. + Dim index As Integer = 0 + For index = 1 To Me.AddNewRecord + + newRecordList.Insert(0, New PersonalExtWorkRecord()) + newUIDataList.Insert(0, New Hashtable()) + + Next + Me.AddNewRecord = 0 + + ' Finally, add any new records to the DataSource. + If newRecordList.Count > 0 Then + + Dim finalList As ArrayList = New ArrayList(Me.DataSource) + finalList.InsertRange(0, newRecordList) + + Me.DataSource = DirectCast(finalList.ToArray(GetType(PersonalExtWorkRecord)), PersonalExtWorkRecord()) + + End If + + ' Add the existing UI data to this hash table + If newUIDataList.Count > 0 Then + Me.UIData.InsertRange(0, newUIDataList) + End If + + End Sub + + + Public Sub AddToDeletedRecordIds(ByVal rec As PersonalExtWorkTableControlRow) + If rec.IsNewRecord() Then + Return + End If + + If Not Me.DeletedRecordIds Is Nothing AndAlso Me.DeletedRecordIds.Trim <> "" Then + Me.DeletedRecordIds &= "," + End If + + Me.DeletedRecordIds &= "[" & rec.RecordUniqueId & "]" + End Sub + + Protected Overridable Function InDeletedRecordIds(ByVal rec As PersonalExtWorkTableControlRow) As Boolean + If Me.DeletedRecordIds Is Nothing OrElse Me.DeletedRecordIds.Trim = "" Then + Return False + End If + + Return Me.DeletedRecordIds.IndexOf("[" & rec.RecordUniqueId & "]") >= 0 + End Function + + Private _DeletedRecordIds As String + Public Property DeletedRecordIds() As String + Get + Return Me._DeletedRecordIds + End Get + Set(ByVal value As String) + Me._DeletedRecordIds = value + End Set + End Property + + + ' Create Set, WhereClause, and Populate Methods + + Public Overridable Sub SetActiveLabel() + + End Sub + + Public Overridable Sub SetBeginDateLabel() + + End Sub + + Public Overridable Sub SetCommandDateLabel1() + + End Sub + + Public Overridable Sub SetCommandLabel1() + + End Sub + + Public Overridable Sub SetDescriptionLabel1() + + End Sub + + Public Overridable Sub SetEndDateLabel3() + + End Sub + + Public Overridable Sub SetPersonalExtWorkTableControlCollapsibleRegion() + + End Sub + + Public Overridable Sub SetPlaceLabel1() + + 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. + Dim added As Boolean = Me.AddNewRecord > 0 + Me.LoadData() + Me.DataBind() + + If added Then + Me.SetFocusToAddedRow() + End If + + End If + + + + Catch ex As Exception + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + Finally + DbUtils.EndTransaction + End Try + End Sub + + 'this function sets focus to the first editable element in the new added row in the editable table + Protected Overridable Sub SetFocusToAddedRow() + Dim rep As System.Web.UI.WebControls.Repeater = CType(Me.FindControl("PersonalExtWorkTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing OrElse rep.Items.Count = 0 Then Return + Dim repItem As System.Web.UI.WebControls.RepeaterItem + For Each repItem In rep.Items + 'Load scripts to table rows + Me.Page.LoadFocusScripts(repItem) + Dim recControl As PersonalExtWorkTableControlRow = DirectCast(repItem.FindControl("PersonalExtWorkTableControlRow"), PersonalExtWorkTableControlRow) + If recControl.IsNewRecord Then + For Each field As Control In recControl.Controls + If field.Visible AndAlso Me.Page.IsControlEditable(field, False) Then + 'set focus on the first editable field in the new row + field.Focus() + Dim updPan As UpdatePanel = DirectCast(Me.Page.FindControlRecursively("UpdatePanel1"), UpdatePanel) + If Not updPan Is Nothing Then updPan.Update() + Return + End If + Next + Return + End If + Next + End Sub + + + Protected Overrides Sub SaveControlsToSession() + MyBase.SaveControlsToSession() + + ' Save filter controls to values to session. + + + 'Save pagination state to session. + + + + ' Save table control properties to the session. + If Not Me.CurrentSortOrder Is Nothing Then + Me.SaveToSession(Me, "Order_By", Me.CurrentSortOrder.ToXmlString()) + End If + + Me.SaveToSession(Me, "Page_Index", Me.PageIndex.ToString()) + Me.SaveToSession(Me, "Page_Size", Me.PageSize.ToString()) + + Me.SaveToSession(Me, "DeletedRecordIds", Me.DeletedRecordIds) + + End Sub + + Protected Sub SaveControlsToSession_Ajax() + ' Save filter controls to values to session. + + HttpContext.Current.Session("AppRelativeVirtualPath") = Me.Page.AppRelativeVirtualPath + + End Sub + + Protected Overrides Sub ClearControlsFromSession() + MyBase.ClearControlsFromSession() + + ' Clear filter controls values from the session. + + + ' Clear pagination state from session. + + + + ' Clear table properties from the session. + Me.RemoveFromSession(Me, "Order_By") + Me.RemoveFromSession(Me, "Page_Index") + Me.RemoveFromSession(Me, "Page_Size") + + Me.RemoveFromSession(Me, "DeletedRecordIds") + + End Sub + + Protected Overrides Sub LoadViewState(ByVal savedState As Object) + MyBase.LoadViewState(savedState) + + Dim orderByStr As String = CType(ViewState("PersonalExtWorkTableControl_OrderBy"), String) + + If orderByStr IsNot Nothing AndAlso orderByStr.Trim <> "" Then + Me.CurrentSortOrder = BaseClasses.Data.OrderBy.FromXmlString(orderByStr) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + End If + + Dim pageIndex As String = CType(ViewState("Page_Index"), String) + If pageIndex IsNot Nothing Then + Me.PageIndex = CInt(pageIndex) + End If + + Dim pageSize As String = CType(ViewState("Page_Size"), String) + If Not pageSize Is Nothing Then + Me.PageSize = CInt(pageSize) + End If + + + + ' Load view state for pagination control. + + Me.DeletedRecordIds = CType(Me.ViewState("DeletedRecordIds"), String) + + End Sub + + Protected Overrides Function SaveViewState() As Object + + If Me.CurrentSortOrder IsNot Nothing Then + Me.ViewState("PersonalExtWorkTableControl_OrderBy") = Me.CurrentSortOrder.ToXmlString() + End If + + Me.ViewState("Page_Index") = Me.PageIndex + Me.ViewState("Page_Size") = Me.PageSize + + Me.ViewState("DeletedRecordIds") = Me.DeletedRecordIds + + + ' Load view state for pagination control. + + + Return MyBase.SaveViewState() + End Function + + ' Generate the event handling functions for pagination events. + + ' event handler for ImageButton + Public Overridable Sub PersonalExtWorkPagination_FirstPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.PageIndex = 0 + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalExtWorkPagination_LastPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.DisplayLastPage = True + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalExtWorkPagination_NextPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.PageIndex += 1 + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for LinkButton + Public Overridable Sub PersonalExtWorkPagination_PageSizeButton_Click(ByVal sender As Object, ByVal args As EventArgs) + + Try + + Me.DataChanged = True + + Me.PageSize = Integer.Parse(Me.PersonalExtWorkPagination.PageSize.Text) + + Me.PageIndex = Integer.Parse(Me.PersonalExtWorkPagination.CurrentPage.Text) - 1 + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalExtWorkPagination_PreviousPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + If Me.PageIndex > 0 Then + Me.PageIndex -= 1 + Me.DataChanged = True + End If + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + + ' Generate the event handling functions for sorting events. + + Public Overridable Sub ActiveLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by Active when clicked. + + ' Get previous sorting state for Active. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalExtWorkTable.Active) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for Active. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalExtWorkTable.Active, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by Active, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub BeginDateLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by BeginDate when clicked. + + ' Get previous sorting state for BeginDate. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalExtWorkTable.BeginDate) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for BeginDate. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalExtWorkTable.BeginDate, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by BeginDate, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub CommandDateLabel1_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by CommandDate when clicked. + + ' Get previous sorting state for CommandDate. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalExtWorkTable.CommandDate) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for CommandDate. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalExtWorkTable.CommandDate, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by CommandDate, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub CommandLabel1_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by Command when clicked. + + ' Get previous sorting state for Command. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalExtWorkTable.Command) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for Command. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalExtWorkTable.Command, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by Command, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub DescriptionLabel1_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by Description when clicked. + + ' Get previous sorting state for Description. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalExtWorkTable.Description) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for Description. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalExtWorkTable.Description, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by Description, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub EndDateLabel3_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by EndDate when clicked. + + ' Get previous sorting state for EndDate. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalExtWorkTable.EndDate) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for EndDate. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalExtWorkTable.EndDate, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by EndDate, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub PlaceLabel1_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by Place when clicked. + + ' Get previous sorting state for Place. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalExtWorkTable.Place) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for Place. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalExtWorkTable.Place, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by Place, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + + ' Generate the event handling functions for button events. + + ' event handler for ImageButton + Public Overridable Sub PersonalExtWorkAddButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + Me.AddNewRecord = 1 + Me.DataChanged = True + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalExtWorkDeleteButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + If(Not Me.Page.IsPageRefresh) Then + + Me.DeleteSelectedRecords(True) + Me.SetFormulaControls() + + + End If + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalExtWorkEditButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + ' The redirect URL is set on the Properties, Custom Properties or Actions. + ' The ModifyRedirectURL call resolves the parameters before the + ' Response.Redirect redirects the page to the URL. + ' Any code after the Response.Redirect call will not be executed, since the page is + ' redirected to the URL. + + + Dim url As String = "../PersonalExtWork/EditPersonalExtWork.aspx?PersonalExtWork={PK}" + + Dim shouldRedirect As Boolean = True + Dim TargetKey As String = Nothing + Dim DFKA As String = TargetKey + Dim id As String = DFKA + Dim value As String = id + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + url = Me.ModifyRedirectUrl(url, "",False) + url = Me.Page.ModifyRedirectUrl(url, "",False) + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + shouldRedirect = False + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + If shouldRedirect Then + Me.Page.ShouldSaveControlsToSession = True + Me.Page.Response.Redirect(url) + ElseIf Not TargetKey Is Nothing AndAlso _ + Not shouldRedirect Then + Me.Page.ShouldSaveControlsToSession = True + Me.Page.CloseWindow(True) + + End If + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalExtWorkResetButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.CurrentSortOrder.Reset() + If Me.InSession(Me, "Order_By") Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + + End If + + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + + + ' Generate the event handling functions for filter and search events. + + + ' Generate the event handling functions for others + + + Private _UIData As New System.Collections.Generic.List(Of Hashtable) + Public Property UIData() As System.Collections.Generic.List(Of Hashtable) + Get + Return Me._UIData + End Get + Set(ByVal value As System.Collections.Generic.List(Of Hashtable)) + Me._UIData = value + End Set + End Property + + ' pagination properties + Protected _PageSize As Integer + Public Property PageSize() As Integer + Get + Return Me._PageSize + End Get + Set(ByVal value As Integer) + Me._PageSize = value + End Set + End Property + + Protected _PageIndex As Integer + Public Property PageIndex() As Integer + Get + ' Return the PageIndex + Return Me._PageIndex + End Get + Set(ByVal value As Integer) + Me._PageIndex = value + End Set + End Property + + Protected _TotalRecords As Integer = -1 + Public Property TotalRecords() As Integer + Get + If _TotalRecords < 0 + _TotalRecords = PersonalExtWorkTable.GetRecordCount(CreateCompoundJoinFilter(), CreateWhereClause()) + End If + Return Me._TotalRecords + End Get + Set(ByVal value As Integer) + If Me.PageSize > 0 Then + + Me.TotalPages = CInt(Math.Ceiling(value / Me.PageSize)) + + End If + Me._TotalRecords = value + End Set + End Property + + + + Protected _TotalPages As Integer = -1 + Public Property TotalPages() As Integer + Get + If _TotalPages < 0 Then + + Me.TotalPages = CInt(Math.Ceiling(TotalRecords / Me.PageSize)) + + End If + Return Me._TotalPages + End Get + Set(ByVal value As Integer) + Me._TotalPages = value + End Set + End Property + + Protected _DisplayLastPage As Boolean + Public Property DisplayLastPage() As Boolean + Get + Return Me._DisplayLastPage + End Get + Set(ByVal value As Boolean) + Me._DisplayLastPage = value + End Set + End Property + + Private _DataChanged As Boolean = False + Public Property DataChanged() As Boolean + Get + Return Me._DataChanged + End Get + Set(ByVal value As Boolean) + Me._DataChanged = value + End Set + End Property + + Private _ResetData As Boolean = False + Public Property ResetData() As Boolean + Get + Return Me._ResetData + End Get + Set(ByVal value As Boolean) + Me._ResetData = value + End Set + End Property + + Private _AddNewRecord As Integer = 0 + Public Property AddNewRecord() As Integer + Get + Return Me._AddNewRecord + End Get + Set(ByVal value As Integer) + Me._AddNewRecord = value + End Set + End Property + + + Private _CurrentSortOrder As OrderBy = Nothing + Public Property CurrentSortOrder() As OrderBy + Get + Return Me._CurrentSortOrder + End Get + Set(ByVal value As BaseClasses.Data.OrderBy) + Me._CurrentSortOrder = value + End Set + End Property + + Private _DataSource() As PersonalExtWorkRecord = Nothing + Public Property DataSource() As PersonalExtWorkRecord () + Get + Return Me._DataSource + End Get + Set(ByVal value() As PersonalExtWorkRecord) + Me._DataSource = value + End Set + End Property + +#Region "Helper Properties" + + Public ReadOnly Property ActiveLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "ActiveLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property BeginDateLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "BeginDateLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property CommandDateLabel1() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "CommandDateLabel1"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property CommandLabel1() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "CommandLabel1"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property DescriptionLabel1() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "DescriptionLabel1"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property EndDateLabel3() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "EndDateLabel3"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property PersonalExtWorkAddButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalExtWorkAddButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalExtWorkDeleteButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalExtWorkDeleteButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalExtWorkEditButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalExtWorkEditButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalExtWorkPagination() As Persons.UI.IPagination + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalExtWorkPagination"), Persons.UI.IPagination) + End Get + End Property + + Public ReadOnly Property PersonalExtWorkResetButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalExtWorkResetButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalExtWorkTableControlCollapsibleRegion() As System.Web.UI.WebControls.Panel + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalExtWorkTableControlCollapsibleRegion"), System.Web.UI.WebControls.Panel) + End Get + End Property + + Public ReadOnly Property PersonalExtWorkToggleAll() As System.Web.UI.WebControls.CheckBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalExtWorkToggleAll"), System.Web.UI.WebControls.CheckBox) + End Get + End Property + + Public ReadOnly Property PlaceLabel1() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PlaceLabel1"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + +#End Region + +#Region "Helper Functions" + + Public Overrides Overloads Function ModifyRedirectUrl(url As String, arg As String, ByVal bEncrypt As Boolean) As String + Return Me.Page.EvaluateExpressions(url, arg, bEncrypt, Me) + End Function + + Public Overrides Overloads Function EvaluateExpressions(url As String, arg As String, ByVal bEncrypt As Boolean) As String + Dim needToProcess As Boolean = AreAnyUrlParametersForMe(url, arg) + If (needToProcess) Then + Dim recCtl As PersonalExtWorkTableControlRow = Me.GetSelectedRecordControl() + If recCtl Is Nothing AndAlso url.IndexOf("{") >= 0 Then + ' Localization. + Throw New Exception(Page.GetResourceValue("Err:NoRecSelected", "Persons")) + End If + Dim rec As PersonalExtWorkRecord = Nothing + If recCtl IsNot Nothing Then + rec = recCtl.GetRecord() + End If + Return EvaluateExpressions(url, arg, rec, bEncrypt) + End If + Return url + End Function + + Public Overridable Function GetSelectedRecordIndex() As Integer + Dim counter As Integer = 0 + Dim recControl As PersonalExtWorkTableControlRow + For Each recControl In Me.GetRecordControls() + If recControl.PersonalExtWorkRecordRowSelection.Checked Then + Return counter + End If + counter += 1 + Next + Return -1 + End Function + + Public Overridable Function GetSelectedRecordControl() As PersonalExtWorkTableControlRow + Dim selectedList() As PersonalExtWorkTableControlRow = Me.GetSelectedRecordControls() + If selectedList.Length = 0 Then + Return Nothing + End If + Return selectedList(0) + + End Function + + Public Overridable Function GetSelectedRecordControls() As PersonalExtWorkTableControlRow() + + Dim selectedList As ArrayList = New ArrayList(25) + Dim recControl As PersonalExtWorkTableControlRow + For Each recControl In Me.GetRecordControls() + If recControl.PersonalExtWorkRecordRowSelection IsNot Nothing AndAlso recControl.PersonalExtWorkRecordRowSelection.Checked Then + selectedList.Add(recControl) + End If + Next + Return DirectCast(selectedList.ToArray(GetType(PersonalExtWorkTableControlRow)), PersonalExtWorkTableControlRow()) + + End Function + + Public Overridable Sub DeleteSelectedRecords(ByVal deferDeletion As Boolean) + Dim recList() As PersonalExtWorkTableControlRow = Me.GetSelectedRecordControls() + If recList.Length = 0 Then + ' Localization. + Throw New Exception(Page.GetResourceValue("Err:NoRecSelected", "Persons")) + End If + + Dim recCtl As PersonalExtWorkTableControlRow + For Each recCtl In recList + If deferDeletion Then + If Not recCtl.IsNewRecord Then + + Me.AddToDeletedRecordIds(recCtl) + + End If + recCtl.Visible = False + + recCtl.PersonalExtWorkRecordRowSelection.Checked = False + + Else + + recCtl.Delete() + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + End If + Next + End Sub + + Public Function GetRecordControls() As PersonalExtWorkTableControlRow() + Dim recList As ArrayList = New ArrayList() + Dim rep As System.Web.UI.WebControls.Repeater = CType(Me.FindControl("PersonalExtWorkTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return Nothing + Dim repItem As System.Web.UI.WebControls.RepeaterItem + + For Each repItem In rep.Items + + Dim recControl As PersonalExtWorkTableControlRow = DirectCast(repItem.FindControl("PersonalExtWorkTableControlRow"), PersonalExtWorkTableControlRow) + recList.Add(recControl) + + Next + + Return DirectCast(recList.ToArray(GetType(PersonalExtWorkTableControlRow)), PersonalExtWorkTableControlRow()) + End Function + + Public Shadows ReadOnly Property Page() As BaseApplicationPage + Get + Return DirectCast(MyBase.Page, BaseApplicationPage) + End Get + End Property + +#End Region + + + +End Class + + +' Base class for the PersonalInsigniaTableControlRow control on the EditPersonalId page. +' Do not modify this class. Instead override any method in PersonalInsigniaTableControlRow. +Public Class BasePersonalInsigniaTableControlRow + Inherits Persons.UI.BaseApplicationRecordControl + + ' To customize, override this method in PersonalInsigniaTableControlRow. + Protected Overridable Sub Control_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Init + + Me.ClearControlsFromSession() + End Sub + + ' To customize, override this method in PersonalInsigniaTableControlRow. + Protected Overridable Sub Control_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load + + 'Call LoadFocusScripts from repeater so that onfocus attribute could be added to elements + Me.Page.LoadFocusScripts(Me) + + ' Show confirmation message on Click + Me.PersonalInsigniaRowDeleteButton.Attributes.Add("onClick", "return (confirm('" & (CType(Me.Page,BaseApplicationPage)).GetResourceValue("DeleteRecordConfirm", "Persons") & "'));") + + + ' Register the event handlers. + + AddHandler Me.PersonalInsigniaRowDeleteButton.Click, AddressOf PersonalInsigniaRowDeleteButton_Click + + AddHandler Me.PersonalInsigniaRowEditButton.Click, AddressOf PersonalInsigniaRowEditButton_Click + + AddHandler Me.PersonalInsigniaRowViewButton.Click, AddressOf PersonalInsigniaRowViewButton_Click + + AddHandler Me.InsigniaId.SelectedIndexChanged, AddressOf InsigniaId_SelectedIndexChanged + + AddHandler Me.GazetteDate.TextChanged, AddressOf GazetteDate_TextChanged + + AddHandler Me.GazetteNO.TextChanged, AddressOf GazetteNO_TextChanged + + AddHandler Me.GazettePage.TextChanged, AddressOf GazettePage_TextChanged + + AddHandler Me.GazetteSection.TextChanged, AddressOf GazetteSection_TextChanged + + AddHandler Me.InsigniaDate.TextChanged, AddressOf InsigniaDate_TextChanged + + AddHandler Me.InsigniaReturn.TextChanged, AddressOf InsigniaReturn_TextChanged + + + End Sub + + + Public Overridable Sub LoadData() + + ' Load the data from the database into the DataSource PersonalInsignia 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 = PersonalInsigniaTable.GetRecord(Me.RecordUniqueId, True) + + Return + End If + + ' Since this is a row in the table, the data for this row is loaded by the + ' LoadData method of the BasePersonalInsigniaTableControl when the data for the entire + ' table is loaded. + + Me.DataSource = New PersonalInsigniaRecord() + + + + End Sub + + ' Populate the UI controls using the DataSource. To customize, override this method in PersonalInsigniaTableControlRow. + 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 + + SetGazetteDate() + SetGazetteNO() + SetGazettePage() + SetGazetteSection() + SetInsigniaDate() + SetInsigniaId() + SetInsigniaReturn() + + + + + + + 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 SetGazetteDate() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.GazetteDate.ID) Then + + Me.GazetteDate.Text = Me.PreviousUIData(Me.GazetteDate.ID).ToString() + + Return + End If + + + ' Set the GazetteDate TextBox on the webpage with value from the + ' PersonalInsignia database record. + + ' Me.DataSource is the PersonalInsignia record retrieved from the database. + ' Me.GazetteDate is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetGazetteDate() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.GazetteDateSpecified Then + + ' If the GazetteDate is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalInsigniaTable.GazetteDate, "d MMM yy") + + Me.GazetteDate.Text = formattedValue + + Else + + ' GazetteDate is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.GazetteDate.Text = PersonalInsigniaTable.GazetteDate.Format(PersonalInsigniaTable.GazetteDate.DefaultValue, "d MMM yy") + + End If + + End Sub + + Public Overridable Sub SetGazetteNO() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.GazetteNO.ID) Then + + Me.GazetteNO.Text = Me.PreviousUIData(Me.GazetteNO.ID).ToString() + + Return + End If + + + ' Set the GazetteNO TextBox on the webpage with value from the + ' PersonalInsignia database record. + + ' Me.DataSource is the PersonalInsignia record retrieved from the database. + ' Me.GazetteNO is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetGazetteNO() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.GazetteNOSpecified Then + + ' If the GazetteNO is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalInsigniaTable.GazetteNO) + + Me.GazetteNO.Text = formattedValue + + Else + + ' GazetteNO is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.GazetteNO.Text = PersonalInsigniaTable.GazetteNO.Format(PersonalInsigniaTable.GazetteNO.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetGazettePage() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.GazettePage.ID) Then + + Me.GazettePage.Text = Me.PreviousUIData(Me.GazettePage.ID).ToString() + + Return + End If + + + ' Set the GazettePage TextBox on the webpage with value from the + ' PersonalInsignia database record. + + ' Me.DataSource is the PersonalInsignia record retrieved from the database. + ' Me.GazettePage is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetGazettePage() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.GazettePageSpecified Then + + ' If the GazettePage is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalInsigniaTable.GazettePage) + + Me.GazettePage.Text = formattedValue + + Else + + ' GazettePage is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.GazettePage.Text = PersonalInsigniaTable.GazettePage.Format(PersonalInsigniaTable.GazettePage.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetGazetteSection() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.GazetteSection.ID) Then + + Me.GazetteSection.Text = Me.PreviousUIData(Me.GazetteSection.ID).ToString() + + Return + End If + + + ' Set the GazetteSection TextBox on the webpage with value from the + ' PersonalInsignia database record. + + ' Me.DataSource is the PersonalInsignia record retrieved from the database. + ' Me.GazetteSection is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetGazetteSection() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.GazetteSectionSpecified Then + + ' If the GazetteSection is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalInsigniaTable.GazetteSection) + + Me.GazetteSection.Text = formattedValue + + Else + + ' GazetteSection is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.GazetteSection.Text = PersonalInsigniaTable.GazetteSection.Format(PersonalInsigniaTable.GazetteSection.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetInsigniaDate() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.InsigniaDate.ID) Then + + Me.InsigniaDate.Text = Me.PreviousUIData(Me.InsigniaDate.ID).ToString() + + Return + End If + + + ' Set the InsigniaDate TextBox on the webpage with value from the + ' PersonalInsignia database record. + + ' Me.DataSource is the PersonalInsignia record retrieved from the database. + ' Me.InsigniaDate is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetInsigniaDate() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.InsigniaDateSpecified Then + + ' If the InsigniaDate is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalInsigniaTable.InsigniaDate, "d MMM yy") + + Me.InsigniaDate.Text = formattedValue + + Else + + ' InsigniaDate is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.InsigniaDate.Text = PersonalInsigniaTable.InsigniaDate.Format(PersonalInsigniaTable.InsigniaDate.DefaultValue, "d MMM yy") + + End If + + End Sub + + Public Overridable Sub SetInsigniaId() + + ' If selection was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.InsigniaId.ID) Then + If Me.PreviousUIData(Me.InsigniaId.ID) Is Nothing + Me.PopulateInsigniaIdDropDownList(Nothing, 100) + Else + Me.PopulateInsigniaIdDropDownList(Me.PreviousUIData(Me.InsigniaId.ID).ToString(), 100) + End If + Return + End If + + + ' Set the InsigniaId DropDownList on the webpage with value from the + ' PersonalInsignia database record. + + ' Me.DataSource is the PersonalInsignia record retrieved from the database. + ' Me.InsigniaId is the ASP:DropDownList on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetInsigniaId() + ' and add your own code before or after the call to the MyBase function. + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.InsigniaIdSpecified Then + + ' If the InsigniaId is non-NULL, then format the value. + ' The Format method will return the Display Foreign Key As (DFKA) value + Me.PopulateInsigniaIdDropDownList(Me.DataSource.InsigniaId.ToString(), 100) + + Else + + ' InsigniaId 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.PopulateInsigniaIdDropDownList(Nothing, 100) + Else + Me.PopulateInsigniaIdDropDownList(PersonalInsigniaTable.InsigniaId.DefaultValue, 100) + End If + + End If + + End Sub + + Public Overridable Sub SetInsigniaReturn() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.InsigniaReturn.ID) Then + + Me.InsigniaReturn.Text = Me.PreviousUIData(Me.InsigniaReturn.ID).ToString() + + Return + End If + + + ' Set the InsigniaReturn TextBox on the webpage with value from the + ' PersonalInsignia database record. + + ' Me.DataSource is the PersonalInsignia record retrieved from the database. + ' Me.InsigniaReturn is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetInsigniaReturn() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.InsigniaReturnSpecified Then + + ' If the InsigniaReturn is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalInsigniaTable.InsigniaReturn) + + Me.InsigniaReturn.Text = formattedValue + + Else + + ' InsigniaReturn is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.InsigniaReturn.Text = PersonalInsigniaTable.InsigniaReturn.Format(PersonalInsigniaTable.InsigniaReturn.DefaultValue) + + End If + + End Sub + + + Public EvaluateFormulaDelegate As BaseClasses.Data.DataSource.EvaluateFormulaDelegate = New BaseClasses.Data.DataSource.EvaluateFormulaDelegate(AddressOf Me.EvaluateFormula) + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean, ByVal e As FormulaEvaluator) As String + If e Is Nothing Then + e = New FormulaEvaluator() + End If + + e.Variables.Clear() + + + ' add variables for formula evaluation + If variables IsNot Nothing Then + Dim enumerator As System.Collections.Generic.IEnumerator(Of System.Collections.Generic.KeyValuePair(Of String, Object)) = variables.GetEnumerator() + While enumerator.MoveNext() + e.Variables.Add(enumerator.Current.Key, enumerator.Current.Value) + End While + End If + + If includeDS + + End IF + + + ' Other variables referred to in the formula are expected to be + ' properties of the DataSource. For example, referring to + ' UnitPrice as a variable will refer to DataSource.UnitPrice + If dataSourceForEvaluate Is Nothing Then + + e.DataSource = Me.DataSource + + Else + e.DataSource = dataSourceForEvaluate + End If + + ' Define the calling control. This is used to add other + ' related table and record controls as variables. + e.CallingControl = Me + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + + If Not String.IsNullOrEmpty(format) AndAlso (String.IsNullOrEmpty(formula) OrElse formula.IndexOf("Format(") < 0) Then + Return FormulaUtils.Format(resultObj, format) + Else + Return resultObj.ToString() + End If + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format,variables ,includeDS, Nothing) + End Function + + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object)) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format, variables ,True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, format, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal e as FormulaEvaluator) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, variables, True, e) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal includeDS as Boolean) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, includeDS, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, True, Nothing) + End Function + + + Public Overridable Sub RegisterPostback() + + + End Sub + + + + ' To customize, override this method in PersonalInsigniaTableControlRow. + 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 parentCtrl As PersonalIdRecordControl + + + parentCtrl = DirectCast(Me.Page.FindControlRecursively("PersonalIdRecordControl"), PersonalIdRecordControl) + + If (Not IsNothing(parentCtrl) AndAlso IsNothing(parentCtrl.DataSource)) + ' Load the record if it is not loaded yet. + parentCtrl.LoadData() + End If + If (IsNothing(parentCtrl) OrElse IsNothing(parentCtrl.DataSource)) + ' Get the error message from the application resource file. + Throw New Exception(Page.GetResourceValue("Err:NoParentRecId", "Persons")) + End If + + Me.DataSource.PersonalId = parentCtrl.DataSource.PersonalId + + ' 2. Perform any custom validation. + Me.Validate() + + + ' 3. Set the values in the record with data from UI controls. + ' This calls the Get() method for each of the user interface controls. + Me.GetUIData() + + ' 4. Save in the database. + ' We should not save the record if the data did not change. This + ' will save a database hit and avoid triggering any database triggers. + + If Me.DataSource.IsAnyValueChanged Then + ' Save record to database but do not commit yet. + ' Auto generated ids are available after saving for use by child (dependent) records. + Me.DataSource.Save() + + DirectCast(GetParentControlObject(Me, "PersonalInsigniaTableControl"), PersonalInsigniaTableControl).DataChanged = True + DirectCast(GetParentControlObject(Me, "PersonalInsigniaTableControl"), PersonalInsigniaTableControl).ResetData = True + End If + + + ' update session or cookie by formula + + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + ' For Master-Detail relationships, save data on the Detail table(s) + + End Sub + + ' To customize, override this method in PersonalInsigniaTableControlRow. + 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. + + GetGazetteDate() + GetGazetteNO() + GetGazettePage() + GetGazetteSection() + GetInsigniaDate() + GetInsigniaId() + GetInsigniaReturn() + End Sub + + + Public Overridable Sub GetGazetteDate() + + ' Retrieve the value entered by the user on the GazetteDate ASP:TextBox, and + ' save it into the GazetteDate field in DataSource PersonalInsignia 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.GazetteDate.Text, PersonalInsigniaTable.GazetteDate) + + + End Sub + + Public Overridable Sub GetGazetteNO() + + ' Retrieve the value entered by the user on the GazetteNO ASP:TextBox, and + ' save it into the GazetteNO field in DataSource PersonalInsignia record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.GazetteNO.Text, PersonalInsigniaTable.GazetteNO) + + + End Sub + + Public Overridable Sub GetGazettePage() + + ' Retrieve the value entered by the user on the GazettePage ASP:TextBox, and + ' save it into the GazettePage field in DataSource PersonalInsignia record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.GazettePage.Text, PersonalInsigniaTable.GazettePage) + + + End Sub + + Public Overridable Sub GetGazetteSection() + + ' Retrieve the value entered by the user on the GazetteSection ASP:TextBox, and + ' save it into the GazetteSection field in DataSource PersonalInsignia record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.GazetteSection.Text, PersonalInsigniaTable.GazetteSection) + + + End Sub + + Public Overridable Sub GetInsigniaDate() + + ' Retrieve the value entered by the user on the InsigniaDate ASP:TextBox, and + ' save it into the InsigniaDate field in DataSource PersonalInsignia 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.InsigniaDate.Text, PersonalInsigniaTable.InsigniaDate) + + + End Sub + + Public Overridable Sub GetInsigniaId() + + ' Retrieve the value entered by the user on the InsigniaId ASP:DropDownList, and + ' save it into the InsigniaId field in DataSource PersonalInsignia record. + + ' Custom validation should be performed in Validate, not here. + + Me.DataSource.Parse(GetValueSelectedPageRequest(Me.InsigniaId), PersonalInsigniaTable.InsigniaId) + + End Sub + + Public Overridable Sub GetInsigniaReturn() + + ' Retrieve the value entered by the user on the InsigniaReturn ASP:TextBox, and + ' save it into the InsigniaReturn field in DataSource PersonalInsignia record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.InsigniaReturn.Text, PersonalInsigniaTable.InsigniaReturn) + + + End Sub + + + ' To customize, override this method in PersonalInsigniaTableControlRow. + + Public Overridable Function CreateWhereClause() As WhereClause + + Return Nothing + + End Function + + + + ' To customize, override this method in PersonalInsigniaTableControlRow. + 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) + PersonalInsigniaTable.DeleteRecord(pkValue) + + DirectCast(GetParentControlObject(Me, "PersonalInsigniaTableControl"), PersonalInsigniaTableControl).DataChanged = True + DirectCast(GetParentControlObject(Me, "PersonalInsigniaTableControl"), PersonalInsigniaTableControl).ResetData = True + End Sub + + Protected Overridable Sub Control_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.PreRender + ' PreRender event is raised just before page is being displayed. + Try + DbUtils.StartTransaction() + Me.RegisterPostback() + + If Not Me.Page.ErrorOnPage AndAlso (Me.Page.IsPageRefresh OrElse Me.DataChanged OrElse Me.ResetData) Then + + + ' Re-load the data and update the web page if necessary. + ' This is typically done during a postback (filter, search button, sort, pagination button). + ' In each of the other click handlers, simply set DataChanged to True to reload the data. + Me.LoadData() + Me.DataBind() + End If + + + Catch ex As Exception + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + Finally + DbUtils.EndTransaction() + End Try + End Sub + + + Protected Overrides Sub SaveControlsToSession() + MyBase.SaveControlsToSession() + + + 'Save pagination state to session. + + End Sub + + + + Protected Overrides Sub ClearControlsFromSession() + MyBase.ClearControlsFromSession() + + + + ' Clear pagination state from session. + + End Sub + + Protected Overrides Sub LoadViewState(ByVal savedState As Object) + MyBase.LoadViewState(savedState) + Dim isNewRecord As String = CType(ViewState("IsNewRecord"), String) + If Not isNewRecord Is Nothing AndAlso isNewRecord.Trim <> "" Then + Me.IsNewRecord = Boolean.Parse(isNewRecord) + End If + + Dim myCheckSum As String = CType(ViewState("CheckSum"), String) + If Not myCheckSum Is Nothing AndAlso myCheckSum.Trim <> "" Then + Me.CheckSum = myCheckSum + End If + + + ' Load view state for pagination control. + + End Sub + + Protected Overrides Function SaveViewState() As Object + ViewState("IsNewRecord") = Me.IsNewRecord.ToString() + ViewState("CheckSum") = Me.CheckSum + + + ' Load view state for pagination control. + + Return MyBase.SaveViewState() + End Function + + + + Public Overridable Function CreateWhereClause_InsigniaIdDropDownList() 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 Insignia table. + ' Examples: + ' wc.iAND(InsigniaTable.InsigniaName, BaseFilter.ComparisonOperator.EqualsTo, "XYZ") + ' wc.iAND(InsigniaTable.Active, BaseFilter.ComparisonOperator.EqualsTo, "1") + + Dim wc As WhereClause = New WhereClause() + Return wc + + End Function + + + ' Fill the InsigniaId list. + Protected Overridable Sub PopulateInsigniaIdDropDownList( _ + ByVal selectedValue As String, _ + ByVal maxItems As Integer) + + Me.InsigniaId.Items.Clear() + + + ' 1. Setup the static list items + + ' Add the Please Select item. + Me.InsigniaId.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_InsigniaIdDropDownList function. + ' It is better to customize the where clause there. + + Dim wc As WhereClause = CreateWhereClause_InsigniaIdDropDownList() + ' Create the ORDER BY clause to sort based on the displayed value. + + + Dim orderBy As OrderBy = New OrderBy(false, false) + orderBy.Add(InsigniaTable.InsigniaName, 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 InsigniaRecord = 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 = InsigniaTable.GetRecords(wc, orderBy, pageNum, maxItems) + For each itemValue As InsigniaRecord In itemValues + ' Create the item and add to the list. + Dim cvalue As String = Nothing + Dim fvalue As String = Nothing + If itemValue.InsigniaIdSpecified Then + cvalue = itemValue.InsigniaId.ToString() + + If counter < maxItems AndAlso Me.InsigniaId.Items.FindByValue(cvalue) Is Nothing Then + + Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalInsigniaTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalInsigniaTable.InsigniaId) + If _isExpandableNonCompositeForeignKey AndAlso PersonalInsigniaTable.InsigniaId.IsApplyDisplayAs Then + fvalue = PersonalInsigniaTable.GetDFKA(itemValue, PersonalInsigniaTable.InsigniaId) + End If + If (Not _isExpandableNonCompositeForeignKey) Or (String.IsNullOrEmpty(fvalue)) Then + fvalue = itemValue.Format(InsigniaTable.InsigniaName) + 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.InsigniaId.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.InsigniaId.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.InsigniaId, selectedValue) AndAlso _ + Not SetSelectedDisplayText(Me.InsigniaId, selectedValue)Then + + ' construct a whereclause to query a record with Insignia.InsigniaId = selectedValue + Dim filter2 As CompoundFilter = New CompoundFilter(CompoundFilter.CompoundingOperators.And_Operator, Nothing) + Dim whereClause2 As WhereClause = New WhereClause() + filter2.AddFilter(New BaseClasses.Data.ColumnValueFilter(InsigniaTable.InsigniaId, selectedValue, BaseClasses.Data.BaseFilter.ComparisonOperator.EqualsTo, False)) + whereClause2.AddFilter(filter2, CompoundFilter.CompoundingOperators.And_Operator) + + Try + ' Execute the query + Dim rc() As InsigniaRecord = InsigniaTable.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 InsigniaRecord = DirectCast(rc(0), InsigniaRecord) + ' Create the item and add to the list. + Dim cvalue As String = Nothing + Dim fvalue As String = Nothing + If itemValue.InsigniaIdSpecified Then + cvalue = itemValue.InsigniaId.ToString() + Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalInsigniaTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalInsigniaTable.InsigniaId) + If _isExpandableNonCompositeForeignKey AndAlso PersonalInsigniaTable.InsigniaId.IsApplyDisplayAs Then + fvalue = PersonalInsigniaTable.GetDFKA(itemValue, PersonalInsigniaTable.InsigniaId) + End If + If (Not _isExpandableNonCompositeForeignKey) Or (String.IsNullOrEmpty(fvalue)) Then + fvalue = itemValue.Format(InsigniaTable.InsigniaName) + End If + + If fvalue Is Nothing OrElse fvalue.Trim() = "" Then fvalue = cvalue + Dim newItem As New ListItem(fvalue, cvalue) + Me.InsigniaId.Items.Add(newItem) + SetSelectedValue(Me.InsigniaId, selectedValue) + End If + End If + Catch + End Try + + End If + + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalInsigniaRowDeleteButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + If(Not Me.Page.IsPageRefresh) Then + + Dim tc As PersonalInsigniaTableControl = DirectCast(GetParentControlObject(Me, "PersonalInsigniaTableControl"), PersonalInsigniaTableControl) + If Not (IsNothing(tc)) Then + If Not Me.IsNewRecord Then + tc.AddToDeletedRecordIds(DirectCast(Me, PersonalInsigniaTableControlRow)) + End If + Me.Visible = False + tc.SetFormulaControls() + End If + + End If + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalInsigniaRowEditButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + ' The redirect URL is set on the Properties, Custom Properties or Actions. + ' The ModifyRedirectURL call resolves the parameters before the + ' Response.Redirect redirects the page to the URL. + ' Any code after the Response.Redirect call will not be executed, since the page is + ' redirected to the URL. + + + Dim url As String = "../Shared/ConfigureEditRecord.aspx" + + Dim shouldRedirect As Boolean = True + Dim TargetKey As String = Nothing + Dim DFKA As String = TargetKey + Dim id As String = DFKA + Dim value As String = id + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + url = Me.ModifyRedirectUrl(url, "",False) + url = Me.Page.ModifyRedirectUrl(url, "",False) + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + shouldRedirect = False + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + If shouldRedirect Then + Me.Page.ShouldSaveControlsToSession = True + Me.Page.Response.Redirect(url) + ElseIf Not TargetKey Is Nothing AndAlso _ + Not shouldRedirect Then + Me.Page.ShouldSaveControlsToSession = True + Me.Page.CloseWindow(True) + + End If + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalInsigniaRowViewButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + ' The redirect URL is set on the Properties, Custom Properties or Actions. + ' The ModifyRedirectURL call resolves the parameters before the + ' Response.Redirect redirects the page to the URL. + ' Any code after the Response.Redirect call will not be executed, since the page is + ' redirected to the URL. + + + Dim url As String = "../Shared/ConfigureViewRecord.aspx" + + Dim shouldRedirect As Boolean = True + Dim TargetKey As String = Nothing + Dim DFKA As String = TargetKey + Dim id As String = DFKA + Dim value As String = id + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + url = Me.ModifyRedirectUrl(url, "",False) + url = Me.Page.ModifyRedirectUrl(url, "",False) + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + shouldRedirect = False + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + If shouldRedirect Then + Me.Page.ShouldSaveControlsToSession = True + Me.Page.Response.Redirect(url) + ElseIf Not TargetKey Is Nothing AndAlso _ + Not shouldRedirect Then + Me.Page.ShouldSaveControlsToSession = True + Me.Page.CloseWindow(True) + + End If + End Sub + + Protected Overridable Sub InsigniaId_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()(InsigniaId.ClientID & "_SelectedValue"), String) + Dim displayText As String = CType(Me.Page.Session()(InsigniaId.ClientID & "_SelectedDisplayText"), String) + If displayText <> "" AndAlso val <> "" Then + Me.InsigniaId.Items.Add(New ListItem(displayText, val)) + Me.InsigniaId.SelectedIndex = Me.InsigniaId.Items.Count - 1 + Me.Page.Session.Remove(InsigniaId.ClientID & "_SelectedValue") + Me.Page.Session.Remove(InsigniaId.ClientID & "_SelectedDisplayText") + End If + + + + + End Sub + + Protected Overridable Sub GazetteDate_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub GazetteNO_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub GazettePage_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub GazetteSection_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub InsigniaDate_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub InsigniaReturn_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("BasePersonalInsigniaTableControlRow_Rec"), String) + End Get + Set(ByVal value As String) + Me.ViewState("BasePersonalInsigniaTableControlRow_Rec") = value + End Set + End Property + + Private _DataSource As PersonalInsigniaRecord + Public Property DataSource() As PersonalInsigniaRecord + Get + Return Me._DataSource + End Get + + Set(ByVal value As PersonalInsigniaRecord) + + Me._DataSource = value + End Set + End Property + + + + Private _checkSum As String + Public Overridable Property CheckSum() As String + Get + Return Me._checkSum + End Get + Set(ByVal value As String) + Me._checkSum = value + End Set + End Property + + Private _TotalPages As Integer + Public Property TotalPages() As Integer + Get + Return Me._TotalPages + End Get + Set(ByVal value As Integer) + Me._TotalPages = value + End Set + End Property + + Private _PageIndex As Integer + Public Property PageIndex() As Integer + Get + ' Return the PageIndex + Return Me._PageIndex + End Get + Set(ByVal value As Integer) + Me._PageIndex = value + End Set + End Property + + Private _DisplayLastPage As Boolean + Public Property DisplayLastPage() As Boolean + Get + Return Me._DisplayLastPage + End Get + Set(ByVal value As Boolean) + Me._DisplayLastPage = value + End Set + End Property + + + +#Region "Helper Properties" + + Public ReadOnly Property GazetteDate() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "GazetteDate"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property GazetteNO() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "GazetteNO"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property GazettePage() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "GazettePage"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property GazetteSection() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "GazetteSection"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property InsigniaDate() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "InsigniaDate"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property InsigniaId() As System.Web.UI.WebControls.DropDownList + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "InsigniaId"), System.Web.UI.WebControls.DropDownList) + End Get + End Property + + Public ReadOnly Property InsigniaReturn() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "InsigniaReturn"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property PersonalInsigniaRecordRowSelection() As System.Web.UI.WebControls.CheckBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalInsigniaRecordRowSelection"), System.Web.UI.WebControls.CheckBox) + End Get + End Property + + Public ReadOnly Property PersonalInsigniaRowDeleteButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalInsigniaRowDeleteButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalInsigniaRowEditButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalInsigniaRowEditButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalInsigniaRowViewButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalInsigniaRowViewButton"), System.Web.UI.WebControls.ImageButton) + 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 PersonalInsigniaRecord = 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 PersonalInsigniaRecord + If Not Me.DataSource Is Nothing Then + Return Me.DataSource + End If + + If Not Me.RecordUniqueId Is Nothing Then + + Return PersonalInsigniaTable.GetRecord(Me.RecordUniqueId, True) + + End If + + ' Localization. + + Return Nothing + + End Function + + Public Shadows ReadOnly Property Page() As BaseApplicationPage + Get + Return DirectCast(MyBase.Page, BaseApplicationPage) + End Get + End Property + +#End Region + +End Class + + + +' Base class for the PersonalInsigniaTableControl control on the EditPersonalId page. +' Do not modify this class. Instead override any method in PersonalInsigniaTableControl. +Public Class BasePersonalInsigniaTableControl + Inherits Persons.UI.BaseApplicationTableControl + + + + Protected Overridable Sub Control_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Init + + + + ' Setup the filter and search events. + + + + ' Control Initializations. + ' Initialize the table's current sort order. + + If Me.InSession(Me, "Order_By") Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + Me.CurrentSortOrder.Add(PersonalInsigniaTable.InsigniaDate, OrderByItem.OrderDir.Asc) + + End If + + + + ' Setup default pagination settings. + + Me.PageSize = CInt(Me.GetFromSession(Me, "Page_Size", "10")) + Me.PageIndex = CInt(Me.GetFromSession(Me, "Page_Index", "0")) + + + + Me.ClearControlsFromSession() + End Sub + + Protected Overridable Sub Control_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load + + SaveControlsToSession_Ajax() + + ' Show confirmation message on Click + Me.PersonalInsigniaDeleteButton.Attributes.Add("onClick", "return (confirm('" & (CType(Me.Page,BaseApplicationPage)).GetResourceValue("DeleteConfirm", "Persons") & "'));") + + ' Setup the pagination events. + + AddHandler Me.PersonalInsigniaPagination.FirstPage.Click, AddressOf PersonalInsigniaPagination_FirstPage_Click + + AddHandler Me.PersonalInsigniaPagination.LastPage.Click, AddressOf PersonalInsigniaPagination_LastPage_Click + + AddHandler Me.PersonalInsigniaPagination.NextPage.Click, AddressOf PersonalInsigniaPagination_NextPage_Click + + AddHandler Me.PersonalInsigniaPagination.PageSizeButton.Click, AddressOf PersonalInsigniaPagination_PageSizeButton_Click + + AddHandler Me.PersonalInsigniaPagination.PreviousPage.Click, AddressOf PersonalInsigniaPagination_PreviousPage_Click + + + ' Setup the sorting events. + + AddHandler Me.GazetteDateLabel.Click, AddressOf GazetteDateLabel_Click + + AddHandler Me.GazetteNOLabel.Click, AddressOf GazetteNOLabel_Click + + AddHandler Me.GazettePageLabel.Click, AddressOf GazettePageLabel_Click + + AddHandler Me.GazetteSectionLabel.Click, AddressOf GazetteSectionLabel_Click + + AddHandler Me.InsigniaDateLabel1.Click, AddressOf InsigniaDateLabel1_Click + + AddHandler Me.InsigniaIdLabel1.Click, AddressOf InsigniaIdLabel1_Click + + AddHandler Me.InsigniaReturnLabel.Click, AddressOf InsigniaReturnLabel_Click + + ' Setup the button events. + + AddHandler Me.PersonalInsigniaAddButton.Click, AddressOf PersonalInsigniaAddButton_Click + + AddHandler Me.PersonalInsigniaDeleteButton.Click, AddressOf PersonalInsigniaDeleteButton_Click + + AddHandler Me.PersonalInsigniaEditButton.Click, AddressOf PersonalInsigniaEditButton_Click + + AddHandler Me.PersonalInsigniaResetButton.Click, AddressOf PersonalInsigniaResetButton_Click + + + ' Setup events for others + + End Sub + + + Public Overridable Sub LoadData() + + ' Read data from database. Returns an array of records that can be assigned + ' to the DataSource table control property. + Try + Dim joinFilter As CompoundFilter = CreateCompoundJoinFilter() + + ' The WHERE clause will be empty when displaying all records in table. + Dim wc As WhereClause = CreateWhereClause() + If wc IsNot Nothing AndAlso Not wc.RunQuery Then + ' Initialize an empty array of records + Dim alist As New ArrayList(0) + Me.DataSource = DirectCast(alist.ToArray(GetType(PersonalInsigniaRecord)), PersonalInsigniaRecord()) + ' Add records to the list if needed. + Me.AddNewRecords() + Me._TotalRecords = 0 + Me._TotalPages = 0 + Return + End If + + ' Call OrderBy to determine the order - either use the order defined + ' on the Query Wizard, or specified by user (by clicking on column heading) + Dim orderBy As OrderBy = CreateOrderBy() + + ' Get the pagesize from the pagesize control. + Me.GetPageSize() + + If Me.DisplayLastPage Then + Dim totalRecords As Integer = If(Me._TotalRecords < 0, PersonalInsigniaTable.GetRecordCount(CreateCompoundJoinFilter(), CreateWhereClause()), Me._TotalRecords) + + Dim totalPages As Integer = CInt(Math.Ceiling(totalRecords / Me.PageSize)) + + Me.PageIndex = totalPages - 1 + End If + + ' Make sure PageIndex (current page) and PageSize are within bounds. + If Me.PageIndex < 0 Then + Me.PageIndex = 0 + End If + If Me.PageSize < 1 Then + Me.PageSize = 1 + End If + + ' Retrieve the records and set the table DataSource. + ' Only PageSize records are fetched starting at PageIndex (zero based). + If Me.AddNewRecord > 0 Then + ' Make sure to preserve the previously entered data on new rows. + Dim postdata As New ArrayList + For Each rc As PersonalInsigniaTableControlRow In Me.GetRecordControls() + If Not rc.IsNewRecord Then + rc.DataSource = rc.GetRecord() + rc.GetUIData() + postdata.Add(rc.DataSource) + UIData.Add(rc.PreservedUIData()) + End If + Next + Me.DataSource = DirectCast(postdata.ToArray(GetType(PersonalInsigniaRecord)), PersonalInsigniaRecord()) + Else ' Get the records from the database + Me.DataSource = PersonalInsigniaTable.GetRecords(joinFilter, wc, orderBy, Me.PageIndex, Me.PageSize) + + End If + + ' if the datasource contains no records contained in database, then load the last page. + If (DbUtils.GetCreatedRecords(Me.DataSource).Length = 0 AndAlso Not Me.DisplayLastPage) Then + Me.DisplayLastPage = True + LoadData() + Else + + ' Add any new rows desired by the user. + Me.AddNewRecords() + + ' Turn off the ToggleAll checkbox + Me.PersonalInsigniaToggleAll.Checked = False + + + ' Initialize the page and grand totals. now + + End If + + Catch ex As Exception + ' Report the error message to the end user + Dim msg As String = ex.Message + If ex.InnerException IsNot Nothing Then + msg = msg & " InnerException: " & ex.InnerException.Message + End If + Throw New Exception(msg, ex.InnerException) + End Try + End Sub + + + + + Public Overrides Sub DataBind() + ' The DataBind method binds the user interface controls to the values + ' from the database record for each row in the table. To do this, it calls the + ' DataBind for each of the rows. + ' DataBind also populates any filters above the table, and sets the pagination + ' control to the correct number of records and the current page number. + + MyBase.DataBind() + + ' Make sure that the DataSource is initialized. + If Me.DataSource Is Nothing Then + Return + End If + + 'LoadData for DataSource for chart and report if they exist + + ' Improve performance by prefetching display as records. + Me.PreFetchForeignKeyValues() + + ' Setup the pagination controls. + BindPaginationControls() + + + + ' Bind the repeater with the list of records to expand the UI. + Dim rep As System.Web.UI.WebControls.Repeater = CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalInsigniaTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return + rep.DataSource = DataSource() + rep.DataBind() + + Dim index As Integer = 0 + For Each repItem As System.Web.UI.WebControls.RepeaterItem In rep.Items + ' Loop through all rows in the table, set its DataSource and call DataBind(). + Dim recControl As PersonalInsigniaTableControlRow = DirectCast(repItem.FindControl("PersonalInsigniaTableControlRow"), PersonalInsigniaTableControlRow) + recControl.DataSource = Me.DataSource(index) + If Me.UIData.Count > index Then + recControl.PreviousUIData = Me.UIData(index) + End If + recControl.DataBind() + recControl.Visible = Not Me.InDeletedRecordIds(recControl) + + index += 1 + Next + + + + + ' Call the Set methods for each controls on the panel + + SetGazetteDateLabel() + SetGazetteNOLabel() + SetGazettePageLabel() + SetGazetteSectionLabel() + SetInsigniaDateLabel1() + SetInsigniaIdLabel1() + SetInsigniaReturnLabel() + + + + + + SetPersonalInsigniaTableControlCollapsibleRegion() + + ' setting the state of expand or collapse alternative rows + + + ' Load data for each record and table UI control. + ' Ordering is important because child controls get + ' their parent ids from their parent UI controls. + + + ' this method calls the set method for controls with special formula like running total, sum, rank, etc + SetFormulaControls() + End Sub + + Public Overridable Sub SetFormulaControls() + ' this method calls Set methods for the control that has special formula + + + + End Sub + + + Public Sub PreFetchForeignKeyValues() + If (IsNothing(Me.DataSource)) + Return + End If + + Me.Page.PregetDfkaRecords(PersonalInsigniaTable.InsigniaId, Me.DataSource) + + End Sub + + + Public Overridable Sub RegisterPostback() + + + End Sub + + Public EvaluateFormulaDelegate As BaseClasses.Data.DataSource.EvaluateFormulaDelegate = New BaseClasses.Data.DataSource.EvaluateFormulaDelegate(AddressOf Me.EvaluateFormula) + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean, ByVal e as FormulaEvaluator) As String + If e Is Nothing + e = New FormulaEvaluator() + End If + + e.Variables.Clear() + + + ' add variables for formula evaluation + If variables IsNot Nothing Then + Dim enumerator As System.Collections.Generic.IEnumerator(Of System.Collections.Generic.KeyValuePair(Of String, Object)) = variables.GetEnumerator() + While enumerator.MoveNext() + e.Variables.Add(enumerator.Current.Key, enumerator.Current.Value) + End While + End If + + If includeDS + + End If + + ' All variables referred to in the formula are expected to be + ' properties of the DataSource. For example, referring to + ' UnitPrice as a variable will refer to DataSource.UnitPrice + e.DataSource = dataSourceForEvaluate + + ' Define the calling control. This is used to add other + ' related table and record controls as variables. + e.CallingControl = Me + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + + If Not String.IsNullOrEmpty(format) AndAlso (String.IsNullOrEmpty(formula) OrElse formula.IndexOf("Format(") < 0) Then + Return FormulaUtils.Format(resultObj, format) + Else + Return resultObj.ToString() + End If + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format,variables ,includeDS, Nothing) + End Function + + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object)) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format, variables ,True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, format, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal e as FormulaEvaluator) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, variables, True, e) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal includeDS as Boolean) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, includeDS, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, True, Nothing) + End Function + + + + + Public Overridable Sub ResetControl() + + Me.CurrentSortOrder.Reset() + If (Me.InSession(Me, "Order_By")) Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + Me.CurrentSortOrder.Add(PersonalInsigniaTable.InsigniaDate, OrderByItem.OrderDir.Asc) + + End If + + Me.PageIndex = 0 + End Sub + + Protected Overridable Sub BindPaginationControls() + ' Setup the pagination controls. + + ' Bind the pagination labels. + + If DbUtils.GetCreatedRecords(Me.DataSource).Length > 0 Then + + Me.PersonalInsigniaPagination.CurrentPage.Text = (Me.PageIndex + 1).ToString() + Else + Me.PersonalInsigniaPagination.CurrentPage.Text = "0" + End If + Me.PersonalInsigniaPagination.PageSize.Text = Me.PageSize.ToString() + Me.PersonalInsigniaPagination.TotalItems.Text = Me.TotalRecords.ToString() + Me.PersonalInsigniaPagination.TotalPages.Text = Me.TotalPages.ToString() + + ' Bind the buttons for PersonalInsigniaTableControl pagination. + + Me.PersonalInsigniaPagination.FirstPage.Enabled = Not (Me.PageIndex = 0) + If Me._TotalPages < 0 Then ' if the total pages is not determined yet, enable last and next buttons + Me.PersonalInsigniaPagination.LastPage.Enabled = True + ElseIf Me._TotalPages = 0 ' if the total pages is determined and it is 0, enable last and next buttons + Me.PersonalInsigniaPagination.LastPage.Enabled = False + Else ' if the total pages is the last page, disable last and next buttons + Me.PersonalInsigniaPagination.LastPage.Enabled = Not (Me.PageIndex = Me.TotalPages - 1) + End If + + If Me._TotalPages < 0 Then ' if the total pages is not determined yet, enable last and next buttons + Me.PersonalInsigniaPagination.NextPage.Enabled = True + ElseIf Me._TotalPages = 0 ' if the total pages is determined and it is 0, enable last and next buttons + Me.PersonalInsigniaPagination.NextPage.Enabled = False + Else ' if the total pages is the last page, disable last and next buttons + Me.PersonalInsigniaPagination.NextPage.Enabled = Not (Me.PageIndex = Me.TotalPages - 1) + End If + + Me.PersonalInsigniaPagination.PreviousPage.Enabled = Not (Me.PageIndex = 0) + + + End Sub + + Public Overridable Sub SaveData() + ' Save the data from the entire table. Calls each row's Save Data + ' to save their data. This function is called by the Click handler of the + ' Save button. The button handler should Start/Commit/End a transaction. + + Dim recCtl As PersonalInsigniaTableControlRow + For Each recCtl In Me.GetRecordControls() + + If Me.InDeletedRecordIds(recCtl) Then + ' Delete any pending deletes. + recCtl.Delete() + Else + If recCtl.Visible Then + recCtl.SaveData() + End If + End If + + Next + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + ' Set IsNewRecord to False for all records - since everything has been saved and is no longer "new" + For Each recCtl In Me.GetRecordControls() + recCtl.IsNewRecord = False + Next + + + ' Set DeletedRecordsIds to Nothing since we have deleted all pending deletes. + Me.DeletedRecordIds = Nothing + + End Sub + + Public Overridable Function CreateCompoundJoinFilter() As CompoundFilter + Dim jFilter As CompoundFilter = New CompoundFilter() + + Return jFilter + + End Function + + + Public Overridable Function CreateOrderBy() As OrderBy + ' The CurrentSortOrder is initialized to the sort order on the + ' Query Wizard. It may be modified by the Click handler for any of + ' the column heading to sort or reverse sort by that column. + ' You can add your own sort order, or modify it on the Query Wizard. + Return Me.CurrentSortOrder + End Function + + Public Overridable Function CreateWhereClause() As WhereClause + 'This CreateWhereClause is used for loading the data. + PersonalInsigniaTable.Instance.InnerFilter = Nothing + Dim wc As WhereClause = New WhereClause() + + ' Compose the WHERE clause consiting of: + ' 1. Static clause defined at design time. + ' 2. User selected search criteria. + ' 3. User selected filter criteria. + + + Dim selectedRecordKeyValue as KeyValue = New KeyValue() + + Dim personalIdRecordControlObj As Persons.UI.Controls.EditPersonalId.PersonalIdRecordControl = DirectCast(MiscUtils.FindControlRecursively(Me.Page, "PersonalIdRecordControl"), Persons.UI.Controls.EditPersonalId.PersonalIdRecordControl) + + If (Not IsNothing(personalIdRecordControlObj) AndAlso Not IsNothing(personalIdRecordControlObj.GetRecord()) AndAlso personalIdRecordControlObj.GetRecord().IsCreated AndAlso Not IsNothing(personalIdRecordControlObj.GetRecord().PersonalId)) + wc.iAND(PersonalInsigniaTable.PersonalId, BaseFilter.ComparisonOperator.EqualsTo, personalIdRecordControlObj.GetRecord().PersonalId.ToString()) + selectedRecordKeyValue.AddElement(PersonalInsigniaTable.PersonalId.InternalName, personalIdRecordControlObj.GetRecord().PersonalId.ToString()) + Else + wc.RunQuery = False + Return wc + End If + + HttpContext.Current.Session("PersonalInsigniaTableControlWhereClause") = selectedRecordKeyValue.ToXmlString() + + Return wc + End Function + + + Public Overridable Function CreateWhereClause(ByVal searchText as String, ByVal fromSearchControl as String, ByVal AutoTypeAheadSearch as String, ByVal AutoTypeAheadWordSeparators as String) As WhereClause + ' This CreateWhereClause is used for loading list of suggestions for Auto Type-Ahead feature. + PersonalInsigniaTable.Instance.InnerFilter = Nothing + Dim wc As WhereClause = New WhereClause() + + ' Compose the WHERE clause consiting of: + ' 1. Static clause defined at design time. + ' 2. User selected search criteria. + ' 3. User selected filter criteria. + + Dim appRelativeVirtualPath As String = CType(HttpContext.Current.Session("AppRelativeVirtualPath"), String) + + Dim selectedRecordInPersonalIdRecordControl as String = DirectCast(HttpContext.Current.Session("PersonalInsigniaTableControlWhereClause"), String) + + If Not selectedRecordInPersonalIdRecordControl Is Nothing AndAlso KeyValue.IsXmlKey(selectedRecordInPersonalIdRecordControl) Then + Dim selectedRecordKeyValue as KeyValue = KeyValue.XmlToKey(selectedRecordInPersonalIdRecordControl) + + If Not IsNothing(selectedRecordKeyValue) AndAlso selectedRecordKeyValue.ContainsColumn(PersonalInsigniaTable.PersonalId) Then + wc.iAND(PersonalInsigniaTable.PersonalId, BaseFilter.ComparisonOperator.EqualsTo, selectedRecordKeyValue.GetColumnValue(PersonalInsigniaTable.PersonalId).ToString()) + End If + + End If + + ' Adds clauses if values are selected in Filter controls which are configured in the page. + + + Return wc + End Function + + + Public Overridable Function FormatSuggestions(ByVal prefixText As String, ByVal resultItem As String, _ + ByVal columnLength As Integer, ByVal AutoTypeAheadDisplayFoundText As String, _ + ByVal autoTypeAheadSearch As String, ByVal AutoTypeAheadWordSeparators As String, _ + ByVal resultList As ArrayList) As Boolean + + 'Formats the resultItem and adds it to the list of suggestions. + Dim index As Integer = resultItem.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture).IndexOf(prefixText.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture)) + Dim itemToAdd As String = "" + Dim isFound As Boolean = False + Dim isAdded As Boolean = False + ' Get the index where prfixt is at the beginning of resultItem. If not found then, index of word which begins with prefixText. + If InvariantLCase(autoTypeAheadSearch).equals("wordsstartingwithsearchstring") And Not index = 0 Then + ' Expression to find word which contains AutoTypeAheadWordSeparators followed by prefixText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex( AutoTypeAheadWordSeparators + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + If regex1.IsMatch(resultItem) Then + index = regex1.Match(resultItem).Index + isFound = True + End If + ' If the prefixText is found immediatly after white space then starting of the word is found so don not search any further + If not resultItem(index).ToString() = " " Then + ' Expression to find beginning of the word which contains AutoTypeAheadWordSeparators followed by prefixText + Dim regex As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\\S*" + AutoTypeAheadWordSeparators + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + If regex.IsMatch(resultItem) Then + index = regex.Match(resultItem).Index + isFound = True + End If + End If + End If + + ' If autoTypeAheadSearch value is wordsstartingwithsearchstring then, extract the substring only if the prefixText is found at the + ' beginning of the resultItem (index = 0) or a word in resultItem is found starts with prefixText. + If index = 0 Or isFound Or InvariantLCase(autoTypeAheadSearch).Equals("anywhereinstring") then + If InvariantLCase(AutoTypeAheadDisplayFoundText).equals("atbeginningofmatchedstring") Then + ' Expression to find beginning of the word which contains prefixText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\\S*" + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + ' Find the beginning of the word which contains prefexText + If (StringUtils.InvariantLCase(autoTypeAheadSearch).Equals("anywhereinstring") AndAlso regex1.IsMatch(resultItem)) Then + index = regex1.Match(resultItem).Index + isFound = True + End If + ' Display string from the index till end of the string if sub string from index till end is less than columnLength value. + If Len(resultItem) - index <= columnLength Then + If index = 0 Then + itemToAdd = resultItem + Else + itemToAdd = "..." & resultItem.Substring(index, Len(resultItem) - index) + End If + Else + If index = 0 Then + itemToAdd = resultItem.Substring(index, (columnLength - 3)) & "..." + Else + 'Truncate the string to show only columnLength - 6 characters as begining and trailing "..." has to be appended. + itemToAdd = "..." & resultItem.Substring(index , columnLength - 6) & "..." + End If + End If + ElseIf InvariantLCase(AutoTypeAheadDisplayFoundText).equals("inmiddleofmatchedstring") Then + Dim subStringBeginIndex As Integer = CType(columnLength/2, Integer) + If Len(resultItem) <= columnLength Then + itemToAdd = resultItem + Else + ' Sanity check at end of the string + If index + Len(prefixText) = columnLength Then + itemToAdd = "..." & resultItem.Substring(index-columnLength,index) + ElseIf Len(resultItem) - index < subStringBeginIndex Then + ' Display string from the end till columnLength value if, index is closer to the end of the string. + itemToAdd = "..." & resultItem.Substring(Len(resultItem)-columnLength,Len(resultItem)) + ElseIf index <= subStringBeginIndex Then + ' Sanity chet at beginning of the string + itemToAdd = resultItem.Substring(0, columnLength) & "..." + Else + ' Display string containing text before the prefixText occures and text after the prefixText + itemToAdd = "..." & resultItem.Substring(index - subStringBeginIndex, columnLength) & "..." + End If + End If + ElseIf InvariantLCase(AutoTypeAheadDisplayFoundText).equals("atendofmatchedstring") Then + ' Expression to find ending of the word which contains prefexText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\s", System.Text.RegularExpressions.RegexOptions.IgnoreCase) + ' Find the ending of the word which contains prefexText + If regex1.IsMatch(resultItem, index + 1) Then + index = regex1.Match(resultItem, index + 1).Index + Else + ' If the word which contains prefexText is the last word in string, regex1.IsMatch returns false. + index = resultItem.Length + End If + If index > Len(resultItem) Then + index = Len(resultItem) + End If + ' If text from beginning of the string till index is less than columnLength value then, display string from the beginning till index. + If index <= columnLength Then + if index = Len(resultItem) Then 'Make decision to append "..." + itemToAdd = resultItem.Substring(0,index) + Else + itemToAdd = resultItem.Substring(0,index) & "..." + End If + Else + If index = Len(resultItem) Then + itemToAdd = "..." & resultItem.Substring(index - (columnLength - 3), (columnLength - 3)) + Else + 'Truncate the string to show only columnLength - 6 characters as begining and trailing "..." has to be appended. + itemToAdd = "..." & resultItem.Substring(index - (columnLength - 6), columnLength - 6) & "..." + End If + End If + End If + + ' Remove newline character from itemToAdd + Dim prefixTextIndex As Integer = itemToAdd.IndexOf(prefixText, StringComparison.CurrentCultureIgnoreCase) + ' If itemToAdd contains any newline after the search text then show text only till newline + Dim regex2 As System.Text.RegularExpressions.Regex = New System.Text.RegularExpressions.Regex("(" & vbCrLf & "|" & vbLf & ")", System.Text.RegularExpressions.RegexOptions.IgnoreCase) + Dim newLineIndexAfterPrefix As Integer = -1 + If regex2.IsMatch(itemToAdd, prefixTextIndex) Then + newLineIndexAfterPrefix = regex2.Match(itemToAdd, prefixTextIndex).Index + End If + If (newLineIndexAfterPrefix > -1) Then + If itemToAdd.EndsWith("...") Then + itemToAdd = (itemToAdd.Substring(0, newLineIndexAfterPrefix) + "...") + Else + itemToAdd = itemToAdd.Substring(0, newLineIndexAfterPrefix) + End If + End If + ' If itemToAdd contains any newline before search text then show text which comes after newline + Dim regex3 As System.Text.RegularExpressions.Regex = New System.Text.RegularExpressions.Regex("(" & vbCrLf & "|" & vbLf & ")", (System.Text.RegularExpressions.RegexOptions.IgnoreCase Or System.Text.RegularExpressions.RegexOptions.RightToLeft)) + Dim newLineIndexBeforePrefix As Integer = -1 + If regex3.IsMatch(itemToAdd, prefixTextIndex) Then + newLineIndexBeforePrefix = regex3.Match(itemToAdd, prefixTextIndex).Index + End If + If (newLineIndexBeforePrefix > -1) Then + If itemToAdd.StartsWith("...") Then + itemToAdd = ("..." + itemToAdd.Substring((newLineIndexBeforePrefix + regex3.Match(itemToAdd, prefixTextIndex).Length))) + Else + itemToAdd = itemToAdd.Substring((newLineIndexBeforePrefix + regex3.Match(itemToAdd, prefixTextIndex).Length)) + End If + End If + + If Not itemToAdd is nothing AndAlso Not resultList.Contains(itemToAdd) Then + + resultList.Add(itemToAdd) + + isAdded = true + End If + End If + Return isAdded + End Function + + + Protected Overridable Sub GetPageSize() + + If Me.PersonalInsigniaPagination.PageSize.Text.Trim <> "" Then + Try + 'Me.PageSize = Integer.Parse(Me.PersonalInsigniaPagination.PageSize.Text) + Catch ex As Exception + End Try + End If + End Sub + + Protected Overridable Sub AddNewRecords() + + Dim newRecordList As ArrayList = New ArrayList() + + Dim newUIDataList As System.Collections.Generic.List(Of Hashtable) = New System.Collections.Generic.List(Of Hashtable)() + + ' Loop though all the record controls and if the record control + ' does not have a unique record id set, then create a record + ' and add to the list. + If Not Me.ResetData Then + Dim rep As System.Web.UI.WebControls.Repeater = CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalInsigniaTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return + + Dim repItem As System.Web.UI.WebControls.RepeaterItem + For Each repItem In rep.Items + ' Loop through all rows in the table, set its DataSource and call DataBind(). + + Dim recControl As PersonalInsigniaTableControlRow = DirectCast(repItem.FindControl("PersonalInsigniaTableControlRow"), PersonalInsigniaTableControlRow) + + If recControl.Visible AndAlso recControl.IsNewRecord() Then + + Dim rec As PersonalInsigniaRecord = New PersonalInsigniaRecord() + + If recControl.GazetteDate.Text <> "" Then + rec.Parse(recControl.GazetteDate.Text, PersonalInsigniaTable.GazetteDate) + End If + If recControl.GazetteNO.Text <> "" Then + rec.Parse(recControl.GazetteNO.Text, PersonalInsigniaTable.GazetteNO) + End If + If recControl.GazettePage.Text <> "" Then + rec.Parse(recControl.GazettePage.Text, PersonalInsigniaTable.GazettePage) + End If + If recControl.GazetteSection.Text <> "" Then + rec.Parse(recControl.GazetteSection.Text, PersonalInsigniaTable.GazetteSection) + End If + If recControl.InsigniaDate.Text <> "" Then + rec.Parse(recControl.InsigniaDate.Text, PersonalInsigniaTable.InsigniaDate) + End If + If MiscUtils.IsValueSelected(recControl.InsigniaId) Then + rec.Parse(recControl.InsigniaId.SelectedItem.Value, PersonalInsigniaTable.InsigniaId) + End If + If recControl.InsigniaReturn.Text <> "" Then + rec.Parse(recControl.InsigniaReturn.Text, PersonalInsigniaTable.InsigniaReturn) + End If + newUIDataList.Add(recControl.PreservedUIData()) + newRecordList.Add(rec) + End If + Next + End If + + + ' Add any new record to the list. + Dim index As Integer = 0 + For index = 1 To Me.AddNewRecord + + newRecordList.Insert(0, New PersonalInsigniaRecord()) + newUIDataList.Insert(0, New Hashtable()) + + Next + Me.AddNewRecord = 0 + + ' Finally, add any new records to the DataSource. + If newRecordList.Count > 0 Then + + Dim finalList As ArrayList = New ArrayList(Me.DataSource) + finalList.InsertRange(0, newRecordList) + + Me.DataSource = DirectCast(finalList.ToArray(GetType(PersonalInsigniaRecord)), PersonalInsigniaRecord()) + + End If + + ' Add the existing UI data to this hash table + If newUIDataList.Count > 0 Then + Me.UIData.InsertRange(0, newUIDataList) + End If + + End Sub + + + Public Sub AddToDeletedRecordIds(ByVal rec As PersonalInsigniaTableControlRow) + If rec.IsNewRecord() Then + Return + End If + + If Not Me.DeletedRecordIds Is Nothing AndAlso Me.DeletedRecordIds.Trim <> "" Then + Me.DeletedRecordIds &= "," + End If + + Me.DeletedRecordIds &= "[" & rec.RecordUniqueId & "]" + End Sub + + Protected Overridable Function InDeletedRecordIds(ByVal rec As PersonalInsigniaTableControlRow) As Boolean + If Me.DeletedRecordIds Is Nothing OrElse Me.DeletedRecordIds.Trim = "" Then + Return False + End If + + Return Me.DeletedRecordIds.IndexOf("[" & rec.RecordUniqueId & "]") >= 0 + End Function + + Private _DeletedRecordIds As String + Public Property DeletedRecordIds() As String + Get + Return Me._DeletedRecordIds + End Get + Set(ByVal value As String) + Me._DeletedRecordIds = value + End Set + End Property + + + ' Create Set, WhereClause, and Populate Methods + + Public Overridable Sub SetGazetteDateLabel() + + End Sub + + Public Overridable Sub SetGazetteNOLabel() + + End Sub + + Public Overridable Sub SetGazettePageLabel() + + End Sub + + Public Overridable Sub SetGazetteSectionLabel() + + End Sub + + Public Overridable Sub SetInsigniaDateLabel1() + + End Sub + + Public Overridable Sub SetInsigniaIdLabel1() + + End Sub + + Public Overridable Sub SetInsigniaReturnLabel() + + End Sub + + Public Overridable Sub SetPersonalInsigniaTableControlCollapsibleRegion() + + 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. + Dim added As Boolean = Me.AddNewRecord > 0 + Me.LoadData() + Me.DataBind() + + If added Then + Me.SetFocusToAddedRow() + End If + + End If + + + + Catch ex As Exception + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + Finally + DbUtils.EndTransaction + End Try + End Sub + + 'this function sets focus to the first editable element in the new added row in the editable table + Protected Overridable Sub SetFocusToAddedRow() + Dim rep As System.Web.UI.WebControls.Repeater = CType(Me.FindControl("PersonalInsigniaTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing OrElse rep.Items.Count = 0 Then Return + Dim repItem As System.Web.UI.WebControls.RepeaterItem + For Each repItem In rep.Items + 'Load scripts to table rows + Me.Page.LoadFocusScripts(repItem) + Dim recControl As PersonalInsigniaTableControlRow = DirectCast(repItem.FindControl("PersonalInsigniaTableControlRow"), PersonalInsigniaTableControlRow) + If recControl.IsNewRecord Then + For Each field As Control In recControl.Controls + If field.Visible AndAlso Me.Page.IsControlEditable(field, False) Then + 'set focus on the first editable field in the new row + field.Focus() + Dim updPan As UpdatePanel = DirectCast(Me.Page.FindControlRecursively("UpdatePanel1"), UpdatePanel) + If Not updPan Is Nothing Then updPan.Update() + Return + End If + Next + Return + End If + Next + End Sub + + + Protected Overrides Sub SaveControlsToSession() + MyBase.SaveControlsToSession() + + ' Save filter controls to values to session. + + + 'Save pagination state to session. + + + + ' Save table control properties to the session. + If Not Me.CurrentSortOrder Is Nothing Then + Me.SaveToSession(Me, "Order_By", Me.CurrentSortOrder.ToXmlString()) + End If + + Me.SaveToSession(Me, "Page_Index", Me.PageIndex.ToString()) + Me.SaveToSession(Me, "Page_Size", Me.PageSize.ToString()) + + Me.SaveToSession(Me, "DeletedRecordIds", Me.DeletedRecordIds) + + End Sub + + Protected Sub SaveControlsToSession_Ajax() + ' Save filter controls to values to session. + + HttpContext.Current.Session("AppRelativeVirtualPath") = Me.Page.AppRelativeVirtualPath + + End Sub + + Protected Overrides Sub ClearControlsFromSession() + MyBase.ClearControlsFromSession() + + ' Clear filter controls values from the session. + + + ' Clear pagination state from session. + + + + ' Clear table properties from the session. + Me.RemoveFromSession(Me, "Order_By") + Me.RemoveFromSession(Me, "Page_Index") + Me.RemoveFromSession(Me, "Page_Size") + + Me.RemoveFromSession(Me, "DeletedRecordIds") + + End Sub + + Protected Overrides Sub LoadViewState(ByVal savedState As Object) + MyBase.LoadViewState(savedState) + + Dim orderByStr As String = CType(ViewState("PersonalInsigniaTableControl_OrderBy"), String) + + If orderByStr IsNot Nothing AndAlso orderByStr.Trim <> "" Then + Me.CurrentSortOrder = BaseClasses.Data.OrderBy.FromXmlString(orderByStr) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + End If + + Dim pageIndex As String = CType(ViewState("Page_Index"), String) + If pageIndex IsNot Nothing Then + Me.PageIndex = CInt(pageIndex) + End If + + Dim pageSize As String = CType(ViewState("Page_Size"), String) + If Not pageSize Is Nothing Then + Me.PageSize = CInt(pageSize) + End If + + + + ' Load view state for pagination control. + + Me.DeletedRecordIds = CType(Me.ViewState("DeletedRecordIds"), String) + + End Sub + + Protected Overrides Function SaveViewState() As Object + + If Me.CurrentSortOrder IsNot Nothing Then + Me.ViewState("PersonalInsigniaTableControl_OrderBy") = Me.CurrentSortOrder.ToXmlString() + End If + + Me.ViewState("Page_Index") = Me.PageIndex + Me.ViewState("Page_Size") = Me.PageSize + + Me.ViewState("DeletedRecordIds") = Me.DeletedRecordIds + + + ' Load view state for pagination control. + + + Return MyBase.SaveViewState() + End Function + + ' Generate the event handling functions for pagination events. + + ' event handler for ImageButton + Public Overridable Sub PersonalInsigniaPagination_FirstPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.PageIndex = 0 + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalInsigniaPagination_LastPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.DisplayLastPage = True + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalInsigniaPagination_NextPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.PageIndex += 1 + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for LinkButton + Public Overridable Sub PersonalInsigniaPagination_PageSizeButton_Click(ByVal sender As Object, ByVal args As EventArgs) + + Try + + Me.DataChanged = True + + Me.PageSize = Integer.Parse(Me.PersonalInsigniaPagination.PageSize.Text) + + Me.PageIndex = Integer.Parse(Me.PersonalInsigniaPagination.CurrentPage.Text) - 1 + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalInsigniaPagination_PreviousPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + If Me.PageIndex > 0 Then + Me.PageIndex -= 1 + Me.DataChanged = True + End If + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + + ' Generate the event handling functions for sorting events. + + Public Overridable Sub GazetteDateLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by GazetteDate when clicked. + + ' Get previous sorting state for GazetteDate. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalInsigniaTable.GazetteDate) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for GazetteDate. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalInsigniaTable.GazetteDate, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by GazetteDate, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub GazetteNOLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by GazetteNO when clicked. + + ' Get previous sorting state for GazetteNO. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalInsigniaTable.GazetteNO) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for GazetteNO. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalInsigniaTable.GazetteNO, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by GazetteNO, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub GazettePageLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by GazettePage when clicked. + + ' Get previous sorting state for GazettePage. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalInsigniaTable.GazettePage) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for GazettePage. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalInsigniaTable.GazettePage, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by GazettePage, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub GazetteSectionLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by GazetteSection when clicked. + + ' Get previous sorting state for GazetteSection. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalInsigniaTable.GazetteSection) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for GazetteSection. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalInsigniaTable.GazetteSection, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by GazetteSection, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub InsigniaDateLabel1_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by InsigniaDate when clicked. + + ' Get previous sorting state for InsigniaDate. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalInsigniaTable.InsigniaDate) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for InsigniaDate. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalInsigniaTable.InsigniaDate, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by InsigniaDate, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub InsigniaIdLabel1_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by InsigniaId when clicked. + + ' Get previous sorting state for InsigniaId. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalInsigniaTable.InsigniaId) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for InsigniaId. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalInsigniaTable.InsigniaId, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by InsigniaId, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub InsigniaReturnLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by InsigniaReturn when clicked. + + ' Get previous sorting state for InsigniaReturn. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalInsigniaTable.InsigniaReturn) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for InsigniaReturn. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalInsigniaTable.InsigniaReturn, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by InsigniaReturn, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + + ' Generate the event handling functions for button events. + + ' event handler for ImageButton + Public Overridable Sub PersonalInsigniaAddButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + Me.AddNewRecord = 1 + Me.DataChanged = True + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalInsigniaDeleteButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + If(Not Me.Page.IsPageRefresh) Then + + Me.DeleteSelectedRecords(True) + Me.SetFormulaControls() + + + End If + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalInsigniaEditButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + ' The redirect URL is set on the Properties, Custom Properties or Actions. + ' The ModifyRedirectURL call resolves the parameters before the + ' Response.Redirect redirects the page to the URL. + ' Any code after the Response.Redirect call will not be executed, since the page is + ' redirected to the URL. + + + Dim url As String = "../Shared/ConfigureEditRecord.aspx" + + Dim shouldRedirect As Boolean = True + Dim TargetKey As String = Nothing + Dim DFKA As String = TargetKey + Dim id As String = DFKA + Dim value As String = id + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + url = Me.ModifyRedirectUrl(url, "",False) + url = Me.Page.ModifyRedirectUrl(url, "",False) + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + shouldRedirect = False + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + If shouldRedirect Then + Me.Page.ShouldSaveControlsToSession = True + Me.Page.Response.Redirect(url) + ElseIf Not TargetKey Is Nothing AndAlso _ + Not shouldRedirect Then + Me.Page.ShouldSaveControlsToSession = True + Me.Page.CloseWindow(True) + + End If + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalInsigniaResetButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.CurrentSortOrder.Reset() + If Me.InSession(Me, "Order_By") Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + Me.CurrentSortOrder.Add(PersonalInsigniaTable.InsigniaDate, OrderByItem.OrderDir.Asc) + + + End If + + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + + + ' Generate the event handling functions for filter and search events. + + + ' Generate the event handling functions for others + + + Private _UIData As New System.Collections.Generic.List(Of Hashtable) + Public Property UIData() As System.Collections.Generic.List(Of Hashtable) + Get + Return Me._UIData + End Get + Set(ByVal value As System.Collections.Generic.List(Of Hashtable)) + Me._UIData = value + End Set + End Property + + ' pagination properties + Protected _PageSize As Integer + Public Property PageSize() As Integer + Get + Return Me._PageSize + End Get + Set(ByVal value As Integer) + Me._PageSize = value + End Set + End Property + + Protected _PageIndex As Integer + Public Property PageIndex() As Integer + Get + ' Return the PageIndex + Return Me._PageIndex + End Get + Set(ByVal value As Integer) + Me._PageIndex = value + End Set + End Property + + Protected _TotalRecords As Integer = -1 + Public Property TotalRecords() As Integer + Get + If _TotalRecords < 0 + _TotalRecords = PersonalInsigniaTable.GetRecordCount(CreateCompoundJoinFilter(), CreateWhereClause()) + End If + Return Me._TotalRecords + End Get + Set(ByVal value As Integer) + If Me.PageSize > 0 Then + + Me.TotalPages = CInt(Math.Ceiling(value / Me.PageSize)) + + End If + Me._TotalRecords = value + End Set + End Property + + + + Protected _TotalPages As Integer = -1 + Public Property TotalPages() As Integer + Get + If _TotalPages < 0 Then + + Me.TotalPages = CInt(Math.Ceiling(TotalRecords / Me.PageSize)) + + End If + Return Me._TotalPages + End Get + Set(ByVal value As Integer) + Me._TotalPages = value + End Set + End Property + + Protected _DisplayLastPage As Boolean + Public Property DisplayLastPage() As Boolean + Get + Return Me._DisplayLastPage + End Get + Set(ByVal value As Boolean) + Me._DisplayLastPage = value + End Set + End Property + + Private _DataChanged As Boolean = False + Public Property DataChanged() As Boolean + Get + Return Me._DataChanged + End Get + Set(ByVal value As Boolean) + Me._DataChanged = value + End Set + End Property + + Private _ResetData As Boolean = False + Public Property ResetData() As Boolean + Get + Return Me._ResetData + End Get + Set(ByVal value As Boolean) + Me._ResetData = value + End Set + End Property + + Private _AddNewRecord As Integer = 0 + Public Property AddNewRecord() As Integer + Get + Return Me._AddNewRecord + End Get + Set(ByVal value As Integer) + Me._AddNewRecord = value + End Set + End Property + + + Private _CurrentSortOrder As OrderBy = Nothing + Public Property CurrentSortOrder() As OrderBy + Get + Return Me._CurrentSortOrder + End Get + Set(ByVal value As BaseClasses.Data.OrderBy) + Me._CurrentSortOrder = value + End Set + End Property + + Private _DataSource() As PersonalInsigniaRecord = Nothing + Public Property DataSource() As PersonalInsigniaRecord () + Get + Return Me._DataSource + End Get + Set(ByVal value() As PersonalInsigniaRecord) + Me._DataSource = value + End Set + End Property + +#Region "Helper Properties" + + Public ReadOnly Property GazetteDateLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "GazetteDateLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property GazetteNOLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "GazetteNOLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property GazettePageLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "GazettePageLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property GazetteSectionLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "GazetteSectionLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property InsigniaDateLabel1() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "InsigniaDateLabel1"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property InsigniaIdLabel1() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "InsigniaIdLabel1"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property InsigniaReturnLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "InsigniaReturnLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property PersonalInsigniaAddButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalInsigniaAddButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalInsigniaDeleteButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalInsigniaDeleteButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalInsigniaEditButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalInsigniaEditButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalInsigniaPagination() As Persons.UI.IPagination + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalInsigniaPagination"), Persons.UI.IPagination) + End Get + End Property + + Public ReadOnly Property PersonalInsigniaResetButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalInsigniaResetButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalInsigniaTableControlCollapsibleRegion() As System.Web.UI.WebControls.Panel + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalInsigniaTableControlCollapsibleRegion"), System.Web.UI.WebControls.Panel) + End Get + End Property + + Public ReadOnly Property PersonalInsigniaToggleAll() As System.Web.UI.WebControls.CheckBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalInsigniaToggleAll"), System.Web.UI.WebControls.CheckBox) + End Get + End Property + +#End Region + +#Region "Helper Functions" + + Public Overrides Overloads Function ModifyRedirectUrl(url As String, arg As String, ByVal bEncrypt As Boolean) As String + Return Me.Page.EvaluateExpressions(url, arg, bEncrypt, Me) + End Function + + Public Overrides Overloads Function EvaluateExpressions(url As String, arg As String, ByVal bEncrypt As Boolean) As String + Dim needToProcess As Boolean = AreAnyUrlParametersForMe(url, arg) + If (needToProcess) Then + Dim recCtl As PersonalInsigniaTableControlRow = Me.GetSelectedRecordControl() + If recCtl Is Nothing AndAlso url.IndexOf("{") >= 0 Then + ' Localization. + Throw New Exception(Page.GetResourceValue("Err:NoRecSelected", "Persons")) + End If + Dim rec As PersonalInsigniaRecord = Nothing + If recCtl IsNot Nothing Then + rec = recCtl.GetRecord() + End If + Return EvaluateExpressions(url, arg, rec, bEncrypt) + End If + Return url + End Function + + Public Overridable Function GetSelectedRecordIndex() As Integer + Dim counter As Integer = 0 + Dim recControl As PersonalInsigniaTableControlRow + For Each recControl In Me.GetRecordControls() + If recControl.PersonalInsigniaRecordRowSelection.Checked Then + Return counter + End If + counter += 1 + Next + Return -1 + End Function + + Public Overridable Function GetSelectedRecordControl() As PersonalInsigniaTableControlRow + Dim selectedList() As PersonalInsigniaTableControlRow = Me.GetSelectedRecordControls() + If selectedList.Length = 0 Then + Return Nothing + End If + Return selectedList(0) + + End Function + + Public Overridable Function GetSelectedRecordControls() As PersonalInsigniaTableControlRow() + + Dim selectedList As ArrayList = New ArrayList(25) + Dim recControl As PersonalInsigniaTableControlRow + For Each recControl In Me.GetRecordControls() + If recControl.PersonalInsigniaRecordRowSelection IsNot Nothing AndAlso recControl.PersonalInsigniaRecordRowSelection.Checked Then + selectedList.Add(recControl) + End If + Next + Return DirectCast(selectedList.ToArray(GetType(PersonalInsigniaTableControlRow)), PersonalInsigniaTableControlRow()) + + End Function + + Public Overridable Sub DeleteSelectedRecords(ByVal deferDeletion As Boolean) + Dim recList() As PersonalInsigniaTableControlRow = Me.GetSelectedRecordControls() + If recList.Length = 0 Then + ' Localization. + Throw New Exception(Page.GetResourceValue("Err:NoRecSelected", "Persons")) + End If + + Dim recCtl As PersonalInsigniaTableControlRow + For Each recCtl In recList + If deferDeletion Then + If Not recCtl.IsNewRecord Then + + Me.AddToDeletedRecordIds(recCtl) + + End If + recCtl.Visible = False + + recCtl.PersonalInsigniaRecordRowSelection.Checked = False + + Else + + recCtl.Delete() + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + End If + Next + End Sub + + Public Function GetRecordControls() As PersonalInsigniaTableControlRow() + Dim recList As ArrayList = New ArrayList() + Dim rep As System.Web.UI.WebControls.Repeater = CType(Me.FindControl("PersonalInsigniaTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return Nothing + Dim repItem As System.Web.UI.WebControls.RepeaterItem + + For Each repItem In rep.Items + + Dim recControl As PersonalInsigniaTableControlRow = DirectCast(repItem.FindControl("PersonalInsigniaTableControlRow"), PersonalInsigniaTableControlRow) + recList.Add(recControl) + + Next + + Return DirectCast(recList.ToArray(GetType(PersonalInsigniaTableControlRow)), PersonalInsigniaTableControlRow()) + End Function + + Public Shadows ReadOnly Property Page() As BaseApplicationPage + Get + Return DirectCast(MyBase.Page, BaseApplicationPage) + End Get + End Property + +#End Region + + + +End Class + + +' Base class for the PersonalLanguageSkillTableControlRow control on the EditPersonalId page. +' Do not modify this class. Instead override any method in PersonalLanguageSkillTableControlRow. +Public Class BasePersonalLanguageSkillTableControlRow + Inherits Persons.UI.BaseApplicationRecordControl + + ' To customize, override this method in PersonalLanguageSkillTableControlRow. + Protected Overridable Sub Control_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Init + + Me.ClearControlsFromSession() + End Sub + + ' To customize, override this method in PersonalLanguageSkillTableControlRow. + Protected Overridable Sub Control_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load + + 'Call LoadFocusScripts from repeater so that onfocus attribute could be added to elements + Me.Page.LoadFocusScripts(Me) + + ' Show confirmation message on Click + Me.PersonalLanguageSkillRowDeleteButton.Attributes.Add("onClick", "return (confirm('" & (CType(Me.Page,BaseApplicationPage)).GetResourceValue("DeleteRecordConfirm", "Persons") & "'));") + + + ' Register the event handlers. + + AddHandler Me.PersonalLanguageSkillRowDeleteButton.Click, AddressOf PersonalLanguageSkillRowDeleteButton_Click + + AddHandler Me.PersonalLanguageSkillRowEditButton.Click, AddressOf PersonalLanguageSkillRowEditButton_Click + + AddHandler Me.PersonalLanguageSkillRowViewButton.Click, AddressOf PersonalLanguageSkillRowViewButton_Click + + AddHandler Me.LanguageId.SelectedIndexChanged, AddressOf LanguageId_SelectedIndexChanged + + AddHandler Me.Level.TextChanged, AddressOf Level_TextChanged + + + End Sub + + + Public Overridable Sub LoadData() + + ' Load the data from the database into the DataSource PersonalLanguageSkill 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 = PersonalLanguageSkillTable.GetRecord(Me.RecordUniqueId, True) + + Return + End If + + ' Since this is a row in the table, the data for this row is loaded by the + ' LoadData method of the BasePersonalLanguageSkillTableControl when the data for the entire + ' table is loaded. + + Me.DataSource = New PersonalLanguageSkillRecord() + + + + End Sub + + ' Populate the UI controls using the DataSource. To customize, override this method in PersonalLanguageSkillTableControlRow. + 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 + + SetLanguageId() + SetLevel() + + + + + + + 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 SetLanguageId() + + ' If selection was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.LanguageId.ID) Then + If Me.PreviousUIData(Me.LanguageId.ID) Is Nothing + Me.PopulateLanguageIdDropDownList(Nothing, 100) + Else + Me.PopulateLanguageIdDropDownList(Me.PreviousUIData(Me.LanguageId.ID).ToString(), 100) + End If + Return + End If + + + ' Set the LanguageId DropDownList on the webpage with value from the + ' PersonalLanguageSkill database record. + + ' Me.DataSource is the PersonalLanguageSkill record retrieved from the database. + ' Me.LanguageId is the ASP:DropDownList on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetLanguageId() + ' and add your own code before or after the call to the MyBase function. + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.LanguageIdSpecified Then + + ' If the LanguageId is non-NULL, then format the value. + ' The Format method will return the Display Foreign Key As (DFKA) value + Me.PopulateLanguageIdDropDownList(Me.DataSource.LanguageId.ToString(), 100) + + Else + + ' LanguageId 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.PopulateLanguageIdDropDownList(Nothing, 100) + Else + Me.PopulateLanguageIdDropDownList(PersonalLanguageSkillTable.LanguageId.DefaultValue, 100) + End If + + End If + + End Sub + + Public Overridable Sub SetLevel() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.Level.ID) Then + + Me.Level.Text = Me.PreviousUIData(Me.Level.ID).ToString() + + Return + End If + + + ' Set the Level TextBox on the webpage with value from the + ' PersonalLanguageSkill database record. + + ' Me.DataSource is the PersonalLanguageSkill record retrieved from the database. + ' Me.Level is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetLevel() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.LevelSpecified Then + + ' If the Level is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalLanguageSkillTable.Level) + + Me.Level.Text = formattedValue + + Else + + ' Level is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.Level.Text = PersonalLanguageSkillTable.Level.Format(PersonalLanguageSkillTable.Level.DefaultValue) + + End If + + End Sub + + + Public EvaluateFormulaDelegate As BaseClasses.Data.DataSource.EvaluateFormulaDelegate = New BaseClasses.Data.DataSource.EvaluateFormulaDelegate(AddressOf Me.EvaluateFormula) + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean, ByVal e As FormulaEvaluator) As String + If e Is Nothing Then + e = New FormulaEvaluator() + End If + + e.Variables.Clear() + + + ' add variables for formula evaluation + If variables IsNot Nothing Then + Dim enumerator As System.Collections.Generic.IEnumerator(Of System.Collections.Generic.KeyValuePair(Of String, Object)) = variables.GetEnumerator() + While enumerator.MoveNext() + e.Variables.Add(enumerator.Current.Key, enumerator.Current.Value) + End While + End If + + If includeDS + + End IF + + + ' Other variables referred to in the formula are expected to be + ' properties of the DataSource. For example, referring to + ' UnitPrice as a variable will refer to DataSource.UnitPrice + If dataSourceForEvaluate Is Nothing Then + + e.DataSource = Me.DataSource + + Else + e.DataSource = dataSourceForEvaluate + End If + + ' Define the calling control. This is used to add other + ' related table and record controls as variables. + e.CallingControl = Me + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + + If Not String.IsNullOrEmpty(format) AndAlso (String.IsNullOrEmpty(formula) OrElse formula.IndexOf("Format(") < 0) Then + Return FormulaUtils.Format(resultObj, format) + Else + Return resultObj.ToString() + End If + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format,variables ,includeDS, Nothing) + End Function + + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object)) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format, variables ,True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, format, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal e as FormulaEvaluator) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, variables, True, e) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal includeDS as Boolean) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, includeDS, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, True, Nothing) + End Function + + + Public Overridable Sub RegisterPostback() + + + End Sub + + + + ' To customize, override this method in PersonalLanguageSkillTableControlRow. + 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 parentCtrl As PersonalIdRecordControl + + + parentCtrl = DirectCast(Me.Page.FindControlRecursively("PersonalIdRecordControl"), PersonalIdRecordControl) + + If (Not IsNothing(parentCtrl) AndAlso IsNothing(parentCtrl.DataSource)) + ' Load the record if it is not loaded yet. + parentCtrl.LoadData() + End If + If (IsNothing(parentCtrl) OrElse IsNothing(parentCtrl.DataSource)) + ' Get the error message from the application resource file. + Throw New Exception(Page.GetResourceValue("Err:NoParentRecId", "Persons")) + End If + + Me.DataSource.PersonalId = parentCtrl.DataSource.PersonalId + + ' 2. Perform any custom validation. + Me.Validate() + + + ' 3. Set the values in the record with data from UI controls. + ' This calls the Get() method for each of the user interface controls. + Me.GetUIData() + + ' 4. Save in the database. + ' We should not save the record if the data did not change. This + ' will save a database hit and avoid triggering any database triggers. + + If Me.DataSource.IsAnyValueChanged Then + ' Save record to database but do not commit yet. + ' Auto generated ids are available after saving for use by child (dependent) records. + Me.DataSource.Save() + + DirectCast(GetParentControlObject(Me, "PersonalLanguageSkillTableControl"), PersonalLanguageSkillTableControl).DataChanged = True + DirectCast(GetParentControlObject(Me, "PersonalLanguageSkillTableControl"), PersonalLanguageSkillTableControl).ResetData = True + End If + + + ' update session or cookie by formula + + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + ' For Master-Detail relationships, save data on the Detail table(s) + + End Sub + + ' To customize, override this method in PersonalLanguageSkillTableControlRow. + 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. + + GetLanguageId() + GetLevel() + End Sub + + + Public Overridable Sub GetLanguageId() + + ' Retrieve the value entered by the user on the LanguageId ASP:DropDownList, and + ' save it into the LanguageId field in DataSource PersonalLanguageSkill record. + + ' Custom validation should be performed in Validate, not here. + + Me.DataSource.Parse(GetValueSelectedPageRequest(Me.LanguageId), PersonalLanguageSkillTable.LanguageId) + + End Sub + + Public Overridable Sub GetLevel() + + ' Retrieve the value entered by the user on the Level ASP:TextBox, and + ' save it into the Level field in DataSource PersonalLanguageSkill record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.Level.Text, PersonalLanguageSkillTable.Level) + + + End Sub + + + ' To customize, override this method in PersonalLanguageSkillTableControlRow. + + Public Overridable Function CreateWhereClause() As WhereClause + + Return Nothing + + End Function + + + + ' To customize, override this method in PersonalLanguageSkillTableControlRow. + 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) + PersonalLanguageSkillTable.DeleteRecord(pkValue) + + DirectCast(GetParentControlObject(Me, "PersonalLanguageSkillTableControl"), PersonalLanguageSkillTableControl).DataChanged = True + DirectCast(GetParentControlObject(Me, "PersonalLanguageSkillTableControl"), PersonalLanguageSkillTableControl).ResetData = True + End Sub + + Protected Overridable Sub Control_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.PreRender + ' PreRender event is raised just before page is being displayed. + Try + DbUtils.StartTransaction() + Me.RegisterPostback() + + If Not Me.Page.ErrorOnPage AndAlso (Me.Page.IsPageRefresh OrElse Me.DataChanged OrElse Me.ResetData) Then + + + ' Re-load the data and update the web page if necessary. + ' This is typically done during a postback (filter, search button, sort, pagination button). + ' In each of the other click handlers, simply set DataChanged to True to reload the data. + Me.LoadData() + Me.DataBind() + End If + + + Catch ex As Exception + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + Finally + DbUtils.EndTransaction() + End Try + End Sub + + + Protected Overrides Sub SaveControlsToSession() + MyBase.SaveControlsToSession() + + + 'Save pagination state to session. + + End Sub + + + + Protected Overrides Sub ClearControlsFromSession() + MyBase.ClearControlsFromSession() + + + + ' Clear pagination state from session. + + End Sub + + Protected Overrides Sub LoadViewState(ByVal savedState As Object) + MyBase.LoadViewState(savedState) + Dim isNewRecord As String = CType(ViewState("IsNewRecord"), String) + If Not isNewRecord Is Nothing AndAlso isNewRecord.Trim <> "" Then + Me.IsNewRecord = Boolean.Parse(isNewRecord) + End If + + Dim myCheckSum As String = CType(ViewState("CheckSum"), String) + If Not myCheckSum Is Nothing AndAlso myCheckSum.Trim <> "" Then + Me.CheckSum = myCheckSum + End If + + + ' Load view state for pagination control. + + End Sub + + Protected Overrides Function SaveViewState() As Object + ViewState("IsNewRecord") = Me.IsNewRecord.ToString() + ViewState("CheckSum") = Me.CheckSum + + + ' Load view state for pagination control. + + Return MyBase.SaveViewState() + End Function + + + + Public Overridable Function CreateWhereClause_LanguageIdDropDownList() 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 Language table. + ' Examples: + ' wc.iAND(LanguageTable.Language0, BaseFilter.ComparisonOperator.EqualsTo, "XYZ") + ' wc.iAND(LanguageTable.Active, BaseFilter.ComparisonOperator.EqualsTo, "1") + + Dim wc As WhereClause = New WhereClause() + Return wc + + End Function + + + ' Fill the LanguageId list. + Protected Overridable Sub PopulateLanguageIdDropDownList( _ + ByVal selectedValue As String, _ + ByVal maxItems As Integer) + + Me.LanguageId.Items.Clear() + + + ' 1. Setup the static list items + + ' Add the Please Select item. + Me.LanguageId.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_LanguageIdDropDownList function. + ' It is better to customize the where clause there. + + Dim wc As WhereClause = CreateWhereClause_LanguageIdDropDownList() + ' Create the ORDER BY clause to sort based on the displayed value. + + + Dim orderBy As OrderBy = New OrderBy(false, false) + orderBy.Add(LanguageTable.Language0, 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 LanguageRecord = 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 = LanguageTable.GetRecords(wc, orderBy, pageNum, maxItems) + For each itemValue As LanguageRecord In itemValues + ' Create the item and add to the list. + Dim cvalue As String = Nothing + Dim fvalue As String = Nothing + If itemValue.LanguageIdSpecified Then + cvalue = itemValue.LanguageId.ToString() + + If counter < maxItems AndAlso Me.LanguageId.Items.FindByValue(cvalue) Is Nothing Then + + Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalLanguageSkillTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalLanguageSkillTable.LanguageId) + If _isExpandableNonCompositeForeignKey AndAlso PersonalLanguageSkillTable.LanguageId.IsApplyDisplayAs Then + fvalue = PersonalLanguageSkillTable.GetDFKA(itemValue, PersonalLanguageSkillTable.LanguageId) + End If + If (Not _isExpandableNonCompositeForeignKey) Or (String.IsNullOrEmpty(fvalue)) Then + fvalue = itemValue.Format(LanguageTable.Language0) + 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.LanguageId.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.LanguageId.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.LanguageId, selectedValue) AndAlso _ + Not SetSelectedDisplayText(Me.LanguageId, selectedValue)Then + + ' construct a whereclause to query a record with Language.LanguageId = selectedValue + Dim filter2 As CompoundFilter = New CompoundFilter(CompoundFilter.CompoundingOperators.And_Operator, Nothing) + Dim whereClause2 As WhereClause = New WhereClause() + filter2.AddFilter(New BaseClasses.Data.ColumnValueFilter(LanguageTable.LanguageId, selectedValue, BaseClasses.Data.BaseFilter.ComparisonOperator.EqualsTo, False)) + whereClause2.AddFilter(filter2, CompoundFilter.CompoundingOperators.And_Operator) + + Try + ' Execute the query + Dim rc() As LanguageRecord = LanguageTable.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 LanguageRecord = DirectCast(rc(0), LanguageRecord) + ' Create the item and add to the list. + Dim cvalue As String = Nothing + Dim fvalue As String = Nothing + If itemValue.LanguageIdSpecified Then + cvalue = itemValue.LanguageId.ToString() + Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalLanguageSkillTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalLanguageSkillTable.LanguageId) + If _isExpandableNonCompositeForeignKey AndAlso PersonalLanguageSkillTable.LanguageId.IsApplyDisplayAs Then + fvalue = PersonalLanguageSkillTable.GetDFKA(itemValue, PersonalLanguageSkillTable.LanguageId) + End If + If (Not _isExpandableNonCompositeForeignKey) Or (String.IsNullOrEmpty(fvalue)) Then + fvalue = itemValue.Format(LanguageTable.Language0) + End If + + If fvalue Is Nothing OrElse fvalue.Trim() = "" Then fvalue = cvalue + Dim newItem As New ListItem(fvalue, cvalue) + Me.LanguageId.Items.Add(newItem) + SetSelectedValue(Me.LanguageId, selectedValue) + End If + End If + Catch + End Try + + End If + + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalLanguageSkillRowDeleteButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + If(Not Me.Page.IsPageRefresh) Then + + Dim tc As PersonalLanguageSkillTableControl = DirectCast(GetParentControlObject(Me, "PersonalLanguageSkillTableControl"), PersonalLanguageSkillTableControl) + If Not (IsNothing(tc)) Then + If Not Me.IsNewRecord Then + tc.AddToDeletedRecordIds(DirectCast(Me, PersonalLanguageSkillTableControlRow)) + End If + Me.Visible = False + tc.SetFormulaControls() + End If + + End If + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalLanguageSkillRowEditButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + ' The redirect URL is set on the Properties, Custom Properties or Actions. + ' The ModifyRedirectURL call resolves the parameters before the + ' Response.Redirect redirects the page to the URL. + ' Any code after the Response.Redirect call will not be executed, since the page is + ' redirected to the URL. + + + Dim url As String = "../Shared/ConfigureEditRecord.aspx" + + Dim shouldRedirect As Boolean = True + Dim TargetKey As String = Nothing + Dim DFKA As String = TargetKey + Dim id As String = DFKA + Dim value As String = id + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + url = Me.ModifyRedirectUrl(url, "",False) + url = Me.Page.ModifyRedirectUrl(url, "",False) + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + shouldRedirect = False + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + If shouldRedirect Then + Me.Page.ShouldSaveControlsToSession = True + Me.Page.Response.Redirect(url) + ElseIf Not TargetKey Is Nothing AndAlso _ + Not shouldRedirect Then + Me.Page.ShouldSaveControlsToSession = True + Me.Page.CloseWindow(True) + + End If + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalLanguageSkillRowViewButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + ' The redirect URL is set on the Properties, Custom Properties or Actions. + ' The ModifyRedirectURL call resolves the parameters before the + ' Response.Redirect redirects the page to the URL. + ' Any code after the Response.Redirect call will not be executed, since the page is + ' redirected to the URL. + + + Dim url As String = "../Shared/ConfigureViewRecord.aspx" + + Dim shouldRedirect As Boolean = True + Dim TargetKey As String = Nothing + Dim DFKA As String = TargetKey + Dim id As String = DFKA + Dim value As String = id + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + url = Me.ModifyRedirectUrl(url, "",False) + url = Me.Page.ModifyRedirectUrl(url, "",False) + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + shouldRedirect = False + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + If shouldRedirect Then + Me.Page.ShouldSaveControlsToSession = True + Me.Page.Response.Redirect(url) + ElseIf Not TargetKey Is Nothing AndAlso _ + Not shouldRedirect Then + Me.Page.ShouldSaveControlsToSession = True + Me.Page.CloseWindow(True) + + End If + End Sub + + Protected Overridable Sub LanguageId_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()(LanguageId.ClientID & "_SelectedValue"), String) + Dim displayText As String = CType(Me.Page.Session()(LanguageId.ClientID & "_SelectedDisplayText"), String) + If displayText <> "" AndAlso val <> "" Then + Me.LanguageId.Items.Add(New ListItem(displayText, val)) + Me.LanguageId.SelectedIndex = Me.LanguageId.Items.Count - 1 + Me.Page.Session.Remove(LanguageId.ClientID & "_SelectedValue") + Me.Page.Session.Remove(LanguageId.ClientID & "_SelectedDisplayText") + End If + + + + + End Sub + + Protected Overridable Sub Level_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("BasePersonalLanguageSkillTableControlRow_Rec"), String) + End Get + Set(ByVal value As String) + Me.ViewState("BasePersonalLanguageSkillTableControlRow_Rec") = value + End Set + End Property + + Private _DataSource As PersonalLanguageSkillRecord + Public Property DataSource() As PersonalLanguageSkillRecord + Get + Return Me._DataSource + End Get + + Set(ByVal value As PersonalLanguageSkillRecord) + + Me._DataSource = value + End Set + End Property + + + + Private _checkSum As String + Public Overridable Property CheckSum() As String + Get + Return Me._checkSum + End Get + Set(ByVal value As String) + Me._checkSum = value + End Set + End Property + + Private _TotalPages As Integer + Public Property TotalPages() As Integer + Get + Return Me._TotalPages + End Get + Set(ByVal value As Integer) + Me._TotalPages = value + End Set + End Property + + Private _PageIndex As Integer + Public Property PageIndex() As Integer + Get + ' Return the PageIndex + Return Me._PageIndex + End Get + Set(ByVal value As Integer) + Me._PageIndex = value + End Set + End Property + + Private _DisplayLastPage As Boolean + Public Property DisplayLastPage() As Boolean + Get + Return Me._DisplayLastPage + End Get + Set(ByVal value As Boolean) + Me._DisplayLastPage = value + End Set + End Property + + + +#Region "Helper Properties" + + Public ReadOnly Property LanguageId() As System.Web.UI.WebControls.DropDownList + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "LanguageId"), System.Web.UI.WebControls.DropDownList) + End Get + End Property + + Public ReadOnly Property Level() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Level"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property PersonalLanguageSkillRecordRowSelection() As System.Web.UI.WebControls.CheckBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalLanguageSkillRecordRowSelection"), System.Web.UI.WebControls.CheckBox) + End Get + End Property + + Public ReadOnly Property PersonalLanguageSkillRowDeleteButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalLanguageSkillRowDeleteButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalLanguageSkillRowEditButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalLanguageSkillRowEditButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalLanguageSkillRowViewButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalLanguageSkillRowViewButton"), System.Web.UI.WebControls.ImageButton) + 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 PersonalLanguageSkillRecord = 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 PersonalLanguageSkillRecord + If Not Me.DataSource Is Nothing Then + Return Me.DataSource + End If + + If Not Me.RecordUniqueId Is Nothing Then + + Return PersonalLanguageSkillTable.GetRecord(Me.RecordUniqueId, True) + + End If + + ' Localization. + + Return Nothing + + End Function + + Public Shadows ReadOnly Property Page() As BaseApplicationPage + Get + Return DirectCast(MyBase.Page, BaseApplicationPage) + End Get + End Property + +#End Region + +End Class + + + +' Base class for the PersonalLanguageSkillTableControl control on the EditPersonalId page. +' Do not modify this class. Instead override any method in PersonalLanguageSkillTableControl. +Public Class BasePersonalLanguageSkillTableControl + Inherits Persons.UI.BaseApplicationTableControl + + + + Protected Overridable Sub Control_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Init + + + + ' Setup the filter and search events. + + + + ' Control Initializations. + ' Initialize the table's current sort order. + + If Me.InSession(Me, "Order_By") Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + End If + + + + ' Setup default pagination settings. + + Me.PageSize = CInt(Me.GetFromSession(Me, "Page_Size", "10")) + Me.PageIndex = CInt(Me.GetFromSession(Me, "Page_Index", "0")) + + + + Me.ClearControlsFromSession() + End Sub + + Protected Overridable Sub Control_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load + + SaveControlsToSession_Ajax() + + ' Show confirmation message on Click + Me.PersonalLanguageSkillDeleteButton.Attributes.Add("onClick", "return (confirm('" & (CType(Me.Page,BaseApplicationPage)).GetResourceValue("DeleteConfirm", "Persons") & "'));") + + ' Setup the pagination events. + + AddHandler Me.PersonalLanguageSkillPagination.FirstPage.Click, AddressOf PersonalLanguageSkillPagination_FirstPage_Click + + AddHandler Me.PersonalLanguageSkillPagination.LastPage.Click, AddressOf PersonalLanguageSkillPagination_LastPage_Click + + AddHandler Me.PersonalLanguageSkillPagination.NextPage.Click, AddressOf PersonalLanguageSkillPagination_NextPage_Click + + AddHandler Me.PersonalLanguageSkillPagination.PageSizeButton.Click, AddressOf PersonalLanguageSkillPagination_PageSizeButton_Click + + AddHandler Me.PersonalLanguageSkillPagination.PreviousPage.Click, AddressOf PersonalLanguageSkillPagination_PreviousPage_Click + + + ' Setup the sorting events. + + AddHandler Me.LanguageIdLabel1.Click, AddressOf LanguageIdLabel1_Click + + AddHandler Me.LevelLabel1.Click, AddressOf LevelLabel1_Click + + ' Setup the button events. + + AddHandler Me.PersonalLanguageSkillAddButton.Click, AddressOf PersonalLanguageSkillAddButton_Click + + AddHandler Me.PersonalLanguageSkillDeleteButton.Click, AddressOf PersonalLanguageSkillDeleteButton_Click + + AddHandler Me.PersonalLanguageSkillEditButton.Click, AddressOf PersonalLanguageSkillEditButton_Click + + AddHandler Me.PersonalLanguageSkillResetButton.Click, AddressOf PersonalLanguageSkillResetButton_Click + + + ' Setup events for others + + End Sub + + + Public Overridable Sub LoadData() + + ' Read data from database. Returns an array of records that can be assigned + ' to the DataSource table control property. + Try + Dim joinFilter As CompoundFilter = CreateCompoundJoinFilter() + + ' The WHERE clause will be empty when displaying all records in table. + Dim wc As WhereClause = CreateWhereClause() + If wc IsNot Nothing AndAlso Not wc.RunQuery Then + ' Initialize an empty array of records + Dim alist As New ArrayList(0) + Me.DataSource = DirectCast(alist.ToArray(GetType(PersonalLanguageSkillRecord)), PersonalLanguageSkillRecord()) + ' Add records to the list if needed. + Me.AddNewRecords() + Me._TotalRecords = 0 + Me._TotalPages = 0 + Return + End If + + ' Call OrderBy to determine the order - either use the order defined + ' on the Query Wizard, or specified by user (by clicking on column heading) + Dim orderBy As OrderBy = CreateOrderBy() + + ' Get the pagesize from the pagesize control. + Me.GetPageSize() + + If Me.DisplayLastPage Then + Dim totalRecords As Integer = If(Me._TotalRecords < 0, PersonalLanguageSkillTable.GetRecordCount(CreateCompoundJoinFilter(), CreateWhereClause()), Me._TotalRecords) + + Dim totalPages As Integer = CInt(Math.Ceiling(totalRecords / Me.PageSize)) + + Me.PageIndex = totalPages - 1 + End If + + ' Make sure PageIndex (current page) and PageSize are within bounds. + If Me.PageIndex < 0 Then + Me.PageIndex = 0 + End If + If Me.PageSize < 1 Then + Me.PageSize = 1 + End If + + ' Retrieve the records and set the table DataSource. + ' Only PageSize records are fetched starting at PageIndex (zero based). + If Me.AddNewRecord > 0 Then + ' Make sure to preserve the previously entered data on new rows. + Dim postdata As New ArrayList + For Each rc As PersonalLanguageSkillTableControlRow In Me.GetRecordControls() + If Not rc.IsNewRecord Then + rc.DataSource = rc.GetRecord() + rc.GetUIData() + postdata.Add(rc.DataSource) + UIData.Add(rc.PreservedUIData()) + End If + Next + Me.DataSource = DirectCast(postdata.ToArray(GetType(PersonalLanguageSkillRecord)), PersonalLanguageSkillRecord()) + Else ' Get the records from the database + Me.DataSource = PersonalLanguageSkillTable.GetRecords(joinFilter, wc, orderBy, Me.PageIndex, Me.PageSize) + + End If + + ' if the datasource contains no records contained in database, then load the last page. + If (DbUtils.GetCreatedRecords(Me.DataSource).Length = 0 AndAlso Not Me.DisplayLastPage) Then + Me.DisplayLastPage = True + LoadData() + Else + + ' Add any new rows desired by the user. + Me.AddNewRecords() + + ' Turn off the ToggleAll checkbox + Me.PersonalLanguageSkillToggleAll.Checked = False + + + ' Initialize the page and grand totals. now + + End If + + Catch ex As Exception + ' Report the error message to the end user + Dim msg As String = ex.Message + If ex.InnerException IsNot Nothing Then + msg = msg & " InnerException: " & ex.InnerException.Message + End If + Throw New Exception(msg, ex.InnerException) + End Try + End Sub + + + + + Public Overrides Sub DataBind() + ' The DataBind method binds the user interface controls to the values + ' from the database record for each row in the table. To do this, it calls the + ' DataBind for each of the rows. + ' DataBind also populates any filters above the table, and sets the pagination + ' control to the correct number of records and the current page number. + + MyBase.DataBind() + + ' Make sure that the DataSource is initialized. + If Me.DataSource Is Nothing Then + Return + End If + + 'LoadData for DataSource for chart and report if they exist + + ' Improve performance by prefetching display as records. + Me.PreFetchForeignKeyValues() + + ' Setup the pagination controls. + BindPaginationControls() + + + + ' Bind the repeater with the list of records to expand the UI. + Dim rep As System.Web.UI.WebControls.Repeater = CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalLanguageSkillTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return + rep.DataSource = DataSource() + rep.DataBind() + + Dim index As Integer = 0 + For Each repItem As System.Web.UI.WebControls.RepeaterItem In rep.Items + ' Loop through all rows in the table, set its DataSource and call DataBind(). + Dim recControl As PersonalLanguageSkillTableControlRow = DirectCast(repItem.FindControl("PersonalLanguageSkillTableControlRow"), PersonalLanguageSkillTableControlRow) + recControl.DataSource = Me.DataSource(index) + If Me.UIData.Count > index Then + recControl.PreviousUIData = Me.UIData(index) + End If + recControl.DataBind() + recControl.Visible = Not Me.InDeletedRecordIds(recControl) + + index += 1 + Next + + + + + ' Call the Set methods for each controls on the panel + + SetLanguageIdLabel1() + SetLevelLabel1() + + + + + + SetPersonalLanguageSkillTableControlCollapsibleRegion() + + ' setting the state of expand or collapse alternative rows + + + ' Load data for each record and table UI control. + ' Ordering is important because child controls get + ' their parent ids from their parent UI controls. + + + ' this method calls the set method for controls with special formula like running total, sum, rank, etc + SetFormulaControls() + End Sub + + Public Overridable Sub SetFormulaControls() + ' this method calls Set methods for the control that has special formula + + + + End Sub + + + Public Sub PreFetchForeignKeyValues() + If (IsNothing(Me.DataSource)) + Return + End If + + Me.Page.PregetDfkaRecords(PersonalLanguageSkillTable.LanguageId, Me.DataSource) + + End Sub + + + Public Overridable Sub RegisterPostback() + + + End Sub + + Public EvaluateFormulaDelegate As BaseClasses.Data.DataSource.EvaluateFormulaDelegate = New BaseClasses.Data.DataSource.EvaluateFormulaDelegate(AddressOf Me.EvaluateFormula) + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean, ByVal e as FormulaEvaluator) As String + If e Is Nothing + e = New FormulaEvaluator() + End If + + e.Variables.Clear() + + + ' add variables for formula evaluation + If variables IsNot Nothing Then + Dim enumerator As System.Collections.Generic.IEnumerator(Of System.Collections.Generic.KeyValuePair(Of String, Object)) = variables.GetEnumerator() + While enumerator.MoveNext() + e.Variables.Add(enumerator.Current.Key, enumerator.Current.Value) + End While + End If + + If includeDS + + End If + + ' All variables referred to in the formula are expected to be + ' properties of the DataSource. For example, referring to + ' UnitPrice as a variable will refer to DataSource.UnitPrice + e.DataSource = dataSourceForEvaluate + + ' Define the calling control. This is used to add other + ' related table and record controls as variables. + e.CallingControl = Me + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + + If Not String.IsNullOrEmpty(format) AndAlso (String.IsNullOrEmpty(formula) OrElse formula.IndexOf("Format(") < 0) Then + Return FormulaUtils.Format(resultObj, format) + Else + Return resultObj.ToString() + End If + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format,variables ,includeDS, Nothing) + End Function + + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object)) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format, variables ,True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, format, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal e as FormulaEvaluator) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, variables, True, e) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal includeDS as Boolean) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, includeDS, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, True, Nothing) + End Function + + + + + Public Overridable Sub ResetControl() + + Me.CurrentSortOrder.Reset() + If (Me.InSession(Me, "Order_By")) Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + End If + + Me.PageIndex = 0 + End Sub + + Protected Overridable Sub BindPaginationControls() + ' Setup the pagination controls. + + ' Bind the pagination labels. + + If DbUtils.GetCreatedRecords(Me.DataSource).Length > 0 Then + + Me.PersonalLanguageSkillPagination.CurrentPage.Text = (Me.PageIndex + 1).ToString() + Else + Me.PersonalLanguageSkillPagination.CurrentPage.Text = "0" + End If + Me.PersonalLanguageSkillPagination.PageSize.Text = Me.PageSize.ToString() + Me.PersonalLanguageSkillPagination.TotalItems.Text = Me.TotalRecords.ToString() + Me.PersonalLanguageSkillPagination.TotalPages.Text = Me.TotalPages.ToString() + + ' Bind the buttons for PersonalLanguageSkillTableControl pagination. + + Me.PersonalLanguageSkillPagination.FirstPage.Enabled = Not (Me.PageIndex = 0) + If Me._TotalPages < 0 Then ' if the total pages is not determined yet, enable last and next buttons + Me.PersonalLanguageSkillPagination.LastPage.Enabled = True + ElseIf Me._TotalPages = 0 ' if the total pages is determined and it is 0, enable last and next buttons + Me.PersonalLanguageSkillPagination.LastPage.Enabled = False + Else ' if the total pages is the last page, disable last and next buttons + Me.PersonalLanguageSkillPagination.LastPage.Enabled = Not (Me.PageIndex = Me.TotalPages - 1) + End If + + If Me._TotalPages < 0 Then ' if the total pages is not determined yet, enable last and next buttons + Me.PersonalLanguageSkillPagination.NextPage.Enabled = True + ElseIf Me._TotalPages = 0 ' if the total pages is determined and it is 0, enable last and next buttons + Me.PersonalLanguageSkillPagination.NextPage.Enabled = False + Else ' if the total pages is the last page, disable last and next buttons + Me.PersonalLanguageSkillPagination.NextPage.Enabled = Not (Me.PageIndex = Me.TotalPages - 1) + End If + + Me.PersonalLanguageSkillPagination.PreviousPage.Enabled = Not (Me.PageIndex = 0) + + + End Sub + + Public Overridable Sub SaveData() + ' Save the data from the entire table. Calls each row's Save Data + ' to save their data. This function is called by the Click handler of the + ' Save button. The button handler should Start/Commit/End a transaction. + + Dim recCtl As PersonalLanguageSkillTableControlRow + For Each recCtl In Me.GetRecordControls() + + If Me.InDeletedRecordIds(recCtl) Then + ' Delete any pending deletes. + recCtl.Delete() + Else + If recCtl.Visible Then + recCtl.SaveData() + End If + End If + + Next + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + ' Set IsNewRecord to False for all records - since everything has been saved and is no longer "new" + For Each recCtl In Me.GetRecordControls() + recCtl.IsNewRecord = False + Next + + + ' Set DeletedRecordsIds to Nothing since we have deleted all pending deletes. + Me.DeletedRecordIds = Nothing + + End Sub + + Public Overridable Function CreateCompoundJoinFilter() As CompoundFilter + Dim jFilter As CompoundFilter = New CompoundFilter() + + Return jFilter + + End Function + + + Public Overridable Function CreateOrderBy() As OrderBy + ' The CurrentSortOrder is initialized to the sort order on the + ' Query Wizard. It may be modified by the Click handler for any of + ' the column heading to sort or reverse sort by that column. + ' You can add your own sort order, or modify it on the Query Wizard. + Return Me.CurrentSortOrder + End Function + + Public Overridable Function CreateWhereClause() As WhereClause + 'This CreateWhereClause is used for loading the data. + PersonalLanguageSkillTable.Instance.InnerFilter = Nothing + Dim wc As WhereClause = New WhereClause() + + ' Compose the WHERE clause consiting of: + ' 1. Static clause defined at design time. + ' 2. User selected search criteria. + ' 3. User selected filter criteria. + + + Dim selectedRecordKeyValue as KeyValue = New KeyValue() + + Dim personalIdRecordControlObj As Persons.UI.Controls.EditPersonalId.PersonalIdRecordControl = DirectCast(MiscUtils.FindControlRecursively(Me.Page, "PersonalIdRecordControl"), Persons.UI.Controls.EditPersonalId.PersonalIdRecordControl) + + If (Not IsNothing(personalIdRecordControlObj) AndAlso Not IsNothing(personalIdRecordControlObj.GetRecord()) AndAlso personalIdRecordControlObj.GetRecord().IsCreated AndAlso Not IsNothing(personalIdRecordControlObj.GetRecord().PersonalId)) + wc.iAND(PersonalLanguageSkillTable.PersonalId, BaseFilter.ComparisonOperator.EqualsTo, personalIdRecordControlObj.GetRecord().PersonalId.ToString()) + selectedRecordKeyValue.AddElement(PersonalLanguageSkillTable.PersonalId.InternalName, personalIdRecordControlObj.GetRecord().PersonalId.ToString()) + Else + wc.RunQuery = False + Return wc + End If + + HttpContext.Current.Session("PersonalLanguageSkillTableControlWhereClause") = selectedRecordKeyValue.ToXmlString() + + Return wc + End Function + + + Public Overridable Function CreateWhereClause(ByVal searchText as String, ByVal fromSearchControl as String, ByVal AutoTypeAheadSearch as String, ByVal AutoTypeAheadWordSeparators as String) As WhereClause + ' This CreateWhereClause is used for loading list of suggestions for Auto Type-Ahead feature. + PersonalLanguageSkillTable.Instance.InnerFilter = Nothing + Dim wc As WhereClause = New WhereClause() + + ' Compose the WHERE clause consiting of: + ' 1. Static clause defined at design time. + ' 2. User selected search criteria. + ' 3. User selected filter criteria. + + Dim appRelativeVirtualPath As String = CType(HttpContext.Current.Session("AppRelativeVirtualPath"), String) + + Dim selectedRecordInPersonalIdRecordControl as String = DirectCast(HttpContext.Current.Session("PersonalLanguageSkillTableControlWhereClause"), String) + + If Not selectedRecordInPersonalIdRecordControl Is Nothing AndAlso KeyValue.IsXmlKey(selectedRecordInPersonalIdRecordControl) Then + Dim selectedRecordKeyValue as KeyValue = KeyValue.XmlToKey(selectedRecordInPersonalIdRecordControl) + + If Not IsNothing(selectedRecordKeyValue) AndAlso selectedRecordKeyValue.ContainsColumn(PersonalLanguageSkillTable.PersonalId) Then + wc.iAND(PersonalLanguageSkillTable.PersonalId, BaseFilter.ComparisonOperator.EqualsTo, selectedRecordKeyValue.GetColumnValue(PersonalLanguageSkillTable.PersonalId).ToString()) + End If + + End If + + ' Adds clauses if values are selected in Filter controls which are configured in the page. + + + Return wc + End Function + + + Public Overridable Function FormatSuggestions(ByVal prefixText As String, ByVal resultItem As String, _ + ByVal columnLength As Integer, ByVal AutoTypeAheadDisplayFoundText As String, _ + ByVal autoTypeAheadSearch As String, ByVal AutoTypeAheadWordSeparators As String, _ + ByVal resultList As ArrayList) As Boolean + + 'Formats the resultItem and adds it to the list of suggestions. + Dim index As Integer = resultItem.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture).IndexOf(prefixText.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture)) + Dim itemToAdd As String = "" + Dim isFound As Boolean = False + Dim isAdded As Boolean = False + ' Get the index where prfixt is at the beginning of resultItem. If not found then, index of word which begins with prefixText. + If InvariantLCase(autoTypeAheadSearch).equals("wordsstartingwithsearchstring") And Not index = 0 Then + ' Expression to find word which contains AutoTypeAheadWordSeparators followed by prefixText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex( AutoTypeAheadWordSeparators + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + If regex1.IsMatch(resultItem) Then + index = regex1.Match(resultItem).Index + isFound = True + End If + ' If the prefixText is found immediatly after white space then starting of the word is found so don not search any further + If not resultItem(index).ToString() = " " Then + ' Expression to find beginning of the word which contains AutoTypeAheadWordSeparators followed by prefixText + Dim regex As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\\S*" + AutoTypeAheadWordSeparators + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + If regex.IsMatch(resultItem) Then + index = regex.Match(resultItem).Index + isFound = True + End If + End If + End If + + ' If autoTypeAheadSearch value is wordsstartingwithsearchstring then, extract the substring only if the prefixText is found at the + ' beginning of the resultItem (index = 0) or a word in resultItem is found starts with prefixText. + If index = 0 Or isFound Or InvariantLCase(autoTypeAheadSearch).Equals("anywhereinstring") then + If InvariantLCase(AutoTypeAheadDisplayFoundText).equals("atbeginningofmatchedstring") Then + ' Expression to find beginning of the word which contains prefixText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\\S*" + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + ' Find the beginning of the word which contains prefexText + If (StringUtils.InvariantLCase(autoTypeAheadSearch).Equals("anywhereinstring") AndAlso regex1.IsMatch(resultItem)) Then + index = regex1.Match(resultItem).Index + isFound = True + End If + ' Display string from the index till end of the string if sub string from index till end is less than columnLength value. + If Len(resultItem) - index <= columnLength Then + If index = 0 Then + itemToAdd = resultItem + Else + itemToAdd = "..." & resultItem.Substring(index, Len(resultItem) - index) + End If + Else + If index = 0 Then + itemToAdd = resultItem.Substring(index, (columnLength - 3)) & "..." + Else + 'Truncate the string to show only columnLength - 6 characters as begining and trailing "..." has to be appended. + itemToAdd = "..." & resultItem.Substring(index , columnLength - 6) & "..." + End If + End If + ElseIf InvariantLCase(AutoTypeAheadDisplayFoundText).equals("inmiddleofmatchedstring") Then + Dim subStringBeginIndex As Integer = CType(columnLength/2, Integer) + If Len(resultItem) <= columnLength Then + itemToAdd = resultItem + Else + ' Sanity check at end of the string + If index + Len(prefixText) = columnLength Then + itemToAdd = "..." & resultItem.Substring(index-columnLength,index) + ElseIf Len(resultItem) - index < subStringBeginIndex Then + ' Display string from the end till columnLength value if, index is closer to the end of the string. + itemToAdd = "..." & resultItem.Substring(Len(resultItem)-columnLength,Len(resultItem)) + ElseIf index <= subStringBeginIndex Then + ' Sanity chet at beginning of the string + itemToAdd = resultItem.Substring(0, columnLength) & "..." + Else + ' Display string containing text before the prefixText occures and text after the prefixText + itemToAdd = "..." & resultItem.Substring(index - subStringBeginIndex, columnLength) & "..." + End If + End If + ElseIf InvariantLCase(AutoTypeAheadDisplayFoundText).equals("atendofmatchedstring") Then + ' Expression to find ending of the word which contains prefexText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\s", System.Text.RegularExpressions.RegexOptions.IgnoreCase) + ' Find the ending of the word which contains prefexText + If regex1.IsMatch(resultItem, index + 1) Then + index = regex1.Match(resultItem, index + 1).Index + Else + ' If the word which contains prefexText is the last word in string, regex1.IsMatch returns false. + index = resultItem.Length + End If + If index > Len(resultItem) Then + index = Len(resultItem) + End If + ' If text from beginning of the string till index is less than columnLength value then, display string from the beginning till index. + If index <= columnLength Then + if index = Len(resultItem) Then 'Make decision to append "..." + itemToAdd = resultItem.Substring(0,index) + Else + itemToAdd = resultItem.Substring(0,index) & "..." + End If + Else + If index = Len(resultItem) Then + itemToAdd = "..." & resultItem.Substring(index - (columnLength - 3), (columnLength - 3)) + Else + 'Truncate the string to show only columnLength - 6 characters as begining and trailing "..." has to be appended. + itemToAdd = "..." & resultItem.Substring(index - (columnLength - 6), columnLength - 6) & "..." + End If + End If + End If + + ' Remove newline character from itemToAdd + Dim prefixTextIndex As Integer = itemToAdd.IndexOf(prefixText, StringComparison.CurrentCultureIgnoreCase) + ' If itemToAdd contains any newline after the search text then show text only till newline + Dim regex2 As System.Text.RegularExpressions.Regex = New System.Text.RegularExpressions.Regex("(" & vbCrLf & "|" & vbLf & ")", System.Text.RegularExpressions.RegexOptions.IgnoreCase) + Dim newLineIndexAfterPrefix As Integer = -1 + If regex2.IsMatch(itemToAdd, prefixTextIndex) Then + newLineIndexAfterPrefix = regex2.Match(itemToAdd, prefixTextIndex).Index + End If + If (newLineIndexAfterPrefix > -1) Then + If itemToAdd.EndsWith("...") Then + itemToAdd = (itemToAdd.Substring(0, newLineIndexAfterPrefix) + "...") + Else + itemToAdd = itemToAdd.Substring(0, newLineIndexAfterPrefix) + End If + End If + ' If itemToAdd contains any newline before search text then show text which comes after newline + Dim regex3 As System.Text.RegularExpressions.Regex = New System.Text.RegularExpressions.Regex("(" & vbCrLf & "|" & vbLf & ")", (System.Text.RegularExpressions.RegexOptions.IgnoreCase Or System.Text.RegularExpressions.RegexOptions.RightToLeft)) + Dim newLineIndexBeforePrefix As Integer = -1 + If regex3.IsMatch(itemToAdd, prefixTextIndex) Then + newLineIndexBeforePrefix = regex3.Match(itemToAdd, prefixTextIndex).Index + End If + If (newLineIndexBeforePrefix > -1) Then + If itemToAdd.StartsWith("...") Then + itemToAdd = ("..." + itemToAdd.Substring((newLineIndexBeforePrefix + regex3.Match(itemToAdd, prefixTextIndex).Length))) + Else + itemToAdd = itemToAdd.Substring((newLineIndexBeforePrefix + regex3.Match(itemToAdd, prefixTextIndex).Length)) + End If + End If + + If Not itemToAdd is nothing AndAlso Not resultList.Contains(itemToAdd) Then + + resultList.Add(itemToAdd) + + isAdded = true + End If + End If + Return isAdded + End Function + + + Protected Overridable Sub GetPageSize() + + If Me.PersonalLanguageSkillPagination.PageSize.Text.Trim <> "" Then + Try + 'Me.PageSize = Integer.Parse(Me.PersonalLanguageSkillPagination.PageSize.Text) + Catch ex As Exception + End Try + End If + End Sub + + Protected Overridable Sub AddNewRecords() + + Dim newRecordList As ArrayList = New ArrayList() + + Dim newUIDataList As System.Collections.Generic.List(Of Hashtable) = New System.Collections.Generic.List(Of Hashtable)() + + ' Loop though all the record controls and if the record control + ' does not have a unique record id set, then create a record + ' and add to the list. + If Not Me.ResetData Then + Dim rep As System.Web.UI.WebControls.Repeater = CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalLanguageSkillTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return + + Dim repItem As System.Web.UI.WebControls.RepeaterItem + For Each repItem In rep.Items + ' Loop through all rows in the table, set its DataSource and call DataBind(). + + Dim recControl As PersonalLanguageSkillTableControlRow = DirectCast(repItem.FindControl("PersonalLanguageSkillTableControlRow"), PersonalLanguageSkillTableControlRow) + + If recControl.Visible AndAlso recControl.IsNewRecord() Then + + Dim rec As PersonalLanguageSkillRecord = New PersonalLanguageSkillRecord() + + If MiscUtils.IsValueSelected(recControl.LanguageId) Then + rec.Parse(recControl.LanguageId.SelectedItem.Value, PersonalLanguageSkillTable.LanguageId) + End If + If recControl.Level.Text <> "" Then + rec.Parse(recControl.Level.Text, PersonalLanguageSkillTable.Level) + End If + newUIDataList.Add(recControl.PreservedUIData()) + newRecordList.Add(rec) + End If + Next + End If + + + ' Add any new record to the list. + Dim index As Integer = 0 + For index = 1 To Me.AddNewRecord + + newRecordList.Insert(0, New PersonalLanguageSkillRecord()) + newUIDataList.Insert(0, New Hashtable()) + + Next + Me.AddNewRecord = 0 + + ' Finally, add any new records to the DataSource. + If newRecordList.Count > 0 Then + + Dim finalList As ArrayList = New ArrayList(Me.DataSource) + finalList.InsertRange(0, newRecordList) + + Me.DataSource = DirectCast(finalList.ToArray(GetType(PersonalLanguageSkillRecord)), PersonalLanguageSkillRecord()) + + End If + + ' Add the existing UI data to this hash table + If newUIDataList.Count > 0 Then + Me.UIData.InsertRange(0, newUIDataList) + End If + + End Sub + + + Public Sub AddToDeletedRecordIds(ByVal rec As PersonalLanguageSkillTableControlRow) + If rec.IsNewRecord() Then + Return + End If + + If Not Me.DeletedRecordIds Is Nothing AndAlso Me.DeletedRecordIds.Trim <> "" Then + Me.DeletedRecordIds &= "," + End If + + Me.DeletedRecordIds &= "[" & rec.RecordUniqueId & "]" + End Sub + + Protected Overridable Function InDeletedRecordIds(ByVal rec As PersonalLanguageSkillTableControlRow) As Boolean + If Me.DeletedRecordIds Is Nothing OrElse Me.DeletedRecordIds.Trim = "" Then + Return False + End If + + Return Me.DeletedRecordIds.IndexOf("[" & rec.RecordUniqueId & "]") >= 0 + End Function + + Private _DeletedRecordIds As String + Public Property DeletedRecordIds() As String + Get + Return Me._DeletedRecordIds + End Get + Set(ByVal value As String) + Me._DeletedRecordIds = value + End Set + End Property + + + ' Create Set, WhereClause, and Populate Methods + + Public Overridable Sub SetLanguageIdLabel1() + + End Sub + + Public Overridable Sub SetLevelLabel1() + + End Sub + + Public Overridable Sub SetPersonalLanguageSkillTableControlCollapsibleRegion() + + 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. + Dim added As Boolean = Me.AddNewRecord > 0 + Me.LoadData() + Me.DataBind() + + If added Then + Me.SetFocusToAddedRow() + End If + + End If + + + + Catch ex As Exception + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + Finally + DbUtils.EndTransaction + End Try + End Sub + + 'this function sets focus to the first editable element in the new added row in the editable table + Protected Overridable Sub SetFocusToAddedRow() + Dim rep As System.Web.UI.WebControls.Repeater = CType(Me.FindControl("PersonalLanguageSkillTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing OrElse rep.Items.Count = 0 Then Return + Dim repItem As System.Web.UI.WebControls.RepeaterItem + For Each repItem In rep.Items + 'Load scripts to table rows + Me.Page.LoadFocusScripts(repItem) + Dim recControl As PersonalLanguageSkillTableControlRow = DirectCast(repItem.FindControl("PersonalLanguageSkillTableControlRow"), PersonalLanguageSkillTableControlRow) + If recControl.IsNewRecord Then + For Each field As Control In recControl.Controls + If field.Visible AndAlso Me.Page.IsControlEditable(field, False) Then + 'set focus on the first editable field in the new row + field.Focus() + Dim updPan As UpdatePanel = DirectCast(Me.Page.FindControlRecursively("UpdatePanel1"), UpdatePanel) + If Not updPan Is Nothing Then updPan.Update() + Return + End If + Next + Return + End If + Next + End Sub + + + Protected Overrides Sub SaveControlsToSession() + MyBase.SaveControlsToSession() + + ' Save filter controls to values to session. + + + 'Save pagination state to session. + + + + ' Save table control properties to the session. + If Not Me.CurrentSortOrder Is Nothing Then + Me.SaveToSession(Me, "Order_By", Me.CurrentSortOrder.ToXmlString()) + End If + + Me.SaveToSession(Me, "Page_Index", Me.PageIndex.ToString()) + Me.SaveToSession(Me, "Page_Size", Me.PageSize.ToString()) + + Me.SaveToSession(Me, "DeletedRecordIds", Me.DeletedRecordIds) + + End Sub + + Protected Sub SaveControlsToSession_Ajax() + ' Save filter controls to values to session. + + HttpContext.Current.Session("AppRelativeVirtualPath") = Me.Page.AppRelativeVirtualPath + + End Sub + + Protected Overrides Sub ClearControlsFromSession() + MyBase.ClearControlsFromSession() + + ' Clear filter controls values from the session. + + + ' Clear pagination state from session. + + + + ' Clear table properties from the session. + Me.RemoveFromSession(Me, "Order_By") + Me.RemoveFromSession(Me, "Page_Index") + Me.RemoveFromSession(Me, "Page_Size") + + Me.RemoveFromSession(Me, "DeletedRecordIds") + + End Sub + + Protected Overrides Sub LoadViewState(ByVal savedState As Object) + MyBase.LoadViewState(savedState) + + Dim orderByStr As String = CType(ViewState("PersonalLanguageSkillTableControl_OrderBy"), String) + + If orderByStr IsNot Nothing AndAlso orderByStr.Trim <> "" Then + Me.CurrentSortOrder = BaseClasses.Data.OrderBy.FromXmlString(orderByStr) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + End If + + Dim pageIndex As String = CType(ViewState("Page_Index"), String) + If pageIndex IsNot Nothing Then + Me.PageIndex = CInt(pageIndex) + End If + + Dim pageSize As String = CType(ViewState("Page_Size"), String) + If Not pageSize Is Nothing Then + Me.PageSize = CInt(pageSize) + End If + + + + ' Load view state for pagination control. + + Me.DeletedRecordIds = CType(Me.ViewState("DeletedRecordIds"), String) + + End Sub + + Protected Overrides Function SaveViewState() As Object + + If Me.CurrentSortOrder IsNot Nothing Then + Me.ViewState("PersonalLanguageSkillTableControl_OrderBy") = Me.CurrentSortOrder.ToXmlString() + End If + + Me.ViewState("Page_Index") = Me.PageIndex + Me.ViewState("Page_Size") = Me.PageSize + + Me.ViewState("DeletedRecordIds") = Me.DeletedRecordIds + + + ' Load view state for pagination control. + + + Return MyBase.SaveViewState() + End Function + + ' Generate the event handling functions for pagination events. + + ' event handler for ImageButton + Public Overridable Sub PersonalLanguageSkillPagination_FirstPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.PageIndex = 0 + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalLanguageSkillPagination_LastPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.DisplayLastPage = True + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalLanguageSkillPagination_NextPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.PageIndex += 1 + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for LinkButton + Public Overridable Sub PersonalLanguageSkillPagination_PageSizeButton_Click(ByVal sender As Object, ByVal args As EventArgs) + + Try + + Me.DataChanged = True + + Me.PageSize = Integer.Parse(Me.PersonalLanguageSkillPagination.PageSize.Text) + + Me.PageIndex = Integer.Parse(Me.PersonalLanguageSkillPagination.CurrentPage.Text) - 1 + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalLanguageSkillPagination_PreviousPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + If Me.PageIndex > 0 Then + Me.PageIndex -= 1 + Me.DataChanged = True + End If + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + + ' Generate the event handling functions for sorting events. + + Public Overridable Sub LanguageIdLabel1_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by LanguageId when clicked. + + ' Get previous sorting state for LanguageId. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalLanguageSkillTable.LanguageId) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for LanguageId. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalLanguageSkillTable.LanguageId, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by LanguageId, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub LevelLabel1_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by Level when clicked. + + ' Get previous sorting state for Level. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalLanguageSkillTable.Level) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for Level. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalLanguageSkillTable.Level, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by Level, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + + ' Generate the event handling functions for button events. + + ' event handler for ImageButton + Public Overridable Sub PersonalLanguageSkillAddButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + Me.AddNewRecord = 1 + Me.DataChanged = True + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalLanguageSkillDeleteButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + If(Not Me.Page.IsPageRefresh) Then + + Me.DeleteSelectedRecords(True) + Me.SetFormulaControls() + + + End If + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalLanguageSkillEditButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + ' The redirect URL is set on the Properties, Custom Properties or Actions. + ' The ModifyRedirectURL call resolves the parameters before the + ' Response.Redirect redirects the page to the URL. + ' Any code after the Response.Redirect call will not be executed, since the page is + ' redirected to the URL. + + + Dim url As String = "../Shared/ConfigureEditRecord.aspx" + + Dim shouldRedirect As Boolean = True + Dim TargetKey As String = Nothing + Dim DFKA As String = TargetKey + Dim id As String = DFKA + Dim value As String = id + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + url = Me.ModifyRedirectUrl(url, "",False) + url = Me.Page.ModifyRedirectUrl(url, "",False) + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + shouldRedirect = False + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + If shouldRedirect Then + Me.Page.ShouldSaveControlsToSession = True + Me.Page.Response.Redirect(url) + ElseIf Not TargetKey Is Nothing AndAlso _ + Not shouldRedirect Then + Me.Page.ShouldSaveControlsToSession = True + Me.Page.CloseWindow(True) + + End If + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalLanguageSkillResetButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.CurrentSortOrder.Reset() + If Me.InSession(Me, "Order_By") Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + + End If + + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + + + ' Generate the event handling functions for filter and search events. + + + ' Generate the event handling functions for others + + + Private _UIData As New System.Collections.Generic.List(Of Hashtable) + Public Property UIData() As System.Collections.Generic.List(Of Hashtable) + Get + Return Me._UIData + End Get + Set(ByVal value As System.Collections.Generic.List(Of Hashtable)) + Me._UIData = value + End Set + End Property + + ' pagination properties + Protected _PageSize As Integer + Public Property PageSize() As Integer + Get + Return Me._PageSize + End Get + Set(ByVal value As Integer) + Me._PageSize = value + End Set + End Property + + Protected _PageIndex As Integer + Public Property PageIndex() As Integer + Get + ' Return the PageIndex + Return Me._PageIndex + End Get + Set(ByVal value As Integer) + Me._PageIndex = value + End Set + End Property + + Protected _TotalRecords As Integer = -1 + Public Property TotalRecords() As Integer + Get + If _TotalRecords < 0 + _TotalRecords = PersonalLanguageSkillTable.GetRecordCount(CreateCompoundJoinFilter(), CreateWhereClause()) + End If + Return Me._TotalRecords + End Get + Set(ByVal value As Integer) + If Me.PageSize > 0 Then + + Me.TotalPages = CInt(Math.Ceiling(value / Me.PageSize)) + + End If + Me._TotalRecords = value + End Set + End Property + + + + Protected _TotalPages As Integer = -1 + Public Property TotalPages() As Integer + Get + If _TotalPages < 0 Then + + Me.TotalPages = CInt(Math.Ceiling(TotalRecords / Me.PageSize)) + + End If + Return Me._TotalPages + End Get + Set(ByVal value As Integer) + Me._TotalPages = value + End Set + End Property + + Protected _DisplayLastPage As Boolean + Public Property DisplayLastPage() As Boolean + Get + Return Me._DisplayLastPage + End Get + Set(ByVal value As Boolean) + Me._DisplayLastPage = value + End Set + End Property + + Private _DataChanged As Boolean = False + Public Property DataChanged() As Boolean + Get + Return Me._DataChanged + End Get + Set(ByVal value As Boolean) + Me._DataChanged = value + End Set + End Property + + Private _ResetData As Boolean = False + Public Property ResetData() As Boolean + Get + Return Me._ResetData + End Get + Set(ByVal value As Boolean) + Me._ResetData = value + End Set + End Property + + Private _AddNewRecord As Integer = 0 + Public Property AddNewRecord() As Integer + Get + Return Me._AddNewRecord + End Get + Set(ByVal value As Integer) + Me._AddNewRecord = value + End Set + End Property + + + Private _CurrentSortOrder As OrderBy = Nothing + Public Property CurrentSortOrder() As OrderBy + Get + Return Me._CurrentSortOrder + End Get + Set(ByVal value As BaseClasses.Data.OrderBy) + Me._CurrentSortOrder = value + End Set + End Property + + Private _DataSource() As PersonalLanguageSkillRecord = Nothing + Public Property DataSource() As PersonalLanguageSkillRecord () + Get + Return Me._DataSource + End Get + Set(ByVal value() As PersonalLanguageSkillRecord) + Me._DataSource = value + End Set + End Property + +#Region "Helper Properties" + + Public ReadOnly Property LanguageIdLabel1() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "LanguageIdLabel1"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property LevelLabel1() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "LevelLabel1"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property PersonalLanguageSkillAddButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalLanguageSkillAddButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalLanguageSkillDeleteButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalLanguageSkillDeleteButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalLanguageSkillEditButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalLanguageSkillEditButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalLanguageSkillPagination() As Persons.UI.IPagination + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalLanguageSkillPagination"), Persons.UI.IPagination) + End Get + End Property + + Public ReadOnly Property PersonalLanguageSkillResetButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalLanguageSkillResetButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalLanguageSkillTableControlCollapsibleRegion() As System.Web.UI.WebControls.Panel + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalLanguageSkillTableControlCollapsibleRegion"), System.Web.UI.WebControls.Panel) + End Get + End Property + + Public ReadOnly Property PersonalLanguageSkillToggleAll() As System.Web.UI.WebControls.CheckBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalLanguageSkillToggleAll"), System.Web.UI.WebControls.CheckBox) + End Get + End Property + +#End Region + +#Region "Helper Functions" + + Public Overrides Overloads Function ModifyRedirectUrl(url As String, arg As String, ByVal bEncrypt As Boolean) As String + Return Me.Page.EvaluateExpressions(url, arg, bEncrypt, Me) + End Function + + Public Overrides Overloads Function EvaluateExpressions(url As String, arg As String, ByVal bEncrypt As Boolean) As String + Dim needToProcess As Boolean = AreAnyUrlParametersForMe(url, arg) + If (needToProcess) Then + Dim recCtl As PersonalLanguageSkillTableControlRow = Me.GetSelectedRecordControl() + If recCtl Is Nothing AndAlso url.IndexOf("{") >= 0 Then + ' Localization. + Throw New Exception(Page.GetResourceValue("Err:NoRecSelected", "Persons")) + End If + Dim rec As PersonalLanguageSkillRecord = Nothing + If recCtl IsNot Nothing Then + rec = recCtl.GetRecord() + End If + Return EvaluateExpressions(url, arg, rec, bEncrypt) + End If + Return url + End Function + + Public Overridable Function GetSelectedRecordIndex() As Integer + Dim counter As Integer = 0 + Dim recControl As PersonalLanguageSkillTableControlRow + For Each recControl In Me.GetRecordControls() + If recControl.PersonalLanguageSkillRecordRowSelection.Checked Then + Return counter + End If + counter += 1 + Next + Return -1 + End Function + + Public Overridable Function GetSelectedRecordControl() As PersonalLanguageSkillTableControlRow + Dim selectedList() As PersonalLanguageSkillTableControlRow = Me.GetSelectedRecordControls() + If selectedList.Length = 0 Then + Return Nothing + End If + Return selectedList(0) + + End Function + + Public Overridable Function GetSelectedRecordControls() As PersonalLanguageSkillTableControlRow() + + Dim selectedList As ArrayList = New ArrayList(25) + Dim recControl As PersonalLanguageSkillTableControlRow + For Each recControl In Me.GetRecordControls() + If recControl.PersonalLanguageSkillRecordRowSelection IsNot Nothing AndAlso recControl.PersonalLanguageSkillRecordRowSelection.Checked Then + selectedList.Add(recControl) + End If + Next + Return DirectCast(selectedList.ToArray(GetType(PersonalLanguageSkillTableControlRow)), PersonalLanguageSkillTableControlRow()) + + End Function + + Public Overridable Sub DeleteSelectedRecords(ByVal deferDeletion As Boolean) + Dim recList() As PersonalLanguageSkillTableControlRow = Me.GetSelectedRecordControls() + If recList.Length = 0 Then + ' Localization. + Throw New Exception(Page.GetResourceValue("Err:NoRecSelected", "Persons")) + End If + + Dim recCtl As PersonalLanguageSkillTableControlRow + For Each recCtl In recList + If deferDeletion Then + If Not recCtl.IsNewRecord Then + + Me.AddToDeletedRecordIds(recCtl) + + End If + recCtl.Visible = False + + recCtl.PersonalLanguageSkillRecordRowSelection.Checked = False + + Else + + recCtl.Delete() + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + End If + Next + End Sub + + Public Function GetRecordControls() As PersonalLanguageSkillTableControlRow() + Dim recList As ArrayList = New ArrayList() + Dim rep As System.Web.UI.WebControls.Repeater = CType(Me.FindControl("PersonalLanguageSkillTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return Nothing + Dim repItem As System.Web.UI.WebControls.RepeaterItem + + For Each repItem In rep.Items + + Dim recControl As PersonalLanguageSkillTableControlRow = DirectCast(repItem.FindControl("PersonalLanguageSkillTableControlRow"), PersonalLanguageSkillTableControlRow) + recList.Add(recControl) + + Next + + Return DirectCast(recList.ToArray(GetType(PersonalLanguageSkillTableControlRow)), PersonalLanguageSkillTableControlRow()) + End Function + + Public Shadows ReadOnly Property Page() As BaseApplicationPage + Get + Return DirectCast(MyBase.Page, BaseApplicationPage) + End Get + End Property + +#End Region + + + +End Class + + +' Base class for the PersonalNameTableControlRow control on the EditPersonalId page. +' Do not modify this class. Instead override any method in PersonalNameTableControlRow. +Public Class BasePersonalNameTableControlRow + Inherits Persons.UI.BaseApplicationRecordControl + + ' To customize, override this method in PersonalNameTableControlRow. + Protected Overridable Sub Control_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Init + + Me.ClearControlsFromSession() + End Sub + + ' To customize, override this method in PersonalNameTableControlRow. + Protected Overridable Sub Control_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load + + 'Call LoadFocusScripts from repeater so that onfocus attribute could be added to elements + Me.Page.LoadFocusScripts(Me) + + ' Show confirmation message on Click + Me.PersonalNameRowDeleteButton.Attributes.Add("onClick", "return (confirm('" & (CType(Me.Page,BaseApplicationPage)).GetResourceValue("DeleteRecordConfirm", "Persons") & "'));") + + + ' Register the event handlers. + + AddHandler Me.PersonalNameRowDeleteButton.Click, AddressOf PersonalNameRowDeleteButton_Click + + AddHandler Me.PersonalNameRowEditButton.Click, AddressOf PersonalNameRowEditButton_Click + + AddHandler Me.PersonalNameRowViewButton.Click, AddressOf PersonalNameRowViewButton_Click + + AddHandler Me.NameDate.TextChanged, AddressOf NameDate_TextChanged + + AddHandler Me.PersonalLastName1.TextChanged, AddressOf PersonalLastName1_TextChanged + + AddHandler Me.PersonalName1.TextChanged, AddressOf PersonalName1_TextChanged + + AddHandler Me.Ref2.TextChanged, AddressOf Ref2_TextChanged + + + End Sub + + + Public Overridable Sub LoadData() + + ' Load the data from the database into the DataSource PersonalName 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 = PersonalNameTable.GetRecord(Me.RecordUniqueId, True) + + Return + End If + + ' Since this is a row in the table, the data for this row is loaded by the + ' LoadData method of the BasePersonalNameTableControl when the data for the entire + ' table is loaded. + + Me.DataSource = New PersonalNameRecord() + + + + End Sub + + ' Populate the UI controls using the DataSource. To customize, override this method in PersonalNameTableControlRow. + 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 + + SetNameDate() + SetPersonalLastName1() + SetPersonalName1() + + + + + SetRef2() + + + 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 SetNameDate() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.NameDate.ID) Then + + Me.NameDate.Text = Me.PreviousUIData(Me.NameDate.ID).ToString() + + Return + End If + + + ' Set the NameDate TextBox on the webpage with value from the + ' PersonalName database record. + + ' Me.DataSource is the PersonalName record retrieved from the database. + ' Me.NameDate is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetNameDate() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.NameDateSpecified Then + + ' If the NameDate is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalNameTable.NameDate, "d MMM yy") + + Me.NameDate.Text = formattedValue + + Else + + ' NameDate is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.NameDate.Text = PersonalNameTable.NameDate.Format(PersonalNameTable.NameDate.DefaultValue, "d MMM yy") + + End If + + End Sub + + Public Overridable Sub SetPersonalLastName1() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.PersonalLastName1.ID) Then + + Me.PersonalLastName1.Text = Me.PreviousUIData(Me.PersonalLastName1.ID).ToString() + + Return + End If + + + ' Set the PersonalLastName TextBox on the webpage with value from the + ' PersonalName database record. + + ' Me.DataSource is the PersonalName record retrieved from the database. + ' Me.PersonalLastName1 is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetPersonalLastName1() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.PersonalLastNameSpecified Then + + ' If the PersonalLastName is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalNameTable.PersonalLastName) + + Me.PersonalLastName1.Text = formattedValue + + Else + + ' PersonalLastName is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.PersonalLastName1.Text = PersonalNameTable.PersonalLastName.Format(PersonalNameTable.PersonalLastName.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetPersonalName1() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.PersonalName1.ID) Then + + Me.PersonalName1.Text = Me.PreviousUIData(Me.PersonalName1.ID).ToString() + + Return + End If + + + ' Set the PersonalName TextBox on the webpage with value from the + ' PersonalName database record. + + ' Me.DataSource is the PersonalName record retrieved from the database. + ' Me.PersonalName1 is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetPersonalName1() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.PersonalNameSpecified Then + + ' If the PersonalName is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalNameTable.PersonalName) + + Me.PersonalName1.Text = formattedValue + + Else + + ' PersonalName is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.PersonalName1.Text = PersonalNameTable.PersonalName.Format(PersonalNameTable.PersonalName.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetRef2() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.Ref2.ID) Then + + Me.Ref2.Text = Me.PreviousUIData(Me.Ref2.ID).ToString() + + Return + End If + + + ' Set the Ref TextBox on the webpage with value from the + ' PersonalName database record. + + ' Me.DataSource is the PersonalName record retrieved from the database. + ' Me.Ref2 is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetRef2() + ' 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(PersonalNameTable.Ref0) + + Me.Ref2.Text = formattedValue + + Else + + ' Ref is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.Ref2.Text = PersonalNameTable.Ref0.Format(PersonalNameTable.Ref0.DefaultValue) + + End If + + End Sub + + + Public EvaluateFormulaDelegate As BaseClasses.Data.DataSource.EvaluateFormulaDelegate = New BaseClasses.Data.DataSource.EvaluateFormulaDelegate(AddressOf Me.EvaluateFormula) + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean, ByVal e As FormulaEvaluator) As String + If e Is Nothing Then + e = New FormulaEvaluator() + End If + + e.Variables.Clear() + + + ' add variables for formula evaluation + If variables IsNot Nothing Then + Dim enumerator As System.Collections.Generic.IEnumerator(Of System.Collections.Generic.KeyValuePair(Of String, Object)) = variables.GetEnumerator() + While enumerator.MoveNext() + e.Variables.Add(enumerator.Current.Key, enumerator.Current.Value) + End While + End If + + If includeDS + + End IF + + + ' Other variables referred to in the formula are expected to be + ' properties of the DataSource. For example, referring to + ' UnitPrice as a variable will refer to DataSource.UnitPrice + If dataSourceForEvaluate Is Nothing Then + + e.DataSource = Me.DataSource + + Else + e.DataSource = dataSourceForEvaluate + End If + + ' Define the calling control. This is used to add other + ' related table and record controls as variables. + e.CallingControl = Me + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + + If Not String.IsNullOrEmpty(format) AndAlso (String.IsNullOrEmpty(formula) OrElse formula.IndexOf("Format(") < 0) Then + Return FormulaUtils.Format(resultObj, format) + Else + Return resultObj.ToString() + End If + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format,variables ,includeDS, Nothing) + End Function + + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object)) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format, variables ,True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, format, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal e as FormulaEvaluator) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, variables, True, e) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal includeDS as Boolean) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, includeDS, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, True, Nothing) + End Function + + + Public Overridable Sub RegisterPostback() + + + End Sub + + + + ' To customize, override this method in PersonalNameTableControlRow. + 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 parentCtrl As PersonalIdRecordControl + + + parentCtrl = DirectCast(Me.Page.FindControlRecursively("PersonalIdRecordControl"), PersonalIdRecordControl) + + If (Not IsNothing(parentCtrl) AndAlso IsNothing(parentCtrl.DataSource)) + ' Load the record if it is not loaded yet. + parentCtrl.LoadData() + End If + If (IsNothing(parentCtrl) OrElse IsNothing(parentCtrl.DataSource)) + ' Get the error message from the application resource file. + Throw New Exception(Page.GetResourceValue("Err:NoParentRecId", "Persons")) + End If + + Me.DataSource.PersonalId = parentCtrl.DataSource.PersonalId + + ' 2. Perform any custom validation. + Me.Validate() + + + ' 3. Set the values in the record with data from UI controls. + ' This calls the Get() method for each of the user interface controls. + Me.GetUIData() + + ' 4. Save in the database. + ' We should not save the record if the data did not change. This + ' will save a database hit and avoid triggering any database triggers. + + If Me.DataSource.IsAnyValueChanged Then + ' Save record to database but do not commit yet. + ' Auto generated ids are available after saving for use by child (dependent) records. + Me.DataSource.Save() + + DirectCast(GetParentControlObject(Me, "PersonalNameTableControl"), PersonalNameTableControl).DataChanged = True + DirectCast(GetParentControlObject(Me, "PersonalNameTableControl"), PersonalNameTableControl).ResetData = True + End If + + + ' update session or cookie by formula + + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + ' For Master-Detail relationships, save data on the Detail table(s) + + End Sub + + ' To customize, override this method in PersonalNameTableControlRow. + 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. + + GetNameDate() + GetPersonalLastName1() + GetPersonalName1() + GetRef2() + End Sub + + + Public Overridable Sub GetNameDate() + + ' Retrieve the value entered by the user on the NameDate ASP:TextBox, and + ' save it into the NameDate field in DataSource PersonalName 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.NameDate.Text, PersonalNameTable.NameDate) + + + End Sub + + Public Overridable Sub GetPersonalLastName1() + + ' Retrieve the value entered by the user on the PersonalLastName ASP:TextBox, and + ' save it into the PersonalLastName field in DataSource PersonalName record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.PersonalLastName1.Text, PersonalNameTable.PersonalLastName) + + + End Sub + + Public Overridable Sub GetPersonalName1() + + ' Retrieve the value entered by the user on the PersonalName ASP:TextBox, and + ' save it into the PersonalName field in DataSource PersonalName record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.PersonalName1.Text, PersonalNameTable.PersonalName) + + + End Sub + + Public Overridable Sub GetRef2() + + ' Retrieve the value entered by the user on the Ref ASP:TextBox, and + ' save it into the Ref field in DataSource PersonalName record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.Ref2.Text, PersonalNameTable.Ref0) + + + End Sub + + + ' To customize, override this method in PersonalNameTableControlRow. + + Public Overridable Function CreateWhereClause() As WhereClause + + Return Nothing + + End Function + + + + ' To customize, override this method in PersonalNameTableControlRow. + 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) + PersonalNameTable.DeleteRecord(pkValue) + + DirectCast(GetParentControlObject(Me, "PersonalNameTableControl"), PersonalNameTableControl).DataChanged = True + DirectCast(GetParentControlObject(Me, "PersonalNameTableControl"), PersonalNameTableControl).ResetData = True + End Sub + + Protected Overridable Sub Control_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.PreRender + ' PreRender event is raised just before page is being displayed. + Try + DbUtils.StartTransaction() + Me.RegisterPostback() + + If Not Me.Page.ErrorOnPage AndAlso (Me.Page.IsPageRefresh OrElse Me.DataChanged OrElse Me.ResetData) Then + + + ' Re-load the data and update the web page if necessary. + ' This is typically done during a postback (filter, search button, sort, pagination button). + ' In each of the other click handlers, simply set DataChanged to True to reload the data. + Me.LoadData() + Me.DataBind() + End If + + + Catch ex As Exception + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + Finally + DbUtils.EndTransaction() + End Try + End Sub + + + Protected Overrides Sub SaveControlsToSession() + MyBase.SaveControlsToSession() + + + 'Save pagination state to session. + + End Sub + + + + Protected Overrides Sub ClearControlsFromSession() + MyBase.ClearControlsFromSession() + + + + ' Clear pagination state from session. + + End Sub + + Protected Overrides Sub LoadViewState(ByVal savedState As Object) + MyBase.LoadViewState(savedState) + Dim isNewRecord As String = CType(ViewState("IsNewRecord"), String) + If Not isNewRecord Is Nothing AndAlso isNewRecord.Trim <> "" Then + Me.IsNewRecord = Boolean.Parse(isNewRecord) + End If + + Dim myCheckSum As String = CType(ViewState("CheckSum"), String) + If Not myCheckSum Is Nothing AndAlso myCheckSum.Trim <> "" Then + Me.CheckSum = myCheckSum + End If + + + ' Load view state for pagination control. + + End Sub + + Protected Overrides Function SaveViewState() As Object + ViewState("IsNewRecord") = Me.IsNewRecord.ToString() + ViewState("CheckSum") = Me.CheckSum + + + ' Load view state for pagination control. + + Return MyBase.SaveViewState() + End Function + + + ' event handler for ImageButton + Public Overridable Sub PersonalNameRowDeleteButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + If(Not Me.Page.IsPageRefresh) Then + + Dim tc As PersonalNameTableControl = DirectCast(GetParentControlObject(Me, "PersonalNameTableControl"), PersonalNameTableControl) + If Not (IsNothing(tc)) Then + If Not Me.IsNewRecord Then + tc.AddToDeletedRecordIds(DirectCast(Me, PersonalNameTableControlRow)) + End If + Me.Visible = False + tc.SetFormulaControls() + End If + + End If + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalNameRowEditButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + ' The redirect URL is set on the Properties, Custom Properties or Actions. + ' The ModifyRedirectURL call resolves the parameters before the + ' Response.Redirect redirects the page to the URL. + ' Any code after the Response.Redirect call will not be executed, since the page is + ' redirected to the URL. + + + Dim url As String = "../Shared/ConfigureEditRecord.aspx" + + Dim shouldRedirect As Boolean = True + Dim TargetKey As String = Nothing + Dim DFKA As String = TargetKey + Dim id As String = DFKA + Dim value As String = id + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + url = Me.ModifyRedirectUrl(url, "",False) + url = Me.Page.ModifyRedirectUrl(url, "",False) + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + shouldRedirect = False + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + If shouldRedirect Then + Me.Page.ShouldSaveControlsToSession = True + Me.Page.Response.Redirect(url) + ElseIf Not TargetKey Is Nothing AndAlso _ + Not shouldRedirect Then + Me.Page.ShouldSaveControlsToSession = True + Me.Page.CloseWindow(True) + + End If + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalNameRowViewButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + ' The redirect URL is set on the Properties, Custom Properties or Actions. + ' The ModifyRedirectURL call resolves the parameters before the + ' Response.Redirect redirects the page to the URL. + ' Any code after the Response.Redirect call will not be executed, since the page is + ' redirected to the URL. + + + Dim url As String = "../Shared/ConfigureViewRecord.aspx" + + Dim shouldRedirect As Boolean = True + Dim TargetKey As String = Nothing + Dim DFKA As String = TargetKey + Dim id As String = DFKA + Dim value As String = id + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + url = Me.ModifyRedirectUrl(url, "",False) + url = Me.Page.ModifyRedirectUrl(url, "",False) + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + shouldRedirect = False + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + If shouldRedirect Then + Me.Page.ShouldSaveControlsToSession = True + Me.Page.Response.Redirect(url) + ElseIf Not TargetKey Is Nothing AndAlso _ + Not shouldRedirect Then + Me.Page.ShouldSaveControlsToSession = True + Me.Page.CloseWindow(True) + + End If + End Sub + + Protected Overridable Sub NameDate_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub PersonalLastName1_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub PersonalName1_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub Ref2_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("BasePersonalNameTableControlRow_Rec"), String) + End Get + Set(ByVal value As String) + Me.ViewState("BasePersonalNameTableControlRow_Rec") = value + End Set + End Property + + Private _DataSource As PersonalNameRecord + Public Property DataSource() As PersonalNameRecord + Get + Return Me._DataSource + End Get + + Set(ByVal value As PersonalNameRecord) + + Me._DataSource = value + End Set + End Property + + + + Private _checkSum As String + Public Overridable Property CheckSum() As String + Get + Return Me._checkSum + End Get + Set(ByVal value As String) + Me._checkSum = value + End Set + End Property + + Private _TotalPages As Integer + Public Property TotalPages() As Integer + Get + Return Me._TotalPages + End Get + Set(ByVal value As Integer) + Me._TotalPages = value + End Set + End Property + + Private _PageIndex As Integer + Public Property PageIndex() As Integer + Get + ' Return the PageIndex + Return Me._PageIndex + End Get + Set(ByVal value As Integer) + Me._PageIndex = value + End Set + End Property + + Private _DisplayLastPage As Boolean + Public Property DisplayLastPage() As Boolean + Get + Return Me._DisplayLastPage + End Get + Set(ByVal value As Boolean) + Me._DisplayLastPage = value + End Set + End Property + + + +#Region "Helper Properties" + + Public ReadOnly Property NameDate() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "NameDate"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property PersonalLastName1() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalLastName1"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property PersonalName1() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalName1"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property PersonalNameRecordRowSelection() As System.Web.UI.WebControls.CheckBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalNameRecordRowSelection"), System.Web.UI.WebControls.CheckBox) + End Get + End Property + + Public ReadOnly Property PersonalNameRowDeleteButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalNameRowDeleteButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalNameRowEditButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalNameRowEditButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalNameRowViewButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalNameRowViewButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property Ref2() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Ref2"), System.Web.UI.WebControls.TextBox) + 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 PersonalNameRecord = 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 PersonalNameRecord + If Not Me.DataSource Is Nothing Then + Return Me.DataSource + End If + + If Not Me.RecordUniqueId Is Nothing Then + + Return PersonalNameTable.GetRecord(Me.RecordUniqueId, True) + + End If + + ' Localization. + + Return Nothing + + End Function + + Public Shadows ReadOnly Property Page() As BaseApplicationPage + Get + Return DirectCast(MyBase.Page, BaseApplicationPage) + End Get + End Property + +#End Region + +End Class + + + +' Base class for the PersonalNameTableControl control on the EditPersonalId page. +' Do not modify this class. Instead override any method in PersonalNameTableControl. +Public Class BasePersonalNameTableControl + Inherits Persons.UI.BaseApplicationTableControl + + + + Protected Overridable Sub Control_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Init + + + + ' Setup the filter and search events. + + + + ' Control Initializations. + ' Initialize the table's current sort order. + + If Me.InSession(Me, "Order_By") Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + Me.CurrentSortOrder.Add(PersonalNameTable.NameDate, OrderByItem.OrderDir.Asc) + + End If + + + + ' Setup default pagination settings. + + Me.PageSize = CInt(Me.GetFromSession(Me, "Page_Size", "10")) + Me.PageIndex = CInt(Me.GetFromSession(Me, "Page_Index", "0")) + + + + Me.ClearControlsFromSession() + End Sub + + Protected Overridable Sub Control_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load + + SaveControlsToSession_Ajax() + + ' Show confirmation message on Click + Me.PersonalNameDeleteButton.Attributes.Add("onClick", "return (confirm('" & (CType(Me.Page,BaseApplicationPage)).GetResourceValue("DeleteConfirm", "Persons") & "'));") + + ' Setup the pagination events. + + AddHandler Me.PersonalNamePagination.FirstPage.Click, AddressOf PersonalNamePagination_FirstPage_Click + + AddHandler Me.PersonalNamePagination.LastPage.Click, AddressOf PersonalNamePagination_LastPage_Click + + AddHandler Me.PersonalNamePagination.NextPage.Click, AddressOf PersonalNamePagination_NextPage_Click + + AddHandler Me.PersonalNamePagination.PageSizeButton.Click, AddressOf PersonalNamePagination_PageSizeButton_Click + + AddHandler Me.PersonalNamePagination.PreviousPage.Click, AddressOf PersonalNamePagination_PreviousPage_Click + + + ' Setup the sorting events. + + AddHandler Me.NameDateLabel.Click, AddressOf NameDateLabel_Click + + AddHandler Me.PersonalLastNameLabel2.Click, AddressOf PersonalLastNameLabel2_Click + + AddHandler Me.PersonalNameLabel2.Click, AddressOf PersonalNameLabel2_Click + + AddHandler Me.RefLabel1.Click, AddressOf RefLabel1_Click + + ' Setup the button events. + + AddHandler Me.PersonalNameAddButton.Click, AddressOf PersonalNameAddButton_Click + + AddHandler Me.PersonalNameDeleteButton.Click, AddressOf PersonalNameDeleteButton_Click + + AddHandler Me.PersonalNameEditButton.Click, AddressOf PersonalNameEditButton_Click + + AddHandler Me.PersonalNameResetButton.Click, AddressOf PersonalNameResetButton_Click + + + ' Setup events for others + + End Sub + + + Public Overridable Sub LoadData() + + ' Read data from database. Returns an array of records that can be assigned + ' to the DataSource table control property. + Try + Dim joinFilter As CompoundFilter = CreateCompoundJoinFilter() + + ' The WHERE clause will be empty when displaying all records in table. + Dim wc As WhereClause = CreateWhereClause() + If wc IsNot Nothing AndAlso Not wc.RunQuery Then + ' Initialize an empty array of records + Dim alist As New ArrayList(0) + Me.DataSource = DirectCast(alist.ToArray(GetType(PersonalNameRecord)), PersonalNameRecord()) + ' Add records to the list if needed. + Me.AddNewRecords() + Me._TotalRecords = 0 + Me._TotalPages = 0 + Return + End If + + ' Call OrderBy to determine the order - either use the order defined + ' on the Query Wizard, or specified by user (by clicking on column heading) + Dim orderBy As OrderBy = CreateOrderBy() + + ' Get the pagesize from the pagesize control. + Me.GetPageSize() + + If Me.DisplayLastPage Then + Dim totalRecords As Integer = If(Me._TotalRecords < 0, PersonalNameTable.GetRecordCount(CreateCompoundJoinFilter(), CreateWhereClause()), Me._TotalRecords) + + Dim totalPages As Integer = CInt(Math.Ceiling(totalRecords / Me.PageSize)) + + Me.PageIndex = totalPages - 1 + End If + + ' Make sure PageIndex (current page) and PageSize are within bounds. + If Me.PageIndex < 0 Then + Me.PageIndex = 0 + End If + If Me.PageSize < 1 Then + Me.PageSize = 1 + End If + + ' Retrieve the records and set the table DataSource. + ' Only PageSize records are fetched starting at PageIndex (zero based). + If Me.AddNewRecord > 0 Then + ' Make sure to preserve the previously entered data on new rows. + Dim postdata As New ArrayList + For Each rc As PersonalNameTableControlRow In Me.GetRecordControls() + If Not rc.IsNewRecord Then + rc.DataSource = rc.GetRecord() + rc.GetUIData() + postdata.Add(rc.DataSource) + UIData.Add(rc.PreservedUIData()) + End If + Next + Me.DataSource = DirectCast(postdata.ToArray(GetType(PersonalNameRecord)), PersonalNameRecord()) + Else ' Get the records from the database + Me.DataSource = PersonalNameTable.GetRecords(joinFilter, wc, orderBy, Me.PageIndex, Me.PageSize) + + End If + + ' if the datasource contains no records contained in database, then load the last page. + If (DbUtils.GetCreatedRecords(Me.DataSource).Length = 0 AndAlso Not Me.DisplayLastPage) Then + Me.DisplayLastPage = True + LoadData() + Else + + ' Add any new rows desired by the user. + Me.AddNewRecords() + + ' Turn off the ToggleAll checkbox + Me.PersonalNameToggleAll.Checked = False + + + ' Initialize the page and grand totals. now + + End If + + Catch ex As Exception + ' Report the error message to the end user + Dim msg As String = ex.Message + If ex.InnerException IsNot Nothing Then + msg = msg & " InnerException: " & ex.InnerException.Message + End If + Throw New Exception(msg, ex.InnerException) + End Try + End Sub + + + + + Public Overrides Sub DataBind() + ' The DataBind method binds the user interface controls to the values + ' from the database record for each row in the table. To do this, it calls the + ' DataBind for each of the rows. + ' DataBind also populates any filters above the table, and sets the pagination + ' control to the correct number of records and the current page number. + + MyBase.DataBind() + + ' Make sure that the DataSource is initialized. + If Me.DataSource Is Nothing Then + Return + End If + + 'LoadData for DataSource for chart and report if they exist + + ' Setup the pagination controls. + BindPaginationControls() + + + + ' Bind the repeater with the list of records to expand the UI. + Dim rep As System.Web.UI.WebControls.Repeater = CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalNameTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return + rep.DataSource = DataSource() + rep.DataBind() + + Dim index As Integer = 0 + For Each repItem As System.Web.UI.WebControls.RepeaterItem In rep.Items + ' Loop through all rows in the table, set its DataSource and call DataBind(). + Dim recControl As PersonalNameTableControlRow = DirectCast(repItem.FindControl("PersonalNameTableControlRow"), PersonalNameTableControlRow) + recControl.DataSource = Me.DataSource(index) + If Me.UIData.Count > index Then + recControl.PreviousUIData = Me.UIData(index) + End If + recControl.DataBind() + recControl.Visible = Not Me.InDeletedRecordIds(recControl) + + index += 1 + Next + + + + + ' Call the Set methods for each controls on the panel + + SetNameDateLabel() + SetPersonalLastNameLabel2() + + + + SetPersonalNameLabel2() + + + SetPersonalNameTableControlCollapsibleRegion() + + SetRefLabel1() + ' setting the state of expand or collapse alternative rows + + + ' Load data for each record and table UI control. + ' Ordering is important because child controls get + ' their parent ids from their parent UI controls. + + + ' this method calls the set method for controls with special formula like running total, sum, rank, etc + SetFormulaControls() + End Sub + + Public Overridable Sub SetFormulaControls() + ' this method calls Set methods for the control that has special formula + + + + End Sub + + + + Public Overridable Sub RegisterPostback() + + + End Sub + + Public EvaluateFormulaDelegate As BaseClasses.Data.DataSource.EvaluateFormulaDelegate = New BaseClasses.Data.DataSource.EvaluateFormulaDelegate(AddressOf Me.EvaluateFormula) + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean, ByVal e as FormulaEvaluator) As String + If e Is Nothing + e = New FormulaEvaluator() + End If + + e.Variables.Clear() + + + ' add variables for formula evaluation + If variables IsNot Nothing Then + Dim enumerator As System.Collections.Generic.IEnumerator(Of System.Collections.Generic.KeyValuePair(Of String, Object)) = variables.GetEnumerator() + While enumerator.MoveNext() + e.Variables.Add(enumerator.Current.Key, enumerator.Current.Value) + End While + End If + + If includeDS + + End If + + ' All variables referred to in the formula are expected to be + ' properties of the DataSource. For example, referring to + ' UnitPrice as a variable will refer to DataSource.UnitPrice + e.DataSource = dataSourceForEvaluate + + ' Define the calling control. This is used to add other + ' related table and record controls as variables. + e.CallingControl = Me + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + + If Not String.IsNullOrEmpty(format) AndAlso (String.IsNullOrEmpty(formula) OrElse formula.IndexOf("Format(") < 0) Then + Return FormulaUtils.Format(resultObj, format) + Else + Return resultObj.ToString() + End If + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format,variables ,includeDS, Nothing) + End Function + + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object)) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format, variables ,True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, format, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal e as FormulaEvaluator) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, variables, True, e) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal includeDS as Boolean) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, includeDS, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, True, Nothing) + End Function + + + + + Public Overridable Sub ResetControl() + + Me.CurrentSortOrder.Reset() + If (Me.InSession(Me, "Order_By")) Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + Me.CurrentSortOrder.Add(PersonalNameTable.NameDate, OrderByItem.OrderDir.Asc) + + End If + + Me.PageIndex = 0 + End Sub + + Protected Overridable Sub BindPaginationControls() + ' Setup the pagination controls. + + ' Bind the pagination labels. + + If DbUtils.GetCreatedRecords(Me.DataSource).Length > 0 Then + + Me.PersonalNamePagination.CurrentPage.Text = (Me.PageIndex + 1).ToString() + Else + Me.PersonalNamePagination.CurrentPage.Text = "0" + End If + Me.PersonalNamePagination.PageSize.Text = Me.PageSize.ToString() + Me.PersonalNamePagination.TotalItems.Text = Me.TotalRecords.ToString() + Me.PersonalNamePagination.TotalPages.Text = Me.TotalPages.ToString() + + ' Bind the buttons for PersonalNameTableControl pagination. + + Me.PersonalNamePagination.FirstPage.Enabled = Not (Me.PageIndex = 0) + If Me._TotalPages < 0 Then ' if the total pages is not determined yet, enable last and next buttons + Me.PersonalNamePagination.LastPage.Enabled = True + ElseIf Me._TotalPages = 0 ' if the total pages is determined and it is 0, enable last and next buttons + Me.PersonalNamePagination.LastPage.Enabled = False + Else ' if the total pages is the last page, disable last and next buttons + Me.PersonalNamePagination.LastPage.Enabled = Not (Me.PageIndex = Me.TotalPages - 1) + End If + + If Me._TotalPages < 0 Then ' if the total pages is not determined yet, enable last and next buttons + Me.PersonalNamePagination.NextPage.Enabled = True + ElseIf Me._TotalPages = 0 ' if the total pages is determined and it is 0, enable last and next buttons + Me.PersonalNamePagination.NextPage.Enabled = False + Else ' if the total pages is the last page, disable last and next buttons + Me.PersonalNamePagination.NextPage.Enabled = Not (Me.PageIndex = Me.TotalPages - 1) + End If + + Me.PersonalNamePagination.PreviousPage.Enabled = Not (Me.PageIndex = 0) + + + End Sub + + Public Overridable Sub SaveData() + ' Save the data from the entire table. Calls each row's Save Data + ' to save their data. This function is called by the Click handler of the + ' Save button. The button handler should Start/Commit/End a transaction. + + Dim recCtl As PersonalNameTableControlRow + For Each recCtl In Me.GetRecordControls() + + If Me.InDeletedRecordIds(recCtl) Then + ' Delete any pending deletes. + recCtl.Delete() + Else + If recCtl.Visible Then + recCtl.SaveData() + End If + End If + + Next + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + ' Set IsNewRecord to False for all records - since everything has been saved and is no longer "new" + For Each recCtl In Me.GetRecordControls() + recCtl.IsNewRecord = False + Next + + + ' Set DeletedRecordsIds to Nothing since we have deleted all pending deletes. + Me.DeletedRecordIds = Nothing + + End Sub + + Public Overridable Function CreateCompoundJoinFilter() As CompoundFilter + Dim jFilter As CompoundFilter = New CompoundFilter() + + Return jFilter + + End Function + + + Public Overridable Function CreateOrderBy() As OrderBy + ' The CurrentSortOrder is initialized to the sort order on the + ' Query Wizard. It may be modified by the Click handler for any of + ' the column heading to sort or reverse sort by that column. + ' You can add your own sort order, or modify it on the Query Wizard. + Return Me.CurrentSortOrder + End Function + + Public Overridable Function CreateWhereClause() As WhereClause + 'This CreateWhereClause is used for loading the data. + PersonalNameTable.Instance.InnerFilter = Nothing + Dim wc As WhereClause = New WhereClause() + + ' Compose the WHERE clause consiting of: + ' 1. Static clause defined at design time. + ' 2. User selected search criteria. + ' 3. User selected filter criteria. + + + Dim selectedRecordKeyValue as KeyValue = New KeyValue() + + Dim personalIdRecordControlObj As Persons.UI.Controls.EditPersonalId.PersonalIdRecordControl = DirectCast(MiscUtils.FindControlRecursively(Me.Page, "PersonalIdRecordControl"), Persons.UI.Controls.EditPersonalId.PersonalIdRecordControl) + + If (Not IsNothing(personalIdRecordControlObj) AndAlso Not IsNothing(personalIdRecordControlObj.GetRecord()) AndAlso personalIdRecordControlObj.GetRecord().IsCreated AndAlso Not IsNothing(personalIdRecordControlObj.GetRecord().PersonalId)) + wc.iAND(PersonalNameTable.PersonalId, BaseFilter.ComparisonOperator.EqualsTo, personalIdRecordControlObj.GetRecord().PersonalId.ToString()) + selectedRecordKeyValue.AddElement(PersonalNameTable.PersonalId.InternalName, personalIdRecordControlObj.GetRecord().PersonalId.ToString()) + Else + wc.RunQuery = False + Return wc + End If + + HttpContext.Current.Session("PersonalNameTableControlWhereClause") = selectedRecordKeyValue.ToXmlString() + + Return wc + End Function + + + Public Overridable Function CreateWhereClause(ByVal searchText as String, ByVal fromSearchControl as String, ByVal AutoTypeAheadSearch as String, ByVal AutoTypeAheadWordSeparators as String) As WhereClause + ' This CreateWhereClause is used for loading list of suggestions for Auto Type-Ahead feature. + PersonalNameTable.Instance.InnerFilter = Nothing + Dim wc As WhereClause = New WhereClause() + + ' Compose the WHERE clause consiting of: + ' 1. Static clause defined at design time. + ' 2. User selected search criteria. + ' 3. User selected filter criteria. + + Dim appRelativeVirtualPath As String = CType(HttpContext.Current.Session("AppRelativeVirtualPath"), String) + + Dim selectedRecordInPersonalIdRecordControl as String = DirectCast(HttpContext.Current.Session("PersonalNameTableControlWhereClause"), String) + + If Not selectedRecordInPersonalIdRecordControl Is Nothing AndAlso KeyValue.IsXmlKey(selectedRecordInPersonalIdRecordControl) Then + Dim selectedRecordKeyValue as KeyValue = KeyValue.XmlToKey(selectedRecordInPersonalIdRecordControl) + + If Not IsNothing(selectedRecordKeyValue) AndAlso selectedRecordKeyValue.ContainsColumn(PersonalNameTable.PersonalId) Then + wc.iAND(PersonalNameTable.PersonalId, BaseFilter.ComparisonOperator.EqualsTo, selectedRecordKeyValue.GetColumnValue(PersonalNameTable.PersonalId).ToString()) + End If + + End If + + ' Adds clauses if values are selected in Filter controls which are configured in the page. + + + Return wc + End Function + + + Public Overridable Function FormatSuggestions(ByVal prefixText As String, ByVal resultItem As String, _ + ByVal columnLength As Integer, ByVal AutoTypeAheadDisplayFoundText As String, _ + ByVal autoTypeAheadSearch As String, ByVal AutoTypeAheadWordSeparators As String, _ + ByVal resultList As ArrayList) As Boolean + + 'Formats the resultItem and adds it to the list of suggestions. + Dim index As Integer = resultItem.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture).IndexOf(prefixText.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture)) + Dim itemToAdd As String = "" + Dim isFound As Boolean = False + Dim isAdded As Boolean = False + ' Get the index where prfixt is at the beginning of resultItem. If not found then, index of word which begins with prefixText. + If InvariantLCase(autoTypeAheadSearch).equals("wordsstartingwithsearchstring") And Not index = 0 Then + ' Expression to find word which contains AutoTypeAheadWordSeparators followed by prefixText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex( AutoTypeAheadWordSeparators + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + If regex1.IsMatch(resultItem) Then + index = regex1.Match(resultItem).Index + isFound = True + End If + ' If the prefixText is found immediatly after white space then starting of the word is found so don not search any further + If not resultItem(index).ToString() = " " Then + ' Expression to find beginning of the word which contains AutoTypeAheadWordSeparators followed by prefixText + Dim regex As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\\S*" + AutoTypeAheadWordSeparators + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + If regex.IsMatch(resultItem) Then + index = regex.Match(resultItem).Index + isFound = True + End If + End If + End If + + ' If autoTypeAheadSearch value is wordsstartingwithsearchstring then, extract the substring only if the prefixText is found at the + ' beginning of the resultItem (index = 0) or a word in resultItem is found starts with prefixText. + If index = 0 Or isFound Or InvariantLCase(autoTypeAheadSearch).Equals("anywhereinstring") then + If InvariantLCase(AutoTypeAheadDisplayFoundText).equals("atbeginningofmatchedstring") Then + ' Expression to find beginning of the word which contains prefixText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\\S*" + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + ' Find the beginning of the word which contains prefexText + If (StringUtils.InvariantLCase(autoTypeAheadSearch).Equals("anywhereinstring") AndAlso regex1.IsMatch(resultItem)) Then + index = regex1.Match(resultItem).Index + isFound = True + End If + ' Display string from the index till end of the string if sub string from index till end is less than columnLength value. + If Len(resultItem) - index <= columnLength Then + If index = 0 Then + itemToAdd = resultItem + Else + itemToAdd = "..." & resultItem.Substring(index, Len(resultItem) - index) + End If + Else + If index = 0 Then + itemToAdd = resultItem.Substring(index, (columnLength - 3)) & "..." + Else + 'Truncate the string to show only columnLength - 6 characters as begining and trailing "..." has to be appended. + itemToAdd = "..." & resultItem.Substring(index , columnLength - 6) & "..." + End If + End If + ElseIf InvariantLCase(AutoTypeAheadDisplayFoundText).equals("inmiddleofmatchedstring") Then + Dim subStringBeginIndex As Integer = CType(columnLength/2, Integer) + If Len(resultItem) <= columnLength Then + itemToAdd = resultItem + Else + ' Sanity check at end of the string + If index + Len(prefixText) = columnLength Then + itemToAdd = "..." & resultItem.Substring(index-columnLength,index) + ElseIf Len(resultItem) - index < subStringBeginIndex Then + ' Display string from the end till columnLength value if, index is closer to the end of the string. + itemToAdd = "..." & resultItem.Substring(Len(resultItem)-columnLength,Len(resultItem)) + ElseIf index <= subStringBeginIndex Then + ' Sanity chet at beginning of the string + itemToAdd = resultItem.Substring(0, columnLength) & "..." + Else + ' Display string containing text before the prefixText occures and text after the prefixText + itemToAdd = "..." & resultItem.Substring(index - subStringBeginIndex, columnLength) & "..." + End If + End If + ElseIf InvariantLCase(AutoTypeAheadDisplayFoundText).equals("atendofmatchedstring") Then + ' Expression to find ending of the word which contains prefexText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\s", System.Text.RegularExpressions.RegexOptions.IgnoreCase) + ' Find the ending of the word which contains prefexText + If regex1.IsMatch(resultItem, index + 1) Then + index = regex1.Match(resultItem, index + 1).Index + Else + ' If the word which contains prefexText is the last word in string, regex1.IsMatch returns false. + index = resultItem.Length + End If + If index > Len(resultItem) Then + index = Len(resultItem) + End If + ' If text from beginning of the string till index is less than columnLength value then, display string from the beginning till index. + If index <= columnLength Then + if index = Len(resultItem) Then 'Make decision to append "..." + itemToAdd = resultItem.Substring(0,index) + Else + itemToAdd = resultItem.Substring(0,index) & "..." + End If + Else + If index = Len(resultItem) Then + itemToAdd = "..." & resultItem.Substring(index - (columnLength - 3), (columnLength - 3)) + Else + 'Truncate the string to show only columnLength - 6 characters as begining and trailing "..." has to be appended. + itemToAdd = "..." & resultItem.Substring(index - (columnLength - 6), columnLength - 6) & "..." + End If + End If + End If + + ' Remove newline character from itemToAdd + Dim prefixTextIndex As Integer = itemToAdd.IndexOf(prefixText, StringComparison.CurrentCultureIgnoreCase) + ' If itemToAdd contains any newline after the search text then show text only till newline + Dim regex2 As System.Text.RegularExpressions.Regex = New System.Text.RegularExpressions.Regex("(" & vbCrLf & "|" & vbLf & ")", System.Text.RegularExpressions.RegexOptions.IgnoreCase) + Dim newLineIndexAfterPrefix As Integer = -1 + If regex2.IsMatch(itemToAdd, prefixTextIndex) Then + newLineIndexAfterPrefix = regex2.Match(itemToAdd, prefixTextIndex).Index + End If + If (newLineIndexAfterPrefix > -1) Then + If itemToAdd.EndsWith("...") Then + itemToAdd = (itemToAdd.Substring(0, newLineIndexAfterPrefix) + "...") + Else + itemToAdd = itemToAdd.Substring(0, newLineIndexAfterPrefix) + End If + End If + ' If itemToAdd contains any newline before search text then show text which comes after newline + Dim regex3 As System.Text.RegularExpressions.Regex = New System.Text.RegularExpressions.Regex("(" & vbCrLf & "|" & vbLf & ")", (System.Text.RegularExpressions.RegexOptions.IgnoreCase Or System.Text.RegularExpressions.RegexOptions.RightToLeft)) + Dim newLineIndexBeforePrefix As Integer = -1 + If regex3.IsMatch(itemToAdd, prefixTextIndex) Then + newLineIndexBeforePrefix = regex3.Match(itemToAdd, prefixTextIndex).Index + End If + If (newLineIndexBeforePrefix > -1) Then + If itemToAdd.StartsWith("...") Then + itemToAdd = ("..." + itemToAdd.Substring((newLineIndexBeforePrefix + regex3.Match(itemToAdd, prefixTextIndex).Length))) + Else + itemToAdd = itemToAdd.Substring((newLineIndexBeforePrefix + regex3.Match(itemToAdd, prefixTextIndex).Length)) + End If + End If + + If Not itemToAdd is nothing AndAlso Not resultList.Contains(itemToAdd) Then + + resultList.Add(itemToAdd) + + isAdded = true + End If + End If + Return isAdded + End Function + + + Protected Overridable Sub GetPageSize() + + If Me.PersonalNamePagination.PageSize.Text.Trim <> "" Then + Try + 'Me.PageSize = Integer.Parse(Me.PersonalNamePagination.PageSize.Text) + Catch ex As Exception + End Try + End If + End Sub + + Protected Overridable Sub AddNewRecords() + + Dim newRecordList As ArrayList = New ArrayList() + + Dim newUIDataList As System.Collections.Generic.List(Of Hashtable) = New System.Collections.Generic.List(Of Hashtable)() + + ' Loop though all the record controls and if the record control + ' does not have a unique record id set, then create a record + ' and add to the list. + If Not Me.ResetData Then + Dim rep As System.Web.UI.WebControls.Repeater = CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalNameTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return + + Dim repItem As System.Web.UI.WebControls.RepeaterItem + For Each repItem In rep.Items + ' Loop through all rows in the table, set its DataSource and call DataBind(). + + Dim recControl As PersonalNameTableControlRow = DirectCast(repItem.FindControl("PersonalNameTableControlRow"), PersonalNameTableControlRow) + + If recControl.Visible AndAlso recControl.IsNewRecord() Then + + Dim rec As PersonalNameRecord = New PersonalNameRecord() + + If recControl.NameDate.Text <> "" Then + rec.Parse(recControl.NameDate.Text, PersonalNameTable.NameDate) + End If + If recControl.PersonalLastName1.Text <> "" Then + rec.Parse(recControl.PersonalLastName1.Text, PersonalNameTable.PersonalLastName) + End If + If recControl.PersonalName1.Text <> "" Then + rec.Parse(recControl.PersonalName1.Text, PersonalNameTable.PersonalName) + End If + If recControl.Ref2.Text <> "" Then + rec.Parse(recControl.Ref2.Text, PersonalNameTable.Ref0) + End If + newUIDataList.Add(recControl.PreservedUIData()) + newRecordList.Add(rec) + End If + Next + End If + + + ' Add any new record to the list. + Dim index As Integer = 0 + For index = 1 To Me.AddNewRecord + + newRecordList.Insert(0, New PersonalNameRecord()) + newUIDataList.Insert(0, New Hashtable()) + + Next + Me.AddNewRecord = 0 + + ' Finally, add any new records to the DataSource. + If newRecordList.Count > 0 Then + + Dim finalList As ArrayList = New ArrayList(Me.DataSource) + finalList.InsertRange(0, newRecordList) + + Me.DataSource = DirectCast(finalList.ToArray(GetType(PersonalNameRecord)), PersonalNameRecord()) + + End If + + ' Add the existing UI data to this hash table + If newUIDataList.Count > 0 Then + Me.UIData.InsertRange(0, newUIDataList) + End If + + End Sub + + + Public Sub AddToDeletedRecordIds(ByVal rec As PersonalNameTableControlRow) + If rec.IsNewRecord() Then + Return + End If + + If Not Me.DeletedRecordIds Is Nothing AndAlso Me.DeletedRecordIds.Trim <> "" Then + Me.DeletedRecordIds &= "," + End If + + Me.DeletedRecordIds &= "[" & rec.RecordUniqueId & "]" + End Sub + + Protected Overridable Function InDeletedRecordIds(ByVal rec As PersonalNameTableControlRow) As Boolean + If Me.DeletedRecordIds Is Nothing OrElse Me.DeletedRecordIds.Trim = "" Then + Return False + End If + + Return Me.DeletedRecordIds.IndexOf("[" & rec.RecordUniqueId & "]") >= 0 + End Function + + Private _DeletedRecordIds As String + Public Property DeletedRecordIds() As String + Get + Return Me._DeletedRecordIds + End Get + Set(ByVal value As String) + Me._DeletedRecordIds = value + End Set + End Property + + + ' Create Set, WhereClause, and Populate Methods + + Public Overridable Sub SetNameDateLabel() + + End Sub + + Public Overridable Sub SetPersonalLastNameLabel2() + + End Sub + + Public Overridable Sub SetPersonalNameLabel2() + + End Sub + + Public Overridable Sub SetPersonalNameTableControlCollapsibleRegion() + + End Sub + + Public Overridable Sub SetRefLabel1() + + 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. + Dim added As Boolean = Me.AddNewRecord > 0 + Me.LoadData() + Me.DataBind() + + If added Then + Me.SetFocusToAddedRow() + End If + + End If + + + + Catch ex As Exception + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + Finally + DbUtils.EndTransaction + End Try + End Sub + + 'this function sets focus to the first editable element in the new added row in the editable table + Protected Overridable Sub SetFocusToAddedRow() + Dim rep As System.Web.UI.WebControls.Repeater = CType(Me.FindControl("PersonalNameTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing OrElse rep.Items.Count = 0 Then Return + Dim repItem As System.Web.UI.WebControls.RepeaterItem + For Each repItem In rep.Items + 'Load scripts to table rows + Me.Page.LoadFocusScripts(repItem) + Dim recControl As PersonalNameTableControlRow = DirectCast(repItem.FindControl("PersonalNameTableControlRow"), PersonalNameTableControlRow) + If recControl.IsNewRecord Then + For Each field As Control In recControl.Controls + If field.Visible AndAlso Me.Page.IsControlEditable(field, False) Then + 'set focus on the first editable field in the new row + field.Focus() + Dim updPan As UpdatePanel = DirectCast(Me.Page.FindControlRecursively("UpdatePanel1"), UpdatePanel) + If Not updPan Is Nothing Then updPan.Update() + Return + End If + Next + Return + End If + Next + End Sub + + + Protected Overrides Sub SaveControlsToSession() + MyBase.SaveControlsToSession() + + ' Save filter controls to values to session. + + + 'Save pagination state to session. + + + + ' Save table control properties to the session. + If Not Me.CurrentSortOrder Is Nothing Then + Me.SaveToSession(Me, "Order_By", Me.CurrentSortOrder.ToXmlString()) + End If + + Me.SaveToSession(Me, "Page_Index", Me.PageIndex.ToString()) + Me.SaveToSession(Me, "Page_Size", Me.PageSize.ToString()) + + Me.SaveToSession(Me, "DeletedRecordIds", Me.DeletedRecordIds) + + End Sub + + Protected Sub SaveControlsToSession_Ajax() + ' Save filter controls to values to session. + + HttpContext.Current.Session("AppRelativeVirtualPath") = Me.Page.AppRelativeVirtualPath + + End Sub + + Protected Overrides Sub ClearControlsFromSession() + MyBase.ClearControlsFromSession() + + ' Clear filter controls values from the session. + + + ' Clear pagination state from session. + + + + ' Clear table properties from the session. + Me.RemoveFromSession(Me, "Order_By") + Me.RemoveFromSession(Me, "Page_Index") + Me.RemoveFromSession(Me, "Page_Size") + + Me.RemoveFromSession(Me, "DeletedRecordIds") + + End Sub + + Protected Overrides Sub LoadViewState(ByVal savedState As Object) + MyBase.LoadViewState(savedState) + + Dim orderByStr As String = CType(ViewState("PersonalNameTableControl_OrderBy"), String) + + If orderByStr IsNot Nothing AndAlso orderByStr.Trim <> "" Then + Me.CurrentSortOrder = BaseClasses.Data.OrderBy.FromXmlString(orderByStr) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + End If + + Dim pageIndex As String = CType(ViewState("Page_Index"), String) + If pageIndex IsNot Nothing Then + Me.PageIndex = CInt(pageIndex) + End If + + Dim pageSize As String = CType(ViewState("Page_Size"), String) + If Not pageSize Is Nothing Then + Me.PageSize = CInt(pageSize) + End If + + + + ' Load view state for pagination control. + + Me.DeletedRecordIds = CType(Me.ViewState("DeletedRecordIds"), String) + + End Sub + + Protected Overrides Function SaveViewState() As Object + + If Me.CurrentSortOrder IsNot Nothing Then + Me.ViewState("PersonalNameTableControl_OrderBy") = Me.CurrentSortOrder.ToXmlString() + End If + + Me.ViewState("Page_Index") = Me.PageIndex + Me.ViewState("Page_Size") = Me.PageSize + + Me.ViewState("DeletedRecordIds") = Me.DeletedRecordIds + + + ' Load view state for pagination control. + + + Return MyBase.SaveViewState() + End Function + + ' Generate the event handling functions for pagination events. + + ' event handler for ImageButton + Public Overridable Sub PersonalNamePagination_FirstPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.PageIndex = 0 + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalNamePagination_LastPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.DisplayLastPage = True + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalNamePagination_NextPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.PageIndex += 1 + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for LinkButton + Public Overridable Sub PersonalNamePagination_PageSizeButton_Click(ByVal sender As Object, ByVal args As EventArgs) + + Try + + Me.DataChanged = True + + Me.PageSize = Integer.Parse(Me.PersonalNamePagination.PageSize.Text) + + Me.PageIndex = Integer.Parse(Me.PersonalNamePagination.CurrentPage.Text) - 1 + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalNamePagination_PreviousPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + If Me.PageIndex > 0 Then + Me.PageIndex -= 1 + Me.DataChanged = True + End If + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + + ' Generate the event handling functions for sorting events. + + Public Overridable Sub NameDateLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by NameDate when clicked. + + ' Get previous sorting state for NameDate. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalNameTable.NameDate) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for NameDate. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalNameTable.NameDate, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by NameDate, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub PersonalLastNameLabel2_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by PersonalLastName when clicked. + + ' Get previous sorting state for PersonalLastName. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalNameTable.PersonalLastName) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for PersonalLastName. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalNameTable.PersonalLastName, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by PersonalLastName, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub PersonalNameLabel2_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by PersonalName when clicked. + + ' Get previous sorting state for PersonalName. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalNameTable.PersonalName) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for PersonalName. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalNameTable.PersonalName, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by PersonalName, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub RefLabel1_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by Ref when clicked. + + ' Get previous sorting state for Ref. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalNameTable.Ref0) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for Ref. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalNameTable.Ref0, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by Ref, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + + ' Generate the event handling functions for button events. + + ' event handler for ImageButton + Public Overridable Sub PersonalNameAddButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + Me.AddNewRecord = 1 + Me.DataChanged = True + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalNameDeleteButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + If(Not Me.Page.IsPageRefresh) Then + + Me.DeleteSelectedRecords(True) + Me.SetFormulaControls() + + + End If + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalNameEditButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + ' The redirect URL is set on the Properties, Custom Properties or Actions. + ' The ModifyRedirectURL call resolves the parameters before the + ' Response.Redirect redirects the page to the URL. + ' Any code after the Response.Redirect call will not be executed, since the page is + ' redirected to the URL. + + + Dim url As String = "../Shared/ConfigureEditRecord.aspx" + + Dim shouldRedirect As Boolean = True + Dim TargetKey As String = Nothing + Dim DFKA As String = TargetKey + Dim id As String = DFKA + Dim value As String = id + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + url = Me.ModifyRedirectUrl(url, "",False) + url = Me.Page.ModifyRedirectUrl(url, "",False) + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + shouldRedirect = False + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + If shouldRedirect Then + Me.Page.ShouldSaveControlsToSession = True + Me.Page.Response.Redirect(url) + ElseIf Not TargetKey Is Nothing AndAlso _ + Not shouldRedirect Then + Me.Page.ShouldSaveControlsToSession = True + Me.Page.CloseWindow(True) + + End If + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalNameResetButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.CurrentSortOrder.Reset() + If Me.InSession(Me, "Order_By") Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + Me.CurrentSortOrder.Add(PersonalNameTable.NameDate, OrderByItem.OrderDir.Asc) + + + End If + + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + + + ' Generate the event handling functions for filter and search events. + + + ' Generate the event handling functions for others + + + Private _UIData As New System.Collections.Generic.List(Of Hashtable) + Public Property UIData() As System.Collections.Generic.List(Of Hashtable) + Get + Return Me._UIData + End Get + Set(ByVal value As System.Collections.Generic.List(Of Hashtable)) + Me._UIData = value + End Set + End Property + + ' pagination properties + Protected _PageSize As Integer + Public Property PageSize() As Integer + Get + Return Me._PageSize + End Get + Set(ByVal value As Integer) + Me._PageSize = value + End Set + End Property + + Protected _PageIndex As Integer + Public Property PageIndex() As Integer + Get + ' Return the PageIndex + Return Me._PageIndex + End Get + Set(ByVal value As Integer) + Me._PageIndex = value + End Set + End Property + + Protected _TotalRecords As Integer = -1 + Public Property TotalRecords() As Integer + Get + If _TotalRecords < 0 + _TotalRecords = PersonalNameTable.GetRecordCount(CreateCompoundJoinFilter(), CreateWhereClause()) + End If + Return Me._TotalRecords + End Get + Set(ByVal value As Integer) + If Me.PageSize > 0 Then + + Me.TotalPages = CInt(Math.Ceiling(value / Me.PageSize)) + + End If + Me._TotalRecords = value + End Set + End Property + + + + Protected _TotalPages As Integer = -1 + Public Property TotalPages() As Integer + Get + If _TotalPages < 0 Then + + Me.TotalPages = CInt(Math.Ceiling(TotalRecords / Me.PageSize)) + + End If + Return Me._TotalPages + End Get + Set(ByVal value As Integer) + Me._TotalPages = value + End Set + End Property + + Protected _DisplayLastPage As Boolean + Public Property DisplayLastPage() As Boolean + Get + Return Me._DisplayLastPage + End Get + Set(ByVal value As Boolean) + Me._DisplayLastPage = value + End Set + End Property + + Private _DataChanged As Boolean = False + Public Property DataChanged() As Boolean + Get + Return Me._DataChanged + End Get + Set(ByVal value As Boolean) + Me._DataChanged = value + End Set + End Property + + Private _ResetData As Boolean = False + Public Property ResetData() As Boolean + Get + Return Me._ResetData + End Get + Set(ByVal value As Boolean) + Me._ResetData = value + End Set + End Property + + Private _AddNewRecord As Integer = 0 + Public Property AddNewRecord() As Integer + Get + Return Me._AddNewRecord + End Get + Set(ByVal value As Integer) + Me._AddNewRecord = value + End Set + End Property + + + Private _CurrentSortOrder As OrderBy = Nothing + Public Property CurrentSortOrder() As OrderBy + Get + Return Me._CurrentSortOrder + End Get + Set(ByVal value As BaseClasses.Data.OrderBy) + Me._CurrentSortOrder = value + End Set + End Property + + Private _DataSource() As PersonalNameRecord = Nothing + Public Property DataSource() As PersonalNameRecord () + Get + Return Me._DataSource + End Get + Set(ByVal value() As PersonalNameRecord) + Me._DataSource = value + End Set + End Property + +#Region "Helper Properties" + + Public ReadOnly Property NameDateLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "NameDateLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property PersonalLastNameLabel2() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalLastNameLabel2"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property PersonalNameAddButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalNameAddButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalNameDeleteButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalNameDeleteButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalNameEditButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalNameEditButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalNameLabel2() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalNameLabel2"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property PersonalNamePagination() As Persons.UI.IPagination + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalNamePagination"), Persons.UI.IPagination) + End Get + End Property + + Public ReadOnly Property PersonalNameResetButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalNameResetButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalNameTableControlCollapsibleRegion() As System.Web.UI.WebControls.Panel + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalNameTableControlCollapsibleRegion"), System.Web.UI.WebControls.Panel) + End Get + End Property + + Public ReadOnly Property PersonalNameToggleAll() As System.Web.UI.WebControls.CheckBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalNameToggleAll"), System.Web.UI.WebControls.CheckBox) + End Get + End Property + + Public ReadOnly Property RefLabel1() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RefLabel1"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + +#End Region + +#Region "Helper Functions" + + Public Overrides Overloads Function ModifyRedirectUrl(url As String, arg As String, ByVal bEncrypt As Boolean) As String + Return Me.Page.EvaluateExpressions(url, arg, bEncrypt, Me) + End Function + + Public Overrides Overloads Function EvaluateExpressions(url As String, arg As String, ByVal bEncrypt As Boolean) As String + Dim needToProcess As Boolean = AreAnyUrlParametersForMe(url, arg) + If (needToProcess) Then + Dim recCtl As PersonalNameTableControlRow = Me.GetSelectedRecordControl() + If recCtl Is Nothing AndAlso url.IndexOf("{") >= 0 Then + ' Localization. + Throw New Exception(Page.GetResourceValue("Err:NoRecSelected", "Persons")) + End If + Dim rec As PersonalNameRecord = Nothing + If recCtl IsNot Nothing Then + rec = recCtl.GetRecord() + End If + Return EvaluateExpressions(url, arg, rec, bEncrypt) + End If + Return url + End Function + + Public Overridable Function GetSelectedRecordIndex() As Integer + Dim counter As Integer = 0 + Dim recControl As PersonalNameTableControlRow + For Each recControl In Me.GetRecordControls() + If recControl.PersonalNameRecordRowSelection.Checked Then + Return counter + End If + counter += 1 + Next + Return -1 + End Function + + Public Overridable Function GetSelectedRecordControl() As PersonalNameTableControlRow + Dim selectedList() As PersonalNameTableControlRow = Me.GetSelectedRecordControls() + If selectedList.Length = 0 Then + Return Nothing + End If + Return selectedList(0) + + End Function + + Public Overridable Function GetSelectedRecordControls() As PersonalNameTableControlRow() + + Dim selectedList As ArrayList = New ArrayList(25) + Dim recControl As PersonalNameTableControlRow + For Each recControl In Me.GetRecordControls() + If recControl.PersonalNameRecordRowSelection IsNot Nothing AndAlso recControl.PersonalNameRecordRowSelection.Checked Then + selectedList.Add(recControl) + End If + Next + Return DirectCast(selectedList.ToArray(GetType(PersonalNameTableControlRow)), PersonalNameTableControlRow()) + + End Function + + Public Overridable Sub DeleteSelectedRecords(ByVal deferDeletion As Boolean) + Dim recList() As PersonalNameTableControlRow = Me.GetSelectedRecordControls() + If recList.Length = 0 Then + ' Localization. + Throw New Exception(Page.GetResourceValue("Err:NoRecSelected", "Persons")) + End If + + Dim recCtl As PersonalNameTableControlRow + For Each recCtl In recList + If deferDeletion Then + If Not recCtl.IsNewRecord Then + + Me.AddToDeletedRecordIds(recCtl) + + End If + recCtl.Visible = False + + recCtl.PersonalNameRecordRowSelection.Checked = False + + Else + + recCtl.Delete() + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + End If + Next + End Sub + + Public Function GetRecordControls() As PersonalNameTableControlRow() + Dim recList As ArrayList = New ArrayList() + Dim rep As System.Web.UI.WebControls.Repeater = CType(Me.FindControl("PersonalNameTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return Nothing + Dim repItem As System.Web.UI.WebControls.RepeaterItem + + For Each repItem In rep.Items + + Dim recControl As PersonalNameTableControlRow = DirectCast(repItem.FindControl("PersonalNameTableControlRow"), PersonalNameTableControlRow) + recList.Add(recControl) + + Next + + Return DirectCast(recList.ToArray(GetType(PersonalNameTableControlRow)), PersonalNameTableControlRow()) + End Function + + Public Shadows ReadOnly Property Page() As BaseApplicationPage + Get + Return DirectCast(MyBase.Page, BaseApplicationPage) + End Get + End Property + +#End Region + + + +End Class + + +' Base class for the PersonalRankTableControlRow control on the EditPersonalId page. +' Do not modify this class. Instead override any method in PersonalRankTableControlRow. +Public Class BasePersonalRankTableControlRow + Inherits Persons.UI.BaseApplicationRecordControl + + ' To customize, override this method in PersonalRankTableControlRow. + Protected Overridable Sub Control_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Init + + Me.ClearControlsFromSession() + End Sub + + ' To customize, override this method in PersonalRankTableControlRow. + Protected Overridable Sub Control_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load + + 'Call LoadFocusScripts from repeater so that onfocus attribute could be added to elements + Me.Page.LoadFocusScripts(Me) + + ' Show confirmation message on Click + Me.PersonalRankRowDeleteButton.Attributes.Add("onClick", "return (confirm('" & (CType(Me.Page,BaseApplicationPage)).GetResourceValue("DeleteRecordConfirm", "Persons") & "'));") + + + ' Register the event handlers. + + AddHandler Me.PersonalRankRowDeleteButton.Click, AddressOf PersonalRankRowDeleteButton_Click + + AddHandler Me.PersonalRankRowEditButton.Click, AddressOf PersonalRankRowEditButton_Click + + AddHandler Me.PersonalRankRowViewButton.Click, AddressOf PersonalRankRowViewButton_Click + + AddHandler Me.RankId1.SelectedIndexChanged, AddressOf RankId1_SelectedIndexChanged + + AddHandler Me.PreRank.CheckedChanged, AddressOf PreRank_CheckedChanged + + AddHandler Me.GazetteDate1.TextChanged, AddressOf GazetteDate1_TextChanged + + AddHandler Me.GazetteNO1.TextChanged, AddressOf GazetteNO1_TextChanged + + AddHandler Me.GazettePage1.TextChanged, AddressOf GazettePage1_TextChanged + + AddHandler Me.GazetteSection1.TextChanged, AddressOf GazetteSection1_TextChanged + + AddHandler Me.RankDate.TextChanged, AddressOf RankDate_TextChanged + + AddHandler Me.Ref3.TextChanged, AddressOf Ref3_TextChanged + + AddHandler Me.RefDate1.TextChanged, AddressOf RefDate1_TextChanged + + + End Sub + + + Public Overridable Sub LoadData() + + ' Load the data from the database into the DataSource PersonalRank 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 = PersonalRankTable.GetRecord(Me.RecordUniqueId, True) + + Return + End If + + ' Since this is a row in the table, the data for this row is loaded by the + ' LoadData method of the BasePersonalRankTableControl when the data for the entire + ' table is loaded. + + Me.DataSource = New PersonalRankRecord() + + + + End Sub + + ' Populate the UI controls using the DataSource. To customize, override this method in PersonalRankTableControlRow. + 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 + + SetGazetteDate1() + SetGazetteNO1() + SetGazettePage1() + SetGazetteSection1() + + + + + SetPreRank() + SetRankDate() + SetRankId1() + SetRef3() + SetRefDate1() + + + 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 SetGazetteDate1() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.GazetteDate1.ID) Then + + Me.GazetteDate1.Text = Me.PreviousUIData(Me.GazetteDate1.ID).ToString() + + Return + End If + + + ' Set the GazetteDate TextBox on the webpage with value from the + ' PersonalRank database record. + + ' Me.DataSource is the PersonalRank record retrieved from the database. + ' Me.GazetteDate1 is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetGazetteDate1() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.GazetteDateSpecified Then + + ' If the GazetteDate is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalRankTable.GazetteDate, "d MMM yyyy") + + Me.GazetteDate1.Text = formattedValue + + Else + + ' GazetteDate is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.GazetteDate1.Text = PersonalRankTable.GazetteDate.Format(PersonalRankTable.GazetteDate.DefaultValue, "d MMM yyyy") + + End If + + End Sub + + Public Overridable Sub SetGazetteNO1() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.GazetteNO1.ID) Then + + Me.GazetteNO1.Text = Me.PreviousUIData(Me.GazetteNO1.ID).ToString() + + Return + End If + + + ' Set the GazetteNO TextBox on the webpage with value from the + ' PersonalRank database record. + + ' Me.DataSource is the PersonalRank record retrieved from the database. + ' Me.GazetteNO1 is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetGazetteNO1() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.GazetteNOSpecified Then + + ' If the GazetteNO is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalRankTable.GazetteNO) + + Me.GazetteNO1.Text = formattedValue + + Else + + ' GazetteNO is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.GazetteNO1.Text = PersonalRankTable.GazetteNO.Format(PersonalRankTable.GazetteNO.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetGazettePage1() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.GazettePage1.ID) Then + + Me.GazettePage1.Text = Me.PreviousUIData(Me.GazettePage1.ID).ToString() + + Return + End If + + + ' Set the GazettePage TextBox on the webpage with value from the + ' PersonalRank database record. + + ' Me.DataSource is the PersonalRank record retrieved from the database. + ' Me.GazettePage1 is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetGazettePage1() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.GazettePageSpecified Then + + ' If the GazettePage is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalRankTable.GazettePage) + + Me.GazettePage1.Text = formattedValue + + Else + + ' GazettePage is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.GazettePage1.Text = PersonalRankTable.GazettePage.Format(PersonalRankTable.GazettePage.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetGazetteSection1() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.GazetteSection1.ID) Then + + Me.GazetteSection1.Text = Me.PreviousUIData(Me.GazetteSection1.ID).ToString() + + Return + End If + + + ' Set the GazetteSection TextBox on the webpage with value from the + ' PersonalRank database record. + + ' Me.DataSource is the PersonalRank record retrieved from the database. + ' Me.GazetteSection1 is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetGazetteSection1() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.GazetteSectionSpecified Then + + ' If the GazetteSection is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalRankTable.GazetteSection) + + Me.GazetteSection1.Text = formattedValue + + Else + + ' GazetteSection is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.GazetteSection1.Text = PersonalRankTable.GazetteSection.Format(PersonalRankTable.GazetteSection.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetPreRank() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.PreRank.ID) Then + Me.PreRank.Checked = Convert.ToBoolean(Me.PreviousUIData(Me.PreRank.ID)) + Return + End If + + + ' Set the PreRank CheckBox on the webpage with value from the + ' PersonalRank database record. + + ' Me.DataSource is the PersonalRank record retrieved from the database. + ' Me.PreRank is the ASP:CheckBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetPreRank() + ' and add your own code before or after the call to the MyBase function. + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.PreRankSpecified Then + + ' If the PreRank is non-NULL, then format the value. + ' The Format method will use the Display Format + If Me.DataSource.PreRank.ToString() = "1" Then + + Me.PreRank.Checked = True + Else + Me.PreRank.Checked = False + End If + + Else + + ' PreRank is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + If Not Me.DataSource.IsCreated Then + Me.PreRank.Checked = PersonalRankTable.PreRank.ParseValue(PersonalRankTable.PreRank.DefaultValue).ToBoolean() + End If + + End If + + End Sub + + Public Overridable Sub SetRankDate() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.RankDate.ID) Then + + Me.RankDate.Text = Me.PreviousUIData(Me.RankDate.ID).ToString() + + Return + End If + + + ' Set the RankDate TextBox on the webpage with value from the + ' PersonalRank database record. + + ' Me.DataSource is the PersonalRank record retrieved from the database. + ' Me.RankDate is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetRankDate() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.RankDateSpecified Then + + ' If the RankDate is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalRankTable.RankDate, "d MMM yyyy") + + Me.RankDate.Text = formattedValue + + Else + + ' RankDate is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.RankDate.Text = PersonalRankTable.RankDate.Format(PersonalRankTable.RankDate.DefaultValue, "d MMM yyyy") + + End If + + End Sub + + Public Overridable Sub SetRankId1() + + ' If selection was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.RankId1.ID) Then + If Me.PreviousUIData(Me.RankId1.ID) Is Nothing + Me.PopulateRankId1DropDownList(Nothing, 100) + Else + Me.PopulateRankId1DropDownList(Me.PreviousUIData(Me.RankId1.ID).ToString(), 100) + End If + Return + End If + + + ' Set the RankId DropDownList on the webpage with value from the + ' PersonalRank database record. + + ' Me.DataSource is the PersonalRank record retrieved from the database. + ' Me.RankId1 is the ASP:DropDownList on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetRankId1() + ' and add your own code before or after the call to the MyBase function. + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.RankIdSpecified Then + + ' If the RankId is non-NULL, then format the value. + ' The Format method will return the Display Foreign Key As (DFKA) value + Me.PopulateRankId1DropDownList(Me.DataSource.RankId.ToString(), 100) + + Else + + ' RankId 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.PopulateRankId1DropDownList(Nothing, 100) + Else + Me.PopulateRankId1DropDownList(PersonalRankTable.RankId.DefaultValue, 100) + End If + + End If + + End Sub + + Public Overridable Sub SetRef3() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.Ref3.ID) Then + + Me.Ref3.Text = Me.PreviousUIData(Me.Ref3.ID).ToString() + + Return + End If + + + ' Set the Ref TextBox on the webpage with value from the + ' PersonalRank database record. + + ' Me.DataSource is the PersonalRank record retrieved from the database. + ' Me.Ref3 is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetRef3() + ' 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(PersonalRankTable.Ref0) + + Me.Ref3.Text = formattedValue + + Else + + ' Ref is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.Ref3.Text = PersonalRankTable.Ref0.Format(PersonalRankTable.Ref0.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetRefDate1() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.RefDate1.ID) Then + + Me.RefDate1.Text = Me.PreviousUIData(Me.RefDate1.ID).ToString() + + Return + End If + + + ' Set the RefDate TextBox on the webpage with value from the + ' PersonalRank database record. + + ' Me.DataSource is the PersonalRank record retrieved from the database. + ' Me.RefDate1 is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetRefDate1() + ' 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(PersonalRankTable.RefDate, "d MMM yyyy") + + Me.RefDate1.Text = formattedValue + + Else + + ' RefDate is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.RefDate1.Text = PersonalRankTable.RefDate.Format(PersonalRankTable.RefDate.DefaultValue, "d MMM yyyy") + + End If + + End Sub + + + Public EvaluateFormulaDelegate As BaseClasses.Data.DataSource.EvaluateFormulaDelegate = New BaseClasses.Data.DataSource.EvaluateFormulaDelegate(AddressOf Me.EvaluateFormula) + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean, ByVal e As FormulaEvaluator) As String + If e Is Nothing Then + e = New FormulaEvaluator() + End If + + e.Variables.Clear() + + + ' add variables for formula evaluation + If variables IsNot Nothing Then + Dim enumerator As System.Collections.Generic.IEnumerator(Of System.Collections.Generic.KeyValuePair(Of String, Object)) = variables.GetEnumerator() + While enumerator.MoveNext() + e.Variables.Add(enumerator.Current.Key, enumerator.Current.Value) + End While + End If + + If includeDS + + End IF + + + ' Other variables referred to in the formula are expected to be + ' properties of the DataSource. For example, referring to + ' UnitPrice as a variable will refer to DataSource.UnitPrice + If dataSourceForEvaluate Is Nothing Then + + e.DataSource = Me.DataSource + + Else + e.DataSource = dataSourceForEvaluate + End If + + ' Define the calling control. This is used to add other + ' related table and record controls as variables. + e.CallingControl = Me + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + + If Not String.IsNullOrEmpty(format) AndAlso (String.IsNullOrEmpty(formula) OrElse formula.IndexOf("Format(") < 0) Then + Return FormulaUtils.Format(resultObj, format) + Else + Return resultObj.ToString() + End If + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format,variables ,includeDS, Nothing) + End Function + + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object)) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format, variables ,True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, format, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal e as FormulaEvaluator) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, variables, True, e) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal includeDS as Boolean) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, includeDS, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, True, Nothing) + End Function + + + Public Overridable Sub RegisterPostback() + + + End Sub + + + + ' To customize, override this method in PersonalRankTableControlRow. + 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 parentCtrl As PersonalIdRecordControl + + + parentCtrl = DirectCast(Me.Page.FindControlRecursively("PersonalIdRecordControl"), PersonalIdRecordControl) + + If (Not IsNothing(parentCtrl) AndAlso IsNothing(parentCtrl.DataSource)) + ' Load the record if it is not loaded yet. + parentCtrl.LoadData() + End If + If (IsNothing(parentCtrl) OrElse IsNothing(parentCtrl.DataSource)) + ' Get the error message from the application resource file. + Throw New Exception(Page.GetResourceValue("Err:NoParentRecId", "Persons")) + End If + + Me.DataSource.PersonalId = parentCtrl.DataSource.PersonalId + + ' 2. Perform any custom validation. + Me.Validate() + + + ' 3. Set the values in the record with data from UI controls. + ' This calls the Get() method for each of the user interface controls. + Me.GetUIData() + + ' 4. Save in the database. + ' We should not save the record if the data did not change. This + ' will save a database hit and avoid triggering any database triggers. + + If Me.DataSource.IsAnyValueChanged Then + ' Save record to database but do not commit yet. + ' Auto generated ids are available after saving for use by child (dependent) records. + Me.DataSource.Save() + + DirectCast(GetParentControlObject(Me, "PersonalRankTableControl"), PersonalRankTableControl).DataChanged = True + DirectCast(GetParentControlObject(Me, "PersonalRankTableControl"), PersonalRankTableControl).ResetData = True + End If + + + ' update session or cookie by formula + + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + ' For Master-Detail relationships, save data on the Detail table(s) + + End Sub + + ' To customize, override this method in PersonalRankTableControlRow. + 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. + + GetGazetteDate1() + GetGazetteNO1() + GetGazettePage1() + GetGazetteSection1() + GetPreRank() + GetRankDate() + GetRankId1() + GetRef3() + GetRefDate1() + End Sub + + + Public Overridable Sub GetGazetteDate1() + + ' Retrieve the value entered by the user on the GazetteDate ASP:TextBox, and + ' save it into the GazetteDate field in DataSource PersonalRank 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.GazetteDate1.Text, PersonalRankTable.GazetteDate) + + + End Sub + + Public Overridable Sub GetGazetteNO1() + + ' Retrieve the value entered by the user on the GazetteNO ASP:TextBox, and + ' save it into the GazetteNO field in DataSource PersonalRank record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.GazetteNO1.Text, PersonalRankTable.GazetteNO) + + + End Sub + + Public Overridable Sub GetGazettePage1() + + ' Retrieve the value entered by the user on the GazettePage ASP:TextBox, and + ' save it into the GazettePage field in DataSource PersonalRank record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.GazettePage1.Text, PersonalRankTable.GazettePage) + + + End Sub + + Public Overridable Sub GetGazetteSection1() + + ' Retrieve the value entered by the user on the GazetteSection ASP:TextBox, and + ' save it into the GazetteSection field in DataSource PersonalRank record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.GazetteSection1.Text, PersonalRankTable.GazetteSection) + + + End Sub + + Public Overridable Sub GetPreRank() + + + ' Retrieve the value entered by the user on the PreRank ASP:CheckBox, and + ' save it into the PreRank field in DataSource PersonalRank record. + ' Custom validation should be performed in Validate, not here. + + + If Me.PreRank.Checked Then + Me.DataSource.Parse("1", PersonalRankTable.PreRank) + Else + Me.DataSource.Parse("0", PersonalRankTable.PreRank) + End If + + End Sub + + Public Overridable Sub GetRankDate() + + ' Retrieve the value entered by the user on the RankDate ASP:TextBox, and + ' save it into the RankDate field in DataSource PersonalRank 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.RankDate.Text, PersonalRankTable.RankDate) + + + End Sub + + Public Overridable Sub GetRankId1() + + ' Retrieve the value entered by the user on the RankId ASP:DropDownList, and + ' save it into the RankId field in DataSource PersonalRank record. + + ' Custom validation should be performed in Validate, not here. + + Me.DataSource.Parse(GetValueSelectedPageRequest(Me.RankId1), PersonalRankTable.RankId) + + End Sub + + Public Overridable Sub GetRef3() + + ' Retrieve the value entered by the user on the Ref ASP:TextBox, and + ' save it into the Ref field in DataSource PersonalRank record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.Ref3.Text, PersonalRankTable.Ref0) + + + End Sub + + Public Overridable Sub GetRefDate1() + + ' Retrieve the value entered by the user on the RefDate ASP:TextBox, and + ' save it into the RefDate field in DataSource PersonalRank 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.RefDate1.Text, PersonalRankTable.RefDate) + + + End Sub + + + ' To customize, override this method in PersonalRankTableControlRow. + + Public Overridable Function CreateWhereClause() As WhereClause + + Return Nothing + + End Function + + + + ' To customize, override this method in PersonalRankTableControlRow. + 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) + PersonalRankTable.DeleteRecord(pkValue) + + DirectCast(GetParentControlObject(Me, "PersonalRankTableControl"), PersonalRankTableControl).DataChanged = True + DirectCast(GetParentControlObject(Me, "PersonalRankTableControl"), PersonalRankTableControl).ResetData = True + End Sub + + Protected Overridable Sub Control_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.PreRender + ' PreRender event is raised just before page is being displayed. + Try + DbUtils.StartTransaction() + Me.RegisterPostback() + + If Not Me.Page.ErrorOnPage AndAlso (Me.Page.IsPageRefresh OrElse Me.DataChanged OrElse Me.ResetData) Then + + + ' Re-load the data and update the web page if necessary. + ' This is typically done during a postback (filter, search button, sort, pagination button). + ' In each of the other click handlers, simply set DataChanged to True to reload the data. + Me.LoadData() + Me.DataBind() + End If + + + Catch ex As Exception + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + Finally + DbUtils.EndTransaction() + End Try + End Sub + + + Protected Overrides Sub SaveControlsToSession() + MyBase.SaveControlsToSession() + + + 'Save pagination state to session. + + End Sub + + + + Protected Overrides Sub ClearControlsFromSession() + MyBase.ClearControlsFromSession() + + + + ' Clear pagination state from session. + + End Sub + + Protected Overrides Sub LoadViewState(ByVal savedState As Object) + MyBase.LoadViewState(savedState) + Dim isNewRecord As String = CType(ViewState("IsNewRecord"), String) + If Not isNewRecord Is Nothing AndAlso isNewRecord.Trim <> "" Then + Me.IsNewRecord = Boolean.Parse(isNewRecord) + End If + + Dim myCheckSum As String = CType(ViewState("CheckSum"), String) + If Not myCheckSum Is Nothing AndAlso myCheckSum.Trim <> "" Then + Me.CheckSum = myCheckSum + End If + + + ' Load view state for pagination control. + + End Sub + + Protected Overrides Function SaveViewState() As Object + ViewState("IsNewRecord") = Me.IsNewRecord.ToString() + ViewState("CheckSum") = Me.CheckSum + + + ' Load view state for pagination control. + + Return MyBase.SaveViewState() + End Function + + + + Public Overridable Function CreateWhereClause_RankId1DropDownList() 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 Rank table. + ' Examples: + ' wc.iAND(RankTable.ShortRank, BaseFilter.ComparisonOperator.EqualsTo, "XYZ") + ' wc.iAND(RankTable.Active, BaseFilter.ComparisonOperator.EqualsTo, "1") + + Dim wc As WhereClause = New WhereClause() + Return wc + + End Function + + + ' Fill the RankId1 list. + Protected Overridable Sub PopulateRankId1DropDownList( _ + ByVal selectedValue As String, _ + ByVal maxItems As Integer) + + Me.RankId1.Items.Clear() + + + ' 1. Setup the static list items + + ' Add the Please Select item. + Me.RankId1.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_RankId1DropDownList function. + ' It is better to customize the where clause there. + + Dim wc As WhereClause = CreateWhereClause_RankId1DropDownList() + ' Create the ORDER BY clause to sort based on the displayed value. + + + Dim orderBy As OrderBy = New OrderBy(false, false) + orderBy.Add(RankTable.ShortRank, 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 RankRecord = 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 = RankTable.GetRecords(wc, orderBy, pageNum, maxItems) + For each itemValue As RankRecord In itemValues + ' Create the item and add to the list. + Dim cvalue As String = Nothing + Dim fvalue As String = Nothing + If itemValue.RankIdSpecified Then + cvalue = itemValue.RankId.ToString() + + If counter < maxItems AndAlso Me.RankId1.Items.FindByValue(cvalue) Is Nothing Then + + Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalRankTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalRankTable.RankId) + If _isExpandableNonCompositeForeignKey AndAlso PersonalRankTable.RankId.IsApplyDisplayAs Then + fvalue = PersonalRankTable.GetDFKA(itemValue, PersonalRankTable.RankId) + End If + If (Not _isExpandableNonCompositeForeignKey) Or (String.IsNullOrEmpty(fvalue)) Then + fvalue = itemValue.Format(RankTable.ShortRank) + 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.RankId1.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.RankId1.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.RankId1, selectedValue) AndAlso _ + Not SetSelectedDisplayText(Me.RankId1, selectedValue)Then + + ' construct a whereclause to query a record with Rank.RankId = selectedValue + Dim filter2 As CompoundFilter = New CompoundFilter(CompoundFilter.CompoundingOperators.And_Operator, Nothing) + Dim whereClause2 As WhereClause = New WhereClause() + filter2.AddFilter(New BaseClasses.Data.ColumnValueFilter(RankTable.RankId, selectedValue, BaseClasses.Data.BaseFilter.ComparisonOperator.EqualsTo, False)) + whereClause2.AddFilter(filter2, CompoundFilter.CompoundingOperators.And_Operator) + + Try + ' Execute the query + Dim rc() As RankRecord = RankTable.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 RankRecord = DirectCast(rc(0), RankRecord) + ' Create the item and add to the list. + Dim cvalue As String = Nothing + Dim fvalue As String = Nothing + If itemValue.RankIdSpecified Then + cvalue = itemValue.RankId.ToString() + Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalRankTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalRankTable.RankId) + If _isExpandableNonCompositeForeignKey AndAlso PersonalRankTable.RankId.IsApplyDisplayAs Then + fvalue = PersonalRankTable.GetDFKA(itemValue, PersonalRankTable.RankId) + End If + If (Not _isExpandableNonCompositeForeignKey) Or (String.IsNullOrEmpty(fvalue)) Then + fvalue = itemValue.Format(RankTable.ShortRank) + End If + + If fvalue Is Nothing OrElse fvalue.Trim() = "" Then fvalue = cvalue + Dim newItem As New ListItem(fvalue, cvalue) + Me.RankId1.Items.Add(newItem) + SetSelectedValue(Me.RankId1, selectedValue) + End If + End If + Catch + End Try + + End If + + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalRankRowDeleteButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + If(Not Me.Page.IsPageRefresh) Then + + Dim tc As PersonalRankTableControl = DirectCast(GetParentControlObject(Me, "PersonalRankTableControl"), PersonalRankTableControl) + If Not (IsNothing(tc)) Then + If Not Me.IsNewRecord Then + tc.AddToDeletedRecordIds(DirectCast(Me, PersonalRankTableControlRow)) + End If + Me.Visible = False + tc.SetFormulaControls() + End If + + End If + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalRankRowEditButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + ' The redirect URL is set on the Properties, Custom Properties or Actions. + ' The ModifyRedirectURL call resolves the parameters before the + ' Response.Redirect redirects the page to the URL. + ' Any code after the Response.Redirect call will not be executed, since the page is + ' redirected to the URL. + + + Dim url As String = "../Shared/ConfigureEditRecord.aspx" + + Dim shouldRedirect As Boolean = True + Dim TargetKey As String = Nothing + Dim DFKA As String = TargetKey + Dim id As String = DFKA + Dim value As String = id + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + url = Me.ModifyRedirectUrl(url, "",False) + url = Me.Page.ModifyRedirectUrl(url, "",False) + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + shouldRedirect = False + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + If shouldRedirect Then + Me.Page.ShouldSaveControlsToSession = True + Me.Page.Response.Redirect(url) + ElseIf Not TargetKey Is Nothing AndAlso _ + Not shouldRedirect Then + Me.Page.ShouldSaveControlsToSession = True + Me.Page.CloseWindow(True) + + End If + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalRankRowViewButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + ' The redirect URL is set on the Properties, Custom Properties or Actions. + ' The ModifyRedirectURL call resolves the parameters before the + ' Response.Redirect redirects the page to the URL. + ' Any code after the Response.Redirect call will not be executed, since the page is + ' redirected to the URL. + + + Dim url As String = "../Shared/ConfigureViewRecord.aspx" + + Dim shouldRedirect As Boolean = True + Dim TargetKey As String = Nothing + Dim DFKA As String = TargetKey + Dim id As String = DFKA + Dim value As String = id + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + url = Me.ModifyRedirectUrl(url, "",False) + url = Me.Page.ModifyRedirectUrl(url, "",False) + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + shouldRedirect = False + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + If shouldRedirect Then + Me.Page.ShouldSaveControlsToSession = True + Me.Page.Response.Redirect(url) + ElseIf Not TargetKey Is Nothing AndAlso _ + Not shouldRedirect Then + Me.Page.ShouldSaveControlsToSession = True + Me.Page.CloseWindow(True) + + End If + End Sub + + Protected Overridable Sub RankId1_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()(RankId1.ClientID & "_SelectedValue"), String) + Dim displayText As String = CType(Me.Page.Session()(RankId1.ClientID & "_SelectedDisplayText"), String) + If displayText <> "" AndAlso val <> "" Then + Me.RankId1.Items.Add(New ListItem(displayText, val)) + Me.RankId1.SelectedIndex = Me.RankId1.Items.Count - 1 + Me.Page.Session.Remove(RankId1.ClientID & "_SelectedValue") + Me.Page.Session.Remove(RankId1.ClientID & "_SelectedDisplayText") + End If + + + + + End Sub + + Protected Overridable Sub PreRank_CheckedChanged(ByVal sender As Object, ByVal args As EventArgs) + + + End Sub + + Protected Overridable Sub GazetteDate1_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub GazetteNO1_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub GazettePage1_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub GazetteSection1_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub RankDate_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub Ref3_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub RefDate1_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("BasePersonalRankTableControlRow_Rec"), String) + End Get + Set(ByVal value As String) + Me.ViewState("BasePersonalRankTableControlRow_Rec") = value + End Set + End Property + + Private _DataSource As PersonalRankRecord + Public Property DataSource() As PersonalRankRecord + Get + Return Me._DataSource + End Get + + Set(ByVal value As PersonalRankRecord) + + Me._DataSource = value + End Set + End Property + + + + Private _checkSum As String + Public Overridable Property CheckSum() As String + Get + Return Me._checkSum + End Get + Set(ByVal value As String) + Me._checkSum = value + End Set + End Property + + Private _TotalPages As Integer + Public Property TotalPages() As Integer + Get + Return Me._TotalPages + End Get + Set(ByVal value As Integer) + Me._TotalPages = value + End Set + End Property + + Private _PageIndex As Integer + Public Property PageIndex() As Integer + Get + ' Return the PageIndex + Return Me._PageIndex + End Get + Set(ByVal value As Integer) + Me._PageIndex = value + End Set + End Property + + Private _DisplayLastPage As Boolean + Public Property DisplayLastPage() As Boolean + Get + Return Me._DisplayLastPage + End Get + Set(ByVal value As Boolean) + Me._DisplayLastPage = value + End Set + End Property + + + +#Region "Helper Properties" + + Public ReadOnly Property GazetteDate1() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "GazetteDate1"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property GazetteNO1() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "GazetteNO1"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property GazettePage1() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "GazettePage1"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property GazetteSection1() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "GazetteSection1"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property PersonalRankRecordRowSelection() As System.Web.UI.WebControls.CheckBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalRankRecordRowSelection"), System.Web.UI.WebControls.CheckBox) + End Get + End Property + + Public ReadOnly Property PersonalRankRowDeleteButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalRankRowDeleteButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalRankRowEditButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalRankRowEditButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalRankRowViewButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalRankRowViewButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PreRank() As System.Web.UI.WebControls.CheckBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PreRank"), System.Web.UI.WebControls.CheckBox) + End Get + End Property + + Public ReadOnly Property RankDate() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RankDate"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property RankId1() As System.Web.UI.WebControls.DropDownList + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RankId1"), System.Web.UI.WebControls.DropDownList) + End Get + End Property + + Public ReadOnly Property Ref3() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Ref3"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property RefDate1() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RefDate1"), System.Web.UI.WebControls.TextBox) + 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 PersonalRankRecord = 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 PersonalRankRecord + If Not Me.DataSource Is Nothing Then + Return Me.DataSource + End If + + If Not Me.RecordUniqueId Is Nothing Then + + Return PersonalRankTable.GetRecord(Me.RecordUniqueId, True) + + End If + + ' Localization. + + Return Nothing + + End Function + + Public Shadows ReadOnly Property Page() As BaseApplicationPage + Get + Return DirectCast(MyBase.Page, BaseApplicationPage) + End Get + End Property + +#End Region + +End Class + + + +' Base class for the PersonalRankTableControl control on the EditPersonalId page. +' Do not modify this class. Instead override any method in PersonalRankTableControl. +Public Class BasePersonalRankTableControl + Inherits Persons.UI.BaseApplicationTableControl + + + + Protected Overridable Sub Control_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Init + + + + ' Setup the filter and search events. + + + + ' Control Initializations. + ' Initialize the table's current sort order. + + If Me.InSession(Me, "Order_By") Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + End If + + + + ' Setup default pagination settings. + + Me.PageSize = CInt(Me.GetFromSession(Me, "Page_Size", "10")) + Me.PageIndex = CInt(Me.GetFromSession(Me, "Page_Index", "0")) + + + + Me.ClearControlsFromSession() + End Sub + + Protected Overridable Sub Control_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load + + SaveControlsToSession_Ajax() + + ' Show confirmation message on Click + Me.PersonalRankDeleteButton.Attributes.Add("onClick", "return (confirm('" & (CType(Me.Page,BaseApplicationPage)).GetResourceValue("DeleteConfirm", "Persons") & "'));") + + ' Setup the pagination events. + + AddHandler Me.PersonalRankPagination.FirstPage.Click, AddressOf PersonalRankPagination_FirstPage_Click + + AddHandler Me.PersonalRankPagination.LastPage.Click, AddressOf PersonalRankPagination_LastPage_Click + + AddHandler Me.PersonalRankPagination.NextPage.Click, AddressOf PersonalRankPagination_NextPage_Click + + AddHandler Me.PersonalRankPagination.PageSizeButton.Click, AddressOf PersonalRankPagination_PageSizeButton_Click + + AddHandler Me.PersonalRankPagination.PreviousPage.Click, AddressOf PersonalRankPagination_PreviousPage_Click + + + ' Setup the sorting events. + + AddHandler Me.GazetteDateLabel1.Click, AddressOf GazetteDateLabel1_Click + + AddHandler Me.GazetteNOLabel1.Click, AddressOf GazetteNOLabel1_Click + + AddHandler Me.GazettePageLabel1.Click, AddressOf GazettePageLabel1_Click + + AddHandler Me.GazetteSectionLabel1.Click, AddressOf GazetteSectionLabel1_Click + + AddHandler Me.PreRankLabel1.Click, AddressOf PreRankLabel1_Click + + AddHandler Me.RankDateLabel.Click, AddressOf RankDateLabel_Click + + AddHandler Me.RankIdLabel2.Click, AddressOf RankIdLabel2_Click + + AddHandler Me.RefDateLabel1.Click, AddressOf RefDateLabel1_Click + + AddHandler Me.RefLabel2.Click, AddressOf RefLabel2_Click + + ' Setup the button events. + + AddHandler Me.PersonalRankAddButton.Click, AddressOf PersonalRankAddButton_Click + + AddHandler Me.PersonalRankDeleteButton.Click, AddressOf PersonalRankDeleteButton_Click + + AddHandler Me.PersonalRankEditButton.Click, AddressOf PersonalRankEditButton_Click + + AddHandler Me.PersonalRankResetButton.Click, AddressOf PersonalRankResetButton_Click + + + ' Setup events for others + + End Sub + + + Public Overridable Sub LoadData() + + ' Read data from database. Returns an array of records that can be assigned + ' to the DataSource table control property. + Try + Dim joinFilter As CompoundFilter = CreateCompoundJoinFilter() + + ' The WHERE clause will be empty when displaying all records in table. + Dim wc As WhereClause = CreateWhereClause() + If wc IsNot Nothing AndAlso Not wc.RunQuery Then + ' Initialize an empty array of records + Dim alist As New ArrayList(0) + Me.DataSource = DirectCast(alist.ToArray(GetType(PersonalRankRecord)), PersonalRankRecord()) + ' Add records to the list if needed. + Me.AddNewRecords() + Me._TotalRecords = 0 + Me._TotalPages = 0 + Return + End If + + ' Call OrderBy to determine the order - either use the order defined + ' on the Query Wizard, or specified by user (by clicking on column heading) + Dim orderBy As OrderBy = CreateOrderBy() + + ' Get the pagesize from the pagesize control. + Me.GetPageSize() + + If Me.DisplayLastPage Then + Dim totalRecords As Integer = If(Me._TotalRecords < 0, PersonalRankTable.GetRecordCount(CreateCompoundJoinFilter(), CreateWhereClause()), Me._TotalRecords) + + Dim totalPages As Integer = CInt(Math.Ceiling(totalRecords / Me.PageSize)) + + Me.PageIndex = totalPages - 1 + End If + + ' Make sure PageIndex (current page) and PageSize are within bounds. + If Me.PageIndex < 0 Then + Me.PageIndex = 0 + End If + If Me.PageSize < 1 Then + Me.PageSize = 1 + End If + + ' Retrieve the records and set the table DataSource. + ' Only PageSize records are fetched starting at PageIndex (zero based). + If Me.AddNewRecord > 0 Then + ' Make sure to preserve the previously entered data on new rows. + Dim postdata As New ArrayList + For Each rc As PersonalRankTableControlRow In Me.GetRecordControls() + If Not rc.IsNewRecord Then + rc.DataSource = rc.GetRecord() + rc.GetUIData() + postdata.Add(rc.DataSource) + UIData.Add(rc.PreservedUIData()) + End If + Next + Me.DataSource = DirectCast(postdata.ToArray(GetType(PersonalRankRecord)), PersonalRankRecord()) + Else ' Get the records from the database + Me.DataSource = PersonalRankTable.GetRecords(joinFilter, wc, orderBy, Me.PageIndex, Me.PageSize) + + End If + + ' if the datasource contains no records contained in database, then load the last page. + If (DbUtils.GetCreatedRecords(Me.DataSource).Length = 0 AndAlso Not Me.DisplayLastPage) Then + Me.DisplayLastPage = True + LoadData() + Else + + ' Add any new rows desired by the user. + Me.AddNewRecords() + + ' Turn off the ToggleAll checkbox + Me.PersonalRankToggleAll.Checked = False + + + ' Initialize the page and grand totals. now + + End If + + Catch ex As Exception + ' Report the error message to the end user + Dim msg As String = ex.Message + If ex.InnerException IsNot Nothing Then + msg = msg & " InnerException: " & ex.InnerException.Message + End If + Throw New Exception(msg, ex.InnerException) + End Try + End Sub + + + + + Public Overrides Sub DataBind() + ' The DataBind method binds the user interface controls to the values + ' from the database record for each row in the table. To do this, it calls the + ' DataBind for each of the rows. + ' DataBind also populates any filters above the table, and sets the pagination + ' control to the correct number of records and the current page number. + + MyBase.DataBind() + + ' Make sure that the DataSource is initialized. + If Me.DataSource Is Nothing Then + Return + End If + + 'LoadData for DataSource for chart and report if they exist + + ' Improve performance by prefetching display as records. + Me.PreFetchForeignKeyValues() + + ' Setup the pagination controls. + BindPaginationControls() + + + + ' Bind the repeater with the list of records to expand the UI. + Dim rep As System.Web.UI.WebControls.Repeater = CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalRankTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return + rep.DataSource = DataSource() + rep.DataBind() + + Dim index As Integer = 0 + For Each repItem As System.Web.UI.WebControls.RepeaterItem In rep.Items + ' Loop through all rows in the table, set its DataSource and call DataBind(). + Dim recControl As PersonalRankTableControlRow = DirectCast(repItem.FindControl("PersonalRankTableControlRow"), PersonalRankTableControlRow) + recControl.DataSource = Me.DataSource(index) + If Me.UIData.Count > index Then + recControl.PreviousUIData = Me.UIData(index) + End If + recControl.DataBind() + recControl.Visible = Not Me.InDeletedRecordIds(recControl) + + index += 1 + Next + + + + + ' Call the Set methods for each controls on the panel + + SetGazetteDateLabel1() + SetGazetteNOLabel1() + SetGazettePageLabel1() + SetGazetteSectionLabel1() + + + + + + SetPersonalRankTableControlCollapsibleRegion() + + SetPreRankLabel1() + SetRankDateLabel() + SetRankIdLabel2() + SetRefDateLabel1() + SetRefLabel2() + ' setting the state of expand or collapse alternative rows + + + ' Load data for each record and table UI control. + ' Ordering is important because child controls get + ' their parent ids from their parent UI controls. + + + ' this method calls the set method for controls with special formula like running total, sum, rank, etc + SetFormulaControls() + End Sub + + Public Overridable Sub SetFormulaControls() + ' this method calls Set methods for the control that has special formula + + + + End Sub + + + Public Sub PreFetchForeignKeyValues() + If (IsNothing(Me.DataSource)) + Return + End If + + Me.Page.PregetDfkaRecords(PersonalRankTable.RankId, Me.DataSource) + + End Sub + + + Public Overridable Sub RegisterPostback() + + + End Sub + + Public EvaluateFormulaDelegate As BaseClasses.Data.DataSource.EvaluateFormulaDelegate = New BaseClasses.Data.DataSource.EvaluateFormulaDelegate(AddressOf Me.EvaluateFormula) + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean, ByVal e as FormulaEvaluator) As String + If e Is Nothing + e = New FormulaEvaluator() + End If + + e.Variables.Clear() + + + ' add variables for formula evaluation + If variables IsNot Nothing Then + Dim enumerator As System.Collections.Generic.IEnumerator(Of System.Collections.Generic.KeyValuePair(Of String, Object)) = variables.GetEnumerator() + While enumerator.MoveNext() + e.Variables.Add(enumerator.Current.Key, enumerator.Current.Value) + End While + End If + + If includeDS + + End If + + ' All variables referred to in the formula are expected to be + ' properties of the DataSource. For example, referring to + ' UnitPrice as a variable will refer to DataSource.UnitPrice + e.DataSource = dataSourceForEvaluate + + ' Define the calling control. This is used to add other + ' related table and record controls as variables. + e.CallingControl = Me + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + + If Not String.IsNullOrEmpty(format) AndAlso (String.IsNullOrEmpty(formula) OrElse formula.IndexOf("Format(") < 0) Then + Return FormulaUtils.Format(resultObj, format) + Else + Return resultObj.ToString() + End If + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format,variables ,includeDS, Nothing) + End Function + + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object)) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format, variables ,True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, format, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal e as FormulaEvaluator) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, variables, True, e) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal includeDS as Boolean) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, includeDS, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, True, Nothing) + End Function + + + + + Public Overridable Sub ResetControl() + + Me.CurrentSortOrder.Reset() + If (Me.InSession(Me, "Order_By")) Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + End If + + Me.PageIndex = 0 + End Sub + + Protected Overridable Sub BindPaginationControls() + ' Setup the pagination controls. + + ' Bind the pagination labels. + + If DbUtils.GetCreatedRecords(Me.DataSource).Length > 0 Then + + Me.PersonalRankPagination.CurrentPage.Text = (Me.PageIndex + 1).ToString() + Else + Me.PersonalRankPagination.CurrentPage.Text = "0" + End If + Me.PersonalRankPagination.PageSize.Text = Me.PageSize.ToString() + Me.PersonalRankPagination.TotalItems.Text = Me.TotalRecords.ToString() + Me.PersonalRankPagination.TotalPages.Text = Me.TotalPages.ToString() + + ' Bind the buttons for PersonalRankTableControl pagination. + + Me.PersonalRankPagination.FirstPage.Enabled = Not (Me.PageIndex = 0) + If Me._TotalPages < 0 Then ' if the total pages is not determined yet, enable last and next buttons + Me.PersonalRankPagination.LastPage.Enabled = True + ElseIf Me._TotalPages = 0 ' if the total pages is determined and it is 0, enable last and next buttons + Me.PersonalRankPagination.LastPage.Enabled = False + Else ' if the total pages is the last page, disable last and next buttons + Me.PersonalRankPagination.LastPage.Enabled = Not (Me.PageIndex = Me.TotalPages - 1) + End If + + If Me._TotalPages < 0 Then ' if the total pages is not determined yet, enable last and next buttons + Me.PersonalRankPagination.NextPage.Enabled = True + ElseIf Me._TotalPages = 0 ' if the total pages is determined and it is 0, enable last and next buttons + Me.PersonalRankPagination.NextPage.Enabled = False + Else ' if the total pages is the last page, disable last and next buttons + Me.PersonalRankPagination.NextPage.Enabled = Not (Me.PageIndex = Me.TotalPages - 1) + End If + + Me.PersonalRankPagination.PreviousPage.Enabled = Not (Me.PageIndex = 0) + + + End Sub + + Public Overridable Sub SaveData() + ' Save the data from the entire table. Calls each row's Save Data + ' to save their data. This function is called by the Click handler of the + ' Save button. The button handler should Start/Commit/End a transaction. + + Dim recCtl As PersonalRankTableControlRow + For Each recCtl In Me.GetRecordControls() + + If Me.InDeletedRecordIds(recCtl) Then + ' Delete any pending deletes. + recCtl.Delete() + Else + If recCtl.Visible Then + recCtl.SaveData() + End If + End If + + Next + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + ' Set IsNewRecord to False for all records - since everything has been saved and is no longer "new" + For Each recCtl In Me.GetRecordControls() + recCtl.IsNewRecord = False + Next + + + ' Set DeletedRecordsIds to Nothing since we have deleted all pending deletes. + Me.DeletedRecordIds = Nothing + + End Sub + + Public Overridable Function CreateCompoundJoinFilter() As CompoundFilter + Dim jFilter As CompoundFilter = New CompoundFilter() + + Return jFilter + + End Function + + + Public Overridable Function CreateOrderBy() As OrderBy + ' The CurrentSortOrder is initialized to the sort order on the + ' Query Wizard. It may be modified by the Click handler for any of + ' the column heading to sort or reverse sort by that column. + ' You can add your own sort order, or modify it on the Query Wizard. + Return Me.CurrentSortOrder + End Function + + Public Overridable Function CreateWhereClause() As WhereClause + 'This CreateWhereClause is used for loading the data. + PersonalRankTable.Instance.InnerFilter = Nothing + Dim wc As WhereClause = New WhereClause() + + ' Compose the WHERE clause consiting of: + ' 1. Static clause defined at design time. + ' 2. User selected search criteria. + ' 3. User selected filter criteria. + + + Dim selectedRecordKeyValue as KeyValue = New KeyValue() + + Dim personalIdRecordControlObj As Persons.UI.Controls.EditPersonalId.PersonalIdRecordControl = DirectCast(MiscUtils.FindControlRecursively(Me.Page, "PersonalIdRecordControl"), Persons.UI.Controls.EditPersonalId.PersonalIdRecordControl) + + If (Not IsNothing(personalIdRecordControlObj) AndAlso Not IsNothing(personalIdRecordControlObj.GetRecord()) AndAlso personalIdRecordControlObj.GetRecord().IsCreated AndAlso Not IsNothing(personalIdRecordControlObj.GetRecord().PersonalId)) + wc.iAND(PersonalRankTable.PersonalId, BaseFilter.ComparisonOperator.EqualsTo, personalIdRecordControlObj.GetRecord().PersonalId.ToString()) + selectedRecordKeyValue.AddElement(PersonalRankTable.PersonalId.InternalName, personalIdRecordControlObj.GetRecord().PersonalId.ToString()) + Else + wc.RunQuery = False + Return wc + End If + + HttpContext.Current.Session("PersonalRankTableControlWhereClause") = selectedRecordKeyValue.ToXmlString() + + Return wc + End Function + + + Public Overridable Function CreateWhereClause(ByVal searchText as String, ByVal fromSearchControl as String, ByVal AutoTypeAheadSearch as String, ByVal AutoTypeAheadWordSeparators as String) As WhereClause + ' This CreateWhereClause is used for loading list of suggestions for Auto Type-Ahead feature. + PersonalRankTable.Instance.InnerFilter = Nothing + Dim wc As WhereClause = New WhereClause() + + ' Compose the WHERE clause consiting of: + ' 1. Static clause defined at design time. + ' 2. User selected search criteria. + ' 3. User selected filter criteria. + + Dim appRelativeVirtualPath As String = CType(HttpContext.Current.Session("AppRelativeVirtualPath"), String) + + Dim selectedRecordInPersonalIdRecordControl as String = DirectCast(HttpContext.Current.Session("PersonalRankTableControlWhereClause"), String) + + If Not selectedRecordInPersonalIdRecordControl Is Nothing AndAlso KeyValue.IsXmlKey(selectedRecordInPersonalIdRecordControl) Then + Dim selectedRecordKeyValue as KeyValue = KeyValue.XmlToKey(selectedRecordInPersonalIdRecordControl) + + If Not IsNothing(selectedRecordKeyValue) AndAlso selectedRecordKeyValue.ContainsColumn(PersonalRankTable.PersonalId) Then + wc.iAND(PersonalRankTable.PersonalId, BaseFilter.ComparisonOperator.EqualsTo, selectedRecordKeyValue.GetColumnValue(PersonalRankTable.PersonalId).ToString()) + End If + + End If + + ' Adds clauses if values are selected in Filter controls which are configured in the page. + + + Return wc + End Function + + + Public Overridable Function FormatSuggestions(ByVal prefixText As String, ByVal resultItem As String, _ + ByVal columnLength As Integer, ByVal AutoTypeAheadDisplayFoundText As String, _ + ByVal autoTypeAheadSearch As String, ByVal AutoTypeAheadWordSeparators As String, _ + ByVal resultList As ArrayList) As Boolean + + 'Formats the resultItem and adds it to the list of suggestions. + Dim index As Integer = resultItem.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture).IndexOf(prefixText.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture)) + Dim itemToAdd As String = "" + Dim isFound As Boolean = False + Dim isAdded As Boolean = False + ' Get the index where prfixt is at the beginning of resultItem. If not found then, index of word which begins with prefixText. + If InvariantLCase(autoTypeAheadSearch).equals("wordsstartingwithsearchstring") And Not index = 0 Then + ' Expression to find word which contains AutoTypeAheadWordSeparators followed by prefixText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex( AutoTypeAheadWordSeparators + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + If regex1.IsMatch(resultItem) Then + index = regex1.Match(resultItem).Index + isFound = True + End If + ' If the prefixText is found immediatly after white space then starting of the word is found so don not search any further + If not resultItem(index).ToString() = " " Then + ' Expression to find beginning of the word which contains AutoTypeAheadWordSeparators followed by prefixText + Dim regex As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\\S*" + AutoTypeAheadWordSeparators + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + If regex.IsMatch(resultItem) Then + index = regex.Match(resultItem).Index + isFound = True + End If + End If + End If + + ' If autoTypeAheadSearch value is wordsstartingwithsearchstring then, extract the substring only if the prefixText is found at the + ' beginning of the resultItem (index = 0) or a word in resultItem is found starts with prefixText. + If index = 0 Or isFound Or InvariantLCase(autoTypeAheadSearch).Equals("anywhereinstring") then + If InvariantLCase(AutoTypeAheadDisplayFoundText).equals("atbeginningofmatchedstring") Then + ' Expression to find beginning of the word which contains prefixText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\\S*" + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + ' Find the beginning of the word which contains prefexText + If (StringUtils.InvariantLCase(autoTypeAheadSearch).Equals("anywhereinstring") AndAlso regex1.IsMatch(resultItem)) Then + index = regex1.Match(resultItem).Index + isFound = True + End If + ' Display string from the index till end of the string if sub string from index till end is less than columnLength value. + If Len(resultItem) - index <= columnLength Then + If index = 0 Then + itemToAdd = resultItem + Else + itemToAdd = "..." & resultItem.Substring(index, Len(resultItem) - index) + End If + Else + If index = 0 Then + itemToAdd = resultItem.Substring(index, (columnLength - 3)) & "..." + Else + 'Truncate the string to show only columnLength - 6 characters as begining and trailing "..." has to be appended. + itemToAdd = "..." & resultItem.Substring(index , columnLength - 6) & "..." + End If + End If + ElseIf InvariantLCase(AutoTypeAheadDisplayFoundText).equals("inmiddleofmatchedstring") Then + Dim subStringBeginIndex As Integer = CType(columnLength/2, Integer) + If Len(resultItem) <= columnLength Then + itemToAdd = resultItem + Else + ' Sanity check at end of the string + If index + Len(prefixText) = columnLength Then + itemToAdd = "..." & resultItem.Substring(index-columnLength,index) + ElseIf Len(resultItem) - index < subStringBeginIndex Then + ' Display string from the end till columnLength value if, index is closer to the end of the string. + itemToAdd = "..." & resultItem.Substring(Len(resultItem)-columnLength,Len(resultItem)) + ElseIf index <= subStringBeginIndex Then + ' Sanity chet at beginning of the string + itemToAdd = resultItem.Substring(0, columnLength) & "..." + Else + ' Display string containing text before the prefixText occures and text after the prefixText + itemToAdd = "..." & resultItem.Substring(index - subStringBeginIndex, columnLength) & "..." + End If + End If + ElseIf InvariantLCase(AutoTypeAheadDisplayFoundText).equals("atendofmatchedstring") Then + ' Expression to find ending of the word which contains prefexText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\s", System.Text.RegularExpressions.RegexOptions.IgnoreCase) + ' Find the ending of the word which contains prefexText + If regex1.IsMatch(resultItem, index + 1) Then + index = regex1.Match(resultItem, index + 1).Index + Else + ' If the word which contains prefexText is the last word in string, regex1.IsMatch returns false. + index = resultItem.Length + End If + If index > Len(resultItem) Then + index = Len(resultItem) + End If + ' If text from beginning of the string till index is less than columnLength value then, display string from the beginning till index. + If index <= columnLength Then + if index = Len(resultItem) Then 'Make decision to append "..." + itemToAdd = resultItem.Substring(0,index) + Else + itemToAdd = resultItem.Substring(0,index) & "..." + End If + Else + If index = Len(resultItem) Then + itemToAdd = "..." & resultItem.Substring(index - (columnLength - 3), (columnLength - 3)) + Else + 'Truncate the string to show only columnLength - 6 characters as begining and trailing "..." has to be appended. + itemToAdd = "..." & resultItem.Substring(index - (columnLength - 6), columnLength - 6) & "..." + End If + End If + End If + + ' Remove newline character from itemToAdd + Dim prefixTextIndex As Integer = itemToAdd.IndexOf(prefixText, StringComparison.CurrentCultureIgnoreCase) + ' If itemToAdd contains any newline after the search text then show text only till newline + Dim regex2 As System.Text.RegularExpressions.Regex = New System.Text.RegularExpressions.Regex("(" & vbCrLf & "|" & vbLf & ")", System.Text.RegularExpressions.RegexOptions.IgnoreCase) + Dim newLineIndexAfterPrefix As Integer = -1 + If regex2.IsMatch(itemToAdd, prefixTextIndex) Then + newLineIndexAfterPrefix = regex2.Match(itemToAdd, prefixTextIndex).Index + End If + If (newLineIndexAfterPrefix > -1) Then + If itemToAdd.EndsWith("...") Then + itemToAdd = (itemToAdd.Substring(0, newLineIndexAfterPrefix) + "...") + Else + itemToAdd = itemToAdd.Substring(0, newLineIndexAfterPrefix) + End If + End If + ' If itemToAdd contains any newline before search text then show text which comes after newline + Dim regex3 As System.Text.RegularExpressions.Regex = New System.Text.RegularExpressions.Regex("(" & vbCrLf & "|" & vbLf & ")", (System.Text.RegularExpressions.RegexOptions.IgnoreCase Or System.Text.RegularExpressions.RegexOptions.RightToLeft)) + Dim newLineIndexBeforePrefix As Integer = -1 + If regex3.IsMatch(itemToAdd, prefixTextIndex) Then + newLineIndexBeforePrefix = regex3.Match(itemToAdd, prefixTextIndex).Index + End If + If (newLineIndexBeforePrefix > -1) Then + If itemToAdd.StartsWith("...") Then + itemToAdd = ("..." + itemToAdd.Substring((newLineIndexBeforePrefix + regex3.Match(itemToAdd, prefixTextIndex).Length))) + Else + itemToAdd = itemToAdd.Substring((newLineIndexBeforePrefix + regex3.Match(itemToAdd, prefixTextIndex).Length)) + End If + End If + + If Not itemToAdd is nothing AndAlso Not resultList.Contains(itemToAdd) Then + + resultList.Add(itemToAdd) + + isAdded = true + End If + End If + Return isAdded + End Function + + + Protected Overridable Sub GetPageSize() + + If Me.PersonalRankPagination.PageSize.Text.Trim <> "" Then + Try + 'Me.PageSize = Integer.Parse(Me.PersonalRankPagination.PageSize.Text) + Catch ex As Exception + End Try + End If + End Sub + + Protected Overridable Sub AddNewRecords() + + Dim newRecordList As ArrayList = New ArrayList() + + Dim newUIDataList As System.Collections.Generic.List(Of Hashtable) = New System.Collections.Generic.List(Of Hashtable)() + + ' Loop though all the record controls and if the record control + ' does not have a unique record id set, then create a record + ' and add to the list. + If Not Me.ResetData Then + Dim rep As System.Web.UI.WebControls.Repeater = CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalRankTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return + + Dim repItem As System.Web.UI.WebControls.RepeaterItem + For Each repItem In rep.Items + ' Loop through all rows in the table, set its DataSource and call DataBind(). + + Dim recControl As PersonalRankTableControlRow = DirectCast(repItem.FindControl("PersonalRankTableControlRow"), PersonalRankTableControlRow) + + If recControl.Visible AndAlso recControl.IsNewRecord() Then + + Dim rec As PersonalRankRecord = New PersonalRankRecord() + + If recControl.GazetteDate1.Text <> "" Then + rec.Parse(recControl.GazetteDate1.Text, PersonalRankTable.GazetteDate) + End If + If recControl.GazetteNO1.Text <> "" Then + rec.Parse(recControl.GazetteNO1.Text, PersonalRankTable.GazetteNO) + End If + If recControl.GazettePage1.Text <> "" Then + rec.Parse(recControl.GazettePage1.Text, PersonalRankTable.GazettePage) + End If + If recControl.GazetteSection1.Text <> "" Then + rec.Parse(recControl.GazetteSection1.Text, PersonalRankTable.GazetteSection) + End If + If recControl.PreRank.Checked Then + rec.Parse("1", PersonalRankTable.PreRank) + Else + rec.Parse("0", PersonalRankTable.PreRank) + End If + + If recControl.RankDate.Text <> "" Then + rec.Parse(recControl.RankDate.Text, PersonalRankTable.RankDate) + End If + If MiscUtils.IsValueSelected(recControl.RankId1) Then + rec.Parse(recControl.RankId1.SelectedItem.Value, PersonalRankTable.RankId) + End If + If recControl.Ref3.Text <> "" Then + rec.Parse(recControl.Ref3.Text, PersonalRankTable.Ref0) + End If + If recControl.RefDate1.Text <> "" Then + rec.Parse(recControl.RefDate1.Text, PersonalRankTable.RefDate) + End If + newUIDataList.Add(recControl.PreservedUIData()) + newRecordList.Add(rec) + End If + Next + End If + + + ' Add any new record to the list. + Dim index As Integer = 0 + For index = 1 To Me.AddNewRecord + + newRecordList.Insert(0, New PersonalRankRecord()) + newUIDataList.Insert(0, New Hashtable()) + + Next + Me.AddNewRecord = 0 + + ' Finally, add any new records to the DataSource. + If newRecordList.Count > 0 Then + + Dim finalList As ArrayList = New ArrayList(Me.DataSource) + finalList.InsertRange(0, newRecordList) + + Me.DataSource = DirectCast(finalList.ToArray(GetType(PersonalRankRecord)), PersonalRankRecord()) + + End If + + ' Add the existing UI data to this hash table + If newUIDataList.Count > 0 Then + Me.UIData.InsertRange(0, newUIDataList) + End If + + End Sub + + + Public Sub AddToDeletedRecordIds(ByVal rec As PersonalRankTableControlRow) + If rec.IsNewRecord() Then + Return + End If + + If Not Me.DeletedRecordIds Is Nothing AndAlso Me.DeletedRecordIds.Trim <> "" Then + Me.DeletedRecordIds &= "," + End If + + Me.DeletedRecordIds &= "[" & rec.RecordUniqueId & "]" + End Sub + + Protected Overridable Function InDeletedRecordIds(ByVal rec As PersonalRankTableControlRow) As Boolean + If Me.DeletedRecordIds Is Nothing OrElse Me.DeletedRecordIds.Trim = "" Then + Return False + End If + + Return Me.DeletedRecordIds.IndexOf("[" & rec.RecordUniqueId & "]") >= 0 + End Function + + Private _DeletedRecordIds As String + Public Property DeletedRecordIds() As String + Get + Return Me._DeletedRecordIds + End Get + Set(ByVal value As String) + Me._DeletedRecordIds = value + End Set + End Property + + + ' Create Set, WhereClause, and Populate Methods + + Public Overridable Sub SetGazetteDateLabel1() + + End Sub + + Public Overridable Sub SetGazetteNOLabel1() + + End Sub + + Public Overridable Sub SetGazettePageLabel1() + + End Sub + + Public Overridable Sub SetGazetteSectionLabel1() + + End Sub + + Public Overridable Sub SetPersonalRankTableControlCollapsibleRegion() + + End Sub + + Public Overridable Sub SetPreRankLabel1() + + End Sub + + Public Overridable Sub SetRankDateLabel() + + End Sub + + Public Overridable Sub SetRankIdLabel2() + + End Sub + + Public Overridable Sub SetRefDateLabel1() + + End Sub + + Public Overridable Sub SetRefLabel2() + + 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. + Dim added As Boolean = Me.AddNewRecord > 0 + Me.LoadData() + Me.DataBind() + + If added Then + Me.SetFocusToAddedRow() + End If + + End If + + + + Catch ex As Exception + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + Finally + DbUtils.EndTransaction + End Try + End Sub + + 'this function sets focus to the first editable element in the new added row in the editable table + Protected Overridable Sub SetFocusToAddedRow() + Dim rep As System.Web.UI.WebControls.Repeater = CType(Me.FindControl("PersonalRankTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing OrElse rep.Items.Count = 0 Then Return + Dim repItem As System.Web.UI.WebControls.RepeaterItem + For Each repItem In rep.Items + 'Load scripts to table rows + Me.Page.LoadFocusScripts(repItem) + Dim recControl As PersonalRankTableControlRow = DirectCast(repItem.FindControl("PersonalRankTableControlRow"), PersonalRankTableControlRow) + If recControl.IsNewRecord Then + For Each field As Control In recControl.Controls + If field.Visible AndAlso Me.Page.IsControlEditable(field, False) Then + 'set focus on the first editable field in the new row + field.Focus() + Dim updPan As UpdatePanel = DirectCast(Me.Page.FindControlRecursively("UpdatePanel1"), UpdatePanel) + If Not updPan Is Nothing Then updPan.Update() + Return + End If + Next + Return + End If + Next + End Sub + + + Protected Overrides Sub SaveControlsToSession() + MyBase.SaveControlsToSession() + + ' Save filter controls to values to session. + + + 'Save pagination state to session. + + + + ' Save table control properties to the session. + If Not Me.CurrentSortOrder Is Nothing Then + Me.SaveToSession(Me, "Order_By", Me.CurrentSortOrder.ToXmlString()) + End If + + Me.SaveToSession(Me, "Page_Index", Me.PageIndex.ToString()) + Me.SaveToSession(Me, "Page_Size", Me.PageSize.ToString()) + + Me.SaveToSession(Me, "DeletedRecordIds", Me.DeletedRecordIds) + + End Sub + + Protected Sub SaveControlsToSession_Ajax() + ' Save filter controls to values to session. + + HttpContext.Current.Session("AppRelativeVirtualPath") = Me.Page.AppRelativeVirtualPath + + End Sub + + Protected Overrides Sub ClearControlsFromSession() + MyBase.ClearControlsFromSession() + + ' Clear filter controls values from the session. + + + ' Clear pagination state from session. + + + + ' Clear table properties from the session. + Me.RemoveFromSession(Me, "Order_By") + Me.RemoveFromSession(Me, "Page_Index") + Me.RemoveFromSession(Me, "Page_Size") + + Me.RemoveFromSession(Me, "DeletedRecordIds") + + End Sub + + Protected Overrides Sub LoadViewState(ByVal savedState As Object) + MyBase.LoadViewState(savedState) + + Dim orderByStr As String = CType(ViewState("PersonalRankTableControl_OrderBy"), String) + + If orderByStr IsNot Nothing AndAlso orderByStr.Trim <> "" Then + Me.CurrentSortOrder = BaseClasses.Data.OrderBy.FromXmlString(orderByStr) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + End If + + Dim pageIndex As String = CType(ViewState("Page_Index"), String) + If pageIndex IsNot Nothing Then + Me.PageIndex = CInt(pageIndex) + End If + + Dim pageSize As String = CType(ViewState("Page_Size"), String) + If Not pageSize Is Nothing Then + Me.PageSize = CInt(pageSize) + End If + + + + ' Load view state for pagination control. + + Me.DeletedRecordIds = CType(Me.ViewState("DeletedRecordIds"), String) + + End Sub + + Protected Overrides Function SaveViewState() As Object + + If Me.CurrentSortOrder IsNot Nothing Then + Me.ViewState("PersonalRankTableControl_OrderBy") = Me.CurrentSortOrder.ToXmlString() + End If + + Me.ViewState("Page_Index") = Me.PageIndex + Me.ViewState("Page_Size") = Me.PageSize + + Me.ViewState("DeletedRecordIds") = Me.DeletedRecordIds + + + ' Load view state for pagination control. + + + Return MyBase.SaveViewState() + End Function + + ' Generate the event handling functions for pagination events. + + ' event handler for ImageButton + Public Overridable Sub PersonalRankPagination_FirstPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.PageIndex = 0 + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalRankPagination_LastPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.DisplayLastPage = True + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalRankPagination_NextPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.PageIndex += 1 + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for LinkButton + Public Overridable Sub PersonalRankPagination_PageSizeButton_Click(ByVal sender As Object, ByVal args As EventArgs) + + Try + + Me.DataChanged = True + + Me.PageSize = Integer.Parse(Me.PersonalRankPagination.PageSize.Text) + + Me.PageIndex = Integer.Parse(Me.PersonalRankPagination.CurrentPage.Text) - 1 + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalRankPagination_PreviousPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + If Me.PageIndex > 0 Then + Me.PageIndex -= 1 + Me.DataChanged = True + End If + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + + ' Generate the event handling functions for sorting events. + + Public Overridable Sub GazetteDateLabel1_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by GazetteDate when clicked. + + ' Get previous sorting state for GazetteDate. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalRankTable.GazetteDate) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for GazetteDate. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalRankTable.GazetteDate, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by GazetteDate, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub GazetteNOLabel1_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by GazetteNO when clicked. + + ' Get previous sorting state for GazetteNO. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalRankTable.GazetteNO) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for GazetteNO. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalRankTable.GazetteNO, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by GazetteNO, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub GazettePageLabel1_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by GazettePage when clicked. + + ' Get previous sorting state for GazettePage. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalRankTable.GazettePage) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for GazettePage. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalRankTable.GazettePage, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by GazettePage, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub GazetteSectionLabel1_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by GazetteSection when clicked. + + ' Get previous sorting state for GazetteSection. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalRankTable.GazetteSection) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for GazetteSection. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalRankTable.GazetteSection, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by GazetteSection, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub PreRankLabel1_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by PreRank when clicked. + + ' Get previous sorting state for PreRank. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalRankTable.PreRank) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for PreRank. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalRankTable.PreRank, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by PreRank, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub RankDateLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by RankDate when clicked. + + ' Get previous sorting state for RankDate. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalRankTable.RankDate) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for RankDate. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalRankTable.RankDate, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by RankDate, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub RankIdLabel2_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by RankId when clicked. + + ' Get previous sorting state for RankId. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalRankTable.RankId) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for RankId. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalRankTable.RankId, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by RankId, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub RefDateLabel1_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by RefDate when clicked. + + ' Get previous sorting state for RefDate. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalRankTable.RefDate) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for RefDate. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalRankTable.RefDate, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by RefDate, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub RefLabel2_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by Ref when clicked. + + ' Get previous sorting state for Ref. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalRankTable.Ref0) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for Ref. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalRankTable.Ref0, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by Ref, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + + ' Generate the event handling functions for button events. + + ' event handler for ImageButton + Public Overridable Sub PersonalRankAddButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + Me.AddNewRecord = 1 + Me.DataChanged = True + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalRankDeleteButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + If(Not Me.Page.IsPageRefresh) Then + + Me.DeleteSelectedRecords(True) + Me.SetFormulaControls() + + + End If + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalRankEditButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + ' The redirect URL is set on the Properties, Custom Properties or Actions. + ' The ModifyRedirectURL call resolves the parameters before the + ' Response.Redirect redirects the page to the URL. + ' Any code after the Response.Redirect call will not be executed, since the page is + ' redirected to the URL. + + + Dim url As String = "../Shared/ConfigureEditRecord.aspx" + + Dim shouldRedirect As Boolean = True + Dim TargetKey As String = Nothing + Dim DFKA As String = TargetKey + Dim id As String = DFKA + Dim value As String = id + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + url = Me.ModifyRedirectUrl(url, "",False) + url = Me.Page.ModifyRedirectUrl(url, "",False) + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + shouldRedirect = False + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + If shouldRedirect Then + Me.Page.ShouldSaveControlsToSession = True + Me.Page.Response.Redirect(url) + ElseIf Not TargetKey Is Nothing AndAlso _ + Not shouldRedirect Then + Me.Page.ShouldSaveControlsToSession = True + Me.Page.CloseWindow(True) + + End If + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalRankResetButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.CurrentSortOrder.Reset() + If Me.InSession(Me, "Order_By") Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + + End If + + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + + + ' Generate the event handling functions for filter and search events. + + + ' Generate the event handling functions for others + + + Private _UIData As New System.Collections.Generic.List(Of Hashtable) + Public Property UIData() As System.Collections.Generic.List(Of Hashtable) + Get + Return Me._UIData + End Get + Set(ByVal value As System.Collections.Generic.List(Of Hashtable)) + Me._UIData = value + End Set + End Property + + ' pagination properties + Protected _PageSize As Integer + Public Property PageSize() As Integer + Get + Return Me._PageSize + End Get + Set(ByVal value As Integer) + Me._PageSize = value + End Set + End Property + + Protected _PageIndex As Integer + Public Property PageIndex() As Integer + Get + ' Return the PageIndex + Return Me._PageIndex + End Get + Set(ByVal value As Integer) + Me._PageIndex = value + End Set + End Property + + Protected _TotalRecords As Integer = -1 + Public Property TotalRecords() As Integer + Get + If _TotalRecords < 0 + _TotalRecords = PersonalRankTable.GetRecordCount(CreateCompoundJoinFilter(), CreateWhereClause()) + End If + Return Me._TotalRecords + End Get + Set(ByVal value As Integer) + If Me.PageSize > 0 Then + + Me.TotalPages = CInt(Math.Ceiling(value / Me.PageSize)) + + End If + Me._TotalRecords = value + End Set + End Property + + + + Protected _TotalPages As Integer = -1 + Public Property TotalPages() As Integer + Get + If _TotalPages < 0 Then + + Me.TotalPages = CInt(Math.Ceiling(TotalRecords / Me.PageSize)) + + End If + Return Me._TotalPages + End Get + Set(ByVal value As Integer) + Me._TotalPages = value + End Set + End Property + + Protected _DisplayLastPage As Boolean + Public Property DisplayLastPage() As Boolean + Get + Return Me._DisplayLastPage + End Get + Set(ByVal value As Boolean) + Me._DisplayLastPage = value + End Set + End Property + + Private _DataChanged As Boolean = False + Public Property DataChanged() As Boolean + Get + Return Me._DataChanged + End Get + Set(ByVal value As Boolean) + Me._DataChanged = value + End Set + End Property + + Private _ResetData As Boolean = False + Public Property ResetData() As Boolean + Get + Return Me._ResetData + End Get + Set(ByVal value As Boolean) + Me._ResetData = value + End Set + End Property + + Private _AddNewRecord As Integer = 0 + Public Property AddNewRecord() As Integer + Get + Return Me._AddNewRecord + End Get + Set(ByVal value As Integer) + Me._AddNewRecord = value + End Set + End Property + + + Private _CurrentSortOrder As OrderBy = Nothing + Public Property CurrentSortOrder() As OrderBy + Get + Return Me._CurrentSortOrder + End Get + Set(ByVal value As BaseClasses.Data.OrderBy) + Me._CurrentSortOrder = value + End Set + End Property + + Private _DataSource() As PersonalRankRecord = Nothing + Public Property DataSource() As PersonalRankRecord () + Get + Return Me._DataSource + End Get + Set(ByVal value() As PersonalRankRecord) + Me._DataSource = value + End Set + End Property + +#Region "Helper Properties" + + Public ReadOnly Property GazetteDateLabel1() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "GazetteDateLabel1"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property GazetteNOLabel1() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "GazetteNOLabel1"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property GazettePageLabel1() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "GazettePageLabel1"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property GazetteSectionLabel1() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "GazetteSectionLabel1"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property PersonalRankAddButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalRankAddButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalRankDeleteButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalRankDeleteButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalRankEditButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalRankEditButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalRankPagination() As Persons.UI.IPagination + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalRankPagination"), Persons.UI.IPagination) + End Get + End Property + + Public ReadOnly Property PersonalRankResetButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalRankResetButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalRankTableControlCollapsibleRegion() As System.Web.UI.WebControls.Panel + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalRankTableControlCollapsibleRegion"), System.Web.UI.WebControls.Panel) + End Get + End Property + + Public ReadOnly Property PersonalRankToggleAll() As System.Web.UI.WebControls.CheckBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalRankToggleAll"), System.Web.UI.WebControls.CheckBox) + End Get + End Property + + Public ReadOnly Property PreRankLabel1() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PreRankLabel1"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property RankDateLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RankDateLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property RankIdLabel2() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RankIdLabel2"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property RefDateLabel1() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RefDateLabel1"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property RefLabel2() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RefLabel2"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + +#End Region + +#Region "Helper Functions" + + Public Overrides Overloads Function ModifyRedirectUrl(url As String, arg As String, ByVal bEncrypt As Boolean) As String + Return Me.Page.EvaluateExpressions(url, arg, bEncrypt, Me) + End Function + + Public Overrides Overloads Function EvaluateExpressions(url As String, arg As String, ByVal bEncrypt As Boolean) As String + Dim needToProcess As Boolean = AreAnyUrlParametersForMe(url, arg) + If (needToProcess) Then + Dim recCtl As PersonalRankTableControlRow = Me.GetSelectedRecordControl() + If recCtl Is Nothing AndAlso url.IndexOf("{") >= 0 Then + ' Localization. + Throw New Exception(Page.GetResourceValue("Err:NoRecSelected", "Persons")) + End If + Dim rec As PersonalRankRecord = Nothing + If recCtl IsNot Nothing Then + rec = recCtl.GetRecord() + End If + Return EvaluateExpressions(url, arg, rec, bEncrypt) + End If + Return url + End Function + + Public Overridable Function GetSelectedRecordIndex() As Integer + Dim counter As Integer = 0 + Dim recControl As PersonalRankTableControlRow + For Each recControl In Me.GetRecordControls() + If recControl.PersonalRankRecordRowSelection.Checked Then + Return counter + End If + counter += 1 + Next + Return -1 + End Function + + Public Overridable Function GetSelectedRecordControl() As PersonalRankTableControlRow + Dim selectedList() As PersonalRankTableControlRow = Me.GetSelectedRecordControls() + If selectedList.Length = 0 Then + Return Nothing + End If + Return selectedList(0) + + End Function + + Public Overridable Function GetSelectedRecordControls() As PersonalRankTableControlRow() + + Dim selectedList As ArrayList = New ArrayList(25) + Dim recControl As PersonalRankTableControlRow + For Each recControl In Me.GetRecordControls() + If recControl.PersonalRankRecordRowSelection IsNot Nothing AndAlso recControl.PersonalRankRecordRowSelection.Checked Then + selectedList.Add(recControl) + End If + Next + Return DirectCast(selectedList.ToArray(GetType(PersonalRankTableControlRow)), PersonalRankTableControlRow()) + + End Function + + Public Overridable Sub DeleteSelectedRecords(ByVal deferDeletion As Boolean) + Dim recList() As PersonalRankTableControlRow = Me.GetSelectedRecordControls() + If recList.Length = 0 Then + ' Localization. + Throw New Exception(Page.GetResourceValue("Err:NoRecSelected", "Persons")) + End If + + Dim recCtl As PersonalRankTableControlRow + For Each recCtl In recList + If deferDeletion Then + If Not recCtl.IsNewRecord Then + + Me.AddToDeletedRecordIds(recCtl) + + End If + recCtl.Visible = False + + recCtl.PersonalRankRecordRowSelection.Checked = False + + Else + + recCtl.Delete() + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + End If + Next + End Sub + + Public Function GetRecordControls() As PersonalRankTableControlRow() + Dim recList As ArrayList = New ArrayList() + Dim rep As System.Web.UI.WebControls.Repeater = CType(Me.FindControl("PersonalRankTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return Nothing + Dim repItem As System.Web.UI.WebControls.RepeaterItem + + For Each repItem In rep.Items + + Dim recControl As PersonalRankTableControlRow = DirectCast(repItem.FindControl("PersonalRankTableControlRow"), PersonalRankTableControlRow) + recList.Add(recControl) + + Next + + Return DirectCast(recList.ToArray(GetType(PersonalRankTableControlRow)), PersonalRankTableControlRow()) + End Function + + Public Shadows ReadOnly Property Page() As BaseApplicationPage + Get + Return DirectCast(MyBase.Page, BaseApplicationPage) + End Get + End Property + +#End Region + + + +End Class + + +' Base class for the PersonalSalaryTableControlRow control on the EditPersonalId page. +' Do not modify this class. Instead override any method in PersonalSalaryTableControlRow. +Public Class BasePersonalSalaryTableControlRow + Inherits Persons.UI.BaseApplicationRecordControl + + ' To customize, override this method in PersonalSalaryTableControlRow. + Protected Overridable Sub Control_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Init + + Me.ClearControlsFromSession() + End Sub + + ' To customize, override this method in PersonalSalaryTableControlRow. + Protected Overridable Sub Control_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load + + 'Call LoadFocusScripts from repeater so that onfocus attribute could be added to elements + Me.Page.LoadFocusScripts(Me) + + ' Show confirmation message on Click + Me.PersonalSalaryRowDeleteButton.Attributes.Add("onClick", "return (confirm('" & (CType(Me.Page,BaseApplicationPage)).GetResourceValue("DeleteRecordConfirm", "Persons") & "'));") + + + ' Register the event handlers. + + AddHandler Me.PersonalSalaryRowDeleteButton.Click, AddressOf PersonalSalaryRowDeleteButton_Click + + AddHandler Me.PersonalSalaryRowEditButton.Click, AddressOf PersonalSalaryRowEditButton_Click + + AddHandler Me.PersonalSalaryRowViewButton.Click, AddressOf PersonalSalaryRowViewButton_Click + + AddHandler Me.CommandDate2.TextChanged, AddressOf CommandDate2_TextChanged + + AddHandler Me.PositionSalary.TextChanged, AddressOf PositionSalary_TextChanged + + AddHandler Me.SalaryAmout.TextChanged, AddressOf SalaryAmout_TextChanged + + AddHandler Me.SalaryCommand.TextChanged, AddressOf SalaryCommand_TextChanged + + AddHandler Me.SalaryDate.TextChanged, AddressOf SalaryDate_TextChanged + + AddHandler Me.SalaryPlus.TextChanged, AddressOf SalaryPlus_TextChanged + + AddHandler Me.SalaryRank.TextChanged, AddressOf SalaryRank_TextChanged + + AddHandler Me.SalaryStep.TextChanged, AddressOf SalaryStep_TextChanged + + AddHandler Me.SalaryYear.TextChanged, AddressOf SalaryYear_TextChanged + + + End Sub + + + Public Overridable Sub LoadData() + + ' Load the data from the database into the DataSource PersonalSalary 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 = PersonalSalaryTable.GetRecord(Me.RecordUniqueId, True) + + Return + End If + + ' Since this is a row in the table, the data for this row is loaded by the + ' LoadData method of the BasePersonalSalaryTableControl when the data for the entire + ' table is loaded. + + Me.DataSource = New PersonalSalaryRecord() + + + + End Sub + + ' Populate the UI controls using the DataSource. To customize, override this method in PersonalSalaryTableControlRow. + 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 + + SetCommandDate2() + + + + + SetPositionSalary() + SetSalaryAmout() + SetSalaryCommand() + SetSalaryDate() + SetSalaryPlus() + SetSalaryRank() + SetSalaryStep() + SetSalaryYear() + + + 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 SetCommandDate2() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.CommandDate2.ID) Then + + Me.CommandDate2.Text = Me.PreviousUIData(Me.CommandDate2.ID).ToString() + + Return + End If + + + ' Set the CommandDate TextBox on the webpage with value from the + ' PersonalSalary database record. + + ' Me.DataSource is the PersonalSalary record retrieved from the database. + ' Me.CommandDate2 is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetCommandDate2() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.CommandDateSpecified Then + + ' If the CommandDate is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalSalaryTable.CommandDate, "d MMM yyyy") + + Me.CommandDate2.Text = formattedValue + + Else + + ' CommandDate is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.CommandDate2.Text = PersonalSalaryTable.CommandDate.Format(PersonalSalaryTable.CommandDate.DefaultValue, "d MMM yyyy") + + End If + + End Sub + + Public Overridable Sub SetPositionSalary() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.PositionSalary.ID) Then + + Me.PositionSalary.Text = Me.PreviousUIData(Me.PositionSalary.ID).ToString() + + Return + End If + + + ' Set the PositionSalary TextBox on the webpage with value from the + ' PersonalSalary database record. + + ' Me.DataSource is the PersonalSalary record retrieved from the database. + ' Me.PositionSalary is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetPositionSalary() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.PositionSalarySpecified Then + + ' If the PositionSalary is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalSalaryTable.PositionSalary, "#####") + + Me.PositionSalary.Text = formattedValue + + Else + + ' PositionSalary is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.PositionSalary.Text = PersonalSalaryTable.PositionSalary.Format(PersonalSalaryTable.PositionSalary.DefaultValue, "#####") + + End If + + End Sub + + Public Overridable Sub SetSalaryAmout() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.SalaryAmout.ID) Then + + Me.SalaryAmout.Text = Me.PreviousUIData(Me.SalaryAmout.ID).ToString() + + Return + End If + + + ' Set the SalaryAmout TextBox on the webpage with value from the + ' PersonalSalary database record. + + ' Me.DataSource is the PersonalSalary record retrieved from the database. + ' Me.SalaryAmout is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetSalaryAmout() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.SalaryAmoutSpecified Then + + ' If the SalaryAmout is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalSalaryTable.SalaryAmout, "#,###") + + Me.SalaryAmout.Text = formattedValue + + Else + + ' SalaryAmout is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.SalaryAmout.Text = PersonalSalaryTable.SalaryAmout.Format(PersonalSalaryTable.SalaryAmout.DefaultValue, "#,###") + + End If + + End Sub + + Public Overridable Sub SetSalaryCommand() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.SalaryCommand.ID) Then + + Me.SalaryCommand.Text = Me.PreviousUIData(Me.SalaryCommand.ID).ToString() + + Return + End If + + + ' Set the SalaryCommand TextBox on the webpage with value from the + ' PersonalSalary database record. + + ' Me.DataSource is the PersonalSalary record retrieved from the database. + ' Me.SalaryCommand is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetSalaryCommand() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.SalaryCommandSpecified Then + + ' If the SalaryCommand is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalSalaryTable.SalaryCommand) + + Me.SalaryCommand.Text = formattedValue + + Else + + ' SalaryCommand is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.SalaryCommand.Text = PersonalSalaryTable.SalaryCommand.Format(PersonalSalaryTable.SalaryCommand.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetSalaryDate() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.SalaryDate.ID) Then + + Me.SalaryDate.Text = Me.PreviousUIData(Me.SalaryDate.ID).ToString() + + Return + End If + + + ' Set the SalaryDate TextBox on the webpage with value from the + ' PersonalSalary database record. + + ' Me.DataSource is the PersonalSalary record retrieved from the database. + ' Me.SalaryDate is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetSalaryDate() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.SalaryDateSpecified Then + + ' If the SalaryDate is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalSalaryTable.SalaryDate, "d MMM yyyy") + + Me.SalaryDate.Text = formattedValue + + Else + + ' SalaryDate is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.SalaryDate.Text = PersonalSalaryTable.SalaryDate.Format(PersonalSalaryTable.SalaryDate.DefaultValue, "d MMM yyyy") + + End If + + End Sub + + Public Overridable Sub SetSalaryPlus() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.SalaryPlus.ID) Then + + Me.SalaryPlus.Text = Me.PreviousUIData(Me.SalaryPlus.ID).ToString() + + Return + End If + + + ' Set the SalaryPlus TextBox on the webpage with value from the + ' PersonalSalary database record. + + ' Me.DataSource is the PersonalSalary record retrieved from the database. + ' Me.SalaryPlus is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetSalaryPlus() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.SalaryPlusSpecified Then + + ' If the SalaryPlus is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalSalaryTable.SalaryPlus, "#####") + + Me.SalaryPlus.Text = formattedValue + + Else + + ' SalaryPlus is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.SalaryPlus.Text = PersonalSalaryTable.SalaryPlus.Format(PersonalSalaryTable.SalaryPlus.DefaultValue, "#####") + + End If + + End Sub + + Public Overridable Sub SetSalaryRank() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.SalaryRank.ID) Then + + Me.SalaryRank.Text = Me.PreviousUIData(Me.SalaryRank.ID).ToString() + + Return + End If + + + ' Set the SalaryRank TextBox on the webpage with value from the + ' PersonalSalary database record. + + ' Me.DataSource is the PersonalSalary record retrieved from the database. + ' Me.SalaryRank is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetSalaryRank() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.SalaryRankSpecified Then + + ' If the SalaryRank is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalSalaryTable.SalaryRank) + + Me.SalaryRank.Text = formattedValue + + Else + + ' SalaryRank is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.SalaryRank.Text = PersonalSalaryTable.SalaryRank.Format(PersonalSalaryTable.SalaryRank.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetSalaryStep() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.SalaryStep.ID) Then + + Me.SalaryStep.Text = Me.PreviousUIData(Me.SalaryStep.ID).ToString() + + Return + End If + + + ' Set the SalaryStep TextBox on the webpage with value from the + ' PersonalSalary database record. + + ' Me.DataSource is the PersonalSalary record retrieved from the database. + ' Me.SalaryStep is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetSalaryStep() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.SalaryStepSpecified Then + + ' If the SalaryStep is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalSalaryTable.SalaryStep) + + Me.SalaryStep.Text = formattedValue + + Else + + ' SalaryStep is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.SalaryStep.Text = PersonalSalaryTable.SalaryStep.Format(PersonalSalaryTable.SalaryStep.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetSalaryYear() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.SalaryYear.ID) Then + + Me.SalaryYear.Text = Me.PreviousUIData(Me.SalaryYear.ID).ToString() + + Return + End If + + + ' Set the SalaryYear TextBox on the webpage with value from the + ' PersonalSalary database record. + + ' Me.DataSource is the PersonalSalary record retrieved from the database. + ' Me.SalaryYear is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetSalaryYear() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.SalaryYearSpecified Then + + ' If the SalaryYear is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalSalaryTable.SalaryYear) + + Me.SalaryYear.Text = formattedValue + + Else + + ' SalaryYear is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.SalaryYear.Text = PersonalSalaryTable.SalaryYear.Format(PersonalSalaryTable.SalaryYear.DefaultValue) + + End If + + End Sub + + + Public EvaluateFormulaDelegate As BaseClasses.Data.DataSource.EvaluateFormulaDelegate = New BaseClasses.Data.DataSource.EvaluateFormulaDelegate(AddressOf Me.EvaluateFormula) + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean, ByVal e As FormulaEvaluator) As String + If e Is Nothing Then + e = New FormulaEvaluator() + End If + + e.Variables.Clear() + + + ' add variables for formula evaluation + If variables IsNot Nothing Then + Dim enumerator As System.Collections.Generic.IEnumerator(Of System.Collections.Generic.KeyValuePair(Of String, Object)) = variables.GetEnumerator() + While enumerator.MoveNext() + e.Variables.Add(enumerator.Current.Key, enumerator.Current.Value) + End While + End If + + If includeDS + + End IF + + + ' Other variables referred to in the formula are expected to be + ' properties of the DataSource. For example, referring to + ' UnitPrice as a variable will refer to DataSource.UnitPrice + If dataSourceForEvaluate Is Nothing Then + + e.DataSource = Me.DataSource + + Else + e.DataSource = dataSourceForEvaluate + End If + + ' Define the calling control. This is used to add other + ' related table and record controls as variables. + e.CallingControl = Me + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + + If Not String.IsNullOrEmpty(format) AndAlso (String.IsNullOrEmpty(formula) OrElse formula.IndexOf("Format(") < 0) Then + Return FormulaUtils.Format(resultObj, format) + Else + Return resultObj.ToString() + End If + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format,variables ,includeDS, Nothing) + End Function + + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object)) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format, variables ,True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, format, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal e as FormulaEvaluator) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, variables, True, e) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal includeDS as Boolean) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, includeDS, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, True, Nothing) + End Function + + + Public Overridable Sub RegisterPostback() + + + End Sub + + + + ' To customize, override this method in PersonalSalaryTableControlRow. + 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 parentCtrl As PersonalIdRecordControl + + + parentCtrl = DirectCast(Me.Page.FindControlRecursively("PersonalIdRecordControl"), PersonalIdRecordControl) + + If (Not IsNothing(parentCtrl) AndAlso IsNothing(parentCtrl.DataSource)) + ' Load the record if it is not loaded yet. + parentCtrl.LoadData() + End If + If (IsNothing(parentCtrl) OrElse IsNothing(parentCtrl.DataSource)) + ' Get the error message from the application resource file. + Throw New Exception(Page.GetResourceValue("Err:NoParentRecId", "Persons")) + End If + + Me.DataSource.PersonalId = parentCtrl.DataSource.PersonalId + + ' 2. Perform any custom validation. + Me.Validate() + + + ' 3. Set the values in the record with data from UI controls. + ' This calls the Get() method for each of the user interface controls. + Me.GetUIData() + + ' 4. Save in the database. + ' We should not save the record if the data did not change. This + ' will save a database hit and avoid triggering any database triggers. + + If Me.DataSource.IsAnyValueChanged Then + ' Save record to database but do not commit yet. + ' Auto generated ids are available after saving for use by child (dependent) records. + Me.DataSource.Save() + + DirectCast(GetParentControlObject(Me, "PersonalSalaryTableControl"), PersonalSalaryTableControl).DataChanged = True + DirectCast(GetParentControlObject(Me, "PersonalSalaryTableControl"), PersonalSalaryTableControl).ResetData = True + End If + + + ' update session or cookie by formula + + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + ' For Master-Detail relationships, save data on the Detail table(s) + + End Sub + + ' To customize, override this method in PersonalSalaryTableControlRow. + 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. + + GetCommandDate2() + GetPositionSalary() + GetSalaryAmout() + GetSalaryCommand() + GetSalaryDate() + GetSalaryPlus() + GetSalaryRank() + GetSalaryStep() + GetSalaryYear() + End Sub + + + Public Overridable Sub GetCommandDate2() + + ' Retrieve the value entered by the user on the CommandDate ASP:TextBox, and + ' save it into the CommandDate field in DataSource PersonalSalary 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.CommandDate2.Text, PersonalSalaryTable.CommandDate) + + + End Sub + + Public Overridable Sub GetPositionSalary() + + ' Retrieve the value entered by the user on the PositionSalary ASP:TextBox, and + ' save it into the PositionSalary field in DataSource PersonalSalary record. + ' Parse will also validate the amount to ensure it is of the proper format + ' and valid. The format is verified based on the current culture + ' settings including the currency symbol and decimal separator + ' (no currency conversion is performed). + ' 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.PositionSalary.Text, PersonalSalaryTable.PositionSalary) + + + End Sub + + Public Overridable Sub GetSalaryAmout() + + ' Retrieve the value entered by the user on the SalaryAmout ASP:TextBox, and + ' save it into the SalaryAmout field in DataSource PersonalSalary record. + ' Parse will also validate the amount to ensure it is of the proper format + ' and valid. The format is verified based on the current culture + ' settings including the currency symbol and decimal separator + ' (no currency conversion is performed). + ' 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.SalaryAmout.Text, PersonalSalaryTable.SalaryAmout) + + + End Sub + + Public Overridable Sub GetSalaryCommand() + + ' Retrieve the value entered by the user on the SalaryCommand ASP:TextBox, and + ' save it into the SalaryCommand field in DataSource PersonalSalary record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.SalaryCommand.Text, PersonalSalaryTable.SalaryCommand) + + + End Sub + + Public Overridable Sub GetSalaryDate() + + ' Retrieve the value entered by the user on the SalaryDate ASP:TextBox, and + ' save it into the SalaryDate field in DataSource PersonalSalary 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.SalaryDate.Text, PersonalSalaryTable.SalaryDate) + + + End Sub + + Public Overridable Sub GetSalaryPlus() + + ' Retrieve the value entered by the user on the SalaryPlus ASP:TextBox, and + ' save it into the SalaryPlus field in DataSource PersonalSalary record. + ' Parse will also validate the amount to ensure it is of the proper format + ' and valid. The format is verified based on the current culture + ' settings including the currency symbol and decimal separator + ' (no currency conversion is performed). + ' 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.SalaryPlus.Text, PersonalSalaryTable.SalaryPlus) + + + End Sub + + Public Overridable Sub GetSalaryRank() + + ' Retrieve the value entered by the user on the SalaryRank ASP:TextBox, and + ' save it into the SalaryRank field in DataSource PersonalSalary record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.SalaryRank.Text, PersonalSalaryTable.SalaryRank) + + + End Sub + + Public Overridable Sub GetSalaryStep() + + ' Retrieve the value entered by the user on the SalaryStep ASP:TextBox, and + ' save it into the SalaryStep field in DataSource PersonalSalary record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.SalaryStep.Text, PersonalSalaryTable.SalaryStep) + + + End Sub + + Public Overridable Sub GetSalaryYear() + + ' Retrieve the value entered by the user on the SalaryYear ASP:TextBox, and + ' save it into the SalaryYear field in DataSource PersonalSalary record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.SalaryYear.Text, PersonalSalaryTable.SalaryYear) + + + End Sub + + + ' To customize, override this method in PersonalSalaryTableControlRow. + + Public Overridable Function CreateWhereClause() As WhereClause + + Return Nothing + + End Function + + + + ' To customize, override this method in PersonalSalaryTableControlRow. + 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) + PersonalSalaryTable.DeleteRecord(pkValue) + + DirectCast(GetParentControlObject(Me, "PersonalSalaryTableControl"), PersonalSalaryTableControl).DataChanged = True + DirectCast(GetParentControlObject(Me, "PersonalSalaryTableControl"), PersonalSalaryTableControl).ResetData = True + End Sub + + Protected Overridable Sub Control_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.PreRender + ' PreRender event is raised just before page is being displayed. + Try + DbUtils.StartTransaction() + Me.RegisterPostback() + + If Not Me.Page.ErrorOnPage AndAlso (Me.Page.IsPageRefresh OrElse Me.DataChanged OrElse Me.ResetData) Then + + + ' Re-load the data and update the web page if necessary. + ' This is typically done during a postback (filter, search button, sort, pagination button). + ' In each of the other click handlers, simply set DataChanged to True to reload the data. + Me.LoadData() + Me.DataBind() + End If + + + Catch ex As Exception + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + Finally + DbUtils.EndTransaction() + End Try + End Sub + + + Protected Overrides Sub SaveControlsToSession() + MyBase.SaveControlsToSession() + + + 'Save pagination state to session. + + End Sub + + + + Protected Overrides Sub ClearControlsFromSession() + MyBase.ClearControlsFromSession() + + + + ' Clear pagination state from session. + + End Sub + + Protected Overrides Sub LoadViewState(ByVal savedState As Object) + MyBase.LoadViewState(savedState) + Dim isNewRecord As String = CType(ViewState("IsNewRecord"), String) + If Not isNewRecord Is Nothing AndAlso isNewRecord.Trim <> "" Then + Me.IsNewRecord = Boolean.Parse(isNewRecord) + End If + + Dim myCheckSum As String = CType(ViewState("CheckSum"), String) + If Not myCheckSum Is Nothing AndAlso myCheckSum.Trim <> "" Then + Me.CheckSum = myCheckSum + End If + + + ' Load view state for pagination control. + + End Sub + + Protected Overrides Function SaveViewState() As Object + ViewState("IsNewRecord") = Me.IsNewRecord.ToString() + ViewState("CheckSum") = Me.CheckSum + + + ' Load view state for pagination control. + + Return MyBase.SaveViewState() + End Function + + + ' event handler for ImageButton + Public Overridable Sub PersonalSalaryRowDeleteButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + If(Not Me.Page.IsPageRefresh) Then + + Dim tc As PersonalSalaryTableControl = DirectCast(GetParentControlObject(Me, "PersonalSalaryTableControl"), PersonalSalaryTableControl) + If Not (IsNothing(tc)) Then + If Not Me.IsNewRecord Then + tc.AddToDeletedRecordIds(DirectCast(Me, PersonalSalaryTableControlRow)) + End If + Me.Visible = False + tc.SetFormulaControls() + End If + + End If + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalSalaryRowEditButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + ' The redirect URL is set on the Properties, Custom Properties or Actions. + ' The ModifyRedirectURL call resolves the parameters before the + ' Response.Redirect redirects the page to the URL. + ' Any code after the Response.Redirect call will not be executed, since the page is + ' redirected to the URL. + + + Dim url As String = "../Shared/ConfigureEditRecord.aspx" + + Dim shouldRedirect As Boolean = True + Dim TargetKey As String = Nothing + Dim DFKA As String = TargetKey + Dim id As String = DFKA + Dim value As String = id + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + url = Me.ModifyRedirectUrl(url, "",False) + url = Me.Page.ModifyRedirectUrl(url, "",False) + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + shouldRedirect = False + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + If shouldRedirect Then + Me.Page.ShouldSaveControlsToSession = True + Me.Page.Response.Redirect(url) + ElseIf Not TargetKey Is Nothing AndAlso _ + Not shouldRedirect Then + Me.Page.ShouldSaveControlsToSession = True + Me.Page.CloseWindow(True) + + End If + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalSalaryRowViewButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + ' The redirect URL is set on the Properties, Custom Properties or Actions. + ' The ModifyRedirectURL call resolves the parameters before the + ' Response.Redirect redirects the page to the URL. + ' Any code after the Response.Redirect call will not be executed, since the page is + ' redirected to the URL. + + + Dim url As String = "../Shared/ConfigureViewRecord.aspx" + + Dim shouldRedirect As Boolean = True + Dim TargetKey As String = Nothing + Dim DFKA As String = TargetKey + Dim id As String = DFKA + Dim value As String = id + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + url = Me.ModifyRedirectUrl(url, "",False) + url = Me.Page.ModifyRedirectUrl(url, "",False) + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + shouldRedirect = False + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + If shouldRedirect Then + Me.Page.ShouldSaveControlsToSession = True + Me.Page.Response.Redirect(url) + ElseIf Not TargetKey Is Nothing AndAlso _ + Not shouldRedirect Then + Me.Page.ShouldSaveControlsToSession = True + Me.Page.CloseWindow(True) + + End If + End Sub + + Protected Overridable Sub CommandDate2_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub PositionSalary_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub SalaryAmout_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub SalaryCommand_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub SalaryDate_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub SalaryPlus_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub SalaryRank_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub SalaryStep_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub SalaryYear_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("BasePersonalSalaryTableControlRow_Rec"), String) + End Get + Set(ByVal value As String) + Me.ViewState("BasePersonalSalaryTableControlRow_Rec") = value + End Set + End Property + + Private _DataSource As PersonalSalaryRecord + Public Property DataSource() As PersonalSalaryRecord + Get + Return Me._DataSource + End Get + + Set(ByVal value As PersonalSalaryRecord) + + Me._DataSource = value + End Set + End Property + + + + Private _checkSum As String + Public Overridable Property CheckSum() As String + Get + Return Me._checkSum + End Get + Set(ByVal value As String) + Me._checkSum = value + End Set + End Property + + Private _TotalPages As Integer + Public Property TotalPages() As Integer + Get + Return Me._TotalPages + End Get + Set(ByVal value As Integer) + Me._TotalPages = value + End Set + End Property + + Private _PageIndex As Integer + Public Property PageIndex() As Integer + Get + ' Return the PageIndex + Return Me._PageIndex + End Get + Set(ByVal value As Integer) + Me._PageIndex = value + End Set + End Property + + Private _DisplayLastPage As Boolean + Public Property DisplayLastPage() As Boolean + Get + Return Me._DisplayLastPage + End Get + Set(ByVal value As Boolean) + Me._DisplayLastPage = value + End Set + End Property + + + +#Region "Helper Properties" + + Public ReadOnly Property CommandDate2() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "CommandDate2"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property PersonalSalaryRecordRowSelection() As System.Web.UI.WebControls.CheckBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalSalaryRecordRowSelection"), System.Web.UI.WebControls.CheckBox) + End Get + End Property + + Public ReadOnly Property PersonalSalaryRowDeleteButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalSalaryRowDeleteButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalSalaryRowEditButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalSalaryRowEditButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalSalaryRowViewButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalSalaryRowViewButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PositionSalary() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PositionSalary"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property SalaryAmout() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "SalaryAmout"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property SalaryCommand() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "SalaryCommand"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property SalaryDate() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "SalaryDate"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property SalaryPlus() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "SalaryPlus"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property SalaryRank() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "SalaryRank"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property SalaryStep() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "SalaryStep"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property SalaryYear() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "SalaryYear"), System.Web.UI.WebControls.TextBox) + 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 PersonalSalaryRecord = 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 PersonalSalaryRecord + If Not Me.DataSource Is Nothing Then + Return Me.DataSource + End If + + If Not Me.RecordUniqueId Is Nothing Then + + Return PersonalSalaryTable.GetRecord(Me.RecordUniqueId, True) + + End If + + ' Localization. + + Return Nothing + + End Function + + Public Shadows ReadOnly Property Page() As BaseApplicationPage + Get + Return DirectCast(MyBase.Page, BaseApplicationPage) + End Get + End Property + +#End Region + +End Class + + + +' Base class for the PersonalSalaryTableControl control on the EditPersonalId page. +' Do not modify this class. Instead override any method in PersonalSalaryTableControl. +Public Class BasePersonalSalaryTableControl + Inherits Persons.UI.BaseApplicationTableControl + + + + Protected Overridable Sub Control_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Init + + + + ' Setup the filter and search events. + + + + ' Control Initializations. + ' Initialize the table's current sort order. + + If Me.InSession(Me, "Order_By") Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + Me.CurrentSortOrder.Add(PersonalSalaryTable.SalaryDate, OrderByItem.OrderDir.Asc) + + Me.CurrentSortOrder.Add(PersonalSalaryTable.CommandDate, OrderByItem.OrderDir.Asc) + + End If + + + + ' Setup default pagination settings. + + Me.PageSize = CInt(Me.GetFromSession(Me, "Page_Size", "10")) + Me.PageIndex = CInt(Me.GetFromSession(Me, "Page_Index", "0")) + + + + Me.ClearControlsFromSession() + End Sub + + Protected Overridable Sub Control_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load + + SaveControlsToSession_Ajax() + + ' Show confirmation message on Click + Me.PersonalSalaryDeleteButton.Attributes.Add("onClick", "return (confirm('" & (CType(Me.Page,BaseApplicationPage)).GetResourceValue("DeleteConfirm", "Persons") & "'));") + + ' Setup the pagination events. + + AddHandler Me.PersonalSalaryPagination.FirstPage.Click, AddressOf PersonalSalaryPagination_FirstPage_Click + + AddHandler Me.PersonalSalaryPagination.LastPage.Click, AddressOf PersonalSalaryPagination_LastPage_Click + + AddHandler Me.PersonalSalaryPagination.NextPage.Click, AddressOf PersonalSalaryPagination_NextPage_Click + + AddHandler Me.PersonalSalaryPagination.PageSizeButton.Click, AddressOf PersonalSalaryPagination_PageSizeButton_Click + + AddHandler Me.PersonalSalaryPagination.PreviousPage.Click, AddressOf PersonalSalaryPagination_PreviousPage_Click + + + ' Setup the sorting events. + + AddHandler Me.CommandDateLabel2.Click, AddressOf CommandDateLabel2_Click + + AddHandler Me.PositionSalaryLabel.Click, AddressOf PositionSalaryLabel_Click + + AddHandler Me.SalaryAmoutLabel.Click, AddressOf SalaryAmoutLabel_Click + + AddHandler Me.SalaryCommandLabel.Click, AddressOf SalaryCommandLabel_Click + + AddHandler Me.SalaryDateLabel1.Click, AddressOf SalaryDateLabel1_Click + + AddHandler Me.SalaryPlusLabel.Click, AddressOf SalaryPlusLabel_Click + + AddHandler Me.SalaryRankLabel1.Click, AddressOf SalaryRankLabel1_Click + + AddHandler Me.SalaryStepLabel.Click, AddressOf SalaryStepLabel_Click + + AddHandler Me.SalaryYearLabel.Click, AddressOf SalaryYearLabel_Click + + ' Setup the button events. + + AddHandler Me.PersonalSalaryAddButton.Click, AddressOf PersonalSalaryAddButton_Click + + AddHandler Me.PersonalSalaryDeleteButton.Click, AddressOf PersonalSalaryDeleteButton_Click + + AddHandler Me.PersonalSalaryEditButton.Click, AddressOf PersonalSalaryEditButton_Click + + AddHandler Me.PersonalSalaryResetButton.Click, AddressOf PersonalSalaryResetButton_Click + + + ' Setup events for others + + End Sub + + + Public Overridable Sub LoadData() + + ' Read data from database. Returns an array of records that can be assigned + ' to the DataSource table control property. + Try + Dim joinFilter As CompoundFilter = CreateCompoundJoinFilter() + + ' The WHERE clause will be empty when displaying all records in table. + Dim wc As WhereClause = CreateWhereClause() + If wc IsNot Nothing AndAlso Not wc.RunQuery Then + ' Initialize an empty array of records + Dim alist As New ArrayList(0) + Me.DataSource = DirectCast(alist.ToArray(GetType(PersonalSalaryRecord)), PersonalSalaryRecord()) + ' Add records to the list if needed. + Me.AddNewRecords() + Me._TotalRecords = 0 + Me._TotalPages = 0 + Return + End If + + ' Call OrderBy to determine the order - either use the order defined + ' on the Query Wizard, or specified by user (by clicking on column heading) + Dim orderBy As OrderBy = CreateOrderBy() + + ' Get the pagesize from the pagesize control. + Me.GetPageSize() + + If Me.DisplayLastPage Then + Dim totalRecords As Integer = If(Me._TotalRecords < 0, PersonalSalaryTable.GetRecordCount(CreateCompoundJoinFilter(), CreateWhereClause()), Me._TotalRecords) + + Dim totalPages As Integer = CInt(Math.Ceiling(totalRecords / Me.PageSize)) + + Me.PageIndex = totalPages - 1 + End If + + ' Make sure PageIndex (current page) and PageSize are within bounds. + If Me.PageIndex < 0 Then + Me.PageIndex = 0 + End If + If Me.PageSize < 1 Then + Me.PageSize = 1 + End If + + ' Retrieve the records and set the table DataSource. + ' Only PageSize records are fetched starting at PageIndex (zero based). + If Me.AddNewRecord > 0 Then + ' Make sure to preserve the previously entered data on new rows. + Dim postdata As New ArrayList + For Each rc As PersonalSalaryTableControlRow In Me.GetRecordControls() + If Not rc.IsNewRecord Then + rc.DataSource = rc.GetRecord() + rc.GetUIData() + postdata.Add(rc.DataSource) + UIData.Add(rc.PreservedUIData()) + End If + Next + Me.DataSource = DirectCast(postdata.ToArray(GetType(PersonalSalaryRecord)), PersonalSalaryRecord()) + Else ' Get the records from the database + Me.DataSource = PersonalSalaryTable.GetRecords(joinFilter, wc, orderBy, Me.PageIndex, Me.PageSize) + + End If + + ' if the datasource contains no records contained in database, then load the last page. + If (DbUtils.GetCreatedRecords(Me.DataSource).Length = 0 AndAlso Not Me.DisplayLastPage) Then + Me.DisplayLastPage = True + LoadData() + Else + + ' Add any new rows desired by the user. + Me.AddNewRecords() + + ' Turn off the ToggleAll checkbox + Me.PersonalSalaryToggleAll.Checked = False + + + ' Initialize the page and grand totals. now + + End If + + Catch ex As Exception + ' Report the error message to the end user + Dim msg As String = ex.Message + If ex.InnerException IsNot Nothing Then + msg = msg & " InnerException: " & ex.InnerException.Message + End If + Throw New Exception(msg, ex.InnerException) + End Try + End Sub + + + + + Public Overrides Sub DataBind() + ' The DataBind method binds the user interface controls to the values + ' from the database record for each row in the table. To do this, it calls the + ' DataBind for each of the rows. + ' DataBind also populates any filters above the table, and sets the pagination + ' control to the correct number of records and the current page number. + + MyBase.DataBind() + + ' Make sure that the DataSource is initialized. + If Me.DataSource Is Nothing Then + Return + End If + + 'LoadData for DataSource for chart and report if they exist + + ' Setup the pagination controls. + BindPaginationControls() + + + + ' Bind the repeater with the list of records to expand the UI. + Dim rep As System.Web.UI.WebControls.Repeater = CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalSalaryTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return + rep.DataSource = DataSource() + rep.DataBind() + + Dim index As Integer = 0 + For Each repItem As System.Web.UI.WebControls.RepeaterItem In rep.Items + ' Loop through all rows in the table, set its DataSource and call DataBind(). + Dim recControl As PersonalSalaryTableControlRow = DirectCast(repItem.FindControl("PersonalSalaryTableControlRow"), PersonalSalaryTableControlRow) + recControl.DataSource = Me.DataSource(index) + If Me.UIData.Count > index Then + recControl.PreviousUIData = Me.UIData(index) + End If + recControl.DataBind() + recControl.Visible = Not Me.InDeletedRecordIds(recControl) + + index += 1 + Next + + + + + ' Call the Set methods for each controls on the panel + + SetCommandDateLabel2() + + + + + + SetPersonalSalaryTableControlCollapsibleRegion() + + SetPositionSalaryLabel() + SetSalaryAmoutLabel() + SetSalaryCommandLabel() + SetSalaryDateLabel1() + SetSalaryPlusLabel() + SetSalaryRankLabel1() + SetSalaryStepLabel() + SetSalaryYearLabel() + ' setting the state of expand or collapse alternative rows + + + ' Load data for each record and table UI control. + ' Ordering is important because child controls get + ' their parent ids from their parent UI controls. + + + ' this method calls the set method for controls with special formula like running total, sum, rank, etc + SetFormulaControls() + End Sub + + Public Overridable Sub SetFormulaControls() + ' this method calls Set methods for the control that has special formula + + + + End Sub + + + + Public Overridable Sub RegisterPostback() + + + End Sub + + Public EvaluateFormulaDelegate As BaseClasses.Data.DataSource.EvaluateFormulaDelegate = New BaseClasses.Data.DataSource.EvaluateFormulaDelegate(AddressOf Me.EvaluateFormula) + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean, ByVal e as FormulaEvaluator) As String + If e Is Nothing + e = New FormulaEvaluator() + End If + + e.Variables.Clear() + + + ' add variables for formula evaluation + If variables IsNot Nothing Then + Dim enumerator As System.Collections.Generic.IEnumerator(Of System.Collections.Generic.KeyValuePair(Of String, Object)) = variables.GetEnumerator() + While enumerator.MoveNext() + e.Variables.Add(enumerator.Current.Key, enumerator.Current.Value) + End While + End If + + If includeDS + + End If + + ' All variables referred to in the formula are expected to be + ' properties of the DataSource. For example, referring to + ' UnitPrice as a variable will refer to DataSource.UnitPrice + e.DataSource = dataSourceForEvaluate + + ' Define the calling control. This is used to add other + ' related table and record controls as variables. + e.CallingControl = Me + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + + If Not String.IsNullOrEmpty(format) AndAlso (String.IsNullOrEmpty(formula) OrElse formula.IndexOf("Format(") < 0) Then + Return FormulaUtils.Format(resultObj, format) + Else + Return resultObj.ToString() + End If + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format,variables ,includeDS, Nothing) + End Function + + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object)) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format, variables ,True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, format, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal e as FormulaEvaluator) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, variables, True, e) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal includeDS as Boolean) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, includeDS, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, True, Nothing) + End Function + + + + + Public Overridable Sub ResetControl() + + Me.CurrentSortOrder.Reset() + If (Me.InSession(Me, "Order_By")) Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + Me.CurrentSortOrder.Add(PersonalSalaryTable.SalaryDate, OrderByItem.OrderDir.Asc) + + Me.CurrentSortOrder.Add(PersonalSalaryTable.CommandDate, OrderByItem.OrderDir.Asc) + + End If + + Me.PageIndex = 0 + End Sub + + Protected Overridable Sub BindPaginationControls() + ' Setup the pagination controls. + + ' Bind the pagination labels. + + If DbUtils.GetCreatedRecords(Me.DataSource).Length > 0 Then + + Me.PersonalSalaryPagination.CurrentPage.Text = (Me.PageIndex + 1).ToString() + Else + Me.PersonalSalaryPagination.CurrentPage.Text = "0" + End If + Me.PersonalSalaryPagination.PageSize.Text = Me.PageSize.ToString() + Me.PersonalSalaryPagination.TotalItems.Text = Me.TotalRecords.ToString() + Me.PersonalSalaryPagination.TotalPages.Text = Me.TotalPages.ToString() + + ' Bind the buttons for PersonalSalaryTableControl pagination. + + Me.PersonalSalaryPagination.FirstPage.Enabled = Not (Me.PageIndex = 0) + If Me._TotalPages < 0 Then ' if the total pages is not determined yet, enable last and next buttons + Me.PersonalSalaryPagination.LastPage.Enabled = True + ElseIf Me._TotalPages = 0 ' if the total pages is determined and it is 0, enable last and next buttons + Me.PersonalSalaryPagination.LastPage.Enabled = False + Else ' if the total pages is the last page, disable last and next buttons + Me.PersonalSalaryPagination.LastPage.Enabled = Not (Me.PageIndex = Me.TotalPages - 1) + End If + + If Me._TotalPages < 0 Then ' if the total pages is not determined yet, enable last and next buttons + Me.PersonalSalaryPagination.NextPage.Enabled = True + ElseIf Me._TotalPages = 0 ' if the total pages is determined and it is 0, enable last and next buttons + Me.PersonalSalaryPagination.NextPage.Enabled = False + Else ' if the total pages is the last page, disable last and next buttons + Me.PersonalSalaryPagination.NextPage.Enabled = Not (Me.PageIndex = Me.TotalPages - 1) + End If + + Me.PersonalSalaryPagination.PreviousPage.Enabled = Not (Me.PageIndex = 0) + + + End Sub + + Public Overridable Sub SaveData() + ' Save the data from the entire table. Calls each row's Save Data + ' to save their data. This function is called by the Click handler of the + ' Save button. The button handler should Start/Commit/End a transaction. + + Dim recCtl As PersonalSalaryTableControlRow + For Each recCtl In Me.GetRecordControls() + + If Me.InDeletedRecordIds(recCtl) Then + ' Delete any pending deletes. + recCtl.Delete() + Else + If recCtl.Visible Then + recCtl.SaveData() + End If + End If + + Next + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + ' Set IsNewRecord to False for all records - since everything has been saved and is no longer "new" + For Each recCtl In Me.GetRecordControls() + recCtl.IsNewRecord = False + Next + + + ' Set DeletedRecordsIds to Nothing since we have deleted all pending deletes. + Me.DeletedRecordIds = Nothing + + End Sub + + Public Overridable Function CreateCompoundJoinFilter() As CompoundFilter + Dim jFilter As CompoundFilter = New CompoundFilter() + + Return jFilter + + End Function + + + Public Overridable Function CreateOrderBy() As OrderBy + ' The CurrentSortOrder is initialized to the sort order on the + ' Query Wizard. It may be modified by the Click handler for any of + ' the column heading to sort or reverse sort by that column. + ' You can add your own sort order, or modify it on the Query Wizard. + Return Me.CurrentSortOrder + End Function + + Public Overridable Function CreateWhereClause() As WhereClause + 'This CreateWhereClause is used for loading the data. + PersonalSalaryTable.Instance.InnerFilter = Nothing + Dim wc As WhereClause = New WhereClause() + + ' Compose the WHERE clause consiting of: + ' 1. Static clause defined at design time. + ' 2. User selected search criteria. + ' 3. User selected filter criteria. + + + Dim selectedRecordKeyValue as KeyValue = New KeyValue() + + Dim personalIdRecordControlObj As Persons.UI.Controls.EditPersonalId.PersonalIdRecordControl = DirectCast(MiscUtils.FindControlRecursively(Me.Page, "PersonalIdRecordControl"), Persons.UI.Controls.EditPersonalId.PersonalIdRecordControl) + + If (Not IsNothing(personalIdRecordControlObj) AndAlso Not IsNothing(personalIdRecordControlObj.GetRecord()) AndAlso personalIdRecordControlObj.GetRecord().IsCreated AndAlso Not IsNothing(personalIdRecordControlObj.GetRecord().PersonalId)) + wc.iAND(PersonalSalaryTable.PersonalId, BaseFilter.ComparisonOperator.EqualsTo, personalIdRecordControlObj.GetRecord().PersonalId.ToString()) + selectedRecordKeyValue.AddElement(PersonalSalaryTable.PersonalId.InternalName, personalIdRecordControlObj.GetRecord().PersonalId.ToString()) + Else + wc.RunQuery = False + Return wc + End If + + HttpContext.Current.Session("PersonalSalaryTableControlWhereClause") = selectedRecordKeyValue.ToXmlString() + + Return wc + End Function + + + Public Overridable Function CreateWhereClause(ByVal searchText as String, ByVal fromSearchControl as String, ByVal AutoTypeAheadSearch as String, ByVal AutoTypeAheadWordSeparators as String) As WhereClause + ' This CreateWhereClause is used for loading list of suggestions for Auto Type-Ahead feature. + PersonalSalaryTable.Instance.InnerFilter = Nothing + Dim wc As WhereClause = New WhereClause() + + ' Compose the WHERE clause consiting of: + ' 1. Static clause defined at design time. + ' 2. User selected search criteria. + ' 3. User selected filter criteria. + + Dim appRelativeVirtualPath As String = CType(HttpContext.Current.Session("AppRelativeVirtualPath"), String) + + Dim selectedRecordInPersonalIdRecordControl as String = DirectCast(HttpContext.Current.Session("PersonalSalaryTableControlWhereClause"), String) + + If Not selectedRecordInPersonalIdRecordControl Is Nothing AndAlso KeyValue.IsXmlKey(selectedRecordInPersonalIdRecordControl) Then + Dim selectedRecordKeyValue as KeyValue = KeyValue.XmlToKey(selectedRecordInPersonalIdRecordControl) + + If Not IsNothing(selectedRecordKeyValue) AndAlso selectedRecordKeyValue.ContainsColumn(PersonalSalaryTable.PersonalId) Then + wc.iAND(PersonalSalaryTable.PersonalId, BaseFilter.ComparisonOperator.EqualsTo, selectedRecordKeyValue.GetColumnValue(PersonalSalaryTable.PersonalId).ToString()) + End If + + End If + + ' Adds clauses if values are selected in Filter controls which are configured in the page. + + + Return wc + End Function + + + Public Overridable Function FormatSuggestions(ByVal prefixText As String, ByVal resultItem As String, _ + ByVal columnLength As Integer, ByVal AutoTypeAheadDisplayFoundText As String, _ + ByVal autoTypeAheadSearch As String, ByVal AutoTypeAheadWordSeparators As String, _ + ByVal resultList As ArrayList) As Boolean + + 'Formats the resultItem and adds it to the list of suggestions. + Dim index As Integer = resultItem.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture).IndexOf(prefixText.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture)) + Dim itemToAdd As String = "" + Dim isFound As Boolean = False + Dim isAdded As Boolean = False + ' Get the index where prfixt is at the beginning of resultItem. If not found then, index of word which begins with prefixText. + If InvariantLCase(autoTypeAheadSearch).equals("wordsstartingwithsearchstring") And Not index = 0 Then + ' Expression to find word which contains AutoTypeAheadWordSeparators followed by prefixText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex( AutoTypeAheadWordSeparators + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + If regex1.IsMatch(resultItem) Then + index = regex1.Match(resultItem).Index + isFound = True + End If + ' If the prefixText is found immediatly after white space then starting of the word is found so don not search any further + If not resultItem(index).ToString() = " " Then + ' Expression to find beginning of the word which contains AutoTypeAheadWordSeparators followed by prefixText + Dim regex As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\\S*" + AutoTypeAheadWordSeparators + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + If regex.IsMatch(resultItem) Then + index = regex.Match(resultItem).Index + isFound = True + End If + End If + End If + + ' If autoTypeAheadSearch value is wordsstartingwithsearchstring then, extract the substring only if the prefixText is found at the + ' beginning of the resultItem (index = 0) or a word in resultItem is found starts with prefixText. + If index = 0 Or isFound Or InvariantLCase(autoTypeAheadSearch).Equals("anywhereinstring") then + If InvariantLCase(AutoTypeAheadDisplayFoundText).equals("atbeginningofmatchedstring") Then + ' Expression to find beginning of the word which contains prefixText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\\S*" + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + ' Find the beginning of the word which contains prefexText + If (StringUtils.InvariantLCase(autoTypeAheadSearch).Equals("anywhereinstring") AndAlso regex1.IsMatch(resultItem)) Then + index = regex1.Match(resultItem).Index + isFound = True + End If + ' Display string from the index till end of the string if sub string from index till end is less than columnLength value. + If Len(resultItem) - index <= columnLength Then + If index = 0 Then + itemToAdd = resultItem + Else + itemToAdd = "..." & resultItem.Substring(index, Len(resultItem) - index) + End If + Else + If index = 0 Then + itemToAdd = resultItem.Substring(index, (columnLength - 3)) & "..." + Else + 'Truncate the string to show only columnLength - 6 characters as begining and trailing "..." has to be appended. + itemToAdd = "..." & resultItem.Substring(index , columnLength - 6) & "..." + End If + End If + ElseIf InvariantLCase(AutoTypeAheadDisplayFoundText).equals("inmiddleofmatchedstring") Then + Dim subStringBeginIndex As Integer = CType(columnLength/2, Integer) + If Len(resultItem) <= columnLength Then + itemToAdd = resultItem + Else + ' Sanity check at end of the string + If index + Len(prefixText) = columnLength Then + itemToAdd = "..." & resultItem.Substring(index-columnLength,index) + ElseIf Len(resultItem) - index < subStringBeginIndex Then + ' Display string from the end till columnLength value if, index is closer to the end of the string. + itemToAdd = "..." & resultItem.Substring(Len(resultItem)-columnLength,Len(resultItem)) + ElseIf index <= subStringBeginIndex Then + ' Sanity chet at beginning of the string + itemToAdd = resultItem.Substring(0, columnLength) & "..." + Else + ' Display string containing text before the prefixText occures and text after the prefixText + itemToAdd = "..." & resultItem.Substring(index - subStringBeginIndex, columnLength) & "..." + End If + End If + ElseIf InvariantLCase(AutoTypeAheadDisplayFoundText).equals("atendofmatchedstring") Then + ' Expression to find ending of the word which contains prefexText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\s", System.Text.RegularExpressions.RegexOptions.IgnoreCase) + ' Find the ending of the word which contains prefexText + If regex1.IsMatch(resultItem, index + 1) Then + index = regex1.Match(resultItem, index + 1).Index + Else + ' If the word which contains prefexText is the last word in string, regex1.IsMatch returns false. + index = resultItem.Length + End If + If index > Len(resultItem) Then + index = Len(resultItem) + End If + ' If text from beginning of the string till index is less than columnLength value then, display string from the beginning till index. + If index <= columnLength Then + if index = Len(resultItem) Then 'Make decision to append "..." + itemToAdd = resultItem.Substring(0,index) + Else + itemToAdd = resultItem.Substring(0,index) & "..." + End If + Else + If index = Len(resultItem) Then + itemToAdd = "..." & resultItem.Substring(index - (columnLength - 3), (columnLength - 3)) + Else + 'Truncate the string to show only columnLength - 6 characters as begining and trailing "..." has to be appended. + itemToAdd = "..." & resultItem.Substring(index - (columnLength - 6), columnLength - 6) & "..." + End If + End If + End If + + ' Remove newline character from itemToAdd + Dim prefixTextIndex As Integer = itemToAdd.IndexOf(prefixText, StringComparison.CurrentCultureIgnoreCase) + ' If itemToAdd contains any newline after the search text then show text only till newline + Dim regex2 As System.Text.RegularExpressions.Regex = New System.Text.RegularExpressions.Regex("(" & vbCrLf & "|" & vbLf & ")", System.Text.RegularExpressions.RegexOptions.IgnoreCase) + Dim newLineIndexAfterPrefix As Integer = -1 + If regex2.IsMatch(itemToAdd, prefixTextIndex) Then + newLineIndexAfterPrefix = regex2.Match(itemToAdd, prefixTextIndex).Index + End If + If (newLineIndexAfterPrefix > -1) Then + If itemToAdd.EndsWith("...") Then + itemToAdd = (itemToAdd.Substring(0, newLineIndexAfterPrefix) + "...") + Else + itemToAdd = itemToAdd.Substring(0, newLineIndexAfterPrefix) + End If + End If + ' If itemToAdd contains any newline before search text then show text which comes after newline + Dim regex3 As System.Text.RegularExpressions.Regex = New System.Text.RegularExpressions.Regex("(" & vbCrLf & "|" & vbLf & ")", (System.Text.RegularExpressions.RegexOptions.IgnoreCase Or System.Text.RegularExpressions.RegexOptions.RightToLeft)) + Dim newLineIndexBeforePrefix As Integer = -1 + If regex3.IsMatch(itemToAdd, prefixTextIndex) Then + newLineIndexBeforePrefix = regex3.Match(itemToAdd, prefixTextIndex).Index + End If + If (newLineIndexBeforePrefix > -1) Then + If itemToAdd.StartsWith("...") Then + itemToAdd = ("..." + itemToAdd.Substring((newLineIndexBeforePrefix + regex3.Match(itemToAdd, prefixTextIndex).Length))) + Else + itemToAdd = itemToAdd.Substring((newLineIndexBeforePrefix + regex3.Match(itemToAdd, prefixTextIndex).Length)) + End If + End If + + If Not itemToAdd is nothing AndAlso Not resultList.Contains(itemToAdd) Then + + resultList.Add(itemToAdd) + + isAdded = true + End If + End If + Return isAdded + End Function + + + Protected Overridable Sub GetPageSize() + + If Me.PersonalSalaryPagination.PageSize.Text.Trim <> "" Then + Try + 'Me.PageSize = Integer.Parse(Me.PersonalSalaryPagination.PageSize.Text) + Catch ex As Exception + End Try + End If + End Sub + + Protected Overridable Sub AddNewRecords() + + Dim newRecordList As ArrayList = New ArrayList() + + Dim newUIDataList As System.Collections.Generic.List(Of Hashtable) = New System.Collections.Generic.List(Of Hashtable)() + + ' Loop though all the record controls and if the record control + ' does not have a unique record id set, then create a record + ' and add to the list. + If Not Me.ResetData Then + Dim rep As System.Web.UI.WebControls.Repeater = CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalSalaryTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return + + Dim repItem As System.Web.UI.WebControls.RepeaterItem + For Each repItem In rep.Items + ' Loop through all rows in the table, set its DataSource and call DataBind(). + + Dim recControl As PersonalSalaryTableControlRow = DirectCast(repItem.FindControl("PersonalSalaryTableControlRow"), PersonalSalaryTableControlRow) + + If recControl.Visible AndAlso recControl.IsNewRecord() Then + + Dim rec As PersonalSalaryRecord = New PersonalSalaryRecord() + + If recControl.CommandDate2.Text <> "" Then + rec.Parse(recControl.CommandDate2.Text, PersonalSalaryTable.CommandDate) + End If + If recControl.PositionSalary.Text <> "" Then + rec.Parse(recControl.PositionSalary.Text, PersonalSalaryTable.PositionSalary) + End If + If recControl.SalaryAmout.Text <> "" Then + rec.Parse(recControl.SalaryAmout.Text, PersonalSalaryTable.SalaryAmout) + End If + If recControl.SalaryCommand.Text <> "" Then + rec.Parse(recControl.SalaryCommand.Text, PersonalSalaryTable.SalaryCommand) + End If + If recControl.SalaryDate.Text <> "" Then + rec.Parse(recControl.SalaryDate.Text, PersonalSalaryTable.SalaryDate) + End If + If recControl.SalaryPlus.Text <> "" Then + rec.Parse(recControl.SalaryPlus.Text, PersonalSalaryTable.SalaryPlus) + End If + If recControl.SalaryRank.Text <> "" Then + rec.Parse(recControl.SalaryRank.Text, PersonalSalaryTable.SalaryRank) + End If + If recControl.SalaryStep.Text <> "" Then + rec.Parse(recControl.SalaryStep.Text, PersonalSalaryTable.SalaryStep) + End If + If recControl.SalaryYear.Text <> "" Then + rec.Parse(recControl.SalaryYear.Text, PersonalSalaryTable.SalaryYear) + End If + newUIDataList.Add(recControl.PreservedUIData()) + newRecordList.Add(rec) + End If + Next + End If + + + ' Add any new record to the list. + Dim index As Integer = 0 + For index = 1 To Me.AddNewRecord + + newRecordList.Insert(0, New PersonalSalaryRecord()) + newUIDataList.Insert(0, New Hashtable()) + + Next + Me.AddNewRecord = 0 + + ' Finally, add any new records to the DataSource. + If newRecordList.Count > 0 Then + + Dim finalList As ArrayList = New ArrayList(Me.DataSource) + finalList.InsertRange(0, newRecordList) + + Me.DataSource = DirectCast(finalList.ToArray(GetType(PersonalSalaryRecord)), PersonalSalaryRecord()) + + End If + + ' Add the existing UI data to this hash table + If newUIDataList.Count > 0 Then + Me.UIData.InsertRange(0, newUIDataList) + End If + + End Sub + + + Public Sub AddToDeletedRecordIds(ByVal rec As PersonalSalaryTableControlRow) + If rec.IsNewRecord() Then + Return + End If + + If Not Me.DeletedRecordIds Is Nothing AndAlso Me.DeletedRecordIds.Trim <> "" Then + Me.DeletedRecordIds &= "," + End If + + Me.DeletedRecordIds &= "[" & rec.RecordUniqueId & "]" + End Sub + + Protected Overridable Function InDeletedRecordIds(ByVal rec As PersonalSalaryTableControlRow) As Boolean + If Me.DeletedRecordIds Is Nothing OrElse Me.DeletedRecordIds.Trim = "" Then + Return False + End If + + Return Me.DeletedRecordIds.IndexOf("[" & rec.RecordUniqueId & "]") >= 0 + End Function + + Private _DeletedRecordIds As String + Public Property DeletedRecordIds() As String + Get + Return Me._DeletedRecordIds + End Get + Set(ByVal value As String) + Me._DeletedRecordIds = value + End Set + End Property + + + ' Create Set, WhereClause, and Populate Methods + + Public Overridable Sub SetCommandDateLabel2() + + End Sub + + Public Overridable Sub SetPersonalSalaryTableControlCollapsibleRegion() + + End Sub + + Public Overridable Sub SetPositionSalaryLabel() + + End Sub + + Public Overridable Sub SetSalaryAmoutLabel() + + End Sub + + Public Overridable Sub SetSalaryCommandLabel() + + End Sub + + Public Overridable Sub SetSalaryDateLabel1() + + End Sub + + Public Overridable Sub SetSalaryPlusLabel() + + End Sub + + Public Overridable Sub SetSalaryRankLabel1() + + End Sub + + Public Overridable Sub SetSalaryStepLabel() + + End Sub + + Public Overridable Sub SetSalaryYearLabel() + + 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. + Dim added As Boolean = Me.AddNewRecord > 0 + Me.LoadData() + Me.DataBind() + + If added Then + Me.SetFocusToAddedRow() + End If + + End If + + + + Catch ex As Exception + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + Finally + DbUtils.EndTransaction + End Try + End Sub + + 'this function sets focus to the first editable element in the new added row in the editable table + Protected Overridable Sub SetFocusToAddedRow() + Dim rep As System.Web.UI.WebControls.Repeater = CType(Me.FindControl("PersonalSalaryTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing OrElse rep.Items.Count = 0 Then Return + Dim repItem As System.Web.UI.WebControls.RepeaterItem + For Each repItem In rep.Items + 'Load scripts to table rows + Me.Page.LoadFocusScripts(repItem) + Dim recControl As PersonalSalaryTableControlRow = DirectCast(repItem.FindControl("PersonalSalaryTableControlRow"), PersonalSalaryTableControlRow) + If recControl.IsNewRecord Then + For Each field As Control In recControl.Controls + If field.Visible AndAlso Me.Page.IsControlEditable(field, False) Then + 'set focus on the first editable field in the new row + field.Focus() + Dim updPan As UpdatePanel = DirectCast(Me.Page.FindControlRecursively("UpdatePanel1"), UpdatePanel) + If Not updPan Is Nothing Then updPan.Update() + Return + End If + Next + Return + End If + Next + End Sub + + + Protected Overrides Sub SaveControlsToSession() + MyBase.SaveControlsToSession() + + ' Save filter controls to values to session. + + + 'Save pagination state to session. + + + + ' Save table control properties to the session. + If Not Me.CurrentSortOrder Is Nothing Then + Me.SaveToSession(Me, "Order_By", Me.CurrentSortOrder.ToXmlString()) + End If + + Me.SaveToSession(Me, "Page_Index", Me.PageIndex.ToString()) + Me.SaveToSession(Me, "Page_Size", Me.PageSize.ToString()) + + Me.SaveToSession(Me, "DeletedRecordIds", Me.DeletedRecordIds) + + End Sub + + Protected Sub SaveControlsToSession_Ajax() + ' Save filter controls to values to session. + + HttpContext.Current.Session("AppRelativeVirtualPath") = Me.Page.AppRelativeVirtualPath + + End Sub + + Protected Overrides Sub ClearControlsFromSession() + MyBase.ClearControlsFromSession() + + ' Clear filter controls values from the session. + + + ' Clear pagination state from session. + + + + ' Clear table properties from the session. + Me.RemoveFromSession(Me, "Order_By") + Me.RemoveFromSession(Me, "Page_Index") + Me.RemoveFromSession(Me, "Page_Size") + + Me.RemoveFromSession(Me, "DeletedRecordIds") + + End Sub + + Protected Overrides Sub LoadViewState(ByVal savedState As Object) + MyBase.LoadViewState(savedState) + + Dim orderByStr As String = CType(ViewState("PersonalSalaryTableControl_OrderBy"), String) + + If orderByStr IsNot Nothing AndAlso orderByStr.Trim <> "" Then + Me.CurrentSortOrder = BaseClasses.Data.OrderBy.FromXmlString(orderByStr) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + End If + + Dim pageIndex As String = CType(ViewState("Page_Index"), String) + If pageIndex IsNot Nothing Then + Me.PageIndex = CInt(pageIndex) + End If + + Dim pageSize As String = CType(ViewState("Page_Size"), String) + If Not pageSize Is Nothing Then + Me.PageSize = CInt(pageSize) + End If + + + + ' Load view state for pagination control. + + Me.DeletedRecordIds = CType(Me.ViewState("DeletedRecordIds"), String) + + End Sub + + Protected Overrides Function SaveViewState() As Object + + If Me.CurrentSortOrder IsNot Nothing Then + Me.ViewState("PersonalSalaryTableControl_OrderBy") = Me.CurrentSortOrder.ToXmlString() + End If + + Me.ViewState("Page_Index") = Me.PageIndex + Me.ViewState("Page_Size") = Me.PageSize + + Me.ViewState("DeletedRecordIds") = Me.DeletedRecordIds + + + ' Load view state for pagination control. + + + Return MyBase.SaveViewState() + End Function + + ' Generate the event handling functions for pagination events. + + ' event handler for ImageButton + Public Overridable Sub PersonalSalaryPagination_FirstPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.PageIndex = 0 + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalSalaryPagination_LastPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.DisplayLastPage = True + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalSalaryPagination_NextPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.PageIndex += 1 + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for LinkButton + Public Overridable Sub PersonalSalaryPagination_PageSizeButton_Click(ByVal sender As Object, ByVal args As EventArgs) + + Try + + Me.DataChanged = True + + Me.PageSize = Integer.Parse(Me.PersonalSalaryPagination.PageSize.Text) + + Me.PageIndex = Integer.Parse(Me.PersonalSalaryPagination.CurrentPage.Text) - 1 + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalSalaryPagination_PreviousPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + If Me.PageIndex > 0 Then + Me.PageIndex -= 1 + Me.DataChanged = True + End If + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + + ' Generate the event handling functions for sorting events. + + Public Overridable Sub CommandDateLabel2_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by CommandDate when clicked. + + ' Get previous sorting state for CommandDate. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalSalaryTable.CommandDate) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for CommandDate. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalSalaryTable.CommandDate, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by CommandDate, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub PositionSalaryLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by PositionSalary when clicked. + + ' Get previous sorting state for PositionSalary. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalSalaryTable.PositionSalary) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for PositionSalary. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalSalaryTable.PositionSalary, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by PositionSalary, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub SalaryAmoutLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by SalaryAmout when clicked. + + ' Get previous sorting state for SalaryAmout. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalSalaryTable.SalaryAmout) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for SalaryAmout. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalSalaryTable.SalaryAmout, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by SalaryAmout, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub SalaryCommandLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by SalaryCommand when clicked. + + ' Get previous sorting state for SalaryCommand. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalSalaryTable.SalaryCommand) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for SalaryCommand. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalSalaryTable.SalaryCommand, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by SalaryCommand, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub SalaryDateLabel1_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by SalaryDate when clicked. + + ' Get previous sorting state for SalaryDate. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalSalaryTable.SalaryDate) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for SalaryDate. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalSalaryTable.SalaryDate, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by SalaryDate, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub SalaryPlusLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by SalaryPlus when clicked. + + ' Get previous sorting state for SalaryPlus. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalSalaryTable.SalaryPlus) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for SalaryPlus. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalSalaryTable.SalaryPlus, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by SalaryPlus, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub SalaryRankLabel1_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by SalaryRank when clicked. + + ' Get previous sorting state for SalaryRank. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalSalaryTable.SalaryRank) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for SalaryRank. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalSalaryTable.SalaryRank, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by SalaryRank, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub SalaryStepLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by SalaryStep when clicked. + + ' Get previous sorting state for SalaryStep. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalSalaryTable.SalaryStep) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for SalaryStep. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalSalaryTable.SalaryStep, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by SalaryStep, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub SalaryYearLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by SalaryYear when clicked. + + ' Get previous sorting state for SalaryYear. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalSalaryTable.SalaryYear) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for SalaryYear. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalSalaryTable.SalaryYear, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by SalaryYear, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + + ' Generate the event handling functions for button events. + + ' event handler for ImageButton + Public Overridable Sub PersonalSalaryAddButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + Me.AddNewRecord = 1 + Me.DataChanged = True + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalSalaryDeleteButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + If(Not Me.Page.IsPageRefresh) Then + + Me.DeleteSelectedRecords(True) + Me.SetFormulaControls() + + + End If + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalSalaryEditButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + ' The redirect URL is set on the Properties, Custom Properties or Actions. + ' The ModifyRedirectURL call resolves the parameters before the + ' Response.Redirect redirects the page to the URL. + ' Any code after the Response.Redirect call will not be executed, since the page is + ' redirected to the URL. + + + Dim url As String = "../Shared/ConfigureEditRecord.aspx" + + Dim shouldRedirect As Boolean = True + Dim TargetKey As String = Nothing + Dim DFKA As String = TargetKey + Dim id As String = DFKA + Dim value As String = id + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + url = Me.ModifyRedirectUrl(url, "",False) + url = Me.Page.ModifyRedirectUrl(url, "",False) + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + shouldRedirect = False + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + If shouldRedirect Then + Me.Page.ShouldSaveControlsToSession = True + Me.Page.Response.Redirect(url) + ElseIf Not TargetKey Is Nothing AndAlso _ + Not shouldRedirect Then + Me.Page.ShouldSaveControlsToSession = True + Me.Page.CloseWindow(True) + + End If + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalSalaryResetButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.CurrentSortOrder.Reset() + If Me.InSession(Me, "Order_By") Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + Me.CurrentSortOrder.Add(PersonalSalaryTable.SalaryDate, OrderByItem.OrderDir.Asc) + + Me.CurrentSortOrder.Add(PersonalSalaryTable.CommandDate, OrderByItem.OrderDir.Asc) + + + End If + + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + + + ' Generate the event handling functions for filter and search events. + + + ' Generate the event handling functions for others + + + Private _UIData As New System.Collections.Generic.List(Of Hashtable) + Public Property UIData() As System.Collections.Generic.List(Of Hashtable) + Get + Return Me._UIData + End Get + Set(ByVal value As System.Collections.Generic.List(Of Hashtable)) + Me._UIData = value + End Set + End Property + + ' pagination properties + Protected _PageSize As Integer + Public Property PageSize() As Integer + Get + Return Me._PageSize + End Get + Set(ByVal value As Integer) + Me._PageSize = value + End Set + End Property + + Protected _PageIndex As Integer + Public Property PageIndex() As Integer + Get + ' Return the PageIndex + Return Me._PageIndex + End Get + Set(ByVal value As Integer) + Me._PageIndex = value + End Set + End Property + + Protected _TotalRecords As Integer = -1 + Public Property TotalRecords() As Integer + Get + If _TotalRecords < 0 + _TotalRecords = PersonalSalaryTable.GetRecordCount(CreateCompoundJoinFilter(), CreateWhereClause()) + End If + Return Me._TotalRecords + End Get + Set(ByVal value As Integer) + If Me.PageSize > 0 Then + + Me.TotalPages = CInt(Math.Ceiling(value / Me.PageSize)) + + End If + Me._TotalRecords = value + End Set + End Property + + + + Protected _TotalPages As Integer = -1 + Public Property TotalPages() As Integer + Get + If _TotalPages < 0 Then + + Me.TotalPages = CInt(Math.Ceiling(TotalRecords / Me.PageSize)) + + End If + Return Me._TotalPages + End Get + Set(ByVal value As Integer) + Me._TotalPages = value + End Set + End Property + + Protected _DisplayLastPage As Boolean + Public Property DisplayLastPage() As Boolean + Get + Return Me._DisplayLastPage + End Get + Set(ByVal value As Boolean) + Me._DisplayLastPage = value + End Set + End Property + + Private _DataChanged As Boolean = False + Public Property DataChanged() As Boolean + Get + Return Me._DataChanged + End Get + Set(ByVal value As Boolean) + Me._DataChanged = value + End Set + End Property + + Private _ResetData As Boolean = False + Public Property ResetData() As Boolean + Get + Return Me._ResetData + End Get + Set(ByVal value As Boolean) + Me._ResetData = value + End Set + End Property + + Private _AddNewRecord As Integer = 0 + Public Property AddNewRecord() As Integer + Get + Return Me._AddNewRecord + End Get + Set(ByVal value As Integer) + Me._AddNewRecord = value + End Set + End Property + + + Private _CurrentSortOrder As OrderBy = Nothing + Public Property CurrentSortOrder() As OrderBy + Get + Return Me._CurrentSortOrder + End Get + Set(ByVal value As BaseClasses.Data.OrderBy) + Me._CurrentSortOrder = value + End Set + End Property + + Private _DataSource() As PersonalSalaryRecord = Nothing + Public Property DataSource() As PersonalSalaryRecord () + Get + Return Me._DataSource + End Get + Set(ByVal value() As PersonalSalaryRecord) + Me._DataSource = value + End Set + End Property + +#Region "Helper Properties" + + Public ReadOnly Property CommandDateLabel2() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "CommandDateLabel2"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property PersonalSalaryAddButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalSalaryAddButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalSalaryDeleteButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalSalaryDeleteButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalSalaryEditButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalSalaryEditButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalSalaryPagination() As Persons.UI.IPagination + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalSalaryPagination"), Persons.UI.IPagination) + End Get + End Property + + Public ReadOnly Property PersonalSalaryResetButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalSalaryResetButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalSalaryTableControlCollapsibleRegion() As System.Web.UI.WebControls.Panel + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalSalaryTableControlCollapsibleRegion"), System.Web.UI.WebControls.Panel) + End Get + End Property + + Public ReadOnly Property PersonalSalaryToggleAll() As System.Web.UI.WebControls.CheckBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalSalaryToggleAll"), System.Web.UI.WebControls.CheckBox) + End Get + End Property + + Public ReadOnly Property PositionSalaryLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PositionSalaryLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property SalaryAmoutLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "SalaryAmoutLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property SalaryCommandLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "SalaryCommandLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property SalaryDateLabel1() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "SalaryDateLabel1"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property SalaryPlusLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "SalaryPlusLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property SalaryRankLabel1() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "SalaryRankLabel1"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property SalaryStepLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "SalaryStepLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property SalaryYearLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "SalaryYearLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + +#End Region + +#Region "Helper Functions" + + Public Overrides Overloads Function ModifyRedirectUrl(url As String, arg As String, ByVal bEncrypt As Boolean) As String + Return Me.Page.EvaluateExpressions(url, arg, bEncrypt, Me) + End Function + + Public Overrides Overloads Function EvaluateExpressions(url As String, arg As String, ByVal bEncrypt As Boolean) As String + Dim needToProcess As Boolean = AreAnyUrlParametersForMe(url, arg) + If (needToProcess) Then + Dim recCtl As PersonalSalaryTableControlRow = Me.GetSelectedRecordControl() + If recCtl Is Nothing AndAlso url.IndexOf("{") >= 0 Then + ' Localization. + Throw New Exception(Page.GetResourceValue("Err:NoRecSelected", "Persons")) + End If + Dim rec As PersonalSalaryRecord = Nothing + If recCtl IsNot Nothing Then + rec = recCtl.GetRecord() + End If + Return EvaluateExpressions(url, arg, rec, bEncrypt) + End If + Return url + End Function + + Public Overridable Function GetSelectedRecordIndex() As Integer + Dim counter As Integer = 0 + Dim recControl As PersonalSalaryTableControlRow + For Each recControl In Me.GetRecordControls() + If recControl.PersonalSalaryRecordRowSelection.Checked Then + Return counter + End If + counter += 1 + Next + Return -1 + End Function + + Public Overridable Function GetSelectedRecordControl() As PersonalSalaryTableControlRow + Dim selectedList() As PersonalSalaryTableControlRow = Me.GetSelectedRecordControls() + If selectedList.Length = 0 Then + Return Nothing + End If + Return selectedList(0) + + End Function + + Public Overridable Function GetSelectedRecordControls() As PersonalSalaryTableControlRow() + + Dim selectedList As ArrayList = New ArrayList(25) + Dim recControl As PersonalSalaryTableControlRow + For Each recControl In Me.GetRecordControls() + If recControl.PersonalSalaryRecordRowSelection IsNot Nothing AndAlso recControl.PersonalSalaryRecordRowSelection.Checked Then + selectedList.Add(recControl) + End If + Next + Return DirectCast(selectedList.ToArray(GetType(PersonalSalaryTableControlRow)), PersonalSalaryTableControlRow()) + + End Function + + Public Overridable Sub DeleteSelectedRecords(ByVal deferDeletion As Boolean) + Dim recList() As PersonalSalaryTableControlRow = Me.GetSelectedRecordControls() + If recList.Length = 0 Then + ' Localization. + Throw New Exception(Page.GetResourceValue("Err:NoRecSelected", "Persons")) + End If + + Dim recCtl As PersonalSalaryTableControlRow + For Each recCtl In recList + If deferDeletion Then + If Not recCtl.IsNewRecord Then + + Me.AddToDeletedRecordIds(recCtl) + + End If + recCtl.Visible = False + + recCtl.PersonalSalaryRecordRowSelection.Checked = False + + Else + + recCtl.Delete() + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + End If + Next + End Sub + + Public Function GetRecordControls() As PersonalSalaryTableControlRow() + Dim recList As ArrayList = New ArrayList() + Dim rep As System.Web.UI.WebControls.Repeater = CType(Me.FindControl("PersonalSalaryTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return Nothing + Dim repItem As System.Web.UI.WebControls.RepeaterItem + + For Each repItem In rep.Items + + Dim recControl As PersonalSalaryTableControlRow = DirectCast(repItem.FindControl("PersonalSalaryTableControlRow"), PersonalSalaryTableControlRow) + recList.Add(recControl) + + Next + + Return DirectCast(recList.ToArray(GetType(PersonalSalaryTableControlRow)), PersonalSalaryTableControlRow()) + End Function + + Public Shadows ReadOnly Property Page() As BaseApplicationPage + Get + Return DirectCast(MyBase.Page, BaseApplicationPage) + End Get + End Property + +#End Region + + + +End Class + + +' Base class for the PersonalSpecialSkillTableControlRow control on the EditPersonalId page. +' Do not modify this class. Instead override any method in PersonalSpecialSkillTableControlRow. +Public Class BasePersonalSpecialSkillTableControlRow + Inherits Persons.UI.BaseApplicationRecordControl + + ' To customize, override this method in PersonalSpecialSkillTableControlRow. + Protected Overridable Sub Control_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Init + + Me.ClearControlsFromSession() + End Sub + + ' To customize, override this method in PersonalSpecialSkillTableControlRow. + Protected Overridable Sub Control_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load + + 'Call LoadFocusScripts from repeater so that onfocus attribute could be added to elements + Me.Page.LoadFocusScripts(Me) + + ' Show confirmation message on Click + Me.PersonalSpecialSkillRowDeleteButton.Attributes.Add("onClick", "return (confirm('" & (CType(Me.Page,BaseApplicationPage)).GetResourceValue("DeleteRecordConfirm", "Persons") & "'));") + + + ' Register the event handlers. + + AddHandler Me.PersonalSpecialSkillRowDeleteButton.Click, AddressOf PersonalSpecialSkillRowDeleteButton_Click + + AddHandler Me.PersonalSpecialSkillRowEditButton.Click, AddressOf PersonalSpecialSkillRowEditButton_Click + + AddHandler Me.PersonalSpecialSkillRowViewButton.Click, AddressOf PersonalSpecialSkillRowViewButton_Click + + AddHandler Me.Level1.TextChanged, AddressOf Level1_TextChanged + + AddHandler Me.Skill.TextChanged, AddressOf Skill_TextChanged + + + End Sub + + + Public Overridable Sub LoadData() + + ' Load the data from the database into the DataSource PersonalSpecialSkill 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 = PersonalSpecialSkillTable.GetRecord(Me.RecordUniqueId, True) + + Return + End If + + ' Since this is a row in the table, the data for this row is loaded by the + ' LoadData method of the BasePersonalSpecialSkillTableControl when the data for the entire + ' table is loaded. + + Me.DataSource = New PersonalSpecialSkillRecord() + + + + End Sub + + ' Populate the UI controls using the DataSource. To customize, override this method in PersonalSpecialSkillTableControlRow. + 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 + + SetLevel1() + + + + + SetSkill() + + + 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 SetLevel1() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.Level1.ID) Then + + Me.Level1.Text = Me.PreviousUIData(Me.Level1.ID).ToString() + + Return + End If + + + ' Set the Level TextBox on the webpage with value from the + ' PersonalSpecialSkill database record. + + ' Me.DataSource is the PersonalSpecialSkill record retrieved from the database. + ' Me.Level1 is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetLevel1() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.LevelSpecified Then + + ' If the Level is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalSpecialSkillTable.Level) + + Me.Level1.Text = formattedValue + + Else + + ' Level is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.Level1.Text = PersonalSpecialSkillTable.Level.Format(PersonalSpecialSkillTable.Level.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetSkill() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.Skill.ID) Then + + Me.Skill.Text = Me.PreviousUIData(Me.Skill.ID).ToString() + + Return + End If + + + ' Set the Skill TextBox on the webpage with value from the + ' PersonalSpecialSkill database record. + + ' Me.DataSource is the PersonalSpecialSkill record retrieved from the database. + ' Me.Skill is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetSkill() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.SkillSpecified Then + + ' If the Skill is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalSpecialSkillTable.Skill) + + Me.Skill.Text = formattedValue + + Else + + ' Skill is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.Skill.Text = PersonalSpecialSkillTable.Skill.Format(PersonalSpecialSkillTable.Skill.DefaultValue) + + End If + + End Sub + + + Public EvaluateFormulaDelegate As BaseClasses.Data.DataSource.EvaluateFormulaDelegate = New BaseClasses.Data.DataSource.EvaluateFormulaDelegate(AddressOf Me.EvaluateFormula) + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean, ByVal e As FormulaEvaluator) As String + If e Is Nothing Then + e = New FormulaEvaluator() + End If + + e.Variables.Clear() + + + ' add variables for formula evaluation + If variables IsNot Nothing Then + Dim enumerator As System.Collections.Generic.IEnumerator(Of System.Collections.Generic.KeyValuePair(Of String, Object)) = variables.GetEnumerator() + While enumerator.MoveNext() + e.Variables.Add(enumerator.Current.Key, enumerator.Current.Value) + End While + End If + + If includeDS + + End IF + + + ' Other variables referred to in the formula are expected to be + ' properties of the DataSource. For example, referring to + ' UnitPrice as a variable will refer to DataSource.UnitPrice + If dataSourceForEvaluate Is Nothing Then + + e.DataSource = Me.DataSource + + Else + e.DataSource = dataSourceForEvaluate + End If + + ' Define the calling control. This is used to add other + ' related table and record controls as variables. + e.CallingControl = Me + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + + If Not String.IsNullOrEmpty(format) AndAlso (String.IsNullOrEmpty(formula) OrElse formula.IndexOf("Format(") < 0) Then + Return FormulaUtils.Format(resultObj, format) + Else + Return resultObj.ToString() + End If + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format,variables ,includeDS, Nothing) + End Function + + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object)) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format, variables ,True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, format, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal e as FormulaEvaluator) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, variables, True, e) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal includeDS as Boolean) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, includeDS, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, True, Nothing) + End Function + + + Public Overridable Sub RegisterPostback() + + + End Sub + + + + ' To customize, override this method in PersonalSpecialSkillTableControlRow. + 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 parentCtrl As PersonalIdRecordControl + + + parentCtrl = DirectCast(Me.Page.FindControlRecursively("PersonalIdRecordControl"), PersonalIdRecordControl) + + If (Not IsNothing(parentCtrl) AndAlso IsNothing(parentCtrl.DataSource)) + ' Load the record if it is not loaded yet. + parentCtrl.LoadData() + End If + If (IsNothing(parentCtrl) OrElse IsNothing(parentCtrl.DataSource)) + ' Get the error message from the application resource file. + Throw New Exception(Page.GetResourceValue("Err:NoParentRecId", "Persons")) + End If + + Me.DataSource.PersonalId = parentCtrl.DataSource.PersonalId + + ' 2. Perform any custom validation. + Me.Validate() + + + ' 3. Set the values in the record with data from UI controls. + ' This calls the Get() method for each of the user interface controls. + Me.GetUIData() + + ' 4. Save in the database. + ' We should not save the record if the data did not change. This + ' will save a database hit and avoid triggering any database triggers. + + If Me.DataSource.IsAnyValueChanged Then + ' Save record to database but do not commit yet. + ' Auto generated ids are available after saving for use by child (dependent) records. + Me.DataSource.Save() + + DirectCast(GetParentControlObject(Me, "PersonalSpecialSkillTableControl"), PersonalSpecialSkillTableControl).DataChanged = True + DirectCast(GetParentControlObject(Me, "PersonalSpecialSkillTableControl"), PersonalSpecialSkillTableControl).ResetData = True + End If + + + ' update session or cookie by formula + + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + ' For Master-Detail relationships, save data on the Detail table(s) + + End Sub + + ' To customize, override this method in PersonalSpecialSkillTableControlRow. + 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. + + GetLevel1() + GetSkill() + End Sub + + + Public Overridable Sub GetLevel1() + + ' Retrieve the value entered by the user on the Level ASP:TextBox, and + ' save it into the Level field in DataSource PersonalSpecialSkill record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.Level1.Text, PersonalSpecialSkillTable.Level) + + + End Sub + + Public Overridable Sub GetSkill() + + ' Retrieve the value entered by the user on the Skill ASP:TextBox, and + ' save it into the Skill field in DataSource PersonalSpecialSkill record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.Skill.Text, PersonalSpecialSkillTable.Skill) + + + End Sub + + + ' To customize, override this method in PersonalSpecialSkillTableControlRow. + + Public Overridable Function CreateWhereClause() As WhereClause + + Return Nothing + + End Function + + + + ' To customize, override this method in PersonalSpecialSkillTableControlRow. + 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) + PersonalSpecialSkillTable.DeleteRecord(pkValue) + + DirectCast(GetParentControlObject(Me, "PersonalSpecialSkillTableControl"), PersonalSpecialSkillTableControl).DataChanged = True + DirectCast(GetParentControlObject(Me, "PersonalSpecialSkillTableControl"), PersonalSpecialSkillTableControl).ResetData = True + End Sub + + Protected Overridable Sub Control_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.PreRender + ' PreRender event is raised just before page is being displayed. + Try + DbUtils.StartTransaction() + Me.RegisterPostback() + + If Not Me.Page.ErrorOnPage AndAlso (Me.Page.IsPageRefresh OrElse Me.DataChanged OrElse Me.ResetData) Then + + + ' Re-load the data and update the web page if necessary. + ' This is typically done during a postback (filter, search button, sort, pagination button). + ' In each of the other click handlers, simply set DataChanged to True to reload the data. + Me.LoadData() + Me.DataBind() + End If + + + Catch ex As Exception + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + Finally + DbUtils.EndTransaction() + End Try + End Sub + + + Protected Overrides Sub SaveControlsToSession() + MyBase.SaveControlsToSession() + + + 'Save pagination state to session. + + End Sub + + + + Protected Overrides Sub ClearControlsFromSession() + MyBase.ClearControlsFromSession() + + + + ' Clear pagination state from session. + + End Sub + + Protected Overrides Sub LoadViewState(ByVal savedState As Object) + MyBase.LoadViewState(savedState) + Dim isNewRecord As String = CType(ViewState("IsNewRecord"), String) + If Not isNewRecord Is Nothing AndAlso isNewRecord.Trim <> "" Then + Me.IsNewRecord = Boolean.Parse(isNewRecord) + End If + + Dim myCheckSum As String = CType(ViewState("CheckSum"), String) + If Not myCheckSum Is Nothing AndAlso myCheckSum.Trim <> "" Then + Me.CheckSum = myCheckSum + End If + + + ' Load view state for pagination control. + + End Sub + + Protected Overrides Function SaveViewState() As Object + ViewState("IsNewRecord") = Me.IsNewRecord.ToString() + ViewState("CheckSum") = Me.CheckSum + + + ' Load view state for pagination control. + + Return MyBase.SaveViewState() + End Function + + + ' event handler for ImageButton + Public Overridable Sub PersonalSpecialSkillRowDeleteButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + If(Not Me.Page.IsPageRefresh) Then + + Dim tc As PersonalSpecialSkillTableControl = DirectCast(GetParentControlObject(Me, "PersonalSpecialSkillTableControl"), PersonalSpecialSkillTableControl) + If Not (IsNothing(tc)) Then + If Not Me.IsNewRecord Then + tc.AddToDeletedRecordIds(DirectCast(Me, PersonalSpecialSkillTableControlRow)) + End If + Me.Visible = False + tc.SetFormulaControls() + End If + + End If + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalSpecialSkillRowEditButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + ' The redirect URL is set on the Properties, Custom Properties or Actions. + ' The ModifyRedirectURL call resolves the parameters before the + ' Response.Redirect redirects the page to the URL. + ' Any code after the Response.Redirect call will not be executed, since the page is + ' redirected to the URL. + + + Dim url As String = "../Shared/ConfigureEditRecord.aspx" + + Dim shouldRedirect As Boolean = True + Dim TargetKey As String = Nothing + Dim DFKA As String = TargetKey + Dim id As String = DFKA + Dim value As String = id + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + url = Me.ModifyRedirectUrl(url, "",False) + url = Me.Page.ModifyRedirectUrl(url, "",False) + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + shouldRedirect = False + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + If shouldRedirect Then + Me.Page.ShouldSaveControlsToSession = True + Me.Page.Response.Redirect(url) + ElseIf Not TargetKey Is Nothing AndAlso _ + Not shouldRedirect Then + Me.Page.ShouldSaveControlsToSession = True + Me.Page.CloseWindow(True) + + End If + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalSpecialSkillRowViewButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + ' The redirect URL is set on the Properties, Custom Properties or Actions. + ' The ModifyRedirectURL call resolves the parameters before the + ' Response.Redirect redirects the page to the URL. + ' Any code after the Response.Redirect call will not be executed, since the page is + ' redirected to the URL. + + + Dim url As String = "../Shared/ConfigureViewRecord.aspx" + + Dim shouldRedirect As Boolean = True + Dim TargetKey As String = Nothing + Dim DFKA As String = TargetKey + Dim id As String = DFKA + Dim value As String = id + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + url = Me.ModifyRedirectUrl(url, "",False) + url = Me.Page.ModifyRedirectUrl(url, "",False) + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + shouldRedirect = False + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + If shouldRedirect Then + Me.Page.ShouldSaveControlsToSession = True + Me.Page.Response.Redirect(url) + ElseIf Not TargetKey Is Nothing AndAlso _ + Not shouldRedirect Then + Me.Page.ShouldSaveControlsToSession = True + Me.Page.CloseWindow(True) + + End If + End Sub + + Protected Overridable Sub Level1_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub Skill_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("BasePersonalSpecialSkillTableControlRow_Rec"), String) + End Get + Set(ByVal value As String) + Me.ViewState("BasePersonalSpecialSkillTableControlRow_Rec") = value + End Set + End Property + + Private _DataSource As PersonalSpecialSkillRecord + Public Property DataSource() As PersonalSpecialSkillRecord + Get + Return Me._DataSource + End Get + + Set(ByVal value As PersonalSpecialSkillRecord) + + Me._DataSource = value + End Set + End Property + + + + Private _checkSum As String + Public Overridable Property CheckSum() As String + Get + Return Me._checkSum + End Get + Set(ByVal value As String) + Me._checkSum = value + End Set + End Property + + Private _TotalPages As Integer + Public Property TotalPages() As Integer + Get + Return Me._TotalPages + End Get + Set(ByVal value As Integer) + Me._TotalPages = value + End Set + End Property + + Private _PageIndex As Integer + Public Property PageIndex() As Integer + Get + ' Return the PageIndex + Return Me._PageIndex + End Get + Set(ByVal value As Integer) + Me._PageIndex = value + End Set + End Property + + Private _DisplayLastPage As Boolean + Public Property DisplayLastPage() As Boolean + Get + Return Me._DisplayLastPage + End Get + Set(ByVal value As Boolean) + Me._DisplayLastPage = value + End Set + End Property + + + +#Region "Helper Properties" + + Public ReadOnly Property Level1() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Level1"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property PersonalSpecialSkillRecordRowSelection() As System.Web.UI.WebControls.CheckBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalSpecialSkillRecordRowSelection"), System.Web.UI.WebControls.CheckBox) + End Get + End Property + + Public ReadOnly Property PersonalSpecialSkillRowDeleteButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalSpecialSkillRowDeleteButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalSpecialSkillRowEditButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalSpecialSkillRowEditButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalSpecialSkillRowViewButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalSpecialSkillRowViewButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property Skill() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Skill"), System.Web.UI.WebControls.TextBox) + 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 PersonalSpecialSkillRecord = 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 PersonalSpecialSkillRecord + If Not Me.DataSource Is Nothing Then + Return Me.DataSource + End If + + If Not Me.RecordUniqueId Is Nothing Then + + Return PersonalSpecialSkillTable.GetRecord(Me.RecordUniqueId, True) + + End If + + ' Localization. + + Return Nothing + + End Function + + Public Shadows ReadOnly Property Page() As BaseApplicationPage + Get + Return DirectCast(MyBase.Page, BaseApplicationPage) + End Get + End Property + +#End Region + +End Class + + + +' Base class for the PersonalSpecialSkillTableControl control on the EditPersonalId page. +' Do not modify this class. Instead override any method in PersonalSpecialSkillTableControl. +Public Class BasePersonalSpecialSkillTableControl + Inherits Persons.UI.BaseApplicationTableControl + + + + Protected Overridable Sub Control_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Init + + + + ' Setup the filter and search events. + + + + ' Control Initializations. + ' Initialize the table's current sort order. + + If Me.InSession(Me, "Order_By") Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + End If + + + + ' Setup default pagination settings. + + Me.PageSize = CInt(Me.GetFromSession(Me, "Page_Size", "10")) + Me.PageIndex = CInt(Me.GetFromSession(Me, "Page_Index", "0")) + + + + Me.ClearControlsFromSession() + End Sub + + Protected Overridable Sub Control_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load + + SaveControlsToSession_Ajax() + + ' Show confirmation message on Click + Me.PersonalSpecialSkillDeleteButton.Attributes.Add("onClick", "return (confirm('" & (CType(Me.Page,BaseApplicationPage)).GetResourceValue("DeleteConfirm", "Persons") & "'));") + + ' Setup the pagination events. + + AddHandler Me.PersonalSpecialSkillPagination.FirstPage.Click, AddressOf PersonalSpecialSkillPagination_FirstPage_Click + + AddHandler Me.PersonalSpecialSkillPagination.LastPage.Click, AddressOf PersonalSpecialSkillPagination_LastPage_Click + + AddHandler Me.PersonalSpecialSkillPagination.NextPage.Click, AddressOf PersonalSpecialSkillPagination_NextPage_Click + + AddHandler Me.PersonalSpecialSkillPagination.PageSizeButton.Click, AddressOf PersonalSpecialSkillPagination_PageSizeButton_Click + + AddHandler Me.PersonalSpecialSkillPagination.PreviousPage.Click, AddressOf PersonalSpecialSkillPagination_PreviousPage_Click + + + ' Setup the sorting events. + + AddHandler Me.LevelLabel3.Click, AddressOf LevelLabel3_Click + + AddHandler Me.SkillLabel1.Click, AddressOf SkillLabel1_Click + + ' Setup the button events. + + AddHandler Me.PersonalSpecialSkillAddButton.Click, AddressOf PersonalSpecialSkillAddButton_Click + + AddHandler Me.PersonalSpecialSkillDeleteButton.Click, AddressOf PersonalSpecialSkillDeleteButton_Click + + AddHandler Me.PersonalSpecialSkillEditButton.Click, AddressOf PersonalSpecialSkillEditButton_Click + + AddHandler Me.PersonalSpecialSkillResetButton.Click, AddressOf PersonalSpecialSkillResetButton_Click + + + ' Setup events for others + + End Sub + + + Public Overridable Sub LoadData() + + ' Read data from database. Returns an array of records that can be assigned + ' to the DataSource table control property. + Try + Dim joinFilter As CompoundFilter = CreateCompoundJoinFilter() + + ' The WHERE clause will be empty when displaying all records in table. + Dim wc As WhereClause = CreateWhereClause() + If wc IsNot Nothing AndAlso Not wc.RunQuery Then + ' Initialize an empty array of records + Dim alist As New ArrayList(0) + Me.DataSource = DirectCast(alist.ToArray(GetType(PersonalSpecialSkillRecord)), PersonalSpecialSkillRecord()) + ' Add records to the list if needed. + Me.AddNewRecords() + Me._TotalRecords = 0 + Me._TotalPages = 0 + Return + End If + + ' Call OrderBy to determine the order - either use the order defined + ' on the Query Wizard, or specified by user (by clicking on column heading) + Dim orderBy As OrderBy = CreateOrderBy() + + ' Get the pagesize from the pagesize control. + Me.GetPageSize() + + If Me.DisplayLastPage Then + Dim totalRecords As Integer = If(Me._TotalRecords < 0, PersonalSpecialSkillTable.GetRecordCount(CreateCompoundJoinFilter(), CreateWhereClause()), Me._TotalRecords) + + Dim totalPages As Integer = CInt(Math.Ceiling(totalRecords / Me.PageSize)) + + Me.PageIndex = totalPages - 1 + End If + + ' Make sure PageIndex (current page) and PageSize are within bounds. + If Me.PageIndex < 0 Then + Me.PageIndex = 0 + End If + If Me.PageSize < 1 Then + Me.PageSize = 1 + End If + + ' Retrieve the records and set the table DataSource. + ' Only PageSize records are fetched starting at PageIndex (zero based). + If Me.AddNewRecord > 0 Then + ' Make sure to preserve the previously entered data on new rows. + Dim postdata As New ArrayList + For Each rc As PersonalSpecialSkillTableControlRow In Me.GetRecordControls() + If Not rc.IsNewRecord Then + rc.DataSource = rc.GetRecord() + rc.GetUIData() + postdata.Add(rc.DataSource) + UIData.Add(rc.PreservedUIData()) + End If + Next + Me.DataSource = DirectCast(postdata.ToArray(GetType(PersonalSpecialSkillRecord)), PersonalSpecialSkillRecord()) + Else ' Get the records from the database + Me.DataSource = PersonalSpecialSkillTable.GetRecords(joinFilter, wc, orderBy, Me.PageIndex, Me.PageSize) + + End If + + ' if the datasource contains no records contained in database, then load the last page. + If (DbUtils.GetCreatedRecords(Me.DataSource).Length = 0 AndAlso Not Me.DisplayLastPage) Then + Me.DisplayLastPage = True + LoadData() + Else + + ' Add any new rows desired by the user. + Me.AddNewRecords() + + ' Turn off the ToggleAll checkbox + Me.PersonalSpecialSkillToggleAll.Checked = False + + + ' Initialize the page and grand totals. now + + End If + + Catch ex As Exception + ' Report the error message to the end user + Dim msg As String = ex.Message + If ex.InnerException IsNot Nothing Then + msg = msg & " InnerException: " & ex.InnerException.Message + End If + Throw New Exception(msg, ex.InnerException) + End Try + End Sub + + + + + Public Overrides Sub DataBind() + ' The DataBind method binds the user interface controls to the values + ' from the database record for each row in the table. To do this, it calls the + ' DataBind for each of the rows. + ' DataBind also populates any filters above the table, and sets the pagination + ' control to the correct number of records and the current page number. + + MyBase.DataBind() + + ' Make sure that the DataSource is initialized. + If Me.DataSource Is Nothing Then + Return + End If + + 'LoadData for DataSource for chart and report if they exist + + ' Setup the pagination controls. + BindPaginationControls() + + + + ' Bind the repeater with the list of records to expand the UI. + Dim rep As System.Web.UI.WebControls.Repeater = CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalSpecialSkillTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return + rep.DataSource = DataSource() + rep.DataBind() + + Dim index As Integer = 0 + For Each repItem As System.Web.UI.WebControls.RepeaterItem In rep.Items + ' Loop through all rows in the table, set its DataSource and call DataBind(). + Dim recControl As PersonalSpecialSkillTableControlRow = DirectCast(repItem.FindControl("PersonalSpecialSkillTableControlRow"), PersonalSpecialSkillTableControlRow) + recControl.DataSource = Me.DataSource(index) + If Me.UIData.Count > index Then + recControl.PreviousUIData = Me.UIData(index) + End If + recControl.DataBind() + recControl.Visible = Not Me.InDeletedRecordIds(recControl) + + index += 1 + Next + + + + + ' Call the Set methods for each controls on the panel + + SetLevelLabel3() + + + + + + SetPersonalSpecialSkillTableControlCollapsibleRegion() + + SetSkillLabel1() + ' setting the state of expand or collapse alternative rows + + + ' Load data for each record and table UI control. + ' Ordering is important because child controls get + ' their parent ids from their parent UI controls. + + + ' this method calls the set method for controls with special formula like running total, sum, rank, etc + SetFormulaControls() + End Sub + + Public Overridable Sub SetFormulaControls() + ' this method calls Set methods for the control that has special formula + + + + End Sub + + + + Public Overridable Sub RegisterPostback() + + + End Sub + + Public EvaluateFormulaDelegate As BaseClasses.Data.DataSource.EvaluateFormulaDelegate = New BaseClasses.Data.DataSource.EvaluateFormulaDelegate(AddressOf Me.EvaluateFormula) + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean, ByVal e as FormulaEvaluator) As String + If e Is Nothing + e = New FormulaEvaluator() + End If + + e.Variables.Clear() + + + ' add variables for formula evaluation + If variables IsNot Nothing Then + Dim enumerator As System.Collections.Generic.IEnumerator(Of System.Collections.Generic.KeyValuePair(Of String, Object)) = variables.GetEnumerator() + While enumerator.MoveNext() + e.Variables.Add(enumerator.Current.Key, enumerator.Current.Value) + End While + End If + + If includeDS + + End If + + ' All variables referred to in the formula are expected to be + ' properties of the DataSource. For example, referring to + ' UnitPrice as a variable will refer to DataSource.UnitPrice + e.DataSource = dataSourceForEvaluate + + ' Define the calling control. This is used to add other + ' related table and record controls as variables. + e.CallingControl = Me + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + + If Not String.IsNullOrEmpty(format) AndAlso (String.IsNullOrEmpty(formula) OrElse formula.IndexOf("Format(") < 0) Then + Return FormulaUtils.Format(resultObj, format) + Else + Return resultObj.ToString() + End If + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format,variables ,includeDS, Nothing) + End Function + + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object)) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format, variables ,True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, format, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal e as FormulaEvaluator) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, variables, True, e) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal includeDS as Boolean) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, includeDS, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, True, Nothing) + End Function + + + + + Public Overridable Sub ResetControl() + + Me.CurrentSortOrder.Reset() + If (Me.InSession(Me, "Order_By")) Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + End If + + Me.PageIndex = 0 + End Sub + + Protected Overridable Sub BindPaginationControls() + ' Setup the pagination controls. + + ' Bind the pagination labels. + + If DbUtils.GetCreatedRecords(Me.DataSource).Length > 0 Then + + Me.PersonalSpecialSkillPagination.CurrentPage.Text = (Me.PageIndex + 1).ToString() + Else + Me.PersonalSpecialSkillPagination.CurrentPage.Text = "0" + End If + Me.PersonalSpecialSkillPagination.PageSize.Text = Me.PageSize.ToString() + Me.PersonalSpecialSkillPagination.TotalItems.Text = Me.TotalRecords.ToString() + Me.PersonalSpecialSkillPagination.TotalPages.Text = Me.TotalPages.ToString() + + ' Bind the buttons for PersonalSpecialSkillTableControl pagination. + + Me.PersonalSpecialSkillPagination.FirstPage.Enabled = Not (Me.PageIndex = 0) + If Me._TotalPages < 0 Then ' if the total pages is not determined yet, enable last and next buttons + Me.PersonalSpecialSkillPagination.LastPage.Enabled = True + ElseIf Me._TotalPages = 0 ' if the total pages is determined and it is 0, enable last and next buttons + Me.PersonalSpecialSkillPagination.LastPage.Enabled = False + Else ' if the total pages is the last page, disable last and next buttons + Me.PersonalSpecialSkillPagination.LastPage.Enabled = Not (Me.PageIndex = Me.TotalPages - 1) + End If + + If Me._TotalPages < 0 Then ' if the total pages is not determined yet, enable last and next buttons + Me.PersonalSpecialSkillPagination.NextPage.Enabled = True + ElseIf Me._TotalPages = 0 ' if the total pages is determined and it is 0, enable last and next buttons + Me.PersonalSpecialSkillPagination.NextPage.Enabled = False + Else ' if the total pages is the last page, disable last and next buttons + Me.PersonalSpecialSkillPagination.NextPage.Enabled = Not (Me.PageIndex = Me.TotalPages - 1) + End If + + Me.PersonalSpecialSkillPagination.PreviousPage.Enabled = Not (Me.PageIndex = 0) + + + End Sub + + Public Overridable Sub SaveData() + ' Save the data from the entire table. Calls each row's Save Data + ' to save their data. This function is called by the Click handler of the + ' Save button. The button handler should Start/Commit/End a transaction. + + Dim recCtl As PersonalSpecialSkillTableControlRow + For Each recCtl In Me.GetRecordControls() + + If Me.InDeletedRecordIds(recCtl) Then + ' Delete any pending deletes. + recCtl.Delete() + Else + If recCtl.Visible Then + recCtl.SaveData() + End If + End If + + Next + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + ' Set IsNewRecord to False for all records - since everything has been saved and is no longer "new" + For Each recCtl In Me.GetRecordControls() + recCtl.IsNewRecord = False + Next + + + ' Set DeletedRecordsIds to Nothing since we have deleted all pending deletes. + Me.DeletedRecordIds = Nothing + + End Sub + + Public Overridable Function CreateCompoundJoinFilter() As CompoundFilter + Dim jFilter As CompoundFilter = New CompoundFilter() + + Return jFilter + + End Function + + + Public Overridable Function CreateOrderBy() As OrderBy + ' The CurrentSortOrder is initialized to the sort order on the + ' Query Wizard. It may be modified by the Click handler for any of + ' the column heading to sort or reverse sort by that column. + ' You can add your own sort order, or modify it on the Query Wizard. + Return Me.CurrentSortOrder + End Function + + Public Overridable Function CreateWhereClause() As WhereClause + 'This CreateWhereClause is used for loading the data. + PersonalSpecialSkillTable.Instance.InnerFilter = Nothing + Dim wc As WhereClause = New WhereClause() + + ' Compose the WHERE clause consiting of: + ' 1. Static clause defined at design time. + ' 2. User selected search criteria. + ' 3. User selected filter criteria. + + + Dim selectedRecordKeyValue as KeyValue = New KeyValue() + + Dim personalIdRecordControlObj As Persons.UI.Controls.EditPersonalId.PersonalIdRecordControl = DirectCast(MiscUtils.FindControlRecursively(Me.Page, "PersonalIdRecordControl"), Persons.UI.Controls.EditPersonalId.PersonalIdRecordControl) + + If (Not IsNothing(personalIdRecordControlObj) AndAlso Not IsNothing(personalIdRecordControlObj.GetRecord()) AndAlso personalIdRecordControlObj.GetRecord().IsCreated AndAlso Not IsNothing(personalIdRecordControlObj.GetRecord().PersonalId)) + wc.iAND(PersonalSpecialSkillTable.PersonalId, BaseFilter.ComparisonOperator.EqualsTo, personalIdRecordControlObj.GetRecord().PersonalId.ToString()) + selectedRecordKeyValue.AddElement(PersonalSpecialSkillTable.PersonalId.InternalName, personalIdRecordControlObj.GetRecord().PersonalId.ToString()) + Else + wc.RunQuery = False + Return wc + End If + + HttpContext.Current.Session("PersonalSpecialSkillTableControlWhereClause") = selectedRecordKeyValue.ToXmlString() + + Return wc + End Function + + + Public Overridable Function CreateWhereClause(ByVal searchText as String, ByVal fromSearchControl as String, ByVal AutoTypeAheadSearch as String, ByVal AutoTypeAheadWordSeparators as String) As WhereClause + ' This CreateWhereClause is used for loading list of suggestions for Auto Type-Ahead feature. + PersonalSpecialSkillTable.Instance.InnerFilter = Nothing + Dim wc As WhereClause = New WhereClause() + + ' Compose the WHERE clause consiting of: + ' 1. Static clause defined at design time. + ' 2. User selected search criteria. + ' 3. User selected filter criteria. + + Dim appRelativeVirtualPath As String = CType(HttpContext.Current.Session("AppRelativeVirtualPath"), String) + + Dim selectedRecordInPersonalIdRecordControl as String = DirectCast(HttpContext.Current.Session("PersonalSpecialSkillTableControlWhereClause"), String) + + If Not selectedRecordInPersonalIdRecordControl Is Nothing AndAlso KeyValue.IsXmlKey(selectedRecordInPersonalIdRecordControl) Then + Dim selectedRecordKeyValue as KeyValue = KeyValue.XmlToKey(selectedRecordInPersonalIdRecordControl) + + If Not IsNothing(selectedRecordKeyValue) AndAlso selectedRecordKeyValue.ContainsColumn(PersonalSpecialSkillTable.PersonalId) Then + wc.iAND(PersonalSpecialSkillTable.PersonalId, BaseFilter.ComparisonOperator.EqualsTo, selectedRecordKeyValue.GetColumnValue(PersonalSpecialSkillTable.PersonalId).ToString()) + End If + + End If + + ' Adds clauses if values are selected in Filter controls which are configured in the page. + + + Return wc + End Function + + + Public Overridable Function FormatSuggestions(ByVal prefixText As String, ByVal resultItem As String, _ + ByVal columnLength As Integer, ByVal AutoTypeAheadDisplayFoundText As String, _ + ByVal autoTypeAheadSearch As String, ByVal AutoTypeAheadWordSeparators As String, _ + ByVal resultList As ArrayList) As Boolean + + 'Formats the resultItem and adds it to the list of suggestions. + Dim index As Integer = resultItem.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture).IndexOf(prefixText.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture)) + Dim itemToAdd As String = "" + Dim isFound As Boolean = False + Dim isAdded As Boolean = False + ' Get the index where prfixt is at the beginning of resultItem. If not found then, index of word which begins with prefixText. + If InvariantLCase(autoTypeAheadSearch).equals("wordsstartingwithsearchstring") And Not index = 0 Then + ' Expression to find word which contains AutoTypeAheadWordSeparators followed by prefixText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex( AutoTypeAheadWordSeparators + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + If regex1.IsMatch(resultItem) Then + index = regex1.Match(resultItem).Index + isFound = True + End If + ' If the prefixText is found immediatly after white space then starting of the word is found so don not search any further + If not resultItem(index).ToString() = " " Then + ' Expression to find beginning of the word which contains AutoTypeAheadWordSeparators followed by prefixText + Dim regex As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\\S*" + AutoTypeAheadWordSeparators + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + If regex.IsMatch(resultItem) Then + index = regex.Match(resultItem).Index + isFound = True + End If + End If + End If + + ' If autoTypeAheadSearch value is wordsstartingwithsearchstring then, extract the substring only if the prefixText is found at the + ' beginning of the resultItem (index = 0) or a word in resultItem is found starts with prefixText. + If index = 0 Or isFound Or InvariantLCase(autoTypeAheadSearch).Equals("anywhereinstring") then + If InvariantLCase(AutoTypeAheadDisplayFoundText).equals("atbeginningofmatchedstring") Then + ' Expression to find beginning of the word which contains prefixText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\\S*" + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + ' Find the beginning of the word which contains prefexText + If (StringUtils.InvariantLCase(autoTypeAheadSearch).Equals("anywhereinstring") AndAlso regex1.IsMatch(resultItem)) Then + index = regex1.Match(resultItem).Index + isFound = True + End If + ' Display string from the index till end of the string if sub string from index till end is less than columnLength value. + If Len(resultItem) - index <= columnLength Then + If index = 0 Then + itemToAdd = resultItem + Else + itemToAdd = "..." & resultItem.Substring(index, Len(resultItem) - index) + End If + Else + If index = 0 Then + itemToAdd = resultItem.Substring(index, (columnLength - 3)) & "..." + Else + 'Truncate the string to show only columnLength - 6 characters as begining and trailing "..." has to be appended. + itemToAdd = "..." & resultItem.Substring(index , columnLength - 6) & "..." + End If + End If + ElseIf InvariantLCase(AutoTypeAheadDisplayFoundText).equals("inmiddleofmatchedstring") Then + Dim subStringBeginIndex As Integer = CType(columnLength/2, Integer) + If Len(resultItem) <= columnLength Then + itemToAdd = resultItem + Else + ' Sanity check at end of the string + If index + Len(prefixText) = columnLength Then + itemToAdd = "..." & resultItem.Substring(index-columnLength,index) + ElseIf Len(resultItem) - index < subStringBeginIndex Then + ' Display string from the end till columnLength value if, index is closer to the end of the string. + itemToAdd = "..." & resultItem.Substring(Len(resultItem)-columnLength,Len(resultItem)) + ElseIf index <= subStringBeginIndex Then + ' Sanity chet at beginning of the string + itemToAdd = resultItem.Substring(0, columnLength) & "..." + Else + ' Display string containing text before the prefixText occures and text after the prefixText + itemToAdd = "..." & resultItem.Substring(index - subStringBeginIndex, columnLength) & "..." + End If + End If + ElseIf InvariantLCase(AutoTypeAheadDisplayFoundText).equals("atendofmatchedstring") Then + ' Expression to find ending of the word which contains prefexText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\s", System.Text.RegularExpressions.RegexOptions.IgnoreCase) + ' Find the ending of the word which contains prefexText + If regex1.IsMatch(resultItem, index + 1) Then + index = regex1.Match(resultItem, index + 1).Index + Else + ' If the word which contains prefexText is the last word in string, regex1.IsMatch returns false. + index = resultItem.Length + End If + If index > Len(resultItem) Then + index = Len(resultItem) + End If + ' If text from beginning of the string till index is less than columnLength value then, display string from the beginning till index. + If index <= columnLength Then + if index = Len(resultItem) Then 'Make decision to append "..." + itemToAdd = resultItem.Substring(0,index) + Else + itemToAdd = resultItem.Substring(0,index) & "..." + End If + Else + If index = Len(resultItem) Then + itemToAdd = "..." & resultItem.Substring(index - (columnLength - 3), (columnLength - 3)) + Else + 'Truncate the string to show only columnLength - 6 characters as begining and trailing "..." has to be appended. + itemToAdd = "..." & resultItem.Substring(index - (columnLength - 6), columnLength - 6) & "..." + End If + End If + End If + + ' Remove newline character from itemToAdd + Dim prefixTextIndex As Integer = itemToAdd.IndexOf(prefixText, StringComparison.CurrentCultureIgnoreCase) + ' If itemToAdd contains any newline after the search text then show text only till newline + Dim regex2 As System.Text.RegularExpressions.Regex = New System.Text.RegularExpressions.Regex("(" & vbCrLf & "|" & vbLf & ")", System.Text.RegularExpressions.RegexOptions.IgnoreCase) + Dim newLineIndexAfterPrefix As Integer = -1 + If regex2.IsMatch(itemToAdd, prefixTextIndex) Then + newLineIndexAfterPrefix = regex2.Match(itemToAdd, prefixTextIndex).Index + End If + If (newLineIndexAfterPrefix > -1) Then + If itemToAdd.EndsWith("...") Then + itemToAdd = (itemToAdd.Substring(0, newLineIndexAfterPrefix) + "...") + Else + itemToAdd = itemToAdd.Substring(0, newLineIndexAfterPrefix) + End If + End If + ' If itemToAdd contains any newline before search text then show text which comes after newline + Dim regex3 As System.Text.RegularExpressions.Regex = New System.Text.RegularExpressions.Regex("(" & vbCrLf & "|" & vbLf & ")", (System.Text.RegularExpressions.RegexOptions.IgnoreCase Or System.Text.RegularExpressions.RegexOptions.RightToLeft)) + Dim newLineIndexBeforePrefix As Integer = -1 + If regex3.IsMatch(itemToAdd, prefixTextIndex) Then + newLineIndexBeforePrefix = regex3.Match(itemToAdd, prefixTextIndex).Index + End If + If (newLineIndexBeforePrefix > -1) Then + If itemToAdd.StartsWith("...") Then + itemToAdd = ("..." + itemToAdd.Substring((newLineIndexBeforePrefix + regex3.Match(itemToAdd, prefixTextIndex).Length))) + Else + itemToAdd = itemToAdd.Substring((newLineIndexBeforePrefix + regex3.Match(itemToAdd, prefixTextIndex).Length)) + End If + End If + + If Not itemToAdd is nothing AndAlso Not resultList.Contains(itemToAdd) Then + + resultList.Add(itemToAdd) + + isAdded = true + End If + End If + Return isAdded + End Function + + + Protected Overridable Sub GetPageSize() + + If Me.PersonalSpecialSkillPagination.PageSize.Text.Trim <> "" Then + Try + 'Me.PageSize = Integer.Parse(Me.PersonalSpecialSkillPagination.PageSize.Text) + Catch ex As Exception + End Try + End If + End Sub + + Protected Overridable Sub AddNewRecords() + + Dim newRecordList As ArrayList = New ArrayList() + + Dim newUIDataList As System.Collections.Generic.List(Of Hashtable) = New System.Collections.Generic.List(Of Hashtable)() + + ' Loop though all the record controls and if the record control + ' does not have a unique record id set, then create a record + ' and add to the list. + If Not Me.ResetData Then + Dim rep As System.Web.UI.WebControls.Repeater = CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalSpecialSkillTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return + + Dim repItem As System.Web.UI.WebControls.RepeaterItem + For Each repItem In rep.Items + ' Loop through all rows in the table, set its DataSource and call DataBind(). + + Dim recControl As PersonalSpecialSkillTableControlRow = DirectCast(repItem.FindControl("PersonalSpecialSkillTableControlRow"), PersonalSpecialSkillTableControlRow) + + If recControl.Visible AndAlso recControl.IsNewRecord() Then + + Dim rec As PersonalSpecialSkillRecord = New PersonalSpecialSkillRecord() + + If recControl.Level1.Text <> "" Then + rec.Parse(recControl.Level1.Text, PersonalSpecialSkillTable.Level) + End If + If recControl.Skill.Text <> "" Then + rec.Parse(recControl.Skill.Text, PersonalSpecialSkillTable.Skill) + End If + newUIDataList.Add(recControl.PreservedUIData()) + newRecordList.Add(rec) + End If + Next + End If + + + ' Add any new record to the list. + Dim index As Integer = 0 + For index = 1 To Me.AddNewRecord + + newRecordList.Insert(0, New PersonalSpecialSkillRecord()) + newUIDataList.Insert(0, New Hashtable()) + + Next + Me.AddNewRecord = 0 + + ' Finally, add any new records to the DataSource. + If newRecordList.Count > 0 Then + + Dim finalList As ArrayList = New ArrayList(Me.DataSource) + finalList.InsertRange(0, newRecordList) + + Me.DataSource = DirectCast(finalList.ToArray(GetType(PersonalSpecialSkillRecord)), PersonalSpecialSkillRecord()) + + End If + + ' Add the existing UI data to this hash table + If newUIDataList.Count > 0 Then + Me.UIData.InsertRange(0, newUIDataList) + End If + + End Sub + + + Public Sub AddToDeletedRecordIds(ByVal rec As PersonalSpecialSkillTableControlRow) + If rec.IsNewRecord() Then + Return + End If + + If Not Me.DeletedRecordIds Is Nothing AndAlso Me.DeletedRecordIds.Trim <> "" Then + Me.DeletedRecordIds &= "," + End If + + Me.DeletedRecordIds &= "[" & rec.RecordUniqueId & "]" + End Sub + + Protected Overridable Function InDeletedRecordIds(ByVal rec As PersonalSpecialSkillTableControlRow) As Boolean + If Me.DeletedRecordIds Is Nothing OrElse Me.DeletedRecordIds.Trim = "" Then + Return False + End If + + Return Me.DeletedRecordIds.IndexOf("[" & rec.RecordUniqueId & "]") >= 0 + End Function + + Private _DeletedRecordIds As String + Public Property DeletedRecordIds() As String + Get + Return Me._DeletedRecordIds + End Get + Set(ByVal value As String) + Me._DeletedRecordIds = value + End Set + End Property + + + ' Create Set, WhereClause, and Populate Methods + + Public Overridable Sub SetLevelLabel3() + + End Sub + + Public Overridable Sub SetPersonalSpecialSkillTableControlCollapsibleRegion() + + End Sub + + Public Overridable Sub SetSkillLabel1() + + 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. + Dim added As Boolean = Me.AddNewRecord > 0 + Me.LoadData() + Me.DataBind() + + If added Then + Me.SetFocusToAddedRow() + End If + + End If + + + + Catch ex As Exception + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + Finally + DbUtils.EndTransaction + End Try + End Sub + + 'this function sets focus to the first editable element in the new added row in the editable table + Protected Overridable Sub SetFocusToAddedRow() + Dim rep As System.Web.UI.WebControls.Repeater = CType(Me.FindControl("PersonalSpecialSkillTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing OrElse rep.Items.Count = 0 Then Return + Dim repItem As System.Web.UI.WebControls.RepeaterItem + For Each repItem In rep.Items + 'Load scripts to table rows + Me.Page.LoadFocusScripts(repItem) + Dim recControl As PersonalSpecialSkillTableControlRow = DirectCast(repItem.FindControl("PersonalSpecialSkillTableControlRow"), PersonalSpecialSkillTableControlRow) + If recControl.IsNewRecord Then + For Each field As Control In recControl.Controls + If field.Visible AndAlso Me.Page.IsControlEditable(field, False) Then + 'set focus on the first editable field in the new row + field.Focus() + Dim updPan As UpdatePanel = DirectCast(Me.Page.FindControlRecursively("UpdatePanel1"), UpdatePanel) + If Not updPan Is Nothing Then updPan.Update() + Return + End If + Next + Return + End If + Next + End Sub + + + Protected Overrides Sub SaveControlsToSession() + MyBase.SaveControlsToSession() + + ' Save filter controls to values to session. + + + 'Save pagination state to session. + + + + ' Save table control properties to the session. + If Not Me.CurrentSortOrder Is Nothing Then + Me.SaveToSession(Me, "Order_By", Me.CurrentSortOrder.ToXmlString()) + End If + + Me.SaveToSession(Me, "Page_Index", Me.PageIndex.ToString()) + Me.SaveToSession(Me, "Page_Size", Me.PageSize.ToString()) + + Me.SaveToSession(Me, "DeletedRecordIds", Me.DeletedRecordIds) + + End Sub + + Protected Sub SaveControlsToSession_Ajax() + ' Save filter controls to values to session. + + HttpContext.Current.Session("AppRelativeVirtualPath") = Me.Page.AppRelativeVirtualPath + + End Sub + + Protected Overrides Sub ClearControlsFromSession() + MyBase.ClearControlsFromSession() + + ' Clear filter controls values from the session. + + + ' Clear pagination state from session. + + + + ' Clear table properties from the session. + Me.RemoveFromSession(Me, "Order_By") + Me.RemoveFromSession(Me, "Page_Index") + Me.RemoveFromSession(Me, "Page_Size") + + Me.RemoveFromSession(Me, "DeletedRecordIds") + + End Sub + + Protected Overrides Sub LoadViewState(ByVal savedState As Object) + MyBase.LoadViewState(savedState) + + Dim orderByStr As String = CType(ViewState("PersonalSpecialSkillTableControl_OrderBy"), String) + + If orderByStr IsNot Nothing AndAlso orderByStr.Trim <> "" Then + Me.CurrentSortOrder = BaseClasses.Data.OrderBy.FromXmlString(orderByStr) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + End If + + Dim pageIndex As String = CType(ViewState("Page_Index"), String) + If pageIndex IsNot Nothing Then + Me.PageIndex = CInt(pageIndex) + End If + + Dim pageSize As String = CType(ViewState("Page_Size"), String) + If Not pageSize Is Nothing Then + Me.PageSize = CInt(pageSize) + End If + + + + ' Load view state for pagination control. + + Me.DeletedRecordIds = CType(Me.ViewState("DeletedRecordIds"), String) + + End Sub + + Protected Overrides Function SaveViewState() As Object + + If Me.CurrentSortOrder IsNot Nothing Then + Me.ViewState("PersonalSpecialSkillTableControl_OrderBy") = Me.CurrentSortOrder.ToXmlString() + End If + + Me.ViewState("Page_Index") = Me.PageIndex + Me.ViewState("Page_Size") = Me.PageSize + + Me.ViewState("DeletedRecordIds") = Me.DeletedRecordIds + + + ' Load view state for pagination control. + + + Return MyBase.SaveViewState() + End Function + + ' Generate the event handling functions for pagination events. + + ' event handler for ImageButton + Public Overridable Sub PersonalSpecialSkillPagination_FirstPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.PageIndex = 0 + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalSpecialSkillPagination_LastPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.DisplayLastPage = True + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalSpecialSkillPagination_NextPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.PageIndex += 1 + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for LinkButton + Public Overridable Sub PersonalSpecialSkillPagination_PageSizeButton_Click(ByVal sender As Object, ByVal args As EventArgs) + + Try + + Me.DataChanged = True + + Me.PageSize = Integer.Parse(Me.PersonalSpecialSkillPagination.PageSize.Text) + + Me.PageIndex = Integer.Parse(Me.PersonalSpecialSkillPagination.CurrentPage.Text) - 1 + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalSpecialSkillPagination_PreviousPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + If Me.PageIndex > 0 Then + Me.PageIndex -= 1 + Me.DataChanged = True + End If + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + + ' Generate the event handling functions for sorting events. + + Public Overridable Sub LevelLabel3_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by Level when clicked. + + ' Get previous sorting state for Level. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalSpecialSkillTable.Level) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for Level. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalSpecialSkillTable.Level, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by Level, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub SkillLabel1_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by Skill when clicked. + + ' Get previous sorting state for Skill. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalSpecialSkillTable.Skill) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for Skill. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalSpecialSkillTable.Skill, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by Skill, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + + ' Generate the event handling functions for button events. + + ' event handler for ImageButton + Public Overridable Sub PersonalSpecialSkillAddButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + Me.AddNewRecord = 1 + Me.DataChanged = True + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalSpecialSkillDeleteButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + If(Not Me.Page.IsPageRefresh) Then + + Me.DeleteSelectedRecords(True) + Me.SetFormulaControls() + + + End If + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalSpecialSkillEditButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + ' The redirect URL is set on the Properties, Custom Properties or Actions. + ' The ModifyRedirectURL call resolves the parameters before the + ' Response.Redirect redirects the page to the URL. + ' Any code after the Response.Redirect call will not be executed, since the page is + ' redirected to the URL. + + + Dim url As String = "../Shared/ConfigureEditRecord.aspx" + + Dim shouldRedirect As Boolean = True + Dim TargetKey As String = Nothing + Dim DFKA As String = TargetKey + Dim id As String = DFKA + Dim value As String = id + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + url = Me.ModifyRedirectUrl(url, "",False) + url = Me.Page.ModifyRedirectUrl(url, "",False) + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + shouldRedirect = False + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + If shouldRedirect Then + Me.Page.ShouldSaveControlsToSession = True + Me.Page.Response.Redirect(url) + ElseIf Not TargetKey Is Nothing AndAlso _ + Not shouldRedirect Then + Me.Page.ShouldSaveControlsToSession = True + Me.Page.CloseWindow(True) + + End If + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalSpecialSkillResetButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.CurrentSortOrder.Reset() + If Me.InSession(Me, "Order_By") Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + + End If + + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + + + ' Generate the event handling functions for filter and search events. + + + ' Generate the event handling functions for others + + + Private _UIData As New System.Collections.Generic.List(Of Hashtable) + Public Property UIData() As System.Collections.Generic.List(Of Hashtable) + Get + Return Me._UIData + End Get + Set(ByVal value As System.Collections.Generic.List(Of Hashtable)) + Me._UIData = value + End Set + End Property + + ' pagination properties + Protected _PageSize As Integer + Public Property PageSize() As Integer + Get + Return Me._PageSize + End Get + Set(ByVal value As Integer) + Me._PageSize = value + End Set + End Property + + Protected _PageIndex As Integer + Public Property PageIndex() As Integer + Get + ' Return the PageIndex + Return Me._PageIndex + End Get + Set(ByVal value As Integer) + Me._PageIndex = value + End Set + End Property + + Protected _TotalRecords As Integer = -1 + Public Property TotalRecords() As Integer + Get + If _TotalRecords < 0 + _TotalRecords = PersonalSpecialSkillTable.GetRecordCount(CreateCompoundJoinFilter(), CreateWhereClause()) + End If + Return Me._TotalRecords + End Get + Set(ByVal value As Integer) + If Me.PageSize > 0 Then + + Me.TotalPages = CInt(Math.Ceiling(value / Me.PageSize)) + + End If + Me._TotalRecords = value + End Set + End Property + + + + Protected _TotalPages As Integer = -1 + Public Property TotalPages() As Integer + Get + If _TotalPages < 0 Then + + Me.TotalPages = CInt(Math.Ceiling(TotalRecords / Me.PageSize)) + + End If + Return Me._TotalPages + End Get + Set(ByVal value As Integer) + Me._TotalPages = value + End Set + End Property + + Protected _DisplayLastPage As Boolean + Public Property DisplayLastPage() As Boolean + Get + Return Me._DisplayLastPage + End Get + Set(ByVal value As Boolean) + Me._DisplayLastPage = value + End Set + End Property + + Private _DataChanged As Boolean = False + Public Property DataChanged() As Boolean + Get + Return Me._DataChanged + End Get + Set(ByVal value As Boolean) + Me._DataChanged = value + End Set + End Property + + Private _ResetData As Boolean = False + Public Property ResetData() As Boolean + Get + Return Me._ResetData + End Get + Set(ByVal value As Boolean) + Me._ResetData = value + End Set + End Property + + Private _AddNewRecord As Integer = 0 + Public Property AddNewRecord() As Integer + Get + Return Me._AddNewRecord + End Get + Set(ByVal value As Integer) + Me._AddNewRecord = value + End Set + End Property + + + Private _CurrentSortOrder As OrderBy = Nothing + Public Property CurrentSortOrder() As OrderBy + Get + Return Me._CurrentSortOrder + End Get + Set(ByVal value As BaseClasses.Data.OrderBy) + Me._CurrentSortOrder = value + End Set + End Property + + Private _DataSource() As PersonalSpecialSkillRecord = Nothing + Public Property DataSource() As PersonalSpecialSkillRecord () + Get + Return Me._DataSource + End Get + Set(ByVal value() As PersonalSpecialSkillRecord) + Me._DataSource = value + End Set + End Property + +#Region "Helper Properties" + + Public ReadOnly Property LevelLabel3() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "LevelLabel3"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property PersonalSpecialSkillAddButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalSpecialSkillAddButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalSpecialSkillDeleteButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalSpecialSkillDeleteButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalSpecialSkillEditButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalSpecialSkillEditButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalSpecialSkillPagination() As Persons.UI.IPagination + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalSpecialSkillPagination"), Persons.UI.IPagination) + End Get + End Property + + Public ReadOnly Property PersonalSpecialSkillResetButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalSpecialSkillResetButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalSpecialSkillTableControlCollapsibleRegion() As System.Web.UI.WebControls.Panel + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalSpecialSkillTableControlCollapsibleRegion"), System.Web.UI.WebControls.Panel) + End Get + End Property + + Public ReadOnly Property PersonalSpecialSkillToggleAll() As System.Web.UI.WebControls.CheckBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalSpecialSkillToggleAll"), System.Web.UI.WebControls.CheckBox) + End Get + End Property + + Public ReadOnly Property SkillLabel1() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "SkillLabel1"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + +#End Region + +#Region "Helper Functions" + + Public Overrides Overloads Function ModifyRedirectUrl(url As String, arg As String, ByVal bEncrypt As Boolean) As String + Return Me.Page.EvaluateExpressions(url, arg, bEncrypt, Me) + End Function + + Public Overrides Overloads Function EvaluateExpressions(url As String, arg As String, ByVal bEncrypt As Boolean) As String + Dim needToProcess As Boolean = AreAnyUrlParametersForMe(url, arg) + If (needToProcess) Then + Dim recCtl As PersonalSpecialSkillTableControlRow = Me.GetSelectedRecordControl() + If recCtl Is Nothing AndAlso url.IndexOf("{") >= 0 Then + ' Localization. + Throw New Exception(Page.GetResourceValue("Err:NoRecSelected", "Persons")) + End If + Dim rec As PersonalSpecialSkillRecord = Nothing + If recCtl IsNot Nothing Then + rec = recCtl.GetRecord() + End If + Return EvaluateExpressions(url, arg, rec, bEncrypt) + End If + Return url + End Function + + Public Overridable Function GetSelectedRecordIndex() As Integer + Dim counter As Integer = 0 + Dim recControl As PersonalSpecialSkillTableControlRow + For Each recControl In Me.GetRecordControls() + If recControl.PersonalSpecialSkillRecordRowSelection.Checked Then + Return counter + End If + counter += 1 + Next + Return -1 + End Function + + Public Overridable Function GetSelectedRecordControl() As PersonalSpecialSkillTableControlRow + Dim selectedList() As PersonalSpecialSkillTableControlRow = Me.GetSelectedRecordControls() + If selectedList.Length = 0 Then + Return Nothing + End If + Return selectedList(0) + + End Function + + Public Overridable Function GetSelectedRecordControls() As PersonalSpecialSkillTableControlRow() + + Dim selectedList As ArrayList = New ArrayList(25) + Dim recControl As PersonalSpecialSkillTableControlRow + For Each recControl In Me.GetRecordControls() + If recControl.PersonalSpecialSkillRecordRowSelection IsNot Nothing AndAlso recControl.PersonalSpecialSkillRecordRowSelection.Checked Then + selectedList.Add(recControl) + End If + Next + Return DirectCast(selectedList.ToArray(GetType(PersonalSpecialSkillTableControlRow)), PersonalSpecialSkillTableControlRow()) + + End Function + + Public Overridable Sub DeleteSelectedRecords(ByVal deferDeletion As Boolean) + Dim recList() As PersonalSpecialSkillTableControlRow = Me.GetSelectedRecordControls() + If recList.Length = 0 Then + ' Localization. + Throw New Exception(Page.GetResourceValue("Err:NoRecSelected", "Persons")) + End If + + Dim recCtl As PersonalSpecialSkillTableControlRow + For Each recCtl In recList + If deferDeletion Then + If Not recCtl.IsNewRecord Then + + Me.AddToDeletedRecordIds(recCtl) + + End If + recCtl.Visible = False + + recCtl.PersonalSpecialSkillRecordRowSelection.Checked = False + + Else + + recCtl.Delete() + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + End If + Next + End Sub + + Public Function GetRecordControls() As PersonalSpecialSkillTableControlRow() + Dim recList As ArrayList = New ArrayList() + Dim rep As System.Web.UI.WebControls.Repeater = CType(Me.FindControl("PersonalSpecialSkillTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return Nothing + Dim repItem As System.Web.UI.WebControls.RepeaterItem + + For Each repItem In rep.Items + + Dim recControl As PersonalSpecialSkillTableControlRow = DirectCast(repItem.FindControl("PersonalSpecialSkillTableControlRow"), PersonalSpecialSkillTableControlRow) + recList.Add(recControl) + + Next + + Return DirectCast(recList.ToArray(GetType(PersonalSpecialSkillTableControlRow)), PersonalSpecialSkillTableControlRow()) + End Function + + Public Shadows ReadOnly Property Page() As BaseApplicationPage + Get + Return DirectCast(MyBase.Page, BaseApplicationPage) + End Get + End Property + +#End Region + + + +End Class + + +' Base class for the PersonalSportSkillTableControl1Row control on the EditPersonalId page. +' Do not modify this class. Instead override any method in PersonalSportSkillTableControl1Row. +Public Class BasePersonalSportSkillTableControl1Row + Inherits Persons.UI.BaseApplicationRecordControl + + ' To customize, override this method in PersonalSportSkillTableControl1Row. + Protected Overridable Sub Control_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Init + + Me.ClearControlsFromSession() + End Sub + + ' To customize, override this method in PersonalSportSkillTableControl1Row. + Protected Overridable Sub Control_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load + + 'Call LoadFocusScripts from repeater so that onfocus attribute could be added to elements + Me.Page.LoadFocusScripts(Me) + + ' Show confirmation message on Click + Me.PersonalSportSkillRowDeleteButton1.Attributes.Add("onClick", "return (confirm('" & (CType(Me.Page,BaseApplicationPage)).GetResourceValue("DeleteRecordConfirm", "Persons") & "'));") + + + ' Register the event handlers. + + AddHandler Me.PersonalSportSkillRowDeleteButton1.Click, AddressOf PersonalSportSkillRowDeleteButton1_Click + + AddHandler Me.PersonalSportSkillRowEditButton1.Click, AddressOf PersonalSportSkillRowEditButton1_Click + + AddHandler Me.PersonalSportSkillRowViewButton1.Click, AddressOf PersonalSportSkillRowViewButton1_Click + + Me.SportId1AddRecordLink.PostBackUrl = "../Sport/AddSport.aspx" & "?Target=" & Me.SportId1.ClientID & "&DFKA=" & HttpUtility.UrlEncode("SPORT") + Me.SportId1AddRecordLink.Attributes.Item("onClick") = "window.open('" & Me.SportId1AddRecordLink.PostBackUrl & "','_blank', 'width=900, height=700, resizable, scrollbars, modal=yes'); return false;" + + AddHandler Me.SportId1.SelectedIndexChanged, AddressOf SportId1_SelectedIndexChanged + + AddHandler Me.Level3.TextChanged, AddressOf Level3_TextChanged + + + End Sub + + + Public Overridable Sub LoadData() + + ' Load the data from the database into the DataSource PersonalSportSkill 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 = PersonalSportSkillTable.GetRecord(Me.RecordUniqueId, True) + + Return + End If + + ' Since this is a row in the table, the data for this row is loaded by the + ' LoadData method of the BasePersonalSportSkillTableControl1 when the data for the entire + ' table is loaded. + + Me.DataSource = New PersonalSportSkillRecord() + + + + End Sub + + ' Populate the UI controls using the DataSource. To customize, override this method in PersonalSportSkillTableControl1Row. + 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 + + SetLevel3() + + + + + SetSportId1() + + + + 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 SetLevel3() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.Level3.ID) Then + + Me.Level3.Text = Me.PreviousUIData(Me.Level3.ID).ToString() + + Return + End If + + + ' Set the Level TextBox on the webpage with value from the + ' PersonalSportSkill database record. + + ' Me.DataSource is the PersonalSportSkill record retrieved from the database. + ' Me.Level3 is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetLevel3() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.LevelSpecified Then + + ' If the Level is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalSportSkillTable.Level) + + Me.Level3.Text = formattedValue + + Else + + ' Level is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.Level3.Text = PersonalSportSkillTable.Level.Format(PersonalSportSkillTable.Level.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetSportId1() + + ' If selection was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.SportId1.ID) Then + If Me.PreviousUIData(Me.SportId1.ID) Is Nothing + Me.PopulateSportId1DropDownList(Nothing, 100) + Else + Me.PopulateSportId1DropDownList(Me.PreviousUIData(Me.SportId1.ID).ToString(), 100) + End If + Return + End If + + + ' Set the SportId DropDownList on the webpage with value from the + ' PersonalSportSkill database record. + + ' Me.DataSource is the PersonalSportSkill record retrieved from the database. + ' Me.SportId1 is the ASP:DropDownList on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetSportId1() + ' and add your own code before or after the call to the MyBase function. + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.SportIdSpecified Then + + ' If the SportId is non-NULL, then format the value. + ' The Format method will return the Display Foreign Key As (DFKA) value + Me.PopulateSportId1DropDownList(Me.DataSource.SportId.ToString(), 100) + + Else + + ' SportId 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.PopulateSportId1DropDownList(Nothing, 100) + Else + Me.PopulateSportId1DropDownList(PersonalSportSkillTable.SportId.DefaultValue, 100) + End If + + End If + + End Sub + + + Public EvaluateFormulaDelegate As BaseClasses.Data.DataSource.EvaluateFormulaDelegate = New BaseClasses.Data.DataSource.EvaluateFormulaDelegate(AddressOf Me.EvaluateFormula) + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean, ByVal e As FormulaEvaluator) As String + If e Is Nothing Then + e = New FormulaEvaluator() + End If + + e.Variables.Clear() + + + ' add variables for formula evaluation + If variables IsNot Nothing Then + Dim enumerator As System.Collections.Generic.IEnumerator(Of System.Collections.Generic.KeyValuePair(Of String, Object)) = variables.GetEnumerator() + While enumerator.MoveNext() + e.Variables.Add(enumerator.Current.Key, enumerator.Current.Value) + End While + End If + + If includeDS + + End IF + + + ' Other variables referred to in the formula are expected to be + ' properties of the DataSource. For example, referring to + ' UnitPrice as a variable will refer to DataSource.UnitPrice + If dataSourceForEvaluate Is Nothing Then + + e.DataSource = Me.DataSource + + Else + e.DataSource = dataSourceForEvaluate + End If + + ' Define the calling control. This is used to add other + ' related table and record controls as variables. + e.CallingControl = Me + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + + If Not String.IsNullOrEmpty(format) AndAlso (String.IsNullOrEmpty(formula) OrElse formula.IndexOf("Format(") < 0) Then + Return FormulaUtils.Format(resultObj, format) + Else + Return resultObj.ToString() + End If + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format,variables ,includeDS, Nothing) + End Function + + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object)) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format, variables ,True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, format, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal e as FormulaEvaluator) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, variables, True, e) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal includeDS as Boolean) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, includeDS, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, True, Nothing) + End Function + + + Public Overridable Sub RegisterPostback() + + + End Sub + + + + ' To customize, override this method in PersonalSportSkillTableControl1Row. + 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 parentCtrl As PersonalIdRecordControl + + + parentCtrl = DirectCast(Me.Page.FindControlRecursively("PersonalIdRecordControl"), PersonalIdRecordControl) + + If (Not IsNothing(parentCtrl) AndAlso IsNothing(parentCtrl.DataSource)) + ' Load the record if it is not loaded yet. + parentCtrl.LoadData() + End If + If (IsNothing(parentCtrl) OrElse IsNothing(parentCtrl.DataSource)) + ' Get the error message from the application resource file. + Throw New Exception(Page.GetResourceValue("Err:NoParentRecId", "Persons")) + End If + + Me.DataSource.PersonalId = parentCtrl.DataSource.PersonalId + + ' 2. Perform any custom validation. + Me.Validate() + + + ' 3. Set the values in the record with data from UI controls. + ' This calls the Get() method for each of the user interface controls. + Me.GetUIData() + + ' 4. Save in the database. + ' We should not save the record if the data did not change. This + ' will save a database hit and avoid triggering any database triggers. + + If Me.DataSource.IsAnyValueChanged Then + ' Save record to database but do not commit yet. + ' Auto generated ids are available after saving for use by child (dependent) records. + Me.DataSource.Save() + + DirectCast(GetParentControlObject(Me, "PersonalSportSkillTableControl1"), PersonalSportSkillTableControl1).DataChanged = True + DirectCast(GetParentControlObject(Me, "PersonalSportSkillTableControl1"), PersonalSportSkillTableControl1).ResetData = True + End If + + + ' update session or cookie by formula + + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + ' For Master-Detail relationships, save data on the Detail table(s) + + End Sub + + ' To customize, override this method in PersonalSportSkillTableControl1Row. + 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. + + GetLevel3() + GetSportId1() + End Sub + + + Public Overridable Sub GetLevel3() + + ' Retrieve the value entered by the user on the Level ASP:TextBox, and + ' save it into the Level field in DataSource PersonalSportSkill record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.Level3.Text, PersonalSportSkillTable.Level) + + + End Sub + + Public Overridable Sub GetSportId1() + + ' Retrieve the value entered by the user on the SportId ASP:DropDownList, and + ' save it into the SportId field in DataSource PersonalSportSkill record. + + ' Custom validation should be performed in Validate, not here. + + Me.DataSource.Parse(GetValueSelectedPageRequest(Me.SportId1), PersonalSportSkillTable.SportId) + + End Sub + + + ' To customize, override this method in PersonalSportSkillTableControl1Row. + + Public Overridable Function CreateWhereClause() As WhereClause + + Return Nothing + + End Function + + + + ' To customize, override this method in PersonalSportSkillTableControl1Row. + 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) + PersonalSportSkillTable.DeleteRecord(pkValue) + + DirectCast(GetParentControlObject(Me, "PersonalSportSkillTableControl1"), PersonalSportSkillTableControl1).DataChanged = True + DirectCast(GetParentControlObject(Me, "PersonalSportSkillTableControl1"), PersonalSportSkillTableControl1).ResetData = True + End Sub + + Protected Overridable Sub Control_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.PreRender + ' PreRender event is raised just before page is being displayed. + Try + DbUtils.StartTransaction() + Me.RegisterPostback() + + If Not Me.Page.ErrorOnPage AndAlso (Me.Page.IsPageRefresh OrElse Me.DataChanged OrElse Me.ResetData) Then + + + ' Re-load the data and update the web page if necessary. + ' This is typically done during a postback (filter, search button, sort, pagination button). + ' In each of the other click handlers, simply set DataChanged to True to reload the data. + Me.LoadData() + Me.DataBind() + End If + + + Catch ex As Exception + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + Finally + DbUtils.EndTransaction() + End Try + End Sub + + + Protected Overrides Sub SaveControlsToSession() + MyBase.SaveControlsToSession() + + + 'Save pagination state to session. + + End Sub + + + + Protected Overrides Sub ClearControlsFromSession() + MyBase.ClearControlsFromSession() + + + + ' Clear pagination state from session. + + End Sub + + Protected Overrides Sub LoadViewState(ByVal savedState As Object) + MyBase.LoadViewState(savedState) + Dim isNewRecord As String = CType(ViewState("IsNewRecord"), String) + If Not isNewRecord Is Nothing AndAlso isNewRecord.Trim <> "" Then + Me.IsNewRecord = Boolean.Parse(isNewRecord) + End If + + Dim myCheckSum As String = CType(ViewState("CheckSum"), String) + If Not myCheckSum Is Nothing AndAlso myCheckSum.Trim <> "" Then + Me.CheckSum = myCheckSum + End If + + + ' Load view state for pagination control. + + End Sub + + Protected Overrides Function SaveViewState() As Object + ViewState("IsNewRecord") = Me.IsNewRecord.ToString() + ViewState("CheckSum") = Me.CheckSum + + + ' Load view state for pagination control. + + Return MyBase.SaveViewState() + End Function + + + + Public Overridable Function CreateWhereClause_SportId1DropDownList() 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 Sport table. + ' Examples: + ' wc.iAND(SportTable.SPORT, BaseFilter.ComparisonOperator.EqualsTo, "XYZ") + ' wc.iAND(SportTable.Active, BaseFilter.ComparisonOperator.EqualsTo, "1") + + Dim wc As WhereClause = New WhereClause() + Return wc + + End Function + + + ' Fill the SportId1 list. + Protected Overridable Sub PopulateSportId1DropDownList( _ + ByVal selectedValue As String, _ + ByVal maxItems As Integer) + + Me.SportId1.Items.Clear() + + + ' 1. Setup the static list items + + ' Add the Please Select item. + Me.SportId1.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_SportId1DropDownList function. + ' It is better to customize the where clause there. + + Dim wc As WhereClause = CreateWhereClause_SportId1DropDownList() + ' Create the ORDER BY clause to sort based on the displayed value. + + + Dim orderBy As OrderBy = New OrderBy(false, false) + orderBy.Add(SportTable.SPORT, 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 SportRecord = 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 = SportTable.GetRecords(wc, orderBy, pageNum, maxItems) + For each itemValue As SportRecord In itemValues + ' Create the item and add to the list. + Dim cvalue As String = Nothing + Dim fvalue As String = Nothing + If itemValue.SportIdSpecified Then + cvalue = itemValue.SportId.ToString() + + If counter < maxItems AndAlso Me.SportId1.Items.FindByValue(cvalue) Is Nothing Then + + Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalSportSkillTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalSportSkillTable.SportId) + If _isExpandableNonCompositeForeignKey AndAlso PersonalSportSkillTable.SportId.IsApplyDisplayAs Then + fvalue = PersonalSportSkillTable.GetDFKA(itemValue, PersonalSportSkillTable.SportId) + End If + If (Not _isExpandableNonCompositeForeignKey) Or (String.IsNullOrEmpty(fvalue)) Then + fvalue = itemValue.Format(SportTable.SPORT) + 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.SportId1.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.SportId1.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.SportId1, selectedValue) AndAlso _ + Not SetSelectedDisplayText(Me.SportId1, selectedValue)Then + + ' construct a whereclause to query a record with Sport.SportId = selectedValue + Dim filter2 As CompoundFilter = New CompoundFilter(CompoundFilter.CompoundingOperators.And_Operator, Nothing) + Dim whereClause2 As WhereClause = New WhereClause() + filter2.AddFilter(New BaseClasses.Data.ColumnValueFilter(SportTable.SportId, selectedValue, BaseClasses.Data.BaseFilter.ComparisonOperator.EqualsTo, False)) + whereClause2.AddFilter(filter2, CompoundFilter.CompoundingOperators.And_Operator) + + Try + ' Execute the query + Dim rc() As SportRecord = SportTable.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 SportRecord = DirectCast(rc(0), SportRecord) + ' Create the item and add to the list. + Dim cvalue As String = Nothing + Dim fvalue As String = Nothing + If itemValue.SportIdSpecified Then + cvalue = itemValue.SportId.ToString() + Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalSportSkillTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalSportSkillTable.SportId) + If _isExpandableNonCompositeForeignKey AndAlso PersonalSportSkillTable.SportId.IsApplyDisplayAs Then + fvalue = PersonalSportSkillTable.GetDFKA(itemValue, PersonalSportSkillTable.SportId) + End If + If (Not _isExpandableNonCompositeForeignKey) Or (String.IsNullOrEmpty(fvalue)) Then + fvalue = itemValue.Format(SportTable.SPORT) + End If + + If fvalue Is Nothing OrElse fvalue.Trim() = "" Then fvalue = cvalue + Dim newItem As New ListItem(fvalue, cvalue) + Me.SportId1.Items.Add(newItem) + SetSelectedValue(Me.SportId1, selectedValue) + End If + End If + Catch + End Try + + End If + + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalSportSkillRowDeleteButton1_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + If(Not Me.Page.IsPageRefresh) Then + + Dim tc As PersonalSportSkillTableControl1 = DirectCast(GetParentControlObject(Me, "PersonalSportSkillTableControl1"), PersonalSportSkillTableControl1) + If Not (IsNothing(tc)) Then + If Not Me.IsNewRecord Then + tc.AddToDeletedRecordIds(DirectCast(Me, PersonalSportSkillTableControl1Row)) + End If + Me.Visible = False + tc.SetFormulaControls() + End If + + End If + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalSportSkillRowEditButton1_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + ' The redirect URL is set on the Properties, Custom Properties or Actions. + ' The ModifyRedirectURL call resolves the parameters before the + ' Response.Redirect redirects the page to the URL. + ' Any code after the Response.Redirect call will not be executed, since the page is + ' redirected to the URL. + + + Dim url As String = "../Shared/ConfigureEditRecord.aspx" + + Dim shouldRedirect As Boolean = True + Dim TargetKey As String = Nothing + Dim DFKA As String = TargetKey + Dim id As String = DFKA + Dim value As String = id + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + url = Me.ModifyRedirectUrl(url, "",False) + url = Me.Page.ModifyRedirectUrl(url, "",False) + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + shouldRedirect = False + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + If shouldRedirect Then + Me.Page.ShouldSaveControlsToSession = True + Me.Page.Response.Redirect(url) + ElseIf Not TargetKey Is Nothing AndAlso _ + Not shouldRedirect Then + Me.Page.ShouldSaveControlsToSession = True + Me.Page.CloseWindow(True) + + End If + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalSportSkillRowViewButton1_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + ' The redirect URL is set on the Properties, Custom Properties or Actions. + ' The ModifyRedirectURL call resolves the parameters before the + ' Response.Redirect redirects the page to the URL. + ' Any code after the Response.Redirect call will not be executed, since the page is + ' redirected to the URL. + + + Dim url As String = "../Shared/ConfigureViewRecord.aspx" + + Dim shouldRedirect As Boolean = True + Dim TargetKey As String = Nothing + Dim DFKA As String = TargetKey + Dim id As String = DFKA + Dim value As String = id + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + url = Me.ModifyRedirectUrl(url, "",False) + url = Me.Page.ModifyRedirectUrl(url, "",False) + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + shouldRedirect = False + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + If shouldRedirect Then + Me.Page.ShouldSaveControlsToSession = True + Me.Page.Response.Redirect(url) + ElseIf Not TargetKey Is Nothing AndAlso _ + Not shouldRedirect Then + Me.Page.ShouldSaveControlsToSession = True + Me.Page.CloseWindow(True) + + End If + End Sub + + Protected Overridable Sub SportId1_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()(SportId1.ClientID & "_SelectedValue"), String) + Dim displayText As String = CType(Me.Page.Session()(SportId1.ClientID & "_SelectedDisplayText"), String) + If displayText <> "" AndAlso val <> "" Then + Me.SportId1.Items.Add(New ListItem(displayText, val)) + Me.SportId1.SelectedIndex = Me.SportId1.Items.Count - 1 + Me.Page.Session.Remove(SportId1.ClientID & "_SelectedValue") + Me.Page.Session.Remove(SportId1.ClientID & "_SelectedDisplayText") + End If + + + + + End Sub + + Protected Overridable Sub Level3_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("BasePersonalSportSkillTableControl1Row_Rec"), String) + End Get + Set(ByVal value As String) + Me.ViewState("BasePersonalSportSkillTableControl1Row_Rec") = value + End Set + End Property + + Private _DataSource As PersonalSportSkillRecord + Public Property DataSource() As PersonalSportSkillRecord + Get + Return Me._DataSource + End Get + + Set(ByVal value As PersonalSportSkillRecord) + + Me._DataSource = value + End Set + End Property + + + + Private _checkSum As String + Public Overridable Property CheckSum() As String + Get + Return Me._checkSum + End Get + Set(ByVal value As String) + Me._checkSum = value + End Set + End Property + + Private _TotalPages As Integer + Public Property TotalPages() As Integer + Get + Return Me._TotalPages + End Get + Set(ByVal value As Integer) + Me._TotalPages = value + End Set + End Property + + Private _PageIndex As Integer + Public Property PageIndex() As Integer + Get + ' Return the PageIndex + Return Me._PageIndex + End Get + Set(ByVal value As Integer) + Me._PageIndex = value + End Set + End Property + + Private _DisplayLastPage As Boolean + Public Property DisplayLastPage() As Boolean + Get + Return Me._DisplayLastPage + End Get + Set(ByVal value As Boolean) + Me._DisplayLastPage = value + End Set + End Property + + + +#Region "Helper Properties" + + Public ReadOnly Property Level3() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Level3"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property PersonalSportSkillRecordRowSelection1() As System.Web.UI.WebControls.CheckBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalSportSkillRecordRowSelection1"), System.Web.UI.WebControls.CheckBox) + End Get + End Property + + Public ReadOnly Property PersonalSportSkillRowDeleteButton1() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalSportSkillRowDeleteButton1"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalSportSkillRowEditButton1() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalSportSkillRowEditButton1"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalSportSkillRowViewButton1() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalSportSkillRowViewButton1"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property SportId1() As System.Web.UI.WebControls.DropDownList + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "SportId1"), System.Web.UI.WebControls.DropDownList) + End Get + End Property + + Public ReadOnly Property SportId1AddRecordLink() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "SportId1AddRecordLink"), System.Web.UI.WebControls.ImageButton) + 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 PersonalSportSkillRecord = 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 PersonalSportSkillRecord + If Not Me.DataSource Is Nothing Then + Return Me.DataSource + End If + + If Not Me.RecordUniqueId Is Nothing Then + + Return PersonalSportSkillTable.GetRecord(Me.RecordUniqueId, True) + + End If + + ' Localization. + + Return Nothing + + End Function + + Public Shadows ReadOnly Property Page() As BaseApplicationPage + Get + Return DirectCast(MyBase.Page, BaseApplicationPage) + End Get + End Property + +#End Region + +End Class + + + +' Base class for the PersonalSportSkillTableControl1 control on the EditPersonalId page. +' Do not modify this class. Instead override any method in PersonalSportSkillTableControl1. +Public Class BasePersonalSportSkillTableControl1 + Inherits Persons.UI.BaseApplicationTableControl + + + + Protected Overridable Sub Control_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Init + + + + ' Setup the filter and search events. + + + + ' Control Initializations. + ' Initialize the table's current sort order. + + If Me.InSession(Me, "Order_By") Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + End If + + + + ' Setup default pagination settings. + + Me.PageSize = CInt(Me.GetFromSession(Me, "Page_Size", "10")) + Me.PageIndex = CInt(Me.GetFromSession(Me, "Page_Index", "0")) + + + + Me.ClearControlsFromSession() + End Sub + + Protected Overridable Sub Control_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load + + SaveControlsToSession_Ajax() + + ' Show confirmation message on Click + Me.PersonalSportSkillDeleteButton1.Attributes.Add("onClick", "return (confirm('" & (CType(Me.Page,BaseApplicationPage)).GetResourceValue("DeleteConfirm", "Persons") & "'));") + + ' Setup the pagination events. + + AddHandler Me.PersonalSportSkillPagination1.FirstPage.Click, AddressOf PersonalSportSkillPagination1_FirstPage_Click + + AddHandler Me.PersonalSportSkillPagination1.LastPage.Click, AddressOf PersonalSportSkillPagination1_LastPage_Click + + AddHandler Me.PersonalSportSkillPagination1.NextPage.Click, AddressOf PersonalSportSkillPagination1_NextPage_Click + + AddHandler Me.PersonalSportSkillPagination1.PageSizeButton.Click, AddressOf PersonalSportSkillPagination1_PageSizeButton_Click + + AddHandler Me.PersonalSportSkillPagination1.PreviousPage.Click, AddressOf PersonalSportSkillPagination1_PreviousPage_Click + + + ' Setup the sorting events. + + AddHandler Me.LevelLabel.Click, AddressOf LevelLabel_Click + + AddHandler Me.SportIdLabel2.Click, AddressOf SportIdLabel2_Click + + ' Setup the button events. + + AddHandler Me.PersonalSportSkillAddButton1.Click, AddressOf PersonalSportSkillAddButton1_Click + + AddHandler Me.PersonalSportSkillDeleteButton1.Click, AddressOf PersonalSportSkillDeleteButton1_Click + + AddHandler Me.PersonalSportSkillEditButton1.Click, AddressOf PersonalSportSkillEditButton1_Click + + AddHandler Me.PersonalSportSkillRefreshButton.Click, AddressOf PersonalSportSkillRefreshButton_Click + + AddHandler Me.PersonalSportSkillResetButton1.Click, AddressOf PersonalSportSkillResetButton1_Click + + AddHandler Me.PersonalSportSkillSaveButton.Click, AddressOf PersonalSportSkillSaveButton_Click + + Me.PersonalSportSkillSaveButton.Attributes.Add("onclick", "SubmitHRefOnce(this, """ & Me.Page.GetResourceValue("Txt:SaveRecord", "Persons") & """);") + + + ' Setup events for others + + End Sub + + + Public Overridable Sub LoadData() + + ' Read data from database. Returns an array of records that can be assigned + ' to the DataSource table control property. + Try + Dim joinFilter As CompoundFilter = CreateCompoundJoinFilter() + + ' The WHERE clause will be empty when displaying all records in table. + Dim wc As WhereClause = CreateWhereClause() + If wc IsNot Nothing AndAlso Not wc.RunQuery Then + ' Initialize an empty array of records + Dim alist As New ArrayList(0) + Me.DataSource = DirectCast(alist.ToArray(GetType(PersonalSportSkillRecord)), PersonalSportSkillRecord()) + ' Add records to the list if needed. + Me.AddNewRecords() + Me._TotalRecords = 0 + Me._TotalPages = 0 + Return + End If + + ' Call OrderBy to determine the order - either use the order defined + ' on the Query Wizard, or specified by user (by clicking on column heading) + Dim orderBy As OrderBy = CreateOrderBy() + + ' Get the pagesize from the pagesize control. + Me.GetPageSize() + + If Me.DisplayLastPage Then + Dim totalRecords As Integer = If(Me._TotalRecords < 0, PersonalSportSkillTable.GetRecordCount(CreateCompoundJoinFilter(), CreateWhereClause()), Me._TotalRecords) + + Dim totalPages As Integer = CInt(Math.Ceiling(totalRecords / Me.PageSize)) + + Me.PageIndex = totalPages - 1 + End If + + ' Make sure PageIndex (current page) and PageSize are within bounds. + If Me.PageIndex < 0 Then + Me.PageIndex = 0 + End If + If Me.PageSize < 1 Then + Me.PageSize = 1 + End If + + ' Retrieve the records and set the table DataSource. + ' Only PageSize records are fetched starting at PageIndex (zero based). + If Me.AddNewRecord > 0 Then + ' Make sure to preserve the previously entered data on new rows. + Dim postdata As New ArrayList + For Each rc As PersonalSportSkillTableControl1Row In Me.GetRecordControls() + If Not rc.IsNewRecord Then + rc.DataSource = rc.GetRecord() + rc.GetUIData() + postdata.Add(rc.DataSource) + UIData.Add(rc.PreservedUIData()) + End If + Next + Me.DataSource = DirectCast(postdata.ToArray(GetType(PersonalSportSkillRecord)), PersonalSportSkillRecord()) + Else ' Get the records from the database + Me.DataSource = PersonalSportSkillTable.GetRecords(joinFilter, wc, orderBy, Me.PageIndex, Me.PageSize) + + End If + + ' if the datasource contains no records contained in database, then load the last page. + If (DbUtils.GetCreatedRecords(Me.DataSource).Length = 0 AndAlso Not Me.DisplayLastPage) Then + Me.DisplayLastPage = True + LoadData() + Else + + ' Add any new rows desired by the user. + Me.AddNewRecords() + + ' Turn off the ToggleAll checkbox + Me.PersonalSportSkillToggleAll1.Checked = False + + + ' Initialize the page and grand totals. now + + End If + + Catch ex As Exception + ' Report the error message to the end user + Dim msg As String = ex.Message + If ex.InnerException IsNot Nothing Then + msg = msg & " InnerException: " & ex.InnerException.Message + End If + Throw New Exception(msg, ex.InnerException) + End Try + End Sub + + + + + Public Overrides Sub DataBind() + ' The DataBind method binds the user interface controls to the values + ' from the database record for each row in the table. To do this, it calls the + ' DataBind for each of the rows. + ' DataBind also populates any filters above the table, and sets the pagination + ' control to the correct number of records and the current page number. + + MyBase.DataBind() + + ' Make sure that the DataSource is initialized. + If Me.DataSource Is Nothing Then + Return + End If + + 'LoadData for DataSource for chart and report if they exist + + ' Improve performance by prefetching display as records. + Me.PreFetchForeignKeyValues() + + ' Setup the pagination controls. + BindPaginationControls() + + + + ' Bind the repeater with the list of records to expand the UI. + Dim rep As System.Web.UI.WebControls.Repeater = CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalSportSkillTableControl1Repeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return + rep.DataSource = DataSource() + rep.DataBind() + + Dim index As Integer = 0 + For Each repItem As System.Web.UI.WebControls.RepeaterItem In rep.Items + ' Loop through all rows in the table, set its DataSource and call DataBind(). + Dim recControl As PersonalSportSkillTableControl1Row = DirectCast(repItem.FindControl("PersonalSportSkillTableControl1Row"), PersonalSportSkillTableControl1Row) + recControl.DataSource = Me.DataSource(index) + If Me.UIData.Count > index Then + recControl.PreviousUIData = Me.UIData(index) + End If + recControl.DataBind() + recControl.Visible = Not Me.InDeletedRecordIds(recControl) + + index += 1 + Next + + + + + ' Call the Set methods for each controls on the panel + + SetLevelLabel() + + + + + + + + SetPersonalSportSkillTableControl1CollapsibleRegion() + + SetSportIdLabel2() + ' setting the state of expand or collapse alternative rows + + + ' Load data for each record and table UI control. + ' Ordering is important because child controls get + ' their parent ids from their parent UI controls. + + + ' this method calls the set method for controls with special formula like running total, sum, rank, etc + SetFormulaControls() + End Sub + + Public Overridable Sub SetFormulaControls() + ' this method calls Set methods for the control that has special formula + + + + End Sub + + + Public Sub PreFetchForeignKeyValues() + If (IsNothing(Me.DataSource)) + Return + End If + + Me.Page.PregetDfkaRecords(PersonalSportSkillTable.SportId, Me.DataSource) + + End Sub + + + Public Overridable Sub RegisterPostback() + + Me.Page.RegisterPostBackTrigger(MiscUtils.FindControlRecursively(Me,"PersonalSportSkillSaveButton")) + + + End Sub + + Public EvaluateFormulaDelegate As BaseClasses.Data.DataSource.EvaluateFormulaDelegate = New BaseClasses.Data.DataSource.EvaluateFormulaDelegate(AddressOf Me.EvaluateFormula) + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean, ByVal e as FormulaEvaluator) As String + If e Is Nothing + e = New FormulaEvaluator() + End If + + e.Variables.Clear() + + + ' add variables for formula evaluation + If variables IsNot Nothing Then + Dim enumerator As System.Collections.Generic.IEnumerator(Of System.Collections.Generic.KeyValuePair(Of String, Object)) = variables.GetEnumerator() + While enumerator.MoveNext() + e.Variables.Add(enumerator.Current.Key, enumerator.Current.Value) + End While + End If + + If includeDS + + End If + + ' All variables referred to in the formula are expected to be + ' properties of the DataSource. For example, referring to + ' UnitPrice as a variable will refer to DataSource.UnitPrice + e.DataSource = dataSourceForEvaluate + + ' Define the calling control. This is used to add other + ' related table and record controls as variables. + e.CallingControl = Me + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + + If Not String.IsNullOrEmpty(format) AndAlso (String.IsNullOrEmpty(formula) OrElse formula.IndexOf("Format(") < 0) Then + Return FormulaUtils.Format(resultObj, format) + Else + Return resultObj.ToString() + End If + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format,variables ,includeDS, Nothing) + End Function + + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object)) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format, variables ,True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, format, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal e as FormulaEvaluator) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, variables, True, e) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal includeDS as Boolean) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, includeDS, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, True, Nothing) + End Function + + + + + Public Overridable Sub ResetControl() + + Me.CurrentSortOrder.Reset() + If (Me.InSession(Me, "Order_By")) Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + End If + + Me.PageIndex = 0 + End Sub + + Protected Overridable Sub BindPaginationControls() + ' Setup the pagination controls. + + ' Bind the pagination labels. + + If DbUtils.GetCreatedRecords(Me.DataSource).Length > 0 Then + + Me.PersonalSportSkillPagination1.CurrentPage.Text = (Me.PageIndex + 1).ToString() + Else + Me.PersonalSportSkillPagination1.CurrentPage.Text = "0" + End If + Me.PersonalSportSkillPagination1.PageSize.Text = Me.PageSize.ToString() + Me.PersonalSportSkillPagination1.TotalItems.Text = Me.TotalRecords.ToString() + Me.PersonalSportSkillPagination1.TotalPages.Text = Me.TotalPages.ToString() + + ' Bind the buttons for PersonalSportSkillTableControl1 pagination. + + Me.PersonalSportSkillPagination1.FirstPage.Enabled = Not (Me.PageIndex = 0) + If Me._TotalPages < 0 Then ' if the total pages is not determined yet, enable last and next buttons + Me.PersonalSportSkillPagination1.LastPage.Enabled = True + ElseIf Me._TotalPages = 0 ' if the total pages is determined and it is 0, enable last and next buttons + Me.PersonalSportSkillPagination1.LastPage.Enabled = False + Else ' if the total pages is the last page, disable last and next buttons + Me.PersonalSportSkillPagination1.LastPage.Enabled = Not (Me.PageIndex = Me.TotalPages - 1) + End If + + If Me._TotalPages < 0 Then ' if the total pages is not determined yet, enable last and next buttons + Me.PersonalSportSkillPagination1.NextPage.Enabled = True + ElseIf Me._TotalPages = 0 ' if the total pages is determined and it is 0, enable last and next buttons + Me.PersonalSportSkillPagination1.NextPage.Enabled = False + Else ' if the total pages is the last page, disable last and next buttons + Me.PersonalSportSkillPagination1.NextPage.Enabled = Not (Me.PageIndex = Me.TotalPages - 1) + End If + + Me.PersonalSportSkillPagination1.PreviousPage.Enabled = Not (Me.PageIndex = 0) + + + End Sub + + Public Overridable Sub SaveData() + ' Save the data from the entire table. Calls each row's Save Data + ' to save their data. This function is called by the Click handler of the + ' Save button. The button handler should Start/Commit/End a transaction. + + Dim recCtl As PersonalSportSkillTableControl1Row + For Each recCtl In Me.GetRecordControls() + + If Me.InDeletedRecordIds(recCtl) Then + ' Delete any pending deletes. + recCtl.Delete() + Else + If recCtl.Visible Then + recCtl.SaveData() + End If + End If + + Next + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + ' Set IsNewRecord to False for all records - since everything has been saved and is no longer "new" + For Each recCtl In Me.GetRecordControls() + recCtl.IsNewRecord = False + Next + + + ' Set DeletedRecordsIds to Nothing since we have deleted all pending deletes. + Me.DeletedRecordIds = Nothing + + End Sub + + Public Overridable Function CreateCompoundJoinFilter() As CompoundFilter + Dim jFilter As CompoundFilter = New CompoundFilter() + + Return jFilter + + End Function + + + Public Overridable Function CreateOrderBy() As OrderBy + ' The CurrentSortOrder is initialized to the sort order on the + ' Query Wizard. It may be modified by the Click handler for any of + ' the column heading to sort or reverse sort by that column. + ' You can add your own sort order, or modify it on the Query Wizard. + Return Me.CurrentSortOrder + End Function + + Public Overridable Function CreateWhereClause() As WhereClause + 'This CreateWhereClause is used for loading the data. + PersonalSportSkillTable.Instance.InnerFilter = Nothing + Dim wc As WhereClause = New WhereClause() + + ' Compose the WHERE clause consiting of: + ' 1. Static clause defined at design time. + ' 2. User selected search criteria. + ' 3. User selected filter criteria. + + + Dim selectedRecordKeyValue as KeyValue = New KeyValue() + + Dim personalIdRecordControlObj As Persons.UI.Controls.EditPersonalId.PersonalIdRecordControl = DirectCast(MiscUtils.FindControlRecursively(Me.Page, "PersonalIdRecordControl"), Persons.UI.Controls.EditPersonalId.PersonalIdRecordControl) + + If (Not IsNothing(personalIdRecordControlObj) AndAlso Not IsNothing(personalIdRecordControlObj.GetRecord()) AndAlso personalIdRecordControlObj.GetRecord().IsCreated AndAlso Not IsNothing(personalIdRecordControlObj.GetRecord().PersonalId)) + wc.iAND(PersonalSportSkillTable.PersonalId, BaseFilter.ComparisonOperator.EqualsTo, personalIdRecordControlObj.GetRecord().PersonalId.ToString()) + selectedRecordKeyValue.AddElement(PersonalSportSkillTable.PersonalId.InternalName, personalIdRecordControlObj.GetRecord().PersonalId.ToString()) + Else + wc.RunQuery = False + Return wc + End If + + HttpContext.Current.Session("PersonalSportSkillTableControl1WhereClause") = selectedRecordKeyValue.ToXmlString() + + Return wc + End Function + + + Public Overridable Function CreateWhereClause(ByVal searchText as String, ByVal fromSearchControl as String, ByVal AutoTypeAheadSearch as String, ByVal AutoTypeAheadWordSeparators as String) As WhereClause + ' This CreateWhereClause is used for loading list of suggestions for Auto Type-Ahead feature. + PersonalSportSkillTable.Instance.InnerFilter = Nothing + Dim wc As WhereClause = New WhereClause() + + ' Compose the WHERE clause consiting of: + ' 1. Static clause defined at design time. + ' 2. User selected search criteria. + ' 3. User selected filter criteria. + + Dim appRelativeVirtualPath As String = CType(HttpContext.Current.Session("AppRelativeVirtualPath"), String) + + Dim selectedRecordInPersonalIdRecordControl as String = DirectCast(HttpContext.Current.Session("PersonalSportSkillTableControl1WhereClause"), String) + + If Not selectedRecordInPersonalIdRecordControl Is Nothing AndAlso KeyValue.IsXmlKey(selectedRecordInPersonalIdRecordControl) Then + Dim selectedRecordKeyValue as KeyValue = KeyValue.XmlToKey(selectedRecordInPersonalIdRecordControl) + + If Not IsNothing(selectedRecordKeyValue) AndAlso selectedRecordKeyValue.ContainsColumn(PersonalSportSkillTable.PersonalId) Then + wc.iAND(PersonalSportSkillTable.PersonalId, BaseFilter.ComparisonOperator.EqualsTo, selectedRecordKeyValue.GetColumnValue(PersonalSportSkillTable.PersonalId).ToString()) + End If + + End If + + ' Adds clauses if values are selected in Filter controls which are configured in the page. + + + Return wc + End Function + + + Public Overridable Function FormatSuggestions(ByVal prefixText As String, ByVal resultItem As String, _ + ByVal columnLength As Integer, ByVal AutoTypeAheadDisplayFoundText As String, _ + ByVal autoTypeAheadSearch As String, ByVal AutoTypeAheadWordSeparators As String, _ + ByVal resultList As ArrayList) As Boolean + + 'Formats the resultItem and adds it to the list of suggestions. + Dim index As Integer = resultItem.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture).IndexOf(prefixText.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture)) + Dim itemToAdd As String = "" + Dim isFound As Boolean = False + Dim isAdded As Boolean = False + ' Get the index where prfixt is at the beginning of resultItem. If not found then, index of word which begins with prefixText. + If InvariantLCase(autoTypeAheadSearch).equals("wordsstartingwithsearchstring") And Not index = 0 Then + ' Expression to find word which contains AutoTypeAheadWordSeparators followed by prefixText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex( AutoTypeAheadWordSeparators + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + If regex1.IsMatch(resultItem) Then + index = regex1.Match(resultItem).Index + isFound = True + End If + ' If the prefixText is found immediatly after white space then starting of the word is found so don not search any further + If not resultItem(index).ToString() = " " Then + ' Expression to find beginning of the word which contains AutoTypeAheadWordSeparators followed by prefixText + Dim regex As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\\S*" + AutoTypeAheadWordSeparators + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + If regex.IsMatch(resultItem) Then + index = regex.Match(resultItem).Index + isFound = True + End If + End If + End If + + ' If autoTypeAheadSearch value is wordsstartingwithsearchstring then, extract the substring only if the prefixText is found at the + ' beginning of the resultItem (index = 0) or a word in resultItem is found starts with prefixText. + If index = 0 Or isFound Or InvariantLCase(autoTypeAheadSearch).Equals("anywhereinstring") then + If InvariantLCase(AutoTypeAheadDisplayFoundText).equals("atbeginningofmatchedstring") Then + ' Expression to find beginning of the word which contains prefixText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\\S*" + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + ' Find the beginning of the word which contains prefexText + If (StringUtils.InvariantLCase(autoTypeAheadSearch).Equals("anywhereinstring") AndAlso regex1.IsMatch(resultItem)) Then + index = regex1.Match(resultItem).Index + isFound = True + End If + ' Display string from the index till end of the string if sub string from index till end is less than columnLength value. + If Len(resultItem) - index <= columnLength Then + If index = 0 Then + itemToAdd = resultItem + Else + itemToAdd = "..." & resultItem.Substring(index, Len(resultItem) - index) + End If + Else + If index = 0 Then + itemToAdd = resultItem.Substring(index, (columnLength - 3)) & "..." + Else + 'Truncate the string to show only columnLength - 6 characters as begining and trailing "..." has to be appended. + itemToAdd = "..." & resultItem.Substring(index , columnLength - 6) & "..." + End If + End If + ElseIf InvariantLCase(AutoTypeAheadDisplayFoundText).equals("inmiddleofmatchedstring") Then + Dim subStringBeginIndex As Integer = CType(columnLength/2, Integer) + If Len(resultItem) <= columnLength Then + itemToAdd = resultItem + Else + ' Sanity check at end of the string + If index + Len(prefixText) = columnLength Then + itemToAdd = "..." & resultItem.Substring(index-columnLength,index) + ElseIf Len(resultItem) - index < subStringBeginIndex Then + ' Display string from the end till columnLength value if, index is closer to the end of the string. + itemToAdd = "..." & resultItem.Substring(Len(resultItem)-columnLength,Len(resultItem)) + ElseIf index <= subStringBeginIndex Then + ' Sanity chet at beginning of the string + itemToAdd = resultItem.Substring(0, columnLength) & "..." + Else + ' Display string containing text before the prefixText occures and text after the prefixText + itemToAdd = "..." & resultItem.Substring(index - subStringBeginIndex, columnLength) & "..." + End If + End If + ElseIf InvariantLCase(AutoTypeAheadDisplayFoundText).equals("atendofmatchedstring") Then + ' Expression to find ending of the word which contains prefexText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\s", System.Text.RegularExpressions.RegexOptions.IgnoreCase) + ' Find the ending of the word which contains prefexText + If regex1.IsMatch(resultItem, index + 1) Then + index = regex1.Match(resultItem, index + 1).Index + Else + ' If the word which contains prefexText is the last word in string, regex1.IsMatch returns false. + index = resultItem.Length + End If + If index > Len(resultItem) Then + index = Len(resultItem) + End If + ' If text from beginning of the string till index is less than columnLength value then, display string from the beginning till index. + If index <= columnLength Then + if index = Len(resultItem) Then 'Make decision to append "..." + itemToAdd = resultItem.Substring(0,index) + Else + itemToAdd = resultItem.Substring(0,index) & "..." + End If + Else + If index = Len(resultItem) Then + itemToAdd = "..." & resultItem.Substring(index - (columnLength - 3), (columnLength - 3)) + Else + 'Truncate the string to show only columnLength - 6 characters as begining and trailing "..." has to be appended. + itemToAdd = "..." & resultItem.Substring(index - (columnLength - 6), columnLength - 6) & "..." + End If + End If + End If + + ' Remove newline character from itemToAdd + Dim prefixTextIndex As Integer = itemToAdd.IndexOf(prefixText, StringComparison.CurrentCultureIgnoreCase) + ' If itemToAdd contains any newline after the search text then show text only till newline + Dim regex2 As System.Text.RegularExpressions.Regex = New System.Text.RegularExpressions.Regex("(" & vbCrLf & "|" & vbLf & ")", System.Text.RegularExpressions.RegexOptions.IgnoreCase) + Dim newLineIndexAfterPrefix As Integer = -1 + If regex2.IsMatch(itemToAdd, prefixTextIndex) Then + newLineIndexAfterPrefix = regex2.Match(itemToAdd, prefixTextIndex).Index + End If + If (newLineIndexAfterPrefix > -1) Then + If itemToAdd.EndsWith("...") Then + itemToAdd = (itemToAdd.Substring(0, newLineIndexAfterPrefix) + "...") + Else + itemToAdd = itemToAdd.Substring(0, newLineIndexAfterPrefix) + End If + End If + ' If itemToAdd contains any newline before search text then show text which comes after newline + Dim regex3 As System.Text.RegularExpressions.Regex = New System.Text.RegularExpressions.Regex("(" & vbCrLf & "|" & vbLf & ")", (System.Text.RegularExpressions.RegexOptions.IgnoreCase Or System.Text.RegularExpressions.RegexOptions.RightToLeft)) + Dim newLineIndexBeforePrefix As Integer = -1 + If regex3.IsMatch(itemToAdd, prefixTextIndex) Then + newLineIndexBeforePrefix = regex3.Match(itemToAdd, prefixTextIndex).Index + End If + If (newLineIndexBeforePrefix > -1) Then + If itemToAdd.StartsWith("...") Then + itemToAdd = ("..." + itemToAdd.Substring((newLineIndexBeforePrefix + regex3.Match(itemToAdd, prefixTextIndex).Length))) + Else + itemToAdd = itemToAdd.Substring((newLineIndexBeforePrefix + regex3.Match(itemToAdd, prefixTextIndex).Length)) + End If + End If + + If Not itemToAdd is nothing AndAlso Not resultList.Contains(itemToAdd) Then + + resultList.Add(itemToAdd) + + isAdded = true + End If + End If + Return isAdded + End Function + + + Protected Overridable Sub GetPageSize() + + If Me.PersonalSportSkillPagination1.PageSize.Text.Trim <> "" Then + Try + 'Me.PageSize = Integer.Parse(Me.PersonalSportSkillPagination1.PageSize.Text) + Catch ex As Exception + End Try + End If + End Sub + + Protected Overridable Sub AddNewRecords() + + Dim newRecordList As ArrayList = New ArrayList() + + Dim newUIDataList As System.Collections.Generic.List(Of Hashtable) = New System.Collections.Generic.List(Of Hashtable)() + + ' Loop though all the record controls and if the record control + ' does not have a unique record id set, then create a record + ' and add to the list. + If Not Me.ResetData Then + Dim rep As System.Web.UI.WebControls.Repeater = CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalSportSkillTableControl1Repeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return + + Dim repItem As System.Web.UI.WebControls.RepeaterItem + For Each repItem In rep.Items + ' Loop through all rows in the table, set its DataSource and call DataBind(). + + Dim recControl As PersonalSportSkillTableControl1Row = DirectCast(repItem.FindControl("PersonalSportSkillTableControl1Row"), PersonalSportSkillTableControl1Row) + + If recControl.Visible AndAlso recControl.IsNewRecord() Then + + Dim rec As PersonalSportSkillRecord = New PersonalSportSkillRecord() + + If recControl.Level3.Text <> "" Then + rec.Parse(recControl.Level3.Text, PersonalSportSkillTable.Level) + End If + If MiscUtils.IsValueSelected(recControl.SportId1) Then + rec.Parse(recControl.SportId1.SelectedItem.Value, PersonalSportSkillTable.SportId) + End If + newUIDataList.Add(recControl.PreservedUIData()) + newRecordList.Add(rec) + End If + Next + End If + + + ' Add any new record to the list. + Dim index As Integer = 0 + For index = 1 To Me.AddNewRecord + + newRecordList.Insert(0, New PersonalSportSkillRecord()) + newUIDataList.Insert(0, New Hashtable()) + + Next + Me.AddNewRecord = 0 + + ' Finally, add any new records to the DataSource. + If newRecordList.Count > 0 Then + + Dim finalList As ArrayList = New ArrayList(Me.DataSource) + finalList.InsertRange(0, newRecordList) + + Me.DataSource = DirectCast(finalList.ToArray(GetType(PersonalSportSkillRecord)), PersonalSportSkillRecord()) + + End If + + ' Add the existing UI data to this hash table + If newUIDataList.Count > 0 Then + Me.UIData.InsertRange(0, newUIDataList) + End If + + End Sub + + + Public Sub AddToDeletedRecordIds(ByVal rec As PersonalSportSkillTableControl1Row) + If rec.IsNewRecord() Then + Return + End If + + If Not Me.DeletedRecordIds Is Nothing AndAlso Me.DeletedRecordIds.Trim <> "" Then + Me.DeletedRecordIds &= "," + End If + + Me.DeletedRecordIds &= "[" & rec.RecordUniqueId & "]" + End Sub + + Protected Overridable Function InDeletedRecordIds(ByVal rec As PersonalSportSkillTableControl1Row) As Boolean + If Me.DeletedRecordIds Is Nothing OrElse Me.DeletedRecordIds.Trim = "" Then + Return False + End If + + Return Me.DeletedRecordIds.IndexOf("[" & rec.RecordUniqueId & "]") >= 0 + End Function + + Private _DeletedRecordIds As String + Public Property DeletedRecordIds() As String + Get + Return Me._DeletedRecordIds + End Get + Set(ByVal value As String) + Me._DeletedRecordIds = value + End Set + End Property + + + ' Create Set, WhereClause, and Populate Methods + + Public Overridable Sub SetLevelLabel() + + End Sub + + Public Overridable Sub SetPersonalSportSkillTableControl1CollapsibleRegion() + + End Sub + + Public Overridable Sub SetSportIdLabel2() + + 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. + Dim added As Boolean = Me.AddNewRecord > 0 + Me.LoadData() + Me.DataBind() + + If added Then + Me.SetFocusToAddedRow() + End If + + End If + + + + Catch ex As Exception + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + Finally + DbUtils.EndTransaction + End Try + End Sub + + 'this function sets focus to the first editable element in the new added row in the editable table + Protected Overridable Sub SetFocusToAddedRow() + Dim rep As System.Web.UI.WebControls.Repeater = CType(Me.FindControl("PersonalSportSkillTableControl1Repeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing OrElse rep.Items.Count = 0 Then Return + Dim repItem As System.Web.UI.WebControls.RepeaterItem + For Each repItem In rep.Items + 'Load scripts to table rows + Me.Page.LoadFocusScripts(repItem) + Dim recControl As PersonalSportSkillTableControl1Row = DirectCast(repItem.FindControl("PersonalSportSkillTableControl1Row"), PersonalSportSkillTableControl1Row) + If recControl.IsNewRecord Then + For Each field As Control In recControl.Controls + If field.Visible AndAlso Me.Page.IsControlEditable(field, False) Then + 'set focus on the first editable field in the new row + field.Focus() + Dim updPan As UpdatePanel = DirectCast(Me.Page.FindControlRecursively("UpdatePanel1"), UpdatePanel) + If Not updPan Is Nothing Then updPan.Update() + Return + End If + Next + Return + End If + Next + End Sub + + + Protected Overrides Sub SaveControlsToSession() + MyBase.SaveControlsToSession() + + ' Save filter controls to values to session. + + + 'Save pagination state to session. + + + + ' Save table control properties to the session. + If Not Me.CurrentSortOrder Is Nothing Then + Me.SaveToSession(Me, "Order_By", Me.CurrentSortOrder.ToXmlString()) + End If + + Me.SaveToSession(Me, "Page_Index", Me.PageIndex.ToString()) + Me.SaveToSession(Me, "Page_Size", Me.PageSize.ToString()) + + Me.SaveToSession(Me, "DeletedRecordIds", Me.DeletedRecordIds) + + End Sub + + Protected Sub SaveControlsToSession_Ajax() + ' Save filter controls to values to session. + + HttpContext.Current.Session("AppRelativeVirtualPath") = Me.Page.AppRelativeVirtualPath + + End Sub + + Protected Overrides Sub ClearControlsFromSession() + MyBase.ClearControlsFromSession() + + ' Clear filter controls values from the session. + + + ' Clear pagination state from session. + + + + ' Clear table properties from the session. + Me.RemoveFromSession(Me, "Order_By") + Me.RemoveFromSession(Me, "Page_Index") + Me.RemoveFromSession(Me, "Page_Size") + + Me.RemoveFromSession(Me, "DeletedRecordIds") + + End Sub + + Protected Overrides Sub LoadViewState(ByVal savedState As Object) + MyBase.LoadViewState(savedState) + + Dim orderByStr As String = CType(ViewState("PersonalSportSkillTableControl1_OrderBy"), String) + + If orderByStr IsNot Nothing AndAlso orderByStr.Trim <> "" Then + Me.CurrentSortOrder = BaseClasses.Data.OrderBy.FromXmlString(orderByStr) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + End If + + Dim pageIndex As String = CType(ViewState("Page_Index"), String) + If pageIndex IsNot Nothing Then + Me.PageIndex = CInt(pageIndex) + End If + + Dim pageSize As String = CType(ViewState("Page_Size"), String) + If Not pageSize Is Nothing Then + Me.PageSize = CInt(pageSize) + End If + + + + ' Load view state for pagination control. + + Me.DeletedRecordIds = CType(Me.ViewState("DeletedRecordIds"), String) + + End Sub + + Protected Overrides Function SaveViewState() As Object + + If Me.CurrentSortOrder IsNot Nothing Then + Me.ViewState("PersonalSportSkillTableControl1_OrderBy") = Me.CurrentSortOrder.ToXmlString() + End If + + Me.ViewState("Page_Index") = Me.PageIndex + Me.ViewState("Page_Size") = Me.PageSize + + Me.ViewState("DeletedRecordIds") = Me.DeletedRecordIds + + + ' Load view state for pagination control. + + + Return MyBase.SaveViewState() + End Function + + ' Generate the event handling functions for pagination events. + + ' event handler for ImageButton + Public Overridable Sub PersonalSportSkillPagination1_FirstPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.PageIndex = 0 + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalSportSkillPagination1_LastPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.DisplayLastPage = True + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalSportSkillPagination1_NextPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.PageIndex += 1 + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for LinkButton + Public Overridable Sub PersonalSportSkillPagination1_PageSizeButton_Click(ByVal sender As Object, ByVal args As EventArgs) + + Try + + Me.DataChanged = True + + Me.PageSize = Integer.Parse(Me.PersonalSportSkillPagination1.PageSize.Text) + + Me.PageIndex = Integer.Parse(Me.PersonalSportSkillPagination1.CurrentPage.Text) - 1 + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalSportSkillPagination1_PreviousPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + If Me.PageIndex > 0 Then + Me.PageIndex -= 1 + Me.DataChanged = True + End If + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + + ' Generate the event handling functions for sorting events. + + Public Overridable Sub LevelLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by Level when clicked. + + ' Get previous sorting state for Level. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalSportSkillTable.Level) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for Level. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalSportSkillTable.Level, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by Level, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub SportIdLabel2_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by SportId when clicked. + + ' Get previous sorting state for SportId. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalSportSkillTable.SportId) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for SportId. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalSportSkillTable.SportId, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by SportId, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + + ' Generate the event handling functions for button events. + + ' event handler for ImageButton + Public Overridable Sub PersonalSportSkillAddButton1_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + Me.AddNewRecord = 1 + Me.DataChanged = True + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalSportSkillDeleteButton1_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + If(Not Me.Page.IsPageRefresh) Then + + Me.DeleteSelectedRecords(True) + Me.SetFormulaControls() + + + End If + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalSportSkillEditButton1_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + ' The redirect URL is set on the Properties, Custom Properties or Actions. + ' The ModifyRedirectURL call resolves the parameters before the + ' Response.Redirect redirects the page to the URL. + ' Any code after the Response.Redirect call will not be executed, since the page is + ' redirected to the URL. + + + Dim url As String = "../Shared/ConfigureEditRecord.aspx" + + Dim shouldRedirect As Boolean = True + Dim TargetKey As String = Nothing + Dim DFKA As String = TargetKey + Dim id As String = DFKA + Dim value As String = id + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + url = Me.ModifyRedirectUrl(url, "",False) + url = Me.Page.ModifyRedirectUrl(url, "",False) + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + shouldRedirect = False + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + If shouldRedirect Then + Me.Page.ShouldSaveControlsToSession = True + Me.Page.Response.Redirect(url) + ElseIf Not TargetKey Is Nothing AndAlso _ + Not shouldRedirect Then + Me.Page.ShouldSaveControlsToSession = True + Me.Page.CloseWindow(True) + + End If + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalSportSkillRefreshButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Dim PersonalDDTableControlObj as PersonalDDTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalDDTableControl"), PersonalDDTableControl) + PersonalDDTableControlObj.ResetData = True + + PersonalDDTableControlObj.RemoveFromSession(PersonalDDTableControlObj, "DeletedRecordIds") + PersonalDDTableControlObj.DeletedRecordIds = Nothing + + Dim PersonalEducationTableControlObj as PersonalEducationTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalEducationTableControl"), PersonalEducationTableControl) + PersonalEducationTableControlObj.ResetData = True + + PersonalEducationTableControlObj.RemoveFromSession(PersonalEducationTableControlObj, "DeletedRecordIds") + PersonalEducationTableControlObj.DeletedRecordIds = Nothing + + Dim PersonalExtWorkTableControlObj as PersonalExtWorkTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalExtWorkTableControl"), PersonalExtWorkTableControl) + PersonalExtWorkTableControlObj.ResetData = True + + PersonalExtWorkTableControlObj.RemoveFromSession(PersonalExtWorkTableControlObj, "DeletedRecordIds") + PersonalExtWorkTableControlObj.DeletedRecordIds = Nothing + + Dim PersonalIdRecordControlObj as PersonalIdRecordControl = DirectCast(Me.Page.FindControlRecursively("PersonalIdRecordControl"), PersonalIdRecordControl) + PersonalIdRecordControlObj.ResetData = True + + + Dim PersonalInsigniaTableControlObj as PersonalInsigniaTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalInsigniaTableControl"), PersonalInsigniaTableControl) + PersonalInsigniaTableControlObj.ResetData = True + + PersonalInsigniaTableControlObj.RemoveFromSession(PersonalInsigniaTableControlObj, "DeletedRecordIds") + PersonalInsigniaTableControlObj.DeletedRecordIds = Nothing + + Dim PersonalLanguageSkillTableControlObj as PersonalLanguageSkillTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalLanguageSkillTableControl"), PersonalLanguageSkillTableControl) + PersonalLanguageSkillTableControlObj.ResetData = True + + PersonalLanguageSkillTableControlObj.RemoveFromSession(PersonalLanguageSkillTableControlObj, "DeletedRecordIds") + PersonalLanguageSkillTableControlObj.DeletedRecordIds = Nothing + + Dim PersonalNameTableControlObj as PersonalNameTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalNameTableControl"), PersonalNameTableControl) + PersonalNameTableControlObj.ResetData = True + + PersonalNameTableControlObj.RemoveFromSession(PersonalNameTableControlObj, "DeletedRecordIds") + PersonalNameTableControlObj.DeletedRecordIds = Nothing + + Dim PersonalRankTableControlObj as PersonalRankTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalRankTableControl"), PersonalRankTableControl) + PersonalRankTableControlObj.ResetData = True + + PersonalRankTableControlObj.RemoveFromSession(PersonalRankTableControlObj, "DeletedRecordIds") + PersonalRankTableControlObj.DeletedRecordIds = Nothing + + Dim PersonalSalaryTableControlObj as PersonalSalaryTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalSalaryTableControl"), PersonalSalaryTableControl) + PersonalSalaryTableControlObj.ResetData = True + + PersonalSalaryTableControlObj.RemoveFromSession(PersonalSalaryTableControlObj, "DeletedRecordIds") + PersonalSalaryTableControlObj.DeletedRecordIds = Nothing + + Dim PersonalSpecialSkillTableControlObj as PersonalSpecialSkillTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalSpecialSkillTableControl"), PersonalSpecialSkillTableControl) + PersonalSpecialSkillTableControlObj.ResetData = True + + PersonalSpecialSkillTableControlObj.RemoveFromSession(PersonalSpecialSkillTableControlObj, "DeletedRecordIds") + PersonalSpecialSkillTableControlObj.DeletedRecordIds = Nothing + + Dim PersonalSportSkillTableControl1Obj as PersonalSportSkillTableControl1 = DirectCast(Me.Page.FindControlRecursively("PersonalSportSkillTableControl1"), PersonalSportSkillTableControl1) + PersonalSportSkillTableControl1Obj.ResetData = True + + PersonalSportSkillTableControl1Obj.RemoveFromSession(PersonalSportSkillTableControl1Obj, "DeletedRecordIds") + PersonalSportSkillTableControl1Obj.DeletedRecordIds = Nothing + + Dim PersonalTitleTableControlObj as PersonalTitleTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalTitleTableControl"), PersonalTitleTableControl) + PersonalTitleTableControlObj.ResetData = True + + PersonalTitleTableControlObj.RemoveFromSession(PersonalTitleTableControlObj, "DeletedRecordIds") + PersonalTitleTableControlObj.DeletedRecordIds = Nothing + + Dim PersonRelativeTableControlObj as PersonRelativeTableControl = DirectCast(Me.Page.FindControlRecursively("PersonRelativeTableControl"), PersonRelativeTableControl) + PersonRelativeTableControlObj.ResetData = True + + PersonRelativeTableControlObj.RemoveFromSession(PersonRelativeTableControlObj, "DeletedRecordIds") + PersonRelativeTableControlObj.DeletedRecordIds = Nothing + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalSportSkillResetButton1_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.CurrentSortOrder.Reset() + If Me.InSession(Me, "Order_By") Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + + End If + + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalSportSkillSaveButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + + If (Not Me.Page.IsPageRefresh) Then + Me.SaveData() + End If + + Me.Page.CommitTransaction(sender) + ' Set IsNewRecord to False for all records - since everything has been saved and is no longer "new" + Dim recCtl As PersonalSportSkillTableControl1Row + For Each recCtl in Me.GetRecordControls() + + recCtl.IsNewRecord = False + Next + + + ' Set DeletedRecordsIds to Nothing since we have deleted all pending deletes. + + Me.DeletedRecordIds = Nothing + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + + + ' Generate the event handling functions for filter and search events. + + + ' Generate the event handling functions for others + + + Private _UIData As New System.Collections.Generic.List(Of Hashtable) + Public Property UIData() As System.Collections.Generic.List(Of Hashtable) + Get + Return Me._UIData + End Get + Set(ByVal value As System.Collections.Generic.List(Of Hashtable)) + Me._UIData = value + End Set + End Property + + ' pagination properties + Protected _PageSize As Integer + Public Property PageSize() As Integer + Get + Return Me._PageSize + End Get + Set(ByVal value As Integer) + Me._PageSize = value + End Set + End Property + + Protected _PageIndex As Integer + Public Property PageIndex() As Integer + Get + ' Return the PageIndex + Return Me._PageIndex + End Get + Set(ByVal value As Integer) + Me._PageIndex = value + End Set + End Property + + Protected _TotalRecords As Integer = -1 + Public Property TotalRecords() As Integer + Get + If _TotalRecords < 0 + _TotalRecords = PersonalSportSkillTable.GetRecordCount(CreateCompoundJoinFilter(), CreateWhereClause()) + End If + Return Me._TotalRecords + End Get + Set(ByVal value As Integer) + If Me.PageSize > 0 Then + + Me.TotalPages = CInt(Math.Ceiling(value / Me.PageSize)) + + End If + Me._TotalRecords = value + End Set + End Property + + + + Protected _TotalPages As Integer = -1 + Public Property TotalPages() As Integer + Get + If _TotalPages < 0 Then + + Me.TotalPages = CInt(Math.Ceiling(TotalRecords / Me.PageSize)) + + End If + Return Me._TotalPages + End Get + Set(ByVal value As Integer) + Me._TotalPages = value + End Set + End Property + + Protected _DisplayLastPage As Boolean + Public Property DisplayLastPage() As Boolean + Get + Return Me._DisplayLastPage + End Get + Set(ByVal value As Boolean) + Me._DisplayLastPage = value + End Set + End Property + + Private _DataChanged As Boolean = False + Public Property DataChanged() As Boolean + Get + Return Me._DataChanged + End Get + Set(ByVal value As Boolean) + Me._DataChanged = value + End Set + End Property + + Private _ResetData As Boolean = False + Public Property ResetData() As Boolean + Get + Return Me._ResetData + End Get + Set(ByVal value As Boolean) + Me._ResetData = value + End Set + End Property + + Private _AddNewRecord As Integer = 0 + Public Property AddNewRecord() As Integer + Get + Return Me._AddNewRecord + End Get + Set(ByVal value As Integer) + Me._AddNewRecord = value + End Set + End Property + + + Private _CurrentSortOrder As OrderBy = Nothing + Public Property CurrentSortOrder() As OrderBy + Get + Return Me._CurrentSortOrder + End Get + Set(ByVal value As BaseClasses.Data.OrderBy) + Me._CurrentSortOrder = value + End Set + End Property + + Private _DataSource() As PersonalSportSkillRecord = Nothing + Public Property DataSource() As PersonalSportSkillRecord () + Get + Return Me._DataSource + End Get + Set(ByVal value() As PersonalSportSkillRecord) + Me._DataSource = value + End Set + End Property + +#Region "Helper Properties" + + Public ReadOnly Property LevelLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "LevelLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property PersonalSportSkillAddButton1() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalSportSkillAddButton1"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalSportSkillDeleteButton1() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalSportSkillDeleteButton1"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalSportSkillEditButton1() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalSportSkillEditButton1"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalSportSkillPagination1() As Persons.UI.IPagination + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalSportSkillPagination1"), Persons.UI.IPagination) + End Get + End Property + + Public ReadOnly Property PersonalSportSkillRefreshButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalSportSkillRefreshButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalSportSkillResetButton1() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalSportSkillResetButton1"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalSportSkillSaveButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalSportSkillSaveButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalSportSkillTableControl1CollapsibleRegion() As System.Web.UI.WebControls.Panel + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalSportSkillTableControl1CollapsibleRegion"), System.Web.UI.WebControls.Panel) + End Get + End Property + + Public ReadOnly Property PersonalSportSkillToggleAll1() As System.Web.UI.WebControls.CheckBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalSportSkillToggleAll1"), System.Web.UI.WebControls.CheckBox) + End Get + End Property + + Public ReadOnly Property SportIdLabel2() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "SportIdLabel2"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + +#End Region + +#Region "Helper Functions" + + Public Overrides Overloads Function ModifyRedirectUrl(url As String, arg As String, ByVal bEncrypt As Boolean) As String + Return Me.Page.EvaluateExpressions(url, arg, bEncrypt, Me) + End Function + + Public Overrides Overloads Function EvaluateExpressions(url As String, arg As String, ByVal bEncrypt As Boolean) As String + Dim needToProcess As Boolean = AreAnyUrlParametersForMe(url, arg) + If (needToProcess) Then + Dim recCtl As PersonalSportSkillTableControl1Row = Me.GetSelectedRecordControl() + If recCtl Is Nothing AndAlso url.IndexOf("{") >= 0 Then + ' Localization. + Throw New Exception(Page.GetResourceValue("Err:NoRecSelected", "Persons")) + End If + Dim rec As PersonalSportSkillRecord = Nothing + If recCtl IsNot Nothing Then + rec = recCtl.GetRecord() + End If + Return EvaluateExpressions(url, arg, rec, bEncrypt) + End If + Return url + End Function + + Public Overridable Function GetSelectedRecordIndex() As Integer + Dim counter As Integer = 0 + Dim recControl As PersonalSportSkillTableControl1Row + For Each recControl In Me.GetRecordControls() + If recControl.PersonalSportSkillRecordRowSelection1.Checked Then + Return counter + End If + counter += 1 + Next + Return -1 + End Function + + Public Overridable Function GetSelectedRecordControl() As PersonalSportSkillTableControl1Row + Dim selectedList() As PersonalSportSkillTableControl1Row = Me.GetSelectedRecordControls() + If selectedList.Length = 0 Then + Return Nothing + End If + Return selectedList(0) + + End Function + + Public Overridable Function GetSelectedRecordControls() As PersonalSportSkillTableControl1Row() + + Dim selectedList As ArrayList = New ArrayList(25) + Dim recControl As PersonalSportSkillTableControl1Row + For Each recControl In Me.GetRecordControls() + If recControl.PersonalSportSkillRecordRowSelection1 IsNot Nothing AndAlso recControl.PersonalSportSkillRecordRowSelection1.Checked Then + selectedList.Add(recControl) + End If + Next + Return DirectCast(selectedList.ToArray(GetType(PersonalSportSkillTableControl1Row)), PersonalSportSkillTableControl1Row()) + + End Function + + Public Overridable Sub DeleteSelectedRecords(ByVal deferDeletion As Boolean) + Dim recList() As PersonalSportSkillTableControl1Row = Me.GetSelectedRecordControls() + If recList.Length = 0 Then + ' Localization. + Throw New Exception(Page.GetResourceValue("Err:NoRecSelected", "Persons")) + End If + + Dim recCtl As PersonalSportSkillTableControl1Row + For Each recCtl In recList + If deferDeletion Then + If Not recCtl.IsNewRecord Then + + Me.AddToDeletedRecordIds(recCtl) + + End If + recCtl.Visible = False + + recCtl.PersonalSportSkillRecordRowSelection1.Checked = False + + Else + + recCtl.Delete() + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + End If + Next + End Sub + + Public Function GetRecordControls() As PersonalSportSkillTableControl1Row() + Dim recList As ArrayList = New ArrayList() + Dim rep As System.Web.UI.WebControls.Repeater = CType(Me.FindControl("PersonalSportSkillTableControl1Repeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return Nothing + Dim repItem As System.Web.UI.WebControls.RepeaterItem + + For Each repItem In rep.Items + + Dim recControl As PersonalSportSkillTableControl1Row = DirectCast(repItem.FindControl("PersonalSportSkillTableControl1Row"), PersonalSportSkillTableControl1Row) + recList.Add(recControl) + + Next + + Return DirectCast(recList.ToArray(GetType(PersonalSportSkillTableControl1Row)), PersonalSportSkillTableControl1Row()) + End Function + + Public Shadows ReadOnly Property Page() As BaseApplicationPage + Get + Return DirectCast(MyBase.Page, BaseApplicationPage) + End Get + End Property + +#End Region + + + +End Class + + +' Base class for the PersonalTitleTableControlRow control on the EditPersonalId page. +' Do not modify this class. Instead override any method in PersonalTitleTableControlRow. +Public Class BasePersonalTitleTableControlRow + Inherits Persons.UI.BaseApplicationRecordControl + + ' To customize, override this method in PersonalTitleTableControlRow. + Protected Overridable Sub Control_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Init + + Me.ClearControlsFromSession() + End Sub + + ' To customize, override this method in PersonalTitleTableControlRow. + Protected Overridable Sub Control_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load + + 'Call LoadFocusScripts from repeater so that onfocus attribute could be added to elements + Me.Page.LoadFocusScripts(Me) + + ' Show confirmation message on Click + Me.PersonalTitleRowDeleteButton.Attributes.Add("onClick", "return (confirm('" & (CType(Me.Page,BaseApplicationPage)).GetResourceValue("DeleteRecordConfirm", "Persons") & "'));") + + + ' Register the event handlers. + + AddHandler Me.PersonalTitleRowDeleteButton.Click, AddressOf PersonalTitleRowDeleteButton_Click + + AddHandler Me.PersonalTitleRowEditButton.Click, AddressOf PersonalTitleRowEditButton_Click + + AddHandler Me.PersonalTitleRowViewButton.Click, AddressOf PersonalTitleRowViewButton_Click + + AddHandler Me.Command2.TextChanged, AddressOf Command2_TextChanged + + AddHandler Me.CommandDate3.TextChanged, AddressOf CommandDate3_TextChanged + + AddHandler Me.Dept.TextChanged, AddressOf Dept_TextChanged + + AddHandler Me.SkillNo.TextChanged, AddressOf SkillNo_TextChanged + + AddHandler Me.Title.TextChanged, AddressOf Title_TextChanged + + AddHandler Me.TitleDate.TextChanged, AddressOf TitleDate_TextChanged + + AddHandler Me.TitleRank.TextChanged, AddressOf TitleRank_TextChanged + + + End Sub + + + Public Overridable Sub LoadData() + + ' Load the data from the database into the DataSource PersonalTitle 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 = PersonalTitleTable.GetRecord(Me.RecordUniqueId, True) + + Return + End If + + ' Since this is a row in the table, the data for this row is loaded by the + ' LoadData method of the BasePersonalTitleTableControl when the data for the entire + ' table is loaded. + + Me.DataSource = New PersonalTitleRecord() + + + + End Sub + + ' Populate the UI controls using the DataSource. To customize, override this method in PersonalTitleTableControlRow. + 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 + + SetCommand2() + SetCommandDate3() + SetDept() + + + + + SetSkillNo() + SetTitle() + SetTitleDate() + SetTitleRank() + + + 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 SetCommand2() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.Command2.ID) Then + + Me.Command2.Text = Me.PreviousUIData(Me.Command2.ID).ToString() + + Return + End If + + + ' Set the Command TextBox on the webpage with value from the + ' PersonalTitle database record. + + ' Me.DataSource is the PersonalTitle record retrieved from the database. + ' Me.Command2 is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetCommand2() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.CommandSpecified Then + + ' If the Command is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalTitleTable.Command) + + Me.Command2.Text = formattedValue + + Else + + ' Command is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.Command2.Text = PersonalTitleTable.Command.Format(PersonalTitleTable.Command.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetCommandDate3() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.CommandDate3.ID) Then + + Me.CommandDate3.Text = Me.PreviousUIData(Me.CommandDate3.ID).ToString() + + Return + End If + + + ' Set the CommandDate TextBox on the webpage with value from the + ' PersonalTitle database record. + + ' Me.DataSource is the PersonalTitle record retrieved from the database. + ' Me.CommandDate3 is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetCommandDate3() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.CommandDateSpecified Then + + ' If the CommandDate is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalTitleTable.CommandDate, "d MMM yy") + + Me.CommandDate3.Text = formattedValue + + Else + + ' CommandDate is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.CommandDate3.Text = PersonalTitleTable.CommandDate.Format(PersonalTitleTable.CommandDate.DefaultValue, "d MMM yy") + + End If + + End Sub + + Public Overridable Sub SetDept() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.Dept.ID) Then + + Me.Dept.Text = Me.PreviousUIData(Me.Dept.ID).ToString() + + Return + End If + + + ' Set the Dept TextBox on the webpage with value from the + ' PersonalTitle database record. + + ' Me.DataSource is the PersonalTitle record retrieved from the database. + ' Me.Dept is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetDept() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.DeptSpecified Then + + ' If the Dept is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalTitleTable.Dept) + + Me.Dept.Text = formattedValue + + Else + + ' Dept is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.Dept.Text = PersonalTitleTable.Dept.Format(PersonalTitleTable.Dept.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetSkillNo() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.SkillNo.ID) Then + + Me.SkillNo.Text = Me.PreviousUIData(Me.SkillNo.ID).ToString() + + Return + End If + + + ' Set the SkillNo TextBox on the webpage with value from the + ' PersonalTitle database record. + + ' Me.DataSource is the PersonalTitle record retrieved from the database. + ' Me.SkillNo is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetSkillNo() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.SkillNoSpecified Then + + ' If the SkillNo is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalTitleTable.SkillNo) + + Me.SkillNo.Text = formattedValue + + Else + + ' SkillNo is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.SkillNo.Text = PersonalTitleTable.SkillNo.Format(PersonalTitleTable.SkillNo.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetTitle() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.Title.ID) Then + + Me.Title.Text = Me.PreviousUIData(Me.Title.ID).ToString() + + Return + End If + + + ' Set the Title TextBox on the webpage with value from the + ' PersonalTitle database record. + + ' Me.DataSource is the PersonalTitle record retrieved from the database. + ' Me.Title is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetTitle() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.TitleSpecified Then + + ' If the Title is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalTitleTable.Title) + + Me.Title.Text = formattedValue + + Else + + ' Title is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.Title.Text = PersonalTitleTable.Title.Format(PersonalTitleTable.Title.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetTitleDate() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.TitleDate.ID) Then + + Me.TitleDate.Text = Me.PreviousUIData(Me.TitleDate.ID).ToString() + + Return + End If + + + ' Set the TitleDate TextBox on the webpage with value from the + ' PersonalTitle database record. + + ' Me.DataSource is the PersonalTitle record retrieved from the database. + ' Me.TitleDate is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetTitleDate() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.TitleDateSpecified Then + + ' If the TitleDate is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalTitleTable.TitleDate, "d MMM yy") + + Me.TitleDate.Text = formattedValue + + Else + + ' TitleDate is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.TitleDate.Text = PersonalTitleTable.TitleDate.Format(PersonalTitleTable.TitleDate.DefaultValue, "d MMM yy") + + End If + + End Sub + + Public Overridable Sub SetTitleRank() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.TitleRank.ID) Then + + Me.TitleRank.Text = Me.PreviousUIData(Me.TitleRank.ID).ToString() + + Return + End If + + + ' Set the TitleRank TextBox on the webpage with value from the + ' PersonalTitle database record. + + ' Me.DataSource is the PersonalTitle record retrieved from the database. + ' Me.TitleRank is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetTitleRank() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.TitleRankSpecified Then + + ' If the TitleRank is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalTitleTable.TitleRank) + + Me.TitleRank.Text = formattedValue + + Else + + ' TitleRank is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.TitleRank.Text = PersonalTitleTable.TitleRank.Format(PersonalTitleTable.TitleRank.DefaultValue) + + End If + + End Sub + + + Public EvaluateFormulaDelegate As BaseClasses.Data.DataSource.EvaluateFormulaDelegate = New BaseClasses.Data.DataSource.EvaluateFormulaDelegate(AddressOf Me.EvaluateFormula) + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean, ByVal e As FormulaEvaluator) As String + If e Is Nothing Then + e = New FormulaEvaluator() + End If + + e.Variables.Clear() + + + ' add variables for formula evaluation + If variables IsNot Nothing Then + Dim enumerator As System.Collections.Generic.IEnumerator(Of System.Collections.Generic.KeyValuePair(Of String, Object)) = variables.GetEnumerator() + While enumerator.MoveNext() + e.Variables.Add(enumerator.Current.Key, enumerator.Current.Value) + End While + End If + + If includeDS + + End IF + + + ' Other variables referred to in the formula are expected to be + ' properties of the DataSource. For example, referring to + ' UnitPrice as a variable will refer to DataSource.UnitPrice + If dataSourceForEvaluate Is Nothing Then + + e.DataSource = Me.DataSource + + Else + e.DataSource = dataSourceForEvaluate + End If + + ' Define the calling control. This is used to add other + ' related table and record controls as variables. + e.CallingControl = Me + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + + If Not String.IsNullOrEmpty(format) AndAlso (String.IsNullOrEmpty(formula) OrElse formula.IndexOf("Format(") < 0) Then + Return FormulaUtils.Format(resultObj, format) + Else + Return resultObj.ToString() + End If + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format,variables ,includeDS, Nothing) + End Function + + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object)) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format, variables ,True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, format, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal e as FormulaEvaluator) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, variables, True, e) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal includeDS as Boolean) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, includeDS, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, True, Nothing) + End Function + + + Public Overridable Sub RegisterPostback() + + + End Sub + + + + ' To customize, override this method in PersonalTitleTableControlRow. + 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 parentCtrl As PersonalIdRecordControl + + + parentCtrl = DirectCast(Me.Page.FindControlRecursively("PersonalIdRecordControl"), PersonalIdRecordControl) + + If (Not IsNothing(parentCtrl) AndAlso IsNothing(parentCtrl.DataSource)) + ' Load the record if it is not loaded yet. + parentCtrl.LoadData() + End If + If (IsNothing(parentCtrl) OrElse IsNothing(parentCtrl.DataSource)) + ' Get the error message from the application resource file. + Throw New Exception(Page.GetResourceValue("Err:NoParentRecId", "Persons")) + End If + + Me.DataSource.PersonalId = parentCtrl.DataSource.PersonalId + + ' 2. Perform any custom validation. + Me.Validate() + + + ' 3. Set the values in the record with data from UI controls. + ' This calls the Get() method for each of the user interface controls. + Me.GetUIData() + + ' 4. Save in the database. + ' We should not save the record if the data did not change. This + ' will save a database hit and avoid triggering any database triggers. + + If Me.DataSource.IsAnyValueChanged Then + ' Save record to database but do not commit yet. + ' Auto generated ids are available after saving for use by child (dependent) records. + Me.DataSource.Save() + + DirectCast(GetParentControlObject(Me, "PersonalTitleTableControl"), PersonalTitleTableControl).DataChanged = True + DirectCast(GetParentControlObject(Me, "PersonalTitleTableControl"), PersonalTitleTableControl).ResetData = True + End If + + + ' update session or cookie by formula + + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + ' For Master-Detail relationships, save data on the Detail table(s) + + End Sub + + ' To customize, override this method in PersonalTitleTableControlRow. + 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. + + GetCommand2() + GetCommandDate3() + GetDept() + GetSkillNo() + GetTitle() + GetTitleDate() + GetTitleRank() + End Sub + + + Public Overridable Sub GetCommand2() + + ' Retrieve the value entered by the user on the Command ASP:TextBox, and + ' save it into the Command field in DataSource PersonalTitle record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.Command2.Text, PersonalTitleTable.Command) + + + End Sub + + Public Overridable Sub GetCommandDate3() + + ' Retrieve the value entered by the user on the CommandDate ASP:TextBox, and + ' save it into the CommandDate field in DataSource PersonalTitle 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.CommandDate3.Text, PersonalTitleTable.CommandDate) + + + End Sub + + Public Overridable Sub GetDept() + + ' Retrieve the value entered by the user on the Dept ASP:TextBox, and + ' save it into the Dept field in DataSource PersonalTitle record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.Dept.Text, PersonalTitleTable.Dept) + + + End Sub + + Public Overridable Sub GetSkillNo() + + ' Retrieve the value entered by the user on the SkillNo ASP:TextBox, and + ' save it into the SkillNo field in DataSource PersonalTitle record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.SkillNo.Text, PersonalTitleTable.SkillNo) + + + End Sub + + Public Overridable Sub GetTitle() + + ' Retrieve the value entered by the user on the Title ASP:TextBox, and + ' save it into the Title field in DataSource PersonalTitle record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.Title.Text, PersonalTitleTable.Title) + + + End Sub + + Public Overridable Sub GetTitleDate() + + ' Retrieve the value entered by the user on the TitleDate ASP:TextBox, and + ' save it into the TitleDate field in DataSource PersonalTitle 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.TitleDate.Text, PersonalTitleTable.TitleDate) + + + End Sub + + Public Overridable Sub GetTitleRank() + + ' Retrieve the value entered by the user on the TitleRank ASP:TextBox, and + ' save it into the TitleRank field in DataSource PersonalTitle record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.TitleRank.Text, PersonalTitleTable.TitleRank) + + + End Sub + + + ' To customize, override this method in PersonalTitleTableControlRow. + + Public Overridable Function CreateWhereClause() As WhereClause + + Return Nothing + + End Function + + + + ' To customize, override this method in PersonalTitleTableControlRow. + 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) + PersonalTitleTable.DeleteRecord(pkValue) + + DirectCast(GetParentControlObject(Me, "PersonalTitleTableControl"), PersonalTitleTableControl).DataChanged = True + DirectCast(GetParentControlObject(Me, "PersonalTitleTableControl"), PersonalTitleTableControl).ResetData = True + End Sub + + Protected Overridable Sub Control_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.PreRender + ' PreRender event is raised just before page is being displayed. + Try + DbUtils.StartTransaction() + Me.RegisterPostback() + + If Not Me.Page.ErrorOnPage AndAlso (Me.Page.IsPageRefresh OrElse Me.DataChanged OrElse Me.ResetData) Then + + + ' Re-load the data and update the web page if necessary. + ' This is typically done during a postback (filter, search button, sort, pagination button). + ' In each of the other click handlers, simply set DataChanged to True to reload the data. + Me.LoadData() + Me.DataBind() + End If + + + Catch ex As Exception + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + Finally + DbUtils.EndTransaction() + End Try + End Sub + + + Protected Overrides Sub SaveControlsToSession() + MyBase.SaveControlsToSession() + + + 'Save pagination state to session. + + End Sub + + + + Protected Overrides Sub ClearControlsFromSession() + MyBase.ClearControlsFromSession() + + + + ' Clear pagination state from session. + + End Sub + + Protected Overrides Sub LoadViewState(ByVal savedState As Object) + MyBase.LoadViewState(savedState) + Dim isNewRecord As String = CType(ViewState("IsNewRecord"), String) + If Not isNewRecord Is Nothing AndAlso isNewRecord.Trim <> "" Then + Me.IsNewRecord = Boolean.Parse(isNewRecord) + End If + + Dim myCheckSum As String = CType(ViewState("CheckSum"), String) + If Not myCheckSum Is Nothing AndAlso myCheckSum.Trim <> "" Then + Me.CheckSum = myCheckSum + End If + + + ' Load view state for pagination control. + + End Sub + + Protected Overrides Function SaveViewState() As Object + ViewState("IsNewRecord") = Me.IsNewRecord.ToString() + ViewState("CheckSum") = Me.CheckSum + + + ' Load view state for pagination control. + + Return MyBase.SaveViewState() + End Function + + + ' event handler for ImageButton + Public Overridable Sub PersonalTitleRowDeleteButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + If(Not Me.Page.IsPageRefresh) Then + + Dim tc As PersonalTitleTableControl = DirectCast(GetParentControlObject(Me, "PersonalTitleTableControl"), PersonalTitleTableControl) + If Not (IsNothing(tc)) Then + If Not Me.IsNewRecord Then + tc.AddToDeletedRecordIds(DirectCast(Me, PersonalTitleTableControlRow)) + End If + Me.Visible = False + tc.SetFormulaControls() + End If + + End If + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalTitleRowEditButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + ' The redirect URL is set on the Properties, Custom Properties or Actions. + ' The ModifyRedirectURL call resolves the parameters before the + ' Response.Redirect redirects the page to the URL. + ' Any code after the Response.Redirect call will not be executed, since the page is + ' redirected to the URL. + + + Dim url As String = "../Shared/ConfigureEditRecord.aspx" + + Dim shouldRedirect As Boolean = True + Dim TargetKey As String = Nothing + Dim DFKA As String = TargetKey + Dim id As String = DFKA + Dim value As String = id + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + url = Me.ModifyRedirectUrl(url, "",False) + url = Me.Page.ModifyRedirectUrl(url, "",False) + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + shouldRedirect = False + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + If shouldRedirect Then + Me.Page.ShouldSaveControlsToSession = True + Me.Page.Response.Redirect(url) + ElseIf Not TargetKey Is Nothing AndAlso _ + Not shouldRedirect Then + Me.Page.ShouldSaveControlsToSession = True + Me.Page.CloseWindow(True) + + End If + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalTitleRowViewButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + ' The redirect URL is set on the Properties, Custom Properties or Actions. + ' The ModifyRedirectURL call resolves the parameters before the + ' Response.Redirect redirects the page to the URL. + ' Any code after the Response.Redirect call will not be executed, since the page is + ' redirected to the URL. + + + Dim url As String = "../Shared/ConfigureViewRecord.aspx" + + Dim shouldRedirect As Boolean = True + Dim TargetKey As String = Nothing + Dim DFKA As String = TargetKey + Dim id As String = DFKA + Dim value As String = id + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + url = Me.ModifyRedirectUrl(url, "",False) + url = Me.Page.ModifyRedirectUrl(url, "",False) + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + shouldRedirect = False + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + If shouldRedirect Then + Me.Page.ShouldSaveControlsToSession = True + Me.Page.Response.Redirect(url) + ElseIf Not TargetKey Is Nothing AndAlso _ + Not shouldRedirect Then + Me.Page.ShouldSaveControlsToSession = True + Me.Page.CloseWindow(True) + + End If + End Sub + + Protected Overridable Sub Command2_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub CommandDate3_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub Dept_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub SkillNo_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub Title_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub TitleDate_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub TitleRank_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("BasePersonalTitleTableControlRow_Rec"), String) + End Get + Set(ByVal value As String) + Me.ViewState("BasePersonalTitleTableControlRow_Rec") = value + End Set + End Property + + Private _DataSource As PersonalTitleRecord + Public Property DataSource() As PersonalTitleRecord + Get + Return Me._DataSource + End Get + + Set(ByVal value As PersonalTitleRecord) + + Me._DataSource = value + End Set + End Property + + + + Private _checkSum As String + Public Overridable Property CheckSum() As String + Get + Return Me._checkSum + End Get + Set(ByVal value As String) + Me._checkSum = value + End Set + End Property + + Private _TotalPages As Integer + Public Property TotalPages() As Integer + Get + Return Me._TotalPages + End Get + Set(ByVal value As Integer) + Me._TotalPages = value + End Set + End Property + + Private _PageIndex As Integer + Public Property PageIndex() As Integer + Get + ' Return the PageIndex + Return Me._PageIndex + End Get + Set(ByVal value As Integer) + Me._PageIndex = value + End Set + End Property + + Private _DisplayLastPage As Boolean + Public Property DisplayLastPage() As Boolean + Get + Return Me._DisplayLastPage + End Get + Set(ByVal value As Boolean) + Me._DisplayLastPage = value + End Set + End Property + + + +#Region "Helper Properties" + + Public ReadOnly Property Command2() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Command2"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property CommandDate3() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "CommandDate3"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property Dept() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Dept"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property PersonalTitleRecordRowSelection() As System.Web.UI.WebControls.CheckBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalTitleRecordRowSelection"), System.Web.UI.WebControls.CheckBox) + End Get + End Property + + Public ReadOnly Property PersonalTitleRowDeleteButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalTitleRowDeleteButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalTitleRowEditButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalTitleRowEditButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalTitleRowViewButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalTitleRowViewButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property SkillNo() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "SkillNo"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property Title() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Title"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property TitleDate() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "TitleDate"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property TitleRank() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "TitleRank"), System.Web.UI.WebControls.TextBox) + 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 PersonalTitleRecord = 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 PersonalTitleRecord + If Not Me.DataSource Is Nothing Then + Return Me.DataSource + End If + + If Not Me.RecordUniqueId Is Nothing Then + + Return PersonalTitleTable.GetRecord(Me.RecordUniqueId, True) + + End If + + ' Localization. + + Return Nothing + + End Function + + Public Shadows ReadOnly Property Page() As BaseApplicationPage + Get + Return DirectCast(MyBase.Page, BaseApplicationPage) + End Get + End Property + +#End Region + +End Class + + + +' Base class for the PersonalTitleTableControl control on the EditPersonalId page. +' Do not modify this class. Instead override any method in PersonalTitleTableControl. +Public Class BasePersonalTitleTableControl + Inherits Persons.UI.BaseApplicationTableControl + + + + Protected Overridable Sub Control_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Init + + + + ' Setup the filter and search events. + + + + ' Control Initializations. + ' Initialize the table's current sort order. + + If Me.InSession(Me, "Order_By") Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + Me.CurrentSortOrder.Add(PersonalTitleTable.TitleDate, OrderByItem.OrderDir.Asc) + + End If + + + + ' Setup default pagination settings. + + Me.PageSize = CInt(Me.GetFromSession(Me, "Page_Size", "10")) + Me.PageIndex = CInt(Me.GetFromSession(Me, "Page_Index", "0")) + + + + Me.ClearControlsFromSession() + End Sub + + Protected Overridable Sub Control_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load + + SaveControlsToSession_Ajax() + + ' Show confirmation message on Click + Me.PersonalTitleDeleteButton.Attributes.Add("onClick", "return (confirm('" & (CType(Me.Page,BaseApplicationPage)).GetResourceValue("DeleteConfirm", "Persons") & "'));") + + ' Setup the pagination events. + + AddHandler Me.PersonalTitlePagination.FirstPage.Click, AddressOf PersonalTitlePagination_FirstPage_Click + + AddHandler Me.PersonalTitlePagination.LastPage.Click, AddressOf PersonalTitlePagination_LastPage_Click + + AddHandler Me.PersonalTitlePagination.NextPage.Click, AddressOf PersonalTitlePagination_NextPage_Click + + AddHandler Me.PersonalTitlePagination.PageSizeButton.Click, AddressOf PersonalTitlePagination_PageSizeButton_Click + + AddHandler Me.PersonalTitlePagination.PreviousPage.Click, AddressOf PersonalTitlePagination_PreviousPage_Click + + + ' Setup the sorting events. + + AddHandler Me.CommandDateLabel3.Click, AddressOf CommandDateLabel3_Click + + AddHandler Me.CommandLabel2.Click, AddressOf CommandLabel2_Click + + AddHandler Me.DeptLabel.Click, AddressOf DeptLabel_Click + + AddHandler Me.SkillNoLabel.Click, AddressOf SkillNoLabel_Click + + AddHandler Me.TitleDateLabel1.Click, AddressOf TitleDateLabel1_Click + + AddHandler Me.TitleLabel.Click, AddressOf TitleLabel_Click + + AddHandler Me.TitleRankLabel.Click, AddressOf TitleRankLabel_Click + + ' Setup the button events. + + AddHandler Me.PersonalTitleAddButton.Click, AddressOf PersonalTitleAddButton_Click + + AddHandler Me.PersonalTitleDeleteButton.Click, AddressOf PersonalTitleDeleteButton_Click + + AddHandler Me.PersonalTitleEditButton.Click, AddressOf PersonalTitleEditButton_Click + + AddHandler Me.PersonalTitleResetButton.Click, AddressOf PersonalTitleResetButton_Click + + + ' Setup events for others + + End Sub + + + Public Overridable Sub LoadData() + + ' Read data from database. Returns an array of records that can be assigned + ' to the DataSource table control property. + Try + Dim joinFilter As CompoundFilter = CreateCompoundJoinFilter() + + ' The WHERE clause will be empty when displaying all records in table. + Dim wc As WhereClause = CreateWhereClause() + If wc IsNot Nothing AndAlso Not wc.RunQuery Then + ' Initialize an empty array of records + Dim alist As New ArrayList(0) + Me.DataSource = DirectCast(alist.ToArray(GetType(PersonalTitleRecord)), PersonalTitleRecord()) + ' Add records to the list if needed. + Me.AddNewRecords() + Me._TotalRecords = 0 + Me._TotalPages = 0 + Return + End If + + ' Call OrderBy to determine the order - either use the order defined + ' on the Query Wizard, or specified by user (by clicking on column heading) + Dim orderBy As OrderBy = CreateOrderBy() + + ' Get the pagesize from the pagesize control. + Me.GetPageSize() + + If Me.DisplayLastPage Then + Dim totalRecords As Integer = If(Me._TotalRecords < 0, PersonalTitleTable.GetRecordCount(CreateCompoundJoinFilter(), CreateWhereClause()), Me._TotalRecords) + + Dim totalPages As Integer = CInt(Math.Ceiling(totalRecords / Me.PageSize)) + + Me.PageIndex = totalPages - 1 + End If + + ' Make sure PageIndex (current page) and PageSize are within bounds. + If Me.PageIndex < 0 Then + Me.PageIndex = 0 + End If + If Me.PageSize < 1 Then + Me.PageSize = 1 + End If + + ' Retrieve the records and set the table DataSource. + ' Only PageSize records are fetched starting at PageIndex (zero based). + If Me.AddNewRecord > 0 Then + ' Make sure to preserve the previously entered data on new rows. + Dim postdata As New ArrayList + For Each rc As PersonalTitleTableControlRow In Me.GetRecordControls() + If Not rc.IsNewRecord Then + rc.DataSource = rc.GetRecord() + rc.GetUIData() + postdata.Add(rc.DataSource) + UIData.Add(rc.PreservedUIData()) + End If + Next + Me.DataSource = DirectCast(postdata.ToArray(GetType(PersonalTitleRecord)), PersonalTitleRecord()) + Else ' Get the records from the database + Me.DataSource = PersonalTitleTable.GetRecords(joinFilter, wc, orderBy, Me.PageIndex, Me.PageSize) + + End If + + ' if the datasource contains no records contained in database, then load the last page. + If (DbUtils.GetCreatedRecords(Me.DataSource).Length = 0 AndAlso Not Me.DisplayLastPage) Then + Me.DisplayLastPage = True + LoadData() + Else + + ' Add any new rows desired by the user. + Me.AddNewRecords() + + ' Turn off the ToggleAll checkbox + Me.PersonalTitleToggleAll.Checked = False + + + ' Initialize the page and grand totals. now + + End If + + Catch ex As Exception + ' Report the error message to the end user + Dim msg As String = ex.Message + If ex.InnerException IsNot Nothing Then + msg = msg & " InnerException: " & ex.InnerException.Message + End If + Throw New Exception(msg, ex.InnerException) + End Try + End Sub + + + + + Public Overrides Sub DataBind() + ' The DataBind method binds the user interface controls to the values + ' from the database record for each row in the table. To do this, it calls the + ' DataBind for each of the rows. + ' DataBind also populates any filters above the table, and sets the pagination + ' control to the correct number of records and the current page number. + + MyBase.DataBind() + + ' Make sure that the DataSource is initialized. + If Me.DataSource Is Nothing Then + Return + End If + + 'LoadData for DataSource for chart and report if they exist + + ' Setup the pagination controls. + BindPaginationControls() + + + + ' Bind the repeater with the list of records to expand the UI. + Dim rep As System.Web.UI.WebControls.Repeater = CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalTitleTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return + rep.DataSource = DataSource() + rep.DataBind() + + Dim index As Integer = 0 + For Each repItem As System.Web.UI.WebControls.RepeaterItem In rep.Items + ' Loop through all rows in the table, set its DataSource and call DataBind(). + Dim recControl As PersonalTitleTableControlRow = DirectCast(repItem.FindControl("PersonalTitleTableControlRow"), PersonalTitleTableControlRow) + recControl.DataSource = Me.DataSource(index) + If Me.UIData.Count > index Then + recControl.PreviousUIData = Me.UIData(index) + End If + recControl.DataBind() + recControl.Visible = Not Me.InDeletedRecordIds(recControl) + + index += 1 + Next + + + + + ' Call the Set methods for each controls on the panel + + SetCommandDateLabel3() + SetCommandLabel2() + SetDeptLabel() + + + + + + SetPersonalTitleTableControlCollapsibleRegion() + + SetSkillNoLabel() + SetTitleDateLabel1() + SetTitleLabel() + SetTitleRankLabel() + ' setting the state of expand or collapse alternative rows + + + ' Load data for each record and table UI control. + ' Ordering is important because child controls get + ' their parent ids from their parent UI controls. + + + ' this method calls the set method for controls with special formula like running total, sum, rank, etc + SetFormulaControls() + End Sub + + Public Overridable Sub SetFormulaControls() + ' this method calls Set methods for the control that has special formula + + + + End Sub + + + + Public Overridable Sub RegisterPostback() + + + End Sub + + Public EvaluateFormulaDelegate As BaseClasses.Data.DataSource.EvaluateFormulaDelegate = New BaseClasses.Data.DataSource.EvaluateFormulaDelegate(AddressOf Me.EvaluateFormula) + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean, ByVal e as FormulaEvaluator) As String + If e Is Nothing + e = New FormulaEvaluator() + End If + + e.Variables.Clear() + + + ' add variables for formula evaluation + If variables IsNot Nothing Then + Dim enumerator As System.Collections.Generic.IEnumerator(Of System.Collections.Generic.KeyValuePair(Of String, Object)) = variables.GetEnumerator() + While enumerator.MoveNext() + e.Variables.Add(enumerator.Current.Key, enumerator.Current.Value) + End While + End If + + If includeDS + + End If + + ' All variables referred to in the formula are expected to be + ' properties of the DataSource. For example, referring to + ' UnitPrice as a variable will refer to DataSource.UnitPrice + e.DataSource = dataSourceForEvaluate + + ' Define the calling control. This is used to add other + ' related table and record controls as variables. + e.CallingControl = Me + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + + If Not String.IsNullOrEmpty(format) AndAlso (String.IsNullOrEmpty(formula) OrElse formula.IndexOf("Format(") < 0) Then + Return FormulaUtils.Format(resultObj, format) + Else + Return resultObj.ToString() + End If + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format,variables ,includeDS, Nothing) + End Function + + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object)) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format, variables ,True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, format, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal e as FormulaEvaluator) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, variables, True, e) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal includeDS as Boolean) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, includeDS, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, True, Nothing) + End Function + + + + + Public Overridable Sub ResetControl() + + Me.CurrentSortOrder.Reset() + If (Me.InSession(Me, "Order_By")) Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + Me.CurrentSortOrder.Add(PersonalTitleTable.TitleDate, OrderByItem.OrderDir.Asc) + + End If + + Me.PageIndex = 0 + End Sub + + Protected Overridable Sub BindPaginationControls() + ' Setup the pagination controls. + + ' Bind the pagination labels. + + If DbUtils.GetCreatedRecords(Me.DataSource).Length > 0 Then + + Me.PersonalTitlePagination.CurrentPage.Text = (Me.PageIndex + 1).ToString() + Else + Me.PersonalTitlePagination.CurrentPage.Text = "0" + End If + Me.PersonalTitlePagination.PageSize.Text = Me.PageSize.ToString() + Me.PersonalTitlePagination.TotalItems.Text = Me.TotalRecords.ToString() + Me.PersonalTitlePagination.TotalPages.Text = Me.TotalPages.ToString() + + ' Bind the buttons for PersonalTitleTableControl pagination. + + Me.PersonalTitlePagination.FirstPage.Enabled = Not (Me.PageIndex = 0) + If Me._TotalPages < 0 Then ' if the total pages is not determined yet, enable last and next buttons + Me.PersonalTitlePagination.LastPage.Enabled = True + ElseIf Me._TotalPages = 0 ' if the total pages is determined and it is 0, enable last and next buttons + Me.PersonalTitlePagination.LastPage.Enabled = False + Else ' if the total pages is the last page, disable last and next buttons + Me.PersonalTitlePagination.LastPage.Enabled = Not (Me.PageIndex = Me.TotalPages - 1) + End If + + If Me._TotalPages < 0 Then ' if the total pages is not determined yet, enable last and next buttons + Me.PersonalTitlePagination.NextPage.Enabled = True + ElseIf Me._TotalPages = 0 ' if the total pages is determined and it is 0, enable last and next buttons + Me.PersonalTitlePagination.NextPage.Enabled = False + Else ' if the total pages is the last page, disable last and next buttons + Me.PersonalTitlePagination.NextPage.Enabled = Not (Me.PageIndex = Me.TotalPages - 1) + End If + + Me.PersonalTitlePagination.PreviousPage.Enabled = Not (Me.PageIndex = 0) + + + End Sub + + Public Overridable Sub SaveData() + ' Save the data from the entire table. Calls each row's Save Data + ' to save their data. This function is called by the Click handler of the + ' Save button. The button handler should Start/Commit/End a transaction. + + Dim recCtl As PersonalTitleTableControlRow + For Each recCtl In Me.GetRecordControls() + + If Me.InDeletedRecordIds(recCtl) Then + ' Delete any pending deletes. + recCtl.Delete() + Else + If recCtl.Visible Then + recCtl.SaveData() + End If + End If + + Next + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + ' Set IsNewRecord to False for all records - since everything has been saved and is no longer "new" + For Each recCtl In Me.GetRecordControls() + recCtl.IsNewRecord = False + Next + + + ' Set DeletedRecordsIds to Nothing since we have deleted all pending deletes. + Me.DeletedRecordIds = Nothing + + End Sub + + Public Overridable Function CreateCompoundJoinFilter() As CompoundFilter + Dim jFilter As CompoundFilter = New CompoundFilter() + + Return jFilter + + End Function + + + Public Overridable Function CreateOrderBy() As OrderBy + ' The CurrentSortOrder is initialized to the sort order on the + ' Query Wizard. It may be modified by the Click handler for any of + ' the column heading to sort or reverse sort by that column. + ' You can add your own sort order, or modify it on the Query Wizard. + Return Me.CurrentSortOrder + End Function + + Public Overridable Function CreateWhereClause() As WhereClause + 'This CreateWhereClause is used for loading the data. + PersonalTitleTable.Instance.InnerFilter = Nothing + Dim wc As WhereClause = New WhereClause() + + ' Compose the WHERE clause consiting of: + ' 1. Static clause defined at design time. + ' 2. User selected search criteria. + ' 3. User selected filter criteria. + + + Dim selectedRecordKeyValue as KeyValue = New KeyValue() + + Dim personalIdRecordControlObj As Persons.UI.Controls.EditPersonalId.PersonalIdRecordControl = DirectCast(MiscUtils.FindControlRecursively(Me.Page, "PersonalIdRecordControl"), Persons.UI.Controls.EditPersonalId.PersonalIdRecordControl) + + If (Not IsNothing(personalIdRecordControlObj) AndAlso Not IsNothing(personalIdRecordControlObj.GetRecord()) AndAlso personalIdRecordControlObj.GetRecord().IsCreated AndAlso Not IsNothing(personalIdRecordControlObj.GetRecord().PersonalId)) + wc.iAND(PersonalTitleTable.PersonalId, BaseFilter.ComparisonOperator.EqualsTo, personalIdRecordControlObj.GetRecord().PersonalId.ToString()) + selectedRecordKeyValue.AddElement(PersonalTitleTable.PersonalId.InternalName, personalIdRecordControlObj.GetRecord().PersonalId.ToString()) + Else + wc.RunQuery = False + Return wc + End If + + HttpContext.Current.Session("PersonalTitleTableControlWhereClause") = selectedRecordKeyValue.ToXmlString() + + Return wc + End Function + + + Public Overridable Function CreateWhereClause(ByVal searchText as String, ByVal fromSearchControl as String, ByVal AutoTypeAheadSearch as String, ByVal AutoTypeAheadWordSeparators as String) As WhereClause + ' This CreateWhereClause is used for loading list of suggestions for Auto Type-Ahead feature. + PersonalTitleTable.Instance.InnerFilter = Nothing + Dim wc As WhereClause = New WhereClause() + + ' Compose the WHERE clause consiting of: + ' 1. Static clause defined at design time. + ' 2. User selected search criteria. + ' 3. User selected filter criteria. + + Dim appRelativeVirtualPath As String = CType(HttpContext.Current.Session("AppRelativeVirtualPath"), String) + + Dim selectedRecordInPersonalIdRecordControl as String = DirectCast(HttpContext.Current.Session("PersonalTitleTableControlWhereClause"), String) + + If Not selectedRecordInPersonalIdRecordControl Is Nothing AndAlso KeyValue.IsXmlKey(selectedRecordInPersonalIdRecordControl) Then + Dim selectedRecordKeyValue as KeyValue = KeyValue.XmlToKey(selectedRecordInPersonalIdRecordControl) + + If Not IsNothing(selectedRecordKeyValue) AndAlso selectedRecordKeyValue.ContainsColumn(PersonalTitleTable.PersonalId) Then + wc.iAND(PersonalTitleTable.PersonalId, BaseFilter.ComparisonOperator.EqualsTo, selectedRecordKeyValue.GetColumnValue(PersonalTitleTable.PersonalId).ToString()) + End If + + End If + + ' Adds clauses if values are selected in Filter controls which are configured in the page. + + + Return wc + End Function + + + Public Overridable Function FormatSuggestions(ByVal prefixText As String, ByVal resultItem As String, _ + ByVal columnLength As Integer, ByVal AutoTypeAheadDisplayFoundText As String, _ + ByVal autoTypeAheadSearch As String, ByVal AutoTypeAheadWordSeparators As String, _ + ByVal resultList As ArrayList) As Boolean + + 'Formats the resultItem and adds it to the list of suggestions. + Dim index As Integer = resultItem.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture).IndexOf(prefixText.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture)) + Dim itemToAdd As String = "" + Dim isFound As Boolean = False + Dim isAdded As Boolean = False + ' Get the index where prfixt is at the beginning of resultItem. If not found then, index of word which begins with prefixText. + If InvariantLCase(autoTypeAheadSearch).equals("wordsstartingwithsearchstring") And Not index = 0 Then + ' Expression to find word which contains AutoTypeAheadWordSeparators followed by prefixText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex( AutoTypeAheadWordSeparators + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + If regex1.IsMatch(resultItem) Then + index = regex1.Match(resultItem).Index + isFound = True + End If + ' If the prefixText is found immediatly after white space then starting of the word is found so don not search any further + If not resultItem(index).ToString() = " " Then + ' Expression to find beginning of the word which contains AutoTypeAheadWordSeparators followed by prefixText + Dim regex As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\\S*" + AutoTypeAheadWordSeparators + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + If regex.IsMatch(resultItem) Then + index = regex.Match(resultItem).Index + isFound = True + End If + End If + End If + + ' If autoTypeAheadSearch value is wordsstartingwithsearchstring then, extract the substring only if the prefixText is found at the + ' beginning of the resultItem (index = 0) or a word in resultItem is found starts with prefixText. + If index = 0 Or isFound Or InvariantLCase(autoTypeAheadSearch).Equals("anywhereinstring") then + If InvariantLCase(AutoTypeAheadDisplayFoundText).equals("atbeginningofmatchedstring") Then + ' Expression to find beginning of the word which contains prefixText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\\S*" + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + ' Find the beginning of the word which contains prefexText + If (StringUtils.InvariantLCase(autoTypeAheadSearch).Equals("anywhereinstring") AndAlso regex1.IsMatch(resultItem)) Then + index = regex1.Match(resultItem).Index + isFound = True + End If + ' Display string from the index till end of the string if sub string from index till end is less than columnLength value. + If Len(resultItem) - index <= columnLength Then + If index = 0 Then + itemToAdd = resultItem + Else + itemToAdd = "..." & resultItem.Substring(index, Len(resultItem) - index) + End If + Else + If index = 0 Then + itemToAdd = resultItem.Substring(index, (columnLength - 3)) & "..." + Else + 'Truncate the string to show only columnLength - 6 characters as begining and trailing "..." has to be appended. + itemToAdd = "..." & resultItem.Substring(index , columnLength - 6) & "..." + End If + End If + ElseIf InvariantLCase(AutoTypeAheadDisplayFoundText).equals("inmiddleofmatchedstring") Then + Dim subStringBeginIndex As Integer = CType(columnLength/2, Integer) + If Len(resultItem) <= columnLength Then + itemToAdd = resultItem + Else + ' Sanity check at end of the string + If index + Len(prefixText) = columnLength Then + itemToAdd = "..." & resultItem.Substring(index-columnLength,index) + ElseIf Len(resultItem) - index < subStringBeginIndex Then + ' Display string from the end till columnLength value if, index is closer to the end of the string. + itemToAdd = "..." & resultItem.Substring(Len(resultItem)-columnLength,Len(resultItem)) + ElseIf index <= subStringBeginIndex Then + ' Sanity chet at beginning of the string + itemToAdd = resultItem.Substring(0, columnLength) & "..." + Else + ' Display string containing text before the prefixText occures and text after the prefixText + itemToAdd = "..." & resultItem.Substring(index - subStringBeginIndex, columnLength) & "..." + End If + End If + ElseIf InvariantLCase(AutoTypeAheadDisplayFoundText).equals("atendofmatchedstring") Then + ' Expression to find ending of the word which contains prefexText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\s", System.Text.RegularExpressions.RegexOptions.IgnoreCase) + ' Find the ending of the word which contains prefexText + If regex1.IsMatch(resultItem, index + 1) Then + index = regex1.Match(resultItem, index + 1).Index + Else + ' If the word which contains prefexText is the last word in string, regex1.IsMatch returns false. + index = resultItem.Length + End If + If index > Len(resultItem) Then + index = Len(resultItem) + End If + ' If text from beginning of the string till index is less than columnLength value then, display string from the beginning till index. + If index <= columnLength Then + if index = Len(resultItem) Then 'Make decision to append "..." + itemToAdd = resultItem.Substring(0,index) + Else + itemToAdd = resultItem.Substring(0,index) & "..." + End If + Else + If index = Len(resultItem) Then + itemToAdd = "..." & resultItem.Substring(index - (columnLength - 3), (columnLength - 3)) + Else + 'Truncate the string to show only columnLength - 6 characters as begining and trailing "..." has to be appended. + itemToAdd = "..." & resultItem.Substring(index - (columnLength - 6), columnLength - 6) & "..." + End If + End If + End If + + ' Remove newline character from itemToAdd + Dim prefixTextIndex As Integer = itemToAdd.IndexOf(prefixText, StringComparison.CurrentCultureIgnoreCase) + ' If itemToAdd contains any newline after the search text then show text only till newline + Dim regex2 As System.Text.RegularExpressions.Regex = New System.Text.RegularExpressions.Regex("(" & vbCrLf & "|" & vbLf & ")", System.Text.RegularExpressions.RegexOptions.IgnoreCase) + Dim newLineIndexAfterPrefix As Integer = -1 + If regex2.IsMatch(itemToAdd, prefixTextIndex) Then + newLineIndexAfterPrefix = regex2.Match(itemToAdd, prefixTextIndex).Index + End If + If (newLineIndexAfterPrefix > -1) Then + If itemToAdd.EndsWith("...") Then + itemToAdd = (itemToAdd.Substring(0, newLineIndexAfterPrefix) + "...") + Else + itemToAdd = itemToAdd.Substring(0, newLineIndexAfterPrefix) + End If + End If + ' If itemToAdd contains any newline before search text then show text which comes after newline + Dim regex3 As System.Text.RegularExpressions.Regex = New System.Text.RegularExpressions.Regex("(" & vbCrLf & "|" & vbLf & ")", (System.Text.RegularExpressions.RegexOptions.IgnoreCase Or System.Text.RegularExpressions.RegexOptions.RightToLeft)) + Dim newLineIndexBeforePrefix As Integer = -1 + If regex3.IsMatch(itemToAdd, prefixTextIndex) Then + newLineIndexBeforePrefix = regex3.Match(itemToAdd, prefixTextIndex).Index + End If + If (newLineIndexBeforePrefix > -1) Then + If itemToAdd.StartsWith("...") Then + itemToAdd = ("..." + itemToAdd.Substring((newLineIndexBeforePrefix + regex3.Match(itemToAdd, prefixTextIndex).Length))) + Else + itemToAdd = itemToAdd.Substring((newLineIndexBeforePrefix + regex3.Match(itemToAdd, prefixTextIndex).Length)) + End If + End If + + If Not itemToAdd is nothing AndAlso Not resultList.Contains(itemToAdd) Then + + resultList.Add(itemToAdd) + + isAdded = true + End If + End If + Return isAdded + End Function + + + Protected Overridable Sub GetPageSize() + + If Me.PersonalTitlePagination.PageSize.Text.Trim <> "" Then + Try + 'Me.PageSize = Integer.Parse(Me.PersonalTitlePagination.PageSize.Text) + Catch ex As Exception + End Try + End If + End Sub + + Protected Overridable Sub AddNewRecords() + + Dim newRecordList As ArrayList = New ArrayList() + + Dim newUIDataList As System.Collections.Generic.List(Of Hashtable) = New System.Collections.Generic.List(Of Hashtable)() + + ' Loop though all the record controls and if the record control + ' does not have a unique record id set, then create a record + ' and add to the list. + If Not Me.ResetData Then + Dim rep As System.Web.UI.WebControls.Repeater = CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalTitleTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return + + Dim repItem As System.Web.UI.WebControls.RepeaterItem + For Each repItem In rep.Items + ' Loop through all rows in the table, set its DataSource and call DataBind(). + + Dim recControl As PersonalTitleTableControlRow = DirectCast(repItem.FindControl("PersonalTitleTableControlRow"), PersonalTitleTableControlRow) + + If recControl.Visible AndAlso recControl.IsNewRecord() Then + + Dim rec As PersonalTitleRecord = New PersonalTitleRecord() + + If recControl.Command2.Text <> "" Then + rec.Parse(recControl.Command2.Text, PersonalTitleTable.Command) + End If + If recControl.CommandDate3.Text <> "" Then + rec.Parse(recControl.CommandDate3.Text, PersonalTitleTable.CommandDate) + End If + If recControl.Dept.Text <> "" Then + rec.Parse(recControl.Dept.Text, PersonalTitleTable.Dept) + End If + If recControl.SkillNo.Text <> "" Then + rec.Parse(recControl.SkillNo.Text, PersonalTitleTable.SkillNo) + End If + If recControl.Title.Text <> "" Then + rec.Parse(recControl.Title.Text, PersonalTitleTable.Title) + End If + If recControl.TitleDate.Text <> "" Then + rec.Parse(recControl.TitleDate.Text, PersonalTitleTable.TitleDate) + End If + If recControl.TitleRank.Text <> "" Then + rec.Parse(recControl.TitleRank.Text, PersonalTitleTable.TitleRank) + End If + newUIDataList.Add(recControl.PreservedUIData()) + newRecordList.Add(rec) + End If + Next + End If + + + ' Add any new record to the list. + Dim index As Integer = 0 + For index = 1 To Me.AddNewRecord + + newRecordList.Insert(0, New PersonalTitleRecord()) + newUIDataList.Insert(0, New Hashtable()) + + Next + Me.AddNewRecord = 0 + + ' Finally, add any new records to the DataSource. + If newRecordList.Count > 0 Then + + Dim finalList As ArrayList = New ArrayList(Me.DataSource) + finalList.InsertRange(0, newRecordList) + + Me.DataSource = DirectCast(finalList.ToArray(GetType(PersonalTitleRecord)), PersonalTitleRecord()) + + End If + + ' Add the existing UI data to this hash table + If newUIDataList.Count > 0 Then + Me.UIData.InsertRange(0, newUIDataList) + End If + + End Sub + + + Public Sub AddToDeletedRecordIds(ByVal rec As PersonalTitleTableControlRow) + If rec.IsNewRecord() Then + Return + End If + + If Not Me.DeletedRecordIds Is Nothing AndAlso Me.DeletedRecordIds.Trim <> "" Then + Me.DeletedRecordIds &= "," + End If + + Me.DeletedRecordIds &= "[" & rec.RecordUniqueId & "]" + End Sub + + Protected Overridable Function InDeletedRecordIds(ByVal rec As PersonalTitleTableControlRow) As Boolean + If Me.DeletedRecordIds Is Nothing OrElse Me.DeletedRecordIds.Trim = "" Then + Return False + End If + + Return Me.DeletedRecordIds.IndexOf("[" & rec.RecordUniqueId & "]") >= 0 + End Function + + Private _DeletedRecordIds As String + Public Property DeletedRecordIds() As String + Get + Return Me._DeletedRecordIds + End Get + Set(ByVal value As String) + Me._DeletedRecordIds = value + End Set + End Property + + + ' Create Set, WhereClause, and Populate Methods + + Public Overridable Sub SetCommandDateLabel3() + + End Sub + + Public Overridable Sub SetCommandLabel2() + + End Sub + + Public Overridable Sub SetDeptLabel() + + End Sub + + Public Overridable Sub SetPersonalTitleTableControlCollapsibleRegion() + + End Sub + + Public Overridable Sub SetSkillNoLabel() + + End Sub + + Public Overridable Sub SetTitleDateLabel1() + + End Sub + + Public Overridable Sub SetTitleLabel() + + End Sub + + Public Overridable Sub SetTitleRankLabel() + + 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. + Dim added As Boolean = Me.AddNewRecord > 0 + Me.LoadData() + Me.DataBind() + + If added Then + Me.SetFocusToAddedRow() + End If + + End If + + + + Catch ex As Exception + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + Finally + DbUtils.EndTransaction + End Try + End Sub + + 'this function sets focus to the first editable element in the new added row in the editable table + Protected Overridable Sub SetFocusToAddedRow() + Dim rep As System.Web.UI.WebControls.Repeater = CType(Me.FindControl("PersonalTitleTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing OrElse rep.Items.Count = 0 Then Return + Dim repItem As System.Web.UI.WebControls.RepeaterItem + For Each repItem In rep.Items + 'Load scripts to table rows + Me.Page.LoadFocusScripts(repItem) + Dim recControl As PersonalTitleTableControlRow = DirectCast(repItem.FindControl("PersonalTitleTableControlRow"), PersonalTitleTableControlRow) + If recControl.IsNewRecord Then + For Each field As Control In recControl.Controls + If field.Visible AndAlso Me.Page.IsControlEditable(field, False) Then + 'set focus on the first editable field in the new row + field.Focus() + Dim updPan As UpdatePanel = DirectCast(Me.Page.FindControlRecursively("UpdatePanel1"), UpdatePanel) + If Not updPan Is Nothing Then updPan.Update() + Return + End If + Next + Return + End If + Next + End Sub + + + Protected Overrides Sub SaveControlsToSession() + MyBase.SaveControlsToSession() + + ' Save filter controls to values to session. + + + 'Save pagination state to session. + + + + ' Save table control properties to the session. + If Not Me.CurrentSortOrder Is Nothing Then + Me.SaveToSession(Me, "Order_By", Me.CurrentSortOrder.ToXmlString()) + End If + + Me.SaveToSession(Me, "Page_Index", Me.PageIndex.ToString()) + Me.SaveToSession(Me, "Page_Size", Me.PageSize.ToString()) + + Me.SaveToSession(Me, "DeletedRecordIds", Me.DeletedRecordIds) + + End Sub + + Protected Sub SaveControlsToSession_Ajax() + ' Save filter controls to values to session. + + HttpContext.Current.Session("AppRelativeVirtualPath") = Me.Page.AppRelativeVirtualPath + + End Sub + + Protected Overrides Sub ClearControlsFromSession() + MyBase.ClearControlsFromSession() + + ' Clear filter controls values from the session. + + + ' Clear pagination state from session. + + + + ' Clear table properties from the session. + Me.RemoveFromSession(Me, "Order_By") + Me.RemoveFromSession(Me, "Page_Index") + Me.RemoveFromSession(Me, "Page_Size") + + Me.RemoveFromSession(Me, "DeletedRecordIds") + + End Sub + + Protected Overrides Sub LoadViewState(ByVal savedState As Object) + MyBase.LoadViewState(savedState) + + Dim orderByStr As String = CType(ViewState("PersonalTitleTableControl_OrderBy"), String) + + If orderByStr IsNot Nothing AndAlso orderByStr.Trim <> "" Then + Me.CurrentSortOrder = BaseClasses.Data.OrderBy.FromXmlString(orderByStr) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + End If + + Dim pageIndex As String = CType(ViewState("Page_Index"), String) + If pageIndex IsNot Nothing Then + Me.PageIndex = CInt(pageIndex) + End If + + Dim pageSize As String = CType(ViewState("Page_Size"), String) + If Not pageSize Is Nothing Then + Me.PageSize = CInt(pageSize) + End If + + + + ' Load view state for pagination control. + + Me.DeletedRecordIds = CType(Me.ViewState("DeletedRecordIds"), String) + + End Sub + + Protected Overrides Function SaveViewState() As Object + + If Me.CurrentSortOrder IsNot Nothing Then + Me.ViewState("PersonalTitleTableControl_OrderBy") = Me.CurrentSortOrder.ToXmlString() + End If + + Me.ViewState("Page_Index") = Me.PageIndex + Me.ViewState("Page_Size") = Me.PageSize + + Me.ViewState("DeletedRecordIds") = Me.DeletedRecordIds + + + ' Load view state for pagination control. + + + Return MyBase.SaveViewState() + End Function + + ' Generate the event handling functions for pagination events. + + ' event handler for ImageButton + Public Overridable Sub PersonalTitlePagination_FirstPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.PageIndex = 0 + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalTitlePagination_LastPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.DisplayLastPage = True + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalTitlePagination_NextPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.PageIndex += 1 + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for LinkButton + Public Overridable Sub PersonalTitlePagination_PageSizeButton_Click(ByVal sender As Object, ByVal args As EventArgs) + + Try + + Me.DataChanged = True + + Me.PageSize = Integer.Parse(Me.PersonalTitlePagination.PageSize.Text) + + Me.PageIndex = Integer.Parse(Me.PersonalTitlePagination.CurrentPage.Text) - 1 + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalTitlePagination_PreviousPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + If Me.PageIndex > 0 Then + Me.PageIndex -= 1 + Me.DataChanged = True + End If + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + + ' Generate the event handling functions for sorting events. + + Public Overridable Sub CommandDateLabel3_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by CommandDate when clicked. + + ' Get previous sorting state for CommandDate. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalTitleTable.CommandDate) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for CommandDate. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalTitleTable.CommandDate, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by CommandDate, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub CommandLabel2_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by Command when clicked. + + ' Get previous sorting state for Command. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalTitleTable.Command) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for Command. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalTitleTable.Command, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by Command, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub DeptLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by Dept when clicked. + + ' Get previous sorting state for Dept. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalTitleTable.Dept) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for Dept. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalTitleTable.Dept, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by Dept, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub SkillNoLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by SkillNo when clicked. + + ' Get previous sorting state for SkillNo. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalTitleTable.SkillNo) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for SkillNo. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalTitleTable.SkillNo, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by SkillNo, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub TitleDateLabel1_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by TitleDate when clicked. + + ' Get previous sorting state for TitleDate. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalTitleTable.TitleDate) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for TitleDate. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalTitleTable.TitleDate, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by TitleDate, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub TitleLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by Title when clicked. + + ' Get previous sorting state for Title. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalTitleTable.Title) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for Title. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalTitleTable.Title, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by Title, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub TitleRankLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by TitleRank when clicked. + + ' Get previous sorting state for TitleRank. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalTitleTable.TitleRank) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for TitleRank. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalTitleTable.TitleRank, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by TitleRank, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + + ' Generate the event handling functions for button events. + + ' event handler for ImageButton + Public Overridable Sub PersonalTitleAddButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + Me.AddNewRecord = 1 + Me.DataChanged = True + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalTitleDeleteButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + If(Not Me.Page.IsPageRefresh) Then + + Me.DeleteSelectedRecords(True) + Me.SetFormulaControls() + + + End If + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalTitleEditButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + ' The redirect URL is set on the Properties, Custom Properties or Actions. + ' The ModifyRedirectURL call resolves the parameters before the + ' Response.Redirect redirects the page to the URL. + ' Any code after the Response.Redirect call will not be executed, since the page is + ' redirected to the URL. + + + Dim url As String = "../Shared/ConfigureEditRecord.aspx" + + Dim shouldRedirect As Boolean = True + Dim TargetKey As String = Nothing + Dim DFKA As String = TargetKey + Dim id As String = DFKA + Dim value As String = id + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + url = Me.ModifyRedirectUrl(url, "",False) + url = Me.Page.ModifyRedirectUrl(url, "",False) + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + shouldRedirect = False + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + If shouldRedirect Then + Me.Page.ShouldSaveControlsToSession = True + Me.Page.Response.Redirect(url) + ElseIf Not TargetKey Is Nothing AndAlso _ + Not shouldRedirect Then + Me.Page.ShouldSaveControlsToSession = True + Me.Page.CloseWindow(True) + + End If + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalTitleResetButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.CurrentSortOrder.Reset() + If Me.InSession(Me, "Order_By") Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + Me.CurrentSortOrder.Add(PersonalTitleTable.TitleDate, OrderByItem.OrderDir.Asc) + + + End If + + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + + + ' Generate the event handling functions for filter and search events. + + + ' Generate the event handling functions for others + + + Private _UIData As New System.Collections.Generic.List(Of Hashtable) + Public Property UIData() As System.Collections.Generic.List(Of Hashtable) + Get + Return Me._UIData + End Get + Set(ByVal value As System.Collections.Generic.List(Of Hashtable)) + Me._UIData = value + End Set + End Property + + ' pagination properties + Protected _PageSize As Integer + Public Property PageSize() As Integer + Get + Return Me._PageSize + End Get + Set(ByVal value As Integer) + Me._PageSize = value + End Set + End Property + + Protected _PageIndex As Integer + Public Property PageIndex() As Integer + Get + ' Return the PageIndex + Return Me._PageIndex + End Get + Set(ByVal value As Integer) + Me._PageIndex = value + End Set + End Property + + Protected _TotalRecords As Integer = -1 + Public Property TotalRecords() As Integer + Get + If _TotalRecords < 0 + _TotalRecords = PersonalTitleTable.GetRecordCount(CreateCompoundJoinFilter(), CreateWhereClause()) + End If + Return Me._TotalRecords + End Get + Set(ByVal value As Integer) + If Me.PageSize > 0 Then + + Me.TotalPages = CInt(Math.Ceiling(value / Me.PageSize)) + + End If + Me._TotalRecords = value + End Set + End Property + + + + Protected _TotalPages As Integer = -1 + Public Property TotalPages() As Integer + Get + If _TotalPages < 0 Then + + Me.TotalPages = CInt(Math.Ceiling(TotalRecords / Me.PageSize)) + + End If + Return Me._TotalPages + End Get + Set(ByVal value As Integer) + Me._TotalPages = value + End Set + End Property + + Protected _DisplayLastPage As Boolean + Public Property DisplayLastPage() As Boolean + Get + Return Me._DisplayLastPage + End Get + Set(ByVal value As Boolean) + Me._DisplayLastPage = value + End Set + End Property + + Private _DataChanged As Boolean = False + Public Property DataChanged() As Boolean + Get + Return Me._DataChanged + End Get + Set(ByVal value As Boolean) + Me._DataChanged = value + End Set + End Property + + Private _ResetData As Boolean = False + Public Property ResetData() As Boolean + Get + Return Me._ResetData + End Get + Set(ByVal value As Boolean) + Me._ResetData = value + End Set + End Property + + Private _AddNewRecord As Integer = 0 + Public Property AddNewRecord() As Integer + Get + Return Me._AddNewRecord + End Get + Set(ByVal value As Integer) + Me._AddNewRecord = value + End Set + End Property + + + Private _CurrentSortOrder As OrderBy = Nothing + Public Property CurrentSortOrder() As OrderBy + Get + Return Me._CurrentSortOrder + End Get + Set(ByVal value As BaseClasses.Data.OrderBy) + Me._CurrentSortOrder = value + End Set + End Property + + Private _DataSource() As PersonalTitleRecord = Nothing + Public Property DataSource() As PersonalTitleRecord () + Get + Return Me._DataSource + End Get + Set(ByVal value() As PersonalTitleRecord) + Me._DataSource = value + End Set + End Property + +#Region "Helper Properties" + + Public ReadOnly Property CommandDateLabel3() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "CommandDateLabel3"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property CommandLabel2() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "CommandLabel2"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property DeptLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "DeptLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property PersonalTitleAddButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalTitleAddButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalTitleDeleteButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalTitleDeleteButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalTitleEditButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalTitleEditButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalTitlePagination() As Persons.UI.IPagination + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalTitlePagination"), Persons.UI.IPagination) + End Get + End Property + + Public ReadOnly Property PersonalTitleResetButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalTitleResetButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalTitleTableControlCollapsibleRegion() As System.Web.UI.WebControls.Panel + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalTitleTableControlCollapsibleRegion"), System.Web.UI.WebControls.Panel) + End Get + End Property + + Public ReadOnly Property PersonalTitleToggleAll() As System.Web.UI.WebControls.CheckBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalTitleToggleAll"), System.Web.UI.WebControls.CheckBox) + End Get + End Property + + Public ReadOnly Property SkillNoLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "SkillNoLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property TitleDateLabel1() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "TitleDateLabel1"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property TitleLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "TitleLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property TitleRankLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "TitleRankLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + +#End Region + +#Region "Helper Functions" + + Public Overrides Overloads Function ModifyRedirectUrl(url As String, arg As String, ByVal bEncrypt As Boolean) As String + Return Me.Page.EvaluateExpressions(url, arg, bEncrypt, Me) + End Function + + Public Overrides Overloads Function EvaluateExpressions(url As String, arg As String, ByVal bEncrypt As Boolean) As String + Dim needToProcess As Boolean = AreAnyUrlParametersForMe(url, arg) + If (needToProcess) Then + Dim recCtl As PersonalTitleTableControlRow = Me.GetSelectedRecordControl() + If recCtl Is Nothing AndAlso url.IndexOf("{") >= 0 Then + ' Localization. + Throw New Exception(Page.GetResourceValue("Err:NoRecSelected", "Persons")) + End If + Dim rec As PersonalTitleRecord = Nothing + If recCtl IsNot Nothing Then + rec = recCtl.GetRecord() + End If + Return EvaluateExpressions(url, arg, rec, bEncrypt) + End If + Return url + End Function + + Public Overridable Function GetSelectedRecordIndex() As Integer + Dim counter As Integer = 0 + Dim recControl As PersonalTitleTableControlRow + For Each recControl In Me.GetRecordControls() + If recControl.PersonalTitleRecordRowSelection.Checked Then + Return counter + End If + counter += 1 + Next + Return -1 + End Function + + Public Overridable Function GetSelectedRecordControl() As PersonalTitleTableControlRow + Dim selectedList() As PersonalTitleTableControlRow = Me.GetSelectedRecordControls() + If selectedList.Length = 0 Then + Return Nothing + End If + Return selectedList(0) + + End Function + + Public Overridable Function GetSelectedRecordControls() As PersonalTitleTableControlRow() + + Dim selectedList As ArrayList = New ArrayList(25) + Dim recControl As PersonalTitleTableControlRow + For Each recControl In Me.GetRecordControls() + If recControl.PersonalTitleRecordRowSelection IsNot Nothing AndAlso recControl.PersonalTitleRecordRowSelection.Checked Then + selectedList.Add(recControl) + End If + Next + Return DirectCast(selectedList.ToArray(GetType(PersonalTitleTableControlRow)), PersonalTitleTableControlRow()) + + End Function + + Public Overridable Sub DeleteSelectedRecords(ByVal deferDeletion As Boolean) + Dim recList() As PersonalTitleTableControlRow = Me.GetSelectedRecordControls() + If recList.Length = 0 Then + ' Localization. + Throw New Exception(Page.GetResourceValue("Err:NoRecSelected", "Persons")) + End If + + Dim recCtl As PersonalTitleTableControlRow + For Each recCtl In recList + If deferDeletion Then + If Not recCtl.IsNewRecord Then + + Me.AddToDeletedRecordIds(recCtl) + + End If + recCtl.Visible = False + + recCtl.PersonalTitleRecordRowSelection.Checked = False + + Else + + recCtl.Delete() + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + End If + Next + End Sub + + Public Function GetRecordControls() As PersonalTitleTableControlRow() + Dim recList As ArrayList = New ArrayList() + Dim rep As System.Web.UI.WebControls.Repeater = CType(Me.FindControl("PersonalTitleTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return Nothing + Dim repItem As System.Web.UI.WebControls.RepeaterItem + + For Each repItem In rep.Items + + Dim recControl As PersonalTitleTableControlRow = DirectCast(repItem.FindControl("PersonalTitleTableControlRow"), PersonalTitleTableControlRow) + recList.Add(recControl) + + Next + + Return DirectCast(recList.ToArray(GetType(PersonalTitleTableControlRow)), PersonalTitleTableControlRow()) + End Function + + Public Shadows ReadOnly Property Page() As BaseApplicationPage + Get + Return DirectCast(MyBase.Page, BaseApplicationPage) + End Get + End Property + +#End Region + + + +End Class + + +' Base class for the PersonRelativeTableControlRow control on the EditPersonalId page. +' Do not modify this class. Instead override any method in PersonRelativeTableControlRow. +Public Class BasePersonRelativeTableControlRow + Inherits Persons.UI.BaseApplicationRecordControl + + ' To customize, override this method in PersonRelativeTableControlRow. + Protected Overridable Sub Control_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Init + + Me.ClearControlsFromSession() + End Sub + + ' To customize, override this method in PersonRelativeTableControlRow. + Protected Overridable Sub Control_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load + + 'Call LoadFocusScripts from repeater so that onfocus attribute could be added to elements + Me.Page.LoadFocusScripts(Me) + + ' Show confirmation message on Click + Me.PersonRelativeRowDeleteButton.Attributes.Add("onClick", "return (confirm('" & (CType(Me.Page,BaseApplicationPage)).GetResourceValue("DeleteRecordConfirm", "Persons") & "'));") + + + ' Register the event handlers. + + AddHandler Me.PersonRelativeRowDeleteButton.Click, AddressOf PersonRelativeRowDeleteButton_Click + + AddHandler Me.PersonRelativeRowEditButton.Click, AddressOf PersonRelativeRowEditButton_Click + + 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.Ref4.TextChanged, AddressOf Ref4_TextChanged + + AddHandler Me.RefDate2.TextChanged, AddressOf RefDate2_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 + + ' Since this is a row in the table, the data for this row is loaded by the + ' LoadData method of the BasePersonRelativeTableControl when the data for the entire + ' table is loaded. + + Me.DataSource = New PersonRelativeRecord() + + + + End Sub + + ' Populate the UI controls using the DataSource. To customize, override this method in PersonRelativeTableControlRow. + 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() + SetFName() + SetMLastName() + SetMName() + SetMOrLastName() + + + SetRAddress() + SetRAmphur() + SetRBirthDate() + SetRef4() + SetRefDate2() + SetRelationId() + SetRFirstName() + SetRLastName() + SetRNationality() + SetROrigin() + SetROrLastName() + SetRPreName() + SetRProvince() + SetRReligion() + SetRRemark() + SetRStatus() + SetRStatusDate() + SetRStatusRef() + + + 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() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.FLastName.ID) Then + + Me.FLastName.Text = Me.PreviousUIData(Me.FLastName.ID).ToString() + + Return + End If + + + ' 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() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.FName.ID) Then + + Me.FName.Text = Me.PreviousUIData(Me.FName.ID).ToString() + + Return + End If + + + ' 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() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.MLastName.ID) Then + + Me.MLastName.Text = Me.PreviousUIData(Me.MLastName.ID).ToString() + + Return + End If + + + ' 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() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.MName.ID) Then + + Me.MName.Text = Me.PreviousUIData(Me.MName.ID).ToString() + + Return + End If + + + ' 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() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.MOrLastName.ID) Then + + Me.MOrLastName.Text = Me.PreviousUIData(Me.MOrLastName.ID).ToString() + + Return + End If + + + ' 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() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.RAddress.ID) Then + + Me.RAddress.Text = Me.PreviousUIData(Me.RAddress.ID).ToString() + + Return + End If + + + ' 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() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.RAmphur.ID) Then + + Me.RAmphur.Text = Me.PreviousUIData(Me.RAmphur.ID).ToString() + + Return + End If + + + ' 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() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.RBirthDate.ID) Then + + Me.RBirthDate.Text = Me.PreviousUIData(Me.RBirthDate.ID).ToString() + + Return + End If + + + ' 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 SetRef4() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.Ref4.ID) Then + + Me.Ref4.Text = Me.PreviousUIData(Me.Ref4.ID).ToString() + + Return + End If + + + ' 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.Ref4 is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetRef4() + ' 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.Ref4.Text = formattedValue + + Else + + ' Ref is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.Ref4.Text = PersonRelativeTable.Ref0.Format(PersonRelativeTable.Ref0.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetRefDate2() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.RefDate2.ID) Then + + Me.RefDate2.Text = Me.PreviousUIData(Me.RefDate2.ID).ToString() + + Return + End If + + + ' 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.RefDate2 is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetRefDate2() + ' 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.RefDate2.Text = formattedValue + + Else + + ' RefDate is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.RefDate2.Text = PersonRelativeTable.RefDate.Format(PersonRelativeTable.RefDate.DefaultValue, "d MMM yy") + + End If + + End Sub + + Public Overridable Sub SetRelationId() + + ' If selection was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.RelationId.ID) Then + If Me.PreviousUIData(Me.RelationId.ID) Is Nothing + Me.PopulateRelationIdDropDownList(Nothing, 100) + Else + Me.PopulateRelationIdDropDownList(Me.PreviousUIData(Me.RelationId.ID).ToString(), 100) + End If + Return + End If + + + ' 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() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.RFirstName.ID) Then + + Me.RFirstName.Text = Me.PreviousUIData(Me.RFirstName.ID).ToString() + + Return + End If + + + ' 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() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.RLastName.ID) Then + + Me.RLastName.Text = Me.PreviousUIData(Me.RLastName.ID).ToString() + + Return + End If + + + ' 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() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.RNationality.ID) Then + + Me.RNationality.Text = Me.PreviousUIData(Me.RNationality.ID).ToString() + + Return + End If + + + ' 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() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.ROrigin.ID) Then + + Me.ROrigin.Text = Me.PreviousUIData(Me.ROrigin.ID).ToString() + + Return + End If + + + ' 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() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.ROrLastName.ID) Then + + Me.ROrLastName.Text = Me.PreviousUIData(Me.ROrLastName.ID).ToString() + + Return + End If + + + ' 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() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.RPreName.ID) Then + + Me.RPreName.Text = Me.PreviousUIData(Me.RPreName.ID).ToString() + + Return + End If + + + ' 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() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.RProvince.ID) Then + + Me.RProvince.Text = Me.PreviousUIData(Me.RProvince.ID).ToString() + + Return + End If + + + ' 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() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.RReligion.ID) Then + + Me.RReligion.Text = Me.PreviousUIData(Me.RReligion.ID).ToString() + + Return + End If + + + ' 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() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.RRemark.ID) Then + + Me.RRemark.Text = Me.PreviousUIData(Me.RRemark.ID).ToString() + + Return + End If + + + ' 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() + + ' If selection was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.RStatus.ID) Then + If Me.PreviousUIData(Me.RStatus.ID) Is Nothing + Me.PopulateRStatusDropDownList(Nothing, 100) + Else + Me.PopulateRStatusDropDownList(Me.PreviousUIData(Me.RStatus.ID).ToString(), 100) + End If + Return + End If + + + ' 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() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.RStatusDate.ID) Then + + Me.RStatusDate.Text = Me.PreviousUIData(Me.RStatusDate.ID).ToString() + + Return + End If + + + ' 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() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.RStatusRef.ID) Then + + Me.RStatusRef.Text = Me.PreviousUIData(Me.RStatusRef.ID).ToString() + + Return + End If + + + ' 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 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 PersonRelativeTableControlRow. + 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 parentCtrl As PersonalIdRecordControl + + + parentCtrl = DirectCast(Me.Page.FindControlRecursively("PersonalIdRecordControl"), PersonalIdRecordControl) + + If (Not IsNothing(parentCtrl) AndAlso IsNothing(parentCtrl.DataSource)) + ' Load the record if it is not loaded yet. + parentCtrl.LoadData() + End If + If (IsNothing(parentCtrl) OrElse IsNothing(parentCtrl.DataSource)) + ' Get the error message from the application resource file. + Throw New Exception(Page.GetResourceValue("Err:NoParentRecId", "Persons")) + End If + + Me.DataSource.PersonalId = parentCtrl.DataSource.PersonalId + + ' 2. Perform any custom validation. + Me.Validate() + + + ' 3. Set the values in the record with data from UI controls. + ' This calls the Get() method for each of the user interface controls. + Me.GetUIData() + + ' 4. Save in the database. + ' We should not save the record if the data did not change. This + ' will save a database hit and avoid triggering any database triggers. + + If Me.DataSource.IsAnyValueChanged Then + ' Save record to database but do not commit yet. + ' Auto generated ids are available after saving for use by child (dependent) records. + Me.DataSource.Save() + + DirectCast(GetParentControlObject(Me, "PersonRelativeTableControl"), PersonRelativeTableControl).DataChanged = True + DirectCast(GetParentControlObject(Me, "PersonRelativeTableControl"), PersonRelativeTableControl).ResetData = True + End If + + + ' update session or cookie by formula + + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + ' For Master-Detail relationships, save data on the Detail table(s) + + End Sub + + ' To customize, override this method in PersonRelativeTableControlRow. + 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() + GetRef4() + GetRefDate2() + 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 GetRef4() + + ' 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.Ref4.Text, PersonRelativeTable.Ref0) + + + End Sub + + Public Overridable Sub GetRefDate2() + + ' 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.RefDate2.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 PersonRelativeTableControlRow. + + Public Overridable Function CreateWhereClause() As WhereClause + + Return Nothing + + End Function + + + + ' To customize, override this method in PersonRelativeTableControlRow. + 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) + + DirectCast(GetParentControlObject(Me, "PersonRelativeTableControl"), PersonRelativeTableControl).DataChanged = True + DirectCast(GetParentControlObject(Me, "PersonRelativeTableControl"), PersonRelativeTableControl).ResetData = True + End Sub + + Protected Overridable Sub Control_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.PreRender + ' PreRender event is raised just before page is being displayed. + Try + DbUtils.StartTransaction() + Me.RegisterPostback() + + If Not Me.Page.ErrorOnPage AndAlso (Me.Page.IsPageRefresh OrElse Me.DataChanged OrElse Me.ResetData) Then + + + ' Re-load the data and update the web page if necessary. + ' This is typically done during a postback (filter, search button, sort, pagination button). + ' In each of the other click handlers, simply set DataChanged to True to reload the data. + Me.LoadData() + Me.DataBind() + End If + + + Catch ex As Exception + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + Finally + DbUtils.EndTransaction() + End Try + End Sub + + + Protected Overrides Sub SaveControlsToSession() + MyBase.SaveControlsToSession() + + + 'Save pagination state to session. + + End Sub + + + + Protected Overrides Sub ClearControlsFromSession() + MyBase.ClearControlsFromSession() + + + + ' Clear pagination state from session. + + End Sub + + Protected Overrides Sub LoadViewState(ByVal savedState As Object) + MyBase.LoadViewState(savedState) + Dim isNewRecord As String = CType(ViewState("IsNewRecord"), String) + If Not isNewRecord Is Nothing AndAlso isNewRecord.Trim <> "" Then + Me.IsNewRecord = Boolean.Parse(isNewRecord) + End If + + Dim myCheckSum As String = CType(ViewState("CheckSum"), String) + If Not myCheckSum Is Nothing AndAlso myCheckSum.Trim <> "" Then + Me.CheckSum = myCheckSum + End If + + + ' Load view state for pagination control. + + End Sub + + Protected Overrides Function SaveViewState() As Object + ViewState("IsNewRecord") = Me.IsNewRecord.ToString() + ViewState("CheckSum") = Me.CheckSum + + + ' Load view state for pagination control. + + Return MyBase.SaveViewState() + End Function + + + + 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 + + ' event handler for ImageButton + Public Overridable Sub PersonRelativeRowDeleteButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + If(Not Me.Page.IsPageRefresh) Then + + Dim tc As PersonRelativeTableControl = DirectCast(GetParentControlObject(Me, "PersonRelativeTableControl"), PersonRelativeTableControl) + If Not (IsNothing(tc)) Then + If Not Me.IsNewRecord Then + tc.AddToDeletedRecordIds(DirectCast(Me, PersonRelativeTableControlRow)) + End If + Me.Visible = False + tc.SetFormulaControls() + End If + + End If + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonRelativeRowEditButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + ' The redirect URL is set on the Properties, Custom Properties or Actions. + ' The ModifyRedirectURL call resolves the parameters before the + ' Response.Redirect redirects the page to the URL. + ' Any code after the Response.Redirect call will not be executed, since the page is + ' redirected to the URL. + + + Dim url As String = "../PersonRelative/EditPersonRelative.aspx?PersonRelative={PersonRelativeTableControlRow:PK}" + + Dim shouldRedirect As Boolean = True + Dim TargetKey As String = Nothing + Dim DFKA As String = TargetKey + Dim id As String = DFKA + Dim value As String = id + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + url = Me.ModifyRedirectUrl(url, "",False) + url = Me.Page.ModifyRedirectUrl(url, "",False) + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + shouldRedirect = False + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + If shouldRedirect Then + Me.Page.ShouldSaveControlsToSession = True + Me.Page.Response.Redirect(url) + ElseIf Not TargetKey Is Nothing AndAlso _ + Not shouldRedirect Then + Me.Page.ShouldSaveControlsToSession = True + Me.Page.CloseWindow(True) + + End If + End Sub + + 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 Ref4_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub RefDate2_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("BasePersonRelativeTableControlRow_Rec"), String) + End Get + Set(ByVal value As String) + Me.ViewState("BasePersonRelativeTableControlRow_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 _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 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 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 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 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 PersonRelativeRowDeleteButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonRelativeRowDeleteButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonRelativeRowEditButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonRelativeRowEditButton"), System.Web.UI.WebControls.ImageButton) + 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 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 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 Ref4() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Ref4"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property RefDate2() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RefDate2"), System.Web.UI.WebControls.TextBox) + 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 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 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 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 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 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 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 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 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 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 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 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 + +#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. + + Return Nothing + + End Function + + Public Shadows ReadOnly Property Page() As BaseApplicationPage + Get + Return DirectCast(MyBase.Page, BaseApplicationPage) + End Get + End Property + +#End Region + +End Class + + + +' Base class for the PersonRelativeTableControl control on the EditPersonalId page. +' Do not modify this class. Instead override any method in PersonRelativeTableControl. +Public Class BasePersonRelativeTableControl + Inherits Persons.UI.BaseApplicationTableControl + + + + Protected Overridable Sub Control_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Init + + + + ' Setup the filter and search events. + + + + ' Control Initializations. + ' Initialize the table's current sort order. + + If Me.InSession(Me, "Order_By") Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + Me.CurrentSortOrder.Add(PersonRelativeTable.RelationId, OrderByItem.OrderDir.Asc) + + Me.CurrentSortOrder.Add(PersonRelativeTable.RBirthDate, OrderByItem.OrderDir.Asc) + + End If + + + + ' Setup default pagination settings. + + Me.PageSize = CInt(Me.GetFromSession(Me, "Page_Size", "10")) + Me.PageIndex = CInt(Me.GetFromSession(Me, "Page_Index", "0")) + + + + Me.ClearControlsFromSession() + End Sub + + Protected Overridable Sub Control_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load + + SaveControlsToSession_Ajax() + + ' Setup the pagination events. + + AddHandler Me.PersonRelativePagination.FirstPage.Click, AddressOf PersonRelativePagination_FirstPage_Click + + AddHandler Me.PersonRelativePagination.LastPage.Click, AddressOf PersonRelativePagination_LastPage_Click + + AddHandler Me.PersonRelativePagination.NextPage.Click, AddressOf PersonRelativePagination_NextPage_Click + + AddHandler Me.PersonRelativePagination.PageSizeButton.Click, AddressOf PersonRelativePagination_PageSizeButton_Click + + AddHandler Me.PersonRelativePagination.PreviousPage.Click, AddressOf PersonRelativePagination_PreviousPage_Click + + + ' Setup the sorting events. + + ' Setup the button events. + + AddHandler Me.PersonRelativeAddButton.Click, AddressOf PersonRelativeAddButton_Click + + AddHandler Me.PersonRelativeRefreshButton.Click, AddressOf PersonRelativeRefreshButton_Click + + AddHandler Me.PersonRelativeResetButton.Click, AddressOf PersonRelativeResetButton_Click + + AddHandler Me.PersonRelativeSaveButton.Click, AddressOf PersonRelativeSaveButton_Click + + Me.PersonRelativeSaveButton.Attributes.Add("onclick", "SubmitHRefOnce(this, """ & Me.Page.GetResourceValue("Txt:SaveRecord", "Persons") & """);") + + + ' Setup events for others + + End Sub + + + Public Overridable Sub LoadData() + + ' Read data from database. Returns an array of records that can be assigned + ' to the DataSource table control property. + Try + Dim joinFilter As CompoundFilter = CreateCompoundJoinFilter() + + ' The WHERE clause will be empty when displaying all records in table. + Dim wc As WhereClause = CreateWhereClause() + If wc IsNot Nothing AndAlso Not wc.RunQuery Then + ' Initialize an empty array of records + Dim alist As New ArrayList(0) + Me.DataSource = DirectCast(alist.ToArray(GetType(PersonRelativeRecord)), PersonRelativeRecord()) + ' Add records to the list if needed. + Me.AddNewRecords() + Me._TotalRecords = 0 + Me._TotalPages = 0 + Return + End If + + ' Call OrderBy to determine the order - either use the order defined + ' on the Query Wizard, or specified by user (by clicking on column heading) + Dim orderBy As OrderBy = CreateOrderBy() + + ' Get the pagesize from the pagesize control. + Me.GetPageSize() + + If Me.DisplayLastPage Then + Dim totalRecords As Integer = If(Me._TotalRecords < 0, PersonRelativeTable.GetRecordCount(CreateCompoundJoinFilter(), CreateWhereClause()), Me._TotalRecords) + + Dim totalPages As Integer = CInt(Math.Ceiling(totalRecords / Me.PageSize)) + + Me.PageIndex = totalPages - 1 + End If + + ' Make sure PageIndex (current page) and PageSize are within bounds. + If Me.PageIndex < 0 Then + Me.PageIndex = 0 + End If + If Me.PageSize < 1 Then + Me.PageSize = 1 + End If + + ' Retrieve the records and set the table DataSource. + ' Only PageSize records are fetched starting at PageIndex (zero based). + If Me.AddNewRecord > 0 Then + ' Make sure to preserve the previously entered data on new rows. + Dim postdata As New ArrayList + For Each rc As PersonRelativeTableControlRow In Me.GetRecordControls() + If Not rc.IsNewRecord Then + rc.DataSource = rc.GetRecord() + rc.GetUIData() + postdata.Add(rc.DataSource) + UIData.Add(rc.PreservedUIData()) + End If + Next + Me.DataSource = DirectCast(postdata.ToArray(GetType(PersonRelativeRecord)), PersonRelativeRecord()) + Else ' Get the records from the database + Me.DataSource = PersonRelativeTable.GetRecords(joinFilter, wc, orderBy, Me.PageIndex, Me.PageSize) + + End If + + ' if the datasource contains no records contained in database, then load the last page. + If (DbUtils.GetCreatedRecords(Me.DataSource).Length = 0 AndAlso Not Me.DisplayLastPage) Then + Me.DisplayLastPage = True + LoadData() + Else + + ' Add any new rows desired by the user. + Me.AddNewRecords() + + + ' Initialize the page and grand totals. now + + End If + + Catch ex As Exception + ' Report the error message to the end user + Dim msg As String = ex.Message + If ex.InnerException IsNot Nothing Then + msg = msg & " InnerException: " & ex.InnerException.Message + End If + Throw New Exception(msg, ex.InnerException) + End Try + End Sub + + + + + Public Overrides Sub DataBind() + ' The DataBind method binds the user interface controls to the values + ' from the database record for each row in the table. To do this, it calls the + ' DataBind for each of the rows. + ' DataBind also populates any filters above the table, and sets the pagination + ' control to the correct number of records and the current page number. + + MyBase.DataBind() + + ' Make sure that the DataSource is initialized. + If Me.DataSource Is Nothing Then + Return + End If + + 'LoadData for DataSource for chart and report if they exist + + ' Improve performance by prefetching display as records. + Me.PreFetchForeignKeyValues() + + ' Setup the pagination controls. + BindPaginationControls() + + + + ' Bind the repeater with the list of records to expand the UI. + Dim rep As System.Web.UI.WebControls.Repeater = CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonRelativeTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return + rep.DataSource = DataSource() + rep.DataBind() + + Dim index As Integer = 0 + For Each repItem As System.Web.UI.WebControls.RepeaterItem In rep.Items + ' Loop through all rows in the table, set its DataSource and call DataBind(). + Dim recControl As PersonRelativeTableControlRow = DirectCast(repItem.FindControl("PersonRelativeTableControlRow"), PersonRelativeTableControlRow) + recControl.DataSource = Me.DataSource(index) + If Me.UIData.Count > index Then + recControl.PreviousUIData = Me.UIData(index) + End If + recControl.DataBind() + recControl.Visible = Not Me.InDeletedRecordIds(recControl) + + index += 1 + Next + + + + + ' Call the Set methods for each controls on the panel + + SetFLastNameLabel() + SetFNameLabel() + SetMLastNameLabel() + SetMNameLabel() + SetMOrLastNameLabel() + + + + + + SetPersonRelativeTableControlCollapsibleRegion() + SetRAddressLabel() + SetRAmphurLabel() + SetRBirthDateLabel() + SetRefDateLabel2() + SetRefLabel3() + SetRelationIdLabel1() + SetRFirstNameLabel() + SetRLastNameLabel() + SetRNationalityLabel() + SetROriginLabel() + SetROrLastNameLabel() + SetRPreNameLabel() + SetRProvinceLabel() + SetRReligionLabel() + SetRRemarkLabel() + SetRStatusDateLabel() + SetRStatusLabel() + SetRStatusRefLabel() + ' setting the state of expand or collapse alternative rows + + + ' Load data for each record and table UI control. + ' Ordering is important because child controls get + ' their parent ids from their parent UI controls. + + + ' this method calls the set method for controls with special formula like running total, sum, rank, etc + SetFormulaControls() + End Sub + + Public Overridable Sub SetFormulaControls() + ' this method calls Set methods for the control that has special formula + + + + End Sub + + + Public Sub PreFetchForeignKeyValues() + If (IsNothing(Me.DataSource)) + Return + End If + + Me.Page.PregetDfkaRecords(PersonRelativeTable.RelationId, Me.DataSource) + + Me.Page.PregetDfkaRecords(PersonRelativeTable.RStatus, Me.DataSource) + + End Sub + + + Public Overridable Sub RegisterPostback() + + Me.Page.RegisterPostBackTrigger(MiscUtils.FindControlRecursively(Me,"PersonRelativeSaveButton")) + + + End Sub + + Public EvaluateFormulaDelegate As BaseClasses.Data.DataSource.EvaluateFormulaDelegate = New BaseClasses.Data.DataSource.EvaluateFormulaDelegate(AddressOf Me.EvaluateFormula) + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean, ByVal e as FormulaEvaluator) As String + If e Is Nothing + e = New FormulaEvaluator() + End If + + e.Variables.Clear() + + + ' add variables for formula evaluation + If variables IsNot Nothing Then + Dim enumerator As System.Collections.Generic.IEnumerator(Of System.Collections.Generic.KeyValuePair(Of String, Object)) = variables.GetEnumerator() + While enumerator.MoveNext() + e.Variables.Add(enumerator.Current.Key, enumerator.Current.Value) + End While + End If + + If includeDS + + End If + + ' All variables referred to in the formula are expected to be + ' properties of the DataSource. For example, referring to + ' UnitPrice as a variable will refer to DataSource.UnitPrice + e.DataSource = dataSourceForEvaluate + + ' Define the calling control. This is used to add other + ' related table and record controls as variables. + e.CallingControl = Me + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + + If Not String.IsNullOrEmpty(format) AndAlso (String.IsNullOrEmpty(formula) OrElse formula.IndexOf("Format(") < 0) Then + Return FormulaUtils.Format(resultObj, format) + Else + Return resultObj.ToString() + End If + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format,variables ,includeDS, Nothing) + End Function + + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object)) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format, variables ,True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, format, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal e as FormulaEvaluator) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, variables, True, e) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal includeDS as Boolean) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, includeDS, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, True, Nothing) + End Function + + + + + Public Overridable Sub ResetControl() + + Me.CurrentSortOrder.Reset() + If (Me.InSession(Me, "Order_By")) Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + Me.CurrentSortOrder.Add(PersonRelativeTable.RelationId, OrderByItem.OrderDir.Asc) + + Me.CurrentSortOrder.Add(PersonRelativeTable.RBirthDate, OrderByItem.OrderDir.Asc) + + End If + + Me.PageIndex = 0 + End Sub + + Protected Overridable Sub BindPaginationControls() + ' Setup the pagination controls. + + ' Bind the pagination labels. + + If DbUtils.GetCreatedRecords(Me.DataSource).Length > 0 Then + + Me.PersonRelativePagination.CurrentPage.Text = (Me.PageIndex + 1).ToString() + Else + Me.PersonRelativePagination.CurrentPage.Text = "0" + End If + Me.PersonRelativePagination.PageSize.Text = Me.PageSize.ToString() + Me.PersonRelativePagination.TotalItems.Text = Me.TotalRecords.ToString() + Me.PersonRelativePagination.TotalPages.Text = Me.TotalPages.ToString() + + ' Bind the buttons for PersonRelativeTableControl pagination. + + Me.PersonRelativePagination.FirstPage.Enabled = Not (Me.PageIndex = 0) + If Me._TotalPages < 0 Then ' if the total pages is not determined yet, enable last and next buttons + Me.PersonRelativePagination.LastPage.Enabled = True + ElseIf Me._TotalPages = 0 ' if the total pages is determined and it is 0, enable last and next buttons + Me.PersonRelativePagination.LastPage.Enabled = False + Else ' if the total pages is the last page, disable last and next buttons + Me.PersonRelativePagination.LastPage.Enabled = Not (Me.PageIndex = Me.TotalPages - 1) + End If + + If Me._TotalPages < 0 Then ' if the total pages is not determined yet, enable last and next buttons + Me.PersonRelativePagination.NextPage.Enabled = True + ElseIf Me._TotalPages = 0 ' if the total pages is determined and it is 0, enable last and next buttons + Me.PersonRelativePagination.NextPage.Enabled = False + Else ' if the total pages is the last page, disable last and next buttons + Me.PersonRelativePagination.NextPage.Enabled = Not (Me.PageIndex = Me.TotalPages - 1) + End If + + Me.PersonRelativePagination.PreviousPage.Enabled = Not (Me.PageIndex = 0) + + + End Sub + + Public Overridable Sub SaveData() + ' Save the data from the entire table. Calls each row's Save Data + ' to save their data. This function is called by the Click handler of the + ' Save button. The button handler should Start/Commit/End a transaction. + + Dim recCtl As PersonRelativeTableControlRow + For Each recCtl In Me.GetRecordControls() + + If Me.InDeletedRecordIds(recCtl) Then + ' Delete any pending deletes. + recCtl.Delete() + Else + If recCtl.Visible Then + recCtl.SaveData() + End If + End If + + Next + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + ' Set IsNewRecord to False for all records - since everything has been saved and is no longer "new" + For Each recCtl In Me.GetRecordControls() + recCtl.IsNewRecord = False + Next + + + ' Set DeletedRecordsIds to Nothing since we have deleted all pending deletes. + Me.DeletedRecordIds = Nothing + + End Sub + + Public Overridable Function CreateCompoundJoinFilter() As CompoundFilter + Dim jFilter As CompoundFilter = New CompoundFilter() + + Return jFilter + + End Function + + + Public Overridable Function CreateOrderBy() As OrderBy + ' The CurrentSortOrder is initialized to the sort order on the + ' Query Wizard. It may be modified by the Click handler for any of + ' the column heading to sort or reverse sort by that column. + ' You can add your own sort order, or modify it on the Query Wizard. + Return Me.CurrentSortOrder + End Function + + Public Overridable Function CreateWhereClause() As WhereClause + 'This CreateWhereClause is used for loading the data. + 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 search criteria. + ' 3. User selected filter criteria. + + + Dim selectedRecordKeyValue as KeyValue = New KeyValue() + + Dim personalIdRecordControlObj As Persons.UI.Controls.EditPersonalId.PersonalIdRecordControl = DirectCast(MiscUtils.FindControlRecursively(Me.Page, "PersonalIdRecordControl"), Persons.UI.Controls.EditPersonalId.PersonalIdRecordControl) + + If (Not IsNothing(personalIdRecordControlObj) AndAlso Not IsNothing(personalIdRecordControlObj.GetRecord()) AndAlso personalIdRecordControlObj.GetRecord().IsCreated AndAlso Not IsNothing(personalIdRecordControlObj.GetRecord().PersonalId)) + wc.iAND(PersonRelativeTable.PersonalId, BaseFilter.ComparisonOperator.EqualsTo, personalIdRecordControlObj.GetRecord().PersonalId.ToString()) + selectedRecordKeyValue.AddElement(PersonRelativeTable.PersonalId.InternalName, personalIdRecordControlObj.GetRecord().PersonalId.ToString()) + Else + wc.RunQuery = False + Return wc + End If + + HttpContext.Current.Session("PersonRelativeTableControlWhereClause") = selectedRecordKeyValue.ToXmlString() + + Return wc + End Function + + + Public Overridable Function CreateWhereClause(ByVal searchText as String, ByVal fromSearchControl as String, ByVal AutoTypeAheadSearch as String, ByVal AutoTypeAheadWordSeparators as String) As WhereClause + ' This CreateWhereClause is used for loading list of suggestions for Auto Type-Ahead feature. + 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 search criteria. + ' 3. User selected filter criteria. + + Dim appRelativeVirtualPath As String = CType(HttpContext.Current.Session("AppRelativeVirtualPath"), String) + + Dim selectedRecordInPersonalIdRecordControl as String = DirectCast(HttpContext.Current.Session("PersonRelativeTableControlWhereClause"), String) + + If Not selectedRecordInPersonalIdRecordControl Is Nothing AndAlso KeyValue.IsXmlKey(selectedRecordInPersonalIdRecordControl) Then + Dim selectedRecordKeyValue as KeyValue = KeyValue.XmlToKey(selectedRecordInPersonalIdRecordControl) + + If Not IsNothing(selectedRecordKeyValue) AndAlso selectedRecordKeyValue.ContainsColumn(PersonRelativeTable.PersonalId) Then + wc.iAND(PersonRelativeTable.PersonalId, BaseFilter.ComparisonOperator.EqualsTo, selectedRecordKeyValue.GetColumnValue(PersonRelativeTable.PersonalId).ToString()) + End If + + End If + + ' Adds clauses if values are selected in Filter controls which are configured in the page. + + + Return wc + End Function + + + Public Overridable Function FormatSuggestions(ByVal prefixText As String, ByVal resultItem As String, _ + ByVal columnLength As Integer, ByVal AutoTypeAheadDisplayFoundText As String, _ + ByVal autoTypeAheadSearch As String, ByVal AutoTypeAheadWordSeparators As String, _ + ByVal resultList As ArrayList) As Boolean + + 'Formats the resultItem and adds it to the list of suggestions. + Dim index As Integer = resultItem.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture).IndexOf(prefixText.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture)) + Dim itemToAdd As String = "" + Dim isFound As Boolean = False + Dim isAdded As Boolean = False + ' Get the index where prfixt is at the beginning of resultItem. If not found then, index of word which begins with prefixText. + If InvariantLCase(autoTypeAheadSearch).equals("wordsstartingwithsearchstring") And Not index = 0 Then + ' Expression to find word which contains AutoTypeAheadWordSeparators followed by prefixText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex( AutoTypeAheadWordSeparators + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + If regex1.IsMatch(resultItem) Then + index = regex1.Match(resultItem).Index + isFound = True + End If + ' If the prefixText is found immediatly after white space then starting of the word is found so don not search any further + If not resultItem(index).ToString() = " " Then + ' Expression to find beginning of the word which contains AutoTypeAheadWordSeparators followed by prefixText + Dim regex As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\\S*" + AutoTypeAheadWordSeparators + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + If regex.IsMatch(resultItem) Then + index = regex.Match(resultItem).Index + isFound = True + End If + End If + End If + + ' If autoTypeAheadSearch value is wordsstartingwithsearchstring then, extract the substring only if the prefixText is found at the + ' beginning of the resultItem (index = 0) or a word in resultItem is found starts with prefixText. + If index = 0 Or isFound Or InvariantLCase(autoTypeAheadSearch).Equals("anywhereinstring") then + If InvariantLCase(AutoTypeAheadDisplayFoundText).equals("atbeginningofmatchedstring") Then + ' Expression to find beginning of the word which contains prefixText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\\S*" + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + ' Find the beginning of the word which contains prefexText + If (StringUtils.InvariantLCase(autoTypeAheadSearch).Equals("anywhereinstring") AndAlso regex1.IsMatch(resultItem)) Then + index = regex1.Match(resultItem).Index + isFound = True + End If + ' Display string from the index till end of the string if sub string from index till end is less than columnLength value. + If Len(resultItem) - index <= columnLength Then + If index = 0 Then + itemToAdd = resultItem + Else + itemToAdd = "..." & resultItem.Substring(index, Len(resultItem) - index) + End If + Else + If index = 0 Then + itemToAdd = resultItem.Substring(index, (columnLength - 3)) & "..." + Else + 'Truncate the string to show only columnLength - 6 characters as begining and trailing "..." has to be appended. + itemToAdd = "..." & resultItem.Substring(index , columnLength - 6) & "..." + End If + End If + ElseIf InvariantLCase(AutoTypeAheadDisplayFoundText).equals("inmiddleofmatchedstring") Then + Dim subStringBeginIndex As Integer = CType(columnLength/2, Integer) + If Len(resultItem) <= columnLength Then + itemToAdd = resultItem + Else + ' Sanity check at end of the string + If index + Len(prefixText) = columnLength Then + itemToAdd = "..." & resultItem.Substring(index-columnLength,index) + ElseIf Len(resultItem) - index < subStringBeginIndex Then + ' Display string from the end till columnLength value if, index is closer to the end of the string. + itemToAdd = "..." & resultItem.Substring(Len(resultItem)-columnLength,Len(resultItem)) + ElseIf index <= subStringBeginIndex Then + ' Sanity chet at beginning of the string + itemToAdd = resultItem.Substring(0, columnLength) & "..." + Else + ' Display string containing text before the prefixText occures and text after the prefixText + itemToAdd = "..." & resultItem.Substring(index - subStringBeginIndex, columnLength) & "..." + End If + End If + ElseIf InvariantLCase(AutoTypeAheadDisplayFoundText).equals("atendofmatchedstring") Then + ' Expression to find ending of the word which contains prefexText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\s", System.Text.RegularExpressions.RegexOptions.IgnoreCase) + ' Find the ending of the word which contains prefexText + If regex1.IsMatch(resultItem, index + 1) Then + index = regex1.Match(resultItem, index + 1).Index + Else + ' If the word which contains prefexText is the last word in string, regex1.IsMatch returns false. + index = resultItem.Length + End If + If index > Len(resultItem) Then + index = Len(resultItem) + End If + ' If text from beginning of the string till index is less than columnLength value then, display string from the beginning till index. + If index <= columnLength Then + if index = Len(resultItem) Then 'Make decision to append "..." + itemToAdd = resultItem.Substring(0,index) + Else + itemToAdd = resultItem.Substring(0,index) & "..." + End If + Else + If index = Len(resultItem) Then + itemToAdd = "..." & resultItem.Substring(index - (columnLength - 3), (columnLength - 3)) + Else + 'Truncate the string to show only columnLength - 6 characters as begining and trailing "..." has to be appended. + itemToAdd = "..." & resultItem.Substring(index - (columnLength - 6), columnLength - 6) & "..." + End If + End If + End If + + ' Remove newline character from itemToAdd + Dim prefixTextIndex As Integer = itemToAdd.IndexOf(prefixText, StringComparison.CurrentCultureIgnoreCase) + ' If itemToAdd contains any newline after the search text then show text only till newline + Dim regex2 As System.Text.RegularExpressions.Regex = New System.Text.RegularExpressions.Regex("(" & vbCrLf & "|" & vbLf & ")", System.Text.RegularExpressions.RegexOptions.IgnoreCase) + Dim newLineIndexAfterPrefix As Integer = -1 + If regex2.IsMatch(itemToAdd, prefixTextIndex) Then + newLineIndexAfterPrefix = regex2.Match(itemToAdd, prefixTextIndex).Index + End If + If (newLineIndexAfterPrefix > -1) Then + If itemToAdd.EndsWith("...") Then + itemToAdd = (itemToAdd.Substring(0, newLineIndexAfterPrefix) + "...") + Else + itemToAdd = itemToAdd.Substring(0, newLineIndexAfterPrefix) + End If + End If + ' If itemToAdd contains any newline before search text then show text which comes after newline + Dim regex3 As System.Text.RegularExpressions.Regex = New System.Text.RegularExpressions.Regex("(" & vbCrLf & "|" & vbLf & ")", (System.Text.RegularExpressions.RegexOptions.IgnoreCase Or System.Text.RegularExpressions.RegexOptions.RightToLeft)) + Dim newLineIndexBeforePrefix As Integer = -1 + If regex3.IsMatch(itemToAdd, prefixTextIndex) Then + newLineIndexBeforePrefix = regex3.Match(itemToAdd, prefixTextIndex).Index + End If + If (newLineIndexBeforePrefix > -1) Then + If itemToAdd.StartsWith("...") Then + itemToAdd = ("..." + itemToAdd.Substring((newLineIndexBeforePrefix + regex3.Match(itemToAdd, prefixTextIndex).Length))) + Else + itemToAdd = itemToAdd.Substring((newLineIndexBeforePrefix + regex3.Match(itemToAdd, prefixTextIndex).Length)) + End If + End If + + If Not itemToAdd is nothing AndAlso Not resultList.Contains(itemToAdd) Then + + resultList.Add(itemToAdd) + + isAdded = true + End If + End If + Return isAdded + End Function + + + Protected Overridable Sub GetPageSize() + + If Me.PersonRelativePagination.PageSize.Text.Trim <> "" Then + Try + 'Me.PageSize = Integer.Parse(Me.PersonRelativePagination.PageSize.Text) + Catch ex As Exception + End Try + End If + End Sub + + Protected Overridable Sub AddNewRecords() + + Dim newRecordList As ArrayList = New ArrayList() + + Dim newUIDataList As System.Collections.Generic.List(Of Hashtable) = New System.Collections.Generic.List(Of Hashtable)() + + ' Loop though all the record controls and if the record control + ' does not have a unique record id set, then create a record + ' and add to the list. + If Not Me.ResetData Then + Dim rep As System.Web.UI.WebControls.Repeater = CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonRelativeTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return + + Dim repItem As System.Web.UI.WebControls.RepeaterItem + For Each repItem In rep.Items + ' Loop through all rows in the table, set its DataSource and call DataBind(). + + Dim recControl As PersonRelativeTableControlRow = DirectCast(repItem.FindControl("PersonRelativeTableControlRow"), PersonRelativeTableControlRow) + + If recControl.Visible AndAlso recControl.IsNewRecord() Then + + Dim rec As PersonRelativeRecord = New PersonRelativeRecord() + + If recControl.FLastName.Text <> "" Then + rec.Parse(recControl.FLastName.Text, PersonRelativeTable.FLastName) + End If + If recControl.FName.Text <> "" Then + rec.Parse(recControl.FName.Text, PersonRelativeTable.FName) + End If + If recControl.MLastName.Text <> "" Then + rec.Parse(recControl.MLastName.Text, PersonRelativeTable.MLastName) + End If + If recControl.MName.Text <> "" Then + rec.Parse(recControl.MName.Text, PersonRelativeTable.MName) + End If + If recControl.MOrLastName.Text <> "" Then + rec.Parse(recControl.MOrLastName.Text, PersonRelativeTable.MOrLastName) + End If + If recControl.RAddress.Text <> "" Then + rec.Parse(recControl.RAddress.Text, PersonRelativeTable.RAddress) + End If + If recControl.RAmphur.Text <> "" Then + rec.Parse(recControl.RAmphur.Text, PersonRelativeTable.RAmphur) + End If + If recControl.RBirthDate.Text <> "" Then + rec.Parse(recControl.RBirthDate.Text, PersonRelativeTable.RBirthDate) + End If + If recControl.Ref4.Text <> "" Then + rec.Parse(recControl.Ref4.Text, PersonRelativeTable.Ref0) + End If + If recControl.RefDate2.Text <> "" Then + rec.Parse(recControl.RefDate2.Text, PersonRelativeTable.RefDate) + End If + If MiscUtils.IsValueSelected(recControl.RelationId) Then + rec.Parse(recControl.RelationId.SelectedItem.Value, PersonRelativeTable.RelationId) + End If + If recControl.RFirstName.Text <> "" Then + rec.Parse(recControl.RFirstName.Text, PersonRelativeTable.RFirstName) + End If + If recControl.RLastName.Text <> "" Then + rec.Parse(recControl.RLastName.Text, PersonRelativeTable.RLastName) + End If + If recControl.RNationality.Text <> "" Then + rec.Parse(recControl.RNationality.Text, PersonRelativeTable.RNationality) + End If + If recControl.ROrigin.Text <> "" Then + rec.Parse(recControl.ROrigin.Text, PersonRelativeTable.ROrigin) + End If + If recControl.ROrLastName.Text <> "" Then + rec.Parse(recControl.ROrLastName.Text, PersonRelativeTable.ROrLastName) + End If + If recControl.RPreName.Text <> "" Then + rec.Parse(recControl.RPreName.Text, PersonRelativeTable.RPreName) + End If + If recControl.RProvince.Text <> "" Then + rec.Parse(recControl.RProvince.Text, PersonRelativeTable.RProvince) + End If + If recControl.RReligion.Text <> "" Then + rec.Parse(recControl.RReligion.Text, PersonRelativeTable.RReligion) + End If + If recControl.RRemark.Text <> "" Then + rec.Parse(recControl.RRemark.Text, PersonRelativeTable.RRemark) + End If + If MiscUtils.IsValueSelected(recControl.RStatus) Then + rec.Parse(recControl.RStatus.SelectedItem.Value, PersonRelativeTable.RStatus) + End If + If recControl.RStatusDate.Text <> "" Then + rec.Parse(recControl.RStatusDate.Text, PersonRelativeTable.RStatusDate) + End If + If recControl.RStatusRef.Text <> "" Then + rec.Parse(recControl.RStatusRef.Text, PersonRelativeTable.RStatusRef) + End If + newUIDataList.Add(recControl.PreservedUIData()) + newRecordList.Add(rec) + End If + Next + End If + + + ' Add any new record to the list. + Dim index As Integer = 0 + For index = 1 To Me.AddNewRecord + + newRecordList.Insert(0, New PersonRelativeRecord()) + newUIDataList.Insert(0, New Hashtable()) + + Next + Me.AddNewRecord = 0 + + ' Finally, add any new records to the DataSource. + If newRecordList.Count > 0 Then + + Dim finalList As ArrayList = New ArrayList(Me.DataSource) + finalList.InsertRange(0, newRecordList) + + Me.DataSource = DirectCast(finalList.ToArray(GetType(PersonRelativeRecord)), PersonRelativeRecord()) + + End If + + ' Add the existing UI data to this hash table + If newUIDataList.Count > 0 Then + Me.UIData.InsertRange(0, newUIDataList) + End If + + End Sub + + + Public Sub AddToDeletedRecordIds(ByVal rec As PersonRelativeTableControlRow) + If rec.IsNewRecord() Then + Return + End If + + If Not Me.DeletedRecordIds Is Nothing AndAlso Me.DeletedRecordIds.Trim <> "" Then + Me.DeletedRecordIds &= "," + End If + + Me.DeletedRecordIds &= "[" & rec.RecordUniqueId & "]" + End Sub + + Protected Overridable Function InDeletedRecordIds(ByVal rec As PersonRelativeTableControlRow) As Boolean + If Me.DeletedRecordIds Is Nothing OrElse Me.DeletedRecordIds.Trim = "" Then + Return False + End If + + Return Me.DeletedRecordIds.IndexOf("[" & rec.RecordUniqueId & "]") >= 0 + End Function + + Private _DeletedRecordIds As String + Public Property DeletedRecordIds() As String + Get + Return Me._DeletedRecordIds + End Get + Set(ByVal value As String) + Me._DeletedRecordIds = value + End Set + End Property + + + ' Create Set, WhereClause, and Populate Methods + + Public Overridable Sub 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 SetPersonRelativeTableControlCollapsibleRegion() + + End Sub + + Public Overridable Sub SetRAddressLabel() + + End Sub + + Public Overridable Sub SetRAmphurLabel() + + End Sub + + Public Overridable Sub SetRBirthDateLabel() + + End Sub + + Public Overridable Sub SetRefDateLabel2() + + End Sub + + Public Overridable Sub SetRefLabel3() + + End Sub + + Public Overridable Sub SetRelationIdLabel1() + + 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 + + + + + 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. + Dim added As Boolean = Me.AddNewRecord > 0 + Me.LoadData() + Me.DataBind() + + If added Then + Me.SetFocusToAddedRow() + End If + + End If + + + + Catch ex As Exception + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + Finally + DbUtils.EndTransaction + End Try + End Sub + + 'this function sets focus to the first editable element in the new added row in the editable table + Protected Overridable Sub SetFocusToAddedRow() + Dim rep As System.Web.UI.WebControls.Repeater = CType(Me.FindControl("PersonRelativeTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing OrElse rep.Items.Count = 0 Then Return + Dim repItem As System.Web.UI.WebControls.RepeaterItem + For Each repItem In rep.Items + 'Load scripts to table rows + Me.Page.LoadFocusScripts(repItem) + Dim recControl As PersonRelativeTableControlRow = DirectCast(repItem.FindControl("PersonRelativeTableControlRow"), PersonRelativeTableControlRow) + If recControl.IsNewRecord Then + For Each field As Control In recControl.Controls + If field.Visible AndAlso Me.Page.IsControlEditable(field, False) Then + 'set focus on the first editable field in the new row + field.Focus() + Dim updPan As UpdatePanel = DirectCast(Me.Page.FindControlRecursively("UpdatePanel1"), UpdatePanel) + If Not updPan Is Nothing Then updPan.Update() + Return + End If + Next + Return + End If + Next + End Sub + + + Protected Overrides Sub SaveControlsToSession() + MyBase.SaveControlsToSession() + + ' Save filter controls to values to session. + + + 'Save pagination state to session. + + + + ' Save table control properties to the session. + If Not Me.CurrentSortOrder Is Nothing Then + Me.SaveToSession(Me, "Order_By", Me.CurrentSortOrder.ToXmlString()) + End If + + Me.SaveToSession(Me, "Page_Index", Me.PageIndex.ToString()) + Me.SaveToSession(Me, "Page_Size", Me.PageSize.ToString()) + + Me.SaveToSession(Me, "DeletedRecordIds", Me.DeletedRecordIds) + + End Sub + + Protected Sub SaveControlsToSession_Ajax() + ' Save filter controls to values to session. + + HttpContext.Current.Session("AppRelativeVirtualPath") = Me.Page.AppRelativeVirtualPath + + End Sub + + Protected Overrides Sub ClearControlsFromSession() + MyBase.ClearControlsFromSession() + + ' Clear filter controls values from the session. + + + ' Clear pagination state from session. + + + + ' Clear table properties from the session. + Me.RemoveFromSession(Me, "Order_By") + Me.RemoveFromSession(Me, "Page_Index") + Me.RemoveFromSession(Me, "Page_Size") + + Me.RemoveFromSession(Me, "DeletedRecordIds") + + End Sub + + Protected Overrides Sub LoadViewState(ByVal savedState As Object) + MyBase.LoadViewState(savedState) + + Dim orderByStr As String = CType(ViewState("PersonRelativeTableControl_OrderBy"), String) + + If orderByStr IsNot Nothing AndAlso orderByStr.Trim <> "" Then + Me.CurrentSortOrder = BaseClasses.Data.OrderBy.FromXmlString(orderByStr) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + End If + + Dim pageIndex As String = CType(ViewState("Page_Index"), String) + If pageIndex IsNot Nothing Then + Me.PageIndex = CInt(pageIndex) + End If + + Dim pageSize As String = CType(ViewState("Page_Size"), String) + If Not pageSize Is Nothing Then + Me.PageSize = CInt(pageSize) + End If + + + + ' Load view state for pagination control. + + Me.DeletedRecordIds = CType(Me.ViewState("DeletedRecordIds"), String) + + End Sub + + Protected Overrides Function SaveViewState() As Object + + If Me.CurrentSortOrder IsNot Nothing Then + Me.ViewState("PersonRelativeTableControl_OrderBy") = Me.CurrentSortOrder.ToXmlString() + End If + + Me.ViewState("Page_Index") = Me.PageIndex + Me.ViewState("Page_Size") = Me.PageSize + + Me.ViewState("DeletedRecordIds") = Me.DeletedRecordIds + + + ' Load view state for pagination control. + + + Return MyBase.SaveViewState() + End Function + + ' Generate the event handling functions for pagination events. + + ' event handler for ImageButton + Public Overridable Sub PersonRelativePagination_FirstPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.PageIndex = 0 + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonRelativePagination_LastPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.DisplayLastPage = True + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonRelativePagination_NextPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.PageIndex += 1 + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for LinkButton + Public Overridable Sub PersonRelativePagination_PageSizeButton_Click(ByVal sender As Object, ByVal args As EventArgs) + + Try + + Me.DataChanged = True + + Me.PageSize = Integer.Parse(Me.PersonRelativePagination.PageSize.Text) + + Me.PageIndex = Integer.Parse(Me.PersonRelativePagination.CurrentPage.Text) - 1 + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonRelativePagination_PreviousPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + If Me.PageIndex > 0 Then + Me.PageIndex -= 1 + Me.DataChanged = True + End If + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + + ' Generate the event handling functions for sorting events. + + + ' Generate the event handling functions for button events. + + ' event handler for ImageButton + Public Overridable Sub PersonRelativeAddButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + Me.AddNewRecord = 1 + Me.DataChanged = True + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonRelativeRefreshButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Dim PersonalDDTableControlObj as PersonalDDTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalDDTableControl"), PersonalDDTableControl) + PersonalDDTableControlObj.ResetData = True + + PersonalDDTableControlObj.RemoveFromSession(PersonalDDTableControlObj, "DeletedRecordIds") + PersonalDDTableControlObj.DeletedRecordIds = Nothing + + Dim PersonalEducationTableControlObj as PersonalEducationTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalEducationTableControl"), PersonalEducationTableControl) + PersonalEducationTableControlObj.ResetData = True + + PersonalEducationTableControlObj.RemoveFromSession(PersonalEducationTableControlObj, "DeletedRecordIds") + PersonalEducationTableControlObj.DeletedRecordIds = Nothing + + Dim PersonalExtWorkTableControlObj as PersonalExtWorkTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalExtWorkTableControl"), PersonalExtWorkTableControl) + PersonalExtWorkTableControlObj.ResetData = True + + PersonalExtWorkTableControlObj.RemoveFromSession(PersonalExtWorkTableControlObj, "DeletedRecordIds") + PersonalExtWorkTableControlObj.DeletedRecordIds = Nothing + + Dim PersonalIdRecordControlObj as PersonalIdRecordControl = DirectCast(Me.Page.FindControlRecursively("PersonalIdRecordControl"), PersonalIdRecordControl) + PersonalIdRecordControlObj.ResetData = True + + + Dim PersonalInsigniaTableControlObj as PersonalInsigniaTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalInsigniaTableControl"), PersonalInsigniaTableControl) + PersonalInsigniaTableControlObj.ResetData = True + + PersonalInsigniaTableControlObj.RemoveFromSession(PersonalInsigniaTableControlObj, "DeletedRecordIds") + PersonalInsigniaTableControlObj.DeletedRecordIds = Nothing + + Dim PersonalLanguageSkillTableControlObj as PersonalLanguageSkillTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalLanguageSkillTableControl"), PersonalLanguageSkillTableControl) + PersonalLanguageSkillTableControlObj.ResetData = True + + PersonalLanguageSkillTableControlObj.RemoveFromSession(PersonalLanguageSkillTableControlObj, "DeletedRecordIds") + PersonalLanguageSkillTableControlObj.DeletedRecordIds = Nothing + + Dim PersonalNameTableControlObj as PersonalNameTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalNameTableControl"), PersonalNameTableControl) + PersonalNameTableControlObj.ResetData = True + + PersonalNameTableControlObj.RemoveFromSession(PersonalNameTableControlObj, "DeletedRecordIds") + PersonalNameTableControlObj.DeletedRecordIds = Nothing + + Dim PersonalRankTableControlObj as PersonalRankTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalRankTableControl"), PersonalRankTableControl) + PersonalRankTableControlObj.ResetData = True + + PersonalRankTableControlObj.RemoveFromSession(PersonalRankTableControlObj, "DeletedRecordIds") + PersonalRankTableControlObj.DeletedRecordIds = Nothing + + Dim PersonalSalaryTableControlObj as PersonalSalaryTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalSalaryTableControl"), PersonalSalaryTableControl) + PersonalSalaryTableControlObj.ResetData = True + + PersonalSalaryTableControlObj.RemoveFromSession(PersonalSalaryTableControlObj, "DeletedRecordIds") + PersonalSalaryTableControlObj.DeletedRecordIds = Nothing + + Dim PersonalSpecialSkillTableControlObj as PersonalSpecialSkillTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalSpecialSkillTableControl"), PersonalSpecialSkillTableControl) + PersonalSpecialSkillTableControlObj.ResetData = True + + PersonalSpecialSkillTableControlObj.RemoveFromSession(PersonalSpecialSkillTableControlObj, "DeletedRecordIds") + PersonalSpecialSkillTableControlObj.DeletedRecordIds = Nothing + + Dim PersonalSportSkillTableControl1Obj as PersonalSportSkillTableControl1 = DirectCast(Me.Page.FindControlRecursively("PersonalSportSkillTableControl1"), PersonalSportSkillTableControl1) + PersonalSportSkillTableControl1Obj.ResetData = True + + PersonalSportSkillTableControl1Obj.RemoveFromSession(PersonalSportSkillTableControl1Obj, "DeletedRecordIds") + PersonalSportSkillTableControl1Obj.DeletedRecordIds = Nothing + + Dim PersonalTitleTableControlObj as PersonalTitleTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalTitleTableControl"), PersonalTitleTableControl) + PersonalTitleTableControlObj.ResetData = True + + PersonalTitleTableControlObj.RemoveFromSession(PersonalTitleTableControlObj, "DeletedRecordIds") + PersonalTitleTableControlObj.DeletedRecordIds = Nothing + + Dim PersonRelativeTableControlObj as PersonRelativeTableControl = DirectCast(Me.Page.FindControlRecursively("PersonRelativeTableControl"), PersonRelativeTableControl) + PersonRelativeTableControlObj.ResetData = True + + PersonRelativeTableControlObj.RemoveFromSession(PersonRelativeTableControlObj, "DeletedRecordIds") + PersonRelativeTableControlObj.DeletedRecordIds = Nothing + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonRelativeResetButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.CurrentSortOrder.Reset() + If Me.InSession(Me, "Order_By") Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + Me.CurrentSortOrder.Add(PersonRelativeTable.RelationId, OrderByItem.OrderDir.Asc) + + Me.CurrentSortOrder.Add(PersonRelativeTable.RBirthDate, OrderByItem.OrderDir.Asc) + + + End If + + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonRelativeSaveButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + + If (Not Me.Page.IsPageRefresh) Then + Me.SaveData() + End If + + Me.Page.CommitTransaction(sender) + ' Set IsNewRecord to False for all records - since everything has been saved and is no longer "new" + Dim recCtl As PersonRelativeTableControlRow + For Each recCtl in Me.GetRecordControls() + + recCtl.IsNewRecord = False + Next + + + ' Set DeletedRecordsIds to Nothing since we have deleted all pending deletes. + + Me.DeletedRecordIds = Nothing + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + + + ' Generate the event handling functions for filter and search events. + + + ' Generate the event handling functions for others + + + Private _UIData As New System.Collections.Generic.List(Of Hashtable) + Public Property UIData() As System.Collections.Generic.List(Of Hashtable) + Get + Return Me._UIData + End Get + Set(ByVal value As System.Collections.Generic.List(Of Hashtable)) + Me._UIData = value + End Set + End Property + + ' pagination properties + Protected _PageSize As Integer + Public Property PageSize() As Integer + Get + Return Me._PageSize + End Get + Set(ByVal value As Integer) + Me._PageSize = value + End Set + End Property + + Protected _PageIndex As Integer + Public Property PageIndex() As Integer + Get + ' Return the PageIndex + Return Me._PageIndex + End Get + Set(ByVal value As Integer) + Me._PageIndex = value + End Set + End Property + + Protected _TotalRecords As Integer = -1 + Public Property TotalRecords() As Integer + Get + If _TotalRecords < 0 + _TotalRecords = PersonRelativeTable.GetRecordCount(CreateCompoundJoinFilter(), CreateWhereClause()) + End If + Return Me._TotalRecords + End Get + Set(ByVal value As Integer) + If Me.PageSize > 0 Then + + Me.TotalPages = CInt(Math.Ceiling(value / Me.PageSize)) + + End If + Me._TotalRecords = value + End Set + End Property + + + + Protected _TotalPages As Integer = -1 + Public Property TotalPages() As Integer + Get + If _TotalPages < 0 Then + + Me.TotalPages = CInt(Math.Ceiling(TotalRecords / Me.PageSize)) + + End If + Return Me._TotalPages + End Get + Set(ByVal value As Integer) + Me._TotalPages = value + End Set + End Property + + Protected _DisplayLastPage As Boolean + Public Property DisplayLastPage() As Boolean + Get + Return Me._DisplayLastPage + End Get + Set(ByVal value As Boolean) + Me._DisplayLastPage = value + End Set + End Property + + Private _DataChanged As Boolean = False + Public Property DataChanged() As Boolean + Get + Return Me._DataChanged + End Get + Set(ByVal value As Boolean) + Me._DataChanged = value + End Set + End Property + + Private _ResetData As Boolean = False + Public Property ResetData() As Boolean + Get + Return Me._ResetData + End Get + Set(ByVal value As Boolean) + Me._ResetData = value + End Set + End Property + + Private _AddNewRecord As Integer = 0 + Public Property AddNewRecord() As Integer + Get + Return Me._AddNewRecord + End Get + Set(ByVal value As Integer) + Me._AddNewRecord = value + End Set + End Property + + + Private _CurrentSortOrder As OrderBy = Nothing + Public Property CurrentSortOrder() As OrderBy + Get + Return Me._CurrentSortOrder + End Get + Set(ByVal value As BaseClasses.Data.OrderBy) + Me._CurrentSortOrder = value + End Set + End Property + + Private _DataSource() As PersonRelativeRecord = Nothing + Public Property DataSource() As PersonRelativeRecord () + Get + Return Me._DataSource + End Get + Set(ByVal value() As PersonRelativeRecord) + Me._DataSource = value + End Set + End Property + +#Region "Helper Properties" + + 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 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 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 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 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 PersonRelativeAddButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonRelativeAddButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonRelativePagination() As Persons.UI.IPagination + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonRelativePagination"), Persons.UI.IPagination) + End Get + End Property + + Public ReadOnly Property PersonRelativeRefreshButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonRelativeRefreshButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonRelativeResetButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonRelativeResetButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonRelativeSaveButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonRelativeSaveButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonRelativeTableControlCollapsibleRegion() As System.Web.UI.WebControls.Panel + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonRelativeTableControlCollapsibleRegion"), System.Web.UI.WebControls.Panel) + 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 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 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 RefDateLabel2() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RefDateLabel2"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property RefLabel3() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RefLabel3"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property RelationIdLabel1() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RelationIdLabel1"), System.Web.UI.WebControls.Literal) + 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 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 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 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 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 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 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 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 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 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 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(url As String, arg As String, ByVal bEncrypt As Boolean) As String + Return Me.Page.EvaluateExpressions(url, arg, bEncrypt, Me) + End Function + + Public Overrides Overloads Function EvaluateExpressions(url As String, arg As String, ByVal bEncrypt As Boolean) As String + Dim needToProcess As Boolean = AreAnyUrlParametersForMe(url, arg) + If (needToProcess) Then + Dim recCtl As PersonRelativeTableControlRow = Me.GetSelectedRecordControl() + If recCtl Is Nothing AndAlso url.IndexOf("{") >= 0 Then + ' Localization. + Throw New Exception(Page.GetResourceValue("Err:NoRecSelected", "Persons")) + End If + Dim rec As PersonRelativeRecord = Nothing + If recCtl IsNot Nothing Then + rec = recCtl.GetRecord() + End If + Return EvaluateExpressions(url, arg, rec, bEncrypt) + End If + Return url + End Function + + Public Overridable Function GetSelectedRecordControl() As PersonRelativeTableControlRow + Return Nothing + + End Function + + Public Overridable Function GetSelectedRecordControls() As PersonRelativeTableControlRow() + + Return DirectCast((new ArrayList()).ToArray(GetType(PersonRelativeTableControlRow)), PersonRelativeTableControlRow()) + + End Function + + Public Overridable Sub DeleteSelectedRecords(ByVal deferDeletion As Boolean) + Dim recList() As PersonRelativeTableControlRow = Me.GetSelectedRecordControls() + If recList.Length = 0 Then + ' Localization. + Throw New Exception(Page.GetResourceValue("Err:NoRecSelected", "Persons")) + End If + + Dim recCtl As PersonRelativeTableControlRow + For Each recCtl In recList + If deferDeletion Then + If Not recCtl.IsNewRecord Then + + Me.AddToDeletedRecordIds(recCtl) + + End If + recCtl.Visible = False + + Else + + recCtl.Delete() + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + End If + Next + End Sub + + Public Function GetRecordControls() As PersonRelativeTableControlRow() + Dim recList As ArrayList = New ArrayList() + Dim rep As System.Web.UI.WebControls.Repeater = CType(Me.FindControl("PersonRelativeTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return Nothing + Dim repItem As System.Web.UI.WebControls.RepeaterItem + + For Each repItem In rep.Items + + Dim recControl As PersonRelativeTableControlRow = DirectCast(repItem.FindControl("PersonRelativeTableControlRow"), PersonRelativeTableControlRow) + recList.Add(recControl) + + Next + + Return DirectCast(recList.ToArray(GetType(PersonRelativeTableControlRow)), PersonRelativeTableControlRow()) + End Function + + Public Shadows ReadOnly Property Page() As BaseApplicationPage + Get + Return DirectCast(MyBase.Page, BaseApplicationPage) + End Get + End Property + +#End Region + + + +End Class + + +' Base class for the PersonalIdRecordControl control on the EditPersonalId page. +' Do not modify this class. Instead override any method in PersonalIdRecordControl. +Public Class BasePersonalIdRecordControl + Inherits Persons.UI.BaseApplicationRecordControl + + ' To customize, override this method in PersonalIdRecordControl. + Protected Overridable Sub Control_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Init + + ' Setup the filter and search events. + + Me.ClearControlsFromSession() + End Sub + + ' To customize, override this method in PersonalIdRecordControl. + Protected Overridable Sub Control_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load + + ' Setup the pagination events. + + + ' Register the event handlers. + + AddHandler Me.ArmId.SelectedIndexChanged, AddressOf ArmId_SelectedIndexChanged + + AddHandler Me.ArmyId.SelectedIndexChanged, AddressOf ArmyId_SelectedIndexChanged + + AddHandler Me.BloodId.SelectedIndexChanged, AddressOf BloodId_SelectedIndexChanged + + AddHandler Me.Born.SelectedIndexChanged, AddressOf Born_SelectedIndexChanged + + AddHandler Me.DeptId.SelectedIndexChanged, AddressOf DeptId_SelectedIndexChanged + + AddHandler Me.RankId.SelectedIndexChanged, AddressOf RankId_SelectedIndexChanged + + AddHandler Me.SectionId.SelectedIndexChanged, AddressOf SectionId_SelectedIndexChanged + + AddHandler Me.Sex.SelectedIndexChanged, AddressOf Sex_SelectedIndexChanged + + AddHandler Me.StatusId.SelectedIndexChanged, AddressOf StatusId_SelectedIndexChanged + + AddHandler Me.Addr.TextChanged, AddressOf Addr_TextChanged + + AddHandler Me.Amphur.TextChanged, AddressOf Amphur_TextChanged + + AddHandler Me.ArmyWelfareMemId.TextChanged, AddressOf ArmyWelfareMemId_TextChanged + + AddHandler Me.BAmphur.TextChanged, AddressOf BAmphur_TextChanged + + AddHandler Me.BirthDate.TextChanged, AddressOf BirthDate_TextChanged + + AddHandler Me.BProvince.TextChanged, AddressOf BProvince_TextChanged + + AddHandler Me.CremateMemId.TextChanged, AddressOf CremateMemId_TextChanged + + AddHandler Me.MId.TextChanged, AddressOf MId_TextChanged + + AddHandler Me.MobilePhone.TextChanged, AddressOf MobilePhone_TextChanged + + AddHandler Me.Nationality.TextChanged, AddressOf Nationality_TextChanged + + AddHandler Me.OfficerDate.TextChanged, AddressOf OfficerDate_TextChanged + + AddHandler Me.Origin.TextChanged, AddressOf Origin_TextChanged + + AddHandler Me.PersonalId.TextChanged, AddressOf PersonalId_TextChanged + + AddHandler Me.PersonalLastName.TextChanged, AddressOf PersonalLastName_TextChanged + + AddHandler Me.PersonalName.TextChanged, AddressOf PersonalName_TextChanged + + AddHandler Me.Phone.TextChanged, AddressOf Phone_TextChanged + + AddHandler Me.PhoneExt.TextChanged, AddressOf PhoneExt_TextChanged + + AddHandler Me.PlaceOfBirth.TextChanged, AddressOf PlaceOfBirth_TextChanged + + AddHandler Me.PostCode.TextChanged, AddressOf PostCode_TextChanged + + AddHandler Me.Province.TextChanged, AddressOf Province_TextChanged + + AddHandler Me.RegDate.TextChanged, AddressOf RegDate_TextChanged + + AddHandler Me.RegNo1.TextChanged, AddressOf RegNo1_TextChanged + + AddHandler Me.RegNo2.TextChanged, AddressOf RegNo2_TextChanged + + AddHandler Me.Religion.TextChanged, AddressOf Religion_TextChanged + + AddHandler Me.TId.TextChanged, AddressOf TId_TextChanged + + + End Sub + + + Public Overridable Sub LoadData() + + ' Load the data from the database into the DataSource PersonalId record. + ' It is better to make changes to functions called by LoadData such as + ' CreateWhereClause, rather than making changes here. + + ' 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 = PersonalIdTable.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, "PersonalIdRecordControlPanel"), System.Web.UI.WebControls.Panel) + If Not Panel is Nothing Then + Panel.visible = True + End If + + ' If there is no Where clause, then simply create a new, blank record. + + If wc Is Nothing OrElse Not wc.RunQuery Then + Me.DataSource = New PersonalIdRecord() + + If Not Panel is Nothing Then + Panel.visible = False + End If + + Return + End If + + ' Retrieve the record from the database. It is possible + + Dim recList() As PersonalIdRecord = PersonalIdTable.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 = PersonalIdTable.GetRecord(recList(0).GetID.ToXmlString(), True) + + + + End Sub + + ' Populate the UI controls using the DataSource. To customize, override this method in PersonalIdRecordControl. + Public Overrides Sub DataBind() + ' The DataBind method binds the user interface controls to the values + ' from the database record. To do this, it calls the Set methods for + ' each of the field displayed on the webpage. It is better to make + ' changes in the Set methods, rather than making changes here. + + MyBase.DataBind() + + ' Make sure that the DataSource is initialized. + If Me.DataSource Is Nothing Then + + Return + End If + + + 'LoadData for DataSource for chart and report if they exist + + + + ' Call the Set methods for each controls on the panel + + SetAddr() + SetAddrLabel() + SetAmphur() + SetAmphurLabel() + SetArmId() + SetArmIdLabel() + SetArmyId() + SetArmyIdLabel() + SetArmyWelfareMemId() + SetArmyWelfareMemIdLabel() + SetBAmphur() + SetBAmphurLabel() + SetBirthDate() + SetBirthDateLabel() + SetBloodId() + SetBloodIdLabel() + SetBorn() + SetBornLabel() + SetBProvince() + SetBProvinceLabel() + SetCremateMemId() + SetCremateMemIdLabel() + SetDeptId() + SetDeptIdLabel() + SetMId() + SetMIdLabel() + SetMobilePhone() + SetMobilePhoneLabel() + SetNationality() + SetNationalityLabel() + SetOfficerDate() + SetOfficerDateLabel() + SetOrigin() + SetOriginLabel() + SetPersonalId() + SetPersonalIdLabel() + SetPersonalIdRecordControlCollapsibleRegion() + SetPersonalIdRecordControlIcon() + SetPersonalIdRecordControlPanelExtender() + + SetPersonalLastName() + SetPersonalLastNameLabel() + SetPersonalName() + SetPersonalNameLabel() + SetPhone() + SetPhoneExt() + SetPhoneExtLabel() + SetPhoneLabel() + + SetpictureImage() + SetpictureLabel() + SetPlaceOfBirth() + SetPlaceOfBirthLabel() + SetPostCode() + SetPostCodeLabel() + SetProvince() + SetProvinceLabel() + SetRankId() + SetRankIdLabel() + SetRegDate() + SetRegDateLabel() + SetRegNo1() + SetRegNo1Label() + SetRegNo2() + SetRegNo2Label() + SetReligion() + SetReligionLabel() + SetSectionId() + SetSectionIdLabel() + SetSex() + SetSexLabel() + SetStatusId() + SetStatusIdLabel() + SetTId() + SetTIdLabel() + + + 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 + + Dim recPersonalDDTableControl as PersonalDDTableControl = DirectCast(MiscUtils.FindControlRecursively(Me.Page, "PersonalDDTableControl"), PersonalDDTableControl) + + If (shouldResetControl OrElse Me.Page.IsPageRefresh) + recPersonalDDTableControl.ResetControl() + End IF + + recPersonalDDTableControl.LoadData() + recPersonalDDTableControl.DataBind() + + Dim recPersonalEducationTableControl as PersonalEducationTableControl = DirectCast(MiscUtils.FindControlRecursively(Me.Page, "PersonalEducationTableControl"), PersonalEducationTableControl) + + If (shouldResetControl OrElse Me.Page.IsPageRefresh) + recPersonalEducationTableControl.ResetControl() + End IF + + recPersonalEducationTableControl.LoadData() + recPersonalEducationTableControl.DataBind() + + Dim recPersonalExtWorkTableControl as PersonalExtWorkTableControl = DirectCast(MiscUtils.FindControlRecursively(Me.Page, "PersonalExtWorkTableControl"), PersonalExtWorkTableControl) + + If (shouldResetControl OrElse Me.Page.IsPageRefresh) + recPersonalExtWorkTableControl.ResetControl() + End IF + + recPersonalExtWorkTableControl.LoadData() + recPersonalExtWorkTableControl.DataBind() + + Dim recPersonalInsigniaTableControl as PersonalInsigniaTableControl = DirectCast(MiscUtils.FindControlRecursively(Me.Page, "PersonalInsigniaTableControl"), PersonalInsigniaTableControl) + + If (shouldResetControl OrElse Me.Page.IsPageRefresh) + recPersonalInsigniaTableControl.ResetControl() + End IF + + recPersonalInsigniaTableControl.LoadData() + recPersonalInsigniaTableControl.DataBind() + + Dim recPersonalLanguageSkillTableControl as PersonalLanguageSkillTableControl = DirectCast(MiscUtils.FindControlRecursively(Me.Page, "PersonalLanguageSkillTableControl"), PersonalLanguageSkillTableControl) + + If (shouldResetControl OrElse Me.Page.IsPageRefresh) + recPersonalLanguageSkillTableControl.ResetControl() + End IF + + recPersonalLanguageSkillTableControl.LoadData() + recPersonalLanguageSkillTableControl.DataBind() + + Dim recPersonalNameTableControl as PersonalNameTableControl = DirectCast(MiscUtils.FindControlRecursively(Me.Page, "PersonalNameTableControl"), PersonalNameTableControl) + + If (shouldResetControl OrElse Me.Page.IsPageRefresh) + recPersonalNameTableControl.ResetControl() + End IF + + recPersonalNameTableControl.LoadData() + recPersonalNameTableControl.DataBind() + + Dim recPersonalRankTableControl as PersonalRankTableControl = DirectCast(MiscUtils.FindControlRecursively(Me.Page, "PersonalRankTableControl"), PersonalRankTableControl) + + If (shouldResetControl OrElse Me.Page.IsPageRefresh) + recPersonalRankTableControl.ResetControl() + End IF + + recPersonalRankTableControl.LoadData() + recPersonalRankTableControl.DataBind() + + Dim recPersonalSalaryTableControl as PersonalSalaryTableControl = DirectCast(MiscUtils.FindControlRecursively(Me.Page, "PersonalSalaryTableControl"), PersonalSalaryTableControl) + + If (shouldResetControl OrElse Me.Page.IsPageRefresh) + recPersonalSalaryTableControl.ResetControl() + End IF + + recPersonalSalaryTableControl.LoadData() + recPersonalSalaryTableControl.DataBind() + + Dim recPersonalSpecialSkillTableControl as PersonalSpecialSkillTableControl = DirectCast(MiscUtils.FindControlRecursively(Me.Page, "PersonalSpecialSkillTableControl"), PersonalSpecialSkillTableControl) + + If (shouldResetControl OrElse Me.Page.IsPageRefresh) + recPersonalSpecialSkillTableControl.ResetControl() + End IF + + recPersonalSpecialSkillTableControl.LoadData() + recPersonalSpecialSkillTableControl.DataBind() + + Dim recPersonalSportSkillTableControl1 as PersonalSportSkillTableControl1 = DirectCast(MiscUtils.FindControlRecursively(Me.Page, "PersonalSportSkillTableControl1"), PersonalSportSkillTableControl1) + + If (shouldResetControl OrElse Me.Page.IsPageRefresh) + recPersonalSportSkillTableControl1.ResetControl() + End IF + + recPersonalSportSkillTableControl1.LoadData() + recPersonalSportSkillTableControl1.DataBind() + + Dim recPersonalTitleTableControl as PersonalTitleTableControl = DirectCast(MiscUtils.FindControlRecursively(Me.Page, "PersonalTitleTableControl"), PersonalTitleTableControl) + + If (shouldResetControl OrElse Me.Page.IsPageRefresh) + recPersonalTitleTableControl.ResetControl() + End IF + + recPersonalTitleTableControl.LoadData() + recPersonalTitleTableControl.DataBind() + + Dim recPersonRelativeTableControl as PersonRelativeTableControl = DirectCast(MiscUtils.FindControlRecursively(Me.Page, "PersonRelativeTableControl"), PersonRelativeTableControl) + + If (shouldResetControl OrElse Me.Page.IsPageRefresh) + recPersonRelativeTableControl.ResetControl() + End IF + + recPersonRelativeTableControl.LoadData() + recPersonRelativeTableControl.DataBind() + + End Sub + + + Public Overridable Sub SetAddr() + + + ' Set the Addr TextBox on the webpage with value from the + ' PersonalId database record. + + ' Me.DataSource is the PersonalId record retrieved from the database. + ' Me.Addr is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetAddr() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.AddrSpecified Then + + ' If the Addr is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalIdTable.Addr) + + Me.Addr.Text = formattedValue + + Else + + ' Addr is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.Addr.Text = PersonalIdTable.Addr.Format(PersonalIdTable.Addr.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetAmphur() + + + ' Set the Amphur TextBox on the webpage with value from the + ' PersonalId database record. + + ' Me.DataSource is the PersonalId record retrieved from the database. + ' Me.Amphur is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetAmphur() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.AmphurSpecified Then + + ' If the Amphur is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalIdTable.Amphur) + + Me.Amphur.Text = formattedValue + + Else + + ' Amphur is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.Amphur.Text = PersonalIdTable.Amphur.Format(PersonalIdTable.Amphur.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetArmId() + + + ' Set the ArmId DropDownList on the webpage with value from the + ' PersonalId database record. + + ' Me.DataSource is the PersonalId record retrieved from the database. + ' Me.ArmId is the ASP:DropDownList on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetArmId() + ' and add your own code before or after the call to the MyBase function. + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.ArmIdSpecified Then + + ' If the ArmId is non-NULL, then format the value. + ' The Format method will return the Display Foreign Key As (DFKA) value + Me.PopulateArmIdDropDownList(Me.DataSource.ArmId.ToString(), 100) + + Else + + ' ArmId 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.PopulateArmIdDropDownList(Nothing, 100) + Else + Me.PopulateArmIdDropDownList(PersonalIdTable.ArmId.DefaultValue, 100) + End If + + End If + + End Sub + + Public Overridable Sub SetArmyId() + + + ' Set the ArmyId DropDownList on the webpage with value from the + ' PersonalId database record. + + ' Me.DataSource is the PersonalId record retrieved from the database. + ' Me.ArmyId is the ASP:DropDownList on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetArmyId() + ' and add your own code before or after the call to the MyBase function. + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.ArmyIdSpecified Then + + ' If the ArmyId is non-NULL, then format the value. + ' The Format method will return the Display Foreign Key As (DFKA) value + Me.PopulateArmyIdDropDownList(Me.DataSource.ArmyId.ToString(), 100) + + Else + + ' ArmyId 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.PopulateArmyIdDropDownList(Nothing, 100) + Else + Me.PopulateArmyIdDropDownList(PersonalIdTable.ArmyId.DefaultValue, 100) + End If + + End If + + End Sub + + Public Overridable Sub SetArmyWelfareMemId() + + + ' Set the ArmyWelfareMemId TextBox on the webpage with value from the + ' PersonalId database record. + + ' Me.DataSource is the PersonalId record retrieved from the database. + ' Me.ArmyWelfareMemId is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetArmyWelfareMemId() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.ArmyWelfareMemIdSpecified Then + + ' If the ArmyWelfareMemId is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalIdTable.ArmyWelfareMemId) + + Me.ArmyWelfareMemId.Text = formattedValue + + Else + + ' ArmyWelfareMemId is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.ArmyWelfareMemId.Text = PersonalIdTable.ArmyWelfareMemId.Format(PersonalIdTable.ArmyWelfareMemId.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetBAmphur() + + + ' Set the BAmphur TextBox on the webpage with value from the + ' PersonalId database record. + + ' Me.DataSource is the PersonalId record retrieved from the database. + ' Me.BAmphur is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetBAmphur() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.BAmphurSpecified Then + + ' If the BAmphur is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalIdTable.BAmphur) + + Me.BAmphur.Text = formattedValue + + Else + + ' BAmphur is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.BAmphur.Text = PersonalIdTable.BAmphur.Format(PersonalIdTable.BAmphur.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetBirthDate() + + + ' Set the BirthDate TextBox on the webpage with value from the + ' PersonalId database record. + + ' Me.DataSource is the PersonalId record retrieved from the database. + ' Me.BirthDate is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetBirthDate() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.BirthDateSpecified Then + + ' If the BirthDate is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalIdTable.BirthDate, "d MMM yy") + + Me.BirthDate.Text = formattedValue + + Else + + ' BirthDate is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.BirthDate.Text = PersonalIdTable.BirthDate.Format(PersonalIdTable.BirthDate.DefaultValue, "d MMM yy") + + End If + + End Sub + + Public Overridable Sub SetBloodId() + + + ' Set the BloodId DropDownList on the webpage with value from the + ' PersonalId database record. + + ' Me.DataSource is the PersonalId record retrieved from the database. + ' Me.BloodId is the ASP:DropDownList on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetBloodId() + ' and add your own code before or after the call to the MyBase function. + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.BloodIdSpecified Then + + ' If the BloodId is non-NULL, then format the value. + ' The Format method will return the Display Foreign Key As (DFKA) value + Me.PopulateBloodIdDropDownList(Me.DataSource.BloodId.ToString(), 100) + + Else + + ' BloodId 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.PopulateBloodIdDropDownList(Nothing, 100) + Else + Me.PopulateBloodIdDropDownList(PersonalIdTable.BloodId.DefaultValue, 100) + End If + + End If + + End Sub + + Public Overridable Sub SetBorn() + + + ' Set the Born DropDownList on the webpage with value from the + ' PersonalId database record. + + ' Me.DataSource is the PersonalId record retrieved from the database. + ' Me.Born is the ASP:DropDownList on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetBorn() + ' and add your own code before or after the call to the MyBase function. + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.BornSpecified Then + + ' If the Born is non-NULL, then format the value. + ' The Format method will return the Display Foreign Key As (DFKA) value + Me.PopulateBornDropDownList(Me.DataSource.Born, 100) + + Else + + ' Born 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.PopulateBornDropDownList(Nothing, 100) + Else + Me.PopulateBornDropDownList(PersonalIdTable.Born.DefaultValue, 100) + End If + + End If + + End Sub + + Public Overridable Sub SetBProvince() + + + ' Set the BProvince TextBox on the webpage with value from the + ' PersonalId database record. + + ' Me.DataSource is the PersonalId record retrieved from the database. + ' Me.BProvince is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetBProvince() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.BProvinceSpecified Then + + ' If the BProvince is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalIdTable.BProvince) + + Me.BProvince.Text = formattedValue + + Else + + ' BProvince is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.BProvince.Text = PersonalIdTable.BProvince.Format(PersonalIdTable.BProvince.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetCremateMemId() + + + ' Set the CremateMemId TextBox on the webpage with value from the + ' PersonalId database record. + + ' Me.DataSource is the PersonalId record retrieved from the database. + ' Me.CremateMemId is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetCremateMemId() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.CremateMemIdSpecified Then + + ' If the CremateMemId is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalIdTable.CremateMemId) + + Me.CremateMemId.Text = formattedValue + + Else + + ' CremateMemId is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.CremateMemId.Text = PersonalIdTable.CremateMemId.Format(PersonalIdTable.CremateMemId.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetDeptId() + + + ' Set the DeptId DropDownList on the webpage with value from the + ' PersonalId database record. + + ' Me.DataSource is the PersonalId record retrieved from the database. + ' Me.DeptId is the ASP:DropDownList on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetDeptId() + ' and add your own code before or after the call to the MyBase function. + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.DeptIdSpecified Then + + ' If the DeptId is non-NULL, then format the value. + ' The Format method will return the Display Foreign Key As (DFKA) value + Me.PopulateDeptIdDropDownList(Me.DataSource.DeptId.ToString(), 100) + + Else + + ' DeptId 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.PopulateDeptIdDropDownList(Nothing, 100) + Else + Me.PopulateDeptIdDropDownList(PersonalIdTable.DeptId.DefaultValue, 100) + End If + + End If + + End Sub + + Public Overridable Sub SetMId() + + + ' Set the MId TextBox on the webpage with value from the + ' PersonalId database record. + + ' Me.DataSource is the PersonalId record retrieved from the database. + ' Me.MId is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetMId() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.MIdSpecified Then + + ' If the MId is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalIdTable.MId) + + Me.MId.Text = formattedValue + + Else + + ' MId is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.MId.Text = PersonalIdTable.MId.Format(PersonalIdTable.MId.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetMobilePhone() + + + ' Set the MobilePhone TextBox on the webpage with value from the + ' PersonalId database record. + + ' Me.DataSource is the PersonalId record retrieved from the database. + ' Me.MobilePhone is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetMobilePhone() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.MobilePhoneSpecified Then + + ' If the MobilePhone is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalIdTable.MobilePhone) + + Me.MobilePhone.Text = formattedValue + + Else + + ' MobilePhone is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.MobilePhone.Text = PersonalIdTable.MobilePhone.Format(PersonalIdTable.MobilePhone.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetNationality() + + + ' Set the Nationality TextBox on the webpage with value from the + ' PersonalId database record. + + ' Me.DataSource is the PersonalId record retrieved from the database. + ' Me.Nationality is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetNationality() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.NationalitySpecified Then + + ' If the Nationality is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalIdTable.Nationality) + + Me.Nationality.Text = formattedValue + + Else + + ' Nationality is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.Nationality.Text = PersonalIdTable.Nationality.Format(PersonalIdTable.Nationality.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetOfficerDate() + + + ' Set the OfficerDate TextBox on the webpage with value from the + ' PersonalId database record. + + ' Me.DataSource is the PersonalId record retrieved from the database. + ' Me.OfficerDate is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetOfficerDate() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.OfficerDateSpecified Then + + ' If the OfficerDate is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalIdTable.OfficerDate, "d MMM yy") + + Me.OfficerDate.Text = formattedValue + + Else + + ' OfficerDate is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.OfficerDate.Text = PersonalIdTable.OfficerDate.Format(PersonalIdTable.OfficerDate.DefaultValue, "d MMM yy") + + End If + + End Sub + + Public Overridable Sub SetOrigin() + + + ' Set the Origin TextBox on the webpage with value from the + ' PersonalId database record. + + ' Me.DataSource is the PersonalId record retrieved from the database. + ' Me.Origin is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetOrigin() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.OriginSpecified Then + + ' If the Origin is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalIdTable.Origin) + + Me.Origin.Text = formattedValue + + Else + + ' Origin is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.Origin.Text = PersonalIdTable.Origin.Format(PersonalIdTable.Origin.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetPersonalId() + + + ' Set the PersonalId TextBox on the webpage with value from the + ' PersonalId database record. + + ' Me.DataSource is the PersonalId record retrieved from the database. + ' Me.PersonalId is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetPersonalId() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.PersonalIdSpecified Then + + ' If the PersonalId is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalIdTable.PersonalId) + + Me.PersonalId.Text = formattedValue + + Else + + ' PersonalId is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.PersonalId.Text = PersonalIdTable.PersonalId.Format(PersonalIdTable.PersonalId.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetPersonalLastName() + + + ' Set the PersonalLastName TextBox on the webpage with value from the + ' PersonalId database record. + + ' Me.DataSource is the PersonalId record retrieved from the database. + ' Me.PersonalLastName is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetPersonalLastName() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.PersonalLastNameSpecified Then + + ' If the PersonalLastName is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalIdTable.PersonalLastName) + + Me.PersonalLastName.Text = formattedValue + + Else + + ' PersonalLastName is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.PersonalLastName.Text = PersonalIdTable.PersonalLastName.Format(PersonalIdTable.PersonalLastName.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetPersonalName() + + + ' Set the PersonalName TextBox on the webpage with value from the + ' PersonalId database record. + + ' Me.DataSource is the PersonalId record retrieved from the database. + ' Me.PersonalName is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetPersonalName() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.PersonalNameSpecified Then + + ' If the PersonalName is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalIdTable.PersonalName) + + Me.PersonalName.Text = formattedValue + + Else + + ' PersonalName is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.PersonalName.Text = PersonalIdTable.PersonalName.Format(PersonalIdTable.PersonalName.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetPhone() + + + ' Set the Phone TextBox on the webpage with value from the + ' PersonalId database record. + + ' Me.DataSource is the PersonalId record retrieved from the database. + ' Me.Phone is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetPhone() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.PhoneSpecified Then + + ' If the Phone is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalIdTable.Phone) + + Me.Phone.Text = formattedValue + + Else + + ' Phone is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.Phone.Text = PersonalIdTable.Phone.Format(PersonalIdTable.Phone.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetPhoneExt() + + + ' Set the PhoneExt TextBox on the webpage with value from the + ' PersonalId database record. + + ' Me.DataSource is the PersonalId record retrieved from the database. + ' Me.PhoneExt is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetPhoneExt() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.PhoneExtSpecified Then + + ' If the PhoneExt is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalIdTable.PhoneExt) + + Me.PhoneExt.Text = formattedValue + + Else + + ' PhoneExt is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.PhoneExt.Text = PersonalIdTable.PhoneExt.Format(PersonalIdTable.PhoneExt.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetpictureImage() + ' Set the picture Image on the webpage with value from the + ' PersonalId database record. + + ' Me.DataSource is the PersonalId record retrieved from the database. + ' Me.pictureImage is the ASP:Image on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetpictureImage() + ' and add your own code before or after the call to the MyBase function. + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.pictureSpecified Then + + ' If the picture is non-NULL, then format the value. + ' The Format method will use the Display Format + Me.pictureImage.Attributes.Add("onclick", "gPersist=true;") + Me.pictureImage.Attributes.Add("onmouseout","detailRolloverPopupClose();") + + Dim name As String = HttpUtility.HtmlEncode(PersonalIdTable.picture.Name) + + If Not HttpUtility.HtmlEncode("%ISD_DEFAULT%").Equals("%ISD_DEFAULT%") Then + name = HttpUtility.HtmlEncode(Me.Page.GetResourceValue("%ISD_DEFAULT%")) + End If + + Me.pictureImage.Attributes.Add("onmouseover","SaveMousePosition(event);delayRolloverPopup(""PageMethods.GetImage(\""" & Me.Page.Encrypt("PersonalId") _ + & "\"", \""" & Me.Page.Encrypt(HttpUtility.UrlEncode(Me.DataSource.GetID().ToString())) _ + & "\"", \""" & Me.Page.Encrypt("picture") & "\"", \""" & NetUtils.EncodeStringForHtmlDisplay(name.Substring(0, name.Length)) & "\"", false, 200," _ + & " 300, true, PopupDisplayWindowCallBackWith20);"",500);") + + ' Shrunk image size specified by ImagePercentSize on Properties. + Me.pictureImage.ImageUrl = Me.DataSource.FormatImageUrl(PersonalIdTable.picture, Me.Page.Encrypt("PersonalId"), Me.Page.Encrypt("picture"), Me.Page.Encrypt(Me.DataSource.GetID().ToXmlString()), 20) + + Me.pictureImage.Visible = True + Else + ' picture is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + Me.pictureImage.Visible = False + End If + End Sub + + Public Overridable Sub SetPlaceOfBirth() + + + ' Set the PlaceOfBirth TextBox on the webpage with value from the + ' PersonalId database record. + + ' Me.DataSource is the PersonalId record retrieved from the database. + ' Me.PlaceOfBirth is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetPlaceOfBirth() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.PlaceOfBirthSpecified Then + + ' If the PlaceOfBirth is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalIdTable.PlaceOfBirth) + + Me.PlaceOfBirth.Text = formattedValue + + Else + + ' PlaceOfBirth is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.PlaceOfBirth.Text = PersonalIdTable.PlaceOfBirth.Format(PersonalIdTable.PlaceOfBirth.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetPostCode() + + + ' Set the PostCode TextBox on the webpage with value from the + ' PersonalId database record. + + ' Me.DataSource is the PersonalId record retrieved from the database. + ' Me.PostCode is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetPostCode() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.PostCodeSpecified Then + + ' If the PostCode is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalIdTable.PostCode) + + Me.PostCode.Text = formattedValue + + Else + + ' PostCode is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.PostCode.Text = PersonalIdTable.PostCode.Format(PersonalIdTable.PostCode.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetProvince() + + + ' Set the Province TextBox on the webpage with value from the + ' PersonalId database record. + + ' Me.DataSource is the PersonalId record retrieved from the database. + ' Me.Province is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetProvince() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.ProvinceSpecified Then + + ' If the Province is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalIdTable.Province) + + Me.Province.Text = formattedValue + + Else + + ' Province is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.Province.Text = PersonalIdTable.Province.Format(PersonalIdTable.Province.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetRankId() + + + ' Set the RankId DropDownList on the webpage with value from the + ' PersonalId database record. + + ' Me.DataSource is the PersonalId record retrieved from the database. + ' Me.RankId is the ASP:DropDownList on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetRankId() + ' and add your own code before or after the call to the MyBase function. + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.RankIdSpecified Then + + ' If the RankId is non-NULL, then format the value. + ' The Format method will use the Display Format + Me.PopulateRankIdDropDownList(Me.DataSource.RankId.ToString(), 100) + + Else + + ' RankId 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.PopulateRankIdDropDownList(Nothing, 100) + Else + Me.PopulateRankIdDropDownList(PersonalIdTable.RankId.DefaultValue, 100) + End If + + End If + + End Sub + + Public Overridable Sub SetRegDate() + + + ' Set the RegDate TextBox on the webpage with value from the + ' PersonalId database record. + + ' Me.DataSource is the PersonalId record retrieved from the database. + ' Me.RegDate is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetRegDate() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.RegDateSpecified Then + + ' If the RegDate is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalIdTable.RegDate, "d MMM yy") + + Me.RegDate.Text = formattedValue + + Else + + ' RegDate is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.RegDate.Text = PersonalIdTable.RegDate.Format(PersonalIdTable.RegDate.DefaultValue, "d MMM yy") + + End If + + End Sub + + Public Overridable Sub SetRegNo1() + + + ' Set the RegNo1 TextBox on the webpage with value from the + ' PersonalId database record. + + ' Me.DataSource is the PersonalId record retrieved from the database. + ' Me.RegNo1 is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetRegNo1() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.RegNo1Specified Then + + ' If the RegNo1 is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalIdTable.RegNo1) + + Me.RegNo1.Text = formattedValue + + Else + + ' RegNo1 is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.RegNo1.Text = PersonalIdTable.RegNo1.Format(PersonalIdTable.RegNo1.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetRegNo2() + + + ' Set the RegNo2 TextBox on the webpage with value from the + ' PersonalId database record. + + ' Me.DataSource is the PersonalId record retrieved from the database. + ' Me.RegNo2 is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetRegNo2() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.RegNo2Specified Then + + ' If the RegNo2 is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalIdTable.RegNo2) + + Me.RegNo2.Text = formattedValue + + Else + + ' RegNo2 is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.RegNo2.Text = PersonalIdTable.RegNo2.Format(PersonalIdTable.RegNo2.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetReligion() + + + ' Set the Religion TextBox on the webpage with value from the + ' PersonalId database record. + + ' Me.DataSource is the PersonalId record retrieved from the database. + ' Me.Religion is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetReligion() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.ReligionSpecified Then + + ' If the Religion is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalIdTable.Religion) + + Me.Religion.Text = formattedValue + + Else + + ' Religion is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.Religion.Text = PersonalIdTable.Religion.Format(PersonalIdTable.Religion.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetSectionId() + + + ' Set the SectionId DropDownList on the webpage with value from the + ' PersonalId database record. + + ' Me.DataSource is the PersonalId record retrieved from the database. + ' Me.SectionId is the ASP:DropDownList on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetSectionId() + ' and add your own code before or after the call to the MyBase function. + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.SectionIdSpecified Then + + ' If the SectionId is non-NULL, then format the value. + ' The Format method will return the Display Foreign Key As (DFKA) value + Me.PopulateSectionIdDropDownList(Me.DataSource.SectionId.ToString(), 100) + + Else + + ' SectionId 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.PopulateSectionIdDropDownList(Nothing, 100) + Else + Me.PopulateSectionIdDropDownList(PersonalIdTable.SectionId.DefaultValue, 100) + End If + + End If + + End Sub + + Public Overridable Sub SetSex() + + + ' Set the Sex DropDownList on the webpage with value from the + ' PersonalId database record. + + ' Me.DataSource is the PersonalId record retrieved from the database. + ' Me.Sex is the ASP:DropDownList on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetSex() + ' and add your own code before or after the call to the MyBase function. + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.SexSpecified Then + + ' If the Sex is non-NULL, then format the value. + ' The Format method will return the Display Foreign Key As (DFKA) value + Me.PopulateSexDropDownList(Me.DataSource.Sex.ToString(), 100) + + Else + + ' Sex 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.PopulateSexDropDownList(Nothing, 100) + Else + Me.PopulateSexDropDownList(PersonalIdTable.Sex.DefaultValue, 100) + End If + + End If + + End Sub + + Public Overridable Sub SetStatusId() + + + ' Set the StatusId DropDownList on the webpage with value from the + ' PersonalId database record. + + ' Me.DataSource is the PersonalId record retrieved from the database. + ' Me.StatusId is the ASP:DropDownList on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetStatusId() + ' and add your own code before or after the call to the MyBase function. + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.StatusIdSpecified Then + + ' If the StatusId is non-NULL, then format the value. + ' The Format method will return the Display Foreign Key As (DFKA) value + Me.PopulateStatusIdDropDownList(Me.DataSource.StatusId.ToString(), 100) + + Else + + ' StatusId 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.PopulateStatusIdDropDownList(Nothing, 100) + Else + Me.PopulateStatusIdDropDownList(PersonalIdTable.StatusId.DefaultValue, 100) + End If + + End If + + End Sub + + Public Overridable Sub SetTId() + + + ' Set the TId TextBox on the webpage with value from the + ' PersonalId database record. + + ' Me.DataSource is the PersonalId record retrieved from the database. + ' Me.TId is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetTId() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.TIdSpecified Then + + ' If the TId is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalIdTable.TId) + + Me.TId.Text = formattedValue + + Else + + ' TId is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.TId.Text = PersonalIdTable.TId.Format(PersonalIdTable.TId.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetAddrLabel() + + End Sub + + Public Overridable Sub SetAmphurLabel() + + End Sub + + Public Overridable Sub SetArmIdLabel() + + End Sub + + Public Overridable Sub SetArmyIdLabel() + + End Sub + + Public Overridable Sub SetArmyWelfareMemIdLabel() + + End Sub + + Public Overridable Sub SetBAmphurLabel() + + End Sub + + Public Overridable Sub SetBirthDateLabel() + + End Sub + + Public Overridable Sub SetBloodIdLabel() + + End Sub + + Public Overridable Sub SetBornLabel() + + End Sub + + Public Overridable Sub SetBProvinceLabel() + + End Sub + + Public Overridable Sub SetCremateMemIdLabel() + + End Sub + + Public Overridable Sub SetDeptIdLabel() + + End Sub + + Public Overridable Sub SetMIdLabel() + + End Sub + + Public Overridable Sub SetMobilePhoneLabel() + + End Sub + + Public Overridable Sub SetNationalityLabel() + + End Sub + + Public Overridable Sub SetOfficerDateLabel() + + End Sub + + Public Overridable Sub SetOriginLabel() + + End Sub + + Public Overridable Sub SetPersonalIdLabel() + + End Sub + + Public Overridable Sub SetPersonalIdRecordControlCollapsibleRegion() + + End Sub + + Public Overridable Sub SetPersonalIdRecordControlIcon() + + End Sub + + Public Overridable Sub SetPersonalIdRecordControlPanelExtender() + + End Sub + + Public Overridable Sub SetPersonalLastNameLabel() + + End Sub + + Public Overridable Sub SetPersonalNameLabel() + + End Sub + + Public Overridable Sub SetPhoneExtLabel() + + End Sub + + Public Overridable Sub SetPhoneLabel() + + End Sub + + Public Overridable Sub SetpictureLabel() + + End Sub + + Public Overridable Sub SetPlaceOfBirthLabel() + + End Sub + + Public Overridable Sub SetPostCodeLabel() + + End Sub + + Public Overridable Sub SetProvinceLabel() + + End Sub + + Public Overridable Sub SetRankIdLabel() + + End Sub + + Public Overridable Sub SetRegDateLabel() + + End Sub + + Public Overridable Sub SetRegNo1Label() + + End Sub + + Public Overridable Sub SetRegNo2Label() + + End Sub + + Public Overridable Sub SetReligionLabel() + + End Sub + + Public Overridable Sub SetSectionIdLabel() + + End Sub + + Public Overridable Sub SetSexLabel() + + End Sub + + Public Overridable Sub SetStatusIdLabel() + + End Sub + + Public Overridable Sub SetTIdLabel() + + 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 PersonalIdRecordControl. + Public Overridable Sub SaveData() + ' Saves the associated record in the database. + ' SaveData calls Validate and Get methods - so it may be more appropriate to + ' customize those methods. + + ' 1. Load the existing record from the database. Since we save the entire record, this ensures + ' that fields that are not displayed are also properly initialized. + Me.LoadData() + + Dim Panel As System.Web.UI.WebControls.Panel = CType(MiscUtils.FindControlRecursively(Me, "PersonalIdRecordControlPanel"), System.Web.UI.WebControls.Panel) + + If ((Not IsNothing(Panel)) AndAlso (Not Panel.Visible)) OrElse IsNothing(Me.DataSource) Then + Return + End If + + + ' 2. Perform any custom validation. + Me.Validate() + + + ' 3. Set the values in the record with data from UI controls. + ' This calls the Get() method for each of the user interface controls. + Me.GetUIData() + + ' 4. Save in the database. + ' We should not save the record if the data did not change. This + ' will save a database hit and avoid triggering any database triggers. + + If Me.DataSource.IsAnyValueChanged Then + ' Save record to database but do not commit yet. + ' Auto generated ids are available after saving for use by child (dependent) records. + Me.DataSource.Save() + + End If + + + ' update session or cookie by formula + + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + ' For Master-Detail relationships, save data on the Detail table(s) + + Dim recPersonalDDTableControl as PersonalDDTableControl = DirectCast(MiscUtils.FindControlRecursively(Me.Page, "PersonalDDTableControl"), PersonalDDTableControl) + recPersonalDDTableControl.SaveData() + + Dim recPersonalEducationTableControl as PersonalEducationTableControl = DirectCast(MiscUtils.FindControlRecursively(Me.Page, "PersonalEducationTableControl"), PersonalEducationTableControl) + recPersonalEducationTableControl.SaveData() + + Dim recPersonalExtWorkTableControl as PersonalExtWorkTableControl = DirectCast(MiscUtils.FindControlRecursively(Me.Page, "PersonalExtWorkTableControl"), PersonalExtWorkTableControl) + recPersonalExtWorkTableControl.SaveData() + + Dim recPersonalInsigniaTableControl as PersonalInsigniaTableControl = DirectCast(MiscUtils.FindControlRecursively(Me.Page, "PersonalInsigniaTableControl"), PersonalInsigniaTableControl) + recPersonalInsigniaTableControl.SaveData() + + Dim recPersonalLanguageSkillTableControl as PersonalLanguageSkillTableControl = DirectCast(MiscUtils.FindControlRecursively(Me.Page, "PersonalLanguageSkillTableControl"), PersonalLanguageSkillTableControl) + recPersonalLanguageSkillTableControl.SaveData() + + Dim recPersonalNameTableControl as PersonalNameTableControl = DirectCast(MiscUtils.FindControlRecursively(Me.Page, "PersonalNameTableControl"), PersonalNameTableControl) + recPersonalNameTableControl.SaveData() + + Dim recPersonalRankTableControl as PersonalRankTableControl = DirectCast(MiscUtils.FindControlRecursively(Me.Page, "PersonalRankTableControl"), PersonalRankTableControl) + recPersonalRankTableControl.SaveData() + + Dim recPersonalSalaryTableControl as PersonalSalaryTableControl = DirectCast(MiscUtils.FindControlRecursively(Me.Page, "PersonalSalaryTableControl"), PersonalSalaryTableControl) + recPersonalSalaryTableControl.SaveData() + + Dim recPersonalSpecialSkillTableControl as PersonalSpecialSkillTableControl = DirectCast(MiscUtils.FindControlRecursively(Me.Page, "PersonalSpecialSkillTableControl"), PersonalSpecialSkillTableControl) + recPersonalSpecialSkillTableControl.SaveData() + + Dim recPersonalSportSkillTableControl1 as PersonalSportSkillTableControl1 = DirectCast(MiscUtils.FindControlRecursively(Me.Page, "PersonalSportSkillTableControl1"), PersonalSportSkillTableControl1) + recPersonalSportSkillTableControl1.SaveData() + + Dim recPersonalTitleTableControl as PersonalTitleTableControl = DirectCast(MiscUtils.FindControlRecursively(Me.Page, "PersonalTitleTableControl"), PersonalTitleTableControl) + recPersonalTitleTableControl.SaveData() + + Dim recPersonRelativeTableControl as PersonRelativeTableControl = DirectCast(MiscUtils.FindControlRecursively(Me.Page, "PersonRelativeTableControl"), PersonRelativeTableControl) + recPersonRelativeTableControl.SaveData() + + End Sub + + ' To customize, override this method in PersonalIdRecordControl. + Public Overridable Sub GetUIData() + ' The GetUIData method retrieves the updated values from the user interface + ' controls into a database record in preparation for saving or updating. + ' To do this, it calls the Get methods for each of the field displayed on + ' the webpage. It is better to make changes in the Get methods, rather + ' than making changes here. + + ' Call the Get methods for each of the user interface controls. + + GetAddr() + GetAmphur() + GetArmId() + GetArmyId() + GetArmyWelfareMemId() + GetBAmphur() + GetBirthDate() + GetBloodId() + GetBorn() + GetBProvince() + GetCremateMemId() + GetDeptId() + GetMId() + GetMobilePhone() + GetNationality() + GetOfficerDate() + GetOrigin() + GetPersonalId() + GetPersonalLastName() + GetPersonalName() + GetPhone() + GetPhoneExt() + Getpicture() + GetPlaceOfBirth() + GetPostCode() + GetProvince() + GetRankId() + GetRegDate() + GetRegNo1() + GetRegNo2() + GetReligion() + GetSectionId() + GetSex() + GetStatusId() + GetTId() + End Sub + + + Public Overridable Sub GetAddr() + + ' Retrieve the value entered by the user on the Addr ASP:TextBox, and + ' save it into the Addr field in DataSource PersonalId record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.Addr.Text, PersonalIdTable.Addr) + + + End Sub + + Public Overridable Sub GetAmphur() + + ' Retrieve the value entered by the user on the Amphur ASP:TextBox, and + ' save it into the Amphur field in DataSource PersonalId record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.Amphur.Text, PersonalIdTable.Amphur) + + + End Sub + + Public Overridable Sub GetArmId() + + ' Retrieve the value entered by the user on the ArmId ASP:DropDownList, and + ' save it into the ArmId field in DataSource PersonalId record. + + ' Custom validation should be performed in Validate, not here. + + Me.DataSource.Parse(GetValueSelectedPageRequest(Me.ArmId), PersonalIdTable.ArmId) + + End Sub + + Public Overridable Sub GetArmyId() + + ' Retrieve the value entered by the user on the ArmyId ASP:DropDownList, and + ' save it into the ArmyId field in DataSource PersonalId record. + + ' Custom validation should be performed in Validate, not here. + + Me.DataSource.Parse(GetValueSelectedPageRequest(Me.ArmyId), PersonalIdTable.ArmyId) + + End Sub + + Public Overridable Sub GetArmyWelfareMemId() + + ' Retrieve the value entered by the user on the ArmyWelfareMemId ASP:TextBox, and + ' save it into the ArmyWelfareMemId field in DataSource PersonalId record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.ArmyWelfareMemId.Text, PersonalIdTable.ArmyWelfareMemId) + + + End Sub + + Public Overridable Sub GetBAmphur() + + ' Retrieve the value entered by the user on the BAmphur ASP:TextBox, and + ' save it into the BAmphur field in DataSource PersonalId record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.BAmphur.Text, PersonalIdTable.BAmphur) + + + End Sub + + Public Overridable Sub GetBirthDate() + + ' Retrieve the value entered by the user on the BirthDate ASP:TextBox, and + ' save it into the BirthDate field in DataSource PersonalId 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.BirthDate.Text, PersonalIdTable.BirthDate) + + + End Sub + + Public Overridable Sub GetBloodId() + + ' Retrieve the value entered by the user on the BloodId ASP:DropDownList, and + ' save it into the BloodId field in DataSource PersonalId record. + + ' Custom validation should be performed in Validate, not here. + + Me.DataSource.Parse(GetValueSelectedPageRequest(Me.BloodId), PersonalIdTable.BloodId) + + End Sub + + Public Overridable Sub GetBorn() + + ' Retrieve the value entered by the user on the Born ASP:DropDownList, and + ' save it into the Born field in DataSource PersonalId record. + + ' Custom validation should be performed in Validate, not here. + + Me.DataSource.Parse(GetValueSelectedPageRequest(Me.Born), PersonalIdTable.Born) + + End Sub + + Public Overridable Sub GetBProvince() + + ' Retrieve the value entered by the user on the BProvince ASP:TextBox, and + ' save it into the BProvince field in DataSource PersonalId record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.BProvince.Text, PersonalIdTable.BProvince) + + + End Sub + + Public Overridable Sub GetCremateMemId() + + ' Retrieve the value entered by the user on the CremateMemId ASP:TextBox, and + ' save it into the CremateMemId field in DataSource PersonalId record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.CremateMemId.Text, PersonalIdTable.CremateMemId) + + + End Sub + + Public Overridable Sub GetDeptId() + + ' Retrieve the value entered by the user on the DeptId ASP:DropDownList, and + ' save it into the DeptId field in DataSource PersonalId record. + + ' Custom validation should be performed in Validate, not here. + + Me.DataSource.Parse(GetValueSelectedPageRequest(Me.DeptId), PersonalIdTable.DeptId) + + End Sub + + Public Overridable Sub GetMId() + + ' Retrieve the value entered by the user on the MId ASP:TextBox, and + ' save it into the MId field in DataSource PersonalId record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.MId.Text, PersonalIdTable.MId) + + + End Sub + + Public Overridable Sub GetMobilePhone() + + ' Retrieve the value entered by the user on the MobilePhone ASP:TextBox, and + ' save it into the MobilePhone field in DataSource PersonalId record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.MobilePhone.Text, PersonalIdTable.MobilePhone) + + + End Sub + + Public Overridable Sub GetNationality() + + ' Retrieve the value entered by the user on the Nationality ASP:TextBox, and + ' save it into the Nationality field in DataSource PersonalId record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.Nationality.Text, PersonalIdTable.Nationality) + + + End Sub + + Public Overridable Sub GetOfficerDate() + + ' Retrieve the value entered by the user on the OfficerDate ASP:TextBox, and + ' save it into the OfficerDate field in DataSource PersonalId 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.OfficerDate.Text, PersonalIdTable.OfficerDate) + + + End Sub + + Public Overridable Sub GetOrigin() + + ' Retrieve the value entered by the user on the Origin ASP:TextBox, and + ' save it into the Origin field in DataSource PersonalId record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.Origin.Text, PersonalIdTable.Origin) + + + End Sub + + Public Overridable Sub GetPersonalId() + + ' Retrieve the value entered by the user on the PersonalId ASP:TextBox, and + ' save it into the PersonalId field in DataSource PersonalId record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.PersonalId.Text, PersonalIdTable.PersonalId) + + + End Sub + + Public Overridable Sub GetPersonalLastName() + + ' Retrieve the value entered by the user on the PersonalLastName ASP:TextBox, and + ' save it into the PersonalLastName field in DataSource PersonalId record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.PersonalLastName.Text, PersonalIdTable.PersonalLastName) + + + End Sub + + Public Overridable Sub GetPersonalName() + + ' Retrieve the value entered by the user on the PersonalName ASP:TextBox, and + ' save it into the PersonalName field in DataSource PersonalId record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.PersonalName.Text, PersonalIdTable.PersonalName) + + + End Sub + + Public Overridable Sub GetPhone() + + ' Retrieve the value entered by the user on the Phone ASP:TextBox, and + ' save it into the Phone field in DataSource PersonalId record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.Phone.Text, PersonalIdTable.Phone) + + + End Sub + + Public Overridable Sub GetPhoneExt() + + ' Retrieve the value entered by the user on the PhoneExt ASP:TextBox, and + ' save it into the PhoneExt field in DataSource PersonalId record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.PhoneExt.Text, PersonalIdTable.PhoneExt) + + + End Sub + + Public Overridable Sub Getpicture() + ' Retrieve the value entered by the user on the picture ASP:FileUpload, and + ' save it into the picture field in DataSource PersonalId record. + ' Custom validation should be performed in Validate, not here. + + If Not Me.picture.PostedFile is Nothing then + If Me.picture.PostedFile.FileName.Length > 0 AndAlso Me.picture.PostedFile.ContentLength > 0 Then + ' Retrieve the file contents and store them in picture field. + Me.DataSource.Parse(MiscUtils.GetFileContent(Me.picture.PostedFile), PersonalIdTable.picture) + + ' If there is a FileName companion field specified, then save the file name as well. + ' Strip off the path and just save the part after the last \ + Dim path As String = Me.picture.PostedFile.FileName + Dim LastIndex As Integer = path.LastIndexOf("\") + + Me.DataSource.PictureName = path.Substring(LastIndex + 1).Replace("'", "_") + + End If + End If + End Sub + + Public Overridable Sub GetPlaceOfBirth() + + ' Retrieve the value entered by the user on the PlaceOfBirth ASP:TextBox, and + ' save it into the PlaceOfBirth field in DataSource PersonalId record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.PlaceOfBirth.Text, PersonalIdTable.PlaceOfBirth) + + + End Sub + + Public Overridable Sub GetPostCode() + + ' Retrieve the value entered by the user on the PostCode ASP:TextBox, and + ' save it into the PostCode field in DataSource PersonalId record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.PostCode.Text, PersonalIdTable.PostCode) + + + End Sub + + Public Overridable Sub GetProvince() + + ' Retrieve the value entered by the user on the Province ASP:TextBox, and + ' save it into the Province field in DataSource PersonalId record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.Province.Text, PersonalIdTable.Province) + + + End Sub + + Public Overridable Sub GetRankId() + + ' Retrieve the value entered by the user on the RankId ASP:DropDownList, and + ' save it into the RankId field in DataSource PersonalId record. + + ' Custom validation should be performed in Validate, not here. + + Me.DataSource.Parse(GetValueSelectedPageRequest(Me.RankId), PersonalIdTable.RankId) + + End Sub + + Public Overridable Sub GetRegDate() + + ' Retrieve the value entered by the user on the RegDate ASP:TextBox, and + ' save it into the RegDate field in DataSource PersonalId 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.RegDate.Text, PersonalIdTable.RegDate) + + + End Sub + + Public Overridable Sub GetRegNo1() + + ' Retrieve the value entered by the user on the RegNo1 ASP:TextBox, and + ' save it into the RegNo1 field in DataSource PersonalId record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.RegNo1.Text, PersonalIdTable.RegNo1) + + + End Sub + + Public Overridable Sub GetRegNo2() + + ' Retrieve the value entered by the user on the RegNo2 ASP:TextBox, and + ' save it into the RegNo2 field in DataSource PersonalId record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.RegNo2.Text, PersonalIdTable.RegNo2) + + + End Sub + + Public Overridable Sub GetReligion() + + ' Retrieve the value entered by the user on the Religion ASP:TextBox, and + ' save it into the Religion field in DataSource PersonalId record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.Religion.Text, PersonalIdTable.Religion) + + + End Sub + + Public Overridable Sub GetSectionId() + + ' Retrieve the value entered by the user on the SectionId ASP:DropDownList, and + ' save it into the SectionId field in DataSource PersonalId record. + + ' Custom validation should be performed in Validate, not here. + + Me.DataSource.Parse(GetValueSelectedPageRequest(Me.SectionId), PersonalIdTable.SectionId) + + End Sub + + Public Overridable Sub GetSex() + + ' Retrieve the value entered by the user on the Sex ASP:DropDownList, and + ' save it into the Sex field in DataSource PersonalId record. + + ' Custom validation should be performed in Validate, not here. + + Me.DataSource.Parse(GetValueSelectedPageRequest(Me.Sex), PersonalIdTable.Sex) + + End Sub + + Public Overridable Sub GetStatusId() + + ' Retrieve the value entered by the user on the StatusId ASP:DropDownList, and + ' save it into the StatusId field in DataSource PersonalId record. + + ' Custom validation should be performed in Validate, not here. + + Me.DataSource.Parse(GetValueSelectedPageRequest(Me.StatusId), PersonalIdTable.StatusId) + + End Sub + + Public Overridable Sub GetTId() + + ' Retrieve the value entered by the user on the TId ASP:TextBox, and + ' save it into the TId field in DataSource PersonalId record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.TId.Text, PersonalIdTable.TId) + + + End Sub + + + ' To customize, override this method in PersonalIdRecordControl. + + Public Overridable Function CreateWhereClause() As WhereClause + + Dim wc As WhereClause + PersonalIdTable.Instance.InnerFilter = Nothing + wc = New WhereClause() + + ' Compose the WHERE clause consiting of: + ' 1. Static clause defined at design time. + ' 2. User selected filter criteria. + ' 3. User selected search criteria. + + + ' Get the static clause defined at design time on the Record Panel Wizard + + Dim qc As WhereClause = Me.CreateQueryClause() + If Not(IsNothing(qc)) Then + wc.iAND(qc) + End If + + ' Retrieve the record id from the URL parameter. + + Dim recId As String = Me.Page.Request.QueryString.Item("PersonalId") + + 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}", "PersonalId")) + End If + HttpContext.Current.Session("QueryString in EditPersonalId") = recId + + If KeyValue.IsXmlKey(recId) Then + ' Keys are typically passed as XML structures to handle composite keys. + ' If XML, then add a Where clause based on the Primary Key in the XML. + Dim pkValue As KeyValue = KeyValue.XmlToKey(recId) + + wc.iAND(PersonalIdTable.PersonalId, BaseFilter.ComparisonOperator.EqualsTo, pkValue.GetColumnValueString(PersonalIdTable.PersonalId)) + + Else + ' The URL parameter contains the actual value, not an XML structure. + + wc.iAND(PersonalIdTable.PersonalId, BaseFilter.ComparisonOperator.EqualsTo, recId) + + End If + + Return wc + + End Function + + Protected Overridable Function CreateQueryClause() As WhereClause + ' Create a where clause for the Static clause defined at design time. + Return Nothing + End Function + + ' This CreateWhereClause is used for loading list of suggestions for Auto Type-Ahead feature. + + Public Overridable Function CreateWhereClause(ByVal searchText As String, ByVal fromSearchControl As String, ByVal AutoTypeAheadSearch As String, ByVal AutoTypeAheadWordSeparators As String) As WhereClause + PersonalIdTable.Instance.InnerFilter = Nothing + Dim wc As WhereClause = New WhereClause() + + ' Compose the WHERE clause consiting of: + ' 1. Static clause defined at design time. + ' 2. User selected filter criteria. + ' 3. User selected search criteria. + Dim appRelativeVirtualPath As String = CType(HttpContext.Current.Session("AppRelativeVirtualPath"), String) + + + ' Get the static clause defined at design time on the Table Panel Wizard + Dim qc As WhereClause = Me.CreateQueryClause() + If Not(IsNothing(qc)) Then + wc.iAND(qc) ''nope nothing + End If + + ' 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 PersonalIdRecordControl. + Public Overridable Sub Validate() + ' Add custom validation for any control within this panel. + ' Example. If you have a State ASP:Textbox control + ' If Me.State.Text <> "CA" Then + ' Throw New Exception("State must be CA (California).") + ' End If + + ' The Validate method is common across all controls within + ' this panel so you can validate multiple fields, but report + ' one error message. + + + End Sub + + Public Overridable Sub Delete() + + If Me.IsNewRecord() Then + Return + End If + + Dim pkValue As KeyValue = KeyValue.XmlToKey(Me.RecordUniqueId) + PersonalIdTable.DeleteRecord(pkValue) + + End Sub + + Protected Overridable Sub Control_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.PreRender + ' PreRender event is raised just before page is being displayed. + Try + DbUtils.StartTransaction() + Me.RegisterPostback() + + If Not Me.Page.ErrorOnPage AndAlso (Me.Page.IsPageRefresh OrElse Me.DataChanged OrElse Me.ResetData) Then + + + ' Re-load the data and update the web page if necessary. + ' This is typically done during a postback (filter, search button, sort, pagination button). + ' In each of the other click handlers, simply set DataChanged to True to reload the data. + Me.LoadData() + Me.DataBind() + End If + + + Catch ex As Exception + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + Finally + DbUtils.EndTransaction() + End Try + End Sub + + + Protected Overrides Sub SaveControlsToSession() + MyBase.SaveControlsToSession() + + + 'Save 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_ArmIdDropDownList() 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 Arm table. + ' Examples: + ' wc.iAND(ArmTable.ArmSName, BaseFilter.ComparisonOperator.EqualsTo, "XYZ") + ' wc.iAND(ArmTable.Active, BaseFilter.ComparisonOperator.EqualsTo, "1") + + Dim wc As WhereClause = New WhereClause() + Return wc + + End Function + + + + Public Overridable Function CreateWhereClause_ArmyIdDropDownList() 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 Army table. + ' Examples: + ' wc.iAND(ArmyTable.Army, BaseFilter.ComparisonOperator.EqualsTo, "XYZ") + ' wc.iAND(ArmyTable.Active, BaseFilter.ComparisonOperator.EqualsTo, "1") + + Dim wc As WhereClause = New WhereClause() + Return wc + + End Function + + + + Public Overridable Function CreateWhereClause_BloodIdDropDownList() 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 BloodId table. + ' Examples: + ' wc.iAND(BloodIdTable.BloodName, BaseFilter.ComparisonOperator.EqualsTo, "XYZ") + ' wc.iAND(BloodIdTable.Active, BaseFilter.ComparisonOperator.EqualsTo, "1") + + Dim wc As WhereClause = New WhereClause() + Return wc + + End Function + + + + Public Overridable Function CreateWhereClause_BornDropDownList() 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 Born table. + ' Examples: + ' wc.iAND(BornTable.BornDesc, BaseFilter.ComparisonOperator.EqualsTo, "XYZ") + ' wc.iAND(BornTable.Active, BaseFilter.ComparisonOperator.EqualsTo, "1") + + Dim wc As WhereClause = New WhereClause() + Return wc + + End Function + + + + Public Overridable Function CreateWhereClause_DeptIdDropDownList() 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 Dept table. + ' Examples: + ' wc.iAND(DeptTable.Dept, BaseFilter.ComparisonOperator.EqualsTo, "XYZ") + ' wc.iAND(DeptTable.Active, BaseFilter.ComparisonOperator.EqualsTo, "1") + + Dim wc As WhereClause = New WhereClause() + Return wc + + End Function + + + + Public Overridable Function CreateWhereClause_RankIdDropDownList() As WhereClause + ' By default, we simply return a new WhereClause. + ' Add additional where clauses to restrict the items shown in the dropdown list. + + Dim wc As WhereClause = New WhereClause() + Return wc + + End Function + + + + Public Overridable Function CreateWhereClause_SectionIdDropDownList() 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 Section table. + ' Examples: + ' wc.iAND(SectionTable.SectionName, BaseFilter.ComparisonOperator.EqualsTo, "XYZ") + ' wc.iAND(SectionTable.Active, BaseFilter.ComparisonOperator.EqualsTo, "1") + + Dim wc As WhereClause = New WhereClause() + Return wc + + End Function + + + + Public Overridable Function CreateWhereClause_SexDropDownList() 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 Sex table. + ' Examples: + ' wc.iAND(SexTable.Sex, BaseFilter.ComparisonOperator.EqualsTo, "XYZ") + ' wc.iAND(SexTable.Active, BaseFilter.ComparisonOperator.EqualsTo, "1") + + Dim wc As WhereClause = New WhereClause() + Return wc + + End Function + + + + Public Overridable Function CreateWhereClause_StatusIdDropDownList() 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 Status table. + ' Examples: + ' wc.iAND(StatusTable.Status, BaseFilter.ComparisonOperator.EqualsTo, "XYZ") + ' wc.iAND(StatusTable.Active, BaseFilter.ComparisonOperator.EqualsTo, "1") + + Dim wc As WhereClause = New WhereClause() + Return wc + + End Function + + + ' Fill the ArmId list. + Protected Overridable Sub PopulateArmIdDropDownList( _ + ByVal selectedValue As String, _ + ByVal maxItems As Integer) + + Me.ArmId.Items.Clear() + + + ' 1. Setup the static list items + + ' Add the Please Select item. + Me.ArmId.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_ArmIdDropDownList function. + ' It is better to customize the where clause there. + + Dim wc As WhereClause = CreateWhereClause_ArmIdDropDownList() + ' Create the ORDER BY clause to sort based on the displayed value. + + + Dim orderBy As OrderBy = New OrderBy(false, false) + orderBy.Add(ArmTable.ArmSName, 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 ArmRecord = 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 = ArmTable.GetRecords(wc, orderBy, pageNum, maxItems) + For each itemValue As ArmRecord In itemValues + ' Create the item and add to the list. + Dim cvalue As String = Nothing + Dim fvalue As String = Nothing + If itemValue.ArmIdSpecified Then + cvalue = itemValue.ArmId.ToString() + + If counter < maxItems AndAlso Me.ArmId.Items.FindByValue(cvalue) Is Nothing Then + + Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalIdTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalIdTable.ArmId) + If _isExpandableNonCompositeForeignKey AndAlso PersonalIdTable.ArmId.IsApplyDisplayAs Then + fvalue = PersonalIdTable.GetDFKA(itemValue, PersonalIdTable.ArmId) + End If + If (Not _isExpandableNonCompositeForeignKey) Or (String.IsNullOrEmpty(fvalue)) Then + fvalue = itemValue.Format(ArmTable.ArmSName) + 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.ArmId.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.ArmId.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.ArmId, selectedValue) AndAlso _ + Not SetSelectedDisplayText(Me.ArmId, selectedValue)Then + + ' construct a whereclause to query a record with Arm.ArmId = selectedValue + Dim filter2 As CompoundFilter = New CompoundFilter(CompoundFilter.CompoundingOperators.And_Operator, Nothing) + Dim whereClause2 As WhereClause = New WhereClause() + filter2.AddFilter(New BaseClasses.Data.ColumnValueFilter(ArmTable.ArmId, selectedValue, BaseClasses.Data.BaseFilter.ComparisonOperator.EqualsTo, False)) + whereClause2.AddFilter(filter2, CompoundFilter.CompoundingOperators.And_Operator) + + Try + ' Execute the query + Dim rc() As ArmRecord = ArmTable.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 ArmRecord = DirectCast(rc(0), ArmRecord) + ' Create the item and add to the list. + Dim cvalue As String = Nothing + Dim fvalue As String = Nothing + If itemValue.ArmIdSpecified Then + cvalue = itemValue.ArmId.ToString() + Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalIdTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalIdTable.ArmId) + If _isExpandableNonCompositeForeignKey AndAlso PersonalIdTable.ArmId.IsApplyDisplayAs Then + fvalue = PersonalIdTable.GetDFKA(itemValue, PersonalIdTable.ArmId) + End If + If (Not _isExpandableNonCompositeForeignKey) Or (String.IsNullOrEmpty(fvalue)) Then + fvalue = itemValue.Format(ArmTable.ArmSName) + End If + + If fvalue Is Nothing OrElse fvalue.Trim() = "" Then fvalue = cvalue + Dim newItem As New ListItem(fvalue, cvalue) + Me.ArmId.Items.Add(newItem) + SetSelectedValue(Me.ArmId, selectedValue) + End If + End If + Catch + End Try + + End If + + + End Sub + + ' Fill the ArmyId list. + Protected Overridable Sub PopulateArmyIdDropDownList( _ + ByVal selectedValue As String, _ + ByVal maxItems As Integer) + + Me.ArmyId.Items.Clear() + + + ' 1. Setup the static list items + + ' Add the Please Select item. + Me.ArmyId.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_ArmyIdDropDownList function. + ' It is better to customize the where clause there. + + Dim wc As WhereClause = CreateWhereClause_ArmyIdDropDownList() + ' Create the ORDER BY clause to sort based on the displayed value. + + + Dim orderBy As OrderBy = New OrderBy(false, false) + orderBy.Add(ArmyTable.Army, 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 ArmyRecord = 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 = ArmyTable.GetRecords(wc, orderBy, pageNum, maxItems) + For each itemValue As ArmyRecord In itemValues + ' Create the item and add to the list. + Dim cvalue As String = Nothing + Dim fvalue As String = Nothing + If itemValue.ArmyIdSpecified Then + cvalue = itemValue.ArmyId.ToString() + + If counter < maxItems AndAlso Me.ArmyId.Items.FindByValue(cvalue) Is Nothing Then + + Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalIdTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalIdTable.ArmyId) + If _isExpandableNonCompositeForeignKey AndAlso PersonalIdTable.ArmyId.IsApplyDisplayAs Then + fvalue = PersonalIdTable.GetDFKA(itemValue, PersonalIdTable.ArmyId) + End If + If (Not _isExpandableNonCompositeForeignKey) Or (String.IsNullOrEmpty(fvalue)) Then + fvalue = itemValue.Format(ArmyTable.Army) + 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.ArmyId.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.ArmyId.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.ArmyId, selectedValue) AndAlso _ + Not SetSelectedDisplayText(Me.ArmyId, selectedValue)Then + + ' construct a whereclause to query a record with Army.ArmyId = selectedValue + Dim filter2 As CompoundFilter = New CompoundFilter(CompoundFilter.CompoundingOperators.And_Operator, Nothing) + Dim whereClause2 As WhereClause = New WhereClause() + filter2.AddFilter(New BaseClasses.Data.ColumnValueFilter(ArmyTable.ArmyId, selectedValue, BaseClasses.Data.BaseFilter.ComparisonOperator.EqualsTo, False)) + whereClause2.AddFilter(filter2, CompoundFilter.CompoundingOperators.And_Operator) + + Try + ' Execute the query + Dim rc() As ArmyRecord = ArmyTable.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 ArmyRecord = DirectCast(rc(0), ArmyRecord) + ' Create the item and add to the list. + Dim cvalue As String = Nothing + Dim fvalue As String = Nothing + If itemValue.ArmyIdSpecified Then + cvalue = itemValue.ArmyId.ToString() + Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalIdTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalIdTable.ArmyId) + If _isExpandableNonCompositeForeignKey AndAlso PersonalIdTable.ArmyId.IsApplyDisplayAs Then + fvalue = PersonalIdTable.GetDFKA(itemValue, PersonalIdTable.ArmyId) + End If + If (Not _isExpandableNonCompositeForeignKey) Or (String.IsNullOrEmpty(fvalue)) Then + fvalue = itemValue.Format(ArmyTable.Army) + End If + + If fvalue Is Nothing OrElse fvalue.Trim() = "" Then fvalue = cvalue + Dim newItem As New ListItem(fvalue, cvalue) + Me.ArmyId.Items.Add(newItem) + SetSelectedValue(Me.ArmyId, selectedValue) + End If + End If + Catch + End Try + + End If + + + End Sub + + ' Fill the BloodId list. + Protected Overridable Sub PopulateBloodIdDropDownList( _ + ByVal selectedValue As String, _ + ByVal maxItems As Integer) + + Me.BloodId.Items.Clear() + + + ' 1. Setup the static list items + + ' Add the Please Select item. + Me.BloodId.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_BloodIdDropDownList function. + ' It is better to customize the where clause there. + + Dim wc As WhereClause = CreateWhereClause_BloodIdDropDownList() + ' Create the ORDER BY clause to sort based on the displayed value. + + + Dim orderBy As OrderBy = New OrderBy(false, false) + orderBy.Add(BloodIdTable.BloodName, 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 BloodIdRecord = 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 = BloodIdTable.GetRecords(wc, orderBy, pageNum, maxItems) + For each itemValue As BloodIdRecord In itemValues + ' Create the item and add to the list. + Dim cvalue As String = Nothing + Dim fvalue As String = Nothing + If itemValue.BloodIdSpecified Then + cvalue = itemValue.BloodId.ToString() + + If counter < maxItems AndAlso Me.BloodId.Items.FindByValue(cvalue) Is Nothing Then + + Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalIdTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalIdTable.BloodId) + If _isExpandableNonCompositeForeignKey AndAlso PersonalIdTable.BloodId.IsApplyDisplayAs Then + fvalue = PersonalIdTable.GetDFKA(itemValue, PersonalIdTable.BloodId) + End If + If (Not _isExpandableNonCompositeForeignKey) Or (String.IsNullOrEmpty(fvalue)) Then + fvalue = itemValue.Format(BloodIdTable.BloodName) + 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.BloodId.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.BloodId.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.BloodId, selectedValue) AndAlso _ + Not SetSelectedDisplayText(Me.BloodId, selectedValue)Then + + ' construct a whereclause to query a record with BloodId.BloodId = selectedValue + Dim filter2 As CompoundFilter = New CompoundFilter(CompoundFilter.CompoundingOperators.And_Operator, Nothing) + Dim whereClause2 As WhereClause = New WhereClause() + filter2.AddFilter(New BaseClasses.Data.ColumnValueFilter(BloodIdTable.BloodId, selectedValue, BaseClasses.Data.BaseFilter.ComparisonOperator.EqualsTo, False)) + whereClause2.AddFilter(filter2, CompoundFilter.CompoundingOperators.And_Operator) + + Try + ' Execute the query + Dim rc() As BloodIdRecord = BloodIdTable.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 BloodIdRecord = DirectCast(rc(0), BloodIdRecord) + ' Create the item and add to the list. + Dim cvalue As String = Nothing + Dim fvalue As String = Nothing + If itemValue.BloodIdSpecified Then + cvalue = itemValue.BloodId.ToString() + Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalIdTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalIdTable.BloodId) + If _isExpandableNonCompositeForeignKey AndAlso PersonalIdTable.BloodId.IsApplyDisplayAs Then + fvalue = PersonalIdTable.GetDFKA(itemValue, PersonalIdTable.BloodId) + End If + If (Not _isExpandableNonCompositeForeignKey) Or (String.IsNullOrEmpty(fvalue)) Then + fvalue = itemValue.Format(BloodIdTable.BloodName) + End If + + If fvalue Is Nothing OrElse fvalue.Trim() = "" Then fvalue = cvalue + Dim newItem As New ListItem(fvalue, cvalue) + Me.BloodId.Items.Add(newItem) + SetSelectedValue(Me.BloodId, selectedValue) + End If + End If + Catch + End Try + + End If + + + End Sub + + ' Fill the Born list. + Protected Overridable Sub PopulateBornDropDownList( _ + ByVal selectedValue As String, _ + ByVal maxItems As Integer) + + Me.Born.Items.Clear() + + + ' 1. Setup the static list items + + ' Add the Please Select item. + Me.Born.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_BornDropDownList function. + ' It is better to customize the where clause there. + + Dim wc As WhereClause = CreateWhereClause_BornDropDownList() + ' Create the ORDER BY clause to sort based on the displayed value. + + + Dim orderBy As OrderBy = New OrderBy(false, false) + orderBy.Add(BornTable.BornDesc, 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 BornRecord = 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 = BornTable.GetRecords(wc, orderBy, pageNum, maxItems) + For each itemValue As BornRecord In itemValues + ' Create the item and add to the list. + Dim cvalue As String = Nothing + Dim fvalue As String = Nothing + If itemValue.BornSpecified Then + cvalue = itemValue.Born.ToString() + + If counter < maxItems AndAlso Me.Born.Items.FindByValue(cvalue) Is Nothing Then + + Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalIdTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalIdTable.Born) + If _isExpandableNonCompositeForeignKey AndAlso PersonalIdTable.Born.IsApplyDisplayAs Then + fvalue = PersonalIdTable.GetDFKA(itemValue, PersonalIdTable.Born) + End If + If (Not _isExpandableNonCompositeForeignKey) Or (String.IsNullOrEmpty(fvalue)) Then + fvalue = itemValue.Format(BornTable.BornDesc) + 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.Born.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.Born.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.Born, selectedValue) AndAlso _ + Not SetSelectedDisplayText(Me.Born, selectedValue)Then + + ' construct a whereclause to query a record with Born.Born = selectedValue + Dim filter2 As CompoundFilter = New CompoundFilter(CompoundFilter.CompoundingOperators.And_Operator, Nothing) + Dim whereClause2 As WhereClause = New WhereClause() + filter2.AddFilter(New BaseClasses.Data.ColumnValueFilter(BornTable.Born, selectedValue, BaseClasses.Data.BaseFilter.ComparisonOperator.EqualsTo, False)) + whereClause2.AddFilter(filter2, CompoundFilter.CompoundingOperators.And_Operator) + + Try + ' Execute the query + Dim rc() As BornRecord = BornTable.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 BornRecord = DirectCast(rc(0), BornRecord) + ' Create the item and add to the list. + Dim cvalue As String = Nothing + Dim fvalue As String = Nothing + If itemValue.BornSpecified Then + cvalue = itemValue.Born.ToString() + Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalIdTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalIdTable.Born) + If _isExpandableNonCompositeForeignKey AndAlso PersonalIdTable.Born.IsApplyDisplayAs Then + fvalue = PersonalIdTable.GetDFKA(itemValue, PersonalIdTable.Born) + End If + If (Not _isExpandableNonCompositeForeignKey) Or (String.IsNullOrEmpty(fvalue)) Then + fvalue = itemValue.Format(BornTable.BornDesc) + End If + + If fvalue Is Nothing OrElse fvalue.Trim() = "" Then fvalue = cvalue + Dim newItem As New ListItem(fvalue, cvalue) + Me.Born.Items.Add(newItem) + SetSelectedValue(Me.Born, selectedValue) + End If + End If + Catch + End Try + + End If + + + End Sub + + ' Fill the DeptId list. + Protected Overridable Sub PopulateDeptIdDropDownList( _ + ByVal selectedValue As String, _ + ByVal maxItems As Integer) + + Me.DeptId.Items.Clear() + + + ' 1. Setup the static list items + + ' Add the Please Select item. + Me.DeptId.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_DeptIdDropDownList function. + ' It is better to customize the where clause there. + + Dim wc As WhereClause = CreateWhereClause_DeptIdDropDownList() + ' Create the ORDER BY clause to sort based on the displayed value. + + + Dim orderBy As OrderBy = New OrderBy(false, false) + orderBy.Add(DeptTable.Dept, 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 DeptRecord = 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 = DeptTable.GetRecords(wc, orderBy, pageNum, maxItems) + For each itemValue As DeptRecord In itemValues + ' Create the item and add to the list. + Dim cvalue As String = Nothing + Dim fvalue As String = Nothing + If itemValue.DeptIdSpecified Then + cvalue = itemValue.DeptId.ToString() + + If counter < maxItems AndAlso Me.DeptId.Items.FindByValue(cvalue) Is Nothing Then + + Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalIdTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalIdTable.DeptId) + If _isExpandableNonCompositeForeignKey AndAlso PersonalIdTable.DeptId.IsApplyDisplayAs Then + fvalue = PersonalIdTable.GetDFKA(itemValue, PersonalIdTable.DeptId) + End If + If (Not _isExpandableNonCompositeForeignKey) Or (String.IsNullOrEmpty(fvalue)) Then + fvalue = itemValue.Format(DeptTable.Dept) + 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.DeptId.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.DeptId.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.DeptId, selectedValue) AndAlso _ + Not SetSelectedDisplayText(Me.DeptId, selectedValue)Then + + ' construct a whereclause to query a record with Dept.DeptId = selectedValue + Dim filter2 As CompoundFilter = New CompoundFilter(CompoundFilter.CompoundingOperators.And_Operator, Nothing) + Dim whereClause2 As WhereClause = New WhereClause() + filter2.AddFilter(New BaseClasses.Data.ColumnValueFilter(DeptTable.DeptId, selectedValue, BaseClasses.Data.BaseFilter.ComparisonOperator.EqualsTo, False)) + whereClause2.AddFilter(filter2, CompoundFilter.CompoundingOperators.And_Operator) + + Try + ' Execute the query + Dim rc() As DeptRecord = DeptTable.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 DeptRecord = DirectCast(rc(0), DeptRecord) + ' Create the item and add to the list. + Dim cvalue As String = Nothing + Dim fvalue As String = Nothing + If itemValue.DeptIdSpecified Then + cvalue = itemValue.DeptId.ToString() + Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalIdTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalIdTable.DeptId) + If _isExpandableNonCompositeForeignKey AndAlso PersonalIdTable.DeptId.IsApplyDisplayAs Then + fvalue = PersonalIdTable.GetDFKA(itemValue, PersonalIdTable.DeptId) + End If + If (Not _isExpandableNonCompositeForeignKey) Or (String.IsNullOrEmpty(fvalue)) Then + fvalue = itemValue.Format(DeptTable.Dept) + End If + + If fvalue Is Nothing OrElse fvalue.Trim() = "" Then fvalue = cvalue + Dim newItem As New ListItem(fvalue, cvalue) + Me.DeptId.Items.Add(newItem) + SetSelectedValue(Me.DeptId, selectedValue) + End If + End If + Catch + End Try + + End If + + + End Sub + + ' Fill the RankId list. + Protected Overridable Sub PopulateRankIdDropDownList( _ + ByVal selectedValue As String, _ + ByVal maxItems As Integer) + + Me.RankId.Items.Clear() + + + ' 1. Setup the static list items + + ' Add the Please Select item. + Me.RankId.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_RankIdDropDownList function. + ' It is better to customize the where clause there. + + Dim wc As WhereClause = CreateWhereClause_RankIdDropDownList() + ' Create the ORDER BY clause to sort based on the displayed value. + + + ' 3. Read a total of maxItems from the database and insert them + Dim orderBy As OrderBy = New OrderBy(False, False) + orderBy.Add(PersonalIdTable.RankId, OrderByItem.OrderDir.Asc) + + Dim itemValue As String + Dim listDuplicates As New ArrayList() + + For Each itemValue In PersonalIdTable.GetValues(PersonalIdTable.RankId, wc, orderBy, maxItems) + ' Create the dropdown list item and add it to the list. + Dim fvalue As String = PersonalIdTable.RankId.Format(itemValue) + If fvalue Is Nothing OrElse fvalue.Trim() = "" Then fvalue = itemValue + Dim dupItem As ListItem = Me.RankId.Items.FindByText(fvalue) + + If Not IsNothing(dupItem) Then + listDuplicates.Add(fvalue) + dupItem.Text = fvalue & " (ID " & dupItem.Value & ")" + End If + + Dim newItem As ListItem = New ListItem(fvalue, itemValue) + Me.RankId.Items.Add(newItem) + + If listDuplicates.Contains(fvalue) Then + newItem.Text = fvalue & " (ID " & itemValue & ")" + End If + Next + + + ' 4. Set the selected value (insert if not already present). + + If Not selectedValue Is Nothing AndAlso _ + selectedValue.Trim <> "" AndAlso _ + Not SetSelectedValue(Me.RankId, selectedValue) AndAlso _ + Not SetSelectedDisplayText(Me.RankId, selectedValue) AndAlso _ + Not SetSelectedDisplayText(Me.RankId, PersonalIdTable.RankId.Format(selectedValue))Then + Dim fvalue As String = PersonalIdTable.RankId.Format(selectedValue) + If fvalue Is Nothing OrElse fvalue.Trim() = "" Then fvalue = selectedValue + Dim item As ListItem = New ListItem(fvalue, selectedValue) + item.Selected = True + Me.RankId.Items.Add(item) + End If + + + End Sub + + ' Fill the SectionId list. + Protected Overridable Sub PopulateSectionIdDropDownList( _ + ByVal selectedValue As String, _ + ByVal maxItems As Integer) + + Me.SectionId.Items.Clear() + + + ' 1. Setup the static list items + + ' Add the Please Select item. + Me.SectionId.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_SectionIdDropDownList function. + ' It is better to customize the where clause there. + + Dim wc As WhereClause = CreateWhereClause_SectionIdDropDownList() + ' Create the ORDER BY clause to sort based on the displayed value. + + + Dim orderBy As OrderBy = New OrderBy(false, false) + orderBy.Add(SectionTable.SectionName, 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 SectionRecord = 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 = SectionTable.GetRecords(wc, orderBy, pageNum, maxItems) + For each itemValue As SectionRecord In itemValues + ' Create the item and add to the list. + Dim cvalue As String = Nothing + Dim fvalue As String = Nothing + If itemValue.SectionIdSpecified Then + cvalue = itemValue.SectionId.ToString() + + If counter < maxItems AndAlso Me.SectionId.Items.FindByValue(cvalue) Is Nothing Then + + Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalIdTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalIdTable.SectionId) + If _isExpandableNonCompositeForeignKey AndAlso PersonalIdTable.SectionId.IsApplyDisplayAs Then + fvalue = PersonalIdTable.GetDFKA(itemValue, PersonalIdTable.SectionId) + End If + If (Not _isExpandableNonCompositeForeignKey) Or (String.IsNullOrEmpty(fvalue)) Then + fvalue = itemValue.Format(SectionTable.SectionName) + 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.SectionId.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.SectionId.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.SectionId, selectedValue) AndAlso _ + Not SetSelectedDisplayText(Me.SectionId, selectedValue)Then + + ' construct a whereclause to query a record with Section.SectionId = selectedValue + Dim filter2 As CompoundFilter = New CompoundFilter(CompoundFilter.CompoundingOperators.And_Operator, Nothing) + Dim whereClause2 As WhereClause = New WhereClause() + filter2.AddFilter(New BaseClasses.Data.ColumnValueFilter(SectionTable.SectionId, selectedValue, BaseClasses.Data.BaseFilter.ComparisonOperator.EqualsTo, False)) + whereClause2.AddFilter(filter2, CompoundFilter.CompoundingOperators.And_Operator) + + Try + ' Execute the query + Dim rc() As SectionRecord = SectionTable.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 SectionRecord = DirectCast(rc(0), SectionRecord) + ' Create the item and add to the list. + Dim cvalue As String = Nothing + Dim fvalue As String = Nothing + If itemValue.SectionIdSpecified Then + cvalue = itemValue.SectionId.ToString() + Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalIdTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalIdTable.SectionId) + If _isExpandableNonCompositeForeignKey AndAlso PersonalIdTable.SectionId.IsApplyDisplayAs Then + fvalue = PersonalIdTable.GetDFKA(itemValue, PersonalIdTable.SectionId) + End If + If (Not _isExpandableNonCompositeForeignKey) Or (String.IsNullOrEmpty(fvalue)) Then + fvalue = itemValue.Format(SectionTable.SectionName) + End If + + If fvalue Is Nothing OrElse fvalue.Trim() = "" Then fvalue = cvalue + Dim newItem As New ListItem(fvalue, cvalue) + Me.SectionId.Items.Add(newItem) + SetSelectedValue(Me.SectionId, selectedValue) + End If + End If + Catch + End Try + + End If + + + End Sub + + ' Fill the Sex list. + Protected Overridable Sub PopulateSexDropDownList( _ + ByVal selectedValue As String, _ + ByVal maxItems As Integer) + + Me.Sex.Items.Clear() + + + ' 1. Setup the static list items + + ' Add the Please Select item. + Me.Sex.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_SexDropDownList function. + ' It is better to customize the where clause there. + + Dim wc As WhereClause = CreateWhereClause_SexDropDownList() + ' Create the ORDER BY clause to sort based on the displayed value. + + + Dim orderBy As OrderBy = New OrderBy(false, false) + orderBy.Add(SexTable.Sex, 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 SexRecord = 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 = SexTable.GetRecords(wc, orderBy, pageNum, maxItems) + For each itemValue As SexRecord In itemValues + ' Create the item and add to the list. + Dim cvalue As String = Nothing + Dim fvalue As String = Nothing + If itemValue.SexIdSpecified Then + cvalue = itemValue.SexId.ToString() + + If counter < maxItems AndAlso Me.Sex.Items.FindByValue(cvalue) Is Nothing Then + + Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalIdTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalIdTable.Sex) + If _isExpandableNonCompositeForeignKey AndAlso PersonalIdTable.Sex.IsApplyDisplayAs Then + fvalue = PersonalIdTable.GetDFKA(itemValue, PersonalIdTable.Sex) + End If + If (Not _isExpandableNonCompositeForeignKey) Or (String.IsNullOrEmpty(fvalue)) Then + fvalue = itemValue.Format(SexTable.Sex) + 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.Sex.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.Sex.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.Sex, selectedValue) AndAlso _ + Not SetSelectedDisplayText(Me.Sex, selectedValue)Then + + ' construct a whereclause to query a record with Sex.SexId = selectedValue + Dim filter2 As CompoundFilter = New CompoundFilter(CompoundFilter.CompoundingOperators.And_Operator, Nothing) + Dim whereClause2 As WhereClause = New WhereClause() + filter2.AddFilter(New BaseClasses.Data.ColumnValueFilter(SexTable.SexId, selectedValue, BaseClasses.Data.BaseFilter.ComparisonOperator.EqualsTo, False)) + whereClause2.AddFilter(filter2, CompoundFilter.CompoundingOperators.And_Operator) + + Try + ' Execute the query + Dim rc() As SexRecord = SexTable.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 SexRecord = DirectCast(rc(0), SexRecord) + ' Create the item and add to the list. + Dim cvalue As String = Nothing + Dim fvalue As String = Nothing + If itemValue.SexIdSpecified Then + cvalue = itemValue.SexId.ToString() + Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalIdTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalIdTable.Sex) + If _isExpandableNonCompositeForeignKey AndAlso PersonalIdTable.Sex.IsApplyDisplayAs Then + fvalue = PersonalIdTable.GetDFKA(itemValue, PersonalIdTable.Sex) + End If + If (Not _isExpandableNonCompositeForeignKey) Or (String.IsNullOrEmpty(fvalue)) Then + fvalue = itemValue.Format(SexTable.Sex) + End If + + If fvalue Is Nothing OrElse fvalue.Trim() = "" Then fvalue = cvalue + Dim newItem As New ListItem(fvalue, cvalue) + Me.Sex.Items.Add(newItem) + SetSelectedValue(Me.Sex, selectedValue) + End If + End If + Catch + End Try + + End If + + + End Sub + + ' Fill the StatusId list. + Protected Overridable Sub PopulateStatusIdDropDownList( _ + ByVal selectedValue As String, _ + ByVal maxItems As Integer) + + Me.StatusId.Items.Clear() + + + ' 1. Setup the static list items + + ' Add the Please Select item. + Me.StatusId.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_StatusIdDropDownList function. + ' It is better to customize the where clause there. + + Dim wc As WhereClause = CreateWhereClause_StatusIdDropDownList() + ' Create the ORDER BY clause to sort based on the displayed value. + + + Dim orderBy As OrderBy = New OrderBy(false, false) + orderBy.Add(StatusTable.Status, 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 StatusRecord = 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 = StatusTable.GetRecords(wc, orderBy, pageNum, maxItems) + For each itemValue As StatusRecord In itemValues + ' Create the item and add to the list. + Dim cvalue As String = Nothing + Dim fvalue As String = Nothing + If itemValue.StatusIdSpecified Then + cvalue = itemValue.StatusId.ToString() + + If counter < maxItems AndAlso Me.StatusId.Items.FindByValue(cvalue) Is Nothing Then + + Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalIdTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalIdTable.StatusId) + If _isExpandableNonCompositeForeignKey AndAlso PersonalIdTable.StatusId.IsApplyDisplayAs Then + fvalue = PersonalIdTable.GetDFKA(itemValue, PersonalIdTable.StatusId) + End If + If (Not _isExpandableNonCompositeForeignKey) Or (String.IsNullOrEmpty(fvalue)) Then + fvalue = itemValue.Format(StatusTable.Status) + 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.StatusId.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.StatusId.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.StatusId, selectedValue) AndAlso _ + Not SetSelectedDisplayText(Me.StatusId, selectedValue)Then + + ' construct a whereclause to query a record with Status.StatusId = selectedValue + Dim filter2 As CompoundFilter = New CompoundFilter(CompoundFilter.CompoundingOperators.And_Operator, Nothing) + Dim whereClause2 As WhereClause = New WhereClause() + filter2.AddFilter(New BaseClasses.Data.ColumnValueFilter(StatusTable.StatusId, selectedValue, BaseClasses.Data.BaseFilter.ComparisonOperator.EqualsTo, False)) + whereClause2.AddFilter(filter2, CompoundFilter.CompoundingOperators.And_Operator) + + Try + ' Execute the query + Dim rc() As StatusRecord = StatusTable.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 StatusRecord = DirectCast(rc(0), StatusRecord) + ' Create the item and add to the list. + Dim cvalue As String = Nothing + Dim fvalue As String = Nothing + If itemValue.StatusIdSpecified Then + cvalue = itemValue.StatusId.ToString() + Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalIdTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalIdTable.StatusId) + If _isExpandableNonCompositeForeignKey AndAlso PersonalIdTable.StatusId.IsApplyDisplayAs Then + fvalue = PersonalIdTable.GetDFKA(itemValue, PersonalIdTable.StatusId) + End If + If (Not _isExpandableNonCompositeForeignKey) Or (String.IsNullOrEmpty(fvalue)) Then + fvalue = itemValue.Format(StatusTable.Status) + End If + + If fvalue Is Nothing OrElse fvalue.Trim() = "" Then fvalue = cvalue + Dim newItem As New ListItem(fvalue, cvalue) + Me.StatusId.Items.Add(newItem) + SetSelectedValue(Me.StatusId, selectedValue) + End If + End If + Catch + End Try + + End If + + + End Sub + + Protected Overridable Sub ArmId_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()(ArmId.ClientID & "_SelectedValue"), String) + Dim displayText As String = CType(Me.Page.Session()(ArmId.ClientID & "_SelectedDisplayText"), String) + If displayText <> "" AndAlso val <> "" Then + Me.ArmId.Items.Add(New ListItem(displayText, val)) + Me.ArmId.SelectedIndex = Me.ArmId.Items.Count - 1 + Me.Page.Session.Remove(ArmId.ClientID & "_SelectedValue") + Me.Page.Session.Remove(ArmId.ClientID & "_SelectedDisplayText") + End If + + + + + End Sub + + Protected Overridable Sub ArmyId_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()(ArmyId.ClientID & "_SelectedValue"), String) + Dim displayText As String = CType(Me.Page.Session()(ArmyId.ClientID & "_SelectedDisplayText"), String) + If displayText <> "" AndAlso val <> "" Then + Me.ArmyId.Items.Add(New ListItem(displayText, val)) + Me.ArmyId.SelectedIndex = Me.ArmyId.Items.Count - 1 + Me.Page.Session.Remove(ArmyId.ClientID & "_SelectedValue") + Me.Page.Session.Remove(ArmyId.ClientID & "_SelectedDisplayText") + End If + + + + + End Sub + + Protected Overridable Sub BloodId_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()(BloodId.ClientID & "_SelectedValue"), String) + Dim displayText As String = CType(Me.Page.Session()(BloodId.ClientID & "_SelectedDisplayText"), String) + If displayText <> "" AndAlso val <> "" Then + Me.BloodId.Items.Add(New ListItem(displayText, val)) + Me.BloodId.SelectedIndex = Me.BloodId.Items.Count - 1 + Me.Page.Session.Remove(BloodId.ClientID & "_SelectedValue") + Me.Page.Session.Remove(BloodId.ClientID & "_SelectedDisplayText") + End If + + + + + End Sub + + Protected Overridable Sub Born_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()(Born.ClientID & "_SelectedValue"), String) + Dim displayText As String = CType(Me.Page.Session()(Born.ClientID & "_SelectedDisplayText"), String) + If displayText <> "" AndAlso val <> "" Then + Me.Born.Items.Add(New ListItem(displayText, val)) + Me.Born.SelectedIndex = Me.Born.Items.Count - 1 + Me.Page.Session.Remove(Born.ClientID & "_SelectedValue") + Me.Page.Session.Remove(Born.ClientID & "_SelectedDisplayText") + End If + + + + + End Sub + + Protected Overridable Sub DeptId_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()(DeptId.ClientID & "_SelectedValue"), String) + Dim displayText As String = CType(Me.Page.Session()(DeptId.ClientID & "_SelectedDisplayText"), String) + If displayText <> "" AndAlso val <> "" Then + Me.DeptId.Items.Add(New ListItem(displayText, val)) + Me.DeptId.SelectedIndex = Me.DeptId.Items.Count - 1 + Me.Page.Session.Remove(DeptId.ClientID & "_SelectedValue") + Me.Page.Session.Remove(DeptId.ClientID & "_SelectedDisplayText") + End If + + + + + End Sub + + Protected Overridable Sub RankId_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()(RankId.ClientID & "_SelectedValue"), String) + Dim displayText As String = CType(Me.Page.Session()(RankId.ClientID & "_SelectedDisplayText"), String) + If displayText <> "" AndAlso val <> "" Then + Me.RankId.Items.Add(New ListItem(displayText, val)) + Me.RankId.SelectedIndex = Me.RankId.Items.Count - 1 + Me.Page.Session.Remove(RankId.ClientID & "_SelectedValue") + Me.Page.Session.Remove(RankId.ClientID & "_SelectedDisplayText") + End If + + + + + End Sub + + Protected Overridable Sub SectionId_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()(SectionId.ClientID & "_SelectedValue"), String) + Dim displayText As String = CType(Me.Page.Session()(SectionId.ClientID & "_SelectedDisplayText"), String) + If displayText <> "" AndAlso val <> "" Then + Me.SectionId.Items.Add(New ListItem(displayText, val)) + Me.SectionId.SelectedIndex = Me.SectionId.Items.Count - 1 + Me.Page.Session.Remove(SectionId.ClientID & "_SelectedValue") + Me.Page.Session.Remove(SectionId.ClientID & "_SelectedDisplayText") + End If + + + + + End Sub + + Protected Overridable Sub Sex_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()(Sex.ClientID & "_SelectedValue"), String) + Dim displayText As String = CType(Me.Page.Session()(Sex.ClientID & "_SelectedDisplayText"), String) + If displayText <> "" AndAlso val <> "" Then + Me.Sex.Items.Add(New ListItem(displayText, val)) + Me.Sex.SelectedIndex = Me.Sex.Items.Count - 1 + Me.Page.Session.Remove(Sex.ClientID & "_SelectedValue") + Me.Page.Session.Remove(Sex.ClientID & "_SelectedDisplayText") + End If + + + + + End Sub + + Protected Overridable Sub StatusId_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()(StatusId.ClientID & "_SelectedValue"), String) + Dim displayText As String = CType(Me.Page.Session()(StatusId.ClientID & "_SelectedDisplayText"), String) + If displayText <> "" AndAlso val <> "" Then + Me.StatusId.Items.Add(New ListItem(displayText, val)) + Me.StatusId.SelectedIndex = Me.StatusId.Items.Count - 1 + Me.Page.Session.Remove(StatusId.ClientID & "_SelectedValue") + Me.Page.Session.Remove(StatusId.ClientID & "_SelectedDisplayText") + End If + + + + + End Sub + + Protected Overridable Sub Addr_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub Amphur_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub ArmyWelfareMemId_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub BAmphur_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub BirthDate_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub BProvince_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub CremateMemId_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub MId_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub MobilePhone_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub Nationality_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub OfficerDate_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub Origin_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub PersonalId_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub PersonalLastName_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub PersonalName_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub Phone_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub PhoneExt_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub PlaceOfBirth_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub PostCode_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub Province_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub RegDate_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub RegNo1_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub RegNo2_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub Religion_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub TId_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + + Private _PreviousUIData As New Hashtable + Public Overridable Property PreviousUIData() As Hashtable + Get + Return _PreviousUIData + End Get + Set(ByVal value As Hashtable) + _PreviousUIData = value + End Set + End Property + + Private _IsNewRecord As Boolean = True + Public Overridable Property IsNewRecord() As Boolean + Get + Return Me._IsNewRecord + End Get + Set(ByVal value As Boolean) + Me._IsNewRecord = value + End Set + End Property + + Private _DataChanged As Boolean = False + Public Overridable Property DataChanged() As Boolean + Get + Return Me._DataChanged + End Get + Set(ByVal Value As Boolean) + Me._DataChanged = Value + End Set + End Property + + Private _ResetData As Boolean = False + Public Overridable Property ResetData() As Boolean + Get + Return Me._ResetData + End Get + Set(ByVal Value As Boolean) + Me._ResetData = Value + End Set + End Property + + Public Property RecordUniqueId() As String + Get + Return CType(Me.ViewState("BasePersonalIdRecordControl_Rec"), String) + End Get + Set(ByVal value As String) + Me.ViewState("BasePersonalIdRecordControl_Rec") = value + End Set + End Property + + Private _DataSource As PersonalIdRecord + Public Property DataSource() As PersonalIdRecord + Get + Return Me._DataSource + End Get + + Set(ByVal value As PersonalIdRecord) + + Me._DataSource = value + End Set + End Property + + + + Private _checkSum As String + Public Overridable Property CheckSum() As String + Get + Return Me._checkSum + End Get + Set(ByVal value As String) + Me._checkSum = value + End Set + End Property + + Private _TotalPages As Integer + Public Property TotalPages() As Integer + Get + Return Me._TotalPages + End Get + Set(ByVal value As Integer) + Me._TotalPages = value + End Set + End Property + + Private _PageIndex As Integer + Public Property PageIndex() As Integer + Get + ' Return the PageIndex + Return Me._PageIndex + End Get + Set(ByVal value As Integer) + Me._PageIndex = value + End Set + End Property + + Private _PageSize As Integer + Public Property PageSize() As Integer + Get + Return Me._PageSize + End Get + Set(ByVal value As Integer) + Me._PageSize = value + End Set + End Property + + Private _TotalRecords As Integer + Public Property TotalRecords() As Integer + Get + Return Me._TotalRecords + End Get + Set(ByVal value As Integer) + If Me.PageSize > 0 Then + Me.TotalPages = CInt(Math.Ceiling(value / Me.PageSize)) + End If + + Me._TotalRecords = value + End Set + End Property + + Private _DisplayLastPage As Boolean + Public Property DisplayLastPage() As Boolean + Get + Return Me._DisplayLastPage + End Get + Set(ByVal value As Boolean) + Me._DisplayLastPage = value + End Set + End Property + + + +#Region "Helper Properties" + + Public ReadOnly Property Addr() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Addr"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property AddrLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "AddrLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property Amphur() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Amphur"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property AmphurLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "AmphurLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property ArmId() As System.Web.UI.WebControls.DropDownList + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "ArmId"), System.Web.UI.WebControls.DropDownList) + End Get + End Property + + Public ReadOnly Property ArmIdLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "ArmIdLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property ArmyId() As System.Web.UI.WebControls.DropDownList + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "ArmyId"), System.Web.UI.WebControls.DropDownList) + End Get + End Property + + Public ReadOnly Property ArmyIdLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "ArmyIdLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property ArmyWelfareMemId() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "ArmyWelfareMemId"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property ArmyWelfareMemIdLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "ArmyWelfareMemIdLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property BAmphur() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "BAmphur"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property BAmphurLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "BAmphurLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property BirthDate() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "BirthDate"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property BirthDateLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "BirthDateLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property BloodId() As System.Web.UI.WebControls.DropDownList + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "BloodId"), System.Web.UI.WebControls.DropDownList) + End Get + End Property + + Public ReadOnly Property BloodIdLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "BloodIdLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property Born() As System.Web.UI.WebControls.DropDownList + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Born"), System.Web.UI.WebControls.DropDownList) + End Get + End Property + + Public ReadOnly Property BornLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "BornLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property BProvince() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "BProvince"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property BProvinceLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "BProvinceLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property CremateMemId() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "CremateMemId"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property CremateMemIdLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "CremateMemIdLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property DeptId() As System.Web.UI.WebControls.DropDownList + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "DeptId"), System.Web.UI.WebControls.DropDownList) + End Get + End Property + + Public ReadOnly Property DeptIdLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "DeptIdLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property MId() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "MId"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property MIdLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "MIdLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property MobilePhone() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "MobilePhone"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property MobilePhoneLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "MobilePhoneLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property Nationality() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Nationality"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property NationalityLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "NationalityLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property OfficerDate() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "OfficerDate"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property OfficerDateLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "OfficerDateLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property Origin() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Origin"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property OriginLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "OriginLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property PersonalId() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalId"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property PersonalIdLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalIdLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property PersonalIdRecordControlCollapsibleRegion() As System.Web.UI.WebControls.Panel + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalIdRecordControlCollapsibleRegion"), System.Web.UI.WebControls.Panel) + End Get + End Property + + Public ReadOnly Property PersonalIdRecordControlIcon() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalIdRecordControlIcon"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalIdRecordControlPanelExtender() As AjaxControlToolkit.CollapsiblePanelExtender + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalIdRecordControlPanelExtender"), AjaxControlToolkit.CollapsiblePanelExtender) + End Get + End Property + + Public ReadOnly Property PersonalIdTitle() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalIdTitle"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property PersonalLastName() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalLastName"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property PersonalLastNameLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalLastNameLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property PersonalName() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalName"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property PersonalNameLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalNameLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property Phone() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Phone"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property PhoneExt() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PhoneExt"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property PhoneExtLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PhoneExtLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property PhoneLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PhoneLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property picture() As System.Web.UI.WebControls.FileUpload + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "picture"), System.Web.UI.WebControls.FileUpload) + End Get + End Property + + Public ReadOnly Property pictureImage() As System.Web.UI.WebControls.Image + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "pictureImage"), System.Web.UI.WebControls.Image) + End Get + End Property + + Public ReadOnly Property pictureLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "pictureLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property PlaceOfBirth() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PlaceOfBirth"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property PlaceOfBirthLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PlaceOfBirthLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property PostCode() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PostCode"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property PostCodeLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PostCodeLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property Province() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Province"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property ProvinceLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "ProvinceLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property RankId() As System.Web.UI.WebControls.DropDownList + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RankId"), System.Web.UI.WebControls.DropDownList) + End Get + End Property + + Public ReadOnly Property RankIdLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RankIdLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property RegDate() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RegDate"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property RegDateLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RegDateLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property RegNo1() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RegNo1"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property RegNo1Label() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RegNo1Label"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property RegNo2() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RegNo2"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property RegNo2Label() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RegNo2Label"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property Religion() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Religion"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property ReligionLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "ReligionLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property SectionId() As System.Web.UI.WebControls.DropDownList + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "SectionId"), System.Web.UI.WebControls.DropDownList) + End Get + End Property + + Public ReadOnly Property SectionIdLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "SectionIdLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property Sex() As System.Web.UI.WebControls.DropDownList + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Sex"), System.Web.UI.WebControls.DropDownList) + End Get + End Property + + Public ReadOnly Property SexLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "SexLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property StatusId() As System.Web.UI.WebControls.DropDownList + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "StatusId"), System.Web.UI.WebControls.DropDownList) + End Get + End Property + + Public ReadOnly Property StatusIdLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "StatusIdLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property TId() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "TId"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property TIdLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "TIdLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + +#End Region + +#Region "Helper Functions" + + Public Overrides Overloads Function ModifyRedirectUrl(ByVal url As String, ByVal arg As String, ByVal bEncrypt As Boolean) As String + Return Me.Page.EvaluateExpressions(url, arg, bEncrypt, Me) + End Function + + Public Overrides Overloads Function EvaluateExpressions(ByVal url As String, ByVal arg As String, ByVal bEncrypt As Boolean) As String + + Dim rec As PersonalIdRecord = Nothing + + + Try + rec = Me.GetRecord() + Catch ex As Exception + ' Do nothing + End Try + + If rec Is Nothing AndAlso url.IndexOf("{") >= 0 Then + ' Localization. + + Throw New Exception(Page.GetResourceValue("Err:RecDataSrcNotInitialized", "Persons")) + + End If + Return EvaluateExpressions(url, arg, rec, bEncrypt) + End Function + + + Public Overridable Function GetRecord() As PersonalIdRecord + If Not Me.DataSource Is Nothing Then + Return Me.DataSource + End If + + If Not Me.RecordUniqueId Is Nothing Then + + Return PersonalIdTable.GetRecord(Me.RecordUniqueId, True) + + End If + + ' Localization. + + 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 + + \ No newline at end of file diff --git a/App_Code/PersonalId/EditPersonalId1.Controls.vb b/App_Code/PersonalId/EditPersonalId1.Controls.vb new file mode 100644 index 0000000..12b1361 --- /dev/null +++ b/App_Code/PersonalId/EditPersonalId1.Controls.vb @@ -0,0 +1,6995 @@ + +' This file implements the TableControl, TableControlRow, and RecordControl classes for the +' EditPersonalId1.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 + +Imports CrPdf + +#End Region + + +Namespace Persons.UI.Controls.EditPersonalId1 + +#Region "Section 1: Place your customizations here." + + + Public Class PersonalIdRecordControl + Inherits BasePersonalIdRecordControl + ' The BasePersonalIdRecordControl implements the LoadData, DataBind and other + ' methods to load and display the data in a table control. + + Protected Overrides Sub PopulateRankIdDropDownList( _ + ByVal selectedValue As String, _ + ByVal maxItems As Integer) + + ' Populate the RankIdDropDownList with the + ' foreign key values from the Rank table. + + ' This is a four step process. + ' 1. Set up the WHERE and the ORDER BY clause to read from the Rank. + ' 2. Read a total of maxItems from the database and insert them into the RankIdDropDownList. + ' 3. Set the selected value (insert if not already present). + ' 4. Insert the language specific "Please Select" item at the top. + + ' 1. Set up the WHERE and the ORDER BY clause by calling the CreateWhereClause_RankIdDropDownList function. + ' It is better to customize the where clause there. + Dim wc As WhereClause = CreateWhereClause_RankIdDropDownList() + wc.iAND(RankTable.RankId, BaseFilter.ComparisonOperator.Less_Than, "61") + wc.iOR(RankTable.RankId, BaseFilter.ComparisonOperator.Greater_Than, "69") + + Dim orderBy As OrderBy = New OrderBy(False, True) + orderBy.Add(RankTable.ArmyId, OrderByItem.OrderDir.Asc) + orderBy.Add(RankTable.RankId, OrderByItem.OrderDir.Asc) + + ' 2. Read a total of maxItems from the database and insert them into the RankIdDropDownList. + Me.RankId.Items.Clear() + Dim itemValue As RankRecord + For Each itemValue In RankTable.GetRecords(wc, orderBy, 0, maxItems) + ' Create the item and add to the list. + Dim cvalue As String = Nothing + Dim fvalue As String = Nothing + If itemValue.RankIdSpecified Then + cvalue = itemValue.RankId.ToString() + fvalue = itemValue.Format(RankTable.ArmyId) & " - " & itemValue.Format(RankTable.RankName) + End If + + Dim item As ListItem = New ListItem(fvalue, cvalue) + Me.RankId.Items.Add(item) + Next + + ' 3. Set the selected value (insert if not already present). + If Not selectedValue Is Nothing AndAlso _ + selectedValue.Trim <> "" AndAlso _ + Not SetSelectedValue(Me.RankId, selectedValue) AndAlso _ + Not MiscUtils.SetSelectedValue(Me.RankId, PersonalIdTable.RankId.Format(selectedValue)) Then + Dim fvalue As String = PersonalIdTable.RankId.Format(selectedValue) + Dim item As ListItem = New ListItem(fvalue, selectedValue) + item.Selected = True + Me.RankId.Items.Insert(0, item) + End If + + + ' 4. Insert the language specific "Please Select" item at the top. + Me.RankId.Items.Insert(0, New ListItem(Page.GetResourceValue("Txt:PleaseSelect", "Persons"), "--PLEASE_SELECT--")) + + End Sub + + Protected Overrides Sub PopulateArmIdDropDownList( _ + ByVal selectedValue As String, _ + ByVal maxItems As Integer) + + ' Populate the ArmIdDropDownList with the + ' foreign key values from the Arm table. + + ' This is a four step process. + ' 1. Set up the WHERE and the ORDER BY clause to read from the Arm. + ' 2. Read a total of maxItems from the database and insert them into the ArmIdDropDownList. + ' 3. Set the selected value (insert if not already present). + ' 4. Insert the language specific "Please Select" item at the top. + + ' 1. Set up the WHERE and the ORDER BY clause by calling the CreateWhereClause_ArmIdDropDownList function. + ' It is better to customize the where clause there. + Dim wc As WhereClause = CreateWhereClause_ArmIdDropDownList() + ' wc.iAND (PersonalIdTable .ArmyId ,BaseFilter.ComparisonOperator.EqualsTo ,Me.ArmyId .Text + Dim orderBy As OrderBy = New OrderBy(False, True) + orderBy.Add(ArmTable.ArmId, OrderByItem.OrderDir.Asc) + + ' 2. Read a total of maxItems from the database and insert them into the ArmIdDropDownList. + Me.ArmId.Items.Clear() + Dim itemValue As ArmRecord + For Each itemValue In ArmTable.GetRecords(wc, orderBy, 0, maxItems) + ' Create the item and add to the list. + Dim cvalue As String = Nothing + Dim fvalue As String = Nothing + If itemValue.ArmIdSpecified Then + cvalue = itemValue.ArmId.ToString() + fvalue = itemValue.Format(ArmTable.ArmyId) & " - " & itemValue.Format(ArmTable.ArmName) + End If + + Dim item As ListItem = New ListItem(fvalue, cvalue) + Me.ArmId.Items.Add(item) + Next + + ' 3. Set the selected value (insert if not already present). + If Not selectedValue Is Nothing AndAlso _ + selectedValue.Trim <> "" AndAlso _ + Not SetSelectedValue(Me.ArmId, selectedValue) AndAlso _ + Not MiscUtils.SetSelectedValue(Me.ArmId, PersonalIdTable.ArmId.Format(selectedValue)) Then + Dim fvalue As String = PersonalIdTable.ArmId.Format(selectedValue) + Dim item As ListItem = New ListItem(fvalue, selectedValue) + item.Selected = True + Me.ArmId.Items.Insert(0, item) + End If + + + ' 4. Insert the language specific "Please Select" item at the top. + Me.ArmId.Items.Insert(0, New ListItem(Page.GetResourceValue("Txt:PleaseSelect", "Persons"), "--PLEASE_SELECT--")) + + + + End Sub + + + Private Sub PersonalIdRecordControl_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load + AddHandler Me.PersonalId.TextChanged, AddressOf PersonalId_TextChanged + + End Sub + + Private Sub PersonalId_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) + 'update PersonalId + ' Ps.ChingePID(Me.DataSource.PersonalId, Me.PersonalId.Text) + 'Me.DataChanged = True + + Try + DbUtils.StartTransaction() + Dim Rec As PersonalIdRecord = Me.GetRecord + If Me.PersonalId.Text <> Rec.PersonalId Then + If Ps.IsPid(Me.PersonalId.Text) Then + Ps.ChingePID(Rec.PersonalId, Me.PersonalId.Text) + DbUtils.CommitTransaction() + 'Me.Page.CurrentSecurity.SetUser(Me.PersonalName.Text, Me.PersonalId.Text) + Me.Page.RedirectToLoginPage() + 'SaveData() + Else + Throw New ApplicationException("กรอกรหัสประจำตัวประชาชนไม่ถูกต้อง") + 'MiscUtils.RegisterJScriptAlert(Me, "", "กรอกรหัสประจำตัวประชาชนไม่ถูกต้อง") + End If + End If + DbUtils.CommitTransaction() + Catch ex As ApplicationException + MiscUtils.RegisterJScriptAlert(Me, "", ex.Message) + End Try + + + End Sub + + Public Overrides Sub SaveData() + 'Dim Rec As PersonalIdRecord = Me.GetRecord + If Ps.IsPid(Me.PersonalId.Text) Then + ' Me.Page.RedirectToLoginPage() + MyBase.SaveData() + 'Me.Page.CurrentSecurity.SetUser(Me.PersonalName.Text, Me.PersonalId.Text) + 'Me.Page.RedirectToLoginPage() + 'Utils.SecurityControls.SetCurrentUserID(Me.PersonalId.Text) + 'Me.Page.RedirectToDefaultPage() + Else + 'Throw New Exception("กรอกรหัสประจำตัวประชาชนไม่ถูกต้อง") + Throw New ApplicationException("กรอกรหัสประจำตัวประชาชนไม่ถูกต้อง") + 'MiscUtils.RegisterJScriptAlert(Me, "", "กรอกรหัสประจำตัวประชาชนไม่ถูกต้อง") + End If + + 'MyBase.SaveData() + + End Sub + + Protected Overrides Sub PopulateDeptIdDropDownList( _ + ByVal selectedValue As String, _ + ByVal maxItems As Integer) + + ' Populate the DeptIdDropDownList with the + ' foreign key values from the Dept table. + + ' This is a four step process. + ' 1. Set up the WHERE and the ORDER BY clause to read from the Dept. + ' 2. Read a total of maxItems from the database and insert them into the DeptIdDropDownList. + ' 3. Set the selected value (insert if not already present). + ' 4. Insert the language specific "Please Select" item at the top. + + ' 1. Set up the WHERE and the ORDER BY clause by calling the CreateWhereClause_DeptIdDropDownList function. + ' It is better to customize the where clause there. + Dim wc As WhereClause = CreateWhereClause_DeptIdDropDownList() + Dim orderBy As OrderBy = New OrderBy(False, True) + orderBy.Add(DeptTable.SectionId, OrderByItem.OrderDir.Asc) + orderBy.Add(DeptTable.Dept, OrderByItem.OrderDir.Asc) + + ' 2. Read a total of maxItems from the database and insert them into the DeptIdDropDownList. + Me.DeptId.Items.Clear() + Dim itemValue As DeptRecord + For Each itemValue In DeptTable.GetRecords(wc, orderBy, 0, maxItems) + ' Create the item and add to the list. + Dim cvalue As String = Nothing + Dim fvalue As String = Nothing + If itemValue.DeptIdSpecified Then + cvalue = itemValue.DeptId.ToString() + fvalue = itemValue.Format(DeptTable.SectionId) & " - " & itemValue.Format(DeptTable.Dept) + End If + + Dim item As ListItem = New ListItem(fvalue, cvalue) + Me.DeptId.Items.Add(item) + Next + + ' 3. Set the selected value (insert if not already present). + If Not selectedValue Is Nothing AndAlso _ + selectedValue.Trim <> "" AndAlso _ + Not SetSelectedValue(Me.DeptId, selectedValue) AndAlso _ + Not MiscUtils.SetSelectedValue(Me.DeptId, PersonalIdTable.DeptId.Format(selectedValue)) Then + Dim fvalue As String = PersonalIdTable.DeptId.Format(selectedValue) + Dim item As ListItem = New ListItem(fvalue, selectedValue) + item.Selected = True + Me.DeptId.Items.Insert(0, item) + End If + + + ' 4. Insert the language specific "Please Select" item at the top. + Me.DeptId.Items.Insert(0, New ListItem(Page.GetResourceValue("Txt:PleaseSelect", "Persons"), "--PLEASE_SELECT--")) + + End Sub + +' Public Overrides Sub View_PersonsPDFButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) +' +' Try +' +' Dim cls As New CrPdf +' cls.GetCr(Me.Page, "report1.rpt", "Pid", Me.PersonalId.Text) +' +' Catch ex As Exception +' Me.Page.ErrorOnPage = True +' +' ' Report the error message to the end user +' Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) +' Finally +' +' End Try +' +' End Sub + + + + + End Class + + + +Public Class ReportPropertiesTableControl + Inherits BaseReportPropertiesTableControl + + Public Overrides Sub ReportPropertiesPDFButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + Try + Dim PID As TextBox = CType(Me.Page.FindControlRecursively("PersonalId"), TextBox) + Dim cr As New CrPdf + Dim param(0) As String + param(0) = "PID," & PID.Text ' Utils.SecurityControls.GetCurrentUserID + cr.GetCr(Me, "../Reports/Person_Record.rpt", param) + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + Finally + + End Try + + End Sub + Public Overrides Sub ReportPropertiesWordButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + Try + Dim PID As TextBox = CType(Me.Page.FindControlRecursively("PersonalId"), TextBox) + Dim cr As New CrPdf + Dim param(0) As String + param(0) = "PID," & PID.Text ' Utils.SecurityControls.GetCurrentUserID + cr.GetCr(Me, "../Reports/Person_Record.rpt", param, 3) + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + Finally + + End Try + + End Sub + Public Overrides Sub ReportPropertiesExportExcelButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + Try + Dim PID As TextBox = CType(Me.Page.FindControlRecursively("PersonalId"), TextBox) + Dim cr As New CrPdf + Dim param(0) As String + param(0) = "PID," & PID.Text ' Utils.SecurityControls.GetCurrentUserID + cr.GetCr(Me, "../Reports/Person_Record.rpt", param, 2) + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + Finally + + End Try + End Sub + + Public Overrides Sub SaveData() + ' do Nothing + End Sub + + + End Class +Public Class ReportPropertiesTableControlRow + Inherits BaseReportPropertiesTableControlRow + + + +End Class +#End Region + + + +#Region "Section 2: Do not modify this section." + + +' Base class for the ReportPropertiesTableControlRow control on the EditPersonalId1 page. +' Do not modify this class. Instead override any method in ReportPropertiesTableControlRow. +Public Class BaseReportPropertiesTableControlRow + Inherits Persons.UI.BaseApplicationRecordControl + + ' To customize, override this method in ReportPropertiesTableControlRow. + Protected Overridable Sub Control_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Init + + Me.ClearControlsFromSession() + End Sub + + ' To customize, override this method in ReportPropertiesTableControlRow. + Protected Overridable Sub Control_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load + + 'Call LoadFocusScripts from repeater so that onfocus attribute could be added to elements + Me.Page.LoadFocusScripts(Me) + + + ' Register the event handlers. + + + End Sub + + + Public Overridable Sub LoadData() + + ' Load the data from the database into the DataSource ReportProperties 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 = ReportPropertiesTable.GetRecord(Me.RecordUniqueId, True) + + Return + End If + + ' Since this is a row in the table, the data for this row is loaded by the + ' LoadData method of the BaseReportPropertiesTableControl when the data for the entire + ' table is loaded. + + Me.DataSource = New ReportPropertiesRecord() + + + + End Sub + + ' Populate the UI controls using the DataSource. To customize, override this method in ReportPropertiesTableControlRow. + 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 + + + + 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 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 ReportPropertiesTableControlRow. + Public Overridable Sub SaveData() + ' Saves the associated record in the database. + ' SaveData calls Validate and Get methods - so it may be more appropriate to + ' customize those methods. + + ' 1. Load the existing record from the database. Since we save the entire record, this ensures + ' that fields that are not displayed are also properly initialized. + Me.LoadData() + + + ' 2. Perform any custom validation. + Me.Validate() + + + ' 3. Set the values in the record with data from UI controls. + ' This calls the Get() method for each of the user interface controls. + Me.GetUIData() + + ' 4. Save in the database. + ' We should not save the record if the data did not change. This + ' will save a database hit and avoid triggering any database triggers. + + If Me.DataSource.IsAnyValueChanged Then + ' Save record to database but do not commit yet. + ' Auto generated ids are available after saving for use by child (dependent) records. + Me.DataSource.Save() + + DirectCast(GetParentControlObject(Me, "ReportPropertiesTableControl"), ReportPropertiesTableControl).DataChanged = True + DirectCast(GetParentControlObject(Me, "ReportPropertiesTableControl"), ReportPropertiesTableControl).ResetData = True + End If + + + ' update session or cookie by formula + + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + ' For Master-Detail relationships, save data on the Detail table(s) + + End Sub + + ' To customize, override this method in ReportPropertiesTableControlRow. + 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. + + End Sub + + + + ' To customize, override this method in ReportPropertiesTableControlRow. + + Public Overridable Function CreateWhereClause() As WhereClause + + Return Nothing + + End Function + + + + ' To customize, override this method in ReportPropertiesTableControlRow. + 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) + ReportPropertiesTable.DeleteRecord(pkValue) + + DirectCast(GetParentControlObject(Me, "ReportPropertiesTableControl"), ReportPropertiesTableControl).DataChanged = True + DirectCast(GetParentControlObject(Me, "ReportPropertiesTableControl"), ReportPropertiesTableControl).ResetData = True + End Sub + + Protected Overridable Sub Control_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.PreRender + ' PreRender event is raised just before page is being displayed. + Try + DbUtils.StartTransaction() + Me.RegisterPostback() + + If Not Me.Page.ErrorOnPage AndAlso (Me.Page.IsPageRefresh OrElse Me.DataChanged OrElse Me.ResetData) Then + + + ' Re-load the data and update the web page if necessary. + ' This is typically done during a postback (filter, search button, sort, pagination button). + ' In each of the other click handlers, simply set DataChanged to True to reload the data. + Me.LoadData() + Me.DataBind() + End If + + + Catch ex As Exception + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + Finally + DbUtils.EndTransaction() + End Try + End Sub + + + Protected Overrides Sub SaveControlsToSession() + MyBase.SaveControlsToSession() + + + 'Save pagination state to session. + + End Sub + + + + Protected Overrides Sub ClearControlsFromSession() + MyBase.ClearControlsFromSession() + + + + ' Clear pagination state from session. + + End Sub + + Protected Overrides Sub LoadViewState(ByVal savedState As Object) + MyBase.LoadViewState(savedState) + Dim isNewRecord As String = CType(ViewState("IsNewRecord"), String) + If Not isNewRecord Is Nothing AndAlso isNewRecord.Trim <> "" Then + Me.IsNewRecord = Boolean.Parse(isNewRecord) + End If + + Dim myCheckSum As String = CType(ViewState("CheckSum"), String) + If Not myCheckSum Is Nothing AndAlso myCheckSum.Trim <> "" Then + Me.CheckSum = myCheckSum + End If + + + ' Load view state for pagination control. + + End Sub + + Protected Overrides Function SaveViewState() As Object + ViewState("IsNewRecord") = Me.IsNewRecord.ToString() + ViewState("CheckSum") = Me.CheckSum + + + ' Load view state for pagination control. + + Return MyBase.SaveViewState() + End Function + + + + 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("BaseReportPropertiesTableControlRow_Rec"), String) + End Get + Set(ByVal value As String) + Me.ViewState("BaseReportPropertiesTableControlRow_Rec") = value + End Set + End Property + + Private _DataSource As ReportPropertiesRecord + Public Property DataSource() As ReportPropertiesRecord + Get + Return Me._DataSource + End Get + + Set(ByVal value As ReportPropertiesRecord) + + Me._DataSource = value + End Set + End Property + + + + Private _checkSum As String + Public Overridable Property CheckSum() As String + Get + Return Me._checkSum + End Get + Set(ByVal value As String) + Me._checkSum = value + End Set + End Property + + Private _TotalPages As Integer + Public Property TotalPages() As Integer + Get + Return Me._TotalPages + End Get + Set(ByVal value As Integer) + Me._TotalPages = value + End Set + End Property + + Private _PageIndex As Integer + Public Property PageIndex() As Integer + Get + ' Return the PageIndex + Return Me._PageIndex + End Get + Set(ByVal value As Integer) + Me._PageIndex = value + End Set + End Property + + Private _DisplayLastPage As Boolean + Public Property DisplayLastPage() As Boolean + Get + Return Me._DisplayLastPage + End Get + Set(ByVal value As Boolean) + Me._DisplayLastPage = value + End Set + End Property + + + +#Region "Helper Properties" + +#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 ReportPropertiesRecord = 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 ReportPropertiesRecord + If Not Me.DataSource Is Nothing Then + Return Me.DataSource + End If + + If Not Me.RecordUniqueId Is Nothing Then + + Return ReportPropertiesTable.GetRecord(Me.RecordUniqueId, True) + + End If + + ' Localization. + + Throw New Exception(Page.GetResourceValue("Err:RetrieveRec", "Persons")) + + End Function + + Public Shadows ReadOnly Property Page() As BaseApplicationPage + Get + Return DirectCast(MyBase.Page, BaseApplicationPage) + End Get + End Property + +#End Region + +End Class + + + +' Base class for the ReportPropertiesTableControl control on the EditPersonalId1 page. +' Do not modify this class. Instead override any method in ReportPropertiesTableControl. +Public Class BaseReportPropertiesTableControl + Inherits Persons.UI.BaseApplicationTableControl + + + + Protected Overridable Sub Control_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Init + + + + ' Setup the filter and search events. + + + + ' Control Initializations. + ' Initialize the table's current sort order. + + If Me.InSession(Me, "Order_By") Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + End If + + + + ' Setup default pagination settings. + + Me.PageSize = CInt(Me.GetFromSession(Me, "Page_Size", "10")) + Me.PageIndex = CInt(Me.GetFromSession(Me, "Page_Index", "0")) + + + + Me.ClearControlsFromSession() + End Sub + + Protected Overridable Sub Control_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load + + SaveControlsToSession_Ajax() + + ' Setup the pagination events. + + + ' Setup the sorting events. + + ' Setup the button events. + + AddHandler Me.ReportPropertiesExportExcelButton.Click, AddressOf ReportPropertiesExportExcelButton_Click + + AddHandler Me.ReportPropertiesPDFButton.Click, AddressOf ReportPropertiesPDFButton_Click + + AddHandler Me.ReportPropertiesWordButton.Click, AddressOf ReportPropertiesWordButton_Click + + + ' Setup events for others + + End Sub + + + Public Overridable Sub LoadData() + + ' Read data from database. Returns an array of records that can be assigned + ' to the DataSource table control property. + Try + Dim joinFilter As CompoundFilter = CreateCompoundJoinFilter() + + ' The WHERE clause will be empty when displaying all records in table. + Dim wc As WhereClause = CreateWhereClause() + If wc IsNot Nothing AndAlso Not wc.RunQuery Then + ' Initialize an empty array of records + Dim alist As New ArrayList(0) + Me.DataSource = DirectCast(alist.ToArray(GetType(ReportPropertiesRecord)), ReportPropertiesRecord()) + ' Add records to the list if needed. + Me.AddNewRecords() + Me._TotalRecords = 0 + Me._TotalPages = 0 + Return + End If + + ' Call OrderBy to determine the order - either use the order defined + ' on the Query Wizard, or specified by user (by clicking on column heading) + Dim orderBy As OrderBy = CreateOrderBy() + + ' Get the pagesize from the pagesize control. + Me.GetPageSize() + + If Me.DisplayLastPage Then + Dim totalRecords As Integer = If(Me._TotalRecords < 0, ReportPropertiesTable.GetRecordCount(CreateCompoundJoinFilter(), CreateWhereClause()), Me._TotalRecords) + + Dim totalPages As Integer = CInt(Math.Ceiling(totalRecords / Me.PageSize)) + + Me.PageIndex = totalPages - 1 + End If + + ' Make sure PageIndex (current page) and PageSize are within bounds. + If Me.PageIndex < 0 Then + Me.PageIndex = 0 + End If + If Me.PageSize < 1 Then + Me.PageSize = 1 + End If + + ' Retrieve the records and set the table DataSource. + ' Only PageSize records are fetched starting at PageIndex (zero based). + If Me.AddNewRecord > 0 Then + ' Make sure to preserve the previously entered data on new rows. + Dim postdata As New ArrayList + For Each rc As ReportPropertiesTableControlRow In Me.GetRecordControls() + If Not rc.IsNewRecord Then + rc.DataSource = rc.GetRecord() + rc.GetUIData() + postdata.Add(rc.DataSource) + UIData.Add(rc.PreservedUIData()) + End If + Next + Me.DataSource = DirectCast(postdata.ToArray(GetType(ReportPropertiesRecord)), ReportPropertiesRecord()) + Else ' Get the records from the database + Me.DataSource = ReportPropertiesTable.GetRecords(joinFilter, wc, orderBy, Me.PageIndex, Me.PageSize) + + End If + + ' if the datasource contains no records contained in database, then load the last page. + If (DbUtils.GetCreatedRecords(Me.DataSource).Length = 0 AndAlso Not Me.DisplayLastPage) Then + Me.DisplayLastPage = True + LoadData() + Else + + ' Add any new rows desired by the user. + Me.AddNewRecords() + + + ' Initialize the page and grand totals. now + + End If + + Catch ex As Exception + ' Report the error message to the end user + Dim msg As String = ex.Message + If ex.InnerException IsNot Nothing Then + msg = msg & " InnerException: " & ex.InnerException.Message + End If + Throw New Exception(msg, ex.InnerException) + End Try + End Sub + + + + + Public Overrides Sub DataBind() + ' The DataBind method binds the user interface controls to the values + ' from the database record for each row in the table. To do this, it calls the + ' DataBind for each of the rows. + ' DataBind also populates any filters above the table, and sets the pagination + ' control to the correct number of records and the current page number. + + MyBase.DataBind() + + ' Make sure that the DataSource is initialized. + If Me.DataSource Is Nothing Then + Return + End If + + 'LoadData for DataSource for chart and report if they exist + + ' Setup the pagination controls. + BindPaginationControls() + + + + ' Bind the repeater with the list of records to expand the UI. + Dim rep As System.Web.UI.WebControls.Repeater = CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "ReportPropertiesTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return + rep.DataSource = DataSource() + rep.DataBind() + + Dim index As Integer = 0 + For Each repItem As System.Web.UI.WebControls.RepeaterItem In rep.Items + ' Loop through all rows in the table, set its DataSource and call DataBind(). + Dim recControl As ReportPropertiesTableControlRow = DirectCast(repItem.FindControl("ReportPropertiesTableControlRow"), ReportPropertiesTableControlRow) + recControl.DataSource = Me.DataSource(index) + If Me.UIData.Count > index Then + recControl.PreviousUIData = Me.UIData(index) + End If + recControl.DataBind() + recControl.Visible = Not Me.InDeletedRecordIds(recControl) + + index += 1 + Next + + + + + ' Call the Set methods for each controls on the panel + + + + SetReportPropertiesTableControlCollapsibleRegion() + + ' setting the state of expand or collapse alternative rows + + + ' Load data for each record and table UI control. + ' Ordering is important because child controls get + ' their parent ids from their parent UI controls. + + + ' this method calls the set method for controls with special formula like running total, sum, rank, etc + SetFormulaControls() + End Sub + + Public Overridable Sub SetFormulaControls() + ' this method calls Set methods for the control that has special formula + + + + End Sub + + + + Public Overridable Sub RegisterPostback() + + Me.Page.RegisterPostBackTrigger(MiscUtils.FindControlRecursively(Me,"ReportPropertiesExportExcelButton")) + + Me.Page.RegisterPostBackTrigger(MiscUtils.FindControlRecursively(Me,"ReportPropertiesPDFButton")) + + Me.Page.RegisterPostBackTrigger(MiscUtils.FindControlRecursively(Me,"ReportPropertiesWordButton")) + + + End Sub + + Public EvaluateFormulaDelegate As BaseClasses.Data.DataSource.EvaluateFormulaDelegate = New BaseClasses.Data.DataSource.EvaluateFormulaDelegate(AddressOf Me.EvaluateFormula) + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean, ByVal e as FormulaEvaluator) As String + If e Is Nothing + e = New FormulaEvaluator() + End If + + e.Variables.Clear() + + + ' add variables for formula evaluation + If variables IsNot Nothing Then + Dim enumerator As System.Collections.Generic.IEnumerator(Of System.Collections.Generic.KeyValuePair(Of String, Object)) = variables.GetEnumerator() + While enumerator.MoveNext() + e.Variables.Add(enumerator.Current.Key, enumerator.Current.Value) + End While + End If + + If includeDS + + End If + + ' All variables referred to in the formula are expected to be + ' properties of the DataSource. For example, referring to + ' UnitPrice as a variable will refer to DataSource.UnitPrice + e.DataSource = dataSourceForEvaluate + + ' Define the calling control. This is used to add other + ' related table and record controls as variables. + e.CallingControl = Me + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + + If Not String.IsNullOrEmpty(format) AndAlso (String.IsNullOrEmpty(formula) OrElse formula.IndexOf("Format(") < 0) Then + Return FormulaUtils.Format(resultObj, format) + Else + Return resultObj.ToString() + End If + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format,variables ,includeDS, Nothing) + End Function + + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object)) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format, variables ,True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, format, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal e as FormulaEvaluator) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, variables, True, e) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal includeDS as Boolean) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, includeDS, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, True, Nothing) + End Function + + + + + Public Overridable Sub ResetControl() + + Me.CurrentSortOrder.Reset() + If (Me.InSession(Me, "Order_By")) Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + End If + + Me.PageIndex = 0 + End Sub + + Protected Overridable Sub BindPaginationControls() + ' Setup the pagination controls. + + ' Bind the pagination labels. + + + ' Bind the buttons for ReportPropertiesTableControl pagination. + + + + End Sub + + Public Overridable Sub SaveData() + ' Save the data from the entire table. Calls each row's Save Data + ' to save their data. This function is called by the Click handler of the + ' Save button. The button handler should Start/Commit/End a transaction. + + Dim recCtl As ReportPropertiesTableControlRow + For Each recCtl In Me.GetRecordControls() + + If Me.InDeletedRecordIds(recCtl) Then + ' Delete any pending deletes. + recCtl.Delete() + Else + If recCtl.Visible Then + recCtl.SaveData() + End If + End If + + Next + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + ' Set IsNewRecord to False for all records - since everything has been saved and is no longer "new" + For Each recCtl In Me.GetRecordControls() + recCtl.IsNewRecord = False + Next + + + ' Set DeletedRecordsIds to Nothing since we have deleted all pending deletes. + Me.DeletedRecordIds = Nothing + + End Sub + + Public Overridable Function CreateCompoundJoinFilter() As CompoundFilter + Dim jFilter As CompoundFilter = New CompoundFilter() + + Return jFilter + + End Function + + + Public Overridable Function CreateOrderBy() As OrderBy + ' The CurrentSortOrder is initialized to the sort order on the + ' Query Wizard. It may be modified by the Click handler for any of + ' the column heading to sort or reverse sort by that column. + ' You can add your own sort order, or modify it on the Query Wizard. + Return Me.CurrentSortOrder + End Function + + Public Overridable Function CreateWhereClause() As WhereClause + 'This CreateWhereClause is used for loading the data. + ReportPropertiesTable.Instance.InnerFilter = Nothing + Dim wc As WhereClause = New WhereClause() + + ' Compose the WHERE clause consiting of: + ' 1. Static clause defined at design time. + ' 2. User selected search criteria. + ' 3. User selected filter criteria. + + + Return wc + End Function + + + Public Overridable Function CreateWhereClause(ByVal searchText as String, ByVal fromSearchControl as String, ByVal AutoTypeAheadSearch as String, ByVal AutoTypeAheadWordSeparators as String) As WhereClause + ' This CreateWhereClause is used for loading list of suggestions for Auto Type-Ahead feature. + ReportPropertiesTable.Instance.InnerFilter = Nothing + Dim wc As WhereClause = New WhereClause() + + ' Compose the WHERE clause consiting of: + ' 1. Static clause defined at design time. + ' 2. User selected search criteria. + ' 3. User selected filter criteria. + + Dim appRelativeVirtualPath As String = CType(HttpContext.Current.Session("AppRelativeVirtualPath"), String) + + ' Adds clauses if values are selected in Filter controls which are configured in the page. + + + Return wc + End Function + + + Public Overridable Function FormatSuggestions(ByVal prefixText As String, ByVal resultItem As String, _ + ByVal columnLength As Integer, ByVal AutoTypeAheadDisplayFoundText As String, _ + ByVal autoTypeAheadSearch As String, ByVal AutoTypeAheadWordSeparators As String, _ + ByVal resultList As ArrayList) As Boolean + + 'Formats the resultItem and adds it to the list of suggestions. + Dim index As Integer = resultItem.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture).IndexOf(prefixText.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture)) + Dim itemToAdd As String = "" + Dim isFound As Boolean = False + Dim isAdded As Boolean = False + ' Get the index where prfixt is at the beginning of resultItem. If not found then, index of word which begins with prefixText. + If InvariantLCase(autoTypeAheadSearch).equals("wordsstartingwithsearchstring") And Not index = 0 Then + ' Expression to find word which contains AutoTypeAheadWordSeparators followed by prefixText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex( AutoTypeAheadWordSeparators + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + If regex1.IsMatch(resultItem) Then + index = regex1.Match(resultItem).Index + isFound = True + End If + ' If the prefixText is found immediatly after white space then starting of the word is found so don not search any further + If not resultItem(index).ToString() = " " Then + ' Expression to find beginning of the word which contains AutoTypeAheadWordSeparators followed by prefixText + Dim regex As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\\S*" + AutoTypeAheadWordSeparators + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + If regex.IsMatch(resultItem) Then + index = regex.Match(resultItem).Index + isFound = True + End If + End If + End If + + ' If autoTypeAheadSearch value is wordsstartingwithsearchstring then, extract the substring only if the prefixText is found at the + ' beginning of the resultItem (index = 0) or a word in resultItem is found starts with prefixText. + If index = 0 Or isFound Or InvariantLCase(autoTypeAheadSearch).Equals("anywhereinstring") then + If InvariantLCase(AutoTypeAheadDisplayFoundText).equals("atbeginningofmatchedstring") Then + ' Expression to find beginning of the word which contains prefixText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\\S*" + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + ' Find the beginning of the word which contains prefexText + If (StringUtils.InvariantLCase(autoTypeAheadSearch).Equals("anywhereinstring") AndAlso regex1.IsMatch(resultItem)) Then + index = regex1.Match(resultItem).Index + isFound = True + End If + ' Display string from the index till end of the string if sub string from index till end is less than columnLength value. + If Len(resultItem) - index <= columnLength Then + If index = 0 Then + itemToAdd = resultItem + Else + itemToAdd = "..." & resultItem.Substring(index, Len(resultItem) - index) + End If + Else + If index = 0 Then + itemToAdd = resultItem.Substring(index, (columnLength - 3)) & "..." + Else + 'Truncate the string to show only columnLength - 6 characters as begining and trailing "..." has to be appended. + itemToAdd = "..." & resultItem.Substring(index , columnLength - 6) & "..." + End If + End If + ElseIf InvariantLCase(AutoTypeAheadDisplayFoundText).equals("inmiddleofmatchedstring") Then + Dim subStringBeginIndex As Integer = CType(columnLength/2, Integer) + If Len(resultItem) <= columnLength Then + itemToAdd = resultItem + Else + ' Sanity check at end of the string + If index + Len(prefixText) = columnLength Then + itemToAdd = "..." & resultItem.Substring(index-columnLength,index) + ElseIf Len(resultItem) - index < subStringBeginIndex Then + ' Display string from the end till columnLength value if, index is closer to the end of the string. + itemToAdd = "..." & resultItem.Substring(Len(resultItem)-columnLength,Len(resultItem)) + ElseIf index <= subStringBeginIndex Then + ' Sanity chet at beginning of the string + itemToAdd = resultItem.Substring(0, columnLength) & "..." + Else + ' Display string containing text before the prefixText occures and text after the prefixText + itemToAdd = "..." & resultItem.Substring(index - subStringBeginIndex, columnLength) & "..." + End If + End If + ElseIf InvariantLCase(AutoTypeAheadDisplayFoundText).equals("atendofmatchedstring") Then + ' Expression to find ending of the word which contains prefexText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\s", System.Text.RegularExpressions.RegexOptions.IgnoreCase) + ' Find the ending of the word which contains prefexText + If regex1.IsMatch(resultItem, index + 1) Then + index = regex1.Match(resultItem, index + 1).Index + Else + ' If the word which contains prefexText is the last word in string, regex1.IsMatch returns false. + index = resultItem.Length + End If + If index > Len(resultItem) Then + index = Len(resultItem) + End If + ' If text from beginning of the string till index is less than columnLength value then, display string from the beginning till index. + If index <= columnLength Then + if index = Len(resultItem) Then 'Make decision to append "..." + itemToAdd = resultItem.Substring(0,index) + Else + itemToAdd = resultItem.Substring(0,index) & "..." + End If + Else + If index = Len(resultItem) Then + itemToAdd = "..." & resultItem.Substring(index - (columnLength - 3), (columnLength - 3)) + Else + 'Truncate the string to show only columnLength - 6 characters as begining and trailing "..." has to be appended. + itemToAdd = "..." & resultItem.Substring(index - (columnLength - 6), columnLength - 6) & "..." + End If + End If + End If + + ' Remove newline character from itemToAdd + Dim prefixTextIndex As Integer = itemToAdd.IndexOf(prefixText, StringComparison.CurrentCultureIgnoreCase) + ' If itemToAdd contains any newline after the search text then show text only till newline + Dim regex2 As System.Text.RegularExpressions.Regex = New System.Text.RegularExpressions.Regex("(" & vbCrLf & "|" & vbLf & ")", System.Text.RegularExpressions.RegexOptions.IgnoreCase) + Dim newLineIndexAfterPrefix As Integer = -1 + If regex2.IsMatch(itemToAdd, prefixTextIndex) Then + newLineIndexAfterPrefix = regex2.Match(itemToAdd, prefixTextIndex).Index + End If + If (newLineIndexAfterPrefix > -1) Then + If itemToAdd.EndsWith("...") Then + itemToAdd = (itemToAdd.Substring(0, newLineIndexAfterPrefix) + "...") + Else + itemToAdd = itemToAdd.Substring(0, newLineIndexAfterPrefix) + End If + End If + ' If itemToAdd contains any newline before search text then show text which comes after newline + Dim regex3 As System.Text.RegularExpressions.Regex = New System.Text.RegularExpressions.Regex("(" & vbCrLf & "|" & vbLf & ")", (System.Text.RegularExpressions.RegexOptions.IgnoreCase Or System.Text.RegularExpressions.RegexOptions.RightToLeft)) + Dim newLineIndexBeforePrefix As Integer = -1 + If regex3.IsMatch(itemToAdd, prefixTextIndex) Then + newLineIndexBeforePrefix = regex3.Match(itemToAdd, prefixTextIndex).Index + End If + If (newLineIndexBeforePrefix > -1) Then + If itemToAdd.StartsWith("...") Then + itemToAdd = ("..." + itemToAdd.Substring((newLineIndexBeforePrefix + regex3.Match(itemToAdd, prefixTextIndex).Length))) + Else + itemToAdd = itemToAdd.Substring((newLineIndexBeforePrefix + regex3.Match(itemToAdd, prefixTextIndex).Length)) + End If + End If + + If Not itemToAdd is nothing AndAlso Not resultList.Contains(itemToAdd) Then + + resultList.Add(itemToAdd) + + isAdded = true + End If + End If + Return isAdded + End Function + + + Protected Overridable Sub GetPageSize() + + End Sub + + Protected Overridable Sub AddNewRecords() + + Dim newRecordList As ArrayList = New ArrayList() + + Dim newUIDataList As System.Collections.Generic.List(Of Hashtable) = New System.Collections.Generic.List(Of Hashtable)() + + ' Loop though all the record controls and if the record control + ' does not have a unique record id set, then create a record + ' and add to the list. + If Not Me.ResetData Then + Dim rep As System.Web.UI.WebControls.Repeater = CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "ReportPropertiesTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return + + Dim repItem As System.Web.UI.WebControls.RepeaterItem + For Each repItem In rep.Items + ' Loop through all rows in the table, set its DataSource and call DataBind(). + + Dim recControl As ReportPropertiesTableControlRow = DirectCast(repItem.FindControl("ReportPropertiesTableControlRow"), ReportPropertiesTableControlRow) + + If recControl.Visible AndAlso recControl.IsNewRecord() Then + + Dim rec As ReportPropertiesRecord = New ReportPropertiesRecord() + + newUIDataList.Add(recControl.PreservedUIData()) + newRecordList.Add(rec) + End If + Next + End If + + + ' Add any new record to the list. + Dim index As Integer = 0 + For index = 1 To Me.AddNewRecord + + newRecordList.Insert(0, New ReportPropertiesRecord()) + newUIDataList.Insert(0, New Hashtable()) + + Next + Me.AddNewRecord = 0 + + ' Finally, add any new records to the DataSource. + If newRecordList.Count > 0 Then + + Dim finalList As ArrayList = New ArrayList(Me.DataSource) + finalList.InsertRange(0, newRecordList) + + Me.DataSource = DirectCast(finalList.ToArray(GetType(ReportPropertiesRecord)), ReportPropertiesRecord()) + + End If + + ' Add the existing UI data to this hash table + If newUIDataList.Count > 0 Then + Me.UIData.InsertRange(0, newUIDataList) + End If + + End Sub + + + Public Sub AddToDeletedRecordIds(ByVal rec As ReportPropertiesTableControlRow) + If rec.IsNewRecord() Then + Return + End If + + If Not Me.DeletedRecordIds Is Nothing AndAlso Me.DeletedRecordIds.Trim <> "" Then + Me.DeletedRecordIds &= "," + End If + + Me.DeletedRecordIds &= "[" & rec.RecordUniqueId & "]" + End Sub + + Protected Overridable Function InDeletedRecordIds(ByVal rec As ReportPropertiesTableControlRow) As Boolean + If Me.DeletedRecordIds Is Nothing OrElse Me.DeletedRecordIds.Trim = "" Then + Return False + End If + + Return Me.DeletedRecordIds.IndexOf("[" & rec.RecordUniqueId & "]") >= 0 + End Function + + Private _DeletedRecordIds As String + Public Property DeletedRecordIds() As String + Get + Return Me._DeletedRecordIds + End Get + Set(ByVal value As String) + Me._DeletedRecordIds = value + End Set + End Property + + + ' Create Set, WhereClause, and Populate Methods + + Public Overridable Sub SetReportPropertiesTableControlCollapsibleRegion() + + End Sub + + + + + Protected Overridable Sub Control_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.PreRender + ' PreRender event is raised just before page is being displayed. + Try + DbUtils.StartTransaction + Me.RegisterPostback() + + If Not Me.Page.ErrorOnPage AndAlso (Me.Page.IsPageRefresh OrElse Me.DataChanged OrElse Me.ResetData) Then + + + ' Re-load the data and update the web page if necessary. + ' This is typically done during a postback (filter, search button, sort, pagination button). + ' In each of the other click handlers, simply set DataChanged to True to reload the data. + + Me.LoadData() + Me.DataBind() + + End If + + + + Catch ex As Exception + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + Finally + DbUtils.EndTransaction + End Try + End Sub + + + Protected Overrides Sub SaveControlsToSession() + MyBase.SaveControlsToSession() + + ' Save filter controls to values to session. + + + 'Save pagination state to session. + + + + ' Save table control properties to the session. + If Not Me.CurrentSortOrder Is Nothing Then + Me.SaveToSession(Me, "Order_By", Me.CurrentSortOrder.ToXmlString()) + End If + + Me.SaveToSession(Me, "Page_Index", Me.PageIndex.ToString()) + Me.SaveToSession(Me, "Page_Size", Me.PageSize.ToString()) + + Me.SaveToSession(Me, "DeletedRecordIds", Me.DeletedRecordIds) + + End Sub + + Protected Sub SaveControlsToSession_Ajax() + ' Save filter controls to values to session. + + HttpContext.Current.Session("AppRelativeVirtualPath") = Me.Page.AppRelativeVirtualPath + + End Sub + + Protected Overrides Sub ClearControlsFromSession() + MyBase.ClearControlsFromSession() + + ' Clear filter controls values from the session. + + + ' Clear pagination state from session. + + + + ' Clear table properties from the session. + Me.RemoveFromSession(Me, "Order_By") + Me.RemoveFromSession(Me, "Page_Index") + Me.RemoveFromSession(Me, "Page_Size") + + Me.RemoveFromSession(Me, "DeletedRecordIds") + + End Sub + + Protected Overrides Sub LoadViewState(ByVal savedState As Object) + MyBase.LoadViewState(savedState) + + Dim orderByStr As String = CType(ViewState("ReportPropertiesTableControl_OrderBy"), String) + + If orderByStr IsNot Nothing AndAlso orderByStr.Trim <> "" Then + Me.CurrentSortOrder = BaseClasses.Data.OrderBy.FromXmlString(orderByStr) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + End If + + Dim pageIndex As String = CType(ViewState("Page_Index"), String) + If pageIndex IsNot Nothing Then + Me.PageIndex = CInt(pageIndex) + End If + + Dim pageSize As String = CType(ViewState("Page_Size"), String) + If Not pageSize Is Nothing Then + Me.PageSize = CInt(pageSize) + End If + + + + ' Load view state for pagination control. + + Me.DeletedRecordIds = CType(Me.ViewState("DeletedRecordIds"), String) + + End Sub + + Protected Overrides Function SaveViewState() As Object + + If Me.CurrentSortOrder IsNot Nothing Then + Me.ViewState("ReportPropertiesTableControl_OrderBy") = Me.CurrentSortOrder.ToXmlString() + End If + + Me.ViewState("Page_Index") = Me.PageIndex + Me.ViewState("Page_Size") = Me.PageSize + + Me.ViewState("DeletedRecordIds") = Me.DeletedRecordIds + + + ' Load view state for pagination control. + + + Return MyBase.SaveViewState() + End Function + + ' Generate the event handling functions for pagination events. + + + ' Generate the event handling functions for sorting events. + + + ' Generate the event handling functions for button events. + + ' event handler for ImageButton + Public Overridable Sub ReportPropertiesExportExcelButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + ' To customize the columns or the format, override this function in Section 1 of the page + ' and modify it to your liking. + ' Build the where clause based on the current filter and search criteria + ' Create the Order By clause based on the user's current sorting preference. + + Dim wc As WhereClause = CreateWhereClause + Dim orderBy As OrderBy = Nothing + + orderBy = CreateOrderBy + + Dim done As Boolean = False + Dim val As Object = "" + ' Read pageSize records at a time and write out the Excel file. + Dim totalRowsReturned As Integer = 0 + + Me.TotalRecords = ReportPropertiesTable.GetRecordCount(wc) + If Me.TotalRecords > 10000 Then + + ' Add each of the columns in order of export. + Dim columns() as BaseColumn = New BaseColumn() { _ + Nothing} + Dim exportData as ExportDataToCSV = New ExportDataToCSV(ReportPropertiesTable.Instance, wc, orderBy, columns) + exportData.StartExport(Me.Page.Response, True) + + Dim dataForCSV As DataForExport = New DataForExport(ReportPropertiesTable.Instance, wc, orderBy, columns) + + ' Read pageSize records at a time and write out the CSV file. + While (Not done) + Dim recList As ArrayList = dataForCSV.GetRows(exportData.pageSize) + If recList Is Nothing Then + Exit While 'no more records we are done + End If + + totalRowsReturned = recList.Count + For Each rec As BaseRecord In recList + For Each col As BaseColumn In dataForCSV.ColumnList + If col Is Nothing Then + Continue For + End If + + If Not dataForCSV.IncludeInExport(col) Then + Continue For + End If + + val = rec.GetValue(col).ToString() + exportData.WriteColumnData(val, dataForCSV.IsString(col)) + + Next col + exportData.WriteNewRow() + Next rec + + ' If we already are below the pageSize, then we are done. + If totalRowsReturned < exportData.pageSize Then + done = True + End If + End While + exportData.FinishExport(Me.Page.Response) + Else + + ' Create an instance of the Excel report class with the table class, where clause and order by. + Dim excelReport As ExportDataToExcel = New ExportDataToExcel(ReportPropertiesTable.Instance, wc, orderBy) + ' Add each of the columns in order of export. + ' To customize the data type, change the second parameter of the new ExcelColumn to be + ' a format string from Excel's Format Cell menu. For example "dddd, mmmm dd, yyyy h:mm AM/PM;@", "#,##0.00" + + If Me.Page.Response Is Nothing Then + Return + End If + + excelReport.CreateExcelBook() + + Dim width As Integer = 0 + Dim columnCounter As Integer = 0 + Dim data As DataForExport = New DataForExport(ReportPropertiesTable.Instance, wc, orderBy, Nothing) + + + For Each col As ExcelColumn In data.ColumnList + width = excelReport.GetExcelCellWidth(col) + If data.IncludeInExport(col) Then + excelReport.AddColumnToExcelBook(columnCounter, col.ToString(), excelReport.GetExcelDataType(col), width, excelReport.GetDisplayFormat(col)) + columnCounter = columnCounter + 1 + End If + Next col + + While (Not done) + Dim recList As ArrayList = data.GetRows(excelReport.pageSize) + + If recList Is Nothing Then + Exit While 'no more records we are done + End If + + totalRowsReturned = recList.Count + + For Each rec As BaseRecord In recList + excelReport.AddRowToExcelBook() + columnCounter = 0 + + For Each col As ExcelColumn In data.ColumnList + If Not data.IncludeInExport(col) Then + Continue For + End If + + Dim _isExpandableNonCompositeForeignKey As Boolean = col.DisplayColumn.TableDefinition.IsExpandableNonCompositeForeignKey(col.DisplayColumn) + If _isExpandableNonCompositeForeignKey AndAlso col.DisplayColumn.IsApplyDisplayAs Then + val = ReportPropertiesTable.GetDFKA(rec.GetValue(col.DisplayColumn).ToString(), col.DisplayColumn, Nothing) + If val Is Nothing Then + val = rec.Format(col.DisplayColumn) + End If + Else + val = excelReport.GetValueForExcelExport(col, rec) + End If + excelReport.AddCellToExcelRow(columnCounter, excelReport.GetExcelDataType(col), val, col.DisplayFormat) + + columnCounter = columnCounter + 1 + Next col + Next rec + + ' If we already are below the pageSize, then we are done. + If totalRowsReturned < excelReport.pageSize Then + done = True + End If + End While + + excelReport.SaveExcelBook(Me.Page.Response) + End If + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub ReportPropertiesPDFButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + Dim report As PDFReport = New PDFReport() + report.SpecificReportFileName = Page.Server.MapPath("EditPersonalId1.ReportPropertiesPDFButton.report") + ' report.Title replaces the value tag of page header and footer containing ${ReportTitle} + report.Title = "ReportProperties" + ' If EditPersonalId1.ReportPropertiesPDFButton.report specifies a valid report template, + ' AddColumn method will generate a report template. + ' Each AddColumn method-call specifies a column + ' The 1st parameter represents the text of the column header + ' The 2nd parameter represents the horizontal alignment of the column header + ' The 3rd parameter represents the text format of the column detail + ' The 4th parameter represents the horizontal alignment of the column detail + ' The 5th parameter represents the relative width of the column + + + Dim rowsPerQuery As Integer = 5000 + Dim recordCount As Integer = 0 + + report.Page = Page.GetResourceValue("Txt:Page", "Persons") + report.ApplicationPath = Me.Page.MapPath(Page.Request.ApplicationPath) + + Dim whereClause As WhereClause = CreateWhereClause + Dim orderBy As OrderBy = CreateOrderBy + Dim joinFilter As BaseFilter = CreateCompoundJoinFilter() + + Dim pageNum As Integer = 0 + Dim totalRows As Integer = ReportPropertiesTable.GetRecordCount(joinFilter,whereClause) + Dim columns As ColumnList = ReportPropertiesTable.GetColumnList() + Dim records As ReportPropertiesRecord() = Nothing + + Do + + records = ReportPropertiesTable.GetRecords(joinFilter,whereClause, orderBy, pageNum, rowsPerQuery) + If Not (records Is Nothing) AndAlso records.Length > 0 AndAlso whereClause.RunQuery Then + For Each record As ReportPropertiesRecord In records + + ' AddData method takes four parameters + ' The 1st parameters represent the data format + ' The 2nd parameters represent the data value + ' The 3rd parameters represent the default alignment of column using the data + ' The 4th parameters represent the maximum length of the data value being shown + + report.WriteRow + Next + pageNum = pageNum + 1 + recordCount += records.Length + End If + Loop While Not (records Is Nothing) AndAlso recordCount < totalRows AndAlso whereClause.RunQuery + + report.Close + BaseClasses.Utils.NetUtils.WriteResponseBinaryAttachment(Me.Page.Response, report.Title + ".pdf", report.ReportInByteArray, 0, true) + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub ReportPropertiesWordButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + Dim report As WordReport = New WordReport + report.SpecificReportFileName = Page.Server.MapPath("EditPersonalId1.ReportPropertiesWordButton.word") + ' report.Title replaces the value tag of page header and footer containing ${ReportTitle} + report.Title = "ReportProperties" + ' If EditPersonalId1.ReportPropertiesWordButton.report specifies a valid report template, + ' AddColumn method will generate a report template. + ' Each AddColumn method-call specifies a column + ' The 1st parameter represents the text of the column header + ' The 2nd parameter represents the horizontal alignment of the column header + ' The 3rd parameter represents the text format of the column detail + ' The 4th parameter represents the horizontal alignment of the column detail + ' The 5th parameter represents the relative width of the column + + Dim whereClause As WhereClause = CreateWhereClause + + Dim orderBy As OrderBy = CreateOrderBy + Dim joinFilter As BaseFilter = CreateCompoundJoinFilter() + + Dim rowsPerQuery As Integer = 5000 + Dim pageNum As Integer = 0 + Dim recordCount As Integer = 0 + Dim totalRows As Integer = ReportPropertiesTable.GetRecordCount(joinFilter,whereClause) + + report.Page = Page.GetResourceValue("Txt:Page", "Persons") + report.ApplicationPath = Me.Page.MapPath(Page.Request.ApplicationPath) + + Dim columns As ColumnList = ReportPropertiesTable.GetColumnList() + Dim records As ReportPropertiesRecord() = Nothing + Do + records = ReportPropertiesTable.GetRecords(joinFilter,whereClause, orderBy, pageNum, rowsPerQuery) + + If Not (records Is Nothing) AndAlso records.Length > 0 AndAlso whereClause.RunQuery Then + For Each record As ReportPropertiesRecord In records + ' AddData method takes four parameters + ' The 1st parameters represent the data format + ' The 2nd parameters represent the data value + ' The 3rd parameters represent the default alignment of column using the data + ' The 4th parameters represent the maximum length of the data value being shown + + report.WriteRow + Next + pageNum = pageNum + 1 + recordCount += records.Length + End If + Loop While Not (records Is Nothing) AndAlso recordCount < totalRows AndAlso whereClause.RunQuery + report.save + BaseClasses.Utils.NetUtils.WriteResponseBinaryAttachment(Me.Page.Response, report.Title + ".doc", report.ReportInByteArray, 0, true) + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + + + ' Generate the event handling functions for filter and search events. + + + ' Generate the event handling functions for others + + + Private _UIData As New System.Collections.Generic.List(Of Hashtable) + Public Property UIData() As System.Collections.Generic.List(Of Hashtable) + Get + Return Me._UIData + End Get + Set(ByVal value As System.Collections.Generic.List(Of Hashtable)) + Me._UIData = value + End Set + End Property + + ' pagination properties + Protected _PageSize As Integer + Public Property PageSize() As Integer + Get + Return Me._PageSize + End Get + Set(ByVal value As Integer) + Me._PageSize = value + End Set + End Property + + Protected _PageIndex As Integer + Public Property PageIndex() As Integer + Get + ' Return the PageIndex + Return Me._PageIndex + End Get + Set(ByVal value As Integer) + Me._PageIndex = value + End Set + End Property + + Protected _TotalRecords As Integer = -1 + Public Property TotalRecords() As Integer + Get + If _TotalRecords < 0 + _TotalRecords = ReportPropertiesTable.GetRecordCount(CreateCompoundJoinFilter(), CreateWhereClause()) + End If + Return Me._TotalRecords + End Get + Set(ByVal value As Integer) + If Me.PageSize > 0 Then + + Me.TotalPages = CInt(Math.Ceiling(value / Me.PageSize)) + + End If + Me._TotalRecords = value + End Set + End Property + + + + Protected _TotalPages As Integer = -1 + Public Property TotalPages() As Integer + Get + If _TotalPages < 0 Then + + Me.TotalPages = CInt(Math.Ceiling(TotalRecords / Me.PageSize)) + + End If + Return Me._TotalPages + End Get + Set(ByVal value As Integer) + Me._TotalPages = value + End Set + End Property + + Protected _DisplayLastPage As Boolean + Public Property DisplayLastPage() As Boolean + Get + Return Me._DisplayLastPage + End Get + Set(ByVal value As Boolean) + Me._DisplayLastPage = value + End Set + End Property + + Private _DataChanged As Boolean = False + Public Property DataChanged() As Boolean + Get + Return Me._DataChanged + End Get + Set(ByVal value As Boolean) + Me._DataChanged = value + End Set + End Property + + Private _ResetData As Boolean = False + Public Property ResetData() As Boolean + Get + Return Me._ResetData + End Get + Set(ByVal value As Boolean) + Me._ResetData = value + End Set + End Property + + Private _AddNewRecord As Integer = 0 + Public Property AddNewRecord() As Integer + Get + Return Me._AddNewRecord + End Get + Set(ByVal value As Integer) + Me._AddNewRecord = value + End Set + End Property + + + Private _CurrentSortOrder As OrderBy = Nothing + Public Property CurrentSortOrder() As OrderBy + Get + Return Me._CurrentSortOrder + End Get + Set(ByVal value As BaseClasses.Data.OrderBy) + Me._CurrentSortOrder = value + End Set + End Property + + Private _DataSource() As ReportPropertiesRecord = Nothing + Public Property DataSource() As ReportPropertiesRecord () + Get + Return Me._DataSource + End Get + Set(ByVal value() As ReportPropertiesRecord) + Me._DataSource = value + End Set + End Property + +#Region "Helper Properties" + + Public ReadOnly Property ReportPropertiesExportExcelButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "ReportPropertiesExportExcelButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property ReportPropertiesPDFButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "ReportPropertiesPDFButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property ReportPropertiesTableControlCollapsibleRegion() As System.Web.UI.WebControls.Panel + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "ReportPropertiesTableControlCollapsibleRegion"), System.Web.UI.WebControls.Panel) + End Get + End Property + + Public ReadOnly Property ReportPropertiesWordButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "ReportPropertiesWordButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + +#End Region + +#Region "Helper Functions" + + Public Overrides Overloads Function ModifyRedirectUrl(url As String, arg As String, ByVal bEncrypt As Boolean) As String + Return Me.Page.EvaluateExpressions(url, arg, bEncrypt, Me) + End Function + + Public Overrides Overloads Function EvaluateExpressions(url As String, arg As String, ByVal bEncrypt As Boolean) As String + Dim needToProcess As Boolean = AreAnyUrlParametersForMe(url, arg) + If (needToProcess) Then + Dim recCtl As ReportPropertiesTableControlRow = Me.GetSelectedRecordControl() + If recCtl Is Nothing AndAlso url.IndexOf("{") >= 0 Then + ' Localization. + Throw New Exception(Page.GetResourceValue("Err:NoRecSelected", "Persons")) + End If + Dim rec As ReportPropertiesRecord = Nothing + If recCtl IsNot Nothing Then + rec = recCtl.GetRecord() + End If + Return EvaluateExpressions(url, arg, rec, bEncrypt) + End If + Return url + End Function + + Public Overridable Function GetSelectedRecordControl() As ReportPropertiesTableControlRow + Return Nothing + + End Function + + Public Overridable Function GetSelectedRecordControls() As ReportPropertiesTableControlRow() + + Return DirectCast((new ArrayList()).ToArray(GetType(ReportPropertiesTableControlRow)), ReportPropertiesTableControlRow()) + + End Function + + Public Overridable Sub DeleteSelectedRecords(ByVal deferDeletion As Boolean) + Dim recList() As ReportPropertiesTableControlRow = Me.GetSelectedRecordControls() + If recList.Length = 0 Then + ' Localization. + Throw New Exception(Page.GetResourceValue("Err:NoRecSelected", "Persons")) + End If + + Dim recCtl As ReportPropertiesTableControlRow + For Each recCtl In recList + If deferDeletion Then + If Not recCtl.IsNewRecord Then + + Me.AddToDeletedRecordIds(recCtl) + + End If + recCtl.Visible = False + + Else + + recCtl.Delete() + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + End If + Next + End Sub + + Public Function GetRecordControls() As ReportPropertiesTableControlRow() + Dim recList As ArrayList = New ArrayList() + Dim rep As System.Web.UI.WebControls.Repeater = CType(Me.FindControl("ReportPropertiesTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return Nothing + Dim repItem As System.Web.UI.WebControls.RepeaterItem + + For Each repItem In rep.Items + + Dim recControl As ReportPropertiesTableControlRow = DirectCast(repItem.FindControl("ReportPropertiesTableControlRow"), ReportPropertiesTableControlRow) + recList.Add(recControl) + + Next + + Return DirectCast(recList.ToArray(GetType(ReportPropertiesTableControlRow)), ReportPropertiesTableControlRow()) + End Function + + Public Shadows ReadOnly Property Page() As BaseApplicationPage + Get + Return DirectCast(MyBase.Page, BaseApplicationPage) + End Get + End Property + +#End Region + + + +End Class + + +' Base class for the PersonalIdRecordControl control on the EditPersonalId1 page. +' Do not modify this class. Instead override any method in PersonalIdRecordControl. +Public Class BasePersonalIdRecordControl + Inherits Persons.UI.BaseApplicationRecordControl + + ' To customize, override this method in PersonalIdRecordControl. + Protected Overridable Sub Control_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Init + + ' Setup the filter and search events. + + Me.ClearControlsFromSession() + End Sub + + ' To customize, override this method in PersonalIdRecordControl. + Protected Overridable Sub Control_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load + + ' Setup the pagination events. + + + ' Register the event handlers. + + AddHandler Me.ArmId.SelectedIndexChanged, AddressOf ArmId_SelectedIndexChanged + + AddHandler Me.ArmyId.SelectedIndexChanged, AddressOf ArmyId_SelectedIndexChanged + + AddHandler Me.BloodId.SelectedIndexChanged, AddressOf BloodId_SelectedIndexChanged + + AddHandler Me.Born.SelectedIndexChanged, AddressOf Born_SelectedIndexChanged + + AddHandler Me.DeptId.SelectedIndexChanged, AddressOf DeptId_SelectedIndexChanged + + AddHandler Me.RankId.SelectedIndexChanged, AddressOf RankId_SelectedIndexChanged + + AddHandler Me.SectionId.SelectedIndexChanged, AddressOf SectionId_SelectedIndexChanged + + AddHandler Me.Sex.SelectedIndexChanged, AddressOf Sex_SelectedIndexChanged + + AddHandler Me.StatusId.SelectedIndexChanged, AddressOf StatusId_SelectedIndexChanged + + AddHandler Me.Addr.TextChanged, AddressOf Addr_TextChanged + + AddHandler Me.Amphur.TextChanged, AddressOf Amphur_TextChanged + + AddHandler Me.ArmyWelfareMemId.TextChanged, AddressOf ArmyWelfareMemId_TextChanged + + AddHandler Me.BAmphur.TextChanged, AddressOf BAmphur_TextChanged + + AddHandler Me.BirthDate.TextChanged, AddressOf BirthDate_TextChanged + + AddHandler Me.BProvince.TextChanged, AddressOf BProvince_TextChanged + + AddHandler Me.CremateMemId.TextChanged, AddressOf CremateMemId_TextChanged + + AddHandler Me.MId.TextChanged, AddressOf MId_TextChanged + + AddHandler Me.MobilePhone.TextChanged, AddressOf MobilePhone_TextChanged + + AddHandler Me.Nationality.TextChanged, AddressOf Nationality_TextChanged + + AddHandler Me.OfficerDate.TextChanged, AddressOf OfficerDate_TextChanged + + AddHandler Me.Origin.TextChanged, AddressOf Origin_TextChanged + + AddHandler Me.PersonalId.TextChanged, AddressOf PersonalId_TextChanged + + AddHandler Me.PersonalLastName.TextChanged, AddressOf PersonalLastName_TextChanged + + AddHandler Me.PersonalName.TextChanged, AddressOf PersonalName_TextChanged + + AddHandler Me.Phone.TextChanged, AddressOf Phone_TextChanged + + AddHandler Me.PhoneExt.TextChanged, AddressOf PhoneExt_TextChanged + + AddHandler Me.PlaceOfBirth.TextChanged, AddressOf PlaceOfBirth_TextChanged + + AddHandler Me.PostCode.TextChanged, AddressOf PostCode_TextChanged + + AddHandler Me.Province.TextChanged, AddressOf Province_TextChanged + + AddHandler Me.RegDate.TextChanged, AddressOf RegDate_TextChanged + + AddHandler Me.RegNo1.TextChanged, AddressOf RegNo1_TextChanged + + AddHandler Me.RegNo2.TextChanged, AddressOf RegNo2_TextChanged + + AddHandler Me.Religion.TextChanged, AddressOf Religion_TextChanged + + AddHandler Me.TId.TextChanged, AddressOf TId_TextChanged + + + End Sub + + + Public Overridable Sub LoadData() + + ' Load the data from the database into the DataSource PersonalId record. + ' It is better to make changes to functions called by LoadData such as + ' CreateWhereClause, rather than making changes here. + + ' 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 = PersonalIdTable.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, "PersonalIdRecordControlPanel"), System.Web.UI.WebControls.Panel) + If Not Panel is Nothing Then + Panel.visible = True + End If + + ' If there is no Where clause, then simply create a new, blank record. + + If wc Is Nothing OrElse Not wc.RunQuery Then + Me.DataSource = New PersonalIdRecord() + + If Not Panel is Nothing Then + Panel.visible = False + End If + + Return + End If + + ' Retrieve the record from the database. It is possible + + Dim recList() As PersonalIdRecord = PersonalIdTable.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 = PersonalIdTable.GetRecord(recList(0).GetID.ToXmlString(), True) + + + + End Sub + + ' Populate the UI controls using the DataSource. To customize, override this method in PersonalIdRecordControl. + Public Overrides Sub DataBind() + ' The DataBind method binds the user interface controls to the values + ' from the database record. To do this, it calls the Set methods for + ' each of the field displayed on the webpage. It is better to make + ' changes in the Set methods, rather than making changes here. + + MyBase.DataBind() + + ' Make sure that the DataSource is initialized. + If Me.DataSource Is Nothing Then + + Return + End If + + + 'LoadData for DataSource for chart and report if they exist + + + + ' Call the Set methods for each controls on the panel + + SetAddr() + SetAddrLabel() + SetAmphur() + SetAmphurLabel() + SetArmId() + SetArmIdLabel() + SetArmyId() + SetArmyIdLabel() + SetArmyWelfareMemId() + SetArmyWelfareMemIdLabel() + SetBAmphur() + SetBAmphurLabel() + SetBirthDate() + SetBirthDateLabel() + SetBloodId() + SetBloodIdLabel() + SetBorn() + SetBornLabel() + SetBProvince() + SetBProvinceLabel() + SetCremateMemId() + SetCremateMemIdLabel() + SetDeptId() + SetDeptIdLabel() + SetMId() + SetMIdLabel() + SetMobilePhone() + SetMobilePhoneLabel() + SetNationality() + SetNationalityLabel() + SetOfficerDate() + SetOfficerDateLabel() + SetOrigin() + SetOriginLabel() + SetPersonalId() + SetPersonalIdLabel() + SetPersonalIdRecordControlCollapsibleRegion() + SetPersonalIdRecordControlIcon() + SetPersonalIdRecordControlPanelExtender() + + SetPersonalLastName() + SetPersonalLastNameLabel() + SetPersonalName() + SetPersonalNameLabel() + SetPhone() + SetPhoneExt() + SetPhoneExtLabel() + SetPhoneLabel() + + SetpictureImage() + SetpictureLabel() + SetPlaceOfBirth() + SetPlaceOfBirthLabel() + SetPostCode() + SetPostCodeLabel() + SetProvince() + SetProvinceLabel() + SetRankId() + SetRankIdLabel() + SetRegDate() + SetRegDateLabel() + SetRegNo1() + SetRegNo1Label() + SetRegNo2() + SetRegNo2Label() + SetReligion() + SetReligionLabel() + SetSectionId() + SetSectionIdLabel() + SetSex() + SetSexLabel() + SetStatusId() + SetStatusIdLabel() + SetTId() + SetTIdLabel() + + + 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 SetAddr() + + + ' Set the Addr TextBox on the webpage with value from the + ' PersonalId database record. + + ' Me.DataSource is the PersonalId record retrieved from the database. + ' Me.Addr is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetAddr() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.AddrSpecified Then + + ' If the Addr is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalIdTable.Addr) + + Me.Addr.Text = formattedValue + + Else + + ' Addr is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.Addr.Text = PersonalIdTable.Addr.Format(PersonalIdTable.Addr.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetAmphur() + + + ' Set the Amphur TextBox on the webpage with value from the + ' PersonalId database record. + + ' Me.DataSource is the PersonalId record retrieved from the database. + ' Me.Amphur is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetAmphur() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.AmphurSpecified Then + + ' If the Amphur is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalIdTable.Amphur) + + Me.Amphur.Text = formattedValue + + Else + + ' Amphur is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.Amphur.Text = PersonalIdTable.Amphur.Format(PersonalIdTable.Amphur.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetArmId() + + + ' Set the ArmId DropDownList on the webpage with value from the + ' PersonalId database record. + + ' Me.DataSource is the PersonalId record retrieved from the database. + ' Me.ArmId is the ASP:DropDownList on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetArmId() + ' and add your own code before or after the call to the MyBase function. + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.ArmIdSpecified Then + + ' If the ArmId is non-NULL, then format the value. + ' The Format method will return the Display Foreign Key As (DFKA) value + Me.PopulateArmIdDropDownList(Me.DataSource.ArmId.ToString(), 100) + + Else + + ' ArmId 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.PopulateArmIdDropDownList(Nothing, 100) + Else + Me.PopulateArmIdDropDownList(PersonalIdTable.ArmId.DefaultValue, 100) + End If + + End If + + End Sub + + Public Overridable Sub SetArmyId() + + + ' Set the ArmyId DropDownList on the webpage with value from the + ' PersonalId database record. + + ' Me.DataSource is the PersonalId record retrieved from the database. + ' Me.ArmyId is the ASP:DropDownList on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetArmyId() + ' and add your own code before or after the call to the MyBase function. + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.ArmyIdSpecified Then + + ' If the ArmyId is non-NULL, then format the value. + ' The Format method will return the Display Foreign Key As (DFKA) value + Me.PopulateArmyIdDropDownList(Me.DataSource.ArmyId.ToString(), 100) + + Else + + ' ArmyId 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.PopulateArmyIdDropDownList(Nothing, 100) + Else + Me.PopulateArmyIdDropDownList(PersonalIdTable.ArmyId.DefaultValue, 100) + End If + + End If + + End Sub + + Public Overridable Sub SetArmyWelfareMemId() + + + ' Set the ArmyWelfareMemId TextBox on the webpage with value from the + ' PersonalId database record. + + ' Me.DataSource is the PersonalId record retrieved from the database. + ' Me.ArmyWelfareMemId is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetArmyWelfareMemId() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.ArmyWelfareMemIdSpecified Then + + ' If the ArmyWelfareMemId is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalIdTable.ArmyWelfareMemId) + + Me.ArmyWelfareMemId.Text = formattedValue + + Else + + ' ArmyWelfareMemId is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.ArmyWelfareMemId.Text = PersonalIdTable.ArmyWelfareMemId.Format(PersonalIdTable.ArmyWelfareMemId.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetBAmphur() + + + ' Set the BAmphur TextBox on the webpage with value from the + ' PersonalId database record. + + ' Me.DataSource is the PersonalId record retrieved from the database. + ' Me.BAmphur is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetBAmphur() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.BAmphurSpecified Then + + ' If the BAmphur is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalIdTable.BAmphur) + + Me.BAmphur.Text = formattedValue + + Else + + ' BAmphur is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.BAmphur.Text = PersonalIdTable.BAmphur.Format(PersonalIdTable.BAmphur.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetBirthDate() + + + ' Set the BirthDate TextBox on the webpage with value from the + ' PersonalId database record. + + ' Me.DataSource is the PersonalId record retrieved from the database. + ' Me.BirthDate is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetBirthDate() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.BirthDateSpecified Then + + ' If the BirthDate is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalIdTable.BirthDate, "d MMM yyyy") + + Me.BirthDate.Text = formattedValue + + Else + + ' BirthDate is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.BirthDate.Text = PersonalIdTable.BirthDate.Format(PersonalIdTable.BirthDate.DefaultValue, "d MMM yyyy") + + End If + + End Sub + + Public Overridable Sub SetBloodId() + + + ' Set the BloodId DropDownList on the webpage with value from the + ' PersonalId database record. + + ' Me.DataSource is the PersonalId record retrieved from the database. + ' Me.BloodId is the ASP:DropDownList on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetBloodId() + ' and add your own code before or after the call to the MyBase function. + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.BloodIdSpecified Then + + ' If the BloodId is non-NULL, then format the value. + ' The Format method will return the Display Foreign Key As (DFKA) value + Me.PopulateBloodIdDropDownList(Me.DataSource.BloodId.ToString(), 100) + + Else + + ' BloodId 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.PopulateBloodIdDropDownList(Nothing, 100) + Else + Me.PopulateBloodIdDropDownList(PersonalIdTable.BloodId.DefaultValue, 100) + End If + + End If + + End Sub + + Public Overridable Sub SetBorn() + + + ' Set the Born DropDownList on the webpage with value from the + ' PersonalId database record. + + ' Me.DataSource is the PersonalId record retrieved from the database. + ' Me.Born is the ASP:DropDownList on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetBorn() + ' and add your own code before or after the call to the MyBase function. + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.BornSpecified Then + + ' If the Born is non-NULL, then format the value. + ' The Format method will return the Display Foreign Key As (DFKA) value + Me.PopulateBornDropDownList(Me.DataSource.Born, 100) + + Else + + ' Born 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.PopulateBornDropDownList(Nothing, 100) + Else + Me.PopulateBornDropDownList(PersonalIdTable.Born.DefaultValue, 100) + End If + + End If + + End Sub + + Public Overridable Sub SetBProvince() + + + ' Set the BProvince TextBox on the webpage with value from the + ' PersonalId database record. + + ' Me.DataSource is the PersonalId record retrieved from the database. + ' Me.BProvince is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetBProvince() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.BProvinceSpecified Then + + ' If the BProvince is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalIdTable.BProvince) + + Me.BProvince.Text = formattedValue + + Else + + ' BProvince is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.BProvince.Text = PersonalIdTable.BProvince.Format(PersonalIdTable.BProvince.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetCremateMemId() + + + ' Set the CremateMemId TextBox on the webpage with value from the + ' PersonalId database record. + + ' Me.DataSource is the PersonalId record retrieved from the database. + ' Me.CremateMemId is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetCremateMemId() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.CremateMemIdSpecified Then + + ' If the CremateMemId is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalIdTable.CremateMemId) + + Me.CremateMemId.Text = formattedValue + + Else + + ' CremateMemId is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.CremateMemId.Text = PersonalIdTable.CremateMemId.Format(PersonalIdTable.CremateMemId.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetDeptId() + + + ' Set the DeptId DropDownList on the webpage with value from the + ' PersonalId database record. + + ' Me.DataSource is the PersonalId record retrieved from the database. + ' Me.DeptId is the ASP:DropDownList on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetDeptId() + ' and add your own code before or after the call to the MyBase function. + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.DeptIdSpecified Then + + ' If the DeptId is non-NULL, then format the value. + ' The Format method will return the Display Foreign Key As (DFKA) value + Me.PopulateDeptIdDropDownList(Me.DataSource.DeptId.ToString(), 100) + + Else + + ' DeptId 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.PopulateDeptIdDropDownList(Nothing, 100) + Else + Me.PopulateDeptIdDropDownList(PersonalIdTable.DeptId.DefaultValue, 100) + End If + + End If + + End Sub + + Public Overridable Sub SetMId() + + + ' Set the MId TextBox on the webpage with value from the + ' PersonalId database record. + + ' Me.DataSource is the PersonalId record retrieved from the database. + ' Me.MId is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetMId() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.MIdSpecified Then + + ' If the MId is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalIdTable.MId) + + Me.MId.Text = formattedValue + + Else + + ' MId is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.MId.Text = PersonalIdTable.MId.Format(PersonalIdTable.MId.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetMobilePhone() + + + ' Set the MobilePhone TextBox on the webpage with value from the + ' PersonalId database record. + + ' Me.DataSource is the PersonalId record retrieved from the database. + ' Me.MobilePhone is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetMobilePhone() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.MobilePhoneSpecified Then + + ' If the MobilePhone is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalIdTable.MobilePhone) + + Me.MobilePhone.Text = formattedValue + + Else + + ' MobilePhone is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.MobilePhone.Text = PersonalIdTable.MobilePhone.Format(PersonalIdTable.MobilePhone.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetNationality() + + + ' Set the Nationality TextBox on the webpage with value from the + ' PersonalId database record. + + ' Me.DataSource is the PersonalId record retrieved from the database. + ' Me.Nationality is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetNationality() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.NationalitySpecified Then + + ' If the Nationality is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalIdTable.Nationality) + + Me.Nationality.Text = formattedValue + + Else + + ' Nationality is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.Nationality.Text = PersonalIdTable.Nationality.Format(PersonalIdTable.Nationality.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetOfficerDate() + + + ' Set the OfficerDate TextBox on the webpage with value from the + ' PersonalId database record. + + ' Me.DataSource is the PersonalId record retrieved from the database. + ' Me.OfficerDate is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetOfficerDate() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.OfficerDateSpecified Then + + ' If the OfficerDate is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalIdTable.OfficerDate, "d MMM yyyy") + + Me.OfficerDate.Text = formattedValue + + Else + + ' OfficerDate is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.OfficerDate.Text = PersonalIdTable.OfficerDate.Format(PersonalIdTable.OfficerDate.DefaultValue, "d MMM yyyy") + + End If + + End Sub + + Public Overridable Sub SetOrigin() + + + ' Set the Origin TextBox on the webpage with value from the + ' PersonalId database record. + + ' Me.DataSource is the PersonalId record retrieved from the database. + ' Me.Origin is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetOrigin() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.OriginSpecified Then + + ' If the Origin is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalIdTable.Origin) + + Me.Origin.Text = formattedValue + + Else + + ' Origin is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.Origin.Text = PersonalIdTable.Origin.Format(PersonalIdTable.Origin.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetPersonalId() + + + ' Set the PersonalId TextBox on the webpage with value from the + ' PersonalId database record. + + ' Me.DataSource is the PersonalId record retrieved from the database. + ' Me.PersonalId is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetPersonalId() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.PersonalIdSpecified Then + + ' If the PersonalId is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalIdTable.PersonalId) + + Me.PersonalId.Text = formattedValue + + Else + + ' PersonalId is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.PersonalId.Text = PersonalIdTable.PersonalId.Format(PersonalIdTable.PersonalId.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetPersonalLastName() + + + ' Set the PersonalLastName TextBox on the webpage with value from the + ' PersonalId database record. + + ' Me.DataSource is the PersonalId record retrieved from the database. + ' Me.PersonalLastName is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetPersonalLastName() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.PersonalLastNameSpecified Then + + ' If the PersonalLastName is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalIdTable.PersonalLastName) + + Me.PersonalLastName.Text = formattedValue + + Else + + ' PersonalLastName is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.PersonalLastName.Text = PersonalIdTable.PersonalLastName.Format(PersonalIdTable.PersonalLastName.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetPersonalName() + + + ' Set the PersonalName TextBox on the webpage with value from the + ' PersonalId database record. + + ' Me.DataSource is the PersonalId record retrieved from the database. + ' Me.PersonalName is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetPersonalName() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.PersonalNameSpecified Then + + ' If the PersonalName is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalIdTable.PersonalName) + + Me.PersonalName.Text = formattedValue + + Else + + ' PersonalName is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.PersonalName.Text = PersonalIdTable.PersonalName.Format(PersonalIdTable.PersonalName.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetPhone() + + + ' Set the Phone TextBox on the webpage with value from the + ' PersonalId database record. + + ' Me.DataSource is the PersonalId record retrieved from the database. + ' Me.Phone is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetPhone() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.PhoneSpecified Then + + ' If the Phone is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalIdTable.Phone) + + Me.Phone.Text = formattedValue + + Else + + ' Phone is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.Phone.Text = PersonalIdTable.Phone.Format(PersonalIdTable.Phone.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetPhoneExt() + + + ' Set the PhoneExt TextBox on the webpage with value from the + ' PersonalId database record. + + ' Me.DataSource is the PersonalId record retrieved from the database. + ' Me.PhoneExt is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetPhoneExt() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.PhoneExtSpecified Then + + ' If the PhoneExt is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalIdTable.PhoneExt) + + Me.PhoneExt.Text = formattedValue + + Else + + ' PhoneExt is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.PhoneExt.Text = PersonalIdTable.PhoneExt.Format(PersonalIdTable.PhoneExt.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetpictureImage() + ' Set the picture Image on the webpage with value from the + ' PersonalId database record. + + ' Me.DataSource is the PersonalId record retrieved from the database. + ' Me.pictureImage is the ASP:Image on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetpictureImage() + ' and add your own code before or after the call to the MyBase function. + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.pictureSpecified Then + + ' If the picture is non-NULL, then format the value. + ' The Format method will use the Display Format + Me.pictureImage.Attributes.Add("onclick", "gPersist=true;") + Me.pictureImage.Attributes.Add("onmouseout","detailRolloverPopupClose();") + + Dim name As String = HttpUtility.HtmlEncode(PersonalIdTable.picture.Name) + + If Not HttpUtility.HtmlEncode("%ISD_DEFAULT%").Equals("%ISD_DEFAULT%") Then + name = HttpUtility.HtmlEncode(Me.Page.GetResourceValue("%ISD_DEFAULT%")) + End If + + Me.pictureImage.Attributes.Add("onmouseover","SaveMousePosition(event);delayRolloverPopup(""PageMethods.GetImage(\""" & Me.Page.Encrypt("PersonalId") _ + & "\"", \""" & Me.Page.Encrypt(HttpUtility.UrlEncode(Me.DataSource.GetID().ToString())) _ + & "\"", \""" & Me.Page.Encrypt("picture") & "\"", \""" & NetUtils.EncodeStringForHtmlDisplay(name.Substring(0, name.Length)) & "\"", false, 250," _ + & " 200, true, PopupDisplayWindowCallBackWith20);"",500);") + + ' Shrunk image size specified by ImagePercentSize on Properties. + Me.pictureImage.ImageUrl = Me.DataSource.FormatImageUrl(PersonalIdTable.picture, Me.Page.Encrypt("PersonalId"), Me.Page.Encrypt("picture"), Me.Page.Encrypt(Me.DataSource.GetID().ToXmlString()), 20) + + Me.pictureImage.Visible = True + Else + ' picture is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + Me.pictureImage.Visible = False + End If + End Sub + + Public Overridable Sub SetPlaceOfBirth() + + + ' Set the PlaceOfBirth TextBox on the webpage with value from the + ' PersonalId database record. + + ' Me.DataSource is the PersonalId record retrieved from the database. + ' Me.PlaceOfBirth is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetPlaceOfBirth() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.PlaceOfBirthSpecified Then + + ' If the PlaceOfBirth is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalIdTable.PlaceOfBirth) + + Me.PlaceOfBirth.Text = formattedValue + + Else + + ' PlaceOfBirth is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.PlaceOfBirth.Text = PersonalIdTable.PlaceOfBirth.Format(PersonalIdTable.PlaceOfBirth.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetPostCode() + + + ' Set the PostCode TextBox on the webpage with value from the + ' PersonalId database record. + + ' Me.DataSource is the PersonalId record retrieved from the database. + ' Me.PostCode is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetPostCode() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.PostCodeSpecified Then + + ' If the PostCode is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalIdTable.PostCode) + + Me.PostCode.Text = formattedValue + + Else + + ' PostCode is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.PostCode.Text = PersonalIdTable.PostCode.Format(PersonalIdTable.PostCode.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetProvince() + + + ' Set the Province TextBox on the webpage with value from the + ' PersonalId database record. + + ' Me.DataSource is the PersonalId record retrieved from the database. + ' Me.Province is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetProvince() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.ProvinceSpecified Then + + ' If the Province is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalIdTable.Province) + + Me.Province.Text = formattedValue + + Else + + ' Province is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.Province.Text = PersonalIdTable.Province.Format(PersonalIdTable.Province.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetRankId() + + + ' Set the RankId DropDownList on the webpage with value from the + ' PersonalId database record. + + ' Me.DataSource is the PersonalId record retrieved from the database. + ' Me.RankId is the ASP:DropDownList on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetRankId() + ' and add your own code before or after the call to the MyBase function. + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.RankIdSpecified Then + + ' If the RankId is non-NULL, then format the value. + ' The Format method will use the Display Format + Me.PopulateRankIdDropDownList(Me.DataSource.RankId.ToString(), 100) + + Else + + ' RankId 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.PopulateRankIdDropDownList(Nothing, 100) + Else + Me.PopulateRankIdDropDownList(PersonalIdTable.RankId.DefaultValue, 100) + End If + + End If + + End Sub + + Public Overridable Sub SetRegDate() + + + ' Set the RegDate TextBox on the webpage with value from the + ' PersonalId database record. + + ' Me.DataSource is the PersonalId record retrieved from the database. + ' Me.RegDate is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetRegDate() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.RegDateSpecified Then + + ' If the RegDate is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalIdTable.RegDate, "d MMM yyyy") + + Me.RegDate.Text = formattedValue + + Else + + ' RegDate is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.RegDate.Text = PersonalIdTable.RegDate.Format(PersonalIdTable.RegDate.DefaultValue, "d MMM yyyy") + + End If + + End Sub + + Public Overridable Sub SetRegNo1() + + + ' Set the RegNo1 TextBox on the webpage with value from the + ' PersonalId database record. + + ' Me.DataSource is the PersonalId record retrieved from the database. + ' Me.RegNo1 is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetRegNo1() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.RegNo1Specified Then + + ' If the RegNo1 is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalIdTable.RegNo1) + + Me.RegNo1.Text = formattedValue + + Else + + ' RegNo1 is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.RegNo1.Text = PersonalIdTable.RegNo1.Format(PersonalIdTable.RegNo1.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetRegNo2() + + + ' Set the RegNo2 TextBox on the webpage with value from the + ' PersonalId database record. + + ' Me.DataSource is the PersonalId record retrieved from the database. + ' Me.RegNo2 is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetRegNo2() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.RegNo2Specified Then + + ' If the RegNo2 is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalIdTable.RegNo2) + + Me.RegNo2.Text = formattedValue + + Else + + ' RegNo2 is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.RegNo2.Text = PersonalIdTable.RegNo2.Format(PersonalIdTable.RegNo2.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetReligion() + + + ' Set the Religion TextBox on the webpage with value from the + ' PersonalId database record. + + ' Me.DataSource is the PersonalId record retrieved from the database. + ' Me.Religion is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetReligion() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.ReligionSpecified Then + + ' If the Religion is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalIdTable.Religion) + + Me.Religion.Text = formattedValue + + Else + + ' Religion is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.Religion.Text = PersonalIdTable.Religion.Format(PersonalIdTable.Religion.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetSectionId() + + + ' Set the SectionId DropDownList on the webpage with value from the + ' PersonalId database record. + + ' Me.DataSource is the PersonalId record retrieved from the database. + ' Me.SectionId is the ASP:DropDownList on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetSectionId() + ' and add your own code before or after the call to the MyBase function. + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.SectionIdSpecified Then + + ' If the SectionId is non-NULL, then format the value. + ' The Format method will return the Display Foreign Key As (DFKA) value + Me.PopulateSectionIdDropDownList(Me.DataSource.SectionId.ToString(), 100) + + Else + + ' SectionId 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.PopulateSectionIdDropDownList(Nothing, 100) + Else + Me.PopulateSectionIdDropDownList(PersonalIdTable.SectionId.DefaultValue, 100) + End If + + End If + + End Sub + + Public Overridable Sub SetSex() + + + ' Set the Sex DropDownList on the webpage with value from the + ' PersonalId database record. + + ' Me.DataSource is the PersonalId record retrieved from the database. + ' Me.Sex is the ASP:DropDownList on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetSex() + ' and add your own code before or after the call to the MyBase function. + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.SexSpecified Then + + ' If the Sex is non-NULL, then format the value. + ' The Format method will return the Display Foreign Key As (DFKA) value + Me.PopulateSexDropDownList(Me.DataSource.Sex.ToString(), 100) + + Else + + ' Sex 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.PopulateSexDropDownList(Nothing, 100) + Else + Me.PopulateSexDropDownList(PersonalIdTable.Sex.DefaultValue, 100) + End If + + End If + + End Sub + + Public Overridable Sub SetStatusId() + + + ' Set the StatusId DropDownList on the webpage with value from the + ' PersonalId database record. + + ' Me.DataSource is the PersonalId record retrieved from the database. + ' Me.StatusId is the ASP:DropDownList on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetStatusId() + ' and add your own code before or after the call to the MyBase function. + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.StatusIdSpecified Then + + ' If the StatusId is non-NULL, then format the value. + ' The Format method will return the Display Foreign Key As (DFKA) value + Me.PopulateStatusIdDropDownList(Me.DataSource.StatusId.ToString(), 100) + + Else + + ' StatusId 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.PopulateStatusIdDropDownList(Nothing, 100) + Else + Me.PopulateStatusIdDropDownList(PersonalIdTable.StatusId.DefaultValue, 100) + End If + + End If + + End Sub + + Public Overridable Sub SetTId() + + + ' Set the TId TextBox on the webpage with value from the + ' PersonalId database record. + + ' Me.DataSource is the PersonalId record retrieved from the database. + ' Me.TId is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetTId() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.TIdSpecified Then + + ' If the TId is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalIdTable.TId) + + Me.TId.Text = formattedValue + + Else + + ' TId is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.TId.Text = PersonalIdTable.TId.Format(PersonalIdTable.TId.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetAddrLabel() + + End Sub + + Public Overridable Sub SetAmphurLabel() + + End Sub + + Public Overridable Sub SetArmIdLabel() + + End Sub + + Public Overridable Sub SetArmyIdLabel() + + End Sub + + Public Overridable Sub SetArmyWelfareMemIdLabel() + + End Sub + + Public Overridable Sub SetBAmphurLabel() + + End Sub + + Public Overridable Sub SetBirthDateLabel() + + End Sub + + Public Overridable Sub SetBloodIdLabel() + + End Sub + + Public Overridable Sub SetBornLabel() + + End Sub + + Public Overridable Sub SetBProvinceLabel() + + End Sub + + Public Overridable Sub SetCremateMemIdLabel() + + End Sub + + Public Overridable Sub SetDeptIdLabel() + + End Sub + + Public Overridable Sub SetMIdLabel() + + End Sub + + Public Overridable Sub SetMobilePhoneLabel() + + End Sub + + Public Overridable Sub SetNationalityLabel() + + End Sub + + Public Overridable Sub SetOfficerDateLabel() + + End Sub + + Public Overridable Sub SetOriginLabel() + + End Sub + + Public Overridable Sub SetPersonalIdLabel() + + End Sub + + Public Overridable Sub SetPersonalIdRecordControlCollapsibleRegion() + + End Sub + + Public Overridable Sub SetPersonalIdRecordControlIcon() + + End Sub + + Public Overridable Sub SetPersonalIdRecordControlPanelExtender() + + End Sub + + Public Overridable Sub SetPersonalLastNameLabel() + + End Sub + + Public Overridable Sub SetPersonalNameLabel() + + End Sub + + Public Overridable Sub SetPhoneExtLabel() + + End Sub + + Public Overridable Sub SetPhoneLabel() + + End Sub + + Public Overridable Sub SetpictureLabel() + + End Sub + + Public Overridable Sub SetPlaceOfBirthLabel() + + End Sub + + Public Overridable Sub SetPostCodeLabel() + + End Sub + + Public Overridable Sub SetProvinceLabel() + + End Sub + + Public Overridable Sub SetRankIdLabel() + + End Sub + + Public Overridable Sub SetRegDateLabel() + + End Sub + + Public Overridable Sub SetRegNo1Label() + + End Sub + + Public Overridable Sub SetRegNo2Label() + + End Sub + + Public Overridable Sub SetReligionLabel() + + End Sub + + Public Overridable Sub SetSectionIdLabel() + + End Sub + + Public Overridable Sub SetSexLabel() + + End Sub + + Public Overridable Sub SetStatusIdLabel() + + End Sub + + Public Overridable Sub SetTIdLabel() + + 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 PersonalIdRecordControl. + Public Overridable Sub SaveData() + ' Saves the associated record in the database. + ' SaveData calls Validate and Get methods - so it may be more appropriate to + ' customize those methods. + + ' 1. Load the existing record from the database. Since we save the entire record, this ensures + ' that fields that are not displayed are also properly initialized. + Me.LoadData() + + Dim Panel As System.Web.UI.WebControls.Panel = CType(MiscUtils.FindControlRecursively(Me, "PersonalIdRecordControlPanel"), System.Web.UI.WebControls.Panel) + + If ((Not IsNothing(Panel)) AndAlso (Not Panel.Visible)) OrElse IsNothing(Me.DataSource) Then + Return + End If + + + ' 2. Perform any custom validation. + Me.Validate() + + + ' 3. Set the values in the record with data from UI controls. + ' This calls the Get() method for each of the user interface controls. + Me.GetUIData() + + ' 4. Save in the database. + ' We should not save the record if the data did not change. This + ' will save a database hit and avoid triggering any database triggers. + + If Me.DataSource.IsAnyValueChanged Then + ' Save record to database but do not commit yet. + ' Auto generated ids are available after saving for use by child (dependent) records. + Me.DataSource.Save() + + End If + + + ' update session or cookie by formula + + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + ' For Master-Detail relationships, save data on the Detail table(s) + + End Sub + + ' To customize, override this method in PersonalIdRecordControl. + Public Overridable Sub GetUIData() + ' The GetUIData method retrieves the updated values from the user interface + ' controls into a database record in preparation for saving or updating. + ' To do this, it calls the Get methods for each of the field displayed on + ' the webpage. It is better to make changes in the Get methods, rather + ' than making changes here. + + ' Call the Get methods for each of the user interface controls. + + GetAddr() + GetAmphur() + GetArmId() + GetArmyId() + GetArmyWelfareMemId() + GetBAmphur() + GetBirthDate() + GetBloodId() + GetBorn() + GetBProvince() + GetCremateMemId() + GetDeptId() + GetMId() + GetMobilePhone() + GetNationality() + GetOfficerDate() + GetOrigin() + GetPersonalId() + GetPersonalLastName() + GetPersonalName() + GetPhone() + GetPhoneExt() + Getpicture() + GetPlaceOfBirth() + GetPostCode() + GetProvince() + GetRankId() + GetRegDate() + GetRegNo1() + GetRegNo2() + GetReligion() + GetSectionId() + GetSex() + GetStatusId() + GetTId() + End Sub + + + Public Overridable Sub GetAddr() + + ' Retrieve the value entered by the user on the Addr ASP:TextBox, and + ' save it into the Addr field in DataSource PersonalId record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.Addr.Text, PersonalIdTable.Addr) + + + End Sub + + Public Overridable Sub GetAmphur() + + ' Retrieve the value entered by the user on the Amphur ASP:TextBox, and + ' save it into the Amphur field in DataSource PersonalId record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.Amphur.Text, PersonalIdTable.Amphur) + + + End Sub + + Public Overridable Sub GetArmId() + + ' Retrieve the value entered by the user on the ArmId ASP:DropDownList, and + ' save it into the ArmId field in DataSource PersonalId record. + + ' Custom validation should be performed in Validate, not here. + + Me.DataSource.Parse(GetValueSelectedPageRequest(Me.ArmId), PersonalIdTable.ArmId) + + End Sub + + Public Overridable Sub GetArmyId() + + ' Retrieve the value entered by the user on the ArmyId ASP:DropDownList, and + ' save it into the ArmyId field in DataSource PersonalId record. + + ' Custom validation should be performed in Validate, not here. + + Me.DataSource.Parse(GetValueSelectedPageRequest(Me.ArmyId), PersonalIdTable.ArmyId) + + End Sub + + Public Overridable Sub GetArmyWelfareMemId() + + ' Retrieve the value entered by the user on the ArmyWelfareMemId ASP:TextBox, and + ' save it into the ArmyWelfareMemId field in DataSource PersonalId record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.ArmyWelfareMemId.Text, PersonalIdTable.ArmyWelfareMemId) + + + End Sub + + Public Overridable Sub GetBAmphur() + + ' Retrieve the value entered by the user on the BAmphur ASP:TextBox, and + ' save it into the BAmphur field in DataSource PersonalId record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.BAmphur.Text, PersonalIdTable.BAmphur) + + + End Sub + + Public Overridable Sub GetBirthDate() + + ' Retrieve the value entered by the user on the BirthDate ASP:TextBox, and + ' save it into the BirthDate field in DataSource PersonalId 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.BirthDate.Text, PersonalIdTable.BirthDate) + + + End Sub + + Public Overridable Sub GetBloodId() + + ' Retrieve the value entered by the user on the BloodId ASP:DropDownList, and + ' save it into the BloodId field in DataSource PersonalId record. + + ' Custom validation should be performed in Validate, not here. + + Me.DataSource.Parse(GetValueSelectedPageRequest(Me.BloodId), PersonalIdTable.BloodId) + + End Sub + + Public Overridable Sub GetBorn() + + ' Retrieve the value entered by the user on the Born ASP:DropDownList, and + ' save it into the Born field in DataSource PersonalId record. + + ' Custom validation should be performed in Validate, not here. + + Me.DataSource.Parse(GetValueSelectedPageRequest(Me.Born), PersonalIdTable.Born) + + End Sub + + Public Overridable Sub GetBProvince() + + ' Retrieve the value entered by the user on the BProvince ASP:TextBox, and + ' save it into the BProvince field in DataSource PersonalId record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.BProvince.Text, PersonalIdTable.BProvince) + + + End Sub + + Public Overridable Sub GetCremateMemId() + + ' Retrieve the value entered by the user on the CremateMemId ASP:TextBox, and + ' save it into the CremateMemId field in DataSource PersonalId record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.CremateMemId.Text, PersonalIdTable.CremateMemId) + + + End Sub + + Public Overridable Sub GetDeptId() + + ' Retrieve the value entered by the user on the DeptId ASP:DropDownList, and + ' save it into the DeptId field in DataSource PersonalId record. + + ' Custom validation should be performed in Validate, not here. + + Me.DataSource.Parse(GetValueSelectedPageRequest(Me.DeptId), PersonalIdTable.DeptId) + + End Sub + + Public Overridable Sub GetMId() + + ' Retrieve the value entered by the user on the MId ASP:TextBox, and + ' save it into the MId field in DataSource PersonalId record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.MId.Text, PersonalIdTable.MId) + + + End Sub + + Public Overridable Sub GetMobilePhone() + + ' Retrieve the value entered by the user on the MobilePhone ASP:TextBox, and + ' save it into the MobilePhone field in DataSource PersonalId record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.MobilePhone.Text, PersonalIdTable.MobilePhone) + + + End Sub + + Public Overridable Sub GetNationality() + + ' Retrieve the value entered by the user on the Nationality ASP:TextBox, and + ' save it into the Nationality field in DataSource PersonalId record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.Nationality.Text, PersonalIdTable.Nationality) + + + End Sub + + Public Overridable Sub GetOfficerDate() + + ' Retrieve the value entered by the user on the OfficerDate ASP:TextBox, and + ' save it into the OfficerDate field in DataSource PersonalId 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.OfficerDate.Text, PersonalIdTable.OfficerDate) + + + End Sub + + Public Overridable Sub GetOrigin() + + ' Retrieve the value entered by the user on the Origin ASP:TextBox, and + ' save it into the Origin field in DataSource PersonalId record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.Origin.Text, PersonalIdTable.Origin) + + + End Sub + + Public Overridable Sub GetPersonalId() + + ' Retrieve the value entered by the user on the PersonalId ASP:TextBox, and + ' save it into the PersonalId field in DataSource PersonalId record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.PersonalId.Text, PersonalIdTable.PersonalId) + + + End Sub + + Public Overridable Sub GetPersonalLastName() + + ' Retrieve the value entered by the user on the PersonalLastName ASP:TextBox, and + ' save it into the PersonalLastName field in DataSource PersonalId record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.PersonalLastName.Text, PersonalIdTable.PersonalLastName) + + + End Sub + + Public Overridable Sub GetPersonalName() + + ' Retrieve the value entered by the user on the PersonalName ASP:TextBox, and + ' save it into the PersonalName field in DataSource PersonalId record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.PersonalName.Text, PersonalIdTable.PersonalName) + + + End Sub + + Public Overridable Sub GetPhone() + + ' Retrieve the value entered by the user on the Phone ASP:TextBox, and + ' save it into the Phone field in DataSource PersonalId record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.Phone.Text, PersonalIdTable.Phone) + + + End Sub + + Public Overridable Sub GetPhoneExt() + + ' Retrieve the value entered by the user on the PhoneExt ASP:TextBox, and + ' save it into the PhoneExt field in DataSource PersonalId record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.PhoneExt.Text, PersonalIdTable.PhoneExt) + + + End Sub + + Public Overridable Sub Getpicture() + ' Retrieve the value entered by the user on the picture ASP:FileUpload, and + ' save it into the picture field in DataSource PersonalId record. + ' Custom validation should be performed in Validate, not here. + + If Not Me.picture.PostedFile is Nothing then + If Me.picture.PostedFile.FileName.Length > 0 AndAlso Me.picture.PostedFile.ContentLength > 0 Then + ' Retrieve the file contents and store them in picture field. + Me.DataSource.Parse(MiscUtils.GetFileContent(Me.picture.PostedFile), PersonalIdTable.picture) + + ' If there is a FileName companion field specified, then save the file name as well. + ' Strip off the path and just save the part after the last \ + Dim path As String = Me.picture.PostedFile.FileName + Dim LastIndex As Integer = path.LastIndexOf("\") + + Me.DataSource.PictureName = path.Substring(LastIndex + 1).Replace("'", "_") + + End If + End If + End Sub + + Public Overridable Sub GetPlaceOfBirth() + + ' Retrieve the value entered by the user on the PlaceOfBirth ASP:TextBox, and + ' save it into the PlaceOfBirth field in DataSource PersonalId record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.PlaceOfBirth.Text, PersonalIdTable.PlaceOfBirth) + + + End Sub + + Public Overridable Sub GetPostCode() + + ' Retrieve the value entered by the user on the PostCode ASP:TextBox, and + ' save it into the PostCode field in DataSource PersonalId record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.PostCode.Text, PersonalIdTable.PostCode) + + + End Sub + + Public Overridable Sub GetProvince() + + ' Retrieve the value entered by the user on the Province ASP:TextBox, and + ' save it into the Province field in DataSource PersonalId record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.Province.Text, PersonalIdTable.Province) + + + End Sub + + Public Overridable Sub GetRankId() + + ' Retrieve the value entered by the user on the RankId ASP:DropDownList, and + ' save it into the RankId field in DataSource PersonalId record. + + ' Custom validation should be performed in Validate, not here. + + Me.DataSource.Parse(GetValueSelectedPageRequest(Me.RankId), PersonalIdTable.RankId) + + End Sub + + Public Overridable Sub GetRegDate() + + ' Retrieve the value entered by the user on the RegDate ASP:TextBox, and + ' save it into the RegDate field in DataSource PersonalId 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.RegDate.Text, PersonalIdTable.RegDate) + + + End Sub + + Public Overridable Sub GetRegNo1() + + ' Retrieve the value entered by the user on the RegNo1 ASP:TextBox, and + ' save it into the RegNo1 field in DataSource PersonalId record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.RegNo1.Text, PersonalIdTable.RegNo1) + + + End Sub + + Public Overridable Sub GetRegNo2() + + ' Retrieve the value entered by the user on the RegNo2 ASP:TextBox, and + ' save it into the RegNo2 field in DataSource PersonalId record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.RegNo2.Text, PersonalIdTable.RegNo2) + + + End Sub + + Public Overridable Sub GetReligion() + + ' Retrieve the value entered by the user on the Religion ASP:TextBox, and + ' save it into the Religion field in DataSource PersonalId record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.Religion.Text, PersonalIdTable.Religion) + + + End Sub + + Public Overridable Sub GetSectionId() + + ' Retrieve the value entered by the user on the SectionId ASP:DropDownList, and + ' save it into the SectionId field in DataSource PersonalId record. + + ' Custom validation should be performed in Validate, not here. + + Me.DataSource.Parse(GetValueSelectedPageRequest(Me.SectionId), PersonalIdTable.SectionId) + + End Sub + + Public Overridable Sub GetSex() + + ' Retrieve the value entered by the user on the Sex ASP:DropDownList, and + ' save it into the Sex field in DataSource PersonalId record. + + ' Custom validation should be performed in Validate, not here. + + Me.DataSource.Parse(GetValueSelectedPageRequest(Me.Sex), PersonalIdTable.Sex) + + End Sub + + Public Overridable Sub GetStatusId() + + ' Retrieve the value entered by the user on the StatusId ASP:DropDownList, and + ' save it into the StatusId field in DataSource PersonalId record. + + ' Custom validation should be performed in Validate, not here. + + Me.DataSource.Parse(GetValueSelectedPageRequest(Me.StatusId), PersonalIdTable.StatusId) + + End Sub + + Public Overridable Sub GetTId() + + ' Retrieve the value entered by the user on the TId ASP:TextBox, and + ' save it into the TId field in DataSource PersonalId record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.TId.Text, PersonalIdTable.TId) + + + End Sub + + + ' To customize, override this method in PersonalIdRecordControl. + + Public Overridable Function CreateWhereClause() As WhereClause + + Dim wc As WhereClause + PersonalIdTable.Instance.InnerFilter = Nothing + wc = New WhereClause() + + ' Compose the WHERE clause consiting of: + ' 1. Static clause defined at design time. + ' 2. User selected filter criteria. + ' 3. User selected search criteria. + + + ' Get the static clause defined at design time on the Record Panel Wizard + + Dim qc As WhereClause = Me.CreateQueryClause() + If Not(IsNothing(qc)) Then + wc.iAND(qc) + End If + + Return wc + + End Function + + Protected Overridable Function CreateQueryClause() As WhereClause + ' Create a where clause for the Static clause defined at design time. + Dim filter As CompoundFilter = New CompoundFilter(CompoundFilter.CompoundingOperators.And_Operator, Nothing) + Dim whereClause As WhereClause = New WhereClause() + + filter.AddFilter(New BaseClasses.Data.SignedInUserFilter(BaseClasses.Data.BaseTable.CreateInstance("Persons.Business.PersonalIdTable, App_Code").TableDefinition.ColumnList.GetByUniqueName("PersonalId_.PersonalId"), New BaseClasses.Data.IdentifierAliasInfo("PersonalId_", Nothing), BaseClasses.Data.BaseFilter.ComparisonOperator.EqualsTo, False)) + + whereClause.AddFilter(filter, CompoundFilter.CompoundingOperators.And_Operator) + + Return whereClause + + End Function + + ' This CreateWhereClause is used for loading list of suggestions for Auto Type-Ahead feature. + + Public Overridable Function CreateWhereClause(ByVal searchText As String, ByVal fromSearchControl As String, ByVal AutoTypeAheadSearch As String, ByVal AutoTypeAheadWordSeparators As String) As WhereClause + PersonalIdTable.Instance.InnerFilter = Nothing + Dim wc As WhereClause = New WhereClause() + + ' Compose the WHERE clause consiting of: + ' 1. Static clause defined at design time. + ' 2. User selected filter criteria. + ' 3. User selected search criteria. + Dim appRelativeVirtualPath As String = CType(HttpContext.Current.Session("AppRelativeVirtualPath"), String) + + + ' Get the static clause defined at design time on the Table Panel Wizard + Dim qc As WhereClause = Me.CreateQueryClause() + If Not(IsNothing(qc)) Then + wc.iAND(qc) ''nope nothing + End If + + ' 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 PersonalIdRecordControl. + Public Overridable Sub Validate() + ' Add custom validation for any control within this panel. + ' Example. If you have a State ASP:Textbox control + ' If Me.State.Text <> "CA" Then + ' Throw New Exception("State must be CA (California).") + ' End If + + ' The Validate method is common across all controls within + ' this panel so you can validate multiple fields, but report + ' one error message. + + + End Sub + + Public Overridable Sub Delete() + + If Me.IsNewRecord() Then + Return + End If + + Dim pkValue As KeyValue = KeyValue.XmlToKey(Me.RecordUniqueId) + PersonalIdTable.DeleteRecord(pkValue) + + End Sub + + Protected Overridable Sub Control_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.PreRender + ' PreRender event is raised just before page is being displayed. + Try + DbUtils.StartTransaction() + Me.RegisterPostback() + + If Not Me.Page.ErrorOnPage AndAlso (Me.Page.IsPageRefresh OrElse Me.DataChanged OrElse Me.ResetData) Then + + + ' Re-load the data and update the web page if necessary. + ' This is typically done during a postback (filter, search button, sort, pagination button). + ' In each of the other click handlers, simply set DataChanged to True to reload the data. + Me.LoadData() + Me.DataBind() + End If + + + Catch ex As Exception + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + Finally + DbUtils.EndTransaction() + End Try + End Sub + + + Protected Overrides Sub SaveControlsToSession() + MyBase.SaveControlsToSession() + + + 'Save 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_ArmIdDropDownList() 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 Arm table. + ' Examples: + ' wc.iAND(ArmTable.ArmSName, BaseFilter.ComparisonOperator.EqualsTo, "XYZ") + ' wc.iAND(ArmTable.Active, BaseFilter.ComparisonOperator.EqualsTo, "1") + + Dim wc As WhereClause = New WhereClause() + Return wc + + End Function + + + + Public Overridable Function CreateWhereClause_ArmyIdDropDownList() 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 Army table. + ' Examples: + ' wc.iAND(ArmyTable.Army, BaseFilter.ComparisonOperator.EqualsTo, "XYZ") + ' wc.iAND(ArmyTable.Active, BaseFilter.ComparisonOperator.EqualsTo, "1") + + Dim wc As WhereClause = New WhereClause() + Return wc + + End Function + + + + Public Overridable Function CreateWhereClause_BloodIdDropDownList() 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 BloodId table. + ' Examples: + ' wc.iAND(BloodIdTable.BloodName, BaseFilter.ComparisonOperator.EqualsTo, "XYZ") + ' wc.iAND(BloodIdTable.Active, BaseFilter.ComparisonOperator.EqualsTo, "1") + + Dim wc As WhereClause = New WhereClause() + Return wc + + End Function + + + + Public Overridable Function CreateWhereClause_BornDropDownList() 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 Born table. + ' Examples: + ' wc.iAND(BornTable.BornDesc, BaseFilter.ComparisonOperator.EqualsTo, "XYZ") + ' wc.iAND(BornTable.Active, BaseFilter.ComparisonOperator.EqualsTo, "1") + + Dim wc As WhereClause = New WhereClause() + Return wc + + End Function + + + + Public Overridable Function CreateWhereClause_DeptIdDropDownList() 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 Dept table. + ' Examples: + ' wc.iAND(DeptTable.Dept, BaseFilter.ComparisonOperator.EqualsTo, "XYZ") + ' wc.iAND(DeptTable.Active, BaseFilter.ComparisonOperator.EqualsTo, "1") + + Dim wc As WhereClause = New WhereClause() + Return wc + + End Function + + + + Public Overridable Function CreateWhereClause_RankIdDropDownList() As WhereClause + ' By default, we simply return a new WhereClause. + ' Add additional where clauses to restrict the items shown in the dropdown list. + + Dim wc As WhereClause = New WhereClause() + Return wc + + End Function + + + + Public Overridable Function CreateWhereClause_SectionIdDropDownList() 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 Section table. + ' Examples: + ' wc.iAND(SectionTable.SectionName, BaseFilter.ComparisonOperator.EqualsTo, "XYZ") + ' wc.iAND(SectionTable.Active, BaseFilter.ComparisonOperator.EqualsTo, "1") + + Dim wc As WhereClause = New WhereClause() + Return wc + + End Function + + + + Public Overridable Function CreateWhereClause_SexDropDownList() 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 Sex table. + ' Examples: + ' wc.iAND(SexTable.Sex, BaseFilter.ComparisonOperator.EqualsTo, "XYZ") + ' wc.iAND(SexTable.Active, BaseFilter.ComparisonOperator.EqualsTo, "1") + + Dim wc As WhereClause = New WhereClause() + Return wc + + End Function + + + + Public Overridable Function CreateWhereClause_StatusIdDropDownList() 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 Status table. + ' Examples: + ' wc.iAND(StatusTable.Status, BaseFilter.ComparisonOperator.EqualsTo, "XYZ") + ' wc.iAND(StatusTable.Active, BaseFilter.ComparisonOperator.EqualsTo, "1") + + Dim wc As WhereClause = New WhereClause() + Return wc + + End Function + + + ' Fill the ArmId list. + Protected Overridable Sub PopulateArmIdDropDownList( _ + ByVal selectedValue As String, _ + ByVal maxItems As Integer) + + Me.ArmId.Items.Clear() + + + ' 1. Setup the static list items + + ' Add the Please Select item. + Me.ArmId.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_ArmIdDropDownList function. + ' It is better to customize the where clause there. + + Dim wc As WhereClause = CreateWhereClause_ArmIdDropDownList() + ' Create the ORDER BY clause to sort based on the displayed value. + + + Dim orderBy As OrderBy = New OrderBy(false, false) + orderBy.Add(ArmTable.ArmSName, 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 ArmRecord = 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 = ArmTable.GetRecords(wc, orderBy, pageNum, maxItems) + For each itemValue As ArmRecord In itemValues + ' Create the item and add to the list. + Dim cvalue As String = Nothing + Dim fvalue As String = Nothing + If itemValue.ArmIdSpecified Then + cvalue = itemValue.ArmId.ToString() + + If counter < maxItems AndAlso Me.ArmId.Items.FindByValue(cvalue) Is Nothing Then + + Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalIdTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalIdTable.ArmId) + If _isExpandableNonCompositeForeignKey AndAlso PersonalIdTable.ArmId.IsApplyDisplayAs Then + fvalue = PersonalIdTable.GetDFKA(itemValue, PersonalIdTable.ArmId) + End If + If (Not _isExpandableNonCompositeForeignKey) Or (String.IsNullOrEmpty(fvalue)) Then + fvalue = itemValue.Format(ArmTable.ArmSName) + 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.ArmId.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.ArmId.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.ArmId, selectedValue) AndAlso _ + Not SetSelectedDisplayText(Me.ArmId, selectedValue)Then + + ' construct a whereclause to query a record with Arm.ArmId = selectedValue + Dim filter2 As CompoundFilter = New CompoundFilter(CompoundFilter.CompoundingOperators.And_Operator, Nothing) + Dim whereClause2 As WhereClause = New WhereClause() + filter2.AddFilter(New BaseClasses.Data.ColumnValueFilter(ArmTable.ArmId, selectedValue, BaseClasses.Data.BaseFilter.ComparisonOperator.EqualsTo, False)) + whereClause2.AddFilter(filter2, CompoundFilter.CompoundingOperators.And_Operator) + + Try + ' Execute the query + Dim rc() As ArmRecord = ArmTable.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 ArmRecord = DirectCast(rc(0), ArmRecord) + ' Create the item and add to the list. + Dim cvalue As String = Nothing + Dim fvalue As String = Nothing + If itemValue.ArmIdSpecified Then + cvalue = itemValue.ArmId.ToString() + Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalIdTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalIdTable.ArmId) + If _isExpandableNonCompositeForeignKey AndAlso PersonalIdTable.ArmId.IsApplyDisplayAs Then + fvalue = PersonalIdTable.GetDFKA(itemValue, PersonalIdTable.ArmId) + End If + If (Not _isExpandableNonCompositeForeignKey) Or (String.IsNullOrEmpty(fvalue)) Then + fvalue = itemValue.Format(ArmTable.ArmSName) + End If + + If fvalue Is Nothing OrElse fvalue.Trim() = "" Then fvalue = cvalue + Dim newItem As New ListItem(fvalue, cvalue) + Me.ArmId.Items.Add(newItem) + SetSelectedValue(Me.ArmId, selectedValue) + End If + End If + Catch + End Try + + End If + + + End Sub + + ' Fill the ArmyId list. + Protected Overridable Sub PopulateArmyIdDropDownList( _ + ByVal selectedValue As String, _ + ByVal maxItems As Integer) + + Me.ArmyId.Items.Clear() + + + ' 1. Setup the static list items + + ' Add the Please Select item. + Me.ArmyId.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_ArmyIdDropDownList function. + ' It is better to customize the where clause there. + + Dim wc As WhereClause = CreateWhereClause_ArmyIdDropDownList() + ' Create the ORDER BY clause to sort based on the displayed value. + + + Dim orderBy As OrderBy = New OrderBy(false, false) + orderBy.Add(ArmyTable.Army, 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 ArmyRecord = 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 = ArmyTable.GetRecords(wc, orderBy, pageNum, maxItems) + For each itemValue As ArmyRecord In itemValues + ' Create the item and add to the list. + Dim cvalue As String = Nothing + Dim fvalue As String = Nothing + If itemValue.ArmyIdSpecified Then + cvalue = itemValue.ArmyId.ToString() + + If counter < maxItems AndAlso Me.ArmyId.Items.FindByValue(cvalue) Is Nothing Then + + Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalIdTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalIdTable.ArmyId) + If _isExpandableNonCompositeForeignKey AndAlso PersonalIdTable.ArmyId.IsApplyDisplayAs Then + fvalue = PersonalIdTable.GetDFKA(itemValue, PersonalIdTable.ArmyId) + End If + If (Not _isExpandableNonCompositeForeignKey) Or (String.IsNullOrEmpty(fvalue)) Then + fvalue = itemValue.Format(ArmyTable.Army) + 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.ArmyId.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.ArmyId.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.ArmyId, selectedValue) AndAlso _ + Not SetSelectedDisplayText(Me.ArmyId, selectedValue)Then + + ' construct a whereclause to query a record with Army.ArmyId = selectedValue + Dim filter2 As CompoundFilter = New CompoundFilter(CompoundFilter.CompoundingOperators.And_Operator, Nothing) + Dim whereClause2 As WhereClause = New WhereClause() + filter2.AddFilter(New BaseClasses.Data.ColumnValueFilter(ArmyTable.ArmyId, selectedValue, BaseClasses.Data.BaseFilter.ComparisonOperator.EqualsTo, False)) + whereClause2.AddFilter(filter2, CompoundFilter.CompoundingOperators.And_Operator) + + Try + ' Execute the query + Dim rc() As ArmyRecord = ArmyTable.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 ArmyRecord = DirectCast(rc(0), ArmyRecord) + ' Create the item and add to the list. + Dim cvalue As String = Nothing + Dim fvalue As String = Nothing + If itemValue.ArmyIdSpecified Then + cvalue = itemValue.ArmyId.ToString() + Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalIdTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalIdTable.ArmyId) + If _isExpandableNonCompositeForeignKey AndAlso PersonalIdTable.ArmyId.IsApplyDisplayAs Then + fvalue = PersonalIdTable.GetDFKA(itemValue, PersonalIdTable.ArmyId) + End If + If (Not _isExpandableNonCompositeForeignKey) Or (String.IsNullOrEmpty(fvalue)) Then + fvalue = itemValue.Format(ArmyTable.Army) + End If + + If fvalue Is Nothing OrElse fvalue.Trim() = "" Then fvalue = cvalue + Dim newItem As New ListItem(fvalue, cvalue) + Me.ArmyId.Items.Add(newItem) + SetSelectedValue(Me.ArmyId, selectedValue) + End If + End If + Catch + End Try + + End If + + + End Sub + + ' Fill the BloodId list. + Protected Overridable Sub PopulateBloodIdDropDownList( _ + ByVal selectedValue As String, _ + ByVal maxItems As Integer) + + Me.BloodId.Items.Clear() + + + ' 1. Setup the static list items + + ' Add the Please Select item. + Me.BloodId.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_BloodIdDropDownList function. + ' It is better to customize the where clause there. + + Dim wc As WhereClause = CreateWhereClause_BloodIdDropDownList() + ' Create the ORDER BY clause to sort based on the displayed value. + + + Dim orderBy As OrderBy = New OrderBy(false, false) + orderBy.Add(BloodIdTable.BloodName, 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 BloodIdRecord = 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 = BloodIdTable.GetRecords(wc, orderBy, pageNum, maxItems) + For each itemValue As BloodIdRecord In itemValues + ' Create the item and add to the list. + Dim cvalue As String = Nothing + Dim fvalue As String = Nothing + If itemValue.BloodIdSpecified Then + cvalue = itemValue.BloodId.ToString() + + If counter < maxItems AndAlso Me.BloodId.Items.FindByValue(cvalue) Is Nothing Then + + Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalIdTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalIdTable.BloodId) + If _isExpandableNonCompositeForeignKey AndAlso PersonalIdTable.BloodId.IsApplyDisplayAs Then + fvalue = PersonalIdTable.GetDFKA(itemValue, PersonalIdTable.BloodId) + End If + If (Not _isExpandableNonCompositeForeignKey) Or (String.IsNullOrEmpty(fvalue)) Then + fvalue = itemValue.Format(BloodIdTable.BloodName) + 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.BloodId.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.BloodId.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.BloodId, selectedValue) AndAlso _ + Not SetSelectedDisplayText(Me.BloodId, selectedValue)Then + + ' construct a whereclause to query a record with BloodId.BloodId = selectedValue + Dim filter2 As CompoundFilter = New CompoundFilter(CompoundFilter.CompoundingOperators.And_Operator, Nothing) + Dim whereClause2 As WhereClause = New WhereClause() + filter2.AddFilter(New BaseClasses.Data.ColumnValueFilter(BloodIdTable.BloodId, selectedValue, BaseClasses.Data.BaseFilter.ComparisonOperator.EqualsTo, False)) + whereClause2.AddFilter(filter2, CompoundFilter.CompoundingOperators.And_Operator) + + Try + ' Execute the query + Dim rc() As BloodIdRecord = BloodIdTable.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 BloodIdRecord = DirectCast(rc(0), BloodIdRecord) + ' Create the item and add to the list. + Dim cvalue As String = Nothing + Dim fvalue As String = Nothing + If itemValue.BloodIdSpecified Then + cvalue = itemValue.BloodId.ToString() + Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalIdTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalIdTable.BloodId) + If _isExpandableNonCompositeForeignKey AndAlso PersonalIdTable.BloodId.IsApplyDisplayAs Then + fvalue = PersonalIdTable.GetDFKA(itemValue, PersonalIdTable.BloodId) + End If + If (Not _isExpandableNonCompositeForeignKey) Or (String.IsNullOrEmpty(fvalue)) Then + fvalue = itemValue.Format(BloodIdTable.BloodName) + End If + + If fvalue Is Nothing OrElse fvalue.Trim() = "" Then fvalue = cvalue + Dim newItem As New ListItem(fvalue, cvalue) + Me.BloodId.Items.Add(newItem) + SetSelectedValue(Me.BloodId, selectedValue) + End If + End If + Catch + End Try + + End If + + + End Sub + + ' Fill the Born list. + Protected Overridable Sub PopulateBornDropDownList( _ + ByVal selectedValue As String, _ + ByVal maxItems As Integer) + + Me.Born.Items.Clear() + + + ' 1. Setup the static list items + + ' Add the Please Select item. + Me.Born.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_BornDropDownList function. + ' It is better to customize the where clause there. + + Dim wc As WhereClause = CreateWhereClause_BornDropDownList() + ' Create the ORDER BY clause to sort based on the displayed value. + + + Dim orderBy As OrderBy = New OrderBy(false, false) + orderBy.Add(BornTable.BornDesc, 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 BornRecord = 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 = BornTable.GetRecords(wc, orderBy, pageNum, maxItems) + For each itemValue As BornRecord In itemValues + ' Create the item and add to the list. + Dim cvalue As String = Nothing + Dim fvalue As String = Nothing + If itemValue.BornSpecified Then + cvalue = itemValue.Born.ToString() + + If counter < maxItems AndAlso Me.Born.Items.FindByValue(cvalue) Is Nothing Then + + Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalIdTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalIdTable.Born) + If _isExpandableNonCompositeForeignKey AndAlso PersonalIdTable.Born.IsApplyDisplayAs Then + fvalue = PersonalIdTable.GetDFKA(itemValue, PersonalIdTable.Born) + End If + If (Not _isExpandableNonCompositeForeignKey) Or (String.IsNullOrEmpty(fvalue)) Then + fvalue = itemValue.Format(BornTable.BornDesc) + 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.Born.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.Born.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.Born, selectedValue) AndAlso _ + Not SetSelectedDisplayText(Me.Born, selectedValue)Then + + ' construct a whereclause to query a record with Born.Born = selectedValue + Dim filter2 As CompoundFilter = New CompoundFilter(CompoundFilter.CompoundingOperators.And_Operator, Nothing) + Dim whereClause2 As WhereClause = New WhereClause() + filter2.AddFilter(New BaseClasses.Data.ColumnValueFilter(BornTable.Born, selectedValue, BaseClasses.Data.BaseFilter.ComparisonOperator.EqualsTo, False)) + whereClause2.AddFilter(filter2, CompoundFilter.CompoundingOperators.And_Operator) + + Try + ' Execute the query + Dim rc() As BornRecord = BornTable.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 BornRecord = DirectCast(rc(0), BornRecord) + ' Create the item and add to the list. + Dim cvalue As String = Nothing + Dim fvalue As String = Nothing + If itemValue.BornSpecified Then + cvalue = itemValue.Born.ToString() + Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalIdTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalIdTable.Born) + If _isExpandableNonCompositeForeignKey AndAlso PersonalIdTable.Born.IsApplyDisplayAs Then + fvalue = PersonalIdTable.GetDFKA(itemValue, PersonalIdTable.Born) + End If + If (Not _isExpandableNonCompositeForeignKey) Or (String.IsNullOrEmpty(fvalue)) Then + fvalue = itemValue.Format(BornTable.BornDesc) + End If + + If fvalue Is Nothing OrElse fvalue.Trim() = "" Then fvalue = cvalue + Dim newItem As New ListItem(fvalue, cvalue) + Me.Born.Items.Add(newItem) + SetSelectedValue(Me.Born, selectedValue) + End If + End If + Catch + End Try + + End If + + + End Sub + + ' Fill the DeptId list. + Protected Overridable Sub PopulateDeptIdDropDownList( _ + ByVal selectedValue As String, _ + ByVal maxItems As Integer) + + Me.DeptId.Items.Clear() + + + ' 1. Setup the static list items + + ' Add the Please Select item. + Me.DeptId.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_DeptIdDropDownList function. + ' It is better to customize the where clause there. + + Dim wc As WhereClause = CreateWhereClause_DeptIdDropDownList() + ' Create the ORDER BY clause to sort based on the displayed value. + + + Dim orderBy As OrderBy = New OrderBy(false, false) + orderBy.Add(DeptTable.Dept, 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 DeptRecord = 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 = DeptTable.GetRecords(wc, orderBy, pageNum, maxItems) + For each itemValue As DeptRecord In itemValues + ' Create the item and add to the list. + Dim cvalue As String = Nothing + Dim fvalue As String = Nothing + If itemValue.DeptIdSpecified Then + cvalue = itemValue.DeptId.ToString() + + If counter < maxItems AndAlso Me.DeptId.Items.FindByValue(cvalue) Is Nothing Then + + Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalIdTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalIdTable.DeptId) + If _isExpandableNonCompositeForeignKey AndAlso PersonalIdTable.DeptId.IsApplyDisplayAs Then + fvalue = PersonalIdTable.GetDFKA(itemValue, PersonalIdTable.DeptId) + End If + If (Not _isExpandableNonCompositeForeignKey) Or (String.IsNullOrEmpty(fvalue)) Then + fvalue = itemValue.Format(DeptTable.Dept) + 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.DeptId.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.DeptId.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.DeptId, selectedValue) AndAlso _ + Not SetSelectedDisplayText(Me.DeptId, selectedValue)Then + + ' construct a whereclause to query a record with Dept.DeptId = selectedValue + Dim filter2 As CompoundFilter = New CompoundFilter(CompoundFilter.CompoundingOperators.And_Operator, Nothing) + Dim whereClause2 As WhereClause = New WhereClause() + filter2.AddFilter(New BaseClasses.Data.ColumnValueFilter(DeptTable.DeptId, selectedValue, BaseClasses.Data.BaseFilter.ComparisonOperator.EqualsTo, False)) + whereClause2.AddFilter(filter2, CompoundFilter.CompoundingOperators.And_Operator) + + Try + ' Execute the query + Dim rc() As DeptRecord = DeptTable.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 DeptRecord = DirectCast(rc(0), DeptRecord) + ' Create the item and add to the list. + Dim cvalue As String = Nothing + Dim fvalue As String = Nothing + If itemValue.DeptIdSpecified Then + cvalue = itemValue.DeptId.ToString() + Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalIdTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalIdTable.DeptId) + If _isExpandableNonCompositeForeignKey AndAlso PersonalIdTable.DeptId.IsApplyDisplayAs Then + fvalue = PersonalIdTable.GetDFKA(itemValue, PersonalIdTable.DeptId) + End If + If (Not _isExpandableNonCompositeForeignKey) Or (String.IsNullOrEmpty(fvalue)) Then + fvalue = itemValue.Format(DeptTable.Dept) + End If + + If fvalue Is Nothing OrElse fvalue.Trim() = "" Then fvalue = cvalue + Dim newItem As New ListItem(fvalue, cvalue) + Me.DeptId.Items.Add(newItem) + SetSelectedValue(Me.DeptId, selectedValue) + End If + End If + Catch + End Try + + End If + + + End Sub + + ' Fill the RankId list. + Protected Overridable Sub PopulateRankIdDropDownList( _ + ByVal selectedValue As String, _ + ByVal maxItems As Integer) + + Me.RankId.Items.Clear() + + + ' 1. Setup the static list items + + ' Add the Please Select item. + Me.RankId.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_RankIdDropDownList function. + ' It is better to customize the where clause there. + + Dim wc As WhereClause = CreateWhereClause_RankIdDropDownList() + ' Create the ORDER BY clause to sort based on the displayed value. + + + ' 3. Read a total of maxItems from the database and insert them + Dim orderBy As OrderBy = New OrderBy(False, False) + orderBy.Add(PersonalIdTable.RankId, OrderByItem.OrderDir.Asc) + + Dim itemValue As String + Dim listDuplicates As New ArrayList() + + For Each itemValue In PersonalIdTable.GetValues(PersonalIdTable.RankId, wc, orderBy, maxItems) + ' Create the dropdown list item and add it to the list. + Dim fvalue As String = PersonalIdTable.RankId.Format(itemValue) + If fvalue Is Nothing OrElse fvalue.Trim() = "" Then fvalue = itemValue + Dim dupItem As ListItem = Me.RankId.Items.FindByText(fvalue) + + If Not IsNothing(dupItem) Then + listDuplicates.Add(fvalue) + dupItem.Text = fvalue & " (ID " & dupItem.Value & ")" + End If + + Dim newItem As ListItem = New ListItem(fvalue, itemValue) + Me.RankId.Items.Add(newItem) + + If listDuplicates.Contains(fvalue) Then + newItem.Text = fvalue & " (ID " & itemValue & ")" + End If + Next + + + ' 4. Set the selected value (insert if not already present). + + If Not selectedValue Is Nothing AndAlso _ + selectedValue.Trim <> "" AndAlso _ + Not SetSelectedValue(Me.RankId, selectedValue) AndAlso _ + Not SetSelectedDisplayText(Me.RankId, selectedValue) AndAlso _ + Not SetSelectedDisplayText(Me.RankId, PersonalIdTable.RankId.Format(selectedValue))Then + Dim fvalue As String = PersonalIdTable.RankId.Format(selectedValue) + If fvalue Is Nothing OrElse fvalue.Trim() = "" Then fvalue = selectedValue + Dim item As ListItem = New ListItem(fvalue, selectedValue) + item.Selected = True + Me.RankId.Items.Add(item) + End If + + + End Sub + + ' Fill the SectionId list. + Protected Overridable Sub PopulateSectionIdDropDownList( _ + ByVal selectedValue As String, _ + ByVal maxItems As Integer) + + Me.SectionId.Items.Clear() + + + ' 1. Setup the static list items + + ' Add the Please Select item. + Me.SectionId.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_SectionIdDropDownList function. + ' It is better to customize the where clause there. + + Dim wc As WhereClause = CreateWhereClause_SectionIdDropDownList() + ' Create the ORDER BY clause to sort based on the displayed value. + + + Dim orderBy As OrderBy = New OrderBy(false, false) + orderBy.Add(SectionTable.SectionName, 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 SectionRecord = 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 = SectionTable.GetRecords(wc, orderBy, pageNum, maxItems) + For each itemValue As SectionRecord In itemValues + ' Create the item and add to the list. + Dim cvalue As String = Nothing + Dim fvalue As String = Nothing + If itemValue.SectionIdSpecified Then + cvalue = itemValue.SectionId.ToString() + + If counter < maxItems AndAlso Me.SectionId.Items.FindByValue(cvalue) Is Nothing Then + + Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalIdTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalIdTable.SectionId) + If _isExpandableNonCompositeForeignKey AndAlso PersonalIdTable.SectionId.IsApplyDisplayAs Then + fvalue = PersonalIdTable.GetDFKA(itemValue, PersonalIdTable.SectionId) + End If + If (Not _isExpandableNonCompositeForeignKey) Or (String.IsNullOrEmpty(fvalue)) Then + fvalue = itemValue.Format(SectionTable.SectionName) + 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.SectionId.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.SectionId.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.SectionId, selectedValue) AndAlso _ + Not SetSelectedDisplayText(Me.SectionId, selectedValue)Then + + ' construct a whereclause to query a record with Section.SectionId = selectedValue + Dim filter2 As CompoundFilter = New CompoundFilter(CompoundFilter.CompoundingOperators.And_Operator, Nothing) + Dim whereClause2 As WhereClause = New WhereClause() + filter2.AddFilter(New BaseClasses.Data.ColumnValueFilter(SectionTable.SectionId, selectedValue, BaseClasses.Data.BaseFilter.ComparisonOperator.EqualsTo, False)) + whereClause2.AddFilter(filter2, CompoundFilter.CompoundingOperators.And_Operator) + + Try + ' Execute the query + Dim rc() As SectionRecord = SectionTable.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 SectionRecord = DirectCast(rc(0), SectionRecord) + ' Create the item and add to the list. + Dim cvalue As String = Nothing + Dim fvalue As String = Nothing + If itemValue.SectionIdSpecified Then + cvalue = itemValue.SectionId.ToString() + Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalIdTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalIdTable.SectionId) + If _isExpandableNonCompositeForeignKey AndAlso PersonalIdTable.SectionId.IsApplyDisplayAs Then + fvalue = PersonalIdTable.GetDFKA(itemValue, PersonalIdTable.SectionId) + End If + If (Not _isExpandableNonCompositeForeignKey) Or (String.IsNullOrEmpty(fvalue)) Then + fvalue = itemValue.Format(SectionTable.SectionName) + End If + + If fvalue Is Nothing OrElse fvalue.Trim() = "" Then fvalue = cvalue + Dim newItem As New ListItem(fvalue, cvalue) + Me.SectionId.Items.Add(newItem) + SetSelectedValue(Me.SectionId, selectedValue) + End If + End If + Catch + End Try + + End If + + + End Sub + + ' Fill the Sex list. + Protected Overridable Sub PopulateSexDropDownList( _ + ByVal selectedValue As String, _ + ByVal maxItems As Integer) + + Me.Sex.Items.Clear() + + + ' 1. Setup the static list items + + ' Add the Please Select item. + Me.Sex.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_SexDropDownList function. + ' It is better to customize the where clause there. + + Dim wc As WhereClause = CreateWhereClause_SexDropDownList() + ' Create the ORDER BY clause to sort based on the displayed value. + + + Dim orderBy As OrderBy = New OrderBy(false, false) + orderBy.Add(SexTable.Sex, 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 SexRecord = 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 = SexTable.GetRecords(wc, orderBy, pageNum, maxItems) + For each itemValue As SexRecord In itemValues + ' Create the item and add to the list. + Dim cvalue As String = Nothing + Dim fvalue As String = Nothing + If itemValue.SexIdSpecified Then + cvalue = itemValue.SexId.ToString() + + If counter < maxItems AndAlso Me.Sex.Items.FindByValue(cvalue) Is Nothing Then + + Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalIdTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalIdTable.Sex) + If _isExpandableNonCompositeForeignKey AndAlso PersonalIdTable.Sex.IsApplyDisplayAs Then + fvalue = PersonalIdTable.GetDFKA(itemValue, PersonalIdTable.Sex) + End If + If (Not _isExpandableNonCompositeForeignKey) Or (String.IsNullOrEmpty(fvalue)) Then + fvalue = itemValue.Format(SexTable.Sex) + 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.Sex.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.Sex.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.Sex, selectedValue) AndAlso _ + Not SetSelectedDisplayText(Me.Sex, selectedValue)Then + + ' construct a whereclause to query a record with Sex.SexId = selectedValue + Dim filter2 As CompoundFilter = New CompoundFilter(CompoundFilter.CompoundingOperators.And_Operator, Nothing) + Dim whereClause2 As WhereClause = New WhereClause() + filter2.AddFilter(New BaseClasses.Data.ColumnValueFilter(SexTable.SexId, selectedValue, BaseClasses.Data.BaseFilter.ComparisonOperator.EqualsTo, False)) + whereClause2.AddFilter(filter2, CompoundFilter.CompoundingOperators.And_Operator) + + Try + ' Execute the query + Dim rc() As SexRecord = SexTable.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 SexRecord = DirectCast(rc(0), SexRecord) + ' Create the item and add to the list. + Dim cvalue As String = Nothing + Dim fvalue As String = Nothing + If itemValue.SexIdSpecified Then + cvalue = itemValue.SexId.ToString() + Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalIdTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalIdTable.Sex) + If _isExpandableNonCompositeForeignKey AndAlso PersonalIdTable.Sex.IsApplyDisplayAs Then + fvalue = PersonalIdTable.GetDFKA(itemValue, PersonalIdTable.Sex) + End If + If (Not _isExpandableNonCompositeForeignKey) Or (String.IsNullOrEmpty(fvalue)) Then + fvalue = itemValue.Format(SexTable.Sex) + End If + + If fvalue Is Nothing OrElse fvalue.Trim() = "" Then fvalue = cvalue + Dim newItem As New ListItem(fvalue, cvalue) + Me.Sex.Items.Add(newItem) + SetSelectedValue(Me.Sex, selectedValue) + End If + End If + Catch + End Try + + End If + + + End Sub + + ' Fill the StatusId list. + Protected Overridable Sub PopulateStatusIdDropDownList( _ + ByVal selectedValue As String, _ + ByVal maxItems As Integer) + + Me.StatusId.Items.Clear() + + + ' 1. Setup the static list items + + ' Add the Please Select item. + Me.StatusId.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_StatusIdDropDownList function. + ' It is better to customize the where clause there. + + Dim wc As WhereClause = CreateWhereClause_StatusIdDropDownList() + ' Create the ORDER BY clause to sort based on the displayed value. + + + Dim orderBy As OrderBy = New OrderBy(false, false) + orderBy.Add(StatusTable.Status, 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 StatusRecord = 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 = StatusTable.GetRecords(wc, orderBy, pageNum, maxItems) + For each itemValue As StatusRecord In itemValues + ' Create the item and add to the list. + Dim cvalue As String = Nothing + Dim fvalue As String = Nothing + If itemValue.StatusIdSpecified Then + cvalue = itemValue.StatusId.ToString() + + If counter < maxItems AndAlso Me.StatusId.Items.FindByValue(cvalue) Is Nothing Then + + Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalIdTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalIdTable.StatusId) + If _isExpandableNonCompositeForeignKey AndAlso PersonalIdTable.StatusId.IsApplyDisplayAs Then + fvalue = PersonalIdTable.GetDFKA(itemValue, PersonalIdTable.StatusId) + End If + If (Not _isExpandableNonCompositeForeignKey) Or (String.IsNullOrEmpty(fvalue)) Then + fvalue = itemValue.Format(StatusTable.Status) + 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.StatusId.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.StatusId.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.StatusId, selectedValue) AndAlso _ + Not SetSelectedDisplayText(Me.StatusId, selectedValue)Then + + ' construct a whereclause to query a record with Status.StatusId = selectedValue + Dim filter2 As CompoundFilter = New CompoundFilter(CompoundFilter.CompoundingOperators.And_Operator, Nothing) + Dim whereClause2 As WhereClause = New WhereClause() + filter2.AddFilter(New BaseClasses.Data.ColumnValueFilter(StatusTable.StatusId, selectedValue, BaseClasses.Data.BaseFilter.ComparisonOperator.EqualsTo, False)) + whereClause2.AddFilter(filter2, CompoundFilter.CompoundingOperators.And_Operator) + + Try + ' Execute the query + Dim rc() As StatusRecord = StatusTable.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 StatusRecord = DirectCast(rc(0), StatusRecord) + ' Create the item and add to the list. + Dim cvalue As String = Nothing + Dim fvalue As String = Nothing + If itemValue.StatusIdSpecified Then + cvalue = itemValue.StatusId.ToString() + Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalIdTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalIdTable.StatusId) + If _isExpandableNonCompositeForeignKey AndAlso PersonalIdTable.StatusId.IsApplyDisplayAs Then + fvalue = PersonalIdTable.GetDFKA(itemValue, PersonalIdTable.StatusId) + End If + If (Not _isExpandableNonCompositeForeignKey) Or (String.IsNullOrEmpty(fvalue)) Then + fvalue = itemValue.Format(StatusTable.Status) + End If + + If fvalue Is Nothing OrElse fvalue.Trim() = "" Then fvalue = cvalue + Dim newItem As New ListItem(fvalue, cvalue) + Me.StatusId.Items.Add(newItem) + SetSelectedValue(Me.StatusId, selectedValue) + End If + End If + Catch + End Try + + End If + + + End Sub + + Protected Overridable Sub ArmId_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()(ArmId.ClientID & "_SelectedValue"), String) + Dim displayText As String = CType(Me.Page.Session()(ArmId.ClientID & "_SelectedDisplayText"), String) + If displayText <> "" AndAlso val <> "" Then + Me.ArmId.Items.Add(New ListItem(displayText, val)) + Me.ArmId.SelectedIndex = Me.ArmId.Items.Count - 1 + Me.Page.Session.Remove(ArmId.ClientID & "_SelectedValue") + Me.Page.Session.Remove(ArmId.ClientID & "_SelectedDisplayText") + End If + + + + + End Sub + + Protected Overridable Sub ArmyId_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()(ArmyId.ClientID & "_SelectedValue"), String) + Dim displayText As String = CType(Me.Page.Session()(ArmyId.ClientID & "_SelectedDisplayText"), String) + If displayText <> "" AndAlso val <> "" Then + Me.ArmyId.Items.Add(New ListItem(displayText, val)) + Me.ArmyId.SelectedIndex = Me.ArmyId.Items.Count - 1 + Me.Page.Session.Remove(ArmyId.ClientID & "_SelectedValue") + Me.Page.Session.Remove(ArmyId.ClientID & "_SelectedDisplayText") + End If + + + + + End Sub + + Protected Overridable Sub BloodId_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()(BloodId.ClientID & "_SelectedValue"), String) + Dim displayText As String = CType(Me.Page.Session()(BloodId.ClientID & "_SelectedDisplayText"), String) + If displayText <> "" AndAlso val <> "" Then + Me.BloodId.Items.Add(New ListItem(displayText, val)) + Me.BloodId.SelectedIndex = Me.BloodId.Items.Count - 1 + Me.Page.Session.Remove(BloodId.ClientID & "_SelectedValue") + Me.Page.Session.Remove(BloodId.ClientID & "_SelectedDisplayText") + End If + + + + + End Sub + + Protected Overridable Sub Born_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()(Born.ClientID & "_SelectedValue"), String) + Dim displayText As String = CType(Me.Page.Session()(Born.ClientID & "_SelectedDisplayText"), String) + If displayText <> "" AndAlso val <> "" Then + Me.Born.Items.Add(New ListItem(displayText, val)) + Me.Born.SelectedIndex = Me.Born.Items.Count - 1 + Me.Page.Session.Remove(Born.ClientID & "_SelectedValue") + Me.Page.Session.Remove(Born.ClientID & "_SelectedDisplayText") + End If + + + + + End Sub + + Protected Overridable Sub DeptId_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()(DeptId.ClientID & "_SelectedValue"), String) + Dim displayText As String = CType(Me.Page.Session()(DeptId.ClientID & "_SelectedDisplayText"), String) + If displayText <> "" AndAlso val <> "" Then + Me.DeptId.Items.Add(New ListItem(displayText, val)) + Me.DeptId.SelectedIndex = Me.DeptId.Items.Count - 1 + Me.Page.Session.Remove(DeptId.ClientID & "_SelectedValue") + Me.Page.Session.Remove(DeptId.ClientID & "_SelectedDisplayText") + End If + + + + + End Sub + + Protected Overridable Sub RankId_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()(RankId.ClientID & "_SelectedValue"), String) + Dim displayText As String = CType(Me.Page.Session()(RankId.ClientID & "_SelectedDisplayText"), String) + If displayText <> "" AndAlso val <> "" Then + Me.RankId.Items.Add(New ListItem(displayText, val)) + Me.RankId.SelectedIndex = Me.RankId.Items.Count - 1 + Me.Page.Session.Remove(RankId.ClientID & "_SelectedValue") + Me.Page.Session.Remove(RankId.ClientID & "_SelectedDisplayText") + End If + + + + + End Sub + + Protected Overridable Sub SectionId_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()(SectionId.ClientID & "_SelectedValue"), String) + Dim displayText As String = CType(Me.Page.Session()(SectionId.ClientID & "_SelectedDisplayText"), String) + If displayText <> "" AndAlso val <> "" Then + Me.SectionId.Items.Add(New ListItem(displayText, val)) + Me.SectionId.SelectedIndex = Me.SectionId.Items.Count - 1 + Me.Page.Session.Remove(SectionId.ClientID & "_SelectedValue") + Me.Page.Session.Remove(SectionId.ClientID & "_SelectedDisplayText") + End If + + + + + End Sub + + Protected Overridable Sub Sex_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()(Sex.ClientID & "_SelectedValue"), String) + Dim displayText As String = CType(Me.Page.Session()(Sex.ClientID & "_SelectedDisplayText"), String) + If displayText <> "" AndAlso val <> "" Then + Me.Sex.Items.Add(New ListItem(displayText, val)) + Me.Sex.SelectedIndex = Me.Sex.Items.Count - 1 + Me.Page.Session.Remove(Sex.ClientID & "_SelectedValue") + Me.Page.Session.Remove(Sex.ClientID & "_SelectedDisplayText") + End If + + + + + End Sub + + Protected Overridable Sub StatusId_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()(StatusId.ClientID & "_SelectedValue"), String) + Dim displayText As String = CType(Me.Page.Session()(StatusId.ClientID & "_SelectedDisplayText"), String) + If displayText <> "" AndAlso val <> "" Then + Me.StatusId.Items.Add(New ListItem(displayText, val)) + Me.StatusId.SelectedIndex = Me.StatusId.Items.Count - 1 + Me.Page.Session.Remove(StatusId.ClientID & "_SelectedValue") + Me.Page.Session.Remove(StatusId.ClientID & "_SelectedDisplayText") + End If + + + + + End Sub + + Protected Overridable Sub Addr_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub Amphur_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub ArmyWelfareMemId_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub BAmphur_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub BirthDate_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub BProvince_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub CremateMemId_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub MId_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub MobilePhone_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub Nationality_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub OfficerDate_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub Origin_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub PersonalId_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub PersonalLastName_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub PersonalName_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub Phone_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub PhoneExt_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub PlaceOfBirth_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub PostCode_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub Province_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub RegDate_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub RegNo1_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub RegNo2_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub Religion_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub TId_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + + Private _PreviousUIData As New Hashtable + Public Overridable Property PreviousUIData() As Hashtable + Get + Return _PreviousUIData + End Get + Set(ByVal value As Hashtable) + _PreviousUIData = value + End Set + End Property + + Private _IsNewRecord As Boolean = True + Public Overridable Property IsNewRecord() As Boolean + Get + Return Me._IsNewRecord + End Get + Set(ByVal value As Boolean) + Me._IsNewRecord = value + End Set + End Property + + Private _DataChanged As Boolean = False + Public Overridable Property DataChanged() As Boolean + Get + Return Me._DataChanged + End Get + Set(ByVal Value As Boolean) + Me._DataChanged = Value + End Set + End Property + + Private _ResetData As Boolean = False + Public Overridable Property ResetData() As Boolean + Get + Return Me._ResetData + End Get + Set(ByVal Value As Boolean) + Me._ResetData = Value + End Set + End Property + + Public Property RecordUniqueId() As String + Get + Return CType(Me.ViewState("BasePersonalIdRecordControl_Rec"), String) + End Get + Set(ByVal value As String) + Me.ViewState("BasePersonalIdRecordControl_Rec") = value + End Set + End Property + + Private _DataSource As PersonalIdRecord + Public Property DataSource() As PersonalIdRecord + Get + Return Me._DataSource + End Get + + Set(ByVal value As PersonalIdRecord) + + Me._DataSource = value + End Set + End Property + + + + Private _checkSum As String + Public Overridable Property CheckSum() As String + Get + Return Me._checkSum + End Get + Set(ByVal value As String) + Me._checkSum = value + End Set + End Property + + Private _TotalPages As Integer + Public Property TotalPages() As Integer + Get + Return Me._TotalPages + End Get + Set(ByVal value As Integer) + Me._TotalPages = value + End Set + End Property + + Private _PageIndex As Integer + Public Property PageIndex() As Integer + Get + ' Return the PageIndex + Return Me._PageIndex + End Get + Set(ByVal value As Integer) + Me._PageIndex = value + End Set + End Property + + Private _PageSize As Integer + Public Property PageSize() As Integer + Get + Return Me._PageSize + End Get + Set(ByVal value As Integer) + Me._PageSize = value + End Set + End Property + + Private _TotalRecords As Integer + Public Property TotalRecords() As Integer + Get + Return Me._TotalRecords + End Get + Set(ByVal value As Integer) + If Me.PageSize > 0 Then + Me.TotalPages = CInt(Math.Ceiling(value / Me.PageSize)) + End If + + Me._TotalRecords = value + End Set + End Property + + Private _DisplayLastPage As Boolean + Public Property DisplayLastPage() As Boolean + Get + Return Me._DisplayLastPage + End Get + Set(ByVal value As Boolean) + Me._DisplayLastPage = value + End Set + End Property + + + +#Region "Helper Properties" + + Public ReadOnly Property Addr() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Addr"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property AddrLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "AddrLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property Amphur() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Amphur"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property AmphurLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "AmphurLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property ArmId() As System.Web.UI.WebControls.DropDownList + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "ArmId"), System.Web.UI.WebControls.DropDownList) + End Get + End Property + + Public ReadOnly Property ArmIdLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "ArmIdLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property ArmyId() As System.Web.UI.WebControls.DropDownList + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "ArmyId"), System.Web.UI.WebControls.DropDownList) + End Get + End Property + + Public ReadOnly Property ArmyIdLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "ArmyIdLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property ArmyWelfareMemId() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "ArmyWelfareMemId"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property ArmyWelfareMemIdLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "ArmyWelfareMemIdLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property BAmphur() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "BAmphur"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property BAmphurLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "BAmphurLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property BirthDate() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "BirthDate"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property BirthDateLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "BirthDateLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property BloodId() As System.Web.UI.WebControls.DropDownList + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "BloodId"), System.Web.UI.WebControls.DropDownList) + End Get + End Property + + Public ReadOnly Property BloodIdLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "BloodIdLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property Born() As System.Web.UI.WebControls.DropDownList + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Born"), System.Web.UI.WebControls.DropDownList) + End Get + End Property + + Public ReadOnly Property BornLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "BornLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property BProvince() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "BProvince"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property BProvinceLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "BProvinceLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property CremateMemId() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "CremateMemId"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property CremateMemIdLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "CremateMemIdLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property DeptId() As System.Web.UI.WebControls.DropDownList + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "DeptId"), System.Web.UI.WebControls.DropDownList) + End Get + End Property + + Public ReadOnly Property DeptIdLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "DeptIdLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property MId() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "MId"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property MIdLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "MIdLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property MobilePhone() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "MobilePhone"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property MobilePhoneLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "MobilePhoneLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property Nationality() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Nationality"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property NationalityLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "NationalityLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property OfficerDate() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "OfficerDate"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property OfficerDateLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "OfficerDateLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property Origin() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Origin"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property OriginLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "OriginLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property PersonalId() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalId"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property PersonalIdLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalIdLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property PersonalIdRecordControlCollapsibleRegion() As System.Web.UI.WebControls.Panel + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalIdRecordControlCollapsibleRegion"), System.Web.UI.WebControls.Panel) + End Get + End Property + + Public ReadOnly Property PersonalIdRecordControlIcon() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalIdRecordControlIcon"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalIdRecordControlPanelExtender() As AjaxControlToolkit.CollapsiblePanelExtender + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalIdRecordControlPanelExtender"), AjaxControlToolkit.CollapsiblePanelExtender) + End Get + End Property + + Public ReadOnly Property PersonalIdTitle() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalIdTitle"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property PersonalLastName() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalLastName"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property PersonalLastNameLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalLastNameLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property PersonalName() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalName"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property PersonalNameLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalNameLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property Phone() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Phone"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property PhoneExt() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PhoneExt"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property PhoneExtLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PhoneExtLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property PhoneLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PhoneLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property picture() As System.Web.UI.WebControls.FileUpload + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "picture"), System.Web.UI.WebControls.FileUpload) + End Get + End Property + + Public ReadOnly Property pictureImage() As System.Web.UI.WebControls.Image + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "pictureImage"), System.Web.UI.WebControls.Image) + End Get + End Property + + Public ReadOnly Property pictureLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "pictureLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property PlaceOfBirth() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PlaceOfBirth"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property PlaceOfBirthLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PlaceOfBirthLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property PostCode() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PostCode"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property PostCodeLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PostCodeLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property Province() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Province"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property ProvinceLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "ProvinceLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property RankId() As System.Web.UI.WebControls.DropDownList + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RankId"), System.Web.UI.WebControls.DropDownList) + End Get + End Property + + Public ReadOnly Property RankIdLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RankIdLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property RegDate() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RegDate"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property RegDateLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RegDateLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property RegNo1() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RegNo1"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property RegNo1Label() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RegNo1Label"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property RegNo2() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RegNo2"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property RegNo2Label() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RegNo2Label"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property Religion() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Religion"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property ReligionLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "ReligionLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property SectionId() As System.Web.UI.WebControls.DropDownList + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "SectionId"), System.Web.UI.WebControls.DropDownList) + End Get + End Property + + Public ReadOnly Property SectionIdLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "SectionIdLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property Sex() As System.Web.UI.WebControls.DropDownList + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Sex"), System.Web.UI.WebControls.DropDownList) + End Get + End Property + + Public ReadOnly Property SexLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "SexLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property StatusId() As System.Web.UI.WebControls.DropDownList + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "StatusId"), System.Web.UI.WebControls.DropDownList) + End Get + End Property + + Public ReadOnly Property StatusIdLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "StatusIdLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property TId() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "TId"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property TIdLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "TIdLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + +#End Region + +#Region "Helper Functions" + + Public Overrides Overloads Function ModifyRedirectUrl(ByVal url As String, ByVal arg As String, ByVal bEncrypt As Boolean) As String + Return Me.Page.EvaluateExpressions(url, arg, bEncrypt, Me) + End Function + + Public Overrides Overloads Function EvaluateExpressions(ByVal url As String, ByVal arg As String, ByVal bEncrypt As Boolean) As String + + Dim rec As PersonalIdRecord = Nothing + + + Try + rec = Me.GetRecord() + Catch ex As Exception + ' Do nothing + End Try + + If rec Is Nothing AndAlso url.IndexOf("{") >= 0 Then + ' Localization. + + Throw New Exception(Page.GetResourceValue("Err:RecDataSrcNotInitialized", "Persons")) + + End If + Return EvaluateExpressions(url, arg, rec, bEncrypt) + End Function + + + Public Overridable Function GetRecord() As PersonalIdRecord + If Not Me.DataSource Is Nothing Then + Return Me.DataSource + End If + + If Not Me.RecordUniqueId Is Nothing Then + + Return PersonalIdTable.GetRecord(Me.RecordUniqueId, True) + + End If + + ' Localization. + + 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 + + \ No newline at end of file diff --git a/App_Code/PersonalId/IdChange.Controls.vb b/App_Code/PersonalId/IdChange.Controls.vb new file mode 100644 index 0000000..59eb41b --- /dev/null +++ b/App_Code/PersonalId/IdChange.Controls.vb @@ -0,0 +1,1520 @@ + +' This file implements the TableControl, TableControlRow, and RecordControl classes for the +' IdChange.aspx page. The Row or RecordControl classes are the +' ideal place to add code customizations. For example, you can override the LoadData, +' CreateWhereClause, DataBind, SaveData, GetUIData, and Validate methods. + +#Region "Imports statements" + +Option Strict On +Imports Microsoft.VisualBasic +Imports BaseClasses.Web.UI.WebControls +Imports System +Imports System.Collections +Imports System.Collections.Generic + +Imports System.Web +Imports System.Web.UI +Imports System.Web.UI.WebControls +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Utils +Imports ReportTools.ReportCreator +Imports ReportTools.Shared + + + +Imports Persons.Business +Imports Persons.Data + + +#End Region + + +Namespace Persons.UI.Controls.IdChange + +#Region "Section 1: Place your customizations here." + + +Public Class PersonalIdRecordControl + Inherits BasePersonalIdRecordControl + ' The BasePersonalIdRecordControl implements the LoadData, DataBind and other + ' methods to load and display the data in a table control. + + ' This is the ideal place to add your code customizations. For example, you can override the LoadData, + ' CreateWhereClause, DataBind, SaveData, GetUIData, and Validate methods. + + + + ' SaveData saves data in the database. + ' Customize by adding code before or after the call to MyBase.SaveData() + ' or replace the call to MyBase.SaveData(). + Public Overrides Sub SaveData() + 'Dim rec As New PersonalIdRecord + ' rec = PersonalIdTable.GetRecord(Me.PersonalId.Text, True) + ' rec.PersonalId = "1200000000000" + ' rec.Save() + ' Me.DataChanged = False + + Dim myConnection As System.Data.SqlClient.SqlConnection + Dim myCommand As New System.Data.SqlClient.SqlCommand + Dim result As Integer + myConnection = CType(BaseClasses.Data.SqlProvider.SqlTransaction.GetExistingTransaction().GetADOConnectionByName("DatabasePersons1"), System.Data.SqlClient.SqlConnection) + + 'Specify the name of the Stored Procedure which is to be run + + myCommand.Connection = myConnection + myCommand.CommandType = System.Data.CommandType.StoredProcedure + myCommand.CommandTimeout = 15 + + 'myCommand.ExecuteScalar() + myCommand.Parameters.AddWithValue("@pid", "0000000000000") + myCommand.Parameters.AddWithValue("@NewPid", "3160101741051") + myCommand.CommandText = "ChangePid" + result = myCommand.ExecuteNonQuery + + End Sub + + + + + + + + End Class + + + +#End Region + + + +#Region "Section 2: Do not modify this section." + + +' Base class for the PersonalIdRecordControl control on the IdChange page. +' Do not modify this class. Instead override any method in PersonalIdRecordControl. +Public Class BasePersonalIdRecordControl + Inherits Persons.UI.BaseApplicationRecordControl + + ' To customize, override this method in PersonalIdRecordControl. + Protected Overridable Sub Control_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Init + + ' Setup the filter and search events. + + If Not Me.Page.IsPostBack Then + Dim initialVal As String = "" + If Me.InSession(Me.PersonalIdSearch1) + initialVal = Me.GetFromSession(Me.PersonalIdSearch1) + + End If + + If initialVal <> "" + + Me.PersonalIdSearch1.Text = initialVal + + End If + + End If + ' Control Initializations. + ' Initialize the table's current sort order. + + If Me.InSession(Me, "Order_By") Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + + End If + + Me.PageIndex = CInt(Me.GetFromSession(Me, "Page_Index", "0")) + + + Me.ClearControlsFromSession() + End Sub + + ' To customize, override this method in PersonalIdRecordControl. + Protected Overridable Sub Control_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load + + SaveControlsToSession_Ajax() + + ' Setup the pagination events. + + + ' Register the event handlers. + + AddHandler Me.PersonalIdRefreshButton.Click, AddressOf PersonalIdRefreshButton_Click + + AddHandler Me.PersonalIdResetButton.Click, AddressOf PersonalIdResetButton_Click + + AddHandler Me.PersonalIdSaveButton.Click, AddressOf PersonalIdSaveButton_Click + + Me.PersonalIdSaveButton.Attributes.Add("onclick", "SubmitHRefOnce(this, """ & Me.Page.GetResourceValue("Txt:SaveRecord", "Persons") & """);") + + AddHandler Me.PersonalIdSearchButton1.Button.Click, AddressOf PersonalIdSearchButton1_Click + + AddHandler Me.PersonalId.TextChanged, AddressOf PersonalId_TextChanged + + AddHandler Me.PersonalLastName.TextChanged, AddressOf PersonalLastName_TextChanged + + AddHandler Me.PersonalName.TextChanged, AddressOf PersonalName_TextChanged + + + End Sub + + + Public Overridable Sub LoadData() + + ' Load the data from the database into the DataSource PersonalId record. + ' It is better to make changes to functions called by LoadData such as + ' CreateWhereClause, rather than making changes here. + + ' This is the first time a record is being retrieved from the database. + ' So create a Where Clause based on the staic Where clause specified + ' on the Query wizard and the dynamic part specified by the end user + ' on the search and filter controls (if any). + + Dim wc As WhereClause = Me.CreateWhereClause() + + Dim Panel As System.Web.UI.WebControls.Panel = CType(MiscUtils.FindControlRecursively(Me, "PersonalIdRecordControlPanel"), System.Web.UI.WebControls.Panel) + If Not Panel is Nothing Then + Panel.visible = True + End If + + ' If there is no Where clause, then simply create a new, blank record. + + If wc Is Nothing OrElse Not wc.RunQuery Then + Me.DataSource = New PersonalIdRecord() + + If Not Panel is Nothing Then + Panel.visible = False + End If + + Return + End If + + Dim filterJoin As CompoundFilter = CreateCompoundJoinFilter() + Me.TotalPages = PersonalIdTable.GetRecordCount(filterJoin, wc) + If Me.DisplayLastPage Then + Me.PageIndex = Me.TotalPages - 1 + End If + ' Retrieve the record from the database. It is possible + + Dim orderBy As OrderBy = CreateOrderBy() + Dim recList() As PersonalIdRecord = PersonalIdTable.GetRecords(filterJoin, wc, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE, Me.TotalPages) + If recList.Length = 0 Then + ' There is no data for this Where clause. + Me.PageIndex = 0 + Me.DataSource = New PersonalIdRecord() + + Me.RecordUniqueId = Nothing + If Not Panel is Nothing Then + Panel.visible = False + End If + Return + Else If Me.PageIndex >= recList.Length Then + Me.PageIndex = recList.Length - 1 + Else If Me.PageIndex < 0 Then + Me.PageIndex = 0 + End If + + ' Set DataSource based on record retrieved from the database. + Me.DataSource = PersonalIdTable.GetRecord(recList(Me.PageIndex).GetID.ToXmlString(), True) + + + + End Sub + + ' Populate the UI controls using the DataSource. To customize, override this method in PersonalIdRecordControl. + Public Overrides Sub DataBind() + ' The DataBind method binds the user interface controls to the values + ' from the database record. To do this, it calls the Set methods for + ' each of the field displayed on the webpage. It is better to make + ' changes in the Set methods, rather than making changes here. + + MyBase.DataBind() + + ' Make sure that the DataSource is initialized. + If Me.DataSource Is Nothing Then + + Return + End If + + + 'LoadData for DataSource for chart and report if they exist + + + + ' Call the Set methods for each controls on the panel + + SetPersonalId() + SetPersonalIdLabel() + SetPersonalIdRecordControlCollapsibleRegion() + + + + SetPersonalIdSearch1() + + + SetPersonalLastName() + SetPersonalLastNameLabel() + SetPersonalName() + SetPersonalNameLabel() + + + Me.IsNewRecord = True + + If Me.DataSource.IsCreated Then + Me.IsNewRecord = False + + Me.RecordUniqueId = Me.DataSource.GetID.ToXmlString() + End If + + ' Now load data for each record and table child UI controls. + ' Ordering is important because child controls get + ' their parent ids from their parent UI controls. + Dim shouldResetControl As Boolean = False + + End Sub + + + Public Overridable Sub SetPersonalId() + + + ' Set the PersonalId TextBox on the webpage with value from the + ' PersonalId database record. + + ' Me.DataSource is the PersonalId record retrieved from the database. + ' Me.PersonalId is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetPersonalId() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.PersonalIdSpecified Then + + ' If the PersonalId is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalIdTable.PersonalId) + + Me.PersonalId.Text = formattedValue + + Else + + ' PersonalId is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.PersonalId.Text = PersonalIdTable.PersonalId.Format(PersonalIdTable.PersonalId.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetPersonalLastName() + + + ' Set the PersonalLastName TextBox on the webpage with value from the + ' PersonalId database record. + + ' Me.DataSource is the PersonalId record retrieved from the database. + ' Me.PersonalLastName is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetPersonalLastName() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.PersonalLastNameSpecified Then + + ' If the PersonalLastName is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalIdTable.PersonalLastName) + + Me.PersonalLastName.Text = formattedValue + + Else + + ' PersonalLastName is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.PersonalLastName.Text = PersonalIdTable.PersonalLastName.Format(PersonalIdTable.PersonalLastName.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetPersonalName() + + + ' Set the PersonalName TextBox on the webpage with value from the + ' PersonalId database record. + + ' Me.DataSource is the PersonalId record retrieved from the database. + ' Me.PersonalName is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetPersonalName() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.PersonalNameSpecified Then + + ' If the PersonalName is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalIdTable.PersonalName) + + Me.PersonalName.Text = formattedValue + + Else + + ' PersonalName is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.PersonalName.Text = PersonalIdTable.PersonalName.Format(PersonalIdTable.PersonalName.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetPersonalIdLabel() + + End Sub + + Public Overridable Sub SetPersonalIdRecordControlCollapsibleRegion() + + End Sub + + Public Overridable Sub SetPersonalLastNameLabel() + + End Sub + + Public Overridable Sub SetPersonalNameLabel() + + End Sub + + Public Overridable Sub ResetControl() + + Me.PersonalIdSearch1.Text = "" + + Me.RecordUniqueId = Nothing + Me.PageIndex = 0 + + + + End Sub + + + Public EvaluateFormulaDelegate As BaseClasses.Data.DataSource.EvaluateFormulaDelegate = New BaseClasses.Data.DataSource.EvaluateFormulaDelegate(AddressOf Me.EvaluateFormula) + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean, ByVal e As FormulaEvaluator) As String + If e Is Nothing Then + e = New FormulaEvaluator() + End If + + e.Variables.Clear() + + + ' add variables for formula evaluation + If variables IsNot Nothing Then + Dim enumerator As System.Collections.Generic.IEnumerator(Of System.Collections.Generic.KeyValuePair(Of String, Object)) = variables.GetEnumerator() + While enumerator.MoveNext() + e.Variables.Add(enumerator.Current.Key, enumerator.Current.Value) + End While + End If + + If includeDS + + End IF + + + ' Other variables referred to in the formula are expected to be + ' properties of the DataSource. For example, referring to + ' UnitPrice as a variable will refer to DataSource.UnitPrice + If dataSourceForEvaluate Is Nothing Then + + e.DataSource = Me.DataSource + + Else + e.DataSource = dataSourceForEvaluate + End If + + ' Define the calling control. This is used to add other + ' related table and record controls as variables. + e.CallingControl = Me + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + + If Not String.IsNullOrEmpty(format) AndAlso (String.IsNullOrEmpty(formula) OrElse formula.IndexOf("Format(") < 0) Then + Return FormulaUtils.Format(resultObj, format) + Else + Return resultObj.ToString() + End If + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format,variables ,includeDS, Nothing) + End Function + + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object)) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format, variables ,True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, format, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal e as FormulaEvaluator) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, variables, True, e) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal includeDS as Boolean) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, includeDS, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, True, Nothing) + End Function + + + Public Overridable Sub RegisterPostback() + + Me.Page.RegisterPostBackTrigger(MiscUtils.FindControlRecursively(Me,"PersonalIdSaveButton")) + + + End Sub + + + + ' To customize, override this method in PersonalIdRecordControl. + Public Overridable Sub SaveData() + ' Saves the associated record in the database. + ' SaveData calls Validate and Get methods - so it may be more appropriate to + ' customize those methods. + + ' 1. Load the existing record from the database. Since we save the entire record, this ensures + ' that fields that are not displayed are also properly initialized. + Me.LoadData() + + Dim Panel As System.Web.UI.WebControls.Panel = CType(MiscUtils.FindControlRecursively(Me, "PersonalIdRecordControlPanel"), System.Web.UI.WebControls.Panel) + + If ((Not IsNothing(Panel)) AndAlso (Not Panel.Visible)) OrElse IsNothing(Me.DataSource) Then + Return + End If + + + ' 2. Perform any custom validation. + Me.Validate() + + + ' 3. Set the values in the record with data from UI controls. + ' This calls the Get() method for each of the user interface controls. + Me.GetUIData() + + ' 4. Save in the database. + ' We should not save the record if the data did not change. This + ' will save a database hit and avoid triggering any database triggers. + + If Me.DataSource.IsAnyValueChanged Then + ' Save record to database but do not commit yet. + ' Auto generated ids are available after saving for use by child (dependent) records. + Me.DataSource.Save() + + End If + + + ' update session or cookie by formula + + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + ' For Master-Detail relationships, save data on the Detail table(s) + + End Sub + + ' To customize, override this method in PersonalIdRecordControl. + Public Overridable Sub GetUIData() + ' The GetUIData method retrieves the updated values from the user interface + ' controls into a database record in preparation for saving or updating. + ' To do this, it calls the Get methods for each of the field displayed on + ' the webpage. It is better to make changes in the Get methods, rather + ' than making changes here. + + ' Call the Get methods for each of the user interface controls. + + GetPersonalId() + GetPersonalLastName() + GetPersonalName() + End Sub + + + Public Overridable Sub GetPersonalId() + + ' Retrieve the value entered by the user on the PersonalId ASP:TextBox, and + ' save it into the PersonalId field in DataSource PersonalId record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.PersonalId.Text, PersonalIdTable.PersonalId) + + + End Sub + + Public Overridable Sub GetPersonalLastName() + + ' Retrieve the value entered by the user on the PersonalLastName ASP:TextBox, and + ' save it into the PersonalLastName field in DataSource PersonalId record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.PersonalLastName.Text, PersonalIdTable.PersonalLastName) + + + End Sub + + Public Overridable Sub GetPersonalName() + + ' Retrieve the value entered by the user on the PersonalName ASP:TextBox, and + ' save it into the PersonalName field in DataSource PersonalId record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.PersonalName.Text, PersonalIdTable.PersonalName) + + + End Sub + + + + Public Overridable Function CreateCompoundJoinFilter() As CompoundFilter + Dim jFilter As CompoundFilter = New CompoundFilter() + + Return jFilter + + End Function + + + Public Overridable Function CreateOrderBy() As OrderBy + Return Me.CurrentSortOrder + End Function + + + ' To customize, override this method in PersonalIdRecordControl. + + Public Overridable Function CreateWhereClause() As WhereClause + + Dim wc As WhereClause + PersonalIdTable.Instance.InnerFilter = Nothing + wc = New WhereClause() + + ' Compose the WHERE clause consiting of: + ' 1. Static clause defined at design time. + ' 2. User selected filter criteria. + ' 3. User selected search criteria. + + + If IsValueSelected(Me.PersonalIdSearch1) Then + If Me.PersonalIdSearch1.Text = BaseClasses.Resources.AppResources.GetResourceValue("Txt:SearchForEllipsis", Nothing) Then + Me.PersonalIdSearch1.Text = "" + Else + ' Strip "..." from begin and ending of the search text, otherwise the search will return 0 values as in database "..." is not stored. + + If Me.PersonalIdSearch1.Text.StartsWith("...") Then + Me.PersonalIdSearch1.Text = Me.PersonalIdSearch1.Text.SubString(3,Me.PersonalIdSearch1.Text.Length-3) + End If + If Me.PersonalIdSearch1.Text.EndsWith("...") then + Me.PersonalIdSearch1.Text = Me.PersonalIdSearch1.Text.SubString(0,Me.PersonalIdSearch1.Text.Length-3) + ' Strip the last word as well as it is likely only a partial word + Dim endindex As Integer = PersonalIdSearch1.Text.Length - 1 + While (Not Char.IsWhiteSpace(PersonalIdSearch1.Text(endindex)) AndAlso endindex > 0) + endindex -= 1 + End While + If endindex > 0 Then + PersonalIdSearch1.Text = PersonalIdSearch1.Text.Substring(0, endindex) + End If + End If + End If + + Dim formatedSearchText As String = MiscUtils.GetSelectedValue(Me.PersonalIdSearch1, Me.GetFromSession(Me.PersonalIdSearch1)) + + ' After stripping "..." see if the search text is null or empty. + If IsValueSelected(Me.PersonalIdSearch1) Then + ' These clauses are added depending on operator and fields selected in Control's property page, bindings tab. + + Dim search As WhereClause = New WhereClause() + + search.iOR(PersonalIdTable.PersonalName, BaseFilter.ComparisonOperator.Contains, MiscUtils.GetSelectedValue(Me.PersonalIdSearch1, Me.GetFromSession(Me.PersonalIdSearch1)), True, False) + + wc.iAND(search) + + End If + End If + + Dim bAnyFiltersChanged As Boolean = False + + If IsValueSelected(Me.PersonalIdSearch1) OrElse Me.InSession(Me.PersonalIdSearch1) Then + bAnyFiltersChanged = True + End If + + If bAnyFiltersChanged Then + Return wc + + Else + + wc.RunQuery = False + + End If + + ' Retrieve the record id from the URL parameter. + + Dim recId As String = Me.Page.Request.QueryString.Item("PersonalId") + + If Not recId Is Nothing AndAlso Not recId.Trim = "" Then + HttpContext.Current.Session("QueryString in IdChange") = recId + + If KeyValue.IsXmlKey(recId) Then + ' Keys are typically passed as XML structures to handle composite keys. + ' If XML, then add a Where clause based on the Primary Key in the XML. + Dim pkValue As KeyValue = KeyValue.XmlToKey(recId) + + wc.iAND(PersonalIdTable.PersonalId, BaseFilter.ComparisonOperator.EqualsTo, pkValue.GetColumnValueString(PersonalIdTable.PersonalId)) + + Else + ' The URL parameter contains the actual value, not an XML structure. + + wc.iAND(PersonalIdTable.PersonalId, BaseFilter.ComparisonOperator.EqualsTo, recId) + + End If + + Return wc + End If + + Return wc + + End Function + + ' This CreateWhereClause is used for loading list of suggestions for Auto Type-Ahead feature. + + Public Overridable Function CreateWhereClause(ByVal searchText As String, ByVal fromSearchControl As String, ByVal AutoTypeAheadSearch As String, ByVal AutoTypeAheadWordSeparators As String) As WhereClause + PersonalIdTable.Instance.InnerFilter = Nothing + Dim wc As WhereClause = New WhereClause() + + ' Compose the WHERE clause consiting of: + ' 1. Static clause defined at design time. + ' 2. User selected filter criteria. + ' 3. User selected search criteria. + Dim appRelativeVirtualPath As String = CType(HttpContext.Current.Session("AppRelativeVirtualPath"), String) + + + ' Adds clauses if values are selected in Filter controls which are configured in the page. + + If IsValueSelected(searchText) and fromSearchControl = "PersonalIdSearch1" Then + Dim formatedSearchText as String = searchText + ' Strip "..." from begin and ending of the search text, otherwise the search will return 0 values as in database "..." is not stored. + If searchText.StartsWith("...") Then + formatedSearchText = searchText.SubString(3,searchText.Length-3) + End If + If searchText.EndsWith("...") Then + formatedSearchText = searchText.SubString(0,searchText.Length-3) + ' Strip the last word as well as it is likely only a partial word + Dim endindex As Integer = searchText.Length - 1 + While (Not Char.IsWhiteSpace(searchText(endindex)) AndAlso endindex > 0) + endindex -= 1 + End While + If endindex > 0 Then + searchText = searchText.Substring(0, endindex) + End If + End If + 'After stripping "...", trim any leading and trailing whitespaces + formatedSearchText = formatedSearchText.Trim() + ' After stripping "..." see if the search text is null or empty. + If IsValueSelected(formatedSearchText) Then + ' These clauses are added depending on operator and fields selected in Control's property page, bindings tab. + + Dim search As WhereClause = New WhereClause() + + If InvariantLCase(AutoTypeAheadSearch).equals("wordsstartingwithsearchstring") Then + + search.iOR(PersonalIdTable.PersonalName, BaseFilter.ComparisonOperator.Starts_With, formatedSearchText, True, False) + search.iOR(PersonalIdTable.PersonalName, BaseFilter.ComparisonOperator.Contains, AutoTypeAheadWordSeparators & formatedSearchText, True, False) + + Else + + search.iOR(PersonalIdTable.PersonalName, BaseFilter.ComparisonOperator.Contains, formatedSearchText, True, False) + End If + wc.iAND(search) + + End If + End If + + ' Retrieve the record id from the session. + Dim recId As String = DirectCast(HttpContext.Current.Session("QueryString in IdChange"), String) + If Not recId Is Nothing AndAlso Not recId.Trim = "" Then + If KeyValue.IsXmlKey(recId) Then + Dim pkValue As KeyValue = KeyValue.XmlToKey(recId) + + wc.iAND(PersonalIdTable.PersonalId, BaseFilter.ComparisonOperator.EqualsTo, pkValue.GetColumnValueString(PersonalIdTable.PersonalId)) + + Else + + wc.iAND(PersonalIdTable.PersonalId, BaseFilter.ComparisonOperator.EqualsTo, recId) + + End If + End If + + + + Return wc + End Function + + Public Overridable Function GetAutoCompletionList_PersonalIdSearch1(ByVal prefixText As String, ByVal count As Integer) As String() + Dim resultList As ArrayList = New ArrayList + Dim wordList As ArrayList = New ArrayList + Dim iteration As Integer = 0 + + Dim filterJoin As CompoundFilter = CreateCompoundJoinFilter() + Dim wc As WhereClause = CreateWhereClause(prefixText,"PersonalIdSearch1", "WordsStartingWithSearchString", "[^a-zA-Z0-9]") + While (resultList.Count < count AndAlso iteration < 5) + ' Fetch 100 records in each iteration + Dim records() As Persons.Business.PersonalIdRecord = PersonalIdTable.GetRecords(filterJoin, wc, Nothing, iteration, 100) + Dim rec As PersonalIdRecord = Nothing + Dim resultItem As String = "" + For Each rec In records + ' Exit the loop if recordList count has reached AutoTypeAheadListSize. + If resultList.Count >= count then + Exit For + End If + ' If the field is configured to Display as Foreign key, Format() method returns the + ' Display as Forien Key value instead of original field value. + ' Since search had to be done in multiple fields (selected in Control's page property, binding tab) in a record, + ' We need to find relevent field to display which matches the prefixText and is not already present in the result list. + + resultItem = rec.Format(PersonalIdTable.PersonalName) + If resultItem IsNot Nothing AndAlso resultItem.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture).Contains(prefixText.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture)) Then + + Dim isAdded As Boolean = FormatSuggestions(prefixText, resultItem, 50, "AtBeginningOfMatchedString", "WordsStartingWithSearchString", "[^a-zA-Z0-9]", resultList) + If isAdded Then + Continue For + End If + End If + + Next + ' Exit the loop if number of records found is less as further iteration will not return any more records + If records.Length < 100 Then + Exit While + End If + iteration += 1 + End While + + resultList.Sort() + Dim result() As String = New String(resultList.Count - 1) {} + Array.Copy(resultList.ToArray, result, resultList.Count) + Return result + End Function + + + 'Formats the resultItem and adds it to the list of suggestions. + Public Overridable Function FormatSuggestions(ByVal prefixText As String, ByVal resultItem As String, _ + ByVal columnLength As Integer, ByVal AutoTypeAheadDisplayFoundText As String, _ + ByVal autoTypeAheadSearch As String, ByVal AutoTypeAheadWordSeparators As String, _ + ByVal resultList As ArrayList) As Boolean + Dim index As Integer = resultItem.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture).IndexOf(prefixText.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture)) + Dim itemToAdd As String = "" + Dim isFound As Boolean = False + Dim isAdded As Boolean = False + ' Get the index where prfixt is at the beginning of resultItem. If not found then, index of word which begins with prefixText. + If InvariantLCase(autoTypeAheadSearch).equals("wordsstartingwithsearchstring") and not index = 0 Then + ' Expression to find word which contains AutoTypeAheadWordSeparators followed by prefixText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex( AutoTypeAheadWordSeparators + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + If regex1.IsMatch(resultItem) Then + index = regex1.Match(resultItem).Index + isFound = True + End If + ' If the prefixText is found immediatly after white space then starting of the word is found so don not search any further + If not resultItem(index).ToString() = " " Then + ' Expression to find beginning of the word which contains AutoTypeAheadWordSeparators followed by prefixText + Dim regex As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\\S*" + AutoTypeAheadWordSeparators + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + If regex.IsMatch(resultItem) Then + index = regex.Match(resultItem).Index + isFound = True + End If + End If + End If + ' If autoTypeAheadSearch value is wordsstartingwithsearchstring then, extract the substring only if the prefixText is found at the + ' beginning of the resultItem (index = 0) or a word in resultItem is found starts with prefixText. + If index = 0 Or isFound Or InvariantLCase(autoTypeAheadSearch).Equals("anywhereinstring") then + If InvariantLCase(AutoTypeAheadDisplayFoundText).equals("atbeginningofmatchedstring") Then + ' Expression to find beginning of the word which contains prefixText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\\S*" + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + ' Find the beginning of the word which contains prefexText + If (StringUtils.InvariantLCase(autoTypeAheadSearch).Equals("anywhereinstring") AndAlso regex1.IsMatch(resultItem)) Then + index = regex1.Match(resultItem).Index + isFound = True + End If + ' Display string from the index till end of the string if sub string from index till end is less than columnLength value. + If Len(resultItem) - index <= columnLength Then + If index = 0 Then + itemToAdd = resultItem + Else + itemToAdd = "..." & resultItem.Substring(index, Len(resultItem) - index) + End If + Else + If index = 0 Then + itemToAdd = resultItem.Substring(index, (columnLength - 3)) & "..." + Else + 'Truncate the string to show only columnLength - 6 characters as begining and trailing "..." has to be appended. + itemToAdd = "..." & resultItem.Substring(index , columnLength - 6) & "..." + End If + End If + ElseIf InvariantLCase(AutoTypeAheadDisplayFoundText).equals("inmiddleofmatchedstring") Then + Dim subStringBeginIndex As Integer = CType(columnLength/2, Integer) + If Len(resultItem) <= columnLength Then + itemToAdd = resultItem + Else + ' Sanity check at end of the string + If index + Len(prefixText) = columnLength Then + itemToAdd = "..." & resultItem.Substring(index-columnLength,index) + ElseIf Len(resultItem) - index < subStringBeginIndex Then + ' Display string from the end till columnLength value if, index is closer to the end of the string. + itemToAdd = "..." & resultItem.Substring(Len(resultItem)-columnLength,Len(resultItem)) + ElseIf index <= subStringBeginIndex Then + ' Sanity chet at beginning of the string + itemToAdd = resultItem.Substring(0, columnLength) & "..." + Else + ' Display string containing text before the prefixText occures and text after the prefixText + itemToAdd = "..." & resultItem.Substring(index - subStringBeginIndex, columnLength) & "..." + End If + End If + ElseIf InvariantLCase(AutoTypeAheadDisplayFoundText).equals("atendofmatchedstring") Then + ' Expression to find ending of the word which contains prefexText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\s", System.Text.RegularExpressions.RegexOptions.IgnoreCase) + ' Find the ending of the word which contains prefexText + If regex1.IsMatch(resultItem, index + 1) Then + index = regex1.Match(resultItem, index + 1).Index + Else + ' If the word which contains prefexText is the last word in string, regex1.IsMatch returns false. + index = resultItem.Length + End If + If index > Len(resultItem) Then + index = Len(resultItem) + End If + ' If text from beginning of the string till index is less than columnLength value then, display string from the beginning till index. + If index <= columnLength Then + if index = Len(resultItem) then 'Make decision to append "..." + itemToAdd = resultItem.Substring(0,index) + Else + itemToAdd = resultItem.Substring(0,index) & "..." + End If + Else + If index = Len(resultItem) Then + itemToAdd = "..." & resultItem.Substring(index - (columnLength - 3), (columnLength - 3)) + Else + 'Truncate the string to show only columnLength - 6 characters as begining and trailing "..." has to be appended. + itemToAdd = "..." & resultItem.Substring(index - (columnLength - 6), columnLength - 6) & "..." + End If + End If + End If + + ' Remove newline character from itemToAdd + Dim prefixTextIndex As Integer = itemToAdd.IndexOf(prefixText, StringComparison.CurrentCultureIgnoreCase) + ' If itemToAdd contains any newline after the search text then show text only till newline + Dim regex2 As System.Text.RegularExpressions.Regex = New System.Text.RegularExpressions.Regex("(" & vbCrLf & "|" & vbLf & ")", System.Text.RegularExpressions.RegexOptions.IgnoreCase) + Dim newLineIndexAfterPrefix As Integer = -1 + If regex2.IsMatch(itemToAdd, prefixTextIndex) Then + newLineIndexAfterPrefix = regex2.Match(itemToAdd, prefixTextIndex).Index + End If + If (newLineIndexAfterPrefix > -1) Then + If itemToAdd.EndsWith("...") Then + itemToAdd = (itemToAdd.Substring(0, newLineIndexAfterPrefix) + "...") + Else + itemToAdd = itemToAdd.Substring(0, newLineIndexAfterPrefix) + End If + End If + ' If itemToAdd contains any newline before search text then show text which comes after newline + Dim regex3 As System.Text.RegularExpressions.Regex = New System.Text.RegularExpressions.Regex("(" & vbCrLf & "|" & vbLf & ")", (System.Text.RegularExpressions.RegexOptions.IgnoreCase Or System.Text.RegularExpressions.RegexOptions.RightToLeft)) + Dim newLineIndexBeforePrefix As Integer = -1 + If regex3.IsMatch(itemToAdd, prefixTextIndex) Then + newLineIndexBeforePrefix = regex3.Match(itemToAdd, prefixTextIndex).Index + End If + If (newLineIndexBeforePrefix > -1) Then + If itemToAdd.StartsWith("...") Then + itemToAdd = ("..." + itemToAdd.Substring((newLineIndexBeforePrefix + regex3.Match(itemToAdd, prefixTextIndex).Length))) + Else + itemToAdd = itemToAdd.Substring((newLineIndexBeforePrefix + regex3.Match(itemToAdd, prefixTextIndex).Length)) + End If + End If + + If Not itemToAdd is nothing AndAlso Not resultList.Contains(itemToAdd) Then + resultList.Add(itemToAdd) + isAdded = true + End If + End If + Return isAdded + End Function + + Public Overridable Sub SetPersonalIdSearch1() + + End Sub + + + + ' To customize, override this method in PersonalIdRecordControl. + Public Overridable Sub Validate() + ' Add custom validation for any control within this panel. + ' Example. If you have a State ASP:Textbox control + ' If Me.State.Text <> "CA" Then + ' Throw New Exception("State must be CA (California).") + ' End If + + ' The Validate method is common across all controls within + ' this panel so you can validate multiple fields, but report + ' one error message. + + + End Sub + + Public Overridable Sub Delete() + + If Me.IsNewRecord() Then + Return + End If + + Dim pkValue As KeyValue = KeyValue.XmlToKey(Me.RecordUniqueId) + PersonalIdTable.DeleteRecord(pkValue) + + End Sub + + Protected Overridable Sub Control_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.PreRender + ' PreRender event is raised just before page is being displayed. + Try + DbUtils.StartTransaction() + Me.RegisterPostback() + + If Not Me.Page.ErrorOnPage AndAlso (Me.Page.IsPageRefresh OrElse Me.DataChanged OrElse Me.ResetData) Then + + + ' Re-load the data and update the web page if necessary. + ' This is typically done during a postback (filter, search button, sort, pagination button). + ' In each of the other click handlers, simply set DataChanged to True to reload the data. + Me.LoadData() + Me.DataBind() + End If + + + Catch ex As Exception + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + Finally + DbUtils.EndTransaction() + End Try + End Sub + + + Protected Overrides Sub SaveControlsToSession() + MyBase.SaveControlsToSession() + + ' Save filter controls to values to session. + + Me.SaveToSession(Me.PersonalIdSearch1, Me.PersonalIdSearch1.Text) + + + ' Save table control properties to the session. + + If Not Me.CurrentSortOrder Is Nothing Then + Me.SaveToSession(Me, "Order_By", Me.CurrentSortOrder.ToXmlString()) + End If + + + Me.SaveToSession(Me, "Page_Index", Me.PageIndex.ToString()) + + + 'Save pagination state to session. + + End Sub + + + Protected Sub SaveControlsToSession_Ajax() + + ' Save filter controls to values to session. + + Me.SaveToSession("PersonalIdSearch1_Ajax", Me.PersonalIdSearch1.Text) + + HttpContext.Current.Session("AppRelativeVirtualPath") = Me.Page.AppRelativeVirtualPath + + End Sub + + + Protected Overrides Sub ClearControlsFromSession() + MyBase.ClearControlsFromSession() + + + ' Clear filter controls values from the session. + + Me.RemoveFromSession(Me.PersonalIdSearch1) + + ' Clear table properties from the session. + + Me.RemoveFromSession(Me, "Page_Index") + + + ' Clear pagination state from session. + + End Sub + + Protected Overrides Sub LoadViewState(ByVal savedState As Object) + MyBase.LoadViewState(savedState) + Dim isNewRecord As String = CType(ViewState("IsNewRecord"), String) + If Not isNewRecord Is Nothing AndAlso isNewRecord.Trim <> "" Then + Me.IsNewRecord = Boolean.Parse(isNewRecord) + End If + + Dim pageIndex As String = CType(ViewState("Page_Index"), String) + If Not pageIndex Is Nothing Then + Me.PageIndex = CInt(pageIndex) + End If + + Dim orderByStr As String = CType(ViewState("PersonalIdRecordControl_OrderBy"), String) + + If Not orderByStr Is Nothing AndAlso orderByStr.Trim <> "" Then + Me.CurrentSortOrder = BaseClasses.Data.OrderBy.FromXmlString(orderByStr) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + End If + + + ' Load view state for pagination control. + + End Sub + + Protected Overrides Function SaveViewState() As Object + ViewState("IsNewRecord") = Me.IsNewRecord.ToString() + ViewState("CheckSum") = Me.CheckSum + + ViewState("Page_Index") = Me.PageIndex + + + If Not Me.CurrentSortOrder Is Nothing Then + Me.ViewState("PersonalIdRecordControl_OrderBy") = Me.CurrentSortOrder.ToXmlString() + End If + + + ' Load view state for pagination control. + + Return MyBase.SaveViewState() + End Function + + + ' Generate the event handling functions for pagination events. + + + ' Generate the event handling functions for filter and search events. + + ' event handler for ImageButton + Public Overridable Sub PersonalIdRefreshButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Dim PersonalIdRecordControlObj as PersonalIdRecordControl = DirectCast(Me.Page.FindControlRecursively("PersonalIdRecordControl"), PersonalIdRecordControl) + PersonalIdRecordControlObj.ResetData = True + + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalIdResetButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.PersonalIdSearch1.Text = "" + Me.RecordUniqueId = Nothing + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalIdSaveButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + + If (Not Me.Page.IsPageRefresh) Then + Me.SaveData() + End If + + Me.Page.CommitTransaction(sender) + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for Button with Layout + Public Overridable Sub PersonalIdSearchButton1_Click(ByVal sender As Object, ByVal args As EventArgs) + + Try + + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + Protected Overridable Sub PersonalId_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub PersonalLastName_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub PersonalName_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + + Private _PreviousUIData As New Hashtable + Public Overridable Property PreviousUIData() As Hashtable + Get + Return _PreviousUIData + End Get + Set(ByVal value As Hashtable) + _PreviousUIData = value + End Set + End Property + + Private _IsNewRecord As Boolean = True + Public Overridable Property IsNewRecord() As Boolean + Get + Return Me._IsNewRecord + End Get + Set(ByVal value As Boolean) + Me._IsNewRecord = value + End Set + End Property + + Private _DataChanged As Boolean = False + Public Overridable Property DataChanged() As Boolean + Get + Return Me._DataChanged + End Get + Set(ByVal Value As Boolean) + Me._DataChanged = Value + End Set + End Property + + Private _ResetData As Boolean = False + Public Overridable Property ResetData() As Boolean + Get + Return Me._ResetData + End Get + Set(ByVal Value As Boolean) + Me._ResetData = Value + End Set + End Property + + Public Property RecordUniqueId() As String + Get + Return CType(Me.ViewState("BasePersonalIdRecordControl_Rec"), String) + End Get + Set(ByVal value As String) + Me.ViewState("BasePersonalIdRecordControl_Rec") = value + End Set + End Property + + Private _DataSource As PersonalIdRecord + Public Property DataSource() As PersonalIdRecord + Get + Return Me._DataSource + End Get + + Set(ByVal value As PersonalIdRecord) + + Me._DataSource = value + End Set + End Property + + + + Private _checkSum As String + Public Overridable Property CheckSum() As String + Get + Return Me._checkSum + End Get + Set(ByVal value As String) + Me._checkSum = value + End Set + End Property + + Private _TotalPages As Integer + Public Property TotalPages() As Integer + Get + Return Me._TotalPages + End Get + Set(ByVal value As Integer) + Me._TotalPages = value + End Set + End Property + + Private _PageIndex As Integer + Public Property PageIndex() As Integer + Get + ' Return the PageIndex + Return Me._PageIndex + End Get + Set(ByVal value As Integer) + Me._PageIndex = value + End Set + End Property + + Private _PageSize As Integer + Public Property PageSize() As Integer + Get + Return Me._PageSize + End Get + Set(ByVal value As Integer) + Me._PageSize = value + End Set + End Property + + Private _TotalRecords As Integer + Public Property TotalRecords() As Integer + Get + Return Me._TotalRecords + End Get + Set(ByVal value As Integer) + If Me.PageSize > 0 Then + Me.TotalPages = CInt(Math.Ceiling(value / Me.PageSize)) + End If + + Me._TotalRecords = value + End Set + End Property + + Private _DisplayLastPage As Boolean + Public Property DisplayLastPage() As Boolean + Get + Return Me._DisplayLastPage + End Get + Set(ByVal value As Boolean) + Me._DisplayLastPage = value + End Set + End Property + + + Private _CurrentSortOrder As OrderBy = Nothing + Public Property CurrentSortOrder() As OrderBy + Get + Return Me._CurrentSortOrder + End Get + Set(ByVal value As BaseClasses.Data.OrderBy) + Me._CurrentSortOrder = value + End Set + End Property + + +#Region "Helper Properties" + + Public ReadOnly Property PersonalId() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalId"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property PersonalIdLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalIdLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property PersonalIdRecordControlCollapsibleRegion() As System.Web.UI.WebControls.Panel + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalIdRecordControlCollapsibleRegion"), System.Web.UI.WebControls.Panel) + End Get + End Property + + Public ReadOnly Property PersonalIdRefreshButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalIdRefreshButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalIdResetButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalIdResetButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalIdSaveButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalIdSaveButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalIdSearch1() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalIdSearch1"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property PersonalIdSearchButton1() As Persons.UI.IThemeButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalIdSearchButton1"), Persons.UI.IThemeButton) + End Get + End Property + + Public ReadOnly Property PersonalIdTitle() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalIdTitle"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property PersonalLastName() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalLastName"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property PersonalLastNameLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalLastNameLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property PersonalName() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalName"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property PersonalNameLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalNameLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + +#End Region + +#Region "Helper Functions" + + Public Overrides Overloads Function ModifyRedirectUrl(ByVal url As String, ByVal arg As String, ByVal bEncrypt As Boolean) As String + Return Me.Page.EvaluateExpressions(url, arg, bEncrypt, Me) + End Function + + Public Overrides Overloads Function EvaluateExpressions(ByVal url As String, ByVal arg As String, ByVal bEncrypt As Boolean) As String + + Dim rec As PersonalIdRecord = Nothing + + + Try + rec = Me.GetRecord() + Catch ex As Exception + ' Do nothing + End Try + + If rec Is Nothing AndAlso url.IndexOf("{") >= 0 Then + ' Localization. + + Throw New Exception(Page.GetResourceValue("Err:NoRecSelected", "Persons")) + + End If + Return EvaluateExpressions(url, arg, rec, bEncrypt) + End Function + + + Public Overridable Function GetRecord() As PersonalIdRecord + If Not Me.DataSource Is Nothing Then + Return Me.DataSource + End If + + If Not Me.RecordUniqueId Is Nothing Then + + Return PersonalIdTable.GetRecord(Me.RecordUniqueId, True) + + End If + + ' Localization. + + Return Nothing + + End Function + + Public Shadows ReadOnly Property Page() As BaseApplicationPage + Get + Return DirectCast(MyBase.Page, BaseApplicationPage) + End Get + End Property + +#End Region + +End Class + + + +#End Region + + +End Namespace + + \ No newline at end of file diff --git a/App_Code/PersonalId/PersonalImage.Controls.vb b/App_Code/PersonalId/PersonalImage.Controls.vb new file mode 100644 index 0000000..1edc9f1 --- /dev/null +++ b/App_Code/PersonalId/PersonalImage.Controls.vb @@ -0,0 +1,3199 @@ + +' This file implements the TableControl, TableControlRow, and RecordControl classes for the +' PersonalImage.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.PersonalImage + +#Region "Section 1: Place your customizations here." + + +Public Class PersonalIdTableControlRow + Inherits BasePersonalIdTableControlRow + ' The BasePersonalIdTableControlRow implements code for a ROW within the + ' the PersonalIdTableControl table. The BasePersonalIdTableControlRow implements the DataBind and SaveData methods. + ' The loading of data is actually performed by the LoadData method in the base class of PersonalIdTableControl. + + ' This is the ideal place to add your code customizations. For example, you can override the DataBind, + ' SaveData, GetUIData, and Validate methods. + + +End Class + + + +Public Class PersonalIdTableControl + Inherits BasePersonalIdTableControl + + Public Overrides Function CreateOrderBy() As BaseClasses.Data.OrderBy + ' The CurrentSortOrder is initialized to the sort order on the + ' Query Wizard. It may be modified by the Click handler for any of + ' the column heading to sort or reverse sort by that column. + ' You can add your own sort order, or modify it on the Query Wizard. + Me.CurrentSortOrder = New OrderBy(True, True) + Me.CurrentSortOrder.Add(PersonalIdTable.RankId, OrderByItem.OrderDir.Asc) + 'Return MyBase.CreateOrderBy() + + Return Me.CurrentSortOrder + End Function + +End Class + + + +#End Region + + + +#Region "Section 2: Do not modify this section." + + +' Base class for the PersonalIdTableControlRow control on the PersonalImage page. +' Do not modify this class. Instead override any method in PersonalIdTableControlRow. +Public Class BasePersonalIdTableControlRow + Inherits Persons.UI.BaseApplicationRecordControl + + ' To customize, override this method in PersonalIdTableControlRow. + Protected Overridable Sub Control_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Init + + Me.ClearControlsFromSession() + End Sub + + ' To customize, override this method in PersonalIdTableControlRow. + Protected Overridable Sub Control_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load + + 'Call LoadFocusScripts from repeater so that onfocus attribute could be added to elements + Me.Page.LoadFocusScripts(Me) + + ' Show confirmation message on Click + Me.PersonalIdRowDeleteButton.Attributes.Add("onClick", "return (confirm('" & (CType(Me.Page,BaseApplicationPage)).GetResourceValue("DeleteRecordConfirm", "Persons") & "'));") + + + ' Register the event handlers. + + AddHandler Me.PersonalIdRowDeleteButton.Click, AddressOf PersonalIdRowDeleteButton_Click + + AddHandler Me.PersonalIdRowEditButton.Click, AddressOf PersonalIdRowEditButton_Click + + AddHandler Me.PersonalIdRowViewButton.Click, AddressOf PersonalIdRowViewButton_Click + + + End Sub + + + Public Overridable Sub LoadData() + + ' Load the data from the database into the DataSource PersonalId record. + ' It is better to make changes to functions called by LoadData such as + ' CreateWhereClause, rather than making changes here. + + ' 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 = PersonalIdTable.GetRecord(Me.RecordUniqueId, True) + + Return + End If + + ' Since this is a row in the table, the data for this row is loaded by the + ' LoadData method of the BasePersonalIdTableControl when the data for the entire + ' table is loaded. + + Me.DataSource = New PersonalIdRecord() + + + + End Sub + + ' Populate the UI controls using the DataSource. To customize, override this method in PersonalIdTableControlRow. + Public Overrides Sub DataBind() + ' The DataBind method binds the user interface controls to the values + ' from the database record. To do this, it calls the Set methods for + ' each of the field displayed on the webpage. It is better to make + ' changes in the Set methods, rather than making changes here. + + MyBase.DataBind() + + ' Make sure that the DataSource is initialized. + If Me.DataSource Is Nothing Then + + Return + End If + + + 'LoadData for DataSource for chart and report if they exist + + + + ' Call the Set methods for each controls on the panel + + SetPersonalId() + + + + + SetPersonalLastName() + SetPersonalName() + + SetpictureImage() + SetRankId() + + + Me.IsNewRecord = True + + If Me.DataSource.IsCreated Then + Me.IsNewRecord = False + + Me.RecordUniqueId = Me.DataSource.GetID.ToXmlString() + End If + + ' Now load data for each record and table child UI controls. + ' Ordering is important because child controls get + ' their parent ids from their parent UI controls. + Dim shouldResetControl As Boolean = False + + End Sub + + + Public Overridable Sub SetPersonalId() + + + ' Set the PersonalId Literal on the webpage with value from the + ' PersonalId database record. + + ' Me.DataSource is the PersonalId record retrieved from the database. + ' Me.PersonalId is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetPersonalId() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.PersonalIdSpecified Then + + ' If the PersonalId is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalIdTable.PersonalId) + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.PersonalId.Text = formattedValue + + Else + + ' PersonalId is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.PersonalId.Text = PersonalIdTable.PersonalId.Format(PersonalIdTable.PersonalId.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetPersonalLastName() + + + ' Set the PersonalLastName Literal on the webpage with value from the + ' PersonalId database record. + + ' Me.DataSource is the PersonalId record retrieved from the database. + ' Me.PersonalLastName is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetPersonalLastName() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.PersonalLastNameSpecified Then + + ' If the PersonalLastName is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalIdTable.PersonalLastName) + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.PersonalLastName.Text = formattedValue + + Else + + ' PersonalLastName is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.PersonalLastName.Text = PersonalIdTable.PersonalLastName.Format(PersonalIdTable.PersonalLastName.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetPersonalName() + + + ' Set the PersonalName Literal on the webpage with value from the + ' PersonalId database record. + + ' Me.DataSource is the PersonalId record retrieved from the database. + ' Me.PersonalName is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetPersonalName() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.PersonalNameSpecified Then + + ' If the PersonalName is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalIdTable.PersonalName) + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.PersonalName.Text = formattedValue + + Else + + ' PersonalName is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.PersonalName.Text = PersonalIdTable.PersonalName.Format(PersonalIdTable.PersonalName.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetpictureImage() + ' Set the picture Image on the webpage with value from the + ' PersonalId database record. + + ' Me.DataSource is the PersonalId record retrieved from the database. + ' Me.pictureImage is the ASP:Image on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetpictureImage() + ' and add your own code before or after the call to the MyBase function. + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.pictureSpecified Then + + ' If the picture is non-NULL, then format the value. + ' The Format method will use the Display Format + Me.pictureImage.Attributes.Add("onclick", "gPersist=true;") + Me.pictureImage.Attributes.Add("onmouseout","detailRolloverPopupClose();") + + Dim name As String = HttpUtility.HtmlEncode(PersonalIdTable.picture.Name) + + If Not HttpUtility.HtmlEncode("%ISD_DEFAULT%").Equals("%ISD_DEFAULT%") Then + name = HttpUtility.HtmlEncode(Me.Page.GetResourceValue("%ISD_DEFAULT%")) + End If + + Me.pictureImage.Attributes.Add("onmouseover","SaveMousePosition(event);delayRolloverPopup(""PageMethods.GetImage(\""" & Me.Page.Encrypt("PersonalId") _ + & "\"", \""" & Me.Page.Encrypt(HttpUtility.UrlEncode(Me.DataSource.GetID().ToString())) _ + & "\"", \""" & Me.Page.Encrypt("picture") & "\"", \""" & NetUtils.EncodeStringForHtmlDisplay(name.Substring(0, name.Length)) & "\"", false, 200," _ + & " 300, true, PopupDisplayWindowCallBackWith20);"",500);") + + ' Shrunk image size specified by ImagePercentSize on Properties. + Me.pictureImage.ImageUrl = Me.DataSource.FormatImageUrl(PersonalIdTable.picture, Me.Page.Encrypt("PersonalId"), Me.Page.Encrypt("picture"), Me.Page.Encrypt(Me.DataSource.GetID().ToXmlString()), 20) + + Me.pictureImage.Visible = True + Else + ' picture is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + Me.pictureImage.Visible = False + End If + End Sub + + Public Overridable Sub SetRankId() + + + ' Set the RankId Literal on the webpage with value from the + ' PersonalId database record. + + ' Me.DataSource is the PersonalId record retrieved from the database. + ' Me.RankId is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetRankId() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.RankIdSpecified Then + + ' If the RankId is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalIdTable.RankId) + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.RankId.Text = formattedValue + + Else + + ' RankId is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.RankId.Text = PersonalIdTable.RankId.Format(PersonalIdTable.RankId.DefaultValue) + + End If + + End Sub + + + Public EvaluateFormulaDelegate As BaseClasses.Data.DataSource.EvaluateFormulaDelegate = New BaseClasses.Data.DataSource.EvaluateFormulaDelegate(AddressOf Me.EvaluateFormula) + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean, ByVal e As FormulaEvaluator) As String + If e Is Nothing Then + e = New FormulaEvaluator() + End If + + e.Variables.Clear() + + + ' add variables for formula evaluation + If variables IsNot Nothing Then + Dim enumerator As System.Collections.Generic.IEnumerator(Of System.Collections.Generic.KeyValuePair(Of String, Object)) = variables.GetEnumerator() + While enumerator.MoveNext() + e.Variables.Add(enumerator.Current.Key, enumerator.Current.Value) + End While + End If + + If includeDS + + End IF + + + ' Other variables referred to in the formula are expected to be + ' properties of the DataSource. For example, referring to + ' UnitPrice as a variable will refer to DataSource.UnitPrice + If dataSourceForEvaluate Is Nothing Then + + e.DataSource = Me.DataSource + + Else + e.DataSource = dataSourceForEvaluate + End If + + ' Define the calling control. This is used to add other + ' related table and record controls as variables. + e.CallingControl = Me + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + + If Not String.IsNullOrEmpty(format) AndAlso (String.IsNullOrEmpty(formula) OrElse formula.IndexOf("Format(") < 0) Then + Return FormulaUtils.Format(resultObj, format) + Else + Return resultObj.ToString() + End If + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format,variables ,includeDS, Nothing) + End Function + + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object)) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format, variables ,True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, format, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal e as FormulaEvaluator) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, variables, True, e) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal includeDS as Boolean) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, includeDS, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, True, Nothing) + End Function + + + Public Overridable Sub RegisterPostback() + + + End Sub + + + + ' To customize, override this method in PersonalIdTableControlRow. + Public Overridable Sub SaveData() + ' Saves the associated record in the database. + ' SaveData calls Validate and Get methods - so it may be more appropriate to + ' customize those methods. + + ' 1. Load the existing record from the database. Since we save the entire record, this ensures + ' that fields that are not displayed are also properly initialized. + Me.LoadData() + + + ' 2. Perform any custom validation. + Me.Validate() + + + ' 3. Set the values in the record with data from UI controls. + ' This calls the Get() method for each of the user interface controls. + Me.GetUIData() + + ' 4. Save in the database. + ' We should not save the record if the data did not change. This + ' will save a database hit and avoid triggering any database triggers. + + If Me.DataSource.IsAnyValueChanged Then + ' Save record to database but do not commit yet. + ' Auto generated ids are available after saving for use by child (dependent) records. + Me.DataSource.Save() + + DirectCast(GetParentControlObject(Me, "PersonalIdTableControl"), PersonalIdTableControl).DataChanged = True + DirectCast(GetParentControlObject(Me, "PersonalIdTableControl"), PersonalIdTableControl).ResetData = True + End If + + + ' update session or cookie by formula + + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + ' For Master-Detail relationships, save data on the Detail table(s) + + End Sub + + ' To customize, override this method in PersonalIdTableControlRow. + Public Overridable Sub GetUIData() + ' The GetUIData method retrieves the updated values from the user interface + ' controls into a database record in preparation for saving or updating. + ' To do this, it calls the Get methods for each of the field displayed on + ' the webpage. It is better to make changes in the Get methods, rather + ' than making changes here. + + ' Call the Get methods for each of the user interface controls. + + GetPersonalId() + GetPersonalLastName() + GetPersonalName() + Getpicture() + GetRankId() + End Sub + + + Public Overridable Sub GetPersonalId() + + End Sub + + Public Overridable Sub GetPersonalLastName() + + End Sub + + Public Overridable Sub GetPersonalName() + + End Sub + + Public Overridable Sub Getpicture() + ' Retrieve the value entered by the user on the picture ASP:FileUpload, and + ' save it into the picture field in DataSource PersonalId record. + ' Custom validation should be performed in Validate, not here. + + If Not Me.picture.PostedFile is Nothing then + If Me.picture.PostedFile.FileName.Length > 0 AndAlso Me.picture.PostedFile.ContentLength > 0 Then + ' Retrieve the file contents and store them in picture field. + Me.DataSource.Parse(MiscUtils.GetFileContent(Me.picture.PostedFile), PersonalIdTable.picture) + + ' If there is a FileName companion field specified, then save the file name as well. + ' Strip off the path and just save the part after the last \ + Dim path As String = Me.picture.PostedFile.FileName + Dim LastIndex As Integer = path.LastIndexOf("\") + + Me.DataSource.PictureName = path.Substring(LastIndex + 1).Replace("'", "_") + + End If + End If + End Sub + + Public Overridable Sub GetRankId() + + End Sub + + + ' To customize, override this method in PersonalIdTableControlRow. + + Public Overridable Function CreateWhereClause() As WhereClause + + Return Nothing + + End Function + + + + ' To customize, override this method in PersonalIdTableControlRow. + Public Overridable Sub Validate() + ' Add custom validation for any control within this panel. + ' Example. If you have a State ASP:Textbox control + ' If Me.State.Text <> "CA" Then + ' Throw New Exception("State must be CA (California).") + ' End If + + ' The Validate method is common across all controls within + ' this panel so you can validate multiple fields, but report + ' one error message. + + + End Sub + + Public Overridable Sub Delete() + + If Me.IsNewRecord() Then + Return + End If + + Dim pkValue As KeyValue = KeyValue.XmlToKey(Me.RecordUniqueId) + PersonalIdTable.DeleteRecord(pkValue) + + DirectCast(GetParentControlObject(Me, "PersonalIdTableControl"), PersonalIdTableControl).DataChanged = True + DirectCast(GetParentControlObject(Me, "PersonalIdTableControl"), PersonalIdTableControl).ResetData = True + End Sub + + Protected Overridable Sub Control_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.PreRender + ' PreRender event is raised just before page is being displayed. + Try + DbUtils.StartTransaction() + Me.RegisterPostback() + + If Not Me.Page.ErrorOnPage AndAlso (Me.Page.IsPageRefresh OrElse Me.DataChanged OrElse Me.ResetData) Then + + + ' Re-load the data and update the web page if necessary. + ' This is typically done during a postback (filter, search button, sort, pagination button). + ' In each of the other click handlers, simply set DataChanged to True to reload the data. + Me.LoadData() + Me.DataBind() + End If + + + Catch ex As Exception + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + Finally + DbUtils.EndTransaction() + End Try + End Sub + + + Protected Overrides Sub SaveControlsToSession() + MyBase.SaveControlsToSession() + + + 'Save pagination state to session. + + End Sub + + + + Protected Overrides Sub ClearControlsFromSession() + MyBase.ClearControlsFromSession() + + + + ' Clear pagination state from session. + + End Sub + + Protected Overrides Sub LoadViewState(ByVal savedState As Object) + MyBase.LoadViewState(savedState) + Dim isNewRecord As String = CType(ViewState("IsNewRecord"), String) + If Not isNewRecord Is Nothing AndAlso isNewRecord.Trim <> "" Then + Me.IsNewRecord = Boolean.Parse(isNewRecord) + End If + + Dim myCheckSum As String = CType(ViewState("CheckSum"), String) + If Not myCheckSum Is Nothing AndAlso myCheckSum.Trim <> "" Then + Me.CheckSum = myCheckSum + End If + + + ' Load view state for pagination control. + + End Sub + + Protected Overrides Function SaveViewState() As Object + ViewState("IsNewRecord") = Me.IsNewRecord.ToString() + ViewState("CheckSum") = Me.CheckSum + + + ' Load view state for pagination control. + + Return MyBase.SaveViewState() + End Function + + + ' event handler for ImageButton + Public Overridable Sub PersonalIdRowDeleteButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + If(Not Me.Page.IsPageRefresh) Then + + Dim tc As PersonalIdTableControl = DirectCast(GetParentControlObject(Me, "PersonalIdTableControl"), PersonalIdTableControl) + If Not (IsNothing(tc)) Then + If Not Me.IsNewRecord Then + tc.AddToDeletedRecordIds(DirectCast(Me, PersonalIdTableControlRow)) + End If + Me.Visible = False + tc.SetFormulaControls() + End If + + End If + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalIdRowEditButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + ' The redirect URL is set on the Properties, Custom Properties or Actions. + ' The ModifyRedirectURL call resolves the parameters before the + ' Response.Redirect redirects the page to the URL. + ' Any code after the Response.Redirect call will not be executed, since the page is + ' redirected to the URL. + + + Dim url As String = "../PersonalId/EditPersonalId.aspx?PersonalId={PK}" + + Dim shouldRedirect As Boolean = True + Dim TargetKey As String = Nothing + Dim DFKA As String = TargetKey + Dim id As String = DFKA + Dim value As String = id + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + url = Me.ModifyRedirectUrl(url, "",False) + url = Me.Page.ModifyRedirectUrl(url, "",False) + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + shouldRedirect = False + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + If shouldRedirect Then + Me.Page.ShouldSaveControlsToSession = True + Me.Page.Response.Redirect(url) + ElseIf Not TargetKey Is Nothing AndAlso _ + Not shouldRedirect Then + Me.Page.ShouldSaveControlsToSession = True + Me.Page.CloseWindow(True) + + End If + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalIdRowViewButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + ' The redirect URL is set on the Properties, Custom Properties or Actions. + ' The ModifyRedirectURL call resolves the parameters before the + ' Response.Redirect redirects the page to the URL. + ' Any code after the Response.Redirect call will not be executed, since the page is + ' redirected to the URL. + + + Dim url As String = "../PersonalId/ShowPersonalId.aspx?PersonalId={PK}" + + Dim shouldRedirect As Boolean = True + Dim TargetKey As String = Nothing + Dim DFKA As String = TargetKey + Dim id As String = DFKA + Dim value As String = id + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + url = Me.ModifyRedirectUrl(url, "",False) + url = Me.Page.ModifyRedirectUrl(url, "",False) + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + shouldRedirect = False + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + If shouldRedirect Then + Me.Page.ShouldSaveControlsToSession = True + Me.Page.Response.Redirect(url) + ElseIf Not TargetKey Is Nothing AndAlso _ + Not shouldRedirect Then + Me.Page.ShouldSaveControlsToSession = True + Me.Page.CloseWindow(True) + + End If + End Sub + + + 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("BasePersonalIdTableControlRow_Rec"), String) + End Get + Set(ByVal value As String) + Me.ViewState("BasePersonalIdTableControlRow_Rec") = value + End Set + End Property + + Private _DataSource As PersonalIdRecord + Public Property DataSource() As PersonalIdRecord + Get + Return Me._DataSource + End Get + + Set(ByVal value As PersonalIdRecord) + + Me._DataSource = value + End Set + End Property + + + + Private _checkSum As String + Public Overridable Property CheckSum() As String + Get + Return Me._checkSum + End Get + Set(ByVal value As String) + Me._checkSum = value + End Set + End Property + + Private _TotalPages As Integer + Public Property TotalPages() As Integer + Get + Return Me._TotalPages + End Get + Set(ByVal value As Integer) + Me._TotalPages = value + End Set + End Property + + Private _PageIndex As Integer + Public Property PageIndex() As Integer + Get + ' Return the PageIndex + Return Me._PageIndex + End Get + Set(ByVal value As Integer) + Me._PageIndex = value + End Set + End Property + + Private _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 PersonalId() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalId"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property PersonalIdRecordRowSelection() As System.Web.UI.WebControls.CheckBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalIdRecordRowSelection"), System.Web.UI.WebControls.CheckBox) + End Get + End Property + + Public ReadOnly Property PersonalIdRowDeleteButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalIdRowDeleteButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalIdRowEditButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalIdRowEditButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalIdRowViewButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalIdRowViewButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalLastName() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalLastName"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property PersonalName() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalName"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property picture() As System.Web.UI.WebControls.FileUpload + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "picture"), System.Web.UI.WebControls.FileUpload) + End Get + End Property + + Public ReadOnly Property pictureImage() As System.Web.UI.WebControls.Image + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "pictureImage"), System.Web.UI.WebControls.Image) + End Get + End Property + + Public ReadOnly Property RankId() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RankId"), System.Web.UI.WebControls.Literal) + End Get + End Property + +#End Region + +#Region "Helper Functions" + + Public Overrides Overloads Function ModifyRedirectUrl(ByVal url As String, ByVal arg As String, ByVal bEncrypt As Boolean) As String + Return Me.Page.EvaluateExpressions(url, arg, bEncrypt, Me) + End Function + + Public Overrides Overloads Function EvaluateExpressions(ByVal url As String, ByVal arg As String, ByVal bEncrypt As Boolean) As String + + Dim rec As PersonalIdRecord = Nothing + + + Try + rec = Me.GetRecord() + Catch ex As Exception + ' Do nothing + End Try + + If rec Is Nothing AndAlso url.IndexOf("{") >= 0 Then + ' Localization. + + Throw New Exception(Page.GetResourceValue("Err:RecDataSrcNotInitialized", "Persons")) + + End If + Return EvaluateExpressions(url, arg, rec, bEncrypt) + End Function + + + Public Overridable Function GetRecord() As PersonalIdRecord + If Not Me.DataSource Is Nothing Then + Return Me.DataSource + End If + + If Not Me.RecordUniqueId Is Nothing Then + + Return PersonalIdTable.GetRecord(Me.RecordUniqueId, True) + + End If + + ' Localization. + + Throw New Exception(Page.GetResourceValue("Err:RetrieveRec", "Persons")) + + End Function + + Public Shadows ReadOnly Property Page() As BaseApplicationPage + Get + Return DirectCast(MyBase.Page, BaseApplicationPage) + End Get + End Property + +#End Region + +End Class + + + +' Base class for the PersonalIdTableControl control on the PersonalImage page. +' Do not modify this class. Instead override any method in PersonalIdTableControl. +Public Class BasePersonalIdTableControl + Inherits Persons.UI.BaseApplicationTableControl + + + + Protected Overridable Sub Control_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Init + + + + ' Setup the filter and search events. + + AddHandler Me.ArmyIdFilter1.SelectedIndexChanged, AddressOf ArmyIdFilter1_SelectedIndexChanged + AddHandler Me.SectionIdFilter1.SelectedIndexChanged, AddressOf SectionIdFilter1_SelectedIndexChanged + If Not Me.Page.IsPostBack Then + Dim initialVal As String = "" + If Me.InSession(Me.ArmyIdFilter1) + initialVal = Me.GetFromSession(Me.ArmyIdFilter1) + + End If + + If initialVal <> "" + + Me.ArmyIdFilter1.Items.Add(New ListItem(initialVal, initialVal)) + + Me.ArmyIdFilter1.SelectedValue = initialVal + + End If + + End If + If Not Me.Page.IsPostBack Then + Dim initialVal As String = "" + If Me.InSession(Me.PersonalIdSearch1) + initialVal = Me.GetFromSession(Me.PersonalIdSearch1) + + End If + + If initialVal <> "" + + Me.PersonalIdSearch1.Text = initialVal + + End If + + End If + If Not Me.Page.IsPostBack Then + Dim initialVal As String = "" + If Me.InSession(Me.SectionIdFilter1) + initialVal = Me.GetFromSession(Me.SectionIdFilter1) + + End If + + If initialVal <> "" + + Me.SectionIdFilter1.Items.Add(New ListItem(initialVal, initialVal)) + + Me.SectionIdFilter1.SelectedValue = initialVal + + End If + + End If + + + ' Control Initializations. + ' Initialize the table's current sort order. + + If Me.InSession(Me, "Order_By") Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + End If + + + + ' Setup default pagination settings. + + Me.PageSize = CInt(Me.GetFromSession(Me, "Page_Size", "10")) + Me.PageIndex = CInt(Me.GetFromSession(Me, "Page_Index", "0")) + + + + Me.ClearControlsFromSession() + End Sub + + Protected Overridable Sub Control_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load + + SaveControlsToSession_Ajax() + + ' Show confirmation message on Click + Me.PersonalIdDeleteButton.Attributes.Add("onClick", "return (confirm('" & (CType(Me.Page,BaseApplicationPage)).GetResourceValue("DeleteConfirm", "Persons") & "'));") + + ' Setup the pagination events. + + AddHandler Me.PersonalIdPagination.FirstPage.Click, AddressOf PersonalIdPagination_FirstPage_Click + + AddHandler Me.PersonalIdPagination.LastPage.Click, AddressOf PersonalIdPagination_LastPage_Click + + AddHandler Me.PersonalIdPagination.NextPage.Click, AddressOf PersonalIdPagination_NextPage_Click + + AddHandler Me.PersonalIdPagination.PageSizeButton.Click, AddressOf PersonalIdPagination_PageSizeButton_Click + + AddHandler Me.PersonalIdPagination.PreviousPage.Click, AddressOf PersonalIdPagination_PreviousPage_Click + + + ' Setup the sorting events. + + ' Setup the button events. + + AddHandler Me.PersonalIdAddButton.Click, AddressOf PersonalIdAddButton_Click + + AddHandler Me.PersonalIdDeleteButton.Click, AddressOf PersonalIdDeleteButton_Click + + AddHandler Me.PersonalIdEditButton.Click, AddressOf PersonalIdEditButton_Click + + AddHandler Me.PersonalIdRefreshButton.Click, AddressOf PersonalIdRefreshButton_Click + + AddHandler Me.PersonalIdResetButton.Click, AddressOf PersonalIdResetButton_Click + + AddHandler Me.PersonalIdSaveButton.Click, AddressOf PersonalIdSaveButton_Click + + Me.PersonalIdSaveButton.Attributes.Add("onclick", "SubmitHRefOnce(this, """ & Me.Page.GetResourceValue("Txt:SaveRecord", "Persons") & """);") + + AddHandler Me.PersonalIdSearchButton1.Button.Click, AddressOf PersonalIdSearchButton1_Click + + + ' Setup events for others + + End Sub + + + Public Overridable Sub LoadData() + + ' Read data from database. Returns an array of records that can be assigned + ' to the DataSource table control property. + Try + Dim joinFilter As CompoundFilter = CreateCompoundJoinFilter() + + ' The WHERE clause will be empty when displaying all records in table. + Dim wc As WhereClause = CreateWhereClause() + If wc IsNot Nothing AndAlso Not wc.RunQuery Then + ' Initialize an empty array of records + Dim alist As New ArrayList(0) + Me.DataSource = DirectCast(alist.ToArray(GetType(PersonalIdRecord)), PersonalIdRecord()) + ' Add records to the list if needed. + Me.AddNewRecords() + Me._TotalRecords = 0 + Me._TotalPages = 0 + Return + End If + + ' Call OrderBy to determine the order - either use the order defined + ' on the Query Wizard, or specified by user (by clicking on column heading) + Dim orderBy As OrderBy = CreateOrderBy() + + ' Get the pagesize from the pagesize control. + Me.GetPageSize() + + If Me.DisplayLastPage Then + Dim totalRecords As Integer = If(Me._TotalRecords < 0, PersonalIdTable.GetRecordCount(CreateCompoundJoinFilter(), CreateWhereClause()), Me._TotalRecords) + + Dim totalPages As Integer = CInt(Math.Ceiling(totalRecords / Me.PageSize)) + + Me.PageIndex = totalPages - 1 + End If + + ' Make sure PageIndex (current page) and PageSize are within bounds. + If Me.PageIndex < 0 Then + Me.PageIndex = 0 + End If + If Me.PageSize < 1 Then + Me.PageSize = 1 + End If + + ' Retrieve the records and set the table DataSource. + ' Only PageSize records are fetched starting at PageIndex (zero based). + If Me.AddNewRecord > 0 Then + ' Make sure to preserve the previously entered data on new rows. + Dim postdata As New ArrayList + For Each rc As PersonalIdTableControlRow In Me.GetRecordControls() + If Not rc.IsNewRecord Then + rc.DataSource = rc.GetRecord() + rc.GetUIData() + postdata.Add(rc.DataSource) + UIData.Add(rc.PreservedUIData()) + End If + Next + Me.DataSource = DirectCast(postdata.ToArray(GetType(PersonalIdRecord)), PersonalIdRecord()) + Else ' Get the records from the database + Me.DataSource = PersonalIdTable.GetRecords(joinFilter, wc, orderBy, Me.PageIndex, Me.PageSize) + + End If + + ' if the datasource contains no records contained in database, then load the last page. + If (DbUtils.GetCreatedRecords(Me.DataSource).Length = 0 AndAlso Not Me.DisplayLastPage) Then + Me.DisplayLastPage = True + LoadData() + Else + + ' Add any new rows desired by the user. + Me.AddNewRecords() + + ' Turn off the ToggleAll checkbox + Me.PersonalIdToggleAll.Checked = False + + + ' Initialize the page and grand totals. now + + End If + + Catch ex As Exception + ' Report the error message to the end user + Dim msg As String = ex.Message + If ex.InnerException IsNot Nothing Then + msg = msg & " InnerException: " & ex.InnerException.Message + End If + Throw New Exception(msg, ex.InnerException) + End Try + End Sub + + + + + Public Overrides Sub DataBind() + ' The DataBind method binds the user interface controls to the values + ' from the database record for each row in the table. To do this, it calls the + ' DataBind for each of the rows. + ' DataBind also populates any filters above the table, and sets the pagination + ' control to the correct number of records and the current page number. + + MyBase.DataBind() + + ' Make sure that the DataSource is initialized. + If Me.DataSource Is Nothing Then + Return + End If + + 'LoadData for DataSource for chart and report if they exist + + ' Setup the pagination controls. + BindPaginationControls() + + + + ' Bind the repeater with the list of records to expand the UI. + Dim rep As System.Web.UI.WebControls.Repeater = CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalIdTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return + rep.DataSource = DataSource() + rep.DataBind() + + Dim index As Integer = 0 + For Each repItem As System.Web.UI.WebControls.RepeaterItem In rep.Items + ' Loop through all rows in the table, set its DataSource and call DataBind(). + Dim recControl As PersonalIdTableControlRow = DirectCast(repItem.FindControl("PersonalIdTableControlRow"), PersonalIdTableControlRow) + recControl.DataSource = Me.DataSource(index) + If Me.UIData.Count > index Then + recControl.PreviousUIData = Me.UIData(index) + End If + recControl.DataBind() + recControl.Visible = Not Me.InDeletedRecordIds(recControl) + + index += 1 + Next + + + + + ' Call the Set methods for each controls on the panel + + SetArmyIdFilter1() + SetArmyIdLabel2() + + + + SetPersonalIdLabel() + + + + + SetPersonalIdSearch1() + + SetPersonalIdTableControlCollapsibleRegion() + SetPersonalIdTableControlIcon() + SetPersonalIdTableControlPanelExtender() + + + SetpictureLabel() + SetRankIdLabel() + SetSectionIdFilter1() + SetSectionIdLabel2() + ' setting the state of expand or collapse alternative rows + + + ' Load data for each record and table UI control. + ' Ordering is important because child controls get + ' their parent ids from their parent UI controls. + + + ' this method calls the set method for controls with special formula like running total, sum, rank, etc + SetFormulaControls() + End Sub + + Public Overridable Sub SetFormulaControls() + ' this method calls Set methods for the control that has special formula + + + + End Sub + + + + Public Overridable Sub RegisterPostback() + + Me.Page.RegisterPostBackTrigger(MiscUtils.FindControlRecursively(Me,"PersonalIdSaveButton")) + + + End Sub + + Public EvaluateFormulaDelegate As BaseClasses.Data.DataSource.EvaluateFormulaDelegate = New BaseClasses.Data.DataSource.EvaluateFormulaDelegate(AddressOf Me.EvaluateFormula) + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean, ByVal e as FormulaEvaluator) As String + If e Is Nothing + e = New FormulaEvaluator() + End If + + e.Variables.Clear() + + + ' add variables for formula evaluation + If variables IsNot Nothing Then + Dim enumerator As System.Collections.Generic.IEnumerator(Of System.Collections.Generic.KeyValuePair(Of String, Object)) = variables.GetEnumerator() + While enumerator.MoveNext() + e.Variables.Add(enumerator.Current.Key, enumerator.Current.Value) + End While + End If + + If includeDS + + End If + + ' All variables referred to in the formula are expected to be + ' properties of the DataSource. For example, referring to + ' UnitPrice as a variable will refer to DataSource.UnitPrice + e.DataSource = dataSourceForEvaluate + + ' Define the calling control. This is used to add other + ' related table and record controls as variables. + e.CallingControl = Me + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + + If Not String.IsNullOrEmpty(format) AndAlso (String.IsNullOrEmpty(formula) OrElse formula.IndexOf("Format(") < 0) Then + Return FormulaUtils.Format(resultObj, format) + Else + Return resultObj.ToString() + End If + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format,variables ,includeDS, Nothing) + End Function + + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object)) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format, variables ,True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, format, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal e as FormulaEvaluator) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, variables, True, e) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal includeDS as Boolean) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, includeDS, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, True, Nothing) + End Function + + + + + Public Overridable Sub ResetControl() + + Me.ArmyIdFilter1.ClearSelection() + + Me.SectionIdFilter1.ClearSelection() + + Me.PersonalIdSearch1.Text = "" + + Me.CurrentSortOrder.Reset() + If (Me.InSession(Me, "Order_By")) Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + End If + + Me.PageIndex = 0 + End Sub + + Protected Overridable Sub BindPaginationControls() + ' Setup the pagination controls. + + ' Bind the pagination labels. + + If DbUtils.GetCreatedRecords(Me.DataSource).Length > 0 Then + + Me.PersonalIdPagination.CurrentPage.Text = (Me.PageIndex + 1).ToString() + Else + Me.PersonalIdPagination.CurrentPage.Text = "0" + End If + Me.PersonalIdPagination.PageSize.Text = Me.PageSize.ToString() + Me.PersonalIdPagination.TotalItems.Text = Me.TotalRecords.ToString() + Me.PersonalIdPagination.TotalPages.Text = Me.TotalPages.ToString() + + ' Bind the buttons for PersonalIdTableControl pagination. + + Me.PersonalIdPagination.FirstPage.Enabled = Not (Me.PageIndex = 0) + If Me._TotalPages < 0 Then ' if the total pages is not determined yet, enable last and next buttons + Me.PersonalIdPagination.LastPage.Enabled = True + ElseIf Me._TotalPages = 0 ' if the total pages is determined and it is 0, enable last and next buttons + Me.PersonalIdPagination.LastPage.Enabled = False + Else ' if the total pages is the last page, disable last and next buttons + Me.PersonalIdPagination.LastPage.Enabled = Not (Me.PageIndex = Me.TotalPages - 1) + End If + + If Me._TotalPages < 0 Then ' if the total pages is not determined yet, enable last and next buttons + Me.PersonalIdPagination.NextPage.Enabled = True + ElseIf Me._TotalPages = 0 ' if the total pages is determined and it is 0, enable last and next buttons + Me.PersonalIdPagination.NextPage.Enabled = False + Else ' if the total pages is the last page, disable last and next buttons + Me.PersonalIdPagination.NextPage.Enabled = Not (Me.PageIndex = Me.TotalPages - 1) + End If + + Me.PersonalIdPagination.PreviousPage.Enabled = Not (Me.PageIndex = 0) + + + End Sub + + Public Overridable Sub SaveData() + ' Save the data from the entire table. Calls each row's Save Data + ' to save their data. This function is called by the Click handler of the + ' Save button. The button handler should Start/Commit/End a transaction. + + Dim recCtl As PersonalIdTableControlRow + For Each recCtl In Me.GetRecordControls() + + If Me.InDeletedRecordIds(recCtl) Then + ' Delete any pending deletes. + recCtl.Delete() + Else + If recCtl.Visible Then + recCtl.SaveData() + End If + End If + + Next + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + ' Set IsNewRecord to False for all records - since everything has been saved and is no longer "new" + For Each recCtl In Me.GetRecordControls() + recCtl.IsNewRecord = False + Next + + + ' Set DeletedRecordsIds to Nothing since we have deleted all pending deletes. + Me.DeletedRecordIds = Nothing + + End Sub + + Public Overridable Function CreateCompoundJoinFilter() As CompoundFilter + Dim jFilter As CompoundFilter = New CompoundFilter() + + Return jFilter + + End Function + + + Public Overridable Function CreateOrderBy() As OrderBy + ' The CurrentSortOrder is initialized to the sort order on the + ' Query Wizard. It may be modified by the Click handler for any of + ' the column heading to sort or reverse sort by that column. + ' You can add your own sort order, or modify it on the Query Wizard. + Return Me.CurrentSortOrder + End Function + + Public Overridable Function CreateWhereClause() As WhereClause + 'This CreateWhereClause is used for loading the data. + PersonalIdTable.Instance.InnerFilter = Nothing + Dim wc As WhereClause = New WhereClause() + + ' Compose the WHERE clause consiting of: + ' 1. Static clause defined at design time. + ' 2. User selected search criteria. + ' 3. User selected filter criteria. + + + If IsValueSelected(Me.ArmyIdFilter1) Then + + wc.iAND(PersonalIdTable.ArmyId, BaseFilter.ComparisonOperator.EqualsTo, MiscUtils.GetSelectedValue(Me.ArmyIdFilter1, Me.GetFromSession(Me.ArmyIdFilter1)), False, False) + + End If + + + + If IsValueSelected(Me.PersonalIdSearch1) Then + If Me.PersonalIdSearch1.Text = BaseClasses.Resources.AppResources.GetResourceValue("Txt:SearchForEllipsis", Nothing) Then + Me.PersonalIdSearch1.Text = "" + Else + ' Strip "..." from begin and ending of the search text, otherwise the search will return 0 values as in database "..." is not stored. + + If Me.PersonalIdSearch1.Text.StartsWith("...") Then + Me.PersonalIdSearch1.Text = Me.PersonalIdSearch1.Text.SubString(3,Me.PersonalIdSearch1.Text.Length-3) + End If + If Me.PersonalIdSearch1.Text.EndsWith("...") then + Me.PersonalIdSearch1.Text = Me.PersonalIdSearch1.Text.SubString(0,Me.PersonalIdSearch1.Text.Length-3) + ' Strip the last word as well as it is likely only a partial word + Dim endindex As Integer = PersonalIdSearch1.Text.Length - 1 + While (Not Char.IsWhiteSpace(PersonalIdSearch1.Text(endindex)) AndAlso endindex > 0) + endindex -= 1 + End While + If endindex > 0 Then + PersonalIdSearch1.Text = PersonalIdSearch1.Text.Substring(0, endindex) + End If + End If + End If + + Dim formatedSearchText As String = MiscUtils.GetSelectedValue(Me.PersonalIdSearch1, Me.GetFromSession(Me.PersonalIdSearch1)) + + ' After stripping "..." see if the search text is null or empty. + If IsValueSelected(Me.PersonalIdSearch1) Then + ' These clauses are added depending on operator and fields selected in Control's property page, bindings tab. + + Dim search As WhereClause = New WhereClause() + + search.iOR(PersonalIdTable.PersonalId, BaseFilter.ComparisonOperator.Contains, MiscUtils.GetSelectedValue(Me.PersonalIdSearch1, Me.GetFromSession(Me.PersonalIdSearch1)), True, False) + + search.iOR(PersonalIdTable.PersonalName, BaseFilter.ComparisonOperator.Contains, MiscUtils.GetSelectedValue(Me.PersonalIdSearch1, Me.GetFromSession(Me.PersonalIdSearch1)), True, False) + + search.iOR(PersonalIdTable.PersonalLastName, BaseFilter.ComparisonOperator.Contains, MiscUtils.GetSelectedValue(Me.PersonalIdSearch1, Me.GetFromSession(Me.PersonalIdSearch1)), True, False) + + wc.iAND(search) + + End If + End If + + If IsValueSelected(Me.SectionIdFilter1) Then + + wc.iAND(PersonalIdTable.SectionId, BaseFilter.ComparisonOperator.EqualsTo, MiscUtils.GetSelectedValue(Me.SectionIdFilter1, Me.GetFromSession(Me.SectionIdFilter1)), False, False) + + End If + + + + Return wc + End Function + + + Public Overridable Function CreateWhereClause(ByVal searchText as String, ByVal fromSearchControl as String, ByVal AutoTypeAheadSearch as String, ByVal AutoTypeAheadWordSeparators as String) As WhereClause + ' This CreateWhereClause is used for loading list of suggestions for Auto Type-Ahead feature. + PersonalIdTable.Instance.InnerFilter = Nothing + Dim wc As WhereClause = New WhereClause() + + ' Compose the WHERE clause consiting of: + ' 1. Static clause defined at design time. + ' 2. User selected search criteria. + ' 3. User selected filter criteria. + + Dim appRelativeVirtualPath As String = CType(HttpContext.Current.Session("AppRelativeVirtualPath"), String) + + ' Adds clauses if values are selected in Filter controls which are configured in the page. + + Dim ArmyIdFilter1SelectedValue As String = CType(HttpContext.Current.Session()(HttpContext.Current.Session.SessionID & appRelativeVirtualPath & "ArmyIdFilter1_Ajax"), String) + If IsValueSelected(ArmyIdFilter1SelectedValue) Then + + wc.iAND(PersonalIdTable.ArmyId, BaseFilter.ComparisonOperator.EqualsTo, ArmyIdFilter1SelectedValue, false, False) + + End If + + If IsValueSelected(searchText) and fromSearchControl = "PersonalIdSearch1" Then + Dim formatedSearchText as String = searchText + ' Strip "..." from begin and ending of the search text, otherwise the search will return 0 values as in database "..." is not stored. + If searchText.StartsWith("...") Then + formatedSearchText = searchText.SubString(3,searchText.Length-3) + End If + If searchText.EndsWith("...") Then + formatedSearchText = searchText.SubString(0,searchText.Length-3) + ' Strip the last word as well as it is likely only a partial word + Dim endindex As Integer = searchText.Length - 1 + While (Not Char.IsWhiteSpace(searchText(endindex)) AndAlso endindex > 0) + endindex -= 1 + End While + If endindex > 0 Then + searchText = searchText.Substring(0, endindex) + End If + End If + 'After stripping "...", trim any leading and trailing whitespaces + formatedSearchText = formatedSearchText.Trim() + ' After stripping "..." see if the search text is null or empty. + If IsValueSelected(formatedSearchText) Then + ' These clauses are added depending on operator and fields selected in Control's property page, bindings tab. + + Dim search As WhereClause = New WhereClause() + + If InvariantLCase(AutoTypeAheadSearch).equals("wordsstartingwithsearchstring") Then + + search.iOR(PersonalIdTable.PersonalId, BaseFilter.ComparisonOperator.Starts_With, formatedSearchText, True, False) + search.iOR(PersonalIdTable.PersonalId, BaseFilter.ComparisonOperator.Contains, AutoTypeAheadWordSeparators & formatedSearchText, True, False) + + search.iOR(PersonalIdTable.PersonalName, BaseFilter.ComparisonOperator.Starts_With, formatedSearchText, True, False) + search.iOR(PersonalIdTable.PersonalName, BaseFilter.ComparisonOperator.Contains, AutoTypeAheadWordSeparators & formatedSearchText, True, False) + + search.iOR(PersonalIdTable.PersonalLastName, BaseFilter.ComparisonOperator.Starts_With, formatedSearchText, True, False) + search.iOR(PersonalIdTable.PersonalLastName, BaseFilter.ComparisonOperator.Contains, AutoTypeAheadWordSeparators & formatedSearchText, True, False) + + Else + + search.iOR(PersonalIdTable.PersonalId, BaseFilter.ComparisonOperator.Contains, formatedSearchText, True, False) + search.iOR(PersonalIdTable.PersonalName, BaseFilter.ComparisonOperator.Contains, formatedSearchText, True, False) + search.iOR(PersonalIdTable.PersonalLastName, BaseFilter.ComparisonOperator.Contains, formatedSearchText, True, False) + End If + wc.iAND(search) + + End If + End If + + Dim SectionIdFilter1SelectedValue As String = CType(HttpContext.Current.Session()(HttpContext.Current.Session.SessionID & appRelativeVirtualPath & "SectionIdFilter1_Ajax"), String) + If IsValueSelected(SectionIdFilter1SelectedValue) Then + + wc.iAND(PersonalIdTable.SectionId, BaseFilter.ComparisonOperator.EqualsTo, SectionIdFilter1SelectedValue, false, False) + + End If + + + Return wc + End Function + + Public Overridable Function GetAutoCompletionList_PersonalIdSearch1(ByVal prefixText As String, ByVal count As Integer) As String() + Dim resultList As ArrayList = New ArrayList + Dim wordList As ArrayList = New ArrayList + Dim iteration As Integer = 0 + + Dim filterJoin As CompoundFilter = CreateCompoundJoinFilter() + Dim wc As WhereClause = CreateWhereClause(prefixText,"PersonalIdSearch1", "WordsStartingWithSearchString", "[^a-zA-Z0-9]") + While (resultList.Count < count AndAlso iteration < 5) + ' Fetch 100 records in each iteration + Dim recordList () As Persons.Business.PersonalIdRecord = PersonalIdTable.GetRecords(filterJoin, wc, Nothing, iteration, 100) + Dim rec As PersonalIdRecord = Nothing + Dim resultItem As String = "" + For Each rec In recordList + ' Exit the loop if recordList count has reached AutoTypeAheadListSize. + If resultList.Count >= count then + Exit For + End If + ' If the field is configured to Display as Foreign key, Format() method returns the + ' Display as Forien Key value instead of original field value. + ' Since search had to be done in multiple fields (selected in Control's page property, binding tab) in a record, + ' We need to find relevent field to display which matches the prefixText and is not already present in the result list. + + resultItem = rec.Format(PersonalIdTable.PersonalId) + If resultItem IsNot Nothing AndAlso resultItem.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture).Contains(prefixText.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture)) Then + + Dim isAdded As Boolean = FormatSuggestions(prefixText, resultItem, 50, "AtBeginningOfMatchedString", "WordsStartingWithSearchString", "[^a-zA-Z0-9]", resultList) + If isAdded Then + Continue For + End If + End If + + resultItem = rec.Format(PersonalIdTable.PersonalName) + If resultItem IsNot Nothing AndAlso resultItem.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture).Contains(prefixText.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture)) Then + + Dim isAdded As Boolean = FormatSuggestions(prefixText, resultItem, 50, "AtBeginningOfMatchedString", "WordsStartingWithSearchString", "[^a-zA-Z0-9]", resultList) + If isAdded Then + Continue For + End If + End If + + resultItem = rec.Format(PersonalIdTable.PersonalLastName) + If resultItem IsNot Nothing AndAlso resultItem.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture).Contains(prefixText.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture)) Then + + Dim isAdded As Boolean = FormatSuggestions(prefixText, resultItem, 50, "AtBeginningOfMatchedString", "WordsStartingWithSearchString", "[^a-zA-Z0-9]", resultList) + If isAdded Then + Continue For + End If + End If + + Next + ' Exit the loop if number of records found is less as further iteration will not return any more records + If recordList .Length < 100 Then + Exit While + End If + iteration += 1 + End While + + resultList.Sort() + Dim result() As String = New String(resultList.Count - 1) {} + Array.Copy(resultList.ToArray, result, resultList.Count) + Return result + End Function + + + Public Overridable Function FormatSuggestions(ByVal prefixText As String, ByVal resultItem As String, _ + ByVal columnLength As Integer, ByVal AutoTypeAheadDisplayFoundText As String, _ + ByVal autoTypeAheadSearch As String, ByVal AutoTypeAheadWordSeparators As String, _ + ByVal resultList As ArrayList) As Boolean + + 'Formats the resultItem and adds it to the list of suggestions. + Dim index As Integer = resultItem.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture).IndexOf(prefixText.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture)) + Dim itemToAdd As String = "" + Dim isFound As Boolean = False + Dim isAdded As Boolean = False + ' Get the index where prfixt is at the beginning of resultItem. If not found then, index of word which begins with prefixText. + If InvariantLCase(autoTypeAheadSearch).equals("wordsstartingwithsearchstring") And Not index = 0 Then + ' Expression to find word which contains AutoTypeAheadWordSeparators followed by prefixText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex( AutoTypeAheadWordSeparators + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + If regex1.IsMatch(resultItem) Then + index = regex1.Match(resultItem).Index + isFound = True + End If + ' If the prefixText is found immediatly after white space then starting of the word is found so don not search any further + If not resultItem(index).ToString() = " " Then + ' Expression to find beginning of the word which contains AutoTypeAheadWordSeparators followed by prefixText + Dim regex As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\\S*" + AutoTypeAheadWordSeparators + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + If regex.IsMatch(resultItem) Then + index = regex.Match(resultItem).Index + isFound = True + End If + End If + End If + + ' If autoTypeAheadSearch value is wordsstartingwithsearchstring then, extract the substring only if the prefixText is found at the + ' beginning of the resultItem (index = 0) or a word in resultItem is found starts with prefixText. + If index = 0 Or isFound Or InvariantLCase(autoTypeAheadSearch).Equals("anywhereinstring") then + If InvariantLCase(AutoTypeAheadDisplayFoundText).equals("atbeginningofmatchedstring") Then + ' Expression to find beginning of the word which contains prefixText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\\S*" + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + ' Find the beginning of the word which contains prefexText + If (StringUtils.InvariantLCase(autoTypeAheadSearch).Equals("anywhereinstring") AndAlso regex1.IsMatch(resultItem)) Then + index = regex1.Match(resultItem).Index + isFound = True + End If + ' Display string from the index till end of the string if sub string from index till end is less than columnLength value. + If Len(resultItem) - index <= columnLength Then + If index = 0 Then + itemToAdd = resultItem + Else + itemToAdd = "..." & resultItem.Substring(index, Len(resultItem) - index) + End If + Else + If index = 0 Then + itemToAdd = resultItem.Substring(index, (columnLength - 3)) & "..." + Else + 'Truncate the string to show only columnLength - 6 characters as begining and trailing "..." has to be appended. + itemToAdd = "..." & resultItem.Substring(index , columnLength - 6) & "..." + End If + End If + ElseIf InvariantLCase(AutoTypeAheadDisplayFoundText).equals("inmiddleofmatchedstring") Then + Dim subStringBeginIndex As Integer = CType(columnLength/2, Integer) + If Len(resultItem) <= columnLength Then + itemToAdd = resultItem + Else + ' Sanity check at end of the string + If index + Len(prefixText) = columnLength Then + itemToAdd = "..." & resultItem.Substring(index-columnLength,index) + ElseIf Len(resultItem) - index < subStringBeginIndex Then + ' Display string from the end till columnLength value if, index is closer to the end of the string. + itemToAdd = "..." & resultItem.Substring(Len(resultItem)-columnLength,Len(resultItem)) + ElseIf index <= subStringBeginIndex Then + ' Sanity chet at beginning of the string + itemToAdd = resultItem.Substring(0, columnLength) & "..." + Else + ' Display string containing text before the prefixText occures and text after the prefixText + itemToAdd = "..." & resultItem.Substring(index - subStringBeginIndex, columnLength) & "..." + End If + End If + ElseIf InvariantLCase(AutoTypeAheadDisplayFoundText).equals("atendofmatchedstring") Then + ' Expression to find ending of the word which contains prefexText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\s", System.Text.RegularExpressions.RegexOptions.IgnoreCase) + ' Find the ending of the word which contains prefexText + If regex1.IsMatch(resultItem, index + 1) Then + index = regex1.Match(resultItem, index + 1).Index + Else + ' If the word which contains prefexText is the last word in string, regex1.IsMatch returns false. + index = resultItem.Length + End If + If index > Len(resultItem) Then + index = Len(resultItem) + End If + ' If text from beginning of the string till index is less than columnLength value then, display string from the beginning till index. + If index <= columnLength Then + if index = Len(resultItem) Then 'Make decision to append "..." + itemToAdd = resultItem.Substring(0,index) + Else + itemToAdd = resultItem.Substring(0,index) & "..." + End If + Else + If index = Len(resultItem) Then + itemToAdd = "..." & resultItem.Substring(index - (columnLength - 3), (columnLength - 3)) + Else + 'Truncate the string to show only columnLength - 6 characters as begining and trailing "..." has to be appended. + itemToAdd = "..." & resultItem.Substring(index - (columnLength - 6), columnLength - 6) & "..." + End If + End If + End If + + ' Remove newline character from itemToAdd + Dim prefixTextIndex As Integer = itemToAdd.IndexOf(prefixText, StringComparison.CurrentCultureIgnoreCase) + ' If itemToAdd contains any newline after the search text then show text only till newline + Dim regex2 As System.Text.RegularExpressions.Regex = New System.Text.RegularExpressions.Regex("(" & vbCrLf & "|" & vbLf & ")", System.Text.RegularExpressions.RegexOptions.IgnoreCase) + Dim newLineIndexAfterPrefix As Integer = -1 + If regex2.IsMatch(itemToAdd, prefixTextIndex) Then + newLineIndexAfterPrefix = regex2.Match(itemToAdd, prefixTextIndex).Index + End If + If (newLineIndexAfterPrefix > -1) Then + If itemToAdd.EndsWith("...") Then + itemToAdd = (itemToAdd.Substring(0, newLineIndexAfterPrefix) + "...") + Else + itemToAdd = itemToAdd.Substring(0, newLineIndexAfterPrefix) + End If + End If + ' If itemToAdd contains any newline before search text then show text which comes after newline + Dim regex3 As System.Text.RegularExpressions.Regex = New System.Text.RegularExpressions.Regex("(" & vbCrLf & "|" & vbLf & ")", (System.Text.RegularExpressions.RegexOptions.IgnoreCase Or System.Text.RegularExpressions.RegexOptions.RightToLeft)) + Dim newLineIndexBeforePrefix As Integer = -1 + If regex3.IsMatch(itemToAdd, prefixTextIndex) Then + newLineIndexBeforePrefix = regex3.Match(itemToAdd, prefixTextIndex).Index + End If + If (newLineIndexBeforePrefix > -1) Then + If itemToAdd.StartsWith("...") Then + itemToAdd = ("..." + itemToAdd.Substring((newLineIndexBeforePrefix + regex3.Match(itemToAdd, prefixTextIndex).Length))) + Else + itemToAdd = itemToAdd.Substring((newLineIndexBeforePrefix + regex3.Match(itemToAdd, prefixTextIndex).Length)) + End If + End If + + If Not itemToAdd is nothing AndAlso Not resultList.Contains(itemToAdd) Then + + resultList.Add(itemToAdd) + + isAdded = true + End If + End If + Return isAdded + End Function + + + Protected Overridable Sub GetPageSize() + + If Me.PersonalIdPagination.PageSize.Text.Trim <> "" Then + Try + 'Me.PageSize = Integer.Parse(Me.PersonalIdPagination.PageSize.Text) + Catch ex As Exception + End Try + End If + End Sub + + Protected Overridable Sub AddNewRecords() + + Dim newRecordList As ArrayList = New ArrayList() + + Dim newUIDataList As System.Collections.Generic.List(Of Hashtable) = New System.Collections.Generic.List(Of Hashtable)() + + ' Loop though all the record controls and if the record control + ' does not have a unique record id set, then create a record + ' and add to the list. + If Not Me.ResetData Then + Dim rep As System.Web.UI.WebControls.Repeater = CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalIdTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return + + Dim repItem As System.Web.UI.WebControls.RepeaterItem + For Each repItem In rep.Items + ' Loop through all rows in the table, set its DataSource and call DataBind(). + + Dim recControl As PersonalIdTableControlRow = DirectCast(repItem.FindControl("PersonalIdTableControlRow"), PersonalIdTableControlRow) + + If recControl.Visible AndAlso recControl.IsNewRecord() Then + + Dim rec As PersonalIdRecord = New PersonalIdRecord() + + If recControl.PersonalId.Text <> "" Then + rec.Parse(recControl.PersonalId.Text, PersonalIdTable.PersonalId) + End If + If recControl.PersonalLastName.Text <> "" Then + rec.Parse(recControl.PersonalLastName.Text, PersonalIdTable.PersonalLastName) + End If + If recControl.PersonalName.Text <> "" Then + rec.Parse(recControl.PersonalName.Text, PersonalIdTable.PersonalName) + End If + If recControl.RankId.Text <> "" Then + rec.Parse(recControl.RankId.Text, PersonalIdTable.RankId) + End If + newUIDataList.Add(recControl.PreservedUIData()) + newRecordList.Add(rec) + End If + Next + End If + + + ' Add any new record to the list. + Dim index As Integer = 0 + For index = 1 To Me.AddNewRecord + + newRecordList.Insert(0, New PersonalIdRecord()) + newUIDataList.Insert(0, New Hashtable()) + + Next + Me.AddNewRecord = 0 + + ' Finally, add any new records to the DataSource. + If newRecordList.Count > 0 Then + + Dim finalList As ArrayList = New ArrayList(Me.DataSource) + finalList.InsertRange(0, newRecordList) + + Me.DataSource = DirectCast(finalList.ToArray(GetType(PersonalIdRecord)), PersonalIdRecord()) + + End If + + ' Add the existing UI data to this hash table + If newUIDataList.Count > 0 Then + Me.UIData.InsertRange(0, newUIDataList) + End If + + End Sub + + + Public Sub AddToDeletedRecordIds(ByVal rec As PersonalIdTableControlRow) + If rec.IsNewRecord() Then + Return + End If + + If Not Me.DeletedRecordIds Is Nothing AndAlso Me.DeletedRecordIds.Trim <> "" Then + Me.DeletedRecordIds &= "," + End If + + Me.DeletedRecordIds &= "[" & rec.RecordUniqueId & "]" + End Sub + + Protected Overridable Function InDeletedRecordIds(ByVal rec As PersonalIdTableControlRow) As Boolean + If Me.DeletedRecordIds Is Nothing OrElse Me.DeletedRecordIds.Trim = "" Then + Return False + End If + + Return Me.DeletedRecordIds.IndexOf("[" & rec.RecordUniqueId & "]") >= 0 + End Function + + Private _DeletedRecordIds As String + Public Property DeletedRecordIds() As String + Get + Return Me._DeletedRecordIds + End Get + Set(ByVal value As String) + Me._DeletedRecordIds = value + End Set + End Property + + + ' Create Set, WhereClause, and Populate Methods + + Public Overridable Sub SetArmyIdLabel2() + + End Sub + + Public Overridable Sub SetPersonalIdLabel() + + End Sub + + Public Overridable Sub SetPersonalIdTableControlCollapsibleRegion() + + End Sub + + Public Overridable Sub SetPersonalIdTableControlIcon() + + End Sub + + Public Overridable Sub SetPersonalIdTableControlPanelExtender() + + End Sub + + Public Overridable Sub SetpictureLabel() + + End Sub + + Public Overridable Sub SetRankIdLabel() + + End Sub + + Public Overridable Sub SetSectionIdLabel2() + + End Sub + + Public Overridable Sub SetArmyIdFilter1() + + Me.PopulateArmyIdFilter1(GetSelectedValue(Me.ArmyIdFilter1, GetFromSession(Me.ArmyIdFilter1)), 500) + + End Sub + + Public Overridable Sub SetPersonalIdSearch1() + + End Sub + + Public Overridable Sub SetSectionIdFilter1() + + Me.PopulateSectionIdFilter1(GetSelectedValue(Me.SectionIdFilter1, GetFromSession(Me.SectionIdFilter1)), 500) + + End Sub + + ' Get the filters' data for ArmyIdFilter1 + Protected Overridable Sub PopulateArmyIdFilter1(ByVal selectedValue As String, ByVal maxItems As Integer) + + + Me.ArmyIdFilter1.Items.Clear() + + + + ' Set up the WHERE and the ORDER BY clause by calling the CreateWhereClause_ArmyIdFilter1 function. + ' It is better to customize the where clause there. + + + + 'Setup the WHERE clause. + Dim wc As WhereClause = Me.CreateWhereClause_ArmyIdFilter1() + + ' Setup the static list items + + ' Add the All item. + Me.ArmyIdFilter1.Items.Insert(0, new ListItem(Me.Page.GetResourceValue("Txt:All", "Persons"), "--ANY--")) + + + Dim orderBy As OrderBy = New OrderBy(false, false) + orderBy.Add(ArmyTable.Army, OrderByItem.OrderDir.Asc) + + Dim variables As System.Collections.Generic.IDictionary(Of String, Object) = New System.Collections.Generic.Dictionary(Of String, Object) + + + + Dim noValueFormat As String = Page.GetResourceValue("Txt:Other", "Persons") + + + Dim itemValues() As ArmyRecord = Nothing + + If wc.RunQuery + Dim counter As Integer = 0 + Dim pageNum As Integer = 0 + Dim evaluator As New FormulaEvaluator + Dim listDuplicates As New ArrayList() + + + + Do + + itemValues = ArmyTable.GetRecords(wc, orderBy, pageNum, maxItems) + + For each itemValue As ArmyRecord In itemValues + ' Create the item and add to the list. + Dim cvalue As String = Nothing + Dim fvalue As String = Nothing + If itemValue.ArmyIdSpecified Then + cvalue = itemValue.ArmyId.ToString() + + If counter < maxItems AndAlso Me.ArmyIdFilter1.Items.FindByValue(cvalue) Is Nothing Then + + Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalIdTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalIdTable.ArmyId) + If _isExpandableNonCompositeForeignKey AndAlso PersonalIdTable.ArmyId.IsApplyDisplayAs Then + fvalue = PersonalIdTable.GetDFKA(itemValue, PersonalIdTable.ArmyId) + End If + If (Not _isExpandableNonCompositeForeignKey) Or (String.IsNullOrEmpty(fvalue)) Then + fvalue = itemValue.Format(ArmyTable.Army) + 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.ArmyIdFilter1.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.ArmyIdFilter1.Items.Add(newItem) + + If listDuplicates.Contains(fvalue) Then + newItem.Text = fvalue & " (ID " & cvalue.Substring(0, Math.Min(cvalue.Length,38)) & ")" + End If + + counter += 1 + End If + End If + Next + pageNum += 1 + Loop While (itemValues.Length = maxItems AndAlso counter < maxItems) + End If + + + + + + + ' Set the selected value. + SetSelectedValue(Me.ArmyIdFilter1, selectedValue) + + + End Sub + + ' Get the filters' data for SectionIdFilter1 + Protected Overridable Sub PopulateSectionIdFilter1(ByVal selectedValue As String, ByVal maxItems As Integer) + + + Me.SectionIdFilter1.Items.Clear() + + + + ' Set up the WHERE and the ORDER BY clause by calling the CreateWhereClause_SectionIdFilter1 function. + ' It is better to customize the where clause there. + + + + 'Setup the WHERE clause. + Dim wc As WhereClause = Me.CreateWhereClause_SectionIdFilter1() + + ' Setup the static list items + + ' Add the All item. + Me.SectionIdFilter1.Items.Insert(0, new ListItem(Me.Page.GetResourceValue("Txt:All", "Persons"), "--ANY--")) + + + Dim orderBy As OrderBy = New OrderBy(false, false) + orderBy.Add(SectionTable.SectionName, OrderByItem.OrderDir.Asc) + + Dim variables As System.Collections.Generic.IDictionary(Of String, Object) = New System.Collections.Generic.Dictionary(Of String, Object) + + + + Dim noValueFormat As String = Page.GetResourceValue("Txt:Other", "Persons") + + + Dim itemValues() As SectionRecord = Nothing + + If wc.RunQuery + Dim counter As Integer = 0 + Dim pageNum As Integer = 0 + Dim evaluator As New FormulaEvaluator + Dim listDuplicates As New ArrayList() + + + + Do + + itemValues = SectionTable.GetRecords(wc, orderBy, pageNum, maxItems) + + For each itemValue As SectionRecord In itemValues + ' Create the item and add to the list. + Dim cvalue As String = Nothing + Dim fvalue As String = Nothing + If itemValue.SectionIdSpecified Then + cvalue = itemValue.SectionId.ToString() + + If counter < maxItems AndAlso Me.SectionIdFilter1.Items.FindByValue(cvalue) Is Nothing Then + + Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalIdTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalIdTable.SectionId) + If _isExpandableNonCompositeForeignKey AndAlso PersonalIdTable.SectionId.IsApplyDisplayAs Then + fvalue = PersonalIdTable.GetDFKA(itemValue, PersonalIdTable.SectionId) + End If + If (Not _isExpandableNonCompositeForeignKey) Or (String.IsNullOrEmpty(fvalue)) Then + fvalue = itemValue.Format(SectionTable.SectionName) + 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.SectionIdFilter1.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.SectionIdFilter1.Items.Add(newItem) + + If listDuplicates.Contains(fvalue) Then + newItem.Text = fvalue & " (ID " & cvalue.Substring(0, Math.Min(cvalue.Length,38)) & ")" + End If + + counter += 1 + End If + End If + Next + pageNum += 1 + Loop While (itemValues.Length = maxItems AndAlso counter < maxItems) + End If + + + + + + + ' Set the selected value. + SetSelectedValue(Me.SectionIdFilter1, selectedValue) + + + End Sub + + Public Overridable Function CreateWhereClause_ArmyIdFilter1() As WhereClause + + ' Create a where clause for the filter ArmyIdFilter1. + ' This function is called by the Populate method to load the items + ' in the ArmyIdFilter1DropDownList + + Dim wc As WhereClause= New WhereClause() + Return wc + + End Function + + Public Overridable Function CreateWhereClause_SectionIdFilter1() As WhereClause + + ' Create a where clause for the filter SectionIdFilter1. + ' This function is called by the Populate method to load the items + ' in the SectionIdFilter1DropDownList + + Dim wc As WhereClause= New WhereClause() + Return wc + + End Function + + + + + Protected Overridable Sub Control_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.PreRender + ' PreRender event is raised just before page is being displayed. + Try + DbUtils.StartTransaction + Me.RegisterPostback() + + If Not Me.Page.ErrorOnPage AndAlso (Me.Page.IsPageRefresh OrElse Me.DataChanged OrElse Me.ResetData) Then + + + ' Re-load the data and update the web page if necessary. + ' This is typically done during a postback (filter, search button, sort, pagination button). + ' In each of the other click handlers, simply set DataChanged to True to reload the data. + Dim added As Boolean = Me.AddNewRecord > 0 + Me.LoadData() + Me.DataBind() + + If added Then + Me.SetFocusToAddedRow() + End If + + End If + + + + Catch ex As Exception + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + Finally + DbUtils.EndTransaction + End Try + End Sub + + 'this function sets focus to the first editable element in the new added row in the editable table + Protected Overridable Sub SetFocusToAddedRow() + Dim rep As System.Web.UI.WebControls.Repeater = CType(Me.FindControl("PersonalIdTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing OrElse rep.Items.Count = 0 Then Return + Dim repItem As System.Web.UI.WebControls.RepeaterItem + For Each repItem In rep.Items + 'Load scripts to table rows + Me.Page.LoadFocusScripts(repItem) + Dim recControl As PersonalIdTableControlRow = DirectCast(repItem.FindControl("PersonalIdTableControlRow"), PersonalIdTableControlRow) + If recControl.IsNewRecord Then + For Each field As Control In recControl.Controls + If field.Visible AndAlso Me.Page.IsControlEditable(field, False) Then + 'set focus on the first editable field in the new row + field.Focus() + Dim updPan As UpdatePanel = DirectCast(Me.Page.FindControlRecursively("UpdatePanel1"), UpdatePanel) + If Not updPan Is Nothing Then updPan.Update() + Return + End If + Next + Return + End If + Next + End Sub + + + Protected Overrides Sub SaveControlsToSession() + MyBase.SaveControlsToSession() + + ' Save filter controls to values to session. + + Me.SaveToSession(Me.ArmyIdFilter1, Me.ArmyIdFilter1.SelectedValue) + + Me.SaveToSession(Me.PersonalIdSearch1, Me.PersonalIdSearch1.Text) + + Me.SaveToSession(Me.SectionIdFilter1, Me.SectionIdFilter1.SelectedValue) + + + 'Save pagination state to session. + + + + ' Save table control properties to the session. + If Not Me.CurrentSortOrder Is Nothing Then + Me.SaveToSession(Me, "Order_By", Me.CurrentSortOrder.ToXmlString()) + End If + + Me.SaveToSession(Me, "Page_Index", Me.PageIndex.ToString()) + Me.SaveToSession(Me, "Page_Size", Me.PageSize.ToString()) + + Me.SaveToSession(Me, "DeletedRecordIds", Me.DeletedRecordIds) + + End Sub + + Protected Sub SaveControlsToSession_Ajax() + ' Save filter controls to values to session. + + Me.SaveToSession("ArmyIdFilter1_Ajax", Me.ArmyIdFilter1.SelectedValue) + + Me.SaveToSession("PersonalIdSearch1_Ajax", Me.PersonalIdSearch1.Text) + + Me.SaveToSession("SectionIdFilter1_Ajax", Me.SectionIdFilter1.SelectedValue) + + HttpContext.Current.Session("AppRelativeVirtualPath") = Me.Page.AppRelativeVirtualPath + + End Sub + + Protected Overrides Sub ClearControlsFromSession() + MyBase.ClearControlsFromSession() + + ' Clear filter controls values from the session. + + Me.RemoveFromSession(Me.ArmyIdFilter1) + Me.RemoveFromSession(Me.PersonalIdSearch1) + Me.RemoveFromSession(Me.SectionIdFilter1) + + ' Clear pagination state from session. + + + + ' Clear table properties from the session. + Me.RemoveFromSession(Me, "Order_By") + Me.RemoveFromSession(Me, "Page_Index") + Me.RemoveFromSession(Me, "Page_Size") + + Me.RemoveFromSession(Me, "DeletedRecordIds") + + End Sub + + Protected Overrides Sub LoadViewState(ByVal savedState As Object) + MyBase.LoadViewState(savedState) + + Dim orderByStr As String = CType(ViewState("PersonalIdTableControl_OrderBy"), String) + + If orderByStr IsNot Nothing AndAlso orderByStr.Trim <> "" Then + Me.CurrentSortOrder = BaseClasses.Data.OrderBy.FromXmlString(orderByStr) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + End If + + Dim pageIndex As String = CType(ViewState("Page_Index"), String) + If pageIndex IsNot Nothing Then + Me.PageIndex = CInt(pageIndex) + End If + + Dim pageSize As String = CType(ViewState("Page_Size"), String) + If Not pageSize Is Nothing Then + Me.PageSize = CInt(pageSize) + End If + + + + ' Load view state for pagination control. + + Me.DeletedRecordIds = CType(Me.ViewState("DeletedRecordIds"), String) + + End Sub + + Protected Overrides Function SaveViewState() As Object + + If Me.CurrentSortOrder IsNot Nothing Then + Me.ViewState("PersonalIdTableControl_OrderBy") = Me.CurrentSortOrder.ToXmlString() + End If + + Me.ViewState("Page_Index") = Me.PageIndex + Me.ViewState("Page_Size") = Me.PageSize + + Me.ViewState("DeletedRecordIds") = Me.DeletedRecordIds + + + ' Load view state for pagination control. + + + Return MyBase.SaveViewState() + End Function + + ' Generate the event handling functions for pagination events. + + ' event handler for ImageButton + Public Overridable Sub PersonalIdPagination_FirstPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.PageIndex = 0 + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalIdPagination_LastPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.DisplayLastPage = True + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalIdPagination_NextPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.PageIndex += 1 + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for LinkButton + Public Overridable Sub PersonalIdPagination_PageSizeButton_Click(ByVal sender As Object, ByVal args As EventArgs) + + Try + + Me.DataChanged = True + + Me.PageSize = Integer.Parse(Me.PersonalIdPagination.PageSize.Text) + + Me.PageIndex = Integer.Parse(Me.PersonalIdPagination.CurrentPage.Text) - 1 + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalIdPagination_PreviousPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + If Me.PageIndex > 0 Then + Me.PageIndex -= 1 + Me.DataChanged = True + End If + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + + ' Generate the event handling functions for sorting events. + + + ' Generate the event handling functions for button events. + + ' event handler for ImageButton + Public Overridable Sub PersonalIdAddButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + Me.AddNewRecord = 1 + Me.DataChanged = True + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalIdDeleteButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + If(Not Me.Page.IsPageRefresh) Then + + Me.DeleteSelectedRecords(True) + Me.SetFormulaControls() + + + End If + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalIdEditButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + ' The redirect URL is set on the Properties, Custom Properties or Actions. + ' The ModifyRedirectURL call resolves the parameters before the + ' Response.Redirect redirects the page to the URL. + ' Any code after the Response.Redirect call will not be executed, since the page is + ' redirected to the URL. + + + Dim url As String = "../PersonalId/EditPersonalId.aspx?PersonalId={PK}" + + Dim shouldRedirect As Boolean = True + Dim TargetKey As String = Nothing + Dim DFKA As String = TargetKey + Dim id As String = DFKA + Dim value As String = id + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + url = Me.ModifyRedirectUrl(url, "",False) + url = Me.Page.ModifyRedirectUrl(url, "",False) + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + shouldRedirect = False + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + If shouldRedirect Then + Me.Page.ShouldSaveControlsToSession = True + Me.Page.Response.Redirect(url) + ElseIf Not TargetKey Is Nothing AndAlso _ + Not shouldRedirect Then + Me.Page.ShouldSaveControlsToSession = True + Me.Page.CloseWindow(True) + + End If + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalIdRefreshButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Dim PersonalIdTableControlObj as PersonalIdTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalIdTableControl"), PersonalIdTableControl) + PersonalIdTableControlObj.ResetData = True + + PersonalIdTableControlObj.RemoveFromSession(PersonalIdTableControlObj, "DeletedRecordIds") + PersonalIdTableControlObj.DeletedRecordIds = Nothing + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalIdResetButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.ArmyIdFilter1.ClearSelection() + Me.SectionIdFilter1.ClearSelection() + Me.PersonalIdSearch1.Text = "" + Me.CurrentSortOrder.Reset() + If Me.InSession(Me, "Order_By") Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + + End If + + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalIdSaveButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + + If (Not Me.Page.IsPageRefresh) Then + Me.SaveData() + End If + + Me.Page.CommitTransaction(sender) + ' Set IsNewRecord to False for all records - since everything has been saved and is no longer "new" + Dim recCtl As PersonalIdTableControlRow + For Each recCtl in Me.GetRecordControls() + + recCtl.IsNewRecord = False + Next + + + ' Set DeletedRecordsIds to Nothing since we have deleted all pending deletes. + + Me.DeletedRecordIds = Nothing + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for Button with Layout + Public Overridable Sub PersonalIdSearchButton1_Click(ByVal sender As Object, ByVal args As EventArgs) + + Try + + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + + + ' Generate the event handling functions for filter and search events. + + ' event handler for FieldFilter + Protected Overridable Sub ArmyIdFilter1_SelectedIndexChanged(ByVal sender As Object, ByVal args As EventArgs) + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + + End Sub + + ' event handler for FieldFilter + Protected Overridable Sub SectionIdFilter1_SelectedIndexChanged(ByVal sender As Object, ByVal args As EventArgs) + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + + End Sub + + + ' Generate the event handling functions for others + + + Private _UIData As New System.Collections.Generic.List(Of Hashtable) + Public Property UIData() As System.Collections.Generic.List(Of Hashtable) + Get + Return Me._UIData + End Get + Set(ByVal value As System.Collections.Generic.List(Of Hashtable)) + Me._UIData = value + End Set + End Property + + ' pagination properties + Protected _PageSize As Integer + Public Property PageSize() As Integer + Get + Return Me._PageSize + End Get + Set(ByVal value As Integer) + Me._PageSize = value + End Set + End Property + + Protected _PageIndex As Integer + Public Property PageIndex() As Integer + Get + ' Return the PageIndex + Return Me._PageIndex + End Get + Set(ByVal value As Integer) + Me._PageIndex = value + End Set + End Property + + Protected _TotalRecords As Integer = -1 + Public Property TotalRecords() As Integer + Get + If _TotalRecords < 0 + _TotalRecords = PersonalIdTable.GetRecordCount(CreateCompoundJoinFilter(), CreateWhereClause()) + End If + Return Me._TotalRecords + End Get + Set(ByVal value As Integer) + If Me.PageSize > 0 Then + + Me.TotalPages = CInt(Math.Ceiling(value / Me.PageSize)) + + End If + Me._TotalRecords = value + End Set + End Property + + + + Protected _TotalPages As Integer = -1 + Public Property TotalPages() As Integer + Get + If _TotalPages < 0 Then + + Me.TotalPages = CInt(Math.Ceiling(TotalRecords / Me.PageSize)) + + End If + Return Me._TotalPages + End Get + Set(ByVal value As Integer) + Me._TotalPages = value + End Set + End Property + + Protected _DisplayLastPage As Boolean + Public Property DisplayLastPage() As Boolean + Get + Return Me._DisplayLastPage + End Get + Set(ByVal value As Boolean) + Me._DisplayLastPage = value + End Set + End Property + + Private _DataChanged As Boolean = False + Public Property DataChanged() As Boolean + Get + Return Me._DataChanged + End Get + Set(ByVal value As Boolean) + Me._DataChanged = value + End Set + End Property + + Private _ResetData As Boolean = False + Public Property ResetData() As Boolean + Get + Return Me._ResetData + End Get + Set(ByVal value As Boolean) + Me._ResetData = value + End Set + End Property + + Private _AddNewRecord As Integer = 0 + Public Property AddNewRecord() As Integer + Get + Return Me._AddNewRecord + End Get + Set(ByVal value As Integer) + Me._AddNewRecord = value + End Set + End Property + + + Private _CurrentSortOrder As OrderBy = Nothing + Public Property CurrentSortOrder() As OrderBy + Get + Return Me._CurrentSortOrder + End Get + Set(ByVal value As BaseClasses.Data.OrderBy) + Me._CurrentSortOrder = value + End Set + End Property + + Private _DataSource() As PersonalIdRecord = Nothing + Public Property DataSource() As PersonalIdRecord () + Get + Return Me._DataSource + End Get + Set(ByVal value() As PersonalIdRecord) + Me._DataSource = value + End Set + End Property + +#Region "Helper Properties" + + Public ReadOnly Property ArmyIdFilter1() As System.Web.UI.WebControls.DropDownList + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "ArmyIdFilter1"), System.Web.UI.WebControls.DropDownList) + End Get + End Property + + Public ReadOnly Property ArmyIdLabel2() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "ArmyIdLabel2"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property PersonalIdAddButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalIdAddButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalIdDeleteButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalIdDeleteButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalIdEditButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalIdEditButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalIdLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalIdLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property PersonalIdPagination() As Persons.UI.IPagination + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalIdPagination"), Persons.UI.IPagination) + End Get + End Property + + Public ReadOnly Property PersonalIdRefreshButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalIdRefreshButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalIdResetButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalIdResetButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalIdSaveButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalIdSaveButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalIdSearch1() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalIdSearch1"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property PersonalIdSearchButton1() As Persons.UI.IThemeButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalIdSearchButton1"), Persons.UI.IThemeButton) + End Get + End Property + + Public ReadOnly Property PersonalIdTableControlCollapsibleRegion() As System.Web.UI.WebControls.Panel + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalIdTableControlCollapsibleRegion"), System.Web.UI.WebControls.Panel) + End Get + End Property + + Public ReadOnly Property PersonalIdTableControlIcon() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalIdTableControlIcon"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalIdTableControlPanelExtender() As AjaxControlToolkit.CollapsiblePanelExtender + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalIdTableControlPanelExtender"), AjaxControlToolkit.CollapsiblePanelExtender) + End Get + End Property + + Public ReadOnly Property PersonalIdTitle() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalIdTitle"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property PersonalIdToggleAll() As System.Web.UI.WebControls.CheckBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalIdToggleAll"), System.Web.UI.WebControls.CheckBox) + End Get + End Property + + Public ReadOnly Property pictureLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "pictureLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property RankIdLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RankIdLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property SectionIdFilter1() As System.Web.UI.WebControls.DropDownList + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "SectionIdFilter1"), System.Web.UI.WebControls.DropDownList) + End Get + End Property + + Public ReadOnly Property SectionIdLabel2() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "SectionIdLabel2"), System.Web.UI.WebControls.Literal) + End Get + End Property + +#End Region + +#Region "Helper Functions" + + Public Overrides Overloads Function ModifyRedirectUrl(url As String, arg As String, ByVal bEncrypt As Boolean) As String + Return Me.Page.EvaluateExpressions(url, arg, bEncrypt, Me) + End Function + + Public Overrides Overloads Function EvaluateExpressions(url As String, arg As String, ByVal bEncrypt As Boolean) As String + Dim needToProcess As Boolean = AreAnyUrlParametersForMe(url, arg) + If (needToProcess) Then + Dim recCtl As PersonalIdTableControlRow = Me.GetSelectedRecordControl() + If recCtl Is Nothing AndAlso url.IndexOf("{") >= 0 Then + ' Localization. + Throw New Exception(Page.GetResourceValue("Err:NoRecSelected", "Persons")) + End If + Dim rec As PersonalIdRecord = Nothing + If recCtl IsNot Nothing Then + rec = recCtl.GetRecord() + End If + Return EvaluateExpressions(url, arg, rec, bEncrypt) + End If + Return url + End Function + + Public Overridable Function GetSelectedRecordIndex() As Integer + Dim counter As Integer = 0 + Dim recControl As PersonalIdTableControlRow + For Each recControl In Me.GetRecordControls() + If recControl.PersonalIdRecordRowSelection.Checked Then + Return counter + End If + counter += 1 + Next + Return -1 + End Function + + Public Overridable Function GetSelectedRecordControl() As PersonalIdTableControlRow + Dim selectedList() As PersonalIdTableControlRow = Me.GetSelectedRecordControls() + If selectedList.Length = 0 Then + Return Nothing + End If + Return selectedList(0) + + End Function + + Public Overridable Function GetSelectedRecordControls() As PersonalIdTableControlRow() + + Dim selectedList As ArrayList = New ArrayList(25) + Dim recControl As PersonalIdTableControlRow + For Each recControl In Me.GetRecordControls() + If recControl.PersonalIdRecordRowSelection IsNot Nothing AndAlso recControl.PersonalIdRecordRowSelection.Checked Then + selectedList.Add(recControl) + End If + Next + Return DirectCast(selectedList.ToArray(GetType(PersonalIdTableControlRow)), PersonalIdTableControlRow()) + + End Function + + Public Overridable Sub DeleteSelectedRecords(ByVal deferDeletion As Boolean) + Dim recList() As PersonalIdTableControlRow = Me.GetSelectedRecordControls() + If recList.Length = 0 Then + ' Localization. + Throw New Exception(Page.GetResourceValue("Err:NoRecSelected", "Persons")) + End If + + Dim recCtl As PersonalIdTableControlRow + For Each recCtl In recList + If deferDeletion Then + If Not recCtl.IsNewRecord Then + + Me.AddToDeletedRecordIds(recCtl) + + End If + recCtl.Visible = False + + recCtl.PersonalIdRecordRowSelection.Checked = False + + Else + + recCtl.Delete() + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + End If + Next + End Sub + + Public Function GetRecordControls() As PersonalIdTableControlRow() + Dim recList As ArrayList = New ArrayList() + Dim rep As System.Web.UI.WebControls.Repeater = CType(Me.FindControl("PersonalIdTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return Nothing + Dim repItem As System.Web.UI.WebControls.RepeaterItem + + For Each repItem In rep.Items + + Dim recControl As PersonalIdTableControlRow = DirectCast(repItem.FindControl("PersonalIdTableControlRow"), PersonalIdTableControlRow) + recList.Add(recControl) + + Next + + Return DirectCast(recList.ToArray(GetType(PersonalIdTableControlRow)), PersonalIdTableControlRow()) + 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 + + \ No newline at end of file diff --git a/App_Code/PersonalId/ShowPersonalId.Controls.vb b/App_Code/PersonalId/ShowPersonalId.Controls.vb new file mode 100644 index 0000000..c308780 --- /dev/null +++ b/App_Code/PersonalId/ShowPersonalId.Controls.vb @@ -0,0 +1,44474 @@ + +' This file implements the TableControl, TableControlRow, and RecordControl classes for the +' ShowPersonalId.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.ShowPersonalId + +#Region "Section 1: Place your customizations here." + + + +Public Class PersonalDDTableControlRow + Inherits BasePersonalDDTableControlRow + ' The BasePersonalDDTableControlRow implements code for a ROW within the + ' the PersonalDDTableControl table. The BasePersonalDDTableControlRow implements the DataBind and SaveData methods. + ' The loading of data is actually performed by the LoadData method in the base class of PersonalDDTableControl. + + ' This is the ideal place to add your code customizations. For example, you can override the DataBind, + ' SaveData, GetUIData, and Validate methods. + + +End Class + + + +Public Class PersonalDDTableControl + Inherits BasePersonalDDTableControl + + ' The BasePersonalDDTableControl class implements the LoadData, DataBind, CreateWhereClause + ' and other methods to load and display the data in a table control. + + ' This is the ideal place to add your code customizations. You can override the LoadData and CreateWhereClause, + ' The PersonalDDTableControlRow class offers another place where you can customize + ' the DataBind, GetUIData, SaveData and Validate methods specific to each row displayed on the table. + +End Class + + +Public Class PersonalEducationTableControlRow + Inherits BasePersonalEducationTableControlRow + ' The BasePersonalEducationTableControlRow implements code for a ROW within the + ' the PersonalEducationTableControl table. The BasePersonalEducationTableControlRow implements the DataBind and SaveData methods. + ' The loading of data is actually performed by the LoadData method in the base class of PersonalEducationTableControl. + + ' This is the ideal place to add your code customizations. For example, you can override the DataBind, + ' SaveData, GetUIData, and Validate methods. + + + 'Private Sub PersonalEducationTableControlRow_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.PreRender + ' If Me.EducationPeriod.Text = "1" Then + ' Me.EducationPeriod.Text = "ก่อนรับราชการ" + ' Else + ' Me.EducationPeriod.Text = "หลังรับราชการ" + ' + ' End If + 'End Sub + End Class + + + +Public Class PersonalEducationTableControl + Inherits BasePersonalEducationTableControl + + ' The BasePersonalEducationTableControl class implements the LoadData, DataBind, CreateWhereClause + ' and other methods to load and display the data in a table control. + + ' This is the ideal place to add your code customizations. You can override the LoadData and CreateWhereClause, + ' The PersonalEducationTableControlRow class offers another place where you can customize + ' the DataBind, GetUIData, SaveData and Validate methods specific to each row displayed on the table. + +End Class + + +Public Class PersonalExtWorkTableControlRow + Inherits BasePersonalExtWorkTableControlRow + ' The BasePersonalExtWorkTableControlRow implements code for a ROW within the + ' the PersonalExtWorkTableControl table. The BasePersonalExtWorkTableControlRow implements the DataBind and SaveData methods. + ' The loading of data is actually performed by the LoadData method in the base class of PersonalExtWorkTableControl. + + ' This is the ideal place to add your code customizations. For example, you can override the DataBind, + ' SaveData, GetUIData, and Validate methods. + + +End Class + + + +Public Class PersonalExtWorkTableControl + Inherits BasePersonalExtWorkTableControl + Public Overrides Sub PersonalExtWorkPDFButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Dim ctl As PersonalIdRecordControl = CType(Me.Page.FindControlRecursively("PersonalIdRecordControl"), PersonalIdRecordControl) + Dim cr As New CrPdf + Dim param(0) As String + param(0) = "PID," & ctl.PersonalId.Text ' Utils.SecurityControls.GetCurrentUserID + cr.GetCr(Me, "../Reports/Person_Record.rpt", param) + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + Finally + + End Try + End Sub + + End Class + + +Public Class PersonalInsigniaTableControlRow + Inherits BasePersonalInsigniaTableControlRow + ' The BasePersonalInsigniaTableControlRow implements code for a ROW within the + ' the PersonalInsigniaTableControl table. The BasePersonalInsigniaTableControlRow implements the DataBind and SaveData methods. + ' The loading of data is actually performed by the LoadData method in the base class of PersonalInsigniaTableControl. + + ' This is the ideal place to add your code customizations. For example, you can override the DataBind, + ' SaveData, GetUIData, and Validate methods. + + +End Class + + + +Public Class PersonalInsigniaTableControl + Inherits BasePersonalInsigniaTableControl + + ' The BasePersonalInsigniaTableControl class implements the LoadData, DataBind, CreateWhereClause + ' and other methods to load and display the data in a table control. + + ' This is the ideal place to add your code customizations. You can override the LoadData and CreateWhereClause, + ' The PersonalInsigniaTableControlRow class offers another place where you can customize + ' the DataBind, GetUIData, SaveData and Validate methods specific to each row displayed on the table. + +End Class + + +Public Class PersonalLanguageSkillTableControlRow + Inherits BasePersonalLanguageSkillTableControlRow + ' The BasePersonalLanguageSkillTableControlRow implements code for a ROW within the + ' the PersonalLanguageSkillTableControl table. The BasePersonalLanguageSkillTableControlRow implements the DataBind and SaveData methods. + ' The loading of data is actually performed by the LoadData method in the base class of PersonalLanguageSkillTableControl. + + ' This is the ideal place to add your code customizations. For example, you can override the DataBind, + ' SaveData, GetUIData, and Validate methods. + + +End Class + + + +Public Class PersonalLanguageSkillTableControl + Inherits BasePersonalLanguageSkillTableControl + + ' The BasePersonalLanguageSkillTableControl class implements the LoadData, DataBind, CreateWhereClause + ' and other methods to load and display the data in a table control. + + ' This is the ideal place to add your code customizations. You can override the LoadData and CreateWhereClause, + ' The PersonalLanguageSkillTableControlRow class offers another place where you can customize + ' the DataBind, GetUIData, SaveData and Validate methods specific to each row displayed on the table. + +End Class + + +Public Class PersonalNameTableControlRow + Inherits BasePersonalNameTableControlRow + ' The BasePersonalNameTableControlRow implements code for a ROW within the + ' the PersonalNameTableControl table. The BasePersonalNameTableControlRow implements the DataBind and SaveData methods. + ' The loading of data is actually performed by the LoadData method in the base class of PersonalNameTableControl. + + ' This is the ideal place to add your code customizations. For example, you can override the DataBind, + ' SaveData, GetUIData, and Validate methods. + + +End Class + + + +Public Class PersonalNameTableControl + Inherits BasePersonalNameTableControl + + ' The BasePersonalNameTableControl class implements the LoadData, DataBind, CreateWhereClause + ' and other methods to load and display the data in a table control. + + ' This is the ideal place to add your code customizations. You can override the LoadData and CreateWhereClause, + ' The PersonalNameTableControlRow class offers another place where you can customize + ' the DataBind, GetUIData, SaveData and Validate methods specific to each row displayed on the table. + +End Class + + +Public Class PersonalRankTableControlRow + Inherits BasePersonalRankTableControlRow + ' The BasePersonalRankTableControlRow implements code for a ROW within the + ' the PersonalRankTableControl table. The BasePersonalRankTableControlRow implements the DataBind and SaveData methods. + ' The loading of data is actually performed by the LoadData method in the base class of PersonalRankTableControl. + + ' This is the ideal place to add your code customizations. For example, you can override the DataBind, + ' SaveData, GetUIData, and Validate methods. + + +End Class + + + +Public Class PersonalRankTableControl + Inherits BasePersonalRankTableControl + + Public Overrides Function CreateOrderBy() As OrderBy + ' The CurrentSortOrder is initialized to the sort order on the + ' Query Wizard. It may be modified by the Click handler for any of + ' the column heading to sort or reverse sort by that column. + ' You can add your own sort order, or modify it on the Query Wizard. + Dim orderby As OrderBy = New OrderBy(False, False) + orderby.Add(PersonalRankTable.RankId, OrderByItem.OrderDir.Desc) + orderby.Add(PersonalRankTable.PreRank, OrderByItem.OrderDir.Desc) + Return orderby + 'Return Me.CurrentSortOrder + End Function + +End Class + + +Public Class PersonalSalaryTableControlRow + Inherits BasePersonalSalaryTableControlRow + ' The BasePersonalSalaryTableControlRow implements code for a ROW within the + ' the PersonalSalaryTableControl table. The BasePersonalSalaryTableControlRow implements the DataBind and SaveData methods. + ' The loading of data is actually performed by the LoadData method in the base class of PersonalSalaryTableControl. + + ' This is the ideal place to add your code customizations. For example, you can override the DataBind, + ' SaveData, GetUIData, and Validate methods. + + +End Class + + + +Public Class PersonalSalaryTableControl + Inherits BasePersonalSalaryTableControl + + ' The BasePersonalSalaryTableControl class implements the LoadData, DataBind, CreateWhereClause + ' and other methods to load and display the data in a table control. + + ' This is the ideal place to add your code customizations. You can override the LoadData and CreateWhereClause, + ' The PersonalSalaryTableControlRow class offers another place where you can customize + ' the DataBind, GetUIData, SaveData and Validate methods specific to each row displayed on the table. + +End Class + + +Public Class PersonalSpecialSkillTableControlRow + Inherits BasePersonalSpecialSkillTableControlRow + ' The BasePersonalSpecialSkillTableControlRow implements code for a ROW within the + ' the PersonalSpecialSkillTableControl table. The BasePersonalSpecialSkillTableControlRow implements the DataBind and SaveData methods. + ' The loading of data is actually performed by the LoadData method in the base class of PersonalSpecialSkillTableControl. + + ' This is the ideal place to add your code customizations. For example, you can override the DataBind, + ' SaveData, GetUIData, and Validate methods. + + +End Class + + + +Public Class PersonalSpecialSkillTableControl + Inherits BasePersonalSpecialSkillTableControl + + ' The BasePersonalSpecialSkillTableControl class implements the LoadData, DataBind, CreateWhereClause + ' and other methods to load and display the data in a table control. + + ' This is the ideal place to add your code customizations. You can override the LoadData and CreateWhereClause, + ' The PersonalSpecialSkillTableControlRow class offers another place where you can customize + ' the DataBind, GetUIData, SaveData and Validate methods specific to each row displayed on the table. + +End Class + + +Public Class PersonalSportSkillTableControlRow + Inherits BasePersonalSportSkillTableControlRow + ' The BasePersonalSportSkillTableControlRow implements code for a ROW within the + ' the PersonalSportSkillTableControl table. The BasePersonalSportSkillTableControlRow implements the DataBind and SaveData methods. + ' The loading of data is actually performed by the LoadData method in the base class of PersonalSportSkillTableControl. + + ' This is the ideal place to add your code customizations. For example, you can override the DataBind, + ' SaveData, GetUIData, and Validate methods. + + +End Class + + + +Public Class PersonalSportSkillTableControl + Inherits BasePersonalSportSkillTableControl + + ' The BasePersonalSportSkillTableControl class implements the LoadData, DataBind, CreateWhereClause + ' and other methods to load and display the data in a table control. + + ' This is the ideal place to add your code customizations. You can override the LoadData and CreateWhereClause, + ' The PersonalSportSkillTableControlRow class offers another place where you can customize + ' the DataBind, GetUIData, SaveData and Validate methods specific to each row displayed on the table. + +End Class + + +Public Class PersonalTitleTableControlRow + Inherits BasePersonalTitleTableControlRow + ' The BasePersonalTitleTableControlRow implements code for a ROW within the + ' the PersonalTitleTableControl table. The BasePersonalTitleTableControlRow implements the DataBind and SaveData methods. + ' The loading of data is actually performed by the LoadData method in the base class of PersonalTitleTableControl. + + ' This is the ideal place to add your code customizations. For example, you can override the DataBind, + ' SaveData, GetUIData, and Validate methods. + + +End Class + + + +Public Class PersonalTitleTableControl + Inherits BasePersonalTitleTableControl + + ' The BasePersonalTitleTableControl class implements the LoadData, DataBind, CreateWhereClause + ' and other methods to load and display the data in a table control. + + ' This is the ideal place to add your code customizations. You can override the LoadData and CreateWhereClause, + ' The PersonalTitleTableControlRow class offers another place where you can customize + ' the DataBind, GetUIData, SaveData and Validate methods specific to each row displayed on the table. + +End Class + + +Public Class PersonRelativeTableControlRow + Inherits BasePersonRelativeTableControlRow + ' The BasePersonRelativeTableControlRow implements code for a ROW within the + ' the PersonRelativeTableControl table. The BasePersonRelativeTableControlRow implements the DataBind and SaveData methods. + ' The loading of data is actually performed by the LoadData method in the base class of PersonRelativeTableControl. + + ' This is the ideal place to add your code customizations. For example, you can override the DataBind, + ' SaveData, GetUIData, and Validate methods. + + +End Class + + + +Public Class PersonRelativeTableControl + Inherits BasePersonRelativeTableControl + + ' The BasePersonRelativeTableControl class implements the LoadData, DataBind, CreateWhereClause + ' and other methods to load and display the data in a table control. + + ' This is the ideal place to add your code customizations. You can override the LoadData and CreateWhereClause, + ' The PersonRelativeTableControlRow class offers another place where you can customize + ' the DataBind, GetUIData, SaveData and Validate methods specific to each row displayed on the table. + + + Public Overrides Function CreateOrderBy() As BaseClasses.Data.OrderBy + Dim orderby As OrderBy = New OrderBy(False, False) + orderby.Add(PersonRelativeTable.RelationId, OrderByItem.OrderDir.Asc) + orderby.Add(PersonRelativeTable.RBirthDate, OrderByItem.OrderDir.Asc) + Return orderby + 'Return MyBase.CreateOrderBy() + End Function + End Class + + +'Public Class ShowPersonalIdTableTableControlRow +' Inherits BaseShowPersonalIdTableTableControlRow +' ' The BaseShowPersonalIdTableTableControlRow implements code for a ROW within the +' ' the ShowPersonalIdTableTableControl table. The BaseShowPersonalIdTableTableControlRow implements the DataBind and SaveData methods. +' ' The loading of data is actually performed by the LoadData method in the base class of ShowPersonalIdTableTableControl. +' +' ' This is the ideal place to add your code customizations. For example, you can override the DataBind, +' ' SaveData, GetUIData, and Validate methods. +' +' +'End Class +' + + + +'Public Class ShowPersonalIdTableTableControl +' Inherits BaseShowPersonalIdTableTableControl +' +' ' The BaseShowPersonalIdTableTableControl class implements the LoadData, DataBind, CreateWhereClause +' ' and other methods to load and display the data in a table control. +' +' ' This is the ideal place to add your code customizations. You can override the LoadData and CreateWhereClause, +' ' The ShowPersonalIdTableTableControlRow class offers another place where you can customize +' ' the DataBind, GetUIData, SaveData and Validate methods specific to each row displayed on the table. +' +'End Class +' + + +Public Class PersonalIdRecordControl + Inherits BasePersonalIdRecordControl + +' Public Overrides Sub PDFButton_Click(ByVal sender As Object, ByVal args As EventArgs) +' Try +' +' Dim cr As New CrPdf +' Dim param(0) As String +' param(0) = "PID," & Me.PersonalId.Text ' Utils.SecurityControls.GetCurrentUserID +' cr.GetCr(Me, "../Reports/Person_Record.rpt", param) +' +' Catch ex As Exception +' Me.Page.ErrorOnPage = True +' +' ' Report the error message to the end user +' Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) +' Finally +' +' End Try +' +' End Sub + + + End Class + + + +Public Class ReportPropertiesTableControl + Inherits BaseReportPropertiesTableControl + + Public Overrides Sub ReportPropertiesPDFButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + Try + Dim PID As Literal = CType(Me.Page.FindControlRecursively("PersonalId"), Literal) + Dim cr As New CrPdf + Dim param(0) As String + param(0) = "PID," & PID.Text ' Utils.SecurityControls.GetCurrentUserID + cr.GetCr(Me, "../Reports/Person_Record.rpt", param) + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + Finally + + End Try + + End Sub + Public Overrides Sub ReportPropertiesWordButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + Try + Dim PID As Literal = CType(Me.Page.FindControlRecursively("PersonalId"), Literal) + Dim cr As New CrPdf + Dim param(0) As String + param(0) = "PID," & PID.Text ' Utils.SecurityControls.GetCurrentUserID + cr.GetCr(Me, "../Reports/Person_Record.rpt", param, 3) + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + Finally + + End Try + + End Sub + Public Overrides Sub ReportPropertiesExportExcelButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + Try + Dim PID As Literal = CType(Me.Page.FindControlRecursively("PersonalId"), Literal) + Dim cr As New CrPdf + Dim param(0) As String + param(0) = "PID," & PID.Text ' Utils.SecurityControls.GetCurrentUserID + cr.GetCr(Me, "../Reports/Person_Record.rpt", param, 2) + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + Finally + + End Try + End Sub + + + End Class + +Public Class ReportPropertiesTableControlRow + Inherits BaseReportPropertiesTableControlRow + ' The BaseReportPropertiesTableControlRow implements code for a ROW within the + ' the ReportPropertiesTableControl table. The BaseReportPropertiesTableControlRow implements the DataBind and SaveData methods. + ' The loading of data is actually performed by the LoadData method in the base class of ReportPropertiesTableControl. + + ' This is the ideal place to add your code customizations. For example, you can override the DataBind, + ' SaveData, GetUIData, and Validate methods. + + +End Class +#End Region + + + +#Region "Section 2: Do not modify this section." + + +' Base class for the PersonalDDTableControlRow control on the ShowPersonalId page. +' Do not modify this class. Instead override any method in PersonalDDTableControlRow. +Public Class BasePersonalDDTableControlRow + Inherits Persons.UI.BaseApplicationRecordControl + + ' To customize, override this method in PersonalDDTableControlRow. + Protected Overridable Sub Control_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Init + + Me.ClearControlsFromSession() + End Sub + + ' To customize, override this method in PersonalDDTableControlRow. + Protected Overridable Sub Control_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load + + 'Call LoadFocusScripts from repeater so that onfocus attribute could be added to elements + Me.Page.LoadFocusScripts(Me) + + + ' Register the event handlers. + + + End Sub + + + Public Overridable Sub LoadData() + + ' Load the data from the database into the DataSource PersonalDD 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 = PersonalDDTable.GetRecord(Me.RecordUniqueId, True) + + Return + End If + + ' Since this is a row in the table, the data for this row is loaded by the + ' LoadData method of the BasePersonalDDTableControl when the data for the entire + ' table is loaded. + + Me.DataSource = New PersonalDDRecord() + + + + End Sub + + ' Populate the UI controls using the DataSource. To customize, override this method in PersonalDDTableControlRow. + 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 + + SetEndDate() + SetMission() + SetRef1() + SetRefDate() + SetStartDate() + + + Me.IsNewRecord = True + + If Me.DataSource.IsCreated Then + Me.IsNewRecord = False + + Me.RecordUniqueId = Me.DataSource.GetID.ToXmlString() + End If + + ' Now load data for each record and table child UI controls. + ' Ordering is important because child controls get + ' their parent ids from their parent UI controls. + Dim shouldResetControl As Boolean = False + + End Sub + + + Public Overridable Sub SetEndDate() + + + ' Set the EndDate Literal on the webpage with value from the + ' PersonalDD database record. + + ' Me.DataSource is the PersonalDD record retrieved from the database. + ' Me.EndDate is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetEndDate() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.EndDateSpecified Then + + ' If the EndDate is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalDDTable.EndDate, "d MMM yy") + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.EndDate.Text = formattedValue + + Else + + ' EndDate is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.EndDate.Text = PersonalDDTable.EndDate.Format(PersonalDDTable.EndDate.DefaultValue, "d MMM yy") + + End If + + ' If the EndDate is NULL or blank, then use the value specified + ' on Properties. + If Me.EndDate.Text Is Nothing _ + OrElse Me.EndDate.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.EndDate.Text = " " + End If + + End Sub + + Public Overridable Sub SetMission() + + + ' Set the Mission Literal on the webpage with value from the + ' PersonalDD database record. + + ' Me.DataSource is the PersonalDD record retrieved from the database. + ' Me.Mission is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetMission() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.MissionSpecified Then + + ' If the Mission is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalDDTable.Mission) + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + If Not formattedValue is Nothing Then + Dim popupThreshold as Integer = CType(100, Integer) + + Dim maxLength as Integer = Len(formattedValue) + If (maxLength > CType(100, Integer)) Then + ' Truncate based on FieldMaxLength on Properties. + maxLength = CType(100, Integer) + + End If + + ' For fields values larger than the PopupTheshold on Properties, display a popup. + If Len(formattedValue) >= popupThreshold Then + + Dim name As String = HttpUtility.HtmlEncode(PersonalDDTable.Mission.Name) + + If Not HttpUtility.HtmlEncode("%ISD_DEFAULT%").Equals("%ISD_DEFAULT%") Then + name = HttpUtility.HtmlEncode(Me.Page.GetResourceValue("%ISD_DEFAULT%")) + End If + + + + formattedValue= "" & NetUtils.EncodeStringForHtmlDisplay(formattedValue.Substring(0, maxLength)) + + If (maxLength = CType(100, Integer)) Then + formattedValue = formattedValue & "..." & "" + Else + formattedValue = formattedValue & "" + + End If + Else + If maxLength = CType(100, Integer) Then + formattedValue= NetUtils.EncodeStringForHtmlDisplay(formattedValue.SubString(0,MaxLength)) + formattedValue = formattedValue & "..." + + End If + End If + End If + + Me.Mission.Text = formattedValue + + Else + + ' Mission is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.Mission.Text = PersonalDDTable.Mission.Format(PersonalDDTable.Mission.DefaultValue) + + End If + + ' If the Mission is NULL or blank, then use the value specified + ' on Properties. + If Me.Mission.Text Is Nothing _ + OrElse Me.Mission.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.Mission.Text = " " + End If + + End Sub + + Public Overridable Sub SetRef1() + + + ' Set the Ref Literal on the webpage with value from the + ' PersonalDD database record. + + ' Me.DataSource is the PersonalDD record retrieved from the database. + ' Me.Ref1 is the ASP:Literal 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(PersonalDDTable.Ref0) + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + If Not formattedValue is Nothing Then + Dim popupThreshold as Integer = CType(100, Integer) + + Dim maxLength as Integer = Len(formattedValue) + If (maxLength > CType(100, Integer)) Then + ' Truncate based on FieldMaxLength on Properties. + maxLength = CType(100, Integer) + + End If + + ' For fields values larger than the PopupTheshold on Properties, display a popup. + If Len(formattedValue) >= popupThreshold Then + + Dim name As String = HttpUtility.HtmlEncode(PersonalDDTable.Ref0.Name) + + If Not HttpUtility.HtmlEncode("%ISD_DEFAULT%").Equals("%ISD_DEFAULT%") Then + name = HttpUtility.HtmlEncode(Me.Page.GetResourceValue("%ISD_DEFAULT%")) + End If + + + + formattedValue= "" & NetUtils.EncodeStringForHtmlDisplay(formattedValue.Substring(0, maxLength)) + + If (maxLength = CType(100, Integer)) Then + formattedValue = formattedValue & "..." & "" + Else + formattedValue = formattedValue & "" + + End If + Else + If maxLength = CType(100, Integer) Then + formattedValue= NetUtils.EncodeStringForHtmlDisplay(formattedValue.SubString(0,MaxLength)) + formattedValue = formattedValue & "..." + + End If + End If + End If + + 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 = PersonalDDTable.Ref0.Format(PersonalDDTable.Ref0.DefaultValue) + + End If + + ' If the Ref is NULL or blank, then use the value specified + ' on Properties. + If Me.Ref1.Text Is Nothing _ + OrElse Me.Ref1.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.Ref1.Text = " " + End If + + End Sub + + Public Overridable Sub SetRefDate() + + + ' Set the RefDate Literal on the webpage with value from the + ' PersonalDD database record. + + ' Me.DataSource is the PersonalDD record retrieved from the database. + ' Me.RefDate is the ASP:Literal 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(PersonalDDTable.RefDate, "d MMM yy") + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + 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 = PersonalDDTable.RefDate.Format(PersonalDDTable.RefDate.DefaultValue, "d MMM yy") + + End If + + ' If the RefDate is NULL or blank, then use the value specified + ' on Properties. + If Me.RefDate.Text Is Nothing _ + OrElse Me.RefDate.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.RefDate.Text = " " + End If + + End Sub + + Public Overridable Sub SetStartDate() + + + ' Set the StartDate Literal on the webpage with value from the + ' PersonalDD database record. + + ' Me.DataSource is the PersonalDD record retrieved from the database. + ' Me.StartDate is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetStartDate() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.StartDateSpecified Then + + ' If the StartDate is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalDDTable.StartDate, "d MMM yy") + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.StartDate.Text = formattedValue + + Else + + ' StartDate is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.StartDate.Text = PersonalDDTable.StartDate.Format(PersonalDDTable.StartDate.DefaultValue, "d MMM yy") + + End If + + ' If the StartDate is NULL or blank, then use the value specified + ' on Properties. + If Me.StartDate.Text Is Nothing _ + OrElse Me.StartDate.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.StartDate.Text = " " + End If + + End Sub + + + Public EvaluateFormulaDelegate As BaseClasses.Data.DataSource.EvaluateFormulaDelegate = New BaseClasses.Data.DataSource.EvaluateFormulaDelegate(AddressOf Me.EvaluateFormula) + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean, ByVal e As FormulaEvaluator) As String + If e Is Nothing Then + e = New FormulaEvaluator() + End If + + e.Variables.Clear() + + + ' add variables for formula evaluation + If variables IsNot Nothing Then + Dim enumerator As System.Collections.Generic.IEnumerator(Of System.Collections.Generic.KeyValuePair(Of String, Object)) = variables.GetEnumerator() + While enumerator.MoveNext() + e.Variables.Add(enumerator.Current.Key, enumerator.Current.Value) + End While + End If + + If includeDS + + End IF + + + ' Other variables referred to in the formula are expected to be + ' properties of the DataSource. For example, referring to + ' UnitPrice as a variable will refer to DataSource.UnitPrice + If dataSourceForEvaluate Is Nothing Then + + e.DataSource = Me.DataSource + + Else + e.DataSource = dataSourceForEvaluate + End If + + ' Define the calling control. This is used to add other + ' related table and record controls as variables. + e.CallingControl = Me + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + + If Not String.IsNullOrEmpty(format) AndAlso (String.IsNullOrEmpty(formula) OrElse formula.IndexOf("Format(") < 0) Then + Return FormulaUtils.Format(resultObj, format) + Else + Return resultObj.ToString() + End If + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format,variables ,includeDS, Nothing) + End Function + + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object)) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format, variables ,True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, format, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal e as FormulaEvaluator) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, variables, True, e) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal includeDS as Boolean) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, includeDS, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, True, Nothing) + End Function + + + Public Overridable Sub RegisterPostback() + + + End Sub + + + + ' To customize, override this method in PersonalDDTableControlRow. + 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 parentCtrl As PersonalIdRecordControl + + + parentCtrl = DirectCast(Me.Page.FindControlRecursively("PersonalIdRecordControl"), PersonalIdRecordControl) + + If (Not IsNothing(parentCtrl) AndAlso IsNothing(parentCtrl.DataSource)) + ' Load the record if it is not loaded yet. + parentCtrl.LoadData() + End If + If (IsNothing(parentCtrl) OrElse IsNothing(parentCtrl.DataSource)) + ' Get the error message from the application resource file. + Throw New Exception(Page.GetResourceValue("Err:NoParentRecId", "Persons")) + End If + + Me.DataSource.PersonalId = parentCtrl.DataSource.PersonalId + + ' 2. Perform any custom validation. + Me.Validate() + + + ' 3. Set the values in the record with data from UI controls. + ' This calls the Get() method for each of the user interface controls. + Me.GetUIData() + + ' 4. Save in the database. + ' We should not save the record if the data did not change. This + ' will save a database hit and avoid triggering any database triggers. + + If Me.DataSource.IsAnyValueChanged Then + ' Save record to database but do not commit yet. + ' Auto generated ids are available after saving for use by child (dependent) records. + Me.DataSource.Save() + + DirectCast(GetParentControlObject(Me, "PersonalDDTableControl"), PersonalDDTableControl).DataChanged = True + DirectCast(GetParentControlObject(Me, "PersonalDDTableControl"), PersonalDDTableControl).ResetData = True + End If + + + ' update session or cookie by formula + + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + ' For Master-Detail relationships, save data on the Detail table(s) + + End Sub + + ' To customize, override this method in PersonalDDTableControlRow. + 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. + + GetEndDate() + GetMission() + GetRef1() + GetRefDate() + GetStartDate() + End Sub + + + Public Overridable Sub GetEndDate() + + End Sub + + Public Overridable Sub GetMission() + + End Sub + + Public Overridable Sub GetRef1() + + End Sub + + Public Overridable Sub GetRefDate() + + End Sub + + Public Overridable Sub GetStartDate() + + End Sub + + + ' To customize, override this method in PersonalDDTableControlRow. + + Public Overridable Function CreateWhereClause() As WhereClause + + Return Nothing + + End Function + + + + ' To customize, override this method in PersonalDDTableControlRow. + 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) + PersonalDDTable.DeleteRecord(pkValue) + + DirectCast(GetParentControlObject(Me, "PersonalDDTableControl"), PersonalDDTableControl).DataChanged = True + DirectCast(GetParentControlObject(Me, "PersonalDDTableControl"), PersonalDDTableControl).ResetData = True + End Sub + + Protected Overridable Sub Control_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.PreRender + ' PreRender event is raised just before page is being displayed. + Try + DbUtils.StartTransaction() + Me.RegisterPostback() + + If Not Me.Page.ErrorOnPage AndAlso (Me.Page.IsPageRefresh OrElse Me.DataChanged OrElse Me.ResetData) Then + + + ' Re-load the data and update the web page if necessary. + ' This is typically done during a postback (filter, search button, sort, pagination button). + ' In each of the other click handlers, simply set DataChanged to True to reload the data. + Me.LoadData() + Me.DataBind() + End If + + + Catch ex As Exception + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + Finally + DbUtils.EndTransaction() + End Try + End Sub + + + Protected Overrides Sub SaveControlsToSession() + MyBase.SaveControlsToSession() + + + 'Save pagination state to session. + + End Sub + + + + Protected Overrides Sub ClearControlsFromSession() + MyBase.ClearControlsFromSession() + + + + ' Clear pagination state from session. + + End Sub + + Protected Overrides Sub LoadViewState(ByVal savedState As Object) + MyBase.LoadViewState(savedState) + Dim isNewRecord As String = CType(ViewState("IsNewRecord"), String) + If Not isNewRecord Is Nothing AndAlso isNewRecord.Trim <> "" Then + Me.IsNewRecord = Boolean.Parse(isNewRecord) + End If + + Dim myCheckSum As String = CType(ViewState("CheckSum"), String) + If Not myCheckSum Is Nothing AndAlso myCheckSum.Trim <> "" Then + Me.CheckSum = myCheckSum + End If + + + ' Load view state for pagination control. + + End Sub + + Protected Overrides Function SaveViewState() As Object + ViewState("IsNewRecord") = Me.IsNewRecord.ToString() + ViewState("CheckSum") = Me.CheckSum + + + ' Load view state for pagination control. + + Return MyBase.SaveViewState() + End Function + + + + 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("BasePersonalDDTableControlRow_Rec"), String) + End Get + Set(ByVal value As String) + Me.ViewState("BasePersonalDDTableControlRow_Rec") = value + End Set + End Property + + Private _DataSource As PersonalDDRecord + Public Property DataSource() As PersonalDDRecord + Get + Return Me._DataSource + End Get + + Set(ByVal value As PersonalDDRecord) + + Me._DataSource = value + End Set + End Property + + + + Private _checkSum As String + Public Overridable Property CheckSum() As String + Get + Return Me._checkSum + End Get + Set(ByVal value As String) + Me._checkSum = value + End Set + End Property + + Private _TotalPages As Integer + Public Property TotalPages() As Integer + Get + Return Me._TotalPages + End Get + Set(ByVal value As Integer) + Me._TotalPages = value + End Set + End Property + + Private _PageIndex As Integer + Public Property PageIndex() As Integer + Get + ' Return the PageIndex + Return Me._PageIndex + End Get + Set(ByVal value As Integer) + Me._PageIndex = value + End Set + End Property + + Private _DisplayLastPage As Boolean + Public Property DisplayLastPage() As Boolean + Get + Return Me._DisplayLastPage + End Get + Set(ByVal value As Boolean) + Me._DisplayLastPage = value + End Set + End Property + + + +#Region "Helper Properties" + + Public ReadOnly Property EndDate() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "EndDate"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property Mission() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Mission"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property Ref1() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Ref1"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property RefDate() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RefDate"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property StartDate() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "StartDate"), System.Web.UI.WebControls.Literal) + End Get + End Property + +#End Region + +#Region "Helper Functions" + + Public Overrides Overloads Function ModifyRedirectUrl(ByVal url As String, ByVal arg As String, ByVal bEncrypt As Boolean) As String + Return Me.Page.EvaluateExpressions(url, arg, bEncrypt, Me) + End Function + + Public Overrides Overloads Function EvaluateExpressions(ByVal url As String, ByVal arg As String, ByVal bEncrypt As Boolean) As String + + Dim rec As PersonalDDRecord = 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 PersonalDDRecord + If Not Me.DataSource Is Nothing Then + Return Me.DataSource + End If + + If Not Me.RecordUniqueId Is Nothing Then + + Return PersonalDDTable.GetRecord(Me.RecordUniqueId, True) + + End If + + ' Localization. + + Return Nothing + + End Function + + Public Shadows ReadOnly Property Page() As BaseApplicationPage + Get + Return DirectCast(MyBase.Page, BaseApplicationPage) + End Get + End Property + +#End Region + +End Class + + + +' Base class for the PersonalDDTableControl control on the ShowPersonalId page. +' Do not modify this class. Instead override any method in PersonalDDTableControl. +Public Class BasePersonalDDTableControl + Inherits Persons.UI.BaseApplicationTableControl + + + + Protected Overridable Sub Control_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Init + + + + ' Setup the filter and search events. + + + + ' Control Initializations. + ' Initialize the table's current sort order. + + If Me.InSession(Me, "Order_By") Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + Me.CurrentSortOrder.Add(PersonalDDTable.StartDate, OrderByItem.OrderDir.Asc) + + End If + + + + ' Setup default pagination settings. + + Me.PageSize = CInt(Me.GetFromSession(Me, "Page_Size", "10")) + Me.PageIndex = CInt(Me.GetFromSession(Me, "Page_Index", "0")) + + + + Me.ClearControlsFromSession() + End Sub + + Protected Overridable Sub Control_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load + + SaveControlsToSession_Ajax() + + ' Setup the pagination events. + + AddHandler Me.PersonalDDPagination.FirstPage.Click, AddressOf PersonalDDPagination_FirstPage_Click + + AddHandler Me.PersonalDDPagination.LastPage.Click, AddressOf PersonalDDPagination_LastPage_Click + + AddHandler Me.PersonalDDPagination.NextPage.Click, AddressOf PersonalDDPagination_NextPage_Click + + AddHandler Me.PersonalDDPagination.PageSizeButton.Click, AddressOf PersonalDDPagination_PageSizeButton_Click + + AddHandler Me.PersonalDDPagination.PreviousPage.Click, AddressOf PersonalDDPagination_PreviousPage_Click + + + ' Setup the sorting events. + + AddHandler Me.EndDateLabel1.Click, AddressOf EndDateLabel1_Click + + AddHandler Me.MissionLabel.Click, AddressOf MissionLabel_Click + + AddHandler Me.RefDateLabel.Click, AddressOf RefDateLabel_Click + + AddHandler Me.RefLabel.Click, AddressOf RefLabel_Click + + AddHandler Me.StartDateLabel1.Click, AddressOf StartDateLabel1_Click + + ' Setup the button events. + + AddHandler Me.PersonalDDExportCSVButton.Click, AddressOf PersonalDDExportCSVButton_Click + + AddHandler Me.PersonalDDExportExcelButton.Click, AddressOf PersonalDDExportExcelButton_Click + + Me.PersonalDDImportButton.PostBackUrl = "../Shared/SelectFileToImport.aspx?TableName=PersonalDD" + Me.PersonalDDImportButton.Attributes.Item("onClick") = "window.open('" & Me.Page.EncryptUrlParameter(Me.PersonalDDImportButton.PostBackUrl) & "','importWindow', 'width=700, height=500,top=' +(screen.availHeight-500)/2 + ',left=' + (screen.availWidth-700)/2+ ', resizable=yes, scrollbars=yes,modal=yes'); return false;" + + AddHandler Me.PersonalDDImportButton.Click, AddressOf PersonalDDImportButton_Click + + AddHandler Me.PersonalDDPDFButton.Click, AddressOf PersonalDDPDFButton_Click + + AddHandler Me.PersonalDDRefreshButton.Click, AddressOf PersonalDDRefreshButton_Click + + AddHandler Me.PersonalDDResetButton.Click, AddressOf PersonalDDResetButton_Click + + AddHandler Me.PersonalDDWordButton.Click, AddressOf PersonalDDWordButton_Click + + + ' Setup events for others + + End Sub + + + Public Overridable Sub LoadData() + + ' Read data from database. Returns an array of records that can be assigned + ' to the DataSource table control property. + Try + Dim joinFilter As CompoundFilter = CreateCompoundJoinFilter() + + ' The WHERE clause will be empty when displaying all records in table. + Dim wc As WhereClause = CreateWhereClause() + If wc IsNot Nothing AndAlso Not wc.RunQuery Then + ' Initialize an empty array of records + Dim alist As New ArrayList(0) + Me.DataSource = DirectCast(alist.ToArray(GetType(PersonalDDRecord)), PersonalDDRecord()) + ' Add records to the list if needed. + Me.AddNewRecords() + Me._TotalRecords = 0 + Me._TotalPages = 0 + Return + End If + + ' Call OrderBy to determine the order - either use the order defined + ' on the Query Wizard, or specified by user (by clicking on column heading) + Dim orderBy As OrderBy = CreateOrderBy() + + ' Get the pagesize from the pagesize control. + Me.GetPageSize() + + If Me.DisplayLastPage Then + Dim totalRecords As Integer = If(Me._TotalRecords < 0, PersonalDDTable.GetRecordCount(CreateCompoundJoinFilter(), CreateWhereClause()), Me._TotalRecords) + + Dim totalPages As Integer = CInt(Math.Ceiling(totalRecords / Me.PageSize)) + + Me.PageIndex = totalPages - 1 + End If + + ' Make sure PageIndex (current page) and PageSize are within bounds. + If Me.PageIndex < 0 Then + Me.PageIndex = 0 + End If + If Me.PageSize < 1 Then + Me.PageSize = 1 + End If + + ' Retrieve the records and set the table DataSource. + ' Only PageSize records are fetched starting at PageIndex (zero based). + If Me.AddNewRecord > 0 Then + ' Make sure to preserve the previously entered data on new rows. + Dim postdata As New ArrayList + For Each rc As PersonalDDTableControlRow In Me.GetRecordControls() + If Not rc.IsNewRecord Then + rc.DataSource = rc.GetRecord() + rc.GetUIData() + postdata.Add(rc.DataSource) + UIData.Add(rc.PreservedUIData()) + End If + Next + Me.DataSource = DirectCast(postdata.ToArray(GetType(PersonalDDRecord)), PersonalDDRecord()) + Else ' Get the records from the database + Me.DataSource = PersonalDDTable.GetRecords(joinFilter, wc, orderBy, Me.PageIndex, Me.PageSize) + + End If + + ' if the datasource contains no records contained in database, then load the last page. + If (DbUtils.GetCreatedRecords(Me.DataSource).Length = 0 AndAlso Not Me.DisplayLastPage) Then + Me.DisplayLastPage = True + LoadData() + Else + + ' Add any new rows desired by the user. + Me.AddNewRecords() + + + ' Initialize the page and grand totals. now + + End If + + Catch ex As Exception + ' Report the error message to the end user + Dim msg As String = ex.Message + If ex.InnerException IsNot Nothing Then + msg = msg & " InnerException: " & ex.InnerException.Message + End If + Throw New Exception(msg, ex.InnerException) + End Try + End Sub + + + + + Public Overrides Sub DataBind() + ' The DataBind method binds the user interface controls to the values + ' from the database record for each row in the table. To do this, it calls the + ' DataBind for each of the rows. + ' DataBind also populates any filters above the table, and sets the pagination + ' control to the correct number of records and the current page number. + + MyBase.DataBind() + + ' Make sure that the DataSource is initialized. + If Me.DataSource Is Nothing Then + Return + End If + + 'LoadData for DataSource for chart and report if they exist + + ' Setup the pagination controls. + BindPaginationControls() + + + + ' Bind the repeater with the list of records to expand the UI. + Dim rep As System.Web.UI.WebControls.Repeater = CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalDDTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return + rep.DataSource = DataSource() + rep.DataBind() + + Dim index As Integer = 0 + For Each repItem As System.Web.UI.WebControls.RepeaterItem In rep.Items + ' Loop through all rows in the table, set its DataSource and call DataBind(). + Dim recControl As PersonalDDTableControlRow = DirectCast(repItem.FindControl("PersonalDDTableControlRow"), PersonalDDTableControlRow) + recControl.DataSource = Me.DataSource(index) + If Me.UIData.Count > index Then + recControl.PreviousUIData = Me.UIData(index) + End If + recControl.DataBind() + recControl.Visible = Not Me.InDeletedRecordIds(recControl) + + index += 1 + Next + + + + + ' Call the Set methods for each controls on the panel + + SetEndDateLabel1() + SetMissionLabel() + + + + + + + + SetPersonalDDTableControlCollapsibleRegion() + + SetRefDateLabel() + SetRefLabel() + SetStartDateLabel1() + ' setting the state of expand or collapse alternative rows + + + ' Load data for each record and table UI control. + ' Ordering is important because child controls get + ' their parent ids from their parent UI controls. + + + ' this method calls the set method for controls with special formula like running total, sum, rank, etc + SetFormulaControls() + End Sub + + Public Overridable Sub SetFormulaControls() + ' this method calls Set methods for the control that has special formula + + + + End Sub + + + + Public Overridable Sub RegisterPostback() + + Me.Page.RegisterPostBackTrigger(MiscUtils.FindControlRecursively(Me,"PersonalDDExportCSVButton")) + + Me.Page.RegisterPostBackTrigger(MiscUtils.FindControlRecursively(Me,"PersonalDDExportExcelButton")) + + Me.Page.RegisterPostBackTrigger(MiscUtils.FindControlRecursively(Me,"PersonalDDPDFButton")) + + Me.Page.RegisterPostBackTrigger(MiscUtils.FindControlRecursively(Me,"PersonalDDWordButton")) + + + End Sub + + Public EvaluateFormulaDelegate As BaseClasses.Data.DataSource.EvaluateFormulaDelegate = New BaseClasses.Data.DataSource.EvaluateFormulaDelegate(AddressOf Me.EvaluateFormula) + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean, ByVal e as FormulaEvaluator) As String + If e Is Nothing + e = New FormulaEvaluator() + End If + + e.Variables.Clear() + + + ' add variables for formula evaluation + If variables IsNot Nothing Then + Dim enumerator As System.Collections.Generic.IEnumerator(Of System.Collections.Generic.KeyValuePair(Of String, Object)) = variables.GetEnumerator() + While enumerator.MoveNext() + e.Variables.Add(enumerator.Current.Key, enumerator.Current.Value) + End While + End If + + If includeDS + + End If + + ' All variables referred to in the formula are expected to be + ' properties of the DataSource. For example, referring to + ' UnitPrice as a variable will refer to DataSource.UnitPrice + e.DataSource = dataSourceForEvaluate + + ' Define the calling control. This is used to add other + ' related table and record controls as variables. + e.CallingControl = Me + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + + If Not String.IsNullOrEmpty(format) AndAlso (String.IsNullOrEmpty(formula) OrElse formula.IndexOf("Format(") < 0) Then + Return FormulaUtils.Format(resultObj, format) + Else + Return resultObj.ToString() + End If + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format,variables ,includeDS, Nothing) + End Function + + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object)) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format, variables ,True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, format, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal e as FormulaEvaluator) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, variables, True, e) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal includeDS as Boolean) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, includeDS, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, True, Nothing) + End Function + + + + + Public Overridable Sub ResetControl() + + Me.CurrentSortOrder.Reset() + If (Me.InSession(Me, "Order_By")) Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + Me.CurrentSortOrder.Add(PersonalDDTable.StartDate, OrderByItem.OrderDir.Asc) + + End If + + Me.PageIndex = 0 + End Sub + + Protected Overridable Sub BindPaginationControls() + ' Setup the pagination controls. + + ' Bind the pagination labels. + + If DbUtils.GetCreatedRecords(Me.DataSource).Length > 0 Then + + Me.PersonalDDPagination.CurrentPage.Text = (Me.PageIndex + 1).ToString() + Else + Me.PersonalDDPagination.CurrentPage.Text = "0" + End If + Me.PersonalDDPagination.PageSize.Text = Me.PageSize.ToString() + Me.PersonalDDPagination.TotalItems.Text = Me.TotalRecords.ToString() + Me.PersonalDDPagination.TotalPages.Text = Me.TotalPages.ToString() + + ' Bind the buttons for PersonalDDTableControl pagination. + + Me.PersonalDDPagination.FirstPage.Enabled = Not (Me.PageIndex = 0) + If Me._TotalPages < 0 Then ' if the total pages is not determined yet, enable last and next buttons + Me.PersonalDDPagination.LastPage.Enabled = True + ElseIf Me._TotalPages = 0 ' if the total pages is determined and it is 0, enable last and next buttons + Me.PersonalDDPagination.LastPage.Enabled = False + Else ' if the total pages is the last page, disable last and next buttons + Me.PersonalDDPagination.LastPage.Enabled = Not (Me.PageIndex = Me.TotalPages - 1) + End If + + If Me._TotalPages < 0 Then ' if the total pages is not determined yet, enable last and next buttons + Me.PersonalDDPagination.NextPage.Enabled = True + ElseIf Me._TotalPages = 0 ' if the total pages is determined and it is 0, enable last and next buttons + Me.PersonalDDPagination.NextPage.Enabled = False + Else ' if the total pages is the last page, disable last and next buttons + Me.PersonalDDPagination.NextPage.Enabled = Not (Me.PageIndex = Me.TotalPages - 1) + End If + + Me.PersonalDDPagination.PreviousPage.Enabled = Not (Me.PageIndex = 0) + + + End Sub + + Public Overridable Sub SaveData() + ' Save the data from the entire table. Calls each row's Save Data + ' to save their data. This function is called by the Click handler of the + ' Save button. The button handler should Start/Commit/End a transaction. + + Dim recCtl As PersonalDDTableControlRow + For Each recCtl In Me.GetRecordControls() + + If Me.InDeletedRecordIds(recCtl) Then + ' Delete any pending deletes. + recCtl.Delete() + Else + If recCtl.Visible Then + recCtl.SaveData() + End If + End If + + Next + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + ' Set IsNewRecord to False for all records - since everything has been saved and is no longer "new" + For Each recCtl In Me.GetRecordControls() + recCtl.IsNewRecord = False + Next + + + ' Set DeletedRecordsIds to Nothing since we have deleted all pending deletes. + Me.DeletedRecordIds = Nothing + + End Sub + + Public Overridable Function CreateCompoundJoinFilter() As CompoundFilter + Dim jFilter As CompoundFilter = New CompoundFilter() + + Return jFilter + + End Function + + + Public Overridable Function CreateOrderBy() As OrderBy + ' The CurrentSortOrder is initialized to the sort order on the + ' Query Wizard. It may be modified by the Click handler for any of + ' the column heading to sort or reverse sort by that column. + ' You can add your own sort order, or modify it on the Query Wizard. + Return Me.CurrentSortOrder + End Function + + Public Overridable Function CreateWhereClause() As WhereClause + 'This CreateWhereClause is used for loading the data. + PersonalDDTable.Instance.InnerFilter = Nothing + Dim wc As WhereClause = New WhereClause() + + ' Compose the WHERE clause consiting of: + ' 1. Static clause defined at design time. + ' 2. User selected search criteria. + ' 3. User selected filter criteria. + + + Dim selectedRecordKeyValue as KeyValue = New KeyValue() + + Dim personalIdRecordControlObj As Persons.UI.Controls.ShowPersonalId.PersonalIdRecordControl = DirectCast(MiscUtils.FindControlRecursively(Me.Page, "PersonalIdRecordControl"), Persons.UI.Controls.ShowPersonalId.PersonalIdRecordControl) + + If (Not IsNothing(personalIdRecordControlObj) AndAlso Not IsNothing(personalIdRecordControlObj.GetRecord()) AndAlso personalIdRecordControlObj.GetRecord().IsCreated AndAlso Not IsNothing(personalIdRecordControlObj.GetRecord().PersonalId)) + wc.iAND(PersonalDDTable.PersonalId, BaseFilter.ComparisonOperator.EqualsTo, personalIdRecordControlObj.GetRecord().PersonalId.ToString()) + selectedRecordKeyValue.AddElement(PersonalDDTable.PersonalId.InternalName, personalIdRecordControlObj.GetRecord().PersonalId.ToString()) + Else + wc.RunQuery = False + Return wc + End If + + HttpContext.Current.Session("PersonalDDTableControlWhereClause") = selectedRecordKeyValue.ToXmlString() + + Return wc + End Function + + + Public Overridable Function CreateWhereClause(ByVal searchText as String, ByVal fromSearchControl as String, ByVal AutoTypeAheadSearch as String, ByVal AutoTypeAheadWordSeparators as String) As WhereClause + ' This CreateWhereClause is used for loading list of suggestions for Auto Type-Ahead feature. + PersonalDDTable.Instance.InnerFilter = Nothing + Dim wc As WhereClause = New WhereClause() + + ' Compose the WHERE clause consiting of: + ' 1. Static clause defined at design time. + ' 2. User selected search criteria. + ' 3. User selected filter criteria. + + Dim appRelativeVirtualPath As String = CType(HttpContext.Current.Session("AppRelativeVirtualPath"), String) + + Dim selectedRecordInPersonalIdRecordControl as String = DirectCast(HttpContext.Current.Session("PersonalDDTableControlWhereClause"), String) + + If Not selectedRecordInPersonalIdRecordControl Is Nothing AndAlso KeyValue.IsXmlKey(selectedRecordInPersonalIdRecordControl) Then + Dim selectedRecordKeyValue as KeyValue = KeyValue.XmlToKey(selectedRecordInPersonalIdRecordControl) + + If Not IsNothing(selectedRecordKeyValue) AndAlso selectedRecordKeyValue.ContainsColumn(PersonalDDTable.PersonalId) Then + wc.iAND(PersonalDDTable.PersonalId, BaseFilter.ComparisonOperator.EqualsTo, selectedRecordKeyValue.GetColumnValue(PersonalDDTable.PersonalId).ToString()) + End If + + End If + + ' Adds clauses if values are selected in Filter controls which are configured in the page. + + + Return wc + End Function + + + Public Overridable Function FormatSuggestions(ByVal prefixText As String, ByVal resultItem As String, _ + ByVal columnLength As Integer, ByVal AutoTypeAheadDisplayFoundText As String, _ + ByVal autoTypeAheadSearch As String, ByVal AutoTypeAheadWordSeparators As String, _ + ByVal resultList As ArrayList) As Boolean + + 'Formats the resultItem and adds it to the list of suggestions. + Dim index As Integer = resultItem.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture).IndexOf(prefixText.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture)) + Dim itemToAdd As String = "" + Dim isFound As Boolean = False + Dim isAdded As Boolean = False + ' Get the index where prfixt is at the beginning of resultItem. If not found then, index of word which begins with prefixText. + If InvariantLCase(autoTypeAheadSearch).equals("wordsstartingwithsearchstring") And Not index = 0 Then + ' Expression to find word which contains AutoTypeAheadWordSeparators followed by prefixText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex( AutoTypeAheadWordSeparators + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + If regex1.IsMatch(resultItem) Then + index = regex1.Match(resultItem).Index + isFound = True + End If + ' If the prefixText is found immediatly after white space then starting of the word is found so don not search any further + If not resultItem(index).ToString() = " " Then + ' Expression to find beginning of the word which contains AutoTypeAheadWordSeparators followed by prefixText + Dim regex As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\\S*" + AutoTypeAheadWordSeparators + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + If regex.IsMatch(resultItem) Then + index = regex.Match(resultItem).Index + isFound = True + End If + End If + End If + + ' If autoTypeAheadSearch value is wordsstartingwithsearchstring then, extract the substring only if the prefixText is found at the + ' beginning of the resultItem (index = 0) or a word in resultItem is found starts with prefixText. + If index = 0 Or isFound Or InvariantLCase(autoTypeAheadSearch).Equals("anywhereinstring") then + If InvariantLCase(AutoTypeAheadDisplayFoundText).equals("atbeginningofmatchedstring") Then + ' Expression to find beginning of the word which contains prefixText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\\S*" + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + ' Find the beginning of the word which contains prefexText + If (StringUtils.InvariantLCase(autoTypeAheadSearch).Equals("anywhereinstring") AndAlso regex1.IsMatch(resultItem)) Then + index = regex1.Match(resultItem).Index + isFound = True + End If + ' Display string from the index till end of the string if sub string from index till end is less than columnLength value. + If Len(resultItem) - index <= columnLength Then + If index = 0 Then + itemToAdd = resultItem + Else + itemToAdd = "..." & resultItem.Substring(index, Len(resultItem) - index) + End If + Else + If index = 0 Then + itemToAdd = resultItem.Substring(index, (columnLength - 3)) & "..." + Else + 'Truncate the string to show only columnLength - 6 characters as begining and trailing "..." has to be appended. + itemToAdd = "..." & resultItem.Substring(index , columnLength - 6) & "..." + End If + End If + ElseIf InvariantLCase(AutoTypeAheadDisplayFoundText).equals("inmiddleofmatchedstring") Then + Dim subStringBeginIndex As Integer = CType(columnLength/2, Integer) + If Len(resultItem) <= columnLength Then + itemToAdd = resultItem + Else + ' Sanity check at end of the string + If index + Len(prefixText) = columnLength Then + itemToAdd = "..." & resultItem.Substring(index-columnLength,index) + ElseIf Len(resultItem) - index < subStringBeginIndex Then + ' Display string from the end till columnLength value if, index is closer to the end of the string. + itemToAdd = "..." & resultItem.Substring(Len(resultItem)-columnLength,Len(resultItem)) + ElseIf index <= subStringBeginIndex Then + ' Sanity chet at beginning of the string + itemToAdd = resultItem.Substring(0, columnLength) & "..." + Else + ' Display string containing text before the prefixText occures and text after the prefixText + itemToAdd = "..." & resultItem.Substring(index - subStringBeginIndex, columnLength) & "..." + End If + End If + ElseIf InvariantLCase(AutoTypeAheadDisplayFoundText).equals("atendofmatchedstring") Then + ' Expression to find ending of the word which contains prefexText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\s", System.Text.RegularExpressions.RegexOptions.IgnoreCase) + ' Find the ending of the word which contains prefexText + If regex1.IsMatch(resultItem, index + 1) Then + index = regex1.Match(resultItem, index + 1).Index + Else + ' If the word which contains prefexText is the last word in string, regex1.IsMatch returns false. + index = resultItem.Length + End If + If index > Len(resultItem) Then + index = Len(resultItem) + End If + ' If text from beginning of the string till index is less than columnLength value then, display string from the beginning till index. + If index <= columnLength Then + if index = Len(resultItem) Then 'Make decision to append "..." + itemToAdd = resultItem.Substring(0,index) + Else + itemToAdd = resultItem.Substring(0,index) & "..." + End If + Else + If index = Len(resultItem) Then + itemToAdd = "..." & resultItem.Substring(index - (columnLength - 3), (columnLength - 3)) + Else + 'Truncate the string to show only columnLength - 6 characters as begining and trailing "..." has to be appended. + itemToAdd = "..." & resultItem.Substring(index - (columnLength - 6), columnLength - 6) & "..." + End If + End If + End If + + ' Remove newline character from itemToAdd + Dim prefixTextIndex As Integer = itemToAdd.IndexOf(prefixText, StringComparison.CurrentCultureIgnoreCase) + ' If itemToAdd contains any newline after the search text then show text only till newline + Dim regex2 As System.Text.RegularExpressions.Regex = New System.Text.RegularExpressions.Regex("(" & vbCrLf & "|" & vbLf & ")", System.Text.RegularExpressions.RegexOptions.IgnoreCase) + Dim newLineIndexAfterPrefix As Integer = -1 + If regex2.IsMatch(itemToAdd, prefixTextIndex) Then + newLineIndexAfterPrefix = regex2.Match(itemToAdd, prefixTextIndex).Index + End If + If (newLineIndexAfterPrefix > -1) Then + If itemToAdd.EndsWith("...") Then + itemToAdd = (itemToAdd.Substring(0, newLineIndexAfterPrefix) + "...") + Else + itemToAdd = itemToAdd.Substring(0, newLineIndexAfterPrefix) + End If + End If + ' If itemToAdd contains any newline before search text then show text which comes after newline + Dim regex3 As System.Text.RegularExpressions.Regex = New System.Text.RegularExpressions.Regex("(" & vbCrLf & "|" & vbLf & ")", (System.Text.RegularExpressions.RegexOptions.IgnoreCase Or System.Text.RegularExpressions.RegexOptions.RightToLeft)) + Dim newLineIndexBeforePrefix As Integer = -1 + If regex3.IsMatch(itemToAdd, prefixTextIndex) Then + newLineIndexBeforePrefix = regex3.Match(itemToAdd, prefixTextIndex).Index + End If + If (newLineIndexBeforePrefix > -1) Then + If itemToAdd.StartsWith("...") Then + itemToAdd = ("..." + itemToAdd.Substring((newLineIndexBeforePrefix + regex3.Match(itemToAdd, prefixTextIndex).Length))) + Else + itemToAdd = itemToAdd.Substring((newLineIndexBeforePrefix + regex3.Match(itemToAdd, prefixTextIndex).Length)) + End If + End If + + If Not itemToAdd is nothing AndAlso Not resultList.Contains(itemToAdd) Then + + resultList.Add(itemToAdd) + + isAdded = true + End If + End If + Return isAdded + End Function + + + Protected Overridable Sub GetPageSize() + + If Me.PersonalDDPagination.PageSize.Text.Trim <> "" Then + Try + 'Me.PageSize = Integer.Parse(Me.PersonalDDPagination.PageSize.Text) + Catch ex As Exception + End Try + End If + End Sub + + Protected Overridable Sub AddNewRecords() + + Dim newRecordList As ArrayList = New ArrayList() + + Dim newUIDataList As System.Collections.Generic.List(Of Hashtable) = New System.Collections.Generic.List(Of Hashtable)() + + ' Loop though all the record controls and if the record control + ' does not have a unique record id set, then create a record + ' and add to the list. + If Not Me.ResetData Then + Dim rep As System.Web.UI.WebControls.Repeater = CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalDDTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return + + Dim repItem As System.Web.UI.WebControls.RepeaterItem + For Each repItem In rep.Items + ' Loop through all rows in the table, set its DataSource and call DataBind(). + + Dim recControl As PersonalDDTableControlRow = DirectCast(repItem.FindControl("PersonalDDTableControlRow"), PersonalDDTableControlRow) + + If recControl.Visible AndAlso recControl.IsNewRecord() Then + + Dim rec As PersonalDDRecord = New PersonalDDRecord() + + If recControl.EndDate.Text <> "" Then + rec.Parse(recControl.EndDate.Text, PersonalDDTable.EndDate) + End If + If recControl.Mission.Text <> "" Then + rec.Parse(recControl.Mission.Text, PersonalDDTable.Mission) + End If + If recControl.Ref1.Text <> "" Then + rec.Parse(recControl.Ref1.Text, PersonalDDTable.Ref0) + End If + If recControl.RefDate.Text <> "" Then + rec.Parse(recControl.RefDate.Text, PersonalDDTable.RefDate) + End If + If recControl.StartDate.Text <> "" Then + rec.Parse(recControl.StartDate.Text, PersonalDDTable.StartDate) + End If + newUIDataList.Add(recControl.PreservedUIData()) + newRecordList.Add(rec) + End If + Next + End If + + + ' Add any new record to the list. + Dim index As Integer = 0 + For index = 1 To Me.AddNewRecord + + newRecordList.Insert(0, New PersonalDDRecord()) + newUIDataList.Insert(0, New Hashtable()) + + Next + Me.AddNewRecord = 0 + + ' Finally, add any new records to the DataSource. + If newRecordList.Count > 0 Then + + Dim finalList As ArrayList = New ArrayList(Me.DataSource) + finalList.InsertRange(0, newRecordList) + + Me.DataSource = DirectCast(finalList.ToArray(GetType(PersonalDDRecord)), PersonalDDRecord()) + + End If + + ' Add the existing UI data to this hash table + If newUIDataList.Count > 0 Then + Me.UIData.InsertRange(0, newUIDataList) + End If + + End Sub + + + Public Sub AddToDeletedRecordIds(ByVal rec As PersonalDDTableControlRow) + If rec.IsNewRecord() Then + Return + End If + + If Not Me.DeletedRecordIds Is Nothing AndAlso Me.DeletedRecordIds.Trim <> "" Then + Me.DeletedRecordIds &= "," + End If + + Me.DeletedRecordIds &= "[" & rec.RecordUniqueId & "]" + End Sub + + Protected Overridable Function InDeletedRecordIds(ByVal rec As PersonalDDTableControlRow) As Boolean + If Me.DeletedRecordIds Is Nothing OrElse Me.DeletedRecordIds.Trim = "" Then + Return False + End If + + Return Me.DeletedRecordIds.IndexOf("[" & rec.RecordUniqueId & "]") >= 0 + End Function + + Private _DeletedRecordIds As String + Public Property DeletedRecordIds() As String + Get + Return Me._DeletedRecordIds + End Get + Set(ByVal value As String) + Me._DeletedRecordIds = value + End Set + End Property + + + ' Create Set, WhereClause, and Populate Methods + + Public Overridable Sub SetEndDateLabel1() + + End Sub + + Public Overridable Sub SetMissionLabel() + + End Sub + + Public Overridable Sub SetPersonalDDTableControlCollapsibleRegion() + + End Sub + + Public Overridable Sub SetRefDateLabel() + + End Sub + + Public Overridable Sub SetRefLabel() + + End Sub + + Public Overridable Sub SetStartDateLabel1() + + End Sub + + + + + Protected Overridable Sub Control_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.PreRender + ' PreRender event is raised just before page is being displayed. + Try + DbUtils.StartTransaction + Me.RegisterPostback() + + If Not Me.Page.ErrorOnPage AndAlso (Me.Page.IsPageRefresh OrElse Me.DataChanged OrElse Me.ResetData) Then + + + ' Re-load the data and update the web page if necessary. + ' This is typically done during a postback (filter, search button, sort, pagination button). + ' In each of the other click handlers, simply set DataChanged to True to reload the data. + + Me.LoadData() + Me.DataBind() + + End If + + + + Catch ex As Exception + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + Finally + DbUtils.EndTransaction + End Try + End Sub + + + Protected Overrides Sub SaveControlsToSession() + MyBase.SaveControlsToSession() + + ' Save filter controls to values to session. + + + 'Save pagination state to session. + + + + ' Save table control properties to the session. + If Not Me.CurrentSortOrder Is Nothing Then + Me.SaveToSession(Me, "Order_By", Me.CurrentSortOrder.ToXmlString()) + End If + + Me.SaveToSession(Me, "Page_Index", Me.PageIndex.ToString()) + Me.SaveToSession(Me, "Page_Size", Me.PageSize.ToString()) + + Me.SaveToSession(Me, "DeletedRecordIds", Me.DeletedRecordIds) + + End Sub + + Protected Sub SaveControlsToSession_Ajax() + ' Save filter controls to values to session. + + HttpContext.Current.Session("AppRelativeVirtualPath") = Me.Page.AppRelativeVirtualPath + + End Sub + + Protected Overrides Sub ClearControlsFromSession() + MyBase.ClearControlsFromSession() + + ' Clear filter controls values from the session. + + + ' Clear pagination state from session. + + + + ' Clear table properties from the session. + Me.RemoveFromSession(Me, "Order_By") + Me.RemoveFromSession(Me, "Page_Index") + Me.RemoveFromSession(Me, "Page_Size") + + Me.RemoveFromSession(Me, "DeletedRecordIds") + + End Sub + + Protected Overrides Sub LoadViewState(ByVal savedState As Object) + MyBase.LoadViewState(savedState) + + Dim orderByStr As String = CType(ViewState("PersonalDDTableControl_OrderBy"), String) + + If orderByStr IsNot Nothing AndAlso orderByStr.Trim <> "" Then + Me.CurrentSortOrder = BaseClasses.Data.OrderBy.FromXmlString(orderByStr) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + End If + + Dim pageIndex As String = CType(ViewState("Page_Index"), String) + If pageIndex IsNot Nothing Then + Me.PageIndex = CInt(pageIndex) + End If + + Dim pageSize As String = CType(ViewState("Page_Size"), String) + If Not pageSize Is Nothing Then + Me.PageSize = CInt(pageSize) + End If + + + + ' Load view state for pagination control. + + Me.DeletedRecordIds = CType(Me.ViewState("DeletedRecordIds"), String) + + End Sub + + Protected Overrides Function SaveViewState() As Object + + If Me.CurrentSortOrder IsNot Nothing Then + Me.ViewState("PersonalDDTableControl_OrderBy") = Me.CurrentSortOrder.ToXmlString() + End If + + Me.ViewState("Page_Index") = Me.PageIndex + Me.ViewState("Page_Size") = Me.PageSize + + Me.ViewState("DeletedRecordIds") = Me.DeletedRecordIds + + + ' Load view state for pagination control. + + + Return MyBase.SaveViewState() + End Function + + ' Generate the event handling functions for pagination events. + + ' event handler for ImageButton + Public Overridable Sub PersonalDDPagination_FirstPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.PageIndex = 0 + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalDDPagination_LastPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.DisplayLastPage = True + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalDDPagination_NextPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.PageIndex += 1 + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for LinkButton + Public Overridable Sub PersonalDDPagination_PageSizeButton_Click(ByVal sender As Object, ByVal args As EventArgs) + + Try + + Me.DataChanged = True + + Me.PageSize = Integer.Parse(Me.PersonalDDPagination.PageSize.Text) + + Me.PageIndex = Integer.Parse(Me.PersonalDDPagination.CurrentPage.Text) - 1 + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalDDPagination_PreviousPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + If Me.PageIndex > 0 Then + Me.PageIndex -= 1 + Me.DataChanged = True + End If + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + + ' Generate the event handling functions for sorting events. + + Public Overridable Sub EndDateLabel1_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by EndDate when clicked. + + ' Get previous sorting state for EndDate. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalDDTable.EndDate) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for EndDate. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalDDTable.EndDate, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by EndDate, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub MissionLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by Mission when clicked. + + ' Get previous sorting state for Mission. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalDDTable.Mission) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for Mission. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalDDTable.Mission, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by Mission, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub RefDateLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by RefDate when clicked. + + ' Get previous sorting state for RefDate. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalDDTable.RefDate) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for RefDate. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalDDTable.RefDate, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by RefDate, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub RefLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by Ref when clicked. + + ' Get previous sorting state for Ref. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalDDTable.Ref0) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for Ref. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalDDTable.Ref0, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by Ref, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub StartDateLabel1_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by StartDate when clicked. + + ' Get previous sorting state for StartDate. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalDDTable.StartDate) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for StartDate. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalDDTable.StartDate, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by StartDate, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + + ' Generate the event handling functions for button events. + + ' event handler for ImageButton + Public Overridable Sub PersonalDDExportCSVButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + ' Build the where clause based on the current filter and search criteria + ' Create the Order By clause based on the user's current sorting preference. + + Dim wc As WhereClause = CreateWhereClause + Dim orderBy As OrderBy = Nothing + + orderBy = CreateOrderBy + + ' Add each of the columns in order of export. + Dim columns() as BaseColumn = New BaseColumn() { _ + PersonalDDTable.StartDate, _ + PersonalDDTable.EndDate, _ + PersonalDDTable.Mission, _ + PersonalDDTable.Ref0, _ + PersonalDDTable.RefDate, _ + Nothing} + Dim exportData as ExportDataToCSV = New ExportDataToCSV(PersonalDDTable.Instance, wc, orderBy, columns) + + Dim done As Boolean = False + + Dim totalRowsReturned As Integer = 0 + Dim join As CompoundFilter = CreateCompoundJoinFilter() + Dim data As DataForExport = New DataForExport(PersonalDDTable.Instance, wc, orderBy, columns, join) + + 'Check for Export Data Threshold + Dim exportRawValues As Boolean = False + Me.TotalRecords = PersonalDDTable.GetRecordCount(join, wc) + If Me.TotalRecords > 10000 Then + exportRawValues = True + End If + exportData.StartExport(Me.Page.Response, exportRawValues) + + ' Read pageSize records at a time and write out the CSV file. + While (Not done) + Dim recList As ArrayList = data.GetRows(exportData.pageSize) + If recList Is Nothing Then + Exit While 'no more records we are done + End If + + totalRowsReturned = recList.Count + For Each rec As BaseRecord In recList + For Each col As BaseColumn In data.ColumnList + If col Is Nothing Then + Continue For + End If + + If Not data.IncludeInExport(col) Then + Continue For + End If + + Dim val As String = "" + + If exportRawValues Then + val = rec.GetValue(col).ToString() + Else + Dim _isExpandableNonCompositeForeignKey As Boolean = col.TableDefinition.IsExpandableNonCompositeForeignKey(col) + If _isExpandableNonCompositeForeignKey AndAlso col.IsApplyDisplayAs Then + val = PersonalDDTable.GetDFKA(rec.GetValue(col).ToString(), col, Nothing) + End If + If (Not _isExpandableNonCompositeForeignKey) Or (String.IsNullOrEmpty(val)) Then + val = exportData.GetDataForExport(col, rec) + End If + End If + exportData.WriteColumnData(val, data.IsString(col)) + + Next col + exportData.WriteNewRow() + Next rec + + ' If we already are below the pageSize, then we are done. + If totalRowsReturned < exportData.pageSize Then + done = True + End If + End While + exportData.FinishExport(Me.Page.Response) + + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalDDExportExcelButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + ' To customize the columns or the format, override this function in Section 1 of the page + ' and modify it to your liking. + ' Build the where clause based on the current filter and search criteria + ' Create the Order By clause based on the user's current sorting preference. + + Dim wc As WhereClause = CreateWhereClause + Dim orderBy As OrderBy = Nothing + + orderBy = CreateOrderBy + + Dim done As Boolean = False + Dim val As Object = "" + ' Read pageSize records at a time and write out the Excel file. + Dim totalRowsReturned As Integer = 0 + + Me.TotalRecords = PersonalDDTable.GetRecordCount(wc) + If Me.TotalRecords > 10000 Then + + ' Add each of the columns in order of export. + Dim columns() as BaseColumn = New BaseColumn() { _ + PersonalDDTable.StartDate, _ + PersonalDDTable.EndDate, _ + PersonalDDTable.Mission, _ + PersonalDDTable.Ref0, _ + PersonalDDTable.RefDate, _ + Nothing} + Dim exportData as ExportDataToCSV = New ExportDataToCSV(PersonalDDTable.Instance, wc, orderBy, columns) + exportData.StartExport(Me.Page.Response, True) + + Dim dataForCSV As DataForExport = New DataForExport(PersonalDDTable.Instance, wc, orderBy, columns) + + ' Read pageSize records at a time and write out the CSV file. + While (Not done) + Dim recList As ArrayList = dataForCSV.GetRows(exportData.pageSize) + If recList Is Nothing Then + Exit While 'no more records we are done + End If + + totalRowsReturned = recList.Count + For Each rec As BaseRecord In recList + For Each col As BaseColumn In dataForCSV.ColumnList + If col Is Nothing Then + Continue For + End If + + If Not dataForCSV.IncludeInExport(col) Then + Continue For + End If + + val = rec.GetValue(col).ToString() + exportData.WriteColumnData(val, dataForCSV.IsString(col)) + + Next col + exportData.WriteNewRow() + Next rec + + ' If we already are below the pageSize, then we are done. + If totalRowsReturned < exportData.pageSize Then + done = True + End If + End While + exportData.FinishExport(Me.Page.Response) + Else + + ' Create an instance of the Excel report class with the table class, where clause and order by. + Dim excelReport As ExportDataToExcel = New ExportDataToExcel(PersonalDDTable.Instance, wc, orderBy) + ' Add each of the columns in order of export. + ' To customize the data type, change the second parameter of the new ExcelColumn to be + ' a format string from Excel's Format Cell menu. For example "dddd, mmmm dd, yyyy h:mm AM/PM;@", "#,##0.00" + + If Me.Page.Response Is Nothing Then + Return + End If + + excelReport.CreateExcelBook() + + Dim width As Integer = 0 + Dim columnCounter As Integer = 0 + Dim data As DataForExport = New DataForExport(PersonalDDTable.Instance, wc, orderBy, Nothing) + data.ColumnList.Add(New ExcelColumn(PersonalDDTable.StartDate, "Short Date")) + data.ColumnList.Add(New ExcelColumn(PersonalDDTable.EndDate, "Short Date")) + data.ColumnList.Add(New ExcelColumn(PersonalDDTable.Mission, "Default")) + data.ColumnList.Add(New ExcelColumn(PersonalDDTable.Ref0, "Default")) + data.ColumnList.Add(New ExcelColumn(PersonalDDTable.RefDate, "Short Date")) + + + For Each col As ExcelColumn In data.ColumnList + width = excelReport.GetExcelCellWidth(col) + If data.IncludeInExport(col) Then + excelReport.AddColumnToExcelBook(columnCounter, col.ToString(), excelReport.GetExcelDataType(col), width, excelReport.GetDisplayFormat(col)) + columnCounter = columnCounter + 1 + End If + Next col + + While (Not done) + Dim recList As ArrayList = data.GetRows(excelReport.pageSize) + + If recList Is Nothing Then + Exit While 'no more records we are done + End If + + totalRowsReturned = recList.Count + + For Each rec As BaseRecord In recList + excelReport.AddRowToExcelBook() + columnCounter = 0 + + For Each col As ExcelColumn In data.ColumnList + If Not data.IncludeInExport(col) Then + Continue For + End If + + Dim _isExpandableNonCompositeForeignKey As Boolean = col.DisplayColumn.TableDefinition.IsExpandableNonCompositeForeignKey(col.DisplayColumn) + If _isExpandableNonCompositeForeignKey AndAlso col.DisplayColumn.IsApplyDisplayAs Then + val = PersonalDDTable.GetDFKA(rec.GetValue(col.DisplayColumn).ToString(), col.DisplayColumn, Nothing) + If val Is Nothing Then + val = rec.Format(col.DisplayColumn) + End If + Else + val = excelReport.GetValueForExcelExport(col, rec) + End If + excelReport.AddCellToExcelRow(columnCounter, excelReport.GetExcelDataType(col), val, col.DisplayFormat) + + columnCounter = columnCounter + 1 + Next col + Next rec + + ' If we already are below the pageSize, then we are done. + If totalRowsReturned < excelReport.pageSize Then + done = True + End If + End While + + excelReport.SaveExcelBook(Me.Page.Response) + End If + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalDDImportButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalDDPDFButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + Dim report As PDFReport = New PDFReport() + report.SpecificReportFileName = Page.Server.MapPath("ShowPersonalId.PersonalDDPDFButton.report") + ' report.Title replaces the value tag of page header and footer containing ${ReportTitle} + report.Title = "PersonalDD" + ' If ShowPersonalId.PersonalDDPDFButton.report specifies a valid report template, + ' AddColumn method will generate a report template. + ' Each AddColumn method-call specifies a column + ' The 1st parameter represents the text of the column header + ' The 2nd parameter represents the horizontal alignment of the column header + ' The 3rd parameter represents the text format of the column detail + ' The 4th parameter represents the horizontal alignment of the column detail + ' The 5th parameter represents the relative width of the column + report.AddColumn(PersonalDDTable.StartDate.Name, ReportEnum.Align.Left, "${StartDate}", ReportEnum.Align.Left, 20) + report.AddColumn(PersonalDDTable.EndDate.Name, ReportEnum.Align.Left, "${EndDate}", ReportEnum.Align.Left, 20) + report.AddColumn(PersonalDDTable.Mission.Name, ReportEnum.Align.Left, "${Mission}", ReportEnum.Align.Left, 30) + report.AddColumn(PersonalDDTable.Ref0.Name, ReportEnum.Align.Left, "${Ref0}", ReportEnum.Align.Left, 30) + report.AddColumn(PersonalDDTable.RefDate.Name, ReportEnum.Align.Left, "${RefDate}", ReportEnum.Align.Left, 20) + + + Dim rowsPerQuery As Integer = 5000 + Dim recordCount As Integer = 0 + + report.Page = Page.GetResourceValue("Txt:Page", "Persons") + report.ApplicationPath = Me.Page.MapPath(Page.Request.ApplicationPath) + + Dim whereClause As WhereClause = CreateWhereClause + Dim orderBy As OrderBy = CreateOrderBy + Dim joinFilter As BaseFilter = CreateCompoundJoinFilter() + + Dim pageNum As Integer = 0 + Dim totalRows As Integer = PersonalDDTable.GetRecordCount(joinFilter,whereClause) + Dim columns As ColumnList = PersonalDDTable.GetColumnList() + Dim records As PersonalDDRecord() = Nothing + + Do + + records = PersonalDDTable.GetRecords(joinFilter,whereClause, orderBy, pageNum, rowsPerQuery) + If Not (records Is Nothing) AndAlso records.Length > 0 AndAlso whereClause.RunQuery Then + For Each record As PersonalDDRecord In records + + ' AddData method takes four parameters + ' The 1st parameters represent the data format + ' The 2nd parameters represent the data value + ' The 3rd parameters represent the default alignment of column using the data + ' The 4th parameters represent the maximum length of the data value being shown + report.AddData("${StartDate}", record.Format(PersonalDDTable.StartDate), ReportEnum.Align.Left, 100) + report.AddData("${EndDate}", record.Format(PersonalDDTable.EndDate), ReportEnum.Align.Left, 100) + report.AddData("${Mission}", record.Format(PersonalDDTable.Mission), ReportEnum.Align.Left, 100) + report.AddData("${Ref0}", record.Format(PersonalDDTable.Ref0), ReportEnum.Align.Left, 100) + report.AddData("${RefDate}", record.Format(PersonalDDTable.RefDate), ReportEnum.Align.Left, 100) + + report.WriteRow + Next + pageNum = pageNum + 1 + recordCount += records.Length + End If + Loop While Not (records Is Nothing) AndAlso recordCount < totalRows AndAlso whereClause.RunQuery + + report.Close + BaseClasses.Utils.NetUtils.WriteResponseBinaryAttachment(Me.Page.Response, report.Title + ".pdf", report.ReportInByteArray, 0, true) + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalDDRefreshButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Dim PersonalDDTableControlObj as PersonalDDTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalDDTableControl"), PersonalDDTableControl) + PersonalDDTableControlObj.ResetData = True + + PersonalDDTableControlObj.RemoveFromSession(PersonalDDTableControlObj, "DeletedRecordIds") + PersonalDDTableControlObj.DeletedRecordIds = Nothing + + Dim PersonalEducationTableControlObj as PersonalEducationTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalEducationTableControl"), PersonalEducationTableControl) + PersonalEducationTableControlObj.ResetData = True + + PersonalEducationTableControlObj.RemoveFromSession(PersonalEducationTableControlObj, "DeletedRecordIds") + PersonalEducationTableControlObj.DeletedRecordIds = Nothing + + Dim PersonalExtWorkTableControlObj as PersonalExtWorkTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalExtWorkTableControl"), PersonalExtWorkTableControl) + PersonalExtWorkTableControlObj.ResetData = True + + PersonalExtWorkTableControlObj.RemoveFromSession(PersonalExtWorkTableControlObj, "DeletedRecordIds") + PersonalExtWorkTableControlObj.DeletedRecordIds = Nothing + + Dim PersonalIdRecordControlObj as PersonalIdRecordControl = DirectCast(Me.Page.FindControlRecursively("PersonalIdRecordControl"), PersonalIdRecordControl) + PersonalIdRecordControlObj.ResetData = True + + + Dim PersonalInsigniaTableControlObj as PersonalInsigniaTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalInsigniaTableControl"), PersonalInsigniaTableControl) + PersonalInsigniaTableControlObj.ResetData = True + + PersonalInsigniaTableControlObj.RemoveFromSession(PersonalInsigniaTableControlObj, "DeletedRecordIds") + PersonalInsigniaTableControlObj.DeletedRecordIds = Nothing + + Dim PersonalLanguageSkillTableControlObj as PersonalLanguageSkillTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalLanguageSkillTableControl"), PersonalLanguageSkillTableControl) + PersonalLanguageSkillTableControlObj.ResetData = True + + PersonalLanguageSkillTableControlObj.RemoveFromSession(PersonalLanguageSkillTableControlObj, "DeletedRecordIds") + PersonalLanguageSkillTableControlObj.DeletedRecordIds = Nothing + + Dim PersonalNameTableControlObj as PersonalNameTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalNameTableControl"), PersonalNameTableControl) + PersonalNameTableControlObj.ResetData = True + + PersonalNameTableControlObj.RemoveFromSession(PersonalNameTableControlObj, "DeletedRecordIds") + PersonalNameTableControlObj.DeletedRecordIds = Nothing + + Dim PersonalRankTableControlObj as PersonalRankTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalRankTableControl"), PersonalRankTableControl) + PersonalRankTableControlObj.ResetData = True + + PersonalRankTableControlObj.RemoveFromSession(PersonalRankTableControlObj, "DeletedRecordIds") + PersonalRankTableControlObj.DeletedRecordIds = Nothing + + Dim PersonalSalaryTableControlObj as PersonalSalaryTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalSalaryTableControl"), PersonalSalaryTableControl) + PersonalSalaryTableControlObj.ResetData = True + + PersonalSalaryTableControlObj.RemoveFromSession(PersonalSalaryTableControlObj, "DeletedRecordIds") + PersonalSalaryTableControlObj.DeletedRecordIds = Nothing + + Dim PersonalSpecialSkillTableControlObj as PersonalSpecialSkillTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalSpecialSkillTableControl"), PersonalSpecialSkillTableControl) + PersonalSpecialSkillTableControlObj.ResetData = True + + PersonalSpecialSkillTableControlObj.RemoveFromSession(PersonalSpecialSkillTableControlObj, "DeletedRecordIds") + PersonalSpecialSkillTableControlObj.DeletedRecordIds = Nothing + + Dim PersonalSportSkillTableControlObj as PersonalSportSkillTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalSportSkillTableControl"), PersonalSportSkillTableControl) + PersonalSportSkillTableControlObj.ResetData = True + + PersonalSportSkillTableControlObj.RemoveFromSession(PersonalSportSkillTableControlObj, "DeletedRecordIds") + PersonalSportSkillTableControlObj.DeletedRecordIds = Nothing + + Dim PersonalTitleTableControlObj as PersonalTitleTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalTitleTableControl"), PersonalTitleTableControl) + PersonalTitleTableControlObj.ResetData = True + + PersonalTitleTableControlObj.RemoveFromSession(PersonalTitleTableControlObj, "DeletedRecordIds") + PersonalTitleTableControlObj.DeletedRecordIds = Nothing + + Dim PersonRelativeTableControlObj as PersonRelativeTableControl = DirectCast(Me.Page.FindControlRecursively("PersonRelativeTableControl"), PersonRelativeTableControl) + PersonRelativeTableControlObj.ResetData = True + + PersonRelativeTableControlObj.RemoveFromSession(PersonRelativeTableControlObj, "DeletedRecordIds") + PersonRelativeTableControlObj.DeletedRecordIds = Nothing + + Dim ReportPropertiesTableControlObj as ReportPropertiesTableControl = DirectCast(Me.Page.FindControlRecursively("ReportPropertiesTableControl"), ReportPropertiesTableControl) + ReportPropertiesTableControlObj.ResetData = True + + ReportPropertiesTableControlObj.RemoveFromSession(ReportPropertiesTableControlObj, "DeletedRecordIds") + ReportPropertiesTableControlObj.DeletedRecordIds = Nothing + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalDDResetButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.CurrentSortOrder.Reset() + If Me.InSession(Me, "Order_By") Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + Me.CurrentSortOrder.Add(PersonalDDTable.StartDate, OrderByItem.OrderDir.Asc) + + + End If + + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalDDWordButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + Dim report As WordReport = New WordReport + report.SpecificReportFileName = Page.Server.MapPath("ShowPersonalId.PersonalDDWordButton.word") + ' report.Title replaces the value tag of page header and footer containing ${ReportTitle} + report.Title = "PersonalDD" + ' If ShowPersonalId.PersonalDDWordButton.report specifies a valid report template, + ' AddColumn method will generate a report template. + ' Each AddColumn method-call specifies a column + ' The 1st parameter represents the text of the column header + ' The 2nd parameter represents the horizontal alignment of the column header + ' The 3rd parameter represents the text format of the column detail + ' The 4th parameter represents the horizontal alignment of the column detail + ' The 5th parameter represents the relative width of the column + report.AddColumn(PersonalDDTable.StartDate.Name, ReportEnum.Align.Left, "${StartDate}", ReportEnum.Align.Left, 20) + report.AddColumn(PersonalDDTable.EndDate.Name, ReportEnum.Align.Left, "${EndDate}", ReportEnum.Align.Left, 20) + report.AddColumn(PersonalDDTable.Mission.Name, ReportEnum.Align.Left, "${Mission}", ReportEnum.Align.Left, 30) + report.AddColumn(PersonalDDTable.Ref0.Name, ReportEnum.Align.Left, "${Ref0}", ReportEnum.Align.Left, 30) + report.AddColumn(PersonalDDTable.RefDate.Name, ReportEnum.Align.Left, "${RefDate}", ReportEnum.Align.Left, 20) + + Dim whereClause As WhereClause = CreateWhereClause + + Dim orderBy As OrderBy = CreateOrderBy + Dim joinFilter As BaseFilter = CreateCompoundJoinFilter() + + Dim rowsPerQuery As Integer = 5000 + Dim pageNum As Integer = 0 + Dim recordCount As Integer = 0 + Dim totalRows As Integer = PersonalDDTable.GetRecordCount(joinFilter,whereClause) + + report.Page = Page.GetResourceValue("Txt:Page", "Persons") + report.ApplicationPath = Me.Page.MapPath(Page.Request.ApplicationPath) + + Dim columns As ColumnList = PersonalDDTable.GetColumnList() + Dim records As PersonalDDRecord() = Nothing + Do + records = PersonalDDTable.GetRecords(joinFilter,whereClause, orderBy, pageNum, rowsPerQuery) + + If Not (records Is Nothing) AndAlso records.Length > 0 AndAlso whereClause.RunQuery Then + For Each record As PersonalDDRecord In records + ' AddData method takes four parameters + ' The 1st parameters represent the data format + ' The 2nd parameters represent the data value + ' The 3rd parameters represent the default alignment of column using the data + ' The 4th parameters represent the maximum length of the data value being shown + report.AddData("${StartDate}", record.Format(PersonalDDTable.StartDate), ReportEnum.Align.Left, 100) + report.AddData("${EndDate}", record.Format(PersonalDDTable.EndDate), ReportEnum.Align.Left, 100) + report.AddData("${Mission}", record.Format(PersonalDDTable.Mission), ReportEnum.Align.Left, 100) + report.AddData("${Ref0}", record.Format(PersonalDDTable.Ref0), ReportEnum.Align.Left, 100) + report.AddData("${RefDate}", record.Format(PersonalDDTable.RefDate), ReportEnum.Align.Left, 100) + + report.WriteRow + Next + pageNum = pageNum + 1 + recordCount += records.Length + End If + Loop While Not (records Is Nothing) AndAlso recordCount < totalRows AndAlso whereClause.RunQuery + report.save + BaseClasses.Utils.NetUtils.WriteResponseBinaryAttachment(Me.Page.Response, report.Title + ".doc", report.ReportInByteArray, 0, true) + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + + + ' Generate the event handling functions for filter and search events. + + + ' Generate the event handling functions for others + + + Private _UIData As New System.Collections.Generic.List(Of Hashtable) + Public Property UIData() As System.Collections.Generic.List(Of Hashtable) + Get + Return Me._UIData + End Get + Set(ByVal value As System.Collections.Generic.List(Of Hashtable)) + Me._UIData = value + End Set + End Property + + ' pagination properties + Protected _PageSize As Integer + Public Property PageSize() As Integer + Get + Return Me._PageSize + End Get + Set(ByVal value As Integer) + Me._PageSize = value + End Set + End Property + + Protected _PageIndex As Integer + Public Property PageIndex() As Integer + Get + ' Return the PageIndex + Return Me._PageIndex + End Get + Set(ByVal value As Integer) + Me._PageIndex = value + End Set + End Property + + Protected _TotalRecords As Integer = -1 + Public Property TotalRecords() As Integer + Get + If _TotalRecords < 0 + _TotalRecords = PersonalDDTable.GetRecordCount(CreateCompoundJoinFilter(), CreateWhereClause()) + End If + Return Me._TotalRecords + End Get + Set(ByVal value As Integer) + If Me.PageSize > 0 Then + + Me.TotalPages = CInt(Math.Ceiling(value / Me.PageSize)) + + End If + Me._TotalRecords = value + End Set + End Property + + + + Protected _TotalPages As Integer = -1 + Public Property TotalPages() As Integer + Get + If _TotalPages < 0 Then + + Me.TotalPages = CInt(Math.Ceiling(TotalRecords / Me.PageSize)) + + End If + Return Me._TotalPages + End Get + Set(ByVal value As Integer) + Me._TotalPages = value + End Set + End Property + + Protected _DisplayLastPage As Boolean + Public Property DisplayLastPage() As Boolean + Get + Return Me._DisplayLastPage + End Get + Set(ByVal value As Boolean) + Me._DisplayLastPage = value + End Set + End Property + + Private _DataChanged As Boolean = False + Public Property DataChanged() As Boolean + Get + Return Me._DataChanged + End Get + Set(ByVal value As Boolean) + Me._DataChanged = value + End Set + End Property + + Private _ResetData As Boolean = False + Public Property ResetData() As Boolean + Get + Return Me._ResetData + End Get + Set(ByVal value As Boolean) + Me._ResetData = value + End Set + End Property + + Private _AddNewRecord As Integer = 0 + Public Property AddNewRecord() As Integer + Get + Return Me._AddNewRecord + End Get + Set(ByVal value As Integer) + Me._AddNewRecord = value + End Set + End Property + + + Private _CurrentSortOrder As OrderBy = Nothing + Public Property CurrentSortOrder() As OrderBy + Get + Return Me._CurrentSortOrder + End Get + Set(ByVal value As BaseClasses.Data.OrderBy) + Me._CurrentSortOrder = value + End Set + End Property + + Private _DataSource() As PersonalDDRecord = Nothing + Public Property DataSource() As PersonalDDRecord () + Get + Return Me._DataSource + End Get + Set(ByVal value() As PersonalDDRecord) + Me._DataSource = value + End Set + End Property + +#Region "Helper Properties" + + Public ReadOnly Property EndDateLabel1() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "EndDateLabel1"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property MissionLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "MissionLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property PersonalDDExportCSVButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalDDExportCSVButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalDDExportExcelButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalDDExportExcelButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalDDImportButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalDDImportButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalDDPagination() As Persons.UI.IPagination + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalDDPagination"), Persons.UI.IPagination) + End Get + End Property + + Public ReadOnly Property PersonalDDPDFButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalDDPDFButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalDDRefreshButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalDDRefreshButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalDDResetButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalDDResetButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalDDTableControlCollapsibleRegion() As System.Web.UI.WebControls.Panel + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalDDTableControlCollapsibleRegion"), System.Web.UI.WebControls.Panel) + End Get + End Property + + Public ReadOnly Property PersonalDDWordButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalDDWordButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property RefDateLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RefDateLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property RefLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RefLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property StartDateLabel1() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "StartDateLabel1"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + +#End Region + +#Region "Helper Functions" + + Public Overrides Overloads Function ModifyRedirectUrl(url As String, arg As String, ByVal bEncrypt As Boolean) As String + Return Me.Page.EvaluateExpressions(url, arg, bEncrypt, Me) + End Function + + Public Overrides Overloads Function EvaluateExpressions(url As String, arg As String, ByVal bEncrypt As Boolean) As String + Dim needToProcess As Boolean = AreAnyUrlParametersForMe(url, arg) + If (needToProcess) Then + Dim recCtl As PersonalDDTableControlRow = Me.GetSelectedRecordControl() + If recCtl Is Nothing AndAlso url.IndexOf("{") >= 0 Then + ' Localization. + Throw New Exception(Page.GetResourceValue("Err:NoRecSelected", "Persons")) + End If + Dim rec As PersonalDDRecord = Nothing + If recCtl IsNot Nothing Then + rec = recCtl.GetRecord() + End If + Return EvaluateExpressions(url, arg, rec, bEncrypt) + End If + Return url + End Function + + Public Overridable Function GetSelectedRecordControl() As PersonalDDTableControlRow + Return Nothing + + End Function + + Public Overridable Function GetSelectedRecordControls() As PersonalDDTableControlRow() + + Return DirectCast((new ArrayList()).ToArray(GetType(PersonalDDTableControlRow)), PersonalDDTableControlRow()) + + End Function + + Public Overridable Sub DeleteSelectedRecords(ByVal deferDeletion As Boolean) + Dim recList() As PersonalDDTableControlRow = Me.GetSelectedRecordControls() + If recList.Length = 0 Then + ' Localization. + Throw New Exception(Page.GetResourceValue("Err:NoRecSelected", "Persons")) + End If + + Dim recCtl As PersonalDDTableControlRow + For Each recCtl In recList + If deferDeletion Then + If Not recCtl.IsNewRecord Then + + Me.AddToDeletedRecordIds(recCtl) + + End If + recCtl.Visible = False + + Else + + recCtl.Delete() + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + End If + Next + End Sub + + Public Function GetRecordControls() As PersonalDDTableControlRow() + Dim recList As ArrayList = New ArrayList() + Dim rep As System.Web.UI.WebControls.Repeater = CType(Me.FindControl("PersonalDDTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return Nothing + Dim repItem As System.Web.UI.WebControls.RepeaterItem + + For Each repItem In rep.Items + + Dim recControl As PersonalDDTableControlRow = DirectCast(repItem.FindControl("PersonalDDTableControlRow"), PersonalDDTableControlRow) + recList.Add(recControl) + + Next + + Return DirectCast(recList.ToArray(GetType(PersonalDDTableControlRow)), PersonalDDTableControlRow()) + End Function + + Public Shadows ReadOnly Property Page() As BaseApplicationPage + Get + Return DirectCast(MyBase.Page, BaseApplicationPage) + End Get + End Property + +#End Region + + + +End Class + + +' Base class for the PersonalEducationTableControlRow control on the ShowPersonalId page. +' Do not modify this class. Instead override any method in PersonalEducationTableControlRow. +Public Class BasePersonalEducationTableControlRow + Inherits Persons.UI.BaseApplicationRecordControl + + ' To customize, override this method in PersonalEducationTableControlRow. + Protected Overridable Sub Control_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Init + + Me.ClearControlsFromSession() + End Sub + + ' To customize, override this method in PersonalEducationTableControlRow. + Protected Overridable Sub Control_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load + + 'Call LoadFocusScripts from repeater so that onfocus attribute could be added to elements + Me.Page.LoadFocusScripts(Me) + + + ' Register the event handlers. + + + End Sub + + + Public Overridable Sub LoadData() + + ' Load the data from the database into the DataSource PersonalEducation record. + ' It is better to make changes to functions called by LoadData such as + ' CreateWhereClause, rather than making changes here. + + ' The RecordUniqueId is set the first time a record is loaded, and is + ' used during a PostBack to load the record. + + If Me.RecordUniqueId IsNot Nothing AndAlso Me.RecordUniqueId.Trim <> "" Then + Me.DataSource = PersonalEducationTable.GetRecord(Me.RecordUniqueId, True) + + Return + End If + + ' Since this is a row in the table, the data for this row is loaded by the + ' LoadData method of the BasePersonalEducationTableControl when the data for the entire + ' table is loaded. + + Me.DataSource = New PersonalEducationRecord() + + + + End Sub + + ' Populate the UI controls using the DataSource. To customize, override this method in PersonalEducationTableControlRow. + Public Overrides Sub DataBind() + ' The DataBind method binds the user interface controls to the values + ' from the database record. To do this, it calls the Set methods for + ' each of the field displayed on the webpage. It is better to make + ' changes in the Set methods, rather than making changes here. + + MyBase.DataBind() + + ' Make sure that the DataSource is initialized. + If Me.DataSource Is Nothing Then + + Return + End If + + + 'LoadData for DataSource for chart and report if they exist + + + + ' Call the Set methods for each controls on the panel + + SetCommand() + SetCommandDate() + SetCOUNTRY() + SetCourse() + SetCourseAbbr() + SetCourseNo() + SetEducationPeriod() + SetEdYear() + SetEndDate1() + SetFacultry() + SetInstitue() + SetLevelId() + SetNoAll() + SetScore() + SetScoreNo() + SetStartDate1() + + + Me.IsNewRecord = True + + If Me.DataSource.IsCreated Then + Me.IsNewRecord = False + + Me.RecordUniqueId = Me.DataSource.GetID.ToXmlString() + End If + + ' Now load data for each record and table child UI controls. + ' Ordering is important because child controls get + ' their parent ids from their parent UI controls. + Dim shouldResetControl As Boolean = False + + End Sub + + + Public Overridable Sub SetCommand() + + + ' Set the Command Literal on the webpage with value from the + ' PersonalEducation database record. + + ' Me.DataSource is the PersonalEducation record retrieved from the database. + ' Me.Command is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetCommand() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.CommandSpecified Then + + ' If the Command is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalEducationTable.Command) + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.Command.Text = formattedValue + + Else + + ' Command is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.Command.Text = PersonalEducationTable.Command.Format(PersonalEducationTable.Command.DefaultValue) + + End If + + ' If the Command is NULL or blank, then use the value specified + ' on Properties. + If Me.Command.Text Is Nothing _ + OrElse Me.Command.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.Command.Text = " " + End If + + End Sub + + Public Overridable Sub SetCommandDate() + + + ' Set the CommandDate Literal on the webpage with value from the + ' PersonalEducation database record. + + ' Me.DataSource is the PersonalEducation record retrieved from the database. + ' Me.CommandDate is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetCommandDate() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.CommandDateSpecified Then + + ' If the CommandDate is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalEducationTable.CommandDate, "d MMM yy") + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.CommandDate.Text = formattedValue + + Else + + ' CommandDate is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.CommandDate.Text = PersonalEducationTable.CommandDate.Format(PersonalEducationTable.CommandDate.DefaultValue, "d MMM yy") + + End If + + ' If the CommandDate is NULL or blank, then use the value specified + ' on Properties. + If Me.CommandDate.Text Is Nothing _ + OrElse Me.CommandDate.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.CommandDate.Text = " " + End If + + End Sub + + Public Overridable Sub SetCOUNTRY() + + + ' Set the COUNTRY Literal on the webpage with value from the + ' PersonalEducation database record. + + ' Me.DataSource is the PersonalEducation record retrieved from the database. + ' Me.COUNTRY is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetCOUNTRY() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.COUNTRYSpecified Then + + ' If the COUNTRY is non-NULL, then format the value. + + ' The Format method will return the Display Foreign Key As (DFKA) value + Dim formattedValue As String = "" + Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalEducationTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalEducationTable.COUNTRY) + If _isExpandableNonCompositeForeignKey AndAlso PersonalEducationTable.COUNTRY.IsApplyDisplayAs Then + + formattedValue = PersonalEducationTable.GetDFKA(Me.DataSource.COUNTRY.ToString(),PersonalEducationTable.COUNTRY, Nothing) + + if (formattedValue Is Nothing) Then + formattedValue = Me.DataSource.Format(PersonalEducationTable.COUNTRY) + End If + Else + formattedValue = Me.DataSource.COUNTRY.ToString() + End If + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.COUNTRY.Text = formattedValue + + Else + + ' COUNTRY is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.COUNTRY.Text = PersonalEducationTable.COUNTRY.Format(PersonalEducationTable.COUNTRY.DefaultValue) + + End If + + ' If the COUNTRY is NULL or blank, then use the value specified + ' on Properties. + If Me.COUNTRY.Text Is Nothing _ + OrElse Me.COUNTRY.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.COUNTRY.Text = " " + End If + + End Sub + + Public Overridable Sub SetCourse() + + + ' Set the Course Literal on the webpage with value from the + ' PersonalEducation database record. + + ' Me.DataSource is the PersonalEducation record retrieved from the database. + ' Me.Course is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetCourse() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.CourseSpecified Then + + ' If the Course is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalEducationTable.Course) + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.Course.Text = formattedValue + + Else + + ' Course is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.Course.Text = PersonalEducationTable.Course.Format(PersonalEducationTable.Course.DefaultValue) + + End If + + ' If the Course is NULL or blank, then use the value specified + ' on Properties. + If Me.Course.Text Is Nothing _ + OrElse Me.Course.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.Course.Text = " " + End If + + End Sub + + Public Overridable Sub SetCourseAbbr() + + + ' Set the CourseAbbr Literal on the webpage with value from the + ' PersonalEducation database record. + + ' Me.DataSource is the PersonalEducation record retrieved from the database. + ' Me.CourseAbbr is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetCourseAbbr() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.CourseAbbrSpecified Then + + ' If the CourseAbbr is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalEducationTable.CourseAbbr) + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.CourseAbbr.Text = formattedValue + + Else + + ' CourseAbbr is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.CourseAbbr.Text = PersonalEducationTable.CourseAbbr.Format(PersonalEducationTable.CourseAbbr.DefaultValue) + + End If + + ' If the CourseAbbr is NULL or blank, then use the value specified + ' on Properties. + If Me.CourseAbbr.Text Is Nothing _ + OrElse Me.CourseAbbr.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.CourseAbbr.Text = " " + End If + + End Sub + + Public Overridable Sub SetCourseNo() + + + ' Set the CourseNo Literal on the webpage with value from the + ' PersonalEducation database record. + + ' Me.DataSource is the PersonalEducation record retrieved from the database. + ' Me.CourseNo is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetCourseNo() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.CourseNoSpecified Then + + ' If the CourseNo is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalEducationTable.CourseNo) + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.CourseNo.Text = formattedValue + + Else + + ' CourseNo is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.CourseNo.Text = PersonalEducationTable.CourseNo.Format(PersonalEducationTable.CourseNo.DefaultValue) + + End If + + ' If the CourseNo is NULL or blank, then use the value specified + ' on Properties. + If Me.CourseNo.Text Is Nothing _ + OrElse Me.CourseNo.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.CourseNo.Text = " " + End If + + End Sub + + Public Overridable Sub SetEducationPeriod() + + + ' Set the EducationPeriod Literal on the webpage with value from the + ' PersonalEducation database record. + + ' Me.DataSource is the PersonalEducation record retrieved from the database. + ' Me.EducationPeriod is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetEducationPeriod() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.EducationPeriodSpecified Then + + ' If the EducationPeriod is non-NULL, then format the value. + + ' The Format method will return the Display Foreign Key As (DFKA) value + Dim formattedValue As String = "" + Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalEducationTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalEducationTable.EducationPeriod) + If _isExpandableNonCompositeForeignKey AndAlso PersonalEducationTable.EducationPeriod.IsApplyDisplayAs Then + + formattedValue = PersonalEducationTable.GetDFKA(Me.DataSource.EducationPeriod.ToString(),PersonalEducationTable.EducationPeriod, Nothing) + + if (formattedValue Is Nothing) Then + formattedValue = Me.DataSource.Format(PersonalEducationTable.EducationPeriod) + End If + Else + formattedValue = Me.DataSource.EducationPeriod.ToString() + End If + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.EducationPeriod.Text = formattedValue + + Else + + ' EducationPeriod is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.EducationPeriod.Text = PersonalEducationTable.EducationPeriod.Format(PersonalEducationTable.EducationPeriod.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetEdYear() + + + ' Set the EdYear Literal on the webpage with value from the + ' PersonalEducation database record. + + ' Me.DataSource is the PersonalEducation record retrieved from the database. + ' Me.EdYear is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetEdYear() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.EdYearSpecified Then + + ' If the EdYear is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalEducationTable.EdYear) + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.EdYear.Text = formattedValue + + Else + + ' EdYear is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.EdYear.Text = PersonalEducationTable.EdYear.Format(PersonalEducationTable.EdYear.DefaultValue) + + End If + + ' If the EdYear is NULL or blank, then use the value specified + ' on Properties. + If Me.EdYear.Text Is Nothing _ + OrElse Me.EdYear.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.EdYear.Text = " " + End If + + End Sub + + Public Overridable Sub SetEndDate1() + + + ' Set the EndDate Literal on the webpage with value from the + ' PersonalEducation database record. + + ' Me.DataSource is the PersonalEducation record retrieved from the database. + ' Me.EndDate1 is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetEndDate1() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.EndDateSpecified Then + + ' If the EndDate is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalEducationTable.EndDate, "d MMM yy") + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.EndDate1.Text = formattedValue + + Else + + ' EndDate is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.EndDate1.Text = PersonalEducationTable.EndDate.Format(PersonalEducationTable.EndDate.DefaultValue, "d MMM yy") + + End If + + ' If the EndDate is NULL or blank, then use the value specified + ' on Properties. + If Me.EndDate1.Text Is Nothing _ + OrElse Me.EndDate1.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.EndDate1.Text = " " + End If + + End Sub + + Public Overridable Sub SetFacultry() + + + ' Set the Facultry Literal on the webpage with value from the + ' PersonalEducation database record. + + ' Me.DataSource is the PersonalEducation record retrieved from the database. + ' Me.Facultry is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetFacultry() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.FacultrySpecified Then + + ' If the Facultry is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalEducationTable.Facultry) + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.Facultry.Text = formattedValue + + Else + + ' Facultry is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.Facultry.Text = PersonalEducationTable.Facultry.Format(PersonalEducationTable.Facultry.DefaultValue) + + End If + + ' If the Facultry is NULL or blank, then use the value specified + ' on Properties. + If Me.Facultry.Text Is Nothing _ + OrElse Me.Facultry.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.Facultry.Text = " " + End If + + End Sub + + Public Overridable Sub SetInstitue() + + + ' Set the Institue Literal on the webpage with value from the + ' PersonalEducation database record. + + ' Me.DataSource is the PersonalEducation record retrieved from the database. + ' Me.Institue is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetInstitue() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.InstitueSpecified Then + + ' If the Institue is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalEducationTable.Institue) + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.Institue.Text = formattedValue + + Else + + ' Institue is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.Institue.Text = PersonalEducationTable.Institue.Format(PersonalEducationTable.Institue.DefaultValue) + + End If + + ' If the Institue is NULL or blank, then use the value specified + ' on Properties. + If Me.Institue.Text Is Nothing _ + OrElse Me.Institue.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.Institue.Text = " " + End If + + End Sub + + Public Overridable Sub SetLevelId() + + + ' Set the LevelId Literal on the webpage with value from the + ' PersonalEducation database record. + + ' Me.DataSource is the PersonalEducation record retrieved from the database. + ' Me.LevelId is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetLevelId() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.LevelIdSpecified Then + + ' If the LevelId is non-NULL, then format the value. + + ' The Format method will return the Display Foreign Key As (DFKA) value + Dim formattedValue As String = "" + Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalEducationTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalEducationTable.LevelId) + If _isExpandableNonCompositeForeignKey AndAlso PersonalEducationTable.LevelId.IsApplyDisplayAs Then + + formattedValue = PersonalEducationTable.GetDFKA(Me.DataSource.LevelId.ToString(),PersonalEducationTable.LevelId, Nothing) + + if (formattedValue Is Nothing) Then + formattedValue = Me.DataSource.Format(PersonalEducationTable.LevelId) + End If + Else + formattedValue = Me.DataSource.LevelId.ToString() + End If + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.LevelId.Text = formattedValue + + Else + + ' LevelId is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.LevelId.Text = PersonalEducationTable.LevelId.Format(PersonalEducationTable.LevelId.DefaultValue) + + End If + + ' If the LevelId is NULL or blank, then use the value specified + ' on Properties. + If Me.LevelId.Text Is Nothing _ + OrElse Me.LevelId.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.LevelId.Text = " " + End If + + End Sub + + Public Overridable Sub SetNoAll() + + + ' Set the NoAll Literal on the webpage with value from the + ' PersonalEducation database record. + + ' Me.DataSource is the PersonalEducation record retrieved from the database. + ' Me.NoAll is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetNoAll() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.NoAllSpecified Then + + ' If the NoAll is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalEducationTable.NoAll) + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.NoAll.Text = formattedValue + + Else + + ' NoAll is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.NoAll.Text = PersonalEducationTable.NoAll.Format(PersonalEducationTable.NoAll.DefaultValue) + + End If + + ' If the NoAll is NULL or blank, then use the value specified + ' on Properties. + If Me.NoAll.Text Is Nothing _ + OrElse Me.NoAll.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.NoAll.Text = " " + End If + + End Sub + + Public Overridable Sub SetScore() + + + ' Set the Score Literal on the webpage with value from the + ' PersonalEducation database record. + + ' Me.DataSource is the PersonalEducation record retrieved from the database. + ' Me.Score is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetScore() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.ScoreSpecified Then + + ' If the Score is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalEducationTable.Score) + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.Score.Text = formattedValue + + Else + + ' Score is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.Score.Text = PersonalEducationTable.Score.Format(PersonalEducationTable.Score.DefaultValue) + + End If + + ' If the Score is NULL or blank, then use the value specified + ' on Properties. + If Me.Score.Text Is Nothing _ + OrElse Me.Score.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.Score.Text = " " + End If + + End Sub + + Public Overridable Sub SetScoreNo() + + + ' Set the ScoreNo Literal on the webpage with value from the + ' PersonalEducation database record. + + ' Me.DataSource is the PersonalEducation record retrieved from the database. + ' Me.ScoreNo is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetScoreNo() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.ScoreNoSpecified Then + + ' If the ScoreNo is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalEducationTable.ScoreNo) + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.ScoreNo.Text = formattedValue + + Else + + ' ScoreNo is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.ScoreNo.Text = PersonalEducationTable.ScoreNo.Format(PersonalEducationTable.ScoreNo.DefaultValue) + + End If + + ' If the ScoreNo is NULL or blank, then use the value specified + ' on Properties. + If Me.ScoreNo.Text Is Nothing _ + OrElse Me.ScoreNo.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.ScoreNo.Text = " " + End If + + End Sub + + Public Overridable Sub SetStartDate1() + + + ' Set the StartDate Literal on the webpage with value from the + ' PersonalEducation database record. + + ' Me.DataSource is the PersonalEducation record retrieved from the database. + ' Me.StartDate1 is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetStartDate1() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.StartDateSpecified Then + + ' If the StartDate is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalEducationTable.StartDate, "d MMM yy") + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.StartDate1.Text = formattedValue + + Else + + ' StartDate is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.StartDate1.Text = PersonalEducationTable.StartDate.Format(PersonalEducationTable.StartDate.DefaultValue, "d MMM yy") + + End If + + ' If the StartDate is NULL or blank, then use the value specified + ' on Properties. + If Me.StartDate1.Text Is Nothing _ + OrElse Me.StartDate1.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.StartDate1.Text = " " + End If + + End Sub + + + Public EvaluateFormulaDelegate As BaseClasses.Data.DataSource.EvaluateFormulaDelegate = New BaseClasses.Data.DataSource.EvaluateFormulaDelegate(AddressOf Me.EvaluateFormula) + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean, ByVal e As FormulaEvaluator) As String + If e Is Nothing Then + e = New FormulaEvaluator() + End If + + e.Variables.Clear() + + + ' add variables for formula evaluation + If variables IsNot Nothing Then + Dim enumerator As System.Collections.Generic.IEnumerator(Of System.Collections.Generic.KeyValuePair(Of String, Object)) = variables.GetEnumerator() + While enumerator.MoveNext() + e.Variables.Add(enumerator.Current.Key, enumerator.Current.Value) + End While + End If + + If includeDS + + End IF + + + ' Other variables referred to in the formula are expected to be + ' properties of the DataSource. For example, referring to + ' UnitPrice as a variable will refer to DataSource.UnitPrice + If dataSourceForEvaluate Is Nothing Then + + e.DataSource = Me.DataSource + + Else + e.DataSource = dataSourceForEvaluate + End If + + ' Define the calling control. This is used to add other + ' related table and record controls as variables. + e.CallingControl = Me + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + + If Not String.IsNullOrEmpty(format) AndAlso (String.IsNullOrEmpty(formula) OrElse formula.IndexOf("Format(") < 0) Then + Return FormulaUtils.Format(resultObj, format) + Else + Return resultObj.ToString() + End If + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format,variables ,includeDS, Nothing) + End Function + + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object)) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format, variables ,True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, format, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal e as FormulaEvaluator) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, variables, True, e) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal includeDS as Boolean) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, includeDS, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, True, Nothing) + End Function + + + Public Overridable Sub RegisterPostback() + + + End Sub + + + + ' To customize, override this method in PersonalEducationTableControlRow. + Public Overridable Sub SaveData() + ' Saves the associated record in the database. + ' SaveData calls Validate and Get methods - so it may be more appropriate to + ' customize those methods. + + ' 1. Load the existing record from the database. Since we save the entire record, this ensures + ' that fields that are not displayed are also properly initialized. + Me.LoadData() + + Dim parentCtrl As PersonalIdRecordControl + + + parentCtrl = DirectCast(Me.Page.FindControlRecursively("PersonalIdRecordControl"), PersonalIdRecordControl) + + If (Not IsNothing(parentCtrl) AndAlso IsNothing(parentCtrl.DataSource)) + ' Load the record if it is not loaded yet. + parentCtrl.LoadData() + End If + If (IsNothing(parentCtrl) OrElse IsNothing(parentCtrl.DataSource)) + ' Get the error message from the application resource file. + Throw New Exception(Page.GetResourceValue("Err:NoParentRecId", "Persons")) + End If + + Me.DataSource.PersonalId = parentCtrl.DataSource.PersonalId + + ' 2. Perform any custom validation. + Me.Validate() + + + ' 3. Set the values in the record with data from UI controls. + ' This calls the Get() method for each of the user interface controls. + Me.GetUIData() + + ' 4. Save in the database. + ' We should not save the record if the data did not change. This + ' will save a database hit and avoid triggering any database triggers. + + If Me.DataSource.IsAnyValueChanged Then + ' Save record to database but do not commit yet. + ' Auto generated ids are available after saving for use by child (dependent) records. + Me.DataSource.Save() + + DirectCast(GetParentControlObject(Me, "PersonalEducationTableControl"), PersonalEducationTableControl).DataChanged = True + DirectCast(GetParentControlObject(Me, "PersonalEducationTableControl"), PersonalEducationTableControl).ResetData = True + End If + + + ' update session or cookie by formula + + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + ' For Master-Detail relationships, save data on the Detail table(s) + + End Sub + + ' To customize, override this method in PersonalEducationTableControlRow. + Public Overridable Sub GetUIData() + ' The GetUIData method retrieves the updated values from the user interface + ' controls into a database record in preparation for saving or updating. + ' To do this, it calls the Get methods for each of the field displayed on + ' the webpage. It is better to make changes in the Get methods, rather + ' than making changes here. + + ' Call the Get methods for each of the user interface controls. + + GetCommand() + GetCommandDate() + GetCOUNTRY() + GetCourse() + GetCourseAbbr() + GetCourseNo() + GetEducationPeriod() + GetEdYear() + GetEndDate1() + GetFacultry() + GetInstitue() + GetLevelId() + GetNoAll() + GetScore() + GetScoreNo() + GetStartDate1() + End Sub + + + Public Overridable Sub GetCommand() + + End Sub + + Public Overridable Sub GetCommandDate() + + End Sub + + Public Overridable Sub GetCOUNTRY() + + End Sub + + Public Overridable Sub GetCourse() + + End Sub + + Public Overridable Sub GetCourseAbbr() + + End Sub + + Public Overridable Sub GetCourseNo() + + End Sub + + Public Overridable Sub GetEducationPeriod() + + End Sub + + Public Overridable Sub GetEdYear() + + End Sub + + Public Overridable Sub GetEndDate1() + + End Sub + + Public Overridable Sub GetFacultry() + + End Sub + + Public Overridable Sub GetInstitue() + + End Sub + + Public Overridable Sub GetLevelId() + + End Sub + + Public Overridable Sub GetNoAll() + + End Sub + + Public Overridable Sub GetScore() + + End Sub + + Public Overridable Sub GetScoreNo() + + End Sub + + Public Overridable Sub GetStartDate1() + + End Sub + + + ' To customize, override this method in PersonalEducationTableControlRow. + + Public Overridable Function CreateWhereClause() As WhereClause + + Return Nothing + + End Function + + + + ' To customize, override this method in PersonalEducationTableControlRow. + Public Overridable Sub Validate() + ' Add custom validation for any control within this panel. + ' Example. If you have a State ASP:Textbox control + ' If Me.State.Text <> "CA" Then + ' Throw New Exception("State must be CA (California).") + ' End If + + ' The Validate method is common across all controls within + ' this panel so you can validate multiple fields, but report + ' one error message. + + + End Sub + + Public Overridable Sub Delete() + + If Me.IsNewRecord() Then + Return + End If + + Dim pkValue As KeyValue = KeyValue.XmlToKey(Me.RecordUniqueId) + PersonalEducationTable.DeleteRecord(pkValue) + + DirectCast(GetParentControlObject(Me, "PersonalEducationTableControl"), PersonalEducationTableControl).DataChanged = True + DirectCast(GetParentControlObject(Me, "PersonalEducationTableControl"), PersonalEducationTableControl).ResetData = True + End Sub + + Protected Overridable Sub Control_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.PreRender + ' PreRender event is raised just before page is being displayed. + Try + DbUtils.StartTransaction() + Me.RegisterPostback() + + If Not Me.Page.ErrorOnPage AndAlso (Me.Page.IsPageRefresh OrElse Me.DataChanged OrElse Me.ResetData) Then + + + ' Re-load the data and update the web page if necessary. + ' This is typically done during a postback (filter, search button, sort, pagination button). + ' In each of the other click handlers, simply set DataChanged to True to reload the data. + Me.LoadData() + Me.DataBind() + End If + + + Catch ex As Exception + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + Finally + DbUtils.EndTransaction() + End Try + End Sub + + + Protected Overrides Sub SaveControlsToSession() + MyBase.SaveControlsToSession() + + + 'Save pagination state to session. + + End Sub + + + + Protected Overrides Sub ClearControlsFromSession() + MyBase.ClearControlsFromSession() + + + + ' Clear pagination state from session. + + End Sub + + Protected Overrides Sub LoadViewState(ByVal savedState As Object) + MyBase.LoadViewState(savedState) + Dim isNewRecord As String = CType(ViewState("IsNewRecord"), String) + If Not isNewRecord Is Nothing AndAlso isNewRecord.Trim <> "" Then + Me.IsNewRecord = Boolean.Parse(isNewRecord) + End If + + Dim myCheckSum As String = CType(ViewState("CheckSum"), String) + If Not myCheckSum Is Nothing AndAlso myCheckSum.Trim <> "" Then + Me.CheckSum = myCheckSum + End If + + + ' Load view state for pagination control. + + End Sub + + Protected Overrides Function SaveViewState() As Object + ViewState("IsNewRecord") = Me.IsNewRecord.ToString() + ViewState("CheckSum") = Me.CheckSum + + + ' Load view state for pagination control. + + Return MyBase.SaveViewState() + End Function + + + + Private _PreviousUIData As New Hashtable + Public Overridable Property PreviousUIData() As Hashtable + Get + Return _PreviousUIData + End Get + Set(ByVal value As Hashtable) + _PreviousUIData = value + End Set + End Property + + Private _IsNewRecord As Boolean = True + Public Overridable Property IsNewRecord() As Boolean + Get + Return Me._IsNewRecord + End Get + Set(ByVal value As Boolean) + Me._IsNewRecord = value + End Set + End Property + + Private _DataChanged As Boolean = False + Public Overridable Property DataChanged() As Boolean + Get + Return Me._DataChanged + End Get + Set(ByVal Value As Boolean) + Me._DataChanged = Value + End Set + End Property + + Private _ResetData As Boolean = False + Public Overridable Property ResetData() As Boolean + Get + Return Me._ResetData + End Get + Set(ByVal Value As Boolean) + Me._ResetData = Value + End Set + End Property + + Public Property RecordUniqueId() As String + Get + Return CType(Me.ViewState("BasePersonalEducationTableControlRow_Rec"), String) + End Get + Set(ByVal value As String) + Me.ViewState("BasePersonalEducationTableControlRow_Rec") = value + End Set + End Property + + Private _DataSource As PersonalEducationRecord + Public Property DataSource() As PersonalEducationRecord + Get + Return Me._DataSource + End Get + + Set(ByVal value As PersonalEducationRecord) + + Me._DataSource = value + End Set + End Property + + + + Private _checkSum As String + Public Overridable Property CheckSum() As String + Get + Return Me._checkSum + End Get + Set(ByVal value As String) + Me._checkSum = value + End Set + End Property + + Private _TotalPages As Integer + Public Property TotalPages() As Integer + Get + Return Me._TotalPages + End Get + Set(ByVal value As Integer) + Me._TotalPages = value + End Set + End Property + + Private _PageIndex As Integer + Public Property PageIndex() As Integer + Get + ' Return the PageIndex + Return Me._PageIndex + End Get + Set(ByVal value As Integer) + Me._PageIndex = value + End Set + End Property + + Private _DisplayLastPage As Boolean + Public Property DisplayLastPage() As Boolean + Get + Return Me._DisplayLastPage + End Get + Set(ByVal value As Boolean) + Me._DisplayLastPage = value + End Set + End Property + + + +#Region "Helper Properties" + + Public ReadOnly Property Command() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Command"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property CommandDate() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "CommandDate"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property COUNTRY() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "COUNTRY"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property Course() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Course"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property CourseAbbr() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "CourseAbbr"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property CourseNo() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "CourseNo"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property EducationPeriod() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "EducationPeriod"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property EdYear() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "EdYear"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property EndDate1() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "EndDate1"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property Facultry() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Facultry"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property Institue() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Institue"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property LevelId() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "LevelId"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property NoAll() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "NoAll"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property Score() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Score"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property ScoreNo() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "ScoreNo"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property StartDate1() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "StartDate1"), System.Web.UI.WebControls.Literal) + End Get + End Property + +#End Region + +#Region "Helper Functions" + + Public Overrides Overloads Function ModifyRedirectUrl(ByVal url As String, ByVal arg As String, ByVal bEncrypt As Boolean) As String + Return Me.Page.EvaluateExpressions(url, arg, bEncrypt, Me) + End Function + + Public Overrides Overloads Function EvaluateExpressions(ByVal url As String, ByVal arg As String, ByVal bEncrypt As Boolean) As String + + Dim rec As PersonalEducationRecord = Nothing + + + Try + rec = Me.GetRecord() + Catch ex As Exception + ' Do nothing + End Try + + If rec Is Nothing AndAlso url.IndexOf("{") >= 0 Then + ' Localization. + + Throw New Exception(Page.GetResourceValue("Err:RecDataSrcNotInitialized", "Persons")) + + End If + Return EvaluateExpressions(url, arg, rec, bEncrypt) + End Function + + + Public Overridable Function GetRecord() As PersonalEducationRecord + If Not Me.DataSource Is Nothing Then + Return Me.DataSource + End If + + If Not Me.RecordUniqueId Is Nothing Then + + Return PersonalEducationTable.GetRecord(Me.RecordUniqueId, True) + + End If + + ' Localization. + + Return Nothing + + End Function + + Public Shadows ReadOnly Property Page() As BaseApplicationPage + Get + Return DirectCast(MyBase.Page, BaseApplicationPage) + End Get + End Property + +#End Region + +End Class + + + +' Base class for the PersonalEducationTableControl control on the ShowPersonalId page. +' Do not modify this class. Instead override any method in PersonalEducationTableControl. +Public Class BasePersonalEducationTableControl + Inherits Persons.UI.BaseApplicationTableControl + + + + Protected Overridable Sub Control_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Init + + + + ' Setup the filter and search events. + + + + ' Control Initializations. + ' Initialize the table's current sort order. + + If Me.InSession(Me, "Order_By") Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + Me.CurrentSortOrder.Add(PersonalEducationTable.EducationPeriod, OrderByItem.OrderDir.Asc) + + Me.CurrentSortOrder.Add(PersonalEducationTable.StartDate, OrderByItem.OrderDir.Asc) + + End If + + + + ' Setup default pagination settings. + + Me.PageSize = CInt(Me.GetFromSession(Me, "Page_Size", "10")) + Me.PageIndex = CInt(Me.GetFromSession(Me, "Page_Index", "0")) + + + + Me.ClearControlsFromSession() + End Sub + + Protected Overridable Sub Control_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load + + SaveControlsToSession_Ajax() + + ' Setup the pagination events. + + AddHandler Me.PersonalEducationPagination.FirstPage.Click, AddressOf PersonalEducationPagination_FirstPage_Click + + AddHandler Me.PersonalEducationPagination.LastPage.Click, AddressOf PersonalEducationPagination_LastPage_Click + + AddHandler Me.PersonalEducationPagination.NextPage.Click, AddressOf PersonalEducationPagination_NextPage_Click + + AddHandler Me.PersonalEducationPagination.PageSizeButton.Click, AddressOf PersonalEducationPagination_PageSizeButton_Click + + AddHandler Me.PersonalEducationPagination.PreviousPage.Click, AddressOf PersonalEducationPagination_PreviousPage_Click + + + ' Setup the sorting events. + + AddHandler Me.CommandDateLabel.Click, AddressOf CommandDateLabel_Click + + AddHandler Me.CommandLabel.Click, AddressOf CommandLabel_Click + + AddHandler Me.COUNTRYLabel1.Click, AddressOf COUNTRYLabel1_Click + + AddHandler Me.CourseAbbrLabel.Click, AddressOf CourseAbbrLabel_Click + + AddHandler Me.CourseLabel.Click, AddressOf CourseLabel_Click + + AddHandler Me.CourseNoLabel.Click, AddressOf CourseNoLabel_Click + + AddHandler Me.EducationPeriodLabel.Click, AddressOf EducationPeriodLabel_Click + + AddHandler Me.EdYearLabel.Click, AddressOf EdYearLabel_Click + + AddHandler Me.EndDateLabel2.Click, AddressOf EndDateLabel2_Click + + AddHandler Me.FacultryLabel.Click, AddressOf FacultryLabel_Click + + AddHandler Me.InstitueLabel.Click, AddressOf InstitueLabel_Click + + AddHandler Me.LevelIdLabel1.Click, AddressOf LevelIdLabel1_Click + + AddHandler Me.NoAllLabel.Click, AddressOf NoAllLabel_Click + + AddHandler Me.ScoreLabel.Click, AddressOf ScoreLabel_Click + + AddHandler Me.ScoreNoLabel.Click, AddressOf ScoreNoLabel_Click + + AddHandler Me.StartDateLabel2.Click, AddressOf StartDateLabel2_Click + + ' Setup the button events. + + AddHandler Me.PersonalEducationExportCSVButton.Click, AddressOf PersonalEducationExportCSVButton_Click + + AddHandler Me.PersonalEducationExportExcelButton.Click, AddressOf PersonalEducationExportExcelButton_Click + + Me.PersonalEducationImportButton.PostBackUrl = "../Shared/SelectFileToImport.aspx?TableName=PersonalEducation" + Me.PersonalEducationImportButton.Attributes.Item("onClick") = "window.open('" & Me.Page.EncryptUrlParameter(Me.PersonalEducationImportButton.PostBackUrl) & "','importWindow', 'width=700, height=500,top=' +(screen.availHeight-500)/2 + ',left=' + (screen.availWidth-700)/2+ ', resizable=yes, scrollbars=yes,modal=yes'); return false;" + + AddHandler Me.PersonalEducationImportButton.Click, AddressOf PersonalEducationImportButton_Click + + AddHandler Me.PersonalEducationPDFButton.Click, AddressOf PersonalEducationPDFButton_Click + + AddHandler Me.PersonalEducationRefreshButton.Click, AddressOf PersonalEducationRefreshButton_Click + + AddHandler Me.PersonalEducationResetButton.Click, AddressOf PersonalEducationResetButton_Click + + AddHandler Me.PersonalEducationWordButton.Click, AddressOf PersonalEducationWordButton_Click + + + ' Setup events for others + + End Sub + + + Public Overridable Sub LoadData() + + ' Read data from database. Returns an array of records that can be assigned + ' to the DataSource table control property. + Try + Dim joinFilter As CompoundFilter = CreateCompoundJoinFilter() + + ' The WHERE clause will be empty when displaying all records in table. + Dim wc As WhereClause = CreateWhereClause() + If wc IsNot Nothing AndAlso Not wc.RunQuery Then + ' Initialize an empty array of records + Dim alist As New ArrayList(0) + Me.DataSource = DirectCast(alist.ToArray(GetType(PersonalEducationRecord)), PersonalEducationRecord()) + ' Add records to the list if needed. + Me.AddNewRecords() + Me._TotalRecords = 0 + Me._TotalPages = 0 + Return + End If + + ' Call OrderBy to determine the order - either use the order defined + ' on the Query Wizard, or specified by user (by clicking on column heading) + Dim orderBy As OrderBy = CreateOrderBy() + + ' Get the pagesize from the pagesize control. + Me.GetPageSize() + + If Me.DisplayLastPage Then + Dim totalRecords As Integer = If(Me._TotalRecords < 0, PersonalEducationTable.GetRecordCount(CreateCompoundJoinFilter(), CreateWhereClause()), Me._TotalRecords) + + Dim totalPages As Integer = CInt(Math.Ceiling(totalRecords / Me.PageSize)) + + Me.PageIndex = totalPages - 1 + End If + + ' Make sure PageIndex (current page) and PageSize are within bounds. + If Me.PageIndex < 0 Then + Me.PageIndex = 0 + End If + If Me.PageSize < 1 Then + Me.PageSize = 1 + End If + + ' Retrieve the records and set the table DataSource. + ' Only PageSize records are fetched starting at PageIndex (zero based). + If Me.AddNewRecord > 0 Then + ' Make sure to preserve the previously entered data on new rows. + Dim postdata As New ArrayList + For Each rc As PersonalEducationTableControlRow In Me.GetRecordControls() + If Not rc.IsNewRecord Then + rc.DataSource = rc.GetRecord() + rc.GetUIData() + postdata.Add(rc.DataSource) + UIData.Add(rc.PreservedUIData()) + End If + Next + Me.DataSource = DirectCast(postdata.ToArray(GetType(PersonalEducationRecord)), PersonalEducationRecord()) + Else ' Get the records from the database + Me.DataSource = PersonalEducationTable.GetRecords(joinFilter, wc, orderBy, Me.PageIndex, Me.PageSize) + + End If + + ' if the datasource contains no records contained in database, then load the last page. + If (DbUtils.GetCreatedRecords(Me.DataSource).Length = 0 AndAlso Not Me.DisplayLastPage) Then + Me.DisplayLastPage = True + LoadData() + Else + + ' Add any new rows desired by the user. + Me.AddNewRecords() + + + ' Initialize the page and grand totals. now + + End If + + Catch ex As Exception + ' Report the error message to the end user + Dim msg As String = ex.Message + If ex.InnerException IsNot Nothing Then + msg = msg & " InnerException: " & ex.InnerException.Message + End If + Throw New Exception(msg, ex.InnerException) + End Try + End Sub + + + + + Public Overrides Sub DataBind() + ' The DataBind method binds the user interface controls to the values + ' from the database record for each row in the table. To do this, it calls the + ' DataBind for each of the rows. + ' DataBind also populates any filters above the table, and sets the pagination + ' control to the correct number of records and the current page number. + + MyBase.DataBind() + + ' Make sure that the DataSource is initialized. + If Me.DataSource Is Nothing Then + Return + End If + + 'LoadData for DataSource for chart and report if they exist + + ' Improve performance by prefetching display as records. + Me.PreFetchForeignKeyValues() + + ' Setup the pagination controls. + BindPaginationControls() + + + + ' Bind the repeater with the list of records to expand the UI. + Dim rep As System.Web.UI.WebControls.Repeater = CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalEducationTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return + rep.DataSource = DataSource() + rep.DataBind() + + Dim index As Integer = 0 + For Each repItem As System.Web.UI.WebControls.RepeaterItem In rep.Items + ' Loop through all rows in the table, set its DataSource and call DataBind(). + Dim recControl As PersonalEducationTableControlRow = DirectCast(repItem.FindControl("PersonalEducationTableControlRow"), PersonalEducationTableControlRow) + recControl.DataSource = Me.DataSource(index) + If Me.UIData.Count > index Then + recControl.PreviousUIData = Me.UIData(index) + End If + recControl.DataBind() + recControl.Visible = Not Me.InDeletedRecordIds(recControl) + + index += 1 + Next + + + + + ' Call the Set methods for each controls on the panel + + SetCommandDateLabel() + SetCommandLabel() + SetCOUNTRYLabel1() + SetCourseAbbrLabel() + SetCourseLabel() + SetCourseNoLabel() + SetEducationPeriodLabel() + SetEdYearLabel() + SetEndDateLabel2() + SetFacultryLabel() + SetInstitueLabel() + SetLevelIdLabel1() + SetNoAllLabel() + + + + + + + + SetPersonalEducationTableControlCollapsibleRegion() + + SetScoreLabel() + SetScoreNoLabel() + SetStartDateLabel2() + ' setting the state of expand or collapse alternative rows + + + ' Load data for each record and table UI control. + ' Ordering is important because child controls get + ' their parent ids from their parent UI controls. + + + ' this method calls the set method for controls with special formula like running total, sum, rank, etc + SetFormulaControls() + End Sub + + Public Overridable Sub SetFormulaControls() + ' this method calls Set methods for the control that has special formula + + + + End Sub + + + Public Sub PreFetchForeignKeyValues() + If (IsNothing(Me.DataSource)) + Return + End If + + Me.Page.PregetDfkaRecords(PersonalEducationTable.COUNTRY, Me.DataSource) + + Me.Page.PregetDfkaRecords(PersonalEducationTable.EducationPeriod, Me.DataSource) + + Me.Page.PregetDfkaRecords(PersonalEducationTable.LevelId, Me.DataSource) + + End Sub + + + Public Overridable Sub RegisterPostback() + + Me.Page.RegisterPostBackTrigger(MiscUtils.FindControlRecursively(Me,"PersonalEducationExportCSVButton")) + + Me.Page.RegisterPostBackTrigger(MiscUtils.FindControlRecursively(Me,"PersonalEducationExportExcelButton")) + + Me.Page.RegisterPostBackTrigger(MiscUtils.FindControlRecursively(Me,"PersonalEducationPDFButton")) + + Me.Page.RegisterPostBackTrigger(MiscUtils.FindControlRecursively(Me,"PersonalEducationWordButton")) + + + End Sub + + Public EvaluateFormulaDelegate As BaseClasses.Data.DataSource.EvaluateFormulaDelegate = New BaseClasses.Data.DataSource.EvaluateFormulaDelegate(AddressOf Me.EvaluateFormula) + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean, ByVal e as FormulaEvaluator) As String + If e Is Nothing + e = New FormulaEvaluator() + End If + + e.Variables.Clear() + + + ' add variables for formula evaluation + If variables IsNot Nothing Then + Dim enumerator As System.Collections.Generic.IEnumerator(Of System.Collections.Generic.KeyValuePair(Of String, Object)) = variables.GetEnumerator() + While enumerator.MoveNext() + e.Variables.Add(enumerator.Current.Key, enumerator.Current.Value) + End While + End If + + If includeDS + + End If + + ' All variables referred to in the formula are expected to be + ' properties of the DataSource. For example, referring to + ' UnitPrice as a variable will refer to DataSource.UnitPrice + e.DataSource = dataSourceForEvaluate + + ' Define the calling control. This is used to add other + ' related table and record controls as variables. + e.CallingControl = Me + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + + If Not String.IsNullOrEmpty(format) AndAlso (String.IsNullOrEmpty(formula) OrElse formula.IndexOf("Format(") < 0) Then + Return FormulaUtils.Format(resultObj, format) + Else + Return resultObj.ToString() + End If + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format,variables ,includeDS, Nothing) + End Function + + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object)) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format, variables ,True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, format, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal e as FormulaEvaluator) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, variables, True, e) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal includeDS as Boolean) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, includeDS, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, True, Nothing) + End Function + + + + + Public Overridable Sub ResetControl() + + Me.CurrentSortOrder.Reset() + If (Me.InSession(Me, "Order_By")) Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + Me.CurrentSortOrder.Add(PersonalEducationTable.EducationPeriod, OrderByItem.OrderDir.Asc) + + Me.CurrentSortOrder.Add(PersonalEducationTable.StartDate, OrderByItem.OrderDir.Asc) + + End If + + Me.PageIndex = 0 + End Sub + + Protected Overridable Sub BindPaginationControls() + ' Setup the pagination controls. + + ' Bind the pagination labels. + + If DbUtils.GetCreatedRecords(Me.DataSource).Length > 0 Then + + Me.PersonalEducationPagination.CurrentPage.Text = (Me.PageIndex + 1).ToString() + Else + Me.PersonalEducationPagination.CurrentPage.Text = "0" + End If + Me.PersonalEducationPagination.PageSize.Text = Me.PageSize.ToString() + Me.PersonalEducationPagination.TotalItems.Text = Me.TotalRecords.ToString() + Me.PersonalEducationPagination.TotalPages.Text = Me.TotalPages.ToString() + + ' Bind the buttons for PersonalEducationTableControl pagination. + + Me.PersonalEducationPagination.FirstPage.Enabled = Not (Me.PageIndex = 0) + If Me._TotalPages < 0 Then ' if the total pages is not determined yet, enable last and next buttons + Me.PersonalEducationPagination.LastPage.Enabled = True + ElseIf Me._TotalPages = 0 ' if the total pages is determined and it is 0, enable last and next buttons + Me.PersonalEducationPagination.LastPage.Enabled = False + Else ' if the total pages is the last page, disable last and next buttons + Me.PersonalEducationPagination.LastPage.Enabled = Not (Me.PageIndex = Me.TotalPages - 1) + End If + + If Me._TotalPages < 0 Then ' if the total pages is not determined yet, enable last and next buttons + Me.PersonalEducationPagination.NextPage.Enabled = True + ElseIf Me._TotalPages = 0 ' if the total pages is determined and it is 0, enable last and next buttons + Me.PersonalEducationPagination.NextPage.Enabled = False + Else ' if the total pages is the last page, disable last and next buttons + Me.PersonalEducationPagination.NextPage.Enabled = Not (Me.PageIndex = Me.TotalPages - 1) + End If + + Me.PersonalEducationPagination.PreviousPage.Enabled = Not (Me.PageIndex = 0) + + + End Sub + + Public Overridable Sub SaveData() + ' Save the data from the entire table. Calls each row's Save Data + ' to save their data. This function is called by the Click handler of the + ' Save button. The button handler should Start/Commit/End a transaction. + + Dim recCtl As PersonalEducationTableControlRow + For Each recCtl In Me.GetRecordControls() + + If Me.InDeletedRecordIds(recCtl) Then + ' Delete any pending deletes. + recCtl.Delete() + Else + If recCtl.Visible Then + recCtl.SaveData() + End If + End If + + Next + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + ' Set IsNewRecord to False for all records - since everything has been saved and is no longer "new" + For Each recCtl In Me.GetRecordControls() + recCtl.IsNewRecord = False + Next + + + ' Set DeletedRecordsIds to Nothing since we have deleted all pending deletes. + Me.DeletedRecordIds = Nothing + + End Sub + + Public Overridable Function CreateCompoundJoinFilter() As CompoundFilter + Dim jFilter As CompoundFilter = New CompoundFilter() + + Return jFilter + + End Function + + + Public Overridable Function CreateOrderBy() As OrderBy + ' The CurrentSortOrder is initialized to the sort order on the + ' Query Wizard. It may be modified by the Click handler for any of + ' the column heading to sort or reverse sort by that column. + ' You can add your own sort order, or modify it on the Query Wizard. + Return Me.CurrentSortOrder + End Function + + Public Overridable Function CreateWhereClause() As WhereClause + 'This CreateWhereClause is used for loading the data. + PersonalEducationTable.Instance.InnerFilter = Nothing + Dim wc As WhereClause = New WhereClause() + + ' Compose the WHERE clause consiting of: + ' 1. Static clause defined at design time. + ' 2. User selected search criteria. + ' 3. User selected filter criteria. + + + Dim selectedRecordKeyValue as KeyValue = New KeyValue() + + Dim personalIdRecordControlObj As Persons.UI.Controls.ShowPersonalId.PersonalIdRecordControl = DirectCast(MiscUtils.FindControlRecursively(Me.Page, "PersonalIdRecordControl"), Persons.UI.Controls.ShowPersonalId.PersonalIdRecordControl) + + If (Not IsNothing(personalIdRecordControlObj) AndAlso Not IsNothing(personalIdRecordControlObj.GetRecord()) AndAlso personalIdRecordControlObj.GetRecord().IsCreated AndAlso Not IsNothing(personalIdRecordControlObj.GetRecord().PersonalId)) + wc.iAND(PersonalEducationTable.PersonalId, BaseFilter.ComparisonOperator.EqualsTo, personalIdRecordControlObj.GetRecord().PersonalId.ToString()) + selectedRecordKeyValue.AddElement(PersonalEducationTable.PersonalId.InternalName, personalIdRecordControlObj.GetRecord().PersonalId.ToString()) + Else + wc.RunQuery = False + Return wc + End If + + HttpContext.Current.Session("PersonalEducationTableControlWhereClause") = selectedRecordKeyValue.ToXmlString() + + Return wc + End Function + + + Public Overridable Function CreateWhereClause(ByVal searchText as String, ByVal fromSearchControl as String, ByVal AutoTypeAheadSearch as String, ByVal AutoTypeAheadWordSeparators as String) As WhereClause + ' This CreateWhereClause is used for loading list of suggestions for Auto Type-Ahead feature. + PersonalEducationTable.Instance.InnerFilter = Nothing + Dim wc As WhereClause = New WhereClause() + + ' Compose the WHERE clause consiting of: + ' 1. Static clause defined at design time. + ' 2. User selected search criteria. + ' 3. User selected filter criteria. + + Dim appRelativeVirtualPath As String = CType(HttpContext.Current.Session("AppRelativeVirtualPath"), String) + + Dim selectedRecordInPersonalIdRecordControl as String = DirectCast(HttpContext.Current.Session("PersonalEducationTableControlWhereClause"), String) + + If Not selectedRecordInPersonalIdRecordControl Is Nothing AndAlso KeyValue.IsXmlKey(selectedRecordInPersonalIdRecordControl) Then + Dim selectedRecordKeyValue as KeyValue = KeyValue.XmlToKey(selectedRecordInPersonalIdRecordControl) + + If Not IsNothing(selectedRecordKeyValue) AndAlso selectedRecordKeyValue.ContainsColumn(PersonalEducationTable.PersonalId) Then + wc.iAND(PersonalEducationTable.PersonalId, BaseFilter.ComparisonOperator.EqualsTo, selectedRecordKeyValue.GetColumnValue(PersonalEducationTable.PersonalId).ToString()) + End If + + End If + + ' Adds clauses if values are selected in Filter controls which are configured in the page. + + + Return wc + End Function + + + Public Overridable Function FormatSuggestions(ByVal prefixText As String, ByVal resultItem As String, _ + ByVal columnLength As Integer, ByVal AutoTypeAheadDisplayFoundText As String, _ + ByVal autoTypeAheadSearch As String, ByVal AutoTypeAheadWordSeparators As String, _ + ByVal resultList As ArrayList) As Boolean + + 'Formats the resultItem and adds it to the list of suggestions. + Dim index As Integer = resultItem.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture).IndexOf(prefixText.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture)) + Dim itemToAdd As String = "" + Dim isFound As Boolean = False + Dim isAdded As Boolean = False + ' Get the index where prfixt is at the beginning of resultItem. If not found then, index of word which begins with prefixText. + If InvariantLCase(autoTypeAheadSearch).equals("wordsstartingwithsearchstring") And Not index = 0 Then + ' Expression to find word which contains AutoTypeAheadWordSeparators followed by prefixText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex( AutoTypeAheadWordSeparators + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + If regex1.IsMatch(resultItem) Then + index = regex1.Match(resultItem).Index + isFound = True + End If + ' If the prefixText is found immediatly after white space then starting of the word is found so don not search any further + If not resultItem(index).ToString() = " " Then + ' Expression to find beginning of the word which contains AutoTypeAheadWordSeparators followed by prefixText + Dim regex As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\\S*" + AutoTypeAheadWordSeparators + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + If regex.IsMatch(resultItem) Then + index = regex.Match(resultItem).Index + isFound = True + End If + End If + End If + + ' If autoTypeAheadSearch value is wordsstartingwithsearchstring then, extract the substring only if the prefixText is found at the + ' beginning of the resultItem (index = 0) or a word in resultItem is found starts with prefixText. + If index = 0 Or isFound Or InvariantLCase(autoTypeAheadSearch).Equals("anywhereinstring") then + If InvariantLCase(AutoTypeAheadDisplayFoundText).equals("atbeginningofmatchedstring") Then + ' Expression to find beginning of the word which contains prefixText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\\S*" + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + ' Find the beginning of the word which contains prefexText + If (StringUtils.InvariantLCase(autoTypeAheadSearch).Equals("anywhereinstring") AndAlso regex1.IsMatch(resultItem)) Then + index = regex1.Match(resultItem).Index + isFound = True + End If + ' Display string from the index till end of the string if sub string from index till end is less than columnLength value. + If Len(resultItem) - index <= columnLength Then + If index = 0 Then + itemToAdd = resultItem + Else + itemToAdd = "..." & resultItem.Substring(index, Len(resultItem) - index) + End If + Else + If index = 0 Then + itemToAdd = resultItem.Substring(index, (columnLength - 3)) & "..." + Else + 'Truncate the string to show only columnLength - 6 characters as begining and trailing "..." has to be appended. + itemToAdd = "..." & resultItem.Substring(index , columnLength - 6) & "..." + End If + End If + ElseIf InvariantLCase(AutoTypeAheadDisplayFoundText).equals("inmiddleofmatchedstring") Then + Dim subStringBeginIndex As Integer = CType(columnLength/2, Integer) + If Len(resultItem) <= columnLength Then + itemToAdd = resultItem + Else + ' Sanity check at end of the string + If index + Len(prefixText) = columnLength Then + itemToAdd = "..." & resultItem.Substring(index-columnLength,index) + ElseIf Len(resultItem) - index < subStringBeginIndex Then + ' Display string from the end till columnLength value if, index is closer to the end of the string. + itemToAdd = "..." & resultItem.Substring(Len(resultItem)-columnLength,Len(resultItem)) + ElseIf index <= subStringBeginIndex Then + ' Sanity chet at beginning of the string + itemToAdd = resultItem.Substring(0, columnLength) & "..." + Else + ' Display string containing text before the prefixText occures and text after the prefixText + itemToAdd = "..." & resultItem.Substring(index - subStringBeginIndex, columnLength) & "..." + End If + End If + ElseIf InvariantLCase(AutoTypeAheadDisplayFoundText).equals("atendofmatchedstring") Then + ' Expression to find ending of the word which contains prefexText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\s", System.Text.RegularExpressions.RegexOptions.IgnoreCase) + ' Find the ending of the word which contains prefexText + If regex1.IsMatch(resultItem, index + 1) Then + index = regex1.Match(resultItem, index + 1).Index + Else + ' If the word which contains prefexText is the last word in string, regex1.IsMatch returns false. + index = resultItem.Length + End If + If index > Len(resultItem) Then + index = Len(resultItem) + End If + ' If text from beginning of the string till index is less than columnLength value then, display string from the beginning till index. + If index <= columnLength Then + if index = Len(resultItem) Then 'Make decision to append "..." + itemToAdd = resultItem.Substring(0,index) + Else + itemToAdd = resultItem.Substring(0,index) & "..." + End If + Else + If index = Len(resultItem) Then + itemToAdd = "..." & resultItem.Substring(index - (columnLength - 3), (columnLength - 3)) + Else + 'Truncate the string to show only columnLength - 6 characters as begining and trailing "..." has to be appended. + itemToAdd = "..." & resultItem.Substring(index - (columnLength - 6), columnLength - 6) & "..." + End If + End If + End If + + ' Remove newline character from itemToAdd + Dim prefixTextIndex As Integer = itemToAdd.IndexOf(prefixText, StringComparison.CurrentCultureIgnoreCase) + ' If itemToAdd contains any newline after the search text then show text only till newline + Dim regex2 As System.Text.RegularExpressions.Regex = New System.Text.RegularExpressions.Regex("(" & vbCrLf & "|" & vbLf & ")", System.Text.RegularExpressions.RegexOptions.IgnoreCase) + Dim newLineIndexAfterPrefix As Integer = -1 + If regex2.IsMatch(itemToAdd, prefixTextIndex) Then + newLineIndexAfterPrefix = regex2.Match(itemToAdd, prefixTextIndex).Index + End If + If (newLineIndexAfterPrefix > -1) Then + If itemToAdd.EndsWith("...") Then + itemToAdd = (itemToAdd.Substring(0, newLineIndexAfterPrefix) + "...") + Else + itemToAdd = itemToAdd.Substring(0, newLineIndexAfterPrefix) + End If + End If + ' If itemToAdd contains any newline before search text then show text which comes after newline + Dim regex3 As System.Text.RegularExpressions.Regex = New System.Text.RegularExpressions.Regex("(" & vbCrLf & "|" & vbLf & ")", (System.Text.RegularExpressions.RegexOptions.IgnoreCase Or System.Text.RegularExpressions.RegexOptions.RightToLeft)) + Dim newLineIndexBeforePrefix As Integer = -1 + If regex3.IsMatch(itemToAdd, prefixTextIndex) Then + newLineIndexBeforePrefix = regex3.Match(itemToAdd, prefixTextIndex).Index + End If + If (newLineIndexBeforePrefix > -1) Then + If itemToAdd.StartsWith("...") Then + itemToAdd = ("..." + itemToAdd.Substring((newLineIndexBeforePrefix + regex3.Match(itemToAdd, prefixTextIndex).Length))) + Else + itemToAdd = itemToAdd.Substring((newLineIndexBeforePrefix + regex3.Match(itemToAdd, prefixTextIndex).Length)) + End If + End If + + If Not itemToAdd is nothing AndAlso Not resultList.Contains(itemToAdd) Then + + resultList.Add(itemToAdd) + + isAdded = true + End If + End If + Return isAdded + End Function + + + Protected Overridable Sub GetPageSize() + + If Me.PersonalEducationPagination.PageSize.Text.Trim <> "" Then + Try + 'Me.PageSize = Integer.Parse(Me.PersonalEducationPagination.PageSize.Text) + Catch ex As Exception + End Try + End If + End Sub + + Protected Overridable Sub AddNewRecords() + + Dim newRecordList As ArrayList = New ArrayList() + + Dim newUIDataList As System.Collections.Generic.List(Of Hashtable) = New System.Collections.Generic.List(Of Hashtable)() + + ' Loop though all the record controls and if the record control + ' does not have a unique record id set, then create a record + ' and add to the list. + If Not Me.ResetData Then + Dim rep As System.Web.UI.WebControls.Repeater = CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalEducationTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return + + Dim repItem As System.Web.UI.WebControls.RepeaterItem + For Each repItem In rep.Items + ' Loop through all rows in the table, set its DataSource and call DataBind(). + + Dim recControl As PersonalEducationTableControlRow = DirectCast(repItem.FindControl("PersonalEducationTableControlRow"), PersonalEducationTableControlRow) + + If recControl.Visible AndAlso recControl.IsNewRecord() Then + + Dim rec As PersonalEducationRecord = New PersonalEducationRecord() + + If recControl.Command.Text <> "" Then + rec.Parse(recControl.Command.Text, PersonalEducationTable.Command) + End If + If recControl.CommandDate.Text <> "" Then + rec.Parse(recControl.CommandDate.Text, PersonalEducationTable.CommandDate) + End If + If recControl.COUNTRY.Text <> "" Then + rec.Parse(recControl.COUNTRY.Text, PersonalEducationTable.COUNTRY) + End If + If recControl.Course.Text <> "" Then + rec.Parse(recControl.Course.Text, PersonalEducationTable.Course) + End If + If recControl.CourseAbbr.Text <> "" Then + rec.Parse(recControl.CourseAbbr.Text, PersonalEducationTable.CourseAbbr) + End If + If recControl.CourseNo.Text <> "" Then + rec.Parse(recControl.CourseNo.Text, PersonalEducationTable.CourseNo) + End If + If recControl.EducationPeriod.Text <> "" Then + rec.Parse(recControl.EducationPeriod.Text, PersonalEducationTable.EducationPeriod) + End If + If recControl.EdYear.Text <> "" Then + rec.Parse(recControl.EdYear.Text, PersonalEducationTable.EdYear) + End If + If recControl.EndDate1.Text <> "" Then + rec.Parse(recControl.EndDate1.Text, PersonalEducationTable.EndDate) + End If + If recControl.Facultry.Text <> "" Then + rec.Parse(recControl.Facultry.Text, PersonalEducationTable.Facultry) + End If + If recControl.Institue.Text <> "" Then + rec.Parse(recControl.Institue.Text, PersonalEducationTable.Institue) + End If + If recControl.LevelId.Text <> "" Then + rec.Parse(recControl.LevelId.Text, PersonalEducationTable.LevelId) + End If + If recControl.NoAll.Text <> "" Then + rec.Parse(recControl.NoAll.Text, PersonalEducationTable.NoAll) + End If + If recControl.Score.Text <> "" Then + rec.Parse(recControl.Score.Text, PersonalEducationTable.Score) + End If + If recControl.ScoreNo.Text <> "" Then + rec.Parse(recControl.ScoreNo.Text, PersonalEducationTable.ScoreNo) + End If + If recControl.StartDate1.Text <> "" Then + rec.Parse(recControl.StartDate1.Text, PersonalEducationTable.StartDate) + End If + newUIDataList.Add(recControl.PreservedUIData()) + newRecordList.Add(rec) + End If + Next + End If + + + ' Add any new record to the list. + Dim index As Integer = 0 + For index = 1 To Me.AddNewRecord + + newRecordList.Insert(0, New PersonalEducationRecord()) + newUIDataList.Insert(0, New Hashtable()) + + Next + Me.AddNewRecord = 0 + + ' Finally, add any new records to the DataSource. + If newRecordList.Count > 0 Then + + Dim finalList As ArrayList = New ArrayList(Me.DataSource) + finalList.InsertRange(0, newRecordList) + + Me.DataSource = DirectCast(finalList.ToArray(GetType(PersonalEducationRecord)), PersonalEducationRecord()) + + End If + + ' Add the existing UI data to this hash table + If newUIDataList.Count > 0 Then + Me.UIData.InsertRange(0, newUIDataList) + End If + + End Sub + + + Public Sub AddToDeletedRecordIds(ByVal rec As PersonalEducationTableControlRow) + If rec.IsNewRecord() Then + Return + End If + + If Not Me.DeletedRecordIds Is Nothing AndAlso Me.DeletedRecordIds.Trim <> "" Then + Me.DeletedRecordIds &= "," + End If + + Me.DeletedRecordIds &= "[" & rec.RecordUniqueId & "]" + End Sub + + Protected Overridable Function InDeletedRecordIds(ByVal rec As PersonalEducationTableControlRow) As Boolean + If Me.DeletedRecordIds Is Nothing OrElse Me.DeletedRecordIds.Trim = "" Then + Return False + End If + + Return Me.DeletedRecordIds.IndexOf("[" & rec.RecordUniqueId & "]") >= 0 + End Function + + Private _DeletedRecordIds As String + Public Property DeletedRecordIds() As String + Get + Return Me._DeletedRecordIds + End Get + Set(ByVal value As String) + Me._DeletedRecordIds = value + End Set + End Property + + + ' Create Set, WhereClause, and Populate Methods + + Public Overridable Sub SetCommandDateLabel() + + End Sub + + Public Overridable Sub SetCommandLabel() + + End Sub + + Public Overridable Sub SetCOUNTRYLabel1() + + End Sub + + Public Overridable Sub SetCourseAbbrLabel() + + End Sub + + Public Overridable Sub SetCourseLabel() + + End Sub + + Public Overridable Sub SetCourseNoLabel() + + End Sub + + Public Overridable Sub SetEducationPeriodLabel() + + End Sub + + Public Overridable Sub SetEdYearLabel() + + End Sub + + Public Overridable Sub SetEndDateLabel2() + + End Sub + + Public Overridable Sub SetFacultryLabel() + + End Sub + + Public Overridable Sub SetInstitueLabel() + + End Sub + + Public Overridable Sub SetLevelIdLabel1() + + End Sub + + Public Overridable Sub SetNoAllLabel() + + End Sub + + Public Overridable Sub SetPersonalEducationTableControlCollapsibleRegion() + + End Sub + + Public Overridable Sub SetScoreLabel() + + End Sub + + Public Overridable Sub SetScoreNoLabel() + + End Sub + + Public Overridable Sub SetStartDateLabel2() + + End Sub + + + + + Protected Overridable Sub Control_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.PreRender + ' PreRender event is raised just before page is being displayed. + Try + DbUtils.StartTransaction + Me.RegisterPostback() + + If Not Me.Page.ErrorOnPage AndAlso (Me.Page.IsPageRefresh OrElse Me.DataChanged OrElse Me.ResetData) Then + + + ' Re-load the data and update the web page if necessary. + ' This is typically done during a postback (filter, search button, sort, pagination button). + ' In each of the other click handlers, simply set DataChanged to True to reload the data. + + Me.LoadData() + Me.DataBind() + + End If + + + + Catch ex As Exception + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + Finally + DbUtils.EndTransaction + End Try + End Sub + + + Protected Overrides Sub SaveControlsToSession() + MyBase.SaveControlsToSession() + + ' Save filter controls to values to session. + + + 'Save pagination state to session. + + + + ' Save table control properties to the session. + If Not Me.CurrentSortOrder Is Nothing Then + Me.SaveToSession(Me, "Order_By", Me.CurrentSortOrder.ToXmlString()) + End If + + Me.SaveToSession(Me, "Page_Index", Me.PageIndex.ToString()) + Me.SaveToSession(Me, "Page_Size", Me.PageSize.ToString()) + + Me.SaveToSession(Me, "DeletedRecordIds", Me.DeletedRecordIds) + + End Sub + + Protected Sub SaveControlsToSession_Ajax() + ' Save filter controls to values to session. + + HttpContext.Current.Session("AppRelativeVirtualPath") = Me.Page.AppRelativeVirtualPath + + End Sub + + Protected Overrides Sub ClearControlsFromSession() + MyBase.ClearControlsFromSession() + + ' Clear filter controls values from the session. + + + ' Clear pagination state from session. + + + + ' Clear table properties from the session. + Me.RemoveFromSession(Me, "Order_By") + Me.RemoveFromSession(Me, "Page_Index") + Me.RemoveFromSession(Me, "Page_Size") + + Me.RemoveFromSession(Me, "DeletedRecordIds") + + End Sub + + Protected Overrides Sub LoadViewState(ByVal savedState As Object) + MyBase.LoadViewState(savedState) + + Dim orderByStr As String = CType(ViewState("PersonalEducationTableControl_OrderBy"), String) + + If orderByStr IsNot Nothing AndAlso orderByStr.Trim <> "" Then + Me.CurrentSortOrder = BaseClasses.Data.OrderBy.FromXmlString(orderByStr) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + End If + + Dim pageIndex As String = CType(ViewState("Page_Index"), String) + If pageIndex IsNot Nothing Then + Me.PageIndex = CInt(pageIndex) + End If + + Dim pageSize As String = CType(ViewState("Page_Size"), String) + If Not pageSize Is Nothing Then + Me.PageSize = CInt(pageSize) + End If + + + + ' Load view state for pagination control. + + Me.DeletedRecordIds = CType(Me.ViewState("DeletedRecordIds"), String) + + End Sub + + Protected Overrides Function SaveViewState() As Object + + If Me.CurrentSortOrder IsNot Nothing Then + Me.ViewState("PersonalEducationTableControl_OrderBy") = Me.CurrentSortOrder.ToXmlString() + End If + + Me.ViewState("Page_Index") = Me.PageIndex + Me.ViewState("Page_Size") = Me.PageSize + + Me.ViewState("DeletedRecordIds") = Me.DeletedRecordIds + + + ' Load view state for pagination control. + + + Return MyBase.SaveViewState() + End Function + + ' Generate the event handling functions for pagination events. + + ' event handler for ImageButton + Public Overridable Sub PersonalEducationPagination_FirstPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.PageIndex = 0 + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalEducationPagination_LastPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.DisplayLastPage = True + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalEducationPagination_NextPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.PageIndex += 1 + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for LinkButton + Public Overridable Sub PersonalEducationPagination_PageSizeButton_Click(ByVal sender As Object, ByVal args As EventArgs) + + Try + + Me.DataChanged = True + + Me.PageSize = Integer.Parse(Me.PersonalEducationPagination.PageSize.Text) + + Me.PageIndex = Integer.Parse(Me.PersonalEducationPagination.CurrentPage.Text) - 1 + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalEducationPagination_PreviousPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + If Me.PageIndex > 0 Then + Me.PageIndex -= 1 + Me.DataChanged = True + End If + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + + ' Generate the event handling functions for sorting events. + + Public Overridable Sub CommandDateLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by CommandDate when clicked. + + ' Get previous sorting state for CommandDate. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalEducationTable.CommandDate) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for CommandDate. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalEducationTable.CommandDate, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by CommandDate, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub CommandLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by Command when clicked. + + ' Get previous sorting state for Command. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalEducationTable.Command) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for Command. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalEducationTable.Command, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by Command, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub COUNTRYLabel1_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by COUNTRY when clicked. + + ' Get previous sorting state for COUNTRY. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalEducationTable.COUNTRY) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for COUNTRY. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalEducationTable.COUNTRY, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by COUNTRY, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub CourseAbbrLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by CourseAbbr when clicked. + + ' Get previous sorting state for CourseAbbr. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalEducationTable.CourseAbbr) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for CourseAbbr. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalEducationTable.CourseAbbr, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by CourseAbbr, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub CourseLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by Course when clicked. + + ' Get previous sorting state for Course. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalEducationTable.Course) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for Course. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalEducationTable.Course, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by Course, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub CourseNoLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by CourseNo when clicked. + + ' Get previous sorting state for CourseNo. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalEducationTable.CourseNo) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for CourseNo. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalEducationTable.CourseNo, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by CourseNo, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub EducationPeriodLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by EducationPeriod when clicked. + + ' Get previous sorting state for EducationPeriod. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalEducationTable.EducationPeriod) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for EducationPeriod. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalEducationTable.EducationPeriod, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by EducationPeriod, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub EdYearLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by EdYear when clicked. + + ' Get previous sorting state for EdYear. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalEducationTable.EdYear) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for EdYear. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalEducationTable.EdYear, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by EdYear, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub EndDateLabel2_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by EndDate when clicked. + + ' Get previous sorting state for EndDate. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalEducationTable.EndDate) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for EndDate. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalEducationTable.EndDate, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by EndDate, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub FacultryLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by Facultry when clicked. + + ' Get previous sorting state for Facultry. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalEducationTable.Facultry) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for Facultry. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalEducationTable.Facultry, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by Facultry, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub InstitueLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by Institue when clicked. + + ' Get previous sorting state for Institue. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalEducationTable.Institue) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for Institue. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalEducationTable.Institue, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by Institue, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub LevelIdLabel1_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by LevelId when clicked. + + ' Get previous sorting state for LevelId. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalEducationTable.LevelId) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for LevelId. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalEducationTable.LevelId, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by LevelId, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub NoAllLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by NoAll when clicked. + + ' Get previous sorting state for NoAll. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalEducationTable.NoAll) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for NoAll. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalEducationTable.NoAll, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by NoAll, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub ScoreLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by Score when clicked. + + ' Get previous sorting state for Score. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalEducationTable.Score) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for Score. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalEducationTable.Score, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by Score, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub ScoreNoLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by ScoreNo when clicked. + + ' Get previous sorting state for ScoreNo. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalEducationTable.ScoreNo) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for ScoreNo. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalEducationTable.ScoreNo, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by ScoreNo, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub StartDateLabel2_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by StartDate when clicked. + + ' Get previous sorting state for StartDate. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalEducationTable.StartDate) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for StartDate. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalEducationTable.StartDate, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by StartDate, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + + ' Generate the event handling functions for button events. + + ' event handler for ImageButton + Public Overridable Sub PersonalEducationExportCSVButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + ' Build the where clause based on the current filter and search criteria + ' Create the Order By clause based on the user's current sorting preference. + + Dim wc As WhereClause = CreateWhereClause + Dim orderBy As OrderBy = Nothing + + orderBy = CreateOrderBy + + ' Add each of the columns in order of export. + Dim columns() as BaseColumn = New BaseColumn() { _ + PersonalEducationTable.StartDate, _ + PersonalEducationTable.EndDate, _ + PersonalEducationTable.Course, _ + PersonalEducationTable.CourseAbbr, _ + PersonalEducationTable.Institue, _ + PersonalEducationTable.Facultry, _ + PersonalEducationTable.LevelId, _ + PersonalEducationTable.EdYear, _ + PersonalEducationTable.EducationPeriod, _ + PersonalEducationTable.COUNTRY, _ + PersonalEducationTable.CourseNo, _ + PersonalEducationTable.ScoreNo, _ + PersonalEducationTable.NoAll, _ + PersonalEducationTable.Score, _ + PersonalEducationTable.Command, _ + PersonalEducationTable.CommandDate, _ + Nothing} + Dim exportData as ExportDataToCSV = New ExportDataToCSV(PersonalEducationTable.Instance, wc, orderBy, columns) + + Dim done As Boolean = False + + Dim totalRowsReturned As Integer = 0 + Dim join As CompoundFilter = CreateCompoundJoinFilter() + Dim data As DataForExport = New DataForExport(PersonalEducationTable.Instance, wc, orderBy, columns, join) + + 'Check for Export Data Threshold + Dim exportRawValues As Boolean = False + Me.TotalRecords = PersonalEducationTable.GetRecordCount(join, wc) + If Me.TotalRecords > 10000 Then + exportRawValues = True + End If + exportData.StartExport(Me.Page.Response, exportRawValues) + + ' Read pageSize records at a time and write out the CSV file. + While (Not done) + Dim recList As ArrayList = data.GetRows(exportData.pageSize) + If recList Is Nothing Then + Exit While 'no more records we are done + End If + + totalRowsReturned = recList.Count + For Each rec As BaseRecord In recList + For Each col As BaseColumn In data.ColumnList + If col Is Nothing Then + Continue For + End If + + If Not data.IncludeInExport(col) Then + Continue For + End If + + Dim val As String = "" + + If exportRawValues Then + val = rec.GetValue(col).ToString() + Else + Dim _isExpandableNonCompositeForeignKey As Boolean = col.TableDefinition.IsExpandableNonCompositeForeignKey(col) + If _isExpandableNonCompositeForeignKey AndAlso col.IsApplyDisplayAs Then + val = PersonalEducationTable.GetDFKA(rec.GetValue(col).ToString(), col, Nothing) + End If + If (Not _isExpandableNonCompositeForeignKey) Or (String.IsNullOrEmpty(val)) Then + val = exportData.GetDataForExport(col, rec) + End If + End If + exportData.WriteColumnData(val, data.IsString(col)) + + Next col + exportData.WriteNewRow() + Next rec + + ' If we already are below the pageSize, then we are done. + If totalRowsReturned < exportData.pageSize Then + done = True + End If + End While + exportData.FinishExport(Me.Page.Response) + + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalEducationExportExcelButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + ' To customize the columns or the format, override this function in Section 1 of the page + ' and modify it to your liking. + ' Build the where clause based on the current filter and search criteria + ' Create the Order By clause based on the user's current sorting preference. + + Dim wc As WhereClause = CreateWhereClause + Dim orderBy As OrderBy = Nothing + + orderBy = CreateOrderBy + + Dim done As Boolean = False + Dim val As Object = "" + ' Read pageSize records at a time and write out the Excel file. + Dim totalRowsReturned As Integer = 0 + + Me.TotalRecords = PersonalEducationTable.GetRecordCount(wc) + If Me.TotalRecords > 10000 Then + + ' Add each of the columns in order of export. + Dim columns() as BaseColumn = New BaseColumn() { _ + PersonalEducationTable.StartDate, _ + PersonalEducationTable.EndDate, _ + PersonalEducationTable.Course, _ + PersonalEducationTable.CourseAbbr, _ + PersonalEducationTable.Institue, _ + PersonalEducationTable.Facultry, _ + PersonalEducationTable.LevelId, _ + PersonalEducationTable.EdYear, _ + PersonalEducationTable.EducationPeriod, _ + PersonalEducationTable.COUNTRY, _ + PersonalEducationTable.CourseNo, _ + PersonalEducationTable.ScoreNo, _ + PersonalEducationTable.NoAll, _ + PersonalEducationTable.Score, _ + PersonalEducationTable.Command, _ + PersonalEducationTable.CommandDate, _ + Nothing} + Dim exportData as ExportDataToCSV = New ExportDataToCSV(PersonalEducationTable.Instance, wc, orderBy, columns) + exportData.StartExport(Me.Page.Response, True) + + Dim dataForCSV As DataForExport = New DataForExport(PersonalEducationTable.Instance, wc, orderBy, columns) + + ' Read pageSize records at a time and write out the CSV file. + While (Not done) + Dim recList As ArrayList = dataForCSV.GetRows(exportData.pageSize) + If recList Is Nothing Then + Exit While 'no more records we are done + End If + + totalRowsReturned = recList.Count + For Each rec As BaseRecord In recList + For Each col As BaseColumn In dataForCSV.ColumnList + If col Is Nothing Then + Continue For + End If + + If Not dataForCSV.IncludeInExport(col) Then + Continue For + End If + + val = rec.GetValue(col).ToString() + exportData.WriteColumnData(val, dataForCSV.IsString(col)) + + Next col + exportData.WriteNewRow() + Next rec + + ' If we already are below the pageSize, then we are done. + If totalRowsReturned < exportData.pageSize Then + done = True + End If + End While + exportData.FinishExport(Me.Page.Response) + Else + + ' Create an instance of the Excel report class with the table class, where clause and order by. + Dim excelReport As ExportDataToExcel = New ExportDataToExcel(PersonalEducationTable.Instance, wc, orderBy) + ' Add each of the columns in order of export. + ' To customize the data type, change the second parameter of the new ExcelColumn to be + ' a format string from Excel's Format Cell menu. For example "dddd, mmmm dd, yyyy h:mm AM/PM;@", "#,##0.00" + + If Me.Page.Response Is Nothing Then + Return + End If + + excelReport.CreateExcelBook() + + Dim width As Integer = 0 + Dim columnCounter As Integer = 0 + Dim data As DataForExport = New DataForExport(PersonalEducationTable.Instance, wc, orderBy, Nothing) + data.ColumnList.Add(New ExcelColumn(PersonalEducationTable.StartDate, "Short Date")) + data.ColumnList.Add(New ExcelColumn(PersonalEducationTable.EndDate, "Short Date")) + data.ColumnList.Add(New ExcelColumn(PersonalEducationTable.Course, "Default")) + data.ColumnList.Add(New ExcelColumn(PersonalEducationTable.CourseAbbr, "Default")) + data.ColumnList.Add(New ExcelColumn(PersonalEducationTable.Institue, "Default")) + data.ColumnList.Add(New ExcelColumn(PersonalEducationTable.Facultry, "Default")) + data.ColumnList.Add(New ExcelColumn(PersonalEducationTable.LevelId, "Default")) + data.ColumnList.Add(New ExcelColumn(PersonalEducationTable.EdYear, "Default")) + data.ColumnList.Add(New ExcelColumn(PersonalEducationTable.EducationPeriod, "Default")) + data.ColumnList.Add(New ExcelColumn(PersonalEducationTable.COUNTRY, "Default")) + data.ColumnList.Add(New ExcelColumn(PersonalEducationTable.CourseNo, "Default")) + data.ColumnList.Add(New ExcelColumn(PersonalEducationTable.ScoreNo, "Default")) + data.ColumnList.Add(New ExcelColumn(PersonalEducationTable.NoAll, "Default")) + data.ColumnList.Add(New ExcelColumn(PersonalEducationTable.Score, "Default")) + data.ColumnList.Add(New ExcelColumn(PersonalEducationTable.Command, "Default")) + data.ColumnList.Add(New ExcelColumn(PersonalEducationTable.CommandDate, "Short Date")) + + + For Each col As ExcelColumn In data.ColumnList + width = excelReport.GetExcelCellWidth(col) + If data.IncludeInExport(col) Then + excelReport.AddColumnToExcelBook(columnCounter, col.ToString(), excelReport.GetExcelDataType(col), width, excelReport.GetDisplayFormat(col)) + columnCounter = columnCounter + 1 + End If + Next col + + While (Not done) + Dim recList As ArrayList = data.GetRows(excelReport.pageSize) + + If recList Is Nothing Then + Exit While 'no more records we are done + End If + + totalRowsReturned = recList.Count + + For Each rec As BaseRecord In recList + excelReport.AddRowToExcelBook() + columnCounter = 0 + + For Each col As ExcelColumn In data.ColumnList + If Not data.IncludeInExport(col) Then + Continue For + End If + + Dim _isExpandableNonCompositeForeignKey As Boolean = col.DisplayColumn.TableDefinition.IsExpandableNonCompositeForeignKey(col.DisplayColumn) + If _isExpandableNonCompositeForeignKey AndAlso col.DisplayColumn.IsApplyDisplayAs Then + val = PersonalEducationTable.GetDFKA(rec.GetValue(col.DisplayColumn).ToString(), col.DisplayColumn, Nothing) + If val Is Nothing Then + val = rec.Format(col.DisplayColumn) + End If + Else + val = excelReport.GetValueForExcelExport(col, rec) + End If + excelReport.AddCellToExcelRow(columnCounter, excelReport.GetExcelDataType(col), val, col.DisplayFormat) + + columnCounter = columnCounter + 1 + Next col + Next rec + + ' If we already are below the pageSize, then we are done. + If totalRowsReturned < excelReport.pageSize Then + done = True + End If + End While + + excelReport.SaveExcelBook(Me.Page.Response) + End If + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalEducationImportButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalEducationPDFButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + Dim report As PDFReport = New PDFReport() + report.SpecificReportFileName = Page.Server.MapPath("ShowPersonalId.PersonalEducationPDFButton.report") + ' report.Title replaces the value tag of page header and footer containing ${ReportTitle} + report.Title = "PersonalEducation" + ' If ShowPersonalId.PersonalEducationPDFButton.report specifies a valid report template, + ' AddColumn method will generate a report template. + ' Each AddColumn method-call specifies a column + ' The 1st parameter represents the text of the column header + ' The 2nd parameter represents the horizontal alignment of the column header + ' The 3rd parameter represents the text format of the column detail + ' The 4th parameter represents the horizontal alignment of the column detail + ' The 5th parameter represents the relative width of the column + report.AddColumn(PersonalEducationTable.StartDate.Name, ReportEnum.Align.Left, "${StartDate}", ReportEnum.Align.Left, 20) + report.AddColumn(PersonalEducationTable.EndDate.Name, ReportEnum.Align.Left, "${EndDate}", ReportEnum.Align.Left, 20) + report.AddColumn(PersonalEducationTable.Course.Name, ReportEnum.Align.Left, "${Course}", ReportEnum.Align.Left, 30) + report.AddColumn(PersonalEducationTable.CourseAbbr.Name, ReportEnum.Align.Left, "${CourseAbbr}", ReportEnum.Align.Left, 30) + report.AddColumn(PersonalEducationTable.Institue.Name, ReportEnum.Align.Left, "${Institue}", ReportEnum.Align.Left, 30) + report.AddColumn(PersonalEducationTable.Facultry.Name, ReportEnum.Align.Left, "${Facultry}", ReportEnum.Align.Left, 30) + report.AddColumn(PersonalEducationTable.LevelId.Name, ReportEnum.Align.Left, "${LevelId}", ReportEnum.Align.Left, 30) + report.AddColumn(PersonalEducationTable.EdYear.Name, ReportEnum.Align.Left, "${EdYear}", ReportEnum.Align.Left, 15) + report.AddColumn(PersonalEducationTable.EducationPeriod.Name, ReportEnum.Align.Left, "${EducationPeriod}", ReportEnum.Align.Left, 20) + report.AddColumn(PersonalEducationTable.COUNTRY.Name, ReportEnum.Align.Left, "${COUNTRY}", ReportEnum.Align.Left, 30) + report.AddColumn(PersonalEducationTable.CourseNo.Name, ReportEnum.Align.Left, "${CourseNo}", ReportEnum.Align.Left, 15) + report.AddColumn(PersonalEducationTable.ScoreNo.Name, ReportEnum.Align.Left, "${ScoreNo}", ReportEnum.Align.Left, 15) + report.AddColumn(PersonalEducationTable.NoAll.Name, ReportEnum.Align.Left, "${NoAll}", ReportEnum.Align.Left, 15) + report.AddColumn(PersonalEducationTable.Score.Name, ReportEnum.Align.Left, "${Score}", ReportEnum.Align.Left, 15) + report.AddColumn(PersonalEducationTable.Command.Name, ReportEnum.Align.Left, "${Command}", ReportEnum.Align.Left, 30) + report.AddColumn(PersonalEducationTable.CommandDate.Name, ReportEnum.Align.Left, "${CommandDate}", ReportEnum.Align.Left, 20) + + + Dim rowsPerQuery As Integer = 5000 + Dim recordCount As Integer = 0 + + report.Page = Page.GetResourceValue("Txt:Page", "Persons") + report.ApplicationPath = Me.Page.MapPath(Page.Request.ApplicationPath) + + Dim whereClause As WhereClause = CreateWhereClause + Dim orderBy As OrderBy = CreateOrderBy + Dim joinFilter As BaseFilter = CreateCompoundJoinFilter() + + Dim pageNum As Integer = 0 + Dim totalRows As Integer = PersonalEducationTable.GetRecordCount(joinFilter,whereClause) + Dim columns As ColumnList = PersonalEducationTable.GetColumnList() + Dim records As PersonalEducationRecord() = Nothing + + Do + + records = PersonalEducationTable.GetRecords(joinFilter,whereClause, orderBy, pageNum, rowsPerQuery) + If Not (records Is Nothing) AndAlso records.Length > 0 AndAlso whereClause.RunQuery Then + For Each record As PersonalEducationRecord In records + + ' AddData method takes four parameters + ' The 1st parameters represent the data format + ' The 2nd parameters represent the data value + ' The 3rd parameters represent the default alignment of column using the data + ' The 4th parameters represent the maximum length of the data value being shown + report.AddData("${StartDate}", record.Format(PersonalEducationTable.StartDate), ReportEnum.Align.Left, 100) + report.AddData("${EndDate}", record.Format(PersonalEducationTable.EndDate), ReportEnum.Align.Left, 100) + report.AddData("${Course}", record.Format(PersonalEducationTable.Course), ReportEnum.Align.Left, 100) + report.AddData("${CourseAbbr}", record.Format(PersonalEducationTable.CourseAbbr), ReportEnum.Align.Left, 100) + report.AddData("${Institue}", record.Format(PersonalEducationTable.Institue), ReportEnum.Align.Left, 100) + report.AddData("${Facultry}", record.Format(PersonalEducationTable.Facultry), ReportEnum.Align.Left, 100) + If BaseClasses.Utils.MiscUtils.IsNull(record.LevelId) Then + report.AddData("${LevelId}", "",ReportEnum.Align.Left, 100) + Else + Dim _isExpandableNonCompositeForeignKey as Boolean + Dim _DFKA as String = "" + _isExpandableNonCompositeForeignKey = PersonalEducationTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalEducationTable.LevelId) + _DFKA = PersonalEducationTable.GetDFKA(record.LevelId.ToString(), PersonalEducationTable.LevelId,Nothing) + If _isExpandableNonCompositeForeignKey AndAlso (not _DFKA Is Nothing) AndAlso PersonalEducationTable.LevelId.IsApplyDisplayAs Then + report.AddData("${LevelId}", _DFKA,ReportEnum.Align.Left, 100) + Else + report.AddData("${LevelId}", record.Format(PersonalEducationTable.LevelId), ReportEnum.Align.Left, 100) + End If + End If + report.AddData("${EdYear}", record.Format(PersonalEducationTable.EdYear), ReportEnum.Align.Left, 100) + If BaseClasses.Utils.MiscUtils.IsNull(record.EducationPeriod) Then + report.AddData("${EducationPeriod}", "",ReportEnum.Align.Left, 100) + Else + Dim _isExpandableNonCompositeForeignKey as Boolean + Dim _DFKA as String = "" + _isExpandableNonCompositeForeignKey = PersonalEducationTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalEducationTable.EducationPeriod) + _DFKA = PersonalEducationTable.GetDFKA(record.EducationPeriod.ToString(), PersonalEducationTable.EducationPeriod,Nothing) + If _isExpandableNonCompositeForeignKey AndAlso (not _DFKA Is Nothing) AndAlso PersonalEducationTable.EducationPeriod.IsApplyDisplayAs Then + report.AddData("${EducationPeriod}", _DFKA,ReportEnum.Align.Left, 100) + Else + report.AddData("${EducationPeriod}", record.Format(PersonalEducationTable.EducationPeriod), ReportEnum.Align.Left, 100) + End If + End If + If BaseClasses.Utils.MiscUtils.IsNull(record.COUNTRY) Then + report.AddData("${COUNTRY}", "",ReportEnum.Align.Left, 100) + Else + Dim _isExpandableNonCompositeForeignKey as Boolean + Dim _DFKA as String = "" + _isExpandableNonCompositeForeignKey = PersonalEducationTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalEducationTable.COUNTRY) + _DFKA = PersonalEducationTable.GetDFKA(record.COUNTRY.ToString(), PersonalEducationTable.COUNTRY,Nothing) + If _isExpandableNonCompositeForeignKey AndAlso (not _DFKA Is Nothing) AndAlso PersonalEducationTable.COUNTRY.IsApplyDisplayAs Then + report.AddData("${COUNTRY}", _DFKA,ReportEnum.Align.Left, 100) + Else + report.AddData("${COUNTRY}", record.Format(PersonalEducationTable.COUNTRY), ReportEnum.Align.Left, 100) + End If + End If + report.AddData("${CourseNo}", record.Format(PersonalEducationTable.CourseNo), ReportEnum.Align.Left, 100) + report.AddData("${ScoreNo}", record.Format(PersonalEducationTable.ScoreNo), ReportEnum.Align.Left, 100) + report.AddData("${NoAll}", record.Format(PersonalEducationTable.NoAll), ReportEnum.Align.Left, 100) + report.AddData("${Score}", record.Format(PersonalEducationTable.Score), ReportEnum.Align.Left, 100) + report.AddData("${Command}", record.Format(PersonalEducationTable.Command), ReportEnum.Align.Left, 100) + report.AddData("${CommandDate}", record.Format(PersonalEducationTable.CommandDate), ReportEnum.Align.Left, 100) + + report.WriteRow + Next + pageNum = pageNum + 1 + recordCount += records.Length + End If + Loop While Not (records Is Nothing) AndAlso recordCount < totalRows AndAlso whereClause.RunQuery + + report.Close + BaseClasses.Utils.NetUtils.WriteResponseBinaryAttachment(Me.Page.Response, report.Title + ".pdf", report.ReportInByteArray, 0, true) + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalEducationRefreshButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Dim PersonalDDTableControlObj as PersonalDDTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalDDTableControl"), PersonalDDTableControl) + PersonalDDTableControlObj.ResetData = True + + PersonalDDTableControlObj.RemoveFromSession(PersonalDDTableControlObj, "DeletedRecordIds") + PersonalDDTableControlObj.DeletedRecordIds = Nothing + + Dim PersonalEducationTableControlObj as PersonalEducationTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalEducationTableControl"), PersonalEducationTableControl) + PersonalEducationTableControlObj.ResetData = True + + PersonalEducationTableControlObj.RemoveFromSession(PersonalEducationTableControlObj, "DeletedRecordIds") + PersonalEducationTableControlObj.DeletedRecordIds = Nothing + + Dim PersonalExtWorkTableControlObj as PersonalExtWorkTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalExtWorkTableControl"), PersonalExtWorkTableControl) + PersonalExtWorkTableControlObj.ResetData = True + + PersonalExtWorkTableControlObj.RemoveFromSession(PersonalExtWorkTableControlObj, "DeletedRecordIds") + PersonalExtWorkTableControlObj.DeletedRecordIds = Nothing + + Dim PersonalIdRecordControlObj as PersonalIdRecordControl = DirectCast(Me.Page.FindControlRecursively("PersonalIdRecordControl"), PersonalIdRecordControl) + PersonalIdRecordControlObj.ResetData = True + + + Dim PersonalInsigniaTableControlObj as PersonalInsigniaTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalInsigniaTableControl"), PersonalInsigniaTableControl) + PersonalInsigniaTableControlObj.ResetData = True + + PersonalInsigniaTableControlObj.RemoveFromSession(PersonalInsigniaTableControlObj, "DeletedRecordIds") + PersonalInsigniaTableControlObj.DeletedRecordIds = Nothing + + Dim PersonalLanguageSkillTableControlObj as PersonalLanguageSkillTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalLanguageSkillTableControl"), PersonalLanguageSkillTableControl) + PersonalLanguageSkillTableControlObj.ResetData = True + + PersonalLanguageSkillTableControlObj.RemoveFromSession(PersonalLanguageSkillTableControlObj, "DeletedRecordIds") + PersonalLanguageSkillTableControlObj.DeletedRecordIds = Nothing + + Dim PersonalNameTableControlObj as PersonalNameTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalNameTableControl"), PersonalNameTableControl) + PersonalNameTableControlObj.ResetData = True + + PersonalNameTableControlObj.RemoveFromSession(PersonalNameTableControlObj, "DeletedRecordIds") + PersonalNameTableControlObj.DeletedRecordIds = Nothing + + Dim PersonalRankTableControlObj as PersonalRankTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalRankTableControl"), PersonalRankTableControl) + PersonalRankTableControlObj.ResetData = True + + PersonalRankTableControlObj.RemoveFromSession(PersonalRankTableControlObj, "DeletedRecordIds") + PersonalRankTableControlObj.DeletedRecordIds = Nothing + + Dim PersonalSalaryTableControlObj as PersonalSalaryTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalSalaryTableControl"), PersonalSalaryTableControl) + PersonalSalaryTableControlObj.ResetData = True + + PersonalSalaryTableControlObj.RemoveFromSession(PersonalSalaryTableControlObj, "DeletedRecordIds") + PersonalSalaryTableControlObj.DeletedRecordIds = Nothing + + Dim PersonalSpecialSkillTableControlObj as PersonalSpecialSkillTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalSpecialSkillTableControl"), PersonalSpecialSkillTableControl) + PersonalSpecialSkillTableControlObj.ResetData = True + + PersonalSpecialSkillTableControlObj.RemoveFromSession(PersonalSpecialSkillTableControlObj, "DeletedRecordIds") + PersonalSpecialSkillTableControlObj.DeletedRecordIds = Nothing + + Dim PersonalSportSkillTableControlObj as PersonalSportSkillTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalSportSkillTableControl"), PersonalSportSkillTableControl) + PersonalSportSkillTableControlObj.ResetData = True + + PersonalSportSkillTableControlObj.RemoveFromSession(PersonalSportSkillTableControlObj, "DeletedRecordIds") + PersonalSportSkillTableControlObj.DeletedRecordIds = Nothing + + Dim PersonalTitleTableControlObj as PersonalTitleTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalTitleTableControl"), PersonalTitleTableControl) + PersonalTitleTableControlObj.ResetData = True + + PersonalTitleTableControlObj.RemoveFromSession(PersonalTitleTableControlObj, "DeletedRecordIds") + PersonalTitleTableControlObj.DeletedRecordIds = Nothing + + Dim PersonRelativeTableControlObj as PersonRelativeTableControl = DirectCast(Me.Page.FindControlRecursively("PersonRelativeTableControl"), PersonRelativeTableControl) + PersonRelativeTableControlObj.ResetData = True + + PersonRelativeTableControlObj.RemoveFromSession(PersonRelativeTableControlObj, "DeletedRecordIds") + PersonRelativeTableControlObj.DeletedRecordIds = Nothing + + Dim ReportPropertiesTableControlObj as ReportPropertiesTableControl = DirectCast(Me.Page.FindControlRecursively("ReportPropertiesTableControl"), ReportPropertiesTableControl) + ReportPropertiesTableControlObj.ResetData = True + + ReportPropertiesTableControlObj.RemoveFromSession(ReportPropertiesTableControlObj, "DeletedRecordIds") + ReportPropertiesTableControlObj.DeletedRecordIds = Nothing + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalEducationResetButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.CurrentSortOrder.Reset() + If Me.InSession(Me, "Order_By") Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + Me.CurrentSortOrder.Add(PersonalEducationTable.EducationPeriod, OrderByItem.OrderDir.Asc) + + Me.CurrentSortOrder.Add(PersonalEducationTable.StartDate, OrderByItem.OrderDir.Asc) + + + End If + + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalEducationWordButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + Dim report As WordReport = New WordReport + report.SpecificReportFileName = Page.Server.MapPath("ShowPersonalId.PersonalEducationWordButton.word") + ' report.Title replaces the value tag of page header and footer containing ${ReportTitle} + report.Title = "PersonalEducation" + ' If ShowPersonalId.PersonalEducationWordButton.report specifies a valid report template, + ' AddColumn method will generate a report template. + ' Each AddColumn method-call specifies a column + ' The 1st parameter represents the text of the column header + ' The 2nd parameter represents the horizontal alignment of the column header + ' The 3rd parameter represents the text format of the column detail + ' The 4th parameter represents the horizontal alignment of the column detail + ' The 5th parameter represents the relative width of the column + report.AddColumn(PersonalEducationTable.StartDate.Name, ReportEnum.Align.Left, "${StartDate}", ReportEnum.Align.Left, 20) + report.AddColumn(PersonalEducationTable.EndDate.Name, ReportEnum.Align.Left, "${EndDate}", ReportEnum.Align.Left, 20) + report.AddColumn(PersonalEducationTable.Course.Name, ReportEnum.Align.Left, "${Course}", ReportEnum.Align.Left, 30) + report.AddColumn(PersonalEducationTable.CourseAbbr.Name, ReportEnum.Align.Left, "${CourseAbbr}", ReportEnum.Align.Left, 30) + report.AddColumn(PersonalEducationTable.Institue.Name, ReportEnum.Align.Left, "${Institue}", ReportEnum.Align.Left, 30) + report.AddColumn(PersonalEducationTable.Facultry.Name, ReportEnum.Align.Left, "${Facultry}", ReportEnum.Align.Left, 30) + report.AddColumn(PersonalEducationTable.LevelId.Name, ReportEnum.Align.Left, "${LevelId}", ReportEnum.Align.Left, 30) + report.AddColumn(PersonalEducationTable.EdYear.Name, ReportEnum.Align.Left, "${EdYear}", ReportEnum.Align.Left, 15) + report.AddColumn(PersonalEducationTable.EducationPeriod.Name, ReportEnum.Align.Left, "${EducationPeriod}", ReportEnum.Align.Left, 20) + report.AddColumn(PersonalEducationTable.COUNTRY.Name, ReportEnum.Align.Left, "${COUNTRY}", ReportEnum.Align.Left, 30) + report.AddColumn(PersonalEducationTable.CourseNo.Name, ReportEnum.Align.Left, "${CourseNo}", ReportEnum.Align.Left, 15) + report.AddColumn(PersonalEducationTable.ScoreNo.Name, ReportEnum.Align.Left, "${ScoreNo}", ReportEnum.Align.Left, 15) + report.AddColumn(PersonalEducationTable.NoAll.Name, ReportEnum.Align.Left, "${NoAll}", ReportEnum.Align.Left, 15) + report.AddColumn(PersonalEducationTable.Score.Name, ReportEnum.Align.Left, "${Score}", ReportEnum.Align.Left, 15) + report.AddColumn(PersonalEducationTable.Command.Name, ReportEnum.Align.Left, "${Command}", ReportEnum.Align.Left, 30) + report.AddColumn(PersonalEducationTable.CommandDate.Name, ReportEnum.Align.Left, "${CommandDate}", ReportEnum.Align.Left, 20) + + Dim whereClause As WhereClause = CreateWhereClause + + Dim orderBy As OrderBy = CreateOrderBy + Dim joinFilter As BaseFilter = CreateCompoundJoinFilter() + + Dim rowsPerQuery As Integer = 5000 + Dim pageNum As Integer = 0 + Dim recordCount As Integer = 0 + Dim totalRows As Integer = PersonalEducationTable.GetRecordCount(joinFilter,whereClause) + + report.Page = Page.GetResourceValue("Txt:Page", "Persons") + report.ApplicationPath = Me.Page.MapPath(Page.Request.ApplicationPath) + + Dim columns As ColumnList = PersonalEducationTable.GetColumnList() + Dim records As PersonalEducationRecord() = Nothing + Do + records = PersonalEducationTable.GetRecords(joinFilter,whereClause, orderBy, pageNum, rowsPerQuery) + + If Not (records Is Nothing) AndAlso records.Length > 0 AndAlso whereClause.RunQuery Then + For Each record As PersonalEducationRecord In records + ' AddData method takes four parameters + ' The 1st parameters represent the data format + ' The 2nd parameters represent the data value + ' The 3rd parameters represent the default alignment of column using the data + ' The 4th parameters represent the maximum length of the data value being shown + report.AddData("${StartDate}", record.Format(PersonalEducationTable.StartDate), ReportEnum.Align.Left, 100) + report.AddData("${EndDate}", record.Format(PersonalEducationTable.EndDate), ReportEnum.Align.Left, 100) + report.AddData("${Course}", record.Format(PersonalEducationTable.Course), ReportEnum.Align.Left, 100) + report.AddData("${CourseAbbr}", record.Format(PersonalEducationTable.CourseAbbr), ReportEnum.Align.Left, 100) + report.AddData("${Institue}", record.Format(PersonalEducationTable.Institue), ReportEnum.Align.Left, 100) + report.AddData("${Facultry}", record.Format(PersonalEducationTable.Facultry), ReportEnum.Align.Left, 100) + If BaseClasses.Utils.MiscUtils.IsNull(record.LevelId) Then + report.AddData("${LevelId}", "",ReportEnum.Align.Left, 100) + Else + Dim _isExpandableNonCompositeForeignKey as Boolean + Dim _DFKA as String = "" + _isExpandableNonCompositeForeignKey = PersonalEducationTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalEducationTable.LevelId) + _DFKA = PersonalEducationTable.GetDFKA(record.LevelId.ToString(), PersonalEducationTable.LevelId,Nothing) + If _isExpandableNonCompositeForeignKey AndAlso (not _DFKA Is Nothing) AndAlso PersonalEducationTable.LevelId.IsApplyDisplayAs Then + report.AddData("${LevelId}", _DFKA,ReportEnum.Align.Left, 100) + Else + report.AddData("${LevelId}", record.Format(PersonalEducationTable.LevelId), ReportEnum.Align.Left, 100) + End If + End If + report.AddData("${EdYear}", record.Format(PersonalEducationTable.EdYear), ReportEnum.Align.Left, 100) + If BaseClasses.Utils.MiscUtils.IsNull(record.EducationPeriod) Then + report.AddData("${EducationPeriod}", "",ReportEnum.Align.Left, 100) + Else + Dim _isExpandableNonCompositeForeignKey as Boolean + Dim _DFKA as String = "" + _isExpandableNonCompositeForeignKey = PersonalEducationTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalEducationTable.EducationPeriod) + _DFKA = PersonalEducationTable.GetDFKA(record.EducationPeriod.ToString(), PersonalEducationTable.EducationPeriod,Nothing) + If _isExpandableNonCompositeForeignKey AndAlso (not _DFKA Is Nothing) AndAlso PersonalEducationTable.EducationPeriod.IsApplyDisplayAs Then + report.AddData("${EducationPeriod}", _DFKA,ReportEnum.Align.Left, 100) + Else + report.AddData("${EducationPeriod}", record.Format(PersonalEducationTable.EducationPeriod), ReportEnum.Align.Left, 100) + End If + End If + If BaseClasses.Utils.MiscUtils.IsNull(record.COUNTRY) Then + report.AddData("${COUNTRY}", "",ReportEnum.Align.Left, 100) + Else + Dim _isExpandableNonCompositeForeignKey as Boolean + Dim _DFKA as String = "" + _isExpandableNonCompositeForeignKey = PersonalEducationTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalEducationTable.COUNTRY) + _DFKA = PersonalEducationTable.GetDFKA(record.COUNTRY.ToString(), PersonalEducationTable.COUNTRY,Nothing) + If _isExpandableNonCompositeForeignKey AndAlso (not _DFKA Is Nothing) AndAlso PersonalEducationTable.COUNTRY.IsApplyDisplayAs Then + report.AddData("${COUNTRY}", _DFKA,ReportEnum.Align.Left, 100) + Else + report.AddData("${COUNTRY}", record.Format(PersonalEducationTable.COUNTRY), ReportEnum.Align.Left, 100) + End If + End If + report.AddData("${CourseNo}", record.Format(PersonalEducationTable.CourseNo), ReportEnum.Align.Left, 100) + report.AddData("${ScoreNo}", record.Format(PersonalEducationTable.ScoreNo), ReportEnum.Align.Left, 100) + report.AddData("${NoAll}", record.Format(PersonalEducationTable.NoAll), ReportEnum.Align.Left, 100) + report.AddData("${Score}", record.Format(PersonalEducationTable.Score), ReportEnum.Align.Left, 100) + report.AddData("${Command}", record.Format(PersonalEducationTable.Command), ReportEnum.Align.Left, 100) + report.AddData("${CommandDate}", record.Format(PersonalEducationTable.CommandDate), ReportEnum.Align.Left, 100) + + report.WriteRow + Next + pageNum = pageNum + 1 + recordCount += records.Length + End If + Loop While Not (records Is Nothing) AndAlso recordCount < totalRows AndAlso whereClause.RunQuery + report.save + BaseClasses.Utils.NetUtils.WriteResponseBinaryAttachment(Me.Page.Response, report.Title + ".doc", report.ReportInByteArray, 0, true) + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + + + ' Generate the event handling functions for filter and search events. + + + ' Generate the event handling functions for others + + + Private _UIData As New System.Collections.Generic.List(Of Hashtable) + Public Property UIData() As System.Collections.Generic.List(Of Hashtable) + Get + Return Me._UIData + End Get + Set(ByVal value As System.Collections.Generic.List(Of Hashtable)) + Me._UIData = value + End Set + End Property + + ' pagination properties + Protected _PageSize As Integer + Public Property PageSize() As Integer + Get + Return Me._PageSize + End Get + Set(ByVal value As Integer) + Me._PageSize = value + End Set + End Property + + Protected _PageIndex As Integer + Public Property PageIndex() As Integer + Get + ' Return the PageIndex + Return Me._PageIndex + End Get + Set(ByVal value As Integer) + Me._PageIndex = value + End Set + End Property + + Protected _TotalRecords As Integer = -1 + Public Property TotalRecords() As Integer + Get + If _TotalRecords < 0 + _TotalRecords = PersonalEducationTable.GetRecordCount(CreateCompoundJoinFilter(), CreateWhereClause()) + End If + Return Me._TotalRecords + End Get + Set(ByVal value As Integer) + If Me.PageSize > 0 Then + + Me.TotalPages = CInt(Math.Ceiling(value / Me.PageSize)) + + End If + Me._TotalRecords = value + End Set + End Property + + + + Protected _TotalPages As Integer = -1 + Public Property TotalPages() As Integer + Get + If _TotalPages < 0 Then + + Me.TotalPages = CInt(Math.Ceiling(TotalRecords / Me.PageSize)) + + End If + Return Me._TotalPages + End Get + Set(ByVal value As Integer) + Me._TotalPages = value + End Set + End Property + + Protected _DisplayLastPage As Boolean + Public Property DisplayLastPage() As Boolean + Get + Return Me._DisplayLastPage + End Get + Set(ByVal value As Boolean) + Me._DisplayLastPage = value + End Set + End Property + + Private _DataChanged As Boolean = False + Public Property DataChanged() As Boolean + Get + Return Me._DataChanged + End Get + Set(ByVal value As Boolean) + Me._DataChanged = value + End Set + End Property + + Private _ResetData As Boolean = False + Public Property ResetData() As Boolean + Get + Return Me._ResetData + End Get + Set(ByVal value As Boolean) + Me._ResetData = value + End Set + End Property + + Private _AddNewRecord As Integer = 0 + Public Property AddNewRecord() As Integer + Get + Return Me._AddNewRecord + End Get + Set(ByVal value As Integer) + Me._AddNewRecord = value + End Set + End Property + + + Private _CurrentSortOrder As OrderBy = Nothing + Public Property CurrentSortOrder() As OrderBy + Get + Return Me._CurrentSortOrder + End Get + Set(ByVal value As BaseClasses.Data.OrderBy) + Me._CurrentSortOrder = value + End Set + End Property + + Private _DataSource() As PersonalEducationRecord = Nothing + Public Property DataSource() As PersonalEducationRecord () + Get + Return Me._DataSource + End Get + Set(ByVal value() As PersonalEducationRecord) + Me._DataSource = value + End Set + End Property + +#Region "Helper Properties" + + Public ReadOnly Property CommandDateLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "CommandDateLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property CommandLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "CommandLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property COUNTRYLabel1() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "COUNTRYLabel1"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property CourseAbbrLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "CourseAbbrLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property CourseLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "CourseLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property CourseNoLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "CourseNoLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property EducationPeriodLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "EducationPeriodLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property EdYearLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "EdYearLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property EndDateLabel2() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "EndDateLabel2"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property FacultryLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "FacultryLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property InstitueLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "InstitueLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property LevelIdLabel1() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "LevelIdLabel1"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property NoAllLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "NoAllLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property PersonalEducationExportCSVButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalEducationExportCSVButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalEducationExportExcelButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalEducationExportExcelButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalEducationImportButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalEducationImportButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalEducationPagination() As Persons.UI.IPagination + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalEducationPagination"), Persons.UI.IPagination) + End Get + End Property + + Public ReadOnly Property PersonalEducationPDFButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalEducationPDFButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalEducationRefreshButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalEducationRefreshButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalEducationResetButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalEducationResetButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalEducationTableControlCollapsibleRegion() As System.Web.UI.WebControls.Panel + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalEducationTableControlCollapsibleRegion"), System.Web.UI.WebControls.Panel) + End Get + End Property + + Public ReadOnly Property PersonalEducationWordButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalEducationWordButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property ScoreLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "ScoreLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property ScoreNoLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "ScoreNoLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property StartDateLabel2() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "StartDateLabel2"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + +#End Region + +#Region "Helper Functions" + + Public Overrides Overloads Function ModifyRedirectUrl(url As String, arg As String, ByVal bEncrypt As Boolean) As String + Return Me.Page.EvaluateExpressions(url, arg, bEncrypt, Me) + End Function + + Public Overrides Overloads Function EvaluateExpressions(url As String, arg As String, ByVal bEncrypt As Boolean) As String + Dim needToProcess As Boolean = AreAnyUrlParametersForMe(url, arg) + If (needToProcess) Then + Dim recCtl As PersonalEducationTableControlRow = Me.GetSelectedRecordControl() + If recCtl Is Nothing AndAlso url.IndexOf("{") >= 0 Then + ' Localization. + Throw New Exception(Page.GetResourceValue("Err:NoRecSelected", "Persons")) + End If + Dim rec As PersonalEducationRecord = Nothing + If recCtl IsNot Nothing Then + rec = recCtl.GetRecord() + End If + Return EvaluateExpressions(url, arg, rec, bEncrypt) + End If + Return url + End Function + + Public Overridable Function GetSelectedRecordControl() As PersonalEducationTableControlRow + Return Nothing + + End Function + + Public Overridable Function GetSelectedRecordControls() As PersonalEducationTableControlRow() + + Return DirectCast((new ArrayList()).ToArray(GetType(PersonalEducationTableControlRow)), PersonalEducationTableControlRow()) + + End Function + + Public Overridable Sub DeleteSelectedRecords(ByVal deferDeletion As Boolean) + Dim recList() As PersonalEducationTableControlRow = Me.GetSelectedRecordControls() + If recList.Length = 0 Then + ' Localization. + Throw New Exception(Page.GetResourceValue("Err:NoRecSelected", "Persons")) + End If + + Dim recCtl As PersonalEducationTableControlRow + For Each recCtl In recList + If deferDeletion Then + If Not recCtl.IsNewRecord Then + + Me.AddToDeletedRecordIds(recCtl) + + End If + recCtl.Visible = False + + Else + + recCtl.Delete() + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + End If + Next + End Sub + + Public Function GetRecordControls() As PersonalEducationTableControlRow() + Dim recList As ArrayList = New ArrayList() + Dim rep As System.Web.UI.WebControls.Repeater = CType(Me.FindControl("PersonalEducationTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return Nothing + Dim repItem As System.Web.UI.WebControls.RepeaterItem + + For Each repItem In rep.Items + + Dim recControl As PersonalEducationTableControlRow = DirectCast(repItem.FindControl("PersonalEducationTableControlRow"), PersonalEducationTableControlRow) + recList.Add(recControl) + + Next + + Return DirectCast(recList.ToArray(GetType(PersonalEducationTableControlRow)), PersonalEducationTableControlRow()) + End Function + + Public Shadows ReadOnly Property Page() As BaseApplicationPage + Get + Return DirectCast(MyBase.Page, BaseApplicationPage) + End Get + End Property + +#End Region + + + +End Class + + +' Base class for the PersonalExtWorkTableControlRow control on the ShowPersonalId page. +' Do not modify this class. Instead override any method in PersonalExtWorkTableControlRow. +Public Class BasePersonalExtWorkTableControlRow + Inherits Persons.UI.BaseApplicationRecordControl + + ' To customize, override this method in PersonalExtWorkTableControlRow. + Protected Overridable Sub Control_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Init + + Me.ClearControlsFromSession() + End Sub + + ' To customize, override this method in PersonalExtWorkTableControlRow. + Protected Overridable Sub Control_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load + + 'Call LoadFocusScripts from repeater so that onfocus attribute could be added to elements + Me.Page.LoadFocusScripts(Me) + + + ' Register the event handlers. + + + End Sub + + + Public Overridable Sub LoadData() + + ' Load the data from the database into the DataSource PersonalExtWork 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 = PersonalExtWorkTable.GetRecord(Me.RecordUniqueId, True) + + Return + End If + + ' Since this is a row in the table, the data for this row is loaded by the + ' LoadData method of the BasePersonalExtWorkTableControl when the data for the entire + ' table is loaded. + + Me.DataSource = New PersonalExtWorkRecord() + + + + End Sub + + ' Populate the UI controls using the DataSource. To customize, override this method in PersonalExtWorkTableControlRow. + 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 + + SetActive() + SetBeginDate() + SetCommand1() + SetCommandDate1() + SetDescription() + SetEndDate2() + SetPlace() + + + 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 SetActive() + + + ' Set the Active Literal on the webpage with value from the + ' PersonalExtWork database record. + + ' Me.DataSource is the PersonalExtWork record retrieved from the database. + ' Me.Active is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetActive() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.ActiveSpecified Then + + ' If the Active is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalExtWorkTable.Active) + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.Active.Text = formattedValue + + Else + + ' Active is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.Active.Text = PersonalExtWorkTable.Active.Format(PersonalExtWorkTable.Active.DefaultValue) + + End If + + ' If the Active is NULL or blank, then use the value specified + ' on Properties. + If Me.Active.Text Is Nothing _ + OrElse Me.Active.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.Active.Text = " " + End If + + End Sub + + Public Overridable Sub SetBeginDate() + + + ' Set the BeginDate Literal on the webpage with value from the + ' PersonalExtWork database record. + + ' Me.DataSource is the PersonalExtWork record retrieved from the database. + ' Me.BeginDate is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetBeginDate() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.BeginDateSpecified Then + + ' If the BeginDate is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalExtWorkTable.BeginDate, "d MMM yy") + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.BeginDate.Text = formattedValue + + Else + + ' BeginDate is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.BeginDate.Text = PersonalExtWorkTable.BeginDate.Format(PersonalExtWorkTable.BeginDate.DefaultValue, "d MMM yy") + + End If + + ' If the BeginDate is NULL or blank, then use the value specified + ' on Properties. + If Me.BeginDate.Text Is Nothing _ + OrElse Me.BeginDate.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.BeginDate.Text = " " + End If + + End Sub + + Public Overridable Sub SetCommand1() + + + ' Set the Command Literal on the webpage with value from the + ' PersonalExtWork database record. + + ' Me.DataSource is the PersonalExtWork record retrieved from the database. + ' Me.Command1 is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetCommand1() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.CommandSpecified Then + + ' If the Command is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalExtWorkTable.Command) + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + If Not formattedValue is Nothing Then + Dim popupThreshold as Integer = CType(100, Integer) + + Dim maxLength as Integer = Len(formattedValue) + If (maxLength > CType(100, Integer)) Then + ' Truncate based on FieldMaxLength on Properties. + maxLength = CType(100, Integer) + + End If + + ' For fields values larger than the PopupTheshold on Properties, display a popup. + If Len(formattedValue) >= popupThreshold Then + + Dim name As String = HttpUtility.HtmlEncode(PersonalExtWorkTable.Command.Name) + + If Not HttpUtility.HtmlEncode("%ISD_DEFAULT%").Equals("%ISD_DEFAULT%") Then + name = HttpUtility.HtmlEncode(Me.Page.GetResourceValue("%ISD_DEFAULT%")) + End If + + + + formattedValue= "" & NetUtils.EncodeStringForHtmlDisplay(formattedValue.Substring(0, maxLength)) + + If (maxLength = CType(100, Integer)) Then + formattedValue = formattedValue & "..." & "" + Else + formattedValue = formattedValue & "" + + End If + Else + If maxLength = CType(100, Integer) Then + formattedValue= NetUtils.EncodeStringForHtmlDisplay(formattedValue.SubString(0,MaxLength)) + formattedValue = formattedValue & "..." + + End If + End If + End If + + Me.Command1.Text = formattedValue + + Else + + ' Command is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.Command1.Text = PersonalExtWorkTable.Command.Format(PersonalExtWorkTable.Command.DefaultValue) + + End If + + ' If the Command is NULL or blank, then use the value specified + ' on Properties. + If Me.Command1.Text Is Nothing _ + OrElse Me.Command1.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.Command1.Text = " " + End If + + End Sub + + Public Overridable Sub SetCommandDate1() + + + ' Set the CommandDate Literal on the webpage with value from the + ' PersonalExtWork database record. + + ' Me.DataSource is the PersonalExtWork record retrieved from the database. + ' Me.CommandDate1 is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetCommandDate1() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.CommandDateSpecified Then + + ' If the CommandDate is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalExtWorkTable.CommandDate, "d MMM yy") + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.CommandDate1.Text = formattedValue + + Else + + ' CommandDate is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.CommandDate1.Text = PersonalExtWorkTable.CommandDate.Format(PersonalExtWorkTable.CommandDate.DefaultValue, "d MMM yy") + + End If + + ' If the CommandDate is NULL or blank, then use the value specified + ' on Properties. + If Me.CommandDate1.Text Is Nothing _ + OrElse Me.CommandDate1.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.CommandDate1.Text = " " + End If + + End Sub + + Public Overridable Sub SetDescription() + + + ' Set the Description Literal on the webpage with value from the + ' PersonalExtWork database record. + + ' Me.DataSource is the PersonalExtWork record retrieved from the database. + ' Me.Description is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetDescription() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.DescriptionSpecified Then + + ' If the Description is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalExtWorkTable.Description) + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + If Not formattedValue is Nothing Then + Dim popupThreshold as Integer = CType(100, Integer) + + Dim maxLength as Integer = Len(formattedValue) + If (maxLength > CType(100, Integer)) Then + ' Truncate based on FieldMaxLength on Properties. + maxLength = CType(100, Integer) + + End If + + ' For fields values larger than the PopupTheshold on Properties, display a popup. + If Len(formattedValue) >= popupThreshold Then + + Dim name As String = HttpUtility.HtmlEncode(PersonalExtWorkTable.Description.Name) + + If Not HttpUtility.HtmlEncode("%ISD_DEFAULT%").Equals("%ISD_DEFAULT%") Then + name = HttpUtility.HtmlEncode(Me.Page.GetResourceValue("%ISD_DEFAULT%")) + End If + + + + formattedValue= "" & NetUtils.EncodeStringForHtmlDisplay(formattedValue.Substring(0, maxLength)) + + If (maxLength = CType(100, Integer)) Then + formattedValue = formattedValue & "..." & "" + Else + formattedValue = formattedValue & "" + + End If + Else + If maxLength = CType(100, Integer) Then + formattedValue= NetUtils.EncodeStringForHtmlDisplay(formattedValue.SubString(0,MaxLength)) + formattedValue = formattedValue & "..." + + End If + End If + End If + + Me.Description.Text = formattedValue + + Else + + ' Description is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.Description.Text = PersonalExtWorkTable.Description.Format(PersonalExtWorkTable.Description.DefaultValue) + + End If + + ' If the Description is NULL or blank, then use the value specified + ' on Properties. + If Me.Description.Text Is Nothing _ + OrElse Me.Description.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.Description.Text = " " + End If + + End Sub + + Public Overridable Sub SetEndDate2() + + + ' Set the EndDate Literal on the webpage with value from the + ' PersonalExtWork database record. + + ' Me.DataSource is the PersonalExtWork record retrieved from the database. + ' Me.EndDate2 is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetEndDate2() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.EndDateSpecified Then + + ' If the EndDate is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalExtWorkTable.EndDate, "d MMM yy") + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.EndDate2.Text = formattedValue + + Else + + ' EndDate is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.EndDate2.Text = PersonalExtWorkTable.EndDate.Format(PersonalExtWorkTable.EndDate.DefaultValue, "d MMM yy") + + End If + + ' If the EndDate is NULL or blank, then use the value specified + ' on Properties. + If Me.EndDate2.Text Is Nothing _ + OrElse Me.EndDate2.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.EndDate2.Text = " " + End If + + End Sub + + Public Overridable Sub SetPlace() + + + ' Set the Place Literal on the webpage with value from the + ' PersonalExtWork database record. + + ' Me.DataSource is the PersonalExtWork record retrieved from the database. + ' Me.Place is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetPlace() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.PlaceSpecified Then + + ' If the Place is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalExtWorkTable.Place) + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + If Not formattedValue is Nothing Then + Dim popupThreshold as Integer = CType(100, Integer) + + Dim maxLength as Integer = Len(formattedValue) + If (maxLength > CType(100, Integer)) Then + ' Truncate based on FieldMaxLength on Properties. + maxLength = CType(100, Integer) + + End If + + ' For fields values larger than the PopupTheshold on Properties, display a popup. + If Len(formattedValue) >= popupThreshold Then + + Dim name As String = HttpUtility.HtmlEncode(PersonalExtWorkTable.Place.Name) + + If Not HttpUtility.HtmlEncode("%ISD_DEFAULT%").Equals("%ISD_DEFAULT%") Then + name = HttpUtility.HtmlEncode(Me.Page.GetResourceValue("%ISD_DEFAULT%")) + End If + + + + formattedValue= "" & NetUtils.EncodeStringForHtmlDisplay(formattedValue.Substring(0, maxLength)) + + If (maxLength = CType(100, Integer)) Then + formattedValue = formattedValue & "..." & "" + Else + formattedValue = formattedValue & "" + + End If + Else + If maxLength = CType(100, Integer) Then + formattedValue= NetUtils.EncodeStringForHtmlDisplay(formattedValue.SubString(0,MaxLength)) + formattedValue = formattedValue & "..." + + End If + End If + End If + + Me.Place.Text = formattedValue + + Else + + ' Place is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.Place.Text = PersonalExtWorkTable.Place.Format(PersonalExtWorkTable.Place.DefaultValue) + + End If + + ' If the Place is NULL or blank, then use the value specified + ' on Properties. + If Me.Place.Text Is Nothing _ + OrElse Me.Place.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.Place.Text = " " + End If + + End Sub + + + Public EvaluateFormulaDelegate As BaseClasses.Data.DataSource.EvaluateFormulaDelegate = New BaseClasses.Data.DataSource.EvaluateFormulaDelegate(AddressOf Me.EvaluateFormula) + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean, ByVal e As FormulaEvaluator) As String + If e Is Nothing Then + e = New FormulaEvaluator() + End If + + e.Variables.Clear() + + + ' add variables for formula evaluation + If variables IsNot Nothing Then + Dim enumerator As System.Collections.Generic.IEnumerator(Of System.Collections.Generic.KeyValuePair(Of String, Object)) = variables.GetEnumerator() + While enumerator.MoveNext() + e.Variables.Add(enumerator.Current.Key, enumerator.Current.Value) + End While + End If + + If includeDS + + End IF + + + ' Other variables referred to in the formula are expected to be + ' properties of the DataSource. For example, referring to + ' UnitPrice as a variable will refer to DataSource.UnitPrice + If dataSourceForEvaluate Is Nothing Then + + e.DataSource = Me.DataSource + + Else + e.DataSource = dataSourceForEvaluate + End If + + ' Define the calling control. This is used to add other + ' related table and record controls as variables. + e.CallingControl = Me + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + + If Not String.IsNullOrEmpty(format) AndAlso (String.IsNullOrEmpty(formula) OrElse formula.IndexOf("Format(") < 0) Then + Return FormulaUtils.Format(resultObj, format) + Else + Return resultObj.ToString() + End If + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format,variables ,includeDS, Nothing) + End Function + + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object)) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format, variables ,True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, format, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal e as FormulaEvaluator) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, variables, True, e) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal includeDS as Boolean) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, includeDS, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, True, Nothing) + End Function + + + Public Overridable Sub RegisterPostback() + + + End Sub + + + + ' To customize, override this method in PersonalExtWorkTableControlRow. + 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 parentCtrl As PersonalIdRecordControl + + + parentCtrl = DirectCast(Me.Page.FindControlRecursively("PersonalIdRecordControl"), PersonalIdRecordControl) + + If (Not IsNothing(parentCtrl) AndAlso IsNothing(parentCtrl.DataSource)) + ' Load the record if it is not loaded yet. + parentCtrl.LoadData() + End If + If (IsNothing(parentCtrl) OrElse IsNothing(parentCtrl.DataSource)) + ' Get the error message from the application resource file. + Throw New Exception(Page.GetResourceValue("Err:NoParentRecId", "Persons")) + End If + + Me.DataSource.PersonalId = parentCtrl.DataSource.PersonalId + + ' 2. Perform any custom validation. + Me.Validate() + + + ' 3. Set the values in the record with data from UI controls. + ' This calls the Get() method for each of the user interface controls. + Me.GetUIData() + + ' 4. Save in the database. + ' We should not save the record if the data did not change. This + ' will save a database hit and avoid triggering any database triggers. + + If Me.DataSource.IsAnyValueChanged Then + ' Save record to database but do not commit yet. + ' Auto generated ids are available after saving for use by child (dependent) records. + Me.DataSource.Save() + + DirectCast(GetParentControlObject(Me, "PersonalExtWorkTableControl"), PersonalExtWorkTableControl).DataChanged = True + DirectCast(GetParentControlObject(Me, "PersonalExtWorkTableControl"), PersonalExtWorkTableControl).ResetData = True + End If + + + ' update session or cookie by formula + + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + ' For Master-Detail relationships, save data on the Detail table(s) + + End Sub + + ' To customize, override this method in PersonalExtWorkTableControlRow. + 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. + + GetActive() + GetBeginDate() + GetCommand1() + GetCommandDate1() + GetDescription() + GetEndDate2() + GetPlace() + End Sub + + + Public Overridable Sub GetActive() + + End Sub + + Public Overridable Sub GetBeginDate() + + End Sub + + Public Overridable Sub GetCommand1() + + End Sub + + Public Overridable Sub GetCommandDate1() + + End Sub + + Public Overridable Sub GetDescription() + + End Sub + + Public Overridable Sub GetEndDate2() + + End Sub + + Public Overridable Sub GetPlace() + + End Sub + + + ' To customize, override this method in PersonalExtWorkTableControlRow. + + Public Overridable Function CreateWhereClause() As WhereClause + + Return Nothing + + End Function + + + + ' To customize, override this method in PersonalExtWorkTableControlRow. + 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) + PersonalExtWorkTable.DeleteRecord(pkValue) + + DirectCast(GetParentControlObject(Me, "PersonalExtWorkTableControl"), PersonalExtWorkTableControl).DataChanged = True + DirectCast(GetParentControlObject(Me, "PersonalExtWorkTableControl"), PersonalExtWorkTableControl).ResetData = True + End Sub + + Protected Overridable Sub Control_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.PreRender + ' PreRender event is raised just before page is being displayed. + Try + DbUtils.StartTransaction() + Me.RegisterPostback() + + If Not Me.Page.ErrorOnPage AndAlso (Me.Page.IsPageRefresh OrElse Me.DataChanged OrElse Me.ResetData) Then + + + ' Re-load the data and update the web page if necessary. + ' This is typically done during a postback (filter, search button, sort, pagination button). + ' In each of the other click handlers, simply set DataChanged to True to reload the data. + Me.LoadData() + Me.DataBind() + End If + + + Catch ex As Exception + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + Finally + DbUtils.EndTransaction() + End Try + End Sub + + + Protected Overrides Sub SaveControlsToSession() + MyBase.SaveControlsToSession() + + + 'Save pagination state to session. + + End Sub + + + + Protected Overrides Sub ClearControlsFromSession() + MyBase.ClearControlsFromSession() + + + + ' Clear pagination state from session. + + End Sub + + Protected Overrides Sub LoadViewState(ByVal savedState As Object) + MyBase.LoadViewState(savedState) + Dim isNewRecord As String = CType(ViewState("IsNewRecord"), String) + If Not isNewRecord Is Nothing AndAlso isNewRecord.Trim <> "" Then + Me.IsNewRecord = Boolean.Parse(isNewRecord) + End If + + Dim myCheckSum As String = CType(ViewState("CheckSum"), String) + If Not myCheckSum Is Nothing AndAlso myCheckSum.Trim <> "" Then + Me.CheckSum = myCheckSum + End If + + + ' Load view state for pagination control. + + End Sub + + Protected Overrides Function SaveViewState() As Object + ViewState("IsNewRecord") = Me.IsNewRecord.ToString() + ViewState("CheckSum") = Me.CheckSum + + + ' Load view state for pagination control. + + Return MyBase.SaveViewState() + End Function + + + + 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("BasePersonalExtWorkTableControlRow_Rec"), String) + End Get + Set(ByVal value As String) + Me.ViewState("BasePersonalExtWorkTableControlRow_Rec") = value + End Set + End Property + + Private _DataSource As PersonalExtWorkRecord + Public Property DataSource() As PersonalExtWorkRecord + Get + Return Me._DataSource + End Get + + Set(ByVal value As PersonalExtWorkRecord) + + Me._DataSource = value + End Set + End Property + + + + Private _checkSum As String + Public Overridable Property CheckSum() As String + Get + Return Me._checkSum + End Get + Set(ByVal value As String) + Me._checkSum = value + End Set + End Property + + Private _TotalPages As Integer + Public Property TotalPages() As Integer + Get + Return Me._TotalPages + End Get + Set(ByVal value As Integer) + Me._TotalPages = value + End Set + End Property + + Private _PageIndex As Integer + Public Property PageIndex() As Integer + Get + ' Return the PageIndex + Return Me._PageIndex + End Get + Set(ByVal value As Integer) + Me._PageIndex = value + End Set + End Property + + Private _DisplayLastPage As Boolean + Public Property DisplayLastPage() As Boolean + Get + Return Me._DisplayLastPage + End Get + Set(ByVal value As Boolean) + Me._DisplayLastPage = value + End Set + End Property + + + +#Region "Helper Properties" + + Public ReadOnly Property Active() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Active"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property BeginDate() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "BeginDate"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property Command1() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Command1"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property CommandDate1() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "CommandDate1"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property Description() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Description"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property EndDate2() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "EndDate2"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property Place() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Place"), 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 PersonalExtWorkRecord = 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 PersonalExtWorkRecord + If Not Me.DataSource Is Nothing Then + Return Me.DataSource + End If + + If Not Me.RecordUniqueId Is Nothing Then + + Return PersonalExtWorkTable.GetRecord(Me.RecordUniqueId, True) + + End If + + ' Localization. + + Return Nothing + + End Function + + Public Shadows ReadOnly Property Page() As BaseApplicationPage + Get + Return DirectCast(MyBase.Page, BaseApplicationPage) + End Get + End Property + +#End Region + +End Class + + + +' Base class for the PersonalExtWorkTableControl control on the ShowPersonalId page. +' Do not modify this class. Instead override any method in PersonalExtWorkTableControl. +Public Class BasePersonalExtWorkTableControl + Inherits Persons.UI.BaseApplicationTableControl + + + + Protected Overridable Sub Control_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Init + + + + ' Setup the filter and search events. + + + + ' Control Initializations. + ' Initialize the table's current sort order. + + If Me.InSession(Me, "Order_By") Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + End If + + + + ' Setup default pagination settings. + + Me.PageSize = CInt(Me.GetFromSession(Me, "Page_Size", "10")) + Me.PageIndex = CInt(Me.GetFromSession(Me, "Page_Index", "0")) + + + + Me.ClearControlsFromSession() + End Sub + + Protected Overridable Sub Control_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load + + SaveControlsToSession_Ajax() + + ' Setup the pagination events. + + AddHandler Me.PersonalExtWorkPagination.FirstPage.Click, AddressOf PersonalExtWorkPagination_FirstPage_Click + + AddHandler Me.PersonalExtWorkPagination.LastPage.Click, AddressOf PersonalExtWorkPagination_LastPage_Click + + AddHandler Me.PersonalExtWorkPagination.NextPage.Click, AddressOf PersonalExtWorkPagination_NextPage_Click + + AddHandler Me.PersonalExtWorkPagination.PageSizeButton.Click, AddressOf PersonalExtWorkPagination_PageSizeButton_Click + + AddHandler Me.PersonalExtWorkPagination.PreviousPage.Click, AddressOf PersonalExtWorkPagination_PreviousPage_Click + + + ' Setup the sorting events. + + AddHandler Me.ActiveLabel.Click, AddressOf ActiveLabel_Click + + AddHandler Me.BeginDateLabel.Click, AddressOf BeginDateLabel_Click + + AddHandler Me.CommandDateLabel1.Click, AddressOf CommandDateLabel1_Click + + AddHandler Me.CommandLabel1.Click, AddressOf CommandLabel1_Click + + AddHandler Me.DescriptionLabel1.Click, AddressOf DescriptionLabel1_Click + + AddHandler Me.EndDateLabel3.Click, AddressOf EndDateLabel3_Click + + AddHandler Me.PlaceLabel1.Click, AddressOf PlaceLabel1_Click + + ' Setup the button events. + + AddHandler Me.PersonalExtWorkExportCSVButton.Click, AddressOf PersonalExtWorkExportCSVButton_Click + + AddHandler Me.PersonalExtWorkExportExcelButton.Click, AddressOf PersonalExtWorkExportExcelButton_Click + + Me.PersonalExtWorkImportButton.PostBackUrl = "../Shared/SelectFileToImport.aspx?TableName=PersonalExtWork" + Me.PersonalExtWorkImportButton.Attributes.Item("onClick") = "window.open('" & Me.Page.EncryptUrlParameter(Me.PersonalExtWorkImportButton.PostBackUrl) & "','importWindow', 'width=700, height=500,top=' +(screen.availHeight-500)/2 + ',left=' + (screen.availWidth-700)/2+ ', resizable=yes, scrollbars=yes,modal=yes'); return false;" + + AddHandler Me.PersonalExtWorkImportButton.Click, AddressOf PersonalExtWorkImportButton_Click + + AddHandler Me.PersonalExtWorkPDFButton.Click, AddressOf PersonalExtWorkPDFButton_Click + + AddHandler Me.PersonalExtWorkRefreshButton.Click, AddressOf PersonalExtWorkRefreshButton_Click + + AddHandler Me.PersonalExtWorkResetButton.Click, AddressOf PersonalExtWorkResetButton_Click + + AddHandler Me.PersonalExtWorkWordButton.Click, AddressOf PersonalExtWorkWordButton_Click + + + ' Setup events for others + + End Sub + + + Public Overridable Sub LoadData() + + ' Read data from database. Returns an array of records that can be assigned + ' to the DataSource table control property. + Try + Dim joinFilter As CompoundFilter = CreateCompoundJoinFilter() + + ' The WHERE clause will be empty when displaying all records in table. + Dim wc As WhereClause = CreateWhereClause() + If wc IsNot Nothing AndAlso Not wc.RunQuery Then + ' Initialize an empty array of records + Dim alist As New ArrayList(0) + Me.DataSource = DirectCast(alist.ToArray(GetType(PersonalExtWorkRecord)), PersonalExtWorkRecord()) + ' Add records to the list if needed. + Me.AddNewRecords() + Me._TotalRecords = 0 + Me._TotalPages = 0 + Return + End If + + ' Call OrderBy to determine the order - either use the order defined + ' on the Query Wizard, or specified by user (by clicking on column heading) + Dim orderBy As OrderBy = CreateOrderBy() + + ' Get the pagesize from the pagesize control. + Me.GetPageSize() + + If Me.DisplayLastPage Then + Dim totalRecords As Integer = If(Me._TotalRecords < 0, PersonalExtWorkTable.GetRecordCount(CreateCompoundJoinFilter(), CreateWhereClause()), Me._TotalRecords) + + Dim totalPages As Integer = CInt(Math.Ceiling(totalRecords / Me.PageSize)) + + Me.PageIndex = totalPages - 1 + End If + + ' Make sure PageIndex (current page) and PageSize are within bounds. + If Me.PageIndex < 0 Then + Me.PageIndex = 0 + End If + If Me.PageSize < 1 Then + Me.PageSize = 1 + End If + + ' Retrieve the records and set the table DataSource. + ' Only PageSize records are fetched starting at PageIndex (zero based). + If Me.AddNewRecord > 0 Then + ' Make sure to preserve the previously entered data on new rows. + Dim postdata As New ArrayList + For Each rc As PersonalExtWorkTableControlRow In Me.GetRecordControls() + If Not rc.IsNewRecord Then + rc.DataSource = rc.GetRecord() + rc.GetUIData() + postdata.Add(rc.DataSource) + UIData.Add(rc.PreservedUIData()) + End If + Next + Me.DataSource = DirectCast(postdata.ToArray(GetType(PersonalExtWorkRecord)), PersonalExtWorkRecord()) + Else ' Get the records from the database + Me.DataSource = PersonalExtWorkTable.GetRecords(joinFilter, wc, orderBy, Me.PageIndex, Me.PageSize) + + End If + + ' if the datasource contains no records contained in database, then load the last page. + If (DbUtils.GetCreatedRecords(Me.DataSource).Length = 0 AndAlso Not Me.DisplayLastPage) Then + Me.DisplayLastPage = True + LoadData() + Else + + ' Add any new rows desired by the user. + Me.AddNewRecords() + + + ' Initialize the page and grand totals. now + + End If + + Catch ex As Exception + ' Report the error message to the end user + Dim msg As String = ex.Message + If ex.InnerException IsNot Nothing Then + msg = msg & " InnerException: " & ex.InnerException.Message + End If + Throw New Exception(msg, ex.InnerException) + End Try + End Sub + + + + + Public Overrides Sub DataBind() + ' The DataBind method binds the user interface controls to the values + ' from the database record for each row in the table. To do this, it calls the + ' DataBind for each of the rows. + ' DataBind also populates any filters above the table, and sets the pagination + ' control to the correct number of records and the current page number. + + MyBase.DataBind() + + ' Make sure that the DataSource is initialized. + If Me.DataSource Is Nothing Then + Return + End If + + 'LoadData for DataSource for chart and report if they exist + + ' Setup the pagination controls. + BindPaginationControls() + + + + ' Bind the repeater with the list of records to expand the UI. + Dim rep As System.Web.UI.WebControls.Repeater = CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalExtWorkTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return + rep.DataSource = DataSource() + rep.DataBind() + + Dim index As Integer = 0 + For Each repItem As System.Web.UI.WebControls.RepeaterItem In rep.Items + ' Loop through all rows in the table, set its DataSource and call DataBind(). + Dim recControl As PersonalExtWorkTableControlRow = DirectCast(repItem.FindControl("PersonalExtWorkTableControlRow"), PersonalExtWorkTableControlRow) + recControl.DataSource = Me.DataSource(index) + If Me.UIData.Count > index Then + recControl.PreviousUIData = Me.UIData(index) + End If + recControl.DataBind() + recControl.Visible = Not Me.InDeletedRecordIds(recControl) + + index += 1 + Next + + + + + ' Call the Set methods for each controls on the panel + + SetActiveLabel() + SetBeginDateLabel() + SetCommandDateLabel1() + SetCommandLabel1() + SetDescriptionLabel1() + SetEndDateLabel3() + + + + + + + + SetPersonalExtWorkTableControlCollapsibleRegion() + + SetPlaceLabel1() + ' setting the state of expand or collapse alternative rows + + + ' Load data for each record and table UI control. + ' Ordering is important because child controls get + ' their parent ids from their parent UI controls. + + + ' this method calls the set method for controls with special formula like running total, sum, rank, etc + SetFormulaControls() + End Sub + + Public Overridable Sub SetFormulaControls() + ' this method calls Set methods for the control that has special formula + + + + End Sub + + + + Public Overridable Sub RegisterPostback() + + Me.Page.RegisterPostBackTrigger(MiscUtils.FindControlRecursively(Me,"PersonalExtWorkExportCSVButton")) + + Me.Page.RegisterPostBackTrigger(MiscUtils.FindControlRecursively(Me,"PersonalExtWorkExportExcelButton")) + + Me.Page.RegisterPostBackTrigger(MiscUtils.FindControlRecursively(Me,"PersonalExtWorkPDFButton")) + + Me.Page.RegisterPostBackTrigger(MiscUtils.FindControlRecursively(Me,"PersonalExtWorkWordButton")) + + + End Sub + + Public EvaluateFormulaDelegate As BaseClasses.Data.DataSource.EvaluateFormulaDelegate = New BaseClasses.Data.DataSource.EvaluateFormulaDelegate(AddressOf Me.EvaluateFormula) + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean, ByVal e as FormulaEvaluator) As String + If e Is Nothing + e = New FormulaEvaluator() + End If + + e.Variables.Clear() + + + ' add variables for formula evaluation + If variables IsNot Nothing Then + Dim enumerator As System.Collections.Generic.IEnumerator(Of System.Collections.Generic.KeyValuePair(Of String, Object)) = variables.GetEnumerator() + While enumerator.MoveNext() + e.Variables.Add(enumerator.Current.Key, enumerator.Current.Value) + End While + End If + + If includeDS + + End If + + ' All variables referred to in the formula are expected to be + ' properties of the DataSource. For example, referring to + ' UnitPrice as a variable will refer to DataSource.UnitPrice + e.DataSource = dataSourceForEvaluate + + ' Define the calling control. This is used to add other + ' related table and record controls as variables. + e.CallingControl = Me + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + + If Not String.IsNullOrEmpty(format) AndAlso (String.IsNullOrEmpty(formula) OrElse formula.IndexOf("Format(") < 0) Then + Return FormulaUtils.Format(resultObj, format) + Else + Return resultObj.ToString() + End If + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format,variables ,includeDS, Nothing) + End Function + + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object)) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format, variables ,True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, format, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal e as FormulaEvaluator) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, variables, True, e) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal includeDS as Boolean) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, includeDS, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, True, Nothing) + End Function + + + + + Public Overridable Sub ResetControl() + + Me.CurrentSortOrder.Reset() + If (Me.InSession(Me, "Order_By")) Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + End If + + Me.PageIndex = 0 + End Sub + + Protected Overridable Sub BindPaginationControls() + ' Setup the pagination controls. + + ' Bind the pagination labels. + + If DbUtils.GetCreatedRecords(Me.DataSource).Length > 0 Then + + Me.PersonalExtWorkPagination.CurrentPage.Text = (Me.PageIndex + 1).ToString() + Else + Me.PersonalExtWorkPagination.CurrentPage.Text = "0" + End If + Me.PersonalExtWorkPagination.PageSize.Text = Me.PageSize.ToString() + Me.PersonalExtWorkPagination.TotalItems.Text = Me.TotalRecords.ToString() + Me.PersonalExtWorkPagination.TotalPages.Text = Me.TotalPages.ToString() + + ' Bind the buttons for PersonalExtWorkTableControl pagination. + + Me.PersonalExtWorkPagination.FirstPage.Enabled = Not (Me.PageIndex = 0) + If Me._TotalPages < 0 Then ' if the total pages is not determined yet, enable last and next buttons + Me.PersonalExtWorkPagination.LastPage.Enabled = True + ElseIf Me._TotalPages = 0 ' if the total pages is determined and it is 0, enable last and next buttons + Me.PersonalExtWorkPagination.LastPage.Enabled = False + Else ' if the total pages is the last page, disable last and next buttons + Me.PersonalExtWorkPagination.LastPage.Enabled = Not (Me.PageIndex = Me.TotalPages - 1) + End If + + If Me._TotalPages < 0 Then ' if the total pages is not determined yet, enable last and next buttons + Me.PersonalExtWorkPagination.NextPage.Enabled = True + ElseIf Me._TotalPages = 0 ' if the total pages is determined and it is 0, enable last and next buttons + Me.PersonalExtWorkPagination.NextPage.Enabled = False + Else ' if the total pages is the last page, disable last and next buttons + Me.PersonalExtWorkPagination.NextPage.Enabled = Not (Me.PageIndex = Me.TotalPages - 1) + End If + + Me.PersonalExtWorkPagination.PreviousPage.Enabled = Not (Me.PageIndex = 0) + + + End Sub + + Public Overridable Sub SaveData() + ' Save the data from the entire table. Calls each row's Save Data + ' to save their data. This function is called by the Click handler of the + ' Save button. The button handler should Start/Commit/End a transaction. + + Dim recCtl As PersonalExtWorkTableControlRow + For Each recCtl In Me.GetRecordControls() + + If Me.InDeletedRecordIds(recCtl) Then + ' Delete any pending deletes. + recCtl.Delete() + Else + If recCtl.Visible Then + recCtl.SaveData() + End If + End If + + Next + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + ' Set IsNewRecord to False for all records - since everything has been saved and is no longer "new" + For Each recCtl In Me.GetRecordControls() + recCtl.IsNewRecord = False + Next + + + ' Set DeletedRecordsIds to Nothing since we have deleted all pending deletes. + Me.DeletedRecordIds = Nothing + + End Sub + + Public Overridable Function CreateCompoundJoinFilter() As CompoundFilter + Dim jFilter As CompoundFilter = New CompoundFilter() + + Return jFilter + + End Function + + + Public Overridable Function CreateOrderBy() As OrderBy + ' The CurrentSortOrder is initialized to the sort order on the + ' Query Wizard. It may be modified by the Click handler for any of + ' the column heading to sort or reverse sort by that column. + ' You can add your own sort order, or modify it on the Query Wizard. + Return Me.CurrentSortOrder + End Function + + Public Overridable Function CreateWhereClause() As WhereClause + 'This CreateWhereClause is used for loading the data. + PersonalExtWorkTable.Instance.InnerFilter = Nothing + Dim wc As WhereClause = New WhereClause() + + ' Compose the WHERE clause consiting of: + ' 1. Static clause defined at design time. + ' 2. User selected search criteria. + ' 3. User selected filter criteria. + + + Dim selectedRecordKeyValue as KeyValue = New KeyValue() + + Dim personalIdRecordControlObj As Persons.UI.Controls.ShowPersonalId.PersonalIdRecordControl = DirectCast(MiscUtils.FindControlRecursively(Me.Page, "PersonalIdRecordControl"), Persons.UI.Controls.ShowPersonalId.PersonalIdRecordControl) + + If (Not IsNothing(personalIdRecordControlObj) AndAlso Not IsNothing(personalIdRecordControlObj.GetRecord()) AndAlso personalIdRecordControlObj.GetRecord().IsCreated AndAlso Not IsNothing(personalIdRecordControlObj.GetRecord().PersonalId)) + wc.iAND(PersonalExtWorkTable.PersonalId, BaseFilter.ComparisonOperator.EqualsTo, personalIdRecordControlObj.GetRecord().PersonalId.ToString()) + selectedRecordKeyValue.AddElement(PersonalExtWorkTable.PersonalId.InternalName, personalIdRecordControlObj.GetRecord().PersonalId.ToString()) + Else + wc.RunQuery = False + Return wc + End If + + HttpContext.Current.Session("PersonalExtWorkTableControlWhereClause") = selectedRecordKeyValue.ToXmlString() + + Return wc + End Function + + + Public Overridable Function CreateWhereClause(ByVal searchText as String, ByVal fromSearchControl as String, ByVal AutoTypeAheadSearch as String, ByVal AutoTypeAheadWordSeparators as String) As WhereClause + ' This CreateWhereClause is used for loading list of suggestions for Auto Type-Ahead feature. + PersonalExtWorkTable.Instance.InnerFilter = Nothing + Dim wc As WhereClause = New WhereClause() + + ' Compose the WHERE clause consiting of: + ' 1. Static clause defined at design time. + ' 2. User selected search criteria. + ' 3. User selected filter criteria. + + Dim appRelativeVirtualPath As String = CType(HttpContext.Current.Session("AppRelativeVirtualPath"), String) + + Dim selectedRecordInPersonalIdRecordControl as String = DirectCast(HttpContext.Current.Session("PersonalExtWorkTableControlWhereClause"), String) + + If Not selectedRecordInPersonalIdRecordControl Is Nothing AndAlso KeyValue.IsXmlKey(selectedRecordInPersonalIdRecordControl) Then + Dim selectedRecordKeyValue as KeyValue = KeyValue.XmlToKey(selectedRecordInPersonalIdRecordControl) + + If Not IsNothing(selectedRecordKeyValue) AndAlso selectedRecordKeyValue.ContainsColumn(PersonalExtWorkTable.PersonalId) Then + wc.iAND(PersonalExtWorkTable.PersonalId, BaseFilter.ComparisonOperator.EqualsTo, selectedRecordKeyValue.GetColumnValue(PersonalExtWorkTable.PersonalId).ToString()) + End If + + End If + + ' Adds clauses if values are selected in Filter controls which are configured in the page. + + + Return wc + End Function + + + Public Overridable Function FormatSuggestions(ByVal prefixText As String, ByVal resultItem As String, _ + ByVal columnLength As Integer, ByVal AutoTypeAheadDisplayFoundText As String, _ + ByVal autoTypeAheadSearch As String, ByVal AutoTypeAheadWordSeparators As String, _ + ByVal resultList As ArrayList) As Boolean + + 'Formats the resultItem and adds it to the list of suggestions. + Dim index As Integer = resultItem.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture).IndexOf(prefixText.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture)) + Dim itemToAdd As String = "" + Dim isFound As Boolean = False + Dim isAdded As Boolean = False + ' Get the index where prfixt is at the beginning of resultItem. If not found then, index of word which begins with prefixText. + If InvariantLCase(autoTypeAheadSearch).equals("wordsstartingwithsearchstring") And Not index = 0 Then + ' Expression to find word which contains AutoTypeAheadWordSeparators followed by prefixText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex( AutoTypeAheadWordSeparators + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + If regex1.IsMatch(resultItem) Then + index = regex1.Match(resultItem).Index + isFound = True + End If + ' If the prefixText is found immediatly after white space then starting of the word is found so don not search any further + If not resultItem(index).ToString() = " " Then + ' Expression to find beginning of the word which contains AutoTypeAheadWordSeparators followed by prefixText + Dim regex As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\\S*" + AutoTypeAheadWordSeparators + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + If regex.IsMatch(resultItem) Then + index = regex.Match(resultItem).Index + isFound = True + End If + End If + End If + + ' If autoTypeAheadSearch value is wordsstartingwithsearchstring then, extract the substring only if the prefixText is found at the + ' beginning of the resultItem (index = 0) or a word in resultItem is found starts with prefixText. + If index = 0 Or isFound Or InvariantLCase(autoTypeAheadSearch).Equals("anywhereinstring") then + If InvariantLCase(AutoTypeAheadDisplayFoundText).equals("atbeginningofmatchedstring") Then + ' Expression to find beginning of the word which contains prefixText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\\S*" + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + ' Find the beginning of the word which contains prefexText + If (StringUtils.InvariantLCase(autoTypeAheadSearch).Equals("anywhereinstring") AndAlso regex1.IsMatch(resultItem)) Then + index = regex1.Match(resultItem).Index + isFound = True + End If + ' Display string from the index till end of the string if sub string from index till end is less than columnLength value. + If Len(resultItem) - index <= columnLength Then + If index = 0 Then + itemToAdd = resultItem + Else + itemToAdd = "..." & resultItem.Substring(index, Len(resultItem) - index) + End If + Else + If index = 0 Then + itemToAdd = resultItem.Substring(index, (columnLength - 3)) & "..." + Else + 'Truncate the string to show only columnLength - 6 characters as begining and trailing "..." has to be appended. + itemToAdd = "..." & resultItem.Substring(index , columnLength - 6) & "..." + End If + End If + ElseIf InvariantLCase(AutoTypeAheadDisplayFoundText).equals("inmiddleofmatchedstring") Then + Dim subStringBeginIndex As Integer = CType(columnLength/2, Integer) + If Len(resultItem) <= columnLength Then + itemToAdd = resultItem + Else + ' Sanity check at end of the string + If index + Len(prefixText) = columnLength Then + itemToAdd = "..." & resultItem.Substring(index-columnLength,index) + ElseIf Len(resultItem) - index < subStringBeginIndex Then + ' Display string from the end till columnLength value if, index is closer to the end of the string. + itemToAdd = "..." & resultItem.Substring(Len(resultItem)-columnLength,Len(resultItem)) + ElseIf index <= subStringBeginIndex Then + ' Sanity chet at beginning of the string + itemToAdd = resultItem.Substring(0, columnLength) & "..." + Else + ' Display string containing text before the prefixText occures and text after the prefixText + itemToAdd = "..." & resultItem.Substring(index - subStringBeginIndex, columnLength) & "..." + End If + End If + ElseIf InvariantLCase(AutoTypeAheadDisplayFoundText).equals("atendofmatchedstring") Then + ' Expression to find ending of the word which contains prefexText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\s", System.Text.RegularExpressions.RegexOptions.IgnoreCase) + ' Find the ending of the word which contains prefexText + If regex1.IsMatch(resultItem, index + 1) Then + index = regex1.Match(resultItem, index + 1).Index + Else + ' If the word which contains prefexText is the last word in string, regex1.IsMatch returns false. + index = resultItem.Length + End If + If index > Len(resultItem) Then + index = Len(resultItem) + End If + ' If text from beginning of the string till index is less than columnLength value then, display string from the beginning till index. + If index <= columnLength Then + if index = Len(resultItem) Then 'Make decision to append "..." + itemToAdd = resultItem.Substring(0,index) + Else + itemToAdd = resultItem.Substring(0,index) & "..." + End If + Else + If index = Len(resultItem) Then + itemToAdd = "..." & resultItem.Substring(index - (columnLength - 3), (columnLength - 3)) + Else + 'Truncate the string to show only columnLength - 6 characters as begining and trailing "..." has to be appended. + itemToAdd = "..." & resultItem.Substring(index - (columnLength - 6), columnLength - 6) & "..." + End If + End If + End If + + ' Remove newline character from itemToAdd + Dim prefixTextIndex As Integer = itemToAdd.IndexOf(prefixText, StringComparison.CurrentCultureIgnoreCase) + ' If itemToAdd contains any newline after the search text then show text only till newline + Dim regex2 As System.Text.RegularExpressions.Regex = New System.Text.RegularExpressions.Regex("(" & vbCrLf & "|" & vbLf & ")", System.Text.RegularExpressions.RegexOptions.IgnoreCase) + Dim newLineIndexAfterPrefix As Integer = -1 + If regex2.IsMatch(itemToAdd, prefixTextIndex) Then + newLineIndexAfterPrefix = regex2.Match(itemToAdd, prefixTextIndex).Index + End If + If (newLineIndexAfterPrefix > -1) Then + If itemToAdd.EndsWith("...") Then + itemToAdd = (itemToAdd.Substring(0, newLineIndexAfterPrefix) + "...") + Else + itemToAdd = itemToAdd.Substring(0, newLineIndexAfterPrefix) + End If + End If + ' If itemToAdd contains any newline before search text then show text which comes after newline + Dim regex3 As System.Text.RegularExpressions.Regex = New System.Text.RegularExpressions.Regex("(" & vbCrLf & "|" & vbLf & ")", (System.Text.RegularExpressions.RegexOptions.IgnoreCase Or System.Text.RegularExpressions.RegexOptions.RightToLeft)) + Dim newLineIndexBeforePrefix As Integer = -1 + If regex3.IsMatch(itemToAdd, prefixTextIndex) Then + newLineIndexBeforePrefix = regex3.Match(itemToAdd, prefixTextIndex).Index + End If + If (newLineIndexBeforePrefix > -1) Then + If itemToAdd.StartsWith("...") Then + itemToAdd = ("..." + itemToAdd.Substring((newLineIndexBeforePrefix + regex3.Match(itemToAdd, prefixTextIndex).Length))) + Else + itemToAdd = itemToAdd.Substring((newLineIndexBeforePrefix + regex3.Match(itemToAdd, prefixTextIndex).Length)) + End If + End If + + If Not itemToAdd is nothing AndAlso Not resultList.Contains(itemToAdd) Then + + resultList.Add(itemToAdd) + + isAdded = true + End If + End If + Return isAdded + End Function + + + Protected Overridable Sub GetPageSize() + + If Me.PersonalExtWorkPagination.PageSize.Text.Trim <> "" Then + Try + 'Me.PageSize = Integer.Parse(Me.PersonalExtWorkPagination.PageSize.Text) + Catch ex As Exception + End Try + End If + End Sub + + Protected Overridable Sub AddNewRecords() + + Dim newRecordList As ArrayList = New ArrayList() + + Dim newUIDataList As System.Collections.Generic.List(Of Hashtable) = New System.Collections.Generic.List(Of Hashtable)() + + ' Loop though all the record controls and if the record control + ' does not have a unique record id set, then create a record + ' and add to the list. + If Not Me.ResetData Then + Dim rep As System.Web.UI.WebControls.Repeater = CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalExtWorkTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return + + Dim repItem As System.Web.UI.WebControls.RepeaterItem + For Each repItem In rep.Items + ' Loop through all rows in the table, set its DataSource and call DataBind(). + + Dim recControl As PersonalExtWorkTableControlRow = DirectCast(repItem.FindControl("PersonalExtWorkTableControlRow"), PersonalExtWorkTableControlRow) + + If recControl.Visible AndAlso recControl.IsNewRecord() Then + + Dim rec As PersonalExtWorkRecord = New PersonalExtWorkRecord() + + If recControl.Active.Text <> "" Then + rec.Parse(recControl.Active.Text, PersonalExtWorkTable.Active) + End If + If recControl.BeginDate.Text <> "" Then + rec.Parse(recControl.BeginDate.Text, PersonalExtWorkTable.BeginDate) + End If + If recControl.Command1.Text <> "" Then + rec.Parse(recControl.Command1.Text, PersonalExtWorkTable.Command) + End If + If recControl.CommandDate1.Text <> "" Then + rec.Parse(recControl.CommandDate1.Text, PersonalExtWorkTable.CommandDate) + End If + If recControl.Description.Text <> "" Then + rec.Parse(recControl.Description.Text, PersonalExtWorkTable.Description) + End If + If recControl.EndDate2.Text <> "" Then + rec.Parse(recControl.EndDate2.Text, PersonalExtWorkTable.EndDate) + End If + If recControl.Place.Text <> "" Then + rec.Parse(recControl.Place.Text, PersonalExtWorkTable.Place) + End If + newUIDataList.Add(recControl.PreservedUIData()) + newRecordList.Add(rec) + End If + Next + End If + + + ' Add any new record to the list. + Dim index As Integer = 0 + For index = 1 To Me.AddNewRecord + + newRecordList.Insert(0, New PersonalExtWorkRecord()) + newUIDataList.Insert(0, New Hashtable()) + + Next + Me.AddNewRecord = 0 + + ' Finally, add any new records to the DataSource. + If newRecordList.Count > 0 Then + + Dim finalList As ArrayList = New ArrayList(Me.DataSource) + finalList.InsertRange(0, newRecordList) + + Me.DataSource = DirectCast(finalList.ToArray(GetType(PersonalExtWorkRecord)), PersonalExtWorkRecord()) + + End If + + ' Add the existing UI data to this hash table + If newUIDataList.Count > 0 Then + Me.UIData.InsertRange(0, newUIDataList) + End If + + End Sub + + + Public Sub AddToDeletedRecordIds(ByVal rec As PersonalExtWorkTableControlRow) + If rec.IsNewRecord() Then + Return + End If + + If Not Me.DeletedRecordIds Is Nothing AndAlso Me.DeletedRecordIds.Trim <> "" Then + Me.DeletedRecordIds &= "," + End If + + Me.DeletedRecordIds &= "[" & rec.RecordUniqueId & "]" + End Sub + + Protected Overridable Function InDeletedRecordIds(ByVal rec As PersonalExtWorkTableControlRow) As Boolean + If Me.DeletedRecordIds Is Nothing OrElse Me.DeletedRecordIds.Trim = "" Then + Return False + End If + + Return Me.DeletedRecordIds.IndexOf("[" & rec.RecordUniqueId & "]") >= 0 + End Function + + Private _DeletedRecordIds As String + Public Property DeletedRecordIds() As String + Get + Return Me._DeletedRecordIds + End Get + Set(ByVal value As String) + Me._DeletedRecordIds = value + End Set + End Property + + + ' Create Set, WhereClause, and Populate Methods + + Public Overridable Sub SetActiveLabel() + + End Sub + + Public Overridable Sub SetBeginDateLabel() + + End Sub + + Public Overridable Sub SetCommandDateLabel1() + + End Sub + + Public Overridable Sub SetCommandLabel1() + + End Sub + + Public Overridable Sub SetDescriptionLabel1() + + End Sub + + Public Overridable Sub SetEndDateLabel3() + + End Sub + + Public Overridable Sub SetPersonalExtWorkTableControlCollapsibleRegion() + + End Sub + + Public Overridable Sub SetPlaceLabel1() + + End Sub + + + + + Protected Overridable Sub Control_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.PreRender + ' PreRender event is raised just before page is being displayed. + Try + DbUtils.StartTransaction + Me.RegisterPostback() + + If Not Me.Page.ErrorOnPage AndAlso (Me.Page.IsPageRefresh OrElse Me.DataChanged OrElse Me.ResetData) Then + + + ' Re-load the data and update the web page if necessary. + ' This is typically done during a postback (filter, search button, sort, pagination button). + ' In each of the other click handlers, simply set DataChanged to True to reload the data. + + Me.LoadData() + Me.DataBind() + + End If + + + + Catch ex As Exception + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + Finally + DbUtils.EndTransaction + End Try + End Sub + + + Protected Overrides Sub SaveControlsToSession() + MyBase.SaveControlsToSession() + + ' Save filter controls to values to session. + + + 'Save pagination state to session. + + + + ' Save table control properties to the session. + If Not Me.CurrentSortOrder Is Nothing Then + Me.SaveToSession(Me, "Order_By", Me.CurrentSortOrder.ToXmlString()) + End If + + Me.SaveToSession(Me, "Page_Index", Me.PageIndex.ToString()) + Me.SaveToSession(Me, "Page_Size", Me.PageSize.ToString()) + + Me.SaveToSession(Me, "DeletedRecordIds", Me.DeletedRecordIds) + + End Sub + + Protected Sub SaveControlsToSession_Ajax() + ' Save filter controls to values to session. + + HttpContext.Current.Session("AppRelativeVirtualPath") = Me.Page.AppRelativeVirtualPath + + End Sub + + Protected Overrides Sub ClearControlsFromSession() + MyBase.ClearControlsFromSession() + + ' Clear filter controls values from the session. + + + ' Clear pagination state from session. + + + + ' Clear table properties from the session. + Me.RemoveFromSession(Me, "Order_By") + Me.RemoveFromSession(Me, "Page_Index") + Me.RemoveFromSession(Me, "Page_Size") + + Me.RemoveFromSession(Me, "DeletedRecordIds") + + End Sub + + Protected Overrides Sub LoadViewState(ByVal savedState As Object) + MyBase.LoadViewState(savedState) + + Dim orderByStr As String = CType(ViewState("PersonalExtWorkTableControl_OrderBy"), String) + + If orderByStr IsNot Nothing AndAlso orderByStr.Trim <> "" Then + Me.CurrentSortOrder = BaseClasses.Data.OrderBy.FromXmlString(orderByStr) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + End If + + Dim pageIndex As String = CType(ViewState("Page_Index"), String) + If pageIndex IsNot Nothing Then + Me.PageIndex = CInt(pageIndex) + End If + + Dim pageSize As String = CType(ViewState("Page_Size"), String) + If Not pageSize Is Nothing Then + Me.PageSize = CInt(pageSize) + End If + + + + ' Load view state for pagination control. + + Me.DeletedRecordIds = CType(Me.ViewState("DeletedRecordIds"), String) + + End Sub + + Protected Overrides Function SaveViewState() As Object + + If Me.CurrentSortOrder IsNot Nothing Then + Me.ViewState("PersonalExtWorkTableControl_OrderBy") = Me.CurrentSortOrder.ToXmlString() + End If + + Me.ViewState("Page_Index") = Me.PageIndex + Me.ViewState("Page_Size") = Me.PageSize + + Me.ViewState("DeletedRecordIds") = Me.DeletedRecordIds + + + ' Load view state for pagination control. + + + Return MyBase.SaveViewState() + End Function + + ' Generate the event handling functions for pagination events. + + ' event handler for ImageButton + Public Overridable Sub PersonalExtWorkPagination_FirstPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.PageIndex = 0 + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalExtWorkPagination_LastPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.DisplayLastPage = True + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalExtWorkPagination_NextPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.PageIndex += 1 + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for LinkButton + Public Overridable Sub PersonalExtWorkPagination_PageSizeButton_Click(ByVal sender As Object, ByVal args As EventArgs) + + Try + + Me.DataChanged = True + + Me.PageSize = Integer.Parse(Me.PersonalExtWorkPagination.PageSize.Text) + + Me.PageIndex = Integer.Parse(Me.PersonalExtWorkPagination.CurrentPage.Text) - 1 + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalExtWorkPagination_PreviousPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + If Me.PageIndex > 0 Then + Me.PageIndex -= 1 + Me.DataChanged = True + End If + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + + ' Generate the event handling functions for sorting events. + + Public Overridable Sub ActiveLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by Active when clicked. + + ' Get previous sorting state for Active. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalExtWorkTable.Active) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for Active. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalExtWorkTable.Active, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by Active, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub BeginDateLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by BeginDate when clicked. + + ' Get previous sorting state for BeginDate. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalExtWorkTable.BeginDate) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for BeginDate. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalExtWorkTable.BeginDate, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by BeginDate, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub CommandDateLabel1_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by CommandDate when clicked. + + ' Get previous sorting state for CommandDate. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalExtWorkTable.CommandDate) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for CommandDate. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalExtWorkTable.CommandDate, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by CommandDate, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub CommandLabel1_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by Command when clicked. + + ' Get previous sorting state for Command. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalExtWorkTable.Command) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for Command. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalExtWorkTable.Command, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by Command, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub DescriptionLabel1_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by Description when clicked. + + ' Get previous sorting state for Description. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalExtWorkTable.Description) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for Description. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalExtWorkTable.Description, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by Description, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub EndDateLabel3_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by EndDate when clicked. + + ' Get previous sorting state for EndDate. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalExtWorkTable.EndDate) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for EndDate. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalExtWorkTable.EndDate, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by EndDate, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub PlaceLabel1_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by Place when clicked. + + ' Get previous sorting state for Place. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalExtWorkTable.Place) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for Place. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalExtWorkTable.Place, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by Place, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + + ' Generate the event handling functions for button events. + + ' event handler for ImageButton + Public Overridable Sub PersonalExtWorkExportCSVButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + ' Build the where clause based on the current filter and search criteria + ' Create the Order By clause based on the user's current sorting preference. + + Dim wc As WhereClause = CreateWhereClause + Dim orderBy As OrderBy = Nothing + + orderBy = CreateOrderBy + + ' Add each of the columns in order of export. + Dim columns() as BaseColumn = New BaseColumn() { _ + PersonalExtWorkTable.Description, _ + PersonalExtWorkTable.Place, _ + PersonalExtWorkTable.Active, _ + PersonalExtWorkTable.BeginDate, _ + PersonalExtWorkTable.EndDate, _ + PersonalExtWorkTable.Command, _ + PersonalExtWorkTable.CommandDate, _ + Nothing} + Dim exportData as ExportDataToCSV = New ExportDataToCSV(PersonalExtWorkTable.Instance, wc, orderBy, columns) + + Dim done As Boolean = False + + Dim totalRowsReturned As Integer = 0 + Dim join As CompoundFilter = CreateCompoundJoinFilter() + Dim data As DataForExport = New DataForExport(PersonalExtWorkTable.Instance, wc, orderBy, columns, join) + + 'Check for Export Data Threshold + Dim exportRawValues As Boolean = False + Me.TotalRecords = PersonalExtWorkTable.GetRecordCount(join, wc) + If Me.TotalRecords > 10000 Then + exportRawValues = True + End If + exportData.StartExport(Me.Page.Response, exportRawValues) + + ' Read pageSize records at a time and write out the CSV file. + While (Not done) + Dim recList As ArrayList = data.GetRows(exportData.pageSize) + If recList Is Nothing Then + Exit While 'no more records we are done + End If + + totalRowsReturned = recList.Count + For Each rec As BaseRecord In recList + For Each col As BaseColumn In data.ColumnList + If col Is Nothing Then + Continue For + End If + + If Not data.IncludeInExport(col) Then + Continue For + End If + + Dim val As String = "" + + If exportRawValues Then + val = rec.GetValue(col).ToString() + Else + Dim _isExpandableNonCompositeForeignKey As Boolean = col.TableDefinition.IsExpandableNonCompositeForeignKey(col) + If _isExpandableNonCompositeForeignKey AndAlso col.IsApplyDisplayAs Then + val = PersonalExtWorkTable.GetDFKA(rec.GetValue(col).ToString(), col, Nothing) + End If + If (Not _isExpandableNonCompositeForeignKey) Or (String.IsNullOrEmpty(val)) Then + val = exportData.GetDataForExport(col, rec) + End If + End If + exportData.WriteColumnData(val, data.IsString(col)) + + Next col + exportData.WriteNewRow() + Next rec + + ' If we already are below the pageSize, then we are done. + If totalRowsReturned < exportData.pageSize Then + done = True + End If + End While + exportData.FinishExport(Me.Page.Response) + + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalExtWorkExportExcelButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + ' To customize the columns or the format, override this function in Section 1 of the page + ' and modify it to your liking. + ' Build the where clause based on the current filter and search criteria + ' Create the Order By clause based on the user's current sorting preference. + + Dim wc As WhereClause = CreateWhereClause + Dim orderBy As OrderBy = Nothing + + orderBy = CreateOrderBy + + Dim done As Boolean = False + Dim val As Object = "" + ' Read pageSize records at a time and write out the Excel file. + Dim totalRowsReturned As Integer = 0 + + Me.TotalRecords = PersonalExtWorkTable.GetRecordCount(wc) + If Me.TotalRecords > 10000 Then + + ' Add each of the columns in order of export. + Dim columns() as BaseColumn = New BaseColumn() { _ + PersonalExtWorkTable.Description, _ + PersonalExtWorkTable.Place, _ + PersonalExtWorkTable.Active, _ + PersonalExtWorkTable.BeginDate, _ + PersonalExtWorkTable.EndDate, _ + PersonalExtWorkTable.Command, _ + PersonalExtWorkTable.CommandDate, _ + Nothing} + Dim exportData as ExportDataToCSV = New ExportDataToCSV(PersonalExtWorkTable.Instance, wc, orderBy, columns) + exportData.StartExport(Me.Page.Response, True) + + Dim dataForCSV As DataForExport = New DataForExport(PersonalExtWorkTable.Instance, wc, orderBy, columns) + + ' Read pageSize records at a time and write out the CSV file. + While (Not done) + Dim recList As ArrayList = dataForCSV.GetRows(exportData.pageSize) + If recList Is Nothing Then + Exit While 'no more records we are done + End If + + totalRowsReturned = recList.Count + For Each rec As BaseRecord In recList + For Each col As BaseColumn In dataForCSV.ColumnList + If col Is Nothing Then + Continue For + End If + + If Not dataForCSV.IncludeInExport(col) Then + Continue For + End If + + val = rec.GetValue(col).ToString() + exportData.WriteColumnData(val, dataForCSV.IsString(col)) + + Next col + exportData.WriteNewRow() + Next rec + + ' If we already are below the pageSize, then we are done. + If totalRowsReturned < exportData.pageSize Then + done = True + End If + End While + exportData.FinishExport(Me.Page.Response) + Else + + ' Create an instance of the Excel report class with the table class, where clause and order by. + Dim excelReport As ExportDataToExcel = New ExportDataToExcel(PersonalExtWorkTable.Instance, wc, orderBy) + ' Add each of the columns in order of export. + ' To customize the data type, change the second parameter of the new ExcelColumn to be + ' a format string from Excel's Format Cell menu. For example "dddd, mmmm dd, yyyy h:mm AM/PM;@", "#,##0.00" + + If Me.Page.Response Is Nothing Then + Return + End If + + excelReport.CreateExcelBook() + + Dim width As Integer = 0 + Dim columnCounter As Integer = 0 + Dim data As DataForExport = New DataForExport(PersonalExtWorkTable.Instance, wc, orderBy, Nothing) + data.ColumnList.Add(New ExcelColumn(PersonalExtWorkTable.Description, "Default")) + data.ColumnList.Add(New ExcelColumn(PersonalExtWorkTable.Place, "Default")) + data.ColumnList.Add(New ExcelColumn(PersonalExtWorkTable.Active, "Default")) + data.ColumnList.Add(New ExcelColumn(PersonalExtWorkTable.BeginDate, "Short Date")) + data.ColumnList.Add(New ExcelColumn(PersonalExtWorkTable.EndDate, "Short Date")) + data.ColumnList.Add(New ExcelColumn(PersonalExtWorkTable.Command, "Default")) + data.ColumnList.Add(New ExcelColumn(PersonalExtWorkTable.CommandDate, "Short Date")) + + + For Each col As ExcelColumn In data.ColumnList + width = excelReport.GetExcelCellWidth(col) + If data.IncludeInExport(col) Then + excelReport.AddColumnToExcelBook(columnCounter, col.ToString(), excelReport.GetExcelDataType(col), width, excelReport.GetDisplayFormat(col)) + columnCounter = columnCounter + 1 + End If + Next col + + While (Not done) + Dim recList As ArrayList = data.GetRows(excelReport.pageSize) + + If recList Is Nothing Then + Exit While 'no more records we are done + End If + + totalRowsReturned = recList.Count + + For Each rec As BaseRecord In recList + excelReport.AddRowToExcelBook() + columnCounter = 0 + + For Each col As ExcelColumn In data.ColumnList + If Not data.IncludeInExport(col) Then + Continue For + End If + + Dim _isExpandableNonCompositeForeignKey As Boolean = col.DisplayColumn.TableDefinition.IsExpandableNonCompositeForeignKey(col.DisplayColumn) + If _isExpandableNonCompositeForeignKey AndAlso col.DisplayColumn.IsApplyDisplayAs Then + val = PersonalExtWorkTable.GetDFKA(rec.GetValue(col.DisplayColumn).ToString(), col.DisplayColumn, Nothing) + If val Is Nothing Then + val = rec.Format(col.DisplayColumn) + End If + Else + val = excelReport.GetValueForExcelExport(col, rec) + End If + excelReport.AddCellToExcelRow(columnCounter, excelReport.GetExcelDataType(col), val, col.DisplayFormat) + + columnCounter = columnCounter + 1 + Next col + Next rec + + ' If we already are below the pageSize, then we are done. + If totalRowsReturned < excelReport.pageSize Then + done = True + End If + End While + + excelReport.SaveExcelBook(Me.Page.Response) + End If + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalExtWorkImportButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalExtWorkPDFButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + Dim report As PDFReport = New PDFReport() + report.SpecificReportFileName = Page.Server.MapPath("ShowPersonalId.PersonalExtWorkPDFButton.report") + ' report.Title replaces the value tag of page header and footer containing ${ReportTitle} + report.Title = "PersonalExtWork" + ' If ShowPersonalId.PersonalExtWorkPDFButton.report specifies a valid report template, + ' AddColumn method will generate a report template. + ' Each AddColumn method-call specifies a column + ' The 1st parameter represents the text of the column header + ' The 2nd parameter represents the horizontal alignment of the column header + ' The 3rd parameter represents the text format of the column detail + ' The 4th parameter represents the horizontal alignment of the column detail + ' The 5th parameter represents the relative width of the column + report.AddColumn(PersonalExtWorkTable.Description.Name, ReportEnum.Align.Left, "${Description}", ReportEnum.Align.Left, 30) + report.AddColumn(PersonalExtWorkTable.Place.Name, ReportEnum.Align.Left, "${Place}", ReportEnum.Align.Left, 30) + report.AddColumn(PersonalExtWorkTable.Active.Name, ReportEnum.Align.Left, "${Active}", ReportEnum.Align.Left, 15) + report.AddColumn(PersonalExtWorkTable.BeginDate.Name, ReportEnum.Align.Left, "${BeginDate}", ReportEnum.Align.Left, 20) + report.AddColumn(PersonalExtWorkTable.EndDate.Name, ReportEnum.Align.Left, "${EndDate}", ReportEnum.Align.Left, 20) + report.AddColumn(PersonalExtWorkTable.Command.Name, ReportEnum.Align.Left, "${Command}", ReportEnum.Align.Left, 30) + report.AddColumn(PersonalExtWorkTable.CommandDate.Name, ReportEnum.Align.Left, "${CommandDate}", ReportEnum.Align.Left, 20) + + + Dim rowsPerQuery As Integer = 5000 + Dim recordCount As Integer = 0 + + report.Page = Page.GetResourceValue("Txt:Page", "Persons") + report.ApplicationPath = Me.Page.MapPath(Page.Request.ApplicationPath) + + Dim whereClause As WhereClause = CreateWhereClause + Dim orderBy As OrderBy = CreateOrderBy + Dim joinFilter As BaseFilter = CreateCompoundJoinFilter() + + Dim pageNum As Integer = 0 + Dim totalRows As Integer = PersonalExtWorkTable.GetRecordCount(joinFilter,whereClause) + Dim columns As ColumnList = PersonalExtWorkTable.GetColumnList() + Dim records As PersonalExtWorkRecord() = Nothing + + Do + + records = PersonalExtWorkTable.GetRecords(joinFilter,whereClause, orderBy, pageNum, rowsPerQuery) + If Not (records Is Nothing) AndAlso records.Length > 0 AndAlso whereClause.RunQuery Then + For Each record As PersonalExtWorkRecord In records + + ' AddData method takes four parameters + ' The 1st parameters represent the data format + ' The 2nd parameters represent the data value + ' The 3rd parameters represent the default alignment of column using the data + ' The 4th parameters represent the maximum length of the data value being shown + report.AddData("${Description}", record.Format(PersonalExtWorkTable.Description), ReportEnum.Align.Left, 100) + report.AddData("${Place}", record.Format(PersonalExtWorkTable.Place), ReportEnum.Align.Left, 100) + report.AddData("${Active}", record.Format(PersonalExtWorkTable.Active), ReportEnum.Align.Left, 100) + report.AddData("${BeginDate}", record.Format(PersonalExtWorkTable.BeginDate), ReportEnum.Align.Left, 100) + report.AddData("${EndDate}", record.Format(PersonalExtWorkTable.EndDate), ReportEnum.Align.Left, 100) + report.AddData("${Command}", record.Format(PersonalExtWorkTable.Command), ReportEnum.Align.Left, 100) + report.AddData("${CommandDate}", record.Format(PersonalExtWorkTable.CommandDate), ReportEnum.Align.Left, 100) + + report.WriteRow + Next + pageNum = pageNum + 1 + recordCount += records.Length + End If + Loop While Not (records Is Nothing) AndAlso recordCount < totalRows AndAlso whereClause.RunQuery + + report.Close + BaseClasses.Utils.NetUtils.WriteResponseBinaryAttachment(Me.Page.Response, report.Title + ".pdf", report.ReportInByteArray, 0, true) + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalExtWorkRefreshButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Dim PersonalDDTableControlObj as PersonalDDTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalDDTableControl"), PersonalDDTableControl) + PersonalDDTableControlObj.ResetData = True + + PersonalDDTableControlObj.RemoveFromSession(PersonalDDTableControlObj, "DeletedRecordIds") + PersonalDDTableControlObj.DeletedRecordIds = Nothing + + Dim PersonalEducationTableControlObj as PersonalEducationTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalEducationTableControl"), PersonalEducationTableControl) + PersonalEducationTableControlObj.ResetData = True + + PersonalEducationTableControlObj.RemoveFromSession(PersonalEducationTableControlObj, "DeletedRecordIds") + PersonalEducationTableControlObj.DeletedRecordIds = Nothing + + Dim PersonalExtWorkTableControlObj as PersonalExtWorkTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalExtWorkTableControl"), PersonalExtWorkTableControl) + PersonalExtWorkTableControlObj.ResetData = True + + PersonalExtWorkTableControlObj.RemoveFromSession(PersonalExtWorkTableControlObj, "DeletedRecordIds") + PersonalExtWorkTableControlObj.DeletedRecordIds = Nothing + + Dim PersonalIdRecordControlObj as PersonalIdRecordControl = DirectCast(Me.Page.FindControlRecursively("PersonalIdRecordControl"), PersonalIdRecordControl) + PersonalIdRecordControlObj.ResetData = True + + + Dim PersonalInsigniaTableControlObj as PersonalInsigniaTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalInsigniaTableControl"), PersonalInsigniaTableControl) + PersonalInsigniaTableControlObj.ResetData = True + + PersonalInsigniaTableControlObj.RemoveFromSession(PersonalInsigniaTableControlObj, "DeletedRecordIds") + PersonalInsigniaTableControlObj.DeletedRecordIds = Nothing + + Dim PersonalLanguageSkillTableControlObj as PersonalLanguageSkillTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalLanguageSkillTableControl"), PersonalLanguageSkillTableControl) + PersonalLanguageSkillTableControlObj.ResetData = True + + PersonalLanguageSkillTableControlObj.RemoveFromSession(PersonalLanguageSkillTableControlObj, "DeletedRecordIds") + PersonalLanguageSkillTableControlObj.DeletedRecordIds = Nothing + + Dim PersonalNameTableControlObj as PersonalNameTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalNameTableControl"), PersonalNameTableControl) + PersonalNameTableControlObj.ResetData = True + + PersonalNameTableControlObj.RemoveFromSession(PersonalNameTableControlObj, "DeletedRecordIds") + PersonalNameTableControlObj.DeletedRecordIds = Nothing + + Dim PersonalRankTableControlObj as PersonalRankTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalRankTableControl"), PersonalRankTableControl) + PersonalRankTableControlObj.ResetData = True + + PersonalRankTableControlObj.RemoveFromSession(PersonalRankTableControlObj, "DeletedRecordIds") + PersonalRankTableControlObj.DeletedRecordIds = Nothing + + Dim PersonalSalaryTableControlObj as PersonalSalaryTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalSalaryTableControl"), PersonalSalaryTableControl) + PersonalSalaryTableControlObj.ResetData = True + + PersonalSalaryTableControlObj.RemoveFromSession(PersonalSalaryTableControlObj, "DeletedRecordIds") + PersonalSalaryTableControlObj.DeletedRecordIds = Nothing + + Dim PersonalSpecialSkillTableControlObj as PersonalSpecialSkillTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalSpecialSkillTableControl"), PersonalSpecialSkillTableControl) + PersonalSpecialSkillTableControlObj.ResetData = True + + PersonalSpecialSkillTableControlObj.RemoveFromSession(PersonalSpecialSkillTableControlObj, "DeletedRecordIds") + PersonalSpecialSkillTableControlObj.DeletedRecordIds = Nothing + + Dim PersonalSportSkillTableControlObj as PersonalSportSkillTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalSportSkillTableControl"), PersonalSportSkillTableControl) + PersonalSportSkillTableControlObj.ResetData = True + + PersonalSportSkillTableControlObj.RemoveFromSession(PersonalSportSkillTableControlObj, "DeletedRecordIds") + PersonalSportSkillTableControlObj.DeletedRecordIds = Nothing + + Dim PersonalTitleTableControlObj as PersonalTitleTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalTitleTableControl"), PersonalTitleTableControl) + PersonalTitleTableControlObj.ResetData = True + + PersonalTitleTableControlObj.RemoveFromSession(PersonalTitleTableControlObj, "DeletedRecordIds") + PersonalTitleTableControlObj.DeletedRecordIds = Nothing + + Dim PersonRelativeTableControlObj as PersonRelativeTableControl = DirectCast(Me.Page.FindControlRecursively("PersonRelativeTableControl"), PersonRelativeTableControl) + PersonRelativeTableControlObj.ResetData = True + + PersonRelativeTableControlObj.RemoveFromSession(PersonRelativeTableControlObj, "DeletedRecordIds") + PersonRelativeTableControlObj.DeletedRecordIds = Nothing + + Dim ReportPropertiesTableControlObj as ReportPropertiesTableControl = DirectCast(Me.Page.FindControlRecursively("ReportPropertiesTableControl"), ReportPropertiesTableControl) + ReportPropertiesTableControlObj.ResetData = True + + ReportPropertiesTableControlObj.RemoveFromSession(ReportPropertiesTableControlObj, "DeletedRecordIds") + ReportPropertiesTableControlObj.DeletedRecordIds = Nothing + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalExtWorkResetButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.CurrentSortOrder.Reset() + If Me.InSession(Me, "Order_By") Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + + End If + + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalExtWorkWordButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + Dim report As WordReport = New WordReport + report.SpecificReportFileName = Page.Server.MapPath("ShowPersonalId.PersonalExtWorkWordButton.word") + ' report.Title replaces the value tag of page header and footer containing ${ReportTitle} + report.Title = "PersonalExtWork" + ' If ShowPersonalId.PersonalExtWorkWordButton.report specifies a valid report template, + ' AddColumn method will generate a report template. + ' Each AddColumn method-call specifies a column + ' The 1st parameter represents the text of the column header + ' The 2nd parameter represents the horizontal alignment of the column header + ' The 3rd parameter represents the text format of the column detail + ' The 4th parameter represents the horizontal alignment of the column detail + ' The 5th parameter represents the relative width of the column + report.AddColumn(PersonalExtWorkTable.Description.Name, ReportEnum.Align.Left, "${Description}", ReportEnum.Align.Left, 30) + report.AddColumn(PersonalExtWorkTable.Place.Name, ReportEnum.Align.Left, "${Place}", ReportEnum.Align.Left, 30) + report.AddColumn(PersonalExtWorkTable.Active.Name, ReportEnum.Align.Left, "${Active}", ReportEnum.Align.Left, 15) + report.AddColumn(PersonalExtWorkTable.BeginDate.Name, ReportEnum.Align.Left, "${BeginDate}", ReportEnum.Align.Left, 20) + report.AddColumn(PersonalExtWorkTable.EndDate.Name, ReportEnum.Align.Left, "${EndDate}", ReportEnum.Align.Left, 20) + report.AddColumn(PersonalExtWorkTable.Command.Name, ReportEnum.Align.Left, "${Command}", ReportEnum.Align.Left, 30) + report.AddColumn(PersonalExtWorkTable.CommandDate.Name, ReportEnum.Align.Left, "${CommandDate}", ReportEnum.Align.Left, 20) + + Dim whereClause As WhereClause = CreateWhereClause + + Dim orderBy As OrderBy = CreateOrderBy + Dim joinFilter As BaseFilter = CreateCompoundJoinFilter() + + Dim rowsPerQuery As Integer = 5000 + Dim pageNum As Integer = 0 + Dim recordCount As Integer = 0 + Dim totalRows As Integer = PersonalExtWorkTable.GetRecordCount(joinFilter,whereClause) + + report.Page = Page.GetResourceValue("Txt:Page", "Persons") + report.ApplicationPath = Me.Page.MapPath(Page.Request.ApplicationPath) + + Dim columns As ColumnList = PersonalExtWorkTable.GetColumnList() + Dim records As PersonalExtWorkRecord() = Nothing + Do + records = PersonalExtWorkTable.GetRecords(joinFilter,whereClause, orderBy, pageNum, rowsPerQuery) + + If Not (records Is Nothing) AndAlso records.Length > 0 AndAlso whereClause.RunQuery Then + For Each record As PersonalExtWorkRecord In records + ' AddData method takes four parameters + ' The 1st parameters represent the data format + ' The 2nd parameters represent the data value + ' The 3rd parameters represent the default alignment of column using the data + ' The 4th parameters represent the maximum length of the data value being shown + report.AddData("${Description}", record.Format(PersonalExtWorkTable.Description), ReportEnum.Align.Left, 100) + report.AddData("${Place}", record.Format(PersonalExtWorkTable.Place), ReportEnum.Align.Left, 100) + report.AddData("${Active}", record.Format(PersonalExtWorkTable.Active), ReportEnum.Align.Left, 100) + report.AddData("${BeginDate}", record.Format(PersonalExtWorkTable.BeginDate), ReportEnum.Align.Left, 100) + report.AddData("${EndDate}", record.Format(PersonalExtWorkTable.EndDate), ReportEnum.Align.Left, 100) + report.AddData("${Command}", record.Format(PersonalExtWorkTable.Command), ReportEnum.Align.Left, 100) + report.AddData("${CommandDate}", record.Format(PersonalExtWorkTable.CommandDate), ReportEnum.Align.Left, 100) + + report.WriteRow + Next + pageNum = pageNum + 1 + recordCount += records.Length + End If + Loop While Not (records Is Nothing) AndAlso recordCount < totalRows AndAlso whereClause.RunQuery + report.save + BaseClasses.Utils.NetUtils.WriteResponseBinaryAttachment(Me.Page.Response, report.Title + ".doc", report.ReportInByteArray, 0, true) + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + + + ' Generate the event handling functions for filter and search events. + + + ' Generate the event handling functions for others + + + Private _UIData As New System.Collections.Generic.List(Of Hashtable) + Public Property UIData() As System.Collections.Generic.List(Of Hashtable) + Get + Return Me._UIData + End Get + Set(ByVal value As System.Collections.Generic.List(Of Hashtable)) + Me._UIData = value + End Set + End Property + + ' pagination properties + Protected _PageSize As Integer + Public Property PageSize() As Integer + Get + Return Me._PageSize + End Get + Set(ByVal value As Integer) + Me._PageSize = value + End Set + End Property + + Protected _PageIndex As Integer + Public Property PageIndex() As Integer + Get + ' Return the PageIndex + Return Me._PageIndex + End Get + Set(ByVal value As Integer) + Me._PageIndex = value + End Set + End Property + + Protected _TotalRecords As Integer = -1 + Public Property TotalRecords() As Integer + Get + If _TotalRecords < 0 + _TotalRecords = PersonalExtWorkTable.GetRecordCount(CreateCompoundJoinFilter(), CreateWhereClause()) + End If + Return Me._TotalRecords + End Get + Set(ByVal value As Integer) + If Me.PageSize > 0 Then + + Me.TotalPages = CInt(Math.Ceiling(value / Me.PageSize)) + + End If + Me._TotalRecords = value + End Set + End Property + + + + Protected _TotalPages As Integer = -1 + Public Property TotalPages() As Integer + Get + If _TotalPages < 0 Then + + Me.TotalPages = CInt(Math.Ceiling(TotalRecords / Me.PageSize)) + + End If + Return Me._TotalPages + End Get + Set(ByVal value As Integer) + Me._TotalPages = value + End Set + End Property + + Protected _DisplayLastPage As Boolean + Public Property DisplayLastPage() As Boolean + Get + Return Me._DisplayLastPage + End Get + Set(ByVal value As Boolean) + Me._DisplayLastPage = value + End Set + End Property + + Private _DataChanged As Boolean = False + Public Property DataChanged() As Boolean + Get + Return Me._DataChanged + End Get + Set(ByVal value As Boolean) + Me._DataChanged = value + End Set + End Property + + Private _ResetData As Boolean = False + Public Property ResetData() As Boolean + Get + Return Me._ResetData + End Get + Set(ByVal value As Boolean) + Me._ResetData = value + End Set + End Property + + Private _AddNewRecord As Integer = 0 + Public Property AddNewRecord() As Integer + Get + Return Me._AddNewRecord + End Get + Set(ByVal value As Integer) + Me._AddNewRecord = value + End Set + End Property + + + Private _CurrentSortOrder As OrderBy = Nothing + Public Property CurrentSortOrder() As OrderBy + Get + Return Me._CurrentSortOrder + End Get + Set(ByVal value As BaseClasses.Data.OrderBy) + Me._CurrentSortOrder = value + End Set + End Property + + Private _DataSource() As PersonalExtWorkRecord = Nothing + Public Property DataSource() As PersonalExtWorkRecord () + Get + Return Me._DataSource + End Get + Set(ByVal value() As PersonalExtWorkRecord) + Me._DataSource = value + End Set + End Property + +#Region "Helper Properties" + + Public ReadOnly Property ActiveLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "ActiveLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property BeginDateLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "BeginDateLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property CommandDateLabel1() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "CommandDateLabel1"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property CommandLabel1() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "CommandLabel1"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property DescriptionLabel1() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "DescriptionLabel1"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property EndDateLabel3() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "EndDateLabel3"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property PersonalExtWorkExportCSVButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalExtWorkExportCSVButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalExtWorkExportExcelButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalExtWorkExportExcelButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalExtWorkImportButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalExtWorkImportButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalExtWorkPagination() As Persons.UI.IPagination + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalExtWorkPagination"), Persons.UI.IPagination) + End Get + End Property + + Public ReadOnly Property PersonalExtWorkPDFButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalExtWorkPDFButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalExtWorkRefreshButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalExtWorkRefreshButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalExtWorkResetButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalExtWorkResetButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalExtWorkTableControlCollapsibleRegion() As System.Web.UI.WebControls.Panel + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalExtWorkTableControlCollapsibleRegion"), System.Web.UI.WebControls.Panel) + End Get + End Property + + Public ReadOnly Property PersonalExtWorkWordButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalExtWorkWordButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PlaceLabel1() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PlaceLabel1"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + +#End Region + +#Region "Helper Functions" + + Public Overrides Overloads Function ModifyRedirectUrl(url As String, arg As String, ByVal bEncrypt As Boolean) As String + Return Me.Page.EvaluateExpressions(url, arg, bEncrypt, Me) + End Function + + Public Overrides Overloads Function EvaluateExpressions(url As String, arg As String, ByVal bEncrypt As Boolean) As String + Dim needToProcess As Boolean = AreAnyUrlParametersForMe(url, arg) + If (needToProcess) Then + Dim recCtl As PersonalExtWorkTableControlRow = Me.GetSelectedRecordControl() + If recCtl Is Nothing AndAlso url.IndexOf("{") >= 0 Then + ' Localization. + Throw New Exception(Page.GetResourceValue("Err:NoRecSelected", "Persons")) + End If + Dim rec As PersonalExtWorkRecord = Nothing + If recCtl IsNot Nothing Then + rec = recCtl.GetRecord() + End If + Return EvaluateExpressions(url, arg, rec, bEncrypt) + End If + Return url + End Function + + Public Overridable Function GetSelectedRecordControl() As PersonalExtWorkTableControlRow + Return Nothing + + End Function + + Public Overridable Function GetSelectedRecordControls() As PersonalExtWorkTableControlRow() + + Return DirectCast((new ArrayList()).ToArray(GetType(PersonalExtWorkTableControlRow)), PersonalExtWorkTableControlRow()) + + End Function + + Public Overridable Sub DeleteSelectedRecords(ByVal deferDeletion As Boolean) + Dim recList() As PersonalExtWorkTableControlRow = Me.GetSelectedRecordControls() + If recList.Length = 0 Then + ' Localization. + Throw New Exception(Page.GetResourceValue("Err:NoRecSelected", "Persons")) + End If + + Dim recCtl As PersonalExtWorkTableControlRow + For Each recCtl In recList + If deferDeletion Then + If Not recCtl.IsNewRecord Then + + Me.AddToDeletedRecordIds(recCtl) + + End If + recCtl.Visible = False + + Else + + recCtl.Delete() + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + End If + Next + End Sub + + Public Function GetRecordControls() As PersonalExtWorkTableControlRow() + Dim recList As ArrayList = New ArrayList() + Dim rep As System.Web.UI.WebControls.Repeater = CType(Me.FindControl("PersonalExtWorkTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return Nothing + Dim repItem As System.Web.UI.WebControls.RepeaterItem + + For Each repItem In rep.Items + + Dim recControl As PersonalExtWorkTableControlRow = DirectCast(repItem.FindControl("PersonalExtWorkTableControlRow"), PersonalExtWorkTableControlRow) + recList.Add(recControl) + + Next + + Return DirectCast(recList.ToArray(GetType(PersonalExtWorkTableControlRow)), PersonalExtWorkTableControlRow()) + End Function + + Public Shadows ReadOnly Property Page() As BaseApplicationPage + Get + Return DirectCast(MyBase.Page, BaseApplicationPage) + End Get + End Property + +#End Region + + + +End Class + + +' Base class for the PersonalInsigniaTableControlRow control on the ShowPersonalId page. +' Do not modify this class. Instead override any method in PersonalInsigniaTableControlRow. +Public Class BasePersonalInsigniaTableControlRow + Inherits Persons.UI.BaseApplicationRecordControl + + ' To customize, override this method in PersonalInsigniaTableControlRow. + Protected Overridable Sub Control_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Init + + Me.ClearControlsFromSession() + End Sub + + ' To customize, override this method in PersonalInsigniaTableControlRow. + Protected Overridable Sub Control_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load + + 'Call LoadFocusScripts from repeater so that onfocus attribute could be added to elements + Me.Page.LoadFocusScripts(Me) + + + ' Register the event handlers. + + + End Sub + + + Public Overridable Sub LoadData() + + ' Load the data from the database into the DataSource PersonalInsignia 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 = PersonalInsigniaTable.GetRecord(Me.RecordUniqueId, True) + + Return + End If + + ' Since this is a row in the table, the data for this row is loaded by the + ' LoadData method of the BasePersonalInsigniaTableControl when the data for the entire + ' table is loaded. + + Me.DataSource = New PersonalInsigniaRecord() + + + + End Sub + + ' Populate the UI controls using the DataSource. To customize, override this method in PersonalInsigniaTableControlRow. + 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 + + SetGazetteDate() + SetGazetteNO() + SetGazettePage() + SetGazetteSection() + SetInsigniaDate() + SetInsigniaId() + SetInsigniaReturn() + + + 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 SetGazetteDate() + + + ' Set the GazetteDate Literal on the webpage with value from the + ' PersonalInsignia database record. + + ' Me.DataSource is the PersonalInsignia record retrieved from the database. + ' Me.GazetteDate is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetGazetteDate() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.GazetteDateSpecified Then + + ' If the GazetteDate is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalInsigniaTable.GazetteDate, "d MMM yy") + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.GazetteDate.Text = formattedValue + + Else + + ' GazetteDate is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.GazetteDate.Text = PersonalInsigniaTable.GazetteDate.Format(PersonalInsigniaTable.GazetteDate.DefaultValue, "d MMM yy") + + End If + + ' If the GazetteDate is NULL or blank, then use the value specified + ' on Properties. + If Me.GazetteDate.Text Is Nothing _ + OrElse Me.GazetteDate.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.GazetteDate.Text = " " + End If + + End Sub + + Public Overridable Sub SetGazetteNO() + + + ' Set the GazetteNO Literal on the webpage with value from the + ' PersonalInsignia database record. + + ' Me.DataSource is the PersonalInsignia record retrieved from the database. + ' Me.GazetteNO is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetGazetteNO() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.GazetteNOSpecified Then + + ' If the GazetteNO is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalInsigniaTable.GazetteNO) + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.GazetteNO.Text = formattedValue + + Else + + ' GazetteNO is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.GazetteNO.Text = PersonalInsigniaTable.GazetteNO.Format(PersonalInsigniaTable.GazetteNO.DefaultValue) + + End If + + ' If the GazetteNO is NULL or blank, then use the value specified + ' on Properties. + If Me.GazetteNO.Text Is Nothing _ + OrElse Me.GazetteNO.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.GazetteNO.Text = " " + End If + + End Sub + + Public Overridable Sub SetGazettePage() + + + ' Set the GazettePage Literal on the webpage with value from the + ' PersonalInsignia database record. + + ' Me.DataSource is the PersonalInsignia record retrieved from the database. + ' Me.GazettePage is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetGazettePage() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.GazettePageSpecified Then + + ' If the GazettePage is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalInsigniaTable.GazettePage) + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.GazettePage.Text = formattedValue + + Else + + ' GazettePage is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.GazettePage.Text = PersonalInsigniaTable.GazettePage.Format(PersonalInsigniaTable.GazettePage.DefaultValue) + + End If + + ' If the GazettePage is NULL or blank, then use the value specified + ' on Properties. + If Me.GazettePage.Text Is Nothing _ + OrElse Me.GazettePage.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.GazettePage.Text = " " + End If + + End Sub + + Public Overridable Sub SetGazetteSection() + + + ' Set the GazetteSection Literal on the webpage with value from the + ' PersonalInsignia database record. + + ' Me.DataSource is the PersonalInsignia record retrieved from the database. + ' Me.GazetteSection is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetGazetteSection() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.GazetteSectionSpecified Then + + ' If the GazetteSection is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalInsigniaTable.GazetteSection) + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.GazetteSection.Text = formattedValue + + Else + + ' GazetteSection is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.GazetteSection.Text = PersonalInsigniaTable.GazetteSection.Format(PersonalInsigniaTable.GazetteSection.DefaultValue) + + End If + + ' If the GazetteSection is NULL or blank, then use the value specified + ' on Properties. + If Me.GazetteSection.Text Is Nothing _ + OrElse Me.GazetteSection.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.GazetteSection.Text = " " + End If + + End Sub + + Public Overridable Sub SetInsigniaDate() + + + ' Set the InsigniaDate Literal on the webpage with value from the + ' PersonalInsignia database record. + + ' Me.DataSource is the PersonalInsignia record retrieved from the database. + ' Me.InsigniaDate is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetInsigniaDate() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.InsigniaDateSpecified Then + + ' If the InsigniaDate is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalInsigniaTable.InsigniaDate, "d MMM yy") + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.InsigniaDate.Text = formattedValue + + Else + + ' InsigniaDate is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.InsigniaDate.Text = PersonalInsigniaTable.InsigniaDate.Format(PersonalInsigniaTable.InsigniaDate.DefaultValue, "d MMM yy") + + End If + + ' If the InsigniaDate is NULL or blank, then use the value specified + ' on Properties. + If Me.InsigniaDate.Text Is Nothing _ + OrElse Me.InsigniaDate.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.InsigniaDate.Text = " " + End If + + End Sub + + Public Overridable Sub SetInsigniaId() + + + ' Set the InsigniaId Literal on the webpage with value from the + ' PersonalInsignia database record. + + ' Me.DataSource is the PersonalInsignia record retrieved from the database. + ' Me.InsigniaId is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetInsigniaId() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.InsigniaIdSpecified Then + + ' If the InsigniaId is non-NULL, then format the value. + + ' The Format method will return the Display Foreign Key As (DFKA) value + Dim formattedValue As String = "" + Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalInsigniaTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalInsigniaTable.InsigniaId) + If _isExpandableNonCompositeForeignKey AndAlso PersonalInsigniaTable.InsigniaId.IsApplyDisplayAs Then + + formattedValue = PersonalInsigniaTable.GetDFKA(Me.DataSource.InsigniaId.ToString(),PersonalInsigniaTable.InsigniaId, Nothing) + + if (formattedValue Is Nothing) Then + formattedValue = Me.DataSource.Format(PersonalInsigniaTable.InsigniaId) + End If + Else + formattedValue = Me.DataSource.InsigniaId.ToString() + End If + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.InsigniaId.Text = formattedValue + + Else + + ' InsigniaId is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.InsigniaId.Text = PersonalInsigniaTable.InsigniaId.Format(PersonalInsigniaTable.InsigniaId.DefaultValue) + + End If + + ' If the InsigniaId is NULL or blank, then use the value specified + ' on Properties. + If Me.InsigniaId.Text Is Nothing _ + OrElse Me.InsigniaId.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.InsigniaId.Text = " " + End If + + End Sub + + Public Overridable Sub SetInsigniaReturn() + + + ' Set the InsigniaReturn Literal on the webpage with value from the + ' PersonalInsignia database record. + + ' Me.DataSource is the PersonalInsignia record retrieved from the database. + ' Me.InsigniaReturn is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetInsigniaReturn() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.InsigniaReturnSpecified Then + + ' If the InsigniaReturn is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalInsigniaTable.InsigniaReturn) + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.InsigniaReturn.Text = formattedValue + + Else + + ' InsigniaReturn is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.InsigniaReturn.Text = PersonalInsigniaTable.InsigniaReturn.Format(PersonalInsigniaTable.InsigniaReturn.DefaultValue) + + End If + + ' If the InsigniaReturn is NULL or blank, then use the value specified + ' on Properties. + If Me.InsigniaReturn.Text Is Nothing _ + OrElse Me.InsigniaReturn.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.InsigniaReturn.Text = " " + End If + + End Sub + + + Public EvaluateFormulaDelegate As BaseClasses.Data.DataSource.EvaluateFormulaDelegate = New BaseClasses.Data.DataSource.EvaluateFormulaDelegate(AddressOf Me.EvaluateFormula) + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean, ByVal e As FormulaEvaluator) As String + If e Is Nothing Then + e = New FormulaEvaluator() + End If + + e.Variables.Clear() + + + ' add variables for formula evaluation + If variables IsNot Nothing Then + Dim enumerator As System.Collections.Generic.IEnumerator(Of System.Collections.Generic.KeyValuePair(Of String, Object)) = variables.GetEnumerator() + While enumerator.MoveNext() + e.Variables.Add(enumerator.Current.Key, enumerator.Current.Value) + End While + End If + + If includeDS + + End IF + + + ' Other variables referred to in the formula are expected to be + ' properties of the DataSource. For example, referring to + ' UnitPrice as a variable will refer to DataSource.UnitPrice + If dataSourceForEvaluate Is Nothing Then + + e.DataSource = Me.DataSource + + Else + e.DataSource = dataSourceForEvaluate + End If + + ' Define the calling control. This is used to add other + ' related table and record controls as variables. + e.CallingControl = Me + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + + If Not String.IsNullOrEmpty(format) AndAlso (String.IsNullOrEmpty(formula) OrElse formula.IndexOf("Format(") < 0) Then + Return FormulaUtils.Format(resultObj, format) + Else + Return resultObj.ToString() + End If + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format,variables ,includeDS, Nothing) + End Function + + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object)) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format, variables ,True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, format, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal e as FormulaEvaluator) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, variables, True, e) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal includeDS as Boolean) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, includeDS, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, True, Nothing) + End Function + + + Public Overridable Sub RegisterPostback() + + + End Sub + + + + ' To customize, override this method in PersonalInsigniaTableControlRow. + 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 parentCtrl As PersonalIdRecordControl + + + parentCtrl = DirectCast(Me.Page.FindControlRecursively("PersonalIdRecordControl"), PersonalIdRecordControl) + + If (Not IsNothing(parentCtrl) AndAlso IsNothing(parentCtrl.DataSource)) + ' Load the record if it is not loaded yet. + parentCtrl.LoadData() + End If + If (IsNothing(parentCtrl) OrElse IsNothing(parentCtrl.DataSource)) + ' Get the error message from the application resource file. + Throw New Exception(Page.GetResourceValue("Err:NoParentRecId", "Persons")) + End If + + Me.DataSource.PersonalId = parentCtrl.DataSource.PersonalId + + ' 2. Perform any custom validation. + Me.Validate() + + + ' 3. Set the values in the record with data from UI controls. + ' This calls the Get() method for each of the user interface controls. + Me.GetUIData() + + ' 4. Save in the database. + ' We should not save the record if the data did not change. This + ' will save a database hit and avoid triggering any database triggers. + + If Me.DataSource.IsAnyValueChanged Then + ' Save record to database but do not commit yet. + ' Auto generated ids are available after saving for use by child (dependent) records. + Me.DataSource.Save() + + DirectCast(GetParentControlObject(Me, "PersonalInsigniaTableControl"), PersonalInsigniaTableControl).DataChanged = True + DirectCast(GetParentControlObject(Me, "PersonalInsigniaTableControl"), PersonalInsigniaTableControl).ResetData = True + End If + + + ' update session or cookie by formula + + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + ' For Master-Detail relationships, save data on the Detail table(s) + + End Sub + + ' To customize, override this method in PersonalInsigniaTableControlRow. + 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. + + GetGazetteDate() + GetGazetteNO() + GetGazettePage() + GetGazetteSection() + GetInsigniaDate() + GetInsigniaId() + GetInsigniaReturn() + End Sub + + + Public Overridable Sub GetGazetteDate() + + End Sub + + Public Overridable Sub GetGazetteNO() + + End Sub + + Public Overridable Sub GetGazettePage() + + End Sub + + Public Overridable Sub GetGazetteSection() + + End Sub + + Public Overridable Sub GetInsigniaDate() + + End Sub + + Public Overridable Sub GetInsigniaId() + + End Sub + + Public Overridable Sub GetInsigniaReturn() + + End Sub + + + ' To customize, override this method in PersonalInsigniaTableControlRow. + + Public Overridable Function CreateWhereClause() As WhereClause + + Return Nothing + + End Function + + + + ' To customize, override this method in PersonalInsigniaTableControlRow. + 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) + PersonalInsigniaTable.DeleteRecord(pkValue) + + DirectCast(GetParentControlObject(Me, "PersonalInsigniaTableControl"), PersonalInsigniaTableControl).DataChanged = True + DirectCast(GetParentControlObject(Me, "PersonalInsigniaTableControl"), PersonalInsigniaTableControl).ResetData = True + End Sub + + Protected Overridable Sub Control_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.PreRender + ' PreRender event is raised just before page is being displayed. + Try + DbUtils.StartTransaction() + Me.RegisterPostback() + + If Not Me.Page.ErrorOnPage AndAlso (Me.Page.IsPageRefresh OrElse Me.DataChanged OrElse Me.ResetData) Then + + + ' Re-load the data and update the web page if necessary. + ' This is typically done during a postback (filter, search button, sort, pagination button). + ' In each of the other click handlers, simply set DataChanged to True to reload the data. + Me.LoadData() + Me.DataBind() + End If + + + Catch ex As Exception + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + Finally + DbUtils.EndTransaction() + End Try + End Sub + + + Protected Overrides Sub SaveControlsToSession() + MyBase.SaveControlsToSession() + + + 'Save pagination state to session. + + End Sub + + + + Protected Overrides Sub ClearControlsFromSession() + MyBase.ClearControlsFromSession() + + + + ' Clear pagination state from session. + + End Sub + + Protected Overrides Sub LoadViewState(ByVal savedState As Object) + MyBase.LoadViewState(savedState) + Dim isNewRecord As String = CType(ViewState("IsNewRecord"), String) + If Not isNewRecord Is Nothing AndAlso isNewRecord.Trim <> "" Then + Me.IsNewRecord = Boolean.Parse(isNewRecord) + End If + + Dim myCheckSum As String = CType(ViewState("CheckSum"), String) + If Not myCheckSum Is Nothing AndAlso myCheckSum.Trim <> "" Then + Me.CheckSum = myCheckSum + End If + + + ' Load view state for pagination control. + + End Sub + + Protected Overrides Function SaveViewState() As Object + ViewState("IsNewRecord") = Me.IsNewRecord.ToString() + ViewState("CheckSum") = Me.CheckSum + + + ' Load view state for pagination control. + + Return MyBase.SaveViewState() + End Function + + + + 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("BasePersonalInsigniaTableControlRow_Rec"), String) + End Get + Set(ByVal value As String) + Me.ViewState("BasePersonalInsigniaTableControlRow_Rec") = value + End Set + End Property + + Private _DataSource As PersonalInsigniaRecord + Public Property DataSource() As PersonalInsigniaRecord + Get + Return Me._DataSource + End Get + + Set(ByVal value As PersonalInsigniaRecord) + + Me._DataSource = value + End Set + End Property + + + + Private _checkSum As String + Public Overridable Property CheckSum() As String + Get + Return Me._checkSum + End Get + Set(ByVal value As String) + Me._checkSum = value + End Set + End Property + + Private _TotalPages As Integer + Public Property TotalPages() As Integer + Get + Return Me._TotalPages + End Get + Set(ByVal value As Integer) + Me._TotalPages = value + End Set + End Property + + Private _PageIndex As Integer + Public Property PageIndex() As Integer + Get + ' Return the PageIndex + Return Me._PageIndex + End Get + Set(ByVal value As Integer) + Me._PageIndex = value + End Set + End Property + + Private _DisplayLastPage As Boolean + Public Property DisplayLastPage() As Boolean + Get + Return Me._DisplayLastPage + End Get + Set(ByVal value As Boolean) + Me._DisplayLastPage = value + End Set + End Property + + + +#Region "Helper Properties" + + Public ReadOnly Property GazetteDate() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "GazetteDate"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property GazetteNO() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "GazetteNO"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property GazettePage() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "GazettePage"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property GazetteSection() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "GazetteSection"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property InsigniaDate() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "InsigniaDate"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property InsigniaId() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "InsigniaId"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property InsigniaReturn() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "InsigniaReturn"), 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 PersonalInsigniaRecord = 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 PersonalInsigniaRecord + If Not Me.DataSource Is Nothing Then + Return Me.DataSource + End If + + If Not Me.RecordUniqueId Is Nothing Then + + Return PersonalInsigniaTable.GetRecord(Me.RecordUniqueId, True) + + End If + + ' Localization. + + Return Nothing + + End Function + + Public Shadows ReadOnly Property Page() As BaseApplicationPage + Get + Return DirectCast(MyBase.Page, BaseApplicationPage) + End Get + End Property + +#End Region + +End Class + + + +' Base class for the PersonalInsigniaTableControl control on the ShowPersonalId page. +' Do not modify this class. Instead override any method in PersonalInsigniaTableControl. +Public Class BasePersonalInsigniaTableControl + Inherits Persons.UI.BaseApplicationTableControl + + + + Protected Overridable Sub Control_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Init + + + + ' Setup the filter and search events. + + + + ' Control Initializations. + ' Initialize the table's current sort order. + + If Me.InSession(Me, "Order_By") Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + Me.CurrentSortOrder.Add(PersonalInsigniaTable.InsigniaDate, OrderByItem.OrderDir.Asc) + + End If + + + + ' Setup default pagination settings. + + Me.PageSize = CInt(Me.GetFromSession(Me, "Page_Size", "10")) + Me.PageIndex = CInt(Me.GetFromSession(Me, "Page_Index", "0")) + + + + Me.ClearControlsFromSession() + End Sub + + Protected Overridable Sub Control_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load + + SaveControlsToSession_Ajax() + + ' Setup the pagination events. + + AddHandler Me.PersonalInsigniaPagination.FirstPage.Click, AddressOf PersonalInsigniaPagination_FirstPage_Click + + AddHandler Me.PersonalInsigniaPagination.LastPage.Click, AddressOf PersonalInsigniaPagination_LastPage_Click + + AddHandler Me.PersonalInsigniaPagination.NextPage.Click, AddressOf PersonalInsigniaPagination_NextPage_Click + + AddHandler Me.PersonalInsigniaPagination.PageSizeButton.Click, AddressOf PersonalInsigniaPagination_PageSizeButton_Click + + AddHandler Me.PersonalInsigniaPagination.PreviousPage.Click, AddressOf PersonalInsigniaPagination_PreviousPage_Click + + + ' Setup the sorting events. + + AddHandler Me.GazetteDateLabel.Click, AddressOf GazetteDateLabel_Click + + AddHandler Me.GazetteNOLabel.Click, AddressOf GazetteNOLabel_Click + + AddHandler Me.GazettePageLabel.Click, AddressOf GazettePageLabel_Click + + AddHandler Me.GazetteSectionLabel.Click, AddressOf GazetteSectionLabel_Click + + AddHandler Me.InsigniaDateLabel1.Click, AddressOf InsigniaDateLabel1_Click + + AddHandler Me.InsigniaIdLabel1.Click, AddressOf InsigniaIdLabel1_Click + + AddHandler Me.InsigniaReturnLabel.Click, AddressOf InsigniaReturnLabel_Click + + ' Setup the button events. + + AddHandler Me.PersonalInsigniaExportCSVButton.Click, AddressOf PersonalInsigniaExportCSVButton_Click + + AddHandler Me.PersonalInsigniaExportExcelButton.Click, AddressOf PersonalInsigniaExportExcelButton_Click + + Me.PersonalInsigniaImportButton.PostBackUrl = "../Shared/SelectFileToImport.aspx?TableName=PersonalInsignia" + Me.PersonalInsigniaImportButton.Attributes.Item("onClick") = "window.open('" & Me.Page.EncryptUrlParameter(Me.PersonalInsigniaImportButton.PostBackUrl) & "','importWindow', 'width=700, height=500,top=' +(screen.availHeight-500)/2 + ',left=' + (screen.availWidth-700)/2+ ', resizable=yes, scrollbars=yes,modal=yes'); return false;" + + AddHandler Me.PersonalInsigniaImportButton.Click, AddressOf PersonalInsigniaImportButton_Click + + AddHandler Me.PersonalInsigniaPDFButton.Click, AddressOf PersonalInsigniaPDFButton_Click + + AddHandler Me.PersonalInsigniaRefreshButton.Click, AddressOf PersonalInsigniaRefreshButton_Click + + AddHandler Me.PersonalInsigniaResetButton.Click, AddressOf PersonalInsigniaResetButton_Click + + AddHandler Me.PersonalInsigniaWordButton.Click, AddressOf PersonalInsigniaWordButton_Click + + + ' Setup events for others + + End Sub + + + Public Overridable Sub LoadData() + + ' Read data from database. Returns an array of records that can be assigned + ' to the DataSource table control property. + Try + Dim joinFilter As CompoundFilter = CreateCompoundJoinFilter() + + ' The WHERE clause will be empty when displaying all records in table. + Dim wc As WhereClause = CreateWhereClause() + If wc IsNot Nothing AndAlso Not wc.RunQuery Then + ' Initialize an empty array of records + Dim alist As New ArrayList(0) + Me.DataSource = DirectCast(alist.ToArray(GetType(PersonalInsigniaRecord)), PersonalInsigniaRecord()) + ' Add records to the list if needed. + Me.AddNewRecords() + Me._TotalRecords = 0 + Me._TotalPages = 0 + Return + End If + + ' Call OrderBy to determine the order - either use the order defined + ' on the Query Wizard, or specified by user (by clicking on column heading) + Dim orderBy As OrderBy = CreateOrderBy() + + ' Get the pagesize from the pagesize control. + Me.GetPageSize() + + If Me.DisplayLastPage Then + Dim totalRecords As Integer = If(Me._TotalRecords < 0, PersonalInsigniaTable.GetRecordCount(CreateCompoundJoinFilter(), CreateWhereClause()), Me._TotalRecords) + + Dim totalPages As Integer = CInt(Math.Ceiling(totalRecords / Me.PageSize)) + + Me.PageIndex = totalPages - 1 + End If + + ' Make sure PageIndex (current page) and PageSize are within bounds. + If Me.PageIndex < 0 Then + Me.PageIndex = 0 + End If + If Me.PageSize < 1 Then + Me.PageSize = 1 + End If + + ' Retrieve the records and set the table DataSource. + ' Only PageSize records are fetched starting at PageIndex (zero based). + If Me.AddNewRecord > 0 Then + ' Make sure to preserve the previously entered data on new rows. + Dim postdata As New ArrayList + For Each rc As PersonalInsigniaTableControlRow In Me.GetRecordControls() + If Not rc.IsNewRecord Then + rc.DataSource = rc.GetRecord() + rc.GetUIData() + postdata.Add(rc.DataSource) + UIData.Add(rc.PreservedUIData()) + End If + Next + Me.DataSource = DirectCast(postdata.ToArray(GetType(PersonalInsigniaRecord)), PersonalInsigniaRecord()) + Else ' Get the records from the database + Me.DataSource = PersonalInsigniaTable.GetRecords(joinFilter, wc, orderBy, Me.PageIndex, Me.PageSize) + + End If + + ' if the datasource contains no records contained in database, then load the last page. + If (DbUtils.GetCreatedRecords(Me.DataSource).Length = 0 AndAlso Not Me.DisplayLastPage) Then + Me.DisplayLastPage = True + LoadData() + Else + + ' Add any new rows desired by the user. + Me.AddNewRecords() + + + ' Initialize the page and grand totals. now + + End If + + Catch ex As Exception + ' Report the error message to the end user + Dim msg As String = ex.Message + If ex.InnerException IsNot Nothing Then + msg = msg & " InnerException: " & ex.InnerException.Message + End If + Throw New Exception(msg, ex.InnerException) + End Try + End Sub + + + + + Public Overrides Sub DataBind() + ' The DataBind method binds the user interface controls to the values + ' from the database record for each row in the table. To do this, it calls the + ' DataBind for each of the rows. + ' DataBind also populates any filters above the table, and sets the pagination + ' control to the correct number of records and the current page number. + + MyBase.DataBind() + + ' Make sure that the DataSource is initialized. + If Me.DataSource Is Nothing Then + Return + End If + + 'LoadData for DataSource for chart and report if they exist + + ' Improve performance by prefetching display as records. + Me.PreFetchForeignKeyValues() + + ' Setup the pagination controls. + BindPaginationControls() + + + + ' Bind the repeater with the list of records to expand the UI. + Dim rep As System.Web.UI.WebControls.Repeater = CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalInsigniaTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return + rep.DataSource = DataSource() + rep.DataBind() + + Dim index As Integer = 0 + For Each repItem As System.Web.UI.WebControls.RepeaterItem In rep.Items + ' Loop through all rows in the table, set its DataSource and call DataBind(). + Dim recControl As PersonalInsigniaTableControlRow = DirectCast(repItem.FindControl("PersonalInsigniaTableControlRow"), PersonalInsigniaTableControlRow) + recControl.DataSource = Me.DataSource(index) + If Me.UIData.Count > index Then + recControl.PreviousUIData = Me.UIData(index) + End If + recControl.DataBind() + recControl.Visible = Not Me.InDeletedRecordIds(recControl) + + index += 1 + Next + + + + + ' Call the Set methods for each controls on the panel + + SetGazetteDateLabel() + SetGazetteNOLabel() + SetGazettePageLabel() + SetGazetteSectionLabel() + SetInsigniaDateLabel1() + SetInsigniaIdLabel1() + SetInsigniaReturnLabel() + + + + + + + + SetPersonalInsigniaTableControlCollapsibleRegion() + + ' setting the state of expand or collapse alternative rows + + + ' Load data for each record and table UI control. + ' Ordering is important because child controls get + ' their parent ids from their parent UI controls. + + + ' this method calls the set method for controls with special formula like running total, sum, rank, etc + SetFormulaControls() + End Sub + + Public Overridable Sub SetFormulaControls() + ' this method calls Set methods for the control that has special formula + + + + End Sub + + + Public Sub PreFetchForeignKeyValues() + If (IsNothing(Me.DataSource)) + Return + End If + + Me.Page.PregetDfkaRecords(PersonalInsigniaTable.InsigniaId, Me.DataSource) + + End Sub + + + Public Overridable Sub RegisterPostback() + + Me.Page.RegisterPostBackTrigger(MiscUtils.FindControlRecursively(Me,"PersonalInsigniaExportCSVButton")) + + Me.Page.RegisterPostBackTrigger(MiscUtils.FindControlRecursively(Me,"PersonalInsigniaExportExcelButton")) + + Me.Page.RegisterPostBackTrigger(MiscUtils.FindControlRecursively(Me,"PersonalInsigniaPDFButton")) + + Me.Page.RegisterPostBackTrigger(MiscUtils.FindControlRecursively(Me,"PersonalInsigniaWordButton")) + + + End Sub + + Public EvaluateFormulaDelegate As BaseClasses.Data.DataSource.EvaluateFormulaDelegate = New BaseClasses.Data.DataSource.EvaluateFormulaDelegate(AddressOf Me.EvaluateFormula) + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean, ByVal e as FormulaEvaluator) As String + If e Is Nothing + e = New FormulaEvaluator() + End If + + e.Variables.Clear() + + + ' add variables for formula evaluation + If variables IsNot Nothing Then + Dim enumerator As System.Collections.Generic.IEnumerator(Of System.Collections.Generic.KeyValuePair(Of String, Object)) = variables.GetEnumerator() + While enumerator.MoveNext() + e.Variables.Add(enumerator.Current.Key, enumerator.Current.Value) + End While + End If + + If includeDS + + End If + + ' All variables referred to in the formula are expected to be + ' properties of the DataSource. For example, referring to + ' UnitPrice as a variable will refer to DataSource.UnitPrice + e.DataSource = dataSourceForEvaluate + + ' Define the calling control. This is used to add other + ' related table and record controls as variables. + e.CallingControl = Me + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + + If Not String.IsNullOrEmpty(format) AndAlso (String.IsNullOrEmpty(formula) OrElse formula.IndexOf("Format(") < 0) Then + Return FormulaUtils.Format(resultObj, format) + Else + Return resultObj.ToString() + End If + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format,variables ,includeDS, Nothing) + End Function + + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object)) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format, variables ,True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, format, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal e as FormulaEvaluator) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, variables, True, e) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal includeDS as Boolean) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, includeDS, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, True, Nothing) + End Function + + + + + Public Overridable Sub ResetControl() + + Me.CurrentSortOrder.Reset() + If (Me.InSession(Me, "Order_By")) Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + Me.CurrentSortOrder.Add(PersonalInsigniaTable.InsigniaDate, OrderByItem.OrderDir.Asc) + + End If + + Me.PageIndex = 0 + End Sub + + Protected Overridable Sub BindPaginationControls() + ' Setup the pagination controls. + + ' Bind the pagination labels. + + If DbUtils.GetCreatedRecords(Me.DataSource).Length > 0 Then + + Me.PersonalInsigniaPagination.CurrentPage.Text = (Me.PageIndex + 1).ToString() + Else + Me.PersonalInsigniaPagination.CurrentPage.Text = "0" + End If + Me.PersonalInsigniaPagination.PageSize.Text = Me.PageSize.ToString() + Me.PersonalInsigniaPagination.TotalItems.Text = Me.TotalRecords.ToString() + Me.PersonalInsigniaPagination.TotalPages.Text = Me.TotalPages.ToString() + + ' Bind the buttons for PersonalInsigniaTableControl pagination. + + Me.PersonalInsigniaPagination.FirstPage.Enabled = Not (Me.PageIndex = 0) + If Me._TotalPages < 0 Then ' if the total pages is not determined yet, enable last and next buttons + Me.PersonalInsigniaPagination.LastPage.Enabled = True + ElseIf Me._TotalPages = 0 ' if the total pages is determined and it is 0, enable last and next buttons + Me.PersonalInsigniaPagination.LastPage.Enabled = False + Else ' if the total pages is the last page, disable last and next buttons + Me.PersonalInsigniaPagination.LastPage.Enabled = Not (Me.PageIndex = Me.TotalPages - 1) + End If + + If Me._TotalPages < 0 Then ' if the total pages is not determined yet, enable last and next buttons + Me.PersonalInsigniaPagination.NextPage.Enabled = True + ElseIf Me._TotalPages = 0 ' if the total pages is determined and it is 0, enable last and next buttons + Me.PersonalInsigniaPagination.NextPage.Enabled = False + Else ' if the total pages is the last page, disable last and next buttons + Me.PersonalInsigniaPagination.NextPage.Enabled = Not (Me.PageIndex = Me.TotalPages - 1) + End If + + Me.PersonalInsigniaPagination.PreviousPage.Enabled = Not (Me.PageIndex = 0) + + + End Sub + + Public Overridable Sub SaveData() + ' Save the data from the entire table. Calls each row's Save Data + ' to save their data. This function is called by the Click handler of the + ' Save button. The button handler should Start/Commit/End a transaction. + + Dim recCtl As PersonalInsigniaTableControlRow + For Each recCtl In Me.GetRecordControls() + + If Me.InDeletedRecordIds(recCtl) Then + ' Delete any pending deletes. + recCtl.Delete() + Else + If recCtl.Visible Then + recCtl.SaveData() + End If + End If + + Next + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + ' Set IsNewRecord to False for all records - since everything has been saved and is no longer "new" + For Each recCtl In Me.GetRecordControls() + recCtl.IsNewRecord = False + Next + + + ' Set DeletedRecordsIds to Nothing since we have deleted all pending deletes. + Me.DeletedRecordIds = Nothing + + End Sub + + Public Overridable Function CreateCompoundJoinFilter() As CompoundFilter + Dim jFilter As CompoundFilter = New CompoundFilter() + + Return jFilter + + End Function + + + Public Overridable Function CreateOrderBy() As OrderBy + ' The CurrentSortOrder is initialized to the sort order on the + ' Query Wizard. It may be modified by the Click handler for any of + ' the column heading to sort or reverse sort by that column. + ' You can add your own sort order, or modify it on the Query Wizard. + Return Me.CurrentSortOrder + End Function + + Public Overridable Function CreateWhereClause() As WhereClause + 'This CreateWhereClause is used for loading the data. + PersonalInsigniaTable.Instance.InnerFilter = Nothing + Dim wc As WhereClause = New WhereClause() + + ' Compose the WHERE clause consiting of: + ' 1. Static clause defined at design time. + ' 2. User selected search criteria. + ' 3. User selected filter criteria. + + + Dim selectedRecordKeyValue as KeyValue = New KeyValue() + + Dim personalIdRecordControlObj As Persons.UI.Controls.ShowPersonalId.PersonalIdRecordControl = DirectCast(MiscUtils.FindControlRecursively(Me.Page, "PersonalIdRecordControl"), Persons.UI.Controls.ShowPersonalId.PersonalIdRecordControl) + + If (Not IsNothing(personalIdRecordControlObj) AndAlso Not IsNothing(personalIdRecordControlObj.GetRecord()) AndAlso personalIdRecordControlObj.GetRecord().IsCreated AndAlso Not IsNothing(personalIdRecordControlObj.GetRecord().PersonalId)) + wc.iAND(PersonalInsigniaTable.PersonalId, BaseFilter.ComparisonOperator.EqualsTo, personalIdRecordControlObj.GetRecord().PersonalId.ToString()) + selectedRecordKeyValue.AddElement(PersonalInsigniaTable.PersonalId.InternalName, personalIdRecordControlObj.GetRecord().PersonalId.ToString()) + Else + wc.RunQuery = False + Return wc + End If + + HttpContext.Current.Session("PersonalInsigniaTableControlWhereClause") = selectedRecordKeyValue.ToXmlString() + + Return wc + End Function + + + Public Overridable Function CreateWhereClause(ByVal searchText as String, ByVal fromSearchControl as String, ByVal AutoTypeAheadSearch as String, ByVal AutoTypeAheadWordSeparators as String) As WhereClause + ' This CreateWhereClause is used for loading list of suggestions for Auto Type-Ahead feature. + PersonalInsigniaTable.Instance.InnerFilter = Nothing + Dim wc As WhereClause = New WhereClause() + + ' Compose the WHERE clause consiting of: + ' 1. Static clause defined at design time. + ' 2. User selected search criteria. + ' 3. User selected filter criteria. + + Dim appRelativeVirtualPath As String = CType(HttpContext.Current.Session("AppRelativeVirtualPath"), String) + + Dim selectedRecordInPersonalIdRecordControl as String = DirectCast(HttpContext.Current.Session("PersonalInsigniaTableControlWhereClause"), String) + + If Not selectedRecordInPersonalIdRecordControl Is Nothing AndAlso KeyValue.IsXmlKey(selectedRecordInPersonalIdRecordControl) Then + Dim selectedRecordKeyValue as KeyValue = KeyValue.XmlToKey(selectedRecordInPersonalIdRecordControl) + + If Not IsNothing(selectedRecordKeyValue) AndAlso selectedRecordKeyValue.ContainsColumn(PersonalInsigniaTable.PersonalId) Then + wc.iAND(PersonalInsigniaTable.PersonalId, BaseFilter.ComparisonOperator.EqualsTo, selectedRecordKeyValue.GetColumnValue(PersonalInsigniaTable.PersonalId).ToString()) + End If + + End If + + ' Adds clauses if values are selected in Filter controls which are configured in the page. + + + Return wc + End Function + + + Public Overridable Function FormatSuggestions(ByVal prefixText As String, ByVal resultItem As String, _ + ByVal columnLength As Integer, ByVal AutoTypeAheadDisplayFoundText As String, _ + ByVal autoTypeAheadSearch As String, ByVal AutoTypeAheadWordSeparators As String, _ + ByVal resultList As ArrayList) As Boolean + + 'Formats the resultItem and adds it to the list of suggestions. + Dim index As Integer = resultItem.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture).IndexOf(prefixText.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture)) + Dim itemToAdd As String = "" + Dim isFound As Boolean = False + Dim isAdded As Boolean = False + ' Get the index where prfixt is at the beginning of resultItem. If not found then, index of word which begins with prefixText. + If InvariantLCase(autoTypeAheadSearch).equals("wordsstartingwithsearchstring") And Not index = 0 Then + ' Expression to find word which contains AutoTypeAheadWordSeparators followed by prefixText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex( AutoTypeAheadWordSeparators + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + If regex1.IsMatch(resultItem) Then + index = regex1.Match(resultItem).Index + isFound = True + End If + ' If the prefixText is found immediatly after white space then starting of the word is found so don not search any further + If not resultItem(index).ToString() = " " Then + ' Expression to find beginning of the word which contains AutoTypeAheadWordSeparators followed by prefixText + Dim regex As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\\S*" + AutoTypeAheadWordSeparators + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + If regex.IsMatch(resultItem) Then + index = regex.Match(resultItem).Index + isFound = True + End If + End If + End If + + ' If autoTypeAheadSearch value is wordsstartingwithsearchstring then, extract the substring only if the prefixText is found at the + ' beginning of the resultItem (index = 0) or a word in resultItem is found starts with prefixText. + If index = 0 Or isFound Or InvariantLCase(autoTypeAheadSearch).Equals("anywhereinstring") then + If InvariantLCase(AutoTypeAheadDisplayFoundText).equals("atbeginningofmatchedstring") Then + ' Expression to find beginning of the word which contains prefixText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\\S*" + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + ' Find the beginning of the word which contains prefexText + If (StringUtils.InvariantLCase(autoTypeAheadSearch).Equals("anywhereinstring") AndAlso regex1.IsMatch(resultItem)) Then + index = regex1.Match(resultItem).Index + isFound = True + End If + ' Display string from the index till end of the string if sub string from index till end is less than columnLength value. + If Len(resultItem) - index <= columnLength Then + If index = 0 Then + itemToAdd = resultItem + Else + itemToAdd = "..." & resultItem.Substring(index, Len(resultItem) - index) + End If + Else + If index = 0 Then + itemToAdd = resultItem.Substring(index, (columnLength - 3)) & "..." + Else + 'Truncate the string to show only columnLength - 6 characters as begining and trailing "..." has to be appended. + itemToAdd = "..." & resultItem.Substring(index , columnLength - 6) & "..." + End If + End If + ElseIf InvariantLCase(AutoTypeAheadDisplayFoundText).equals("inmiddleofmatchedstring") Then + Dim subStringBeginIndex As Integer = CType(columnLength/2, Integer) + If Len(resultItem) <= columnLength Then + itemToAdd = resultItem + Else + ' Sanity check at end of the string + If index + Len(prefixText) = columnLength Then + itemToAdd = "..." & resultItem.Substring(index-columnLength,index) + ElseIf Len(resultItem) - index < subStringBeginIndex Then + ' Display string from the end till columnLength value if, index is closer to the end of the string. + itemToAdd = "..." & resultItem.Substring(Len(resultItem)-columnLength,Len(resultItem)) + ElseIf index <= subStringBeginIndex Then + ' Sanity chet at beginning of the string + itemToAdd = resultItem.Substring(0, columnLength) & "..." + Else + ' Display string containing text before the prefixText occures and text after the prefixText + itemToAdd = "..." & resultItem.Substring(index - subStringBeginIndex, columnLength) & "..." + End If + End If + ElseIf InvariantLCase(AutoTypeAheadDisplayFoundText).equals("atendofmatchedstring") Then + ' Expression to find ending of the word which contains prefexText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\s", System.Text.RegularExpressions.RegexOptions.IgnoreCase) + ' Find the ending of the word which contains prefexText + If regex1.IsMatch(resultItem, index + 1) Then + index = regex1.Match(resultItem, index + 1).Index + Else + ' If the word which contains prefexText is the last word in string, regex1.IsMatch returns false. + index = resultItem.Length + End If + If index > Len(resultItem) Then + index = Len(resultItem) + End If + ' If text from beginning of the string till index is less than columnLength value then, display string from the beginning till index. + If index <= columnLength Then + if index = Len(resultItem) Then 'Make decision to append "..." + itemToAdd = resultItem.Substring(0,index) + Else + itemToAdd = resultItem.Substring(0,index) & "..." + End If + Else + If index = Len(resultItem) Then + itemToAdd = "..." & resultItem.Substring(index - (columnLength - 3), (columnLength - 3)) + Else + 'Truncate the string to show only columnLength - 6 characters as begining and trailing "..." has to be appended. + itemToAdd = "..." & resultItem.Substring(index - (columnLength - 6), columnLength - 6) & "..." + End If + End If + End If + + ' Remove newline character from itemToAdd + Dim prefixTextIndex As Integer = itemToAdd.IndexOf(prefixText, StringComparison.CurrentCultureIgnoreCase) + ' If itemToAdd contains any newline after the search text then show text only till newline + Dim regex2 As System.Text.RegularExpressions.Regex = New System.Text.RegularExpressions.Regex("(" & vbCrLf & "|" & vbLf & ")", System.Text.RegularExpressions.RegexOptions.IgnoreCase) + Dim newLineIndexAfterPrefix As Integer = -1 + If regex2.IsMatch(itemToAdd, prefixTextIndex) Then + newLineIndexAfterPrefix = regex2.Match(itemToAdd, prefixTextIndex).Index + End If + If (newLineIndexAfterPrefix > -1) Then + If itemToAdd.EndsWith("...") Then + itemToAdd = (itemToAdd.Substring(0, newLineIndexAfterPrefix) + "...") + Else + itemToAdd = itemToAdd.Substring(0, newLineIndexAfterPrefix) + End If + End If + ' If itemToAdd contains any newline before search text then show text which comes after newline + Dim regex3 As System.Text.RegularExpressions.Regex = New System.Text.RegularExpressions.Regex("(" & vbCrLf & "|" & vbLf & ")", (System.Text.RegularExpressions.RegexOptions.IgnoreCase Or System.Text.RegularExpressions.RegexOptions.RightToLeft)) + Dim newLineIndexBeforePrefix As Integer = -1 + If regex3.IsMatch(itemToAdd, prefixTextIndex) Then + newLineIndexBeforePrefix = regex3.Match(itemToAdd, prefixTextIndex).Index + End If + If (newLineIndexBeforePrefix > -1) Then + If itemToAdd.StartsWith("...") Then + itemToAdd = ("..." + itemToAdd.Substring((newLineIndexBeforePrefix + regex3.Match(itemToAdd, prefixTextIndex).Length))) + Else + itemToAdd = itemToAdd.Substring((newLineIndexBeforePrefix + regex3.Match(itemToAdd, prefixTextIndex).Length)) + End If + End If + + If Not itemToAdd is nothing AndAlso Not resultList.Contains(itemToAdd) Then + + resultList.Add(itemToAdd) + + isAdded = true + End If + End If + Return isAdded + End Function + + + Protected Overridable Sub GetPageSize() + + If Me.PersonalInsigniaPagination.PageSize.Text.Trim <> "" Then + Try + 'Me.PageSize = Integer.Parse(Me.PersonalInsigniaPagination.PageSize.Text) + Catch ex As Exception + End Try + End If + End Sub + + Protected Overridable Sub AddNewRecords() + + Dim newRecordList As ArrayList = New ArrayList() + + Dim newUIDataList As System.Collections.Generic.List(Of Hashtable) = New System.Collections.Generic.List(Of Hashtable)() + + ' Loop though all the record controls and if the record control + ' does not have a unique record id set, then create a record + ' and add to the list. + If Not Me.ResetData Then + Dim rep As System.Web.UI.WebControls.Repeater = CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalInsigniaTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return + + Dim repItem As System.Web.UI.WebControls.RepeaterItem + For Each repItem In rep.Items + ' Loop through all rows in the table, set its DataSource and call DataBind(). + + Dim recControl As PersonalInsigniaTableControlRow = DirectCast(repItem.FindControl("PersonalInsigniaTableControlRow"), PersonalInsigniaTableControlRow) + + If recControl.Visible AndAlso recControl.IsNewRecord() Then + + Dim rec As PersonalInsigniaRecord = New PersonalInsigniaRecord() + + If recControl.GazetteDate.Text <> "" Then + rec.Parse(recControl.GazetteDate.Text, PersonalInsigniaTable.GazetteDate) + End If + If recControl.GazetteNO.Text <> "" Then + rec.Parse(recControl.GazetteNO.Text, PersonalInsigniaTable.GazetteNO) + End If + If recControl.GazettePage.Text <> "" Then + rec.Parse(recControl.GazettePage.Text, PersonalInsigniaTable.GazettePage) + End If + If recControl.GazetteSection.Text <> "" Then + rec.Parse(recControl.GazetteSection.Text, PersonalInsigniaTable.GazetteSection) + End If + If recControl.InsigniaDate.Text <> "" Then + rec.Parse(recControl.InsigniaDate.Text, PersonalInsigniaTable.InsigniaDate) + End If + If recControl.InsigniaId.Text <> "" Then + rec.Parse(recControl.InsigniaId.Text, PersonalInsigniaTable.InsigniaId) + End If + If recControl.InsigniaReturn.Text <> "" Then + rec.Parse(recControl.InsigniaReturn.Text, PersonalInsigniaTable.InsigniaReturn) + End If + newUIDataList.Add(recControl.PreservedUIData()) + newRecordList.Add(rec) + End If + Next + End If + + + ' Add any new record to the list. + Dim index As Integer = 0 + For index = 1 To Me.AddNewRecord + + newRecordList.Insert(0, New PersonalInsigniaRecord()) + newUIDataList.Insert(0, New Hashtable()) + + Next + Me.AddNewRecord = 0 + + ' Finally, add any new records to the DataSource. + If newRecordList.Count > 0 Then + + Dim finalList As ArrayList = New ArrayList(Me.DataSource) + finalList.InsertRange(0, newRecordList) + + Me.DataSource = DirectCast(finalList.ToArray(GetType(PersonalInsigniaRecord)), PersonalInsigniaRecord()) + + End If + + ' Add the existing UI data to this hash table + If newUIDataList.Count > 0 Then + Me.UIData.InsertRange(0, newUIDataList) + End If + + End Sub + + + Public Sub AddToDeletedRecordIds(ByVal rec As PersonalInsigniaTableControlRow) + If rec.IsNewRecord() Then + Return + End If + + If Not Me.DeletedRecordIds Is Nothing AndAlso Me.DeletedRecordIds.Trim <> "" Then + Me.DeletedRecordIds &= "," + End If + + Me.DeletedRecordIds &= "[" & rec.RecordUniqueId & "]" + End Sub + + Protected Overridable Function InDeletedRecordIds(ByVal rec As PersonalInsigniaTableControlRow) As Boolean + If Me.DeletedRecordIds Is Nothing OrElse Me.DeletedRecordIds.Trim = "" Then + Return False + End If + + Return Me.DeletedRecordIds.IndexOf("[" & rec.RecordUniqueId & "]") >= 0 + End Function + + Private _DeletedRecordIds As String + Public Property DeletedRecordIds() As String + Get + Return Me._DeletedRecordIds + End Get + Set(ByVal value As String) + Me._DeletedRecordIds = value + End Set + End Property + + + ' Create Set, WhereClause, and Populate Methods + + Public Overridable Sub SetGazetteDateLabel() + + End Sub + + Public Overridable Sub SetGazetteNOLabel() + + End Sub + + Public Overridable Sub SetGazettePageLabel() + + End Sub + + Public Overridable Sub SetGazetteSectionLabel() + + End Sub + + Public Overridable Sub SetInsigniaDateLabel1() + + End Sub + + Public Overridable Sub SetInsigniaIdLabel1() + + End Sub + + Public Overridable Sub SetInsigniaReturnLabel() + + End Sub + + Public Overridable Sub SetPersonalInsigniaTableControlCollapsibleRegion() + + End Sub + + + + + Protected Overridable Sub Control_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.PreRender + ' PreRender event is raised just before page is being displayed. + Try + DbUtils.StartTransaction + Me.RegisterPostback() + + If Not Me.Page.ErrorOnPage AndAlso (Me.Page.IsPageRefresh OrElse Me.DataChanged OrElse Me.ResetData) Then + + + ' Re-load the data and update the web page if necessary. + ' This is typically done during a postback (filter, search button, sort, pagination button). + ' In each of the other click handlers, simply set DataChanged to True to reload the data. + + Me.LoadData() + Me.DataBind() + + End If + + + + Catch ex As Exception + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + Finally + DbUtils.EndTransaction + End Try + End Sub + + + Protected Overrides Sub SaveControlsToSession() + MyBase.SaveControlsToSession() + + ' Save filter controls to values to session. + + + 'Save pagination state to session. + + + + ' Save table control properties to the session. + If Not Me.CurrentSortOrder Is Nothing Then + Me.SaveToSession(Me, "Order_By", Me.CurrentSortOrder.ToXmlString()) + End If + + Me.SaveToSession(Me, "Page_Index", Me.PageIndex.ToString()) + Me.SaveToSession(Me, "Page_Size", Me.PageSize.ToString()) + + Me.SaveToSession(Me, "DeletedRecordIds", Me.DeletedRecordIds) + + End Sub + + Protected Sub SaveControlsToSession_Ajax() + ' Save filter controls to values to session. + + HttpContext.Current.Session("AppRelativeVirtualPath") = Me.Page.AppRelativeVirtualPath + + End Sub + + Protected Overrides Sub ClearControlsFromSession() + MyBase.ClearControlsFromSession() + + ' Clear filter controls values from the session. + + + ' Clear pagination state from session. + + + + ' Clear table properties from the session. + Me.RemoveFromSession(Me, "Order_By") + Me.RemoveFromSession(Me, "Page_Index") + Me.RemoveFromSession(Me, "Page_Size") + + Me.RemoveFromSession(Me, "DeletedRecordIds") + + End Sub + + Protected Overrides Sub LoadViewState(ByVal savedState As Object) + MyBase.LoadViewState(savedState) + + Dim orderByStr As String = CType(ViewState("PersonalInsigniaTableControl_OrderBy"), String) + + If orderByStr IsNot Nothing AndAlso orderByStr.Trim <> "" Then + Me.CurrentSortOrder = BaseClasses.Data.OrderBy.FromXmlString(orderByStr) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + End If + + Dim pageIndex As String = CType(ViewState("Page_Index"), String) + If pageIndex IsNot Nothing Then + Me.PageIndex = CInt(pageIndex) + End If + + Dim pageSize As String = CType(ViewState("Page_Size"), String) + If Not pageSize Is Nothing Then + Me.PageSize = CInt(pageSize) + End If + + + + ' Load view state for pagination control. + + Me.DeletedRecordIds = CType(Me.ViewState("DeletedRecordIds"), String) + + End Sub + + Protected Overrides Function SaveViewState() As Object + + If Me.CurrentSortOrder IsNot Nothing Then + Me.ViewState("PersonalInsigniaTableControl_OrderBy") = Me.CurrentSortOrder.ToXmlString() + End If + + Me.ViewState("Page_Index") = Me.PageIndex + Me.ViewState("Page_Size") = Me.PageSize + + Me.ViewState("DeletedRecordIds") = Me.DeletedRecordIds + + + ' Load view state for pagination control. + + + Return MyBase.SaveViewState() + End Function + + ' Generate the event handling functions for pagination events. + + ' event handler for ImageButton + Public Overridable Sub PersonalInsigniaPagination_FirstPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.PageIndex = 0 + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalInsigniaPagination_LastPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.DisplayLastPage = True + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalInsigniaPagination_NextPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.PageIndex += 1 + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for LinkButton + Public Overridable Sub PersonalInsigniaPagination_PageSizeButton_Click(ByVal sender As Object, ByVal args As EventArgs) + + Try + + Me.DataChanged = True + + Me.PageSize = Integer.Parse(Me.PersonalInsigniaPagination.PageSize.Text) + + Me.PageIndex = Integer.Parse(Me.PersonalInsigniaPagination.CurrentPage.Text) - 1 + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalInsigniaPagination_PreviousPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + If Me.PageIndex > 0 Then + Me.PageIndex -= 1 + Me.DataChanged = True + End If + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + + ' Generate the event handling functions for sorting events. + + Public Overridable Sub GazetteDateLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by GazetteDate when clicked. + + ' Get previous sorting state for GazetteDate. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalInsigniaTable.GazetteDate) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for GazetteDate. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalInsigniaTable.GazetteDate, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by GazetteDate, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub GazetteNOLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by GazetteNO when clicked. + + ' Get previous sorting state for GazetteNO. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalInsigniaTable.GazetteNO) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for GazetteNO. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalInsigniaTable.GazetteNO, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by GazetteNO, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub GazettePageLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by GazettePage when clicked. + + ' Get previous sorting state for GazettePage. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalInsigniaTable.GazettePage) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for GazettePage. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalInsigniaTable.GazettePage, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by GazettePage, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub GazetteSectionLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by GazetteSection when clicked. + + ' Get previous sorting state for GazetteSection. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalInsigniaTable.GazetteSection) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for GazetteSection. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalInsigniaTable.GazetteSection, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by GazetteSection, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub InsigniaDateLabel1_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by InsigniaDate when clicked. + + ' Get previous sorting state for InsigniaDate. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalInsigniaTable.InsigniaDate) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for InsigniaDate. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalInsigniaTable.InsigniaDate, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by InsigniaDate, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub InsigniaIdLabel1_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by InsigniaId when clicked. + + ' Get previous sorting state for InsigniaId. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalInsigniaTable.InsigniaId) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for InsigniaId. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalInsigniaTable.InsigniaId, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by InsigniaId, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub InsigniaReturnLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by InsigniaReturn when clicked. + + ' Get previous sorting state for InsigniaReturn. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalInsigniaTable.InsigniaReturn) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for InsigniaReturn. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalInsigniaTable.InsigniaReturn, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by InsigniaReturn, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + + ' Generate the event handling functions for button events. + + ' event handler for ImageButton + Public Overridable Sub PersonalInsigniaExportCSVButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + ' Build the where clause based on the current filter and search criteria + ' Create the Order By clause based on the user's current sorting preference. + + Dim wc As WhereClause = CreateWhereClause + Dim orderBy As OrderBy = Nothing + + orderBy = CreateOrderBy + + ' Add each of the columns in order of export. + Dim columns() as BaseColumn = New BaseColumn() { _ + PersonalInsigniaTable.InsigniaDate, _ + PersonalInsigniaTable.InsigniaId, _ + PersonalInsigniaTable.GazetteNO, _ + PersonalInsigniaTable.GazetteSection, _ + PersonalInsigniaTable.GazettePage, _ + PersonalInsigniaTable.GazetteDate, _ + PersonalInsigniaTable.InsigniaReturn, _ + Nothing} + Dim exportData as ExportDataToCSV = New ExportDataToCSV(PersonalInsigniaTable.Instance, wc, orderBy, columns) + + Dim done As Boolean = False + + Dim totalRowsReturned As Integer = 0 + Dim join As CompoundFilter = CreateCompoundJoinFilter() + Dim data As DataForExport = New DataForExport(PersonalInsigniaTable.Instance, wc, orderBy, columns, join) + + 'Check for Export Data Threshold + Dim exportRawValues As Boolean = False + Me.TotalRecords = PersonalInsigniaTable.GetRecordCount(join, wc) + If Me.TotalRecords > 10000 Then + exportRawValues = True + End If + exportData.StartExport(Me.Page.Response, exportRawValues) + + ' Read pageSize records at a time and write out the CSV file. + While (Not done) + Dim recList As ArrayList = data.GetRows(exportData.pageSize) + If recList Is Nothing Then + Exit While 'no more records we are done + End If + + totalRowsReturned = recList.Count + For Each rec As BaseRecord In recList + For Each col As BaseColumn In data.ColumnList + If col Is Nothing Then + Continue For + End If + + If Not data.IncludeInExport(col) Then + Continue For + End If + + Dim val As String = "" + + If exportRawValues Then + val = rec.GetValue(col).ToString() + Else + Dim _isExpandableNonCompositeForeignKey As Boolean = col.TableDefinition.IsExpandableNonCompositeForeignKey(col) + If _isExpandableNonCompositeForeignKey AndAlso col.IsApplyDisplayAs Then + val = PersonalInsigniaTable.GetDFKA(rec.GetValue(col).ToString(), col, Nothing) + End If + If (Not _isExpandableNonCompositeForeignKey) Or (String.IsNullOrEmpty(val)) Then + val = exportData.GetDataForExport(col, rec) + End If + End If + exportData.WriteColumnData(val, data.IsString(col)) + + Next col + exportData.WriteNewRow() + Next rec + + ' If we already are below the pageSize, then we are done. + If totalRowsReturned < exportData.pageSize Then + done = True + End If + End While + exportData.FinishExport(Me.Page.Response) + + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalInsigniaExportExcelButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + ' To customize the columns or the format, override this function in Section 1 of the page + ' and modify it to your liking. + ' Build the where clause based on the current filter and search criteria + ' Create the Order By clause based on the user's current sorting preference. + + Dim wc As WhereClause = CreateWhereClause + Dim orderBy As OrderBy = Nothing + + orderBy = CreateOrderBy + + Dim done As Boolean = False + Dim val As Object = "" + ' Read pageSize records at a time and write out the Excel file. + Dim totalRowsReturned As Integer = 0 + + Me.TotalRecords = PersonalInsigniaTable.GetRecordCount(wc) + If Me.TotalRecords > 10000 Then + + ' Add each of the columns in order of export. + Dim columns() as BaseColumn = New BaseColumn() { _ + PersonalInsigniaTable.InsigniaDate, _ + PersonalInsigniaTable.InsigniaId, _ + PersonalInsigniaTable.GazetteNO, _ + PersonalInsigniaTable.GazetteSection, _ + PersonalInsigniaTable.GazettePage, _ + PersonalInsigniaTable.GazetteDate, _ + PersonalInsigniaTable.InsigniaReturn, _ + Nothing} + Dim exportData as ExportDataToCSV = New ExportDataToCSV(PersonalInsigniaTable.Instance, wc, orderBy, columns) + exportData.StartExport(Me.Page.Response, True) + + Dim dataForCSV As DataForExport = New DataForExport(PersonalInsigniaTable.Instance, wc, orderBy, columns) + + ' Read pageSize records at a time and write out the CSV file. + While (Not done) + Dim recList As ArrayList = dataForCSV.GetRows(exportData.pageSize) + If recList Is Nothing Then + Exit While 'no more records we are done + End If + + totalRowsReturned = recList.Count + For Each rec As BaseRecord In recList + For Each col As BaseColumn In dataForCSV.ColumnList + If col Is Nothing Then + Continue For + End If + + If Not dataForCSV.IncludeInExport(col) Then + Continue For + End If + + val = rec.GetValue(col).ToString() + exportData.WriteColumnData(val, dataForCSV.IsString(col)) + + Next col + exportData.WriteNewRow() + Next rec + + ' If we already are below the pageSize, then we are done. + If totalRowsReturned < exportData.pageSize Then + done = True + End If + End While + exportData.FinishExport(Me.Page.Response) + Else + + ' Create an instance of the Excel report class with the table class, where clause and order by. + Dim excelReport As ExportDataToExcel = New ExportDataToExcel(PersonalInsigniaTable.Instance, wc, orderBy) + ' Add each of the columns in order of export. + ' To customize the data type, change the second parameter of the new ExcelColumn to be + ' a format string from Excel's Format Cell menu. For example "dddd, mmmm dd, yyyy h:mm AM/PM;@", "#,##0.00" + + If Me.Page.Response Is Nothing Then + Return + End If + + excelReport.CreateExcelBook() + + Dim width As Integer = 0 + Dim columnCounter As Integer = 0 + Dim data As DataForExport = New DataForExport(PersonalInsigniaTable.Instance, wc, orderBy, Nothing) + data.ColumnList.Add(New ExcelColumn(PersonalInsigniaTable.InsigniaDate, "Short Date")) + data.ColumnList.Add(New ExcelColumn(PersonalInsigniaTable.InsigniaId, "Default")) + data.ColumnList.Add(New ExcelColumn(PersonalInsigniaTable.GazetteNO, "Default")) + data.ColumnList.Add(New ExcelColumn(PersonalInsigniaTable.GazetteSection, "Default")) + data.ColumnList.Add(New ExcelColumn(PersonalInsigniaTable.GazettePage, "Default")) + data.ColumnList.Add(New ExcelColumn(PersonalInsigniaTable.GazetteDate, "Short Date")) + data.ColumnList.Add(New ExcelColumn(PersonalInsigniaTable.InsigniaReturn, "Default")) + + + For Each col As ExcelColumn In data.ColumnList + width = excelReport.GetExcelCellWidth(col) + If data.IncludeInExport(col) Then + excelReport.AddColumnToExcelBook(columnCounter, col.ToString(), excelReport.GetExcelDataType(col), width, excelReport.GetDisplayFormat(col)) + columnCounter = columnCounter + 1 + End If + Next col + + While (Not done) + Dim recList As ArrayList = data.GetRows(excelReport.pageSize) + + If recList Is Nothing Then + Exit While 'no more records we are done + End If + + totalRowsReturned = recList.Count + + For Each rec As BaseRecord In recList + excelReport.AddRowToExcelBook() + columnCounter = 0 + + For Each col As ExcelColumn In data.ColumnList + If Not data.IncludeInExport(col) Then + Continue For + End If + + Dim _isExpandableNonCompositeForeignKey As Boolean = col.DisplayColumn.TableDefinition.IsExpandableNonCompositeForeignKey(col.DisplayColumn) + If _isExpandableNonCompositeForeignKey AndAlso col.DisplayColumn.IsApplyDisplayAs Then + val = PersonalInsigniaTable.GetDFKA(rec.GetValue(col.DisplayColumn).ToString(), col.DisplayColumn, Nothing) + If val Is Nothing Then + val = rec.Format(col.DisplayColumn) + End If + Else + val = excelReport.GetValueForExcelExport(col, rec) + End If + excelReport.AddCellToExcelRow(columnCounter, excelReport.GetExcelDataType(col), val, col.DisplayFormat) + + columnCounter = columnCounter + 1 + Next col + Next rec + + ' If we already are below the pageSize, then we are done. + If totalRowsReturned < excelReport.pageSize Then + done = True + End If + End While + + excelReport.SaveExcelBook(Me.Page.Response) + End If + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalInsigniaImportButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalInsigniaPDFButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + Dim report As PDFReport = New PDFReport() + report.SpecificReportFileName = Page.Server.MapPath("ShowPersonalId.PersonalInsigniaPDFButton.report") + ' report.Title replaces the value tag of page header and footer containing ${ReportTitle} + report.Title = "PersonalInsignia" + ' If ShowPersonalId.PersonalInsigniaPDFButton.report specifies a valid report template, + ' AddColumn method will generate a report template. + ' Each AddColumn method-call specifies a column + ' The 1st parameter represents the text of the column header + ' The 2nd parameter represents the horizontal alignment of the column header + ' The 3rd parameter represents the text format of the column detail + ' The 4th parameter represents the horizontal alignment of the column detail + ' The 5th parameter represents the relative width of the column + report.AddColumn(PersonalInsigniaTable.InsigniaDate.Name, ReportEnum.Align.Left, "${InsigniaDate}", ReportEnum.Align.Left, 20) + report.AddColumn(PersonalInsigniaTable.InsigniaId.Name, ReportEnum.Align.Left, "${InsigniaId}", ReportEnum.Align.Left, 30) + report.AddColumn(PersonalInsigniaTable.GazetteNO.Name, ReportEnum.Align.Left, "${GazetteNO}", ReportEnum.Align.Left, 15) + report.AddColumn(PersonalInsigniaTable.GazetteSection.Name, ReportEnum.Align.Left, "${GazetteSection}", ReportEnum.Align.Left, 15) + report.AddColumn(PersonalInsigniaTable.GazettePage.Name, ReportEnum.Align.Left, "${GazettePage}", ReportEnum.Align.Left, 30) + report.AddColumn(PersonalInsigniaTable.GazetteDate.Name, ReportEnum.Align.Left, "${GazetteDate}", ReportEnum.Align.Left, 20) + report.AddColumn(PersonalInsigniaTable.InsigniaReturn.Name, ReportEnum.Align.Left, "${InsigniaReturn}", ReportEnum.Align.Left, 30) + + + Dim rowsPerQuery As Integer = 5000 + Dim recordCount As Integer = 0 + + report.Page = Page.GetResourceValue("Txt:Page", "Persons") + report.ApplicationPath = Me.Page.MapPath(Page.Request.ApplicationPath) + + Dim whereClause As WhereClause = CreateWhereClause + Dim orderBy As OrderBy = CreateOrderBy + Dim joinFilter As BaseFilter = CreateCompoundJoinFilter() + + Dim pageNum As Integer = 0 + Dim totalRows As Integer = PersonalInsigniaTable.GetRecordCount(joinFilter,whereClause) + Dim columns As ColumnList = PersonalInsigniaTable.GetColumnList() + Dim records As PersonalInsigniaRecord() = Nothing + + Do + + records = PersonalInsigniaTable.GetRecords(joinFilter,whereClause, orderBy, pageNum, rowsPerQuery) + If Not (records Is Nothing) AndAlso records.Length > 0 AndAlso whereClause.RunQuery Then + For Each record As PersonalInsigniaRecord In records + + ' AddData method takes four parameters + ' The 1st parameters represent the data format + ' The 2nd parameters represent the data value + ' The 3rd parameters represent the default alignment of column using the data + ' The 4th parameters represent the maximum length of the data value being shown + report.AddData("${InsigniaDate}", record.Format(PersonalInsigniaTable.InsigniaDate), ReportEnum.Align.Left, 100) + If BaseClasses.Utils.MiscUtils.IsNull(record.InsigniaId) Then + report.AddData("${InsigniaId}", "",ReportEnum.Align.Left, 100) + Else + Dim _isExpandableNonCompositeForeignKey as Boolean + Dim _DFKA as String = "" + _isExpandableNonCompositeForeignKey = PersonalInsigniaTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalInsigniaTable.InsigniaId) + _DFKA = PersonalInsigniaTable.GetDFKA(record.InsigniaId.ToString(), PersonalInsigniaTable.InsigniaId,Nothing) + If _isExpandableNonCompositeForeignKey AndAlso (not _DFKA Is Nothing) AndAlso PersonalInsigniaTable.InsigniaId.IsApplyDisplayAs Then + report.AddData("${InsigniaId}", _DFKA,ReportEnum.Align.Left, 100) + Else + report.AddData("${InsigniaId}", record.Format(PersonalInsigniaTable.InsigniaId), ReportEnum.Align.Left, 100) + End If + End If + report.AddData("${GazetteNO}", record.Format(PersonalInsigniaTable.GazetteNO), ReportEnum.Align.Left, 100) + report.AddData("${GazetteSection}", record.Format(PersonalInsigniaTable.GazetteSection), ReportEnum.Align.Left, 100) + report.AddData("${GazettePage}", record.Format(PersonalInsigniaTable.GazettePage), ReportEnum.Align.Left, 100) + report.AddData("${GazetteDate}", record.Format(PersonalInsigniaTable.GazetteDate), ReportEnum.Align.Left, 100) + report.AddData("${InsigniaReturn}", record.Format(PersonalInsigniaTable.InsigniaReturn), ReportEnum.Align.Left, 100) + + report.WriteRow + Next + pageNum = pageNum + 1 + recordCount += records.Length + End If + Loop While Not (records Is Nothing) AndAlso recordCount < totalRows AndAlso whereClause.RunQuery + + report.Close + BaseClasses.Utils.NetUtils.WriteResponseBinaryAttachment(Me.Page.Response, report.Title + ".pdf", report.ReportInByteArray, 0, true) + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalInsigniaRefreshButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Dim PersonalDDTableControlObj as PersonalDDTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalDDTableControl"), PersonalDDTableControl) + PersonalDDTableControlObj.ResetData = True + + PersonalDDTableControlObj.RemoveFromSession(PersonalDDTableControlObj, "DeletedRecordIds") + PersonalDDTableControlObj.DeletedRecordIds = Nothing + + Dim PersonalEducationTableControlObj as PersonalEducationTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalEducationTableControl"), PersonalEducationTableControl) + PersonalEducationTableControlObj.ResetData = True + + PersonalEducationTableControlObj.RemoveFromSession(PersonalEducationTableControlObj, "DeletedRecordIds") + PersonalEducationTableControlObj.DeletedRecordIds = Nothing + + Dim PersonalExtWorkTableControlObj as PersonalExtWorkTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalExtWorkTableControl"), PersonalExtWorkTableControl) + PersonalExtWorkTableControlObj.ResetData = True + + PersonalExtWorkTableControlObj.RemoveFromSession(PersonalExtWorkTableControlObj, "DeletedRecordIds") + PersonalExtWorkTableControlObj.DeletedRecordIds = Nothing + + Dim PersonalIdRecordControlObj as PersonalIdRecordControl = DirectCast(Me.Page.FindControlRecursively("PersonalIdRecordControl"), PersonalIdRecordControl) + PersonalIdRecordControlObj.ResetData = True + + + Dim PersonalInsigniaTableControlObj as PersonalInsigniaTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalInsigniaTableControl"), PersonalInsigniaTableControl) + PersonalInsigniaTableControlObj.ResetData = True + + PersonalInsigniaTableControlObj.RemoveFromSession(PersonalInsigniaTableControlObj, "DeletedRecordIds") + PersonalInsigniaTableControlObj.DeletedRecordIds = Nothing + + Dim PersonalLanguageSkillTableControlObj as PersonalLanguageSkillTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalLanguageSkillTableControl"), PersonalLanguageSkillTableControl) + PersonalLanguageSkillTableControlObj.ResetData = True + + PersonalLanguageSkillTableControlObj.RemoveFromSession(PersonalLanguageSkillTableControlObj, "DeletedRecordIds") + PersonalLanguageSkillTableControlObj.DeletedRecordIds = Nothing + + Dim PersonalNameTableControlObj as PersonalNameTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalNameTableControl"), PersonalNameTableControl) + PersonalNameTableControlObj.ResetData = True + + PersonalNameTableControlObj.RemoveFromSession(PersonalNameTableControlObj, "DeletedRecordIds") + PersonalNameTableControlObj.DeletedRecordIds = Nothing + + Dim PersonalRankTableControlObj as PersonalRankTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalRankTableControl"), PersonalRankTableControl) + PersonalRankTableControlObj.ResetData = True + + PersonalRankTableControlObj.RemoveFromSession(PersonalRankTableControlObj, "DeletedRecordIds") + PersonalRankTableControlObj.DeletedRecordIds = Nothing + + Dim PersonalSalaryTableControlObj as PersonalSalaryTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalSalaryTableControl"), PersonalSalaryTableControl) + PersonalSalaryTableControlObj.ResetData = True + + PersonalSalaryTableControlObj.RemoveFromSession(PersonalSalaryTableControlObj, "DeletedRecordIds") + PersonalSalaryTableControlObj.DeletedRecordIds = Nothing + + Dim PersonalSpecialSkillTableControlObj as PersonalSpecialSkillTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalSpecialSkillTableControl"), PersonalSpecialSkillTableControl) + PersonalSpecialSkillTableControlObj.ResetData = True + + PersonalSpecialSkillTableControlObj.RemoveFromSession(PersonalSpecialSkillTableControlObj, "DeletedRecordIds") + PersonalSpecialSkillTableControlObj.DeletedRecordIds = Nothing + + Dim PersonalSportSkillTableControlObj as PersonalSportSkillTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalSportSkillTableControl"), PersonalSportSkillTableControl) + PersonalSportSkillTableControlObj.ResetData = True + + PersonalSportSkillTableControlObj.RemoveFromSession(PersonalSportSkillTableControlObj, "DeletedRecordIds") + PersonalSportSkillTableControlObj.DeletedRecordIds = Nothing + + Dim PersonalTitleTableControlObj as PersonalTitleTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalTitleTableControl"), PersonalTitleTableControl) + PersonalTitleTableControlObj.ResetData = True + + PersonalTitleTableControlObj.RemoveFromSession(PersonalTitleTableControlObj, "DeletedRecordIds") + PersonalTitleTableControlObj.DeletedRecordIds = Nothing + + Dim PersonRelativeTableControlObj as PersonRelativeTableControl = DirectCast(Me.Page.FindControlRecursively("PersonRelativeTableControl"), PersonRelativeTableControl) + PersonRelativeTableControlObj.ResetData = True + + PersonRelativeTableControlObj.RemoveFromSession(PersonRelativeTableControlObj, "DeletedRecordIds") + PersonRelativeTableControlObj.DeletedRecordIds = Nothing + + Dim ReportPropertiesTableControlObj as ReportPropertiesTableControl = DirectCast(Me.Page.FindControlRecursively("ReportPropertiesTableControl"), ReportPropertiesTableControl) + ReportPropertiesTableControlObj.ResetData = True + + ReportPropertiesTableControlObj.RemoveFromSession(ReportPropertiesTableControlObj, "DeletedRecordIds") + ReportPropertiesTableControlObj.DeletedRecordIds = Nothing + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalInsigniaResetButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.CurrentSortOrder.Reset() + If Me.InSession(Me, "Order_By") Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + Me.CurrentSortOrder.Add(PersonalInsigniaTable.InsigniaDate, OrderByItem.OrderDir.Asc) + + + End If + + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalInsigniaWordButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + Dim report As WordReport = New WordReport + report.SpecificReportFileName = Page.Server.MapPath("ShowPersonalId.PersonalInsigniaWordButton.word") + ' report.Title replaces the value tag of page header and footer containing ${ReportTitle} + report.Title = "PersonalInsignia" + ' If ShowPersonalId.PersonalInsigniaWordButton.report specifies a valid report template, + ' AddColumn method will generate a report template. + ' Each AddColumn method-call specifies a column + ' The 1st parameter represents the text of the column header + ' The 2nd parameter represents the horizontal alignment of the column header + ' The 3rd parameter represents the text format of the column detail + ' The 4th parameter represents the horizontal alignment of the column detail + ' The 5th parameter represents the relative width of the column + report.AddColumn(PersonalInsigniaTable.InsigniaDate.Name, ReportEnum.Align.Left, "${InsigniaDate}", ReportEnum.Align.Left, 20) + report.AddColumn(PersonalInsigniaTable.InsigniaId.Name, ReportEnum.Align.Left, "${InsigniaId}", ReportEnum.Align.Left, 30) + report.AddColumn(PersonalInsigniaTable.GazetteNO.Name, ReportEnum.Align.Left, "${GazetteNO}", ReportEnum.Align.Left, 15) + report.AddColumn(PersonalInsigniaTable.GazetteSection.Name, ReportEnum.Align.Left, "${GazetteSection}", ReportEnum.Align.Left, 15) + report.AddColumn(PersonalInsigniaTable.GazettePage.Name, ReportEnum.Align.Left, "${GazettePage}", ReportEnum.Align.Left, 30) + report.AddColumn(PersonalInsigniaTable.GazetteDate.Name, ReportEnum.Align.Left, "${GazetteDate}", ReportEnum.Align.Left, 20) + report.AddColumn(PersonalInsigniaTable.InsigniaReturn.Name, ReportEnum.Align.Left, "${InsigniaReturn}", ReportEnum.Align.Left, 30) + + Dim whereClause As WhereClause = CreateWhereClause + + Dim orderBy As OrderBy = CreateOrderBy + Dim joinFilter As BaseFilter = CreateCompoundJoinFilter() + + Dim rowsPerQuery As Integer = 5000 + Dim pageNum As Integer = 0 + Dim recordCount As Integer = 0 + Dim totalRows As Integer = PersonalInsigniaTable.GetRecordCount(joinFilter,whereClause) + + report.Page = Page.GetResourceValue("Txt:Page", "Persons") + report.ApplicationPath = Me.Page.MapPath(Page.Request.ApplicationPath) + + Dim columns As ColumnList = PersonalInsigniaTable.GetColumnList() + Dim records As PersonalInsigniaRecord() = Nothing + Do + records = PersonalInsigniaTable.GetRecords(joinFilter,whereClause, orderBy, pageNum, rowsPerQuery) + + If Not (records Is Nothing) AndAlso records.Length > 0 AndAlso whereClause.RunQuery Then + For Each record As PersonalInsigniaRecord In records + ' AddData method takes four parameters + ' The 1st parameters represent the data format + ' The 2nd parameters represent the data value + ' The 3rd parameters represent the default alignment of column using the data + ' The 4th parameters represent the maximum length of the data value being shown + report.AddData("${InsigniaDate}", record.Format(PersonalInsigniaTable.InsigniaDate), ReportEnum.Align.Left, 100) + If BaseClasses.Utils.MiscUtils.IsNull(record.InsigniaId) Then + report.AddData("${InsigniaId}", "",ReportEnum.Align.Left, 100) + Else + Dim _isExpandableNonCompositeForeignKey as Boolean + Dim _DFKA as String = "" + _isExpandableNonCompositeForeignKey = PersonalInsigniaTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalInsigniaTable.InsigniaId) + _DFKA = PersonalInsigniaTable.GetDFKA(record.InsigniaId.ToString(), PersonalInsigniaTable.InsigniaId,Nothing) + If _isExpandableNonCompositeForeignKey AndAlso (not _DFKA Is Nothing) AndAlso PersonalInsigniaTable.InsigniaId.IsApplyDisplayAs Then + report.AddData("${InsigniaId}", _DFKA,ReportEnum.Align.Left, 100) + Else + report.AddData("${InsigniaId}", record.Format(PersonalInsigniaTable.InsigniaId), ReportEnum.Align.Left, 100) + End If + End If + report.AddData("${GazetteNO}", record.Format(PersonalInsigniaTable.GazetteNO), ReportEnum.Align.Left, 100) + report.AddData("${GazetteSection}", record.Format(PersonalInsigniaTable.GazetteSection), ReportEnum.Align.Left, 100) + report.AddData("${GazettePage}", record.Format(PersonalInsigniaTable.GazettePage), ReportEnum.Align.Left, 100) + report.AddData("${GazetteDate}", record.Format(PersonalInsigniaTable.GazetteDate), ReportEnum.Align.Left, 100) + report.AddData("${InsigniaReturn}", record.Format(PersonalInsigniaTable.InsigniaReturn), ReportEnum.Align.Left, 100) + + report.WriteRow + Next + pageNum = pageNum + 1 + recordCount += records.Length + End If + Loop While Not (records Is Nothing) AndAlso recordCount < totalRows AndAlso whereClause.RunQuery + report.save + BaseClasses.Utils.NetUtils.WriteResponseBinaryAttachment(Me.Page.Response, report.Title + ".doc", report.ReportInByteArray, 0, true) + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + + + ' Generate the event handling functions for filter and search events. + + + ' Generate the event handling functions for others + + + Private _UIData As New System.Collections.Generic.List(Of Hashtable) + Public Property UIData() As System.Collections.Generic.List(Of Hashtable) + Get + Return Me._UIData + End Get + Set(ByVal value As System.Collections.Generic.List(Of Hashtable)) + Me._UIData = value + End Set + End Property + + ' pagination properties + Protected _PageSize As Integer + Public Property PageSize() As Integer + Get + Return Me._PageSize + End Get + Set(ByVal value As Integer) + Me._PageSize = value + End Set + End Property + + Protected _PageIndex As Integer + Public Property PageIndex() As Integer + Get + ' Return the PageIndex + Return Me._PageIndex + End Get + Set(ByVal value As Integer) + Me._PageIndex = value + End Set + End Property + + Protected _TotalRecords As Integer = -1 + Public Property TotalRecords() As Integer + Get + If _TotalRecords < 0 + _TotalRecords = PersonalInsigniaTable.GetRecordCount(CreateCompoundJoinFilter(), CreateWhereClause()) + End If + Return Me._TotalRecords + End Get + Set(ByVal value As Integer) + If Me.PageSize > 0 Then + + Me.TotalPages = CInt(Math.Ceiling(value / Me.PageSize)) + + End If + Me._TotalRecords = value + End Set + End Property + + + + Protected _TotalPages As Integer = -1 + Public Property TotalPages() As Integer + Get + If _TotalPages < 0 Then + + Me.TotalPages = CInt(Math.Ceiling(TotalRecords / Me.PageSize)) + + End If + Return Me._TotalPages + End Get + Set(ByVal value As Integer) + Me._TotalPages = value + End Set + End Property + + Protected _DisplayLastPage As Boolean + Public Property DisplayLastPage() As Boolean + Get + Return Me._DisplayLastPage + End Get + Set(ByVal value As Boolean) + Me._DisplayLastPage = value + End Set + End Property + + Private _DataChanged As Boolean = False + Public Property DataChanged() As Boolean + Get + Return Me._DataChanged + End Get + Set(ByVal value As Boolean) + Me._DataChanged = value + End Set + End Property + + Private _ResetData As Boolean = False + Public Property ResetData() As Boolean + Get + Return Me._ResetData + End Get + Set(ByVal value As Boolean) + Me._ResetData = value + End Set + End Property + + Private _AddNewRecord As Integer = 0 + Public Property AddNewRecord() As Integer + Get + Return Me._AddNewRecord + End Get + Set(ByVal value As Integer) + Me._AddNewRecord = value + End Set + End Property + + + Private _CurrentSortOrder As OrderBy = Nothing + Public Property CurrentSortOrder() As OrderBy + Get + Return Me._CurrentSortOrder + End Get + Set(ByVal value As BaseClasses.Data.OrderBy) + Me._CurrentSortOrder = value + End Set + End Property + + Private _DataSource() As PersonalInsigniaRecord = Nothing + Public Property DataSource() As PersonalInsigniaRecord () + Get + Return Me._DataSource + End Get + Set(ByVal value() As PersonalInsigniaRecord) + Me._DataSource = value + End Set + End Property + +#Region "Helper Properties" + + Public ReadOnly Property GazetteDateLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "GazetteDateLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property GazetteNOLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "GazetteNOLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property GazettePageLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "GazettePageLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property GazetteSectionLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "GazetteSectionLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property InsigniaDateLabel1() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "InsigniaDateLabel1"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property InsigniaIdLabel1() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "InsigniaIdLabel1"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property InsigniaReturnLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "InsigniaReturnLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property PersonalInsigniaExportCSVButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalInsigniaExportCSVButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalInsigniaExportExcelButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalInsigniaExportExcelButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalInsigniaImportButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalInsigniaImportButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalInsigniaPagination() As Persons.UI.IPagination + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalInsigniaPagination"), Persons.UI.IPagination) + End Get + End Property + + Public ReadOnly Property PersonalInsigniaPDFButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalInsigniaPDFButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalInsigniaRefreshButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalInsigniaRefreshButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalInsigniaResetButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalInsigniaResetButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalInsigniaTableControlCollapsibleRegion() As System.Web.UI.WebControls.Panel + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalInsigniaTableControlCollapsibleRegion"), System.Web.UI.WebControls.Panel) + End Get + End Property + + Public ReadOnly Property PersonalInsigniaWordButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalInsigniaWordButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + +#End Region + +#Region "Helper Functions" + + Public Overrides Overloads Function ModifyRedirectUrl(url As String, arg As String, ByVal bEncrypt As Boolean) As String + Return Me.Page.EvaluateExpressions(url, arg, bEncrypt, Me) + End Function + + Public Overrides Overloads Function EvaluateExpressions(url As String, arg As String, ByVal bEncrypt As Boolean) As String + Dim needToProcess As Boolean = AreAnyUrlParametersForMe(url, arg) + If (needToProcess) Then + Dim recCtl As PersonalInsigniaTableControlRow = Me.GetSelectedRecordControl() + If recCtl Is Nothing AndAlso url.IndexOf("{") >= 0 Then + ' Localization. + Throw New Exception(Page.GetResourceValue("Err:NoRecSelected", "Persons")) + End If + Dim rec As PersonalInsigniaRecord = Nothing + If recCtl IsNot Nothing Then + rec = recCtl.GetRecord() + End If + Return EvaluateExpressions(url, arg, rec, bEncrypt) + End If + Return url + End Function + + Public Overridable Function GetSelectedRecordControl() As PersonalInsigniaTableControlRow + Return Nothing + + End Function + + Public Overridable Function GetSelectedRecordControls() As PersonalInsigniaTableControlRow() + + Return DirectCast((new ArrayList()).ToArray(GetType(PersonalInsigniaTableControlRow)), PersonalInsigniaTableControlRow()) + + End Function + + Public Overridable Sub DeleteSelectedRecords(ByVal deferDeletion As Boolean) + Dim recList() As PersonalInsigniaTableControlRow = Me.GetSelectedRecordControls() + If recList.Length = 0 Then + ' Localization. + Throw New Exception(Page.GetResourceValue("Err:NoRecSelected", "Persons")) + End If + + Dim recCtl As PersonalInsigniaTableControlRow + For Each recCtl In recList + If deferDeletion Then + If Not recCtl.IsNewRecord Then + + Me.AddToDeletedRecordIds(recCtl) + + End If + recCtl.Visible = False + + Else + + recCtl.Delete() + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + End If + Next + End Sub + + Public Function GetRecordControls() As PersonalInsigniaTableControlRow() + Dim recList As ArrayList = New ArrayList() + Dim rep As System.Web.UI.WebControls.Repeater = CType(Me.FindControl("PersonalInsigniaTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return Nothing + Dim repItem As System.Web.UI.WebControls.RepeaterItem + + For Each repItem In rep.Items + + Dim recControl As PersonalInsigniaTableControlRow = DirectCast(repItem.FindControl("PersonalInsigniaTableControlRow"), PersonalInsigniaTableControlRow) + recList.Add(recControl) + + Next + + Return DirectCast(recList.ToArray(GetType(PersonalInsigniaTableControlRow)), PersonalInsigniaTableControlRow()) + End Function + + Public Shadows ReadOnly Property Page() As BaseApplicationPage + Get + Return DirectCast(MyBase.Page, BaseApplicationPage) + End Get + End Property + +#End Region + + + +End Class + + +' Base class for the PersonalLanguageSkillTableControlRow control on the ShowPersonalId page. +' Do not modify this class. Instead override any method in PersonalLanguageSkillTableControlRow. +Public Class BasePersonalLanguageSkillTableControlRow + Inherits Persons.UI.BaseApplicationRecordControl + + ' To customize, override this method in PersonalLanguageSkillTableControlRow. + Protected Overridable Sub Control_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Init + + Me.ClearControlsFromSession() + End Sub + + ' To customize, override this method in PersonalLanguageSkillTableControlRow. + Protected Overridable Sub Control_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load + + 'Call LoadFocusScripts from repeater so that onfocus attribute could be added to elements + Me.Page.LoadFocusScripts(Me) + + + ' Register the event handlers. + + + End Sub + + + Public Overridable Sub LoadData() + + ' Load the data from the database into the DataSource PersonalLanguageSkill 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 = PersonalLanguageSkillTable.GetRecord(Me.RecordUniqueId, True) + + Return + End If + + ' Since this is a row in the table, the data for this row is loaded by the + ' LoadData method of the BasePersonalLanguageSkillTableControl when the data for the entire + ' table is loaded. + + Me.DataSource = New PersonalLanguageSkillRecord() + + + + End Sub + + ' Populate the UI controls using the DataSource. To customize, override this method in PersonalLanguageSkillTableControlRow. + 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 + + SetLanguageId() + SetLevel() + + + 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 SetLanguageId() + + + ' Set the LanguageId Literal on the webpage with value from the + ' PersonalLanguageSkill database record. + + ' Me.DataSource is the PersonalLanguageSkill record retrieved from the database. + ' Me.LanguageId is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetLanguageId() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.LanguageIdSpecified Then + + ' If the LanguageId is non-NULL, then format the value. + + ' The Format method will return the Display Foreign Key As (DFKA) value + Dim formattedValue As String = "" + Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalLanguageSkillTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalLanguageSkillTable.LanguageId) + If _isExpandableNonCompositeForeignKey AndAlso PersonalLanguageSkillTable.LanguageId.IsApplyDisplayAs Then + + formattedValue = PersonalLanguageSkillTable.GetDFKA(Me.DataSource.LanguageId.ToString(),PersonalLanguageSkillTable.LanguageId, Nothing) + + if (formattedValue Is Nothing) Then + formattedValue = Me.DataSource.Format(PersonalLanguageSkillTable.LanguageId) + End If + Else + formattedValue = Me.DataSource.LanguageId.ToString() + End If + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.LanguageId.Text = formattedValue + + Else + + ' LanguageId is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.LanguageId.Text = PersonalLanguageSkillTable.LanguageId.Format(PersonalLanguageSkillTable.LanguageId.DefaultValue) + + End If + + ' If the LanguageId is NULL or blank, then use the value specified + ' on Properties. + If Me.LanguageId.Text Is Nothing _ + OrElse Me.LanguageId.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.LanguageId.Text = " " + End If + + End Sub + + Public Overridable Sub SetLevel() + + + ' Set the Level Literal on the webpage with value from the + ' PersonalLanguageSkill database record. + + ' Me.DataSource is the PersonalLanguageSkill record retrieved from the database. + ' Me.Level is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetLevel() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.LevelSpecified Then + + ' If the Level is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalLanguageSkillTable.Level) + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.Level.Text = formattedValue + + Else + + ' Level is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.Level.Text = PersonalLanguageSkillTable.Level.Format(PersonalLanguageSkillTable.Level.DefaultValue) + + End If + + ' If the Level is NULL or blank, then use the value specified + ' on Properties. + If Me.Level.Text Is Nothing _ + OrElse Me.Level.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.Level.Text = " " + End If + + End Sub + + + Public EvaluateFormulaDelegate As BaseClasses.Data.DataSource.EvaluateFormulaDelegate = New BaseClasses.Data.DataSource.EvaluateFormulaDelegate(AddressOf Me.EvaluateFormula) + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean, ByVal e As FormulaEvaluator) As String + If e Is Nothing Then + e = New FormulaEvaluator() + End If + + e.Variables.Clear() + + + ' add variables for formula evaluation + If variables IsNot Nothing Then + Dim enumerator As System.Collections.Generic.IEnumerator(Of System.Collections.Generic.KeyValuePair(Of String, Object)) = variables.GetEnumerator() + While enumerator.MoveNext() + e.Variables.Add(enumerator.Current.Key, enumerator.Current.Value) + End While + End If + + If includeDS + + End IF + + + ' Other variables referred to in the formula are expected to be + ' properties of the DataSource. For example, referring to + ' UnitPrice as a variable will refer to DataSource.UnitPrice + If dataSourceForEvaluate Is Nothing Then + + e.DataSource = Me.DataSource + + Else + e.DataSource = dataSourceForEvaluate + End If + + ' Define the calling control. This is used to add other + ' related table and record controls as variables. + e.CallingControl = Me + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + + If Not String.IsNullOrEmpty(format) AndAlso (String.IsNullOrEmpty(formula) OrElse formula.IndexOf("Format(") < 0) Then + Return FormulaUtils.Format(resultObj, format) + Else + Return resultObj.ToString() + End If + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format,variables ,includeDS, Nothing) + End Function + + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object)) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format, variables ,True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, format, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal e as FormulaEvaluator) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, variables, True, e) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal includeDS as Boolean) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, includeDS, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, True, Nothing) + End Function + + + Public Overridable Sub RegisterPostback() + + + End Sub + + + + ' To customize, override this method in PersonalLanguageSkillTableControlRow. + 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 parentCtrl As PersonalIdRecordControl + + + parentCtrl = DirectCast(Me.Page.FindControlRecursively("PersonalIdRecordControl"), PersonalIdRecordControl) + + If (Not IsNothing(parentCtrl) AndAlso IsNothing(parentCtrl.DataSource)) + ' Load the record if it is not loaded yet. + parentCtrl.LoadData() + End If + If (IsNothing(parentCtrl) OrElse IsNothing(parentCtrl.DataSource)) + ' Get the error message from the application resource file. + Throw New Exception(Page.GetResourceValue("Err:NoParentRecId", "Persons")) + End If + + Me.DataSource.PersonalId = parentCtrl.DataSource.PersonalId + + ' 2. Perform any custom validation. + Me.Validate() + + + ' 3. Set the values in the record with data from UI controls. + ' This calls the Get() method for each of the user interface controls. + Me.GetUIData() + + ' 4. Save in the database. + ' We should not save the record if the data did not change. This + ' will save a database hit and avoid triggering any database triggers. + + If Me.DataSource.IsAnyValueChanged Then + ' Save record to database but do not commit yet. + ' Auto generated ids are available after saving for use by child (dependent) records. + Me.DataSource.Save() + + DirectCast(GetParentControlObject(Me, "PersonalLanguageSkillTableControl"), PersonalLanguageSkillTableControl).DataChanged = True + DirectCast(GetParentControlObject(Me, "PersonalLanguageSkillTableControl"), PersonalLanguageSkillTableControl).ResetData = True + End If + + + ' update session or cookie by formula + + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + ' For Master-Detail relationships, save data on the Detail table(s) + + End Sub + + ' To customize, override this method in PersonalLanguageSkillTableControlRow. + 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. + + GetLanguageId() + GetLevel() + End Sub + + + Public Overridable Sub GetLanguageId() + + End Sub + + Public Overridable Sub GetLevel() + + End Sub + + + ' To customize, override this method in PersonalLanguageSkillTableControlRow. + + Public Overridable Function CreateWhereClause() As WhereClause + + Return Nothing + + End Function + + + + ' To customize, override this method in PersonalLanguageSkillTableControlRow. + 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) + PersonalLanguageSkillTable.DeleteRecord(pkValue) + + DirectCast(GetParentControlObject(Me, "PersonalLanguageSkillTableControl"), PersonalLanguageSkillTableControl).DataChanged = True + DirectCast(GetParentControlObject(Me, "PersonalLanguageSkillTableControl"), PersonalLanguageSkillTableControl).ResetData = True + End Sub + + Protected Overridable Sub Control_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.PreRender + ' PreRender event is raised just before page is being displayed. + Try + DbUtils.StartTransaction() + Me.RegisterPostback() + + If Not Me.Page.ErrorOnPage AndAlso (Me.Page.IsPageRefresh OrElse Me.DataChanged OrElse Me.ResetData) Then + + + ' Re-load the data and update the web page if necessary. + ' This is typically done during a postback (filter, search button, sort, pagination button). + ' In each of the other click handlers, simply set DataChanged to True to reload the data. + Me.LoadData() + Me.DataBind() + End If + + + Catch ex As Exception + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + Finally + DbUtils.EndTransaction() + End Try + End Sub + + + Protected Overrides Sub SaveControlsToSession() + MyBase.SaveControlsToSession() + + + 'Save pagination state to session. + + End Sub + + + + Protected Overrides Sub ClearControlsFromSession() + MyBase.ClearControlsFromSession() + + + + ' Clear pagination state from session. + + End Sub + + Protected Overrides Sub LoadViewState(ByVal savedState As Object) + MyBase.LoadViewState(savedState) + Dim isNewRecord As String = CType(ViewState("IsNewRecord"), String) + If Not isNewRecord Is Nothing AndAlso isNewRecord.Trim <> "" Then + Me.IsNewRecord = Boolean.Parse(isNewRecord) + End If + + Dim myCheckSum As String = CType(ViewState("CheckSum"), String) + If Not myCheckSum Is Nothing AndAlso myCheckSum.Trim <> "" Then + Me.CheckSum = myCheckSum + End If + + + ' Load view state for pagination control. + + End Sub + + Protected Overrides Function SaveViewState() As Object + ViewState("IsNewRecord") = Me.IsNewRecord.ToString() + ViewState("CheckSum") = Me.CheckSum + + + ' Load view state for pagination control. + + Return MyBase.SaveViewState() + End Function + + + + 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("BasePersonalLanguageSkillTableControlRow_Rec"), String) + End Get + Set(ByVal value As String) + Me.ViewState("BasePersonalLanguageSkillTableControlRow_Rec") = value + End Set + End Property + + Private _DataSource As PersonalLanguageSkillRecord + Public Property DataSource() As PersonalLanguageSkillRecord + Get + Return Me._DataSource + End Get + + Set(ByVal value As PersonalLanguageSkillRecord) + + Me._DataSource = value + End Set + End Property + + + + Private _checkSum As String + Public Overridable Property CheckSum() As String + Get + Return Me._checkSum + End Get + Set(ByVal value As String) + Me._checkSum = value + End Set + End Property + + Private _TotalPages As Integer + Public Property TotalPages() As Integer + Get + Return Me._TotalPages + End Get + Set(ByVal value As Integer) + Me._TotalPages = value + End Set + End Property + + Private _PageIndex As Integer + Public Property PageIndex() As Integer + Get + ' Return the PageIndex + Return Me._PageIndex + End Get + Set(ByVal value As Integer) + Me._PageIndex = value + End Set + End Property + + Private _DisplayLastPage As Boolean + Public Property DisplayLastPage() As Boolean + Get + Return Me._DisplayLastPage + End Get + Set(ByVal value As Boolean) + Me._DisplayLastPage = value + End Set + End Property + + + +#Region "Helper Properties" + + Public ReadOnly Property LanguageId() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "LanguageId"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property Level() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Level"), 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 PersonalLanguageSkillRecord = 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 PersonalLanguageSkillRecord + If Not Me.DataSource Is Nothing Then + Return Me.DataSource + End If + + If Not Me.RecordUniqueId Is Nothing Then + + Return PersonalLanguageSkillTable.GetRecord(Me.RecordUniqueId, True) + + End If + + ' Localization. + + Return Nothing + + End Function + + Public Shadows ReadOnly Property Page() As BaseApplicationPage + Get + Return DirectCast(MyBase.Page, BaseApplicationPage) + End Get + End Property + +#End Region + +End Class + + + +' Base class for the PersonalLanguageSkillTableControl control on the ShowPersonalId page. +' Do not modify this class. Instead override any method in PersonalLanguageSkillTableControl. +Public Class BasePersonalLanguageSkillTableControl + Inherits Persons.UI.BaseApplicationTableControl + + + + Protected Overridable Sub Control_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Init + + + + ' Setup the filter and search events. + + + + ' Control Initializations. + ' Initialize the table's current sort order. + + If Me.InSession(Me, "Order_By") Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + End If + + + + ' Setup default pagination settings. + + Me.PageSize = CInt(Me.GetFromSession(Me, "Page_Size", "10")) + Me.PageIndex = CInt(Me.GetFromSession(Me, "Page_Index", "0")) + + + + Me.ClearControlsFromSession() + End Sub + + Protected Overridable Sub Control_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load + + SaveControlsToSession_Ajax() + + ' Setup the pagination events. + + AddHandler Me.PersonalLanguageSkillPagination.FirstPage.Click, AddressOf PersonalLanguageSkillPagination_FirstPage_Click + + AddHandler Me.PersonalLanguageSkillPagination.LastPage.Click, AddressOf PersonalLanguageSkillPagination_LastPage_Click + + AddHandler Me.PersonalLanguageSkillPagination.NextPage.Click, AddressOf PersonalLanguageSkillPagination_NextPage_Click + + AddHandler Me.PersonalLanguageSkillPagination.PageSizeButton.Click, AddressOf PersonalLanguageSkillPagination_PageSizeButton_Click + + AddHandler Me.PersonalLanguageSkillPagination.PreviousPage.Click, AddressOf PersonalLanguageSkillPagination_PreviousPage_Click + + + ' Setup the sorting events. + + AddHandler Me.LanguageIdLabel1.Click, AddressOf LanguageIdLabel1_Click + + AddHandler Me.LevelLabel1.Click, AddressOf LevelLabel1_Click + + ' Setup the button events. + + AddHandler Me.PersonalLanguageSkillExportCSVButton.Click, AddressOf PersonalLanguageSkillExportCSVButton_Click + + AddHandler Me.PersonalLanguageSkillExportExcelButton.Click, AddressOf PersonalLanguageSkillExportExcelButton_Click + + Me.PersonalLanguageSkillImportButton.PostBackUrl = "../Shared/SelectFileToImport.aspx?TableName=PersonalLanguageSkill" + Me.PersonalLanguageSkillImportButton.Attributes.Item("onClick") = "window.open('" & Me.Page.EncryptUrlParameter(Me.PersonalLanguageSkillImportButton.PostBackUrl) & "','importWindow', 'width=700, height=500,top=' +(screen.availHeight-500)/2 + ',left=' + (screen.availWidth-700)/2+ ', resizable=yes, scrollbars=yes,modal=yes'); return false;" + + AddHandler Me.PersonalLanguageSkillImportButton.Click, AddressOf PersonalLanguageSkillImportButton_Click + + AddHandler Me.PersonalLanguageSkillPDFButton.Click, AddressOf PersonalLanguageSkillPDFButton_Click + + AddHandler Me.PersonalLanguageSkillRefreshButton.Click, AddressOf PersonalLanguageSkillRefreshButton_Click + + AddHandler Me.PersonalLanguageSkillResetButton.Click, AddressOf PersonalLanguageSkillResetButton_Click + + AddHandler Me.PersonalLanguageSkillWordButton.Click, AddressOf PersonalLanguageSkillWordButton_Click + + + ' Setup events for others + + End Sub + + + Public Overridable Sub LoadData() + + ' Read data from database. Returns an array of records that can be assigned + ' to the DataSource table control property. + Try + Dim joinFilter As CompoundFilter = CreateCompoundJoinFilter() + + ' The WHERE clause will be empty when displaying all records in table. + Dim wc As WhereClause = CreateWhereClause() + If wc IsNot Nothing AndAlso Not wc.RunQuery Then + ' Initialize an empty array of records + Dim alist As New ArrayList(0) + Me.DataSource = DirectCast(alist.ToArray(GetType(PersonalLanguageSkillRecord)), PersonalLanguageSkillRecord()) + ' Add records to the list if needed. + Me.AddNewRecords() + Me._TotalRecords = 0 + Me._TotalPages = 0 + Return + End If + + ' Call OrderBy to determine the order - either use the order defined + ' on the Query Wizard, or specified by user (by clicking on column heading) + Dim orderBy As OrderBy = CreateOrderBy() + + ' Get the pagesize from the pagesize control. + Me.GetPageSize() + + If Me.DisplayLastPage Then + Dim totalRecords As Integer = If(Me._TotalRecords < 0, PersonalLanguageSkillTable.GetRecordCount(CreateCompoundJoinFilter(), CreateWhereClause()), Me._TotalRecords) + + Dim totalPages As Integer = CInt(Math.Ceiling(totalRecords / Me.PageSize)) + + Me.PageIndex = totalPages - 1 + End If + + ' Make sure PageIndex (current page) and PageSize are within bounds. + If Me.PageIndex < 0 Then + Me.PageIndex = 0 + End If + If Me.PageSize < 1 Then + Me.PageSize = 1 + End If + + ' Retrieve the records and set the table DataSource. + ' Only PageSize records are fetched starting at PageIndex (zero based). + If Me.AddNewRecord > 0 Then + ' Make sure to preserve the previously entered data on new rows. + Dim postdata As New ArrayList + For Each rc As PersonalLanguageSkillTableControlRow In Me.GetRecordControls() + If Not rc.IsNewRecord Then + rc.DataSource = rc.GetRecord() + rc.GetUIData() + postdata.Add(rc.DataSource) + UIData.Add(rc.PreservedUIData()) + End If + Next + Me.DataSource = DirectCast(postdata.ToArray(GetType(PersonalLanguageSkillRecord)), PersonalLanguageSkillRecord()) + Else ' Get the records from the database + Me.DataSource = PersonalLanguageSkillTable.GetRecords(joinFilter, wc, orderBy, Me.PageIndex, Me.PageSize) + + End If + + ' if the datasource contains no records contained in database, then load the last page. + If (DbUtils.GetCreatedRecords(Me.DataSource).Length = 0 AndAlso Not Me.DisplayLastPage) Then + Me.DisplayLastPage = True + LoadData() + Else + + ' Add any new rows desired by the user. + Me.AddNewRecords() + + + ' Initialize the page and grand totals. now + + End If + + Catch ex As Exception + ' Report the error message to the end user + Dim msg As String = ex.Message + If ex.InnerException IsNot Nothing Then + msg = msg & " InnerException: " & ex.InnerException.Message + End If + Throw New Exception(msg, ex.InnerException) + End Try + End Sub + + + + + Public Overrides Sub DataBind() + ' The DataBind method binds the user interface controls to the values + ' from the database record for each row in the table. To do this, it calls the + ' DataBind for each of the rows. + ' DataBind also populates any filters above the table, and sets the pagination + ' control to the correct number of records and the current page number. + + MyBase.DataBind() + + ' Make sure that the DataSource is initialized. + If Me.DataSource Is Nothing Then + Return + End If + + 'LoadData for DataSource for chart and report if they exist + + ' Improve performance by prefetching display as records. + Me.PreFetchForeignKeyValues() + + ' Setup the pagination controls. + BindPaginationControls() + + + + ' Bind the repeater with the list of records to expand the UI. + Dim rep As System.Web.UI.WebControls.Repeater = CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalLanguageSkillTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return + rep.DataSource = DataSource() + rep.DataBind() + + Dim index As Integer = 0 + For Each repItem As System.Web.UI.WebControls.RepeaterItem In rep.Items + ' Loop through all rows in the table, set its DataSource and call DataBind(). + Dim recControl As PersonalLanguageSkillTableControlRow = DirectCast(repItem.FindControl("PersonalLanguageSkillTableControlRow"), PersonalLanguageSkillTableControlRow) + recControl.DataSource = Me.DataSource(index) + If Me.UIData.Count > index Then + recControl.PreviousUIData = Me.UIData(index) + End If + recControl.DataBind() + recControl.Visible = Not Me.InDeletedRecordIds(recControl) + + index += 1 + Next + + + + + ' Call the Set methods for each controls on the panel + + SetLanguageIdLabel1() + SetLevelLabel1() + + + + + + + + SetPersonalLanguageSkillTableControlCollapsibleRegion() + + ' setting the state of expand or collapse alternative rows + + + ' Load data for each record and table UI control. + ' Ordering is important because child controls get + ' their parent ids from their parent UI controls. + + + ' this method calls the set method for controls with special formula like running total, sum, rank, etc + SetFormulaControls() + End Sub + + Public Overridable Sub SetFormulaControls() + ' this method calls Set methods for the control that has special formula + + + + End Sub + + + Public Sub PreFetchForeignKeyValues() + If (IsNothing(Me.DataSource)) + Return + End If + + Me.Page.PregetDfkaRecords(PersonalLanguageSkillTable.LanguageId, Me.DataSource) + + End Sub + + + Public Overridable Sub RegisterPostback() + + Me.Page.RegisterPostBackTrigger(MiscUtils.FindControlRecursively(Me,"PersonalLanguageSkillExportCSVButton")) + + Me.Page.RegisterPostBackTrigger(MiscUtils.FindControlRecursively(Me,"PersonalLanguageSkillExportExcelButton")) + + Me.Page.RegisterPostBackTrigger(MiscUtils.FindControlRecursively(Me,"PersonalLanguageSkillPDFButton")) + + Me.Page.RegisterPostBackTrigger(MiscUtils.FindControlRecursively(Me,"PersonalLanguageSkillWordButton")) + + + End Sub + + Public EvaluateFormulaDelegate As BaseClasses.Data.DataSource.EvaluateFormulaDelegate = New BaseClasses.Data.DataSource.EvaluateFormulaDelegate(AddressOf Me.EvaluateFormula) + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean, ByVal e as FormulaEvaluator) As String + If e Is Nothing + e = New FormulaEvaluator() + End If + + e.Variables.Clear() + + + ' add variables for formula evaluation + If variables IsNot Nothing Then + Dim enumerator As System.Collections.Generic.IEnumerator(Of System.Collections.Generic.KeyValuePair(Of String, Object)) = variables.GetEnumerator() + While enumerator.MoveNext() + e.Variables.Add(enumerator.Current.Key, enumerator.Current.Value) + End While + End If + + If includeDS + + End If + + ' All variables referred to in the formula are expected to be + ' properties of the DataSource. For example, referring to + ' UnitPrice as a variable will refer to DataSource.UnitPrice + e.DataSource = dataSourceForEvaluate + + ' Define the calling control. This is used to add other + ' related table and record controls as variables. + e.CallingControl = Me + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + + If Not String.IsNullOrEmpty(format) AndAlso (String.IsNullOrEmpty(formula) OrElse formula.IndexOf("Format(") < 0) Then + Return FormulaUtils.Format(resultObj, format) + Else + Return resultObj.ToString() + End If + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format,variables ,includeDS, Nothing) + End Function + + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object)) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format, variables ,True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, format, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal e as FormulaEvaluator) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, variables, True, e) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal includeDS as Boolean) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, includeDS, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, True, Nothing) + End Function + + + + + Public Overridable Sub ResetControl() + + Me.CurrentSortOrder.Reset() + If (Me.InSession(Me, "Order_By")) Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + End If + + Me.PageIndex = 0 + End Sub + + Protected Overridable Sub BindPaginationControls() + ' Setup the pagination controls. + + ' Bind the pagination labels. + + If DbUtils.GetCreatedRecords(Me.DataSource).Length > 0 Then + + Me.PersonalLanguageSkillPagination.CurrentPage.Text = (Me.PageIndex + 1).ToString() + Else + Me.PersonalLanguageSkillPagination.CurrentPage.Text = "0" + End If + Me.PersonalLanguageSkillPagination.PageSize.Text = Me.PageSize.ToString() + Me.PersonalLanguageSkillPagination.TotalItems.Text = Me.TotalRecords.ToString() + Me.PersonalLanguageSkillPagination.TotalPages.Text = Me.TotalPages.ToString() + + ' Bind the buttons for PersonalLanguageSkillTableControl pagination. + + Me.PersonalLanguageSkillPagination.FirstPage.Enabled = Not (Me.PageIndex = 0) + If Me._TotalPages < 0 Then ' if the total pages is not determined yet, enable last and next buttons + Me.PersonalLanguageSkillPagination.LastPage.Enabled = True + ElseIf Me._TotalPages = 0 ' if the total pages is determined and it is 0, enable last and next buttons + Me.PersonalLanguageSkillPagination.LastPage.Enabled = False + Else ' if the total pages is the last page, disable last and next buttons + Me.PersonalLanguageSkillPagination.LastPage.Enabled = Not (Me.PageIndex = Me.TotalPages - 1) + End If + + If Me._TotalPages < 0 Then ' if the total pages is not determined yet, enable last and next buttons + Me.PersonalLanguageSkillPagination.NextPage.Enabled = True + ElseIf Me._TotalPages = 0 ' if the total pages is determined and it is 0, enable last and next buttons + Me.PersonalLanguageSkillPagination.NextPage.Enabled = False + Else ' if the total pages is the last page, disable last and next buttons + Me.PersonalLanguageSkillPagination.NextPage.Enabled = Not (Me.PageIndex = Me.TotalPages - 1) + End If + + Me.PersonalLanguageSkillPagination.PreviousPage.Enabled = Not (Me.PageIndex = 0) + + + End Sub + + Public Overridable Sub SaveData() + ' Save the data from the entire table. Calls each row's Save Data + ' to save their data. This function is called by the Click handler of the + ' Save button. The button handler should Start/Commit/End a transaction. + + Dim recCtl As PersonalLanguageSkillTableControlRow + For Each recCtl In Me.GetRecordControls() + + If Me.InDeletedRecordIds(recCtl) Then + ' Delete any pending deletes. + recCtl.Delete() + Else + If recCtl.Visible Then + recCtl.SaveData() + End If + End If + + Next + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + ' Set IsNewRecord to False for all records - since everything has been saved and is no longer "new" + For Each recCtl In Me.GetRecordControls() + recCtl.IsNewRecord = False + Next + + + ' Set DeletedRecordsIds to Nothing since we have deleted all pending deletes. + Me.DeletedRecordIds = Nothing + + End Sub + + Public Overridable Function CreateCompoundJoinFilter() As CompoundFilter + Dim jFilter As CompoundFilter = New CompoundFilter() + + Return jFilter + + End Function + + + Public Overridable Function CreateOrderBy() As OrderBy + ' The CurrentSortOrder is initialized to the sort order on the + ' Query Wizard. It may be modified by the Click handler for any of + ' the column heading to sort or reverse sort by that column. + ' You can add your own sort order, or modify it on the Query Wizard. + Return Me.CurrentSortOrder + End Function + + Public Overridable Function CreateWhereClause() As WhereClause + 'This CreateWhereClause is used for loading the data. + PersonalLanguageSkillTable.Instance.InnerFilter = Nothing + Dim wc As WhereClause = New WhereClause() + + ' Compose the WHERE clause consiting of: + ' 1. Static clause defined at design time. + ' 2. User selected search criteria. + ' 3. User selected filter criteria. + + + Dim selectedRecordKeyValue as KeyValue = New KeyValue() + + Dim personalIdRecordControlObj As Persons.UI.Controls.ShowPersonalId.PersonalIdRecordControl = DirectCast(MiscUtils.FindControlRecursively(Me.Page, "PersonalIdRecordControl"), Persons.UI.Controls.ShowPersonalId.PersonalIdRecordControl) + + If (Not IsNothing(personalIdRecordControlObj) AndAlso Not IsNothing(personalIdRecordControlObj.GetRecord()) AndAlso personalIdRecordControlObj.GetRecord().IsCreated AndAlso Not IsNothing(personalIdRecordControlObj.GetRecord().PersonalId)) + wc.iAND(PersonalLanguageSkillTable.PersonalId, BaseFilter.ComparisonOperator.EqualsTo, personalIdRecordControlObj.GetRecord().PersonalId.ToString()) + selectedRecordKeyValue.AddElement(PersonalLanguageSkillTable.PersonalId.InternalName, personalIdRecordControlObj.GetRecord().PersonalId.ToString()) + Else + wc.RunQuery = False + Return wc + End If + + HttpContext.Current.Session("PersonalLanguageSkillTableControlWhereClause") = selectedRecordKeyValue.ToXmlString() + + Return wc + End Function + + + Public Overridable Function CreateWhereClause(ByVal searchText as String, ByVal fromSearchControl as String, ByVal AutoTypeAheadSearch as String, ByVal AutoTypeAheadWordSeparators as String) As WhereClause + ' This CreateWhereClause is used for loading list of suggestions for Auto Type-Ahead feature. + PersonalLanguageSkillTable.Instance.InnerFilter = Nothing + Dim wc As WhereClause = New WhereClause() + + ' Compose the WHERE clause consiting of: + ' 1. Static clause defined at design time. + ' 2. User selected search criteria. + ' 3. User selected filter criteria. + + Dim appRelativeVirtualPath As String = CType(HttpContext.Current.Session("AppRelativeVirtualPath"), String) + + Dim selectedRecordInPersonalIdRecordControl as String = DirectCast(HttpContext.Current.Session("PersonalLanguageSkillTableControlWhereClause"), String) + + If Not selectedRecordInPersonalIdRecordControl Is Nothing AndAlso KeyValue.IsXmlKey(selectedRecordInPersonalIdRecordControl) Then + Dim selectedRecordKeyValue as KeyValue = KeyValue.XmlToKey(selectedRecordInPersonalIdRecordControl) + + If Not IsNothing(selectedRecordKeyValue) AndAlso selectedRecordKeyValue.ContainsColumn(PersonalLanguageSkillTable.PersonalId) Then + wc.iAND(PersonalLanguageSkillTable.PersonalId, BaseFilter.ComparisonOperator.EqualsTo, selectedRecordKeyValue.GetColumnValue(PersonalLanguageSkillTable.PersonalId).ToString()) + End If + + End If + + ' Adds clauses if values are selected in Filter controls which are configured in the page. + + + Return wc + End Function + + + Public Overridable Function FormatSuggestions(ByVal prefixText As String, ByVal resultItem As String, _ + ByVal columnLength As Integer, ByVal AutoTypeAheadDisplayFoundText As String, _ + ByVal autoTypeAheadSearch As String, ByVal AutoTypeAheadWordSeparators As String, _ + ByVal resultList As ArrayList) As Boolean + + 'Formats the resultItem and adds it to the list of suggestions. + Dim index As Integer = resultItem.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture).IndexOf(prefixText.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture)) + Dim itemToAdd As String = "" + Dim isFound As Boolean = False + Dim isAdded As Boolean = False + ' Get the index where prfixt is at the beginning of resultItem. If not found then, index of word which begins with prefixText. + If InvariantLCase(autoTypeAheadSearch).equals("wordsstartingwithsearchstring") And Not index = 0 Then + ' Expression to find word which contains AutoTypeAheadWordSeparators followed by prefixText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex( AutoTypeAheadWordSeparators + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + If regex1.IsMatch(resultItem) Then + index = regex1.Match(resultItem).Index + isFound = True + End If + ' If the prefixText is found immediatly after white space then starting of the word is found so don not search any further + If not resultItem(index).ToString() = " " Then + ' Expression to find beginning of the word which contains AutoTypeAheadWordSeparators followed by prefixText + Dim regex As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\\S*" + AutoTypeAheadWordSeparators + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + If regex.IsMatch(resultItem) Then + index = regex.Match(resultItem).Index + isFound = True + End If + End If + End If + + ' If autoTypeAheadSearch value is wordsstartingwithsearchstring then, extract the substring only if the prefixText is found at the + ' beginning of the resultItem (index = 0) or a word in resultItem is found starts with prefixText. + If index = 0 Or isFound Or InvariantLCase(autoTypeAheadSearch).Equals("anywhereinstring") then + If InvariantLCase(AutoTypeAheadDisplayFoundText).equals("atbeginningofmatchedstring") Then + ' Expression to find beginning of the word which contains prefixText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\\S*" + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + ' Find the beginning of the word which contains prefexText + If (StringUtils.InvariantLCase(autoTypeAheadSearch).Equals("anywhereinstring") AndAlso regex1.IsMatch(resultItem)) Then + index = regex1.Match(resultItem).Index + isFound = True + End If + ' Display string from the index till end of the string if sub string from index till end is less than columnLength value. + If Len(resultItem) - index <= columnLength Then + If index = 0 Then + itemToAdd = resultItem + Else + itemToAdd = "..." & resultItem.Substring(index, Len(resultItem) - index) + End If + Else + If index = 0 Then + itemToAdd = resultItem.Substring(index, (columnLength - 3)) & "..." + Else + 'Truncate the string to show only columnLength - 6 characters as begining and trailing "..." has to be appended. + itemToAdd = "..." & resultItem.Substring(index , columnLength - 6) & "..." + End If + End If + ElseIf InvariantLCase(AutoTypeAheadDisplayFoundText).equals("inmiddleofmatchedstring") Then + Dim subStringBeginIndex As Integer = CType(columnLength/2, Integer) + If Len(resultItem) <= columnLength Then + itemToAdd = resultItem + Else + ' Sanity check at end of the string + If index + Len(prefixText) = columnLength Then + itemToAdd = "..." & resultItem.Substring(index-columnLength,index) + ElseIf Len(resultItem) - index < subStringBeginIndex Then + ' Display string from the end till columnLength value if, index is closer to the end of the string. + itemToAdd = "..." & resultItem.Substring(Len(resultItem)-columnLength,Len(resultItem)) + ElseIf index <= subStringBeginIndex Then + ' Sanity chet at beginning of the string + itemToAdd = resultItem.Substring(0, columnLength) & "..." + Else + ' Display string containing text before the prefixText occures and text after the prefixText + itemToAdd = "..." & resultItem.Substring(index - subStringBeginIndex, columnLength) & "..." + End If + End If + ElseIf InvariantLCase(AutoTypeAheadDisplayFoundText).equals("atendofmatchedstring") Then + ' Expression to find ending of the word which contains prefexText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\s", System.Text.RegularExpressions.RegexOptions.IgnoreCase) + ' Find the ending of the word which contains prefexText + If regex1.IsMatch(resultItem, index + 1) Then + index = regex1.Match(resultItem, index + 1).Index + Else + ' If the word which contains prefexText is the last word in string, regex1.IsMatch returns false. + index = resultItem.Length + End If + If index > Len(resultItem) Then + index = Len(resultItem) + End If + ' If text from beginning of the string till index is less than columnLength value then, display string from the beginning till index. + If index <= columnLength Then + if index = Len(resultItem) Then 'Make decision to append "..." + itemToAdd = resultItem.Substring(0,index) + Else + itemToAdd = resultItem.Substring(0,index) & "..." + End If + Else + If index = Len(resultItem) Then + itemToAdd = "..." & resultItem.Substring(index - (columnLength - 3), (columnLength - 3)) + Else + 'Truncate the string to show only columnLength - 6 characters as begining and trailing "..." has to be appended. + itemToAdd = "..." & resultItem.Substring(index - (columnLength - 6), columnLength - 6) & "..." + End If + End If + End If + + ' Remove newline character from itemToAdd + Dim prefixTextIndex As Integer = itemToAdd.IndexOf(prefixText, StringComparison.CurrentCultureIgnoreCase) + ' If itemToAdd contains any newline after the search text then show text only till newline + Dim regex2 As System.Text.RegularExpressions.Regex = New System.Text.RegularExpressions.Regex("(" & vbCrLf & "|" & vbLf & ")", System.Text.RegularExpressions.RegexOptions.IgnoreCase) + Dim newLineIndexAfterPrefix As Integer = -1 + If regex2.IsMatch(itemToAdd, prefixTextIndex) Then + newLineIndexAfterPrefix = regex2.Match(itemToAdd, prefixTextIndex).Index + End If + If (newLineIndexAfterPrefix > -1) Then + If itemToAdd.EndsWith("...") Then + itemToAdd = (itemToAdd.Substring(0, newLineIndexAfterPrefix) + "...") + Else + itemToAdd = itemToAdd.Substring(0, newLineIndexAfterPrefix) + End If + End If + ' If itemToAdd contains any newline before search text then show text which comes after newline + Dim regex3 As System.Text.RegularExpressions.Regex = New System.Text.RegularExpressions.Regex("(" & vbCrLf & "|" & vbLf & ")", (System.Text.RegularExpressions.RegexOptions.IgnoreCase Or System.Text.RegularExpressions.RegexOptions.RightToLeft)) + Dim newLineIndexBeforePrefix As Integer = -1 + If regex3.IsMatch(itemToAdd, prefixTextIndex) Then + newLineIndexBeforePrefix = regex3.Match(itemToAdd, prefixTextIndex).Index + End If + If (newLineIndexBeforePrefix > -1) Then + If itemToAdd.StartsWith("...") Then + itemToAdd = ("..." + itemToAdd.Substring((newLineIndexBeforePrefix + regex3.Match(itemToAdd, prefixTextIndex).Length))) + Else + itemToAdd = itemToAdd.Substring((newLineIndexBeforePrefix + regex3.Match(itemToAdd, prefixTextIndex).Length)) + End If + End If + + If Not itemToAdd is nothing AndAlso Not resultList.Contains(itemToAdd) Then + + resultList.Add(itemToAdd) + + isAdded = true + End If + End If + Return isAdded + End Function + + + Protected Overridable Sub GetPageSize() + + If Me.PersonalLanguageSkillPagination.PageSize.Text.Trim <> "" Then + Try + 'Me.PageSize = Integer.Parse(Me.PersonalLanguageSkillPagination.PageSize.Text) + Catch ex As Exception + End Try + End If + End Sub + + Protected Overridable Sub AddNewRecords() + + Dim newRecordList As ArrayList = New ArrayList() + + Dim newUIDataList As System.Collections.Generic.List(Of Hashtable) = New System.Collections.Generic.List(Of Hashtable)() + + ' Loop though all the record controls and if the record control + ' does not have a unique record id set, then create a record + ' and add to the list. + If Not Me.ResetData Then + Dim rep As System.Web.UI.WebControls.Repeater = CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalLanguageSkillTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return + + Dim repItem As System.Web.UI.WebControls.RepeaterItem + For Each repItem In rep.Items + ' Loop through all rows in the table, set its DataSource and call DataBind(). + + Dim recControl As PersonalLanguageSkillTableControlRow = DirectCast(repItem.FindControl("PersonalLanguageSkillTableControlRow"), PersonalLanguageSkillTableControlRow) + + If recControl.Visible AndAlso recControl.IsNewRecord() Then + + Dim rec As PersonalLanguageSkillRecord = New PersonalLanguageSkillRecord() + + If recControl.LanguageId.Text <> "" Then + rec.Parse(recControl.LanguageId.Text, PersonalLanguageSkillTable.LanguageId) + End If + If recControl.Level.Text <> "" Then + rec.Parse(recControl.Level.Text, PersonalLanguageSkillTable.Level) + End If + newUIDataList.Add(recControl.PreservedUIData()) + newRecordList.Add(rec) + End If + Next + End If + + + ' Add any new record to the list. + Dim index As Integer = 0 + For index = 1 To Me.AddNewRecord + + newRecordList.Insert(0, New PersonalLanguageSkillRecord()) + newUIDataList.Insert(0, New Hashtable()) + + Next + Me.AddNewRecord = 0 + + ' Finally, add any new records to the DataSource. + If newRecordList.Count > 0 Then + + Dim finalList As ArrayList = New ArrayList(Me.DataSource) + finalList.InsertRange(0, newRecordList) + + Me.DataSource = DirectCast(finalList.ToArray(GetType(PersonalLanguageSkillRecord)), PersonalLanguageSkillRecord()) + + End If + + ' Add the existing UI data to this hash table + If newUIDataList.Count > 0 Then + Me.UIData.InsertRange(0, newUIDataList) + End If + + End Sub + + + Public Sub AddToDeletedRecordIds(ByVal rec As PersonalLanguageSkillTableControlRow) + If rec.IsNewRecord() Then + Return + End If + + If Not Me.DeletedRecordIds Is Nothing AndAlso Me.DeletedRecordIds.Trim <> "" Then + Me.DeletedRecordIds &= "," + End If + + Me.DeletedRecordIds &= "[" & rec.RecordUniqueId & "]" + End Sub + + Protected Overridable Function InDeletedRecordIds(ByVal rec As PersonalLanguageSkillTableControlRow) As Boolean + If Me.DeletedRecordIds Is Nothing OrElse Me.DeletedRecordIds.Trim = "" Then + Return False + End If + + Return Me.DeletedRecordIds.IndexOf("[" & rec.RecordUniqueId & "]") >= 0 + End Function + + Private _DeletedRecordIds As String + Public Property DeletedRecordIds() As String + Get + Return Me._DeletedRecordIds + End Get + Set(ByVal value As String) + Me._DeletedRecordIds = value + End Set + End Property + + + ' Create Set, WhereClause, and Populate Methods + + Public Overridable Sub SetLanguageIdLabel1() + + End Sub + + Public Overridable Sub SetLevelLabel1() + + End Sub + + Public Overridable Sub SetPersonalLanguageSkillTableControlCollapsibleRegion() + + End Sub + + + + + Protected Overridable Sub Control_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.PreRender + ' PreRender event is raised just before page is being displayed. + Try + DbUtils.StartTransaction + Me.RegisterPostback() + + If Not Me.Page.ErrorOnPage AndAlso (Me.Page.IsPageRefresh OrElse Me.DataChanged OrElse Me.ResetData) Then + + + ' Re-load the data and update the web page if necessary. + ' This is typically done during a postback (filter, search button, sort, pagination button). + ' In each of the other click handlers, simply set DataChanged to True to reload the data. + + Me.LoadData() + Me.DataBind() + + End If + + + + Catch ex As Exception + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + Finally + DbUtils.EndTransaction + End Try + End Sub + + + Protected Overrides Sub SaveControlsToSession() + MyBase.SaveControlsToSession() + + ' Save filter controls to values to session. + + + 'Save pagination state to session. + + + + ' Save table control properties to the session. + If Not Me.CurrentSortOrder Is Nothing Then + Me.SaveToSession(Me, "Order_By", Me.CurrentSortOrder.ToXmlString()) + End If + + Me.SaveToSession(Me, "Page_Index", Me.PageIndex.ToString()) + Me.SaveToSession(Me, "Page_Size", Me.PageSize.ToString()) + + Me.SaveToSession(Me, "DeletedRecordIds", Me.DeletedRecordIds) + + End Sub + + Protected Sub SaveControlsToSession_Ajax() + ' Save filter controls to values to session. + + HttpContext.Current.Session("AppRelativeVirtualPath") = Me.Page.AppRelativeVirtualPath + + End Sub + + Protected Overrides Sub ClearControlsFromSession() + MyBase.ClearControlsFromSession() + + ' Clear filter controls values from the session. + + + ' Clear pagination state from session. + + + + ' Clear table properties from the session. + Me.RemoveFromSession(Me, "Order_By") + Me.RemoveFromSession(Me, "Page_Index") + Me.RemoveFromSession(Me, "Page_Size") + + Me.RemoveFromSession(Me, "DeletedRecordIds") + + End Sub + + Protected Overrides Sub LoadViewState(ByVal savedState As Object) + MyBase.LoadViewState(savedState) + + Dim orderByStr As String = CType(ViewState("PersonalLanguageSkillTableControl_OrderBy"), String) + + If orderByStr IsNot Nothing AndAlso orderByStr.Trim <> "" Then + Me.CurrentSortOrder = BaseClasses.Data.OrderBy.FromXmlString(orderByStr) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + End If + + Dim pageIndex As String = CType(ViewState("Page_Index"), String) + If pageIndex IsNot Nothing Then + Me.PageIndex = CInt(pageIndex) + End If + + Dim pageSize As String = CType(ViewState("Page_Size"), String) + If Not pageSize Is Nothing Then + Me.PageSize = CInt(pageSize) + End If + + + + ' Load view state for pagination control. + + Me.DeletedRecordIds = CType(Me.ViewState("DeletedRecordIds"), String) + + End Sub + + Protected Overrides Function SaveViewState() As Object + + If Me.CurrentSortOrder IsNot Nothing Then + Me.ViewState("PersonalLanguageSkillTableControl_OrderBy") = Me.CurrentSortOrder.ToXmlString() + End If + + Me.ViewState("Page_Index") = Me.PageIndex + Me.ViewState("Page_Size") = Me.PageSize + + Me.ViewState("DeletedRecordIds") = Me.DeletedRecordIds + + + ' Load view state for pagination control. + + + Return MyBase.SaveViewState() + End Function + + ' Generate the event handling functions for pagination events. + + ' event handler for ImageButton + Public Overridable Sub PersonalLanguageSkillPagination_FirstPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.PageIndex = 0 + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalLanguageSkillPagination_LastPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.DisplayLastPage = True + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalLanguageSkillPagination_NextPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.PageIndex += 1 + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for LinkButton + Public Overridable Sub PersonalLanguageSkillPagination_PageSizeButton_Click(ByVal sender As Object, ByVal args As EventArgs) + + Try + + Me.DataChanged = True + + Me.PageSize = Integer.Parse(Me.PersonalLanguageSkillPagination.PageSize.Text) + + Me.PageIndex = Integer.Parse(Me.PersonalLanguageSkillPagination.CurrentPage.Text) - 1 + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalLanguageSkillPagination_PreviousPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + If Me.PageIndex > 0 Then + Me.PageIndex -= 1 + Me.DataChanged = True + End If + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + + ' Generate the event handling functions for sorting events. + + Public Overridable Sub LanguageIdLabel1_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by LanguageId when clicked. + + ' Get previous sorting state for LanguageId. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalLanguageSkillTable.LanguageId) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for LanguageId. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalLanguageSkillTable.LanguageId, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by LanguageId, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub LevelLabel1_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by Level when clicked. + + ' Get previous sorting state for Level. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalLanguageSkillTable.Level) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for Level. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalLanguageSkillTable.Level, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by Level, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + + ' Generate the event handling functions for button events. + + ' event handler for ImageButton + Public Overridable Sub PersonalLanguageSkillExportCSVButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + ' Build the where clause based on the current filter and search criteria + ' Create the Order By clause based on the user's current sorting preference. + + Dim wc As WhereClause = CreateWhereClause + Dim orderBy As OrderBy = Nothing + + orderBy = CreateOrderBy + + ' Add each of the columns in order of export. + Dim columns() as BaseColumn = New BaseColumn() { _ + PersonalLanguageSkillTable.LanguageId, _ + PersonalLanguageSkillTable.Level, _ + Nothing} + Dim exportData as ExportDataToCSV = New ExportDataToCSV(PersonalLanguageSkillTable.Instance, wc, orderBy, columns) + + Dim done As Boolean = False + + Dim totalRowsReturned As Integer = 0 + Dim join As CompoundFilter = CreateCompoundJoinFilter() + Dim data As DataForExport = New DataForExport(PersonalLanguageSkillTable.Instance, wc, orderBy, columns, join) + + 'Check for Export Data Threshold + Dim exportRawValues As Boolean = False + Me.TotalRecords = PersonalLanguageSkillTable.GetRecordCount(join, wc) + If Me.TotalRecords > 10000 Then + exportRawValues = True + End If + exportData.StartExport(Me.Page.Response, exportRawValues) + + ' Read pageSize records at a time and write out the CSV file. + While (Not done) + Dim recList As ArrayList = data.GetRows(exportData.pageSize) + If recList Is Nothing Then + Exit While 'no more records we are done + End If + + totalRowsReturned = recList.Count + For Each rec As BaseRecord In recList + For Each col As BaseColumn In data.ColumnList + If col Is Nothing Then + Continue For + End If + + If Not data.IncludeInExport(col) Then + Continue For + End If + + Dim val As String = "" + + If exportRawValues Then + val = rec.GetValue(col).ToString() + Else + Dim _isExpandableNonCompositeForeignKey As Boolean = col.TableDefinition.IsExpandableNonCompositeForeignKey(col) + If _isExpandableNonCompositeForeignKey AndAlso col.IsApplyDisplayAs Then + val = PersonalLanguageSkillTable.GetDFKA(rec.GetValue(col).ToString(), col, Nothing) + End If + If (Not _isExpandableNonCompositeForeignKey) Or (String.IsNullOrEmpty(val)) Then + val = exportData.GetDataForExport(col, rec) + End If + End If + exportData.WriteColumnData(val, data.IsString(col)) + + Next col + exportData.WriteNewRow() + Next rec + + ' If we already are below the pageSize, then we are done. + If totalRowsReturned < exportData.pageSize Then + done = True + End If + End While + exportData.FinishExport(Me.Page.Response) + + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalLanguageSkillExportExcelButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + ' To customize the columns or the format, override this function in Section 1 of the page + ' and modify it to your liking. + ' Build the where clause based on the current filter and search criteria + ' Create the Order By clause based on the user's current sorting preference. + + Dim wc As WhereClause = CreateWhereClause + Dim orderBy As OrderBy = Nothing + + orderBy = CreateOrderBy + + Dim done As Boolean = False + Dim val As Object = "" + ' Read pageSize records at a time and write out the Excel file. + Dim totalRowsReturned As Integer = 0 + + Me.TotalRecords = PersonalLanguageSkillTable.GetRecordCount(wc) + If Me.TotalRecords > 10000 Then + + ' Add each of the columns in order of export. + Dim columns() as BaseColumn = New BaseColumn() { _ + PersonalLanguageSkillTable.LanguageId, _ + PersonalLanguageSkillTable.Level, _ + Nothing} + Dim exportData as ExportDataToCSV = New ExportDataToCSV(PersonalLanguageSkillTable.Instance, wc, orderBy, columns) + exportData.StartExport(Me.Page.Response, True) + + Dim dataForCSV As DataForExport = New DataForExport(PersonalLanguageSkillTable.Instance, wc, orderBy, columns) + + ' Read pageSize records at a time and write out the CSV file. + While (Not done) + Dim recList As ArrayList = dataForCSV.GetRows(exportData.pageSize) + If recList Is Nothing Then + Exit While 'no more records we are done + End If + + totalRowsReturned = recList.Count + For Each rec As BaseRecord In recList + For Each col As BaseColumn In dataForCSV.ColumnList + If col Is Nothing Then + Continue For + End If + + If Not dataForCSV.IncludeInExport(col) Then + Continue For + End If + + val = rec.GetValue(col).ToString() + exportData.WriteColumnData(val, dataForCSV.IsString(col)) + + Next col + exportData.WriteNewRow() + Next rec + + ' If we already are below the pageSize, then we are done. + If totalRowsReturned < exportData.pageSize Then + done = True + End If + End While + exportData.FinishExport(Me.Page.Response) + Else + + ' Create an instance of the Excel report class with the table class, where clause and order by. + Dim excelReport As ExportDataToExcel = New ExportDataToExcel(PersonalLanguageSkillTable.Instance, wc, orderBy) + ' Add each of the columns in order of export. + ' To customize the data type, change the second parameter of the new ExcelColumn to be + ' a format string from Excel's Format Cell menu. For example "dddd, mmmm dd, yyyy h:mm AM/PM;@", "#,##0.00" + + If Me.Page.Response Is Nothing Then + Return + End If + + excelReport.CreateExcelBook() + + Dim width As Integer = 0 + Dim columnCounter As Integer = 0 + Dim data As DataForExport = New DataForExport(PersonalLanguageSkillTable.Instance, wc, orderBy, Nothing) + data.ColumnList.Add(New ExcelColumn(PersonalLanguageSkillTable.LanguageId, "Default")) + data.ColumnList.Add(New ExcelColumn(PersonalLanguageSkillTable.Level, "Default")) + + + For Each col As ExcelColumn In data.ColumnList + width = excelReport.GetExcelCellWidth(col) + If data.IncludeInExport(col) Then + excelReport.AddColumnToExcelBook(columnCounter, col.ToString(), excelReport.GetExcelDataType(col), width, excelReport.GetDisplayFormat(col)) + columnCounter = columnCounter + 1 + End If + Next col + + While (Not done) + Dim recList As ArrayList = data.GetRows(excelReport.pageSize) + + If recList Is Nothing Then + Exit While 'no more records we are done + End If + + totalRowsReturned = recList.Count + + For Each rec As BaseRecord In recList + excelReport.AddRowToExcelBook() + columnCounter = 0 + + For Each col As ExcelColumn In data.ColumnList + If Not data.IncludeInExport(col) Then + Continue For + End If + + Dim _isExpandableNonCompositeForeignKey As Boolean = col.DisplayColumn.TableDefinition.IsExpandableNonCompositeForeignKey(col.DisplayColumn) + If _isExpandableNonCompositeForeignKey AndAlso col.DisplayColumn.IsApplyDisplayAs Then + val = PersonalLanguageSkillTable.GetDFKA(rec.GetValue(col.DisplayColumn).ToString(), col.DisplayColumn, Nothing) + If val Is Nothing Then + val = rec.Format(col.DisplayColumn) + End If + Else + val = excelReport.GetValueForExcelExport(col, rec) + End If + excelReport.AddCellToExcelRow(columnCounter, excelReport.GetExcelDataType(col), val, col.DisplayFormat) + + columnCounter = columnCounter + 1 + Next col + Next rec + + ' If we already are below the pageSize, then we are done. + If totalRowsReturned < excelReport.pageSize Then + done = True + End If + End While + + excelReport.SaveExcelBook(Me.Page.Response) + End If + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalLanguageSkillImportButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalLanguageSkillPDFButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + Dim report As PDFReport = New PDFReport() + report.SpecificReportFileName = Page.Server.MapPath("ShowPersonalId.PersonalLanguageSkillPDFButton.report") + ' report.Title replaces the value tag of page header and footer containing ${ReportTitle} + report.Title = "PersonalLanguageSkill" + ' If ShowPersonalId.PersonalLanguageSkillPDFButton.report specifies a valid report template, + ' AddColumn method will generate a report template. + ' Each AddColumn method-call specifies a column + ' The 1st parameter represents the text of the column header + ' The 2nd parameter represents the horizontal alignment of the column header + ' The 3rd parameter represents the text format of the column detail + ' The 4th parameter represents the horizontal alignment of the column detail + ' The 5th parameter represents the relative width of the column + report.AddColumn(PersonalLanguageSkillTable.LanguageId.Name, ReportEnum.Align.Left, "${LanguageId}", ReportEnum.Align.Left, 30) + report.AddColumn(PersonalLanguageSkillTable.Level.Name, ReportEnum.Align.Left, "${Level}", ReportEnum.Align.Left, 30) + + + Dim rowsPerQuery As Integer = 5000 + Dim recordCount As Integer = 0 + + report.Page = Page.GetResourceValue("Txt:Page", "Persons") + report.ApplicationPath = Me.Page.MapPath(Page.Request.ApplicationPath) + + Dim whereClause As WhereClause = CreateWhereClause + Dim orderBy As OrderBy = CreateOrderBy + Dim joinFilter As BaseFilter = CreateCompoundJoinFilter() + + Dim pageNum As Integer = 0 + Dim totalRows As Integer = PersonalLanguageSkillTable.GetRecordCount(joinFilter,whereClause) + Dim columns As ColumnList = PersonalLanguageSkillTable.GetColumnList() + Dim records As PersonalLanguageSkillRecord() = Nothing + + Do + + records = PersonalLanguageSkillTable.GetRecords(joinFilter,whereClause, orderBy, pageNum, rowsPerQuery) + If Not (records Is Nothing) AndAlso records.Length > 0 AndAlso whereClause.RunQuery Then + For Each record As PersonalLanguageSkillRecord In records + + ' AddData method takes four parameters + ' The 1st parameters represent the data format + ' The 2nd parameters represent the data value + ' The 3rd parameters represent the default alignment of column using the data + ' The 4th parameters represent the maximum length of the data value being shown + If BaseClasses.Utils.MiscUtils.IsNull(record.LanguageId) Then + report.AddData("${LanguageId}", "",ReportEnum.Align.Left, 100) + Else + Dim _isExpandableNonCompositeForeignKey as Boolean + Dim _DFKA as String = "" + _isExpandableNonCompositeForeignKey = PersonalLanguageSkillTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalLanguageSkillTable.LanguageId) + _DFKA = PersonalLanguageSkillTable.GetDFKA(record.LanguageId.ToString(), PersonalLanguageSkillTable.LanguageId,Nothing) + If _isExpandableNonCompositeForeignKey AndAlso (not _DFKA Is Nothing) AndAlso PersonalLanguageSkillTable.LanguageId.IsApplyDisplayAs Then + report.AddData("${LanguageId}", _DFKA,ReportEnum.Align.Left, 100) + Else + report.AddData("${LanguageId}", record.Format(PersonalLanguageSkillTable.LanguageId), ReportEnum.Align.Left, 100) + End If + End If + report.AddData("${Level}", record.Format(PersonalLanguageSkillTable.Level), ReportEnum.Align.Left, 100) + + report.WriteRow + Next + pageNum = pageNum + 1 + recordCount += records.Length + End If + Loop While Not (records Is Nothing) AndAlso recordCount < totalRows AndAlso whereClause.RunQuery + + report.Close + BaseClasses.Utils.NetUtils.WriteResponseBinaryAttachment(Me.Page.Response, report.Title + ".pdf", report.ReportInByteArray, 0, true) + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalLanguageSkillRefreshButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Dim PersonalDDTableControlObj as PersonalDDTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalDDTableControl"), PersonalDDTableControl) + PersonalDDTableControlObj.ResetData = True + + PersonalDDTableControlObj.RemoveFromSession(PersonalDDTableControlObj, "DeletedRecordIds") + PersonalDDTableControlObj.DeletedRecordIds = Nothing + + Dim PersonalEducationTableControlObj as PersonalEducationTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalEducationTableControl"), PersonalEducationTableControl) + PersonalEducationTableControlObj.ResetData = True + + PersonalEducationTableControlObj.RemoveFromSession(PersonalEducationTableControlObj, "DeletedRecordIds") + PersonalEducationTableControlObj.DeletedRecordIds = Nothing + + Dim PersonalExtWorkTableControlObj as PersonalExtWorkTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalExtWorkTableControl"), PersonalExtWorkTableControl) + PersonalExtWorkTableControlObj.ResetData = True + + PersonalExtWorkTableControlObj.RemoveFromSession(PersonalExtWorkTableControlObj, "DeletedRecordIds") + PersonalExtWorkTableControlObj.DeletedRecordIds = Nothing + + Dim PersonalIdRecordControlObj as PersonalIdRecordControl = DirectCast(Me.Page.FindControlRecursively("PersonalIdRecordControl"), PersonalIdRecordControl) + PersonalIdRecordControlObj.ResetData = True + + + Dim PersonalInsigniaTableControlObj as PersonalInsigniaTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalInsigniaTableControl"), PersonalInsigniaTableControl) + PersonalInsigniaTableControlObj.ResetData = True + + PersonalInsigniaTableControlObj.RemoveFromSession(PersonalInsigniaTableControlObj, "DeletedRecordIds") + PersonalInsigniaTableControlObj.DeletedRecordIds = Nothing + + Dim PersonalLanguageSkillTableControlObj as PersonalLanguageSkillTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalLanguageSkillTableControl"), PersonalLanguageSkillTableControl) + PersonalLanguageSkillTableControlObj.ResetData = True + + PersonalLanguageSkillTableControlObj.RemoveFromSession(PersonalLanguageSkillTableControlObj, "DeletedRecordIds") + PersonalLanguageSkillTableControlObj.DeletedRecordIds = Nothing + + Dim PersonalNameTableControlObj as PersonalNameTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalNameTableControl"), PersonalNameTableControl) + PersonalNameTableControlObj.ResetData = True + + PersonalNameTableControlObj.RemoveFromSession(PersonalNameTableControlObj, "DeletedRecordIds") + PersonalNameTableControlObj.DeletedRecordIds = Nothing + + Dim PersonalRankTableControlObj as PersonalRankTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalRankTableControl"), PersonalRankTableControl) + PersonalRankTableControlObj.ResetData = True + + PersonalRankTableControlObj.RemoveFromSession(PersonalRankTableControlObj, "DeletedRecordIds") + PersonalRankTableControlObj.DeletedRecordIds = Nothing + + Dim PersonalSalaryTableControlObj as PersonalSalaryTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalSalaryTableControl"), PersonalSalaryTableControl) + PersonalSalaryTableControlObj.ResetData = True + + PersonalSalaryTableControlObj.RemoveFromSession(PersonalSalaryTableControlObj, "DeletedRecordIds") + PersonalSalaryTableControlObj.DeletedRecordIds = Nothing + + Dim PersonalSpecialSkillTableControlObj as PersonalSpecialSkillTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalSpecialSkillTableControl"), PersonalSpecialSkillTableControl) + PersonalSpecialSkillTableControlObj.ResetData = True + + PersonalSpecialSkillTableControlObj.RemoveFromSession(PersonalSpecialSkillTableControlObj, "DeletedRecordIds") + PersonalSpecialSkillTableControlObj.DeletedRecordIds = Nothing + + Dim PersonalSportSkillTableControlObj as PersonalSportSkillTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalSportSkillTableControl"), PersonalSportSkillTableControl) + PersonalSportSkillTableControlObj.ResetData = True + + PersonalSportSkillTableControlObj.RemoveFromSession(PersonalSportSkillTableControlObj, "DeletedRecordIds") + PersonalSportSkillTableControlObj.DeletedRecordIds = Nothing + + Dim PersonalTitleTableControlObj as PersonalTitleTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalTitleTableControl"), PersonalTitleTableControl) + PersonalTitleTableControlObj.ResetData = True + + PersonalTitleTableControlObj.RemoveFromSession(PersonalTitleTableControlObj, "DeletedRecordIds") + PersonalTitleTableControlObj.DeletedRecordIds = Nothing + + Dim PersonRelativeTableControlObj as PersonRelativeTableControl = DirectCast(Me.Page.FindControlRecursively("PersonRelativeTableControl"), PersonRelativeTableControl) + PersonRelativeTableControlObj.ResetData = True + + PersonRelativeTableControlObj.RemoveFromSession(PersonRelativeTableControlObj, "DeletedRecordIds") + PersonRelativeTableControlObj.DeletedRecordIds = Nothing + + Dim ReportPropertiesTableControlObj as ReportPropertiesTableControl = DirectCast(Me.Page.FindControlRecursively("ReportPropertiesTableControl"), ReportPropertiesTableControl) + ReportPropertiesTableControlObj.ResetData = True + + ReportPropertiesTableControlObj.RemoveFromSession(ReportPropertiesTableControlObj, "DeletedRecordIds") + ReportPropertiesTableControlObj.DeletedRecordIds = Nothing + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalLanguageSkillResetButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.CurrentSortOrder.Reset() + If Me.InSession(Me, "Order_By") Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + + End If + + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalLanguageSkillWordButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + Dim report As WordReport = New WordReport + report.SpecificReportFileName = Page.Server.MapPath("ShowPersonalId.PersonalLanguageSkillWordButton.word") + ' report.Title replaces the value tag of page header and footer containing ${ReportTitle} + report.Title = "PersonalLanguageSkill" + ' If ShowPersonalId.PersonalLanguageSkillWordButton.report specifies a valid report template, + ' AddColumn method will generate a report template. + ' Each AddColumn method-call specifies a column + ' The 1st parameter represents the text of the column header + ' The 2nd parameter represents the horizontal alignment of the column header + ' The 3rd parameter represents the text format of the column detail + ' The 4th parameter represents the horizontal alignment of the column detail + ' The 5th parameter represents the relative width of the column + report.AddColumn(PersonalLanguageSkillTable.LanguageId.Name, ReportEnum.Align.Left, "${LanguageId}", ReportEnum.Align.Left, 30) + report.AddColumn(PersonalLanguageSkillTable.Level.Name, ReportEnum.Align.Left, "${Level}", ReportEnum.Align.Left, 30) + + Dim whereClause As WhereClause = CreateWhereClause + + Dim orderBy As OrderBy = CreateOrderBy + Dim joinFilter As BaseFilter = CreateCompoundJoinFilter() + + Dim rowsPerQuery As Integer = 5000 + Dim pageNum As Integer = 0 + Dim recordCount As Integer = 0 + Dim totalRows As Integer = PersonalLanguageSkillTable.GetRecordCount(joinFilter,whereClause) + + report.Page = Page.GetResourceValue("Txt:Page", "Persons") + report.ApplicationPath = Me.Page.MapPath(Page.Request.ApplicationPath) + + Dim columns As ColumnList = PersonalLanguageSkillTable.GetColumnList() + Dim records As PersonalLanguageSkillRecord() = Nothing + Do + records = PersonalLanguageSkillTable.GetRecords(joinFilter,whereClause, orderBy, pageNum, rowsPerQuery) + + If Not (records Is Nothing) AndAlso records.Length > 0 AndAlso whereClause.RunQuery Then + For Each record As PersonalLanguageSkillRecord In records + ' AddData method takes four parameters + ' The 1st parameters represent the data format + ' The 2nd parameters represent the data value + ' The 3rd parameters represent the default alignment of column using the data + ' The 4th parameters represent the maximum length of the data value being shown + If BaseClasses.Utils.MiscUtils.IsNull(record.LanguageId) Then + report.AddData("${LanguageId}", "",ReportEnum.Align.Left, 100) + Else + Dim _isExpandableNonCompositeForeignKey as Boolean + Dim _DFKA as String = "" + _isExpandableNonCompositeForeignKey = PersonalLanguageSkillTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalLanguageSkillTable.LanguageId) + _DFKA = PersonalLanguageSkillTable.GetDFKA(record.LanguageId.ToString(), PersonalLanguageSkillTable.LanguageId,Nothing) + If _isExpandableNonCompositeForeignKey AndAlso (not _DFKA Is Nothing) AndAlso PersonalLanguageSkillTable.LanguageId.IsApplyDisplayAs Then + report.AddData("${LanguageId}", _DFKA,ReportEnum.Align.Left, 100) + Else + report.AddData("${LanguageId}", record.Format(PersonalLanguageSkillTable.LanguageId), ReportEnum.Align.Left, 100) + End If + End If + report.AddData("${Level}", record.Format(PersonalLanguageSkillTable.Level), ReportEnum.Align.Left, 100) + + report.WriteRow + Next + pageNum = pageNum + 1 + recordCount += records.Length + End If + Loop While Not (records Is Nothing) AndAlso recordCount < totalRows AndAlso whereClause.RunQuery + report.save + BaseClasses.Utils.NetUtils.WriteResponseBinaryAttachment(Me.Page.Response, report.Title + ".doc", report.ReportInByteArray, 0, true) + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + + + ' Generate the event handling functions for filter and search events. + + + ' Generate the event handling functions for others + + + Private _UIData As New System.Collections.Generic.List(Of Hashtable) + Public Property UIData() As System.Collections.Generic.List(Of Hashtable) + Get + Return Me._UIData + End Get + Set(ByVal value As System.Collections.Generic.List(Of Hashtable)) + Me._UIData = value + End Set + End Property + + ' pagination properties + Protected _PageSize As Integer + Public Property PageSize() As Integer + Get + Return Me._PageSize + End Get + Set(ByVal value As Integer) + Me._PageSize = value + End Set + End Property + + Protected _PageIndex As Integer + Public Property PageIndex() As Integer + Get + ' Return the PageIndex + Return Me._PageIndex + End Get + Set(ByVal value As Integer) + Me._PageIndex = value + End Set + End Property + + Protected _TotalRecords As Integer = -1 + Public Property TotalRecords() As Integer + Get + If _TotalRecords < 0 + _TotalRecords = PersonalLanguageSkillTable.GetRecordCount(CreateCompoundJoinFilter(), CreateWhereClause()) + End If + Return Me._TotalRecords + End Get + Set(ByVal value As Integer) + If Me.PageSize > 0 Then + + Me.TotalPages = CInt(Math.Ceiling(value / Me.PageSize)) + + End If + Me._TotalRecords = value + End Set + End Property + + + + Protected _TotalPages As Integer = -1 + Public Property TotalPages() As Integer + Get + If _TotalPages < 0 Then + + Me.TotalPages = CInt(Math.Ceiling(TotalRecords / Me.PageSize)) + + End If + Return Me._TotalPages + End Get + Set(ByVal value As Integer) + Me._TotalPages = value + End Set + End Property + + Protected _DisplayLastPage As Boolean + Public Property DisplayLastPage() As Boolean + Get + Return Me._DisplayLastPage + End Get + Set(ByVal value As Boolean) + Me._DisplayLastPage = value + End Set + End Property + + Private _DataChanged As Boolean = False + Public Property DataChanged() As Boolean + Get + Return Me._DataChanged + End Get + Set(ByVal value As Boolean) + Me._DataChanged = value + End Set + End Property + + Private _ResetData As Boolean = False + Public Property ResetData() As Boolean + Get + Return Me._ResetData + End Get + Set(ByVal value As Boolean) + Me._ResetData = value + End Set + End Property + + Private _AddNewRecord As Integer = 0 + Public Property AddNewRecord() As Integer + Get + Return Me._AddNewRecord + End Get + Set(ByVal value As Integer) + Me._AddNewRecord = value + End Set + End Property + + + Private _CurrentSortOrder As OrderBy = Nothing + Public Property CurrentSortOrder() As OrderBy + Get + Return Me._CurrentSortOrder + End Get + Set(ByVal value As BaseClasses.Data.OrderBy) + Me._CurrentSortOrder = value + End Set + End Property + + Private _DataSource() As PersonalLanguageSkillRecord = Nothing + Public Property DataSource() As PersonalLanguageSkillRecord () + Get + Return Me._DataSource + End Get + Set(ByVal value() As PersonalLanguageSkillRecord) + Me._DataSource = value + End Set + End Property + +#Region "Helper Properties" + + Public ReadOnly Property LanguageIdLabel1() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "LanguageIdLabel1"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property LevelLabel1() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "LevelLabel1"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property PersonalLanguageSkillExportCSVButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalLanguageSkillExportCSVButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalLanguageSkillExportExcelButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalLanguageSkillExportExcelButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalLanguageSkillImportButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalLanguageSkillImportButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalLanguageSkillPagination() As Persons.UI.IPagination + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalLanguageSkillPagination"), Persons.UI.IPagination) + End Get + End Property + + Public ReadOnly Property PersonalLanguageSkillPDFButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalLanguageSkillPDFButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalLanguageSkillRefreshButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalLanguageSkillRefreshButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalLanguageSkillResetButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalLanguageSkillResetButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalLanguageSkillTableControlCollapsibleRegion() As System.Web.UI.WebControls.Panel + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalLanguageSkillTableControlCollapsibleRegion"), System.Web.UI.WebControls.Panel) + End Get + End Property + + Public ReadOnly Property PersonalLanguageSkillWordButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalLanguageSkillWordButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + +#End Region + +#Region "Helper Functions" + + Public Overrides Overloads Function ModifyRedirectUrl(url As String, arg As String, ByVal bEncrypt As Boolean) As String + Return Me.Page.EvaluateExpressions(url, arg, bEncrypt, Me) + End Function + + Public Overrides Overloads Function EvaluateExpressions(url As String, arg As String, ByVal bEncrypt As Boolean) As String + Dim needToProcess As Boolean = AreAnyUrlParametersForMe(url, arg) + If (needToProcess) Then + Dim recCtl As PersonalLanguageSkillTableControlRow = Me.GetSelectedRecordControl() + If recCtl Is Nothing AndAlso url.IndexOf("{") >= 0 Then + ' Localization. + Throw New Exception(Page.GetResourceValue("Err:NoRecSelected", "Persons")) + End If + Dim rec As PersonalLanguageSkillRecord = Nothing + If recCtl IsNot Nothing Then + rec = recCtl.GetRecord() + End If + Return EvaluateExpressions(url, arg, rec, bEncrypt) + End If + Return url + End Function + + Public Overridable Function GetSelectedRecordControl() As PersonalLanguageSkillTableControlRow + Return Nothing + + End Function + + Public Overridable Function GetSelectedRecordControls() As PersonalLanguageSkillTableControlRow() + + Return DirectCast((new ArrayList()).ToArray(GetType(PersonalLanguageSkillTableControlRow)), PersonalLanguageSkillTableControlRow()) + + End Function + + Public Overridable Sub DeleteSelectedRecords(ByVal deferDeletion As Boolean) + Dim recList() As PersonalLanguageSkillTableControlRow = Me.GetSelectedRecordControls() + If recList.Length = 0 Then + ' Localization. + Throw New Exception(Page.GetResourceValue("Err:NoRecSelected", "Persons")) + End If + + Dim recCtl As PersonalLanguageSkillTableControlRow + For Each recCtl In recList + If deferDeletion Then + If Not recCtl.IsNewRecord Then + + Me.AddToDeletedRecordIds(recCtl) + + End If + recCtl.Visible = False + + Else + + recCtl.Delete() + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + End If + Next + End Sub + + Public Function GetRecordControls() As PersonalLanguageSkillTableControlRow() + Dim recList As ArrayList = New ArrayList() + Dim rep As System.Web.UI.WebControls.Repeater = CType(Me.FindControl("PersonalLanguageSkillTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return Nothing + Dim repItem As System.Web.UI.WebControls.RepeaterItem + + For Each repItem In rep.Items + + Dim recControl As PersonalLanguageSkillTableControlRow = DirectCast(repItem.FindControl("PersonalLanguageSkillTableControlRow"), PersonalLanguageSkillTableControlRow) + recList.Add(recControl) + + Next + + Return DirectCast(recList.ToArray(GetType(PersonalLanguageSkillTableControlRow)), PersonalLanguageSkillTableControlRow()) + End Function + + Public Shadows ReadOnly Property Page() As BaseApplicationPage + Get + Return DirectCast(MyBase.Page, BaseApplicationPage) + End Get + End Property + +#End Region + + + +End Class + + +' Base class for the PersonalNameTableControlRow control on the ShowPersonalId page. +' Do not modify this class. Instead override any method in PersonalNameTableControlRow. +Public Class BasePersonalNameTableControlRow + Inherits Persons.UI.BaseApplicationRecordControl + + ' To customize, override this method in PersonalNameTableControlRow. + Protected Overridable Sub Control_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Init + + Me.ClearControlsFromSession() + End Sub + + ' To customize, override this method in PersonalNameTableControlRow. + Protected Overridable Sub Control_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load + + 'Call LoadFocusScripts from repeater so that onfocus attribute could be added to elements + Me.Page.LoadFocusScripts(Me) + + + ' Register the event handlers. + + + End Sub + + + Public Overridable Sub LoadData() + + ' Load the data from the database into the DataSource PersonalName 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 = PersonalNameTable.GetRecord(Me.RecordUniqueId, True) + + Return + End If + + ' Since this is a row in the table, the data for this row is loaded by the + ' LoadData method of the BasePersonalNameTableControl when the data for the entire + ' table is loaded. + + Me.DataSource = New PersonalNameRecord() + + + + End Sub + + ' Populate the UI controls using the DataSource. To customize, override this method in PersonalNameTableControlRow. + 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 + + SetNameDate() + SetPersonalLastName1() + SetPersonalName1() + SetRef2() + + + 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 SetNameDate() + + + ' Set the NameDate Literal on the webpage with value from the + ' PersonalName database record. + + ' Me.DataSource is the PersonalName record retrieved from the database. + ' Me.NameDate is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetNameDate() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.NameDateSpecified Then + + ' If the NameDate is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalNameTable.NameDate, "d MMM yy") + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.NameDate.Text = formattedValue + + Else + + ' NameDate is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.NameDate.Text = PersonalNameTable.NameDate.Format(PersonalNameTable.NameDate.DefaultValue, "d MMM yy") + + End If + + ' If the NameDate is NULL or blank, then use the value specified + ' on Properties. + If Me.NameDate.Text Is Nothing _ + OrElse Me.NameDate.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.NameDate.Text = " " + End If + + End Sub + + Public Overridable Sub SetPersonalLastName1() + + + ' Set the PersonalLastName Literal on the webpage with value from the + ' PersonalName database record. + + ' Me.DataSource is the PersonalName record retrieved from the database. + ' Me.PersonalLastName1 is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetPersonalLastName1() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.PersonalLastNameSpecified Then + + ' If the PersonalLastName is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalNameTable.PersonalLastName) + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.PersonalLastName1.Text = formattedValue + + Else + + ' PersonalLastName is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.PersonalLastName1.Text = PersonalNameTable.PersonalLastName.Format(PersonalNameTable.PersonalLastName.DefaultValue) + + End If + + ' If the PersonalLastName is NULL or blank, then use the value specified + ' on Properties. + If Me.PersonalLastName1.Text Is Nothing _ + OrElse Me.PersonalLastName1.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.PersonalLastName1.Text = " " + End If + + End Sub + + Public Overridable Sub SetPersonalName1() + + + ' Set the PersonalName Literal on the webpage with value from the + ' PersonalName database record. + + ' Me.DataSource is the PersonalName record retrieved from the database. + ' Me.PersonalName1 is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetPersonalName1() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.PersonalNameSpecified Then + + ' If the PersonalName is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalNameTable.PersonalName) + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.PersonalName1.Text = formattedValue + + Else + + ' PersonalName is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.PersonalName1.Text = PersonalNameTable.PersonalName.Format(PersonalNameTable.PersonalName.DefaultValue) + + End If + + ' If the PersonalName is NULL or blank, then use the value specified + ' on Properties. + If Me.PersonalName1.Text Is Nothing _ + OrElse Me.PersonalName1.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.PersonalName1.Text = " " + End If + + End Sub + + Public Overridable Sub SetRef2() + + + ' Set the Ref Literal on the webpage with value from the + ' PersonalName database record. + + ' Me.DataSource is the PersonalName record retrieved from the database. + ' Me.Ref2 is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetRef2() + ' 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(PersonalNameTable.Ref0) + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.Ref2.Text = formattedValue + + Else + + ' Ref is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.Ref2.Text = PersonalNameTable.Ref0.Format(PersonalNameTable.Ref0.DefaultValue) + + End If + + ' If the Ref is NULL or blank, then use the value specified + ' on Properties. + If Me.Ref2.Text Is Nothing _ + OrElse Me.Ref2.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.Ref2.Text = " " + End If + + End Sub + + + Public EvaluateFormulaDelegate As BaseClasses.Data.DataSource.EvaluateFormulaDelegate = New BaseClasses.Data.DataSource.EvaluateFormulaDelegate(AddressOf Me.EvaluateFormula) + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean, ByVal e As FormulaEvaluator) As String + If e Is Nothing Then + e = New FormulaEvaluator() + End If + + e.Variables.Clear() + + + ' add variables for formula evaluation + If variables IsNot Nothing Then + Dim enumerator As System.Collections.Generic.IEnumerator(Of System.Collections.Generic.KeyValuePair(Of String, Object)) = variables.GetEnumerator() + While enumerator.MoveNext() + e.Variables.Add(enumerator.Current.Key, enumerator.Current.Value) + End While + End If + + If includeDS + + End IF + + + ' Other variables referred to in the formula are expected to be + ' properties of the DataSource. For example, referring to + ' UnitPrice as a variable will refer to DataSource.UnitPrice + If dataSourceForEvaluate Is Nothing Then + + e.DataSource = Me.DataSource + + Else + e.DataSource = dataSourceForEvaluate + End If + + ' Define the calling control. This is used to add other + ' related table and record controls as variables. + e.CallingControl = Me + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + + If Not String.IsNullOrEmpty(format) AndAlso (String.IsNullOrEmpty(formula) OrElse formula.IndexOf("Format(") < 0) Then + Return FormulaUtils.Format(resultObj, format) + Else + Return resultObj.ToString() + End If + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format,variables ,includeDS, Nothing) + End Function + + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object)) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format, variables ,True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, format, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal e as FormulaEvaluator) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, variables, True, e) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal includeDS as Boolean) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, includeDS, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, True, Nothing) + End Function + + + Public Overridable Sub RegisterPostback() + + + End Sub + + + + ' To customize, override this method in PersonalNameTableControlRow. + 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 parentCtrl As PersonalIdRecordControl + + + parentCtrl = DirectCast(Me.Page.FindControlRecursively("PersonalIdRecordControl"), PersonalIdRecordControl) + + If (Not IsNothing(parentCtrl) AndAlso IsNothing(parentCtrl.DataSource)) + ' Load the record if it is not loaded yet. + parentCtrl.LoadData() + End If + If (IsNothing(parentCtrl) OrElse IsNothing(parentCtrl.DataSource)) + ' Get the error message from the application resource file. + Throw New Exception(Page.GetResourceValue("Err:NoParentRecId", "Persons")) + End If + + Me.DataSource.PersonalId = parentCtrl.DataSource.PersonalId + + ' 2. Perform any custom validation. + Me.Validate() + + + ' 3. Set the values in the record with data from UI controls. + ' This calls the Get() method for each of the user interface controls. + Me.GetUIData() + + ' 4. Save in the database. + ' We should not save the record if the data did not change. This + ' will save a database hit and avoid triggering any database triggers. + + If Me.DataSource.IsAnyValueChanged Then + ' Save record to database but do not commit yet. + ' Auto generated ids are available after saving for use by child (dependent) records. + Me.DataSource.Save() + + DirectCast(GetParentControlObject(Me, "PersonalNameTableControl"), PersonalNameTableControl).DataChanged = True + DirectCast(GetParentControlObject(Me, "PersonalNameTableControl"), PersonalNameTableControl).ResetData = True + End If + + + ' update session or cookie by formula + + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + ' For Master-Detail relationships, save data on the Detail table(s) + + End Sub + + ' To customize, override this method in PersonalNameTableControlRow. + 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. + + GetNameDate() + GetPersonalLastName1() + GetPersonalName1() + GetRef2() + End Sub + + + Public Overridable Sub GetNameDate() + + End Sub + + Public Overridable Sub GetPersonalLastName1() + + End Sub + + Public Overridable Sub GetPersonalName1() + + End Sub + + Public Overridable Sub GetRef2() + + End Sub + + + ' To customize, override this method in PersonalNameTableControlRow. + + Public Overridable Function CreateWhereClause() As WhereClause + + Return Nothing + + End Function + + + + ' To customize, override this method in PersonalNameTableControlRow. + 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) + PersonalNameTable.DeleteRecord(pkValue) + + DirectCast(GetParentControlObject(Me, "PersonalNameTableControl"), PersonalNameTableControl).DataChanged = True + DirectCast(GetParentControlObject(Me, "PersonalNameTableControl"), PersonalNameTableControl).ResetData = True + End Sub + + Protected Overridable Sub Control_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.PreRender + ' PreRender event is raised just before page is being displayed. + Try + DbUtils.StartTransaction() + Me.RegisterPostback() + + If Not Me.Page.ErrorOnPage AndAlso (Me.Page.IsPageRefresh OrElse Me.DataChanged OrElse Me.ResetData) Then + + + ' Re-load the data and update the web page if necessary. + ' This is typically done during a postback (filter, search button, sort, pagination button). + ' In each of the other click handlers, simply set DataChanged to True to reload the data. + Me.LoadData() + Me.DataBind() + End If + + + Catch ex As Exception + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + Finally + DbUtils.EndTransaction() + End Try + End Sub + + + Protected Overrides Sub SaveControlsToSession() + MyBase.SaveControlsToSession() + + + 'Save pagination state to session. + + End Sub + + + + Protected Overrides Sub ClearControlsFromSession() + MyBase.ClearControlsFromSession() + + + + ' Clear pagination state from session. + + End Sub + + Protected Overrides Sub LoadViewState(ByVal savedState As Object) + MyBase.LoadViewState(savedState) + Dim isNewRecord As String = CType(ViewState("IsNewRecord"), String) + If Not isNewRecord Is Nothing AndAlso isNewRecord.Trim <> "" Then + Me.IsNewRecord = Boolean.Parse(isNewRecord) + End If + + Dim myCheckSum As String = CType(ViewState("CheckSum"), String) + If Not myCheckSum Is Nothing AndAlso myCheckSum.Trim <> "" Then + Me.CheckSum = myCheckSum + End If + + + ' Load view state for pagination control. + + End Sub + + Protected Overrides Function SaveViewState() As Object + ViewState("IsNewRecord") = Me.IsNewRecord.ToString() + ViewState("CheckSum") = Me.CheckSum + + + ' Load view state for pagination control. + + Return MyBase.SaveViewState() + End Function + + + + 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("BasePersonalNameTableControlRow_Rec"), String) + End Get + Set(ByVal value As String) + Me.ViewState("BasePersonalNameTableControlRow_Rec") = value + End Set + End Property + + Private _DataSource As PersonalNameRecord + Public Property DataSource() As PersonalNameRecord + Get + Return Me._DataSource + End Get + + Set(ByVal value As PersonalNameRecord) + + Me._DataSource = value + End Set + End Property + + + + Private _checkSum As String + Public Overridable Property CheckSum() As String + Get + Return Me._checkSum + End Get + Set(ByVal value As String) + Me._checkSum = value + End Set + End Property + + Private _TotalPages As Integer + Public Property TotalPages() As Integer + Get + Return Me._TotalPages + End Get + Set(ByVal value As Integer) + Me._TotalPages = value + End Set + End Property + + Private _PageIndex As Integer + Public Property PageIndex() As Integer + Get + ' Return the PageIndex + Return Me._PageIndex + End Get + Set(ByVal value As Integer) + Me._PageIndex = value + End Set + End Property + + Private _DisplayLastPage As Boolean + Public Property DisplayLastPage() As Boolean + Get + Return Me._DisplayLastPage + End Get + Set(ByVal value As Boolean) + Me._DisplayLastPage = value + End Set + End Property + + + +#Region "Helper Properties" + + Public ReadOnly Property NameDate() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "NameDate"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property PersonalLastName1() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalLastName1"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property PersonalName1() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalName1"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property Ref2() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Ref2"), 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 PersonalNameRecord = 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 PersonalNameRecord + If Not Me.DataSource Is Nothing Then + Return Me.DataSource + End If + + If Not Me.RecordUniqueId Is Nothing Then + + Return PersonalNameTable.GetRecord(Me.RecordUniqueId, True) + + End If + + ' Localization. + + Return Nothing + + End Function + + Public Shadows ReadOnly Property Page() As BaseApplicationPage + Get + Return DirectCast(MyBase.Page, BaseApplicationPage) + End Get + End Property + +#End Region + +End Class + + + +' Base class for the PersonalNameTableControl control on the ShowPersonalId page. +' Do not modify this class. Instead override any method in PersonalNameTableControl. +Public Class BasePersonalNameTableControl + Inherits Persons.UI.BaseApplicationTableControl + + + + Protected Overridable Sub Control_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Init + + + + ' Setup the filter and search events. + + + + ' Control Initializations. + ' Initialize the table's current sort order. + + If Me.InSession(Me, "Order_By") Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + Me.CurrentSortOrder.Add(PersonalNameTable.NameDate, OrderByItem.OrderDir.Asc) + + End If + + + + ' Setup default pagination settings. + + Me.PageSize = CInt(Me.GetFromSession(Me, "Page_Size", "10")) + Me.PageIndex = CInt(Me.GetFromSession(Me, "Page_Index", "0")) + + + + Me.ClearControlsFromSession() + End Sub + + Protected Overridable Sub Control_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load + + SaveControlsToSession_Ajax() + + ' Setup the pagination events. + + AddHandler Me.PersonalNamePagination.FirstPage.Click, AddressOf PersonalNamePagination_FirstPage_Click + + AddHandler Me.PersonalNamePagination.LastPage.Click, AddressOf PersonalNamePagination_LastPage_Click + + AddHandler Me.PersonalNamePagination.NextPage.Click, AddressOf PersonalNamePagination_NextPage_Click + + AddHandler Me.PersonalNamePagination.PageSizeButton.Click, AddressOf PersonalNamePagination_PageSizeButton_Click + + AddHandler Me.PersonalNamePagination.PreviousPage.Click, AddressOf PersonalNamePagination_PreviousPage_Click + + + ' Setup the sorting events. + + AddHandler Me.NameDateLabel.Click, AddressOf NameDateLabel_Click + + AddHandler Me.PersonalLastNameLabel2.Click, AddressOf PersonalLastNameLabel2_Click + + AddHandler Me.PersonalNameLabel2.Click, AddressOf PersonalNameLabel2_Click + + AddHandler Me.RefLabel1.Click, AddressOf RefLabel1_Click + + ' Setup the button events. + + AddHandler Me.PersonalNameExportCSVButton.Click, AddressOf PersonalNameExportCSVButton_Click + + AddHandler Me.PersonalNameExportExcelButton.Click, AddressOf PersonalNameExportExcelButton_Click + + Me.PersonalNameImportButton.PostBackUrl = "../Shared/SelectFileToImport.aspx?TableName=PersonalName" + Me.PersonalNameImportButton.Attributes.Item("onClick") = "window.open('" & Me.Page.EncryptUrlParameter(Me.PersonalNameImportButton.PostBackUrl) & "','importWindow', 'width=700, height=500,top=' +(screen.availHeight-500)/2 + ',left=' + (screen.availWidth-700)/2+ ', resizable=yes, scrollbars=yes,modal=yes'); return false;" + + AddHandler Me.PersonalNameImportButton.Click, AddressOf PersonalNameImportButton_Click + + AddHandler Me.PersonalNamePDFButton.Click, AddressOf PersonalNamePDFButton_Click + + AddHandler Me.PersonalNameRefreshButton.Click, AddressOf PersonalNameRefreshButton_Click + + AddHandler Me.PersonalNameResetButton.Click, AddressOf PersonalNameResetButton_Click + + AddHandler Me.PersonalNameWordButton.Click, AddressOf PersonalNameWordButton_Click + + + ' Setup events for others + + End Sub + + + Public Overridable Sub LoadData() + + ' Read data from database. Returns an array of records that can be assigned + ' to the DataSource table control property. + Try + Dim joinFilter As CompoundFilter = CreateCompoundJoinFilter() + + ' The WHERE clause will be empty when displaying all records in table. + Dim wc As WhereClause = CreateWhereClause() + If wc IsNot Nothing AndAlso Not wc.RunQuery Then + ' Initialize an empty array of records + Dim alist As New ArrayList(0) + Me.DataSource = DirectCast(alist.ToArray(GetType(PersonalNameRecord)), PersonalNameRecord()) + ' Add records to the list if needed. + Me.AddNewRecords() + Me._TotalRecords = 0 + Me._TotalPages = 0 + Return + End If + + ' Call OrderBy to determine the order - either use the order defined + ' on the Query Wizard, or specified by user (by clicking on column heading) + Dim orderBy As OrderBy = CreateOrderBy() + + ' Get the pagesize from the pagesize control. + Me.GetPageSize() + + If Me.DisplayLastPage Then + Dim totalRecords As Integer = If(Me._TotalRecords < 0, PersonalNameTable.GetRecordCount(CreateCompoundJoinFilter(), CreateWhereClause()), Me._TotalRecords) + + Dim totalPages As Integer = CInt(Math.Ceiling(totalRecords / Me.PageSize)) + + Me.PageIndex = totalPages - 1 + End If + + ' Make sure PageIndex (current page) and PageSize are within bounds. + If Me.PageIndex < 0 Then + Me.PageIndex = 0 + End If + If Me.PageSize < 1 Then + Me.PageSize = 1 + End If + + ' Retrieve the records and set the table DataSource. + ' Only PageSize records are fetched starting at PageIndex (zero based). + If Me.AddNewRecord > 0 Then + ' Make sure to preserve the previously entered data on new rows. + Dim postdata As New ArrayList + For Each rc As PersonalNameTableControlRow In Me.GetRecordControls() + If Not rc.IsNewRecord Then + rc.DataSource = rc.GetRecord() + rc.GetUIData() + postdata.Add(rc.DataSource) + UIData.Add(rc.PreservedUIData()) + End If + Next + Me.DataSource = DirectCast(postdata.ToArray(GetType(PersonalNameRecord)), PersonalNameRecord()) + Else ' Get the records from the database + Me.DataSource = PersonalNameTable.GetRecords(joinFilter, wc, orderBy, Me.PageIndex, Me.PageSize) + + End If + + ' if the datasource contains no records contained in database, then load the last page. + If (DbUtils.GetCreatedRecords(Me.DataSource).Length = 0 AndAlso Not Me.DisplayLastPage) Then + Me.DisplayLastPage = True + LoadData() + Else + + ' Add any new rows desired by the user. + Me.AddNewRecords() + + + ' Initialize the page and grand totals. now + + End If + + Catch ex As Exception + ' Report the error message to the end user + Dim msg As String = ex.Message + If ex.InnerException IsNot Nothing Then + msg = msg & " InnerException: " & ex.InnerException.Message + End If + Throw New Exception(msg, ex.InnerException) + End Try + End Sub + + + + + Public Overrides Sub DataBind() + ' The DataBind method binds the user interface controls to the values + ' from the database record for each row in the table. To do this, it calls the + ' DataBind for each of the rows. + ' DataBind also populates any filters above the table, and sets the pagination + ' control to the correct number of records and the current page number. + + MyBase.DataBind() + + ' Make sure that the DataSource is initialized. + If Me.DataSource Is Nothing Then + Return + End If + + 'LoadData for DataSource for chart and report if they exist + + ' Setup the pagination controls. + BindPaginationControls() + + + + ' Bind the repeater with the list of records to expand the UI. + Dim rep As System.Web.UI.WebControls.Repeater = CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalNameTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return + rep.DataSource = DataSource() + rep.DataBind() + + Dim index As Integer = 0 + For Each repItem As System.Web.UI.WebControls.RepeaterItem In rep.Items + ' Loop through all rows in the table, set its DataSource and call DataBind(). + Dim recControl As PersonalNameTableControlRow = DirectCast(repItem.FindControl("PersonalNameTableControlRow"), PersonalNameTableControlRow) + recControl.DataSource = Me.DataSource(index) + If Me.UIData.Count > index Then + recControl.PreviousUIData = Me.UIData(index) + End If + recControl.DataBind() + recControl.Visible = Not Me.InDeletedRecordIds(recControl) + + index += 1 + Next + + + + + ' Call the Set methods for each controls on the panel + + SetNameDateLabel() + SetPersonalLastNameLabel2() + + + + SetPersonalNameLabel2() + + + + + SetPersonalNameTableControlCollapsibleRegion() + + SetRefLabel1() + ' setting the state of expand or collapse alternative rows + + + ' Load data for each record and table UI control. + ' Ordering is important because child controls get + ' their parent ids from their parent UI controls. + + + ' this method calls the set method for controls with special formula like running total, sum, rank, etc + SetFormulaControls() + End Sub + + Public Overridable Sub SetFormulaControls() + ' this method calls Set methods for the control that has special formula + + + + End Sub + + + + Public Overridable Sub RegisterPostback() + + Me.Page.RegisterPostBackTrigger(MiscUtils.FindControlRecursively(Me,"PersonalNameExportCSVButton")) + + Me.Page.RegisterPostBackTrigger(MiscUtils.FindControlRecursively(Me,"PersonalNameExportExcelButton")) + + Me.Page.RegisterPostBackTrigger(MiscUtils.FindControlRecursively(Me,"PersonalNamePDFButton")) + + Me.Page.RegisterPostBackTrigger(MiscUtils.FindControlRecursively(Me,"PersonalNameWordButton")) + + + End Sub + + Public EvaluateFormulaDelegate As BaseClasses.Data.DataSource.EvaluateFormulaDelegate = New BaseClasses.Data.DataSource.EvaluateFormulaDelegate(AddressOf Me.EvaluateFormula) + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean, ByVal e as FormulaEvaluator) As String + If e Is Nothing + e = New FormulaEvaluator() + End If + + e.Variables.Clear() + + + ' add variables for formula evaluation + If variables IsNot Nothing Then + Dim enumerator As System.Collections.Generic.IEnumerator(Of System.Collections.Generic.KeyValuePair(Of String, Object)) = variables.GetEnumerator() + While enumerator.MoveNext() + e.Variables.Add(enumerator.Current.Key, enumerator.Current.Value) + End While + End If + + If includeDS + + End If + + ' All variables referred to in the formula are expected to be + ' properties of the DataSource. For example, referring to + ' UnitPrice as a variable will refer to DataSource.UnitPrice + e.DataSource = dataSourceForEvaluate + + ' Define the calling control. This is used to add other + ' related table and record controls as variables. + e.CallingControl = Me + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + + If Not String.IsNullOrEmpty(format) AndAlso (String.IsNullOrEmpty(formula) OrElse formula.IndexOf("Format(") < 0) Then + Return FormulaUtils.Format(resultObj, format) + Else + Return resultObj.ToString() + End If + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format,variables ,includeDS, Nothing) + End Function + + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object)) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format, variables ,True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, format, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal e as FormulaEvaluator) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, variables, True, e) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal includeDS as Boolean) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, includeDS, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, True, Nothing) + End Function + + + + + Public Overridable Sub ResetControl() + + Me.CurrentSortOrder.Reset() + If (Me.InSession(Me, "Order_By")) Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + Me.CurrentSortOrder.Add(PersonalNameTable.NameDate, OrderByItem.OrderDir.Asc) + + End If + + Me.PageIndex = 0 + End Sub + + Protected Overridable Sub BindPaginationControls() + ' Setup the pagination controls. + + ' Bind the pagination labels. + + If DbUtils.GetCreatedRecords(Me.DataSource).Length > 0 Then + + Me.PersonalNamePagination.CurrentPage.Text = (Me.PageIndex + 1).ToString() + Else + Me.PersonalNamePagination.CurrentPage.Text = "0" + End If + Me.PersonalNamePagination.PageSize.Text = Me.PageSize.ToString() + Me.PersonalNamePagination.TotalItems.Text = Me.TotalRecords.ToString() + Me.PersonalNamePagination.TotalPages.Text = Me.TotalPages.ToString() + + ' Bind the buttons for PersonalNameTableControl pagination. + + Me.PersonalNamePagination.FirstPage.Enabled = Not (Me.PageIndex = 0) + If Me._TotalPages < 0 Then ' if the total pages is not determined yet, enable last and next buttons + Me.PersonalNamePagination.LastPage.Enabled = True + ElseIf Me._TotalPages = 0 ' if the total pages is determined and it is 0, enable last and next buttons + Me.PersonalNamePagination.LastPage.Enabled = False + Else ' if the total pages is the last page, disable last and next buttons + Me.PersonalNamePagination.LastPage.Enabled = Not (Me.PageIndex = Me.TotalPages - 1) + End If + + If Me._TotalPages < 0 Then ' if the total pages is not determined yet, enable last and next buttons + Me.PersonalNamePagination.NextPage.Enabled = True + ElseIf Me._TotalPages = 0 ' if the total pages is determined and it is 0, enable last and next buttons + Me.PersonalNamePagination.NextPage.Enabled = False + Else ' if the total pages is the last page, disable last and next buttons + Me.PersonalNamePagination.NextPage.Enabled = Not (Me.PageIndex = Me.TotalPages - 1) + End If + + Me.PersonalNamePagination.PreviousPage.Enabled = Not (Me.PageIndex = 0) + + + End Sub + + Public Overridable Sub SaveData() + ' Save the data from the entire table. Calls each row's Save Data + ' to save their data. This function is called by the Click handler of the + ' Save button. The button handler should Start/Commit/End a transaction. + + Dim recCtl As PersonalNameTableControlRow + For Each recCtl In Me.GetRecordControls() + + If Me.InDeletedRecordIds(recCtl) Then + ' Delete any pending deletes. + recCtl.Delete() + Else + If recCtl.Visible Then + recCtl.SaveData() + End If + End If + + Next + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + ' Set IsNewRecord to False for all records - since everything has been saved and is no longer "new" + For Each recCtl In Me.GetRecordControls() + recCtl.IsNewRecord = False + Next + + + ' Set DeletedRecordsIds to Nothing since we have deleted all pending deletes. + Me.DeletedRecordIds = Nothing + + End Sub + + Public Overridable Function CreateCompoundJoinFilter() As CompoundFilter + Dim jFilter As CompoundFilter = New CompoundFilter() + + Return jFilter + + End Function + + + Public Overridable Function CreateOrderBy() As OrderBy + ' The CurrentSortOrder is initialized to the sort order on the + ' Query Wizard. It may be modified by the Click handler for any of + ' the column heading to sort or reverse sort by that column. + ' You can add your own sort order, or modify it on the Query Wizard. + Return Me.CurrentSortOrder + End Function + + Public Overridable Function CreateWhereClause() As WhereClause + 'This CreateWhereClause is used for loading the data. + PersonalNameTable.Instance.InnerFilter = Nothing + Dim wc As WhereClause = New WhereClause() + + ' Compose the WHERE clause consiting of: + ' 1. Static clause defined at design time. + ' 2. User selected search criteria. + ' 3. User selected filter criteria. + + + Dim selectedRecordKeyValue as KeyValue = New KeyValue() + + Dim personalIdRecordControlObj As Persons.UI.Controls.ShowPersonalId.PersonalIdRecordControl = DirectCast(MiscUtils.FindControlRecursively(Me.Page, "PersonalIdRecordControl"), Persons.UI.Controls.ShowPersonalId.PersonalIdRecordControl) + + If (Not IsNothing(personalIdRecordControlObj) AndAlso Not IsNothing(personalIdRecordControlObj.GetRecord()) AndAlso personalIdRecordControlObj.GetRecord().IsCreated AndAlso Not IsNothing(personalIdRecordControlObj.GetRecord().PersonalId)) + wc.iAND(PersonalNameTable.PersonalId, BaseFilter.ComparisonOperator.EqualsTo, personalIdRecordControlObj.GetRecord().PersonalId.ToString()) + selectedRecordKeyValue.AddElement(PersonalNameTable.PersonalId.InternalName, personalIdRecordControlObj.GetRecord().PersonalId.ToString()) + Else + wc.RunQuery = False + Return wc + End If + + HttpContext.Current.Session("PersonalNameTableControlWhereClause") = selectedRecordKeyValue.ToXmlString() + + Return wc + End Function + + + Public Overridable Function CreateWhereClause(ByVal searchText as String, ByVal fromSearchControl as String, ByVal AutoTypeAheadSearch as String, ByVal AutoTypeAheadWordSeparators as String) As WhereClause + ' This CreateWhereClause is used for loading list of suggestions for Auto Type-Ahead feature. + PersonalNameTable.Instance.InnerFilter = Nothing + Dim wc As WhereClause = New WhereClause() + + ' Compose the WHERE clause consiting of: + ' 1. Static clause defined at design time. + ' 2. User selected search criteria. + ' 3. User selected filter criteria. + + Dim appRelativeVirtualPath As String = CType(HttpContext.Current.Session("AppRelativeVirtualPath"), String) + + Dim selectedRecordInPersonalIdRecordControl as String = DirectCast(HttpContext.Current.Session("PersonalNameTableControlWhereClause"), String) + + If Not selectedRecordInPersonalIdRecordControl Is Nothing AndAlso KeyValue.IsXmlKey(selectedRecordInPersonalIdRecordControl) Then + Dim selectedRecordKeyValue as KeyValue = KeyValue.XmlToKey(selectedRecordInPersonalIdRecordControl) + + If Not IsNothing(selectedRecordKeyValue) AndAlso selectedRecordKeyValue.ContainsColumn(PersonalNameTable.PersonalId) Then + wc.iAND(PersonalNameTable.PersonalId, BaseFilter.ComparisonOperator.EqualsTo, selectedRecordKeyValue.GetColumnValue(PersonalNameTable.PersonalId).ToString()) + End If + + End If + + ' Adds clauses if values are selected in Filter controls which are configured in the page. + + + Return wc + End Function + + + Public Overridable Function FormatSuggestions(ByVal prefixText As String, ByVal resultItem As String, _ + ByVal columnLength As Integer, ByVal AutoTypeAheadDisplayFoundText As String, _ + ByVal autoTypeAheadSearch As String, ByVal AutoTypeAheadWordSeparators As String, _ + ByVal resultList As ArrayList) As Boolean + + 'Formats the resultItem and adds it to the list of suggestions. + Dim index As Integer = resultItem.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture).IndexOf(prefixText.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture)) + Dim itemToAdd As String = "" + Dim isFound As Boolean = False + Dim isAdded As Boolean = False + ' Get the index where prfixt is at the beginning of resultItem. If not found then, index of word which begins with prefixText. + If InvariantLCase(autoTypeAheadSearch).equals("wordsstartingwithsearchstring") And Not index = 0 Then + ' Expression to find word which contains AutoTypeAheadWordSeparators followed by prefixText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex( AutoTypeAheadWordSeparators + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + If regex1.IsMatch(resultItem) Then + index = regex1.Match(resultItem).Index + isFound = True + End If + ' If the prefixText is found immediatly after white space then starting of the word is found so don not search any further + If not resultItem(index).ToString() = " " Then + ' Expression to find beginning of the word which contains AutoTypeAheadWordSeparators followed by prefixText + Dim regex As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\\S*" + AutoTypeAheadWordSeparators + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + If regex.IsMatch(resultItem) Then + index = regex.Match(resultItem).Index + isFound = True + End If + End If + End If + + ' If autoTypeAheadSearch value is wordsstartingwithsearchstring then, extract the substring only if the prefixText is found at the + ' beginning of the resultItem (index = 0) or a word in resultItem is found starts with prefixText. + If index = 0 Or isFound Or InvariantLCase(autoTypeAheadSearch).Equals("anywhereinstring") then + If InvariantLCase(AutoTypeAheadDisplayFoundText).equals("atbeginningofmatchedstring") Then + ' Expression to find beginning of the word which contains prefixText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\\S*" + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + ' Find the beginning of the word which contains prefexText + If (StringUtils.InvariantLCase(autoTypeAheadSearch).Equals("anywhereinstring") AndAlso regex1.IsMatch(resultItem)) Then + index = regex1.Match(resultItem).Index + isFound = True + End If + ' Display string from the index till end of the string if sub string from index till end is less than columnLength value. + If Len(resultItem) - index <= columnLength Then + If index = 0 Then + itemToAdd = resultItem + Else + itemToAdd = "..." & resultItem.Substring(index, Len(resultItem) - index) + End If + Else + If index = 0 Then + itemToAdd = resultItem.Substring(index, (columnLength - 3)) & "..." + Else + 'Truncate the string to show only columnLength - 6 characters as begining and trailing "..." has to be appended. + itemToAdd = "..." & resultItem.Substring(index , columnLength - 6) & "..." + End If + End If + ElseIf InvariantLCase(AutoTypeAheadDisplayFoundText).equals("inmiddleofmatchedstring") Then + Dim subStringBeginIndex As Integer = CType(columnLength/2, Integer) + If Len(resultItem) <= columnLength Then + itemToAdd = resultItem + Else + ' Sanity check at end of the string + If index + Len(prefixText) = columnLength Then + itemToAdd = "..." & resultItem.Substring(index-columnLength,index) + ElseIf Len(resultItem) - index < subStringBeginIndex Then + ' Display string from the end till columnLength value if, index is closer to the end of the string. + itemToAdd = "..." & resultItem.Substring(Len(resultItem)-columnLength,Len(resultItem)) + ElseIf index <= subStringBeginIndex Then + ' Sanity chet at beginning of the string + itemToAdd = resultItem.Substring(0, columnLength) & "..." + Else + ' Display string containing text before the prefixText occures and text after the prefixText + itemToAdd = "..." & resultItem.Substring(index - subStringBeginIndex, columnLength) & "..." + End If + End If + ElseIf InvariantLCase(AutoTypeAheadDisplayFoundText).equals("atendofmatchedstring") Then + ' Expression to find ending of the word which contains prefexText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\s", System.Text.RegularExpressions.RegexOptions.IgnoreCase) + ' Find the ending of the word which contains prefexText + If regex1.IsMatch(resultItem, index + 1) Then + index = regex1.Match(resultItem, index + 1).Index + Else + ' If the word which contains prefexText is the last word in string, regex1.IsMatch returns false. + index = resultItem.Length + End If + If index > Len(resultItem) Then + index = Len(resultItem) + End If + ' If text from beginning of the string till index is less than columnLength value then, display string from the beginning till index. + If index <= columnLength Then + if index = Len(resultItem) Then 'Make decision to append "..." + itemToAdd = resultItem.Substring(0,index) + Else + itemToAdd = resultItem.Substring(0,index) & "..." + End If + Else + If index = Len(resultItem) Then + itemToAdd = "..." & resultItem.Substring(index - (columnLength - 3), (columnLength - 3)) + Else + 'Truncate the string to show only columnLength - 6 characters as begining and trailing "..." has to be appended. + itemToAdd = "..." & resultItem.Substring(index - (columnLength - 6), columnLength - 6) & "..." + End If + End If + End If + + ' Remove newline character from itemToAdd + Dim prefixTextIndex As Integer = itemToAdd.IndexOf(prefixText, StringComparison.CurrentCultureIgnoreCase) + ' If itemToAdd contains any newline after the search text then show text only till newline + Dim regex2 As System.Text.RegularExpressions.Regex = New System.Text.RegularExpressions.Regex("(" & vbCrLf & "|" & vbLf & ")", System.Text.RegularExpressions.RegexOptions.IgnoreCase) + Dim newLineIndexAfterPrefix As Integer = -1 + If regex2.IsMatch(itemToAdd, prefixTextIndex) Then + newLineIndexAfterPrefix = regex2.Match(itemToAdd, prefixTextIndex).Index + End If + If (newLineIndexAfterPrefix > -1) Then + If itemToAdd.EndsWith("...") Then + itemToAdd = (itemToAdd.Substring(0, newLineIndexAfterPrefix) + "...") + Else + itemToAdd = itemToAdd.Substring(0, newLineIndexAfterPrefix) + End If + End If + ' If itemToAdd contains any newline before search text then show text which comes after newline + Dim regex3 As System.Text.RegularExpressions.Regex = New System.Text.RegularExpressions.Regex("(" & vbCrLf & "|" & vbLf & ")", (System.Text.RegularExpressions.RegexOptions.IgnoreCase Or System.Text.RegularExpressions.RegexOptions.RightToLeft)) + Dim newLineIndexBeforePrefix As Integer = -1 + If regex3.IsMatch(itemToAdd, prefixTextIndex) Then + newLineIndexBeforePrefix = regex3.Match(itemToAdd, prefixTextIndex).Index + End If + If (newLineIndexBeforePrefix > -1) Then + If itemToAdd.StartsWith("...") Then + itemToAdd = ("..." + itemToAdd.Substring((newLineIndexBeforePrefix + regex3.Match(itemToAdd, prefixTextIndex).Length))) + Else + itemToAdd = itemToAdd.Substring((newLineIndexBeforePrefix + regex3.Match(itemToAdd, prefixTextIndex).Length)) + End If + End If + + If Not itemToAdd is nothing AndAlso Not resultList.Contains(itemToAdd) Then + + resultList.Add(itemToAdd) + + isAdded = true + End If + End If + Return isAdded + End Function + + + Protected Overridable Sub GetPageSize() + + If Me.PersonalNamePagination.PageSize.Text.Trim <> "" Then + Try + 'Me.PageSize = Integer.Parse(Me.PersonalNamePagination.PageSize.Text) + Catch ex As Exception + End Try + End If + End Sub + + Protected Overridable Sub AddNewRecords() + + Dim newRecordList As ArrayList = New ArrayList() + + Dim newUIDataList As System.Collections.Generic.List(Of Hashtable) = New System.Collections.Generic.List(Of Hashtable)() + + ' Loop though all the record controls and if the record control + ' does not have a unique record id set, then create a record + ' and add to the list. + If Not Me.ResetData Then + Dim rep As System.Web.UI.WebControls.Repeater = CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalNameTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return + + Dim repItem As System.Web.UI.WebControls.RepeaterItem + For Each repItem In rep.Items + ' Loop through all rows in the table, set its DataSource and call DataBind(). + + Dim recControl As PersonalNameTableControlRow = DirectCast(repItem.FindControl("PersonalNameTableControlRow"), PersonalNameTableControlRow) + + If recControl.Visible AndAlso recControl.IsNewRecord() Then + + Dim rec As PersonalNameRecord = New PersonalNameRecord() + + If recControl.NameDate.Text <> "" Then + rec.Parse(recControl.NameDate.Text, PersonalNameTable.NameDate) + End If + If recControl.PersonalLastName1.Text <> "" Then + rec.Parse(recControl.PersonalLastName1.Text, PersonalNameTable.PersonalLastName) + End If + If recControl.PersonalName1.Text <> "" Then + rec.Parse(recControl.PersonalName1.Text, PersonalNameTable.PersonalName) + End If + If recControl.Ref2.Text <> "" Then + rec.Parse(recControl.Ref2.Text, PersonalNameTable.Ref0) + End If + newUIDataList.Add(recControl.PreservedUIData()) + newRecordList.Add(rec) + End If + Next + End If + + + ' Add any new record to the list. + Dim index As Integer = 0 + For index = 1 To Me.AddNewRecord + + newRecordList.Insert(0, New PersonalNameRecord()) + newUIDataList.Insert(0, New Hashtable()) + + Next + Me.AddNewRecord = 0 + + ' Finally, add any new records to the DataSource. + If newRecordList.Count > 0 Then + + Dim finalList As ArrayList = New ArrayList(Me.DataSource) + finalList.InsertRange(0, newRecordList) + + Me.DataSource = DirectCast(finalList.ToArray(GetType(PersonalNameRecord)), PersonalNameRecord()) + + End If + + ' Add the existing UI data to this hash table + If newUIDataList.Count > 0 Then + Me.UIData.InsertRange(0, newUIDataList) + End If + + End Sub + + + Public Sub AddToDeletedRecordIds(ByVal rec As PersonalNameTableControlRow) + If rec.IsNewRecord() Then + Return + End If + + If Not Me.DeletedRecordIds Is Nothing AndAlso Me.DeletedRecordIds.Trim <> "" Then + Me.DeletedRecordIds &= "," + End If + + Me.DeletedRecordIds &= "[" & rec.RecordUniqueId & "]" + End Sub + + Protected Overridable Function InDeletedRecordIds(ByVal rec As PersonalNameTableControlRow) As Boolean + If Me.DeletedRecordIds Is Nothing OrElse Me.DeletedRecordIds.Trim = "" Then + Return False + End If + + Return Me.DeletedRecordIds.IndexOf("[" & rec.RecordUniqueId & "]") >= 0 + End Function + + Private _DeletedRecordIds As String + Public Property DeletedRecordIds() As String + Get + Return Me._DeletedRecordIds + End Get + Set(ByVal value As String) + Me._DeletedRecordIds = value + End Set + End Property + + + ' Create Set, WhereClause, and Populate Methods + + Public Overridable Sub SetNameDateLabel() + + End Sub + + Public Overridable Sub SetPersonalLastNameLabel2() + + End Sub + + Public Overridable Sub SetPersonalNameLabel2() + + End Sub + + Public Overridable Sub SetPersonalNameTableControlCollapsibleRegion() + + End Sub + + Public Overridable Sub SetRefLabel1() + + End Sub + + + + + Protected Overridable Sub Control_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.PreRender + ' PreRender event is raised just before page is being displayed. + Try + DbUtils.StartTransaction + Me.RegisterPostback() + + If Not Me.Page.ErrorOnPage AndAlso (Me.Page.IsPageRefresh OrElse Me.DataChanged OrElse Me.ResetData) Then + + + ' Re-load the data and update the web page if necessary. + ' This is typically done during a postback (filter, search button, sort, pagination button). + ' In each of the other click handlers, simply set DataChanged to True to reload the data. + + Me.LoadData() + Me.DataBind() + + End If + + + + Catch ex As Exception + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + Finally + DbUtils.EndTransaction + End Try + End Sub + + + Protected Overrides Sub SaveControlsToSession() + MyBase.SaveControlsToSession() + + ' Save filter controls to values to session. + + + 'Save pagination state to session. + + + + ' Save table control properties to the session. + If Not Me.CurrentSortOrder Is Nothing Then + Me.SaveToSession(Me, "Order_By", Me.CurrentSortOrder.ToXmlString()) + End If + + Me.SaveToSession(Me, "Page_Index", Me.PageIndex.ToString()) + Me.SaveToSession(Me, "Page_Size", Me.PageSize.ToString()) + + Me.SaveToSession(Me, "DeletedRecordIds", Me.DeletedRecordIds) + + End Sub + + Protected Sub SaveControlsToSession_Ajax() + ' Save filter controls to values to session. + + HttpContext.Current.Session("AppRelativeVirtualPath") = Me.Page.AppRelativeVirtualPath + + End Sub + + Protected Overrides Sub ClearControlsFromSession() + MyBase.ClearControlsFromSession() + + ' Clear filter controls values from the session. + + + ' Clear pagination state from session. + + + + ' Clear table properties from the session. + Me.RemoveFromSession(Me, "Order_By") + Me.RemoveFromSession(Me, "Page_Index") + Me.RemoveFromSession(Me, "Page_Size") + + Me.RemoveFromSession(Me, "DeletedRecordIds") + + End Sub + + Protected Overrides Sub LoadViewState(ByVal savedState As Object) + MyBase.LoadViewState(savedState) + + Dim orderByStr As String = CType(ViewState("PersonalNameTableControl_OrderBy"), String) + + If orderByStr IsNot Nothing AndAlso orderByStr.Trim <> "" Then + Me.CurrentSortOrder = BaseClasses.Data.OrderBy.FromXmlString(orderByStr) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + End If + + Dim pageIndex As String = CType(ViewState("Page_Index"), String) + If pageIndex IsNot Nothing Then + Me.PageIndex = CInt(pageIndex) + End If + + Dim pageSize As String = CType(ViewState("Page_Size"), String) + If Not pageSize Is Nothing Then + Me.PageSize = CInt(pageSize) + End If + + + + ' Load view state for pagination control. + + Me.DeletedRecordIds = CType(Me.ViewState("DeletedRecordIds"), String) + + End Sub + + Protected Overrides Function SaveViewState() As Object + + If Me.CurrentSortOrder IsNot Nothing Then + Me.ViewState("PersonalNameTableControl_OrderBy") = Me.CurrentSortOrder.ToXmlString() + End If + + Me.ViewState("Page_Index") = Me.PageIndex + Me.ViewState("Page_Size") = Me.PageSize + + Me.ViewState("DeletedRecordIds") = Me.DeletedRecordIds + + + ' Load view state for pagination control. + + + Return MyBase.SaveViewState() + End Function + + ' Generate the event handling functions for pagination events. + + ' event handler for ImageButton + Public Overridable Sub PersonalNamePagination_FirstPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.PageIndex = 0 + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalNamePagination_LastPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.DisplayLastPage = True + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalNamePagination_NextPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.PageIndex += 1 + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for LinkButton + Public Overridable Sub PersonalNamePagination_PageSizeButton_Click(ByVal sender As Object, ByVal args As EventArgs) + + Try + + Me.DataChanged = True + + Me.PageSize = Integer.Parse(Me.PersonalNamePagination.PageSize.Text) + + Me.PageIndex = Integer.Parse(Me.PersonalNamePagination.CurrentPage.Text) - 1 + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalNamePagination_PreviousPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + If Me.PageIndex > 0 Then + Me.PageIndex -= 1 + Me.DataChanged = True + End If + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + + ' Generate the event handling functions for sorting events. + + Public Overridable Sub NameDateLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by NameDate when clicked. + + ' Get previous sorting state for NameDate. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalNameTable.NameDate) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for NameDate. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalNameTable.NameDate, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by NameDate, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub PersonalLastNameLabel2_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by PersonalLastName when clicked. + + ' Get previous sorting state for PersonalLastName. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalNameTable.PersonalLastName) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for PersonalLastName. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalNameTable.PersonalLastName, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by PersonalLastName, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub PersonalNameLabel2_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by PersonalName when clicked. + + ' Get previous sorting state for PersonalName. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalNameTable.PersonalName) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for PersonalName. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalNameTable.PersonalName, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by PersonalName, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub RefLabel1_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by Ref when clicked. + + ' Get previous sorting state for Ref. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalNameTable.Ref0) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for Ref. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalNameTable.Ref0, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by Ref, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + + ' Generate the event handling functions for button events. + + ' event handler for ImageButton + Public Overridable Sub PersonalNameExportCSVButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + ' Build the where clause based on the current filter and search criteria + ' Create the Order By clause based on the user's current sorting preference. + + Dim wc As WhereClause = CreateWhereClause + Dim orderBy As OrderBy = Nothing + + orderBy = CreateOrderBy + + ' Add each of the columns in order of export. + Dim columns() as BaseColumn = New BaseColumn() { _ + PersonalNameTable.PersonalName, _ + PersonalNameTable.PersonalLastName, _ + PersonalNameTable.NameDate, _ + PersonalNameTable.Ref0, _ + Nothing} + Dim exportData as ExportDataToCSV = New ExportDataToCSV(PersonalNameTable.Instance, wc, orderBy, columns) + + Dim done As Boolean = False + + Dim totalRowsReturned As Integer = 0 + Dim join As CompoundFilter = CreateCompoundJoinFilter() + Dim data As DataForExport = New DataForExport(PersonalNameTable.Instance, wc, orderBy, columns, join) + + 'Check for Export Data Threshold + Dim exportRawValues As Boolean = False + Me.TotalRecords = PersonalNameTable.GetRecordCount(join, wc) + If Me.TotalRecords > 10000 Then + exportRawValues = True + End If + exportData.StartExport(Me.Page.Response, exportRawValues) + + ' Read pageSize records at a time and write out the CSV file. + While (Not done) + Dim recList As ArrayList = data.GetRows(exportData.pageSize) + If recList Is Nothing Then + Exit While 'no more records we are done + End If + + totalRowsReturned = recList.Count + For Each rec As BaseRecord In recList + For Each col As BaseColumn In data.ColumnList + If col Is Nothing Then + Continue For + End If + + If Not data.IncludeInExport(col) Then + Continue For + End If + + Dim val As String = "" + + If exportRawValues Then + val = rec.GetValue(col).ToString() + Else + Dim _isExpandableNonCompositeForeignKey As Boolean = col.TableDefinition.IsExpandableNonCompositeForeignKey(col) + If _isExpandableNonCompositeForeignKey AndAlso col.IsApplyDisplayAs Then + val = PersonalNameTable.GetDFKA(rec.GetValue(col).ToString(), col, Nothing) + End If + If (Not _isExpandableNonCompositeForeignKey) Or (String.IsNullOrEmpty(val)) Then + val = exportData.GetDataForExport(col, rec) + End If + End If + exportData.WriteColumnData(val, data.IsString(col)) + + Next col + exportData.WriteNewRow() + Next rec + + ' If we already are below the pageSize, then we are done. + If totalRowsReturned < exportData.pageSize Then + done = True + End If + End While + exportData.FinishExport(Me.Page.Response) + + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalNameExportExcelButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + ' To customize the columns or the format, override this function in Section 1 of the page + ' and modify it to your liking. + ' Build the where clause based on the current filter and search criteria + ' Create the Order By clause based on the user's current sorting preference. + + Dim wc As WhereClause = CreateWhereClause + Dim orderBy As OrderBy = Nothing + + orderBy = CreateOrderBy + + Dim done As Boolean = False + Dim val As Object = "" + ' Read pageSize records at a time and write out the Excel file. + Dim totalRowsReturned As Integer = 0 + + Me.TotalRecords = PersonalNameTable.GetRecordCount(wc) + If Me.TotalRecords > 10000 Then + + ' Add each of the columns in order of export. + Dim columns() as BaseColumn = New BaseColumn() { _ + PersonalNameTable.PersonalName, _ + PersonalNameTable.PersonalLastName, _ + PersonalNameTable.NameDate, _ + PersonalNameTable.Ref0, _ + Nothing} + Dim exportData as ExportDataToCSV = New ExportDataToCSV(PersonalNameTable.Instance, wc, orderBy, columns) + exportData.StartExport(Me.Page.Response, True) + + Dim dataForCSV As DataForExport = New DataForExport(PersonalNameTable.Instance, wc, orderBy, columns) + + ' Read pageSize records at a time and write out the CSV file. + While (Not done) + Dim recList As ArrayList = dataForCSV.GetRows(exportData.pageSize) + If recList Is Nothing Then + Exit While 'no more records we are done + End If + + totalRowsReturned = recList.Count + For Each rec As BaseRecord In recList + For Each col As BaseColumn In dataForCSV.ColumnList + If col Is Nothing Then + Continue For + End If + + If Not dataForCSV.IncludeInExport(col) Then + Continue For + End If + + val = rec.GetValue(col).ToString() + exportData.WriteColumnData(val, dataForCSV.IsString(col)) + + Next col + exportData.WriteNewRow() + Next rec + + ' If we already are below the pageSize, then we are done. + If totalRowsReturned < exportData.pageSize Then + done = True + End If + End While + exportData.FinishExport(Me.Page.Response) + Else + + ' Create an instance of the Excel report class with the table class, where clause and order by. + Dim excelReport As ExportDataToExcel = New ExportDataToExcel(PersonalNameTable.Instance, wc, orderBy) + ' Add each of the columns in order of export. + ' To customize the data type, change the second parameter of the new ExcelColumn to be + ' a format string from Excel's Format Cell menu. For example "dddd, mmmm dd, yyyy h:mm AM/PM;@", "#,##0.00" + + If Me.Page.Response Is Nothing Then + Return + End If + + excelReport.CreateExcelBook() + + Dim width As Integer = 0 + Dim columnCounter As Integer = 0 + Dim data As DataForExport = New DataForExport(PersonalNameTable.Instance, wc, orderBy, Nothing) + data.ColumnList.Add(New ExcelColumn(PersonalNameTable.PersonalName, "Default")) + data.ColumnList.Add(New ExcelColumn(PersonalNameTable.PersonalLastName, "Default")) + data.ColumnList.Add(New ExcelColumn(PersonalNameTable.NameDate, "Short Date")) + data.ColumnList.Add(New ExcelColumn(PersonalNameTable.Ref0, "Default")) + + + For Each col As ExcelColumn In data.ColumnList + width = excelReport.GetExcelCellWidth(col) + If data.IncludeInExport(col) Then + excelReport.AddColumnToExcelBook(columnCounter, col.ToString(), excelReport.GetExcelDataType(col), width, excelReport.GetDisplayFormat(col)) + columnCounter = columnCounter + 1 + End If + Next col + + While (Not done) + Dim recList As ArrayList = data.GetRows(excelReport.pageSize) + + If recList Is Nothing Then + Exit While 'no more records we are done + End If + + totalRowsReturned = recList.Count + + For Each rec As BaseRecord In recList + excelReport.AddRowToExcelBook() + columnCounter = 0 + + For Each col As ExcelColumn In data.ColumnList + If Not data.IncludeInExport(col) Then + Continue For + End If + + Dim _isExpandableNonCompositeForeignKey As Boolean = col.DisplayColumn.TableDefinition.IsExpandableNonCompositeForeignKey(col.DisplayColumn) + If _isExpandableNonCompositeForeignKey AndAlso col.DisplayColumn.IsApplyDisplayAs Then + val = PersonalNameTable.GetDFKA(rec.GetValue(col.DisplayColumn).ToString(), col.DisplayColumn, Nothing) + If val Is Nothing Then + val = rec.Format(col.DisplayColumn) + End If + Else + val = excelReport.GetValueForExcelExport(col, rec) + End If + excelReport.AddCellToExcelRow(columnCounter, excelReport.GetExcelDataType(col), val, col.DisplayFormat) + + columnCounter = columnCounter + 1 + Next col + Next rec + + ' If we already are below the pageSize, then we are done. + If totalRowsReturned < excelReport.pageSize Then + done = True + End If + End While + + excelReport.SaveExcelBook(Me.Page.Response) + End If + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalNameImportButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalNamePDFButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + Dim report As PDFReport = New PDFReport() + report.SpecificReportFileName = Page.Server.MapPath("ShowPersonalId.PersonalNamePDFButton.report") + ' report.Title replaces the value tag of page header and footer containing ${ReportTitle} + report.Title = "PersonalName" + ' If ShowPersonalId.PersonalNamePDFButton.report specifies a valid report template, + ' AddColumn method will generate a report template. + ' Each AddColumn method-call specifies a column + ' The 1st parameter represents the text of the column header + ' The 2nd parameter represents the horizontal alignment of the column header + ' The 3rd parameter represents the text format of the column detail + ' The 4th parameter represents the horizontal alignment of the column detail + ' The 5th parameter represents the relative width of the column + report.AddColumn(PersonalNameTable.PersonalName.Name, ReportEnum.Align.Left, "${PersonalName}", ReportEnum.Align.Left, 30) + report.AddColumn(PersonalNameTable.PersonalLastName.Name, ReportEnum.Align.Left, "${PersonalLastName}", ReportEnum.Align.Left, 30) + report.AddColumn(PersonalNameTable.NameDate.Name, ReportEnum.Align.Left, "${NameDate}", ReportEnum.Align.Left, 20) + report.AddColumn(PersonalNameTable.Ref0.Name, ReportEnum.Align.Left, "${Ref0}", ReportEnum.Align.Left, 30) + + + Dim rowsPerQuery As Integer = 5000 + Dim recordCount As Integer = 0 + + report.Page = Page.GetResourceValue("Txt:Page", "Persons") + report.ApplicationPath = Me.Page.MapPath(Page.Request.ApplicationPath) + + Dim whereClause As WhereClause = CreateWhereClause + Dim orderBy As OrderBy = CreateOrderBy + Dim joinFilter As BaseFilter = CreateCompoundJoinFilter() + + Dim pageNum As Integer = 0 + Dim totalRows As Integer = PersonalNameTable.GetRecordCount(joinFilter,whereClause) + Dim columns As ColumnList = PersonalNameTable.GetColumnList() + Dim records As PersonalNameRecord() = Nothing + + Do + + records = PersonalNameTable.GetRecords(joinFilter,whereClause, orderBy, pageNum, rowsPerQuery) + If Not (records Is Nothing) AndAlso records.Length > 0 AndAlso whereClause.RunQuery Then + For Each record As PersonalNameRecord In records + + ' AddData method takes four parameters + ' The 1st parameters represent the data format + ' The 2nd parameters represent the data value + ' The 3rd parameters represent the default alignment of column using the data + ' The 4th parameters represent the maximum length of the data value being shown + report.AddData("${PersonalName}", record.Format(PersonalNameTable.PersonalName), ReportEnum.Align.Left, 100) + report.AddData("${PersonalLastName}", record.Format(PersonalNameTable.PersonalLastName), ReportEnum.Align.Left, 100) + report.AddData("${NameDate}", record.Format(PersonalNameTable.NameDate), ReportEnum.Align.Left, 100) + report.AddData("${Ref0}", record.Format(PersonalNameTable.Ref0), ReportEnum.Align.Left, 100) + + report.WriteRow + Next + pageNum = pageNum + 1 + recordCount += records.Length + End If + Loop While Not (records Is Nothing) AndAlso recordCount < totalRows AndAlso whereClause.RunQuery + + report.Close + BaseClasses.Utils.NetUtils.WriteResponseBinaryAttachment(Me.Page.Response, report.Title + ".pdf", report.ReportInByteArray, 0, true) + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalNameRefreshButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Dim PersonalDDTableControlObj as PersonalDDTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalDDTableControl"), PersonalDDTableControl) + PersonalDDTableControlObj.ResetData = True + + PersonalDDTableControlObj.RemoveFromSession(PersonalDDTableControlObj, "DeletedRecordIds") + PersonalDDTableControlObj.DeletedRecordIds = Nothing + + Dim PersonalEducationTableControlObj as PersonalEducationTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalEducationTableControl"), PersonalEducationTableControl) + PersonalEducationTableControlObj.ResetData = True + + PersonalEducationTableControlObj.RemoveFromSession(PersonalEducationTableControlObj, "DeletedRecordIds") + PersonalEducationTableControlObj.DeletedRecordIds = Nothing + + Dim PersonalExtWorkTableControlObj as PersonalExtWorkTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalExtWorkTableControl"), PersonalExtWorkTableControl) + PersonalExtWorkTableControlObj.ResetData = True + + PersonalExtWorkTableControlObj.RemoveFromSession(PersonalExtWorkTableControlObj, "DeletedRecordIds") + PersonalExtWorkTableControlObj.DeletedRecordIds = Nothing + + Dim PersonalIdRecordControlObj as PersonalIdRecordControl = DirectCast(Me.Page.FindControlRecursively("PersonalIdRecordControl"), PersonalIdRecordControl) + PersonalIdRecordControlObj.ResetData = True + + + Dim PersonalInsigniaTableControlObj as PersonalInsigniaTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalInsigniaTableControl"), PersonalInsigniaTableControl) + PersonalInsigniaTableControlObj.ResetData = True + + PersonalInsigniaTableControlObj.RemoveFromSession(PersonalInsigniaTableControlObj, "DeletedRecordIds") + PersonalInsigniaTableControlObj.DeletedRecordIds = Nothing + + Dim PersonalLanguageSkillTableControlObj as PersonalLanguageSkillTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalLanguageSkillTableControl"), PersonalLanguageSkillTableControl) + PersonalLanguageSkillTableControlObj.ResetData = True + + PersonalLanguageSkillTableControlObj.RemoveFromSession(PersonalLanguageSkillTableControlObj, "DeletedRecordIds") + PersonalLanguageSkillTableControlObj.DeletedRecordIds = Nothing + + Dim PersonalNameTableControlObj as PersonalNameTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalNameTableControl"), PersonalNameTableControl) + PersonalNameTableControlObj.ResetData = True + + PersonalNameTableControlObj.RemoveFromSession(PersonalNameTableControlObj, "DeletedRecordIds") + PersonalNameTableControlObj.DeletedRecordIds = Nothing + + Dim PersonalRankTableControlObj as PersonalRankTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalRankTableControl"), PersonalRankTableControl) + PersonalRankTableControlObj.ResetData = True + + PersonalRankTableControlObj.RemoveFromSession(PersonalRankTableControlObj, "DeletedRecordIds") + PersonalRankTableControlObj.DeletedRecordIds = Nothing + + Dim PersonalSalaryTableControlObj as PersonalSalaryTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalSalaryTableControl"), PersonalSalaryTableControl) + PersonalSalaryTableControlObj.ResetData = True + + PersonalSalaryTableControlObj.RemoveFromSession(PersonalSalaryTableControlObj, "DeletedRecordIds") + PersonalSalaryTableControlObj.DeletedRecordIds = Nothing + + Dim PersonalSpecialSkillTableControlObj as PersonalSpecialSkillTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalSpecialSkillTableControl"), PersonalSpecialSkillTableControl) + PersonalSpecialSkillTableControlObj.ResetData = True + + PersonalSpecialSkillTableControlObj.RemoveFromSession(PersonalSpecialSkillTableControlObj, "DeletedRecordIds") + PersonalSpecialSkillTableControlObj.DeletedRecordIds = Nothing + + Dim PersonalSportSkillTableControlObj as PersonalSportSkillTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalSportSkillTableControl"), PersonalSportSkillTableControl) + PersonalSportSkillTableControlObj.ResetData = True + + PersonalSportSkillTableControlObj.RemoveFromSession(PersonalSportSkillTableControlObj, "DeletedRecordIds") + PersonalSportSkillTableControlObj.DeletedRecordIds = Nothing + + Dim PersonalTitleTableControlObj as PersonalTitleTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalTitleTableControl"), PersonalTitleTableControl) + PersonalTitleTableControlObj.ResetData = True + + PersonalTitleTableControlObj.RemoveFromSession(PersonalTitleTableControlObj, "DeletedRecordIds") + PersonalTitleTableControlObj.DeletedRecordIds = Nothing + + Dim PersonRelativeTableControlObj as PersonRelativeTableControl = DirectCast(Me.Page.FindControlRecursively("PersonRelativeTableControl"), PersonRelativeTableControl) + PersonRelativeTableControlObj.ResetData = True + + PersonRelativeTableControlObj.RemoveFromSession(PersonRelativeTableControlObj, "DeletedRecordIds") + PersonRelativeTableControlObj.DeletedRecordIds = Nothing + + Dim ReportPropertiesTableControlObj as ReportPropertiesTableControl = DirectCast(Me.Page.FindControlRecursively("ReportPropertiesTableControl"), ReportPropertiesTableControl) + ReportPropertiesTableControlObj.ResetData = True + + ReportPropertiesTableControlObj.RemoveFromSession(ReportPropertiesTableControlObj, "DeletedRecordIds") + ReportPropertiesTableControlObj.DeletedRecordIds = Nothing + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalNameResetButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.CurrentSortOrder.Reset() + If Me.InSession(Me, "Order_By") Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + Me.CurrentSortOrder.Add(PersonalNameTable.NameDate, OrderByItem.OrderDir.Asc) + + + End If + + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalNameWordButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + Dim report As WordReport = New WordReport + report.SpecificReportFileName = Page.Server.MapPath("ShowPersonalId.PersonalNameWordButton.word") + ' report.Title replaces the value tag of page header and footer containing ${ReportTitle} + report.Title = "PersonalName" + ' If ShowPersonalId.PersonalNameWordButton.report specifies a valid report template, + ' AddColumn method will generate a report template. + ' Each AddColumn method-call specifies a column + ' The 1st parameter represents the text of the column header + ' The 2nd parameter represents the horizontal alignment of the column header + ' The 3rd parameter represents the text format of the column detail + ' The 4th parameter represents the horizontal alignment of the column detail + ' The 5th parameter represents the relative width of the column + report.AddColumn(PersonalNameTable.PersonalName.Name, ReportEnum.Align.Left, "${PersonalName}", ReportEnum.Align.Left, 30) + report.AddColumn(PersonalNameTable.PersonalLastName.Name, ReportEnum.Align.Left, "${PersonalLastName}", ReportEnum.Align.Left, 30) + report.AddColumn(PersonalNameTable.NameDate.Name, ReportEnum.Align.Left, "${NameDate}", ReportEnum.Align.Left, 20) + report.AddColumn(PersonalNameTable.Ref0.Name, ReportEnum.Align.Left, "${Ref0}", ReportEnum.Align.Left, 30) + + Dim whereClause As WhereClause = CreateWhereClause + + Dim orderBy As OrderBy = CreateOrderBy + Dim joinFilter As BaseFilter = CreateCompoundJoinFilter() + + Dim rowsPerQuery As Integer = 5000 + Dim pageNum As Integer = 0 + Dim recordCount As Integer = 0 + Dim totalRows As Integer = PersonalNameTable.GetRecordCount(joinFilter,whereClause) + + report.Page = Page.GetResourceValue("Txt:Page", "Persons") + report.ApplicationPath = Me.Page.MapPath(Page.Request.ApplicationPath) + + Dim columns As ColumnList = PersonalNameTable.GetColumnList() + Dim records As PersonalNameRecord() = Nothing + Do + records = PersonalNameTable.GetRecords(joinFilter,whereClause, orderBy, pageNum, rowsPerQuery) + + If Not (records Is Nothing) AndAlso records.Length > 0 AndAlso whereClause.RunQuery Then + For Each record As PersonalNameRecord In records + ' AddData method takes four parameters + ' The 1st parameters represent the data format + ' The 2nd parameters represent the data value + ' The 3rd parameters represent the default alignment of column using the data + ' The 4th parameters represent the maximum length of the data value being shown + report.AddData("${PersonalName}", record.Format(PersonalNameTable.PersonalName), ReportEnum.Align.Left, 100) + report.AddData("${PersonalLastName}", record.Format(PersonalNameTable.PersonalLastName), ReportEnum.Align.Left, 100) + report.AddData("${NameDate}", record.Format(PersonalNameTable.NameDate), ReportEnum.Align.Left, 100) + report.AddData("${Ref0}", record.Format(PersonalNameTable.Ref0), ReportEnum.Align.Left, 100) + + report.WriteRow + Next + pageNum = pageNum + 1 + recordCount += records.Length + End If + Loop While Not (records Is Nothing) AndAlso recordCount < totalRows AndAlso whereClause.RunQuery + report.save + BaseClasses.Utils.NetUtils.WriteResponseBinaryAttachment(Me.Page.Response, report.Title + ".doc", report.ReportInByteArray, 0, true) + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + + + ' Generate the event handling functions for filter and search events. + + + ' Generate the event handling functions for others + + + Private _UIData As New System.Collections.Generic.List(Of Hashtable) + Public Property UIData() As System.Collections.Generic.List(Of Hashtable) + Get + Return Me._UIData + End Get + Set(ByVal value As System.Collections.Generic.List(Of Hashtable)) + Me._UIData = value + End Set + End Property + + ' pagination properties + Protected _PageSize As Integer + Public Property PageSize() As Integer + Get + Return Me._PageSize + End Get + Set(ByVal value As Integer) + Me._PageSize = value + End Set + End Property + + Protected _PageIndex As Integer + Public Property PageIndex() As Integer + Get + ' Return the PageIndex + Return Me._PageIndex + End Get + Set(ByVal value As Integer) + Me._PageIndex = value + End Set + End Property + + Protected _TotalRecords As Integer = -1 + Public Property TotalRecords() As Integer + Get + If _TotalRecords < 0 + _TotalRecords = PersonalNameTable.GetRecordCount(CreateCompoundJoinFilter(), CreateWhereClause()) + End If + Return Me._TotalRecords + End Get + Set(ByVal value As Integer) + If Me.PageSize > 0 Then + + Me.TotalPages = CInt(Math.Ceiling(value / Me.PageSize)) + + End If + Me._TotalRecords = value + End Set + End Property + + + + Protected _TotalPages As Integer = -1 + Public Property TotalPages() As Integer + Get + If _TotalPages < 0 Then + + Me.TotalPages = CInt(Math.Ceiling(TotalRecords / Me.PageSize)) + + End If + Return Me._TotalPages + End Get + Set(ByVal value As Integer) + Me._TotalPages = value + End Set + End Property + + Protected _DisplayLastPage As Boolean + Public Property DisplayLastPage() As Boolean + Get + Return Me._DisplayLastPage + End Get + Set(ByVal value As Boolean) + Me._DisplayLastPage = value + End Set + End Property + + Private _DataChanged As Boolean = False + Public Property DataChanged() As Boolean + Get + Return Me._DataChanged + End Get + Set(ByVal value As Boolean) + Me._DataChanged = value + End Set + End Property + + Private _ResetData As Boolean = False + Public Property ResetData() As Boolean + Get + Return Me._ResetData + End Get + Set(ByVal value As Boolean) + Me._ResetData = value + End Set + End Property + + Private _AddNewRecord As Integer = 0 + Public Property AddNewRecord() As Integer + Get + Return Me._AddNewRecord + End Get + Set(ByVal value As Integer) + Me._AddNewRecord = value + End Set + End Property + + + Private _CurrentSortOrder As OrderBy = Nothing + Public Property CurrentSortOrder() As OrderBy + Get + Return Me._CurrentSortOrder + End Get + Set(ByVal value As BaseClasses.Data.OrderBy) + Me._CurrentSortOrder = value + End Set + End Property + + Private _DataSource() As PersonalNameRecord = Nothing + Public Property DataSource() As PersonalNameRecord () + Get + Return Me._DataSource + End Get + Set(ByVal value() As PersonalNameRecord) + Me._DataSource = value + End Set + End Property + +#Region "Helper Properties" + + Public ReadOnly Property NameDateLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "NameDateLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property PersonalLastNameLabel2() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalLastNameLabel2"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property PersonalNameExportCSVButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalNameExportCSVButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalNameExportExcelButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalNameExportExcelButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalNameImportButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalNameImportButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalNameLabel2() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalNameLabel2"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property PersonalNamePagination() As Persons.UI.IPagination + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalNamePagination"), Persons.UI.IPagination) + End Get + End Property + + Public ReadOnly Property PersonalNamePDFButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalNamePDFButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalNameRefreshButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalNameRefreshButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalNameResetButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalNameResetButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalNameTableControlCollapsibleRegion() As System.Web.UI.WebControls.Panel + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalNameTableControlCollapsibleRegion"), System.Web.UI.WebControls.Panel) + End Get + End Property + + Public ReadOnly Property PersonalNameWordButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalNameWordButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property RefLabel1() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RefLabel1"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + +#End Region + +#Region "Helper Functions" + + Public Overrides Overloads Function ModifyRedirectUrl(url As String, arg As String, ByVal bEncrypt As Boolean) As String + Return Me.Page.EvaluateExpressions(url, arg, bEncrypt, Me) + End Function + + Public Overrides Overloads Function EvaluateExpressions(url As String, arg As String, ByVal bEncrypt As Boolean) As String + Dim needToProcess As Boolean = AreAnyUrlParametersForMe(url, arg) + If (needToProcess) Then + Dim recCtl As PersonalNameTableControlRow = Me.GetSelectedRecordControl() + If recCtl Is Nothing AndAlso url.IndexOf("{") >= 0 Then + ' Localization. + Throw New Exception(Page.GetResourceValue("Err:NoRecSelected", "Persons")) + End If + Dim rec As PersonalNameRecord = Nothing + If recCtl IsNot Nothing Then + rec = recCtl.GetRecord() + End If + Return EvaluateExpressions(url, arg, rec, bEncrypt) + End If + Return url + End Function + + Public Overridable Function GetSelectedRecordControl() As PersonalNameTableControlRow + Return Nothing + + End Function + + Public Overridable Function GetSelectedRecordControls() As PersonalNameTableControlRow() + + Return DirectCast((new ArrayList()).ToArray(GetType(PersonalNameTableControlRow)), PersonalNameTableControlRow()) + + End Function + + Public Overridable Sub DeleteSelectedRecords(ByVal deferDeletion As Boolean) + Dim recList() As PersonalNameTableControlRow = Me.GetSelectedRecordControls() + If recList.Length = 0 Then + ' Localization. + Throw New Exception(Page.GetResourceValue("Err:NoRecSelected", "Persons")) + End If + + Dim recCtl As PersonalNameTableControlRow + For Each recCtl In recList + If deferDeletion Then + If Not recCtl.IsNewRecord Then + + Me.AddToDeletedRecordIds(recCtl) + + End If + recCtl.Visible = False + + Else + + recCtl.Delete() + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + End If + Next + End Sub + + Public Function GetRecordControls() As PersonalNameTableControlRow() + Dim recList As ArrayList = New ArrayList() + Dim rep As System.Web.UI.WebControls.Repeater = CType(Me.FindControl("PersonalNameTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return Nothing + Dim repItem As System.Web.UI.WebControls.RepeaterItem + + For Each repItem In rep.Items + + Dim recControl As PersonalNameTableControlRow = DirectCast(repItem.FindControl("PersonalNameTableControlRow"), PersonalNameTableControlRow) + recList.Add(recControl) + + Next + + Return DirectCast(recList.ToArray(GetType(PersonalNameTableControlRow)), PersonalNameTableControlRow()) + End Function + + Public Shadows ReadOnly Property Page() As BaseApplicationPage + Get + Return DirectCast(MyBase.Page, BaseApplicationPage) + End Get + End Property + +#End Region + + + +End Class + + +' Base class for the PersonalRankTableControlRow control on the ShowPersonalId page. +' Do not modify this class. Instead override any method in PersonalRankTableControlRow. +Public Class BasePersonalRankTableControlRow + Inherits Persons.UI.BaseApplicationRecordControl + + ' To customize, override this method in PersonalRankTableControlRow. + Protected Overridable Sub Control_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Init + + Me.ClearControlsFromSession() + End Sub + + ' To customize, override this method in PersonalRankTableControlRow. + Protected Overridable Sub Control_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load + + 'Call LoadFocusScripts from repeater so that onfocus attribute could be added to elements + Me.Page.LoadFocusScripts(Me) + + + ' Register the event handlers. + + + End Sub + + + Public Overridable Sub LoadData() + + ' Load the data from the database into the DataSource PersonalRank 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 = PersonalRankTable.GetRecord(Me.RecordUniqueId, True) + + Return + End If + + ' Since this is a row in the table, the data for this row is loaded by the + ' LoadData method of the BasePersonalRankTableControl when the data for the entire + ' table is loaded. + + Me.DataSource = New PersonalRankRecord() + + + + End Sub + + ' Populate the UI controls using the DataSource. To customize, override this method in PersonalRankTableControlRow. + 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 + + SetGazetteDate1() + SetGazetteNO1() + SetGazettePage1() + SetGazetteSection1() + SetPreRank() + SetRankDate() + SetRankId1() + SetRef3() + SetRefDate1() + + + 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 SetGazetteDate1() + + + ' Set the GazetteDate Literal on the webpage with value from the + ' PersonalRank database record. + + ' Me.DataSource is the PersonalRank record retrieved from the database. + ' Me.GazetteDate1 is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetGazetteDate1() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.GazetteDateSpecified Then + + ' If the GazetteDate is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalRankTable.GazetteDate, "d MMM yyyy") + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.GazetteDate1.Text = formattedValue + + Else + + ' GazetteDate is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.GazetteDate1.Text = PersonalRankTable.GazetteDate.Format(PersonalRankTable.GazetteDate.DefaultValue, "d MMM yyyy") + + End If + + ' If the GazetteDate is NULL or blank, then use the value specified + ' on Properties. + If Me.GazetteDate1.Text Is Nothing _ + OrElse Me.GazetteDate1.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.GazetteDate1.Text = " " + End If + + End Sub + + Public Overridable Sub SetGazetteNO1() + + + ' Set the GazetteNO Literal on the webpage with value from the + ' PersonalRank database record. + + ' Me.DataSource is the PersonalRank record retrieved from the database. + ' Me.GazetteNO1 is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetGazetteNO1() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.GazetteNOSpecified Then + + ' If the GazetteNO is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalRankTable.GazetteNO) + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.GazetteNO1.Text = formattedValue + + Else + + ' GazetteNO is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.GazetteNO1.Text = PersonalRankTable.GazetteNO.Format(PersonalRankTable.GazetteNO.DefaultValue) + + End If + + ' If the GazetteNO is NULL or blank, then use the value specified + ' on Properties. + If Me.GazetteNO1.Text Is Nothing _ + OrElse Me.GazetteNO1.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.GazetteNO1.Text = " " + End If + + End Sub + + Public Overridable Sub SetGazettePage1() + + + ' Set the GazettePage Literal on the webpage with value from the + ' PersonalRank database record. + + ' Me.DataSource is the PersonalRank record retrieved from the database. + ' Me.GazettePage1 is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetGazettePage1() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.GazettePageSpecified Then + + ' If the GazettePage is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalRankTable.GazettePage) + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.GazettePage1.Text = formattedValue + + Else + + ' GazettePage is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.GazettePage1.Text = PersonalRankTable.GazettePage.Format(PersonalRankTable.GazettePage.DefaultValue) + + End If + + ' If the GazettePage is NULL or blank, then use the value specified + ' on Properties. + If Me.GazettePage1.Text Is Nothing _ + OrElse Me.GazettePage1.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.GazettePage1.Text = " " + End If + + End Sub + + Public Overridable Sub SetGazetteSection1() + + + ' Set the GazetteSection Literal on the webpage with value from the + ' PersonalRank database record. + + ' Me.DataSource is the PersonalRank record retrieved from the database. + ' Me.GazetteSection1 is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetGazetteSection1() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.GazetteSectionSpecified Then + + ' If the GazetteSection is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalRankTable.GazetteSection) + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.GazetteSection1.Text = formattedValue + + Else + + ' GazetteSection is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.GazetteSection1.Text = PersonalRankTable.GazetteSection.Format(PersonalRankTable.GazetteSection.DefaultValue) + + End If + + ' If the GazetteSection is NULL or blank, then use the value specified + ' on Properties. + If Me.GazetteSection1.Text Is Nothing _ + OrElse Me.GazetteSection1.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.GazetteSection1.Text = " " + End If + + End Sub + + Public Overridable Sub SetPreRank() + + + ' Set the PreRank Literal on the webpage with value from the + ' PersonalRank database record. + + ' Me.DataSource is the PersonalRank record retrieved from the database. + ' Me.PreRank is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetPreRank() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.PreRankSpecified Then + + ' If the PreRank is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalRankTable.PreRank) + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.PreRank.Text = formattedValue + + Else + + ' PreRank is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.PreRank.Text = PersonalRankTable.PreRank.Format(PersonalRankTable.PreRank.DefaultValue) + + End If + + ' If the PreRank is NULL or blank, then use the value specified + ' on Properties. + If Me.PreRank.Text Is Nothing _ + OrElse Me.PreRank.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.PreRank.Text = " " + End If + + End Sub + + Public Overridable Sub SetRankDate() + + + ' Set the RankDate Literal on the webpage with value from the + ' PersonalRank database record. + + ' Me.DataSource is the PersonalRank record retrieved from the database. + ' Me.RankDate is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetRankDate() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.RankDateSpecified Then + + ' If the RankDate is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalRankTable.RankDate, "d MMM yyyy") + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.RankDate.Text = formattedValue + + Else + + ' RankDate is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.RankDate.Text = PersonalRankTable.RankDate.Format(PersonalRankTable.RankDate.DefaultValue, "d MMM yyyy") + + End If + + ' If the RankDate is NULL or blank, then use the value specified + ' on Properties. + If Me.RankDate.Text Is Nothing _ + OrElse Me.RankDate.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.RankDate.Text = " " + End If + + End Sub + + Public Overridable Sub SetRankId1() + + + ' Set the RankId Literal on the webpage with value from the + ' PersonalRank database record. + + ' Me.DataSource is the PersonalRank record retrieved from the database. + ' Me.RankId1 is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetRankId1() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.RankIdSpecified Then + + ' If the RankId is non-NULL, then format the value. + + ' The Format method will return the Display Foreign Key As (DFKA) value + Dim formattedValue As String = "" + Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalRankTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalRankTable.RankId) + If _isExpandableNonCompositeForeignKey AndAlso PersonalRankTable.RankId.IsApplyDisplayAs Then + + formattedValue = PersonalRankTable.GetDFKA(Me.DataSource.RankId.ToString(),PersonalRankTable.RankId, Nothing) + + if (formattedValue Is Nothing) Then + formattedValue = Me.DataSource.Format(PersonalRankTable.RankId) + End If + Else + formattedValue = Me.DataSource.RankId.ToString() + End If + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.RankId1.Text = formattedValue + + Else + + ' RankId is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.RankId1.Text = PersonalRankTable.RankId.Format(PersonalRankTable.RankId.DefaultValue) + + End If + + ' If the RankId is NULL or blank, then use the value specified + ' on Properties. + If Me.RankId1.Text Is Nothing _ + OrElse Me.RankId1.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.RankId1.Text = " " + End If + + End Sub + + Public Overridable Sub SetRef3() + + + ' Set the Ref Literal on the webpage with value from the + ' PersonalRank database record. + + ' Me.DataSource is the PersonalRank record retrieved from the database. + ' Me.Ref3 is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetRef3() + ' 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(PersonalRankTable.Ref0) + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + If Not formattedValue is Nothing Then + Dim popupThreshold as Integer = CType(100, Integer) + + Dim maxLength as Integer = Len(formattedValue) + If (maxLength > CType(100, Integer)) Then + ' Truncate based on FieldMaxLength on Properties. + maxLength = CType(100, Integer) + + End If + + ' For fields values larger than the PopupTheshold on Properties, display a popup. + If Len(formattedValue) >= popupThreshold Then + + Dim name As String = HttpUtility.HtmlEncode(PersonalRankTable.Ref0.Name) + + If Not HttpUtility.HtmlEncode("%ISD_DEFAULT%").Equals("%ISD_DEFAULT%") Then + name = HttpUtility.HtmlEncode(Me.Page.GetResourceValue("%ISD_DEFAULT%")) + End If + + + + formattedValue= "" & NetUtils.EncodeStringForHtmlDisplay(formattedValue.Substring(0, maxLength)) + + If (maxLength = CType(100, Integer)) Then + formattedValue = formattedValue & "..." & "" + Else + formattedValue = formattedValue & "" + + End If + Else + If maxLength = CType(100, Integer) Then + formattedValue= NetUtils.EncodeStringForHtmlDisplay(formattedValue.SubString(0,MaxLength)) + formattedValue = formattedValue & "..." + + End If + End If + End If + + Me.Ref3.Text = formattedValue + + Else + + ' Ref is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.Ref3.Text = PersonalRankTable.Ref0.Format(PersonalRankTable.Ref0.DefaultValue) + + End If + + ' If the Ref is NULL or blank, then use the value specified + ' on Properties. + If Me.Ref3.Text Is Nothing _ + OrElse Me.Ref3.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.Ref3.Text = " " + End If + + End Sub + + Public Overridable Sub SetRefDate1() + + + ' Set the RefDate Literal on the webpage with value from the + ' PersonalRank database record. + + ' Me.DataSource is the PersonalRank record retrieved from the database. + ' Me.RefDate1 is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetRefDate1() + ' 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(PersonalRankTable.RefDate, "d MMM yyyy") + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.RefDate1.Text = formattedValue + + Else + + ' RefDate is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.RefDate1.Text = PersonalRankTable.RefDate.Format(PersonalRankTable.RefDate.DefaultValue, "d MMM yyyy") + + End If + + ' If the RefDate is NULL or blank, then use the value specified + ' on Properties. + If Me.RefDate1.Text Is Nothing _ + OrElse Me.RefDate1.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.RefDate1.Text = " " + End If + + End Sub + + + Public EvaluateFormulaDelegate As BaseClasses.Data.DataSource.EvaluateFormulaDelegate = New BaseClasses.Data.DataSource.EvaluateFormulaDelegate(AddressOf Me.EvaluateFormula) + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean, ByVal e As FormulaEvaluator) As String + If e Is Nothing Then + e = New FormulaEvaluator() + End If + + e.Variables.Clear() + + + ' add variables for formula evaluation + If variables IsNot Nothing Then + Dim enumerator As System.Collections.Generic.IEnumerator(Of System.Collections.Generic.KeyValuePair(Of String, Object)) = variables.GetEnumerator() + While enumerator.MoveNext() + e.Variables.Add(enumerator.Current.Key, enumerator.Current.Value) + End While + End If + + If includeDS + + End IF + + + ' Other variables referred to in the formula are expected to be + ' properties of the DataSource. For example, referring to + ' UnitPrice as a variable will refer to DataSource.UnitPrice + If dataSourceForEvaluate Is Nothing Then + + e.DataSource = Me.DataSource + + Else + e.DataSource = dataSourceForEvaluate + End If + + ' Define the calling control. This is used to add other + ' related table and record controls as variables. + e.CallingControl = Me + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + + If Not String.IsNullOrEmpty(format) AndAlso (String.IsNullOrEmpty(formula) OrElse formula.IndexOf("Format(") < 0) Then + Return FormulaUtils.Format(resultObj, format) + Else + Return resultObj.ToString() + End If + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format,variables ,includeDS, Nothing) + End Function + + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object)) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format, variables ,True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, format, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal e as FormulaEvaluator) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, variables, True, e) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal includeDS as Boolean) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, includeDS, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, True, Nothing) + End Function + + + Public Overridable Sub RegisterPostback() + + + End Sub + + + + ' To customize, override this method in PersonalRankTableControlRow. + 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 parentCtrl As PersonalIdRecordControl + + + parentCtrl = DirectCast(Me.Page.FindControlRecursively("PersonalIdRecordControl"), PersonalIdRecordControl) + + If (Not IsNothing(parentCtrl) AndAlso IsNothing(parentCtrl.DataSource)) + ' Load the record if it is not loaded yet. + parentCtrl.LoadData() + End If + If (IsNothing(parentCtrl) OrElse IsNothing(parentCtrl.DataSource)) + ' Get the error message from the application resource file. + Throw New Exception(Page.GetResourceValue("Err:NoParentRecId", "Persons")) + End If + + Me.DataSource.PersonalId = parentCtrl.DataSource.PersonalId + + ' 2. Perform any custom validation. + Me.Validate() + + + ' 3. Set the values in the record with data from UI controls. + ' This calls the Get() method for each of the user interface controls. + Me.GetUIData() + + ' 4. Save in the database. + ' We should not save the record if the data did not change. This + ' will save a database hit and avoid triggering any database triggers. + + If Me.DataSource.IsAnyValueChanged Then + ' Save record to database but do not commit yet. + ' Auto generated ids are available after saving for use by child (dependent) records. + Me.DataSource.Save() + + DirectCast(GetParentControlObject(Me, "PersonalRankTableControl"), PersonalRankTableControl).DataChanged = True + DirectCast(GetParentControlObject(Me, "PersonalRankTableControl"), PersonalRankTableControl).ResetData = True + End If + + + ' update session or cookie by formula + + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + ' For Master-Detail relationships, save data on the Detail table(s) + + End Sub + + ' To customize, override this method in PersonalRankTableControlRow. + 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. + + GetGazetteDate1() + GetGazetteNO1() + GetGazettePage1() + GetGazetteSection1() + GetPreRank() + GetRankDate() + GetRankId1() + GetRef3() + GetRefDate1() + End Sub + + + Public Overridable Sub GetGazetteDate1() + + End Sub + + Public Overridable Sub GetGazetteNO1() + + End Sub + + Public Overridable Sub GetGazettePage1() + + End Sub + + Public Overridable Sub GetGazetteSection1() + + End Sub + + Public Overridable Sub GetPreRank() + + End Sub + + Public Overridable Sub GetRankDate() + + End Sub + + Public Overridable Sub GetRankId1() + + End Sub + + Public Overridable Sub GetRef3() + + End Sub + + Public Overridable Sub GetRefDate1() + + End Sub + + + ' To customize, override this method in PersonalRankTableControlRow. + + Public Overridable Function CreateWhereClause() As WhereClause + + Return Nothing + + End Function + + + + ' To customize, override this method in PersonalRankTableControlRow. + 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) + PersonalRankTable.DeleteRecord(pkValue) + + DirectCast(GetParentControlObject(Me, "PersonalRankTableControl"), PersonalRankTableControl).DataChanged = True + DirectCast(GetParentControlObject(Me, "PersonalRankTableControl"), PersonalRankTableControl).ResetData = True + End Sub + + Protected Overridable Sub Control_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.PreRender + ' PreRender event is raised just before page is being displayed. + Try + DbUtils.StartTransaction() + Me.RegisterPostback() + + If Not Me.Page.ErrorOnPage AndAlso (Me.Page.IsPageRefresh OrElse Me.DataChanged OrElse Me.ResetData) Then + + + ' Re-load the data and update the web page if necessary. + ' This is typically done during a postback (filter, search button, sort, pagination button). + ' In each of the other click handlers, simply set DataChanged to True to reload the data. + Me.LoadData() + Me.DataBind() + End If + + + Catch ex As Exception + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + Finally + DbUtils.EndTransaction() + End Try + End Sub + + + Protected Overrides Sub SaveControlsToSession() + MyBase.SaveControlsToSession() + + + 'Save pagination state to session. + + End Sub + + + + Protected Overrides Sub ClearControlsFromSession() + MyBase.ClearControlsFromSession() + + + + ' Clear pagination state from session. + + End Sub + + Protected Overrides Sub LoadViewState(ByVal savedState As Object) + MyBase.LoadViewState(savedState) + Dim isNewRecord As String = CType(ViewState("IsNewRecord"), String) + If Not isNewRecord Is Nothing AndAlso isNewRecord.Trim <> "" Then + Me.IsNewRecord = Boolean.Parse(isNewRecord) + End If + + Dim myCheckSum As String = CType(ViewState("CheckSum"), String) + If Not myCheckSum Is Nothing AndAlso myCheckSum.Trim <> "" Then + Me.CheckSum = myCheckSum + End If + + + ' Load view state for pagination control. + + End Sub + + Protected Overrides Function SaveViewState() As Object + ViewState("IsNewRecord") = Me.IsNewRecord.ToString() + ViewState("CheckSum") = Me.CheckSum + + + ' Load view state for pagination control. + + Return MyBase.SaveViewState() + End Function + + + + 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("BasePersonalRankTableControlRow_Rec"), String) + End Get + Set(ByVal value As String) + Me.ViewState("BasePersonalRankTableControlRow_Rec") = value + End Set + End Property + + Private _DataSource As PersonalRankRecord + Public Property DataSource() As PersonalRankRecord + Get + Return Me._DataSource + End Get + + Set(ByVal value As PersonalRankRecord) + + Me._DataSource = value + End Set + End Property + + + + Private _checkSum As String + Public Overridable Property CheckSum() As String + Get + Return Me._checkSum + End Get + Set(ByVal value As String) + Me._checkSum = value + End Set + End Property + + Private _TotalPages As Integer + Public Property TotalPages() As Integer + Get + Return Me._TotalPages + End Get + Set(ByVal value As Integer) + Me._TotalPages = value + End Set + End Property + + Private _PageIndex As Integer + Public Property PageIndex() As Integer + Get + ' Return the PageIndex + Return Me._PageIndex + End Get + Set(ByVal value As Integer) + Me._PageIndex = value + End Set + End Property + + Private _DisplayLastPage As Boolean + Public Property DisplayLastPage() As Boolean + Get + Return Me._DisplayLastPage + End Get + Set(ByVal value As Boolean) + Me._DisplayLastPage = value + End Set + End Property + + + +#Region "Helper Properties" + + Public ReadOnly Property GazetteDate1() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "GazetteDate1"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property GazetteNO1() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "GazetteNO1"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property GazettePage1() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "GazettePage1"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property GazetteSection1() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "GazetteSection1"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property PreRank() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PreRank"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property RankDate() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RankDate"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property RankId1() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RankId1"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property Ref3() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Ref3"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property RefDate1() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RefDate1"), 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 PersonalRankRecord = 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 PersonalRankRecord + If Not Me.DataSource Is Nothing Then + Return Me.DataSource + End If + + If Not Me.RecordUniqueId Is Nothing Then + + Return PersonalRankTable.GetRecord(Me.RecordUniqueId, True) + + End If + + ' Localization. + + Return Nothing + + End Function + + Public Shadows ReadOnly Property Page() As BaseApplicationPage + Get + Return DirectCast(MyBase.Page, BaseApplicationPage) + End Get + End Property + +#End Region + +End Class + + + +' Base class for the PersonalRankTableControl control on the ShowPersonalId page. +' Do not modify this class. Instead override any method in PersonalRankTableControl. +Public Class BasePersonalRankTableControl + Inherits Persons.UI.BaseApplicationTableControl + + + + Protected Overridable Sub Control_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Init + + + + ' Setup the filter and search events. + + + + ' Control Initializations. + ' Initialize the table's current sort order. + + If Me.InSession(Me, "Order_By") Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + Me.CurrentSortOrder.Add(PersonalRankTable.RankDate, OrderByItem.OrderDir.Asc) + + End If + + + + ' Setup default pagination settings. + + Me.PageSize = CInt(Me.GetFromSession(Me, "Page_Size", "10")) + Me.PageIndex = CInt(Me.GetFromSession(Me, "Page_Index", "0")) + + + + Me.ClearControlsFromSession() + End Sub + + Protected Overridable Sub Control_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load + + SaveControlsToSession_Ajax() + + ' Setup the pagination events. + + AddHandler Me.PersonalRankPagination.FirstPage.Click, AddressOf PersonalRankPagination_FirstPage_Click + + AddHandler Me.PersonalRankPagination.LastPage.Click, AddressOf PersonalRankPagination_LastPage_Click + + AddHandler Me.PersonalRankPagination.NextPage.Click, AddressOf PersonalRankPagination_NextPage_Click + + AddHandler Me.PersonalRankPagination.PageSizeButton.Click, AddressOf PersonalRankPagination_PageSizeButton_Click + + AddHandler Me.PersonalRankPagination.PreviousPage.Click, AddressOf PersonalRankPagination_PreviousPage_Click + + + ' Setup the sorting events. + + AddHandler Me.GazetteDateLabel1.Click, AddressOf GazetteDateLabel1_Click + + AddHandler Me.GazetteNOLabel1.Click, AddressOf GazetteNOLabel1_Click + + AddHandler Me.GazettePageLabel1.Click, AddressOf GazettePageLabel1_Click + + AddHandler Me.GazetteSectionLabel1.Click, AddressOf GazetteSectionLabel1_Click + + AddHandler Me.PreRankLabel1.Click, AddressOf PreRankLabel1_Click + + AddHandler Me.RankDateLabel.Click, AddressOf RankDateLabel_Click + + AddHandler Me.RankIdLabel2.Click, AddressOf RankIdLabel2_Click + + AddHandler Me.RefDateLabel1.Click, AddressOf RefDateLabel1_Click + + AddHandler Me.RefLabel2.Click, AddressOf RefLabel2_Click + + ' Setup the button events. + + AddHandler Me.PersonalRankExportCSVButton.Click, AddressOf PersonalRankExportCSVButton_Click + + AddHandler Me.PersonalRankExportExcelButton.Click, AddressOf PersonalRankExportExcelButton_Click + + Me.PersonalRankImportButton.PostBackUrl = "../Shared/SelectFileToImport.aspx?TableName=PersonalRank" + Me.PersonalRankImportButton.Attributes.Item("onClick") = "window.open('" & Me.Page.EncryptUrlParameter(Me.PersonalRankImportButton.PostBackUrl) & "','importWindow', 'width=700, height=500,top=' +(screen.availHeight-500)/2 + ',left=' + (screen.availWidth-700)/2+ ', resizable=yes, scrollbars=yes,modal=yes'); return false;" + + AddHandler Me.PersonalRankImportButton.Click, AddressOf PersonalRankImportButton_Click + + AddHandler Me.PersonalRankPDFButton.Click, AddressOf PersonalRankPDFButton_Click + + AddHandler Me.PersonalRankRefreshButton.Click, AddressOf PersonalRankRefreshButton_Click + + AddHandler Me.PersonalRankResetButton.Click, AddressOf PersonalRankResetButton_Click + + AddHandler Me.PersonalRankWordButton.Click, AddressOf PersonalRankWordButton_Click + + + ' Setup events for others + + End Sub + + + Public Overridable Sub LoadData() + + ' Read data from database. Returns an array of records that can be assigned + ' to the DataSource table control property. + Try + Dim joinFilter As CompoundFilter = CreateCompoundJoinFilter() + + ' The WHERE clause will be empty when displaying all records in table. + Dim wc As WhereClause = CreateWhereClause() + If wc IsNot Nothing AndAlso Not wc.RunQuery Then + ' Initialize an empty array of records + Dim alist As New ArrayList(0) + Me.DataSource = DirectCast(alist.ToArray(GetType(PersonalRankRecord)), PersonalRankRecord()) + ' Add records to the list if needed. + Me.AddNewRecords() + Me._TotalRecords = 0 + Me._TotalPages = 0 + Return + End If + + ' Call OrderBy to determine the order - either use the order defined + ' on the Query Wizard, or specified by user (by clicking on column heading) + Dim orderBy As OrderBy = CreateOrderBy() + + ' Get the pagesize from the pagesize control. + Me.GetPageSize() + + If Me.DisplayLastPage Then + Dim totalRecords As Integer = If(Me._TotalRecords < 0, PersonalRankTable.GetRecordCount(CreateCompoundJoinFilter(), CreateWhereClause()), Me._TotalRecords) + + Dim totalPages As Integer = CInt(Math.Ceiling(totalRecords / Me.PageSize)) + + Me.PageIndex = totalPages - 1 + End If + + ' Make sure PageIndex (current page) and PageSize are within bounds. + If Me.PageIndex < 0 Then + Me.PageIndex = 0 + End If + If Me.PageSize < 1 Then + Me.PageSize = 1 + End If + + ' Retrieve the records and set the table DataSource. + ' Only PageSize records are fetched starting at PageIndex (zero based). + If Me.AddNewRecord > 0 Then + ' Make sure to preserve the previously entered data on new rows. + Dim postdata As New ArrayList + For Each rc As PersonalRankTableControlRow In Me.GetRecordControls() + If Not rc.IsNewRecord Then + rc.DataSource = rc.GetRecord() + rc.GetUIData() + postdata.Add(rc.DataSource) + UIData.Add(rc.PreservedUIData()) + End If + Next + Me.DataSource = DirectCast(postdata.ToArray(GetType(PersonalRankRecord)), PersonalRankRecord()) + Else ' Get the records from the database + Me.DataSource = PersonalRankTable.GetRecords(joinFilter, wc, orderBy, Me.PageIndex, Me.PageSize) + + End If + + ' if the datasource contains no records contained in database, then load the last page. + If (DbUtils.GetCreatedRecords(Me.DataSource).Length = 0 AndAlso Not Me.DisplayLastPage) Then + Me.DisplayLastPage = True + LoadData() + Else + + ' Add any new rows desired by the user. + Me.AddNewRecords() + + + ' Initialize the page and grand totals. now + + End If + + Catch ex As Exception + ' Report the error message to the end user + Dim msg As String = ex.Message + If ex.InnerException IsNot Nothing Then + msg = msg & " InnerException: " & ex.InnerException.Message + End If + Throw New Exception(msg, ex.InnerException) + End Try + End Sub + + + + + Public Overrides Sub DataBind() + ' The DataBind method binds the user interface controls to the values + ' from the database record for each row in the table. To do this, it calls the + ' DataBind for each of the rows. + ' DataBind also populates any filters above the table, and sets the pagination + ' control to the correct number of records and the current page number. + + MyBase.DataBind() + + ' Make sure that the DataSource is initialized. + If Me.DataSource Is Nothing Then + Return + End If + + 'LoadData for DataSource for chart and report if they exist + + ' Improve performance by prefetching display as records. + Me.PreFetchForeignKeyValues() + + ' Setup the pagination controls. + BindPaginationControls() + + + + ' Bind the repeater with the list of records to expand the UI. + Dim rep As System.Web.UI.WebControls.Repeater = CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalRankTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return + rep.DataSource = DataSource() + rep.DataBind() + + Dim index As Integer = 0 + For Each repItem As System.Web.UI.WebControls.RepeaterItem In rep.Items + ' Loop through all rows in the table, set its DataSource and call DataBind(). + Dim recControl As PersonalRankTableControlRow = DirectCast(repItem.FindControl("PersonalRankTableControlRow"), PersonalRankTableControlRow) + recControl.DataSource = Me.DataSource(index) + If Me.UIData.Count > index Then + recControl.PreviousUIData = Me.UIData(index) + End If + recControl.DataBind() + recControl.Visible = Not Me.InDeletedRecordIds(recControl) + + index += 1 + Next + + + + + ' Call the Set methods for each controls on the panel + + SetGazetteDateLabel1() + SetGazetteNOLabel1() + SetGazettePageLabel1() + SetGazetteSectionLabel1() + + + + + + + + SetPersonalRankTableControlCollapsibleRegion() + + SetPreRankLabel1() + SetRankDateLabel() + SetRankIdLabel2() + SetRefDateLabel1() + SetRefLabel2() + ' setting the state of expand or collapse alternative rows + + + ' Load data for each record and table UI control. + ' Ordering is important because child controls get + ' their parent ids from their parent UI controls. + + + ' this method calls the set method for controls with special formula like running total, sum, rank, etc + SetFormulaControls() + End Sub + + Public Overridable Sub SetFormulaControls() + ' this method calls Set methods for the control that has special formula + + + + End Sub + + + Public Sub PreFetchForeignKeyValues() + If (IsNothing(Me.DataSource)) + Return + End If + + Me.Page.PregetDfkaRecords(PersonalRankTable.RankId, Me.DataSource) + + End Sub + + + Public Overridable Sub RegisterPostback() + + Me.Page.RegisterPostBackTrigger(MiscUtils.FindControlRecursively(Me,"PersonalRankExportCSVButton")) + + Me.Page.RegisterPostBackTrigger(MiscUtils.FindControlRecursively(Me,"PersonalRankExportExcelButton")) + + Me.Page.RegisterPostBackTrigger(MiscUtils.FindControlRecursively(Me,"PersonalRankPDFButton")) + + Me.Page.RegisterPostBackTrigger(MiscUtils.FindControlRecursively(Me,"PersonalRankWordButton")) + + + End Sub + + Public EvaluateFormulaDelegate As BaseClasses.Data.DataSource.EvaluateFormulaDelegate = New BaseClasses.Data.DataSource.EvaluateFormulaDelegate(AddressOf Me.EvaluateFormula) + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean, ByVal e as FormulaEvaluator) As String + If e Is Nothing + e = New FormulaEvaluator() + End If + + e.Variables.Clear() + + + ' add variables for formula evaluation + If variables IsNot Nothing Then + Dim enumerator As System.Collections.Generic.IEnumerator(Of System.Collections.Generic.KeyValuePair(Of String, Object)) = variables.GetEnumerator() + While enumerator.MoveNext() + e.Variables.Add(enumerator.Current.Key, enumerator.Current.Value) + End While + End If + + If includeDS + + End If + + ' All variables referred to in the formula are expected to be + ' properties of the DataSource. For example, referring to + ' UnitPrice as a variable will refer to DataSource.UnitPrice + e.DataSource = dataSourceForEvaluate + + ' Define the calling control. This is used to add other + ' related table and record controls as variables. + e.CallingControl = Me + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + + If Not String.IsNullOrEmpty(format) AndAlso (String.IsNullOrEmpty(formula) OrElse formula.IndexOf("Format(") < 0) Then + Return FormulaUtils.Format(resultObj, format) + Else + Return resultObj.ToString() + End If + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format,variables ,includeDS, Nothing) + End Function + + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object)) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format, variables ,True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, format, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal e as FormulaEvaluator) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, variables, True, e) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal includeDS as Boolean) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, includeDS, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, True, Nothing) + End Function + + + + + Public Overridable Sub ResetControl() + + Me.CurrentSortOrder.Reset() + If (Me.InSession(Me, "Order_By")) Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + Me.CurrentSortOrder.Add(PersonalRankTable.RankDate, OrderByItem.OrderDir.Asc) + + End If + + Me.PageIndex = 0 + End Sub + + Protected Overridable Sub BindPaginationControls() + ' Setup the pagination controls. + + ' Bind the pagination labels. + + If DbUtils.GetCreatedRecords(Me.DataSource).Length > 0 Then + + Me.PersonalRankPagination.CurrentPage.Text = (Me.PageIndex + 1).ToString() + Else + Me.PersonalRankPagination.CurrentPage.Text = "0" + End If + Me.PersonalRankPagination.PageSize.Text = Me.PageSize.ToString() + Me.PersonalRankPagination.TotalItems.Text = Me.TotalRecords.ToString() + Me.PersonalRankPagination.TotalPages.Text = Me.TotalPages.ToString() + + ' Bind the buttons for PersonalRankTableControl pagination. + + Me.PersonalRankPagination.FirstPage.Enabled = Not (Me.PageIndex = 0) + If Me._TotalPages < 0 Then ' if the total pages is not determined yet, enable last and next buttons + Me.PersonalRankPagination.LastPage.Enabled = True + ElseIf Me._TotalPages = 0 ' if the total pages is determined and it is 0, enable last and next buttons + Me.PersonalRankPagination.LastPage.Enabled = False + Else ' if the total pages is the last page, disable last and next buttons + Me.PersonalRankPagination.LastPage.Enabled = Not (Me.PageIndex = Me.TotalPages - 1) + End If + + If Me._TotalPages < 0 Then ' if the total pages is not determined yet, enable last and next buttons + Me.PersonalRankPagination.NextPage.Enabled = True + ElseIf Me._TotalPages = 0 ' if the total pages is determined and it is 0, enable last and next buttons + Me.PersonalRankPagination.NextPage.Enabled = False + Else ' if the total pages is the last page, disable last and next buttons + Me.PersonalRankPagination.NextPage.Enabled = Not (Me.PageIndex = Me.TotalPages - 1) + End If + + Me.PersonalRankPagination.PreviousPage.Enabled = Not (Me.PageIndex = 0) + + + End Sub + + Public Overridable Sub SaveData() + ' Save the data from the entire table. Calls each row's Save Data + ' to save their data. This function is called by the Click handler of the + ' Save button. The button handler should Start/Commit/End a transaction. + + Dim recCtl As PersonalRankTableControlRow + For Each recCtl In Me.GetRecordControls() + + If Me.InDeletedRecordIds(recCtl) Then + ' Delete any pending deletes. + recCtl.Delete() + Else + If recCtl.Visible Then + recCtl.SaveData() + End If + End If + + Next + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + ' Set IsNewRecord to False for all records - since everything has been saved and is no longer "new" + For Each recCtl In Me.GetRecordControls() + recCtl.IsNewRecord = False + Next + + + ' Set DeletedRecordsIds to Nothing since we have deleted all pending deletes. + Me.DeletedRecordIds = Nothing + + End Sub + + Public Overridable Function CreateCompoundJoinFilter() As CompoundFilter + Dim jFilter As CompoundFilter = New CompoundFilter() + + Return jFilter + + End Function + + + Public Overridable Function CreateOrderBy() As OrderBy + ' The CurrentSortOrder is initialized to the sort order on the + ' Query Wizard. It may be modified by the Click handler for any of + ' the column heading to sort or reverse sort by that column. + ' You can add your own sort order, or modify it on the Query Wizard. + Return Me.CurrentSortOrder + End Function + + Public Overridable Function CreateWhereClause() As WhereClause + 'This CreateWhereClause is used for loading the data. + PersonalRankTable.Instance.InnerFilter = Nothing + Dim wc As WhereClause = New WhereClause() + + ' Compose the WHERE clause consiting of: + ' 1. Static clause defined at design time. + ' 2. User selected search criteria. + ' 3. User selected filter criteria. + + + Dim selectedRecordKeyValue as KeyValue = New KeyValue() + + Dim personalIdRecordControlObj As Persons.UI.Controls.ShowPersonalId.PersonalIdRecordControl = DirectCast(MiscUtils.FindControlRecursively(Me.Page, "PersonalIdRecordControl"), Persons.UI.Controls.ShowPersonalId.PersonalIdRecordControl) + + If (Not IsNothing(personalIdRecordControlObj) AndAlso Not IsNothing(personalIdRecordControlObj.GetRecord()) AndAlso personalIdRecordControlObj.GetRecord().IsCreated AndAlso Not IsNothing(personalIdRecordControlObj.GetRecord().PersonalId)) + wc.iAND(PersonalRankTable.PersonalId, BaseFilter.ComparisonOperator.EqualsTo, personalIdRecordControlObj.GetRecord().PersonalId.ToString()) + selectedRecordKeyValue.AddElement(PersonalRankTable.PersonalId.InternalName, personalIdRecordControlObj.GetRecord().PersonalId.ToString()) + Else + wc.RunQuery = False + Return wc + End If + + HttpContext.Current.Session("PersonalRankTableControlWhereClause") = selectedRecordKeyValue.ToXmlString() + + Return wc + End Function + + + Public Overridable Function CreateWhereClause(ByVal searchText as String, ByVal fromSearchControl as String, ByVal AutoTypeAheadSearch as String, ByVal AutoTypeAheadWordSeparators as String) As WhereClause + ' This CreateWhereClause is used for loading list of suggestions for Auto Type-Ahead feature. + PersonalRankTable.Instance.InnerFilter = Nothing + Dim wc As WhereClause = New WhereClause() + + ' Compose the WHERE clause consiting of: + ' 1. Static clause defined at design time. + ' 2. User selected search criteria. + ' 3. User selected filter criteria. + + Dim appRelativeVirtualPath As String = CType(HttpContext.Current.Session("AppRelativeVirtualPath"), String) + + Dim selectedRecordInPersonalIdRecordControl as String = DirectCast(HttpContext.Current.Session("PersonalRankTableControlWhereClause"), String) + + If Not selectedRecordInPersonalIdRecordControl Is Nothing AndAlso KeyValue.IsXmlKey(selectedRecordInPersonalIdRecordControl) Then + Dim selectedRecordKeyValue as KeyValue = KeyValue.XmlToKey(selectedRecordInPersonalIdRecordControl) + + If Not IsNothing(selectedRecordKeyValue) AndAlso selectedRecordKeyValue.ContainsColumn(PersonalRankTable.PersonalId) Then + wc.iAND(PersonalRankTable.PersonalId, BaseFilter.ComparisonOperator.EqualsTo, selectedRecordKeyValue.GetColumnValue(PersonalRankTable.PersonalId).ToString()) + End If + + End If + + ' Adds clauses if values are selected in Filter controls which are configured in the page. + + + Return wc + End Function + + + Public Overridable Function FormatSuggestions(ByVal prefixText As String, ByVal resultItem As String, _ + ByVal columnLength As Integer, ByVal AutoTypeAheadDisplayFoundText As String, _ + ByVal autoTypeAheadSearch As String, ByVal AutoTypeAheadWordSeparators As String, _ + ByVal resultList As ArrayList) As Boolean + + 'Formats the resultItem and adds it to the list of suggestions. + Dim index As Integer = resultItem.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture).IndexOf(prefixText.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture)) + Dim itemToAdd As String = "" + Dim isFound As Boolean = False + Dim isAdded As Boolean = False + ' Get the index where prfixt is at the beginning of resultItem. If not found then, index of word which begins with prefixText. + If InvariantLCase(autoTypeAheadSearch).equals("wordsstartingwithsearchstring") And Not index = 0 Then + ' Expression to find word which contains AutoTypeAheadWordSeparators followed by prefixText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex( AutoTypeAheadWordSeparators + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + If regex1.IsMatch(resultItem) Then + index = regex1.Match(resultItem).Index + isFound = True + End If + ' If the prefixText is found immediatly after white space then starting of the word is found so don not search any further + If not resultItem(index).ToString() = " " Then + ' Expression to find beginning of the word which contains AutoTypeAheadWordSeparators followed by prefixText + Dim regex As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\\S*" + AutoTypeAheadWordSeparators + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + If regex.IsMatch(resultItem) Then + index = regex.Match(resultItem).Index + isFound = True + End If + End If + End If + + ' If autoTypeAheadSearch value is wordsstartingwithsearchstring then, extract the substring only if the prefixText is found at the + ' beginning of the resultItem (index = 0) or a word in resultItem is found starts with prefixText. + If index = 0 Or isFound Or InvariantLCase(autoTypeAheadSearch).Equals("anywhereinstring") then + If InvariantLCase(AutoTypeAheadDisplayFoundText).equals("atbeginningofmatchedstring") Then + ' Expression to find beginning of the word which contains prefixText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\\S*" + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + ' Find the beginning of the word which contains prefexText + If (StringUtils.InvariantLCase(autoTypeAheadSearch).Equals("anywhereinstring") AndAlso regex1.IsMatch(resultItem)) Then + index = regex1.Match(resultItem).Index + isFound = True + End If + ' Display string from the index till end of the string if sub string from index till end is less than columnLength value. + If Len(resultItem) - index <= columnLength Then + If index = 0 Then + itemToAdd = resultItem + Else + itemToAdd = "..." & resultItem.Substring(index, Len(resultItem) - index) + End If + Else + If index = 0 Then + itemToAdd = resultItem.Substring(index, (columnLength - 3)) & "..." + Else + 'Truncate the string to show only columnLength - 6 characters as begining and trailing "..." has to be appended. + itemToAdd = "..." & resultItem.Substring(index , columnLength - 6) & "..." + End If + End If + ElseIf InvariantLCase(AutoTypeAheadDisplayFoundText).equals("inmiddleofmatchedstring") Then + Dim subStringBeginIndex As Integer = CType(columnLength/2, Integer) + If Len(resultItem) <= columnLength Then + itemToAdd = resultItem + Else + ' Sanity check at end of the string + If index + Len(prefixText) = columnLength Then + itemToAdd = "..." & resultItem.Substring(index-columnLength,index) + ElseIf Len(resultItem) - index < subStringBeginIndex Then + ' Display string from the end till columnLength value if, index is closer to the end of the string. + itemToAdd = "..." & resultItem.Substring(Len(resultItem)-columnLength,Len(resultItem)) + ElseIf index <= subStringBeginIndex Then + ' Sanity chet at beginning of the string + itemToAdd = resultItem.Substring(0, columnLength) & "..." + Else + ' Display string containing text before the prefixText occures and text after the prefixText + itemToAdd = "..." & resultItem.Substring(index - subStringBeginIndex, columnLength) & "..." + End If + End If + ElseIf InvariantLCase(AutoTypeAheadDisplayFoundText).equals("atendofmatchedstring") Then + ' Expression to find ending of the word which contains prefexText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\s", System.Text.RegularExpressions.RegexOptions.IgnoreCase) + ' Find the ending of the word which contains prefexText + If regex1.IsMatch(resultItem, index + 1) Then + index = regex1.Match(resultItem, index + 1).Index + Else + ' If the word which contains prefexText is the last word in string, regex1.IsMatch returns false. + index = resultItem.Length + End If + If index > Len(resultItem) Then + index = Len(resultItem) + End If + ' If text from beginning of the string till index is less than columnLength value then, display string from the beginning till index. + If index <= columnLength Then + if index = Len(resultItem) Then 'Make decision to append "..." + itemToAdd = resultItem.Substring(0,index) + Else + itemToAdd = resultItem.Substring(0,index) & "..." + End If + Else + If index = Len(resultItem) Then + itemToAdd = "..." & resultItem.Substring(index - (columnLength - 3), (columnLength - 3)) + Else + 'Truncate the string to show only columnLength - 6 characters as begining and trailing "..." has to be appended. + itemToAdd = "..." & resultItem.Substring(index - (columnLength - 6), columnLength - 6) & "..." + End If + End If + End If + + ' Remove newline character from itemToAdd + Dim prefixTextIndex As Integer = itemToAdd.IndexOf(prefixText, StringComparison.CurrentCultureIgnoreCase) + ' If itemToAdd contains any newline after the search text then show text only till newline + Dim regex2 As System.Text.RegularExpressions.Regex = New System.Text.RegularExpressions.Regex("(" & vbCrLf & "|" & vbLf & ")", System.Text.RegularExpressions.RegexOptions.IgnoreCase) + Dim newLineIndexAfterPrefix As Integer = -1 + If regex2.IsMatch(itemToAdd, prefixTextIndex) Then + newLineIndexAfterPrefix = regex2.Match(itemToAdd, prefixTextIndex).Index + End If + If (newLineIndexAfterPrefix > -1) Then + If itemToAdd.EndsWith("...") Then + itemToAdd = (itemToAdd.Substring(0, newLineIndexAfterPrefix) + "...") + Else + itemToAdd = itemToAdd.Substring(0, newLineIndexAfterPrefix) + End If + End If + ' If itemToAdd contains any newline before search text then show text which comes after newline + Dim regex3 As System.Text.RegularExpressions.Regex = New System.Text.RegularExpressions.Regex("(" & vbCrLf & "|" & vbLf & ")", (System.Text.RegularExpressions.RegexOptions.IgnoreCase Or System.Text.RegularExpressions.RegexOptions.RightToLeft)) + Dim newLineIndexBeforePrefix As Integer = -1 + If regex3.IsMatch(itemToAdd, prefixTextIndex) Then + newLineIndexBeforePrefix = regex3.Match(itemToAdd, prefixTextIndex).Index + End If + If (newLineIndexBeforePrefix > -1) Then + If itemToAdd.StartsWith("...") Then + itemToAdd = ("..." + itemToAdd.Substring((newLineIndexBeforePrefix + regex3.Match(itemToAdd, prefixTextIndex).Length))) + Else + itemToAdd = itemToAdd.Substring((newLineIndexBeforePrefix + regex3.Match(itemToAdd, prefixTextIndex).Length)) + End If + End If + + If Not itemToAdd is nothing AndAlso Not resultList.Contains(itemToAdd) Then + + resultList.Add(itemToAdd) + + isAdded = true + End If + End If + Return isAdded + End Function + + + Protected Overridable Sub GetPageSize() + + If Me.PersonalRankPagination.PageSize.Text.Trim <> "" Then + Try + 'Me.PageSize = Integer.Parse(Me.PersonalRankPagination.PageSize.Text) + Catch ex As Exception + End Try + End If + End Sub + + Protected Overridable Sub AddNewRecords() + + Dim newRecordList As ArrayList = New ArrayList() + + Dim newUIDataList As System.Collections.Generic.List(Of Hashtable) = New System.Collections.Generic.List(Of Hashtable)() + + ' Loop though all the record controls and if the record control + ' does not have a unique record id set, then create a record + ' and add to the list. + If Not Me.ResetData Then + Dim rep As System.Web.UI.WebControls.Repeater = CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalRankTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return + + Dim repItem As System.Web.UI.WebControls.RepeaterItem + For Each repItem In rep.Items + ' Loop through all rows in the table, set its DataSource and call DataBind(). + + Dim recControl As PersonalRankTableControlRow = DirectCast(repItem.FindControl("PersonalRankTableControlRow"), PersonalRankTableControlRow) + + If recControl.Visible AndAlso recControl.IsNewRecord() Then + + Dim rec As PersonalRankRecord = New PersonalRankRecord() + + If recControl.GazetteDate1.Text <> "" Then + rec.Parse(recControl.GazetteDate1.Text, PersonalRankTable.GazetteDate) + End If + If recControl.GazetteNO1.Text <> "" Then + rec.Parse(recControl.GazetteNO1.Text, PersonalRankTable.GazetteNO) + End If + If recControl.GazettePage1.Text <> "" Then + rec.Parse(recControl.GazettePage1.Text, PersonalRankTable.GazettePage) + End If + If recControl.GazetteSection1.Text <> "" Then + rec.Parse(recControl.GazetteSection1.Text, PersonalRankTable.GazetteSection) + End If + If recControl.PreRank.Text <> "" Then + rec.Parse(recControl.PreRank.Text, PersonalRankTable.PreRank) + End If + If recControl.RankDate.Text <> "" Then + rec.Parse(recControl.RankDate.Text, PersonalRankTable.RankDate) + End If + If recControl.RankId1.Text <> "" Then + rec.Parse(recControl.RankId1.Text, PersonalRankTable.RankId) + End If + If recControl.Ref3.Text <> "" Then + rec.Parse(recControl.Ref3.Text, PersonalRankTable.Ref0) + End If + If recControl.RefDate1.Text <> "" Then + rec.Parse(recControl.RefDate1.Text, PersonalRankTable.RefDate) + End If + newUIDataList.Add(recControl.PreservedUIData()) + newRecordList.Add(rec) + End If + Next + End If + + + ' Add any new record to the list. + Dim index As Integer = 0 + For index = 1 To Me.AddNewRecord + + newRecordList.Insert(0, New PersonalRankRecord()) + newUIDataList.Insert(0, New Hashtable()) + + Next + Me.AddNewRecord = 0 + + ' Finally, add any new records to the DataSource. + If newRecordList.Count > 0 Then + + Dim finalList As ArrayList = New ArrayList(Me.DataSource) + finalList.InsertRange(0, newRecordList) + + Me.DataSource = DirectCast(finalList.ToArray(GetType(PersonalRankRecord)), PersonalRankRecord()) + + End If + + ' Add the existing UI data to this hash table + If newUIDataList.Count > 0 Then + Me.UIData.InsertRange(0, newUIDataList) + End If + + End Sub + + + Public Sub AddToDeletedRecordIds(ByVal rec As PersonalRankTableControlRow) + If rec.IsNewRecord() Then + Return + End If + + If Not Me.DeletedRecordIds Is Nothing AndAlso Me.DeletedRecordIds.Trim <> "" Then + Me.DeletedRecordIds &= "," + End If + + Me.DeletedRecordIds &= "[" & rec.RecordUniqueId & "]" + End Sub + + Protected Overridable Function InDeletedRecordIds(ByVal rec As PersonalRankTableControlRow) As Boolean + If Me.DeletedRecordIds Is Nothing OrElse Me.DeletedRecordIds.Trim = "" Then + Return False + End If + + Return Me.DeletedRecordIds.IndexOf("[" & rec.RecordUniqueId & "]") >= 0 + End Function + + Private _DeletedRecordIds As String + Public Property DeletedRecordIds() As String + Get + Return Me._DeletedRecordIds + End Get + Set(ByVal value As String) + Me._DeletedRecordIds = value + End Set + End Property + + + ' Create Set, WhereClause, and Populate Methods + + Public Overridable Sub SetGazetteDateLabel1() + + End Sub + + Public Overridable Sub SetGazetteNOLabel1() + + End Sub + + Public Overridable Sub SetGazettePageLabel1() + + End Sub + + Public Overridable Sub SetGazetteSectionLabel1() + + End Sub + + Public Overridable Sub SetPersonalRankTableControlCollapsibleRegion() + + End Sub + + Public Overridable Sub SetPreRankLabel1() + + End Sub + + Public Overridable Sub SetRankDateLabel() + + End Sub + + Public Overridable Sub SetRankIdLabel2() + + End Sub + + Public Overridable Sub SetRefDateLabel1() + + End Sub + + Public Overridable Sub SetRefLabel2() + + End Sub + + + + + Protected Overridable Sub Control_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.PreRender + ' PreRender event is raised just before page is being displayed. + Try + DbUtils.StartTransaction + Me.RegisterPostback() + + If Not Me.Page.ErrorOnPage AndAlso (Me.Page.IsPageRefresh OrElse Me.DataChanged OrElse Me.ResetData) Then + + + ' Re-load the data and update the web page if necessary. + ' This is typically done during a postback (filter, search button, sort, pagination button). + ' In each of the other click handlers, simply set DataChanged to True to reload the data. + + Me.LoadData() + Me.DataBind() + + End If + + + + Catch ex As Exception + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + Finally + DbUtils.EndTransaction + End Try + End Sub + + + Protected Overrides Sub SaveControlsToSession() + MyBase.SaveControlsToSession() + + ' Save filter controls to values to session. + + + 'Save pagination state to session. + + + + ' Save table control properties to the session. + If Not Me.CurrentSortOrder Is Nothing Then + Me.SaveToSession(Me, "Order_By", Me.CurrentSortOrder.ToXmlString()) + End If + + Me.SaveToSession(Me, "Page_Index", Me.PageIndex.ToString()) + Me.SaveToSession(Me, "Page_Size", Me.PageSize.ToString()) + + Me.SaveToSession(Me, "DeletedRecordIds", Me.DeletedRecordIds) + + End Sub + + Protected Sub SaveControlsToSession_Ajax() + ' Save filter controls to values to session. + + HttpContext.Current.Session("AppRelativeVirtualPath") = Me.Page.AppRelativeVirtualPath + + End Sub + + Protected Overrides Sub ClearControlsFromSession() + MyBase.ClearControlsFromSession() + + ' Clear filter controls values from the session. + + + ' Clear pagination state from session. + + + + ' Clear table properties from the session. + Me.RemoveFromSession(Me, "Order_By") + Me.RemoveFromSession(Me, "Page_Index") + Me.RemoveFromSession(Me, "Page_Size") + + Me.RemoveFromSession(Me, "DeletedRecordIds") + + End Sub + + Protected Overrides Sub LoadViewState(ByVal savedState As Object) + MyBase.LoadViewState(savedState) + + Dim orderByStr As String = CType(ViewState("PersonalRankTableControl_OrderBy"), String) + + If orderByStr IsNot Nothing AndAlso orderByStr.Trim <> "" Then + Me.CurrentSortOrder = BaseClasses.Data.OrderBy.FromXmlString(orderByStr) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + End If + + Dim pageIndex As String = CType(ViewState("Page_Index"), String) + If pageIndex IsNot Nothing Then + Me.PageIndex = CInt(pageIndex) + End If + + Dim pageSize As String = CType(ViewState("Page_Size"), String) + If Not pageSize Is Nothing Then + Me.PageSize = CInt(pageSize) + End If + + + + ' Load view state for pagination control. + + Me.DeletedRecordIds = CType(Me.ViewState("DeletedRecordIds"), String) + + End Sub + + Protected Overrides Function SaveViewState() As Object + + If Me.CurrentSortOrder IsNot Nothing Then + Me.ViewState("PersonalRankTableControl_OrderBy") = Me.CurrentSortOrder.ToXmlString() + End If + + Me.ViewState("Page_Index") = Me.PageIndex + Me.ViewState("Page_Size") = Me.PageSize + + Me.ViewState("DeletedRecordIds") = Me.DeletedRecordIds + + + ' Load view state for pagination control. + + + Return MyBase.SaveViewState() + End Function + + ' Generate the event handling functions for pagination events. + + ' event handler for ImageButton + Public Overridable Sub PersonalRankPagination_FirstPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.PageIndex = 0 + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalRankPagination_LastPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.DisplayLastPage = True + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalRankPagination_NextPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.PageIndex += 1 + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for LinkButton + Public Overridable Sub PersonalRankPagination_PageSizeButton_Click(ByVal sender As Object, ByVal args As EventArgs) + + Try + + Me.DataChanged = True + + Me.PageSize = Integer.Parse(Me.PersonalRankPagination.PageSize.Text) + + Me.PageIndex = Integer.Parse(Me.PersonalRankPagination.CurrentPage.Text) - 1 + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalRankPagination_PreviousPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + If Me.PageIndex > 0 Then + Me.PageIndex -= 1 + Me.DataChanged = True + End If + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + + ' Generate the event handling functions for sorting events. + + Public Overridable Sub GazetteDateLabel1_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by GazetteDate when clicked. + + ' Get previous sorting state for GazetteDate. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalRankTable.GazetteDate) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for GazetteDate. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalRankTable.GazetteDate, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by GazetteDate, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub GazetteNOLabel1_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by GazetteNO when clicked. + + ' Get previous sorting state for GazetteNO. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalRankTable.GazetteNO) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for GazetteNO. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalRankTable.GazetteNO, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by GazetteNO, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub GazettePageLabel1_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by GazettePage when clicked. + + ' Get previous sorting state for GazettePage. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalRankTable.GazettePage) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for GazettePage. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalRankTable.GazettePage, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by GazettePage, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub GazetteSectionLabel1_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by GazetteSection when clicked. + + ' Get previous sorting state for GazetteSection. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalRankTable.GazetteSection) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for GazetteSection. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalRankTable.GazetteSection, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by GazetteSection, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub PreRankLabel1_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by PreRank when clicked. + + ' Get previous sorting state for PreRank. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalRankTable.PreRank) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for PreRank. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalRankTable.PreRank, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by PreRank, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub RankDateLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by RankDate when clicked. + + ' Get previous sorting state for RankDate. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalRankTable.RankDate) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for RankDate. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalRankTable.RankDate, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by RankDate, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub RankIdLabel2_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by RankId when clicked. + + ' Get previous sorting state for RankId. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalRankTable.RankId) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for RankId. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalRankTable.RankId, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by RankId, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub RefDateLabel1_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by RefDate when clicked. + + ' Get previous sorting state for RefDate. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalRankTable.RefDate) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for RefDate. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalRankTable.RefDate, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by RefDate, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub RefLabel2_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by Ref when clicked. + + ' Get previous sorting state for Ref. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalRankTable.Ref0) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for Ref. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalRankTable.Ref0, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by Ref, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + + ' Generate the event handling functions for button events. + + ' event handler for ImageButton + Public Overridable Sub PersonalRankExportCSVButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + ' Build the where clause based on the current filter and search criteria + ' Create the Order By clause based on the user's current sorting preference. + + Dim wc As WhereClause = CreateWhereClause + Dim orderBy As OrderBy = Nothing + + orderBy = CreateOrderBy + + ' Add each of the columns in order of export. + Dim columns() as BaseColumn = New BaseColumn() { _ + PersonalRankTable.PreRank, _ + PersonalRankTable.RankId, _ + PersonalRankTable.RankDate, _ + PersonalRankTable.RefDate, _ + PersonalRankTable.Ref0, _ + PersonalRankTable.GazetteNO, _ + PersonalRankTable.GazetteSection, _ + PersonalRankTable.GazettePage, _ + PersonalRankTable.GazetteDate, _ + Nothing} + Dim exportData as ExportDataToCSV = New ExportDataToCSV(PersonalRankTable.Instance, wc, orderBy, columns) + + Dim done As Boolean = False + + Dim totalRowsReturned As Integer = 0 + Dim join As CompoundFilter = CreateCompoundJoinFilter() + Dim data As DataForExport = New DataForExport(PersonalRankTable.Instance, wc, orderBy, columns, join) + + 'Check for Export Data Threshold + Dim exportRawValues As Boolean = False + Me.TotalRecords = PersonalRankTable.GetRecordCount(join, wc) + If Me.TotalRecords > 10000 Then + exportRawValues = True + End If + exportData.StartExport(Me.Page.Response, exportRawValues) + + ' Read pageSize records at a time and write out the CSV file. + While (Not done) + Dim recList As ArrayList = data.GetRows(exportData.pageSize) + If recList Is Nothing Then + Exit While 'no more records we are done + End If + + totalRowsReturned = recList.Count + For Each rec As BaseRecord In recList + For Each col As BaseColumn In data.ColumnList + If col Is Nothing Then + Continue For + End If + + If Not data.IncludeInExport(col) Then + Continue For + End If + + Dim val As String = "" + + If exportRawValues Then + val = rec.GetValue(col).ToString() + Else + Dim _isExpandableNonCompositeForeignKey As Boolean = col.TableDefinition.IsExpandableNonCompositeForeignKey(col) + If _isExpandableNonCompositeForeignKey AndAlso col.IsApplyDisplayAs Then + val = PersonalRankTable.GetDFKA(rec.GetValue(col).ToString(), col, Nothing) + End If + If (Not _isExpandableNonCompositeForeignKey) Or (String.IsNullOrEmpty(val)) Then + val = exportData.GetDataForExport(col, rec) + End If + End If + exportData.WriteColumnData(val, data.IsString(col)) + + Next col + exportData.WriteNewRow() + Next rec + + ' If we already are below the pageSize, then we are done. + If totalRowsReturned < exportData.pageSize Then + done = True + End If + End While + exportData.FinishExport(Me.Page.Response) + + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalRankExportExcelButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + ' To customize the columns or the format, override this function in Section 1 of the page + ' and modify it to your liking. + ' Build the where clause based on the current filter and search criteria + ' Create the Order By clause based on the user's current sorting preference. + + Dim wc As WhereClause = CreateWhereClause + Dim orderBy As OrderBy = Nothing + + orderBy = CreateOrderBy + + Dim done As Boolean = False + Dim val As Object = "" + ' Read pageSize records at a time and write out the Excel file. + Dim totalRowsReturned As Integer = 0 + + Me.TotalRecords = PersonalRankTable.GetRecordCount(wc) + If Me.TotalRecords > 10000 Then + + ' Add each of the columns in order of export. + Dim columns() as BaseColumn = New BaseColumn() { _ + PersonalRankTable.PreRank, _ + PersonalRankTable.RankId, _ + PersonalRankTable.RankDate, _ + PersonalRankTable.RefDate, _ + PersonalRankTable.Ref0, _ + PersonalRankTable.GazetteNO, _ + PersonalRankTable.GazetteSection, _ + PersonalRankTable.GazettePage, _ + PersonalRankTable.GazetteDate, _ + Nothing} + Dim exportData as ExportDataToCSV = New ExportDataToCSV(PersonalRankTable.Instance, wc, orderBy, columns) + exportData.StartExport(Me.Page.Response, True) + + Dim dataForCSV As DataForExport = New DataForExport(PersonalRankTable.Instance, wc, orderBy, columns) + + ' Read pageSize records at a time and write out the CSV file. + While (Not done) + Dim recList As ArrayList = dataForCSV.GetRows(exportData.pageSize) + If recList Is Nothing Then + Exit While 'no more records we are done + End If + + totalRowsReturned = recList.Count + For Each rec As BaseRecord In recList + For Each col As BaseColumn In dataForCSV.ColumnList + If col Is Nothing Then + Continue For + End If + + If Not dataForCSV.IncludeInExport(col) Then + Continue For + End If + + val = rec.GetValue(col).ToString() + exportData.WriteColumnData(val, dataForCSV.IsString(col)) + + Next col + exportData.WriteNewRow() + Next rec + + ' If we already are below the pageSize, then we are done. + If totalRowsReturned < exportData.pageSize Then + done = True + End If + End While + exportData.FinishExport(Me.Page.Response) + Else + + ' Create an instance of the Excel report class with the table class, where clause and order by. + Dim excelReport As ExportDataToExcel = New ExportDataToExcel(PersonalRankTable.Instance, wc, orderBy) + ' Add each of the columns in order of export. + ' To customize the data type, change the second parameter of the new ExcelColumn to be + ' a format string from Excel's Format Cell menu. For example "dddd, mmmm dd, yyyy h:mm AM/PM;@", "#,##0.00" + + If Me.Page.Response Is Nothing Then + Return + End If + + excelReport.CreateExcelBook() + + Dim width As Integer = 0 + Dim columnCounter As Integer = 0 + Dim data As DataForExport = New DataForExport(PersonalRankTable.Instance, wc, orderBy, Nothing) + data.ColumnList.Add(New ExcelColumn(PersonalRankTable.PreRank, "0")) + data.ColumnList.Add(New ExcelColumn(PersonalRankTable.RankId, "Default")) + data.ColumnList.Add(New ExcelColumn(PersonalRankTable.RankDate, "Short Date")) + data.ColumnList.Add(New ExcelColumn(PersonalRankTable.RefDate, "Short Date")) + data.ColumnList.Add(New ExcelColumn(PersonalRankTable.Ref0, "Default")) + data.ColumnList.Add(New ExcelColumn(PersonalRankTable.GazetteNO, "Default")) + data.ColumnList.Add(New ExcelColumn(PersonalRankTable.GazetteSection, "Default")) + data.ColumnList.Add(New ExcelColumn(PersonalRankTable.GazettePage, "Default")) + data.ColumnList.Add(New ExcelColumn(PersonalRankTable.GazetteDate, "Short Date")) + + + For Each col As ExcelColumn In data.ColumnList + width = excelReport.GetExcelCellWidth(col) + If data.IncludeInExport(col) Then + excelReport.AddColumnToExcelBook(columnCounter, col.ToString(), excelReport.GetExcelDataType(col), width, excelReport.GetDisplayFormat(col)) + columnCounter = columnCounter + 1 + End If + Next col + + While (Not done) + Dim recList As ArrayList = data.GetRows(excelReport.pageSize) + + If recList Is Nothing Then + Exit While 'no more records we are done + End If + + totalRowsReturned = recList.Count + + For Each rec As BaseRecord In recList + excelReport.AddRowToExcelBook() + columnCounter = 0 + + For Each col As ExcelColumn In data.ColumnList + If Not data.IncludeInExport(col) Then + Continue For + End If + + Dim _isExpandableNonCompositeForeignKey As Boolean = col.DisplayColumn.TableDefinition.IsExpandableNonCompositeForeignKey(col.DisplayColumn) + If _isExpandableNonCompositeForeignKey AndAlso col.DisplayColumn.IsApplyDisplayAs Then + val = PersonalRankTable.GetDFKA(rec.GetValue(col.DisplayColumn).ToString(), col.DisplayColumn, Nothing) + If val Is Nothing Then + val = rec.Format(col.DisplayColumn) + End If + Else + val = excelReport.GetValueForExcelExport(col, rec) + End If + excelReport.AddCellToExcelRow(columnCounter, excelReport.GetExcelDataType(col), val, col.DisplayFormat) + + columnCounter = columnCounter + 1 + Next col + Next rec + + ' If we already are below the pageSize, then we are done. + If totalRowsReturned < excelReport.pageSize Then + done = True + End If + End While + + excelReport.SaveExcelBook(Me.Page.Response) + End If + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalRankImportButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalRankPDFButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + Dim report As PDFReport = New PDFReport() + report.SpecificReportFileName = Page.Server.MapPath("ShowPersonalId.PersonalRankPDFButton.report") + ' report.Title replaces the value tag of page header and footer containing ${ReportTitle} + report.Title = "PersonalRank" + ' If ShowPersonalId.PersonalRankPDFButton.report specifies a valid report template, + ' AddColumn method will generate a report template. + ' Each AddColumn method-call specifies a column + ' The 1st parameter represents the text of the column header + ' The 2nd parameter represents the horizontal alignment of the column header + ' The 3rd parameter represents the text format of the column detail + ' The 4th parameter represents the horizontal alignment of the column detail + ' The 5th parameter represents the relative width of the column + report.AddColumn(PersonalRankTable.PreRank.Name, ReportEnum.Align.Right, "${PreRank}", ReportEnum.Align.Right, 15) + report.AddColumn(PersonalRankTable.RankId.Name, ReportEnum.Align.Left, "${RankId}", ReportEnum.Align.Left, 30) + report.AddColumn(PersonalRankTable.RankDate.Name, ReportEnum.Align.Left, "${RankDate}", ReportEnum.Align.Left, 20) + report.AddColumn(PersonalRankTable.RefDate.Name, ReportEnum.Align.Left, "${RefDate}", ReportEnum.Align.Left, 20) + report.AddColumn(PersonalRankTable.Ref0.Name, ReportEnum.Align.Left, "${Ref0}", ReportEnum.Align.Left, 30) + report.AddColumn(PersonalRankTable.GazetteNO.Name, ReportEnum.Align.Left, "${GazetteNO}", ReportEnum.Align.Left, 30) + report.AddColumn(PersonalRankTable.GazetteSection.Name, ReportEnum.Align.Left, "${GazetteSection}", ReportEnum.Align.Left, 30) + report.AddColumn(PersonalRankTable.GazettePage.Name, ReportEnum.Align.Left, "${GazettePage}", ReportEnum.Align.Left, 30) + report.AddColumn(PersonalRankTable.GazetteDate.Name, ReportEnum.Align.Left, "${GazetteDate}", ReportEnum.Align.Left, 20) + + + Dim rowsPerQuery As Integer = 5000 + Dim recordCount As Integer = 0 + + report.Page = Page.GetResourceValue("Txt:Page", "Persons") + report.ApplicationPath = Me.Page.MapPath(Page.Request.ApplicationPath) + + Dim whereClause As WhereClause = CreateWhereClause + Dim orderBy As OrderBy = CreateOrderBy + Dim joinFilter As BaseFilter = CreateCompoundJoinFilter() + + Dim pageNum As Integer = 0 + Dim totalRows As Integer = PersonalRankTable.GetRecordCount(joinFilter,whereClause) + Dim columns As ColumnList = PersonalRankTable.GetColumnList() + Dim records As PersonalRankRecord() = Nothing + + Do + + records = PersonalRankTable.GetRecords(joinFilter,whereClause, orderBy, pageNum, rowsPerQuery) + If Not (records Is Nothing) AndAlso records.Length > 0 AndAlso whereClause.RunQuery Then + For Each record As PersonalRankRecord In records + + ' AddData method takes four parameters + ' The 1st parameters represent the data format + ' The 2nd parameters represent the data value + ' The 3rd parameters represent the default alignment of column using the data + ' The 4th parameters represent the maximum length of the data value being shown + report.AddData("${PreRank}", record.Format(PersonalRankTable.PreRank), ReportEnum.Align.Right, 100) + If BaseClasses.Utils.MiscUtils.IsNull(record.RankId) Then + report.AddData("${RankId}", "",ReportEnum.Align.Left, 100) + Else + Dim _isExpandableNonCompositeForeignKey as Boolean + Dim _DFKA as String = "" + _isExpandableNonCompositeForeignKey = PersonalRankTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalRankTable.RankId) + _DFKA = PersonalRankTable.GetDFKA(record.RankId.ToString(), PersonalRankTable.RankId,Nothing) + If _isExpandableNonCompositeForeignKey AndAlso (not _DFKA Is Nothing) AndAlso PersonalRankTable.RankId.IsApplyDisplayAs Then + report.AddData("${RankId}", _DFKA,ReportEnum.Align.Left, 100) + Else + report.AddData("${RankId}", record.Format(PersonalRankTable.RankId), ReportEnum.Align.Left, 100) + End If + End If + report.AddData("${RankDate}", record.Format(PersonalRankTable.RankDate), ReportEnum.Align.Left, 100) + report.AddData("${RefDate}", record.Format(PersonalRankTable.RefDate), ReportEnum.Align.Left, 100) + report.AddData("${Ref0}", record.Format(PersonalRankTable.Ref0), ReportEnum.Align.Left, 100) + report.AddData("${GazetteNO}", record.Format(PersonalRankTable.GazetteNO), ReportEnum.Align.Left, 100) + report.AddData("${GazetteSection}", record.Format(PersonalRankTable.GazetteSection), ReportEnum.Align.Left, 100) + report.AddData("${GazettePage}", record.Format(PersonalRankTable.GazettePage), ReportEnum.Align.Left, 100) + report.AddData("${GazetteDate}", record.Format(PersonalRankTable.GazetteDate), ReportEnum.Align.Left, 100) + + report.WriteRow + Next + pageNum = pageNum + 1 + recordCount += records.Length + End If + Loop While Not (records Is Nothing) AndAlso recordCount < totalRows AndAlso whereClause.RunQuery + + report.Close + BaseClasses.Utils.NetUtils.WriteResponseBinaryAttachment(Me.Page.Response, report.Title + ".pdf", report.ReportInByteArray, 0, true) + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalRankRefreshButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Dim PersonalDDTableControlObj as PersonalDDTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalDDTableControl"), PersonalDDTableControl) + PersonalDDTableControlObj.ResetData = True + + PersonalDDTableControlObj.RemoveFromSession(PersonalDDTableControlObj, "DeletedRecordIds") + PersonalDDTableControlObj.DeletedRecordIds = Nothing + + Dim PersonalEducationTableControlObj as PersonalEducationTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalEducationTableControl"), PersonalEducationTableControl) + PersonalEducationTableControlObj.ResetData = True + + PersonalEducationTableControlObj.RemoveFromSession(PersonalEducationTableControlObj, "DeletedRecordIds") + PersonalEducationTableControlObj.DeletedRecordIds = Nothing + + Dim PersonalExtWorkTableControlObj as PersonalExtWorkTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalExtWorkTableControl"), PersonalExtWorkTableControl) + PersonalExtWorkTableControlObj.ResetData = True + + PersonalExtWorkTableControlObj.RemoveFromSession(PersonalExtWorkTableControlObj, "DeletedRecordIds") + PersonalExtWorkTableControlObj.DeletedRecordIds = Nothing + + Dim PersonalIdRecordControlObj as PersonalIdRecordControl = DirectCast(Me.Page.FindControlRecursively("PersonalIdRecordControl"), PersonalIdRecordControl) + PersonalIdRecordControlObj.ResetData = True + + + Dim PersonalInsigniaTableControlObj as PersonalInsigniaTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalInsigniaTableControl"), PersonalInsigniaTableControl) + PersonalInsigniaTableControlObj.ResetData = True + + PersonalInsigniaTableControlObj.RemoveFromSession(PersonalInsigniaTableControlObj, "DeletedRecordIds") + PersonalInsigniaTableControlObj.DeletedRecordIds = Nothing + + Dim PersonalLanguageSkillTableControlObj as PersonalLanguageSkillTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalLanguageSkillTableControl"), PersonalLanguageSkillTableControl) + PersonalLanguageSkillTableControlObj.ResetData = True + + PersonalLanguageSkillTableControlObj.RemoveFromSession(PersonalLanguageSkillTableControlObj, "DeletedRecordIds") + PersonalLanguageSkillTableControlObj.DeletedRecordIds = Nothing + + Dim PersonalNameTableControlObj as PersonalNameTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalNameTableControl"), PersonalNameTableControl) + PersonalNameTableControlObj.ResetData = True + + PersonalNameTableControlObj.RemoveFromSession(PersonalNameTableControlObj, "DeletedRecordIds") + PersonalNameTableControlObj.DeletedRecordIds = Nothing + + Dim PersonalRankTableControlObj as PersonalRankTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalRankTableControl"), PersonalRankTableControl) + PersonalRankTableControlObj.ResetData = True + + PersonalRankTableControlObj.RemoveFromSession(PersonalRankTableControlObj, "DeletedRecordIds") + PersonalRankTableControlObj.DeletedRecordIds = Nothing + + Dim PersonalSalaryTableControlObj as PersonalSalaryTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalSalaryTableControl"), PersonalSalaryTableControl) + PersonalSalaryTableControlObj.ResetData = True + + PersonalSalaryTableControlObj.RemoveFromSession(PersonalSalaryTableControlObj, "DeletedRecordIds") + PersonalSalaryTableControlObj.DeletedRecordIds = Nothing + + Dim PersonalSpecialSkillTableControlObj as PersonalSpecialSkillTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalSpecialSkillTableControl"), PersonalSpecialSkillTableControl) + PersonalSpecialSkillTableControlObj.ResetData = True + + PersonalSpecialSkillTableControlObj.RemoveFromSession(PersonalSpecialSkillTableControlObj, "DeletedRecordIds") + PersonalSpecialSkillTableControlObj.DeletedRecordIds = Nothing + + Dim PersonalSportSkillTableControlObj as PersonalSportSkillTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalSportSkillTableControl"), PersonalSportSkillTableControl) + PersonalSportSkillTableControlObj.ResetData = True + + PersonalSportSkillTableControlObj.RemoveFromSession(PersonalSportSkillTableControlObj, "DeletedRecordIds") + PersonalSportSkillTableControlObj.DeletedRecordIds = Nothing + + Dim PersonalTitleTableControlObj as PersonalTitleTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalTitleTableControl"), PersonalTitleTableControl) + PersonalTitleTableControlObj.ResetData = True + + PersonalTitleTableControlObj.RemoveFromSession(PersonalTitleTableControlObj, "DeletedRecordIds") + PersonalTitleTableControlObj.DeletedRecordIds = Nothing + + Dim PersonRelativeTableControlObj as PersonRelativeTableControl = DirectCast(Me.Page.FindControlRecursively("PersonRelativeTableControl"), PersonRelativeTableControl) + PersonRelativeTableControlObj.ResetData = True + + PersonRelativeTableControlObj.RemoveFromSession(PersonRelativeTableControlObj, "DeletedRecordIds") + PersonRelativeTableControlObj.DeletedRecordIds = Nothing + + Dim ReportPropertiesTableControlObj as ReportPropertiesTableControl = DirectCast(Me.Page.FindControlRecursively("ReportPropertiesTableControl"), ReportPropertiesTableControl) + ReportPropertiesTableControlObj.ResetData = True + + ReportPropertiesTableControlObj.RemoveFromSession(ReportPropertiesTableControlObj, "DeletedRecordIds") + ReportPropertiesTableControlObj.DeletedRecordIds = Nothing + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalRankResetButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.CurrentSortOrder.Reset() + If Me.InSession(Me, "Order_By") Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + Me.CurrentSortOrder.Add(PersonalRankTable.RankDate, OrderByItem.OrderDir.Asc) + + + End If + + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalRankWordButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + Dim report As WordReport = New WordReport + report.SpecificReportFileName = Page.Server.MapPath("ShowPersonalId.PersonalRankWordButton.word") + ' report.Title replaces the value tag of page header and footer containing ${ReportTitle} + report.Title = "PersonalRank" + ' If ShowPersonalId.PersonalRankWordButton.report specifies a valid report template, + ' AddColumn method will generate a report template. + ' Each AddColumn method-call specifies a column + ' The 1st parameter represents the text of the column header + ' The 2nd parameter represents the horizontal alignment of the column header + ' The 3rd parameter represents the text format of the column detail + ' The 4th parameter represents the horizontal alignment of the column detail + ' The 5th parameter represents the relative width of the column + report.AddColumn(PersonalRankTable.PreRank.Name, ReportEnum.Align.Right, "${PreRank}", ReportEnum.Align.Right, 15) + report.AddColumn(PersonalRankTable.RankId.Name, ReportEnum.Align.Left, "${RankId}", ReportEnum.Align.Left, 30) + report.AddColumn(PersonalRankTable.RankDate.Name, ReportEnum.Align.Left, "${RankDate}", ReportEnum.Align.Left, 20) + report.AddColumn(PersonalRankTable.RefDate.Name, ReportEnum.Align.Left, "${RefDate}", ReportEnum.Align.Left, 20) + report.AddColumn(PersonalRankTable.Ref0.Name, ReportEnum.Align.Left, "${Ref0}", ReportEnum.Align.Left, 30) + report.AddColumn(PersonalRankTable.GazetteNO.Name, ReportEnum.Align.Left, "${GazetteNO}", ReportEnum.Align.Left, 30) + report.AddColumn(PersonalRankTable.GazetteSection.Name, ReportEnum.Align.Left, "${GazetteSection}", ReportEnum.Align.Left, 30) + report.AddColumn(PersonalRankTable.GazettePage.Name, ReportEnum.Align.Left, "${GazettePage}", ReportEnum.Align.Left, 30) + report.AddColumn(PersonalRankTable.GazetteDate.Name, ReportEnum.Align.Left, "${GazetteDate}", ReportEnum.Align.Left, 20) + + Dim whereClause As WhereClause = CreateWhereClause + + Dim orderBy As OrderBy = CreateOrderBy + Dim joinFilter As BaseFilter = CreateCompoundJoinFilter() + + Dim rowsPerQuery As Integer = 5000 + Dim pageNum As Integer = 0 + Dim recordCount As Integer = 0 + Dim totalRows As Integer = PersonalRankTable.GetRecordCount(joinFilter,whereClause) + + report.Page = Page.GetResourceValue("Txt:Page", "Persons") + report.ApplicationPath = Me.Page.MapPath(Page.Request.ApplicationPath) + + Dim columns As ColumnList = PersonalRankTable.GetColumnList() + Dim records As PersonalRankRecord() = Nothing + Do + records = PersonalRankTable.GetRecords(joinFilter,whereClause, orderBy, pageNum, rowsPerQuery) + + If Not (records Is Nothing) AndAlso records.Length > 0 AndAlso whereClause.RunQuery Then + For Each record As PersonalRankRecord In records + ' AddData method takes four parameters + ' The 1st parameters represent the data format + ' The 2nd parameters represent the data value + ' The 3rd parameters represent the default alignment of column using the data + ' The 4th parameters represent the maximum length of the data value being shown + report.AddData("${PreRank}", record.Format(PersonalRankTable.PreRank), ReportEnum.Align.Right, 100) + If BaseClasses.Utils.MiscUtils.IsNull(record.RankId) Then + report.AddData("${RankId}", "",ReportEnum.Align.Left, 100) + Else + Dim _isExpandableNonCompositeForeignKey as Boolean + Dim _DFKA as String = "" + _isExpandableNonCompositeForeignKey = PersonalRankTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalRankTable.RankId) + _DFKA = PersonalRankTable.GetDFKA(record.RankId.ToString(), PersonalRankTable.RankId,Nothing) + If _isExpandableNonCompositeForeignKey AndAlso (not _DFKA Is Nothing) AndAlso PersonalRankTable.RankId.IsApplyDisplayAs Then + report.AddData("${RankId}", _DFKA,ReportEnum.Align.Left, 100) + Else + report.AddData("${RankId}", record.Format(PersonalRankTable.RankId), ReportEnum.Align.Left, 100) + End If + End If + report.AddData("${RankDate}", record.Format(PersonalRankTable.RankDate), ReportEnum.Align.Left, 100) + report.AddData("${RefDate}", record.Format(PersonalRankTable.RefDate), ReportEnum.Align.Left, 100) + report.AddData("${Ref0}", record.Format(PersonalRankTable.Ref0), ReportEnum.Align.Left, 100) + report.AddData("${GazetteNO}", record.Format(PersonalRankTable.GazetteNO), ReportEnum.Align.Left, 100) + report.AddData("${GazetteSection}", record.Format(PersonalRankTable.GazetteSection), ReportEnum.Align.Left, 100) + report.AddData("${GazettePage}", record.Format(PersonalRankTable.GazettePage), ReportEnum.Align.Left, 100) + report.AddData("${GazetteDate}", record.Format(PersonalRankTable.GazetteDate), ReportEnum.Align.Left, 100) + + report.WriteRow + Next + pageNum = pageNum + 1 + recordCount += records.Length + End If + Loop While Not (records Is Nothing) AndAlso recordCount < totalRows AndAlso whereClause.RunQuery + report.save + BaseClasses.Utils.NetUtils.WriteResponseBinaryAttachment(Me.Page.Response, report.Title + ".doc", report.ReportInByteArray, 0, true) + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + + + ' Generate the event handling functions for filter and search events. + + + ' Generate the event handling functions for others + + + Private _UIData As New System.Collections.Generic.List(Of Hashtable) + Public Property UIData() As System.Collections.Generic.List(Of Hashtable) + Get + Return Me._UIData + End Get + Set(ByVal value As System.Collections.Generic.List(Of Hashtable)) + Me._UIData = value + End Set + End Property + + ' pagination properties + Protected _PageSize As Integer + Public Property PageSize() As Integer + Get + Return Me._PageSize + End Get + Set(ByVal value As Integer) + Me._PageSize = value + End Set + End Property + + Protected _PageIndex As Integer + Public Property PageIndex() As Integer + Get + ' Return the PageIndex + Return Me._PageIndex + End Get + Set(ByVal value As Integer) + Me._PageIndex = value + End Set + End Property + + Protected _TotalRecords As Integer = -1 + Public Property TotalRecords() As Integer + Get + If _TotalRecords < 0 + _TotalRecords = PersonalRankTable.GetRecordCount(CreateCompoundJoinFilter(), CreateWhereClause()) + End If + Return Me._TotalRecords + End Get + Set(ByVal value As Integer) + If Me.PageSize > 0 Then + + Me.TotalPages = CInt(Math.Ceiling(value / Me.PageSize)) + + End If + Me._TotalRecords = value + End Set + End Property + + + + Protected _TotalPages As Integer = -1 + Public Property TotalPages() As Integer + Get + If _TotalPages < 0 Then + + Me.TotalPages = CInt(Math.Ceiling(TotalRecords / Me.PageSize)) + + End If + Return Me._TotalPages + End Get + Set(ByVal value As Integer) + Me._TotalPages = value + End Set + End Property + + Protected _DisplayLastPage As Boolean + Public Property DisplayLastPage() As Boolean + Get + Return Me._DisplayLastPage + End Get + Set(ByVal value As Boolean) + Me._DisplayLastPage = value + End Set + End Property + + Private _DataChanged As Boolean = False + Public Property DataChanged() As Boolean + Get + Return Me._DataChanged + End Get + Set(ByVal value As Boolean) + Me._DataChanged = value + End Set + End Property + + Private _ResetData As Boolean = False + Public Property ResetData() As Boolean + Get + Return Me._ResetData + End Get + Set(ByVal value As Boolean) + Me._ResetData = value + End Set + End Property + + Private _AddNewRecord As Integer = 0 + Public Property AddNewRecord() As Integer + Get + Return Me._AddNewRecord + End Get + Set(ByVal value As Integer) + Me._AddNewRecord = value + End Set + End Property + + + Private _CurrentSortOrder As OrderBy = Nothing + Public Property CurrentSortOrder() As OrderBy + Get + Return Me._CurrentSortOrder + End Get + Set(ByVal value As BaseClasses.Data.OrderBy) + Me._CurrentSortOrder = value + End Set + End Property + + Private _DataSource() As PersonalRankRecord = Nothing + Public Property DataSource() As PersonalRankRecord () + Get + Return Me._DataSource + End Get + Set(ByVal value() As PersonalRankRecord) + Me._DataSource = value + End Set + End Property + +#Region "Helper Properties" + + Public ReadOnly Property GazetteDateLabel1() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "GazetteDateLabel1"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property GazetteNOLabel1() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "GazetteNOLabel1"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property GazettePageLabel1() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "GazettePageLabel1"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property GazetteSectionLabel1() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "GazetteSectionLabel1"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property PersonalRankExportCSVButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalRankExportCSVButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalRankExportExcelButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalRankExportExcelButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalRankImportButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalRankImportButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalRankPagination() As Persons.UI.IPagination + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalRankPagination"), Persons.UI.IPagination) + End Get + End Property + + Public ReadOnly Property PersonalRankPDFButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalRankPDFButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalRankRefreshButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalRankRefreshButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalRankResetButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalRankResetButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalRankTableControlCollapsibleRegion() As System.Web.UI.WebControls.Panel + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalRankTableControlCollapsibleRegion"), System.Web.UI.WebControls.Panel) + End Get + End Property + + Public ReadOnly Property PersonalRankWordButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalRankWordButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PreRankLabel1() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PreRankLabel1"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property RankDateLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RankDateLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property RankIdLabel2() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RankIdLabel2"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property RefDateLabel1() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RefDateLabel1"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property RefLabel2() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RefLabel2"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + +#End Region + +#Region "Helper Functions" + + Public Overrides Overloads Function ModifyRedirectUrl(url As String, arg As String, ByVal bEncrypt As Boolean) As String + Return Me.Page.EvaluateExpressions(url, arg, bEncrypt, Me) + End Function + + Public Overrides Overloads Function EvaluateExpressions(url As String, arg As String, ByVal bEncrypt As Boolean) As String + Dim needToProcess As Boolean = AreAnyUrlParametersForMe(url, arg) + If (needToProcess) Then + Dim recCtl As PersonalRankTableControlRow = Me.GetSelectedRecordControl() + If recCtl Is Nothing AndAlso url.IndexOf("{") >= 0 Then + ' Localization. + Throw New Exception(Page.GetResourceValue("Err:NoRecSelected", "Persons")) + End If + Dim rec As PersonalRankRecord = Nothing + If recCtl IsNot Nothing Then + rec = recCtl.GetRecord() + End If + Return EvaluateExpressions(url, arg, rec, bEncrypt) + End If + Return url + End Function + + Public Overridable Function GetSelectedRecordControl() As PersonalRankTableControlRow + Return Nothing + + End Function + + Public Overridable Function GetSelectedRecordControls() As PersonalRankTableControlRow() + + Return DirectCast((new ArrayList()).ToArray(GetType(PersonalRankTableControlRow)), PersonalRankTableControlRow()) + + End Function + + Public Overridable Sub DeleteSelectedRecords(ByVal deferDeletion As Boolean) + Dim recList() As PersonalRankTableControlRow = Me.GetSelectedRecordControls() + If recList.Length = 0 Then + ' Localization. + Throw New Exception(Page.GetResourceValue("Err:NoRecSelected", "Persons")) + End If + + Dim recCtl As PersonalRankTableControlRow + For Each recCtl In recList + If deferDeletion Then + If Not recCtl.IsNewRecord Then + + Me.AddToDeletedRecordIds(recCtl) + + End If + recCtl.Visible = False + + Else + + recCtl.Delete() + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + End If + Next + End Sub + + Public Function GetRecordControls() As PersonalRankTableControlRow() + Dim recList As ArrayList = New ArrayList() + Dim rep As System.Web.UI.WebControls.Repeater = CType(Me.FindControl("PersonalRankTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return Nothing + Dim repItem As System.Web.UI.WebControls.RepeaterItem + + For Each repItem In rep.Items + + Dim recControl As PersonalRankTableControlRow = DirectCast(repItem.FindControl("PersonalRankTableControlRow"), PersonalRankTableControlRow) + recList.Add(recControl) + + Next + + Return DirectCast(recList.ToArray(GetType(PersonalRankTableControlRow)), PersonalRankTableControlRow()) + End Function + + Public Shadows ReadOnly Property Page() As BaseApplicationPage + Get + Return DirectCast(MyBase.Page, BaseApplicationPage) + End Get + End Property + +#End Region + + + +End Class + + +' Base class for the PersonalSalaryTableControlRow control on the ShowPersonalId page. +' Do not modify this class. Instead override any method in PersonalSalaryTableControlRow. +Public Class BasePersonalSalaryTableControlRow + Inherits Persons.UI.BaseApplicationRecordControl + + ' To customize, override this method in PersonalSalaryTableControlRow. + Protected Overridable Sub Control_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Init + + Me.ClearControlsFromSession() + End Sub + + ' To customize, override this method in PersonalSalaryTableControlRow. + Protected Overridable Sub Control_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load + + 'Call LoadFocusScripts from repeater so that onfocus attribute could be added to elements + Me.Page.LoadFocusScripts(Me) + + + ' Register the event handlers. + + + End Sub + + + Public Overridable Sub LoadData() + + ' Load the data from the database into the DataSource PersonalSalary 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 = PersonalSalaryTable.GetRecord(Me.RecordUniqueId, True) + + Return + End If + + ' Since this is a row in the table, the data for this row is loaded by the + ' LoadData method of the BasePersonalSalaryTableControl when the data for the entire + ' table is loaded. + + Me.DataSource = New PersonalSalaryRecord() + + + + End Sub + + ' Populate the UI controls using the DataSource. To customize, override this method in PersonalSalaryTableControlRow. + 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 + + SetCommandDate2() + SetPositionSalary() + SetSalaryAmout() + SetSalaryCommand() + SetSalaryDate() + SetSalaryExtra_NotUsed() + SetSalaryPlus() + SetSalaryRank() + SetSalaryRound() + SetSalaryStep() + SetSalaryYear() + + + 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 SetCommandDate2() + + + ' Set the CommandDate Literal on the webpage with value from the + ' PersonalSalary database record. + + ' Me.DataSource is the PersonalSalary record retrieved from the database. + ' Me.CommandDate2 is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetCommandDate2() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.CommandDateSpecified Then + + ' If the CommandDate is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalSalaryTable.CommandDate, "d MMM yyyy") + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.CommandDate2.Text = formattedValue + + Else + + ' CommandDate is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.CommandDate2.Text = PersonalSalaryTable.CommandDate.Format(PersonalSalaryTable.CommandDate.DefaultValue, "d MMM yyyy") + + End If + + ' If the CommandDate is NULL or blank, then use the value specified + ' on Properties. + If Me.CommandDate2.Text Is Nothing _ + OrElse Me.CommandDate2.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.CommandDate2.Text = " " + End If + + End Sub + + Public Overridable Sub SetPositionSalary() + + + ' Set the PositionSalary Literal on the webpage with value from the + ' PersonalSalary database record. + + ' Me.DataSource is the PersonalSalary record retrieved from the database. + ' Me.PositionSalary is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetPositionSalary() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.PositionSalarySpecified Then + + ' If the PositionSalary is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalSalaryTable.PositionSalary, "#####") + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.PositionSalary.Text = formattedValue + + Else + + ' PositionSalary is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.PositionSalary.Text = PersonalSalaryTable.PositionSalary.Format(PersonalSalaryTable.PositionSalary.DefaultValue, "#####") + + End If + + ' If the PositionSalary is NULL or blank, then use the value specified + ' on Properties. + If Me.PositionSalary.Text Is Nothing _ + OrElse Me.PositionSalary.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.PositionSalary.Text = " " + End If + + End Sub + + Public Overridable Sub SetSalaryAmout() + + + ' Set the SalaryAmout Literal on the webpage with value from the + ' PersonalSalary database record. + + ' Me.DataSource is the PersonalSalary record retrieved from the database. + ' Me.SalaryAmout is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetSalaryAmout() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.SalaryAmoutSpecified Then + + ' If the SalaryAmout is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalSalaryTable.SalaryAmout, "#,###") + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.SalaryAmout.Text = formattedValue + + Else + + ' SalaryAmout is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.SalaryAmout.Text = PersonalSalaryTable.SalaryAmout.Format(PersonalSalaryTable.SalaryAmout.DefaultValue, "#,###") + + End If + + ' If the SalaryAmout is NULL or blank, then use the value specified + ' on Properties. + If Me.SalaryAmout.Text Is Nothing _ + OrElse Me.SalaryAmout.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.SalaryAmout.Text = " " + End If + + End Sub + + Public Overridable Sub SetSalaryCommand() + + + ' Set the SalaryCommand Literal on the webpage with value from the + ' PersonalSalary database record. + + ' Me.DataSource is the PersonalSalary record retrieved from the database. + ' Me.SalaryCommand is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetSalaryCommand() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.SalaryCommandSpecified Then + + ' If the SalaryCommand is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalSalaryTable.SalaryCommand) + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.SalaryCommand.Text = formattedValue + + Else + + ' SalaryCommand is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.SalaryCommand.Text = PersonalSalaryTable.SalaryCommand.Format(PersonalSalaryTable.SalaryCommand.DefaultValue) + + End If + + ' If the SalaryCommand is NULL or blank, then use the value specified + ' on Properties. + If Me.SalaryCommand.Text Is Nothing _ + OrElse Me.SalaryCommand.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.SalaryCommand.Text = " " + End If + + End Sub + + Public Overridable Sub SetSalaryDate() + + + ' Set the SalaryDate Literal on the webpage with value from the + ' PersonalSalary database record. + + ' Me.DataSource is the PersonalSalary record retrieved from the database. + ' Me.SalaryDate is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetSalaryDate() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.SalaryDateSpecified Then + + ' If the SalaryDate is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalSalaryTable.SalaryDate, "d MMM yyyy") + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.SalaryDate.Text = formattedValue + + Else + + ' SalaryDate is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.SalaryDate.Text = PersonalSalaryTable.SalaryDate.Format(PersonalSalaryTable.SalaryDate.DefaultValue, "d MMM yyyy") + + End If + + ' If the SalaryDate is NULL or blank, then use the value specified + ' on Properties. + If Me.SalaryDate.Text Is Nothing _ + OrElse Me.SalaryDate.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.SalaryDate.Text = " " + End If + + End Sub + + Public Overridable Sub SetSalaryExtra_NotUsed() + + + ' Set the SalaryExtra_NotUsed Literal on the webpage with value from the + ' PersonalSalary database record. + + ' Me.DataSource is the PersonalSalary record retrieved from the database. + ' Me.SalaryExtra_NotUsed is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetSalaryExtra_NotUsed() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.SalaryExtra_NotUsedSpecified Then + + ' If the SalaryExtra_NotUsed is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalSalaryTable.SalaryExtra_NotUsed) + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.SalaryExtra_NotUsed.Text = formattedValue + + Else + + ' SalaryExtra_NotUsed is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.SalaryExtra_NotUsed.Text = PersonalSalaryTable.SalaryExtra_NotUsed.Format(PersonalSalaryTable.SalaryExtra_NotUsed.DefaultValue) + + End If + + ' If the SalaryExtra_NotUsed is NULL or blank, then use the value specified + ' on Properties. + If Me.SalaryExtra_NotUsed.Text Is Nothing _ + OrElse Me.SalaryExtra_NotUsed.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.SalaryExtra_NotUsed.Text = " " + End If + + End Sub + + Public Overridable Sub SetSalaryPlus() + + + ' Set the SalaryPlus Literal on the webpage with value from the + ' PersonalSalary database record. + + ' Me.DataSource is the PersonalSalary record retrieved from the database. + ' Me.SalaryPlus is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetSalaryPlus() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.SalaryPlusSpecified Then + + ' If the SalaryPlus is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalSalaryTable.SalaryPlus, "#####") + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.SalaryPlus.Text = formattedValue + + Else + + ' SalaryPlus is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.SalaryPlus.Text = PersonalSalaryTable.SalaryPlus.Format(PersonalSalaryTable.SalaryPlus.DefaultValue, "#####") + + End If + + ' If the SalaryPlus is NULL or blank, then use the value specified + ' on Properties. + If Me.SalaryPlus.Text Is Nothing _ + OrElse Me.SalaryPlus.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.SalaryPlus.Text = " " + End If + + End Sub + + Public Overridable Sub SetSalaryRank() + + + ' Set the SalaryRank Literal on the webpage with value from the + ' PersonalSalary database record. + + ' Me.DataSource is the PersonalSalary record retrieved from the database. + ' Me.SalaryRank is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetSalaryRank() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.SalaryRankSpecified Then + + ' If the SalaryRank is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalSalaryTable.SalaryRank) + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.SalaryRank.Text = formattedValue + + Else + + ' SalaryRank is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.SalaryRank.Text = PersonalSalaryTable.SalaryRank.Format(PersonalSalaryTable.SalaryRank.DefaultValue) + + End If + + ' If the SalaryRank is NULL or blank, then use the value specified + ' on Properties. + If Me.SalaryRank.Text Is Nothing _ + OrElse Me.SalaryRank.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.SalaryRank.Text = " " + End If + + End Sub + + Public Overridable Sub SetSalaryRound() + + + ' Set the SalaryRound Literal on the webpage with value from the + ' PersonalSalary database record. + + ' Me.DataSource is the PersonalSalary record retrieved from the database. + ' Me.SalaryRound is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetSalaryRound() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.SalaryRoundSpecified Then + + ' If the SalaryRound is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalSalaryTable.SalaryRound) + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.SalaryRound.Text = formattedValue + + Else + + ' SalaryRound is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.SalaryRound.Text = PersonalSalaryTable.SalaryRound.Format(PersonalSalaryTable.SalaryRound.DefaultValue) + + End If + + ' If the SalaryRound is NULL or blank, then use the value specified + ' on Properties. + If Me.SalaryRound.Text Is Nothing _ + OrElse Me.SalaryRound.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.SalaryRound.Text = " " + End If + + End Sub + + Public Overridable Sub SetSalaryStep() + + + ' Set the SalaryStep Literal on the webpage with value from the + ' PersonalSalary database record. + + ' Me.DataSource is the PersonalSalary record retrieved from the database. + ' Me.SalaryStep is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetSalaryStep() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.SalaryStepSpecified Then + + ' If the SalaryStep is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalSalaryTable.SalaryStep) + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.SalaryStep.Text = formattedValue + + Else + + ' SalaryStep is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.SalaryStep.Text = PersonalSalaryTable.SalaryStep.Format(PersonalSalaryTable.SalaryStep.DefaultValue) + + End If + + ' If the SalaryStep is NULL or blank, then use the value specified + ' on Properties. + If Me.SalaryStep.Text Is Nothing _ + OrElse Me.SalaryStep.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.SalaryStep.Text = " " + End If + + End Sub + + Public Overridable Sub SetSalaryYear() + + + ' Set the SalaryYear Literal on the webpage with value from the + ' PersonalSalary database record. + + ' Me.DataSource is the PersonalSalary record retrieved from the database. + ' Me.SalaryYear is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetSalaryYear() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.SalaryYearSpecified Then + + ' If the SalaryYear is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalSalaryTable.SalaryYear) + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.SalaryYear.Text = formattedValue + + Else + + ' SalaryYear is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.SalaryYear.Text = PersonalSalaryTable.SalaryYear.Format(PersonalSalaryTable.SalaryYear.DefaultValue) + + End If + + ' If the SalaryYear is NULL or blank, then use the value specified + ' on Properties. + If Me.SalaryYear.Text Is Nothing _ + OrElse Me.SalaryYear.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.SalaryYear.Text = " " + End If + + End Sub + + + Public EvaluateFormulaDelegate As BaseClasses.Data.DataSource.EvaluateFormulaDelegate = New BaseClasses.Data.DataSource.EvaluateFormulaDelegate(AddressOf Me.EvaluateFormula) + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean, ByVal e As FormulaEvaluator) As String + If e Is Nothing Then + e = New FormulaEvaluator() + End If + + e.Variables.Clear() + + + ' add variables for formula evaluation + If variables IsNot Nothing Then + Dim enumerator As System.Collections.Generic.IEnumerator(Of System.Collections.Generic.KeyValuePair(Of String, Object)) = variables.GetEnumerator() + While enumerator.MoveNext() + e.Variables.Add(enumerator.Current.Key, enumerator.Current.Value) + End While + End If + + If includeDS + + End IF + + + ' Other variables referred to in the formula are expected to be + ' properties of the DataSource. For example, referring to + ' UnitPrice as a variable will refer to DataSource.UnitPrice + If dataSourceForEvaluate Is Nothing Then + + e.DataSource = Me.DataSource + + Else + e.DataSource = dataSourceForEvaluate + End If + + ' Define the calling control. This is used to add other + ' related table and record controls as variables. + e.CallingControl = Me + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + + If Not String.IsNullOrEmpty(format) AndAlso (String.IsNullOrEmpty(formula) OrElse formula.IndexOf("Format(") < 0) Then + Return FormulaUtils.Format(resultObj, format) + Else + Return resultObj.ToString() + End If + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format,variables ,includeDS, Nothing) + End Function + + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object)) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format, variables ,True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, format, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal e as FormulaEvaluator) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, variables, True, e) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal includeDS as Boolean) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, includeDS, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, True, Nothing) + End Function + + + Public Overridable Sub RegisterPostback() + + + End Sub + + + + ' To customize, override this method in PersonalSalaryTableControlRow. + 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 parentCtrl As PersonalIdRecordControl + + + parentCtrl = DirectCast(Me.Page.FindControlRecursively("PersonalIdRecordControl"), PersonalIdRecordControl) + + If (Not IsNothing(parentCtrl) AndAlso IsNothing(parentCtrl.DataSource)) + ' Load the record if it is not loaded yet. + parentCtrl.LoadData() + End If + If (IsNothing(parentCtrl) OrElse IsNothing(parentCtrl.DataSource)) + ' Get the error message from the application resource file. + Throw New Exception(Page.GetResourceValue("Err:NoParentRecId", "Persons")) + End If + + Me.DataSource.PersonalId = parentCtrl.DataSource.PersonalId + + ' 2. Perform any custom validation. + Me.Validate() + + + ' 3. Set the values in the record with data from UI controls. + ' This calls the Get() method for each of the user interface controls. + Me.GetUIData() + + ' 4. Save in the database. + ' We should not save the record if the data did not change. This + ' will save a database hit and avoid triggering any database triggers. + + If Me.DataSource.IsAnyValueChanged Then + ' Save record to database but do not commit yet. + ' Auto generated ids are available after saving for use by child (dependent) records. + Me.DataSource.Save() + + DirectCast(GetParentControlObject(Me, "PersonalSalaryTableControl"), PersonalSalaryTableControl).DataChanged = True + DirectCast(GetParentControlObject(Me, "PersonalSalaryTableControl"), PersonalSalaryTableControl).ResetData = True + End If + + + ' update session or cookie by formula + + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + ' For Master-Detail relationships, save data on the Detail table(s) + + End Sub + + ' To customize, override this method in PersonalSalaryTableControlRow. + 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. + + GetCommandDate2() + GetPositionSalary() + GetSalaryAmout() + GetSalaryCommand() + GetSalaryDate() + GetSalaryExtra_NotUsed() + GetSalaryPlus() + GetSalaryRank() + GetSalaryRound() + GetSalaryStep() + GetSalaryYear() + End Sub + + + Public Overridable Sub GetCommandDate2() + + End Sub + + Public Overridable Sub GetPositionSalary() + + End Sub + + Public Overridable Sub GetSalaryAmout() + + End Sub + + Public Overridable Sub GetSalaryCommand() + + End Sub + + Public Overridable Sub GetSalaryDate() + + End Sub + + Public Overridable Sub GetSalaryExtra_NotUsed() + + End Sub + + Public Overridable Sub GetSalaryPlus() + + End Sub + + Public Overridable Sub GetSalaryRank() + + End Sub + + Public Overridable Sub GetSalaryRound() + + End Sub + + Public Overridable Sub GetSalaryStep() + + End Sub + + Public Overridable Sub GetSalaryYear() + + End Sub + + + ' To customize, override this method in PersonalSalaryTableControlRow. + + Public Overridable Function CreateWhereClause() As WhereClause + + Return Nothing + + End Function + + + + ' To customize, override this method in PersonalSalaryTableControlRow. + 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) + PersonalSalaryTable.DeleteRecord(pkValue) + + DirectCast(GetParentControlObject(Me, "PersonalSalaryTableControl"), PersonalSalaryTableControl).DataChanged = True + DirectCast(GetParentControlObject(Me, "PersonalSalaryTableControl"), PersonalSalaryTableControl).ResetData = True + End Sub + + Protected Overridable Sub Control_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.PreRender + ' PreRender event is raised just before page is being displayed. + Try + DbUtils.StartTransaction() + Me.RegisterPostback() + + If Not Me.Page.ErrorOnPage AndAlso (Me.Page.IsPageRefresh OrElse Me.DataChanged OrElse Me.ResetData) Then + + + ' Re-load the data and update the web page if necessary. + ' This is typically done during a postback (filter, search button, sort, pagination button). + ' In each of the other click handlers, simply set DataChanged to True to reload the data. + Me.LoadData() + Me.DataBind() + End If + + + Catch ex As Exception + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + Finally + DbUtils.EndTransaction() + End Try + End Sub + + + Protected Overrides Sub SaveControlsToSession() + MyBase.SaveControlsToSession() + + + 'Save pagination state to session. + + End Sub + + + + Protected Overrides Sub ClearControlsFromSession() + MyBase.ClearControlsFromSession() + + + + ' Clear pagination state from session. + + End Sub + + Protected Overrides Sub LoadViewState(ByVal savedState As Object) + MyBase.LoadViewState(savedState) + Dim isNewRecord As String = CType(ViewState("IsNewRecord"), String) + If Not isNewRecord Is Nothing AndAlso isNewRecord.Trim <> "" Then + Me.IsNewRecord = Boolean.Parse(isNewRecord) + End If + + Dim myCheckSum As String = CType(ViewState("CheckSum"), String) + If Not myCheckSum Is Nothing AndAlso myCheckSum.Trim <> "" Then + Me.CheckSum = myCheckSum + End If + + + ' Load view state for pagination control. + + End Sub + + Protected Overrides Function SaveViewState() As Object + ViewState("IsNewRecord") = Me.IsNewRecord.ToString() + ViewState("CheckSum") = Me.CheckSum + + + ' Load view state for pagination control. + + Return MyBase.SaveViewState() + End Function + + + + 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("BasePersonalSalaryTableControlRow_Rec"), String) + End Get + Set(ByVal value As String) + Me.ViewState("BasePersonalSalaryTableControlRow_Rec") = value + End Set + End Property + + Private _DataSource As PersonalSalaryRecord + Public Property DataSource() As PersonalSalaryRecord + Get + Return Me._DataSource + End Get + + Set(ByVal value As PersonalSalaryRecord) + + Me._DataSource = value + End Set + End Property + + + + Private _checkSum As String + Public Overridable Property CheckSum() As String + Get + Return Me._checkSum + End Get + Set(ByVal value As String) + Me._checkSum = value + End Set + End Property + + Private _TotalPages As Integer + Public Property TotalPages() As Integer + Get + Return Me._TotalPages + End Get + Set(ByVal value As Integer) + Me._TotalPages = value + End Set + End Property + + Private _PageIndex As Integer + Public Property PageIndex() As Integer + Get + ' Return the PageIndex + Return Me._PageIndex + End Get + Set(ByVal value As Integer) + Me._PageIndex = value + End Set + End Property + + Private _DisplayLastPage As Boolean + Public Property DisplayLastPage() As Boolean + Get + Return Me._DisplayLastPage + End Get + Set(ByVal value As Boolean) + Me._DisplayLastPage = value + End Set + End Property + + + +#Region "Helper Properties" + + Public ReadOnly Property CommandDate2() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "CommandDate2"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property PositionSalary() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PositionSalary"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property SalaryAmout() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "SalaryAmout"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property SalaryCommand() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "SalaryCommand"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property SalaryDate() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "SalaryDate"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property SalaryExtra_NotUsed() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "SalaryExtra_NotUsed"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property SalaryPlus() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "SalaryPlus"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property SalaryRank() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "SalaryRank"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property SalaryRound() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "SalaryRound"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property SalaryStep() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "SalaryStep"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property SalaryYear() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "SalaryYear"), 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 PersonalSalaryRecord = 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 PersonalSalaryRecord + If Not Me.DataSource Is Nothing Then + Return Me.DataSource + End If + + If Not Me.RecordUniqueId Is Nothing Then + + Return PersonalSalaryTable.GetRecord(Me.RecordUniqueId, True) + + End If + + ' Localization. + + Return Nothing + + End Function + + Public Shadows ReadOnly Property Page() As BaseApplicationPage + Get + Return DirectCast(MyBase.Page, BaseApplicationPage) + End Get + End Property + +#End Region + +End Class + + + +' Base class for the PersonalSalaryTableControl control on the ShowPersonalId page. +' Do not modify this class. Instead override any method in PersonalSalaryTableControl. +Public Class BasePersonalSalaryTableControl + Inherits Persons.UI.BaseApplicationTableControl + + + + Protected Overridable Sub Control_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Init + + + + ' Setup the filter and search events. + + + + ' Control Initializations. + ' Initialize the table's current sort order. + + If Me.InSession(Me, "Order_By") Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + Me.CurrentSortOrder.Add(PersonalSalaryTable.SalaryDate, OrderByItem.OrderDir.Asc) + + Me.CurrentSortOrder.Add(PersonalSalaryTable.CommandDate, OrderByItem.OrderDir.Asc) + + End If + + + + ' Setup default pagination settings. + + Me.PageSize = CInt(Me.GetFromSession(Me, "Page_Size", "10")) + Me.PageIndex = CInt(Me.GetFromSession(Me, "Page_Index", "0")) + + + + Me.ClearControlsFromSession() + End Sub + + Protected Overridable Sub Control_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load + + SaveControlsToSession_Ajax() + + ' Setup the pagination events. + + AddHandler Me.PersonalSalaryPagination.FirstPage.Click, AddressOf PersonalSalaryPagination_FirstPage_Click + + AddHandler Me.PersonalSalaryPagination.LastPage.Click, AddressOf PersonalSalaryPagination_LastPage_Click + + AddHandler Me.PersonalSalaryPagination.NextPage.Click, AddressOf PersonalSalaryPagination_NextPage_Click + + AddHandler Me.PersonalSalaryPagination.PageSizeButton.Click, AddressOf PersonalSalaryPagination_PageSizeButton_Click + + AddHandler Me.PersonalSalaryPagination.PreviousPage.Click, AddressOf PersonalSalaryPagination_PreviousPage_Click + + + ' Setup the sorting events. + + AddHandler Me.CommandDateLabel2.Click, AddressOf CommandDateLabel2_Click + + AddHandler Me.PositionSalaryLabel.Click, AddressOf PositionSalaryLabel_Click + + AddHandler Me.SalaryAmoutLabel.Click, AddressOf SalaryAmoutLabel_Click + + AddHandler Me.SalaryCommandLabel.Click, AddressOf SalaryCommandLabel_Click + + AddHandler Me.SalaryDateLabel1.Click, AddressOf SalaryDateLabel1_Click + + AddHandler Me.SalaryExtra_NotUsedLabel.Click, AddressOf SalaryExtra_NotUsedLabel_Click + + AddHandler Me.SalaryPlusLabel.Click, AddressOf SalaryPlusLabel_Click + + AddHandler Me.SalaryRankLabel1.Click, AddressOf SalaryRankLabel1_Click + + AddHandler Me.SalaryRoundLabel.Click, AddressOf SalaryRoundLabel_Click + + AddHandler Me.SalaryStepLabel.Click, AddressOf SalaryStepLabel_Click + + AddHandler Me.SalaryYearLabel.Click, AddressOf SalaryYearLabel_Click + + ' Setup the button events. + + AddHandler Me.PersonalSalaryExportCSVButton.Click, AddressOf PersonalSalaryExportCSVButton_Click + + AddHandler Me.PersonalSalaryExportExcelButton.Click, AddressOf PersonalSalaryExportExcelButton_Click + + Me.PersonalSalaryImportButton.PostBackUrl = "../Shared/SelectFileToImport.aspx?TableName=PersonalSalary" + Me.PersonalSalaryImportButton.Attributes.Item("onClick") = "window.open('" & Me.Page.EncryptUrlParameter(Me.PersonalSalaryImportButton.PostBackUrl) & "','importWindow', 'width=700, height=500,top=' +(screen.availHeight-500)/2 + ',left=' + (screen.availWidth-700)/2+ ', resizable=yes, scrollbars=yes,modal=yes'); return false;" + + AddHandler Me.PersonalSalaryImportButton.Click, AddressOf PersonalSalaryImportButton_Click + + AddHandler Me.PersonalSalaryPDFButton.Click, AddressOf PersonalSalaryPDFButton_Click + + AddHandler Me.PersonalSalaryRefreshButton.Click, AddressOf PersonalSalaryRefreshButton_Click + + AddHandler Me.PersonalSalaryResetButton.Click, AddressOf PersonalSalaryResetButton_Click + + AddHandler Me.PersonalSalaryWordButton.Click, AddressOf PersonalSalaryWordButton_Click + + + ' Setup events for others + + End Sub + + + Public Overridable Sub LoadData() + + ' Read data from database. Returns an array of records that can be assigned + ' to the DataSource table control property. + Try + Dim joinFilter As CompoundFilter = CreateCompoundJoinFilter() + + ' The WHERE clause will be empty when displaying all records in table. + Dim wc As WhereClause = CreateWhereClause() + If wc IsNot Nothing AndAlso Not wc.RunQuery Then + ' Initialize an empty array of records + Dim alist As New ArrayList(0) + Me.DataSource = DirectCast(alist.ToArray(GetType(PersonalSalaryRecord)), PersonalSalaryRecord()) + ' Add records to the list if needed. + Me.AddNewRecords() + Me._TotalRecords = 0 + Me._TotalPages = 0 + Return + End If + + ' Call OrderBy to determine the order - either use the order defined + ' on the Query Wizard, or specified by user (by clicking on column heading) + Dim orderBy As OrderBy = CreateOrderBy() + + ' Get the pagesize from the pagesize control. + Me.GetPageSize() + + If Me.DisplayLastPage Then + Dim totalRecords As Integer = If(Me._TotalRecords < 0, PersonalSalaryTable.GetRecordCount(CreateCompoundJoinFilter(), CreateWhereClause()), Me._TotalRecords) + + Dim totalPages As Integer = CInt(Math.Ceiling(totalRecords / Me.PageSize)) + + Me.PageIndex = totalPages - 1 + End If + + ' Make sure PageIndex (current page) and PageSize are within bounds. + If Me.PageIndex < 0 Then + Me.PageIndex = 0 + End If + If Me.PageSize < 1 Then + Me.PageSize = 1 + End If + + ' Retrieve the records and set the table DataSource. + ' Only PageSize records are fetched starting at PageIndex (zero based). + If Me.AddNewRecord > 0 Then + ' Make sure to preserve the previously entered data on new rows. + Dim postdata As New ArrayList + For Each rc As PersonalSalaryTableControlRow In Me.GetRecordControls() + If Not rc.IsNewRecord Then + rc.DataSource = rc.GetRecord() + rc.GetUIData() + postdata.Add(rc.DataSource) + UIData.Add(rc.PreservedUIData()) + End If + Next + Me.DataSource = DirectCast(postdata.ToArray(GetType(PersonalSalaryRecord)), PersonalSalaryRecord()) + Else ' Get the records from the database + Me.DataSource = PersonalSalaryTable.GetRecords(joinFilter, wc, orderBy, Me.PageIndex, Me.PageSize) + + End If + + ' if the datasource contains no records contained in database, then load the last page. + If (DbUtils.GetCreatedRecords(Me.DataSource).Length = 0 AndAlso Not Me.DisplayLastPage) Then + Me.DisplayLastPage = True + LoadData() + Else + + ' Add any new rows desired by the user. + Me.AddNewRecords() + + + ' Initialize the page and grand totals. now + + End If + + Catch ex As Exception + ' Report the error message to the end user + Dim msg As String = ex.Message + If ex.InnerException IsNot Nothing Then + msg = msg & " InnerException: " & ex.InnerException.Message + End If + Throw New Exception(msg, ex.InnerException) + End Try + End Sub + + + + + Public Overrides Sub DataBind() + ' The DataBind method binds the user interface controls to the values + ' from the database record for each row in the table. To do this, it calls the + ' DataBind for each of the rows. + ' DataBind also populates any filters above the table, and sets the pagination + ' control to the correct number of records and the current page number. + + MyBase.DataBind() + + ' Make sure that the DataSource is initialized. + If Me.DataSource Is Nothing Then + Return + End If + + 'LoadData for DataSource for chart and report if they exist + + ' Setup the pagination controls. + BindPaginationControls() + + + + ' Bind the repeater with the list of records to expand the UI. + Dim rep As System.Web.UI.WebControls.Repeater = CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalSalaryTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return + rep.DataSource = DataSource() + rep.DataBind() + + Dim index As Integer = 0 + For Each repItem As System.Web.UI.WebControls.RepeaterItem In rep.Items + ' Loop through all rows in the table, set its DataSource and call DataBind(). + Dim recControl As PersonalSalaryTableControlRow = DirectCast(repItem.FindControl("PersonalSalaryTableControlRow"), PersonalSalaryTableControlRow) + recControl.DataSource = Me.DataSource(index) + If Me.UIData.Count > index Then + recControl.PreviousUIData = Me.UIData(index) + End If + recControl.DataBind() + recControl.Visible = Not Me.InDeletedRecordIds(recControl) + + index += 1 + Next + + + + + ' Call the Set methods for each controls on the panel + + SetCommandDateLabel2() + + + + + + + + SetPersonalSalaryTableControlCollapsibleRegion() + + SetPositionSalaryLabel() + SetSalaryAmoutLabel() + SetSalaryCommandLabel() + SetSalaryDateLabel1() + SetSalaryExtra_NotUsedLabel() + SetSalaryPlusLabel() + SetSalaryRankLabel1() + SetSalaryRoundLabel() + SetSalaryStepLabel() + SetSalaryYearLabel() + ' setting the state of expand or collapse alternative rows + + + ' Load data for each record and table UI control. + ' Ordering is important because child controls get + ' their parent ids from their parent UI controls. + + + ' this method calls the set method for controls with special formula like running total, sum, rank, etc + SetFormulaControls() + End Sub + + Public Overridable Sub SetFormulaControls() + ' this method calls Set methods for the control that has special formula + + + + End Sub + + + + Public Overridable Sub RegisterPostback() + + Me.Page.RegisterPostBackTrigger(MiscUtils.FindControlRecursively(Me,"PersonalSalaryExportCSVButton")) + + Me.Page.RegisterPostBackTrigger(MiscUtils.FindControlRecursively(Me,"PersonalSalaryExportExcelButton")) + + Me.Page.RegisterPostBackTrigger(MiscUtils.FindControlRecursively(Me,"PersonalSalaryPDFButton")) + + Me.Page.RegisterPostBackTrigger(MiscUtils.FindControlRecursively(Me,"PersonalSalaryWordButton")) + + + End Sub + + Public EvaluateFormulaDelegate As BaseClasses.Data.DataSource.EvaluateFormulaDelegate = New BaseClasses.Data.DataSource.EvaluateFormulaDelegate(AddressOf Me.EvaluateFormula) + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean, ByVal e as FormulaEvaluator) As String + If e Is Nothing + e = New FormulaEvaluator() + End If + + e.Variables.Clear() + + + ' add variables for formula evaluation + If variables IsNot Nothing Then + Dim enumerator As System.Collections.Generic.IEnumerator(Of System.Collections.Generic.KeyValuePair(Of String, Object)) = variables.GetEnumerator() + While enumerator.MoveNext() + e.Variables.Add(enumerator.Current.Key, enumerator.Current.Value) + End While + End If + + If includeDS + + End If + + ' All variables referred to in the formula are expected to be + ' properties of the DataSource. For example, referring to + ' UnitPrice as a variable will refer to DataSource.UnitPrice + e.DataSource = dataSourceForEvaluate + + ' Define the calling control. This is used to add other + ' related table and record controls as variables. + e.CallingControl = Me + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + + If Not String.IsNullOrEmpty(format) AndAlso (String.IsNullOrEmpty(formula) OrElse formula.IndexOf("Format(") < 0) Then + Return FormulaUtils.Format(resultObj, format) + Else + Return resultObj.ToString() + End If + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format,variables ,includeDS, Nothing) + End Function + + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object)) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format, variables ,True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, format, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal e as FormulaEvaluator) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, variables, True, e) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal includeDS as Boolean) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, includeDS, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, True, Nothing) + End Function + + + + + Public Overridable Sub ResetControl() + + Me.CurrentSortOrder.Reset() + If (Me.InSession(Me, "Order_By")) Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + Me.CurrentSortOrder.Add(PersonalSalaryTable.SalaryDate, OrderByItem.OrderDir.Asc) + + Me.CurrentSortOrder.Add(PersonalSalaryTable.CommandDate, OrderByItem.OrderDir.Asc) + + End If + + Me.PageIndex = 0 + End Sub + + Protected Overridable Sub BindPaginationControls() + ' Setup the pagination controls. + + ' Bind the pagination labels. + + If DbUtils.GetCreatedRecords(Me.DataSource).Length > 0 Then + + Me.PersonalSalaryPagination.CurrentPage.Text = (Me.PageIndex + 1).ToString() + Else + Me.PersonalSalaryPagination.CurrentPage.Text = "0" + End If + Me.PersonalSalaryPagination.PageSize.Text = Me.PageSize.ToString() + Me.PersonalSalaryPagination.TotalItems.Text = Me.TotalRecords.ToString() + Me.PersonalSalaryPagination.TotalPages.Text = Me.TotalPages.ToString() + + ' Bind the buttons for PersonalSalaryTableControl pagination. + + Me.PersonalSalaryPagination.FirstPage.Enabled = Not (Me.PageIndex = 0) + If Me._TotalPages < 0 Then ' if the total pages is not determined yet, enable last and next buttons + Me.PersonalSalaryPagination.LastPage.Enabled = True + ElseIf Me._TotalPages = 0 ' if the total pages is determined and it is 0, enable last and next buttons + Me.PersonalSalaryPagination.LastPage.Enabled = False + Else ' if the total pages is the last page, disable last and next buttons + Me.PersonalSalaryPagination.LastPage.Enabled = Not (Me.PageIndex = Me.TotalPages - 1) + End If + + If Me._TotalPages < 0 Then ' if the total pages is not determined yet, enable last and next buttons + Me.PersonalSalaryPagination.NextPage.Enabled = True + ElseIf Me._TotalPages = 0 ' if the total pages is determined and it is 0, enable last and next buttons + Me.PersonalSalaryPagination.NextPage.Enabled = False + Else ' if the total pages is the last page, disable last and next buttons + Me.PersonalSalaryPagination.NextPage.Enabled = Not (Me.PageIndex = Me.TotalPages - 1) + End If + + Me.PersonalSalaryPagination.PreviousPage.Enabled = Not (Me.PageIndex = 0) + + + End Sub + + Public Overridable Sub SaveData() + ' Save the data from the entire table. Calls each row's Save Data + ' to save their data. This function is called by the Click handler of the + ' Save button. The button handler should Start/Commit/End a transaction. + + Dim recCtl As PersonalSalaryTableControlRow + For Each recCtl In Me.GetRecordControls() + + If Me.InDeletedRecordIds(recCtl) Then + ' Delete any pending deletes. + recCtl.Delete() + Else + If recCtl.Visible Then + recCtl.SaveData() + End If + End If + + Next + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + ' Set IsNewRecord to False for all records - since everything has been saved and is no longer "new" + For Each recCtl In Me.GetRecordControls() + recCtl.IsNewRecord = False + Next + + + ' Set DeletedRecordsIds to Nothing since we have deleted all pending deletes. + Me.DeletedRecordIds = Nothing + + End Sub + + Public Overridable Function CreateCompoundJoinFilter() As CompoundFilter + Dim jFilter As CompoundFilter = New CompoundFilter() + + Return jFilter + + End Function + + + Public Overridable Function CreateOrderBy() As OrderBy + ' The CurrentSortOrder is initialized to the sort order on the + ' Query Wizard. It may be modified by the Click handler for any of + ' the column heading to sort or reverse sort by that column. + ' You can add your own sort order, or modify it on the Query Wizard. + Return Me.CurrentSortOrder + End Function + + Public Overridable Function CreateWhereClause() As WhereClause + 'This CreateWhereClause is used for loading the data. + PersonalSalaryTable.Instance.InnerFilter = Nothing + Dim wc As WhereClause = New WhereClause() + + ' Compose the WHERE clause consiting of: + ' 1. Static clause defined at design time. + ' 2. User selected search criteria. + ' 3. User selected filter criteria. + + + Dim selectedRecordKeyValue as KeyValue = New KeyValue() + + Dim personalIdRecordControlObj As Persons.UI.Controls.ShowPersonalId.PersonalIdRecordControl = DirectCast(MiscUtils.FindControlRecursively(Me.Page, "PersonalIdRecordControl"), Persons.UI.Controls.ShowPersonalId.PersonalIdRecordControl) + + If (Not IsNothing(personalIdRecordControlObj) AndAlso Not IsNothing(personalIdRecordControlObj.GetRecord()) AndAlso personalIdRecordControlObj.GetRecord().IsCreated AndAlso Not IsNothing(personalIdRecordControlObj.GetRecord().PersonalId)) + wc.iAND(PersonalSalaryTable.PersonalId, BaseFilter.ComparisonOperator.EqualsTo, personalIdRecordControlObj.GetRecord().PersonalId.ToString()) + selectedRecordKeyValue.AddElement(PersonalSalaryTable.PersonalId.InternalName, personalIdRecordControlObj.GetRecord().PersonalId.ToString()) + Else + wc.RunQuery = False + Return wc + End If + + HttpContext.Current.Session("PersonalSalaryTableControlWhereClause") = selectedRecordKeyValue.ToXmlString() + + Return wc + End Function + + + Public Overridable Function CreateWhereClause(ByVal searchText as String, ByVal fromSearchControl as String, ByVal AutoTypeAheadSearch as String, ByVal AutoTypeAheadWordSeparators as String) As WhereClause + ' This CreateWhereClause is used for loading list of suggestions for Auto Type-Ahead feature. + PersonalSalaryTable.Instance.InnerFilter = Nothing + Dim wc As WhereClause = New WhereClause() + + ' Compose the WHERE clause consiting of: + ' 1. Static clause defined at design time. + ' 2. User selected search criteria. + ' 3. User selected filter criteria. + + Dim appRelativeVirtualPath As String = CType(HttpContext.Current.Session("AppRelativeVirtualPath"), String) + + Dim selectedRecordInPersonalIdRecordControl as String = DirectCast(HttpContext.Current.Session("PersonalSalaryTableControlWhereClause"), String) + + If Not selectedRecordInPersonalIdRecordControl Is Nothing AndAlso KeyValue.IsXmlKey(selectedRecordInPersonalIdRecordControl) Then + Dim selectedRecordKeyValue as KeyValue = KeyValue.XmlToKey(selectedRecordInPersonalIdRecordControl) + + If Not IsNothing(selectedRecordKeyValue) AndAlso selectedRecordKeyValue.ContainsColumn(PersonalSalaryTable.PersonalId) Then + wc.iAND(PersonalSalaryTable.PersonalId, BaseFilter.ComparisonOperator.EqualsTo, selectedRecordKeyValue.GetColumnValue(PersonalSalaryTable.PersonalId).ToString()) + End If + + End If + + ' Adds clauses if values are selected in Filter controls which are configured in the page. + + + Return wc + End Function + + + Public Overridable Function FormatSuggestions(ByVal prefixText As String, ByVal resultItem As String, _ + ByVal columnLength As Integer, ByVal AutoTypeAheadDisplayFoundText As String, _ + ByVal autoTypeAheadSearch As String, ByVal AutoTypeAheadWordSeparators As String, _ + ByVal resultList As ArrayList) As Boolean + + 'Formats the resultItem and adds it to the list of suggestions. + Dim index As Integer = resultItem.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture).IndexOf(prefixText.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture)) + Dim itemToAdd As String = "" + Dim isFound As Boolean = False + Dim isAdded As Boolean = False + ' Get the index where prfixt is at the beginning of resultItem. If not found then, index of word which begins with prefixText. + If InvariantLCase(autoTypeAheadSearch).equals("wordsstartingwithsearchstring") And Not index = 0 Then + ' Expression to find word which contains AutoTypeAheadWordSeparators followed by prefixText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex( AutoTypeAheadWordSeparators + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + If regex1.IsMatch(resultItem) Then + index = regex1.Match(resultItem).Index + isFound = True + End If + ' If the prefixText is found immediatly after white space then starting of the word is found so don not search any further + If not resultItem(index).ToString() = " " Then + ' Expression to find beginning of the word which contains AutoTypeAheadWordSeparators followed by prefixText + Dim regex As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\\S*" + AutoTypeAheadWordSeparators + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + If regex.IsMatch(resultItem) Then + index = regex.Match(resultItem).Index + isFound = True + End If + End If + End If + + ' If autoTypeAheadSearch value is wordsstartingwithsearchstring then, extract the substring only if the prefixText is found at the + ' beginning of the resultItem (index = 0) or a word in resultItem is found starts with prefixText. + If index = 0 Or isFound Or InvariantLCase(autoTypeAheadSearch).Equals("anywhereinstring") then + If InvariantLCase(AutoTypeAheadDisplayFoundText).equals("atbeginningofmatchedstring") Then + ' Expression to find beginning of the word which contains prefixText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\\S*" + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + ' Find the beginning of the word which contains prefexText + If (StringUtils.InvariantLCase(autoTypeAheadSearch).Equals("anywhereinstring") AndAlso regex1.IsMatch(resultItem)) Then + index = regex1.Match(resultItem).Index + isFound = True + End If + ' Display string from the index till end of the string if sub string from index till end is less than columnLength value. + If Len(resultItem) - index <= columnLength Then + If index = 0 Then + itemToAdd = resultItem + Else + itemToAdd = "..." & resultItem.Substring(index, Len(resultItem) - index) + End If + Else + If index = 0 Then + itemToAdd = resultItem.Substring(index, (columnLength - 3)) & "..." + Else + 'Truncate the string to show only columnLength - 6 characters as begining and trailing "..." has to be appended. + itemToAdd = "..." & resultItem.Substring(index , columnLength - 6) & "..." + End If + End If + ElseIf InvariantLCase(AutoTypeAheadDisplayFoundText).equals("inmiddleofmatchedstring") Then + Dim subStringBeginIndex As Integer = CType(columnLength/2, Integer) + If Len(resultItem) <= columnLength Then + itemToAdd = resultItem + Else + ' Sanity check at end of the string + If index + Len(prefixText) = columnLength Then + itemToAdd = "..." & resultItem.Substring(index-columnLength,index) + ElseIf Len(resultItem) - index < subStringBeginIndex Then + ' Display string from the end till columnLength value if, index is closer to the end of the string. + itemToAdd = "..." & resultItem.Substring(Len(resultItem)-columnLength,Len(resultItem)) + ElseIf index <= subStringBeginIndex Then + ' Sanity chet at beginning of the string + itemToAdd = resultItem.Substring(0, columnLength) & "..." + Else + ' Display string containing text before the prefixText occures and text after the prefixText + itemToAdd = "..." & resultItem.Substring(index - subStringBeginIndex, columnLength) & "..." + End If + End If + ElseIf InvariantLCase(AutoTypeAheadDisplayFoundText).equals("atendofmatchedstring") Then + ' Expression to find ending of the word which contains prefexText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\s", System.Text.RegularExpressions.RegexOptions.IgnoreCase) + ' Find the ending of the word which contains prefexText + If regex1.IsMatch(resultItem, index + 1) Then + index = regex1.Match(resultItem, index + 1).Index + Else + ' If the word which contains prefexText is the last word in string, regex1.IsMatch returns false. + index = resultItem.Length + End If + If index > Len(resultItem) Then + index = Len(resultItem) + End If + ' If text from beginning of the string till index is less than columnLength value then, display string from the beginning till index. + If index <= columnLength Then + if index = Len(resultItem) Then 'Make decision to append "..." + itemToAdd = resultItem.Substring(0,index) + Else + itemToAdd = resultItem.Substring(0,index) & "..." + End If + Else + If index = Len(resultItem) Then + itemToAdd = "..." & resultItem.Substring(index - (columnLength - 3), (columnLength - 3)) + Else + 'Truncate the string to show only columnLength - 6 characters as begining and trailing "..." has to be appended. + itemToAdd = "..." & resultItem.Substring(index - (columnLength - 6), columnLength - 6) & "..." + End If + End If + End If + + ' Remove newline character from itemToAdd + Dim prefixTextIndex As Integer = itemToAdd.IndexOf(prefixText, StringComparison.CurrentCultureIgnoreCase) + ' If itemToAdd contains any newline after the search text then show text only till newline + Dim regex2 As System.Text.RegularExpressions.Regex = New System.Text.RegularExpressions.Regex("(" & vbCrLf & "|" & vbLf & ")", System.Text.RegularExpressions.RegexOptions.IgnoreCase) + Dim newLineIndexAfterPrefix As Integer = -1 + If regex2.IsMatch(itemToAdd, prefixTextIndex) Then + newLineIndexAfterPrefix = regex2.Match(itemToAdd, prefixTextIndex).Index + End If + If (newLineIndexAfterPrefix > -1) Then + If itemToAdd.EndsWith("...") Then + itemToAdd = (itemToAdd.Substring(0, newLineIndexAfterPrefix) + "...") + Else + itemToAdd = itemToAdd.Substring(0, newLineIndexAfterPrefix) + End If + End If + ' If itemToAdd contains any newline before search text then show text which comes after newline + Dim regex3 As System.Text.RegularExpressions.Regex = New System.Text.RegularExpressions.Regex("(" & vbCrLf & "|" & vbLf & ")", (System.Text.RegularExpressions.RegexOptions.IgnoreCase Or System.Text.RegularExpressions.RegexOptions.RightToLeft)) + Dim newLineIndexBeforePrefix As Integer = -1 + If regex3.IsMatch(itemToAdd, prefixTextIndex) Then + newLineIndexBeforePrefix = regex3.Match(itemToAdd, prefixTextIndex).Index + End If + If (newLineIndexBeforePrefix > -1) Then + If itemToAdd.StartsWith("...") Then + itemToAdd = ("..." + itemToAdd.Substring((newLineIndexBeforePrefix + regex3.Match(itemToAdd, prefixTextIndex).Length))) + Else + itemToAdd = itemToAdd.Substring((newLineIndexBeforePrefix + regex3.Match(itemToAdd, prefixTextIndex).Length)) + End If + End If + + If Not itemToAdd is nothing AndAlso Not resultList.Contains(itemToAdd) Then + + resultList.Add(itemToAdd) + + isAdded = true + End If + End If + Return isAdded + End Function + + + Protected Overridable Sub GetPageSize() + + If Me.PersonalSalaryPagination.PageSize.Text.Trim <> "" Then + Try + 'Me.PageSize = Integer.Parse(Me.PersonalSalaryPagination.PageSize.Text) + Catch ex As Exception + End Try + End If + End Sub + + Protected Overridable Sub AddNewRecords() + + Dim newRecordList As ArrayList = New ArrayList() + + Dim newUIDataList As System.Collections.Generic.List(Of Hashtable) = New System.Collections.Generic.List(Of Hashtable)() + + ' Loop though all the record controls and if the record control + ' does not have a unique record id set, then create a record + ' and add to the list. + If Not Me.ResetData Then + Dim rep As System.Web.UI.WebControls.Repeater = CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalSalaryTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return + + Dim repItem As System.Web.UI.WebControls.RepeaterItem + For Each repItem In rep.Items + ' Loop through all rows in the table, set its DataSource and call DataBind(). + + Dim recControl As PersonalSalaryTableControlRow = DirectCast(repItem.FindControl("PersonalSalaryTableControlRow"), PersonalSalaryTableControlRow) + + If recControl.Visible AndAlso recControl.IsNewRecord() Then + + Dim rec As PersonalSalaryRecord = New PersonalSalaryRecord() + + If recControl.CommandDate2.Text <> "" Then + rec.Parse(recControl.CommandDate2.Text, PersonalSalaryTable.CommandDate) + End If + If recControl.PositionSalary.Text <> "" Then + rec.Parse(recControl.PositionSalary.Text, PersonalSalaryTable.PositionSalary) + End If + If recControl.SalaryAmout.Text <> "" Then + rec.Parse(recControl.SalaryAmout.Text, PersonalSalaryTable.SalaryAmout) + End If + If recControl.SalaryCommand.Text <> "" Then + rec.Parse(recControl.SalaryCommand.Text, PersonalSalaryTable.SalaryCommand) + End If + If recControl.SalaryDate.Text <> "" Then + rec.Parse(recControl.SalaryDate.Text, PersonalSalaryTable.SalaryDate) + End If + If recControl.SalaryExtra_NotUsed.Text <> "" Then + rec.Parse(recControl.SalaryExtra_NotUsed.Text, PersonalSalaryTable.SalaryExtra_NotUsed) + End If + If recControl.SalaryPlus.Text <> "" Then + rec.Parse(recControl.SalaryPlus.Text, PersonalSalaryTable.SalaryPlus) + End If + If recControl.SalaryRank.Text <> "" Then + rec.Parse(recControl.SalaryRank.Text, PersonalSalaryTable.SalaryRank) + End If + If recControl.SalaryRound.Text <> "" Then + rec.Parse(recControl.SalaryRound.Text, PersonalSalaryTable.SalaryRound) + End If + If recControl.SalaryStep.Text <> "" Then + rec.Parse(recControl.SalaryStep.Text, PersonalSalaryTable.SalaryStep) + End If + If recControl.SalaryYear.Text <> "" Then + rec.Parse(recControl.SalaryYear.Text, PersonalSalaryTable.SalaryYear) + End If + newUIDataList.Add(recControl.PreservedUIData()) + newRecordList.Add(rec) + End If + Next + End If + + + ' Add any new record to the list. + Dim index As Integer = 0 + For index = 1 To Me.AddNewRecord + + newRecordList.Insert(0, New PersonalSalaryRecord()) + newUIDataList.Insert(0, New Hashtable()) + + Next + Me.AddNewRecord = 0 + + ' Finally, add any new records to the DataSource. + If newRecordList.Count > 0 Then + + Dim finalList As ArrayList = New ArrayList(Me.DataSource) + finalList.InsertRange(0, newRecordList) + + Me.DataSource = DirectCast(finalList.ToArray(GetType(PersonalSalaryRecord)), PersonalSalaryRecord()) + + End If + + ' Add the existing UI data to this hash table + If newUIDataList.Count > 0 Then + Me.UIData.InsertRange(0, newUIDataList) + End If + + End Sub + + + Public Sub AddToDeletedRecordIds(ByVal rec As PersonalSalaryTableControlRow) + If rec.IsNewRecord() Then + Return + End If + + If Not Me.DeletedRecordIds Is Nothing AndAlso Me.DeletedRecordIds.Trim <> "" Then + Me.DeletedRecordIds &= "," + End If + + Me.DeletedRecordIds &= "[" & rec.RecordUniqueId & "]" + End Sub + + Protected Overridable Function InDeletedRecordIds(ByVal rec As PersonalSalaryTableControlRow) As Boolean + If Me.DeletedRecordIds Is Nothing OrElse Me.DeletedRecordIds.Trim = "" Then + Return False + End If + + Return Me.DeletedRecordIds.IndexOf("[" & rec.RecordUniqueId & "]") >= 0 + End Function + + Private _DeletedRecordIds As String + Public Property DeletedRecordIds() As String + Get + Return Me._DeletedRecordIds + End Get + Set(ByVal value As String) + Me._DeletedRecordIds = value + End Set + End Property + + + ' Create Set, WhereClause, and Populate Methods + + Public Overridable Sub SetCommandDateLabel2() + + End Sub + + Public Overridable Sub SetPersonalSalaryTableControlCollapsibleRegion() + + End Sub + + Public Overridable Sub SetPositionSalaryLabel() + + End Sub + + Public Overridable Sub SetSalaryAmoutLabel() + + End Sub + + Public Overridable Sub SetSalaryCommandLabel() + + End Sub + + Public Overridable Sub SetSalaryDateLabel1() + + End Sub + + Public Overridable Sub SetSalaryExtra_NotUsedLabel() + + End Sub + + Public Overridable Sub SetSalaryPlusLabel() + + End Sub + + Public Overridable Sub SetSalaryRankLabel1() + + End Sub + + Public Overridable Sub SetSalaryRoundLabel() + + End Sub + + Public Overridable Sub SetSalaryStepLabel() + + End Sub + + Public Overridable Sub SetSalaryYearLabel() + + End Sub + + + + + Protected Overridable Sub Control_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.PreRender + ' PreRender event is raised just before page is being displayed. + Try + DbUtils.StartTransaction + Me.RegisterPostback() + + If Not Me.Page.ErrorOnPage AndAlso (Me.Page.IsPageRefresh OrElse Me.DataChanged OrElse Me.ResetData) Then + + + ' Re-load the data and update the web page if necessary. + ' This is typically done during a postback (filter, search button, sort, pagination button). + ' In each of the other click handlers, simply set DataChanged to True to reload the data. + + Me.LoadData() + Me.DataBind() + + End If + + + + Catch ex As Exception + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + Finally + DbUtils.EndTransaction + End Try + End Sub + + + Protected Overrides Sub SaveControlsToSession() + MyBase.SaveControlsToSession() + + ' Save filter controls to values to session. + + + 'Save pagination state to session. + + + + ' Save table control properties to the session. + If Not Me.CurrentSortOrder Is Nothing Then + Me.SaveToSession(Me, "Order_By", Me.CurrentSortOrder.ToXmlString()) + End If + + Me.SaveToSession(Me, "Page_Index", Me.PageIndex.ToString()) + Me.SaveToSession(Me, "Page_Size", Me.PageSize.ToString()) + + Me.SaveToSession(Me, "DeletedRecordIds", Me.DeletedRecordIds) + + End Sub + + Protected Sub SaveControlsToSession_Ajax() + ' Save filter controls to values to session. + + HttpContext.Current.Session("AppRelativeVirtualPath") = Me.Page.AppRelativeVirtualPath + + End Sub + + Protected Overrides Sub ClearControlsFromSession() + MyBase.ClearControlsFromSession() + + ' Clear filter controls values from the session. + + + ' Clear pagination state from session. + + + + ' Clear table properties from the session. + Me.RemoveFromSession(Me, "Order_By") + Me.RemoveFromSession(Me, "Page_Index") + Me.RemoveFromSession(Me, "Page_Size") + + Me.RemoveFromSession(Me, "DeletedRecordIds") + + End Sub + + Protected Overrides Sub LoadViewState(ByVal savedState As Object) + MyBase.LoadViewState(savedState) + + Dim orderByStr As String = CType(ViewState("PersonalSalaryTableControl_OrderBy"), String) + + If orderByStr IsNot Nothing AndAlso orderByStr.Trim <> "" Then + Me.CurrentSortOrder = BaseClasses.Data.OrderBy.FromXmlString(orderByStr) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + End If + + Dim pageIndex As String = CType(ViewState("Page_Index"), String) + If pageIndex IsNot Nothing Then + Me.PageIndex = CInt(pageIndex) + End If + + Dim pageSize As String = CType(ViewState("Page_Size"), String) + If Not pageSize Is Nothing Then + Me.PageSize = CInt(pageSize) + End If + + + + ' Load view state for pagination control. + + Me.DeletedRecordIds = CType(Me.ViewState("DeletedRecordIds"), String) + + End Sub + + Protected Overrides Function SaveViewState() As Object + + If Me.CurrentSortOrder IsNot Nothing Then + Me.ViewState("PersonalSalaryTableControl_OrderBy") = Me.CurrentSortOrder.ToXmlString() + End If + + Me.ViewState("Page_Index") = Me.PageIndex + Me.ViewState("Page_Size") = Me.PageSize + + Me.ViewState("DeletedRecordIds") = Me.DeletedRecordIds + + + ' Load view state for pagination control. + + + Return MyBase.SaveViewState() + End Function + + ' Generate the event handling functions for pagination events. + + ' event handler for ImageButton + Public Overridable Sub PersonalSalaryPagination_FirstPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.PageIndex = 0 + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalSalaryPagination_LastPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.DisplayLastPage = True + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalSalaryPagination_NextPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.PageIndex += 1 + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for LinkButton + Public Overridable Sub PersonalSalaryPagination_PageSizeButton_Click(ByVal sender As Object, ByVal args As EventArgs) + + Try + + Me.DataChanged = True + + Me.PageSize = Integer.Parse(Me.PersonalSalaryPagination.PageSize.Text) + + Me.PageIndex = Integer.Parse(Me.PersonalSalaryPagination.CurrentPage.Text) - 1 + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalSalaryPagination_PreviousPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + If Me.PageIndex > 0 Then + Me.PageIndex -= 1 + Me.DataChanged = True + End If + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + + ' Generate the event handling functions for sorting events. + + Public Overridable Sub CommandDateLabel2_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by CommandDate when clicked. + + ' Get previous sorting state for CommandDate. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalSalaryTable.CommandDate) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for CommandDate. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalSalaryTable.CommandDate, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by CommandDate, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub PositionSalaryLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by PositionSalary when clicked. + + ' Get previous sorting state for PositionSalary. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalSalaryTable.PositionSalary) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for PositionSalary. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalSalaryTable.PositionSalary, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by PositionSalary, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub SalaryAmoutLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by SalaryAmout when clicked. + + ' Get previous sorting state for SalaryAmout. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalSalaryTable.SalaryAmout) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for SalaryAmout. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalSalaryTable.SalaryAmout, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by SalaryAmout, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub SalaryCommandLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by SalaryCommand when clicked. + + ' Get previous sorting state for SalaryCommand. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalSalaryTable.SalaryCommand) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for SalaryCommand. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalSalaryTable.SalaryCommand, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by SalaryCommand, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub SalaryDateLabel1_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by SalaryDate when clicked. + + ' Get previous sorting state for SalaryDate. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalSalaryTable.SalaryDate) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for SalaryDate. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalSalaryTable.SalaryDate, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by SalaryDate, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub SalaryExtra_NotUsedLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by SalaryExtra_NotUsed when clicked. + + ' Get previous sorting state for SalaryExtra_NotUsed. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalSalaryTable.SalaryExtra_NotUsed) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for SalaryExtra_NotUsed. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalSalaryTable.SalaryExtra_NotUsed, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by SalaryExtra_NotUsed, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub SalaryPlusLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by SalaryPlus when clicked. + + ' Get previous sorting state for SalaryPlus. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalSalaryTable.SalaryPlus) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for SalaryPlus. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalSalaryTable.SalaryPlus, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by SalaryPlus, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub SalaryRankLabel1_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by SalaryRank when clicked. + + ' Get previous sorting state for SalaryRank. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalSalaryTable.SalaryRank) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for SalaryRank. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalSalaryTable.SalaryRank, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by SalaryRank, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub SalaryRoundLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by SalaryRound when clicked. + + ' Get previous sorting state for SalaryRound. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalSalaryTable.SalaryRound) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for SalaryRound. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalSalaryTable.SalaryRound, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by SalaryRound, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub SalaryStepLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by SalaryStep when clicked. + + ' Get previous sorting state for SalaryStep. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalSalaryTable.SalaryStep) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for SalaryStep. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalSalaryTable.SalaryStep, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by SalaryStep, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub SalaryYearLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by SalaryYear when clicked. + + ' Get previous sorting state for SalaryYear. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalSalaryTable.SalaryYear) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for SalaryYear. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalSalaryTable.SalaryYear, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by SalaryYear, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + + ' Generate the event handling functions for button events. + + ' event handler for ImageButton + Public Overridable Sub PersonalSalaryExportCSVButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + ' Build the where clause based on the current filter and search criteria + ' Create the Order By clause based on the user's current sorting preference. + + Dim wc As WhereClause = CreateWhereClause + Dim orderBy As OrderBy = Nothing + + orderBy = CreateOrderBy + + ' Add each of the columns in order of export. + Dim columns() as BaseColumn = New BaseColumn() { _ + PersonalSalaryTable.SalaryDate, _ + PersonalSalaryTable.SalaryRank, _ + PersonalSalaryTable.SalaryStep, _ + PersonalSalaryTable.SalaryYear, _ + PersonalSalaryTable.SalaryRound, _ + PersonalSalaryTable.SalaryAmout, _ + PersonalSalaryTable.SalaryExtra_NotUsed, _ + PersonalSalaryTable.SalaryPlus, _ + PersonalSalaryTable.PositionSalary, _ + PersonalSalaryTable.SalaryCommand, _ + PersonalSalaryTable.CommandDate, _ + Nothing} + Dim exportData as ExportDataToCSV = New ExportDataToCSV(PersonalSalaryTable.Instance, wc, orderBy, columns) + + Dim done As Boolean = False + + Dim totalRowsReturned As Integer = 0 + Dim join As CompoundFilter = CreateCompoundJoinFilter() + Dim data As DataForExport = New DataForExport(PersonalSalaryTable.Instance, wc, orderBy, columns, join) + + 'Check for Export Data Threshold + Dim exportRawValues As Boolean = False + Me.TotalRecords = PersonalSalaryTable.GetRecordCount(join, wc) + If Me.TotalRecords > 10000 Then + exportRawValues = True + End If + exportData.StartExport(Me.Page.Response, exportRawValues) + + ' Read pageSize records at a time and write out the CSV file. + While (Not done) + Dim recList As ArrayList = data.GetRows(exportData.pageSize) + If recList Is Nothing Then + Exit While 'no more records we are done + End If + + totalRowsReturned = recList.Count + For Each rec As BaseRecord In recList + For Each col As BaseColumn In data.ColumnList + If col Is Nothing Then + Continue For + End If + + If Not data.IncludeInExport(col) Then + Continue For + End If + + Dim val As String = "" + + If exportRawValues Then + val = rec.GetValue(col).ToString() + Else + Dim _isExpandableNonCompositeForeignKey As Boolean = col.TableDefinition.IsExpandableNonCompositeForeignKey(col) + If _isExpandableNonCompositeForeignKey AndAlso col.IsApplyDisplayAs Then + val = PersonalSalaryTable.GetDFKA(rec.GetValue(col).ToString(), col, Nothing) + End If + If (Not _isExpandableNonCompositeForeignKey) Or (String.IsNullOrEmpty(val)) Then + val = exportData.GetDataForExport(col, rec) + End If + End If + exportData.WriteColumnData(val, data.IsString(col)) + + Next col + exportData.WriteNewRow() + Next rec + + ' If we already are below the pageSize, then we are done. + If totalRowsReturned < exportData.pageSize Then + done = True + End If + End While + exportData.FinishExport(Me.Page.Response) + + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalSalaryExportExcelButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + ' To customize the columns or the format, override this function in Section 1 of the page + ' and modify it to your liking. + ' Build the where clause based on the current filter and search criteria + ' Create the Order By clause based on the user's current sorting preference. + + Dim wc As WhereClause = CreateWhereClause + Dim orderBy As OrderBy = Nothing + + orderBy = CreateOrderBy + + Dim done As Boolean = False + Dim val As Object = "" + ' Read pageSize records at a time and write out the Excel file. + Dim totalRowsReturned As Integer = 0 + + Me.TotalRecords = PersonalSalaryTable.GetRecordCount(wc) + If Me.TotalRecords > 10000 Then + + ' Add each of the columns in order of export. + Dim columns() as BaseColumn = New BaseColumn() { _ + PersonalSalaryTable.SalaryDate, _ + PersonalSalaryTable.SalaryRank, _ + PersonalSalaryTable.SalaryStep, _ + PersonalSalaryTable.SalaryYear, _ + PersonalSalaryTable.SalaryRound, _ + PersonalSalaryTable.SalaryAmout, _ + PersonalSalaryTable.SalaryExtra_NotUsed, _ + PersonalSalaryTable.SalaryPlus, _ + PersonalSalaryTable.PositionSalary, _ + PersonalSalaryTable.SalaryCommand, _ + PersonalSalaryTable.CommandDate, _ + Nothing} + Dim exportData as ExportDataToCSV = New ExportDataToCSV(PersonalSalaryTable.Instance, wc, orderBy, columns) + exportData.StartExport(Me.Page.Response, True) + + Dim dataForCSV As DataForExport = New DataForExport(PersonalSalaryTable.Instance, wc, orderBy, columns) + + ' Read pageSize records at a time and write out the CSV file. + While (Not done) + Dim recList As ArrayList = dataForCSV.GetRows(exportData.pageSize) + If recList Is Nothing Then + Exit While 'no more records we are done + End If + + totalRowsReturned = recList.Count + For Each rec As BaseRecord In recList + For Each col As BaseColumn In dataForCSV.ColumnList + If col Is Nothing Then + Continue For + End If + + If Not dataForCSV.IncludeInExport(col) Then + Continue For + End If + + val = rec.GetValue(col).ToString() + exportData.WriteColumnData(val, dataForCSV.IsString(col)) + + Next col + exportData.WriteNewRow() + Next rec + + ' If we already are below the pageSize, then we are done. + If totalRowsReturned < exportData.pageSize Then + done = True + End If + End While + exportData.FinishExport(Me.Page.Response) + Else + + ' Create an instance of the Excel report class with the table class, where clause and order by. + Dim excelReport As ExportDataToExcel = New ExportDataToExcel(PersonalSalaryTable.Instance, wc, orderBy) + ' Add each of the columns in order of export. + ' To customize the data type, change the second parameter of the new ExcelColumn to be + ' a format string from Excel's Format Cell menu. For example "dddd, mmmm dd, yyyy h:mm AM/PM;@", "#,##0.00" + + If Me.Page.Response Is Nothing Then + Return + End If + + excelReport.CreateExcelBook() + + Dim width As Integer = 0 + Dim columnCounter As Integer = 0 + Dim data As DataForExport = New DataForExport(PersonalSalaryTable.Instance, wc, orderBy, Nothing) + data.ColumnList.Add(New ExcelColumn(PersonalSalaryTable.SalaryDate, "Short Date")) + data.ColumnList.Add(New ExcelColumn(PersonalSalaryTable.SalaryRank, "Default")) + data.ColumnList.Add(New ExcelColumn(PersonalSalaryTable.SalaryStep, "Standard")) + data.ColumnList.Add(New ExcelColumn(PersonalSalaryTable.SalaryYear, "Default")) + data.ColumnList.Add(New ExcelColumn(PersonalSalaryTable.SalaryRound, "Standard")) + data.ColumnList.Add(New ExcelColumn(PersonalSalaryTable.SalaryAmout, "#,###")) + data.ColumnList.Add(New ExcelColumn(PersonalSalaryTable.SalaryExtra_NotUsed, "Default")) + data.ColumnList.Add(New ExcelColumn(PersonalSalaryTable.SalaryPlus, "#####")) + data.ColumnList.Add(New ExcelColumn(PersonalSalaryTable.PositionSalary, "#####")) + data.ColumnList.Add(New ExcelColumn(PersonalSalaryTable.SalaryCommand, "Default")) + data.ColumnList.Add(New ExcelColumn(PersonalSalaryTable.CommandDate, "Short Date")) + + + For Each col As ExcelColumn In data.ColumnList + width = excelReport.GetExcelCellWidth(col) + If data.IncludeInExport(col) Then + excelReport.AddColumnToExcelBook(columnCounter, col.ToString(), excelReport.GetExcelDataType(col), width, excelReport.GetDisplayFormat(col)) + columnCounter = columnCounter + 1 + End If + Next col + + While (Not done) + Dim recList As ArrayList = data.GetRows(excelReport.pageSize) + + If recList Is Nothing Then + Exit While 'no more records we are done + End If + + totalRowsReturned = recList.Count + + For Each rec As BaseRecord In recList + excelReport.AddRowToExcelBook() + columnCounter = 0 + + For Each col As ExcelColumn In data.ColumnList + If Not data.IncludeInExport(col) Then + Continue For + End If + + Dim _isExpandableNonCompositeForeignKey As Boolean = col.DisplayColumn.TableDefinition.IsExpandableNonCompositeForeignKey(col.DisplayColumn) + If _isExpandableNonCompositeForeignKey AndAlso col.DisplayColumn.IsApplyDisplayAs Then + val = PersonalSalaryTable.GetDFKA(rec.GetValue(col.DisplayColumn).ToString(), col.DisplayColumn, Nothing) + If val Is Nothing Then + val = rec.Format(col.DisplayColumn) + End If + Else + val = excelReport.GetValueForExcelExport(col, rec) + End If + excelReport.AddCellToExcelRow(columnCounter, excelReport.GetExcelDataType(col), val, col.DisplayFormat) + + columnCounter = columnCounter + 1 + Next col + Next rec + + ' If we already are below the pageSize, then we are done. + If totalRowsReturned < excelReport.pageSize Then + done = True + End If + End While + + excelReport.SaveExcelBook(Me.Page.Response) + End If + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalSalaryImportButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalSalaryPDFButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + Dim report As PDFReport = New PDFReport() + report.SpecificReportFileName = Page.Server.MapPath("ShowPersonalId.PersonalSalaryPDFButton.report") + ' report.Title replaces the value tag of page header and footer containing ${ReportTitle} + report.Title = "PersonalSalary" + ' If ShowPersonalId.PersonalSalaryPDFButton.report specifies a valid report template, + ' AddColumn method will generate a report template. + ' Each AddColumn method-call specifies a column + ' The 1st parameter represents the text of the column header + ' The 2nd parameter represents the horizontal alignment of the column header + ' The 3rd parameter represents the text format of the column detail + ' The 4th parameter represents the horizontal alignment of the column detail + ' The 5th parameter represents the relative width of the column + report.AddColumn(PersonalSalaryTable.SalaryDate.Name, ReportEnum.Align.Left, "${SalaryDate}", ReportEnum.Align.Left, 20) + report.AddColumn(PersonalSalaryTable.SalaryRank.Name, ReportEnum.Align.Left, "${SalaryRank}", ReportEnum.Align.Left, 15) + report.AddColumn(PersonalSalaryTable.SalaryStep.Name, ReportEnum.Align.Right, "${SalaryStep}", ReportEnum.Align.Right, 20) + report.AddColumn(PersonalSalaryTable.SalaryYear.Name, ReportEnum.Align.Left, "${SalaryYear}", ReportEnum.Align.Left, 15) + report.AddColumn(PersonalSalaryTable.SalaryRound.Name, ReportEnum.Align.Right, "${SalaryRound}", ReportEnum.Align.Right, 15) + report.AddColumn(PersonalSalaryTable.SalaryAmout.Name, ReportEnum.Align.Right, "${SalaryAmout}", ReportEnum.Align.Right, 20) + report.AddColumn(PersonalSalaryTable.SalaryExtra_NotUsed.Name, ReportEnum.Align.Left, "${SalaryExtra_NotUsed}", ReportEnum.Align.Left, 30) + report.AddColumn(PersonalSalaryTable.SalaryPlus.Name, ReportEnum.Align.Right, "${SalaryPlus}", ReportEnum.Align.Right, 20) + report.AddColumn(PersonalSalaryTable.PositionSalary.Name, ReportEnum.Align.Right, "${PositionSalary}", ReportEnum.Align.Right, 20) + report.AddColumn(PersonalSalaryTable.SalaryCommand.Name, ReportEnum.Align.Left, "${SalaryCommand}", ReportEnum.Align.Left, 30) + report.AddColumn(PersonalSalaryTable.CommandDate.Name, ReportEnum.Align.Left, "${CommandDate}", ReportEnum.Align.Left, 20) + + + Dim rowsPerQuery As Integer = 5000 + Dim recordCount As Integer = 0 + + report.Page = Page.GetResourceValue("Txt:Page", "Persons") + report.ApplicationPath = Me.Page.MapPath(Page.Request.ApplicationPath) + + Dim whereClause As WhereClause = CreateWhereClause + Dim orderBy As OrderBy = CreateOrderBy + Dim joinFilter As BaseFilter = CreateCompoundJoinFilter() + + Dim pageNum As Integer = 0 + Dim totalRows As Integer = PersonalSalaryTable.GetRecordCount(joinFilter,whereClause) + Dim columns As ColumnList = PersonalSalaryTable.GetColumnList() + Dim records As PersonalSalaryRecord() = Nothing + + Do + + records = PersonalSalaryTable.GetRecords(joinFilter,whereClause, orderBy, pageNum, rowsPerQuery) + If Not (records Is Nothing) AndAlso records.Length > 0 AndAlso whereClause.RunQuery Then + For Each record As PersonalSalaryRecord In records + + ' AddData method takes four parameters + ' The 1st parameters represent the data format + ' The 2nd parameters represent the data value + ' The 3rd parameters represent the default alignment of column using the data + ' The 4th parameters represent the maximum length of the data value being shown + report.AddData("${SalaryDate}", record.Format(PersonalSalaryTable.SalaryDate), ReportEnum.Align.Left, 100) + report.AddData("${SalaryRank}", record.Format(PersonalSalaryTable.SalaryRank), ReportEnum.Align.Left, 100) + report.AddData("${SalaryStep}", record.Format(PersonalSalaryTable.SalaryStep), ReportEnum.Align.Right, 100) + report.AddData("${SalaryYear}", record.Format(PersonalSalaryTable.SalaryYear), ReportEnum.Align.Left, 100) + report.AddData("${SalaryRound}", record.Format(PersonalSalaryTable.SalaryRound), ReportEnum.Align.Right, 100) + report.AddData("${SalaryAmout}", record.Format(PersonalSalaryTable.SalaryAmout), ReportEnum.Align.Right, 100) + report.AddData("${SalaryExtra_NotUsed}", record.Format(PersonalSalaryTable.SalaryExtra_NotUsed), ReportEnum.Align.Left, 100) + report.AddData("${SalaryPlus}", record.Format(PersonalSalaryTable.SalaryPlus), ReportEnum.Align.Right, 100) + report.AddData("${PositionSalary}", record.Format(PersonalSalaryTable.PositionSalary), ReportEnum.Align.Right, 100) + report.AddData("${SalaryCommand}", record.Format(PersonalSalaryTable.SalaryCommand), ReportEnum.Align.Left, 100) + report.AddData("${CommandDate}", record.Format(PersonalSalaryTable.CommandDate), ReportEnum.Align.Left, 100) + + report.WriteRow + Next + pageNum = pageNum + 1 + recordCount += records.Length + End If + Loop While Not (records Is Nothing) AndAlso recordCount < totalRows AndAlso whereClause.RunQuery + + report.Close + BaseClasses.Utils.NetUtils.WriteResponseBinaryAttachment(Me.Page.Response, report.Title + ".pdf", report.ReportInByteArray, 0, true) + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalSalaryRefreshButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Dim PersonalDDTableControlObj as PersonalDDTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalDDTableControl"), PersonalDDTableControl) + PersonalDDTableControlObj.ResetData = True + + PersonalDDTableControlObj.RemoveFromSession(PersonalDDTableControlObj, "DeletedRecordIds") + PersonalDDTableControlObj.DeletedRecordIds = Nothing + + Dim PersonalEducationTableControlObj as PersonalEducationTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalEducationTableControl"), PersonalEducationTableControl) + PersonalEducationTableControlObj.ResetData = True + + PersonalEducationTableControlObj.RemoveFromSession(PersonalEducationTableControlObj, "DeletedRecordIds") + PersonalEducationTableControlObj.DeletedRecordIds = Nothing + + Dim PersonalExtWorkTableControlObj as PersonalExtWorkTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalExtWorkTableControl"), PersonalExtWorkTableControl) + PersonalExtWorkTableControlObj.ResetData = True + + PersonalExtWorkTableControlObj.RemoveFromSession(PersonalExtWorkTableControlObj, "DeletedRecordIds") + PersonalExtWorkTableControlObj.DeletedRecordIds = Nothing + + Dim PersonalIdRecordControlObj as PersonalIdRecordControl = DirectCast(Me.Page.FindControlRecursively("PersonalIdRecordControl"), PersonalIdRecordControl) + PersonalIdRecordControlObj.ResetData = True + + + Dim PersonalInsigniaTableControlObj as PersonalInsigniaTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalInsigniaTableControl"), PersonalInsigniaTableControl) + PersonalInsigniaTableControlObj.ResetData = True + + PersonalInsigniaTableControlObj.RemoveFromSession(PersonalInsigniaTableControlObj, "DeletedRecordIds") + PersonalInsigniaTableControlObj.DeletedRecordIds = Nothing + + Dim PersonalLanguageSkillTableControlObj as PersonalLanguageSkillTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalLanguageSkillTableControl"), PersonalLanguageSkillTableControl) + PersonalLanguageSkillTableControlObj.ResetData = True + + PersonalLanguageSkillTableControlObj.RemoveFromSession(PersonalLanguageSkillTableControlObj, "DeletedRecordIds") + PersonalLanguageSkillTableControlObj.DeletedRecordIds = Nothing + + Dim PersonalNameTableControlObj as PersonalNameTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalNameTableControl"), PersonalNameTableControl) + PersonalNameTableControlObj.ResetData = True + + PersonalNameTableControlObj.RemoveFromSession(PersonalNameTableControlObj, "DeletedRecordIds") + PersonalNameTableControlObj.DeletedRecordIds = Nothing + + Dim PersonalRankTableControlObj as PersonalRankTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalRankTableControl"), PersonalRankTableControl) + PersonalRankTableControlObj.ResetData = True + + PersonalRankTableControlObj.RemoveFromSession(PersonalRankTableControlObj, "DeletedRecordIds") + PersonalRankTableControlObj.DeletedRecordIds = Nothing + + Dim PersonalSalaryTableControlObj as PersonalSalaryTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalSalaryTableControl"), PersonalSalaryTableControl) + PersonalSalaryTableControlObj.ResetData = True + + PersonalSalaryTableControlObj.RemoveFromSession(PersonalSalaryTableControlObj, "DeletedRecordIds") + PersonalSalaryTableControlObj.DeletedRecordIds = Nothing + + Dim PersonalSpecialSkillTableControlObj as PersonalSpecialSkillTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalSpecialSkillTableControl"), PersonalSpecialSkillTableControl) + PersonalSpecialSkillTableControlObj.ResetData = True + + PersonalSpecialSkillTableControlObj.RemoveFromSession(PersonalSpecialSkillTableControlObj, "DeletedRecordIds") + PersonalSpecialSkillTableControlObj.DeletedRecordIds = Nothing + + Dim PersonalSportSkillTableControlObj as PersonalSportSkillTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalSportSkillTableControl"), PersonalSportSkillTableControl) + PersonalSportSkillTableControlObj.ResetData = True + + PersonalSportSkillTableControlObj.RemoveFromSession(PersonalSportSkillTableControlObj, "DeletedRecordIds") + PersonalSportSkillTableControlObj.DeletedRecordIds = Nothing + + Dim PersonalTitleTableControlObj as PersonalTitleTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalTitleTableControl"), PersonalTitleTableControl) + PersonalTitleTableControlObj.ResetData = True + + PersonalTitleTableControlObj.RemoveFromSession(PersonalTitleTableControlObj, "DeletedRecordIds") + PersonalTitleTableControlObj.DeletedRecordIds = Nothing + + Dim PersonRelativeTableControlObj as PersonRelativeTableControl = DirectCast(Me.Page.FindControlRecursively("PersonRelativeTableControl"), PersonRelativeTableControl) + PersonRelativeTableControlObj.ResetData = True + + PersonRelativeTableControlObj.RemoveFromSession(PersonRelativeTableControlObj, "DeletedRecordIds") + PersonRelativeTableControlObj.DeletedRecordIds = Nothing + + Dim ReportPropertiesTableControlObj as ReportPropertiesTableControl = DirectCast(Me.Page.FindControlRecursively("ReportPropertiesTableControl"), ReportPropertiesTableControl) + ReportPropertiesTableControlObj.ResetData = True + + ReportPropertiesTableControlObj.RemoveFromSession(ReportPropertiesTableControlObj, "DeletedRecordIds") + ReportPropertiesTableControlObj.DeletedRecordIds = Nothing + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalSalaryResetButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.CurrentSortOrder.Reset() + If Me.InSession(Me, "Order_By") Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + Me.CurrentSortOrder.Add(PersonalSalaryTable.SalaryDate, OrderByItem.OrderDir.Asc) + + Me.CurrentSortOrder.Add(PersonalSalaryTable.CommandDate, OrderByItem.OrderDir.Asc) + + + End If + + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalSalaryWordButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + Dim report As WordReport = New WordReport + report.SpecificReportFileName = Page.Server.MapPath("ShowPersonalId.PersonalSalaryWordButton.word") + ' report.Title replaces the value tag of page header and footer containing ${ReportTitle} + report.Title = "PersonalSalary" + ' If ShowPersonalId.PersonalSalaryWordButton.report specifies a valid report template, + ' AddColumn method will generate a report template. + ' Each AddColumn method-call specifies a column + ' The 1st parameter represents the text of the column header + ' The 2nd parameter represents the horizontal alignment of the column header + ' The 3rd parameter represents the text format of the column detail + ' The 4th parameter represents the horizontal alignment of the column detail + ' The 5th parameter represents the relative width of the column + report.AddColumn(PersonalSalaryTable.SalaryDate.Name, ReportEnum.Align.Left, "${SalaryDate}", ReportEnum.Align.Left, 20) + report.AddColumn(PersonalSalaryTable.SalaryRank.Name, ReportEnum.Align.Left, "${SalaryRank}", ReportEnum.Align.Left, 15) + report.AddColumn(PersonalSalaryTable.SalaryStep.Name, ReportEnum.Align.Right, "${SalaryStep}", ReportEnum.Align.Right, 20) + report.AddColumn(PersonalSalaryTable.SalaryYear.Name, ReportEnum.Align.Left, "${SalaryYear}", ReportEnum.Align.Left, 15) + report.AddColumn(PersonalSalaryTable.SalaryRound.Name, ReportEnum.Align.Right, "${SalaryRound}", ReportEnum.Align.Right, 15) + report.AddColumn(PersonalSalaryTable.SalaryAmout.Name, ReportEnum.Align.Right, "${SalaryAmout}", ReportEnum.Align.Right, 20) + report.AddColumn(PersonalSalaryTable.SalaryExtra_NotUsed.Name, ReportEnum.Align.Left, "${SalaryExtra_NotUsed}", ReportEnum.Align.Left, 30) + report.AddColumn(PersonalSalaryTable.SalaryPlus.Name, ReportEnum.Align.Right, "${SalaryPlus}", ReportEnum.Align.Right, 20) + report.AddColumn(PersonalSalaryTable.PositionSalary.Name, ReportEnum.Align.Right, "${PositionSalary}", ReportEnum.Align.Right, 20) + report.AddColumn(PersonalSalaryTable.SalaryCommand.Name, ReportEnum.Align.Left, "${SalaryCommand}", ReportEnum.Align.Left, 30) + report.AddColumn(PersonalSalaryTable.CommandDate.Name, ReportEnum.Align.Left, "${CommandDate}", ReportEnum.Align.Left, 20) + + Dim whereClause As WhereClause = CreateWhereClause + + Dim orderBy As OrderBy = CreateOrderBy + Dim joinFilter As BaseFilter = CreateCompoundJoinFilter() + + Dim rowsPerQuery As Integer = 5000 + Dim pageNum As Integer = 0 + Dim recordCount As Integer = 0 + Dim totalRows As Integer = PersonalSalaryTable.GetRecordCount(joinFilter,whereClause) + + report.Page = Page.GetResourceValue("Txt:Page", "Persons") + report.ApplicationPath = Me.Page.MapPath(Page.Request.ApplicationPath) + + Dim columns As ColumnList = PersonalSalaryTable.GetColumnList() + Dim records As PersonalSalaryRecord() = Nothing + Do + records = PersonalSalaryTable.GetRecords(joinFilter,whereClause, orderBy, pageNum, rowsPerQuery) + + If Not (records Is Nothing) AndAlso records.Length > 0 AndAlso whereClause.RunQuery Then + For Each record As PersonalSalaryRecord In records + ' AddData method takes four parameters + ' The 1st parameters represent the data format + ' The 2nd parameters represent the data value + ' The 3rd parameters represent the default alignment of column using the data + ' The 4th parameters represent the maximum length of the data value being shown + report.AddData("${SalaryDate}", record.Format(PersonalSalaryTable.SalaryDate), ReportEnum.Align.Left, 100) + report.AddData("${SalaryRank}", record.Format(PersonalSalaryTable.SalaryRank), ReportEnum.Align.Left, 100) + report.AddData("${SalaryStep}", record.Format(PersonalSalaryTable.SalaryStep), ReportEnum.Align.Right, 100) + report.AddData("${SalaryYear}", record.Format(PersonalSalaryTable.SalaryYear), ReportEnum.Align.Left, 100) + report.AddData("${SalaryRound}", record.Format(PersonalSalaryTable.SalaryRound), ReportEnum.Align.Right, 100) + report.AddData("${SalaryAmout}", record.Format(PersonalSalaryTable.SalaryAmout), ReportEnum.Align.Right, 100) + report.AddData("${SalaryExtra_NotUsed}", record.Format(PersonalSalaryTable.SalaryExtra_NotUsed), ReportEnum.Align.Left, 100) + report.AddData("${SalaryPlus}", record.Format(PersonalSalaryTable.SalaryPlus), ReportEnum.Align.Right, 100) + report.AddData("${PositionSalary}", record.Format(PersonalSalaryTable.PositionSalary), ReportEnum.Align.Right, 100) + report.AddData("${SalaryCommand}", record.Format(PersonalSalaryTable.SalaryCommand), ReportEnum.Align.Left, 100) + report.AddData("${CommandDate}", record.Format(PersonalSalaryTable.CommandDate), ReportEnum.Align.Left, 100) + + report.WriteRow + Next + pageNum = pageNum + 1 + recordCount += records.Length + End If + Loop While Not (records Is Nothing) AndAlso recordCount < totalRows AndAlso whereClause.RunQuery + report.save + BaseClasses.Utils.NetUtils.WriteResponseBinaryAttachment(Me.Page.Response, report.Title + ".doc", report.ReportInByteArray, 0, true) + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + + + ' Generate the event handling functions for filter and search events. + + + ' Generate the event handling functions for others + + + Private _UIData As New System.Collections.Generic.List(Of Hashtable) + Public Property UIData() As System.Collections.Generic.List(Of Hashtable) + Get + Return Me._UIData + End Get + Set(ByVal value As System.Collections.Generic.List(Of Hashtable)) + Me._UIData = value + End Set + End Property + + ' pagination properties + Protected _PageSize As Integer + Public Property PageSize() As Integer + Get + Return Me._PageSize + End Get + Set(ByVal value As Integer) + Me._PageSize = value + End Set + End Property + + Protected _PageIndex As Integer + Public Property PageIndex() As Integer + Get + ' Return the PageIndex + Return Me._PageIndex + End Get + Set(ByVal value As Integer) + Me._PageIndex = value + End Set + End Property + + Protected _TotalRecords As Integer = -1 + Public Property TotalRecords() As Integer + Get + If _TotalRecords < 0 + _TotalRecords = PersonalSalaryTable.GetRecordCount(CreateCompoundJoinFilter(), CreateWhereClause()) + End If + Return Me._TotalRecords + End Get + Set(ByVal value As Integer) + If Me.PageSize > 0 Then + + Me.TotalPages = CInt(Math.Ceiling(value / Me.PageSize)) + + End If + Me._TotalRecords = value + End Set + End Property + + + + Protected _TotalPages As Integer = -1 + Public Property TotalPages() As Integer + Get + If _TotalPages < 0 Then + + Me.TotalPages = CInt(Math.Ceiling(TotalRecords / Me.PageSize)) + + End If + Return Me._TotalPages + End Get + Set(ByVal value As Integer) + Me._TotalPages = value + End Set + End Property + + Protected _DisplayLastPage As Boolean + Public Property DisplayLastPage() As Boolean + Get + Return Me._DisplayLastPage + End Get + Set(ByVal value As Boolean) + Me._DisplayLastPage = value + End Set + End Property + + Private _DataChanged As Boolean = False + Public Property DataChanged() As Boolean + Get + Return Me._DataChanged + End Get + Set(ByVal value As Boolean) + Me._DataChanged = value + End Set + End Property + + Private _ResetData As Boolean = False + Public Property ResetData() As Boolean + Get + Return Me._ResetData + End Get + Set(ByVal value As Boolean) + Me._ResetData = value + End Set + End Property + + Private _AddNewRecord As Integer = 0 + Public Property AddNewRecord() As Integer + Get + Return Me._AddNewRecord + End Get + Set(ByVal value As Integer) + Me._AddNewRecord = value + End Set + End Property + + + Private _CurrentSortOrder As OrderBy = Nothing + Public Property CurrentSortOrder() As OrderBy + Get + Return Me._CurrentSortOrder + End Get + Set(ByVal value As BaseClasses.Data.OrderBy) + Me._CurrentSortOrder = value + End Set + End Property + + Private _DataSource() As PersonalSalaryRecord = Nothing + Public Property DataSource() As PersonalSalaryRecord () + Get + Return Me._DataSource + End Get + Set(ByVal value() As PersonalSalaryRecord) + Me._DataSource = value + End Set + End Property + +#Region "Helper Properties" + + Public ReadOnly Property CommandDateLabel2() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "CommandDateLabel2"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property PersonalSalaryExportCSVButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalSalaryExportCSVButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalSalaryExportExcelButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalSalaryExportExcelButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalSalaryImportButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalSalaryImportButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalSalaryPagination() As Persons.UI.IPagination + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalSalaryPagination"), Persons.UI.IPagination) + End Get + End Property + + Public ReadOnly Property PersonalSalaryPDFButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalSalaryPDFButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalSalaryRefreshButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalSalaryRefreshButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalSalaryResetButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalSalaryResetButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalSalaryTableControlCollapsibleRegion() As System.Web.UI.WebControls.Panel + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalSalaryTableControlCollapsibleRegion"), System.Web.UI.WebControls.Panel) + End Get + End Property + + Public ReadOnly Property PersonalSalaryWordButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalSalaryWordButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PositionSalaryLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PositionSalaryLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property SalaryAmoutLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "SalaryAmoutLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property SalaryCommandLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "SalaryCommandLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property SalaryDateLabel1() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "SalaryDateLabel1"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property SalaryExtra_NotUsedLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "SalaryExtra_NotUsedLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property SalaryPlusLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "SalaryPlusLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property SalaryRankLabel1() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "SalaryRankLabel1"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property SalaryRoundLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "SalaryRoundLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property SalaryStepLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "SalaryStepLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property SalaryYearLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "SalaryYearLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + +#End Region + +#Region "Helper Functions" + + Public Overrides Overloads Function ModifyRedirectUrl(url As String, arg As String, ByVal bEncrypt As Boolean) As String + Return Me.Page.EvaluateExpressions(url, arg, bEncrypt, Me) + End Function + + Public Overrides Overloads Function EvaluateExpressions(url As String, arg As String, ByVal bEncrypt As Boolean) As String + Dim needToProcess As Boolean = AreAnyUrlParametersForMe(url, arg) + If (needToProcess) Then + Dim recCtl As PersonalSalaryTableControlRow = Me.GetSelectedRecordControl() + If recCtl Is Nothing AndAlso url.IndexOf("{") >= 0 Then + ' Localization. + Throw New Exception(Page.GetResourceValue("Err:NoRecSelected", "Persons")) + End If + Dim rec As PersonalSalaryRecord = Nothing + If recCtl IsNot Nothing Then + rec = recCtl.GetRecord() + End If + Return EvaluateExpressions(url, arg, rec, bEncrypt) + End If + Return url + End Function + + Public Overridable Function GetSelectedRecordControl() As PersonalSalaryTableControlRow + Return Nothing + + End Function + + Public Overridable Function GetSelectedRecordControls() As PersonalSalaryTableControlRow() + + Return DirectCast((new ArrayList()).ToArray(GetType(PersonalSalaryTableControlRow)), PersonalSalaryTableControlRow()) + + End Function + + Public Overridable Sub DeleteSelectedRecords(ByVal deferDeletion As Boolean) + Dim recList() As PersonalSalaryTableControlRow = Me.GetSelectedRecordControls() + If recList.Length = 0 Then + ' Localization. + Throw New Exception(Page.GetResourceValue("Err:NoRecSelected", "Persons")) + End If + + Dim recCtl As PersonalSalaryTableControlRow + For Each recCtl In recList + If deferDeletion Then + If Not recCtl.IsNewRecord Then + + Me.AddToDeletedRecordIds(recCtl) + + End If + recCtl.Visible = False + + Else + + recCtl.Delete() + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + End If + Next + End Sub + + Public Function GetRecordControls() As PersonalSalaryTableControlRow() + Dim recList As ArrayList = New ArrayList() + Dim rep As System.Web.UI.WebControls.Repeater = CType(Me.FindControl("PersonalSalaryTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return Nothing + Dim repItem As System.Web.UI.WebControls.RepeaterItem + + For Each repItem In rep.Items + + Dim recControl As PersonalSalaryTableControlRow = DirectCast(repItem.FindControl("PersonalSalaryTableControlRow"), PersonalSalaryTableControlRow) + recList.Add(recControl) + + Next + + Return DirectCast(recList.ToArray(GetType(PersonalSalaryTableControlRow)), PersonalSalaryTableControlRow()) + End Function + + Public Shadows ReadOnly Property Page() As BaseApplicationPage + Get + Return DirectCast(MyBase.Page, BaseApplicationPage) + End Get + End Property + +#End Region + + + +End Class + + +' Base class for the PersonalSpecialSkillTableControlRow control on the ShowPersonalId page. +' Do not modify this class. Instead override any method in PersonalSpecialSkillTableControlRow. +Public Class BasePersonalSpecialSkillTableControlRow + Inherits Persons.UI.BaseApplicationRecordControl + + ' To customize, override this method in PersonalSpecialSkillTableControlRow. + Protected Overridable Sub Control_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Init + + Me.ClearControlsFromSession() + End Sub + + ' To customize, override this method in PersonalSpecialSkillTableControlRow. + Protected Overridable Sub Control_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load + + 'Call LoadFocusScripts from repeater so that onfocus attribute could be added to elements + Me.Page.LoadFocusScripts(Me) + + + ' Register the event handlers. + + + End Sub + + + Public Overridable Sub LoadData() + + ' Load the data from the database into the DataSource PersonalSpecialSkill 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 = PersonalSpecialSkillTable.GetRecord(Me.RecordUniqueId, True) + + Return + End If + + ' Since this is a row in the table, the data for this row is loaded by the + ' LoadData method of the BasePersonalSpecialSkillTableControl when the data for the entire + ' table is loaded. + + Me.DataSource = New PersonalSpecialSkillRecord() + + + + End Sub + + ' Populate the UI controls using the DataSource. To customize, override this method in PersonalSpecialSkillTableControlRow. + 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 + + SetLevel1() + SetSkill() + + + 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 SetLevel1() + + + ' Set the Level Literal on the webpage with value from the + ' PersonalSpecialSkill database record. + + ' Me.DataSource is the PersonalSpecialSkill record retrieved from the database. + ' Me.Level1 is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetLevel1() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.LevelSpecified Then + + ' If the Level is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalSpecialSkillTable.Level) + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.Level1.Text = formattedValue + + Else + + ' Level is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.Level1.Text = PersonalSpecialSkillTable.Level.Format(PersonalSpecialSkillTable.Level.DefaultValue) + + End If + + ' If the Level is NULL or blank, then use the value specified + ' on Properties. + If Me.Level1.Text Is Nothing _ + OrElse Me.Level1.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.Level1.Text = " " + End If + + End Sub + + Public Overridable Sub SetSkill() + + + ' Set the Skill Literal on the webpage with value from the + ' PersonalSpecialSkill database record. + + ' Me.DataSource is the PersonalSpecialSkill record retrieved from the database. + ' Me.Skill is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetSkill() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.SkillSpecified Then + + ' If the Skill is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalSpecialSkillTable.Skill) + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.Skill.Text = formattedValue + + Else + + ' Skill is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.Skill.Text = PersonalSpecialSkillTable.Skill.Format(PersonalSpecialSkillTable.Skill.DefaultValue) + + End If + + ' If the Skill is NULL or blank, then use the value specified + ' on Properties. + If Me.Skill.Text Is Nothing _ + OrElse Me.Skill.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.Skill.Text = " " + End If + + End Sub + + + Public EvaluateFormulaDelegate As BaseClasses.Data.DataSource.EvaluateFormulaDelegate = New BaseClasses.Data.DataSource.EvaluateFormulaDelegate(AddressOf Me.EvaluateFormula) + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean, ByVal e As FormulaEvaluator) As String + If e Is Nothing Then + e = New FormulaEvaluator() + End If + + e.Variables.Clear() + + + ' add variables for formula evaluation + If variables IsNot Nothing Then + Dim enumerator As System.Collections.Generic.IEnumerator(Of System.Collections.Generic.KeyValuePair(Of String, Object)) = variables.GetEnumerator() + While enumerator.MoveNext() + e.Variables.Add(enumerator.Current.Key, enumerator.Current.Value) + End While + End If + + If includeDS + + End IF + + + ' Other variables referred to in the formula are expected to be + ' properties of the DataSource. For example, referring to + ' UnitPrice as a variable will refer to DataSource.UnitPrice + If dataSourceForEvaluate Is Nothing Then + + e.DataSource = Me.DataSource + + Else + e.DataSource = dataSourceForEvaluate + End If + + ' Define the calling control. This is used to add other + ' related table and record controls as variables. + e.CallingControl = Me + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + + If Not String.IsNullOrEmpty(format) AndAlso (String.IsNullOrEmpty(formula) OrElse formula.IndexOf("Format(") < 0) Then + Return FormulaUtils.Format(resultObj, format) + Else + Return resultObj.ToString() + End If + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format,variables ,includeDS, Nothing) + End Function + + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object)) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format, variables ,True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, format, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal e as FormulaEvaluator) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, variables, True, e) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal includeDS as Boolean) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, includeDS, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, True, Nothing) + End Function + + + Public Overridable Sub RegisterPostback() + + + End Sub + + + + ' To customize, override this method in PersonalSpecialSkillTableControlRow. + 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 parentCtrl As PersonalIdRecordControl + + + parentCtrl = DirectCast(Me.Page.FindControlRecursively("PersonalIdRecordControl"), PersonalIdRecordControl) + + If (Not IsNothing(parentCtrl) AndAlso IsNothing(parentCtrl.DataSource)) + ' Load the record if it is not loaded yet. + parentCtrl.LoadData() + End If + If (IsNothing(parentCtrl) OrElse IsNothing(parentCtrl.DataSource)) + ' Get the error message from the application resource file. + Throw New Exception(Page.GetResourceValue("Err:NoParentRecId", "Persons")) + End If + + Me.DataSource.PersonalId = parentCtrl.DataSource.PersonalId + + ' 2. Perform any custom validation. + Me.Validate() + + + ' 3. Set the values in the record with data from UI controls. + ' This calls the Get() method for each of the user interface controls. + Me.GetUIData() + + ' 4. Save in the database. + ' We should not save the record if the data did not change. This + ' will save a database hit and avoid triggering any database triggers. + + If Me.DataSource.IsAnyValueChanged Then + ' Save record to database but do not commit yet. + ' Auto generated ids are available after saving for use by child (dependent) records. + Me.DataSource.Save() + + DirectCast(GetParentControlObject(Me, "PersonalSpecialSkillTableControl"), PersonalSpecialSkillTableControl).DataChanged = True + DirectCast(GetParentControlObject(Me, "PersonalSpecialSkillTableControl"), PersonalSpecialSkillTableControl).ResetData = True + End If + + + ' update session or cookie by formula + + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + ' For Master-Detail relationships, save data on the Detail table(s) + + End Sub + + ' To customize, override this method in PersonalSpecialSkillTableControlRow. + 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. + + GetLevel1() + GetSkill() + End Sub + + + Public Overridable Sub GetLevel1() + + End Sub + + Public Overridable Sub GetSkill() + + End Sub + + + ' To customize, override this method in PersonalSpecialSkillTableControlRow. + + Public Overridable Function CreateWhereClause() As WhereClause + + Return Nothing + + End Function + + + + ' To customize, override this method in PersonalSpecialSkillTableControlRow. + 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) + PersonalSpecialSkillTable.DeleteRecord(pkValue) + + DirectCast(GetParentControlObject(Me, "PersonalSpecialSkillTableControl"), PersonalSpecialSkillTableControl).DataChanged = True + DirectCast(GetParentControlObject(Me, "PersonalSpecialSkillTableControl"), PersonalSpecialSkillTableControl).ResetData = True + End Sub + + Protected Overridable Sub Control_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.PreRender + ' PreRender event is raised just before page is being displayed. + Try + DbUtils.StartTransaction() + Me.RegisterPostback() + + If Not Me.Page.ErrorOnPage AndAlso (Me.Page.IsPageRefresh OrElse Me.DataChanged OrElse Me.ResetData) Then + + + ' Re-load the data and update the web page if necessary. + ' This is typically done during a postback (filter, search button, sort, pagination button). + ' In each of the other click handlers, simply set DataChanged to True to reload the data. + Me.LoadData() + Me.DataBind() + End If + + + Catch ex As Exception + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + Finally + DbUtils.EndTransaction() + End Try + End Sub + + + Protected Overrides Sub SaveControlsToSession() + MyBase.SaveControlsToSession() + + + 'Save pagination state to session. + + End Sub + + + + Protected Overrides Sub ClearControlsFromSession() + MyBase.ClearControlsFromSession() + + + + ' Clear pagination state from session. + + End Sub + + Protected Overrides Sub LoadViewState(ByVal savedState As Object) + MyBase.LoadViewState(savedState) + Dim isNewRecord As String = CType(ViewState("IsNewRecord"), String) + If Not isNewRecord Is Nothing AndAlso isNewRecord.Trim <> "" Then + Me.IsNewRecord = Boolean.Parse(isNewRecord) + End If + + Dim myCheckSum As String = CType(ViewState("CheckSum"), String) + If Not myCheckSum Is Nothing AndAlso myCheckSum.Trim <> "" Then + Me.CheckSum = myCheckSum + End If + + + ' Load view state for pagination control. + + End Sub + + Protected Overrides Function SaveViewState() As Object + ViewState("IsNewRecord") = Me.IsNewRecord.ToString() + ViewState("CheckSum") = Me.CheckSum + + + ' Load view state for pagination control. + + Return MyBase.SaveViewState() + End Function + + + + 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("BasePersonalSpecialSkillTableControlRow_Rec"), String) + End Get + Set(ByVal value As String) + Me.ViewState("BasePersonalSpecialSkillTableControlRow_Rec") = value + End Set + End Property + + Private _DataSource As PersonalSpecialSkillRecord + Public Property DataSource() As PersonalSpecialSkillRecord + Get + Return Me._DataSource + End Get + + Set(ByVal value As PersonalSpecialSkillRecord) + + Me._DataSource = value + End Set + End Property + + + + Private _checkSum As String + Public Overridable Property CheckSum() As String + Get + Return Me._checkSum + End Get + Set(ByVal value As String) + Me._checkSum = value + End Set + End Property + + Private _TotalPages As Integer + Public Property TotalPages() As Integer + Get + Return Me._TotalPages + End Get + Set(ByVal value As Integer) + Me._TotalPages = value + End Set + End Property + + Private _PageIndex As Integer + Public Property PageIndex() As Integer + Get + ' Return the PageIndex + Return Me._PageIndex + End Get + Set(ByVal value As Integer) + Me._PageIndex = value + End Set + End Property + + Private _DisplayLastPage As Boolean + Public Property DisplayLastPage() As Boolean + Get + Return Me._DisplayLastPage + End Get + Set(ByVal value As Boolean) + Me._DisplayLastPage = value + End Set + End Property + + + +#Region "Helper Properties" + + Public ReadOnly Property Level1() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Level1"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property Skill() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Skill"), 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 PersonalSpecialSkillRecord = 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 PersonalSpecialSkillRecord + If Not Me.DataSource Is Nothing Then + Return Me.DataSource + End If + + If Not Me.RecordUniqueId Is Nothing Then + + Return PersonalSpecialSkillTable.GetRecord(Me.RecordUniqueId, True) + + End If + + ' Localization. + + Return Nothing + + End Function + + Public Shadows ReadOnly Property Page() As BaseApplicationPage + Get + Return DirectCast(MyBase.Page, BaseApplicationPage) + End Get + End Property + +#End Region + +End Class + + + +' Base class for the PersonalSpecialSkillTableControl control on the ShowPersonalId page. +' Do not modify this class. Instead override any method in PersonalSpecialSkillTableControl. +Public Class BasePersonalSpecialSkillTableControl + Inherits Persons.UI.BaseApplicationTableControl + + + + Protected Overridable Sub Control_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Init + + + + ' Setup the filter and search events. + + + + ' Control Initializations. + ' Initialize the table's current sort order. + + If Me.InSession(Me, "Order_By") Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + End If + + + + ' Setup default pagination settings. + + Me.PageSize = CInt(Me.GetFromSession(Me, "Page_Size", "10")) + Me.PageIndex = CInt(Me.GetFromSession(Me, "Page_Index", "0")) + + + + Me.ClearControlsFromSession() + End Sub + + Protected Overridable Sub Control_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load + + SaveControlsToSession_Ajax() + + ' Setup the pagination events. + + AddHandler Me.PersonalSpecialSkillPagination.FirstPage.Click, AddressOf PersonalSpecialSkillPagination_FirstPage_Click + + AddHandler Me.PersonalSpecialSkillPagination.LastPage.Click, AddressOf PersonalSpecialSkillPagination_LastPage_Click + + AddHandler Me.PersonalSpecialSkillPagination.NextPage.Click, AddressOf PersonalSpecialSkillPagination_NextPage_Click + + AddHandler Me.PersonalSpecialSkillPagination.PageSizeButton.Click, AddressOf PersonalSpecialSkillPagination_PageSizeButton_Click + + AddHandler Me.PersonalSpecialSkillPagination.PreviousPage.Click, AddressOf PersonalSpecialSkillPagination_PreviousPage_Click + + + ' Setup the sorting events. + + AddHandler Me.LevelLabel3.Click, AddressOf LevelLabel3_Click + + AddHandler Me.SkillLabel1.Click, AddressOf SkillLabel1_Click + + ' Setup the button events. + + AddHandler Me.PersonalSpecialSkillExportCSVButton.Click, AddressOf PersonalSpecialSkillExportCSVButton_Click + + AddHandler Me.PersonalSpecialSkillExportExcelButton.Click, AddressOf PersonalSpecialSkillExportExcelButton_Click + + Me.PersonalSpecialSkillImportButton.PostBackUrl = "../Shared/SelectFileToImport.aspx?TableName=PersonalSpecialSkill" + Me.PersonalSpecialSkillImportButton.Attributes.Item("onClick") = "window.open('" & Me.Page.EncryptUrlParameter(Me.PersonalSpecialSkillImportButton.PostBackUrl) & "','importWindow', 'width=700, height=500,top=' +(screen.availHeight-500)/2 + ',left=' + (screen.availWidth-700)/2+ ', resizable=yes, scrollbars=yes,modal=yes'); return false;" + + AddHandler Me.PersonalSpecialSkillImportButton.Click, AddressOf PersonalSpecialSkillImportButton_Click + + AddHandler Me.PersonalSpecialSkillPDFButton.Click, AddressOf PersonalSpecialSkillPDFButton_Click + + AddHandler Me.PersonalSpecialSkillRefreshButton.Click, AddressOf PersonalSpecialSkillRefreshButton_Click + + AddHandler Me.PersonalSpecialSkillResetButton.Click, AddressOf PersonalSpecialSkillResetButton_Click + + AddHandler Me.PersonalSpecialSkillWordButton.Click, AddressOf PersonalSpecialSkillWordButton_Click + + + ' Setup events for others + + End Sub + + + Public Overridable Sub LoadData() + + ' Read data from database. Returns an array of records that can be assigned + ' to the DataSource table control property. + Try + Dim joinFilter As CompoundFilter = CreateCompoundJoinFilter() + + ' The WHERE clause will be empty when displaying all records in table. + Dim wc As WhereClause = CreateWhereClause() + If wc IsNot Nothing AndAlso Not wc.RunQuery Then + ' Initialize an empty array of records + Dim alist As New ArrayList(0) + Me.DataSource = DirectCast(alist.ToArray(GetType(PersonalSpecialSkillRecord)), PersonalSpecialSkillRecord()) + ' Add records to the list if needed. + Me.AddNewRecords() + Me._TotalRecords = 0 + Me._TotalPages = 0 + Return + End If + + ' Call OrderBy to determine the order - either use the order defined + ' on the Query Wizard, or specified by user (by clicking on column heading) + Dim orderBy As OrderBy = CreateOrderBy() + + ' Get the pagesize from the pagesize control. + Me.GetPageSize() + + If Me.DisplayLastPage Then + Dim totalRecords As Integer = If(Me._TotalRecords < 0, PersonalSpecialSkillTable.GetRecordCount(CreateCompoundJoinFilter(), CreateWhereClause()), Me._TotalRecords) + + Dim totalPages As Integer = CInt(Math.Ceiling(totalRecords / Me.PageSize)) + + Me.PageIndex = totalPages - 1 + End If + + ' Make sure PageIndex (current page) and PageSize are within bounds. + If Me.PageIndex < 0 Then + Me.PageIndex = 0 + End If + If Me.PageSize < 1 Then + Me.PageSize = 1 + End If + + ' Retrieve the records and set the table DataSource. + ' Only PageSize records are fetched starting at PageIndex (zero based). + If Me.AddNewRecord > 0 Then + ' Make sure to preserve the previously entered data on new rows. + Dim postdata As New ArrayList + For Each rc As PersonalSpecialSkillTableControlRow In Me.GetRecordControls() + If Not rc.IsNewRecord Then + rc.DataSource = rc.GetRecord() + rc.GetUIData() + postdata.Add(rc.DataSource) + UIData.Add(rc.PreservedUIData()) + End If + Next + Me.DataSource = DirectCast(postdata.ToArray(GetType(PersonalSpecialSkillRecord)), PersonalSpecialSkillRecord()) + Else ' Get the records from the database + Me.DataSource = PersonalSpecialSkillTable.GetRecords(joinFilter, wc, orderBy, Me.PageIndex, Me.PageSize) + + End If + + ' if the datasource contains no records contained in database, then load the last page. + If (DbUtils.GetCreatedRecords(Me.DataSource).Length = 0 AndAlso Not Me.DisplayLastPage) Then + Me.DisplayLastPage = True + LoadData() + Else + + ' Add any new rows desired by the user. + Me.AddNewRecords() + + + ' Initialize the page and grand totals. now + + End If + + Catch ex As Exception + ' Report the error message to the end user + Dim msg As String = ex.Message + If ex.InnerException IsNot Nothing Then + msg = msg & " InnerException: " & ex.InnerException.Message + End If + Throw New Exception(msg, ex.InnerException) + End Try + End Sub + + + + + Public Overrides Sub DataBind() + ' The DataBind method binds the user interface controls to the values + ' from the database record for each row in the table. To do this, it calls the + ' DataBind for each of the rows. + ' DataBind also populates any filters above the table, and sets the pagination + ' control to the correct number of records and the current page number. + + MyBase.DataBind() + + ' Make sure that the DataSource is initialized. + If Me.DataSource Is Nothing Then + Return + End If + + 'LoadData for DataSource for chart and report if they exist + + ' Setup the pagination controls. + BindPaginationControls() + + + + ' Bind the repeater with the list of records to expand the UI. + Dim rep As System.Web.UI.WebControls.Repeater = CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalSpecialSkillTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return + rep.DataSource = DataSource() + rep.DataBind() + + Dim index As Integer = 0 + For Each repItem As System.Web.UI.WebControls.RepeaterItem In rep.Items + ' Loop through all rows in the table, set its DataSource and call DataBind(). + Dim recControl As PersonalSpecialSkillTableControlRow = DirectCast(repItem.FindControl("PersonalSpecialSkillTableControlRow"), PersonalSpecialSkillTableControlRow) + recControl.DataSource = Me.DataSource(index) + If Me.UIData.Count > index Then + recControl.PreviousUIData = Me.UIData(index) + End If + recControl.DataBind() + recControl.Visible = Not Me.InDeletedRecordIds(recControl) + + index += 1 + Next + + + + + ' Call the Set methods for each controls on the panel + + SetLevelLabel3() + + + + + + + + SetPersonalSpecialSkillTableControlCollapsibleRegion() + + SetSkillLabel1() + ' setting the state of expand or collapse alternative rows + + + ' Load data for each record and table UI control. + ' Ordering is important because child controls get + ' their parent ids from their parent UI controls. + + + ' this method calls the set method for controls with special formula like running total, sum, rank, etc + SetFormulaControls() + End Sub + + Public Overridable Sub SetFormulaControls() + ' this method calls Set methods for the control that has special formula + + + + End Sub + + + + Public Overridable Sub RegisterPostback() + + Me.Page.RegisterPostBackTrigger(MiscUtils.FindControlRecursively(Me,"PersonalSpecialSkillExportCSVButton")) + + Me.Page.RegisterPostBackTrigger(MiscUtils.FindControlRecursively(Me,"PersonalSpecialSkillExportExcelButton")) + + Me.Page.RegisterPostBackTrigger(MiscUtils.FindControlRecursively(Me,"PersonalSpecialSkillPDFButton")) + + Me.Page.RegisterPostBackTrigger(MiscUtils.FindControlRecursively(Me,"PersonalSpecialSkillWordButton")) + + + End Sub + + Public EvaluateFormulaDelegate As BaseClasses.Data.DataSource.EvaluateFormulaDelegate = New BaseClasses.Data.DataSource.EvaluateFormulaDelegate(AddressOf Me.EvaluateFormula) + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean, ByVal e as FormulaEvaluator) As String + If e Is Nothing + e = New FormulaEvaluator() + End If + + e.Variables.Clear() + + + ' add variables for formula evaluation + If variables IsNot Nothing Then + Dim enumerator As System.Collections.Generic.IEnumerator(Of System.Collections.Generic.KeyValuePair(Of String, Object)) = variables.GetEnumerator() + While enumerator.MoveNext() + e.Variables.Add(enumerator.Current.Key, enumerator.Current.Value) + End While + End If + + If includeDS + + End If + + ' All variables referred to in the formula are expected to be + ' properties of the DataSource. For example, referring to + ' UnitPrice as a variable will refer to DataSource.UnitPrice + e.DataSource = dataSourceForEvaluate + + ' Define the calling control. This is used to add other + ' related table and record controls as variables. + e.CallingControl = Me + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + + If Not String.IsNullOrEmpty(format) AndAlso (String.IsNullOrEmpty(formula) OrElse formula.IndexOf("Format(") < 0) Then + Return FormulaUtils.Format(resultObj, format) + Else + Return resultObj.ToString() + End If + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format,variables ,includeDS, Nothing) + End Function + + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object)) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format, variables ,True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, format, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal e as FormulaEvaluator) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, variables, True, e) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal includeDS as Boolean) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, includeDS, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, True, Nothing) + End Function + + + + + Public Overridable Sub ResetControl() + + Me.CurrentSortOrder.Reset() + If (Me.InSession(Me, "Order_By")) Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + End If + + Me.PageIndex = 0 + End Sub + + Protected Overridable Sub BindPaginationControls() + ' Setup the pagination controls. + + ' Bind the pagination labels. + + If DbUtils.GetCreatedRecords(Me.DataSource).Length > 0 Then + + Me.PersonalSpecialSkillPagination.CurrentPage.Text = (Me.PageIndex + 1).ToString() + Else + Me.PersonalSpecialSkillPagination.CurrentPage.Text = "0" + End If + Me.PersonalSpecialSkillPagination.PageSize.Text = Me.PageSize.ToString() + Me.PersonalSpecialSkillPagination.TotalItems.Text = Me.TotalRecords.ToString() + Me.PersonalSpecialSkillPagination.TotalPages.Text = Me.TotalPages.ToString() + + ' Bind the buttons for PersonalSpecialSkillTableControl pagination. + + Me.PersonalSpecialSkillPagination.FirstPage.Enabled = Not (Me.PageIndex = 0) + If Me._TotalPages < 0 Then ' if the total pages is not determined yet, enable last and next buttons + Me.PersonalSpecialSkillPagination.LastPage.Enabled = True + ElseIf Me._TotalPages = 0 ' if the total pages is determined and it is 0, enable last and next buttons + Me.PersonalSpecialSkillPagination.LastPage.Enabled = False + Else ' if the total pages is the last page, disable last and next buttons + Me.PersonalSpecialSkillPagination.LastPage.Enabled = Not (Me.PageIndex = Me.TotalPages - 1) + End If + + If Me._TotalPages < 0 Then ' if the total pages is not determined yet, enable last and next buttons + Me.PersonalSpecialSkillPagination.NextPage.Enabled = True + ElseIf Me._TotalPages = 0 ' if the total pages is determined and it is 0, enable last and next buttons + Me.PersonalSpecialSkillPagination.NextPage.Enabled = False + Else ' if the total pages is the last page, disable last and next buttons + Me.PersonalSpecialSkillPagination.NextPage.Enabled = Not (Me.PageIndex = Me.TotalPages - 1) + End If + + Me.PersonalSpecialSkillPagination.PreviousPage.Enabled = Not (Me.PageIndex = 0) + + + End Sub + + Public Overridable Sub SaveData() + ' Save the data from the entire table. Calls each row's Save Data + ' to save their data. This function is called by the Click handler of the + ' Save button. The button handler should Start/Commit/End a transaction. + + Dim recCtl As PersonalSpecialSkillTableControlRow + For Each recCtl In Me.GetRecordControls() + + If Me.InDeletedRecordIds(recCtl) Then + ' Delete any pending deletes. + recCtl.Delete() + Else + If recCtl.Visible Then + recCtl.SaveData() + End If + End If + + Next + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + ' Set IsNewRecord to False for all records - since everything has been saved and is no longer "new" + For Each recCtl In Me.GetRecordControls() + recCtl.IsNewRecord = False + Next + + + ' Set DeletedRecordsIds to Nothing since we have deleted all pending deletes. + Me.DeletedRecordIds = Nothing + + End Sub + + Public Overridable Function CreateCompoundJoinFilter() As CompoundFilter + Dim jFilter As CompoundFilter = New CompoundFilter() + + Return jFilter + + End Function + + + Public Overridable Function CreateOrderBy() As OrderBy + ' The CurrentSortOrder is initialized to the sort order on the + ' Query Wizard. It may be modified by the Click handler for any of + ' the column heading to sort or reverse sort by that column. + ' You can add your own sort order, or modify it on the Query Wizard. + Return Me.CurrentSortOrder + End Function + + Public Overridable Function CreateWhereClause() As WhereClause + 'This CreateWhereClause is used for loading the data. + PersonalSpecialSkillTable.Instance.InnerFilter = Nothing + Dim wc As WhereClause = New WhereClause() + + ' Compose the WHERE clause consiting of: + ' 1. Static clause defined at design time. + ' 2. User selected search criteria. + ' 3. User selected filter criteria. + + + Dim selectedRecordKeyValue as KeyValue = New KeyValue() + + Dim personalIdRecordControlObj As Persons.UI.Controls.ShowPersonalId.PersonalIdRecordControl = DirectCast(MiscUtils.FindControlRecursively(Me.Page, "PersonalIdRecordControl"), Persons.UI.Controls.ShowPersonalId.PersonalIdRecordControl) + + If (Not IsNothing(personalIdRecordControlObj) AndAlso Not IsNothing(personalIdRecordControlObj.GetRecord()) AndAlso personalIdRecordControlObj.GetRecord().IsCreated AndAlso Not IsNothing(personalIdRecordControlObj.GetRecord().PersonalId)) + wc.iAND(PersonalSpecialSkillTable.PersonalId, BaseFilter.ComparisonOperator.EqualsTo, personalIdRecordControlObj.GetRecord().PersonalId.ToString()) + selectedRecordKeyValue.AddElement(PersonalSpecialSkillTable.PersonalId.InternalName, personalIdRecordControlObj.GetRecord().PersonalId.ToString()) + Else + wc.RunQuery = False + Return wc + End If + + HttpContext.Current.Session("PersonalSpecialSkillTableControlWhereClause") = selectedRecordKeyValue.ToXmlString() + + Return wc + End Function + + + Public Overridable Function CreateWhereClause(ByVal searchText as String, ByVal fromSearchControl as String, ByVal AutoTypeAheadSearch as String, ByVal AutoTypeAheadWordSeparators as String) As WhereClause + ' This CreateWhereClause is used for loading list of suggestions for Auto Type-Ahead feature. + PersonalSpecialSkillTable.Instance.InnerFilter = Nothing + Dim wc As WhereClause = New WhereClause() + + ' Compose the WHERE clause consiting of: + ' 1. Static clause defined at design time. + ' 2. User selected search criteria. + ' 3. User selected filter criteria. + + Dim appRelativeVirtualPath As String = CType(HttpContext.Current.Session("AppRelativeVirtualPath"), String) + + Dim selectedRecordInPersonalIdRecordControl as String = DirectCast(HttpContext.Current.Session("PersonalSpecialSkillTableControlWhereClause"), String) + + If Not selectedRecordInPersonalIdRecordControl Is Nothing AndAlso KeyValue.IsXmlKey(selectedRecordInPersonalIdRecordControl) Then + Dim selectedRecordKeyValue as KeyValue = KeyValue.XmlToKey(selectedRecordInPersonalIdRecordControl) + + If Not IsNothing(selectedRecordKeyValue) AndAlso selectedRecordKeyValue.ContainsColumn(PersonalSpecialSkillTable.PersonalId) Then + wc.iAND(PersonalSpecialSkillTable.PersonalId, BaseFilter.ComparisonOperator.EqualsTo, selectedRecordKeyValue.GetColumnValue(PersonalSpecialSkillTable.PersonalId).ToString()) + End If + + End If + + ' Adds clauses if values are selected in Filter controls which are configured in the page. + + + Return wc + End Function + + + Public Overridable Function FormatSuggestions(ByVal prefixText As String, ByVal resultItem As String, _ + ByVal columnLength As Integer, ByVal AutoTypeAheadDisplayFoundText As String, _ + ByVal autoTypeAheadSearch As String, ByVal AutoTypeAheadWordSeparators As String, _ + ByVal resultList As ArrayList) As Boolean + + 'Formats the resultItem and adds it to the list of suggestions. + Dim index As Integer = resultItem.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture).IndexOf(prefixText.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture)) + Dim itemToAdd As String = "" + Dim isFound As Boolean = False + Dim isAdded As Boolean = False + ' Get the index where prfixt is at the beginning of resultItem. If not found then, index of word which begins with prefixText. + If InvariantLCase(autoTypeAheadSearch).equals("wordsstartingwithsearchstring") And Not index = 0 Then + ' Expression to find word which contains AutoTypeAheadWordSeparators followed by prefixText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex( AutoTypeAheadWordSeparators + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + If regex1.IsMatch(resultItem) Then + index = regex1.Match(resultItem).Index + isFound = True + End If + ' If the prefixText is found immediatly after white space then starting of the word is found so don not search any further + If not resultItem(index).ToString() = " " Then + ' Expression to find beginning of the word which contains AutoTypeAheadWordSeparators followed by prefixText + Dim regex As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\\S*" + AutoTypeAheadWordSeparators + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + If regex.IsMatch(resultItem) Then + index = regex.Match(resultItem).Index + isFound = True + End If + End If + End If + + ' If autoTypeAheadSearch value is wordsstartingwithsearchstring then, extract the substring only if the prefixText is found at the + ' beginning of the resultItem (index = 0) or a word in resultItem is found starts with prefixText. + If index = 0 Or isFound Or InvariantLCase(autoTypeAheadSearch).Equals("anywhereinstring") then + If InvariantLCase(AutoTypeAheadDisplayFoundText).equals("atbeginningofmatchedstring") Then + ' Expression to find beginning of the word which contains prefixText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\\S*" + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + ' Find the beginning of the word which contains prefexText + If (StringUtils.InvariantLCase(autoTypeAheadSearch).Equals("anywhereinstring") AndAlso regex1.IsMatch(resultItem)) Then + index = regex1.Match(resultItem).Index + isFound = True + End If + ' Display string from the index till end of the string if sub string from index till end is less than columnLength value. + If Len(resultItem) - index <= columnLength Then + If index = 0 Then + itemToAdd = resultItem + Else + itemToAdd = "..." & resultItem.Substring(index, Len(resultItem) - index) + End If + Else + If index = 0 Then + itemToAdd = resultItem.Substring(index, (columnLength - 3)) & "..." + Else + 'Truncate the string to show only columnLength - 6 characters as begining and trailing "..." has to be appended. + itemToAdd = "..." & resultItem.Substring(index , columnLength - 6) & "..." + End If + End If + ElseIf InvariantLCase(AutoTypeAheadDisplayFoundText).equals("inmiddleofmatchedstring") Then + Dim subStringBeginIndex As Integer = CType(columnLength/2, Integer) + If Len(resultItem) <= columnLength Then + itemToAdd = resultItem + Else + ' Sanity check at end of the string + If index + Len(prefixText) = columnLength Then + itemToAdd = "..." & resultItem.Substring(index-columnLength,index) + ElseIf Len(resultItem) - index < subStringBeginIndex Then + ' Display string from the end till columnLength value if, index is closer to the end of the string. + itemToAdd = "..." & resultItem.Substring(Len(resultItem)-columnLength,Len(resultItem)) + ElseIf index <= subStringBeginIndex Then + ' Sanity chet at beginning of the string + itemToAdd = resultItem.Substring(0, columnLength) & "..." + Else + ' Display string containing text before the prefixText occures and text after the prefixText + itemToAdd = "..." & resultItem.Substring(index - subStringBeginIndex, columnLength) & "..." + End If + End If + ElseIf InvariantLCase(AutoTypeAheadDisplayFoundText).equals("atendofmatchedstring") Then + ' Expression to find ending of the word which contains prefexText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\s", System.Text.RegularExpressions.RegexOptions.IgnoreCase) + ' Find the ending of the word which contains prefexText + If regex1.IsMatch(resultItem, index + 1) Then + index = regex1.Match(resultItem, index + 1).Index + Else + ' If the word which contains prefexText is the last word in string, regex1.IsMatch returns false. + index = resultItem.Length + End If + If index > Len(resultItem) Then + index = Len(resultItem) + End If + ' If text from beginning of the string till index is less than columnLength value then, display string from the beginning till index. + If index <= columnLength Then + if index = Len(resultItem) Then 'Make decision to append "..." + itemToAdd = resultItem.Substring(0,index) + Else + itemToAdd = resultItem.Substring(0,index) & "..." + End If + Else + If index = Len(resultItem) Then + itemToAdd = "..." & resultItem.Substring(index - (columnLength - 3), (columnLength - 3)) + Else + 'Truncate the string to show only columnLength - 6 characters as begining and trailing "..." has to be appended. + itemToAdd = "..." & resultItem.Substring(index - (columnLength - 6), columnLength - 6) & "..." + End If + End If + End If + + ' Remove newline character from itemToAdd + Dim prefixTextIndex As Integer = itemToAdd.IndexOf(prefixText, StringComparison.CurrentCultureIgnoreCase) + ' If itemToAdd contains any newline after the search text then show text only till newline + Dim regex2 As System.Text.RegularExpressions.Regex = New System.Text.RegularExpressions.Regex("(" & vbCrLf & "|" & vbLf & ")", System.Text.RegularExpressions.RegexOptions.IgnoreCase) + Dim newLineIndexAfterPrefix As Integer = -1 + If regex2.IsMatch(itemToAdd, prefixTextIndex) Then + newLineIndexAfterPrefix = regex2.Match(itemToAdd, prefixTextIndex).Index + End If + If (newLineIndexAfterPrefix > -1) Then + If itemToAdd.EndsWith("...") Then + itemToAdd = (itemToAdd.Substring(0, newLineIndexAfterPrefix) + "...") + Else + itemToAdd = itemToAdd.Substring(0, newLineIndexAfterPrefix) + End If + End If + ' If itemToAdd contains any newline before search text then show text which comes after newline + Dim regex3 As System.Text.RegularExpressions.Regex = New System.Text.RegularExpressions.Regex("(" & vbCrLf & "|" & vbLf & ")", (System.Text.RegularExpressions.RegexOptions.IgnoreCase Or System.Text.RegularExpressions.RegexOptions.RightToLeft)) + Dim newLineIndexBeforePrefix As Integer = -1 + If regex3.IsMatch(itemToAdd, prefixTextIndex) Then + newLineIndexBeforePrefix = regex3.Match(itemToAdd, prefixTextIndex).Index + End If + If (newLineIndexBeforePrefix > -1) Then + If itemToAdd.StartsWith("...") Then + itemToAdd = ("..." + itemToAdd.Substring((newLineIndexBeforePrefix + regex3.Match(itemToAdd, prefixTextIndex).Length))) + Else + itemToAdd = itemToAdd.Substring((newLineIndexBeforePrefix + regex3.Match(itemToAdd, prefixTextIndex).Length)) + End If + End If + + If Not itemToAdd is nothing AndAlso Not resultList.Contains(itemToAdd) Then + + resultList.Add(itemToAdd) + + isAdded = true + End If + End If + Return isAdded + End Function + + + Protected Overridable Sub GetPageSize() + + If Me.PersonalSpecialSkillPagination.PageSize.Text.Trim <> "" Then + Try + 'Me.PageSize = Integer.Parse(Me.PersonalSpecialSkillPagination.PageSize.Text) + Catch ex As Exception + End Try + End If + End Sub + + Protected Overridable Sub AddNewRecords() + + Dim newRecordList As ArrayList = New ArrayList() + + Dim newUIDataList As System.Collections.Generic.List(Of Hashtable) = New System.Collections.Generic.List(Of Hashtable)() + + ' Loop though all the record controls and if the record control + ' does not have a unique record id set, then create a record + ' and add to the list. + If Not Me.ResetData Then + Dim rep As System.Web.UI.WebControls.Repeater = CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalSpecialSkillTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return + + Dim repItem As System.Web.UI.WebControls.RepeaterItem + For Each repItem In rep.Items + ' Loop through all rows in the table, set its DataSource and call DataBind(). + + Dim recControl As PersonalSpecialSkillTableControlRow = DirectCast(repItem.FindControl("PersonalSpecialSkillTableControlRow"), PersonalSpecialSkillTableControlRow) + + If recControl.Visible AndAlso recControl.IsNewRecord() Then + + Dim rec As PersonalSpecialSkillRecord = New PersonalSpecialSkillRecord() + + If recControl.Level1.Text <> "" Then + rec.Parse(recControl.Level1.Text, PersonalSpecialSkillTable.Level) + End If + If recControl.Skill.Text <> "" Then + rec.Parse(recControl.Skill.Text, PersonalSpecialSkillTable.Skill) + End If + newUIDataList.Add(recControl.PreservedUIData()) + newRecordList.Add(rec) + End If + Next + End If + + + ' Add any new record to the list. + Dim index As Integer = 0 + For index = 1 To Me.AddNewRecord + + newRecordList.Insert(0, New PersonalSpecialSkillRecord()) + newUIDataList.Insert(0, New Hashtable()) + + Next + Me.AddNewRecord = 0 + + ' Finally, add any new records to the DataSource. + If newRecordList.Count > 0 Then + + Dim finalList As ArrayList = New ArrayList(Me.DataSource) + finalList.InsertRange(0, newRecordList) + + Me.DataSource = DirectCast(finalList.ToArray(GetType(PersonalSpecialSkillRecord)), PersonalSpecialSkillRecord()) + + End If + + ' Add the existing UI data to this hash table + If newUIDataList.Count > 0 Then + Me.UIData.InsertRange(0, newUIDataList) + End If + + End Sub + + + Public Sub AddToDeletedRecordIds(ByVal rec As PersonalSpecialSkillTableControlRow) + If rec.IsNewRecord() Then + Return + End If + + If Not Me.DeletedRecordIds Is Nothing AndAlso Me.DeletedRecordIds.Trim <> "" Then + Me.DeletedRecordIds &= "," + End If + + Me.DeletedRecordIds &= "[" & rec.RecordUniqueId & "]" + End Sub + + Protected Overridable Function InDeletedRecordIds(ByVal rec As PersonalSpecialSkillTableControlRow) As Boolean + If Me.DeletedRecordIds Is Nothing OrElse Me.DeletedRecordIds.Trim = "" Then + Return False + End If + + Return Me.DeletedRecordIds.IndexOf("[" & rec.RecordUniqueId & "]") >= 0 + End Function + + Private _DeletedRecordIds As String + Public Property DeletedRecordIds() As String + Get + Return Me._DeletedRecordIds + End Get + Set(ByVal value As String) + Me._DeletedRecordIds = value + End Set + End Property + + + ' Create Set, WhereClause, and Populate Methods + + Public Overridable Sub SetLevelLabel3() + + End Sub + + Public Overridable Sub SetPersonalSpecialSkillTableControlCollapsibleRegion() + + End Sub + + Public Overridable Sub SetSkillLabel1() + + End Sub + + + + + Protected Overridable Sub Control_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.PreRender + ' PreRender event is raised just before page is being displayed. + Try + DbUtils.StartTransaction + Me.RegisterPostback() + + If Not Me.Page.ErrorOnPage AndAlso (Me.Page.IsPageRefresh OrElse Me.DataChanged OrElse Me.ResetData) Then + + + ' Re-load the data and update the web page if necessary. + ' This is typically done during a postback (filter, search button, sort, pagination button). + ' In each of the other click handlers, simply set DataChanged to True to reload the data. + + Me.LoadData() + Me.DataBind() + + End If + + + + Catch ex As Exception + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + Finally + DbUtils.EndTransaction + End Try + End Sub + + + Protected Overrides Sub SaveControlsToSession() + MyBase.SaveControlsToSession() + + ' Save filter controls to values to session. + + + 'Save pagination state to session. + + + + ' Save table control properties to the session. + If Not Me.CurrentSortOrder Is Nothing Then + Me.SaveToSession(Me, "Order_By", Me.CurrentSortOrder.ToXmlString()) + End If + + Me.SaveToSession(Me, "Page_Index", Me.PageIndex.ToString()) + Me.SaveToSession(Me, "Page_Size", Me.PageSize.ToString()) + + Me.SaveToSession(Me, "DeletedRecordIds", Me.DeletedRecordIds) + + End Sub + + Protected Sub SaveControlsToSession_Ajax() + ' Save filter controls to values to session. + + HttpContext.Current.Session("AppRelativeVirtualPath") = Me.Page.AppRelativeVirtualPath + + End Sub + + Protected Overrides Sub ClearControlsFromSession() + MyBase.ClearControlsFromSession() + + ' Clear filter controls values from the session. + + + ' Clear pagination state from session. + + + + ' Clear table properties from the session. + Me.RemoveFromSession(Me, "Order_By") + Me.RemoveFromSession(Me, "Page_Index") + Me.RemoveFromSession(Me, "Page_Size") + + Me.RemoveFromSession(Me, "DeletedRecordIds") + + End Sub + + Protected Overrides Sub LoadViewState(ByVal savedState As Object) + MyBase.LoadViewState(savedState) + + Dim orderByStr As String = CType(ViewState("PersonalSpecialSkillTableControl_OrderBy"), String) + + If orderByStr IsNot Nothing AndAlso orderByStr.Trim <> "" Then + Me.CurrentSortOrder = BaseClasses.Data.OrderBy.FromXmlString(orderByStr) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + End If + + Dim pageIndex As String = CType(ViewState("Page_Index"), String) + If pageIndex IsNot Nothing Then + Me.PageIndex = CInt(pageIndex) + End If + + Dim pageSize As String = CType(ViewState("Page_Size"), String) + If Not pageSize Is Nothing Then + Me.PageSize = CInt(pageSize) + End If + + + + ' Load view state for pagination control. + + Me.DeletedRecordIds = CType(Me.ViewState("DeletedRecordIds"), String) + + End Sub + + Protected Overrides Function SaveViewState() As Object + + If Me.CurrentSortOrder IsNot Nothing Then + Me.ViewState("PersonalSpecialSkillTableControl_OrderBy") = Me.CurrentSortOrder.ToXmlString() + End If + + Me.ViewState("Page_Index") = Me.PageIndex + Me.ViewState("Page_Size") = Me.PageSize + + Me.ViewState("DeletedRecordIds") = Me.DeletedRecordIds + + + ' Load view state for pagination control. + + + Return MyBase.SaveViewState() + End Function + + ' Generate the event handling functions for pagination events. + + ' event handler for ImageButton + Public Overridable Sub PersonalSpecialSkillPagination_FirstPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.PageIndex = 0 + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalSpecialSkillPagination_LastPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.DisplayLastPage = True + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalSpecialSkillPagination_NextPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.PageIndex += 1 + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for LinkButton + Public Overridable Sub PersonalSpecialSkillPagination_PageSizeButton_Click(ByVal sender As Object, ByVal args As EventArgs) + + Try + + Me.DataChanged = True + + Me.PageSize = Integer.Parse(Me.PersonalSpecialSkillPagination.PageSize.Text) + + Me.PageIndex = Integer.Parse(Me.PersonalSpecialSkillPagination.CurrentPage.Text) - 1 + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalSpecialSkillPagination_PreviousPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + If Me.PageIndex > 0 Then + Me.PageIndex -= 1 + Me.DataChanged = True + End If + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + + ' Generate the event handling functions for sorting events. + + Public Overridable Sub LevelLabel3_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by Level when clicked. + + ' Get previous sorting state for Level. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalSpecialSkillTable.Level) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for Level. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalSpecialSkillTable.Level, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by Level, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub SkillLabel1_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by Skill when clicked. + + ' Get previous sorting state for Skill. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalSpecialSkillTable.Skill) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for Skill. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalSpecialSkillTable.Skill, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by Skill, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + + ' Generate the event handling functions for button events. + + ' event handler for ImageButton + Public Overridable Sub PersonalSpecialSkillExportCSVButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + ' Build the where clause based on the current filter and search criteria + ' Create the Order By clause based on the user's current sorting preference. + + Dim wc As WhereClause = CreateWhereClause + Dim orderBy As OrderBy = Nothing + + orderBy = CreateOrderBy + + ' Add each of the columns in order of export. + Dim columns() as BaseColumn = New BaseColumn() { _ + PersonalSpecialSkillTable.Skill, _ + PersonalSpecialSkillTable.Level, _ + Nothing} + Dim exportData as ExportDataToCSV = New ExportDataToCSV(PersonalSpecialSkillTable.Instance, wc, orderBy, columns) + + Dim done As Boolean = False + + Dim totalRowsReturned As Integer = 0 + Dim join As CompoundFilter = CreateCompoundJoinFilter() + Dim data As DataForExport = New DataForExport(PersonalSpecialSkillTable.Instance, wc, orderBy, columns, join) + + 'Check for Export Data Threshold + Dim exportRawValues As Boolean = False + Me.TotalRecords = PersonalSpecialSkillTable.GetRecordCount(join, wc) + If Me.TotalRecords > 10000 Then + exportRawValues = True + End If + exportData.StartExport(Me.Page.Response, exportRawValues) + + ' Read pageSize records at a time and write out the CSV file. + While (Not done) + Dim recList As ArrayList = data.GetRows(exportData.pageSize) + If recList Is Nothing Then + Exit While 'no more records we are done + End If + + totalRowsReturned = recList.Count + For Each rec As BaseRecord In recList + For Each col As BaseColumn In data.ColumnList + If col Is Nothing Then + Continue For + End If + + If Not data.IncludeInExport(col) Then + Continue For + End If + + Dim val As String = "" + + If exportRawValues Then + val = rec.GetValue(col).ToString() + Else + Dim _isExpandableNonCompositeForeignKey As Boolean = col.TableDefinition.IsExpandableNonCompositeForeignKey(col) + If _isExpandableNonCompositeForeignKey AndAlso col.IsApplyDisplayAs Then + val = PersonalSpecialSkillTable.GetDFKA(rec.GetValue(col).ToString(), col, Nothing) + End If + If (Not _isExpandableNonCompositeForeignKey) Or (String.IsNullOrEmpty(val)) Then + val = exportData.GetDataForExport(col, rec) + End If + End If + exportData.WriteColumnData(val, data.IsString(col)) + + Next col + exportData.WriteNewRow() + Next rec + + ' If we already are below the pageSize, then we are done. + If totalRowsReturned < exportData.pageSize Then + done = True + End If + End While + exportData.FinishExport(Me.Page.Response) + + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalSpecialSkillExportExcelButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + ' To customize the columns or the format, override this function in Section 1 of the page + ' and modify it to your liking. + ' Build the where clause based on the current filter and search criteria + ' Create the Order By clause based on the user's current sorting preference. + + Dim wc As WhereClause = CreateWhereClause + Dim orderBy As OrderBy = Nothing + + orderBy = CreateOrderBy + + Dim done As Boolean = False + Dim val As Object = "" + ' Read pageSize records at a time and write out the Excel file. + Dim totalRowsReturned As Integer = 0 + + Me.TotalRecords = PersonalSpecialSkillTable.GetRecordCount(wc) + If Me.TotalRecords > 10000 Then + + ' Add each of the columns in order of export. + Dim columns() as BaseColumn = New BaseColumn() { _ + PersonalSpecialSkillTable.Skill, _ + PersonalSpecialSkillTable.Level, _ + Nothing} + Dim exportData as ExportDataToCSV = New ExportDataToCSV(PersonalSpecialSkillTable.Instance, wc, orderBy, columns) + exportData.StartExport(Me.Page.Response, True) + + Dim dataForCSV As DataForExport = New DataForExport(PersonalSpecialSkillTable.Instance, wc, orderBy, columns) + + ' Read pageSize records at a time and write out the CSV file. + While (Not done) + Dim recList As ArrayList = dataForCSV.GetRows(exportData.pageSize) + If recList Is Nothing Then + Exit While 'no more records we are done + End If + + totalRowsReturned = recList.Count + For Each rec As BaseRecord In recList + For Each col As BaseColumn In dataForCSV.ColumnList + If col Is Nothing Then + Continue For + End If + + If Not dataForCSV.IncludeInExport(col) Then + Continue For + End If + + val = rec.GetValue(col).ToString() + exportData.WriteColumnData(val, dataForCSV.IsString(col)) + + Next col + exportData.WriteNewRow() + Next rec + + ' If we already are below the pageSize, then we are done. + If totalRowsReturned < exportData.pageSize Then + done = True + End If + End While + exportData.FinishExport(Me.Page.Response) + Else + + ' Create an instance of the Excel report class with the table class, where clause and order by. + Dim excelReport As ExportDataToExcel = New ExportDataToExcel(PersonalSpecialSkillTable.Instance, wc, orderBy) + ' Add each of the columns in order of export. + ' To customize the data type, change the second parameter of the new ExcelColumn to be + ' a format string from Excel's Format Cell menu. For example "dddd, mmmm dd, yyyy h:mm AM/PM;@", "#,##0.00" + + If Me.Page.Response Is Nothing Then + Return + End If + + excelReport.CreateExcelBook() + + Dim width As Integer = 0 + Dim columnCounter As Integer = 0 + Dim data As DataForExport = New DataForExport(PersonalSpecialSkillTable.Instance, wc, orderBy, Nothing) + data.ColumnList.Add(New ExcelColumn(PersonalSpecialSkillTable.Skill, "Default")) + data.ColumnList.Add(New ExcelColumn(PersonalSpecialSkillTable.Level, "Default")) + + + For Each col As ExcelColumn In data.ColumnList + width = excelReport.GetExcelCellWidth(col) + If data.IncludeInExport(col) Then + excelReport.AddColumnToExcelBook(columnCounter, col.ToString(), excelReport.GetExcelDataType(col), width, excelReport.GetDisplayFormat(col)) + columnCounter = columnCounter + 1 + End If + Next col + + While (Not done) + Dim recList As ArrayList = data.GetRows(excelReport.pageSize) + + If recList Is Nothing Then + Exit While 'no more records we are done + End If + + totalRowsReturned = recList.Count + + For Each rec As BaseRecord In recList + excelReport.AddRowToExcelBook() + columnCounter = 0 + + For Each col As ExcelColumn In data.ColumnList + If Not data.IncludeInExport(col) Then + Continue For + End If + + Dim _isExpandableNonCompositeForeignKey As Boolean = col.DisplayColumn.TableDefinition.IsExpandableNonCompositeForeignKey(col.DisplayColumn) + If _isExpandableNonCompositeForeignKey AndAlso col.DisplayColumn.IsApplyDisplayAs Then + val = PersonalSpecialSkillTable.GetDFKA(rec.GetValue(col.DisplayColumn).ToString(), col.DisplayColumn, Nothing) + If val Is Nothing Then + val = rec.Format(col.DisplayColumn) + End If + Else + val = excelReport.GetValueForExcelExport(col, rec) + End If + excelReport.AddCellToExcelRow(columnCounter, excelReport.GetExcelDataType(col), val, col.DisplayFormat) + + columnCounter = columnCounter + 1 + Next col + Next rec + + ' If we already are below the pageSize, then we are done. + If totalRowsReturned < excelReport.pageSize Then + done = True + End If + End While + + excelReport.SaveExcelBook(Me.Page.Response) + End If + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalSpecialSkillImportButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalSpecialSkillPDFButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + Dim report As PDFReport = New PDFReport() + report.SpecificReportFileName = Page.Server.MapPath("ShowPersonalId.PersonalSpecialSkillPDFButton.report") + ' report.Title replaces the value tag of page header and footer containing ${ReportTitle} + report.Title = "PersonalSpecialSkill" + ' If ShowPersonalId.PersonalSpecialSkillPDFButton.report specifies a valid report template, + ' AddColumn method will generate a report template. + ' Each AddColumn method-call specifies a column + ' The 1st parameter represents the text of the column header + ' The 2nd parameter represents the horizontal alignment of the column header + ' The 3rd parameter represents the text format of the column detail + ' The 4th parameter represents the horizontal alignment of the column detail + ' The 5th parameter represents the relative width of the column + report.AddColumn(PersonalSpecialSkillTable.Skill.Name, ReportEnum.Align.Left, "${Skill}", ReportEnum.Align.Left, 30) + report.AddColumn(PersonalSpecialSkillTable.Level.Name, ReportEnum.Align.Left, "${Level}", ReportEnum.Align.Left, 30) + + + Dim rowsPerQuery As Integer = 5000 + Dim recordCount As Integer = 0 + + report.Page = Page.GetResourceValue("Txt:Page", "Persons") + report.ApplicationPath = Me.Page.MapPath(Page.Request.ApplicationPath) + + Dim whereClause As WhereClause = CreateWhereClause + Dim orderBy As OrderBy = CreateOrderBy + Dim joinFilter As BaseFilter = CreateCompoundJoinFilter() + + Dim pageNum As Integer = 0 + Dim totalRows As Integer = PersonalSpecialSkillTable.GetRecordCount(joinFilter,whereClause) + Dim columns As ColumnList = PersonalSpecialSkillTable.GetColumnList() + Dim records As PersonalSpecialSkillRecord() = Nothing + + Do + + records = PersonalSpecialSkillTable.GetRecords(joinFilter,whereClause, orderBy, pageNum, rowsPerQuery) + If Not (records Is Nothing) AndAlso records.Length > 0 AndAlso whereClause.RunQuery Then + For Each record As PersonalSpecialSkillRecord In records + + ' AddData method takes four parameters + ' The 1st parameters represent the data format + ' The 2nd parameters represent the data value + ' The 3rd parameters represent the default alignment of column using the data + ' The 4th parameters represent the maximum length of the data value being shown + report.AddData("${Skill}", record.Format(PersonalSpecialSkillTable.Skill), ReportEnum.Align.Left, 100) + report.AddData("${Level}", record.Format(PersonalSpecialSkillTable.Level), ReportEnum.Align.Left, 100) + + report.WriteRow + Next + pageNum = pageNum + 1 + recordCount += records.Length + End If + Loop While Not (records Is Nothing) AndAlso recordCount < totalRows AndAlso whereClause.RunQuery + + report.Close + BaseClasses.Utils.NetUtils.WriteResponseBinaryAttachment(Me.Page.Response, report.Title + ".pdf", report.ReportInByteArray, 0, true) + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalSpecialSkillRefreshButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Dim PersonalDDTableControlObj as PersonalDDTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalDDTableControl"), PersonalDDTableControl) + PersonalDDTableControlObj.ResetData = True + + PersonalDDTableControlObj.RemoveFromSession(PersonalDDTableControlObj, "DeletedRecordIds") + PersonalDDTableControlObj.DeletedRecordIds = Nothing + + Dim PersonalEducationTableControlObj as PersonalEducationTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalEducationTableControl"), PersonalEducationTableControl) + PersonalEducationTableControlObj.ResetData = True + + PersonalEducationTableControlObj.RemoveFromSession(PersonalEducationTableControlObj, "DeletedRecordIds") + PersonalEducationTableControlObj.DeletedRecordIds = Nothing + + Dim PersonalExtWorkTableControlObj as PersonalExtWorkTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalExtWorkTableControl"), PersonalExtWorkTableControl) + PersonalExtWorkTableControlObj.ResetData = True + + PersonalExtWorkTableControlObj.RemoveFromSession(PersonalExtWorkTableControlObj, "DeletedRecordIds") + PersonalExtWorkTableControlObj.DeletedRecordIds = Nothing + + Dim PersonalIdRecordControlObj as PersonalIdRecordControl = DirectCast(Me.Page.FindControlRecursively("PersonalIdRecordControl"), PersonalIdRecordControl) + PersonalIdRecordControlObj.ResetData = True + + + Dim PersonalInsigniaTableControlObj as PersonalInsigniaTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalInsigniaTableControl"), PersonalInsigniaTableControl) + PersonalInsigniaTableControlObj.ResetData = True + + PersonalInsigniaTableControlObj.RemoveFromSession(PersonalInsigniaTableControlObj, "DeletedRecordIds") + PersonalInsigniaTableControlObj.DeletedRecordIds = Nothing + + Dim PersonalLanguageSkillTableControlObj as PersonalLanguageSkillTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalLanguageSkillTableControl"), PersonalLanguageSkillTableControl) + PersonalLanguageSkillTableControlObj.ResetData = True + + PersonalLanguageSkillTableControlObj.RemoveFromSession(PersonalLanguageSkillTableControlObj, "DeletedRecordIds") + PersonalLanguageSkillTableControlObj.DeletedRecordIds = Nothing + + Dim PersonalNameTableControlObj as PersonalNameTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalNameTableControl"), PersonalNameTableControl) + PersonalNameTableControlObj.ResetData = True + + PersonalNameTableControlObj.RemoveFromSession(PersonalNameTableControlObj, "DeletedRecordIds") + PersonalNameTableControlObj.DeletedRecordIds = Nothing + + Dim PersonalRankTableControlObj as PersonalRankTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalRankTableControl"), PersonalRankTableControl) + PersonalRankTableControlObj.ResetData = True + + PersonalRankTableControlObj.RemoveFromSession(PersonalRankTableControlObj, "DeletedRecordIds") + PersonalRankTableControlObj.DeletedRecordIds = Nothing + + Dim PersonalSalaryTableControlObj as PersonalSalaryTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalSalaryTableControl"), PersonalSalaryTableControl) + PersonalSalaryTableControlObj.ResetData = True + + PersonalSalaryTableControlObj.RemoveFromSession(PersonalSalaryTableControlObj, "DeletedRecordIds") + PersonalSalaryTableControlObj.DeletedRecordIds = Nothing + + Dim PersonalSpecialSkillTableControlObj as PersonalSpecialSkillTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalSpecialSkillTableControl"), PersonalSpecialSkillTableControl) + PersonalSpecialSkillTableControlObj.ResetData = True + + PersonalSpecialSkillTableControlObj.RemoveFromSession(PersonalSpecialSkillTableControlObj, "DeletedRecordIds") + PersonalSpecialSkillTableControlObj.DeletedRecordIds = Nothing + + Dim PersonalSportSkillTableControlObj as PersonalSportSkillTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalSportSkillTableControl"), PersonalSportSkillTableControl) + PersonalSportSkillTableControlObj.ResetData = True + + PersonalSportSkillTableControlObj.RemoveFromSession(PersonalSportSkillTableControlObj, "DeletedRecordIds") + PersonalSportSkillTableControlObj.DeletedRecordIds = Nothing + + Dim PersonalTitleTableControlObj as PersonalTitleTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalTitleTableControl"), PersonalTitleTableControl) + PersonalTitleTableControlObj.ResetData = True + + PersonalTitleTableControlObj.RemoveFromSession(PersonalTitleTableControlObj, "DeletedRecordIds") + PersonalTitleTableControlObj.DeletedRecordIds = Nothing + + Dim PersonRelativeTableControlObj as PersonRelativeTableControl = DirectCast(Me.Page.FindControlRecursively("PersonRelativeTableControl"), PersonRelativeTableControl) + PersonRelativeTableControlObj.ResetData = True + + PersonRelativeTableControlObj.RemoveFromSession(PersonRelativeTableControlObj, "DeletedRecordIds") + PersonRelativeTableControlObj.DeletedRecordIds = Nothing + + Dim ReportPropertiesTableControlObj as ReportPropertiesTableControl = DirectCast(Me.Page.FindControlRecursively("ReportPropertiesTableControl"), ReportPropertiesTableControl) + ReportPropertiesTableControlObj.ResetData = True + + ReportPropertiesTableControlObj.RemoveFromSession(ReportPropertiesTableControlObj, "DeletedRecordIds") + ReportPropertiesTableControlObj.DeletedRecordIds = Nothing + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalSpecialSkillResetButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.CurrentSortOrder.Reset() + If Me.InSession(Me, "Order_By") Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + + End If + + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalSpecialSkillWordButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + Dim report As WordReport = New WordReport + report.SpecificReportFileName = Page.Server.MapPath("ShowPersonalId.PersonalSpecialSkillWordButton.word") + ' report.Title replaces the value tag of page header and footer containing ${ReportTitle} + report.Title = "PersonalSpecialSkill" + ' If ShowPersonalId.PersonalSpecialSkillWordButton.report specifies a valid report template, + ' AddColumn method will generate a report template. + ' Each AddColumn method-call specifies a column + ' The 1st parameter represents the text of the column header + ' The 2nd parameter represents the horizontal alignment of the column header + ' The 3rd parameter represents the text format of the column detail + ' The 4th parameter represents the horizontal alignment of the column detail + ' The 5th parameter represents the relative width of the column + report.AddColumn(PersonalSpecialSkillTable.Skill.Name, ReportEnum.Align.Left, "${Skill}", ReportEnum.Align.Left, 30) + report.AddColumn(PersonalSpecialSkillTable.Level.Name, ReportEnum.Align.Left, "${Level}", ReportEnum.Align.Left, 30) + + Dim whereClause As WhereClause = CreateWhereClause + + Dim orderBy As OrderBy = CreateOrderBy + Dim joinFilter As BaseFilter = CreateCompoundJoinFilter() + + Dim rowsPerQuery As Integer = 5000 + Dim pageNum As Integer = 0 + Dim recordCount As Integer = 0 + Dim totalRows As Integer = PersonalSpecialSkillTable.GetRecordCount(joinFilter,whereClause) + + report.Page = Page.GetResourceValue("Txt:Page", "Persons") + report.ApplicationPath = Me.Page.MapPath(Page.Request.ApplicationPath) + + Dim columns As ColumnList = PersonalSpecialSkillTable.GetColumnList() + Dim records As PersonalSpecialSkillRecord() = Nothing + Do + records = PersonalSpecialSkillTable.GetRecords(joinFilter,whereClause, orderBy, pageNum, rowsPerQuery) + + If Not (records Is Nothing) AndAlso records.Length > 0 AndAlso whereClause.RunQuery Then + For Each record As PersonalSpecialSkillRecord In records + ' AddData method takes four parameters + ' The 1st parameters represent the data format + ' The 2nd parameters represent the data value + ' The 3rd parameters represent the default alignment of column using the data + ' The 4th parameters represent the maximum length of the data value being shown + report.AddData("${Skill}", record.Format(PersonalSpecialSkillTable.Skill), ReportEnum.Align.Left, 100) + report.AddData("${Level}", record.Format(PersonalSpecialSkillTable.Level), ReportEnum.Align.Left, 100) + + report.WriteRow + Next + pageNum = pageNum + 1 + recordCount += records.Length + End If + Loop While Not (records Is Nothing) AndAlso recordCount < totalRows AndAlso whereClause.RunQuery + report.save + BaseClasses.Utils.NetUtils.WriteResponseBinaryAttachment(Me.Page.Response, report.Title + ".doc", report.ReportInByteArray, 0, true) + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + + + ' Generate the event handling functions for filter and search events. + + + ' Generate the event handling functions for others + + + Private _UIData As New System.Collections.Generic.List(Of Hashtable) + Public Property UIData() As System.Collections.Generic.List(Of Hashtable) + Get + Return Me._UIData + End Get + Set(ByVal value As System.Collections.Generic.List(Of Hashtable)) + Me._UIData = value + End Set + End Property + + ' pagination properties + Protected _PageSize As Integer + Public Property PageSize() As Integer + Get + Return Me._PageSize + End Get + Set(ByVal value As Integer) + Me._PageSize = value + End Set + End Property + + Protected _PageIndex As Integer + Public Property PageIndex() As Integer + Get + ' Return the PageIndex + Return Me._PageIndex + End Get + Set(ByVal value As Integer) + Me._PageIndex = value + End Set + End Property + + Protected _TotalRecords As Integer = -1 + Public Property TotalRecords() As Integer + Get + If _TotalRecords < 0 + _TotalRecords = PersonalSpecialSkillTable.GetRecordCount(CreateCompoundJoinFilter(), CreateWhereClause()) + End If + Return Me._TotalRecords + End Get + Set(ByVal value As Integer) + If Me.PageSize > 0 Then + + Me.TotalPages = CInt(Math.Ceiling(value / Me.PageSize)) + + End If + Me._TotalRecords = value + End Set + End Property + + + + Protected _TotalPages As Integer = -1 + Public Property TotalPages() As Integer + Get + If _TotalPages < 0 Then + + Me.TotalPages = CInt(Math.Ceiling(TotalRecords / Me.PageSize)) + + End If + Return Me._TotalPages + End Get + Set(ByVal value As Integer) + Me._TotalPages = value + End Set + End Property + + Protected _DisplayLastPage As Boolean + Public Property DisplayLastPage() As Boolean + Get + Return Me._DisplayLastPage + End Get + Set(ByVal value As Boolean) + Me._DisplayLastPage = value + End Set + End Property + + Private _DataChanged As Boolean = False + Public Property DataChanged() As Boolean + Get + Return Me._DataChanged + End Get + Set(ByVal value As Boolean) + Me._DataChanged = value + End Set + End Property + + Private _ResetData As Boolean = False + Public Property ResetData() As Boolean + Get + Return Me._ResetData + End Get + Set(ByVal value As Boolean) + Me._ResetData = value + End Set + End Property + + Private _AddNewRecord As Integer = 0 + Public Property AddNewRecord() As Integer + Get + Return Me._AddNewRecord + End Get + Set(ByVal value As Integer) + Me._AddNewRecord = value + End Set + End Property + + + Private _CurrentSortOrder As OrderBy = Nothing + Public Property CurrentSortOrder() As OrderBy + Get + Return Me._CurrentSortOrder + End Get + Set(ByVal value As BaseClasses.Data.OrderBy) + Me._CurrentSortOrder = value + End Set + End Property + + Private _DataSource() As PersonalSpecialSkillRecord = Nothing + Public Property DataSource() As PersonalSpecialSkillRecord () + Get + Return Me._DataSource + End Get + Set(ByVal value() As PersonalSpecialSkillRecord) + Me._DataSource = value + End Set + End Property + +#Region "Helper Properties" + + Public ReadOnly Property LevelLabel3() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "LevelLabel3"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property PersonalSpecialSkillExportCSVButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalSpecialSkillExportCSVButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalSpecialSkillExportExcelButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalSpecialSkillExportExcelButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalSpecialSkillImportButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalSpecialSkillImportButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalSpecialSkillPagination() As Persons.UI.IPagination + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalSpecialSkillPagination"), Persons.UI.IPagination) + End Get + End Property + + Public ReadOnly Property PersonalSpecialSkillPDFButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalSpecialSkillPDFButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalSpecialSkillRefreshButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalSpecialSkillRefreshButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalSpecialSkillResetButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalSpecialSkillResetButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalSpecialSkillTableControlCollapsibleRegion() As System.Web.UI.WebControls.Panel + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalSpecialSkillTableControlCollapsibleRegion"), System.Web.UI.WebControls.Panel) + End Get + End Property + + Public ReadOnly Property PersonalSpecialSkillWordButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalSpecialSkillWordButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property SkillLabel1() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "SkillLabel1"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + +#End Region + +#Region "Helper Functions" + + Public Overrides Overloads Function ModifyRedirectUrl(url As String, arg As String, ByVal bEncrypt As Boolean) As String + Return Me.Page.EvaluateExpressions(url, arg, bEncrypt, Me) + End Function + + Public Overrides Overloads Function EvaluateExpressions(url As String, arg As String, ByVal bEncrypt As Boolean) As String + Dim needToProcess As Boolean = AreAnyUrlParametersForMe(url, arg) + If (needToProcess) Then + Dim recCtl As PersonalSpecialSkillTableControlRow = Me.GetSelectedRecordControl() + If recCtl Is Nothing AndAlso url.IndexOf("{") >= 0 Then + ' Localization. + Throw New Exception(Page.GetResourceValue("Err:NoRecSelected", "Persons")) + End If + Dim rec As PersonalSpecialSkillRecord = Nothing + If recCtl IsNot Nothing Then + rec = recCtl.GetRecord() + End If + Return EvaluateExpressions(url, arg, rec, bEncrypt) + End If + Return url + End Function + + Public Overridable Function GetSelectedRecordControl() As PersonalSpecialSkillTableControlRow + Return Nothing + + End Function + + Public Overridable Function GetSelectedRecordControls() As PersonalSpecialSkillTableControlRow() + + Return DirectCast((new ArrayList()).ToArray(GetType(PersonalSpecialSkillTableControlRow)), PersonalSpecialSkillTableControlRow()) + + End Function + + Public Overridable Sub DeleteSelectedRecords(ByVal deferDeletion As Boolean) + Dim recList() As PersonalSpecialSkillTableControlRow = Me.GetSelectedRecordControls() + If recList.Length = 0 Then + ' Localization. + Throw New Exception(Page.GetResourceValue("Err:NoRecSelected", "Persons")) + End If + + Dim recCtl As PersonalSpecialSkillTableControlRow + For Each recCtl In recList + If deferDeletion Then + If Not recCtl.IsNewRecord Then + + Me.AddToDeletedRecordIds(recCtl) + + End If + recCtl.Visible = False + + Else + + recCtl.Delete() + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + End If + Next + End Sub + + Public Function GetRecordControls() As PersonalSpecialSkillTableControlRow() + Dim recList As ArrayList = New ArrayList() + Dim rep As System.Web.UI.WebControls.Repeater = CType(Me.FindControl("PersonalSpecialSkillTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return Nothing + Dim repItem As System.Web.UI.WebControls.RepeaterItem + + For Each repItem In rep.Items + + Dim recControl As PersonalSpecialSkillTableControlRow = DirectCast(repItem.FindControl("PersonalSpecialSkillTableControlRow"), PersonalSpecialSkillTableControlRow) + recList.Add(recControl) + + Next + + Return DirectCast(recList.ToArray(GetType(PersonalSpecialSkillTableControlRow)), PersonalSpecialSkillTableControlRow()) + End Function + + Public Shadows ReadOnly Property Page() As BaseApplicationPage + Get + Return DirectCast(MyBase.Page, BaseApplicationPage) + End Get + End Property + +#End Region + + + +End Class + + +' Base class for the PersonalSportSkillTableControlRow control on the ShowPersonalId page. +' Do not modify this class. Instead override any method in PersonalSportSkillTableControlRow. +Public Class BasePersonalSportSkillTableControlRow + Inherits Persons.UI.BaseApplicationRecordControl + + ' To customize, override this method in PersonalSportSkillTableControlRow. + Protected Overridable Sub Control_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Init + + Me.ClearControlsFromSession() + End Sub + + ' To customize, override this method in PersonalSportSkillTableControlRow. + Protected Overridable Sub Control_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load + + 'Call LoadFocusScripts from repeater so that onfocus attribute could be added to elements + Me.Page.LoadFocusScripts(Me) + + + ' Register the event handlers. + + + End Sub + + + Public Overridable Sub LoadData() + + ' Load the data from the database into the DataSource PersonalSportSkill 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 = PersonalSportSkillTable.GetRecord(Me.RecordUniqueId, True) + + Return + End If + + ' Since this is a row in the table, the data for this row is loaded by the + ' LoadData method of the BasePersonalSportSkillTableControl when the data for the entire + ' table is loaded. + + Me.DataSource = New PersonalSportSkillRecord() + + + + End Sub + + ' Populate the UI controls using the DataSource. To customize, override this method in PersonalSportSkillTableControlRow. + 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 + + SetLevel2() + SetSportId() + + + 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 SetLevel2() + + + ' Set the Level Literal on the webpage with value from the + ' PersonalSportSkill database record. + + ' Me.DataSource is the PersonalSportSkill record retrieved from the database. + ' Me.Level2 is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetLevel2() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.LevelSpecified Then + + ' If the Level is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalSportSkillTable.Level) + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.Level2.Text = formattedValue + + Else + + ' Level is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.Level2.Text = PersonalSportSkillTable.Level.Format(PersonalSportSkillTable.Level.DefaultValue) + + End If + + ' If the Level is NULL or blank, then use the value specified + ' on Properties. + If Me.Level2.Text Is Nothing _ + OrElse Me.Level2.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.Level2.Text = " " + End If + + End Sub + + Public Overridable Sub SetSportId() + + + ' Set the SportId Literal on the webpage with value from the + ' PersonalSportSkill database record. + + ' Me.DataSource is the PersonalSportSkill record retrieved from the database. + ' Me.SportId is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetSportId() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.SportIdSpecified Then + + ' If the SportId is non-NULL, then format the value. + + ' The Format method will return the Display Foreign Key As (DFKA) value + Dim formattedValue As String = "" + Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalSportSkillTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalSportSkillTable.SportId) + If _isExpandableNonCompositeForeignKey AndAlso PersonalSportSkillTable.SportId.IsApplyDisplayAs Then + + formattedValue = PersonalSportSkillTable.GetDFKA(Me.DataSource.SportId.ToString(),PersonalSportSkillTable.SportId, Nothing) + + if (formattedValue Is Nothing) Then + formattedValue = Me.DataSource.Format(PersonalSportSkillTable.SportId) + End If + Else + formattedValue = Me.DataSource.SportId.ToString() + End If + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.SportId.Text = formattedValue + + Else + + ' SportId is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.SportId.Text = PersonalSportSkillTable.SportId.Format(PersonalSportSkillTable.SportId.DefaultValue) + + End If + + ' If the SportId is NULL or blank, then use the value specified + ' on Properties. + If Me.SportId.Text Is Nothing _ + OrElse Me.SportId.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.SportId.Text = " " + End If + + End Sub + + + Public EvaluateFormulaDelegate As BaseClasses.Data.DataSource.EvaluateFormulaDelegate = New BaseClasses.Data.DataSource.EvaluateFormulaDelegate(AddressOf Me.EvaluateFormula) + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean, ByVal e As FormulaEvaluator) As String + If e Is Nothing Then + e = New FormulaEvaluator() + End If + + e.Variables.Clear() + + + ' add variables for formula evaluation + If variables IsNot Nothing Then + Dim enumerator As System.Collections.Generic.IEnumerator(Of System.Collections.Generic.KeyValuePair(Of String, Object)) = variables.GetEnumerator() + While enumerator.MoveNext() + e.Variables.Add(enumerator.Current.Key, enumerator.Current.Value) + End While + End If + + If includeDS + + End IF + + + ' Other variables referred to in the formula are expected to be + ' properties of the DataSource. For example, referring to + ' UnitPrice as a variable will refer to DataSource.UnitPrice + If dataSourceForEvaluate Is Nothing Then + + e.DataSource = Me.DataSource + + Else + e.DataSource = dataSourceForEvaluate + End If + + ' Define the calling control. This is used to add other + ' related table and record controls as variables. + e.CallingControl = Me + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + + If Not String.IsNullOrEmpty(format) AndAlso (String.IsNullOrEmpty(formula) OrElse formula.IndexOf("Format(") < 0) Then + Return FormulaUtils.Format(resultObj, format) + Else + Return resultObj.ToString() + End If + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format,variables ,includeDS, Nothing) + End Function + + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object)) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format, variables ,True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, format, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal e as FormulaEvaluator) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, variables, True, e) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal includeDS as Boolean) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, includeDS, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, True, Nothing) + End Function + + + Public Overridable Sub RegisterPostback() + + + End Sub + + + + ' To customize, override this method in PersonalSportSkillTableControlRow. + 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 parentCtrl As PersonalIdRecordControl + + + parentCtrl = DirectCast(Me.Page.FindControlRecursively("PersonalIdRecordControl"), PersonalIdRecordControl) + + If (Not IsNothing(parentCtrl) AndAlso IsNothing(parentCtrl.DataSource)) + ' Load the record if it is not loaded yet. + parentCtrl.LoadData() + End If + If (IsNothing(parentCtrl) OrElse IsNothing(parentCtrl.DataSource)) + ' Get the error message from the application resource file. + Throw New Exception(Page.GetResourceValue("Err:NoParentRecId", "Persons")) + End If + + Me.DataSource.PersonalId = parentCtrl.DataSource.PersonalId + + ' 2. Perform any custom validation. + Me.Validate() + + + ' 3. Set the values in the record with data from UI controls. + ' This calls the Get() method for each of the user interface controls. + Me.GetUIData() + + ' 4. Save in the database. + ' We should not save the record if the data did not change. This + ' will save a database hit and avoid triggering any database triggers. + + If Me.DataSource.IsAnyValueChanged Then + ' Save record to database but do not commit yet. + ' Auto generated ids are available after saving for use by child (dependent) records. + Me.DataSource.Save() + + DirectCast(GetParentControlObject(Me, "PersonalSportSkillTableControl"), PersonalSportSkillTableControl).DataChanged = True + DirectCast(GetParentControlObject(Me, "PersonalSportSkillTableControl"), PersonalSportSkillTableControl).ResetData = True + End If + + + ' update session or cookie by formula + + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + ' For Master-Detail relationships, save data on the Detail table(s) + + End Sub + + ' To customize, override this method in PersonalSportSkillTableControlRow. + 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. + + GetLevel2() + GetSportId() + End Sub + + + Public Overridable Sub GetLevel2() + + End Sub + + Public Overridable Sub GetSportId() + + End Sub + + + ' To customize, override this method in PersonalSportSkillTableControlRow. + + Public Overridable Function CreateWhereClause() As WhereClause + + Return Nothing + + End Function + + + + ' To customize, override this method in PersonalSportSkillTableControlRow. + 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) + PersonalSportSkillTable.DeleteRecord(pkValue) + + DirectCast(GetParentControlObject(Me, "PersonalSportSkillTableControl"), PersonalSportSkillTableControl).DataChanged = True + DirectCast(GetParentControlObject(Me, "PersonalSportSkillTableControl"), PersonalSportSkillTableControl).ResetData = True + End Sub + + Protected Overridable Sub Control_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.PreRender + ' PreRender event is raised just before page is being displayed. + Try + DbUtils.StartTransaction() + Me.RegisterPostback() + + If Not Me.Page.ErrorOnPage AndAlso (Me.Page.IsPageRefresh OrElse Me.DataChanged OrElse Me.ResetData) Then + + + ' Re-load the data and update the web page if necessary. + ' This is typically done during a postback (filter, search button, sort, pagination button). + ' In each of the other click handlers, simply set DataChanged to True to reload the data. + Me.LoadData() + Me.DataBind() + End If + + + Catch ex As Exception + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + Finally + DbUtils.EndTransaction() + End Try + End Sub + + + Protected Overrides Sub SaveControlsToSession() + MyBase.SaveControlsToSession() + + + 'Save pagination state to session. + + End Sub + + + + Protected Overrides Sub ClearControlsFromSession() + MyBase.ClearControlsFromSession() + + + + ' Clear pagination state from session. + + End Sub + + Protected Overrides Sub LoadViewState(ByVal savedState As Object) + MyBase.LoadViewState(savedState) + Dim isNewRecord As String = CType(ViewState("IsNewRecord"), String) + If Not isNewRecord Is Nothing AndAlso isNewRecord.Trim <> "" Then + Me.IsNewRecord = Boolean.Parse(isNewRecord) + End If + + Dim myCheckSum As String = CType(ViewState("CheckSum"), String) + If Not myCheckSum Is Nothing AndAlso myCheckSum.Trim <> "" Then + Me.CheckSum = myCheckSum + End If + + + ' Load view state for pagination control. + + End Sub + + Protected Overrides Function SaveViewState() As Object + ViewState("IsNewRecord") = Me.IsNewRecord.ToString() + ViewState("CheckSum") = Me.CheckSum + + + ' Load view state for pagination control. + + Return MyBase.SaveViewState() + End Function + + + + 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("BasePersonalSportSkillTableControlRow_Rec"), String) + End Get + Set(ByVal value As String) + Me.ViewState("BasePersonalSportSkillTableControlRow_Rec") = value + End Set + End Property + + Private _DataSource As PersonalSportSkillRecord + Public Property DataSource() As PersonalSportSkillRecord + Get + Return Me._DataSource + End Get + + Set(ByVal value As PersonalSportSkillRecord) + + Me._DataSource = value + End Set + End Property + + + + Private _checkSum As String + Public Overridable Property CheckSum() As String + Get + Return Me._checkSum + End Get + Set(ByVal value As String) + Me._checkSum = value + End Set + End Property + + Private _TotalPages As Integer + Public Property TotalPages() As Integer + Get + Return Me._TotalPages + End Get + Set(ByVal value As Integer) + Me._TotalPages = value + End Set + End Property + + Private _PageIndex As Integer + Public Property PageIndex() As Integer + Get + ' Return the PageIndex + Return Me._PageIndex + End Get + Set(ByVal value As Integer) + Me._PageIndex = value + End Set + End Property + + Private _DisplayLastPage As Boolean + Public Property DisplayLastPage() As Boolean + Get + Return Me._DisplayLastPage + End Get + Set(ByVal value As Boolean) + Me._DisplayLastPage = value + End Set + End Property + + + +#Region "Helper Properties" + + Public ReadOnly Property Level2() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Level2"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property SportId() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "SportId"), 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 PersonalSportSkillRecord = 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 PersonalSportSkillRecord + If Not Me.DataSource Is Nothing Then + Return Me.DataSource + End If + + If Not Me.RecordUniqueId Is Nothing Then + + Return PersonalSportSkillTable.GetRecord(Me.RecordUniqueId, True) + + End If + + ' Localization. + + Return Nothing + + End Function + + Public Shadows ReadOnly Property Page() As BaseApplicationPage + Get + Return DirectCast(MyBase.Page, BaseApplicationPage) + End Get + End Property + +#End Region + +End Class + + + +' Base class for the PersonalSportSkillTableControl control on the ShowPersonalId page. +' Do not modify this class. Instead override any method in PersonalSportSkillTableControl. +Public Class BasePersonalSportSkillTableControl + Inherits Persons.UI.BaseApplicationTableControl + + + + Protected Overridable Sub Control_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Init + + + + ' Setup the filter and search events. + + + + ' Control Initializations. + ' Initialize the table's current sort order. + + If Me.InSession(Me, "Order_By") Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + End If + + + + ' Setup default pagination settings. + + Me.PageSize = CInt(Me.GetFromSession(Me, "Page_Size", "10")) + Me.PageIndex = CInt(Me.GetFromSession(Me, "Page_Index", "0")) + + + + Me.ClearControlsFromSession() + End Sub + + Protected Overridable Sub Control_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load + + SaveControlsToSession_Ajax() + + ' Setup the pagination events. + + AddHandler Me.PersonalSportSkillPagination.FirstPage.Click, AddressOf PersonalSportSkillPagination_FirstPage_Click + + AddHandler Me.PersonalSportSkillPagination.LastPage.Click, AddressOf PersonalSportSkillPagination_LastPage_Click + + AddHandler Me.PersonalSportSkillPagination.NextPage.Click, AddressOf PersonalSportSkillPagination_NextPage_Click + + AddHandler Me.PersonalSportSkillPagination.PageSizeButton.Click, AddressOf PersonalSportSkillPagination_PageSizeButton_Click + + AddHandler Me.PersonalSportSkillPagination.PreviousPage.Click, AddressOf PersonalSportSkillPagination_PreviousPage_Click + + + ' Setup the sorting events. + + AddHandler Me.LevelLabel5.Click, AddressOf LevelLabel5_Click + + AddHandler Me.SportIdLabel1.Click, AddressOf SportIdLabel1_Click + + ' Setup the button events. + + AddHandler Me.PersonalSportSkillExportCSVButton.Click, AddressOf PersonalSportSkillExportCSVButton_Click + + AddHandler Me.PersonalSportSkillExportExcelButton.Click, AddressOf PersonalSportSkillExportExcelButton_Click + + Me.PersonalSportSkillImportButton.PostBackUrl = "../Shared/SelectFileToImport.aspx?TableName=PersonalSportSkill" + Me.PersonalSportSkillImportButton.Attributes.Item("onClick") = "window.open('" & Me.Page.EncryptUrlParameter(Me.PersonalSportSkillImportButton.PostBackUrl) & "','importWindow', 'width=700, height=500,top=' +(screen.availHeight-500)/2 + ',left=' + (screen.availWidth-700)/2+ ', resizable=yes, scrollbars=yes,modal=yes'); return false;" + + AddHandler Me.PersonalSportSkillImportButton.Click, AddressOf PersonalSportSkillImportButton_Click + + AddHandler Me.PersonalSportSkillPDFButton.Click, AddressOf PersonalSportSkillPDFButton_Click + + AddHandler Me.PersonalSportSkillRefreshButton.Click, AddressOf PersonalSportSkillRefreshButton_Click + + AddHandler Me.PersonalSportSkillResetButton.Click, AddressOf PersonalSportSkillResetButton_Click + + AddHandler Me.PersonalSportSkillWordButton.Click, AddressOf PersonalSportSkillWordButton_Click + + + ' Setup events for others + + End Sub + + + Public Overridable Sub LoadData() + + ' Read data from database. Returns an array of records that can be assigned + ' to the DataSource table control property. + Try + Dim joinFilter As CompoundFilter = CreateCompoundJoinFilter() + + ' The WHERE clause will be empty when displaying all records in table. + Dim wc As WhereClause = CreateWhereClause() + If wc IsNot Nothing AndAlso Not wc.RunQuery Then + ' Initialize an empty array of records + Dim alist As New ArrayList(0) + Me.DataSource = DirectCast(alist.ToArray(GetType(PersonalSportSkillRecord)), PersonalSportSkillRecord()) + ' Add records to the list if needed. + Me.AddNewRecords() + Me._TotalRecords = 0 + Me._TotalPages = 0 + Return + End If + + ' Call OrderBy to determine the order - either use the order defined + ' on the Query Wizard, or specified by user (by clicking on column heading) + Dim orderBy As OrderBy = CreateOrderBy() + + ' Get the pagesize from the pagesize control. + Me.GetPageSize() + + If Me.DisplayLastPage Then + Dim totalRecords As Integer = If(Me._TotalRecords < 0, PersonalSportSkillTable.GetRecordCount(CreateCompoundJoinFilter(), CreateWhereClause()), Me._TotalRecords) + + Dim totalPages As Integer = CInt(Math.Ceiling(totalRecords / Me.PageSize)) + + Me.PageIndex = totalPages - 1 + End If + + ' Make sure PageIndex (current page) and PageSize are within bounds. + If Me.PageIndex < 0 Then + Me.PageIndex = 0 + End If + If Me.PageSize < 1 Then + Me.PageSize = 1 + End If + + ' Retrieve the records and set the table DataSource. + ' Only PageSize records are fetched starting at PageIndex (zero based). + If Me.AddNewRecord > 0 Then + ' Make sure to preserve the previously entered data on new rows. + Dim postdata As New ArrayList + For Each rc As PersonalSportSkillTableControlRow In Me.GetRecordControls() + If Not rc.IsNewRecord Then + rc.DataSource = rc.GetRecord() + rc.GetUIData() + postdata.Add(rc.DataSource) + UIData.Add(rc.PreservedUIData()) + End If + Next + Me.DataSource = DirectCast(postdata.ToArray(GetType(PersonalSportSkillRecord)), PersonalSportSkillRecord()) + Else ' Get the records from the database + Me.DataSource = PersonalSportSkillTable.GetRecords(joinFilter, wc, orderBy, Me.PageIndex, Me.PageSize) + + End If + + ' if the datasource contains no records contained in database, then load the last page. + If (DbUtils.GetCreatedRecords(Me.DataSource).Length = 0 AndAlso Not Me.DisplayLastPage) Then + Me.DisplayLastPage = True + LoadData() + Else + + ' Add any new rows desired by the user. + Me.AddNewRecords() + + + ' Initialize the page and grand totals. now + + End If + + Catch ex As Exception + ' Report the error message to the end user + Dim msg As String = ex.Message + If ex.InnerException IsNot Nothing Then + msg = msg & " InnerException: " & ex.InnerException.Message + End If + Throw New Exception(msg, ex.InnerException) + End Try + End Sub + + + + + Public Overrides Sub DataBind() + ' The DataBind method binds the user interface controls to the values + ' from the database record for each row in the table. To do this, it calls the + ' DataBind for each of the rows. + ' DataBind also populates any filters above the table, and sets the pagination + ' control to the correct number of records and the current page number. + + MyBase.DataBind() + + ' Make sure that the DataSource is initialized. + If Me.DataSource Is Nothing Then + Return + End If + + 'LoadData for DataSource for chart and report if they exist + + ' Improve performance by prefetching display as records. + Me.PreFetchForeignKeyValues() + + ' Setup the pagination controls. + BindPaginationControls() + + + + ' Bind the repeater with the list of records to expand the UI. + Dim rep As System.Web.UI.WebControls.Repeater = CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalSportSkillTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return + rep.DataSource = DataSource() + rep.DataBind() + + Dim index As Integer = 0 + For Each repItem As System.Web.UI.WebControls.RepeaterItem In rep.Items + ' Loop through all rows in the table, set its DataSource and call DataBind(). + Dim recControl As PersonalSportSkillTableControlRow = DirectCast(repItem.FindControl("PersonalSportSkillTableControlRow"), PersonalSportSkillTableControlRow) + recControl.DataSource = Me.DataSource(index) + If Me.UIData.Count > index Then + recControl.PreviousUIData = Me.UIData(index) + End If + recControl.DataBind() + recControl.Visible = Not Me.InDeletedRecordIds(recControl) + + index += 1 + Next + + + + + ' Call the Set methods for each controls on the panel + + SetLevelLabel5() + + + + + + + + SetPersonalSportSkillTableControlCollapsibleRegion() + + SetSportIdLabel1() + ' setting the state of expand or collapse alternative rows + + + ' Load data for each record and table UI control. + ' Ordering is important because child controls get + ' their parent ids from their parent UI controls. + + + ' this method calls the set method for controls with special formula like running total, sum, rank, etc + SetFormulaControls() + End Sub + + Public Overridable Sub SetFormulaControls() + ' this method calls Set methods for the control that has special formula + + + + End Sub + + + Public Sub PreFetchForeignKeyValues() + If (IsNothing(Me.DataSource)) + Return + End If + + Me.Page.PregetDfkaRecords(PersonalSportSkillTable.SportId, Me.DataSource) + + End Sub + + + Public Overridable Sub RegisterPostback() + + Me.Page.RegisterPostBackTrigger(MiscUtils.FindControlRecursively(Me,"PersonalSportSkillExportCSVButton")) + + Me.Page.RegisterPostBackTrigger(MiscUtils.FindControlRecursively(Me,"PersonalSportSkillExportExcelButton")) + + Me.Page.RegisterPostBackTrigger(MiscUtils.FindControlRecursively(Me,"PersonalSportSkillPDFButton")) + + Me.Page.RegisterPostBackTrigger(MiscUtils.FindControlRecursively(Me,"PersonalSportSkillWordButton")) + + + End Sub + + Public EvaluateFormulaDelegate As BaseClasses.Data.DataSource.EvaluateFormulaDelegate = New BaseClasses.Data.DataSource.EvaluateFormulaDelegate(AddressOf Me.EvaluateFormula) + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean, ByVal e as FormulaEvaluator) As String + If e Is Nothing + e = New FormulaEvaluator() + End If + + e.Variables.Clear() + + + ' add variables for formula evaluation + If variables IsNot Nothing Then + Dim enumerator As System.Collections.Generic.IEnumerator(Of System.Collections.Generic.KeyValuePair(Of String, Object)) = variables.GetEnumerator() + While enumerator.MoveNext() + e.Variables.Add(enumerator.Current.Key, enumerator.Current.Value) + End While + End If + + If includeDS + + End If + + ' All variables referred to in the formula are expected to be + ' properties of the DataSource. For example, referring to + ' UnitPrice as a variable will refer to DataSource.UnitPrice + e.DataSource = dataSourceForEvaluate + + ' Define the calling control. This is used to add other + ' related table and record controls as variables. + e.CallingControl = Me + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + + If Not String.IsNullOrEmpty(format) AndAlso (String.IsNullOrEmpty(formula) OrElse formula.IndexOf("Format(") < 0) Then + Return FormulaUtils.Format(resultObj, format) + Else + Return resultObj.ToString() + End If + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format,variables ,includeDS, Nothing) + End Function + + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object)) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format, variables ,True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, format, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal e as FormulaEvaluator) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, variables, True, e) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal includeDS as Boolean) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, includeDS, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, True, Nothing) + End Function + + + + + Public Overridable Sub ResetControl() + + Me.CurrentSortOrder.Reset() + If (Me.InSession(Me, "Order_By")) Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + End If + + Me.PageIndex = 0 + End Sub + + Protected Overridable Sub BindPaginationControls() + ' Setup the pagination controls. + + ' Bind the pagination labels. + + If DbUtils.GetCreatedRecords(Me.DataSource).Length > 0 Then + + Me.PersonalSportSkillPagination.CurrentPage.Text = (Me.PageIndex + 1).ToString() + Else + Me.PersonalSportSkillPagination.CurrentPage.Text = "0" + End If + Me.PersonalSportSkillPagination.PageSize.Text = Me.PageSize.ToString() + Me.PersonalSportSkillPagination.TotalItems.Text = Me.TotalRecords.ToString() + Me.PersonalSportSkillPagination.TotalPages.Text = Me.TotalPages.ToString() + + ' Bind the buttons for PersonalSportSkillTableControl pagination. + + Me.PersonalSportSkillPagination.FirstPage.Enabled = Not (Me.PageIndex = 0) + If Me._TotalPages < 0 Then ' if the total pages is not determined yet, enable last and next buttons + Me.PersonalSportSkillPagination.LastPage.Enabled = True + ElseIf Me._TotalPages = 0 ' if the total pages is determined and it is 0, enable last and next buttons + Me.PersonalSportSkillPagination.LastPage.Enabled = False + Else ' if the total pages is the last page, disable last and next buttons + Me.PersonalSportSkillPagination.LastPage.Enabled = Not (Me.PageIndex = Me.TotalPages - 1) + End If + + If Me._TotalPages < 0 Then ' if the total pages is not determined yet, enable last and next buttons + Me.PersonalSportSkillPagination.NextPage.Enabled = True + ElseIf Me._TotalPages = 0 ' if the total pages is determined and it is 0, enable last and next buttons + Me.PersonalSportSkillPagination.NextPage.Enabled = False + Else ' if the total pages is the last page, disable last and next buttons + Me.PersonalSportSkillPagination.NextPage.Enabled = Not (Me.PageIndex = Me.TotalPages - 1) + End If + + Me.PersonalSportSkillPagination.PreviousPage.Enabled = Not (Me.PageIndex = 0) + + + End Sub + + Public Overridable Sub SaveData() + ' Save the data from the entire table. Calls each row's Save Data + ' to save their data. This function is called by the Click handler of the + ' Save button. The button handler should Start/Commit/End a transaction. + + Dim recCtl As PersonalSportSkillTableControlRow + For Each recCtl In Me.GetRecordControls() + + If Me.InDeletedRecordIds(recCtl) Then + ' Delete any pending deletes. + recCtl.Delete() + Else + If recCtl.Visible Then + recCtl.SaveData() + End If + End If + + Next + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + ' Set IsNewRecord to False for all records - since everything has been saved and is no longer "new" + For Each recCtl In Me.GetRecordControls() + recCtl.IsNewRecord = False + Next + + + ' Set DeletedRecordsIds to Nothing since we have deleted all pending deletes. + Me.DeletedRecordIds = Nothing + + End Sub + + Public Overridable Function CreateCompoundJoinFilter() As CompoundFilter + Dim jFilter As CompoundFilter = New CompoundFilter() + + Return jFilter + + End Function + + + Public Overridable Function CreateOrderBy() As OrderBy + ' The CurrentSortOrder is initialized to the sort order on the + ' Query Wizard. It may be modified by the Click handler for any of + ' the column heading to sort or reverse sort by that column. + ' You can add your own sort order, or modify it on the Query Wizard. + Return Me.CurrentSortOrder + End Function + + Public Overridable Function CreateWhereClause() As WhereClause + 'This CreateWhereClause is used for loading the data. + PersonalSportSkillTable.Instance.InnerFilter = Nothing + Dim wc As WhereClause = New WhereClause() + + ' Compose the WHERE clause consiting of: + ' 1. Static clause defined at design time. + ' 2. User selected search criteria. + ' 3. User selected filter criteria. + + + Dim selectedRecordKeyValue as KeyValue = New KeyValue() + + Dim personalIdRecordControlObj As Persons.UI.Controls.ShowPersonalId.PersonalIdRecordControl = DirectCast(MiscUtils.FindControlRecursively(Me.Page, "PersonalIdRecordControl"), Persons.UI.Controls.ShowPersonalId.PersonalIdRecordControl) + + If (Not IsNothing(personalIdRecordControlObj) AndAlso Not IsNothing(personalIdRecordControlObj.GetRecord()) AndAlso personalIdRecordControlObj.GetRecord().IsCreated AndAlso Not IsNothing(personalIdRecordControlObj.GetRecord().PersonalId)) + wc.iAND(PersonalSportSkillTable.PersonalId, BaseFilter.ComparisonOperator.EqualsTo, personalIdRecordControlObj.GetRecord().PersonalId.ToString()) + selectedRecordKeyValue.AddElement(PersonalSportSkillTable.PersonalId.InternalName, personalIdRecordControlObj.GetRecord().PersonalId.ToString()) + Else + wc.RunQuery = False + Return wc + End If + + HttpContext.Current.Session("PersonalSportSkillTableControlWhereClause") = selectedRecordKeyValue.ToXmlString() + + Return wc + End Function + + + Public Overridable Function CreateWhereClause(ByVal searchText as String, ByVal fromSearchControl as String, ByVal AutoTypeAheadSearch as String, ByVal AutoTypeAheadWordSeparators as String) As WhereClause + ' This CreateWhereClause is used for loading list of suggestions for Auto Type-Ahead feature. + PersonalSportSkillTable.Instance.InnerFilter = Nothing + Dim wc As WhereClause = New WhereClause() + + ' Compose the WHERE clause consiting of: + ' 1. Static clause defined at design time. + ' 2. User selected search criteria. + ' 3. User selected filter criteria. + + Dim appRelativeVirtualPath As String = CType(HttpContext.Current.Session("AppRelativeVirtualPath"), String) + + Dim selectedRecordInPersonalIdRecordControl as String = DirectCast(HttpContext.Current.Session("PersonalSportSkillTableControlWhereClause"), String) + + If Not selectedRecordInPersonalIdRecordControl Is Nothing AndAlso KeyValue.IsXmlKey(selectedRecordInPersonalIdRecordControl) Then + Dim selectedRecordKeyValue as KeyValue = KeyValue.XmlToKey(selectedRecordInPersonalIdRecordControl) + + If Not IsNothing(selectedRecordKeyValue) AndAlso selectedRecordKeyValue.ContainsColumn(PersonalSportSkillTable.PersonalId) Then + wc.iAND(PersonalSportSkillTable.PersonalId, BaseFilter.ComparisonOperator.EqualsTo, selectedRecordKeyValue.GetColumnValue(PersonalSportSkillTable.PersonalId).ToString()) + End If + + End If + + ' Adds clauses if values are selected in Filter controls which are configured in the page. + + + Return wc + End Function + + + Public Overridable Function FormatSuggestions(ByVal prefixText As String, ByVal resultItem As String, _ + ByVal columnLength As Integer, ByVal AutoTypeAheadDisplayFoundText As String, _ + ByVal autoTypeAheadSearch As String, ByVal AutoTypeAheadWordSeparators As String, _ + ByVal resultList As ArrayList) As Boolean + + 'Formats the resultItem and adds it to the list of suggestions. + Dim index As Integer = resultItem.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture).IndexOf(prefixText.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture)) + Dim itemToAdd As String = "" + Dim isFound As Boolean = False + Dim isAdded As Boolean = False + ' Get the index where prfixt is at the beginning of resultItem. If not found then, index of word which begins with prefixText. + If InvariantLCase(autoTypeAheadSearch).equals("wordsstartingwithsearchstring") And Not index = 0 Then + ' Expression to find word which contains AutoTypeAheadWordSeparators followed by prefixText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex( AutoTypeAheadWordSeparators + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + If regex1.IsMatch(resultItem) Then + index = regex1.Match(resultItem).Index + isFound = True + End If + ' If the prefixText is found immediatly after white space then starting of the word is found so don not search any further + If not resultItem(index).ToString() = " " Then + ' Expression to find beginning of the word which contains AutoTypeAheadWordSeparators followed by prefixText + Dim regex As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\\S*" + AutoTypeAheadWordSeparators + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + If regex.IsMatch(resultItem) Then + index = regex.Match(resultItem).Index + isFound = True + End If + End If + End If + + ' If autoTypeAheadSearch value is wordsstartingwithsearchstring then, extract the substring only if the prefixText is found at the + ' beginning of the resultItem (index = 0) or a word in resultItem is found starts with prefixText. + If index = 0 Or isFound Or InvariantLCase(autoTypeAheadSearch).Equals("anywhereinstring") then + If InvariantLCase(AutoTypeAheadDisplayFoundText).equals("atbeginningofmatchedstring") Then + ' Expression to find beginning of the word which contains prefixText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\\S*" + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + ' Find the beginning of the word which contains prefexText + If (StringUtils.InvariantLCase(autoTypeAheadSearch).Equals("anywhereinstring") AndAlso regex1.IsMatch(resultItem)) Then + index = regex1.Match(resultItem).Index + isFound = True + End If + ' Display string from the index till end of the string if sub string from index till end is less than columnLength value. + If Len(resultItem) - index <= columnLength Then + If index = 0 Then + itemToAdd = resultItem + Else + itemToAdd = "..." & resultItem.Substring(index, Len(resultItem) - index) + End If + Else + If index = 0 Then + itemToAdd = resultItem.Substring(index, (columnLength - 3)) & "..." + Else + 'Truncate the string to show only columnLength - 6 characters as begining and trailing "..." has to be appended. + itemToAdd = "..." & resultItem.Substring(index , columnLength - 6) & "..." + End If + End If + ElseIf InvariantLCase(AutoTypeAheadDisplayFoundText).equals("inmiddleofmatchedstring") Then + Dim subStringBeginIndex As Integer = CType(columnLength/2, Integer) + If Len(resultItem) <= columnLength Then + itemToAdd = resultItem + Else + ' Sanity check at end of the string + If index + Len(prefixText) = columnLength Then + itemToAdd = "..." & resultItem.Substring(index-columnLength,index) + ElseIf Len(resultItem) - index < subStringBeginIndex Then + ' Display string from the end till columnLength value if, index is closer to the end of the string. + itemToAdd = "..." & resultItem.Substring(Len(resultItem)-columnLength,Len(resultItem)) + ElseIf index <= subStringBeginIndex Then + ' Sanity chet at beginning of the string + itemToAdd = resultItem.Substring(0, columnLength) & "..." + Else + ' Display string containing text before the prefixText occures and text after the prefixText + itemToAdd = "..." & resultItem.Substring(index - subStringBeginIndex, columnLength) & "..." + End If + End If + ElseIf InvariantLCase(AutoTypeAheadDisplayFoundText).equals("atendofmatchedstring") Then + ' Expression to find ending of the word which contains prefexText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\s", System.Text.RegularExpressions.RegexOptions.IgnoreCase) + ' Find the ending of the word which contains prefexText + If regex1.IsMatch(resultItem, index + 1) Then + index = regex1.Match(resultItem, index + 1).Index + Else + ' If the word which contains prefexText is the last word in string, regex1.IsMatch returns false. + index = resultItem.Length + End If + If index > Len(resultItem) Then + index = Len(resultItem) + End If + ' If text from beginning of the string till index is less than columnLength value then, display string from the beginning till index. + If index <= columnLength Then + if index = Len(resultItem) Then 'Make decision to append "..." + itemToAdd = resultItem.Substring(0,index) + Else + itemToAdd = resultItem.Substring(0,index) & "..." + End If + Else + If index = Len(resultItem) Then + itemToAdd = "..." & resultItem.Substring(index - (columnLength - 3), (columnLength - 3)) + Else + 'Truncate the string to show only columnLength - 6 characters as begining and trailing "..." has to be appended. + itemToAdd = "..." & resultItem.Substring(index - (columnLength - 6), columnLength - 6) & "..." + End If + End If + End If + + ' Remove newline character from itemToAdd + Dim prefixTextIndex As Integer = itemToAdd.IndexOf(prefixText, StringComparison.CurrentCultureIgnoreCase) + ' If itemToAdd contains any newline after the search text then show text only till newline + Dim regex2 As System.Text.RegularExpressions.Regex = New System.Text.RegularExpressions.Regex("(" & vbCrLf & "|" & vbLf & ")", System.Text.RegularExpressions.RegexOptions.IgnoreCase) + Dim newLineIndexAfterPrefix As Integer = -1 + If regex2.IsMatch(itemToAdd, prefixTextIndex) Then + newLineIndexAfterPrefix = regex2.Match(itemToAdd, prefixTextIndex).Index + End If + If (newLineIndexAfterPrefix > -1) Then + If itemToAdd.EndsWith("...") Then + itemToAdd = (itemToAdd.Substring(0, newLineIndexAfterPrefix) + "...") + Else + itemToAdd = itemToAdd.Substring(0, newLineIndexAfterPrefix) + End If + End If + ' If itemToAdd contains any newline before search text then show text which comes after newline + Dim regex3 As System.Text.RegularExpressions.Regex = New System.Text.RegularExpressions.Regex("(" & vbCrLf & "|" & vbLf & ")", (System.Text.RegularExpressions.RegexOptions.IgnoreCase Or System.Text.RegularExpressions.RegexOptions.RightToLeft)) + Dim newLineIndexBeforePrefix As Integer = -1 + If regex3.IsMatch(itemToAdd, prefixTextIndex) Then + newLineIndexBeforePrefix = regex3.Match(itemToAdd, prefixTextIndex).Index + End If + If (newLineIndexBeforePrefix > -1) Then + If itemToAdd.StartsWith("...") Then + itemToAdd = ("..." + itemToAdd.Substring((newLineIndexBeforePrefix + regex3.Match(itemToAdd, prefixTextIndex).Length))) + Else + itemToAdd = itemToAdd.Substring((newLineIndexBeforePrefix + regex3.Match(itemToAdd, prefixTextIndex).Length)) + End If + End If + + If Not itemToAdd is nothing AndAlso Not resultList.Contains(itemToAdd) Then + + resultList.Add(itemToAdd) + + isAdded = true + End If + End If + Return isAdded + End Function + + + Protected Overridable Sub GetPageSize() + + If Me.PersonalSportSkillPagination.PageSize.Text.Trim <> "" Then + Try + 'Me.PageSize = Integer.Parse(Me.PersonalSportSkillPagination.PageSize.Text) + Catch ex As Exception + End Try + End If + End Sub + + Protected Overridable Sub AddNewRecords() + + Dim newRecordList As ArrayList = New ArrayList() + + Dim newUIDataList As System.Collections.Generic.List(Of Hashtable) = New System.Collections.Generic.List(Of Hashtable)() + + ' Loop though all the record controls and if the record control + ' does not have a unique record id set, then create a record + ' and add to the list. + If Not Me.ResetData Then + Dim rep As System.Web.UI.WebControls.Repeater = CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalSportSkillTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return + + Dim repItem As System.Web.UI.WebControls.RepeaterItem + For Each repItem In rep.Items + ' Loop through all rows in the table, set its DataSource and call DataBind(). + + Dim recControl As PersonalSportSkillTableControlRow = DirectCast(repItem.FindControl("PersonalSportSkillTableControlRow"), PersonalSportSkillTableControlRow) + + If recControl.Visible AndAlso recControl.IsNewRecord() Then + + Dim rec As PersonalSportSkillRecord = New PersonalSportSkillRecord() + + If recControl.Level2.Text <> "" Then + rec.Parse(recControl.Level2.Text, PersonalSportSkillTable.Level) + End If + If recControl.SportId.Text <> "" Then + rec.Parse(recControl.SportId.Text, PersonalSportSkillTable.SportId) + End If + newUIDataList.Add(recControl.PreservedUIData()) + newRecordList.Add(rec) + End If + Next + End If + + + ' Add any new record to the list. + Dim index As Integer = 0 + For index = 1 To Me.AddNewRecord + + newRecordList.Insert(0, New PersonalSportSkillRecord()) + newUIDataList.Insert(0, New Hashtable()) + + Next + Me.AddNewRecord = 0 + + ' Finally, add any new records to the DataSource. + If newRecordList.Count > 0 Then + + Dim finalList As ArrayList = New ArrayList(Me.DataSource) + finalList.InsertRange(0, newRecordList) + + Me.DataSource = DirectCast(finalList.ToArray(GetType(PersonalSportSkillRecord)), PersonalSportSkillRecord()) + + End If + + ' Add the existing UI data to this hash table + If newUIDataList.Count > 0 Then + Me.UIData.InsertRange(0, newUIDataList) + End If + + End Sub + + + Public Sub AddToDeletedRecordIds(ByVal rec As PersonalSportSkillTableControlRow) + If rec.IsNewRecord() Then + Return + End If + + If Not Me.DeletedRecordIds Is Nothing AndAlso Me.DeletedRecordIds.Trim <> "" Then + Me.DeletedRecordIds &= "," + End If + + Me.DeletedRecordIds &= "[" & rec.RecordUniqueId & "]" + End Sub + + Protected Overridable Function InDeletedRecordIds(ByVal rec As PersonalSportSkillTableControlRow) As Boolean + If Me.DeletedRecordIds Is Nothing OrElse Me.DeletedRecordIds.Trim = "" Then + Return False + End If + + Return Me.DeletedRecordIds.IndexOf("[" & rec.RecordUniqueId & "]") >= 0 + End Function + + Private _DeletedRecordIds As String + Public Property DeletedRecordIds() As String + Get + Return Me._DeletedRecordIds + End Get + Set(ByVal value As String) + Me._DeletedRecordIds = value + End Set + End Property + + + ' Create Set, WhereClause, and Populate Methods + + Public Overridable Sub SetLevelLabel5() + + End Sub + + Public Overridable Sub SetPersonalSportSkillTableControlCollapsibleRegion() + + End Sub + + Public Overridable Sub SetSportIdLabel1() + + End Sub + + + + + Protected Overridable Sub Control_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.PreRender + ' PreRender event is raised just before page is being displayed. + Try + DbUtils.StartTransaction + Me.RegisterPostback() + + If Not Me.Page.ErrorOnPage AndAlso (Me.Page.IsPageRefresh OrElse Me.DataChanged OrElse Me.ResetData) Then + + + ' Re-load the data and update the web page if necessary. + ' This is typically done during a postback (filter, search button, sort, pagination button). + ' In each of the other click handlers, simply set DataChanged to True to reload the data. + + Me.LoadData() + Me.DataBind() + + End If + + + + Catch ex As Exception + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + Finally + DbUtils.EndTransaction + End Try + End Sub + + + Protected Overrides Sub SaveControlsToSession() + MyBase.SaveControlsToSession() + + ' Save filter controls to values to session. + + + 'Save pagination state to session. + + + + ' Save table control properties to the session. + If Not Me.CurrentSortOrder Is Nothing Then + Me.SaveToSession(Me, "Order_By", Me.CurrentSortOrder.ToXmlString()) + End If + + Me.SaveToSession(Me, "Page_Index", Me.PageIndex.ToString()) + Me.SaveToSession(Me, "Page_Size", Me.PageSize.ToString()) + + Me.SaveToSession(Me, "DeletedRecordIds", Me.DeletedRecordIds) + + End Sub + + Protected Sub SaveControlsToSession_Ajax() + ' Save filter controls to values to session. + + HttpContext.Current.Session("AppRelativeVirtualPath") = Me.Page.AppRelativeVirtualPath + + End Sub + + Protected Overrides Sub ClearControlsFromSession() + MyBase.ClearControlsFromSession() + + ' Clear filter controls values from the session. + + + ' Clear pagination state from session. + + + + ' Clear table properties from the session. + Me.RemoveFromSession(Me, "Order_By") + Me.RemoveFromSession(Me, "Page_Index") + Me.RemoveFromSession(Me, "Page_Size") + + Me.RemoveFromSession(Me, "DeletedRecordIds") + + End Sub + + Protected Overrides Sub LoadViewState(ByVal savedState As Object) + MyBase.LoadViewState(savedState) + + Dim orderByStr As String = CType(ViewState("PersonalSportSkillTableControl_OrderBy"), String) + + If orderByStr IsNot Nothing AndAlso orderByStr.Trim <> "" Then + Me.CurrentSortOrder = BaseClasses.Data.OrderBy.FromXmlString(orderByStr) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + End If + + Dim pageIndex As String = CType(ViewState("Page_Index"), String) + If pageIndex IsNot Nothing Then + Me.PageIndex = CInt(pageIndex) + End If + + Dim pageSize As String = CType(ViewState("Page_Size"), String) + If Not pageSize Is Nothing Then + Me.PageSize = CInt(pageSize) + End If + + + + ' Load view state for pagination control. + + Me.DeletedRecordIds = CType(Me.ViewState("DeletedRecordIds"), String) + + End Sub + + Protected Overrides Function SaveViewState() As Object + + If Me.CurrentSortOrder IsNot Nothing Then + Me.ViewState("PersonalSportSkillTableControl_OrderBy") = Me.CurrentSortOrder.ToXmlString() + End If + + Me.ViewState("Page_Index") = Me.PageIndex + Me.ViewState("Page_Size") = Me.PageSize + + Me.ViewState("DeletedRecordIds") = Me.DeletedRecordIds + + + ' Load view state for pagination control. + + + Return MyBase.SaveViewState() + End Function + + ' Generate the event handling functions for pagination events. + + ' event handler for ImageButton + Public Overridable Sub PersonalSportSkillPagination_FirstPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.PageIndex = 0 + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalSportSkillPagination_LastPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.DisplayLastPage = True + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalSportSkillPagination_NextPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.PageIndex += 1 + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for LinkButton + Public Overridable Sub PersonalSportSkillPagination_PageSizeButton_Click(ByVal sender As Object, ByVal args As EventArgs) + + Try + + Me.DataChanged = True + + Me.PageSize = Integer.Parse(Me.PersonalSportSkillPagination.PageSize.Text) + + Me.PageIndex = Integer.Parse(Me.PersonalSportSkillPagination.CurrentPage.Text) - 1 + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalSportSkillPagination_PreviousPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + If Me.PageIndex > 0 Then + Me.PageIndex -= 1 + Me.DataChanged = True + End If + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + + ' Generate the event handling functions for sorting events. + + Public Overridable Sub LevelLabel5_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by Level when clicked. + + ' Get previous sorting state for Level. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalSportSkillTable.Level) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for Level. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalSportSkillTable.Level, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by Level, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub SportIdLabel1_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by SportId when clicked. + + ' Get previous sorting state for SportId. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalSportSkillTable.SportId) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for SportId. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalSportSkillTable.SportId, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by SportId, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + + ' Generate the event handling functions for button events. + + ' event handler for ImageButton + Public Overridable Sub PersonalSportSkillExportCSVButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + ' Build the where clause based on the current filter and search criteria + ' Create the Order By clause based on the user's current sorting preference. + + Dim wc As WhereClause = CreateWhereClause + Dim orderBy As OrderBy = Nothing + + orderBy = CreateOrderBy + + ' Add each of the columns in order of export. + Dim columns() as BaseColumn = New BaseColumn() { _ + PersonalSportSkillTable.SportId, _ + PersonalSportSkillTable.Level, _ + Nothing} + Dim exportData as ExportDataToCSV = New ExportDataToCSV(PersonalSportSkillTable.Instance, wc, orderBy, columns) + + Dim done As Boolean = False + + Dim totalRowsReturned As Integer = 0 + Dim join As CompoundFilter = CreateCompoundJoinFilter() + Dim data As DataForExport = New DataForExport(PersonalSportSkillTable.Instance, wc, orderBy, columns, join) + + 'Check for Export Data Threshold + Dim exportRawValues As Boolean = False + Me.TotalRecords = PersonalSportSkillTable.GetRecordCount(join, wc) + If Me.TotalRecords > 10000 Then + exportRawValues = True + End If + exportData.StartExport(Me.Page.Response, exportRawValues) + + ' Read pageSize records at a time and write out the CSV file. + While (Not done) + Dim recList As ArrayList = data.GetRows(exportData.pageSize) + If recList Is Nothing Then + Exit While 'no more records we are done + End If + + totalRowsReturned = recList.Count + For Each rec As BaseRecord In recList + For Each col As BaseColumn In data.ColumnList + If col Is Nothing Then + Continue For + End If + + If Not data.IncludeInExport(col) Then + Continue For + End If + + Dim val As String = "" + + If exportRawValues Then + val = rec.GetValue(col).ToString() + Else + Dim _isExpandableNonCompositeForeignKey As Boolean = col.TableDefinition.IsExpandableNonCompositeForeignKey(col) + If _isExpandableNonCompositeForeignKey AndAlso col.IsApplyDisplayAs Then + val = PersonalSportSkillTable.GetDFKA(rec.GetValue(col).ToString(), col, Nothing) + End If + If (Not _isExpandableNonCompositeForeignKey) Or (String.IsNullOrEmpty(val)) Then + val = exportData.GetDataForExport(col, rec) + End If + End If + exportData.WriteColumnData(val, data.IsString(col)) + + Next col + exportData.WriteNewRow() + Next rec + + ' If we already are below the pageSize, then we are done. + If totalRowsReturned < exportData.pageSize Then + done = True + End If + End While + exportData.FinishExport(Me.Page.Response) + + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalSportSkillExportExcelButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + ' To customize the columns or the format, override this function in Section 1 of the page + ' and modify it to your liking. + ' Build the where clause based on the current filter and search criteria + ' Create the Order By clause based on the user's current sorting preference. + + Dim wc As WhereClause = CreateWhereClause + Dim orderBy As OrderBy = Nothing + + orderBy = CreateOrderBy + + Dim done As Boolean = False + Dim val As Object = "" + ' Read pageSize records at a time and write out the Excel file. + Dim totalRowsReturned As Integer = 0 + + Me.TotalRecords = PersonalSportSkillTable.GetRecordCount(wc) + If Me.TotalRecords > 10000 Then + + ' Add each of the columns in order of export. + Dim columns() as BaseColumn = New BaseColumn() { _ + PersonalSportSkillTable.SportId, _ + PersonalSportSkillTable.Level, _ + Nothing} + Dim exportData as ExportDataToCSV = New ExportDataToCSV(PersonalSportSkillTable.Instance, wc, orderBy, columns) + exportData.StartExport(Me.Page.Response, True) + + Dim dataForCSV As DataForExport = New DataForExport(PersonalSportSkillTable.Instance, wc, orderBy, columns) + + ' Read pageSize records at a time and write out the CSV file. + While (Not done) + Dim recList As ArrayList = dataForCSV.GetRows(exportData.pageSize) + If recList Is Nothing Then + Exit While 'no more records we are done + End If + + totalRowsReturned = recList.Count + For Each rec As BaseRecord In recList + For Each col As BaseColumn In dataForCSV.ColumnList + If col Is Nothing Then + Continue For + End If + + If Not dataForCSV.IncludeInExport(col) Then + Continue For + End If + + val = rec.GetValue(col).ToString() + exportData.WriteColumnData(val, dataForCSV.IsString(col)) + + Next col + exportData.WriteNewRow() + Next rec + + ' If we already are below the pageSize, then we are done. + If totalRowsReturned < exportData.pageSize Then + done = True + End If + End While + exportData.FinishExport(Me.Page.Response) + Else + + ' Create an instance of the Excel report class with the table class, where clause and order by. + Dim excelReport As ExportDataToExcel = New ExportDataToExcel(PersonalSportSkillTable.Instance, wc, orderBy) + ' Add each of the columns in order of export. + ' To customize the data type, change the second parameter of the new ExcelColumn to be + ' a format string from Excel's Format Cell menu. For example "dddd, mmmm dd, yyyy h:mm AM/PM;@", "#,##0.00" + + If Me.Page.Response Is Nothing Then + Return + End If + + excelReport.CreateExcelBook() + + Dim width As Integer = 0 + Dim columnCounter As Integer = 0 + Dim data As DataForExport = New DataForExport(PersonalSportSkillTable.Instance, wc, orderBy, Nothing) + data.ColumnList.Add(New ExcelColumn(PersonalSportSkillTable.SportId, "Default")) + data.ColumnList.Add(New ExcelColumn(PersonalSportSkillTable.Level, "Default")) + + + For Each col As ExcelColumn In data.ColumnList + width = excelReport.GetExcelCellWidth(col) + If data.IncludeInExport(col) Then + excelReport.AddColumnToExcelBook(columnCounter, col.ToString(), excelReport.GetExcelDataType(col), width, excelReport.GetDisplayFormat(col)) + columnCounter = columnCounter + 1 + End If + Next col + + While (Not done) + Dim recList As ArrayList = data.GetRows(excelReport.pageSize) + + If recList Is Nothing Then + Exit While 'no more records we are done + End If + + totalRowsReturned = recList.Count + + For Each rec As BaseRecord In recList + excelReport.AddRowToExcelBook() + columnCounter = 0 + + For Each col As ExcelColumn In data.ColumnList + If Not data.IncludeInExport(col) Then + Continue For + End If + + Dim _isExpandableNonCompositeForeignKey As Boolean = col.DisplayColumn.TableDefinition.IsExpandableNonCompositeForeignKey(col.DisplayColumn) + If _isExpandableNonCompositeForeignKey AndAlso col.DisplayColumn.IsApplyDisplayAs Then + val = PersonalSportSkillTable.GetDFKA(rec.GetValue(col.DisplayColumn).ToString(), col.DisplayColumn, Nothing) + If val Is Nothing Then + val = rec.Format(col.DisplayColumn) + End If + Else + val = excelReport.GetValueForExcelExport(col, rec) + End If + excelReport.AddCellToExcelRow(columnCounter, excelReport.GetExcelDataType(col), val, col.DisplayFormat) + + columnCounter = columnCounter + 1 + Next col + Next rec + + ' If we already are below the pageSize, then we are done. + If totalRowsReturned < excelReport.pageSize Then + done = True + End If + End While + + excelReport.SaveExcelBook(Me.Page.Response) + End If + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalSportSkillImportButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalSportSkillPDFButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + Dim report As PDFReport = New PDFReport() + report.SpecificReportFileName = Page.Server.MapPath("ShowPersonalId.PersonalSportSkillPDFButton.report") + ' report.Title replaces the value tag of page header and footer containing ${ReportTitle} + report.Title = "PersonalSportSkill" + ' If ShowPersonalId.PersonalSportSkillPDFButton.report specifies a valid report template, + ' AddColumn method will generate a report template. + ' Each AddColumn method-call specifies a column + ' The 1st parameter represents the text of the column header + ' The 2nd parameter represents the horizontal alignment of the column header + ' The 3rd parameter represents the text format of the column detail + ' The 4th parameter represents the horizontal alignment of the column detail + ' The 5th parameter represents the relative width of the column + report.AddColumn(PersonalSportSkillTable.SportId.Name, ReportEnum.Align.Left, "${SportId}", ReportEnum.Align.Left, 20) + report.AddColumn(PersonalSportSkillTable.Level.Name, ReportEnum.Align.Left, "${Level}", ReportEnum.Align.Left, 30) + + + Dim rowsPerQuery As Integer = 5000 + Dim recordCount As Integer = 0 + + report.Page = Page.GetResourceValue("Txt:Page", "Persons") + report.ApplicationPath = Me.Page.MapPath(Page.Request.ApplicationPath) + + Dim whereClause As WhereClause = CreateWhereClause + Dim orderBy As OrderBy = CreateOrderBy + Dim joinFilter As BaseFilter = CreateCompoundJoinFilter() + + Dim pageNum As Integer = 0 + Dim totalRows As Integer = PersonalSportSkillTable.GetRecordCount(joinFilter,whereClause) + Dim columns As ColumnList = PersonalSportSkillTable.GetColumnList() + Dim records As PersonalSportSkillRecord() = Nothing + + Do + + records = PersonalSportSkillTable.GetRecords(joinFilter,whereClause, orderBy, pageNum, rowsPerQuery) + If Not (records Is Nothing) AndAlso records.Length > 0 AndAlso whereClause.RunQuery Then + For Each record As PersonalSportSkillRecord In records + + ' AddData method takes four parameters + ' The 1st parameters represent the data format + ' The 2nd parameters represent the data value + ' The 3rd parameters represent the default alignment of column using the data + ' The 4th parameters represent the maximum length of the data value being shown + If BaseClasses.Utils.MiscUtils.IsNull(record.SportId) Then + report.AddData("${SportId}", "",ReportEnum.Align.Left, 100) + Else + Dim _isExpandableNonCompositeForeignKey as Boolean + Dim _DFKA as String = "" + _isExpandableNonCompositeForeignKey = PersonalSportSkillTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalSportSkillTable.SportId) + _DFKA = PersonalSportSkillTable.GetDFKA(record.SportId.ToString(), PersonalSportSkillTable.SportId,Nothing) + If _isExpandableNonCompositeForeignKey AndAlso (not _DFKA Is Nothing) AndAlso PersonalSportSkillTable.SportId.IsApplyDisplayAs Then + report.AddData("${SportId}", _DFKA,ReportEnum.Align.Left, 100) + Else + report.AddData("${SportId}", record.Format(PersonalSportSkillTable.SportId), ReportEnum.Align.Left, 100) + End If + End If + report.AddData("${Level}", record.Format(PersonalSportSkillTable.Level), ReportEnum.Align.Left, 100) + + report.WriteRow + Next + pageNum = pageNum + 1 + recordCount += records.Length + End If + Loop While Not (records Is Nothing) AndAlso recordCount < totalRows AndAlso whereClause.RunQuery + + report.Close + BaseClasses.Utils.NetUtils.WriteResponseBinaryAttachment(Me.Page.Response, report.Title + ".pdf", report.ReportInByteArray, 0, true) + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalSportSkillRefreshButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Dim PersonalDDTableControlObj as PersonalDDTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalDDTableControl"), PersonalDDTableControl) + PersonalDDTableControlObj.ResetData = True + + PersonalDDTableControlObj.RemoveFromSession(PersonalDDTableControlObj, "DeletedRecordIds") + PersonalDDTableControlObj.DeletedRecordIds = Nothing + + Dim PersonalEducationTableControlObj as PersonalEducationTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalEducationTableControl"), PersonalEducationTableControl) + PersonalEducationTableControlObj.ResetData = True + + PersonalEducationTableControlObj.RemoveFromSession(PersonalEducationTableControlObj, "DeletedRecordIds") + PersonalEducationTableControlObj.DeletedRecordIds = Nothing + + Dim PersonalExtWorkTableControlObj as PersonalExtWorkTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalExtWorkTableControl"), PersonalExtWorkTableControl) + PersonalExtWorkTableControlObj.ResetData = True + + PersonalExtWorkTableControlObj.RemoveFromSession(PersonalExtWorkTableControlObj, "DeletedRecordIds") + PersonalExtWorkTableControlObj.DeletedRecordIds = Nothing + + Dim PersonalIdRecordControlObj as PersonalIdRecordControl = DirectCast(Me.Page.FindControlRecursively("PersonalIdRecordControl"), PersonalIdRecordControl) + PersonalIdRecordControlObj.ResetData = True + + + Dim PersonalInsigniaTableControlObj as PersonalInsigniaTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalInsigniaTableControl"), PersonalInsigniaTableControl) + PersonalInsigniaTableControlObj.ResetData = True + + PersonalInsigniaTableControlObj.RemoveFromSession(PersonalInsigniaTableControlObj, "DeletedRecordIds") + PersonalInsigniaTableControlObj.DeletedRecordIds = Nothing + + Dim PersonalLanguageSkillTableControlObj as PersonalLanguageSkillTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalLanguageSkillTableControl"), PersonalLanguageSkillTableControl) + PersonalLanguageSkillTableControlObj.ResetData = True + + PersonalLanguageSkillTableControlObj.RemoveFromSession(PersonalLanguageSkillTableControlObj, "DeletedRecordIds") + PersonalLanguageSkillTableControlObj.DeletedRecordIds = Nothing + + Dim PersonalNameTableControlObj as PersonalNameTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalNameTableControl"), PersonalNameTableControl) + PersonalNameTableControlObj.ResetData = True + + PersonalNameTableControlObj.RemoveFromSession(PersonalNameTableControlObj, "DeletedRecordIds") + PersonalNameTableControlObj.DeletedRecordIds = Nothing + + Dim PersonalRankTableControlObj as PersonalRankTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalRankTableControl"), PersonalRankTableControl) + PersonalRankTableControlObj.ResetData = True + + PersonalRankTableControlObj.RemoveFromSession(PersonalRankTableControlObj, "DeletedRecordIds") + PersonalRankTableControlObj.DeletedRecordIds = Nothing + + Dim PersonalSalaryTableControlObj as PersonalSalaryTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalSalaryTableControl"), PersonalSalaryTableControl) + PersonalSalaryTableControlObj.ResetData = True + + PersonalSalaryTableControlObj.RemoveFromSession(PersonalSalaryTableControlObj, "DeletedRecordIds") + PersonalSalaryTableControlObj.DeletedRecordIds = Nothing + + Dim PersonalSpecialSkillTableControlObj as PersonalSpecialSkillTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalSpecialSkillTableControl"), PersonalSpecialSkillTableControl) + PersonalSpecialSkillTableControlObj.ResetData = True + + PersonalSpecialSkillTableControlObj.RemoveFromSession(PersonalSpecialSkillTableControlObj, "DeletedRecordIds") + PersonalSpecialSkillTableControlObj.DeletedRecordIds = Nothing + + Dim PersonalSportSkillTableControlObj as PersonalSportSkillTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalSportSkillTableControl"), PersonalSportSkillTableControl) + PersonalSportSkillTableControlObj.ResetData = True + + PersonalSportSkillTableControlObj.RemoveFromSession(PersonalSportSkillTableControlObj, "DeletedRecordIds") + PersonalSportSkillTableControlObj.DeletedRecordIds = Nothing + + Dim PersonalTitleTableControlObj as PersonalTitleTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalTitleTableControl"), PersonalTitleTableControl) + PersonalTitleTableControlObj.ResetData = True + + PersonalTitleTableControlObj.RemoveFromSession(PersonalTitleTableControlObj, "DeletedRecordIds") + PersonalTitleTableControlObj.DeletedRecordIds = Nothing + + Dim PersonRelativeTableControlObj as PersonRelativeTableControl = DirectCast(Me.Page.FindControlRecursively("PersonRelativeTableControl"), PersonRelativeTableControl) + PersonRelativeTableControlObj.ResetData = True + + PersonRelativeTableControlObj.RemoveFromSession(PersonRelativeTableControlObj, "DeletedRecordIds") + PersonRelativeTableControlObj.DeletedRecordIds = Nothing + + Dim ReportPropertiesTableControlObj as ReportPropertiesTableControl = DirectCast(Me.Page.FindControlRecursively("ReportPropertiesTableControl"), ReportPropertiesTableControl) + ReportPropertiesTableControlObj.ResetData = True + + ReportPropertiesTableControlObj.RemoveFromSession(ReportPropertiesTableControlObj, "DeletedRecordIds") + ReportPropertiesTableControlObj.DeletedRecordIds = Nothing + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalSportSkillResetButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.CurrentSortOrder.Reset() + If Me.InSession(Me, "Order_By") Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + + End If + + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalSportSkillWordButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + Dim report As WordReport = New WordReport + report.SpecificReportFileName = Page.Server.MapPath("ShowPersonalId.PersonalSportSkillWordButton.word") + ' report.Title replaces the value tag of page header and footer containing ${ReportTitle} + report.Title = "PersonalSportSkill" + ' If ShowPersonalId.PersonalSportSkillWordButton.report specifies a valid report template, + ' AddColumn method will generate a report template. + ' Each AddColumn method-call specifies a column + ' The 1st parameter represents the text of the column header + ' The 2nd parameter represents the horizontal alignment of the column header + ' The 3rd parameter represents the text format of the column detail + ' The 4th parameter represents the horizontal alignment of the column detail + ' The 5th parameter represents the relative width of the column + report.AddColumn(PersonalSportSkillTable.SportId.Name, ReportEnum.Align.Left, "${SportId}", ReportEnum.Align.Left, 20) + report.AddColumn(PersonalSportSkillTable.Level.Name, ReportEnum.Align.Left, "${Level}", ReportEnum.Align.Left, 30) + + Dim whereClause As WhereClause = CreateWhereClause + + Dim orderBy As OrderBy = CreateOrderBy + Dim joinFilter As BaseFilter = CreateCompoundJoinFilter() + + Dim rowsPerQuery As Integer = 5000 + Dim pageNum As Integer = 0 + Dim recordCount As Integer = 0 + Dim totalRows As Integer = PersonalSportSkillTable.GetRecordCount(joinFilter,whereClause) + + report.Page = Page.GetResourceValue("Txt:Page", "Persons") + report.ApplicationPath = Me.Page.MapPath(Page.Request.ApplicationPath) + + Dim columns As ColumnList = PersonalSportSkillTable.GetColumnList() + Dim records As PersonalSportSkillRecord() = Nothing + Do + records = PersonalSportSkillTable.GetRecords(joinFilter,whereClause, orderBy, pageNum, rowsPerQuery) + + If Not (records Is Nothing) AndAlso records.Length > 0 AndAlso whereClause.RunQuery Then + For Each record As PersonalSportSkillRecord In records + ' AddData method takes four parameters + ' The 1st parameters represent the data format + ' The 2nd parameters represent the data value + ' The 3rd parameters represent the default alignment of column using the data + ' The 4th parameters represent the maximum length of the data value being shown + If BaseClasses.Utils.MiscUtils.IsNull(record.SportId) Then + report.AddData("${SportId}", "",ReportEnum.Align.Left, 100) + Else + Dim _isExpandableNonCompositeForeignKey as Boolean + Dim _DFKA as String = "" + _isExpandableNonCompositeForeignKey = PersonalSportSkillTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalSportSkillTable.SportId) + _DFKA = PersonalSportSkillTable.GetDFKA(record.SportId.ToString(), PersonalSportSkillTable.SportId,Nothing) + If _isExpandableNonCompositeForeignKey AndAlso (not _DFKA Is Nothing) AndAlso PersonalSportSkillTable.SportId.IsApplyDisplayAs Then + report.AddData("${SportId}", _DFKA,ReportEnum.Align.Left, 100) + Else + report.AddData("${SportId}", record.Format(PersonalSportSkillTable.SportId), ReportEnum.Align.Left, 100) + End If + End If + report.AddData("${Level}", record.Format(PersonalSportSkillTable.Level), ReportEnum.Align.Left, 100) + + report.WriteRow + Next + pageNum = pageNum + 1 + recordCount += records.Length + End If + Loop While Not (records Is Nothing) AndAlso recordCount < totalRows AndAlso whereClause.RunQuery + report.save + BaseClasses.Utils.NetUtils.WriteResponseBinaryAttachment(Me.Page.Response, report.Title + ".doc", report.ReportInByteArray, 0, true) + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + + + ' Generate the event handling functions for filter and search events. + + + ' Generate the event handling functions for others + + + Private _UIData As New System.Collections.Generic.List(Of Hashtable) + Public Property UIData() As System.Collections.Generic.List(Of Hashtable) + Get + Return Me._UIData + End Get + Set(ByVal value As System.Collections.Generic.List(Of Hashtable)) + Me._UIData = value + End Set + End Property + + ' pagination properties + Protected _PageSize As Integer + Public Property PageSize() As Integer + Get + Return Me._PageSize + End Get + Set(ByVal value As Integer) + Me._PageSize = value + End Set + End Property + + Protected _PageIndex As Integer + Public Property PageIndex() As Integer + Get + ' Return the PageIndex + Return Me._PageIndex + End Get + Set(ByVal value As Integer) + Me._PageIndex = value + End Set + End Property + + Protected _TotalRecords As Integer = -1 + Public Property TotalRecords() As Integer + Get + If _TotalRecords < 0 + _TotalRecords = PersonalSportSkillTable.GetRecordCount(CreateCompoundJoinFilter(), CreateWhereClause()) + End If + Return Me._TotalRecords + End Get + Set(ByVal value As Integer) + If Me.PageSize > 0 Then + + Me.TotalPages = CInt(Math.Ceiling(value / Me.PageSize)) + + End If + Me._TotalRecords = value + End Set + End Property + + + + Protected _TotalPages As Integer = -1 + Public Property TotalPages() As Integer + Get + If _TotalPages < 0 Then + + Me.TotalPages = CInt(Math.Ceiling(TotalRecords / Me.PageSize)) + + End If + Return Me._TotalPages + End Get + Set(ByVal value As Integer) + Me._TotalPages = value + End Set + End Property + + Protected _DisplayLastPage As Boolean + Public Property DisplayLastPage() As Boolean + Get + Return Me._DisplayLastPage + End Get + Set(ByVal value As Boolean) + Me._DisplayLastPage = value + End Set + End Property + + Private _DataChanged As Boolean = False + Public Property DataChanged() As Boolean + Get + Return Me._DataChanged + End Get + Set(ByVal value As Boolean) + Me._DataChanged = value + End Set + End Property + + Private _ResetData As Boolean = False + Public Property ResetData() As Boolean + Get + Return Me._ResetData + End Get + Set(ByVal value As Boolean) + Me._ResetData = value + End Set + End Property + + Private _AddNewRecord As Integer = 0 + Public Property AddNewRecord() As Integer + Get + Return Me._AddNewRecord + End Get + Set(ByVal value As Integer) + Me._AddNewRecord = value + End Set + End Property + + + Private _CurrentSortOrder As OrderBy = Nothing + Public Property CurrentSortOrder() As OrderBy + Get + Return Me._CurrentSortOrder + End Get + Set(ByVal value As BaseClasses.Data.OrderBy) + Me._CurrentSortOrder = value + End Set + End Property + + Private _DataSource() As PersonalSportSkillRecord = Nothing + Public Property DataSource() As PersonalSportSkillRecord () + Get + Return Me._DataSource + End Get + Set(ByVal value() As PersonalSportSkillRecord) + Me._DataSource = value + End Set + End Property + +#Region "Helper Properties" + + Public ReadOnly Property LevelLabel5() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "LevelLabel5"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property PersonalSportSkillExportCSVButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalSportSkillExportCSVButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalSportSkillExportExcelButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalSportSkillExportExcelButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalSportSkillImportButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalSportSkillImportButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalSportSkillPagination() As Persons.UI.IPagination + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalSportSkillPagination"), Persons.UI.IPagination) + End Get + End Property + + Public ReadOnly Property PersonalSportSkillPDFButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalSportSkillPDFButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalSportSkillRefreshButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalSportSkillRefreshButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalSportSkillResetButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalSportSkillResetButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalSportSkillTableControlCollapsibleRegion() As System.Web.UI.WebControls.Panel + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalSportSkillTableControlCollapsibleRegion"), System.Web.UI.WebControls.Panel) + End Get + End Property + + Public ReadOnly Property PersonalSportSkillWordButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalSportSkillWordButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property SportIdLabel1() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "SportIdLabel1"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + +#End Region + +#Region "Helper Functions" + + Public Overrides Overloads Function ModifyRedirectUrl(url As String, arg As String, ByVal bEncrypt As Boolean) As String + Return Me.Page.EvaluateExpressions(url, arg, bEncrypt, Me) + End Function + + Public Overrides Overloads Function EvaluateExpressions(url As String, arg As String, ByVal bEncrypt As Boolean) As String + Dim needToProcess As Boolean = AreAnyUrlParametersForMe(url, arg) + If (needToProcess) Then + Dim recCtl As PersonalSportSkillTableControlRow = Me.GetSelectedRecordControl() + If recCtl Is Nothing AndAlso url.IndexOf("{") >= 0 Then + ' Localization. + Throw New Exception(Page.GetResourceValue("Err:NoRecSelected", "Persons")) + End If + Dim rec As PersonalSportSkillRecord = Nothing + If recCtl IsNot Nothing Then + rec = recCtl.GetRecord() + End If + Return EvaluateExpressions(url, arg, rec, bEncrypt) + End If + Return url + End Function + + Public Overridable Function GetSelectedRecordControl() As PersonalSportSkillTableControlRow + Return Nothing + + End Function + + Public Overridable Function GetSelectedRecordControls() As PersonalSportSkillTableControlRow() + + Return DirectCast((new ArrayList()).ToArray(GetType(PersonalSportSkillTableControlRow)), PersonalSportSkillTableControlRow()) + + End Function + + Public Overridable Sub DeleteSelectedRecords(ByVal deferDeletion As Boolean) + Dim recList() As PersonalSportSkillTableControlRow = Me.GetSelectedRecordControls() + If recList.Length = 0 Then + ' Localization. + Throw New Exception(Page.GetResourceValue("Err:NoRecSelected", "Persons")) + End If + + Dim recCtl As PersonalSportSkillTableControlRow + For Each recCtl In recList + If deferDeletion Then + If Not recCtl.IsNewRecord Then + + Me.AddToDeletedRecordIds(recCtl) + + End If + recCtl.Visible = False + + Else + + recCtl.Delete() + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + End If + Next + End Sub + + Public Function GetRecordControls() As PersonalSportSkillTableControlRow() + Dim recList As ArrayList = New ArrayList() + Dim rep As System.Web.UI.WebControls.Repeater = CType(Me.FindControl("PersonalSportSkillTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return Nothing + Dim repItem As System.Web.UI.WebControls.RepeaterItem + + For Each repItem In rep.Items + + Dim recControl As PersonalSportSkillTableControlRow = DirectCast(repItem.FindControl("PersonalSportSkillTableControlRow"), PersonalSportSkillTableControlRow) + recList.Add(recControl) + + Next + + Return DirectCast(recList.ToArray(GetType(PersonalSportSkillTableControlRow)), PersonalSportSkillTableControlRow()) + End Function + + Public Shadows ReadOnly Property Page() As BaseApplicationPage + Get + Return DirectCast(MyBase.Page, BaseApplicationPage) + End Get + End Property + +#End Region + + + +End Class + + +' Base class for the PersonalTitleTableControlRow control on the ShowPersonalId page. +' Do not modify this class. Instead override any method in PersonalTitleTableControlRow. +Public Class BasePersonalTitleTableControlRow + Inherits Persons.UI.BaseApplicationRecordControl + + ' To customize, override this method in PersonalTitleTableControlRow. + Protected Overridable Sub Control_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Init + + Me.ClearControlsFromSession() + End Sub + + ' To customize, override this method in PersonalTitleTableControlRow. + Protected Overridable Sub Control_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load + + 'Call LoadFocusScripts from repeater so that onfocus attribute could be added to elements + Me.Page.LoadFocusScripts(Me) + + + ' Register the event handlers. + + + End Sub + + + Public Overridable Sub LoadData() + + ' Load the data from the database into the DataSource PersonalTitle 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 = PersonalTitleTable.GetRecord(Me.RecordUniqueId, True) + + Return + End If + + ' Since this is a row in the table, the data for this row is loaded by the + ' LoadData method of the BasePersonalTitleTableControl when the data for the entire + ' table is loaded. + + Me.DataSource = New PersonalTitleRecord() + + + + End Sub + + ' Populate the UI controls using the DataSource. To customize, override this method in PersonalTitleTableControlRow. + 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 + + SetCommand2() + SetCommandDate3() + SetDept() + SetSkillNo() + SetTitle() + SetTitleDate() + SetTitleRank() + + + 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 SetCommand2() + + + ' Set the Command Literal on the webpage with value from the + ' PersonalTitle database record. + + ' Me.DataSource is the PersonalTitle record retrieved from the database. + ' Me.Command2 is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetCommand2() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.CommandSpecified Then + + ' If the Command is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalTitleTable.Command) + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.Command2.Text = formattedValue + + Else + + ' Command is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.Command2.Text = PersonalTitleTable.Command.Format(PersonalTitleTable.Command.DefaultValue) + + End If + + ' If the Command is NULL or blank, then use the value specified + ' on Properties. + If Me.Command2.Text Is Nothing _ + OrElse Me.Command2.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.Command2.Text = " " + End If + + End Sub + + Public Overridable Sub SetCommandDate3() + + + ' Set the CommandDate Literal on the webpage with value from the + ' PersonalTitle database record. + + ' Me.DataSource is the PersonalTitle record retrieved from the database. + ' Me.CommandDate3 is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetCommandDate3() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.CommandDateSpecified Then + + ' If the CommandDate is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalTitleTable.CommandDate, "d MMM yy") + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.CommandDate3.Text = formattedValue + + Else + + ' CommandDate is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.CommandDate3.Text = PersonalTitleTable.CommandDate.Format(PersonalTitleTable.CommandDate.DefaultValue, "d MMM yy") + + End If + + ' If the CommandDate is NULL or blank, then use the value specified + ' on Properties. + If Me.CommandDate3.Text Is Nothing _ + OrElse Me.CommandDate3.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.CommandDate3.Text = " " + End If + + End Sub + + Public Overridable Sub SetDept() + + + ' Set the Dept Literal on the webpage with value from the + ' PersonalTitle database record. + + ' Me.DataSource is the PersonalTitle record retrieved from the database. + ' Me.Dept is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetDept() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.DeptSpecified Then + + ' If the Dept is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalTitleTable.Dept) + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.Dept.Text = formattedValue + + Else + + ' Dept is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.Dept.Text = PersonalTitleTable.Dept.Format(PersonalTitleTable.Dept.DefaultValue) + + End If + + ' If the Dept is NULL or blank, then use the value specified + ' on Properties. + If Me.Dept.Text Is Nothing _ + OrElse Me.Dept.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.Dept.Text = " " + End If + + End Sub + + Public Overridable Sub SetSkillNo() + + + ' Set the SkillNo Literal on the webpage with value from the + ' PersonalTitle database record. + + ' Me.DataSource is the PersonalTitle record retrieved from the database. + ' Me.SkillNo is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetSkillNo() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.SkillNoSpecified Then + + ' If the SkillNo is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalTitleTable.SkillNo) + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.SkillNo.Text = formattedValue + + Else + + ' SkillNo is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.SkillNo.Text = PersonalTitleTable.SkillNo.Format(PersonalTitleTable.SkillNo.DefaultValue) + + End If + + ' If the SkillNo is NULL or blank, then use the value specified + ' on Properties. + If Me.SkillNo.Text Is Nothing _ + OrElse Me.SkillNo.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.SkillNo.Text = " " + End If + + End Sub + + Public Overridable Sub SetTitle() + + + ' Set the Title Literal on the webpage with value from the + ' PersonalTitle database record. + + ' Me.DataSource is the PersonalTitle record retrieved from the database. + ' Me.Title is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetTitle() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.TitleSpecified Then + + ' If the Title is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalTitleTable.Title) + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + If Not formattedValue is Nothing Then + Dim popupThreshold as Integer = CType(100, Integer) + + Dim maxLength as Integer = Len(formattedValue) + If (maxLength > CType(100, Integer)) Then + ' Truncate based on FieldMaxLength on Properties. + maxLength = CType(100, Integer) + + End If + + ' For fields values larger than the PopupTheshold on Properties, display a popup. + If Len(formattedValue) >= popupThreshold Then + + Dim name As String = HttpUtility.HtmlEncode(PersonalTitleTable.Title.Name) + + If Not HttpUtility.HtmlEncode("%ISD_DEFAULT%").Equals("%ISD_DEFAULT%") Then + name = HttpUtility.HtmlEncode(Me.Page.GetResourceValue("%ISD_DEFAULT%")) + End If + + + + formattedValue= "" & NetUtils.EncodeStringForHtmlDisplay(formattedValue.Substring(0, maxLength)) + + If (maxLength = CType(100, Integer)) Then + formattedValue = formattedValue & "..." & "" + Else + formattedValue = formattedValue & "" + + End If + Else + If maxLength = CType(100, Integer) Then + formattedValue= NetUtils.EncodeStringForHtmlDisplay(formattedValue.SubString(0,MaxLength)) + formattedValue = formattedValue & "..." + + End If + End If + End If + + Me.Title.Text = formattedValue + + Else + + ' Title is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.Title.Text = PersonalTitleTable.Title.Format(PersonalTitleTable.Title.DefaultValue) + + End If + + ' If the Title is NULL or blank, then use the value specified + ' on Properties. + If Me.Title.Text Is Nothing _ + OrElse Me.Title.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.Title.Text = " " + End If + + End Sub + + Public Overridable Sub SetTitleDate() + + + ' Set the TitleDate Literal on the webpage with value from the + ' PersonalTitle database record. + + ' Me.DataSource is the PersonalTitle record retrieved from the database. + ' Me.TitleDate is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetTitleDate() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.TitleDateSpecified Then + + ' If the TitleDate is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalTitleTable.TitleDate, "d MMM yy") + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.TitleDate.Text = formattedValue + + Else + + ' TitleDate is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.TitleDate.Text = PersonalTitleTable.TitleDate.Format(PersonalTitleTable.TitleDate.DefaultValue, "d MMM yy") + + End If + + ' If the TitleDate is NULL or blank, then use the value specified + ' on Properties. + If Me.TitleDate.Text Is Nothing _ + OrElse Me.TitleDate.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.TitleDate.Text = " " + End If + + End Sub + + Public Overridable Sub SetTitleRank() + + + ' Set the TitleRank Literal on the webpage with value from the + ' PersonalTitle database record. + + ' Me.DataSource is the PersonalTitle record retrieved from the database. + ' Me.TitleRank is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetTitleRank() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.TitleRankSpecified Then + + ' If the TitleRank is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalTitleTable.TitleRank) + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.TitleRank.Text = formattedValue + + Else + + ' TitleRank is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.TitleRank.Text = PersonalTitleTable.TitleRank.Format(PersonalTitleTable.TitleRank.DefaultValue) + + End If + + ' If the TitleRank is NULL or blank, then use the value specified + ' on Properties. + If Me.TitleRank.Text Is Nothing _ + OrElse Me.TitleRank.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.TitleRank.Text = " " + End If + + End Sub + + + Public EvaluateFormulaDelegate As BaseClasses.Data.DataSource.EvaluateFormulaDelegate = New BaseClasses.Data.DataSource.EvaluateFormulaDelegate(AddressOf Me.EvaluateFormula) + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean, ByVal e As FormulaEvaluator) As String + If e Is Nothing Then + e = New FormulaEvaluator() + End If + + e.Variables.Clear() + + + ' add variables for formula evaluation + If variables IsNot Nothing Then + Dim enumerator As System.Collections.Generic.IEnumerator(Of System.Collections.Generic.KeyValuePair(Of String, Object)) = variables.GetEnumerator() + While enumerator.MoveNext() + e.Variables.Add(enumerator.Current.Key, enumerator.Current.Value) + End While + End If + + If includeDS + + End IF + + + ' Other variables referred to in the formula are expected to be + ' properties of the DataSource. For example, referring to + ' UnitPrice as a variable will refer to DataSource.UnitPrice + If dataSourceForEvaluate Is Nothing Then + + e.DataSource = Me.DataSource + + Else + e.DataSource = dataSourceForEvaluate + End If + + ' Define the calling control. This is used to add other + ' related table and record controls as variables. + e.CallingControl = Me + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + + If Not String.IsNullOrEmpty(format) AndAlso (String.IsNullOrEmpty(formula) OrElse formula.IndexOf("Format(") < 0) Then + Return FormulaUtils.Format(resultObj, format) + Else + Return resultObj.ToString() + End If + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format,variables ,includeDS, Nothing) + End Function + + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object)) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format, variables ,True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, format, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal e as FormulaEvaluator) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, variables, True, e) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal includeDS as Boolean) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, includeDS, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, True, Nothing) + End Function + + + Public Overridable Sub RegisterPostback() + + + End Sub + + + + ' To customize, override this method in PersonalTitleTableControlRow. + 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 parentCtrl As PersonalIdRecordControl + + + parentCtrl = DirectCast(Me.Page.FindControlRecursively("PersonalIdRecordControl"), PersonalIdRecordControl) + + If (Not IsNothing(parentCtrl) AndAlso IsNothing(parentCtrl.DataSource)) + ' Load the record if it is not loaded yet. + parentCtrl.LoadData() + End If + If (IsNothing(parentCtrl) OrElse IsNothing(parentCtrl.DataSource)) + ' Get the error message from the application resource file. + Throw New Exception(Page.GetResourceValue("Err:NoParentRecId", "Persons")) + End If + + Me.DataSource.PersonalId = parentCtrl.DataSource.PersonalId + + ' 2. Perform any custom validation. + Me.Validate() + + + ' 3. Set the values in the record with data from UI controls. + ' This calls the Get() method for each of the user interface controls. + Me.GetUIData() + + ' 4. Save in the database. + ' We should not save the record if the data did not change. This + ' will save a database hit and avoid triggering any database triggers. + + If Me.DataSource.IsAnyValueChanged Then + ' Save record to database but do not commit yet. + ' Auto generated ids are available after saving for use by child (dependent) records. + Me.DataSource.Save() + + DirectCast(GetParentControlObject(Me, "PersonalTitleTableControl"), PersonalTitleTableControl).DataChanged = True + DirectCast(GetParentControlObject(Me, "PersonalTitleTableControl"), PersonalTitleTableControl).ResetData = True + End If + + + ' update session or cookie by formula + + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + ' For Master-Detail relationships, save data on the Detail table(s) + + End Sub + + ' To customize, override this method in PersonalTitleTableControlRow. + 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. + + GetCommand2() + GetCommandDate3() + GetDept() + GetSkillNo() + GetTitle() + GetTitleDate() + GetTitleRank() + End Sub + + + Public Overridable Sub GetCommand2() + + End Sub + + Public Overridable Sub GetCommandDate3() + + End Sub + + Public Overridable Sub GetDept() + + End Sub + + Public Overridable Sub GetSkillNo() + + End Sub + + Public Overridable Sub GetTitle() + + End Sub + + Public Overridable Sub GetTitleDate() + + End Sub + + Public Overridable Sub GetTitleRank() + + End Sub + + + ' To customize, override this method in PersonalTitleTableControlRow. + + Public Overridable Function CreateWhereClause() As WhereClause + + Return Nothing + + End Function + + + + ' To customize, override this method in PersonalTitleTableControlRow. + 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) + PersonalTitleTable.DeleteRecord(pkValue) + + DirectCast(GetParentControlObject(Me, "PersonalTitleTableControl"), PersonalTitleTableControl).DataChanged = True + DirectCast(GetParentControlObject(Me, "PersonalTitleTableControl"), PersonalTitleTableControl).ResetData = True + End Sub + + Protected Overridable Sub Control_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.PreRender + ' PreRender event is raised just before page is being displayed. + Try + DbUtils.StartTransaction() + Me.RegisterPostback() + + If Not Me.Page.ErrorOnPage AndAlso (Me.Page.IsPageRefresh OrElse Me.DataChanged OrElse Me.ResetData) Then + + + ' Re-load the data and update the web page if necessary. + ' This is typically done during a postback (filter, search button, sort, pagination button). + ' In each of the other click handlers, simply set DataChanged to True to reload the data. + Me.LoadData() + Me.DataBind() + End If + + + Catch ex As Exception + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + Finally + DbUtils.EndTransaction() + End Try + End Sub + + + Protected Overrides Sub SaveControlsToSession() + MyBase.SaveControlsToSession() + + + 'Save pagination state to session. + + End Sub + + + + Protected Overrides Sub ClearControlsFromSession() + MyBase.ClearControlsFromSession() + + + + ' Clear pagination state from session. + + End Sub + + Protected Overrides Sub LoadViewState(ByVal savedState As Object) + MyBase.LoadViewState(savedState) + Dim isNewRecord As String = CType(ViewState("IsNewRecord"), String) + If Not isNewRecord Is Nothing AndAlso isNewRecord.Trim <> "" Then + Me.IsNewRecord = Boolean.Parse(isNewRecord) + End If + + Dim myCheckSum As String = CType(ViewState("CheckSum"), String) + If Not myCheckSum Is Nothing AndAlso myCheckSum.Trim <> "" Then + Me.CheckSum = myCheckSum + End If + + + ' Load view state for pagination control. + + End Sub + + Protected Overrides Function SaveViewState() As Object + ViewState("IsNewRecord") = Me.IsNewRecord.ToString() + ViewState("CheckSum") = Me.CheckSum + + + ' Load view state for pagination control. + + Return MyBase.SaveViewState() + End Function + + + + 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("BasePersonalTitleTableControlRow_Rec"), String) + End Get + Set(ByVal value As String) + Me.ViewState("BasePersonalTitleTableControlRow_Rec") = value + End Set + End Property + + Private _DataSource As PersonalTitleRecord + Public Property DataSource() As PersonalTitleRecord + Get + Return Me._DataSource + End Get + + Set(ByVal value As PersonalTitleRecord) + + Me._DataSource = value + End Set + End Property + + + + Private _checkSum As String + Public Overridable Property CheckSum() As String + Get + Return Me._checkSum + End Get + Set(ByVal value As String) + Me._checkSum = value + End Set + End Property + + Private _TotalPages As Integer + Public Property TotalPages() As Integer + Get + Return Me._TotalPages + End Get + Set(ByVal value As Integer) + Me._TotalPages = value + End Set + End Property + + Private _PageIndex As Integer + Public Property PageIndex() As Integer + Get + ' Return the PageIndex + Return Me._PageIndex + End Get + Set(ByVal value As Integer) + Me._PageIndex = value + End Set + End Property + + Private _DisplayLastPage As Boolean + Public Property DisplayLastPage() As Boolean + Get + Return Me._DisplayLastPage + End Get + Set(ByVal value As Boolean) + Me._DisplayLastPage = value + End Set + End Property + + + +#Region "Helper Properties" + + Public ReadOnly Property Command2() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Command2"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property CommandDate3() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "CommandDate3"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property Dept() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Dept"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property SkillNo() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "SkillNo"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property Title() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Title"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property TitleDate() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "TitleDate"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property TitleRank() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "TitleRank"), 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 PersonalTitleRecord = 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 PersonalTitleRecord + If Not Me.DataSource Is Nothing Then + Return Me.DataSource + End If + + If Not Me.RecordUniqueId Is Nothing Then + + Return PersonalTitleTable.GetRecord(Me.RecordUniqueId, True) + + End If + + ' Localization. + + Return Nothing + + End Function + + Public Shadows ReadOnly Property Page() As BaseApplicationPage + Get + Return DirectCast(MyBase.Page, BaseApplicationPage) + End Get + End Property + +#End Region + +End Class + + + +' Base class for the PersonalTitleTableControl control on the ShowPersonalId page. +' Do not modify this class. Instead override any method in PersonalTitleTableControl. +Public Class BasePersonalTitleTableControl + Inherits Persons.UI.BaseApplicationTableControl + + + + Protected Overridable Sub Control_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Init + + + + ' Setup the filter and search events. + + + + ' Control Initializations. + ' Initialize the table's current sort order. + + If Me.InSession(Me, "Order_By") Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + Me.CurrentSortOrder.Add(PersonalTitleTable.TitleDate, OrderByItem.OrderDir.Asc) + + End If + + + + ' Setup default pagination settings. + + Me.PageSize = CInt(Me.GetFromSession(Me, "Page_Size", "10")) + Me.PageIndex = CInt(Me.GetFromSession(Me, "Page_Index", "0")) + + + + Me.ClearControlsFromSession() + End Sub + + Protected Overridable Sub Control_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load + + SaveControlsToSession_Ajax() + + ' Setup the pagination events. + + AddHandler Me.PersonalTitlePagination.FirstPage.Click, AddressOf PersonalTitlePagination_FirstPage_Click + + AddHandler Me.PersonalTitlePagination.LastPage.Click, AddressOf PersonalTitlePagination_LastPage_Click + + AddHandler Me.PersonalTitlePagination.NextPage.Click, AddressOf PersonalTitlePagination_NextPage_Click + + AddHandler Me.PersonalTitlePagination.PageSizeButton.Click, AddressOf PersonalTitlePagination_PageSizeButton_Click + + AddHandler Me.PersonalTitlePagination.PreviousPage.Click, AddressOf PersonalTitlePagination_PreviousPage_Click + + + ' Setup the sorting events. + + AddHandler Me.CommandDateLabel3.Click, AddressOf CommandDateLabel3_Click + + AddHandler Me.CommandLabel2.Click, AddressOf CommandLabel2_Click + + AddHandler Me.DeptLabel.Click, AddressOf DeptLabel_Click + + AddHandler Me.SkillNoLabel.Click, AddressOf SkillNoLabel_Click + + AddHandler Me.TitleDateLabel1.Click, AddressOf TitleDateLabel1_Click + + AddHandler Me.TitleLabel.Click, AddressOf TitleLabel_Click + + AddHandler Me.TitleRankLabel.Click, AddressOf TitleRankLabel_Click + + ' Setup the button events. + + AddHandler Me.PersonalTitleExportCSVButton.Click, AddressOf PersonalTitleExportCSVButton_Click + + AddHandler Me.PersonalTitleExportExcelButton.Click, AddressOf PersonalTitleExportExcelButton_Click + + Me.PersonalTitleImportButton.PostBackUrl = "../Shared/SelectFileToImport.aspx?TableName=PersonalTitle" + Me.PersonalTitleImportButton.Attributes.Item("onClick") = "window.open('" & Me.Page.EncryptUrlParameter(Me.PersonalTitleImportButton.PostBackUrl) & "','importWindow', 'width=700, height=500,top=' +(screen.availHeight-500)/2 + ',left=' + (screen.availWidth-700)/2+ ', resizable=yes, scrollbars=yes,modal=yes'); return false;" + + AddHandler Me.PersonalTitleImportButton.Click, AddressOf PersonalTitleImportButton_Click + + AddHandler Me.PersonalTitlePDFButton.Click, AddressOf PersonalTitlePDFButton_Click + + AddHandler Me.PersonalTitleRefreshButton.Click, AddressOf PersonalTitleRefreshButton_Click + + AddHandler Me.PersonalTitleResetButton.Click, AddressOf PersonalTitleResetButton_Click + + AddHandler Me.PersonalTitleWordButton.Click, AddressOf PersonalTitleWordButton_Click + + + ' Setup events for others + + End Sub + + + Public Overridable Sub LoadData() + + ' Read data from database. Returns an array of records that can be assigned + ' to the DataSource table control property. + Try + Dim joinFilter As CompoundFilter = CreateCompoundJoinFilter() + + ' The WHERE clause will be empty when displaying all records in table. + Dim wc As WhereClause = CreateWhereClause() + If wc IsNot Nothing AndAlso Not wc.RunQuery Then + ' Initialize an empty array of records + Dim alist As New ArrayList(0) + Me.DataSource = DirectCast(alist.ToArray(GetType(PersonalTitleRecord)), PersonalTitleRecord()) + ' Add records to the list if needed. + Me.AddNewRecords() + Me._TotalRecords = 0 + Me._TotalPages = 0 + Return + End If + + ' Call OrderBy to determine the order - either use the order defined + ' on the Query Wizard, or specified by user (by clicking on column heading) + Dim orderBy As OrderBy = CreateOrderBy() + + ' Get the pagesize from the pagesize control. + Me.GetPageSize() + + If Me.DisplayLastPage Then + Dim totalRecords As Integer = If(Me._TotalRecords < 0, PersonalTitleTable.GetRecordCount(CreateCompoundJoinFilter(), CreateWhereClause()), Me._TotalRecords) + + Dim totalPages As Integer = CInt(Math.Ceiling(totalRecords / Me.PageSize)) + + Me.PageIndex = totalPages - 1 + End If + + ' Make sure PageIndex (current page) and PageSize are within bounds. + If Me.PageIndex < 0 Then + Me.PageIndex = 0 + End If + If Me.PageSize < 1 Then + Me.PageSize = 1 + End If + + ' Retrieve the records and set the table DataSource. + ' Only PageSize records are fetched starting at PageIndex (zero based). + If Me.AddNewRecord > 0 Then + ' Make sure to preserve the previously entered data on new rows. + Dim postdata As New ArrayList + For Each rc As PersonalTitleTableControlRow In Me.GetRecordControls() + If Not rc.IsNewRecord Then + rc.DataSource = rc.GetRecord() + rc.GetUIData() + postdata.Add(rc.DataSource) + UIData.Add(rc.PreservedUIData()) + End If + Next + Me.DataSource = DirectCast(postdata.ToArray(GetType(PersonalTitleRecord)), PersonalTitleRecord()) + Else ' Get the records from the database + Me.DataSource = PersonalTitleTable.GetRecords(joinFilter, wc, orderBy, Me.PageIndex, Me.PageSize) + + End If + + ' if the datasource contains no records contained in database, then load the last page. + If (DbUtils.GetCreatedRecords(Me.DataSource).Length = 0 AndAlso Not Me.DisplayLastPage) Then + Me.DisplayLastPage = True + LoadData() + Else + + ' Add any new rows desired by the user. + Me.AddNewRecords() + + + ' Initialize the page and grand totals. now + + End If + + Catch ex As Exception + ' Report the error message to the end user + Dim msg As String = ex.Message + If ex.InnerException IsNot Nothing Then + msg = msg & " InnerException: " & ex.InnerException.Message + End If + Throw New Exception(msg, ex.InnerException) + End Try + End Sub + + + + + Public Overrides Sub DataBind() + ' The DataBind method binds the user interface controls to the values + ' from the database record for each row in the table. To do this, it calls the + ' DataBind for each of the rows. + ' DataBind also populates any filters above the table, and sets the pagination + ' control to the correct number of records and the current page number. + + MyBase.DataBind() + + ' Make sure that the DataSource is initialized. + If Me.DataSource Is Nothing Then + Return + End If + + 'LoadData for DataSource for chart and report if they exist + + ' Setup the pagination controls. + BindPaginationControls() + + + + ' Bind the repeater with the list of records to expand the UI. + Dim rep As System.Web.UI.WebControls.Repeater = CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalTitleTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return + rep.DataSource = DataSource() + rep.DataBind() + + Dim index As Integer = 0 + For Each repItem As System.Web.UI.WebControls.RepeaterItem In rep.Items + ' Loop through all rows in the table, set its DataSource and call DataBind(). + Dim recControl As PersonalTitleTableControlRow = DirectCast(repItem.FindControl("PersonalTitleTableControlRow"), PersonalTitleTableControlRow) + recControl.DataSource = Me.DataSource(index) + If Me.UIData.Count > index Then + recControl.PreviousUIData = Me.UIData(index) + End If + recControl.DataBind() + recControl.Visible = Not Me.InDeletedRecordIds(recControl) + + index += 1 + Next + + + + + ' Call the Set methods for each controls on the panel + + SetCommandDateLabel3() + SetCommandLabel2() + SetDeptLabel() + + + + + + + + SetPersonalTitleTableControlCollapsibleRegion() + + SetSkillNoLabel() + SetTitleDateLabel1() + SetTitleLabel() + SetTitleRankLabel() + ' setting the state of expand or collapse alternative rows + + + ' Load data for each record and table UI control. + ' Ordering is important because child controls get + ' their parent ids from their parent UI controls. + + + ' this method calls the set method for controls with special formula like running total, sum, rank, etc + SetFormulaControls() + End Sub + + Public Overridable Sub SetFormulaControls() + ' this method calls Set methods for the control that has special formula + + + + End Sub + + + + Public Overridable Sub RegisterPostback() + + Me.Page.RegisterPostBackTrigger(MiscUtils.FindControlRecursively(Me,"PersonalTitleExportCSVButton")) + + Me.Page.RegisterPostBackTrigger(MiscUtils.FindControlRecursively(Me,"PersonalTitleExportExcelButton")) + + Me.Page.RegisterPostBackTrigger(MiscUtils.FindControlRecursively(Me,"PersonalTitlePDFButton")) + + Me.Page.RegisterPostBackTrigger(MiscUtils.FindControlRecursively(Me,"PersonalTitleWordButton")) + + + End Sub + + Public EvaluateFormulaDelegate As BaseClasses.Data.DataSource.EvaluateFormulaDelegate = New BaseClasses.Data.DataSource.EvaluateFormulaDelegate(AddressOf Me.EvaluateFormula) + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean, ByVal e as FormulaEvaluator) As String + If e Is Nothing + e = New FormulaEvaluator() + End If + + e.Variables.Clear() + + + ' add variables for formula evaluation + If variables IsNot Nothing Then + Dim enumerator As System.Collections.Generic.IEnumerator(Of System.Collections.Generic.KeyValuePair(Of String, Object)) = variables.GetEnumerator() + While enumerator.MoveNext() + e.Variables.Add(enumerator.Current.Key, enumerator.Current.Value) + End While + End If + + If includeDS + + End If + + ' All variables referred to in the formula are expected to be + ' properties of the DataSource. For example, referring to + ' UnitPrice as a variable will refer to DataSource.UnitPrice + e.DataSource = dataSourceForEvaluate + + ' Define the calling control. This is used to add other + ' related table and record controls as variables. + e.CallingControl = Me + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + + If Not String.IsNullOrEmpty(format) AndAlso (String.IsNullOrEmpty(formula) OrElse formula.IndexOf("Format(") < 0) Then + Return FormulaUtils.Format(resultObj, format) + Else + Return resultObj.ToString() + End If + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format,variables ,includeDS, Nothing) + End Function + + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object)) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format, variables ,True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, format, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal e as FormulaEvaluator) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, variables, True, e) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal includeDS as Boolean) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, includeDS, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, True, Nothing) + End Function + + + + + Public Overridable Sub ResetControl() + + Me.CurrentSortOrder.Reset() + If (Me.InSession(Me, "Order_By")) Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + Me.CurrentSortOrder.Add(PersonalTitleTable.TitleDate, OrderByItem.OrderDir.Asc) + + End If + + Me.PageIndex = 0 + End Sub + + Protected Overridable Sub BindPaginationControls() + ' Setup the pagination controls. + + ' Bind the pagination labels. + + If DbUtils.GetCreatedRecords(Me.DataSource).Length > 0 Then + + Me.PersonalTitlePagination.CurrentPage.Text = (Me.PageIndex + 1).ToString() + Else + Me.PersonalTitlePagination.CurrentPage.Text = "0" + End If + Me.PersonalTitlePagination.PageSize.Text = Me.PageSize.ToString() + Me.PersonalTitlePagination.TotalItems.Text = Me.TotalRecords.ToString() + Me.PersonalTitlePagination.TotalPages.Text = Me.TotalPages.ToString() + + ' Bind the buttons for PersonalTitleTableControl pagination. + + Me.PersonalTitlePagination.FirstPage.Enabled = Not (Me.PageIndex = 0) + If Me._TotalPages < 0 Then ' if the total pages is not determined yet, enable last and next buttons + Me.PersonalTitlePagination.LastPage.Enabled = True + ElseIf Me._TotalPages = 0 ' if the total pages is determined and it is 0, enable last and next buttons + Me.PersonalTitlePagination.LastPage.Enabled = False + Else ' if the total pages is the last page, disable last and next buttons + Me.PersonalTitlePagination.LastPage.Enabled = Not (Me.PageIndex = Me.TotalPages - 1) + End If + + If Me._TotalPages < 0 Then ' if the total pages is not determined yet, enable last and next buttons + Me.PersonalTitlePagination.NextPage.Enabled = True + ElseIf Me._TotalPages = 0 ' if the total pages is determined and it is 0, enable last and next buttons + Me.PersonalTitlePagination.NextPage.Enabled = False + Else ' if the total pages is the last page, disable last and next buttons + Me.PersonalTitlePagination.NextPage.Enabled = Not (Me.PageIndex = Me.TotalPages - 1) + End If + + Me.PersonalTitlePagination.PreviousPage.Enabled = Not (Me.PageIndex = 0) + + + End Sub + + Public Overridable Sub SaveData() + ' Save the data from the entire table. Calls each row's Save Data + ' to save their data. This function is called by the Click handler of the + ' Save button. The button handler should Start/Commit/End a transaction. + + Dim recCtl As PersonalTitleTableControlRow + For Each recCtl In Me.GetRecordControls() + + If Me.InDeletedRecordIds(recCtl) Then + ' Delete any pending deletes. + recCtl.Delete() + Else + If recCtl.Visible Then + recCtl.SaveData() + End If + End If + + Next + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + ' Set IsNewRecord to False for all records - since everything has been saved and is no longer "new" + For Each recCtl In Me.GetRecordControls() + recCtl.IsNewRecord = False + Next + + + ' Set DeletedRecordsIds to Nothing since we have deleted all pending deletes. + Me.DeletedRecordIds = Nothing + + End Sub + + Public Overridable Function CreateCompoundJoinFilter() As CompoundFilter + Dim jFilter As CompoundFilter = New CompoundFilter() + + Return jFilter + + End Function + + + Public Overridable Function CreateOrderBy() As OrderBy + ' The CurrentSortOrder is initialized to the sort order on the + ' Query Wizard. It may be modified by the Click handler for any of + ' the column heading to sort or reverse sort by that column. + ' You can add your own sort order, or modify it on the Query Wizard. + Return Me.CurrentSortOrder + End Function + + Public Overridable Function CreateWhereClause() As WhereClause + 'This CreateWhereClause is used for loading the data. + PersonalTitleTable.Instance.InnerFilter = Nothing + Dim wc As WhereClause = New WhereClause() + + ' Compose the WHERE clause consiting of: + ' 1. Static clause defined at design time. + ' 2. User selected search criteria. + ' 3. User selected filter criteria. + + + Dim selectedRecordKeyValue as KeyValue = New KeyValue() + + Dim personalIdRecordControlObj As Persons.UI.Controls.ShowPersonalId.PersonalIdRecordControl = DirectCast(MiscUtils.FindControlRecursively(Me.Page, "PersonalIdRecordControl"), Persons.UI.Controls.ShowPersonalId.PersonalIdRecordControl) + + If (Not IsNothing(personalIdRecordControlObj) AndAlso Not IsNothing(personalIdRecordControlObj.GetRecord()) AndAlso personalIdRecordControlObj.GetRecord().IsCreated AndAlso Not IsNothing(personalIdRecordControlObj.GetRecord().PersonalId)) + wc.iAND(PersonalTitleTable.PersonalId, BaseFilter.ComparisonOperator.EqualsTo, personalIdRecordControlObj.GetRecord().PersonalId.ToString()) + selectedRecordKeyValue.AddElement(PersonalTitleTable.PersonalId.InternalName, personalIdRecordControlObj.GetRecord().PersonalId.ToString()) + Else + wc.RunQuery = False + Return wc + End If + + HttpContext.Current.Session("PersonalTitleTableControlWhereClause") = selectedRecordKeyValue.ToXmlString() + + Return wc + End Function + + + Public Overridable Function CreateWhereClause(ByVal searchText as String, ByVal fromSearchControl as String, ByVal AutoTypeAheadSearch as String, ByVal AutoTypeAheadWordSeparators as String) As WhereClause + ' This CreateWhereClause is used for loading list of suggestions for Auto Type-Ahead feature. + PersonalTitleTable.Instance.InnerFilter = Nothing + Dim wc As WhereClause = New WhereClause() + + ' Compose the WHERE clause consiting of: + ' 1. Static clause defined at design time. + ' 2. User selected search criteria. + ' 3. User selected filter criteria. + + Dim appRelativeVirtualPath As String = CType(HttpContext.Current.Session("AppRelativeVirtualPath"), String) + + Dim selectedRecordInPersonalIdRecordControl as String = DirectCast(HttpContext.Current.Session("PersonalTitleTableControlWhereClause"), String) + + If Not selectedRecordInPersonalIdRecordControl Is Nothing AndAlso KeyValue.IsXmlKey(selectedRecordInPersonalIdRecordControl) Then + Dim selectedRecordKeyValue as KeyValue = KeyValue.XmlToKey(selectedRecordInPersonalIdRecordControl) + + If Not IsNothing(selectedRecordKeyValue) AndAlso selectedRecordKeyValue.ContainsColumn(PersonalTitleTable.PersonalId) Then + wc.iAND(PersonalTitleTable.PersonalId, BaseFilter.ComparisonOperator.EqualsTo, selectedRecordKeyValue.GetColumnValue(PersonalTitleTable.PersonalId).ToString()) + End If + + End If + + ' Adds clauses if values are selected in Filter controls which are configured in the page. + + + Return wc + End Function + + + Public Overridable Function FormatSuggestions(ByVal prefixText As String, ByVal resultItem As String, _ + ByVal columnLength As Integer, ByVal AutoTypeAheadDisplayFoundText As String, _ + ByVal autoTypeAheadSearch As String, ByVal AutoTypeAheadWordSeparators As String, _ + ByVal resultList As ArrayList) As Boolean + + 'Formats the resultItem and adds it to the list of suggestions. + Dim index As Integer = resultItem.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture).IndexOf(prefixText.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture)) + Dim itemToAdd As String = "" + Dim isFound As Boolean = False + Dim isAdded As Boolean = False + ' Get the index where prfixt is at the beginning of resultItem. If not found then, index of word which begins with prefixText. + If InvariantLCase(autoTypeAheadSearch).equals("wordsstartingwithsearchstring") And Not index = 0 Then + ' Expression to find word which contains AutoTypeAheadWordSeparators followed by prefixText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex( AutoTypeAheadWordSeparators + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + If regex1.IsMatch(resultItem) Then + index = regex1.Match(resultItem).Index + isFound = True + End If + ' If the prefixText is found immediatly after white space then starting of the word is found so don not search any further + If not resultItem(index).ToString() = " " Then + ' Expression to find beginning of the word which contains AutoTypeAheadWordSeparators followed by prefixText + Dim regex As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\\S*" + AutoTypeAheadWordSeparators + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + If regex.IsMatch(resultItem) Then + index = regex.Match(resultItem).Index + isFound = True + End If + End If + End If + + ' If autoTypeAheadSearch value is wordsstartingwithsearchstring then, extract the substring only if the prefixText is found at the + ' beginning of the resultItem (index = 0) or a word in resultItem is found starts with prefixText. + If index = 0 Or isFound Or InvariantLCase(autoTypeAheadSearch).Equals("anywhereinstring") then + If InvariantLCase(AutoTypeAheadDisplayFoundText).equals("atbeginningofmatchedstring") Then + ' Expression to find beginning of the word which contains prefixText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\\S*" + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + ' Find the beginning of the word which contains prefexText + If (StringUtils.InvariantLCase(autoTypeAheadSearch).Equals("anywhereinstring") AndAlso regex1.IsMatch(resultItem)) Then + index = regex1.Match(resultItem).Index + isFound = True + End If + ' Display string from the index till end of the string if sub string from index till end is less than columnLength value. + If Len(resultItem) - index <= columnLength Then + If index = 0 Then + itemToAdd = resultItem + Else + itemToAdd = "..." & resultItem.Substring(index, Len(resultItem) - index) + End If + Else + If index = 0 Then + itemToAdd = resultItem.Substring(index, (columnLength - 3)) & "..." + Else + 'Truncate the string to show only columnLength - 6 characters as begining and trailing "..." has to be appended. + itemToAdd = "..." & resultItem.Substring(index , columnLength - 6) & "..." + End If + End If + ElseIf InvariantLCase(AutoTypeAheadDisplayFoundText).equals("inmiddleofmatchedstring") Then + Dim subStringBeginIndex As Integer = CType(columnLength/2, Integer) + If Len(resultItem) <= columnLength Then + itemToAdd = resultItem + Else + ' Sanity check at end of the string + If index + Len(prefixText) = columnLength Then + itemToAdd = "..." & resultItem.Substring(index-columnLength,index) + ElseIf Len(resultItem) - index < subStringBeginIndex Then + ' Display string from the end till columnLength value if, index is closer to the end of the string. + itemToAdd = "..." & resultItem.Substring(Len(resultItem)-columnLength,Len(resultItem)) + ElseIf index <= subStringBeginIndex Then + ' Sanity chet at beginning of the string + itemToAdd = resultItem.Substring(0, columnLength) & "..." + Else + ' Display string containing text before the prefixText occures and text after the prefixText + itemToAdd = "..." & resultItem.Substring(index - subStringBeginIndex, columnLength) & "..." + End If + End If + ElseIf InvariantLCase(AutoTypeAheadDisplayFoundText).equals("atendofmatchedstring") Then + ' Expression to find ending of the word which contains prefexText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\s", System.Text.RegularExpressions.RegexOptions.IgnoreCase) + ' Find the ending of the word which contains prefexText + If regex1.IsMatch(resultItem, index + 1) Then + index = regex1.Match(resultItem, index + 1).Index + Else + ' If the word which contains prefexText is the last word in string, regex1.IsMatch returns false. + index = resultItem.Length + End If + If index > Len(resultItem) Then + index = Len(resultItem) + End If + ' If text from beginning of the string till index is less than columnLength value then, display string from the beginning till index. + If index <= columnLength Then + if index = Len(resultItem) Then 'Make decision to append "..." + itemToAdd = resultItem.Substring(0,index) + Else + itemToAdd = resultItem.Substring(0,index) & "..." + End If + Else + If index = Len(resultItem) Then + itemToAdd = "..." & resultItem.Substring(index - (columnLength - 3), (columnLength - 3)) + Else + 'Truncate the string to show only columnLength - 6 characters as begining and trailing "..." has to be appended. + itemToAdd = "..." & resultItem.Substring(index - (columnLength - 6), columnLength - 6) & "..." + End If + End If + End If + + ' Remove newline character from itemToAdd + Dim prefixTextIndex As Integer = itemToAdd.IndexOf(prefixText, StringComparison.CurrentCultureIgnoreCase) + ' If itemToAdd contains any newline after the search text then show text only till newline + Dim regex2 As System.Text.RegularExpressions.Regex = New System.Text.RegularExpressions.Regex("(" & vbCrLf & "|" & vbLf & ")", System.Text.RegularExpressions.RegexOptions.IgnoreCase) + Dim newLineIndexAfterPrefix As Integer = -1 + If regex2.IsMatch(itemToAdd, prefixTextIndex) Then + newLineIndexAfterPrefix = regex2.Match(itemToAdd, prefixTextIndex).Index + End If + If (newLineIndexAfterPrefix > -1) Then + If itemToAdd.EndsWith("...") Then + itemToAdd = (itemToAdd.Substring(0, newLineIndexAfterPrefix) + "...") + Else + itemToAdd = itemToAdd.Substring(0, newLineIndexAfterPrefix) + End If + End If + ' If itemToAdd contains any newline before search text then show text which comes after newline + Dim regex3 As System.Text.RegularExpressions.Regex = New System.Text.RegularExpressions.Regex("(" & vbCrLf & "|" & vbLf & ")", (System.Text.RegularExpressions.RegexOptions.IgnoreCase Or System.Text.RegularExpressions.RegexOptions.RightToLeft)) + Dim newLineIndexBeforePrefix As Integer = -1 + If regex3.IsMatch(itemToAdd, prefixTextIndex) Then + newLineIndexBeforePrefix = regex3.Match(itemToAdd, prefixTextIndex).Index + End If + If (newLineIndexBeforePrefix > -1) Then + If itemToAdd.StartsWith("...") Then + itemToAdd = ("..." + itemToAdd.Substring((newLineIndexBeforePrefix + regex3.Match(itemToAdd, prefixTextIndex).Length))) + Else + itemToAdd = itemToAdd.Substring((newLineIndexBeforePrefix + regex3.Match(itemToAdd, prefixTextIndex).Length)) + End If + End If + + If Not itemToAdd is nothing AndAlso Not resultList.Contains(itemToAdd) Then + + resultList.Add(itemToAdd) + + isAdded = true + End If + End If + Return isAdded + End Function + + + Protected Overridable Sub GetPageSize() + + If Me.PersonalTitlePagination.PageSize.Text.Trim <> "" Then + Try + 'Me.PageSize = Integer.Parse(Me.PersonalTitlePagination.PageSize.Text) + Catch ex As Exception + End Try + End If + End Sub + + Protected Overridable Sub AddNewRecords() + + Dim newRecordList As ArrayList = New ArrayList() + + Dim newUIDataList As System.Collections.Generic.List(Of Hashtable) = New System.Collections.Generic.List(Of Hashtable)() + + ' Loop though all the record controls and if the record control + ' does not have a unique record id set, then create a record + ' and add to the list. + If Not Me.ResetData Then + Dim rep As System.Web.UI.WebControls.Repeater = CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalTitleTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return + + Dim repItem As System.Web.UI.WebControls.RepeaterItem + For Each repItem In rep.Items + ' Loop through all rows in the table, set its DataSource and call DataBind(). + + Dim recControl As PersonalTitleTableControlRow = DirectCast(repItem.FindControl("PersonalTitleTableControlRow"), PersonalTitleTableControlRow) + + If recControl.Visible AndAlso recControl.IsNewRecord() Then + + Dim rec As PersonalTitleRecord = New PersonalTitleRecord() + + If recControl.Command2.Text <> "" Then + rec.Parse(recControl.Command2.Text, PersonalTitleTable.Command) + End If + If recControl.CommandDate3.Text <> "" Then + rec.Parse(recControl.CommandDate3.Text, PersonalTitleTable.CommandDate) + End If + If recControl.Dept.Text <> "" Then + rec.Parse(recControl.Dept.Text, PersonalTitleTable.Dept) + End If + If recControl.SkillNo.Text <> "" Then + rec.Parse(recControl.SkillNo.Text, PersonalTitleTable.SkillNo) + End If + If recControl.Title.Text <> "" Then + rec.Parse(recControl.Title.Text, PersonalTitleTable.Title) + End If + If recControl.TitleDate.Text <> "" Then + rec.Parse(recControl.TitleDate.Text, PersonalTitleTable.TitleDate) + End If + If recControl.TitleRank.Text <> "" Then + rec.Parse(recControl.TitleRank.Text, PersonalTitleTable.TitleRank) + End If + newUIDataList.Add(recControl.PreservedUIData()) + newRecordList.Add(rec) + End If + Next + End If + + + ' Add any new record to the list. + Dim index As Integer = 0 + For index = 1 To Me.AddNewRecord + + newRecordList.Insert(0, New PersonalTitleRecord()) + newUIDataList.Insert(0, New Hashtable()) + + Next + Me.AddNewRecord = 0 + + ' Finally, add any new records to the DataSource. + If newRecordList.Count > 0 Then + + Dim finalList As ArrayList = New ArrayList(Me.DataSource) + finalList.InsertRange(0, newRecordList) + + Me.DataSource = DirectCast(finalList.ToArray(GetType(PersonalTitleRecord)), PersonalTitleRecord()) + + End If + + ' Add the existing UI data to this hash table + If newUIDataList.Count > 0 Then + Me.UIData.InsertRange(0, newUIDataList) + End If + + End Sub + + + Public Sub AddToDeletedRecordIds(ByVal rec As PersonalTitleTableControlRow) + If rec.IsNewRecord() Then + Return + End If + + If Not Me.DeletedRecordIds Is Nothing AndAlso Me.DeletedRecordIds.Trim <> "" Then + Me.DeletedRecordIds &= "," + End If + + Me.DeletedRecordIds &= "[" & rec.RecordUniqueId & "]" + End Sub + + Protected Overridable Function InDeletedRecordIds(ByVal rec As PersonalTitleTableControlRow) As Boolean + If Me.DeletedRecordIds Is Nothing OrElse Me.DeletedRecordIds.Trim = "" Then + Return False + End If + + Return Me.DeletedRecordIds.IndexOf("[" & rec.RecordUniqueId & "]") >= 0 + End Function + + Private _DeletedRecordIds As String + Public Property DeletedRecordIds() As String + Get + Return Me._DeletedRecordIds + End Get + Set(ByVal value As String) + Me._DeletedRecordIds = value + End Set + End Property + + + ' Create Set, WhereClause, and Populate Methods + + Public Overridable Sub SetCommandDateLabel3() + + End Sub + + Public Overridable Sub SetCommandLabel2() + + End Sub + + Public Overridable Sub SetDeptLabel() + + End Sub + + Public Overridable Sub SetPersonalTitleTableControlCollapsibleRegion() + + End Sub + + Public Overridable Sub SetSkillNoLabel() + + End Sub + + Public Overridable Sub SetTitleDateLabel1() + + End Sub + + Public Overridable Sub SetTitleLabel() + + End Sub + + Public Overridable Sub SetTitleRankLabel() + + End Sub + + + + + Protected Overridable Sub Control_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.PreRender + ' PreRender event is raised just before page is being displayed. + Try + DbUtils.StartTransaction + Me.RegisterPostback() + + If Not Me.Page.ErrorOnPage AndAlso (Me.Page.IsPageRefresh OrElse Me.DataChanged OrElse Me.ResetData) Then + + + ' Re-load the data and update the web page if necessary. + ' This is typically done during a postback (filter, search button, sort, pagination button). + ' In each of the other click handlers, simply set DataChanged to True to reload the data. + + Me.LoadData() + Me.DataBind() + + End If + + + + Catch ex As Exception + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + Finally + DbUtils.EndTransaction + End Try + End Sub + + + Protected Overrides Sub SaveControlsToSession() + MyBase.SaveControlsToSession() + + ' Save filter controls to values to session. + + + 'Save pagination state to session. + + + + ' Save table control properties to the session. + If Not Me.CurrentSortOrder Is Nothing Then + Me.SaveToSession(Me, "Order_By", Me.CurrentSortOrder.ToXmlString()) + End If + + Me.SaveToSession(Me, "Page_Index", Me.PageIndex.ToString()) + Me.SaveToSession(Me, "Page_Size", Me.PageSize.ToString()) + + Me.SaveToSession(Me, "DeletedRecordIds", Me.DeletedRecordIds) + + End Sub + + Protected Sub SaveControlsToSession_Ajax() + ' Save filter controls to values to session. + + HttpContext.Current.Session("AppRelativeVirtualPath") = Me.Page.AppRelativeVirtualPath + + End Sub + + Protected Overrides Sub ClearControlsFromSession() + MyBase.ClearControlsFromSession() + + ' Clear filter controls values from the session. + + + ' Clear pagination state from session. + + + + ' Clear table properties from the session. + Me.RemoveFromSession(Me, "Order_By") + Me.RemoveFromSession(Me, "Page_Index") + Me.RemoveFromSession(Me, "Page_Size") + + Me.RemoveFromSession(Me, "DeletedRecordIds") + + End Sub + + Protected Overrides Sub LoadViewState(ByVal savedState As Object) + MyBase.LoadViewState(savedState) + + Dim orderByStr As String = CType(ViewState("PersonalTitleTableControl_OrderBy"), String) + + If orderByStr IsNot Nothing AndAlso orderByStr.Trim <> "" Then + Me.CurrentSortOrder = BaseClasses.Data.OrderBy.FromXmlString(orderByStr) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + End If + + Dim pageIndex As String = CType(ViewState("Page_Index"), String) + If pageIndex IsNot Nothing Then + Me.PageIndex = CInt(pageIndex) + End If + + Dim pageSize As String = CType(ViewState("Page_Size"), String) + If Not pageSize Is Nothing Then + Me.PageSize = CInt(pageSize) + End If + + + + ' Load view state for pagination control. + + Me.DeletedRecordIds = CType(Me.ViewState("DeletedRecordIds"), String) + + End Sub + + Protected Overrides Function SaveViewState() As Object + + If Me.CurrentSortOrder IsNot Nothing Then + Me.ViewState("PersonalTitleTableControl_OrderBy") = Me.CurrentSortOrder.ToXmlString() + End If + + Me.ViewState("Page_Index") = Me.PageIndex + Me.ViewState("Page_Size") = Me.PageSize + + Me.ViewState("DeletedRecordIds") = Me.DeletedRecordIds + + + ' Load view state for pagination control. + + + Return MyBase.SaveViewState() + End Function + + ' Generate the event handling functions for pagination events. + + ' event handler for ImageButton + Public Overridable Sub PersonalTitlePagination_FirstPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.PageIndex = 0 + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalTitlePagination_LastPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.DisplayLastPage = True + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalTitlePagination_NextPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.PageIndex += 1 + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for LinkButton + Public Overridable Sub PersonalTitlePagination_PageSizeButton_Click(ByVal sender As Object, ByVal args As EventArgs) + + Try + + Me.DataChanged = True + + Me.PageSize = Integer.Parse(Me.PersonalTitlePagination.PageSize.Text) + + Me.PageIndex = Integer.Parse(Me.PersonalTitlePagination.CurrentPage.Text) - 1 + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalTitlePagination_PreviousPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + If Me.PageIndex > 0 Then + Me.PageIndex -= 1 + Me.DataChanged = True + End If + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + + ' Generate the event handling functions for sorting events. + + Public Overridable Sub CommandDateLabel3_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by CommandDate when clicked. + + ' Get previous sorting state for CommandDate. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalTitleTable.CommandDate) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for CommandDate. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalTitleTable.CommandDate, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by CommandDate, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub CommandLabel2_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by Command when clicked. + + ' Get previous sorting state for Command. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalTitleTable.Command) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for Command. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalTitleTable.Command, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by Command, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub DeptLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by Dept when clicked. + + ' Get previous sorting state for Dept. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalTitleTable.Dept) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for Dept. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalTitleTable.Dept, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by Dept, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub SkillNoLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by SkillNo when clicked. + + ' Get previous sorting state for SkillNo. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalTitleTable.SkillNo) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for SkillNo. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalTitleTable.SkillNo, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by SkillNo, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub TitleDateLabel1_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by TitleDate when clicked. + + ' Get previous sorting state for TitleDate. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalTitleTable.TitleDate) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for TitleDate. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalTitleTable.TitleDate, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by TitleDate, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub TitleLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by Title when clicked. + + ' Get previous sorting state for Title. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalTitleTable.Title) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for Title. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalTitleTable.Title, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by Title, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub TitleRankLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by TitleRank when clicked. + + ' Get previous sorting state for TitleRank. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalTitleTable.TitleRank) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for TitleRank. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalTitleTable.TitleRank, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by TitleRank, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + + ' Generate the event handling functions for button events. + + ' event handler for ImageButton + Public Overridable Sub PersonalTitleExportCSVButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + ' Build the where clause based on the current filter and search criteria + ' Create the Order By clause based on the user's current sorting preference. + + Dim wc As WhereClause = CreateWhereClause + Dim orderBy As OrderBy = Nothing + + orderBy = CreateOrderBy + + ' Add each of the columns in order of export. + Dim columns() as BaseColumn = New BaseColumn() { _ + PersonalTitleTable.TitleDate, _ + PersonalTitleTable.Title, _ + PersonalTitleTable.SkillNo, _ + PersonalTitleTable.TitleRank, _ + PersonalTitleTable.Command, _ + PersonalTitleTable.CommandDate, _ + PersonalTitleTable.Dept, _ + Nothing} + Dim exportData as ExportDataToCSV = New ExportDataToCSV(PersonalTitleTable.Instance, wc, orderBy, columns) + + Dim done As Boolean = False + + Dim totalRowsReturned As Integer = 0 + Dim join As CompoundFilter = CreateCompoundJoinFilter() + Dim data As DataForExport = New DataForExport(PersonalTitleTable.Instance, wc, orderBy, columns, join) + + 'Check for Export Data Threshold + Dim exportRawValues As Boolean = False + Me.TotalRecords = PersonalTitleTable.GetRecordCount(join, wc) + If Me.TotalRecords > 10000 Then + exportRawValues = True + End If + exportData.StartExport(Me.Page.Response, exportRawValues) + + ' Read pageSize records at a time and write out the CSV file. + While (Not done) + Dim recList As ArrayList = data.GetRows(exportData.pageSize) + If recList Is Nothing Then + Exit While 'no more records we are done + End If + + totalRowsReturned = recList.Count + For Each rec As BaseRecord In recList + For Each col As BaseColumn In data.ColumnList + If col Is Nothing Then + Continue For + End If + + If Not data.IncludeInExport(col) Then + Continue For + End If + + Dim val As String = "" + + If exportRawValues Then + val = rec.GetValue(col).ToString() + Else + Dim _isExpandableNonCompositeForeignKey As Boolean = col.TableDefinition.IsExpandableNonCompositeForeignKey(col) + If _isExpandableNonCompositeForeignKey AndAlso col.IsApplyDisplayAs Then + val = PersonalTitleTable.GetDFKA(rec.GetValue(col).ToString(), col, Nothing) + End If + If (Not _isExpandableNonCompositeForeignKey) Or (String.IsNullOrEmpty(val)) Then + val = exportData.GetDataForExport(col, rec) + End If + End If + exportData.WriteColumnData(val, data.IsString(col)) + + Next col + exportData.WriteNewRow() + Next rec + + ' If we already are below the pageSize, then we are done. + If totalRowsReturned < exportData.pageSize Then + done = True + End If + End While + exportData.FinishExport(Me.Page.Response) + + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalTitleExportExcelButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + ' To customize the columns or the format, override this function in Section 1 of the page + ' and modify it to your liking. + ' Build the where clause based on the current filter and search criteria + ' Create the Order By clause based on the user's current sorting preference. + + Dim wc As WhereClause = CreateWhereClause + Dim orderBy As OrderBy = Nothing + + orderBy = CreateOrderBy + + Dim done As Boolean = False + Dim val As Object = "" + ' Read pageSize records at a time and write out the Excel file. + Dim totalRowsReturned As Integer = 0 + + Me.TotalRecords = PersonalTitleTable.GetRecordCount(wc) + If Me.TotalRecords > 10000 Then + + ' Add each of the columns in order of export. + Dim columns() as BaseColumn = New BaseColumn() { _ + PersonalTitleTable.TitleDate, _ + PersonalTitleTable.Title, _ + PersonalTitleTable.SkillNo, _ + PersonalTitleTable.TitleRank, _ + PersonalTitleTable.Command, _ + PersonalTitleTable.CommandDate, _ + PersonalTitleTable.Dept, _ + Nothing} + Dim exportData as ExportDataToCSV = New ExportDataToCSV(PersonalTitleTable.Instance, wc, orderBy, columns) + exportData.StartExport(Me.Page.Response, True) + + Dim dataForCSV As DataForExport = New DataForExport(PersonalTitleTable.Instance, wc, orderBy, columns) + + ' Read pageSize records at a time and write out the CSV file. + While (Not done) + Dim recList As ArrayList = dataForCSV.GetRows(exportData.pageSize) + If recList Is Nothing Then + Exit While 'no more records we are done + End If + + totalRowsReturned = recList.Count + For Each rec As BaseRecord In recList + For Each col As BaseColumn In dataForCSV.ColumnList + If col Is Nothing Then + Continue For + End If + + If Not dataForCSV.IncludeInExport(col) Then + Continue For + End If + + val = rec.GetValue(col).ToString() + exportData.WriteColumnData(val, dataForCSV.IsString(col)) + + Next col + exportData.WriteNewRow() + Next rec + + ' If we already are below the pageSize, then we are done. + If totalRowsReturned < exportData.pageSize Then + done = True + End If + End While + exportData.FinishExport(Me.Page.Response) + Else + + ' Create an instance of the Excel report class with the table class, where clause and order by. + Dim excelReport As ExportDataToExcel = New ExportDataToExcel(PersonalTitleTable.Instance, wc, orderBy) + ' Add each of the columns in order of export. + ' To customize the data type, change the second parameter of the new ExcelColumn to be + ' a format string from Excel's Format Cell menu. For example "dddd, mmmm dd, yyyy h:mm AM/PM;@", "#,##0.00" + + If Me.Page.Response Is Nothing Then + Return + End If + + excelReport.CreateExcelBook() + + Dim width As Integer = 0 + Dim columnCounter As Integer = 0 + Dim data As DataForExport = New DataForExport(PersonalTitleTable.Instance, wc, orderBy, Nothing) + data.ColumnList.Add(New ExcelColumn(PersonalTitleTable.TitleDate, "Short Date")) + data.ColumnList.Add(New ExcelColumn(PersonalTitleTable.Title, "Default")) + data.ColumnList.Add(New ExcelColumn(PersonalTitleTable.SkillNo, "Default")) + data.ColumnList.Add(New ExcelColumn(PersonalTitleTable.TitleRank, "Default")) + data.ColumnList.Add(New ExcelColumn(PersonalTitleTable.Command, "Default")) + data.ColumnList.Add(New ExcelColumn(PersonalTitleTable.CommandDate, "Short Date")) + data.ColumnList.Add(New ExcelColumn(PersonalTitleTable.Dept, "Default")) + + + For Each col As ExcelColumn In data.ColumnList + width = excelReport.GetExcelCellWidth(col) + If data.IncludeInExport(col) Then + excelReport.AddColumnToExcelBook(columnCounter, col.ToString(), excelReport.GetExcelDataType(col), width, excelReport.GetDisplayFormat(col)) + columnCounter = columnCounter + 1 + End If + Next col + + While (Not done) + Dim recList As ArrayList = data.GetRows(excelReport.pageSize) + + If recList Is Nothing Then + Exit While 'no more records we are done + End If + + totalRowsReturned = recList.Count + + For Each rec As BaseRecord In recList + excelReport.AddRowToExcelBook() + columnCounter = 0 + + For Each col As ExcelColumn In data.ColumnList + If Not data.IncludeInExport(col) Then + Continue For + End If + + Dim _isExpandableNonCompositeForeignKey As Boolean = col.DisplayColumn.TableDefinition.IsExpandableNonCompositeForeignKey(col.DisplayColumn) + If _isExpandableNonCompositeForeignKey AndAlso col.DisplayColumn.IsApplyDisplayAs Then + val = PersonalTitleTable.GetDFKA(rec.GetValue(col.DisplayColumn).ToString(), col.DisplayColumn, Nothing) + If val Is Nothing Then + val = rec.Format(col.DisplayColumn) + End If + Else + val = excelReport.GetValueForExcelExport(col, rec) + End If + excelReport.AddCellToExcelRow(columnCounter, excelReport.GetExcelDataType(col), val, col.DisplayFormat) + + columnCounter = columnCounter + 1 + Next col + Next rec + + ' If we already are below the pageSize, then we are done. + If totalRowsReturned < excelReport.pageSize Then + done = True + End If + End While + + excelReport.SaveExcelBook(Me.Page.Response) + End If + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalTitleImportButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalTitlePDFButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + Dim report As PDFReport = New PDFReport() + report.SpecificReportFileName = Page.Server.MapPath("ShowPersonalId.PersonalTitlePDFButton.report") + ' report.Title replaces the value tag of page header and footer containing ${ReportTitle} + report.Title = "PersonalTitle" + ' If ShowPersonalId.PersonalTitlePDFButton.report specifies a valid report template, + ' AddColumn method will generate a report template. + ' Each AddColumn method-call specifies a column + ' The 1st parameter represents the text of the column header + ' The 2nd parameter represents the horizontal alignment of the column header + ' The 3rd parameter represents the text format of the column detail + ' The 4th parameter represents the horizontal alignment of the column detail + ' The 5th parameter represents the relative width of the column + report.AddColumn(PersonalTitleTable.TitleDate.Name, ReportEnum.Align.Left, "${TitleDate}", ReportEnum.Align.Left, 20) + report.AddColumn(PersonalTitleTable.Title.Name, ReportEnum.Align.Left, "${Title}", ReportEnum.Align.Left, 30) + report.AddColumn(PersonalTitleTable.SkillNo.Name, ReportEnum.Align.Left, "${SkillNo}", ReportEnum.Align.Left, 15) + report.AddColumn(PersonalTitleTable.TitleRank.Name, ReportEnum.Align.Left, "${TitleRank}", ReportEnum.Align.Left, 15) + report.AddColumn(PersonalTitleTable.Command.Name, ReportEnum.Align.Left, "${Command}", ReportEnum.Align.Left, 30) + report.AddColumn(PersonalTitleTable.CommandDate.Name, ReportEnum.Align.Left, "${CommandDate}", ReportEnum.Align.Left, 20) + report.AddColumn(PersonalTitleTable.Dept.Name, ReportEnum.Align.Left, "${Dept}", ReportEnum.Align.Left, 30) + + + Dim rowsPerQuery As Integer = 5000 + Dim recordCount As Integer = 0 + + report.Page = Page.GetResourceValue("Txt:Page", "Persons") + report.ApplicationPath = Me.Page.MapPath(Page.Request.ApplicationPath) + + Dim whereClause As WhereClause = CreateWhereClause + Dim orderBy As OrderBy = CreateOrderBy + Dim joinFilter As BaseFilter = CreateCompoundJoinFilter() + + Dim pageNum As Integer = 0 + Dim totalRows As Integer = PersonalTitleTable.GetRecordCount(joinFilter,whereClause) + Dim columns As ColumnList = PersonalTitleTable.GetColumnList() + Dim records As PersonalTitleRecord() = Nothing + + Do + + records = PersonalTitleTable.GetRecords(joinFilter,whereClause, orderBy, pageNum, rowsPerQuery) + If Not (records Is Nothing) AndAlso records.Length > 0 AndAlso whereClause.RunQuery Then + For Each record As PersonalTitleRecord In records + + ' AddData method takes four parameters + ' The 1st parameters represent the data format + ' The 2nd parameters represent the data value + ' The 3rd parameters represent the default alignment of column using the data + ' The 4th parameters represent the maximum length of the data value being shown + report.AddData("${TitleDate}", record.Format(PersonalTitleTable.TitleDate), ReportEnum.Align.Left, 100) + report.AddData("${Title}", record.Format(PersonalTitleTable.Title), ReportEnum.Align.Left, 100) + report.AddData("${SkillNo}", record.Format(PersonalTitleTable.SkillNo), ReportEnum.Align.Left, 100) + report.AddData("${TitleRank}", record.Format(PersonalTitleTable.TitleRank), ReportEnum.Align.Left, 100) + report.AddData("${Command}", record.Format(PersonalTitleTable.Command), ReportEnum.Align.Left, 100) + report.AddData("${CommandDate}", record.Format(PersonalTitleTable.CommandDate), ReportEnum.Align.Left, 100) + report.AddData("${Dept}", record.Format(PersonalTitleTable.Dept), ReportEnum.Align.Left, 100) + + report.WriteRow + Next + pageNum = pageNum + 1 + recordCount += records.Length + End If + Loop While Not (records Is Nothing) AndAlso recordCount < totalRows AndAlso whereClause.RunQuery + + report.Close + BaseClasses.Utils.NetUtils.WriteResponseBinaryAttachment(Me.Page.Response, report.Title + ".pdf", report.ReportInByteArray, 0, true) + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalTitleRefreshButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Dim PersonalDDTableControlObj as PersonalDDTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalDDTableControl"), PersonalDDTableControl) + PersonalDDTableControlObj.ResetData = True + + PersonalDDTableControlObj.RemoveFromSession(PersonalDDTableControlObj, "DeletedRecordIds") + PersonalDDTableControlObj.DeletedRecordIds = Nothing + + Dim PersonalEducationTableControlObj as PersonalEducationTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalEducationTableControl"), PersonalEducationTableControl) + PersonalEducationTableControlObj.ResetData = True + + PersonalEducationTableControlObj.RemoveFromSession(PersonalEducationTableControlObj, "DeletedRecordIds") + PersonalEducationTableControlObj.DeletedRecordIds = Nothing + + Dim PersonalExtWorkTableControlObj as PersonalExtWorkTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalExtWorkTableControl"), PersonalExtWorkTableControl) + PersonalExtWorkTableControlObj.ResetData = True + + PersonalExtWorkTableControlObj.RemoveFromSession(PersonalExtWorkTableControlObj, "DeletedRecordIds") + PersonalExtWorkTableControlObj.DeletedRecordIds = Nothing + + Dim PersonalIdRecordControlObj as PersonalIdRecordControl = DirectCast(Me.Page.FindControlRecursively("PersonalIdRecordControl"), PersonalIdRecordControl) + PersonalIdRecordControlObj.ResetData = True + + + Dim PersonalInsigniaTableControlObj as PersonalInsigniaTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalInsigniaTableControl"), PersonalInsigniaTableControl) + PersonalInsigniaTableControlObj.ResetData = True + + PersonalInsigniaTableControlObj.RemoveFromSession(PersonalInsigniaTableControlObj, "DeletedRecordIds") + PersonalInsigniaTableControlObj.DeletedRecordIds = Nothing + + Dim PersonalLanguageSkillTableControlObj as PersonalLanguageSkillTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalLanguageSkillTableControl"), PersonalLanguageSkillTableControl) + PersonalLanguageSkillTableControlObj.ResetData = True + + PersonalLanguageSkillTableControlObj.RemoveFromSession(PersonalLanguageSkillTableControlObj, "DeletedRecordIds") + PersonalLanguageSkillTableControlObj.DeletedRecordIds = Nothing + + Dim PersonalNameTableControlObj as PersonalNameTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalNameTableControl"), PersonalNameTableControl) + PersonalNameTableControlObj.ResetData = True + + PersonalNameTableControlObj.RemoveFromSession(PersonalNameTableControlObj, "DeletedRecordIds") + PersonalNameTableControlObj.DeletedRecordIds = Nothing + + Dim PersonalRankTableControlObj as PersonalRankTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalRankTableControl"), PersonalRankTableControl) + PersonalRankTableControlObj.ResetData = True + + PersonalRankTableControlObj.RemoveFromSession(PersonalRankTableControlObj, "DeletedRecordIds") + PersonalRankTableControlObj.DeletedRecordIds = Nothing + + Dim PersonalSalaryTableControlObj as PersonalSalaryTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalSalaryTableControl"), PersonalSalaryTableControl) + PersonalSalaryTableControlObj.ResetData = True + + PersonalSalaryTableControlObj.RemoveFromSession(PersonalSalaryTableControlObj, "DeletedRecordIds") + PersonalSalaryTableControlObj.DeletedRecordIds = Nothing + + Dim PersonalSpecialSkillTableControlObj as PersonalSpecialSkillTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalSpecialSkillTableControl"), PersonalSpecialSkillTableControl) + PersonalSpecialSkillTableControlObj.ResetData = True + + PersonalSpecialSkillTableControlObj.RemoveFromSession(PersonalSpecialSkillTableControlObj, "DeletedRecordIds") + PersonalSpecialSkillTableControlObj.DeletedRecordIds = Nothing + + Dim PersonalSportSkillTableControlObj as PersonalSportSkillTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalSportSkillTableControl"), PersonalSportSkillTableControl) + PersonalSportSkillTableControlObj.ResetData = True + + PersonalSportSkillTableControlObj.RemoveFromSession(PersonalSportSkillTableControlObj, "DeletedRecordIds") + PersonalSportSkillTableControlObj.DeletedRecordIds = Nothing + + Dim PersonalTitleTableControlObj as PersonalTitleTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalTitleTableControl"), PersonalTitleTableControl) + PersonalTitleTableControlObj.ResetData = True + + PersonalTitleTableControlObj.RemoveFromSession(PersonalTitleTableControlObj, "DeletedRecordIds") + PersonalTitleTableControlObj.DeletedRecordIds = Nothing + + Dim PersonRelativeTableControlObj as PersonRelativeTableControl = DirectCast(Me.Page.FindControlRecursively("PersonRelativeTableControl"), PersonRelativeTableControl) + PersonRelativeTableControlObj.ResetData = True + + PersonRelativeTableControlObj.RemoveFromSession(PersonRelativeTableControlObj, "DeletedRecordIds") + PersonRelativeTableControlObj.DeletedRecordIds = Nothing + + Dim ReportPropertiesTableControlObj as ReportPropertiesTableControl = DirectCast(Me.Page.FindControlRecursively("ReportPropertiesTableControl"), ReportPropertiesTableControl) + ReportPropertiesTableControlObj.ResetData = True + + ReportPropertiesTableControlObj.RemoveFromSession(ReportPropertiesTableControlObj, "DeletedRecordIds") + ReportPropertiesTableControlObj.DeletedRecordIds = Nothing + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalTitleResetButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.CurrentSortOrder.Reset() + If Me.InSession(Me, "Order_By") Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + Me.CurrentSortOrder.Add(PersonalTitleTable.TitleDate, OrderByItem.OrderDir.Asc) + + + End If + + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalTitleWordButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + Dim report As WordReport = New WordReport + report.SpecificReportFileName = Page.Server.MapPath("ShowPersonalId.PersonalTitleWordButton.word") + ' report.Title replaces the value tag of page header and footer containing ${ReportTitle} + report.Title = "PersonalTitle" + ' If ShowPersonalId.PersonalTitleWordButton.report specifies a valid report template, + ' AddColumn method will generate a report template. + ' Each AddColumn method-call specifies a column + ' The 1st parameter represents the text of the column header + ' The 2nd parameter represents the horizontal alignment of the column header + ' The 3rd parameter represents the text format of the column detail + ' The 4th parameter represents the horizontal alignment of the column detail + ' The 5th parameter represents the relative width of the column + report.AddColumn(PersonalTitleTable.TitleDate.Name, ReportEnum.Align.Left, "${TitleDate}", ReportEnum.Align.Left, 20) + report.AddColumn(PersonalTitleTable.Title.Name, ReportEnum.Align.Left, "${Title}", ReportEnum.Align.Left, 30) + report.AddColumn(PersonalTitleTable.SkillNo.Name, ReportEnum.Align.Left, "${SkillNo}", ReportEnum.Align.Left, 15) + report.AddColumn(PersonalTitleTable.TitleRank.Name, ReportEnum.Align.Left, "${TitleRank}", ReportEnum.Align.Left, 15) + report.AddColumn(PersonalTitleTable.Command.Name, ReportEnum.Align.Left, "${Command}", ReportEnum.Align.Left, 30) + report.AddColumn(PersonalTitleTable.CommandDate.Name, ReportEnum.Align.Left, "${CommandDate}", ReportEnum.Align.Left, 20) + report.AddColumn(PersonalTitleTable.Dept.Name, ReportEnum.Align.Left, "${Dept}", ReportEnum.Align.Left, 30) + + Dim whereClause As WhereClause = CreateWhereClause + + Dim orderBy As OrderBy = CreateOrderBy + Dim joinFilter As BaseFilter = CreateCompoundJoinFilter() + + Dim rowsPerQuery As Integer = 5000 + Dim pageNum As Integer = 0 + Dim recordCount As Integer = 0 + Dim totalRows As Integer = PersonalTitleTable.GetRecordCount(joinFilter,whereClause) + + report.Page = Page.GetResourceValue("Txt:Page", "Persons") + report.ApplicationPath = Me.Page.MapPath(Page.Request.ApplicationPath) + + Dim columns As ColumnList = PersonalTitleTable.GetColumnList() + Dim records As PersonalTitleRecord() = Nothing + Do + records = PersonalTitleTable.GetRecords(joinFilter,whereClause, orderBy, pageNum, rowsPerQuery) + + If Not (records Is Nothing) AndAlso records.Length > 0 AndAlso whereClause.RunQuery Then + For Each record As PersonalTitleRecord In records + ' AddData method takes four parameters + ' The 1st parameters represent the data format + ' The 2nd parameters represent the data value + ' The 3rd parameters represent the default alignment of column using the data + ' The 4th parameters represent the maximum length of the data value being shown + report.AddData("${TitleDate}", record.Format(PersonalTitleTable.TitleDate), ReportEnum.Align.Left, 100) + report.AddData("${Title}", record.Format(PersonalTitleTable.Title), ReportEnum.Align.Left, 100) + report.AddData("${SkillNo}", record.Format(PersonalTitleTable.SkillNo), ReportEnum.Align.Left, 100) + report.AddData("${TitleRank}", record.Format(PersonalTitleTable.TitleRank), ReportEnum.Align.Left, 100) + report.AddData("${Command}", record.Format(PersonalTitleTable.Command), ReportEnum.Align.Left, 100) + report.AddData("${CommandDate}", record.Format(PersonalTitleTable.CommandDate), ReportEnum.Align.Left, 100) + report.AddData("${Dept}", record.Format(PersonalTitleTable.Dept), ReportEnum.Align.Left, 100) + + report.WriteRow + Next + pageNum = pageNum + 1 + recordCount += records.Length + End If + Loop While Not (records Is Nothing) AndAlso recordCount < totalRows AndAlso whereClause.RunQuery + report.save + BaseClasses.Utils.NetUtils.WriteResponseBinaryAttachment(Me.Page.Response, report.Title + ".doc", report.ReportInByteArray, 0, true) + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + + + ' Generate the event handling functions for filter and search events. + + + ' Generate the event handling functions for others + + + Private _UIData As New System.Collections.Generic.List(Of Hashtable) + Public Property UIData() As System.Collections.Generic.List(Of Hashtable) + Get + Return Me._UIData + End Get + Set(ByVal value As System.Collections.Generic.List(Of Hashtable)) + Me._UIData = value + End Set + End Property + + ' pagination properties + Protected _PageSize As Integer + Public Property PageSize() As Integer + Get + Return Me._PageSize + End Get + Set(ByVal value As Integer) + Me._PageSize = value + End Set + End Property + + Protected _PageIndex As Integer + Public Property PageIndex() As Integer + Get + ' Return the PageIndex + Return Me._PageIndex + End Get + Set(ByVal value As Integer) + Me._PageIndex = value + End Set + End Property + + Protected _TotalRecords As Integer = -1 + Public Property TotalRecords() As Integer + Get + If _TotalRecords < 0 + _TotalRecords = PersonalTitleTable.GetRecordCount(CreateCompoundJoinFilter(), CreateWhereClause()) + End If + Return Me._TotalRecords + End Get + Set(ByVal value As Integer) + If Me.PageSize > 0 Then + + Me.TotalPages = CInt(Math.Ceiling(value / Me.PageSize)) + + End If + Me._TotalRecords = value + End Set + End Property + + + + Protected _TotalPages As Integer = -1 + Public Property TotalPages() As Integer + Get + If _TotalPages < 0 Then + + Me.TotalPages = CInt(Math.Ceiling(TotalRecords / Me.PageSize)) + + End If + Return Me._TotalPages + End Get + Set(ByVal value As Integer) + Me._TotalPages = value + End Set + End Property + + Protected _DisplayLastPage As Boolean + Public Property DisplayLastPage() As Boolean + Get + Return Me._DisplayLastPage + End Get + Set(ByVal value As Boolean) + Me._DisplayLastPage = value + End Set + End Property + + Private _DataChanged As Boolean = False + Public Property DataChanged() As Boolean + Get + Return Me._DataChanged + End Get + Set(ByVal value As Boolean) + Me._DataChanged = value + End Set + End Property + + Private _ResetData As Boolean = False + Public Property ResetData() As Boolean + Get + Return Me._ResetData + End Get + Set(ByVal value As Boolean) + Me._ResetData = value + End Set + End Property + + Private _AddNewRecord As Integer = 0 + Public Property AddNewRecord() As Integer + Get + Return Me._AddNewRecord + End Get + Set(ByVal value As Integer) + Me._AddNewRecord = value + End Set + End Property + + + Private _CurrentSortOrder As OrderBy = Nothing + Public Property CurrentSortOrder() As OrderBy + Get + Return Me._CurrentSortOrder + End Get + Set(ByVal value As BaseClasses.Data.OrderBy) + Me._CurrentSortOrder = value + End Set + End Property + + Private _DataSource() As PersonalTitleRecord = Nothing + Public Property DataSource() As PersonalTitleRecord () + Get + Return Me._DataSource + End Get + Set(ByVal value() As PersonalTitleRecord) + Me._DataSource = value + End Set + End Property + +#Region "Helper Properties" + + Public ReadOnly Property CommandDateLabel3() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "CommandDateLabel3"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property CommandLabel2() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "CommandLabel2"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property DeptLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "DeptLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property PersonalTitleExportCSVButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalTitleExportCSVButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalTitleExportExcelButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalTitleExportExcelButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalTitleImportButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalTitleImportButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalTitlePagination() As Persons.UI.IPagination + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalTitlePagination"), Persons.UI.IPagination) + End Get + End Property + + Public ReadOnly Property PersonalTitlePDFButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalTitlePDFButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalTitleRefreshButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalTitleRefreshButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalTitleResetButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalTitleResetButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalTitleTableControlCollapsibleRegion() As System.Web.UI.WebControls.Panel + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalTitleTableControlCollapsibleRegion"), System.Web.UI.WebControls.Panel) + End Get + End Property + + Public ReadOnly Property PersonalTitleWordButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalTitleWordButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property SkillNoLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "SkillNoLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property TitleDateLabel1() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "TitleDateLabel1"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property TitleLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "TitleLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property TitleRankLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "TitleRankLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + +#End Region + +#Region "Helper Functions" + + Public Overrides Overloads Function ModifyRedirectUrl(url As String, arg As String, ByVal bEncrypt As Boolean) As String + Return Me.Page.EvaluateExpressions(url, arg, bEncrypt, Me) + End Function + + Public Overrides Overloads Function EvaluateExpressions(url As String, arg As String, ByVal bEncrypt As Boolean) As String + Dim needToProcess As Boolean = AreAnyUrlParametersForMe(url, arg) + If (needToProcess) Then + Dim recCtl As PersonalTitleTableControlRow = Me.GetSelectedRecordControl() + If recCtl Is Nothing AndAlso url.IndexOf("{") >= 0 Then + ' Localization. + Throw New Exception(Page.GetResourceValue("Err:NoRecSelected", "Persons")) + End If + Dim rec As PersonalTitleRecord = Nothing + If recCtl IsNot Nothing Then + rec = recCtl.GetRecord() + End If + Return EvaluateExpressions(url, arg, rec, bEncrypt) + End If + Return url + End Function + + Public Overridable Function GetSelectedRecordControl() As PersonalTitleTableControlRow + Return Nothing + + End Function + + Public Overridable Function GetSelectedRecordControls() As PersonalTitleTableControlRow() + + Return DirectCast((new ArrayList()).ToArray(GetType(PersonalTitleTableControlRow)), PersonalTitleTableControlRow()) + + End Function + + Public Overridable Sub DeleteSelectedRecords(ByVal deferDeletion As Boolean) + Dim recList() As PersonalTitleTableControlRow = Me.GetSelectedRecordControls() + If recList.Length = 0 Then + ' Localization. + Throw New Exception(Page.GetResourceValue("Err:NoRecSelected", "Persons")) + End If + + Dim recCtl As PersonalTitleTableControlRow + For Each recCtl In recList + If deferDeletion Then + If Not recCtl.IsNewRecord Then + + Me.AddToDeletedRecordIds(recCtl) + + End If + recCtl.Visible = False + + Else + + recCtl.Delete() + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + End If + Next + End Sub + + Public Function GetRecordControls() As PersonalTitleTableControlRow() + Dim recList As ArrayList = New ArrayList() + Dim rep As System.Web.UI.WebControls.Repeater = CType(Me.FindControl("PersonalTitleTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return Nothing + Dim repItem As System.Web.UI.WebControls.RepeaterItem + + For Each repItem In rep.Items + + Dim recControl As PersonalTitleTableControlRow = DirectCast(repItem.FindControl("PersonalTitleTableControlRow"), PersonalTitleTableControlRow) + recList.Add(recControl) + + Next + + Return DirectCast(recList.ToArray(GetType(PersonalTitleTableControlRow)), PersonalTitleTableControlRow()) + End Function + + Public Shadows ReadOnly Property Page() As BaseApplicationPage + Get + Return DirectCast(MyBase.Page, BaseApplicationPage) + End Get + End Property + +#End Region + + + +End Class + + +' Base class for the PersonRelativeTableControlRow control on the ShowPersonalId page. +' Do not modify this class. Instead override any method in PersonRelativeTableControlRow. +Public Class BasePersonRelativeTableControlRow + Inherits Persons.UI.BaseApplicationRecordControl + + ' To customize, override this method in PersonRelativeTableControlRow. + Protected Overridable Sub Control_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Init + + Me.ClearControlsFromSession() + End Sub + + ' To customize, override this method in PersonRelativeTableControlRow. + Protected Overridable Sub Control_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load + + 'Call LoadFocusScripts from repeater so that onfocus attribute could be added to elements + Me.Page.LoadFocusScripts(Me) + + + ' Register the event handlers. + + + 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 + + ' Since this is a row in the table, the data for this row is loaded by the + ' LoadData method of the BasePersonRelativeTableControl when the data for the entire + ' table is loaded. + + Me.DataSource = New PersonRelativeRecord() + + + + End Sub + + ' Populate the UI controls using the DataSource. To customize, override this method in PersonRelativeTableControlRow. + 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() + SetFName() + SetMLastName() + SetMName() + SetMOrLastName() + SetRAddress() + SetRAmphur() + SetRBirthDate() + SetRef4() + SetRefDate2() + SetRelationId() + SetRFirstName() + SetRLastName() + SetRNationality() + SetROrigin() + SetROrLastName() + SetRPreName() + SetRProvince() + SetRReligion() + SetRRemark() + SetRStatus() + SetRStatusDate() + SetRStatusRef() + + + 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 Literal 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:Literal 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) + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + 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 + + ' If the FLastName is NULL or blank, then use the value specified + ' on Properties. + If Me.FLastName.Text Is Nothing _ + OrElse Me.FLastName.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.FLastName.Text = " " + End If + + End Sub + + Public Overridable Sub SetFName() + + + ' Set the FName Literal 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:Literal 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) + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + 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 + + ' If the FName is NULL or blank, then use the value specified + ' on Properties. + If Me.FName.Text Is Nothing _ + OrElse Me.FName.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.FName.Text = " " + End If + + End Sub + + Public Overridable Sub SetMLastName() + + + ' Set the MLastName Literal 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:Literal 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) + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + 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 + + ' If the MLastName is NULL or blank, then use the value specified + ' on Properties. + If Me.MLastName.Text Is Nothing _ + OrElse Me.MLastName.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.MLastName.Text = " " + End If + + End Sub + + Public Overridable Sub SetMName() + + + ' Set the MName Literal 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:Literal 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) + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + 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 + + ' If the MName is NULL or blank, then use the value specified + ' on Properties. + If Me.MName.Text Is Nothing _ + OrElse Me.MName.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.MName.Text = " " + End If + + End Sub + + Public Overridable Sub SetMOrLastName() + + + ' Set the MOrLastName Literal 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:Literal 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) + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + 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 + + ' If the MOrLastName is NULL or blank, then use the value specified + ' on Properties. + If Me.MOrLastName.Text Is Nothing _ + OrElse Me.MOrLastName.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.MOrLastName.Text = " " + End If + + End Sub + + Public Overridable Sub SetRAddress() + + + ' Set the RAddress Literal 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:Literal 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) + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + 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 + + ' If the RAddress is NULL or blank, then use the value specified + ' on Properties. + If Me.RAddress.Text Is Nothing _ + OrElse Me.RAddress.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.RAddress.Text = " " + End If + + End Sub + + Public Overridable Sub SetRAmphur() + + + ' Set the RAmphur Literal 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:Literal 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) + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + 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 + + ' If the RAmphur is NULL or blank, then use the value specified + ' on Properties. + If Me.RAmphur.Text Is Nothing _ + OrElse Me.RAmphur.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.RAmphur.Text = " " + End If + + End Sub + + Public Overridable Sub SetRBirthDate() + + + ' Set the RBirthDate Literal 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:Literal 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") + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + 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 + + ' If the RBirthDate is NULL or blank, then use the value specified + ' on Properties. + If Me.RBirthDate.Text Is Nothing _ + OrElse Me.RBirthDate.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.RBirthDate.Text = " " + End If + + End Sub + + Public Overridable Sub SetRef4() + + + ' Set the Ref Literal on the webpage with value from the + ' PersonRelative database record. + + ' Me.DataSource is the PersonRelative record retrieved from the database. + ' Me.Ref4 is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetRef4() + ' 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) + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + If Not formattedValue is Nothing Then + Dim popupThreshold as Integer = CType(100, Integer) + + Dim maxLength as Integer = Len(formattedValue) + If (maxLength > CType(100, Integer)) Then + ' Truncate based on FieldMaxLength on Properties. + maxLength = CType(100, Integer) + + End If + + ' For fields values larger than the PopupTheshold on Properties, display a popup. + If Len(formattedValue) >= popupThreshold Then + + Dim name As String = HttpUtility.HtmlEncode(PersonRelativeTable.Ref0.Name) + + If Not HttpUtility.HtmlEncode("%ISD_DEFAULT%").Equals("%ISD_DEFAULT%") Then + name = HttpUtility.HtmlEncode(Me.Page.GetResourceValue("%ISD_DEFAULT%")) + End If + + + + formattedValue= "" & NetUtils.EncodeStringForHtmlDisplay(formattedValue.Substring(0, maxLength)) + + If (maxLength = CType(100, Integer)) Then + formattedValue = formattedValue & "..." & "" + Else + formattedValue = formattedValue & "" + + End If + Else + If maxLength = CType(100, Integer) Then + formattedValue= NetUtils.EncodeStringForHtmlDisplay(formattedValue.SubString(0,MaxLength)) + formattedValue = formattedValue & "..." + + End If + End If + End If + + Me.Ref4.Text = formattedValue + + Else + + ' Ref is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.Ref4.Text = PersonRelativeTable.Ref0.Format(PersonRelativeTable.Ref0.DefaultValue) + + End If + + ' If the Ref is NULL or blank, then use the value specified + ' on Properties. + If Me.Ref4.Text Is Nothing _ + OrElse Me.Ref4.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.Ref4.Text = " " + End If + + End Sub + + Public Overridable Sub SetRefDate2() + + + ' Set the RefDate Literal on the webpage with value from the + ' PersonRelative database record. + + ' Me.DataSource is the PersonRelative record retrieved from the database. + ' Me.RefDate2 is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetRefDate2() + ' 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") + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.RefDate2.Text = formattedValue + + Else + + ' RefDate is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.RefDate2.Text = PersonRelativeTable.RefDate.Format(PersonRelativeTable.RefDate.DefaultValue, "d MMM yy") + + End If + + ' If the RefDate is NULL or blank, then use the value specified + ' on Properties. + If Me.RefDate2.Text Is Nothing _ + OrElse Me.RefDate2.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.RefDate2.Text = " " + End If + + End Sub + + Public Overridable Sub SetRelationId() + + + ' Set the RelationId Literal 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:Literal 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 + Dim formattedValue As String = "" + Dim _isExpandableNonCompositeForeignKey As Boolean = PersonRelativeTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonRelativeTable.RelationId) + If _isExpandableNonCompositeForeignKey AndAlso PersonRelativeTable.RelationId.IsApplyDisplayAs Then + + formattedValue = PersonRelativeTable.GetDFKA(Me.DataSource.RelationId.ToString(),PersonRelativeTable.RelationId, Nothing) + + if (formattedValue Is Nothing) Then + formattedValue = Me.DataSource.Format(PersonRelativeTable.RelationId) + End If + Else + formattedValue = Me.DataSource.RelationId.ToString() + End If + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.RelationId.Text = formattedValue + + Else + + ' RelationId is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.RelationId.Text = PersonRelativeTable.RelationId.Format(PersonRelativeTable.RelationId.DefaultValue) + + End If + + ' If the RelationId is NULL or blank, then use the value specified + ' on Properties. + If Me.RelationId.Text Is Nothing _ + OrElse Me.RelationId.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.RelationId.Text = " " + End If + + End Sub + + Public Overridable Sub SetRFirstName() + + + ' Set the RFirstName Literal 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:Literal 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) + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + 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 + + ' If the RFirstName is NULL or blank, then use the value specified + ' on Properties. + If Me.RFirstName.Text Is Nothing _ + OrElse Me.RFirstName.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.RFirstName.Text = " " + End If + + End Sub + + Public Overridable Sub SetRLastName() + + + ' Set the RLastName Literal 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:Literal 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) + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + 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 + + ' If the RLastName is NULL or blank, then use the value specified + ' on Properties. + If Me.RLastName.Text Is Nothing _ + OrElse Me.RLastName.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.RLastName.Text = " " + End If + + End Sub + + Public Overridable Sub SetRNationality() + + + ' Set the RNationality Literal 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:Literal 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) + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + 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 + + ' If the RNationality is NULL or blank, then use the value specified + ' on Properties. + If Me.RNationality.Text Is Nothing _ + OrElse Me.RNationality.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.RNationality.Text = " " + End If + + End Sub + + Public Overridable Sub SetROrigin() + + + ' Set the ROrigin Literal 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:Literal 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) + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + 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 + + ' If the ROrigin is NULL or blank, then use the value specified + ' on Properties. + If Me.ROrigin.Text Is Nothing _ + OrElse Me.ROrigin.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.ROrigin.Text = " " + End If + + End Sub + + Public Overridable Sub SetROrLastName() + + + ' Set the ROrLastName Literal 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:Literal 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) + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + 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 + + ' If the ROrLastName is NULL or blank, then use the value specified + ' on Properties. + If Me.ROrLastName.Text Is Nothing _ + OrElse Me.ROrLastName.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.ROrLastName.Text = " " + End If + + End Sub + + Public Overridable Sub SetRPreName() + + + ' Set the RPreName Literal 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:Literal 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) + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + 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 + + ' If the RPreName is NULL or blank, then use the value specified + ' on Properties. + If Me.RPreName.Text Is Nothing _ + OrElse Me.RPreName.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.RPreName.Text = " " + End If + + End Sub + + Public Overridable Sub SetRProvince() + + + ' Set the RProvince Literal 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:Literal 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) + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + 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 + + ' If the RProvince is NULL or blank, then use the value specified + ' on Properties. + If Me.RProvince.Text Is Nothing _ + OrElse Me.RProvince.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.RProvince.Text = " " + End If + + End Sub + + Public Overridable Sub SetRReligion() + + + ' Set the RReligion Literal 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:Literal 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) + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + 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 + + ' If the RReligion is NULL or blank, then use the value specified + ' on Properties. + If Me.RReligion.Text Is Nothing _ + OrElse Me.RReligion.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.RReligion.Text = " " + End If + + End Sub + + Public Overridable Sub SetRRemark() + + + ' Set the RRemark Literal 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:Literal 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) + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + 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 + + ' If the RRemark is NULL or blank, then use the value specified + ' on Properties. + If Me.RRemark.Text Is Nothing _ + OrElse Me.RRemark.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.RRemark.Text = " " + End If + + End Sub + + Public Overridable Sub SetRStatus() + + + ' Set the RStatus Literal 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:Literal 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 + Dim formattedValue As String = "" + Dim _isExpandableNonCompositeForeignKey As Boolean = PersonRelativeTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonRelativeTable.RStatus) + If _isExpandableNonCompositeForeignKey AndAlso PersonRelativeTable.RStatus.IsApplyDisplayAs Then + + formattedValue = PersonRelativeTable.GetDFKA(Me.DataSource.RStatus.ToString(),PersonRelativeTable.RStatus, Nothing) + + if (formattedValue Is Nothing) Then + formattedValue = Me.DataSource.Format(PersonRelativeTable.RStatus) + End If + Else + formattedValue = Me.DataSource.RStatus.ToString() + End If + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.RStatus.Text = formattedValue + + Else + + ' RStatus is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.RStatus.Text = PersonRelativeTable.RStatus.Format(PersonRelativeTable.RStatus.DefaultValue) + + End If + + ' If the RStatus is NULL or blank, then use the value specified + ' on Properties. + If Me.RStatus.Text Is Nothing _ + OrElse Me.RStatus.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.RStatus.Text = " " + End If + + End Sub + + Public Overridable Sub SetRStatusDate() + + + ' Set the RStatusDate Literal 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:Literal 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") + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + 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 + + ' If the RStatusDate is NULL or blank, then use the value specified + ' on Properties. + If Me.RStatusDate.Text Is Nothing _ + OrElse Me.RStatusDate.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.RStatusDate.Text = " " + End If + + End Sub + + Public Overridable Sub SetRStatusRef() + + + ' Set the RStatusRef Literal 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:Literal 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) + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + If Not formattedValue is Nothing Then + Dim popupThreshold as Integer = CType(100, Integer) + + Dim maxLength as Integer = Len(formattedValue) + If (maxLength > CType(100, Integer)) Then + ' Truncate based on FieldMaxLength on Properties. + maxLength = CType(100, Integer) + + End If + + ' For fields values larger than the PopupTheshold on Properties, display a popup. + If Len(formattedValue) >= popupThreshold Then + + Dim name As String = HttpUtility.HtmlEncode(PersonRelativeTable.RStatusRef.Name) + + If Not HttpUtility.HtmlEncode("%ISD_DEFAULT%").Equals("%ISD_DEFAULT%") Then + name = HttpUtility.HtmlEncode(Me.Page.GetResourceValue("%ISD_DEFAULT%")) + End If + + + + formattedValue= "" & NetUtils.EncodeStringForHtmlDisplay(formattedValue.Substring(0, maxLength)) + + If (maxLength = CType(100, Integer)) Then + formattedValue = formattedValue & "..." & "" + Else + formattedValue = formattedValue & "" + + End If + Else + If maxLength = CType(100, Integer) Then + formattedValue= NetUtils.EncodeStringForHtmlDisplay(formattedValue.SubString(0,MaxLength)) + formattedValue = formattedValue & "..." + + End If + End If + End If + + 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 + + ' If the RStatusRef is NULL or blank, then use the value specified + ' on Properties. + If Me.RStatusRef.Text Is Nothing _ + OrElse Me.RStatusRef.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.RStatusRef.Text = " " + End If + + End Sub + + + Public EvaluateFormulaDelegate As BaseClasses.Data.DataSource.EvaluateFormulaDelegate = New BaseClasses.Data.DataSource.EvaluateFormulaDelegate(AddressOf Me.EvaluateFormula) + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean, ByVal e As FormulaEvaluator) As String + If e Is Nothing Then + e = New FormulaEvaluator() + End If + + e.Variables.Clear() + + + ' add variables for formula evaluation + If variables IsNot Nothing Then + Dim enumerator As System.Collections.Generic.IEnumerator(Of System.Collections.Generic.KeyValuePair(Of String, Object)) = variables.GetEnumerator() + While enumerator.MoveNext() + e.Variables.Add(enumerator.Current.Key, enumerator.Current.Value) + End While + End If + + If includeDS + + End IF + + + ' Other variables referred to in the formula are expected to be + ' properties of the DataSource. For example, referring to + ' UnitPrice as a variable will refer to DataSource.UnitPrice + If dataSourceForEvaluate Is Nothing Then + + e.DataSource = Me.DataSource + + Else + e.DataSource = dataSourceForEvaluate + End If + + ' Define the calling control. This is used to add other + ' related table and record controls as variables. + e.CallingControl = Me + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + + If Not String.IsNullOrEmpty(format) AndAlso (String.IsNullOrEmpty(formula) OrElse formula.IndexOf("Format(") < 0) Then + Return FormulaUtils.Format(resultObj, format) + Else + Return resultObj.ToString() + End If + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format,variables ,includeDS, Nothing) + End Function + + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object)) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format, variables ,True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, format, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal e as FormulaEvaluator) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, variables, True, e) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal includeDS as Boolean) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, includeDS, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, True, Nothing) + End Function + + + Public Overridable Sub RegisterPostback() + + + End Sub + + + + ' To customize, override this method in PersonRelativeTableControlRow. + 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 parentCtrl As PersonalIdRecordControl + + + parentCtrl = DirectCast(Me.Page.FindControlRecursively("PersonalIdRecordControl"), PersonalIdRecordControl) + + If (Not IsNothing(parentCtrl) AndAlso IsNothing(parentCtrl.DataSource)) + ' Load the record if it is not loaded yet. + parentCtrl.LoadData() + End If + If (IsNothing(parentCtrl) OrElse IsNothing(parentCtrl.DataSource)) + ' Get the error message from the application resource file. + Throw New Exception(Page.GetResourceValue("Err:NoParentRecId", "Persons")) + End If + + Me.DataSource.PersonalId = parentCtrl.DataSource.PersonalId + + ' 2. Perform any custom validation. + Me.Validate() + + + ' 3. Set the values in the record with data from UI controls. + ' This calls the Get() method for each of the user interface controls. + Me.GetUIData() + + ' 4. Save in the database. + ' We should not save the record if the data did not change. This + ' will save a database hit and avoid triggering any database triggers. + + If Me.DataSource.IsAnyValueChanged Then + ' Save record to database but do not commit yet. + ' Auto generated ids are available after saving for use by child (dependent) records. + Me.DataSource.Save() + + DirectCast(GetParentControlObject(Me, "PersonRelativeTableControl"), PersonRelativeTableControl).DataChanged = True + DirectCast(GetParentControlObject(Me, "PersonRelativeTableControl"), PersonRelativeTableControl).ResetData = True + End If + + + ' update session or cookie by formula + + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + ' For Master-Detail relationships, save data on the Detail table(s) + + End Sub + + ' To customize, override this method in PersonRelativeTableControlRow. + 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() + GetRef4() + GetRefDate2() + GetRelationId() + GetRFirstName() + GetRLastName() + GetRNationality() + GetROrigin() + GetROrLastName() + GetRPreName() + GetRProvince() + GetRReligion() + GetRRemark() + GetRStatus() + GetRStatusDate() + GetRStatusRef() + End Sub + + + Public Overridable Sub GetFLastName() + + End Sub + + Public Overridable Sub GetFName() + + End Sub + + Public Overridable Sub GetMLastName() + + End Sub + + Public Overridable Sub GetMName() + + End Sub + + Public Overridable Sub GetMOrLastName() + + End Sub + + Public Overridable Sub GetRAddress() + + End Sub + + Public Overridable Sub GetRAmphur() + + End Sub + + Public Overridable Sub GetRBirthDate() + + End Sub + + Public Overridable Sub GetRef4() + + End Sub + + Public Overridable Sub GetRefDate2() + + End Sub + + Public Overridable Sub GetRelationId() + + End Sub + + Public Overridable Sub GetRFirstName() + + End Sub + + Public Overridable Sub GetRLastName() + + End Sub + + Public Overridable Sub GetRNationality() + + End Sub + + Public Overridable Sub GetROrigin() + + End Sub + + Public Overridable Sub GetROrLastName() + + End Sub + + Public Overridable Sub GetRPreName() + + End Sub + + Public Overridable Sub GetRProvince() + + End Sub + + Public Overridable Sub GetRReligion() + + End Sub + + Public Overridable Sub GetRRemark() + + End Sub + + Public Overridable Sub GetRStatus() + + End Sub + + Public Overridable Sub GetRStatusDate() + + End Sub + + Public Overridable Sub GetRStatusRef() + + End Sub + + + ' To customize, override this method in PersonRelativeTableControlRow. + + Public Overridable Function CreateWhereClause() As WhereClause + + Return Nothing + + End Function + + + + ' To customize, override this method in PersonRelativeTableControlRow. + 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) + + DirectCast(GetParentControlObject(Me, "PersonRelativeTableControl"), PersonRelativeTableControl).DataChanged = True + DirectCast(GetParentControlObject(Me, "PersonRelativeTableControl"), PersonRelativeTableControl).ResetData = True + End Sub + + Protected Overridable Sub Control_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.PreRender + ' PreRender event is raised just before page is being displayed. + Try + DbUtils.StartTransaction() + Me.RegisterPostback() + + If Not Me.Page.ErrorOnPage AndAlso (Me.Page.IsPageRefresh OrElse Me.DataChanged OrElse Me.ResetData) Then + + + ' Re-load the data and update the web page if necessary. + ' This is typically done during a postback (filter, search button, sort, pagination button). + ' In each of the other click handlers, simply set DataChanged to True to reload the data. + Me.LoadData() + Me.DataBind() + End If + + + Catch ex As Exception + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + Finally + DbUtils.EndTransaction() + End Try + End Sub + + + Protected Overrides Sub SaveControlsToSession() + MyBase.SaveControlsToSession() + + + 'Save pagination state to session. + + End Sub + + + + Protected Overrides Sub ClearControlsFromSession() + MyBase.ClearControlsFromSession() + + + + ' Clear pagination state from session. + + End Sub + + Protected Overrides Sub LoadViewState(ByVal savedState As Object) + MyBase.LoadViewState(savedState) + Dim isNewRecord As String = CType(ViewState("IsNewRecord"), String) + If Not isNewRecord Is Nothing AndAlso isNewRecord.Trim <> "" Then + Me.IsNewRecord = Boolean.Parse(isNewRecord) + End If + + Dim myCheckSum As String = CType(ViewState("CheckSum"), String) + If Not myCheckSum Is Nothing AndAlso myCheckSum.Trim <> "" Then + Me.CheckSum = myCheckSum + End If + + + ' Load view state for pagination control. + + End Sub + + Protected Overrides Function SaveViewState() As Object + ViewState("IsNewRecord") = Me.IsNewRecord.ToString() + ViewState("CheckSum") = Me.CheckSum + + + ' Load view state for pagination control. + + Return MyBase.SaveViewState() + End Function + + + + 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("BasePersonRelativeTableControlRow_Rec"), String) + End Get + Set(ByVal value As String) + Me.ViewState("BasePersonRelativeTableControlRow_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 _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.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "FLastName"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property FName() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "FName"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property MLastName() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "MLastName"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property MName() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "MName"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property MOrLastName() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "MOrLastName"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property RAddress() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RAddress"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property RAmphur() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RAmphur"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property RBirthDate() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RBirthDate"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property Ref4() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Ref4"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property RefDate2() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RefDate2"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property RelationId() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RelationId"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property RFirstName() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RFirstName"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property RLastName() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RLastName"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property RNationality() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RNationality"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property ROrigin() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "ROrigin"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property ROrLastName() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "ROrLastName"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property RPreName() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RPreName"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property RProvince() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RProvince"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property RReligion() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RReligion"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property RRemark() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RRemark"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property RStatus() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RStatus"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property RStatusDate() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RStatusDate"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property RStatusRef() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RStatusRef"), 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. + + Return Nothing + + End Function + + Public Shadows ReadOnly Property Page() As BaseApplicationPage + Get + Return DirectCast(MyBase.Page, BaseApplicationPage) + End Get + End Property + +#End Region + +End Class + + + +' Base class for the PersonRelativeTableControl control on the ShowPersonalId page. +' Do not modify this class. Instead override any method in PersonRelativeTableControl. +Public Class BasePersonRelativeTableControl + Inherits Persons.UI.BaseApplicationTableControl + + + + Protected Overridable Sub Control_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Init + + + + ' Setup the filter and search events. + + + + ' Control Initializations. + ' Initialize the table's current sort order. + + If Me.InSession(Me, "Order_By") Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + Me.CurrentSortOrder.Add(PersonRelativeTable.RelationId, OrderByItem.OrderDir.Asc) + + Me.CurrentSortOrder.Add(PersonRelativeTable.RBirthDate, OrderByItem.OrderDir.Asc) + + End If + + + + ' Setup default pagination settings. + + Me.PageSize = CInt(Me.GetFromSession(Me, "Page_Size", "10")) + Me.PageIndex = CInt(Me.GetFromSession(Me, "Page_Index", "0")) + + + + Me.ClearControlsFromSession() + End Sub + + Protected Overridable Sub Control_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load + + SaveControlsToSession_Ajax() + + ' Setup the pagination events. + + AddHandler Me.PersonRelativePagination.FirstPage.Click, AddressOf PersonRelativePagination_FirstPage_Click + + AddHandler Me.PersonRelativePagination.LastPage.Click, AddressOf PersonRelativePagination_LastPage_Click + + AddHandler Me.PersonRelativePagination.NextPage.Click, AddressOf PersonRelativePagination_NextPage_Click + + AddHandler Me.PersonRelativePagination.PageSizeButton.Click, AddressOf PersonRelativePagination_PageSizeButton_Click + + AddHandler Me.PersonRelativePagination.PreviousPage.Click, AddressOf PersonRelativePagination_PreviousPage_Click + + + ' Setup the sorting events. + + AddHandler Me.FLastNameLabel.Click, AddressOf FLastNameLabel_Click + + AddHandler Me.FNameLabel.Click, AddressOf FNameLabel_Click + + AddHandler Me.MLastNameLabel.Click, AddressOf MLastNameLabel_Click + + AddHandler Me.MNameLabel.Click, AddressOf MNameLabel_Click + + AddHandler Me.MOrLastNameLabel.Click, AddressOf MOrLastNameLabel_Click + + AddHandler Me.RAddressLabel.Click, AddressOf RAddressLabel_Click + + AddHandler Me.RAmphurLabel.Click, AddressOf RAmphurLabel_Click + + AddHandler Me.RBirthDateLabel.Click, AddressOf RBirthDateLabel_Click + + AddHandler Me.RefDateLabel2.Click, AddressOf RefDateLabel2_Click + + AddHandler Me.RefLabel3.Click, AddressOf RefLabel3_Click + + AddHandler Me.RelationIdLabel1.Click, AddressOf RelationIdLabel1_Click + + AddHandler Me.RFirstNameLabel.Click, AddressOf RFirstNameLabel_Click + + AddHandler Me.RLastNameLabel.Click, AddressOf RLastNameLabel_Click + + AddHandler Me.RNationalityLabel.Click, AddressOf RNationalityLabel_Click + + AddHandler Me.ROriginLabel.Click, AddressOf ROriginLabel_Click + + AddHandler Me.ROrLastNameLabel.Click, AddressOf ROrLastNameLabel_Click + + AddHandler Me.RPreNameLabel.Click, AddressOf RPreNameLabel_Click + + AddHandler Me.RProvinceLabel.Click, AddressOf RProvinceLabel_Click + + AddHandler Me.RReligionLabel.Click, AddressOf RReligionLabel_Click + + AddHandler Me.RRemarkLabel.Click, AddressOf RRemarkLabel_Click + + AddHandler Me.RStatusDateLabel.Click, AddressOf RStatusDateLabel_Click + + AddHandler Me.RStatusLabel1.Click, AddressOf RStatusLabel1_Click + + AddHandler Me.RStatusRefLabel.Click, AddressOf RStatusRefLabel_Click + + ' Setup the button events. + + AddHandler Me.PersonRelativeExportCSVButton.Click, AddressOf PersonRelativeExportCSVButton_Click + + AddHandler Me.PersonRelativeExportExcelButton.Click, AddressOf PersonRelativeExportExcelButton_Click + + Me.PersonRelativeImportButton.PostBackUrl = "../Shared/SelectFileToImport.aspx?TableName=PersonRelative" + Me.PersonRelativeImportButton.Attributes.Item("onClick") = "window.open('" & Me.Page.EncryptUrlParameter(Me.PersonRelativeImportButton.PostBackUrl) & "','importWindow', 'width=700, height=500,top=' +(screen.availHeight-500)/2 + ',left=' + (screen.availWidth-700)/2+ ', resizable=yes, scrollbars=yes,modal=yes'); return false;" + + AddHandler Me.PersonRelativeImportButton.Click, AddressOf PersonRelativeImportButton_Click + + AddHandler Me.PersonRelativePDFButton.Click, AddressOf PersonRelativePDFButton_Click + + AddHandler Me.PersonRelativeRefreshButton.Click, AddressOf PersonRelativeRefreshButton_Click + + AddHandler Me.PersonRelativeResetButton.Click, AddressOf PersonRelativeResetButton_Click + + AddHandler Me.PersonRelativeWordButton.Click, AddressOf PersonRelativeWordButton_Click + + + ' Setup events for others + + End Sub + + + Public Overridable Sub LoadData() + + ' Read data from database. Returns an array of records that can be assigned + ' to the DataSource table control property. + Try + Dim joinFilter As CompoundFilter = CreateCompoundJoinFilter() + + ' The WHERE clause will be empty when displaying all records in table. + Dim wc As WhereClause = CreateWhereClause() + If wc IsNot Nothing AndAlso Not wc.RunQuery Then + ' Initialize an empty array of records + Dim alist As New ArrayList(0) + Me.DataSource = DirectCast(alist.ToArray(GetType(PersonRelativeRecord)), PersonRelativeRecord()) + ' Add records to the list if needed. + Me.AddNewRecords() + Me._TotalRecords = 0 + Me._TotalPages = 0 + Return + End If + + ' Call OrderBy to determine the order - either use the order defined + ' on the Query Wizard, or specified by user (by clicking on column heading) + Dim orderBy As OrderBy = CreateOrderBy() + + ' Get the pagesize from the pagesize control. + Me.GetPageSize() + + If Me.DisplayLastPage Then + Dim totalRecords As Integer = If(Me._TotalRecords < 0, PersonRelativeTable.GetRecordCount(CreateCompoundJoinFilter(), CreateWhereClause()), Me._TotalRecords) + + Dim totalPages As Integer = CInt(Math.Ceiling(totalRecords / Me.PageSize)) + + Me.PageIndex = totalPages - 1 + End If + + ' Make sure PageIndex (current page) and PageSize are within bounds. + If Me.PageIndex < 0 Then + Me.PageIndex = 0 + End If + If Me.PageSize < 1 Then + Me.PageSize = 1 + End If + + ' Retrieve the records and set the table DataSource. + ' Only PageSize records are fetched starting at PageIndex (zero based). + If Me.AddNewRecord > 0 Then + ' Make sure to preserve the previously entered data on new rows. + Dim postdata As New ArrayList + For Each rc As PersonRelativeTableControlRow In Me.GetRecordControls() + If Not rc.IsNewRecord Then + rc.DataSource = rc.GetRecord() + rc.GetUIData() + postdata.Add(rc.DataSource) + UIData.Add(rc.PreservedUIData()) + End If + Next + Me.DataSource = DirectCast(postdata.ToArray(GetType(PersonRelativeRecord)), PersonRelativeRecord()) + Else ' Get the records from the database + Me.DataSource = PersonRelativeTable.GetRecords(joinFilter, wc, orderBy, Me.PageIndex, Me.PageSize) + + End If + + ' if the datasource contains no records contained in database, then load the last page. + If (DbUtils.GetCreatedRecords(Me.DataSource).Length = 0 AndAlso Not Me.DisplayLastPage) Then + Me.DisplayLastPage = True + LoadData() + Else + + ' Add any new rows desired by the user. + Me.AddNewRecords() + + + ' Initialize the page and grand totals. now + + End If + + Catch ex As Exception + ' Report the error message to the end user + Dim msg As String = ex.Message + If ex.InnerException IsNot Nothing Then + msg = msg & " InnerException: " & ex.InnerException.Message + End If + Throw New Exception(msg, ex.InnerException) + End Try + End Sub + + + + + Public Overrides Sub DataBind() + ' The DataBind method binds the user interface controls to the values + ' from the database record for each row in the table. To do this, it calls the + ' DataBind for each of the rows. + ' DataBind also populates any filters above the table, and sets the pagination + ' control to the correct number of records and the current page number. + + MyBase.DataBind() + + ' Make sure that the DataSource is initialized. + If Me.DataSource Is Nothing Then + Return + End If + + 'LoadData for DataSource for chart and report if they exist + + ' Improve performance by prefetching display as records. + Me.PreFetchForeignKeyValues() + + ' Setup the pagination controls. + BindPaginationControls() + + + + ' Bind the repeater with the list of records to expand the UI. + Dim rep As System.Web.UI.WebControls.Repeater = CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonRelativeTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return + rep.DataSource = DataSource() + rep.DataBind() + + Dim index As Integer = 0 + For Each repItem As System.Web.UI.WebControls.RepeaterItem In rep.Items + ' Loop through all rows in the table, set its DataSource and call DataBind(). + Dim recControl As PersonRelativeTableControlRow = DirectCast(repItem.FindControl("PersonRelativeTableControlRow"), PersonRelativeTableControlRow) + recControl.DataSource = Me.DataSource(index) + If Me.UIData.Count > index Then + recControl.PreviousUIData = Me.UIData(index) + End If + recControl.DataBind() + recControl.Visible = Not Me.InDeletedRecordIds(recControl) + + index += 1 + Next + + + + + ' Call the Set methods for each controls on the panel + + SetFLastNameLabel() + SetFNameLabel() + SetMLastNameLabel() + SetMNameLabel() + SetMOrLastNameLabel() + + + + + + + + SetPersonRelativeTableControlCollapsibleRegion() + + SetRAddressLabel() + SetRAmphurLabel() + SetRBirthDateLabel() + SetRefDateLabel2() + SetRefLabel3() + SetRelationIdLabel1() + SetRFirstNameLabel() + SetRLastNameLabel() + SetRNationalityLabel() + SetROriginLabel() + SetROrLastNameLabel() + SetRPreNameLabel() + SetRProvinceLabel() + SetRReligionLabel() + SetRRemarkLabel() + SetRStatusDateLabel() + SetRStatusLabel1() + SetRStatusRefLabel() + ' setting the state of expand or collapse alternative rows + + + ' Load data for each record and table UI control. + ' Ordering is important because child controls get + ' their parent ids from their parent UI controls. + + + ' this method calls the set method for controls with special formula like running total, sum, rank, etc + SetFormulaControls() + End Sub + + Public Overridable Sub SetFormulaControls() + ' this method calls Set methods for the control that has special formula + + + + End Sub + + + Public Sub PreFetchForeignKeyValues() + If (IsNothing(Me.DataSource)) + Return + End If + + Me.Page.PregetDfkaRecords(PersonRelativeTable.RelationId, Me.DataSource) + + Me.Page.PregetDfkaRecords(PersonRelativeTable.RStatus, Me.DataSource) + + End Sub + + + Public Overridable Sub RegisterPostback() + + Me.Page.RegisterPostBackTrigger(MiscUtils.FindControlRecursively(Me,"PersonRelativeExportCSVButton")) + + Me.Page.RegisterPostBackTrigger(MiscUtils.FindControlRecursively(Me,"PersonRelativeExportExcelButton")) + + Me.Page.RegisterPostBackTrigger(MiscUtils.FindControlRecursively(Me,"PersonRelativePDFButton")) + + Me.Page.RegisterPostBackTrigger(MiscUtils.FindControlRecursively(Me,"PersonRelativeWordButton")) + + + End Sub + + Public EvaluateFormulaDelegate As BaseClasses.Data.DataSource.EvaluateFormulaDelegate = New BaseClasses.Data.DataSource.EvaluateFormulaDelegate(AddressOf Me.EvaluateFormula) + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean, ByVal e as FormulaEvaluator) As String + If e Is Nothing + e = New FormulaEvaluator() + End If + + e.Variables.Clear() + + + ' add variables for formula evaluation + If variables IsNot Nothing Then + Dim enumerator As System.Collections.Generic.IEnumerator(Of System.Collections.Generic.KeyValuePair(Of String, Object)) = variables.GetEnumerator() + While enumerator.MoveNext() + e.Variables.Add(enumerator.Current.Key, enumerator.Current.Value) + End While + End If + + If includeDS + + End If + + ' All variables referred to in the formula are expected to be + ' properties of the DataSource. For example, referring to + ' UnitPrice as a variable will refer to DataSource.UnitPrice + e.DataSource = dataSourceForEvaluate + + ' Define the calling control. This is used to add other + ' related table and record controls as variables. + e.CallingControl = Me + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + + If Not String.IsNullOrEmpty(format) AndAlso (String.IsNullOrEmpty(formula) OrElse formula.IndexOf("Format(") < 0) Then + Return FormulaUtils.Format(resultObj, format) + Else + Return resultObj.ToString() + End If + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format,variables ,includeDS, Nothing) + End Function + + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object)) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format, variables ,True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, format, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal e as FormulaEvaluator) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, variables, True, e) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal includeDS as Boolean) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, includeDS, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, True, Nothing) + End Function + + + + + Public Overridable Sub ResetControl() + + Me.CurrentSortOrder.Reset() + If (Me.InSession(Me, "Order_By")) Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + Me.CurrentSortOrder.Add(PersonRelativeTable.RelationId, OrderByItem.OrderDir.Asc) + + Me.CurrentSortOrder.Add(PersonRelativeTable.RBirthDate, OrderByItem.OrderDir.Asc) + + End If + + Me.PageIndex = 0 + End Sub + + Protected Overridable Sub BindPaginationControls() + ' Setup the pagination controls. + + ' Bind the pagination labels. + + If DbUtils.GetCreatedRecords(Me.DataSource).Length > 0 Then + + Me.PersonRelativePagination.CurrentPage.Text = (Me.PageIndex + 1).ToString() + Else + Me.PersonRelativePagination.CurrentPage.Text = "0" + End If + Me.PersonRelativePagination.PageSize.Text = Me.PageSize.ToString() + Me.PersonRelativePagination.TotalItems.Text = Me.TotalRecords.ToString() + Me.PersonRelativePagination.TotalPages.Text = Me.TotalPages.ToString() + + ' Bind the buttons for PersonRelativeTableControl pagination. + + Me.PersonRelativePagination.FirstPage.Enabled = Not (Me.PageIndex = 0) + If Me._TotalPages < 0 Then ' if the total pages is not determined yet, enable last and next buttons + Me.PersonRelativePagination.LastPage.Enabled = True + ElseIf Me._TotalPages = 0 ' if the total pages is determined and it is 0, enable last and next buttons + Me.PersonRelativePagination.LastPage.Enabled = False + Else ' if the total pages is the last page, disable last and next buttons + Me.PersonRelativePagination.LastPage.Enabled = Not (Me.PageIndex = Me.TotalPages - 1) + End If + + If Me._TotalPages < 0 Then ' if the total pages is not determined yet, enable last and next buttons + Me.PersonRelativePagination.NextPage.Enabled = True + ElseIf Me._TotalPages = 0 ' if the total pages is determined and it is 0, enable last and next buttons + Me.PersonRelativePagination.NextPage.Enabled = False + Else ' if the total pages is the last page, disable last and next buttons + Me.PersonRelativePagination.NextPage.Enabled = Not (Me.PageIndex = Me.TotalPages - 1) + End If + + Me.PersonRelativePagination.PreviousPage.Enabled = Not (Me.PageIndex = 0) + + + End Sub + + Public Overridable Sub SaveData() + ' Save the data from the entire table. Calls each row's Save Data + ' to save their data. This function is called by the Click handler of the + ' Save button. The button handler should Start/Commit/End a transaction. + + Dim recCtl As PersonRelativeTableControlRow + For Each recCtl In Me.GetRecordControls() + + If Me.InDeletedRecordIds(recCtl) Then + ' Delete any pending deletes. + recCtl.Delete() + Else + If recCtl.Visible Then + recCtl.SaveData() + End If + End If + + Next + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + ' Set IsNewRecord to False for all records - since everything has been saved and is no longer "new" + For Each recCtl In Me.GetRecordControls() + recCtl.IsNewRecord = False + Next + + + ' Set DeletedRecordsIds to Nothing since we have deleted all pending deletes. + Me.DeletedRecordIds = Nothing + + End Sub + + Public Overridable Function CreateCompoundJoinFilter() As CompoundFilter + Dim jFilter As CompoundFilter = New CompoundFilter() + + Return jFilter + + End Function + + + Public Overridable Function CreateOrderBy() As OrderBy + ' The CurrentSortOrder is initialized to the sort order on the + ' Query Wizard. It may be modified by the Click handler for any of + ' the column heading to sort or reverse sort by that column. + ' You can add your own sort order, or modify it on the Query Wizard. + Return Me.CurrentSortOrder + End Function + + Public Overridable Function CreateWhereClause() As WhereClause + 'This CreateWhereClause is used for loading the data. + 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 search criteria. + ' 3. User selected filter criteria. + + + Dim selectedRecordKeyValue as KeyValue = New KeyValue() + + Dim personalIdRecordControlObj As Persons.UI.Controls.ShowPersonalId.PersonalIdRecordControl = DirectCast(MiscUtils.FindControlRecursively(Me.Page, "PersonalIdRecordControl"), Persons.UI.Controls.ShowPersonalId.PersonalIdRecordControl) + + If (Not IsNothing(personalIdRecordControlObj) AndAlso Not IsNothing(personalIdRecordControlObj.GetRecord()) AndAlso personalIdRecordControlObj.GetRecord().IsCreated AndAlso Not IsNothing(personalIdRecordControlObj.GetRecord().PersonalId)) + wc.iAND(PersonRelativeTable.PersonalId, BaseFilter.ComparisonOperator.EqualsTo, personalIdRecordControlObj.GetRecord().PersonalId.ToString()) + selectedRecordKeyValue.AddElement(PersonRelativeTable.PersonalId.InternalName, personalIdRecordControlObj.GetRecord().PersonalId.ToString()) + Else + wc.RunQuery = False + Return wc + End If + + HttpContext.Current.Session("PersonRelativeTableControlWhereClause") = selectedRecordKeyValue.ToXmlString() + + Return wc + End Function + + + Public Overridable Function CreateWhereClause(ByVal searchText as String, ByVal fromSearchControl as String, ByVal AutoTypeAheadSearch as String, ByVal AutoTypeAheadWordSeparators as String) As WhereClause + ' This CreateWhereClause is used for loading list of suggestions for Auto Type-Ahead feature. + 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 search criteria. + ' 3. User selected filter criteria. + + Dim appRelativeVirtualPath As String = CType(HttpContext.Current.Session("AppRelativeVirtualPath"), String) + + Dim selectedRecordInPersonalIdRecordControl as String = DirectCast(HttpContext.Current.Session("PersonRelativeTableControlWhereClause"), String) + + If Not selectedRecordInPersonalIdRecordControl Is Nothing AndAlso KeyValue.IsXmlKey(selectedRecordInPersonalIdRecordControl) Then + Dim selectedRecordKeyValue as KeyValue = KeyValue.XmlToKey(selectedRecordInPersonalIdRecordControl) + + If Not IsNothing(selectedRecordKeyValue) AndAlso selectedRecordKeyValue.ContainsColumn(PersonRelativeTable.PersonalId) Then + wc.iAND(PersonRelativeTable.PersonalId, BaseFilter.ComparisonOperator.EqualsTo, selectedRecordKeyValue.GetColumnValue(PersonRelativeTable.PersonalId).ToString()) + End If + + End If + + ' Adds clauses if values are selected in Filter controls which are configured in the page. + + + Return wc + End Function + + + Public Overridable Function FormatSuggestions(ByVal prefixText As String, ByVal resultItem As String, _ + ByVal columnLength As Integer, ByVal AutoTypeAheadDisplayFoundText As String, _ + ByVal autoTypeAheadSearch As String, ByVal AutoTypeAheadWordSeparators As String, _ + ByVal resultList As ArrayList) As Boolean + + 'Formats the resultItem and adds it to the list of suggestions. + Dim index As Integer = resultItem.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture).IndexOf(prefixText.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture)) + Dim itemToAdd As String = "" + Dim isFound As Boolean = False + Dim isAdded As Boolean = False + ' Get the index where prfixt is at the beginning of resultItem. If not found then, index of word which begins with prefixText. + If InvariantLCase(autoTypeAheadSearch).equals("wordsstartingwithsearchstring") And Not index = 0 Then + ' Expression to find word which contains AutoTypeAheadWordSeparators followed by prefixText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex( AutoTypeAheadWordSeparators + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + If regex1.IsMatch(resultItem) Then + index = regex1.Match(resultItem).Index + isFound = True + End If + ' If the prefixText is found immediatly after white space then starting of the word is found so don not search any further + If not resultItem(index).ToString() = " " Then + ' Expression to find beginning of the word which contains AutoTypeAheadWordSeparators followed by prefixText + Dim regex As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\\S*" + AutoTypeAheadWordSeparators + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + If regex.IsMatch(resultItem) Then + index = regex.Match(resultItem).Index + isFound = True + End If + End If + End If + + ' If autoTypeAheadSearch value is wordsstartingwithsearchstring then, extract the substring only if the prefixText is found at the + ' beginning of the resultItem (index = 0) or a word in resultItem is found starts with prefixText. + If index = 0 Or isFound Or InvariantLCase(autoTypeAheadSearch).Equals("anywhereinstring") then + If InvariantLCase(AutoTypeAheadDisplayFoundText).equals("atbeginningofmatchedstring") Then + ' Expression to find beginning of the word which contains prefixText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\\S*" + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + ' Find the beginning of the word which contains prefexText + If (StringUtils.InvariantLCase(autoTypeAheadSearch).Equals("anywhereinstring") AndAlso regex1.IsMatch(resultItem)) Then + index = regex1.Match(resultItem).Index + isFound = True + End If + ' Display string from the index till end of the string if sub string from index till end is less than columnLength value. + If Len(resultItem) - index <= columnLength Then + If index = 0 Then + itemToAdd = resultItem + Else + itemToAdd = "..." & resultItem.Substring(index, Len(resultItem) - index) + End If + Else + If index = 0 Then + itemToAdd = resultItem.Substring(index, (columnLength - 3)) & "..." + Else + 'Truncate the string to show only columnLength - 6 characters as begining and trailing "..." has to be appended. + itemToAdd = "..." & resultItem.Substring(index , columnLength - 6) & "..." + End If + End If + ElseIf InvariantLCase(AutoTypeAheadDisplayFoundText).equals("inmiddleofmatchedstring") Then + Dim subStringBeginIndex As Integer = CType(columnLength/2, Integer) + If Len(resultItem) <= columnLength Then + itemToAdd = resultItem + Else + ' Sanity check at end of the string + If index + Len(prefixText) = columnLength Then + itemToAdd = "..." & resultItem.Substring(index-columnLength,index) + ElseIf Len(resultItem) - index < subStringBeginIndex Then + ' Display string from the end till columnLength value if, index is closer to the end of the string. + itemToAdd = "..." & resultItem.Substring(Len(resultItem)-columnLength,Len(resultItem)) + ElseIf index <= subStringBeginIndex Then + ' Sanity chet at beginning of the string + itemToAdd = resultItem.Substring(0, columnLength) & "..." + Else + ' Display string containing text before the prefixText occures and text after the prefixText + itemToAdd = "..." & resultItem.Substring(index - subStringBeginIndex, columnLength) & "..." + End If + End If + ElseIf InvariantLCase(AutoTypeAheadDisplayFoundText).equals("atendofmatchedstring") Then + ' Expression to find ending of the word which contains prefexText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\s", System.Text.RegularExpressions.RegexOptions.IgnoreCase) + ' Find the ending of the word which contains prefexText + If regex1.IsMatch(resultItem, index + 1) Then + index = regex1.Match(resultItem, index + 1).Index + Else + ' If the word which contains prefexText is the last word in string, regex1.IsMatch returns false. + index = resultItem.Length + End If + If index > Len(resultItem) Then + index = Len(resultItem) + End If + ' If text from beginning of the string till index is less than columnLength value then, display string from the beginning till index. + If index <= columnLength Then + if index = Len(resultItem) Then 'Make decision to append "..." + itemToAdd = resultItem.Substring(0,index) + Else + itemToAdd = resultItem.Substring(0,index) & "..." + End If + Else + If index = Len(resultItem) Then + itemToAdd = "..." & resultItem.Substring(index - (columnLength - 3), (columnLength - 3)) + Else + 'Truncate the string to show only columnLength - 6 characters as begining and trailing "..." has to be appended. + itemToAdd = "..." & resultItem.Substring(index - (columnLength - 6), columnLength - 6) & "..." + End If + End If + End If + + ' Remove newline character from itemToAdd + Dim prefixTextIndex As Integer = itemToAdd.IndexOf(prefixText, StringComparison.CurrentCultureIgnoreCase) + ' If itemToAdd contains any newline after the search text then show text only till newline + Dim regex2 As System.Text.RegularExpressions.Regex = New System.Text.RegularExpressions.Regex("(" & vbCrLf & "|" & vbLf & ")", System.Text.RegularExpressions.RegexOptions.IgnoreCase) + Dim newLineIndexAfterPrefix As Integer = -1 + If regex2.IsMatch(itemToAdd, prefixTextIndex) Then + newLineIndexAfterPrefix = regex2.Match(itemToAdd, prefixTextIndex).Index + End If + If (newLineIndexAfterPrefix > -1) Then + If itemToAdd.EndsWith("...") Then + itemToAdd = (itemToAdd.Substring(0, newLineIndexAfterPrefix) + "...") + Else + itemToAdd = itemToAdd.Substring(0, newLineIndexAfterPrefix) + End If + End If + ' If itemToAdd contains any newline before search text then show text which comes after newline + Dim regex3 As System.Text.RegularExpressions.Regex = New System.Text.RegularExpressions.Regex("(" & vbCrLf & "|" & vbLf & ")", (System.Text.RegularExpressions.RegexOptions.IgnoreCase Or System.Text.RegularExpressions.RegexOptions.RightToLeft)) + Dim newLineIndexBeforePrefix As Integer = -1 + If regex3.IsMatch(itemToAdd, prefixTextIndex) Then + newLineIndexBeforePrefix = regex3.Match(itemToAdd, prefixTextIndex).Index + End If + If (newLineIndexBeforePrefix > -1) Then + If itemToAdd.StartsWith("...") Then + itemToAdd = ("..." + itemToAdd.Substring((newLineIndexBeforePrefix + regex3.Match(itemToAdd, prefixTextIndex).Length))) + Else + itemToAdd = itemToAdd.Substring((newLineIndexBeforePrefix + regex3.Match(itemToAdd, prefixTextIndex).Length)) + End If + End If + + If Not itemToAdd is nothing AndAlso Not resultList.Contains(itemToAdd) Then + + resultList.Add(itemToAdd) + + isAdded = true + End If + End If + Return isAdded + End Function + + + Protected Overridable Sub GetPageSize() + + If Me.PersonRelativePagination.PageSize.Text.Trim <> "" Then + Try + 'Me.PageSize = Integer.Parse(Me.PersonRelativePagination.PageSize.Text) + Catch ex As Exception + End Try + End If + End Sub + + Protected Overridable Sub AddNewRecords() + + Dim newRecordList As ArrayList = New ArrayList() + + Dim newUIDataList As System.Collections.Generic.List(Of Hashtable) = New System.Collections.Generic.List(Of Hashtable)() + + ' Loop though all the record controls and if the record control + ' does not have a unique record id set, then create a record + ' and add to the list. + If Not Me.ResetData Then + Dim rep As System.Web.UI.WebControls.Repeater = CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonRelativeTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return + + Dim repItem As System.Web.UI.WebControls.RepeaterItem + For Each repItem In rep.Items + ' Loop through all rows in the table, set its DataSource and call DataBind(). + + Dim recControl As PersonRelativeTableControlRow = DirectCast(repItem.FindControl("PersonRelativeTableControlRow"), PersonRelativeTableControlRow) + + If recControl.Visible AndAlso recControl.IsNewRecord() Then + + Dim rec As PersonRelativeRecord = New PersonRelativeRecord() + + If recControl.FLastName.Text <> "" Then + rec.Parse(recControl.FLastName.Text, PersonRelativeTable.FLastName) + End If + If recControl.FName.Text <> "" Then + rec.Parse(recControl.FName.Text, PersonRelativeTable.FName) + End If + If recControl.MLastName.Text <> "" Then + rec.Parse(recControl.MLastName.Text, PersonRelativeTable.MLastName) + End If + If recControl.MName.Text <> "" Then + rec.Parse(recControl.MName.Text, PersonRelativeTable.MName) + End If + If recControl.MOrLastName.Text <> "" Then + rec.Parse(recControl.MOrLastName.Text, PersonRelativeTable.MOrLastName) + End If + If recControl.RAddress.Text <> "" Then + rec.Parse(recControl.RAddress.Text, PersonRelativeTable.RAddress) + End If + If recControl.RAmphur.Text <> "" Then + rec.Parse(recControl.RAmphur.Text, PersonRelativeTable.RAmphur) + End If + If recControl.RBirthDate.Text <> "" Then + rec.Parse(recControl.RBirthDate.Text, PersonRelativeTable.RBirthDate) + End If + If recControl.Ref4.Text <> "" Then + rec.Parse(recControl.Ref4.Text, PersonRelativeTable.Ref0) + End If + If recControl.RefDate2.Text <> "" Then + rec.Parse(recControl.RefDate2.Text, PersonRelativeTable.RefDate) + End If + If recControl.RelationId.Text <> "" Then + rec.Parse(recControl.RelationId.Text, PersonRelativeTable.RelationId) + End If + If recControl.RFirstName.Text <> "" Then + rec.Parse(recControl.RFirstName.Text, PersonRelativeTable.RFirstName) + End If + If recControl.RLastName.Text <> "" Then + rec.Parse(recControl.RLastName.Text, PersonRelativeTable.RLastName) + End If + If recControl.RNationality.Text <> "" Then + rec.Parse(recControl.RNationality.Text, PersonRelativeTable.RNationality) + End If + If recControl.ROrigin.Text <> "" Then + rec.Parse(recControl.ROrigin.Text, PersonRelativeTable.ROrigin) + End If + If recControl.ROrLastName.Text <> "" Then + rec.Parse(recControl.ROrLastName.Text, PersonRelativeTable.ROrLastName) + End If + If recControl.RPreName.Text <> "" Then + rec.Parse(recControl.RPreName.Text, PersonRelativeTable.RPreName) + End If + If recControl.RProvince.Text <> "" Then + rec.Parse(recControl.RProvince.Text, PersonRelativeTable.RProvince) + End If + If recControl.RReligion.Text <> "" Then + rec.Parse(recControl.RReligion.Text, PersonRelativeTable.RReligion) + End If + If recControl.RRemark.Text <> "" Then + rec.Parse(recControl.RRemark.Text, PersonRelativeTable.RRemark) + End If + If recControl.RStatus.Text <> "" Then + rec.Parse(recControl.RStatus.Text, PersonRelativeTable.RStatus) + End If + If recControl.RStatusDate.Text <> "" Then + rec.Parse(recControl.RStatusDate.Text, PersonRelativeTable.RStatusDate) + End If + If recControl.RStatusRef.Text <> "" Then + rec.Parse(recControl.RStatusRef.Text, PersonRelativeTable.RStatusRef) + End If + newUIDataList.Add(recControl.PreservedUIData()) + newRecordList.Add(rec) + End If + Next + End If + + + ' Add any new record to the list. + Dim index As Integer = 0 + For index = 1 To Me.AddNewRecord + + newRecordList.Insert(0, New PersonRelativeRecord()) + newUIDataList.Insert(0, New Hashtable()) + + Next + Me.AddNewRecord = 0 + + ' Finally, add any new records to the DataSource. + If newRecordList.Count > 0 Then + + Dim finalList As ArrayList = New ArrayList(Me.DataSource) + finalList.InsertRange(0, newRecordList) + + Me.DataSource = DirectCast(finalList.ToArray(GetType(PersonRelativeRecord)), PersonRelativeRecord()) + + End If + + ' Add the existing UI data to this hash table + If newUIDataList.Count > 0 Then + Me.UIData.InsertRange(0, newUIDataList) + End If + + End Sub + + + Public Sub AddToDeletedRecordIds(ByVal rec As PersonRelativeTableControlRow) + If rec.IsNewRecord() Then + Return + End If + + If Not Me.DeletedRecordIds Is Nothing AndAlso Me.DeletedRecordIds.Trim <> "" Then + Me.DeletedRecordIds &= "," + End If + + Me.DeletedRecordIds &= "[" & rec.RecordUniqueId & "]" + End Sub + + Protected Overridable Function InDeletedRecordIds(ByVal rec As PersonRelativeTableControlRow) As Boolean + If Me.DeletedRecordIds Is Nothing OrElse Me.DeletedRecordIds.Trim = "" Then + Return False + End If + + Return Me.DeletedRecordIds.IndexOf("[" & rec.RecordUniqueId & "]") >= 0 + End Function + + Private _DeletedRecordIds As String + Public Property DeletedRecordIds() As String + Get + Return Me._DeletedRecordIds + End Get + Set(ByVal value As String) + Me._DeletedRecordIds = value + End Set + End Property + + + ' Create Set, WhereClause, and Populate Methods + + Public Overridable Sub 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 SetPersonRelativeTableControlCollapsibleRegion() + + End Sub + + Public Overridable Sub SetRAddressLabel() + + End Sub + + Public Overridable Sub SetRAmphurLabel() + + End Sub + + Public Overridable Sub SetRBirthDateLabel() + + End Sub + + Public Overridable Sub SetRefDateLabel2() + + End Sub + + Public Overridable Sub SetRefLabel3() + + End Sub + + Public Overridable Sub SetRelationIdLabel1() + + 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 SetRStatusLabel1() + + End Sub + + Public Overridable Sub SetRStatusRefLabel() + + End Sub + + + + + Protected Overridable Sub Control_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.PreRender + ' PreRender event is raised just before page is being displayed. + Try + DbUtils.StartTransaction + Me.RegisterPostback() + + If Not Me.Page.ErrorOnPage AndAlso (Me.Page.IsPageRefresh OrElse Me.DataChanged OrElse Me.ResetData) Then + + + ' Re-load the data and update the web page if necessary. + ' This is typically done during a postback (filter, search button, sort, pagination button). + ' In each of the other click handlers, simply set DataChanged to True to reload the data. + + Me.LoadData() + Me.DataBind() + + End If + + + + Catch ex As Exception + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + Finally + DbUtils.EndTransaction + End Try + End Sub + + + Protected Overrides Sub SaveControlsToSession() + MyBase.SaveControlsToSession() + + ' Save filter controls to values to session. + + + 'Save pagination state to session. + + + + ' Save table control properties to the session. + If Not Me.CurrentSortOrder Is Nothing Then + Me.SaveToSession(Me, "Order_By", Me.CurrentSortOrder.ToXmlString()) + End If + + Me.SaveToSession(Me, "Page_Index", Me.PageIndex.ToString()) + Me.SaveToSession(Me, "Page_Size", Me.PageSize.ToString()) + + Me.SaveToSession(Me, "DeletedRecordIds", Me.DeletedRecordIds) + + End Sub + + Protected Sub SaveControlsToSession_Ajax() + ' Save filter controls to values to session. + + HttpContext.Current.Session("AppRelativeVirtualPath") = Me.Page.AppRelativeVirtualPath + + End Sub + + Protected Overrides Sub ClearControlsFromSession() + MyBase.ClearControlsFromSession() + + ' Clear filter controls values from the session. + + + ' Clear pagination state from session. + + + + ' Clear table properties from the session. + Me.RemoveFromSession(Me, "Order_By") + Me.RemoveFromSession(Me, "Page_Index") + Me.RemoveFromSession(Me, "Page_Size") + + Me.RemoveFromSession(Me, "DeletedRecordIds") + + End Sub + + Protected Overrides Sub LoadViewState(ByVal savedState As Object) + MyBase.LoadViewState(savedState) + + Dim orderByStr As String = CType(ViewState("PersonRelativeTableControl_OrderBy"), String) + + If orderByStr IsNot Nothing AndAlso orderByStr.Trim <> "" Then + Me.CurrentSortOrder = BaseClasses.Data.OrderBy.FromXmlString(orderByStr) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + End If + + Dim pageIndex As String = CType(ViewState("Page_Index"), String) + If pageIndex IsNot Nothing Then + Me.PageIndex = CInt(pageIndex) + End If + + Dim pageSize As String = CType(ViewState("Page_Size"), String) + If Not pageSize Is Nothing Then + Me.PageSize = CInt(pageSize) + End If + + + + ' Load view state for pagination control. + + Me.DeletedRecordIds = CType(Me.ViewState("DeletedRecordIds"), String) + + End Sub + + Protected Overrides Function SaveViewState() As Object + + If Me.CurrentSortOrder IsNot Nothing Then + Me.ViewState("PersonRelativeTableControl_OrderBy") = Me.CurrentSortOrder.ToXmlString() + End If + + Me.ViewState("Page_Index") = Me.PageIndex + Me.ViewState("Page_Size") = Me.PageSize + + Me.ViewState("DeletedRecordIds") = Me.DeletedRecordIds + + + ' Load view state for pagination control. + + + Return MyBase.SaveViewState() + End Function + + ' Generate the event handling functions for pagination events. + + ' event handler for ImageButton + Public Overridable Sub PersonRelativePagination_FirstPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.PageIndex = 0 + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonRelativePagination_LastPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.DisplayLastPage = True + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonRelativePagination_NextPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.PageIndex += 1 + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for LinkButton + Public Overridable Sub PersonRelativePagination_PageSizeButton_Click(ByVal sender As Object, ByVal args As EventArgs) + + Try + + Me.DataChanged = True + + Me.PageSize = Integer.Parse(Me.PersonRelativePagination.PageSize.Text) + + Me.PageIndex = Integer.Parse(Me.PersonRelativePagination.CurrentPage.Text) - 1 + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonRelativePagination_PreviousPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + If Me.PageIndex > 0 Then + Me.PageIndex -= 1 + Me.DataChanged = True + End If + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + + ' Generate the event handling functions for sorting events. + + Public Overridable Sub FLastNameLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by FLastName when clicked. + + ' Get previous sorting state for FLastName. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonRelativeTable.FLastName) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for FLastName. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonRelativeTable.FLastName, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by FLastName, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub FNameLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by FName when clicked. + + ' Get previous sorting state for FName. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonRelativeTable.FName) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for FName. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonRelativeTable.FName, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by FName, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub MLastNameLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by MLastName when clicked. + + ' Get previous sorting state for MLastName. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonRelativeTable.MLastName) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for MLastName. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonRelativeTable.MLastName, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by MLastName, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub MNameLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by MName when clicked. + + ' Get previous sorting state for MName. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonRelativeTable.MName) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for MName. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonRelativeTable.MName, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by MName, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub MOrLastNameLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by MOrLastName when clicked. + + ' Get previous sorting state for MOrLastName. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonRelativeTable.MOrLastName) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for MOrLastName. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonRelativeTable.MOrLastName, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by MOrLastName, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub RAddressLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by RAddress when clicked. + + ' Get previous sorting state for RAddress. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonRelativeTable.RAddress) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for RAddress. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonRelativeTable.RAddress, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by RAddress, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub RAmphurLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by RAmphur when clicked. + + ' Get previous sorting state for RAmphur. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonRelativeTable.RAmphur) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for RAmphur. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonRelativeTable.RAmphur, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by RAmphur, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub RBirthDateLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by RBirthDate when clicked. + + ' Get previous sorting state for RBirthDate. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonRelativeTable.RBirthDate) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for RBirthDate. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonRelativeTable.RBirthDate, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by RBirthDate, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub RefDateLabel2_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by RefDate when clicked. + + ' Get previous sorting state for RefDate. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonRelativeTable.RefDate) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for RefDate. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonRelativeTable.RefDate, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by RefDate, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub RefLabel3_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by Ref when clicked. + + ' Get previous sorting state for Ref. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonRelativeTable.Ref0) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for Ref. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonRelativeTable.Ref0, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by Ref, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub RelationIdLabel1_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by RelationId when clicked. + + ' Get previous sorting state for RelationId. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonRelativeTable.RelationId) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for RelationId. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonRelativeTable.RelationId, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by RelationId, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub RFirstNameLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by RFirstName when clicked. + + ' Get previous sorting state for RFirstName. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonRelativeTable.RFirstName) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for RFirstName. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonRelativeTable.RFirstName, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by RFirstName, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub RLastNameLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by RLastName when clicked. + + ' Get previous sorting state for RLastName. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonRelativeTable.RLastName) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for RLastName. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonRelativeTable.RLastName, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by RLastName, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub RNationalityLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by RNationality when clicked. + + ' Get previous sorting state for RNationality. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonRelativeTable.RNationality) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for RNationality. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonRelativeTable.RNationality, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by RNationality, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub ROriginLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by ROrigin when clicked. + + ' Get previous sorting state for ROrigin. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonRelativeTable.ROrigin) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for ROrigin. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonRelativeTable.ROrigin, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by ROrigin, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub ROrLastNameLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by ROrLastName when clicked. + + ' Get previous sorting state for ROrLastName. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonRelativeTable.ROrLastName) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for ROrLastName. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonRelativeTable.ROrLastName, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by ROrLastName, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub RPreNameLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by RPreName when clicked. + + ' Get previous sorting state for RPreName. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonRelativeTable.RPreName) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for RPreName. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonRelativeTable.RPreName, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by RPreName, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub RProvinceLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by RProvince when clicked. + + ' Get previous sorting state for RProvince. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonRelativeTable.RProvince) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for RProvince. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonRelativeTable.RProvince, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by RProvince, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub RReligionLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by RReligion when clicked. + + ' Get previous sorting state for RReligion. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonRelativeTable.RReligion) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for RReligion. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonRelativeTable.RReligion, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by RReligion, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub RRemarkLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by RRemark when clicked. + + ' Get previous sorting state for RRemark. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonRelativeTable.RRemark) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for RRemark. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonRelativeTable.RRemark, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by RRemark, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub RStatusDateLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by RStatusDate when clicked. + + ' Get previous sorting state for RStatusDate. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonRelativeTable.RStatusDate) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for RStatusDate. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonRelativeTable.RStatusDate, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by RStatusDate, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub RStatusLabel1_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by RStatus when clicked. + + ' Get previous sorting state for RStatus. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonRelativeTable.RStatus) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for RStatus. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonRelativeTable.RStatus, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by RStatus, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub RStatusRefLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by RStatusRef when clicked. + + ' Get previous sorting state for RStatusRef. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonRelativeTable.RStatusRef) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for RStatusRef. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonRelativeTable.RStatusRef, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by RStatusRef, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + + ' Generate the event handling functions for button events. + + ' event handler for ImageButton + Public Overridable Sub PersonRelativeExportCSVButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + ' Build the where clause based on the current filter and search criteria + ' Create the Order By clause based on the user's current sorting preference. + + Dim wc As WhereClause = CreateWhereClause + Dim orderBy As OrderBy = Nothing + + orderBy = CreateOrderBy + + ' Add each of the columns in order of export. + Dim columns() as BaseColumn = New BaseColumn() { _ + PersonRelativeTable.RPreName, _ + PersonRelativeTable.RFirstName, _ + PersonRelativeTable.RLastName, _ + PersonRelativeTable.ROrLastName, _ + PersonRelativeTable.FName, _ + PersonRelativeTable.FLastName, _ + PersonRelativeTable.MName, _ + PersonRelativeTable.MLastName, _ + PersonRelativeTable.MOrLastName, _ + PersonRelativeTable.ROrigin, _ + PersonRelativeTable.RNationality, _ + PersonRelativeTable.RReligion, _ + PersonRelativeTable.RAddress, _ + PersonRelativeTable.RAmphur, _ + PersonRelativeTable.RProvince, _ + PersonRelativeTable.RBirthDate, _ + PersonRelativeTable.RelationId, _ + PersonRelativeTable.Ref0, _ + PersonRelativeTable.RefDate, _ + PersonRelativeTable.RStatus, _ + PersonRelativeTable.RStatusRef, _ + PersonRelativeTable.RStatusDate, _ + PersonRelativeTable.RRemark, _ + Nothing} + Dim exportData as ExportDataToCSV = New ExportDataToCSV(PersonRelativeTable.Instance, wc, orderBy, columns) + + Dim done As Boolean = False + + Dim totalRowsReturned As Integer = 0 + Dim join As CompoundFilter = CreateCompoundJoinFilter() + Dim data As DataForExport = New DataForExport(PersonRelativeTable.Instance, wc, orderBy, columns, join) + + 'Check for Export Data Threshold + Dim exportRawValues As Boolean = False + Me.TotalRecords = PersonRelativeTable.GetRecordCount(join, wc) + If Me.TotalRecords > 10000 Then + exportRawValues = True + End If + exportData.StartExport(Me.Page.Response, exportRawValues) + + ' Read pageSize records at a time and write out the CSV file. + While (Not done) + Dim recList As ArrayList = data.GetRows(exportData.pageSize) + If recList Is Nothing Then + Exit While 'no more records we are done + End If + + totalRowsReturned = recList.Count + For Each rec As BaseRecord In recList + For Each col As BaseColumn In data.ColumnList + If col Is Nothing Then + Continue For + End If + + If Not data.IncludeInExport(col) Then + Continue For + End If + + Dim val As String = "" + + If exportRawValues Then + val = rec.GetValue(col).ToString() + Else + Dim _isExpandableNonCompositeForeignKey As Boolean = col.TableDefinition.IsExpandableNonCompositeForeignKey(col) + If _isExpandableNonCompositeForeignKey AndAlso col.IsApplyDisplayAs Then + val = PersonRelativeTable.GetDFKA(rec.GetValue(col).ToString(), col, Nothing) + End If + If (Not _isExpandableNonCompositeForeignKey) Or (String.IsNullOrEmpty(val)) Then + val = exportData.GetDataForExport(col, rec) + End If + End If + exportData.WriteColumnData(val, data.IsString(col)) + + Next col + exportData.WriteNewRow() + Next rec + + ' If we already are below the pageSize, then we are done. + If totalRowsReturned < exportData.pageSize Then + done = True + End If + End While + exportData.FinishExport(Me.Page.Response) + + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonRelativeExportExcelButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + ' To customize the columns or the format, override this function in Section 1 of the page + ' and modify it to your liking. + ' Build the where clause based on the current filter and search criteria + ' Create the Order By clause based on the user's current sorting preference. + + Dim wc As WhereClause = CreateWhereClause + Dim orderBy As OrderBy = Nothing + + orderBy = CreateOrderBy + + Dim done As Boolean = False + Dim val As Object = "" + ' Read pageSize records at a time and write out the Excel file. + Dim totalRowsReturned As Integer = 0 + + Me.TotalRecords = PersonRelativeTable.GetRecordCount(wc) + If Me.TotalRecords > 10000 Then + + ' Add each of the columns in order of export. + Dim columns() as BaseColumn = New BaseColumn() { _ + PersonRelativeTable.RPreName, _ + PersonRelativeTable.RFirstName, _ + PersonRelativeTable.RLastName, _ + PersonRelativeTable.ROrLastName, _ + PersonRelativeTable.FName, _ + PersonRelativeTable.FLastName, _ + PersonRelativeTable.MName, _ + PersonRelativeTable.MLastName, _ + PersonRelativeTable.MOrLastName, _ + PersonRelativeTable.ROrigin, _ + PersonRelativeTable.RNationality, _ + PersonRelativeTable.RReligion, _ + PersonRelativeTable.RAddress, _ + PersonRelativeTable.RAmphur, _ + PersonRelativeTable.RProvince, _ + PersonRelativeTable.RBirthDate, _ + PersonRelativeTable.RelationId, _ + PersonRelativeTable.Ref0, _ + PersonRelativeTable.RefDate, _ + PersonRelativeTable.RStatus, _ + PersonRelativeTable.RStatusRef, _ + PersonRelativeTable.RStatusDate, _ + PersonRelativeTable.RRemark, _ + Nothing} + Dim exportData as ExportDataToCSV = New ExportDataToCSV(PersonRelativeTable.Instance, wc, orderBy, columns) + exportData.StartExport(Me.Page.Response, True) + + Dim dataForCSV As DataForExport = New DataForExport(PersonRelativeTable.Instance, wc, orderBy, columns) + + ' Read pageSize records at a time and write out the CSV file. + While (Not done) + Dim recList As ArrayList = dataForCSV.GetRows(exportData.pageSize) + If recList Is Nothing Then + Exit While 'no more records we are done + End If + + totalRowsReturned = recList.Count + For Each rec As BaseRecord In recList + For Each col As BaseColumn In dataForCSV.ColumnList + If col Is Nothing Then + Continue For + End If + + If Not dataForCSV.IncludeInExport(col) Then + Continue For + End If + + val = rec.GetValue(col).ToString() + exportData.WriteColumnData(val, dataForCSV.IsString(col)) + + Next col + exportData.WriteNewRow() + Next rec + + ' If we already are below the pageSize, then we are done. + If totalRowsReturned < exportData.pageSize Then + done = True + End If + End While + exportData.FinishExport(Me.Page.Response) + Else + + ' Create an instance of the Excel report class with the table class, where clause and order by. + Dim excelReport As ExportDataToExcel = New ExportDataToExcel(PersonRelativeTable.Instance, wc, orderBy) + ' Add each of the columns in order of export. + ' To customize the data type, change the second parameter of the new ExcelColumn to be + ' a format string from Excel's Format Cell menu. For example "dddd, mmmm dd, yyyy h:mm AM/PM;@", "#,##0.00" + + If Me.Page.Response Is Nothing Then + Return + End If + + excelReport.CreateExcelBook() + + Dim width As Integer = 0 + Dim columnCounter As Integer = 0 + Dim data As DataForExport = New DataForExport(PersonRelativeTable.Instance, wc, orderBy, Nothing) + data.ColumnList.Add(New ExcelColumn(PersonRelativeTable.RPreName, "Default")) + data.ColumnList.Add(New ExcelColumn(PersonRelativeTable.RFirstName, "Default")) + data.ColumnList.Add(New ExcelColumn(PersonRelativeTable.RLastName, "Default")) + data.ColumnList.Add(New ExcelColumn(PersonRelativeTable.ROrLastName, "Default")) + data.ColumnList.Add(New ExcelColumn(PersonRelativeTable.FName, "Default")) + data.ColumnList.Add(New ExcelColumn(PersonRelativeTable.FLastName, "Default")) + data.ColumnList.Add(New ExcelColumn(PersonRelativeTable.MName, "Default")) + data.ColumnList.Add(New ExcelColumn(PersonRelativeTable.MLastName, "Default")) + data.ColumnList.Add(New ExcelColumn(PersonRelativeTable.MOrLastName, "Default")) + data.ColumnList.Add(New ExcelColumn(PersonRelativeTable.ROrigin, "Default")) + data.ColumnList.Add(New ExcelColumn(PersonRelativeTable.RNationality, "Default")) + data.ColumnList.Add(New ExcelColumn(PersonRelativeTable.RReligion, "Default")) + data.ColumnList.Add(New ExcelColumn(PersonRelativeTable.RAddress, "Default")) + data.ColumnList.Add(New ExcelColumn(PersonRelativeTable.RAmphur, "Default")) + data.ColumnList.Add(New ExcelColumn(PersonRelativeTable.RProvince, "Default")) + data.ColumnList.Add(New ExcelColumn(PersonRelativeTable.RBirthDate, "Short Date")) + data.ColumnList.Add(New ExcelColumn(PersonRelativeTable.RelationId, "Default")) + data.ColumnList.Add(New ExcelColumn(PersonRelativeTable.Ref0, "Default")) + data.ColumnList.Add(New ExcelColumn(PersonRelativeTable.RefDate, "Short Date")) + data.ColumnList.Add(New ExcelColumn(PersonRelativeTable.RStatus, "Default")) + data.ColumnList.Add(New ExcelColumn(PersonRelativeTable.RStatusRef, "Default")) + data.ColumnList.Add(New ExcelColumn(PersonRelativeTable.RStatusDate, "Short Date")) + data.ColumnList.Add(New ExcelColumn(PersonRelativeTable.RRemark, "Default")) + + + For Each col As ExcelColumn In data.ColumnList + width = excelReport.GetExcelCellWidth(col) + If data.IncludeInExport(col) Then + excelReport.AddColumnToExcelBook(columnCounter, col.ToString(), excelReport.GetExcelDataType(col), width, excelReport.GetDisplayFormat(col)) + columnCounter = columnCounter + 1 + End If + Next col + + While (Not done) + Dim recList As ArrayList = data.GetRows(excelReport.pageSize) + + If recList Is Nothing Then + Exit While 'no more records we are done + End If + + totalRowsReturned = recList.Count + + For Each rec As BaseRecord In recList + excelReport.AddRowToExcelBook() + columnCounter = 0 + + For Each col As ExcelColumn In data.ColumnList + If Not data.IncludeInExport(col) Then + Continue For + End If + + Dim _isExpandableNonCompositeForeignKey As Boolean = col.DisplayColumn.TableDefinition.IsExpandableNonCompositeForeignKey(col.DisplayColumn) + If _isExpandableNonCompositeForeignKey AndAlso col.DisplayColumn.IsApplyDisplayAs Then + val = PersonRelativeTable.GetDFKA(rec.GetValue(col.DisplayColumn).ToString(), col.DisplayColumn, Nothing) + If val Is Nothing Then + val = rec.Format(col.DisplayColumn) + End If + Else + val = excelReport.GetValueForExcelExport(col, rec) + End If + excelReport.AddCellToExcelRow(columnCounter, excelReport.GetExcelDataType(col), val, col.DisplayFormat) + + columnCounter = columnCounter + 1 + Next col + Next rec + + ' If we already are below the pageSize, then we are done. + If totalRowsReturned < excelReport.pageSize Then + done = True + End If + End While + + excelReport.SaveExcelBook(Me.Page.Response) + End If + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonRelativeImportButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonRelativePDFButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + Dim report As PDFReport = New PDFReport() + report.SpecificReportFileName = Page.Server.MapPath("ShowPersonalId.PersonRelativePDFButton.report") + ' report.Title replaces the value tag of page header and footer containing ${ReportTitle} + report.Title = "PersonRelative" + ' If ShowPersonalId.PersonRelativePDFButton.report specifies a valid report template, + ' AddColumn method will generate a report template. + ' Each AddColumn method-call specifies a column + ' The 1st parameter represents the text of the column header + ' The 2nd parameter represents the horizontal alignment of the column header + ' The 3rd parameter represents the text format of the column detail + ' The 4th parameter represents the horizontal alignment of the column detail + ' The 5th parameter represents the relative width of the column + report.AddColumn(PersonRelativeTable.RPreName.Name, ReportEnum.Align.Left, "${RPreName}", ReportEnum.Align.Left, 30) + report.AddColumn(PersonRelativeTable.RFirstName.Name, ReportEnum.Align.Left, "${RFirstName}", ReportEnum.Align.Left, 30) + report.AddColumn(PersonRelativeTable.RLastName.Name, ReportEnum.Align.Left, "${RLastName}", ReportEnum.Align.Left, 30) + report.AddColumn(PersonRelativeTable.ROrLastName.Name, ReportEnum.Align.Left, "${ROrLastName}", ReportEnum.Align.Left, 30) + report.AddColumn(PersonRelativeTable.FName.Name, ReportEnum.Align.Left, "${FName}", ReportEnum.Align.Left, 30) + report.AddColumn(PersonRelativeTable.FLastName.Name, ReportEnum.Align.Left, "${FLastName}", ReportEnum.Align.Left, 30) + report.AddColumn(PersonRelativeTable.MName.Name, ReportEnum.Align.Left, "${MName}", ReportEnum.Align.Left, 30) + report.AddColumn(PersonRelativeTable.MLastName.Name, ReportEnum.Align.Left, "${MLastName}", ReportEnum.Align.Left, 30) + report.AddColumn(PersonRelativeTable.MOrLastName.Name, ReportEnum.Align.Left, "${MOrLastName}", ReportEnum.Align.Left, 30) + report.AddColumn(PersonRelativeTable.ROrigin.Name, ReportEnum.Align.Left, "${ROrigin}", ReportEnum.Align.Left, 30) + report.AddColumn(PersonRelativeTable.RNationality.Name, ReportEnum.Align.Left, "${RNationality}", ReportEnum.Align.Left, 30) + report.AddColumn(PersonRelativeTable.RReligion.Name, ReportEnum.Align.Left, "${RReligion}", ReportEnum.Align.Left, 30) + report.AddColumn(PersonRelativeTable.RAddress.Name, ReportEnum.Align.Left, "${RAddress}", ReportEnum.Align.Left, 30) + report.AddColumn(PersonRelativeTable.RAmphur.Name, ReportEnum.Align.Left, "${RAmphur}", ReportEnum.Align.Left, 30) + report.AddColumn(PersonRelativeTable.RProvince.Name, ReportEnum.Align.Left, "${RProvince}", ReportEnum.Align.Left, 30) + report.AddColumn(PersonRelativeTable.RBirthDate.Name, ReportEnum.Align.Left, "${RBirthDate}", ReportEnum.Align.Left, 20) + report.AddColumn(PersonRelativeTable.RelationId.Name, ReportEnum.Align.Left, "${RelationId}", ReportEnum.Align.Left, 30) + report.AddColumn(PersonRelativeTable.Ref0.Name, ReportEnum.Align.Left, "${Ref0}", ReportEnum.Align.Left, 30) + report.AddColumn(PersonRelativeTable.RefDate.Name, ReportEnum.Align.Left, "${RefDate}", ReportEnum.Align.Left, 20) + report.AddColumn(PersonRelativeTable.RStatus.Name, ReportEnum.Align.Left, "${RStatus}", ReportEnum.Align.Left, 30) + report.AddColumn(PersonRelativeTable.RStatusRef.Name, ReportEnum.Align.Left, "${RStatusRef}", ReportEnum.Align.Left, 30) + report.AddColumn(PersonRelativeTable.RStatusDate.Name, ReportEnum.Align.Left, "${RStatusDate}", ReportEnum.Align.Left, 20) + report.AddColumn(PersonRelativeTable.RRemark.Name, ReportEnum.Align.Left, "${RRemark}", ReportEnum.Align.Left, 30) + + + Dim rowsPerQuery As Integer = 5000 + Dim recordCount As Integer = 0 + + report.Page = Page.GetResourceValue("Txt:Page", "Persons") + report.ApplicationPath = Me.Page.MapPath(Page.Request.ApplicationPath) + + Dim whereClause As WhereClause = CreateWhereClause + Dim orderBy As OrderBy = CreateOrderBy + Dim joinFilter As BaseFilter = CreateCompoundJoinFilter() + + Dim pageNum As Integer = 0 + Dim totalRows As Integer = PersonRelativeTable.GetRecordCount(joinFilter,whereClause) + Dim columns As ColumnList = PersonRelativeTable.GetColumnList() + Dim records As PersonRelativeRecord() = Nothing + + Do + + records = PersonRelativeTable.GetRecords(joinFilter,whereClause, orderBy, pageNum, rowsPerQuery) + If Not (records Is Nothing) AndAlso records.Length > 0 AndAlso whereClause.RunQuery Then + For Each record As PersonRelativeRecord In records + + ' AddData method takes four parameters + ' The 1st parameters represent the data format + ' The 2nd parameters represent the data value + ' The 3rd parameters represent the default alignment of column using the data + ' The 4th parameters represent the maximum length of the data value being shown + report.AddData("${RPreName}", record.Format(PersonRelativeTable.RPreName), ReportEnum.Align.Left, 100) + report.AddData("${RFirstName}", record.Format(PersonRelativeTable.RFirstName), ReportEnum.Align.Left, 100) + report.AddData("${RLastName}", record.Format(PersonRelativeTable.RLastName), ReportEnum.Align.Left, 100) + report.AddData("${ROrLastName}", record.Format(PersonRelativeTable.ROrLastName), ReportEnum.Align.Left, 100) + report.AddData("${FName}", record.Format(PersonRelativeTable.FName), ReportEnum.Align.Left, 100) + report.AddData("${FLastName}", record.Format(PersonRelativeTable.FLastName), ReportEnum.Align.Left, 100) + report.AddData("${MName}", record.Format(PersonRelativeTable.MName), ReportEnum.Align.Left, 100) + report.AddData("${MLastName}", record.Format(PersonRelativeTable.MLastName), ReportEnum.Align.Left, 100) + report.AddData("${MOrLastName}", record.Format(PersonRelativeTable.MOrLastName), ReportEnum.Align.Left, 100) + report.AddData("${ROrigin}", record.Format(PersonRelativeTable.ROrigin), ReportEnum.Align.Left, 100) + report.AddData("${RNationality}", record.Format(PersonRelativeTable.RNationality), ReportEnum.Align.Left, 100) + report.AddData("${RReligion}", record.Format(PersonRelativeTable.RReligion), ReportEnum.Align.Left, 100) + report.AddData("${RAddress}", record.Format(PersonRelativeTable.RAddress), ReportEnum.Align.Left, 100) + report.AddData("${RAmphur}", record.Format(PersonRelativeTable.RAmphur), ReportEnum.Align.Left, 100) + report.AddData("${RProvince}", record.Format(PersonRelativeTable.RProvince), ReportEnum.Align.Left, 100) + report.AddData("${RBirthDate}", record.Format(PersonRelativeTable.RBirthDate), ReportEnum.Align.Left, 100) + If BaseClasses.Utils.MiscUtils.IsNull(record.RelationId) Then + report.AddData("${RelationId}", "",ReportEnum.Align.Left, 100) + Else + Dim _isExpandableNonCompositeForeignKey as Boolean + Dim _DFKA as String = "" + _isExpandableNonCompositeForeignKey = PersonRelativeTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonRelativeTable.RelationId) + _DFKA = PersonRelativeTable.GetDFKA(record.RelationId.ToString(), PersonRelativeTable.RelationId,Nothing) + If _isExpandableNonCompositeForeignKey AndAlso (not _DFKA Is Nothing) AndAlso PersonRelativeTable.RelationId.IsApplyDisplayAs Then + report.AddData("${RelationId}", _DFKA,ReportEnum.Align.Left, 100) + Else + report.AddData("${RelationId}", record.Format(PersonRelativeTable.RelationId), ReportEnum.Align.Left, 100) + End If + End If + report.AddData("${Ref0}", record.Format(PersonRelativeTable.Ref0), ReportEnum.Align.Left, 100) + report.AddData("${RefDate}", record.Format(PersonRelativeTable.RefDate), ReportEnum.Align.Left, 100) + If BaseClasses.Utils.MiscUtils.IsNull(record.RStatus) Then + report.AddData("${RStatus}", "",ReportEnum.Align.Left, 100) + Else + Dim _isExpandableNonCompositeForeignKey as Boolean + Dim _DFKA as String = "" + _isExpandableNonCompositeForeignKey = PersonRelativeTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonRelativeTable.RStatus) + _DFKA = PersonRelativeTable.GetDFKA(record.RStatus.ToString(), PersonRelativeTable.RStatus,Nothing) + If _isExpandableNonCompositeForeignKey AndAlso (not _DFKA Is Nothing) AndAlso PersonRelativeTable.RStatus.IsApplyDisplayAs Then + report.AddData("${RStatus}", _DFKA,ReportEnum.Align.Left, 100) + Else + report.AddData("${RStatus}", record.Format(PersonRelativeTable.RStatus), ReportEnum.Align.Left, 100) + End If + End If + report.AddData("${RStatusRef}", record.Format(PersonRelativeTable.RStatusRef), ReportEnum.Align.Left, 100) + report.AddData("${RStatusDate}", record.Format(PersonRelativeTable.RStatusDate), ReportEnum.Align.Left, 100) + report.AddData("${RRemark}", record.Format(PersonRelativeTable.RRemark), ReportEnum.Align.Left, 100) + + report.WriteRow + Next + pageNum = pageNum + 1 + recordCount += records.Length + End If + Loop While Not (records Is Nothing) AndAlso recordCount < totalRows AndAlso whereClause.RunQuery + + report.Close + BaseClasses.Utils.NetUtils.WriteResponseBinaryAttachment(Me.Page.Response, report.Title + ".pdf", report.ReportInByteArray, 0, true) + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonRelativeRefreshButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Dim PersonalDDTableControlObj as PersonalDDTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalDDTableControl"), PersonalDDTableControl) + PersonalDDTableControlObj.ResetData = True + + PersonalDDTableControlObj.RemoveFromSession(PersonalDDTableControlObj, "DeletedRecordIds") + PersonalDDTableControlObj.DeletedRecordIds = Nothing + + Dim PersonalEducationTableControlObj as PersonalEducationTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalEducationTableControl"), PersonalEducationTableControl) + PersonalEducationTableControlObj.ResetData = True + + PersonalEducationTableControlObj.RemoveFromSession(PersonalEducationTableControlObj, "DeletedRecordIds") + PersonalEducationTableControlObj.DeletedRecordIds = Nothing + + Dim PersonalExtWorkTableControlObj as PersonalExtWorkTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalExtWorkTableControl"), PersonalExtWorkTableControl) + PersonalExtWorkTableControlObj.ResetData = True + + PersonalExtWorkTableControlObj.RemoveFromSession(PersonalExtWorkTableControlObj, "DeletedRecordIds") + PersonalExtWorkTableControlObj.DeletedRecordIds = Nothing + + Dim PersonalIdRecordControlObj as PersonalIdRecordControl = DirectCast(Me.Page.FindControlRecursively("PersonalIdRecordControl"), PersonalIdRecordControl) + PersonalIdRecordControlObj.ResetData = True + + + Dim PersonalInsigniaTableControlObj as PersonalInsigniaTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalInsigniaTableControl"), PersonalInsigniaTableControl) + PersonalInsigniaTableControlObj.ResetData = True + + PersonalInsigniaTableControlObj.RemoveFromSession(PersonalInsigniaTableControlObj, "DeletedRecordIds") + PersonalInsigniaTableControlObj.DeletedRecordIds = Nothing + + Dim PersonalLanguageSkillTableControlObj as PersonalLanguageSkillTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalLanguageSkillTableControl"), PersonalLanguageSkillTableControl) + PersonalLanguageSkillTableControlObj.ResetData = True + + PersonalLanguageSkillTableControlObj.RemoveFromSession(PersonalLanguageSkillTableControlObj, "DeletedRecordIds") + PersonalLanguageSkillTableControlObj.DeletedRecordIds = Nothing + + Dim PersonalNameTableControlObj as PersonalNameTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalNameTableControl"), PersonalNameTableControl) + PersonalNameTableControlObj.ResetData = True + + PersonalNameTableControlObj.RemoveFromSession(PersonalNameTableControlObj, "DeletedRecordIds") + PersonalNameTableControlObj.DeletedRecordIds = Nothing + + Dim PersonalRankTableControlObj as PersonalRankTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalRankTableControl"), PersonalRankTableControl) + PersonalRankTableControlObj.ResetData = True + + PersonalRankTableControlObj.RemoveFromSession(PersonalRankTableControlObj, "DeletedRecordIds") + PersonalRankTableControlObj.DeletedRecordIds = Nothing + + Dim PersonalSalaryTableControlObj as PersonalSalaryTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalSalaryTableControl"), PersonalSalaryTableControl) + PersonalSalaryTableControlObj.ResetData = True + + PersonalSalaryTableControlObj.RemoveFromSession(PersonalSalaryTableControlObj, "DeletedRecordIds") + PersonalSalaryTableControlObj.DeletedRecordIds = Nothing + + Dim PersonalSpecialSkillTableControlObj as PersonalSpecialSkillTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalSpecialSkillTableControl"), PersonalSpecialSkillTableControl) + PersonalSpecialSkillTableControlObj.ResetData = True + + PersonalSpecialSkillTableControlObj.RemoveFromSession(PersonalSpecialSkillTableControlObj, "DeletedRecordIds") + PersonalSpecialSkillTableControlObj.DeletedRecordIds = Nothing + + Dim PersonalSportSkillTableControlObj as PersonalSportSkillTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalSportSkillTableControl"), PersonalSportSkillTableControl) + PersonalSportSkillTableControlObj.ResetData = True + + PersonalSportSkillTableControlObj.RemoveFromSession(PersonalSportSkillTableControlObj, "DeletedRecordIds") + PersonalSportSkillTableControlObj.DeletedRecordIds = Nothing + + Dim PersonalTitleTableControlObj as PersonalTitleTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalTitleTableControl"), PersonalTitleTableControl) + PersonalTitleTableControlObj.ResetData = True + + PersonalTitleTableControlObj.RemoveFromSession(PersonalTitleTableControlObj, "DeletedRecordIds") + PersonalTitleTableControlObj.DeletedRecordIds = Nothing + + Dim PersonRelativeTableControlObj as PersonRelativeTableControl = DirectCast(Me.Page.FindControlRecursively("PersonRelativeTableControl"), PersonRelativeTableControl) + PersonRelativeTableControlObj.ResetData = True + + PersonRelativeTableControlObj.RemoveFromSession(PersonRelativeTableControlObj, "DeletedRecordIds") + PersonRelativeTableControlObj.DeletedRecordIds = Nothing + + Dim ReportPropertiesTableControlObj as ReportPropertiesTableControl = DirectCast(Me.Page.FindControlRecursively("ReportPropertiesTableControl"), ReportPropertiesTableControl) + ReportPropertiesTableControlObj.ResetData = True + + ReportPropertiesTableControlObj.RemoveFromSession(ReportPropertiesTableControlObj, "DeletedRecordIds") + ReportPropertiesTableControlObj.DeletedRecordIds = Nothing + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonRelativeResetButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.CurrentSortOrder.Reset() + If Me.InSession(Me, "Order_By") Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + Me.CurrentSortOrder.Add(PersonRelativeTable.RelationId, OrderByItem.OrderDir.Asc) + + Me.CurrentSortOrder.Add(PersonRelativeTable.RBirthDate, OrderByItem.OrderDir.Asc) + + + End If + + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonRelativeWordButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + Dim report As WordReport = New WordReport + report.SpecificReportFileName = Page.Server.MapPath("ShowPersonalId.PersonRelativeWordButton.word") + ' report.Title replaces the value tag of page header and footer containing ${ReportTitle} + report.Title = "PersonRelative" + ' If ShowPersonalId.PersonRelativeWordButton.report specifies a valid report template, + ' AddColumn method will generate a report template. + ' Each AddColumn method-call specifies a column + ' The 1st parameter represents the text of the column header + ' The 2nd parameter represents the horizontal alignment of the column header + ' The 3rd parameter represents the text format of the column detail + ' The 4th parameter represents the horizontal alignment of the column detail + ' The 5th parameter represents the relative width of the column + report.AddColumn(PersonRelativeTable.RPreName.Name, ReportEnum.Align.Left, "${RPreName}", ReportEnum.Align.Left, 30) + report.AddColumn(PersonRelativeTable.RFirstName.Name, ReportEnum.Align.Left, "${RFirstName}", ReportEnum.Align.Left, 30) + report.AddColumn(PersonRelativeTable.RLastName.Name, ReportEnum.Align.Left, "${RLastName}", ReportEnum.Align.Left, 30) + report.AddColumn(PersonRelativeTable.ROrLastName.Name, ReportEnum.Align.Left, "${ROrLastName}", ReportEnum.Align.Left, 30) + report.AddColumn(PersonRelativeTable.FName.Name, ReportEnum.Align.Left, "${FName}", ReportEnum.Align.Left, 30) + report.AddColumn(PersonRelativeTable.FLastName.Name, ReportEnum.Align.Left, "${FLastName}", ReportEnum.Align.Left, 30) + report.AddColumn(PersonRelativeTable.MName.Name, ReportEnum.Align.Left, "${MName}", ReportEnum.Align.Left, 30) + report.AddColumn(PersonRelativeTable.MLastName.Name, ReportEnum.Align.Left, "${MLastName}", ReportEnum.Align.Left, 30) + report.AddColumn(PersonRelativeTable.MOrLastName.Name, ReportEnum.Align.Left, "${MOrLastName}", ReportEnum.Align.Left, 30) + report.AddColumn(PersonRelativeTable.ROrigin.Name, ReportEnum.Align.Left, "${ROrigin}", ReportEnum.Align.Left, 30) + report.AddColumn(PersonRelativeTable.RNationality.Name, ReportEnum.Align.Left, "${RNationality}", ReportEnum.Align.Left, 30) + report.AddColumn(PersonRelativeTable.RReligion.Name, ReportEnum.Align.Left, "${RReligion}", ReportEnum.Align.Left, 30) + report.AddColumn(PersonRelativeTable.RAddress.Name, ReportEnum.Align.Left, "${RAddress}", ReportEnum.Align.Left, 30) + report.AddColumn(PersonRelativeTable.RAmphur.Name, ReportEnum.Align.Left, "${RAmphur}", ReportEnum.Align.Left, 30) + report.AddColumn(PersonRelativeTable.RProvince.Name, ReportEnum.Align.Left, "${RProvince}", ReportEnum.Align.Left, 30) + report.AddColumn(PersonRelativeTable.RBirthDate.Name, ReportEnum.Align.Left, "${RBirthDate}", ReportEnum.Align.Left, 20) + report.AddColumn(PersonRelativeTable.RelationId.Name, ReportEnum.Align.Left, "${RelationId}", ReportEnum.Align.Left, 30) + report.AddColumn(PersonRelativeTable.Ref0.Name, ReportEnum.Align.Left, "${Ref0}", ReportEnum.Align.Left, 30) + report.AddColumn(PersonRelativeTable.RefDate.Name, ReportEnum.Align.Left, "${RefDate}", ReportEnum.Align.Left, 20) + report.AddColumn(PersonRelativeTable.RStatus.Name, ReportEnum.Align.Left, "${RStatus}", ReportEnum.Align.Left, 30) + report.AddColumn(PersonRelativeTable.RStatusRef.Name, ReportEnum.Align.Left, "${RStatusRef}", ReportEnum.Align.Left, 30) + report.AddColumn(PersonRelativeTable.RStatusDate.Name, ReportEnum.Align.Left, "${RStatusDate}", ReportEnum.Align.Left, 20) + report.AddColumn(PersonRelativeTable.RRemark.Name, ReportEnum.Align.Left, "${RRemark}", ReportEnum.Align.Left, 30) + + Dim whereClause As WhereClause = CreateWhereClause + + Dim orderBy As OrderBy = CreateOrderBy + Dim joinFilter As BaseFilter = CreateCompoundJoinFilter() + + Dim rowsPerQuery As Integer = 5000 + Dim pageNum As Integer = 0 + Dim recordCount As Integer = 0 + Dim totalRows As Integer = PersonRelativeTable.GetRecordCount(joinFilter,whereClause) + + report.Page = Page.GetResourceValue("Txt:Page", "Persons") + report.ApplicationPath = Me.Page.MapPath(Page.Request.ApplicationPath) + + Dim columns As ColumnList = PersonRelativeTable.GetColumnList() + Dim records As PersonRelativeRecord() = Nothing + Do + records = PersonRelativeTable.GetRecords(joinFilter,whereClause, orderBy, pageNum, rowsPerQuery) + + If Not (records Is Nothing) AndAlso records.Length > 0 AndAlso whereClause.RunQuery Then + For Each record As PersonRelativeRecord In records + ' AddData method takes four parameters + ' The 1st parameters represent the data format + ' The 2nd parameters represent the data value + ' The 3rd parameters represent the default alignment of column using the data + ' The 4th parameters represent the maximum length of the data value being shown + report.AddData("${RPreName}", record.Format(PersonRelativeTable.RPreName), ReportEnum.Align.Left, 100) + report.AddData("${RFirstName}", record.Format(PersonRelativeTable.RFirstName), ReportEnum.Align.Left, 100) + report.AddData("${RLastName}", record.Format(PersonRelativeTable.RLastName), ReportEnum.Align.Left, 100) + report.AddData("${ROrLastName}", record.Format(PersonRelativeTable.ROrLastName), ReportEnum.Align.Left, 100) + report.AddData("${FName}", record.Format(PersonRelativeTable.FName), ReportEnum.Align.Left, 100) + report.AddData("${FLastName}", record.Format(PersonRelativeTable.FLastName), ReportEnum.Align.Left, 100) + report.AddData("${MName}", record.Format(PersonRelativeTable.MName), ReportEnum.Align.Left, 100) + report.AddData("${MLastName}", record.Format(PersonRelativeTable.MLastName), ReportEnum.Align.Left, 100) + report.AddData("${MOrLastName}", record.Format(PersonRelativeTable.MOrLastName), ReportEnum.Align.Left, 100) + report.AddData("${ROrigin}", record.Format(PersonRelativeTable.ROrigin), ReportEnum.Align.Left, 100) + report.AddData("${RNationality}", record.Format(PersonRelativeTable.RNationality), ReportEnum.Align.Left, 100) + report.AddData("${RReligion}", record.Format(PersonRelativeTable.RReligion), ReportEnum.Align.Left, 100) + report.AddData("${RAddress}", record.Format(PersonRelativeTable.RAddress), ReportEnum.Align.Left, 100) + report.AddData("${RAmphur}", record.Format(PersonRelativeTable.RAmphur), ReportEnum.Align.Left, 100) + report.AddData("${RProvince}", record.Format(PersonRelativeTable.RProvince), ReportEnum.Align.Left, 100) + report.AddData("${RBirthDate}", record.Format(PersonRelativeTable.RBirthDate), ReportEnum.Align.Left, 100) + If BaseClasses.Utils.MiscUtils.IsNull(record.RelationId) Then + report.AddData("${RelationId}", "",ReportEnum.Align.Left, 100) + Else + Dim _isExpandableNonCompositeForeignKey as Boolean + Dim _DFKA as String = "" + _isExpandableNonCompositeForeignKey = PersonRelativeTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonRelativeTable.RelationId) + _DFKA = PersonRelativeTable.GetDFKA(record.RelationId.ToString(), PersonRelativeTable.RelationId,Nothing) + If _isExpandableNonCompositeForeignKey AndAlso (not _DFKA Is Nothing) AndAlso PersonRelativeTable.RelationId.IsApplyDisplayAs Then + report.AddData("${RelationId}", _DFKA,ReportEnum.Align.Left, 100) + Else + report.AddData("${RelationId}", record.Format(PersonRelativeTable.RelationId), ReportEnum.Align.Left, 100) + End If + End If + report.AddData("${Ref0}", record.Format(PersonRelativeTable.Ref0), ReportEnum.Align.Left, 100) + report.AddData("${RefDate}", record.Format(PersonRelativeTable.RefDate), ReportEnum.Align.Left, 100) + If BaseClasses.Utils.MiscUtils.IsNull(record.RStatus) Then + report.AddData("${RStatus}", "",ReportEnum.Align.Left, 100) + Else + Dim _isExpandableNonCompositeForeignKey as Boolean + Dim _DFKA as String = "" + _isExpandableNonCompositeForeignKey = PersonRelativeTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonRelativeTable.RStatus) + _DFKA = PersonRelativeTable.GetDFKA(record.RStatus.ToString(), PersonRelativeTable.RStatus,Nothing) + If _isExpandableNonCompositeForeignKey AndAlso (not _DFKA Is Nothing) AndAlso PersonRelativeTable.RStatus.IsApplyDisplayAs Then + report.AddData("${RStatus}", _DFKA,ReportEnum.Align.Left, 100) + Else + report.AddData("${RStatus}", record.Format(PersonRelativeTable.RStatus), ReportEnum.Align.Left, 100) + End If + End If + report.AddData("${RStatusRef}", record.Format(PersonRelativeTable.RStatusRef), ReportEnum.Align.Left, 100) + report.AddData("${RStatusDate}", record.Format(PersonRelativeTable.RStatusDate), ReportEnum.Align.Left, 100) + report.AddData("${RRemark}", record.Format(PersonRelativeTable.RRemark), ReportEnum.Align.Left, 100) + + report.WriteRow + Next + pageNum = pageNum + 1 + recordCount += records.Length + End If + Loop While Not (records Is Nothing) AndAlso recordCount < totalRows AndAlso whereClause.RunQuery + report.save + BaseClasses.Utils.NetUtils.WriteResponseBinaryAttachment(Me.Page.Response, report.Title + ".doc", report.ReportInByteArray, 0, true) + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + + + ' Generate the event handling functions for filter and search events. + + + ' Generate the event handling functions for others + + + Private _UIData As New System.Collections.Generic.List(Of Hashtable) + Public Property UIData() As System.Collections.Generic.List(Of Hashtable) + Get + Return Me._UIData + End Get + Set(ByVal value As System.Collections.Generic.List(Of Hashtable)) + Me._UIData = value + End Set + End Property + + ' pagination properties + Protected _PageSize As Integer + Public Property PageSize() As Integer + Get + Return Me._PageSize + End Get + Set(ByVal value As Integer) + Me._PageSize = value + End Set + End Property + + Protected _PageIndex As Integer + Public Property PageIndex() As Integer + Get + ' Return the PageIndex + Return Me._PageIndex + End Get + Set(ByVal value As Integer) + Me._PageIndex = value + End Set + End Property + + Protected _TotalRecords As Integer = -1 + Public Property TotalRecords() As Integer + Get + If _TotalRecords < 0 + _TotalRecords = PersonRelativeTable.GetRecordCount(CreateCompoundJoinFilter(), CreateWhereClause()) + End If + Return Me._TotalRecords + End Get + Set(ByVal value As Integer) + If Me.PageSize > 0 Then + + Me.TotalPages = CInt(Math.Ceiling(value / Me.PageSize)) + + End If + Me._TotalRecords = value + End Set + End Property + + + + Protected _TotalPages As Integer = -1 + Public Property TotalPages() As Integer + Get + If _TotalPages < 0 Then + + Me.TotalPages = CInt(Math.Ceiling(TotalRecords / Me.PageSize)) + + End If + Return Me._TotalPages + End Get + Set(ByVal value As Integer) + Me._TotalPages = value + End Set + End Property + + Protected _DisplayLastPage As Boolean + Public Property DisplayLastPage() As Boolean + Get + Return Me._DisplayLastPage + End Get + Set(ByVal value As Boolean) + Me._DisplayLastPage = value + End Set + End Property + + Private _DataChanged As Boolean = False + Public Property DataChanged() As Boolean + Get + Return Me._DataChanged + End Get + Set(ByVal value As Boolean) + Me._DataChanged = value + End Set + End Property + + Private _ResetData As Boolean = False + Public Property ResetData() As Boolean + Get + Return Me._ResetData + End Get + Set(ByVal value As Boolean) + Me._ResetData = value + End Set + End Property + + Private _AddNewRecord As Integer = 0 + Public Property AddNewRecord() As Integer + Get + Return Me._AddNewRecord + End Get + Set(ByVal value As Integer) + Me._AddNewRecord = value + End Set + End Property + + + Private _CurrentSortOrder As OrderBy = Nothing + Public Property CurrentSortOrder() As OrderBy + Get + Return Me._CurrentSortOrder + End Get + Set(ByVal value As BaseClasses.Data.OrderBy) + Me._CurrentSortOrder = value + End Set + End Property + + Private _DataSource() As PersonRelativeRecord = Nothing + Public Property DataSource() As PersonRelativeRecord () + Get + Return Me._DataSource + End Get + Set(ByVal value() As PersonRelativeRecord) + Me._DataSource = value + End Set + End Property + +#Region "Helper Properties" + + Public ReadOnly Property FLastNameLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "FLastNameLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property FNameLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "FNameLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property MLastNameLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "MLastNameLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property MNameLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "MNameLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property MOrLastNameLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "MOrLastNameLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property PersonRelativeExportCSVButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonRelativeExportCSVButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonRelativeExportExcelButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonRelativeExportExcelButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonRelativeImportButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonRelativeImportButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonRelativePagination() As Persons.UI.IPagination + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonRelativePagination"), Persons.UI.IPagination) + End Get + End Property + + Public ReadOnly Property PersonRelativePDFButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonRelativePDFButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonRelativeRefreshButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonRelativeRefreshButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonRelativeResetButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonRelativeResetButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonRelativeTableControlCollapsibleRegion() As System.Web.UI.WebControls.Panel + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonRelativeTableControlCollapsibleRegion"), System.Web.UI.WebControls.Panel) + End Get + End Property + + Public ReadOnly Property PersonRelativeWordButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonRelativeWordButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property RAddressLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RAddressLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property RAmphurLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RAmphurLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property RBirthDateLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RBirthDateLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property RefDateLabel2() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RefDateLabel2"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property RefLabel3() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RefLabel3"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property RelationIdLabel1() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RelationIdLabel1"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property RFirstNameLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RFirstNameLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property RLastNameLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RLastNameLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property RNationalityLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RNationalityLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property ROriginLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "ROriginLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property ROrLastNameLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "ROrLastNameLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property RPreNameLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RPreNameLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property RProvinceLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RProvinceLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property RReligionLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RReligionLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property RRemarkLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RRemarkLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property RStatusDateLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RStatusDateLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property RStatusLabel1() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RStatusLabel1"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property RStatusRefLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RStatusRefLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + +#End Region + +#Region "Helper Functions" + + Public Overrides Overloads Function ModifyRedirectUrl(url As String, arg As String, ByVal bEncrypt As Boolean) As String + Return Me.Page.EvaluateExpressions(url, arg, bEncrypt, Me) + End Function + + Public Overrides Overloads Function EvaluateExpressions(url As String, arg As String, ByVal bEncrypt As Boolean) As String + Dim needToProcess As Boolean = AreAnyUrlParametersForMe(url, arg) + If (needToProcess) Then + Dim recCtl As PersonRelativeTableControlRow = Me.GetSelectedRecordControl() + If recCtl Is Nothing AndAlso url.IndexOf("{") >= 0 Then + ' Localization. + Throw New Exception(Page.GetResourceValue("Err:NoRecSelected", "Persons")) + End If + Dim rec As PersonRelativeRecord = Nothing + If recCtl IsNot Nothing Then + rec = recCtl.GetRecord() + End If + Return EvaluateExpressions(url, arg, rec, bEncrypt) + End If + Return url + End Function + + Public Overridable Function GetSelectedRecordControl() As PersonRelativeTableControlRow + Return Nothing + + End Function + + Public Overridable Function GetSelectedRecordControls() As PersonRelativeTableControlRow() + + Return DirectCast((new ArrayList()).ToArray(GetType(PersonRelativeTableControlRow)), PersonRelativeTableControlRow()) + + End Function + + Public Overridable Sub DeleteSelectedRecords(ByVal deferDeletion As Boolean) + Dim recList() As PersonRelativeTableControlRow = Me.GetSelectedRecordControls() + If recList.Length = 0 Then + ' Localization. + Throw New Exception(Page.GetResourceValue("Err:NoRecSelected", "Persons")) + End If + + Dim recCtl As PersonRelativeTableControlRow + For Each recCtl In recList + If deferDeletion Then + If Not recCtl.IsNewRecord Then + + Me.AddToDeletedRecordIds(recCtl) + + End If + recCtl.Visible = False + + Else + + recCtl.Delete() + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + End If + Next + End Sub + + Public Function GetRecordControls() As PersonRelativeTableControlRow() + Dim recList As ArrayList = New ArrayList() + Dim rep As System.Web.UI.WebControls.Repeater = CType(Me.FindControl("PersonRelativeTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return Nothing + Dim repItem As System.Web.UI.WebControls.RepeaterItem + + For Each repItem In rep.Items + + Dim recControl As PersonRelativeTableControlRow = DirectCast(repItem.FindControl("PersonRelativeTableControlRow"), PersonRelativeTableControlRow) + recList.Add(recControl) + + Next + + Return DirectCast(recList.ToArray(GetType(PersonRelativeTableControlRow)), PersonRelativeTableControlRow()) + End Function + + Public Shadows ReadOnly Property Page() As BaseApplicationPage + Get + Return DirectCast(MyBase.Page, BaseApplicationPage) + End Get + End Property + +#End Region + + + +End Class + + +' Base class for the ReportPropertiesTableControlRow control on the ShowPersonalId page. +' Do not modify this class. Instead override any method in ReportPropertiesTableControlRow. +Public Class BaseReportPropertiesTableControlRow + Inherits Persons.UI.BaseApplicationRecordControl + + ' To customize, override this method in ReportPropertiesTableControlRow. + Protected Overridable Sub Control_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Init + + Me.ClearControlsFromSession() + End Sub + + ' To customize, override this method in ReportPropertiesTableControlRow. + Protected Overridable Sub Control_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load + + 'Call LoadFocusScripts from repeater so that onfocus attribute could be added to elements + Me.Page.LoadFocusScripts(Me) + + + ' Register the event handlers. + + + End Sub + + + Public Overridable Sub LoadData() + + ' Load the data from the database into the DataSource ReportProperties 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 = ReportPropertiesTable.GetRecord(Me.RecordUniqueId, True) + + Return + End If + + ' Since this is a row in the table, the data for this row is loaded by the + ' LoadData method of the BaseReportPropertiesTableControl when the data for the entire + ' table is loaded. + + Me.DataSource = New ReportPropertiesRecord() + + + + End Sub + + ' Populate the UI controls using the DataSource. To customize, override this method in ReportPropertiesTableControlRow. + 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 + + + + 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 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 ReportPropertiesTableControlRow. + Public Overridable Sub SaveData() + ' Saves the associated record in the database. + ' SaveData calls Validate and Get methods - so it may be more appropriate to + ' customize those methods. + + ' 1. Load the existing record from the database. Since we save the entire record, this ensures + ' that fields that are not displayed are also properly initialized. + Me.LoadData() + + + ' 2. Perform any custom validation. + Me.Validate() + + + ' 3. Set the values in the record with data from UI controls. + ' This calls the Get() method for each of the user interface controls. + Me.GetUIData() + + ' 4. Save in the database. + ' We should not save the record if the data did not change. This + ' will save a database hit and avoid triggering any database triggers. + + If Me.DataSource.IsAnyValueChanged Then + ' Save record to database but do not commit yet. + ' Auto generated ids are available after saving for use by child (dependent) records. + Me.DataSource.Save() + + DirectCast(GetParentControlObject(Me, "ReportPropertiesTableControl"), ReportPropertiesTableControl).DataChanged = True + DirectCast(GetParentControlObject(Me, "ReportPropertiesTableControl"), ReportPropertiesTableControl).ResetData = True + End If + + + ' update session or cookie by formula + + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + ' For Master-Detail relationships, save data on the Detail table(s) + + End Sub + + ' To customize, override this method in ReportPropertiesTableControlRow. + 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. + + End Sub + + + + ' To customize, override this method in ReportPropertiesTableControlRow. + + Public Overridable Function CreateWhereClause() As WhereClause + + Return Nothing + + End Function + + + + ' To customize, override this method in ReportPropertiesTableControlRow. + 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) + ReportPropertiesTable.DeleteRecord(pkValue) + + DirectCast(GetParentControlObject(Me, "ReportPropertiesTableControl"), ReportPropertiesTableControl).DataChanged = True + DirectCast(GetParentControlObject(Me, "ReportPropertiesTableControl"), ReportPropertiesTableControl).ResetData = True + End Sub + + Protected Overridable Sub Control_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.PreRender + ' PreRender event is raised just before page is being displayed. + Try + DbUtils.StartTransaction() + Me.RegisterPostback() + + If Not Me.Page.ErrorOnPage AndAlso (Me.Page.IsPageRefresh OrElse Me.DataChanged OrElse Me.ResetData) Then + + + ' Re-load the data and update the web page if necessary. + ' This is typically done during a postback (filter, search button, sort, pagination button). + ' In each of the other click handlers, simply set DataChanged to True to reload the data. + Me.LoadData() + Me.DataBind() + End If + + + Catch ex As Exception + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + Finally + DbUtils.EndTransaction() + End Try + End Sub + + + Protected Overrides Sub SaveControlsToSession() + MyBase.SaveControlsToSession() + + + 'Save pagination state to session. + + End Sub + + + + Protected Overrides Sub ClearControlsFromSession() + MyBase.ClearControlsFromSession() + + + + ' Clear pagination state from session. + + End Sub + + Protected Overrides Sub LoadViewState(ByVal savedState As Object) + MyBase.LoadViewState(savedState) + Dim isNewRecord As String = CType(ViewState("IsNewRecord"), String) + If Not isNewRecord Is Nothing AndAlso isNewRecord.Trim <> "" Then + Me.IsNewRecord = Boolean.Parse(isNewRecord) + End If + + Dim myCheckSum As String = CType(ViewState("CheckSum"), String) + If Not myCheckSum Is Nothing AndAlso myCheckSum.Trim <> "" Then + Me.CheckSum = myCheckSum + End If + + + ' Load view state for pagination control. + + End Sub + + Protected Overrides Function SaveViewState() As Object + ViewState("IsNewRecord") = Me.IsNewRecord.ToString() + ViewState("CheckSum") = Me.CheckSum + + + ' Load view state for pagination control. + + Return MyBase.SaveViewState() + End Function + + + + 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("BaseReportPropertiesTableControlRow_Rec"), String) + End Get + Set(ByVal value As String) + Me.ViewState("BaseReportPropertiesTableControlRow_Rec") = value + End Set + End Property + + Private _DataSource As ReportPropertiesRecord + Public Property DataSource() As ReportPropertiesRecord + Get + Return Me._DataSource + End Get + + Set(ByVal value As ReportPropertiesRecord) + + Me._DataSource = value + End Set + End Property + + + + Private _checkSum As String + Public Overridable Property CheckSum() As String + Get + Return Me._checkSum + End Get + Set(ByVal value As String) + Me._checkSum = value + End Set + End Property + + Private _TotalPages As Integer + Public Property TotalPages() As Integer + Get + Return Me._TotalPages + End Get + Set(ByVal value As Integer) + Me._TotalPages = value + End Set + End Property + + Private _PageIndex As Integer + Public Property PageIndex() As Integer + Get + ' Return the PageIndex + Return Me._PageIndex + End Get + Set(ByVal value As Integer) + Me._PageIndex = value + End Set + End Property + + Private _DisplayLastPage As Boolean + Public Property DisplayLastPage() As Boolean + Get + Return Me._DisplayLastPage + End Get + Set(ByVal value As Boolean) + Me._DisplayLastPage = value + End Set + End Property + + + +#Region "Helper Properties" + +#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 ReportPropertiesRecord = 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 ReportPropertiesRecord + If Not Me.DataSource Is Nothing Then + Return Me.DataSource + End If + + If Not Me.RecordUniqueId Is Nothing Then + + Return ReportPropertiesTable.GetRecord(Me.RecordUniqueId, True) + + End If + + ' Localization. + + Throw New Exception(Page.GetResourceValue("Err:RetrieveRec", "Persons")) + + End Function + + Public Shadows ReadOnly Property Page() As BaseApplicationPage + Get + Return DirectCast(MyBase.Page, BaseApplicationPage) + End Get + End Property + +#End Region + +End Class + + + +' Base class for the ReportPropertiesTableControl control on the ShowPersonalId page. +' Do not modify this class. Instead override any method in ReportPropertiesTableControl. +Public Class BaseReportPropertiesTableControl + Inherits Persons.UI.BaseApplicationTableControl + + + + Protected Overridable Sub Control_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Init + + + + ' Setup the filter and search events. + + + + ' Control Initializations. + ' Initialize the table's current sort order. + + If Me.InSession(Me, "Order_By") Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + End If + + + + ' Setup default pagination settings. + + Me.PageSize = CInt(Me.GetFromSession(Me, "Page_Size", "10")) + Me.PageIndex = CInt(Me.GetFromSession(Me, "Page_Index", "0")) + + + + Me.ClearControlsFromSession() + End Sub + + Protected Overridable Sub Control_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load + + SaveControlsToSession_Ajax() + + ' Setup the pagination events. + + + ' Setup the sorting events. + + ' Setup the button events. + + AddHandler Me.ReportPropertiesExportExcelButton.Click, AddressOf ReportPropertiesExportExcelButton_Click + + AddHandler Me.ReportPropertiesPDFButton.Click, AddressOf ReportPropertiesPDFButton_Click + + AddHandler Me.ReportPropertiesWordButton.Click, AddressOf ReportPropertiesWordButton_Click + + + ' Setup events for others + + End Sub + + + Public Overridable Sub LoadData() + + ' Read data from database. Returns an array of records that can be assigned + ' to the DataSource table control property. + Try + Dim joinFilter As CompoundFilter = CreateCompoundJoinFilter() + + ' The WHERE clause will be empty when displaying all records in table. + Dim wc As WhereClause = CreateWhereClause() + If wc IsNot Nothing AndAlso Not wc.RunQuery Then + ' Initialize an empty array of records + Dim alist As New ArrayList(0) + Me.DataSource = DirectCast(alist.ToArray(GetType(ReportPropertiesRecord)), ReportPropertiesRecord()) + ' Add records to the list if needed. + Me.AddNewRecords() + Me._TotalRecords = 0 + Me._TotalPages = 0 + Return + End If + + ' Call OrderBy to determine the order - either use the order defined + ' on the Query Wizard, or specified by user (by clicking on column heading) + Dim orderBy As OrderBy = CreateOrderBy() + + ' Get the pagesize from the pagesize control. + Me.GetPageSize() + + If Me.DisplayLastPage Then + Dim totalRecords As Integer = If(Me._TotalRecords < 0, ReportPropertiesTable.GetRecordCount(CreateCompoundJoinFilter(), CreateWhereClause()), Me._TotalRecords) + + Dim totalPages As Integer = CInt(Math.Ceiling(totalRecords / Me.PageSize)) + + Me.PageIndex = totalPages - 1 + End If + + ' Make sure PageIndex (current page) and PageSize are within bounds. + If Me.PageIndex < 0 Then + Me.PageIndex = 0 + End If + If Me.PageSize < 1 Then + Me.PageSize = 1 + End If + + ' Retrieve the records and set the table DataSource. + ' Only PageSize records are fetched starting at PageIndex (zero based). + If Me.AddNewRecord > 0 Then + ' Make sure to preserve the previously entered data on new rows. + Dim postdata As New ArrayList + For Each rc As ReportPropertiesTableControlRow In Me.GetRecordControls() + If Not rc.IsNewRecord Then + rc.DataSource = rc.GetRecord() + rc.GetUIData() + postdata.Add(rc.DataSource) + UIData.Add(rc.PreservedUIData()) + End If + Next + Me.DataSource = DirectCast(postdata.ToArray(GetType(ReportPropertiesRecord)), ReportPropertiesRecord()) + Else ' Get the records from the database + Me.DataSource = ReportPropertiesTable.GetRecords(joinFilter, wc, orderBy, Me.PageIndex, Me.PageSize) + + End If + + ' if the datasource contains no records contained in database, then load the last page. + If (DbUtils.GetCreatedRecords(Me.DataSource).Length = 0 AndAlso Not Me.DisplayLastPage) Then + Me.DisplayLastPage = True + LoadData() + Else + + ' Add any new rows desired by the user. + Me.AddNewRecords() + + + ' Initialize the page and grand totals. now + + End If + + Catch ex As Exception + ' Report the error message to the end user + Dim msg As String = ex.Message + If ex.InnerException IsNot Nothing Then + msg = msg & " InnerException: " & ex.InnerException.Message + End If + Throw New Exception(msg, ex.InnerException) + End Try + End Sub + + + + + Public Overrides Sub DataBind() + ' The DataBind method binds the user interface controls to the values + ' from the database record for each row in the table. To do this, it calls the + ' DataBind for each of the rows. + ' DataBind also populates any filters above the table, and sets the pagination + ' control to the correct number of records and the current page number. + + MyBase.DataBind() + + ' Make sure that the DataSource is initialized. + If Me.DataSource Is Nothing Then + Return + End If + + 'LoadData for DataSource for chart and report if they exist + + ' Setup the pagination controls. + BindPaginationControls() + + + + ' Bind the repeater with the list of records to expand the UI. + Dim rep As System.Web.UI.WebControls.Repeater = CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "ReportPropertiesTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return + rep.DataSource = DataSource() + rep.DataBind() + + Dim index As Integer = 0 + For Each repItem As System.Web.UI.WebControls.RepeaterItem In rep.Items + ' Loop through all rows in the table, set its DataSource and call DataBind(). + Dim recControl As ReportPropertiesTableControlRow = DirectCast(repItem.FindControl("ReportPropertiesTableControlRow"), ReportPropertiesTableControlRow) + recControl.DataSource = Me.DataSource(index) + If Me.UIData.Count > index Then + recControl.PreviousUIData = Me.UIData(index) + End If + recControl.DataBind() + recControl.Visible = Not Me.InDeletedRecordIds(recControl) + + index += 1 + Next + + + + + ' Call the Set methods for each controls on the panel + + + + SetReportPropertiesTableControlCollapsibleRegion() + + ' setting the state of expand or collapse alternative rows + + + ' Load data for each record and table UI control. + ' Ordering is important because child controls get + ' their parent ids from their parent UI controls. + + + ' this method calls the set method for controls with special formula like running total, sum, rank, etc + SetFormulaControls() + End Sub + + Public Overridable Sub SetFormulaControls() + ' this method calls Set methods for the control that has special formula + + + + End Sub + + + + Public Overridable Sub RegisterPostback() + + Me.Page.RegisterPostBackTrigger(MiscUtils.FindControlRecursively(Me,"ReportPropertiesExportExcelButton")) + + Me.Page.RegisterPostBackTrigger(MiscUtils.FindControlRecursively(Me,"ReportPropertiesPDFButton")) + + Me.Page.RegisterPostBackTrigger(MiscUtils.FindControlRecursively(Me,"ReportPropertiesWordButton")) + + + End Sub + + Public EvaluateFormulaDelegate As BaseClasses.Data.DataSource.EvaluateFormulaDelegate = New BaseClasses.Data.DataSource.EvaluateFormulaDelegate(AddressOf Me.EvaluateFormula) + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean, ByVal e as FormulaEvaluator) As String + If e Is Nothing + e = New FormulaEvaluator() + End If + + e.Variables.Clear() + + + ' add variables for formula evaluation + If variables IsNot Nothing Then + Dim enumerator As System.Collections.Generic.IEnumerator(Of System.Collections.Generic.KeyValuePair(Of String, Object)) = variables.GetEnumerator() + While enumerator.MoveNext() + e.Variables.Add(enumerator.Current.Key, enumerator.Current.Value) + End While + End If + + If includeDS + + End If + + ' All variables referred to in the formula are expected to be + ' properties of the DataSource. For example, referring to + ' UnitPrice as a variable will refer to DataSource.UnitPrice + e.DataSource = dataSourceForEvaluate + + ' Define the calling control. This is used to add other + ' related table and record controls as variables. + e.CallingControl = Me + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + + If Not String.IsNullOrEmpty(format) AndAlso (String.IsNullOrEmpty(formula) OrElse formula.IndexOf("Format(") < 0) Then + Return FormulaUtils.Format(resultObj, format) + Else + Return resultObj.ToString() + End If + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format,variables ,includeDS, Nothing) + End Function + + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object)) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format, variables ,True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, format, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal e as FormulaEvaluator) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, variables, True, e) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal includeDS as Boolean) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, includeDS, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, True, Nothing) + End Function + + + + + Public Overridable Sub ResetControl() + + Me.CurrentSortOrder.Reset() + If (Me.InSession(Me, "Order_By")) Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + End If + + Me.PageIndex = 0 + End Sub + + Protected Overridable Sub BindPaginationControls() + ' Setup the pagination controls. + + ' Bind the pagination labels. + + + ' Bind the buttons for ReportPropertiesTableControl pagination. + + + + End Sub + + Public Overridable Sub SaveData() + ' Save the data from the entire table. Calls each row's Save Data + ' to save their data. This function is called by the Click handler of the + ' Save button. The button handler should Start/Commit/End a transaction. + + Dim recCtl As ReportPropertiesTableControlRow + For Each recCtl In Me.GetRecordControls() + + If Me.InDeletedRecordIds(recCtl) Then + ' Delete any pending deletes. + recCtl.Delete() + Else + If recCtl.Visible Then + recCtl.SaveData() + End If + End If + + Next + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + ' Set IsNewRecord to False for all records - since everything has been saved and is no longer "new" + For Each recCtl In Me.GetRecordControls() + recCtl.IsNewRecord = False + Next + + + ' Set DeletedRecordsIds to Nothing since we have deleted all pending deletes. + Me.DeletedRecordIds = Nothing + + End Sub + + Public Overridable Function CreateCompoundJoinFilter() As CompoundFilter + Dim jFilter As CompoundFilter = New CompoundFilter() + + Return jFilter + + End Function + + + Public Overridable Function CreateOrderBy() As OrderBy + ' The CurrentSortOrder is initialized to the sort order on the + ' Query Wizard. It may be modified by the Click handler for any of + ' the column heading to sort or reverse sort by that column. + ' You can add your own sort order, or modify it on the Query Wizard. + Return Me.CurrentSortOrder + End Function + + Public Overridable Function CreateWhereClause() As WhereClause + 'This CreateWhereClause is used for loading the data. + ReportPropertiesTable.Instance.InnerFilter = Nothing + Dim wc As WhereClause = New WhereClause() + + ' Compose the WHERE clause consiting of: + ' 1. Static clause defined at design time. + ' 2. User selected search criteria. + ' 3. User selected filter criteria. + + + Return wc + End Function + + + Public Overridable Function CreateWhereClause(ByVal searchText as String, ByVal fromSearchControl as String, ByVal AutoTypeAheadSearch as String, ByVal AutoTypeAheadWordSeparators as String) As WhereClause + ' This CreateWhereClause is used for loading list of suggestions for Auto Type-Ahead feature. + ReportPropertiesTable.Instance.InnerFilter = Nothing + Dim wc As WhereClause = New WhereClause() + + ' Compose the WHERE clause consiting of: + ' 1. Static clause defined at design time. + ' 2. User selected search criteria. + ' 3. User selected filter criteria. + + Dim appRelativeVirtualPath As String = CType(HttpContext.Current.Session("AppRelativeVirtualPath"), String) + + ' Adds clauses if values are selected in Filter controls which are configured in the page. + + + Return wc + End Function + + + Public Overridable Function FormatSuggestions(ByVal prefixText As String, ByVal resultItem As String, _ + ByVal columnLength As Integer, ByVal AutoTypeAheadDisplayFoundText As String, _ + ByVal autoTypeAheadSearch As String, ByVal AutoTypeAheadWordSeparators As String, _ + ByVal resultList As ArrayList) As Boolean + + 'Formats the resultItem and adds it to the list of suggestions. + Dim index As Integer = resultItem.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture).IndexOf(prefixText.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture)) + Dim itemToAdd As String = "" + Dim isFound As Boolean = False + Dim isAdded As Boolean = False + ' Get the index where prfixt is at the beginning of resultItem. If not found then, index of word which begins with prefixText. + If InvariantLCase(autoTypeAheadSearch).equals("wordsstartingwithsearchstring") And Not index = 0 Then + ' Expression to find word which contains AutoTypeAheadWordSeparators followed by prefixText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex( AutoTypeAheadWordSeparators + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + If regex1.IsMatch(resultItem) Then + index = regex1.Match(resultItem).Index + isFound = True + End If + ' If the prefixText is found immediatly after white space then starting of the word is found so don not search any further + If not resultItem(index).ToString() = " " Then + ' Expression to find beginning of the word which contains AutoTypeAheadWordSeparators followed by prefixText + Dim regex As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\\S*" + AutoTypeAheadWordSeparators + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + If regex.IsMatch(resultItem) Then + index = regex.Match(resultItem).Index + isFound = True + End If + End If + End If + + ' If autoTypeAheadSearch value is wordsstartingwithsearchstring then, extract the substring only if the prefixText is found at the + ' beginning of the resultItem (index = 0) or a word in resultItem is found starts with prefixText. + If index = 0 Or isFound Or InvariantLCase(autoTypeAheadSearch).Equals("anywhereinstring") then + If InvariantLCase(AutoTypeAheadDisplayFoundText).equals("atbeginningofmatchedstring") Then + ' Expression to find beginning of the word which contains prefixText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\\S*" + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + ' Find the beginning of the word which contains prefexText + If (StringUtils.InvariantLCase(autoTypeAheadSearch).Equals("anywhereinstring") AndAlso regex1.IsMatch(resultItem)) Then + index = regex1.Match(resultItem).Index + isFound = True + End If + ' Display string from the index till end of the string if sub string from index till end is less than columnLength value. + If Len(resultItem) - index <= columnLength Then + If index = 0 Then + itemToAdd = resultItem + Else + itemToAdd = "..." & resultItem.Substring(index, Len(resultItem) - index) + End If + Else + If index = 0 Then + itemToAdd = resultItem.Substring(index, (columnLength - 3)) & "..." + Else + 'Truncate the string to show only columnLength - 6 characters as begining and trailing "..." has to be appended. + itemToAdd = "..." & resultItem.Substring(index , columnLength - 6) & "..." + End If + End If + ElseIf InvariantLCase(AutoTypeAheadDisplayFoundText).equals("inmiddleofmatchedstring") Then + Dim subStringBeginIndex As Integer = CType(columnLength/2, Integer) + If Len(resultItem) <= columnLength Then + itemToAdd = resultItem + Else + ' Sanity check at end of the string + If index + Len(prefixText) = columnLength Then + itemToAdd = "..." & resultItem.Substring(index-columnLength,index) + ElseIf Len(resultItem) - index < subStringBeginIndex Then + ' Display string from the end till columnLength value if, index is closer to the end of the string. + itemToAdd = "..." & resultItem.Substring(Len(resultItem)-columnLength,Len(resultItem)) + ElseIf index <= subStringBeginIndex Then + ' Sanity chet at beginning of the string + itemToAdd = resultItem.Substring(0, columnLength) & "..." + Else + ' Display string containing text before the prefixText occures and text after the prefixText + itemToAdd = "..." & resultItem.Substring(index - subStringBeginIndex, columnLength) & "..." + End If + End If + ElseIf InvariantLCase(AutoTypeAheadDisplayFoundText).equals("atendofmatchedstring") Then + ' Expression to find ending of the word which contains prefexText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\s", System.Text.RegularExpressions.RegexOptions.IgnoreCase) + ' Find the ending of the word which contains prefexText + If regex1.IsMatch(resultItem, index + 1) Then + index = regex1.Match(resultItem, index + 1).Index + Else + ' If the word which contains prefexText is the last word in string, regex1.IsMatch returns false. + index = resultItem.Length + End If + If index > Len(resultItem) Then + index = Len(resultItem) + End If + ' If text from beginning of the string till index is less than columnLength value then, display string from the beginning till index. + If index <= columnLength Then + if index = Len(resultItem) Then 'Make decision to append "..." + itemToAdd = resultItem.Substring(0,index) + Else + itemToAdd = resultItem.Substring(0,index) & "..." + End If + Else + If index = Len(resultItem) Then + itemToAdd = "..." & resultItem.Substring(index - (columnLength - 3), (columnLength - 3)) + Else + 'Truncate the string to show only columnLength - 6 characters as begining and trailing "..." has to be appended. + itemToAdd = "..." & resultItem.Substring(index - (columnLength - 6), columnLength - 6) & "..." + End If + End If + End If + + ' Remove newline character from itemToAdd + Dim prefixTextIndex As Integer = itemToAdd.IndexOf(prefixText, StringComparison.CurrentCultureIgnoreCase) + ' If itemToAdd contains any newline after the search text then show text only till newline + Dim regex2 As System.Text.RegularExpressions.Regex = New System.Text.RegularExpressions.Regex("(" & vbCrLf & "|" & vbLf & ")", System.Text.RegularExpressions.RegexOptions.IgnoreCase) + Dim newLineIndexAfterPrefix As Integer = -1 + If regex2.IsMatch(itemToAdd, prefixTextIndex) Then + newLineIndexAfterPrefix = regex2.Match(itemToAdd, prefixTextIndex).Index + End If + If (newLineIndexAfterPrefix > -1) Then + If itemToAdd.EndsWith("...") Then + itemToAdd = (itemToAdd.Substring(0, newLineIndexAfterPrefix) + "...") + Else + itemToAdd = itemToAdd.Substring(0, newLineIndexAfterPrefix) + End If + End If + ' If itemToAdd contains any newline before search text then show text which comes after newline + Dim regex3 As System.Text.RegularExpressions.Regex = New System.Text.RegularExpressions.Regex("(" & vbCrLf & "|" & vbLf & ")", (System.Text.RegularExpressions.RegexOptions.IgnoreCase Or System.Text.RegularExpressions.RegexOptions.RightToLeft)) + Dim newLineIndexBeforePrefix As Integer = -1 + If regex3.IsMatch(itemToAdd, prefixTextIndex) Then + newLineIndexBeforePrefix = regex3.Match(itemToAdd, prefixTextIndex).Index + End If + If (newLineIndexBeforePrefix > -1) Then + If itemToAdd.StartsWith("...") Then + itemToAdd = ("..." + itemToAdd.Substring((newLineIndexBeforePrefix + regex3.Match(itemToAdd, prefixTextIndex).Length))) + Else + itemToAdd = itemToAdd.Substring((newLineIndexBeforePrefix + regex3.Match(itemToAdd, prefixTextIndex).Length)) + End If + End If + + If Not itemToAdd is nothing AndAlso Not resultList.Contains(itemToAdd) Then + + resultList.Add(itemToAdd) + + isAdded = true + End If + End If + Return isAdded + End Function + + + Protected Overridable Sub GetPageSize() + + End Sub + + Protected Overridable Sub AddNewRecords() + + Dim newRecordList As ArrayList = New ArrayList() + + Dim newUIDataList As System.Collections.Generic.List(Of Hashtable) = New System.Collections.Generic.List(Of Hashtable)() + + ' Loop though all the record controls and if the record control + ' does not have a unique record id set, then create a record + ' and add to the list. + If Not Me.ResetData Then + Dim rep As System.Web.UI.WebControls.Repeater = CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "ReportPropertiesTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return + + Dim repItem As System.Web.UI.WebControls.RepeaterItem + For Each repItem In rep.Items + ' Loop through all rows in the table, set its DataSource and call DataBind(). + + Dim recControl As ReportPropertiesTableControlRow = DirectCast(repItem.FindControl("ReportPropertiesTableControlRow"), ReportPropertiesTableControlRow) + + If recControl.Visible AndAlso recControl.IsNewRecord() Then + + Dim rec As ReportPropertiesRecord = New ReportPropertiesRecord() + + newUIDataList.Add(recControl.PreservedUIData()) + newRecordList.Add(rec) + End If + Next + End If + + + ' Add any new record to the list. + Dim index As Integer = 0 + For index = 1 To Me.AddNewRecord + + newRecordList.Insert(0, New ReportPropertiesRecord()) + newUIDataList.Insert(0, New Hashtable()) + + Next + Me.AddNewRecord = 0 + + ' Finally, add any new records to the DataSource. + If newRecordList.Count > 0 Then + + Dim finalList As ArrayList = New ArrayList(Me.DataSource) + finalList.InsertRange(0, newRecordList) + + Me.DataSource = DirectCast(finalList.ToArray(GetType(ReportPropertiesRecord)), ReportPropertiesRecord()) + + End If + + ' Add the existing UI data to this hash table + If newUIDataList.Count > 0 Then + Me.UIData.InsertRange(0, newUIDataList) + End If + + End Sub + + + Public Sub AddToDeletedRecordIds(ByVal rec As ReportPropertiesTableControlRow) + If rec.IsNewRecord() Then + Return + End If + + If Not Me.DeletedRecordIds Is Nothing AndAlso Me.DeletedRecordIds.Trim <> "" Then + Me.DeletedRecordIds &= "," + End If + + Me.DeletedRecordIds &= "[" & rec.RecordUniqueId & "]" + End Sub + + Protected Overridable Function InDeletedRecordIds(ByVal rec As ReportPropertiesTableControlRow) As Boolean + If Me.DeletedRecordIds Is Nothing OrElse Me.DeletedRecordIds.Trim = "" Then + Return False + End If + + Return Me.DeletedRecordIds.IndexOf("[" & rec.RecordUniqueId & "]") >= 0 + End Function + + Private _DeletedRecordIds As String + Public Property DeletedRecordIds() As String + Get + Return Me._DeletedRecordIds + End Get + Set(ByVal value As String) + Me._DeletedRecordIds = value + End Set + End Property + + + ' Create Set, WhereClause, and Populate Methods + + Public Overridable Sub SetReportPropertiesTableControlCollapsibleRegion() + + 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 + + + + Me.Page.Authorize(Ctype(ReportPropertiesExportExcelButton, Control), "5") + + Me.Page.Authorize(Ctype(ReportPropertiesPDFButton, Control), "5") + + Me.Page.Authorize(Ctype(ReportPropertiesWordButton, Control), "5") + + Catch ex As Exception + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + Finally + DbUtils.EndTransaction + End Try + End Sub + + + Protected Overrides Sub SaveControlsToSession() + MyBase.SaveControlsToSession() + + ' Save filter controls to values to session. + + + 'Save pagination state to session. + + + + ' Save table control properties to the session. + If Not Me.CurrentSortOrder Is Nothing Then + Me.SaveToSession(Me, "Order_By", Me.CurrentSortOrder.ToXmlString()) + End If + + Me.SaveToSession(Me, "Page_Index", Me.PageIndex.ToString()) + Me.SaveToSession(Me, "Page_Size", Me.PageSize.ToString()) + + Me.SaveToSession(Me, "DeletedRecordIds", Me.DeletedRecordIds) + + End Sub + + Protected Sub SaveControlsToSession_Ajax() + ' Save filter controls to values to session. + + HttpContext.Current.Session("AppRelativeVirtualPath") = Me.Page.AppRelativeVirtualPath + + End Sub + + Protected Overrides Sub ClearControlsFromSession() + MyBase.ClearControlsFromSession() + + ' Clear filter controls values from the session. + + + ' Clear pagination state from session. + + + + ' Clear table properties from the session. + Me.RemoveFromSession(Me, "Order_By") + Me.RemoveFromSession(Me, "Page_Index") + Me.RemoveFromSession(Me, "Page_Size") + + Me.RemoveFromSession(Me, "DeletedRecordIds") + + End Sub + + Protected Overrides Sub LoadViewState(ByVal savedState As Object) + MyBase.LoadViewState(savedState) + + Dim orderByStr As String = CType(ViewState("ReportPropertiesTableControl_OrderBy"), String) + + If orderByStr IsNot Nothing AndAlso orderByStr.Trim <> "" Then + Me.CurrentSortOrder = BaseClasses.Data.OrderBy.FromXmlString(orderByStr) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + End If + + Dim pageIndex As String = CType(ViewState("Page_Index"), String) + If pageIndex IsNot Nothing Then + Me.PageIndex = CInt(pageIndex) + End If + + Dim pageSize As String = CType(ViewState("Page_Size"), String) + If Not pageSize Is Nothing Then + Me.PageSize = CInt(pageSize) + End If + + + + ' Load view state for pagination control. + + Me.DeletedRecordIds = CType(Me.ViewState("DeletedRecordIds"), String) + + End Sub + + Protected Overrides Function SaveViewState() As Object + + If Me.CurrentSortOrder IsNot Nothing Then + Me.ViewState("ReportPropertiesTableControl_OrderBy") = Me.CurrentSortOrder.ToXmlString() + End If + + Me.ViewState("Page_Index") = Me.PageIndex + Me.ViewState("Page_Size") = Me.PageSize + + Me.ViewState("DeletedRecordIds") = Me.DeletedRecordIds + + + ' Load view state for pagination control. + + + Return MyBase.SaveViewState() + End Function + + ' Generate the event handling functions for pagination events. + + + ' Generate the event handling functions for sorting events. + + + ' Generate the event handling functions for button events. + + ' event handler for ImageButton + Public Overridable Sub ReportPropertiesExportExcelButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + ' To customize the columns or the format, override this function in Section 1 of the page + ' and modify it to your liking. + ' Build the where clause based on the current filter and search criteria + ' Create the Order By clause based on the user's current sorting preference. + + Dim wc As WhereClause = CreateWhereClause + Dim orderBy As OrderBy = Nothing + + orderBy = CreateOrderBy + + Dim done As Boolean = False + Dim val As Object = "" + ' Read pageSize records at a time and write out the Excel file. + Dim totalRowsReturned As Integer = 0 + + Me.TotalRecords = ReportPropertiesTable.GetRecordCount(wc) + If Me.TotalRecords > 10000 Then + + ' Add each of the columns in order of export. + Dim columns() as BaseColumn = New BaseColumn() { _ + Nothing} + Dim exportData as ExportDataToCSV = New ExportDataToCSV(ReportPropertiesTable.Instance, wc, orderBy, columns) + exportData.StartExport(Me.Page.Response, True) + + Dim dataForCSV As DataForExport = New DataForExport(ReportPropertiesTable.Instance, wc, orderBy, columns) + + ' Read pageSize records at a time and write out the CSV file. + While (Not done) + Dim recList As ArrayList = dataForCSV.GetRows(exportData.pageSize) + If recList Is Nothing Then + Exit While 'no more records we are done + End If + + totalRowsReturned = recList.Count + For Each rec As BaseRecord In recList + For Each col As BaseColumn In dataForCSV.ColumnList + If col Is Nothing Then + Continue For + End If + + If Not dataForCSV.IncludeInExport(col) Then + Continue For + End If + + val = rec.GetValue(col).ToString() + exportData.WriteColumnData(val, dataForCSV.IsString(col)) + + Next col + exportData.WriteNewRow() + Next rec + + ' If we already are below the pageSize, then we are done. + If totalRowsReturned < exportData.pageSize Then + done = True + End If + End While + exportData.FinishExport(Me.Page.Response) + Else + + ' Create an instance of the Excel report class with the table class, where clause and order by. + Dim excelReport As ExportDataToExcel = New ExportDataToExcel(ReportPropertiesTable.Instance, wc, orderBy) + ' Add each of the columns in order of export. + ' To customize the data type, change the second parameter of the new ExcelColumn to be + ' a format string from Excel's Format Cell menu. For example "dddd, mmmm dd, yyyy h:mm AM/PM;@", "#,##0.00" + + If Me.Page.Response Is Nothing Then + Return + End If + + excelReport.CreateExcelBook() + + Dim width As Integer = 0 + Dim columnCounter As Integer = 0 + Dim data As DataForExport = New DataForExport(ReportPropertiesTable.Instance, wc, orderBy, Nothing) + + + For Each col As ExcelColumn In data.ColumnList + width = excelReport.GetExcelCellWidth(col) + If data.IncludeInExport(col) Then + excelReport.AddColumnToExcelBook(columnCounter, col.ToString(), excelReport.GetExcelDataType(col), width, excelReport.GetDisplayFormat(col)) + columnCounter = columnCounter + 1 + End If + Next col + + While (Not done) + Dim recList As ArrayList = data.GetRows(excelReport.pageSize) + + If recList Is Nothing Then + Exit While 'no more records we are done + End If + + totalRowsReturned = recList.Count + + For Each rec As BaseRecord In recList + excelReport.AddRowToExcelBook() + columnCounter = 0 + + For Each col As ExcelColumn In data.ColumnList + If Not data.IncludeInExport(col) Then + Continue For + End If + + Dim _isExpandableNonCompositeForeignKey As Boolean = col.DisplayColumn.TableDefinition.IsExpandableNonCompositeForeignKey(col.DisplayColumn) + If _isExpandableNonCompositeForeignKey AndAlso col.DisplayColumn.IsApplyDisplayAs Then + val = ReportPropertiesTable.GetDFKA(rec.GetValue(col.DisplayColumn).ToString(), col.DisplayColumn, Nothing) + If val Is Nothing Then + val = rec.Format(col.DisplayColumn) + End If + Else + val = excelReport.GetValueForExcelExport(col, rec) + End If + excelReport.AddCellToExcelRow(columnCounter, excelReport.GetExcelDataType(col), val, col.DisplayFormat) + + columnCounter = columnCounter + 1 + Next col + Next rec + + ' If we already are below the pageSize, then we are done. + If totalRowsReturned < excelReport.pageSize Then + done = True + End If + End While + + excelReport.SaveExcelBook(Me.Page.Response) + End If + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub ReportPropertiesPDFButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + Dim report As PDFReport = New PDFReport() + report.SpecificReportFileName = Page.Server.MapPath("ShowPersonalId.ReportPropertiesPDFButton.report") + ' report.Title replaces the value tag of page header and footer containing ${ReportTitle} + report.Title = "ReportProperties" + ' If ShowPersonalId.ReportPropertiesPDFButton.report specifies a valid report template, + ' AddColumn method will generate a report template. + ' Each AddColumn method-call specifies a column + ' The 1st parameter represents the text of the column header + ' The 2nd parameter represents the horizontal alignment of the column header + ' The 3rd parameter represents the text format of the column detail + ' The 4th parameter represents the horizontal alignment of the column detail + ' The 5th parameter represents the relative width of the column + + + Dim rowsPerQuery As Integer = 5000 + Dim recordCount As Integer = 0 + + report.Page = Page.GetResourceValue("Txt:Page", "Persons") + report.ApplicationPath = Me.Page.MapPath(Page.Request.ApplicationPath) + + Dim whereClause As WhereClause = CreateWhereClause + Dim orderBy As OrderBy = CreateOrderBy + Dim joinFilter As BaseFilter = CreateCompoundJoinFilter() + + Dim pageNum As Integer = 0 + Dim totalRows As Integer = ReportPropertiesTable.GetRecordCount(joinFilter,whereClause) + Dim columns As ColumnList = ReportPropertiesTable.GetColumnList() + Dim records As ReportPropertiesRecord() = Nothing + + Do + + records = ReportPropertiesTable.GetRecords(joinFilter,whereClause, orderBy, pageNum, rowsPerQuery) + If Not (records Is Nothing) AndAlso records.Length > 0 AndAlso whereClause.RunQuery Then + For Each record As ReportPropertiesRecord In records + + ' AddData method takes four parameters + ' The 1st parameters represent the data format + ' The 2nd parameters represent the data value + ' The 3rd parameters represent the default alignment of column using the data + ' The 4th parameters represent the maximum length of the data value being shown + + report.WriteRow + Next + pageNum = pageNum + 1 + recordCount += records.Length + End If + Loop While Not (records Is Nothing) AndAlso recordCount < totalRows AndAlso whereClause.RunQuery + + report.Close + BaseClasses.Utils.NetUtils.WriteResponseBinaryAttachment(Me.Page.Response, report.Title + ".pdf", report.ReportInByteArray, 0, true) + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub ReportPropertiesWordButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + Dim report As WordReport = New WordReport + report.SpecificReportFileName = Page.Server.MapPath("ShowPersonalId.ReportPropertiesWordButton.word") + ' report.Title replaces the value tag of page header and footer containing ${ReportTitle} + report.Title = "ReportProperties" + ' If ShowPersonalId.ReportPropertiesWordButton.report specifies a valid report template, + ' AddColumn method will generate a report template. + ' Each AddColumn method-call specifies a column + ' The 1st parameter represents the text of the column header + ' The 2nd parameter represents the horizontal alignment of the column header + ' The 3rd parameter represents the text format of the column detail + ' The 4th parameter represents the horizontal alignment of the column detail + ' The 5th parameter represents the relative width of the column + + Dim whereClause As WhereClause = CreateWhereClause + + Dim orderBy As OrderBy = CreateOrderBy + Dim joinFilter As BaseFilter = CreateCompoundJoinFilter() + + Dim rowsPerQuery As Integer = 5000 + Dim pageNum As Integer = 0 + Dim recordCount As Integer = 0 + Dim totalRows As Integer = ReportPropertiesTable.GetRecordCount(joinFilter,whereClause) + + report.Page = Page.GetResourceValue("Txt:Page", "Persons") + report.ApplicationPath = Me.Page.MapPath(Page.Request.ApplicationPath) + + Dim columns As ColumnList = ReportPropertiesTable.GetColumnList() + Dim records As ReportPropertiesRecord() = Nothing + Do + records = ReportPropertiesTable.GetRecords(joinFilter,whereClause, orderBy, pageNum, rowsPerQuery) + + If Not (records Is Nothing) AndAlso records.Length > 0 AndAlso whereClause.RunQuery Then + For Each record As ReportPropertiesRecord In records + ' AddData method takes four parameters + ' The 1st parameters represent the data format + ' The 2nd parameters represent the data value + ' The 3rd parameters represent the default alignment of column using the data + ' The 4th parameters represent the maximum length of the data value being shown + + report.WriteRow + Next + pageNum = pageNum + 1 + recordCount += records.Length + End If + Loop While Not (records Is Nothing) AndAlso recordCount < totalRows AndAlso whereClause.RunQuery + report.save + BaseClasses.Utils.NetUtils.WriteResponseBinaryAttachment(Me.Page.Response, report.Title + ".doc", report.ReportInByteArray, 0, true) + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + + + ' Generate the event handling functions for filter and search events. + + + ' Generate the event handling functions for others + + + Private _UIData As New System.Collections.Generic.List(Of Hashtable) + Public Property UIData() As System.Collections.Generic.List(Of Hashtable) + Get + Return Me._UIData + End Get + Set(ByVal value As System.Collections.Generic.List(Of Hashtable)) + Me._UIData = value + End Set + End Property + + ' pagination properties + Protected _PageSize As Integer + Public Property PageSize() As Integer + Get + Return Me._PageSize + End Get + Set(ByVal value As Integer) + Me._PageSize = value + End Set + End Property + + Protected _PageIndex As Integer + Public Property PageIndex() As Integer + Get + ' Return the PageIndex + Return Me._PageIndex + End Get + Set(ByVal value As Integer) + Me._PageIndex = value + End Set + End Property + + Protected _TotalRecords As Integer = -1 + Public Property TotalRecords() As Integer + Get + If _TotalRecords < 0 + _TotalRecords = ReportPropertiesTable.GetRecordCount(CreateCompoundJoinFilter(), CreateWhereClause()) + End If + Return Me._TotalRecords + End Get + Set(ByVal value As Integer) + If Me.PageSize > 0 Then + + Me.TotalPages = CInt(Math.Ceiling(value / Me.PageSize)) + + End If + Me._TotalRecords = value + End Set + End Property + + + + Protected _TotalPages As Integer = -1 + Public Property TotalPages() As Integer + Get + If _TotalPages < 0 Then + + Me.TotalPages = CInt(Math.Ceiling(TotalRecords / Me.PageSize)) + + End If + Return Me._TotalPages + End Get + Set(ByVal value As Integer) + Me._TotalPages = value + End Set + End Property + + Protected _DisplayLastPage As Boolean + Public Property DisplayLastPage() As Boolean + Get + Return Me._DisplayLastPage + End Get + Set(ByVal value As Boolean) + Me._DisplayLastPage = value + End Set + End Property + + Private _DataChanged As Boolean = False + Public Property DataChanged() As Boolean + Get + Return Me._DataChanged + End Get + Set(ByVal value As Boolean) + Me._DataChanged = value + End Set + End Property + + Private _ResetData As Boolean = False + Public Property ResetData() As Boolean + Get + Return Me._ResetData + End Get + Set(ByVal value As Boolean) + Me._ResetData = value + End Set + End Property + + Private _AddNewRecord As Integer = 0 + Public Property AddNewRecord() As Integer + Get + Return Me._AddNewRecord + End Get + Set(ByVal value As Integer) + Me._AddNewRecord = value + End Set + End Property + + + Private _CurrentSortOrder As OrderBy = Nothing + Public Property CurrentSortOrder() As OrderBy + Get + Return Me._CurrentSortOrder + End Get + Set(ByVal value As BaseClasses.Data.OrderBy) + Me._CurrentSortOrder = value + End Set + End Property + + Private _DataSource() As ReportPropertiesRecord = Nothing + Public Property DataSource() As ReportPropertiesRecord () + Get + Return Me._DataSource + End Get + Set(ByVal value() As ReportPropertiesRecord) + Me._DataSource = value + End Set + End Property + +#Region "Helper Properties" + + Public ReadOnly Property ReportPropertiesExportExcelButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "ReportPropertiesExportExcelButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property ReportPropertiesPDFButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "ReportPropertiesPDFButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property ReportPropertiesTableControlCollapsibleRegion() As System.Web.UI.WebControls.Panel + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "ReportPropertiesTableControlCollapsibleRegion"), System.Web.UI.WebControls.Panel) + End Get + End Property + + Public ReadOnly Property ReportPropertiesWordButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "ReportPropertiesWordButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + +#End Region + +#Region "Helper Functions" + + Public Overrides Overloads Function ModifyRedirectUrl(url As String, arg As String, ByVal bEncrypt As Boolean) As String + Return Me.Page.EvaluateExpressions(url, arg, bEncrypt, Me) + End Function + + Public Overrides Overloads Function EvaluateExpressions(url As String, arg As String, ByVal bEncrypt As Boolean) As String + Dim needToProcess As Boolean = AreAnyUrlParametersForMe(url, arg) + If (needToProcess) Then + Dim recCtl As ReportPropertiesTableControlRow = Me.GetSelectedRecordControl() + If recCtl Is Nothing AndAlso url.IndexOf("{") >= 0 Then + ' Localization. + Throw New Exception(Page.GetResourceValue("Err:NoRecSelected", "Persons")) + End If + Dim rec As ReportPropertiesRecord = Nothing + If recCtl IsNot Nothing Then + rec = recCtl.GetRecord() + End If + Return EvaluateExpressions(url, arg, rec, bEncrypt) + End If + Return url + End Function + + Public Overridable Function GetSelectedRecordControl() As ReportPropertiesTableControlRow + Return Nothing + + End Function + + Public Overridable Function GetSelectedRecordControls() As ReportPropertiesTableControlRow() + + Return DirectCast((new ArrayList()).ToArray(GetType(ReportPropertiesTableControlRow)), ReportPropertiesTableControlRow()) + + End Function + + Public Overridable Sub DeleteSelectedRecords(ByVal deferDeletion As Boolean) + Dim recList() As ReportPropertiesTableControlRow = Me.GetSelectedRecordControls() + If recList.Length = 0 Then + ' Localization. + Throw New Exception(Page.GetResourceValue("Err:NoRecSelected", "Persons")) + End If + + Dim recCtl As ReportPropertiesTableControlRow + For Each recCtl In recList + If deferDeletion Then + If Not recCtl.IsNewRecord Then + + Me.AddToDeletedRecordIds(recCtl) + + End If + recCtl.Visible = False + + Else + + recCtl.Delete() + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + End If + Next + End Sub + + Public Function GetRecordControls() As ReportPropertiesTableControlRow() + Dim recList As ArrayList = New ArrayList() + Dim rep As System.Web.UI.WebControls.Repeater = CType(Me.FindControl("ReportPropertiesTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return Nothing + Dim repItem As System.Web.UI.WebControls.RepeaterItem + + For Each repItem In rep.Items + + Dim recControl As ReportPropertiesTableControlRow = DirectCast(repItem.FindControl("ReportPropertiesTableControlRow"), ReportPropertiesTableControlRow) + recList.Add(recControl) + + Next + + Return DirectCast(recList.ToArray(GetType(ReportPropertiesTableControlRow)), ReportPropertiesTableControlRow()) + End Function + + Public Shadows ReadOnly Property Page() As BaseApplicationPage + Get + Return DirectCast(MyBase.Page, BaseApplicationPage) + End Get + End Property + +#End Region + + + +End Class + + +' Base class for the PersonalIdRecordControl control on the ShowPersonalId page. +' Do not modify this class. Instead override any method in PersonalIdRecordControl. +Public Class BasePersonalIdRecordControl + Inherits Persons.UI.BaseApplicationRecordControl + + ' To customize, override this method in PersonalIdRecordControl. + Protected Overridable Sub Control_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Init + + ' Setup the filter and search events. + + Me.ClearControlsFromSession() + End Sub + + ' To customize, override this method in PersonalIdRecordControl. + Protected Overridable Sub Control_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load + + ' Setup the pagination events. + + + ' Register the event handlers. + + AddHandler Me.PersonalIdDialogEditButton.Click, AddressOf PersonalIdDialogEditButton_Click + + + End Sub + + + Public Overridable Sub LoadData() + + ' Load the data from the database into the DataSource PersonalId record. + ' It is better to make changes to functions called by LoadData such as + ' CreateWhereClause, rather than making changes here. + + ' 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 = PersonalIdTable.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, "PersonalIdRecordControlPanel"), System.Web.UI.WebControls.Panel) + If Not Panel is Nothing Then + Panel.visible = True + End If + + ' If there is no Where clause, then simply create a new, blank record. + + If wc Is Nothing OrElse Not wc.RunQuery Then + Me.DataSource = New PersonalIdRecord() + + If Not Panel is Nothing Then + Panel.visible = False + End If + + Return + End If + + ' Retrieve the record from the database. It is possible + + Dim recList() As PersonalIdRecord = PersonalIdTable.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 = PersonalIdTable.GetRecord(recList(0).GetID.ToXmlString(), True) + + + + End Sub + + ' Populate the UI controls using the DataSource. To customize, override this method in PersonalIdRecordControl. + Public Overrides Sub DataBind() + ' The DataBind method binds the user interface controls to the values + ' from the database record. To do this, it calls the Set methods for + ' each of the field displayed on the webpage. It is better to make + ' changes in the Set methods, rather than making changes here. + + MyBase.DataBind() + + ' Make sure that the DataSource is initialized. + If Me.DataSource Is Nothing Then + + Return + End If + + + 'LoadData for DataSource for chart and report if they exist + + + + ' Call the Set methods for each controls on the panel + + SetAddr() + SetAddrLabel() + SetAmphur() + SetAmphurLabel() + SetArmId() + SetArmIdLabel() + SetArmyId() + SetArmyIdLabel() + SetArmyWelfareMemId() + SetArmyWelfareMemIdLabel() + SetBAmphur() + SetBAmphurLabel() + SetBirthDate() + SetBirthDateLabel() + SetBloodId() + SetBloodIdLabel() + SetBorn() + SetBornLabel() + SetBProvince() + SetBProvinceLabel() + SetCommission() + SetCommissionLabel() + SetCremateMemId() + SetCremateMemIdLabel() + SetDeptId() + SetDeptIdLabel() + SetMId() + SetMIdLabel() + SetMobilePhone() + SetMobilePhoneLabel() + SetNationality() + SetNationalityLabel() + SetOfficerDate() + SetOfficerDateLabel() + SetOrigin() + SetOriginLabel() + SetPersonalId() + + SetPersonalIdLabel() + SetPersonalIdRecordControlCollapsibleRegion() + SetPersonalIdRecordControlIcon() + SetPersonalIdRecordControlPanelExtender() + + SetPersonalLastName() + SetPersonalLastNameLabel() + SetPersonalName() + SetPersonalNameLabel() + SetPhone() + SetPhoneExt() + SetPhoneExtLabel() + SetPhoneLabel() + Setpicture() + SetpictureLabel() + SetPlaceOfBirth() + SetPlaceOfBirthLabel() + SetPostCode() + SetPostCodeLabel() + SetProvince() + SetProvinceLabel() + SetRankId() + SetRankIdLabel() + SetRegDate() + SetRegDateLabel() + SetRegNo1() + SetRegNo1Label() + SetRegNo2() + SetRegNo2Label() + SetReligion() + SetReligionLabel() + SetSectionId() + SetSectionIdLabel() + SetSex() + SetSexLabel() + SetStatusId() + SetStatusIdLabel() + SetTId() + SetTIdLabel() + + + 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 + + Dim recPersonalDDTableControl as PersonalDDTableControl = DirectCast(MiscUtils.FindControlRecursively(Me.Page, "PersonalDDTableControl"), PersonalDDTableControl) + + If (shouldResetControl OrElse Me.Page.IsPageRefresh) + recPersonalDDTableControl.ResetControl() + End IF + + recPersonalDDTableControl.LoadData() + recPersonalDDTableControl.DataBind() + + Dim recPersonalEducationTableControl as PersonalEducationTableControl = DirectCast(MiscUtils.FindControlRecursively(Me.Page, "PersonalEducationTableControl"), PersonalEducationTableControl) + + If (shouldResetControl OrElse Me.Page.IsPageRefresh) + recPersonalEducationTableControl.ResetControl() + End IF + + recPersonalEducationTableControl.LoadData() + recPersonalEducationTableControl.DataBind() + + Dim recPersonalExtWorkTableControl as PersonalExtWorkTableControl = DirectCast(MiscUtils.FindControlRecursively(Me.Page, "PersonalExtWorkTableControl"), PersonalExtWorkTableControl) + + If (shouldResetControl OrElse Me.Page.IsPageRefresh) + recPersonalExtWorkTableControl.ResetControl() + End IF + + recPersonalExtWorkTableControl.LoadData() + recPersonalExtWorkTableControl.DataBind() + + Dim recPersonalInsigniaTableControl as PersonalInsigniaTableControl = DirectCast(MiscUtils.FindControlRecursively(Me.Page, "PersonalInsigniaTableControl"), PersonalInsigniaTableControl) + + If (shouldResetControl OrElse Me.Page.IsPageRefresh) + recPersonalInsigniaTableControl.ResetControl() + End IF + + recPersonalInsigniaTableControl.LoadData() + recPersonalInsigniaTableControl.DataBind() + + Dim recPersonalLanguageSkillTableControl as PersonalLanguageSkillTableControl = DirectCast(MiscUtils.FindControlRecursively(Me.Page, "PersonalLanguageSkillTableControl"), PersonalLanguageSkillTableControl) + + If (shouldResetControl OrElse Me.Page.IsPageRefresh) + recPersonalLanguageSkillTableControl.ResetControl() + End IF + + recPersonalLanguageSkillTableControl.LoadData() + recPersonalLanguageSkillTableControl.DataBind() + + Dim recPersonalNameTableControl as PersonalNameTableControl = DirectCast(MiscUtils.FindControlRecursively(Me.Page, "PersonalNameTableControl"), PersonalNameTableControl) + + If (shouldResetControl OrElse Me.Page.IsPageRefresh) + recPersonalNameTableControl.ResetControl() + End IF + + recPersonalNameTableControl.LoadData() + recPersonalNameTableControl.DataBind() + + Dim recPersonalRankTableControl as PersonalRankTableControl = DirectCast(MiscUtils.FindControlRecursively(Me.Page, "PersonalRankTableControl"), PersonalRankTableControl) + + If (shouldResetControl OrElse Me.Page.IsPageRefresh) + recPersonalRankTableControl.ResetControl() + End IF + + recPersonalRankTableControl.LoadData() + recPersonalRankTableControl.DataBind() + + Dim recPersonalSalaryTableControl as PersonalSalaryTableControl = DirectCast(MiscUtils.FindControlRecursively(Me.Page, "PersonalSalaryTableControl"), PersonalSalaryTableControl) + + If (shouldResetControl OrElse Me.Page.IsPageRefresh) + recPersonalSalaryTableControl.ResetControl() + End IF + + recPersonalSalaryTableControl.LoadData() + recPersonalSalaryTableControl.DataBind() + + Dim recPersonalSpecialSkillTableControl as PersonalSpecialSkillTableControl = DirectCast(MiscUtils.FindControlRecursively(Me.Page, "PersonalSpecialSkillTableControl"), PersonalSpecialSkillTableControl) + + If (shouldResetControl OrElse Me.Page.IsPageRefresh) + recPersonalSpecialSkillTableControl.ResetControl() + End IF + + recPersonalSpecialSkillTableControl.LoadData() + recPersonalSpecialSkillTableControl.DataBind() + + Dim recPersonalSportSkillTableControl as PersonalSportSkillTableControl = DirectCast(MiscUtils.FindControlRecursively(Me.Page, "PersonalSportSkillTableControl"), PersonalSportSkillTableControl) + + If (shouldResetControl OrElse Me.Page.IsPageRefresh) + recPersonalSportSkillTableControl.ResetControl() + End IF + + recPersonalSportSkillTableControl.LoadData() + recPersonalSportSkillTableControl.DataBind() + + Dim recPersonalTitleTableControl as PersonalTitleTableControl = DirectCast(MiscUtils.FindControlRecursively(Me.Page, "PersonalTitleTableControl"), PersonalTitleTableControl) + + If (shouldResetControl OrElse Me.Page.IsPageRefresh) + recPersonalTitleTableControl.ResetControl() + End IF + + recPersonalTitleTableControl.LoadData() + recPersonalTitleTableControl.DataBind() + + Dim recPersonRelativeTableControl as PersonRelativeTableControl = DirectCast(MiscUtils.FindControlRecursively(Me.Page, "PersonRelativeTableControl"), PersonRelativeTableControl) + + If (shouldResetControl OrElse Me.Page.IsPageRefresh) + recPersonRelativeTableControl.ResetControl() + End IF + + recPersonRelativeTableControl.LoadData() + recPersonRelativeTableControl.DataBind() + + End Sub + + + Public Overridable Sub SetAddr() + + + ' Set the Addr Literal on the webpage with value from the + ' PersonalId database record. + + ' Me.DataSource is the PersonalId record retrieved from the database. + ' Me.Addr is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetAddr() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.AddrSpecified Then + + ' If the Addr is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalIdTable.Addr) + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + If Not formattedValue is Nothing Then + Dim popupThreshold as Integer = CType(100, Integer) + + Dim maxLength as Integer = Len(formattedValue) + If (maxLength > CType(100, Integer)) Then + ' Truncate based on FieldMaxLength on Properties. + maxLength = CType(100, Integer) + + End If + + ' For fields values larger than the PopupTheshold on Properties, display a popup. + If Len(formattedValue) >= popupThreshold Then + + Dim name As String = HttpUtility.HtmlEncode(PersonalIdTable.Addr.Name) + + If Not HttpUtility.HtmlEncode("%ISD_DEFAULT%").Equals("%ISD_DEFAULT%") Then + name = HttpUtility.HtmlEncode(Me.Page.GetResourceValue("%ISD_DEFAULT%")) + End If + + + + formattedValue= "" & NetUtils.EncodeStringForHtmlDisplay(formattedValue.Substring(0, maxLength)) + + If (maxLength = CType(100, Integer)) Then + formattedValue = formattedValue & "..." & "" + Else + formattedValue = formattedValue & "" + + End If + Else + If maxLength = CType(100, Integer) Then + formattedValue= NetUtils.EncodeStringForHtmlDisplay(formattedValue.SubString(0,MaxLength)) + formattedValue = formattedValue & "..." + + End If + End If + End If + + Me.Addr.Text = formattedValue + + Else + + ' Addr is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.Addr.Text = PersonalIdTable.Addr.Format(PersonalIdTable.Addr.DefaultValue) + + End If + + ' If the Addr is NULL or blank, then use the value specified + ' on Properties. + If Me.Addr.Text Is Nothing _ + OrElse Me.Addr.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.Addr.Text = " " + End If + + End Sub + + Public Overridable Sub SetAmphur() + + + ' Set the Amphur Literal on the webpage with value from the + ' PersonalId database record. + + ' Me.DataSource is the PersonalId record retrieved from the database. + ' Me.Amphur is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetAmphur() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.AmphurSpecified Then + + ' If the Amphur is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalIdTable.Amphur) + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.Amphur.Text = formattedValue + + Else + + ' Amphur is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.Amphur.Text = PersonalIdTable.Amphur.Format(PersonalIdTable.Amphur.DefaultValue) + + End If + + ' If the Amphur is NULL or blank, then use the value specified + ' on Properties. + If Me.Amphur.Text Is Nothing _ + OrElse Me.Amphur.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.Amphur.Text = " " + End If + + End Sub + + Public Overridable Sub SetArmId() + + + ' Set the ArmId Literal on the webpage with value from the + ' PersonalId database record. + + ' Me.DataSource is the PersonalId record retrieved from the database. + ' Me.ArmId is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetArmId() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.ArmIdSpecified Then + + ' If the ArmId is non-NULL, then format the value. + + ' The Format method will return the Display Foreign Key As (DFKA) value + Dim formattedValue As String = "" + Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalIdTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalIdTable.ArmId) + If _isExpandableNonCompositeForeignKey AndAlso PersonalIdTable.ArmId.IsApplyDisplayAs Then + + formattedValue = PersonalIdTable.GetDFKA(Me.DataSource.ArmId.ToString(),PersonalIdTable.ArmId, Nothing) + + if (formattedValue Is Nothing) Then + formattedValue = Me.DataSource.Format(PersonalIdTable.ArmId) + End If + Else + formattedValue = Me.DataSource.ArmId.ToString() + End If + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.ArmId.Text = formattedValue + + Else + + ' ArmId is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.ArmId.Text = PersonalIdTable.ArmId.Format(PersonalIdTable.ArmId.DefaultValue) + + End If + + ' If the ArmId is NULL or blank, then use the value specified + ' on Properties. + If Me.ArmId.Text Is Nothing _ + OrElse Me.ArmId.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.ArmId.Text = " " + End If + + End Sub + + Public Overridable Sub SetArmyId() + + + ' Set the ArmyId Literal on the webpage with value from the + ' PersonalId database record. + + ' Me.DataSource is the PersonalId record retrieved from the database. + ' Me.ArmyId is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetArmyId() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.ArmyIdSpecified Then + + ' If the ArmyId is non-NULL, then format the value. + + ' The Format method will return the Display Foreign Key As (DFKA) value + Dim formattedValue As String = "" + Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalIdTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalIdTable.ArmyId) + If _isExpandableNonCompositeForeignKey AndAlso PersonalIdTable.ArmyId.IsApplyDisplayAs Then + + formattedValue = PersonalIdTable.GetDFKA(Me.DataSource.ArmyId.ToString(),PersonalIdTable.ArmyId, Nothing) + + if (formattedValue Is Nothing) Then + formattedValue = Me.DataSource.Format(PersonalIdTable.ArmyId) + End If + Else + formattedValue = Me.DataSource.ArmyId.ToString() + End If + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.ArmyId.Text = formattedValue + + Else + + ' ArmyId is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.ArmyId.Text = PersonalIdTable.ArmyId.Format(PersonalIdTable.ArmyId.DefaultValue) + + End If + + ' If the ArmyId is NULL or blank, then use the value specified + ' on Properties. + If Me.ArmyId.Text Is Nothing _ + OrElse Me.ArmyId.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.ArmyId.Text = " " + End If + + End Sub + + Public Overridable Sub SetArmyWelfareMemId() + + + ' Set the ArmyWelfareMemId Literal on the webpage with value from the + ' PersonalId database record. + + ' Me.DataSource is the PersonalId record retrieved from the database. + ' Me.ArmyWelfareMemId is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetArmyWelfareMemId() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.ArmyWelfareMemIdSpecified Then + + ' If the ArmyWelfareMemId is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalIdTable.ArmyWelfareMemId) + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.ArmyWelfareMemId.Text = formattedValue + + Else + + ' ArmyWelfareMemId is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.ArmyWelfareMemId.Text = PersonalIdTable.ArmyWelfareMemId.Format(PersonalIdTable.ArmyWelfareMemId.DefaultValue) + + End If + + ' If the ArmyWelfareMemId is NULL or blank, then use the value specified + ' on Properties. + If Me.ArmyWelfareMemId.Text Is Nothing _ + OrElse Me.ArmyWelfareMemId.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.ArmyWelfareMemId.Text = " " + End If + + End Sub + + Public Overridable Sub SetBAmphur() + + + ' Set the BAmphur Literal on the webpage with value from the + ' PersonalId database record. + + ' Me.DataSource is the PersonalId record retrieved from the database. + ' Me.BAmphur is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetBAmphur() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.BAmphurSpecified Then + + ' If the BAmphur is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalIdTable.BAmphur) + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.BAmphur.Text = formattedValue + + Else + + ' BAmphur is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.BAmphur.Text = PersonalIdTable.BAmphur.Format(PersonalIdTable.BAmphur.DefaultValue) + + End If + + ' If the BAmphur is NULL or blank, then use the value specified + ' on Properties. + If Me.BAmphur.Text Is Nothing _ + OrElse Me.BAmphur.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.BAmphur.Text = " " + End If + + End Sub + + Public Overridable Sub SetBirthDate() + + + ' Set the BirthDate Literal on the webpage with value from the + ' PersonalId database record. + + ' Me.DataSource is the PersonalId record retrieved from the database. + ' Me.BirthDate is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetBirthDate() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.BirthDateSpecified Then + + ' If the BirthDate is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalIdTable.BirthDate, "d MMM yy") + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.BirthDate.Text = formattedValue + + Else + + ' BirthDate is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.BirthDate.Text = PersonalIdTable.BirthDate.Format(PersonalIdTable.BirthDate.DefaultValue, "d MMM yy") + + End If + + ' If the BirthDate is NULL or blank, then use the value specified + ' on Properties. + If Me.BirthDate.Text Is Nothing _ + OrElse Me.BirthDate.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.BirthDate.Text = " " + End If + + End Sub + + Public Overridable Sub SetBloodId() + + + ' Set the BloodId Literal on the webpage with value from the + ' PersonalId database record. + + ' Me.DataSource is the PersonalId record retrieved from the database. + ' Me.BloodId is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetBloodId() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.BloodIdSpecified Then + + ' If the BloodId is non-NULL, then format the value. + + ' The Format method will return the Display Foreign Key As (DFKA) value + Dim formattedValue As String = "" + Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalIdTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalIdTable.BloodId) + If _isExpandableNonCompositeForeignKey AndAlso PersonalIdTable.BloodId.IsApplyDisplayAs Then + + formattedValue = PersonalIdTable.GetDFKA(Me.DataSource.BloodId.ToString(),PersonalIdTable.BloodId, Nothing) + + if (formattedValue Is Nothing) Then + formattedValue = Me.DataSource.Format(PersonalIdTable.BloodId) + End If + Else + formattedValue = Me.DataSource.BloodId.ToString() + End If + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.BloodId.Text = formattedValue + + Else + + ' BloodId is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.BloodId.Text = PersonalIdTable.BloodId.Format(PersonalIdTable.BloodId.DefaultValue) + + End If + + ' If the BloodId is NULL or blank, then use the value specified + ' on Properties. + If Me.BloodId.Text Is Nothing _ + OrElse Me.BloodId.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.BloodId.Text = " " + End If + + End Sub + + Public Overridable Sub SetBorn() + + + ' Set the Born Literal on the webpage with value from the + ' PersonalId database record. + + ' Me.DataSource is the PersonalId record retrieved from the database. + ' Me.Born is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetBorn() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.BornSpecified Then + + ' If the Born is non-NULL, then format the value. + + ' The Format method will return the Display Foreign Key As (DFKA) value + Dim formattedValue As String = "" + Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalIdTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalIdTable.Born) + If _isExpandableNonCompositeForeignKey AndAlso PersonalIdTable.Born.IsApplyDisplayAs Then + + formattedValue = PersonalIdTable.GetDFKA(Me.DataSource.Born.ToString(),PersonalIdTable.Born, Nothing) + + if (formattedValue Is Nothing) Then + formattedValue = Me.DataSource.Format(PersonalIdTable.Born) + End If + Else + formattedValue = Me.DataSource.Born.ToString() + End If + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.Born.Text = formattedValue + + Else + + ' Born is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.Born.Text = PersonalIdTable.Born.Format(PersonalIdTable.Born.DefaultValue) + + End If + + ' If the Born is NULL or blank, then use the value specified + ' on Properties. + If Me.Born.Text Is Nothing _ + OrElse Me.Born.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.Born.Text = " " + End If + + End Sub + + Public Overridable Sub SetBProvince() + + + ' Set the BProvince Literal on the webpage with value from the + ' PersonalId database record. + + ' Me.DataSource is the PersonalId record retrieved from the database. + ' Me.BProvince is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetBProvince() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.BProvinceSpecified Then + + ' If the BProvince is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalIdTable.BProvince) + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.BProvince.Text = formattedValue + + Else + + ' BProvince is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.BProvince.Text = PersonalIdTable.BProvince.Format(PersonalIdTable.BProvince.DefaultValue) + + End If + + ' If the BProvince is NULL or blank, then use the value specified + ' on Properties. + If Me.BProvince.Text Is Nothing _ + OrElse Me.BProvince.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.BProvince.Text = " " + End If + + End Sub + + Public Overridable Sub SetCommission() + + + ' Set the Commission Literal on the webpage with value from the + ' PersonalId database record. + + ' Me.DataSource is the PersonalId record retrieved from the database. + ' Me.Commission is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetCommission() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.CommissionSpecified Then + + ' If the Commission is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalIdTable.Commission) + + If Not formattedValue is Nothing Then + Dim popupThreshold as Integer = CType(100, Integer) + + Dim maxLength as Integer = Len(formattedValue) + If (maxLength > CType(100, Integer)) Then + ' Truncate based on FieldMaxLength on Properties. + maxLength = CType(100, Integer) + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + + End If + + ' For fields values larger than the PopupTheshold on Properties, display a popup. + If Len(formattedValue) >= popupThreshold Then + + Dim name As String = HttpUtility.HtmlEncode(PersonalIdTable.Commission.Name) + + If Not HttpUtility.HtmlEncode("%ISD_DEFAULT%").Equals("%ISD_DEFAULT%") Then + name = HttpUtility.HtmlEncode(Me.Page.GetResourceValue("%ISD_DEFAULT%")) + End If + + + + formattedValue= "" & NetUtils.EncodeStringForHtmlDisplay(formattedValue.Substring(0, maxLength)) + + If (maxLength = CType(100, Integer)) Then + formattedValue = formattedValue & "..." & "" + Else + formattedValue = formattedValue & "" + + formattedValue = "
" & formattedValue & "
" + End If + Else + If maxLength = CType(100, Integer) Then + formattedValue= NetUtils.EncodeStringForHtmlDisplay(formattedValue.SubString(0,MaxLength)) + formattedValue = formattedValue & "..." + + Else + + formattedValue = "
" & formattedValue & "
" + End If + End If + End If + + Me.Commission.Text = formattedValue + + Else + + ' Commission is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.Commission.Text = PersonalIdTable.Commission.Format(PersonalIdTable.Commission.DefaultValue) + + End If + + ' If the Commission is NULL or blank, then use the value specified + ' on Properties. + If Me.Commission.Text Is Nothing _ + OrElse Me.Commission.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.Commission.Text = " " + End If + + End Sub + + Public Overridable Sub SetCremateMemId() + + + ' Set the CremateMemId Literal on the webpage with value from the + ' PersonalId database record. + + ' Me.DataSource is the PersonalId record retrieved from the database. + ' Me.CremateMemId is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetCremateMemId() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.CremateMemIdSpecified Then + + ' If the CremateMemId is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalIdTable.CremateMemId) + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.CremateMemId.Text = formattedValue + + Else + + ' CremateMemId is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.CremateMemId.Text = PersonalIdTable.CremateMemId.Format(PersonalIdTable.CremateMemId.DefaultValue) + + End If + + ' If the CremateMemId is NULL or blank, then use the value specified + ' on Properties. + If Me.CremateMemId.Text Is Nothing _ + OrElse Me.CremateMemId.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.CremateMemId.Text = " " + End If + + End Sub + + Public Overridable Sub SetDeptId() + + + ' Set the DeptId Literal on the webpage with value from the + ' PersonalId database record. + + ' Me.DataSource is the PersonalId record retrieved from the database. + ' Me.DeptId is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetDeptId() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.DeptIdSpecified Then + + ' If the DeptId is non-NULL, then format the value. + + ' The Format method will return the Display Foreign Key As (DFKA) value + Dim formattedValue As String = "" + Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalIdTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalIdTable.DeptId) + If _isExpandableNonCompositeForeignKey AndAlso PersonalIdTable.DeptId.IsApplyDisplayAs Then + + formattedValue = PersonalIdTable.GetDFKA(Me.DataSource.DeptId.ToString(),PersonalIdTable.DeptId, Nothing) + + if (formattedValue Is Nothing) Then + formattedValue = Me.DataSource.Format(PersonalIdTable.DeptId) + End If + Else + formattedValue = Me.DataSource.DeptId.ToString() + End If + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.DeptId.Text = formattedValue + + Else + + ' DeptId is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.DeptId.Text = PersonalIdTable.DeptId.Format(PersonalIdTable.DeptId.DefaultValue) + + End If + + ' If the DeptId is NULL or blank, then use the value specified + ' on Properties. + If Me.DeptId.Text Is Nothing _ + OrElse Me.DeptId.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.DeptId.Text = " " + End If + + End Sub + + Public Overridable Sub SetMId() + + + ' Set the MId Literal on the webpage with value from the + ' PersonalId database record. + + ' Me.DataSource is the PersonalId record retrieved from the database. + ' Me.MId is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetMId() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.MIdSpecified Then + + ' If the MId is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalIdTable.MId) + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.MId.Text = formattedValue + + Else + + ' MId is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.MId.Text = PersonalIdTable.MId.Format(PersonalIdTable.MId.DefaultValue) + + End If + + ' If the MId is NULL or blank, then use the value specified + ' on Properties. + If Me.MId.Text Is Nothing _ + OrElse Me.MId.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.MId.Text = " " + End If + + End Sub + + Public Overridable Sub SetMobilePhone() + + + ' Set the MobilePhone Literal on the webpage with value from the + ' PersonalId database record. + + ' Me.DataSource is the PersonalId record retrieved from the database. + ' Me.MobilePhone is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetMobilePhone() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.MobilePhoneSpecified Then + + ' If the MobilePhone is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalIdTable.MobilePhone) + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.MobilePhone.Text = formattedValue + + Else + + ' MobilePhone is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.MobilePhone.Text = PersonalIdTable.MobilePhone.Format(PersonalIdTable.MobilePhone.DefaultValue) + + End If + + ' If the MobilePhone is NULL or blank, then use the value specified + ' on Properties. + If Me.MobilePhone.Text Is Nothing _ + OrElse Me.MobilePhone.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.MobilePhone.Text = " " + End If + + End Sub + + Public Overridable Sub SetNationality() + + + ' Set the Nationality Literal on the webpage with value from the + ' PersonalId database record. + + ' Me.DataSource is the PersonalId record retrieved from the database. + ' Me.Nationality is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetNationality() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.NationalitySpecified Then + + ' If the Nationality is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalIdTable.Nationality) + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.Nationality.Text = formattedValue + + Else + + ' Nationality is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.Nationality.Text = PersonalIdTable.Nationality.Format(PersonalIdTable.Nationality.DefaultValue) + + End If + + ' If the Nationality is NULL or blank, then use the value specified + ' on Properties. + If Me.Nationality.Text Is Nothing _ + OrElse Me.Nationality.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.Nationality.Text = " " + End If + + End Sub + + Public Overridable Sub SetOfficerDate() + + + ' Set the OfficerDate Literal on the webpage with value from the + ' PersonalId database record. + + ' Me.DataSource is the PersonalId record retrieved from the database. + ' Me.OfficerDate is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetOfficerDate() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.OfficerDateSpecified Then + + ' If the OfficerDate is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalIdTable.OfficerDate, "d MMM yy") + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.OfficerDate.Text = formattedValue + + Else + + ' OfficerDate is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.OfficerDate.Text = PersonalIdTable.OfficerDate.Format(PersonalIdTable.OfficerDate.DefaultValue, "d MMM yy") + + End If + + ' If the OfficerDate is NULL or blank, then use the value specified + ' on Properties. + If Me.OfficerDate.Text Is Nothing _ + OrElse Me.OfficerDate.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.OfficerDate.Text = " " + End If + + End Sub + + Public Overridable Sub SetOrigin() + + + ' Set the Origin Literal on the webpage with value from the + ' PersonalId database record. + + ' Me.DataSource is the PersonalId record retrieved from the database. + ' Me.Origin is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetOrigin() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.OriginSpecified Then + + ' If the Origin is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalIdTable.Origin) + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.Origin.Text = formattedValue + + Else + + ' Origin is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.Origin.Text = PersonalIdTable.Origin.Format(PersonalIdTable.Origin.DefaultValue) + + End If + + ' If the Origin is NULL or blank, then use the value specified + ' on Properties. + If Me.Origin.Text Is Nothing _ + OrElse Me.Origin.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.Origin.Text = " " + End If + + End Sub + + Public Overridable Sub SetPersonalId() + + + ' Set the PersonalId Literal on the webpage with value from the + ' PersonalId database record. + + ' Me.DataSource is the PersonalId record retrieved from the database. + ' Me.PersonalId is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetPersonalId() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.PersonalIdSpecified Then + + ' If the PersonalId is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalIdTable.PersonalId) + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.PersonalId.Text = formattedValue + + Else + + ' PersonalId is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.PersonalId.Text = PersonalIdTable.PersonalId.Format(PersonalIdTable.PersonalId.DefaultValue) + + End If + + ' If the PersonalId is NULL or blank, then use the value specified + ' on Properties. + If Me.PersonalId.Text Is Nothing _ + OrElse Me.PersonalId.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.PersonalId.Text = " " + End If + + End Sub + + Public Overridable Sub SetPersonalLastName() + + + ' Set the PersonalLastName Literal on the webpage with value from the + ' PersonalId database record. + + ' Me.DataSource is the PersonalId record retrieved from the database. + ' Me.PersonalLastName is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetPersonalLastName() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.PersonalLastNameSpecified Then + + ' If the PersonalLastName is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalIdTable.PersonalLastName) + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.PersonalLastName.Text = formattedValue + + Else + + ' PersonalLastName is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.PersonalLastName.Text = PersonalIdTable.PersonalLastName.Format(PersonalIdTable.PersonalLastName.DefaultValue) + + End If + + ' If the PersonalLastName is NULL or blank, then use the value specified + ' on Properties. + If Me.PersonalLastName.Text Is Nothing _ + OrElse Me.PersonalLastName.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.PersonalLastName.Text = " " + End If + + End Sub + + Public Overridable Sub SetPersonalName() + + + ' Set the PersonalName Literal on the webpage with value from the + ' PersonalId database record. + + ' Me.DataSource is the PersonalId record retrieved from the database. + ' Me.PersonalName is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetPersonalName() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.PersonalNameSpecified Then + + ' If the PersonalName is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalIdTable.PersonalName) + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.PersonalName.Text = formattedValue + + Else + + ' PersonalName is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.PersonalName.Text = PersonalIdTable.PersonalName.Format(PersonalIdTable.PersonalName.DefaultValue) + + End If + + ' If the PersonalName is NULL or blank, then use the value specified + ' on Properties. + If Me.PersonalName.Text Is Nothing _ + OrElse Me.PersonalName.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.PersonalName.Text = " " + End If + + End Sub + + Public Overridable Sub SetPhone() + + + ' Set the Phone Literal on the webpage with value from the + ' PersonalId database record. + + ' Me.DataSource is the PersonalId record retrieved from the database. + ' Me.Phone is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetPhone() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.PhoneSpecified Then + + ' If the Phone is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalIdTable.Phone) + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.Phone.Text = formattedValue + + Else + + ' Phone is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.Phone.Text = PersonalIdTable.Phone.Format(PersonalIdTable.Phone.DefaultValue) + + End If + + ' If the Phone is NULL or blank, then use the value specified + ' on Properties. + If Me.Phone.Text Is Nothing _ + OrElse Me.Phone.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.Phone.Text = " " + End If + + End Sub + + Public Overridable Sub SetPhoneExt() + + + ' Set the PhoneExt Literal on the webpage with value from the + ' PersonalId database record. + + ' Me.DataSource is the PersonalId record retrieved from the database. + ' Me.PhoneExt is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetPhoneExt() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.PhoneExtSpecified Then + + ' If the PhoneExt is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalIdTable.PhoneExt) + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.PhoneExt.Text = formattedValue + + Else + + ' PhoneExt is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.PhoneExt.Text = PersonalIdTable.PhoneExt.Format(PersonalIdTable.PhoneExt.DefaultValue) + + End If + + ' If the PhoneExt is NULL or blank, then use the value specified + ' on Properties. + If Me.PhoneExt.Text Is Nothing _ + OrElse Me.PhoneExt.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.PhoneExt.Text = " " + End If + + End Sub + + Public Overridable Sub Setpicture() + ' Set the picture Image on the webpage with value from the + ' PersonalId database record. + + ' Me.DataSource is the PersonalId record retrieved from the database. + ' Me.picture is the ASP:Image on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.Setpicture() + ' and add your own code before or after the call to the MyBase function. + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.pictureSpecified Then + + ' If the picture is non-NULL, then format the value. + ' The Format method will use the Display Format + Me.picture.Attributes.Add("onclick", "gPersist=true;") + Me.picture.Attributes.Add("onmouseout","detailRolloverPopupClose();") + + Dim name As String = HttpUtility.HtmlEncode(PersonalIdTable.picture.Name) + + If Not HttpUtility.HtmlEncode("%ISD_DEFAULT%").Equals("%ISD_DEFAULT%") Then + name = HttpUtility.HtmlEncode(Me.Page.GetResourceValue("%ISD_DEFAULT%")) + End If + + Me.picture.Attributes.Add("onmouseover","SaveMousePosition(event);delayRolloverPopup(""PageMethods.GetImage(\""" & Me.Page.Encrypt("PersonalId") _ + & "\"", \""" & Me.Page.Encrypt(HttpUtility.UrlEncode(Me.DataSource.GetID().ToString())) _ + & "\"", \""" & Me.Page.Encrypt("picture") & "\"", \""" & NetUtils.EncodeStringForHtmlDisplay(name.Substring(0, name.Length)) & "\"", false, 250," _ + & " 200, true, PopupDisplayWindowCallBackWith20);"",500);") + + ' Shrunk image size specified by ImagePercentSize on Properties. + Me.picture.ImageUrl = Me.DataSource.FormatImageUrl(PersonalIdTable.picture, Me.Page.Encrypt("PersonalId"), Me.Page.Encrypt("picture"), Me.Page.Encrypt(Me.DataSource.GetID().ToXmlString()), 20) + + Me.picture.Visible = True + Else + ' picture is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + Me.picture.Visible = False + End If + End Sub + + Public Overridable Sub SetPlaceOfBirth() + + + ' Set the PlaceOfBirth Literal on the webpage with value from the + ' PersonalId database record. + + ' Me.DataSource is the PersonalId record retrieved from the database. + ' Me.PlaceOfBirth is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetPlaceOfBirth() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.PlaceOfBirthSpecified Then + + ' If the PlaceOfBirth is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalIdTable.PlaceOfBirth) + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + If Not formattedValue is Nothing Then + Dim popupThreshold as Integer = CType(100, Integer) + + Dim maxLength as Integer = Len(formattedValue) + If (maxLength > CType(100, Integer)) Then + ' Truncate based on FieldMaxLength on Properties. + maxLength = CType(100, Integer) + + End If + + ' For fields values larger than the PopupTheshold on Properties, display a popup. + If Len(formattedValue) >= popupThreshold Then + + Dim name As String = HttpUtility.HtmlEncode(PersonalIdTable.PlaceOfBirth.Name) + + If Not HttpUtility.HtmlEncode("%ISD_DEFAULT%").Equals("%ISD_DEFAULT%") Then + name = HttpUtility.HtmlEncode(Me.Page.GetResourceValue("%ISD_DEFAULT%")) + End If + + + + formattedValue= "" & NetUtils.EncodeStringForHtmlDisplay(formattedValue.Substring(0, maxLength)) + + If (maxLength = CType(100, Integer)) Then + formattedValue = formattedValue & "..." & "" + Else + formattedValue = formattedValue & "" + + End If + Else + If maxLength = CType(100, Integer) Then + formattedValue= NetUtils.EncodeStringForHtmlDisplay(formattedValue.SubString(0,MaxLength)) + formattedValue = formattedValue & "..." + + End If + End If + End If + + Me.PlaceOfBirth.Text = formattedValue + + Else + + ' PlaceOfBirth is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.PlaceOfBirth.Text = PersonalIdTable.PlaceOfBirth.Format(PersonalIdTable.PlaceOfBirth.DefaultValue) + + End If + + ' If the PlaceOfBirth is NULL or blank, then use the value specified + ' on Properties. + If Me.PlaceOfBirth.Text Is Nothing _ + OrElse Me.PlaceOfBirth.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.PlaceOfBirth.Text = " " + End If + + End Sub + + Public Overridable Sub SetPostCode() + + + ' Set the PostCode Literal on the webpage with value from the + ' PersonalId database record. + + ' Me.DataSource is the PersonalId record retrieved from the database. + ' Me.PostCode is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetPostCode() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.PostCodeSpecified Then + + ' If the PostCode is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalIdTable.PostCode) + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.PostCode.Text = formattedValue + + Else + + ' PostCode is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.PostCode.Text = PersonalIdTable.PostCode.Format(PersonalIdTable.PostCode.DefaultValue) + + End If + + ' If the PostCode is NULL or blank, then use the value specified + ' on Properties. + If Me.PostCode.Text Is Nothing _ + OrElse Me.PostCode.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.PostCode.Text = " " + End If + + End Sub + + Public Overridable Sub SetProvince() + + + ' Set the Province Literal on the webpage with value from the + ' PersonalId database record. + + ' Me.DataSource is the PersonalId record retrieved from the database. + ' Me.Province is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetProvince() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.ProvinceSpecified Then + + ' If the Province is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalIdTable.Province) + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.Province.Text = formattedValue + + Else + + ' Province is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.Province.Text = PersonalIdTable.Province.Format(PersonalIdTable.Province.DefaultValue) + + End If + + ' If the Province is NULL or blank, then use the value specified + ' on Properties. + If Me.Province.Text Is Nothing _ + OrElse Me.Province.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.Province.Text = " " + End If + + End Sub + + Public Overridable Sub SetRankId() + + + ' Set the RankId Literal on the webpage with value from the + ' PersonalId database record. + + ' Me.DataSource is the PersonalId record retrieved from the database. + ' Me.RankId is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetRankId() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.RankIdSpecified Then + + ' If the RankId is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalIdTable.RankId) + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.RankId.Text = formattedValue + + Else + + ' RankId is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.RankId.Text = PersonalIdTable.RankId.Format(PersonalIdTable.RankId.DefaultValue) + + End If + + ' If the RankId is NULL or blank, then use the value specified + ' on Properties. + If Me.RankId.Text Is Nothing _ + OrElse Me.RankId.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.RankId.Text = " " + End If + + End Sub + + Public Overridable Sub SetRegDate() + + + ' Set the RegDate Literal on the webpage with value from the + ' PersonalId database record. + + ' Me.DataSource is the PersonalId record retrieved from the database. + ' Me.RegDate is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetRegDate() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.RegDateSpecified Then + + ' If the RegDate is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalIdTable.RegDate, "d MMM yy") + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.RegDate.Text = formattedValue + + Else + + ' RegDate is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.RegDate.Text = PersonalIdTable.RegDate.Format(PersonalIdTable.RegDate.DefaultValue, "d MMM yy") + + End If + + ' If the RegDate is NULL or blank, then use the value specified + ' on Properties. + If Me.RegDate.Text Is Nothing _ + OrElse Me.RegDate.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.RegDate.Text = " " + End If + + End Sub + + Public Overridable Sub SetRegNo1() + + + ' Set the RegNo1 Literal on the webpage with value from the + ' PersonalId database record. + + ' Me.DataSource is the PersonalId record retrieved from the database. + ' Me.RegNo1 is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetRegNo1() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.RegNo1Specified Then + + ' If the RegNo1 is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalIdTable.RegNo1) + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.RegNo1.Text = formattedValue + + Else + + ' RegNo1 is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.RegNo1.Text = PersonalIdTable.RegNo1.Format(PersonalIdTable.RegNo1.DefaultValue) + + End If + + ' If the RegNo1 is NULL or blank, then use the value specified + ' on Properties. + If Me.RegNo1.Text Is Nothing _ + OrElse Me.RegNo1.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.RegNo1.Text = " " + End If + + End Sub + + Public Overridable Sub SetRegNo2() + + + ' Set the RegNo2 Literal on the webpage with value from the + ' PersonalId database record. + + ' Me.DataSource is the PersonalId record retrieved from the database. + ' Me.RegNo2 is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetRegNo2() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.RegNo2Specified Then + + ' If the RegNo2 is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalIdTable.RegNo2) + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.RegNo2.Text = formattedValue + + Else + + ' RegNo2 is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.RegNo2.Text = PersonalIdTable.RegNo2.Format(PersonalIdTable.RegNo2.DefaultValue) + + End If + + ' If the RegNo2 is NULL or blank, then use the value specified + ' on Properties. + If Me.RegNo2.Text Is Nothing _ + OrElse Me.RegNo2.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.RegNo2.Text = " " + End If + + End Sub + + Public Overridable Sub SetReligion() + + + ' Set the Religion Literal on the webpage with value from the + ' PersonalId database record. + + ' Me.DataSource is the PersonalId record retrieved from the database. + ' Me.Religion is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetReligion() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.ReligionSpecified Then + + ' If the Religion is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalIdTable.Religion) + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.Religion.Text = formattedValue + + Else + + ' Religion is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.Religion.Text = PersonalIdTable.Religion.Format(PersonalIdTable.Religion.DefaultValue) + + End If + + ' If the Religion is NULL or blank, then use the value specified + ' on Properties. + If Me.Religion.Text Is Nothing _ + OrElse Me.Religion.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.Religion.Text = " " + End If + + End Sub + + Public Overridable Sub SetSectionId() + + + ' Set the SectionId Literal on the webpage with value from the + ' PersonalId database record. + + ' Me.DataSource is the PersonalId record retrieved from the database. + ' Me.SectionId is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetSectionId() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.SectionIdSpecified Then + + ' If the SectionId is non-NULL, then format the value. + + ' The Format method will return the Display Foreign Key As (DFKA) value + Dim formattedValue As String = "" + Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalIdTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalIdTable.SectionId) + If _isExpandableNonCompositeForeignKey AndAlso PersonalIdTable.SectionId.IsApplyDisplayAs Then + + formattedValue = PersonalIdTable.GetDFKA(Me.DataSource.SectionId.ToString(),PersonalIdTable.SectionId, Nothing) + + if (formattedValue Is Nothing) Then + formattedValue = Me.DataSource.Format(PersonalIdTable.SectionId) + End If + Else + formattedValue = Me.DataSource.SectionId.ToString() + End If + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.SectionId.Text = formattedValue + + Else + + ' SectionId is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.SectionId.Text = PersonalIdTable.SectionId.Format(PersonalIdTable.SectionId.DefaultValue) + + End If + + ' If the SectionId is NULL or blank, then use the value specified + ' on Properties. + If Me.SectionId.Text Is Nothing _ + OrElse Me.SectionId.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.SectionId.Text = " " + End If + + End Sub + + Public Overridable Sub SetSex() + + + ' Set the Sex Literal on the webpage with value from the + ' PersonalId database record. + + ' Me.DataSource is the PersonalId record retrieved from the database. + ' Me.Sex is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetSex() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.SexSpecified Then + + ' If the Sex is non-NULL, then format the value. + + ' The Format method will return the Display Foreign Key As (DFKA) value + Dim formattedValue As String = "" + Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalIdTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalIdTable.Sex) + If _isExpandableNonCompositeForeignKey AndAlso PersonalIdTable.Sex.IsApplyDisplayAs Then + + formattedValue = PersonalIdTable.GetDFKA(Me.DataSource.Sex.ToString(),PersonalIdTable.Sex, Nothing) + + if (formattedValue Is Nothing) Then + formattedValue = Me.DataSource.Format(PersonalIdTable.Sex) + End If + Else + formattedValue = Me.DataSource.Sex.ToString() + End If + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.Sex.Text = formattedValue + + Else + + ' Sex is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.Sex.Text = PersonalIdTable.Sex.Format(PersonalIdTable.Sex.DefaultValue) + + End If + + ' If the Sex is NULL or blank, then use the value specified + ' on Properties. + If Me.Sex.Text Is Nothing _ + OrElse Me.Sex.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.Sex.Text = " " + End If + + End Sub + + Public Overridable Sub SetStatusId() + + + ' Set the StatusId Literal on the webpage with value from the + ' PersonalId database record. + + ' Me.DataSource is the PersonalId record retrieved from the database. + ' Me.StatusId is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetStatusId() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.StatusIdSpecified Then + + ' If the StatusId is non-NULL, then format the value. + + ' The Format method will return the Display Foreign Key As (DFKA) value + Dim formattedValue As String = "" + Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalIdTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalIdTable.StatusId) + If _isExpandableNonCompositeForeignKey AndAlso PersonalIdTable.StatusId.IsApplyDisplayAs Then + + formattedValue = PersonalIdTable.GetDFKA(Me.DataSource.StatusId.ToString(),PersonalIdTable.StatusId, Nothing) + + if (formattedValue Is Nothing) Then + formattedValue = Me.DataSource.Format(PersonalIdTable.StatusId) + End If + Else + formattedValue = Me.DataSource.StatusId.ToString() + End If + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.StatusId.Text = formattedValue + + Else + + ' StatusId is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.StatusId.Text = PersonalIdTable.StatusId.Format(PersonalIdTable.StatusId.DefaultValue) + + End If + + ' If the StatusId is NULL or blank, then use the value specified + ' on Properties. + If Me.StatusId.Text Is Nothing _ + OrElse Me.StatusId.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.StatusId.Text = " " + End If + + End Sub + + Public Overridable Sub SetTId() + + + ' Set the TId Literal on the webpage with value from the + ' PersonalId database record. + + ' Me.DataSource is the PersonalId record retrieved from the database. + ' Me.TId is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetTId() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.TIdSpecified Then + + ' If the TId is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalIdTable.TId) + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.TId.Text = formattedValue + + Else + + ' TId is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.TId.Text = PersonalIdTable.TId.Format(PersonalIdTable.TId.DefaultValue) + + End If + + ' If the TId is NULL or blank, then use the value specified + ' on Properties. + If Me.TId.Text Is Nothing _ + OrElse Me.TId.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.TId.Text = " " + End If + + End Sub + + Public Overridable Sub SetAddrLabel() + + End Sub + + Public Overridable Sub SetAmphurLabel() + + End Sub + + Public Overridable Sub SetArmIdLabel() + + End Sub + + Public Overridable Sub SetArmyIdLabel() + + End Sub + + Public Overridable Sub SetArmyWelfareMemIdLabel() + + End Sub + + Public Overridable Sub SetBAmphurLabel() + + End Sub + + Public Overridable Sub SetBirthDateLabel() + + End Sub + + Public Overridable Sub SetBloodIdLabel() + + End Sub + + Public Overridable Sub SetBornLabel() + + End Sub + + Public Overridable Sub SetBProvinceLabel() + + End Sub + + Public Overridable Sub SetCommissionLabel() + + End Sub + + Public Overridable Sub SetCremateMemIdLabel() + + End Sub + + Public Overridable Sub SetDeptIdLabel() + + End Sub + + Public Overridable Sub SetMIdLabel() + + End Sub + + Public Overridable Sub SetMobilePhoneLabel() + + End Sub + + Public Overridable Sub SetNationalityLabel() + + End Sub + + Public Overridable Sub SetOfficerDateLabel() + + End Sub + + Public Overridable Sub SetOriginLabel() + + End Sub + + Public Overridable Sub SetPersonalIdLabel() + + End Sub + + Public Overridable Sub SetPersonalIdRecordControlCollapsibleRegion() + + End Sub + + Public Overridable Sub SetPersonalIdRecordControlIcon() + + End Sub + + Public Overridable Sub SetPersonalIdRecordControlPanelExtender() + + End Sub + + Public Overridable Sub SetPersonalLastNameLabel() + + End Sub + + Public Overridable Sub SetPersonalNameLabel() + + End Sub + + Public Overridable Sub SetPhoneExtLabel() + + End Sub + + Public Overridable Sub SetPhoneLabel() + + End Sub + + Public Overridable Sub SetpictureLabel() + + End Sub + + Public Overridable Sub SetPlaceOfBirthLabel() + + End Sub + + Public Overridable Sub SetPostCodeLabel() + + End Sub + + Public Overridable Sub SetProvinceLabel() + + End Sub + + Public Overridable Sub SetRankIdLabel() + + End Sub + + Public Overridable Sub SetRegDateLabel() + + End Sub + + Public Overridable Sub SetRegNo1Label() + + End Sub + + Public Overridable Sub SetRegNo2Label() + + End Sub + + Public Overridable Sub SetReligionLabel() + + End Sub + + Public Overridable Sub SetSectionIdLabel() + + End Sub + + Public Overridable Sub SetSexLabel() + + End Sub + + Public Overridable Sub SetStatusIdLabel() + + End Sub + + Public Overridable Sub SetTIdLabel() + + 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 PersonalIdRecordControl. + Public Overridable Sub SaveData() + ' Saves the associated record in the database. + ' SaveData calls Validate and Get methods - so it may be more appropriate to + ' customize those methods. + + ' 1. Load the existing record from the database. Since we save the entire record, this ensures + ' that fields that are not displayed are also properly initialized. + Me.LoadData() + + Dim Panel As System.Web.UI.WebControls.Panel = CType(MiscUtils.FindControlRecursively(Me, "PersonalIdRecordControlPanel"), System.Web.UI.WebControls.Panel) + + If ((Not IsNothing(Panel)) AndAlso (Not Panel.Visible)) OrElse IsNothing(Me.DataSource) Then + Return + End If + + + ' 2. Perform any custom validation. + Me.Validate() + + + ' 3. Set the values in the record with data from UI controls. + ' This calls the Get() method for each of the user interface controls. + Me.GetUIData() + + ' 4. Save in the database. + ' We should not save the record if the data did not change. This + ' will save a database hit and avoid triggering any database triggers. + + If Me.DataSource.IsAnyValueChanged Then + ' Save record to database but do not commit yet. + ' Auto generated ids are available after saving for use by child (dependent) records. + Me.DataSource.Save() + + End If + + + ' update session or cookie by formula + + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + ' For Master-Detail relationships, save data on the Detail table(s) + + Dim recPersonalDDTableControl as PersonalDDTableControl = DirectCast(MiscUtils.FindControlRecursively(Me.Page, "PersonalDDTableControl"), PersonalDDTableControl) + recPersonalDDTableControl.SaveData() + + Dim recPersonalEducationTableControl as PersonalEducationTableControl = DirectCast(MiscUtils.FindControlRecursively(Me.Page, "PersonalEducationTableControl"), PersonalEducationTableControl) + recPersonalEducationTableControl.SaveData() + + Dim recPersonalExtWorkTableControl as PersonalExtWorkTableControl = DirectCast(MiscUtils.FindControlRecursively(Me.Page, "PersonalExtWorkTableControl"), PersonalExtWorkTableControl) + recPersonalExtWorkTableControl.SaveData() + + Dim recPersonalInsigniaTableControl as PersonalInsigniaTableControl = DirectCast(MiscUtils.FindControlRecursively(Me.Page, "PersonalInsigniaTableControl"), PersonalInsigniaTableControl) + recPersonalInsigniaTableControl.SaveData() + + Dim recPersonalLanguageSkillTableControl as PersonalLanguageSkillTableControl = DirectCast(MiscUtils.FindControlRecursively(Me.Page, "PersonalLanguageSkillTableControl"), PersonalLanguageSkillTableControl) + recPersonalLanguageSkillTableControl.SaveData() + + Dim recPersonalNameTableControl as PersonalNameTableControl = DirectCast(MiscUtils.FindControlRecursively(Me.Page, "PersonalNameTableControl"), PersonalNameTableControl) + recPersonalNameTableControl.SaveData() + + Dim recPersonalRankTableControl as PersonalRankTableControl = DirectCast(MiscUtils.FindControlRecursively(Me.Page, "PersonalRankTableControl"), PersonalRankTableControl) + recPersonalRankTableControl.SaveData() + + Dim recPersonalSalaryTableControl as PersonalSalaryTableControl = DirectCast(MiscUtils.FindControlRecursively(Me.Page, "PersonalSalaryTableControl"), PersonalSalaryTableControl) + recPersonalSalaryTableControl.SaveData() + + Dim recPersonalSpecialSkillTableControl as PersonalSpecialSkillTableControl = DirectCast(MiscUtils.FindControlRecursively(Me.Page, "PersonalSpecialSkillTableControl"), PersonalSpecialSkillTableControl) + recPersonalSpecialSkillTableControl.SaveData() + + Dim recPersonalSportSkillTableControl as PersonalSportSkillTableControl = DirectCast(MiscUtils.FindControlRecursively(Me.Page, "PersonalSportSkillTableControl"), PersonalSportSkillTableControl) + recPersonalSportSkillTableControl.SaveData() + + Dim recPersonalTitleTableControl as PersonalTitleTableControl = DirectCast(MiscUtils.FindControlRecursively(Me.Page, "PersonalTitleTableControl"), PersonalTitleTableControl) + recPersonalTitleTableControl.SaveData() + + Dim recPersonRelativeTableControl as PersonRelativeTableControl = DirectCast(MiscUtils.FindControlRecursively(Me.Page, "PersonRelativeTableControl"), PersonRelativeTableControl) + recPersonRelativeTableControl.SaveData() + + End Sub + + ' To customize, override this method in PersonalIdRecordControl. + Public Overridable Sub GetUIData() + ' The GetUIData method retrieves the updated values from the user interface + ' controls into a database record in preparation for saving or updating. + ' To do this, it calls the Get methods for each of the field displayed on + ' the webpage. It is better to make changes in the Get methods, rather + ' than making changes here. + + ' Call the Get methods for each of the user interface controls. + + GetAddr() + GetAmphur() + GetArmId() + GetArmyId() + GetArmyWelfareMemId() + GetBAmphur() + GetBirthDate() + GetBloodId() + GetBorn() + GetBProvince() + GetCommission() + GetCremateMemId() + GetDeptId() + GetMId() + GetMobilePhone() + GetNationality() + GetOfficerDate() + GetOrigin() + GetPersonalId() + GetPersonalLastName() + GetPersonalName() + GetPhone() + GetPhoneExt() + GetPlaceOfBirth() + GetPostCode() + GetProvince() + GetRankId() + GetRegDate() + GetRegNo1() + GetRegNo2() + GetReligion() + GetSectionId() + GetSex() + GetStatusId() + GetTId() + End Sub + + + Public Overridable Sub GetAddr() + + End Sub + + Public Overridable Sub GetAmphur() + + End Sub + + Public Overridable Sub GetArmId() + + End Sub + + Public Overridable Sub GetArmyId() + + End Sub + + Public Overridable Sub GetArmyWelfareMemId() + + End Sub + + Public Overridable Sub GetBAmphur() + + End Sub + + Public Overridable Sub GetBirthDate() + + End Sub + + Public Overridable Sub GetBloodId() + + End Sub + + Public Overridable Sub GetBorn() + + End Sub + + Public Overridable Sub GetBProvince() + + End Sub + + Public Overridable Sub GetCommission() + + End Sub + + Public Overridable Sub GetCremateMemId() + + End Sub + + Public Overridable Sub GetDeptId() + + End Sub + + Public Overridable Sub GetMId() + + End Sub + + Public Overridable Sub GetMobilePhone() + + End Sub + + Public Overridable Sub GetNationality() + + End Sub + + Public Overridable Sub GetOfficerDate() + + End Sub + + Public Overridable Sub GetOrigin() + + End Sub + + Public Overridable Sub GetPersonalId() + + End Sub + + Public Overridable Sub GetPersonalLastName() + + End Sub + + Public Overridable Sub GetPersonalName() + + End Sub + + Public Overridable Sub GetPhone() + + End Sub + + Public Overridable Sub GetPhoneExt() + + End Sub + + Public Overridable Sub GetPlaceOfBirth() + + End Sub + + Public Overridable Sub GetPostCode() + + End Sub + + Public Overridable Sub GetProvince() + + End Sub + + Public Overridable Sub GetRankId() + + End Sub + + Public Overridable Sub GetRegDate() + + End Sub + + Public Overridable Sub GetRegNo1() + + End Sub + + Public Overridable Sub GetRegNo2() + + End Sub + + Public Overridable Sub GetReligion() + + End Sub + + Public Overridable Sub GetSectionId() + + End Sub + + Public Overridable Sub GetSex() + + End Sub + + Public Overridable Sub GetStatusId() + + End Sub + + Public Overridable Sub GetTId() + + End Sub + + + ' To customize, override this method in PersonalIdRecordControl. + + Public Overridable Function CreateWhereClause() As WhereClause + + Dim wc As WhereClause + PersonalIdTable.Instance.InnerFilter = Nothing + wc = New WhereClause() + + ' Compose the WHERE clause consiting of: + ' 1. Static clause defined at design time. + ' 2. User selected filter criteria. + ' 3. User selected search criteria. + + + ' Retrieve the record id from the URL parameter. + + Dim recId As String = Me.Page.Request.QueryString.Item("PersonalId") + + 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}", "PersonalId")) + End If + HttpContext.Current.Session("QueryString in ShowPersonalId") = recId + + If KeyValue.IsXmlKey(recId) Then + ' Keys are typically passed as XML structures to handle composite keys. + ' If XML, then add a Where clause based on the Primary Key in the XML. + Dim pkValue As KeyValue = KeyValue.XmlToKey(recId) + + wc.iAND(PersonalIdTable.PersonalId, BaseFilter.ComparisonOperator.EqualsTo, pkValue.GetColumnValueString(PersonalIdTable.PersonalId)) + + Else + ' The URL parameter contains the actual value, not an XML structure. + + wc.iAND(PersonalIdTable.PersonalId, BaseFilter.ComparisonOperator.EqualsTo, recId) + + End If + + Return wc + + End Function + + ' This CreateWhereClause is used for loading list of suggestions for Auto Type-Ahead feature. + + Public Overridable Function CreateWhereClause(ByVal searchText As String, ByVal fromSearchControl As String, ByVal AutoTypeAheadSearch As String, ByVal AutoTypeAheadWordSeparators As String) As WhereClause + PersonalIdTable.Instance.InnerFilter = Nothing + Dim wc As WhereClause = New WhereClause() + + ' Compose the WHERE clause consiting of: + ' 1. Static clause defined at design time. + ' 2. User selected filter criteria. + ' 3. User selected search criteria. + Dim appRelativeVirtualPath As String = CType(HttpContext.Current.Session("AppRelativeVirtualPath"), String) + + + ' Adds clauses if values are selected in Filter controls which are configured in the page. + + + + 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 PersonalIdRecordControl. + Public Overridable Sub Validate() + ' Add custom validation for any control within this panel. + ' Example. If you have a State ASP:Textbox control + ' If Me.State.Text <> "CA" Then + ' Throw New Exception("State must be CA (California).") + ' End If + + ' The Validate method is common across all controls within + ' this panel so you can validate multiple fields, but report + ' one error message. + + + End Sub + + Public Overridable Sub Delete() + + If Me.IsNewRecord() Then + Return + End If + + Dim pkValue As KeyValue = KeyValue.XmlToKey(Me.RecordUniqueId) + PersonalIdTable.DeleteRecord(pkValue) + + End Sub + + Protected Overridable Sub Control_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.PreRender + ' PreRender event is raised just before page is being displayed. + Try + DbUtils.StartTransaction() + Me.RegisterPostback() + + If Not Me.Page.ErrorOnPage AndAlso (Me.Page.IsPageRefresh OrElse Me.DataChanged OrElse Me.ResetData) Then + + + ' Re-load the data and update the web page if necessary. + ' This is typically done during a postback (filter, search button, sort, pagination button). + ' In each of the other click handlers, simply set DataChanged to True to reload the data. + Me.LoadData() + Me.DataBind() + End If + + + Me.Page.Authorize(Ctype(BirthDate, Control), "NO_ACCESS") + + Me.Page.Authorize(Ctype(PersonalId, Control), "NO_ACCESS") + + 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. + + ' event handler for ImageButton + Public Overridable Sub PersonalIdDialogEditButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + ' The redirect URL is set on the Properties, Custom Properties or Actions. + ' The ModifyRedirectURL call resolves the parameters before the + ' Response.Redirect redirects the page to the URL. + ' Any code after the Response.Redirect call will not be executed, since the page is + ' redirected to the URL. + + + Dim url As String = "../PersonalId/EditPersonalId.aspx?PersonalId={PK}" + + Dim shouldRedirect As Boolean = True + Dim TargetKey As String = Nothing + Dim DFKA As String = TargetKey + Dim id As String = DFKA + Dim value As String = id + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + url = Me.ModifyRedirectUrl(url, "",False) + url = Me.Page.ModifyRedirectUrl(url, "",False) + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + shouldRedirect = False + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + If shouldRedirect Then + Me.Page.ShouldSaveControlsToSession = True + Me.Page.Response.Redirect(url) + ElseIf Not TargetKey Is Nothing AndAlso _ + Not shouldRedirect Then + Me.Page.ShouldSaveControlsToSession = True + Me.Page.CloseWindow(True) + + End If + End Sub + + + Private _PreviousUIData As New Hashtable + Public Overridable Property PreviousUIData() As Hashtable + Get + Return _PreviousUIData + End Get + Set(ByVal value As Hashtable) + _PreviousUIData = value + End Set + End Property + + Private _IsNewRecord As Boolean = True + Public Overridable Property IsNewRecord() As Boolean + Get + Return Me._IsNewRecord + End Get + Set(ByVal value As Boolean) + Me._IsNewRecord = value + End Set + End Property + + Private _DataChanged As Boolean = False + Public Overridable Property DataChanged() As Boolean + Get + Return Me._DataChanged + End Get + Set(ByVal Value As Boolean) + Me._DataChanged = Value + End Set + End Property + + Private _ResetData As Boolean = False + Public Overridable Property ResetData() As Boolean + Get + Return Me._ResetData + End Get + Set(ByVal Value As Boolean) + Me._ResetData = Value + End Set + End Property + + Public Property RecordUniqueId() As String + Get + Return CType(Me.ViewState("BasePersonalIdRecordControl_Rec"), String) + End Get + Set(ByVal value As String) + Me.ViewState("BasePersonalIdRecordControl_Rec") = value + End Set + End Property + + Private _DataSource As PersonalIdRecord + Public Property DataSource() As PersonalIdRecord + Get + Return Me._DataSource + End Get + + Set(ByVal value As PersonalIdRecord) + + Me._DataSource = value + End Set + End Property + + + + Private _checkSum As String + Public Overridable Property CheckSum() As String + Get + Return Me._checkSum + End Get + Set(ByVal value As String) + Me._checkSum = value + End Set + End Property + + Private _TotalPages As Integer + Public Property TotalPages() As Integer + Get + Return Me._TotalPages + End Get + Set(ByVal value As Integer) + Me._TotalPages = value + End Set + End Property + + Private _PageIndex As Integer + Public Property PageIndex() As Integer + Get + ' Return the PageIndex + Return Me._PageIndex + End Get + Set(ByVal value As Integer) + Me._PageIndex = value + End Set + End Property + + Private _PageSize As Integer + Public Property PageSize() As Integer + Get + Return Me._PageSize + End Get + Set(ByVal value As Integer) + Me._PageSize = value + End Set + End Property + + Private _TotalRecords As Integer + Public Property TotalRecords() As Integer + Get + Return Me._TotalRecords + End Get + Set(ByVal value As Integer) + If Me.PageSize > 0 Then + Me.TotalPages = CInt(Math.Ceiling(value / Me.PageSize)) + End If + + Me._TotalRecords = value + End Set + End Property + + Private _DisplayLastPage As Boolean + Public Property DisplayLastPage() As Boolean + Get + Return Me._DisplayLastPage + End Get + Set(ByVal value As Boolean) + Me._DisplayLastPage = value + End Set + End Property + + + +#Region "Helper Properties" + + Public ReadOnly Property Addr() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Addr"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property AddrLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "AddrLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property Amphur() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Amphur"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property AmphurLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "AmphurLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property ArmId() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "ArmId"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property ArmIdLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "ArmIdLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property ArmyId() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "ArmyId"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property ArmyIdLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "ArmyIdLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property ArmyWelfareMemId() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "ArmyWelfareMemId"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property ArmyWelfareMemIdLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "ArmyWelfareMemIdLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property BAmphur() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "BAmphur"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property BAmphurLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "BAmphurLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property BirthDate() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "BirthDate"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property BirthDateLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "BirthDateLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property BloodId() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "BloodId"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property BloodIdLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "BloodIdLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property Born() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Born"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property BornLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "BornLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property BProvince() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "BProvince"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property BProvinceLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "BProvinceLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property Commission() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Commission"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property CommissionLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "CommissionLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property CremateMemId() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "CremateMemId"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property CremateMemIdLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "CremateMemIdLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property DeptId() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "DeptId"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property DeptIdLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "DeptIdLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property MId() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "MId"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property MIdLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "MIdLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property MobilePhone() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "MobilePhone"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property MobilePhoneLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "MobilePhoneLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property Nationality() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Nationality"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property NationalityLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "NationalityLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property OfficerDate() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "OfficerDate"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property OfficerDateLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "OfficerDateLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property Origin() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Origin"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property OriginLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "OriginLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property PersonalId() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalId"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property PersonalIdDialogEditButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalIdDialogEditButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalIdLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalIdLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property PersonalIdRecordControlCollapsibleRegion() As System.Web.UI.WebControls.Panel + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalIdRecordControlCollapsibleRegion"), System.Web.UI.WebControls.Panel) + End Get + End Property + + Public ReadOnly Property PersonalIdRecordControlIcon() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalIdRecordControlIcon"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalIdRecordControlPanelExtender() As AjaxControlToolkit.CollapsiblePanelExtender + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalIdRecordControlPanelExtender"), AjaxControlToolkit.CollapsiblePanelExtender) + End Get + End Property + + Public ReadOnly Property PersonalIdTitle() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalIdTitle"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property PersonalLastName() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalLastName"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property PersonalLastNameLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalLastNameLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property PersonalName() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalName"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property PersonalNameLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalNameLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property Phone() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Phone"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property PhoneExt() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PhoneExt"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property PhoneExtLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PhoneExtLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property PhoneLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PhoneLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property picture() As System.Web.UI.WebControls.Image + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "picture"), System.Web.UI.WebControls.Image) + End Get + End Property + + Public ReadOnly Property pictureLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "pictureLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property PlaceOfBirth() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PlaceOfBirth"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property PlaceOfBirthLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PlaceOfBirthLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property PostCode() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PostCode"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property PostCodeLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PostCodeLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property Province() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Province"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property ProvinceLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "ProvinceLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property RankId() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RankId"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property RankIdLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RankIdLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property RegDate() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RegDate"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property RegDateLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RegDateLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property RegNo1() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RegNo1"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property RegNo1Label() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RegNo1Label"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property RegNo2() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RegNo2"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property RegNo2Label() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RegNo2Label"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property Religion() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Religion"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property ReligionLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "ReligionLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property SectionId() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "SectionId"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property SectionIdLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "SectionIdLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property Sex() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Sex"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property SexLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "SexLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property StatusId() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "StatusId"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property StatusIdLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "StatusIdLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property TId() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "TId"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property TIdLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "TIdLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + +#End Region + +#Region "Helper Functions" + + Public Overrides Overloads Function ModifyRedirectUrl(ByVal url As String, ByVal arg As String, ByVal bEncrypt As Boolean) As String + Return Me.Page.EvaluateExpressions(url, arg, bEncrypt, Me) + End Function + + Public Overrides Overloads Function EvaluateExpressions(ByVal url As String, ByVal arg As String, ByVal bEncrypt As Boolean) As String + + Dim rec As PersonalIdRecord = Nothing + + + Try + rec = Me.GetRecord() + Catch ex As Exception + ' Do nothing + End Try + + If rec Is Nothing AndAlso url.IndexOf("{") >= 0 Then + ' Localization. + + Throw New Exception(Page.GetResourceValue("Err:RecDataSrcNotInitialized", "Persons")) + + End If + Return EvaluateExpressions(url, arg, rec, bEncrypt) + End Function + + + Public Overridable Function GetRecord() As PersonalIdRecord + If Not Me.DataSource Is Nothing Then + Return Me.DataSource + End If + + If Not Me.RecordUniqueId Is Nothing Then + + Return PersonalIdTable.GetRecord(Me.RecordUniqueId, True) + + End If + + ' Localization. + + 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 + + \ No newline at end of file diff --git a/App_Code/PersonalId/ShowPersonalTable.Controls.vb b/App_Code/PersonalId/ShowPersonalTable.Controls.vb new file mode 100644 index 0000000..2f2aa14 --- /dev/null +++ b/App_Code/PersonalId/ShowPersonalTable.Controls.vb @@ -0,0 +1,3731 @@ + +' This file implements the TableControl, TableControlRow, and RecordControl classes for the +' ShowPersonalTable.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 + +Imports CrPdf + +#End Region + + +Namespace Persons.UI.Controls.ShowPersonalTable + +#Region "Section 1: Place your customizations here." + + +Public Class PersonalIdTableControlRow + Inherits BasePersonalIdTableControlRow + ' The BasePersonalIdTableControlRow implements code for a ROW within the + ' the PersonalIdTableControl table. The BasePersonalIdTableControlRow implements the DataBind and SaveData methods. + ' The loading of data is actually performed by the LoadData method in the base class of PersonalIdTableControl. + + ' This is the ideal place to add your code customizations. For example, you can override the DataBind, + ' SaveData, GetUIData, and Validate methods. + + +End Class + + + +Public Class PersonalIdTableControl + Inherits BasePersonalIdTableControl + + Public Overrides Sub PersonalIdPDFButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction() + Dim param(0) As String + param(0) = "PID,3160101741051" + Dim cr As New CrPdf + cr.GetCr(Me, "../Reports/Person_Record.rpt", param) + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + Finally + DbUtils.EndTransaction() + End Try + + End Sub + + Public Overrides Sub Button_Click(ByVal sender As Object, ByVal args As EventArgs) + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction() + Dim param(0) As String + param(0) = "PID,3160101741051" + Dim cr As New CrPdf + cr.GetCr(Me, "../Reports/Person_Record.rpt", param) + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + Finally + DbUtils.EndTransaction() + End Try + + End Sub + + + End Class + + + +#End Region + + + +#Region "Section 2: Do not modify this section." + + +' Base class for the PersonalIdTableControlRow control on the ShowPersonalTable page. +' Do not modify this class. Instead override any method in PersonalIdTableControlRow. +Public Class BasePersonalIdTableControlRow + Inherits Persons.UI.BaseApplicationRecordControl + + ' To customize, override this method in PersonalIdTableControlRow. + Protected Overridable Sub Control_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Init + + Me.ClearControlsFromSession() + End Sub + + ' To customize, override this method in PersonalIdTableControlRow. + Protected Overridable Sub Control_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load + + 'Call LoadFocusScripts from repeater so that onfocus attribute could be added to elements + Me.Page.LoadFocusScripts(Me) + + ' Show confirmation message on Click + Me.PersonalIdRowDeleteButton.Attributes.Add("onClick", "return (confirm('" & (CType(Me.Page,BaseApplicationPage)).GetResourceValue("DeleteRecordConfirm", "Persons") & "'));") + + + ' Register the event handlers. + + AddHandler Me.PersonalIdRowCopyButton.Click, AddressOf PersonalIdRowCopyButton_Click + + AddHandler Me.PersonalIdRowDeleteButton.Click, AddressOf PersonalIdRowDeleteButton_Click + + AddHandler Me.PersonalIdRowEditButton.Click, AddressOf PersonalIdRowEditButton_Click + + AddHandler Me.PersonalIdRowViewButton.Click, AddressOf PersonalIdRowViewButton_Click + + + End Sub + + + Public Overridable Sub LoadData() + + ' Load the data from the database into the DataSource PersonalId record. + ' It is better to make changes to functions called by LoadData such as + ' CreateWhereClause, rather than making changes here. + + ' 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 = PersonalIdTable.GetRecord(Me.RecordUniqueId, True) + + Return + End If + + ' Since this is a row in the table, the data for this row is loaded by the + ' LoadData method of the BasePersonalIdTableControl when the data for the entire + ' table is loaded. + + Me.DataSource = New PersonalIdRecord() + + + + End Sub + + ' Populate the UI controls using the DataSource. To customize, override this method in PersonalIdTableControlRow. + Public Overrides Sub DataBind() + ' The DataBind method binds the user interface controls to the values + ' from the database record. To do this, it calls the Set methods for + ' each of the field displayed on the webpage. It is better to make + ' changes in the Set methods, rather than making changes here. + + MyBase.DataBind() + + ' Make sure that the DataSource is initialized. + If Me.DataSource Is Nothing Then + + Return + End If + + + 'LoadData for DataSource for chart and report if they exist + + + + ' Call the Set methods for each controls on the panel + + SetPersonalId() + + + + + + SetPersonalLastName() + SetPersonalName() + + + Me.IsNewRecord = True + + If Me.DataSource.IsCreated Then + Me.IsNewRecord = False + + Me.RecordUniqueId = Me.DataSource.GetID.ToXmlString() + End If + + ' Now load data for each record and table child UI controls. + ' Ordering is important because child controls get + ' their parent ids from their parent UI controls. + Dim shouldResetControl As Boolean = False + + End Sub + + + Public Overridable Sub SetPersonalId() + + + ' Set the PersonalId Literal on the webpage with value from the + ' PersonalId database record. + + ' Me.DataSource is the PersonalId record retrieved from the database. + ' Me.PersonalId is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetPersonalId() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.PersonalIdSpecified Then + + ' If the PersonalId is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalIdTable.PersonalId) + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.PersonalId.Text = formattedValue + + Else + + ' PersonalId is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.PersonalId.Text = PersonalIdTable.PersonalId.Format(PersonalIdTable.PersonalId.DefaultValue) + + End If + + ' If the PersonalId is NULL or blank, then use the value specified + ' on Properties. + If Me.PersonalId.Text Is Nothing _ + OrElse Me.PersonalId.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.PersonalId.Text = " " + End If + + End Sub + + Public Overridable Sub SetPersonalLastName() + + + ' Set the PersonalLastName Literal on the webpage with value from the + ' PersonalId database record. + + ' Me.DataSource is the PersonalId record retrieved from the database. + ' Me.PersonalLastName is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetPersonalLastName() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.PersonalLastNameSpecified Then + + ' If the PersonalLastName is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalIdTable.PersonalLastName) + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.PersonalLastName.Text = formattedValue + + Else + + ' PersonalLastName is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.PersonalLastName.Text = PersonalIdTable.PersonalLastName.Format(PersonalIdTable.PersonalLastName.DefaultValue) + + End If + + ' If the PersonalLastName is NULL or blank, then use the value specified + ' on Properties. + If Me.PersonalLastName.Text Is Nothing _ + OrElse Me.PersonalLastName.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.PersonalLastName.Text = " " + End If + + End Sub + + Public Overridable Sub SetPersonalName() + + + ' Set the PersonalName Literal on the webpage with value from the + ' PersonalId database record. + + ' Me.DataSource is the PersonalId record retrieved from the database. + ' Me.PersonalName is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetPersonalName() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.PersonalNameSpecified Then + + ' If the PersonalName is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalIdTable.PersonalName) + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.PersonalName.Text = formattedValue + + Else + + ' PersonalName is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.PersonalName.Text = PersonalIdTable.PersonalName.Format(PersonalIdTable.PersonalName.DefaultValue) + + End If + + ' If the PersonalName is NULL or blank, then use the value specified + ' on Properties. + If Me.PersonalName.Text Is Nothing _ + OrElse Me.PersonalName.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.PersonalName.Text = " " + End If + + End Sub + + + Public EvaluateFormulaDelegate As BaseClasses.Data.DataSource.EvaluateFormulaDelegate = New BaseClasses.Data.DataSource.EvaluateFormulaDelegate(AddressOf Me.EvaluateFormula) + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean, ByVal e As FormulaEvaluator) As String + If e Is Nothing Then + e = New FormulaEvaluator() + End If + + e.Variables.Clear() + + + ' add variables for formula evaluation + If variables IsNot Nothing Then + Dim enumerator As System.Collections.Generic.IEnumerator(Of System.Collections.Generic.KeyValuePair(Of String, Object)) = variables.GetEnumerator() + While enumerator.MoveNext() + e.Variables.Add(enumerator.Current.Key, enumerator.Current.Value) + End While + End If + + If includeDS + + End IF + + + ' Other variables referred to in the formula are expected to be + ' properties of the DataSource. For example, referring to + ' UnitPrice as a variable will refer to DataSource.UnitPrice + If dataSourceForEvaluate Is Nothing Then + + e.DataSource = Me.DataSource + + Else + e.DataSource = dataSourceForEvaluate + End If + + ' Define the calling control. This is used to add other + ' related table and record controls as variables. + e.CallingControl = Me + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + + If Not String.IsNullOrEmpty(format) AndAlso (String.IsNullOrEmpty(formula) OrElse formula.IndexOf("Format(") < 0) Then + Return FormulaUtils.Format(resultObj, format) + Else + Return resultObj.ToString() + End If + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format,variables ,includeDS, Nothing) + End Function + + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object)) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format, variables ,True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, format, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal e as FormulaEvaluator) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, variables, True, e) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal includeDS as Boolean) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, includeDS, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, True, Nothing) + End Function + + + Public Overridable Sub RegisterPostback() + + + End Sub + + + + ' To customize, override this method in PersonalIdTableControlRow. + Public Overridable Sub SaveData() + ' Saves the associated record in the database. + ' SaveData calls Validate and Get methods - so it may be more appropriate to + ' customize those methods. + + ' 1. Load the existing record from the database. Since we save the entire record, this ensures + ' that fields that are not displayed are also properly initialized. + Me.LoadData() + + + ' 2. Perform any custom validation. + Me.Validate() + + + ' 3. Set the values in the record with data from UI controls. + ' This calls the Get() method for each of the user interface controls. + Me.GetUIData() + + ' 4. Save in the database. + ' We should not save the record if the data did not change. This + ' will save a database hit and avoid triggering any database triggers. + + If Me.DataSource.IsAnyValueChanged Then + ' Save record to database but do not commit yet. + ' Auto generated ids are available after saving for use by child (dependent) records. + Me.DataSource.Save() + + DirectCast(GetParentControlObject(Me, "PersonalIdTableControl"), PersonalIdTableControl).DataChanged = True + DirectCast(GetParentControlObject(Me, "PersonalIdTableControl"), PersonalIdTableControl).ResetData = True + End If + + + ' update session or cookie by formula + + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + ' For Master-Detail relationships, save data on the Detail table(s) + + End Sub + + ' To customize, override this method in PersonalIdTableControlRow. + Public Overridable Sub GetUIData() + ' The GetUIData method retrieves the updated values from the user interface + ' controls into a database record in preparation for saving or updating. + ' To do this, it calls the Get methods for each of the field displayed on + ' the webpage. It is better to make changes in the Get methods, rather + ' than making changes here. + + ' Call the Get methods for each of the user interface controls. + + GetPersonalId() + GetPersonalLastName() + GetPersonalName() + End Sub + + + Public Overridable Sub GetPersonalId() + + End Sub + + Public Overridable Sub GetPersonalLastName() + + End Sub + + Public Overridable Sub GetPersonalName() + + End Sub + + + ' To customize, override this method in PersonalIdTableControlRow. + + Public Overridable Function CreateWhereClause() As WhereClause + + Return Nothing + + End Function + + + + ' To customize, override this method in PersonalIdTableControlRow. + Public Overridable Sub Validate() + ' Add custom validation for any control within this panel. + ' Example. If you have a State ASP:Textbox control + ' If Me.State.Text <> "CA" Then + ' Throw New Exception("State must be CA (California).") + ' End If + + ' The Validate method is common across all controls within + ' this panel so you can validate multiple fields, but report + ' one error message. + + + End Sub + + Public Overridable Sub Delete() + + If Me.IsNewRecord() Then + Return + End If + + Dim pkValue As KeyValue = KeyValue.XmlToKey(Me.RecordUniqueId) + PersonalIdTable.DeleteRecord(pkValue) + + DirectCast(GetParentControlObject(Me, "PersonalIdTableControl"), PersonalIdTableControl).DataChanged = True + DirectCast(GetParentControlObject(Me, "PersonalIdTableControl"), PersonalIdTableControl).ResetData = True + End Sub + + Protected Overridable Sub Control_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.PreRender + ' PreRender event is raised just before page is being displayed. + Try + DbUtils.StartTransaction() + Me.RegisterPostback() + + If Not Me.Page.ErrorOnPage AndAlso (Me.Page.IsPageRefresh OrElse Me.DataChanged OrElse Me.ResetData) Then + + + ' Re-load the data and update the web page if necessary. + ' This is typically done during a postback (filter, search button, sort, pagination button). + ' In each of the other click handlers, simply set DataChanged to True to reload the data. + Me.LoadData() + Me.DataBind() + End If + + + Catch ex As Exception + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + Finally + DbUtils.EndTransaction() + End Try + End Sub + + + Protected Overrides Sub SaveControlsToSession() + MyBase.SaveControlsToSession() + + + 'Save pagination state to session. + + End Sub + + + + Protected Overrides Sub ClearControlsFromSession() + MyBase.ClearControlsFromSession() + + + + ' Clear pagination state from session. + + End Sub + + Protected Overrides Sub LoadViewState(ByVal savedState As Object) + MyBase.LoadViewState(savedState) + Dim isNewRecord As String = CType(ViewState("IsNewRecord"), String) + If Not isNewRecord Is Nothing AndAlso isNewRecord.Trim <> "" Then + Me.IsNewRecord = Boolean.Parse(isNewRecord) + End If + + Dim myCheckSum As String = CType(ViewState("CheckSum"), String) + If Not myCheckSum Is Nothing AndAlso myCheckSum.Trim <> "" Then + Me.CheckSum = myCheckSum + End If + + + ' Load view state for pagination control. + + End Sub + + Protected Overrides Function SaveViewState() As Object + ViewState("IsNewRecord") = Me.IsNewRecord.ToString() + ViewState("CheckSum") = Me.CheckSum + + + ' Load view state for pagination control. + + Return MyBase.SaveViewState() + End Function + + + ' event handler for ImageButton + Public Overridable Sub PersonalIdRowCopyButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + ' The redirect URL is set on the Properties, Custom Properties or Actions. + ' The ModifyRedirectURL call resolves the parameters before the + ' Response.Redirect redirects the page to the URL. + ' Any code after the Response.Redirect call will not be executed, since the page is + ' redirected to the URL. + + + Dim url As String = "../PersonalId/AddPersonalId.aspx?PersonalId={PK}" + + Dim shouldRedirect As Boolean = True + Dim TargetKey As String = Nothing + Dim DFKA As String = TargetKey + Dim id As String = DFKA + Dim value As String = id + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + url = Me.ModifyRedirectUrl(url, "",False) + url = Me.Page.ModifyRedirectUrl(url, "",False) + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + shouldRedirect = False + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + If shouldRedirect Then + Me.Page.ShouldSaveControlsToSession = True + Me.Page.Response.Redirect(url) + ElseIf Not TargetKey Is Nothing AndAlso _ + Not shouldRedirect Then + Me.Page.ShouldSaveControlsToSession = True + Me.Page.CloseWindow(True) + + End If + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalIdRowDeleteButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + If(Not Me.Page.IsPageRefresh) Then + + Me.Delete() + + End If + Me.Page.CommitTransaction(sender) + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalIdRowEditButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + ' The redirect URL is set on the Properties, Custom Properties or Actions. + ' The ModifyRedirectURL call resolves the parameters before the + ' Response.Redirect redirects the page to the URL. + ' Any code after the Response.Redirect call will not be executed, since the page is + ' redirected to the URL. + + + Dim url As String = "../PersonalId/EditPersonalId.aspx?PersonalId={PK}" + + Dim shouldRedirect As Boolean = True + Dim TargetKey As String = Nothing + Dim DFKA As String = TargetKey + Dim id As String = DFKA + Dim value As String = id + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + url = Me.ModifyRedirectUrl(url, "",False) + url = Me.Page.ModifyRedirectUrl(url, "",False) + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + shouldRedirect = False + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + If shouldRedirect Then + Me.Page.ShouldSaveControlsToSession = True + Me.Page.Response.Redirect(url) + ElseIf Not TargetKey Is Nothing AndAlso _ + Not shouldRedirect Then + Me.Page.ShouldSaveControlsToSession = True + Me.Page.CloseWindow(True) + + End If + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalIdRowViewButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + ' The redirect URL is set on the Properties, Custom Properties or Actions. + ' The ModifyRedirectURL call resolves the parameters before the + ' Response.Redirect redirects the page to the URL. + ' Any code after the Response.Redirect call will not be executed, since the page is + ' redirected to the URL. + + + Dim url As String = "../PersonalId/ShowPersonalId.aspx?PersonalId={PK}" + + Dim shouldRedirect As Boolean = True + Dim TargetKey As String = Nothing + Dim DFKA As String = TargetKey + Dim id As String = DFKA + Dim value As String = id + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + url = Me.ModifyRedirectUrl(url, "",False) + url = Me.Page.ModifyRedirectUrl(url, "",False) + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + shouldRedirect = False + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + If shouldRedirect Then + Me.Page.ShouldSaveControlsToSession = True + Me.Page.Response.Redirect(url) + ElseIf Not TargetKey Is Nothing AndAlso _ + Not shouldRedirect Then + Me.Page.ShouldSaveControlsToSession = True + Me.Page.CloseWindow(True) + + End If + End Sub + + + 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("BasePersonalIdTableControlRow_Rec"), String) + End Get + Set(ByVal value As String) + Me.ViewState("BasePersonalIdTableControlRow_Rec") = value + End Set + End Property + + Private _DataSource As PersonalIdRecord + Public Property DataSource() As PersonalIdRecord + Get + Return Me._DataSource + End Get + + Set(ByVal value As PersonalIdRecord) + + Me._DataSource = value + End Set + End Property + + + + Private _checkSum As String + Public Overridable Property CheckSum() As String + Get + Return Me._checkSum + End Get + Set(ByVal value As String) + Me._checkSum = value + End Set + End Property + + Private _TotalPages As Integer + Public Property TotalPages() As Integer + Get + Return Me._TotalPages + End Get + Set(ByVal value As Integer) + Me._TotalPages = value + End Set + End Property + + Private _PageIndex As Integer + Public Property PageIndex() As Integer + Get + ' Return the PageIndex + Return Me._PageIndex + End Get + Set(ByVal value As Integer) + Me._PageIndex = value + End Set + End Property + + Private _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 PersonalId() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalId"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property PersonalIdRecordRowSelection() As System.Web.UI.WebControls.CheckBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalIdRecordRowSelection"), System.Web.UI.WebControls.CheckBox) + End Get + End Property + + Public ReadOnly Property PersonalIdRowCopyButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalIdRowCopyButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalIdRowDeleteButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalIdRowDeleteButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalIdRowEditButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalIdRowEditButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalIdRowViewButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalIdRowViewButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalLastName() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalLastName"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property PersonalName() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalName"), System.Web.UI.WebControls.Literal) + End Get + End Property + +#End Region + +#Region "Helper Functions" + + Public Overrides Overloads Function ModifyRedirectUrl(ByVal url As String, ByVal arg As String, ByVal bEncrypt As Boolean) As String + Return Me.Page.EvaluateExpressions(url, arg, bEncrypt, Me) + End Function + + Public Overrides Overloads Function EvaluateExpressions(ByVal url As String, ByVal arg As String, ByVal bEncrypt As Boolean) As String + + Dim rec As PersonalIdRecord = Nothing + + + Try + rec = Me.GetRecord() + Catch ex As Exception + ' Do nothing + End Try + + If rec Is Nothing AndAlso url.IndexOf("{") >= 0 Then + ' Localization. + + Throw New Exception(Page.GetResourceValue("Err:RecDataSrcNotInitialized", "Persons")) + + End If + Return EvaluateExpressions(url, arg, rec, bEncrypt) + End Function + + + Public Overridable Function GetRecord() As PersonalIdRecord + If Not Me.DataSource Is Nothing Then + Return Me.DataSource + End If + + If Not Me.RecordUniqueId Is Nothing Then + + Return PersonalIdTable.GetRecord(Me.RecordUniqueId, True) + + End If + + ' Localization. + + Throw New Exception(Page.GetResourceValue("Err:RetrieveRec", "Persons")) + + End Function + + Public Shadows ReadOnly Property Page() As BaseApplicationPage + Get + Return DirectCast(MyBase.Page, BaseApplicationPage) + End Get + End Property + +#End Region + +End Class + + + +' Base class for the PersonalIdTableControl control on the ShowPersonalTable page. +' Do not modify this class. Instead override any method in PersonalIdTableControl. +Public Class BasePersonalIdTableControl + Inherits Persons.UI.BaseApplicationTableControl + + + + Protected Overridable Sub Control_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Init + + + + ' Setup the filter and search events. + + AddHandler Me.ArmyIdFilter1.SelectedIndexChanged, AddressOf ArmyIdFilter1_SelectedIndexChanged + AddHandler Me.SectionIdFilter1.SelectedIndexChanged, AddressOf SectionIdFilter1_SelectedIndexChanged + If Not Me.Page.IsPostBack Then + Dim initialVal As String = "" + If Me.InSession(Me.ArmyIdFilter1) + initialVal = Me.GetFromSession(Me.ArmyIdFilter1) + + End If + + If initialVal <> "" + + Me.ArmyIdFilter1.Items.Add(New ListItem(initialVal, initialVal)) + + Me.ArmyIdFilter1.SelectedValue = initialVal + + End If + + End If + If Not Me.Page.IsPostBack Then + Dim initialVal As String = "" + If Me.InSession(Me.PersonalIdSearch1) + initialVal = Me.GetFromSession(Me.PersonalIdSearch1) + + End If + + If initialVal <> "" + + Me.PersonalIdSearch1.Text = initialVal + + End If + + End If + If Not Me.Page.IsPostBack Then + Dim initialVal As String = "" + If Me.InSession(Me.SectionIdFilter1) + initialVal = Me.GetFromSession(Me.SectionIdFilter1) + + End If + + If initialVal <> "" + + Me.SectionIdFilter1.Items.Add(New ListItem(initialVal, initialVal)) + + Me.SectionIdFilter1.SelectedValue = initialVal + + End If + + End If + + + ' Control Initializations. + ' Initialize the table's current sort order. + + If Me.InSession(Me, "Order_By") Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + End If + + + + ' Setup default pagination settings. + + Me.PageSize = CInt(Me.GetFromSession(Me, "Page_Size", "10")) + Me.PageIndex = CInt(Me.GetFromSession(Me, "Page_Index", "0")) + + + + Me.ClearControlsFromSession() + End Sub + + Protected Overridable Sub Control_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load + + SaveControlsToSession_Ajax() + + ' Show confirmation message on Click + Me.PersonalIdDeleteButton.Attributes.Add("onClick", "return (confirm('" & (CType(Me.Page,BaseApplicationPage)).GetResourceValue("DeleteConfirm", "Persons") & "'));") + + ' Setup the pagination events. + + AddHandler Me.PersonalIdPagination.FirstPage.Click, AddressOf PersonalIdPagination_FirstPage_Click + + AddHandler Me.PersonalIdPagination.LastPage.Click, AddressOf PersonalIdPagination_LastPage_Click + + AddHandler Me.PersonalIdPagination.NextPage.Click, AddressOf PersonalIdPagination_NextPage_Click + + AddHandler Me.PersonalIdPagination.PageSizeButton.Click, AddressOf PersonalIdPagination_PageSizeButton_Click + + AddHandler Me.PersonalIdPagination.PreviousPage.Click, AddressOf PersonalIdPagination_PreviousPage_Click + + + ' Setup the sorting events. + + AddHandler Me.PersonalIdLabel.Click, AddressOf PersonalIdLabel_Click + + AddHandler Me.PersonalLastNameLabel.Click, AddressOf PersonalLastNameLabel_Click + + AddHandler Me.PersonalNameLabel.Click, AddressOf PersonalNameLabel_Click + + ' Setup the button events. + + AddHandler Me.PersonalIdCopyButton.Click, AddressOf PersonalIdCopyButton_Click + + AddHandler Me.PersonalIdDeleteButton.Click, AddressOf PersonalIdDeleteButton_Click + + AddHandler Me.PersonalIdEditButton.Click, AddressOf PersonalIdEditButton_Click + + AddHandler Me.PersonalIdExportCSVButton.Click, AddressOf PersonalIdExportCSVButton_Click + + AddHandler Me.PersonalIdExportExcelButton.Click, AddressOf PersonalIdExportExcelButton_Click + + Me.PersonalIdImportButton.PostBackUrl = "../Shared/SelectFileToImport.aspx?TableName=PersonalId" + Me.PersonalIdImportButton.Attributes.Item("onClick") = "window.open('" & Me.Page.EncryptUrlParameter(Me.PersonalIdImportButton.PostBackUrl) & "','importWindow', 'width=700, height=500,top=' +(screen.availHeight-500)/2 + ',left=' + (screen.availWidth-700)/2+ ', resizable=yes, scrollbars=yes,modal=yes'); return false;" + + AddHandler Me.PersonalIdImportButton.Click, AddressOf PersonalIdImportButton_Click + + AddHandler Me.PersonalIdNewButton.Click, AddressOf PersonalIdNewButton_Click + + AddHandler Me.PersonalIdPDFButton.Click, AddressOf PersonalIdPDFButton_Click + + AddHandler Me.PersonalIdRefreshButton.Click, AddressOf PersonalIdRefreshButton_Click + + AddHandler Me.PersonalIdResetButton.Click, AddressOf PersonalIdResetButton_Click + + AddHandler Me.PersonalIdWordButton.Click, AddressOf PersonalIdWordButton_Click + + AddHandler Me.Button.Button.Click, AddressOf Button_Click + + AddHandler Me.PersonalIdSearchButton1.Button.Click, AddressOf PersonalIdSearchButton1_Click + + + ' Setup events for others + + End Sub + + + Public Overridable Sub LoadData() + + ' Read data from database. Returns an array of records that can be assigned + ' to the DataSource table control property. + Try + Dim joinFilter As CompoundFilter = CreateCompoundJoinFilter() + + ' The WHERE clause will be empty when displaying all records in table. + Dim wc As WhereClause = CreateWhereClause() + If wc IsNot Nothing AndAlso Not wc.RunQuery Then + ' Initialize an empty array of records + Dim alist As New ArrayList(0) + Me.DataSource = DirectCast(alist.ToArray(GetType(PersonalIdRecord)), PersonalIdRecord()) + ' Add records to the list if needed. + Me.AddNewRecords() + Me._TotalRecords = 0 + Me._TotalPages = 0 + Return + End If + + ' Call OrderBy to determine the order - either use the order defined + ' on the Query Wizard, or specified by user (by clicking on column heading) + Dim orderBy As OrderBy = CreateOrderBy() + + ' Get the pagesize from the pagesize control. + Me.GetPageSize() + + If Me.DisplayLastPage Then + Dim totalRecords As Integer = If(Me._TotalRecords < 0, PersonalIdTable.GetRecordCount(CreateCompoundJoinFilter(), CreateWhereClause()), Me._TotalRecords) + + Dim totalPages As Integer = CInt(Math.Ceiling(totalRecords / Me.PageSize)) + + Me.PageIndex = totalPages - 1 + End If + + ' Make sure PageIndex (current page) and PageSize are within bounds. + If Me.PageIndex < 0 Then + Me.PageIndex = 0 + End If + If Me.PageSize < 1 Then + Me.PageSize = 1 + End If + + ' Retrieve the records and set the table DataSource. + ' Only PageSize records are fetched starting at PageIndex (zero based). + If Me.AddNewRecord > 0 Then + ' Make sure to preserve the previously entered data on new rows. + Dim postdata As New ArrayList + For Each rc As PersonalIdTableControlRow In Me.GetRecordControls() + If Not rc.IsNewRecord Then + rc.DataSource = rc.GetRecord() + rc.GetUIData() + postdata.Add(rc.DataSource) + UIData.Add(rc.PreservedUIData()) + End If + Next + Me.DataSource = DirectCast(postdata.ToArray(GetType(PersonalIdRecord)), PersonalIdRecord()) + Else ' Get the records from the database + Me.DataSource = PersonalIdTable.GetRecords(joinFilter, wc, orderBy, Me.PageIndex, Me.PageSize) + + End If + + ' if the datasource contains no records contained in database, then load the last page. + If (DbUtils.GetCreatedRecords(Me.DataSource).Length = 0 AndAlso Not Me.DisplayLastPage) Then + Me.DisplayLastPage = True + LoadData() + Else + + ' Add any new rows desired by the user. + Me.AddNewRecords() + + ' Turn off the ToggleAll checkbox + Me.PersonalIdToggleAll.Checked = False + + + ' Initialize the page and grand totals. now + + End If + + Catch ex As Exception + ' Report the error message to the end user + Dim msg As String = ex.Message + If ex.InnerException IsNot Nothing Then + msg = msg & " InnerException: " & ex.InnerException.Message + End If + Throw New Exception(msg, ex.InnerException) + End Try + End Sub + + + + + Public Overrides Sub DataBind() + ' The DataBind method binds the user interface controls to the values + ' from the database record for each row in the table. To do this, it calls the + ' DataBind for each of the rows. + ' DataBind also populates any filters above the table, and sets the pagination + ' control to the correct number of records and the current page number. + + MyBase.DataBind() + + ' Make sure that the DataSource is initialized. + If Me.DataSource Is Nothing Then + Return + End If + + 'LoadData for DataSource for chart and report if they exist + + ' Setup the pagination controls. + BindPaginationControls() + + + + ' Bind the repeater with the list of records to expand the UI. + Dim rep As System.Web.UI.WebControls.Repeater = CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalIdTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return + rep.DataSource = DataSource() + rep.DataBind() + + Dim index As Integer = 0 + For Each repItem As System.Web.UI.WebControls.RepeaterItem In rep.Items + ' Loop through all rows in the table, set its DataSource and call DataBind(). + Dim recControl As PersonalIdTableControlRow = DirectCast(repItem.FindControl("PersonalIdTableControlRow"), PersonalIdTableControlRow) + recControl.DataSource = Me.DataSource(index) + If Me.UIData.Count > index Then + recControl.PreviousUIData = Me.UIData(index) + End If + recControl.DataBind() + recControl.Visible = Not Me.InDeletedRecordIds(recControl) + + index += 1 + Next + + + + + ' Call the Set methods for each controls on the panel + + SetArmyIdFilter1() + SetArmyIdLabel2() + + + + + + + + SetPersonalIdLabel() + + + + + + SetPersonalIdSearch1() + + SetPersonalIdTableControlCollapsibleRegion() + SetPersonalIdTableControlIcon() + SetPersonalIdTableControlPanelExtender() + + + + SetPersonalLastNameLabel() + SetPersonalNameLabel() + SetSectionIdFilter1() + SetSectionIdLabel2() + ' setting the state of expand or collapse alternative rows + + + ' Load data for each record and table UI control. + ' Ordering is important because child controls get + ' their parent ids from their parent UI controls. + + + ' this method calls the set method for controls with special formula like running total, sum, rank, etc + SetFormulaControls() + End Sub + + Public Overridable Sub SetFormulaControls() + ' this method calls Set methods for the control that has special formula + + + + End Sub + + + + Public Overridable Sub RegisterPostback() + + Me.Page.RegisterPostBackTrigger(MiscUtils.FindControlRecursively(Me,"PersonalIdExportCSVButton")) + + Me.Page.RegisterPostBackTrigger(MiscUtils.FindControlRecursively(Me,"PersonalIdExportExcelButton")) + + Me.Page.RegisterPostBackTrigger(MiscUtils.FindControlRecursively(Me,"PersonalIdPDFButton")) + + Me.Page.RegisterPostBackTrigger(MiscUtils.FindControlRecursively(Me,"PersonalIdWordButton")) + + + End Sub + + Public EvaluateFormulaDelegate As BaseClasses.Data.DataSource.EvaluateFormulaDelegate = New BaseClasses.Data.DataSource.EvaluateFormulaDelegate(AddressOf Me.EvaluateFormula) + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean, ByVal e as FormulaEvaluator) As String + If e Is Nothing + e = New FormulaEvaluator() + End If + + e.Variables.Clear() + + + ' add variables for formula evaluation + If variables IsNot Nothing Then + Dim enumerator As System.Collections.Generic.IEnumerator(Of System.Collections.Generic.KeyValuePair(Of String, Object)) = variables.GetEnumerator() + While enumerator.MoveNext() + e.Variables.Add(enumerator.Current.Key, enumerator.Current.Value) + End While + End If + + If includeDS + + End If + + ' All variables referred to in the formula are expected to be + ' properties of the DataSource. For example, referring to + ' UnitPrice as a variable will refer to DataSource.UnitPrice + e.DataSource = dataSourceForEvaluate + + ' Define the calling control. This is used to add other + ' related table and record controls as variables. + e.CallingControl = Me + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + + If Not String.IsNullOrEmpty(format) AndAlso (String.IsNullOrEmpty(formula) OrElse formula.IndexOf("Format(") < 0) Then + Return FormulaUtils.Format(resultObj, format) + Else + Return resultObj.ToString() + End If + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format,variables ,includeDS, Nothing) + End Function + + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object)) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format, variables ,True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, format, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal e as FormulaEvaluator) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, variables, True, e) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal includeDS as Boolean) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, includeDS, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, True, Nothing) + End Function + + + + + Public Overridable Sub ResetControl() + + Me.ArmyIdFilter1.ClearSelection() + + Me.SectionIdFilter1.ClearSelection() + + Me.PersonalIdSearch1.Text = "" + + Me.CurrentSortOrder.Reset() + If (Me.InSession(Me, "Order_By")) Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + End If + + Me.PageIndex = 0 + End Sub + + Protected Overridable Sub BindPaginationControls() + ' Setup the pagination controls. + + ' Bind the pagination labels. + + If DbUtils.GetCreatedRecords(Me.DataSource).Length > 0 Then + + Me.PersonalIdPagination.CurrentPage.Text = (Me.PageIndex + 1).ToString() + Else + Me.PersonalIdPagination.CurrentPage.Text = "0" + End If + Me.PersonalIdPagination.PageSize.Text = Me.PageSize.ToString() + Me.PersonalIdPagination.TotalItems.Text = Me.TotalRecords.ToString() + Me.PersonalIdPagination.TotalPages.Text = Me.TotalPages.ToString() + + ' Bind the buttons for PersonalIdTableControl pagination. + + Me.PersonalIdPagination.FirstPage.Enabled = Not (Me.PageIndex = 0) + If Me._TotalPages < 0 Then ' if the total pages is not determined yet, enable last and next buttons + Me.PersonalIdPagination.LastPage.Enabled = True + ElseIf Me._TotalPages = 0 ' if the total pages is determined and it is 0, enable last and next buttons + Me.PersonalIdPagination.LastPage.Enabled = False + Else ' if the total pages is the last page, disable last and next buttons + Me.PersonalIdPagination.LastPage.Enabled = Not (Me.PageIndex = Me.TotalPages - 1) + End If + + If Me._TotalPages < 0 Then ' if the total pages is not determined yet, enable last and next buttons + Me.PersonalIdPagination.NextPage.Enabled = True + ElseIf Me._TotalPages = 0 ' if the total pages is determined and it is 0, enable last and next buttons + Me.PersonalIdPagination.NextPage.Enabled = False + Else ' if the total pages is the last page, disable last and next buttons + Me.PersonalIdPagination.NextPage.Enabled = Not (Me.PageIndex = Me.TotalPages - 1) + End If + + Me.PersonalIdPagination.PreviousPage.Enabled = Not (Me.PageIndex = 0) + + + End Sub + + Public Overridable Sub SaveData() + ' Save the data from the entire table. Calls each row's Save Data + ' to save their data. This function is called by the Click handler of the + ' Save button. The button handler should Start/Commit/End a transaction. + + Dim recCtl As PersonalIdTableControlRow + For Each recCtl In Me.GetRecordControls() + + If Me.InDeletedRecordIds(recCtl) Then + ' Delete any pending deletes. + recCtl.Delete() + Else + If recCtl.Visible Then + recCtl.SaveData() + End If + End If + + Next + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + ' Set IsNewRecord to False for all records - since everything has been saved and is no longer "new" + For Each recCtl In Me.GetRecordControls() + recCtl.IsNewRecord = False + Next + + + ' Set DeletedRecordsIds to Nothing since we have deleted all pending deletes. + Me.DeletedRecordIds = Nothing + + End Sub + + Public Overridable Function CreateCompoundJoinFilter() As CompoundFilter + Dim jFilter As CompoundFilter = New CompoundFilter() + + Return jFilter + + End Function + + + Public Overridable Function CreateOrderBy() As OrderBy + ' The CurrentSortOrder is initialized to the sort order on the + ' Query Wizard. It may be modified by the Click handler for any of + ' the column heading to sort or reverse sort by that column. + ' You can add your own sort order, or modify it on the Query Wizard. + Return Me.CurrentSortOrder + End Function + + Public Overridable Function CreateWhereClause() As WhereClause + 'This CreateWhereClause is used for loading the data. + PersonalIdTable.Instance.InnerFilter = Nothing + Dim wc As WhereClause = New WhereClause() + + ' Compose the WHERE clause consiting of: + ' 1. Static clause defined at design time. + ' 2. User selected search criteria. + ' 3. User selected filter criteria. + + + If IsValueSelected(Me.ArmyIdFilter1) Then + + wc.iAND(PersonalIdTable.ArmyId, BaseFilter.ComparisonOperator.EqualsTo, MiscUtils.GetSelectedValue(Me.ArmyIdFilter1, Me.GetFromSession(Me.ArmyIdFilter1)), False, False) + + End If + + + + If IsValueSelected(Me.PersonalIdSearch1) Then + If Me.PersonalIdSearch1.Text = BaseClasses.Resources.AppResources.GetResourceValue("Txt:SearchForEllipsis", Nothing) Then + Me.PersonalIdSearch1.Text = "" + Else + ' Strip "..." from begin and ending of the search text, otherwise the search will return 0 values as in database "..." is not stored. + + If Me.PersonalIdSearch1.Text.StartsWith("...") Then + Me.PersonalIdSearch1.Text = Me.PersonalIdSearch1.Text.SubString(3,Me.PersonalIdSearch1.Text.Length-3) + End If + If Me.PersonalIdSearch1.Text.EndsWith("...") then + Me.PersonalIdSearch1.Text = Me.PersonalIdSearch1.Text.SubString(0,Me.PersonalIdSearch1.Text.Length-3) + ' Strip the last word as well as it is likely only a partial word + Dim endindex As Integer = PersonalIdSearch1.Text.Length - 1 + While (Not Char.IsWhiteSpace(PersonalIdSearch1.Text(endindex)) AndAlso endindex > 0) + endindex -= 1 + End While + If endindex > 0 Then + PersonalIdSearch1.Text = PersonalIdSearch1.Text.Substring(0, endindex) + End If + End If + End If + + Dim formatedSearchText As String = MiscUtils.GetSelectedValue(Me.PersonalIdSearch1, Me.GetFromSession(Me.PersonalIdSearch1)) + + ' After stripping "..." see if the search text is null or empty. + If IsValueSelected(Me.PersonalIdSearch1) Then + ' These clauses are added depending on operator and fields selected in Control's property page, bindings tab. + + Dim search As WhereClause = New WhereClause() + + search.iOR(PersonalIdTable.PersonalId, BaseFilter.ComparisonOperator.Contains, MiscUtils.GetSelectedValue(Me.PersonalIdSearch1, Me.GetFromSession(Me.PersonalIdSearch1)), True, False) + + wc.iAND(search) + + End If + End If + + If IsValueSelected(Me.SectionIdFilter1) Then + + wc.iAND(PersonalIdTable.SectionId, BaseFilter.ComparisonOperator.EqualsTo, MiscUtils.GetSelectedValue(Me.SectionIdFilter1, Me.GetFromSession(Me.SectionIdFilter1)), False, False) + + End If + + + + Return wc + End Function + + + Public Overridable Function CreateWhereClause(ByVal searchText as String, ByVal fromSearchControl as String, ByVal AutoTypeAheadSearch as String, ByVal AutoTypeAheadWordSeparators as String) As WhereClause + ' This CreateWhereClause is used for loading list of suggestions for Auto Type-Ahead feature. + PersonalIdTable.Instance.InnerFilter = Nothing + Dim wc As WhereClause = New WhereClause() + + ' Compose the WHERE clause consiting of: + ' 1. Static clause defined at design time. + ' 2. User selected search criteria. + ' 3. User selected filter criteria. + + Dim appRelativeVirtualPath As String = CType(HttpContext.Current.Session("AppRelativeVirtualPath"), String) + + ' Adds clauses if values are selected in Filter controls which are configured in the page. + + Dim ArmyIdFilter1SelectedValue As String = CType(HttpContext.Current.Session()(HttpContext.Current.Session.SessionID & appRelativeVirtualPath & "ArmyIdFilter1_Ajax"), String) + If IsValueSelected(ArmyIdFilter1SelectedValue) Then + + wc.iAND(PersonalIdTable.ArmyId, BaseFilter.ComparisonOperator.EqualsTo, ArmyIdFilter1SelectedValue, false, False) + + End If + + If IsValueSelected(searchText) and fromSearchControl = "PersonalIdSearch1" Then + Dim formatedSearchText as String = searchText + ' Strip "..." from begin and ending of the search text, otherwise the search will return 0 values as in database "..." is not stored. + If searchText.StartsWith("...") Then + formatedSearchText = searchText.SubString(3,searchText.Length-3) + End If + If searchText.EndsWith("...") Then + formatedSearchText = searchText.SubString(0,searchText.Length-3) + ' Strip the last word as well as it is likely only a partial word + Dim endindex As Integer = searchText.Length - 1 + While (Not Char.IsWhiteSpace(searchText(endindex)) AndAlso endindex > 0) + endindex -= 1 + End While + If endindex > 0 Then + searchText = searchText.Substring(0, endindex) + End If + End If + 'After stripping "...", trim any leading and trailing whitespaces + formatedSearchText = formatedSearchText.Trim() + ' After stripping "..." see if the search text is null or empty. + If IsValueSelected(formatedSearchText) Then + ' These clauses are added depending on operator and fields selected in Control's property page, bindings tab. + + Dim search As WhereClause = New WhereClause() + + If InvariantLCase(AutoTypeAheadSearch).equals("wordsstartingwithsearchstring") Then + + search.iOR(PersonalIdTable.PersonalId, BaseFilter.ComparisonOperator.Starts_With, formatedSearchText, True, False) + search.iOR(PersonalIdTable.PersonalId, BaseFilter.ComparisonOperator.Contains, AutoTypeAheadWordSeparators & formatedSearchText, True, False) + + Else + + search.iOR(PersonalIdTable.PersonalId, BaseFilter.ComparisonOperator.Contains, formatedSearchText, True, False) + End If + wc.iAND(search) + + End If + End If + + Dim SectionIdFilter1SelectedValue As String = CType(HttpContext.Current.Session()(HttpContext.Current.Session.SessionID & appRelativeVirtualPath & "SectionIdFilter1_Ajax"), String) + If IsValueSelected(SectionIdFilter1SelectedValue) Then + + wc.iAND(PersonalIdTable.SectionId, BaseFilter.ComparisonOperator.EqualsTo, SectionIdFilter1SelectedValue, false, False) + + End If + + + Return wc + End Function + + Public Overridable Function GetAutoCompletionList_PersonalIdSearch1(ByVal prefixText As String, ByVal count As Integer) As String() + Dim resultList As ArrayList = New ArrayList + Dim wordList As ArrayList = New ArrayList + Dim iteration As Integer = 0 + + Dim filterJoin As CompoundFilter = CreateCompoundJoinFilter() + Dim wc As WhereClause = CreateWhereClause(prefixText,"PersonalIdSearch1", "WordsStartingWithSearchString", "[^a-zA-Z0-9]") + While (resultList.Count < count AndAlso iteration < 5) + ' Fetch 100 records in each iteration + Dim recordList () As Persons.Business.PersonalIdRecord = PersonalIdTable.GetRecords(filterJoin, wc, Nothing, iteration, 100) + Dim rec As PersonalIdRecord = Nothing + Dim resultItem As String = "" + For Each rec In recordList + ' Exit the loop if recordList count has reached AutoTypeAheadListSize. + If resultList.Count >= count then + Exit For + End If + ' If the field is configured to Display as Foreign key, Format() method returns the + ' Display as Forien Key value instead of original field value. + ' Since search had to be done in multiple fields (selected in Control's page property, binding tab) in a record, + ' We need to find relevent field to display which matches the prefixText and is not already present in the result list. + + resultItem = rec.Format(PersonalIdTable.PersonalId) + If resultItem IsNot Nothing AndAlso resultItem.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture).Contains(prefixText.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture)) Then + + Dim isAdded As Boolean = FormatSuggestions(prefixText, resultItem, 50, "AtBeginningOfMatchedString", "WordsStartingWithSearchString", "[^a-zA-Z0-9]", resultList) + If isAdded Then + Continue For + End If + End If + + Next + ' Exit the loop if number of records found is less as further iteration will not return any more records + If recordList .Length < 100 Then + Exit While + End If + iteration += 1 + End While + + resultList.Sort() + Dim result() As String = New String(resultList.Count - 1) {} + Array.Copy(resultList.ToArray, result, resultList.Count) + Return result + End Function + + + Public Overridable Function FormatSuggestions(ByVal prefixText As String, ByVal resultItem As String, _ + ByVal columnLength As Integer, ByVal AutoTypeAheadDisplayFoundText As String, _ + ByVal autoTypeAheadSearch As String, ByVal AutoTypeAheadWordSeparators As String, _ + ByVal resultList As ArrayList) As Boolean + + 'Formats the resultItem and adds it to the list of suggestions. + Dim index As Integer = resultItem.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture).IndexOf(prefixText.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture)) + Dim itemToAdd As String = "" + Dim isFound As Boolean = False + Dim isAdded As Boolean = False + ' Get the index where prfixt is at the beginning of resultItem. If not found then, index of word which begins with prefixText. + If InvariantLCase(autoTypeAheadSearch).equals("wordsstartingwithsearchstring") And Not index = 0 Then + ' Expression to find word which contains AutoTypeAheadWordSeparators followed by prefixText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex( AutoTypeAheadWordSeparators + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + If regex1.IsMatch(resultItem) Then + index = regex1.Match(resultItem).Index + isFound = True + End If + ' If the prefixText is found immediatly after white space then starting of the word is found so don not search any further + If not resultItem(index).ToString() = " " Then + ' Expression to find beginning of the word which contains AutoTypeAheadWordSeparators followed by prefixText + Dim regex As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\\S*" + AutoTypeAheadWordSeparators + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + If regex.IsMatch(resultItem) Then + index = regex.Match(resultItem).Index + isFound = True + End If + End If + End If + + ' If autoTypeAheadSearch value is wordsstartingwithsearchstring then, extract the substring only if the prefixText is found at the + ' beginning of the resultItem (index = 0) or a word in resultItem is found starts with prefixText. + If index = 0 Or isFound Or InvariantLCase(autoTypeAheadSearch).Equals("anywhereinstring") then + If InvariantLCase(AutoTypeAheadDisplayFoundText).equals("atbeginningofmatchedstring") Then + ' Expression to find beginning of the word which contains prefixText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\\S*" + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + ' Find the beginning of the word which contains prefexText + If (StringUtils.InvariantLCase(autoTypeAheadSearch).Equals("anywhereinstring") AndAlso regex1.IsMatch(resultItem)) Then + index = regex1.Match(resultItem).Index + isFound = True + End If + ' Display string from the index till end of the string if sub string from index till end is less than columnLength value. + If Len(resultItem) - index <= columnLength Then + If index = 0 Then + itemToAdd = resultItem + Else + itemToAdd = "..." & resultItem.Substring(index, Len(resultItem) - index) + End If + Else + If index = 0 Then + itemToAdd = resultItem.Substring(index, (columnLength - 3)) & "..." + Else + 'Truncate the string to show only columnLength - 6 characters as begining and trailing "..." has to be appended. + itemToAdd = "..." & resultItem.Substring(index , columnLength - 6) & "..." + End If + End If + ElseIf InvariantLCase(AutoTypeAheadDisplayFoundText).equals("inmiddleofmatchedstring") Then + Dim subStringBeginIndex As Integer = CType(columnLength/2, Integer) + If Len(resultItem) <= columnLength Then + itemToAdd = resultItem + Else + ' Sanity check at end of the string + If index + Len(prefixText) = columnLength Then + itemToAdd = "..." & resultItem.Substring(index-columnLength,index) + ElseIf Len(resultItem) - index < subStringBeginIndex Then + ' Display string from the end till columnLength value if, index is closer to the end of the string. + itemToAdd = "..." & resultItem.Substring(Len(resultItem)-columnLength,Len(resultItem)) + ElseIf index <= subStringBeginIndex Then + ' Sanity chet at beginning of the string + itemToAdd = resultItem.Substring(0, columnLength) & "..." + Else + ' Display string containing text before the prefixText occures and text after the prefixText + itemToAdd = "..." & resultItem.Substring(index - subStringBeginIndex, columnLength) & "..." + End If + End If + ElseIf InvariantLCase(AutoTypeAheadDisplayFoundText).equals("atendofmatchedstring") Then + ' Expression to find ending of the word which contains prefexText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\s", System.Text.RegularExpressions.RegexOptions.IgnoreCase) + ' Find the ending of the word which contains prefexText + If regex1.IsMatch(resultItem, index + 1) Then + index = regex1.Match(resultItem, index + 1).Index + Else + ' If the word which contains prefexText is the last word in string, regex1.IsMatch returns false. + index = resultItem.Length + End If + If index > Len(resultItem) Then + index = Len(resultItem) + End If + ' If text from beginning of the string till index is less than columnLength value then, display string from the beginning till index. + If index <= columnLength Then + if index = Len(resultItem) Then 'Make decision to append "..." + itemToAdd = resultItem.Substring(0,index) + Else + itemToAdd = resultItem.Substring(0,index) & "..." + End If + Else + If index = Len(resultItem) Then + itemToAdd = "..." & resultItem.Substring(index - (columnLength - 3), (columnLength - 3)) + Else + 'Truncate the string to show only columnLength - 6 characters as begining and trailing "..." has to be appended. + itemToAdd = "..." & resultItem.Substring(index - (columnLength - 6), columnLength - 6) & "..." + End If + End If + End If + + ' Remove newline character from itemToAdd + Dim prefixTextIndex As Integer = itemToAdd.IndexOf(prefixText, StringComparison.CurrentCultureIgnoreCase) + ' If itemToAdd contains any newline after the search text then show text only till newline + Dim regex2 As System.Text.RegularExpressions.Regex = New System.Text.RegularExpressions.Regex("(" & vbCrLf & "|" & vbLf & ")", System.Text.RegularExpressions.RegexOptions.IgnoreCase) + Dim newLineIndexAfterPrefix As Integer = -1 + If regex2.IsMatch(itemToAdd, prefixTextIndex) Then + newLineIndexAfterPrefix = regex2.Match(itemToAdd, prefixTextIndex).Index + End If + If (newLineIndexAfterPrefix > -1) Then + If itemToAdd.EndsWith("...") Then + itemToAdd = (itemToAdd.Substring(0, newLineIndexAfterPrefix) + "...") + Else + itemToAdd = itemToAdd.Substring(0, newLineIndexAfterPrefix) + End If + End If + ' If itemToAdd contains any newline before search text then show text which comes after newline + Dim regex3 As System.Text.RegularExpressions.Regex = New System.Text.RegularExpressions.Regex("(" & vbCrLf & "|" & vbLf & ")", (System.Text.RegularExpressions.RegexOptions.IgnoreCase Or System.Text.RegularExpressions.RegexOptions.RightToLeft)) + Dim newLineIndexBeforePrefix As Integer = -1 + If regex3.IsMatch(itemToAdd, prefixTextIndex) Then + newLineIndexBeforePrefix = regex3.Match(itemToAdd, prefixTextIndex).Index + End If + If (newLineIndexBeforePrefix > -1) Then + If itemToAdd.StartsWith("...") Then + itemToAdd = ("..." + itemToAdd.Substring((newLineIndexBeforePrefix + regex3.Match(itemToAdd, prefixTextIndex).Length))) + Else + itemToAdd = itemToAdd.Substring((newLineIndexBeforePrefix + regex3.Match(itemToAdd, prefixTextIndex).Length)) + End If + End If + + If Not itemToAdd is nothing AndAlso Not resultList.Contains(itemToAdd) Then + + resultList.Add(itemToAdd) + + isAdded = true + End If + End If + Return isAdded + End Function + + + Protected Overridable Sub GetPageSize() + + If Me.PersonalIdPagination.PageSize.Text.Trim <> "" Then + Try + 'Me.PageSize = Integer.Parse(Me.PersonalIdPagination.PageSize.Text) + Catch ex As Exception + End Try + End If + End Sub + + Protected Overridable Sub AddNewRecords() + + Dim newRecordList As ArrayList = New ArrayList() + + Dim newUIDataList As System.Collections.Generic.List(Of Hashtable) = New System.Collections.Generic.List(Of Hashtable)() + + ' Loop though all the record controls and if the record control + ' does not have a unique record id set, then create a record + ' and add to the list. + If Not Me.ResetData Then + Dim rep As System.Web.UI.WebControls.Repeater = CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalIdTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return + + Dim repItem As System.Web.UI.WebControls.RepeaterItem + For Each repItem In rep.Items + ' Loop through all rows in the table, set its DataSource and call DataBind(). + + Dim recControl As PersonalIdTableControlRow = DirectCast(repItem.FindControl("PersonalIdTableControlRow"), PersonalIdTableControlRow) + + If recControl.Visible AndAlso recControl.IsNewRecord() Then + + Dim rec As PersonalIdRecord = New PersonalIdRecord() + + If recControl.PersonalId.Text <> "" Then + rec.Parse(recControl.PersonalId.Text, PersonalIdTable.PersonalId) + End If + If recControl.PersonalLastName.Text <> "" Then + rec.Parse(recControl.PersonalLastName.Text, PersonalIdTable.PersonalLastName) + End If + If recControl.PersonalName.Text <> "" Then + rec.Parse(recControl.PersonalName.Text, PersonalIdTable.PersonalName) + End If + newUIDataList.Add(recControl.PreservedUIData()) + newRecordList.Add(rec) + End If + Next + End If + + + ' Add any new record to the list. + Dim index As Integer = 0 + For index = 1 To Me.AddNewRecord + + newRecordList.Insert(0, New PersonalIdRecord()) + newUIDataList.Insert(0, New Hashtable()) + + Next + Me.AddNewRecord = 0 + + ' Finally, add any new records to the DataSource. + If newRecordList.Count > 0 Then + + Dim finalList As ArrayList = New ArrayList(Me.DataSource) + finalList.InsertRange(0, newRecordList) + + Me.DataSource = DirectCast(finalList.ToArray(GetType(PersonalIdRecord)), PersonalIdRecord()) + + End If + + ' Add the existing UI data to this hash table + If newUIDataList.Count > 0 Then + Me.UIData.InsertRange(0, newUIDataList) + End If + + End Sub + + + Public Sub AddToDeletedRecordIds(ByVal rec As PersonalIdTableControlRow) + If rec.IsNewRecord() Then + Return + End If + + If Not Me.DeletedRecordIds Is Nothing AndAlso Me.DeletedRecordIds.Trim <> "" Then + Me.DeletedRecordIds &= "," + End If + + Me.DeletedRecordIds &= "[" & rec.RecordUniqueId & "]" + End Sub + + Protected Overridable Function InDeletedRecordIds(ByVal rec As PersonalIdTableControlRow) As Boolean + If Me.DeletedRecordIds Is Nothing OrElse Me.DeletedRecordIds.Trim = "" Then + Return False + End If + + Return Me.DeletedRecordIds.IndexOf("[" & rec.RecordUniqueId & "]") >= 0 + End Function + + Private _DeletedRecordIds As String + Public Property DeletedRecordIds() As String + Get + Return Me._DeletedRecordIds + End Get + Set(ByVal value As String) + Me._DeletedRecordIds = value + End Set + End Property + + + ' Create Set, WhereClause, and Populate Methods + + Public Overridable Sub SetArmyIdLabel2() + + End Sub + + Public Overridable Sub SetPersonalIdLabel() + + End Sub + + Public Overridable Sub SetPersonalIdTableControlCollapsibleRegion() + + End Sub + + Public Overridable Sub SetPersonalIdTableControlIcon() + + End Sub + + Public Overridable Sub SetPersonalIdTableControlPanelExtender() + + End Sub + + Public Overridable Sub SetPersonalLastNameLabel() + + End Sub + + Public Overridable Sub SetPersonalNameLabel() + + End Sub + + Public Overridable Sub SetSectionIdLabel2() + + End Sub + + Public Overridable Sub SetArmyIdFilter1() + + Me.PopulateArmyIdFilter1(GetSelectedValue(Me.ArmyIdFilter1, GetFromSession(Me.ArmyIdFilter1)), 500) + + End Sub + + Public Overridable Sub SetPersonalIdSearch1() + + End Sub + + Public Overridable Sub SetSectionIdFilter1() + + Me.PopulateSectionIdFilter1(GetSelectedValue(Me.SectionIdFilter1, GetFromSession(Me.SectionIdFilter1)), 500) + + End Sub + + ' Get the filters' data for ArmyIdFilter1 + Protected Overridable Sub PopulateArmyIdFilter1(ByVal selectedValue As String, ByVal maxItems As Integer) + + + Me.ArmyIdFilter1.Items.Clear() + + + + ' Set up the WHERE and the ORDER BY clause by calling the CreateWhereClause_ArmyIdFilter1 function. + ' It is better to customize the where clause there. + + + + 'Setup the WHERE clause. + Dim wc As WhereClause = Me.CreateWhereClause_ArmyIdFilter1() + + ' Setup the static list items + + ' Add the All item. + Me.ArmyIdFilter1.Items.Insert(0, new ListItem(Me.Page.GetResourceValue("Txt:All", "Persons"), "--ANY--")) + + + Dim orderBy As OrderBy = New OrderBy(false, false) + orderBy.Add(ArmyTable.Army, OrderByItem.OrderDir.Asc) + + Dim variables As System.Collections.Generic.IDictionary(Of String, Object) = New System.Collections.Generic.Dictionary(Of String, Object) + + + + Dim noValueFormat As String = Page.GetResourceValue("Txt:Other", "Persons") + + + Dim itemValues() As ArmyRecord = Nothing + + If wc.RunQuery + Dim counter As Integer = 0 + Dim pageNum As Integer = 0 + Dim evaluator As New FormulaEvaluator + Dim listDuplicates As New ArrayList() + + + + Do + + itemValues = ArmyTable.GetRecords(wc, orderBy, pageNum, maxItems) + + For each itemValue As ArmyRecord In itemValues + ' Create the item and add to the list. + Dim cvalue As String = Nothing + Dim fvalue As String = Nothing + If itemValue.ArmyIdSpecified Then + cvalue = itemValue.ArmyId.ToString() + + If counter < maxItems AndAlso Me.ArmyIdFilter1.Items.FindByValue(cvalue) Is Nothing Then + + Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalIdTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalIdTable.ArmyId) + If _isExpandableNonCompositeForeignKey AndAlso PersonalIdTable.ArmyId.IsApplyDisplayAs Then + fvalue = PersonalIdTable.GetDFKA(itemValue, PersonalIdTable.ArmyId) + End If + If (Not _isExpandableNonCompositeForeignKey) Or (String.IsNullOrEmpty(fvalue)) Then + fvalue = itemValue.Format(ArmyTable.Army) + 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.ArmyIdFilter1.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.ArmyIdFilter1.Items.Add(newItem) + + If listDuplicates.Contains(fvalue) Then + newItem.Text = fvalue & " (ID " & cvalue.Substring(0, Math.Min(cvalue.Length,38)) & ")" + End If + + counter += 1 + End If + End If + Next + pageNum += 1 + Loop While (itemValues.Length = maxItems AndAlso counter < maxItems) + End If + + + + + + + ' Set the selected value. + SetSelectedValue(Me.ArmyIdFilter1, selectedValue) + + + End Sub + + ' Get the filters' data for SectionIdFilter1 + Protected Overridable Sub PopulateSectionIdFilter1(ByVal selectedValue As String, ByVal maxItems As Integer) + + + Me.SectionIdFilter1.Items.Clear() + + + + ' Set up the WHERE and the ORDER BY clause by calling the CreateWhereClause_SectionIdFilter1 function. + ' It is better to customize the where clause there. + + + + 'Setup the WHERE clause. + Dim wc As WhereClause = Me.CreateWhereClause_SectionIdFilter1() + + ' Setup the static list items + + ' Add the All item. + Me.SectionIdFilter1.Items.Insert(0, new ListItem(Me.Page.GetResourceValue("Txt:All", "Persons"), "--ANY--")) + + + Dim orderBy As OrderBy = New OrderBy(false, false) + orderBy.Add(SectionTable.SectionName, OrderByItem.OrderDir.Asc) + + Dim variables As System.Collections.Generic.IDictionary(Of String, Object) = New System.Collections.Generic.Dictionary(Of String, Object) + + + + Dim noValueFormat As String = Page.GetResourceValue("Txt:Other", "Persons") + + + Dim itemValues() As SectionRecord = Nothing + + If wc.RunQuery + Dim counter As Integer = 0 + Dim pageNum As Integer = 0 + Dim evaluator As New FormulaEvaluator + Dim listDuplicates As New ArrayList() + + + + Do + + itemValues = SectionTable.GetRecords(wc, orderBy, pageNum, maxItems) + + For each itemValue As SectionRecord In itemValues + ' Create the item and add to the list. + Dim cvalue As String = Nothing + Dim fvalue As String = Nothing + If itemValue.SectionIdSpecified Then + cvalue = itemValue.SectionId.ToString() + + If counter < maxItems AndAlso Me.SectionIdFilter1.Items.FindByValue(cvalue) Is Nothing Then + + Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalIdTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalIdTable.SectionId) + If _isExpandableNonCompositeForeignKey AndAlso PersonalIdTable.SectionId.IsApplyDisplayAs Then + fvalue = PersonalIdTable.GetDFKA(itemValue, PersonalIdTable.SectionId) + End If + If (Not _isExpandableNonCompositeForeignKey) Or (String.IsNullOrEmpty(fvalue)) Then + fvalue = itemValue.Format(SectionTable.SectionName) + 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.SectionIdFilter1.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.SectionIdFilter1.Items.Add(newItem) + + If listDuplicates.Contains(fvalue) Then + newItem.Text = fvalue & " (ID " & cvalue.Substring(0, Math.Min(cvalue.Length,38)) & ")" + End If + + counter += 1 + End If + End If + Next + pageNum += 1 + Loop While (itemValues.Length = maxItems AndAlso counter < maxItems) + End If + + + + + + + ' Set the selected value. + SetSelectedValue(Me.SectionIdFilter1, selectedValue) + + + End Sub + + Public Overridable Function CreateWhereClause_ArmyIdFilter1() As WhereClause + + ' Create a where clause for the filter ArmyIdFilter1. + ' This function is called by the Populate method to load the items + ' in the ArmyIdFilter1DropDownList + + Dim wc As WhereClause= New WhereClause() + Return wc + + End Function + + Public Overridable Function CreateWhereClause_SectionIdFilter1() As WhereClause + + ' Create a where clause for the filter SectionIdFilter1. + ' This function is called by the Populate method to load the items + ' in the SectionIdFilter1DropDownList + + Dim wc As WhereClause= New WhereClause() + Return wc + + End Function + + + + + Protected Overridable Sub Control_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.PreRender + ' PreRender event is raised just before page is being displayed. + Try + DbUtils.StartTransaction + Me.RegisterPostback() + + If Not Me.Page.ErrorOnPage AndAlso (Me.Page.IsPageRefresh OrElse Me.DataChanged OrElse Me.ResetData) Then + + + ' Re-load the data and update the web page if necessary. + ' This is typically done during a postback (filter, search button, sort, pagination button). + ' In each of the other click handlers, simply set DataChanged to True to reload the data. + + Me.LoadData() + Me.DataBind() + + End If + + + + Catch ex As Exception + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + Finally + DbUtils.EndTransaction + End Try + End Sub + + + Protected Overrides Sub SaveControlsToSession() + MyBase.SaveControlsToSession() + + ' Save filter controls to values to session. + + Me.SaveToSession(Me.ArmyIdFilter1, Me.ArmyIdFilter1.SelectedValue) + + Me.SaveToSession(Me.PersonalIdSearch1, Me.PersonalIdSearch1.Text) + + Me.SaveToSession(Me.SectionIdFilter1, Me.SectionIdFilter1.SelectedValue) + + + 'Save pagination state to session. + + + + ' Save table control properties to the session. + If Not Me.CurrentSortOrder Is Nothing Then + Me.SaveToSession(Me, "Order_By", Me.CurrentSortOrder.ToXmlString()) + End If + + Me.SaveToSession(Me, "Page_Index", Me.PageIndex.ToString()) + Me.SaveToSession(Me, "Page_Size", Me.PageSize.ToString()) + + Me.SaveToSession(Me, "DeletedRecordIds", Me.DeletedRecordIds) + + End Sub + + Protected Sub SaveControlsToSession_Ajax() + ' Save filter controls to values to session. + + Me.SaveToSession("ArmyIdFilter1_Ajax", Me.ArmyIdFilter1.SelectedValue) + + Me.SaveToSession("PersonalIdSearch1_Ajax", Me.PersonalIdSearch1.Text) + + Me.SaveToSession("SectionIdFilter1_Ajax", Me.SectionIdFilter1.SelectedValue) + + HttpContext.Current.Session("AppRelativeVirtualPath") = Me.Page.AppRelativeVirtualPath + + End Sub + + Protected Overrides Sub ClearControlsFromSession() + MyBase.ClearControlsFromSession() + + ' Clear filter controls values from the session. + + Me.RemoveFromSession(Me.ArmyIdFilter1) + Me.RemoveFromSession(Me.PersonalIdSearch1) + Me.RemoveFromSession(Me.SectionIdFilter1) + + ' Clear pagination state from session. + + + + ' Clear table properties from the session. + Me.RemoveFromSession(Me, "Order_By") + Me.RemoveFromSession(Me, "Page_Index") + Me.RemoveFromSession(Me, "Page_Size") + + Me.RemoveFromSession(Me, "DeletedRecordIds") + + End Sub + + Protected Overrides Sub LoadViewState(ByVal savedState As Object) + MyBase.LoadViewState(savedState) + + Dim orderByStr As String = CType(ViewState("PersonalIdTableControl_OrderBy"), String) + + If orderByStr IsNot Nothing AndAlso orderByStr.Trim <> "" Then + Me.CurrentSortOrder = BaseClasses.Data.OrderBy.FromXmlString(orderByStr) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + End If + + Dim pageIndex As String = CType(ViewState("Page_Index"), String) + If pageIndex IsNot Nothing Then + Me.PageIndex = CInt(pageIndex) + End If + + Dim pageSize As String = CType(ViewState("Page_Size"), String) + If Not pageSize Is Nothing Then + Me.PageSize = CInt(pageSize) + End If + + + + ' Load view state for pagination control. + + Me.DeletedRecordIds = CType(Me.ViewState("DeletedRecordIds"), String) + + End Sub + + Protected Overrides Function SaveViewState() As Object + + If Me.CurrentSortOrder IsNot Nothing Then + Me.ViewState("PersonalIdTableControl_OrderBy") = Me.CurrentSortOrder.ToXmlString() + End If + + Me.ViewState("Page_Index") = Me.PageIndex + Me.ViewState("Page_Size") = Me.PageSize + + Me.ViewState("DeletedRecordIds") = Me.DeletedRecordIds + + + ' Load view state for pagination control. + + + Return MyBase.SaveViewState() + End Function + + ' Generate the event handling functions for pagination events. + + ' event handler for ImageButton + Public Overridable Sub PersonalIdPagination_FirstPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.PageIndex = 0 + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalIdPagination_LastPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.DisplayLastPage = True + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalIdPagination_NextPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.PageIndex += 1 + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for LinkButton + Public Overridable Sub PersonalIdPagination_PageSizeButton_Click(ByVal sender As Object, ByVal args As EventArgs) + + Try + + Me.DataChanged = True + + Me.PageSize = Integer.Parse(Me.PersonalIdPagination.PageSize.Text) + + Me.PageIndex = Integer.Parse(Me.PersonalIdPagination.CurrentPage.Text) - 1 + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalIdPagination_PreviousPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + If Me.PageIndex > 0 Then + Me.PageIndex -= 1 + Me.DataChanged = True + End If + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + + ' Generate the event handling functions for sorting events. + + Public Overridable Sub PersonalIdLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by PersonalId when clicked. + + ' Get previous sorting state for PersonalId. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalIdTable.PersonalId) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for PersonalId. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalIdTable.PersonalId, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by PersonalId, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub PersonalLastNameLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by PersonalLastName when clicked. + + ' Get previous sorting state for PersonalLastName. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalIdTable.PersonalLastName) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for PersonalLastName. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalIdTable.PersonalLastName, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by PersonalLastName, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub PersonalNameLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by PersonalName when clicked. + + ' Get previous sorting state for PersonalName. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalIdTable.PersonalName) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for PersonalName. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalIdTable.PersonalName, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by PersonalName, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + + ' Generate the event handling functions for button events. + + ' event handler for ImageButton + Public Overridable Sub PersonalIdCopyButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + ' The redirect URL is set on the Properties, Custom Properties or Actions. + ' The ModifyRedirectURL call resolves the parameters before the + ' Response.Redirect redirects the page to the URL. + ' Any code after the Response.Redirect call will not be executed, since the page is + ' redirected to the URL. + + + Dim url As String = "../PersonalId/AddPersonalId.aspx?PersonalId={PK}" + + Dim shouldRedirect As Boolean = True + Dim TargetKey As String = Nothing + Dim DFKA As String = TargetKey + Dim id As String = DFKA + Dim value As String = id + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + url = Me.ModifyRedirectUrl(url, "",False) + url = Me.Page.ModifyRedirectUrl(url, "",False) + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + shouldRedirect = False + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + If shouldRedirect Then + Me.Page.ShouldSaveControlsToSession = True + Me.Page.Response.Redirect(url) + ElseIf Not TargetKey Is Nothing AndAlso _ + Not shouldRedirect Then + Me.Page.ShouldSaveControlsToSession = True + Me.Page.CloseWindow(True) + + End If + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalIdDeleteButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + If(Not Me.Page.IsPageRefresh) Then + + Me.DeleteSelectedRecords(False) + Me.SetFormulaControls() + + + End If + Me.Page.CommitTransaction(sender) + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalIdEditButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + ' The redirect URL is set on the Properties, Custom Properties or Actions. + ' The ModifyRedirectURL call resolves the parameters before the + ' Response.Redirect redirects the page to the URL. + ' Any code after the Response.Redirect call will not be executed, since the page is + ' redirected to the URL. + + + Dim url As String = "../PersonalId/EditPersonalId.aspx?PersonalId={PK}" + + Dim shouldRedirect As Boolean = True + Dim TargetKey As String = Nothing + Dim DFKA As String = TargetKey + Dim id As String = DFKA + Dim value As String = id + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + url = Me.ModifyRedirectUrl(url, "",False) + url = Me.Page.ModifyRedirectUrl(url, "",False) + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + shouldRedirect = False + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + If shouldRedirect Then + Me.Page.ShouldSaveControlsToSession = True + Me.Page.Response.Redirect(url) + ElseIf Not TargetKey Is Nothing AndAlso _ + Not shouldRedirect Then + Me.Page.ShouldSaveControlsToSession = True + Me.Page.CloseWindow(True) + + End If + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalIdExportCSVButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + ' Build the where clause based on the current filter and search criteria + ' Create the Order By clause based on the user's current sorting preference. + + Dim wc As WhereClause = CreateWhereClause + Dim orderBy As OrderBy = Nothing + + orderBy = CreateOrderBy + + ' Add each of the columns in order of export. + Dim columns() as BaseColumn = New BaseColumn() { _ + PersonalIdTable.PersonalId, _ + PersonalIdTable.PersonalName, _ + PersonalIdTable.PersonalLastName, _ + Nothing} + Dim exportData as ExportDataToCSV = New ExportDataToCSV(PersonalIdTable.Instance, wc, orderBy, columns) + + Dim done As Boolean = False + + Dim totalRowsReturned As Integer = 0 + Dim join As CompoundFilter = CreateCompoundJoinFilter() + Dim data As DataForExport = New DataForExport(PersonalIdTable.Instance, wc, orderBy, columns, join) + + 'Check for Export Data Threshold + Dim exportRawValues As Boolean = False + Me.TotalRecords = PersonalIdTable.GetRecordCount(join, wc) + If Me.TotalRecords > 10000 Then + exportRawValues = True + End If + exportData.StartExport(Me.Page.Response, exportRawValues) + + ' Read pageSize records at a time and write out the CSV file. + While (Not done) + Dim recList As ArrayList = data.GetRows(exportData.pageSize) + If recList Is Nothing Then + Exit While 'no more records we are done + End If + + totalRowsReturned = recList.Count + For Each rec As BaseRecord In recList + For Each col As BaseColumn In data.ColumnList + If col Is Nothing Then + Continue For + End If + + If Not data.IncludeInExport(col) Then + Continue For + End If + + Dim val As String = "" + + If exportRawValues Then + val = rec.GetValue(col).ToString() + Else + Dim _isExpandableNonCompositeForeignKey As Boolean = col.TableDefinition.IsExpandableNonCompositeForeignKey(col) + If _isExpandableNonCompositeForeignKey AndAlso col.IsApplyDisplayAs Then + val = PersonalIdTable.GetDFKA(rec.GetValue(col).ToString(), col, Nothing) + End If + If (Not _isExpandableNonCompositeForeignKey) Or (String.IsNullOrEmpty(val)) Then + val = exportData.GetDataForExport(col, rec) + End If + End If + exportData.WriteColumnData(val, data.IsString(col)) + + Next col + exportData.WriteNewRow() + Next rec + + ' If we already are below the pageSize, then we are done. + If totalRowsReturned < exportData.pageSize Then + done = True + End If + End While + exportData.FinishExport(Me.Page.Response) + + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalIdExportExcelButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + ' To customize the columns or the format, override this function in Section 1 of the page + ' and modify it to your liking. + ' Build the where clause based on the current filter and search criteria + ' Create the Order By clause based on the user's current sorting preference. + + Dim wc As WhereClause = CreateWhereClause + Dim orderBy As OrderBy = Nothing + + orderBy = CreateOrderBy + + Dim done As Boolean = False + Dim val As Object = "" + ' Read pageSize records at a time and write out the Excel file. + Dim totalRowsReturned As Integer = 0 + + Me.TotalRecords = PersonalIdTable.GetRecordCount(wc) + If Me.TotalRecords > 10000 Then + + ' Add each of the columns in order of export. + Dim columns() as BaseColumn = New BaseColumn() { _ + PersonalIdTable.PersonalId, _ + PersonalIdTable.PersonalName, _ + PersonalIdTable.PersonalLastName, _ + Nothing} + Dim exportData as ExportDataToCSV = New ExportDataToCSV(PersonalIdTable.Instance, wc, orderBy, columns) + exportData.StartExport(Me.Page.Response, True) + + Dim dataForCSV As DataForExport = New DataForExport(PersonalIdTable.Instance, wc, orderBy, columns) + + ' Read pageSize records at a time and write out the CSV file. + While (Not done) + Dim recList As ArrayList = dataForCSV.GetRows(exportData.pageSize) + If recList Is Nothing Then + Exit While 'no more records we are done + End If + + totalRowsReturned = recList.Count + For Each rec As BaseRecord In recList + For Each col As BaseColumn In dataForCSV.ColumnList + If col Is Nothing Then + Continue For + End If + + If Not dataForCSV.IncludeInExport(col) Then + Continue For + End If + + val = rec.GetValue(col).ToString() + exportData.WriteColumnData(val, dataForCSV.IsString(col)) + + Next col + exportData.WriteNewRow() + Next rec + + ' If we already are below the pageSize, then we are done. + If totalRowsReturned < exportData.pageSize Then + done = True + End If + End While + exportData.FinishExport(Me.Page.Response) + Else + + ' Create an instance of the Excel report class with the table class, where clause and order by. + Dim excelReport As ExportDataToExcel = New ExportDataToExcel(PersonalIdTable.Instance, wc, orderBy) + ' Add each of the columns in order of export. + ' To customize the data type, change the second parameter of the new ExcelColumn to be + ' a format string from Excel's Format Cell menu. For example "dddd, mmmm dd, yyyy h:mm AM/PM;@", "#,##0.00" + + If Me.Page.Response Is Nothing Then + Return + End If + + excelReport.CreateExcelBook() + + Dim width As Integer = 0 + Dim columnCounter As Integer = 0 + Dim data As DataForExport = New DataForExport(PersonalIdTable.Instance, wc, orderBy, Nothing) + data.ColumnList.Add(New ExcelColumn(PersonalIdTable.PersonalId, "Default")) + data.ColumnList.Add(New ExcelColumn(PersonalIdTable.PersonalName, "Default")) + data.ColumnList.Add(New ExcelColumn(PersonalIdTable.PersonalLastName, "Default")) + + + For Each col As ExcelColumn In data.ColumnList + width = excelReport.GetExcelCellWidth(col) + If data.IncludeInExport(col) Then + excelReport.AddColumnToExcelBook(columnCounter, col.ToString(), excelReport.GetExcelDataType(col), width, excelReport.GetDisplayFormat(col)) + columnCounter = columnCounter + 1 + End If + Next col + + While (Not done) + Dim recList As ArrayList = data.GetRows(excelReport.pageSize) + + If recList Is Nothing Then + Exit While 'no more records we are done + End If + + totalRowsReturned = recList.Count + + For Each rec As BaseRecord In recList + excelReport.AddRowToExcelBook() + columnCounter = 0 + + For Each col As ExcelColumn In data.ColumnList + If Not data.IncludeInExport(col) Then + Continue For + End If + + Dim _isExpandableNonCompositeForeignKey As Boolean = col.DisplayColumn.TableDefinition.IsExpandableNonCompositeForeignKey(col.DisplayColumn) + If _isExpandableNonCompositeForeignKey AndAlso col.DisplayColumn.IsApplyDisplayAs Then + val = PersonalIdTable.GetDFKA(rec.GetValue(col.DisplayColumn).ToString(), col.DisplayColumn, Nothing) + If val Is Nothing Then + val = rec.Format(col.DisplayColumn) + End If + Else + val = excelReport.GetValueForExcelExport(col, rec) + End If + excelReport.AddCellToExcelRow(columnCounter, excelReport.GetExcelDataType(col), val, col.DisplayFormat) + + columnCounter = columnCounter + 1 + Next col + Next rec + + ' If we already are below the pageSize, then we are done. + If totalRowsReturned < excelReport.pageSize Then + done = True + End If + End While + + excelReport.SaveExcelBook(Me.Page.Response) + End If + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalIdImportButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalIdNewButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + ' The redirect URL is set on the Properties, Custom Properties or Actions. + ' The ModifyRedirectURL call resolves the parameters before the + ' Response.Redirect redirects the page to the URL. + ' Any code after the Response.Redirect call will not be executed, since the page is + ' redirected to the URL. + + + Dim url As String = "../PersonalId/AddPersonalId.aspx" + + Dim shouldRedirect As Boolean = True + Dim TargetKey As String = Nothing + Dim DFKA As String = TargetKey + Dim id As String = DFKA + Dim value As String = id + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + url = Me.ModifyRedirectUrl(url, "",False) + url = Me.Page.ModifyRedirectUrl(url, "",False) + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + shouldRedirect = False + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + If shouldRedirect Then + Me.Page.ShouldSaveControlsToSession = True + Me.Page.Response.Redirect(url) + ElseIf Not TargetKey Is Nothing AndAlso _ + Not shouldRedirect Then + Me.Page.ShouldSaveControlsToSession = True + Me.Page.CloseWindow(True) + + End If + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalIdPDFButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + Dim report As PDFReport = New PDFReport() + report.SpecificReportFileName = Page.Server.MapPath("ShowPersonalTable.PersonalIdPDFButton.report") + ' report.Title replaces the value tag of page header and footer containing ${ReportTitle} + report.Title = "PersonalId" + ' If ShowPersonalTable.PersonalIdPDFButton.report specifies a valid report template, + ' AddColumn method will generate a report template. + ' Each AddColumn method-call specifies a column + ' The 1st parameter represents the text of the column header + ' The 2nd parameter represents the horizontal alignment of the column header + ' The 3rd parameter represents the text format of the column detail + ' The 4th parameter represents the horizontal alignment of the column detail + ' The 5th parameter represents the relative width of the column + report.AddColumn(PersonalIdTable.PersonalId.Name, ReportEnum.Align.Left, "${PersonalId}", ReportEnum.Align.Left, 15) + report.AddColumn(PersonalIdTable.PersonalName.Name, ReportEnum.Align.Left, "${PersonalName}", ReportEnum.Align.Left, 30) + report.AddColumn(PersonalIdTable.PersonalLastName.Name, ReportEnum.Align.Left, "${PersonalLastName}", ReportEnum.Align.Left, 30) + + + Dim rowsPerQuery As Integer = 5000 + Dim recordCount As Integer = 0 + + report.Page = Page.GetResourceValue("Txt:Page", "Persons") + report.ApplicationPath = Me.Page.MapPath(Page.Request.ApplicationPath) + + Dim whereClause As WhereClause = CreateWhereClause + Dim orderBy As OrderBy = CreateOrderBy + Dim joinFilter As BaseFilter = CreateCompoundJoinFilter() + + Dim pageNum As Integer = 0 + Dim totalRows As Integer = PersonalIdTable.GetRecordCount(joinFilter,whereClause) + Dim columns As ColumnList = PersonalIdTable.GetColumnList() + Dim records As PersonalIdRecord() = Nothing + + Do + + records = PersonalIdTable.GetRecords(joinFilter,whereClause, orderBy, pageNum, rowsPerQuery) + If Not (records Is Nothing) AndAlso records.Length > 0 AndAlso whereClause.RunQuery Then + For Each record As PersonalIdRecord In records + + ' AddData method takes four parameters + ' The 1st parameters represent the data format + ' The 2nd parameters represent the data value + ' The 3rd parameters represent the default alignment of column using the data + ' The 4th parameters represent the maximum length of the data value being shown + report.AddData("${PersonalId}", record.Format(PersonalIdTable.PersonalId), ReportEnum.Align.Left, 100) + report.AddData("${PersonalName}", record.Format(PersonalIdTable.PersonalName), ReportEnum.Align.Left, 100) + report.AddData("${PersonalLastName}", record.Format(PersonalIdTable.PersonalLastName), ReportEnum.Align.Left, 100) + + report.WriteRow + Next + pageNum = pageNum + 1 + recordCount += records.Length + End If + Loop While Not (records Is Nothing) AndAlso recordCount < totalRows AndAlso whereClause.RunQuery + + report.Close + BaseClasses.Utils.NetUtils.WriteResponseBinaryAttachment(Me.Page.Response, report.Title + ".pdf", report.ReportInByteArray, 0, true) + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalIdRefreshButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Dim PersonalIdTableControlObj as PersonalIdTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalIdTableControl"), PersonalIdTableControl) + PersonalIdTableControlObj.ResetData = True + + PersonalIdTableControlObj.RemoveFromSession(PersonalIdTableControlObj, "DeletedRecordIds") + PersonalIdTableControlObj.DeletedRecordIds = Nothing + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalIdResetButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.ArmyIdFilter1.ClearSelection() + Me.SectionIdFilter1.ClearSelection() + Me.PersonalIdSearch1.Text = "" + Me.CurrentSortOrder.Reset() + If Me.InSession(Me, "Order_By") Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + + End If + + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalIdWordButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + Dim report As WordReport = New WordReport + report.SpecificReportFileName = Page.Server.MapPath("ShowPersonalTable.PersonalIdWordButton.word") + ' report.Title replaces the value tag of page header and footer containing ${ReportTitle} + report.Title = "PersonalId" + ' If ShowPersonalTable.PersonalIdWordButton.report specifies a valid report template, + ' AddColumn method will generate a report template. + ' Each AddColumn method-call specifies a column + ' The 1st parameter represents the text of the column header + ' The 2nd parameter represents the horizontal alignment of the column header + ' The 3rd parameter represents the text format of the column detail + ' The 4th parameter represents the horizontal alignment of the column detail + ' The 5th parameter represents the relative width of the column + report.AddColumn(PersonalIdTable.PersonalId.Name, ReportEnum.Align.Left, "${PersonalId}", ReportEnum.Align.Left, 15) + report.AddColumn(PersonalIdTable.PersonalName.Name, ReportEnum.Align.Left, "${PersonalName}", ReportEnum.Align.Left, 30) + report.AddColumn(PersonalIdTable.PersonalLastName.Name, ReportEnum.Align.Left, "${PersonalLastName}", ReportEnum.Align.Left, 30) + + Dim whereClause As WhereClause = CreateWhereClause + + Dim orderBy As OrderBy = CreateOrderBy + Dim joinFilter As BaseFilter = CreateCompoundJoinFilter() + + Dim rowsPerQuery As Integer = 5000 + Dim pageNum As Integer = 0 + Dim recordCount As Integer = 0 + Dim totalRows As Integer = PersonalIdTable.GetRecordCount(joinFilter,whereClause) + + report.Page = Page.GetResourceValue("Txt:Page", "Persons") + report.ApplicationPath = Me.Page.MapPath(Page.Request.ApplicationPath) + + Dim columns As ColumnList = PersonalIdTable.GetColumnList() + Dim records As PersonalIdRecord() = Nothing + Do + records = PersonalIdTable.GetRecords(joinFilter,whereClause, orderBy, pageNum, rowsPerQuery) + + If Not (records Is Nothing) AndAlso records.Length > 0 AndAlso whereClause.RunQuery Then + For Each record As PersonalIdRecord In records + ' AddData method takes four parameters + ' The 1st parameters represent the data format + ' The 2nd parameters represent the data value + ' The 3rd parameters represent the default alignment of column using the data + ' The 4th parameters represent the maximum length of the data value being shown + report.AddData("${PersonalId}", record.Format(PersonalIdTable.PersonalId), ReportEnum.Align.Left, 100) + report.AddData("${PersonalName}", record.Format(PersonalIdTable.PersonalName), ReportEnum.Align.Left, 100) + report.AddData("${PersonalLastName}", record.Format(PersonalIdTable.PersonalLastName), ReportEnum.Align.Left, 100) + + report.WriteRow + Next + pageNum = pageNum + 1 + recordCount += records.Length + End If + Loop While Not (records Is Nothing) AndAlso recordCount < totalRows AndAlso whereClause.RunQuery + report.save + BaseClasses.Utils.NetUtils.WriteResponseBinaryAttachment(Me.Page.Response, report.Title + ".doc", report.ReportInByteArray, 0, true) + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for Button with Layout + Public Overridable Sub Button_Click(ByVal sender As Object, ByVal args As EventArgs) + + Try + + 'This method is initially empty to implement custom click handler. + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for Button with Layout + Public Overridable Sub PersonalIdSearchButton1_Click(ByVal sender As Object, ByVal args As EventArgs) + + Try + + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + + + ' Generate the event handling functions for filter and search events. + + ' event handler for FieldFilter + Protected Overridable Sub ArmyIdFilter1_SelectedIndexChanged(ByVal sender As Object, ByVal args As EventArgs) + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + + End Sub + + ' event handler for FieldFilter + Protected Overridable Sub SectionIdFilter1_SelectedIndexChanged(ByVal sender As Object, ByVal args As EventArgs) + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + + End Sub + + + ' Generate the event handling functions for others + + + Private _UIData As New System.Collections.Generic.List(Of Hashtable) + Public Property UIData() As System.Collections.Generic.List(Of Hashtable) + Get + Return Me._UIData + End Get + Set(ByVal value As System.Collections.Generic.List(Of Hashtable)) + Me._UIData = value + End Set + End Property + + ' pagination properties + Protected _PageSize As Integer + Public Property PageSize() As Integer + Get + Return Me._PageSize + End Get + Set(ByVal value As Integer) + Me._PageSize = value + End Set + End Property + + Protected _PageIndex As Integer + Public Property PageIndex() As Integer + Get + ' Return the PageIndex + Return Me._PageIndex + End Get + Set(ByVal value As Integer) + Me._PageIndex = value + End Set + End Property + + Protected _TotalRecords As Integer = -1 + Public Property TotalRecords() As Integer + Get + If _TotalRecords < 0 + _TotalRecords = PersonalIdTable.GetRecordCount(CreateCompoundJoinFilter(), CreateWhereClause()) + End If + Return Me._TotalRecords + End Get + Set(ByVal value As Integer) + If Me.PageSize > 0 Then + + Me.TotalPages = CInt(Math.Ceiling(value / Me.PageSize)) + + End If + Me._TotalRecords = value + End Set + End Property + + + + Protected _TotalPages As Integer = -1 + Public Property TotalPages() As Integer + Get + If _TotalPages < 0 Then + + Me.TotalPages = CInt(Math.Ceiling(TotalRecords / Me.PageSize)) + + End If + Return Me._TotalPages + End Get + Set(ByVal value As Integer) + Me._TotalPages = value + End Set + End Property + + Protected _DisplayLastPage As Boolean + Public Property DisplayLastPage() As Boolean + Get + Return Me._DisplayLastPage + End Get + Set(ByVal value As Boolean) + Me._DisplayLastPage = value + End Set + End Property + + Private _DataChanged As Boolean = False + Public Property DataChanged() As Boolean + Get + Return Me._DataChanged + End Get + Set(ByVal value As Boolean) + Me._DataChanged = value + End Set + End Property + + Private _ResetData As Boolean = False + Public Property ResetData() As Boolean + Get + Return Me._ResetData + End Get + Set(ByVal value As Boolean) + Me._ResetData = value + End Set + End Property + + Private _AddNewRecord As Integer = 0 + Public Property AddNewRecord() As Integer + Get + Return Me._AddNewRecord + End Get + Set(ByVal value As Integer) + Me._AddNewRecord = value + End Set + End Property + + + Private _CurrentSortOrder As OrderBy = Nothing + Public Property CurrentSortOrder() As OrderBy + Get + Return Me._CurrentSortOrder + End Get + Set(ByVal value As BaseClasses.Data.OrderBy) + Me._CurrentSortOrder = value + End Set + End Property + + Private _DataSource() As PersonalIdRecord = Nothing + Public Property DataSource() As PersonalIdRecord () + Get + Return Me._DataSource + End Get + Set(ByVal value() As PersonalIdRecord) + Me._DataSource = value + End Set + End Property + +#Region "Helper Properties" + + Public ReadOnly Property ArmyIdFilter1() As System.Web.UI.WebControls.DropDownList + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "ArmyIdFilter1"), System.Web.UI.WebControls.DropDownList) + End Get + End Property + + Public ReadOnly Property ArmyIdLabel2() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "ArmyIdLabel2"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property Button() As Persons.UI.IThemeButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Button"), Persons.UI.IThemeButton) + End Get + End Property + + Public ReadOnly Property PersonalIdCopyButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalIdCopyButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalIdDeleteButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalIdDeleteButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalIdEditButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalIdEditButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalIdExportCSVButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalIdExportCSVButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalIdExportExcelButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalIdExportExcelButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalIdImportButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalIdImportButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalIdLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalIdLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property PersonalIdNewButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalIdNewButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalIdPagination() As Persons.UI.IPagination + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalIdPagination"), Persons.UI.IPagination) + End Get + End Property + + Public ReadOnly Property PersonalIdPDFButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalIdPDFButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalIdRefreshButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalIdRefreshButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalIdResetButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalIdResetButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalIdSearch1() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalIdSearch1"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property PersonalIdSearchButton1() As Persons.UI.IThemeButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalIdSearchButton1"), Persons.UI.IThemeButton) + End Get + End Property + + Public ReadOnly Property PersonalIdTableControlCollapsibleRegion() As System.Web.UI.WebControls.Panel + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalIdTableControlCollapsibleRegion"), System.Web.UI.WebControls.Panel) + End Get + End Property + + Public ReadOnly Property PersonalIdTableControlIcon() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalIdTableControlIcon"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalIdTableControlPanelExtender() As AjaxControlToolkit.CollapsiblePanelExtender + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalIdTableControlPanelExtender"), AjaxControlToolkit.CollapsiblePanelExtender) + End Get + End Property + + Public ReadOnly Property PersonalIdTitle() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalIdTitle"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property PersonalIdToggleAll() As System.Web.UI.WebControls.CheckBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalIdToggleAll"), System.Web.UI.WebControls.CheckBox) + End Get + End Property + + Public ReadOnly Property PersonalIdWordButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalIdWordButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalLastNameLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalLastNameLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property PersonalNameLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalNameLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property SectionIdFilter1() As System.Web.UI.WebControls.DropDownList + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "SectionIdFilter1"), System.Web.UI.WebControls.DropDownList) + End Get + End Property + + Public ReadOnly Property SectionIdLabel2() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "SectionIdLabel2"), System.Web.UI.WebControls.Literal) + End Get + End Property + +#End Region + +#Region "Helper Functions" + + Public Overrides Overloads Function ModifyRedirectUrl(url As String, arg As String, ByVal bEncrypt As Boolean) As String + Return Me.Page.EvaluateExpressions(url, arg, bEncrypt, Me) + End Function + + Public Overrides Overloads Function EvaluateExpressions(url As String, arg As String, ByVal bEncrypt As Boolean) As String + Dim needToProcess As Boolean = AreAnyUrlParametersForMe(url, arg) + If (needToProcess) Then + Dim recCtl As PersonalIdTableControlRow = Me.GetSelectedRecordControl() + If recCtl Is Nothing AndAlso url.IndexOf("{") >= 0 Then + ' Localization. + Throw New Exception(Page.GetResourceValue("Err:NoRecSelected", "Persons")) + End If + Dim rec As PersonalIdRecord = Nothing + If recCtl IsNot Nothing Then + rec = recCtl.GetRecord() + End If + Return EvaluateExpressions(url, arg, rec, bEncrypt) + End If + Return url + End Function + + Public Overridable Function GetSelectedRecordIndex() As Integer + Dim counter As Integer = 0 + Dim recControl As PersonalIdTableControlRow + For Each recControl In Me.GetRecordControls() + If recControl.PersonalIdRecordRowSelection.Checked Then + Return counter + End If + counter += 1 + Next + Return -1 + End Function + + Public Overridable Function GetSelectedRecordControl() As PersonalIdTableControlRow + Dim selectedList() As PersonalIdTableControlRow = Me.GetSelectedRecordControls() + If selectedList.Length = 0 Then + Return Nothing + End If + Return selectedList(0) + + End Function + + Public Overridable Function GetSelectedRecordControls() As PersonalIdTableControlRow() + + Dim selectedList As ArrayList = New ArrayList(25) + Dim recControl As PersonalIdTableControlRow + For Each recControl In Me.GetRecordControls() + If recControl.PersonalIdRecordRowSelection IsNot Nothing AndAlso recControl.PersonalIdRecordRowSelection.Checked Then + selectedList.Add(recControl) + End If + Next + Return DirectCast(selectedList.ToArray(GetType(PersonalIdTableControlRow)), PersonalIdTableControlRow()) + + End Function + + Public Overridable Sub DeleteSelectedRecords(ByVal deferDeletion As Boolean) + Dim recList() As PersonalIdTableControlRow = Me.GetSelectedRecordControls() + If recList.Length = 0 Then + ' Localization. + Throw New Exception(Page.GetResourceValue("Err:NoRecSelected", "Persons")) + End If + + Dim recCtl As PersonalIdTableControlRow + For Each recCtl In recList + If deferDeletion Then + If Not recCtl.IsNewRecord Then + + Me.AddToDeletedRecordIds(recCtl) + + End If + recCtl.Visible = False + + recCtl.PersonalIdRecordRowSelection.Checked = False + + Else + + recCtl.Delete() + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + End If + Next + End Sub + + Public Function GetRecordControls() As PersonalIdTableControlRow() + Dim recList As ArrayList = New ArrayList() + Dim rep As System.Web.UI.WebControls.Repeater = CType(Me.FindControl("PersonalIdTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return Nothing + Dim repItem As System.Web.UI.WebControls.RepeaterItem + + For Each repItem In rep.Items + + Dim recControl As PersonalIdTableControlRow = DirectCast(repItem.FindControl("PersonalIdTableControlRow"), PersonalIdTableControlRow) + recList.Add(recControl) + + Next + + Return DirectCast(recList.ToArray(GetType(PersonalIdTableControlRow)), PersonalIdTableControlRow()) + 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 + + \ No newline at end of file diff --git a/App_Code/PersonalId/ShowViewPersons.Controls.vb b/App_Code/PersonalId/ShowViewPersons.Controls.vb new file mode 100644 index 0000000..3ee3f64 --- /dev/null +++ b/App_Code/PersonalId/ShowViewPersons.Controls.vb @@ -0,0 +1,5246 @@ + +' This file implements the TableControl, TableControlRow, and RecordControl classes for the +' ShowViewPersons.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.ShowViewPersons + +#Region "Section 1: Place your customizations here." + + +Public Class View_PersonsTableControlRow + Inherits BaseView_PersonsTableControlRow + ' The BaseView_PersonsTableControlRow implements code for a ROW within the + ' the View_PersonsTableControl table. The BaseView_PersonsTableControlRow implements the DataBind and SaveData methods. + ' The loading of data is actually performed by the LoadData method in the base class of View_PersonsTableControl. + + ' This is the ideal place to add your code customizations. For example, you can override the DataBind, + ' SaveData, GetUIData, and Validate methods. + + + Private Sub View_PersonsTableControlRow_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.PreRender + On Error Resume Next + Dim Yrs, Mts As Double + If Me.RankDate1.Text <> "" Then + Yrs = Fix(DateDiff("m", Me.RankDate1.Text, Now) / 12) + Mts = CInt(DateDiff("m", Me.RankDate1.Text, Now) Mod 12) + Me.RankDate1.Text = "
" & Yrs & "/" & Mts + End If + 'If Yrs <> 0 AndAlso Mts <> 0 Then + 'Me.RankDate1.Text = "
(" & Yrs & " ปี " & Mts & " เดือน)" + 'ElseIf Yrs <> 0 AndAlso Mts = 0 Then + 'Me.RankDate1.Text = "
(" & Yrs & " ปี)" + 'ElseIf Yrs = 0 AndAlso Mts <> 0 Then + 'Me.RankDate1.Text = "
" & Mts & " เดือน " + 'End If + End Sub + End Class + + + +Public Class View_PersonsTableControl + Inherits BaseView_PersonsTableControl + + ' The BaseView_PersonsTableControl class implements the LoadData, DataBind, CreateWhereClause + ' and other methods to load and display the data in a table control. + + ' This is the ideal place to add your code customizations. You can override the LoadData and CreateWhereClause, + ' The View_PersonsTableControlRow class offers another place where you can customize + ' the DataBind, GetUIData, SaveData and Validate methods specific to each row displayed on the table. + ' Public Overrides Function CreateOrderBy() As BaseClasses.Data.OrderBy + ' If Me.InSession(Me, "Order_By") Then + ' Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + ' Else + ' Me.CurrentSortOrder = New OrderBy(True, True) + ' Me.CurrentSortOrder.Add(View_PersonsView.RankId, OrderByItem.OrderDir.Asc) + ' Me.CurrentSortOrder.Add(View_PersonsView.DateRank, OrderByItem.OrderDir.Asc) + ' Me.CurrentSortOrder.Add(View_PersonsView.DatePrevRank, OrderByItem.OrderDir.Asc) + ' Return MyBase.CreateOrderBy() + ' End If + ' End Function + + Protected Overrides Sub PopulateSectionIdFromFilter(ByVal selectedValue As String, ByVal maxItems As Integer) + + 'Setup the WHERE clause. + Dim wc As WhereClause = Me.CreateWhereClause_SectionIdFromFilter() + wc.iAND(SectionTable.SectionId, BaseFilter.ComparisonOperator.Not_Equals, "0") + Dim orderBy As OrderBy = New OrderBy(False, True) + orderBy.Add(SectionTable.SectionAbbvrName, OrderByItem.OrderDir.Asc) + + Dim noValueFormat As String = Page.GetResourceValue("Txt:Other", "Persons") + + + Me.SectionIdFromFilter.Items.Clear() + Dim itemValue As SectionRecord + For Each itemValue In SectionTable.GetRecords(wc, orderBy, 0, maxItems) + ' Create the item and add to the list. + Dim cvalue As String = Nothing + Dim fvalue As String = noValueFormat + If itemValue.SectionIdSpecified Then + cvalue = itemValue.SectionId.ToString() + fvalue = itemValue.Format(SectionTable.SectionAbbvrName) + End If + + Dim item As ListItem = New ListItem(fvalue, cvalue) + If Me.SectionIdFromFilter.Items.IndexOf(item) < 0 Then + Me.SectionIdFromFilter.Items.Add(item) + End If + Next + + ' Add the All item. + Me.SectionIdFromFilter.Items.Insert(0, New ListItem(Page.GetResourceValue("Txt:All", "Persons"), "--ANY--")) + + ' Set the selected value. + SetSelectedValue(Me.SectionIdFromFilter, selectedValue) + + + End Sub + + + Protected Overrides Sub PopulateDeptIdFilter(ByVal selectedValue As String, ByVal maxItems As Integer) + + 'Setup the WHERE clause. + Dim wc As WhereClause = Me.CreateWhereClause_DeptIdFilter() + If Me.SectionIdFromFilter.SelectedValue = "--ANY--" Or Me.SectionIdFromFilter.SelectedValue = "0" Or Me.SectionIdFromFilter.SelectedValue = "" Then + Else + wc.iAND(DeptTable.SectionId, BaseFilter.ComparisonOperator.EqualsTo, Me.SectionIdFromFilter.SelectedValue) + End If + Dim orderBy As OrderBy = New OrderBy(False, True) + orderBy.Add(DeptTable.DeptId, OrderByItem.OrderDir.Asc) + + Dim noValueFormat As String = Page.GetResourceValue("Txt:Other", "Persons") + + + Me.DeptIdFilter.Items.Clear() + Dim itemValue As DeptRecord + For Each itemValue In DeptTable.GetRecords(wc, orderBy, 0, maxItems) + ' Create the item and add to the list. + Dim cvalue As String = Nothing + Dim fvalue As String = noValueFormat + If itemValue.DeptIdSpecified Then + cvalue = itemValue.DeptId.ToString() + If Me.SectionIdFromFilter.SelectedValue = "--ANY--" Or Me.SectionIdFromFilter.SelectedValue = "0" Or Me.SectionIdFromFilter.SelectedValue = "" Then + fvalue = Ps.GetSectionAbbvrNameByDeptId(itemValue.DeptId) & ": " & itemValue.Format(DeptTable.DeptAbbvr) + Else + fvalue = itemValue.Format(DeptTable.DeptAbbvr) '& ": " & Ps.GetSectionAbbvrNameByDeptId(itemValue.DeptId) + End If + End If + Dim item As ListItem = New ListItem(fvalue, cvalue) + If Me.DeptIdFilter.Items.IndexOf(item) < 0 Then + Me.DeptIdFilter.Items.Add(item) + End If + Next + + ' Add the All item. + Me.DeptIdFilter.Items.Insert(0, New ListItem(Page.GetResourceValue("Txt:All", "Persons"), "--ANY--")) + + ' Set the selected value. + SetSelectedValue(Me.DeptIdFilter, selectedValue) + + + End Sub + + Protected Overrides Sub PopulateRankLevelFilter(ByVal selectedValue As String, ByVal maxItems As Integer) + + 'Setup the WHERE clause. + Dim wc As WhereClause = Me.CreateWhereClause_RankLevelFilter() + wc.iAND(RankTable.RankLevel, BaseFilter.ComparisonOperator.Less_Than, "21") + wc.iOR(RankTable.RankLevel, BaseFilter.ComparisonOperator.Greater_Than, "27") + Dim orderBy As OrderBy = New OrderBy(False, True) + orderBy.Add(RankTable.RankLevel, OrderByItem.OrderDir.Asc) + + Dim noValueFormat As String = Page.GetResourceValue("Txt:Other", "Persons") + + + Me.RankLevelFilter.Items.Clear() + Dim itemValue As RankRecord + For Each itemValue In RankTable.GetRecords(wc, orderBy, 0, maxItems) + ' Create the item and add to the list. + Dim cvalue As String = Nothing + Dim fvalue As String = noValueFormat + If itemValue.RankLevelSpecified Then + cvalue = itemValue.RankLevel.ToString() + fvalue = itemValue.Format(RankTable.RankLevelName) + End If + + Dim item As ListItem = New ListItem(fvalue, cvalue) + If Me.RankLevelFilter.Items.IndexOf(item) < 0 Then + Me.RankLevelFilter.Items.Add(item) + End If + Next + + ' Add the All item. + Me.RankLevelFilter.Items.Insert(0, New ListItem(Page.GetResourceValue("Txt:All", "Persons"), "--ANY--")) + + ' Set the selected value. + SetSelectedValue(Me.RankLevelFilter, selectedValue) + + + End Sub + + + Private Sub View_PersonsTableControl_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Init + MyBase.Control_Init(sender, e) + ' Me.CurrentSortOrder.Reset() + ' 'Me.CurrentSortOrder = New OrderBy(True, True) + ' Me.CurrentSortOrder.Add(View_PersonsView.RankId, OrderByItem.OrderDir.Asc) + ' Me.CurrentSortOrder.Add(View_PersonsView.DateRank, OrderByItem.OrderDir.Asc) + ' Me.CurrentSortOrder.Add(View_PersonsView.DatePrevRank, OrderByItem.OrderDir.Asc) + + End Sub + Public Overrides Sub View_PersonsResetButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + MyBase.View_PersonsResetButton_Click(sender, args) + ' Me.CurrentSortOrder.Reset() + ' 'Me.CurrentSortOrder = New OrderBy(True, True) + ' Me.CurrentSortOrder.Add(View_PersonsView.RankId, OrderByItem.OrderDir.Asc) + ' Me.CurrentSortOrder.Add(View_PersonsView.DateRank, OrderByItem.OrderDir.Asc) + ' Me.CurrentSortOrder.Add(View_PersonsView.DatePrevRank, OrderByItem.OrderDir.Asc) + + End Sub + + + + + End Class + + + +#End Region + + + +#Region "Section 2: Do not modify this section." + + +' Base class for the View_PersonsTableControlRow control on the ShowViewPersons page. +' Do not modify this class. Instead override any method in View_PersonsTableControlRow. +Public Class BaseView_PersonsTableControlRow + Inherits Persons.UI.BaseApplicationRecordControl + + ' To customize, override this method in View_PersonsTableControlRow. + Protected Overridable Sub Control_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Init + + Me.ClearControlsFromSession() + End Sub + + ' To customize, override this method in View_PersonsTableControlRow. + Protected Overridable Sub Control_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load + + 'Call LoadFocusScripts from repeater so that onfocus attribute could be added to elements + Me.Page.LoadFocusScripts(Me) + + + ' Register the event handlers. + + AddHandler Me.View_PersonsRowEditButton.Click, AddressOf View_PersonsRowEditButton_Click + + AddHandler Me.View_PersonsRowViewButton.Click, AddressOf View_PersonsRowViewButton_Click + + + End Sub + + + Public Overridable Sub LoadData() + + ' Load the data from the database into the DataSource View_Persons 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 = View_PersonsView.GetRecord(Me.RecordUniqueId, True) + + Return + End If + + ' Since this is a row in the table, the data for this row is loaded by the + ' LoadData method of the BaseView_PersonsTableControl when the data for the entire + ' table is loaded. + + Me.DataSource = New View_PersonsRecord() + + + + End Sub + + ' Populate the UI controls using the DataSource. To customize, override this method in View_PersonsTableControlRow. + 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 + + SetArmSName() + SetBorn() + SetBProvince() + SetCEdu() + SetCommission() + SetDeptAbbvr() + SetMobilePhone() + Setpicture() + SetRankAndName() + SetRankDate() + SetRankDate1() + SetRetire() + SetSAmout() + SetSectionAbbvrName() + SetTitle() + + + + + 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 SetArmSName() + + + ' Set the ArmSName Literal on the webpage with value from the + ' View_Persons database record. + + ' Me.DataSource is the View_Persons record retrieved from the database. + ' Me.ArmSName is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetArmSName() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.ArmSNameSpecified Then + + ' If the ArmSName is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(View_PersonsView.ArmSName) + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.ArmSName.Text = formattedValue + + Else + + ' ArmSName is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.ArmSName.Text = View_PersonsView.ArmSName.Format(View_PersonsView.ArmSName.DefaultValue) + + End If + + ' If the ArmSName is NULL or blank, then use the value specified + ' on Properties. + If Me.ArmSName.Text Is Nothing _ + OrElse Me.ArmSName.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.ArmSName.Text = " " + End If + + End Sub + + Public Overridable Sub SetBorn() + + + ' Set the Born Literal on the webpage with value from the + ' View_Persons database record. + + ' Me.DataSource is the View_Persons record retrieved from the database. + ' Me.Born is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetBorn() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.BornSpecified Then + + ' If the Born is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(View_PersonsView.Born) + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.Born.Text = formattedValue + + Else + + ' Born is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.Born.Text = View_PersonsView.Born.Format(View_PersonsView.Born.DefaultValue) + + End If + + ' If the Born is NULL or blank, then use the value specified + ' on Properties. + If Me.Born.Text Is Nothing _ + OrElse Me.Born.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.Born.Text = " " + End If + + End Sub + + Public Overridable Sub SetBProvince() + + + ' Set the BProvince Literal on the webpage with value from the + ' View_Persons database record. + + ' Me.DataSource is the View_Persons record retrieved from the database. + ' Me.BProvince is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetBProvince() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.BProvinceSpecified Then + + ' If the BProvince is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(View_PersonsView.BProvince) + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.BProvince.Text = formattedValue + + Else + + ' BProvince is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.BProvince.Text = View_PersonsView.BProvince.Format(View_PersonsView.BProvince.DefaultValue) + + End If + + ' If the BProvince is NULL or blank, then use the value specified + ' on Properties. + If Me.BProvince.Text Is Nothing _ + OrElse Me.BProvince.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.BProvince.Text = " " + End If + + End Sub + + Public Overridable Sub SetCEdu() + + + ' Set the CEdu Literal on the webpage with value from the + ' View_Persons database record. + + ' Me.DataSource is the View_Persons record retrieved from the database. + ' Me.CEdu is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetCEdu() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.CEduSpecified Then + + ' If the CEdu is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(View_PersonsView.CEdu) + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.CEdu.Text = formattedValue + + Else + + ' CEdu is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.CEdu.Text = View_PersonsView.CEdu.Format(View_PersonsView.CEdu.DefaultValue) + + End If + + ' If the CEdu is NULL or blank, then use the value specified + ' on Properties. + If Me.CEdu.Text Is Nothing _ + OrElse Me.CEdu.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.CEdu.Text = " " + End If + + End Sub + + Public Overridable Sub SetCommission() + + + ' Set the Commission Literal on the webpage with value from the + ' View_Persons database record. + + ' Me.DataSource is the View_Persons record retrieved from the database. + ' Me.Commission is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetCommission() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.CommissionSpecified Then + + ' If the Commission is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(View_PersonsView.Commission) + + If Not formattedValue is Nothing Then + Dim popupThreshold as Integer = CType(30, Integer) + + Dim maxLength as Integer = Len(formattedValue) + If (maxLength > CType(30, Integer)) Then + ' Truncate based on FieldMaxLength on Properties. + maxLength = CType(30, Integer) + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + + End If + + ' For fields values larger than the PopupTheshold on Properties, display a popup. + If Len(formattedValue) >= popupThreshold Then + + Dim name As String = HttpUtility.HtmlEncode(View_PersonsView.Commission.Name) + + If Not HttpUtility.HtmlEncode("หน้าที่/งานที่ปฏิบัติ").Equals("%ISD_DEFAULT%") Then + name = HttpUtility.HtmlEncode(Me.Page.GetResourceValue("หน้าที่/งานที่ปฏิบัติ")) + End If + + + + formattedValue= "" & NetUtils.EncodeStringForHtmlDisplay(formattedValue.Substring(0, maxLength)) + + If (maxLength = CType(30, Integer)) Then + formattedValue = formattedValue & "..." & "" + Else + formattedValue = formattedValue & "" + + formattedValue = "
" & formattedValue & "
" + End If + Else + If maxLength = CType(30, Integer) Then + formattedValue= NetUtils.EncodeStringForHtmlDisplay(formattedValue.SubString(0,MaxLength)) + formattedValue = formattedValue & "..." + + Else + + formattedValue = "
" & formattedValue & "
" + End If + End If + End If + + Me.Commission.Text = formattedValue + + Else + + ' Commission is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.Commission.Text = View_PersonsView.Commission.Format(View_PersonsView.Commission.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetDeptAbbvr() + + + ' Set the DeptAbbvr Literal on the webpage with value from the + ' View_Persons database record. + + ' Me.DataSource is the View_Persons record retrieved from the database. + ' Me.DeptAbbvr is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetDeptAbbvr() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.DeptAbbvrSpecified Then + + ' If the DeptAbbvr is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(View_PersonsView.DeptAbbvr) + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.DeptAbbvr.Text = formattedValue + + Else + + ' DeptAbbvr is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.DeptAbbvr.Text = View_PersonsView.DeptAbbvr.Format(View_PersonsView.DeptAbbvr.DefaultValue) + + End If + + ' If the DeptAbbvr is NULL or blank, then use the value specified + ' on Properties. + If Me.DeptAbbvr.Text Is Nothing _ + OrElse Me.DeptAbbvr.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.DeptAbbvr.Text = " " + End If + + End Sub + + Public Overridable Sub SetMobilePhone() + + + ' Set the MobilePhone Literal on the webpage with value from the + ' View_Persons database record. + + ' Me.DataSource is the View_Persons record retrieved from the database. + ' Me.MobilePhone is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetMobilePhone() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.MobilePhoneSpecified Then + + ' If the MobilePhone is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(View_PersonsView.MobilePhone) + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.MobilePhone.Text = formattedValue + + Else + + ' MobilePhone is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.MobilePhone.Text = View_PersonsView.MobilePhone.Format(View_PersonsView.MobilePhone.DefaultValue) + + End If + + ' If the MobilePhone is NULL or blank, then use the value specified + ' on Properties. + If Me.MobilePhone.Text Is Nothing _ + OrElse Me.MobilePhone.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.MobilePhone.Text = " " + End If + + End Sub + + Public Overridable Sub Setpicture() + ' Set the picture Image on the webpage with value from the + ' View_Persons database record. + + ' Me.DataSource is the View_Persons record retrieved from the database. + ' Me.picture is the ASP:Image on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.Setpicture() + ' and add your own code before or after the call to the MyBase function. + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.pictureSpecified Then + + ' If the picture is non-NULL, then format the value. + ' The Format method will use the Display Format + Me.picture.Attributes.Add("onclick", "gPersist=true;") + Me.picture.Attributes.Add("onmouseout","detailRolloverPopupClose();") + + Dim name As String = HttpUtility.HtmlEncode(View_PersonsView.picture.Name) + + If Not HttpUtility.HtmlEncode("%ISD_DEFAULT%").Equals("%ISD_DEFAULT%") Then + name = HttpUtility.HtmlEncode(Me.Page.GetResourceValue("%ISD_DEFAULT%")) + End If + + Me.picture.Attributes.Add("onmouseover","SaveMousePosition(event);delayRolloverPopup(""PageMethods.GetImage(\""" & Me.Page.Encrypt("View_Persons") _ + & "\"", \""" & Me.Page.Encrypt(HttpUtility.UrlEncode(Me.DataSource.GetID().ToString())) _ + & "\"", \""" & Me.Page.Encrypt("picture") & "\"", \""" & NetUtils.EncodeStringForHtmlDisplay(name.Substring(0, name.Length)) & "\"", false, 250," _ + & " 200, true, PopupDisplayWindowCallBackWith20);"",500);") + + ' Shrunk image size specified by ImagePercentSize on Properties. + Me.picture.ImageUrl = Me.DataSource.FormatImageUrl(View_PersonsView.picture, Me.Page.Encrypt("View_Persons"), Me.Page.Encrypt("picture"), Me.Page.Encrypt(Me.DataSource.GetID().ToXmlString()), 20) + + Me.picture.Visible = True + Else + ' picture is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + Me.picture.Visible = False + End If + End Sub + + Public Overridable Sub SetRankAndName() + + + ' Set the RankAndName Literal on the webpage with value from the + ' View_Persons database record. + + ' Me.DataSource is the View_Persons record retrieved from the database. + ' Me.RankAndName is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetRankAndName() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.RankAndNameSpecified Then + + ' If the RankAndName is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(View_PersonsView.RankAndName) + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + If Not formattedValue is Nothing Then + Dim popupThreshold as Integer = CType(100, Integer) + + Dim maxLength as Integer = Len(formattedValue) + If (maxLength > CType(100, Integer)) Then + ' Truncate based on FieldMaxLength on Properties. + maxLength = CType(100, Integer) + + End If + + ' For fields values larger than the PopupTheshold on Properties, display a popup. + If Len(formattedValue) >= popupThreshold Then + + Dim name As String = HttpUtility.HtmlEncode(View_PersonsView.RankAndName.Name) + + If Not HttpUtility.HtmlEncode("%ISD_DEFAULT%").Equals("%ISD_DEFAULT%") Then + name = HttpUtility.HtmlEncode(Me.Page.GetResourceValue("%ISD_DEFAULT%")) + End If + + + + formattedValue= "" & NetUtils.EncodeStringForHtmlDisplay(formattedValue.Substring(0, maxLength)) + + If (maxLength = CType(100, Integer)) Then + formattedValue = formattedValue & "..." & "" + Else + formattedValue = formattedValue & "" + + End If + Else + If maxLength = CType(100, Integer) Then + formattedValue= NetUtils.EncodeStringForHtmlDisplay(formattedValue.SubString(0,MaxLength)) + formattedValue = formattedValue & "..." + + End If + End If + End If + + Me.RankAndName.Text = formattedValue + + Else + + ' RankAndName is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.RankAndName.Text = View_PersonsView.RankAndName.Format(View_PersonsView.RankAndName.DefaultValue) + + End If + + ' If the RankAndName is NULL or blank, then use the value specified + ' on Properties. + If Me.RankAndName.Text Is Nothing _ + OrElse Me.RankAndName.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.RankAndName.Text = " " + End If + + End Sub + + Public Overridable Sub SetRankDate() + + + ' Set the RankDate Literal on the webpage with value from the + ' View_Persons database record. + + ' Me.DataSource is the View_Persons record retrieved from the database. + ' Me.RankDate is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetRankDate() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.RankDateSpecified Then + + ' If the RankDate is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(View_PersonsView.RankDate, "d MMM yy") + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + formattedValue = NetUtils.HtmlEncodeWhiteSpace(formattedValue) + Me.RankDate.Text = formattedValue + + Else + + ' RankDate is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.RankDate.Text = View_PersonsView.RankDate.Format(View_PersonsView.RankDate.DefaultValue, "d MMM yy") + + End If + + End Sub + + Public Overridable Sub SetRankDate1() + + + ' Set the RankDate Literal on the webpage with value from the + ' View_Persons database record. + + ' Me.DataSource is the View_Persons record retrieved from the database. + ' Me.RankDate1 is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetRankDate1() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.RankDateSpecified Then + + ' If the RankDate is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(View_PersonsView.RankDate, "d") + + formattedValue = NetUtils.HtmlEncodeWhiteSpace(formattedValue) + Me.RankDate1.Text = formattedValue + + Else + + ' RankDate is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.RankDate1.Text = View_PersonsView.RankDate.Format(View_PersonsView.RankDate.DefaultValue, "d") + + End If + + End Sub + + Public Overridable Sub SetRetire() + + + ' Set the Retire Literal on the webpage with value from the + ' View_Persons database record. + + ' Me.DataSource is the View_Persons record retrieved from the database. + ' Me.Retire is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetRetire() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.RetireSpecified Then + + ' If the Retire is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(View_PersonsView.Retire) + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.Retire.Text = formattedValue + + Else + + ' Retire is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.Retire.Text = View_PersonsView.Retire.Format(View_PersonsView.Retire.DefaultValue) + + End If + + ' If the Retire is NULL or blank, then use the value specified + ' on Properties. + If Me.Retire.Text Is Nothing _ + OrElse Me.Retire.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.Retire.Text = " " + End If + + End Sub + + Public Overridable Sub SetSAmout() + + + ' Set the SAmout Literal on the webpage with value from the + ' View_Persons database record. + + ' Me.DataSource is the View_Persons record retrieved from the database. + ' Me.SAmout is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetSAmout() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.SAmoutSpecified Then + + ' If the SAmout is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(View_PersonsView.SAmout, "#,###") + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.SAmout.Text = formattedValue + + Else + + ' SAmout is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.SAmout.Text = View_PersonsView.SAmout.Format(View_PersonsView.SAmout.DefaultValue, "#,###") + + End If + + ' If the SAmout is NULL or blank, then use the value specified + ' on Properties. + If Me.SAmout.Text Is Nothing _ + OrElse Me.SAmout.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.SAmout.Text = " " + End If + + End Sub + + Public Overridable Sub SetSectionAbbvrName() + + + ' Set the SectionAbbvrName Literal on the webpage with value from the + ' View_Persons database record. + + ' Me.DataSource is the View_Persons record retrieved from the database. + ' Me.SectionAbbvrName is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetSectionAbbvrName() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.SectionAbbvrNameSpecified Then + + ' If the SectionAbbvrName is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(View_PersonsView.SectionAbbvrName) + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.SectionAbbvrName.Text = formattedValue + + Else + + ' SectionAbbvrName is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.SectionAbbvrName.Text = View_PersonsView.SectionAbbvrName.Format(View_PersonsView.SectionAbbvrName.DefaultValue) + + End If + + ' If the SectionAbbvrName is NULL or blank, then use the value specified + ' on Properties. + If Me.SectionAbbvrName.Text Is Nothing _ + OrElse Me.SectionAbbvrName.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.SectionAbbvrName.Text = " " + End If + + End Sub + + Public Overridable Sub SetTitle() + + + ' Set the Title Literal on the webpage with value from the + ' View_Persons database record. + + ' Me.DataSource is the View_Persons record retrieved from the database. + ' Me.Title is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetTitle() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.TitleSpecified Then + + ' If the Title is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(View_PersonsView.Title) + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.Title.Text = formattedValue + + Else + + ' Title is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.Title.Text = View_PersonsView.Title.Format(View_PersonsView.Title.DefaultValue) + + End If + + ' If the Title is NULL or blank, then use the value specified + ' on Properties. + If Me.Title.Text Is Nothing _ + OrElse Me.Title.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.Title.Text = " " + End If + + End Sub + + + Public EvaluateFormulaDelegate As BaseClasses.Data.DataSource.EvaluateFormulaDelegate = New BaseClasses.Data.DataSource.EvaluateFormulaDelegate(AddressOf Me.EvaluateFormula) + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean, ByVal e As FormulaEvaluator) As String + If e Is Nothing Then + e = New FormulaEvaluator() + End If + + e.Variables.Clear() + + + ' add variables for formula evaluation + If variables IsNot Nothing Then + Dim enumerator As System.Collections.Generic.IEnumerator(Of System.Collections.Generic.KeyValuePair(Of String, Object)) = variables.GetEnumerator() + While enumerator.MoveNext() + e.Variables.Add(enumerator.Current.Key, enumerator.Current.Value) + End While + End If + + If includeDS + + End IF + + + ' Other variables referred to in the formula are expected to be + ' properties of the DataSource. For example, referring to + ' UnitPrice as a variable will refer to DataSource.UnitPrice + If dataSourceForEvaluate Is Nothing Then + + e.DataSource = Me.DataSource + + Else + e.DataSource = dataSourceForEvaluate + End If + + ' Define the calling control. This is used to add other + ' related table and record controls as variables. + e.CallingControl = Me + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + + If Not String.IsNullOrEmpty(format) AndAlso (String.IsNullOrEmpty(formula) OrElse formula.IndexOf("Format(") < 0) Then + Return FormulaUtils.Format(resultObj, format) + Else + Return resultObj.ToString() + End If + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format,variables ,includeDS, Nothing) + End Function + + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object)) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format, variables ,True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, format, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal e as FormulaEvaluator) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, variables, True, e) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal includeDS as Boolean) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, includeDS, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, True, Nothing) + End Function + + + Public Overridable Sub RegisterPostback() + + + End Sub + + + + ' To customize, override this method in View_PersonsTableControlRow. + Public Overridable Sub SaveData() + ' Saves the associated record in the database. + ' SaveData calls Validate and Get methods - so it may be more appropriate to + ' customize those methods. + + ' 1. Load the existing record from the database. Since we save the entire record, this ensures + ' that fields that are not displayed are also properly initialized. + Me.LoadData() + + + ' 2. Perform any custom validation. + Me.Validate() + + + ' 3. Set the values in the record with data from UI controls. + ' This calls the Get() method for each of the user interface controls. + Me.GetUIData() + + ' 4. Save in the database. + ' We should not save the record if the data did not change. This + ' will save a database hit and avoid triggering any database triggers. + + If Me.DataSource.IsAnyValueChanged Then + ' Save record to database but do not commit yet. + ' Auto generated ids are available after saving for use by child (dependent) records. + Me.DataSource.Save() + + DirectCast(GetParentControlObject(Me, "View_PersonsTableControl"), View_PersonsTableControl).DataChanged = True + DirectCast(GetParentControlObject(Me, "View_PersonsTableControl"), View_PersonsTableControl).ResetData = True + End If + + + ' update session or cookie by formula + + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + ' For Master-Detail relationships, save data on the Detail table(s) + + End Sub + + ' To customize, override this method in View_PersonsTableControlRow. + 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. + + GetArmSName() + GetBorn() + GetBProvince() + GetCEdu() + GetCommission() + GetDeptAbbvr() + GetMobilePhone() + GetRankAndName() + GetRankDate() + GetRankDate1() + GetRetire() + GetSAmout() + GetSectionAbbvrName() + GetTitle() + End Sub + + + Public Overridable Sub GetArmSName() + + End Sub + + Public Overridable Sub GetBorn() + + End Sub + + Public Overridable Sub GetBProvince() + + End Sub + + Public Overridable Sub GetCEdu() + + End Sub + + Public Overridable Sub GetCommission() + + End Sub + + Public Overridable Sub GetDeptAbbvr() + + End Sub + + Public Overridable Sub GetMobilePhone() + + End Sub + + Public Overridable Sub GetRankAndName() + + End Sub + + Public Overridable Sub GetRankDate() + + End Sub + + Public Overridable Sub GetRankDate1() + + End Sub + + Public Overridable Sub GetRetire() + + End Sub + + Public Overridable Sub GetSAmout() + + End Sub + + Public Overridable Sub GetSectionAbbvrName() + + End Sub + + Public Overridable Sub GetTitle() + + End Sub + + + ' To customize, override this method in View_PersonsTableControlRow. + + Public Overridable Function CreateWhereClause() As WhereClause + + Return Nothing + + End Function + + + + ' To customize, override this method in View_PersonsTableControlRow. + 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) + View_PersonsView.DeleteRecord(pkValue) + + DirectCast(GetParentControlObject(Me, "View_PersonsTableControl"), View_PersonsTableControl).DataChanged = True + DirectCast(GetParentControlObject(Me, "View_PersonsTableControl"), View_PersonsTableControl).ResetData = True + End Sub + + Protected Overridable Sub Control_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.PreRender + ' PreRender event is raised just before page is being displayed. + Try + DbUtils.StartTransaction() + Me.RegisterPostback() + + If Not Me.Page.ErrorOnPage AndAlso (Me.Page.IsPageRefresh OrElse Me.DataChanged OrElse Me.ResetData) Then + + + ' Re-load the data and update the web page if necessary. + ' This is typically done during a postback (filter, search button, sort, pagination button). + ' In each of the other click handlers, simply set DataChanged to True to reload the data. + Me.LoadData() + Me.DataBind() + End If + + + Me.Page.Authorize(Ctype(View_PersonsRowEditButton, Control), "NO_ACCESS") + + Me.Page.Authorize(Ctype(View_PersonsRowViewButton, Control), "NO_ACCESS") + + Catch ex As Exception + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + Finally + DbUtils.EndTransaction() + End Try + End Sub + + + Protected Overrides Sub SaveControlsToSession() + MyBase.SaveControlsToSession() + + + 'Save pagination state to session. + + End Sub + + + + Protected Overrides Sub ClearControlsFromSession() + MyBase.ClearControlsFromSession() + + + + ' Clear pagination state from session. + + End Sub + + Protected Overrides Sub LoadViewState(ByVal savedState As Object) + MyBase.LoadViewState(savedState) + Dim isNewRecord As String = CType(ViewState("IsNewRecord"), String) + If Not isNewRecord Is Nothing AndAlso isNewRecord.Trim <> "" Then + Me.IsNewRecord = Boolean.Parse(isNewRecord) + End If + + Dim myCheckSum As String = CType(ViewState("CheckSum"), String) + If Not myCheckSum Is Nothing AndAlso myCheckSum.Trim <> "" Then + Me.CheckSum = myCheckSum + End If + + + ' Load view state for pagination control. + + End Sub + + Protected Overrides Function SaveViewState() As Object + ViewState("IsNewRecord") = Me.IsNewRecord.ToString() + ViewState("CheckSum") = Me.CheckSum + + + ' Load view state for pagination control. + + Return MyBase.SaveViewState() + End Function + + + ' event handler for ImageButton + Public Overridable Sub View_PersonsRowEditButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + ' The redirect URL is set on the Properties, Custom Properties or Actions. + ' The ModifyRedirectURL call resolves the parameters before the + ' Response.Redirect redirects the page to the URL. + ' Any code after the Response.Redirect call will not be executed, since the page is + ' redirected to the URL. + + + Dim url As String = "../PersonalId/EditPersonalId.aspx?PersonalId={View_PersonsTableControlRow:PK}" + + Dim shouldRedirect As Boolean = True + Dim TargetKey As String = Nothing + Dim DFKA As String = TargetKey + Dim id As String = DFKA + Dim value As String = id + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + url = Me.ModifyRedirectUrl(url, "",False) + url = Me.Page.ModifyRedirectUrl(url, "",False) + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + shouldRedirect = False + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + If shouldRedirect Then + Me.Page.ShouldSaveControlsToSession = True + Me.Page.Response.Redirect(url) + ElseIf Not TargetKey Is Nothing AndAlso _ + Not shouldRedirect Then + Me.Page.ShouldSaveControlsToSession = True + Me.Page.CloseWindow(True) + + End If + End Sub + + ' event handler for ImageButton + Public Overridable Sub View_PersonsRowViewButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + ' The redirect URL is set on the Properties, Custom Properties or Actions. + ' The ModifyRedirectURL call resolves the parameters before the + ' Response.Redirect redirects the page to the URL. + ' Any code after the Response.Redirect call will not be executed, since the page is + ' redirected to the URL. + + + Dim url As String = "../PersonalId/ShowPersonalId.aspx?PersonalId={View_PersonsTableControlRow:PK}" + + Dim shouldRedirect As Boolean = True + Dim TargetKey As String = Nothing + Dim DFKA As String = TargetKey + Dim id As String = DFKA + Dim value As String = id + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + url = Me.ModifyRedirectUrl(url, "",False) + url = Me.Page.ModifyRedirectUrl(url, "",False) + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + shouldRedirect = False + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + If shouldRedirect Then + Me.Page.ShouldSaveControlsToSession = True + Me.Page.Response.Redirect(url) + ElseIf Not TargetKey Is Nothing AndAlso _ + Not shouldRedirect Then + Me.Page.ShouldSaveControlsToSession = True + Me.Page.CloseWindow(True) + + End If + End Sub + + + 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("BaseView_PersonsTableControlRow_Rec"), String) + End Get + Set(ByVal value As String) + Me.ViewState("BaseView_PersonsTableControlRow_Rec") = value + End Set + End Property + + Private _DataSource As View_PersonsRecord + Public Property DataSource() As View_PersonsRecord + Get + Return Me._DataSource + End Get + + Set(ByVal value As View_PersonsRecord) + + Me._DataSource = value + End Set + End Property + + + + Private _checkSum As String + Public Overridable Property CheckSum() As String + Get + Return Me._checkSum + End Get + Set(ByVal value As String) + Me._checkSum = value + End Set + End Property + + Private _TotalPages As Integer + Public Property TotalPages() As Integer + Get + Return Me._TotalPages + End Get + Set(ByVal value As Integer) + Me._TotalPages = value + End Set + End Property + + Private _PageIndex As Integer + Public Property PageIndex() As Integer + Get + ' Return the PageIndex + Return Me._PageIndex + End Get + Set(ByVal value As Integer) + Me._PageIndex = value + End Set + End Property + + Private _DisplayLastPage As Boolean + Public Property DisplayLastPage() As Boolean + Get + Return Me._DisplayLastPage + End Get + Set(ByVal value As Boolean) + Me._DisplayLastPage = value + End Set + End Property + + + +#Region "Helper Properties" + + Public ReadOnly Property ArmSName() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "ArmSName"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property Born() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Born"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property BProvince() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "BProvince"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property CEdu() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "CEdu"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property Commission() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Commission"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property DeptAbbvr() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "DeptAbbvr"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property MobilePhone() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "MobilePhone"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property picture() As System.Web.UI.WebControls.Image + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "picture"), System.Web.UI.WebControls.Image) + End Get + End Property + + Public ReadOnly Property RankAndName() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RankAndName"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property RankDate() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RankDate"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property RankDate1() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RankDate1"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property Retire() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Retire"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property SAmout() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "SAmout"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property SectionAbbvrName() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "SectionAbbvrName"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property Title() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Title"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property View_PersonsRowEditButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "View_PersonsRowEditButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property View_PersonsRowViewButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "View_PersonsRowViewButton"), System.Web.UI.WebControls.ImageButton) + 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 View_PersonsRecord = 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 View_PersonsRecord + If Not Me.DataSource Is Nothing Then + Return Me.DataSource + End If + + If Not Me.RecordUniqueId Is Nothing Then + + Return View_PersonsView.GetRecord(Me.RecordUniqueId, True) + + End If + + ' Localization. + + Throw New Exception(Page.GetResourceValue("Err:RetrieveRec", "Persons")) + + End Function + + Public Shadows ReadOnly Property Page() As BaseApplicationPage + Get + Return DirectCast(MyBase.Page, BaseApplicationPage) + End Get + End Property + +#End Region + +End Class + + + +' Base class for the View_PersonsTableControl control on the ShowViewPersons page. +' Do not modify this class. Instead override any method in View_PersonsTableControl. +Public Class BaseView_PersonsTableControl + Inherits Persons.UI.BaseApplicationTableControl + + + + Protected Overridable Sub Control_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Init + + + + ' Setup the filter and search events. + + AddHandler Me.ArmyIdFromFilter1.SelectedIndexChanged, AddressOf ArmyIdFromFilter1_SelectedIndexChanged + AddHandler Me.DeptIdFilter.SelectedIndexChanged, AddressOf DeptIdFilter_SelectedIndexChanged + AddHandler Me.RankLevelFilter.SelectedIndexChanged, AddressOf RankLevelFilter_SelectedIndexChanged + AddHandler Me.RetireFilter.SelectedIndexChanged, AddressOf RetireFilter_SelectedIndexChanged + AddHandler Me.SectionIdFromFilter.SelectedIndexChanged, AddressOf SectionIdFromFilter_SelectedIndexChanged + If Not Me.Page.IsPostBack Then + Dim initialVal As String = "" + If Me.InSession(Me.ArmyIdFromFilter1) + initialVal = Me.GetFromSession(Me.ArmyIdFromFilter1) + + End If + + If initialVal <> "" + + Me.ArmyIdFromFilter1.Items.Add(New ListItem(initialVal, initialVal)) + + Me.ArmyIdFromFilter1.SelectedValue = initialVal + + End If + + End If + If Not Me.Page.IsPostBack Then + Dim initialVal As String = "" + If Me.InSession(Me.DeptIdFilter) + initialVal = Me.GetFromSession(Me.DeptIdFilter) + + End If + + If initialVal <> "" + + Me.DeptIdFilter.Items.Add(New ListItem(initialVal, initialVal)) + + Me.DeptIdFilter.SelectedValue = initialVal + + End If + + End If + If Not Me.Page.IsPostBack Then + Dim initialVal As String = "" + If Me.InSession(Me.RankLevelFilter) + initialVal = Me.GetFromSession(Me.RankLevelFilter) + + End If + + If initialVal <> "" + + Me.RankLevelFilter.Items.Add(New ListItem(initialVal, initialVal)) + + Me.RankLevelFilter.SelectedValue = initialVal + + End If + + End If + If Not Me.Page.IsPostBack Then + Dim initialVal As String = "" + If Me.InSession(Me.RetireFilter) + initialVal = Me.GetFromSession(Me.RetireFilter) + + End If + + If initialVal <> "" + + Me.RetireFilter.Items.Add(New ListItem(initialVal, initialVal)) + + Me.RetireFilter.SelectedValue = initialVal + + End If + + End If + If Not Me.Page.IsPostBack Then + Dim initialVal As String = "" + If Me.InSession(Me.SectionIdFromFilter) + initialVal = Me.GetFromSession(Me.SectionIdFromFilter) + + End If + + If initialVal <> "" + + Me.SectionIdFromFilter.Items.Add(New ListItem(initialVal, initialVal)) + + Me.SectionIdFromFilter.SelectedValue = initialVal + + End If + + End If + If Not Me.Page.IsPostBack Then + Dim initialVal As String = "" + If Me.InSession(Me.View_PersonsSearch1) + initialVal = Me.GetFromSession(Me.View_PersonsSearch1) + + End If + + If initialVal <> "" + + Me.View_PersonsSearch1.Text = initialVal + + End If + + End If + + + ' Control Initializations. + ' Initialize the table's current sort order. + + If Me.InSession(Me, "Order_By") Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + Me.CurrentSortOrder.Add(View_PersonsView.RankId, OrderByItem.OrderDir.Asc) + + Me.CurrentSortOrder.Add(View_PersonsView.RankDate, OrderByItem.OrderDir.Asc) + + Me.CurrentSortOrder.Add(View_PersonsView.DatePrevRank, OrderByItem.OrderDir.Asc) + + End If + + + + ' Setup default pagination settings. + + Me.PageSize = CInt(Me.GetFromSession(Me, "Page_Size", "10")) + Me.PageIndex = CInt(Me.GetFromSession(Me, "Page_Index", "0")) + + + + Me.ClearControlsFromSession() + End Sub + + Protected Overridable Sub Control_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load + + SaveControlsToSession_Ajax() + + ' Setup the pagination events. + + AddHandler Me.View_PersonsPagination.FirstPage.Click, AddressOf View_PersonsPagination_FirstPage_Click + + AddHandler Me.View_PersonsPagination.LastPage.Click, AddressOf View_PersonsPagination_LastPage_Click + + AddHandler Me.View_PersonsPagination.NextPage.Click, AddressOf View_PersonsPagination_NextPage_Click + + AddHandler Me.View_PersonsPagination.PageSizeButton.Click, AddressOf View_PersonsPagination_PageSizeButton_Click + + AddHandler Me.View_PersonsPagination.PreviousPage.Click, AddressOf View_PersonsPagination_PreviousPage_Click + + + ' Setup the sorting events. + + AddHandler Me.ArmSNameLabel.Click, AddressOf ArmSNameLabel_Click + + AddHandler Me.BornLabel.Click, AddressOf BornLabel_Click + + AddHandler Me.BProvinceLabel.Click, AddressOf BProvinceLabel_Click + + AddHandler Me.CEduLabel.Click, AddressOf CEduLabel_Click + + AddHandler Me.MobilePhoneLabel.Click, AddressOf MobilePhoneLabel_Click + + AddHandler Me.PersonalNameLabel.Click, AddressOf PersonalNameLabel_Click + + AddHandler Me.RankDateLabel.Click, AddressOf RankDateLabel_Click + + AddHandler Me.RankDateLabel1.Click, AddressOf RankDateLabel1_Click + + AddHandler Me.RetireLabel.Click, AddressOf RetireLabel_Click + + AddHandler Me.SAmoutLabel.Click, AddressOf SAmoutLabel_Click + + AddHandler Me.SectionAbbvrNameLabel.Click, AddressOf SectionAbbvrNameLabel_Click + + AddHandler Me.TitleLabel.Click, AddressOf TitleLabel_Click + + ' Setup the button events. + + AddHandler Me.View_PersonsExportCSVButton.Click, AddressOf View_PersonsExportCSVButton_Click + + AddHandler Me.View_PersonsExportExcelButton.Click, AddressOf View_PersonsExportExcelButton_Click + + AddHandler Me.View_PersonsPDFButton.Click, AddressOf View_PersonsPDFButton_Click + + AddHandler Me.View_PersonsRefreshButton.Click, AddressOf View_PersonsRefreshButton_Click + + AddHandler Me.View_PersonsResetButton.Click, AddressOf View_PersonsResetButton_Click + + AddHandler Me.View_PersonsWordButton.Click, AddressOf View_PersonsWordButton_Click + + AddHandler Me.View_PersonsSearchButton1.Button.Click, AddressOf View_PersonsSearchButton1_Click + + + ' Setup events for others + + End Sub + + + Public Overridable Sub LoadData() + + ' Read data from database. Returns an array of records that can be assigned + ' to the DataSource table control property. + Try + Dim joinFilter As CompoundFilter = CreateCompoundJoinFilter() + + ' The WHERE clause will be empty when displaying all records in table. + Dim wc As WhereClause = CreateWhereClause() + If wc IsNot Nothing AndAlso Not wc.RunQuery Then + ' Initialize an empty array of records + Dim alist As New ArrayList(0) + Me.DataSource = DirectCast(alist.ToArray(GetType(View_PersonsRecord)), View_PersonsRecord()) + ' Add records to the list if needed. + Me.AddNewRecords() + Me._TotalRecords = 0 + Me._TotalPages = 0 + Return + End If + + ' Call OrderBy to determine the order - either use the order defined + ' on the Query Wizard, or specified by user (by clicking on column heading) + Dim orderBy As OrderBy = CreateOrderBy() + + ' Get the pagesize from the pagesize control. + Me.GetPageSize() + + If Me.DisplayLastPage Then + Dim totalRecords As Integer = If(Me._TotalRecords < 0, View_PersonsView.GetRecordCount(CreateCompoundJoinFilter(), CreateWhereClause()), Me._TotalRecords) + + Dim totalPages As Integer = CInt(Math.Ceiling(totalRecords / Me.PageSize)) + + Me.PageIndex = totalPages - 1 + End If + + ' Make sure PageIndex (current page) and PageSize are within bounds. + If Me.PageIndex < 0 Then + Me.PageIndex = 0 + End If + If Me.PageSize < 1 Then + Me.PageSize = 1 + End If + + ' Retrieve the records and set the table DataSource. + ' Only PageSize records are fetched starting at PageIndex (zero based). + If Me.AddNewRecord > 0 Then + ' Make sure to preserve the previously entered data on new rows. + Dim postdata As New ArrayList + For Each rc As View_PersonsTableControlRow In Me.GetRecordControls() + If Not rc.IsNewRecord Then + rc.DataSource = rc.GetRecord() + rc.GetUIData() + postdata.Add(rc.DataSource) + UIData.Add(rc.PreservedUIData()) + End If + Next + Me.DataSource = DirectCast(postdata.ToArray(GetType(View_PersonsRecord)), View_PersonsRecord()) + Else ' Get the records from the database + Me.DataSource = View_PersonsView.GetRecords(joinFilter, wc, orderBy, Me.PageIndex, Me.PageSize) + + End If + + ' if the datasource contains no records contained in database, then load the last page. + If (DbUtils.GetCreatedRecords(Me.DataSource).Length = 0 AndAlso Not Me.DisplayLastPage) Then + Me.DisplayLastPage = True + LoadData() + Else + + ' Add any new rows desired by the user. + Me.AddNewRecords() + + + ' Initialize the page and grand totals. now + + Me.SAmoutGrandTotal.Text = Me.GetSAmoutGrandTotal() + If Me.SAmoutGrandTotal.Text Is Nothing OrElse _ + Me.SAmoutGrandTotal.Text.Trim() = "" Then + Me.SAmoutGrandTotal.Text = " " + End If + End If + + Catch ex As Exception + ' Report the error message to the end user + Dim msg As String = ex.Message + If ex.InnerException IsNot Nothing Then + msg = msg & " InnerException: " & ex.InnerException.Message + End If + Throw New Exception(msg, ex.InnerException) + End Try + End Sub + + + + + Public Overrides Sub DataBind() + ' The DataBind method binds the user interface controls to the values + ' from the database record for each row in the table. To do this, it calls the + ' DataBind for each of the rows. + ' DataBind also populates any filters above the table, and sets the pagination + ' control to the correct number of records and the current page number. + + MyBase.DataBind() + + ' Make sure that the DataSource is initialized. + If Me.DataSource Is Nothing Then + Return + End If + + 'LoadData for DataSource for chart and report if they exist + + ' Setup the pagination controls. + BindPaginationControls() + + + + ' Bind the repeater with the list of records to expand the UI. + Dim rep As System.Web.UI.WebControls.Repeater = CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "View_PersonsTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return + rep.DataSource = DataSource() + rep.DataBind() + + Dim index As Integer = 0 + For Each repItem As System.Web.UI.WebControls.RepeaterItem In rep.Items + ' Loop through all rows in the table, set its DataSource and call DataBind(). + Dim recControl As View_PersonsTableControlRow = DirectCast(repItem.FindControl("View_PersonsTableControlRow"), View_PersonsTableControlRow) + recControl.DataSource = Me.DataSource(index) + If Me.UIData.Count > index Then + recControl.PreviousUIData = Me.UIData(index) + End If + recControl.DataBind() + recControl.Visible = Not Me.InDeletedRecordIds(recControl) + + index += 1 + Next + + + + + ' Call the Set methods for each controls on the panel + + SetArmSNameLabel() + SetArmyIdFromFilter1() + SetArmyIdLabel2() + SetBornLabel() + SetBProvinceLabel() + SetCEduLabel() + SetCommissionLabel() + SetDeptIdFilter() + SetDeptIdLabel() + SetMobilePhoneLabel() + SetPersonalNameLabel() + SetpictureLabel() + SetRankDateLabel() + SetRankDateLabel1() + SetRankLevelFilter() + SetRankLevelLabel() + SetRetireFilter() + SetRetireLabel() + SetRetireLabel1() + + SetSAmoutLabel() + SetSectionAbbvrNameLabel() + SetSectionIdFromFilter() + SetSectionIdLabel() + SetTitleLabel() + + + + + + + + SetView_PersonsSearch1() + + SetView_PersonsTableControlCollapsibleRegion() + SetView_PersonsTableControlIcon() + SetView_PersonsTableControlPanelExtender() + + + ' setting the state of expand or collapse alternative rows + + + ' Load data for each record and table UI control. + ' Ordering is important because child controls get + ' their parent ids from their parent UI controls. + + + ' this method calls the set method for controls with special formula like running total, sum, rank, etc + SetFormulaControls() + End Sub + + Public Overridable Sub SetFormulaControls() + ' this method calls Set methods for the control that has special formula + + + + End Sub + + + + Public Overridable Sub RegisterPostback() + + Me.Page.RegisterPostBackTrigger(MiscUtils.FindControlRecursively(Me,"View_PersonsExportCSVButton")) + + Me.Page.RegisterPostBackTrigger(MiscUtils.FindControlRecursively(Me,"View_PersonsExportExcelButton")) + + Me.Page.RegisterPostBackTrigger(MiscUtils.FindControlRecursively(Me,"View_PersonsPDFButton")) + + Me.Page.RegisterPostBackTrigger(MiscUtils.FindControlRecursively(Me,"View_PersonsWordButton")) + + + End Sub + + Public EvaluateFormulaDelegate As BaseClasses.Data.DataSource.EvaluateFormulaDelegate = New BaseClasses.Data.DataSource.EvaluateFormulaDelegate(AddressOf Me.EvaluateFormula) + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean, ByVal e as FormulaEvaluator) As String + If e Is Nothing + e = New FormulaEvaluator() + End If + + e.Variables.Clear() + + + ' add variables for formula evaluation + If variables IsNot Nothing Then + Dim enumerator As System.Collections.Generic.IEnumerator(Of System.Collections.Generic.KeyValuePair(Of String, Object)) = variables.GetEnumerator() + While enumerator.MoveNext() + e.Variables.Add(enumerator.Current.Key, enumerator.Current.Value) + End While + End If + + If includeDS + + End If + + ' All variables referred to in the formula are expected to be + ' properties of the DataSource. For example, referring to + ' UnitPrice as a variable will refer to DataSource.UnitPrice + e.DataSource = dataSourceForEvaluate + + ' Define the calling control. This is used to add other + ' related table and record controls as variables. + e.CallingControl = Me + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + + If Not String.IsNullOrEmpty(format) AndAlso (String.IsNullOrEmpty(formula) OrElse formula.IndexOf("Format(") < 0) Then + Return FormulaUtils.Format(resultObj, format) + Else + Return resultObj.ToString() + End If + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format,variables ,includeDS, Nothing) + End Function + + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object)) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format, variables ,True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, format, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal e as FormulaEvaluator) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, variables, True, e) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal includeDS as Boolean) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, includeDS, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, True, Nothing) + End Function + + + + + Public Overridable Sub ResetControl() + + Me.ArmyIdFromFilter1.ClearSelection() + + Me.DeptIdFilter.ClearSelection() + + Me.RankLevelFilter.ClearSelection() + + Me.RetireFilter.ClearSelection() + + Me.SectionIdFromFilter.ClearSelection() + + Me.View_PersonsSearch1.Text = "" + + Me.CurrentSortOrder.Reset() + If (Me.InSession(Me, "Order_By")) Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + Me.CurrentSortOrder.Add(View_PersonsView.RankId, OrderByItem.OrderDir.Asc) + + Me.CurrentSortOrder.Add(View_PersonsView.RankDate, OrderByItem.OrderDir.Asc) + + Me.CurrentSortOrder.Add(View_PersonsView.DatePrevRank, OrderByItem.OrderDir.Asc) + + End If + + Me.PageIndex = 0 + End Sub + + Protected Overridable Sub BindPaginationControls() + ' Setup the pagination controls. + + ' Bind the pagination labels. + + If DbUtils.GetCreatedRecords(Me.DataSource).Length > 0 Then + + Me.View_PersonsPagination.CurrentPage.Text = (Me.PageIndex + 1).ToString() + Else + Me.View_PersonsPagination.CurrentPage.Text = "0" + End If + Me.View_PersonsPagination.PageSize.Text = Me.PageSize.ToString() + Me.View_PersonsPagination.TotalItems.Text = Me.TotalRecords.ToString() + Me.View_PersonsPagination.TotalPages.Text = Me.TotalPages.ToString() + + ' Bind the buttons for View_PersonsTableControl pagination. + + Me.View_PersonsPagination.FirstPage.Enabled = Not (Me.PageIndex = 0) + If Me._TotalPages < 0 Then ' if the total pages is not determined yet, enable last and next buttons + Me.View_PersonsPagination.LastPage.Enabled = True + ElseIf Me._TotalPages = 0 ' if the total pages is determined and it is 0, enable last and next buttons + Me.View_PersonsPagination.LastPage.Enabled = False + Else ' if the total pages is the last page, disable last and next buttons + Me.View_PersonsPagination.LastPage.Enabled = Not (Me.PageIndex = Me.TotalPages - 1) + End If + + If Me._TotalPages < 0 Then ' if the total pages is not determined yet, enable last and next buttons + Me.View_PersonsPagination.NextPage.Enabled = True + ElseIf Me._TotalPages = 0 ' if the total pages is determined and it is 0, enable last and next buttons + Me.View_PersonsPagination.NextPage.Enabled = False + Else ' if the total pages is the last page, disable last and next buttons + Me.View_PersonsPagination.NextPage.Enabled = Not (Me.PageIndex = Me.TotalPages - 1) + End If + + Me.View_PersonsPagination.PreviousPage.Enabled = Not (Me.PageIndex = 0) + + + End Sub + + Public Overridable Sub SaveData() + ' Save the data from the entire table. Calls each row's Save Data + ' to save their data. This function is called by the Click handler of the + ' Save button. The button handler should Start/Commit/End a transaction. + + Dim recCtl As View_PersonsTableControlRow + For Each recCtl In Me.GetRecordControls() + + If Me.InDeletedRecordIds(recCtl) Then + ' Delete any pending deletes. + recCtl.Delete() + Else + If recCtl.Visible Then + recCtl.SaveData() + End If + End If + + Next + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + ' Set IsNewRecord to False for all records - since everything has been saved and is no longer "new" + For Each recCtl In Me.GetRecordControls() + recCtl.IsNewRecord = False + Next + + + ' Set DeletedRecordsIds to Nothing since we have deleted all pending deletes. + Me.DeletedRecordIds = Nothing + + End Sub + + Public Overridable Function CreateCompoundJoinFilter() As CompoundFilter + Dim jFilter As CompoundFilter = New CompoundFilter() + + Return jFilter + + End Function + + + Public Overridable Function CreateOrderBy() As OrderBy + ' The CurrentSortOrder is initialized to the sort order on the + ' Query Wizard. It may be modified by the Click handler for any of + ' the column heading to sort or reverse sort by that column. + ' You can add your own sort order, or modify it on the Query Wizard. + Return Me.CurrentSortOrder + End Function + + Public Overridable Function CreateWhereClause() As WhereClause + 'This CreateWhereClause is used for loading the data. + View_PersonsView.Instance.InnerFilter = Nothing + Dim wc As WhereClause = New WhereClause() + + ' Compose the WHERE clause consiting of: + ' 1. Static clause defined at design time. + ' 2. User selected search criteria. + ' 3. User selected filter criteria. + + + If IsValueSelected(Me.ArmyIdFromFilter1) Then + + wc.iAND(View_PersonsView.ArmyId, BaseFilter.ComparisonOperator.EqualsTo, MiscUtils.GetSelectedValue(Me.ArmyIdFromFilter1, Me.GetFromSession(Me.ArmyIdFromFilter1)), False, False) + + End If + + + + If IsValueSelected(Me.DeptIdFilter) Then + + wc.iAND(View_PersonsView.DeptId, BaseFilter.ComparisonOperator.EqualsTo, MiscUtils.GetSelectedValue(Me.DeptIdFilter, Me.GetFromSession(Me.DeptIdFilter)), False, False) + + End If + + + + If IsValueSelected(Me.RankLevelFilter) Then + + wc.iAND(View_PersonsView.RankLevel, BaseFilter.ComparisonOperator.EqualsTo, MiscUtils.GetSelectedValue(Me.RankLevelFilter, Me.GetFromSession(Me.RankLevelFilter)), False, False) + + End If + + + + If IsValueSelected(Me.RetireFilter) Then + + wc.iAND(View_PersonsView.Retire, BaseFilter.ComparisonOperator.EqualsTo, MiscUtils.GetSelectedValue(Me.RetireFilter, Me.GetFromSession(Me.RetireFilter)), False, False) + + End If + + + + If IsValueSelected(Me.SectionIdFromFilter) Then + + wc.iAND(View_PersonsView.SectionId, BaseFilter.ComparisonOperator.EqualsTo, MiscUtils.GetSelectedValue(Me.SectionIdFromFilter, Me.GetFromSession(Me.SectionIdFromFilter)), False, False) + + End If + + + + If IsValueSelected(Me.View_PersonsSearch1) Then + If Me.View_PersonsSearch1.Text = BaseClasses.Resources.AppResources.GetResourceValue("Txt:SearchForEllipsis", Nothing) Then + Me.View_PersonsSearch1.Text = "" + Else + ' Strip "..." from begin and ending of the search text, otherwise the search will return 0 values as in database "..." is not stored. + + If Me.View_PersonsSearch1.Text.StartsWith("...") Then + Me.View_PersonsSearch1.Text = Me.View_PersonsSearch1.Text.SubString(3,Me.View_PersonsSearch1.Text.Length-3) + End If + If Me.View_PersonsSearch1.Text.EndsWith("...") then + Me.View_PersonsSearch1.Text = Me.View_PersonsSearch1.Text.SubString(0,Me.View_PersonsSearch1.Text.Length-3) + ' Strip the last word as well as it is likely only a partial word + Dim endindex As Integer = View_PersonsSearch1.Text.Length - 1 + While (Not Char.IsWhiteSpace(View_PersonsSearch1.Text(endindex)) AndAlso endindex > 0) + endindex -= 1 + End While + If endindex > 0 Then + View_PersonsSearch1.Text = View_PersonsSearch1.Text.Substring(0, endindex) + End If + End If + End If + + Dim formatedSearchText As String = MiscUtils.GetSelectedValue(Me.View_PersonsSearch1, Me.GetFromSession(Me.View_PersonsSearch1)) + + ' After stripping "..." see if the search text is null or empty. + If IsValueSelected(Me.View_PersonsSearch1) Then + ' These clauses are added depending on operator and fields selected in Control's property page, bindings tab. + + Dim search As WhereClause = New WhereClause() + + search.iOR(View_PersonsView.SectionAbbvrName, BaseFilter.ComparisonOperator.Contains, MiscUtils.GetSelectedValue(Me.View_PersonsSearch1, Me.GetFromSession(Me.View_PersonsSearch1)), True, False) + + search.iOR(View_PersonsView.DeptAbbvr, BaseFilter.ComparisonOperator.Contains, MiscUtils.GetSelectedValue(Me.View_PersonsSearch1, Me.GetFromSession(Me.View_PersonsSearch1)), True, False) + + search.iOR(View_PersonsView.PersonalLastName, BaseFilter.ComparisonOperator.Contains, MiscUtils.GetSelectedValue(Me.View_PersonsSearch1, Me.GetFromSession(Me.View_PersonsSearch1)), True, False) + + search.iOR(View_PersonsView.PersonalName, BaseFilter.ComparisonOperator.Contains, MiscUtils.GetSelectedValue(Me.View_PersonsSearch1, Me.GetFromSession(Me.View_PersonsSearch1)), True, False) + + search.iOR(View_PersonsView.Retire, BaseFilter.ComparisonOperator.Contains, MiscUtils.GetSelectedValue(Me.View_PersonsSearch1, Me.GetFromSession(Me.View_PersonsSearch1)), True, False) + + wc.iAND(search) + + End If + End If + + Return wc + End Function + + + Public Overridable Function CreateWhereClause(ByVal searchText as String, ByVal fromSearchControl as String, ByVal AutoTypeAheadSearch as String, ByVal AutoTypeAheadWordSeparators as String) As WhereClause + ' This CreateWhereClause is used for loading list of suggestions for Auto Type-Ahead feature. + View_PersonsView.Instance.InnerFilter = Nothing + Dim wc As WhereClause = New WhereClause() + + ' Compose the WHERE clause consiting of: + ' 1. Static clause defined at design time. + ' 2. User selected search criteria. + ' 3. User selected filter criteria. + + Dim appRelativeVirtualPath As String = CType(HttpContext.Current.Session("AppRelativeVirtualPath"), String) + + ' Adds clauses if values are selected in Filter controls which are configured in the page. + + Dim ArmyIdFromFilter1SelectedValue As String = CType(HttpContext.Current.Session()(HttpContext.Current.Session.SessionID & appRelativeVirtualPath & "ArmyIdFromFilter1_Ajax"), String) + If IsValueSelected(ArmyIdFromFilter1SelectedValue) Then + + wc.iAND(View_PersonsView.ArmyId, BaseFilter.ComparisonOperator.EqualsTo, ArmyIdFromFilter1SelectedValue, false, False) + + End If + + Dim DeptIdFilterSelectedValue As String = CType(HttpContext.Current.Session()(HttpContext.Current.Session.SessionID & appRelativeVirtualPath & "DeptIdFilter_Ajax"), String) + If IsValueSelected(DeptIdFilterSelectedValue) Then + + wc.iAND(View_PersonsView.DeptId, BaseFilter.ComparisonOperator.EqualsTo, DeptIdFilterSelectedValue, false, False) + + End If + + Dim RankLevelFilterSelectedValue As String = CType(HttpContext.Current.Session()(HttpContext.Current.Session.SessionID & appRelativeVirtualPath & "RankLevelFilter_Ajax"), String) + If IsValueSelected(RankLevelFilterSelectedValue) Then + + wc.iAND(View_PersonsView.RankLevel, BaseFilter.ComparisonOperator.EqualsTo, RankLevelFilterSelectedValue, false, False) + + End If + + Dim RetireFilterSelectedValue As String = CType(HttpContext.Current.Session()(HttpContext.Current.Session.SessionID & appRelativeVirtualPath & "RetireFilter_Ajax"), String) + If IsValueSelected(RetireFilterSelectedValue) Then + + wc.iAND(View_PersonsView.Retire, BaseFilter.ComparisonOperator.EqualsTo, RetireFilterSelectedValue, false, False) + + End If + + Dim SectionIdFromFilterSelectedValue As String = CType(HttpContext.Current.Session()(HttpContext.Current.Session.SessionID & appRelativeVirtualPath & "SectionIdFromFilter_Ajax"), String) + If IsValueSelected(SectionIdFromFilterSelectedValue) Then + + wc.iAND(View_PersonsView.SectionId, BaseFilter.ComparisonOperator.EqualsTo, SectionIdFromFilterSelectedValue, false, False) + + End If + + If IsValueSelected(searchText) and fromSearchControl = "View_PersonsSearch1" Then + Dim formatedSearchText as String = searchText + ' Strip "..." from begin and ending of the search text, otherwise the search will return 0 values as in database "..." is not stored. + If searchText.StartsWith("...") Then + formatedSearchText = searchText.SubString(3,searchText.Length-3) + End If + If searchText.EndsWith("...") Then + formatedSearchText = searchText.SubString(0,searchText.Length-3) + ' Strip the last word as well as it is likely only a partial word + Dim endindex As Integer = searchText.Length - 1 + While (Not Char.IsWhiteSpace(searchText(endindex)) AndAlso endindex > 0) + endindex -= 1 + End While + If endindex > 0 Then + searchText = searchText.Substring(0, endindex) + End If + End If + 'After stripping "...", trim any leading and trailing whitespaces + formatedSearchText = formatedSearchText.Trim() + ' After stripping "..." see if the search text is null or empty. + If IsValueSelected(formatedSearchText) Then + ' These clauses are added depending on operator and fields selected in Control's property page, bindings tab. + + Dim search As WhereClause = New WhereClause() + + If InvariantLCase(AutoTypeAheadSearch).equals("wordsstartingwithsearchstring") Then + + search.iOR(View_PersonsView.SectionAbbvrName, BaseFilter.ComparisonOperator.Starts_With, formatedSearchText, True, False) + search.iOR(View_PersonsView.SectionAbbvrName, BaseFilter.ComparisonOperator.Contains, AutoTypeAheadWordSeparators & formatedSearchText, True, False) + + search.iOR(View_PersonsView.DeptAbbvr, BaseFilter.ComparisonOperator.Starts_With, formatedSearchText, True, False) + search.iOR(View_PersonsView.DeptAbbvr, BaseFilter.ComparisonOperator.Contains, AutoTypeAheadWordSeparators & formatedSearchText, True, False) + + search.iOR(View_PersonsView.PersonalLastName, BaseFilter.ComparisonOperator.Starts_With, formatedSearchText, True, False) + search.iOR(View_PersonsView.PersonalLastName, BaseFilter.ComparisonOperator.Contains, AutoTypeAheadWordSeparators & formatedSearchText, True, False) + + search.iOR(View_PersonsView.PersonalName, BaseFilter.ComparisonOperator.Starts_With, formatedSearchText, True, False) + search.iOR(View_PersonsView.PersonalName, BaseFilter.ComparisonOperator.Contains, AutoTypeAheadWordSeparators & formatedSearchText, True, False) + + search.iOR(View_PersonsView.Retire, BaseFilter.ComparisonOperator.Starts_With, formatedSearchText, True, False) + search.iOR(View_PersonsView.Retire, BaseFilter.ComparisonOperator.Contains, AutoTypeAheadWordSeparators & formatedSearchText, True, False) + + Else + + search.iOR(View_PersonsView.SectionAbbvrName, BaseFilter.ComparisonOperator.Contains, formatedSearchText, True, False) + search.iOR(View_PersonsView.DeptAbbvr, BaseFilter.ComparisonOperator.Contains, formatedSearchText, True, False) + search.iOR(View_PersonsView.PersonalLastName, BaseFilter.ComparisonOperator.Contains, formatedSearchText, True, False) + search.iOR(View_PersonsView.PersonalName, BaseFilter.ComparisonOperator.Contains, formatedSearchText, True, False) + search.iOR(View_PersonsView.Retire, BaseFilter.ComparisonOperator.Contains, formatedSearchText, True, False) + End If + wc.iAND(search) + + End If + End If + + + Return wc + End Function + + Public Overridable Function GetAutoCompletionList_View_PersonsSearch1(ByVal prefixText As String, ByVal count As Integer) As String() + Dim resultList As ArrayList = New ArrayList + Dim wordList As ArrayList = New ArrayList + Dim iteration As Integer = 0 + + Dim filterJoin As CompoundFilter = CreateCompoundJoinFilter() + Dim wc As WhereClause = CreateWhereClause(prefixText,"View_PersonsSearch1", "WordsStartingWithSearchString", "[^a-zA-Z0-9]") + While (resultList.Count < count AndAlso iteration < 5) + ' Fetch 100 records in each iteration + Dim recordList () As Persons.Business.View_PersonsRecord = View_PersonsView.GetRecords(filterJoin, wc, Nothing, iteration, 100) + Dim rec As View_PersonsRecord = Nothing + Dim resultItem As String = "" + For Each rec In recordList + ' Exit the loop if recordList count has reached AutoTypeAheadListSize. + If resultList.Count >= count then + Exit For + End If + ' If the field is configured to Display as Foreign key, Format() method returns the + ' Display as Forien Key value instead of original field value. + ' Since search had to be done in multiple fields (selected in Control's page property, binding tab) in a record, + ' We need to find relevent field to display which matches the prefixText and is not already present in the result list. + + resultItem = rec.Format(View_PersonsView.SectionAbbvrName) + If resultItem IsNot Nothing AndAlso resultItem.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture).Contains(prefixText.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture)) Then + + Dim isAdded As Boolean = FormatSuggestions(prefixText, resultItem, 50, "AtBeginningOfMatchedString", "WordsStartingWithSearchString", "[^a-zA-Z0-9]", resultList) + If isAdded Then + Continue For + End If + End If + + resultItem = rec.Format(View_PersonsView.DeptAbbvr) + If resultItem IsNot Nothing AndAlso resultItem.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture).Contains(prefixText.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture)) Then + + Dim isAdded As Boolean = FormatSuggestions(prefixText, resultItem, 50, "AtBeginningOfMatchedString", "WordsStartingWithSearchString", "[^a-zA-Z0-9]", resultList) + If isAdded Then + Continue For + End If + End If + + resultItem = rec.Format(View_PersonsView.PersonalLastName) + If resultItem IsNot Nothing AndAlso resultItem.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture).Contains(prefixText.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture)) Then + + Dim isAdded As Boolean = FormatSuggestions(prefixText, resultItem, 50, "AtBeginningOfMatchedString", "WordsStartingWithSearchString", "[^a-zA-Z0-9]", resultList) + If isAdded Then + Continue For + End If + End If + + resultItem = rec.Format(View_PersonsView.PersonalName) + If resultItem IsNot Nothing AndAlso resultItem.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture).Contains(prefixText.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture)) Then + + Dim isAdded As Boolean = FormatSuggestions(prefixText, resultItem, 50, "AtBeginningOfMatchedString", "WordsStartingWithSearchString", "[^a-zA-Z0-9]", resultList) + If isAdded Then + Continue For + End If + End If + + resultItem = rec.Format(View_PersonsView.Retire) + If resultItem IsNot Nothing AndAlso resultItem.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture).Contains(prefixText.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture)) Then + + Dim isAdded As Boolean = FormatSuggestions(prefixText, resultItem, 50, "AtBeginningOfMatchedString", "WordsStartingWithSearchString", "[^a-zA-Z0-9]", resultList) + If isAdded Then + Continue For + End If + End If + + Next + ' Exit the loop if number of records found is less as further iteration will not return any more records + If recordList .Length < 100 Then + Exit While + End If + iteration += 1 + End While + + resultList.Sort() + Dim result() As String = New String(resultList.Count - 1) {} + Array.Copy(resultList.ToArray, result, resultList.Count) + Return result + End Function + + + Public Overridable Function FormatSuggestions(ByVal prefixText As String, ByVal resultItem As String, _ + ByVal columnLength As Integer, ByVal AutoTypeAheadDisplayFoundText As String, _ + ByVal autoTypeAheadSearch As String, ByVal AutoTypeAheadWordSeparators As String, _ + ByVal resultList As ArrayList) As Boolean + + 'Formats the resultItem and adds it to the list of suggestions. + Dim index As Integer = resultItem.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture).IndexOf(prefixText.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture)) + Dim itemToAdd As String = "" + Dim isFound As Boolean = False + Dim isAdded As Boolean = False + ' Get the index where prfixt is at the beginning of resultItem. If not found then, index of word which begins with prefixText. + If InvariantLCase(autoTypeAheadSearch).equals("wordsstartingwithsearchstring") And Not index = 0 Then + ' Expression to find word which contains AutoTypeAheadWordSeparators followed by prefixText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex( AutoTypeAheadWordSeparators + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + If regex1.IsMatch(resultItem) Then + index = regex1.Match(resultItem).Index + isFound = True + End If + ' If the prefixText is found immediatly after white space then starting of the word is found so don not search any further + If not resultItem(index).ToString() = " " Then + ' Expression to find beginning of the word which contains AutoTypeAheadWordSeparators followed by prefixText + Dim regex As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\\S*" + AutoTypeAheadWordSeparators + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + If regex.IsMatch(resultItem) Then + index = regex.Match(resultItem).Index + isFound = True + End If + End If + End If + + ' If autoTypeAheadSearch value is wordsstartingwithsearchstring then, extract the substring only if the prefixText is found at the + ' beginning of the resultItem (index = 0) or a word in resultItem is found starts with prefixText. + If index = 0 Or isFound Or InvariantLCase(autoTypeAheadSearch).Equals("anywhereinstring") then + If InvariantLCase(AutoTypeAheadDisplayFoundText).equals("atbeginningofmatchedstring") Then + ' Expression to find beginning of the word which contains prefixText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\\S*" + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + ' Find the beginning of the word which contains prefexText + If (StringUtils.InvariantLCase(autoTypeAheadSearch).Equals("anywhereinstring") AndAlso regex1.IsMatch(resultItem)) Then + index = regex1.Match(resultItem).Index + isFound = True + End If + ' Display string from the index till end of the string if sub string from index till end is less than columnLength value. + If Len(resultItem) - index <= columnLength Then + If index = 0 Then + itemToAdd = resultItem + Else + itemToAdd = "..." & resultItem.Substring(index, Len(resultItem) - index) + End If + Else + If index = 0 Then + itemToAdd = resultItem.Substring(index, (columnLength - 3)) & "..." + Else + 'Truncate the string to show only columnLength - 6 characters as begining and trailing "..." has to be appended. + itemToAdd = "..." & resultItem.Substring(index , columnLength - 6) & "..." + End If + End If + ElseIf InvariantLCase(AutoTypeAheadDisplayFoundText).equals("inmiddleofmatchedstring") Then + Dim subStringBeginIndex As Integer = CType(columnLength/2, Integer) + If Len(resultItem) <= columnLength Then + itemToAdd = resultItem + Else + ' Sanity check at end of the string + If index + Len(prefixText) = columnLength Then + itemToAdd = "..." & resultItem.Substring(index-columnLength,index) + ElseIf Len(resultItem) - index < subStringBeginIndex Then + ' Display string from the end till columnLength value if, index is closer to the end of the string. + itemToAdd = "..." & resultItem.Substring(Len(resultItem)-columnLength,Len(resultItem)) + ElseIf index <= subStringBeginIndex Then + ' Sanity chet at beginning of the string + itemToAdd = resultItem.Substring(0, columnLength) & "..." + Else + ' Display string containing text before the prefixText occures and text after the prefixText + itemToAdd = "..." & resultItem.Substring(index - subStringBeginIndex, columnLength) & "..." + End If + End If + ElseIf InvariantLCase(AutoTypeAheadDisplayFoundText).equals("atendofmatchedstring") Then + ' Expression to find ending of the word which contains prefexText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\s", System.Text.RegularExpressions.RegexOptions.IgnoreCase) + ' Find the ending of the word which contains prefexText + If regex1.IsMatch(resultItem, index + 1) Then + index = regex1.Match(resultItem, index + 1).Index + Else + ' If the word which contains prefexText is the last word in string, regex1.IsMatch returns false. + index = resultItem.Length + End If + If index > Len(resultItem) Then + index = Len(resultItem) + End If + ' If text from beginning of the string till index is less than columnLength value then, display string from the beginning till index. + If index <= columnLength Then + if index = Len(resultItem) Then 'Make decision to append "..." + itemToAdd = resultItem.Substring(0,index) + Else + itemToAdd = resultItem.Substring(0,index) & "..." + End If + Else + If index = Len(resultItem) Then + itemToAdd = "..." & resultItem.Substring(index - (columnLength - 3), (columnLength - 3)) + Else + 'Truncate the string to show only columnLength - 6 characters as begining and trailing "..." has to be appended. + itemToAdd = "..." & resultItem.Substring(index - (columnLength - 6), columnLength - 6) & "..." + End If + End If + End If + + ' Remove newline character from itemToAdd + Dim prefixTextIndex As Integer = itemToAdd.IndexOf(prefixText, StringComparison.CurrentCultureIgnoreCase) + ' If itemToAdd contains any newline after the search text then show text only till newline + Dim regex2 As System.Text.RegularExpressions.Regex = New System.Text.RegularExpressions.Regex("(" & vbCrLf & "|" & vbLf & ")", System.Text.RegularExpressions.RegexOptions.IgnoreCase) + Dim newLineIndexAfterPrefix As Integer = -1 + If regex2.IsMatch(itemToAdd, prefixTextIndex) Then + newLineIndexAfterPrefix = regex2.Match(itemToAdd, prefixTextIndex).Index + End If + If (newLineIndexAfterPrefix > -1) Then + If itemToAdd.EndsWith("...") Then + itemToAdd = (itemToAdd.Substring(0, newLineIndexAfterPrefix) + "...") + Else + itemToAdd = itemToAdd.Substring(0, newLineIndexAfterPrefix) + End If + End If + ' If itemToAdd contains any newline before search text then show text which comes after newline + Dim regex3 As System.Text.RegularExpressions.Regex = New System.Text.RegularExpressions.Regex("(" & vbCrLf & "|" & vbLf & ")", (System.Text.RegularExpressions.RegexOptions.IgnoreCase Or System.Text.RegularExpressions.RegexOptions.RightToLeft)) + Dim newLineIndexBeforePrefix As Integer = -1 + If regex3.IsMatch(itemToAdd, prefixTextIndex) Then + newLineIndexBeforePrefix = regex3.Match(itemToAdd, prefixTextIndex).Index + End If + If (newLineIndexBeforePrefix > -1) Then + If itemToAdd.StartsWith("...") Then + itemToAdd = ("..." + itemToAdd.Substring((newLineIndexBeforePrefix + regex3.Match(itemToAdd, prefixTextIndex).Length))) + Else + itemToAdd = itemToAdd.Substring((newLineIndexBeforePrefix + regex3.Match(itemToAdd, prefixTextIndex).Length)) + End If + End If + + If Not itemToAdd is nothing AndAlso Not resultList.Contains(itemToAdd) Then + + resultList.Add(itemToAdd) + + isAdded = true + End If + End If + Return isAdded + End Function + + + Protected Overridable Sub GetPageSize() + + If Me.View_PersonsPagination.PageSize.Text.Trim <> "" Then + Try + 'Me.PageSize = Integer.Parse(Me.View_PersonsPagination.PageSize.Text) + Catch ex As Exception + End Try + End If + End Sub + + Protected Overridable Sub AddNewRecords() + + Dim newRecordList As ArrayList = New ArrayList() + + Dim newUIDataList As System.Collections.Generic.List(Of Hashtable) = New System.Collections.Generic.List(Of Hashtable)() + + ' Loop though all the record controls and if the record control + ' does not have a unique record id set, then create a record + ' and add to the list. + If Not Me.ResetData Then + Dim rep As System.Web.UI.WebControls.Repeater = CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "View_PersonsTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return + + Dim repItem As System.Web.UI.WebControls.RepeaterItem + For Each repItem In rep.Items + ' Loop through all rows in the table, set its DataSource and call DataBind(). + + Dim recControl As View_PersonsTableControlRow = DirectCast(repItem.FindControl("View_PersonsTableControlRow"), View_PersonsTableControlRow) + + If recControl.Visible AndAlso recControl.IsNewRecord() Then + + Dim rec As View_PersonsRecord = New View_PersonsRecord() + + If recControl.ArmSName.Text <> "" Then + rec.Parse(recControl.ArmSName.Text, View_PersonsView.ArmSName) + End If + If recControl.Born.Text <> "" Then + rec.Parse(recControl.Born.Text, View_PersonsView.Born) + End If + If recControl.BProvince.Text <> "" Then + rec.Parse(recControl.BProvince.Text, View_PersonsView.BProvince) + End If + If recControl.CEdu.Text <> "" Then + rec.Parse(recControl.CEdu.Text, View_PersonsView.CEdu) + End If + If recControl.Commission.Text <> "" Then + rec.Parse(recControl.Commission.Text, View_PersonsView.Commission) + End If + If recControl.DeptAbbvr.Text <> "" Then + rec.Parse(recControl.DeptAbbvr.Text, View_PersonsView.DeptAbbvr) + End If + If recControl.MobilePhone.Text <> "" Then + rec.Parse(recControl.MobilePhone.Text, View_PersonsView.MobilePhone) + End If + If recControl.RankAndName.Text <> "" Then + rec.Parse(recControl.RankAndName.Text, View_PersonsView.RankAndName) + End If + If recControl.RankDate.Text <> "" Then + rec.Parse(recControl.RankDate.Text, View_PersonsView.RankDate) + End If + If recControl.RankDate1.Text <> "" Then + rec.Parse(recControl.RankDate1.Text, View_PersonsView.RankDate) + End If + If recControl.Retire.Text <> "" Then + rec.Parse(recControl.Retire.Text, View_PersonsView.Retire) + End If + If recControl.SAmout.Text <> "" Then + rec.Parse(recControl.SAmout.Text, View_PersonsView.SAmout) + End If + If recControl.SectionAbbvrName.Text <> "" Then + rec.Parse(recControl.SectionAbbvrName.Text, View_PersonsView.SectionAbbvrName) + End If + If recControl.Title.Text <> "" Then + rec.Parse(recControl.Title.Text, View_PersonsView.Title) + End If + newUIDataList.Add(recControl.PreservedUIData()) + newRecordList.Add(rec) + End If + Next + End If + + + ' Add any new record to the list. + Dim index As Integer = 0 + For index = 1 To Me.AddNewRecord + + newRecordList.Insert(0, New View_PersonsRecord()) + newUIDataList.Insert(0, New Hashtable()) + + Next + Me.AddNewRecord = 0 + + ' Finally, add any new records to the DataSource. + If newRecordList.Count > 0 Then + + Dim finalList As ArrayList = New ArrayList(Me.DataSource) + finalList.InsertRange(0, newRecordList) + + Me.DataSource = DirectCast(finalList.ToArray(GetType(View_PersonsRecord)), View_PersonsRecord()) + + End If + + ' Add the existing UI data to this hash table + If newUIDataList.Count > 0 Then + Me.UIData.InsertRange(0, newUIDataList) + End If + + End Sub + + + Public Sub AddToDeletedRecordIds(ByVal rec As View_PersonsTableControlRow) + If rec.IsNewRecord() Then + Return + End If + + If Not Me.DeletedRecordIds Is Nothing AndAlso Me.DeletedRecordIds.Trim <> "" Then + Me.DeletedRecordIds &= "," + End If + + Me.DeletedRecordIds &= "[" & rec.RecordUniqueId & "]" + End Sub + + Protected Overridable Function InDeletedRecordIds(ByVal rec As View_PersonsTableControlRow) As Boolean + If Me.DeletedRecordIds Is Nothing OrElse Me.DeletedRecordIds.Trim = "" Then + Return False + End If + + Return Me.DeletedRecordIds.IndexOf("[" & rec.RecordUniqueId & "]") >= 0 + End Function + + Private _DeletedRecordIds As String + Public Property DeletedRecordIds() As String + Get + Return Me._DeletedRecordIds + End Get + Set(ByVal value As String) + Me._DeletedRecordIds = value + End Set + End Property + + + ' Create Set, WhereClause, and Populate Methods + + Public Overridable Sub SetArmSNameLabel() + + End Sub + + Public Overridable Sub SetArmyIdLabel2() + + End Sub + + Public Overridable Sub SetBornLabel() + + End Sub + + Public Overridable Sub SetBProvinceLabel() + + End Sub + + Public Overridable Sub SetCEduLabel() + + End Sub + + Public Overridable Sub SetCommissionLabel() + + End Sub + + Public Overridable Sub SetDeptIdLabel() + + 'Code for the text property is generated inside the .aspx file. + 'To override this property you can uncomment the following property and add your own value. + 'Me.DeptIdLabel.Text = "Some value" + + End Sub + + Public Overridable Sub SetMobilePhoneLabel() + + End Sub + + Public Overridable Sub SetPersonalNameLabel() + + End Sub + + Public Overridable Sub SetpictureLabel() + + End Sub + + Public Overridable Sub SetRankDateLabel() + + End Sub + + Public Overridable Sub SetRankDateLabel1() + + 'Code for the text property is generated inside the .aspx file. + 'To override this property you can uncomment the following property and add your own value. + 'Me.RankDateLabel1.Text = "Some value" + + End Sub + + Public Overridable Sub SetRankLevelLabel() + + End Sub + + Public Overridable Sub SetRetireLabel() + + End Sub + + Public Overridable Sub SetRetireLabel1() + + End Sub + + Public Overridable Sub SetSAmoutLabel() + + End Sub + + Public Overridable Sub SetSectionAbbvrNameLabel() + + End Sub + + Public Overridable Sub SetSectionIdLabel() + + End Sub + + Public Overridable Sub SetTitleLabel() + + End Sub + + Public Overridable Sub SetView_PersonsTableControlCollapsibleRegion() + + End Sub + + Public Overridable Sub SetView_PersonsTableControlIcon() + + End Sub + + Public Overridable Sub SetView_PersonsTableControlPanelExtender() + + End Sub + + Public Overridable Sub SetArmyIdFromFilter1() + + Me.PopulateArmyIdFromFilter1(GetSelectedValue(Me.ArmyIdFromFilter1, GetFromSession(Me.ArmyIdFromFilter1)), 500) + + End Sub + + Public Overridable Sub SetDeptIdFilter() + + Me.PopulateDeptIdFilter(GetSelectedValue(Me.DeptIdFilter, GetFromSession(Me.DeptIdFilter)), 500) + + End Sub + + Public Overridable Sub SetRankLevelFilter() + + Me.PopulateRankLevelFilter(GetSelectedValue(Me.RankLevelFilter, GetFromSession(Me.RankLevelFilter)), 500) + + End Sub + + Public Overridable Sub SetRetireFilter() + + Me.PopulateRetireFilter(GetSelectedValue(Me.RetireFilter, GetFromSession(Me.RetireFilter)), 500) + + End Sub + + Public Overridable Sub SetSectionIdFromFilter() + + Me.PopulateSectionIdFromFilter(GetSelectedValue(Me.SectionIdFromFilter, GetFromSession(Me.SectionIdFromFilter)), 500) + + End Sub + + Public Overridable Sub SetView_PersonsSearch1() + + End Sub + + ' Get the filters' data for ArmyIdFromFilter1 + Protected Overridable Sub PopulateArmyIdFromFilter1(ByVal selectedValue As String, ByVal maxItems As Integer) + + + Me.ArmyIdFromFilter1.Items.Clear() + + + + ' Set up the WHERE and the ORDER BY clause by calling the CreateWhereClause_ArmyIdFromFilter1 function. + ' It is better to customize the where clause there. + + + + 'Setup the WHERE clause. + Dim wc As WhereClause = Me.CreateWhereClause_ArmyIdFromFilter1() + + ' Setup the static list items + + ' Add the All item. + Me.ArmyIdFromFilter1.Items.Insert(0, new ListItem(Me.Page.GetResourceValue("Txt:All", "Persons"), "--ANY--")) + + + Dim orderBy As OrderBy = New OrderBy(false, false) + orderBy.Add(ArmyTable.Army, OrderByItem.OrderDir.Asc) + + Dim variables As System.Collections.Generic.IDictionary(Of String, Object) = New System.Collections.Generic.Dictionary(Of String, Object) + + + + Dim noValueFormat As String = Page.GetResourceValue("Txt:Other", "Persons") + + + Dim itemValues() As ArmyRecord = Nothing + + If wc.RunQuery + Dim counter As Integer = 0 + Dim pageNum As Integer = 0 + Dim evaluator As New FormulaEvaluator + Dim listDuplicates As New ArrayList() + + + + Do + + itemValues = ArmyTable.GetRecords(wc, orderBy, pageNum, maxItems) + + For each itemValue As ArmyRecord In itemValues + ' Create the item and add to the list. + Dim cvalue As String = Nothing + Dim fvalue As String = Nothing + If itemValue.ArmyIdSpecified Then + cvalue = itemValue.ArmyId.ToString() + + If counter < maxItems AndAlso Me.ArmyIdFromFilter1.Items.FindByValue(cvalue) Is Nothing Then + + Dim _isExpandableNonCompositeForeignKey As Boolean = View_PersonsView.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(View_PersonsView.ArmyId) + If _isExpandableNonCompositeForeignKey AndAlso View_PersonsView.ArmyId.IsApplyDisplayAs Then + fvalue = View_PersonsView.GetDFKA(itemValue, View_PersonsView.ArmyId) + End If + If (Not _isExpandableNonCompositeForeignKey) Or (String.IsNullOrEmpty(fvalue)) Then + fvalue = itemValue.Format(ArmyTable.Army) + 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.ArmyIdFromFilter1.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.ArmyIdFromFilter1.Items.Add(newItem) + + If listDuplicates.Contains(fvalue) Then + newItem.Text = fvalue & " (ID " & cvalue.Substring(0, Math.Min(cvalue.Length,38)) & ")" + End If + + counter += 1 + End If + End If + Next + pageNum += 1 + Loop While (itemValues.Length = maxItems AndAlso counter < maxItems) + End If + + + + + + + ' Set the selected value. + SetSelectedValue(Me.ArmyIdFromFilter1, selectedValue) + + + End Sub + + ' Get the filters' data for DeptIdFilter + Protected Overridable Sub PopulateDeptIdFilter(ByVal selectedValue As String, ByVal maxItems As Integer) + + + Me.DeptIdFilter.Items.Clear() + + + + ' Set up the WHERE and the ORDER BY clause by calling the CreateWhereClause_DeptIdFilter function. + ' It is better to customize the where clause there. + + ' Setup the WHERE clause, including the base table if needed. + + Dim wc As WhereClause = Me.CreateWhereClause_DeptIdFilter() + + ' Setup the static list items + + ' Add the All item. + Me.DeptIdFilter.Items.Insert(0, new ListItem(Me.Page.GetResourceValue("Txt:All", "Persons"), "--ANY--")) + + + + Dim orderBy As OrderBy = New OrderBy(False, False) + orderBy.Add(View_PersonsView.DeptId, OrderByItem.OrderDir.Asc) + + + Dim values() As String = View_PersonsView.GetValues(View_PersonsView.DeptId, wc, orderBy, maxItems) + + Dim cvalue As String + + Dim listDuplicates As New ArrayList() + For Each cvalue In values + ' Create the item and add to the list. + Dim fvalue As String + + If ( View_PersonsView.DeptId.IsColumnValueTypeBoolean()) Then + fvalue = cvalue + Else + fvalue = View_PersonsView.DeptId.Format(cvalue) + End If + + 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.DeptIdFilter.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.DeptIdFilter.Items.Add(newItem) + + If listDuplicates.Contains(fvalue) Then + newItem.Text = fvalue & " (ID " & cvalue.Substring(0, Math.Min(cvalue.Length,38)) & ")" + End If + + Next + + + + ' Set the selected value. + SetSelectedValue(Me.DeptIdFilter, selectedValue) + + + End Sub + + ' Get the filters' data for RankLevelFilter + Protected Overridable Sub PopulateRankLevelFilter(ByVal selectedValue As String, ByVal maxItems As Integer) + + + Me.RankLevelFilter.Items.Clear() + + + + ' Set up the WHERE and the ORDER BY clause by calling the CreateWhereClause_RankLevelFilter function. + ' It is better to customize the where clause there. + + + + 'Setup the WHERE clause. + Dim wc As WhereClause = Me.CreateWhereClause_RankLevelFilter() + + ' Setup the static list items + + ' Add the All item. + Me.RankLevelFilter.Items.Insert(0, new ListItem(Me.Page.GetResourceValue("Txt:All", "Persons"), "--ANY--")) + + + Dim orderBy As OrderBy = New OrderBy(false, false) + orderBy.Add(RankTable.RankLevelName, OrderByItem.OrderDir.Asc) + + Dim variables As System.Collections.Generic.IDictionary(Of String, Object) = New System.Collections.Generic.Dictionary(Of String, Object) + + + + Dim noValueFormat As String = Page.GetResourceValue("Txt:Other", "Persons") + + + Dim itemValues() As RankRecord = Nothing + + If wc.RunQuery + Dim counter As Integer = 0 + Dim pageNum As Integer = 0 + Dim evaluator As New FormulaEvaluator + Dim listDuplicates As New ArrayList() + + + + Do + + itemValues = RankTable.GetRecords(wc, orderBy, pageNum, maxItems) + + For each itemValue As RankRecord In itemValues + ' Create the item and add to the list. + Dim cvalue As String = Nothing + Dim fvalue As String = Nothing + If itemValue.RankLevelSpecified Then + cvalue = itemValue.RankLevel.ToString() + + If counter < maxItems AndAlso Me.RankLevelFilter.Items.FindByValue(cvalue) Is Nothing Then + + Dim _isExpandableNonCompositeForeignKey As Boolean = View_PersonsView.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(View_PersonsView.RankLevel) + If _isExpandableNonCompositeForeignKey AndAlso View_PersonsView.RankLevel.IsApplyDisplayAs Then + fvalue = View_PersonsView.GetDFKA(itemValue, View_PersonsView.RankLevel) + End If + If (Not _isExpandableNonCompositeForeignKey) Or (String.IsNullOrEmpty(fvalue)) Then + fvalue = itemValue.Format(RankTable.RankLevelName) + 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.RankLevelFilter.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.RankLevelFilter.Items.Add(newItem) + + If listDuplicates.Contains(fvalue) Then + newItem.Text = fvalue & " (ID " & cvalue.Substring(0, Math.Min(cvalue.Length,38)) & ")" + End If + + counter += 1 + End If + End If + Next + pageNum += 1 + Loop While (itemValues.Length = maxItems AndAlso counter < maxItems) + End If + + + + + + + ' Set the selected value. + SetSelectedValue(Me.RankLevelFilter, selectedValue) + + + End Sub + + ' Get the filters' data for RetireFilter + Protected Overridable Sub PopulateRetireFilter(ByVal selectedValue As String, ByVal maxItems As Integer) + + + Me.RetireFilter.Items.Clear() + + + + ' Set up the WHERE and the ORDER BY clause by calling the CreateWhereClause_RetireFilter function. + ' It is better to customize the where clause there. + + ' Setup the WHERE clause, including the base table if needed. + + Dim wc As WhereClause = Me.CreateWhereClause_RetireFilter() + + ' Setup the static list items + + ' Add the All item. + Me.RetireFilter.Items.Insert(0, new ListItem(Me.Page.GetResourceValue("Txt:All", "Persons"), "--ANY--")) + + + + Dim orderBy As OrderBy = New OrderBy(False, False) + orderBy.Add(View_PersonsView.Retire, OrderByItem.OrderDir.Asc) + + + Dim values() As String = View_PersonsView.GetValues(View_PersonsView.Retire, wc, orderBy, maxItems) + + Dim cvalue As String + + Dim listDuplicates As New ArrayList() + For Each cvalue In values + ' Create the item and add to the list. + Dim fvalue As String + + If ( View_PersonsView.Retire.IsColumnValueTypeBoolean()) Then + fvalue = cvalue + Else + fvalue = View_PersonsView.Retire.Format(cvalue) + End If + + 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.RetireFilter.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.RetireFilter.Items.Add(newItem) + + If listDuplicates.Contains(fvalue) Then + newItem.Text = fvalue & " (ID " & cvalue.Substring(0, Math.Min(cvalue.Length,38)) & ")" + End If + + Next + + + + ' Set the selected value. + SetSelectedValue(Me.RetireFilter, selectedValue) + + + End Sub + + ' Get the filters' data for SectionIdFromFilter + Protected Overridable Sub PopulateSectionIdFromFilter(ByVal selectedValue As String, ByVal maxItems As Integer) + + + Me.SectionIdFromFilter.Items.Clear() + + + + ' Set up the WHERE and the ORDER BY clause by calling the CreateWhereClause_SectionIdFromFilter function. + ' It is better to customize the where clause there. + + + + 'Setup the WHERE clause. + Dim wc As WhereClause = Me.CreateWhereClause_SectionIdFromFilter() + + ' Setup the static list items + + ' Add the All item. + Me.SectionIdFromFilter.Items.Insert(0, new ListItem(Me.Page.GetResourceValue("Txt:All", "Persons"), "--ANY--")) + + + Dim orderBy As OrderBy = New OrderBy(false, false) + orderBy.Add(SectionTable.SectionAbbvrName, OrderByItem.OrderDir.Asc) + + Dim variables As System.Collections.Generic.IDictionary(Of String, Object) = New System.Collections.Generic.Dictionary(Of String, Object) + + + + Dim noValueFormat As String = Page.GetResourceValue("Txt:Other", "Persons") + + + Dim itemValues() As SectionRecord = Nothing + + If wc.RunQuery + Dim counter As Integer = 0 + Dim pageNum As Integer = 0 + Dim evaluator As New FormulaEvaluator + Dim listDuplicates As New ArrayList() + + + + Do + + itemValues = SectionTable.GetRecords(wc, orderBy, pageNum, maxItems) + + For each itemValue As SectionRecord In itemValues + ' Create the item and add to the list. + Dim cvalue As String = Nothing + Dim fvalue As String = Nothing + If itemValue.SectionIdSpecified Then + cvalue = itemValue.SectionId.ToString() + + If counter < maxItems AndAlso Me.SectionIdFromFilter.Items.FindByValue(cvalue) Is Nothing Then + + Dim _isExpandableNonCompositeForeignKey As Boolean = View_PersonsView.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(View_PersonsView.SectionId) + If _isExpandableNonCompositeForeignKey AndAlso View_PersonsView.SectionId.IsApplyDisplayAs Then + fvalue = View_PersonsView.GetDFKA(itemValue, View_PersonsView.SectionId) + End If + If (Not _isExpandableNonCompositeForeignKey) Or (String.IsNullOrEmpty(fvalue)) Then + fvalue = itemValue.Format(SectionTable.SectionAbbvrName) + 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.SectionIdFromFilter.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.SectionIdFromFilter.Items.Add(newItem) + + If listDuplicates.Contains(fvalue) Then + newItem.Text = fvalue & " (ID " & cvalue.Substring(0, Math.Min(cvalue.Length,38)) & ")" + End If + + counter += 1 + End If + End If + Next + pageNum += 1 + Loop While (itemValues.Length = maxItems AndAlso counter < maxItems) + End If + + + + + + + ' Set the selected value. + SetSelectedValue(Me.SectionIdFromFilter, selectedValue) + + + End Sub + + Public Overridable Function CreateWhereClause_ArmyIdFromFilter1() As WhereClause + + ' Create a where clause for the filter ArmyIdFromFilter1. + ' This function is called by the Populate method to load the items + ' in the ArmyIdFromFilter1DropDownList + + Dim wc As WhereClause= New WhereClause() + Return wc + + End Function + + Public Overridable Function CreateWhereClause_DeptIdFilter() As WhereClause + + ' Create a where clause for the filter DeptIdFilter. + ' This function is called by the Populate method to load the items + ' in the DeptIdFilterDropDownList + + Dim wc As WhereClause= New WhereClause() + Return wc + + End Function + + Public Overridable Function CreateWhereClause_RankLevelFilter() As WhereClause + + ' Create a where clause for the filter RankLevelFilter. + ' This function is called by the Populate method to load the items + ' in the RankLevelFilterDropDownList + + Dim wc As WhereClause= New WhereClause() + Return wc + + End Function + + Public Overridable Function CreateWhereClause_RetireFilter() As WhereClause + + ' Create a where clause for the filter RetireFilter. + ' This function is called by the Populate method to load the items + ' in the RetireFilterDropDownList + + Dim wc As WhereClause= New WhereClause() + Return wc + + End Function + + Public Overridable Function CreateWhereClause_SectionIdFromFilter() As WhereClause + + ' Create a where clause for the filter SectionIdFromFilter. + ' This function is called by the Populate method to load the items + ' in the SectionIdFromFilterDropDownList + + Dim wc As WhereClause= New WhereClause() + Return wc + + End Function + + Protected Overridable Function GetSAmoutGrandTotal() As String + + Dim wc As WhereClause = Me.CreateWhereClause() + Dim joinFilter As CompoundFilter = Me.CreateCompoundJoinFilter() + + Dim orderBy As OrderBy = New OrderBy(True, False) + Dim SAmoutSum As String = View_PersonsView.GetSum(View_PersonsView.SAmout, joinFilter, wc, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) + + Return View_PersonsView.SAmout.Format(SAmoutSum) + + End Function + + + + + Protected Overridable Sub Control_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.PreRender + ' PreRender event is raised just before page is being displayed. + Try + DbUtils.StartTransaction + Me.RegisterPostback() + + If Not Me.Page.ErrorOnPage AndAlso (Me.Page.IsPageRefresh OrElse Me.DataChanged OrElse Me.ResetData) Then + + + ' Re-load the data and update the web page if necessary. + ' This is typically done during a postback (filter, search button, sort, pagination button). + ' In each of the other click handlers, simply set DataChanged to True to reload the data. + + Me.LoadData() + Me.DataBind() + + End If + + + + Catch ex As Exception + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + Finally + DbUtils.EndTransaction + End Try + End Sub + + + Protected Overrides Sub SaveControlsToSession() + MyBase.SaveControlsToSession() + + ' Save filter controls to values to session. + + Me.SaveToSession(Me.ArmyIdFromFilter1, Me.ArmyIdFromFilter1.SelectedValue) + + Me.SaveToSession(Me.DeptIdFilter, Me.DeptIdFilter.SelectedValue) + + Me.SaveToSession(Me.RankLevelFilter, Me.RankLevelFilter.SelectedValue) + + Me.SaveToSession(Me.RetireFilter, Me.RetireFilter.SelectedValue) + + Me.SaveToSession(Me.SectionIdFromFilter, Me.SectionIdFromFilter.SelectedValue) + + Me.SaveToSession(Me.View_PersonsSearch1, Me.View_PersonsSearch1.Text) + + + 'Save pagination state to session. + + + + ' Save table control properties to the session. + If Not Me.CurrentSortOrder Is Nothing Then + Me.SaveToSession(Me, "Order_By", Me.CurrentSortOrder.ToXmlString()) + End If + + Me.SaveToSession(Me, "Page_Index", Me.PageIndex.ToString()) + Me.SaveToSession(Me, "Page_Size", Me.PageSize.ToString()) + + Me.SaveToSession(Me, "DeletedRecordIds", Me.DeletedRecordIds) + + End Sub + + Protected Sub SaveControlsToSession_Ajax() + ' Save filter controls to values to session. + + Me.SaveToSession("ArmyIdFromFilter1_Ajax", Me.ArmyIdFromFilter1.SelectedValue) + + Me.SaveToSession("DeptIdFilter_Ajax", Me.DeptIdFilter.SelectedValue) + + Me.SaveToSession("RankLevelFilter_Ajax", Me.RankLevelFilter.SelectedValue) + + Me.SaveToSession("RetireFilter_Ajax", Me.RetireFilter.SelectedValue) + + Me.SaveToSession("SectionIdFromFilter_Ajax", Me.SectionIdFromFilter.SelectedValue) + + Me.SaveToSession("View_PersonsSearch1_Ajax", Me.View_PersonsSearch1.Text) + + HttpContext.Current.Session("AppRelativeVirtualPath") = Me.Page.AppRelativeVirtualPath + + End Sub + + Protected Overrides Sub ClearControlsFromSession() + MyBase.ClearControlsFromSession() + + ' Clear filter controls values from the session. + + Me.RemoveFromSession(Me.ArmyIdFromFilter1) + Me.RemoveFromSession(Me.DeptIdFilter) + Me.RemoveFromSession(Me.RankLevelFilter) + Me.RemoveFromSession(Me.RetireFilter) + Me.RemoveFromSession(Me.SectionIdFromFilter) + Me.RemoveFromSession(Me.View_PersonsSearch1) + + ' Clear pagination state from session. + + + + ' Clear table properties from the session. + Me.RemoveFromSession(Me, "Order_By") + Me.RemoveFromSession(Me, "Page_Index") + Me.RemoveFromSession(Me, "Page_Size") + + Me.RemoveFromSession(Me, "DeletedRecordIds") + + End Sub + + Protected Overrides Sub LoadViewState(ByVal savedState As Object) + MyBase.LoadViewState(savedState) + + Dim orderByStr As String = CType(ViewState("View_PersonsTableControl_OrderBy"), String) + + If orderByStr IsNot Nothing AndAlso orderByStr.Trim <> "" Then + Me.CurrentSortOrder = BaseClasses.Data.OrderBy.FromXmlString(orderByStr) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + End If + + Dim pageIndex As String = CType(ViewState("Page_Index"), String) + If pageIndex IsNot Nothing Then + Me.PageIndex = CInt(pageIndex) + End If + + Dim pageSize As String = CType(ViewState("Page_Size"), String) + If Not pageSize Is Nothing Then + Me.PageSize = CInt(pageSize) + End If + + + + ' Load view state for pagination control. + + Me.DeletedRecordIds = CType(Me.ViewState("DeletedRecordIds"), String) + + End Sub + + Protected Overrides Function SaveViewState() As Object + + If Me.CurrentSortOrder IsNot Nothing Then + Me.ViewState("View_PersonsTableControl_OrderBy") = Me.CurrentSortOrder.ToXmlString() + End If + + Me.ViewState("Page_Index") = Me.PageIndex + Me.ViewState("Page_Size") = Me.PageSize + + Me.ViewState("DeletedRecordIds") = Me.DeletedRecordIds + + + ' Load view state for pagination control. + + + Return MyBase.SaveViewState() + End Function + + ' Generate the event handling functions for pagination events. + + ' event handler for ImageButton + Public Overridable Sub View_PersonsPagination_FirstPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.PageIndex = 0 + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub View_PersonsPagination_LastPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.DisplayLastPage = True + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub View_PersonsPagination_NextPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.PageIndex += 1 + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for LinkButton + Public Overridable Sub View_PersonsPagination_PageSizeButton_Click(ByVal sender As Object, ByVal args As EventArgs) + + Try + + Me.DataChanged = True + + Me.PageSize = Integer.Parse(Me.View_PersonsPagination.PageSize.Text) + + Me.PageIndex = Integer.Parse(Me.View_PersonsPagination.CurrentPage.Text) - 1 + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub View_PersonsPagination_PreviousPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + If Me.PageIndex > 0 Then + Me.PageIndex -= 1 + Me.DataChanged = True + End If + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + + ' Generate the event handling functions for sorting events. + + Public Overridable Sub ArmSNameLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by ArmSName when clicked. + + ' Get previous sorting state for ArmSName. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(View_PersonsView.ArmSName) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for ArmSName. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(View_PersonsView.ArmSName, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by ArmSName, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub BornLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by Born when clicked. + + ' Get previous sorting state for Born. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(View_PersonsView.Born) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for Born. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(View_PersonsView.Born, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by Born, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub BProvinceLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by BProvince when clicked. + + ' Get previous sorting state for BProvince. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(View_PersonsView.BProvince) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for BProvince. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(View_PersonsView.BProvince, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by BProvince, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub CEduLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by CEdu when clicked. + + ' Get previous sorting state for CEdu. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(View_PersonsView.CEdu) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for CEdu. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(View_PersonsView.CEdu, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by CEdu, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub MobilePhoneLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by MobilePhone when clicked. + + ' Get previous sorting state for MobilePhone. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(View_PersonsView.MobilePhone) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for MobilePhone. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(View_PersonsView.MobilePhone, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by MobilePhone, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub PersonalNameLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by PersonalName when clicked. + + ' Get previous sorting state for PersonalName. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(View_PersonsView.PersonalName) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for PersonalName. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(View_PersonsView.PersonalName, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by PersonalName, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub RankDateLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by RankDate when clicked. + + ' Get previous sorting state for RankDate. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(View_PersonsView.RankDate) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for RankDate. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(View_PersonsView.RankDate, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by RankDate, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub RankDateLabel1_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by RankDate when clicked. + + ' Get previous sorting state for RankDate. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(View_PersonsView.RankDate) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for RankDate. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(View_PersonsView.RankDate, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by RankDate, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub RetireLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by Retire when clicked. + + ' Get previous sorting state for Retire. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(View_PersonsView.Retire) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for Retire. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(View_PersonsView.Retire, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by Retire, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub SAmoutLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by SAmout when clicked. + + ' Get previous sorting state for SAmout. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(View_PersonsView.SAmout) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for SAmout. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(View_PersonsView.SAmout, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by SAmout, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub SectionAbbvrNameLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by SectionAbbvrName when clicked. + + ' Get previous sorting state for SectionAbbvrName. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(View_PersonsView.SectionAbbvrName) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for SectionAbbvrName. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(View_PersonsView.SectionAbbvrName, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by SectionAbbvrName, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub TitleLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by Title when clicked. + + ' Get previous sorting state for Title. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(View_PersonsView.Title) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for Title. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(View_PersonsView.Title, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by Title, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + + ' Generate the event handling functions for button events. + + ' event handler for ImageButton + Public Overridable Sub View_PersonsExportCSVButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + ' Build the where clause based on the current filter and search criteria + ' Create the Order By clause based on the user's current sorting preference. + + Dim wc As WhereClause = CreateWhereClause + Dim orderBy As OrderBy = Nothing + + orderBy = CreateOrderBy + + ' Add each of the columns in order of export. + Dim columns() as BaseColumn = New BaseColumn() { _ + View_PersonsView.ArmSName, _ + View_PersonsView.SectionAbbvrName, _ + View_PersonsView.DeptAbbvr, _ + View_PersonsView.Retire, _ + View_PersonsView.Commission, _ + View_PersonsView.Born, _ + View_PersonsView.BProvince, _ + View_PersonsView.SAmout, _ + View_PersonsView.CEdu, _ + View_PersonsView.MobilePhone, _ + View_PersonsView.RankDate, _ + View_PersonsView.Title, _ + View_PersonsView.RankAndName, _ + Nothing} + Dim exportData as ExportDataToCSV = New ExportDataToCSV(View_PersonsView.Instance, wc, orderBy, columns) + + Dim done As Boolean = False + + Dim totalRowsReturned As Integer = 0 + Dim join As CompoundFilter = CreateCompoundJoinFilter() + Dim data As DataForExport = New DataForExport(View_PersonsView.Instance, wc, orderBy, columns, join) + + 'Check for Export Data Threshold + Dim exportRawValues As Boolean = False + Me.TotalRecords = View_PersonsView.GetRecordCount(join, wc) + If Me.TotalRecords > 10000 Then + exportRawValues = True + End If + exportData.StartExport(Me.Page.Response, exportRawValues) + + ' Read pageSize records at a time and write out the CSV file. + While (Not done) + Dim recList As ArrayList = data.GetRows(exportData.pageSize) + If recList Is Nothing Then + Exit While 'no more records we are done + End If + + totalRowsReturned = recList.Count + For Each rec As BaseRecord In recList + For Each col As BaseColumn In data.ColumnList + If col Is Nothing Then + Continue For + End If + + If Not data.IncludeInExport(col) Then + Continue For + End If + + Dim val As String = "" + + If exportRawValues Then + val = rec.GetValue(col).ToString() + Else + Dim _isExpandableNonCompositeForeignKey As Boolean = col.TableDefinition.IsExpandableNonCompositeForeignKey(col) + If _isExpandableNonCompositeForeignKey AndAlso col.IsApplyDisplayAs Then + val = View_PersonsView.GetDFKA(rec.GetValue(col).ToString(), col, Nothing) + End If + If (Not _isExpandableNonCompositeForeignKey) Or (String.IsNullOrEmpty(val)) Then + val = exportData.GetDataForExport(col, rec) + End If + End If + exportData.WriteColumnData(val, data.IsString(col)) + + Next col + exportData.WriteNewRow() + Next rec + + ' If we already are below the pageSize, then we are done. + If totalRowsReturned < exportData.pageSize Then + done = True + End If + End While + exportData.FinishExport(Me.Page.Response) + + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub View_PersonsExportExcelButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + ' To customize the columns or the format, override this function in Section 1 of the page + ' and modify it to your liking. + ' Build the where clause based on the current filter and search criteria + ' Create the Order By clause based on the user's current sorting preference. + + Dim wc As WhereClause = CreateWhereClause + Dim orderBy As OrderBy = Nothing + + orderBy = CreateOrderBy + + Dim done As Boolean = False + Dim val As Object = "" + ' Read pageSize records at a time and write out the Excel file. + Dim totalRowsReturned As Integer = 0 + + Me.TotalRecords = View_PersonsView.GetRecordCount(wc) + If Me.TotalRecords > 10000 Then + + ' Add each of the columns in order of export. + Dim columns() as BaseColumn = New BaseColumn() { _ + View_PersonsView.ArmSName, _ + View_PersonsView.SectionAbbvrName, _ + View_PersonsView.DeptAbbvr, _ + View_PersonsView.Retire, _ + View_PersonsView.Commission, _ + View_PersonsView.Born, _ + View_PersonsView.BProvince, _ + View_PersonsView.SAmout, _ + View_PersonsView.CEdu, _ + View_PersonsView.MobilePhone, _ + View_PersonsView.RankDate, _ + View_PersonsView.Title, _ + View_PersonsView.RankAndName, _ + Nothing} + Dim exportData as ExportDataToCSV = New ExportDataToCSV(View_PersonsView.Instance, wc, orderBy, columns) + exportData.StartExport(Me.Page.Response, True) + + Dim dataForCSV As DataForExport = New DataForExport(View_PersonsView.Instance, wc, orderBy, columns) + + ' Read pageSize records at a time and write out the CSV file. + While (Not done) + Dim recList As ArrayList = dataForCSV.GetRows(exportData.pageSize) + If recList Is Nothing Then + Exit While 'no more records we are done + End If + + totalRowsReturned = recList.Count + For Each rec As BaseRecord In recList + For Each col As BaseColumn In dataForCSV.ColumnList + If col Is Nothing Then + Continue For + End If + + If Not dataForCSV.IncludeInExport(col) Then + Continue For + End If + + val = rec.GetValue(col).ToString() + exportData.WriteColumnData(val, dataForCSV.IsString(col)) + + Next col + exportData.WriteNewRow() + Next rec + + ' If we already are below the pageSize, then we are done. + If totalRowsReturned < exportData.pageSize Then + done = True + End If + End While + exportData.FinishExport(Me.Page.Response) + Else + + ' Create an instance of the Excel report class with the table class, where clause and order by. + Dim excelReport As ExportDataToExcel = New ExportDataToExcel(View_PersonsView.Instance, wc, orderBy) + ' Add each of the columns in order of export. + ' To customize the data type, change the second parameter of the new ExcelColumn to be + ' a format string from Excel's Format Cell menu. For example "dddd, mmmm dd, yyyy h:mm AM/PM;@", "#,##0.00" + + If Me.Page.Response Is Nothing Then + Return + End If + + excelReport.CreateExcelBook() + + Dim width As Integer = 0 + Dim columnCounter As Integer = 0 + Dim data As DataForExport = New DataForExport(View_PersonsView.Instance, wc, orderBy, Nothing) + data.ColumnList.Add(New ExcelColumn(View_PersonsView.ArmSName, "Default")) + data.ColumnList.Add(New ExcelColumn(View_PersonsView.SectionAbbvrName, "Default")) + data.ColumnList.Add(New ExcelColumn(View_PersonsView.DeptAbbvr, "Default")) + data.ColumnList.Add(New ExcelColumn(View_PersonsView.Retire, "Default")) + data.ColumnList.Add(New ExcelColumn(View_PersonsView.Commission, "Default")) + data.ColumnList.Add(New ExcelColumn(View_PersonsView.Born, "Default")) + data.ColumnList.Add(New ExcelColumn(View_PersonsView.BProvince, "Default")) + data.ColumnList.Add(New ExcelColumn(View_PersonsView.SAmout, "#,###")) + data.ColumnList.Add(New ExcelColumn(View_PersonsView.CEdu, "Default")) + data.ColumnList.Add(New ExcelColumn(View_PersonsView.MobilePhone, "Default")) + data.ColumnList.Add(New ExcelColumn(View_PersonsView.RankDate, "Short Date")) + data.ColumnList.Add(New ExcelColumn(View_PersonsView.Title, "Default")) + data.ColumnList.Add(New ExcelColumn(View_PersonsView.RankAndName, "Default")) + + + For Each col As ExcelColumn In data.ColumnList + width = excelReport.GetExcelCellWidth(col) + If data.IncludeInExport(col) Then + excelReport.AddColumnToExcelBook(columnCounter, col.ToString(), excelReport.GetExcelDataType(col), width, excelReport.GetDisplayFormat(col)) + columnCounter = columnCounter + 1 + End If + Next col + + While (Not done) + Dim recList As ArrayList = data.GetRows(excelReport.pageSize) + + If recList Is Nothing Then + Exit While 'no more records we are done + End If + + totalRowsReturned = recList.Count + + For Each rec As BaseRecord In recList + excelReport.AddRowToExcelBook() + columnCounter = 0 + + For Each col As ExcelColumn In data.ColumnList + If Not data.IncludeInExport(col) Then + Continue For + End If + + Dim _isExpandableNonCompositeForeignKey As Boolean = col.DisplayColumn.TableDefinition.IsExpandableNonCompositeForeignKey(col.DisplayColumn) + If _isExpandableNonCompositeForeignKey AndAlso col.DisplayColumn.IsApplyDisplayAs Then + val = View_PersonsView.GetDFKA(rec.GetValue(col.DisplayColumn).ToString(), col.DisplayColumn, Nothing) + If val Is Nothing Then + val = rec.Format(col.DisplayColumn) + End If + Else + val = excelReport.GetValueForExcelExport(col, rec) + End If + excelReport.AddCellToExcelRow(columnCounter, excelReport.GetExcelDataType(col), val, col.DisplayFormat) + + columnCounter = columnCounter + 1 + Next col + Next rec + + ' If we already are below the pageSize, then we are done. + If totalRowsReturned < excelReport.pageSize Then + done = True + End If + End While + + excelReport.SaveExcelBook(Me.Page.Response) + End If + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub View_PersonsPDFButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + Dim report As PDFReport = New PDFReport() + report.SpecificReportFileName = Page.Server.MapPath("ShowViewPersons.View_PersonsPDFButton.report") + ' report.Title replaces the value tag of page header and footer containing ${ReportTitle} + report.Title = "View_Persons" + ' If ShowViewPersons.View_PersonsPDFButton.report specifies a valid report template, + ' AddColumn method will generate a report template. + ' Each AddColumn method-call specifies a column + ' The 1st parameter represents the text of the column header + ' The 2nd parameter represents the horizontal alignment of the column header + ' The 3rd parameter represents the text format of the column detail + ' The 4th parameter represents the horizontal alignment of the column detail + ' The 5th parameter represents the relative width of the column + report.AddColumn(View_PersonsView.ArmSName.Name, ReportEnum.Align.Left, "${ArmSName}", ReportEnum.Align.Left, 30) + report.AddColumn(View_PersonsView.SectionAbbvrName.Name, ReportEnum.Align.Left, "${SectionAbbvrName}", ReportEnum.Align.Left, 20) + report.AddColumn(View_PersonsView.DeptAbbvr.Name, ReportEnum.Align.Left, "${DeptAbbvr}", ReportEnum.Align.Left, 20) + report.AddColumn(View_PersonsView.Retire.Name, ReportEnum.Align.Left, "${Retire}", ReportEnum.Align.Left, 15) + report.AddColumn(View_PersonsView.Commission.Name, ReportEnum.Align.Left, "${Commission}", ReportEnum.Align.Left, 30) + report.AddColumn(View_PersonsView.Born.Name, ReportEnum.Align.Left, "${Born}", ReportEnum.Align.Left, 20) + report.AddColumn(View_PersonsView.BProvince.Name, ReportEnum.Align.Left, "${BProvince}", ReportEnum.Align.Left, 30) + report.AddColumn(View_PersonsView.SAmout.Name, ReportEnum.Align.Right, "${SAmout}", ReportEnum.Align.Right, 20) + report.AddColumn(View_PersonsView.CEdu.Name, ReportEnum.Align.Left, "${CEdu}", ReportEnum.Align.Left, 30) + report.AddColumn(View_PersonsView.MobilePhone.Name, ReportEnum.Align.Left, "${MobilePhone}", ReportEnum.Align.Left, 15) + report.AddColumn(View_PersonsView.RankDate.Name, ReportEnum.Align.Left, "${RankDate}", ReportEnum.Align.Left, 20) + report.AddColumn(View_PersonsView.Title.Name, ReportEnum.Align.Left, "${Title}", ReportEnum.Align.Left, 30) + report.AddColumn(View_PersonsView.RankAndName.Name, ReportEnum.Align.Left, "${RankAndName}", ReportEnum.Align.Left, 30) + + + Dim rowsPerQuery As Integer = 5000 + Dim recordCount As Integer = 0 + + report.Page = Page.GetResourceValue("Txt:Page", "Persons") + report.ApplicationPath = Me.Page.MapPath(Page.Request.ApplicationPath) + + Dim whereClause As WhereClause = CreateWhereClause + Dim orderBy As OrderBy = CreateOrderBy + Dim joinFilter As BaseFilter = CreateCompoundJoinFilter() + + Dim pageNum As Integer = 0 + Dim totalRows As Integer = View_PersonsView.GetRecordCount(joinFilter,whereClause) + Dim columns As ColumnList = View_PersonsView.GetColumnList() + Dim records As View_PersonsRecord() = Nothing + + Do + + records = View_PersonsView.GetRecords(joinFilter,whereClause, orderBy, pageNum, rowsPerQuery) + If Not (records Is Nothing) AndAlso records.Length > 0 AndAlso whereClause.RunQuery Then + For Each record As View_PersonsRecord In records + + ' AddData method takes four parameters + ' The 1st parameters represent the data format + ' The 2nd parameters represent the data value + ' The 3rd parameters represent the default alignment of column using the data + ' The 4th parameters represent the maximum length of the data value being shown + report.AddData("${ArmSName}", record.Format(View_PersonsView.ArmSName), ReportEnum.Align.Left, 100) + report.AddData("${SectionAbbvrName}", record.Format(View_PersonsView.SectionAbbvrName), ReportEnum.Align.Left, 100) + report.AddData("${DeptAbbvr}", record.Format(View_PersonsView.DeptAbbvr), ReportEnum.Align.Left, 100) + report.AddData("${Retire}", record.Format(View_PersonsView.Retire), ReportEnum.Align.Left, 100) + report.AddData("${Commission}", record.Format(View_PersonsView.Commission), ReportEnum.Align.Left, 30) + report.AddData("${Born}", record.Format(View_PersonsView.Born), ReportEnum.Align.Left, 100) + report.AddData("${BProvince}", record.Format(View_PersonsView.BProvince), ReportEnum.Align.Left, 100) + report.AddData("${SAmout}", record.Format(View_PersonsView.SAmout), ReportEnum.Align.Right, 100) + report.AddData("${CEdu}", record.Format(View_PersonsView.CEdu), ReportEnum.Align.Left, 100) + report.AddData("${MobilePhone}", record.Format(View_PersonsView.MobilePhone), ReportEnum.Align.Left, 100) + report.AddData("${RankDate}", record.Format(View_PersonsView.RankDate), ReportEnum.Align.Left, 100) + report.AddData("${Title}", record.Format(View_PersonsView.Title), ReportEnum.Align.Left, 100) + report.AddData("${RankAndName}", record.Format(View_PersonsView.RankAndName), ReportEnum.Align.Left, 100) + + report.WriteRow + Next + pageNum = pageNum + 1 + recordCount += records.Length + End If + Loop While Not (records Is Nothing) AndAlso recordCount < totalRows AndAlso whereClause.RunQuery + + report.Close + BaseClasses.Utils.NetUtils.WriteResponseBinaryAttachment(Me.Page.Response, report.Title + ".pdf", report.ReportInByteArray, 0, true) + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub View_PersonsRefreshButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Dim View_PersonsTableControlObj as View_PersonsTableControl = DirectCast(Me.Page.FindControlRecursively("View_PersonsTableControl"), View_PersonsTableControl) + View_PersonsTableControlObj.ResetData = True + + View_PersonsTableControlObj.RemoveFromSession(View_PersonsTableControlObj, "DeletedRecordIds") + View_PersonsTableControlObj.DeletedRecordIds = Nothing + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub View_PersonsResetButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.ArmyIdFromFilter1.ClearSelection() + Me.DeptIdFilter.ClearSelection() + Me.RankLevelFilter.ClearSelection() + Me.RetireFilter.ClearSelection() + Me.SectionIdFromFilter.ClearSelection() + Me.View_PersonsSearch1.Text = "" + Me.CurrentSortOrder.Reset() + If Me.InSession(Me, "Order_By") Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + Me.CurrentSortOrder.Add(View_PersonsView.RankId, OrderByItem.OrderDir.Asc) + + Me.CurrentSortOrder.Add(View_PersonsView.RankDate, OrderByItem.OrderDir.Asc) + + Me.CurrentSortOrder.Add(View_PersonsView.DatePrevRank, OrderByItem.OrderDir.Asc) + + + End If + + Me.SAmoutGrandTotal.Text = " " + + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub View_PersonsWordButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + Dim report As WordReport = New WordReport + report.SpecificReportFileName = Page.Server.MapPath("ShowViewPersons.View_PersonsWordButton.word") + ' report.Title replaces the value tag of page header and footer containing ${ReportTitle} + report.Title = "View_Persons" + ' If ShowViewPersons.View_PersonsWordButton.report specifies a valid report template, + ' AddColumn method will generate a report template. + ' Each AddColumn method-call specifies a column + ' The 1st parameter represents the text of the column header + ' The 2nd parameter represents the horizontal alignment of the column header + ' The 3rd parameter represents the text format of the column detail + ' The 4th parameter represents the horizontal alignment of the column detail + ' The 5th parameter represents the relative width of the column + report.AddColumn(View_PersonsView.ArmSName.Name, ReportEnum.Align.Left, "${ArmSName}", ReportEnum.Align.Left, 30) + report.AddColumn(View_PersonsView.SectionAbbvrName.Name, ReportEnum.Align.Left, "${SectionAbbvrName}", ReportEnum.Align.Left, 20) + report.AddColumn(View_PersonsView.DeptAbbvr.Name, ReportEnum.Align.Left, "${DeptAbbvr}", ReportEnum.Align.Left, 20) + report.AddColumn(View_PersonsView.Retire.Name, ReportEnum.Align.Left, "${Retire}", ReportEnum.Align.Left, 15) + report.AddColumn(View_PersonsView.Commission.Name, ReportEnum.Align.Left, "${Commission}", ReportEnum.Align.Left, 30) + report.AddColumn(View_PersonsView.Born.Name, ReportEnum.Align.Left, "${Born}", ReportEnum.Align.Left, 20) + report.AddColumn(View_PersonsView.BProvince.Name, ReportEnum.Align.Left, "${BProvince}", ReportEnum.Align.Left, 30) + report.AddColumn(View_PersonsView.SAmout.Name, ReportEnum.Align.Right, "${SAmout}", ReportEnum.Align.Right, 20) + report.AddColumn(View_PersonsView.CEdu.Name, ReportEnum.Align.Left, "${CEdu}", ReportEnum.Align.Left, 30) + report.AddColumn(View_PersonsView.MobilePhone.Name, ReportEnum.Align.Left, "${MobilePhone}", ReportEnum.Align.Left, 15) + report.AddColumn(View_PersonsView.RankDate.Name, ReportEnum.Align.Left, "${RankDate}", ReportEnum.Align.Left, 20) + report.AddColumn(View_PersonsView.Title.Name, ReportEnum.Align.Left, "${Title}", ReportEnum.Align.Left, 30) + report.AddColumn(View_PersonsView.RankAndName.Name, ReportEnum.Align.Left, "${RankAndName}", ReportEnum.Align.Left, 30) + + Dim whereClause As WhereClause = CreateWhereClause + + Dim orderBy As OrderBy = CreateOrderBy + Dim joinFilter As BaseFilter = CreateCompoundJoinFilter() + + Dim rowsPerQuery As Integer = 5000 + Dim pageNum As Integer = 0 + Dim recordCount As Integer = 0 + Dim totalRows As Integer = View_PersonsView.GetRecordCount(joinFilter,whereClause) + + report.Page = Page.GetResourceValue("Txt:Page", "Persons") + report.ApplicationPath = Me.Page.MapPath(Page.Request.ApplicationPath) + + Dim columns As ColumnList = View_PersonsView.GetColumnList() + Dim records As View_PersonsRecord() = Nothing + Do + records = View_PersonsView.GetRecords(joinFilter,whereClause, orderBy, pageNum, rowsPerQuery) + + If Not (records Is Nothing) AndAlso records.Length > 0 AndAlso whereClause.RunQuery Then + For Each record As View_PersonsRecord In records + ' AddData method takes four parameters + ' The 1st parameters represent the data format + ' The 2nd parameters represent the data value + ' The 3rd parameters represent the default alignment of column using the data + ' The 4th parameters represent the maximum length of the data value being shown + report.AddData("${ArmSName}", record.Format(View_PersonsView.ArmSName), ReportEnum.Align.Left, 100) + report.AddData("${SectionAbbvrName}", record.Format(View_PersonsView.SectionAbbvrName), ReportEnum.Align.Left, 100) + report.AddData("${DeptAbbvr}", record.Format(View_PersonsView.DeptAbbvr), ReportEnum.Align.Left, 100) + report.AddData("${Retire}", record.Format(View_PersonsView.Retire), ReportEnum.Align.Left, 100) + report.AddData("${Commission}", record.Format(View_PersonsView.Commission), ReportEnum.Align.Left, 30) + report.AddData("${Born}", record.Format(View_PersonsView.Born), ReportEnum.Align.Left, 100) + report.AddData("${BProvince}", record.Format(View_PersonsView.BProvince), ReportEnum.Align.Left, 100) + report.AddData("${SAmout}", record.Format(View_PersonsView.SAmout), ReportEnum.Align.Right, 100) + report.AddData("${CEdu}", record.Format(View_PersonsView.CEdu), ReportEnum.Align.Left, 100) + report.AddData("${MobilePhone}", record.Format(View_PersonsView.MobilePhone), ReportEnum.Align.Left, 100) + report.AddData("${RankDate}", record.Format(View_PersonsView.RankDate), ReportEnum.Align.Left, 100) + report.AddData("${Title}", record.Format(View_PersonsView.Title), ReportEnum.Align.Left, 100) + report.AddData("${RankAndName}", record.Format(View_PersonsView.RankAndName), ReportEnum.Align.Left, 100) + + report.WriteRow + Next + pageNum = pageNum + 1 + recordCount += records.Length + End If + Loop While Not (records Is Nothing) AndAlso recordCount < totalRows AndAlso whereClause.RunQuery + report.save + BaseClasses.Utils.NetUtils.WriteResponseBinaryAttachment(Me.Page.Response, report.Title + ".doc", report.ReportInByteArray, 0, true) + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for Button with Layout + Public Overridable Sub View_PersonsSearchButton1_Click(ByVal sender As Object, ByVal args As EventArgs) + + Try + + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + + + ' Generate the event handling functions for filter and search events. + + ' event handler for FieldFilter + Protected Overridable Sub ArmyIdFromFilter1_SelectedIndexChanged(ByVal sender As Object, ByVal args As EventArgs) + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + + End Sub + + ' event handler for FieldFilter + Protected Overridable Sub DeptIdFilter_SelectedIndexChanged(ByVal sender As Object, ByVal args As EventArgs) + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + + End Sub + + ' event handler for FieldFilter + Protected Overridable Sub RankLevelFilter_SelectedIndexChanged(ByVal sender As Object, ByVal args As EventArgs) + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + + End Sub + + ' event handler for FieldFilter + Protected Overridable Sub RetireFilter_SelectedIndexChanged(ByVal sender As Object, ByVal args As EventArgs) + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + + End Sub + + ' event handler for FieldFilter + Protected Overridable Sub SectionIdFromFilter_SelectedIndexChanged(ByVal sender As Object, ByVal args As EventArgs) + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + + End Sub + + + ' Generate the event handling functions for others + + + Private _UIData As New System.Collections.Generic.List(Of Hashtable) + Public Property UIData() As System.Collections.Generic.List(Of Hashtable) + Get + Return Me._UIData + End Get + Set(ByVal value As System.Collections.Generic.List(Of Hashtable)) + Me._UIData = value + End Set + End Property + + ' pagination properties + Protected _PageSize As Integer + Public Property PageSize() As Integer + Get + Return Me._PageSize + End Get + Set(ByVal value As Integer) + Me._PageSize = value + End Set + End Property + + Protected _PageIndex As Integer + Public Property PageIndex() As Integer + Get + ' Return the PageIndex + Return Me._PageIndex + End Get + Set(ByVal value As Integer) + Me._PageIndex = value + End Set + End Property + + Protected _TotalRecords As Integer = -1 + Public Property TotalRecords() As Integer + Get + If _TotalRecords < 0 + _TotalRecords = View_PersonsView.GetRecordCount(CreateCompoundJoinFilter(), CreateWhereClause()) + End If + Return Me._TotalRecords + End Get + Set(ByVal value As Integer) + If Me.PageSize > 0 Then + + Me.TotalPages = CInt(Math.Ceiling(value / Me.PageSize)) + + End If + Me._TotalRecords = value + End Set + End Property + + + + Protected _TotalPages As Integer = -1 + Public Property TotalPages() As Integer + Get + If _TotalPages < 0 Then + + Me.TotalPages = CInt(Math.Ceiling(TotalRecords / Me.PageSize)) + + End If + Return Me._TotalPages + End Get + Set(ByVal value As Integer) + Me._TotalPages = value + End Set + End Property + + Protected _DisplayLastPage As Boolean + Public Property DisplayLastPage() As Boolean + Get + Return Me._DisplayLastPage + End Get + Set(ByVal value As Boolean) + Me._DisplayLastPage = value + End Set + End Property + + Private _DataChanged As Boolean = False + Public Property DataChanged() As Boolean + Get + Return Me._DataChanged + End Get + Set(ByVal value As Boolean) + Me._DataChanged = value + End Set + End Property + + Private _ResetData As Boolean = False + Public Property ResetData() As Boolean + Get + Return Me._ResetData + End Get + Set(ByVal value As Boolean) + Me._ResetData = value + End Set + End Property + + Private _AddNewRecord As Integer = 0 + Public Property AddNewRecord() As Integer + Get + Return Me._AddNewRecord + End Get + Set(ByVal value As Integer) + Me._AddNewRecord = value + End Set + End Property + + + Private _CurrentSortOrder As OrderBy = Nothing + Public Property CurrentSortOrder() As OrderBy + Get + Return Me._CurrentSortOrder + End Get + Set(ByVal value As BaseClasses.Data.OrderBy) + Me._CurrentSortOrder = value + End Set + End Property + + Private _DataSource() As View_PersonsRecord = Nothing + Public Property DataSource() As View_PersonsRecord () + Get + Return Me._DataSource + End Get + Set(ByVal value() As View_PersonsRecord) + Me._DataSource = value + End Set + End Property + +#Region "Helper Properties" + + Public ReadOnly Property ArmSNameLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "ArmSNameLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property ArmyIdFromFilter1() As System.Web.UI.WebControls.DropDownList + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "ArmyIdFromFilter1"), System.Web.UI.WebControls.DropDownList) + End Get + End Property + + Public ReadOnly Property ArmyIdLabel2() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "ArmyIdLabel2"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property BornLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "BornLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property BProvinceLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "BProvinceLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property CEduLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "CEduLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property CommissionLabel() As System.Web.UI.WebControls.Label + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "CommissionLabel"), System.Web.UI.WebControls.Label) + End Get + End Property + + Public ReadOnly Property DeptIdFilter() As System.Web.UI.WebControls.DropDownList + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "DeptIdFilter"), System.Web.UI.WebControls.DropDownList) + End Get + End Property + + Public ReadOnly Property DeptIdLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "DeptIdLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property MobilePhoneLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "MobilePhoneLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property PersonalNameLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalNameLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property pictureLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "pictureLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property RankDateLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RankDateLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property RankDateLabel1() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RankDateLabel1"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property RankLevelFilter() As System.Web.UI.WebControls.DropDownList + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RankLevelFilter"), System.Web.UI.WebControls.DropDownList) + End Get + End Property + + Public ReadOnly Property RankLevelLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RankLevelLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property RetireFilter() As System.Web.UI.WebControls.DropDownList + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RetireFilter"), System.Web.UI.WebControls.DropDownList) + End Get + End Property + + Public ReadOnly Property RetireLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RetireLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property RetireLabel1() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RetireLabel1"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property SAmoutGrandTotal() As System.Web.UI.WebControls.Label + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "SAmoutGrandTotal"), System.Web.UI.WebControls.Label) + End Get + End Property + + Public ReadOnly Property SAmoutLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "SAmoutLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property SectionAbbvrNameLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "SectionAbbvrNameLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property SectionIdFromFilter() As System.Web.UI.WebControls.DropDownList + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "SectionIdFromFilter"), System.Web.UI.WebControls.DropDownList) + End Get + End Property + + Public ReadOnly Property SectionIdLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "SectionIdLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property TitleLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "TitleLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property View_PersonsExportCSVButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "View_PersonsExportCSVButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property View_PersonsExportExcelButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "View_PersonsExportExcelButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property View_PersonsPagination() As Persons.UI.IPagination + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "View_PersonsPagination"), Persons.UI.IPagination) + End Get + End Property + + Public ReadOnly Property View_PersonsPDFButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "View_PersonsPDFButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property View_PersonsRefreshButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "View_PersonsRefreshButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property View_PersonsResetButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "View_PersonsResetButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property View_PersonsSearch1() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "View_PersonsSearch1"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property View_PersonsSearchButton1() As Persons.UI.IThemeButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "View_PersonsSearchButton1"), Persons.UI.IThemeButton) + End Get + End Property + + Public ReadOnly Property View_PersonsTableControlCollapsibleRegion() As System.Web.UI.WebControls.Panel + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "View_PersonsTableControlCollapsibleRegion"), System.Web.UI.WebControls.Panel) + End Get + End Property + + Public ReadOnly Property View_PersonsTableControlIcon() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "View_PersonsTableControlIcon"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property View_PersonsTableControlPanelExtender() As AjaxControlToolkit.CollapsiblePanelExtender + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "View_PersonsTableControlPanelExtender"), AjaxControlToolkit.CollapsiblePanelExtender) + End Get + End Property + + Public ReadOnly Property View_PersonsTitle() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "View_PersonsTitle"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property View_PersonsWordButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "View_PersonsWordButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + +#End Region + +#Region "Helper Functions" + + Public Overrides Overloads Function ModifyRedirectUrl(url As String, arg As String, ByVal bEncrypt As Boolean) As String + Return Me.Page.EvaluateExpressions(url, arg, bEncrypt, Me) + End Function + + Public Overrides Overloads Function EvaluateExpressions(url As String, arg As String, ByVal bEncrypt As Boolean) As String + Dim needToProcess As Boolean = AreAnyUrlParametersForMe(url, arg) + If (needToProcess) Then + Dim recCtl As View_PersonsTableControlRow = Me.GetSelectedRecordControl() + If recCtl Is Nothing AndAlso url.IndexOf("{") >= 0 Then + ' Localization. + Throw New Exception(Page.GetResourceValue("Err:NoRecSelected", "Persons")) + End If + Dim rec As View_PersonsRecord = Nothing + If recCtl IsNot Nothing Then + rec = recCtl.GetRecord() + End If + Return EvaluateExpressions(url, arg, rec, bEncrypt) + End If + Return url + End Function + + Public Overridable Function GetSelectedRecordControl() As View_PersonsTableControlRow + Return Nothing + + End Function + + Public Overridable Function GetSelectedRecordControls() As View_PersonsTableControlRow() + + Return DirectCast((new ArrayList()).ToArray(GetType(View_PersonsTableControlRow)), View_PersonsTableControlRow()) + + End Function + + Public Overridable Sub DeleteSelectedRecords(ByVal deferDeletion As Boolean) + Dim recList() As View_PersonsTableControlRow = Me.GetSelectedRecordControls() + If recList.Length = 0 Then + ' Localization. + Throw New Exception(Page.GetResourceValue("Err:NoRecSelected", "Persons")) + End If + + Dim recCtl As View_PersonsTableControlRow + For Each recCtl In recList + If deferDeletion Then + If Not recCtl.IsNewRecord Then + + Me.AddToDeletedRecordIds(recCtl) + + End If + recCtl.Visible = False + + Else + + recCtl.Delete() + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + End If + Next + End Sub + + Public Function GetRecordControls() As View_PersonsTableControlRow() + Dim recList As ArrayList = New ArrayList() + Dim rep As System.Web.UI.WebControls.Repeater = CType(Me.FindControl("View_PersonsTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return Nothing + Dim repItem As System.Web.UI.WebControls.RepeaterItem + + For Each repItem In rep.Items + + Dim recControl As View_PersonsTableControlRow = DirectCast(repItem.FindControl("View_PersonsTableControlRow"), View_PersonsTableControlRow) + recList.Add(recControl) + + Next + + Return DirectCast(recList.ToArray(GetType(View_PersonsTableControlRow)), View_PersonsTableControlRow()) + 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 + + \ No newline at end of file diff --git a/App_Code/PersonalInsignia/EditPersonalInsigniaTable.Controls.vb b/App_Code/PersonalInsignia/EditPersonalInsigniaTable.Controls.vb new file mode 100644 index 0000000..4ebbaf9 --- /dev/null +++ b/App_Code/PersonalInsignia/EditPersonalInsigniaTable.Controls.vb @@ -0,0 +1,3387 @@ + +' This file implements the TableControl, TableControlRow, and RecordControl classes for the +' EditPersonalInsigniaTable.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.EditPersonalInsigniaTable + +#Region "Section 1: Place your customizations here." + + +Public Class PersonalInsigniaTableControlRow + Inherits BasePersonalInsigniaTableControlRow + ' The BasePersonalInsigniaTableControlRow implements code for a ROW within the + ' the PersonalInsigniaTableControl table. The BasePersonalInsigniaTableControlRow implements the DataBind and SaveData methods. + ' The loading of data is actually performed by the LoadData method in the base class of PersonalInsigniaTableControl. + + ' This is the ideal place to add your code customizations. For example, you can override the DataBind, + ' SaveData, GetUIData, and Validate methods. + Public Overrides Sub GetUIData() + + ' Call MyBase.GetUIData + MyBase.GetUIData() + + ' Get PersonalDD Record + Dim myRec As PersonalInsigniaRecord = Me.GetRecord + + ' Set PersonalId field value to new value string + myRec.PersonalId = Utils.SecurityControls.GetCurrentUserID + + End Sub + + +End Class + + + +Public Class PersonalInsigniaTableControl + Inherits BasePersonalInsigniaTableControl + + ' The BasePersonalInsigniaTableControl class implements the LoadData, DataBind, CreateWhereClause + ' and other methods to load and display the data in a table control. + + ' This is the ideal place to add your code customizations. You can override the LoadData and CreateWhereClause, + ' The PersonalInsigniaTableControlRow class offers another place where you can customize + ' the DataBind, GetUIData, SaveData and Validate methods specific to each row displayed on the table. + +End Class + + + +#End Region + + + +#Region "Section 2: Do not modify this section." + + +' Base class for the PersonalInsigniaTableControlRow control on the EditPersonalInsigniaTable page. +' Do not modify this class. Instead override any method in PersonalInsigniaTableControlRow. +Public Class BasePersonalInsigniaTableControlRow + Inherits Persons.UI.BaseApplicationRecordControl + + ' To customize, override this method in PersonalInsigniaTableControlRow. + Protected Overridable Sub Control_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Init + + Me.ClearControlsFromSession() + End Sub + + ' To customize, override this method in PersonalInsigniaTableControlRow. + Protected Overridable Sub Control_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load + + 'Call LoadFocusScripts from repeater so that onfocus attribute could be added to elements + Me.Page.LoadFocusScripts(Me) + + ' Show confirmation message on Click + Me.PersonalInsigniaRowDeleteButton.Attributes.Add("onClick", "return (confirm('" & (CType(Me.Page,BaseApplicationPage)).GetResourceValue("DeleteRecordConfirm", "Persons") & "'));") + + + ' Register the event handlers. + + AddHandler Me.PersonalInsigniaRowDeleteButton.Click, AddressOf PersonalInsigniaRowDeleteButton_Click + + AddHandler Me.InsigniaId.SelectedIndexChanged, AddressOf InsigniaId_SelectedIndexChanged + + AddHandler Me.PersonalId.SelectedIndexChanged, AddressOf PersonalId_SelectedIndexChanged + + AddHandler Me.GazetteDate.TextChanged, AddressOf GazetteDate_TextChanged + + AddHandler Me.GazetteNO.TextChanged, AddressOf GazetteNO_TextChanged + + AddHandler Me.GazettePage.TextChanged, AddressOf GazettePage_TextChanged + + AddHandler Me.GazetteSection.TextChanged, AddressOf GazetteSection_TextChanged + + AddHandler Me.InsigniaDate.TextChanged, AddressOf InsigniaDate_TextChanged + + AddHandler Me.InsigniaReturn.TextChanged, AddressOf InsigniaReturn_TextChanged + + + End Sub + + + Public Overridable Sub LoadData() + + ' Load the data from the database into the DataSource PersonalInsignia 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 = PersonalInsigniaTable.GetRecord(Me.RecordUniqueId, True) + + Return + End If + + ' Since this is a row in the table, the data for this row is loaded by the + ' LoadData method of the BasePersonalInsigniaTableControl when the data for the entire + ' table is loaded. + + Me.DataSource = New PersonalInsigniaRecord() + + + + End Sub + + ' Populate the UI controls using the DataSource. To customize, override this method in PersonalInsigniaTableControlRow. + 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 + + SetGazetteDate() + SetGazetteNO() + SetGazettePage() + SetGazetteSection() + SetInsigniaDate() + SetInsigniaId() + SetInsigniaReturn() + SetPersonalId() + + + + + 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 SetGazetteDate() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.GazetteDate.ID) Then + + Me.GazetteDate.Text = Me.PreviousUIData(Me.GazetteDate.ID).ToString() + + Return + End If + + + ' Set the GazetteDate TextBox on the webpage with value from the + ' PersonalInsignia database record. + + ' Me.DataSource is the PersonalInsignia record retrieved from the database. + ' Me.GazetteDate is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetGazetteDate() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.GazetteDateSpecified Then + + ' If the GazetteDate is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalInsigniaTable.GazetteDate, "d MMM yyyy") + + Me.GazetteDate.Text = formattedValue + + Else + + ' GazetteDate is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.GazetteDate.Text = PersonalInsigniaTable.GazetteDate.Format(PersonalInsigniaTable.GazetteDate.DefaultValue, "d MMM yyyy") + + End If + + End Sub + + Public Overridable Sub SetGazetteNO() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.GazetteNO.ID) Then + + Me.GazetteNO.Text = Me.PreviousUIData(Me.GazetteNO.ID).ToString() + + Return + End If + + + ' Set the GazetteNO TextBox on the webpage with value from the + ' PersonalInsignia database record. + + ' Me.DataSource is the PersonalInsignia record retrieved from the database. + ' Me.GazetteNO is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetGazetteNO() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.GazetteNOSpecified Then + + ' If the GazetteNO is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalInsigniaTable.GazetteNO) + + Me.GazetteNO.Text = formattedValue + + Else + + ' GazetteNO is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.GazetteNO.Text = PersonalInsigniaTable.GazetteNO.Format(PersonalInsigniaTable.GazetteNO.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetGazettePage() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.GazettePage.ID) Then + + Me.GazettePage.Text = Me.PreviousUIData(Me.GazettePage.ID).ToString() + + Return + End If + + + ' Set the GazettePage TextBox on the webpage with value from the + ' PersonalInsignia database record. + + ' Me.DataSource is the PersonalInsignia record retrieved from the database. + ' Me.GazettePage is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetGazettePage() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.GazettePageSpecified Then + + ' If the GazettePage is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalInsigniaTable.GazettePage) + + Me.GazettePage.Text = formattedValue + + Else + + ' GazettePage is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.GazettePage.Text = PersonalInsigniaTable.GazettePage.Format(PersonalInsigniaTable.GazettePage.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetGazetteSection() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.GazetteSection.ID) Then + + Me.GazetteSection.Text = Me.PreviousUIData(Me.GazetteSection.ID).ToString() + + Return + End If + + + ' Set the GazetteSection TextBox on the webpage with value from the + ' PersonalInsignia database record. + + ' Me.DataSource is the PersonalInsignia record retrieved from the database. + ' Me.GazetteSection is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetGazetteSection() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.GazetteSectionSpecified Then + + ' If the GazetteSection is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalInsigniaTable.GazetteSection) + + Me.GazetteSection.Text = formattedValue + + Else + + ' GazetteSection is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.GazetteSection.Text = PersonalInsigniaTable.GazetteSection.Format(PersonalInsigniaTable.GazetteSection.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetInsigniaDate() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.InsigniaDate.ID) Then + + Me.InsigniaDate.Text = Me.PreviousUIData(Me.InsigniaDate.ID).ToString() + + Return + End If + + + ' Set the InsigniaDate TextBox on the webpage with value from the + ' PersonalInsignia database record. + + ' Me.DataSource is the PersonalInsignia record retrieved from the database. + ' Me.InsigniaDate is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetInsigniaDate() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.InsigniaDateSpecified Then + + ' If the InsigniaDate is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalInsigniaTable.InsigniaDate, "d MMM yyyy") + + Me.InsigniaDate.Text = formattedValue + + Else + + ' InsigniaDate is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.InsigniaDate.Text = PersonalInsigniaTable.InsigniaDate.Format(PersonalInsigniaTable.InsigniaDate.DefaultValue, "d MMM yyyy") + + End If + + End Sub + + Public Overridable Sub SetInsigniaId() + + ' If selection was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.InsigniaId.ID) Then + If Me.PreviousUIData(Me.InsigniaId.ID) Is Nothing + Me.PopulateInsigniaIdDropDownList(Nothing, 100) + Else + Me.PopulateInsigniaIdDropDownList(Me.PreviousUIData(Me.InsigniaId.ID).ToString(), 100) + End If + Return + End If + + + ' Set the InsigniaId DropDownList on the webpage with value from the + ' PersonalInsignia database record. + + ' Me.DataSource is the PersonalInsignia record retrieved from the database. + ' Me.InsigniaId is the ASP:DropDownList on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetInsigniaId() + ' and add your own code before or after the call to the MyBase function. + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.InsigniaIdSpecified Then + + ' If the InsigniaId is non-NULL, then format the value. + ' The Format method will return the Display Foreign Key As (DFKA) value + Me.PopulateInsigniaIdDropDownList(Me.DataSource.InsigniaId.ToString(), 100) + + Else + + ' InsigniaId 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.PopulateInsigniaIdDropDownList(Nothing, 100) + Else + Me.PopulateInsigniaIdDropDownList(PersonalInsigniaTable.InsigniaId.DefaultValue, 100) + End If + + End If + + End Sub + + Public Overridable Sub SetInsigniaReturn() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.InsigniaReturn.ID) Then + + Me.InsigniaReturn.Text = Me.PreviousUIData(Me.InsigniaReturn.ID).ToString() + + Return + End If + + + ' Set the InsigniaReturn TextBox on the webpage with value from the + ' PersonalInsignia database record. + + ' Me.DataSource is the PersonalInsignia record retrieved from the database. + ' Me.InsigniaReturn is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetInsigniaReturn() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.InsigniaReturnSpecified Then + + ' If the InsigniaReturn is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalInsigniaTable.InsigniaReturn) + + Me.InsigniaReturn.Text = formattedValue + + Else + + ' InsigniaReturn is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.InsigniaReturn.Text = PersonalInsigniaTable.InsigniaReturn.Format(PersonalInsigniaTable.InsigniaReturn.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetPersonalId() + + ' If selection was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.PersonalId.ID) Then + If Me.PreviousUIData(Me.PersonalId.ID) Is Nothing + Me.PopulatePersonalIdDropDownList(Nothing, 100) + Else + Me.PopulatePersonalIdDropDownList(Me.PreviousUIData(Me.PersonalId.ID).ToString(), 100) + End If + Return + End If + + + ' Set the PersonalId DropDownList on the webpage with value from the + ' PersonalInsignia database record. + + ' Me.DataSource is the PersonalInsignia record retrieved from the database. + ' Me.PersonalId is the ASP:DropDownList on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetPersonalId() + ' and add your own code before or after the call to the MyBase function. + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.PersonalIdSpecified Then + + ' If the PersonalId is non-NULL, then format the value. + ' The Format method will return the Display Foreign Key As (DFKA) value + Me.PopulatePersonalIdDropDownList(Me.DataSource.PersonalId, 100) + + Else + + ' PersonalId 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.PopulatePersonalIdDropDownList(Nothing, 100) + Else + Me.PopulatePersonalIdDropDownList(PersonalInsigniaTable.PersonalId.DefaultValue, 100) + End If + + End If + + End Sub + + + Public EvaluateFormulaDelegate As BaseClasses.Data.DataSource.EvaluateFormulaDelegate = New BaseClasses.Data.DataSource.EvaluateFormulaDelegate(AddressOf Me.EvaluateFormula) + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean, ByVal e As FormulaEvaluator) As String + If e Is Nothing Then + e = New FormulaEvaluator() + End If + + e.Variables.Clear() + + + ' add variables for formula evaluation + If variables IsNot Nothing Then + Dim enumerator As System.Collections.Generic.IEnumerator(Of System.Collections.Generic.KeyValuePair(Of String, Object)) = variables.GetEnumerator() + While enumerator.MoveNext() + e.Variables.Add(enumerator.Current.Key, enumerator.Current.Value) + End While + End If + + If includeDS + + End IF + + + ' Other variables referred to in the formula are expected to be + ' properties of the DataSource. For example, referring to + ' UnitPrice as a variable will refer to DataSource.UnitPrice + If dataSourceForEvaluate Is Nothing Then + + e.DataSource = Me.DataSource + + Else + e.DataSource = dataSourceForEvaluate + End If + + ' Define the calling control. This is used to add other + ' related table and record controls as variables. + e.CallingControl = Me + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + + If Not String.IsNullOrEmpty(format) AndAlso (String.IsNullOrEmpty(formula) OrElse formula.IndexOf("Format(") < 0) Then + Return FormulaUtils.Format(resultObj, format) + Else + Return resultObj.ToString() + End If + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format,variables ,includeDS, Nothing) + End Function + + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object)) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format, variables ,True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, format, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal e as FormulaEvaluator) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, variables, True, e) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal includeDS as Boolean) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, includeDS, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, True, Nothing) + End Function + + + Public Overridable Sub RegisterPostback() + + + End Sub + + + + ' To customize, override this method in PersonalInsigniaTableControlRow. + Public Overridable Sub SaveData() + ' Saves the associated record in the database. + ' SaveData calls Validate and Get methods - so it may be more appropriate to + ' customize those methods. + + ' 1. Load the existing record from the database. Since we save the entire record, this ensures + ' that fields that are not displayed are also properly initialized. + Me.LoadData() + + + ' 2. Perform any custom validation. + Me.Validate() + + + ' 3. Set the values in the record with data from UI controls. + ' This calls the Get() method for each of the user interface controls. + Me.GetUIData() + + ' 4. Save in the database. + ' We should not save the record if the data did not change. This + ' will save a database hit and avoid triggering any database triggers. + + If Me.DataSource.IsAnyValueChanged Then + ' Save record to database but do not commit yet. + ' Auto generated ids are available after saving for use by child (dependent) records. + Me.DataSource.Save() + + DirectCast(GetParentControlObject(Me, "PersonalInsigniaTableControl"), PersonalInsigniaTableControl).DataChanged = True + DirectCast(GetParentControlObject(Me, "PersonalInsigniaTableControl"), PersonalInsigniaTableControl).ResetData = True + End If + + + ' update session or cookie by formula + + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + ' For Master-Detail relationships, save data on the Detail table(s) + + End Sub + + ' To customize, override this method in PersonalInsigniaTableControlRow. + 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. + + GetGazetteDate() + GetGazetteNO() + GetGazettePage() + GetGazetteSection() + GetInsigniaDate() + GetInsigniaId() + GetInsigniaReturn() + GetPersonalId() + End Sub + + + Public Overridable Sub GetGazetteDate() + + ' Retrieve the value entered by the user on the GazetteDate ASP:TextBox, and + ' save it into the GazetteDate field in DataSource PersonalInsignia 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.GazetteDate.Text, PersonalInsigniaTable.GazetteDate) + + + End Sub + + Public Overridable Sub GetGazetteNO() + + ' Retrieve the value entered by the user on the GazetteNO ASP:TextBox, and + ' save it into the GazetteNO field in DataSource PersonalInsignia record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.GazetteNO.Text, PersonalInsigniaTable.GazetteNO) + + + End Sub + + Public Overridable Sub GetGazettePage() + + ' Retrieve the value entered by the user on the GazettePage ASP:TextBox, and + ' save it into the GazettePage field in DataSource PersonalInsignia record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.GazettePage.Text, PersonalInsigniaTable.GazettePage) + + + End Sub + + Public Overridable Sub GetGazetteSection() + + ' Retrieve the value entered by the user on the GazetteSection ASP:TextBox, and + ' save it into the GazetteSection field in DataSource PersonalInsignia record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.GazetteSection.Text, PersonalInsigniaTable.GazetteSection) + + + End Sub + + Public Overridable Sub GetInsigniaDate() + + ' Retrieve the value entered by the user on the InsigniaDate ASP:TextBox, and + ' save it into the InsigniaDate field in DataSource PersonalInsignia 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.InsigniaDate.Text, PersonalInsigniaTable.InsigniaDate) + + + End Sub + + Public Overridable Sub GetInsigniaId() + + ' Retrieve the value entered by the user on the InsigniaId ASP:DropDownList, and + ' save it into the InsigniaId field in DataSource PersonalInsignia record. + + ' Custom validation should be performed in Validate, not here. + + Me.DataSource.Parse(GetValueSelectedPageRequest(Me.InsigniaId), PersonalInsigniaTable.InsigniaId) + + End Sub + + Public Overridable Sub GetInsigniaReturn() + + ' Retrieve the value entered by the user on the InsigniaReturn ASP:TextBox, and + ' save it into the InsigniaReturn field in DataSource PersonalInsignia record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.InsigniaReturn.Text, PersonalInsigniaTable.InsigniaReturn) + + + End Sub + + Public Overridable Sub GetPersonalId() + + ' Retrieve the value entered by the user on the PersonalId ASP:DropDownList, and + ' save it into the PersonalId field in DataSource PersonalInsignia record. + + ' Custom validation should be performed in Validate, not here. + + Me.DataSource.Parse(GetValueSelectedPageRequest(Me.PersonalId), PersonalInsigniaTable.PersonalId) + + End Sub + + + ' To customize, override this method in PersonalInsigniaTableControlRow. + + Public Overridable Function CreateWhereClause() As WhereClause + + Return Nothing + + End Function + + + + ' To customize, override this method in PersonalInsigniaTableControlRow. + 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) + PersonalInsigniaTable.DeleteRecord(pkValue) + + DirectCast(GetParentControlObject(Me, "PersonalInsigniaTableControl"), PersonalInsigniaTableControl).DataChanged = True + DirectCast(GetParentControlObject(Me, "PersonalInsigniaTableControl"), PersonalInsigniaTableControl).ResetData = True + End Sub + + Protected Overridable Sub Control_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.PreRender + ' PreRender event is raised just before page is being displayed. + Try + DbUtils.StartTransaction() + Me.RegisterPostback() + + If Not Me.Page.ErrorOnPage AndAlso (Me.Page.IsPageRefresh OrElse Me.DataChanged OrElse Me.ResetData) Then + + + ' Re-load the data and update the web page if necessary. + ' This is typically done during a postback (filter, search button, sort, pagination button). + ' In each of the other click handlers, simply set DataChanged to True to reload the data. + Me.LoadData() + Me.DataBind() + End If + + + Catch ex As Exception + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + Finally + DbUtils.EndTransaction() + End Try + End Sub + + + Protected Overrides Sub SaveControlsToSession() + MyBase.SaveControlsToSession() + + + 'Save pagination state to session. + + End Sub + + + + Protected Overrides Sub ClearControlsFromSession() + MyBase.ClearControlsFromSession() + + + + ' Clear pagination state from session. + + End Sub + + Protected Overrides Sub LoadViewState(ByVal savedState As Object) + MyBase.LoadViewState(savedState) + Dim isNewRecord As String = CType(ViewState("IsNewRecord"), String) + If Not isNewRecord Is Nothing AndAlso isNewRecord.Trim <> "" Then + Me.IsNewRecord = Boolean.Parse(isNewRecord) + End If + + Dim myCheckSum As String = CType(ViewState("CheckSum"), String) + If Not myCheckSum Is Nothing AndAlso myCheckSum.Trim <> "" Then + Me.CheckSum = myCheckSum + End If + + + ' Load view state for pagination control. + + End Sub + + Protected Overrides Function SaveViewState() As Object + ViewState("IsNewRecord") = Me.IsNewRecord.ToString() + ViewState("CheckSum") = Me.CheckSum + + + ' Load view state for pagination control. + + Return MyBase.SaveViewState() + End Function + + + + Public Overridable Function CreateWhereClause_InsigniaIdDropDownList() 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 Insignia table. + ' Examples: + ' wc.iAND(InsigniaTable.InsigniaName, BaseFilter.ComparisonOperator.EqualsTo, "XYZ") + ' wc.iAND(InsigniaTable.Active, BaseFilter.ComparisonOperator.EqualsTo, "1") + + Dim wc As WhereClause = New WhereClause() + Return wc + + End Function + + + + Public Overridable Function CreateWhereClause_PersonalIdDropDownList() 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 PersonalId table. + ' Examples: + ' wc.iAND(PersonalIdTable.PersonalName, BaseFilter.ComparisonOperator.EqualsTo, "XYZ") + ' wc.iAND(PersonalIdTable.Active, BaseFilter.ComparisonOperator.EqualsTo, "1") + + Dim wc As WhereClause = New WhereClause() + Return wc + + End Function + + + ' Fill the InsigniaId list. + Protected Overridable Sub PopulateInsigniaIdDropDownList( _ + ByVal selectedValue As String, _ + ByVal maxItems As Integer) + + Me.InsigniaId.Items.Clear() + + + ' 1. Setup the static list items + + ' Add the Please Select item. + Me.InsigniaId.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_InsigniaIdDropDownList function. + ' It is better to customize the where clause there. + + Dim wc As WhereClause = CreateWhereClause_InsigniaIdDropDownList() + ' Create the ORDER BY clause to sort based on the displayed value. + + + Dim orderBy As OrderBy = New OrderBy(false, false) + orderBy.Add(InsigniaTable.InsigniaName, 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 InsigniaRecord = 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 = InsigniaTable.GetRecords(wc, orderBy, pageNum, maxItems) + For each itemValue As InsigniaRecord In itemValues + ' Create the item and add to the list. + Dim cvalue As String = Nothing + Dim fvalue As String = Nothing + If itemValue.InsigniaIdSpecified Then + cvalue = itemValue.InsigniaId.ToString() + + If counter < maxItems AndAlso Me.InsigniaId.Items.FindByValue(cvalue) Is Nothing Then + + Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalInsigniaTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalInsigniaTable.InsigniaId) + If _isExpandableNonCompositeForeignKey AndAlso PersonalInsigniaTable.InsigniaId.IsApplyDisplayAs Then + fvalue = PersonalInsigniaTable.GetDFKA(itemValue, PersonalInsigniaTable.InsigniaId) + End If + If (Not _isExpandableNonCompositeForeignKey) Or (String.IsNullOrEmpty(fvalue)) Then + fvalue = itemValue.Format(InsigniaTable.InsigniaName) + 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.InsigniaId.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.InsigniaId.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.InsigniaId, selectedValue) AndAlso _ + Not SetSelectedDisplayText(Me.InsigniaId, selectedValue)Then + + ' construct a whereclause to query a record with Insignia.InsigniaId = selectedValue + Dim filter2 As CompoundFilter = New CompoundFilter(CompoundFilter.CompoundingOperators.And_Operator, Nothing) + Dim whereClause2 As WhereClause = New WhereClause() + filter2.AddFilter(New BaseClasses.Data.ColumnValueFilter(InsigniaTable.InsigniaId, selectedValue, BaseClasses.Data.BaseFilter.ComparisonOperator.EqualsTo, False)) + whereClause2.AddFilter(filter2, CompoundFilter.CompoundingOperators.And_Operator) + + Try + ' Execute the query + Dim rc() As InsigniaRecord = InsigniaTable.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 InsigniaRecord = DirectCast(rc(0), InsigniaRecord) + ' Create the item and add to the list. + Dim cvalue As String = Nothing + Dim fvalue As String = Nothing + If itemValue.InsigniaIdSpecified Then + cvalue = itemValue.InsigniaId.ToString() + Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalInsigniaTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalInsigniaTable.InsigniaId) + If _isExpandableNonCompositeForeignKey AndAlso PersonalInsigniaTable.InsigniaId.IsApplyDisplayAs Then + fvalue = PersonalInsigniaTable.GetDFKA(itemValue, PersonalInsigniaTable.InsigniaId) + End If + If (Not _isExpandableNonCompositeForeignKey) Or (String.IsNullOrEmpty(fvalue)) Then + fvalue = itemValue.Format(InsigniaTable.InsigniaName) + End If + + If fvalue Is Nothing OrElse fvalue.Trim() = "" Then fvalue = cvalue + Dim newItem As New ListItem(fvalue, cvalue) + Me.InsigniaId.Items.Add(newItem) + SetSelectedValue(Me.InsigniaId, selectedValue) + End If + End If + Catch + End Try + + End If + + + End Sub + + ' Fill the PersonalId list. + Protected Overridable Sub PopulatePersonalIdDropDownList( _ + ByVal selectedValue As String, _ + ByVal maxItems As Integer) + + Me.PersonalId.Items.Clear() + + + ' 1. Setup the static list items + + ' Add the Please Select item. + Me.PersonalId.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_PersonalIdDropDownList function. + ' It is better to customize the where clause there. + + Dim wc As WhereClause = CreateWhereClause_PersonalIdDropDownList() + ' Create the ORDER BY clause to sort based on the displayed value. + + + Dim orderBy As OrderBy = New OrderBy(false, false) + orderBy.Add(PersonalIdTable.PersonalName, OrderByItem.OrderDir.Asc) + + Dim variables As System.Collections.Generic.IDictionary(Of String, Object) = New System.Collections.Generic.Dictionary(Of String, Object) + + ' 3. Read a total of maxItems from the database and insert them + Dim itemValues() As PersonalIdRecord = 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 = PersonalIdTable.GetRecords(wc, orderBy, pageNum, maxItems) + For each itemValue As PersonalIdRecord In itemValues + ' Create the item and add to the list. + Dim cvalue As String = Nothing + Dim fvalue As String = Nothing + If itemValue.PersonalIdSpecified Then + cvalue = itemValue.PersonalId.ToString() + + If counter < maxItems AndAlso Me.PersonalId.Items.FindByValue(cvalue) Is Nothing Then + + Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalInsigniaTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalInsigniaTable.PersonalId) + If _isExpandableNonCompositeForeignKey AndAlso PersonalInsigniaTable.PersonalId.IsApplyDisplayAs Then + fvalue = PersonalInsigniaTable.GetDFKA(itemValue, PersonalInsigniaTable.PersonalId) + End If + If (Not _isExpandableNonCompositeForeignKey) Or (String.IsNullOrEmpty(fvalue)) Then + fvalue = itemValue.Format(PersonalIdTable.PersonalName) + End If + + If fvalue Is Nothing OrElse fvalue.Trim() = "" Then fvalue = cvalue + + If (IsNothing(fvalue)) Then + fvalue = "" + End If + + fvalue = fvalue.Trim() + + If ( fvalue.Length > 50 ) Then + fvalue = fvalue.Substring(0, 50) & "..." + End If + + Dim dupItem As ListItem = Me.PersonalId.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.PersonalId.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.PersonalId, selectedValue) AndAlso _ + Not SetSelectedDisplayText(Me.PersonalId, selectedValue)Then + + ' construct a whereclause to query a record with PersonalId.PersonalId = selectedValue + Dim filter2 As CompoundFilter = New CompoundFilter(CompoundFilter.CompoundingOperators.And_Operator, Nothing) + Dim whereClause2 As WhereClause = New WhereClause() + filter2.AddFilter(New BaseClasses.Data.ColumnValueFilter(PersonalIdTable.PersonalId, selectedValue, BaseClasses.Data.BaseFilter.ComparisonOperator.EqualsTo, False)) + whereClause2.AddFilter(filter2, CompoundFilter.CompoundingOperators.And_Operator) + + Try + ' Execute the query + Dim rc() As PersonalIdRecord = PersonalIdTable.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 PersonalIdRecord = DirectCast(rc(0), PersonalIdRecord) + ' Create the item and add to the list. + Dim cvalue As String = Nothing + Dim fvalue As String = Nothing + If itemValue.PersonalIdSpecified Then + cvalue = itemValue.PersonalId.ToString() + Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalInsigniaTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalInsigniaTable.PersonalId) + If _isExpandableNonCompositeForeignKey AndAlso PersonalInsigniaTable.PersonalId.IsApplyDisplayAs Then + fvalue = PersonalInsigniaTable.GetDFKA(itemValue, PersonalInsigniaTable.PersonalId) + End If + If (Not _isExpandableNonCompositeForeignKey) Or (String.IsNullOrEmpty(fvalue)) Then + fvalue = itemValue.Format(PersonalIdTable.PersonalName) + End If + + If fvalue Is Nothing OrElse fvalue.Trim() = "" Then fvalue = cvalue + Dim newItem As New ListItem(fvalue, cvalue) + Me.PersonalId.Items.Add(newItem) + SetSelectedValue(Me.PersonalId, selectedValue) + End If + End If + Catch + End Try + + End If + + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalInsigniaRowDeleteButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + If(Not Me.Page.IsPageRefresh) Then + + Dim tc As PersonalInsigniaTableControl = DirectCast(GetParentControlObject(Me, "PersonalInsigniaTableControl"), PersonalInsigniaTableControl) + If Not (IsNothing(tc)) Then + If Not Me.IsNewRecord Then + tc.AddToDeletedRecordIds(DirectCast(Me, PersonalInsigniaTableControlRow)) + End If + Me.Visible = False + tc.SetFormulaControls() + End If + + End If + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + Protected Overridable Sub InsigniaId_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()(InsigniaId.ClientID & "_SelectedValue"), String) + Dim displayText As String = CType(Me.Page.Session()(InsigniaId.ClientID & "_SelectedDisplayText"), String) + If displayText <> "" AndAlso val <> "" Then + Me.InsigniaId.Items.Add(New ListItem(displayText, val)) + Me.InsigniaId.SelectedIndex = Me.InsigniaId.Items.Count - 1 + Me.Page.Session.Remove(InsigniaId.ClientID & "_SelectedValue") + Me.Page.Session.Remove(InsigniaId.ClientID & "_SelectedDisplayText") + End If + + + + + End Sub + + Protected Overridable Sub PersonalId_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()(PersonalId.ClientID & "_SelectedValue"), String) + Dim displayText As String = CType(Me.Page.Session()(PersonalId.ClientID & "_SelectedDisplayText"), String) + If displayText <> "" AndAlso val <> "" Then + Me.PersonalId.Items.Add(New ListItem(displayText, val)) + Me.PersonalId.SelectedIndex = Me.PersonalId.Items.Count - 1 + Me.Page.Session.Remove(PersonalId.ClientID & "_SelectedValue") + Me.Page.Session.Remove(PersonalId.ClientID & "_SelectedDisplayText") + End If + + + + + End Sub + + Protected Overridable Sub GazetteDate_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub GazetteNO_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub GazettePage_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub GazetteSection_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub InsigniaDate_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub InsigniaReturn_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("BasePersonalInsigniaTableControlRow_Rec"), String) + End Get + Set(ByVal value As String) + Me.ViewState("BasePersonalInsigniaTableControlRow_Rec") = value + End Set + End Property + + Private _DataSource As PersonalInsigniaRecord + Public Property DataSource() As PersonalInsigniaRecord + Get + Return Me._DataSource + End Get + + Set(ByVal value As PersonalInsigniaRecord) + + Me._DataSource = value + End Set + End Property + + + + Private _checkSum As String + Public Overridable Property CheckSum() As String + Get + Return Me._checkSum + End Get + Set(ByVal value As String) + Me._checkSum = value + End Set + End Property + + Private _TotalPages As Integer + Public Property TotalPages() As Integer + Get + Return Me._TotalPages + End Get + Set(ByVal value As Integer) + Me._TotalPages = value + End Set + End Property + + Private _PageIndex As Integer + Public Property PageIndex() As Integer + Get + ' Return the PageIndex + Return Me._PageIndex + End Get + Set(ByVal value As Integer) + Me._PageIndex = value + End Set + End Property + + Private _DisplayLastPage As Boolean + Public Property DisplayLastPage() As Boolean + Get + Return Me._DisplayLastPage + End Get + Set(ByVal value As Boolean) + Me._DisplayLastPage = value + End Set + End Property + + + +#Region "Helper Properties" + + Public ReadOnly Property GazetteDate() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "GazetteDate"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property GazetteNO() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "GazetteNO"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property GazettePage() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "GazettePage"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property GazetteSection() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "GazetteSection"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property InsigniaDate() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "InsigniaDate"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property InsigniaId() As System.Web.UI.WebControls.DropDownList + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "InsigniaId"), System.Web.UI.WebControls.DropDownList) + End Get + End Property + + Public ReadOnly Property InsigniaReturn() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "InsigniaReturn"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property PersonalId() As System.Web.UI.WebControls.DropDownList + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalId"), System.Web.UI.WebControls.DropDownList) + End Get + End Property + + Public ReadOnly Property PersonalInsigniaRecordRowSelection() As System.Web.UI.WebControls.CheckBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalInsigniaRecordRowSelection"), System.Web.UI.WebControls.CheckBox) + End Get + End Property + + Public ReadOnly Property PersonalInsigniaRowDeleteButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalInsigniaRowDeleteButton"), System.Web.UI.WebControls.ImageButton) + 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 PersonalInsigniaRecord = 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 PersonalInsigniaRecord + If Not Me.DataSource Is Nothing Then + Return Me.DataSource + End If + + If Not Me.RecordUniqueId Is Nothing Then + + Return PersonalInsigniaTable.GetRecord(Me.RecordUniqueId, True) + + End If + + ' Localization. + + Throw New Exception(Page.GetResourceValue("Err:RetrieveRec", "Persons")) + + End Function + + Public Shadows ReadOnly Property Page() As BaseApplicationPage + Get + Return DirectCast(MyBase.Page, BaseApplicationPage) + End Get + End Property + +#End Region + +End Class + + + +' Base class for the PersonalInsigniaTableControl control on the EditPersonalInsigniaTable page. +' Do not modify this class. Instead override any method in PersonalInsigniaTableControl. +Public Class BasePersonalInsigniaTableControl + Inherits Persons.UI.BaseApplicationTableControl + + + + Protected Overridable Sub Control_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Init + + + + ' Setup the filter and search events. + + + + ' Control Initializations. + ' Initialize the table's current sort order. + + If Me.InSession(Me, "Order_By") Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + Me.CurrentSortOrder.Add(PersonalInsigniaTable.InsigniaDate, OrderByItem.OrderDir.Asc) + + End If + + + + ' Setup default pagination settings. + + Me.PageSize = CInt(Me.GetFromSession(Me, "Page_Size", "10")) + Me.PageIndex = CInt(Me.GetFromSession(Me, "Page_Index", "0")) + + + + Me.ClearControlsFromSession() + End Sub + + Protected Overridable Sub Control_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load + + SaveControlsToSession_Ajax() + + ' Show confirmation message on Click + Me.PersonalInsigniaDeleteButton.Attributes.Add("onClick", "return (confirm('" & (CType(Me.Page,BaseApplicationPage)).GetResourceValue("DeleteConfirm", "Persons") & "'));") + + ' Setup the pagination events. + + AddHandler Me.PersonalInsigniaPagination.FirstPage.Click, AddressOf PersonalInsigniaPagination_FirstPage_Click + + AddHandler Me.PersonalInsigniaPagination.LastPage.Click, AddressOf PersonalInsigniaPagination_LastPage_Click + + AddHandler Me.PersonalInsigniaPagination.NextPage.Click, AddressOf PersonalInsigniaPagination_NextPage_Click + + AddHandler Me.PersonalInsigniaPagination.PageSizeButton.Click, AddressOf PersonalInsigniaPagination_PageSizeButton_Click + + AddHandler Me.PersonalInsigniaPagination.PreviousPage.Click, AddressOf PersonalInsigniaPagination_PreviousPage_Click + + + ' Setup the sorting events. + + AddHandler Me.GazetteDateLabel.Click, AddressOf GazetteDateLabel_Click + + AddHandler Me.GazetteNOLabel.Click, AddressOf GazetteNOLabel_Click + + AddHandler Me.GazettePageLabel.Click, AddressOf GazettePageLabel_Click + + AddHandler Me.GazetteSectionLabel.Click, AddressOf GazetteSectionLabel_Click + + AddHandler Me.InsigniaDateLabel.Click, AddressOf InsigniaDateLabel_Click + + AddHandler Me.InsigniaIdLabel1.Click, AddressOf InsigniaIdLabel1_Click + + AddHandler Me.InsigniaReturnLabel.Click, AddressOf InsigniaReturnLabel_Click + + ' Setup the button events. + + AddHandler Me.PersonalInsigniaAddButton.Click, AddressOf PersonalInsigniaAddButton_Click + + AddHandler Me.PersonalInsigniaDeleteButton.Click, AddressOf PersonalInsigniaDeleteButton_Click + + AddHandler Me.PersonalInsigniaEditButton.Click, AddressOf PersonalInsigniaEditButton_Click + + AddHandler Me.PersonalInsigniaRefreshButton.Click, AddressOf PersonalInsigniaRefreshButton_Click + + AddHandler Me.PersonalInsigniaResetButton.Click, AddressOf PersonalInsigniaResetButton_Click + + AddHandler Me.PersonalInsigniaSaveButton.Click, AddressOf PersonalInsigniaSaveButton_Click + + Me.PersonalInsigniaSaveButton.Attributes.Add("onclick", "SubmitHRefOnce(this, """ & Me.Page.GetResourceValue("Txt:SaveRecord", "Persons") & """);") + + + ' Setup events for others + + End Sub + + + Public Overridable Sub LoadData() + + ' Read data from database. Returns an array of records that can be assigned + ' to the DataSource table control property. + Try + Dim joinFilter As CompoundFilter = CreateCompoundJoinFilter() + + ' The WHERE clause will be empty when displaying all records in table. + Dim wc As WhereClause = CreateWhereClause() + If wc IsNot Nothing AndAlso Not wc.RunQuery Then + ' Initialize an empty array of records + Dim alist As New ArrayList(0) + Me.DataSource = DirectCast(alist.ToArray(GetType(PersonalInsigniaRecord)), PersonalInsigniaRecord()) + ' Add records to the list if needed. + Me.AddNewRecords() + Me._TotalRecords = 0 + Me._TotalPages = 0 + Return + End If + + ' Call OrderBy to determine the order - either use the order defined + ' on the Query Wizard, or specified by user (by clicking on column heading) + Dim orderBy As OrderBy = CreateOrderBy() + + ' Get the pagesize from the pagesize control. + Me.GetPageSize() + + If Me.DisplayLastPage Then + Dim totalRecords As Integer = If(Me._TotalRecords < 0, PersonalInsigniaTable.GetRecordCount(CreateCompoundJoinFilter(), CreateWhereClause()), Me._TotalRecords) + + Dim totalPages As Integer = CInt(Math.Ceiling(totalRecords / Me.PageSize)) + + Me.PageIndex = totalPages - 1 + End If + + ' Make sure PageIndex (current page) and PageSize are within bounds. + If Me.PageIndex < 0 Then + Me.PageIndex = 0 + End If + If Me.PageSize < 1 Then + Me.PageSize = 1 + End If + + ' Retrieve the records and set the table DataSource. + ' Only PageSize records are fetched starting at PageIndex (zero based). + If Me.AddNewRecord > 0 Then + ' Make sure to preserve the previously entered data on new rows. + Dim postdata As New ArrayList + For Each rc As PersonalInsigniaTableControlRow In Me.GetRecordControls() + If Not rc.IsNewRecord Then + rc.DataSource = rc.GetRecord() + rc.GetUIData() + postdata.Add(rc.DataSource) + UIData.Add(rc.PreservedUIData()) + End If + Next + Me.DataSource = DirectCast(postdata.ToArray(GetType(PersonalInsigniaRecord)), PersonalInsigniaRecord()) + Else ' Get the records from the database + Me.DataSource = PersonalInsigniaTable.GetRecords(joinFilter, wc, orderBy, Me.PageIndex, Me.PageSize) + + End If + + ' if the datasource contains no records contained in database, then load the last page. + If (DbUtils.GetCreatedRecords(Me.DataSource).Length = 0 AndAlso Not Me.DisplayLastPage) Then + Me.DisplayLastPage = True + LoadData() + Else + + ' Add any new rows desired by the user. + Me.AddNewRecords() + + ' Turn off the ToggleAll checkbox + Me.PersonalInsigniaToggleAll.Checked = False + + + ' Initialize the page and grand totals. now + + End If + + Catch ex As Exception + ' Report the error message to the end user + Dim msg As String = ex.Message + If ex.InnerException IsNot Nothing Then + msg = msg & " InnerException: " & ex.InnerException.Message + End If + Throw New Exception(msg, ex.InnerException) + End Try + End Sub + + + + + Public Overrides Sub DataBind() + ' The DataBind method binds the user interface controls to the values + ' from the database record for each row in the table. To do this, it calls the + ' DataBind for each of the rows. + ' DataBind also populates any filters above the table, and sets the pagination + ' control to the correct number of records and the current page number. + + MyBase.DataBind() + + ' Make sure that the DataSource is initialized. + If Me.DataSource Is Nothing Then + Return + End If + + 'LoadData for DataSource for chart and report if they exist + + ' Improve performance by prefetching display as records. + Me.PreFetchForeignKeyValues() + + ' Setup the pagination controls. + BindPaginationControls() + + + + ' Bind the repeater with the list of records to expand the UI. + Dim rep As System.Web.UI.WebControls.Repeater = CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalInsigniaTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return + rep.DataSource = DataSource() + rep.DataBind() + + Dim index As Integer = 0 + For Each repItem As System.Web.UI.WebControls.RepeaterItem In rep.Items + ' Loop through all rows in the table, set its DataSource and call DataBind(). + Dim recControl As PersonalInsigniaTableControlRow = DirectCast(repItem.FindControl("PersonalInsigniaTableControlRow"), PersonalInsigniaTableControlRow) + recControl.DataSource = Me.DataSource(index) + If Me.UIData.Count > index Then + recControl.PreviousUIData = Me.UIData(index) + End If + recControl.DataBind() + recControl.Visible = Not Me.InDeletedRecordIds(recControl) + + index += 1 + Next + + + + + ' Call the Set methods for each controls on the panel + + SetGazetteDateLabel() + SetGazetteNOLabel() + SetGazettePageLabel() + SetGazetteSectionLabel() + SetInsigniaDateLabel() + SetInsigniaIdLabel1() + SetInsigniaReturnLabel() + + + + + + + + SetPersonalInsigniaTableControlCollapsibleRegion() + SetPersonalInsigniaTableControlIcon() + SetPersonalInsigniaTableControlPanelExtender() + + + ' setting the state of expand or collapse alternative rows + + + ' Load data for each record and table UI control. + ' Ordering is important because child controls get + ' their parent ids from their parent UI controls. + + + ' this method calls the set method for controls with special formula like running total, sum, rank, etc + SetFormulaControls() + End Sub + + Public Overridable Sub SetFormulaControls() + ' this method calls Set methods for the control that has special formula + + + + End Sub + + + Public Sub PreFetchForeignKeyValues() + If (IsNothing(Me.DataSource)) + Return + End If + + Me.Page.PregetDfkaRecords(PersonalInsigniaTable.InsigniaId, Me.DataSource) + + Me.Page.PregetDfkaRecords(PersonalInsigniaTable.PersonalId, Me.DataSource) + + End Sub + + + Public Overridable Sub RegisterPostback() + + Me.Page.RegisterPostBackTrigger(MiscUtils.FindControlRecursively(Me,"PersonalInsigniaSaveButton")) + + + End Sub + + Public EvaluateFormulaDelegate As BaseClasses.Data.DataSource.EvaluateFormulaDelegate = New BaseClasses.Data.DataSource.EvaluateFormulaDelegate(AddressOf Me.EvaluateFormula) + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean, ByVal e as FormulaEvaluator) As String + If e Is Nothing + e = New FormulaEvaluator() + End If + + e.Variables.Clear() + + + ' add variables for formula evaluation + If variables IsNot Nothing Then + Dim enumerator As System.Collections.Generic.IEnumerator(Of System.Collections.Generic.KeyValuePair(Of String, Object)) = variables.GetEnumerator() + While enumerator.MoveNext() + e.Variables.Add(enumerator.Current.Key, enumerator.Current.Value) + End While + End If + + If includeDS + + End If + + ' All variables referred to in the formula are expected to be + ' properties of the DataSource. For example, referring to + ' UnitPrice as a variable will refer to DataSource.UnitPrice + e.DataSource = dataSourceForEvaluate + + ' Define the calling control. This is used to add other + ' related table and record controls as variables. + e.CallingControl = Me + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + + If Not String.IsNullOrEmpty(format) AndAlso (String.IsNullOrEmpty(formula) OrElse formula.IndexOf("Format(") < 0) Then + Return FormulaUtils.Format(resultObj, format) + Else + Return resultObj.ToString() + End If + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format,variables ,includeDS, Nothing) + End Function + + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object)) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format, variables ,True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, format, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal e as FormulaEvaluator) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, variables, True, e) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal includeDS as Boolean) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, includeDS, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, True, Nothing) + End Function + + + + + Public Overridable Sub ResetControl() + + Me.CurrentSortOrder.Reset() + If (Me.InSession(Me, "Order_By")) Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + Me.CurrentSortOrder.Add(PersonalInsigniaTable.InsigniaDate, OrderByItem.OrderDir.Asc) + + End If + + Me.PageIndex = 0 + End Sub + + Protected Overridable Sub BindPaginationControls() + ' Setup the pagination controls. + + ' Bind the pagination labels. + + If DbUtils.GetCreatedRecords(Me.DataSource).Length > 0 Then + + Me.PersonalInsigniaPagination.CurrentPage.Text = (Me.PageIndex + 1).ToString() + Else + Me.PersonalInsigniaPagination.CurrentPage.Text = "0" + End If + Me.PersonalInsigniaPagination.PageSize.Text = Me.PageSize.ToString() + Me.PersonalInsigniaPagination.TotalItems.Text = Me.TotalRecords.ToString() + Me.PersonalInsigniaPagination.TotalPages.Text = Me.TotalPages.ToString() + + ' Bind the buttons for PersonalInsigniaTableControl pagination. + + Me.PersonalInsigniaPagination.FirstPage.Enabled = Not (Me.PageIndex = 0) + If Me._TotalPages < 0 Then ' if the total pages is not determined yet, enable last and next buttons + Me.PersonalInsigniaPagination.LastPage.Enabled = True + ElseIf Me._TotalPages = 0 ' if the total pages is determined and it is 0, enable last and next buttons + Me.PersonalInsigniaPagination.LastPage.Enabled = False + Else ' if the total pages is the last page, disable last and next buttons + Me.PersonalInsigniaPagination.LastPage.Enabled = Not (Me.PageIndex = Me.TotalPages - 1) + End If + + If Me._TotalPages < 0 Then ' if the total pages is not determined yet, enable last and next buttons + Me.PersonalInsigniaPagination.NextPage.Enabled = True + ElseIf Me._TotalPages = 0 ' if the total pages is determined and it is 0, enable last and next buttons + Me.PersonalInsigniaPagination.NextPage.Enabled = False + Else ' if the total pages is the last page, disable last and next buttons + Me.PersonalInsigniaPagination.NextPage.Enabled = Not (Me.PageIndex = Me.TotalPages - 1) + End If + + Me.PersonalInsigniaPagination.PreviousPage.Enabled = Not (Me.PageIndex = 0) + + + End Sub + + Public Overridable Sub SaveData() + ' Save the data from the entire table. Calls each row's Save Data + ' to save their data. This function is called by the Click handler of the + ' Save button. The button handler should Start/Commit/End a transaction. + + Dim recCtl As PersonalInsigniaTableControlRow + For Each recCtl In Me.GetRecordControls() + + If Me.InDeletedRecordIds(recCtl) Then + ' Delete any pending deletes. + recCtl.Delete() + Else + If recCtl.Visible Then + recCtl.SaveData() + End If + End If + + Next + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + ' Set IsNewRecord to False for all records - since everything has been saved and is no longer "new" + For Each recCtl In Me.GetRecordControls() + recCtl.IsNewRecord = False + Next + + + ' Set DeletedRecordsIds to Nothing since we have deleted all pending deletes. + Me.DeletedRecordIds = Nothing + + End Sub + + Public Overridable Function CreateCompoundJoinFilter() As CompoundFilter + Dim jFilter As CompoundFilter = New CompoundFilter() + + Return jFilter + + End Function + + + Public Overridable Function CreateOrderBy() As OrderBy + ' The CurrentSortOrder is initialized to the sort order on the + ' Query Wizard. It may be modified by the Click handler for any of + ' the column heading to sort or reverse sort by that column. + ' You can add your own sort order, or modify it on the Query Wizard. + Return Me.CurrentSortOrder + End Function + + Public Overridable Function CreateWhereClause() As WhereClause + 'This CreateWhereClause is used for loading the data. + PersonalInsigniaTable.Instance.InnerFilter = Nothing + Dim wc As WhereClause = New WhereClause() + + ' Compose the WHERE clause consiting of: + ' 1. Static clause defined at design time. + ' 2. User selected search criteria. + ' 3. User selected filter criteria. + + + ' Get the static clause defined at design time on the Table Panel Wizard + Dim qc As WhereClause = Me.CreateQueryClause() + If Not(IsNothing(qc)) Then + wc.iAND(qc) + End If + + Return wc + End Function + + + Public Overridable Function CreateWhereClause(ByVal searchText as String, ByVal fromSearchControl as String, ByVal AutoTypeAheadSearch as String, ByVal AutoTypeAheadWordSeparators as String) As WhereClause + ' This CreateWhereClause is used for loading list of suggestions for Auto Type-Ahead feature. + PersonalInsigniaTable.Instance.InnerFilter = Nothing + Dim wc As WhereClause = New WhereClause() + + ' Compose the WHERE clause consiting of: + ' 1. Static clause defined at design time. + ' 2. User selected search criteria. + ' 3. User selected filter criteria. + + Dim appRelativeVirtualPath As String = CType(HttpContext.Current.Session("AppRelativeVirtualPath"), String) + + ' Get the static clause defined at design time on the Table Panel Wizard + Dim qc As WhereClause = Me.CreateQueryClause() + If Not(IsNothing(qc)) Then + wc.iAND(qc) + End If + + ' Adds clauses if values are selected in Filter controls which are configured in the page. + + + Return wc + End Function + + Protected Overridable Function CreateQueryClause() As WhereClause + ' Create a where clause for the Static clause defined at design time. + Dim filter As CompoundFilter = New CompoundFilter(CompoundFilter.CompoundingOperators.And_Operator, Nothing) + Dim whereClause As WhereClause = New WhereClause() + + filter.AddFilter(New BaseClasses.Data.SignedInUserFilter(BaseClasses.Data.BaseTable.CreateInstance("Persons.Business.PersonalInsigniaTable, App_Code").TableDefinition.ColumnList.GetByUniqueName("PersonalInsignia_.PersonalId"), New BaseClasses.Data.IdentifierAliasInfo("PersonalInsignia_", Nothing), BaseClasses.Data.BaseFilter.ComparisonOperator.EqualsTo, False)) + + whereClause.AddFilter(filter, CompoundFilter.CompoundingOperators.And_Operator) + + Return whereClause + + End Function + + + Public Overridable Function FormatSuggestions(ByVal prefixText As String, ByVal resultItem As String, _ + ByVal columnLength As Integer, ByVal AutoTypeAheadDisplayFoundText As String, _ + ByVal autoTypeAheadSearch As String, ByVal AutoTypeAheadWordSeparators As String, _ + ByVal resultList As ArrayList) As Boolean + + 'Formats the resultItem and adds it to the list of suggestions. + Dim index As Integer = resultItem.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture).IndexOf(prefixText.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture)) + Dim itemToAdd As String = "" + Dim isFound As Boolean = False + Dim isAdded As Boolean = False + ' Get the index where prfixt is at the beginning of resultItem. If not found then, index of word which begins with prefixText. + If InvariantLCase(autoTypeAheadSearch).equals("wordsstartingwithsearchstring") And Not index = 0 Then + ' Expression to find word which contains AutoTypeAheadWordSeparators followed by prefixText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex( AutoTypeAheadWordSeparators + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + If regex1.IsMatch(resultItem) Then + index = regex1.Match(resultItem).Index + isFound = True + End If + ' If the prefixText is found immediatly after white space then starting of the word is found so don not search any further + If not resultItem(index).ToString() = " " Then + ' Expression to find beginning of the word which contains AutoTypeAheadWordSeparators followed by prefixText + Dim regex As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\\S*" + AutoTypeAheadWordSeparators + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + If regex.IsMatch(resultItem) Then + index = regex.Match(resultItem).Index + isFound = True + End If + End If + End If + + ' If autoTypeAheadSearch value is wordsstartingwithsearchstring then, extract the substring only if the prefixText is found at the + ' beginning of the resultItem (index = 0) or a word in resultItem is found starts with prefixText. + If index = 0 Or isFound Or InvariantLCase(autoTypeAheadSearch).Equals("anywhereinstring") then + If InvariantLCase(AutoTypeAheadDisplayFoundText).equals("atbeginningofmatchedstring") Then + ' Expression to find beginning of the word which contains prefixText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\\S*" + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + ' Find the beginning of the word which contains prefexText + If (StringUtils.InvariantLCase(autoTypeAheadSearch).Equals("anywhereinstring") AndAlso regex1.IsMatch(resultItem)) Then + index = regex1.Match(resultItem).Index + isFound = True + End If + ' Display string from the index till end of the string if sub string from index till end is less than columnLength value. + If Len(resultItem) - index <= columnLength Then + If index = 0 Then + itemToAdd = resultItem + Else + itemToAdd = "..." & resultItem.Substring(index, Len(resultItem) - index) + End If + Else + If index = 0 Then + itemToAdd = resultItem.Substring(index, (columnLength - 3)) & "..." + Else + 'Truncate the string to show only columnLength - 6 characters as begining and trailing "..." has to be appended. + itemToAdd = "..." & resultItem.Substring(index , columnLength - 6) & "..." + End If + End If + ElseIf InvariantLCase(AutoTypeAheadDisplayFoundText).equals("inmiddleofmatchedstring") Then + Dim subStringBeginIndex As Integer = CType(columnLength/2, Integer) + If Len(resultItem) <= columnLength Then + itemToAdd = resultItem + Else + ' Sanity check at end of the string + If index + Len(prefixText) = columnLength Then + itemToAdd = "..." & resultItem.Substring(index-columnLength,index) + ElseIf Len(resultItem) - index < subStringBeginIndex Then + ' Display string from the end till columnLength value if, index is closer to the end of the string. + itemToAdd = "..." & resultItem.Substring(Len(resultItem)-columnLength,Len(resultItem)) + ElseIf index <= subStringBeginIndex Then + ' Sanity chet at beginning of the string + itemToAdd = resultItem.Substring(0, columnLength) & "..." + Else + ' Display string containing text before the prefixText occures and text after the prefixText + itemToAdd = "..." & resultItem.Substring(index - subStringBeginIndex, columnLength) & "..." + End If + End If + ElseIf InvariantLCase(AutoTypeAheadDisplayFoundText).equals("atendofmatchedstring") Then + ' Expression to find ending of the word which contains prefexText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\s", System.Text.RegularExpressions.RegexOptions.IgnoreCase) + ' Find the ending of the word which contains prefexText + If regex1.IsMatch(resultItem, index + 1) Then + index = regex1.Match(resultItem, index + 1).Index + Else + ' If the word which contains prefexText is the last word in string, regex1.IsMatch returns false. + index = resultItem.Length + End If + If index > Len(resultItem) Then + index = Len(resultItem) + End If + ' If text from beginning of the string till index is less than columnLength value then, display string from the beginning till index. + If index <= columnLength Then + if index = Len(resultItem) Then 'Make decision to append "..." + itemToAdd = resultItem.Substring(0,index) + Else + itemToAdd = resultItem.Substring(0,index) & "..." + End If + Else + If index = Len(resultItem) Then + itemToAdd = "..." & resultItem.Substring(index - (columnLength - 3), (columnLength - 3)) + Else + 'Truncate the string to show only columnLength - 6 characters as begining and trailing "..." has to be appended. + itemToAdd = "..." & resultItem.Substring(index - (columnLength - 6), columnLength - 6) & "..." + End If + End If + End If + + ' Remove newline character from itemToAdd + Dim prefixTextIndex As Integer = itemToAdd.IndexOf(prefixText, StringComparison.CurrentCultureIgnoreCase) + ' If itemToAdd contains any newline after the search text then show text only till newline + Dim regex2 As System.Text.RegularExpressions.Regex = New System.Text.RegularExpressions.Regex("(" & vbCrLf & "|" & vbLf & ")", System.Text.RegularExpressions.RegexOptions.IgnoreCase) + Dim newLineIndexAfterPrefix As Integer = -1 + If regex2.IsMatch(itemToAdd, prefixTextIndex) Then + newLineIndexAfterPrefix = regex2.Match(itemToAdd, prefixTextIndex).Index + End If + If (newLineIndexAfterPrefix > -1) Then + If itemToAdd.EndsWith("...") Then + itemToAdd = (itemToAdd.Substring(0, newLineIndexAfterPrefix) + "...") + Else + itemToAdd = itemToAdd.Substring(0, newLineIndexAfterPrefix) + End If + End If + ' If itemToAdd contains any newline before search text then show text which comes after newline + Dim regex3 As System.Text.RegularExpressions.Regex = New System.Text.RegularExpressions.Regex("(" & vbCrLf & "|" & vbLf & ")", (System.Text.RegularExpressions.RegexOptions.IgnoreCase Or System.Text.RegularExpressions.RegexOptions.RightToLeft)) + Dim newLineIndexBeforePrefix As Integer = -1 + If regex3.IsMatch(itemToAdd, prefixTextIndex) Then + newLineIndexBeforePrefix = regex3.Match(itemToAdd, prefixTextIndex).Index + End If + If (newLineIndexBeforePrefix > -1) Then + If itemToAdd.StartsWith("...") Then + itemToAdd = ("..." + itemToAdd.Substring((newLineIndexBeforePrefix + regex3.Match(itemToAdd, prefixTextIndex).Length))) + Else + itemToAdd = itemToAdd.Substring((newLineIndexBeforePrefix + regex3.Match(itemToAdd, prefixTextIndex).Length)) + End If + End If + + If Not itemToAdd is nothing AndAlso Not resultList.Contains(itemToAdd) Then + + resultList.Add(itemToAdd) + + isAdded = true + End If + End If + Return isAdded + End Function + + + Protected Overridable Sub GetPageSize() + + If Me.PersonalInsigniaPagination.PageSize.Text.Trim <> "" Then + Try + 'Me.PageSize = Integer.Parse(Me.PersonalInsigniaPagination.PageSize.Text) + Catch ex As Exception + End Try + End If + End Sub + + Protected Overridable Sub AddNewRecords() + + Dim newRecordList As ArrayList = New ArrayList() + + Dim newUIDataList As System.Collections.Generic.List(Of Hashtable) = New System.Collections.Generic.List(Of Hashtable)() + + ' Loop though all the record controls and if the record control + ' does not have a unique record id set, then create a record + ' and add to the list. + If Not Me.ResetData Then + Dim rep As System.Web.UI.WebControls.Repeater = CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalInsigniaTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return + + Dim repItem As System.Web.UI.WebControls.RepeaterItem + For Each repItem In rep.Items + ' Loop through all rows in the table, set its DataSource and call DataBind(). + + Dim recControl As PersonalInsigniaTableControlRow = DirectCast(repItem.FindControl("PersonalInsigniaTableControlRow"), PersonalInsigniaTableControlRow) + + If recControl.Visible AndAlso recControl.IsNewRecord() Then + + Dim rec As PersonalInsigniaRecord = New PersonalInsigniaRecord() + + If recControl.GazetteDate.Text <> "" Then + rec.Parse(recControl.GazetteDate.Text, PersonalInsigniaTable.GazetteDate) + End If + If recControl.GazetteNO.Text <> "" Then + rec.Parse(recControl.GazetteNO.Text, PersonalInsigniaTable.GazetteNO) + End If + If recControl.GazettePage.Text <> "" Then + rec.Parse(recControl.GazettePage.Text, PersonalInsigniaTable.GazettePage) + End If + If recControl.GazetteSection.Text <> "" Then + rec.Parse(recControl.GazetteSection.Text, PersonalInsigniaTable.GazetteSection) + End If + If recControl.InsigniaDate.Text <> "" Then + rec.Parse(recControl.InsigniaDate.Text, PersonalInsigniaTable.InsigniaDate) + End If + If MiscUtils.IsValueSelected(recControl.InsigniaId) Then + rec.Parse(recControl.InsigniaId.SelectedItem.Value, PersonalInsigniaTable.InsigniaId) + End If + If recControl.InsigniaReturn.Text <> "" Then + rec.Parse(recControl.InsigniaReturn.Text, PersonalInsigniaTable.InsigniaReturn) + End If + If MiscUtils.IsValueSelected(recControl.PersonalId) Then + rec.Parse(recControl.PersonalId.SelectedItem.Value, PersonalInsigniaTable.PersonalId) + End If + newUIDataList.Add(recControl.PreservedUIData()) + newRecordList.Add(rec) + End If + Next + End If + + + ' Add any new record to the list. + Dim index As Integer = 0 + For index = 1 To Me.AddNewRecord + + newRecordList.Insert(0, New PersonalInsigniaRecord()) + newUIDataList.Insert(0, New Hashtable()) + + Next + Me.AddNewRecord = 0 + + ' Finally, add any new records to the DataSource. + If newRecordList.Count > 0 Then + + Dim finalList As ArrayList = New ArrayList(Me.DataSource) + finalList.InsertRange(0, newRecordList) + + Me.DataSource = DirectCast(finalList.ToArray(GetType(PersonalInsigniaRecord)), PersonalInsigniaRecord()) + + End If + + ' Add the existing UI data to this hash table + If newUIDataList.Count > 0 Then + Me.UIData.InsertRange(0, newUIDataList) + End If + + End Sub + + + Public Sub AddToDeletedRecordIds(ByVal rec As PersonalInsigniaTableControlRow) + If rec.IsNewRecord() Then + Return + End If + + If Not Me.DeletedRecordIds Is Nothing AndAlso Me.DeletedRecordIds.Trim <> "" Then + Me.DeletedRecordIds &= "," + End If + + Me.DeletedRecordIds &= "[" & rec.RecordUniqueId & "]" + End Sub + + Protected Overridable Function InDeletedRecordIds(ByVal rec As PersonalInsigniaTableControlRow) As Boolean + If Me.DeletedRecordIds Is Nothing OrElse Me.DeletedRecordIds.Trim = "" Then + Return False + End If + + Return Me.DeletedRecordIds.IndexOf("[" & rec.RecordUniqueId & "]") >= 0 + End Function + + Private _DeletedRecordIds As String + Public Property DeletedRecordIds() As String + Get + Return Me._DeletedRecordIds + End Get + Set(ByVal value As String) + Me._DeletedRecordIds = value + End Set + End Property + + + ' Create Set, WhereClause, and Populate Methods + + Public Overridable Sub SetGazetteDateLabel() + + End Sub + + Public Overridable Sub SetGazetteNOLabel() + + End Sub + + Public Overridable Sub SetGazettePageLabel() + + End Sub + + Public Overridable Sub SetGazetteSectionLabel() + + End Sub + + Public Overridable Sub SetInsigniaDateLabel() + + End Sub + + Public Overridable Sub SetInsigniaIdLabel1() + + End Sub + + Public Overridable Sub SetInsigniaReturnLabel() + + End Sub + + Public Overridable Sub SetPersonalInsigniaTableControlCollapsibleRegion() + + End Sub + + Public Overridable Sub SetPersonalInsigniaTableControlIcon() + + End Sub + + Public Overridable Sub SetPersonalInsigniaTableControlPanelExtender() + + 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. + Dim added As Boolean = Me.AddNewRecord > 0 + Me.LoadData() + Me.DataBind() + + If added Then + Me.SetFocusToAddedRow() + End If + + End If + + + + Catch ex As Exception + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + Finally + DbUtils.EndTransaction + End Try + End Sub + + 'this function sets focus to the first editable element in the new added row in the editable table + Protected Overridable Sub SetFocusToAddedRow() + Dim rep As System.Web.UI.WebControls.Repeater = CType(Me.FindControl("PersonalInsigniaTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing OrElse rep.Items.Count = 0 Then Return + Dim repItem As System.Web.UI.WebControls.RepeaterItem + For Each repItem In rep.Items + 'Load scripts to table rows + Me.Page.LoadFocusScripts(repItem) + Dim recControl As PersonalInsigniaTableControlRow = DirectCast(repItem.FindControl("PersonalInsigniaTableControlRow"), PersonalInsigniaTableControlRow) + If recControl.IsNewRecord Then + For Each field As Control In recControl.Controls + If field.Visible AndAlso Me.Page.IsControlEditable(field, False) Then + 'set focus on the first editable field in the new row + field.Focus() + Dim updPan As UpdatePanel = DirectCast(Me.Page.FindControlRecursively("UpdatePanel1"), UpdatePanel) + If Not updPan Is Nothing Then updPan.Update() + Return + End If + Next + Return + End If + Next + End Sub + + + Protected Overrides Sub SaveControlsToSession() + MyBase.SaveControlsToSession() + + ' Save filter controls to values to session. + + + 'Save pagination state to session. + + + + ' Save table control properties to the session. + If Not Me.CurrentSortOrder Is Nothing Then + Me.SaveToSession(Me, "Order_By", Me.CurrentSortOrder.ToXmlString()) + End If + + Me.SaveToSession(Me, "Page_Index", Me.PageIndex.ToString()) + Me.SaveToSession(Me, "Page_Size", Me.PageSize.ToString()) + + Me.SaveToSession(Me, "DeletedRecordIds", Me.DeletedRecordIds) + + End Sub + + Protected Sub SaveControlsToSession_Ajax() + ' Save filter controls to values to session. + + HttpContext.Current.Session("AppRelativeVirtualPath") = Me.Page.AppRelativeVirtualPath + + End Sub + + Protected Overrides Sub ClearControlsFromSession() + MyBase.ClearControlsFromSession() + + ' Clear filter controls values from the session. + + + ' Clear pagination state from session. + + + + ' Clear table properties from the session. + Me.RemoveFromSession(Me, "Order_By") + Me.RemoveFromSession(Me, "Page_Index") + Me.RemoveFromSession(Me, "Page_Size") + + Me.RemoveFromSession(Me, "DeletedRecordIds") + + End Sub + + Protected Overrides Sub LoadViewState(ByVal savedState As Object) + MyBase.LoadViewState(savedState) + + Dim orderByStr As String = CType(ViewState("PersonalInsigniaTableControl_OrderBy"), String) + + If orderByStr IsNot Nothing AndAlso orderByStr.Trim <> "" Then + Me.CurrentSortOrder = BaseClasses.Data.OrderBy.FromXmlString(orderByStr) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + End If + + Dim pageIndex As String = CType(ViewState("Page_Index"), String) + If pageIndex IsNot Nothing Then + Me.PageIndex = CInt(pageIndex) + End If + + Dim pageSize As String = CType(ViewState("Page_Size"), String) + If Not pageSize Is Nothing Then + Me.PageSize = CInt(pageSize) + End If + + + + ' Load view state for pagination control. + + Me.DeletedRecordIds = CType(Me.ViewState("DeletedRecordIds"), String) + + End Sub + + Protected Overrides Function SaveViewState() As Object + + If Me.CurrentSortOrder IsNot Nothing Then + Me.ViewState("PersonalInsigniaTableControl_OrderBy") = Me.CurrentSortOrder.ToXmlString() + End If + + Me.ViewState("Page_Index") = Me.PageIndex + Me.ViewState("Page_Size") = Me.PageSize + + Me.ViewState("DeletedRecordIds") = Me.DeletedRecordIds + + + ' Load view state for pagination control. + + + Return MyBase.SaveViewState() + End Function + + ' Generate the event handling functions for pagination events. + + ' event handler for ImageButton + Public Overridable Sub PersonalInsigniaPagination_FirstPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.PageIndex = 0 + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalInsigniaPagination_LastPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.DisplayLastPage = True + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalInsigniaPagination_NextPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.PageIndex += 1 + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for LinkButton + Public Overridable Sub PersonalInsigniaPagination_PageSizeButton_Click(ByVal sender As Object, ByVal args As EventArgs) + + Try + + Me.DataChanged = True + + Me.PageSize = Integer.Parse(Me.PersonalInsigniaPagination.PageSize.Text) + + Me.PageIndex = Integer.Parse(Me.PersonalInsigniaPagination.CurrentPage.Text) - 1 + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalInsigniaPagination_PreviousPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + If Me.PageIndex > 0 Then + Me.PageIndex -= 1 + Me.DataChanged = True + End If + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + + ' Generate the event handling functions for sorting events. + + Public Overridable Sub GazetteDateLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by GazetteDate when clicked. + + ' Get previous sorting state for GazetteDate. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalInsigniaTable.GazetteDate) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for GazetteDate. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalInsigniaTable.GazetteDate, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by GazetteDate, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub GazetteNOLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by GazetteNO when clicked. + + ' Get previous sorting state for GazetteNO. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalInsigniaTable.GazetteNO) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for GazetteNO. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalInsigniaTable.GazetteNO, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by GazetteNO, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub GazettePageLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by GazettePage when clicked. + + ' Get previous sorting state for GazettePage. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalInsigniaTable.GazettePage) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for GazettePage. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalInsigniaTable.GazettePage, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by GazettePage, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub GazetteSectionLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by GazetteSection when clicked. + + ' Get previous sorting state for GazetteSection. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalInsigniaTable.GazetteSection) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for GazetteSection. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalInsigniaTable.GazetteSection, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by GazetteSection, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub InsigniaDateLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by InsigniaDate when clicked. + + ' Get previous sorting state for InsigniaDate. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalInsigniaTable.InsigniaDate) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for InsigniaDate. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalInsigniaTable.InsigniaDate, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by InsigniaDate, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub InsigniaIdLabel1_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by InsigniaId when clicked. + + ' Get previous sorting state for InsigniaId. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalInsigniaTable.InsigniaId) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for InsigniaId. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalInsigniaTable.InsigniaId, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by InsigniaId, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub InsigniaReturnLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by InsigniaReturn when clicked. + + ' Get previous sorting state for InsigniaReturn. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalInsigniaTable.InsigniaReturn) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for InsigniaReturn. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalInsigniaTable.InsigniaReturn, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by InsigniaReturn, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + + ' Generate the event handling functions for button events. + + ' event handler for ImageButton + Public Overridable Sub PersonalInsigniaAddButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + Me.AddNewRecord = 1 + Me.DataChanged = True + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalInsigniaDeleteButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + If(Not Me.Page.IsPageRefresh) Then + + Me.DeleteSelectedRecords(True) + Me.SetFormulaControls() + + + End If + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalInsigniaEditButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + ' The redirect URL is set on the Properties, Custom Properties or Actions. + ' The ModifyRedirectURL call resolves the parameters before the + ' Response.Redirect redirects the page to the URL. + ' Any code after the Response.Redirect call will not be executed, since the page is + ' redirected to the URL. + + + Dim url As String = "../Shared/ConfigureEditRecord.aspx" + + Dim shouldRedirect As Boolean = True + Dim TargetKey As String = Nothing + Dim DFKA As String = TargetKey + Dim id As String = DFKA + Dim value As String = id + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + url = Me.ModifyRedirectUrl(url, "",False) + url = Me.Page.ModifyRedirectUrl(url, "",False) + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + shouldRedirect = False + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + If shouldRedirect Then + Me.Page.ShouldSaveControlsToSession = True + Me.Page.Response.Redirect(url) + ElseIf Not TargetKey Is Nothing AndAlso _ + Not shouldRedirect Then + Me.Page.ShouldSaveControlsToSession = True + Me.Page.CloseWindow(True) + + End If + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalInsigniaRefreshButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Dim PersonalInsigniaTableControlObj as PersonalInsigniaTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalInsigniaTableControl"), PersonalInsigniaTableControl) + PersonalInsigniaTableControlObj.ResetData = True + + PersonalInsigniaTableControlObj.RemoveFromSession(PersonalInsigniaTableControlObj, "DeletedRecordIds") + PersonalInsigniaTableControlObj.DeletedRecordIds = Nothing + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalInsigniaResetButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.CurrentSortOrder.Reset() + If Me.InSession(Me, "Order_By") Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + Me.CurrentSortOrder.Add(PersonalInsigniaTable.InsigniaDate, OrderByItem.OrderDir.Asc) + + + End If + + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalInsigniaSaveButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + + If (Not Me.Page.IsPageRefresh) Then + Me.SaveData() + End If + + Me.Page.CommitTransaction(sender) + ' Set IsNewRecord to False for all records - since everything has been saved and is no longer "new" + Dim recCtl As PersonalInsigniaTableControlRow + For Each recCtl in Me.GetRecordControls() + + recCtl.IsNewRecord = False + Next + + + ' Set DeletedRecordsIds to Nothing since we have deleted all pending deletes. + + Me.DeletedRecordIds = Nothing + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + + + ' Generate the event handling functions for filter and search events. + + + ' Generate the event handling functions for others + + + Private _UIData As New System.Collections.Generic.List(Of Hashtable) + Public Property UIData() As System.Collections.Generic.List(Of Hashtable) + Get + Return Me._UIData + End Get + Set(ByVal value As System.Collections.Generic.List(Of Hashtable)) + Me._UIData = value + End Set + End Property + + ' pagination properties + Protected _PageSize As Integer + Public Property PageSize() As Integer + Get + Return Me._PageSize + End Get + Set(ByVal value As Integer) + Me._PageSize = value + End Set + End Property + + Protected _PageIndex As Integer + Public Property PageIndex() As Integer + Get + ' Return the PageIndex + Return Me._PageIndex + End Get + Set(ByVal value As Integer) + Me._PageIndex = value + End Set + End Property + + Protected _TotalRecords As Integer = -1 + Public Property TotalRecords() As Integer + Get + If _TotalRecords < 0 + _TotalRecords = PersonalInsigniaTable.GetRecordCount(CreateCompoundJoinFilter(), CreateWhereClause()) + End If + Return Me._TotalRecords + End Get + Set(ByVal value As Integer) + If Me.PageSize > 0 Then + + Me.TotalPages = CInt(Math.Ceiling(value / Me.PageSize)) + + End If + Me._TotalRecords = value + End Set + End Property + + + + Protected _TotalPages As Integer = -1 + Public Property TotalPages() As Integer + Get + If _TotalPages < 0 Then + + Me.TotalPages = CInt(Math.Ceiling(TotalRecords / Me.PageSize)) + + End If + Return Me._TotalPages + End Get + Set(ByVal value As Integer) + Me._TotalPages = value + End Set + End Property + + Protected _DisplayLastPage As Boolean + Public Property DisplayLastPage() As Boolean + Get + Return Me._DisplayLastPage + End Get + Set(ByVal value As Boolean) + Me._DisplayLastPage = value + End Set + End Property + + Private _DataChanged As Boolean = False + Public Property DataChanged() As Boolean + Get + Return Me._DataChanged + End Get + Set(ByVal value As Boolean) + Me._DataChanged = value + End Set + End Property + + Private _ResetData As Boolean = False + Public Property ResetData() As Boolean + Get + Return Me._ResetData + End Get + Set(ByVal value As Boolean) + Me._ResetData = value + End Set + End Property + + Private _AddNewRecord As Integer = 0 + Public Property AddNewRecord() As Integer + Get + Return Me._AddNewRecord + End Get + Set(ByVal value As Integer) + Me._AddNewRecord = value + End Set + End Property + + + Private _CurrentSortOrder As OrderBy = Nothing + Public Property CurrentSortOrder() As OrderBy + Get + Return Me._CurrentSortOrder + End Get + Set(ByVal value As BaseClasses.Data.OrderBy) + Me._CurrentSortOrder = value + End Set + End Property + + Private _DataSource() As PersonalInsigniaRecord = Nothing + Public Property DataSource() As PersonalInsigniaRecord () + Get + Return Me._DataSource + End Get + Set(ByVal value() As PersonalInsigniaRecord) + Me._DataSource = value + End Set + End Property + +#Region "Helper Properties" + + Public ReadOnly Property GazetteDateLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "GazetteDateLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property GazetteNOLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "GazetteNOLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property GazettePageLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "GazettePageLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property GazetteSectionLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "GazetteSectionLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property InsigniaDateLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "InsigniaDateLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property InsigniaIdLabel1() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "InsigniaIdLabel1"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property InsigniaReturnLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "InsigniaReturnLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property PersonalInsigniaAddButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalInsigniaAddButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalInsigniaDeleteButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalInsigniaDeleteButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalInsigniaEditButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalInsigniaEditButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalInsigniaPagination() As Persons.UI.IPagination + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalInsigniaPagination"), Persons.UI.IPagination) + End Get + End Property + + Public ReadOnly Property PersonalInsigniaRefreshButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalInsigniaRefreshButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalInsigniaResetButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalInsigniaResetButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalInsigniaSaveButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalInsigniaSaveButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalInsigniaTableControlCollapsibleRegion() As System.Web.UI.WebControls.Panel + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalInsigniaTableControlCollapsibleRegion"), System.Web.UI.WebControls.Panel) + End Get + End Property + + Public ReadOnly Property PersonalInsigniaTableControlIcon() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalInsigniaTableControlIcon"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalInsigniaTableControlPanelExtender() As AjaxControlToolkit.CollapsiblePanelExtender + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalInsigniaTableControlPanelExtender"), AjaxControlToolkit.CollapsiblePanelExtender) + End Get + End Property + + Public ReadOnly Property PersonalInsigniaTitle() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalInsigniaTitle"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property PersonalInsigniaToggleAll() As System.Web.UI.WebControls.CheckBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalInsigniaToggleAll"), System.Web.UI.WebControls.CheckBox) + End Get + End Property + +#End Region + +#Region "Helper Functions" + + Public Overrides Overloads Function ModifyRedirectUrl(url As String, arg As String, ByVal bEncrypt As Boolean) As String + Return Me.Page.EvaluateExpressions(url, arg, bEncrypt, Me) + End Function + + Public Overrides Overloads Function EvaluateExpressions(url As String, arg As String, ByVal bEncrypt As Boolean) As String + Dim needToProcess As Boolean = AreAnyUrlParametersForMe(url, arg) + If (needToProcess) Then + Dim recCtl As PersonalInsigniaTableControlRow = Me.GetSelectedRecordControl() + If recCtl Is Nothing AndAlso url.IndexOf("{") >= 0 Then + ' Localization. + Throw New Exception(Page.GetResourceValue("Err:NoRecSelected", "Persons")) + End If + Dim rec As PersonalInsigniaRecord = Nothing + If recCtl IsNot Nothing Then + rec = recCtl.GetRecord() + End If + Return EvaluateExpressions(url, arg, rec, bEncrypt) + End If + Return url + End Function + + Public Overridable Function GetSelectedRecordIndex() As Integer + Dim counter As Integer = 0 + Dim recControl As PersonalInsigniaTableControlRow + For Each recControl In Me.GetRecordControls() + If recControl.PersonalInsigniaRecordRowSelection.Checked Then + Return counter + End If + counter += 1 + Next + Return -1 + End Function + + Public Overridable Function GetSelectedRecordControl() As PersonalInsigniaTableControlRow + Dim selectedList() As PersonalInsigniaTableControlRow = Me.GetSelectedRecordControls() + If selectedList.Length = 0 Then + Return Nothing + End If + Return selectedList(0) + + End Function + + Public Overridable Function GetSelectedRecordControls() As PersonalInsigniaTableControlRow() + + Dim selectedList As ArrayList = New ArrayList(25) + Dim recControl As PersonalInsigniaTableControlRow + For Each recControl In Me.GetRecordControls() + If recControl.PersonalInsigniaRecordRowSelection IsNot Nothing AndAlso recControl.PersonalInsigniaRecordRowSelection.Checked Then + selectedList.Add(recControl) + End If + Next + Return DirectCast(selectedList.ToArray(GetType(PersonalInsigniaTableControlRow)), PersonalInsigniaTableControlRow()) + + End Function + + Public Overridable Sub DeleteSelectedRecords(ByVal deferDeletion As Boolean) + Dim recList() As PersonalInsigniaTableControlRow = Me.GetSelectedRecordControls() + If recList.Length = 0 Then + ' Localization. + Throw New Exception(Page.GetResourceValue("Err:NoRecSelected", "Persons")) + End If + + Dim recCtl As PersonalInsigniaTableControlRow + For Each recCtl In recList + If deferDeletion Then + If Not recCtl.IsNewRecord Then + + Me.AddToDeletedRecordIds(recCtl) + + End If + recCtl.Visible = False + + recCtl.PersonalInsigniaRecordRowSelection.Checked = False + + Else + + recCtl.Delete() + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + End If + Next + End Sub + + Public Function GetRecordControls() As PersonalInsigniaTableControlRow() + Dim recList As ArrayList = New ArrayList() + Dim rep As System.Web.UI.WebControls.Repeater = CType(Me.FindControl("PersonalInsigniaTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return Nothing + Dim repItem As System.Web.UI.WebControls.RepeaterItem + + For Each repItem In rep.Items + + Dim recControl As PersonalInsigniaTableControlRow = DirectCast(repItem.FindControl("PersonalInsigniaTableControlRow"), PersonalInsigniaTableControlRow) + recList.Add(recControl) + + Next + + Return DirectCast(recList.ToArray(GetType(PersonalInsigniaTableControlRow)), PersonalInsigniaTableControlRow()) + 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 + + \ No newline at end of file diff --git a/App_Code/PersonalLanguageSkill/EditPersonalLanguageSkillTable.Controls.vb b/App_Code/PersonalLanguageSkill/EditPersonalLanguageSkillTable.Controls.vb new file mode 100644 index 0000000..93b9f6e --- /dev/null +++ b/App_Code/PersonalLanguageSkill/EditPersonalLanguageSkillTable.Controls.vb @@ -0,0 +1,2835 @@ + +' This file implements the TableControl, TableControlRow, and RecordControl classes for the +' EditPersonalLanguageSkillTable.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.EditPersonalLanguageSkillTable + +#Region "Section 1: Place your customizations here." + + +Public Class PersonalLanguageSkillTableControlRow + Inherits BasePersonalLanguageSkillTableControlRow + ' The BasePersonalLanguageSkillTableControlRow implements code for a ROW within the + ' the PersonalLanguageSkillTableControl table. The BasePersonalLanguageSkillTableControlRow implements the DataBind and SaveData methods. + ' The loading of data is actually performed by the LoadData method in the base class of PersonalLanguageSkillTableControl. + + ' This is the ideal place to add your code customizations. For example, you can override the DataBind, + ' SaveData, GetUIData, and Validate methods. + Public Overrides Sub GetUIData() + + ' Call MyBase.GetUIData + MyBase.GetUIData() + + ' Get PersonalDD Record + Dim myRec As PersonalLanguageSkillRecord = Me.GetRecord + + ' Set PersonalId field value to new value string + myRec.PersonalId = Utils.SecurityControls.GetCurrentUserID + + End Sub + + +End Class + + + +Public Class PersonalLanguageSkillTableControl + Inherits BasePersonalLanguageSkillTableControl + + ' The BasePersonalLanguageSkillTableControl class implements the LoadData, DataBind, CreateWhereClause + ' and other methods to load and display the data in a table control. + + ' This is the ideal place to add your code customizations. You can override the LoadData and CreateWhereClause, + ' The PersonalLanguageSkillTableControlRow class offers another place where you can customize + ' the DataBind, GetUIData, SaveData and Validate methods specific to each row displayed on the table. + +End Class + + + +#End Region + + + +#Region "Section 2: Do not modify this section." + + +' Base class for the PersonalLanguageSkillTableControlRow control on the EditPersonalLanguageSkillTable page. +' Do not modify this class. Instead override any method in PersonalLanguageSkillTableControlRow. +Public Class BasePersonalLanguageSkillTableControlRow + Inherits Persons.UI.BaseApplicationRecordControl + + ' To customize, override this method in PersonalLanguageSkillTableControlRow. + Protected Overridable Sub Control_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Init + + Me.ClearControlsFromSession() + End Sub + + ' To customize, override this method in PersonalLanguageSkillTableControlRow. + Protected Overridable Sub Control_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load + + 'Call LoadFocusScripts from repeater so that onfocus attribute could be added to elements + Me.Page.LoadFocusScripts(Me) + + ' Show confirmation message on Click + Me.PersonalLanguageSkillRowDeleteButton.Attributes.Add("onClick", "return (confirm('" & (CType(Me.Page,BaseApplicationPage)).GetResourceValue("DeleteRecordConfirm", "Persons") & "'));") + + + ' Register the event handlers. + + AddHandler Me.PersonalLanguageSkillRowDeleteButton.Click, AddressOf PersonalLanguageSkillRowDeleteButton_Click + + AddHandler Me.LanguageId.SelectedIndexChanged, AddressOf LanguageId_SelectedIndexChanged + + AddHandler Me.PersonalId.SelectedIndexChanged, AddressOf PersonalId_SelectedIndexChanged + + AddHandler Me.Level.TextChanged, AddressOf Level_TextChanged + + + End Sub + + + Public Overridable Sub LoadData() + + ' Load the data from the database into the DataSource PersonalLanguageSkill 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 = PersonalLanguageSkillTable.GetRecord(Me.RecordUniqueId, True) + + Return + End If + + ' Since this is a row in the table, the data for this row is loaded by the + ' LoadData method of the BasePersonalLanguageSkillTableControl when the data for the entire + ' table is loaded. + + Me.DataSource = New PersonalLanguageSkillRecord() + + + + End Sub + + ' Populate the UI controls using the DataSource. To customize, override this method in PersonalLanguageSkillTableControlRow. + 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 + + SetLanguageId() + SetLevel() + SetPersonalId() + + + + + 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 SetLanguageId() + + ' If selection was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.LanguageId.ID) Then + If Me.PreviousUIData(Me.LanguageId.ID) Is Nothing + Me.PopulateLanguageIdDropDownList(Nothing, 100) + Else + Me.PopulateLanguageIdDropDownList(Me.PreviousUIData(Me.LanguageId.ID).ToString(), 100) + End If + Return + End If + + + ' Set the LanguageId DropDownList on the webpage with value from the + ' PersonalLanguageSkill database record. + + ' Me.DataSource is the PersonalLanguageSkill record retrieved from the database. + ' Me.LanguageId is the ASP:DropDownList on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetLanguageId() + ' and add your own code before or after the call to the MyBase function. + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.LanguageIdSpecified Then + + ' If the LanguageId is non-NULL, then format the value. + ' The Format method will return the Display Foreign Key As (DFKA) value + Me.PopulateLanguageIdDropDownList(Me.DataSource.LanguageId.ToString(), 100) + + Else + + ' LanguageId 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.PopulateLanguageIdDropDownList(Nothing, 100) + Else + Me.PopulateLanguageIdDropDownList(PersonalLanguageSkillTable.LanguageId.DefaultValue, 100) + End If + + End If + + End Sub + + Public Overridable Sub SetLevel() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.Level.ID) Then + + Me.Level.Text = Me.PreviousUIData(Me.Level.ID).ToString() + + Return + End If + + + ' Set the Level TextBox on the webpage with value from the + ' PersonalLanguageSkill database record. + + ' Me.DataSource is the PersonalLanguageSkill record retrieved from the database. + ' Me.Level is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetLevel() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.LevelSpecified Then + + ' If the Level is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalLanguageSkillTable.Level) + + Me.Level.Text = formattedValue + + Else + + ' Level is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.Level.Text = PersonalLanguageSkillTable.Level.Format(PersonalLanguageSkillTable.Level.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetPersonalId() + + ' If selection was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.PersonalId.ID) Then + If Me.PreviousUIData(Me.PersonalId.ID) Is Nothing + Me.PopulatePersonalIdDropDownList(Nothing, 100) + Else + Me.PopulatePersonalIdDropDownList(Me.PreviousUIData(Me.PersonalId.ID).ToString(), 100) + End If + Return + End If + + + ' Set the PersonalId DropDownList on the webpage with value from the + ' PersonalLanguageSkill database record. + + ' Me.DataSource is the PersonalLanguageSkill record retrieved from the database. + ' Me.PersonalId is the ASP:DropDownList on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetPersonalId() + ' and add your own code before or after the call to the MyBase function. + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.PersonalIdSpecified Then + + ' If the PersonalId is non-NULL, then format the value. + ' The Format method will return the Display Foreign Key As (DFKA) value + Me.PopulatePersonalIdDropDownList(Me.DataSource.PersonalId, 100) + + Else + + ' PersonalId 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.PopulatePersonalIdDropDownList(Nothing, 100) + Else + Me.PopulatePersonalIdDropDownList(PersonalLanguageSkillTable.PersonalId.DefaultValue, 100) + End If + + End If + + End Sub + + + Public EvaluateFormulaDelegate As BaseClasses.Data.DataSource.EvaluateFormulaDelegate = New BaseClasses.Data.DataSource.EvaluateFormulaDelegate(AddressOf Me.EvaluateFormula) + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean, ByVal e As FormulaEvaluator) As String + If e Is Nothing Then + e = New FormulaEvaluator() + End If + + e.Variables.Clear() + + + ' add variables for formula evaluation + If variables IsNot Nothing Then + Dim enumerator As System.Collections.Generic.IEnumerator(Of System.Collections.Generic.KeyValuePair(Of String, Object)) = variables.GetEnumerator() + While enumerator.MoveNext() + e.Variables.Add(enumerator.Current.Key, enumerator.Current.Value) + End While + End If + + If includeDS + + End IF + + + ' Other variables referred to in the formula are expected to be + ' properties of the DataSource. For example, referring to + ' UnitPrice as a variable will refer to DataSource.UnitPrice + If dataSourceForEvaluate Is Nothing Then + + e.DataSource = Me.DataSource + + Else + e.DataSource = dataSourceForEvaluate + End If + + ' Define the calling control. This is used to add other + ' related table and record controls as variables. + e.CallingControl = Me + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + + If Not String.IsNullOrEmpty(format) AndAlso (String.IsNullOrEmpty(formula) OrElse formula.IndexOf("Format(") < 0) Then + Return FormulaUtils.Format(resultObj, format) + Else + Return resultObj.ToString() + End If + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format,variables ,includeDS, Nothing) + End Function + + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object)) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format, variables ,True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, format, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal e as FormulaEvaluator) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, variables, True, e) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal includeDS as Boolean) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, includeDS, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, True, Nothing) + End Function + + + Public Overridable Sub RegisterPostback() + + + End Sub + + + + ' To customize, override this method in PersonalLanguageSkillTableControlRow. + Public Overridable Sub SaveData() + ' Saves the associated record in the database. + ' SaveData calls Validate and Get methods - so it may be more appropriate to + ' customize those methods. + + ' 1. Load the existing record from the database. Since we save the entire record, this ensures + ' that fields that are not displayed are also properly initialized. + Me.LoadData() + + + ' 2. Perform any custom validation. + Me.Validate() + + + ' 3. Set the values in the record with data from UI controls. + ' This calls the Get() method for each of the user interface controls. + Me.GetUIData() + + ' 4. Save in the database. + ' We should not save the record if the data did not change. This + ' will save a database hit and avoid triggering any database triggers. + + If Me.DataSource.IsAnyValueChanged Then + ' Save record to database but do not commit yet. + ' Auto generated ids are available after saving for use by child (dependent) records. + Me.DataSource.Save() + + DirectCast(GetParentControlObject(Me, "PersonalLanguageSkillTableControl"), PersonalLanguageSkillTableControl).DataChanged = True + DirectCast(GetParentControlObject(Me, "PersonalLanguageSkillTableControl"), PersonalLanguageSkillTableControl).ResetData = True + End If + + + ' update session or cookie by formula + + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + ' For Master-Detail relationships, save data on the Detail table(s) + + End Sub + + ' To customize, override this method in PersonalLanguageSkillTableControlRow. + 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. + + GetLanguageId() + GetLevel() + GetPersonalId() + End Sub + + + Public Overridable Sub GetLanguageId() + + ' Retrieve the value entered by the user on the LanguageId ASP:DropDownList, and + ' save it into the LanguageId field in DataSource PersonalLanguageSkill record. + + ' Custom validation should be performed in Validate, not here. + + Me.DataSource.Parse(GetValueSelectedPageRequest(Me.LanguageId), PersonalLanguageSkillTable.LanguageId) + + End Sub + + Public Overridable Sub GetLevel() + + ' Retrieve the value entered by the user on the Level ASP:TextBox, and + ' save it into the Level field in DataSource PersonalLanguageSkill record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.Level.Text, PersonalLanguageSkillTable.Level) + + + End Sub + + Public Overridable Sub GetPersonalId() + + ' Retrieve the value entered by the user on the PersonalId ASP:DropDownList, and + ' save it into the PersonalId field in DataSource PersonalLanguageSkill record. + + ' Custom validation should be performed in Validate, not here. + + Me.DataSource.Parse(GetValueSelectedPageRequest(Me.PersonalId), PersonalLanguageSkillTable.PersonalId) + + End Sub + + + ' To customize, override this method in PersonalLanguageSkillTableControlRow. + + Public Overridable Function CreateWhereClause() As WhereClause + + Return Nothing + + End Function + + + + ' To customize, override this method in PersonalLanguageSkillTableControlRow. + 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) + PersonalLanguageSkillTable.DeleteRecord(pkValue) + + DirectCast(GetParentControlObject(Me, "PersonalLanguageSkillTableControl"), PersonalLanguageSkillTableControl).DataChanged = True + DirectCast(GetParentControlObject(Me, "PersonalLanguageSkillTableControl"), PersonalLanguageSkillTableControl).ResetData = True + End Sub + + Protected Overridable Sub Control_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.PreRender + ' PreRender event is raised just before page is being displayed. + Try + DbUtils.StartTransaction() + Me.RegisterPostback() + + If Not Me.Page.ErrorOnPage AndAlso (Me.Page.IsPageRefresh OrElse Me.DataChanged OrElse Me.ResetData) Then + + + ' Re-load the data and update the web page if necessary. + ' This is typically done during a postback (filter, search button, sort, pagination button). + ' In each of the other click handlers, simply set DataChanged to True to reload the data. + Me.LoadData() + Me.DataBind() + End If + + + Catch ex As Exception + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + Finally + DbUtils.EndTransaction() + End Try + End Sub + + + Protected Overrides Sub SaveControlsToSession() + MyBase.SaveControlsToSession() + + + 'Save pagination state to session. + + End Sub + + + + Protected Overrides Sub ClearControlsFromSession() + MyBase.ClearControlsFromSession() + + + + ' Clear pagination state from session. + + End Sub + + Protected Overrides Sub LoadViewState(ByVal savedState As Object) + MyBase.LoadViewState(savedState) + Dim isNewRecord As String = CType(ViewState("IsNewRecord"), String) + If Not isNewRecord Is Nothing AndAlso isNewRecord.Trim <> "" Then + Me.IsNewRecord = Boolean.Parse(isNewRecord) + End If + + Dim myCheckSum As String = CType(ViewState("CheckSum"), String) + If Not myCheckSum Is Nothing AndAlso myCheckSum.Trim <> "" Then + Me.CheckSum = myCheckSum + End If + + + ' Load view state for pagination control. + + End Sub + + Protected Overrides Function SaveViewState() As Object + ViewState("IsNewRecord") = Me.IsNewRecord.ToString() + ViewState("CheckSum") = Me.CheckSum + + + ' Load view state for pagination control. + + Return MyBase.SaveViewState() + End Function + + + + Public Overridable Function CreateWhereClause_LanguageIdDropDownList() 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 Language table. + ' Examples: + ' wc.iAND(LanguageTable.Language0, BaseFilter.ComparisonOperator.EqualsTo, "XYZ") + ' wc.iAND(LanguageTable.Active, BaseFilter.ComparisonOperator.EqualsTo, "1") + + Dim wc As WhereClause = New WhereClause() + Return wc + + End Function + + + + Public Overridable Function CreateWhereClause_PersonalIdDropDownList() 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 PersonalId table. + ' Examples: + ' wc.iAND(PersonalIdTable.PersonalName, BaseFilter.ComparisonOperator.EqualsTo, "XYZ") + ' wc.iAND(PersonalIdTable.Active, BaseFilter.ComparisonOperator.EqualsTo, "1") + + Dim wc As WhereClause = New WhereClause() + Return wc + + End Function + + + ' Fill the LanguageId list. + Protected Overridable Sub PopulateLanguageIdDropDownList( _ + ByVal selectedValue As String, _ + ByVal maxItems As Integer) + + Me.LanguageId.Items.Clear() + + + ' 1. Setup the static list items + + ' Add the Please Select item. + Me.LanguageId.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_LanguageIdDropDownList function. + ' It is better to customize the where clause there. + + Dim wc As WhereClause = CreateWhereClause_LanguageIdDropDownList() + ' Create the ORDER BY clause to sort based on the displayed value. + + + Dim orderBy As OrderBy = New OrderBy(false, false) + orderBy.Add(LanguageTable.Language0, 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 LanguageRecord = 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 = LanguageTable.GetRecords(wc, orderBy, pageNum, maxItems) + For each itemValue As LanguageRecord In itemValues + ' Create the item and add to the list. + Dim cvalue As String = Nothing + Dim fvalue As String = Nothing + If itemValue.LanguageIdSpecified Then + cvalue = itemValue.LanguageId.ToString() + + If counter < maxItems AndAlso Me.LanguageId.Items.FindByValue(cvalue) Is Nothing Then + + Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalLanguageSkillTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalLanguageSkillTable.LanguageId) + If _isExpandableNonCompositeForeignKey AndAlso PersonalLanguageSkillTable.LanguageId.IsApplyDisplayAs Then + fvalue = PersonalLanguageSkillTable.GetDFKA(itemValue, PersonalLanguageSkillTable.LanguageId) + End If + If (Not _isExpandableNonCompositeForeignKey) Or (String.IsNullOrEmpty(fvalue)) Then + fvalue = itemValue.Format(LanguageTable.Language0) + 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.LanguageId.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.LanguageId.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.LanguageId, selectedValue) AndAlso _ + Not SetSelectedDisplayText(Me.LanguageId, selectedValue)Then + + ' construct a whereclause to query a record with Language.LanguageId = selectedValue + Dim filter2 As CompoundFilter = New CompoundFilter(CompoundFilter.CompoundingOperators.And_Operator, Nothing) + Dim whereClause2 As WhereClause = New WhereClause() + filter2.AddFilter(New BaseClasses.Data.ColumnValueFilter(LanguageTable.LanguageId, selectedValue, BaseClasses.Data.BaseFilter.ComparisonOperator.EqualsTo, False)) + whereClause2.AddFilter(filter2, CompoundFilter.CompoundingOperators.And_Operator) + + Try + ' Execute the query + Dim rc() As LanguageRecord = LanguageTable.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 LanguageRecord = DirectCast(rc(0), LanguageRecord) + ' Create the item and add to the list. + Dim cvalue As String = Nothing + Dim fvalue As String = Nothing + If itemValue.LanguageIdSpecified Then + cvalue = itemValue.LanguageId.ToString() + Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalLanguageSkillTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalLanguageSkillTable.LanguageId) + If _isExpandableNonCompositeForeignKey AndAlso PersonalLanguageSkillTable.LanguageId.IsApplyDisplayAs Then + fvalue = PersonalLanguageSkillTable.GetDFKA(itemValue, PersonalLanguageSkillTable.LanguageId) + End If + If (Not _isExpandableNonCompositeForeignKey) Or (String.IsNullOrEmpty(fvalue)) Then + fvalue = itemValue.Format(LanguageTable.Language0) + End If + + If fvalue Is Nothing OrElse fvalue.Trim() = "" Then fvalue = cvalue + Dim newItem As New ListItem(fvalue, cvalue) + Me.LanguageId.Items.Add(newItem) + SetSelectedValue(Me.LanguageId, selectedValue) + End If + End If + Catch + End Try + + End If + + + End Sub + + ' Fill the PersonalId list. + Protected Overridable Sub PopulatePersonalIdDropDownList( _ + ByVal selectedValue As String, _ + ByVal maxItems As Integer) + + Me.PersonalId.Items.Clear() + + + ' 1. Setup the static list items + + ' Add the Please Select item. + Me.PersonalId.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_PersonalIdDropDownList function. + ' It is better to customize the where clause there. + + Dim wc As WhereClause = CreateWhereClause_PersonalIdDropDownList() + ' Create the ORDER BY clause to sort based on the displayed value. + + + Dim orderBy As OrderBy = New OrderBy(false, false) + orderBy.Add(PersonalIdTable.PersonalName, OrderByItem.OrderDir.Asc) + + Dim variables As System.Collections.Generic.IDictionary(Of String, Object) = New System.Collections.Generic.Dictionary(Of String, Object) + + ' 3. Read a total of maxItems from the database and insert them + Dim itemValues() As PersonalIdRecord = 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 = PersonalIdTable.GetRecords(wc, orderBy, pageNum, maxItems) + For each itemValue As PersonalIdRecord In itemValues + ' Create the item and add to the list. + Dim cvalue As String = Nothing + Dim fvalue As String = Nothing + If itemValue.PersonalIdSpecified Then + cvalue = itemValue.PersonalId.ToString() + + If counter < maxItems AndAlso Me.PersonalId.Items.FindByValue(cvalue) Is Nothing Then + + Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalLanguageSkillTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalLanguageSkillTable.PersonalId) + If _isExpandableNonCompositeForeignKey AndAlso PersonalLanguageSkillTable.PersonalId.IsApplyDisplayAs Then + fvalue = PersonalLanguageSkillTable.GetDFKA(itemValue, PersonalLanguageSkillTable.PersonalId) + End If + If (Not _isExpandableNonCompositeForeignKey) Or (String.IsNullOrEmpty(fvalue)) Then + fvalue = itemValue.Format(PersonalIdTable.PersonalName) + End If + + If fvalue Is Nothing OrElse fvalue.Trim() = "" Then fvalue = cvalue + + If (IsNothing(fvalue)) Then + fvalue = "" + End If + + fvalue = fvalue.Trim() + + If ( fvalue.Length > 50 ) Then + fvalue = fvalue.Substring(0, 50) & "..." + End If + + Dim dupItem As ListItem = Me.PersonalId.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.PersonalId.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.PersonalId, selectedValue) AndAlso _ + Not SetSelectedDisplayText(Me.PersonalId, selectedValue)Then + + ' construct a whereclause to query a record with PersonalId.PersonalId = selectedValue + Dim filter2 As CompoundFilter = New CompoundFilter(CompoundFilter.CompoundingOperators.And_Operator, Nothing) + Dim whereClause2 As WhereClause = New WhereClause() + filter2.AddFilter(New BaseClasses.Data.ColumnValueFilter(PersonalIdTable.PersonalId, selectedValue, BaseClasses.Data.BaseFilter.ComparisonOperator.EqualsTo, False)) + whereClause2.AddFilter(filter2, CompoundFilter.CompoundingOperators.And_Operator) + + Try + ' Execute the query + Dim rc() As PersonalIdRecord = PersonalIdTable.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 PersonalIdRecord = DirectCast(rc(0), PersonalIdRecord) + ' Create the item and add to the list. + Dim cvalue As String = Nothing + Dim fvalue As String = Nothing + If itemValue.PersonalIdSpecified Then + cvalue = itemValue.PersonalId.ToString() + Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalLanguageSkillTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalLanguageSkillTable.PersonalId) + If _isExpandableNonCompositeForeignKey AndAlso PersonalLanguageSkillTable.PersonalId.IsApplyDisplayAs Then + fvalue = PersonalLanguageSkillTable.GetDFKA(itemValue, PersonalLanguageSkillTable.PersonalId) + End If + If (Not _isExpandableNonCompositeForeignKey) Or (String.IsNullOrEmpty(fvalue)) Then + fvalue = itemValue.Format(PersonalIdTable.PersonalName) + End If + + If fvalue Is Nothing OrElse fvalue.Trim() = "" Then fvalue = cvalue + Dim newItem As New ListItem(fvalue, cvalue) + Me.PersonalId.Items.Add(newItem) + SetSelectedValue(Me.PersonalId, selectedValue) + End If + End If + Catch + End Try + + End If + + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalLanguageSkillRowDeleteButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + If(Not Me.Page.IsPageRefresh) Then + + Dim tc As PersonalLanguageSkillTableControl = DirectCast(GetParentControlObject(Me, "PersonalLanguageSkillTableControl"), PersonalLanguageSkillTableControl) + If Not (IsNothing(tc)) Then + If Not Me.IsNewRecord Then + tc.AddToDeletedRecordIds(DirectCast(Me, PersonalLanguageSkillTableControlRow)) + End If + Me.Visible = False + tc.SetFormulaControls() + End If + + End If + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + Protected Overridable Sub LanguageId_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()(LanguageId.ClientID & "_SelectedValue"), String) + Dim displayText As String = CType(Me.Page.Session()(LanguageId.ClientID & "_SelectedDisplayText"), String) + If displayText <> "" AndAlso val <> "" Then + Me.LanguageId.Items.Add(New ListItem(displayText, val)) + Me.LanguageId.SelectedIndex = Me.LanguageId.Items.Count - 1 + Me.Page.Session.Remove(LanguageId.ClientID & "_SelectedValue") + Me.Page.Session.Remove(LanguageId.ClientID & "_SelectedDisplayText") + End If + + + + + End Sub + + Protected Overridable Sub PersonalId_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()(PersonalId.ClientID & "_SelectedValue"), String) + Dim displayText As String = CType(Me.Page.Session()(PersonalId.ClientID & "_SelectedDisplayText"), String) + If displayText <> "" AndAlso val <> "" Then + Me.PersonalId.Items.Add(New ListItem(displayText, val)) + Me.PersonalId.SelectedIndex = Me.PersonalId.Items.Count - 1 + Me.Page.Session.Remove(PersonalId.ClientID & "_SelectedValue") + Me.Page.Session.Remove(PersonalId.ClientID & "_SelectedDisplayText") + End If + + + + + End Sub + + Protected Overridable Sub Level_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("BasePersonalLanguageSkillTableControlRow_Rec"), String) + End Get + Set(ByVal value As String) + Me.ViewState("BasePersonalLanguageSkillTableControlRow_Rec") = value + End Set + End Property + + Private _DataSource As PersonalLanguageSkillRecord + Public Property DataSource() As PersonalLanguageSkillRecord + Get + Return Me._DataSource + End Get + + Set(ByVal value As PersonalLanguageSkillRecord) + + Me._DataSource = value + End Set + End Property + + + + Private _checkSum As String + Public Overridable Property CheckSum() As String + Get + Return Me._checkSum + End Get + Set(ByVal value As String) + Me._checkSum = value + End Set + End Property + + Private _TotalPages As Integer + Public Property TotalPages() As Integer + Get + Return Me._TotalPages + End Get + Set(ByVal value As Integer) + Me._TotalPages = value + End Set + End Property + + Private _PageIndex As Integer + Public Property PageIndex() As Integer + Get + ' Return the PageIndex + Return Me._PageIndex + End Get + Set(ByVal value As Integer) + Me._PageIndex = value + End Set + End Property + + Private _DisplayLastPage As Boolean + Public Property DisplayLastPage() As Boolean + Get + Return Me._DisplayLastPage + End Get + Set(ByVal value As Boolean) + Me._DisplayLastPage = value + End Set + End Property + + + +#Region "Helper Properties" + + Public ReadOnly Property LanguageId() As System.Web.UI.WebControls.DropDownList + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "LanguageId"), System.Web.UI.WebControls.DropDownList) + End Get + End Property + + Public ReadOnly Property Level() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Level"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property PersonalId() As System.Web.UI.WebControls.DropDownList + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalId"), System.Web.UI.WebControls.DropDownList) + End Get + End Property + + Public ReadOnly Property PersonalLanguageSkillRecordRowSelection() As System.Web.UI.WebControls.CheckBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalLanguageSkillRecordRowSelection"), System.Web.UI.WebControls.CheckBox) + End Get + End Property + + Public ReadOnly Property PersonalLanguageSkillRowDeleteButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalLanguageSkillRowDeleteButton"), System.Web.UI.WebControls.ImageButton) + 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 PersonalLanguageSkillRecord = 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 PersonalLanguageSkillRecord + If Not Me.DataSource Is Nothing Then + Return Me.DataSource + End If + + If Not Me.RecordUniqueId Is Nothing Then + + Return PersonalLanguageSkillTable.GetRecord(Me.RecordUniqueId, True) + + End If + + ' Localization. + + Throw New Exception(Page.GetResourceValue("Err:RetrieveRec", "Persons")) + + End Function + + Public Shadows ReadOnly Property Page() As BaseApplicationPage + Get + Return DirectCast(MyBase.Page, BaseApplicationPage) + End Get + End Property + +#End Region + +End Class + + + +' Base class for the PersonalLanguageSkillTableControl control on the EditPersonalLanguageSkillTable page. +' Do not modify this class. Instead override any method in PersonalLanguageSkillTableControl. +Public Class BasePersonalLanguageSkillTableControl + Inherits Persons.UI.BaseApplicationTableControl + + + + Protected Overridable Sub Control_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Init + + + + ' Setup the filter and search events. + + + + ' Control Initializations. + ' Initialize the table's current sort order. + + If Me.InSession(Me, "Order_By") Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + End If + + + + ' Setup default pagination settings. + + Me.PageSize = CInt(Me.GetFromSession(Me, "Page_Size", "10")) + Me.PageIndex = CInt(Me.GetFromSession(Me, "Page_Index", "0")) + + + + Me.ClearControlsFromSession() + End Sub + + Protected Overridable Sub Control_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load + + SaveControlsToSession_Ajax() + + ' Show confirmation message on Click + Me.PersonalLanguageSkillDeleteButton.Attributes.Add("onClick", "return (confirm('" & (CType(Me.Page,BaseApplicationPage)).GetResourceValue("DeleteConfirm", "Persons") & "'));") + + ' Setup the pagination events. + + AddHandler Me.PersonalLanguageSkillPagination.FirstPage.Click, AddressOf PersonalLanguageSkillPagination_FirstPage_Click + + AddHandler Me.PersonalLanguageSkillPagination.LastPage.Click, AddressOf PersonalLanguageSkillPagination_LastPage_Click + + AddHandler Me.PersonalLanguageSkillPagination.NextPage.Click, AddressOf PersonalLanguageSkillPagination_NextPage_Click + + AddHandler Me.PersonalLanguageSkillPagination.PageSizeButton.Click, AddressOf PersonalLanguageSkillPagination_PageSizeButton_Click + + AddHandler Me.PersonalLanguageSkillPagination.PreviousPage.Click, AddressOf PersonalLanguageSkillPagination_PreviousPage_Click + + + ' Setup the sorting events. + + AddHandler Me.LanguageIdLabel1.Click, AddressOf LanguageIdLabel1_Click + + AddHandler Me.LevelLabel.Click, AddressOf LevelLabel_Click + + ' Setup the button events. + + AddHandler Me.PersonalLanguageSkillAddButton.Click, AddressOf PersonalLanguageSkillAddButton_Click + + AddHandler Me.PersonalLanguageSkillDeleteButton.Click, AddressOf PersonalLanguageSkillDeleteButton_Click + + AddHandler Me.PersonalLanguageSkillEditButton.Click, AddressOf PersonalLanguageSkillEditButton_Click + + AddHandler Me.PersonalLanguageSkillRefreshButton.Click, AddressOf PersonalLanguageSkillRefreshButton_Click + + AddHandler Me.PersonalLanguageSkillResetButton.Click, AddressOf PersonalLanguageSkillResetButton_Click + + AddHandler Me.PersonalLanguageSkillSaveButton.Click, AddressOf PersonalLanguageSkillSaveButton_Click + + Me.PersonalLanguageSkillSaveButton.Attributes.Add("onclick", "SubmitHRefOnce(this, """ & Me.Page.GetResourceValue("Txt:SaveRecord", "Persons") & """);") + + + ' Setup events for others + + End Sub + + + Public Overridable Sub LoadData() + + ' Read data from database. Returns an array of records that can be assigned + ' to the DataSource table control property. + Try + Dim joinFilter As CompoundFilter = CreateCompoundJoinFilter() + + ' The WHERE clause will be empty when displaying all records in table. + Dim wc As WhereClause = CreateWhereClause() + If wc IsNot Nothing AndAlso Not wc.RunQuery Then + ' Initialize an empty array of records + Dim alist As New ArrayList(0) + Me.DataSource = DirectCast(alist.ToArray(GetType(PersonalLanguageSkillRecord)), PersonalLanguageSkillRecord()) + ' Add records to the list if needed. + Me.AddNewRecords() + Me._TotalRecords = 0 + Me._TotalPages = 0 + Return + End If + + ' Call OrderBy to determine the order - either use the order defined + ' on the Query Wizard, or specified by user (by clicking on column heading) + Dim orderBy As OrderBy = CreateOrderBy() + + ' Get the pagesize from the pagesize control. + Me.GetPageSize() + + If Me.DisplayLastPage Then + Dim totalRecords As Integer = If(Me._TotalRecords < 0, PersonalLanguageSkillTable.GetRecordCount(CreateCompoundJoinFilter(), CreateWhereClause()), Me._TotalRecords) + + Dim totalPages As Integer = CInt(Math.Ceiling(totalRecords / Me.PageSize)) + + Me.PageIndex = totalPages - 1 + End If + + ' Make sure PageIndex (current page) and PageSize are within bounds. + If Me.PageIndex < 0 Then + Me.PageIndex = 0 + End If + If Me.PageSize < 1 Then + Me.PageSize = 1 + End If + + ' Retrieve the records and set the table DataSource. + ' Only PageSize records are fetched starting at PageIndex (zero based). + If Me.AddNewRecord > 0 Then + ' Make sure to preserve the previously entered data on new rows. + Dim postdata As New ArrayList + For Each rc As PersonalLanguageSkillTableControlRow In Me.GetRecordControls() + If Not rc.IsNewRecord Then + rc.DataSource = rc.GetRecord() + rc.GetUIData() + postdata.Add(rc.DataSource) + UIData.Add(rc.PreservedUIData()) + End If + Next + Me.DataSource = DirectCast(postdata.ToArray(GetType(PersonalLanguageSkillRecord)), PersonalLanguageSkillRecord()) + Else ' Get the records from the database + Me.DataSource = PersonalLanguageSkillTable.GetRecords(joinFilter, wc, orderBy, Me.PageIndex, Me.PageSize) + + End If + + ' if the datasource contains no records contained in database, then load the last page. + If (DbUtils.GetCreatedRecords(Me.DataSource).Length = 0 AndAlso Not Me.DisplayLastPage) Then + Me.DisplayLastPage = True + LoadData() + Else + + ' Add any new rows desired by the user. + Me.AddNewRecords() + + ' Turn off the ToggleAll checkbox + Me.PersonalLanguageSkillToggleAll.Checked = False + + + ' Initialize the page and grand totals. now + + End If + + Catch ex As Exception + ' Report the error message to the end user + Dim msg As String = ex.Message + If ex.InnerException IsNot Nothing Then + msg = msg & " InnerException: " & ex.InnerException.Message + End If + Throw New Exception(msg, ex.InnerException) + End Try + End Sub + + + + + Public Overrides Sub DataBind() + ' The DataBind method binds the user interface controls to the values + ' from the database record for each row in the table. To do this, it calls the + ' DataBind for each of the rows. + ' DataBind also populates any filters above the table, and sets the pagination + ' control to the correct number of records and the current page number. + + MyBase.DataBind() + + ' Make sure that the DataSource is initialized. + If Me.DataSource Is Nothing Then + Return + End If + + 'LoadData for DataSource for chart and report if they exist + + ' Improve performance by prefetching display as records. + Me.PreFetchForeignKeyValues() + + ' Setup the pagination controls. + BindPaginationControls() + + + + ' Bind the repeater with the list of records to expand the UI. + Dim rep As System.Web.UI.WebControls.Repeater = CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalLanguageSkillTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return + rep.DataSource = DataSource() + rep.DataBind() + + Dim index As Integer = 0 + For Each repItem As System.Web.UI.WebControls.RepeaterItem In rep.Items + ' Loop through all rows in the table, set its DataSource and call DataBind(). + Dim recControl As PersonalLanguageSkillTableControlRow = DirectCast(repItem.FindControl("PersonalLanguageSkillTableControlRow"), PersonalLanguageSkillTableControlRow) + recControl.DataSource = Me.DataSource(index) + If Me.UIData.Count > index Then + recControl.PreviousUIData = Me.UIData(index) + End If + recControl.DataBind() + recControl.Visible = Not Me.InDeletedRecordIds(recControl) + + index += 1 + Next + + + + + ' Call the Set methods for each controls on the panel + + SetLanguageIdLabel1() + SetLevelLabel() + + + + + + + + SetPersonalLanguageSkillTableControlCollapsibleRegion() + SetPersonalLanguageSkillTableControlIcon() + SetPersonalLanguageSkillTableControlPanelExtender() + + + ' setting the state of expand or collapse alternative rows + + + ' Load data for each record and table UI control. + ' Ordering is important because child controls get + ' their parent ids from their parent UI controls. + + + ' this method calls the set method for controls with special formula like running total, sum, rank, etc + SetFormulaControls() + End Sub + + Public Overridable Sub SetFormulaControls() + ' this method calls Set methods for the control that has special formula + + + + End Sub + + + Public Sub PreFetchForeignKeyValues() + If (IsNothing(Me.DataSource)) + Return + End If + + Me.Page.PregetDfkaRecords(PersonalLanguageSkillTable.LanguageId, Me.DataSource) + + Me.Page.PregetDfkaRecords(PersonalLanguageSkillTable.PersonalId, Me.DataSource) + + End Sub + + + Public Overridable Sub RegisterPostback() + + Me.Page.RegisterPostBackTrigger(MiscUtils.FindControlRecursively(Me,"PersonalLanguageSkillSaveButton")) + + + End Sub + + Public EvaluateFormulaDelegate As BaseClasses.Data.DataSource.EvaluateFormulaDelegate = New BaseClasses.Data.DataSource.EvaluateFormulaDelegate(AddressOf Me.EvaluateFormula) + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean, ByVal e as FormulaEvaluator) As String + If e Is Nothing + e = New FormulaEvaluator() + End If + + e.Variables.Clear() + + + ' add variables for formula evaluation + If variables IsNot Nothing Then + Dim enumerator As System.Collections.Generic.IEnumerator(Of System.Collections.Generic.KeyValuePair(Of String, Object)) = variables.GetEnumerator() + While enumerator.MoveNext() + e.Variables.Add(enumerator.Current.Key, enumerator.Current.Value) + End While + End If + + If includeDS + + End If + + ' All variables referred to in the formula are expected to be + ' properties of the DataSource. For example, referring to + ' UnitPrice as a variable will refer to DataSource.UnitPrice + e.DataSource = dataSourceForEvaluate + + ' Define the calling control. This is used to add other + ' related table and record controls as variables. + e.CallingControl = Me + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + + If Not String.IsNullOrEmpty(format) AndAlso (String.IsNullOrEmpty(formula) OrElse formula.IndexOf("Format(") < 0) Then + Return FormulaUtils.Format(resultObj, format) + Else + Return resultObj.ToString() + End If + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format,variables ,includeDS, Nothing) + End Function + + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object)) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format, variables ,True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, format, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal e as FormulaEvaluator) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, variables, True, e) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal includeDS as Boolean) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, includeDS, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, True, Nothing) + End Function + + + + + Public Overridable Sub ResetControl() + + Me.CurrentSortOrder.Reset() + If (Me.InSession(Me, "Order_By")) Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + End If + + Me.PageIndex = 0 + End Sub + + Protected Overridable Sub BindPaginationControls() + ' Setup the pagination controls. + + ' Bind the pagination labels. + + If DbUtils.GetCreatedRecords(Me.DataSource).Length > 0 Then + + Me.PersonalLanguageSkillPagination.CurrentPage.Text = (Me.PageIndex + 1).ToString() + Else + Me.PersonalLanguageSkillPagination.CurrentPage.Text = "0" + End If + Me.PersonalLanguageSkillPagination.PageSize.Text = Me.PageSize.ToString() + Me.PersonalLanguageSkillPagination.TotalItems.Text = Me.TotalRecords.ToString() + Me.PersonalLanguageSkillPagination.TotalPages.Text = Me.TotalPages.ToString() + + ' Bind the buttons for PersonalLanguageSkillTableControl pagination. + + Me.PersonalLanguageSkillPagination.FirstPage.Enabled = Not (Me.PageIndex = 0) + If Me._TotalPages < 0 Then ' if the total pages is not determined yet, enable last and next buttons + Me.PersonalLanguageSkillPagination.LastPage.Enabled = True + ElseIf Me._TotalPages = 0 ' if the total pages is determined and it is 0, enable last and next buttons + Me.PersonalLanguageSkillPagination.LastPage.Enabled = False + Else ' if the total pages is the last page, disable last and next buttons + Me.PersonalLanguageSkillPagination.LastPage.Enabled = Not (Me.PageIndex = Me.TotalPages - 1) + End If + + If Me._TotalPages < 0 Then ' if the total pages is not determined yet, enable last and next buttons + Me.PersonalLanguageSkillPagination.NextPage.Enabled = True + ElseIf Me._TotalPages = 0 ' if the total pages is determined and it is 0, enable last and next buttons + Me.PersonalLanguageSkillPagination.NextPage.Enabled = False + Else ' if the total pages is the last page, disable last and next buttons + Me.PersonalLanguageSkillPagination.NextPage.Enabled = Not (Me.PageIndex = Me.TotalPages - 1) + End If + + Me.PersonalLanguageSkillPagination.PreviousPage.Enabled = Not (Me.PageIndex = 0) + + + End Sub + + Public Overridable Sub SaveData() + ' Save the data from the entire table. Calls each row's Save Data + ' to save their data. This function is called by the Click handler of the + ' Save button. The button handler should Start/Commit/End a transaction. + + Dim recCtl As PersonalLanguageSkillTableControlRow + For Each recCtl In Me.GetRecordControls() + + If Me.InDeletedRecordIds(recCtl) Then + ' Delete any pending deletes. + recCtl.Delete() + Else + If recCtl.Visible Then + recCtl.SaveData() + End If + End If + + Next + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + ' Set IsNewRecord to False for all records - since everything has been saved and is no longer "new" + For Each recCtl In Me.GetRecordControls() + recCtl.IsNewRecord = False + Next + + + ' Set DeletedRecordsIds to Nothing since we have deleted all pending deletes. + Me.DeletedRecordIds = Nothing + + End Sub + + Public Overridable Function CreateCompoundJoinFilter() As CompoundFilter + Dim jFilter As CompoundFilter = New CompoundFilter() + + Return jFilter + + End Function + + + Public Overridable Function CreateOrderBy() As OrderBy + ' The CurrentSortOrder is initialized to the sort order on the + ' Query Wizard. It may be modified by the Click handler for any of + ' the column heading to sort or reverse sort by that column. + ' You can add your own sort order, or modify it on the Query Wizard. + Return Me.CurrentSortOrder + End Function + + Public Overridable Function CreateWhereClause() As WhereClause + 'This CreateWhereClause is used for loading the data. + PersonalLanguageSkillTable.Instance.InnerFilter = Nothing + Dim wc As WhereClause = New WhereClause() + + ' Compose the WHERE clause consiting of: + ' 1. Static clause defined at design time. + ' 2. User selected search criteria. + ' 3. User selected filter criteria. + + + ' Get the static clause defined at design time on the Table Panel Wizard + Dim qc As WhereClause = Me.CreateQueryClause() + If Not(IsNothing(qc)) Then + wc.iAND(qc) + End If + + Return wc + End Function + + + Public Overridable Function CreateWhereClause(ByVal searchText as String, ByVal fromSearchControl as String, ByVal AutoTypeAheadSearch as String, ByVal AutoTypeAheadWordSeparators as String) As WhereClause + ' This CreateWhereClause is used for loading list of suggestions for Auto Type-Ahead feature. + PersonalLanguageSkillTable.Instance.InnerFilter = Nothing + Dim wc As WhereClause = New WhereClause() + + ' Compose the WHERE clause consiting of: + ' 1. Static clause defined at design time. + ' 2. User selected search criteria. + ' 3. User selected filter criteria. + + Dim appRelativeVirtualPath As String = CType(HttpContext.Current.Session("AppRelativeVirtualPath"), String) + + ' Get the static clause defined at design time on the Table Panel Wizard + Dim qc As WhereClause = Me.CreateQueryClause() + If Not(IsNothing(qc)) Then + wc.iAND(qc) + End If + + ' Adds clauses if values are selected in Filter controls which are configured in the page. + + + Return wc + End Function + + Protected Overridable Function CreateQueryClause() As WhereClause + ' Create a where clause for the Static clause defined at design time. + Dim filter As CompoundFilter = New CompoundFilter(CompoundFilter.CompoundingOperators.And_Operator, Nothing) + Dim whereClause As WhereClause = New WhereClause() + + filter.AddFilter(New BaseClasses.Data.SignedInUserFilter(BaseClasses.Data.BaseTable.CreateInstance("Persons.Business.PersonalLanguageSkillTable, App_Code").TableDefinition.ColumnList.GetByUniqueName("PersonalLanguageSkill_.PersonalId"), New BaseClasses.Data.IdentifierAliasInfo("PersonalLanguageSkill_", Nothing), BaseClasses.Data.BaseFilter.ComparisonOperator.EqualsTo, False)) + + whereClause.AddFilter(filter, CompoundFilter.CompoundingOperators.And_Operator) + + Return whereClause + + End Function + + + Public Overridable Function FormatSuggestions(ByVal prefixText As String, ByVal resultItem As String, _ + ByVal columnLength As Integer, ByVal AutoTypeAheadDisplayFoundText As String, _ + ByVal autoTypeAheadSearch As String, ByVal AutoTypeAheadWordSeparators As String, _ + ByVal resultList As ArrayList) As Boolean + + 'Formats the resultItem and adds it to the list of suggestions. + Dim index As Integer = resultItem.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture).IndexOf(prefixText.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture)) + Dim itemToAdd As String = "" + Dim isFound As Boolean = False + Dim isAdded As Boolean = False + ' Get the index where prfixt is at the beginning of resultItem. If not found then, index of word which begins with prefixText. + If InvariantLCase(autoTypeAheadSearch).equals("wordsstartingwithsearchstring") And Not index = 0 Then + ' Expression to find word which contains AutoTypeAheadWordSeparators followed by prefixText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex( AutoTypeAheadWordSeparators + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + If regex1.IsMatch(resultItem) Then + index = regex1.Match(resultItem).Index + isFound = True + End If + ' If the prefixText is found immediatly after white space then starting of the word is found so don not search any further + If not resultItem(index).ToString() = " " Then + ' Expression to find beginning of the word which contains AutoTypeAheadWordSeparators followed by prefixText + Dim regex As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\\S*" + AutoTypeAheadWordSeparators + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + If regex.IsMatch(resultItem) Then + index = regex.Match(resultItem).Index + isFound = True + End If + End If + End If + + ' If autoTypeAheadSearch value is wordsstartingwithsearchstring then, extract the substring only if the prefixText is found at the + ' beginning of the resultItem (index = 0) or a word in resultItem is found starts with prefixText. + If index = 0 Or isFound Or InvariantLCase(autoTypeAheadSearch).Equals("anywhereinstring") then + If InvariantLCase(AutoTypeAheadDisplayFoundText).equals("atbeginningofmatchedstring") Then + ' Expression to find beginning of the word which contains prefixText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\\S*" + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + ' Find the beginning of the word which contains prefexText + If (StringUtils.InvariantLCase(autoTypeAheadSearch).Equals("anywhereinstring") AndAlso regex1.IsMatch(resultItem)) Then + index = regex1.Match(resultItem).Index + isFound = True + End If + ' Display string from the index till end of the string if sub string from index till end is less than columnLength value. + If Len(resultItem) - index <= columnLength Then + If index = 0 Then + itemToAdd = resultItem + Else + itemToAdd = "..." & resultItem.Substring(index, Len(resultItem) - index) + End If + Else + If index = 0 Then + itemToAdd = resultItem.Substring(index, (columnLength - 3)) & "..." + Else + 'Truncate the string to show only columnLength - 6 characters as begining and trailing "..." has to be appended. + itemToAdd = "..." & resultItem.Substring(index , columnLength - 6) & "..." + End If + End If + ElseIf InvariantLCase(AutoTypeAheadDisplayFoundText).equals("inmiddleofmatchedstring") Then + Dim subStringBeginIndex As Integer = CType(columnLength/2, Integer) + If Len(resultItem) <= columnLength Then + itemToAdd = resultItem + Else + ' Sanity check at end of the string + If index + Len(prefixText) = columnLength Then + itemToAdd = "..." & resultItem.Substring(index-columnLength,index) + ElseIf Len(resultItem) - index < subStringBeginIndex Then + ' Display string from the end till columnLength value if, index is closer to the end of the string. + itemToAdd = "..." & resultItem.Substring(Len(resultItem)-columnLength,Len(resultItem)) + ElseIf index <= subStringBeginIndex Then + ' Sanity chet at beginning of the string + itemToAdd = resultItem.Substring(0, columnLength) & "..." + Else + ' Display string containing text before the prefixText occures and text after the prefixText + itemToAdd = "..." & resultItem.Substring(index - subStringBeginIndex, columnLength) & "..." + End If + End If + ElseIf InvariantLCase(AutoTypeAheadDisplayFoundText).equals("atendofmatchedstring") Then + ' Expression to find ending of the word which contains prefexText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\s", System.Text.RegularExpressions.RegexOptions.IgnoreCase) + ' Find the ending of the word which contains prefexText + If regex1.IsMatch(resultItem, index + 1) Then + index = regex1.Match(resultItem, index + 1).Index + Else + ' If the word which contains prefexText is the last word in string, regex1.IsMatch returns false. + index = resultItem.Length + End If + If index > Len(resultItem) Then + index = Len(resultItem) + End If + ' If text from beginning of the string till index is less than columnLength value then, display string from the beginning till index. + If index <= columnLength Then + if index = Len(resultItem) Then 'Make decision to append "..." + itemToAdd = resultItem.Substring(0,index) + Else + itemToAdd = resultItem.Substring(0,index) & "..." + End If + Else + If index = Len(resultItem) Then + itemToAdd = "..." & resultItem.Substring(index - (columnLength - 3), (columnLength - 3)) + Else + 'Truncate the string to show only columnLength - 6 characters as begining and trailing "..." has to be appended. + itemToAdd = "..." & resultItem.Substring(index - (columnLength - 6), columnLength - 6) & "..." + End If + End If + End If + + ' Remove newline character from itemToAdd + Dim prefixTextIndex As Integer = itemToAdd.IndexOf(prefixText, StringComparison.CurrentCultureIgnoreCase) + ' If itemToAdd contains any newline after the search text then show text only till newline + Dim regex2 As System.Text.RegularExpressions.Regex = New System.Text.RegularExpressions.Regex("(" & vbCrLf & "|" & vbLf & ")", System.Text.RegularExpressions.RegexOptions.IgnoreCase) + Dim newLineIndexAfterPrefix As Integer = -1 + If regex2.IsMatch(itemToAdd, prefixTextIndex) Then + newLineIndexAfterPrefix = regex2.Match(itemToAdd, prefixTextIndex).Index + End If + If (newLineIndexAfterPrefix > -1) Then + If itemToAdd.EndsWith("...") Then + itemToAdd = (itemToAdd.Substring(0, newLineIndexAfterPrefix) + "...") + Else + itemToAdd = itemToAdd.Substring(0, newLineIndexAfterPrefix) + End If + End If + ' If itemToAdd contains any newline before search text then show text which comes after newline + Dim regex3 As System.Text.RegularExpressions.Regex = New System.Text.RegularExpressions.Regex("(" & vbCrLf & "|" & vbLf & ")", (System.Text.RegularExpressions.RegexOptions.IgnoreCase Or System.Text.RegularExpressions.RegexOptions.RightToLeft)) + Dim newLineIndexBeforePrefix As Integer = -1 + If regex3.IsMatch(itemToAdd, prefixTextIndex) Then + newLineIndexBeforePrefix = regex3.Match(itemToAdd, prefixTextIndex).Index + End If + If (newLineIndexBeforePrefix > -1) Then + If itemToAdd.StartsWith("...") Then + itemToAdd = ("..." + itemToAdd.Substring((newLineIndexBeforePrefix + regex3.Match(itemToAdd, prefixTextIndex).Length))) + Else + itemToAdd = itemToAdd.Substring((newLineIndexBeforePrefix + regex3.Match(itemToAdd, prefixTextIndex).Length)) + End If + End If + + If Not itemToAdd is nothing AndAlso Not resultList.Contains(itemToAdd) Then + + resultList.Add(itemToAdd) + + isAdded = true + End If + End If + Return isAdded + End Function + + + Protected Overridable Sub GetPageSize() + + If Me.PersonalLanguageSkillPagination.PageSize.Text.Trim <> "" Then + Try + 'Me.PageSize = Integer.Parse(Me.PersonalLanguageSkillPagination.PageSize.Text) + Catch ex As Exception + End Try + End If + End Sub + + Protected Overridable Sub AddNewRecords() + + Dim newRecordList As ArrayList = New ArrayList() + + Dim newUIDataList As System.Collections.Generic.List(Of Hashtable) = New System.Collections.Generic.List(Of Hashtable)() + + ' Loop though all the record controls and if the record control + ' does not have a unique record id set, then create a record + ' and add to the list. + If Not Me.ResetData Then + Dim rep As System.Web.UI.WebControls.Repeater = CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalLanguageSkillTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return + + Dim repItem As System.Web.UI.WebControls.RepeaterItem + For Each repItem In rep.Items + ' Loop through all rows in the table, set its DataSource and call DataBind(). + + Dim recControl As PersonalLanguageSkillTableControlRow = DirectCast(repItem.FindControl("PersonalLanguageSkillTableControlRow"), PersonalLanguageSkillTableControlRow) + + If recControl.Visible AndAlso recControl.IsNewRecord() Then + + Dim rec As PersonalLanguageSkillRecord = New PersonalLanguageSkillRecord() + + If MiscUtils.IsValueSelected(recControl.LanguageId) Then + rec.Parse(recControl.LanguageId.SelectedItem.Value, PersonalLanguageSkillTable.LanguageId) + End If + If recControl.Level.Text <> "" Then + rec.Parse(recControl.Level.Text, PersonalLanguageSkillTable.Level) + End If + If MiscUtils.IsValueSelected(recControl.PersonalId) Then + rec.Parse(recControl.PersonalId.SelectedItem.Value, PersonalLanguageSkillTable.PersonalId) + End If + newUIDataList.Add(recControl.PreservedUIData()) + newRecordList.Add(rec) + End If + Next + End If + + + ' Add any new record to the list. + Dim index As Integer = 0 + For index = 1 To Me.AddNewRecord + + newRecordList.Insert(0, New PersonalLanguageSkillRecord()) + newUIDataList.Insert(0, New Hashtable()) + + Next + Me.AddNewRecord = 0 + + ' Finally, add any new records to the DataSource. + If newRecordList.Count > 0 Then + + Dim finalList As ArrayList = New ArrayList(Me.DataSource) + finalList.InsertRange(0, newRecordList) + + Me.DataSource = DirectCast(finalList.ToArray(GetType(PersonalLanguageSkillRecord)), PersonalLanguageSkillRecord()) + + End If + + ' Add the existing UI data to this hash table + If newUIDataList.Count > 0 Then + Me.UIData.InsertRange(0, newUIDataList) + End If + + End Sub + + + Public Sub AddToDeletedRecordIds(ByVal rec As PersonalLanguageSkillTableControlRow) + If rec.IsNewRecord() Then + Return + End If + + If Not Me.DeletedRecordIds Is Nothing AndAlso Me.DeletedRecordIds.Trim <> "" Then + Me.DeletedRecordIds &= "," + End If + + Me.DeletedRecordIds &= "[" & rec.RecordUniqueId & "]" + End Sub + + Protected Overridable Function InDeletedRecordIds(ByVal rec As PersonalLanguageSkillTableControlRow) As Boolean + If Me.DeletedRecordIds Is Nothing OrElse Me.DeletedRecordIds.Trim = "" Then + Return False + End If + + Return Me.DeletedRecordIds.IndexOf("[" & rec.RecordUniqueId & "]") >= 0 + End Function + + Private _DeletedRecordIds As String + Public Property DeletedRecordIds() As String + Get + Return Me._DeletedRecordIds + End Get + Set(ByVal value As String) + Me._DeletedRecordIds = value + End Set + End Property + + + ' Create Set, WhereClause, and Populate Methods + + Public Overridable Sub SetLanguageIdLabel1() + + End Sub + + Public Overridable Sub SetLevelLabel() + + End Sub + + Public Overridable Sub SetPersonalLanguageSkillTableControlCollapsibleRegion() + + End Sub + + Public Overridable Sub SetPersonalLanguageSkillTableControlIcon() + + End Sub + + Public Overridable Sub SetPersonalLanguageSkillTableControlPanelExtender() + + 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. + Dim added As Boolean = Me.AddNewRecord > 0 + Me.LoadData() + Me.DataBind() + + If added Then + Me.SetFocusToAddedRow() + End If + + End If + + + + Catch ex As Exception + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + Finally + DbUtils.EndTransaction + End Try + End Sub + + 'this function sets focus to the first editable element in the new added row in the editable table + Protected Overridable Sub SetFocusToAddedRow() + Dim rep As System.Web.UI.WebControls.Repeater = CType(Me.FindControl("PersonalLanguageSkillTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing OrElse rep.Items.Count = 0 Then Return + Dim repItem As System.Web.UI.WebControls.RepeaterItem + For Each repItem In rep.Items + 'Load scripts to table rows + Me.Page.LoadFocusScripts(repItem) + Dim recControl As PersonalLanguageSkillTableControlRow = DirectCast(repItem.FindControl("PersonalLanguageSkillTableControlRow"), PersonalLanguageSkillTableControlRow) + If recControl.IsNewRecord Then + For Each field As Control In recControl.Controls + If field.Visible AndAlso Me.Page.IsControlEditable(field, False) Then + 'set focus on the first editable field in the new row + field.Focus() + Dim updPan As UpdatePanel = DirectCast(Me.Page.FindControlRecursively("UpdatePanel1"), UpdatePanel) + If Not updPan Is Nothing Then updPan.Update() + Return + End If + Next + Return + End If + Next + End Sub + + + Protected Overrides Sub SaveControlsToSession() + MyBase.SaveControlsToSession() + + ' Save filter controls to values to session. + + + 'Save pagination state to session. + + + + ' Save table control properties to the session. + If Not Me.CurrentSortOrder Is Nothing Then + Me.SaveToSession(Me, "Order_By", Me.CurrentSortOrder.ToXmlString()) + End If + + Me.SaveToSession(Me, "Page_Index", Me.PageIndex.ToString()) + Me.SaveToSession(Me, "Page_Size", Me.PageSize.ToString()) + + Me.SaveToSession(Me, "DeletedRecordIds", Me.DeletedRecordIds) + + End Sub + + Protected Sub SaveControlsToSession_Ajax() + ' Save filter controls to values to session. + + HttpContext.Current.Session("AppRelativeVirtualPath") = Me.Page.AppRelativeVirtualPath + + End Sub + + Protected Overrides Sub ClearControlsFromSession() + MyBase.ClearControlsFromSession() + + ' Clear filter controls values from the session. + + + ' Clear pagination state from session. + + + + ' Clear table properties from the session. + Me.RemoveFromSession(Me, "Order_By") + Me.RemoveFromSession(Me, "Page_Index") + Me.RemoveFromSession(Me, "Page_Size") + + Me.RemoveFromSession(Me, "DeletedRecordIds") + + End Sub + + Protected Overrides Sub LoadViewState(ByVal savedState As Object) + MyBase.LoadViewState(savedState) + + Dim orderByStr As String = CType(ViewState("PersonalLanguageSkillTableControl_OrderBy"), String) + + If orderByStr IsNot Nothing AndAlso orderByStr.Trim <> "" Then + Me.CurrentSortOrder = BaseClasses.Data.OrderBy.FromXmlString(orderByStr) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + End If + + Dim pageIndex As String = CType(ViewState("Page_Index"), String) + If pageIndex IsNot Nothing Then + Me.PageIndex = CInt(pageIndex) + End If + + Dim pageSize As String = CType(ViewState("Page_Size"), String) + If Not pageSize Is Nothing Then + Me.PageSize = CInt(pageSize) + End If + + + + ' Load view state for pagination control. + + Me.DeletedRecordIds = CType(Me.ViewState("DeletedRecordIds"), String) + + End Sub + + Protected Overrides Function SaveViewState() As Object + + If Me.CurrentSortOrder IsNot Nothing Then + Me.ViewState("PersonalLanguageSkillTableControl_OrderBy") = Me.CurrentSortOrder.ToXmlString() + End If + + Me.ViewState("Page_Index") = Me.PageIndex + Me.ViewState("Page_Size") = Me.PageSize + + Me.ViewState("DeletedRecordIds") = Me.DeletedRecordIds + + + ' Load view state for pagination control. + + + Return MyBase.SaveViewState() + End Function + + ' Generate the event handling functions for pagination events. + + ' event handler for ImageButton + Public Overridable Sub PersonalLanguageSkillPagination_FirstPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.PageIndex = 0 + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalLanguageSkillPagination_LastPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.DisplayLastPage = True + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalLanguageSkillPagination_NextPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.PageIndex += 1 + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for LinkButton + Public Overridable Sub PersonalLanguageSkillPagination_PageSizeButton_Click(ByVal sender As Object, ByVal args As EventArgs) + + Try + + Me.DataChanged = True + + Me.PageSize = Integer.Parse(Me.PersonalLanguageSkillPagination.PageSize.Text) + + Me.PageIndex = Integer.Parse(Me.PersonalLanguageSkillPagination.CurrentPage.Text) - 1 + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalLanguageSkillPagination_PreviousPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + If Me.PageIndex > 0 Then + Me.PageIndex -= 1 + Me.DataChanged = True + End If + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + + ' Generate the event handling functions for sorting events. + + Public Overridable Sub LanguageIdLabel1_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by LanguageId when clicked. + + ' Get previous sorting state for LanguageId. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalLanguageSkillTable.LanguageId) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for LanguageId. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalLanguageSkillTable.LanguageId, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by LanguageId, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub LevelLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by Level when clicked. + + ' Get previous sorting state for Level. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalLanguageSkillTable.Level) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for Level. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalLanguageSkillTable.Level, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by Level, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + + ' Generate the event handling functions for button events. + + ' event handler for ImageButton + Public Overridable Sub PersonalLanguageSkillAddButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + Me.AddNewRecord = 1 + Me.DataChanged = True + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalLanguageSkillDeleteButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + If(Not Me.Page.IsPageRefresh) Then + + Me.DeleteSelectedRecords(True) + Me.SetFormulaControls() + + + End If + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalLanguageSkillEditButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + ' The redirect URL is set on the Properties, Custom Properties or Actions. + ' The ModifyRedirectURL call resolves the parameters before the + ' Response.Redirect redirects the page to the URL. + ' Any code after the Response.Redirect call will not be executed, since the page is + ' redirected to the URL. + + + Dim url As String = "../Shared/ConfigureEditRecord.aspx" + + Dim shouldRedirect As Boolean = True + Dim TargetKey As String = Nothing + Dim DFKA As String = TargetKey + Dim id As String = DFKA + Dim value As String = id + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + url = Me.ModifyRedirectUrl(url, "",False) + url = Me.Page.ModifyRedirectUrl(url, "",False) + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + shouldRedirect = False + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + If shouldRedirect Then + Me.Page.ShouldSaveControlsToSession = True + Me.Page.Response.Redirect(url) + ElseIf Not TargetKey Is Nothing AndAlso _ + Not shouldRedirect Then + Me.Page.ShouldSaveControlsToSession = True + Me.Page.CloseWindow(True) + + End If + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalLanguageSkillRefreshButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Dim PersonalLanguageSkillTableControlObj as PersonalLanguageSkillTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalLanguageSkillTableControl"), PersonalLanguageSkillTableControl) + PersonalLanguageSkillTableControlObj.ResetData = True + + PersonalLanguageSkillTableControlObj.RemoveFromSession(PersonalLanguageSkillTableControlObj, "DeletedRecordIds") + PersonalLanguageSkillTableControlObj.DeletedRecordIds = Nothing + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalLanguageSkillResetButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.CurrentSortOrder.Reset() + If Me.InSession(Me, "Order_By") Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + + End If + + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalLanguageSkillSaveButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + + If (Not Me.Page.IsPageRefresh) Then + Me.SaveData() + End If + + Me.Page.CommitTransaction(sender) + ' Set IsNewRecord to False for all records - since everything has been saved and is no longer "new" + Dim recCtl As PersonalLanguageSkillTableControlRow + For Each recCtl in Me.GetRecordControls() + + recCtl.IsNewRecord = False + Next + + + ' Set DeletedRecordsIds to Nothing since we have deleted all pending deletes. + + Me.DeletedRecordIds = Nothing + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + + + ' Generate the event handling functions for filter and search events. + + + ' Generate the event handling functions for others + + + Private _UIData As New System.Collections.Generic.List(Of Hashtable) + Public Property UIData() As System.Collections.Generic.List(Of Hashtable) + Get + Return Me._UIData + End Get + Set(ByVal value As System.Collections.Generic.List(Of Hashtable)) + Me._UIData = value + End Set + End Property + + ' pagination properties + Protected _PageSize As Integer + Public Property PageSize() As Integer + Get + Return Me._PageSize + End Get + Set(ByVal value As Integer) + Me._PageSize = value + End Set + End Property + + Protected _PageIndex As Integer + Public Property PageIndex() As Integer + Get + ' Return the PageIndex + Return Me._PageIndex + End Get + Set(ByVal value As Integer) + Me._PageIndex = value + End Set + End Property + + Protected _TotalRecords As Integer = -1 + Public Property TotalRecords() As Integer + Get + If _TotalRecords < 0 + _TotalRecords = PersonalLanguageSkillTable.GetRecordCount(CreateCompoundJoinFilter(), CreateWhereClause()) + End If + Return Me._TotalRecords + End Get + Set(ByVal value As Integer) + If Me.PageSize > 0 Then + + Me.TotalPages = CInt(Math.Ceiling(value / Me.PageSize)) + + End If + Me._TotalRecords = value + End Set + End Property + + + + Protected _TotalPages As Integer = -1 + Public Property TotalPages() As Integer + Get + If _TotalPages < 0 Then + + Me.TotalPages = CInt(Math.Ceiling(TotalRecords / Me.PageSize)) + + End If + Return Me._TotalPages + End Get + Set(ByVal value As Integer) + Me._TotalPages = value + End Set + End Property + + Protected _DisplayLastPage As Boolean + Public Property DisplayLastPage() As Boolean + Get + Return Me._DisplayLastPage + End Get + Set(ByVal value As Boolean) + Me._DisplayLastPage = value + End Set + End Property + + Private _DataChanged As Boolean = False + Public Property DataChanged() As Boolean + Get + Return Me._DataChanged + End Get + Set(ByVal value As Boolean) + Me._DataChanged = value + End Set + End Property + + Private _ResetData As Boolean = False + Public Property ResetData() As Boolean + Get + Return Me._ResetData + End Get + Set(ByVal value As Boolean) + Me._ResetData = value + End Set + End Property + + Private _AddNewRecord As Integer = 0 + Public Property AddNewRecord() As Integer + Get + Return Me._AddNewRecord + End Get + Set(ByVal value As Integer) + Me._AddNewRecord = value + End Set + End Property + + + Private _CurrentSortOrder As OrderBy = Nothing + Public Property CurrentSortOrder() As OrderBy + Get + Return Me._CurrentSortOrder + End Get + Set(ByVal value As BaseClasses.Data.OrderBy) + Me._CurrentSortOrder = value + End Set + End Property + + Private _DataSource() As PersonalLanguageSkillRecord = Nothing + Public Property DataSource() As PersonalLanguageSkillRecord () + Get + Return Me._DataSource + End Get + Set(ByVal value() As PersonalLanguageSkillRecord) + Me._DataSource = value + End Set + End Property + +#Region "Helper Properties" + + Public ReadOnly Property LanguageIdLabel1() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "LanguageIdLabel1"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property LevelLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "LevelLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property PersonalLanguageSkillAddButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalLanguageSkillAddButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalLanguageSkillDeleteButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalLanguageSkillDeleteButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalLanguageSkillEditButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalLanguageSkillEditButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalLanguageSkillPagination() As Persons.UI.IPagination + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalLanguageSkillPagination"), Persons.UI.IPagination) + End Get + End Property + + Public ReadOnly Property PersonalLanguageSkillRefreshButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalLanguageSkillRefreshButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalLanguageSkillResetButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalLanguageSkillResetButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalLanguageSkillSaveButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalLanguageSkillSaveButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalLanguageSkillTableControlCollapsibleRegion() As System.Web.UI.WebControls.Panel + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalLanguageSkillTableControlCollapsibleRegion"), System.Web.UI.WebControls.Panel) + End Get + End Property + + Public ReadOnly Property PersonalLanguageSkillTableControlIcon() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalLanguageSkillTableControlIcon"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalLanguageSkillTableControlPanelExtender() As AjaxControlToolkit.CollapsiblePanelExtender + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalLanguageSkillTableControlPanelExtender"), AjaxControlToolkit.CollapsiblePanelExtender) + End Get + End Property + + Public ReadOnly Property PersonalLanguageSkillTitle() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalLanguageSkillTitle"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property PersonalLanguageSkillToggleAll() As System.Web.UI.WebControls.CheckBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalLanguageSkillToggleAll"), System.Web.UI.WebControls.CheckBox) + End Get + End Property + +#End Region + +#Region "Helper Functions" + + Public Overrides Overloads Function ModifyRedirectUrl(url As String, arg As String, ByVal bEncrypt As Boolean) As String + Return Me.Page.EvaluateExpressions(url, arg, bEncrypt, Me) + End Function + + Public Overrides Overloads Function EvaluateExpressions(url As String, arg As String, ByVal bEncrypt As Boolean) As String + Dim needToProcess As Boolean = AreAnyUrlParametersForMe(url, arg) + If (needToProcess) Then + Dim recCtl As PersonalLanguageSkillTableControlRow = Me.GetSelectedRecordControl() + If recCtl Is Nothing AndAlso url.IndexOf("{") >= 0 Then + ' Localization. + Throw New Exception(Page.GetResourceValue("Err:NoRecSelected", "Persons")) + End If + Dim rec As PersonalLanguageSkillRecord = Nothing + If recCtl IsNot Nothing Then + rec = recCtl.GetRecord() + End If + Return EvaluateExpressions(url, arg, rec, bEncrypt) + End If + Return url + End Function + + Public Overridable Function GetSelectedRecordIndex() As Integer + Dim counter As Integer = 0 + Dim recControl As PersonalLanguageSkillTableControlRow + For Each recControl In Me.GetRecordControls() + If recControl.PersonalLanguageSkillRecordRowSelection.Checked Then + Return counter + End If + counter += 1 + Next + Return -1 + End Function + + Public Overridable Function GetSelectedRecordControl() As PersonalLanguageSkillTableControlRow + Dim selectedList() As PersonalLanguageSkillTableControlRow = Me.GetSelectedRecordControls() + If selectedList.Length = 0 Then + Return Nothing + End If + Return selectedList(0) + + End Function + + Public Overridable Function GetSelectedRecordControls() As PersonalLanguageSkillTableControlRow() + + Dim selectedList As ArrayList = New ArrayList(25) + Dim recControl As PersonalLanguageSkillTableControlRow + For Each recControl In Me.GetRecordControls() + If recControl.PersonalLanguageSkillRecordRowSelection IsNot Nothing AndAlso recControl.PersonalLanguageSkillRecordRowSelection.Checked Then + selectedList.Add(recControl) + End If + Next + Return DirectCast(selectedList.ToArray(GetType(PersonalLanguageSkillTableControlRow)), PersonalLanguageSkillTableControlRow()) + + End Function + + Public Overridable Sub DeleteSelectedRecords(ByVal deferDeletion As Boolean) + Dim recList() As PersonalLanguageSkillTableControlRow = Me.GetSelectedRecordControls() + If recList.Length = 0 Then + ' Localization. + Throw New Exception(Page.GetResourceValue("Err:NoRecSelected", "Persons")) + End If + + Dim recCtl As PersonalLanguageSkillTableControlRow + For Each recCtl In recList + If deferDeletion Then + If Not recCtl.IsNewRecord Then + + Me.AddToDeletedRecordIds(recCtl) + + End If + recCtl.Visible = False + + recCtl.PersonalLanguageSkillRecordRowSelection.Checked = False + + Else + + recCtl.Delete() + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + End If + Next + End Sub + + Public Function GetRecordControls() As PersonalLanguageSkillTableControlRow() + Dim recList As ArrayList = New ArrayList() + Dim rep As System.Web.UI.WebControls.Repeater = CType(Me.FindControl("PersonalLanguageSkillTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return Nothing + Dim repItem As System.Web.UI.WebControls.RepeaterItem + + For Each repItem In rep.Items + + Dim recControl As PersonalLanguageSkillTableControlRow = DirectCast(repItem.FindControl("PersonalLanguageSkillTableControlRow"), PersonalLanguageSkillTableControlRow) + recList.Add(recControl) + + Next + + Return DirectCast(recList.ToArray(GetType(PersonalLanguageSkillTableControlRow)), PersonalLanguageSkillTableControlRow()) + 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 + + \ No newline at end of file diff --git a/App_Code/PersonalName/EditPersonalNameTable.Controls.vb b/App_Code/PersonalName/EditPersonalNameTable.Controls.vb new file mode 100644 index 0000000..8bb0079 --- /dev/null +++ b/App_Code/PersonalName/EditPersonalNameTable.Controls.vb @@ -0,0 +1,2895 @@ + +' This file implements the TableControl, TableControlRow, and RecordControl classes for the +' EditPersonalNameTable.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.EditPersonalNameTable + +#Region "Section 1: Place your customizations here." + + +Public Class PersonalNameTableControlRow + Inherits BasePersonalNameTableControlRow + ' The BasePersonalNameTableControlRow implements code for a ROW within the + ' the PersonalNameTableControl table. The BasePersonalNameTableControlRow implements the DataBind and SaveData methods. + ' The loading of data is actually performed by the LoadData method in the base class of PersonalNameTableControl. + + ' This is the ideal place to add your code customizations. For example, you can override the DataBind, + ' SaveData, GetUIData, and Validate methods. + Public Overrides Sub GetUIData() + + ' Call MyBase.GetUIData + MyBase.GetUIData() + + ' Get PersonalDD Record + Dim myRec As PersonalNameRecord = Me.GetRecord + + ' Set PersonalId field value to new value string + myRec.PersonalId = Utils.SecurityControls.GetCurrentUserID + + End Sub + + +End Class + + + +Public Class PersonalNameTableControl + Inherits BasePersonalNameTableControl + + ' The BasePersonalNameTableControl class implements the LoadData, DataBind, CreateWhereClause + ' and other methods to load and display the data in a table control. + + ' This is the ideal place to add your code customizations. You can override the LoadData and CreateWhereClause, + ' The PersonalNameTableControlRow class offers another place where you can customize + ' the DataBind, GetUIData, SaveData and Validate methods specific to each row displayed on the table. + +End Class + + + +#End Region + + + +#Region "Section 2: Do not modify this section." + + +' Base class for the PersonalNameTableControlRow control on the EditPersonalNameTable page. +' Do not modify this class. Instead override any method in PersonalNameTableControlRow. +Public Class BasePersonalNameTableControlRow + Inherits Persons.UI.BaseApplicationRecordControl + + ' To customize, override this method in PersonalNameTableControlRow. + Protected Overridable Sub Control_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Init + + Me.ClearControlsFromSession() + End Sub + + ' To customize, override this method in PersonalNameTableControlRow. + Protected Overridable Sub Control_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load + + 'Call LoadFocusScripts from repeater so that onfocus attribute could be added to elements + Me.Page.LoadFocusScripts(Me) + + ' Show confirmation message on Click + Me.PersonalNameRowDeleteButton.Attributes.Add("onClick", "return (confirm('" & (CType(Me.Page,BaseApplicationPage)).GetResourceValue("DeleteRecordConfirm", "Persons") & "'));") + + + ' Register the event handlers. + + AddHandler Me.PersonalNameRowDeleteButton.Click, AddressOf PersonalNameRowDeleteButton_Click + + AddHandler Me.PersonalId.SelectedIndexChanged, AddressOf PersonalId_SelectedIndexChanged + + AddHandler Me.NameDate.TextChanged, AddressOf NameDate_TextChanged + + AddHandler Me.PersonalLastName.TextChanged, AddressOf PersonalLastName_TextChanged + + AddHandler Me.PersonalName.TextChanged, AddressOf PersonalName_TextChanged + + AddHandler Me.Ref1.TextChanged, AddressOf Ref1_TextChanged + + + End Sub + + + Public Overridable Sub LoadData() + + ' Load the data from the database into the DataSource PersonalName 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 = PersonalNameTable.GetRecord(Me.RecordUniqueId, True) + + Return + End If + + ' Since this is a row in the table, the data for this row is loaded by the + ' LoadData method of the BasePersonalNameTableControl when the data for the entire + ' table is loaded. + + Me.DataSource = New PersonalNameRecord() + + + + End Sub + + ' Populate the UI controls using the DataSource. To customize, override this method in PersonalNameTableControlRow. + 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 + + SetNameDate() + SetPersonalId() + SetPersonalLastName() + SetPersonalName() + + + SetRef1() + + + 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 SetNameDate() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.NameDate.ID) Then + + Me.NameDate.Text = Me.PreviousUIData(Me.NameDate.ID).ToString() + + Return + End If + + + ' Set the NameDate TextBox on the webpage with value from the + ' PersonalName database record. + + ' Me.DataSource is the PersonalName record retrieved from the database. + ' Me.NameDate is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetNameDate() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.NameDateSpecified Then + + ' If the NameDate is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalNameTable.NameDate, "d MMM yyyy") + + Me.NameDate.Text = formattedValue + + Else + + ' NameDate is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.NameDate.Text = PersonalNameTable.NameDate.Format(PersonalNameTable.NameDate.DefaultValue, "d MMM yyyy") + + End If + + End Sub + + Public Overridable Sub SetPersonalId() + + ' If selection was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.PersonalId.ID) Then + If Me.PreviousUIData(Me.PersonalId.ID) Is Nothing + Me.PopulatePersonalIdDropDownList(Nothing, 100) + Else + Me.PopulatePersonalIdDropDownList(Me.PreviousUIData(Me.PersonalId.ID).ToString(), 100) + End If + Return + End If + + + ' Set the PersonalId DropDownList on the webpage with value from the + ' PersonalName database record. + + ' Me.DataSource is the PersonalName record retrieved from the database. + ' Me.PersonalId is the ASP:DropDownList on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetPersonalId() + ' and add your own code before or after the call to the MyBase function. + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.PersonalIdSpecified Then + + ' If the PersonalId is non-NULL, then format the value. + ' The Format method will return the Display Foreign Key As (DFKA) value + Me.PopulatePersonalIdDropDownList(Me.DataSource.PersonalId, 100) + + Else + + ' PersonalId 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.PopulatePersonalIdDropDownList(Nothing, 100) + Else + Me.PopulatePersonalIdDropDownList(PersonalNameTable.PersonalId.DefaultValue, 100) + End If + + End If + + End Sub + + Public Overridable Sub SetPersonalLastName() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.PersonalLastName.ID) Then + + Me.PersonalLastName.Text = Me.PreviousUIData(Me.PersonalLastName.ID).ToString() + + Return + End If + + + ' Set the PersonalLastName TextBox on the webpage with value from the + ' PersonalName database record. + + ' Me.DataSource is the PersonalName record retrieved from the database. + ' Me.PersonalLastName is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetPersonalLastName() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.PersonalLastNameSpecified Then + + ' If the PersonalLastName is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalNameTable.PersonalLastName) + + Me.PersonalLastName.Text = formattedValue + + Else + + ' PersonalLastName is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.PersonalLastName.Text = PersonalNameTable.PersonalLastName.Format(PersonalNameTable.PersonalLastName.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetPersonalName() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.PersonalName.ID) Then + + Me.PersonalName.Text = Me.PreviousUIData(Me.PersonalName.ID).ToString() + + Return + End If + + + ' Set the PersonalName TextBox on the webpage with value from the + ' PersonalName database record. + + ' Me.DataSource is the PersonalName record retrieved from the database. + ' Me.PersonalName is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetPersonalName() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.PersonalNameSpecified Then + + ' If the PersonalName is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalNameTable.PersonalName) + + Me.PersonalName.Text = formattedValue + + Else + + ' PersonalName is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.PersonalName.Text = PersonalNameTable.PersonalName.Format(PersonalNameTable.PersonalName.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetRef1() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.Ref1.ID) Then + + Me.Ref1.Text = Me.PreviousUIData(Me.Ref1.ID).ToString() + + Return + End If + + + ' Set the Ref TextBox on the webpage with value from the + ' PersonalName database record. + + ' Me.DataSource is the PersonalName 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(PersonalNameTable.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 = PersonalNameTable.Ref0.Format(PersonalNameTable.Ref0.DefaultValue) + + End If + + End Sub + + + Public EvaluateFormulaDelegate As BaseClasses.Data.DataSource.EvaluateFormulaDelegate = New BaseClasses.Data.DataSource.EvaluateFormulaDelegate(AddressOf Me.EvaluateFormula) + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean, ByVal e As FormulaEvaluator) As String + If e Is Nothing Then + e = New FormulaEvaluator() + End If + + e.Variables.Clear() + + + ' add variables for formula evaluation + If variables IsNot Nothing Then + Dim enumerator As System.Collections.Generic.IEnumerator(Of System.Collections.Generic.KeyValuePair(Of String, Object)) = variables.GetEnumerator() + While enumerator.MoveNext() + e.Variables.Add(enumerator.Current.Key, enumerator.Current.Value) + End While + End If + + If includeDS + + End IF + + + ' Other variables referred to in the formula are expected to be + ' properties of the DataSource. For example, referring to + ' UnitPrice as a variable will refer to DataSource.UnitPrice + If dataSourceForEvaluate Is Nothing Then + + e.DataSource = Me.DataSource + + Else + e.DataSource = dataSourceForEvaluate + End If + + ' Define the calling control. This is used to add other + ' related table and record controls as variables. + e.CallingControl = Me + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + + If Not String.IsNullOrEmpty(format) AndAlso (String.IsNullOrEmpty(formula) OrElse formula.IndexOf("Format(") < 0) Then + Return FormulaUtils.Format(resultObj, format) + Else + Return resultObj.ToString() + End If + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format,variables ,includeDS, Nothing) + End Function + + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object)) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format, variables ,True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, format, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal e as FormulaEvaluator) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, variables, True, e) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal includeDS as Boolean) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, includeDS, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, True, Nothing) + End Function + + + Public Overridable Sub RegisterPostback() + + + End Sub + + + + ' To customize, override this method in PersonalNameTableControlRow. + Public Overridable Sub SaveData() + ' Saves the associated record in the database. + ' SaveData calls Validate and Get methods - so it may be more appropriate to + ' customize those methods. + + ' 1. Load the existing record from the database. Since we save the entire record, this ensures + ' that fields that are not displayed are also properly initialized. + Me.LoadData() + + + ' 2. Perform any custom validation. + Me.Validate() + + + ' 3. Set the values in the record with data from UI controls. + ' This calls the Get() method for each of the user interface controls. + Me.GetUIData() + + ' 4. Save in the database. + ' We should not save the record if the data did not change. This + ' will save a database hit and avoid triggering any database triggers. + + If Me.DataSource.IsAnyValueChanged Then + ' Save record to database but do not commit yet. + ' Auto generated ids are available after saving for use by child (dependent) records. + Me.DataSource.Save() + + DirectCast(GetParentControlObject(Me, "PersonalNameTableControl"), PersonalNameTableControl).DataChanged = True + DirectCast(GetParentControlObject(Me, "PersonalNameTableControl"), PersonalNameTableControl).ResetData = True + End If + + + ' update session or cookie by formula + + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + ' For Master-Detail relationships, save data on the Detail table(s) + + End Sub + + ' To customize, override this method in PersonalNameTableControlRow. + 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. + + GetNameDate() + GetPersonalId() + GetPersonalLastName() + GetPersonalName() + GetRef1() + End Sub + + + Public Overridable Sub GetNameDate() + + ' Retrieve the value entered by the user on the NameDate ASP:TextBox, and + ' save it into the NameDate field in DataSource PersonalName 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.NameDate.Text, PersonalNameTable.NameDate) + + + End Sub + + Public Overridable Sub GetPersonalId() + + ' Retrieve the value entered by the user on the PersonalId ASP:DropDownList, and + ' save it into the PersonalId field in DataSource PersonalName record. + + ' Custom validation should be performed in Validate, not here. + + Me.DataSource.Parse(GetValueSelectedPageRequest(Me.PersonalId), PersonalNameTable.PersonalId) + + End Sub + + Public Overridable Sub GetPersonalLastName() + + ' Retrieve the value entered by the user on the PersonalLastName ASP:TextBox, and + ' save it into the PersonalLastName field in DataSource PersonalName record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.PersonalLastName.Text, PersonalNameTable.PersonalLastName) + + + End Sub + + Public Overridable Sub GetPersonalName() + + ' Retrieve the value entered by the user on the PersonalName ASP:TextBox, and + ' save it into the PersonalName field in DataSource PersonalName record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.PersonalName.Text, PersonalNameTable.PersonalName) + + + 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 PersonalName record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.Ref1.Text, PersonalNameTable.Ref0) + + + End Sub + + + ' To customize, override this method in PersonalNameTableControlRow. + + Public Overridable Function CreateWhereClause() As WhereClause + + Return Nothing + + End Function + + + + ' To customize, override this method in PersonalNameTableControlRow. + 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) + PersonalNameTable.DeleteRecord(pkValue) + + DirectCast(GetParentControlObject(Me, "PersonalNameTableControl"), PersonalNameTableControl).DataChanged = True + DirectCast(GetParentControlObject(Me, "PersonalNameTableControl"), PersonalNameTableControl).ResetData = True + End Sub + + Protected Overridable Sub Control_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.PreRender + ' PreRender event is raised just before page is being displayed. + Try + DbUtils.StartTransaction() + Me.RegisterPostback() + + If Not Me.Page.ErrorOnPage AndAlso (Me.Page.IsPageRefresh OrElse Me.DataChanged OrElse Me.ResetData) Then + + + ' Re-load the data and update the web page if necessary. + ' This is typically done during a postback (filter, search button, sort, pagination button). + ' In each of the other click handlers, simply set DataChanged to True to reload the data. + Me.LoadData() + Me.DataBind() + End If + + + Catch ex As Exception + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + Finally + DbUtils.EndTransaction() + End Try + End Sub + + + Protected Overrides Sub SaveControlsToSession() + MyBase.SaveControlsToSession() + + + 'Save pagination state to session. + + End Sub + + + + Protected Overrides Sub ClearControlsFromSession() + MyBase.ClearControlsFromSession() + + + + ' Clear pagination state from session. + + End Sub + + Protected Overrides Sub LoadViewState(ByVal savedState As Object) + MyBase.LoadViewState(savedState) + Dim isNewRecord As String = CType(ViewState("IsNewRecord"), String) + If Not isNewRecord Is Nothing AndAlso isNewRecord.Trim <> "" Then + Me.IsNewRecord = Boolean.Parse(isNewRecord) + End If + + Dim myCheckSum As String = CType(ViewState("CheckSum"), String) + If Not myCheckSum Is Nothing AndAlso myCheckSum.Trim <> "" Then + Me.CheckSum = myCheckSum + End If + + + ' Load view state for pagination control. + + End Sub + + Protected Overrides Function SaveViewState() As Object + ViewState("IsNewRecord") = Me.IsNewRecord.ToString() + ViewState("CheckSum") = Me.CheckSum + + + ' Load view state for pagination control. + + Return MyBase.SaveViewState() + End Function + + + + Public Overridable Function CreateWhereClause_PersonalIdDropDownList() 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 PersonalId table. + ' Examples: + ' wc.iAND(PersonalIdTable.PersonalName, BaseFilter.ComparisonOperator.EqualsTo, "XYZ") + ' wc.iAND(PersonalIdTable.Active, BaseFilter.ComparisonOperator.EqualsTo, "1") + + Dim wc As WhereClause = New WhereClause() + Return wc + + End Function + + + ' Fill the PersonalId list. + Protected Overridable Sub PopulatePersonalIdDropDownList( _ + ByVal selectedValue As String, _ + ByVal maxItems As Integer) + + Me.PersonalId.Items.Clear() + + + ' 1. Setup the static list items + + ' Add the Please Select item. + Me.PersonalId.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_PersonalIdDropDownList function. + ' It is better to customize the where clause there. + + Dim wc As WhereClause = CreateWhereClause_PersonalIdDropDownList() + ' Create the ORDER BY clause to sort based on the displayed value. + + + Dim orderBy As OrderBy = New OrderBy(false, false) + orderBy.Add(PersonalIdTable.PersonalName, OrderByItem.OrderDir.Asc) + + Dim variables As System.Collections.Generic.IDictionary(Of String, Object) = New System.Collections.Generic.Dictionary(Of String, Object) + + ' 3. Read a total of maxItems from the database and insert them + Dim itemValues() As PersonalIdRecord = 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 = PersonalIdTable.GetRecords(wc, orderBy, pageNum, maxItems) + For each itemValue As PersonalIdRecord In itemValues + ' Create the item and add to the list. + Dim cvalue As String = Nothing + Dim fvalue As String = Nothing + If itemValue.PersonalIdSpecified Then + cvalue = itemValue.PersonalId.ToString() + + If counter < maxItems AndAlso Me.PersonalId.Items.FindByValue(cvalue) Is Nothing Then + + Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalNameTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalNameTable.PersonalId) + If _isExpandableNonCompositeForeignKey AndAlso PersonalNameTable.PersonalId.IsApplyDisplayAs Then + fvalue = PersonalNameTable.GetDFKA(itemValue, PersonalNameTable.PersonalId) + End If + If (Not _isExpandableNonCompositeForeignKey) Or (String.IsNullOrEmpty(fvalue)) Then + fvalue = itemValue.Format(PersonalIdTable.PersonalName) + End If + + If fvalue Is Nothing OrElse fvalue.Trim() = "" Then fvalue = cvalue + + If (IsNothing(fvalue)) Then + fvalue = "" + End If + + fvalue = fvalue.Trim() + + If ( fvalue.Length > 50 ) Then + fvalue = fvalue.Substring(0, 50) & "..." + End If + + Dim dupItem As ListItem = Me.PersonalId.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.PersonalId.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.PersonalId, selectedValue) AndAlso _ + Not SetSelectedDisplayText(Me.PersonalId, selectedValue)Then + + ' construct a whereclause to query a record with PersonalId.PersonalId = selectedValue + Dim filter2 As CompoundFilter = New CompoundFilter(CompoundFilter.CompoundingOperators.And_Operator, Nothing) + Dim whereClause2 As WhereClause = New WhereClause() + filter2.AddFilter(New BaseClasses.Data.ColumnValueFilter(PersonalIdTable.PersonalId, selectedValue, BaseClasses.Data.BaseFilter.ComparisonOperator.EqualsTo, False)) + whereClause2.AddFilter(filter2, CompoundFilter.CompoundingOperators.And_Operator) + + Try + ' Execute the query + Dim rc() As PersonalIdRecord = PersonalIdTable.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 PersonalIdRecord = DirectCast(rc(0), PersonalIdRecord) + ' Create the item and add to the list. + Dim cvalue As String = Nothing + Dim fvalue As String = Nothing + If itemValue.PersonalIdSpecified Then + cvalue = itemValue.PersonalId.ToString() + Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalNameTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalNameTable.PersonalId) + If _isExpandableNonCompositeForeignKey AndAlso PersonalNameTable.PersonalId.IsApplyDisplayAs Then + fvalue = PersonalNameTable.GetDFKA(itemValue, PersonalNameTable.PersonalId) + End If + If (Not _isExpandableNonCompositeForeignKey) Or (String.IsNullOrEmpty(fvalue)) Then + fvalue = itemValue.Format(PersonalIdTable.PersonalName) + End If + + If fvalue Is Nothing OrElse fvalue.Trim() = "" Then fvalue = cvalue + Dim newItem As New ListItem(fvalue, cvalue) + Me.PersonalId.Items.Add(newItem) + SetSelectedValue(Me.PersonalId, selectedValue) + End If + End If + Catch + End Try + + End If + + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalNameRowDeleteButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + If(Not Me.Page.IsPageRefresh) Then + + Dim tc As PersonalNameTableControl = DirectCast(GetParentControlObject(Me, "PersonalNameTableControl"), PersonalNameTableControl) + If Not (IsNothing(tc)) Then + If Not Me.IsNewRecord Then + tc.AddToDeletedRecordIds(DirectCast(Me, PersonalNameTableControlRow)) + End If + Me.Visible = False + tc.SetFormulaControls() + End If + + End If + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + Protected Overridable Sub PersonalId_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()(PersonalId.ClientID & "_SelectedValue"), String) + Dim displayText As String = CType(Me.Page.Session()(PersonalId.ClientID & "_SelectedDisplayText"), String) + If displayText <> "" AndAlso val <> "" Then + Me.PersonalId.Items.Add(New ListItem(displayText, val)) + Me.PersonalId.SelectedIndex = Me.PersonalId.Items.Count - 1 + Me.Page.Session.Remove(PersonalId.ClientID & "_SelectedValue") + Me.Page.Session.Remove(PersonalId.ClientID & "_SelectedDisplayText") + End If + + + + + End Sub + + Protected Overridable Sub NameDate_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub PersonalLastName_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub PersonalName_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub Ref1_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("BasePersonalNameTableControlRow_Rec"), String) + End Get + Set(ByVal value As String) + Me.ViewState("BasePersonalNameTableControlRow_Rec") = value + End Set + End Property + + Private _DataSource As PersonalNameRecord + Public Property DataSource() As PersonalNameRecord + Get + Return Me._DataSource + End Get + + Set(ByVal value As PersonalNameRecord) + + Me._DataSource = value + End Set + End Property + + + + Private _checkSum As String + Public Overridable Property CheckSum() As String + Get + Return Me._checkSum + End Get + Set(ByVal value As String) + Me._checkSum = value + End Set + End Property + + Private _TotalPages As Integer + Public Property TotalPages() As Integer + Get + Return Me._TotalPages + End Get + Set(ByVal value As Integer) + Me._TotalPages = value + End Set + End Property + + Private _PageIndex As Integer + Public Property PageIndex() As Integer + Get + ' Return the PageIndex + Return Me._PageIndex + End Get + Set(ByVal value As Integer) + Me._PageIndex = value + End Set + End Property + + Private _DisplayLastPage As Boolean + Public Property DisplayLastPage() As Boolean + Get + Return Me._DisplayLastPage + End Get + Set(ByVal value As Boolean) + Me._DisplayLastPage = value + End Set + End Property + + + +#Region "Helper Properties" + + Public ReadOnly Property NameDate() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "NameDate"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property PersonalId() As System.Web.UI.WebControls.DropDownList + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalId"), System.Web.UI.WebControls.DropDownList) + End Get + End Property + + Public ReadOnly Property PersonalLastName() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalLastName"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property PersonalName() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalName"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property PersonalNameRecordRowSelection() As System.Web.UI.WebControls.CheckBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalNameRecordRowSelection"), System.Web.UI.WebControls.CheckBox) + End Get + End Property + + Public ReadOnly Property PersonalNameRowDeleteButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalNameRowDeleteButton"), System.Web.UI.WebControls.ImageButton) + 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 + +#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 PersonalNameRecord = 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 PersonalNameRecord + If Not Me.DataSource Is Nothing Then + Return Me.DataSource + End If + + If Not Me.RecordUniqueId Is Nothing Then + + Return PersonalNameTable.GetRecord(Me.RecordUniqueId, True) + + End If + + ' Localization. + + Throw New Exception(Page.GetResourceValue("Err:RetrieveRec", "Persons")) + + End Function + + Public Shadows ReadOnly Property Page() As BaseApplicationPage + Get + Return DirectCast(MyBase.Page, BaseApplicationPage) + End Get + End Property + +#End Region + +End Class + + + +' Base class for the PersonalNameTableControl control on the EditPersonalNameTable page. +' Do not modify this class. Instead override any method in PersonalNameTableControl. +Public Class BasePersonalNameTableControl + Inherits Persons.UI.BaseApplicationTableControl + + + + Protected Overridable Sub Control_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Init + + + + ' Setup the filter and search events. + + + + ' Control Initializations. + ' Initialize the table's current sort order. + + If Me.InSession(Me, "Order_By") Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + Me.CurrentSortOrder.Add(PersonalNameTable.NameDate, OrderByItem.OrderDir.Asc) + + End If + + + + ' Setup default pagination settings. + + Me.PageSize = CInt(Me.GetFromSession(Me, "Page_Size", "10")) + Me.PageIndex = CInt(Me.GetFromSession(Me, "Page_Index", "0")) + + + + Me.ClearControlsFromSession() + End Sub + + Protected Overridable Sub Control_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load + + SaveControlsToSession_Ajax() + + ' Show confirmation message on Click + Me.PersonalNameDeleteButton.Attributes.Add("onClick", "return (confirm('" & (CType(Me.Page,BaseApplicationPage)).GetResourceValue("DeleteConfirm", "Persons") & "'));") + + ' Setup the pagination events. + + AddHandler Me.PersonalNamePagination.FirstPage.Click, AddressOf PersonalNamePagination_FirstPage_Click + + AddHandler Me.PersonalNamePagination.LastPage.Click, AddressOf PersonalNamePagination_LastPage_Click + + AddHandler Me.PersonalNamePagination.NextPage.Click, AddressOf PersonalNamePagination_NextPage_Click + + AddHandler Me.PersonalNamePagination.PageSizeButton.Click, AddressOf PersonalNamePagination_PageSizeButton_Click + + AddHandler Me.PersonalNamePagination.PreviousPage.Click, AddressOf PersonalNamePagination_PreviousPage_Click + + + ' Setup the sorting events. + + AddHandler Me.NameDateLabel.Click, AddressOf NameDateLabel_Click + + AddHandler Me.PersonalLastNameLabel.Click, AddressOf PersonalLastNameLabel_Click + + AddHandler Me.PersonalNameLabel1.Click, AddressOf PersonalNameLabel1_Click + + AddHandler Me.RefLabel.Click, AddressOf RefLabel_Click + + ' Setup the button events. + + AddHandler Me.PersonalNameAddButton.Click, AddressOf PersonalNameAddButton_Click + + AddHandler Me.PersonalNameDeleteButton.Click, AddressOf PersonalNameDeleteButton_Click + + AddHandler Me.PersonalNameEditButton.Click, AddressOf PersonalNameEditButton_Click + + AddHandler Me.PersonalNameRefreshButton.Click, AddressOf PersonalNameRefreshButton_Click + + AddHandler Me.PersonalNameResetButton.Click, AddressOf PersonalNameResetButton_Click + + AddHandler Me.PersonalNameSaveButton.Click, AddressOf PersonalNameSaveButton_Click + + Me.PersonalNameSaveButton.Attributes.Add("onclick", "SubmitHRefOnce(this, """ & Me.Page.GetResourceValue("Txt:SaveRecord", "Persons") & """);") + + + ' Setup events for others + + End Sub + + + Public Overridable Sub LoadData() + + ' Read data from database. Returns an array of records that can be assigned + ' to the DataSource table control property. + Try + Dim joinFilter As CompoundFilter = CreateCompoundJoinFilter() + + ' The WHERE clause will be empty when displaying all records in table. + Dim wc As WhereClause = CreateWhereClause() + If wc IsNot Nothing AndAlso Not wc.RunQuery Then + ' Initialize an empty array of records + Dim alist As New ArrayList(0) + Me.DataSource = DirectCast(alist.ToArray(GetType(PersonalNameRecord)), PersonalNameRecord()) + ' Add records to the list if needed. + Me.AddNewRecords() + Me._TotalRecords = 0 + Me._TotalPages = 0 + Return + End If + + ' Call OrderBy to determine the order - either use the order defined + ' on the Query Wizard, or specified by user (by clicking on column heading) + Dim orderBy As OrderBy = CreateOrderBy() + + ' Get the pagesize from the pagesize control. + Me.GetPageSize() + + If Me.DisplayLastPage Then + Dim totalRecords As Integer = If(Me._TotalRecords < 0, PersonalNameTable.GetRecordCount(CreateCompoundJoinFilter(), CreateWhereClause()), Me._TotalRecords) + + Dim totalPages As Integer = CInt(Math.Ceiling(totalRecords / Me.PageSize)) + + Me.PageIndex = totalPages - 1 + End If + + ' Make sure PageIndex (current page) and PageSize are within bounds. + If Me.PageIndex < 0 Then + Me.PageIndex = 0 + End If + If Me.PageSize < 1 Then + Me.PageSize = 1 + End If + + ' Retrieve the records and set the table DataSource. + ' Only PageSize records are fetched starting at PageIndex (zero based). + If Me.AddNewRecord > 0 Then + ' Make sure to preserve the previously entered data on new rows. + Dim postdata As New ArrayList + For Each rc As PersonalNameTableControlRow In Me.GetRecordControls() + If Not rc.IsNewRecord Then + rc.DataSource = rc.GetRecord() + rc.GetUIData() + postdata.Add(rc.DataSource) + UIData.Add(rc.PreservedUIData()) + End If + Next + Me.DataSource = DirectCast(postdata.ToArray(GetType(PersonalNameRecord)), PersonalNameRecord()) + Else ' Get the records from the database + Me.DataSource = PersonalNameTable.GetRecords(joinFilter, wc, orderBy, Me.PageIndex, Me.PageSize) + + End If + + ' if the datasource contains no records contained in database, then load the last page. + If (DbUtils.GetCreatedRecords(Me.DataSource).Length = 0 AndAlso Not Me.DisplayLastPage) Then + Me.DisplayLastPage = True + LoadData() + Else + + ' Add any new rows desired by the user. + Me.AddNewRecords() + + ' Turn off the ToggleAll checkbox + Me.PersonalNameToggleAll.Checked = False + + + ' Initialize the page and grand totals. now + + End If + + Catch ex As Exception + ' Report the error message to the end user + Dim msg As String = ex.Message + If ex.InnerException IsNot Nothing Then + msg = msg & " InnerException: " & ex.InnerException.Message + End If + Throw New Exception(msg, ex.InnerException) + End Try + End Sub + + + + + Public Overrides Sub DataBind() + ' The DataBind method binds the user interface controls to the values + ' from the database record for each row in the table. To do this, it calls the + ' DataBind for each of the rows. + ' DataBind also populates any filters above the table, and sets the pagination + ' control to the correct number of records and the current page number. + + MyBase.DataBind() + + ' Make sure that the DataSource is initialized. + If Me.DataSource Is Nothing Then + Return + End If + + 'LoadData for DataSource for chart and report if they exist + + ' Improve performance by prefetching display as records. + Me.PreFetchForeignKeyValues() + + ' Setup the pagination controls. + BindPaginationControls() + + + + ' Bind the repeater with the list of records to expand the UI. + Dim rep As System.Web.UI.WebControls.Repeater = CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalNameTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return + rep.DataSource = DataSource() + rep.DataBind() + + Dim index As Integer = 0 + For Each repItem As System.Web.UI.WebControls.RepeaterItem In rep.Items + ' Loop through all rows in the table, set its DataSource and call DataBind(). + Dim recControl As PersonalNameTableControlRow = DirectCast(repItem.FindControl("PersonalNameTableControlRow"), PersonalNameTableControlRow) + recControl.DataSource = Me.DataSource(index) + If Me.UIData.Count > index Then + recControl.PreviousUIData = Me.UIData(index) + End If + recControl.DataBind() + recControl.Visible = Not Me.InDeletedRecordIds(recControl) + + index += 1 + Next + + + + + ' Call the Set methods for each controls on the panel + + SetNameDateLabel() + SetPersonalLastNameLabel() + + + + SetPersonalNameLabel1() + + + + + SetPersonalNameTableControlCollapsibleRegion() + SetPersonalNameTableControlIcon() + SetPersonalNameTableControlPanelExtender() + + + SetRefLabel() + ' setting the state of expand or collapse alternative rows + + + ' Load data for each record and table UI control. + ' Ordering is important because child controls get + ' their parent ids from their parent UI controls. + + + ' this method calls the set method for controls with special formula like running total, sum, rank, etc + SetFormulaControls() + End Sub + + Public Overridable Sub SetFormulaControls() + ' this method calls Set methods for the control that has special formula + + + + End Sub + + + Public Sub PreFetchForeignKeyValues() + If (IsNothing(Me.DataSource)) + Return + End If + + Me.Page.PregetDfkaRecords(PersonalNameTable.PersonalId, Me.DataSource) + + End Sub + + + Public Overridable Sub RegisterPostback() + + Me.Page.RegisterPostBackTrigger(MiscUtils.FindControlRecursively(Me,"PersonalNameSaveButton")) + + + End Sub + + Public EvaluateFormulaDelegate As BaseClasses.Data.DataSource.EvaluateFormulaDelegate = New BaseClasses.Data.DataSource.EvaluateFormulaDelegate(AddressOf Me.EvaluateFormula) + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean, ByVal e as FormulaEvaluator) As String + If e Is Nothing + e = New FormulaEvaluator() + End If + + e.Variables.Clear() + + + ' add variables for formula evaluation + If variables IsNot Nothing Then + Dim enumerator As System.Collections.Generic.IEnumerator(Of System.Collections.Generic.KeyValuePair(Of String, Object)) = variables.GetEnumerator() + While enumerator.MoveNext() + e.Variables.Add(enumerator.Current.Key, enumerator.Current.Value) + End While + End If + + If includeDS + + End If + + ' All variables referred to in the formula are expected to be + ' properties of the DataSource. For example, referring to + ' UnitPrice as a variable will refer to DataSource.UnitPrice + e.DataSource = dataSourceForEvaluate + + ' Define the calling control. This is used to add other + ' related table and record controls as variables. + e.CallingControl = Me + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + + If Not String.IsNullOrEmpty(format) AndAlso (String.IsNullOrEmpty(formula) OrElse formula.IndexOf("Format(") < 0) Then + Return FormulaUtils.Format(resultObj, format) + Else + Return resultObj.ToString() + End If + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format,variables ,includeDS, Nothing) + End Function + + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object)) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format, variables ,True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, format, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal e as FormulaEvaluator) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, variables, True, e) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal includeDS as Boolean) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, includeDS, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, True, Nothing) + End Function + + + + + Public Overridable Sub ResetControl() + + Me.CurrentSortOrder.Reset() + If (Me.InSession(Me, "Order_By")) Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + Me.CurrentSortOrder.Add(PersonalNameTable.NameDate, OrderByItem.OrderDir.Asc) + + End If + + Me.PageIndex = 0 + End Sub + + Protected Overridable Sub BindPaginationControls() + ' Setup the pagination controls. + + ' Bind the pagination labels. + + If DbUtils.GetCreatedRecords(Me.DataSource).Length > 0 Then + + Me.PersonalNamePagination.CurrentPage.Text = (Me.PageIndex + 1).ToString() + Else + Me.PersonalNamePagination.CurrentPage.Text = "0" + End If + Me.PersonalNamePagination.PageSize.Text = Me.PageSize.ToString() + Me.PersonalNamePagination.TotalItems.Text = Me.TotalRecords.ToString() + Me.PersonalNamePagination.TotalPages.Text = Me.TotalPages.ToString() + + ' Bind the buttons for PersonalNameTableControl pagination. + + Me.PersonalNamePagination.FirstPage.Enabled = Not (Me.PageIndex = 0) + If Me._TotalPages < 0 Then ' if the total pages is not determined yet, enable last and next buttons + Me.PersonalNamePagination.LastPage.Enabled = True + ElseIf Me._TotalPages = 0 ' if the total pages is determined and it is 0, enable last and next buttons + Me.PersonalNamePagination.LastPage.Enabled = False + Else ' if the total pages is the last page, disable last and next buttons + Me.PersonalNamePagination.LastPage.Enabled = Not (Me.PageIndex = Me.TotalPages - 1) + End If + + If Me._TotalPages < 0 Then ' if the total pages is not determined yet, enable last and next buttons + Me.PersonalNamePagination.NextPage.Enabled = True + ElseIf Me._TotalPages = 0 ' if the total pages is determined and it is 0, enable last and next buttons + Me.PersonalNamePagination.NextPage.Enabled = False + Else ' if the total pages is the last page, disable last and next buttons + Me.PersonalNamePagination.NextPage.Enabled = Not (Me.PageIndex = Me.TotalPages - 1) + End If + + Me.PersonalNamePagination.PreviousPage.Enabled = Not (Me.PageIndex = 0) + + + End Sub + + Public Overridable Sub SaveData() + ' Save the data from the entire table. Calls each row's Save Data + ' to save their data. This function is called by the Click handler of the + ' Save button. The button handler should Start/Commit/End a transaction. + + Dim recCtl As PersonalNameTableControlRow + For Each recCtl In Me.GetRecordControls() + + If Me.InDeletedRecordIds(recCtl) Then + ' Delete any pending deletes. + recCtl.Delete() + Else + If recCtl.Visible Then + recCtl.SaveData() + End If + End If + + Next + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + ' Set IsNewRecord to False for all records - since everything has been saved and is no longer "new" + For Each recCtl In Me.GetRecordControls() + recCtl.IsNewRecord = False + Next + + + ' Set DeletedRecordsIds to Nothing since we have deleted all pending deletes. + Me.DeletedRecordIds = Nothing + + End Sub + + Public Overridable Function CreateCompoundJoinFilter() As CompoundFilter + Dim jFilter As CompoundFilter = New CompoundFilter() + + Return jFilter + + End Function + + + Public Overridable Function CreateOrderBy() As OrderBy + ' The CurrentSortOrder is initialized to the sort order on the + ' Query Wizard. It may be modified by the Click handler for any of + ' the column heading to sort or reverse sort by that column. + ' You can add your own sort order, or modify it on the Query Wizard. + Return Me.CurrentSortOrder + End Function + + Public Overridable Function CreateWhereClause() As WhereClause + 'This CreateWhereClause is used for loading the data. + PersonalNameTable.Instance.InnerFilter = Nothing + Dim wc As WhereClause = New WhereClause() + + ' Compose the WHERE clause consiting of: + ' 1. Static clause defined at design time. + ' 2. User selected search criteria. + ' 3. User selected filter criteria. + + + ' Get the static clause defined at design time on the Table Panel Wizard + Dim qc As WhereClause = Me.CreateQueryClause() + If Not(IsNothing(qc)) Then + wc.iAND(qc) + End If + + Return wc + End Function + + + Public Overridable Function CreateWhereClause(ByVal searchText as String, ByVal fromSearchControl as String, ByVal AutoTypeAheadSearch as String, ByVal AutoTypeAheadWordSeparators as String) As WhereClause + ' This CreateWhereClause is used for loading list of suggestions for Auto Type-Ahead feature. + PersonalNameTable.Instance.InnerFilter = Nothing + Dim wc As WhereClause = New WhereClause() + + ' Compose the WHERE clause consiting of: + ' 1. Static clause defined at design time. + ' 2. User selected search criteria. + ' 3. User selected filter criteria. + + Dim appRelativeVirtualPath As String = CType(HttpContext.Current.Session("AppRelativeVirtualPath"), String) + + ' Get the static clause defined at design time on the Table Panel Wizard + Dim qc As WhereClause = Me.CreateQueryClause() + If Not(IsNothing(qc)) Then + wc.iAND(qc) + End If + + ' Adds clauses if values are selected in Filter controls which are configured in the page. + + + Return wc + End Function + + Protected Overridable Function CreateQueryClause() As WhereClause + ' Create a where clause for the Static clause defined at design time. + Dim filter As CompoundFilter = New CompoundFilter(CompoundFilter.CompoundingOperators.And_Operator, Nothing) + Dim whereClause As WhereClause = New WhereClause() + + filter.AddFilter(New BaseClasses.Data.SignedInUserFilter(BaseClasses.Data.BaseTable.CreateInstance("Persons.Business.PersonalNameTable, App_Code").TableDefinition.ColumnList.GetByUniqueName("PersonalName_.PersonalId"), New BaseClasses.Data.IdentifierAliasInfo("PersonalName_", Nothing), BaseClasses.Data.BaseFilter.ComparisonOperator.EqualsTo, False)) + + whereClause.AddFilter(filter, CompoundFilter.CompoundingOperators.And_Operator) + + Return whereClause + + End Function + + + Public Overridable Function FormatSuggestions(ByVal prefixText As String, ByVal resultItem As String, _ + ByVal columnLength As Integer, ByVal AutoTypeAheadDisplayFoundText As String, _ + ByVal autoTypeAheadSearch As String, ByVal AutoTypeAheadWordSeparators As String, _ + ByVal resultList As ArrayList) As Boolean + + 'Formats the resultItem and adds it to the list of suggestions. + Dim index As Integer = resultItem.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture).IndexOf(prefixText.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture)) + Dim itemToAdd As String = "" + Dim isFound As Boolean = False + Dim isAdded As Boolean = False + ' Get the index where prfixt is at the beginning of resultItem. If not found then, index of word which begins with prefixText. + If InvariantLCase(autoTypeAheadSearch).equals("wordsstartingwithsearchstring") And Not index = 0 Then + ' Expression to find word which contains AutoTypeAheadWordSeparators followed by prefixText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex( AutoTypeAheadWordSeparators + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + If regex1.IsMatch(resultItem) Then + index = regex1.Match(resultItem).Index + isFound = True + End If + ' If the prefixText is found immediatly after white space then starting of the word is found so don not search any further + If not resultItem(index).ToString() = " " Then + ' Expression to find beginning of the word which contains AutoTypeAheadWordSeparators followed by prefixText + Dim regex As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\\S*" + AutoTypeAheadWordSeparators + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + If regex.IsMatch(resultItem) Then + index = regex.Match(resultItem).Index + isFound = True + End If + End If + End If + + ' If autoTypeAheadSearch value is wordsstartingwithsearchstring then, extract the substring only if the prefixText is found at the + ' beginning of the resultItem (index = 0) or a word in resultItem is found starts with prefixText. + If index = 0 Or isFound Or InvariantLCase(autoTypeAheadSearch).Equals("anywhereinstring") then + If InvariantLCase(AutoTypeAheadDisplayFoundText).equals("atbeginningofmatchedstring") Then + ' Expression to find beginning of the word which contains prefixText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\\S*" + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + ' Find the beginning of the word which contains prefexText + If (StringUtils.InvariantLCase(autoTypeAheadSearch).Equals("anywhereinstring") AndAlso regex1.IsMatch(resultItem)) Then + index = regex1.Match(resultItem).Index + isFound = True + End If + ' Display string from the index till end of the string if sub string from index till end is less than columnLength value. + If Len(resultItem) - index <= columnLength Then + If index = 0 Then + itemToAdd = resultItem + Else + itemToAdd = "..." & resultItem.Substring(index, Len(resultItem) - index) + End If + Else + If index = 0 Then + itemToAdd = resultItem.Substring(index, (columnLength - 3)) & "..." + Else + 'Truncate the string to show only columnLength - 6 characters as begining and trailing "..." has to be appended. + itemToAdd = "..." & resultItem.Substring(index , columnLength - 6) & "..." + End If + End If + ElseIf InvariantLCase(AutoTypeAheadDisplayFoundText).equals("inmiddleofmatchedstring") Then + Dim subStringBeginIndex As Integer = CType(columnLength/2, Integer) + If Len(resultItem) <= columnLength Then + itemToAdd = resultItem + Else + ' Sanity check at end of the string + If index + Len(prefixText) = columnLength Then + itemToAdd = "..." & resultItem.Substring(index-columnLength,index) + ElseIf Len(resultItem) - index < subStringBeginIndex Then + ' Display string from the end till columnLength value if, index is closer to the end of the string. + itemToAdd = "..." & resultItem.Substring(Len(resultItem)-columnLength,Len(resultItem)) + ElseIf index <= subStringBeginIndex Then + ' Sanity chet at beginning of the string + itemToAdd = resultItem.Substring(0, columnLength) & "..." + Else + ' Display string containing text before the prefixText occures and text after the prefixText + itemToAdd = "..." & resultItem.Substring(index - subStringBeginIndex, columnLength) & "..." + End If + End If + ElseIf InvariantLCase(AutoTypeAheadDisplayFoundText).equals("atendofmatchedstring") Then + ' Expression to find ending of the word which contains prefexText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\s", System.Text.RegularExpressions.RegexOptions.IgnoreCase) + ' Find the ending of the word which contains prefexText + If regex1.IsMatch(resultItem, index + 1) Then + index = regex1.Match(resultItem, index + 1).Index + Else + ' If the word which contains prefexText is the last word in string, regex1.IsMatch returns false. + index = resultItem.Length + End If + If index > Len(resultItem) Then + index = Len(resultItem) + End If + ' If text from beginning of the string till index is less than columnLength value then, display string from the beginning till index. + If index <= columnLength Then + if index = Len(resultItem) Then 'Make decision to append "..." + itemToAdd = resultItem.Substring(0,index) + Else + itemToAdd = resultItem.Substring(0,index) & "..." + End If + Else + If index = Len(resultItem) Then + itemToAdd = "..." & resultItem.Substring(index - (columnLength - 3), (columnLength - 3)) + Else + 'Truncate the string to show only columnLength - 6 characters as begining and trailing "..." has to be appended. + itemToAdd = "..." & resultItem.Substring(index - (columnLength - 6), columnLength - 6) & "..." + End If + End If + End If + + ' Remove newline character from itemToAdd + Dim prefixTextIndex As Integer = itemToAdd.IndexOf(prefixText, StringComparison.CurrentCultureIgnoreCase) + ' If itemToAdd contains any newline after the search text then show text only till newline + Dim regex2 As System.Text.RegularExpressions.Regex = New System.Text.RegularExpressions.Regex("(" & vbCrLf & "|" & vbLf & ")", System.Text.RegularExpressions.RegexOptions.IgnoreCase) + Dim newLineIndexAfterPrefix As Integer = -1 + If regex2.IsMatch(itemToAdd, prefixTextIndex) Then + newLineIndexAfterPrefix = regex2.Match(itemToAdd, prefixTextIndex).Index + End If + If (newLineIndexAfterPrefix > -1) Then + If itemToAdd.EndsWith("...") Then + itemToAdd = (itemToAdd.Substring(0, newLineIndexAfterPrefix) + "...") + Else + itemToAdd = itemToAdd.Substring(0, newLineIndexAfterPrefix) + End If + End If + ' If itemToAdd contains any newline before search text then show text which comes after newline + Dim regex3 As System.Text.RegularExpressions.Regex = New System.Text.RegularExpressions.Regex("(" & vbCrLf & "|" & vbLf & ")", (System.Text.RegularExpressions.RegexOptions.IgnoreCase Or System.Text.RegularExpressions.RegexOptions.RightToLeft)) + Dim newLineIndexBeforePrefix As Integer = -1 + If regex3.IsMatch(itemToAdd, prefixTextIndex) Then + newLineIndexBeforePrefix = regex3.Match(itemToAdd, prefixTextIndex).Index + End If + If (newLineIndexBeforePrefix > -1) Then + If itemToAdd.StartsWith("...") Then + itemToAdd = ("..." + itemToAdd.Substring((newLineIndexBeforePrefix + regex3.Match(itemToAdd, prefixTextIndex).Length))) + Else + itemToAdd = itemToAdd.Substring((newLineIndexBeforePrefix + regex3.Match(itemToAdd, prefixTextIndex).Length)) + End If + End If + + If Not itemToAdd is nothing AndAlso Not resultList.Contains(itemToAdd) Then + + resultList.Add(itemToAdd) + + isAdded = true + End If + End If + Return isAdded + End Function + + + Protected Overridable Sub GetPageSize() + + If Me.PersonalNamePagination.PageSize.Text.Trim <> "" Then + Try + 'Me.PageSize = Integer.Parse(Me.PersonalNamePagination.PageSize.Text) + Catch ex As Exception + End Try + End If + End Sub + + Protected Overridable Sub AddNewRecords() + + Dim newRecordList As ArrayList = New ArrayList() + + Dim newUIDataList As System.Collections.Generic.List(Of Hashtable) = New System.Collections.Generic.List(Of Hashtable)() + + ' Loop though all the record controls and if the record control + ' does not have a unique record id set, then create a record + ' and add to the list. + If Not Me.ResetData Then + Dim rep As System.Web.UI.WebControls.Repeater = CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalNameTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return + + Dim repItem As System.Web.UI.WebControls.RepeaterItem + For Each repItem In rep.Items + ' Loop through all rows in the table, set its DataSource and call DataBind(). + + Dim recControl As PersonalNameTableControlRow = DirectCast(repItem.FindControl("PersonalNameTableControlRow"), PersonalNameTableControlRow) + + If recControl.Visible AndAlso recControl.IsNewRecord() Then + + Dim rec As PersonalNameRecord = New PersonalNameRecord() + + If recControl.NameDate.Text <> "" Then + rec.Parse(recControl.NameDate.Text, PersonalNameTable.NameDate) + End If + If MiscUtils.IsValueSelected(recControl.PersonalId) Then + rec.Parse(recControl.PersonalId.SelectedItem.Value, PersonalNameTable.PersonalId) + End If + If recControl.PersonalLastName.Text <> "" Then + rec.Parse(recControl.PersonalLastName.Text, PersonalNameTable.PersonalLastName) + End If + If recControl.PersonalName.Text <> "" Then + rec.Parse(recControl.PersonalName.Text, PersonalNameTable.PersonalName) + End If + If recControl.Ref1.Text <> "" Then + rec.Parse(recControl.Ref1.Text, PersonalNameTable.Ref0) + End If + newUIDataList.Add(recControl.PreservedUIData()) + newRecordList.Add(rec) + End If + Next + End If + + + ' Add any new record to the list. + Dim index As Integer = 0 + For index = 1 To Me.AddNewRecord + + newRecordList.Insert(0, New PersonalNameRecord()) + newUIDataList.Insert(0, New Hashtable()) + + Next + Me.AddNewRecord = 0 + + ' Finally, add any new records to the DataSource. + If newRecordList.Count > 0 Then + + Dim finalList As ArrayList = New ArrayList(Me.DataSource) + finalList.InsertRange(0, newRecordList) + + Me.DataSource = DirectCast(finalList.ToArray(GetType(PersonalNameRecord)), PersonalNameRecord()) + + End If + + ' Add the existing UI data to this hash table + If newUIDataList.Count > 0 Then + Me.UIData.InsertRange(0, newUIDataList) + End If + + End Sub + + + Public Sub AddToDeletedRecordIds(ByVal rec As PersonalNameTableControlRow) + If rec.IsNewRecord() Then + Return + End If + + If Not Me.DeletedRecordIds Is Nothing AndAlso Me.DeletedRecordIds.Trim <> "" Then + Me.DeletedRecordIds &= "," + End If + + Me.DeletedRecordIds &= "[" & rec.RecordUniqueId & "]" + End Sub + + Protected Overridable Function InDeletedRecordIds(ByVal rec As PersonalNameTableControlRow) As Boolean + If Me.DeletedRecordIds Is Nothing OrElse Me.DeletedRecordIds.Trim = "" Then + Return False + End If + + Return Me.DeletedRecordIds.IndexOf("[" & rec.RecordUniqueId & "]") >= 0 + End Function + + Private _DeletedRecordIds As String + Public Property DeletedRecordIds() As String + Get + Return Me._DeletedRecordIds + End Get + Set(ByVal value As String) + Me._DeletedRecordIds = value + End Set + End Property + + + ' Create Set, WhereClause, and Populate Methods + + Public Overridable Sub SetNameDateLabel() + + End Sub + + Public Overridable Sub SetPersonalLastNameLabel() + + End Sub + + Public Overridable Sub SetPersonalNameLabel1() + + End Sub + + Public Overridable Sub SetPersonalNameTableControlCollapsibleRegion() + + End Sub + + Public Overridable Sub SetPersonalNameTableControlIcon() + + End Sub + + Public Overridable Sub SetPersonalNameTableControlPanelExtender() + + End Sub + + Public Overridable Sub SetRefLabel() + + 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. + Dim added As Boolean = Me.AddNewRecord > 0 + Me.LoadData() + Me.DataBind() + + If added Then + Me.SetFocusToAddedRow() + End If + + End If + + + + Catch ex As Exception + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + Finally + DbUtils.EndTransaction + End Try + End Sub + + 'this function sets focus to the first editable element in the new added row in the editable table + Protected Overridable Sub SetFocusToAddedRow() + Dim rep As System.Web.UI.WebControls.Repeater = CType(Me.FindControl("PersonalNameTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing OrElse rep.Items.Count = 0 Then Return + Dim repItem As System.Web.UI.WebControls.RepeaterItem + For Each repItem In rep.Items + 'Load scripts to table rows + Me.Page.LoadFocusScripts(repItem) + Dim recControl As PersonalNameTableControlRow = DirectCast(repItem.FindControl("PersonalNameTableControlRow"), PersonalNameTableControlRow) + If recControl.IsNewRecord Then + For Each field As Control In recControl.Controls + If field.Visible AndAlso Me.Page.IsControlEditable(field, False) Then + 'set focus on the first editable field in the new row + field.Focus() + Dim updPan As UpdatePanel = DirectCast(Me.Page.FindControlRecursively("UpdatePanel1"), UpdatePanel) + If Not updPan Is Nothing Then updPan.Update() + Return + End If + Next + Return + End If + Next + End Sub + + + Protected Overrides Sub SaveControlsToSession() + MyBase.SaveControlsToSession() + + ' Save filter controls to values to session. + + + 'Save pagination state to session. + + + + ' Save table control properties to the session. + If Not Me.CurrentSortOrder Is Nothing Then + Me.SaveToSession(Me, "Order_By", Me.CurrentSortOrder.ToXmlString()) + End If + + Me.SaveToSession(Me, "Page_Index", Me.PageIndex.ToString()) + Me.SaveToSession(Me, "Page_Size", Me.PageSize.ToString()) + + Me.SaveToSession(Me, "DeletedRecordIds", Me.DeletedRecordIds) + + End Sub + + Protected Sub SaveControlsToSession_Ajax() + ' Save filter controls to values to session. + + HttpContext.Current.Session("AppRelativeVirtualPath") = Me.Page.AppRelativeVirtualPath + + End Sub + + Protected Overrides Sub ClearControlsFromSession() + MyBase.ClearControlsFromSession() + + ' Clear filter controls values from the session. + + + ' Clear pagination state from session. + + + + ' Clear table properties from the session. + Me.RemoveFromSession(Me, "Order_By") + Me.RemoveFromSession(Me, "Page_Index") + Me.RemoveFromSession(Me, "Page_Size") + + Me.RemoveFromSession(Me, "DeletedRecordIds") + + End Sub + + Protected Overrides Sub LoadViewState(ByVal savedState As Object) + MyBase.LoadViewState(savedState) + + Dim orderByStr As String = CType(ViewState("PersonalNameTableControl_OrderBy"), String) + + If orderByStr IsNot Nothing AndAlso orderByStr.Trim <> "" Then + Me.CurrentSortOrder = BaseClasses.Data.OrderBy.FromXmlString(orderByStr) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + End If + + Dim pageIndex As String = CType(ViewState("Page_Index"), String) + If pageIndex IsNot Nothing Then + Me.PageIndex = CInt(pageIndex) + End If + + Dim pageSize As String = CType(ViewState("Page_Size"), String) + If Not pageSize Is Nothing Then + Me.PageSize = CInt(pageSize) + End If + + + + ' Load view state for pagination control. + + Me.DeletedRecordIds = CType(Me.ViewState("DeletedRecordIds"), String) + + End Sub + + Protected Overrides Function SaveViewState() As Object + + If Me.CurrentSortOrder IsNot Nothing Then + Me.ViewState("PersonalNameTableControl_OrderBy") = Me.CurrentSortOrder.ToXmlString() + End If + + Me.ViewState("Page_Index") = Me.PageIndex + Me.ViewState("Page_Size") = Me.PageSize + + Me.ViewState("DeletedRecordIds") = Me.DeletedRecordIds + + + ' Load view state for pagination control. + + + Return MyBase.SaveViewState() + End Function + + ' Generate the event handling functions for pagination events. + + ' event handler for ImageButton + Public Overridable Sub PersonalNamePagination_FirstPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.PageIndex = 0 + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalNamePagination_LastPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.DisplayLastPage = True + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalNamePagination_NextPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.PageIndex += 1 + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for LinkButton + Public Overridable Sub PersonalNamePagination_PageSizeButton_Click(ByVal sender As Object, ByVal args As EventArgs) + + Try + + Me.DataChanged = True + + Me.PageSize = Integer.Parse(Me.PersonalNamePagination.PageSize.Text) + + Me.PageIndex = Integer.Parse(Me.PersonalNamePagination.CurrentPage.Text) - 1 + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalNamePagination_PreviousPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + If Me.PageIndex > 0 Then + Me.PageIndex -= 1 + Me.DataChanged = True + End If + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + + ' Generate the event handling functions for sorting events. + + Public Overridable Sub NameDateLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by NameDate when clicked. + + ' Get previous sorting state for NameDate. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalNameTable.NameDate) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for NameDate. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalNameTable.NameDate, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by NameDate, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub PersonalLastNameLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by PersonalLastName when clicked. + + ' Get previous sorting state for PersonalLastName. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalNameTable.PersonalLastName) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for PersonalLastName. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalNameTable.PersonalLastName, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by PersonalLastName, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub PersonalNameLabel1_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by PersonalName when clicked. + + ' Get previous sorting state for PersonalName. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalNameTable.PersonalName) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for PersonalName. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalNameTable.PersonalName, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by PersonalName, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub RefLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by Ref when clicked. + + ' Get previous sorting state for Ref. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalNameTable.Ref0) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for Ref. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalNameTable.Ref0, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by Ref, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + + ' Generate the event handling functions for button events. + + ' event handler for ImageButton + Public Overridable Sub PersonalNameAddButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + Me.AddNewRecord = 1 + Me.DataChanged = True + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalNameDeleteButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + If(Not Me.Page.IsPageRefresh) Then + + Me.DeleteSelectedRecords(True) + Me.SetFormulaControls() + + + End If + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalNameEditButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + ' The redirect URL is set on the Properties, Custom Properties or Actions. + ' The ModifyRedirectURL call resolves the parameters before the + ' Response.Redirect redirects the page to the URL. + ' Any code after the Response.Redirect call will not be executed, since the page is + ' redirected to the URL. + + + Dim url As String = "../Shared/ConfigureEditRecord.aspx" + + Dim shouldRedirect As Boolean = True + Dim TargetKey As String = Nothing + Dim DFKA As String = TargetKey + Dim id As String = DFKA + Dim value As String = id + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + url = Me.ModifyRedirectUrl(url, "",False) + url = Me.Page.ModifyRedirectUrl(url, "",False) + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + shouldRedirect = False + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + If shouldRedirect Then + Me.Page.ShouldSaveControlsToSession = True + Me.Page.Response.Redirect(url) + ElseIf Not TargetKey Is Nothing AndAlso _ + Not shouldRedirect Then + Me.Page.ShouldSaveControlsToSession = True + Me.Page.CloseWindow(True) + + End If + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalNameRefreshButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Dim PersonalNameTableControlObj as PersonalNameTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalNameTableControl"), PersonalNameTableControl) + PersonalNameTableControlObj.ResetData = True + + PersonalNameTableControlObj.RemoveFromSession(PersonalNameTableControlObj, "DeletedRecordIds") + PersonalNameTableControlObj.DeletedRecordIds = Nothing + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalNameResetButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.CurrentSortOrder.Reset() + If Me.InSession(Me, "Order_By") Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + Me.CurrentSortOrder.Add(PersonalNameTable.NameDate, OrderByItem.OrderDir.Asc) + + + End If + + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalNameSaveButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + + If (Not Me.Page.IsPageRefresh) Then + Me.SaveData() + End If + + Me.Page.CommitTransaction(sender) + ' Set IsNewRecord to False for all records - since everything has been saved and is no longer "new" + Dim recCtl As PersonalNameTableControlRow + For Each recCtl in Me.GetRecordControls() + + recCtl.IsNewRecord = False + Next + + + ' Set DeletedRecordsIds to Nothing since we have deleted all pending deletes. + + Me.DeletedRecordIds = Nothing + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + + + ' Generate the event handling functions for filter and search events. + + + ' Generate the event handling functions for others + + + Private _UIData As New System.Collections.Generic.List(Of Hashtable) + Public Property UIData() As System.Collections.Generic.List(Of Hashtable) + Get + Return Me._UIData + End Get + Set(ByVal value As System.Collections.Generic.List(Of Hashtable)) + Me._UIData = value + End Set + End Property + + ' pagination properties + Protected _PageSize As Integer + Public Property PageSize() As Integer + Get + Return Me._PageSize + End Get + Set(ByVal value As Integer) + Me._PageSize = value + End Set + End Property + + Protected _PageIndex As Integer + Public Property PageIndex() As Integer + Get + ' Return the PageIndex + Return Me._PageIndex + End Get + Set(ByVal value As Integer) + Me._PageIndex = value + End Set + End Property + + Protected _TotalRecords As Integer = -1 + Public Property TotalRecords() As Integer + Get + If _TotalRecords < 0 + _TotalRecords = PersonalNameTable.GetRecordCount(CreateCompoundJoinFilter(), CreateWhereClause()) + End If + Return Me._TotalRecords + End Get + Set(ByVal value As Integer) + If Me.PageSize > 0 Then + + Me.TotalPages = CInt(Math.Ceiling(value / Me.PageSize)) + + End If + Me._TotalRecords = value + End Set + End Property + + + + Protected _TotalPages As Integer = -1 + Public Property TotalPages() As Integer + Get + If _TotalPages < 0 Then + + Me.TotalPages = CInt(Math.Ceiling(TotalRecords / Me.PageSize)) + + End If + Return Me._TotalPages + End Get + Set(ByVal value As Integer) + Me._TotalPages = value + End Set + End Property + + Protected _DisplayLastPage As Boolean + Public Property DisplayLastPage() As Boolean + Get + Return Me._DisplayLastPage + End Get + Set(ByVal value As Boolean) + Me._DisplayLastPage = value + End Set + End Property + + Private _DataChanged As Boolean = False + Public Property DataChanged() As Boolean + Get + Return Me._DataChanged + End Get + Set(ByVal value As Boolean) + Me._DataChanged = value + End Set + End Property + + Private _ResetData As Boolean = False + Public Property ResetData() As Boolean + Get + Return Me._ResetData + End Get + Set(ByVal value As Boolean) + Me._ResetData = value + End Set + End Property + + Private _AddNewRecord As Integer = 0 + Public Property AddNewRecord() As Integer + Get + Return Me._AddNewRecord + End Get + Set(ByVal value As Integer) + Me._AddNewRecord = value + End Set + End Property + + + Private _CurrentSortOrder As OrderBy = Nothing + Public Property CurrentSortOrder() As OrderBy + Get + Return Me._CurrentSortOrder + End Get + Set(ByVal value As BaseClasses.Data.OrderBy) + Me._CurrentSortOrder = value + End Set + End Property + + Private _DataSource() As PersonalNameRecord = Nothing + Public Property DataSource() As PersonalNameRecord () + Get + Return Me._DataSource + End Get + Set(ByVal value() As PersonalNameRecord) + Me._DataSource = value + End Set + End Property + +#Region "Helper Properties" + + Public ReadOnly Property NameDateLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "NameDateLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property PersonalLastNameLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalLastNameLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property PersonalNameAddButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalNameAddButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalNameDeleteButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalNameDeleteButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalNameEditButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalNameEditButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalNameLabel1() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalNameLabel1"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property PersonalNamePagination() As Persons.UI.IPagination + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalNamePagination"), Persons.UI.IPagination) + End Get + End Property + + Public ReadOnly Property PersonalNameRefreshButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalNameRefreshButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalNameResetButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalNameResetButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalNameSaveButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalNameSaveButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalNameTableControlCollapsibleRegion() As System.Web.UI.WebControls.Panel + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalNameTableControlCollapsibleRegion"), System.Web.UI.WebControls.Panel) + End Get + End Property + + Public ReadOnly Property PersonalNameTableControlIcon() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalNameTableControlIcon"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalNameTableControlPanelExtender() As AjaxControlToolkit.CollapsiblePanelExtender + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalNameTableControlPanelExtender"), AjaxControlToolkit.CollapsiblePanelExtender) + End Get + End Property + + Public ReadOnly Property PersonalNameTitle() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalNameTitle"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property PersonalNameToggleAll() As System.Web.UI.WebControls.CheckBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalNameToggleAll"), System.Web.UI.WebControls.CheckBox) + End Get + End Property + + Public ReadOnly Property RefLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RefLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + +#End Region + +#Region "Helper Functions" + + Public Overrides Overloads Function ModifyRedirectUrl(url As String, arg As String, ByVal bEncrypt As Boolean) As String + Return Me.Page.EvaluateExpressions(url, arg, bEncrypt, Me) + End Function + + Public Overrides Overloads Function EvaluateExpressions(url As String, arg As String, ByVal bEncrypt As Boolean) As String + Dim needToProcess As Boolean = AreAnyUrlParametersForMe(url, arg) + If (needToProcess) Then + Dim recCtl As PersonalNameTableControlRow = Me.GetSelectedRecordControl() + If recCtl Is Nothing AndAlso url.IndexOf("{") >= 0 Then + ' Localization. + Throw New Exception(Page.GetResourceValue("Err:NoRecSelected", "Persons")) + End If + Dim rec As PersonalNameRecord = Nothing + If recCtl IsNot Nothing Then + rec = recCtl.GetRecord() + End If + Return EvaluateExpressions(url, arg, rec, bEncrypt) + End If + Return url + End Function + + Public Overridable Function GetSelectedRecordIndex() As Integer + Dim counter As Integer = 0 + Dim recControl As PersonalNameTableControlRow + For Each recControl In Me.GetRecordControls() + If recControl.PersonalNameRecordRowSelection.Checked Then + Return counter + End If + counter += 1 + Next + Return -1 + End Function + + Public Overridable Function GetSelectedRecordControl() As PersonalNameTableControlRow + Dim selectedList() As PersonalNameTableControlRow = Me.GetSelectedRecordControls() + If selectedList.Length = 0 Then + Return Nothing + End If + Return selectedList(0) + + End Function + + Public Overridable Function GetSelectedRecordControls() As PersonalNameTableControlRow() + + Dim selectedList As ArrayList = New ArrayList(25) + Dim recControl As PersonalNameTableControlRow + For Each recControl In Me.GetRecordControls() + If recControl.PersonalNameRecordRowSelection IsNot Nothing AndAlso recControl.PersonalNameRecordRowSelection.Checked Then + selectedList.Add(recControl) + End If + Next + Return DirectCast(selectedList.ToArray(GetType(PersonalNameTableControlRow)), PersonalNameTableControlRow()) + + End Function + + Public Overridable Sub DeleteSelectedRecords(ByVal deferDeletion As Boolean) + Dim recList() As PersonalNameTableControlRow = Me.GetSelectedRecordControls() + If recList.Length = 0 Then + ' Localization. + Throw New Exception(Page.GetResourceValue("Err:NoRecSelected", "Persons")) + End If + + Dim recCtl As PersonalNameTableControlRow + For Each recCtl In recList + If deferDeletion Then + If Not recCtl.IsNewRecord Then + + Me.AddToDeletedRecordIds(recCtl) + + End If + recCtl.Visible = False + + recCtl.PersonalNameRecordRowSelection.Checked = False + + Else + + recCtl.Delete() + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + End If + Next + End Sub + + Public Function GetRecordControls() As PersonalNameTableControlRow() + Dim recList As ArrayList = New ArrayList() + Dim rep As System.Web.UI.WebControls.Repeater = CType(Me.FindControl("PersonalNameTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return Nothing + Dim repItem As System.Web.UI.WebControls.RepeaterItem + + For Each repItem In rep.Items + + Dim recControl As PersonalNameTableControlRow = DirectCast(repItem.FindControl("PersonalNameTableControlRow"), PersonalNameTableControlRow) + recList.Add(recControl) + + Next + + Return DirectCast(recList.ToArray(GetType(PersonalNameTableControlRow)), PersonalNameTableControlRow()) + 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 + + \ No newline at end of file diff --git a/App_Code/PersonalRank/EditPersonalRankTable.Controls.vb b/App_Code/PersonalRank/EditPersonalRankTable.Controls.vb new file mode 100644 index 0000000..50353c3 --- /dev/null +++ b/App_Code/PersonalRank/EditPersonalRankTable.Controls.vb @@ -0,0 +1,3755 @@ + +' This file implements the TableControl, TableControlRow, and RecordControl classes for the +' EditPersonalRankTable.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.EditPersonalRankTable + +#Region "Section 1: Place your customizations here." + + +Public Class PersonalRankTableControlRow + Inherits BasePersonalRankTableControlRow + ' The BasePersonalRankTableControlRow implements code for a ROW within the + ' the PersonalRankTableControl table. The BasePersonalRankTableControlRow implements the DataBind and SaveData methods. + ' The loading of data is actually performed by the LoadData method in the base class of PersonalRankTableControl. + + ' This is the ideal place to add your code customizations. For example, you can override the DataBind, + ' SaveData, GetUIData, and Validate methods. + Public Overrides Sub GetUIData() + + ' Call MyBase.GetUIData + MyBase.GetUIData() + + ' Get PersonalDD Record + Dim myRec As PersonalRankRecord = Me.GetRecord + + ' Set PersonalId field value to new value string + myRec.PersonalId = Utils.SecurityControls.GetCurrentUserID + + End Sub + Protected Overrides Sub PopulatePreRankDropDownList( _ + ByVal selectedValue As String, _ + ByVal maxItems As Integer) + + Me.PreRank.Items.Clear() + + Me.PreRank.Items.Add(New ListItem("", "0")) + Me.PreRank.Items.Add(New ListItem("ว่าที่", "1")) + ' 3. Set the selected value (insert if not already present). + If Not selectedValue Is Nothing AndAlso _ + selectedValue.Trim <> "" AndAlso _ + Not SetSelectedValue(Me.PreRank, selectedValue) AndAlso _ + Not MiscUtils.SetSelectedValue(Me.PreRank, PersonalRankTable.PreRank.Format(selectedValue)) Then + Dim fvalue As String = PersonalRankTable.PreRank.Format(selectedValue) + Dim item As ListItem = New ListItem(fvalue, selectedValue) + item.Selected = True + Me.PreRank.Items.Insert(0, item) + End If + + + ' 4. Insert the language specific "Please Select" item at the top. + Me.PreRank.Items.Insert(0, New ListItem(Page.GetResourceValue("Txt:PleaseSelect", "Persons"), "--PLEASE_SELECT--")) + + End Sub + + Protected Overrides Sub PopulateRankIdDropDownList( _ + ByVal selectedValue As String, _ + ByVal maxItems As Integer) + + ' Populate the RankIdDropDownList with the + ' foreign key values from the Rank table. + + ' This is a four step process. + ' 1. Set up the WHERE and the ORDER BY clause to read from the Rank. + ' 2. Read a total of maxItems from the database and insert them into the RankIdDropDownList. + ' 3. Set the selected value (insert if not already present). + ' 4. Insert the language specific "Please Select" item at the top. + + ' 1. Set up the WHERE and the ORDER BY clause by calling the CreateWhereClause_RankIdDropDownList function. + ' It is better to customize the where clause there. + Dim wc As WhereClause = CreateWhereClause_RankIdDropDownList() + wc.iNOT(RankTable.RankId, BaseFilter.ComparisonOperator.EqualsTo, "34") + wc.iNOT(RankTable.RankId, BaseFilter.ComparisonOperator.EqualsTo, "35") + wc.iNOT(RankTable.RankId, BaseFilter.ComparisonOperator.EqualsTo, "36") + wc.iAND(RankTable.RankId, BaseFilter.ComparisonOperator.Less_Than, "57") + + + Dim orderBy As OrderBy = New OrderBy(False, True) + orderBy.Add(RankTable.ArmyId, OrderByItem.OrderDir.Asc) + orderBy.Add(RankTable.RankId, OrderByItem.OrderDir.Asc) + + ' 2. Read a total of maxItems from the database and insert them into the RankIdDropDownList. + Me.RankId.Items.Clear() + Dim itemValue As RankRecord + For Each itemValue In RankTable.GetRecords(wc, orderBy, 0, maxItems) + ' Create the item and add to the list. + Dim cvalue As String = Nothing + Dim fvalue As String = Nothing + If itemValue.RankIdSpecified Then + cvalue = itemValue.RankId.ToString() + fvalue = itemValue.Format(RankTable.ArmyId) & ", " & itemValue.Format(RankTable.ShortRank) + End If + + Dim item As ListItem = New ListItem(fvalue, cvalue) + Me.RankId.Items.Add(item) + Next + + ' 3. Set the selected value (insert if not already present). + If Not selectedValue Is Nothing AndAlso _ + selectedValue.Trim <> "" AndAlso _ + Not SetSelectedValue(Me.RankId, selectedValue) AndAlso _ + Not MiscUtils.SetSelectedValue(Me.RankId, PersonalRankTable.RankId.Format(selectedValue)) Then + Dim fvalue As String = PersonalRankTable.RankId.Format(selectedValue) + Dim item As ListItem = New ListItem(fvalue, selectedValue) + item.Selected = True + Me.RankId.Items.Insert(0, item) + End If + + + ' 4. Insert the language specific "Please Select" item at the top. + Me.RankId.Items.Insert(0, New ListItem(Page.GetResourceValue("Txt:PleaseSelect", "Persons"), "--PLEASE_SELECT--")) + + End Sub + + + +End Class + + + +Public Class PersonalRankTableControl + Inherits BasePersonalRankTableControl + + ' The BasePersonalRankTableControl class implements the LoadData, DataBind, CreateWhereClause + ' and other methods to load and display the data in a table control. + + ' This is the ideal place to add your code customizations. You can override the LoadData and CreateWhereClause, + ' The PersonalRankTableControlRow class offers another place where you can customize + ' the DataBind, GetUIData, SaveData and Validate methods specific to each row displayed on the table. + Public Overrides Function CreateOrderBy() As OrderBy + ' The CurrentSortOrder is initialized to the sort order on the + ' Query Wizard. It may be modified by the Click handler for any of + ' the column heading to sort or reverse sort by that column. + ' You can add your own sort order, or modify it on the Query Wizard. + Dim orderby As OrderBy = New OrderBy(False, False) + orderby.Add(PersonalRankTable.RankId, OrderByItem.OrderDir.Desc) + orderby.Add(PersonalRankTable.PreRank, OrderByItem.OrderDir.Desc) + Return orderby + 'Return Me.CurrentSortOrder + End Function + +End Class + + + +#End Region + + + +#Region "Section 2: Do not modify this section." + + +' Base class for the PersonalRankTableControlRow control on the EditPersonalRankTable page. +' Do not modify this class. Instead override any method in PersonalRankTableControlRow. +Public Class BasePersonalRankTableControlRow + Inherits Persons.UI.BaseApplicationRecordControl + + ' To customize, override this method in PersonalRankTableControlRow. + Protected Overridable Sub Control_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Init + + Me.ClearControlsFromSession() + End Sub + + ' To customize, override this method in PersonalRankTableControlRow. + Protected Overridable Sub Control_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load + + 'Call LoadFocusScripts from repeater so that onfocus attribute could be added to elements + Me.Page.LoadFocusScripts(Me) + + ' Show confirmation message on Click + Me.PersonalRankRowDeleteButton.Attributes.Add("onClick", "return (confirm('" & (CType(Me.Page,BaseApplicationPage)).GetResourceValue("DeleteRecordConfirm", "Persons") & "'));") + + + ' Register the event handlers. + + AddHandler Me.PersonalRankRowDeleteButton.Click, AddressOf PersonalRankRowDeleteButton_Click + + AddHandler Me.PersonalId.SelectedIndexChanged, AddressOf PersonalId_SelectedIndexChanged + + AddHandler Me.PreRank.SelectedIndexChanged, AddressOf PreRank_SelectedIndexChanged + + AddHandler Me.RankId.SelectedIndexChanged, AddressOf RankId_SelectedIndexChanged + + AddHandler Me.GazetteDate.TextChanged, AddressOf GazetteDate_TextChanged + + AddHandler Me.GazetteNO.TextChanged, AddressOf GazetteNO_TextChanged + + AddHandler Me.GazettePage.TextChanged, AddressOf GazettePage_TextChanged + + AddHandler Me.GazetteSection.TextChanged, AddressOf GazetteSection_TextChanged + + AddHandler Me.RankDate.TextChanged, AddressOf RankDate_TextChanged + + AddHandler Me.Ref1.TextChanged, AddressOf Ref1_TextChanged + + AddHandler Me.RefDate.TextChanged, AddressOf RefDate_TextChanged + + + End Sub + + + Public Overridable Sub LoadData() + + ' Load the data from the database into the DataSource PersonalRank 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 = PersonalRankTable.GetRecord(Me.RecordUniqueId, True) + + Return + End If + + ' Since this is a row in the table, the data for this row is loaded by the + ' LoadData method of the BasePersonalRankTableControl when the data for the entire + ' table is loaded. + + Me.DataSource = New PersonalRankRecord() + + + + End Sub + + ' Populate the UI controls using the DataSource. To customize, override this method in PersonalRankTableControlRow. + 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 + + SetGazetteDate() + SetGazetteNO() + SetGazettePage() + SetGazetteSection() + SetPersonalId() + + + SetPreRank() + SetRankDate() + SetRankId() + SetRef1() + SetRefDate() + + + 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 SetGazetteDate() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.GazetteDate.ID) Then + + Me.GazetteDate.Text = Me.PreviousUIData(Me.GazetteDate.ID).ToString() + + Return + End If + + + ' Set the GazetteDate TextBox on the webpage with value from the + ' PersonalRank database record. + + ' Me.DataSource is the PersonalRank record retrieved from the database. + ' Me.GazetteDate is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetGazetteDate() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.GazetteDateSpecified Then + + ' If the GazetteDate is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalRankTable.GazetteDate, "d MMM yyyy") + + Me.GazetteDate.Text = formattedValue + + Else + + ' GazetteDate is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.GazetteDate.Text = PersonalRankTable.GazetteDate.Format(PersonalRankTable.GazetteDate.DefaultValue, "d MMM yyyy") + + End If + + End Sub + + Public Overridable Sub SetGazetteNO() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.GazetteNO.ID) Then + + Me.GazetteNO.Text = Me.PreviousUIData(Me.GazetteNO.ID).ToString() + + Return + End If + + + ' Set the GazetteNO TextBox on the webpage with value from the + ' PersonalRank database record. + + ' Me.DataSource is the PersonalRank record retrieved from the database. + ' Me.GazetteNO is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetGazetteNO() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.GazetteNOSpecified Then + + ' If the GazetteNO is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalRankTable.GazetteNO) + + Me.GazetteNO.Text = formattedValue + + Else + + ' GazetteNO is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.GazetteNO.Text = PersonalRankTable.GazetteNO.Format(PersonalRankTable.GazetteNO.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetGazettePage() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.GazettePage.ID) Then + + Me.GazettePage.Text = Me.PreviousUIData(Me.GazettePage.ID).ToString() + + Return + End If + + + ' Set the GazettePage TextBox on the webpage with value from the + ' PersonalRank database record. + + ' Me.DataSource is the PersonalRank record retrieved from the database. + ' Me.GazettePage is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetGazettePage() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.GazettePageSpecified Then + + ' If the GazettePage is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalRankTable.GazettePage) + + Me.GazettePage.Text = formattedValue + + Else + + ' GazettePage is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.GazettePage.Text = PersonalRankTable.GazettePage.Format(PersonalRankTable.GazettePage.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetGazetteSection() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.GazetteSection.ID) Then + + Me.GazetteSection.Text = Me.PreviousUIData(Me.GazetteSection.ID).ToString() + + Return + End If + + + ' Set the GazetteSection TextBox on the webpage with value from the + ' PersonalRank database record. + + ' Me.DataSource is the PersonalRank record retrieved from the database. + ' Me.GazetteSection is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetGazetteSection() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.GazetteSectionSpecified Then + + ' If the GazetteSection is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalRankTable.GazetteSection) + + Me.GazetteSection.Text = formattedValue + + Else + + ' GazetteSection is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.GazetteSection.Text = PersonalRankTable.GazetteSection.Format(PersonalRankTable.GazetteSection.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetPersonalId() + + ' If selection was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.PersonalId.ID) Then + If Me.PreviousUIData(Me.PersonalId.ID) Is Nothing + Me.PopulatePersonalIdDropDownList(Nothing, 100) + Else + Me.PopulatePersonalIdDropDownList(Me.PreviousUIData(Me.PersonalId.ID).ToString(), 100) + End If + Return + End If + + + ' Set the PersonalId DropDownList on the webpage with value from the + ' PersonalRank database record. + + ' Me.DataSource is the PersonalRank record retrieved from the database. + ' Me.PersonalId is the ASP:DropDownList on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetPersonalId() + ' and add your own code before or after the call to the MyBase function. + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.PersonalIdSpecified Then + + ' If the PersonalId is non-NULL, then format the value. + ' The Format method will return the Display Foreign Key As (DFKA) value + Me.PopulatePersonalIdDropDownList(Me.DataSource.PersonalId, 100) + + Else + + ' PersonalId 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.PopulatePersonalIdDropDownList(Nothing, 100) + Else + Me.PopulatePersonalIdDropDownList(PersonalRankTable.PersonalId.DefaultValue, 100) + End If + + End If + + End Sub + + Public Overridable Sub SetPreRank() + + ' If selection was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.PreRank.ID) Then + If Me.PreviousUIData(Me.PreRank.ID) Is Nothing + Me.PopulatePreRankDropDownList(Nothing, 100) + Else + Me.PopulatePreRankDropDownList(Me.PreviousUIData(Me.PreRank.ID).ToString(), 100) + End If + Return + End If + + + ' Set the PreRank DropDownList on the webpage with value from the + ' PersonalRank database record. + + ' Me.DataSource is the PersonalRank record retrieved from the database. + ' Me.PreRank is the ASP:DropDownList on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetPreRank() + ' and add your own code before or after the call to the MyBase function. + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.PreRankSpecified Then + + ' If the PreRank is non-NULL, then format the value. + ' The Format method will use the Display Format + Me.PopulatePreRankDropDownList(Me.DataSource.PreRank.ToString(), 100) + + Else + + ' PreRank 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.PopulatePreRankDropDownList(Nothing, 100) + Else + Me.PopulatePreRankDropDownList(PersonalRankTable.PreRank.DefaultValue, 100) + End If + + End If + + End Sub + + Public Overridable Sub SetRankDate() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.RankDate.ID) Then + + Me.RankDate.Text = Me.PreviousUIData(Me.RankDate.ID).ToString() + + Return + End If + + + ' Set the RankDate TextBox on the webpage with value from the + ' PersonalRank database record. + + ' Me.DataSource is the PersonalRank record retrieved from the database. + ' Me.RankDate is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetRankDate() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.RankDateSpecified Then + + ' If the RankDate is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalRankTable.RankDate, "d MMM yyyy") + + Me.RankDate.Text = formattedValue + + Else + + ' RankDate is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.RankDate.Text = PersonalRankTable.RankDate.Format(PersonalRankTable.RankDate.DefaultValue, "d MMM yyyy") + + End If + + End Sub + + Public Overridable Sub SetRankId() + + ' If selection was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.RankId.ID) Then + If Me.PreviousUIData(Me.RankId.ID) Is Nothing + Me.PopulateRankIdDropDownList(Nothing, 100) + Else + Me.PopulateRankIdDropDownList(Me.PreviousUIData(Me.RankId.ID).ToString(), 100) + End If + Return + End If + + + ' Set the RankId DropDownList on the webpage with value from the + ' PersonalRank database record. + + ' Me.DataSource is the PersonalRank record retrieved from the database. + ' Me.RankId is the ASP:DropDownList on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetRankId() + ' and add your own code before or after the call to the MyBase function. + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.RankIdSpecified Then + + ' If the RankId is non-NULL, then format the value. + ' The Format method will return the Display Foreign Key As (DFKA) value + Me.PopulateRankIdDropDownList(Me.DataSource.RankId.ToString(), 100) + + Else + + ' RankId 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.PopulateRankIdDropDownList(Nothing, 100) + Else + Me.PopulateRankIdDropDownList(PersonalRankTable.RankId.DefaultValue, 100) + End If + + End If + + End Sub + + Public Overridable Sub SetRef1() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.Ref1.ID) Then + + Me.Ref1.Text = Me.PreviousUIData(Me.Ref1.ID).ToString() + + Return + End If + + + ' Set the Ref TextBox on the webpage with value from the + ' PersonalRank database record. + + ' Me.DataSource is the PersonalRank 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(PersonalRankTable.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 = PersonalRankTable.Ref0.Format(PersonalRankTable.Ref0.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetRefDate() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.RefDate.ID) Then + + Me.RefDate.Text = Me.PreviousUIData(Me.RefDate.ID).ToString() + + Return + End If + + + ' Set the RefDate TextBox on the webpage with value from the + ' PersonalRank database record. + + ' Me.DataSource is the PersonalRank 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(PersonalRankTable.RefDate, "d MMM yyyy") + + 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 = PersonalRankTable.RefDate.Format(PersonalRankTable.RefDate.DefaultValue, "d MMM yyyy") + + End If + + End Sub + + + Public EvaluateFormulaDelegate As BaseClasses.Data.DataSource.EvaluateFormulaDelegate = New BaseClasses.Data.DataSource.EvaluateFormulaDelegate(AddressOf Me.EvaluateFormula) + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean, ByVal e As FormulaEvaluator) As String + If e Is Nothing Then + e = New FormulaEvaluator() + End If + + e.Variables.Clear() + + + ' add variables for formula evaluation + If variables IsNot Nothing Then + Dim enumerator As System.Collections.Generic.IEnumerator(Of System.Collections.Generic.KeyValuePair(Of String, Object)) = variables.GetEnumerator() + While enumerator.MoveNext() + e.Variables.Add(enumerator.Current.Key, enumerator.Current.Value) + End While + End If + + If includeDS + + End IF + + + ' Other variables referred to in the formula are expected to be + ' properties of the DataSource. For example, referring to + ' UnitPrice as a variable will refer to DataSource.UnitPrice + If dataSourceForEvaluate Is Nothing Then + + e.DataSource = Me.DataSource + + Else + e.DataSource = dataSourceForEvaluate + End If + + ' Define the calling control. This is used to add other + ' related table and record controls as variables. + e.CallingControl = Me + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + + If Not String.IsNullOrEmpty(format) AndAlso (String.IsNullOrEmpty(formula) OrElse formula.IndexOf("Format(") < 0) Then + Return FormulaUtils.Format(resultObj, format) + Else + Return resultObj.ToString() + End If + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format,variables ,includeDS, Nothing) + End Function + + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object)) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format, variables ,True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, format, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal e as FormulaEvaluator) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, variables, True, e) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal includeDS as Boolean) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, includeDS, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, True, Nothing) + End Function + + + Public Overridable Sub RegisterPostback() + + + End Sub + + + + ' To customize, override this method in PersonalRankTableControlRow. + Public Overridable Sub SaveData() + ' Saves the associated record in the database. + ' SaveData calls Validate and Get methods - so it may be more appropriate to + ' customize those methods. + + ' 1. Load the existing record from the database. Since we save the entire record, this ensures + ' that fields that are not displayed are also properly initialized. + Me.LoadData() + + + ' 2. Perform any custom validation. + Me.Validate() + + + ' 3. Set the values in the record with data from UI controls. + ' This calls the Get() method for each of the user interface controls. + Me.GetUIData() + + ' 4. Save in the database. + ' We should not save the record if the data did not change. This + ' will save a database hit and avoid triggering any database triggers. + + If Me.DataSource.IsAnyValueChanged Then + ' Save record to database but do not commit yet. + ' Auto generated ids are available after saving for use by child (dependent) records. + Me.DataSource.Save() + + DirectCast(GetParentControlObject(Me, "PersonalRankTableControl"), PersonalRankTableControl).DataChanged = True + DirectCast(GetParentControlObject(Me, "PersonalRankTableControl"), PersonalRankTableControl).ResetData = True + End If + + + ' update session or cookie by formula + + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + ' For Master-Detail relationships, save data on the Detail table(s) + + End Sub + + ' To customize, override this method in PersonalRankTableControlRow. + 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. + + GetGazetteDate() + GetGazetteNO() + GetGazettePage() + GetGazetteSection() + GetPersonalId() + GetPreRank() + GetRankDate() + GetRankId() + GetRef1() + GetRefDate() + End Sub + + + Public Overridable Sub GetGazetteDate() + + ' Retrieve the value entered by the user on the GazetteDate ASP:TextBox, and + ' save it into the GazetteDate field in DataSource PersonalRank 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.GazetteDate.Text, PersonalRankTable.GazetteDate) + + + End Sub + + Public Overridable Sub GetGazetteNO() + + ' Retrieve the value entered by the user on the GazetteNO ASP:TextBox, and + ' save it into the GazetteNO field in DataSource PersonalRank record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.GazetteNO.Text, PersonalRankTable.GazetteNO) + + + End Sub + + Public Overridable Sub GetGazettePage() + + ' Retrieve the value entered by the user on the GazettePage ASP:TextBox, and + ' save it into the GazettePage field in DataSource PersonalRank record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.GazettePage.Text, PersonalRankTable.GazettePage) + + + End Sub + + Public Overridable Sub GetGazetteSection() + + ' Retrieve the value entered by the user on the GazetteSection ASP:TextBox, and + ' save it into the GazetteSection field in DataSource PersonalRank record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.GazetteSection.Text, PersonalRankTable.GazetteSection) + + + End Sub + + Public Overridable Sub GetPersonalId() + + ' Retrieve the value entered by the user on the PersonalId ASP:DropDownList, and + ' save it into the PersonalId field in DataSource PersonalRank record. + + ' Custom validation should be performed in Validate, not here. + + Me.DataSource.Parse(GetValueSelectedPageRequest(Me.PersonalId), PersonalRankTable.PersonalId) + + End Sub + + Public Overridable Sub GetPreRank() + + ' Retrieve the value entered by the user on the PreRank ASP:DropDownList, and + ' save it into the PreRank field in DataSource PersonalRank record. + + ' Custom validation should be performed in Validate, not here. + + Me.DataSource.Parse(GetValueSelectedPageRequest(Me.PreRank), PersonalRankTable.PreRank) + + End Sub + + Public Overridable Sub GetRankDate() + + ' Retrieve the value entered by the user on the RankDate ASP:TextBox, and + ' save it into the RankDate field in DataSource PersonalRank 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.RankDate.Text, PersonalRankTable.RankDate) + + + End Sub + + Public Overridable Sub GetRankId() + + ' Retrieve the value entered by the user on the RankId ASP:DropDownList, and + ' save it into the RankId field in DataSource PersonalRank record. + + ' Custom validation should be performed in Validate, not here. + + Me.DataSource.Parse(GetValueSelectedPageRequest(Me.RankId), PersonalRankTable.RankId) + + 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 PersonalRank record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.Ref1.Text, PersonalRankTable.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 PersonalRank 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, PersonalRankTable.RefDate) + + + End Sub + + + ' To customize, override this method in PersonalRankTableControlRow. + + Public Overridable Function CreateWhereClause() As WhereClause + + Return Nothing + + End Function + + + + ' To customize, override this method in PersonalRankTableControlRow. + 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) + PersonalRankTable.DeleteRecord(pkValue) + + DirectCast(GetParentControlObject(Me, "PersonalRankTableControl"), PersonalRankTableControl).DataChanged = True + DirectCast(GetParentControlObject(Me, "PersonalRankTableControl"), PersonalRankTableControl).ResetData = True + End Sub + + Protected Overridable Sub Control_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.PreRender + ' PreRender event is raised just before page is being displayed. + Try + DbUtils.StartTransaction() + Me.RegisterPostback() + + If Not Me.Page.ErrorOnPage AndAlso (Me.Page.IsPageRefresh OrElse Me.DataChanged OrElse Me.ResetData) Then + + + ' Re-load the data and update the web page if necessary. + ' This is typically done during a postback (filter, search button, sort, pagination button). + ' In each of the other click handlers, simply set DataChanged to True to reload the data. + Me.LoadData() + Me.DataBind() + End If + + + Catch ex As Exception + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + Finally + DbUtils.EndTransaction() + End Try + End Sub + + + Protected Overrides Sub SaveControlsToSession() + MyBase.SaveControlsToSession() + + + 'Save pagination state to session. + + End Sub + + + + Protected Overrides Sub ClearControlsFromSession() + MyBase.ClearControlsFromSession() + + + + ' Clear pagination state from session. + + End Sub + + Protected Overrides Sub LoadViewState(ByVal savedState As Object) + MyBase.LoadViewState(savedState) + Dim isNewRecord As String = CType(ViewState("IsNewRecord"), String) + If Not isNewRecord Is Nothing AndAlso isNewRecord.Trim <> "" Then + Me.IsNewRecord = Boolean.Parse(isNewRecord) + End If + + Dim myCheckSum As String = CType(ViewState("CheckSum"), String) + If Not myCheckSum Is Nothing AndAlso myCheckSum.Trim <> "" Then + Me.CheckSum = myCheckSum + End If + + + ' Load view state for pagination control. + + End Sub + + Protected Overrides Function SaveViewState() As Object + ViewState("IsNewRecord") = Me.IsNewRecord.ToString() + ViewState("CheckSum") = Me.CheckSum + + + ' Load view state for pagination control. + + Return MyBase.SaveViewState() + End Function + + + + Public Overridable Function CreateWhereClause_PersonalIdDropDownList() 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 PersonalId table. + ' Examples: + ' wc.iAND(PersonalIdTable.PersonalName, BaseFilter.ComparisonOperator.EqualsTo, "XYZ") + ' wc.iAND(PersonalIdTable.Active, BaseFilter.ComparisonOperator.EqualsTo, "1") + + Dim wc As WhereClause = New WhereClause() + Return wc + + End Function + + + + Public Overridable Function CreateWhereClause_PreRankDropDownList() As WhereClause + ' By default, we simply return a new WhereClause. + ' Add additional where clauses to restrict the items shown in the dropdown list. + + Dim wc As WhereClause = New WhereClause() + Return wc + + End Function + + + + Public Overridable Function CreateWhereClause_RankIdDropDownList() 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 Rank table. + ' Examples: + ' wc.iAND(RankTable.ShortRank, BaseFilter.ComparisonOperator.EqualsTo, "XYZ") + ' wc.iAND(RankTable.Active, BaseFilter.ComparisonOperator.EqualsTo, "1") + + Dim wc As WhereClause = New WhereClause() + Return wc + + End Function + + + ' Fill the PersonalId list. + Protected Overridable Sub PopulatePersonalIdDropDownList( _ + ByVal selectedValue As String, _ + ByVal maxItems As Integer) + + Me.PersonalId.Items.Clear() + + + ' 1. Setup the static list items + + ' Add the Please Select item. + Me.PersonalId.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_PersonalIdDropDownList function. + ' It is better to customize the where clause there. + + Dim wc As WhereClause = CreateWhereClause_PersonalIdDropDownList() + ' Create the ORDER BY clause to sort based on the displayed value. + + + Dim orderBy As OrderBy = New OrderBy(false, false) + orderBy.Add(PersonalIdTable.PersonalName, OrderByItem.OrderDir.Asc) + + Dim variables As System.Collections.Generic.IDictionary(Of String, Object) = New System.Collections.Generic.Dictionary(Of String, Object) + + ' 3. Read a total of maxItems from the database and insert them + Dim itemValues() As PersonalIdRecord = 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 = PersonalIdTable.GetRecords(wc, orderBy, pageNum, maxItems) + For each itemValue As PersonalIdRecord In itemValues + ' Create the item and add to the list. + Dim cvalue As String = Nothing + Dim fvalue As String = Nothing + If itemValue.PersonalIdSpecified Then + cvalue = itemValue.PersonalId.ToString() + + If counter < maxItems AndAlso Me.PersonalId.Items.FindByValue(cvalue) Is Nothing Then + + Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalRankTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalRankTable.PersonalId) + If _isExpandableNonCompositeForeignKey AndAlso PersonalRankTable.PersonalId.IsApplyDisplayAs Then + fvalue = PersonalRankTable.GetDFKA(itemValue, PersonalRankTable.PersonalId) + End If + If (Not _isExpandableNonCompositeForeignKey) Or (String.IsNullOrEmpty(fvalue)) Then + fvalue = itemValue.Format(PersonalIdTable.PersonalName) + End If + + If fvalue Is Nothing OrElse fvalue.Trim() = "" Then fvalue = cvalue + + If (IsNothing(fvalue)) Then + fvalue = "" + End If + + fvalue = fvalue.Trim() + + If ( fvalue.Length > 50 ) Then + fvalue = fvalue.Substring(0, 50) & "..." + End If + + Dim dupItem As ListItem = Me.PersonalId.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.PersonalId.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.PersonalId, selectedValue) AndAlso _ + Not SetSelectedDisplayText(Me.PersonalId, selectedValue)Then + + ' construct a whereclause to query a record with PersonalId.PersonalId = selectedValue + Dim filter2 As CompoundFilter = New CompoundFilter(CompoundFilter.CompoundingOperators.And_Operator, Nothing) + Dim whereClause2 As WhereClause = New WhereClause() + filter2.AddFilter(New BaseClasses.Data.ColumnValueFilter(PersonalIdTable.PersonalId, selectedValue, BaseClasses.Data.BaseFilter.ComparisonOperator.EqualsTo, False)) + whereClause2.AddFilter(filter2, CompoundFilter.CompoundingOperators.And_Operator) + + Try + ' Execute the query + Dim rc() As PersonalIdRecord = PersonalIdTable.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 PersonalIdRecord = DirectCast(rc(0), PersonalIdRecord) + ' Create the item and add to the list. + Dim cvalue As String = Nothing + Dim fvalue As String = Nothing + If itemValue.PersonalIdSpecified Then + cvalue = itemValue.PersonalId.ToString() + Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalRankTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalRankTable.PersonalId) + If _isExpandableNonCompositeForeignKey AndAlso PersonalRankTable.PersonalId.IsApplyDisplayAs Then + fvalue = PersonalRankTable.GetDFKA(itemValue, PersonalRankTable.PersonalId) + End If + If (Not _isExpandableNonCompositeForeignKey) Or (String.IsNullOrEmpty(fvalue)) Then + fvalue = itemValue.Format(PersonalIdTable.PersonalName) + End If + + If fvalue Is Nothing OrElse fvalue.Trim() = "" Then fvalue = cvalue + Dim newItem As New ListItem(fvalue, cvalue) + Me.PersonalId.Items.Add(newItem) + SetSelectedValue(Me.PersonalId, selectedValue) + End If + End If + Catch + End Try + + End If + + + End Sub + + ' Fill the PreRank list. + Protected Overridable Sub PopulatePreRankDropDownList( _ + ByVal selectedValue As String, _ + ByVal maxItems As Integer) + + Me.PreRank.Items.Clear() + + + ' 1. Setup the static list items + + Me.PreRank.Items.Add(New ListItem(Me.Page.ExpandResourceValue("{Txt:PleaseSelect}"), "--PLEASE_SELECT--")) + + Me.PreRank.Items.Add(New ListItem(Me.Page.ExpandResourceValue("0"), "0")) + + Me.PreRank.Items.Add(New ListItem(Me.Page.ExpandResourceValue("1"), "1")) + + ' Skip step 2 and 3 because no need to load data from database and insert data + + + ' 4. Set the selected value (insert if not already present). + + If Not selectedValue Is Nothing AndAlso _ + selectedValue.Trim <> "" AndAlso _ + Not SetSelectedValue(Me.PreRank, selectedValue) AndAlso _ + Not SetSelectedDisplayText(Me.PreRank, selectedValue) AndAlso _ + Not SetSelectedDisplayText(Me.PreRank, PersonalRankTable.PreRank.Format(selectedValue))Then + Dim fvalue As String = PersonalRankTable.PreRank.Format(selectedValue) + If fvalue Is Nothing OrElse fvalue.Trim() = "" Then fvalue = selectedValue + Dim item As ListItem = New ListItem(fvalue, selectedValue) + item.Selected = True + Me.PreRank.Items.Add(item) + End If + + + End Sub + + ' Fill the RankId list. + Protected Overridable Sub PopulateRankIdDropDownList( _ + ByVal selectedValue As String, _ + ByVal maxItems As Integer) + + Me.RankId.Items.Clear() + + + ' 1. Setup the static list items + + ' Add the Please Select item. + Me.RankId.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_RankIdDropDownList function. + ' It is better to customize the where clause there. + + Dim wc As WhereClause = CreateWhereClause_RankIdDropDownList() + ' Create the ORDER BY clause to sort based on the displayed value. + + + Dim orderBy As OrderBy = New OrderBy(false, false) + orderBy.Add(RankTable.ShortRank, 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 RankRecord = 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 = RankTable.GetRecords(wc, orderBy, pageNum, maxItems) + For each itemValue As RankRecord In itemValues + ' Create the item and add to the list. + Dim cvalue As String = Nothing + Dim fvalue As String = Nothing + If itemValue.RankIdSpecified Then + cvalue = itemValue.RankId.ToString() + + If counter < maxItems AndAlso Me.RankId.Items.FindByValue(cvalue) Is Nothing Then + + Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalRankTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalRankTable.RankId) + If _isExpandableNonCompositeForeignKey AndAlso PersonalRankTable.RankId.IsApplyDisplayAs Then + fvalue = PersonalRankTable.GetDFKA(itemValue, PersonalRankTable.RankId) + End If + If (Not _isExpandableNonCompositeForeignKey) Or (String.IsNullOrEmpty(fvalue)) Then + fvalue = itemValue.Format(RankTable.ShortRank) + 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.RankId.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.RankId.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.RankId, selectedValue) AndAlso _ + Not SetSelectedDisplayText(Me.RankId, selectedValue)Then + + ' construct a whereclause to query a record with Rank.RankId = selectedValue + Dim filter2 As CompoundFilter = New CompoundFilter(CompoundFilter.CompoundingOperators.And_Operator, Nothing) + Dim whereClause2 As WhereClause = New WhereClause() + filter2.AddFilter(New BaseClasses.Data.ColumnValueFilter(RankTable.RankId, selectedValue, BaseClasses.Data.BaseFilter.ComparisonOperator.EqualsTo, False)) + whereClause2.AddFilter(filter2, CompoundFilter.CompoundingOperators.And_Operator) + + Try + ' Execute the query + Dim rc() As RankRecord = RankTable.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 RankRecord = DirectCast(rc(0), RankRecord) + ' Create the item and add to the list. + Dim cvalue As String = Nothing + Dim fvalue As String = Nothing + If itemValue.RankIdSpecified Then + cvalue = itemValue.RankId.ToString() + Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalRankTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalRankTable.RankId) + If _isExpandableNonCompositeForeignKey AndAlso PersonalRankTable.RankId.IsApplyDisplayAs Then + fvalue = PersonalRankTable.GetDFKA(itemValue, PersonalRankTable.RankId) + End If + If (Not _isExpandableNonCompositeForeignKey) Or (String.IsNullOrEmpty(fvalue)) Then + fvalue = itemValue.Format(RankTable.ShortRank) + End If + + If fvalue Is Nothing OrElse fvalue.Trim() = "" Then fvalue = cvalue + Dim newItem As New ListItem(fvalue, cvalue) + Me.RankId.Items.Add(newItem) + SetSelectedValue(Me.RankId, selectedValue) + End If + End If + Catch + End Try + + End If + + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalRankRowDeleteButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + If(Not Me.Page.IsPageRefresh) Then + + Dim tc As PersonalRankTableControl = DirectCast(GetParentControlObject(Me, "PersonalRankTableControl"), PersonalRankTableControl) + If Not (IsNothing(tc)) Then + If Not Me.IsNewRecord Then + tc.AddToDeletedRecordIds(DirectCast(Me, PersonalRankTableControlRow)) + End If + Me.Visible = False + tc.SetFormulaControls() + End If + + End If + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + Protected Overridable Sub PersonalId_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()(PersonalId.ClientID & "_SelectedValue"), String) + Dim displayText As String = CType(Me.Page.Session()(PersonalId.ClientID & "_SelectedDisplayText"), String) + If displayText <> "" AndAlso val <> "" Then + Me.PersonalId.Items.Add(New ListItem(displayText, val)) + Me.PersonalId.SelectedIndex = Me.PersonalId.Items.Count - 1 + Me.Page.Session.Remove(PersonalId.ClientID & "_SelectedValue") + Me.Page.Session.Remove(PersonalId.ClientID & "_SelectedDisplayText") + End If + + + + + End Sub + + Protected Overridable Sub PreRank_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()(PreRank.ClientID & "_SelectedValue"), String) + Dim displayText As String = CType(Me.Page.Session()(PreRank.ClientID & "_SelectedDisplayText"), String) + If displayText <> "" AndAlso val <> "" Then + Me.PreRank.Items.Add(New ListItem(displayText, val)) + Me.PreRank.SelectedIndex = Me.PreRank.Items.Count - 1 + Me.Page.Session.Remove(PreRank.ClientID & "_SelectedValue") + Me.Page.Session.Remove(PreRank.ClientID & "_SelectedDisplayText") + End If + + + + + End Sub + + Protected Overridable Sub RankId_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()(RankId.ClientID & "_SelectedValue"), String) + Dim displayText As String = CType(Me.Page.Session()(RankId.ClientID & "_SelectedDisplayText"), String) + If displayText <> "" AndAlso val <> "" Then + Me.RankId.Items.Add(New ListItem(displayText, val)) + Me.RankId.SelectedIndex = Me.RankId.Items.Count - 1 + Me.Page.Session.Remove(RankId.ClientID & "_SelectedValue") + Me.Page.Session.Remove(RankId.ClientID & "_SelectedDisplayText") + End If + + + + + End Sub + + Protected Overridable Sub GazetteDate_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub GazetteNO_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub GazettePage_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub GazetteSection_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub RankDate_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 + + + 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("BasePersonalRankTableControlRow_Rec"), String) + End Get + Set(ByVal value As String) + Me.ViewState("BasePersonalRankTableControlRow_Rec") = value + End Set + End Property + + Private _DataSource As PersonalRankRecord + Public Property DataSource() As PersonalRankRecord + Get + Return Me._DataSource + End Get + + Set(ByVal value As PersonalRankRecord) + + Me._DataSource = value + End Set + End Property + + + + Private _checkSum As String + Public Overridable Property CheckSum() As String + Get + Return Me._checkSum + End Get + Set(ByVal value As String) + Me._checkSum = value + End Set + End Property + + Private _TotalPages As Integer + Public Property TotalPages() As Integer + Get + Return Me._TotalPages + End Get + Set(ByVal value As Integer) + Me._TotalPages = value + End Set + End Property + + Private _PageIndex As Integer + Public Property PageIndex() As Integer + Get + ' Return the PageIndex + Return Me._PageIndex + End Get + Set(ByVal value As Integer) + Me._PageIndex = value + End Set + End Property + + Private _DisplayLastPage As Boolean + Public Property DisplayLastPage() As Boolean + Get + Return Me._DisplayLastPage + End Get + Set(ByVal value As Boolean) + Me._DisplayLastPage = value + End Set + End Property + + + +#Region "Helper Properties" + + Public ReadOnly Property GazetteDate() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "GazetteDate"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property GazetteNO() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "GazetteNO"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property GazettePage() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "GazettePage"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property GazetteSection() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "GazetteSection"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property PersonalId() As System.Web.UI.WebControls.DropDownList + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalId"), System.Web.UI.WebControls.DropDownList) + End Get + End Property + + Public ReadOnly Property PersonalRankRecordRowSelection() As System.Web.UI.WebControls.CheckBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalRankRecordRowSelection"), System.Web.UI.WebControls.CheckBox) + End Get + End Property + + Public ReadOnly Property PersonalRankRowDeleteButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalRankRowDeleteButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PreRank() As System.Web.UI.WebControls.DropDownList + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PreRank"), System.Web.UI.WebControls.DropDownList) + End Get + End Property + + Public ReadOnly Property RankDate() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RankDate"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property RankId() As System.Web.UI.WebControls.DropDownList + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RankId"), System.Web.UI.WebControls.DropDownList) + 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 + +#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 PersonalRankRecord = 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 PersonalRankRecord + If Not Me.DataSource Is Nothing Then + Return Me.DataSource + End If + + If Not Me.RecordUniqueId Is Nothing Then + + Return PersonalRankTable.GetRecord(Me.RecordUniqueId, True) + + End If + + ' Localization. + + Throw New Exception(Page.GetResourceValue("Err:RetrieveRec", "Persons")) + + End Function + + Public Shadows ReadOnly Property Page() As BaseApplicationPage + Get + Return DirectCast(MyBase.Page, BaseApplicationPage) + End Get + End Property + +#End Region + +End Class + + + +' Base class for the PersonalRankTableControl control on the EditPersonalRankTable page. +' Do not modify this class. Instead override any method in PersonalRankTableControl. +Public Class BasePersonalRankTableControl + Inherits Persons.UI.BaseApplicationTableControl + + + + Protected Overridable Sub Control_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Init + + + + ' Setup the filter and search events. + + + + ' Control Initializations. + ' Initialize the table's current sort order. + + If Me.InSession(Me, "Order_By") Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + End If + + + + ' Setup default pagination settings. + + Me.PageSize = CInt(Me.GetFromSession(Me, "Page_Size", "10")) + Me.PageIndex = CInt(Me.GetFromSession(Me, "Page_Index", "0")) + + + + Me.ClearControlsFromSession() + End Sub + + Protected Overridable Sub Control_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load + + SaveControlsToSession_Ajax() + + ' Show confirmation message on Click + Me.PersonalRankDeleteButton.Attributes.Add("onClick", "return (confirm('" & (CType(Me.Page,BaseApplicationPage)).GetResourceValue("DeleteConfirm", "Persons") & "'));") + + ' Setup the pagination events. + + AddHandler Me.PersonalRankPagination.FirstPage.Click, AddressOf PersonalRankPagination_FirstPage_Click + + AddHandler Me.PersonalRankPagination.LastPage.Click, AddressOf PersonalRankPagination_LastPage_Click + + AddHandler Me.PersonalRankPagination.NextPage.Click, AddressOf PersonalRankPagination_NextPage_Click + + AddHandler Me.PersonalRankPagination.PageSizeButton.Click, AddressOf PersonalRankPagination_PageSizeButton_Click + + AddHandler Me.PersonalRankPagination.PreviousPage.Click, AddressOf PersonalRankPagination_PreviousPage_Click + + + ' Setup the sorting events. + + AddHandler Me.GazetteDateLabel.Click, AddressOf GazetteDateLabel_Click + + AddHandler Me.GazetteNOLabel.Click, AddressOf GazetteNOLabel_Click + + AddHandler Me.GazettePageLabel.Click, AddressOf GazettePageLabel_Click + + AddHandler Me.GazetteSectionLabel.Click, AddressOf GazetteSectionLabel_Click + + AddHandler Me.PreRankLabel.Click, AddressOf PreRankLabel_Click + + AddHandler Me.RankDateLabel.Click, AddressOf RankDateLabel_Click + + AddHandler Me.RankIdLabel1.Click, AddressOf RankIdLabel1_Click + + AddHandler Me.RefDateLabel.Click, AddressOf RefDateLabel_Click + + AddHandler Me.RefLabel.Click, AddressOf RefLabel_Click + + ' Setup the button events. + + AddHandler Me.PersonalRankAddButton.Click, AddressOf PersonalRankAddButton_Click + + AddHandler Me.PersonalRankDeleteButton.Click, AddressOf PersonalRankDeleteButton_Click + + AddHandler Me.PersonalRankEditButton.Click, AddressOf PersonalRankEditButton_Click + + AddHandler Me.PersonalRankRefreshButton.Click, AddressOf PersonalRankRefreshButton_Click + + AddHandler Me.PersonalRankResetButton.Click, AddressOf PersonalRankResetButton_Click + + AddHandler Me.PersonalRankSaveButton.Click, AddressOf PersonalRankSaveButton_Click + + Me.PersonalRankSaveButton.Attributes.Add("onclick", "SubmitHRefOnce(this, """ & Me.Page.GetResourceValue("Txt:SaveRecord", "Persons") & """);") + + + ' Setup events for others + + End Sub + + + Public Overridable Sub LoadData() + + ' Read data from database. Returns an array of records that can be assigned + ' to the DataSource table control property. + Try + Dim joinFilter As CompoundFilter = CreateCompoundJoinFilter() + + ' The WHERE clause will be empty when displaying all records in table. + Dim wc As WhereClause = CreateWhereClause() + If wc IsNot Nothing AndAlso Not wc.RunQuery Then + ' Initialize an empty array of records + Dim alist As New ArrayList(0) + Me.DataSource = DirectCast(alist.ToArray(GetType(PersonalRankRecord)), PersonalRankRecord()) + ' Add records to the list if needed. + Me.AddNewRecords() + Me._TotalRecords = 0 + Me._TotalPages = 0 + Return + End If + + ' Call OrderBy to determine the order - either use the order defined + ' on the Query Wizard, or specified by user (by clicking on column heading) + Dim orderBy As OrderBy = CreateOrderBy() + + ' Get the pagesize from the pagesize control. + Me.GetPageSize() + + If Me.DisplayLastPage Then + Dim totalRecords As Integer = If(Me._TotalRecords < 0, PersonalRankTable.GetRecordCount(CreateCompoundJoinFilter(), CreateWhereClause()), Me._TotalRecords) + + Dim totalPages As Integer = CInt(Math.Ceiling(totalRecords / Me.PageSize)) + + Me.PageIndex = totalPages - 1 + End If + + ' Make sure PageIndex (current page) and PageSize are within bounds. + If Me.PageIndex < 0 Then + Me.PageIndex = 0 + End If + If Me.PageSize < 1 Then + Me.PageSize = 1 + End If + + ' Retrieve the records and set the table DataSource. + ' Only PageSize records are fetched starting at PageIndex (zero based). + If Me.AddNewRecord > 0 Then + ' Make sure to preserve the previously entered data on new rows. + Dim postdata As New ArrayList + For Each rc As PersonalRankTableControlRow In Me.GetRecordControls() + If Not rc.IsNewRecord Then + rc.DataSource = rc.GetRecord() + rc.GetUIData() + postdata.Add(rc.DataSource) + UIData.Add(rc.PreservedUIData()) + End If + Next + Me.DataSource = DirectCast(postdata.ToArray(GetType(PersonalRankRecord)), PersonalRankRecord()) + Else ' Get the records from the database + Me.DataSource = PersonalRankTable.GetRecords(joinFilter, wc, orderBy, Me.PageIndex, Me.PageSize) + + End If + + ' if the datasource contains no records contained in database, then load the last page. + If (DbUtils.GetCreatedRecords(Me.DataSource).Length = 0 AndAlso Not Me.DisplayLastPage) Then + Me.DisplayLastPage = True + LoadData() + Else + + ' Add any new rows desired by the user. + Me.AddNewRecords() + + ' Turn off the ToggleAll checkbox + Me.PersonalRankToggleAll.Checked = False + + + ' Initialize the page and grand totals. now + + End If + + Catch ex As Exception + ' Report the error message to the end user + Dim msg As String = ex.Message + If ex.InnerException IsNot Nothing Then + msg = msg & " InnerException: " & ex.InnerException.Message + End If + Throw New Exception(msg, ex.InnerException) + End Try + End Sub + + + + + Public Overrides Sub DataBind() + ' The DataBind method binds the user interface controls to the values + ' from the database record for each row in the table. To do this, it calls the + ' DataBind for each of the rows. + ' DataBind also populates any filters above the table, and sets the pagination + ' control to the correct number of records and the current page number. + + MyBase.DataBind() + + ' Make sure that the DataSource is initialized. + If Me.DataSource Is Nothing Then + Return + End If + + 'LoadData for DataSource for chart and report if they exist + + ' Improve performance by prefetching display as records. + Me.PreFetchForeignKeyValues() + + ' Setup the pagination controls. + BindPaginationControls() + + + + ' Bind the repeater with the list of records to expand the UI. + Dim rep As System.Web.UI.WebControls.Repeater = CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalRankTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return + rep.DataSource = DataSource() + rep.DataBind() + + Dim index As Integer = 0 + For Each repItem As System.Web.UI.WebControls.RepeaterItem In rep.Items + ' Loop through all rows in the table, set its DataSource and call DataBind(). + Dim recControl As PersonalRankTableControlRow = DirectCast(repItem.FindControl("PersonalRankTableControlRow"), PersonalRankTableControlRow) + recControl.DataSource = Me.DataSource(index) + If Me.UIData.Count > index Then + recControl.PreviousUIData = Me.UIData(index) + End If + recControl.DataBind() + recControl.Visible = Not Me.InDeletedRecordIds(recControl) + + index += 1 + Next + + + + + ' Call the Set methods for each controls on the panel + + SetGazetteDateLabel() + SetGazetteNOLabel() + SetGazettePageLabel() + SetGazetteSectionLabel() + + + + + + + + SetPersonalRankTableControlCollapsibleRegion() + SetPersonalRankTableControlIcon() + SetPersonalRankTableControlPanelExtender() + + + SetPreRankLabel() + SetRankDateLabel() + SetRankIdLabel1() + SetRefDateLabel() + SetRefLabel() + ' setting the state of expand or collapse alternative rows + + + ' Load data for each record and table UI control. + ' Ordering is important because child controls get + ' their parent ids from their parent UI controls. + + + ' this method calls the set method for controls with special formula like running total, sum, rank, etc + SetFormulaControls() + End Sub + + Public Overridable Sub SetFormulaControls() + ' this method calls Set methods for the control that has special formula + + + + End Sub + + + Public Sub PreFetchForeignKeyValues() + If (IsNothing(Me.DataSource)) + Return + End If + + Me.Page.PregetDfkaRecords(PersonalRankTable.PersonalId, Me.DataSource) + + Me.Page.PregetDfkaRecords(PersonalRankTable.RankId, Me.DataSource) + + End Sub + + + Public Overridable Sub RegisterPostback() + + Me.Page.RegisterPostBackTrigger(MiscUtils.FindControlRecursively(Me,"PersonalRankSaveButton")) + + + End Sub + + Public EvaluateFormulaDelegate As BaseClasses.Data.DataSource.EvaluateFormulaDelegate = New BaseClasses.Data.DataSource.EvaluateFormulaDelegate(AddressOf Me.EvaluateFormula) + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean, ByVal e as FormulaEvaluator) As String + If e Is Nothing + e = New FormulaEvaluator() + End If + + e.Variables.Clear() + + + ' add variables for formula evaluation + If variables IsNot Nothing Then + Dim enumerator As System.Collections.Generic.IEnumerator(Of System.Collections.Generic.KeyValuePair(Of String, Object)) = variables.GetEnumerator() + While enumerator.MoveNext() + e.Variables.Add(enumerator.Current.Key, enumerator.Current.Value) + End While + End If + + If includeDS + + End If + + ' All variables referred to in the formula are expected to be + ' properties of the DataSource. For example, referring to + ' UnitPrice as a variable will refer to DataSource.UnitPrice + e.DataSource = dataSourceForEvaluate + + ' Define the calling control. This is used to add other + ' related table and record controls as variables. + e.CallingControl = Me + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + + If Not String.IsNullOrEmpty(format) AndAlso (String.IsNullOrEmpty(formula) OrElse formula.IndexOf("Format(") < 0) Then + Return FormulaUtils.Format(resultObj, format) + Else + Return resultObj.ToString() + End If + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format,variables ,includeDS, Nothing) + End Function + + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object)) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format, variables ,True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, format, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal e as FormulaEvaluator) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, variables, True, e) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal includeDS as Boolean) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, includeDS, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, True, Nothing) + End Function + + + + + Public Overridable Sub ResetControl() + + Me.CurrentSortOrder.Reset() + If (Me.InSession(Me, "Order_By")) Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + End If + + Me.PageIndex = 0 + End Sub + + Protected Overridable Sub BindPaginationControls() + ' Setup the pagination controls. + + ' Bind the pagination labels. + + If DbUtils.GetCreatedRecords(Me.DataSource).Length > 0 Then + + Me.PersonalRankPagination.CurrentPage.Text = (Me.PageIndex + 1).ToString() + Else + Me.PersonalRankPagination.CurrentPage.Text = "0" + End If + Me.PersonalRankPagination.PageSize.Text = Me.PageSize.ToString() + Me.PersonalRankPagination.TotalItems.Text = Me.TotalRecords.ToString() + Me.PersonalRankPagination.TotalPages.Text = Me.TotalPages.ToString() + + ' Bind the buttons for PersonalRankTableControl pagination. + + Me.PersonalRankPagination.FirstPage.Enabled = Not (Me.PageIndex = 0) + If Me._TotalPages < 0 Then ' if the total pages is not determined yet, enable last and next buttons + Me.PersonalRankPagination.LastPage.Enabled = True + ElseIf Me._TotalPages = 0 ' if the total pages is determined and it is 0, enable last and next buttons + Me.PersonalRankPagination.LastPage.Enabled = False + Else ' if the total pages is the last page, disable last and next buttons + Me.PersonalRankPagination.LastPage.Enabled = Not (Me.PageIndex = Me.TotalPages - 1) + End If + + If Me._TotalPages < 0 Then ' if the total pages is not determined yet, enable last and next buttons + Me.PersonalRankPagination.NextPage.Enabled = True + ElseIf Me._TotalPages = 0 ' if the total pages is determined and it is 0, enable last and next buttons + Me.PersonalRankPagination.NextPage.Enabled = False + Else ' if the total pages is the last page, disable last and next buttons + Me.PersonalRankPagination.NextPage.Enabled = Not (Me.PageIndex = Me.TotalPages - 1) + End If + + Me.PersonalRankPagination.PreviousPage.Enabled = Not (Me.PageIndex = 0) + + + End Sub + + Public Overridable Sub SaveData() + ' Save the data from the entire table. Calls each row's Save Data + ' to save their data. This function is called by the Click handler of the + ' Save button. The button handler should Start/Commit/End a transaction. + + Dim recCtl As PersonalRankTableControlRow + For Each recCtl In Me.GetRecordControls() + + If Me.InDeletedRecordIds(recCtl) Then + ' Delete any pending deletes. + recCtl.Delete() + Else + If recCtl.Visible Then + recCtl.SaveData() + End If + End If + + Next + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + ' Set IsNewRecord to False for all records - since everything has been saved and is no longer "new" + For Each recCtl In Me.GetRecordControls() + recCtl.IsNewRecord = False + Next + + + ' Set DeletedRecordsIds to Nothing since we have deleted all pending deletes. + Me.DeletedRecordIds = Nothing + + End Sub + + Public Overridable Function CreateCompoundJoinFilter() As CompoundFilter + Dim jFilter As CompoundFilter = New CompoundFilter() + + Return jFilter + + End Function + + + Public Overridable Function CreateOrderBy() As OrderBy + ' The CurrentSortOrder is initialized to the sort order on the + ' Query Wizard. It may be modified by the Click handler for any of + ' the column heading to sort or reverse sort by that column. + ' You can add your own sort order, or modify it on the Query Wizard. + Return Me.CurrentSortOrder + End Function + + Public Overridable Function CreateWhereClause() As WhereClause + 'This CreateWhereClause is used for loading the data. + PersonalRankTable.Instance.InnerFilter = Nothing + Dim wc As WhereClause = New WhereClause() + + ' Compose the WHERE clause consiting of: + ' 1. Static clause defined at design time. + ' 2. User selected search criteria. + ' 3. User selected filter criteria. + + + ' Get the static clause defined at design time on the Table Panel Wizard + Dim qc As WhereClause = Me.CreateQueryClause() + If Not(IsNothing(qc)) Then + wc.iAND(qc) + End If + + Return wc + End Function + + + Public Overridable Function CreateWhereClause(ByVal searchText as String, ByVal fromSearchControl as String, ByVal AutoTypeAheadSearch as String, ByVal AutoTypeAheadWordSeparators as String) As WhereClause + ' This CreateWhereClause is used for loading list of suggestions for Auto Type-Ahead feature. + PersonalRankTable.Instance.InnerFilter = Nothing + Dim wc As WhereClause = New WhereClause() + + ' Compose the WHERE clause consiting of: + ' 1. Static clause defined at design time. + ' 2. User selected search criteria. + ' 3. User selected filter criteria. + + Dim appRelativeVirtualPath As String = CType(HttpContext.Current.Session("AppRelativeVirtualPath"), String) + + ' Get the static clause defined at design time on the Table Panel Wizard + Dim qc As WhereClause = Me.CreateQueryClause() + If Not(IsNothing(qc)) Then + wc.iAND(qc) + End If + + ' Adds clauses if values are selected in Filter controls which are configured in the page. + + + Return wc + End Function + + Protected Overridable Function CreateQueryClause() As WhereClause + ' Create a where clause for the Static clause defined at design time. + Dim filter As CompoundFilter = New CompoundFilter(CompoundFilter.CompoundingOperators.And_Operator, Nothing) + Dim whereClause As WhereClause = New WhereClause() + + filter.AddFilter(New BaseClasses.Data.SignedInUserFilter(BaseClasses.Data.BaseTable.CreateInstance("Persons.Business.PersonalRankTable, App_Code").TableDefinition.ColumnList.GetByUniqueName("PersonalRank_.PersonalId"), New BaseClasses.Data.IdentifierAliasInfo("PersonalRank_", Nothing), BaseClasses.Data.BaseFilter.ComparisonOperator.EqualsTo, False)) + + whereClause.AddFilter(filter, CompoundFilter.CompoundingOperators.And_Operator) + + Return whereClause + + End Function + + + Public Overridable Function FormatSuggestions(ByVal prefixText As String, ByVal resultItem As String, _ + ByVal columnLength As Integer, ByVal AutoTypeAheadDisplayFoundText As String, _ + ByVal autoTypeAheadSearch As String, ByVal AutoTypeAheadWordSeparators As String, _ + ByVal resultList As ArrayList) As Boolean + + 'Formats the resultItem and adds it to the list of suggestions. + Dim index As Integer = resultItem.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture).IndexOf(prefixText.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture)) + Dim itemToAdd As String = "" + Dim isFound As Boolean = False + Dim isAdded As Boolean = False + ' Get the index where prfixt is at the beginning of resultItem. If not found then, index of word which begins with prefixText. + If InvariantLCase(autoTypeAheadSearch).equals("wordsstartingwithsearchstring") And Not index = 0 Then + ' Expression to find word which contains AutoTypeAheadWordSeparators followed by prefixText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex( AutoTypeAheadWordSeparators + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + If regex1.IsMatch(resultItem) Then + index = regex1.Match(resultItem).Index + isFound = True + End If + ' If the prefixText is found immediatly after white space then starting of the word is found so don not search any further + If not resultItem(index).ToString() = " " Then + ' Expression to find beginning of the word which contains AutoTypeAheadWordSeparators followed by prefixText + Dim regex As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\\S*" + AutoTypeAheadWordSeparators + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + If regex.IsMatch(resultItem) Then + index = regex.Match(resultItem).Index + isFound = True + End If + End If + End If + + ' If autoTypeAheadSearch value is wordsstartingwithsearchstring then, extract the substring only if the prefixText is found at the + ' beginning of the resultItem (index = 0) or a word in resultItem is found starts with prefixText. + If index = 0 Or isFound Or InvariantLCase(autoTypeAheadSearch).Equals("anywhereinstring") then + If InvariantLCase(AutoTypeAheadDisplayFoundText).equals("atbeginningofmatchedstring") Then + ' Expression to find beginning of the word which contains prefixText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\\S*" + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + ' Find the beginning of the word which contains prefexText + If (StringUtils.InvariantLCase(autoTypeAheadSearch).Equals("anywhereinstring") AndAlso regex1.IsMatch(resultItem)) Then + index = regex1.Match(resultItem).Index + isFound = True + End If + ' Display string from the index till end of the string if sub string from index till end is less than columnLength value. + If Len(resultItem) - index <= columnLength Then + If index = 0 Then + itemToAdd = resultItem + Else + itemToAdd = "..." & resultItem.Substring(index, Len(resultItem) - index) + End If + Else + If index = 0 Then + itemToAdd = resultItem.Substring(index, (columnLength - 3)) & "..." + Else + 'Truncate the string to show only columnLength - 6 characters as begining and trailing "..." has to be appended. + itemToAdd = "..." & resultItem.Substring(index , columnLength - 6) & "..." + End If + End If + ElseIf InvariantLCase(AutoTypeAheadDisplayFoundText).equals("inmiddleofmatchedstring") Then + Dim subStringBeginIndex As Integer = CType(columnLength/2, Integer) + If Len(resultItem) <= columnLength Then + itemToAdd = resultItem + Else + ' Sanity check at end of the string + If index + Len(prefixText) = columnLength Then + itemToAdd = "..." & resultItem.Substring(index-columnLength,index) + ElseIf Len(resultItem) - index < subStringBeginIndex Then + ' Display string from the end till columnLength value if, index is closer to the end of the string. + itemToAdd = "..." & resultItem.Substring(Len(resultItem)-columnLength,Len(resultItem)) + ElseIf index <= subStringBeginIndex Then + ' Sanity chet at beginning of the string + itemToAdd = resultItem.Substring(0, columnLength) & "..." + Else + ' Display string containing text before the prefixText occures and text after the prefixText + itemToAdd = "..." & resultItem.Substring(index - subStringBeginIndex, columnLength) & "..." + End If + End If + ElseIf InvariantLCase(AutoTypeAheadDisplayFoundText).equals("atendofmatchedstring") Then + ' Expression to find ending of the word which contains prefexText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\s", System.Text.RegularExpressions.RegexOptions.IgnoreCase) + ' Find the ending of the word which contains prefexText + If regex1.IsMatch(resultItem, index + 1) Then + index = regex1.Match(resultItem, index + 1).Index + Else + ' If the word which contains prefexText is the last word in string, regex1.IsMatch returns false. + index = resultItem.Length + End If + If index > Len(resultItem) Then + index = Len(resultItem) + End If + ' If text from beginning of the string till index is less than columnLength value then, display string from the beginning till index. + If index <= columnLength Then + if index = Len(resultItem) Then 'Make decision to append "..." + itemToAdd = resultItem.Substring(0,index) + Else + itemToAdd = resultItem.Substring(0,index) & "..." + End If + Else + If index = Len(resultItem) Then + itemToAdd = "..." & resultItem.Substring(index - (columnLength - 3), (columnLength - 3)) + Else + 'Truncate the string to show only columnLength - 6 characters as begining and trailing "..." has to be appended. + itemToAdd = "..." & resultItem.Substring(index - (columnLength - 6), columnLength - 6) & "..." + End If + End If + End If + + ' Remove newline character from itemToAdd + Dim prefixTextIndex As Integer = itemToAdd.IndexOf(prefixText, StringComparison.CurrentCultureIgnoreCase) + ' If itemToAdd contains any newline after the search text then show text only till newline + Dim regex2 As System.Text.RegularExpressions.Regex = New System.Text.RegularExpressions.Regex("(" & vbCrLf & "|" & vbLf & ")", System.Text.RegularExpressions.RegexOptions.IgnoreCase) + Dim newLineIndexAfterPrefix As Integer = -1 + If regex2.IsMatch(itemToAdd, prefixTextIndex) Then + newLineIndexAfterPrefix = regex2.Match(itemToAdd, prefixTextIndex).Index + End If + If (newLineIndexAfterPrefix > -1) Then + If itemToAdd.EndsWith("...") Then + itemToAdd = (itemToAdd.Substring(0, newLineIndexAfterPrefix) + "...") + Else + itemToAdd = itemToAdd.Substring(0, newLineIndexAfterPrefix) + End If + End If + ' If itemToAdd contains any newline before search text then show text which comes after newline + Dim regex3 As System.Text.RegularExpressions.Regex = New System.Text.RegularExpressions.Regex("(" & vbCrLf & "|" & vbLf & ")", (System.Text.RegularExpressions.RegexOptions.IgnoreCase Or System.Text.RegularExpressions.RegexOptions.RightToLeft)) + Dim newLineIndexBeforePrefix As Integer = -1 + If regex3.IsMatch(itemToAdd, prefixTextIndex) Then + newLineIndexBeforePrefix = regex3.Match(itemToAdd, prefixTextIndex).Index + End If + If (newLineIndexBeforePrefix > -1) Then + If itemToAdd.StartsWith("...") Then + itemToAdd = ("..." + itemToAdd.Substring((newLineIndexBeforePrefix + regex3.Match(itemToAdd, prefixTextIndex).Length))) + Else + itemToAdd = itemToAdd.Substring((newLineIndexBeforePrefix + regex3.Match(itemToAdd, prefixTextIndex).Length)) + End If + End If + + If Not itemToAdd is nothing AndAlso Not resultList.Contains(itemToAdd) Then + + resultList.Add(itemToAdd) + + isAdded = true + End If + End If + Return isAdded + End Function + + + Protected Overridable Sub GetPageSize() + + If Me.PersonalRankPagination.PageSize.Text.Trim <> "" Then + Try + 'Me.PageSize = Integer.Parse(Me.PersonalRankPagination.PageSize.Text) + Catch ex As Exception + End Try + End If + End Sub + + Protected Overridable Sub AddNewRecords() + + Dim newRecordList As ArrayList = New ArrayList() + + Dim newUIDataList As System.Collections.Generic.List(Of Hashtable) = New System.Collections.Generic.List(Of Hashtable)() + + ' Loop though all the record controls and if the record control + ' does not have a unique record id set, then create a record + ' and add to the list. + If Not Me.ResetData Then + Dim rep As System.Web.UI.WebControls.Repeater = CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalRankTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return + + Dim repItem As System.Web.UI.WebControls.RepeaterItem + For Each repItem In rep.Items + ' Loop through all rows in the table, set its DataSource and call DataBind(). + + Dim recControl As PersonalRankTableControlRow = DirectCast(repItem.FindControl("PersonalRankTableControlRow"), PersonalRankTableControlRow) + + If recControl.Visible AndAlso recControl.IsNewRecord() Then + + Dim rec As PersonalRankRecord = New PersonalRankRecord() + + If recControl.GazetteDate.Text <> "" Then + rec.Parse(recControl.GazetteDate.Text, PersonalRankTable.GazetteDate) + End If + If recControl.GazetteNO.Text <> "" Then + rec.Parse(recControl.GazetteNO.Text, PersonalRankTable.GazetteNO) + End If + If recControl.GazettePage.Text <> "" Then + rec.Parse(recControl.GazettePage.Text, PersonalRankTable.GazettePage) + End If + If recControl.GazetteSection.Text <> "" Then + rec.Parse(recControl.GazetteSection.Text, PersonalRankTable.GazetteSection) + End If + If MiscUtils.IsValueSelected(recControl.PersonalId) Then + rec.Parse(recControl.PersonalId.SelectedItem.Value, PersonalRankTable.PersonalId) + End If + If MiscUtils.IsValueSelected(recControl.PreRank) Then + rec.Parse(recControl.PreRank.SelectedItem.Value, PersonalRankTable.PreRank) + End If + If recControl.RankDate.Text <> "" Then + rec.Parse(recControl.RankDate.Text, PersonalRankTable.RankDate) + End If + If MiscUtils.IsValueSelected(recControl.RankId) Then + rec.Parse(recControl.RankId.SelectedItem.Value, PersonalRankTable.RankId) + End If + If recControl.Ref1.Text <> "" Then + rec.Parse(recControl.Ref1.Text, PersonalRankTable.Ref0) + End If + If recControl.RefDate.Text <> "" Then + rec.Parse(recControl.RefDate.Text, PersonalRankTable.RefDate) + End If + newUIDataList.Add(recControl.PreservedUIData()) + newRecordList.Add(rec) + End If + Next + End If + + + ' Add any new record to the list. + Dim index As Integer = 0 + For index = 1 To Me.AddNewRecord + + newRecordList.Insert(0, New PersonalRankRecord()) + newUIDataList.Insert(0, New Hashtable()) + + Next + Me.AddNewRecord = 0 + + ' Finally, add any new records to the DataSource. + If newRecordList.Count > 0 Then + + Dim finalList As ArrayList = New ArrayList(Me.DataSource) + finalList.InsertRange(0, newRecordList) + + Me.DataSource = DirectCast(finalList.ToArray(GetType(PersonalRankRecord)), PersonalRankRecord()) + + End If + + ' Add the existing UI data to this hash table + If newUIDataList.Count > 0 Then + Me.UIData.InsertRange(0, newUIDataList) + End If + + End Sub + + + Public Sub AddToDeletedRecordIds(ByVal rec As PersonalRankTableControlRow) + If rec.IsNewRecord() Then + Return + End If + + If Not Me.DeletedRecordIds Is Nothing AndAlso Me.DeletedRecordIds.Trim <> "" Then + Me.DeletedRecordIds &= "," + End If + + Me.DeletedRecordIds &= "[" & rec.RecordUniqueId & "]" + End Sub + + Protected Overridable Function InDeletedRecordIds(ByVal rec As PersonalRankTableControlRow) As Boolean + If Me.DeletedRecordIds Is Nothing OrElse Me.DeletedRecordIds.Trim = "" Then + Return False + End If + + Return Me.DeletedRecordIds.IndexOf("[" & rec.RecordUniqueId & "]") >= 0 + End Function + + Private _DeletedRecordIds As String + Public Property DeletedRecordIds() As String + Get + Return Me._DeletedRecordIds + End Get + Set(ByVal value As String) + Me._DeletedRecordIds = value + End Set + End Property + + + ' Create Set, WhereClause, and Populate Methods + + Public Overridable Sub SetGazetteDateLabel() + + End Sub + + Public Overridable Sub SetGazetteNOLabel() + + End Sub + + Public Overridable Sub SetGazettePageLabel() + + End Sub + + Public Overridable Sub SetGazetteSectionLabel() + + End Sub + + Public Overridable Sub SetPersonalRankTableControlCollapsibleRegion() + + End Sub + + Public Overridable Sub SetPersonalRankTableControlIcon() + + End Sub + + Public Overridable Sub SetPersonalRankTableControlPanelExtender() + + End Sub + + Public Overridable Sub SetPreRankLabel() + + End Sub + + Public Overridable Sub SetRankDateLabel() + + End Sub + + Public Overridable Sub SetRankIdLabel1() + + End Sub + + Public Overridable Sub SetRefDateLabel() + + End Sub + + Public Overridable Sub SetRefLabel() + + 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. + Dim added As Boolean = Me.AddNewRecord > 0 + Me.LoadData() + Me.DataBind() + + If added Then + Me.SetFocusToAddedRow() + End If + + End If + + + + Catch ex As Exception + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + Finally + DbUtils.EndTransaction + End Try + End Sub + + 'this function sets focus to the first editable element in the new added row in the editable table + Protected Overridable Sub SetFocusToAddedRow() + Dim rep As System.Web.UI.WebControls.Repeater = CType(Me.FindControl("PersonalRankTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing OrElse rep.Items.Count = 0 Then Return + Dim repItem As System.Web.UI.WebControls.RepeaterItem + For Each repItem In rep.Items + 'Load scripts to table rows + Me.Page.LoadFocusScripts(repItem) + Dim recControl As PersonalRankTableControlRow = DirectCast(repItem.FindControl("PersonalRankTableControlRow"), PersonalRankTableControlRow) + If recControl.IsNewRecord Then + For Each field As Control In recControl.Controls + If field.Visible AndAlso Me.Page.IsControlEditable(field, False) Then + 'set focus on the first editable field in the new row + field.Focus() + Dim updPan As UpdatePanel = DirectCast(Me.Page.FindControlRecursively("UpdatePanel1"), UpdatePanel) + If Not updPan Is Nothing Then updPan.Update() + Return + End If + Next + Return + End If + Next + End Sub + + + Protected Overrides Sub SaveControlsToSession() + MyBase.SaveControlsToSession() + + ' Save filter controls to values to session. + + + 'Save pagination state to session. + + + + ' Save table control properties to the session. + If Not Me.CurrentSortOrder Is Nothing Then + Me.SaveToSession(Me, "Order_By", Me.CurrentSortOrder.ToXmlString()) + End If + + Me.SaveToSession(Me, "Page_Index", Me.PageIndex.ToString()) + Me.SaveToSession(Me, "Page_Size", Me.PageSize.ToString()) + + Me.SaveToSession(Me, "DeletedRecordIds", Me.DeletedRecordIds) + + End Sub + + Protected Sub SaveControlsToSession_Ajax() + ' Save filter controls to values to session. + + HttpContext.Current.Session("AppRelativeVirtualPath") = Me.Page.AppRelativeVirtualPath + + End Sub + + Protected Overrides Sub ClearControlsFromSession() + MyBase.ClearControlsFromSession() + + ' Clear filter controls values from the session. + + + ' Clear pagination state from session. + + + + ' Clear table properties from the session. + Me.RemoveFromSession(Me, "Order_By") + Me.RemoveFromSession(Me, "Page_Index") + Me.RemoveFromSession(Me, "Page_Size") + + Me.RemoveFromSession(Me, "DeletedRecordIds") + + End Sub + + Protected Overrides Sub LoadViewState(ByVal savedState As Object) + MyBase.LoadViewState(savedState) + + Dim orderByStr As String = CType(ViewState("PersonalRankTableControl_OrderBy"), String) + + If orderByStr IsNot Nothing AndAlso orderByStr.Trim <> "" Then + Me.CurrentSortOrder = BaseClasses.Data.OrderBy.FromXmlString(orderByStr) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + End If + + Dim pageIndex As String = CType(ViewState("Page_Index"), String) + If pageIndex IsNot Nothing Then + Me.PageIndex = CInt(pageIndex) + End If + + Dim pageSize As String = CType(ViewState("Page_Size"), String) + If Not pageSize Is Nothing Then + Me.PageSize = CInt(pageSize) + End If + + + + ' Load view state for pagination control. + + Me.DeletedRecordIds = CType(Me.ViewState("DeletedRecordIds"), String) + + End Sub + + Protected Overrides Function SaveViewState() As Object + + If Me.CurrentSortOrder IsNot Nothing Then + Me.ViewState("PersonalRankTableControl_OrderBy") = Me.CurrentSortOrder.ToXmlString() + End If + + Me.ViewState("Page_Index") = Me.PageIndex + Me.ViewState("Page_Size") = Me.PageSize + + Me.ViewState("DeletedRecordIds") = Me.DeletedRecordIds + + + ' Load view state for pagination control. + + + Return MyBase.SaveViewState() + End Function + + ' Generate the event handling functions for pagination events. + + ' event handler for ImageButton + Public Overridable Sub PersonalRankPagination_FirstPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.PageIndex = 0 + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalRankPagination_LastPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.DisplayLastPage = True + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalRankPagination_NextPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.PageIndex += 1 + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for LinkButton + Public Overridable Sub PersonalRankPagination_PageSizeButton_Click(ByVal sender As Object, ByVal args As EventArgs) + + Try + + Me.DataChanged = True + + Me.PageSize = Integer.Parse(Me.PersonalRankPagination.PageSize.Text) + + Me.PageIndex = Integer.Parse(Me.PersonalRankPagination.CurrentPage.Text) - 1 + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalRankPagination_PreviousPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + If Me.PageIndex > 0 Then + Me.PageIndex -= 1 + Me.DataChanged = True + End If + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + + ' Generate the event handling functions for sorting events. + + Public Overridable Sub GazetteDateLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by GazetteDate when clicked. + + ' Get previous sorting state for GazetteDate. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalRankTable.GazetteDate) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for GazetteDate. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalRankTable.GazetteDate, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by GazetteDate, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub GazetteNOLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by GazetteNO when clicked. + + ' Get previous sorting state for GazetteNO. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalRankTable.GazetteNO) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for GazetteNO. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalRankTable.GazetteNO, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by GazetteNO, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub GazettePageLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by GazettePage when clicked. + + ' Get previous sorting state for GazettePage. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalRankTable.GazettePage) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for GazettePage. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalRankTable.GazettePage, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by GazettePage, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub GazetteSectionLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by GazetteSection when clicked. + + ' Get previous sorting state for GazetteSection. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalRankTable.GazetteSection) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for GazetteSection. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalRankTable.GazetteSection, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by GazetteSection, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub PreRankLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by PreRank when clicked. + + ' Get previous sorting state for PreRank. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalRankTable.PreRank) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for PreRank. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalRankTable.PreRank, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by PreRank, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub RankDateLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by RankDate when clicked. + + ' Get previous sorting state for RankDate. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalRankTable.RankDate) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for RankDate. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalRankTable.RankDate, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by RankDate, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub RankIdLabel1_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by RankId when clicked. + + ' Get previous sorting state for RankId. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalRankTable.RankId) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for RankId. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalRankTable.RankId, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by RankId, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub RefDateLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by RefDate when clicked. + + ' Get previous sorting state for RefDate. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalRankTable.RefDate) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for RefDate. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalRankTable.RefDate, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by RefDate, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub RefLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by Ref when clicked. + + ' Get previous sorting state for Ref. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalRankTable.Ref0) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for Ref. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalRankTable.Ref0, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by Ref, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + + ' Generate the event handling functions for button events. + + ' event handler for ImageButton + Public Overridable Sub PersonalRankAddButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + Me.AddNewRecord = 1 + Me.DataChanged = True + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalRankDeleteButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + If(Not Me.Page.IsPageRefresh) Then + + Me.DeleteSelectedRecords(True) + Me.SetFormulaControls() + + + End If + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalRankEditButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + ' The redirect URL is set on the Properties, Custom Properties or Actions. + ' The ModifyRedirectURL call resolves the parameters before the + ' Response.Redirect redirects the page to the URL. + ' Any code after the Response.Redirect call will not be executed, since the page is + ' redirected to the URL. + + + Dim url As String = "../Shared/ConfigureEditRecord.aspx" + + Dim shouldRedirect As Boolean = True + Dim TargetKey As String = Nothing + Dim DFKA As String = TargetKey + Dim id As String = DFKA + Dim value As String = id + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + url = Me.ModifyRedirectUrl(url, "",False) + url = Me.Page.ModifyRedirectUrl(url, "",False) + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + shouldRedirect = False + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + If shouldRedirect Then + Me.Page.ShouldSaveControlsToSession = True + Me.Page.Response.Redirect(url) + ElseIf Not TargetKey Is Nothing AndAlso _ + Not shouldRedirect Then + Me.Page.ShouldSaveControlsToSession = True + Me.Page.CloseWindow(True) + + End If + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalRankRefreshButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Dim PersonalRankTableControlObj as PersonalRankTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalRankTableControl"), PersonalRankTableControl) + PersonalRankTableControlObj.ResetData = True + + PersonalRankTableControlObj.RemoveFromSession(PersonalRankTableControlObj, "DeletedRecordIds") + PersonalRankTableControlObj.DeletedRecordIds = Nothing + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalRankResetButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.CurrentSortOrder.Reset() + If Me.InSession(Me, "Order_By") Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + + End If + + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalRankSaveButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + + If (Not Me.Page.IsPageRefresh) Then + Me.SaveData() + End If + + Me.Page.CommitTransaction(sender) + ' Set IsNewRecord to False for all records - since everything has been saved and is no longer "new" + Dim recCtl As PersonalRankTableControlRow + For Each recCtl in Me.GetRecordControls() + + recCtl.IsNewRecord = False + Next + + + ' Set DeletedRecordsIds to Nothing since we have deleted all pending deletes. + + Me.DeletedRecordIds = Nothing + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + + + ' Generate the event handling functions for filter and search events. + + + ' Generate the event handling functions for others + + + Private _UIData As New System.Collections.Generic.List(Of Hashtable) + Public Property UIData() As System.Collections.Generic.List(Of Hashtable) + Get + Return Me._UIData + End Get + Set(ByVal value As System.Collections.Generic.List(Of Hashtable)) + Me._UIData = value + End Set + End Property + + ' pagination properties + Protected _PageSize As Integer + Public Property PageSize() As Integer + Get + Return Me._PageSize + End Get + Set(ByVal value As Integer) + Me._PageSize = value + End Set + End Property + + Protected _PageIndex As Integer + Public Property PageIndex() As Integer + Get + ' Return the PageIndex + Return Me._PageIndex + End Get + Set(ByVal value As Integer) + Me._PageIndex = value + End Set + End Property + + Protected _TotalRecords As Integer = -1 + Public Property TotalRecords() As Integer + Get + If _TotalRecords < 0 + _TotalRecords = PersonalRankTable.GetRecordCount(CreateCompoundJoinFilter(), CreateWhereClause()) + End If + Return Me._TotalRecords + End Get + Set(ByVal value As Integer) + If Me.PageSize > 0 Then + + Me.TotalPages = CInt(Math.Ceiling(value / Me.PageSize)) + + End If + Me._TotalRecords = value + End Set + End Property + + + + Protected _TotalPages As Integer = -1 + Public Property TotalPages() As Integer + Get + If _TotalPages < 0 Then + + Me.TotalPages = CInt(Math.Ceiling(TotalRecords / Me.PageSize)) + + End If + Return Me._TotalPages + End Get + Set(ByVal value As Integer) + Me._TotalPages = value + End Set + End Property + + Protected _DisplayLastPage As Boolean + Public Property DisplayLastPage() As Boolean + Get + Return Me._DisplayLastPage + End Get + Set(ByVal value As Boolean) + Me._DisplayLastPage = value + End Set + End Property + + Private _DataChanged As Boolean = False + Public Property DataChanged() As Boolean + Get + Return Me._DataChanged + End Get + Set(ByVal value As Boolean) + Me._DataChanged = value + End Set + End Property + + Private _ResetData As Boolean = False + Public Property ResetData() As Boolean + Get + Return Me._ResetData + End Get + Set(ByVal value As Boolean) + Me._ResetData = value + End Set + End Property + + Private _AddNewRecord As Integer = 0 + Public Property AddNewRecord() As Integer + Get + Return Me._AddNewRecord + End Get + Set(ByVal value As Integer) + Me._AddNewRecord = value + End Set + End Property + + + Private _CurrentSortOrder As OrderBy = Nothing + Public Property CurrentSortOrder() As OrderBy + Get + Return Me._CurrentSortOrder + End Get + Set(ByVal value As BaseClasses.Data.OrderBy) + Me._CurrentSortOrder = value + End Set + End Property + + Private _DataSource() As PersonalRankRecord = Nothing + Public Property DataSource() As PersonalRankRecord () + Get + Return Me._DataSource + End Get + Set(ByVal value() As PersonalRankRecord) + Me._DataSource = value + End Set + End Property + +#Region "Helper Properties" + + Public ReadOnly Property GazetteDateLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "GazetteDateLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property GazetteNOLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "GazetteNOLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property GazettePageLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "GazettePageLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property GazetteSectionLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "GazetteSectionLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property PersonalRankAddButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalRankAddButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalRankDeleteButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalRankDeleteButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalRankEditButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalRankEditButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalRankPagination() As Persons.UI.IPagination + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalRankPagination"), Persons.UI.IPagination) + End Get + End Property + + Public ReadOnly Property PersonalRankRefreshButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalRankRefreshButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalRankResetButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalRankResetButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalRankSaveButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalRankSaveButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalRankTableControlCollapsibleRegion() As System.Web.UI.WebControls.Panel + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalRankTableControlCollapsibleRegion"), System.Web.UI.WebControls.Panel) + End Get + End Property + + Public ReadOnly Property PersonalRankTableControlIcon() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalRankTableControlIcon"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalRankTableControlPanelExtender() As AjaxControlToolkit.CollapsiblePanelExtender + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalRankTableControlPanelExtender"), AjaxControlToolkit.CollapsiblePanelExtender) + End Get + End Property + + Public ReadOnly Property PersonalRankTitle() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalRankTitle"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property PersonalRankToggleAll() As System.Web.UI.WebControls.CheckBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalRankToggleAll"), System.Web.UI.WebControls.CheckBox) + End Get + End Property + + Public ReadOnly Property PreRankLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PreRankLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property RankDateLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RankDateLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property RankIdLabel1() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RankIdLabel1"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property RefDateLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RefDateLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property RefLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RefLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + +#End Region + +#Region "Helper Functions" + + Public Overrides Overloads Function ModifyRedirectUrl(url As String, arg As String, ByVal bEncrypt As Boolean) As String + Return Me.Page.EvaluateExpressions(url, arg, bEncrypt, Me) + End Function + + Public Overrides Overloads Function EvaluateExpressions(url As String, arg As String, ByVal bEncrypt As Boolean) As String + Dim needToProcess As Boolean = AreAnyUrlParametersForMe(url, arg) + If (needToProcess) Then + Dim recCtl As PersonalRankTableControlRow = Me.GetSelectedRecordControl() + If recCtl Is Nothing AndAlso url.IndexOf("{") >= 0 Then + ' Localization. + Throw New Exception(Page.GetResourceValue("Err:NoRecSelected", "Persons")) + End If + Dim rec As PersonalRankRecord = Nothing + If recCtl IsNot Nothing Then + rec = recCtl.GetRecord() + End If + Return EvaluateExpressions(url, arg, rec, bEncrypt) + End If + Return url + End Function + + Public Overridable Function GetSelectedRecordIndex() As Integer + Dim counter As Integer = 0 + Dim recControl As PersonalRankTableControlRow + For Each recControl In Me.GetRecordControls() + If recControl.PersonalRankRecordRowSelection.Checked Then + Return counter + End If + counter += 1 + Next + Return -1 + End Function + + Public Overridable Function GetSelectedRecordControl() As PersonalRankTableControlRow + Dim selectedList() As PersonalRankTableControlRow = Me.GetSelectedRecordControls() + If selectedList.Length = 0 Then + Return Nothing + End If + Return selectedList(0) + + End Function + + Public Overridable Function GetSelectedRecordControls() As PersonalRankTableControlRow() + + Dim selectedList As ArrayList = New ArrayList(25) + Dim recControl As PersonalRankTableControlRow + For Each recControl In Me.GetRecordControls() + If recControl.PersonalRankRecordRowSelection IsNot Nothing AndAlso recControl.PersonalRankRecordRowSelection.Checked Then + selectedList.Add(recControl) + End If + Next + Return DirectCast(selectedList.ToArray(GetType(PersonalRankTableControlRow)), PersonalRankTableControlRow()) + + End Function + + Public Overridable Sub DeleteSelectedRecords(ByVal deferDeletion As Boolean) + Dim recList() As PersonalRankTableControlRow = Me.GetSelectedRecordControls() + If recList.Length = 0 Then + ' Localization. + Throw New Exception(Page.GetResourceValue("Err:NoRecSelected", "Persons")) + End If + + Dim recCtl As PersonalRankTableControlRow + For Each recCtl In recList + If deferDeletion Then + If Not recCtl.IsNewRecord Then + + Me.AddToDeletedRecordIds(recCtl) + + End If + recCtl.Visible = False + + recCtl.PersonalRankRecordRowSelection.Checked = False + + Else + + recCtl.Delete() + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + End If + Next + End Sub + + Public Function GetRecordControls() As PersonalRankTableControlRow() + Dim recList As ArrayList = New ArrayList() + Dim rep As System.Web.UI.WebControls.Repeater = CType(Me.FindControl("PersonalRankTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return Nothing + Dim repItem As System.Web.UI.WebControls.RepeaterItem + + For Each repItem In rep.Items + + Dim recControl As PersonalRankTableControlRow = DirectCast(repItem.FindControl("PersonalRankTableControlRow"), PersonalRankTableControlRow) + recList.Add(recControl) + + Next + + Return DirectCast(recList.ToArray(GetType(PersonalRankTableControlRow)), PersonalRankTableControlRow()) + 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 + + \ No newline at end of file diff --git a/App_Code/PersonalSalary/EditPersonalSalaryTable.Controls.vb b/App_Code/PersonalSalary/EditPersonalSalaryTable.Controls.vb new file mode 100644 index 0000000..7fb423d --- /dev/null +++ b/App_Code/PersonalSalary/EditPersonalSalaryTable.Controls.vb @@ -0,0 +1,3456 @@ + +' This file implements the TableControl, TableControlRow, and RecordControl classes for the +' EditPersonalSalaryTable.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.EditPersonalSalaryTable + +#Region "Section 1: Place your customizations here." + + +Public Class PersonalSalaryTableControlRow + Inherits BasePersonalSalaryTableControlRow + ' The BasePersonalSalaryTableControlRow implements code for a ROW within the + ' the PersonalSalaryTableControl table. The BasePersonalSalaryTableControlRow implements the DataBind and SaveData methods. + ' The loading of data is actually performed by the LoadData method in the base class of PersonalSalaryTableControl. + + ' This is the ideal place to add your code customizations. For example, you can override the DataBind, + ' SaveData, GetUIData, and Validate methods. + Public Overrides Sub GetUIData() + + ' Call MyBase.GetUIData + MyBase.GetUIData() + + ' Get PersonalDD Record + Dim myRec As PersonalSalaryRecord = Me.GetRecord + + ' Set PersonalId field value to new value string + myRec.PersonalId = Utils.SecurityControls.GetCurrentUserID + + End Sub + + +End Class + + + +Public Class PersonalSalaryTableControl + Inherits BasePersonalSalaryTableControl + + ' The BasePersonalSalaryTableControl class implements the LoadData, DataBind, CreateWhereClause + ' and other methods to load and display the data in a table control. + + ' This is the ideal place to add your code customizations. You can override the LoadData and CreateWhereClause, + ' The PersonalSalaryTableControlRow class offers another place where you can customize + ' the DataBind, GetUIData, SaveData and Validate methods specific to each row displayed on the table. + +End Class + + + +#End Region + + + +#Region "Section 2: Do not modify this section." + + +' Base class for the PersonalSalaryTableControlRow control on the EditPersonalSalaryTable page. +' Do not modify this class. Instead override any method in PersonalSalaryTableControlRow. +Public Class BasePersonalSalaryTableControlRow + Inherits Persons.UI.BaseApplicationRecordControl + + ' To customize, override this method in PersonalSalaryTableControlRow. + Protected Overridable Sub Control_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Init + + Me.ClearControlsFromSession() + End Sub + + ' To customize, override this method in PersonalSalaryTableControlRow. + Protected Overridable Sub Control_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load + + 'Call LoadFocusScripts from repeater so that onfocus attribute could be added to elements + Me.Page.LoadFocusScripts(Me) + + ' Show confirmation message on Click + Me.PersonalSalaryRowDeleteButton.Attributes.Add("onClick", "return (confirm('" & (CType(Me.Page,BaseApplicationPage)).GetResourceValue("DeleteRecordConfirm", "Persons") & "'));") + + + ' Register the event handlers. + + AddHandler Me.PersonalSalaryRowDeleteButton.Click, AddressOf PersonalSalaryRowDeleteButton_Click + + AddHandler Me.PersonalId.SelectedIndexChanged, AddressOf PersonalId_SelectedIndexChanged + + AddHandler Me.CommandDate.TextChanged, AddressOf CommandDate_TextChanged + + AddHandler Me.PositionSalary.TextChanged, AddressOf PositionSalary_TextChanged + + AddHandler Me.SalaryAmout.TextChanged, AddressOf SalaryAmout_TextChanged + + AddHandler Me.SalaryCommand.TextChanged, AddressOf SalaryCommand_TextChanged + + AddHandler Me.SalaryDate.TextChanged, AddressOf SalaryDate_TextChanged + + AddHandler Me.SalaryPlus.TextChanged, AddressOf SalaryPlus_TextChanged + + AddHandler Me.SalaryRank.TextChanged, AddressOf SalaryRank_TextChanged + + AddHandler Me.SalaryStep.TextChanged, AddressOf SalaryStep_TextChanged + + AddHandler Me.SalaryYear.TextChanged, AddressOf SalaryYear_TextChanged + + + End Sub + + + Public Overridable Sub LoadData() + + ' Load the data from the database into the DataSource PersonalSalary 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 = PersonalSalaryTable.GetRecord(Me.RecordUniqueId, True) + + Return + End If + + ' Since this is a row in the table, the data for this row is loaded by the + ' LoadData method of the BasePersonalSalaryTableControl when the data for the entire + ' table is loaded. + + Me.DataSource = New PersonalSalaryRecord() + + + + End Sub + + ' Populate the UI controls using the DataSource. To customize, override this method in PersonalSalaryTableControlRow. + 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 + + SetCommandDate() + SetPersonalId() + + + SetPositionSalary() + SetSalaryAmout() + SetSalaryCommand() + SetSalaryDate() + SetSalaryPlus() + SetSalaryRank() + SetSalaryStep() + SetSalaryYear() + + + 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 SetCommandDate() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.CommandDate.ID) Then + + Me.CommandDate.Text = Me.PreviousUIData(Me.CommandDate.ID).ToString() + + Return + End If + + + ' Set the CommandDate TextBox on the webpage with value from the + ' PersonalSalary database record. + + ' Me.DataSource is the PersonalSalary record retrieved from the database. + ' Me.CommandDate is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetCommandDate() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.CommandDateSpecified Then + + ' If the CommandDate is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalSalaryTable.CommandDate, "d MMM yyyy") + + Me.CommandDate.Text = formattedValue + + Else + + ' CommandDate is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.CommandDate.Text = PersonalSalaryTable.CommandDate.Format(PersonalSalaryTable.CommandDate.DefaultValue, "d MMM yyyy") + + End If + + End Sub + + Public Overridable Sub SetPersonalId() + + ' If selection was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.PersonalId.ID) Then + If Me.PreviousUIData(Me.PersonalId.ID) Is Nothing + Me.PopulatePersonalIdDropDownList(Nothing, 100) + Else + Me.PopulatePersonalIdDropDownList(Me.PreviousUIData(Me.PersonalId.ID).ToString(), 100) + End If + Return + End If + + + ' Set the PersonalId DropDownList on the webpage with value from the + ' PersonalSalary database record. + + ' Me.DataSource is the PersonalSalary record retrieved from the database. + ' Me.PersonalId is the ASP:DropDownList on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetPersonalId() + ' and add your own code before or after the call to the MyBase function. + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.PersonalIdSpecified Then + + ' If the PersonalId is non-NULL, then format the value. + ' The Format method will return the Display Foreign Key As (DFKA) value + Me.PopulatePersonalIdDropDownList(Me.DataSource.PersonalId, 100) + + Else + + ' PersonalId 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.PopulatePersonalIdDropDownList(Nothing, 100) + Else + Me.PopulatePersonalIdDropDownList(PersonalSalaryTable.PersonalId.DefaultValue, 100) + End If + + End If + + End Sub + + Public Overridable Sub SetPositionSalary() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.PositionSalary.ID) Then + + Me.PositionSalary.Text = Me.PreviousUIData(Me.PositionSalary.ID).ToString() + + Return + End If + + + ' Set the PositionSalary TextBox on the webpage with value from the + ' PersonalSalary database record. + + ' Me.DataSource is the PersonalSalary record retrieved from the database. + ' Me.PositionSalary is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetPositionSalary() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.PositionSalarySpecified Then + + ' If the PositionSalary is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalSalaryTable.PositionSalary, "#####") + + Me.PositionSalary.Text = formattedValue + + Else + + ' PositionSalary is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.PositionSalary.Text = PersonalSalaryTable.PositionSalary.Format(PersonalSalaryTable.PositionSalary.DefaultValue, "#####") + + End If + + End Sub + + Public Overridable Sub SetSalaryAmout() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.SalaryAmout.ID) Then + + Me.SalaryAmout.Text = Me.PreviousUIData(Me.SalaryAmout.ID).ToString() + + Return + End If + + + ' Set the SalaryAmout TextBox on the webpage with value from the + ' PersonalSalary database record. + + ' Me.DataSource is the PersonalSalary record retrieved from the database. + ' Me.SalaryAmout is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetSalaryAmout() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.SalaryAmoutSpecified Then + + ' If the SalaryAmout is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalSalaryTable.SalaryAmout, "#,###") + + Me.SalaryAmout.Text = formattedValue + + Else + + ' SalaryAmout is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.SalaryAmout.Text = PersonalSalaryTable.SalaryAmout.Format(PersonalSalaryTable.SalaryAmout.DefaultValue, "#,###") + + End If + + End Sub + + Public Overridable Sub SetSalaryCommand() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.SalaryCommand.ID) Then + + Me.SalaryCommand.Text = Me.PreviousUIData(Me.SalaryCommand.ID).ToString() + + Return + End If + + + ' Set the SalaryCommand TextBox on the webpage with value from the + ' PersonalSalary database record. + + ' Me.DataSource is the PersonalSalary record retrieved from the database. + ' Me.SalaryCommand is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetSalaryCommand() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.SalaryCommandSpecified Then + + ' If the SalaryCommand is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalSalaryTable.SalaryCommand) + + Me.SalaryCommand.Text = formattedValue + + Else + + ' SalaryCommand is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.SalaryCommand.Text = PersonalSalaryTable.SalaryCommand.Format(PersonalSalaryTable.SalaryCommand.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetSalaryDate() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.SalaryDate.ID) Then + + Me.SalaryDate.Text = Me.PreviousUIData(Me.SalaryDate.ID).ToString() + + Return + End If + + + ' Set the SalaryDate TextBox on the webpage with value from the + ' PersonalSalary database record. + + ' Me.DataSource is the PersonalSalary record retrieved from the database. + ' Me.SalaryDate is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetSalaryDate() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.SalaryDateSpecified Then + + ' If the SalaryDate is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalSalaryTable.SalaryDate, "d MMM yyyy") + + Me.SalaryDate.Text = formattedValue + + Else + + ' SalaryDate is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.SalaryDate.Text = PersonalSalaryTable.SalaryDate.Format(PersonalSalaryTable.SalaryDate.DefaultValue, "d MMM yyyy") + + End If + + End Sub + + Public Overridable Sub SetSalaryPlus() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.SalaryPlus.ID) Then + + Me.SalaryPlus.Text = Me.PreviousUIData(Me.SalaryPlus.ID).ToString() + + Return + End If + + + ' Set the SalaryPlus TextBox on the webpage with value from the + ' PersonalSalary database record. + + ' Me.DataSource is the PersonalSalary record retrieved from the database. + ' Me.SalaryPlus is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetSalaryPlus() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.SalaryPlusSpecified Then + + ' If the SalaryPlus is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalSalaryTable.SalaryPlus, "#####") + + Me.SalaryPlus.Text = formattedValue + + Else + + ' SalaryPlus is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.SalaryPlus.Text = PersonalSalaryTable.SalaryPlus.Format(PersonalSalaryTable.SalaryPlus.DefaultValue, "#####") + + End If + + End Sub + + Public Overridable Sub SetSalaryRank() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.SalaryRank.ID) Then + + Me.SalaryRank.Text = Me.PreviousUIData(Me.SalaryRank.ID).ToString() + + Return + End If + + + ' Set the SalaryRank TextBox on the webpage with value from the + ' PersonalSalary database record. + + ' Me.DataSource is the PersonalSalary record retrieved from the database. + ' Me.SalaryRank is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetSalaryRank() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.SalaryRankSpecified Then + + ' If the SalaryRank is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalSalaryTable.SalaryRank) + + Me.SalaryRank.Text = formattedValue + + Else + + ' SalaryRank is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.SalaryRank.Text = PersonalSalaryTable.SalaryRank.Format(PersonalSalaryTable.SalaryRank.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetSalaryStep() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.SalaryStep.ID) Then + + Me.SalaryStep.Text = Me.PreviousUIData(Me.SalaryStep.ID).ToString() + + Return + End If + + + ' Set the SalaryStep TextBox on the webpage with value from the + ' PersonalSalary database record. + + ' Me.DataSource is the PersonalSalary record retrieved from the database. + ' Me.SalaryStep is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetSalaryStep() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.SalaryStepSpecified Then + + ' If the SalaryStep is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalSalaryTable.SalaryStep) + + Me.SalaryStep.Text = formattedValue + + Else + + ' SalaryStep is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.SalaryStep.Text = PersonalSalaryTable.SalaryStep.Format(PersonalSalaryTable.SalaryStep.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetSalaryYear() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.SalaryYear.ID) Then + + Me.SalaryYear.Text = Me.PreviousUIData(Me.SalaryYear.ID).ToString() + + Return + End If + + + ' Set the SalaryYear TextBox on the webpage with value from the + ' PersonalSalary database record. + + ' Me.DataSource is the PersonalSalary record retrieved from the database. + ' Me.SalaryYear is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetSalaryYear() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.SalaryYearSpecified Then + + ' If the SalaryYear is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalSalaryTable.SalaryYear) + + Me.SalaryYear.Text = formattedValue + + Else + + ' SalaryYear is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.SalaryYear.Text = PersonalSalaryTable.SalaryYear.Format(PersonalSalaryTable.SalaryYear.DefaultValue) + + End If + + End Sub + + + Public EvaluateFormulaDelegate As BaseClasses.Data.DataSource.EvaluateFormulaDelegate = New BaseClasses.Data.DataSource.EvaluateFormulaDelegate(AddressOf Me.EvaluateFormula) + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean, ByVal e As FormulaEvaluator) As String + If e Is Nothing Then + e = New FormulaEvaluator() + End If + + e.Variables.Clear() + + + ' add variables for formula evaluation + If variables IsNot Nothing Then + Dim enumerator As System.Collections.Generic.IEnumerator(Of System.Collections.Generic.KeyValuePair(Of String, Object)) = variables.GetEnumerator() + While enumerator.MoveNext() + e.Variables.Add(enumerator.Current.Key, enumerator.Current.Value) + End While + End If + + If includeDS + + End IF + + + ' Other variables referred to in the formula are expected to be + ' properties of the DataSource. For example, referring to + ' UnitPrice as a variable will refer to DataSource.UnitPrice + If dataSourceForEvaluate Is Nothing Then + + e.DataSource = Me.DataSource + + Else + e.DataSource = dataSourceForEvaluate + End If + + ' Define the calling control. This is used to add other + ' related table and record controls as variables. + e.CallingControl = Me + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + + If Not String.IsNullOrEmpty(format) AndAlso (String.IsNullOrEmpty(formula) OrElse formula.IndexOf("Format(") < 0) Then + Return FormulaUtils.Format(resultObj, format) + Else + Return resultObj.ToString() + End If + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format,variables ,includeDS, Nothing) + End Function + + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object)) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format, variables ,True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, format, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal e as FormulaEvaluator) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, variables, True, e) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal includeDS as Boolean) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, includeDS, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, True, Nothing) + End Function + + + Public Overridable Sub RegisterPostback() + + + End Sub + + + + ' To customize, override this method in PersonalSalaryTableControlRow. + Public Overridable Sub SaveData() + ' Saves the associated record in the database. + ' SaveData calls Validate and Get methods - so it may be more appropriate to + ' customize those methods. + + ' 1. Load the existing record from the database. Since we save the entire record, this ensures + ' that fields that are not displayed are also properly initialized. + Me.LoadData() + + + ' 2. Perform any custom validation. + Me.Validate() + + + ' 3. Set the values in the record with data from UI controls. + ' This calls the Get() method for each of the user interface controls. + Me.GetUIData() + + ' 4. Save in the database. + ' We should not save the record if the data did not change. This + ' will save a database hit and avoid triggering any database triggers. + + If Me.DataSource.IsAnyValueChanged Then + ' Save record to database but do not commit yet. + ' Auto generated ids are available after saving for use by child (dependent) records. + Me.DataSource.Save() + + DirectCast(GetParentControlObject(Me, "PersonalSalaryTableControl"), PersonalSalaryTableControl).DataChanged = True + DirectCast(GetParentControlObject(Me, "PersonalSalaryTableControl"), PersonalSalaryTableControl).ResetData = True + End If + + + ' update session or cookie by formula + + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + ' For Master-Detail relationships, save data on the Detail table(s) + + End Sub + + ' To customize, override this method in PersonalSalaryTableControlRow. + 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. + + GetCommandDate() + GetPersonalId() + GetPositionSalary() + GetSalaryAmout() + GetSalaryCommand() + GetSalaryDate() + GetSalaryPlus() + GetSalaryRank() + GetSalaryStep() + GetSalaryYear() + End Sub + + + Public Overridable Sub GetCommandDate() + + ' Retrieve the value entered by the user on the CommandDate ASP:TextBox, and + ' save it into the CommandDate field in DataSource PersonalSalary 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.CommandDate.Text, PersonalSalaryTable.CommandDate) + + + End Sub + + Public Overridable Sub GetPersonalId() + + ' Retrieve the value entered by the user on the PersonalId ASP:DropDownList, and + ' save it into the PersonalId field in DataSource PersonalSalary record. + + ' Custom validation should be performed in Validate, not here. + + Me.DataSource.Parse(GetValueSelectedPageRequest(Me.PersonalId), PersonalSalaryTable.PersonalId) + + End Sub + + Public Overridable Sub GetPositionSalary() + + ' Retrieve the value entered by the user on the PositionSalary ASP:TextBox, and + ' save it into the PositionSalary field in DataSource PersonalSalary record. + ' Parse will also validate the amount to ensure it is of the proper format + ' and valid. The format is verified based on the current culture + ' settings including the currency symbol and decimal separator + ' (no currency conversion is performed). + ' 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.PositionSalary.Text, PersonalSalaryTable.PositionSalary) + + + End Sub + + Public Overridable Sub GetSalaryAmout() + + ' Retrieve the value entered by the user on the SalaryAmout ASP:TextBox, and + ' save it into the SalaryAmout field in DataSource PersonalSalary record. + ' Parse will also validate the amount to ensure it is of the proper format + ' and valid. The format is verified based on the current culture + ' settings including the currency symbol and decimal separator + ' (no currency conversion is performed). + ' 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.SalaryAmout.Text, PersonalSalaryTable.SalaryAmout) + + + End Sub + + Public Overridable Sub GetSalaryCommand() + + ' Retrieve the value entered by the user on the SalaryCommand ASP:TextBox, and + ' save it into the SalaryCommand field in DataSource PersonalSalary record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.SalaryCommand.Text, PersonalSalaryTable.SalaryCommand) + + + End Sub + + Public Overridable Sub GetSalaryDate() + + ' Retrieve the value entered by the user on the SalaryDate ASP:TextBox, and + ' save it into the SalaryDate field in DataSource PersonalSalary 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.SalaryDate.Text, PersonalSalaryTable.SalaryDate) + + + End Sub + + Public Overridable Sub GetSalaryPlus() + + ' Retrieve the value entered by the user on the SalaryPlus ASP:TextBox, and + ' save it into the SalaryPlus field in DataSource PersonalSalary record. + ' Parse will also validate the amount to ensure it is of the proper format + ' and valid. The format is verified based on the current culture + ' settings including the currency symbol and decimal separator + ' (no currency conversion is performed). + ' 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.SalaryPlus.Text, PersonalSalaryTable.SalaryPlus) + + + End Sub + + Public Overridable Sub GetSalaryRank() + + ' Retrieve the value entered by the user on the SalaryRank ASP:TextBox, and + ' save it into the SalaryRank field in DataSource PersonalSalary record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.SalaryRank.Text, PersonalSalaryTable.SalaryRank) + + + End Sub + + Public Overridable Sub GetSalaryStep() + + ' Retrieve the value entered by the user on the SalaryStep ASP:TextBox, and + ' save it into the SalaryStep field in DataSource PersonalSalary record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.SalaryStep.Text, PersonalSalaryTable.SalaryStep) + + + End Sub + + Public Overridable Sub GetSalaryYear() + + ' Retrieve the value entered by the user on the SalaryYear ASP:TextBox, and + ' save it into the SalaryYear field in DataSource PersonalSalary record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.SalaryYear.Text, PersonalSalaryTable.SalaryYear) + + + End Sub + + + ' To customize, override this method in PersonalSalaryTableControlRow. + + Public Overridable Function CreateWhereClause() As WhereClause + + Return Nothing + + End Function + + + + ' To customize, override this method in PersonalSalaryTableControlRow. + 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) + PersonalSalaryTable.DeleteRecord(pkValue) + + DirectCast(GetParentControlObject(Me, "PersonalSalaryTableControl"), PersonalSalaryTableControl).DataChanged = True + DirectCast(GetParentControlObject(Me, "PersonalSalaryTableControl"), PersonalSalaryTableControl).ResetData = True + End Sub + + Protected Overridable Sub Control_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.PreRender + ' PreRender event is raised just before page is being displayed. + Try + DbUtils.StartTransaction() + Me.RegisterPostback() + + If Not Me.Page.ErrorOnPage AndAlso (Me.Page.IsPageRefresh OrElse Me.DataChanged OrElse Me.ResetData) Then + + + ' Re-load the data and update the web page if necessary. + ' This is typically done during a postback (filter, search button, sort, pagination button). + ' In each of the other click handlers, simply set DataChanged to True to reload the data. + Me.LoadData() + Me.DataBind() + End If + + + Catch ex As Exception + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + Finally + DbUtils.EndTransaction() + End Try + End Sub + + + Protected Overrides Sub SaveControlsToSession() + MyBase.SaveControlsToSession() + + + 'Save pagination state to session. + + End Sub + + + + Protected Overrides Sub ClearControlsFromSession() + MyBase.ClearControlsFromSession() + + + + ' Clear pagination state from session. + + End Sub + + Protected Overrides Sub LoadViewState(ByVal savedState As Object) + MyBase.LoadViewState(savedState) + Dim isNewRecord As String = CType(ViewState("IsNewRecord"), String) + If Not isNewRecord Is Nothing AndAlso isNewRecord.Trim <> "" Then + Me.IsNewRecord = Boolean.Parse(isNewRecord) + End If + + Dim myCheckSum As String = CType(ViewState("CheckSum"), String) + If Not myCheckSum Is Nothing AndAlso myCheckSum.Trim <> "" Then + Me.CheckSum = myCheckSum + End If + + + ' Load view state for pagination control. + + End Sub + + Protected Overrides Function SaveViewState() As Object + ViewState("IsNewRecord") = Me.IsNewRecord.ToString() + ViewState("CheckSum") = Me.CheckSum + + + ' Load view state for pagination control. + + Return MyBase.SaveViewState() + End Function + + + + Public Overridable Function CreateWhereClause_PersonalIdDropDownList() 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 PersonalId table. + ' Examples: + ' wc.iAND(PersonalIdTable.PersonalName, BaseFilter.ComparisonOperator.EqualsTo, "XYZ") + ' wc.iAND(PersonalIdTable.Active, BaseFilter.ComparisonOperator.EqualsTo, "1") + + Dim wc As WhereClause = New WhereClause() + Return wc + + End Function + + + ' Fill the PersonalId list. + Protected Overridable Sub PopulatePersonalIdDropDownList( _ + ByVal selectedValue As String, _ + ByVal maxItems As Integer) + + Me.PersonalId.Items.Clear() + + + ' 1. Setup the static list items + + ' Add the Please Select item. + Me.PersonalId.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_PersonalIdDropDownList function. + ' It is better to customize the where clause there. + + Dim wc As WhereClause = CreateWhereClause_PersonalIdDropDownList() + ' Create the ORDER BY clause to sort based on the displayed value. + + + Dim orderBy As OrderBy = New OrderBy(false, false) + orderBy.Add(PersonalIdTable.PersonalName, OrderByItem.OrderDir.Asc) + + Dim variables As System.Collections.Generic.IDictionary(Of String, Object) = New System.Collections.Generic.Dictionary(Of String, Object) + + ' 3. Read a total of maxItems from the database and insert them + Dim itemValues() As PersonalIdRecord = 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 = PersonalIdTable.GetRecords(wc, orderBy, pageNum, maxItems) + For each itemValue As PersonalIdRecord In itemValues + ' Create the item and add to the list. + Dim cvalue As String = Nothing + Dim fvalue As String = Nothing + If itemValue.PersonalIdSpecified Then + cvalue = itemValue.PersonalId.ToString() + + If counter < maxItems AndAlso Me.PersonalId.Items.FindByValue(cvalue) Is Nothing Then + + Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalSalaryTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalSalaryTable.PersonalId) + If _isExpandableNonCompositeForeignKey AndAlso PersonalSalaryTable.PersonalId.IsApplyDisplayAs Then + fvalue = PersonalSalaryTable.GetDFKA(itemValue, PersonalSalaryTable.PersonalId) + End If + If (Not _isExpandableNonCompositeForeignKey) Or (String.IsNullOrEmpty(fvalue)) Then + fvalue = itemValue.Format(PersonalIdTable.PersonalName) + End If + + If fvalue Is Nothing OrElse fvalue.Trim() = "" Then fvalue = cvalue + + If (IsNothing(fvalue)) Then + fvalue = "" + End If + + fvalue = fvalue.Trim() + + If ( fvalue.Length > 50 ) Then + fvalue = fvalue.Substring(0, 50) & "..." + End If + + Dim dupItem As ListItem = Me.PersonalId.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.PersonalId.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.PersonalId, selectedValue) AndAlso _ + Not SetSelectedDisplayText(Me.PersonalId, selectedValue)Then + + ' construct a whereclause to query a record with PersonalId.PersonalId = selectedValue + Dim filter2 As CompoundFilter = New CompoundFilter(CompoundFilter.CompoundingOperators.And_Operator, Nothing) + Dim whereClause2 As WhereClause = New WhereClause() + filter2.AddFilter(New BaseClasses.Data.ColumnValueFilter(PersonalIdTable.PersonalId, selectedValue, BaseClasses.Data.BaseFilter.ComparisonOperator.EqualsTo, False)) + whereClause2.AddFilter(filter2, CompoundFilter.CompoundingOperators.And_Operator) + + Try + ' Execute the query + Dim rc() As PersonalIdRecord = PersonalIdTable.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 PersonalIdRecord = DirectCast(rc(0), PersonalIdRecord) + ' Create the item and add to the list. + Dim cvalue As String = Nothing + Dim fvalue As String = Nothing + If itemValue.PersonalIdSpecified Then + cvalue = itemValue.PersonalId.ToString() + Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalSalaryTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalSalaryTable.PersonalId) + If _isExpandableNonCompositeForeignKey AndAlso PersonalSalaryTable.PersonalId.IsApplyDisplayAs Then + fvalue = PersonalSalaryTable.GetDFKA(itemValue, PersonalSalaryTable.PersonalId) + End If + If (Not _isExpandableNonCompositeForeignKey) Or (String.IsNullOrEmpty(fvalue)) Then + fvalue = itemValue.Format(PersonalIdTable.PersonalName) + End If + + If fvalue Is Nothing OrElse fvalue.Trim() = "" Then fvalue = cvalue + Dim newItem As New ListItem(fvalue, cvalue) + Me.PersonalId.Items.Add(newItem) + SetSelectedValue(Me.PersonalId, selectedValue) + End If + End If + Catch + End Try + + End If + + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalSalaryRowDeleteButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + If(Not Me.Page.IsPageRefresh) Then + + Dim tc As PersonalSalaryTableControl = DirectCast(GetParentControlObject(Me, "PersonalSalaryTableControl"), PersonalSalaryTableControl) + If Not (IsNothing(tc)) Then + If Not Me.IsNewRecord Then + tc.AddToDeletedRecordIds(DirectCast(Me, PersonalSalaryTableControlRow)) + End If + Me.Visible = False + tc.SetFormulaControls() + End If + + End If + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + Protected Overridable Sub PersonalId_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()(PersonalId.ClientID & "_SelectedValue"), String) + Dim displayText As String = CType(Me.Page.Session()(PersonalId.ClientID & "_SelectedDisplayText"), String) + If displayText <> "" AndAlso val <> "" Then + Me.PersonalId.Items.Add(New ListItem(displayText, val)) + Me.PersonalId.SelectedIndex = Me.PersonalId.Items.Count - 1 + Me.Page.Session.Remove(PersonalId.ClientID & "_SelectedValue") + Me.Page.Session.Remove(PersonalId.ClientID & "_SelectedDisplayText") + End If + + + + + End Sub + + Protected Overridable Sub CommandDate_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub PositionSalary_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub SalaryAmout_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub SalaryCommand_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub SalaryDate_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub SalaryPlus_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub SalaryRank_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub SalaryStep_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub SalaryYear_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("BasePersonalSalaryTableControlRow_Rec"), String) + End Get + Set(ByVal value As String) + Me.ViewState("BasePersonalSalaryTableControlRow_Rec") = value + End Set + End Property + + Private _DataSource As PersonalSalaryRecord + Public Property DataSource() As PersonalSalaryRecord + Get + Return Me._DataSource + End Get + + Set(ByVal value As PersonalSalaryRecord) + + Me._DataSource = value + End Set + End Property + + + + Private _checkSum As String + Public Overridable Property CheckSum() As String + Get + Return Me._checkSum + End Get + Set(ByVal value As String) + Me._checkSum = value + End Set + End Property + + Private _TotalPages As Integer + Public Property TotalPages() As Integer + Get + Return Me._TotalPages + End Get + Set(ByVal value As Integer) + Me._TotalPages = value + End Set + End Property + + Private _PageIndex As Integer + Public Property PageIndex() As Integer + Get + ' Return the PageIndex + Return Me._PageIndex + End Get + Set(ByVal value As Integer) + Me._PageIndex = value + End Set + End Property + + Private _DisplayLastPage As Boolean + Public Property DisplayLastPage() As Boolean + Get + Return Me._DisplayLastPage + End Get + Set(ByVal value As Boolean) + Me._DisplayLastPage = value + End Set + End Property + + + +#Region "Helper Properties" + + Public ReadOnly Property CommandDate() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "CommandDate"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property PersonalId() As System.Web.UI.WebControls.DropDownList + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalId"), System.Web.UI.WebControls.DropDownList) + End Get + End Property + + Public ReadOnly Property PersonalSalaryRecordRowSelection() As System.Web.UI.WebControls.CheckBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalSalaryRecordRowSelection"), System.Web.UI.WebControls.CheckBox) + End Get + End Property + + Public ReadOnly Property PersonalSalaryRowDeleteButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalSalaryRowDeleteButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PositionSalary() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PositionSalary"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property SalaryAmout() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "SalaryAmout"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property SalaryCommand() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "SalaryCommand"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property SalaryDate() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "SalaryDate"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property SalaryPlus() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "SalaryPlus"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property SalaryRank() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "SalaryRank"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property SalaryStep() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "SalaryStep"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property SalaryYear() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "SalaryYear"), System.Web.UI.WebControls.TextBox) + 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 PersonalSalaryRecord = 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 PersonalSalaryRecord + If Not Me.DataSource Is Nothing Then + Return Me.DataSource + End If + + If Not Me.RecordUniqueId Is Nothing Then + + Return PersonalSalaryTable.GetRecord(Me.RecordUniqueId, True) + + End If + + ' Localization. + + Throw New Exception(Page.GetResourceValue("Err:RetrieveRec", "Persons")) + + End Function + + Public Shadows ReadOnly Property Page() As BaseApplicationPage + Get + Return DirectCast(MyBase.Page, BaseApplicationPage) + End Get + End Property + +#End Region + +End Class + + + +' Base class for the PersonalSalaryTableControl control on the EditPersonalSalaryTable page. +' Do not modify this class. Instead override any method in PersonalSalaryTableControl. +Public Class BasePersonalSalaryTableControl + Inherits Persons.UI.BaseApplicationTableControl + + + + Protected Overridable Sub Control_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Init + + + + ' Setup the filter and search events. + + + + ' Control Initializations. + ' Initialize the table's current sort order. + + If Me.InSession(Me, "Order_By") Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + Me.CurrentSortOrder.Add(PersonalSalaryTable.SalaryDate, OrderByItem.OrderDir.Asc) + + Me.CurrentSortOrder.Add(PersonalSalaryTable.SalaryAmout, OrderByItem.OrderDir.Asc) + + End If + + + + ' Setup default pagination settings. + + Me.PageSize = CInt(Me.GetFromSession(Me, "Page_Size", "10")) + Me.PageIndex = CInt(Me.GetFromSession(Me, "Page_Index", "0")) + + + + Me.ClearControlsFromSession() + End Sub + + Protected Overridable Sub Control_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load + + SaveControlsToSession_Ajax() + + ' Show confirmation message on Click + Me.PersonalSalaryDeleteButton.Attributes.Add("onClick", "return (confirm('" & (CType(Me.Page,BaseApplicationPage)).GetResourceValue("DeleteConfirm", "Persons") & "'));") + + ' Setup the pagination events. + + AddHandler Me.PersonalSalaryPagination.FirstPage.Click, AddressOf PersonalSalaryPagination_FirstPage_Click + + AddHandler Me.PersonalSalaryPagination.LastPage.Click, AddressOf PersonalSalaryPagination_LastPage_Click + + AddHandler Me.PersonalSalaryPagination.NextPage.Click, AddressOf PersonalSalaryPagination_NextPage_Click + + AddHandler Me.PersonalSalaryPagination.PageSizeButton.Click, AddressOf PersonalSalaryPagination_PageSizeButton_Click + + AddHandler Me.PersonalSalaryPagination.PreviousPage.Click, AddressOf PersonalSalaryPagination_PreviousPage_Click + + + ' Setup the sorting events. + + AddHandler Me.CommandDateLabel.Click, AddressOf CommandDateLabel_Click + + AddHandler Me.PositionSalaryLabel.Click, AddressOf PositionSalaryLabel_Click + + AddHandler Me.SalaryAmoutLabel.Click, AddressOf SalaryAmoutLabel_Click + + AddHandler Me.SalaryCommandLabel.Click, AddressOf SalaryCommandLabel_Click + + AddHandler Me.SalaryDateLabel1.Click, AddressOf SalaryDateLabel1_Click + + AddHandler Me.SalaryPlusLabel.Click, AddressOf SalaryPlusLabel_Click + + AddHandler Me.SalaryRankLabel.Click, AddressOf SalaryRankLabel_Click + + AddHandler Me.SalaryStepLabel.Click, AddressOf SalaryStepLabel_Click + + AddHandler Me.SalaryYearLabel.Click, AddressOf SalaryYearLabel_Click + + ' Setup the button events. + + AddHandler Me.PersonalSalaryAddButton.Click, AddressOf PersonalSalaryAddButton_Click + + AddHandler Me.PersonalSalaryDeleteButton.Click, AddressOf PersonalSalaryDeleteButton_Click + + AddHandler Me.PersonalSalaryEditButton.Click, AddressOf PersonalSalaryEditButton_Click + + AddHandler Me.PersonalSalaryRefreshButton.Click, AddressOf PersonalSalaryRefreshButton_Click + + AddHandler Me.PersonalSalaryResetButton.Click, AddressOf PersonalSalaryResetButton_Click + + AddHandler Me.PersonalSalarySaveButton.Click, AddressOf PersonalSalarySaveButton_Click + + Me.PersonalSalarySaveButton.Attributes.Add("onclick", "SubmitHRefOnce(this, """ & Me.Page.GetResourceValue("Txt:SaveRecord", "Persons") & """);") + + + ' Setup events for others + + End Sub + + + Public Overridable Sub LoadData() + + ' Read data from database. Returns an array of records that can be assigned + ' to the DataSource table control property. + Try + Dim joinFilter As CompoundFilter = CreateCompoundJoinFilter() + + ' The WHERE clause will be empty when displaying all records in table. + Dim wc As WhereClause = CreateWhereClause() + If wc IsNot Nothing AndAlso Not wc.RunQuery Then + ' Initialize an empty array of records + Dim alist As New ArrayList(0) + Me.DataSource = DirectCast(alist.ToArray(GetType(PersonalSalaryRecord)), PersonalSalaryRecord()) + ' Add records to the list if needed. + Me.AddNewRecords() + Me._TotalRecords = 0 + Me._TotalPages = 0 + Return + End If + + ' Call OrderBy to determine the order - either use the order defined + ' on the Query Wizard, or specified by user (by clicking on column heading) + Dim orderBy As OrderBy = CreateOrderBy() + + ' Get the pagesize from the pagesize control. + Me.GetPageSize() + + If Me.DisplayLastPage Then + Dim totalRecords As Integer = If(Me._TotalRecords < 0, PersonalSalaryTable.GetRecordCount(CreateCompoundJoinFilter(), CreateWhereClause()), Me._TotalRecords) + + Dim totalPages As Integer = CInt(Math.Ceiling(totalRecords / Me.PageSize)) + + Me.PageIndex = totalPages - 1 + End If + + ' Make sure PageIndex (current page) and PageSize are within bounds. + If Me.PageIndex < 0 Then + Me.PageIndex = 0 + End If + If Me.PageSize < 1 Then + Me.PageSize = 1 + End If + + ' Retrieve the records and set the table DataSource. + ' Only PageSize records are fetched starting at PageIndex (zero based). + If Me.AddNewRecord > 0 Then + ' Make sure to preserve the previously entered data on new rows. + Dim postdata As New ArrayList + For Each rc As PersonalSalaryTableControlRow In Me.GetRecordControls() + If Not rc.IsNewRecord Then + rc.DataSource = rc.GetRecord() + rc.GetUIData() + postdata.Add(rc.DataSource) + UIData.Add(rc.PreservedUIData()) + End If + Next + Me.DataSource = DirectCast(postdata.ToArray(GetType(PersonalSalaryRecord)), PersonalSalaryRecord()) + Else ' Get the records from the database + Me.DataSource = PersonalSalaryTable.GetRecords(joinFilter, wc, orderBy, Me.PageIndex, Me.PageSize) + + End If + + ' if the datasource contains no records contained in database, then load the last page. + If (DbUtils.GetCreatedRecords(Me.DataSource).Length = 0 AndAlso Not Me.DisplayLastPage) Then + Me.DisplayLastPage = True + LoadData() + Else + + ' Add any new rows desired by the user. + Me.AddNewRecords() + + ' Turn off the ToggleAll checkbox + Me.PersonalSalaryToggleAll.Checked = False + + + ' Initialize the page and grand totals. now + + End If + + Catch ex As Exception + ' Report the error message to the end user + Dim msg As String = ex.Message + If ex.InnerException IsNot Nothing Then + msg = msg & " InnerException: " & ex.InnerException.Message + End If + Throw New Exception(msg, ex.InnerException) + End Try + End Sub + + + + + Public Overrides Sub DataBind() + ' The DataBind method binds the user interface controls to the values + ' from the database record for each row in the table. To do this, it calls the + ' DataBind for each of the rows. + ' DataBind also populates any filters above the table, and sets the pagination + ' control to the correct number of records and the current page number. + + MyBase.DataBind() + + ' Make sure that the DataSource is initialized. + If Me.DataSource Is Nothing Then + Return + End If + + 'LoadData for DataSource for chart and report if they exist + + ' Improve performance by prefetching display as records. + Me.PreFetchForeignKeyValues() + + ' Setup the pagination controls. + BindPaginationControls() + + + + ' Bind the repeater with the list of records to expand the UI. + Dim rep As System.Web.UI.WebControls.Repeater = CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalSalaryTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return + rep.DataSource = DataSource() + rep.DataBind() + + Dim index As Integer = 0 + For Each repItem As System.Web.UI.WebControls.RepeaterItem In rep.Items + ' Loop through all rows in the table, set its DataSource and call DataBind(). + Dim recControl As PersonalSalaryTableControlRow = DirectCast(repItem.FindControl("PersonalSalaryTableControlRow"), PersonalSalaryTableControlRow) + recControl.DataSource = Me.DataSource(index) + If Me.UIData.Count > index Then + recControl.PreviousUIData = Me.UIData(index) + End If + recControl.DataBind() + recControl.Visible = Not Me.InDeletedRecordIds(recControl) + + index += 1 + Next + + + + + ' Call the Set methods for each controls on the panel + + SetCommandDateLabel() + + + + + + + + SetPersonalSalaryTableControlCollapsibleRegion() + SetPersonalSalaryTableControlIcon() + SetPersonalSalaryTableControlPanelExtender() + + + SetPositionSalaryLabel() + SetSalaryAmoutLabel() + SetSalaryCommandLabel() + SetSalaryDateLabel1() + SetSalaryPlusLabel() + SetSalaryRankLabel() + SetSalaryStepLabel() + SetSalaryYearLabel() + ' setting the state of expand or collapse alternative rows + + + ' Load data for each record and table UI control. + ' Ordering is important because child controls get + ' their parent ids from their parent UI controls. + + + ' this method calls the set method for controls with special formula like running total, sum, rank, etc + SetFormulaControls() + End Sub + + Public Overridable Sub SetFormulaControls() + ' this method calls Set methods for the control that has special formula + + + + End Sub + + + Public Sub PreFetchForeignKeyValues() + If (IsNothing(Me.DataSource)) + Return + End If + + Me.Page.PregetDfkaRecords(PersonalSalaryTable.PersonalId, Me.DataSource) + + End Sub + + + Public Overridable Sub RegisterPostback() + + Me.Page.RegisterPostBackTrigger(MiscUtils.FindControlRecursively(Me,"PersonalSalarySaveButton")) + + + End Sub + + Public EvaluateFormulaDelegate As BaseClasses.Data.DataSource.EvaluateFormulaDelegate = New BaseClasses.Data.DataSource.EvaluateFormulaDelegate(AddressOf Me.EvaluateFormula) + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean, ByVal e as FormulaEvaluator) As String + If e Is Nothing + e = New FormulaEvaluator() + End If + + e.Variables.Clear() + + + ' add variables for formula evaluation + If variables IsNot Nothing Then + Dim enumerator As System.Collections.Generic.IEnumerator(Of System.Collections.Generic.KeyValuePair(Of String, Object)) = variables.GetEnumerator() + While enumerator.MoveNext() + e.Variables.Add(enumerator.Current.Key, enumerator.Current.Value) + End While + End If + + If includeDS + + End If + + ' All variables referred to in the formula are expected to be + ' properties of the DataSource. For example, referring to + ' UnitPrice as a variable will refer to DataSource.UnitPrice + e.DataSource = dataSourceForEvaluate + + ' Define the calling control. This is used to add other + ' related table and record controls as variables. + e.CallingControl = Me + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + + If Not String.IsNullOrEmpty(format) AndAlso (String.IsNullOrEmpty(formula) OrElse formula.IndexOf("Format(") < 0) Then + Return FormulaUtils.Format(resultObj, format) + Else + Return resultObj.ToString() + End If + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format,variables ,includeDS, Nothing) + End Function + + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object)) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format, variables ,True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, format, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal e as FormulaEvaluator) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, variables, True, e) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal includeDS as Boolean) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, includeDS, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, True, Nothing) + End Function + + + + + Public Overridable Sub ResetControl() + + Me.CurrentSortOrder.Reset() + If (Me.InSession(Me, "Order_By")) Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + Me.CurrentSortOrder.Add(PersonalSalaryTable.SalaryDate, OrderByItem.OrderDir.Asc) + + Me.CurrentSortOrder.Add(PersonalSalaryTable.SalaryAmout, OrderByItem.OrderDir.Asc) + + End If + + Me.PageIndex = 0 + End Sub + + Protected Overridable Sub BindPaginationControls() + ' Setup the pagination controls. + + ' Bind the pagination labels. + + If DbUtils.GetCreatedRecords(Me.DataSource).Length > 0 Then + + Me.PersonalSalaryPagination.CurrentPage.Text = (Me.PageIndex + 1).ToString() + Else + Me.PersonalSalaryPagination.CurrentPage.Text = "0" + End If + Me.PersonalSalaryPagination.PageSize.Text = Me.PageSize.ToString() + Me.PersonalSalaryPagination.TotalItems.Text = Me.TotalRecords.ToString() + Me.PersonalSalaryPagination.TotalPages.Text = Me.TotalPages.ToString() + + ' Bind the buttons for PersonalSalaryTableControl pagination. + + Me.PersonalSalaryPagination.FirstPage.Enabled = Not (Me.PageIndex = 0) + If Me._TotalPages < 0 Then ' if the total pages is not determined yet, enable last and next buttons + Me.PersonalSalaryPagination.LastPage.Enabled = True + ElseIf Me._TotalPages = 0 ' if the total pages is determined and it is 0, enable last and next buttons + Me.PersonalSalaryPagination.LastPage.Enabled = False + Else ' if the total pages is the last page, disable last and next buttons + Me.PersonalSalaryPagination.LastPage.Enabled = Not (Me.PageIndex = Me.TotalPages - 1) + End If + + If Me._TotalPages < 0 Then ' if the total pages is not determined yet, enable last and next buttons + Me.PersonalSalaryPagination.NextPage.Enabled = True + ElseIf Me._TotalPages = 0 ' if the total pages is determined and it is 0, enable last and next buttons + Me.PersonalSalaryPagination.NextPage.Enabled = False + Else ' if the total pages is the last page, disable last and next buttons + Me.PersonalSalaryPagination.NextPage.Enabled = Not (Me.PageIndex = Me.TotalPages - 1) + End If + + Me.PersonalSalaryPagination.PreviousPage.Enabled = Not (Me.PageIndex = 0) + + + End Sub + + Public Overridable Sub SaveData() + ' Save the data from the entire table. Calls each row's Save Data + ' to save their data. This function is called by the Click handler of the + ' Save button. The button handler should Start/Commit/End a transaction. + + Dim recCtl As PersonalSalaryTableControlRow + For Each recCtl In Me.GetRecordControls() + + If Me.InDeletedRecordIds(recCtl) Then + ' Delete any pending deletes. + recCtl.Delete() + Else + If recCtl.Visible Then + recCtl.SaveData() + End If + End If + + Next + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + ' Set IsNewRecord to False for all records - since everything has been saved and is no longer "new" + For Each recCtl In Me.GetRecordControls() + recCtl.IsNewRecord = False + Next + + + ' Set DeletedRecordsIds to Nothing since we have deleted all pending deletes. + Me.DeletedRecordIds = Nothing + + End Sub + + Public Overridable Function CreateCompoundJoinFilter() As CompoundFilter + Dim jFilter As CompoundFilter = New CompoundFilter() + + Return jFilter + + End Function + + + Public Overridable Function CreateOrderBy() As OrderBy + ' The CurrentSortOrder is initialized to the sort order on the + ' Query Wizard. It may be modified by the Click handler for any of + ' the column heading to sort or reverse sort by that column. + ' You can add your own sort order, or modify it on the Query Wizard. + Return Me.CurrentSortOrder + End Function + + Public Overridable Function CreateWhereClause() As WhereClause + 'This CreateWhereClause is used for loading the data. + PersonalSalaryTable.Instance.InnerFilter = Nothing + Dim wc As WhereClause = New WhereClause() + + ' Compose the WHERE clause consiting of: + ' 1. Static clause defined at design time. + ' 2. User selected search criteria. + ' 3. User selected filter criteria. + + + ' Get the static clause defined at design time on the Table Panel Wizard + Dim qc As WhereClause = Me.CreateQueryClause() + If Not(IsNothing(qc)) Then + wc.iAND(qc) + End If + + Return wc + End Function + + + Public Overridable Function CreateWhereClause(ByVal searchText as String, ByVal fromSearchControl as String, ByVal AutoTypeAheadSearch as String, ByVal AutoTypeAheadWordSeparators as String) As WhereClause + ' This CreateWhereClause is used for loading list of suggestions for Auto Type-Ahead feature. + PersonalSalaryTable.Instance.InnerFilter = Nothing + Dim wc As WhereClause = New WhereClause() + + ' Compose the WHERE clause consiting of: + ' 1. Static clause defined at design time. + ' 2. User selected search criteria. + ' 3. User selected filter criteria. + + Dim appRelativeVirtualPath As String = CType(HttpContext.Current.Session("AppRelativeVirtualPath"), String) + + ' Get the static clause defined at design time on the Table Panel Wizard + Dim qc As WhereClause = Me.CreateQueryClause() + If Not(IsNothing(qc)) Then + wc.iAND(qc) + End If + + ' Adds clauses if values are selected in Filter controls which are configured in the page. + + + Return wc + End Function + + Protected Overridable Function CreateQueryClause() As WhereClause + ' Create a where clause for the Static clause defined at design time. + Dim filter As CompoundFilter = New CompoundFilter(CompoundFilter.CompoundingOperators.And_Operator, Nothing) + Dim whereClause As WhereClause = New WhereClause() + + filter.AddFilter(New BaseClasses.Data.SignedInUserFilter(BaseClasses.Data.BaseTable.CreateInstance("Persons.Business.PersonalSalaryTable, App_Code").TableDefinition.ColumnList.GetByUniqueName("PersonalSalary_.PersonalId"), New BaseClasses.Data.IdentifierAliasInfo("PersonalSalary_", Nothing), BaseClasses.Data.BaseFilter.ComparisonOperator.EqualsTo, False)) + + whereClause.AddFilter(filter, CompoundFilter.CompoundingOperators.And_Operator) + + Return whereClause + + End Function + + + Public Overridable Function FormatSuggestions(ByVal prefixText As String, ByVal resultItem As String, _ + ByVal columnLength As Integer, ByVal AutoTypeAheadDisplayFoundText As String, _ + ByVal autoTypeAheadSearch As String, ByVal AutoTypeAheadWordSeparators As String, _ + ByVal resultList As ArrayList) As Boolean + + 'Formats the resultItem and adds it to the list of suggestions. + Dim index As Integer = resultItem.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture).IndexOf(prefixText.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture)) + Dim itemToAdd As String = "" + Dim isFound As Boolean = False + Dim isAdded As Boolean = False + ' Get the index where prfixt is at the beginning of resultItem. If not found then, index of word which begins with prefixText. + If InvariantLCase(autoTypeAheadSearch).equals("wordsstartingwithsearchstring") And Not index = 0 Then + ' Expression to find word which contains AutoTypeAheadWordSeparators followed by prefixText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex( AutoTypeAheadWordSeparators + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + If regex1.IsMatch(resultItem) Then + index = regex1.Match(resultItem).Index + isFound = True + End If + ' If the prefixText is found immediatly after white space then starting of the word is found so don not search any further + If not resultItem(index).ToString() = " " Then + ' Expression to find beginning of the word which contains AutoTypeAheadWordSeparators followed by prefixText + Dim regex As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\\S*" + AutoTypeAheadWordSeparators + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + If regex.IsMatch(resultItem) Then + index = regex.Match(resultItem).Index + isFound = True + End If + End If + End If + + ' If autoTypeAheadSearch value is wordsstartingwithsearchstring then, extract the substring only if the prefixText is found at the + ' beginning of the resultItem (index = 0) or a word in resultItem is found starts with prefixText. + If index = 0 Or isFound Or InvariantLCase(autoTypeAheadSearch).Equals("anywhereinstring") then + If InvariantLCase(AutoTypeAheadDisplayFoundText).equals("atbeginningofmatchedstring") Then + ' Expression to find beginning of the word which contains prefixText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\\S*" + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + ' Find the beginning of the word which contains prefexText + If (StringUtils.InvariantLCase(autoTypeAheadSearch).Equals("anywhereinstring") AndAlso regex1.IsMatch(resultItem)) Then + index = regex1.Match(resultItem).Index + isFound = True + End If + ' Display string from the index till end of the string if sub string from index till end is less than columnLength value. + If Len(resultItem) - index <= columnLength Then + If index = 0 Then + itemToAdd = resultItem + Else + itemToAdd = "..." & resultItem.Substring(index, Len(resultItem) - index) + End If + Else + If index = 0 Then + itemToAdd = resultItem.Substring(index, (columnLength - 3)) & "..." + Else + 'Truncate the string to show only columnLength - 6 characters as begining and trailing "..." has to be appended. + itemToAdd = "..." & resultItem.Substring(index , columnLength - 6) & "..." + End If + End If + ElseIf InvariantLCase(AutoTypeAheadDisplayFoundText).equals("inmiddleofmatchedstring") Then + Dim subStringBeginIndex As Integer = CType(columnLength/2, Integer) + If Len(resultItem) <= columnLength Then + itemToAdd = resultItem + Else + ' Sanity check at end of the string + If index + Len(prefixText) = columnLength Then + itemToAdd = "..." & resultItem.Substring(index-columnLength,index) + ElseIf Len(resultItem) - index < subStringBeginIndex Then + ' Display string from the end till columnLength value if, index is closer to the end of the string. + itemToAdd = "..." & resultItem.Substring(Len(resultItem)-columnLength,Len(resultItem)) + ElseIf index <= subStringBeginIndex Then + ' Sanity chet at beginning of the string + itemToAdd = resultItem.Substring(0, columnLength) & "..." + Else + ' Display string containing text before the prefixText occures and text after the prefixText + itemToAdd = "..." & resultItem.Substring(index - subStringBeginIndex, columnLength) & "..." + End If + End If + ElseIf InvariantLCase(AutoTypeAheadDisplayFoundText).equals("atendofmatchedstring") Then + ' Expression to find ending of the word which contains prefexText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\s", System.Text.RegularExpressions.RegexOptions.IgnoreCase) + ' Find the ending of the word which contains prefexText + If regex1.IsMatch(resultItem, index + 1) Then + index = regex1.Match(resultItem, index + 1).Index + Else + ' If the word which contains prefexText is the last word in string, regex1.IsMatch returns false. + index = resultItem.Length + End If + If index > Len(resultItem) Then + index = Len(resultItem) + End If + ' If text from beginning of the string till index is less than columnLength value then, display string from the beginning till index. + If index <= columnLength Then + if index = Len(resultItem) Then 'Make decision to append "..." + itemToAdd = resultItem.Substring(0,index) + Else + itemToAdd = resultItem.Substring(0,index) & "..." + End If + Else + If index = Len(resultItem) Then + itemToAdd = "..." & resultItem.Substring(index - (columnLength - 3), (columnLength - 3)) + Else + 'Truncate the string to show only columnLength - 6 characters as begining and trailing "..." has to be appended. + itemToAdd = "..." & resultItem.Substring(index - (columnLength - 6), columnLength - 6) & "..." + End If + End If + End If + + ' Remove newline character from itemToAdd + Dim prefixTextIndex As Integer = itemToAdd.IndexOf(prefixText, StringComparison.CurrentCultureIgnoreCase) + ' If itemToAdd contains any newline after the search text then show text only till newline + Dim regex2 As System.Text.RegularExpressions.Regex = New System.Text.RegularExpressions.Regex("(" & vbCrLf & "|" & vbLf & ")", System.Text.RegularExpressions.RegexOptions.IgnoreCase) + Dim newLineIndexAfterPrefix As Integer = -1 + If regex2.IsMatch(itemToAdd, prefixTextIndex) Then + newLineIndexAfterPrefix = regex2.Match(itemToAdd, prefixTextIndex).Index + End If + If (newLineIndexAfterPrefix > -1) Then + If itemToAdd.EndsWith("...") Then + itemToAdd = (itemToAdd.Substring(0, newLineIndexAfterPrefix) + "...") + Else + itemToAdd = itemToAdd.Substring(0, newLineIndexAfterPrefix) + End If + End If + ' If itemToAdd contains any newline before search text then show text which comes after newline + Dim regex3 As System.Text.RegularExpressions.Regex = New System.Text.RegularExpressions.Regex("(" & vbCrLf & "|" & vbLf & ")", (System.Text.RegularExpressions.RegexOptions.IgnoreCase Or System.Text.RegularExpressions.RegexOptions.RightToLeft)) + Dim newLineIndexBeforePrefix As Integer = -1 + If regex3.IsMatch(itemToAdd, prefixTextIndex) Then + newLineIndexBeforePrefix = regex3.Match(itemToAdd, prefixTextIndex).Index + End If + If (newLineIndexBeforePrefix > -1) Then + If itemToAdd.StartsWith("...") Then + itemToAdd = ("..." + itemToAdd.Substring((newLineIndexBeforePrefix + regex3.Match(itemToAdd, prefixTextIndex).Length))) + Else + itemToAdd = itemToAdd.Substring((newLineIndexBeforePrefix + regex3.Match(itemToAdd, prefixTextIndex).Length)) + End If + End If + + If Not itemToAdd is nothing AndAlso Not resultList.Contains(itemToAdd) Then + + resultList.Add(itemToAdd) + + isAdded = true + End If + End If + Return isAdded + End Function + + + Protected Overridable Sub GetPageSize() + + If Me.PersonalSalaryPagination.PageSize.Text.Trim <> "" Then + Try + 'Me.PageSize = Integer.Parse(Me.PersonalSalaryPagination.PageSize.Text) + Catch ex As Exception + End Try + End If + End Sub + + Protected Overridable Sub AddNewRecords() + + Dim newRecordList As ArrayList = New ArrayList() + + Dim newUIDataList As System.Collections.Generic.List(Of Hashtable) = New System.Collections.Generic.List(Of Hashtable)() + + ' Loop though all the record controls and if the record control + ' does not have a unique record id set, then create a record + ' and add to the list. + If Not Me.ResetData Then + Dim rep As System.Web.UI.WebControls.Repeater = CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalSalaryTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return + + Dim repItem As System.Web.UI.WebControls.RepeaterItem + For Each repItem In rep.Items + ' Loop through all rows in the table, set its DataSource and call DataBind(). + + Dim recControl As PersonalSalaryTableControlRow = DirectCast(repItem.FindControl("PersonalSalaryTableControlRow"), PersonalSalaryTableControlRow) + + If recControl.Visible AndAlso recControl.IsNewRecord() Then + + Dim rec As PersonalSalaryRecord = New PersonalSalaryRecord() + + If recControl.CommandDate.Text <> "" Then + rec.Parse(recControl.CommandDate.Text, PersonalSalaryTable.CommandDate) + End If + If MiscUtils.IsValueSelected(recControl.PersonalId) Then + rec.Parse(recControl.PersonalId.SelectedItem.Value, PersonalSalaryTable.PersonalId) + End If + If recControl.PositionSalary.Text <> "" Then + rec.Parse(recControl.PositionSalary.Text, PersonalSalaryTable.PositionSalary) + End If + If recControl.SalaryAmout.Text <> "" Then + rec.Parse(recControl.SalaryAmout.Text, PersonalSalaryTable.SalaryAmout) + End If + If recControl.SalaryCommand.Text <> "" Then + rec.Parse(recControl.SalaryCommand.Text, PersonalSalaryTable.SalaryCommand) + End If + If recControl.SalaryDate.Text <> "" Then + rec.Parse(recControl.SalaryDate.Text, PersonalSalaryTable.SalaryDate) + End If + If recControl.SalaryPlus.Text <> "" Then + rec.Parse(recControl.SalaryPlus.Text, PersonalSalaryTable.SalaryPlus) + End If + If recControl.SalaryRank.Text <> "" Then + rec.Parse(recControl.SalaryRank.Text, PersonalSalaryTable.SalaryRank) + End If + If recControl.SalaryStep.Text <> "" Then + rec.Parse(recControl.SalaryStep.Text, PersonalSalaryTable.SalaryStep) + End If + If recControl.SalaryYear.Text <> "" Then + rec.Parse(recControl.SalaryYear.Text, PersonalSalaryTable.SalaryYear) + End If + newUIDataList.Add(recControl.PreservedUIData()) + newRecordList.Add(rec) + End If + Next + End If + + + ' Add any new record to the list. + Dim index As Integer = 0 + For index = 1 To Me.AddNewRecord + + newRecordList.Insert(0, New PersonalSalaryRecord()) + newUIDataList.Insert(0, New Hashtable()) + + Next + Me.AddNewRecord = 0 + + ' Finally, add any new records to the DataSource. + If newRecordList.Count > 0 Then + + Dim finalList As ArrayList = New ArrayList(Me.DataSource) + finalList.InsertRange(0, newRecordList) + + Me.DataSource = DirectCast(finalList.ToArray(GetType(PersonalSalaryRecord)), PersonalSalaryRecord()) + + End If + + ' Add the existing UI data to this hash table + If newUIDataList.Count > 0 Then + Me.UIData.InsertRange(0, newUIDataList) + End If + + End Sub + + + Public Sub AddToDeletedRecordIds(ByVal rec As PersonalSalaryTableControlRow) + If rec.IsNewRecord() Then + Return + End If + + If Not Me.DeletedRecordIds Is Nothing AndAlso Me.DeletedRecordIds.Trim <> "" Then + Me.DeletedRecordIds &= "," + End If + + Me.DeletedRecordIds &= "[" & rec.RecordUniqueId & "]" + End Sub + + Protected Overridable Function InDeletedRecordIds(ByVal rec As PersonalSalaryTableControlRow) As Boolean + If Me.DeletedRecordIds Is Nothing OrElse Me.DeletedRecordIds.Trim = "" Then + Return False + End If + + Return Me.DeletedRecordIds.IndexOf("[" & rec.RecordUniqueId & "]") >= 0 + End Function + + Private _DeletedRecordIds As String + Public Property DeletedRecordIds() As String + Get + Return Me._DeletedRecordIds + End Get + Set(ByVal value As String) + Me._DeletedRecordIds = value + End Set + End Property + + + ' Create Set, WhereClause, and Populate Methods + + Public Overridable Sub SetCommandDateLabel() + + End Sub + + Public Overridable Sub SetPersonalSalaryTableControlCollapsibleRegion() + + End Sub + + Public Overridable Sub SetPersonalSalaryTableControlIcon() + + End Sub + + Public Overridable Sub SetPersonalSalaryTableControlPanelExtender() + + End Sub + + Public Overridable Sub SetPositionSalaryLabel() + + End Sub + + Public Overridable Sub SetSalaryAmoutLabel() + + End Sub + + Public Overridable Sub SetSalaryCommandLabel() + + End Sub + + Public Overridable Sub SetSalaryDateLabel1() + + End Sub + + Public Overridable Sub SetSalaryPlusLabel() + + End Sub + + Public Overridable Sub SetSalaryRankLabel() + + End Sub + + Public Overridable Sub SetSalaryStepLabel() + + End Sub + + Public Overridable Sub SetSalaryYearLabel() + + 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. + Dim added As Boolean = Me.AddNewRecord > 0 + Me.LoadData() + Me.DataBind() + + If added Then + Me.SetFocusToAddedRow() + End If + + End If + + + + Catch ex As Exception + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + Finally + DbUtils.EndTransaction + End Try + End Sub + + 'this function sets focus to the first editable element in the new added row in the editable table + Protected Overridable Sub SetFocusToAddedRow() + Dim rep As System.Web.UI.WebControls.Repeater = CType(Me.FindControl("PersonalSalaryTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing OrElse rep.Items.Count = 0 Then Return + Dim repItem As System.Web.UI.WebControls.RepeaterItem + For Each repItem In rep.Items + 'Load scripts to table rows + Me.Page.LoadFocusScripts(repItem) + Dim recControl As PersonalSalaryTableControlRow = DirectCast(repItem.FindControl("PersonalSalaryTableControlRow"), PersonalSalaryTableControlRow) + If recControl.IsNewRecord Then + For Each field As Control In recControl.Controls + If field.Visible AndAlso Me.Page.IsControlEditable(field, False) Then + 'set focus on the first editable field in the new row + field.Focus() + Dim updPan As UpdatePanel = DirectCast(Me.Page.FindControlRecursively("UpdatePanel1"), UpdatePanel) + If Not updPan Is Nothing Then updPan.Update() + Return + End If + Next + Return + End If + Next + End Sub + + + Protected Overrides Sub SaveControlsToSession() + MyBase.SaveControlsToSession() + + ' Save filter controls to values to session. + + + 'Save pagination state to session. + + + + ' Save table control properties to the session. + If Not Me.CurrentSortOrder Is Nothing Then + Me.SaveToSession(Me, "Order_By", Me.CurrentSortOrder.ToXmlString()) + End If + + Me.SaveToSession(Me, "Page_Index", Me.PageIndex.ToString()) + Me.SaveToSession(Me, "Page_Size", Me.PageSize.ToString()) + + Me.SaveToSession(Me, "DeletedRecordIds", Me.DeletedRecordIds) + + End Sub + + Protected Sub SaveControlsToSession_Ajax() + ' Save filter controls to values to session. + + HttpContext.Current.Session("AppRelativeVirtualPath") = Me.Page.AppRelativeVirtualPath + + End Sub + + Protected Overrides Sub ClearControlsFromSession() + MyBase.ClearControlsFromSession() + + ' Clear filter controls values from the session. + + + ' Clear pagination state from session. + + + + ' Clear table properties from the session. + Me.RemoveFromSession(Me, "Order_By") + Me.RemoveFromSession(Me, "Page_Index") + Me.RemoveFromSession(Me, "Page_Size") + + Me.RemoveFromSession(Me, "DeletedRecordIds") + + End Sub + + Protected Overrides Sub LoadViewState(ByVal savedState As Object) + MyBase.LoadViewState(savedState) + + Dim orderByStr As String = CType(ViewState("PersonalSalaryTableControl_OrderBy"), String) + + If orderByStr IsNot Nothing AndAlso orderByStr.Trim <> "" Then + Me.CurrentSortOrder = BaseClasses.Data.OrderBy.FromXmlString(orderByStr) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + End If + + Dim pageIndex As String = CType(ViewState("Page_Index"), String) + If pageIndex IsNot Nothing Then + Me.PageIndex = CInt(pageIndex) + End If + + Dim pageSize As String = CType(ViewState("Page_Size"), String) + If Not pageSize Is Nothing Then + Me.PageSize = CInt(pageSize) + End If + + + + ' Load view state for pagination control. + + Me.DeletedRecordIds = CType(Me.ViewState("DeletedRecordIds"), String) + + End Sub + + Protected Overrides Function SaveViewState() As Object + + If Me.CurrentSortOrder IsNot Nothing Then + Me.ViewState("PersonalSalaryTableControl_OrderBy") = Me.CurrentSortOrder.ToXmlString() + End If + + Me.ViewState("Page_Index") = Me.PageIndex + Me.ViewState("Page_Size") = Me.PageSize + + Me.ViewState("DeletedRecordIds") = Me.DeletedRecordIds + + + ' Load view state for pagination control. + + + Return MyBase.SaveViewState() + End Function + + ' Generate the event handling functions for pagination events. + + ' event handler for ImageButton + Public Overridable Sub PersonalSalaryPagination_FirstPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.PageIndex = 0 + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalSalaryPagination_LastPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.DisplayLastPage = True + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalSalaryPagination_NextPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.PageIndex += 1 + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for LinkButton + Public Overridable Sub PersonalSalaryPagination_PageSizeButton_Click(ByVal sender As Object, ByVal args As EventArgs) + + Try + + Me.DataChanged = True + + Me.PageSize = Integer.Parse(Me.PersonalSalaryPagination.PageSize.Text) + + Me.PageIndex = Integer.Parse(Me.PersonalSalaryPagination.CurrentPage.Text) - 1 + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalSalaryPagination_PreviousPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + If Me.PageIndex > 0 Then + Me.PageIndex -= 1 + Me.DataChanged = True + End If + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + + ' Generate the event handling functions for sorting events. + + Public Overridable Sub CommandDateLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by CommandDate when clicked. + + ' Get previous sorting state for CommandDate. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalSalaryTable.CommandDate) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for CommandDate. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalSalaryTable.CommandDate, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by CommandDate, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub PositionSalaryLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by PositionSalary when clicked. + + ' Get previous sorting state for PositionSalary. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalSalaryTable.PositionSalary) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for PositionSalary. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalSalaryTable.PositionSalary, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by PositionSalary, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub SalaryAmoutLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by SalaryAmout when clicked. + + ' Get previous sorting state for SalaryAmout. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalSalaryTable.SalaryAmout) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for SalaryAmout. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalSalaryTable.SalaryAmout, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by SalaryAmout, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub SalaryCommandLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by SalaryCommand when clicked. + + ' Get previous sorting state for SalaryCommand. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalSalaryTable.SalaryCommand) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for SalaryCommand. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalSalaryTable.SalaryCommand, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by SalaryCommand, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub SalaryDateLabel1_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by SalaryDate when clicked. + + ' Get previous sorting state for SalaryDate. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalSalaryTable.SalaryDate) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for SalaryDate. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalSalaryTable.SalaryDate, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by SalaryDate, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub SalaryPlusLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by SalaryPlus when clicked. + + ' Get previous sorting state for SalaryPlus. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalSalaryTable.SalaryPlus) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for SalaryPlus. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalSalaryTable.SalaryPlus, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by SalaryPlus, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub SalaryRankLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by SalaryRank when clicked. + + ' Get previous sorting state for SalaryRank. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalSalaryTable.SalaryRank) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for SalaryRank. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalSalaryTable.SalaryRank, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by SalaryRank, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub SalaryStepLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by SalaryStep when clicked. + + ' Get previous sorting state for SalaryStep. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalSalaryTable.SalaryStep) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for SalaryStep. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalSalaryTable.SalaryStep, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by SalaryStep, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub SalaryYearLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by SalaryYear when clicked. + + ' Get previous sorting state for SalaryYear. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalSalaryTable.SalaryYear) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for SalaryYear. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalSalaryTable.SalaryYear, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by SalaryYear, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + + ' Generate the event handling functions for button events. + + ' event handler for ImageButton + Public Overridable Sub PersonalSalaryAddButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + Me.AddNewRecord = 1 + Me.DataChanged = True + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalSalaryDeleteButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + If(Not Me.Page.IsPageRefresh) Then + + Me.DeleteSelectedRecords(True) + Me.SetFormulaControls() + + + End If + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalSalaryEditButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + ' The redirect URL is set on the Properties, Custom Properties or Actions. + ' The ModifyRedirectURL call resolves the parameters before the + ' Response.Redirect redirects the page to the URL. + ' Any code after the Response.Redirect call will not be executed, since the page is + ' redirected to the URL. + + + Dim url As String = "../Shared/ConfigureEditRecord.aspx" + + Dim shouldRedirect As Boolean = True + Dim TargetKey As String = Nothing + Dim DFKA As String = TargetKey + Dim id As String = DFKA + Dim value As String = id + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + url = Me.ModifyRedirectUrl(url, "",False) + url = Me.Page.ModifyRedirectUrl(url, "",False) + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + shouldRedirect = False + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + If shouldRedirect Then + Me.Page.ShouldSaveControlsToSession = True + Me.Page.Response.Redirect(url) + ElseIf Not TargetKey Is Nothing AndAlso _ + Not shouldRedirect Then + Me.Page.ShouldSaveControlsToSession = True + Me.Page.CloseWindow(True) + + End If + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalSalaryRefreshButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Dim PersonalSalaryTableControlObj as PersonalSalaryTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalSalaryTableControl"), PersonalSalaryTableControl) + PersonalSalaryTableControlObj.ResetData = True + + PersonalSalaryTableControlObj.RemoveFromSession(PersonalSalaryTableControlObj, "DeletedRecordIds") + PersonalSalaryTableControlObj.DeletedRecordIds = Nothing + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalSalaryResetButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.CurrentSortOrder.Reset() + If Me.InSession(Me, "Order_By") Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + Me.CurrentSortOrder.Add(PersonalSalaryTable.SalaryDate, OrderByItem.OrderDir.Asc) + + Me.CurrentSortOrder.Add(PersonalSalaryTable.SalaryAmout, OrderByItem.OrderDir.Asc) + + + End If + + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalSalarySaveButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + + If (Not Me.Page.IsPageRefresh) Then + Me.SaveData() + End If + + Me.Page.CommitTransaction(sender) + ' Set IsNewRecord to False for all records - since everything has been saved and is no longer "new" + Dim recCtl As PersonalSalaryTableControlRow + For Each recCtl in Me.GetRecordControls() + + recCtl.IsNewRecord = False + Next + + + ' Set DeletedRecordsIds to Nothing since we have deleted all pending deletes. + + Me.DeletedRecordIds = Nothing + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + + + ' Generate the event handling functions for filter and search events. + + + ' Generate the event handling functions for others + + + Private _UIData As New System.Collections.Generic.List(Of Hashtable) + Public Property UIData() As System.Collections.Generic.List(Of Hashtable) + Get + Return Me._UIData + End Get + Set(ByVal value As System.Collections.Generic.List(Of Hashtable)) + Me._UIData = value + End Set + End Property + + ' pagination properties + Protected _PageSize As Integer + Public Property PageSize() As Integer + Get + Return Me._PageSize + End Get + Set(ByVal value As Integer) + Me._PageSize = value + End Set + End Property + + Protected _PageIndex As Integer + Public Property PageIndex() As Integer + Get + ' Return the PageIndex + Return Me._PageIndex + End Get + Set(ByVal value As Integer) + Me._PageIndex = value + End Set + End Property + + Protected _TotalRecords As Integer = -1 + Public Property TotalRecords() As Integer + Get + If _TotalRecords < 0 + _TotalRecords = PersonalSalaryTable.GetRecordCount(CreateCompoundJoinFilter(), CreateWhereClause()) + End If + Return Me._TotalRecords + End Get + Set(ByVal value As Integer) + If Me.PageSize > 0 Then + + Me.TotalPages = CInt(Math.Ceiling(value / Me.PageSize)) + + End If + Me._TotalRecords = value + End Set + End Property + + + + Protected _TotalPages As Integer = -1 + Public Property TotalPages() As Integer + Get + If _TotalPages < 0 Then + + Me.TotalPages = CInt(Math.Ceiling(TotalRecords / Me.PageSize)) + + End If + Return Me._TotalPages + End Get + Set(ByVal value As Integer) + Me._TotalPages = value + End Set + End Property + + Protected _DisplayLastPage As Boolean + Public Property DisplayLastPage() As Boolean + Get + Return Me._DisplayLastPage + End Get + Set(ByVal value As Boolean) + Me._DisplayLastPage = value + End Set + End Property + + Private _DataChanged As Boolean = False + Public Property DataChanged() As Boolean + Get + Return Me._DataChanged + End Get + Set(ByVal value As Boolean) + Me._DataChanged = value + End Set + End Property + + Private _ResetData As Boolean = False + Public Property ResetData() As Boolean + Get + Return Me._ResetData + End Get + Set(ByVal value As Boolean) + Me._ResetData = value + End Set + End Property + + Private _AddNewRecord As Integer = 0 + Public Property AddNewRecord() As Integer + Get + Return Me._AddNewRecord + End Get + Set(ByVal value As Integer) + Me._AddNewRecord = value + End Set + End Property + + + Private _CurrentSortOrder As OrderBy = Nothing + Public Property CurrentSortOrder() As OrderBy + Get + Return Me._CurrentSortOrder + End Get + Set(ByVal value As BaseClasses.Data.OrderBy) + Me._CurrentSortOrder = value + End Set + End Property + + Private _DataSource() As PersonalSalaryRecord = Nothing + Public Property DataSource() As PersonalSalaryRecord () + Get + Return Me._DataSource + End Get + Set(ByVal value() As PersonalSalaryRecord) + Me._DataSource = value + End Set + End Property + +#Region "Helper Properties" + + Public ReadOnly Property CommandDateLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "CommandDateLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property PersonalSalaryAddButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalSalaryAddButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalSalaryDeleteButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalSalaryDeleteButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalSalaryEditButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalSalaryEditButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalSalaryPagination() As Persons.UI.IPagination + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalSalaryPagination"), Persons.UI.IPagination) + End Get + End Property + + Public ReadOnly Property PersonalSalaryRefreshButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalSalaryRefreshButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalSalaryResetButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalSalaryResetButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalSalarySaveButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalSalarySaveButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalSalaryTableControlCollapsibleRegion() As System.Web.UI.WebControls.Panel + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalSalaryTableControlCollapsibleRegion"), System.Web.UI.WebControls.Panel) + End Get + End Property + + Public ReadOnly Property PersonalSalaryTableControlIcon() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalSalaryTableControlIcon"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalSalaryTableControlPanelExtender() As AjaxControlToolkit.CollapsiblePanelExtender + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalSalaryTableControlPanelExtender"), AjaxControlToolkit.CollapsiblePanelExtender) + End Get + End Property + + Public ReadOnly Property PersonalSalaryTitle() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalSalaryTitle"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property PersonalSalaryToggleAll() As System.Web.UI.WebControls.CheckBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalSalaryToggleAll"), System.Web.UI.WebControls.CheckBox) + End Get + End Property + + Public ReadOnly Property PositionSalaryLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PositionSalaryLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property SalaryAmoutLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "SalaryAmoutLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property SalaryCommandLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "SalaryCommandLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property SalaryDateLabel1() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "SalaryDateLabel1"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property SalaryPlusLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "SalaryPlusLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property SalaryRankLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "SalaryRankLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property SalaryStepLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "SalaryStepLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property SalaryYearLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "SalaryYearLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + +#End Region + +#Region "Helper Functions" + + Public Overrides Overloads Function ModifyRedirectUrl(url As String, arg As String, ByVal bEncrypt As Boolean) As String + Return Me.Page.EvaluateExpressions(url, arg, bEncrypt, Me) + End Function + + Public Overrides Overloads Function EvaluateExpressions(url As String, arg As String, ByVal bEncrypt As Boolean) As String + Dim needToProcess As Boolean = AreAnyUrlParametersForMe(url, arg) + If (needToProcess) Then + Dim recCtl As PersonalSalaryTableControlRow = Me.GetSelectedRecordControl() + If recCtl Is Nothing AndAlso url.IndexOf("{") >= 0 Then + ' Localization. + Throw New Exception(Page.GetResourceValue("Err:NoRecSelected", "Persons")) + End If + Dim rec As PersonalSalaryRecord = Nothing + If recCtl IsNot Nothing Then + rec = recCtl.GetRecord() + End If + Return EvaluateExpressions(url, arg, rec, bEncrypt) + End If + Return url + End Function + + Public Overridable Function GetSelectedRecordIndex() As Integer + Dim counter As Integer = 0 + Dim recControl As PersonalSalaryTableControlRow + For Each recControl In Me.GetRecordControls() + If recControl.PersonalSalaryRecordRowSelection.Checked Then + Return counter + End If + counter += 1 + Next + Return -1 + End Function + + Public Overridable Function GetSelectedRecordControl() As PersonalSalaryTableControlRow + Dim selectedList() As PersonalSalaryTableControlRow = Me.GetSelectedRecordControls() + If selectedList.Length = 0 Then + Return Nothing + End If + Return selectedList(0) + + End Function + + Public Overridable Function GetSelectedRecordControls() As PersonalSalaryTableControlRow() + + Dim selectedList As ArrayList = New ArrayList(25) + Dim recControl As PersonalSalaryTableControlRow + For Each recControl In Me.GetRecordControls() + If recControl.PersonalSalaryRecordRowSelection IsNot Nothing AndAlso recControl.PersonalSalaryRecordRowSelection.Checked Then + selectedList.Add(recControl) + End If + Next + Return DirectCast(selectedList.ToArray(GetType(PersonalSalaryTableControlRow)), PersonalSalaryTableControlRow()) + + End Function + + Public Overridable Sub DeleteSelectedRecords(ByVal deferDeletion As Boolean) + Dim recList() As PersonalSalaryTableControlRow = Me.GetSelectedRecordControls() + If recList.Length = 0 Then + ' Localization. + Throw New Exception(Page.GetResourceValue("Err:NoRecSelected", "Persons")) + End If + + Dim recCtl As PersonalSalaryTableControlRow + For Each recCtl In recList + If deferDeletion Then + If Not recCtl.IsNewRecord Then + + Me.AddToDeletedRecordIds(recCtl) + + End If + recCtl.Visible = False + + recCtl.PersonalSalaryRecordRowSelection.Checked = False + + Else + + recCtl.Delete() + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + End If + Next + End Sub + + Public Function GetRecordControls() As PersonalSalaryTableControlRow() + Dim recList As ArrayList = New ArrayList() + Dim rep As System.Web.UI.WebControls.Repeater = CType(Me.FindControl("PersonalSalaryTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return Nothing + Dim repItem As System.Web.UI.WebControls.RepeaterItem + + For Each repItem In rep.Items + + Dim recControl As PersonalSalaryTableControlRow = DirectCast(repItem.FindControl("PersonalSalaryTableControlRow"), PersonalSalaryTableControlRow) + recList.Add(recControl) + + Next + + Return DirectCast(recList.ToArray(GetType(PersonalSalaryTableControlRow)), PersonalSalaryTableControlRow()) + 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 + + \ No newline at end of file diff --git a/App_Code/PersonalSpecialSkill/EditPersonalSpecialSkillTable.Controls.vb b/App_Code/PersonalSpecialSkill/EditPersonalSpecialSkillTable.Controls.vb new file mode 100644 index 0000000..a0d7eeb --- /dev/null +++ b/App_Code/PersonalSpecialSkill/EditPersonalSpecialSkillTable.Controls.vb @@ -0,0 +1,2670 @@ + +' This file implements the TableControl, TableControlRow, and RecordControl classes for the +' EditPersonalSpecialSkillTable.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.EditPersonalSpecialSkillTable + +#Region "Section 1: Place your customizations here." + + +Public Class PersonalSpecialSkillTableControlRow + Inherits BasePersonalSpecialSkillTableControlRow + ' The BasePersonalSpecialSkillTableControlRow implements code for a ROW within the + ' the PersonalSpecialSkillTableControl table. The BasePersonalSpecialSkillTableControlRow implements the DataBind and SaveData methods. + ' The loading of data is actually performed by the LoadData method in the base class of PersonalSpecialSkillTableControl. + + ' This is the ideal place to add your code customizations. For example, you can override the DataBind, + ' SaveData, GetUIData, and Validate methods. + Public Overrides Sub GetUIData() + + ' Call MyBase.GetUIData + MyBase.GetUIData() + + ' Get PersonalDD Record + Dim myRec As PersonalSpecialSkillRecord = Me.GetRecord + + ' Set PersonalId field value to new value string + myRec.PersonalId = Utils.SecurityControls.GetCurrentUserID + + End Sub + + +End Class + + + +Public Class PersonalSpecialSkillTableControl + Inherits BasePersonalSpecialSkillTableControl + + ' The BasePersonalSpecialSkillTableControl class implements the LoadData, DataBind, CreateWhereClause + ' and other methods to load and display the data in a table control. + + ' This is the ideal place to add your code customizations. You can override the LoadData and CreateWhereClause, + ' The PersonalSpecialSkillTableControlRow class offers another place where you can customize + ' the DataBind, GetUIData, SaveData and Validate methods specific to each row displayed on the table. + +End Class + + + +#End Region + + + +#Region "Section 2: Do not modify this section." + + +' Base class for the PersonalSpecialSkillTableControlRow control on the EditPersonalSpecialSkillTable page. +' Do not modify this class. Instead override any method in PersonalSpecialSkillTableControlRow. +Public Class BasePersonalSpecialSkillTableControlRow + Inherits Persons.UI.BaseApplicationRecordControl + + ' To customize, override this method in PersonalSpecialSkillTableControlRow. + Protected Overridable Sub Control_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Init + + Me.ClearControlsFromSession() + End Sub + + ' To customize, override this method in PersonalSpecialSkillTableControlRow. + Protected Overridable Sub Control_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load + + 'Call LoadFocusScripts from repeater so that onfocus attribute could be added to elements + Me.Page.LoadFocusScripts(Me) + + ' Show confirmation message on Click + Me.PersonalSpecialSkillRowDeleteButton.Attributes.Add("onClick", "return (confirm('" & (CType(Me.Page,BaseApplicationPage)).GetResourceValue("DeleteRecordConfirm", "Persons") & "'));") + + + ' Register the event handlers. + + AddHandler Me.PersonalSpecialSkillRowDeleteButton.Click, AddressOf PersonalSpecialSkillRowDeleteButton_Click + + AddHandler Me.PersonalId.SelectedIndexChanged, AddressOf PersonalId_SelectedIndexChanged + + AddHandler Me.Level.TextChanged, AddressOf Level_TextChanged + + AddHandler Me.Skill.TextChanged, AddressOf Skill_TextChanged + + + End Sub + + + Public Overridable Sub LoadData() + + ' Load the data from the database into the DataSource PersonalSpecialSkill 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 = PersonalSpecialSkillTable.GetRecord(Me.RecordUniqueId, True) + + Return + End If + + ' Since this is a row in the table, the data for this row is loaded by the + ' LoadData method of the BasePersonalSpecialSkillTableControl when the data for the entire + ' table is loaded. + + Me.DataSource = New PersonalSpecialSkillRecord() + + + + End Sub + + ' Populate the UI controls using the DataSource. To customize, override this method in PersonalSpecialSkillTableControlRow. + 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 + + SetLevel() + SetPersonalId() + + + SetSkill() + + + 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 SetLevel() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.Level.ID) Then + + Me.Level.Text = Me.PreviousUIData(Me.Level.ID).ToString() + + Return + End If + + + ' Set the Level TextBox on the webpage with value from the + ' PersonalSpecialSkill database record. + + ' Me.DataSource is the PersonalSpecialSkill record retrieved from the database. + ' Me.Level is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetLevel() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.LevelSpecified Then + + ' If the Level is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalSpecialSkillTable.Level) + + Me.Level.Text = formattedValue + + Else + + ' Level is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.Level.Text = PersonalSpecialSkillTable.Level.Format(PersonalSpecialSkillTable.Level.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetPersonalId() + + ' If selection was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.PersonalId.ID) Then + If Me.PreviousUIData(Me.PersonalId.ID) Is Nothing + Me.PopulatePersonalIdDropDownList(Nothing, 100) + Else + Me.PopulatePersonalIdDropDownList(Me.PreviousUIData(Me.PersonalId.ID).ToString(), 100) + End If + Return + End If + + + ' Set the PersonalId DropDownList on the webpage with value from the + ' PersonalSpecialSkill database record. + + ' Me.DataSource is the PersonalSpecialSkill record retrieved from the database. + ' Me.PersonalId is the ASP:DropDownList on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetPersonalId() + ' and add your own code before or after the call to the MyBase function. + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.PersonalIdSpecified Then + + ' If the PersonalId is non-NULL, then format the value. + ' The Format method will return the Display Foreign Key As (DFKA) value + Me.PopulatePersonalIdDropDownList(Me.DataSource.PersonalId, 100) + + Else + + ' PersonalId 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.PopulatePersonalIdDropDownList(Nothing, 100) + Else + Me.PopulatePersonalIdDropDownList(PersonalSpecialSkillTable.PersonalId.DefaultValue, 100) + End If + + End If + + End Sub + + Public Overridable Sub SetSkill() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.Skill.ID) Then + + Me.Skill.Text = Me.PreviousUIData(Me.Skill.ID).ToString() + + Return + End If + + + ' Set the Skill TextBox on the webpage with value from the + ' PersonalSpecialSkill database record. + + ' Me.DataSource is the PersonalSpecialSkill record retrieved from the database. + ' Me.Skill is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetSkill() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.SkillSpecified Then + + ' If the Skill is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalSpecialSkillTable.Skill) + + Me.Skill.Text = formattedValue + + Else + + ' Skill is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.Skill.Text = PersonalSpecialSkillTable.Skill.Format(PersonalSpecialSkillTable.Skill.DefaultValue) + + End If + + End Sub + + + Public EvaluateFormulaDelegate As BaseClasses.Data.DataSource.EvaluateFormulaDelegate = New BaseClasses.Data.DataSource.EvaluateFormulaDelegate(AddressOf Me.EvaluateFormula) + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean, ByVal e As FormulaEvaluator) As String + If e Is Nothing Then + e = New FormulaEvaluator() + End If + + e.Variables.Clear() + + + ' add variables for formula evaluation + If variables IsNot Nothing Then + Dim enumerator As System.Collections.Generic.IEnumerator(Of System.Collections.Generic.KeyValuePair(Of String, Object)) = variables.GetEnumerator() + While enumerator.MoveNext() + e.Variables.Add(enumerator.Current.Key, enumerator.Current.Value) + End While + End If + + If includeDS + + End IF + + + ' Other variables referred to in the formula are expected to be + ' properties of the DataSource. For example, referring to + ' UnitPrice as a variable will refer to DataSource.UnitPrice + If dataSourceForEvaluate Is Nothing Then + + e.DataSource = Me.DataSource + + Else + e.DataSource = dataSourceForEvaluate + End If + + ' Define the calling control. This is used to add other + ' related table and record controls as variables. + e.CallingControl = Me + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + + If Not String.IsNullOrEmpty(format) AndAlso (String.IsNullOrEmpty(formula) OrElse formula.IndexOf("Format(") < 0) Then + Return FormulaUtils.Format(resultObj, format) + Else + Return resultObj.ToString() + End If + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format,variables ,includeDS, Nothing) + End Function + + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object)) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format, variables ,True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, format, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal e as FormulaEvaluator) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, variables, True, e) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal includeDS as Boolean) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, includeDS, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, True, Nothing) + End Function + + + Public Overridable Sub RegisterPostback() + + + End Sub + + + + ' To customize, override this method in PersonalSpecialSkillTableControlRow. + Public Overridable Sub SaveData() + ' Saves the associated record in the database. + ' SaveData calls Validate and Get methods - so it may be more appropriate to + ' customize those methods. + + ' 1. Load the existing record from the database. Since we save the entire record, this ensures + ' that fields that are not displayed are also properly initialized. + Me.LoadData() + + + ' 2. Perform any custom validation. + Me.Validate() + + + ' 3. Set the values in the record with data from UI controls. + ' This calls the Get() method for each of the user interface controls. + Me.GetUIData() + + ' 4. Save in the database. + ' We should not save the record if the data did not change. This + ' will save a database hit and avoid triggering any database triggers. + + If Me.DataSource.IsAnyValueChanged Then + ' Save record to database but do not commit yet. + ' Auto generated ids are available after saving for use by child (dependent) records. + Me.DataSource.Save() + + DirectCast(GetParentControlObject(Me, "PersonalSpecialSkillTableControl"), PersonalSpecialSkillTableControl).DataChanged = True + DirectCast(GetParentControlObject(Me, "PersonalSpecialSkillTableControl"), PersonalSpecialSkillTableControl).ResetData = True + End If + + + ' update session or cookie by formula + + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + ' For Master-Detail relationships, save data on the Detail table(s) + + End Sub + + ' To customize, override this method in PersonalSpecialSkillTableControlRow. + 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. + + GetLevel() + GetPersonalId() + GetSkill() + End Sub + + + Public Overridable Sub GetLevel() + + ' Retrieve the value entered by the user on the Level ASP:TextBox, and + ' save it into the Level field in DataSource PersonalSpecialSkill record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.Level.Text, PersonalSpecialSkillTable.Level) + + + End Sub + + Public Overridable Sub GetPersonalId() + + ' Retrieve the value entered by the user on the PersonalId ASP:DropDownList, and + ' save it into the PersonalId field in DataSource PersonalSpecialSkill record. + + ' Custom validation should be performed in Validate, not here. + + Me.DataSource.Parse(GetValueSelectedPageRequest(Me.PersonalId), PersonalSpecialSkillTable.PersonalId) + + End Sub + + Public Overridable Sub GetSkill() + + ' Retrieve the value entered by the user on the Skill ASP:TextBox, and + ' save it into the Skill field in DataSource PersonalSpecialSkill record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.Skill.Text, PersonalSpecialSkillTable.Skill) + + + End Sub + + + ' To customize, override this method in PersonalSpecialSkillTableControlRow. + + Public Overridable Function CreateWhereClause() As WhereClause + + Return Nothing + + End Function + + + + ' To customize, override this method in PersonalSpecialSkillTableControlRow. + 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) + PersonalSpecialSkillTable.DeleteRecord(pkValue) + + DirectCast(GetParentControlObject(Me, "PersonalSpecialSkillTableControl"), PersonalSpecialSkillTableControl).DataChanged = True + DirectCast(GetParentControlObject(Me, "PersonalSpecialSkillTableControl"), PersonalSpecialSkillTableControl).ResetData = True + End Sub + + Protected Overridable Sub Control_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.PreRender + ' PreRender event is raised just before page is being displayed. + Try + DbUtils.StartTransaction() + Me.RegisterPostback() + + If Not Me.Page.ErrorOnPage AndAlso (Me.Page.IsPageRefresh OrElse Me.DataChanged OrElse Me.ResetData) Then + + + ' Re-load the data and update the web page if necessary. + ' This is typically done during a postback (filter, search button, sort, pagination button). + ' In each of the other click handlers, simply set DataChanged to True to reload the data. + Me.LoadData() + Me.DataBind() + End If + + + Catch ex As Exception + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + Finally + DbUtils.EndTransaction() + End Try + End Sub + + + Protected Overrides Sub SaveControlsToSession() + MyBase.SaveControlsToSession() + + + 'Save pagination state to session. + + End Sub + + + + Protected Overrides Sub ClearControlsFromSession() + MyBase.ClearControlsFromSession() + + + + ' Clear pagination state from session. + + End Sub + + Protected Overrides Sub LoadViewState(ByVal savedState As Object) + MyBase.LoadViewState(savedState) + Dim isNewRecord As String = CType(ViewState("IsNewRecord"), String) + If Not isNewRecord Is Nothing AndAlso isNewRecord.Trim <> "" Then + Me.IsNewRecord = Boolean.Parse(isNewRecord) + End If + + Dim myCheckSum As String = CType(ViewState("CheckSum"), String) + If Not myCheckSum Is Nothing AndAlso myCheckSum.Trim <> "" Then + Me.CheckSum = myCheckSum + End If + + + ' Load view state for pagination control. + + End Sub + + Protected Overrides Function SaveViewState() As Object + ViewState("IsNewRecord") = Me.IsNewRecord.ToString() + ViewState("CheckSum") = Me.CheckSum + + + ' Load view state for pagination control. + + Return MyBase.SaveViewState() + End Function + + + + Public Overridable Function CreateWhereClause_PersonalIdDropDownList() 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 PersonalId table. + ' Examples: + ' wc.iAND(PersonalIdTable.PersonalName, BaseFilter.ComparisonOperator.EqualsTo, "XYZ") + ' wc.iAND(PersonalIdTable.Active, BaseFilter.ComparisonOperator.EqualsTo, "1") + + Dim wc As WhereClause = New WhereClause() + Return wc + + End Function + + + ' Fill the PersonalId list. + Protected Overridable Sub PopulatePersonalIdDropDownList( _ + ByVal selectedValue As String, _ + ByVal maxItems As Integer) + + Me.PersonalId.Items.Clear() + + + ' 1. Setup the static list items + + ' Add the Please Select item. + Me.PersonalId.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_PersonalIdDropDownList function. + ' It is better to customize the where clause there. + + Dim wc As WhereClause = CreateWhereClause_PersonalIdDropDownList() + ' Create the ORDER BY clause to sort based on the displayed value. + + + Dim orderBy As OrderBy = New OrderBy(false, false) + orderBy.Add(PersonalIdTable.PersonalName, OrderByItem.OrderDir.Asc) + + Dim variables As System.Collections.Generic.IDictionary(Of String, Object) = New System.Collections.Generic.Dictionary(Of String, Object) + + ' 3. Read a total of maxItems from the database and insert them + Dim itemValues() As PersonalIdRecord = 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 = PersonalIdTable.GetRecords(wc, orderBy, pageNum, maxItems) + For each itemValue As PersonalIdRecord In itemValues + ' Create the item and add to the list. + Dim cvalue As String = Nothing + Dim fvalue As String = Nothing + If itemValue.PersonalIdSpecified Then + cvalue = itemValue.PersonalId.ToString() + + If counter < maxItems AndAlso Me.PersonalId.Items.FindByValue(cvalue) Is Nothing Then + + Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalSpecialSkillTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalSpecialSkillTable.PersonalId) + If _isExpandableNonCompositeForeignKey AndAlso PersonalSpecialSkillTable.PersonalId.IsApplyDisplayAs Then + fvalue = PersonalSpecialSkillTable.GetDFKA(itemValue, PersonalSpecialSkillTable.PersonalId) + End If + If (Not _isExpandableNonCompositeForeignKey) Or (String.IsNullOrEmpty(fvalue)) Then + fvalue = itemValue.Format(PersonalIdTable.PersonalName) + End If + + If fvalue Is Nothing OrElse fvalue.Trim() = "" Then fvalue = cvalue + + If (IsNothing(fvalue)) Then + fvalue = "" + End If + + fvalue = fvalue.Trim() + + If ( fvalue.Length > 50 ) Then + fvalue = fvalue.Substring(0, 50) & "..." + End If + + Dim dupItem As ListItem = Me.PersonalId.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.PersonalId.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.PersonalId, selectedValue) AndAlso _ + Not SetSelectedDisplayText(Me.PersonalId, selectedValue)Then + + ' construct a whereclause to query a record with PersonalId.PersonalId = selectedValue + Dim filter2 As CompoundFilter = New CompoundFilter(CompoundFilter.CompoundingOperators.And_Operator, Nothing) + Dim whereClause2 As WhereClause = New WhereClause() + filter2.AddFilter(New BaseClasses.Data.ColumnValueFilter(PersonalIdTable.PersonalId, selectedValue, BaseClasses.Data.BaseFilter.ComparisonOperator.EqualsTo, False)) + whereClause2.AddFilter(filter2, CompoundFilter.CompoundingOperators.And_Operator) + + Try + ' Execute the query + Dim rc() As PersonalIdRecord = PersonalIdTable.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 PersonalIdRecord = DirectCast(rc(0), PersonalIdRecord) + ' Create the item and add to the list. + Dim cvalue As String = Nothing + Dim fvalue As String = Nothing + If itemValue.PersonalIdSpecified Then + cvalue = itemValue.PersonalId.ToString() + Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalSpecialSkillTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalSpecialSkillTable.PersonalId) + If _isExpandableNonCompositeForeignKey AndAlso PersonalSpecialSkillTable.PersonalId.IsApplyDisplayAs Then + fvalue = PersonalSpecialSkillTable.GetDFKA(itemValue, PersonalSpecialSkillTable.PersonalId) + End If + If (Not _isExpandableNonCompositeForeignKey) Or (String.IsNullOrEmpty(fvalue)) Then + fvalue = itemValue.Format(PersonalIdTable.PersonalName) + End If + + If fvalue Is Nothing OrElse fvalue.Trim() = "" Then fvalue = cvalue + Dim newItem As New ListItem(fvalue, cvalue) + Me.PersonalId.Items.Add(newItem) + SetSelectedValue(Me.PersonalId, selectedValue) + End If + End If + Catch + End Try + + End If + + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalSpecialSkillRowDeleteButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + If(Not Me.Page.IsPageRefresh) Then + + Dim tc As PersonalSpecialSkillTableControl = DirectCast(GetParentControlObject(Me, "PersonalSpecialSkillTableControl"), PersonalSpecialSkillTableControl) + If Not (IsNothing(tc)) Then + If Not Me.IsNewRecord Then + tc.AddToDeletedRecordIds(DirectCast(Me, PersonalSpecialSkillTableControlRow)) + End If + Me.Visible = False + tc.SetFormulaControls() + End If + + End If + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + Protected Overridable Sub PersonalId_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()(PersonalId.ClientID & "_SelectedValue"), String) + Dim displayText As String = CType(Me.Page.Session()(PersonalId.ClientID & "_SelectedDisplayText"), String) + If displayText <> "" AndAlso val <> "" Then + Me.PersonalId.Items.Add(New ListItem(displayText, val)) + Me.PersonalId.SelectedIndex = Me.PersonalId.Items.Count - 1 + Me.Page.Session.Remove(PersonalId.ClientID & "_SelectedValue") + Me.Page.Session.Remove(PersonalId.ClientID & "_SelectedDisplayText") + End If + + + + + End Sub + + Protected Overridable Sub Level_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub Skill_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("BasePersonalSpecialSkillTableControlRow_Rec"), String) + End Get + Set(ByVal value As String) + Me.ViewState("BasePersonalSpecialSkillTableControlRow_Rec") = value + End Set + End Property + + Private _DataSource As PersonalSpecialSkillRecord + Public Property DataSource() As PersonalSpecialSkillRecord + Get + Return Me._DataSource + End Get + + Set(ByVal value As PersonalSpecialSkillRecord) + + Me._DataSource = value + End Set + End Property + + + + Private _checkSum As String + Public Overridable Property CheckSum() As String + Get + Return Me._checkSum + End Get + Set(ByVal value As String) + Me._checkSum = value + End Set + End Property + + Private _TotalPages As Integer + Public Property TotalPages() As Integer + Get + Return Me._TotalPages + End Get + Set(ByVal value As Integer) + Me._TotalPages = value + End Set + End Property + + Private _PageIndex As Integer + Public Property PageIndex() As Integer + Get + ' Return the PageIndex + Return Me._PageIndex + End Get + Set(ByVal value As Integer) + Me._PageIndex = value + End Set + End Property + + Private _DisplayLastPage As Boolean + Public Property DisplayLastPage() As Boolean + Get + Return Me._DisplayLastPage + End Get + Set(ByVal value As Boolean) + Me._DisplayLastPage = value + End Set + End Property + + + +#Region "Helper Properties" + + Public ReadOnly Property Level() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Level"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property PersonalId() As System.Web.UI.WebControls.DropDownList + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalId"), System.Web.UI.WebControls.DropDownList) + End Get + End Property + + Public ReadOnly Property PersonalSpecialSkillRecordRowSelection() As System.Web.UI.WebControls.CheckBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalSpecialSkillRecordRowSelection"), System.Web.UI.WebControls.CheckBox) + End Get + End Property + + Public ReadOnly Property PersonalSpecialSkillRowDeleteButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalSpecialSkillRowDeleteButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property Skill() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Skill"), System.Web.UI.WebControls.TextBox) + 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 PersonalSpecialSkillRecord = 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 PersonalSpecialSkillRecord + If Not Me.DataSource Is Nothing Then + Return Me.DataSource + End If + + If Not Me.RecordUniqueId Is Nothing Then + + Return PersonalSpecialSkillTable.GetRecord(Me.RecordUniqueId, True) + + End If + + ' Localization. + + Throw New Exception(Page.GetResourceValue("Err:RetrieveRec", "Persons")) + + End Function + + Public Shadows ReadOnly Property Page() As BaseApplicationPage + Get + Return DirectCast(MyBase.Page, BaseApplicationPage) + End Get + End Property + +#End Region + +End Class + + + +' Base class for the PersonalSpecialSkillTableControl control on the EditPersonalSpecialSkillTable page. +' Do not modify this class. Instead override any method in PersonalSpecialSkillTableControl. +Public Class BasePersonalSpecialSkillTableControl + Inherits Persons.UI.BaseApplicationTableControl + + + + Protected Overridable Sub Control_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Init + + + + ' Setup the filter and search events. + + + + ' Control Initializations. + ' Initialize the table's current sort order. + + If Me.InSession(Me, "Order_By") Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + End If + + + + ' Setup default pagination settings. + + Me.PageSize = CInt(Me.GetFromSession(Me, "Page_Size", "10")) + Me.PageIndex = CInt(Me.GetFromSession(Me, "Page_Index", "0")) + + + + Me.ClearControlsFromSession() + End Sub + + Protected Overridable Sub Control_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load + + SaveControlsToSession_Ajax() + + ' Show confirmation message on Click + Me.PersonalSpecialSkillDeleteButton.Attributes.Add("onClick", "return (confirm('" & (CType(Me.Page,BaseApplicationPage)).GetResourceValue("DeleteConfirm", "Persons") & "'));") + + ' Setup the pagination events. + + AddHandler Me.PersonalSpecialSkillPagination.FirstPage.Click, AddressOf PersonalSpecialSkillPagination_FirstPage_Click + + AddHandler Me.PersonalSpecialSkillPagination.LastPage.Click, AddressOf PersonalSpecialSkillPagination_LastPage_Click + + AddHandler Me.PersonalSpecialSkillPagination.NextPage.Click, AddressOf PersonalSpecialSkillPagination_NextPage_Click + + AddHandler Me.PersonalSpecialSkillPagination.PageSizeButton.Click, AddressOf PersonalSpecialSkillPagination_PageSizeButton_Click + + AddHandler Me.PersonalSpecialSkillPagination.PreviousPage.Click, AddressOf PersonalSpecialSkillPagination_PreviousPage_Click + + + ' Setup the sorting events. + + AddHandler Me.LevelLabel.Click, AddressOf LevelLabel_Click + + AddHandler Me.SkillLabel1.Click, AddressOf SkillLabel1_Click + + ' Setup the button events. + + AddHandler Me.PersonalSpecialSkillAddButton.Click, AddressOf PersonalSpecialSkillAddButton_Click + + AddHandler Me.PersonalSpecialSkillDeleteButton.Click, AddressOf PersonalSpecialSkillDeleteButton_Click + + AddHandler Me.PersonalSpecialSkillEditButton.Click, AddressOf PersonalSpecialSkillEditButton_Click + + AddHandler Me.PersonalSpecialSkillRefreshButton.Click, AddressOf PersonalSpecialSkillRefreshButton_Click + + AddHandler Me.PersonalSpecialSkillResetButton.Click, AddressOf PersonalSpecialSkillResetButton_Click + + AddHandler Me.PersonalSpecialSkillSaveButton.Click, AddressOf PersonalSpecialSkillSaveButton_Click + + Me.PersonalSpecialSkillSaveButton.Attributes.Add("onclick", "SubmitHRefOnce(this, """ & Me.Page.GetResourceValue("Txt:SaveRecord", "Persons") & """);") + + + ' Setup events for others + + End Sub + + + Public Overridable Sub LoadData() + + ' Read data from database. Returns an array of records that can be assigned + ' to the DataSource table control property. + Try + Dim joinFilter As CompoundFilter = CreateCompoundJoinFilter() + + ' The WHERE clause will be empty when displaying all records in table. + Dim wc As WhereClause = CreateWhereClause() + If wc IsNot Nothing AndAlso Not wc.RunQuery Then + ' Initialize an empty array of records + Dim alist As New ArrayList(0) + Me.DataSource = DirectCast(alist.ToArray(GetType(PersonalSpecialSkillRecord)), PersonalSpecialSkillRecord()) + ' Add records to the list if needed. + Me.AddNewRecords() + Me._TotalRecords = 0 + Me._TotalPages = 0 + Return + End If + + ' Call OrderBy to determine the order - either use the order defined + ' on the Query Wizard, or specified by user (by clicking on column heading) + Dim orderBy As OrderBy = CreateOrderBy() + + ' Get the pagesize from the pagesize control. + Me.GetPageSize() + + If Me.DisplayLastPage Then + Dim totalRecords As Integer = If(Me._TotalRecords < 0, PersonalSpecialSkillTable.GetRecordCount(CreateCompoundJoinFilter(), CreateWhereClause()), Me._TotalRecords) + + Dim totalPages As Integer = CInt(Math.Ceiling(totalRecords / Me.PageSize)) + + Me.PageIndex = totalPages - 1 + End If + + ' Make sure PageIndex (current page) and PageSize are within bounds. + If Me.PageIndex < 0 Then + Me.PageIndex = 0 + End If + If Me.PageSize < 1 Then + Me.PageSize = 1 + End If + + ' Retrieve the records and set the table DataSource. + ' Only PageSize records are fetched starting at PageIndex (zero based). + If Me.AddNewRecord > 0 Then + ' Make sure to preserve the previously entered data on new rows. + Dim postdata As New ArrayList + For Each rc As PersonalSpecialSkillTableControlRow In Me.GetRecordControls() + If Not rc.IsNewRecord Then + rc.DataSource = rc.GetRecord() + rc.GetUIData() + postdata.Add(rc.DataSource) + UIData.Add(rc.PreservedUIData()) + End If + Next + Me.DataSource = DirectCast(postdata.ToArray(GetType(PersonalSpecialSkillRecord)), PersonalSpecialSkillRecord()) + Else ' Get the records from the database + Me.DataSource = PersonalSpecialSkillTable.GetRecords(joinFilter, wc, orderBy, Me.PageIndex, Me.PageSize) + + End If + + ' if the datasource contains no records contained in database, then load the last page. + If (DbUtils.GetCreatedRecords(Me.DataSource).Length = 0 AndAlso Not Me.DisplayLastPage) Then + Me.DisplayLastPage = True + LoadData() + Else + + ' Add any new rows desired by the user. + Me.AddNewRecords() + + ' Turn off the ToggleAll checkbox + Me.PersonalSpecialSkillToggleAll.Checked = False + + + ' Initialize the page and grand totals. now + + End If + + Catch ex As Exception + ' Report the error message to the end user + Dim msg As String = ex.Message + If ex.InnerException IsNot Nothing Then + msg = msg & " InnerException: " & ex.InnerException.Message + End If + Throw New Exception(msg, ex.InnerException) + End Try + End Sub + + + + + Public Overrides Sub DataBind() + ' The DataBind method binds the user interface controls to the values + ' from the database record for each row in the table. To do this, it calls the + ' DataBind for each of the rows. + ' DataBind also populates any filters above the table, and sets the pagination + ' control to the correct number of records and the current page number. + + MyBase.DataBind() + + ' Make sure that the DataSource is initialized. + If Me.DataSource Is Nothing Then + Return + End If + + 'LoadData for DataSource for chart and report if they exist + + ' Improve performance by prefetching display as records. + Me.PreFetchForeignKeyValues() + + ' Setup the pagination controls. + BindPaginationControls() + + + + ' Bind the repeater with the list of records to expand the UI. + Dim rep As System.Web.UI.WebControls.Repeater = CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalSpecialSkillTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return + rep.DataSource = DataSource() + rep.DataBind() + + Dim index As Integer = 0 + For Each repItem As System.Web.UI.WebControls.RepeaterItem In rep.Items + ' Loop through all rows in the table, set its DataSource and call DataBind(). + Dim recControl As PersonalSpecialSkillTableControlRow = DirectCast(repItem.FindControl("PersonalSpecialSkillTableControlRow"), PersonalSpecialSkillTableControlRow) + recControl.DataSource = Me.DataSource(index) + If Me.UIData.Count > index Then + recControl.PreviousUIData = Me.UIData(index) + End If + recControl.DataBind() + recControl.Visible = Not Me.InDeletedRecordIds(recControl) + + index += 1 + Next + + + + + ' Call the Set methods for each controls on the panel + + SetLevelLabel() + + + + + + + + SetPersonalSpecialSkillTableControlCollapsibleRegion() + SetPersonalSpecialSkillTableControlIcon() + SetPersonalSpecialSkillTableControlPanelExtender() + + + SetSkillLabel1() + ' setting the state of expand or collapse alternative rows + + + ' Load data for each record and table UI control. + ' Ordering is important because child controls get + ' their parent ids from their parent UI controls. + + + ' this method calls the set method for controls with special formula like running total, sum, rank, etc + SetFormulaControls() + End Sub + + Public Overridable Sub SetFormulaControls() + ' this method calls Set methods for the control that has special formula + + + + End Sub + + + Public Sub PreFetchForeignKeyValues() + If (IsNothing(Me.DataSource)) + Return + End If + + Me.Page.PregetDfkaRecords(PersonalSpecialSkillTable.PersonalId, Me.DataSource) + + End Sub + + + Public Overridable Sub RegisterPostback() + + Me.Page.RegisterPostBackTrigger(MiscUtils.FindControlRecursively(Me,"PersonalSpecialSkillSaveButton")) + + + End Sub + + Public EvaluateFormulaDelegate As BaseClasses.Data.DataSource.EvaluateFormulaDelegate = New BaseClasses.Data.DataSource.EvaluateFormulaDelegate(AddressOf Me.EvaluateFormula) + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean, ByVal e as FormulaEvaluator) As String + If e Is Nothing + e = New FormulaEvaluator() + End If + + e.Variables.Clear() + + + ' add variables for formula evaluation + If variables IsNot Nothing Then + Dim enumerator As System.Collections.Generic.IEnumerator(Of System.Collections.Generic.KeyValuePair(Of String, Object)) = variables.GetEnumerator() + While enumerator.MoveNext() + e.Variables.Add(enumerator.Current.Key, enumerator.Current.Value) + End While + End If + + If includeDS + + End If + + ' All variables referred to in the formula are expected to be + ' properties of the DataSource. For example, referring to + ' UnitPrice as a variable will refer to DataSource.UnitPrice + e.DataSource = dataSourceForEvaluate + + ' Define the calling control. This is used to add other + ' related table and record controls as variables. + e.CallingControl = Me + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + + If Not String.IsNullOrEmpty(format) AndAlso (String.IsNullOrEmpty(formula) OrElse formula.IndexOf("Format(") < 0) Then + Return FormulaUtils.Format(resultObj, format) + Else + Return resultObj.ToString() + End If + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format,variables ,includeDS, Nothing) + End Function + + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object)) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format, variables ,True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, format, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal e as FormulaEvaluator) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, variables, True, e) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal includeDS as Boolean) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, includeDS, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, True, Nothing) + End Function + + + + + Public Overridable Sub ResetControl() + + Me.CurrentSortOrder.Reset() + If (Me.InSession(Me, "Order_By")) Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + End If + + Me.PageIndex = 0 + End Sub + + Protected Overridable Sub BindPaginationControls() + ' Setup the pagination controls. + + ' Bind the pagination labels. + + If DbUtils.GetCreatedRecords(Me.DataSource).Length > 0 Then + + Me.PersonalSpecialSkillPagination.CurrentPage.Text = (Me.PageIndex + 1).ToString() + Else + Me.PersonalSpecialSkillPagination.CurrentPage.Text = "0" + End If + Me.PersonalSpecialSkillPagination.PageSize.Text = Me.PageSize.ToString() + Me.PersonalSpecialSkillPagination.TotalItems.Text = Me.TotalRecords.ToString() + Me.PersonalSpecialSkillPagination.TotalPages.Text = Me.TotalPages.ToString() + + ' Bind the buttons for PersonalSpecialSkillTableControl pagination. + + Me.PersonalSpecialSkillPagination.FirstPage.Enabled = Not (Me.PageIndex = 0) + If Me._TotalPages < 0 Then ' if the total pages is not determined yet, enable last and next buttons + Me.PersonalSpecialSkillPagination.LastPage.Enabled = True + ElseIf Me._TotalPages = 0 ' if the total pages is determined and it is 0, enable last and next buttons + Me.PersonalSpecialSkillPagination.LastPage.Enabled = False + Else ' if the total pages is the last page, disable last and next buttons + Me.PersonalSpecialSkillPagination.LastPage.Enabled = Not (Me.PageIndex = Me.TotalPages - 1) + End If + + If Me._TotalPages < 0 Then ' if the total pages is not determined yet, enable last and next buttons + Me.PersonalSpecialSkillPagination.NextPage.Enabled = True + ElseIf Me._TotalPages = 0 ' if the total pages is determined and it is 0, enable last and next buttons + Me.PersonalSpecialSkillPagination.NextPage.Enabled = False + Else ' if the total pages is the last page, disable last and next buttons + Me.PersonalSpecialSkillPagination.NextPage.Enabled = Not (Me.PageIndex = Me.TotalPages - 1) + End If + + Me.PersonalSpecialSkillPagination.PreviousPage.Enabled = Not (Me.PageIndex = 0) + + + End Sub + + Public Overridable Sub SaveData() + ' Save the data from the entire table. Calls each row's Save Data + ' to save their data. This function is called by the Click handler of the + ' Save button. The button handler should Start/Commit/End a transaction. + + Dim recCtl As PersonalSpecialSkillTableControlRow + For Each recCtl In Me.GetRecordControls() + + If Me.InDeletedRecordIds(recCtl) Then + ' Delete any pending deletes. + recCtl.Delete() + Else + If recCtl.Visible Then + recCtl.SaveData() + End If + End If + + Next + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + ' Set IsNewRecord to False for all records - since everything has been saved and is no longer "new" + For Each recCtl In Me.GetRecordControls() + recCtl.IsNewRecord = False + Next + + + ' Set DeletedRecordsIds to Nothing since we have deleted all pending deletes. + Me.DeletedRecordIds = Nothing + + End Sub + + Public Overridable Function CreateCompoundJoinFilter() As CompoundFilter + Dim jFilter As CompoundFilter = New CompoundFilter() + + Return jFilter + + End Function + + + Public Overridable Function CreateOrderBy() As OrderBy + ' The CurrentSortOrder is initialized to the sort order on the + ' Query Wizard. It may be modified by the Click handler for any of + ' the column heading to sort or reverse sort by that column. + ' You can add your own sort order, or modify it on the Query Wizard. + Return Me.CurrentSortOrder + End Function + + Public Overridable Function CreateWhereClause() As WhereClause + 'This CreateWhereClause is used for loading the data. + PersonalSpecialSkillTable.Instance.InnerFilter = Nothing + Dim wc As WhereClause = New WhereClause() + + ' Compose the WHERE clause consiting of: + ' 1. Static clause defined at design time. + ' 2. User selected search criteria. + ' 3. User selected filter criteria. + + + ' Get the static clause defined at design time on the Table Panel Wizard + Dim qc As WhereClause = Me.CreateQueryClause() + If Not(IsNothing(qc)) Then + wc.iAND(qc) + End If + + Return wc + End Function + + + Public Overridable Function CreateWhereClause(ByVal searchText as String, ByVal fromSearchControl as String, ByVal AutoTypeAheadSearch as String, ByVal AutoTypeAheadWordSeparators as String) As WhereClause + ' This CreateWhereClause is used for loading list of suggestions for Auto Type-Ahead feature. + PersonalSpecialSkillTable.Instance.InnerFilter = Nothing + Dim wc As WhereClause = New WhereClause() + + ' Compose the WHERE clause consiting of: + ' 1. Static clause defined at design time. + ' 2. User selected search criteria. + ' 3. User selected filter criteria. + + Dim appRelativeVirtualPath As String = CType(HttpContext.Current.Session("AppRelativeVirtualPath"), String) + + ' Get the static clause defined at design time on the Table Panel Wizard + Dim qc As WhereClause = Me.CreateQueryClause() + If Not(IsNothing(qc)) Then + wc.iAND(qc) + End If + + ' Adds clauses if values are selected in Filter controls which are configured in the page. + + + Return wc + End Function + + Protected Overridable Function CreateQueryClause() As WhereClause + ' Create a where clause for the Static clause defined at design time. + Dim filter As CompoundFilter = New CompoundFilter(CompoundFilter.CompoundingOperators.And_Operator, Nothing) + Dim whereClause As WhereClause = New WhereClause() + + filter.AddFilter(New BaseClasses.Data.SignedInUserFilter(BaseClasses.Data.BaseTable.CreateInstance("Persons.Business.PersonalSpecialSkillTable, App_Code").TableDefinition.ColumnList.GetByUniqueName("PersonalSpecialSkill_.PersonalId"), New BaseClasses.Data.IdentifierAliasInfo("PersonalSpecialSkill_", Nothing), BaseClasses.Data.BaseFilter.ComparisonOperator.EqualsTo, False)) + + whereClause.AddFilter(filter, CompoundFilter.CompoundingOperators.And_Operator) + + Return whereClause + + End Function + + + Public Overridable Function FormatSuggestions(ByVal prefixText As String, ByVal resultItem As String, _ + ByVal columnLength As Integer, ByVal AutoTypeAheadDisplayFoundText As String, _ + ByVal autoTypeAheadSearch As String, ByVal AutoTypeAheadWordSeparators As String, _ + ByVal resultList As ArrayList) As Boolean + + 'Formats the resultItem and adds it to the list of suggestions. + Dim index As Integer = resultItem.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture).IndexOf(prefixText.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture)) + Dim itemToAdd As String = "" + Dim isFound As Boolean = False + Dim isAdded As Boolean = False + ' Get the index where prfixt is at the beginning of resultItem. If not found then, index of word which begins with prefixText. + If InvariantLCase(autoTypeAheadSearch).equals("wordsstartingwithsearchstring") And Not index = 0 Then + ' Expression to find word which contains AutoTypeAheadWordSeparators followed by prefixText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex( AutoTypeAheadWordSeparators + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + If regex1.IsMatch(resultItem) Then + index = regex1.Match(resultItem).Index + isFound = True + End If + ' If the prefixText is found immediatly after white space then starting of the word is found so don not search any further + If not resultItem(index).ToString() = " " Then + ' Expression to find beginning of the word which contains AutoTypeAheadWordSeparators followed by prefixText + Dim regex As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\\S*" + AutoTypeAheadWordSeparators + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + If regex.IsMatch(resultItem) Then + index = regex.Match(resultItem).Index + isFound = True + End If + End If + End If + + ' If autoTypeAheadSearch value is wordsstartingwithsearchstring then, extract the substring only if the prefixText is found at the + ' beginning of the resultItem (index = 0) or a word in resultItem is found starts with prefixText. + If index = 0 Or isFound Or InvariantLCase(autoTypeAheadSearch).Equals("anywhereinstring") then + If InvariantLCase(AutoTypeAheadDisplayFoundText).equals("atbeginningofmatchedstring") Then + ' Expression to find beginning of the word which contains prefixText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\\S*" + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + ' Find the beginning of the word which contains prefexText + If (StringUtils.InvariantLCase(autoTypeAheadSearch).Equals("anywhereinstring") AndAlso regex1.IsMatch(resultItem)) Then + index = regex1.Match(resultItem).Index + isFound = True + End If + ' Display string from the index till end of the string if sub string from index till end is less than columnLength value. + If Len(resultItem) - index <= columnLength Then + If index = 0 Then + itemToAdd = resultItem + Else + itemToAdd = "..." & resultItem.Substring(index, Len(resultItem) - index) + End If + Else + If index = 0 Then + itemToAdd = resultItem.Substring(index, (columnLength - 3)) & "..." + Else + 'Truncate the string to show only columnLength - 6 characters as begining and trailing "..." has to be appended. + itemToAdd = "..." & resultItem.Substring(index , columnLength - 6) & "..." + End If + End If + ElseIf InvariantLCase(AutoTypeAheadDisplayFoundText).equals("inmiddleofmatchedstring") Then + Dim subStringBeginIndex As Integer = CType(columnLength/2, Integer) + If Len(resultItem) <= columnLength Then + itemToAdd = resultItem + Else + ' Sanity check at end of the string + If index + Len(prefixText) = columnLength Then + itemToAdd = "..." & resultItem.Substring(index-columnLength,index) + ElseIf Len(resultItem) - index < subStringBeginIndex Then + ' Display string from the end till columnLength value if, index is closer to the end of the string. + itemToAdd = "..." & resultItem.Substring(Len(resultItem)-columnLength,Len(resultItem)) + ElseIf index <= subStringBeginIndex Then + ' Sanity chet at beginning of the string + itemToAdd = resultItem.Substring(0, columnLength) & "..." + Else + ' Display string containing text before the prefixText occures and text after the prefixText + itemToAdd = "..." & resultItem.Substring(index - subStringBeginIndex, columnLength) & "..." + End If + End If + ElseIf InvariantLCase(AutoTypeAheadDisplayFoundText).equals("atendofmatchedstring") Then + ' Expression to find ending of the word which contains prefexText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\s", System.Text.RegularExpressions.RegexOptions.IgnoreCase) + ' Find the ending of the word which contains prefexText + If regex1.IsMatch(resultItem, index + 1) Then + index = regex1.Match(resultItem, index + 1).Index + Else + ' If the word which contains prefexText is the last word in string, regex1.IsMatch returns false. + index = resultItem.Length + End If + If index > Len(resultItem) Then + index = Len(resultItem) + End If + ' If text from beginning of the string till index is less than columnLength value then, display string from the beginning till index. + If index <= columnLength Then + if index = Len(resultItem) Then 'Make decision to append "..." + itemToAdd = resultItem.Substring(0,index) + Else + itemToAdd = resultItem.Substring(0,index) & "..." + End If + Else + If index = Len(resultItem) Then + itemToAdd = "..." & resultItem.Substring(index - (columnLength - 3), (columnLength - 3)) + Else + 'Truncate the string to show only columnLength - 6 characters as begining and trailing "..." has to be appended. + itemToAdd = "..." & resultItem.Substring(index - (columnLength - 6), columnLength - 6) & "..." + End If + End If + End If + + ' Remove newline character from itemToAdd + Dim prefixTextIndex As Integer = itemToAdd.IndexOf(prefixText, StringComparison.CurrentCultureIgnoreCase) + ' If itemToAdd contains any newline after the search text then show text only till newline + Dim regex2 As System.Text.RegularExpressions.Regex = New System.Text.RegularExpressions.Regex("(" & vbCrLf & "|" & vbLf & ")", System.Text.RegularExpressions.RegexOptions.IgnoreCase) + Dim newLineIndexAfterPrefix As Integer = -1 + If regex2.IsMatch(itemToAdd, prefixTextIndex) Then + newLineIndexAfterPrefix = regex2.Match(itemToAdd, prefixTextIndex).Index + End If + If (newLineIndexAfterPrefix > -1) Then + If itemToAdd.EndsWith("...") Then + itemToAdd = (itemToAdd.Substring(0, newLineIndexAfterPrefix) + "...") + Else + itemToAdd = itemToAdd.Substring(0, newLineIndexAfterPrefix) + End If + End If + ' If itemToAdd contains any newline before search text then show text which comes after newline + Dim regex3 As System.Text.RegularExpressions.Regex = New System.Text.RegularExpressions.Regex("(" & vbCrLf & "|" & vbLf & ")", (System.Text.RegularExpressions.RegexOptions.IgnoreCase Or System.Text.RegularExpressions.RegexOptions.RightToLeft)) + Dim newLineIndexBeforePrefix As Integer = -1 + If regex3.IsMatch(itemToAdd, prefixTextIndex) Then + newLineIndexBeforePrefix = regex3.Match(itemToAdd, prefixTextIndex).Index + End If + If (newLineIndexBeforePrefix > -1) Then + If itemToAdd.StartsWith("...") Then + itemToAdd = ("..." + itemToAdd.Substring((newLineIndexBeforePrefix + regex3.Match(itemToAdd, prefixTextIndex).Length))) + Else + itemToAdd = itemToAdd.Substring((newLineIndexBeforePrefix + regex3.Match(itemToAdd, prefixTextIndex).Length)) + End If + End If + + If Not itemToAdd is nothing AndAlso Not resultList.Contains(itemToAdd) Then + + resultList.Add(itemToAdd) + + isAdded = true + End If + End If + Return isAdded + End Function + + + Protected Overridable Sub GetPageSize() + + If Me.PersonalSpecialSkillPagination.PageSize.Text.Trim <> "" Then + Try + 'Me.PageSize = Integer.Parse(Me.PersonalSpecialSkillPagination.PageSize.Text) + Catch ex As Exception + End Try + End If + End Sub + + Protected Overridable Sub AddNewRecords() + + Dim newRecordList As ArrayList = New ArrayList() + + Dim newUIDataList As System.Collections.Generic.List(Of Hashtable) = New System.Collections.Generic.List(Of Hashtable)() + + ' Loop though all the record controls and if the record control + ' does not have a unique record id set, then create a record + ' and add to the list. + If Not Me.ResetData Then + Dim rep As System.Web.UI.WebControls.Repeater = CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalSpecialSkillTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return + + Dim repItem As System.Web.UI.WebControls.RepeaterItem + For Each repItem In rep.Items + ' Loop through all rows in the table, set its DataSource and call DataBind(). + + Dim recControl As PersonalSpecialSkillTableControlRow = DirectCast(repItem.FindControl("PersonalSpecialSkillTableControlRow"), PersonalSpecialSkillTableControlRow) + + If recControl.Visible AndAlso recControl.IsNewRecord() Then + + Dim rec As PersonalSpecialSkillRecord = New PersonalSpecialSkillRecord() + + If recControl.Level.Text <> "" Then + rec.Parse(recControl.Level.Text, PersonalSpecialSkillTable.Level) + End If + If MiscUtils.IsValueSelected(recControl.PersonalId) Then + rec.Parse(recControl.PersonalId.SelectedItem.Value, PersonalSpecialSkillTable.PersonalId) + End If + If recControl.Skill.Text <> "" Then + rec.Parse(recControl.Skill.Text, PersonalSpecialSkillTable.Skill) + End If + newUIDataList.Add(recControl.PreservedUIData()) + newRecordList.Add(rec) + End If + Next + End If + + + ' Add any new record to the list. + Dim index As Integer = 0 + For index = 1 To Me.AddNewRecord + + newRecordList.Insert(0, New PersonalSpecialSkillRecord()) + newUIDataList.Insert(0, New Hashtable()) + + Next + Me.AddNewRecord = 0 + + ' Finally, add any new records to the DataSource. + If newRecordList.Count > 0 Then + + Dim finalList As ArrayList = New ArrayList(Me.DataSource) + finalList.InsertRange(0, newRecordList) + + Me.DataSource = DirectCast(finalList.ToArray(GetType(PersonalSpecialSkillRecord)), PersonalSpecialSkillRecord()) + + End If + + ' Add the existing UI data to this hash table + If newUIDataList.Count > 0 Then + Me.UIData.InsertRange(0, newUIDataList) + End If + + End Sub + + + Public Sub AddToDeletedRecordIds(ByVal rec As PersonalSpecialSkillTableControlRow) + If rec.IsNewRecord() Then + Return + End If + + If Not Me.DeletedRecordIds Is Nothing AndAlso Me.DeletedRecordIds.Trim <> "" Then + Me.DeletedRecordIds &= "," + End If + + Me.DeletedRecordIds &= "[" & rec.RecordUniqueId & "]" + End Sub + + Protected Overridable Function InDeletedRecordIds(ByVal rec As PersonalSpecialSkillTableControlRow) As Boolean + If Me.DeletedRecordIds Is Nothing OrElse Me.DeletedRecordIds.Trim = "" Then + Return False + End If + + Return Me.DeletedRecordIds.IndexOf("[" & rec.RecordUniqueId & "]") >= 0 + End Function + + Private _DeletedRecordIds As String + Public Property DeletedRecordIds() As String + Get + Return Me._DeletedRecordIds + End Get + Set(ByVal value As String) + Me._DeletedRecordIds = value + End Set + End Property + + + ' Create Set, WhereClause, and Populate Methods + + Public Overridable Sub SetLevelLabel() + + End Sub + + Public Overridable Sub SetPersonalSpecialSkillTableControlCollapsibleRegion() + + End Sub + + Public Overridable Sub SetPersonalSpecialSkillTableControlIcon() + + End Sub + + Public Overridable Sub SetPersonalSpecialSkillTableControlPanelExtender() + + End Sub + + Public Overridable Sub SetSkillLabel1() + + 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. + Dim added As Boolean = Me.AddNewRecord > 0 + Me.LoadData() + Me.DataBind() + + If added Then + Me.SetFocusToAddedRow() + End If + + End If + + + + Catch ex As Exception + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + Finally + DbUtils.EndTransaction + End Try + End Sub + + 'this function sets focus to the first editable element in the new added row in the editable table + Protected Overridable Sub SetFocusToAddedRow() + Dim rep As System.Web.UI.WebControls.Repeater = CType(Me.FindControl("PersonalSpecialSkillTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing OrElse rep.Items.Count = 0 Then Return + Dim repItem As System.Web.UI.WebControls.RepeaterItem + For Each repItem In rep.Items + 'Load scripts to table rows + Me.Page.LoadFocusScripts(repItem) + Dim recControl As PersonalSpecialSkillTableControlRow = DirectCast(repItem.FindControl("PersonalSpecialSkillTableControlRow"), PersonalSpecialSkillTableControlRow) + If recControl.IsNewRecord Then + For Each field As Control In recControl.Controls + If field.Visible AndAlso Me.Page.IsControlEditable(field, False) Then + 'set focus on the first editable field in the new row + field.Focus() + Dim updPan As UpdatePanel = DirectCast(Me.Page.FindControlRecursively("UpdatePanel1"), UpdatePanel) + If Not updPan Is Nothing Then updPan.Update() + Return + End If + Next + Return + End If + Next + End Sub + + + Protected Overrides Sub SaveControlsToSession() + MyBase.SaveControlsToSession() + + ' Save filter controls to values to session. + + + 'Save pagination state to session. + + + + ' Save table control properties to the session. + If Not Me.CurrentSortOrder Is Nothing Then + Me.SaveToSession(Me, "Order_By", Me.CurrentSortOrder.ToXmlString()) + End If + + Me.SaveToSession(Me, "Page_Index", Me.PageIndex.ToString()) + Me.SaveToSession(Me, "Page_Size", Me.PageSize.ToString()) + + Me.SaveToSession(Me, "DeletedRecordIds", Me.DeletedRecordIds) + + End Sub + + Protected Sub SaveControlsToSession_Ajax() + ' Save filter controls to values to session. + + HttpContext.Current.Session("AppRelativeVirtualPath") = Me.Page.AppRelativeVirtualPath + + End Sub + + Protected Overrides Sub ClearControlsFromSession() + MyBase.ClearControlsFromSession() + + ' Clear filter controls values from the session. + + + ' Clear pagination state from session. + + + + ' Clear table properties from the session. + Me.RemoveFromSession(Me, "Order_By") + Me.RemoveFromSession(Me, "Page_Index") + Me.RemoveFromSession(Me, "Page_Size") + + Me.RemoveFromSession(Me, "DeletedRecordIds") + + End Sub + + Protected Overrides Sub LoadViewState(ByVal savedState As Object) + MyBase.LoadViewState(savedState) + + Dim orderByStr As String = CType(ViewState("PersonalSpecialSkillTableControl_OrderBy"), String) + + If orderByStr IsNot Nothing AndAlso orderByStr.Trim <> "" Then + Me.CurrentSortOrder = BaseClasses.Data.OrderBy.FromXmlString(orderByStr) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + End If + + Dim pageIndex As String = CType(ViewState("Page_Index"), String) + If pageIndex IsNot Nothing Then + Me.PageIndex = CInt(pageIndex) + End If + + Dim pageSize As String = CType(ViewState("Page_Size"), String) + If Not pageSize Is Nothing Then + Me.PageSize = CInt(pageSize) + End If + + + + ' Load view state for pagination control. + + Me.DeletedRecordIds = CType(Me.ViewState("DeletedRecordIds"), String) + + End Sub + + Protected Overrides Function SaveViewState() As Object + + If Me.CurrentSortOrder IsNot Nothing Then + Me.ViewState("PersonalSpecialSkillTableControl_OrderBy") = Me.CurrentSortOrder.ToXmlString() + End If + + Me.ViewState("Page_Index") = Me.PageIndex + Me.ViewState("Page_Size") = Me.PageSize + + Me.ViewState("DeletedRecordIds") = Me.DeletedRecordIds + + + ' Load view state for pagination control. + + + Return MyBase.SaveViewState() + End Function + + ' Generate the event handling functions for pagination events. + + ' event handler for ImageButton + Public Overridable Sub PersonalSpecialSkillPagination_FirstPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.PageIndex = 0 + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalSpecialSkillPagination_LastPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.DisplayLastPage = True + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalSpecialSkillPagination_NextPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.PageIndex += 1 + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for LinkButton + Public Overridable Sub PersonalSpecialSkillPagination_PageSizeButton_Click(ByVal sender As Object, ByVal args As EventArgs) + + Try + + Me.DataChanged = True + + Me.PageSize = Integer.Parse(Me.PersonalSpecialSkillPagination.PageSize.Text) + + Me.PageIndex = Integer.Parse(Me.PersonalSpecialSkillPagination.CurrentPage.Text) - 1 + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalSpecialSkillPagination_PreviousPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + If Me.PageIndex > 0 Then + Me.PageIndex -= 1 + Me.DataChanged = True + End If + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + + ' Generate the event handling functions for sorting events. + + Public Overridable Sub LevelLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by Level when clicked. + + ' Get previous sorting state for Level. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalSpecialSkillTable.Level) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for Level. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalSpecialSkillTable.Level, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by Level, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub SkillLabel1_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by Skill when clicked. + + ' Get previous sorting state for Skill. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalSpecialSkillTable.Skill) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for Skill. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalSpecialSkillTable.Skill, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by Skill, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + + ' Generate the event handling functions for button events. + + ' event handler for ImageButton + Public Overridable Sub PersonalSpecialSkillAddButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + Me.AddNewRecord = 1 + Me.DataChanged = True + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalSpecialSkillDeleteButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + If(Not Me.Page.IsPageRefresh) Then + + Me.DeleteSelectedRecords(True) + Me.SetFormulaControls() + + + End If + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalSpecialSkillEditButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + ' The redirect URL is set on the Properties, Custom Properties or Actions. + ' The ModifyRedirectURL call resolves the parameters before the + ' Response.Redirect redirects the page to the URL. + ' Any code after the Response.Redirect call will not be executed, since the page is + ' redirected to the URL. + + + Dim url As String = "../Shared/ConfigureEditRecord.aspx" + + Dim shouldRedirect As Boolean = True + Dim TargetKey As String = Nothing + Dim DFKA As String = TargetKey + Dim id As String = DFKA + Dim value As String = id + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + url = Me.ModifyRedirectUrl(url, "",False) + url = Me.Page.ModifyRedirectUrl(url, "",False) + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + shouldRedirect = False + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + If shouldRedirect Then + Me.Page.ShouldSaveControlsToSession = True + Me.Page.Response.Redirect(url) + ElseIf Not TargetKey Is Nothing AndAlso _ + Not shouldRedirect Then + Me.Page.ShouldSaveControlsToSession = True + Me.Page.CloseWindow(True) + + End If + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalSpecialSkillRefreshButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Dim PersonalSpecialSkillTableControlObj as PersonalSpecialSkillTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalSpecialSkillTableControl"), PersonalSpecialSkillTableControl) + PersonalSpecialSkillTableControlObj.ResetData = True + + PersonalSpecialSkillTableControlObj.RemoveFromSession(PersonalSpecialSkillTableControlObj, "DeletedRecordIds") + PersonalSpecialSkillTableControlObj.DeletedRecordIds = Nothing + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalSpecialSkillResetButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.CurrentSortOrder.Reset() + If Me.InSession(Me, "Order_By") Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + + End If + + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalSpecialSkillSaveButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + + If (Not Me.Page.IsPageRefresh) Then + Me.SaveData() + End If + + Me.Page.CommitTransaction(sender) + ' Set IsNewRecord to False for all records - since everything has been saved and is no longer "new" + Dim recCtl As PersonalSpecialSkillTableControlRow + For Each recCtl in Me.GetRecordControls() + + recCtl.IsNewRecord = False + Next + + + ' Set DeletedRecordsIds to Nothing since we have deleted all pending deletes. + + Me.DeletedRecordIds = Nothing + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + + + ' Generate the event handling functions for filter and search events. + + + ' Generate the event handling functions for others + + + Private _UIData As New System.Collections.Generic.List(Of Hashtable) + Public Property UIData() As System.Collections.Generic.List(Of Hashtable) + Get + Return Me._UIData + End Get + Set(ByVal value As System.Collections.Generic.List(Of Hashtable)) + Me._UIData = value + End Set + End Property + + ' pagination properties + Protected _PageSize As Integer + Public Property PageSize() As Integer + Get + Return Me._PageSize + End Get + Set(ByVal value As Integer) + Me._PageSize = value + End Set + End Property + + Protected _PageIndex As Integer + Public Property PageIndex() As Integer + Get + ' Return the PageIndex + Return Me._PageIndex + End Get + Set(ByVal value As Integer) + Me._PageIndex = value + End Set + End Property + + Protected _TotalRecords As Integer = -1 + Public Property TotalRecords() As Integer + Get + If _TotalRecords < 0 + _TotalRecords = PersonalSpecialSkillTable.GetRecordCount(CreateCompoundJoinFilter(), CreateWhereClause()) + End If + Return Me._TotalRecords + End Get + Set(ByVal value As Integer) + If Me.PageSize > 0 Then + + Me.TotalPages = CInt(Math.Ceiling(value / Me.PageSize)) + + End If + Me._TotalRecords = value + End Set + End Property + + + + Protected _TotalPages As Integer = -1 + Public Property TotalPages() As Integer + Get + If _TotalPages < 0 Then + + Me.TotalPages = CInt(Math.Ceiling(TotalRecords / Me.PageSize)) + + End If + Return Me._TotalPages + End Get + Set(ByVal value As Integer) + Me._TotalPages = value + End Set + End Property + + Protected _DisplayLastPage As Boolean + Public Property DisplayLastPage() As Boolean + Get + Return Me._DisplayLastPage + End Get + Set(ByVal value As Boolean) + Me._DisplayLastPage = value + End Set + End Property + + Private _DataChanged As Boolean = False + Public Property DataChanged() As Boolean + Get + Return Me._DataChanged + End Get + Set(ByVal value As Boolean) + Me._DataChanged = value + End Set + End Property + + Private _ResetData As Boolean = False + Public Property ResetData() As Boolean + Get + Return Me._ResetData + End Get + Set(ByVal value As Boolean) + Me._ResetData = value + End Set + End Property + + Private _AddNewRecord As Integer = 0 + Public Property AddNewRecord() As Integer + Get + Return Me._AddNewRecord + End Get + Set(ByVal value As Integer) + Me._AddNewRecord = value + End Set + End Property + + + Private _CurrentSortOrder As OrderBy = Nothing + Public Property CurrentSortOrder() As OrderBy + Get + Return Me._CurrentSortOrder + End Get + Set(ByVal value As BaseClasses.Data.OrderBy) + Me._CurrentSortOrder = value + End Set + End Property + + Private _DataSource() As PersonalSpecialSkillRecord = Nothing + Public Property DataSource() As PersonalSpecialSkillRecord () + Get + Return Me._DataSource + End Get + Set(ByVal value() As PersonalSpecialSkillRecord) + Me._DataSource = value + End Set + End Property + +#Region "Helper Properties" + + Public ReadOnly Property LevelLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "LevelLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property PersonalSpecialSkillAddButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalSpecialSkillAddButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalSpecialSkillDeleteButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalSpecialSkillDeleteButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalSpecialSkillEditButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalSpecialSkillEditButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalSpecialSkillPagination() As Persons.UI.IPagination + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalSpecialSkillPagination"), Persons.UI.IPagination) + End Get + End Property + + Public ReadOnly Property PersonalSpecialSkillRefreshButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalSpecialSkillRefreshButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalSpecialSkillResetButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalSpecialSkillResetButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalSpecialSkillSaveButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalSpecialSkillSaveButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalSpecialSkillTableControlCollapsibleRegion() As System.Web.UI.WebControls.Panel + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalSpecialSkillTableControlCollapsibleRegion"), System.Web.UI.WebControls.Panel) + End Get + End Property + + Public ReadOnly Property PersonalSpecialSkillTableControlIcon() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalSpecialSkillTableControlIcon"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalSpecialSkillTableControlPanelExtender() As AjaxControlToolkit.CollapsiblePanelExtender + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalSpecialSkillTableControlPanelExtender"), AjaxControlToolkit.CollapsiblePanelExtender) + End Get + End Property + + Public ReadOnly Property PersonalSpecialSkillTitle() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalSpecialSkillTitle"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property PersonalSpecialSkillToggleAll() As System.Web.UI.WebControls.CheckBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalSpecialSkillToggleAll"), System.Web.UI.WebControls.CheckBox) + End Get + End Property + + Public ReadOnly Property SkillLabel1() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "SkillLabel1"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + +#End Region + +#Region "Helper Functions" + + Public Overrides Overloads Function ModifyRedirectUrl(url As String, arg As String, ByVal bEncrypt As Boolean) As String + Return Me.Page.EvaluateExpressions(url, arg, bEncrypt, Me) + End Function + + Public Overrides Overloads Function EvaluateExpressions(url As String, arg As String, ByVal bEncrypt As Boolean) As String + Dim needToProcess As Boolean = AreAnyUrlParametersForMe(url, arg) + If (needToProcess) Then + Dim recCtl As PersonalSpecialSkillTableControlRow = Me.GetSelectedRecordControl() + If recCtl Is Nothing AndAlso url.IndexOf("{") >= 0 Then + ' Localization. + Throw New Exception(Page.GetResourceValue("Err:NoRecSelected", "Persons")) + End If + Dim rec As PersonalSpecialSkillRecord = Nothing + If recCtl IsNot Nothing Then + rec = recCtl.GetRecord() + End If + Return EvaluateExpressions(url, arg, rec, bEncrypt) + End If + Return url + End Function + + Public Overridable Function GetSelectedRecordIndex() As Integer + Dim counter As Integer = 0 + Dim recControl As PersonalSpecialSkillTableControlRow + For Each recControl In Me.GetRecordControls() + If recControl.PersonalSpecialSkillRecordRowSelection.Checked Then + Return counter + End If + counter += 1 + Next + Return -1 + End Function + + Public Overridable Function GetSelectedRecordControl() As PersonalSpecialSkillTableControlRow + Dim selectedList() As PersonalSpecialSkillTableControlRow = Me.GetSelectedRecordControls() + If selectedList.Length = 0 Then + Return Nothing + End If + Return selectedList(0) + + End Function + + Public Overridable Function GetSelectedRecordControls() As PersonalSpecialSkillTableControlRow() + + Dim selectedList As ArrayList = New ArrayList(25) + Dim recControl As PersonalSpecialSkillTableControlRow + For Each recControl In Me.GetRecordControls() + If recControl.PersonalSpecialSkillRecordRowSelection IsNot Nothing AndAlso recControl.PersonalSpecialSkillRecordRowSelection.Checked Then + selectedList.Add(recControl) + End If + Next + Return DirectCast(selectedList.ToArray(GetType(PersonalSpecialSkillTableControlRow)), PersonalSpecialSkillTableControlRow()) + + End Function + + Public Overridable Sub DeleteSelectedRecords(ByVal deferDeletion As Boolean) + Dim recList() As PersonalSpecialSkillTableControlRow = Me.GetSelectedRecordControls() + If recList.Length = 0 Then + ' Localization. + Throw New Exception(Page.GetResourceValue("Err:NoRecSelected", "Persons")) + End If + + Dim recCtl As PersonalSpecialSkillTableControlRow + For Each recCtl In recList + If deferDeletion Then + If Not recCtl.IsNewRecord Then + + Me.AddToDeletedRecordIds(recCtl) + + End If + recCtl.Visible = False + + recCtl.PersonalSpecialSkillRecordRowSelection.Checked = False + + Else + + recCtl.Delete() + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + End If + Next + End Sub + + Public Function GetRecordControls() As PersonalSpecialSkillTableControlRow() + Dim recList As ArrayList = New ArrayList() + Dim rep As System.Web.UI.WebControls.Repeater = CType(Me.FindControl("PersonalSpecialSkillTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return Nothing + Dim repItem As System.Web.UI.WebControls.RepeaterItem + + For Each repItem In rep.Items + + Dim recControl As PersonalSpecialSkillTableControlRow = DirectCast(repItem.FindControl("PersonalSpecialSkillTableControlRow"), PersonalSpecialSkillTableControlRow) + recList.Add(recControl) + + Next + + Return DirectCast(recList.ToArray(GetType(PersonalSpecialSkillTableControlRow)), PersonalSpecialSkillTableControlRow()) + 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 + + \ No newline at end of file diff --git a/App_Code/PersonalSportSkill/EditPersonalSportSkillTable.Controls.vb b/App_Code/PersonalSportSkill/EditPersonalSportSkillTable.Controls.vb new file mode 100644 index 0000000..da0f45a --- /dev/null +++ b/App_Code/PersonalSportSkill/EditPersonalSportSkillTable.Controls.vb @@ -0,0 +1,2845 @@ + +' This file implements the TableControl, TableControlRow, and RecordControl classes for the +' EditPersonalSportSkillTable.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.EditPersonalSportSkillTable + +#Region "Section 1: Place your customizations here." + + +Public Class PersonalSportSkillTableControlRow + Inherits BasePersonalSportSkillTableControlRow + ' The BasePersonalSportSkillTableControlRow implements code for a ROW within the + ' the PersonalSportSkillTableControl table. The BasePersonalSportSkillTableControlRow implements the DataBind and SaveData methods. + ' The loading of data is actually performed by the LoadData method in the base class of PersonalSportSkillTableControl. + + ' This is the ideal place to add your code customizations. For example, you can override the DataBind, + ' SaveData, GetUIData, and Validate methods. + Public Overrides Sub GetUIData() + + ' Call MyBase.GetUIData + MyBase.GetUIData() + + ' Get PersonalDD Record + Dim myRec As PersonalSportSkillRecord = Me.GetRecord + + ' Set PersonalId field value to new value string + myRec.PersonalId = Utils.SecurityControls.GetCurrentUserID + + End Sub + + +End Class + + + +Public Class PersonalSportSkillTableControl + Inherits BasePersonalSportSkillTableControl + + ' The BasePersonalSportSkillTableControl class implements the LoadData, DataBind, CreateWhereClause + ' and other methods to load and display the data in a table control. + + ' This is the ideal place to add your code customizations. You can override the LoadData and CreateWhereClause, + ' The PersonalSportSkillTableControlRow class offers another place where you can customize + ' the DataBind, GetUIData, SaveData and Validate methods specific to each row displayed on the table. + +End Class + + + +#End Region + + + +#Region "Section 2: Do not modify this section." + + +' Base class for the PersonalSportSkillTableControlRow control on the EditPersonalSportSkillTable page. +' Do not modify this class. Instead override any method in PersonalSportSkillTableControlRow. +Public Class BasePersonalSportSkillTableControlRow + Inherits Persons.UI.BaseApplicationRecordControl + + ' To customize, override this method in PersonalSportSkillTableControlRow. + Protected Overridable Sub Control_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Init + + Me.ClearControlsFromSession() + End Sub + + ' To customize, override this method in PersonalSportSkillTableControlRow. + Protected Overridable Sub Control_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load + + 'Call LoadFocusScripts from repeater so that onfocus attribute could be added to elements + Me.Page.LoadFocusScripts(Me) + + ' Show confirmation message on Click + Me.PersonalSportSkillRowDeleteButton.Attributes.Add("onClick", "return (confirm('" & (CType(Me.Page,BaseApplicationPage)).GetResourceValue("DeleteRecordConfirm", "Persons") & "'));") + + + ' Register the event handlers. + + AddHandler Me.PersonalSportSkillRowDeleteButton.Click, AddressOf PersonalSportSkillRowDeleteButton_Click + + Me.SportIdAddRecordLink.PostBackUrl = "../Sport/AddSport.aspx" & "?Target=" & Me.SportId.ClientID & "&DFKA=" & HttpUtility.UrlEncode("SPORT") + Me.SportIdAddRecordLink.Attributes.Item("onClick") = "window.open('" & Me.SportIdAddRecordLink.PostBackUrl & "','_blank', 'width=900, height=700, resizable, scrollbars, modal=yes'); return false;" + + AddHandler Me.PersonalId.SelectedIndexChanged, AddressOf PersonalId_SelectedIndexChanged + + AddHandler Me.SportId.SelectedIndexChanged, AddressOf SportId_SelectedIndexChanged + + AddHandler Me.Level.TextChanged, AddressOf Level_TextChanged + + + End Sub + + + Public Overridable Sub LoadData() + + ' Load the data from the database into the DataSource PersonalSportSkill 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 = PersonalSportSkillTable.GetRecord(Me.RecordUniqueId, True) + + Return + End If + + ' Since this is a row in the table, the data for this row is loaded by the + ' LoadData method of the BasePersonalSportSkillTableControl when the data for the entire + ' table is loaded. + + Me.DataSource = New PersonalSportSkillRecord() + + + + End Sub + + ' Populate the UI controls using the DataSource. To customize, override this method in PersonalSportSkillTableControlRow. + 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 + + SetLevel() + SetPersonalId() + + + SetSportId() + + + + 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 SetLevel() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.Level.ID) Then + + Me.Level.Text = Me.PreviousUIData(Me.Level.ID).ToString() + + Return + End If + + + ' Set the Level TextBox on the webpage with value from the + ' PersonalSportSkill database record. + + ' Me.DataSource is the PersonalSportSkill record retrieved from the database. + ' Me.Level is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetLevel() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.LevelSpecified Then + + ' If the Level is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalSportSkillTable.Level) + + Me.Level.Text = formattedValue + + Else + + ' Level is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.Level.Text = PersonalSportSkillTable.Level.Format(PersonalSportSkillTable.Level.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetPersonalId() + + ' If selection was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.PersonalId.ID) Then + If Me.PreviousUIData(Me.PersonalId.ID) Is Nothing + Me.PopulatePersonalIdDropDownList(Nothing, 100) + Else + Me.PopulatePersonalIdDropDownList(Me.PreviousUIData(Me.PersonalId.ID).ToString(), 100) + End If + Return + End If + + + ' Set the PersonalId DropDownList on the webpage with value from the + ' PersonalSportSkill database record. + + ' Me.DataSource is the PersonalSportSkill record retrieved from the database. + ' Me.PersonalId is the ASP:DropDownList on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetPersonalId() + ' and add your own code before or after the call to the MyBase function. + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.PersonalIdSpecified Then + + ' If the PersonalId is non-NULL, then format the value. + ' The Format method will return the Display Foreign Key As (DFKA) value + Me.PopulatePersonalIdDropDownList(Me.DataSource.PersonalId, 100) + + Else + + ' PersonalId 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.PopulatePersonalIdDropDownList(Nothing, 100) + Else + Me.PopulatePersonalIdDropDownList(PersonalSportSkillTable.PersonalId.DefaultValue, 100) + End If + + End If + + End Sub + + Public Overridable Sub SetSportId() + + ' If selection was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.SportId.ID) Then + If Me.PreviousUIData(Me.SportId.ID) Is Nothing + Me.PopulateSportIdDropDownList(Nothing, 100) + Else + Me.PopulateSportIdDropDownList(Me.PreviousUIData(Me.SportId.ID).ToString(), 100) + End If + Return + End If + + + ' Set the SportId DropDownList on the webpage with value from the + ' PersonalSportSkill database record. + + ' Me.DataSource is the PersonalSportSkill record retrieved from the database. + ' Me.SportId is the ASP:DropDownList on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetSportId() + ' and add your own code before or after the call to the MyBase function. + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.SportIdSpecified Then + + ' If the SportId is non-NULL, then format the value. + ' The Format method will return the Display Foreign Key As (DFKA) value + Me.PopulateSportIdDropDownList(Me.DataSource.SportId.ToString(), 100) + + Else + + ' SportId 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.PopulateSportIdDropDownList(Nothing, 100) + Else + Me.PopulateSportIdDropDownList(PersonalSportSkillTable.SportId.DefaultValue, 100) + End If + + End If + + End Sub + + + Public EvaluateFormulaDelegate As BaseClasses.Data.DataSource.EvaluateFormulaDelegate = New BaseClasses.Data.DataSource.EvaluateFormulaDelegate(AddressOf Me.EvaluateFormula) + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean, ByVal e As FormulaEvaluator) As String + If e Is Nothing Then + e = New FormulaEvaluator() + End If + + e.Variables.Clear() + + + ' add variables for formula evaluation + If variables IsNot Nothing Then + Dim enumerator As System.Collections.Generic.IEnumerator(Of System.Collections.Generic.KeyValuePair(Of String, Object)) = variables.GetEnumerator() + While enumerator.MoveNext() + e.Variables.Add(enumerator.Current.Key, enumerator.Current.Value) + End While + End If + + If includeDS + + End IF + + + ' Other variables referred to in the formula are expected to be + ' properties of the DataSource. For example, referring to + ' UnitPrice as a variable will refer to DataSource.UnitPrice + If dataSourceForEvaluate Is Nothing Then + + e.DataSource = Me.DataSource + + Else + e.DataSource = dataSourceForEvaluate + End If + + ' Define the calling control. This is used to add other + ' related table and record controls as variables. + e.CallingControl = Me + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + + If Not String.IsNullOrEmpty(format) AndAlso (String.IsNullOrEmpty(formula) OrElse formula.IndexOf("Format(") < 0) Then + Return FormulaUtils.Format(resultObj, format) + Else + Return resultObj.ToString() + End If + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format,variables ,includeDS, Nothing) + End Function + + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object)) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format, variables ,True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, format, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal e as FormulaEvaluator) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, variables, True, e) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal includeDS as Boolean) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, includeDS, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, True, Nothing) + End Function + + + Public Overridable Sub RegisterPostback() + + + End Sub + + + + ' To customize, override this method in PersonalSportSkillTableControlRow. + Public Overridable Sub SaveData() + ' Saves the associated record in the database. + ' SaveData calls Validate and Get methods - so it may be more appropriate to + ' customize those methods. + + ' 1. Load the existing record from the database. Since we save the entire record, this ensures + ' that fields that are not displayed are also properly initialized. + Me.LoadData() + + + ' 2. Perform any custom validation. + Me.Validate() + + + ' 3. Set the values in the record with data from UI controls. + ' This calls the Get() method for each of the user interface controls. + Me.GetUIData() + + ' 4. Save in the database. + ' We should not save the record if the data did not change. This + ' will save a database hit and avoid triggering any database triggers. + + If Me.DataSource.IsAnyValueChanged Then + ' Save record to database but do not commit yet. + ' Auto generated ids are available after saving for use by child (dependent) records. + Me.DataSource.Save() + + DirectCast(GetParentControlObject(Me, "PersonalSportSkillTableControl"), PersonalSportSkillTableControl).DataChanged = True + DirectCast(GetParentControlObject(Me, "PersonalSportSkillTableControl"), PersonalSportSkillTableControl).ResetData = True + End If + + + ' update session or cookie by formula + + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + ' For Master-Detail relationships, save data on the Detail table(s) + + End Sub + + ' To customize, override this method in PersonalSportSkillTableControlRow. + 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. + + GetLevel() + GetPersonalId() + GetSportId() + End Sub + + + Public Overridable Sub GetLevel() + + ' Retrieve the value entered by the user on the Level ASP:TextBox, and + ' save it into the Level field in DataSource PersonalSportSkill record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.Level.Text, PersonalSportSkillTable.Level) + + + End Sub + + Public Overridable Sub GetPersonalId() + + ' Retrieve the value entered by the user on the PersonalId ASP:DropDownList, and + ' save it into the PersonalId field in DataSource PersonalSportSkill record. + + ' Custom validation should be performed in Validate, not here. + + Me.DataSource.Parse(GetValueSelectedPageRequest(Me.PersonalId), PersonalSportSkillTable.PersonalId) + + End Sub + + Public Overridable Sub GetSportId() + + ' Retrieve the value entered by the user on the SportId ASP:DropDownList, and + ' save it into the SportId field in DataSource PersonalSportSkill record. + + ' Custom validation should be performed in Validate, not here. + + Me.DataSource.Parse(GetValueSelectedPageRequest(Me.SportId), PersonalSportSkillTable.SportId) + + End Sub + + + ' To customize, override this method in PersonalSportSkillTableControlRow. + + Public Overridable Function CreateWhereClause() As WhereClause + + Return Nothing + + End Function + + + + ' To customize, override this method in PersonalSportSkillTableControlRow. + 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) + PersonalSportSkillTable.DeleteRecord(pkValue) + + DirectCast(GetParentControlObject(Me, "PersonalSportSkillTableControl"), PersonalSportSkillTableControl).DataChanged = True + DirectCast(GetParentControlObject(Me, "PersonalSportSkillTableControl"), PersonalSportSkillTableControl).ResetData = True + End Sub + + Protected Overridable Sub Control_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.PreRender + ' PreRender event is raised just before page is being displayed. + Try + DbUtils.StartTransaction() + Me.RegisterPostback() + + If Not Me.Page.ErrorOnPage AndAlso (Me.Page.IsPageRefresh OrElse Me.DataChanged OrElse Me.ResetData) Then + + + ' Re-load the data and update the web page if necessary. + ' This is typically done during a postback (filter, search button, sort, pagination button). + ' In each of the other click handlers, simply set DataChanged to True to reload the data. + Me.LoadData() + Me.DataBind() + End If + + + Catch ex As Exception + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + Finally + DbUtils.EndTransaction() + End Try + End Sub + + + Protected Overrides Sub SaveControlsToSession() + MyBase.SaveControlsToSession() + + + 'Save pagination state to session. + + End Sub + + + + Protected Overrides Sub ClearControlsFromSession() + MyBase.ClearControlsFromSession() + + + + ' Clear pagination state from session. + + End Sub + + Protected Overrides Sub LoadViewState(ByVal savedState As Object) + MyBase.LoadViewState(savedState) + Dim isNewRecord As String = CType(ViewState("IsNewRecord"), String) + If Not isNewRecord Is Nothing AndAlso isNewRecord.Trim <> "" Then + Me.IsNewRecord = Boolean.Parse(isNewRecord) + End If + + Dim myCheckSum As String = CType(ViewState("CheckSum"), String) + If Not myCheckSum Is Nothing AndAlso myCheckSum.Trim <> "" Then + Me.CheckSum = myCheckSum + End If + + + ' Load view state for pagination control. + + End Sub + + Protected Overrides Function SaveViewState() As Object + ViewState("IsNewRecord") = Me.IsNewRecord.ToString() + ViewState("CheckSum") = Me.CheckSum + + + ' Load view state for pagination control. + + Return MyBase.SaveViewState() + End Function + + + + Public Overridable Function CreateWhereClause_PersonalIdDropDownList() 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 PersonalId table. + ' Examples: + ' wc.iAND(PersonalIdTable.PersonalName, BaseFilter.ComparisonOperator.EqualsTo, "XYZ") + ' wc.iAND(PersonalIdTable.Active, BaseFilter.ComparisonOperator.EqualsTo, "1") + + Dim wc As WhereClause = New WhereClause() + Return wc + + End Function + + + + Public Overridable Function CreateWhereClause_SportIdDropDownList() 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 Sport table. + ' Examples: + ' wc.iAND(SportTable.SPORT, BaseFilter.ComparisonOperator.EqualsTo, "XYZ") + ' wc.iAND(SportTable.Active, BaseFilter.ComparisonOperator.EqualsTo, "1") + + Dim wc As WhereClause = New WhereClause() + Return wc + + End Function + + + ' Fill the PersonalId list. + Protected Overridable Sub PopulatePersonalIdDropDownList( _ + ByVal selectedValue As String, _ + ByVal maxItems As Integer) + + Me.PersonalId.Items.Clear() + + + ' 1. Setup the static list items + + ' Add the Please Select item. + Me.PersonalId.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_PersonalIdDropDownList function. + ' It is better to customize the where clause there. + + Dim wc As WhereClause = CreateWhereClause_PersonalIdDropDownList() + ' Create the ORDER BY clause to sort based on the displayed value. + + + Dim orderBy As OrderBy = New OrderBy(false, false) + orderBy.Add(PersonalIdTable.PersonalName, OrderByItem.OrderDir.Asc) + + Dim variables As System.Collections.Generic.IDictionary(Of String, Object) = New System.Collections.Generic.Dictionary(Of String, Object) + + ' 3. Read a total of maxItems from the database and insert them + Dim itemValues() As PersonalIdRecord = 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 = PersonalIdTable.GetRecords(wc, orderBy, pageNum, maxItems) + For each itemValue As PersonalIdRecord In itemValues + ' Create the item and add to the list. + Dim cvalue As String = Nothing + Dim fvalue As String = Nothing + If itemValue.PersonalIdSpecified Then + cvalue = itemValue.PersonalId.ToString() + + If counter < maxItems AndAlso Me.PersonalId.Items.FindByValue(cvalue) Is Nothing Then + + Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalSportSkillTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalSportSkillTable.PersonalId) + If _isExpandableNonCompositeForeignKey AndAlso PersonalSportSkillTable.PersonalId.IsApplyDisplayAs Then + fvalue = PersonalSportSkillTable.GetDFKA(itemValue, PersonalSportSkillTable.PersonalId) + End If + If (Not _isExpandableNonCompositeForeignKey) Or (String.IsNullOrEmpty(fvalue)) Then + fvalue = itemValue.Format(PersonalIdTable.PersonalName) + End If + + If fvalue Is Nothing OrElse fvalue.Trim() = "" Then fvalue = cvalue + + If (IsNothing(fvalue)) Then + fvalue = "" + End If + + fvalue = fvalue.Trim() + + If ( fvalue.Length > 50 ) Then + fvalue = fvalue.Substring(0, 50) & "..." + End If + + Dim dupItem As ListItem = Me.PersonalId.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.PersonalId.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.PersonalId, selectedValue) AndAlso _ + Not SetSelectedDisplayText(Me.PersonalId, selectedValue)Then + + ' construct a whereclause to query a record with PersonalId.PersonalId = selectedValue + Dim filter2 As CompoundFilter = New CompoundFilter(CompoundFilter.CompoundingOperators.And_Operator, Nothing) + Dim whereClause2 As WhereClause = New WhereClause() + filter2.AddFilter(New BaseClasses.Data.ColumnValueFilter(PersonalIdTable.PersonalId, selectedValue, BaseClasses.Data.BaseFilter.ComparisonOperator.EqualsTo, False)) + whereClause2.AddFilter(filter2, CompoundFilter.CompoundingOperators.And_Operator) + + Try + ' Execute the query + Dim rc() As PersonalIdRecord = PersonalIdTable.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 PersonalIdRecord = DirectCast(rc(0), PersonalIdRecord) + ' Create the item and add to the list. + Dim cvalue As String = Nothing + Dim fvalue As String = Nothing + If itemValue.PersonalIdSpecified Then + cvalue = itemValue.PersonalId.ToString() + Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalSportSkillTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalSportSkillTable.PersonalId) + If _isExpandableNonCompositeForeignKey AndAlso PersonalSportSkillTable.PersonalId.IsApplyDisplayAs Then + fvalue = PersonalSportSkillTable.GetDFKA(itemValue, PersonalSportSkillTable.PersonalId) + End If + If (Not _isExpandableNonCompositeForeignKey) Or (String.IsNullOrEmpty(fvalue)) Then + fvalue = itemValue.Format(PersonalIdTable.PersonalName) + End If + + If fvalue Is Nothing OrElse fvalue.Trim() = "" Then fvalue = cvalue + Dim newItem As New ListItem(fvalue, cvalue) + Me.PersonalId.Items.Add(newItem) + SetSelectedValue(Me.PersonalId, selectedValue) + End If + End If + Catch + End Try + + End If + + + End Sub + + ' Fill the SportId list. + Protected Overridable Sub PopulateSportIdDropDownList( _ + ByVal selectedValue As String, _ + ByVal maxItems As Integer) + + Me.SportId.Items.Clear() + + + ' 1. Setup the static list items + + ' Add the Please Select item. + Me.SportId.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_SportIdDropDownList function. + ' It is better to customize the where clause there. + + Dim wc As WhereClause = CreateWhereClause_SportIdDropDownList() + ' Create the ORDER BY clause to sort based on the displayed value. + + + Dim orderBy As OrderBy = New OrderBy(false, false) + orderBy.Add(SportTable.SPORT, 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 SportRecord = 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 = SportTable.GetRecords(wc, orderBy, pageNum, maxItems) + For each itemValue As SportRecord In itemValues + ' Create the item and add to the list. + Dim cvalue As String = Nothing + Dim fvalue As String = Nothing + If itemValue.SportIdSpecified Then + cvalue = itemValue.SportId.ToString() + + If counter < maxItems AndAlso Me.SportId.Items.FindByValue(cvalue) Is Nothing Then + + Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalSportSkillTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalSportSkillTable.SportId) + If _isExpandableNonCompositeForeignKey AndAlso PersonalSportSkillTable.SportId.IsApplyDisplayAs Then + fvalue = PersonalSportSkillTable.GetDFKA(itemValue, PersonalSportSkillTable.SportId) + End If + If (Not _isExpandableNonCompositeForeignKey) Or (String.IsNullOrEmpty(fvalue)) Then + fvalue = itemValue.Format(SportTable.SPORT) + 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.SportId.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.SportId.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.SportId, selectedValue) AndAlso _ + Not SetSelectedDisplayText(Me.SportId, selectedValue)Then + + ' construct a whereclause to query a record with Sport.SportId = selectedValue + Dim filter2 As CompoundFilter = New CompoundFilter(CompoundFilter.CompoundingOperators.And_Operator, Nothing) + Dim whereClause2 As WhereClause = New WhereClause() + filter2.AddFilter(New BaseClasses.Data.ColumnValueFilter(SportTable.SportId, selectedValue, BaseClasses.Data.BaseFilter.ComparisonOperator.EqualsTo, False)) + whereClause2.AddFilter(filter2, CompoundFilter.CompoundingOperators.And_Operator) + + Try + ' Execute the query + Dim rc() As SportRecord = SportTable.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 SportRecord = DirectCast(rc(0), SportRecord) + ' Create the item and add to the list. + Dim cvalue As String = Nothing + Dim fvalue As String = Nothing + If itemValue.SportIdSpecified Then + cvalue = itemValue.SportId.ToString() + Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalSportSkillTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalSportSkillTable.SportId) + If _isExpandableNonCompositeForeignKey AndAlso PersonalSportSkillTable.SportId.IsApplyDisplayAs Then + fvalue = PersonalSportSkillTable.GetDFKA(itemValue, PersonalSportSkillTable.SportId) + End If + If (Not _isExpandableNonCompositeForeignKey) Or (String.IsNullOrEmpty(fvalue)) Then + fvalue = itemValue.Format(SportTable.SPORT) + End If + + If fvalue Is Nothing OrElse fvalue.Trim() = "" Then fvalue = cvalue + Dim newItem As New ListItem(fvalue, cvalue) + Me.SportId.Items.Add(newItem) + SetSelectedValue(Me.SportId, selectedValue) + End If + End If + Catch + End Try + + End If + + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalSportSkillRowDeleteButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + If(Not Me.Page.IsPageRefresh) Then + + Dim tc As PersonalSportSkillTableControl = DirectCast(GetParentControlObject(Me, "PersonalSportSkillTableControl"), PersonalSportSkillTableControl) + If Not (IsNothing(tc)) Then + If Not Me.IsNewRecord Then + tc.AddToDeletedRecordIds(DirectCast(Me, PersonalSportSkillTableControlRow)) + End If + Me.Visible = False + tc.SetFormulaControls() + End If + + End If + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + Protected Overridable Sub PersonalId_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()(PersonalId.ClientID & "_SelectedValue"), String) + Dim displayText As String = CType(Me.Page.Session()(PersonalId.ClientID & "_SelectedDisplayText"), String) + If displayText <> "" AndAlso val <> "" Then + Me.PersonalId.Items.Add(New ListItem(displayText, val)) + Me.PersonalId.SelectedIndex = Me.PersonalId.Items.Count - 1 + Me.Page.Session.Remove(PersonalId.ClientID & "_SelectedValue") + Me.Page.Session.Remove(PersonalId.ClientID & "_SelectedDisplayText") + End If + + + + + End Sub + + Protected Overridable Sub SportId_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()(SportId.ClientID & "_SelectedValue"), String) + Dim displayText As String = CType(Me.Page.Session()(SportId.ClientID & "_SelectedDisplayText"), String) + If displayText <> "" AndAlso val <> "" Then + Me.SportId.Items.Add(New ListItem(displayText, val)) + Me.SportId.SelectedIndex = Me.SportId.Items.Count - 1 + Me.Page.Session.Remove(SportId.ClientID & "_SelectedValue") + Me.Page.Session.Remove(SportId.ClientID & "_SelectedDisplayText") + End If + + + + + End Sub + + Protected Overridable Sub Level_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("BasePersonalSportSkillTableControlRow_Rec"), String) + End Get + Set(ByVal value As String) + Me.ViewState("BasePersonalSportSkillTableControlRow_Rec") = value + End Set + End Property + + Private _DataSource As PersonalSportSkillRecord + Public Property DataSource() As PersonalSportSkillRecord + Get + Return Me._DataSource + End Get + + Set(ByVal value As PersonalSportSkillRecord) + + Me._DataSource = value + End Set + End Property + + + + Private _checkSum As String + Public Overridable Property CheckSum() As String + Get + Return Me._checkSum + End Get + Set(ByVal value As String) + Me._checkSum = value + End Set + End Property + + Private _TotalPages As Integer + Public Property TotalPages() As Integer + Get + Return Me._TotalPages + End Get + Set(ByVal value As Integer) + Me._TotalPages = value + End Set + End Property + + Private _PageIndex As Integer + Public Property PageIndex() As Integer + Get + ' Return the PageIndex + Return Me._PageIndex + End Get + Set(ByVal value As Integer) + Me._PageIndex = value + End Set + End Property + + Private _DisplayLastPage As Boolean + Public Property DisplayLastPage() As Boolean + Get + Return Me._DisplayLastPage + End Get + Set(ByVal value As Boolean) + Me._DisplayLastPage = value + End Set + End Property + + + +#Region "Helper Properties" + + Public ReadOnly Property Level() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Level"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property PersonalId() As System.Web.UI.WebControls.DropDownList + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalId"), System.Web.UI.WebControls.DropDownList) + End Get + End Property + + Public ReadOnly Property PersonalSportSkillRecordRowSelection() As System.Web.UI.WebControls.CheckBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalSportSkillRecordRowSelection"), System.Web.UI.WebControls.CheckBox) + End Get + End Property + + Public ReadOnly Property PersonalSportSkillRowDeleteButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalSportSkillRowDeleteButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property SportId() As System.Web.UI.WebControls.DropDownList + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "SportId"), System.Web.UI.WebControls.DropDownList) + End Get + End Property + + Public ReadOnly Property SportIdAddRecordLink() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "SportIdAddRecordLink"), System.Web.UI.WebControls.ImageButton) + 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 PersonalSportSkillRecord = 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 PersonalSportSkillRecord + If Not Me.DataSource Is Nothing Then + Return Me.DataSource + End If + + If Not Me.RecordUniqueId Is Nothing Then + + Return PersonalSportSkillTable.GetRecord(Me.RecordUniqueId, True) + + End If + + ' Localization. + + Throw New Exception(Page.GetResourceValue("Err:RetrieveRec", "Persons")) + + End Function + + Public Shadows ReadOnly Property Page() As BaseApplicationPage + Get + Return DirectCast(MyBase.Page, BaseApplicationPage) + End Get + End Property + +#End Region + +End Class + + + +' Base class for the PersonalSportSkillTableControl control on the EditPersonalSportSkillTable page. +' Do not modify this class. Instead override any method in PersonalSportSkillTableControl. +Public Class BasePersonalSportSkillTableControl + Inherits Persons.UI.BaseApplicationTableControl + + + + Protected Overridable Sub Control_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Init + + + + ' Setup the filter and search events. + + + + ' Control Initializations. + ' Initialize the table's current sort order. + + If Me.InSession(Me, "Order_By") Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + End If + + + + ' Setup default pagination settings. + + Me.PageSize = CInt(Me.GetFromSession(Me, "Page_Size", "10")) + Me.PageIndex = CInt(Me.GetFromSession(Me, "Page_Index", "0")) + + + + Me.ClearControlsFromSession() + End Sub + + Protected Overridable Sub Control_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load + + SaveControlsToSession_Ajax() + + ' Show confirmation message on Click + Me.PersonalSportSkillDeleteButton.Attributes.Add("onClick", "return (confirm('" & (CType(Me.Page,BaseApplicationPage)).GetResourceValue("DeleteConfirm", "Persons") & "'));") + + ' Setup the pagination events. + + AddHandler Me.PersonalSportSkillPagination.FirstPage.Click, AddressOf PersonalSportSkillPagination_FirstPage_Click + + AddHandler Me.PersonalSportSkillPagination.LastPage.Click, AddressOf PersonalSportSkillPagination_LastPage_Click + + AddHandler Me.PersonalSportSkillPagination.NextPage.Click, AddressOf PersonalSportSkillPagination_NextPage_Click + + AddHandler Me.PersonalSportSkillPagination.PageSizeButton.Click, AddressOf PersonalSportSkillPagination_PageSizeButton_Click + + AddHandler Me.PersonalSportSkillPagination.PreviousPage.Click, AddressOf PersonalSportSkillPagination_PreviousPage_Click + + + ' Setup the sorting events. + + AddHandler Me.LevelLabel.Click, AddressOf LevelLabel_Click + + AddHandler Me.SportIdLabel1.Click, AddressOf SportIdLabel1_Click + + ' Setup the button events. + + AddHandler Me.PersonalSportSkillAddButton.Click, AddressOf PersonalSportSkillAddButton_Click + + AddHandler Me.PersonalSportSkillDeleteButton.Click, AddressOf PersonalSportSkillDeleteButton_Click + + AddHandler Me.PersonalSportSkillEditButton.Click, AddressOf PersonalSportSkillEditButton_Click + + AddHandler Me.PersonalSportSkillRefreshButton.Click, AddressOf PersonalSportSkillRefreshButton_Click + + AddHandler Me.PersonalSportSkillResetButton.Click, AddressOf PersonalSportSkillResetButton_Click + + AddHandler Me.PersonalSportSkillSaveButton.Click, AddressOf PersonalSportSkillSaveButton_Click + + Me.PersonalSportSkillSaveButton.Attributes.Add("onclick", "SubmitHRefOnce(this, """ & Me.Page.GetResourceValue("Txt:SaveRecord", "Persons") & """);") + + + ' Setup events for others + + End Sub + + + Public Overridable Sub LoadData() + + ' Read data from database. Returns an array of records that can be assigned + ' to the DataSource table control property. + Try + Dim joinFilter As CompoundFilter = CreateCompoundJoinFilter() + + ' The WHERE clause will be empty when displaying all records in table. + Dim wc As WhereClause = CreateWhereClause() + If wc IsNot Nothing AndAlso Not wc.RunQuery Then + ' Initialize an empty array of records + Dim alist As New ArrayList(0) + Me.DataSource = DirectCast(alist.ToArray(GetType(PersonalSportSkillRecord)), PersonalSportSkillRecord()) + ' Add records to the list if needed. + Me.AddNewRecords() + Me._TotalRecords = 0 + Me._TotalPages = 0 + Return + End If + + ' Call OrderBy to determine the order - either use the order defined + ' on the Query Wizard, or specified by user (by clicking on column heading) + Dim orderBy As OrderBy = CreateOrderBy() + + ' Get the pagesize from the pagesize control. + Me.GetPageSize() + + If Me.DisplayLastPage Then + Dim totalRecords As Integer = If(Me._TotalRecords < 0, PersonalSportSkillTable.GetRecordCount(CreateCompoundJoinFilter(), CreateWhereClause()), Me._TotalRecords) + + Dim totalPages As Integer = CInt(Math.Ceiling(totalRecords / Me.PageSize)) + + Me.PageIndex = totalPages - 1 + End If + + ' Make sure PageIndex (current page) and PageSize are within bounds. + If Me.PageIndex < 0 Then + Me.PageIndex = 0 + End If + If Me.PageSize < 1 Then + Me.PageSize = 1 + End If + + ' Retrieve the records and set the table DataSource. + ' Only PageSize records are fetched starting at PageIndex (zero based). + If Me.AddNewRecord > 0 Then + ' Make sure to preserve the previously entered data on new rows. + Dim postdata As New ArrayList + For Each rc As PersonalSportSkillTableControlRow In Me.GetRecordControls() + If Not rc.IsNewRecord Then + rc.DataSource = rc.GetRecord() + rc.GetUIData() + postdata.Add(rc.DataSource) + UIData.Add(rc.PreservedUIData()) + End If + Next + Me.DataSource = DirectCast(postdata.ToArray(GetType(PersonalSportSkillRecord)), PersonalSportSkillRecord()) + Else ' Get the records from the database + Me.DataSource = PersonalSportSkillTable.GetRecords(joinFilter, wc, orderBy, Me.PageIndex, Me.PageSize) + + End If + + ' if the datasource contains no records contained in database, then load the last page. + If (DbUtils.GetCreatedRecords(Me.DataSource).Length = 0 AndAlso Not Me.DisplayLastPage) Then + Me.DisplayLastPage = True + LoadData() + Else + + ' Add any new rows desired by the user. + Me.AddNewRecords() + + ' Turn off the ToggleAll checkbox + Me.PersonalSportSkillToggleAll.Checked = False + + + ' Initialize the page and grand totals. now + + End If + + Catch ex As Exception + ' Report the error message to the end user + Dim msg As String = ex.Message + If ex.InnerException IsNot Nothing Then + msg = msg & " InnerException: " & ex.InnerException.Message + End If + Throw New Exception(msg, ex.InnerException) + End Try + End Sub + + + + + Public Overrides Sub DataBind() + ' The DataBind method binds the user interface controls to the values + ' from the database record for each row in the table. To do this, it calls the + ' DataBind for each of the rows. + ' DataBind also populates any filters above the table, and sets the pagination + ' control to the correct number of records and the current page number. + + MyBase.DataBind() + + ' Make sure that the DataSource is initialized. + If Me.DataSource Is Nothing Then + Return + End If + + 'LoadData for DataSource for chart and report if they exist + + ' Improve performance by prefetching display as records. + Me.PreFetchForeignKeyValues() + + ' Setup the pagination controls. + BindPaginationControls() + + + + ' Bind the repeater with the list of records to expand the UI. + Dim rep As System.Web.UI.WebControls.Repeater = CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalSportSkillTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return + rep.DataSource = DataSource() + rep.DataBind() + + Dim index As Integer = 0 + For Each repItem As System.Web.UI.WebControls.RepeaterItem In rep.Items + ' Loop through all rows in the table, set its DataSource and call DataBind(). + Dim recControl As PersonalSportSkillTableControlRow = DirectCast(repItem.FindControl("PersonalSportSkillTableControlRow"), PersonalSportSkillTableControlRow) + recControl.DataSource = Me.DataSource(index) + If Me.UIData.Count > index Then + recControl.PreviousUIData = Me.UIData(index) + End If + recControl.DataBind() + recControl.Visible = Not Me.InDeletedRecordIds(recControl) + + index += 1 + Next + + + + + ' Call the Set methods for each controls on the panel + + SetLevelLabel() + + + + + + + + SetPersonalSportSkillTableControlCollapsibleRegion() + SetPersonalSportSkillTableControlIcon() + SetPersonalSportSkillTableControlPanelExtender() + + + SetSportIdLabel1() + ' setting the state of expand or collapse alternative rows + + + ' Load data for each record and table UI control. + ' Ordering is important because child controls get + ' their parent ids from their parent UI controls. + + + ' this method calls the set method for controls with special formula like running total, sum, rank, etc + SetFormulaControls() + End Sub + + Public Overridable Sub SetFormulaControls() + ' this method calls Set methods for the control that has special formula + + + + End Sub + + + Public Sub PreFetchForeignKeyValues() + If (IsNothing(Me.DataSource)) + Return + End If + + Me.Page.PregetDfkaRecords(PersonalSportSkillTable.PersonalId, Me.DataSource) + + Me.Page.PregetDfkaRecords(PersonalSportSkillTable.SportId, Me.DataSource) + + End Sub + + + Public Overridable Sub RegisterPostback() + + Me.Page.RegisterPostBackTrigger(MiscUtils.FindControlRecursively(Me,"PersonalSportSkillSaveButton")) + + + End Sub + + Public EvaluateFormulaDelegate As BaseClasses.Data.DataSource.EvaluateFormulaDelegate = New BaseClasses.Data.DataSource.EvaluateFormulaDelegate(AddressOf Me.EvaluateFormula) + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean, ByVal e as FormulaEvaluator) As String + If e Is Nothing + e = New FormulaEvaluator() + End If + + e.Variables.Clear() + + + ' add variables for formula evaluation + If variables IsNot Nothing Then + Dim enumerator As System.Collections.Generic.IEnumerator(Of System.Collections.Generic.KeyValuePair(Of String, Object)) = variables.GetEnumerator() + While enumerator.MoveNext() + e.Variables.Add(enumerator.Current.Key, enumerator.Current.Value) + End While + End If + + If includeDS + + End If + + ' All variables referred to in the formula are expected to be + ' properties of the DataSource. For example, referring to + ' UnitPrice as a variable will refer to DataSource.UnitPrice + e.DataSource = dataSourceForEvaluate + + ' Define the calling control. This is used to add other + ' related table and record controls as variables. + e.CallingControl = Me + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + + If Not String.IsNullOrEmpty(format) AndAlso (String.IsNullOrEmpty(formula) OrElse formula.IndexOf("Format(") < 0) Then + Return FormulaUtils.Format(resultObj, format) + Else + Return resultObj.ToString() + End If + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format,variables ,includeDS, Nothing) + End Function + + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object)) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format, variables ,True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, format, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal e as FormulaEvaluator) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, variables, True, e) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal includeDS as Boolean) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, includeDS, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, True, Nothing) + End Function + + + + + Public Overridable Sub ResetControl() + + Me.CurrentSortOrder.Reset() + If (Me.InSession(Me, "Order_By")) Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + End If + + Me.PageIndex = 0 + End Sub + + Protected Overridable Sub BindPaginationControls() + ' Setup the pagination controls. + + ' Bind the pagination labels. + + If DbUtils.GetCreatedRecords(Me.DataSource).Length > 0 Then + + Me.PersonalSportSkillPagination.CurrentPage.Text = (Me.PageIndex + 1).ToString() + Else + Me.PersonalSportSkillPagination.CurrentPage.Text = "0" + End If + Me.PersonalSportSkillPagination.PageSize.Text = Me.PageSize.ToString() + Me.PersonalSportSkillPagination.TotalItems.Text = Me.TotalRecords.ToString() + Me.PersonalSportSkillPagination.TotalPages.Text = Me.TotalPages.ToString() + + ' Bind the buttons for PersonalSportSkillTableControl pagination. + + Me.PersonalSportSkillPagination.FirstPage.Enabled = Not (Me.PageIndex = 0) + If Me._TotalPages < 0 Then ' if the total pages is not determined yet, enable last and next buttons + Me.PersonalSportSkillPagination.LastPage.Enabled = True + ElseIf Me._TotalPages = 0 ' if the total pages is determined and it is 0, enable last and next buttons + Me.PersonalSportSkillPagination.LastPage.Enabled = False + Else ' if the total pages is the last page, disable last and next buttons + Me.PersonalSportSkillPagination.LastPage.Enabled = Not (Me.PageIndex = Me.TotalPages - 1) + End If + + If Me._TotalPages < 0 Then ' if the total pages is not determined yet, enable last and next buttons + Me.PersonalSportSkillPagination.NextPage.Enabled = True + ElseIf Me._TotalPages = 0 ' if the total pages is determined and it is 0, enable last and next buttons + Me.PersonalSportSkillPagination.NextPage.Enabled = False + Else ' if the total pages is the last page, disable last and next buttons + Me.PersonalSportSkillPagination.NextPage.Enabled = Not (Me.PageIndex = Me.TotalPages - 1) + End If + + Me.PersonalSportSkillPagination.PreviousPage.Enabled = Not (Me.PageIndex = 0) + + + End Sub + + Public Overridable Sub SaveData() + ' Save the data from the entire table. Calls each row's Save Data + ' to save their data. This function is called by the Click handler of the + ' Save button. The button handler should Start/Commit/End a transaction. + + Dim recCtl As PersonalSportSkillTableControlRow + For Each recCtl In Me.GetRecordControls() + + If Me.InDeletedRecordIds(recCtl) Then + ' Delete any pending deletes. + recCtl.Delete() + Else + If recCtl.Visible Then + recCtl.SaveData() + End If + End If + + Next + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + ' Set IsNewRecord to False for all records - since everything has been saved and is no longer "new" + For Each recCtl In Me.GetRecordControls() + recCtl.IsNewRecord = False + Next + + + ' Set DeletedRecordsIds to Nothing since we have deleted all pending deletes. + Me.DeletedRecordIds = Nothing + + End Sub + + Public Overridable Function CreateCompoundJoinFilter() As CompoundFilter + Dim jFilter As CompoundFilter = New CompoundFilter() + + Return jFilter + + End Function + + + Public Overridable Function CreateOrderBy() As OrderBy + ' The CurrentSortOrder is initialized to the sort order on the + ' Query Wizard. It may be modified by the Click handler for any of + ' the column heading to sort or reverse sort by that column. + ' You can add your own sort order, or modify it on the Query Wizard. + Return Me.CurrentSortOrder + End Function + + Public Overridable Function CreateWhereClause() As WhereClause + 'This CreateWhereClause is used for loading the data. + PersonalSportSkillTable.Instance.InnerFilter = Nothing + Dim wc As WhereClause = New WhereClause() + + ' Compose the WHERE clause consiting of: + ' 1. Static clause defined at design time. + ' 2. User selected search criteria. + ' 3. User selected filter criteria. + + + ' Get the static clause defined at design time on the Table Panel Wizard + Dim qc As WhereClause = Me.CreateQueryClause() + If Not(IsNothing(qc)) Then + wc.iAND(qc) + End If + + Return wc + End Function + + + Public Overridable Function CreateWhereClause(ByVal searchText as String, ByVal fromSearchControl as String, ByVal AutoTypeAheadSearch as String, ByVal AutoTypeAheadWordSeparators as String) As WhereClause + ' This CreateWhereClause is used for loading list of suggestions for Auto Type-Ahead feature. + PersonalSportSkillTable.Instance.InnerFilter = Nothing + Dim wc As WhereClause = New WhereClause() + + ' Compose the WHERE clause consiting of: + ' 1. Static clause defined at design time. + ' 2. User selected search criteria. + ' 3. User selected filter criteria. + + Dim appRelativeVirtualPath As String = CType(HttpContext.Current.Session("AppRelativeVirtualPath"), String) + + ' Get the static clause defined at design time on the Table Panel Wizard + Dim qc As WhereClause = Me.CreateQueryClause() + If Not(IsNothing(qc)) Then + wc.iAND(qc) + End If + + ' Adds clauses if values are selected in Filter controls which are configured in the page. + + + Return wc + End Function + + Protected Overridable Function CreateQueryClause() As WhereClause + ' Create a where clause for the Static clause defined at design time. + Dim filter As CompoundFilter = New CompoundFilter(CompoundFilter.CompoundingOperators.And_Operator, Nothing) + Dim whereClause As WhereClause = New WhereClause() + + filter.AddFilter(New BaseClasses.Data.SignedInUserFilter(BaseClasses.Data.BaseTable.CreateInstance("Persons.Business.PersonalSportSkillTable, App_Code").TableDefinition.ColumnList.GetByUniqueName("PersonalSportSkill_.PersonalId"), New BaseClasses.Data.IdentifierAliasInfo("PersonalSportSkill_", Nothing), BaseClasses.Data.BaseFilter.ComparisonOperator.EqualsTo, False)) + + whereClause.AddFilter(filter, CompoundFilter.CompoundingOperators.And_Operator) + + Return whereClause + + End Function + + + Public Overridable Function FormatSuggestions(ByVal prefixText As String, ByVal resultItem As String, _ + ByVal columnLength As Integer, ByVal AutoTypeAheadDisplayFoundText As String, _ + ByVal autoTypeAheadSearch As String, ByVal AutoTypeAheadWordSeparators As String, _ + ByVal resultList As ArrayList) As Boolean + + 'Formats the resultItem and adds it to the list of suggestions. + Dim index As Integer = resultItem.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture).IndexOf(prefixText.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture)) + Dim itemToAdd As String = "" + Dim isFound As Boolean = False + Dim isAdded As Boolean = False + ' Get the index where prfixt is at the beginning of resultItem. If not found then, index of word which begins with prefixText. + If InvariantLCase(autoTypeAheadSearch).equals("wordsstartingwithsearchstring") And Not index = 0 Then + ' Expression to find word which contains AutoTypeAheadWordSeparators followed by prefixText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex( AutoTypeAheadWordSeparators + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + If regex1.IsMatch(resultItem) Then + index = regex1.Match(resultItem).Index + isFound = True + End If + ' If the prefixText is found immediatly after white space then starting of the word is found so don not search any further + If not resultItem(index).ToString() = " " Then + ' Expression to find beginning of the word which contains AutoTypeAheadWordSeparators followed by prefixText + Dim regex As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\\S*" + AutoTypeAheadWordSeparators + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + If regex.IsMatch(resultItem) Then + index = regex.Match(resultItem).Index + isFound = True + End If + End If + End If + + ' If autoTypeAheadSearch value is wordsstartingwithsearchstring then, extract the substring only if the prefixText is found at the + ' beginning of the resultItem (index = 0) or a word in resultItem is found starts with prefixText. + If index = 0 Or isFound Or InvariantLCase(autoTypeAheadSearch).Equals("anywhereinstring") then + If InvariantLCase(AutoTypeAheadDisplayFoundText).equals("atbeginningofmatchedstring") Then + ' Expression to find beginning of the word which contains prefixText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\\S*" + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + ' Find the beginning of the word which contains prefexText + If (StringUtils.InvariantLCase(autoTypeAheadSearch).Equals("anywhereinstring") AndAlso regex1.IsMatch(resultItem)) Then + index = regex1.Match(resultItem).Index + isFound = True + End If + ' Display string from the index till end of the string if sub string from index till end is less than columnLength value. + If Len(resultItem) - index <= columnLength Then + If index = 0 Then + itemToAdd = resultItem + Else + itemToAdd = "..." & resultItem.Substring(index, Len(resultItem) - index) + End If + Else + If index = 0 Then + itemToAdd = resultItem.Substring(index, (columnLength - 3)) & "..." + Else + 'Truncate the string to show only columnLength - 6 characters as begining and trailing "..." has to be appended. + itemToAdd = "..." & resultItem.Substring(index , columnLength - 6) & "..." + End If + End If + ElseIf InvariantLCase(AutoTypeAheadDisplayFoundText).equals("inmiddleofmatchedstring") Then + Dim subStringBeginIndex As Integer = CType(columnLength/2, Integer) + If Len(resultItem) <= columnLength Then + itemToAdd = resultItem + Else + ' Sanity check at end of the string + If index + Len(prefixText) = columnLength Then + itemToAdd = "..." & resultItem.Substring(index-columnLength,index) + ElseIf Len(resultItem) - index < subStringBeginIndex Then + ' Display string from the end till columnLength value if, index is closer to the end of the string. + itemToAdd = "..." & resultItem.Substring(Len(resultItem)-columnLength,Len(resultItem)) + ElseIf index <= subStringBeginIndex Then + ' Sanity chet at beginning of the string + itemToAdd = resultItem.Substring(0, columnLength) & "..." + Else + ' Display string containing text before the prefixText occures and text after the prefixText + itemToAdd = "..." & resultItem.Substring(index - subStringBeginIndex, columnLength) & "..." + End If + End If + ElseIf InvariantLCase(AutoTypeAheadDisplayFoundText).equals("atendofmatchedstring") Then + ' Expression to find ending of the word which contains prefexText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\s", System.Text.RegularExpressions.RegexOptions.IgnoreCase) + ' Find the ending of the word which contains prefexText + If regex1.IsMatch(resultItem, index + 1) Then + index = regex1.Match(resultItem, index + 1).Index + Else + ' If the word which contains prefexText is the last word in string, regex1.IsMatch returns false. + index = resultItem.Length + End If + If index > Len(resultItem) Then + index = Len(resultItem) + End If + ' If text from beginning of the string till index is less than columnLength value then, display string from the beginning till index. + If index <= columnLength Then + if index = Len(resultItem) Then 'Make decision to append "..." + itemToAdd = resultItem.Substring(0,index) + Else + itemToAdd = resultItem.Substring(0,index) & "..." + End If + Else + If index = Len(resultItem) Then + itemToAdd = "..." & resultItem.Substring(index - (columnLength - 3), (columnLength - 3)) + Else + 'Truncate the string to show only columnLength - 6 characters as begining and trailing "..." has to be appended. + itemToAdd = "..." & resultItem.Substring(index - (columnLength - 6), columnLength - 6) & "..." + End If + End If + End If + + ' Remove newline character from itemToAdd + Dim prefixTextIndex As Integer = itemToAdd.IndexOf(prefixText, StringComparison.CurrentCultureIgnoreCase) + ' If itemToAdd contains any newline after the search text then show text only till newline + Dim regex2 As System.Text.RegularExpressions.Regex = New System.Text.RegularExpressions.Regex("(" & vbCrLf & "|" & vbLf & ")", System.Text.RegularExpressions.RegexOptions.IgnoreCase) + Dim newLineIndexAfterPrefix As Integer = -1 + If regex2.IsMatch(itemToAdd, prefixTextIndex) Then + newLineIndexAfterPrefix = regex2.Match(itemToAdd, prefixTextIndex).Index + End If + If (newLineIndexAfterPrefix > -1) Then + If itemToAdd.EndsWith("...") Then + itemToAdd = (itemToAdd.Substring(0, newLineIndexAfterPrefix) + "...") + Else + itemToAdd = itemToAdd.Substring(0, newLineIndexAfterPrefix) + End If + End If + ' If itemToAdd contains any newline before search text then show text which comes after newline + Dim regex3 As System.Text.RegularExpressions.Regex = New System.Text.RegularExpressions.Regex("(" & vbCrLf & "|" & vbLf & ")", (System.Text.RegularExpressions.RegexOptions.IgnoreCase Or System.Text.RegularExpressions.RegexOptions.RightToLeft)) + Dim newLineIndexBeforePrefix As Integer = -1 + If regex3.IsMatch(itemToAdd, prefixTextIndex) Then + newLineIndexBeforePrefix = regex3.Match(itemToAdd, prefixTextIndex).Index + End If + If (newLineIndexBeforePrefix > -1) Then + If itemToAdd.StartsWith("...") Then + itemToAdd = ("..." + itemToAdd.Substring((newLineIndexBeforePrefix + regex3.Match(itemToAdd, prefixTextIndex).Length))) + Else + itemToAdd = itemToAdd.Substring((newLineIndexBeforePrefix + regex3.Match(itemToAdd, prefixTextIndex).Length)) + End If + End If + + If Not itemToAdd is nothing AndAlso Not resultList.Contains(itemToAdd) Then + + resultList.Add(itemToAdd) + + isAdded = true + End If + End If + Return isAdded + End Function + + + Protected Overridable Sub GetPageSize() + + If Me.PersonalSportSkillPagination.PageSize.Text.Trim <> "" Then + Try + 'Me.PageSize = Integer.Parse(Me.PersonalSportSkillPagination.PageSize.Text) + Catch ex As Exception + End Try + End If + End Sub + + Protected Overridable Sub AddNewRecords() + + Dim newRecordList As ArrayList = New ArrayList() + + Dim newUIDataList As System.Collections.Generic.List(Of Hashtable) = New System.Collections.Generic.List(Of Hashtable)() + + ' Loop though all the record controls and if the record control + ' does not have a unique record id set, then create a record + ' and add to the list. + If Not Me.ResetData Then + Dim rep As System.Web.UI.WebControls.Repeater = CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalSportSkillTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return + + Dim repItem As System.Web.UI.WebControls.RepeaterItem + For Each repItem In rep.Items + ' Loop through all rows in the table, set its DataSource and call DataBind(). + + Dim recControl As PersonalSportSkillTableControlRow = DirectCast(repItem.FindControl("PersonalSportSkillTableControlRow"), PersonalSportSkillTableControlRow) + + If recControl.Visible AndAlso recControl.IsNewRecord() Then + + Dim rec As PersonalSportSkillRecord = New PersonalSportSkillRecord() + + If recControl.Level.Text <> "" Then + rec.Parse(recControl.Level.Text, PersonalSportSkillTable.Level) + End If + If MiscUtils.IsValueSelected(recControl.PersonalId) Then + rec.Parse(recControl.PersonalId.SelectedItem.Value, PersonalSportSkillTable.PersonalId) + End If + If MiscUtils.IsValueSelected(recControl.SportId) Then + rec.Parse(recControl.SportId.SelectedItem.Value, PersonalSportSkillTable.SportId) + End If + newUIDataList.Add(recControl.PreservedUIData()) + newRecordList.Add(rec) + End If + Next + End If + + + ' Add any new record to the list. + Dim index As Integer = 0 + For index = 1 To Me.AddNewRecord + + newRecordList.Insert(0, New PersonalSportSkillRecord()) + newUIDataList.Insert(0, New Hashtable()) + + Next + Me.AddNewRecord = 0 + + ' Finally, add any new records to the DataSource. + If newRecordList.Count > 0 Then + + Dim finalList As ArrayList = New ArrayList(Me.DataSource) + finalList.InsertRange(0, newRecordList) + + Me.DataSource = DirectCast(finalList.ToArray(GetType(PersonalSportSkillRecord)), PersonalSportSkillRecord()) + + End If + + ' Add the existing UI data to this hash table + If newUIDataList.Count > 0 Then + Me.UIData.InsertRange(0, newUIDataList) + End If + + End Sub + + + Public Sub AddToDeletedRecordIds(ByVal rec As PersonalSportSkillTableControlRow) + If rec.IsNewRecord() Then + Return + End If + + If Not Me.DeletedRecordIds Is Nothing AndAlso Me.DeletedRecordIds.Trim <> "" Then + Me.DeletedRecordIds &= "," + End If + + Me.DeletedRecordIds &= "[" & rec.RecordUniqueId & "]" + End Sub + + Protected Overridable Function InDeletedRecordIds(ByVal rec As PersonalSportSkillTableControlRow) As Boolean + If Me.DeletedRecordIds Is Nothing OrElse Me.DeletedRecordIds.Trim = "" Then + Return False + End If + + Return Me.DeletedRecordIds.IndexOf("[" & rec.RecordUniqueId & "]") >= 0 + End Function + + Private _DeletedRecordIds As String + Public Property DeletedRecordIds() As String + Get + Return Me._DeletedRecordIds + End Get + Set(ByVal value As String) + Me._DeletedRecordIds = value + End Set + End Property + + + ' Create Set, WhereClause, and Populate Methods + + Public Overridable Sub SetLevelLabel() + + End Sub + + Public Overridable Sub SetPersonalSportSkillTableControlCollapsibleRegion() + + End Sub + + Public Overridable Sub SetPersonalSportSkillTableControlIcon() + + End Sub + + Public Overridable Sub SetPersonalSportSkillTableControlPanelExtender() + + End Sub + + Public Overridable Sub SetSportIdLabel1() + + 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. + Dim added As Boolean = Me.AddNewRecord > 0 + Me.LoadData() + Me.DataBind() + + If added Then + Me.SetFocusToAddedRow() + End If + + End If + + + + Catch ex As Exception + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + Finally + DbUtils.EndTransaction + End Try + End Sub + + 'this function sets focus to the first editable element in the new added row in the editable table + Protected Overridable Sub SetFocusToAddedRow() + Dim rep As System.Web.UI.WebControls.Repeater = CType(Me.FindControl("PersonalSportSkillTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing OrElse rep.Items.Count = 0 Then Return + Dim repItem As System.Web.UI.WebControls.RepeaterItem + For Each repItem In rep.Items + 'Load scripts to table rows + Me.Page.LoadFocusScripts(repItem) + Dim recControl As PersonalSportSkillTableControlRow = DirectCast(repItem.FindControl("PersonalSportSkillTableControlRow"), PersonalSportSkillTableControlRow) + If recControl.IsNewRecord Then + For Each field As Control In recControl.Controls + If field.Visible AndAlso Me.Page.IsControlEditable(field, False) Then + 'set focus on the first editable field in the new row + field.Focus() + Dim updPan As UpdatePanel = DirectCast(Me.Page.FindControlRecursively("UpdatePanel1"), UpdatePanel) + If Not updPan Is Nothing Then updPan.Update() + Return + End If + Next + Return + End If + Next + End Sub + + + Protected Overrides Sub SaveControlsToSession() + MyBase.SaveControlsToSession() + + ' Save filter controls to values to session. + + + 'Save pagination state to session. + + + + ' Save table control properties to the session. + If Not Me.CurrentSortOrder Is Nothing Then + Me.SaveToSession(Me, "Order_By", Me.CurrentSortOrder.ToXmlString()) + End If + + Me.SaveToSession(Me, "Page_Index", Me.PageIndex.ToString()) + Me.SaveToSession(Me, "Page_Size", Me.PageSize.ToString()) + + Me.SaveToSession(Me, "DeletedRecordIds", Me.DeletedRecordIds) + + End Sub + + Protected Sub SaveControlsToSession_Ajax() + ' Save filter controls to values to session. + + HttpContext.Current.Session("AppRelativeVirtualPath") = Me.Page.AppRelativeVirtualPath + + End Sub + + Protected Overrides Sub ClearControlsFromSession() + MyBase.ClearControlsFromSession() + + ' Clear filter controls values from the session. + + + ' Clear pagination state from session. + + + + ' Clear table properties from the session. + Me.RemoveFromSession(Me, "Order_By") + Me.RemoveFromSession(Me, "Page_Index") + Me.RemoveFromSession(Me, "Page_Size") + + Me.RemoveFromSession(Me, "DeletedRecordIds") + + End Sub + + Protected Overrides Sub LoadViewState(ByVal savedState As Object) + MyBase.LoadViewState(savedState) + + Dim orderByStr As String = CType(ViewState("PersonalSportSkillTableControl_OrderBy"), String) + + If orderByStr IsNot Nothing AndAlso orderByStr.Trim <> "" Then + Me.CurrentSortOrder = BaseClasses.Data.OrderBy.FromXmlString(orderByStr) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + End If + + Dim pageIndex As String = CType(ViewState("Page_Index"), String) + If pageIndex IsNot Nothing Then + Me.PageIndex = CInt(pageIndex) + End If + + Dim pageSize As String = CType(ViewState("Page_Size"), String) + If Not pageSize Is Nothing Then + Me.PageSize = CInt(pageSize) + End If + + + + ' Load view state for pagination control. + + Me.DeletedRecordIds = CType(Me.ViewState("DeletedRecordIds"), String) + + End Sub + + Protected Overrides Function SaveViewState() As Object + + If Me.CurrentSortOrder IsNot Nothing Then + Me.ViewState("PersonalSportSkillTableControl_OrderBy") = Me.CurrentSortOrder.ToXmlString() + End If + + Me.ViewState("Page_Index") = Me.PageIndex + Me.ViewState("Page_Size") = Me.PageSize + + Me.ViewState("DeletedRecordIds") = Me.DeletedRecordIds + + + ' Load view state for pagination control. + + + Return MyBase.SaveViewState() + End Function + + ' Generate the event handling functions for pagination events. + + ' event handler for ImageButton + Public Overridable Sub PersonalSportSkillPagination_FirstPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.PageIndex = 0 + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalSportSkillPagination_LastPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.DisplayLastPage = True + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalSportSkillPagination_NextPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.PageIndex += 1 + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for LinkButton + Public Overridable Sub PersonalSportSkillPagination_PageSizeButton_Click(ByVal sender As Object, ByVal args As EventArgs) + + Try + + Me.DataChanged = True + + Me.PageSize = Integer.Parse(Me.PersonalSportSkillPagination.PageSize.Text) + + Me.PageIndex = Integer.Parse(Me.PersonalSportSkillPagination.CurrentPage.Text) - 1 + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalSportSkillPagination_PreviousPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + If Me.PageIndex > 0 Then + Me.PageIndex -= 1 + Me.DataChanged = True + End If + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + + ' Generate the event handling functions for sorting events. + + Public Overridable Sub LevelLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by Level when clicked. + + ' Get previous sorting state for Level. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalSportSkillTable.Level) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for Level. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalSportSkillTable.Level, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by Level, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub SportIdLabel1_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by SportId when clicked. + + ' Get previous sorting state for SportId. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalSportSkillTable.SportId) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for SportId. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalSportSkillTable.SportId, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by SportId, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + + ' Generate the event handling functions for button events. + + ' event handler for ImageButton + Public Overridable Sub PersonalSportSkillAddButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + Me.AddNewRecord = 1 + Me.DataChanged = True + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalSportSkillDeleteButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + If(Not Me.Page.IsPageRefresh) Then + + Me.DeleteSelectedRecords(True) + Me.SetFormulaControls() + + + End If + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalSportSkillEditButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + ' The redirect URL is set on the Properties, Custom Properties or Actions. + ' The ModifyRedirectURL call resolves the parameters before the + ' Response.Redirect redirects the page to the URL. + ' Any code after the Response.Redirect call will not be executed, since the page is + ' redirected to the URL. + + + Dim url As String = "../Shared/ConfigureEditRecord.aspx" + + Dim shouldRedirect As Boolean = True + Dim TargetKey As String = Nothing + Dim DFKA As String = TargetKey + Dim id As String = DFKA + Dim value As String = id + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + url = Me.ModifyRedirectUrl(url, "",False) + url = Me.Page.ModifyRedirectUrl(url, "",False) + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + shouldRedirect = False + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + If shouldRedirect Then + Me.Page.ShouldSaveControlsToSession = True + Me.Page.Response.Redirect(url) + ElseIf Not TargetKey Is Nothing AndAlso _ + Not shouldRedirect Then + Me.Page.ShouldSaveControlsToSession = True + Me.Page.CloseWindow(True) + + End If + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalSportSkillRefreshButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Dim PersonalSportSkillTableControlObj as PersonalSportSkillTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalSportSkillTableControl"), PersonalSportSkillTableControl) + PersonalSportSkillTableControlObj.ResetData = True + + PersonalSportSkillTableControlObj.RemoveFromSession(PersonalSportSkillTableControlObj, "DeletedRecordIds") + PersonalSportSkillTableControlObj.DeletedRecordIds = Nothing + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalSportSkillResetButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.CurrentSortOrder.Reset() + If Me.InSession(Me, "Order_By") Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + + End If + + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalSportSkillSaveButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + + If (Not Me.Page.IsPageRefresh) Then + Me.SaveData() + End If + + Me.Page.CommitTransaction(sender) + ' Set IsNewRecord to False for all records - since everything has been saved and is no longer "new" + Dim recCtl As PersonalSportSkillTableControlRow + For Each recCtl in Me.GetRecordControls() + + recCtl.IsNewRecord = False + Next + + + ' Set DeletedRecordsIds to Nothing since we have deleted all pending deletes. + + Me.DeletedRecordIds = Nothing + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + + + ' Generate the event handling functions for filter and search events. + + + ' Generate the event handling functions for others + + + Private _UIData As New System.Collections.Generic.List(Of Hashtable) + Public Property UIData() As System.Collections.Generic.List(Of Hashtable) + Get + Return Me._UIData + End Get + Set(ByVal value As System.Collections.Generic.List(Of Hashtable)) + Me._UIData = value + End Set + End Property + + ' pagination properties + Protected _PageSize As Integer + Public Property PageSize() As Integer + Get + Return Me._PageSize + End Get + Set(ByVal value As Integer) + Me._PageSize = value + End Set + End Property + + Protected _PageIndex As Integer + Public Property PageIndex() As Integer + Get + ' Return the PageIndex + Return Me._PageIndex + End Get + Set(ByVal value As Integer) + Me._PageIndex = value + End Set + End Property + + Protected _TotalRecords As Integer = -1 + Public Property TotalRecords() As Integer + Get + If _TotalRecords < 0 + _TotalRecords = PersonalSportSkillTable.GetRecordCount(CreateCompoundJoinFilter(), CreateWhereClause()) + End If + Return Me._TotalRecords + End Get + Set(ByVal value As Integer) + If Me.PageSize > 0 Then + + Me.TotalPages = CInt(Math.Ceiling(value / Me.PageSize)) + + End If + Me._TotalRecords = value + End Set + End Property + + + + Protected _TotalPages As Integer = -1 + Public Property TotalPages() As Integer + Get + If _TotalPages < 0 Then + + Me.TotalPages = CInt(Math.Ceiling(TotalRecords / Me.PageSize)) + + End If + Return Me._TotalPages + End Get + Set(ByVal value As Integer) + Me._TotalPages = value + End Set + End Property + + Protected _DisplayLastPage As Boolean + Public Property DisplayLastPage() As Boolean + Get + Return Me._DisplayLastPage + End Get + Set(ByVal value As Boolean) + Me._DisplayLastPage = value + End Set + End Property + + Private _DataChanged As Boolean = False + Public Property DataChanged() As Boolean + Get + Return Me._DataChanged + End Get + Set(ByVal value As Boolean) + Me._DataChanged = value + End Set + End Property + + Private _ResetData As Boolean = False + Public Property ResetData() As Boolean + Get + Return Me._ResetData + End Get + Set(ByVal value As Boolean) + Me._ResetData = value + End Set + End Property + + Private _AddNewRecord As Integer = 0 + Public Property AddNewRecord() As Integer + Get + Return Me._AddNewRecord + End Get + Set(ByVal value As Integer) + Me._AddNewRecord = value + End Set + End Property + + + Private _CurrentSortOrder As OrderBy = Nothing + Public Property CurrentSortOrder() As OrderBy + Get + Return Me._CurrentSortOrder + End Get + Set(ByVal value As BaseClasses.Data.OrderBy) + Me._CurrentSortOrder = value + End Set + End Property + + Private _DataSource() As PersonalSportSkillRecord = Nothing + Public Property DataSource() As PersonalSportSkillRecord () + Get + Return Me._DataSource + End Get + Set(ByVal value() As PersonalSportSkillRecord) + Me._DataSource = value + End Set + End Property + +#Region "Helper Properties" + + Public ReadOnly Property LevelLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "LevelLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property PersonalSportSkillAddButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalSportSkillAddButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalSportSkillDeleteButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalSportSkillDeleteButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalSportSkillEditButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalSportSkillEditButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalSportSkillPagination() As Persons.UI.IPagination + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalSportSkillPagination"), Persons.UI.IPagination) + End Get + End Property + + Public ReadOnly Property PersonalSportSkillRefreshButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalSportSkillRefreshButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalSportSkillResetButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalSportSkillResetButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalSportSkillSaveButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalSportSkillSaveButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalSportSkillTableControlCollapsibleRegion() As System.Web.UI.WebControls.Panel + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalSportSkillTableControlCollapsibleRegion"), System.Web.UI.WebControls.Panel) + End Get + End Property + + Public ReadOnly Property PersonalSportSkillTableControlIcon() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalSportSkillTableControlIcon"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalSportSkillTableControlPanelExtender() As AjaxControlToolkit.CollapsiblePanelExtender + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalSportSkillTableControlPanelExtender"), AjaxControlToolkit.CollapsiblePanelExtender) + End Get + End Property + + Public ReadOnly Property PersonalSportSkillTitle() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalSportSkillTitle"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property PersonalSportSkillToggleAll() As System.Web.UI.WebControls.CheckBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalSportSkillToggleAll"), System.Web.UI.WebControls.CheckBox) + End Get + End Property + + Public ReadOnly Property SportIdLabel1() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "SportIdLabel1"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + +#End Region + +#Region "Helper Functions" + + Public Overrides Overloads Function ModifyRedirectUrl(url As String, arg As String, ByVal bEncrypt As Boolean) As String + Return Me.Page.EvaluateExpressions(url, arg, bEncrypt, Me) + End Function + + Public Overrides Overloads Function EvaluateExpressions(url As String, arg As String, ByVal bEncrypt As Boolean) As String + Dim needToProcess As Boolean = AreAnyUrlParametersForMe(url, arg) + If (needToProcess) Then + Dim recCtl As PersonalSportSkillTableControlRow = Me.GetSelectedRecordControl() + If recCtl Is Nothing AndAlso url.IndexOf("{") >= 0 Then + ' Localization. + Throw New Exception(Page.GetResourceValue("Err:NoRecSelected", "Persons")) + End If + Dim rec As PersonalSportSkillRecord = Nothing + If recCtl IsNot Nothing Then + rec = recCtl.GetRecord() + End If + Return EvaluateExpressions(url, arg, rec, bEncrypt) + End If + Return url + End Function + + Public Overridable Function GetSelectedRecordIndex() As Integer + Dim counter As Integer = 0 + Dim recControl As PersonalSportSkillTableControlRow + For Each recControl In Me.GetRecordControls() + If recControl.PersonalSportSkillRecordRowSelection.Checked Then + Return counter + End If + counter += 1 + Next + Return -1 + End Function + + Public Overridable Function GetSelectedRecordControl() As PersonalSportSkillTableControlRow + Dim selectedList() As PersonalSportSkillTableControlRow = Me.GetSelectedRecordControls() + If selectedList.Length = 0 Then + Return Nothing + End If + Return selectedList(0) + + End Function + + Public Overridable Function GetSelectedRecordControls() As PersonalSportSkillTableControlRow() + + Dim selectedList As ArrayList = New ArrayList(25) + Dim recControl As PersonalSportSkillTableControlRow + For Each recControl In Me.GetRecordControls() + If recControl.PersonalSportSkillRecordRowSelection IsNot Nothing AndAlso recControl.PersonalSportSkillRecordRowSelection.Checked Then + selectedList.Add(recControl) + End If + Next + Return DirectCast(selectedList.ToArray(GetType(PersonalSportSkillTableControlRow)), PersonalSportSkillTableControlRow()) + + End Function + + Public Overridable Sub DeleteSelectedRecords(ByVal deferDeletion As Boolean) + Dim recList() As PersonalSportSkillTableControlRow = Me.GetSelectedRecordControls() + If recList.Length = 0 Then + ' Localization. + Throw New Exception(Page.GetResourceValue("Err:NoRecSelected", "Persons")) + End If + + Dim recCtl As PersonalSportSkillTableControlRow + For Each recCtl In recList + If deferDeletion Then + If Not recCtl.IsNewRecord Then + + Me.AddToDeletedRecordIds(recCtl) + + End If + recCtl.Visible = False + + recCtl.PersonalSportSkillRecordRowSelection.Checked = False + + Else + + recCtl.Delete() + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + End If + Next + End Sub + + Public Function GetRecordControls() As PersonalSportSkillTableControlRow() + Dim recList As ArrayList = New ArrayList() + Dim rep As System.Web.UI.WebControls.Repeater = CType(Me.FindControl("PersonalSportSkillTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return Nothing + Dim repItem As System.Web.UI.WebControls.RepeaterItem + + For Each repItem In rep.Items + + Dim recControl As PersonalSportSkillTableControlRow = DirectCast(repItem.FindControl("PersonalSportSkillTableControlRow"), PersonalSportSkillTableControlRow) + recList.Add(recControl) + + Next + + Return DirectCast(recList.ToArray(GetType(PersonalSportSkillTableControlRow)), PersonalSportSkillTableControlRow()) + 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 + + \ No newline at end of file diff --git a/App_Code/PersonalTitle/EditPersonalTitleTable.Controls.vb b/App_Code/PersonalTitle/EditPersonalTitleTable.Controls.vb new file mode 100644 index 0000000..e50143f --- /dev/null +++ b/App_Code/PersonalTitle/EditPersonalTitleTable.Controls.vb @@ -0,0 +1,3114 @@ + +' This file implements the TableControl, TableControlRow, and RecordControl classes for the +' EditPersonalTitleTable.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.EditPersonalTitleTable + +#Region "Section 1: Place your customizations here." + + +Public Class PersonalTitleTableControlRow + Inherits BasePersonalTitleTableControlRow + ' The BasePersonalTitleTableControlRow implements code for a ROW within the + ' the PersonalTitleTableControl table. The BasePersonalTitleTableControlRow implements the DataBind and SaveData methods. + ' The loading of data is actually performed by the LoadData method in the base class of PersonalTitleTableControl. + + ' This is the ideal place to add your code customizations. For example, you can override the DataBind, + ' SaveData, GetUIData, and Validate methods. + Public Overrides Sub GetUIData() + + ' Call MyBase.GetUIData + MyBase.GetUIData() + + ' Get PersonalDD Record + Dim myRec As PersonalTitleRecord = Me.GetRecord + + ' Set PersonalId field value to new value string + myRec.PersonalId = Utils.SecurityControls.GetCurrentUserID + + End Sub + + +End Class + + + +Public Class PersonalTitleTableControl + Inherits BasePersonalTitleTableControl + + ' The BasePersonalTitleTableControl class implements the LoadData, DataBind, CreateWhereClause + ' and other methods to load and display the data in a table control. + + ' This is the ideal place to add your code customizations. You can override the LoadData and CreateWhereClause, + ' The PersonalTitleTableControlRow class offers another place where you can customize + ' the DataBind, GetUIData, SaveData and Validate methods specific to each row displayed on the table. + +End Class + + + +#End Region + + + +#Region "Section 2: Do not modify this section." + + +' Base class for the PersonalTitleTableControlRow control on the EditPersonalTitleTable page. +' Do not modify this class. Instead override any method in PersonalTitleTableControlRow. +Public Class BasePersonalTitleTableControlRow + Inherits Persons.UI.BaseApplicationRecordControl + + ' To customize, override this method in PersonalTitleTableControlRow. + Protected Overridable Sub Control_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Init + + Me.ClearControlsFromSession() + End Sub + + ' To customize, override this method in PersonalTitleTableControlRow. + Protected Overridable Sub Control_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load + + 'Call LoadFocusScripts from repeater so that onfocus attribute could be added to elements + Me.Page.LoadFocusScripts(Me) + + ' Show confirmation message on Click + Me.PersonalTitleRowDeleteButton.Attributes.Add("onClick", "return (confirm('" & (CType(Me.Page,BaseApplicationPage)).GetResourceValue("DeleteRecordConfirm", "Persons") & "'));") + + + ' Register the event handlers. + + AddHandler Me.PersonalTitleRowDeleteButton.Click, AddressOf PersonalTitleRowDeleteButton_Click + + AddHandler Me.PersonalId.SelectedIndexChanged, AddressOf PersonalId_SelectedIndexChanged + + AddHandler Me.Command.TextChanged, AddressOf Command_TextChanged + + AddHandler Me.CommandDate.TextChanged, AddressOf CommandDate_TextChanged + + AddHandler Me.SkillNo.TextChanged, AddressOf SkillNo_TextChanged + + AddHandler Me.Title.TextChanged, AddressOf Title_TextChanged + + AddHandler Me.TitleDate.TextChanged, AddressOf TitleDate_TextChanged + + AddHandler Me.TitleRank.TextChanged, AddressOf TitleRank_TextChanged + + + End Sub + + + Public Overridable Sub LoadData() + + ' Load the data from the database into the DataSource PersonalTitle 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 = PersonalTitleTable.GetRecord(Me.RecordUniqueId, True) + + Return + End If + + ' Since this is a row in the table, the data for this row is loaded by the + ' LoadData method of the BasePersonalTitleTableControl when the data for the entire + ' table is loaded. + + Me.DataSource = New PersonalTitleRecord() + + + + End Sub + + ' Populate the UI controls using the DataSource. To customize, override this method in PersonalTitleTableControlRow. + Public Overrides Sub DataBind() + ' The DataBind method binds the user interface controls to the values + ' from the database record. To do this, it calls the Set methods for + ' each of the field displayed on the webpage. It is better to make + ' changes in the Set methods, rather than making changes here. + + MyBase.DataBind() + + ' Make sure that the DataSource is initialized. + If Me.DataSource Is Nothing Then + + Return + End If + + + 'LoadData for DataSource for chart and report if they exist + + + + ' Call the Set methods for each controls on the panel + + SetCommand() + SetCommandDate() + SetPersonalId() + + + SetSkillNo() + SetTitle() + SetTitleDate() + SetTitleRank() + + + Me.IsNewRecord = True + + If Me.DataSource.IsCreated Then + Me.IsNewRecord = False + + Me.RecordUniqueId = Me.DataSource.GetID.ToXmlString() + End If + + ' Now load data for each record and table child UI controls. + ' Ordering is important because child controls get + ' their parent ids from their parent UI controls. + Dim shouldResetControl As Boolean = False + + End Sub + + + Public Overridable Sub SetCommand() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.Command.ID) Then + + Me.Command.Text = Me.PreviousUIData(Me.Command.ID).ToString() + + Return + End If + + + ' Set the Command TextBox on the webpage with value from the + ' PersonalTitle database record. + + ' Me.DataSource is the PersonalTitle record retrieved from the database. + ' Me.Command is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetCommand() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.CommandSpecified Then + + ' If the Command is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalTitleTable.Command) + + Me.Command.Text = formattedValue + + Else + + ' Command is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.Command.Text = PersonalTitleTable.Command.Format(PersonalTitleTable.Command.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetCommandDate() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.CommandDate.ID) Then + + Me.CommandDate.Text = Me.PreviousUIData(Me.CommandDate.ID).ToString() + + Return + End If + + + ' Set the CommandDate TextBox on the webpage with value from the + ' PersonalTitle database record. + + ' Me.DataSource is the PersonalTitle record retrieved from the database. + ' Me.CommandDate is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetCommandDate() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.CommandDateSpecified Then + + ' If the CommandDate is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalTitleTable.CommandDate, "d MMM yyyy") + + Me.CommandDate.Text = formattedValue + + Else + + ' CommandDate is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.CommandDate.Text = PersonalTitleTable.CommandDate.Format(PersonalTitleTable.CommandDate.DefaultValue, "d MMM yyyy") + + End If + + End Sub + + Public Overridable Sub SetPersonalId() + + ' If selection was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.PersonalId.ID) Then + If Me.PreviousUIData(Me.PersonalId.ID) Is Nothing + Me.PopulatePersonalIdDropDownList(Nothing, 100) + Else + Me.PopulatePersonalIdDropDownList(Me.PreviousUIData(Me.PersonalId.ID).ToString(), 100) + End If + Return + End If + + + ' Set the PersonalId DropDownList on the webpage with value from the + ' PersonalTitle database record. + + ' Me.DataSource is the PersonalTitle record retrieved from the database. + ' Me.PersonalId is the ASP:DropDownList on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetPersonalId() + ' and add your own code before or after the call to the MyBase function. + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.PersonalIdSpecified Then + + ' If the PersonalId is non-NULL, then format the value. + ' The Format method will return the Display Foreign Key As (DFKA) value + Me.PopulatePersonalIdDropDownList(Me.DataSource.PersonalId, 100) + + Else + + ' PersonalId 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.PopulatePersonalIdDropDownList(Nothing, 100) + Else + Me.PopulatePersonalIdDropDownList(PersonalTitleTable.PersonalId.DefaultValue, 100) + End If + + End If + + End Sub + + Public Overridable Sub SetSkillNo() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.SkillNo.ID) Then + + Me.SkillNo.Text = Me.PreviousUIData(Me.SkillNo.ID).ToString() + + Return + End If + + + ' Set the SkillNo TextBox on the webpage with value from the + ' PersonalTitle database record. + + ' Me.DataSource is the PersonalTitle record retrieved from the database. + ' Me.SkillNo is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetSkillNo() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.SkillNoSpecified Then + + ' If the SkillNo is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalTitleTable.SkillNo) + + Me.SkillNo.Text = formattedValue + + Else + + ' SkillNo is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.SkillNo.Text = PersonalTitleTable.SkillNo.Format(PersonalTitleTable.SkillNo.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetTitle() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.Title.ID) Then + + Me.Title.Text = Me.PreviousUIData(Me.Title.ID).ToString() + + Return + End If + + + ' Set the Title TextBox on the webpage with value from the + ' PersonalTitle database record. + + ' Me.DataSource is the PersonalTitle record retrieved from the database. + ' Me.Title is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetTitle() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.TitleSpecified Then + + ' If the Title is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalTitleTable.Title) + + Me.Title.Text = formattedValue + + Else + + ' Title is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.Title.Text = PersonalTitleTable.Title.Format(PersonalTitleTable.Title.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetTitleDate() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.TitleDate.ID) Then + + Me.TitleDate.Text = Me.PreviousUIData(Me.TitleDate.ID).ToString() + + Return + End If + + + ' Set the TitleDate TextBox on the webpage with value from the + ' PersonalTitle database record. + + ' Me.DataSource is the PersonalTitle record retrieved from the database. + ' Me.TitleDate is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetTitleDate() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.TitleDateSpecified Then + + ' If the TitleDate is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalTitleTable.TitleDate, "d MMM yyyy") + + Me.TitleDate.Text = formattedValue + + Else + + ' TitleDate is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.TitleDate.Text = PersonalTitleTable.TitleDate.Format(PersonalTitleTable.TitleDate.DefaultValue, "d MMM yyyy") + + End If + + End Sub + + Public Overridable Sub SetTitleRank() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.TitleRank.ID) Then + + Me.TitleRank.Text = Me.PreviousUIData(Me.TitleRank.ID).ToString() + + Return + End If + + + ' Set the TitleRank TextBox on the webpage with value from the + ' PersonalTitle database record. + + ' Me.DataSource is the PersonalTitle record retrieved from the database. + ' Me.TitleRank is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetTitleRank() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.TitleRankSpecified Then + + ' If the TitleRank is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(PersonalTitleTable.TitleRank) + + Me.TitleRank.Text = formattedValue + + Else + + ' TitleRank is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.TitleRank.Text = PersonalTitleTable.TitleRank.Format(PersonalTitleTable.TitleRank.DefaultValue) + + End If + + End Sub + + + Public EvaluateFormulaDelegate As BaseClasses.Data.DataSource.EvaluateFormulaDelegate = New BaseClasses.Data.DataSource.EvaluateFormulaDelegate(AddressOf Me.EvaluateFormula) + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean, ByVal e As FormulaEvaluator) As String + If e Is Nothing Then + e = New FormulaEvaluator() + End If + + e.Variables.Clear() + + + ' add variables for formula evaluation + If variables IsNot Nothing Then + Dim enumerator As System.Collections.Generic.IEnumerator(Of System.Collections.Generic.KeyValuePair(Of String, Object)) = variables.GetEnumerator() + While enumerator.MoveNext() + e.Variables.Add(enumerator.Current.Key, enumerator.Current.Value) + End While + End If + + If includeDS + + End IF + + + ' Other variables referred to in the formula are expected to be + ' properties of the DataSource. For example, referring to + ' UnitPrice as a variable will refer to DataSource.UnitPrice + If dataSourceForEvaluate Is Nothing Then + + e.DataSource = Me.DataSource + + Else + e.DataSource = dataSourceForEvaluate + End If + + ' Define the calling control. This is used to add other + ' related table and record controls as variables. + e.CallingControl = Me + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + + If Not String.IsNullOrEmpty(format) AndAlso (String.IsNullOrEmpty(formula) OrElse formula.IndexOf("Format(") < 0) Then + Return FormulaUtils.Format(resultObj, format) + Else + Return resultObj.ToString() + End If + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format,variables ,includeDS, Nothing) + End Function + + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object)) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format, variables ,True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, format, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal e as FormulaEvaluator) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, variables, True, e) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal includeDS as Boolean) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, includeDS, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, True, Nothing) + End Function + + + Public Overridable Sub RegisterPostback() + + + End Sub + + + + ' To customize, override this method in PersonalTitleTableControlRow. + Public Overridable Sub SaveData() + ' Saves the associated record in the database. + ' SaveData calls Validate and Get methods - so it may be more appropriate to + ' customize those methods. + + ' 1. Load the existing record from the database. Since we save the entire record, this ensures + ' that fields that are not displayed are also properly initialized. + Me.LoadData() + + + ' 2. Perform any custom validation. + Me.Validate() + + + ' 3. Set the values in the record with data from UI controls. + ' This calls the Get() method for each of the user interface controls. + Me.GetUIData() + + ' 4. Save in the database. + ' We should not save the record if the data did not change. This + ' will save a database hit and avoid triggering any database triggers. + + If Me.DataSource.IsAnyValueChanged Then + ' Save record to database but do not commit yet. + ' Auto generated ids are available after saving for use by child (dependent) records. + Me.DataSource.Save() + + DirectCast(GetParentControlObject(Me, "PersonalTitleTableControl"), PersonalTitleTableControl).DataChanged = True + DirectCast(GetParentControlObject(Me, "PersonalTitleTableControl"), PersonalTitleTableControl).ResetData = True + End If + + + ' update session or cookie by formula + + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + ' For Master-Detail relationships, save data on the Detail table(s) + + End Sub + + ' To customize, override this method in PersonalTitleTableControlRow. + Public Overridable Sub GetUIData() + ' The GetUIData method retrieves the updated values from the user interface + ' controls into a database record in preparation for saving or updating. + ' To do this, it calls the Get methods for each of the field displayed on + ' the webpage. It is better to make changes in the Get methods, rather + ' than making changes here. + + ' Call the Get methods for each of the user interface controls. + + GetCommand() + GetCommandDate() + GetPersonalId() + GetSkillNo() + GetTitle() + GetTitleDate() + GetTitleRank() + End Sub + + + Public Overridable Sub GetCommand() + + ' Retrieve the value entered by the user on the Command ASP:TextBox, and + ' save it into the Command field in DataSource PersonalTitle record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.Command.Text, PersonalTitleTable.Command) + + + End Sub + + Public Overridable Sub GetCommandDate() + + ' Retrieve the value entered by the user on the CommandDate ASP:TextBox, and + ' save it into the CommandDate field in DataSource PersonalTitle 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.CommandDate.Text, PersonalTitleTable.CommandDate) + + + End Sub + + Public Overridable Sub GetPersonalId() + + ' Retrieve the value entered by the user on the PersonalId ASP:DropDownList, and + ' save it into the PersonalId field in DataSource PersonalTitle record. + + ' Custom validation should be performed in Validate, not here. + + Me.DataSource.Parse(GetValueSelectedPageRequest(Me.PersonalId), PersonalTitleTable.PersonalId) + + End Sub + + Public Overridable Sub GetSkillNo() + + ' Retrieve the value entered by the user on the SkillNo ASP:TextBox, and + ' save it into the SkillNo field in DataSource PersonalTitle record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.SkillNo.Text, PersonalTitleTable.SkillNo) + + + End Sub + + Public Overridable Sub GetTitle() + + ' Retrieve the value entered by the user on the Title ASP:TextBox, and + ' save it into the Title field in DataSource PersonalTitle record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.Title.Text, PersonalTitleTable.Title) + + + End Sub + + Public Overridable Sub GetTitleDate() + + ' Retrieve the value entered by the user on the TitleDate ASP:TextBox, and + ' save it into the TitleDate field in DataSource PersonalTitle 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.TitleDate.Text, PersonalTitleTable.TitleDate) + + + End Sub + + Public Overridable Sub GetTitleRank() + + ' Retrieve the value entered by the user on the TitleRank ASP:TextBox, and + ' save it into the TitleRank field in DataSource PersonalTitle record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.TitleRank.Text, PersonalTitleTable.TitleRank) + + + End Sub + + + ' To customize, override this method in PersonalTitleTableControlRow. + + Public Overridable Function CreateWhereClause() As WhereClause + + Return Nothing + + End Function + + + + ' To customize, override this method in PersonalTitleTableControlRow. + 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) + PersonalTitleTable.DeleteRecord(pkValue) + + DirectCast(GetParentControlObject(Me, "PersonalTitleTableControl"), PersonalTitleTableControl).DataChanged = True + DirectCast(GetParentControlObject(Me, "PersonalTitleTableControl"), PersonalTitleTableControl).ResetData = True + End Sub + + Protected Overridable Sub Control_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.PreRender + ' PreRender event is raised just before page is being displayed. + Try + DbUtils.StartTransaction() + Me.RegisterPostback() + + If Not Me.Page.ErrorOnPage AndAlso (Me.Page.IsPageRefresh OrElse Me.DataChanged OrElse Me.ResetData) Then + + + ' Re-load the data and update the web page if necessary. + ' This is typically done during a postback (filter, search button, sort, pagination button). + ' In each of the other click handlers, simply set DataChanged to True to reload the data. + Me.LoadData() + Me.DataBind() + End If + + + Catch ex As Exception + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + Finally + DbUtils.EndTransaction() + End Try + End Sub + + + Protected Overrides Sub SaveControlsToSession() + MyBase.SaveControlsToSession() + + + 'Save pagination state to session. + + End Sub + + + + Protected Overrides Sub ClearControlsFromSession() + MyBase.ClearControlsFromSession() + + + + ' Clear pagination state from session. + + End Sub + + Protected Overrides Sub LoadViewState(ByVal savedState As Object) + MyBase.LoadViewState(savedState) + Dim isNewRecord As String = CType(ViewState("IsNewRecord"), String) + If Not isNewRecord Is Nothing AndAlso isNewRecord.Trim <> "" Then + Me.IsNewRecord = Boolean.Parse(isNewRecord) + End If + + Dim myCheckSum As String = CType(ViewState("CheckSum"), String) + If Not myCheckSum Is Nothing AndAlso myCheckSum.Trim <> "" Then + Me.CheckSum = myCheckSum + End If + + + ' Load view state for pagination control. + + End Sub + + Protected Overrides Function SaveViewState() As Object + ViewState("IsNewRecord") = Me.IsNewRecord.ToString() + ViewState("CheckSum") = Me.CheckSum + + + ' Load view state for pagination control. + + Return MyBase.SaveViewState() + End Function + + + + Public Overridable Function CreateWhereClause_PersonalIdDropDownList() 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 PersonalId table. + ' Examples: + ' wc.iAND(PersonalIdTable.PersonalName, BaseFilter.ComparisonOperator.EqualsTo, "XYZ") + ' wc.iAND(PersonalIdTable.Active, BaseFilter.ComparisonOperator.EqualsTo, "1") + + Dim wc As WhereClause = New WhereClause() + Return wc + + End Function + + + ' Fill the PersonalId list. + Protected Overridable Sub PopulatePersonalIdDropDownList( _ + ByVal selectedValue As String, _ + ByVal maxItems As Integer) + + Me.PersonalId.Items.Clear() + + + ' 1. Setup the static list items + + ' Add the Please Select item. + Me.PersonalId.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_PersonalIdDropDownList function. + ' It is better to customize the where clause there. + + Dim wc As WhereClause = CreateWhereClause_PersonalIdDropDownList() + ' Create the ORDER BY clause to sort based on the displayed value. + + + Dim orderBy As OrderBy = New OrderBy(false, false) + orderBy.Add(PersonalIdTable.PersonalName, OrderByItem.OrderDir.Asc) + + Dim variables As System.Collections.Generic.IDictionary(Of String, Object) = New System.Collections.Generic.Dictionary(Of String, Object) + + ' 3. Read a total of maxItems from the database and insert them + Dim itemValues() As PersonalIdRecord = 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 = PersonalIdTable.GetRecords(wc, orderBy, pageNum, maxItems) + For each itemValue As PersonalIdRecord In itemValues + ' Create the item and add to the list. + Dim cvalue As String = Nothing + Dim fvalue As String = Nothing + If itemValue.PersonalIdSpecified Then + cvalue = itemValue.PersonalId.ToString() + + If counter < maxItems AndAlso Me.PersonalId.Items.FindByValue(cvalue) Is Nothing Then + + Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalTitleTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalTitleTable.PersonalId) + If _isExpandableNonCompositeForeignKey AndAlso PersonalTitleTable.PersonalId.IsApplyDisplayAs Then + fvalue = PersonalTitleTable.GetDFKA(itemValue, PersonalTitleTable.PersonalId) + End If + If (Not _isExpandableNonCompositeForeignKey) Or (String.IsNullOrEmpty(fvalue)) Then + fvalue = itemValue.Format(PersonalIdTable.PersonalName) + End If + + If fvalue Is Nothing OrElse fvalue.Trim() = "" Then fvalue = cvalue + + If (IsNothing(fvalue)) Then + fvalue = "" + End If + + fvalue = fvalue.Trim() + + If ( fvalue.Length > 50 ) Then + fvalue = fvalue.Substring(0, 50) & "..." + End If + + Dim dupItem As ListItem = Me.PersonalId.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.PersonalId.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.PersonalId, selectedValue) AndAlso _ + Not SetSelectedDisplayText(Me.PersonalId, selectedValue)Then + + ' construct a whereclause to query a record with PersonalId.PersonalId = selectedValue + Dim filter2 As CompoundFilter = New CompoundFilter(CompoundFilter.CompoundingOperators.And_Operator, Nothing) + Dim whereClause2 As WhereClause = New WhereClause() + filter2.AddFilter(New BaseClasses.Data.ColumnValueFilter(PersonalIdTable.PersonalId, selectedValue, BaseClasses.Data.BaseFilter.ComparisonOperator.EqualsTo, False)) + whereClause2.AddFilter(filter2, CompoundFilter.CompoundingOperators.And_Operator) + + Try + ' Execute the query + Dim rc() As PersonalIdRecord = PersonalIdTable.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 PersonalIdRecord = DirectCast(rc(0), PersonalIdRecord) + ' Create the item and add to the list. + Dim cvalue As String = Nothing + Dim fvalue As String = Nothing + If itemValue.PersonalIdSpecified Then + cvalue = itemValue.PersonalId.ToString() + Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalTitleTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalTitleTable.PersonalId) + If _isExpandableNonCompositeForeignKey AndAlso PersonalTitleTable.PersonalId.IsApplyDisplayAs Then + fvalue = PersonalTitleTable.GetDFKA(itemValue, PersonalTitleTable.PersonalId) + End If + If (Not _isExpandableNonCompositeForeignKey) Or (String.IsNullOrEmpty(fvalue)) Then + fvalue = itemValue.Format(PersonalIdTable.PersonalName) + End If + + If fvalue Is Nothing OrElse fvalue.Trim() = "" Then fvalue = cvalue + Dim newItem As New ListItem(fvalue, cvalue) + Me.PersonalId.Items.Add(newItem) + SetSelectedValue(Me.PersonalId, selectedValue) + End If + End If + Catch + End Try + + End If + + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalTitleRowDeleteButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + If(Not Me.Page.IsPageRefresh) Then + + Dim tc As PersonalTitleTableControl = DirectCast(GetParentControlObject(Me, "PersonalTitleTableControl"), PersonalTitleTableControl) + If Not (IsNothing(tc)) Then + If Not Me.IsNewRecord Then + tc.AddToDeletedRecordIds(DirectCast(Me, PersonalTitleTableControlRow)) + End If + Me.Visible = False + tc.SetFormulaControls() + End If + + End If + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + Protected Overridable Sub PersonalId_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()(PersonalId.ClientID & "_SelectedValue"), String) + Dim displayText As String = CType(Me.Page.Session()(PersonalId.ClientID & "_SelectedDisplayText"), String) + If displayText <> "" AndAlso val <> "" Then + Me.PersonalId.Items.Add(New ListItem(displayText, val)) + Me.PersonalId.SelectedIndex = Me.PersonalId.Items.Count - 1 + Me.Page.Session.Remove(PersonalId.ClientID & "_SelectedValue") + Me.Page.Session.Remove(PersonalId.ClientID & "_SelectedDisplayText") + End If + + + + + End Sub + + Protected Overridable Sub Command_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub CommandDate_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub SkillNo_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub Title_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub TitleDate_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub TitleRank_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("BasePersonalTitleTableControlRow_Rec"), String) + End Get + Set(ByVal value As String) + Me.ViewState("BasePersonalTitleTableControlRow_Rec") = value + End Set + End Property + + Private _DataSource As PersonalTitleRecord + Public Property DataSource() As PersonalTitleRecord + Get + Return Me._DataSource + End Get + + Set(ByVal value As PersonalTitleRecord) + + Me._DataSource = value + End Set + End Property + + + + Private _checkSum As String + Public Overridable Property CheckSum() As String + Get + Return Me._checkSum + End Get + Set(ByVal value As String) + Me._checkSum = value + End Set + End Property + + Private _TotalPages As Integer + Public Property TotalPages() As Integer + Get + Return Me._TotalPages + End Get + Set(ByVal value As Integer) + Me._TotalPages = value + End Set + End Property + + Private _PageIndex As Integer + Public Property PageIndex() As Integer + Get + ' Return the PageIndex + Return Me._PageIndex + End Get + Set(ByVal value As Integer) + Me._PageIndex = value + End Set + End Property + + Private _DisplayLastPage As Boolean + Public Property DisplayLastPage() As Boolean + Get + Return Me._DisplayLastPage + End Get + Set(ByVal value As Boolean) + Me._DisplayLastPage = value + End Set + End Property + + + +#Region "Helper Properties" + + Public ReadOnly Property Command() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Command"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property CommandDate() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "CommandDate"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property PersonalId() As System.Web.UI.WebControls.DropDownList + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalId"), System.Web.UI.WebControls.DropDownList) + End Get + End Property + + Public ReadOnly Property PersonalTitleRecordRowSelection() As System.Web.UI.WebControls.CheckBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalTitleRecordRowSelection"), System.Web.UI.WebControls.CheckBox) + End Get + End Property + + Public ReadOnly Property PersonalTitleRowDeleteButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalTitleRowDeleteButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property SkillNo() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "SkillNo"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property Title() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Title"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property TitleDate() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "TitleDate"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property TitleRank() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "TitleRank"), System.Web.UI.WebControls.TextBox) + 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 PersonalTitleRecord = 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 PersonalTitleRecord + If Not Me.DataSource Is Nothing Then + Return Me.DataSource + End If + + If Not Me.RecordUniqueId Is Nothing Then + + Return PersonalTitleTable.GetRecord(Me.RecordUniqueId, True) + + End If + + ' Localization. + + Throw New Exception(Page.GetResourceValue("Err:RetrieveRec", "Persons")) + + End Function + + Public Shadows ReadOnly Property Page() As BaseApplicationPage + Get + Return DirectCast(MyBase.Page, BaseApplicationPage) + End Get + End Property + +#End Region + +End Class + + + +' Base class for the PersonalTitleTableControl control on the EditPersonalTitleTable page. +' Do not modify this class. Instead override any method in PersonalTitleTableControl. +Public Class BasePersonalTitleTableControl + Inherits Persons.UI.BaseApplicationTableControl + + + + Protected Overridable Sub Control_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Init + + + + ' Setup the filter and search events. + + + + ' Control Initializations. + ' Initialize the table's current sort order. + + If Me.InSession(Me, "Order_By") Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + Me.CurrentSortOrder.Add(PersonalTitleTable.TitleDate, OrderByItem.OrderDir.Asc) + + End If + + + + ' Setup default pagination settings. + + Me.PageSize = CInt(Me.GetFromSession(Me, "Page_Size", "10")) + Me.PageIndex = CInt(Me.GetFromSession(Me, "Page_Index", "0")) + + + + Me.ClearControlsFromSession() + End Sub + + Protected Overridable Sub Control_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load + + SaveControlsToSession_Ajax() + + ' Show confirmation message on Click + Me.PersonalTitleDeleteButton.Attributes.Add("onClick", "return (confirm('" & (CType(Me.Page,BaseApplicationPage)).GetResourceValue("DeleteConfirm", "Persons") & "'));") + + ' Setup the pagination events. + + AddHandler Me.PersonalTitlePagination.FirstPage.Click, AddressOf PersonalTitlePagination_FirstPage_Click + + AddHandler Me.PersonalTitlePagination.LastPage.Click, AddressOf PersonalTitlePagination_LastPage_Click + + AddHandler Me.PersonalTitlePagination.NextPage.Click, AddressOf PersonalTitlePagination_NextPage_Click + + AddHandler Me.PersonalTitlePagination.PageSizeButton.Click, AddressOf PersonalTitlePagination_PageSizeButton_Click + + AddHandler Me.PersonalTitlePagination.PreviousPage.Click, AddressOf PersonalTitlePagination_PreviousPage_Click + + + ' Setup the sorting events. + + AddHandler Me.CommandDateLabel.Click, AddressOf CommandDateLabel_Click + + AddHandler Me.CommandLabel.Click, AddressOf CommandLabel_Click + + AddHandler Me.SkillNoLabel.Click, AddressOf SkillNoLabel_Click + + AddHandler Me.TitleDateLabel1.Click, AddressOf TitleDateLabel1_Click + + AddHandler Me.TitleLabel.Click, AddressOf TitleLabel_Click + + AddHandler Me.TitleRankLabel.Click, AddressOf TitleRankLabel_Click + + ' Setup the button events. + + AddHandler Me.PersonalTitleAddButton.Click, AddressOf PersonalTitleAddButton_Click + + AddHandler Me.PersonalTitleDeleteButton.Click, AddressOf PersonalTitleDeleteButton_Click + + AddHandler Me.PersonalTitleEditButton.Click, AddressOf PersonalTitleEditButton_Click + + AddHandler Me.PersonalTitleRefreshButton.Click, AddressOf PersonalTitleRefreshButton_Click + + AddHandler Me.PersonalTitleResetButton.Click, AddressOf PersonalTitleResetButton_Click + + AddHandler Me.PersonalTitleSaveButton.Click, AddressOf PersonalTitleSaveButton_Click + + Me.PersonalTitleSaveButton.Attributes.Add("onclick", "SubmitHRefOnce(this, """ & Me.Page.GetResourceValue("Txt:SaveRecord", "Persons") & """);") + + + ' Setup events for others + + End Sub + + + Public Overridable Sub LoadData() + + ' Read data from database. Returns an array of records that can be assigned + ' to the DataSource table control property. + Try + Dim joinFilter As CompoundFilter = CreateCompoundJoinFilter() + + ' The WHERE clause will be empty when displaying all records in table. + Dim wc As WhereClause = CreateWhereClause() + If wc IsNot Nothing AndAlso Not wc.RunQuery Then + ' Initialize an empty array of records + Dim alist As New ArrayList(0) + Me.DataSource = DirectCast(alist.ToArray(GetType(PersonalTitleRecord)), PersonalTitleRecord()) + ' Add records to the list if needed. + Me.AddNewRecords() + Me._TotalRecords = 0 + Me._TotalPages = 0 + Return + End If + + ' Call OrderBy to determine the order - either use the order defined + ' on the Query Wizard, or specified by user (by clicking on column heading) + Dim orderBy As OrderBy = CreateOrderBy() + + ' Get the pagesize from the pagesize control. + Me.GetPageSize() + + If Me.DisplayLastPage Then + Dim totalRecords As Integer = If(Me._TotalRecords < 0, PersonalTitleTable.GetRecordCount(CreateCompoundJoinFilter(), CreateWhereClause()), Me._TotalRecords) + + Dim totalPages As Integer = CInt(Math.Ceiling(totalRecords / Me.PageSize)) + + Me.PageIndex = totalPages - 1 + End If + + ' Make sure PageIndex (current page) and PageSize are within bounds. + If Me.PageIndex < 0 Then + Me.PageIndex = 0 + End If + If Me.PageSize < 1 Then + Me.PageSize = 1 + End If + + ' Retrieve the records and set the table DataSource. + ' Only PageSize records are fetched starting at PageIndex (zero based). + If Me.AddNewRecord > 0 Then + ' Make sure to preserve the previously entered data on new rows. + Dim postdata As New ArrayList + For Each rc As PersonalTitleTableControlRow In Me.GetRecordControls() + If Not rc.IsNewRecord Then + rc.DataSource = rc.GetRecord() + rc.GetUIData() + postdata.Add(rc.DataSource) + UIData.Add(rc.PreservedUIData()) + End If + Next + Me.DataSource = DirectCast(postdata.ToArray(GetType(PersonalTitleRecord)), PersonalTitleRecord()) + Else ' Get the records from the database + Me.DataSource = PersonalTitleTable.GetRecords(joinFilter, wc, orderBy, Me.PageIndex, Me.PageSize) + + End If + + ' if the datasource contains no records contained in database, then load the last page. + If (DbUtils.GetCreatedRecords(Me.DataSource).Length = 0 AndAlso Not Me.DisplayLastPage) Then + Me.DisplayLastPage = True + LoadData() + Else + + ' Add any new rows desired by the user. + Me.AddNewRecords() + + ' Turn off the ToggleAll checkbox + Me.PersonalTitleToggleAll.Checked = False + + + ' Initialize the page and grand totals. now + + End If + + Catch ex As Exception + ' Report the error message to the end user + Dim msg As String = ex.Message + If ex.InnerException IsNot Nothing Then + msg = msg & " InnerException: " & ex.InnerException.Message + End If + Throw New Exception(msg, ex.InnerException) + End Try + End Sub + + + + + Public Overrides Sub DataBind() + ' The DataBind method binds the user interface controls to the values + ' from the database record for each row in the table. To do this, it calls the + ' DataBind for each of the rows. + ' DataBind also populates any filters above the table, and sets the pagination + ' control to the correct number of records and the current page number. + + MyBase.DataBind() + + ' Make sure that the DataSource is initialized. + If Me.DataSource Is Nothing Then + Return + End If + + 'LoadData for DataSource for chart and report if they exist + + ' Improve performance by prefetching display as records. + Me.PreFetchForeignKeyValues() + + ' Setup the pagination controls. + BindPaginationControls() + + + + ' Bind the repeater with the list of records to expand the UI. + Dim rep As System.Web.UI.WebControls.Repeater = CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalTitleTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return + rep.DataSource = DataSource() + rep.DataBind() + + Dim index As Integer = 0 + For Each repItem As System.Web.UI.WebControls.RepeaterItem In rep.Items + ' Loop through all rows in the table, set its DataSource and call DataBind(). + Dim recControl As PersonalTitleTableControlRow = DirectCast(repItem.FindControl("PersonalTitleTableControlRow"), PersonalTitleTableControlRow) + recControl.DataSource = Me.DataSource(index) + If Me.UIData.Count > index Then + recControl.PreviousUIData = Me.UIData(index) + End If + recControl.DataBind() + recControl.Visible = Not Me.InDeletedRecordIds(recControl) + + index += 1 + Next + + + + + ' Call the Set methods for each controls on the panel + + SetCommandDateLabel() + SetCommandLabel() + + + + + + + + SetPersonalTitleTableControlCollapsibleRegion() + SetPersonalTitleTableControlIcon() + SetPersonalTitleTableControlPanelExtender() + + + SetSkillNoLabel() + SetTitleDateLabel1() + SetTitleLabel() + SetTitleRankLabel() + ' setting the state of expand or collapse alternative rows + + + ' Load data for each record and table UI control. + ' Ordering is important because child controls get + ' their parent ids from their parent UI controls. + + + ' this method calls the set method for controls with special formula like running total, sum, rank, etc + SetFormulaControls() + End Sub + + Public Overridable Sub SetFormulaControls() + ' this method calls Set methods for the control that has special formula + + + + End Sub + + + Public Sub PreFetchForeignKeyValues() + If (IsNothing(Me.DataSource)) + Return + End If + + Me.Page.PregetDfkaRecords(PersonalTitleTable.PersonalId, Me.DataSource) + + End Sub + + + Public Overridable Sub RegisterPostback() + + Me.Page.RegisterPostBackTrigger(MiscUtils.FindControlRecursively(Me,"PersonalTitleSaveButton")) + + + End Sub + + Public EvaluateFormulaDelegate As BaseClasses.Data.DataSource.EvaluateFormulaDelegate = New BaseClasses.Data.DataSource.EvaluateFormulaDelegate(AddressOf Me.EvaluateFormula) + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean, ByVal e as FormulaEvaluator) As String + If e Is Nothing + e = New FormulaEvaluator() + End If + + e.Variables.Clear() + + + ' add variables for formula evaluation + If variables IsNot Nothing Then + Dim enumerator As System.Collections.Generic.IEnumerator(Of System.Collections.Generic.KeyValuePair(Of String, Object)) = variables.GetEnumerator() + While enumerator.MoveNext() + e.Variables.Add(enumerator.Current.Key, enumerator.Current.Value) + End While + End If + + If includeDS + + End If + + ' All variables referred to in the formula are expected to be + ' properties of the DataSource. For example, referring to + ' UnitPrice as a variable will refer to DataSource.UnitPrice + e.DataSource = dataSourceForEvaluate + + ' Define the calling control. This is used to add other + ' related table and record controls as variables. + e.CallingControl = Me + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + + If Not String.IsNullOrEmpty(format) AndAlso (String.IsNullOrEmpty(formula) OrElse formula.IndexOf("Format(") < 0) Then + Return FormulaUtils.Format(resultObj, format) + Else + Return resultObj.ToString() + End If + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format,variables ,includeDS, Nothing) + End Function + + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object)) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format, variables ,True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, format, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal e as FormulaEvaluator) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, variables, True, e) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal includeDS as Boolean) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, includeDS, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, True, Nothing) + End Function + + + + + Public Overridable Sub ResetControl() + + Me.CurrentSortOrder.Reset() + If (Me.InSession(Me, "Order_By")) Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + Me.CurrentSortOrder.Add(PersonalTitleTable.TitleDate, OrderByItem.OrderDir.Asc) + + End If + + Me.PageIndex = 0 + End Sub + + Protected Overridable Sub BindPaginationControls() + ' Setup the pagination controls. + + ' Bind the pagination labels. + + If DbUtils.GetCreatedRecords(Me.DataSource).Length > 0 Then + + Me.PersonalTitlePagination.CurrentPage.Text = (Me.PageIndex + 1).ToString() + Else + Me.PersonalTitlePagination.CurrentPage.Text = "0" + End If + Me.PersonalTitlePagination.PageSize.Text = Me.PageSize.ToString() + Me.PersonalTitlePagination.TotalItems.Text = Me.TotalRecords.ToString() + Me.PersonalTitlePagination.TotalPages.Text = Me.TotalPages.ToString() + + ' Bind the buttons for PersonalTitleTableControl pagination. + + Me.PersonalTitlePagination.FirstPage.Enabled = Not (Me.PageIndex = 0) + If Me._TotalPages < 0 Then ' if the total pages is not determined yet, enable last and next buttons + Me.PersonalTitlePagination.LastPage.Enabled = True + ElseIf Me._TotalPages = 0 ' if the total pages is determined and it is 0, enable last and next buttons + Me.PersonalTitlePagination.LastPage.Enabled = False + Else ' if the total pages is the last page, disable last and next buttons + Me.PersonalTitlePagination.LastPage.Enabled = Not (Me.PageIndex = Me.TotalPages - 1) + End If + + If Me._TotalPages < 0 Then ' if the total pages is not determined yet, enable last and next buttons + Me.PersonalTitlePagination.NextPage.Enabled = True + ElseIf Me._TotalPages = 0 ' if the total pages is determined and it is 0, enable last and next buttons + Me.PersonalTitlePagination.NextPage.Enabled = False + Else ' if the total pages is the last page, disable last and next buttons + Me.PersonalTitlePagination.NextPage.Enabled = Not (Me.PageIndex = Me.TotalPages - 1) + End If + + Me.PersonalTitlePagination.PreviousPage.Enabled = Not (Me.PageIndex = 0) + + + End Sub + + Public Overridable Sub SaveData() + ' Save the data from the entire table. Calls each row's Save Data + ' to save their data. This function is called by the Click handler of the + ' Save button. The button handler should Start/Commit/End a transaction. + + Dim recCtl As PersonalTitleTableControlRow + For Each recCtl In Me.GetRecordControls() + + If Me.InDeletedRecordIds(recCtl) Then + ' Delete any pending deletes. + recCtl.Delete() + Else + If recCtl.Visible Then + recCtl.SaveData() + End If + End If + + Next + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + ' Set IsNewRecord to False for all records - since everything has been saved and is no longer "new" + For Each recCtl In Me.GetRecordControls() + recCtl.IsNewRecord = False + Next + + + ' Set DeletedRecordsIds to Nothing since we have deleted all pending deletes. + Me.DeletedRecordIds = Nothing + + End Sub + + Public Overridable Function CreateCompoundJoinFilter() As CompoundFilter + Dim jFilter As CompoundFilter = New CompoundFilter() + + Return jFilter + + End Function + + + Public Overridable Function CreateOrderBy() As OrderBy + ' The CurrentSortOrder is initialized to the sort order on the + ' Query Wizard. It may be modified by the Click handler for any of + ' the column heading to sort or reverse sort by that column. + ' You can add your own sort order, or modify it on the Query Wizard. + Return Me.CurrentSortOrder + End Function + + Public Overridable Function CreateWhereClause() As WhereClause + 'This CreateWhereClause is used for loading the data. + PersonalTitleTable.Instance.InnerFilter = Nothing + Dim wc As WhereClause = New WhereClause() + + ' Compose the WHERE clause consiting of: + ' 1. Static clause defined at design time. + ' 2. User selected search criteria. + ' 3. User selected filter criteria. + + + ' Get the static clause defined at design time on the Table Panel Wizard + Dim qc As WhereClause = Me.CreateQueryClause() + If Not(IsNothing(qc)) Then + wc.iAND(qc) + End If + + Return wc + End Function + + + Public Overridable Function CreateWhereClause(ByVal searchText as String, ByVal fromSearchControl as String, ByVal AutoTypeAheadSearch as String, ByVal AutoTypeAheadWordSeparators as String) As WhereClause + ' This CreateWhereClause is used for loading list of suggestions for Auto Type-Ahead feature. + PersonalTitleTable.Instance.InnerFilter = Nothing + Dim wc As WhereClause = New WhereClause() + + ' Compose the WHERE clause consiting of: + ' 1. Static clause defined at design time. + ' 2. User selected search criteria. + ' 3. User selected filter criteria. + + Dim appRelativeVirtualPath As String = CType(HttpContext.Current.Session("AppRelativeVirtualPath"), String) + + ' Get the static clause defined at design time on the Table Panel Wizard + Dim qc As WhereClause = Me.CreateQueryClause() + If Not(IsNothing(qc)) Then + wc.iAND(qc) + End If + + ' Adds clauses if values are selected in Filter controls which are configured in the page. + + + Return wc + End Function + + Protected Overridable Function CreateQueryClause() As WhereClause + ' Create a where clause for the Static clause defined at design time. + Dim filter As CompoundFilter = New CompoundFilter(CompoundFilter.CompoundingOperators.And_Operator, Nothing) + Dim whereClause As WhereClause = New WhereClause() + + filter.AddFilter(New BaseClasses.Data.SignedInUserFilter(BaseClasses.Data.BaseTable.CreateInstance("Persons.Business.PersonalTitleTable, App_Code").TableDefinition.ColumnList.GetByUniqueName("PersonalTitle_.PersonalId"), New BaseClasses.Data.IdentifierAliasInfo("PersonalTitle_", Nothing), BaseClasses.Data.BaseFilter.ComparisonOperator.EqualsTo, False)) + + whereClause.AddFilter(filter, CompoundFilter.CompoundingOperators.And_Operator) + + Return whereClause + + End Function + + + Public Overridable Function FormatSuggestions(ByVal prefixText As String, ByVal resultItem As String, _ + ByVal columnLength As Integer, ByVal AutoTypeAheadDisplayFoundText As String, _ + ByVal autoTypeAheadSearch As String, ByVal AutoTypeAheadWordSeparators As String, _ + ByVal resultList As ArrayList) As Boolean + + 'Formats the resultItem and adds it to the list of suggestions. + Dim index As Integer = resultItem.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture).IndexOf(prefixText.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture)) + Dim itemToAdd As String = "" + Dim isFound As Boolean = False + Dim isAdded As Boolean = False + ' Get the index where prfixt is at the beginning of resultItem. If not found then, index of word which begins with prefixText. + If InvariantLCase(autoTypeAheadSearch).equals("wordsstartingwithsearchstring") And Not index = 0 Then + ' Expression to find word which contains AutoTypeAheadWordSeparators followed by prefixText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex( AutoTypeAheadWordSeparators + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + If regex1.IsMatch(resultItem) Then + index = regex1.Match(resultItem).Index + isFound = True + End If + ' If the prefixText is found immediatly after white space then starting of the word is found so don not search any further + If not resultItem(index).ToString() = " " Then + ' Expression to find beginning of the word which contains AutoTypeAheadWordSeparators followed by prefixText + Dim regex As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\\S*" + AutoTypeAheadWordSeparators + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + If regex.IsMatch(resultItem) Then + index = regex.Match(resultItem).Index + isFound = True + End If + End If + End If + + ' If autoTypeAheadSearch value is wordsstartingwithsearchstring then, extract the substring only if the prefixText is found at the + ' beginning of the resultItem (index = 0) or a word in resultItem is found starts with prefixText. + If index = 0 Or isFound Or InvariantLCase(autoTypeAheadSearch).Equals("anywhereinstring") then + If InvariantLCase(AutoTypeAheadDisplayFoundText).equals("atbeginningofmatchedstring") Then + ' Expression to find beginning of the word which contains prefixText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\\S*" + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + ' Find the beginning of the word which contains prefexText + If (StringUtils.InvariantLCase(autoTypeAheadSearch).Equals("anywhereinstring") AndAlso regex1.IsMatch(resultItem)) Then + index = regex1.Match(resultItem).Index + isFound = True + End If + ' Display string from the index till end of the string if sub string from index till end is less than columnLength value. + If Len(resultItem) - index <= columnLength Then + If index = 0 Then + itemToAdd = resultItem + Else + itemToAdd = "..." & resultItem.Substring(index, Len(resultItem) - index) + End If + Else + If index = 0 Then + itemToAdd = resultItem.Substring(index, (columnLength - 3)) & "..." + Else + 'Truncate the string to show only columnLength - 6 characters as begining and trailing "..." has to be appended. + itemToAdd = "..." & resultItem.Substring(index , columnLength - 6) & "..." + End If + End If + ElseIf InvariantLCase(AutoTypeAheadDisplayFoundText).equals("inmiddleofmatchedstring") Then + Dim subStringBeginIndex As Integer = CType(columnLength/2, Integer) + If Len(resultItem) <= columnLength Then + itemToAdd = resultItem + Else + ' Sanity check at end of the string + If index + Len(prefixText) = columnLength Then + itemToAdd = "..." & resultItem.Substring(index-columnLength,index) + ElseIf Len(resultItem) - index < subStringBeginIndex Then + ' Display string from the end till columnLength value if, index is closer to the end of the string. + itemToAdd = "..." & resultItem.Substring(Len(resultItem)-columnLength,Len(resultItem)) + ElseIf index <= subStringBeginIndex Then + ' Sanity chet at beginning of the string + itemToAdd = resultItem.Substring(0, columnLength) & "..." + Else + ' Display string containing text before the prefixText occures and text after the prefixText + itemToAdd = "..." & resultItem.Substring(index - subStringBeginIndex, columnLength) & "..." + End If + End If + ElseIf InvariantLCase(AutoTypeAheadDisplayFoundText).equals("atendofmatchedstring") Then + ' Expression to find ending of the word which contains prefexText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\s", System.Text.RegularExpressions.RegexOptions.IgnoreCase) + ' Find the ending of the word which contains prefexText + If regex1.IsMatch(resultItem, index + 1) Then + index = regex1.Match(resultItem, index + 1).Index + Else + ' If the word which contains prefexText is the last word in string, regex1.IsMatch returns false. + index = resultItem.Length + End If + If index > Len(resultItem) Then + index = Len(resultItem) + End If + ' If text from beginning of the string till index is less than columnLength value then, display string from the beginning till index. + If index <= columnLength Then + if index = Len(resultItem) Then 'Make decision to append "..." + itemToAdd = resultItem.Substring(0,index) + Else + itemToAdd = resultItem.Substring(0,index) & "..." + End If + Else + If index = Len(resultItem) Then + itemToAdd = "..." & resultItem.Substring(index - (columnLength - 3), (columnLength - 3)) + Else + 'Truncate the string to show only columnLength - 6 characters as begining and trailing "..." has to be appended. + itemToAdd = "..." & resultItem.Substring(index - (columnLength - 6), columnLength - 6) & "..." + End If + End If + End If + + ' Remove newline character from itemToAdd + Dim prefixTextIndex As Integer = itemToAdd.IndexOf(prefixText, StringComparison.CurrentCultureIgnoreCase) + ' If itemToAdd contains any newline after the search text then show text only till newline + Dim regex2 As System.Text.RegularExpressions.Regex = New System.Text.RegularExpressions.Regex("(" & vbCrLf & "|" & vbLf & ")", System.Text.RegularExpressions.RegexOptions.IgnoreCase) + Dim newLineIndexAfterPrefix As Integer = -1 + If regex2.IsMatch(itemToAdd, prefixTextIndex) Then + newLineIndexAfterPrefix = regex2.Match(itemToAdd, prefixTextIndex).Index + End If + If (newLineIndexAfterPrefix > -1) Then + If itemToAdd.EndsWith("...") Then + itemToAdd = (itemToAdd.Substring(0, newLineIndexAfterPrefix) + "...") + Else + itemToAdd = itemToAdd.Substring(0, newLineIndexAfterPrefix) + End If + End If + ' If itemToAdd contains any newline before search text then show text which comes after newline + Dim regex3 As System.Text.RegularExpressions.Regex = New System.Text.RegularExpressions.Regex("(" & vbCrLf & "|" & vbLf & ")", (System.Text.RegularExpressions.RegexOptions.IgnoreCase Or System.Text.RegularExpressions.RegexOptions.RightToLeft)) + Dim newLineIndexBeforePrefix As Integer = -1 + If regex3.IsMatch(itemToAdd, prefixTextIndex) Then + newLineIndexBeforePrefix = regex3.Match(itemToAdd, prefixTextIndex).Index + End If + If (newLineIndexBeforePrefix > -1) Then + If itemToAdd.StartsWith("...") Then + itemToAdd = ("..." + itemToAdd.Substring((newLineIndexBeforePrefix + regex3.Match(itemToAdd, prefixTextIndex).Length))) + Else + itemToAdd = itemToAdd.Substring((newLineIndexBeforePrefix + regex3.Match(itemToAdd, prefixTextIndex).Length)) + End If + End If + + If Not itemToAdd is nothing AndAlso Not resultList.Contains(itemToAdd) Then + + resultList.Add(itemToAdd) + + isAdded = true + End If + End If + Return isAdded + End Function + + + Protected Overridable Sub GetPageSize() + + If Me.PersonalTitlePagination.PageSize.Text.Trim <> "" Then + Try + 'Me.PageSize = Integer.Parse(Me.PersonalTitlePagination.PageSize.Text) + Catch ex As Exception + End Try + End If + End Sub + + Protected Overridable Sub AddNewRecords() + + Dim newRecordList As ArrayList = New ArrayList() + + Dim newUIDataList As System.Collections.Generic.List(Of Hashtable) = New System.Collections.Generic.List(Of Hashtable)() + + ' Loop though all the record controls and if the record control + ' does not have a unique record id set, then create a record + ' and add to the list. + If Not Me.ResetData Then + Dim rep As System.Web.UI.WebControls.Repeater = CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalTitleTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return + + Dim repItem As System.Web.UI.WebControls.RepeaterItem + For Each repItem In rep.Items + ' Loop through all rows in the table, set its DataSource and call DataBind(). + + Dim recControl As PersonalTitleTableControlRow = DirectCast(repItem.FindControl("PersonalTitleTableControlRow"), PersonalTitleTableControlRow) + + If recControl.Visible AndAlso recControl.IsNewRecord() Then + + Dim rec As PersonalTitleRecord = New PersonalTitleRecord() + + If recControl.Command.Text <> "" Then + rec.Parse(recControl.Command.Text, PersonalTitleTable.Command) + End If + If recControl.CommandDate.Text <> "" Then + rec.Parse(recControl.CommandDate.Text, PersonalTitleTable.CommandDate) + End If + If MiscUtils.IsValueSelected(recControl.PersonalId) Then + rec.Parse(recControl.PersonalId.SelectedItem.Value, PersonalTitleTable.PersonalId) + End If + If recControl.SkillNo.Text <> "" Then + rec.Parse(recControl.SkillNo.Text, PersonalTitleTable.SkillNo) + End If + If recControl.Title.Text <> "" Then + rec.Parse(recControl.Title.Text, PersonalTitleTable.Title) + End If + If recControl.TitleDate.Text <> "" Then + rec.Parse(recControl.TitleDate.Text, PersonalTitleTable.TitleDate) + End If + If recControl.TitleRank.Text <> "" Then + rec.Parse(recControl.TitleRank.Text, PersonalTitleTable.TitleRank) + End If + newUIDataList.Add(recControl.PreservedUIData()) + newRecordList.Add(rec) + End If + Next + End If + + + ' Add any new record to the list. + Dim index As Integer = 0 + For index = 1 To Me.AddNewRecord + + newRecordList.Insert(0, New PersonalTitleRecord()) + newUIDataList.Insert(0, New Hashtable()) + + Next + Me.AddNewRecord = 0 + + ' Finally, add any new records to the DataSource. + If newRecordList.Count > 0 Then + + Dim finalList As ArrayList = New ArrayList(Me.DataSource) + finalList.InsertRange(0, newRecordList) + + Me.DataSource = DirectCast(finalList.ToArray(GetType(PersonalTitleRecord)), PersonalTitleRecord()) + + End If + + ' Add the existing UI data to this hash table + If newUIDataList.Count > 0 Then + Me.UIData.InsertRange(0, newUIDataList) + End If + + End Sub + + + Public Sub AddToDeletedRecordIds(ByVal rec As PersonalTitleTableControlRow) + If rec.IsNewRecord() Then + Return + End If + + If Not Me.DeletedRecordIds Is Nothing AndAlso Me.DeletedRecordIds.Trim <> "" Then + Me.DeletedRecordIds &= "," + End If + + Me.DeletedRecordIds &= "[" & rec.RecordUniqueId & "]" + End Sub + + Protected Overridable Function InDeletedRecordIds(ByVal rec As PersonalTitleTableControlRow) As Boolean + If Me.DeletedRecordIds Is Nothing OrElse Me.DeletedRecordIds.Trim = "" Then + Return False + End If + + Return Me.DeletedRecordIds.IndexOf("[" & rec.RecordUniqueId & "]") >= 0 + End Function + + Private _DeletedRecordIds As String + Public Property DeletedRecordIds() As String + Get + Return Me._DeletedRecordIds + End Get + Set(ByVal value As String) + Me._DeletedRecordIds = value + End Set + End Property + + + ' Create Set, WhereClause, and Populate Methods + + Public Overridable Sub SetCommandDateLabel() + + End Sub + + Public Overridable Sub SetCommandLabel() + + End Sub + + Public Overridable Sub SetPersonalTitleTableControlCollapsibleRegion() + + End Sub + + Public Overridable Sub SetPersonalTitleTableControlIcon() + + End Sub + + Public Overridable Sub SetPersonalTitleTableControlPanelExtender() + + End Sub + + Public Overridable Sub SetSkillNoLabel() + + End Sub + + Public Overridable Sub SetTitleDateLabel1() + + End Sub + + Public Overridable Sub SetTitleLabel() + + End Sub + + Public Overridable Sub SetTitleRankLabel() + + 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. + Dim added As Boolean = Me.AddNewRecord > 0 + Me.LoadData() + Me.DataBind() + + If added Then + Me.SetFocusToAddedRow() + End If + + End If + + + + Catch ex As Exception + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + Finally + DbUtils.EndTransaction + End Try + End Sub + + 'this function sets focus to the first editable element in the new added row in the editable table + Protected Overridable Sub SetFocusToAddedRow() + Dim rep As System.Web.UI.WebControls.Repeater = CType(Me.FindControl("PersonalTitleTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing OrElse rep.Items.Count = 0 Then Return + Dim repItem As System.Web.UI.WebControls.RepeaterItem + For Each repItem In rep.Items + 'Load scripts to table rows + Me.Page.LoadFocusScripts(repItem) + Dim recControl As PersonalTitleTableControlRow = DirectCast(repItem.FindControl("PersonalTitleTableControlRow"), PersonalTitleTableControlRow) + If recControl.IsNewRecord Then + For Each field As Control In recControl.Controls + If field.Visible AndAlso Me.Page.IsControlEditable(field, False) Then + 'set focus on the first editable field in the new row + field.Focus() + Dim updPan As UpdatePanel = DirectCast(Me.Page.FindControlRecursively("UpdatePanel1"), UpdatePanel) + If Not updPan Is Nothing Then updPan.Update() + Return + End If + Next + Return + End If + Next + End Sub + + + Protected Overrides Sub SaveControlsToSession() + MyBase.SaveControlsToSession() + + ' Save filter controls to values to session. + + + 'Save pagination state to session. + + + + ' Save table control properties to the session. + If Not Me.CurrentSortOrder Is Nothing Then + Me.SaveToSession(Me, "Order_By", Me.CurrentSortOrder.ToXmlString()) + End If + + Me.SaveToSession(Me, "Page_Index", Me.PageIndex.ToString()) + Me.SaveToSession(Me, "Page_Size", Me.PageSize.ToString()) + + Me.SaveToSession(Me, "DeletedRecordIds", Me.DeletedRecordIds) + + End Sub + + Protected Sub SaveControlsToSession_Ajax() + ' Save filter controls to values to session. + + HttpContext.Current.Session("AppRelativeVirtualPath") = Me.Page.AppRelativeVirtualPath + + End Sub + + Protected Overrides Sub ClearControlsFromSession() + MyBase.ClearControlsFromSession() + + ' Clear filter controls values from the session. + + + ' Clear pagination state from session. + + + + ' Clear table properties from the session. + Me.RemoveFromSession(Me, "Order_By") + Me.RemoveFromSession(Me, "Page_Index") + Me.RemoveFromSession(Me, "Page_Size") + + Me.RemoveFromSession(Me, "DeletedRecordIds") + + End Sub + + Protected Overrides Sub LoadViewState(ByVal savedState As Object) + MyBase.LoadViewState(savedState) + + Dim orderByStr As String = CType(ViewState("PersonalTitleTableControl_OrderBy"), String) + + If orderByStr IsNot Nothing AndAlso orderByStr.Trim <> "" Then + Me.CurrentSortOrder = BaseClasses.Data.OrderBy.FromXmlString(orderByStr) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + End If + + Dim pageIndex As String = CType(ViewState("Page_Index"), String) + If pageIndex IsNot Nothing Then + Me.PageIndex = CInt(pageIndex) + End If + + Dim pageSize As String = CType(ViewState("Page_Size"), String) + If Not pageSize Is Nothing Then + Me.PageSize = CInt(pageSize) + End If + + + + ' Load view state for pagination control. + + Me.DeletedRecordIds = CType(Me.ViewState("DeletedRecordIds"), String) + + End Sub + + Protected Overrides Function SaveViewState() As Object + + If Me.CurrentSortOrder IsNot Nothing Then + Me.ViewState("PersonalTitleTableControl_OrderBy") = Me.CurrentSortOrder.ToXmlString() + End If + + Me.ViewState("Page_Index") = Me.PageIndex + Me.ViewState("Page_Size") = Me.PageSize + + Me.ViewState("DeletedRecordIds") = Me.DeletedRecordIds + + + ' Load view state for pagination control. + + + Return MyBase.SaveViewState() + End Function + + ' Generate the event handling functions for pagination events. + + ' event handler for ImageButton + Public Overridable Sub PersonalTitlePagination_FirstPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.PageIndex = 0 + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalTitlePagination_LastPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.DisplayLastPage = True + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalTitlePagination_NextPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.PageIndex += 1 + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for LinkButton + Public Overridable Sub PersonalTitlePagination_PageSizeButton_Click(ByVal sender As Object, ByVal args As EventArgs) + + Try + + Me.DataChanged = True + + Me.PageSize = Integer.Parse(Me.PersonalTitlePagination.PageSize.Text) + + Me.PageIndex = Integer.Parse(Me.PersonalTitlePagination.CurrentPage.Text) - 1 + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalTitlePagination_PreviousPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + If Me.PageIndex > 0 Then + Me.PageIndex -= 1 + Me.DataChanged = True + End If + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + + ' Generate the event handling functions for sorting events. + + Public Overridable Sub CommandDateLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by CommandDate when clicked. + + ' Get previous sorting state for CommandDate. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalTitleTable.CommandDate) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for CommandDate. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalTitleTable.CommandDate, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by CommandDate, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub CommandLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by Command when clicked. + + ' Get previous sorting state for Command. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalTitleTable.Command) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for Command. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalTitleTable.Command, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by Command, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub SkillNoLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by SkillNo when clicked. + + ' Get previous sorting state for SkillNo. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalTitleTable.SkillNo) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for SkillNo. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalTitleTable.SkillNo, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by SkillNo, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub TitleDateLabel1_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by TitleDate when clicked. + + ' Get previous sorting state for TitleDate. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalTitleTable.TitleDate) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for TitleDate. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalTitleTable.TitleDate, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by TitleDate, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub TitleLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by Title when clicked. + + ' Get previous sorting state for Title. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalTitleTable.Title) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for Title. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalTitleTable.Title, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by Title, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub TitleRankLabel_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by TitleRank when clicked. + + ' Get previous sorting state for TitleRank. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalTitleTable.TitleRank) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for TitleRank. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(PersonalTitleTable.TitleRank, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by TitleRank, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + + ' Generate the event handling functions for button events. + + ' event handler for ImageButton + Public Overridable Sub PersonalTitleAddButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + Me.AddNewRecord = 1 + Me.DataChanged = True + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalTitleDeleteButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + If(Not Me.Page.IsPageRefresh) Then + + Me.DeleteSelectedRecords(True) + Me.SetFormulaControls() + + + End If + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalTitleEditButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + ' The redirect URL is set on the Properties, Custom Properties or Actions. + ' The ModifyRedirectURL call resolves the parameters before the + ' Response.Redirect redirects the page to the URL. + ' Any code after the Response.Redirect call will not be executed, since the page is + ' redirected to the URL. + + + Dim url As String = "../Shared/ConfigureEditRecord.aspx" + + Dim shouldRedirect As Boolean = True + Dim TargetKey As String = Nothing + Dim DFKA As String = TargetKey + Dim id As String = DFKA + Dim value As String = id + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + url = Me.ModifyRedirectUrl(url, "",False) + url = Me.Page.ModifyRedirectUrl(url, "",False) + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + shouldRedirect = False + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + If shouldRedirect Then + Me.Page.ShouldSaveControlsToSession = True + Me.Page.Response.Redirect(url) + ElseIf Not TargetKey Is Nothing AndAlso _ + Not shouldRedirect Then + Me.Page.ShouldSaveControlsToSession = True + Me.Page.CloseWindow(True) + + End If + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalTitleRefreshButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Dim PersonalTitleTableControlObj as PersonalTitleTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalTitleTableControl"), PersonalTitleTableControl) + PersonalTitleTableControlObj.ResetData = True + + PersonalTitleTableControlObj.RemoveFromSession(PersonalTitleTableControlObj, "DeletedRecordIds") + PersonalTitleTableControlObj.DeletedRecordIds = Nothing + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalTitleResetButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.CurrentSortOrder.Reset() + If Me.InSession(Me, "Order_By") Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + Me.CurrentSortOrder.Add(PersonalTitleTable.TitleDate, OrderByItem.OrderDir.Asc) + + + End If + + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub PersonalTitleSaveButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + + If (Not Me.Page.IsPageRefresh) Then + Me.SaveData() + End If + + Me.Page.CommitTransaction(sender) + ' Set IsNewRecord to False for all records - since everything has been saved and is no longer "new" + Dim recCtl As PersonalTitleTableControlRow + For Each recCtl in Me.GetRecordControls() + + recCtl.IsNewRecord = False + Next + + + ' Set DeletedRecordsIds to Nothing since we have deleted all pending deletes. + + Me.DeletedRecordIds = Nothing + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + + + ' Generate the event handling functions for filter and search events. + + + ' Generate the event handling functions for others + + + Private _UIData As New System.Collections.Generic.List(Of Hashtable) + Public Property UIData() As System.Collections.Generic.List(Of Hashtable) + Get + Return Me._UIData + End Get + Set(ByVal value As System.Collections.Generic.List(Of Hashtable)) + Me._UIData = value + End Set + End Property + + ' pagination properties + Protected _PageSize As Integer + Public Property PageSize() As Integer + Get + Return Me._PageSize + End Get + Set(ByVal value As Integer) + Me._PageSize = value + End Set + End Property + + Protected _PageIndex As Integer + Public Property PageIndex() As Integer + Get + ' Return the PageIndex + Return Me._PageIndex + End Get + Set(ByVal value As Integer) + Me._PageIndex = value + End Set + End Property + + Protected _TotalRecords As Integer = -1 + Public Property TotalRecords() As Integer + Get + If _TotalRecords < 0 + _TotalRecords = PersonalTitleTable.GetRecordCount(CreateCompoundJoinFilter(), CreateWhereClause()) + End If + Return Me._TotalRecords + End Get + Set(ByVal value As Integer) + If Me.PageSize > 0 Then + + Me.TotalPages = CInt(Math.Ceiling(value / Me.PageSize)) + + End If + Me._TotalRecords = value + End Set + End Property + + + + Protected _TotalPages As Integer = -1 + Public Property TotalPages() As Integer + Get + If _TotalPages < 0 Then + + Me.TotalPages = CInt(Math.Ceiling(TotalRecords / Me.PageSize)) + + End If + Return Me._TotalPages + End Get + Set(ByVal value As Integer) + Me._TotalPages = value + End Set + End Property + + Protected _DisplayLastPage As Boolean + Public Property DisplayLastPage() As Boolean + Get + Return Me._DisplayLastPage + End Get + Set(ByVal value As Boolean) + Me._DisplayLastPage = value + End Set + End Property + + Private _DataChanged As Boolean = False + Public Property DataChanged() As Boolean + Get + Return Me._DataChanged + End Get + Set(ByVal value As Boolean) + Me._DataChanged = value + End Set + End Property + + Private _ResetData As Boolean = False + Public Property ResetData() As Boolean + Get + Return Me._ResetData + End Get + Set(ByVal value As Boolean) + Me._ResetData = value + End Set + End Property + + Private _AddNewRecord As Integer = 0 + Public Property AddNewRecord() As Integer + Get + Return Me._AddNewRecord + End Get + Set(ByVal value As Integer) + Me._AddNewRecord = value + End Set + End Property + + + Private _CurrentSortOrder As OrderBy = Nothing + Public Property CurrentSortOrder() As OrderBy + Get + Return Me._CurrentSortOrder + End Get + Set(ByVal value As BaseClasses.Data.OrderBy) + Me._CurrentSortOrder = value + End Set + End Property + + Private _DataSource() As PersonalTitleRecord = Nothing + Public Property DataSource() As PersonalTitleRecord () + Get + Return Me._DataSource + End Get + Set(ByVal value() As PersonalTitleRecord) + Me._DataSource = value + End Set + End Property + +#Region "Helper Properties" + + Public ReadOnly Property CommandDateLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "CommandDateLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property CommandLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "CommandLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property PersonalTitleAddButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalTitleAddButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalTitleDeleteButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalTitleDeleteButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalTitleEditButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalTitleEditButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalTitlePagination() As Persons.UI.IPagination + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalTitlePagination"), Persons.UI.IPagination) + End Get + End Property + + Public ReadOnly Property PersonalTitleRefreshButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalTitleRefreshButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalTitleResetButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalTitleResetButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalTitleSaveButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalTitleSaveButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalTitleTableControlCollapsibleRegion() As System.Web.UI.WebControls.Panel + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalTitleTableControlCollapsibleRegion"), System.Web.UI.WebControls.Panel) + End Get + End Property + + Public ReadOnly Property PersonalTitleTableControlIcon() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalTitleTableControlIcon"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property PersonalTitleTableControlPanelExtender() As AjaxControlToolkit.CollapsiblePanelExtender + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalTitleTableControlPanelExtender"), AjaxControlToolkit.CollapsiblePanelExtender) + End Get + End Property + + Public ReadOnly Property PersonalTitleTitle() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalTitleTitle"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property PersonalTitleToggleAll() As System.Web.UI.WebControls.CheckBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalTitleToggleAll"), System.Web.UI.WebControls.CheckBox) + End Get + End Property + + Public ReadOnly Property SkillNoLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "SkillNoLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property TitleDateLabel1() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "TitleDateLabel1"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property TitleLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "TitleLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property TitleRankLabel() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "TitleRankLabel"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + +#End Region + +#Region "Helper Functions" + + Public Overrides Overloads Function ModifyRedirectUrl(url As String, arg As String, ByVal bEncrypt As Boolean) As String + Return Me.Page.EvaluateExpressions(url, arg, bEncrypt, Me) + End Function + + Public Overrides Overloads Function EvaluateExpressions(url As String, arg As String, ByVal bEncrypt As Boolean) As String + Dim needToProcess As Boolean = AreAnyUrlParametersForMe(url, arg) + If (needToProcess) Then + Dim recCtl As PersonalTitleTableControlRow = Me.GetSelectedRecordControl() + If recCtl Is Nothing AndAlso url.IndexOf("{") >= 0 Then + ' Localization. + Throw New Exception(Page.GetResourceValue("Err:NoRecSelected", "Persons")) + End If + Dim rec As PersonalTitleRecord = Nothing + If recCtl IsNot Nothing Then + rec = recCtl.GetRecord() + End If + Return EvaluateExpressions(url, arg, rec, bEncrypt) + End If + Return url + End Function + + Public Overridable Function GetSelectedRecordIndex() As Integer + Dim counter As Integer = 0 + Dim recControl As PersonalTitleTableControlRow + For Each recControl In Me.GetRecordControls() + If recControl.PersonalTitleRecordRowSelection.Checked Then + Return counter + End If + counter += 1 + Next + Return -1 + End Function + + Public Overridable Function GetSelectedRecordControl() As PersonalTitleTableControlRow + Dim selectedList() As PersonalTitleTableControlRow = Me.GetSelectedRecordControls() + If selectedList.Length = 0 Then + Return Nothing + End If + Return selectedList(0) + + End Function + + Public Overridable Function GetSelectedRecordControls() As PersonalTitleTableControlRow() + + Dim selectedList As ArrayList = New ArrayList(25) + Dim recControl As PersonalTitleTableControlRow + For Each recControl In Me.GetRecordControls() + If recControl.PersonalTitleRecordRowSelection IsNot Nothing AndAlso recControl.PersonalTitleRecordRowSelection.Checked Then + selectedList.Add(recControl) + End If + Next + Return DirectCast(selectedList.ToArray(GetType(PersonalTitleTableControlRow)), PersonalTitleTableControlRow()) + + End Function + + Public Overridable Sub DeleteSelectedRecords(ByVal deferDeletion As Boolean) + Dim recList() As PersonalTitleTableControlRow = Me.GetSelectedRecordControls() + If recList.Length = 0 Then + ' Localization. + Throw New Exception(Page.GetResourceValue("Err:NoRecSelected", "Persons")) + End If + + Dim recCtl As PersonalTitleTableControlRow + For Each recCtl In recList + If deferDeletion Then + If Not recCtl.IsNewRecord Then + + Me.AddToDeletedRecordIds(recCtl) + + End If + recCtl.Visible = False + + recCtl.PersonalTitleRecordRowSelection.Checked = False + + Else + + recCtl.Delete() + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + End If + Next + End Sub + + Public Function GetRecordControls() As PersonalTitleTableControlRow() + Dim recList As ArrayList = New ArrayList() + Dim rep As System.Web.UI.WebControls.Repeater = CType(Me.FindControl("PersonalTitleTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return Nothing + Dim repItem As System.Web.UI.WebControls.RepeaterItem + + For Each repItem In rep.Items + + Dim recControl As PersonalTitleTableControlRow = DirectCast(repItem.FindControl("PersonalTitleTableControlRow"), PersonalTitleTableControlRow) + recList.Add(recControl) + + Next + + Return DirectCast(recList.ToArray(GetType(PersonalTitleTableControlRow)), PersonalTitleTableControlRow()) + 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 + + \ No newline at end of file diff --git a/App_Code/Ps.vb b/App_Code/Ps.vb new file mode 100644 index 0000000..3c785bb --- /dev/null +++ b/App_Code/Ps.vb @@ -0,0 +1,98 @@ +Imports Microsoft.VisualBasic + +Public Class Ps + Public Shared Function GetRankLevel(Optional ByVal Pid As String = "") As Integer + Dim userId As String = "" + If Pid = "" Then + userId = BaseClasses.Utils.SecurityControls.GetCurrentUserID() + Else + userId = Pid + End If + If userId = "" Then + Return 0 + End If + Dim rec As PersonalIdRecord = PersonalIdTable.GetRecord("PersonalId='" & userId & "'") + Dim rec1 As RankRecord = RankTable.GetRecord("RankId=" & rec.RankId) + Return rec1.RankLevel + End Function + + Public Shared Function GetRank(ByVal RankId As Integer, Optional ByVal ShortRank As Boolean = False) As String + Dim Rank As String = "" + Dim rec As RankRecord = RankTable.GetRecord("RankId=" & RankId) + If Not rec Is Nothing Then + Rank = rec.ShortRankNormal + End If + Return Rank + End Function + Public Shared Function GetDept(ByVal DeptId As Integer) As String + GetDept = "" + Dim rec As DeptRecord = DeptTable.GetRecord("DeptId=" & DeptId) + If Not rec Is Nothing Then + GetDept = rec.DeptAbbvr + Else + End If + End Function + Public Shared Function GetSectionAbbvrNameByDeptId(ByVal DeptId As Integer) As String + GetSectionAbbvrNameByDeptId = "" + Dim rec As DeptRecord = DeptTable.GetRecord("DeptId=" & DeptId) + Dim rec1 As SectionRecord = SectionTable.GetRecord("SectionId=" & rec.SectionId) + GetSectionAbbvrNameByDeptId = rec1.SectionAbbvrName + End Function + Public Shared Function GetName(ByVal pid As String) As String + GetName = "" + Dim recId As PersonalIdRecord = PersonalIdTable.GetRecord("PersonalId='" & pid & "'") + Dim recRank As RankRecord = RankTable.GetRecord("RankId=" & recId.RankId) + + '25/11/54 + ' If Not recId Is Nothing AndAlso Not recRank Is Nothing Then + ' GetName = recRank.ShortRankNormal & recId.PersonalName & " " & recId.PersonalLastName + ' End If + + If recId.Sex = 2 And (recId.RankId < 34 Or recId.RankId > 36 And recId.RankId <= 57) Then + GetName = Trim(recRank.ShortRankNormal & "หญิง " & recId.PersonalName & " " & recId.PersonalLastName & " " & recRank.suffix) + Else + GetName = Trim(recRank.ShortRankNormal & recId.PersonalName & " " & recId.PersonalLastName & " " & recRank.suffix) + End If + + End Function + + Public Shared Function ChingePID(ByVal pid As String, ByVal npid As String) As Integer + Dim myConnection As System.Data.SqlClient.SqlConnection + Dim myCommand As New System.Data.SqlClient.SqlCommand + Dim result As Integer + myConnection = CType(BaseClasses.Data.SqlProvider.SqlTransaction.GetExistingTransaction().GetADOConnectionByName("DatabasePersons1"), System.Data.SqlClient.SqlConnection) + + 'Specify the name of the Stored Procedure which is to be run + + myCommand.Connection = myConnection + myCommand.CommandType = System.Data.CommandType.StoredProcedure + myCommand.CommandTimeout = 15 + + 'myCommand.ExecuteScalar() + myCommand.Parameters.AddWithValue("@pid", pid) + myCommand.Parameters.AddWithValue("@NewPid", npid) + myCommand.CommandText = "ChangePid" + result = myCommand.ExecuteNonQuery + + Return result + + End Function + + Public Shared Function IsPid(ByVal id As String) As Boolean + If Len(id) = 13 Then + Dim i As Integer + Dim sum As Integer + For i = 1 To 12 + sum = sum + CInt(Mid(id, i, 1)) * (14 - i) + Next + If (11 - (sum Mod 11)) Mod 10 = CInt(Mid(id, i, 13)) Then + Return True + Else + Return False + 'Return True + End If + End If + + End Function + +End Class diff --git a/App_Code/Shared/AccessParser.vb b/App_Code/Shared/AccessParser.vb new file mode 100644 index 0000000..f0a24a3 --- /dev/null +++ b/App_Code/Shared/AccessParser.vb @@ -0,0 +1,176 @@ +Imports System +Imports System.Data +Imports System.Data.OleDb +Imports System.Configuration +Imports System.Text +Imports System.IO +Imports System.Collections +Imports System.Web +Imports System.Web.Security +Imports System.Web.UI +Imports System.Web.UI.WebControls +Imports System.Web.UI.WebControls.WebParts +Imports System.Web.UI.HtmlControls + +Namespace Persons.UI + ''' + ''' Summary description for AccessParser + ''' + Public Class AccessParser + Inherits Parser + Implements IDisposable +#Region "Private Member" + + Private fileName As String = String.Empty + Private commandText As String = String.Empty + Private command As OleDbCommand = Nothing + Private connection As OleDbConnection = Nothing + Private reader As OleDbDataReader = Nothing + Private m_connectionString As String = String.Empty + Private _tableName As String = String.Empty + +#End Region +#Region "Properties" + Friend ReadOnly Property ConnectionStringOne() As String + + Get + If HttpContext.Current.Session("pwd") IsNot Nothing Then + Me.m_connectionString = "Provider=Microsoft.ACE.OLEDB.12.0;" + "Data Source=" + Me.fileName + ";" + "Jet OLEDB:Database Password=" + HttpContext.Current.Session("pwd").ToString() + ";" + Return Me.m_connectionString + Else + Me.m_connectionString = "Provider=Microsoft.ACE.OLEDB.12.0;" + "Data Source=" + Me.fileName + ";" + "Persist Security Info=False;" + Return Me.m_connectionString + End If + End Get + End Property + Friend ReadOnly Property ConnectionStringTwo() As String + Get + Me.m_connectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" + "Data Source=" + Me.fileName + ";" + Return Me.m_connectionString + End Get + End Property + Friend ReadOnly Property TableName() As String + Get + If Not IsValidTableName(Me._tableName) Then + Dim aliasName As String = Me._tableName.Replace(" ", "_") & "_" + Return String.Format("[{0}][{1}]", Me._tableName, aliasName) + Else + Return Me._tableName + End If + End Get + End Property + + Private Function IsValidTableName(ByVal tableName As String) As Boolean + + Dim specialChar As Char() = New Char() {"~"c, "-"c, "!"c, "@"c, "#"c, "$"c, "%"c, "^"c, "&"c, "*"c, "("c, ")"c, "`"c, "|"c, "\"c, ":"c, ";"c, "'"c, "<"c, ","c, ">"c, "."c, "/"c, "?"c, "["c, "]"c, "{"c, "}"c} + If tableName.IndexOfAny(specialChar) > -1 Then + Return False + Else + Return True + End If + End Function +#End Region + + + Public Sub New(ByVal file As String, ByVal tableName As String) + ' + ' Add constructor logic here + ' + Me.fileName = file + Dim merror As Boolean = False + Dim isConnectionOpen As Boolean = False + Me._tableName = tableName + Me.connection = New OleDbConnection(Me.ConnectionStringOne) + Me.commandText = "SELECT * FROM " + Me.TableName + Me.command = New OleDbCommand(Me.commandText, Me.connection) + + Try + Me.connection.Open() + isConnectionOpen = True + Me.reader = Me.command.ExecuteReader() + Catch ex As Exception + If Not isConnectionOpen Then + Me.connection = Nothing + Me.command = Nothing + Me.connection = New OleDbConnection(Me.ConnectionStringTwo) + Me.command = New OleDbCommand(Me.commandText, Me.connection) + Try + Me.connection.Open() + + Me.reader = Me.command.ExecuteReader() + Catch exe As Exception + merror = True + Throw New Exception(exe.Message) + End Try + If merror Then + If Me.connection.State = ConnectionState.Open AndAlso Me.connection IsNot Nothing Then + Me.connection.Close() + End If + Throw ex + End If + Else + If Me.connection.State = ConnectionState.Open AndAlso Me.connection IsNot Nothing Then + Me.connection.Close() + End If + Throw ex + End If + + End Try + + End Sub +#Region "Parser member" + + Public Overloads Overrides Sub Reset() + ' throw new NotImplementedException(); + End Sub + + Public Overloads Overrides Function GetNextRow() As String() + Dim row As New ArrayList() + Dim columnIndex As Integer = 0 + If Me.connection.State <> ConnectionState.Closed Then + + If Me.reader.Read() Then + For columns As Integer = 0 To Me.reader.FieldCount - 1 + Try + row.Add(Me.reader(columnIndex).ToString()) + Catch ex As Exception + Throw New Exception(ex.Message) + End Try + columnIndex += 1 + Next + End If + End If + If row.Count <> 0 Then + Return DirectCast(row.ToArray(GetType(String)), String()) + End If + + Return Nothing + End Function + + Public Overloads Overrides Sub Close() + Me.reader.Close() + Me.reader = Nothing + Me.connection.Close() + Me.connection = Nothing + + End Sub +#End Region + +#Region "IDisposable Members" + + Private Sub Dispose() Implements IDisposable.Dispose + 'throw new NotImplementedException(); + If Me.reader IsNot Nothing Then + Me.reader.Close() + Me.reader.Dispose() + End If + If Me.connection IsNot Nothing Then + Me.connection.Close() + Me.connection.Dispose() + End If + + End Sub + +#End Region + End Class +End Namespace \ No newline at end of file diff --git a/App_Code/Shared/BaseApplicationMenuControl.vb b/App_Code/Shared/BaseApplicationMenuControl.vb new file mode 100644 index 0000000..57c67e6 --- /dev/null +++ b/App_Code/Shared/BaseApplicationMenuControl.vb @@ -0,0 +1,287 @@ +Imports BaseClasses.Data +Imports BaseClasses.Utils.StringUtils +Imports BaseClasses.Resources + +Namespace Persons.UI + +' Typical customizations that may be done in this class include +' - adding custom event handlers +' - overriding base class methods + +''' +''' The superclass (i.e. base class) for all Designer-generated user controls in this application. +''' +''' +''' +''' +''' + + Public Class BaseApplicationMenuControl + Inherits BaseClasses.Web.UI.BaseMenuControl + + ' Variable used to prevent infinite loop + Private _modifyRedirectUrlInProgress As Boolean = False + + ''' Allow for migration from earlier versions which did not have url encryption. + Public Overridable Function ModifyRedirectUrl(ByVal redirectUrl As String, ByVal redirectArgument As String) As String + Return EvaluateExpressions(redirectUrl, redirectArgument, False) + End Function + + Public Overridable Function ModifyRedirectUrl(ByVal redirectUrl As String, ByVal redirectArgument As String, ByVal bEncrypt As Boolean) As String + Return EvaluateExpressions(redirectUrl, redirectArgument, bEncrypt) + End Function + + Public Overridable Function EvaluateExpressions(ByVal redirectUrl As String, ByVal redirectArgument As String, ByVal bEncrypt As Boolean) As String + Const PREFIX_NO_ENCODE As String = "NoUrlEncode:" + + If (_modifyRedirectUrlInProgress) Then + Return Nothing + Else + _modifyRedirectUrlInProgress = True + End If + + Dim finalRedirectUrl As String = redirectUrl + Dim finalRedirectArgument As String = redirectArgument + + If (finalRedirectUrl Is Nothing OrElse finalRedirectUrl.Trim = "") Then + Return "" + ElseIf (finalRedirectUrl.IndexOf("{"c) < 0) Then + 'RedirectUrl does not contain any format specifiers + _modifyRedirectUrlInProgress = False + Return finalRedirectUrl + Else + 'The old way was to pass separate URL and arguments and use String.Format to + 'do the replacement. Example: + ' URL: EditProductsRecord?Products={0} + ' Argument: PK + 'The new way to is pass the arguments directly in the URL. Example: + ' URL: EditProductsRecord?Products={PK} + 'If the old way is passsed, convert it to the new way. + If (Len(redirectArgument) > 0) Then + Dim arguments() As String = Split(redirectArgument, ",") + Dim i As Integer + For i = 0 To (arguments.Length - 1) + finalRedirectUrl = finalRedirectUrl.Replace("{" & i.ToString & "}", "{" & arguments(i) & "}") + Next + + finalRedirectArgument = "" + End If + + 'First find all the table and record controls in the page. + Dim controlList As ArrayList = GetAllRecordAndTableControls() + If controlList.Count = 0 Then + Return finalRedirectUrl + End If + + ' Store the controls in a hashtable using the control unique name + ' as the key for easy refrence later in the function. + Dim controlIdList As New Hashtable + Dim control As System.Web.UI.Control + For Each control In controlList + controlIdList.Add(control.UniqueID, control) + Next + + 'Look at all of the expressions in the URL and forward processing + 'to the appropriate controls. + 'Expressions can be of the form [ControlName:][NoUrlEncode:]Key[:Value] + Dim forwardTo As New ArrayList + Dim remainingUrl As String = finalRedirectUrl + While (remainingUrl.IndexOf("{"c) >= 0) And (remainingUrl.IndexOf("}"c) > 0) And _ + (remainingUrl.IndexOf("{"c) < remainingUrl.IndexOf("}"c)) + + Dim leftIndex As Integer = remainingUrl.IndexOf("{"c) + Dim rightIndex As Integer = remainingUrl.IndexOf("}"c) + Dim expression As String = remainingUrl.Substring(leftIndex + 1, rightIndex - leftIndex - 1) + remainingUrl = remainingUrl.Substring(rightIndex + 1) + + Dim prefix As String = Nothing + If (expression.IndexOf(":") > 0) Then + prefix = expression.Substring(0, expression.IndexOf(":")) + End If + If (Not IsNothing(prefix)) AndAlso (prefix.Length > 0) AndAlso _ + (Not (InvariantLCase(prefix) = InvariantLCase(PREFIX_NO_ENCODE))) AndAlso _ + (Not BaseRecord.IsKnownExpressionPrefix(prefix)) Then + 'The prefix is a control name. Add it to the list of controls that + 'need to process the URL. + If (controlIdList.Contains(prefix)) And (Not forwardTo.Contains(prefix)) Then + forwardTo.Add(prefix) + End If + End If + End While + + 'Forward the request to each control in the forwardTo list + Dim containerId As String + For Each containerId In forwardTo + Dim ctl As Control = CType(controlIdList.Item(containerId), Control) + If (Not IsNothing(ctl)) Then + If TypeOf ctl Is BaseApplicationRecordControl Then + finalRedirectUrl = DirectCast(ctl, BaseApplicationRecordControl).EvaluateExpressions(finalRedirectUrl, finalRedirectArgument, bEncrypt) + ElseIf TypeOf ctl Is BaseApplicationTableControl Then + finalRedirectUrl = DirectCast(ctl, BaseApplicationTableControl).EvaluateExpressions(finalRedirectUrl, finalRedirectArgument, bEncrypt) + End If + End If + Next + + 'If there are any unresolved expressions, let the other naming containers + 'have a crack at modifying the URL + For Each control In controlList + If (forwardTo.IndexOf(control.ID) < 0) Then + If TypeOf control Is BaseApplicationRecordControl Then + finalRedirectUrl = DirectCast(control, BaseApplicationRecordControl).EvaluateExpressions(finalRedirectUrl, finalRedirectArgument, bEncrypt) + ElseIf TypeOf control Is BaseApplicationTableControl Then + finalRedirectUrl = DirectCast(control, BaseApplicationTableControl).EvaluateExpressions(finalRedirectUrl, finalRedirectArgument, bEncrypt) + End If + End If + Next + End If + + _modifyRedirectUrlInProgress = False + + Return finalRedirectUrl + End Function + + Private Function GetAllRecordAndTableControls() As ArrayList + Dim controlList As ArrayList = New ArrayList() + GetAllRecordAndTableControls(Me, controlList) + Return controlList + End Function + + Private Sub GetAllRecordAndTableControls(ByVal ctl As Control, ByVal controlList As ArrayList) + If ctl Is Nothing Then + Return + End If + + If TypeOf ctl Is BaseApplicationRecordControl OrElse _ + TypeOf ctl Is BaseApplicationTableControl Then + controlList.Add(ctl) + End If + + Dim nextCtl As Control + For Each nextCtl In ctl.Controls() + GetAllRecordAndTableControls(nextCtl, controlList) + Next + End Sub + +#Region " Methods to manage saving and retrieving control values to session. " + Protected Sub Control_SaveControls_Unload(ByVal sender As Object, ByVal e As EventArgs) Handles MyBase.Unload + If DirectCast(Me.Page, BaseApplicationPage).ShouldSaveControlsToSession Then + Me.SaveControlsToSession() + End If + End Sub + + Protected Overridable Sub SaveControlsToSession() + End Sub + + Public Overridable Sub SetChartControl(ByVal chartCtrlName As String) + End Sub + + Protected Sub Control_ClearControls_PreRender(ByVal sender As Object, ByVal e As EventArgs) Handles MyBase.PreRender + Me.ClearControlsFromSession() + End Sub + + Protected Overridable Sub ClearControlsFromSession() + End Sub + + Public Sub SaveToSession( _ + ByVal control As Control, _ + ByVal value As String) + + SaveToSession(control.UniqueID, value) + End Sub + + Public Function GetFromSession( _ + ByVal control As Control, _ + ByVal defaultValue As String) As String + + Return GetFromSession(control.UniqueID, defaultValue) + End Function + + Public Function GetFromSession(ByVal control As Control) As String + Return GetFromSession(control.UniqueID, Nothing) + End Function + + Public Sub RemoveFromSession(ByVal control As Control) + RemoveFromSession(control.UniqueID) + End Sub + + Public Function InSession(ByVal control As Control) As Boolean + Return InSession(control.UniqueID) + End Function + + Public Sub SaveToSession( _ + ByVal control As Control, _ + ByVal variable As String, _ + ByVal value As String) + + SaveToSession(control.UniqueID & variable, value) + End Sub + + Public Function GetFromSession( _ + ByVal control As Control, _ + ByVal variable As String, _ + ByVal defaultValue As String) As String + + Return GetFromSession(control.UniqueID & variable, defaultValue) + End Function + + Public Sub RemoveFromSession( _ + ByVal control As Control, _ + ByVal variable As String) + + RemoveFromSession(control.UniqueID & variable) + End Sub + + Public Function InSession( _ + ByVal control As Control, _ + ByVal variable As String) As Boolean + + Return InSession(control.UniqueID & variable) + End Function + + Public Sub SaveToSession( _ + ByVal name As String, _ + ByVal value As String) + + Me.Page.Session()(GetValueKey(name)) = value + End Sub + + Public Function GetFromSession( _ + ByVal name As String, _ + ByVal defaultValue As String) As String + + Dim value As String = CType(Me.Page.Session()(GetValueKey(name)), String) + If value Is Nothing OrElse value.Trim() = "" Then + value = defaultValue + End If + + Return value + End Function + + Public Function GetFromSession(ByVal name As String) As String + Return GetFromSession(name, Nothing) + End Function + + Public Sub RemoveFromSession(ByVal name As String) + Me.Page.Session.Remove(GetValueKey(name)) + End Sub + + Public Function InSession(ByVal name As String) As Boolean + Return (Not Me.Page.Session(GetValueKey(name)) Is Nothing) + End Function + + Public Function GetValueKey(ByVal name As String) As String + Return Me.Page.Session.SessionID & Me.Page.AppRelativeVirtualPath & name + End Function +#End Region + + Public Function GetResourceValue(ByVal keyVal As String, ByVal appName As String) As String + Return AppResources.GetResourceValue(keyVal, appName) + End Function + + Public Function GetResourceValue(ByVal keyVal As String) As String + Return AppResources.GetResourceValue(keyVal, Nothing) + End Function + + End Class + +End Namespace diff --git a/App_Code/Shared/BaseApplicationPage.vb b/App_Code/Shared/BaseApplicationPage.vb new file mode 100644 index 0000000..1aba246 --- /dev/null +++ b/App_Code/Shared/BaseApplicationPage.vb @@ -0,0 +1,1268 @@ +Imports BaseClasses.Data +Imports BaseClasses.Utils.StringUtils +Imports BaseClasses.Utils +Imports BaseClasses.Resources +Imports Persons.Business +Imports Persons.Data +Imports BaseClasses.Web.UI + +Imports System.Web.UI.DataVisualization.Charting +Namespace Persons.UI + ' Typical customizations that may be done in this class include + ' - adding custom event handlers + ' - overriding base class methods + ' + ''' + ''' The superclass (i.e. base class) for all Designer-generated pages in this application. + ''' + ''' + ''' + ''' + ''' + + + Public Class BaseApplicationPage + Inherits BaseClasses.Web.UI.BasePage + + Private _Enctype As String = "" + Public Property Enctype() As String + Get + Return Me._Enctype + End Get + Set(ByVal value As String) + Me._Enctype = value + End Set + End Property + + Private Sub Page_PreInit(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.PreInit + Dim selectedTheme As String = Me.GetSelectedTheme() + If Not String.IsNullOrEmpty(selectedTheme) Then + Me.Page.Theme = selectedTheme + End If + End Sub + + 'Script to set focus to the last focused control + + Private Const SCRIPT_DOFOCUS As String = "" & _ + "" + + + 'Add or remove controls if you do not want to retain focus on them + Public Sub LoadFocusScripts(ByVal CurrentControl As Control) + If TypeOf (CurrentControl) Is TextBox OrElse TypeOf (CurrentControl) Is DropDownList OrElse TypeOf (CurrentControl) Is ListBox OrElse _ + TypeOf (CurrentControl) Is Button OrElse TypeOf (CurrentControl) Is ImageButton OrElse TypeOf (CurrentControl) Is RadioButtonList OrElse _ + TypeOf (CurrentControl) Is RadioButton OrElse TypeOf (CurrentControl) Is LinkButton Then + DirectCast(CurrentControl, WebControl).Attributes.Add("onfocus", "try{document.getElementById(""__LASTFOCUS"").value=this.id;}catch(e){}") + End If + If CurrentControl.HasControls() Then + For Each CurrentChildControl As Control In CurrentControl.Controls + Me.LoadFocusScripts(CurrentChildControl) + Next + End If + End Sub + + Public Overridable Sub SetFocusOnLoad() + Me.SetFocusOnLoad(Nothing) + End Sub + + '''Sets focus to the control with ctrlClientID. If empty string is passed, sets focus to the first focusable control + Public Overridable Sub SetFocusOnLoad(ByVal currentControl As Control) + Dim ctrlClientID As String = "" + If currentControl IsNot Nothing Then + ctrlClientID = currentControl.ClientID + 'currentControl.Focus() + End If + If Not ClientScript.IsStartupScriptRegistered(Page.GetType(), "SetFocusOnLoad") Then + Dim _clientSideIsPostBack As System.Web.UI.HtmlControls.HtmlInputHidden = DirectCast(Me.FindControlRecursively("_clientSideIsPostBack"), System.Web.UI.HtmlControls.HtmlInputHidden) + Dim _clientSideIsPostBackID As String = "_clientSideIsPostBack" + If Not _clientSideIsPostBack Is Nothing Then + _clientSideIsPostBackID = _clientSideIsPostBack.ClientID + End If + Dim script As String = SCRIPT_DOFOCUS + script = script.Replace("{ControlClientID}", ctrlClientID) + script = script.Replace("{clientSideIsPostBack}", _clientSideIsPostBackID) + Dim id As String = Request.Item("__LASTFOCUS") + If String.IsNullOrEmpty(id) Then + id = "" + End If + script = script.Replace("{CtrlIDToFocusOnPostBack}", id) + Dim sm As ScriptManager = ScriptManager.GetCurrent(Me.Page) + If sm.IsInAsyncPostBack Then + ScriptManager.RegisterClientScriptBlock(Me, Page.GetType(), "SetFocusOnPostback", script, False) + Else + ClientScript.RegisterStartupScript(Page.GetType(), "SetFocusOnLoad", script, False) + End If + + End If + End Sub + '''Verifies that this is editable control + Public Overridable Function IsControlEditable(ByVal ctrl As Control, Optional ByVal includeCheckBox As Boolean = True) As Boolean + If TypeOf ctrl Is System.Web.UI.WebControls.TextBox OrElse _ + TypeOf ctrl Is System.Web.UI.WebControls.DropDownList OrElse _ + TypeOf ctrl Is System.Web.UI.WebControls.ListBox OrElse _ + TypeOf ctrl Is System.Web.UI.WebControls.FileUpload Then + Return True + ElseIf includeCheckBox AndAlso TypeOf ctrl Is System.Web.UI.WebControls.CheckBox Then + Return True + End If + Return False + End Function + + Public Overridable Function GetSelectedTheme() As String + 'First try to get selected theme from Session + Dim Session As System.Web.SessionState.HttpSessionState = HttpContext.Current.Session + Dim selectedTheme As String = DirectCast(Session.Item(NetUtils.CookieSelectedTheme), String) + If Not String.IsNullOrEmpty(selectedTheme) Then + Return selectedTheme + End If + 'There is no theme stored in session, possibly application is opened for the very first time. + 'Try to get theme from the cookie + selectedTheme = BaseClasses.Utils.NetUtils.GetCookie(NetUtils.CookieSelectedTheme) + If Not String.IsNullOrEmpty(selectedTheme) Then + 'make sure theme exists in application + Dim appDir As String = "" + Try + appDir = System.Web.HttpContext.Current.Server.MapPath("/") + If Not String.IsNullOrEmpty(appDir) Then appDir = appDir & "App_Themes" + Catch ex As Exception + + End Try + If String.IsNullOrEmpty(appDir) Then + Try + appDir = System.Web.HttpContext.Current.Server.MapPath("") + If Not String.IsNullOrEmpty(appDir) Then + If Not System.IO.Directory.GetParent(appDir) Is Nothing Then + appDir = System.IO.Directory.GetParent(appDir).FullName & "\App_Themes" + ElseIf appDir.IndexOf("\") > 0 Then + appDir = appDir.Substring(0, appDir.LastIndexOf("\")) & "\App_Themes" + Else + appDir = "" + End If + End If + Catch ex As Exception + appDir = "" + End Try + End If + If Not String.IsNullOrEmpty(appDir) AndAlso System.IO.Directory.Exists(appDir) Then + If System.IO.Directory.Exists(System.IO.Path.Combine(appDir, selectedTheme)) Then + Session.Item(NetUtils.CookieSelectedTheme) = selectedTheme + Return selectedTheme + Else + BaseClasses.Utils.NetUtils.SetCookie(NetUtils.CookieSelectedTheme, "") + End If + End If + End If + Return "" + End Function + + 'Retrieve selected language from session or cookie + Public Overridable Function GetSelectedLanguage() As String + 'First try to get selected language from Session + Dim Session As System.Web.SessionState.HttpSessionState = HttpContext.Current.Session + Dim selectedLanguage As String = DirectCast(Session("AppCultureUI"), String) + If Not String.IsNullOrEmpty(selectedLanguage) Then Return selectedLanguage + 'There is no theme stored in session, possibly application is opened for the very first time. + 'Try to get theme from the cookie + selectedLanguage = BaseClasses.Utils.NetUtils.GetCookie(NetUtils.CookieSelectedLanguage) + If Not String.IsNullOrEmpty(selectedLanguage) Then + Try + Dim culInfo As System.Globalization.CultureInfo = New System.Globalization.CultureInfo(selectedLanguage) + Session("AppCultureUI") = selectedLanguage + Return selectedLanguage + Catch + 'if exception happened this language is not supported + BaseClasses.Utils.NetUtils.SetCookie(NetUtils.CookieSelectedLanguage, "") + selectedLanguage = System.Threading.Thread.CurrentThread.CurrentUICulture.Name + Session("AppCultureUI") = selectedLanguage + End Try + Else + selectedLanguage = System.Threading.Thread.CurrentThread.CurrentUICulture.Name + Session("AppCultureUI") = selectedLanguage + End If + + Return selectedLanguage + + End Function + + Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load + 'commented out because DataBind is being called multiple times. + ' If (Not Me.IsPostBack) Then + ' Me.DataBind() + ' End If + End Sub + + ' Variable used to prevent infinite loop + Private _modifyRedirectUrlInProgress As Boolean = False + + ' Constant used for EvaluateExpressions + Const PREFIX_NO_ENCODE As String = "NoUrlEncode:" + + ''' Allow for migration from earlier versions which did not have url encryption. + Public Overridable Function ModifyRedirectUrl(ByVal redirectUrl As String, ByVal redirectArgument As String) As String + Return EvaluateExpressions(redirectUrl, redirectArgument, False) + End Function + + Public Overridable Function ModifyRedirectUrl(ByVal redirectUrl As String, ByVal redirectArgument As String, ByVal bEncrypt As Boolean) As String + Return EvaluateExpressions(redirectUrl, redirectArgument, bEncrypt) + End Function + + Public Overridable Function EvaluateExpressions( _ + ByVal redirectUrl As String, _ + ByVal redirectArgument As String, _ + ByVal bEncrypt As Boolean) As String + Return EvaluateExpressions(redirectUrl, redirectArgument, bEncrypt, Me) + End Function + + Public Overridable Function EvaluateExpressions( _ + ByVal redirectUrl As String, _ + ByVal redirectArgument As String, _ + ByVal bEncrypt As Boolean, _ + ByVal targetCtl As Control) As String + + If (_modifyRedirectUrlInProgress) Then + Return Nothing + Else + _modifyRedirectUrlInProgress = True + End If + + Dim finalRedirectUrl As String = redirectUrl + Dim finalRedirectArgument As String = redirectArgument + + + Dim remainingUrl As String = finalRedirectUrl + + + ' encrypt constant value + If bEncrypt AndAlso targetCtl.GetType() Is Page.GetType() Then + remainingUrl &= "&" + finalRedirectUrl &= "&" + + + While (remainingUrl.IndexOf("="c) >= 0) And (remainingUrl.IndexOf("&"c) > 0) And _ + (remainingUrl.IndexOf("="c) < remainingUrl.IndexOf("&"c)) + + Dim leftIndex As Integer = remainingUrl.IndexOf("="c) + Dim rightIndex As Integer = remainingUrl.IndexOf("&"c) + Dim encryptFrom As String = remainingUrl.Substring(leftIndex + 1, rightIndex - leftIndex - 1) + + remainingUrl = remainingUrl.Substring(rightIndex + 1) + If Not encryptFrom.StartsWith("{") OrElse Not encryptFrom.EndsWith("}") Then + + + ' check if it is already encrypted + Dim isEncrypted As Boolean = False + Try + If Decrypt(encryptFrom) <> "" Then + isEncrypted = True + End If + Catch + + End Try + + ' if not, process encryption + If Not isEncrypted Then + Dim encryptTo As String = DirectCast(Me.Page, BaseApplicationPage).Encrypt(DirectCast(encryptFrom, String)) + finalRedirectUrl = finalRedirectUrl.Replace("=" & encryptFrom & "&", "=" & encryptTo & "&") + End If + End If + End While + + + finalRedirectUrl = finalRedirectUrl.Trim("&"c) + End If + + If (finalRedirectUrl Is Nothing OrElse finalRedirectUrl.Trim = "") Then + Return "" + ElseIf (finalRedirectUrl.IndexOf("{"c) < 0) Then + 'RedirectUrl does not contain any format specifiers + _modifyRedirectUrlInProgress = False + Return finalRedirectUrl + Else + 'The old way was to pass separate URL and arguments and use String.Format to + 'do the replacement. Example: + ' URL: EditProductsRecord?Products={0} + ' Argument: PK + 'The new way to is pass the arguments directly in the URL. Example: + ' URL: EditProductsRecord?Products={PK} + 'If the old way is passsed, convert it to the new way. + If (Len(redirectArgument) > 0) Then + Dim arguments() As String = Split(redirectArgument, ",") + Dim i As Integer + For i = 0 To (arguments.Length - 1) + finalRedirectUrl = finalRedirectUrl.Replace("{" & i.ToString & "}", "{" & arguments(i) & "}") + Next + + finalRedirectArgument = "" + End If + + 'First find all the table and record controls in the page. + Dim controlList As New ArrayList() + GetAllRecordAndTableControls(targetCtl, controlList, True) + If controlList.Count = 0 Then + Return finalRedirectUrl + End If + + ' Store the controls in a hashtable using the control unique name + ' as the key for easy refrence later in the function. + Dim controlIdList As New Hashtable + Dim control As System.Web.UI.Control + Dim found As Boolean = False + For Each control In controlList + Dim uID As String = control.UniqueID + Dim pageContentIndex As Integer = uID.IndexOf("$PageContent$") + If pageContentIndex > 0 Then + If found = False Then + 'Remove all controls without $PageContent$ prefix, because this page is used with Master Page + 'and these entries are irrelevant + controlIdList.Clear() + End If + found = True + End If + If found Then + 'If we found that Master Page is used for this page construction than disregard all controls + 'without $PageContent$ prefix + If pageContentIndex > 0 Then + uID = uID.Substring(pageContentIndex + "$PageContent$".Length) + controlIdList.Add(uID, control) + End If + Else + 'No Master Page presense found so far + controlIdList.Add(uID, control) + End If + Next + + 'Look at all of the expressions in the URL and forward processing + 'to the appropriate controls. + 'Expressions can be of the form [ControlName:][NoUrlEncode:]Key[:Value] + Dim forwardTo As New ArrayList + + remainingUrl = finalRedirectUrl + While (remainingUrl.IndexOf("{"c) >= 0) And (remainingUrl.IndexOf("}"c) > 0) And _ + (remainingUrl.IndexOf("{"c) < remainingUrl.IndexOf("}"c)) + + Dim leftIndex As Integer = remainingUrl.IndexOf("{"c) + Dim rightIndex As Integer = remainingUrl.IndexOf("}"c) + Dim expression As String = remainingUrl.Substring(leftIndex + 1, rightIndex - leftIndex - 1) + remainingUrl = remainingUrl.Substring(rightIndex + 1) + + Dim prefix As String = Nothing + If (expression.IndexOf(":") > 0) Then + prefix = expression.Substring(0, expression.IndexOf(":")) + End If + If (Not IsNothing(prefix)) AndAlso (prefix.Length > 0) AndAlso _ + (Not (InvariantLCase(prefix) = InvariantLCase(PREFIX_NO_ENCODE))) AndAlso _ + (Not BaseRecord.IsKnownExpressionPrefix(prefix)) Then + 'The prefix is a control name. Add it to the list of controls that + 'need to process the URL. + If (controlIdList.Contains(prefix)) And (Not forwardTo.Contains(prefix)) Then + forwardTo.Add(prefix) + End If + End If + End While + + 'Forward the request to each control in the forwardTo list + Dim containerId As String + For Each containerId In forwardTo + Dim ctl As Control = CType(controlIdList.Item(containerId), Control) + If (Not IsNothing(ctl)) Then + If TypeOf ctl Is BaseApplicationRecordControl Then + finalRedirectUrl = DirectCast(ctl, BaseApplicationRecordControl).EvaluateExpressions(finalRedirectUrl, finalRedirectArgument, bEncrypt) + ElseIf TypeOf ctl Is BaseApplicationTableControl Then + finalRedirectUrl = DirectCast(ctl, BaseApplicationTableControl).EvaluateExpressions(finalRedirectUrl, finalRedirectArgument, bEncrypt) + End If + End If + Next + + 'If there are any unresolved expressions, let the other naming containers + 'have a crack at modifying the URL + For Each control In controlList + If (forwardTo.IndexOf(control.ID) < 0) Then + If TypeOf control Is BaseApplicationRecordControl Then + finalRedirectUrl = DirectCast(control, BaseApplicationRecordControl).EvaluateExpressions(finalRedirectUrl, finalRedirectArgument, bEncrypt) + ElseIf TypeOf control Is BaseApplicationTableControl Then + finalRedirectUrl = DirectCast(control, BaseApplicationTableControl).EvaluateExpressions(finalRedirectUrl, finalRedirectArgument, bEncrypt) + End If + End If + Next + End If + + _modifyRedirectUrlInProgress = False + + Return finalRedirectUrl + End Function + + Private Sub GetAllRecordAndTableControls(ByVal ctl As Control, ByVal controlList As ArrayList, ByVal withParents As Boolean) + If ctl Is Nothing Then + Return + End If + + GetAllRecordAndTableControls(ctl, controlList) + + If withParents Then + Dim parent As Control = ctl.Parent + While parent IsNot Nothing + If TypeOf (parent) Is BaseApplicationRecordControl OrElse TypeOf (parent) Is BaseApplicationTableControl Then + controlList.Add(parent) + End If + parent = parent.Parent + End While + End If + End Sub + + Private Function GetAllRecordAndTableControls() As ArrayList + Dim controlList As ArrayList = New ArrayList() + GetAllRecordAndTableControls(Me, controlList) + Return controlList + End Function + + Private Sub GetAllRecordAndTableControls(ByVal ctl As Control, ByVal controlList As ArrayList) + If ctl Is Nothing Then + Return + End If + + If TypeOf ctl Is BaseApplicationRecordControl OrElse _ + TypeOf ctl Is BaseApplicationTableControl Then + controlList.Add(ctl) + End If + + Dim nextCtl As Control + For Each nextCtl In ctl.Controls() + GetAllRecordAndTableControls(nextCtl, controlList) + Next + End Sub + + + Public Function GetResourceValue(ByVal keyVal As String, ByVal appName As String) As String + Return AppResources.GetResourceValue(keyVal, appName) + End Function + Public Function GetResourceValue(ByVal keyVal As String) As String + Return AppResources.GetResourceValue(keyVal, Nothing) + End Function + + + + + + + Public Function ExpandResourceValue(ByVal keyVal As String) As String + Return AppResources.ExpandResourceValue(keyVal) + End Function + + ''' ----------------------------------------------------------------------------- + ''' + ''' Register Control buttonCtrl with ScriptManager to perform traditional postback instead of default async postback + ''' + ''' + ''' + ''' + ''' [sramarao] 3/2007 Created + ''' + ''' ----------------------------------------------------------------------------- + Public Sub RegisterPostBackTrigger(ByVal buttonCtrl As System.Web.UI.Control, ByVal updatePanelCtrl As System.Web.UI.Control) + Try + ' Get current ScriptManager + Dim scriptMgr As ScriptManager = ScriptManager.GetCurrent(Me.Page) + ' If Scriptmanager not preset return. + If scriptMgr Is Nothing Then + Return + End If + ' If buttonCtrl is not surrounded by an UpdatePanel then return. + Dim CurrentUpdatePanel As System.Web.UI.UpdatePanel = CType(updatePanelCtrl, UpdatePanel) + If CurrentUpdatePanel Is Nothing Then + Return + End If + If buttonCtrl Is Nothing Then + Return + End If + scriptMgr.RegisterPostBackControl(buttonCtrl) + Catch ex As Exception + Throw ex + End Try + + End Sub + + Public Sub RegisterPostBackTrigger(ByVal buttonCtrl As System.Web.UI.Control) + Try + ' Get current ScriptManager + Dim scriptMgr As ScriptManager = ScriptManager.GetCurrent(Me.Page) + ' If Scriptmanager not preset return. + If scriptMgr Is Nothing Then + Return + End If + If buttonCtrl Is Nothing Then + Return + End If + scriptMgr.RegisterPostBackControl(buttonCtrl) + Catch ex As Exception + Throw ex + End Try + + End Sub + + Public Overridable Sub SaveData() + + End Sub + + Public Overridable Sub SetChartControl(ByVal chartCtrlName As String) + + End Sub + +#Region " Methods to manage saving and retrieving control values to session. " + Private _ShouldSaveControlsToSession As Boolean = False + Public Property ShouldSaveControlsToSession() As Boolean + Get + Return Me._ShouldSaveControlsToSession + End Get + Set(ByVal value As Boolean) + Me._ShouldSaveControlsToSession = value + End Set + End Property + + Protected Sub Page_SaveControls_Unload(ByVal sender As Object, ByVal e As EventArgs) Handles MyBase.Unload + If Me.ShouldSaveControlsToSession Then + Me.SaveControlsToSession() + End If + End Sub + + Protected Overridable Sub SaveControlsToSession() + End Sub + + Protected Sub Control_ClearControls_PreRender(ByVal sender As Object, ByVal e As EventArgs) Handles MyBase.PreRender + Me.ClearControlsFromSession() + End Sub + + Protected Overridable Sub ClearControlsFromSession() + End Sub + + Public Sub SaveToSession( _ + ByVal control As Control, _ + ByVal value As String) + + SaveToSession(control.UniqueID, value) + End Sub + + Public Function GetFromSession( _ + ByVal control As Control, _ + ByVal defaultValue As String) As String + + Return GetFromSession(control.UniqueID, defaultValue) + End Function + + Public Function GetFromSession(ByVal control As Control) As String + Return GetFromSession(control.UniqueID, Nothing) + End Function + + Public Sub RemoveFromSession(ByVal control As Control) + RemoveFromSession(control.UniqueID) + End Sub + + Public Function InSession(ByVal control As Control) As Boolean + Return InSession(control.UniqueID) + End Function + + Public Sub SaveToSession( _ + ByVal control As Control, _ + ByVal variable As String, _ + ByVal value As String) + + SaveToSession(control.UniqueID & variable, value) + End Sub + + Public Function GetFromSession( _ + ByVal control As Control, _ + ByVal variable As String, _ + ByVal defaultValue As String) As String + + Return GetFromSession(control.UniqueID & variable, defaultValue) + End Function + + Public Sub RemoveFromSession( _ + ByVal control As Control, _ + ByVal variable As String) + + RemoveFromSession(control.UniqueID & variable) + End Sub + + Public Function InSession( _ + ByVal control As Control, _ + ByVal variable As String) As Boolean + + Return InSession(control.UniqueID & variable) + End Function + + Public Sub SaveToSession( _ + ByVal name As String, _ + ByVal value As String) + + Me.Session()(GetValueKey(name)) = value + End Sub + + Public Function GetFromSession( _ + ByVal name As String, _ + ByVal defaultValue As String) As String + + Dim value As String = CType(Me.Session()(GetValueKey(name)), String) + If value Is Nothing OrElse value.Trim() = "" Then + value = defaultValue + End If + + Return value + End Function + + Public Function GetFromSession(ByVal name As String) As String + Return GetFromSession(name, Nothing) + End Function + + Public Sub RemoveFromSession(ByVal name As String) + Me.Session.Remove(GetValueKey(name)) + End Sub + + Public Function InSession(ByVal name As String) As Boolean + Return (Not Me.Session(GetValueKey(name)) Is Nothing) + End Function + + Public Function GetValueKey(ByVal name As String) As String + Return Me.Session.SessionID & Me.AppRelativeVirtualPath & name + End Function +#End Region +#Region " Methods to encrypt and decrypt URL parameters " + + + ' The URLEncryptionKey is specified in the web.config. The rightmost three characters of the current + ' Session Id are concatenated with the URLEncryptionKey to provide added protection. You can change + ' this to anything you like by changing this function for the application. + ' This function is private and not overridable because each page cannot have its own key - it must + ' be common across the entire application. + Public Overridable Function Encrypt(ByVal Source As String, Optional ByVal includeSession As Boolean = True) As String + Dim CheckCrypto As Crypto = New Crypto(Crypto.Providers.DES) + Return CheckCrypto.Encrypt(Source, includeSession) + End Function + + Public Overridable Function Decrypt(ByVal Source As String, Optional ByVal includeSession As Boolean = True) As String + Dim CheckCrypto As Crypto = New Crypto(Crypto.Providers.DES) + Return CheckCrypto.Decrypt(Source, includeSession) + End Function + + ' Encrypt url parameter which is enclosed in {}. For eg:..\Shared\SelectFileToImport?TableName=Employees + Public Function EncryptUrlParameter(ByVal url As String) As String + If (url Is Nothing) Then + Return "" + End If + + If ((url.IndexOf(Microsoft.VisualBasic.ChrW(61)) > 0)) Then + Dim queryString() As String = url.Split(Microsoft.VisualBasic.ChrW(61)) + Dim expression As String = queryString(1) + Dim encryptedValue As String = Encrypt(expression) + url = url.Replace(expression, encryptedValue) + + End If + Return url + End Function +#End Region + +#Region "Import Wizard methods" + Public Overridable Function GetPreviousURL() As String + Me.RemoveCurrentRequestFromSessionNavigationHistory() + + Dim snh As BaseClasses.Web.SessionNavigationHistory = Me.GetSessionNavigationHistory() + Dim prevUrl As String = Nothing + Dim toRemoveRequest As Boolean = False + If Not snh Is Nothing Then + Dim prevRequest As BaseClasses.Web.SessionNavigationHistory.RequestInfo = snh.GetCurrentRequest() + If (Not IsNothing(prevRequest)) Then + If (InvariantUCase(Me.Request.Url.PathAndQuery) <> InvariantUCase(prevRequest._Url.PathAndQuery)) Then + 'If it is different than the current URL, redirect to the previous request's URL + toRemoveRequest = True + prevUrl = prevRequest._Url.PathAndQuery + ElseIf ((Not IsNothing(prevRequest._UrlReferrer)) AndAlso _ + (InvariantUCase(Me.Request.Url.PathAndQuery) <> InvariantUCase(prevRequest._UrlReferrer.PathAndQuery))) Then + 'ElseIf it is different than the current URL, redirect to the previous request's URLReferrer + toRemoveRequest = True + prevUrl = prevRequest._UrlReferrer.PathAndQuery + End If + End If + End If + + If String.IsNullOrEmpty(prevUrl) Then + prevUrl = BaseClasses.Configuration.ApplicationSettings.Current.DefaultPageUrl + End If + Return prevUrl + End Function +#End Region + +#Region "Chart control initialization" + + + Public Const PIE As String = "Pie" + Public Const LINE As String = "Line" + Public Const BAR As String = "Bar" + Public Const COLUMN As String = "Column" + Public Const LabelInsideBar As String = "Label inside bar" + Public Const ValueAtBarEnd As String = "Value at bar end" + Public Const NothingInside As String = "Nothing" + + + ''' + ''' Creates chart control based on the passed parameters + ''' + ''' How thick the bar or column + ''' Bar, Column, Pie or Line + ''' If true - uses Palette, otherwise - single color. For Pie chart palette is used regardless of this parameter + ''' One of the palette in Windows.Forms.DataVisualization.ChartColorPalette + ''' One of the colors in Drawing.Color. Used for the bars, columns, or line + ''' One of the font familie as defined in Drawinf.FontFamily (string) + ''' color of the font used for all texts - labels and values (from Drawing.color) + ''' Background on the chart area. From Drawing.Color + ''' The color used on all grid lines and markers. From Drawing.Color + ''' Title of the chart + ''' Title on the Axis with labels + ''' Title on the axis with values + ''' Array of labels (String) + ''' Array of values (Decimal) + ''' If 0, label on the X axis is shown horizontally, if negative, it is tilted counter clock wize, if positive, + ''' tilted colck wise. Could be from -90 to 90. (degrees) + ''' Added to custom properties to series. To the list of supported properties refer to + ''' http://msdn.microsoft.com/en-us/library/dd456764.aspx + ''' + Public Overridable Sub InitializeChartControl(ByVal chartControl As Chart, _ + ByVal indexArray() As String, _ + ByVal valueArray() As Decimal, _ + ByVal barThickness As Integer, _ + ByVal chartType As String, _ + ByVal usePalette As Boolean, _ + ByVal palette As ChartColorPalette, _ + ByVal color As Drawing.Color, _ + ByVal backGroundColor As System.Drawing.Color, _ + ByVal gridColor As System.Drawing.Color, _ + ByVal fontFamily As String, _ + ByVal fontColor As System.Drawing.Color, _ + ByVal internalLabelColor As System.Drawing.Color, _ + ByVal showInsideBar As String, _ + ByVal title As String, _ + ByVal indexAxisTitle As String, _ + ByVal valueAxisTitle As String, _ + ByVal labelAngle As Integer, _ + ByVal generatePercentage As Boolean, _ + ByVal labelFormat As String, _ + ByVal customProperties As String) + + Dim args As New System.Collections.Generic.List(Of Object) + args.Add(chartControl) + args.Add(indexArray) + args.Add(valueArray) + args.Add(Nothing) + args.Add(Nothing) + args.Add(barThickness) + args.Add(chartType) + args.Add(usePalette) + args.Add(palette) + args.Add(color) + args.Add(backGroundColor) + args.Add(gridColor) + args.Add(fontFamily) + args.Add(fontColor) + args.Add(internalLabelColor) + args.Add(showInsideBar) + args.Add(title) + args.Add(indexAxisTitle) + args.Add(valueAxisTitle) + args.Add(labelAngle) + args.Add(generatePercentage) + args.Add(labelFormat) + args.Add("") + args.Add("") + args.Add("") + args.Add("") + args.Add("") + args.Add(customProperties) + InitializeChartControl(args.ToArray()) + End Sub + + + ''' + ''' Creates chart control based on the passed parameters + ''' + ''' parameters to initialize the chart + ''' http://msdn.microsoft.com/en-us/library/dd456764.aspx + ''' chart control or Nothing + Public Overridable Sub InitializeChartControl(ByVal args() As Object) + + Dim chartControl As Chart = Nothing + Dim indexArray() As String = Nothing + Dim valueArray() As Decimal = Nothing + Dim legendURLArray() As String = Nothing + Dim dataPointURLArray() As String = Nothing + Dim barThickness As Integer = 3 + Dim chartType As String = Nothing + Dim usePalette As Boolean = False + Dim palette As ChartColorPalette = ChartColorPalette.None + Dim color As Drawing.Color = Drawing.Color.White + Dim backGroundColor As System.Drawing.Color = Drawing.Color.White + Dim gridColor As System.Drawing.Color = Drawing.Color.Black + Dim fontFamily As String = Nothing + Dim fontColor As System.Drawing.Color = Drawing.Color.Black + Dim internalLabelColor As System.Drawing.Color = Drawing.Color.Black + Dim showInsideBar As String = "" + Dim title As String = "" + Dim indexAxisTitle As String = "" + Dim valueAxisTitle As String = "" + Dim labelAngle As Integer = 0 + Dim generatePercentage As Boolean = False + Dim labelFormat As String = Nothing + Dim chartTitleFontSize As String = "" + Dim axisTitleFontSize As String = "" + Dim scaleFontSize As String = "" + Dim labelInsideFontSize As String = "" + Dim customProperties As String = "" + + + If args.Length > 0 AndAlso args(0) IsNot Nothing Then + chartControl = DirectCast(args(0), Chart) + End If + If args.Length > 1 AndAlso args(1) IsNot Nothing Then + indexArray = DirectCast(args(1), String()) + End If + If args.Length > 2 AndAlso args(2) IsNot Nothing Then + valueArray = DirectCast(args(2), Decimal()) + End If + If args.Length > 3 AndAlso args(3) IsNot Nothing Then + legendURLArray = DirectCast(args(3), String()) + End If + If args.Length > 4 AndAlso args(4) IsNot Nothing Then + dataPointURLArray = DirectCast(args(4), String()) + End If + If args.Length > 5 AndAlso args(5) IsNot Nothing Then + barThickness = DirectCast(args(5), Integer) + End If + If args.Length > 6 AndAlso args(6) IsNot Nothing Then + chartType = DirectCast(args(6), String) + End If + If args.Length > 7 AndAlso args(7) IsNot Nothing Then + usePalette = DirectCast(args(7), Boolean) + End If + If args.Length > 8 AndAlso args(8) IsNot Nothing Then + palette = DirectCast(args(8), ChartColorPalette) + End If + If args.Length > 9 AndAlso args(9) IsNot Nothing Then + color = DirectCast(args(9), Drawing.Color) + End If + If args.Length > 10 AndAlso args(10) IsNot Nothing Then + backGroundColor = DirectCast(args(10), Drawing.Color) + End If + If args.Length > 11 AndAlso args(11) IsNot Nothing Then + gridColor = DirectCast(args(11), Drawing.Color) + End If + If args.Length > 12 AndAlso args(12) IsNot Nothing Then + fontFamily = DirectCast(args(12), String) + End If + If args.Length > 13 AndAlso args(13) IsNot Nothing Then + fontColor = DirectCast(args(13), Drawing.Color) + End If + If args.Length > 14 AndAlso args(14) IsNot Nothing Then + internalLabelColor = DirectCast(args(14), Drawing.Color) + End If + If args.Length > 15 AndAlso args(15) IsNot Nothing Then + showInsideBar = DirectCast(args(15), String) + End If + If args.Length > 16 AndAlso args(16) IsNot Nothing Then + title = DirectCast(args(16), String) + End If + If args.Length > 17 AndAlso args(17) IsNot Nothing Then + indexAxisTitle = DirectCast(args(17), String) + End If + If args.Length > 18 AndAlso args(18) IsNot Nothing Then + valueAxisTitle = DirectCast(args(18), String) + End If + If args.Length > 19 AndAlso args(19) IsNot Nothing Then + labelAngle = DirectCast(args(19), Integer) + End If + If args.Length > 20 AndAlso args(20) IsNot Nothing Then + generatePercentage = DirectCast(args(20), Boolean) + End If + If args.Length > 21 AndAlso args(21) IsNot Nothing Then + labelFormat = DirectCast(args(21), String) + End If + If args.Length > 22 AndAlso args(22) IsNot Nothing Then + chartTitleFontSize = DirectCast(args(22), String) + End If + If args.Length > 23 AndAlso args(23) IsNot Nothing Then + axisTitleFontSize = DirectCast(args(23), String) + End If + If args.Length > 24 AndAlso args(24) IsNot Nothing Then + scaleFontSize = DirectCast(args(24), String) + End If + If args.Length > 25 AndAlso args(25) IsNot Nothing Then + labelInsideFontSize = DirectCast(args(25), String) + End If + If args.Length > 26 AndAlso args(26) IsNot Nothing Then + customProperties = DirectCast(args(26), String) + End If + + + + 'Add chart area to the control + Dim baseChartAreaName As String = "ChartArea" + Dim chartAreaName As String = "ChartArea1" + If Not chartControl.ChartAreas Is Nothing AndAlso chartControl.ChartAreas.Count > 0 Then + Dim suffix As Integer = 1 + Dim found As Boolean = True + + While found AndAlso suffix < 100 + chartAreaName = baseChartAreaName & suffix.ToString() + found = False + For Each ca As ChartArea In chartControl.ChartAreas + If ca.Name = chartAreaName Then + found = True + suffix += 1 + Exit For + End If + Next + End While + If found Then Return + End If + Dim chartArea As ChartArea = chartControl.ChartAreas.Add(chartAreaName) + + chartArea.AxisX.TitleForeColor = fontColor + chartArea.AxisY.TitleForeColor = fontColor + + chartArea.AxisX.TitleFont = New System.Drawing.Font(fontFamily, If(Integer.TryParse(chartTitleFontSize, 0), Integer.Parse(axisTitleFontSize), chartArea.AxisX.TitleFont.Size)) + chartArea.AxisY.TitleFont = New System.Drawing.Font(fontFamily, If(Integer.TryParse(chartTitleFontSize, 0), Integer.Parse(axisTitleFontSize), chartArea.AxisY.TitleFont.Size)) + chartArea.AxisY.IsLabelAutoFit = True + chartArea.AxisX.IsLabelAutoFit = False + chartArea.AxisX.Interval = 1 + chartArea.AxisX.MajorGrid.LineColor = System.Drawing.Color.LightGray + chartArea.AxisY.MajorGrid.LineColor = System.Drawing.Color.LightGray + chartArea.AxisX.LabelStyle.ForeColor = fontColor + chartArea.AxisY.LabelStyle.ForeColor = fontColor + chartArea.AxisX.LabelStyle.Font = New System.Drawing.Font(fontFamily, If(Integer.TryParse(scaleFontSize, 0), Integer.Parse(scaleFontSize), chartArea.AxisX.LabelStyle.Font.Size)) + chartArea.AxisX.LineColor = gridColor + chartArea.AxisY.LineColor = gridColor + chartArea.AxisX.MajorTickMark.LineColor = gridColor + chartArea.AxisY.MajorTickMark.LineColor = gridColor + chartArea.AxisX.LabelStyle.Enabled = True + chartArea.AxisY.LabelStyle.Enabled = True + chartArea.AxisX.Title = indexAxisTitle + chartArea.AxisY.Title = valueAxisTitle + chartArea.AxisY.LabelStyle.Format = labelFormat + If generatePercentage Then + chartArea.AxisY.LabelStyle.Format = "0%" + End If + chartArea.AxisY.LabelStyle.Font = New System.Drawing.Font(fontFamily, If(Integer.TryParse(scaleFontSize, 0), Integer.Parse(scaleFontSize), chartArea.AxisY.LabelStyle.Font.Size)) + chartArea.BackColor = backGroundColor + 'Now add Series + Dim baseSeriesName As String = "Series" + Dim seriesName As String = "Series1" + If Not chartControl.Series Is Nothing AndAlso chartControl.Series.Count > 0 Then + Dim suffix As Integer = 1 + Dim found As Boolean = True + + While found AndAlso suffix < 100 + seriesName = baseSeriesName & suffix.ToString() + found = False + For Each s As Series In chartControl.Series + If s.Name = seriesName Then + found = True + suffix += 1 + Exit For + End If + Next + End While + If found Then Return + End If + Dim series As Series = chartControl.Series.Add(seriesName) + + series.ChartArea = chartAreaName + chartControl.Series(seriesName).Points.Clear() + chartControl.Series(seriesName).BackGradientStyle = GradientStyle.None + chartControl.Series(seriesName).BackHatchStyle = ChartHatchStyle.None + chartControl.Series(seriesName).Font = New System.Drawing.Font(fontFamily, 6) + chartControl.Series(seriesName).LabelForeColor = fontColor + chartControl.Series(seriesName).SmartLabelStyle.AllowOutsidePlotArea = LabelOutsidePlotAreaStyle.Yes + chartControl.AntiAliasing = AntiAliasingStyles.All + + If usePalette OrElse chartType = PIE Then + chartControl.Series(seriesName).Palette = palette + Else + chartControl.Series(seriesName).Color = color + End If + + Dim baseTitleName As String = "Title" + Dim TitleName As String = "Title1" + If Not chartControl.Titles Is Nothing AndAlso chartControl.Titles.Count > 0 Then + Dim suffix As Integer = 1 + Dim found As Boolean = True + + While found AndAlso suffix < 100 + TitleName = baseTitleName & suffix.ToString() + found = False + For Each t As Title In chartControl.Titles + If t.Name = TitleName Then + found = True + suffix += 1 + Exit For + End If + Next + End While + If found Then Return + End If + Dim titleIndex As Integer = chartControl.Titles.Count - 1 + chartControl.Titles.Add(TitleName).Text = title + titleIndex += 1 + chartControl.Titles(titleIndex).ForeColor = fontColor + chartControl.Titles(titleIndex).Font = New System.Drawing.Font(fontFamily, If(Integer.TryParse(chartTitleFontSize, 0), Integer.Parse(chartTitleFontSize), chartArea.AxisY.TitleFont.Size)) + + Dim dataSet As New System.Data.DataSet() + Dim seriesTable As New System.Data.DataTable() + Dim cProperties As String = customProperties + seriesTable.Columns.Add(New System.Data.DataColumn("X", GetType(String))) + If (labelFormat = "0") Then + seriesTable.Columns.Add(New System.Data.DataColumn("Y", GetType(Integer))) + Else + seriesTable.Columns.Add(New System.Data.DataColumn("Y", GetType(Double))) + End If + + 'Append cProperties with some style qualifiers + + If Not cProperties.ToLower.Contains("DrawingStyle".ToLower) Then + If Not String.IsNullOrEmpty(cProperties) AndAlso Not cProperties.EndsWith(",") Then cProperties &= "," + cProperties &= "DrawingStyle = Emboss" + End If + + If String.Equals(showInsideBar, LabelInsideBar, StringComparison.InvariantCultureIgnoreCase) AndAlso _ + chartType <> PIE Then + + If Not cProperties.ToLower.Contains("BarLabelStyle".ToLower) Then + If Not String.IsNullOrEmpty(cProperties) AndAlso Not cProperties.EndsWith(",") Then cProperties &= "," + cProperties &= "BarLabelStyle = Center" + End If + + End If + If chartType = PIE Then + If showInsideBar = ValueAtBarEnd Then + If Not cProperties.ToLower.Contains("PieLabelStyle".ToLower) Then + If Not String.IsNullOrEmpty(cProperties) AndAlso Not cProperties.EndsWith(",") Then cProperties &= "," + cProperties &= "PieLabelStyle = Outside" + End If + + Else + If Not cProperties.ToLower.Contains("PieLabelStyle".ToLower) Then + If Not String.IsNullOrEmpty(cProperties) AndAlso Not cProperties.EndsWith(",") Then cProperties &= "," + cProperties &= "PieLabelStyle = Inside" + End If + + End If + If Not cProperties.ToLower.Contains("PieDrawingStyle".ToLower) Then + If Not String.IsNullOrEmpty(cProperties) AndAlso Not cProperties.EndsWith(",") Then cProperties &= "," + cProperties &= "PieDrawingStyle = Concave" + End If + + End If + + Select Case chartType + Case BAR + chartArea.AxisY.LabelStyle.Angle = labelAngle + series.ChartType = SeriesChartType.Bar + If Not cProperties.ToLower.Contains("PixelPointWidth".ToLower) Then + Dim barWidth As String = "PixelPointWidth = " & barThickness + If Not String.IsNullOrEmpty(cProperties) AndAlso Not cProperties.EndsWith(",") Then cProperties &= "," + cProperties &= barWidth + End If + Case COLUMN + chartArea.AxisX.LabelStyle.Angle = labelAngle + series.ChartType = SeriesChartType.Column + If Not cProperties.ToLower.Contains("PixelPointWidth".ToLower) Then + Dim barWidth As String = "PixelPointWidth = " & barThickness + If Not String.IsNullOrEmpty(cProperties) AndAlso Not cProperties.EndsWith(",") Then cProperties &= "," + cProperties &= barWidth + End If + Case LINE + chartArea.AxisX.LabelStyle.Angle = labelAngle + series.ChartType = SeriesChartType.Line + Case PIE + chartControl.Series(seriesName).BorderColor = System.Drawing.Color.LightGray + chartControl.Series(seriesName).BorderWidth = 1 + series.ChartType = SeriesChartType.Pie + 'Construct Legend + Dim baseLegendName As String = "Legend" + Dim legendName As String = "Legend1" + If Not chartControl.Legends Is Nothing AndAlso chartControl.Legends.Count > 0 Then + Dim suffix As Integer = 1 + Dim found As Boolean = True + While found AndAlso suffix < 100 + legendName = baseLegendName & suffix.ToString() + found = False + For Each l As Legend In chartControl.Legends + If l.Name = legendName Then + found = True + suffix += 1 + Exit For + End If + Next + End While + If found Then Return + End If + Dim legend As System.Web.UI.DataVisualization.Charting.Legend = chartControl.Legends.Add(legendName) + legend.Title = indexAxisTitle + legend.ForeColor = fontColor + legend.TitleFont = New System.Drawing.Font(fontFamily, If(Integer.TryParse(axisTitleFontSize, 0), Integer.Parse(axisTitleFontSize), legend.TitleFont.Size)) + legend.Font = New System.Drawing.Font(fontFamily, If(Integer.TryParse(scaleFontSize, 0), Integer.Parse(scaleFontSize), legend.Font.Size)) + legend.TitleForeColor = chartArea.AxisX.TitleForeColor + End Select + chartControl.Series(seriesName).CustomProperties = cProperties + + 'Sanity check for label and value arrays. They should not be empty + If indexArray Is Nothing OrElse valueArray Is Nothing Then + Return + End If + + 'Add data to data table. For Bar chart add them in the reversed order + Dim dimention As Integer = indexArray.Length - 1 + If dimention > valueArray.Length - 1 Then dimention = valueArray.Length - 1 + If chartType = BAR Then + For i As Integer = dimention To 0 Step -1 + seriesTable.Rows.Add(New Object() {indexArray(i), Convert.ToDouble(valueArray(i))}) + Next + If legendURLArray IsNot Nothing AndAlso legendURLArray.Length > 0 Then + Array.Reverse(legendURLArray) + End If + If dataPointURLArray IsNot Nothing AndAlso dataPointURLArray.Length > 0 Then + Array.Reverse(dataPointURLArray) + End If + Else + For i As Integer = 0 To dimention + seriesTable.Rows.Add(New Object() {indexArray(i), Convert.ToDouble(valueArray(i))}) + Next + End If + + + dataSet.Tables.Add(seriesTable) + + series.BorderWidth = 2 + chartControl.Series(seriesName).XValueMember = "X" + chartControl.Series(seriesName).YValueMembers = "Y" + + chartControl.DataSource = dataSet + If chartControl.DataSource Is Nothing Then + Return + Else + chartControl.DataBind() + End If + + + + 'now when data bound to the chart, change some properties on particular elements (data points) of series + If chartType = PIE Then + For Each dp As DataPoint In chartControl.Series(seriesName).Points + If showInsideBar = ValueAtBarEnd Then + dp.LabelForeColor = fontColor + Else + dp.LabelForeColor = internalLabelColor + End If + + Dim value As Double = dp.YValues(0) + dp.Label = value.ToString(labelFormat) + If Not String.IsNullOrEmpty(dp.AxisLabel) Then + dp.LegendText = "#AXISLABEL" + Else + dp.LegendText = " " + End If + + Next + + For i As Integer = 0 To chartControl.Series(seriesName).Points.Count - 1 + Dim dp As DataPoint = chartControl.Series(seriesName).Points(i) + If legendURLArray IsNot Nothing AndAlso i < legendURLArray.Length Then + dp.LegendUrl = legendURLArray(i) + dp.LegendMapAreaAttributes = "target=""_blank""" + End If + If dataPointURLArray IsNot Nothing AndAlso i < dataPointURLArray.Length Then + dp.Url = dataPointURLArray(i) + dp.MapAreaAttributes = "target=""_blank""" + End If + dp.Font = New System.Drawing.Font(fontFamily, If(Integer.TryParse(scaleFontSize, 0), Integer.Parse(scaleFontSize), dp.Font.Size)) + + Next + + Else + If showInsideBar = ValueAtBarEnd Then + + ' find out the largest value to be shown + Dim largestValInChart As Decimal = Decimal.MinValue + For Each v As Decimal In valueArray + If largestValInChart < v Then + largestValInChart = v + End If + Next + + + For Each dp As DataPoint In chartControl.Series(seriesName).Points + dp.MarkerStyle = MarkerStyle.None + Dim value As Double = dp.YValues(0) + dp.Label = value.ToString(labelFormat) + dp.LabelForeColor = fontColor + dp.CustomProperties = "BarLabelStyle = Outside" + + ' for small value, show the label outside + ' for large value, show the label inside + If chartType = BAR AndAlso (largestValInChart / 2) < value Then + dp.LabelForeColor = internalLabelColor + dp.CustomProperties = "BarLabelStyle = Right" + End If + Next + ElseIf showInsideBar = LabelInsideBar Then + If chartControl.Series(seriesName).Points.Count = indexArray.Length Then + Dim index As Integer = 0 + Dim increment As Integer = 1 + Dim lColor As Drawing.Color = fontColor + chartArea.AxisX.LabelStyle.Enabled = False + If chartType = BAR Then + lColor = internalLabelColor + index = indexArray.Length - 1 + increment = -1 + End If + For Each dp As DataPoint In chartControl.Series(seriesName).Points + dp.MarkerStyle = MarkerStyle.None + dp.CustomProperties = "BarLabelStyle = Center" + dp.LabelForeColor = lColor + dp.Label = indexArray(index) + index += increment + Next + End If + End If + For i As Integer = 0 To chartControl.Series(seriesName).Points.Count - 1 + Dim dp As DataPoint = chartControl.Series(seriesName).Points(i) + If String.IsNullOrEmpty(dp.AxisLabel) Then + dp.AxisLabel = " " + End If + If legendURLArray IsNot Nothing AndAlso i < legendURLArray.Length Then + dp.LegendUrl = legendURLArray(i) + dp.LegendMapAreaAttributes = "target=""_blank""" + End If + If dataPointURLArray IsNot Nothing AndAlso i < dataPointURLArray.Length Then + dp.Url = dataPointURLArray(i) + dp.MapAreaAttributes = "target=""_blank""" + End If + dp.Font = New System.Drawing.Font(fontFamily, If(Integer.TryParse(labelInsideFontSize, 0), Integer.Parse(labelInsideFontSize), dp.Font.Size)) + + Next + End If + End Sub + +#End Region + + End Class + +End Namespace diff --git a/App_Code/Shared/BaseApplicationRecordControl.vb b/App_Code/Shared/BaseApplicationRecordControl.vb new file mode 100644 index 0000000..d6f6d57 --- /dev/null +++ b/App_Code/Shared/BaseApplicationRecordControl.vb @@ -0,0 +1,414 @@ +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Utils +Imports BaseClasses.Utils.StringUtils + +Namespace Persons.UI + + ' Typical customizations that may be done in this class include + ' - adding custom event handlers + ' - overriding base class methods + + ''' + ''' The superclass (i.e. base class) for all Designer-generated record controls in this application. + ''' + ''' + ''' + ''' + ''' + + Public Class BaseApplicationRecordControl + Inherits System.Web.UI.Control + + ''' Allow for migration from earlier versions which did not have url encryption. + Public Overridable Function ModifyRedirectUrl(ByVal redirectUrl As String, ByVal redirectArgument As String) As String + Throw New Exception("This function should be implemented by inherited record control class.") + End Function + + Public Overridable Function ModifyRedirectUrl(ByVal redirectUrl As String, ByVal redirectArgument As String, ByVal bEncrypt As Boolean) As String + Throw New Exception("This function should be implemented by inherited record control class.") + End Function + + Public Overridable Function EvaluateExpressions(ByVal redirectUrl As String, ByVal redirectArgument As String, ByVal bEncrypt As Boolean) As String + Throw New Exception("This function should be implemented by inherited record control class.") + End Function + + ''' Allow for migration from earlier versions which did not have url encryption. + Public Overridable Function ModifyRedirectUrl(ByVal redirectUrl As String, ByVal redirectArgument As String, ByVal rec As IRecord) As String + Return EvaluateExpressions(redirectUrl, redirectArgument, rec, False) + End Function + + Public Overridable Function ModifyRedirectUrl(ByVal redirectUrl As String, ByVal redirectArgument As String, ByVal rec As IRecord, ByVal bEncrypt As Boolean) As String + Return EvaluateExpressions(redirectUrl, redirectArgument, rec, bEncrypt) + End Function + + Public Overridable Function EvaluateExpressions(ByVal redirectUrl As String, ByVal redirectArgument As String, ByVal rec As IRecord, ByVal bEncrypt As Boolean) As String + Const PREFIX_NO_ENCODE As String = "NoUrlEncode:" + + Dim finalRedirectUrl As String = redirectUrl + Dim finalRedirectArgument As String = redirectArgument + + If (finalRedirectUrl Is Nothing OrElse finalRedirectUrl.Trim = "") Then + Return finalRedirectUrl + ElseIf (finalRedirectUrl.IndexOf("{"c) < 0) Then + Return finalRedirectUrl + Else + 'The old way was to pass separate URL and arguments and use String.Format to + 'do the replacement. Example: + ' URL: EditProductsRecord?Products={0} + ' Argument: PK + 'The new way to is pass the arguments directly in the URL. Example: + ' URL: EditProductsRecord?Products={PK} + 'If the old way is passsed, convert it to the new way. + If (Len(finalRedirectArgument) > 0) Then + Dim arguments() As String = Split(finalRedirectArgument, ",") + Dim i As Integer + For i = 0 To (arguments.Length - 1) + finalRedirectUrl = finalRedirectUrl.Replace("{" & i.ToString & "}", "{" & arguments(i) & "}") + Next + finalRedirectArgument = "" + End If + + 'Evaluate all of the expressions in the RedirectURL + 'Expressions can be of the form [ControlName:][NoUrlEncode:]Key[:Value] + Dim remainingUrl As String = finalRedirectUrl + + While (remainingUrl.IndexOf("{"c) >= 0) And (remainingUrl.IndexOf("}"c) > 0) And _ + (remainingUrl.IndexOf("{"c) < remainingUrl.IndexOf("}"c)) + + Dim leftIndex As Integer = remainingUrl.IndexOf("{"c) + Dim rightIndex As Integer = remainingUrl.IndexOf("}"c) + Dim expression As String = remainingUrl.Substring(leftIndex + 1, rightIndex - leftIndex - 1) + Dim origExpression As String = expression + remainingUrl = remainingUrl.Substring(rightIndex + 1) + + Dim skip As Boolean = False + Dim returnEmptyStringOnFail As Boolean = False + Dim prefix As String = Nothing + + 'Check to see if this control must evaluate the expression + If (expression.IndexOf(":") > 0) Then + prefix = expression.Substring(0, expression.IndexOf(":")) + End If + If (Not IsNothing(prefix)) AndAlso (prefix.Length > 0) AndAlso _ + (Not (InvariantLCase(prefix) = InvariantLCase(PREFIX_NO_ENCODE))) AndAlso _ + (Not BaseRecord.IsKnownExpressionPrefix(prefix)) Then + + 'Remove the ASCX Prefix + Dim IdString As String = Me.ID + If IdString.StartsWith("_") Then + IdString = IdString.Remove(0, 1) + End If + 'The prefix is a control name. + If (prefix = IdString) Then + 'This control is responsible for evaluating the expression, + 'so if it can't be evaluated then return an empty string. + returnEmptyStringOnFail = True + expression = expression.Substring(expression.IndexOf(":") + 1) + Else + 'It's not for this control to evaluate so skip. + skip = True + End If + End If + + If (Not skip) Then + Dim bUrlEncode As Boolean = True + If (InvariantLCase(expression).StartsWith(InvariantLCase(PREFIX_NO_ENCODE))) Then + bUrlEncode = False + expression = expression.Substring(PREFIX_NO_ENCODE.Length) + End If + Dim result As Object = Nothing + Try + If (Not IsNothing(rec)) Then + result = rec.EvaluateExpression(expression) + End If + Catch ex As Exception + 'Fall through + End Try + + If (Not IsNothing(result)) Then + result = result.ToString() + End If + If (IsNothing(result)) Then + If (Not returnEmptyStringOnFail) Then + Return finalRedirectUrl + Else + result = String.Empty + End If + End If + If (bUrlEncode) Then + result = System.Web.HttpUtility.UrlEncode(DirectCast(result, String)) + If (IsNothing(result)) Then + result = String.Empty + End If + End If + If (bEncrypt) Then + If Not (IsNothing(result)) Then + result = DirectCast(Me.Page, BaseApplicationPage).Encrypt(DirectCast(result, String)) + End If + End If + + finalRedirectUrl = finalRedirectUrl.Replace("{" & origExpression & "}", DirectCast(result, String)) + End If + End While + End If + + 'If there are still expressions to evaluate. Forward to the page for further processing. + Return finalRedirectUrl + End Function + + ''' + ''' Get the Id of the parent table control. We navigate up the chain of + ''' controls until we find the table control. Note that the first table + ''' control above the record control would be the parent. You cannot have + ''' a record control embedded in a different parent control other than its parent. + ''' + ''' The Id of the parent table control. + Public Overridable Function GetParentTableControlID() As String + Dim parent As BaseApplicationTableControl = Me.GetParentTableControl() + If Not (IsNothing(parent)) Then Return parent.ID + Return "" + End Function + +#Region " Methods to manage saving and retrieving control values to session. " + Protected Sub Control_SaveControls_Unload(ByVal sender As Object, ByVal e As EventArgs) Handles MyBase.Unload + If DirectCast(Me.Page, BaseApplicationPage).ShouldSaveControlsToSession Then + Me.SaveControlsToSession() + End If + End Sub + + Protected Overridable Sub SaveControlsToSession() + End Sub + + Protected Sub Control_ClearControls_PreRender(ByVal sender As Object, ByVal e As EventArgs) Handles MyBase.PreRender + Me.ClearControlsFromSession() + End Sub + + Protected Overridable Sub ClearControlsFromSession() + End Sub + + Public Sub SaveToSession( _ + ByVal control As Control, _ + ByVal value As String) + + SaveToSession(control.UniqueID, value) + End Sub + + Public Function GetFromSession( _ + ByVal control As Control, _ + ByVal defaultValue As String) As String + + Return GetFromSession(control.UniqueID, defaultValue) + End Function + + Public Function GetFromSession(ByVal control As Control) As String + Return GetFromSession(control.UniqueID, Nothing) + End Function + + Public Sub RemoveFromSession(ByVal control As Control) + RemoveFromSession(control.UniqueID) + End Sub + + Public Function InSession(ByVal control As Control) As Boolean + Return InSession(control.UniqueID) + End Function + + Public Sub SaveToSession( _ + ByVal control As Control, _ + ByVal variable As String, _ + ByVal value As String) + + SaveToSession(control.UniqueID & variable, value) + End Sub + + Public Function GetFromSession( _ + ByVal control As Control, _ + ByVal variable As String, _ + ByVal defaultValue As String) As String + + Return GetFromSession(control.UniqueID & variable, defaultValue) + End Function + + Public Sub RemoveFromSession( _ + ByVal control As Control, _ + ByVal variable As String) + + RemoveFromSession(control.UniqueID & variable) + End Sub + + Public Function InSession( _ + ByVal control As Control, _ + ByVal variable As String) As Boolean + + Return InSession(control.UniqueID & variable) + End Function + + Public Sub SaveToSession( _ + ByVal name As String, _ + ByVal value As String) + + Me.Page.Session()(GetValueKey(name)) = value + End Sub + + Public Function GetFromSession( _ + ByVal name As String, _ + ByVal defaultValue As String) As String + + Dim value As String = CType(Me.Page.Session()(GetValueKey(name)), String) + If value Is Nothing OrElse value.Trim() = "" Then + value = defaultValue + End If + + Return value + End Function + + Public Function GetFromSession(ByVal name As String) As String + Return GetFromSession(name, Nothing) + End Function + + Public Sub RemoveFromSession(ByVal name As String) + Me.Page.Session.Remove(GetValueKey(name)) + End Sub + + Public Function InSession(ByVal name As String) As Boolean + Return (Not Me.Page.Session(GetValueKey(name)) Is Nothing) + End Function + + Public Function GetValueKey(ByVal name As String) As String + Return Me.Page.Session.SessionID & Me.Page.AppRelativeVirtualPath & name + End Function +#End Region + + ''' + ''' Get the parent table control. We navigate up the chain of + ''' controls until we find the table control. Note that the first table + ''' control above the record control would be the parent. You cannot have + ''' a record control embedded in a different parent control other than its parent. + ''' + ''' The Id of the parent table control. + Public Overridable Function GetParentTableControl() As BaseApplicationTableControl + Try + Dim parent As Control = Me.Parent + While Not (IsNothing(parent)) + If TypeOf parent Is BaseApplicationTableControl Then + Return CType(parent, BaseApplicationTableControl) + End If + parent = parent.Parent + End While + Catch ex As Exception + ' Ignore and return Nothing + End Try + Return Nothing + End Function + + ''' + ''' The row number of this record control within the table control. + ''' This function is called as {TableName}TableControlRow.ROWNUM(). + ''' To make sure all the formula functions are in the same location, we call + ''' the ROWNUM function in the FormulaUtils class, which actually does the work + ''' and return the value. The function in FormulaUtils will need to know the + ''' TableControl, so it is passed as the first instance. + ''' The row number is 1 based. + ''' + ''' The row number of this row relative to the other rows in the table control. + Public Function RowNum() As Decimal + Return FormulaUtils.RowNum(Me.GetParentTableControl(), Me) + End Function + + ''' + ''' The rank of this field relative to other fields in the table control. + ''' This function is called as {TableName}TableControlRow.RANK(). + ''' Say there are 5 rows and they contain 57, 32, 12, 19, 98. + ''' Their respecitive ranks will be 4, 3, 1, 2, 5 + ''' To make sure all the formula functions are in the same location, we call + ''' the RANK function in the FormulaUtils class, which actually does the work + ''' and return the value. The function in FormulaUtils will need to know the + ''' TableControl, so it is passed as the first instance. + ''' The rank is 1 based. + ''' + ''' The string name of the UI control (e.g., "UnitPrice") + ''' The rank of this row relative to the other rows in the table control.. + Public Function Rank(ByVal controlName As String) As Decimal + Return FormulaUtils.Rank(Me.GetParentTableControl(), Me, controlName) + End Function + + ''' + ''' The running total of the field. + ''' This function is called as {TableName}TableControlRow.RUNNINGTOTAL(). + ''' Say there are 5 rows and they contain 57, 32, 12, 19, 98. + ''' The respecitive values for running totals will be be 57, 89, 101, 120, 218 + ''' To make sure all the formula functions are in the same location, we call + ''' the RUNNINGTOTAL function in the FormulaUtils class, which actually does the work + ''' and return the value. The function in FormulaUtils will need to know the + ''' TableControl, so it is passed as the first instance. + ''' + ''' The string name of the UI control (e.g., "UnitPrice") + ''' The running total of the row. + Public Function RunningTotal(ByVal controlName As String) As Decimal + Return FormulaUtils.RunningTotal(Me.GetParentTableControl(), Me, controlName) + End Function + + ''' + ''' Store the UI data within the current record or row control and return as hashtable + ''' + ''' + ''' + Public Overridable Function PreservedUIData() As Hashtable + ' This method get the UI data within the current record and return them as Hastable + Dim uiData As New Hashtable + + + Dim controls() As Control = BaseClasses.Utils.MiscUtils.FindControlsRecursively(Me) + + For Each control As Control In controls + If control.ID <> "" AndAlso Not uiData.ContainsKey(control.ID) Then + If control.GetType() Is GetType(TextBox) Then + Dim textbox As TextBox = DirectCast(control, TextBox) + uiData.Add(textbox.ID, textbox.Text) + ElseIf control.GetType() Is GetType(Literal) Then + Dim literal As Literal = DirectCast(control, Literal) + uiData.Add(literal.ID, literal.Text) + ElseIf control.GetType() Is GetType(Label) Then + Dim label As Label = DirectCast(control, Label) + uiData.Add(label.ID, label.Text) + ElseIf control.GetType() Is GetType(CheckBox) Then + Dim checkbox As CheckBox = DirectCast(control, CheckBox) + uiData.Add(checkbox.ID, checkbox.Checked) + ElseIf control.GetType() Is GetType(Button) Then + Dim button As Button = DirectCast(control, Button) + uiData.Add(button.ID, button.Text) + ElseIf control.GetType() Is GetType(LinkButton) Then + Dim linkButton As LinkButton = DirectCast(control, LinkButton) + uiData.Add(linkButton.ID, linkButton.Text) + ElseIf control.GetType() Is GetType(ListBox) Then + Dim listbox As ListBox = DirectCast(control, ListBox) + uiData.Add(listbox.ID, GetValueSelectedPageRequest(listbox)) + ElseIf control.GetType() Is GetType(DropDownList) Then + Dim dropdownList As DropDownList = DirectCast(control, DropDownList) + uiData.Add(dropdownList.ID, GetValueSelectedPageRequest(dropdownList)) + ElseIf control.GetType() Is GetType(DropDownList) Then + Dim radioButtonList As RadioButtonList = DirectCast(control, RadioButtonList) + uiData.Add(radioButtonList.ID, GetValueSelectedPageRequest(radioButtonList)) + ElseIf control.GetType().GetInterface("IDatePagination") IsNot Nothing OrElse _ + control.GetType().GetInterface("IDatePaginationMobile") IsNot Nothing Then + ' Save the pagination's Interval and FirstStartDate and restore it by these values later + Dim props() As System.Reflection.PropertyInfo = control.GetType().GetProperties() + Dim ht As New Hashtable + For Each prop As System.Reflection.PropertyInfo In props + Dim descriptor As System.ComponentModel.PropertyDescriptor = System.ComponentModel.TypeDescriptor.GetProperties(control.GetType())(prop.Name) + If descriptor.Name = "Interval" Then + ht.Add("Interval", prop.GetValue(control, Nothing).ToString()) + ElseIf descriptor.Name = "FirstStartDate" Then + ht.Add("FirstStartDate", prop.GetValue(control, Nothing).ToString()) + End If + Next + uiData.Add(control.ID, ht) + End If + End If + Next + Return uiData + End Function + + End Class + +End Namespace diff --git a/App_Code/Shared/BaseApplicationTableControl.vb b/App_Code/Shared/BaseApplicationTableControl.vb new file mode 100644 index 0000000..b909975 --- /dev/null +++ b/App_Code/Shared/BaseApplicationTableControl.vb @@ -0,0 +1,531 @@ + +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Utils.StringUtils + + Namespace Persons.UI + + ' Typical customizations that may be done in this class include + ' - adding custom event handlers + ' - overriding base class methods + + ''' + ''' The superclass (i.e. base class) for all Designer-generated pages in this application. + ''' + ''' + ''' + ''' + ''' + + + Public Class BaseApplicationTableControl + Inherits System.Web.UI.Control + + ''' + ''' The name of the row controls. By convention, "Row" is appended to the + ''' end of the name of the table control. So OrdersTableControl will have + ''' OrdersTableControlRow controls. + ''' + Public Overridable ReadOnly Property RowName() As String + Get + Return Me.ID & "Row" + End Get + End Property + + ''' + ''' The name of the repeater controls. By convention, "Repeater" is appended to the + ''' end of the name of the table control. So OrdersTableControl will have + ''' OrdersTableControlRepeater controls. The Row controls defined above are + ''' within the Repeater control. + ''' + Public Overridable ReadOnly Property RepeaterName() As String + Get + Return Me.ID & "Repeater" + End Get + End Property + + ''' Allow for migration from earlier versions which did not have url encryption. + Public Overridable Function ModifyRedirectUrl(ByVal redirectUrl As String, ByVal redirectArgument As String) As String + Throw New Exception("This function should be implemented by inherited table control class.") + End Function + + Public Overridable Function ModifyRedirectUrl(ByVal redirectUrl As String, ByVal redirectArgument As String, ByVal bEncrypt As Boolean) As String + Throw New Exception("This function should be implemented by inherited table control class.") + End Function + + Public Overridable Function EvaluateExpressions(ByVal redirectUrl As String, ByVal redirectArgument As String, ByVal bEncrypt As Boolean) As String + Throw New Exception("This function should be implemented by inherited table control class.") + End Function + + ''' Allow for migration from earlier versions which did not have url encryption. + Public Overridable Function ModifyRedirectUrl(ByVal redirectUrl As String, ByVal redirectArgument As String, ByVal rec As IRecord) As String + Return EvaluateExpressions(redirectUrl, redirectArgument, rec, False) + End Function + + Public Overridable Function ModifyRedirectUrl(ByVal redirectUrl As String, ByVal redirectArgument As String, ByVal rec As IRecord, ByVal bEncrypt As Boolean) As String + Return EvaluateExpressions(redirectUrl, redirectArgument, rec, bEncrypt) + End Function + + Public Overridable Function EvaluateExpressions(ByVal redirectUrl As String, ByVal redirectArgument As String, ByVal rec As IRecord, ByVal bEncrypt As Boolean) As String + Const PREFIX_NO_ENCODE As String = "NoUrlEncode:" + + Dim finalRedirectUrl As String = redirectUrl + Dim finalRedirectArgument As String = redirectArgument + + If (finalRedirectUrl Is Nothing OrElse finalRedirectUrl.Trim = "") Then + Return finalRedirectUrl + ElseIf (finalRedirectUrl.IndexOf("{"c) < 0) Then + Return finalRedirectUrl + Else + 'The old way was to pass separate URL and arguments and use String.Format to + 'do the replacement. Example: + ' URL: EditProductsRecord?Products={0} + ' Argument: PK + 'The new way to is pass the arguments directly in the URL. Example: + ' URL: EditProductsRecord?Products={PK} + 'If the old way is passsed, convert it to the new way. + If (Len(finalRedirectArgument) > 0) Then + Dim arguments() As String = Split(finalRedirectArgument, ",") + Dim i As Integer + For i = 0 To (arguments.Length - 1) + finalRedirectUrl = finalRedirectUrl.Replace("{" & i.ToString & "}", "{" & arguments(i) & "}") + Next + finalRedirectArgument = "" + End If + + 'Evaluate all of the expressions in the RedirectURL + 'Expressions can be of the form [ControlName:][NoUrlEncode:]Key[:Value] + Dim remainingUrl As String = finalRedirectUrl + + While (remainingUrl.IndexOf("{"c) >= 0) And (remainingUrl.IndexOf("}"c) > 0) And _ + (remainingUrl.IndexOf("{"c) < remainingUrl.IndexOf("}"c)) + + Dim leftIndex As Integer = remainingUrl.IndexOf("{"c) + Dim rightIndex As Integer = remainingUrl.IndexOf("}"c) + Dim expression As String = remainingUrl.Substring(leftIndex + 1, rightIndex - leftIndex - 1) + Dim origExpression As String = expression + remainingUrl = remainingUrl.Substring(rightIndex + 1) + + Dim skip As Boolean = False + Dim returnEmptyStringOnFail As Boolean = False + Dim prefix As String = Nothing + + 'Check to see if this control must evaluate the expression + If (expression.IndexOf(":") > 0) Then + prefix = expression.Substring(0, expression.IndexOf(":")) + End If + If (Not IsNothing(prefix)) AndAlso (prefix.Length > 0) AndAlso _ + (Not (InvariantLCase(prefix) = InvariantLCase(PREFIX_NO_ENCODE))) AndAlso _ + (Not BaseRecord.IsKnownExpressionPrefix(prefix)) Then + + 'Remove the ASCX Prefix + Dim IdString As String = Me.ID + If IdString.StartsWith("_") Then + IdString = IdString.Remove(0, 1) + End If + 'The prefix is a control name. + If (prefix = IdString) Then + 'This control is responsible for evaluating the expression, + 'so if it can't be evaluated then return an empty string. + returnEmptyStringOnFail = True + expression = expression.Substring(expression.IndexOf(":") + 1) + Else + 'It's not for this control to evaluate so skip. + skip = True + End If + End If + + If (Not skip) Then + Dim bUrlEncode As Boolean = True + If (InvariantLCase(expression).StartsWith(InvariantLCase(PREFIX_NO_ENCODE))) Then + bUrlEncode = False + expression = expression.Substring(PREFIX_NO_ENCODE.Length) + End If + Dim result As Object = Nothing + Try + If (Not IsNothing(rec)) Then + result = rec.EvaluateExpression(expression) + End If + Catch ex As Exception + 'Fall through + End Try + + If (Not IsNothing(result)) Then + result = result.ToString() + End If + If (IsNothing(result)) Then + If (Not returnEmptyStringOnFail) Then + Return finalRedirectUrl + Else + result = String.Empty + End If + End If + If (bUrlEncode) Then + result = System.Web.HttpUtility.UrlEncode(DirectCast(result, String)) + If (IsNothing(result)) Then + result = String.Empty + End If + End If + If (bEncrypt) Then + If Not (IsNothing(result)) Then + result = DirectCast(Me.Page, BaseApplicationPage).Encrypt(DirectCast(result, String)) + End If + End If + finalRedirectUrl = finalRedirectUrl.Replace("{" & origExpression & "}", DirectCast(result, String)) + End If + End While + End If + + 'If there are still expressions to evaluate. Forward to the page for further processing. + Return finalRedirectUrl + End Function + + Public Function AreAnyUrlParametersForMe(ByVal url As String, ByVal arg As String) As Boolean + Const PREFIX_NO_ENCODE As String = "NoUrlEncode:" + Dim finalRedirectUrl As String = url + Dim finalRedirectArgument As String = arg + If (Len(finalRedirectArgument) > 0) Then + Dim arguments() As String = Split(finalRedirectArgument, ",") + Dim i As Integer + For i = 0 To (arguments.Length - 1) + finalRedirectUrl = finalRedirectUrl.Replace("{" & i.ToString & "}", "{" & arguments(i) & "}") + Next + finalRedirectArgument = "" + End If + + 'Evaluate all of the expressions in the RedirectURL + 'Expressions can be of the form [ControlName:][NoUrlEncode:]Key[:Value] + Dim remainingUrl As String = finalRedirectUrl + Dim skip As Boolean = False + While (remainingUrl.IndexOf("{"c) >= 0) And (remainingUrl.IndexOf("}"c) > 0) And _ + (remainingUrl.IndexOf("{"c) < remainingUrl.IndexOf("}"c)) + + Dim leftIndex As Integer = remainingUrl.IndexOf("{"c) + Dim rightIndex As Integer = remainingUrl.IndexOf("}"c) + Dim expression As String = remainingUrl.Substring(leftIndex + 1, rightIndex - leftIndex - 1) + Dim origExpression As String = expression + remainingUrl = remainingUrl.Substring(rightIndex + 1) + + Dim returnEmptyStringOnFail As Boolean = False + Dim prefix As String = Nothing + + 'Check to see if this control must evaluate the expression + If (expression.IndexOf(":") > 0) Then + prefix = expression.Substring(0, expression.IndexOf(":")) + End If + If (Not IsNothing(prefix)) AndAlso (prefix.Length > 0) AndAlso _ + (Not (InvariantLCase(prefix) = InvariantLCase(PREFIX_NO_ENCODE))) AndAlso _ + (Not BaseRecord.IsKnownExpressionPrefix(prefix)) Then + 'The prefix is a control name. + If (prefix = Me.ID) Then + skip = False + Exit While + Else + 'It's not for this control to evaluate so skip. + skip = True + End If + End If + End While + + If skip Then + Return False + End If + Return True + + End Function + +#Region " Methods to manage saving and retrieving control values to session. " + Protected Sub Control_SaveControls_Unload(ByVal sender As Object, ByVal e As EventArgs) Handles MyBase.Unload + If DirectCast(Me.Page, BaseApplicationPage).ShouldSaveControlsToSession Then + Me.SaveControlsToSession() + End If + End Sub + + Protected Overridable Sub SaveControlsToSession() + End Sub + + Protected Sub Control_ClearControls_PreRender(ByVal sender As Object, ByVal e As EventArgs) Handles MyBase.PreRender + Me.ClearControlsFromSession() + End Sub + + Protected Overridable Sub ClearControlsFromSession() + End Sub + + Public Sub SaveToSession( _ + ByVal control As Control, _ + ByVal value As String) + + SaveToSession(control.UniqueID, value) + End Sub + + Public Function GetFromSession( _ + ByVal control As Control, _ + ByVal defaultValue As String) As String + + Return GetFromSession(control.UniqueID, defaultValue) + End Function + + Public Function GetFromSession(ByVal control As Control) As String + Return GetFromSession(control.UniqueID, Nothing) + End Function + + Public Sub RemoveFromSession(ByVal control As Control) + RemoveFromSession(control.UniqueID) + End Sub + + Public Function InSession(ByVal control As Control) As Boolean + Return InSession(control.UniqueID) + End Function + + Public Sub SaveToSession( _ + ByVal control As Control, _ + ByVal variable As String, _ + ByVal value As String) + + SaveToSession(control.UniqueID & variable, value) + End Sub + + Public Function GetFromSession( _ + ByVal control As Control, _ + ByVal variable As String, _ + ByVal defaultValue As String) As String + + Return GetFromSession(control.UniqueID & variable, defaultValue) + End Function + + Public Sub RemoveFromSession( _ + ByVal control As Control, _ + ByVal variable As String) + + RemoveFromSession(control.UniqueID & variable) + End Sub + + Public Function InSession( _ + ByVal control As Control, _ + ByVal variable As String) As Boolean + + Return InSession(control.UniqueID & variable) + End Function + + Public Sub SaveToSession( _ + ByVal name As String, _ + ByVal value As String) + + Me.Page.Session()(GetValueKey(name)) = value + End Sub + + Public Function GetFromSession( _ + ByVal name As String, _ + ByVal defaultValue As String) As String + + Dim value As String = CType(Me.Page.Session()(GetValueKey(name)), String) + If value Is Nothing OrElse value.Trim() = "" Then + value = defaultValue + End If + + Return value + End Function + + Public Function GetFromSession(ByVal name As String) As String + Return GetFromSession(name, Nothing) + End Function + + Public Sub RemoveFromSession(ByVal name As String) + Me.Page.Session.Remove(GetValueKey(name)) + End Sub + + Public Function InSession(ByVal name As String) As Boolean + Return (Not Me.Page.Session(GetValueKey(name)) Is Nothing) + End Function + + Public Function GetValueKey(ByVal name As String) As String + Return Me.Page.Session.SessionID & Me.Page.AppRelativeVirtualPath & name + End Function +#End Region + + ''' + ''' This function returns the list of record controls within the table control. + ''' There is a more specific GetRecordControls function generated in the + ''' derived classes, but in some cases, we do not know the specific type of + ''' the table control, so we need to call this method. This is also used by the + ''' Formula evaluator to perform Sum, Count and CountA functions. + ''' + Public Function GetBaseRecordControls() As BaseApplicationRecordControl() + Dim recList As ArrayList = New ArrayList() + + ' First get the repeater inside the Table Control. + Dim rep As System.Web.UI.WebControls.Repeater = CType(Me.FindControl(Me.RepeaterName), System.Web.UI.WebControls.Repeater) + If IsNothing(rep) OrElse IsNothing(rep.Items) Then Return Nothing + + ' We now go inside the repeater to find all the record controls. + ' Note that we only find the first level record controls. We do not + ' descend down and find other record controls belonging to tables-inside-table. + Dim repItem As System.Web.UI.WebControls.RepeaterItem + + For Each repItem In rep.Items + Dim recControl As BaseApplicationRecordControl = DirectCast(repItem.FindControl(Me.RowName), BaseApplicationRecordControl) + If Not (IsNothing(recControl)) Then recList.Add(recControl) + Next + + Return DirectCast(recList.ToArray(GetType(BaseApplicationRecordControl)), BaseApplicationRecordControl()) + End Function + + ''' + ''' Sum the values of the displayed controls. The controlName must be + ''' a textbox, label or literal. + ''' This function is called as [Products]TableControl.SUM("UnitPrice"). + ''' To make sure all the formula functions are in the same location, we call + ''' the SUM function in the FormulaUtils class, which actually does the work + ''' and return the value. The function in FormulaUtils will need to know the + ''' TableControl, so it is passed as the first instance. + ''' + ''' The string name of the UI control (e.g., "UnitPrice") + ''' The total of adding the value contained in each of the fields. + Public Function Sum(ByVal controlName As String) As Decimal + Return FormulaUtils.Sum(Me, controlName) + End Function + + ''' + ''' Sum the values of the displayed controls. The controlName must be + ''' a textbox, label or literal. + ''' This function is called as [Products]TableControl.TOTAL("UnitPrice"). + ''' To make sure all the formula functions are in the same location, we call + ''' the TOTAL function in the FormulaUtils class, which actually does the work + ''' and return the value. The function in FormulaUtils will need to know the + ''' TableControl, so it is passed as the first instance. + ''' + ''' The string name of the UI control (e.g., "UnitPrice") + ''' The total of adding the value contained in each of the fields. + Public Function Total(ByVal controlName As String) As Decimal + Return FormulaUtils.Total(Me, controlName) + End Function + + ''' + ''' Finds the maximum among the values of the displayed controls. The ctlName must be + ''' a textbox, label or literal. + ''' This function should be called as [Products]TableControl.Max("UnitPrice"), not + ''' as shown here. The MAX function in the BaseApplicationTableControl will call this + ''' function to actually perform the work - so that we can keep all of the formula + ''' functions together in one place. + ''' + ''' The string name of the UI control (e.g., "UnitPrice") + ''' The maximum among the values contained in each of the fields. + Public Function Max(ByVal ctlName As String) As Decimal + Return FormulaUtils.Max(Me, ctlName) + End Function + + ''' + ''' Finds the minimum among the values of the displayed controls. The ctlName must be + ''' a textbox, label or literal. + ''' This function should be called as [Products]TableControl.Min("UnitPrice"), not + ''' as shown here. The MIN function in the BaseApplicationTableControl will call this + ''' function to actually perform the work - so that we can keep all of the formula + ''' functions together in one place. + ''' + ''' The string name of the UI control (e.g., "UnitPrice") + ''' The minimum among the values contained in each of the fields. + Public Function Min(ByVal ctlName As String) As Decimal + Return FormulaUtils.Min(Me, ctlName) + End Function + + ''' + ''' Count the number of rows in the table control. + ''' This function is called as [Products]TableControl.COUNT(). + ''' To make sure all the formula functions are in the same location, we call + ''' the COUNT function in the FormulaUtils class, which actually does the work + ''' and return the value. The function in FormulaUtils will need to know the + ''' TableControl, so it is passed as the first instance. + ''' + ''' The total number of rows in the table control. + Public Function Count(ByVal controlName As String) As Decimal + Return FormulaUtils.Count(Me, controlName) + End Function + + ''' + ''' Count the number of rows in the table control that are non-blank. + ''' This function is called as [Products]TableControl.COUNTA(). + ''' To make sure all the formula functions are in the same location, we call + ''' the COUNTA function in the FormulaUtils class, which actually does the work + ''' and return the value. The function in FormulaUtils will need to know the + ''' TableControl, so it is passed as the first instance. + ''' + ''' The string name of the UI control (e.g., "UnitPrice") + ''' The total number of rows in the table control. + Public Function CountA(ByVal controlName As String) As Decimal + Return FormulaUtils.CountA(Me, controlName) + End Function + + ''' + ''' Mean of the rows in the table control. + ''' This function is called as [Product]TableControl.COUNTA(). + ''' To make sure all the formula functions are in the same location, we call + ''' the MEAN function in the FormulaUtils class, which actually does the work + ''' and return the value. The function in FormulaUtils will need to know the + ''' TableControl, so it is passed as the first instance. + ''' + ''' The string name of the UI control (e.g., "UnitPrice") + ''' The total number of rows in the table control. + Public Function Mean(ByVal controlName As String) As Decimal + Return FormulaUtils.Mean(Me, controlName) + End Function + + ''' + ''' Average of the rows in the table control. + ''' This function is called as [Product]TableControl.COUNTA(). + ''' To make sure all the formula functions are in the same location, we call + ''' the AVERAGE function in the FormulaUtils class, which actually does the work + ''' and return the value. The function in FormulaUtils will need to know the + ''' TableControl, so it is passed as the first instance. + ''' + ''' The string name of the UI control (e.g., "UnitPrice") + ''' The total number of rows in the table control. + Public Function Average(ByVal controlName As String) As Decimal + Return FormulaUtils.Average(Me, controlName) + End Function + + ''' + ''' Mode of the rows in the table control. + ''' This function is called as [Product]TableControl.COUNTA(). + ''' To make sure all the formula functions are in the same location, we call + ''' the MODE function in the FormulaUtils class, which actually does the work + ''' and return the value. The function in FormulaUtils will need to know the + ''' TableControl, so it is passed as the first instance. + ''' + ''' The string name of the UI control (e.g., "UnitPrice") + ''' The total number of rows in the table control. + Public Function Mode(ByVal controlName As String) As Decimal + Return FormulaUtils.Mode(Me, controlName) + End Function + + ''' + ''' Median of the rows in the table control. + ''' This function is called as [Product]TableControl.COUNTA(). + ''' To make sure all the formula functions are in the same location, we call + ''' the MEDIAN function in the FormulaUtils class, which actually does the work + ''' and return the value. The function in FormulaUtils will need to know the + ''' TableControl, so it is passed as the first instance. + ''' + ''' The string name of the UI control (e.g., "UnitPrice") + ''' The total number of rows in the table control. + Public Function Median(ByVal controlName As String) As Decimal + Return FormulaUtils.Median(Me, controlName) + End Function + + ''' + ''' Range of the rows in the table control. + ''' This function is called as [Product]TableControl.COUNTA(). + ''' To make sure all the formula functions are in the same location, we call + ''' the RANGE function in the FormulaUtils class, which actually does the work + ''' and return the value. The function in FormulaUtils will need to know the + ''' TableControl, so it is passed as the first instance. + ''' + ''' The string name of the UI control (e.g., "UnitPrice") + ''' The total number of rows in the table control. + Public Function Range(ByVal controlName As String) As Decimal + Return FormulaUtils.Range(Me, controlName) + End Function + + + End Class + + End Namespace diff --git a/App_Code/Shared/BaseApplicationUserControl.vb b/App_Code/Shared/BaseApplicationUserControl.vb new file mode 100644 index 0000000..2b08968 --- /dev/null +++ b/App_Code/Shared/BaseApplicationUserControl.vb @@ -0,0 +1,383 @@ +Imports BaseClasses.Data +Imports BaseClasses.Utils.StringUtils + + +Namespace Persons.UI + +' Typical customizations that may be done in this class include +' - adding custom event handlers +' - overriding base class methods + +''' +''' The superclass (i.e. base class) for all Designer-generated user controls in this application. +''' +''' +''' +''' +''' + + Public Class BaseApplicationUserControl + Inherits BaseClasses.Web.UI.BaseUserControl + + ' Variable used to prevent infinite loop + Private _modifyRedirectUrlInProgress As Boolean = False + + ''' Allow for migration from earlier versions which did not have url encryption. + Public Overridable Function ModifyRedirectUrl(ByVal redirectUrl As String, ByVal redirectArgument As String) As String + Return EvaluateExpressions(redirectUrl, redirectArgument, False) + End Function + + Public Overridable Function ModifyRedirectUrl(ByVal redirectUrl As String, ByVal redirectArgument As String, ByVal bEncrypt As Boolean) As String + Return EvaluateExpressions(redirectUrl, redirectArgument, bEncrypt) + End Function + + Public Overridable Function EvaluateExpressions(ByVal redirectUrl As String, ByVal redirectArgument As String, ByVal bEncrypt As Boolean) As String + Const PREFIX_NO_ENCODE As String = "NoUrlEncode:" + + If (_modifyRedirectUrlInProgress) Then + Return Nothing + Else + _modifyRedirectUrlInProgress = True + End If + + Dim finalRedirectUrl As String = redirectUrl + Dim finalRedirectArgument As String = redirectArgument + + If (finalRedirectUrl Is Nothing OrElse finalRedirectUrl.Trim = "") Then + Return "" + ElseIf (finalRedirectUrl.IndexOf("{"c) < 0) Then + 'RedirectUrl does not contain any format specifiers + _modifyRedirectUrlInProgress = False + Return finalRedirectUrl + Else + 'The old way was to pass separate URL and arguments and use String.Format to + 'do the replacement. Example: + ' URL: EditProductsRecord?Products={0} + ' Argument: PK + 'The new way to is pass the arguments directly in the URL. Example: + ' URL: EditProductsRecord?Products={PK} + 'If the old way is passsed, convert it to the new way. + If (Len(redirectArgument) > 0) Then + Dim arguments() As String = Split(redirectArgument, ",") + Dim i As Integer + For i = 0 To (arguments.Length - 1) + finalRedirectUrl = finalRedirectUrl.Replace("{" & i.ToString & "}", "{" & arguments(i) & "}") + Next + + finalRedirectArgument = "" + End If + + 'First find all the table and record controls in the page. + Dim controlList As ArrayList = GetAllRecordAndTableControls() + If controlList.Count = 0 Then + Return finalRedirectUrl + End If + + ' Store the controls in a hashtable using the control unique name + ' as the key for easy refrence later in the function. + Dim controlIdList As New Hashtable + Dim control As System.Web.UI.Control + Dim found As Boolean = False + For Each control In controlList + Dim uID As String = control.UniqueID + Dim pageContentIndex As Integer = uID.IndexOf("$PageContent$") + If pageContentIndex > 0 Then + If found = False Then + 'Remove all controls without $PageContent$ prefix, because this page is used with Master Page + 'and these entries are irrelevant + controlIdList.Clear() + End If + found = True + End If + If found Then + 'If we found that Master Page is used for this page construction than disregard all controls + 'without $PageContent$ prefix + If pageContentIndex > 0 Then + uID = uID.Substring(pageContentIndex + "$PageContent$".Length) + controlIdList.Add(uID, control) + End If + Else + 'No Master Page presense found so far + controlIdList.Add(uID, control) + End If + Next + + 'Look at all of the expressions in the URL and forward processing + 'to the appropriate controls. + 'Expressions can be of the form [ControlName:][NoUrlEncode:]Key[:Value] + Dim forwardTo As New ArrayList + Dim remainingUrl As String = finalRedirectUrl + While (remainingUrl.IndexOf("{"c) >= 0) And (remainingUrl.IndexOf("}"c) > 0) And _ + (remainingUrl.IndexOf("{"c) < remainingUrl.IndexOf("}"c)) + + Dim leftIndex As Integer = remainingUrl.IndexOf("{"c) + Dim rightIndex As Integer = remainingUrl.IndexOf("}"c) + Dim expression As String = remainingUrl.Substring(leftIndex + 1, rightIndex - leftIndex - 1) + remainingUrl = remainingUrl.Substring(rightIndex + 1) + + Dim prefix As String = Nothing + If (expression.IndexOf(":") > 0) Then + prefix = expression.Substring(0, expression.IndexOf(":")) + End If + If (Not IsNothing(prefix)) AndAlso (prefix.Length > 0) AndAlso _ + (Not (InvariantLCase(prefix) = InvariantLCase(PREFIX_NO_ENCODE))) AndAlso _ + (Not BaseRecord.IsKnownExpressionPrefix(prefix)) Then + 'The prefix is a control name. Add it to the list of controls that + 'need to process the URL. + If (controlIdList.Contains(prefix)) And (Not forwardTo.Contains(prefix)) Then + forwardTo.Add(prefix) + End If + End If + End While + + 'Forward the request to each control in the forwardTo list + Dim containerId As String + For Each containerId In forwardTo + Dim ctl As Control = CType(controlIdList.Item(containerId), Control) + If (Not IsNothing(ctl)) Then + If TypeOf ctl Is BaseApplicationRecordControl Then + finalRedirectUrl = DirectCast(ctl, BaseApplicationRecordControl).EvaluateExpressions(finalRedirectUrl, finalRedirectArgument, bEncrypt) + ElseIf TypeOf ctl Is BaseApplicationTableControl Then + finalRedirectUrl = DirectCast(ctl, BaseApplicationTableControl).EvaluateExpressions(finalRedirectUrl, finalRedirectArgument, bEncrypt) + End If + End If + Next + + 'If there are any unresolved expressions, let the other naming containers + 'have a crack at modifying the URL + For Each control In controlList + If (forwardTo.IndexOf(control.ID) < 0) Then + If TypeOf control Is BaseApplicationRecordControl Then + finalRedirectUrl = DirectCast(control, BaseApplicationRecordControl).EvaluateExpressions(finalRedirectUrl, finalRedirectArgument, bEncrypt) + ElseIf TypeOf control Is BaseApplicationTableControl Then + finalRedirectUrl = DirectCast(control, BaseApplicationTableControl).EvaluateExpressions(finalRedirectUrl, finalRedirectArgument, bEncrypt) + End If + End If + Next + End If + + _modifyRedirectUrlInProgress = False + + Return finalRedirectUrl + End Function + + Private Function GetAllRecordAndTableControls() As ArrayList + Dim controlList As ArrayList = New ArrayList() + GetAllRecordAndTableControls(Me, controlList) + Return controlList + End Function + + Private Sub GetAllRecordAndTableControls(ByVal ctl As Control, ByVal controlList As ArrayList) + If ctl Is Nothing Then + Return + End If + + If TypeOf ctl Is BaseApplicationRecordControl OrElse _ + TypeOf ctl Is BaseApplicationTableControl Then + controlList.Add(ctl) + End If + + Dim nextCtl As Control + For Each nextCtl In ctl.Controls() + GetAllRecordAndTableControls(nextCtl, controlList) + Next + End Sub + Public Function GetResourceValue(ByVal keyVal As String, ByVal appName As String) As String + Try + Dim resObj As Object = GetGlobalResourceObject(appName, keyVal) + If Not resObj Is Nothing Then + Return resObj.ToString() + End If + Return "" + Catch + Return "" + End Try + + End Function + + Public Function GetResourceValue(ByVal keyVal As String) As String + Try + Dim appname As String = BaseClasses.Configuration.ApplicationSettings.Current.GetAppSetting(BaseClasses.Configuration.ApplicationSettings.ConfigurationKey.ApplicationName) + Dim resObj As Object = GetGlobalResourceObject(appname, keyVal) + If Not resObj Is Nothing Then + Return resObj.ToString() + End If + Return "" + Catch + Return "" + End Try + + End Function + + ''' ----------------------------------------------------------------------------- + ''' + ''' Register Control buttonCtrl with ScriptManager to perform traditional postback instead of default async postback + ''' + ''' + ''' + ''' + ''' [sramarao] 3/2007 Created + ''' + ''' ----------------------------------------------------------------------------- + Public Sub RegisterPostBackTrigger(ByVal buttonCtrl As System.Web.UI.Control, ByVal updatePanelCtrl As System.Web.UI.Control) + Try + ' Get current ScriptManager + Dim scriptMgr As ScriptManager = ScriptManager.GetCurrent(Me.Page) + ' If Scriptmanager not preset return. + If scriptMgr Is Nothing Then + Return + End If + ' If buttonCtrl is not surrounded by an UpdatePanel then return. + Dim CurrentUpdatePanel As System.Web.UI.UpdatePanel = CType(updatePanelCtrl, UpdatePanel) + If CurrentUpdatePanel Is Nothing Then + Return + End If + If buttonCtrl Is Nothing Then + Return + End If + scriptMgr.RegisterPostBackControl(buttonCtrl) + Catch ex As Exception + Throw ex + End Try + + End Sub + + Public Sub RegisterPostBackTrigger(ByVal buttonCtrl As System.Web.UI.Control) + Try + ' Get current ScriptManager + Dim scriptMgr As ScriptManager = ScriptManager.GetCurrent(Me.Page) + ' If Scriptmanager not preset return. + If scriptMgr Is Nothing Then + Return + End If + If buttonCtrl Is Nothing Then + Return + End If + scriptMgr.RegisterPostBackControl(buttonCtrl) + Catch ex As Exception + Throw ex + End Try + + End Sub + + Public Overridable Sub SaveData() + + End Sub + + Public Overridable Sub SetChartControl(ByVal chartCtrlName As String) + + End Sub + +#Region " Methods to manage saving and retrieving control values to session. " + + Protected Sub Control_SaveControls_Unload(ByVal sender As Object, ByVal e As EventArgs) Handles MyBase.Unload + If DirectCast(Me.Page, BaseApplicationPage).ShouldSaveControlsToSession Then + Me.SaveControlsToSession() + End If + End Sub + + Protected Overridable Sub SaveControlsToSession() + End Sub + + Protected Sub Control_ClearControls_PreRender(ByVal sender As Object, ByVal e As EventArgs) Handles MyBase.PreRender + Me.ClearControlsFromSession() + End Sub + + Protected Overridable Sub ClearControlsFromSession() + End Sub + + Public Sub SaveToSession( _ + ByVal control As Control, _ + ByVal value As String) + + SaveToSession(control.UniqueID, value) + End Sub + + Public Function GetFromSession( _ + ByVal control As Control, _ + ByVal defaultValue As String) As String + + Return GetFromSession(control.UniqueID, defaultValue) + End Function + + Public Function GetFromSession(ByVal control As Control) As String + Return GetFromSession(control.UniqueID, Nothing) + End Function + + Public Sub RemoveFromSession(ByVal control As Control) + RemoveFromSession(control.UniqueID) + End Sub + + Public Function InSession(ByVal control As Control) As Boolean + Return InSession(control.UniqueID) + End Function + + Public Sub SaveToSession( _ + ByVal control As Control, _ + ByVal variable As String, _ + ByVal value As String) + + SaveToSession(control.UniqueID & variable, value) + End Sub + + Public Function GetFromSession( _ + ByVal control As Control, _ + ByVal variable As String, _ + ByVal defaultValue As String) As String + + Return GetFromSession(control.UniqueID & variable, defaultValue) + End Function + + Public Sub RemoveFromSession( _ + ByVal control As Control, _ + ByVal variable As String) + + RemoveFromSession(control.UniqueID & variable) + End Sub + + Public Function InSession( _ + ByVal control As Control, _ + ByVal variable As String) As Boolean + + Return InSession(control.UniqueID & variable) + End Function + + Public Sub SaveToSession( _ + ByVal name As String, _ + ByVal value As String) + + Me.Page.Session()(GetValueKey(name)) = value + End Sub + + Public Function GetFromSession( _ + ByVal name As String, _ + ByVal defaultValue As String) As String + + Dim value As String = CType(Me.Page.Session()(GetValueKey(name)), String) + If value Is Nothing OrElse value.Trim() = "" Then + value = defaultValue + End If + + Return value + End Function + + Public Function GetFromSession(ByVal name As String) As String + Return GetFromSession(name, Nothing) + End Function + + Public Sub RemoveFromSession(ByVal name As String) + Me.Page.Session.Remove(GetValueKey(name)) + End Sub + + Public Function InSession(ByVal name As String) As Boolean + Return (Not Me.Page.Session(GetValueKey(name)) Is Nothing) + End Function + + Public Function GetValueKey(ByVal name As String) As String + Return Me.Page.Session.SessionID & Me.Page.AppRelativeVirtualPath & name + End Function +#End Region + + End Class + +End Namespace diff --git a/App_Code/Shared/CalendarExtendarClass.vb b/App_Code/Shared/CalendarExtendarClass.vb new file mode 100644 index 0000000..3ea23d7 --- /dev/null +++ b/App_Code/Shared/CalendarExtendarClass.vb @@ -0,0 +1,45 @@ +Imports System +Imports System.Data +Imports System.Configuration +Imports System.Web +Imports System.Web.Security +Imports System.Web.UI +Imports System.Web.UI.HtmlControls +Imports System.Web.UI.WebControls +Imports AjaxControlToolkit + +Namespace Persons + ''' + ''' Summary description for CalendarExtendarClass + ''' + Public Class CalendarExtendarClass + Inherits AjaxControlToolkit.CalendarExtender + ' + ' Add constructor logic here + ' + Public Sub New() + End Sub + Protected Overloads Overrides Sub OnLoad(ByVal e As EventArgs) + Dim textBox As TextBox = DirectCast(MyBase.TargetControl, TextBox) + If Me.IsLanguageDefaultRTL Then + If Not Me.Page.IsPostBack Then + If textBox.Text = String.Empty Then + DirectCast(MyBase.TargetControl, TextBox).Text = DateTime.Today.ToString(MyBase.Format) + End If + + End If + End If + MyBase.OnLoad(e) + End Sub + Public ReadOnly Property IsLanguageDefaultRTL() As Boolean + Get + If String.Compare(Me.Page.Culture, "Arabic (Saudi Arabia)", StringComparison.InvariantCulture) = 0 OrElse String.Compare(Me.Page.Culture, "Thai(Thailand)", StringComparison.InvariantCulture) = 0 OrElse String.Compare(Me.Page.Culture, "Divehi (Maldives)", StringComparison.InvariantCulture) = 0 OrElse String.Compare(Me.Page.Culture, "Persian (Iran)", StringComparison.InvariantCulture) = 0 Then + + Return True + Else + Return False + End If + End Get + End Property + End Class +End Namespace diff --git a/App_Code/Shared/CsvParser.vb b/App_Code/Shared/CsvParser.vb new file mode 100644 index 0000000..1621c41 --- /dev/null +++ b/App_Code/Shared/CsvParser.vb @@ -0,0 +1,217 @@ + Imports System + Imports System.Data + Imports System.Configuration + Imports System.ComponentModel + Imports System.Web + Imports System.Web.Security + Imports System.Web.UI + Imports System.Web.UI.WebControls + Imports System.Web.UI.WebControls.WebParts + Imports System.Web.UI.HtmlControls + Imports System.Text + Imports System.IO + Imports System.Collections + + +Namespace Persons.UI + ''' + ''' Summary description for CsvParser: Parses CSV file and returns one row at a time. + ''' Since the code is the same for CSV or TAB, this class is used for parsing both types of files. + ''' + Public Class CsvParser + Inherits Parser + + Private sr As StreamReader = Nothing + + Private csvStrm As CsvStream = Nothing + + Private fileName As String = Nothing + + Private separator As Char = System.Globalization.CultureInfo.CurrentUICulture.TextInfo.ListSeparator(0) + + Public Sub New(ByVal fName As String) + MyBase.New + ' + ' Add constructor logic here + ' + fileName = fName + separator = System.Globalization.CultureInfo.CurrentUICulture.TextInfo.ListSeparator(0) + Reset() + End Sub + + Public Sub New(ByVal fName As String, ByVal fSeparator As Char) + MyBase.New() + ' + ' Add constructor logic here + ' + fileName = fName + separator = fSeparator + Reset() + End Sub + + + ' Resets resourses + Public Overrides Sub Reset() + If (Not (fileName) Is Nothing) Then + sr = New StreamReader(fileName) + csvStrm = New CsvStream(sr, separator) + End If + End Sub + + ' Gets one row at a time. + Public Overrides Function GetNextRow() As String() + Return csvStrm.GetNextRow + End Function + Public Overrides Sub Close() + csvStrm.Close() + End Sub + + ' CsvStream is the helper class which parses the file. + Private Class CsvStream + Implements IDisposable + + Private stream As TextReader + + Private EOS As Boolean = False + + Private EOL As Boolean = False + + Private buffer() As Char = New Char((4096) - 1) {} + + Private pos As Integer = 0 + + Private length As Integer = 0 + + Private separator As Char = System.Globalization.CultureInfo.CurrentUICulture.TextInfo.ListSeparator(0) + + Public Sub New(ByVal s As TextReader, ByVal fSeparator As Char) + MyBase.New() + stream = s + separator = fSeparator + End Sub + + Public Function GetNextRow() As String() + Dim row As ArrayList = New ArrayList + + While True + Dim item As String = GetNextItem + If (item Is Nothing) Then + If (row.Count = 0) Then + Return Nothing + Else + If (row(row.Count - 1).ToString = "") Then + row.RemoveAt((row.Count - 1)) + End If + If (row.Count <> 0) Then + Return CType(row.ToArray(GetType(System.String)), String()) + End If + End If + Else + row.Add(item) + End If + End While + Return Nothing + End Function + Public Sub Close() + If stream IsNot Nothing Then + Me.Dispose() + End If + End Sub + Public Function GetNextItem() As String + If EOL Then + ' previous item was last in line, start new line + EOL = False + Return Nothing + End If + + Dim quoted As Boolean = False + Dim predata As Boolean = True + Dim postdata As Boolean = False + Dim item As New StringBuilder() + + While True + Dim c As Char = GetNextChar(True) + If EOS Then + Return IIf(item.Length > 0, item.ToString(), Nothing) + End If + + If (postdata OrElse Not quoted) AndAlso c = separator Then + Return item.ToString() + ' end of item, return + End If + + If (predata OrElse postdata OrElse Not quoted) AndAlso (c = Chr(10) OrElse c = Chr(13)) Then + ' we are at the end of the line, eat newline characters and exit + EOL = True + If c = Chr(13) AndAlso GetNextChar(False) = Chr(10) Then + GetNextChar(True) + ' new line sequence is 0D0A + End If + Return item.ToString() + End If + + If predata AndAlso c = " "c Then + Continue While + ' whitespace preceeding data, discard + End If + + If predata AndAlso (c = """"c OrElse c = "'"c) Then + ' quoted data is starting + quoted = True + predata = False + Continue While + End If + + If predata Then + ' data is starting without quotes + predata = False + item.Append(c) + Continue While + End If + + If (c = """"c OrElse c = "'"c) AndAlso quoted Then + If GetNextChar(False) = """"c Then + item.Append(GetNextChar(True)) + Else + postdata = True + ' double quotes within quoted string means add a quote + ' end-quote reached + End If + Continue While + End If + + ' all cases covered, character must be data + item.Append(c) + End While + Return Nothing + End Function + + Public Function GetNextChar(ByVal eat As Boolean) As Char + If (pos >= length) Then + length = stream.ReadBlock(buffer, 0, buffer.Length) + If (length = 0) Then + EOS = True + Return Microsoft.VisualBasic.ChrW(92) + End If + pos = 0 + End If + If eat Then + pos = pos + 1 + Return buffer(pos - 1) + Else + Return buffer(pos) + End If + End Function + Public Sub Dispose() Implements IDisposable.Dispose + + If stream IsNot Nothing Then + stream.Close() + stream.Dispose() + stream = Nothing + End If + + End Sub + End Class + End Class +End Namespace + diff --git a/App_Code/Shared/CustomEditor.vb b/App_Code/Shared/CustomEditor.vb new file mode 100644 index 0000000..705dae7 --- /dev/null +++ b/App_Code/Shared/CustomEditor.vb @@ -0,0 +1,143 @@ +Imports AjaxControlToolkit.HTMLEditor +Imports System +Imports System.Collections +Imports System.Collections.ObjectModel + +'This class is used by Edit Table pages + +Namespace Persons.UI + + Public Class CustomEditor + Inherits Editor + + Dim fontName As New AjaxControlToolkit.HTMLEditor.ToolbarButton.FontName() + Dim fontSize As New AjaxControlToolkit.HTMLEditor.ToolbarButton.FontSize() + + ''' + ''' Disables the tabbing for the FontName and FontSize dropdown list + ''' When user tabs from other control to the editor, it should ignore FontName and FontSize dropdown list + ''' and takes the cursor directly inside the editor textbox + ''' + Protected Overrides Sub OnPreRender(ByVal e As EventArgs) + MyBase.OnPreRender(e) + fontName.IgnoreTab = True + fontSize.IgnoreTab = True + End Sub + + ''' + ''' This method is responsible for adding buttons on the TopToolbar of the editor + ''' Remove or Add the buttons provided by AjaxControlToolkit + ''' + Protected Overrides Sub FillTopToolbar() + + Dim options As Collection(Of AjaxControlToolkit.HTMLEditor.ToolbarButton.SelectOption) + Dim [option] As AjaxControlToolkit.HTMLEditor.ToolbarButton.SelectOption + + TopToolbar.Buttons.Add(New AjaxControlToolkit.HTMLEditor.ToolbarButton.Undo()) + TopToolbar.Buttons.Add(New AjaxControlToolkit.HTMLEditor.ToolbarButton.Redo()) + + TopToolbar.Buttons.Add(New AjaxControlToolkit.HTMLEditor.ToolbarButton.HorizontalSeparator()) + TopToolbar.Buttons.Add(New AjaxControlToolkit.HTMLEditor.ToolbarButton.Bold()) + TopToolbar.Buttons.Add(New AjaxControlToolkit.HTMLEditor.ToolbarButton.Italic()) + TopToolbar.Buttons.Add(New AjaxControlToolkit.HTMLEditor.ToolbarButton.Underline()) + + TopToolbar.Buttons.Add(New AjaxControlToolkit.HTMLEditor.ToolbarButton.HorizontalSeparator()) + TopToolbar.Buttons.Add(New AjaxControlToolkit.HTMLEditor.ToolbarButton.FixedBackColor()) + TopToolbar.Buttons.Add(New AjaxControlToolkit.HTMLEditor.ToolbarButton.BackColorSelector()) + TopToolbar.Buttons.Add(New AjaxControlToolkit.HTMLEditor.ToolbarButton.FixedForeColor()) + TopToolbar.Buttons.Add(New AjaxControlToolkit.HTMLEditor.ToolbarButton.ForeColorSelector()) + + TopToolbar.Buttons.Add(New AjaxControlToolkit.HTMLEditor.ToolbarButton.HorizontalSeparator()) + TopToolbar.Buttons.Add(New AjaxControlToolkit.HTMLEditor.ToolbarButton.OrderedList()) + TopToolbar.Buttons.Add(New AjaxControlToolkit.HTMLEditor.ToolbarButton.BulletedList()) + + TopToolbar.Buttons.Add(New AjaxControlToolkit.HTMLEditor.ToolbarButton.HorizontalSeparator()) + TopToolbar.Buttons.Add(New AjaxControlToolkit.HTMLEditor.ToolbarButton.JustifyCenter()) + TopToolbar.Buttons.Add(New AjaxControlToolkit.HTMLEditor.ToolbarButton.JustifyFull()) + TopToolbar.Buttons.Add(New AjaxControlToolkit.HTMLEditor.ToolbarButton.JustifyLeft()) + TopToolbar.Buttons.Add(New AjaxControlToolkit.HTMLEditor.ToolbarButton.JustifyRight()) + + TopToolbar.Buttons.Add(New AjaxControlToolkit.HTMLEditor.ToolbarButton.HorizontalSeparator()) + TopToolbar.Buttons.Add(fontName) + + options = fontName.Options + [option] = New AjaxControlToolkit.HTMLEditor.ToolbarButton.SelectOption() + [option].Value = "arial,helvetica,sans-serif" + [option].Text = "Arial" + options.Add([option]) + [option] = New AjaxControlToolkit.HTMLEditor.ToolbarButton.SelectOption() + [option].Value = "courier new,courier,monospace" + [option].Text = "Courier New" + options.Add([option]) + [option] = New AjaxControlToolkit.HTMLEditor.ToolbarButton.SelectOption() + [option].Value = "georgia,times new roman,times,serif" + [option].Text = "Georgia" + options.Add([option]) + [option] = New AjaxControlToolkit.HTMLEditor.ToolbarButton.SelectOption() + [option].Value = "tahoma,arial,helvetica,sans-serif" + [option].Text = "Tahoma" + options.Add([option]) + [option] = New AjaxControlToolkit.HTMLEditor.ToolbarButton.SelectOption() + [option].Value = "times new roman,times,serif" + [option].Text = "Times New Roman" + options.Add([option]) + [option] = New AjaxControlToolkit.HTMLEditor.ToolbarButton.SelectOption() + [option].Value = "verdana,arial,helvetica,sans-serif" + [option].Text = "Verdana" + options.Add([option]) + [option] = New AjaxControlToolkit.HTMLEditor.ToolbarButton.SelectOption() + [option].Value = "impact" + [option].Text = "Impact" + options.Add([option]) + [option] = New AjaxControlToolkit.HTMLEditor.ToolbarButton.SelectOption() + [option].Value = "wingdings" + [option].Text = "WingDings" + options.Add([option]) + + TopToolbar.Buttons.Add(New AjaxControlToolkit.HTMLEditor.ToolbarButton.HorizontalSeparator()) + TopToolbar.Buttons.Add(fontSize) + + options = fontSize.Options + [option] = New AjaxControlToolkit.HTMLEditor.ToolbarButton.SelectOption() + [option].Value = "8pt" + [option].Text = "1 ( 8 pt)" + options.Add([option]) + [option] = New AjaxControlToolkit.HTMLEditor.ToolbarButton.SelectOption() + [option].Value = "10pt" + [option].Text = "2 (10 pt)" + options.Add([option]) + [option] = New AjaxControlToolkit.HTMLEditor.ToolbarButton.SelectOption() + [option].Value = "12pt" + [option].Text = "3 (12 pt)" + options.Add([option]) + [option] = New AjaxControlToolkit.HTMLEditor.ToolbarButton.SelectOption() + [option].Value = "14pt" + [option].Text = "4 (14 pt)" + options.Add([option]) + [option] = New AjaxControlToolkit.HTMLEditor.ToolbarButton.SelectOption() + [option].Value = "18pt" + [option].Text = "5 (18 pt)" + options.Add([option]) + [option] = New AjaxControlToolkit.HTMLEditor.ToolbarButton.SelectOption() + [option].Value = "24pt" + [option].Text = "6 (24 pt)" + options.Add([option]) + [option] = New AjaxControlToolkit.HTMLEditor.ToolbarButton.SelectOption() + [option].Value = "36pt" + [option].Text = "7 (36 pt)" + options.Add([option]) + End Sub + + ''' + ''' This method is responsible for adding buttons on the BottomToolbar of the editor + ''' Remove or Add the buttons provided by AjaxControlToolkit + ''' + Protected Overrides Sub FillBottomToolbar() + BottomToolbar.Buttons.Add(New AjaxControlToolkit.HTMLEditor.ToolbarButton.DesignMode()) + BottomToolbar.Buttons.Add(New AjaxControlToolkit.HTMLEditor.ToolbarButton.PreviewMode()) + BottomToolbar.Buttons.Add(New AjaxControlToolkit.HTMLEditor.ToolbarButton.HtmlMode()) + End Sub + + End Class + +End Namespace diff --git a/App_Code/Shared/Data.vb b/App_Code/Shared/Data.vb new file mode 100644 index 0000000..7a4f63b --- /dev/null +++ b/App_Code/Shared/Data.vb @@ -0,0 +1,13 @@ +Namespace Persons.Data + + Public Class DataPlaceHolder + + End Class +End Namespace + +Namespace Persons.Business + + Public Class BusinessPlaceHolder + + End Class +End Namespace \ No newline at end of file diff --git a/App_Code/Shared/ExcelParser.vb b/App_Code/Shared/ExcelParser.vb new file mode 100644 index 0000000..ea0b26b --- /dev/null +++ b/App_Code/Shared/ExcelParser.vb @@ -0,0 +1,166 @@ +Imports System +Imports System.Data +Imports System.Data.OleDb +Imports System.Configuration +Imports System.Text +Imports System.IO +Imports System.Collections + + +Namespace Persons.UI + ''' + ''' Summary description for ExcelParser + ''' + Public Class ExcelParser + Inherits Parser + Implements IDisposable +#Region "Private Member" + + Private m_fileName As String = String.Empty + Private commandText As String = String.Empty + Private command As OleDbCommand = Nothing + Private m_connection As OleDbConnection = Nothing + Private reader As OleDbDataReader = Nothing + Private m_connectionString As String = String.Empty + + +#End Region + +#Region "Properties" + + Public Property Connection() As OleDbConnection + Get + Return m_connection + End Get + Set(ByVal value As OleDbConnection) + m_connection = value + End Set + End Property + Public Property FileName() As String + Get + Return m_fileName + End Get + Set(ByVal value As String) + m_fileName = value + End Set + End Property + + Friend ReadOnly Property ConnectionStringOne() As String + Get + Me.m_connectionString = "Provider=Microsoft.ACE.OLEDB.12.0;" + "Data Source=" + Me.fileName + ";" + "Extended Properties=""Excel 12.0;HDR=No;IMEX=1""" + Return Me.m_connectionString + End Get + End Property + Friend ReadOnly Property ConnectionStringTwo() As String + + Get + Me.m_connectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" + "Data Source=" + Me.fileName + ";" + "Extended Properties=""Excel 8.0;HDR=No;IMEX=1""" + Return Me.m_connectionString + End Get + End Property + + +#End Region + + Public Sub New(ByVal file As String, ByVal sheetName As String) + ' + ' Add constructor logic here + ' + Me.fileName = file + Dim merror As Boolean = False + Dim isConnectionOpen As Boolean = False + Me.connection = New OleDbConnection(Me.ConnectionStringOne) + Me.commandText = "SELECT * FROM [" + sheetName + "$]" + Me.command = New OleDbCommand(Me.commandText, Me.connection) + + Try + Me.connection.Open() + isConnectionOpen = True + Me.reader = Me.command.ExecuteReader() + Catch ex As Exception + If Not isConnectionOpen Then + Me.connection = Nothing + Me.command = Nothing + Me.connection = New OleDbConnection(Me.ConnectionStringTwo) + Me.command = New OleDbCommand(Me.commandText, Me.connection) + Try + Me.connection.Open() + + Me.reader = Me.command.ExecuteReader() + Catch exe As Exception + merror = True + Throw New Exception(exe.Message) + End Try + If merror Then + If Me.connection.State = ConnectionState.Open AndAlso Me.connection IsNot Nothing Then + Me.connection.Close() + End If + Throw ex + End If + Else + If Me.connection.State = ConnectionState.Open AndAlso Me.connection IsNot Nothing Then + Me.connection.Close() + End If + Throw ex + End If + + End Try + + End Sub + +#Region "Parser member" + + Public Overloads Overrides Sub Reset() + ' throw new NotImplementedException(); + End Sub + + Public Overloads Overrides Function GetNextRow() As String() + Dim row As New ArrayList() + Dim columnIndex As Integer = 0 + If Me.m_connection.State <> ConnectionState.Closed Then + + If Me.reader.Read() Then + For columns As Integer = 0 To Me.reader.FieldCount - 1 + Try + row.Add(Me.reader(columnIndex).ToString()) + Catch ex As Exception + Throw New Exception(ex.Message) + End Try + columnIndex += 1 + Next + End If + End If + If row.Count <> 0 Then + Return DirectCast(row.ToArray(GetType(String)), String()) + End If + + Return Nothing + End Function + + Public Overloads Overrides Sub Close() + Me.reader.Close() + Me.reader = Nothing + Me.m_connection.Close() + Me.m_connection = Nothing + + End Sub +#End Region + +#Region "IDisposable Members" + + Private Sub Dispose() Implements IDisposable.Dispose + 'throw new NotImplementedException(); + If Me.reader IsNot Nothing Then + Me.reader.Close() + Me.reader.Dispose() + End If + If Me.m_connection IsNot Nothing Then + Me.m_connection.Close() + Me.m_connection.Dispose() + End If + + End Sub + +#End Region + End Class +End Namespace diff --git a/App_Code/Shared/ExportData.vb b/App_Code/Shared/ExportData.vb new file mode 100644 index 0000000..44ae9e4 --- /dev/null +++ b/App_Code/Shared/ExportData.vb @@ -0,0 +1,1197 @@ +Imports System.IO +Imports BaseClasses.Data +Imports System.Collections +Imports System.Data.OleDb +Imports System.Data +Imports NPOI.SS.UserModel +Imports NPOI.HSSF.UserModel + +Namespace Persons + Public Enum ISDDataType + ISDNotSet = 0 + ISDString = 1 + ISDNumber = 2 + ISDDateTime = 3 + ISDBoolean = 4 + ISDInteger = 5 + ISDError = 999 + End Enum + + + Public Class ISDWorkbook + Public Worksheets As New ArrayList() + + Public Properties As New ISDWorkbookProperties() + + + Private Function GenerateUniquePath(ByVal filename As String, ByVal extension As String) As String + Dim suffix As Integer = 0 + Dim fullpath As String + + Do + suffix += 1 + fullpath = System.Web.HttpContext.Current.Server.MapPath("../Temp/" & filename & "_" & suffix & "." & extension) + Loop While System.IO.File.Exists(fullpath) + + Return fullpath + End Function + + + Private Function GetColumnDefinitions(ByVal cols As ArrayList, ByVal headerCells As ArrayList, ByVal dataCells As ArrayList, ByVal addType As Boolean) As String + Dim result As String = "" + Dim i As Integer = 0 + + For Each headerCell As ISDWorksheetCell In headerCells + If Not result.Equals("") Then + result += ", " + End If + result += "[" & headerCell.Text & "]" + + If addType Then + Dim dataCell As ISDWorksheetCell = DirectCast(dataCells(i), ISDWorksheetCell) + + result += " varchar(" & Convert.ToString(cols(i)) & ")" + End If + + i += 1 + Next + + Return result + End Function + + + Private Function GetRowData(ByVal cells As ArrayList) As String + Dim result As String = "" + Dim value As String = "" + + For Each cell As ISDWorksheetCell In cells + If Not result.Equals("") Then + result += ", " + End If + + value = cell.Text.Replace("'", "''") + + If value.Length > 255 Then + value = value.Substring(0, 255) + End If + + result += "'" & value & "'" + Next + + Return result + End Function + + + Public Sub Save(ByVal OutputStream As System.IO.Stream, ByVal response As System.Web.HttpResponse) + Dim filename As String = "Export_" & Guid.NewGuid().ToString() + Dim completePathOne As String = GenerateUniquePath(filename, "xlsx") + Dim completePathTwo As String = GenerateUniquePath(filename, "xls") + Dim completePath As String + Dim tableName As String + + Dim ws As ISDWorksheet = DirectCast(Me.Worksheets(0), ISDWorksheet) + Dim ta As ISDTable = ws.Table + tableName = ws.Name + Dim rows As ArrayList = ta.Rows + Dim row0 As ISDWorksheetRow = Nothing + + If rows.Count > 0 Then + row0 = DirectCast(rows(0), ISDWorksheetRow) + End If + + Dim row1 As ISDWorksheetRow = row0 + + If rows.Count > 1 Then + row1 = DirectCast(rows(1), ISDWorksheetRow) + End If + + Dim cols As ArrayList = ta.Columns + Dim colDefs As String = GetColumnDefinitions(cols, row0.Cells, row1.Cells, True) + Dim colNames As String = GetColumnDefinitions(cols, row0.Cells, row1.Cells, False) + + completePath = completePathTwo + + Dim hssfwb As New HSSFWorkbook() + + Dim format As IDataFormat = hssfwb.CreateDataFormat() + + Dim sh As ISheet = hssfwb.CreateSheet("Sheet1") + + Dim rIndex As Integer = 0 + + Dim r As IRow = sh.CreateRow(rIndex) + + Dim c As Integer = 0 + + + Dim styles(row0.Cells.Count) As HSSFCellStyle + + For Each hCell As ISDWorksheetCell In row0.Cells + Dim style As HSSFCellStyle = CType(hssfwb.CreateCellStyle(), HSSFCellStyle) + Dim ce As ICell = r.CreateCell(c) + + ce.SetCellValue(hCell.Text) + + style.WrapText = True + styles(c) = CType(hssfwb.CreateCellStyle(), HSSFCellStyle) + ce.CellStyle = style + c += 1 + Next + + For rIndex = 1 To rows.Count - 1 + Dim currentRow As ISDWorksheetRow = DirectCast(rows(rIndex), ISDWorksheetRow) + + r = sh.CreateRow(rIndex) + + c = 0 + For i As Integer = 0 To currentRow.Cells.Count - 1 + + 'myValue = myValue.Replace("$", "").Replace(",", "") + Dim ce As ICell = r.CreateCell(c) + + Dim style As HSSFCellStyle = styles(i) + Dim dCell As ISDWorksheetCell = DirectCast(currentRow.Cells(i), ISDWorksheetCell) + + Dim formatStr As String = dCell.Format + If dCell.Type = ISDDataType.ISDInteger OrElse _ + dCell.Type = ISDDataType.ISDNumber Then + ce.SetCellType(CellType.NUMERIC) + + If dCell.Value IsNot Nothing Then + ce.SetCellValue(Convert.ToDouble(dCell.Value)) + End If + + If GetBuildInFormat(dCell.Format) > 0 Then + style.DataFormat = HSSFDataFormat.GetBuiltinFormat(dCell.Format) + Else + + Dim info As System.Globalization.NumberFormatInfo = System.Globalization.CultureInfo.CurrentCulture.NumberFormat + If dCell.Format = "" OrElse dCell.Format Is Nothing Then + formatStr = "##0.00" + ElseIf dCell.Format.Contains("C") OrElse dCell.Format.Contains("c") Then + formatStr = info.CurrencySymbol & "##0.00" + ElseIf dCell.Format.Contains("P") OrElse dCell.Format.Contains("p") Then + formatStr = "##0.00" & info.PercentSymbol + ElseIf dCell.Format.Contains(info.CurrencySymbol) OrElse dCell.Format.Contains(info.PercentSymbol) Then + ' use the user given display format + Else + formatStr = "##0.00" + End If + style.DataFormat = format.GetFormat(formatStr) + End If + ElseIf dCell.Type = ISDDataType.ISDDateTime Then + + If dCell.Value IsNot Nothing Then + ce.SetCellType(CellType.NUMERIC) + ce.SetCellValue(Convert.ToDateTime(dCell.Value)) + End If + + If GetBuildInFormat(dCell.Format) > 0 Then + style.DataFormat = HSSFDataFormat.GetBuiltinFormat(dCell.Format) + Else + Dim info As System.Globalization.DateTimeFormatInfo = System.Globalization.CultureInfo.CurrentCulture.DateTimeFormat + + ' convert the date format understood by Excel + ' see http://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.71).aspx + Select Case dCell.Format + Case "d" + formatStr = info.ShortDatePattern + Case "D" + formatStr = info.LongDatePattern + Case "t" + formatStr = info.ShortTimePattern + Case "T" + formatStr = info.LongTimePattern + Case "f" + formatStr = info.LongDatePattern & " " & info.ShortTimePattern + Case "F" + formatStr = info.FullDateTimePattern + Case "g" + formatStr = info.ShortDatePattern & " " & info.ShortTimePattern + Case "G" + formatStr = info.ShortDatePattern & " " & info.LongTimePattern + Case "M", "m" + formatStr = info.MonthDayPattern + Case "R", "r" + formatStr = info.RFC1123Pattern + Case "s" + formatStr = info.SortableDateTimePattern + Case "u" + formatStr = info.UniversalSortableDateTimePattern + Case "U" + formatStr = info.FullDateTimePattern + Case "Y", "y" + formatStr = info.YearMonthPattern + Case Else + formatStr = info.ShortDatePattern + End Select + + ' some pattern above might return t but this is not recognized by Excel, so remove it + formatStr = formatStr.Replace("t", "") + style.DataFormat = format.GetFormat(formatStr) + + End If + + Else + ce.SetCellType(CellType.STRING) + If dCell.Value IsNot Nothing Then + Dim myValue As String = dCell.Text.Replace("'", "''") + If myValue.Length > 255 Then + myValue = myValue.Substring(0, 255) + End If + ce.SetCellValue(myValue) + End If + + If GetBuildInFormat(dCell.Format) > 0 Then + style.DataFormat = HSSFDataFormat.GetBuiltinFormat(dCell.Format) + Else + style.DataFormat = HSSFDataFormat.GetBuiltinFormat("TEXT") + style.WrapText = True + End If + + End If + + ce.CellStyle = style + c += 1 + Next + Next + + Dim ms As New MemoryStream() + hssfwb.Write(ms) + + Dim NPOIDownloadFileName As String = Me.Properties.Title + + If completePath.EndsWith(".xlsx") Then + NPOIDownloadFileName += ".xlsx" + Else + NPOIDownloadFileName += ".xls" + End If + + response.ClearHeaders() + response.Clear() + response.Cache.SetCacheability(System.Web.HttpCacheability.[Private]) + response.Cache.SetMaxAge(New TimeSpan(0)) + response.Cache.SetExpires(New DateTime(0)) + response.Cache.SetNoServerCaching() + response.AppendHeader("Content-Disposition", ("attachment; filename=""" & (NPOIDownloadFileName & """"))) + response.ContentType = "application/vnd.ms-excel" + + OutputStream.Write(ms.ToArray(), 0, ms.ToArray().Length) + + Return + End Sub + + + Private Function GetBuildInFormat(ByVal format As String) As Short + If format = "" OrElse format Is Nothing Then + Return -1 + Else + Return HSSFDataFormat.GetBuiltinFormat(format) + End If + End Function + + End Class + + Public Class ISDWorkbookProperties + Public Title As String = "" + End Class + + + Public Class ISDWorksheet + Public Table As New ISDTable() + Public Name As String = "" + + Public Sub New(ByVal name__1 As String) + Name = name__1 + End Sub + End Class + + Public Class ISDTable + Public Rows As New ArrayList() + Public Columns As New ArrayList() + End Class + + + Public Class ISDWorksheetRow + Public Cells As New ArrayList() + End Class + + + Public Class ISDWorksheetCell + Public Value As Object = "" + Public Type As ISDDataType = ISDDataType.ISDString + Public StyleID As String = "" + Public Format As String = "" + + Public ReadOnly Property Text() As String + Get + If Value Is Nothing Then + Return Nothing + End If + Return Value.ToString() + End Get + End Property + + Public Sub New() + Value = "" + Type = ISDDataType.ISDString + StyleID = "" + End Sub + + Public Sub New(ByVal text__1 As Object) + Value = text__1 + Type = ISDDataType.ISDString + StyleID = "" + End Sub + + + + Public Sub New(ByVal text__1 As Object, ByVal styleID__2 As String) + Value = text__1 + Type = ISDDataType.ISDString + StyleID = styleID__2 + End Sub + + Public Sub New(ByVal text__1 As Object, ByVal type__2 As ISDDataType, ByVal styleID__3 As String, ByVal format__4 As String) + Value = text__1 + Type = type__2 + StyleID = styleID__3 + Format = format__4 + End Sub + End Class + + + + ''' + ''' Base class to export data to CSV or Excel + ''' + Public MustInherit Class ExportDataBaseClass +#Region "Properties" + Protected pageSize As Integer = 5000 + + Protected _headerString As [String] + Protected Property HeaderString() As [String] + Get + Return _headerString + End Get + Set(ByVal value As [String]) + _headerString = value + End Set + End Property + + Protected MustOverride ReadOnly Property Title() As String +#End Region + +#Region "Constructor" + Protected Sub New() + HeaderString = Nothing + End Sub + + Protected Sub New(ByVal header As [String]) + HeaderString = header + End Sub +#End Region + +#Region "Public Methods" + + ' SetsResponse header and cache + Public Sub SetupResponse(ByVal response As System.Web.HttpResponse, ByVal fileName As String) + response.ClearHeaders() + response.Clear() + response.Cache.SetCacheability(System.Web.HttpCacheability.[Private]) + response.Cache.SetMaxAge(New TimeSpan(0)) + response.Cache.SetExpires(New DateTime(0)) + response.Cache.SetNoServerCaching() + response.AppendHeader("Content-Disposition", ("attachment; filename=""" & (fileName & """"))) + End Sub + + Public MustOverride Sub Export(ByVal response As System.Web.HttpResponse) + +#End Region + End Class + + ' The ExportToCSVBaseClass class exports to CSV file and sends the file to the response stream. + Public MustInherit Class ExportToCSVBaseClass + Inherits ExportDataBaseClass +#Region "Properties" + + Private _writer As StreamWriter + Private Property Writer() As StreamWriter + Get + Return _writer + End Get + Set(ByVal value As StreamWriter) + _writer = value + End Set + End Property +#End Region + +#Region "Constructor" + Protected Sub New() + MyBase.New() + End Sub + + Protected Sub New(ByVal header As [String]) + MyBase.New(header) + End Sub +#End Region + +#Region "Private Methods" + + Protected Overridable Function WriteColumnHeader(ByVal exportRawValues As Boolean) As Boolean + ' If the DisplayString is not null then, write the contents of DisplayString as column headers + If MyBase.HeaderString IsNot Nothing AndAlso MyBase.HeaderString <> "" Then + Writer.Write(HeaderString.Replace("""", """""")) + Return True + End If + + Return False + End Function + + Protected separator As [String] = System.Globalization.CultureInfo.CurrentCulture.TextInfo.ListSeparator + + Protected Sub WriteColumnTitle(ByVal val As String) + Writer.Write("""" & (val.Replace("""", """""") & """" & separator)) + End Sub + + Protected Friend Sub WriteColumnData(ByVal val As Object, ByVal isString As Boolean) + If val IsNot Nothing AndAlso (isString OrElse val.ToString().Contains(separator)) Then + Writer.Write("""" & (val.ToString().Replace("""", """""") & """")) + Else + Writer.Write(val) + End If + + Writer.Write(separator) + End Sub + + Protected Friend Sub WriteNewRow() + Writer.WriteLine() + End Sub +#End Region + +#Region "Public Methods" + + Public Sub StartExport(ByVal response As System.Web.HttpResponse, Optional ByVal exportRawValues As Boolean = False) + If response Is Nothing Then + Return + End If + + Dim fileName As String = Title & ".csv" + SetupResponse(response, fileName) + response.ContentType = "text/plain" + + Writer = New StreamWriter(response.OutputStream, System.Text.Encoding.UTF8) + + ' First write out the Column Headers + Me.WriteColumnHeader(exportRawValues) + + Writer.WriteLine() + End Sub + + Public Sub FinishExport(ByVal response As System.Web.HttpResponse) + Writer.Flush() + + ' Need to call Response.End() so nothing will be attached to a file + ' System.Web.HttpResponse.End() function will throw System.Threading.ThreadAbortException + ' indicating that the current response ends prematurely - that's what we want + response.[End]() + End Sub +#End Region + End Class + + ''' + ''' The ExportToExcelBaseClass provides common functionality + ''' used for exports to Excel and sends the XLS file to the response stream. + ''' + Public MustInherit Class ExportToExcelBaseClass + Inherits ExportDataBaseClass +#Region "Properties" + + Private _ISDexcelBook As ISDWorkbook + Private Property ISDExcelBook() As ISDWorkbook + Get + Return _ISDexcelBook + End Get + Set(ByVal value As ISDWorkbook) + _ISDexcelBook = value + End Set + End Property + + Private _ISDexcelSheet As ISDWorksheet + Private Property ISDExcelSheet() As ISDWorksheet + Get + Return _ISDexcelSheet + End Get + Set(ByVal value As ISDWorksheet) + _ISDexcelSheet = value + End Set + End Property + + Private _ISDexcelRow As ISDWorksheetRow + Private Property ISDExcelRow() As ISDWorksheetRow + Get + Return _ISDexcelRow + End Get + Set(ByVal value As ISDWorksheetRow) + _ISDexcelRow = value + End Set + End Property +#End Region + +#Region "Constructor" + Protected Sub New() + MyBase.HeaderString = Nothing + End Sub + + Protected Sub New(ByVal header As [String]) + MyBase.HeaderString = header + End Sub +#End Region + +#Region "Protected Methods" + + ' Add column to excel book, creates style for that column set's format + ' before call to this function empty row needs to be added + Protected Friend Sub AddColumnToExcelBook(ByVal column As Integer, ByVal caption As String, ByVal type As ISDDataType, ByVal width As Integer, ByVal format As String) + If ISDExcelRow Is Nothing Then + Return + End If + + ISDExcelRow.Cells.Add(New ISDWorksheetCell(caption, "HeaderRowStyle")) + ISDExcelSheet.Table.Columns.Add(width) + End Sub + + ' Add cell with data to existing row + ' column - column number to set correct format for this cell + ' name - column name + ' entityType - EntityType instance, that holds types definitions for this table + ' val - data value for this cell + Protected Friend Sub AddCellToExcelRow(ByVal column As Integer, ByVal type As ISDDataType, ByVal val As Object, ByVal format As String) + Dim styleName As [String] = "Style" + 'name of the format style + If ISDExcelRow Is Nothing Then + Return + End If + + ISDExcelRow.Cells.Add(New ISDWorksheetCell(val, type, (styleName & column), format)) + End Sub + + Protected Friend Sub AddRowToExcelBook() + If ISDExcelSheet Is Nothing Then + Return + End If + + ISDExcelRow = New ISDWorksheetRow() + ISDExcelSheet.Table.Rows.Add(ISDExcelRow) + End Sub + + ' calls SetupResponse to set header and cache and saves Excel file to HttpResponse + Protected Friend Sub SaveExcelBook(ByVal response As System.Web.HttpResponse) + Try + ISDExcelBook.Save(response.OutputStream, response) + Catch ex As Exception + Throw ex + End Try + + ' Need to call Response.End() so nothing will be attached to a file + ' System.Web.HttpResponse.End() function will throw System.Threading.ThreadAbortException + ' indicating that the current response ends prematurely - that's what we want + response.[End]() + End Sub + + ' Creates Excel Workbook that is used for Export to Excel request. + Protected Friend Sub CreateExcelBook() + ISDExcelBook = New ISDWorkbook() + + ISDExcelBook.Properties.Title = Title + + ISDExcelSheet = New ISDWorksheet("Sheet1") + ISDExcelBook.Worksheets.Add(ISDExcelSheet) + + ISDExcelRow = New ISDWorksheetRow() + ISDExcelSheet.Table.Rows.Add(ISDExcelRow) + End Sub +#End Region + End Class + + Public Class ExportDataToCSV + Inherits ExportToCSVBaseClass +#Region "Properties" + Private data As DataForExport = Nothing + Public Shadows pageSize As Integer = 5000 + + Protected Overrides ReadOnly Property Title() As String + Get + Return data.Title + End Get + End Property +#End Region + +#Region "Constructor" + Private Sub New() + End Sub + 'don't use this one! + Public Sub New(ByVal tbl As BaseTable, ByVal wc As WhereClause, ByVal orderBy As OrderBy, ByVal columns As BaseColumn()) + MyBase.New() + data = New DataForExport(tbl, wc, orderBy, columns) + End Sub + Public Sub New(ByVal tbl As BaseTable, ByVal wc As WhereClause, ByVal orderBy As OrderBy) + MyBase.New() + data = New DataForExport(tbl, wc, orderBy, Nothing) + End Sub + + Public Sub New(ByVal tbl As BaseTable, ByVal wc As WhereClause, ByVal orderBy As OrderBy, ByVal columns As BaseColumn(), ByVal header As [String]) + MyBase.New(header) + data = New DataForExport(tbl, wc, orderBy, columns) + End Sub + + Public Sub New(ByVal tbl As BaseTable, ByVal wc As WhereClause, ByVal orderBy As OrderBy, ByVal header As [String]) + MyBase.New(header) + data = New DataForExport(tbl, wc, orderBy, Nothing) + End Sub +#End Region + +#Region "Private Methods" + Public Function GetDataForExport(ByVal col As BaseColumn, ByVal rec As BaseRecord) As String + Dim val As [String] = "" + + If col.TableDefinition.IsExpandableNonCompositeForeignKey(col) Then + ' Foreign Key column, so we will use DFKA and String type. + val = rec.Format(col) + Else + Select Case col.ColumnType + Case BaseColumn.ColumnTypes.Binary, BaseColumn.ColumnTypes.Image + Exit Select + Case BaseColumn.ColumnTypes.Currency, BaseColumn.ColumnTypes.Number, BaseColumn.ColumnTypes.Percentage + val = rec.Format(col) + Exit Select + Case Else + val = rec.Format(col) + Exit Select + End Select + End If + Return val + End Function + + + + Protected Overrides Function WriteColumnHeader(ByVal exportRawValues As Boolean) As Boolean + If MyBase.WriteColumnHeader(exportRawValues) Then + Return True + End If + + ' If DisplayString is null, then write out the Column's name property as the header. + For Each col As BaseColumn In data.ColumnList + If Not (col Is Nothing) Then + If data.IncludeInExport(col) Then + If Not exportRawValues Then + MyBase.WriteColumnTitle(col.Name) + Else + Dim _isExpandableNonCompositeForeignKey As Boolean = col.TableDefinition.IsExpandableNonCompositeForeignKey(col) + If _isExpandableNonCompositeForeignKey Then + Dim fkColumn As ForeignKey = data.DBTable.TableDefinition.GetExpandableNonCompositeForeignKey(col) + Dim name As String = fkColumn.GetPrimaryKeyColumnName(col) + MyBase.WriteColumnTitle(name) + Else + MyBase.WriteColumnTitle(col.Name) + End If + End If + End If + End If + Next + Return True + End Function + + Protected Sub WriteRows() + Dim done As Boolean = False + + Dim totalRowsReturned As Integer = 0 + ' Read pageSize records at a time and write out the CSV file. + While Not done + Dim recList As ArrayList = data.GetRows(pageSize) + If recList Is Nothing Then + Exit While + End If + 'we are done + totalRowsReturned = recList.Count + For Each rec As BaseRecord In recList + For Each col As BaseColumn In data.ColumnList + If col Is Nothing Then + Continue For + End If + + If Not data.IncludeInExport(col) Then + Continue For + End If + + Dim val As [String] = GetDataForExport(col, rec) + + MyBase.WriteColumnData(val, data.IsString(col)) + Next + MyBase.WriteNewRow() + Next + + ' If we already are below the pageSize, then we are done. + If (totalRowsReturned < pageSize) Then + done = True + End If + End While + End Sub + +#End Region + +#Region "Public Methods" + Public Overrides Sub Export(ByVal response As System.Web.HttpResponse) + If response Is Nothing Then + Return + End If + + StartExport(response) + WriteRows() + FinishExport(response) + End Sub +#End Region + End Class + + ''' + ''' The ExportDataToExcel class exports to Excel file and sends the XLS file to the response stream. + ''' + Public Class ExportDataToExcel + Inherits ExportToExcelBaseClass +#Region "Properties" + Private data As DataForExport = Nothing + Public Shadows pageSize As Integer = 5000 + + Protected Overrides ReadOnly Property Title() As String + Get + Return data.Title + End Get + End Property + +#End Region + +#Region "Constructor" + Private Sub New() + End Sub + 'don't use this one! + Public Sub New(ByVal tbl As BaseTable, ByVal wc As WhereClause, ByVal orderBy As OrderBy) + MyBase.New() + data = New DataForExport(tbl, wc, orderBy, Nothing) + End Sub +#End Region + +#Region "Private Methods" + + Public Function GetDisplayFormat(ByVal col As ExcelColumn) As String + Return col.DisplayFormat + End Function + + 'return true if type can be included in export data + Protected Friend Function GetExcelDataType(ByVal col As ExcelColumn) As ISDDataType + If col.DisplayColumn.TableDefinition.IsExpandableNonCompositeForeignKey(col.DisplayColumn) Then + Return ISDDataType.ISDString + End If + Select Case col.DisplayColumn.ColumnType + Case BaseColumn.ColumnTypes.Number, BaseColumn.ColumnTypes.Percentage + Return ISDDataType.ISDNumber + + Case BaseColumn.ColumnTypes.Currency + Return ISDDataType.ISDNumber + + Case BaseColumn.ColumnTypes.[Date] + Return ISDDataType.ISDDateTime + + Case BaseColumn.ColumnTypes.Very_Large_String + Return ISDDataType.ISDString + + Case BaseColumn.ColumnTypes.[Boolean] + Return ISDDataType.ISDString + Case Else + + Return ISDDataType.ISDString + End Select + End Function + + Public Function GetExcelCellWidth(ByVal col As ExcelColumn) As Integer + If col Is Nothing Then + Return 0 + End If + + Dim width As Integer = 50 + If col.DisplayColumn.TableDefinition.IsExpandableNonCompositeForeignKey(col.DisplayColumn) Then + ' Set width if field is a foreign key field + width = 100 + Else + Select Case col.DisplayColumn.ColumnType + Case BaseColumn.ColumnTypes.Binary, BaseColumn.ColumnTypes.Image + ' Skip - do nothing for these columns + width = 0 + Exit Select + Case BaseColumn.ColumnTypes.Currency, BaseColumn.ColumnTypes.Number, BaseColumn.ColumnTypes.Percentage + width = 60 + Exit Select + Case BaseColumn.ColumnTypes.[String] + width = 255 + Exit Select + Case BaseColumn.ColumnTypes.Very_Large_String + width = 255 + Exit Select + Case Else + width = 50 + Exit Select + End Select + End If + Return width + End Function + + + + Protected Friend Function GetValueForExcelExport(ByVal col As ExcelColumn, ByVal rec As BaseRecord) As Object + Dim val As Object = "" + Dim isNull As Boolean = False + Dim deciNumber As Decimal + + If col Is Nothing Then + Return Nothing + End If + 'DFKA value is evaluated in the ExportExcelButton_Click method in the .controls file + 'if (col.DisplayColumn.TableDefinition.IsExpandableNonCompositeForeignKey(col.DisplayColumn)) + '{ + ' // Foreign Key column, so we will use DFKA and String type. + ' val = rec.Format(col.DisplayColumn); + '} + 'else + '{ + Select Case col.DisplayColumn.ColumnType + + Case BaseColumn.ColumnTypes.Number, BaseColumn.ColumnTypes.Percentage, BaseColumn.ColumnTypes.Currency + Dim numVal As ColumnValue = rec.GetValue(col.DisplayColumn) + + 'If the value of the column to be exported is nothing, add an empty cell to the Excel file + If numVal.IsNull Then + isNull = True + Else + deciNumber = numVal.ToDecimal() + val = deciNumber + End If + Exit Select + Case BaseColumn.ColumnTypes.[Date] + Dim dateVal As ColumnValue = rec.GetValue(col.DisplayColumn) + If dateVal.IsNull Then + isNull = True + Else + ' Specify the default Excel format for the date field + ' val = rec.Format(col.DisplayColumn, "s"); + ' val += ".000"; + val = rec.GetValue(col.DisplayColumn).Value + End If + Exit Select + Case BaseColumn.ColumnTypes.Very_Large_String + val = rec.GetValue(col.DisplayColumn).ToString() + Exit Select + + Case BaseColumn.ColumnTypes.[Boolean] + val = rec.Format(col.DisplayColumn) + Exit Select + Case Else + + val = rec.Format(col.DisplayColumn) + Exit Select + End Select + '} + If isNull Then + Return Nothing + Else + Return val + End If + End Function +#End Region + +#Region "Public Methods" + Public Sub AddColumn(ByVal col As ExcelColumn) + data.ColumnList.Add(col) + End Sub + + Public Overrides Sub Export(ByVal response As System.Web.HttpResponse) + Dim done As Boolean = False + Dim val As Object + + If response Is Nothing Then + Return + End If + + CreateExcelBook() + + Dim width As Integer = 0 + Dim columnCounter As Integer = 0 + + ' First write out the Column Headers + For Each col As ExcelColumn In data.ColumnList + width = GetExcelCellWidth(col) + If data.IncludeInExport(col) Then + AddColumnToExcelBook(columnCounter, col.ToString(), GetExcelDataType(col), width, GetDisplayFormat(col)) + columnCounter += 1 + End If + Next + ' Read pageSize records at a time and write out the Excel file. + Dim totalRowsReturned As Integer = 0 + + While Not done + Dim recList As ArrayList = data.GetRows(pageSize) + + If recList Is Nothing Then + Exit While + End If + totalRowsReturned = recList.Count + + For Each rec As BaseRecord In recList + AddRowToExcelBook() + columnCounter = 0 + For Each col As ExcelColumn In data.ColumnList + If Not data.IncludeInExport(col) Then + Continue For + End If + + val = GetValueForExcelExport(col, rec) + AddCellToExcelRow(columnCounter, GetExcelDataType(col), val, col.DisplayFormat) + + columnCounter += 1 + Next + Next + + ' If we already are below the pageSize, then we are done. + If (totalRowsReturned < pageSize) Then + done = True + End If + End While + + SaveExcelBook(response) + End Sub +#End Region + + End Class + + ''' + ''' The DataForExport class is a support class for Exportdata. + ''' It encapsulate access to data needs to be exported: + ''' data rows, title, columns. + ''' + Class DataForExport + Public ColumnList As New ArrayList() + + Public _tbl As BaseTable + Public Property DBTable() As BaseTable + Get + Return _tbl + End Get + Set(ByVal value As BaseTable) + _tbl = value + End Set + End Property + + Public _wc As WhereClause + Public Property SelectWhereClause() As WhereClause + Get + Return _wc + End Get + Set(ByVal value As WhereClause) + _wc = value + End Set + End Property + + Public _orderby As OrderBy + Public Property SelectOrderBy() As OrderBy + Get + Return _orderby + End Get + Set(ByVal value As OrderBy) + _orderby = value + End Set + End Property + + Public _join As BaseFilter + Public Property SelectJoin() As BaseFilter + Get + Return _join + End Get + + Set(ByVal value As BaseFilter) + _join = value + End Set + End Property + + Public ReadOnly Property Title() As String + Get + If DBTable.TableDefinition Is Nothing Then + Return "Unnamed" + End If + + Return DBTable.TableDefinition.Name + End Get + End Property + + Private pageIndex As Integer = 0 + Public Function GetRows(ByVal pageSize As Integer) As ArrayList + + Dim totalRows As Integer = 0 + + Dim recList As ArrayList = Nothing + + ' Read pageSize records at a time and write out the CSV file. + If SelectWhereClause.RunQuery Then + recList = DBTable.GetRecordList(SelectJoin, SelectWhereClause.GetFilter(), Nothing, SelectOrderBy, pageIndex, pageSize, _ + totalRows) + pageIndex += 1 + End If + + Return recList + End Function + + + Public Sub New(ByVal tbl As BaseTable, ByVal wc As WhereClause, ByVal orderBy As OrderBy, ByVal columns As BaseColumn()) + Me.DBTable = tbl + Me.SelectWhereClause = wc + Me.SelectOrderBy = orderBy + Me.SelectJoin = Nothing + If columns IsNot Nothing Then + ColumnList.AddRange(columns) + End If + End Sub + + Public Sub New(ByVal tbl As BaseTable, ByVal wc As WhereClause, ByVal orderBy As OrderBy, ByVal columns As BaseColumn(), ByVal join As BaseFilter) + Me.DBTable = tbl + Me.SelectWhereClause = wc + Me.SelectOrderBy = orderBy + Me.SelectJoin = join + If columns IsNot Nothing Then + ColumnList.AddRange(columns) + End If + End Sub + + Public Function IsString(ByVal col As BaseColumn) As Boolean + If col Is Nothing Then + Return False + End If + + Select Case col.ColumnType + Case BaseColumn.ColumnTypes.Binary, BaseColumn.ColumnTypes.Image, BaseColumn.ColumnTypes.Currency, BaseColumn.ColumnTypes.Number, BaseColumn.ColumnTypes.Percentage + Return False + End Select + Return True + End Function + Public Function IsString(ByVal col As ExcelColumn) As Boolean + If col Is Nothing Then + Return False + End If + + Return IsString(col.DisplayColumn) + End Function + + Public Function IncludeInExport(ByVal col As BaseColumn) As Boolean + If col Is Nothing Then + Return False + End If + + Select Case col.ColumnType + Case BaseColumn.ColumnTypes.Binary, BaseColumn.ColumnTypes.Image + ' Skip - do nothing for these columns + Return False + End Select + Return True + End Function + + Public Function IncludeInExport(ByVal col As ExcelColumn) As Boolean + If col Is Nothing Then + Return False + End If + + Return IncludeInExport(col.DisplayColumn) + End Function + End Class + ''' + ''' ExcelColumn class is used to set Excel format for BaseClolumn to be used for exporting data to Excel file. + ''' + Public Class ExcelColumn + +#Region "Constructor" + ''' + ''' Cretes new ExcelColumn + ''' + ''' BaseColumn + ''' a format string from Excel's Format Cell menu. For example "dddd, mmmm dd, yyyy h:mm AM/PM;@", "#,##0.00" + Public Sub New(ByVal col As BaseColumn, ByVal format As String) + DisplayColumn = col + DisplayFormat = format + End Sub +#End Region +#Region "Properties" + Private _column As BaseColumn + Public Property DisplayColumn() As BaseColumn + Get + Return _column + End Get + Set(ByVal value As BaseColumn) + _column = value + End Set + End Property + + Private _format As String + Public Property DisplayFormat() As String + Get + Return _format + End Get + Set(ByVal value As String) + _format = value + End Set + End Property +#End Region + +#Region "Public Methods" + Public Overrides Function ToString() As String + Return DisplayColumn.Name + End Function +#End Region + End Class + + + ''' + ''' This class is redundant. It is left here for backward compatibility. + ''' + ''' + Public Class ExportData +#Region "Private members" + Private _exportDataToCSV As ExportDataToCSV = Nothing + Private _exportDataToExcel As ExportDataToExcel = Nothing +#End Region + +#Region "Constructor" + Public Sub New(ByVal tbl As BaseTable, ByVal wc As WhereClause, ByVal orderBy As OrderBy, ByVal columns As BaseColumn()) + _exportDataToCSV = New ExportDataToCSV(tbl, wc, orderBy, columns) + End Sub + + Public Sub New(ByVal tbl As BaseTable, ByVal wc As WhereClause, ByVal orderBy As OrderBy) + _exportDataToCSV = New ExportDataToCSV(tbl, wc, orderBy) + _exportDataToExcel = New ExportDataToExcel(tbl, wc, orderBy) + End Sub + + Public Sub New(ByVal tbl As BaseTable, ByVal wc As WhereClause, ByVal orderBy As OrderBy, ByVal columns As BaseColumn(), ByVal header As [String]) + _exportDataToCSV = New ExportDataToCSV(tbl, wc, orderBy, columns, header) + End Sub +#End Region + Public Sub AddColumn(ByVal col As ExcelColumn) + If _exportDataToExcel IsNot Nothing Then + _exportDataToExcel.AddColumn(col) + End If + End Sub + Public Sub ExportToCSV(ByVal response As System.Web.HttpResponse) + If _exportDataToCSV IsNot Nothing Then + _exportDataToCSV.Export(response) + End If + End Sub + Public Sub ExportToExcel(ByVal response As System.Web.HttpResponse) + If _exportDataToExcel IsNot Nothing Then + _exportDataToExcel.Export(response) + End If + End Sub + End Class +End Namespace \ No newline at end of file diff --git a/App_Code/Shared/FormulaEvaluator.vb b/App_Code/Shared/FormulaEvaluator.vb new file mode 100644 index 0000000..417baf2 --- /dev/null +++ b/App_Code/Shared/FormulaEvaluator.vb @@ -0,0 +1,224 @@ +Imports Microsoft.VisualBasic +Imports System.IO +Imports BaseClasses.Data +Imports Ciloci.Flee +Imports Persons.UI +Imports Persons.Data + +Namespace Persons + + ''' + ''' The FormulaEvaluator class evaluates a formula passed to the Evaluate function. + ''' You must set the DataSource and Page variables as part of this. + ''' + ''' + Public Class FormulaEvaluator + Inherits BaseFormulaEvaluator + + + ''' + ''' Record control (or row) from which this evaluator is called. Could be Nothing + ''' if called from the data access layer. + ''' + Private _callingControl As Control = Nothing + Public Property CallingControl() As Control + Get + Return _callingControl + End Get + Set(ByVal value As Control) + _callingControl = value + End Set + End Property + + + ''' + ''' Create a new evaluator and prepare for evaluation. + ''' + Public Sub New(Optional ByVal mainObj As Object = Nothing) + + ' pass mainObj to contructor so that formula like = mainObj. can be evaluated + If mainObj Is Nothing Then + _evaluator = New ExpressionContext() + Else + _evaluator = New ExpressionContext(mainObj) + End If + + ' The order of adding types is important. First we add our own + ' formula functions, followed by the generic types. + + + Evaluator.Imports.AddType(GetType(BaseFormulaUtils)) + Evaluator.Imports.AddType(GetType(FormulaUtils)) + + ' ADVANCED. For advanced usage, generic types can also be imported into + ' the formula evaluator. This is done by adding types of some generic types + ' such as Math, DateTime, Convert, and String. For example, if you add the + ' Convert type, you can then use Convert.ToDecimal("string"). The second + ' parameter to the AddType is the namespace that will be used in the formula. + ' These functions expect a certain type. For example, Math functions expect + ' a Double for the most part. If you pass a string, they will throw an exception. + ' As such, we have written separate functions in FormulaUtils that are more + ' loosely-typed than the standard libraries available here. + ' Examples: + Evaluator.Imports.AddType(GetType(Math), "Math") + Evaluator.Imports.AddType(GetType(DateTime), "DateTime") + Evaluator.Imports.AddType(GetType(Convert), "Convert") + Evaluator.Imports.AddType(GetType(String), "String") + + ' We want a loosely-typed evaluation language - so do not + ' type-check any variables. + Evaluator.Options.Checked = False + + ' Our policy is to always treat real numbers as Decimal instead of + ' Double or Single to make it consistent across the entire + ' evaluator. + Evaluator.Options.RealLiteralDataType = RealLiteralDataType.Decimal + + ' The variable event handler handles the variables based on the DataSource. + AddHandler _evaluator.Variables.ResolveVariableType, AddressOf variables_ResolveVariableType + AddHandler _evaluator.Variables.ResolveVariableValue, AddressOf variables_ResolveVariableValue + End Sub + + + ''' + ''' Evaluate the expression passed in as the string + ''' + ''' The input whose absolute value is to be found. + ''' The result of the evaluation. Can we be any data type including string, datetime, decimal, etc. + Public Overrides Function Evaluate(ByVal expression As String) As Object + If IsNothing(expression) Then Return Nothing + If expression = "" Then Return "" + + ' Strip of the = in the front of the forumula - the Expression evaluator + ' does not need it. Also, make sure to trim the result to remove any + ' spaces in the front and the back. + expression = expression.TrimStart(New Char() {"="c, " "c}).Trim() + + ' Add all realted controls of this control. This includes the calling control, its children and parents. + AddRelatedControlVariables() + + ' If there are any exceptions when parsing or evaluating, they are + ' thrown so that the end user can see the error. As such, there is no + ' Try-Catch block here. + Try + Dim eDynamic As IDynamicExpression = _evaluator.CompileDynamic(expression) + Return eDynamic.Evaluate() + Catch ex As Exception + Return "ERROR: " & ex.Message + End Try + End Function + + + + +#Region "Private functions" + ''' + ''' Adds related record and table controls. + ''' This has to navigate up to the page level and add any table or record controls. + ''' And we have to navigate within to add any record/table controls. + ''' And we have to go sideways to also add any controls. + ''' Finally we have to add the page control. + ''' This allows the expression to use any record or table control on the page + ''' as long as it is accessible without being in a repeater. + ''' + Private Sub AddRelatedControlVariables() + If IsNothing(CallingControl) Then Return + + Try + ' STEP 1: Our strategy is to first add the current control and + ' all of its parents. This way, we maintain the full context of where + ' we are. For example, if you are in a row within a table, within another row + ' that is within another table, then by going up the hierarchy looking for parents + ' will preserve all of the context. + ' Later in Step 2 we will go through the other branches. + Dim ctl As Control = CallingControl + While Not (IsNothing(ctl)) + If TypeOf ctl Is BaseApplicationRecordControl OrElse TypeOf ctl Is BaseApplicationTableControl Then + AddControlAndChildren(ctl) + End If + ' Navigate up. + ctl = ctl.Parent + End While + + ' STEP 2: Go through the other branches on the page and add all other table and + ' record controls on the page. + AddControlAndChildren(CallingControl.Page) + + ' STEP 3: Add more variable for ASCX control. + AddVariableNameWithoutUnderscore() + + ' STEP 4: Finally add the Page itself. + Evaluator.Variables.Add("Page", CallingControl.Page) + + Catch ex As Exception + ' Ignore and continue in case of a problem. + End Try + + End Sub + + ''' + ''' Add this control and all child controls of the given control. + ''' We only add the Record and Table Controls. No other controls need + ''' to be added. + ''' This function is smart enough not to add or descend down a control + ''' that was previously added by checking whether the Id is already contained + ''' in the Evaluator variables. This avoids unnecessary traversal. + ''' This function is called recursively to add any child controls. + ''' + Private Sub AddControlAndChildren(ByVal ctl As Control) + ' We quit immediately if a control is already in the list of variables, + ' because we have convered that branch already. + Try + If IsNothing(ctl) Then Return + + If Not (IsNothing(ctl.ID)) AndAlso Evaluator.Variables.ContainsKey(ctl.ID) Then Return + + ' If this is a record or table control, add it. + If TypeOf ctl Is BaseApplicationRecordControl OrElse TypeOf ctl Is BaseApplicationTableControl Then + If Not (IsNothing(ctl.ID)) Then + Evaluator.Variables.Add(ctl.ID, ctl) + End If + End If + + For Each child As Control In ctl.Controls + ' We do not want to go into a repeater because there will be multiple rows. + ' So we will call AddChildControls only for those controls that are NOT repeaters. + If Not (TypeOf child Is System.Web.UI.WebControls.Repeater) Then + AddControlAndChildren(child) + End If + Next + Catch ex As Exception + ' Ignore - we do not want to give an exception if we cannot add all variables. + End Try + + End Sub + + + ''' + ''' If the current is not ASPX page but ASCX controls, the controls in this ASCX control has id starting with underscore. + ''' To avoid confusion in formula, we also define variable name without underscore. + ''' + ''' + Private Sub AddVariableNameWithoutUnderscore() + Dim vars As New Collections.Generic.Dictionary(Of String, Object) + Dim enumerator As Collections.Generic.IEnumerator(Of Collections.Generic.KeyValuePair(Of String, Object)) = Me.Evaluator.Variables.GetEnumerator() + While enumerator.MoveNext + If enumerator.Current.Key.StartsWith("_") Then + Dim varNameWitoutUnderscore As String = enumerator.Current.Key.Substring(1) + If Not Me.Evaluator.Variables.ContainsKey(varNameWitoutUnderscore) Then + vars.Add(varNameWitoutUnderscore, enumerator.Current.Value) + End If + End If + End While + + Dim enumerator2 As Collections.Generic.Dictionary(Of String, Object).Enumerator = vars.GetEnumerator() + While enumerator2.MoveNext + Me.Evaluator.Variables.Add(enumerator2.Current.Key, enumerator2.Current.Value) + End While + End Sub +#End Region + + + End Class + +End Namespace diff --git a/App_Code/Shared/FormulaUtils.vb b/App_Code/Shared/FormulaUtils.vb new file mode 100644 index 0000000..3ab3100 --- /dev/null +++ b/App_Code/Shared/FormulaUtils.vb @@ -0,0 +1,550 @@ +Option Strict On +Imports Microsoft.VisualBasic +Imports System.IO +Imports BaseClasses +Imports BaseClasses.Data +Imports BaseClasses.Utils +Imports Persons.UI +Imports Persons.Data + +Namespace Persons + + ''' + ''' The FormulaUtils class contains a set of functions that are available + ''' in the Formula editor. You can specify any of these functions after + ''' the = sign. + ''' For example, you can say: + ''' = IsEven(32) + ''' These functions throw an exception on an error. The formula evaluator + ''' catches this exception and returns the error string to the user interface. + ''' + ''' All of the functions operate as a Decimal. The Decimal data type is better + ''' then Double or Single since it provides a more accurate value as compared to + ''' Double, and a larger value as compared to a Single. All integers, doubles, etc. + ''' are converted to Decimals as part of these functions. + ''' + ''' Function names are not case sensitive. So you can use ROUND, Round, round, etc. + ''' + ''' + ''' + Public Class FormulaUtils + Inherits BaseFormulaUtils + +#Region "Table Control-level functions" + + ''' + ''' Sum the values of the displayed controls. The ctlName must be + ''' a textbox, label or literal. + ''' This function should be called as [Products]TableControl.SUM("UnitPrice"), not + ''' as shown here. The SUM function in the BaseApplicationTableControl will call this + ''' function to actually perform the work - so that we can keep all of the formula + ''' functions together in one place. + ''' + ''' The table control instance. + ''' The string name of the UI control (e.g., "UnitPrice") + ''' The total of adding the value contained in each of the fields. + Public Overloads Shared Function Sum(ByVal tableControl As BaseApplicationTableControl, ByVal ctlName As String) As Decimal + Dim total As Decimal = 0 + + For Each item As Object In GetSortedValues(tableControl, ctlName) + total += CDec(item) + Next + + Return total + End Function + + ''' + ''' Sum the values of the displayed controls. The ctlName must be + ''' a textbox, label or literal. + ''' This function should be called as [Products]TableControl.TOTAL("UnitPrice"), not + ''' as shown here. The TOTAL function in the BaseApplicationTableControl will call this + ''' function to actually perform the work - so that we can keep all of the formula + ''' functions together in one place. + ''' + ''' The table control instance. + ''' The string name of the UI control (e.g., "UnitPrice") + ''' The total of adding the value contained in each of the fields. + Public Overloads Shared Function Total(ByVal tableControl As BaseApplicationTableControl, ByVal ctlName As String) As Decimal + Dim sum As Decimal = 0 + + For Each item As Object In GetSortedValues(tableControl, ctlName) + sum += CDec(item) + Next + + Return sum + End Function + + + ''' + ''' Finds the maximum among the values of the displayed controls. The ctlName must be + ''' a textbox, label or literal. + ''' This function should be called as [Products]TableControl.Max("UnitPrice"), not + ''' as shown here. The MAX function in the BaseApplicationTableControl will call this + ''' function to actually perform the work - so that we can keep all of the formula + ''' functions together in one place. + ''' + ''' The table control instance. + ''' The string name of the UI control (e.g., "UnitPrice") + ''' The maximum among the values contained in each of the fields. + Public Overloads Shared Function Max(ByVal tableControl As BaseApplicationTableControl, ByVal ctlName As String) As Decimal + Dim maxDecimal As Decimal = Decimal.MinValue + + For Each item As Object In GetSortedValues(tableControl, ctlName) + maxDecimal = Math.Max(maxDecimal, CDec(item)) + Next + + Return maxDecimal + End Function + + ''' + ''' Finds the minimum among the values of the displayed controls. The ctlName must be + ''' a textbox, label or literal. + ''' This function should be called as [Products]TableControl.Min("UnitPrice"), not + ''' as shown here. The MIN function in the BaseApplicationTableControl will call this + ''' function to actually perform the work - so that we can keep all of the formula + ''' functions together in one place. + ''' + ''' The table control instance. + ''' The string name of the UI control (e.g., "UnitPrice") + ''' The minimum among the values contained in each of the fields. + Public Overloads Shared Function Min(ByVal tableControl As BaseApplicationTableControl, ByVal ctlName As String) As Decimal + Dim minDecimal As Decimal = Decimal.MaxValue + + For Each item As Object In GetSortedValues(tableControl, ctlName) + minDecimal = Math.Min(minDecimal, CDec(item)) + Next + + Return minDecimal + End Function + + ''' + ''' Count the number of rows in this table control. + ''' This function should be called as [Products]TableControl.COUNT(), not + ''' as shown here. The COUNT function in the BaseApplicationTableControl will call this + ''' function to actually perform the work - so that we can keep all of the formula + ''' functions together in one place. + ''' + ''' The table control instance. + ''' The string name of the UI control (e.g., "UnitPrice") + ''' The count of the number of rows. + Public Overloads Shared Function Count(ByVal tableControl As BaseApplicationTableControl, ByVal ctlName As String) As Integer + Try + Return tableControl.GetBaseRecordControls().Length() + Catch ex As Exception + ' If there is an error getting the length, we simply fall through and return 0. + End Try + + Return 0 + End Function + + ''' + ''' Count the number of rows in this table control that actually contain + ''' a decimal value (as opposed to be NULL or invalid value) + ''' This function should be called as [Products]TableControl.COUNTA("UnitPrice"), not + ''' as shown here. The COUNTA function in the BaseApplicationTableControl will call this + ''' function to actually perform the work - so that we can keep all of the formula + ''' functions together in one place. + ''' + ''' The table control instance. + ''' The string name of the UI control (e.g., "UnitPrice") + ''' The count of the number of rows. + Public Shared Function CountA(ByVal tableControl As BaseApplicationTableControl, ByVal ctlName As String) As Integer + Dim recCtl As BaseApplicationRecordControl + Dim totalRows As Integer = 0 + + ' Get all of the record controls within this table control. + For Each recCtl In tableControl.GetBaseRecordControls() + Dim ctl As Control + ' The control itself may be embedded in sub-panels, so we need to use + ' FindControlRecursively starting from the recCtl. + ctl = MiscUtils.FindControlRecursively(recCtl, ctlName) + If Not (IsNothing(ctl)) Then + ' Add the row if this contains a valid number. + Dim val As String = Nothing + ' Get the value from the textbox, label or literal + If TypeOf ctl Is System.Web.UI.WebControls.TextBox Then + val = CType(ctl, TextBox).Text + ElseIf TypeOf ctl Is System.Web.UI.WebControls.Label Then + val = CType(ctl, Label).Text + ElseIf TypeOf ctl Is System.Web.UI.WebControls.Literal Then + val = CType(ctl, Literal).Text + End If + Try + If Not (IsNothing(val)) AndAlso val.Trim.Length > 0 Then + totalRows += 1 + End If + Catch ex As Exception + ' Ignore exception - since this is only returning the + ' rows that contain a valid value. Other rows with a + ' NULL value or an invalid value will not be counted. + End Try + End If + Next + + Return totalRows + End Function + + ''' + ''' Calulates the Mean (Average) of the values of the displayed controls. The ctlName must be + ''' a textbox, label or literal. + ''' We could have implemented this as a call to SUM()/COUNT(), but decided to do it this way + ''' for efficiency. + ''' This function should be called as [Products]TableControl.MEAN("UnitPrice"), not + ''' as shown here. The MEAN function in the BaseApplicationTableControl will call this + ''' function to actually perform the work - so that we can keep all of the formula + ''' functions together in one place. + ''' + ''' The table control instance. + ''' The string name of the UI control (e.g., "UnitPrice") + ''' The total of adding the value contained in each of the fields. + Public Shared Function Mean(ByVal tableControl As BaseApplicationTableControl, ByVal ctlName As String) As Decimal + Dim recCtl As BaseApplicationRecordControl + Dim total As Decimal = 0 + Dim numRows As Integer = 0 + + ' Get all of the record controls within this table control. + For Each recCtl In tableControl.GetBaseRecordControls() + Dim ctl As Control + ' The control itself may be embedded in sub-panels, so we need to use + ' FindControlRecursively starting from the recCtl. + ctl = MiscUtils.FindControlRecursively(recCtl, ctlName) + If Not (IsNothing(ctl)) Then + Dim val As String = Nothing + ' Get the value from the textbox, label or literal + If TypeOf ctl Is System.Web.UI.WebControls.TextBox Then + val = CType(ctl, TextBox).Text + ElseIf TypeOf ctl Is System.Web.UI.WebControls.Label Then + val = CType(ctl, Label).Text + ElseIf TypeOf ctl Is System.Web.UI.WebControls.Literal Then + val = CType(ctl, Literal).Text + End If + + Try + ' If the value is not a valid number, ignore it. + total += ParseDecimal(val) + Catch ex As Exception + ' Ignore exception. + End Try + + ' Mean is calculated based on the number of rows, NOT on + ' the number of non-NULL values. So in this way, it is based on + ' COUNT and not on COUNTA. + numRows += 1 + End If + Next + + Return (total / numRows) + End Function + + ''' + ''' Calulates the Average of the values of the displayed controls. The ctlName must be + ''' a textbox, label or literal. + ''' We could have implemented this as a call to SUM()/COUNT(), but decided to do it this way + ''' for efficiency. + ''' This function should be called as [Products]TableControl.AVERAGE("UnitPrice"), not + ''' as shown here. The AVERAGE function in the BaseApplicationTableControl will call this + ''' function to actually perform the work - so that we can keep all of the formula + ''' functions together in one place. + ''' + ''' The table control instance. + ''' The string name of the UI control (e.g., "UnitPrice") + ''' The total of adding the value contained in each of the fields. + Public Overloads Shared Function Average(ByVal tableControl As BaseApplicationTableControl, ByVal ctlName As String) As Decimal + Return Mean(tableControl, ctlName) + End Function + + ''' + ''' Return the Mode of this control. + ''' This function should be called as [Products]TableControl.MODE("UnitPrice"), not + ''' as shown here. The MODE function in the BaseApplicationRecordControl will call this + ''' function to actually perform the work - so that we can keep all of the formula + ''' functions together in one place. + ''' Say there are 5 rows and they contain 57, 57, 12, 57, 98. + ''' The Mode is 57 as it is the number which repeats the maximum number of times. + ''' + ''' The table control instance. + ''' The string name of the UI control (e.g., "UnitPrice") + ''' The row number of the recordControl passed in. 0 if this is not a correct row number. + Public Shared Function Mode(ByVal tableControl As BaseApplicationTableControl, ByVal ctlName As String) As Decimal + Dim rankedArray As ArrayList = GetSortedValues(tableControl, ctlName) + + Dim num As Decimal = 0 + Dim modeVal As Decimal = 0 + + Dim count As Integer = 0 + Dim max As Integer = 0 + + ' Because this is a sorted array, we can + For Each item As Object In rankedArray + If num <> CDec(item) Then + num = CDec(item) + count = 1 + Else + count += 1 + End If + + If count > max Then + max = count + modeVal = num + End If + Next + + Return modeVal + End Function + + ''' + ''' Return the Median of this control. + ''' This function should be called as [Products]TableControl.MEDIAN("UnitPrice"), not + ''' as shown here. The MEDIAN function in the BaseApplicationRecordControl will call this + ''' function to actually perform the work - so that we can keep all of the formula + ''' functions together in one place. + ''' Say there are 5 rows and they contain 57, 32, 12, 19, 98. + ''' The order is 12, 19, 32, 57, 98 - so the Median is 32. + ''' If the number of numbers is even, the Median is the average of the two middle numbers. + ''' Say there are 6 rows and they contain 57, 32, 12, 19, 98, 121 + ''' The order is 12, 19, 32, 57, 98, 121 - so the two numbers in the mid are 32 and 57. + ''' So the median is (32 + 57) / 2 = 89/2 = 44.5 + ''' + ''' The table control instance. + ''' The string name of the UI control (e.g., "UnitPrice") + ''' The row number of the recordControl passed in. 0 if this is not a correct row number. + Public Shared Function Median(ByVal tableControl As BaseApplicationTableControl, ByVal ctlName As String) As Decimal + Dim rankedArray As ArrayList = GetSortedValues(tableControl, ctlName) + + ' If there are 0 elements, then there is no median. + If rankedArray.Count = 0 Then Return 0 + + Dim halfPoint As Integer = CInt(Math.Floor(rankedArray.Count / 2)) + Dim medianValue As Decimal = 0 + If rankedArray.Count Mod 2 = 0 Then + medianValue = (CDec(rankedArray.Item(halfPoint - 1)) + CDec(rankedArray(halfPoint))) / 2 + Else + ' Odd numbered items. So + medianValue = CDec(rankedArray.Item(halfPoint)) + End If + + Return medianValue + End Function + + ''' + ''' Return the Range of this control. + ''' This function should be called as [Products]TableControl.RANGE("UnitPrice"), not + ''' as shown here. The RANGE function in the BaseApplicationRecordControl will call this + ''' function to actually perform the work - so that we can keep all of the formula + ''' functions together in one place. + ''' Say there are 5 rows and they contain 57, 32, 12, 19, 98. + ''' The lowest is 12, highest is 98, so the range is 98-12 = 86 + ''' + ''' The table control instance. + ''' The string name of the UI control (e.g., "UnitPrice") + ''' The row number of the recordControl passed in. 0 if this is not a correct row number. + Public Shared Function Range(ByVal tableControl As BaseApplicationTableControl, ByVal ctlName As String) As Decimal + Dim rankedArray As ArrayList = GetSortedValues(tableControl, ctlName) + + ' If there are 0 or 1 elements, then there is no range. + If rankedArray.Count <= 1 Then Return 0 + + ' Take the difference between the largest and the smallest. + Return CDec(rankedArray.Item(rankedArray.Count - 1)) - CDec(rankedArray.Item(0)) + End Function + +#End Region + +#Region "Record Control-level functions" + + ''' + ''' Return the row number of this record control. + ''' This function should be called as [Products]TableControlRow.ROWNUM(), not + ''' as shown here. The ROWNUM function in the BaseApplicationRecordControl will call this + ''' function to actually perform the work - so that we can keep all of the formula + ''' functions together in one place. + ''' + ''' The table control instance. + ''' The record control whose row number is being determined. Row numbers are 1-based. + ''' The row number of the recordControl passed in. 0 if this is not a correct row number. + Public Shared Function RowNum(ByVal tableControl As BaseApplicationTableControl, ByVal recordControl As BaseApplicationRecordControl) As Integer + Dim recCtl As BaseApplicationRecordControl + Dim rowNumber As Integer = 1 + + ' Get all of the record controls within this table control. + For Each recCtl In tableControl.GetBaseRecordControls() + If Object.ReferenceEquals(recCtl, recordControl) Then + ' We found the row. + Return rowNumber + End If + rowNumber += 1 + Next + + Return 0 + End Function + + ''' + ''' Return the Rank of this control. + ''' This function should be called as [Products]TableControlRow.RANK("UnitPrice"), not + ''' as shown here. The RANK function in the BaseApplicationRecordControl will call this + ''' function to actually perform the work - so that we can keep all of the formula + ''' functions together in one place. + ''' Say there are 5 rows and they contain 57, 32, 12, 19, 98. + ''' Their respecitive ranks will be 4, 3, 1, 2, 5 + ''' + ''' The table control instance. + ''' The record control whose tank is being determined. Rank numbers are 1-based. + ''' The string name of the UI control (e.g., "UnitPrice") + ''' The row number of the recordControl passed in. 0 if this is not a correct row number. + Public Shared Function Rank(ByVal tableControl As BaseApplicationTableControl, ByVal recordControl As BaseApplicationRecordControl, ByVal ctlName As String) As Integer + Dim recCtl As BaseApplicationRecordControl + Dim rankedArray As ArrayList = New ArrayList() + Dim lookFor As Decimal = 0 + + ' Get all of the record controls within this table control. + For Each recCtl In tableControl.GetBaseRecordControls() + Dim ctl As Control + ' The control itself may be embedded in sub-panels, so we need to use + ' FindControlRecursively starting from the recCtl. + ctl = MiscUtils.FindControlRecursively(recCtl, ctlName) + If Not (IsNothing(ctl)) Then + Dim textVal As String = Nothing + Dim val As Decimal = 0 + + ' Get the value from the textbox, label or literal + If TypeOf ctl Is System.Web.UI.WebControls.TextBox Then + textVal = CType(ctl, TextBox).Text + ElseIf TypeOf ctl Is System.Web.UI.WebControls.Label Then + textVal = CType(ctl, Label).Text + ElseIf TypeOf ctl Is System.Web.UI.WebControls.Literal Then + textVal = CType(ctl, Literal).Text + End If + + Try + ' If the value is not a valid number, ignore it. + val = ParseDecimal(textVal) + rankedArray.Add(val) + ' Save the value that we need to look for to determine the rank + If Object.ReferenceEquals(recCtl, recordControl) Then + lookFor = val + End If + Catch ex As Exception + ' Ignore exception. + End Try + End If + Next + + ' Sort the array now. + rankedArray.Sort() + + ' Rank is always 1 based in our case. So we need to add one to the + ' location returned by IndexOf + Return rankedArray.IndexOf(lookFor) + 1 + End Function + + ''' + ''' Return the running total of the control. + ''' This function should be called as [Products]TableControlRow.RUNNINGTOTAL("UnitPrice"), not + ''' as shown here. The RUNNINGTOTAL function in the BaseApplicationRecordControl will call this + ''' function to actually perform the work - so that we can keep all of the formula + ''' functions together in one place. + ''' Say there are 5 rows and they contain 57, 32, 12, 19, 98. + ''' Their respecitive running totals will be 57, 89, 101, 120, 218 + ''' + ''' The table control instance. + ''' The record control whose running total is being determined. + ''' The string name of the UI control (e.g., "UnitPrice") + ''' The running total of the recordControl passed in. + Public Shared Function RunningTotal(ByVal tableControl As BaseApplicationTableControl, ByVal recordControl As BaseApplicationRecordControl, ByVal ctlName As String) As Decimal + Dim recCtl As BaseApplicationRecordControl + Dim lookFor As Decimal = 0 + Dim total As Decimal = 0 + ' Get all of the record controls within this table control. + For Each recCtl In tableControl.GetBaseRecordControls() + Dim ctl As Control + + ' The control itself may be embedded in sub-panels, so we need to use + ' FindControlRecursively starting from the recCtl. + ctl = MiscUtils.FindControlRecursively(recCtl, ctlName) + If Not (IsNothing(ctl)) Then + Dim textVal As String = Nothing + Dim val As Decimal = 0 + + ' Get the value from the textbox, label or literal + If TypeOf ctl Is System.Web.UI.WebControls.TextBox Then + textVal = CType(ctl, TextBox).Text + ElseIf TypeOf ctl Is System.Web.UI.WebControls.Label Then + textVal = CType(ctl, Label).Text + ElseIf TypeOf ctl Is System.Web.UI.WebControls.Literal Then + textVal = CType(ctl, Literal).Text + End If + + Try + ' If the value is not a valid number, ignore it. + val = ParseDecimal(textVal) + total = val + total + ' If the row till which we are finding the running total, return the total till that row + If Object.ReferenceEquals(recCtl, recordControl) Then + Return total + End If + Catch ex As Exception + ' Ignore exception. + End Try + End If + Next + Return total + End Function + + +#End Region + +#Region "Private" + + + ''' + ''' GetSortedValues is a private function that returns the list of sorted values of + ''' the given control name. This is used by Rank, Median, Average, Mode, etc. + ''' + ''' The table control instance. + ''' The string name of the UI control (e.g., "UnitPrice") + ''' A sorted array of values for the given control. + Private Shared Function GetSortedValues(ByVal tableControl As BaseApplicationTableControl, ByVal ctlName As String) As ArrayList + Dim recCtl As BaseApplicationRecordControl + Dim rankedArray As ArrayList = New ArrayList() + + ' Get all of the record controls within this table control. + For Each recCtl In tableControl.GetBaseRecordControls() + Dim ctl As Control + ' The control itself may be embedded in sub-panels, so we need to use + ' FindControlRecursively starting from the recCtl. + ctl = MiscUtils.FindControlRecursively(recCtl, ctlName) + If Not (IsNothing(ctl)) AndAlso ctl.Visible Then + Dim textVal As String = Nothing + Dim val As Decimal = 0 + + ' Get the value from the textbox, label or literal + If TypeOf ctl Is System.Web.UI.WebControls.TextBox Then + textVal = CType(ctl, TextBox).Text + ElseIf TypeOf ctl Is System.Web.UI.WebControls.Label Then + textVal = CType(ctl, Label).Text + ElseIf TypeOf ctl Is System.Web.UI.WebControls.Literal Then + textVal = CType(ctl, Literal).Text + End If + + Try + ' If the value is not a valid number, ignore it. + val = ParseDecimal(textVal) + rankedArray.Add(val) + Catch ex As Exception + ' Ignore exception. + End Try + End If + Next + + ' Sort the array now. + rankedArray.Sort() + + Return rankedArray + End Function + +#End Region + + + End Class + +End Namespace \ No newline at end of file diff --git a/App_Code/Shared/FvLlsHyperLink.vb b/App_Code/Shared/FvLlsHyperLink.vb new file mode 100644 index 0000000..6e45192 --- /dev/null +++ b/App_Code/Shared/FvLlsHyperLink.vb @@ -0,0 +1,200 @@ +' +' +' Typical customizations that may be done in this class include +' - adding custom event handlers +' - overriding base class methods + +Imports System.ComponentModel + +Namespace Persons + + ''' + ''' Renders a hyperlink that displays the app's page in a popup window. + ''' + ''' + ''' Unlike a regular HyperLink, this control's NavigateUrl is ReadOnly and derived automatically at runtime. + ''' + ''' + ''' + Public Class FvLlsHyperLink + Inherits BaseClasses.Web.UI.WebControls.PopupWindowHyperLink + + Public Sub New() + MyBase.New() + Me.WindowFeatures = "width=600, height=400, resizable, scrollbars" + Me.WindowName = "llswin" + + Me.ImageUrl = "~/Images/LargeListSelector.gif" + 'Me.Style.Add("vertical-align", "middle") + Me.CssClass = "llslink" + Me.ToolTip = "More" + End Sub + + 'Shadow the NavigateUrl Property to return a runtime-derived url and to make it ReadOnly. + _ + Public Shadows ReadOnly Property NavigateUrl() As String + Get + Return Me.DeriveNavigateUrl() + End Get + 'Set(ByVal value As String) + ' ViewState("NavigateUrl") = value + 'End Set + End Property + + Private _ControlToUpdate As String = "" + Public Property ControlToUpdate() As String + Get + Return Me._ControlToUpdate + End Get + Set(ByVal value As String) + Me._ControlToUpdate = value + End Set + End Property + + Private _MinListItems As Integer = 100 + _ + Public Property MinListItems() As Integer + Get + Return Me._MinListItems + End Get + Set(ByVal value As Integer) + If (value < 0) Then + value = 0 + End If + Me._MinListItems = value + End Set + End Property + + Private _Table As String = "" + Public Property Table() As String + Get + Return Me._Table + End Get + Set(ByVal value As String) + Me._Table = value + End Set + End Property + + Private _Field As String = "" + Public Property Field() As String + Get + Return Me._Field + End Get + Set(ByVal value As String) + Me._Field = value + End Set + End Property + + Private _DisplayField As String = "" + Public Property DisplayField() As String + Get + Return Me._DisplayField + End Get + Set(ByVal value As String) + Me._DisplayField = value + End Set + End Property + + Private _Formula As String = "" + Public Property Formula() As String + Get + Return Me._Formula + End Get + Set(ByVal value As String) + Me._Formula = value + End Set + End Property + + + Public Function GetControlToUpdate() As Control + If (Len(Me.ControlToUpdate) > 0) Then + Return Me.NamingContainer.FindControl(Me.ControlToUpdate) + End If + Return Nothing + End Function + + Protected Function DeriveNavigateUrl() As String + + Dim c As Control = Me.GetControlToUpdate() + + Dim tableName As String = Me.Table + Dim fieldName As String = Me.Field + Dim displayFieldName As String = Me.DisplayField + Dim formula As String = Me.Formula + + If (IsNothing(displayFieldName)) Then + displayFieldName = fieldName + End If + + ' encrypt all the fields + tableName = CType(Me.Page, Persons.UI.BaseApplicationPage).Encrypt(tableName) + fieldName = CType(Me.Page, Persons.UI.BaseApplicationPage).Encrypt(fieldName) + displayFieldName = CType(Me.Page, Persons.UI.BaseApplicationPage).Encrypt(displayFieldName) + formula = CType(Me.Page, Persons.UI.BaseApplicationPage).Encrypt(formula) + + Return String.Format( _ + "~/Shared/LargeListSelector.aspx?Table={0}&Field={1}&DisplayField={2}&Target={3}&Formula={4}&usnh=n", _ + HttpUtility.UrlEncode(tableName), _ + HttpUtility.UrlEncode(fieldName), _ + HttpUtility.UrlEncode(displayFieldName), _ + HttpUtility.UrlEncode(c.ClientID), _ + HttpUtility.UrlEncode(formula)) + End Function + + Protected Overrides Sub Render(ByVal writer As System.Web.UI.HtmlTextWriter) + If (Me.MinListItems > 0) Then + 'Make this control invisible if the ControlToUpdate is a list with < Me.MinListItems items. + Dim c As Control = Me.GetControlToUpdate() + If Not IsNothing(c) AndAlso Not c.Visible Then + Return + End If + If (TypeOf (c) Is System.Web.UI.WebControls.ListControl) Then + Dim lc As System.Web.UI.WebControls.ListControl = CType(c, System.Web.UI.WebControls.ListControl) + Dim listItemCount As Integer = lc.Items.Count + 'Me.Visible = (listItemCount >= Me.MinListItems) + If (Not listItemCount >= Me.MinListItems) Then + Return 'Don't render the control + End If + End If + End If + + 'Set the inherited NavigateUrl property's value to the shadow's (derived) value + Dim baseNavUrl As String = MyBase.NavigateUrl + MyBase.NavigateUrl = Me.NavigateUrl + + MyBase.Render(writer) + + 'Un-set the inherited NavigateUrl property to the original value + MyBase.NavigateUrl = baseNavUrl + End Sub + + Protected Overrides Sub LoadViewState(ByVal savedState As Object) + MyBase.LoadViewState(savedState) + Me._ControlToUpdate = CStr(Me.ViewState.Item("ControlToUpdate")) + Me._MinListItems = CInt(Me.ViewState.Item("MinListItems")) + Me._Table = CStr(Me.ViewState.Item("Table")) + Me._Field = CStr(Me.ViewState.Item("Field")) + Me._DisplayField = CStr(Me.ViewState.Item("DisplayField")) + Me._Formula = CStr(Me.ViewState.Item("Formula")) + End Sub + + Protected Overrides Function SaveViewState() As Object + Me.ViewState.Item("ControlToUpdate") = Me._ControlToUpdate + Me.ViewState.Item("MinListItems") = Me._MinListItems + Me.ViewState.Item("Table") = Me._Table + Me.ViewState.Item("Field") = Me._Field + Me.ViewState.Item("DisplayField") = Me._DisplayField + Me.ViewState.Item("Formula") = Me._Formula + Return MyBase.SaveViewState() + End Function + + End Class + +End Namespace + + diff --git a/App_Code/Shared/HTMLEditor.vb b/App_Code/Shared/HTMLEditor.vb new file mode 100644 index 0000000..fb367be --- /dev/null +++ b/App_Code/Shared/HTMLEditor.vb @@ -0,0 +1,174 @@ +Imports AjaxControlToolkit.HTMLEditor +Imports System +Imports System.Collections +Imports System.Collections.ObjectModel + +'This class is used by Add/Edit Record pages + +Namespace Persons.UI + + Public Class HTMLEditor + Inherits Editor + + Dim fontName As New AjaxControlToolkit.HTMLEditor.ToolbarButton.FontName() + Dim fontSize As New AjaxControlToolkit.HTMLEditor.ToolbarButton.FontSize() + + ''' + ''' Disables the tabbing for the FontName and FontSize dropdown list + ''' When user tabs from other control to the editor, it should ignore FontName and FontSize dropdown list + ''' and takes the cursor directly inside the editor textbox + ''' + Protected Overrides Sub OnPreRender(ByVal e As EventArgs) + MyBase.OnPreRender(e) + fontName.IgnoreTab = True + fontSize.IgnoreTab = True + End Sub + + ''' + ''' This method is responsible for adding buttons on the TopToolbar of the editor + ''' Remove or Add the buttons provided by AjaxControlToolkit + ''' + Protected Overrides Sub FillTopToolbar() + + Dim options As Collection(Of AjaxControlToolkit.HTMLEditor.ToolbarButton.SelectOption) + Dim [option] As AjaxControlToolkit.HTMLEditor.ToolbarButton.SelectOption + + TopToolbar.Buttons.Add(New AjaxControlToolkit.HTMLEditor.ToolbarButton.Undo()) + TopToolbar.Buttons.Add(New AjaxControlToolkit.HTMLEditor.ToolbarButton.Redo()) + + TopToolbar.Buttons.Add(New AjaxControlToolkit.HTMLEditor.ToolbarButton.HorizontalSeparator()) + TopToolbar.Buttons.Add(New AjaxControlToolkit.HTMLEditor.ToolbarButton.Bold()) + TopToolbar.Buttons.Add(New AjaxControlToolkit.HTMLEditor.ToolbarButton.Italic()) + TopToolbar.Buttons.Add(New AjaxControlToolkit.HTMLEditor.ToolbarButton.Underline()) + TopToolbar.Buttons.Add(New AjaxControlToolkit.HTMLEditor.ToolbarButton.StrikeThrough()) + TopToolbar.Buttons.Add(New AjaxControlToolkit.HTMLEditor.ToolbarButton.SubScript()) + TopToolbar.Buttons.Add(New AjaxControlToolkit.HTMLEditor.ToolbarButton.SuperScript()) + + TopToolbar.Buttons.Add(New AjaxControlToolkit.HTMLEditor.ToolbarButton.HorizontalSeparator()) + TopToolbar.Buttons.Add(New AjaxControlToolkit.HTMLEditor.ToolbarButton.FixedBackColor()) + TopToolbar.Buttons.Add(New AjaxControlToolkit.HTMLEditor.ToolbarButton.BackColorSelector()) + TopToolbar.Buttons.Add(New AjaxControlToolkit.HTMLEditor.ToolbarButton.BackColorClear()) + + TopToolbar.Buttons.Add(New AjaxControlToolkit.HTMLEditor.ToolbarButton.HorizontalSeparator()) + TopToolbar.Buttons.Add(New AjaxControlToolkit.HTMLEditor.ToolbarButton.FixedForeColor()) + TopToolbar.Buttons.Add(New AjaxControlToolkit.HTMLEditor.ToolbarButton.ForeColorSelector()) + TopToolbar.Buttons.Add(New AjaxControlToolkit.HTMLEditor.ToolbarButton.ForeColorClear()) + + TopToolbar.Buttons.Add(New AjaxControlToolkit.HTMLEditor.ToolbarButton.HorizontalSeparator()) + TopToolbar.Buttons.Add(New AjaxControlToolkit.HTMLEditor.ToolbarButton.OrderedList()) + TopToolbar.Buttons.Add(New AjaxControlToolkit.HTMLEditor.ToolbarButton.BulletedList()) + + TopToolbar.Buttons.Add(New AjaxControlToolkit.HTMLEditor.ToolbarButton.HorizontalSeparator()) + TopToolbar.Buttons.Add(New AjaxControlToolkit.HTMLEditor.ToolbarButton.Paragraph()) + TopToolbar.Buttons.Add(New AjaxControlToolkit.HTMLEditor.ToolbarButton.JustifyCenter()) + TopToolbar.Buttons.Add(New AjaxControlToolkit.HTMLEditor.ToolbarButton.JustifyFull()) + TopToolbar.Buttons.Add(New AjaxControlToolkit.HTMLEditor.ToolbarButton.JustifyLeft()) + TopToolbar.Buttons.Add(New AjaxControlToolkit.HTMLEditor.ToolbarButton.JustifyRight()) + TopToolbar.Buttons.Add(New AjaxControlToolkit.HTMLEditor.ToolbarButton.RemoveAlignment()) + + TopToolbar.Buttons.Add(New AjaxControlToolkit.HTMLEditor.ToolbarButton.HorizontalSeparator()) + TopToolbar.Buttons.Add(New AjaxControlToolkit.HTMLEditor.ToolbarButton.IncreaseIndent()) + TopToolbar.Buttons.Add(New AjaxControlToolkit.HTMLEditor.ToolbarButton.DecreaseIndent()) + + TopToolbar.Buttons.Add(New AjaxControlToolkit.HTMLEditor.ToolbarButton.HorizontalSeparator()) + TopToolbar.Buttons.Add(New AjaxControlToolkit.HTMLEditor.ToolbarButton.InsertLink()) + TopToolbar.Buttons.Add(New AjaxControlToolkit.HTMLEditor.ToolbarButton.RemoveLink()) + TopToolbar.Buttons.Add(New AjaxControlToolkit.HTMLEditor.ToolbarButton.InsertHR()) + + ' Uncomment this section of code to add more buttons to the editor. + ' These buttons are commented out because of compatibility issues within the browser + 'TopToolbar.Buttons.Add(New AjaxControlToolkit.HTMLEditor.ToolbarButton.HorizontalSeparator()) + 'TopToolbar.Buttons.Add(New AjaxControlToolkit.HTMLEditor.ToolbarButton.Cut()) + 'TopToolbar.Buttons.Add(New AjaxControlToolkit.HTMLEditor.ToolbarButton.Copy()) + 'TopToolbar.Buttons.Add(New AjaxControlToolkit.HTMLEditor.ToolbarButton.Paste()) + 'TopToolbar.Buttons.Add(New AjaxControlToolkit.HTMLEditor.ToolbarButton.PasteText()) + 'TopToolbar.Buttons.Add(New AjaxControlToolkit.HTMLEditor.ToolbarButton.PasteWord()) + + TopToolbar.Buttons.Add(New AjaxControlToolkit.HTMLEditor.ToolbarButton.HorizontalSeparator()) + TopToolbar.Buttons.Add(New AjaxControlToolkit.HTMLEditor.ToolbarButton.Ltr()) + TopToolbar.Buttons.Add(New AjaxControlToolkit.HTMLEditor.ToolbarButton.Rtl()) + + TopToolbar.Buttons.Add(New AjaxControlToolkit.HTMLEditor.ToolbarButton.HorizontalSeparator()) + TopToolbar.Buttons.Add(fontName) + + options = fontName.Options + [option] = New AjaxControlToolkit.HTMLEditor.ToolbarButton.SelectOption() + [option].Value = "arial,helvetica,sans-serif" + [option].Text = "Arial" + options.Add([option]) + [option] = New AjaxControlToolkit.HTMLEditor.ToolbarButton.SelectOption() + [option].Value = "courier new,courier,monospace" + [option].Text = "Courier New" + options.Add([option]) + [option] = New AjaxControlToolkit.HTMLEditor.ToolbarButton.SelectOption() + [option].Value = "georgia,times new roman,times,serif" + [option].Text = "Georgia" + options.Add([option]) + [option] = New AjaxControlToolkit.HTMLEditor.ToolbarButton.SelectOption() + [option].Value = "tahoma,arial,helvetica,sans-serif" + [option].Text = "Tahoma" + options.Add([option]) + [option] = New AjaxControlToolkit.HTMLEditor.ToolbarButton.SelectOption() + [option].Value = "times new roman,times,serif" + [option].Text = "Times New Roman" + options.Add([option]) + [option] = New AjaxControlToolkit.HTMLEditor.ToolbarButton.SelectOption() + [option].Value = "verdana,arial,helvetica,sans-serif" + [option].Text = "Verdana" + options.Add([option]) + [option] = New AjaxControlToolkit.HTMLEditor.ToolbarButton.SelectOption() + [option].Value = "impact" + [option].Text = "Impact" + options.Add([option]) + [option] = New AjaxControlToolkit.HTMLEditor.ToolbarButton.SelectOption() + [option].Value = "wingdings" + [option].Text = "WingDings" + options.Add([option]) + + TopToolbar.Buttons.Add(New AjaxControlToolkit.HTMLEditor.ToolbarButton.HorizontalSeparator()) + TopToolbar.Buttons.Add(fontSize) + + options = fontSize.Options + [option] = New AjaxControlToolkit.HTMLEditor.ToolbarButton.SelectOption() + [option].Value = "8pt" + [option].Text = "1 ( 8 pt)" + options.Add([option]) + [option] = New AjaxControlToolkit.HTMLEditor.ToolbarButton.SelectOption() + [option].Value = "10pt" + [option].Text = "2 (10 pt)" + options.Add([option]) + [option] = New AjaxControlToolkit.HTMLEditor.ToolbarButton.SelectOption() + [option].Value = "12pt" + [option].Text = "3 (12 pt)" + options.Add([option]) + [option] = New AjaxControlToolkit.HTMLEditor.ToolbarButton.SelectOption() + [option].Value = "14pt" + [option].Text = "4 (14 pt)" + options.Add([option]) + [option] = New AjaxControlToolkit.HTMLEditor.ToolbarButton.SelectOption() + [option].Value = "18pt" + [option].Text = "5 (18 pt)" + options.Add([option]) + [option] = New AjaxControlToolkit.HTMLEditor.ToolbarButton.SelectOption() + [option].Value = "24pt" + [option].Text = "6 (24 pt)" + options.Add([option]) + [option] = New AjaxControlToolkit.HTMLEditor.ToolbarButton.SelectOption() + [option].Value = "36pt" + [option].Text = "7 (36 pt)" + options.Add([option]) + End Sub + + ''' + ''' This method is responsible for adding buttons on the BottomToolbar of the editor + ''' Remove or Add the buttons provided by AjaxControlToolkit + ''' + Protected Overrides Sub FillBottomToolbar() + BottomToolbar.Buttons.Add(New AjaxControlToolkit.HTMLEditor.ToolbarButton.DesignMode()) + BottomToolbar.Buttons.Add(New AjaxControlToolkit.HTMLEditor.ToolbarButton.PreviewMode()) + BottomToolbar.Buttons.Add(New AjaxControlToolkit.HTMLEditor.ToolbarButton.HtmlMode()) + End Sub + + End Class + +End Namespace diff --git a/App_Code/Shared/IDatePagination.vb b/App_Code/Shared/IDatePagination.vb new file mode 100644 index 0000000..819e531 --- /dev/null +++ b/App_Code/Shared/IDatePagination.vb @@ -0,0 +1,46 @@ + +Imports Microsoft.VisualBasic +Imports BaseClasses.Utils.DbUtils + +Namespace Persons.UI + + + + Public Interface IDatePagination + +#Region "Interface Properties" + + ReadOnly Property Day() As System.Web.UI.WebControls.LinkButton + ReadOnly Property Day1() As System.Web.UI.WebControls.Literal + ReadOnly Property Month() As System.Web.UI.WebControls.LinkButton + ReadOnly Property Month1() As System.Web.UI.WebControls.Literal + ReadOnly Property NextInterval() As IThemeButton + ReadOnly Property NextPageInterval() As IThemeButton + ReadOnly Property PageTitle() As System.Web.UI.WebControls.Literal + ReadOnly Property PreviousInterval() As IThemeButton + ReadOnly Property PreviousPageInterval() As IThemeButton + ReadOnly Property Quarter() As System.Web.UI.WebControls.LinkButton + ReadOnly Property Quarter1() As System.Web.UI.WebControls.Literal + ReadOnly Property StartDate1() As System.Web.UI.WebControls.Literal + ReadOnly Property Week() As System.Web.UI.WebControls.LinkButton + ReadOnly Property Week1() As System.Web.UI.WebControls.Literal + ReadOnly Property Year() As System.Web.UI.WebControls.LinkButton + ReadOnly Property Year1() As System.Web.UI.WebControls.Literal + Property Visible() as Boolean + + Property Interval() As String + Sub ProcessPreviousPeriod() + Sub ProcessPreviousPagePeriod(ByVal periodsShown As Integer) + Sub ProcessNextPeriod() + Sub ProcessNextPagePeriod(ByVal periodsShown As Integer) + Sub SetPeriodsShown(ByVal periodsShown As Integer) + Property FirstStartDate() As String + + +#End Region + + End Interface + + +End Namespace + \ No newline at end of file diff --git a/App_Code/Shared/IIncludeComponent.vb b/App_Code/Shared/IIncludeComponent.vb new file mode 100644 index 0000000..0ebfea2 --- /dev/null +++ b/App_Code/Shared/IIncludeComponent.vb @@ -0,0 +1,24 @@ + +Imports Microsoft.VisualBasic +Imports BaseClasses.Utils.DbUtils + +Namespace Persons.UI + + + + Public Interface IIncludeComponent + +#Region "Interface Properties" + + Property Visible() as Boolean + + Sub SaveData() + + +#End Region + + End Interface + + +End Namespace + \ No newline at end of file diff --git a/App_Code/Shared/IMenu_Item.vb b/App_Code/Shared/IMenu_Item.vb new file mode 100644 index 0000000..af6dc9b --- /dev/null +++ b/App_Code/Shared/IMenu_Item.vb @@ -0,0 +1,23 @@ + +Imports Microsoft.VisualBasic +Imports BaseClasses.Utils.DbUtils + +Namespace Persons.UI + + + + Public Interface IMenu_Item + +#Region "Interface Properties" + + ReadOnly Property Button() As System.Web.UI.WebControls.LinkButton + Property Visible() as Boolean + + +#End Region + + End Interface + + +End Namespace + \ No newline at end of file diff --git a/App_Code/Shared/IMenu_ItemVertical.vb b/App_Code/Shared/IMenu_ItemVertical.vb new file mode 100644 index 0000000..d649d16 --- /dev/null +++ b/App_Code/Shared/IMenu_ItemVertical.vb @@ -0,0 +1,23 @@ + +Imports Microsoft.VisualBasic +Imports BaseClasses.Utils.DbUtils + +Namespace Persons.UI + + + + Public Interface IMenu_ItemVertical + +#Region "Interface Properties" + + ReadOnly Property Button() As System.Web.UI.WebControls.LinkButton + Property Visible() as Boolean + + +#End Region + + End Interface + + +End Namespace + \ No newline at end of file diff --git a/App_Code/Shared/IMenu_Item_Highlighted.vb b/App_Code/Shared/IMenu_Item_Highlighted.vb new file mode 100644 index 0000000..fb0df5c --- /dev/null +++ b/App_Code/Shared/IMenu_Item_Highlighted.vb @@ -0,0 +1,23 @@ + +Imports Microsoft.VisualBasic +Imports BaseClasses.Utils.DbUtils + +Namespace Persons.UI + + + + Public Interface IMenu_Item_Highlighted + +#Region "Interface Properties" + + ReadOnly Property Button() As System.Web.UI.WebControls.LinkButton + Property Visible() as Boolean + + +#End Region + + End Interface + + +End Namespace + \ No newline at end of file diff --git a/App_Code/Shared/IMenu_Item_HighlightedVertical.vb b/App_Code/Shared/IMenu_Item_HighlightedVertical.vb new file mode 100644 index 0000000..2fc3731 --- /dev/null +++ b/App_Code/Shared/IMenu_Item_HighlightedVertical.vb @@ -0,0 +1,23 @@ + +Imports Microsoft.VisualBasic +Imports BaseClasses.Utils.DbUtils + +Namespace Persons.UI + + + + Public Interface IMenu_Item_HighlightedVertical + +#Region "Interface Properties" + + ReadOnly Property Button() As System.Web.UI.WebControls.LinkButton + Property Visible() as Boolean + + +#End Region + + End Interface + + +End Namespace + \ No newline at end of file diff --git a/App_Code/Shared/IPagination.vb b/App_Code/Shared/IPagination.vb new file mode 100644 index 0000000..1c0ba2a --- /dev/null +++ b/App_Code/Shared/IPagination.vb @@ -0,0 +1,31 @@ + +Imports Microsoft.VisualBasic +Imports BaseClasses.Utils.DbUtils + +Namespace Persons.UI + + + + Public Interface IPagination + +#Region "Interface Properties" + + ReadOnly Property CurrentPage() As System.Web.UI.WebControls.TextBox + ReadOnly Property FirstPage() As System.Web.UI.WebControls.ImageButton + ReadOnly Property LastPage() As System.Web.UI.WebControls.ImageButton + ReadOnly Property NextPage() As System.Web.UI.WebControls.ImageButton + ReadOnly Property PageSize() As System.Web.UI.WebControls.TextBox + ReadOnly Property PageSizeButton() As System.Web.UI.WebControls.LinkButton + ReadOnly Property PreviousPage() As System.Web.UI.WebControls.ImageButton + ReadOnly Property TotalItems() As System.Web.UI.WebControls.Label + ReadOnly Property TotalPages() As System.Web.UI.WebControls.Label + Property Visible() as Boolean + + +#End Region + + End Interface + + +End Namespace + \ No newline at end of file diff --git a/App_Code/Shared/IPaginationMedium.vb b/App_Code/Shared/IPaginationMedium.vb new file mode 100644 index 0000000..9c201bc --- /dev/null +++ b/App_Code/Shared/IPaginationMedium.vb @@ -0,0 +1,30 @@ + +Imports Microsoft.VisualBasic +Imports BaseClasses.Utils.DbUtils + +Namespace Persons.UI + + + + Public Interface IPaginationMedium + +#Region "Interface Properties" + + ReadOnly Property CurrentPage() As System.Web.UI.WebControls.TextBox + ReadOnly Property FirstPage() As System.Web.UI.WebControls.ImageButton + ReadOnly Property LastPage() As System.Web.UI.WebControls.ImageButton + ReadOnly Property NextPage() As System.Web.UI.WebControls.ImageButton + ReadOnly Property PageSize() As System.Web.UI.WebControls.TextBox + ReadOnly Property PageSizeButton() As System.Web.UI.WebControls.LinkButton + ReadOnly Property PreviousPage() As System.Web.UI.WebControls.ImageButton + ReadOnly Property TotalPages() As System.Web.UI.WebControls.Label + Property Visible() as Boolean + + +#End Region + + End Interface + + +End Namespace + \ No newline at end of file diff --git a/App_Code/Shared/IPaginationShort.vb b/App_Code/Shared/IPaginationShort.vb new file mode 100644 index 0000000..95daa6f --- /dev/null +++ b/App_Code/Shared/IPaginationShort.vb @@ -0,0 +1,29 @@ + +Imports Microsoft.VisualBasic +Imports BaseClasses.Utils.DbUtils + +Namespace Persons.UI + + + + Public Interface IPaginationShort + +#Region "Interface Properties" + + ReadOnly Property CurrentPage() As System.Web.UI.WebControls.TextBox + ReadOnly Property FirstPage() As System.Web.UI.WebControls.ImageButton + ReadOnly Property LastPage() As System.Web.UI.WebControls.ImageButton + ReadOnly Property NextPage() As System.Web.UI.WebControls.ImageButton + ReadOnly Property PageSizeButton() As System.Web.UI.WebControls.LinkButton + ReadOnly Property PreviousPage() As System.Web.UI.WebControls.ImageButton + ReadOnly Property TotalPages() As System.Web.UI.WebControls.Label + Property Visible() as Boolean + + +#End Region + + End Interface + + +End Namespace + \ No newline at end of file diff --git a/App_Code/Shared/IThemeButton.vb b/App_Code/Shared/IThemeButton.vb new file mode 100644 index 0000000..c5e945e --- /dev/null +++ b/App_Code/Shared/IThemeButton.vb @@ -0,0 +1,23 @@ + +Imports Microsoft.VisualBasic +Imports BaseClasses.Utils.DbUtils + +Namespace Persons.UI + + + + Public Interface IThemeButton + +#Region "Interface Properties" + + ReadOnly Property Button() As System.Web.UI.WebControls.LinkButton + Property Visible() as Boolean + + +#End Region + + End Interface + + +End Namespace + \ No newline at end of file diff --git a/App_Code/Shared/ImportDataItems.vb b/App_Code/Shared/ImportDataItems.vb new file mode 100644 index 0000000..98648c6 --- /dev/null +++ b/App_Code/Shared/ImportDataItems.vb @@ -0,0 +1,344 @@ + +Imports System +Imports System.Data +Imports System.IO +Imports System.Configuration +Imports System.Web +Imports System.Web.Security +Imports System.Web.UI +Imports System.Web.UI.WebControls +Imports System.Web.UI.WebControls.WebParts +Imports System.Web.UI.HtmlControls +Imports System.Collections +Imports BaseClasses +Imports BaseClasses.Utils +Imports BaseClasses.Data +Imports BaseClasses.Data.SqlProvider +Imports BaseClasses.Web.UI.WebControls + +Namespace Persons.UI + ''' + ''' Summary description for ImportDataItems + ''' + Public Class ImportDataItems + Dim NumberOfRecordImported As Long = 0 + Dim RowCount As Long = 1 + Dim ColumnCount As Integer = 1 + Private Const SEPARATOR As String = ", " + +#Region "Properties" + + ''' + ''' The path of the file from which data is to be retrieved for import. + ''' + Private _fPath As String + + Public Property FilePath() As String + Get + Return _fPath + End Get + Set(ByVal value As String) + _fPath = value + End Set + End Property + + ' + ' Type of the file to be imported + ' + Private _fType As Parser.FileTypes + + Public Property FileType() As Parser.FileTypes + Get + Return _fType + End Get + Set(ByVal value As Parser.FileTypes) + _fType = value + End Set + End Property + + ''' + ''' The database table to which the records from CSV file has to be imported. + ''' + Private _tbl As BaseTable + + Private Property DBTable() As BaseTable + Get + Return Me._tbl + End Get + Set(ByVal value As BaseTable) + Me._tbl = value + End Set + End Property + + ''' + ''' Stores the list of column names for which the data from CSV file is to be imported to database table.. + ''' + Private _columnNameList As ArrayList + + Private Property ColumnNameList() As ArrayList + Get + Return Me._columnNameList + End Get + Set(ByVal value As ArrayList) + Me._columnNameList = value + End Set + End Property + + ''' + ''' Stores the list of checkboxes which indicate whether corresponding column should be imported or not. + ''' + Private _cbxList As ArrayList + + Private Property ImportList() As ArrayList + Get + Return Me._cbxList + End Get + Set(ByVal value As ArrayList) + Me._cbxList = value + End Set + End Property +#End Region + +#Region "Constructor" + Public Sub New(ByVal path As String, ByVal type As Parser.FileTypes, ByVal bTable As BaseTable, ByVal ddListSelected As ArrayList, ByVal chkBoxList As ArrayList) + MyBase.New() + ' + ' Add constructor logic here + ' + Me.DBTable = bTable + Me.ColumnNameList = ddListSelected + Me.ImportList = chkBoxList + Me.FilePath = path + Me.FileType = type + End Sub + +#End Region + + + +#Region "Methods" + + Private Sub AddSkippedRecordToList(ByRef recordsList As Generic.List(Of BaseClasses.Utils.SkippedLine), _ + ByVal RowCount As Long, ByVal rowValues() As String, ByVal exMsg As String) + If Not exMsg Is Nothing AndAlso Not exMsg.Trim = "" Then + exMsg = exMsg.Replace("'", "\'") + End If + Dim skippedRecord As BaseClasses.Utils.SkippedLine = New BaseClasses.Utils.SkippedLine("", exMsg, RowCount) + For Each rv As String In rowValues + If Not rv Is Nothing AndAlso rv.Trim <> "" Then skippedRecord.LineContent &= rv & SEPARATOR + Next + If skippedRecord.LineContent.EndsWith(", ") Then + skippedRecord.LineContent = skippedRecord.LineContent.Substring(0, skippedRecord.LineContent.Length - 2) + End If + + recordsList.Add(skippedRecord) + End Sub + + ''' + ''' Reads rows of values for CSV file and import it to Database. + ''' + Public Function ImportRecords(ByVal isImportFirstRowChecked As Boolean, ByVal isResolvedForeignKeysChecked As Boolean) As BaseClasses.Utils.ImportedResults + Dim success As Boolean = False + Dim parsr As Parser = Nothing + Dim results As BaseClasses.Utils.ImportedResults = New BaseClasses.Utils.ImportedResults + Try + If ((Me.FilePath Is Nothing) _ + OrElse ((Me.DBTable Is Nothing) _ + OrElse ((Me.ColumnNameList Is Nothing) _ + OrElse (Me.ImportList Is Nothing)))) Then + Return results + End If + DbUtils.StartTransaction() + parsr = Parser.GetParser(Me.FilePath, Me.FileType) + Dim rowValues() As String = parsr.GetNextRow + ' get the first row + If (Not isImportFirstRowChecked _ + AndAlso (Not (rowValues) Is Nothing)) Then + Try + DoImport(rowValues, isResolvedForeignKeysChecked) + RowCount += 1 + + Catch ex As Exception + results.NumberOfSkipped += 1 + Me.AddSkippedRecordToList(results.ListOfSkipped, RowCount + results.NumberOfSkipped, rowValues, ex.Message) + End Try + + + End If + + While (Not (rowValues) Is Nothing) + rowValues = parsr.GetNextRow + If (Not (rowValues) Is Nothing) Then + Try + DoImport(rowValues, isResolvedForeignKeysChecked) + RowCount += 1 + + Catch ex As Exception + results.NumberOfSkipped += 1 + Me.AddSkippedRecordToList(results.ListOfSkipped, RowCount + results.NumberOfSkipped, rowValues, ex.Message) + End Try + + End If + + End While + DbUtils.CommitTransaction() + parsr.Close() + + success = True + ' turn on success only when all the rows are imported ie, saved into database. + Catch e As Exception + DbUtils.RollBackTransaction() + results.NumberOfImported = 0 + parsr.Close() + Dim errorMsg As String = e.Message + If File.Exists(Me.FilePath) Then + File.Delete(Me.FilePath) + End If + errorMsg = String.Format("- " & errorMsg & Environment.NewLine & "- Import error occurred at Row = {0},Column = {1}", RowCount, ColumnCount) + Throw New Exception(errorMsg) + Finally + DbUtils.EndTransaction() + If (File.Exists(Me.FilePath)) Then + File.Delete(Me.FilePath) + End If + End Try + results.NumberOfImported = NumberOfRecordImported + Return results + End Function + + ''' + ''' Creates a database record and calls UpdateColumnValuesInRecord to set the record values. + ''' + Private Sub DoImport(ByVal rowValues() As String, ByVal isResolvedForeignKeysChecked As Boolean) + Dim r As IRecord + r = Me.DBTable.CreateRecord + If (UpdateColumnValuesInRecord(rowValues, r, isResolvedForeignKeysChecked)) Then + r.Save() + NumberOfRecordImported = NumberOfRecordImported + 1 + End If + End Sub + + ''' + ''' Sets a database record values with values retrieved from CSV file. + ''' + ''' + ''' + Private Function UpdateColumnValuesInRecord(ByVal rowValues() As String, ByVal record As IRecord, ByVal isResolvedForeignKeysChecked As Boolean) As Boolean + Dim j As Integer = 0 + Dim isRecordUpdated As Boolean = False + ColumnCount = 1 + For Each data As String In rowValues + ColumnCount = ColumnCount + 1 + If j > Me.ImportList.Count - 1 Then + Return isRecordUpdated + End If + Try + + + If ((Me.ColumnNameList(j).ToString <> "") _ + AndAlso CType(Me.ImportList(j), CheckBox).Checked) Then + Dim fkColumn As ForeignKey = Nothing + Dim currentColumn As BaseColumn = Me.DBTable.TableDefinition.ColumnList.GetByAnyName(CType(Me.ColumnNameList(j), String)) + If isResolvedForeignKeysChecked Then + fkColumn = Me.DBTable.TableDefinition.GetForeignKeyByColumnName(currentColumn.InternalName) + End If + Dim colValue As String = "" + ' Check if the foreign key has DFKA. If so, then check the calue from csv file agains the DFKA column in the parent/foreign key table. + ' If a match is found retrieve its ID and set that as value to be insterted in the current table where you are adding records. + If (Not (fkColumn) Is Nothing) Then + Dim originalTableDef As TableDefinition = fkColumn.PrimaryKeyTableDefinition + Dim originalBaseTable As BaseTable = originalTableDef.CreateBaseTable + Dim wc As WhereClause = Nothing + Dim records As ArrayList = New ArrayList + Dim pkColumn As BaseColumn = CType(originalTableDef.PrimaryKey.Columns(0), BaseColumn) + 'Index is zero because we handle only those tables which has single PK column not composite keys. + If ((Not (fkColumn.PrimaryKeyDisplayColumns) Is Nothing) _ + AndAlso (fkColumn.PrimaryKeyDisplayColumns <> "") AndAlso (Not fkColumn.PrimaryKeyDisplayColumns.Trim().StartsWith("="))) Then + wc = New WhereClause(originalTableDef.ColumnList.GetByAnyName(fkColumn.PrimaryKeyDisplayColumns), BaseFilter.ComparisonOperator.EqualsTo, data) + ElseIf ((Not (fkColumn.PrimaryKeyDisplayColumns) Is Nothing) _ + AndAlso (fkColumn.PrimaryKeyDisplayColumns <> "") AndAlso (fkColumn.PrimaryKeyDisplayColumns.Trim().StartsWith("="))) Then + Dim primaryKeyDisplay As String = GetDFKA(fkColumn) + If Not IsNothing(primaryKeyDisplay) Then + wc = New WhereClause(originalTableDef.ColumnList.GetByAnyName(primaryKeyDisplay), BaseFilter.ComparisonOperator.EqualsTo, data) + Else + wc = New WhereClause(pkColumn, BaseFilter.ComparisonOperator.EqualsTo, data) + End If + Else + ' if the foreign key does not have DFKA then just check in the foreign key table if the id exists. If not create a record with the specified ID + ' before adding to current table + wc = New WhereClause(pkColumn, BaseFilter.ComparisonOperator.EqualsTo, data) + End If + Dim join As BaseClasses.Data.BaseFilter = Nothing + records = originalBaseTable.GetRecordList(join, wc.GetFilter, Nothing, Nothing, 0, 100) + If (records.Count > 0) Then + ' take the first record and retrieve its ID. + Dim rec As BaseRecord = CType(records(0), BaseRecord) + colValue = rec.GetValue(pkColumn).ToString + Else + ' IF there is not match found then you have to create a record in the foreign key table with DFKA value and then retreive its ID + If ((Not (data) Is Nothing) _ + And (data <> "")) Then + Dim tempRec As IRecord + If ((Not (fkColumn.PrimaryKeyDisplayColumns) Is Nothing) _ + AndAlso (fkColumn.PrimaryKeyDisplayColumns <> "") AndAlso (Not fkColumn.PrimaryKeyDisplayColumns.Trim().StartsWith("="))) Then + tempRec = originalBaseTable.CreateRecord + Dim tableDef As TableDefinition = originalBaseTable.TableDefinition + For Each newCol As BaseColumn In tableDef.Columns + If fkColumn.PrimaryKeyDisplayColumns = newCol.InternalName Then + tempRec.SetValue(data, newCol.UniqueName) + End If + Next + Else + tempRec = originalBaseTable.CreateRecord(data) + End If + tempRec.Save() + colValue = tempRec.GetValue(pkColumn).ToString + End If + 'colValue = data + End If + Else + colValue = data + End If + ' set the table row's column for value + record.SetValue(colValue, currentColumn.UniqueName) + isRecordUpdated = True + End If + j = (j + 1) + Catch ex As Exception + Throw New Exception(ex.InnerException.Message) + End Try + + Next + Return isRecordUpdated + End Function + + Public Shared Function GetDFKA(ByVal fkColumn As ForeignKey) As String 'ByVal rec As BaseRecord, + Dim isDFKA As Boolean = False + If fkColumn Is Nothing Then + Return Nothing + End If + Dim _DFKA As String = fkColumn.PrimaryKeyDisplayColumns + + ' if the formula is in the format of "= ., then pull out the data from the rec object instead of doing formula evaluation + Dim tableCodeName As String = fkColumn.PrimaryKeyTableDefinition.TableCodeName + Dim column As String = _DFKA.Trim("="c).Trim() + If column.StartsWith(tableCodeName & ".", StringComparison.InvariantCultureIgnoreCase) Then + column = column.Substring(tableCodeName.Length + 1) + End If + + For Each c As BaseColumn In fkColumn.PrimaryKeyTableDefinition.Columns + If column = c.CodeName Then + isDFKA = True + Exit For + End If + Next + + If isDFKA Then + Return column + Else + Return Nothing + End If + End Function +#End Region + End Class +End Namespace \ No newline at end of file diff --git a/App_Code/Shared/LargeListSelector.Controls.vb b/App_Code/Shared/LargeListSelector.Controls.vb new file mode 100644 index 0000000..bf62a11 --- /dev/null +++ b/App_Code/Shared/LargeListSelector.Controls.vb @@ -0,0 +1,1225 @@ +Imports Microsoft.VisualBasic +Imports System +Imports System.Web.UI.WebControls +Imports System.Collections +Imports System.Collections.Generic +Imports BaseClasses +Imports BaseClasses.Web.UI.WebControls +Imports BaseClasses.Data +Imports BaseClasses.Data.BaseFilter.ComparisonOperator +Imports BaseClasses.Data.BaseFilter +Imports BaseClasses.Utils +Imports BaseClasses.Data.OrderByItem.OrderDir + +Namespace Persons.UI.Controls.LargeListSelector + +#Region "Section 1: Place your customizations here." + + Public Class ItemsTableRecordControl + Inherits BaseItemsTableRecordControl + + End Class + + ' The ItemsTable class implements the query used to retrieve records + ' to be displayed in the grid. The static query at design time is combined with the dynamic + ' filter and search criteria. + + Public Class ItemsTable + Inherits BaseItemsTable + + End Class + +#End Region + +#Region "Section 2: Do not modify this section." + ' Base class for the ItemsTableRecordControl control on the LargeListSelector page. + Public Class BaseItemsTableRecordControl + Inherits Persons.UI.BaseApplicationRecordControl + + Private Const ASSEMBLY_NAME As String = "Persons.Business" + + Protected Overridable Sub Control_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Init + ' Register the event handlers. + AddHandler Me.SelectButton.Click, AddressOf SelectButton_Click + + Me.Page.RegisterPostBackTrigger(Me.SelectButton, MiscUtils.GetParentControlObject(Me, "ItemsTableControlUpdatePanel")) + + End Sub + + Protected Overridable Sub Control_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load + + End Sub + + ' Populate the UI controls using the DataSource. + Public Overrides Sub DataBind() + + ' Make sure that the DataSource is initialized. + If Me.DataSource Is Nothing Then + Return + End If + + Dim table As ItemsTable = DirectCast(Me.Page.FindControlRecursively("ItemsTable"), ItemsTable) + Dim td As BaseClasses.Data.TableDefinition = table.GetTable().TableDefinition + Dim col As BaseClasses.Data.BaseColumn = td.ColumnList.GetByAnyName(table.Field) + Dim displayCol As BaseClasses.Data.BaseColumn = td.ColumnList.GetByAnyName(table.DisplayField) + + Me.ValueText.Text = Me.DataSource.GetValue(col).ToString() + + Dim formula As String = table.Formula() + Dim dfka As String = "" + + If Not String.IsNullOrEmpty(formula) Then + Me.ItemText.Text = Me.EvaluateFormula(formula, Me.DataSource, Nothing, td.TableCodeName) + Else + If displayCol Is Nothing Then + dfka = table.DisplayField + If dfka.Trim.StartsWith("=") Then + Me.ItemText.Text = Me.EvaluateFormula(dfka, Me.DataSource, Nothing, td.TableCodeName) + Else + Me.ItemText.Text = Me.DataSource.Format(col) + End If + Else + Me.ItemText.Text = Me.DataSource.Format(displayCol) + End If + + End If + + End Sub + + ' Read data from database. + Public Overridable Sub LoadData() + End Sub + + + Public Overridable Function EvaluateFormula(ByVal formula As String) As String + Dim e As FormulaEvaluator = New FormulaEvaluator() + + + e.DataSource = Me.DataSource + + ' 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 + + Return resultObj.ToString() + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, Optional ByVal format As String = Nothing, Optional ByVal name As String = "") As String + Dim e As Persons.Data.BaseFormulaEvaluator = New Persons.Data.BaseFormulaEvaluator() + If Not dataSourceForEvaluate Is Nothing Then + e.Evaluator.Variables.Add(name, dataSourceForEvaluate) + End If + e.DataSource = dataSourceForEvaluate + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + If Not String.IsNullOrEmpty(format) Then + Return Persons.Data.BaseFormulaUtils.Format(resultObj, format) + Else + Return resultObj.ToString() + End If + End Function + + Protected Overridable Sub SelectButton_Click(ByVal sender As Object, ByVal args As EventArgs) + Dim table As ItemsTable = DirectCast(Me.Page.FindControlRecursively("ItemsTable"), ItemsTable) + Me.RegisterSelectValueScript(table.Target, Me.ValueText.Text, Me.ItemText.Text) + + Dim keyForVal As String = table.Target & "_SelectedValue" + Dim keyForDisplayText As String = table.Target & "_SelectedDisplayText" + + Me.Page.Session.Add(keyForVal, Me.ValueText.Text) + Me.Page.Session.Add(keyForDisplayText, Me.ItemText.Text) + End Sub + + Protected Overrides Sub LoadViewState(ByVal savedState As Object) + MyBase.LoadViewState(savedState) + End Sub + + Protected Overrides Function SaveViewState() As Object + Return MyBase.SaveViewState() + End Function + + Private _DataSource As IRecord + Public Property DataSource() As BaseRecord + Get + Return CType(Me._DataSource, BaseRecord) + End Get + Set(ByVal value As BaseRecord) + Me._DataSource = value + End Set + End Property + +#Region "Helper Properties" + + + Public ReadOnly Property Formula() As System.Web.UI.WebControls.Label + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Formula"), System.Web.UI.WebControls.Label) + End Get + End Property + + Public ReadOnly Property ValueText() As System.Web.UI.WebControls.Label + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "ValueText"), System.Web.UI.WebControls.Label) + End Get + End Property + + Public ReadOnly Property SelectButton() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "SelectButton"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property ItemText() As System.Web.UI.WebControls.Label + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "ItemText"), System.Web.UI.WebControls.Label) + End Get + End Property +#End Region + +#Region "Helper Functions" + Public Shadows ReadOnly Property Page() As BaseApplicationPage + Get + Return DirectCast(MyBase.Page, BaseApplicationPage) + End Get + End Property + + Private Sub RegisterSelectValueScript(ByVal target As String, ByVal value As String, ByVal text As String) + Dim scriptContent As String = String.Format( _ + "updateTarget({0}, {1}, {2});", _ + BaseClasses.Web.AspxTextWriter.CreateJScriptStringLiteral(target), _ + BaseClasses.Web.AspxTextWriter.CreateJScriptStringLiteral(value), _ + BaseClasses.Web.AspxTextWriter.CreateJScriptStringLiteral(text) _ + ) + Dim script As String = BaseClasses.Web.AspxTextWriter.CreateJScriptBlock(scriptContent) + Me.Page.ClientScript.RegisterStartupScript(GetType(String), "SelectValueScript", script) + End Sub + +#End Region + + End Class + + ' Base class for the ItemsTable control on the LargeListSelector page. + Public Class BaseItemsTable + Inherits Persons.UI.BaseApplicationTableControl + + Private Const ASSEMBLY_NAME As String = "Persons.Business" + + Protected Overridable Sub Control_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Init + + ' Setup the pagination events. + AddHandler Me.Pagination.FirstPage.Click, AddressOf Pagination_FirstPage_Click + AddHandler Me.Pagination.LastPage.Click, AddressOf Pagination_LastPage_Click + AddHandler Me.Pagination.NextPage.Click, AddressOf Pagination_NextPage_Click + AddHandler Me.Pagination.PageSizeButton.Click, AddressOf Pagination_PageSizeButton_Click + AddHandler Me.Pagination.PreviousPage.Click, AddressOf Pagination_PreviousPage_Click + + ' Setup - the button events. + AddHandler Me.SearchButton.Button.Click, AddressOf SearchButton_Click + + ' Control Initializations. + If Not Me.Page.IsPostBack Then + ' Initialize the table's current sort order. + Me.CurrentSortOrder = New OrderBy(True, False) + + ' Setup default pagination settings. + Me.PageSize = 10 + Me.PageIndex = 0 + End If + + End Sub + + Protected Overridable Sub Control_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load + Me.RegisterAutoCloseScript() + + Try + ' Load data only when displaying the page for the first time + If (Not Me.Page.IsPostBack) Then + + ' Must start a transaction before performing database operations + DbUtils.StartTransaction() + + ' Load data for each record and table UI control. + ' Ordering is important because child controls get + ' their parent ids from their parent UI controls. + Me.LoadData() + Me.DataBind() + End If + + Catch ex As Exception + ' An error has occured so display an error message. + Utils.RegisterJScriptAlert(Me, "Load_Error_Message", ex.Message) + Finally + If Not Me.Page.IsPostBack Then + ' End database transaction + DbUtils.EndTransaction() + End If + End Try + End Sub + + ' Read data from database. Returns an array of records that can be assigned + ' to the DataSource table control property. + Public Overridable Sub LoadData() + + ' Make sure all url parametes are passed. + If ((Len(BaseClasses.Utils.NetUtils.GetUrlParam(Me, "Table", True)) < 1) OrElse _ + (Len(BaseClasses.Utils.NetUtils.GetUrlParam(Me, "Field", True)) < 1) OrElse _ + (Len(BaseClasses.Utils.NetUtils.GetUrlParam(Me, "DisplayField", True)) < 1) OrElse _ + (Len(BaseClasses.Utils.NetUtils.GetUrlParam(Me, "Target", True)) < 1) _ + ) Then + Me.DataSource = DirectCast((New ArrayList()).ToArray(GetType(BaseRecord)), BaseRecord()) + Return + End If + ' Save all of the URL parameters in the session for use by Ajax type-ahead control + HttpContext.Current.Session().Add("LLSAjaxTable", Me.Table()) + HttpContext.Current.Session().Add("LLSAjaxField", Me.Field()) + HttpContext.Current.Session().Add("LLSAjaxDisplayField", Me.DisplayField()) + HttpContext.Current.Session().Add("LLSAjaxFormula", Me.Formula()) + + ' The WHERE clause will be empty when displaying all records in table. + Dim whereClause As WhereClause = CreateWhereClause() + Dim orderBy As OrderBy = CreateOrderBy() + + ' Set the pagesize. + Me.SetPagintionPageSize() + + ' Get the total number of records to be displayed. + Me.TotalRecords = CInt(Me.GetTable().GetRecordListCount(Nothing, whereClause.GetFilter(), Nothing, Nothing)) + + ' Go to the last page. + If Me.TotalPages <= 0 Then + Me.PageIndex = 0 + ElseIf Me.DisplayLastPage OrElse Me.PageIndex >= Me.TotalPages Then + Me.PageIndex = Me.TotalPages - 1 + End If + + ' Retrieve the records and set the table DataSource. + ' Only PageSize records are fetched starting at PageIndex (zero based). + Dim join As BaseClasses.Data.BaseFilter = Nothing + Me.DataSource = DirectCast(Me.GetTable().GetRecordList(join, whereClause.GetFilter(), Nothing, orderBy, Me.PageIndex, Me.PageSize, Nothing).ToArray(GetType(BaseRecord)), BaseRecord()) + + End Sub + + ' Populate the UI controls. + Public Overrides Sub DataBind() + + MyBase.DataBind() + + ' Make sure that the DataSource is initialized. + If Me.DataSource Is Nothing Then + Return + End If + + ' Setup the pagination controls. + BindPaginationControls() + + Dim rep As System.Web.UI.WebControls.Repeater = CType(Me.FindControl("row1"), System.Web.UI.WebControls.Repeater) + rep.DataSource = Me.DataSource() + rep.DataBind() + + Dim index As Integer = 0 + Dim repItem As System.Web.UI.WebControls.RepeaterItem + Dim listDuplicatesText = New ArrayList() + Dim listDuplicatesRecControl = New ArrayList() + Dim fvalue As String + Dim cvalue As String + + For Each repItem In rep.Items + ' Loop through all rows in the table, set its DataSource and call DataBind(). + Dim recControl As ItemsTableRecordControl = DirectCast(repItem.FindControl("ItemsTableRecordControl"), ItemsTableRecordControl) + recControl.DataSource = Me.DataSource(index) + recControl.DataBind() + + fvalue = recControl.ItemText.Text + cvalue = recControl.ValueText.Text + + If (IsNothing(fvalue)) Then + fvalue = "" + End If + + fvalue = fvalue.Trim() + + If (fvalue.Length > 50) Then + fvalue = fvalue.Substring(0, 50) + "..." + End If + + Dim dupItemIdx As Integer = listDuplicatesText.IndexOf(fvalue) + + If (dupItemIdx >= 0) Then + Dim dupItem As ItemsTableRecordControl = CType(listDuplicatesRecControl(dupItemIdx), ItemsTableRecordControl) + + dupItem.ItemText.Text = fvalue + " (ID " + dupItem.ValueText.Text.Substring(0, Math.Min(dupItem.ValueText.Text.Length, 38)) + ")" + End If + + If (listDuplicatesText.Contains(fvalue)) Then + recControl.ItemText.Text = fvalue + " (ID " + cvalue.Substring(0, Math.Min(cvalue.Length, 38)) + ")" + End If + + listDuplicatesText.Add(fvalue) + listDuplicatesRecControl.Add(recControl) + + index += 1 + Next + + End Sub + + + Protected Overridable Sub BindPaginationControls() + + ' Setup the pagination controls. + + ' Bind the buttons for CategoriesTableControl pagination. + Me.Pagination.FirstPage.Enabled = Not (Me.PageIndex = 0) + Me.Pagination.LastPage.Enabled = Not (Me.PageIndex = Me.TotalPages - 1) + Me.Pagination.NextPage.Enabled = Not (Me.PageIndex = Me.TotalPages - 1) + Me.Pagination.PreviousPage.Enabled = Not (Me.PageIndex = 0) + + ' Bind the pagination labels. + Me.Pagination.CurrentPage.Text = (Me.PageIndex + 1).ToString() + Me.Pagination.PageSize.Text = Me.PageSize.ToString() + Dim totalPagesTB As Label = DirectCast(MiscUtils.FindControlRecursively(Me.Pagination, "_TotalPages"), Label) + If totalPagesTB IsNot Nothing Then + totalPagesTB.Text = Me.TotalPages.ToString() + End If + End Sub + + Protected Overridable Sub SetPagintionPageSize() + If Not Me.Pagination.PageSize Is Nothing AndAlso _ + Not Me.Pagination.PageSize.Text Is Nothing AndAlso _ + Me.Pagination.PageSize.Text.Trim <> "" Then + Try + Me.PageSize = Integer.Parse(Me.Pagination.PageSize.Text) + Catch ex As Exception + End Try + End If + End Sub + + Protected Overridable Function CreateOrderBy() As OrderBy + + + Dim displayCol As BaseClasses.Data.BaseColumn = Me.GetTable().TableDefinition.ColumnList.GetByAnyName(Me.DisplayField) + + + If GetDFKAColumns().Count > 0 Then + Dim dfkacolumns As List(Of BaseClasses.Data.BaseColumn) = GetDFKAColumns() + For Each col As BaseClasses.Data.BaseColumn In dfkacolumns + If col.ColumnType.Equals(BaseColumn.ColumnTypes.String) OrElse _ + col.ColumnType.Equals(BaseColumn.ColumnTypes.Number) OrElse _ + col.ColumnType.Equals(BaseColumn.ColumnTypes.Email) OrElse _ + col.ColumnType.Equals(BaseColumn.ColumnTypes.USA_State) OrElse _ + col.ColumnType.Equals(BaseColumn.ColumnTypes.USA_Zip_Code) OrElse _ + col.ColumnType.Equals(BaseColumn.ColumnTypes.USA_Phone_Number) Then + Me.CurrentSortOrder.Add(col, Asc) + End If + Next + Else + Me.CurrentSortOrder.Add(displayCol, Asc) + End If + + Return Me.CurrentSortOrder + End Function + + Protected Overridable Function CreateWhereClause() As WhereClause + Dim whereClause As WhereClause = New WhereClause() + + Dim displayCol As BaseClasses.Data.BaseColumn = Me.GetTable().TableDefinition.ColumnList.GetByAnyName(Me.DisplayField) + + If MiscUtils.IsValueSelected(Me.StartsWith) Then + ' Strip "..." from begin and ending of the search text, otherwise the search will return 0 values as in database "..." is not stored. + If Me.StartsWith.Text.StartsWith("...") Then + Me.StartsWith.Text = Me.StartsWith.Text.Substring(3, Me.StartsWith.Text.Length - 3) + End If + If Me.StartsWith.Text.EndsWith("...") Then + Me.StartsWith.Text = Me.StartsWith.Text.Substring(0, Me.StartsWith.Text.Length - 3) + End If + Me.StartsWith.Text = Me.StartsWith.Text.Trim() + If GetDFKAColumns().Count > 0 Then + Dim wc As WhereClause = New WhereClause() + Dim dfkacolumns As List(Of BaseClasses.Data.BaseColumn) = GetDFKAColumns() + For Each col As BaseClasses.Data.BaseColumn In dfkacolumns + If col.ColumnType.Equals(BaseColumn.ColumnTypes.String) OrElse _ + col.ColumnType.Equals(BaseColumn.ColumnTypes.Number) OrElse _ + col.ColumnType.Equals(BaseColumn.ColumnTypes.Email) OrElse _ + col.ColumnType.Equals(BaseColumn.ColumnTypes.USA_State) OrElse _ + col.ColumnType.Equals(BaseColumn.ColumnTypes.USA_Zip_Code) OrElse _ + col.ColumnType.Equals(BaseColumn.ColumnTypes.USA_Phone_Number) Then + wc.iOR(col, BaseFilter.ComparisonOperator.Starts_With, Me.StartsWith.Text, True, False) + End If + Next + whereClause.iAND(wc) + Else + whereClause.iAND(displayCol, Starts_With, Me.StartsWith.Text, True, False) + End If + End If + + If MiscUtils.IsValueSelected(Me.Contains) Then + ' Strip "..." from begin and ending of the search text, otherwise the search will return 0 values as in database "..." is not stored. + If Me.Contains.Text.StartsWith("...") Then + Me.Contains.Text = Me.Contains.Text.Substring(3, Me.Contains.Text.Length - 3) + End If + If Me.StartsWith.Text.EndsWith("...") Then + Me.Contains.Text = Me.Contains.Text.Substring(0, Me.Contains.Text.Length - 3) + End If + Me.Contains.Text = Me.Contains.Text.Trim() + If GetDFKAColumns().Count > 0 Then + Dim wc As WhereClause = New WhereClause() + Dim dfkacolumns As List(Of BaseClasses.Data.BaseColumn) = GetDFKAColumns() + For Each col As BaseClasses.Data.BaseColumn In dfkacolumns + If col.ColumnType.Equals(BaseColumn.ColumnTypes.String) OrElse _ + col.ColumnType.Equals(BaseColumn.ColumnTypes.Number) OrElse _ + col.ColumnType.Equals(BaseColumn.ColumnTypes.Email) OrElse _ + col.ColumnType.Equals(BaseColumn.ColumnTypes.USA_State) OrElse _ + col.ColumnType.Equals(BaseColumn.ColumnTypes.USA_Zip_Code) OrElse _ + col.ColumnType.Equals(BaseColumn.ColumnTypes.USA_Phone_Number) Then + wc.iOR(col, BaseFilter.ComparisonOperator.Contains, Me.Contains.Text, True, False) + End If + Next + whereClause.iAND(wc) + Else + whereClause.iAND(displayCol, ComparisonOperator.Contains, Me.Contains.Text, True, False) + End If + End If + + Return whereClause + 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 bStartsWith As Boolean, ByVal AutoTypeAheadWordSeparators As String) As WhereClause + 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) + + Dim displayCol As BaseClasses.Data.BaseColumn = Me.GetTable().TableDefinition.ColumnList.GetByAnyName(Me.DisplayField) + + ' Adds clauses if values are selected in Filter controls which are configured in the page. + + If IsValueSelected(searchText) Then + Dim formatedSearchText As String = searchText + ' strip "..." from begin and ending of the search text, otherwise the search will return 0 values as in database "..." is not stored. + If searchText.StartsWith("...") Then + formatedSearchText = searchText.Substring(3, searchText.Length - 3) + End If + If searchText.EndsWith("...") Then + formatedSearchText = searchText.Substring(0, searchText.Length - 3) + End If + 'After stripping "...", trim any leading and trailing whitespaces + formatedSearchText = formatedSearchText.Trim() + + ' These clauses are added depending on operator and fields selected in Control's property page, bindings tab. + Dim search As WhereClause = New WhereClause() + If Not displayCol Is Nothing Then + If bStartsWith Then + ' Search Text specified in Starts With textbox + search.iOR(displayCol, BaseFilter.ComparisonOperator.Starts_With, formatedSearchText, True, False) + Else + ' Search Text specified in Contains textbox + search.iOR(displayCol, BaseFilter.ComparisonOperator.Starts_With, formatedSearchText, True, False) + search.iOR(displayCol, BaseFilter.ComparisonOperator.Contains, AutoTypeAheadWordSeparators & formatedSearchText, True, False) + End If + Else + Dim dfkacolumns As List(Of BaseClasses.Data.BaseColumn) = GetDFKAColumns() + For Each col As BaseClasses.Data.BaseColumn In dfkacolumns + If col.ColumnType.Equals(BaseColumn.ColumnTypes.String) Then + If (bStartsWith) Then + ' Search Text specified in Starts With textbox + search.iOR(col, BaseFilter.ComparisonOperator.Starts_With, formatedSearchText, True, False) + End If + Else + ' Search Text specified in Contains textbox + search.iOR(col, BaseFilter.ComparisonOperator.Starts_With, formatedSearchText, True, False) + search.iOR(col, BaseFilter.ComparisonOperator.Contains, AutoTypeAheadWordSeparators + formatedSearchText, True, False) + End If + Next + End If + wc.iAND(search) + End If + + If Not displayCol Is Nothing Then + ' The Ajax call may come from one of the fields (e.g., StartsWith). But the user may have some text in the other field. + ' So we need to add the clause for the other field. + + If Not (bStartsWith) Then + ' This was the Contains textbox that was used in Ajax, so add the StartsWith clause. + Dim StartsWithSearchSelectedValue As String = CType(HttpContext.Current.Session()(HttpContext.Current.Session.SessionID & appRelativeVirtualPath & "StartsWithSearch_Ajax"), String) + If IsValueSelected(StartsWithSearchSelectedValue) Then + wc.iAND(displayCol, BaseFilter.ComparisonOperator.Starts_With, StartsWithSearchSelectedValue, False, False) + End If + Else + ' This was the StartsWith textbox that was used in Ajax, so add the Contains clause. + Dim ContainsSelectedValue As String = CType(HttpContext.Current.Session()(HttpContext.Current.Session.SessionID & appRelativeVirtualPath & "ContainsSearch_Ajax"), String) + If IsValueSelected(ContainsSelectedValue) Then + wc.iAND(displayCol, BaseFilter.ComparisonOperator.Contains, ContainsSelectedValue, False, False) + End If + End If + Else + + Dim dfkacolumns As List(Of BaseClasses.Data.BaseColumn) = GetDFKAColumns() + Dim wcAllColumns As WhereClause = New WhereClause() + For Each col As BaseClasses.Data.BaseColumn In dfkacolumns + If Not (bStartsWith) Then + ' This was the Contains textbox that was used in Ajax, so add the StartsWith clause. + Dim StartsWithSearchSelectedValue As String = CType(HttpContext.Current.Session()(HttpContext.Current.Session.SessionID & appRelativeVirtualPath & "StartsWithSearch_Ajax"), String) + If IsValueSelected(StartsWithSearchSelectedValue) Then + wcAllColumns.iOR(col, BaseFilter.ComparisonOperator.Starts_With, StartsWithSearchSelectedValue, False, False) + End If + Else + ' This was the StartsWith textbox that was used in Ajax, so add the Contains clause. + Dim ContainsSelectedValue As String = CType(HttpContext.Current.Session()(HttpContext.Current.Session.SessionID & appRelativeVirtualPath & "ContainsSearch_Ajax"), String) + If IsValueSelected(ContainsSelectedValue) Then + wcAllColumns.iOR(col, BaseFilter.ComparisonOperator.Contains, ContainsSelectedValue, False, False) + End If + End If + Next + End If + + Return wc + End Function + Public Overridable Function GetDFKAColumns() As List(Of BaseClasses.Data.BaseColumn) + + Dim formula As String = "" + Dim table As ItemsTable = CType(Me.Page.FindControlRecursively("ItemsTable"), ItemsTable) + + If Not String.IsNullOrEmpty(table.Formula) Then + formula = table.Formula + Else + Dim dfka As String = Me.DisplayField + dfka = dfka.Replace(Me.Table, "") + dfka = dfka.Replace("=", "") + dfka = dfka.Replace(" ", "") + formula = dfka + End If + + Dim dfkaColumns As List(Of BaseClasses.Data.BaseColumn) = New List(Of BaseClasses.Data.BaseColumn)() + Dim columns() As BaseClasses.Data.BaseColumn = Me.GetTable().TableDefinition.ColumnList.ToColumnArray() + For Each col As BaseColumn In columns + If formula.ToLower().Contains(col.CodeName.ToLower()) Then + formula.Replace(col.CodeName, "") + dfkaColumns.Add(col) + End If + Next + Return dfkaColumns + End Function + + Public Overridable Function GetAutoCompletionList(ByVal startsWithText As String, ByVal containsText As String, ByVal count As Integer) As String() + Dim resultList As ArrayList = New ArrayList + Dim wordList As ArrayList = New ArrayList + Dim iteration As Integer = 0 + Dim prefixText As String = "" + Dim displayCol As BaseClasses.Data.BaseColumn = Me.GetTable().TableDefinition.ColumnList.GetByAnyName(Me.DisplayField) + + Dim wc As WhereClause + + If Not (IsNothing(startsWithText)) AndAlso startsWithText.Trim.Length() > 0 Then + prefixText = startsWithText + wc = CreateWhereClause(startsWithText, True, "[!a-zA-Z0-9]") + Else + prefixText = containsText + wc = CreateWhereClause(containsText, False, "[!a-zA-Z0-9]") + End If + + While (resultList.Count < count AndAlso iteration < 5) + ' Fetch 100 records in each iteration + ' Dim records() As BaseRecord = Me.GetTable().G.GetRecords(wc, Nothing, iteration, 100) + Dim join As BaseClasses.Data.BaseFilter = Nothing + Dim records() As BaseRecord = DirectCast(Me.GetTable().GetRecordList(join, wc.GetFilter(), Nothing, Nothing, iteration, 100).ToArray(GetType(BaseRecord)), BaseRecord()) + Dim rec As BaseRecord = Nothing + Dim resultItem As String = "" + For Each rec In records + ' Exit the loop if recordList count has reached AutoTypeAheadListSize. + If resultList.Count >= count Then + Exit For + End If + ' If the field is configured to Display as Foreign key, Format() method returns the + ' Display as Forien Key value instead of original field value. + ' Since search had to be done in multiple fields (selected in Control's page property, binding tab) in a record, + ' We need to find relevent field to display which matches the prefixText and is not already present in the result list. + + resultItem = rec.Format(displayCol) + + If InvariantUCase(resultItem).Contains(InvariantUCase(prefixText)) Then + Dim isAdded As Boolean = FormatSuggestions(prefixText, resultItem, 50, "AtBeginningOfMatchedString", "WordsStartingWithSearchString", "[^a-zA-Z0-9]", resultList) + If isAdded Then + Continue For + End If + End If + Next + + ' Exit the loop if number of records found is less as further iteration will not return any more records + If records.Length < 100 Then + Exit While + End If + iteration += 1 + End While + + resultList.Sort() + Dim result() As String = New String(resultList.Count - 1) {} + Array.Copy(resultList.ToArray, result, resultList.Count) + Return result + End Function + + + + 'Formats the resultItem and adds it to the list of suggestions. + Public Overridable Function FormatSuggestions(ByVal prefixText As String, ByVal resultItem As String, _ + ByVal columnLength As Integer, ByVal AutoTypeAheadDisplayFoundText As String, _ + ByVal autoTypeAheadSearch As String, ByVal AutoTypeAheadWordSeparators As String, _ + ByVal resultList As ArrayList) As Boolean + Dim index As Integer = InvariantLCase(resultItem).IndexOf(InvariantLCase(prefixText)) + 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 + If Not itemToAdd Is Nothing AndAlso Not resultList.Contains(itemToAdd) Then + resultList.Add(itemToAdd) + isAdded = True + End If + End If + Return isAdded + End Function + + + + Private Sub Control_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.PreRender + If Me.DataChanged Then + Try + ' Must start a transaction before performing database operations + DbUtils.StartTransaction() + + ' Load data for each record and table UI control. + ' Ordering is important because child controls get + ' their parent ids from their parent UI controls. + Me.LoadData() + Me.DataBind() + + Catch ex As Exception + ' An error has occured so display an error message. + Utils.RegisterJScriptAlert(Me, "Load_Error_Message", ex.Message) + Finally + ' End database transaction + DbUtils.EndTransaction() + End Try + End If + End Sub + + Protected Overrides Sub LoadViewState(ByVal savedState As Object) + MyBase.LoadViewState(savedState) + + Dim orderByStr As String = CType(ViewState("ItemsTable_OrderBy"), String) + If Not orderByStr Is Nothing OrElse orderByStr.Trim <> "" Then + Me.CurrentSortOrder = BaseClasses.Data.OrderBy.FromXmlString(orderByStr) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + End If + + Dim pageIndex As String = CType(ViewState("Page_Index"), String) + If Not pageIndex Is Nothing Then + Me.PageIndex = CInt(pageIndex) + End If + + Dim pageSize As String = CType(ViewState("Page_Size"), String) + If Not pageSize Is Nothing Then + Me.PageSize = CInt(pageSize) + End If + End Sub + + Protected Overrides Function SaveViewState() As Object + + Me.ViewState("ItemsTable_OrderBy") = Me.CurrentSortOrder.ToXmlString() + + Me.ViewState("Page_Index") = Me.PageIndex + Me.ViewState("Page_Size") = Me.PageSize + + Return MyBase.SaveViewState() + + End Function + + ' Generate the event handling functions for pagination events. + Public Overridable Sub Pagination_FirstPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + Try + Me.PageIndex = 0 + Me.DataChanged = True + Catch ex As Exception + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + Finally + End Try + End Sub + + ' event handler for ImageButton + Public Overridable Sub Pagination_LastPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + Try + Me.DisplayLastPage = True + Me.DataChanged = True + Catch ex As Exception + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + Finally + End Try + End Sub + + ' event handler for ImageButton + Public Overridable Sub Pagination_NextPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + Try + Me.PageIndex += 1 + Me.DataChanged = True + Catch ex As Exception + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + Finally + End Try + End Sub + + ' event handler for Button w/ Layout + Public Overridable Sub Pagination_PageSizeButton_Click(ByVal sender As Object, ByVal args As EventArgs) + Try + Me.DataChanged = True + Me.PageSize = Integer.Parse(Me.Pagination.PageSize.Text) + Me.PageIndex = Integer.Parse(Me.Pagination.CurrentPage.Text) - 1 + Catch ex As Exception + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + Finally + End Try + End Sub + + ' event handler for ImageButton + Public Overridable Sub Pagination_PreviousPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + Try + If Me.PageIndex > 0 Then + Me.PageIndex -= 1 + Me.DataChanged = True + End If + Catch ex As Exception + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + Finally + End Try + End Sub + + ' Generate the event handling functions for button events. + Public Overridable Sub SearchButton_Click(ByVal sender As Object, ByVal args As EventArgs) + Try + Me.DataChanged = True + Catch ex As Exception + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + Finally + End Try + End Sub + + 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 _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 _TotalRecords As Integer + Public Property TotalRecords() As Integer + Get + Return Me._TotalRecords + End Get + Set(ByVal value As Integer) + If Me.PageSize > 0 Then + Dim num As Double = Me.PageSize + Me.TotalPages = CInt(Math.Ceiling(value / num)) + End If + + Me._TotalRecords = 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 _DisplayLastPage As Boolean + Public Property DisplayLastPage() As Boolean + Get + Return Me._DisplayLastPage + End Get + Set(ByVal value As Boolean) + Me._DisplayLastPage = value + End Set + End Property + + Private _DataChanged As Boolean = False + Public Property DataChanged() As Boolean + Get + Return Me._DataChanged + End Get + Set(ByVal value As Boolean) + Me._DataChanged = value + End Set + End Property + + Private _CurrentSortOrder As OrderBy = Nothing + Public Property CurrentSortOrder() As OrderBy + Get + Return Me._CurrentSortOrder + End Get + Set(ByVal value As BaseClasses.Data.OrderBy) + Me._CurrentSortOrder = value + End Set + End Property + + Private _DataSource() As BaseRecord = Nothing + Public Property DataSource() As BaseRecord() + Get + Return Me._DataSource + End Get + Set(ByVal value() As BaseRecord) + Me._DataSource = value + End Set + End Property + + Public ReadOnly Property Table() As String + Get + Dim errMsg As String = "" + Dim TYPE_FORMAT As String = "{0}.{1}{2},{3}" + Dim tableName As String = "" + Try + ' Try getting from the URL. If not, get it from the session. + tableName = BaseClasses.Utils.NetUtils.GetUrlParam(Me, "Table", True) + tableName = HttpUtility.UrlDecode(tableName) + Catch ex As Exception + ' Get from the session. This table name already contains the prefix required, so we return directly. + tableName = CStr(HttpContext.Current.Session()("LLSAjaxTable")) + Return tableName + End Try + + tableName = CType(Me.Page, BaseApplicationPage).Decrypt(tableName) + + tableName = tableName.Replace(" ", "_") + tableName = tableName.Replace(".", "_") + + + ' Check if it is a table. + Try + + Dim tableType As String = String.Format(TYPE_FORMAT, "Persons.Business", tableName, "Table", "App_Code") + Type.GetType(tableType, True, True) + Return tableType + Catch ex As Exception + End Try + + ' Check if it is a view. + Try + + Dim viewType As String = String.Format(TYPE_FORMAT, "Persons.Business", tableName, "View", "App_Code") + Type.GetType(viewType, True, True) + Return viewType + Catch ex As Exception + End Try + + ' Check if it is a query. + Try + + Dim queryType As String = String.Format(TYPE_FORMAT, "Persons.Business", tableName, "Query", "App_Code") + Type.GetType(queryType, True, True) + Return queryType + Catch ex As Exception + End Try + + Try + + Dim tableType As String = String.Format(TYPE_FORMAT, "Persons.Business", "Table" & tableName, "Table", "App_Code") + Type.GetType(tableType, True, True) + Return tableType + Catch ex As Exception + End Try + + ' Check if it is a view. + Try + + Dim viewType As String = String.Format(TYPE_FORMAT, "Persons.Business", "Table" & tableName, "View", "App_Code") + Type.GetType(viewType, True, True) + Return viewType + Catch ex As Exception + End Try + + ' Check if it is a query. + Try + + Dim queryType As String = String.Format(TYPE_FORMAT, "Persons.Business", "Table" & tableName, "Query", "App_Code") + Type.GetType(queryType, True, True) + Return queryType + Catch ex As Exception + End Try + + Throw New Exception("Fail to locate business layer for " & tableName) + Return "" + End Get + End Property + + Public ReadOnly Property Field() As String + Get + Dim fld As String = "" + Try + ' Try getting from the URL. If not, get it from the session. + fld = BaseClasses.Utils.NetUtils.GetUrlParam(Me, "Field", True) + fld = HttpUtility.UrlDecode(fld) + Catch ex As Exception + ' Get from the session + fld = CStr(HttpContext.Current.Session()("LLSAjaxField")) + End Try + + fld = CType(Me.Page, BaseApplicationPage).Decrypt(fld) + + Return fld + End Get + End Property + + Public ReadOnly Property DisplayField() As String + Get + Dim fld As String = "" + Try + Try + ' Try getting from the URL. If not, get it from the session. + fld = BaseClasses.Utils.NetUtils.GetUrlParam(Me, "DisplayField", True) + fld = HttpUtility.UrlDecode(fld) + Catch ex As Exception + ' Get from the session + fld = CStr(HttpContext.Current.Session()("LLSAjaxDisplayField")) + End Try + + fld = CType(Me.Page, BaseApplicationPage).Decrypt(fld) + Catch + End Try + Return fld + End Get + End Property + + Public ReadOnly Property Formula() As String + Get + Dim fld As String = "" + Try + Try + ' Try getting from the URL. If not, get it from the session. + fld = BaseClasses.Utils.NetUtils.GetUrlParam(Me, "Formula", False, False, False) + fld = HttpUtility.UrlDecode(fld) + Catch ex As Exception + ' Get from the session + fld = CStr(HttpContext.Current.Session()("LLSFormulaField")) + End Try + + fld = CType(Me.Page, BaseApplicationPage).Decrypt(fld) + + Catch + + End Try + + Return fld + End Get + End Property + + Public ReadOnly Property Target() As String + Get + Return BaseClasses.Utils.NetUtils.GetUrlParam(Me, "Target", True) + End Get + End Property + +#Region "Helper Properties" + Public ReadOnly Property StartsWith() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "StartsWith"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property Contains() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Contains"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property SearchButton() As Persons.UI.IThemeButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "SearchButton"), Persons.UI.IThemeButton) + End Get + End Property + + Public ReadOnly Property Pagination() As Persons.UI.IPaginationMedium + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Pagination"), Persons.UI.IPaginationMedium) + End Get + End Property +#End Region + +#Region "Helper Functions" + + ' What do we generate when there is no selection box for the record? + Public Overloads Overrides Function ModifyRedirectUrl(ByVal url As String, ByVal arg As String, ByVal bEncrypt As Boolean) As String + Return ModifyRedirectUrl(url, arg, Nothing, False) + End Function + + Public Function GetRecordControls() As ItemsTableRecordControl() + + Dim recList As ArrayList = New ArrayList() + + Dim rep As System.Web.UI.WebControls.Repeater = CType(Me.FindControl("row1"), System.Web.UI.WebControls.Repeater) + Dim repItem As System.Web.UI.WebControls.RepeaterItem + For Each repItem In rep.Items + Dim recControl As ItemsTableRecordControl = DirectCast(repItem.FindControl("ItemsTableRecordControl"), ItemsTableRecordControl) + recList.Add(recControl) + Next + + Return DirectCast(recList.ToArray(GetType(ItemsTableRecordControl)), ItemsTableRecordControl()) + End Function + + Public Shadows ReadOnly Property Page() As BaseApplicationPage + Get + Return DirectCast(MyBase.Page, BaseApplicationPage) + End Get + End Property + + Private Sub RegisterAutoCloseScript() + 'If (Me.IsPostBack) Then + ' Return + 'End If + If (BaseClasses.Utils.StringUtils.InvariantUCase(Me.Page.Request.Browser.Browser).IndexOf("IE") < 0) Then + Return + End If + If (Me.Page.Request.Browser.MajorVersion < 5) Then + Return + End If + + 'attach a function to the parent window's onunload event + 'that will close the current window + Dim script As String = BaseClasses.Web.AspxTextWriter.CreateJScriptBlock( _ + "function onParentUnload() { window.close(); }" & vbCrLf & _ + "if (window.opener && !window.opener.closed) { window.opener.attachEvent('onunload', onParentUnload);}") + Me.Page.ClientScript.RegisterClientScriptBlock(GetType(String), "AutoCloseScript", script) + End Sub + + Public Function GetTable() As BaseClasses.Data.BaseTable + Dim tn As String = Me.Table + Try + Return BaseClasses.Data.BaseTable.CreateInstance(tn) + Catch e As System.Exception + tn = String.Format("{0}.{1}Access,{2}", "Persons", Replace(tn, " ", "_"), "Persons") + Return BaseClasses.Data.BaseTable.CreateInstance(tn) + End Try + End Function +#End Region + + End Class + +#End Region + +End Namespace \ No newline at end of file diff --git a/App_Code/Shared/MenuXmlSiteMapProvider.vb b/App_Code/Shared/MenuXmlSiteMapProvider.vb new file mode 100644 index 0000000..f58a247 --- /dev/null +++ b/App_Code/Shared/MenuXmlSiteMapProvider.vb @@ -0,0 +1,27 @@ +Imports System +Imports System.Web +Imports BaseClasses.Utils +Imports BaseClasses.Configuration + +Namespace Persons.UI + + ''' + ''' Summary description for MenuXmlSiteMapProvider + ''' This integrates site map provider with role based security. + ''' + Public Class MenuXmlSiteMapProvider + Inherits XmlSiteMapProvider + + + + ' Check the logged in user against the role asigned for the current menu. + ' Returns true if logged user belongs to the role. If not then false is returned. + Public Overrides Function IsAccessibleToUser(ByVal context As HttpContext, ByVal node As SiteMapNode) As Boolean + If (node.Roles.Count = 0) Then + Return True + Else + Return BaseClasses.Utils.SecurityControls.IsUserInRole(context, node.Roles) + End If + End Function + End Class +End Namespace diff --git a/App_Code/Shared/Parser.vb b/App_Code/Shared/Parser.vb new file mode 100644 index 0000000..6068a78 --- /dev/null +++ b/App_Code/Shared/Parser.vb @@ -0,0 +1,85 @@ + Imports System + Imports System.Data + Imports System.Configuration + Imports System.Web + Imports System.Web.Security + Imports System.Web.UI + Imports System.Web.UI.WebControls + Imports System.Web.UI.WebControls.WebParts + Imports System.Web.UI.HtmlControls + Imports System.Text + Imports System.IO + +Namespace Persons.UI + + ''' + ''' Summary description for Parser: Parser for files like csv, excel etc. + ''' + Public MustInherit Class Parser + + ' The type of file. ie, extension of the file. + Public Enum FileTypes + CSV + XLS + XLSX + MDB + ACCDB + TAB + End Enum + + ' Constructor + Public Sub New() + MyBase.New + + End Sub + + ' Reset resources + Public MustOverride Sub Reset() + + ' Get one record at a time + Public MustOverride Function GetNextRow() As String() + + 'Close parser and dispose parser object + Public MustOverride Sub Close() + + ' Generic function to get instance of parser class based on file type. + Public Shared Function GetParser(ByVal filePath As String, ByVal type As FileTypes) As Parser + Dim parsr As Parser = Nothing + Select Case (type) + Case FileTypes.CSV + parsr = New CsvParser(filePath, System.Globalization.CultureInfo.CurrentUICulture.TextInfo.ListSeparator(0)) + Case FileTypes.TAB + parsr = New CsvParser(filePath, vbTab) + Case FileTypes.XLS + Try + parsr = New ExcelParser(filePath, HttpContext.Current.Session("SheetName").ToString()) + Catch e As Exception + Throw New Exception(e.Message) + End Try + Case FileTypes.XLSX + Try + parsr = New ExcelParser(filePath, HttpContext.Current.Session("SheetName").ToString()) + Catch e As Exception + Throw New Exception(e.Message) + End Try + Case FileTypes.MDB + Try + parsr = New AccessParser(filePath, HttpContext.Current.Session("TableName").ToString()) + Catch e As Exception + Throw New Exception(e.Message) + End Try + Exit Select + Case FileTypes.ACCDB + Try + parsr = New AccessParser(filePath, HttpContext.Current.Session("TableName").ToString()) + Catch e As Exception + Throw New Exception(e.Message) + End Try + Exit Select + End Select + Return parsr + End Function + + End Class +End Namespace + diff --git a/App_Code/Shared/SignInState.vb b/App_Code/Shared/SignInState.vb new file mode 100644 index 0000000..2664750 --- /dev/null +++ b/App_Code/Shared/SignInState.vb @@ -0,0 +1,165 @@ +Imports Persons.Data + +Namespace Persons.UI + + + Public Class SignInConstants + Public Const UserName As String = "SIS_UserName" + Public Const Password As String = "SIS_Password" + Public Const OriginalUserName As String = "SIS_OriginalUserName" + Public Const OriginalPassword As String = "SIS_OriginalPassword" + Public Const OriginalRememberUser As String = "SIS_OriginalRememberUser" + Public Const OriginalRememberPassword As String = "SIS_OriginalRememberPassword" + Public Const IsUNToRemember As String = "SIS_IsUNToRemember" + Public Const IsPassToRemember As String = "SIS_IsPassToRemember" + Public Const IsCancelled As String = "SIS_IsCancelled" + Public Const IsAutoLogin As String = "SIS_IsAutoLogin" + Public Const LoginPassword As String = "SIS_LoginPassword" + End Class + Public Class SignInState + Private Session As System.Web.SessionState.HttpSessionState + Public Property UserName() As String + Get + Dim s As String = CType(Me.Session.Item(SignInConstants.UserName), String) + If (s Is Nothing) Then + Return "" + End If + Return s + End Get + Set(ByVal value As String) + Me.Session.Item(SignInConstants.UserName) = value + End Set + End Property + Public Property Password() As String + Get + Dim CheckCrypto As Crypto = New Crypto(Crypto.Providers.DES) + Dim key As String = BaseClasses.Configuration.ApplicationSettings.Current.CookieEncryptionKey + Dim s As String = CType(Me.Session.Item(SignInConstants.Password), String) + If (s Is Nothing OrElse s.Trim = "") Then + Return "" + End If + Return CheckCrypto.Decrypt(s, key, System.Text.Encoding.Unicode, False) + End Get + Set(ByVal value As String) + Dim CheckCrypto As Crypto = New Crypto(Crypto.Providers.DES) + Dim key As String = BaseClasses.Configuration.ApplicationSettings.Current.CookieEncryptionKey + Me.Session.Item(SignInConstants.Password) = CheckCrypto.Encrypt(value, key, System.Text.Encoding.Unicode, False) + End Set + End Property + Public Property LoginPassword() As String + Get + Dim CheckCrypto As Crypto = New Crypto(Crypto.Providers.DES) + Dim key As String = BaseClasses.Configuration.ApplicationSettings.Current.CookieEncryptionKey + Dim s As String = CType(Me.Session.Item(SignInConstants.LoginPassword), String) + If (s Is Nothing OrElse s.Trim = "") Then + Return "" + End If + Return CheckCrypto.Decrypt(s, key, System.Text.Encoding.Unicode, False) + End Get + Set(ByVal value As String) + Dim CheckCrypto As Crypto = New Crypto(Crypto.Providers.DES) + Dim key As String = BaseClasses.Configuration.ApplicationSettings.Current.CookieEncryptionKey + Me.Session.Item(SignInConstants.LoginPassword) = CheckCrypto.Encrypt(value, key, System.Text.Encoding.Unicode, False) + End Set + End Property + Public Property OriginalUserName() As String + Get + Dim s As String = CType(Me.Session.Item(SignInConstants.OriginalUserName), String) + If (s Is Nothing) Then + Return "" + End If + Return s + End Get + Set(ByVal value As String) + Me.Session.Item(SignInConstants.OriginalUserName) = value + End Set + End Property + Public Property OriginalPassword() As String + Get + Dim s As String = CType(Me.Session.Item(SignInConstants.OriginalPassword), String) + If (s Is Nothing) Then + Return "" + End If + Return s + End Get + Set(ByVal value As String) + Me.Session.Item(SignInConstants.OriginalPassword) = value + End Set + End Property + Public Property OriginalRememberUser() As String + Get + Dim s As String = CType(Me.Session.Item(SignInConstants.OriginalRememberUser), String) + If (s Is Nothing) Then + Return "" + End If + Return s + End Get + Set(ByVal value As String) + Me.Session.Item(SignInConstants.OriginalRememberUser) = value + End Set + End Property + Public Property OriginalRememberPassword() As String + Get + Dim s As String = CType(Me.Session.Item(SignInConstants.OriginalRememberPassword), String) + If (s Is Nothing) Then + Return "" + End If + Return s + End Get + Set(ByVal value As String) + Me.Session.Item(SignInConstants.OriginalRememberPassword) = value + End Set + End Property + Public Property IsUNToRemember() As Boolean + Get + Dim s As String = CType(Me.Session.Item(SignInConstants.IsUNToRemember), String) + If (s Is Nothing) Then + Return False + End If + Return Boolean.Parse(s) + End Get + Set(ByVal value As Boolean) + Me.Session.Item(SignInConstants.IsUNToRemember) = value.ToString + End Set + End Property + Public Property IsPassToRemember() As Boolean + Get + Dim s As String = CType(Me.Session.Item(SignInConstants.IsPassToRemember), String) + If (s Is Nothing) Then + Return False + End If + Return Boolean.Parse(s) + End Get + Set(ByVal value As Boolean) + Me.Session.Item(SignInConstants.IsPassToRemember) = value.ToString + End Set + End Property + Public Property IsCancelled() As Boolean + Get + Dim s As String = CType(Me.Session.Item(SignInConstants.IsCancelled), String) + If (s Is Nothing) Then + Return False + End If + Return Boolean.Parse(s) + End Get + Set(ByVal value As Boolean) + Me.Session.Item(SignInConstants.IsCancelled) = value.ToString + End Set + End Property + Public Property IsAutoLogin() As Boolean + Get + Dim s As String = CType(Me.Session.Item(SignInConstants.IsAutoLogin), String) + If (s Is Nothing) Then + Return True + End If + Return Boolean.Parse(s) + End Get + Set(ByVal value As Boolean) + Me.Session.Item(SignInConstants.IsAutoLogin) = value.ToString + End Set + End Property + Public Sub New() + Me.Session = HttpContext.Current.Session + End Sub + End Class +End Namespace diff --git a/App_Code/Sport/AddSport.Controls.vb b/App_Code/Sport/AddSport.Controls.vb new file mode 100644 index 0000000..1601980 --- /dev/null +++ b/App_Code/Sport/AddSport.Controls.vb @@ -0,0 +1,1031 @@ + +' This file implements the TableControl, TableControlRow, and RecordControl classes for the +' AddSport.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.AddSport + +#Region "Section 1: Place your customizations here." + + +'Public Class PersonalSportSkillTableControlRow +' Inherits BasePersonalSportSkillTableControlRow +' ' The BasePersonalSportSkillTableControlRow implements code for a ROW within the +' ' the PersonalSportSkillTableControl table. The BasePersonalSportSkillTableControlRow implements the DataBind and SaveData methods. +' ' The loading of data is actually performed by the LoadData method in the base class of PersonalSportSkillTableControl. +' +' ' This is the ideal place to add your code customizations. For example, you can override the DataBind, +' ' SaveData, GetUIData, and Validate methods. +' +' +'End Class +' + + + +'Public Class PersonalSportSkillTableControl +' Inherits BasePersonalSportSkillTableControl +' +' ' The BasePersonalSportSkillTableControl class implements the LoadData, DataBind, CreateWhereClause +' ' and other methods to load and display the data in a table control. +' +' ' This is the ideal place to add your code customizations. You can override the LoadData and CreateWhereClause, +' ' The PersonalSportSkillTableControlRow class offers another place where you can customize +' ' the DataBind, GetUIData, SaveData and Validate methods specific to each row displayed on the table. +' +'End Class +' + + +Public Class SportRecordControl + Inherits BaseSportRecordControl + ' The BaseSportRecordControl 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 SportRecordControl control on the AddSport page. +' Do not modify this class. Instead override any method in SportRecordControl. +Public Class BaseSportRecordControl + Inherits Persons.UI.BaseApplicationRecordControl + + ' To customize, override this method in SportRecordControl. + 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 SportRecordControl. + 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.SPORT.TextChanged, AddressOf SPORT_TextChanged + + AddHandler Me.SportId.TextChanged, AddressOf SportId_TextChanged + + + End Sub + + + Public Overridable Sub LoadData() + + ' Load the data from the database into the DataSource Sport 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 = SportTable.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() + + ' 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 SportRecord() + + Return + End If + + ' Retrieve the record from the database. It is possible + + Dim recList() As SportRecord = SportTable.GetRecords(wc, Nothing, 0, 2) + If recList.Length = 0 Then + ' There is no data for this Where clause. + wc.RunQuery = False + + Return + End If + + ' Set DataSource based on record retrieved from the database. + Me.DataSource = CType(SportRecord.Copy(recList(0), False), SportRecord) + + + + End Sub + + ' Populate the UI controls using the DataSource. To customize, override this method in SportRecordControl. + 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 + + SetSPORT() + SetSportId() + SetSportIdLabel() + SetSPORTLabel() + SetSportRecordControlCollapsibleRegion() + SetSportRecordControlIcon() + SetSportRecordControlPanelExtender() + + + + 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 SetSPORT() + + + ' Set the SPORT TextBox on the webpage with value from the + ' Sport database record. + + ' Me.DataSource is the Sport record retrieved from the database. + ' Me.SPORT is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetSPORT() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.SPORTSpecified Then + + ' If the SPORT is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(SportTable.SPORT) + + Me.SPORT.Text = formattedValue + + Else + + ' SPORT is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.SPORT.Text = SportTable.SPORT.Format(SportTable.SPORT.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetSportId() + + + ' Set the SportId TextBox on the webpage with value from the + ' Sport database record. + + ' Me.DataSource is the Sport record retrieved from the database. + ' Me.SportId is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetSportId() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.SportIdSpecified Then + + ' If the SportId is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(SportTable.SportId) + + Me.SportId.Text = formattedValue + + Else + + ' SportId is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.SportId.Text = SportTable.SportId.Format(SportTable.SportId.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetSportIdLabel() + + End Sub + + Public Overridable Sub SetSPORTLabel() + + End Sub + + Public Overridable Sub SetSportRecordControlCollapsibleRegion() + + End Sub + + Public Overridable Sub SetSportRecordControlIcon() + + End Sub + + Public Overridable Sub SetSportRecordControlPanelExtender() + + 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 SportRecordControl. + Public Overridable Sub SaveData() + ' Saves the associated record in the database. + ' SaveData calls Validate and Get methods - so it may be more appropriate to + ' customize those methods. + + ' 1. Load the existing record from the database. Since we save the entire record, this ensures + ' that fields that are not displayed are also properly initialized. + Me.LoadData() + + + ' 2. Perform any custom validation. + Me.Validate() + + + ' 3. Set the values in the record with data from UI controls. + ' This calls the Get() method for each of the user interface controls. + Me.GetUIData() + + ' 4. Save in the database. + ' We should not save the record if the data did not change. This + ' will save a database hit and avoid triggering any database triggers. + + If Me.DataSource.IsAnyValueChanged Then + ' Save record to database but do not commit yet. + ' Auto generated ids are available after saving for use by child (dependent) records. + Me.DataSource.Save() + + 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 SportRecordControl. + 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. + + GetSPORT() + GetSportId() + End Sub + + + Public Overridable Sub GetSPORT() + + ' Retrieve the value entered by the user on the SPORT ASP:TextBox, and + ' save it into the SPORT field in DataSource Sport record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.SPORT.Text, SportTable.SPORT) + + + End Sub + + Public Overridable Sub GetSportId() + + ' Retrieve the value entered by the user on the SportId ASP:TextBox, and + ' save it into the SportId field in DataSource Sport record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.SportId.Text, SportTable.SportId) + + + End Sub + + + ' To customize, override this method in SportRecordControl. + + Public Overridable Function CreateWhereClause() As WhereClause + + Dim wc As WhereClause + SportTable.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("Sport") + If recId Is Nothing OrElse recId.Trim = "" Then + + Return Nothing + + End If + + HttpContext.Current.Session("QueryString in AddSport") = 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(SportTable.SportId, BaseFilter.ComparisonOperator.EqualsTo, pkValue.GetColumnValueString(SportTable.SportId)) + + Else + ' The URL parameter contains the actual value, not an XML structure. + + wc.iAND(SportTable.SportId, 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 + SportTable.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 SportRecordControl. + 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) + SportTable.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. + + Protected Overridable Sub SPORT_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub SportId_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("BaseSportRecordControl_Rec"), String) + End Get + Set(ByVal value As String) + Me.ViewState("BaseSportRecordControl_Rec") = value + End Set + End Property + + Private _DataSource As SportRecord + Public Property DataSource() As SportRecord + Get + Return Me._DataSource + End Get + + Set(ByVal value As SportRecord) + + 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 SPORT() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "SPORT"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property SportId() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "SportId"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property SportIdLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "SportIdLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property SPORTLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "SPORTLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property SportRecordControlCollapsibleRegion() As System.Web.UI.WebControls.Panel + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "SportRecordControlCollapsibleRegion"), System.Web.UI.WebControls.Panel) + End Get + End Property + + Public ReadOnly Property SportRecordControlIcon() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "SportRecordControlIcon"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property SportRecordControlPanelExtender() As AjaxControlToolkit.CollapsiblePanelExtender + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "SportRecordControlPanelExtender"), AjaxControlToolkit.CollapsiblePanelExtender) + End Get + End Property + + Public ReadOnly Property SportTitle() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "SportTitle"), 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 SportRecord = 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 SportRecord + If Not Me.DataSource Is Nothing Then + Return Me.DataSource + End If + + + Return New SportRecord() + + 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 + + \ No newline at end of file diff --git a/App_Code/Sport/EditSportTable.Controls.vb b/App_Code/Sport/EditSportTable.Controls.vb new file mode 100644 index 0000000..ffd06ed --- /dev/null +++ b/App_Code/Sport/EditSportTable.Controls.vb @@ -0,0 +1,2969 @@ + +' This file implements the TableControl, TableControlRow, and RecordControl classes for the +' EditSportTable.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.EditSportTable + +#Region "Section 1: Place your customizations here." + + +Public Class SportTableControlRow + Inherits BaseSportTableControlRow + ' The BaseSportTableControlRow implements code for a ROW within the + ' the SportTableControl table. The BaseSportTableControlRow implements the DataBind and SaveData methods. + ' The loading of data is actually performed by the LoadData method in the base class of SportTableControl. + + ' This is the ideal place to add your code customizations. For example, you can override the DataBind, + ' SaveData, GetUIData, and Validate methods. + + +End Class + + + +Public Class SportTableControl + Inherits BaseSportTableControl + + ' The BaseSportTableControl class implements the LoadData, DataBind, CreateWhereClause + ' and other methods to load and display the data in a table control. + + ' This is the ideal place to add your code customizations. You can override the LoadData and CreateWhereClause, + ' The SportTableControlRow class offers another place where you can customize + ' the DataBind, GetUIData, SaveData and Validate methods specific to each row displayed on the table. + +End Class + + + +#End Region + + + +#Region "Section 2: Do not modify this section." + + +' Base class for the SportTableControlRow control on the EditSportTable page. +' Do not modify this class. Instead override any method in SportTableControlRow. +Public Class BaseSportTableControlRow + Inherits Persons.UI.BaseApplicationRecordControl + + ' To customize, override this method in SportTableControlRow. + Protected Overridable Sub Control_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Init + + Me.ClearControlsFromSession() + End Sub + + ' To customize, override this method in SportTableControlRow. + Protected Overridable Sub Control_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load + + 'Call LoadFocusScripts from repeater so that onfocus attribute could be added to elements + Me.Page.LoadFocusScripts(Me) + + ' Show confirmation message on Click + Me.SportRowDeleteButton.Attributes.Add("onClick", "return (confirm('" & (CType(Me.Page,BaseApplicationPage)).GetResourceValue("DeleteRecordConfirm", "Persons") & "'));") + + + ' Register the event handlers. + + AddHandler Me.SportRowDeleteButton.Click, AddressOf SportRowDeleteButton_Click + + AddHandler Me.SportRowEditButton.Click, AddressOf SportRowEditButton_Click + + AddHandler Me.SportRowViewButton.Click, AddressOf SportRowViewButton_Click + + AddHandler Me.SPORT.TextChanged, AddressOf SPORT_TextChanged + + AddHandler Me.SportId.TextChanged, AddressOf SportId_TextChanged + + + End Sub + + + Public Overridable Sub LoadData() + + ' Load the data from the database into the DataSource Sport 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 = SportTable.GetRecord(Me.RecordUniqueId, True) + + Return + End If + + ' Since this is a row in the table, the data for this row is loaded by the + ' LoadData method of the BaseSportTableControl when the data for the entire + ' table is loaded. + + Me.DataSource = New SportRecord() + + + + End Sub + + ' Populate the UI controls using the DataSource. To customize, override this method in SportTableControlRow. + 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 + + SetSPORT() + SetSportId() + + + + + + + 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 SetSPORT() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.SPORT.ID) Then + + Me.SPORT.Text = Me.PreviousUIData(Me.SPORT.ID).ToString() + + Return + End If + + + ' Set the SPORT TextBox on the webpage with value from the + ' Sport database record. + + ' Me.DataSource is the Sport record retrieved from the database. + ' Me.SPORT is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetSPORT() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.SPORTSpecified Then + + ' If the SPORT is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(SportTable.SPORT) + + Me.SPORT.Text = formattedValue + + Else + + ' SPORT is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.SPORT.Text = SportTable.SPORT.Format(SportTable.SPORT.DefaultValue) + + End If + + End Sub + + Public Overridable Sub SetSportId() + + ' If data was retrieved from UI previously, restore it + If Me.PreviousUIData.ContainsKey(Me.SportId.ID) Then + + Me.SportId.Text = Me.PreviousUIData(Me.SportId.ID).ToString() + + Return + End If + + + ' Set the SportId TextBox on the webpage with value from the + ' Sport database record. + + ' Me.DataSource is the Sport record retrieved from the database. + ' Me.SportId is the ASP:TextBox on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetSportId() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.SportIdSpecified Then + + ' If the SportId is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(SportTable.SportId) + + Me.SportId.Text = formattedValue + + Else + + ' SportId is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.SportId.Text = SportTable.SportId.Format(SportTable.SportId.DefaultValue) + + End If + + End Sub + + + Public EvaluateFormulaDelegate As BaseClasses.Data.DataSource.EvaluateFormulaDelegate = New BaseClasses.Data.DataSource.EvaluateFormulaDelegate(AddressOf Me.EvaluateFormula) + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean, ByVal e As FormulaEvaluator) As String + If e Is Nothing Then + e = New FormulaEvaluator() + End If + + e.Variables.Clear() + + + ' add variables for formula evaluation + If variables IsNot Nothing Then + Dim enumerator As System.Collections.Generic.IEnumerator(Of System.Collections.Generic.KeyValuePair(Of String, Object)) = variables.GetEnumerator() + While enumerator.MoveNext() + e.Variables.Add(enumerator.Current.Key, enumerator.Current.Value) + End While + End If + + If includeDS + + End IF + + + ' Other variables referred to in the formula are expected to be + ' properties of the DataSource. For example, referring to + ' UnitPrice as a variable will refer to DataSource.UnitPrice + If dataSourceForEvaluate Is Nothing Then + + e.DataSource = Me.DataSource + + Else + e.DataSource = dataSourceForEvaluate + End If + + ' Define the calling control. This is used to add other + ' related table and record controls as variables. + e.CallingControl = Me + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + + If Not String.IsNullOrEmpty(format) AndAlso (String.IsNullOrEmpty(formula) OrElse formula.IndexOf("Format(") < 0) Then + Return FormulaUtils.Format(resultObj, format) + Else + Return resultObj.ToString() + End If + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format,variables ,includeDS, Nothing) + End Function + + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object)) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format, variables ,True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, format, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal e as FormulaEvaluator) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, variables, True, e) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal includeDS as Boolean) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, includeDS, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, True, Nothing) + End Function + + + Public Overridable Sub RegisterPostback() + + + End Sub + + + + ' To customize, override this method in SportTableControlRow. + Public Overridable Sub SaveData() + ' Saves the associated record in the database. + ' SaveData calls Validate and Get methods - so it may be more appropriate to + ' customize those methods. + + ' 1. Load the existing record from the database. Since we save the entire record, this ensures + ' that fields that are not displayed are also properly initialized. + Me.LoadData() + + + ' 2. Perform any custom validation. + Me.Validate() + + + ' 3. Set the values in the record with data from UI controls. + ' This calls the Get() method for each of the user interface controls. + Me.GetUIData() + + ' 4. Save in the database. + ' We should not save the record if the data did not change. This + ' will save a database hit and avoid triggering any database triggers. + + If Me.DataSource.IsAnyValueChanged Then + ' Save record to database but do not commit yet. + ' Auto generated ids are available after saving for use by child (dependent) records. + Me.DataSource.Save() + + DirectCast(GetParentControlObject(Me, "SportTableControl"), SportTableControl).DataChanged = True + DirectCast(GetParentControlObject(Me, "SportTableControl"), SportTableControl).ResetData = True + End If + + + ' update session or cookie by formula + + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + ' For Master-Detail relationships, save data on the Detail table(s) + + End Sub + + ' To customize, override this method in SportTableControlRow. + 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. + + GetSPORT() + GetSportId() + End Sub + + + Public Overridable Sub GetSPORT() + + ' Retrieve the value entered by the user on the SPORT ASP:TextBox, and + ' save it into the SPORT field in DataSource Sport record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.SPORT.Text, SportTable.SPORT) + + + End Sub + + Public Overridable Sub GetSportId() + + ' Retrieve the value entered by the user on the SportId ASP:TextBox, and + ' save it into the SportId field in DataSource Sport record. + + ' Custom validation should be performed in Validate, not here. + + 'Save the value to data source + Me.DataSource.Parse(Me.SportId.Text, SportTable.SportId) + + + End Sub + + + ' To customize, override this method in SportTableControlRow. + + Public Overridable Function CreateWhereClause() As WhereClause + + Return Nothing + + End Function + + + + ' To customize, override this method in SportTableControlRow. + 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) + SportTable.DeleteRecord(pkValue) + + DirectCast(GetParentControlObject(Me, "SportTableControl"), SportTableControl).DataChanged = True + DirectCast(GetParentControlObject(Me, "SportTableControl"), SportTableControl).ResetData = True + End Sub + + Protected Overridable Sub Control_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.PreRender + ' PreRender event is raised just before page is being displayed. + Try + DbUtils.StartTransaction() + Me.RegisterPostback() + + If Not Me.Page.ErrorOnPage AndAlso (Me.Page.IsPageRefresh OrElse Me.DataChanged OrElse Me.ResetData) Then + + + ' Re-load the data and update the web page if necessary. + ' This is typically done during a postback (filter, search button, sort, pagination button). + ' In each of the other click handlers, simply set DataChanged to True to reload the data. + Me.LoadData() + Me.DataBind() + End If + + + Catch ex As Exception + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + Finally + DbUtils.EndTransaction() + End Try + End Sub + + + Protected Overrides Sub SaveControlsToSession() + MyBase.SaveControlsToSession() + + + 'Save pagination state to session. + + End Sub + + + + Protected Overrides Sub ClearControlsFromSession() + MyBase.ClearControlsFromSession() + + + + ' Clear pagination state from session. + + End Sub + + Protected Overrides Sub LoadViewState(ByVal savedState As Object) + MyBase.LoadViewState(savedState) + Dim isNewRecord As String = CType(ViewState("IsNewRecord"), String) + If Not isNewRecord Is Nothing AndAlso isNewRecord.Trim <> "" Then + Me.IsNewRecord = Boolean.Parse(isNewRecord) + End If + + Dim myCheckSum As String = CType(ViewState("CheckSum"), String) + If Not myCheckSum Is Nothing AndAlso myCheckSum.Trim <> "" Then + Me.CheckSum = myCheckSum + End If + + + ' Load view state for pagination control. + + End Sub + + Protected Overrides Function SaveViewState() As Object + ViewState("IsNewRecord") = Me.IsNewRecord.ToString() + ViewState("CheckSum") = Me.CheckSum + + + ' Load view state for pagination control. + + Return MyBase.SaveViewState() + End Function + + + ' event handler for ImageButton + Public Overridable Sub SportRowDeleteButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + If(Not Me.Page.IsPageRefresh) Then + + Dim tc As SportTableControl = DirectCast(GetParentControlObject(Me, "SportTableControl"), SportTableControl) + If Not (IsNothing(tc)) Then + If Not Me.IsNewRecord Then + tc.AddToDeletedRecordIds(DirectCast(Me, SportTableControlRow)) + End If + Me.Visible = False + tc.SetFormulaControls() + End If + + End If + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub SportRowEditButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + ' The redirect URL is set on the Properties, Custom Properties or Actions. + ' The ModifyRedirectURL call resolves the parameters before the + ' Response.Redirect redirects the page to the URL. + ' Any code after the Response.Redirect call will not be executed, since the page is + ' redirected to the URL. + + + Dim url As String = "../Shared/ConfigureEditRecord.aspx" + + Dim shouldRedirect As Boolean = True + Dim TargetKey As String = Nothing + Dim DFKA As String = TargetKey + Dim id As String = DFKA + Dim value As String = id + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + url = Me.ModifyRedirectUrl(url, "",False) + url = Me.Page.ModifyRedirectUrl(url, "",False) + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + shouldRedirect = False + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + If shouldRedirect Then + Me.Page.ShouldSaveControlsToSession = True + Me.Page.Response.Redirect(url) + ElseIf Not TargetKey Is Nothing AndAlso _ + Not shouldRedirect Then + Me.Page.ShouldSaveControlsToSession = True + Me.Page.CloseWindow(True) + + End If + End Sub + + ' event handler for ImageButton + Public Overridable Sub SportRowViewButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + ' The redirect URL is set on the Properties, Custom Properties or Actions. + ' The ModifyRedirectURL call resolves the parameters before the + ' Response.Redirect redirects the page to the URL. + ' Any code after the Response.Redirect call will not be executed, since the page is + ' redirected to the URL. + + + Dim url As String = "../Shared/ConfigureViewRecord.aspx" + + Dim shouldRedirect As Boolean = True + Dim TargetKey As String = Nothing + Dim DFKA As String = TargetKey + Dim id As String = DFKA + Dim value As String = id + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + url = Me.ModifyRedirectUrl(url, "",False) + url = Me.Page.ModifyRedirectUrl(url, "",False) + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + shouldRedirect = False + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + If shouldRedirect Then + Me.Page.ShouldSaveControlsToSession = True + Me.Page.Response.Redirect(url) + ElseIf Not TargetKey Is Nothing AndAlso _ + Not shouldRedirect Then + Me.Page.ShouldSaveControlsToSession = True + Me.Page.CloseWindow(True) + + End If + End Sub + + Protected Overridable Sub SPORT_TextChanged(ByVal sender As Object, ByVal args As EventArgs) + + End Sub + + Protected Overridable Sub SportId_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("BaseSportTableControlRow_Rec"), String) + End Get + Set(ByVal value As String) + Me.ViewState("BaseSportTableControlRow_Rec") = value + End Set + End Property + + Private _DataSource As SportRecord + Public Property DataSource() As SportRecord + Get + Return Me._DataSource + End Get + + Set(ByVal value As SportRecord) + + Me._DataSource = value + End Set + End Property + + + + Private _checkSum As String + Public Overridable Property CheckSum() As String + Get + Return Me._checkSum + End Get + Set(ByVal value As String) + Me._checkSum = value + End Set + End Property + + Private _TotalPages As Integer + Public Property TotalPages() As Integer + Get + Return Me._TotalPages + End Get + Set(ByVal value As Integer) + Me._TotalPages = value + End Set + End Property + + Private _PageIndex As Integer + Public Property PageIndex() As Integer + Get + ' Return the PageIndex + Return Me._PageIndex + End Get + Set(ByVal value As Integer) + Me._PageIndex = value + End Set + End Property + + Private _DisplayLastPage As Boolean + Public Property DisplayLastPage() As Boolean + Get + Return Me._DisplayLastPage + End Get + Set(ByVal value As Boolean) + Me._DisplayLastPage = value + End Set + End Property + + + +#Region "Helper Properties" + + Public ReadOnly Property SPORT() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "SPORT"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property SportId() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "SportId"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property SportRecordRowSelection() As System.Web.UI.WebControls.CheckBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "SportRecordRowSelection"), System.Web.UI.WebControls.CheckBox) + End Get + End Property + + Public ReadOnly Property SportRowDeleteButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "SportRowDeleteButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property SportRowEditButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "SportRowEditButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property SportRowViewButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "SportRowViewButton"), System.Web.UI.WebControls.ImageButton) + 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 SportRecord = 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 SportRecord + If Not Me.DataSource Is Nothing Then + Return Me.DataSource + End If + + If Not Me.RecordUniqueId Is Nothing Then + + Return SportTable.GetRecord(Me.RecordUniqueId, True) + + End If + + ' Localization. + + Throw New Exception(Page.GetResourceValue("Err:RetrieveRec", "Persons")) + + End Function + + Public Shadows ReadOnly Property Page() As BaseApplicationPage + Get + Return DirectCast(MyBase.Page, BaseApplicationPage) + End Get + End Property + +#End Region + +End Class + + + +' Base class for the SportTableControl control on the EditSportTable page. +' Do not modify this class. Instead override any method in SportTableControl. +Public Class BaseSportTableControl + Inherits Persons.UI.BaseApplicationTableControl + + + + Protected Overridable Sub Control_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Init + + + + ' Setup the filter and search events. + + AddHandler Me.SPORTFilter.SelectedIndexChanged, AddressOf SPORTFilter_SelectedIndexChanged + If Not Me.Page.IsPostBack Then + Dim initialVal As String = "" + If Me.InSession(Me.SPORTFilter) + initialVal = Me.GetFromSession(Me.SPORTFilter) + + End If + + If initialVal <> "" + + Me.SPORTFilter.Items.Add(New ListItem(initialVal, initialVal)) + + Me.SPORTFilter.SelectedValue = initialVal + + End If + + End If + If Not Me.Page.IsPostBack Then + Dim initialVal As String = "" + If Me.InSession(Me.SportIdFromFilter) + initialVal = Me.GetFromSession(Me.SportIdFromFilter) + + End If + + If initialVal <> "" + + Me.SportIdFromFilter.Text = initialVal + + End If + + End If + If Not Me.Page.IsPostBack Then + Dim initialVal As String = "" + If Me.InSession(Me.SportIdToFilter) + initialVal = Me.GetFromSession(Me.SportIdToFilter) + + End If + + If initialVal <> "" + + Me.SportIdToFilter.Text = initialVal + + End If + + End If + If Not Me.Page.IsPostBack Then + Dim initialVal As String = "" + If Me.InSession(Me.SportSearch) + initialVal = Me.GetFromSession(Me.SportSearch) + + End If + + If initialVal <> "" + + Me.SportSearch.Text = initialVal + + End If + + End If + + + ' Control Initializations. + ' Initialize the table's current sort order. + + If Me.InSession(Me, "Order_By") Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + End If + + + + ' Setup default pagination settings. + + Me.PageSize = CInt(Me.GetFromSession(Me, "Page_Size", "10")) + Me.PageIndex = CInt(Me.GetFromSession(Me, "Page_Index", "0")) + + + + Me.ClearControlsFromSession() + End Sub + + Protected Overridable Sub Control_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load + + SaveControlsToSession_Ajax() + + ' Show confirmation message on Click + Me.SportDeleteButton.Attributes.Add("onClick", "return (confirm('" & (CType(Me.Page,BaseApplicationPage)).GetResourceValue("DeleteConfirm", "Persons") & "'));") + + ' Setup the pagination events. + + AddHandler Me.SportPagination.FirstPage.Click, AddressOf SportPagination_FirstPage_Click + + AddHandler Me.SportPagination.LastPage.Click, AddressOf SportPagination_LastPage_Click + + AddHandler Me.SportPagination.NextPage.Click, AddressOf SportPagination_NextPage_Click + + AddHandler Me.SportPagination.PageSizeButton.Click, AddressOf SportPagination_PageSizeButton_Click + + AddHandler Me.SportPagination.PreviousPage.Click, AddressOf SportPagination_PreviousPage_Click + + + ' Setup the sorting events. + + AddHandler Me.SportIdLabel1.Click, AddressOf SportIdLabel1_Click + + AddHandler Me.SPORTLabel1.Click, AddressOf SPORTLabel1_Click + + ' Setup the button events. + + AddHandler Me.SportAddButton.Click, AddressOf SportAddButton_Click + + AddHandler Me.SportDeleteButton.Click, AddressOf SportDeleteButton_Click + + AddHandler Me.SportEditButton.Click, AddressOf SportEditButton_Click + + AddHandler Me.SportRefreshButton.Click, AddressOf SportRefreshButton_Click + + AddHandler Me.SportResetButton.Click, AddressOf SportResetButton_Click + + AddHandler Me.SportSaveButton.Click, AddressOf SportSaveButton_Click + + Me.SportSaveButton.Attributes.Add("onclick", "SubmitHRefOnce(this, """ & Me.Page.GetResourceValue("Txt:SaveRecord", "Persons") & """);") + + AddHandler Me.SportFilterButton.Button.Click, AddressOf SportFilterButton_Click + + AddHandler Me.SportSearchButton.Button.Click, AddressOf SportSearchButton_Click + + + ' Setup events for others + + End Sub + + + Public Overridable Sub LoadData() + + ' Read data from database. Returns an array of records that can be assigned + ' to the DataSource table control property. + Try + Dim joinFilter As CompoundFilter = CreateCompoundJoinFilter() + + ' The WHERE clause will be empty when displaying all records in table. + Dim wc As WhereClause = CreateWhereClause() + If wc IsNot Nothing AndAlso Not wc.RunQuery Then + ' Initialize an empty array of records + Dim alist As New ArrayList(0) + Me.DataSource = DirectCast(alist.ToArray(GetType(SportRecord)), SportRecord()) + ' Add records to the list if needed. + Me.AddNewRecords() + Me._TotalRecords = 0 + Me._TotalPages = 0 + Return + End If + + ' Call OrderBy to determine the order - either use the order defined + ' on the Query Wizard, or specified by user (by clicking on column heading) + Dim orderBy As OrderBy = CreateOrderBy() + + ' Get the pagesize from the pagesize control. + Me.GetPageSize() + + If Me.DisplayLastPage Then + Dim totalRecords As Integer = If(Me._TotalRecords < 0, SportTable.GetRecordCount(CreateCompoundJoinFilter(), CreateWhereClause()), Me._TotalRecords) + + Dim totalPages As Integer = CInt(Math.Ceiling(totalRecords / Me.PageSize)) + + Me.PageIndex = totalPages - 1 + End If + + ' Make sure PageIndex (current page) and PageSize are within bounds. + If Me.PageIndex < 0 Then + Me.PageIndex = 0 + End If + If Me.PageSize < 1 Then + Me.PageSize = 1 + End If + + ' Retrieve the records and set the table DataSource. + ' Only PageSize records are fetched starting at PageIndex (zero based). + If Me.AddNewRecord > 0 Then + ' Make sure to preserve the previously entered data on new rows. + Dim postdata As New ArrayList + For Each rc As SportTableControlRow In Me.GetRecordControls() + If Not rc.IsNewRecord Then + rc.DataSource = rc.GetRecord() + rc.GetUIData() + postdata.Add(rc.DataSource) + UIData.Add(rc.PreservedUIData()) + End If + Next + Me.DataSource = DirectCast(postdata.ToArray(GetType(SportRecord)), SportRecord()) + Else ' Get the records from the database + Me.DataSource = SportTable.GetRecords(joinFilter, wc, orderBy, Me.PageIndex, Me.PageSize) + + End If + + ' if the datasource contains no records contained in database, then load the last page. + If (DbUtils.GetCreatedRecords(Me.DataSource).Length = 0 AndAlso Not Me.DisplayLastPage) Then + Me.DisplayLastPage = True + LoadData() + Else + + ' Add any new rows desired by the user. + Me.AddNewRecords() + + ' Turn off the ToggleAll checkbox + Me.SportToggleAll.Checked = False + + + ' Initialize the page and grand totals. now + + End If + + Catch ex As Exception + ' Report the error message to the end user + Dim msg As String = ex.Message + If ex.InnerException IsNot Nothing Then + msg = msg & " InnerException: " & ex.InnerException.Message + End If + Throw New Exception(msg, ex.InnerException) + End Try + End Sub + + + + + Public Overrides Sub DataBind() + ' The DataBind method binds the user interface controls to the values + ' from the database record for each row in the table. To do this, it calls the + ' DataBind for each of the rows. + ' DataBind also populates any filters above the table, and sets the pagination + ' control to the correct number of records and the current page number. + + MyBase.DataBind() + + ' Make sure that the DataSource is initialized. + If Me.DataSource Is Nothing Then + Return + End If + + 'LoadData for DataSource for chart and report if they exist + + ' Setup the pagination controls. + BindPaginationControls() + + + + ' Bind the repeater with the list of records to expand the UI. + Dim rep As System.Web.UI.WebControls.Repeater = CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "SportTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return + rep.DataSource = DataSource() + rep.DataBind() + + Dim index As Integer = 0 + For Each repItem As System.Web.UI.WebControls.RepeaterItem In rep.Items + ' Loop through all rows in the table, set its DataSource and call DataBind(). + Dim recControl As SportTableControlRow = DirectCast(repItem.FindControl("SportTableControlRow"), SportTableControlRow) + recControl.DataSource = Me.DataSource(index) + If Me.UIData.Count > index Then + recControl.PreviousUIData = Me.UIData(index) + End If + recControl.DataBind() + recControl.Visible = Not Me.InDeletedRecordIds(recControl) + + index += 1 + Next + + + + + ' Call the Set methods for each controls on the panel + + + + + SetSPORTFilter() + + + SetSportIdLabel() + SetSportIdLabel1() + + + SetSPORTLabel() + SetSPORTLabel1() + + + + + SetSportSearch() + + SetSportTableControlCollapsibleRegion() + SetSportTableControlIcon() + SetSportTableControlPanelExtender() + + + ' setting the state of expand or collapse alternative rows + + + ' Load data for each record and table UI control. + ' Ordering is important because child controls get + ' their parent ids from their parent UI controls. + + + ' this method calls the set method for controls with special formula like running total, sum, rank, etc + SetFormulaControls() + End Sub + + Public Overridable Sub SetFormulaControls() + ' this method calls Set methods for the control that has special formula + + + + End Sub + + + + Public Overridable Sub RegisterPostback() + + Me.Page.RegisterPostBackTrigger(MiscUtils.FindControlRecursively(Me,"SportSaveButton")) + + + End Sub + + Public EvaluateFormulaDelegate As BaseClasses.Data.DataSource.EvaluateFormulaDelegate = New BaseClasses.Data.DataSource.EvaluateFormulaDelegate(AddressOf Me.EvaluateFormula) + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean, ByVal e as FormulaEvaluator) As String + If e Is Nothing + e = New FormulaEvaluator() + End If + + e.Variables.Clear() + + + ' add variables for formula evaluation + If variables IsNot Nothing Then + Dim enumerator As System.Collections.Generic.IEnumerator(Of System.Collections.Generic.KeyValuePair(Of String, Object)) = variables.GetEnumerator() + While enumerator.MoveNext() + e.Variables.Add(enumerator.Current.Key, enumerator.Current.Value) + End While + End If + + If includeDS + + End If + + ' All variables referred to in the formula are expected to be + ' properties of the DataSource. For example, referring to + ' UnitPrice as a variable will refer to DataSource.UnitPrice + e.DataSource = dataSourceForEvaluate + + ' Define the calling control. This is used to add other + ' related table and record controls as variables. + e.CallingControl = Me + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + + If Not String.IsNullOrEmpty(format) AndAlso (String.IsNullOrEmpty(formula) OrElse formula.IndexOf("Format(") < 0) Then + Return FormulaUtils.Format(resultObj, format) + Else + Return resultObj.ToString() + End If + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format,variables ,includeDS, Nothing) + End Function + + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object)) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format, variables ,True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, format, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal e as FormulaEvaluator) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, variables, True, e) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal includeDS as Boolean) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, includeDS, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, True, Nothing) + End Function + + + + + Public Overridable Sub ResetControl() + + Me.SPORTFilter.ClearSelection() + + Me.SportIdFromFilter.Text = "" + + Me.SportIdToFilter.Text = "" + + Me.SportSearch.Text = "" + + Me.CurrentSortOrder.Reset() + If (Me.InSession(Me, "Order_By")) Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + End If + + Me.PageIndex = 0 + End Sub + + Protected Overridable Sub BindPaginationControls() + ' Setup the pagination controls. + + ' Bind the pagination labels. + + If DbUtils.GetCreatedRecords(Me.DataSource).Length > 0 Then + + Me.SportPagination.CurrentPage.Text = (Me.PageIndex + 1).ToString() + Else + Me.SportPagination.CurrentPage.Text = "0" + End If + Me.SportPagination.PageSize.Text = Me.PageSize.ToString() + Me.SportPagination.TotalItems.Text = Me.TotalRecords.ToString() + Me.SportPagination.TotalPages.Text = Me.TotalPages.ToString() + + ' Bind the buttons for SportTableControl pagination. + + Me.SportPagination.FirstPage.Enabled = Not (Me.PageIndex = 0) + If Me._TotalPages < 0 Then ' if the total pages is not determined yet, enable last and next buttons + Me.SportPagination.LastPage.Enabled = True + ElseIf Me._TotalPages = 0 ' if the total pages is determined and it is 0, enable last and next buttons + Me.SportPagination.LastPage.Enabled = False + Else ' if the total pages is the last page, disable last and next buttons + Me.SportPagination.LastPage.Enabled = Not (Me.PageIndex = Me.TotalPages - 1) + End If + + If Me._TotalPages < 0 Then ' if the total pages is not determined yet, enable last and next buttons + Me.SportPagination.NextPage.Enabled = True + ElseIf Me._TotalPages = 0 ' if the total pages is determined and it is 0, enable last and next buttons + Me.SportPagination.NextPage.Enabled = False + Else ' if the total pages is the last page, disable last and next buttons + Me.SportPagination.NextPage.Enabled = Not (Me.PageIndex = Me.TotalPages - 1) + End If + + Me.SportPagination.PreviousPage.Enabled = Not (Me.PageIndex = 0) + + + End Sub + + Public Overridable Sub SaveData() + ' Save the data from the entire table. Calls each row's Save Data + ' to save their data. This function is called by the Click handler of the + ' Save button. The button handler should Start/Commit/End a transaction. + + Dim recCtl As SportTableControlRow + For Each recCtl In Me.GetRecordControls() + + If Me.InDeletedRecordIds(recCtl) Then + ' Delete any pending deletes. + recCtl.Delete() + Else + If recCtl.Visible Then + recCtl.SaveData() + End If + End If + + Next + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + ' Set IsNewRecord to False for all records - since everything has been saved and is no longer "new" + For Each recCtl In Me.GetRecordControls() + recCtl.IsNewRecord = False + Next + + + ' Set DeletedRecordsIds to Nothing since we have deleted all pending deletes. + Me.DeletedRecordIds = Nothing + + End Sub + + Public Overridable Function CreateCompoundJoinFilter() As CompoundFilter + Dim jFilter As CompoundFilter = New CompoundFilter() + + Return jFilter + + End Function + + + Public Overridable Function CreateOrderBy() As OrderBy + ' The CurrentSortOrder is initialized to the sort order on the + ' Query Wizard. It may be modified by the Click handler for any of + ' the column heading to sort or reverse sort by that column. + ' You can add your own sort order, or modify it on the Query Wizard. + Return Me.CurrentSortOrder + End Function + + Public Overridable Function CreateWhereClause() As WhereClause + 'This CreateWhereClause is used for loading the data. + SportTable.Instance.InnerFilter = Nothing + Dim wc As WhereClause = New WhereClause() + + ' Compose the WHERE clause consiting of: + ' 1. Static clause defined at design time. + ' 2. User selected search criteria. + ' 3. User selected filter criteria. + + + If IsValueSelected(Me.SPORTFilter) Then + + wc.iAND(SportTable.SPORT, BaseFilter.ComparisonOperator.EqualsTo, MiscUtils.GetSelectedValue(Me.SPORTFilter, Me.GetFromSession(Me.SPORTFilter)), False, False) + + End If + + + + If IsValueSelected(Me.SportIdFromFilter) Then + + wc.iAND(SportTable.SportId, BaseFilter.ComparisonOperator.Greater_Than_Or_Equal, MiscUtils.GetSelectedValue(Me.SportIdFromFilter, Me.GetFromSession(Me.SportIdFromFilter)), False, False) + + End If + + + + If IsValueSelected(Me.SportIdToFilter) Then + + wc.iAND(SportTable.SportId, BaseFilter.ComparisonOperator.Less_Than_Or_Equal, MiscUtils.GetSelectedValue(Me.SportIdToFilter, Me.GetFromSession(Me.SportIdToFilter)), False, False) + + End If + + + + If IsValueSelected(Me.SportSearch) Then + If Me.SportSearch.Text = BaseClasses.Resources.AppResources.GetResourceValue("Txt:SearchForEllipsis", Nothing) Then + Me.SportSearch.Text = "" + Else + ' Strip "..." from begin and ending of the search text, otherwise the search will return 0 values as in database "..." is not stored. + + If Me.SportSearch.Text.StartsWith("...") Then + Me.SportSearch.Text = Me.SportSearch.Text.SubString(3,Me.SportSearch.Text.Length-3) + End If + If Me.SportSearch.Text.EndsWith("...") then + Me.SportSearch.Text = Me.SportSearch.Text.SubString(0,Me.SportSearch.Text.Length-3) + ' Strip the last word as well as it is likely only a partial word + Dim endindex As Integer = SportSearch.Text.Length - 1 + While (Not Char.IsWhiteSpace(SportSearch.Text(endindex)) AndAlso endindex > 0) + endindex -= 1 + End While + If endindex > 0 Then + SportSearch.Text = SportSearch.Text.Substring(0, endindex) + End If + End If + End If + + Dim formatedSearchText As String = MiscUtils.GetSelectedValue(Me.SportSearch, Me.GetFromSession(Me.SportSearch)) + + ' After stripping "..." see if the search text is null or empty. + If IsValueSelected(Me.SportSearch) Then + ' These clauses are added depending on operator and fields selected in Control's property page, bindings tab. + + Dim search As WhereClause = New WhereClause() + + search.iOR(SportTable.SPORT, BaseFilter.ComparisonOperator.Contains, MiscUtils.GetSelectedValue(Me.SportSearch, Me.GetFromSession(Me.SportSearch)), True, False) + + wc.iAND(search) + + End If + End If + + Return wc + End Function + + + Public Overridable Function CreateWhereClause(ByVal searchText as String, ByVal fromSearchControl as String, ByVal AutoTypeAheadSearch as String, ByVal AutoTypeAheadWordSeparators as String) As WhereClause + ' This CreateWhereClause is used for loading list of suggestions for Auto Type-Ahead feature. + SportTable.Instance.InnerFilter = Nothing + Dim wc As WhereClause = New WhereClause() + + ' Compose the WHERE clause consiting of: + ' 1. Static clause defined at design time. + ' 2. User selected search criteria. + ' 3. User selected filter criteria. + + Dim appRelativeVirtualPath As String = CType(HttpContext.Current.Session("AppRelativeVirtualPath"), String) + + ' Adds clauses if values are selected in Filter controls which are configured in the page. + + Dim SPORTFilterSelectedValue As String = CType(HttpContext.Current.Session()(HttpContext.Current.Session.SessionID & appRelativeVirtualPath & "SPORTFilter_Ajax"), String) + If IsValueSelected(SPORTFilterSelectedValue) Then + + wc.iAND(SportTable.SPORT, BaseFilter.ComparisonOperator.EqualsTo, SPORTFilterSelectedValue, false, False) + + End If + + Dim SportIdFromFilterSelectedValue As String = CType(HttpContext.Current.Session()(HttpContext.Current.Session.SessionID & appRelativeVirtualPath & "SportIdFromFilter_Ajax"), String) + If IsValueSelected(SportIdFromFilterSelectedValue) Then + + wc.iAND(SportTable.SportId, BaseFilter.ComparisonOperator.Greater_Than_Or_Equal, SportIdFromFilterSelectedValue, false, False) + + End If + + Dim SportIdToFilterSelectedValue As String = CType(HttpContext.Current.Session()(HttpContext.Current.Session.SessionID & appRelativeVirtualPath & "SportIdToFilter_Ajax"), String) + If IsValueSelected(SportIdToFilterSelectedValue) Then + + wc.iAND(SportTable.SportId, BaseFilter.ComparisonOperator.Less_Than_Or_Equal, SportIdToFilterSelectedValue, false, False) + + End If + + If IsValueSelected(searchText) and fromSearchControl = "SportSearch" Then + Dim formatedSearchText as String = searchText + ' Strip "..." from begin and ending of the search text, otherwise the search will return 0 values as in database "..." is not stored. + If searchText.StartsWith("...") Then + formatedSearchText = searchText.SubString(3,searchText.Length-3) + End If + If searchText.EndsWith("...") Then + formatedSearchText = searchText.SubString(0,searchText.Length-3) + ' Strip the last word as well as it is likely only a partial word + Dim endindex As Integer = searchText.Length - 1 + While (Not Char.IsWhiteSpace(searchText(endindex)) AndAlso endindex > 0) + endindex -= 1 + End While + If endindex > 0 Then + searchText = searchText.Substring(0, endindex) + End If + End If + 'After stripping "...", trim any leading and trailing whitespaces + formatedSearchText = formatedSearchText.Trim() + ' After stripping "..." see if the search text is null or empty. + If IsValueSelected(formatedSearchText) Then + ' These clauses are added depending on operator and fields selected in Control's property page, bindings tab. + + Dim search As WhereClause = New WhereClause() + + If InvariantLCase(AutoTypeAheadSearch).equals("wordsstartingwithsearchstring") Then + + search.iOR(SportTable.SPORT, BaseFilter.ComparisonOperator.Starts_With, formatedSearchText, True, False) + search.iOR(SportTable.SPORT, BaseFilter.ComparisonOperator.Contains, AutoTypeAheadWordSeparators & formatedSearchText, True, False) + + Else + + search.iOR(SportTable.SPORT, BaseFilter.ComparisonOperator.Contains, formatedSearchText, True, False) + End If + wc.iAND(search) + + End If + End If + + + Return wc + End Function + + Public Overridable Function GetAutoCompletionList_SportSearch(ByVal prefixText As String, ByVal count As Integer) As String() + Dim resultList As ArrayList = New ArrayList + Dim wordList As ArrayList = New ArrayList + Dim iteration As Integer = 0 + + Dim filterJoin As CompoundFilter = CreateCompoundJoinFilter() + Dim wc As WhereClause = CreateWhereClause(prefixText,"SportSearch", "WordsStartingWithSearchString", "[^a-zA-Z0-9]") + While (resultList.Count < count AndAlso iteration < 5) + ' Fetch 100 records in each iteration + Dim recordList () As Persons.Business.SportRecord = SportTable.GetRecords(filterJoin, wc, Nothing, iteration, 100) + Dim rec As SportRecord = Nothing + Dim resultItem As String = "" + For Each rec In recordList + ' Exit the loop if recordList count has reached AutoTypeAheadListSize. + If resultList.Count >= count then + Exit For + End If + ' If the field is configured to Display as Foreign key, Format() method returns the + ' Display as Forien Key value instead of original field value. + ' Since search had to be done in multiple fields (selected in Control's page property, binding tab) in a record, + ' We need to find relevent field to display which matches the prefixText and is not already present in the result list. + + resultItem = rec.Format(SportTable.SPORT) + If resultItem IsNot Nothing AndAlso resultItem.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture).Contains(prefixText.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture)) Then + + Dim isAdded As Boolean = FormatSuggestions(prefixText, resultItem, 50, "AtBeginningOfMatchedString", "WordsStartingWithSearchString", "[^a-zA-Z0-9]", resultList) + If isAdded Then + Continue For + End If + End If + + Next + ' Exit the loop if number of records found is less as further iteration will not return any more records + If recordList .Length < 100 Then + Exit While + End If + iteration += 1 + End While + + resultList.Sort() + Dim result() As String = New String(resultList.Count - 1) {} + Array.Copy(resultList.ToArray, result, resultList.Count) + Return result + End Function + + + Public Overridable Function FormatSuggestions(ByVal prefixText As String, ByVal resultItem As String, _ + ByVal columnLength As Integer, ByVal AutoTypeAheadDisplayFoundText As String, _ + ByVal autoTypeAheadSearch As String, ByVal AutoTypeAheadWordSeparators As String, _ + ByVal resultList As ArrayList) As Boolean + + 'Formats the resultItem and adds it to the list of suggestions. + Dim index As Integer = resultItem.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture).IndexOf(prefixText.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture)) + Dim itemToAdd As String = "" + Dim isFound As Boolean = False + Dim isAdded As Boolean = False + ' Get the index where prfixt is at the beginning of resultItem. If not found then, index of word which begins with prefixText. + If InvariantLCase(autoTypeAheadSearch).equals("wordsstartingwithsearchstring") And Not index = 0 Then + ' Expression to find word which contains AutoTypeAheadWordSeparators followed by prefixText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex( AutoTypeAheadWordSeparators + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + If regex1.IsMatch(resultItem) Then + index = regex1.Match(resultItem).Index + isFound = True + End If + ' If the prefixText is found immediatly after white space then starting of the word is found so don not search any further + If not resultItem(index).ToString() = " " Then + ' Expression to find beginning of the word which contains AutoTypeAheadWordSeparators followed by prefixText + Dim regex As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\\S*" + AutoTypeAheadWordSeparators + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + If regex.IsMatch(resultItem) Then + index = regex.Match(resultItem).Index + isFound = True + End If + End If + End If + + ' If autoTypeAheadSearch value is wordsstartingwithsearchstring then, extract the substring only if the prefixText is found at the + ' beginning of the resultItem (index = 0) or a word in resultItem is found starts with prefixText. + If index = 0 Or isFound Or InvariantLCase(autoTypeAheadSearch).Equals("anywhereinstring") then + If InvariantLCase(AutoTypeAheadDisplayFoundText).equals("atbeginningofmatchedstring") Then + ' Expression to find beginning of the word which contains prefixText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\\S*" + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + ' Find the beginning of the word which contains prefexText + If (StringUtils.InvariantLCase(autoTypeAheadSearch).Equals("anywhereinstring") AndAlso regex1.IsMatch(resultItem)) Then + index = regex1.Match(resultItem).Index + isFound = True + End If + ' Display string from the index till end of the string if sub string from index till end is less than columnLength value. + If Len(resultItem) - index <= columnLength Then + If index = 0 Then + itemToAdd = resultItem + Else + itemToAdd = "..." & resultItem.Substring(index, Len(resultItem) - index) + End If + Else + If index = 0 Then + itemToAdd = resultItem.Substring(index, (columnLength - 3)) & "..." + Else + 'Truncate the string to show only columnLength - 6 characters as begining and trailing "..." has to be appended. + itemToAdd = "..." & resultItem.Substring(index , columnLength - 6) & "..." + End If + End If + ElseIf InvariantLCase(AutoTypeAheadDisplayFoundText).equals("inmiddleofmatchedstring") Then + Dim subStringBeginIndex As Integer = CType(columnLength/2, Integer) + If Len(resultItem) <= columnLength Then + itemToAdd = resultItem + Else + ' Sanity check at end of the string + If index + Len(prefixText) = columnLength Then + itemToAdd = "..." & resultItem.Substring(index-columnLength,index) + ElseIf Len(resultItem) - index < subStringBeginIndex Then + ' Display string from the end till columnLength value if, index is closer to the end of the string. + itemToAdd = "..." & resultItem.Substring(Len(resultItem)-columnLength,Len(resultItem)) + ElseIf index <= subStringBeginIndex Then + ' Sanity chet at beginning of the string + itemToAdd = resultItem.Substring(0, columnLength) & "..." + Else + ' Display string containing text before the prefixText occures and text after the prefixText + itemToAdd = "..." & resultItem.Substring(index - subStringBeginIndex, columnLength) & "..." + End If + End If + ElseIf InvariantLCase(AutoTypeAheadDisplayFoundText).equals("atendofmatchedstring") Then + ' Expression to find ending of the word which contains prefexText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\s", System.Text.RegularExpressions.RegexOptions.IgnoreCase) + ' Find the ending of the word which contains prefexText + If regex1.IsMatch(resultItem, index + 1) Then + index = regex1.Match(resultItem, index + 1).Index + Else + ' If the word which contains prefexText is the last word in string, regex1.IsMatch returns false. + index = resultItem.Length + End If + If index > Len(resultItem) Then + index = Len(resultItem) + End If + ' If text from beginning of the string till index is less than columnLength value then, display string from the beginning till index. + If index <= columnLength Then + if index = Len(resultItem) Then 'Make decision to append "..." + itemToAdd = resultItem.Substring(0,index) + Else + itemToAdd = resultItem.Substring(0,index) & "..." + End If + Else + If index = Len(resultItem) Then + itemToAdd = "..." & resultItem.Substring(index - (columnLength - 3), (columnLength - 3)) + Else + 'Truncate the string to show only columnLength - 6 characters as begining and trailing "..." has to be appended. + itemToAdd = "..." & resultItem.Substring(index - (columnLength - 6), columnLength - 6) & "..." + End If + End If + End If + + ' Remove newline character from itemToAdd + Dim prefixTextIndex As Integer = itemToAdd.IndexOf(prefixText, StringComparison.CurrentCultureIgnoreCase) + ' If itemToAdd contains any newline after the search text then show text only till newline + Dim regex2 As System.Text.RegularExpressions.Regex = New System.Text.RegularExpressions.Regex("(" & vbCrLf & "|" & vbLf & ")", System.Text.RegularExpressions.RegexOptions.IgnoreCase) + Dim newLineIndexAfterPrefix As Integer = -1 + If regex2.IsMatch(itemToAdd, prefixTextIndex) Then + newLineIndexAfterPrefix = regex2.Match(itemToAdd, prefixTextIndex).Index + End If + If (newLineIndexAfterPrefix > -1) Then + If itemToAdd.EndsWith("...") Then + itemToAdd = (itemToAdd.Substring(0, newLineIndexAfterPrefix) + "...") + Else + itemToAdd = itemToAdd.Substring(0, newLineIndexAfterPrefix) + End If + End If + ' If itemToAdd contains any newline before search text then show text which comes after newline + Dim regex3 As System.Text.RegularExpressions.Regex = New System.Text.RegularExpressions.Regex("(" & vbCrLf & "|" & vbLf & ")", (System.Text.RegularExpressions.RegexOptions.IgnoreCase Or System.Text.RegularExpressions.RegexOptions.RightToLeft)) + Dim newLineIndexBeforePrefix As Integer = -1 + If regex3.IsMatch(itemToAdd, prefixTextIndex) Then + newLineIndexBeforePrefix = regex3.Match(itemToAdd, prefixTextIndex).Index + End If + If (newLineIndexBeforePrefix > -1) Then + If itemToAdd.StartsWith("...") Then + itemToAdd = ("..." + itemToAdd.Substring((newLineIndexBeforePrefix + regex3.Match(itemToAdd, prefixTextIndex).Length))) + Else + itemToAdd = itemToAdd.Substring((newLineIndexBeforePrefix + regex3.Match(itemToAdd, prefixTextIndex).Length)) + End If + End If + + If Not itemToAdd is nothing AndAlso Not resultList.Contains(itemToAdd) Then + + resultList.Add(itemToAdd) + + isAdded = true + End If + End If + Return isAdded + End Function + + + Protected Overridable Sub GetPageSize() + + If Me.SportPagination.PageSize.Text.Trim <> "" Then + Try + 'Me.PageSize = Integer.Parse(Me.SportPagination.PageSize.Text) + Catch ex As Exception + End Try + End If + End Sub + + Protected Overridable Sub AddNewRecords() + + Dim newRecordList As ArrayList = New ArrayList() + + Dim newUIDataList As System.Collections.Generic.List(Of Hashtable) = New System.Collections.Generic.List(Of Hashtable)() + + ' Loop though all the record controls and if the record control + ' does not have a unique record id set, then create a record + ' and add to the list. + If Not Me.ResetData Then + Dim rep As System.Web.UI.WebControls.Repeater = CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "SportTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return + + Dim repItem As System.Web.UI.WebControls.RepeaterItem + For Each repItem In rep.Items + ' Loop through all rows in the table, set its DataSource and call DataBind(). + + Dim recControl As SportTableControlRow = DirectCast(repItem.FindControl("SportTableControlRow"), SportTableControlRow) + + If recControl.Visible AndAlso recControl.IsNewRecord() Then + + Dim rec As SportRecord = New SportRecord() + + If recControl.SPORT.Text <> "" Then + rec.Parse(recControl.SPORT.Text, SportTable.SPORT) + End If + If recControl.SportId.Text <> "" Then + rec.Parse(recControl.SportId.Text, SportTable.SportId) + End If + newUIDataList.Add(recControl.PreservedUIData()) + newRecordList.Add(rec) + End If + Next + End If + + + ' Add any new record to the list. + Dim index As Integer = 0 + For index = 1 To Me.AddNewRecord + + newRecordList.Insert(0, New SportRecord()) + newUIDataList.Insert(0, New Hashtable()) + + Next + Me.AddNewRecord = 0 + + ' Finally, add any new records to the DataSource. + If newRecordList.Count > 0 Then + + Dim finalList As ArrayList = New ArrayList(Me.DataSource) + finalList.InsertRange(0, newRecordList) + + Me.DataSource = DirectCast(finalList.ToArray(GetType(SportRecord)), SportRecord()) + + End If + + ' Add the existing UI data to this hash table + If newUIDataList.Count > 0 Then + Me.UIData.InsertRange(0, newUIDataList) + End If + + End Sub + + + Public Sub AddToDeletedRecordIds(ByVal rec As SportTableControlRow) + If rec.IsNewRecord() Then + Return + End If + + If Not Me.DeletedRecordIds Is Nothing AndAlso Me.DeletedRecordIds.Trim <> "" Then + Me.DeletedRecordIds &= "," + End If + + Me.DeletedRecordIds &= "[" & rec.RecordUniqueId & "]" + End Sub + + Protected Overridable Function InDeletedRecordIds(ByVal rec As SportTableControlRow) As Boolean + If Me.DeletedRecordIds Is Nothing OrElse Me.DeletedRecordIds.Trim = "" Then + Return False + End If + + Return Me.DeletedRecordIds.IndexOf("[" & rec.RecordUniqueId & "]") >= 0 + End Function + + Private _DeletedRecordIds As String + Public Property DeletedRecordIds() As String + Get + Return Me._DeletedRecordIds + End Get + Set(ByVal value As String) + Me._DeletedRecordIds = value + End Set + End Property + + + ' Create Set, WhereClause, and Populate Methods + + Public Overridable Sub SetSportIdLabel() + + End Sub + + Public Overridable Sub SetSportIdLabel1() + + End Sub + + Public Overridable Sub SetSPORTLabel() + + End Sub + + Public Overridable Sub SetSPORTLabel1() + + End Sub + + Public Overridable Sub SetSportTableControlCollapsibleRegion() + + End Sub + + Public Overridable Sub SetSportTableControlIcon() + + End Sub + + Public Overridable Sub SetSportTableControlPanelExtender() + + End Sub + + Public Overridable Sub SetSPORTFilter() + + Me.PopulateSPORTFilter(GetSelectedValue(Me.SPORTFilter, GetFromSession(Me.SPORTFilter)), 500) + + End Sub + + Public Overridable Sub SetSportSearch() + + End Sub + + ' Get the filters' data for SPORTFilter + Protected Overridable Sub PopulateSPORTFilter(ByVal selectedValue As String, ByVal maxItems As Integer) + + + Me.SPORTFilter.Items.Clear() + + + + ' Set up the WHERE and the ORDER BY clause by calling the CreateWhereClause_SPORTFilter function. + ' It is better to customize the where clause there. + + ' Setup the WHERE clause, including the base table if needed. + + Dim wc As WhereClause = Me.CreateWhereClause_SPORTFilter() + + ' Setup the static list items + + ' Add the All item. + Me.SPORTFilter.Items.Insert(0, new ListItem(Me.Page.GetResourceValue("Txt:All", "Persons"), "--ANY--")) + + + + Dim orderBy As OrderBy = New OrderBy(False, False) + orderBy.Add(SportTable.SPORT, OrderByItem.OrderDir.Asc) + + + Dim values() As String = SportTable.GetValues(SportTable.SPORT, wc, orderBy, maxItems) + + Dim cvalue As String + + Dim listDuplicates As New ArrayList() + For Each cvalue In values + ' Create the item and add to the list. + Dim fvalue As String + + If ( SportTable.SPORT.IsColumnValueTypeBoolean()) Then + fvalue = cvalue + Else + fvalue = SportTable.SPORT.Format(cvalue) + End If + + 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.SPORTFilter.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.SPORTFilter.Items.Add(newItem) + + If listDuplicates.Contains(fvalue) Then + newItem.Text = fvalue & " (ID " & cvalue.Substring(0, Math.Min(cvalue.Length,38)) & ")" + End If + + Next + + + + ' Set the selected value. + SetSelectedValue(Me.SPORTFilter, selectedValue) + + + End Sub + + Public Overridable Function CreateWhereClause_SPORTFilter() As WhereClause + + ' Create a where clause for the filter SPORTFilter. + ' This function is called by the Populate method to load the items + ' in the SPORTFilterDropDownList + + Dim wc As WhereClause= New WhereClause() + Return wc + + End Function + + + + + Protected Overridable Sub Control_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.PreRender + ' PreRender event is raised just before page is being displayed. + Try + DbUtils.StartTransaction + Me.RegisterPostback() + + If Not Me.Page.ErrorOnPage AndAlso (Me.Page.IsPageRefresh OrElse Me.DataChanged OrElse Me.ResetData) Then + + + ' Re-load the data and update the web page if necessary. + ' This is typically done during a postback (filter, search button, sort, pagination button). + ' In each of the other click handlers, simply set DataChanged to True to reload the data. + Dim added As Boolean = Me.AddNewRecord > 0 + Me.LoadData() + Me.DataBind() + + If added Then + Me.SetFocusToAddedRow() + End If + + End If + + + + Catch ex As Exception + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + Finally + DbUtils.EndTransaction + End Try + End Sub + + 'this function sets focus to the first editable element in the new added row in the editable table + Protected Overridable Sub SetFocusToAddedRow() + Dim rep As System.Web.UI.WebControls.Repeater = CType(Me.FindControl("SportTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing OrElse rep.Items.Count = 0 Then Return + Dim repItem As System.Web.UI.WebControls.RepeaterItem + For Each repItem In rep.Items + 'Load scripts to table rows + Me.Page.LoadFocusScripts(repItem) + Dim recControl As SportTableControlRow = DirectCast(repItem.FindControl("SportTableControlRow"), SportTableControlRow) + If recControl.IsNewRecord Then + For Each field As Control In recControl.Controls + If field.Visible AndAlso Me.Page.IsControlEditable(field, False) Then + 'set focus on the first editable field in the new row + field.Focus() + Dim updPan As UpdatePanel = DirectCast(Me.Page.FindControlRecursively("UpdatePanel1"), UpdatePanel) + If Not updPan Is Nothing Then updPan.Update() + Return + End If + Next + Return + End If + Next + End Sub + + + Protected Overrides Sub SaveControlsToSession() + MyBase.SaveControlsToSession() + + ' Save filter controls to values to session. + + Me.SaveToSession(Me.SPORTFilter, Me.SPORTFilter.SelectedValue) + + Me.SaveToSession(Me.SportIdFromFilter, Me.SportIdFromFilter.Text) + + Me.SaveToSession(Me.SportIdToFilter, Me.SportIdToFilter.Text) + + Me.SaveToSession(Me.SportSearch, Me.SportSearch.Text) + + + 'Save pagination state to session. + + + + ' Save table control properties to the session. + If Not Me.CurrentSortOrder Is Nothing Then + Me.SaveToSession(Me, "Order_By", Me.CurrentSortOrder.ToXmlString()) + End If + + Me.SaveToSession(Me, "Page_Index", Me.PageIndex.ToString()) + Me.SaveToSession(Me, "Page_Size", Me.PageSize.ToString()) + + Me.SaveToSession(Me, "DeletedRecordIds", Me.DeletedRecordIds) + + End Sub + + Protected Sub SaveControlsToSession_Ajax() + ' Save filter controls to values to session. + + Me.SaveToSession("SPORTFilter_Ajax", Me.SPORTFilter.SelectedValue) + + Me.SaveToSession("SportIdFromFilter_Ajax", Me.SportIdFromFilter.Text) + + Me.SaveToSession("SportIdToFilter_Ajax", Me.SportIdToFilter.Text) + + Me.SaveToSession("SportSearch_Ajax", Me.SportSearch.Text) + + HttpContext.Current.Session("AppRelativeVirtualPath") = Me.Page.AppRelativeVirtualPath + + End Sub + + Protected Overrides Sub ClearControlsFromSession() + MyBase.ClearControlsFromSession() + + ' Clear filter controls values from the session. + + Me.RemoveFromSession(Me.SPORTFilter) + Me.RemoveFromSession(Me.SportIdFromFilter) + Me.RemoveFromSession(Me.SportIdToFilter) + Me.RemoveFromSession(Me.SportSearch) + + ' Clear pagination state from session. + + + + ' Clear table properties from the session. + Me.RemoveFromSession(Me, "Order_By") + Me.RemoveFromSession(Me, "Page_Index") + Me.RemoveFromSession(Me, "Page_Size") + + Me.RemoveFromSession(Me, "DeletedRecordIds") + + End Sub + + Protected Overrides Sub LoadViewState(ByVal savedState As Object) + MyBase.LoadViewState(savedState) + + Dim orderByStr As String = CType(ViewState("SportTableControl_OrderBy"), String) + + If orderByStr IsNot Nothing AndAlso orderByStr.Trim <> "" Then + Me.CurrentSortOrder = BaseClasses.Data.OrderBy.FromXmlString(orderByStr) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + End If + + Dim pageIndex As String = CType(ViewState("Page_Index"), String) + If pageIndex IsNot Nothing Then + Me.PageIndex = CInt(pageIndex) + End If + + Dim pageSize As String = CType(ViewState("Page_Size"), String) + If Not pageSize Is Nothing Then + Me.PageSize = CInt(pageSize) + End If + + + + ' Load view state for pagination control. + + Me.DeletedRecordIds = CType(Me.ViewState("DeletedRecordIds"), String) + + End Sub + + Protected Overrides Function SaveViewState() As Object + + If Me.CurrentSortOrder IsNot Nothing Then + Me.ViewState("SportTableControl_OrderBy") = Me.CurrentSortOrder.ToXmlString() + End If + + Me.ViewState("Page_Index") = Me.PageIndex + Me.ViewState("Page_Size") = Me.PageSize + + Me.ViewState("DeletedRecordIds") = Me.DeletedRecordIds + + + ' Load view state for pagination control. + + + Return MyBase.SaveViewState() + End Function + + ' Generate the event handling functions for pagination events. + + ' event handler for ImageButton + Public Overridable Sub SportPagination_FirstPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.PageIndex = 0 + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub SportPagination_LastPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.DisplayLastPage = True + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub SportPagination_NextPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.PageIndex += 1 + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for LinkButton + Public Overridable Sub SportPagination_PageSizeButton_Click(ByVal sender As Object, ByVal args As EventArgs) + + Try + + Me.DataChanged = True + + Me.PageSize = Integer.Parse(Me.SportPagination.PageSize.Text) + + Me.PageIndex = Integer.Parse(Me.SportPagination.CurrentPage.Text) - 1 + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub SportPagination_PreviousPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + If Me.PageIndex > 0 Then + Me.PageIndex -= 1 + Me.DataChanged = True + End If + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + + ' Generate the event handling functions for sorting events. + + Public Overridable Sub SportIdLabel1_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by SportId when clicked. + + ' Get previous sorting state for SportId. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(SportTable.SportId) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for SportId. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(SportTable.SportId, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by SportId, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + Public Overridable Sub SPORTLabel1_Click(ByVal sender As Object, ByVal args As EventArgs) + ' Sorts by SPORT when clicked. + + ' Get previous sorting state for SPORT. + + Dim sd As OrderByItem = Me.CurrentSortOrder.Find(SportTable.SPORT) + If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then + ' First time sort, so add sort order for SPORT. + Me.CurrentSortOrder.Reset() + Me.CurrentSortOrder.Add(SportTable.SPORT, OrderByItem.OrderDir.Asc) + Else + ' Previously sorted by SPORT, so just reverse. + sd.Reverse() + End If + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + End Sub + + + ' Generate the event handling functions for button events. + + ' event handler for ImageButton + Public Overridable Sub SportAddButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + Me.AddNewRecord = 1 + Me.DataChanged = True + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub SportDeleteButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + If(Not Me.Page.IsPageRefresh) Then + + Me.DeleteSelectedRecords(True) + Me.SetFormulaControls() + + + End If + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub SportEditButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + ' The redirect URL is set on the Properties, Custom Properties or Actions. + ' The ModifyRedirectURL call resolves the parameters before the + ' Response.Redirect redirects the page to the URL. + ' Any code after the Response.Redirect call will not be executed, since the page is + ' redirected to the URL. + + + Dim url As String = "../Shared/ConfigureEditRecord.aspx" + + Dim shouldRedirect As Boolean = True + Dim TargetKey As String = Nothing + Dim DFKA As String = TargetKey + Dim id As String = DFKA + Dim value As String = id + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + url = Me.ModifyRedirectUrl(url, "",False) + url = Me.Page.ModifyRedirectUrl(url, "",False) + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + shouldRedirect = False + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + If shouldRedirect Then + Me.Page.ShouldSaveControlsToSession = True + Me.Page.Response.Redirect(url) + ElseIf Not TargetKey Is Nothing AndAlso _ + Not shouldRedirect Then + Me.Page.ShouldSaveControlsToSession = True + Me.Page.CloseWindow(True) + + End If + End Sub + + ' event handler for ImageButton + Public Overridable Sub SportRefreshButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Dim SportTableControlObj as SportTableControl = DirectCast(Me.Page.FindControlRecursively("SportTableControl"), SportTableControl) + SportTableControlObj.ResetData = True + + SportTableControlObj.RemoveFromSession(SportTableControlObj, "DeletedRecordIds") + SportTableControlObj.DeletedRecordIds = Nothing + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub SportResetButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + + Me.SPORTFilter.ClearSelection() + Me.SportIdFromFilter.Text = "" + Me.SportIdToFilter.Text = "" + Me.SportSearch.Text = "" + Me.CurrentSortOrder.Reset() + If Me.InSession(Me, "Order_By") Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + + End If + + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for ImageButton + Public Overridable Sub SportSaveButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) + + Try + ' Enclose all database retrieval/update code within a Transaction boundary + DbUtils.StartTransaction + + + If (Not Me.Page.IsPageRefresh) Then + Me.SaveData() + End If + + Me.Page.CommitTransaction(sender) + ' Set IsNewRecord to False for all records - since everything has been saved and is no longer "new" + Dim recCtl As SportTableControlRow + For Each recCtl in Me.GetRecordControls() + + recCtl.IsNewRecord = False + Next + + + ' Set DeletedRecordsIds to Nothing since we have deleted all pending deletes. + + Me.DeletedRecordIds = Nothing + + Catch ex As Exception + ' Upon error, rollback the transaction + Me.Page.RollBackTransaction(sender) + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + DbUtils.EndTransaction + End Try + + End Sub + + ' event handler for Button with Layout + Public Overridable Sub SportFilterButton_Click(ByVal sender As Object, ByVal args As EventArgs) + + Try + + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + ' event handler for Button with Layout + Public Overridable Sub SportSearchButton_Click(ByVal sender As Object, ByVal args As EventArgs) + + Try + + Me.DataChanged = True + + Catch ex As Exception + Me.Page.ErrorOnPage = True + + ' Report the error message to the end user + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + + Finally + + End Try + + End Sub + + + + ' Generate the event handling functions for filter and search events. + + ' event handler for FieldFilter + Protected Overridable Sub SPORTFilter_SelectedIndexChanged(ByVal sender As Object, ByVal args As EventArgs) + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + + + End Sub + + + ' Generate the event handling functions for others + + + Private _UIData As New System.Collections.Generic.List(Of Hashtable) + Public Property UIData() As System.Collections.Generic.List(Of Hashtable) + Get + Return Me._UIData + End Get + Set(ByVal value As System.Collections.Generic.List(Of Hashtable)) + Me._UIData = value + End Set + End Property + + ' pagination properties + Protected _PageSize As Integer + Public Property PageSize() As Integer + Get + Return Me._PageSize + End Get + Set(ByVal value As Integer) + Me._PageSize = value + End Set + End Property + + Protected _PageIndex As Integer + Public Property PageIndex() As Integer + Get + ' Return the PageIndex + Return Me._PageIndex + End Get + Set(ByVal value As Integer) + Me._PageIndex = value + End Set + End Property + + Protected _TotalRecords As Integer = -1 + Public Property TotalRecords() As Integer + Get + If _TotalRecords < 0 + _TotalRecords = SportTable.GetRecordCount(CreateCompoundJoinFilter(), CreateWhereClause()) + End If + Return Me._TotalRecords + End Get + Set(ByVal value As Integer) + If Me.PageSize > 0 Then + + Me.TotalPages = CInt(Math.Ceiling(value / Me.PageSize)) + + End If + Me._TotalRecords = value + End Set + End Property + + + + Protected _TotalPages As Integer = -1 + Public Property TotalPages() As Integer + Get + If _TotalPages < 0 Then + + Me.TotalPages = CInt(Math.Ceiling(TotalRecords / Me.PageSize)) + + End If + Return Me._TotalPages + End Get + Set(ByVal value As Integer) + Me._TotalPages = value + End Set + End Property + + Protected _DisplayLastPage As Boolean + Public Property DisplayLastPage() As Boolean + Get + Return Me._DisplayLastPage + End Get + Set(ByVal value As Boolean) + Me._DisplayLastPage = value + End Set + End Property + + Private _DataChanged As Boolean = False + Public Property DataChanged() As Boolean + Get + Return Me._DataChanged + End Get + Set(ByVal value As Boolean) + Me._DataChanged = value + End Set + End Property + + Private _ResetData As Boolean = False + Public Property ResetData() As Boolean + Get + Return Me._ResetData + End Get + Set(ByVal value As Boolean) + Me._ResetData = value + End Set + End Property + + Private _AddNewRecord As Integer = 0 + Public Property AddNewRecord() As Integer + Get + Return Me._AddNewRecord + End Get + Set(ByVal value As Integer) + Me._AddNewRecord = value + End Set + End Property + + + Private _CurrentSortOrder As OrderBy = Nothing + Public Property CurrentSortOrder() As OrderBy + Get + Return Me._CurrentSortOrder + End Get + Set(ByVal value As BaseClasses.Data.OrderBy) + Me._CurrentSortOrder = value + End Set + End Property + + Private _DataSource() As SportRecord = Nothing + Public Property DataSource() As SportRecord () + Get + Return Me._DataSource + End Get + Set(ByVal value() As SportRecord) + Me._DataSource = value + End Set + End Property + +#Region "Helper Properties" + + Public ReadOnly Property SportAddButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "SportAddButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property SportDeleteButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "SportDeleteButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property SportEditButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "SportEditButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property SPORTFilter() As System.Web.UI.WebControls.DropDownList + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "SPORTFilter"), System.Web.UI.WebControls.DropDownList) + End Get + End Property + + Public ReadOnly Property SportFilterButton() As Persons.UI.IThemeButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "SportFilterButton"), Persons.UI.IThemeButton) + End Get + End Property + + Public ReadOnly Property SportIdFromFilter() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "SportIdFromFilter"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property SportIdLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "SportIdLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property SportIdLabel1() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "SportIdLabel1"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property SportIdToFilter() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "SportIdToFilter"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property SPORTLabel() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "SPORTLabel"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property SPORTLabel1() As System.Web.UI.WebControls.LinkButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "SPORTLabel1"), System.Web.UI.WebControls.LinkButton) + End Get + End Property + + Public ReadOnly Property SportPagination() As Persons.UI.IPagination + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "SportPagination"), Persons.UI.IPagination) + End Get + End Property + + Public ReadOnly Property SportRefreshButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "SportRefreshButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property SportResetButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "SportResetButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property SportSaveButton() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "SportSaveButton"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property SportSearch() As System.Web.UI.WebControls.TextBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "SportSearch"), System.Web.UI.WebControls.TextBox) + End Get + End Property + + Public ReadOnly Property SportSearchButton() As Persons.UI.IThemeButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "SportSearchButton"), Persons.UI.IThemeButton) + End Get + End Property + + Public ReadOnly Property SportTableControlCollapsibleRegion() As System.Web.UI.WebControls.Panel + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "SportTableControlCollapsibleRegion"), System.Web.UI.WebControls.Panel) + End Get + End Property + + Public ReadOnly Property SportTableControlIcon() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "SportTableControlIcon"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property SportTableControlPanelExtender() As AjaxControlToolkit.CollapsiblePanelExtender + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "SportTableControlPanelExtender"), AjaxControlToolkit.CollapsiblePanelExtender) + End Get + End Property + + Public ReadOnly Property SportTitle() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "SportTitle"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property SportToggleAll() As System.Web.UI.WebControls.CheckBox + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "SportToggleAll"), System.Web.UI.WebControls.CheckBox) + End Get + End Property + +#End Region + +#Region "Helper Functions" + + Public Overrides Overloads Function ModifyRedirectUrl(url As String, arg As String, ByVal bEncrypt As Boolean) As String + Return Me.Page.EvaluateExpressions(url, arg, bEncrypt, Me) + End Function + + Public Overrides Overloads Function EvaluateExpressions(url As String, arg As String, ByVal bEncrypt As Boolean) As String + Dim needToProcess As Boolean = AreAnyUrlParametersForMe(url, arg) + If (needToProcess) Then + Dim recCtl As SportTableControlRow = Me.GetSelectedRecordControl() + If recCtl Is Nothing AndAlso url.IndexOf("{") >= 0 Then + ' Localization. + Throw New Exception(Page.GetResourceValue("Err:NoRecSelected", "Persons")) + End If + Dim rec As SportRecord = Nothing + If recCtl IsNot Nothing Then + rec = recCtl.GetRecord() + End If + Return EvaluateExpressions(url, arg, rec, bEncrypt) + End If + Return url + End Function + + Public Overridable Function GetSelectedRecordIndex() As Integer + Dim counter As Integer = 0 + Dim recControl As SportTableControlRow + For Each recControl In Me.GetRecordControls() + If recControl.SportRecordRowSelection.Checked Then + Return counter + End If + counter += 1 + Next + Return -1 + End Function + + Public Overridable Function GetSelectedRecordControl() As SportTableControlRow + Dim selectedList() As SportTableControlRow = Me.GetSelectedRecordControls() + If selectedList.Length = 0 Then + Return Nothing + End If + Return selectedList(0) + + End Function + + Public Overridable Function GetSelectedRecordControls() As SportTableControlRow() + + Dim selectedList As ArrayList = New ArrayList(25) + Dim recControl As SportTableControlRow + For Each recControl In Me.GetRecordControls() + If recControl.SportRecordRowSelection IsNot Nothing AndAlso recControl.SportRecordRowSelection.Checked Then + selectedList.Add(recControl) + End If + Next + Return DirectCast(selectedList.ToArray(GetType(SportTableControlRow)), SportTableControlRow()) + + End Function + + Public Overridable Sub DeleteSelectedRecords(ByVal deferDeletion As Boolean) + Dim recList() As SportTableControlRow = Me.GetSelectedRecordControls() + If recList.Length = 0 Then + ' Localization. + Throw New Exception(Page.GetResourceValue("Err:NoRecSelected", "Persons")) + End If + + Dim recCtl As SportTableControlRow + For Each recCtl In recList + If deferDeletion Then + If Not recCtl.IsNewRecord Then + + Me.AddToDeletedRecordIds(recCtl) + + End If + recCtl.Visible = False + + recCtl.SportRecordRowSelection.Checked = False + + Else + + recCtl.Delete() + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + End If + Next + End Sub + + Public Function GetRecordControls() As SportTableControlRow() + Dim recList As ArrayList = New ArrayList() + Dim rep As System.Web.UI.WebControls.Repeater = CType(Me.FindControl("SportTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return Nothing + Dim repItem As System.Web.UI.WebControls.RepeaterItem + + For Each repItem In rep.Items + + Dim recControl As SportTableControlRow = DirectCast(repItem.FindControl("SportTableControlRow"), SportTableControlRow) + recList.Add(recControl) + + Next + + Return DirectCast(recList.ToArray(GetType(SportTableControlRow)), SportTableControlRow()) + 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 + + \ No newline at end of file diff --git a/App_Code/Sport/SportWebReport.Controls.vb b/App_Code/Sport/SportWebReport.Controls.vb new file mode 100644 index 0000000..eacc88e --- /dev/null +++ b/App_Code/Sport/SportWebReport.Controls.vb @@ -0,0 +1,1782 @@ + +' This file implements the TableControl, TableControlRow, and RecordControl classes for the +' SportWebReport.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.SportWebReport + +#Region "Section 1: Place your customizations here." + + +Public Class SportTableControlRow + Inherits BaseSportTableControlRow + ' The BaseSportTableControlRow implements code for a ROW within the + ' the SportTableControl table. The BaseSportTableControlRow implements the DataBind and SaveData methods. + ' The loading of data is actually performed by the LoadData method in the base class of SportTableControl. + + ' This is the ideal place to add your code customizations. For example, you can override the DataBind, + ' SaveData, GetUIData, and Validate methods. + + +End Class + + + +Public Class SportTableControl + Inherits BaseSportTableControl + + ' The BaseSportTableControl class implements the LoadData, DataBind, CreateWhereClause + ' and other methods to load and display the data in a table control. + + ' This is the ideal place to add your code customizations. You can override the LoadData and CreateWhereClause, + ' The SportTableControlRow class offers another place where you can customize + ' the DataBind, GetUIData, SaveData and Validate methods specific to each row displayed on the table. + +End Class + + + +#End Region + + + +#Region "Section 2: Do not modify this section." + + +' Base class for the SportTableControlRow control on the SportWebReport page. +' Do not modify this class. Instead override any method in SportTableControlRow. +Public Class BaseSportTableControlRow + Inherits Persons.UI.BaseApplicationRecordControl + + ' To customize, override this method in SportTableControlRow. + Protected Overridable Sub Control_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Init + + Me.ClearControlsFromSession() + End Sub + + ' To customize, override this method in SportTableControlRow. + Protected Overridable Sub Control_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load + + 'Call LoadFocusScripts from repeater so that onfocus attribute could be added to elements + Me.Page.LoadFocusScripts(Me) + + + ' Register the event handlers. + + + End Sub + + + Public Overridable Sub LoadData() + + ' Load the data from the database into the DataSource Sport 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 = SportTable.GetRecord(Me.RecordUniqueId, True) + + Return + End If + + ' Since this is a row in the table, the data for this row is loaded by the + ' LoadData method of the BaseSportTableControl when the data for the entire + ' table is loaded. + + Me.DataSource = New SportRecord() + + + + End Sub + + ' Populate the UI controls using the DataSource. To customize, override this method in SportTableControlRow. + 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 + + SetSPORT() + SetSportId() + + + 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 SetSPORT() + + + ' Set the SPORT Literal on the webpage with value from the + ' Sport database record. + + ' Me.DataSource is the Sport record retrieved from the database. + ' Me.SPORT is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetSPORT() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.SPORTSpecified Then + + ' If the SPORT is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(SportTable.SPORT) + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.SPORT.Text = formattedValue + + Else + + ' SPORT is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.SPORT.Text = SportTable.SPORT.Format(SportTable.SPORT.DefaultValue) + + End If + + ' If the SPORT is NULL or blank, then use the value specified + ' on Properties. + If Me.SPORT.Text Is Nothing _ + OrElse Me.SPORT.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.SPORT.Text = " " + End If + + End Sub + + Public Overridable Sub SetSportId() + + + ' Set the SportId Literal on the webpage with value from the + ' Sport database record. + + ' Me.DataSource is the Sport record retrieved from the database. + ' Me.SportId is the ASP:Literal on the webpage. + + ' You can modify this method directly, or replace it with a call to + ' MyBase.SetSportId() + ' and add your own code before or after the call to the MyBase function. + + + + If Me.DataSource IsNot Nothing AndAlso Me.DataSource.SportIdSpecified Then + + ' If the SportId is non-NULL, then format the value. + + ' The Format method will use the Display Format + Dim formattedValue As String = Me.DataSource.Format(SportTable.SportId) + + formattedValue = HttpUtility.HtmlEncode(formattedValue) + Me.SportId.Text = formattedValue + + Else + + ' SportId is NULL in the database, so use the Default Value. + ' Default Value could also be NULL. + + Me.SportId.Text = SportTable.SportId.Format(SportTable.SportId.DefaultValue) + + End If + + ' If the SportId is NULL or blank, then use the value specified + ' on Properties. + If Me.SportId.Text Is Nothing _ + OrElse Me.SportId.Text.Trim() = "" Then + ' Set the value specified on the Properties. + Me.SportId.Text = " " + End If + + End Sub + + + Public EvaluateFormulaDelegate As BaseClasses.Data.DataSource.EvaluateFormulaDelegate = New BaseClasses.Data.DataSource.EvaluateFormulaDelegate(AddressOf Me.EvaluateFormula) + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean, ByVal e As FormulaEvaluator) As String + If e Is Nothing Then + e = New FormulaEvaluator() + End If + + e.Variables.Clear() + + + ' add variables for formula evaluation + If variables IsNot Nothing Then + Dim enumerator As System.Collections.Generic.IEnumerator(Of System.Collections.Generic.KeyValuePair(Of String, Object)) = variables.GetEnumerator() + While enumerator.MoveNext() + e.Variables.Add(enumerator.Current.Key, enumerator.Current.Value) + End While + End If + + If includeDS + + End IF + + + ' Other variables referred to in the formula are expected to be + ' properties of the DataSource. For example, referring to + ' UnitPrice as a variable will refer to DataSource.UnitPrice + If dataSourceForEvaluate Is Nothing Then + + e.DataSource = Me.DataSource + + Else + e.DataSource = dataSourceForEvaluate + End If + + ' Define the calling control. This is used to add other + ' related table and record controls as variables. + e.CallingControl = Me + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + + If Not String.IsNullOrEmpty(format) AndAlso (String.IsNullOrEmpty(formula) OrElse formula.IndexOf("Format(") < 0) Then + Return FormulaUtils.Format(resultObj, format) + Else + Return resultObj.ToString() + End If + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format,variables ,includeDS, Nothing) + End Function + + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object)) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format, variables ,True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, format, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal e as FormulaEvaluator) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, variables, True, e) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal includeDS as Boolean) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, includeDS, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, True, Nothing) + End Function + + + Public Overridable Sub RegisterPostback() + + + End Sub + + + + ' To customize, override this method in SportTableControlRow. + Public Overridable Sub SaveData() + ' Saves the associated record in the database. + ' SaveData calls Validate and Get methods - so it may be more appropriate to + ' customize those methods. + + ' 1. Load the existing record from the database. Since we save the entire record, this ensures + ' that fields that are not displayed are also properly initialized. + Me.LoadData() + + + ' 2. Perform any custom validation. + Me.Validate() + + + ' 3. Set the values in the record with data from UI controls. + ' This calls the Get() method for each of the user interface controls. + Me.GetUIData() + + ' 4. Save in the database. + ' We should not save the record if the data did not change. This + ' will save a database hit and avoid triggering any database triggers. + + If Me.DataSource.IsAnyValueChanged Then + ' Save record to database but do not commit yet. + ' Auto generated ids are available after saving for use by child (dependent) records. + Me.DataSource.Save() + + DirectCast(GetParentControlObject(Me, "SportTableControl"), SportTableControl).DataChanged = True + DirectCast(GetParentControlObject(Me, "SportTableControl"), SportTableControl).ResetData = True + End If + + + ' update session or cookie by formula + + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + ' For Master-Detail relationships, save data on the Detail table(s) + + End Sub + + ' To customize, override this method in SportTableControlRow. + 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. + + GetSPORT() + GetSportId() + End Sub + + + Public Overridable Sub GetSPORT() + + End Sub + + Public Overridable Sub GetSportId() + + End Sub + + + ' To customize, override this method in SportTableControlRow. + + Public Overridable Function CreateWhereClause() As WhereClause + + Return Nothing + + End Function + + + + ' To customize, override this method in SportTableControlRow. + 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) + SportTable.DeleteRecord(pkValue) + + DirectCast(GetParentControlObject(Me, "SportTableControl"), SportTableControl).DataChanged = True + DirectCast(GetParentControlObject(Me, "SportTableControl"), SportTableControl).ResetData = True + End Sub + + Protected Overridable Sub Control_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.PreRender + ' PreRender event is raised just before page is being displayed. + Try + DbUtils.StartTransaction() + Me.RegisterPostback() + + If Not Me.Page.ErrorOnPage AndAlso (Me.Page.IsPageRefresh OrElse Me.DataChanged OrElse Me.ResetData) Then + + + ' Re-load the data and update the web page if necessary. + ' This is typically done during a postback (filter, search button, sort, pagination button). + ' In each of the other click handlers, simply set DataChanged to True to reload the data. + Me.LoadData() + Me.DataBind() + End If + + + Catch ex As Exception + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + Finally + DbUtils.EndTransaction() + End Try + End Sub + + + Protected Overrides Sub SaveControlsToSession() + MyBase.SaveControlsToSession() + + + 'Save pagination state to session. + + End Sub + + + + Protected Overrides Sub ClearControlsFromSession() + MyBase.ClearControlsFromSession() + + + + ' Clear pagination state from session. + + End Sub + + Protected Overrides Sub LoadViewState(ByVal savedState As Object) + MyBase.LoadViewState(savedState) + Dim isNewRecord As String = CType(ViewState("IsNewRecord"), String) + If Not isNewRecord Is Nothing AndAlso isNewRecord.Trim <> "" Then + Me.IsNewRecord = Boolean.Parse(isNewRecord) + End If + + Dim myCheckSum As String = CType(ViewState("CheckSum"), String) + If Not myCheckSum Is Nothing AndAlso myCheckSum.Trim <> "" Then + Me.CheckSum = myCheckSum + End If + + + ' Load view state for pagination control. + + End Sub + + Protected Overrides Function SaveViewState() As Object + ViewState("IsNewRecord") = Me.IsNewRecord.ToString() + ViewState("CheckSum") = Me.CheckSum + + + ' Load view state for pagination control. + + Return MyBase.SaveViewState() + End Function + + + + 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("BaseSportTableControlRow_Rec"), String) + End Get + Set(ByVal value As String) + Me.ViewState("BaseSportTableControlRow_Rec") = value + End Set + End Property + + Private _DataSource As SportRecord + Public Property DataSource() As SportRecord + Get + Return Me._DataSource + End Get + + Set(ByVal value As SportRecord) + + Me._DataSource = value + End Set + End Property + + + + Private _checkSum As String + Public Overridable Property CheckSum() As String + Get + Return Me._checkSum + End Get + Set(ByVal value As String) + Me._checkSum = value + End Set + End Property + + Private _TotalPages As Integer + Public Property TotalPages() As Integer + Get + Return Me._TotalPages + End Get + Set(ByVal value As Integer) + Me._TotalPages = value + End Set + End Property + + Private _PageIndex As Integer + Public Property PageIndex() As Integer + Get + ' Return the PageIndex + Return Me._PageIndex + End Get + Set(ByVal value As Integer) + Me._PageIndex = value + End Set + End Property + + Private _DisplayLastPage As Boolean + Public Property DisplayLastPage() As Boolean + Get + Return Me._DisplayLastPage + End Get + Set(ByVal value As Boolean) + Me._DisplayLastPage = value + End Set + End Property + + + +#Region "Helper Properties" + + Public ReadOnly Property SPORT() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "SPORT"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property SportId() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "SportId"), 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 SportRecord = 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 SportRecord + If Not Me.DataSource Is Nothing Then + Return Me.DataSource + End If + + If Not Me.RecordUniqueId Is Nothing Then + + Return SportTable.GetRecord(Me.RecordUniqueId, True) + + End If + + ' Localization. + + Throw New Exception(Page.GetResourceValue("Err:RetrieveRec", "Persons")) + + End Function + + Public Shadows ReadOnly Property Page() As BaseApplicationPage + Get + Return DirectCast(MyBase.Page, BaseApplicationPage) + End Get + End Property + +#End Region + +End Class + + + +' Base class for the SportTableControl control on the SportWebReport page. +' Do not modify this class. Instead override any method in SportTableControl. +Public Class BaseSportTableControl + Inherits Persons.UI.BaseApplicationTableControl + + + + Protected Overridable Sub Control_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Init + + + + ' Setup the filter and search events. + + + + ' Control Initializations. + ' Initialize the table's current sort order. + + If Me.InSession(Me, "Order_By") Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + End If + + + + ' Setup default pagination settings. + + Me.PageSize = CInt(Me.GetFromSession(Me, "Page_Size", "500")) + Me.PageIndex = CInt(Me.GetFromSession(Me, "Page_Index", "0")) + + + + Me.ClearControlsFromSession() + End Sub + + Protected Overridable Sub Control_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load + + SaveControlsToSession_Ajax() + + ' Setup the pagination events. + + + ' Setup the sorting events. + + ' Setup the button events. + + + ' Setup events for others + + End Sub + + + Public Overridable Sub LoadData() + + ' Read data from database. Returns an array of records that can be assigned + ' to the DataSource table control property. + Try + Dim joinFilter As CompoundFilter = CreateCompoundJoinFilter() + + ' The WHERE clause will be empty when displaying all records in table. + Dim wc As WhereClause = CreateWhereClause() + If wc IsNot Nothing AndAlso Not wc.RunQuery Then + ' Initialize an empty array of records + Dim alist As New ArrayList(0) + Me.DataSource = DirectCast(alist.ToArray(GetType(SportRecord)), SportRecord()) + ' Add records to the list if needed. + Me.AddNewRecords() + Me._TotalRecords = 0 + Me._TotalPages = 0 + Return + End If + + ' Call OrderBy to determine the order - either use the order defined + ' on the Query Wizard, or specified by user (by clicking on column heading) + Dim orderBy As OrderBy = CreateOrderBy() + + ' Get the pagesize from the pagesize control. + Me.GetPageSize() + + If Me.DisplayLastPage Then + Dim totalRecords As Integer = If(Me._TotalRecords < 0, SportTable.GetRecordCount(CreateCompoundJoinFilter(), CreateWhereClause()), Me._TotalRecords) + + Dim totalPages As Integer = CInt(Math.Ceiling(totalRecords / Me.PageSize)) + + Me.PageIndex = totalPages - 1 + End If + + ' Make sure PageIndex (current page) and PageSize are within bounds. + If Me.PageIndex < 0 Then + Me.PageIndex = 0 + End If + If Me.PageSize < 1 Then + Me.PageSize = 1 + End If + + ' Retrieve the records and set the table DataSource. + ' Only PageSize records are fetched starting at PageIndex (zero based). + If Me.AddNewRecord > 0 Then + ' Make sure to preserve the previously entered data on new rows. + Dim postdata As New ArrayList + For Each rc As SportTableControlRow In Me.GetRecordControls() + If Not rc.IsNewRecord Then + rc.DataSource = rc.GetRecord() + rc.GetUIData() + postdata.Add(rc.DataSource) + UIData.Add(rc.PreservedUIData()) + End If + Next + Me.DataSource = DirectCast(postdata.ToArray(GetType(SportRecord)), SportRecord()) + Else ' Get the records from the database + Me.DataSource = SportTable.GetRecords(joinFilter, wc, orderBy, Me.PageIndex, Me.PageSize) + + End If + + ' if the datasource contains no records contained in database, then load the last page. + If (DbUtils.GetCreatedRecords(Me.DataSource).Length = 0 AndAlso Not Me.DisplayLastPage) Then + Me.DisplayLastPage = True + LoadData() + Else + + ' Add any new rows desired by the user. + Me.AddNewRecords() + + + ' Initialize the page and grand totals. now + + End If + + Catch ex As Exception + ' Report the error message to the end user + Dim msg As String = ex.Message + If ex.InnerException IsNot Nothing Then + msg = msg & " InnerException: " & ex.InnerException.Message + End If + Throw New Exception(msg, ex.InnerException) + End Try + End Sub + + + + + Public Overrides Sub DataBind() + ' The DataBind method binds the user interface controls to the values + ' from the database record for each row in the table. To do this, it calls the + ' DataBind for each of the rows. + ' DataBind also populates any filters above the table, and sets the pagination + ' control to the correct number of records and the current page number. + + MyBase.DataBind() + + ' Make sure that the DataSource is initialized. + If Me.DataSource Is Nothing Then + Return + End If + + 'LoadData for DataSource for chart and report if they exist + + ' Setup the pagination controls. + BindPaginationControls() + + + + ' Bind the repeater with the list of records to expand the UI. + Dim rep As System.Web.UI.WebControls.Repeater = CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "SportTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return + rep.DataSource = DataSource() + rep.DataBind() + + Dim index As Integer = 0 + For Each repItem As System.Web.UI.WebControls.RepeaterItem In rep.Items + ' Loop through all rows in the table, set its DataSource and call DataBind(). + Dim recControl As SportTableControlRow = DirectCast(repItem.FindControl("SportTableControlRow"), SportTableControlRow) + recControl.DataSource = Me.DataSource(index) + If Me.UIData.Count > index Then + recControl.PreviousUIData = Me.UIData(index) + End If + recControl.DataBind() + recControl.Visible = Not Me.InDeletedRecordIds(recControl) + + index += 1 + Next + + + + + ' Call the Set methods for each controls on the panel + + SetSportIdLabel1() + SetSPORTLabel1() + SetSportTableControlCollapsibleRegion() + SetSportTableControlIcon() + SetSportTableControlPanelExtender() + + ' setting the state of expand or collapse alternative rows + + + ' Load data for each record and table UI control. + ' Ordering is important because child controls get + ' their parent ids from their parent UI controls. + + + ' this method calls the set method for controls with special formula like running total, sum, rank, etc + SetFormulaControls() + End Sub + + Public Overridable Sub SetFormulaControls() + ' this method calls Set methods for the control that has special formula + + + + End Sub + + + + Public Overridable Sub RegisterPostback() + + + End Sub + + Public EvaluateFormulaDelegate As BaseClasses.Data.DataSource.EvaluateFormulaDelegate = New BaseClasses.Data.DataSource.EvaluateFormulaDelegate(AddressOf Me.EvaluateFormula) + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean, ByVal e as FormulaEvaluator) As String + If e Is Nothing + e = New FormulaEvaluator() + End If + + e.Variables.Clear() + + + ' add variables for formula evaluation + If variables IsNot Nothing Then + Dim enumerator As System.Collections.Generic.IEnumerator(Of System.Collections.Generic.KeyValuePair(Of String, Object)) = variables.GetEnumerator() + While enumerator.MoveNext() + e.Variables.Add(enumerator.Current.Key, enumerator.Current.Value) + End While + End If + + If includeDS + + End If + + ' All variables referred to in the formula are expected to be + ' properties of the DataSource. For example, referring to + ' UnitPrice as a variable will refer to DataSource.UnitPrice + e.DataSource = dataSourceForEvaluate + + ' Define the calling control. This is used to add other + ' related table and record controls as variables. + e.CallingControl = Me + + Dim resultObj As Object = e.Evaluate(formula) + If resultObj Is Nothing Then + Return "" + End If + + If Not String.IsNullOrEmpty(format) AndAlso (String.IsNullOrEmpty(formula) OrElse formula.IndexOf("Format(") < 0) Then + Return FormulaUtils.Format(resultObj, format) + Else + Return resultObj.ToString() + End If + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format,variables ,includeDS, Nothing) + End Function + + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object)) As String + Return EvaluateFormula(formula, dataSourceForEvaluate, format, variables ,True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, format, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal e as FormulaEvaluator) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, variables, True, e) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord) As String + Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, Nothing, True, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal includeDS as Boolean) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, includeDS, Nothing) + End Function + + Public Overridable Function EvaluateFormula(ByVal formula As String) As String + Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, True, Nothing) + End Function + + + + + Public Overridable Sub ResetControl() + + Me.CurrentSortOrder.Reset() + If (Me.InSession(Me, "Order_By")) Then + Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + + End If + + Me.PageIndex = 0 + End Sub + + Protected Overridable Sub BindPaginationControls() + ' Setup the pagination controls. + + ' Bind the pagination labels. + + + ' Bind the buttons for SportTableControl pagination. + + + + End Sub + + Public Overridable Sub SaveData() + ' Save the data from the entire table. Calls each row's Save Data + ' to save their data. This function is called by the Click handler of the + ' Save button. The button handler should Start/Commit/End a transaction. + + Dim recCtl As SportTableControlRow + For Each recCtl In Me.GetRecordControls() + + If Me.InDeletedRecordIds(recCtl) Then + ' Delete any pending deletes. + recCtl.Delete() + Else + If recCtl.Visible Then + recCtl.SaveData() + End If + End If + + Next + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + ' Set IsNewRecord to False for all records - since everything has been saved and is no longer "new" + For Each recCtl In Me.GetRecordControls() + recCtl.IsNewRecord = False + Next + + + ' Set DeletedRecordsIds to Nothing since we have deleted all pending deletes. + Me.DeletedRecordIds = Nothing + + End Sub + + Public Overridable Function CreateCompoundJoinFilter() As CompoundFilter + Dim jFilter As CompoundFilter = New CompoundFilter() + + Return jFilter + + End Function + + + Public Overridable Function CreateOrderBy() As OrderBy + ' The CurrentSortOrder is initialized to the sort order on the + ' Query Wizard. It may be modified by the Click handler for any of + ' the column heading to sort or reverse sort by that column. + ' You can add your own sort order, or modify it on the Query Wizard. + Return Me.CurrentSortOrder + End Function + + Public Overridable Function CreateWhereClause() As WhereClause + 'This CreateWhereClause is used for loading the data. + SportTable.Instance.InnerFilter = Nothing + Dim wc As WhereClause = New WhereClause() + + ' Compose the WHERE clause consiting of: + ' 1. Static clause defined at design time. + ' 2. User selected search criteria. + ' 3. User selected filter criteria. + + + Return wc + End Function + + + Public Overridable Function CreateWhereClause(ByVal searchText as String, ByVal fromSearchControl as String, ByVal AutoTypeAheadSearch as String, ByVal AutoTypeAheadWordSeparators as String) As WhereClause + ' This CreateWhereClause is used for loading list of suggestions for Auto Type-Ahead feature. + SportTable.Instance.InnerFilter = Nothing + Dim wc As WhereClause = New WhereClause() + + ' Compose the WHERE clause consiting of: + ' 1. Static clause defined at design time. + ' 2. User selected search criteria. + ' 3. User selected filter criteria. + + Dim appRelativeVirtualPath As String = CType(HttpContext.Current.Session("AppRelativeVirtualPath"), String) + + ' Adds clauses if values are selected in Filter controls which are configured in the page. + + + Return wc + End Function + + + Public Overridable Function FormatSuggestions(ByVal prefixText As String, ByVal resultItem As String, _ + ByVal columnLength As Integer, ByVal AutoTypeAheadDisplayFoundText As String, _ + ByVal autoTypeAheadSearch As String, ByVal AutoTypeAheadWordSeparators As String, _ + ByVal resultList As ArrayList) As Boolean + + 'Formats the resultItem and adds it to the list of suggestions. + Dim index As Integer = resultItem.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture).IndexOf(prefixText.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture)) + Dim itemToAdd As String = "" + Dim isFound As Boolean = False + Dim isAdded As Boolean = False + ' Get the index where prfixt is at the beginning of resultItem. If not found then, index of word which begins with prefixText. + If InvariantLCase(autoTypeAheadSearch).equals("wordsstartingwithsearchstring") And Not index = 0 Then + ' Expression to find word which contains AutoTypeAheadWordSeparators followed by prefixText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex( AutoTypeAheadWordSeparators + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + If regex1.IsMatch(resultItem) Then + index = regex1.Match(resultItem).Index + isFound = True + End If + ' If the prefixText is found immediatly after white space then starting of the word is found so don not search any further + If not resultItem(index).ToString() = " " Then + ' Expression to find beginning of the word which contains AutoTypeAheadWordSeparators followed by prefixText + Dim regex As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\\S*" + AutoTypeAheadWordSeparators + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + If regex.IsMatch(resultItem) Then + index = regex.Match(resultItem).Index + isFound = True + End If + End If + End If + + ' If autoTypeAheadSearch value is wordsstartingwithsearchstring then, extract the substring only if the prefixText is found at the + ' beginning of the resultItem (index = 0) or a word in resultItem is found starts with prefixText. + If index = 0 Or isFound Or InvariantLCase(autoTypeAheadSearch).Equals("anywhereinstring") then + If InvariantLCase(AutoTypeAheadDisplayFoundText).equals("atbeginningofmatchedstring") Then + ' Expression to find beginning of the word which contains prefixText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\\S*" + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) + ' Find the beginning of the word which contains prefexText + If (StringUtils.InvariantLCase(autoTypeAheadSearch).Equals("anywhereinstring") AndAlso regex1.IsMatch(resultItem)) Then + index = regex1.Match(resultItem).Index + isFound = True + End If + ' Display string from the index till end of the string if sub string from index till end is less than columnLength value. + If Len(resultItem) - index <= columnLength Then + If index = 0 Then + itemToAdd = resultItem + Else + itemToAdd = "..." & resultItem.Substring(index, Len(resultItem) - index) + End If + Else + If index = 0 Then + itemToAdd = resultItem.Substring(index, (columnLength - 3)) & "..." + Else + 'Truncate the string to show only columnLength - 6 characters as begining and trailing "..." has to be appended. + itemToAdd = "..." & resultItem.Substring(index , columnLength - 6) & "..." + End If + End If + ElseIf InvariantLCase(AutoTypeAheadDisplayFoundText).equals("inmiddleofmatchedstring") Then + Dim subStringBeginIndex As Integer = CType(columnLength/2, Integer) + If Len(resultItem) <= columnLength Then + itemToAdd = resultItem + Else + ' Sanity check at end of the string + If index + Len(prefixText) = columnLength Then + itemToAdd = "..." & resultItem.Substring(index-columnLength,index) + ElseIf Len(resultItem) - index < subStringBeginIndex Then + ' Display string from the end till columnLength value if, index is closer to the end of the string. + itemToAdd = "..." & resultItem.Substring(Len(resultItem)-columnLength,Len(resultItem)) + ElseIf index <= subStringBeginIndex Then + ' Sanity chet at beginning of the string + itemToAdd = resultItem.Substring(0, columnLength) & "..." + Else + ' Display string containing text before the prefixText occures and text after the prefixText + itemToAdd = "..." & resultItem.Substring(index - subStringBeginIndex, columnLength) & "..." + End If + End If + ElseIf InvariantLCase(AutoTypeAheadDisplayFoundText).equals("atendofmatchedstring") Then + ' Expression to find ending of the word which contains prefexText + Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\s", System.Text.RegularExpressions.RegexOptions.IgnoreCase) + ' Find the ending of the word which contains prefexText + If regex1.IsMatch(resultItem, index + 1) Then + index = regex1.Match(resultItem, index + 1).Index + Else + ' If the word which contains prefexText is the last word in string, regex1.IsMatch returns false. + index = resultItem.Length + End If + If index > Len(resultItem) Then + index = Len(resultItem) + End If + ' If text from beginning of the string till index is less than columnLength value then, display string from the beginning till index. + If index <= columnLength Then + if index = Len(resultItem) Then 'Make decision to append "..." + itemToAdd = resultItem.Substring(0,index) + Else + itemToAdd = resultItem.Substring(0,index) & "..." + End If + Else + If index = Len(resultItem) Then + itemToAdd = "..." & resultItem.Substring(index - (columnLength - 3), (columnLength - 3)) + Else + 'Truncate the string to show only columnLength - 6 characters as begining and trailing "..." has to be appended. + itemToAdd = "..." & resultItem.Substring(index - (columnLength - 6), columnLength - 6) & "..." + End If + End If + End If + + ' Remove newline character from itemToAdd + Dim prefixTextIndex As Integer = itemToAdd.IndexOf(prefixText, StringComparison.CurrentCultureIgnoreCase) + ' If itemToAdd contains any newline after the search text then show text only till newline + Dim regex2 As System.Text.RegularExpressions.Regex = New System.Text.RegularExpressions.Regex("(" & vbCrLf & "|" & vbLf & ")", System.Text.RegularExpressions.RegexOptions.IgnoreCase) + Dim newLineIndexAfterPrefix As Integer = -1 + If regex2.IsMatch(itemToAdd, prefixTextIndex) Then + newLineIndexAfterPrefix = regex2.Match(itemToAdd, prefixTextIndex).Index + End If + If (newLineIndexAfterPrefix > -1) Then + If itemToAdd.EndsWith("...") Then + itemToAdd = (itemToAdd.Substring(0, newLineIndexAfterPrefix) + "...") + Else + itemToAdd = itemToAdd.Substring(0, newLineIndexAfterPrefix) + End If + End If + ' If itemToAdd contains any newline before search text then show text which comes after newline + Dim regex3 As System.Text.RegularExpressions.Regex = New System.Text.RegularExpressions.Regex("(" & vbCrLf & "|" & vbLf & ")", (System.Text.RegularExpressions.RegexOptions.IgnoreCase Or System.Text.RegularExpressions.RegexOptions.RightToLeft)) + Dim newLineIndexBeforePrefix As Integer = -1 + If regex3.IsMatch(itemToAdd, prefixTextIndex) Then + newLineIndexBeforePrefix = regex3.Match(itemToAdd, prefixTextIndex).Index + End If + If (newLineIndexBeforePrefix > -1) Then + If itemToAdd.StartsWith("...") Then + itemToAdd = ("..." + itemToAdd.Substring((newLineIndexBeforePrefix + regex3.Match(itemToAdd, prefixTextIndex).Length))) + Else + itemToAdd = itemToAdd.Substring((newLineIndexBeforePrefix + regex3.Match(itemToAdd, prefixTextIndex).Length)) + End If + End If + + If Not itemToAdd is nothing AndAlso Not resultList.Contains(itemToAdd) Then + + resultList.Add(itemToAdd) + + isAdded = true + End If + End If + Return isAdded + End Function + + + Protected Overridable Sub GetPageSize() + + End Sub + + Protected Overridable Sub AddNewRecords() + + Dim newRecordList As ArrayList = New ArrayList() + + Dim newUIDataList As System.Collections.Generic.List(Of Hashtable) = New System.Collections.Generic.List(Of Hashtable)() + + ' Loop though all the record controls and if the record control + ' does not have a unique record id set, then create a record + ' and add to the list. + If Not Me.ResetData Then + Dim rep As System.Web.UI.WebControls.Repeater = CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "SportTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return + + Dim repItem As System.Web.UI.WebControls.RepeaterItem + For Each repItem In rep.Items + ' Loop through all rows in the table, set its DataSource and call DataBind(). + + Dim recControl As SportTableControlRow = DirectCast(repItem.FindControl("SportTableControlRow"), SportTableControlRow) + + If recControl.Visible AndAlso recControl.IsNewRecord() Then + + Dim rec As SportRecord = New SportRecord() + + If recControl.SPORT.Text <> "" Then + rec.Parse(recControl.SPORT.Text, SportTable.SPORT) + End If + If recControl.SportId.Text <> "" Then + rec.Parse(recControl.SportId.Text, SportTable.SportId) + End If + newUIDataList.Add(recControl.PreservedUIData()) + newRecordList.Add(rec) + End If + Next + End If + + + ' Add any new record to the list. + Dim index As Integer = 0 + For index = 1 To Me.AddNewRecord + + newRecordList.Insert(0, New SportRecord()) + newUIDataList.Insert(0, New Hashtable()) + + Next + Me.AddNewRecord = 0 + + ' Finally, add any new records to the DataSource. + If newRecordList.Count > 0 Then + + Dim finalList As ArrayList = New ArrayList(Me.DataSource) + finalList.InsertRange(0, newRecordList) + + Me.DataSource = DirectCast(finalList.ToArray(GetType(SportRecord)), SportRecord()) + + End If + + ' Add the existing UI data to this hash table + If newUIDataList.Count > 0 Then + Me.UIData.InsertRange(0, newUIDataList) + End If + + End Sub + + + Public Sub AddToDeletedRecordIds(ByVal rec As SportTableControlRow) + If rec.IsNewRecord() Then + Return + End If + + If Not Me.DeletedRecordIds Is Nothing AndAlso Me.DeletedRecordIds.Trim <> "" Then + Me.DeletedRecordIds &= "," + End If + + Me.DeletedRecordIds &= "[" & rec.RecordUniqueId & "]" + End Sub + + Protected Overridable Function InDeletedRecordIds(ByVal rec As SportTableControlRow) As Boolean + If Me.DeletedRecordIds Is Nothing OrElse Me.DeletedRecordIds.Trim = "" Then + Return False + End If + + Return Me.DeletedRecordIds.IndexOf("[" & rec.RecordUniqueId & "]") >= 0 + End Function + + Private _DeletedRecordIds As String + Public Property DeletedRecordIds() As String + Get + Return Me._DeletedRecordIds + End Get + Set(ByVal value As String) + Me._DeletedRecordIds = value + End Set + End Property + + + ' Create Set, WhereClause, and Populate Methods + + Public Overridable Sub SetSportIdLabel1() + + End Sub + + Public Overridable Sub SetSPORTLabel1() + + End Sub + + Public Overridable Sub SetSportTableControlCollapsibleRegion() + + End Sub + + Public Overridable Sub SetSportTableControlIcon() + + End Sub + + Public Overridable Sub SetSportTableControlPanelExtender() + + End Sub + + + + + Protected Overridable Sub Control_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.PreRender + ' PreRender event is raised just before page is being displayed. + Try + DbUtils.StartTransaction + Me.RegisterPostback() + + If Not Me.Page.ErrorOnPage AndAlso (Me.Page.IsPageRefresh OrElse Me.DataChanged OrElse Me.ResetData) Then + + + ' Re-load the data and update the web page if necessary. + ' This is typically done during a postback (filter, search button, sort, pagination button). + ' In each of the other click handlers, simply set DataChanged to True to reload the data. + + Me.LoadData() + Me.DataBind() + + End If + + + + Catch ex As Exception + Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) + Finally + DbUtils.EndTransaction + End Try + End Sub + + + Protected Overrides Sub SaveControlsToSession() + MyBase.SaveControlsToSession() + + ' Save filter controls to values to session. + + + 'Save pagination state to session. + + + + ' Save table control properties to the session. + If Not Me.CurrentSortOrder Is Nothing Then + Me.SaveToSession(Me, "Order_By", Me.CurrentSortOrder.ToXmlString()) + End If + + Me.SaveToSession(Me, "Page_Index", Me.PageIndex.ToString()) + Me.SaveToSession(Me, "Page_Size", Me.PageSize.ToString()) + + Me.SaveToSession(Me, "DeletedRecordIds", Me.DeletedRecordIds) + + End Sub + + Protected Sub SaveControlsToSession_Ajax() + ' Save filter controls to values to session. + + HttpContext.Current.Session("AppRelativeVirtualPath") = Me.Page.AppRelativeVirtualPath + + End Sub + + Protected Overrides Sub ClearControlsFromSession() + MyBase.ClearControlsFromSession() + + ' Clear filter controls values from the session. + + + ' Clear pagination state from session. + + + + ' Clear table properties from the session. + Me.RemoveFromSession(Me, "Order_By") + Me.RemoveFromSession(Me, "Page_Index") + Me.RemoveFromSession(Me, "Page_Size") + + Me.RemoveFromSession(Me, "DeletedRecordIds") + + End Sub + + Protected Overrides Sub LoadViewState(ByVal savedState As Object) + MyBase.LoadViewState(savedState) + + Dim orderByStr As String = CType(ViewState("SportTableControl_OrderBy"), String) + + If orderByStr IsNot Nothing AndAlso orderByStr.Trim <> "" Then + Me.CurrentSortOrder = BaseClasses.Data.OrderBy.FromXmlString(orderByStr) + Else + Me.CurrentSortOrder = New OrderBy(True, False) + End If + + Dim pageIndex As String = CType(ViewState("Page_Index"), String) + If pageIndex IsNot Nothing Then + Me.PageIndex = CInt(pageIndex) + End If + + Dim pageSize As String = CType(ViewState("Page_Size"), String) + If Not pageSize Is Nothing Then + Me.PageSize = CInt(pageSize) + End If + + + + ' Load view state for pagination control. + + Me.DeletedRecordIds = CType(Me.ViewState("DeletedRecordIds"), String) + + End Sub + + Protected Overrides Function SaveViewState() As Object + + If Me.CurrentSortOrder IsNot Nothing Then + Me.ViewState("SportTableControl_OrderBy") = Me.CurrentSortOrder.ToXmlString() + End If + + Me.ViewState("Page_Index") = Me.PageIndex + Me.ViewState("Page_Size") = Me.PageSize + + Me.ViewState("DeletedRecordIds") = Me.DeletedRecordIds + + + ' Load view state for pagination control. + + + Return MyBase.SaveViewState() + End Function + + ' Generate the event handling functions for pagination events. + + + ' Generate the event handling functions for sorting events. + + + ' Generate the event handling functions for button events. + + + + ' Generate the event handling functions for filter and search events. + + + ' Generate the event handling functions for others + + + Private _UIData As New System.Collections.Generic.List(Of Hashtable) + Public Property UIData() As System.Collections.Generic.List(Of Hashtable) + Get + Return Me._UIData + End Get + Set(ByVal value As System.Collections.Generic.List(Of Hashtable)) + Me._UIData = value + End Set + End Property + + ' pagination properties + Protected _PageSize As Integer + Public Property PageSize() As Integer + Get + Return Me._PageSize + End Get + Set(ByVal value As Integer) + Me._PageSize = value + End Set + End Property + + Protected _PageIndex As Integer + Public Property PageIndex() As Integer + Get + ' Return the PageIndex + Return Me._PageIndex + End Get + Set(ByVal value As Integer) + Me._PageIndex = value + End Set + End Property + + Protected _TotalRecords As Integer = -1 + Public Property TotalRecords() As Integer + Get + If _TotalRecords < 0 + _TotalRecords = SportTable.GetRecordCount(CreateCompoundJoinFilter(), CreateWhereClause()) + End If + Return Me._TotalRecords + End Get + Set(ByVal value As Integer) + If Me.PageSize > 0 Then + + Me.TotalPages = CInt(Math.Ceiling(value / Me.PageSize)) + + End If + Me._TotalRecords = value + End Set + End Property + + + + Protected _TotalPages As Integer = -1 + Public Property TotalPages() As Integer + Get + If _TotalPages < 0 Then + + Me.TotalPages = CInt(Math.Ceiling(TotalRecords / Me.PageSize)) + + End If + Return Me._TotalPages + End Get + Set(ByVal value As Integer) + Me._TotalPages = value + End Set + End Property + + Protected _DisplayLastPage As Boolean + Public Property DisplayLastPage() As Boolean + Get + Return Me._DisplayLastPage + End Get + Set(ByVal value As Boolean) + Me._DisplayLastPage = value + End Set + End Property + + Private _DataChanged As Boolean = False + Public Property DataChanged() As Boolean + Get + Return Me._DataChanged + End Get + Set(ByVal value As Boolean) + Me._DataChanged = value + End Set + End Property + + Private _ResetData As Boolean = False + Public Property ResetData() As Boolean + Get + Return Me._ResetData + End Get + Set(ByVal value As Boolean) + Me._ResetData = value + End Set + End Property + + Private _AddNewRecord As Integer = 0 + Public Property AddNewRecord() As Integer + Get + Return Me._AddNewRecord + End Get + Set(ByVal value As Integer) + Me._AddNewRecord = value + End Set + End Property + + + Private _CurrentSortOrder As OrderBy = Nothing + Public Property CurrentSortOrder() As OrderBy + Get + Return Me._CurrentSortOrder + End Get + Set(ByVal value As BaseClasses.Data.OrderBy) + Me._CurrentSortOrder = value + End Set + End Property + + Private _DataSource() As SportRecord = Nothing + Public Property DataSource() As SportRecord () + Get + Return Me._DataSource + End Get + Set(ByVal value() As SportRecord) + Me._DataSource = value + End Set + End Property + +#Region "Helper Properties" + + Public ReadOnly Property SportIdLabel1() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "SportIdLabel1"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property SPORTLabel1() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "SPORTLabel1"), System.Web.UI.WebControls.Literal) + End Get + End Property + + Public ReadOnly Property SportTableControlCollapsibleRegion() As System.Web.UI.WebControls.Panel + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "SportTableControlCollapsibleRegion"), System.Web.UI.WebControls.Panel) + End Get + End Property + + Public ReadOnly Property SportTableControlIcon() As System.Web.UI.WebControls.ImageButton + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "SportTableControlIcon"), System.Web.UI.WebControls.ImageButton) + End Get + End Property + + Public ReadOnly Property SportTableControlPanelExtender() As AjaxControlToolkit.CollapsiblePanelExtender + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "SportTableControlPanelExtender"), AjaxControlToolkit.CollapsiblePanelExtender) + End Get + End Property + + Public ReadOnly Property SportTitle() As System.Web.UI.WebControls.Literal + Get + Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "SportTitle"), System.Web.UI.WebControls.Literal) + End Get + End Property + +#End Region + +#Region "Helper Functions" + + Public Overrides Overloads Function ModifyRedirectUrl(url As String, arg As String, ByVal bEncrypt As Boolean) As String + Return Me.Page.EvaluateExpressions(url, arg, bEncrypt, Me) + End Function + + Public Overrides Overloads Function EvaluateExpressions(url As String, arg As String, ByVal bEncrypt As Boolean) As String + Dim needToProcess As Boolean = AreAnyUrlParametersForMe(url, arg) + If (needToProcess) Then + Dim recCtl As SportTableControlRow = Me.GetSelectedRecordControl() + If recCtl Is Nothing AndAlso url.IndexOf("{") >= 0 Then + ' Localization. + Throw New Exception(Page.GetResourceValue("Err:NoRecSelected", "Persons")) + End If + Dim rec As SportRecord = Nothing + If recCtl IsNot Nothing Then + rec = recCtl.GetRecord() + End If + Return EvaluateExpressions(url, arg, rec, bEncrypt) + End If + Return url + End Function + + Public Overridable Function GetSelectedRecordControl() As SportTableControlRow + Return Nothing + + End Function + + Public Overridable Function GetSelectedRecordControls() As SportTableControlRow() + + Return DirectCast((new ArrayList()).ToArray(GetType(SportTableControlRow)), SportTableControlRow()) + + End Function + + Public Overridable Sub DeleteSelectedRecords(ByVal deferDeletion As Boolean) + Dim recList() As SportTableControlRow = Me.GetSelectedRecordControls() + If recList.Length = 0 Then + ' Localization. + Throw New Exception(Page.GetResourceValue("Err:NoRecSelected", "Persons")) + End If + + Dim recCtl As SportTableControlRow + For Each recCtl In recList + If deferDeletion Then + If Not recCtl.IsNewRecord Then + + Me.AddToDeletedRecordIds(recCtl) + + End If + recCtl.Visible = False + + Else + + recCtl.Delete() + + ' Setting the DataChanged to True results in the page being refreshed with + ' the most recent data from the database. This happens in PreRender event + ' based on the current sort, search and filter criteria. + Me.DataChanged = True + Me.ResetData = True + + End If + Next + End Sub + + Public Function GetRecordControls() As SportTableControlRow() + Dim recList As ArrayList = New ArrayList() + Dim rep As System.Web.UI.WebControls.Repeater = CType(Me.FindControl("SportTableControlRepeater"), System.Web.UI.WebControls.Repeater) + If rep Is Nothing Then Return Nothing + Dim repItem As System.Web.UI.WebControls.RepeaterItem + + For Each repItem In rep.Items + + Dim recControl As SportTableControlRow = DirectCast(repItem.FindControl("SportTableControlRow"), SportTableControlRow) + recList.Add(recControl) + + Next + + Return DirectCast(recList.ToArray(GetType(SportTableControlRow)), SportTableControlRow()) + 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 + + \ No newline at end of file diff --git a/App_GlobalResources/BaseClasses.resx b/App_GlobalResources/BaseClasses.resx new file mode 100644 index 0000000..37a2ee4 --- /dev/null +++ b/App_GlobalResources/BaseClasses.resx @@ -0,0 +1,440 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + text/microsoft-resx + + + 4.0 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + All + Original English: All + + + Please see your database administrator for more information. + Original English: Please see your database administrator for more information. + + + Please contact your system administrator or customer support. + Original English: Please contact your system administrator or customer support. + + + Unable to access data. + Original English: Unable to access data. + + + The {BUTTON} button caused an error:{NEWLINE}{DETAILS} + Original English: The {BUTTON} button caused an error:{NEWLINE}{DETAILS} + + + Unable to create record. + Original English: Unable to create record. + + + While you were editing, another user updated the same record(s) you were modifying. We recommend you cancel this edit, and start the edit process again with the updated information. + Original English: While you were editing, another user updated the same record(s) you were modifying. We recommend you cancel this edit, and start the edit process again with the updated information. + + + While you were editing, another user deleted the same record(s) you were modifying. + Original English: While you were editing, another user deleted the same record(s) you were modifying. + + + While you were editing, another user deleted the same {Table} record(s) you were modifying. + Original English: While you were editing, another user deleted the same {Table} record(s) you were modifying. + + + While you were editing, another user updated the same {Table} record(s) you were modifying. We recommend you cancel this edit, and start the edit process again with the updated information. + Original English: While you were editing, another user updated the same {Table} record(s) you were modifying. We recommend you cancel this edit, and start the edit process again with the updated information. + + + The data you entered conflicts with a database constraint. + Original English: The data you entered conflicts with a database constraint. + + + The data you entered conflicts with a custom database constraint. + Original English: The data you entered conflicts with a custom database constraint. + + + A record you were attempting to modify contains a foreign key to a database record that does not exist. + Original English: A record you were attempting to modify contains a foreign key to a database record that does not exist. + + + You must enter values for all required fields. + Original English: You must enter values for all required fields. + + + The primary key of a record you were attempting to modify conflicts with the primary key of an existing record. + Original English: The primary key of a record you were attempting to modify conflicts with the primary key of an existing record. + + + A record you were attempting to delete or modify is referenced by other records. + Original English: A record you were attempting to delete or modify is referenced by other records. + + + The data you entered conflicts with unique data in an existing record. + Original English: The data you entered conflicts with unique data in an existing record. + + + Unable to delete record. + Original English: Unable to delete record. + + + Unable to delete record: {ID} + Original English: Unable to delete record: {ID} + + + Unable to delete records. + Original English: Unable to delete records. + + + Unable to Export records. + Original English: Unable to Export records. + + + Unable to get column values. + Original English: Unable to get column values. + + + Unable to get record: {ID}. The record ID is not unique. + Original English: Unable to get record: {ID}. The record ID is not unique. + + + Unable to get record: {ID} + Original English: Unable to get record: {ID} + + + Unable to get records. + Original English: Unable to get records. + + + Unable to get table statistics. + Original English: Unable to get table statistics. + + + An invalid value for "{Column}" was entered. + Original English: An invalid value for "{Column}" was entered. + + + The content you entered has exceeded the space permitted for the "{Column}" database field, {CharNumber} characters. + Original English: The content you entered has exceeded the space permitted for the "{Column}" database field, {CharNumber} characters. + + + The data you entered conflicts with the database schema. + Original English: The data you entered conflicts with the database schema. + + + The data you entered conflicts with the database schema. + Original English: The data you entered conflicts with the database schema. + + + The specified text string could not be converted to a {Type} enumeration value. + Original English: The specified text string could not be converted to a {Type} enumeration value. + + + Invalid value for Foreign Key "{Key}". + Original English: Invalid value for Foreign Key "{Key}". + + + The expression "{Expression}" could not be evaluated. + Original English: The expression "{Expression}" could not be evaluated. + + + The key and record belong to different tables. + Original English: The key and record belong to different tables. + + + A record with the ID '{ID}' could not be retrieved. + Original English: A record with the ID '{ID}' could not be retrieved. + + + The string "{ValueString}" could not be parsed as a field value using the format "{ValueFormat}". + Original English: The string "{ValueString}" could not be parsed as a field value using the format "{ValueFormat}". + + + A connection string was not found for "{ConnectionName}". + Original English: A connection string was not found for "{ConnectionName}". + + + Must be False. + Original English: Must be False. + + + The {Parameter} parameter must be greater than or equal to 0. The current value is {Value}. + Original English: The {Parameter} parameter must be greater than or equal to 0. The current value is {Value}. + + + Must be numeric. + Original English: Must be numeric. + + + Must be an integer. + Original English: Must be an integer. + + + The {Parameter} parameter must be greater than 0. The current value is {Value}. + Original English: The {Parameter} parameter must be greater than 0. The current value is {Value}. + + + Must be True. + Original English: Must be True. + + + Error occurred while assigning primary key columns to DataTable. + Original English: Error occurred while assigning primary key columns to DataTable. + + + The specified record does not have a column named "{Column}". + Original English: The specified record does not have a column named "{Column}". + + + The specified record does not have a foreign key named "{Key}". + Original English: The specified record does not have a foreign key named "{Key}". + + + The specified record does not have a primary key. + Original English: The specified record does not have a primary key. + + + The "{Table}" table does not allow new records to be added. + Original English: The "{Table}" table does not allow new records to be added. + + + The "{Table}" table does not allow records to be deleted. + Original English: The "{Table}" table does not allow records to be deleted. + + + The "{Table}" table does not allow records to be updated. + Original English: The "{Table}" table does not allow records to be updated. + + + While you were editing, another user updated the same record you were modifying. We recommend you cancel this edit, and start the edit process again with the updated information. + Original English: While you were editing, another user updated the same record you were modifying. We recommend you cancel this edit, and start the edit process again with the updated information. + + + While you were editing, another user may have deleted the same record(s) you were modifying. + Original English: While you were editing, another user may have deleted the same record(s) you were modifying. + + + The container's record's foreign key could not be updated. + Original English: The container's record's foreign key could not be updated. + + + Cannot update record. Record data is invalid. + Original English: Cannot update record. Record data is invalid. + + + Unable to update record. + Original English: Unable to update record. + + + Unable to update record: {ID} + Original English: Unable to update record: {ID} + + + {ColumnName} must be a valid credit card number. + Original English: {ColumnName} must be a valid credit card number. + + + {ColumnName} must be a valid credit card expiration date. + Original English: {ColumnName} must be a valid credit card expiration date. + + + {ColumnName} must be a valid date. + Original English: {ColumnName} must be a valid date. + + + {ColumnName} must be a valid email address. + Original English: {ColumnName} must be a valid email address. + + + {ColumnName} must be a valid file name. + Original English: {ColumnName} must be a valid file name. + + + {ColumnName} must contain at least {MinLength} characters. + Original English: {ColumnName} must contain at least {MinLength} characters. + + + {ColumnName} must be a valid monetary value. + Original English: {ColumnName} must be a valid monetary value. + + + {ColumnName} must be a valid non-decimal number. + Original English: {ColumnName} must be a valid non-decimal number. + + + {ColumnName} must be a valid percentage. + Original English: {ColumnName} must be a valid percentage. + + + {ColumnName} must be a valid URL. + Original English: {ColumnName} must be a valid URL. + + + {ColumnName} must be a valid ZIP Code. + Original English: {ColumnName} must be a valid ZIP Code. + + + en-US + Comment Language: en-US + + + ** Please Select ** + Original English: ** Please Select ** + + + No Selection + Original English: No Selection + + + ****** + Original English: ****** + + + Your company goes here. + Example: Iron Speed Inc. + + + 9.2.0 + Example: 9.2.0 + + + Your name goes here + Example: Joe P. Translator + + + 9.2.0 + + + + The {FieldName} value you entered is invalid. It may be invalid for a number of reasons. You may have entered a value that is longer than what is allowed, the value may contain invalid characters or the value might be out of range of allowed values. Please review the value and correct it and submit the changes again. + Original English: The {FieldName} value you entered is invalid. It may be invalid for a number of reasons. You may have entered a value that is longer than what is allowed, the value may contain invalid characters or the value might be out of range of allowed values. Please review the value and correct it and submit the changes again. + + + Please specify a value for the following URL parameter: {ParamName}. + Original English: Please specify a value for the following URL parameter: {ParamName}. + + + Please specify an integer value for the following URL parameter: {ParamName}. + Original English: Please specify an integer value for the following URL parameter: {ParamName}. + + + Please specify a numeric value for the following URL parameter: {ParamName}. + Original English: Please specify a numeric value for the following URL parameter: {ParamName}. + + + Please select a record before proceeding. + Original English: Please select a record before proceeding. + + \ No newline at end of file diff --git a/App_GlobalResources/BaseClasses.th-TH.resx b/App_GlobalResources/BaseClasses.th-TH.resx new file mode 100644 index 0000000..14949c9 --- /dev/null +++ b/App_GlobalResources/BaseClasses.th-TH.resx @@ -0,0 +1,369 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + en-US + + + + + + Iron Speed Inc. + + + กรอกข้อมูล "{Column}" ไม่ถูกต้อง. + An invalid value for "{Column}" was entered. + + + The content you entered has exceeded the space permitted for the "{Column}" database field, {CharNumber} characters. + + + The specified record does not have a column named "{Column}". + + + The specified record does not have a foreign key named "{Key}". + + + Error occured while assigning primary key columns to DataTable. + + + The specified record does not have a primary key. + + + A connection string was not found for "{ConnectionName}". + + + The {Parameter} parameter must be greater than 0. The current value is {Value}. + + + The {Parameter} parameter must be greater than or equal to 0. The current value is {Value}. + + + ** กรุณาเลือก ** + ** Please Select ** + + + No Selection + + + All + + + กรุณาเลือกข้อมูลที่ต้องการ + Please select a record before proceeding. + + + Please specify an integer value for the following URL parameter: {ParamName}. + + + Please specify a numeric value for the following URL parameter: {ParamName}. + + + Please specify a value for the following URL parameter: {ParamName}. + + + ****** + + + The "{Table}" table does not allow new records to be added. + + + The "{Table}" table does not allow records to be deleted. + + + The "{Table}" table does not allow records to be updated. + + + The string "{ValueString}" could not be parsed as a field value using the format "{ValueFormat}". + + + The specified text string could not be converted to a {Type} enumeration value. + + + หากมีข้อสงสัย กรุณาสอบถามผู้ดูแลระบบ + Please see your database administrator for more information. + + + The data you entered conflicts with a database constraint. + + + The data you entered conflicts with a custom database constraint. + + + The primary key of a record you were attempting to modify conflicts with the primary key of an existing record. + + + ข้อมูลซ้ำกับที่มีอยู่แล้ว. + The data you entered conflicts with unique data in an existing record. + + + A record you were attempting to modify contains a foreign key to a database record that does not exist. + + + ข้อมูลที่ต้องการลบ หรือแก้ไข มีข้อมูอื่นที่เกี่ยวข้องอยู่ ไม่สามารถดำเนินการได้ + A record you were attempting to delete or modify is referenced by other records. + + + The data you entered conflicts with the database schema. + + + The data you entered conflicts with the database schema. + + + You must enter values for all required fields. + + + While you were editing, another user updated the same record(s) you were modifying. We recommend you cancel this edit, and start the edit process again with the updated information. + + + While you were editing, another user updated the same {Table} record(s) you were modifying. We recommend you cancel this edit, and start the edit process again with the updated information. + + + While you were editing, another user deleted the same record(s) you were modifying. + + + While you were editing, another user deleted the same {Table} record(s) you were modifying. + + + A record with the ID '{ID}' could not be retrieved. + + + While you were editing, another user updated the same record you were modifying. We recommend you cancel this edit, and start the edit process again with the updated information. + + + While you were editing, another user may have deleted the same record(s) you were modifying. + + + ไม่สามารถบันทึกข้อมูลได้, ข้อมูลไม่ถูกต้อง. + Cannot update record. Record data is invalid. + + + The container's record's foreign key could not be updated. + + + The key and record belong to different tables. + + + Invalid value for Foreign Key "{Key}". + + + The expression "{Expression}" could not be evaluated. + + + เฉพาะตัวเลขเท่านั้น + Must be numeric. + + + เฉพาะตัวเลขเป็นจำนวนเต็มเท่านั้น + Must be an integer. + + + Must be True. + + + Must be False. + + + Unable to delete record: {ID} + + + Unable to get record: {ID} + + + Unable to get record: {ID}. The record ID is not unique. + + + Unable to Export records. + + + Unable to get records. + + + Unable to create record. + + + ไม่สามารถบันทึกข้อมูลได้ . + Unable to update record. + + + Unable to update record: {ID} + + + Unable to get column values. + + + Unable to get table statistics. + + + Unable to delete record. + + + Unable to delete records. + + + Unable to access data. + + + Please contact your system administrator or customer support. + Please contact your system administrator or customer support. + + + The {BUTTON} button caused an error:{NEWLINE}{DETAILS}" + + + {ColumnName} must be a valid non-decimal number. + + + {ColumnName} must be a valid date. + + + {ColumnName} must be a valid monetary value. + + + {ColumnName} must be a valid email address. + + + {ColumnName} must be a valid credit card number. + + + {ColumnName} must be a valid credit card expiration date. + + + {ColumnName} must be a valid URL. + + + {ColumnName} must be a valid ZIP Code. + + + {ColumnName} must be a valid percentage. + + + {ColumnName} must contain at least {MinLength} characters. + + + {ColumnName} must be a valid file name. + + + The {FieldName} value you entered is invalid. It may be invalid for a number of reasons. You may have entered a value that is longer than what is allowed, the value may contain invalid characters or the value might be out of range of allowed values. Please review the value and correct it and submit the changes again. + + + กรุณาแก้ไขข้อผิดพลาด: + Please correct the following errors: + + \ No newline at end of file diff --git a/App_GlobalResources/Persons.resx b/App_GlobalResources/Persons.resx new file mode 100644 index 0000000..3635b2a --- /dev/null +++ b/App_GlobalResources/Persons.resx @@ -0,0 +1,734 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + th + + + Pete + + + Neosamz Technologies + + + แก้ไข + + + เพิ่ม + + + ลบออก + + + แก้ไขข้อมูล + + + ดูข้อมูลนี้ + + + เริ่มใหม่ + + + ส่งออก + + + ยกเลิก/กลับ + + + ตกลง + + + บันทึก + + + ไป + + + ค้น + + + Refresh + + + ยกเลิกการกรองข้อมูล + + + คัดลอก + + + ส่งออกไป Excel + + + ส่งออกเป็น PDF ไฟล์ + + + หน้าแรก + + + หน้าแรก + + + หน้าต่อไป + + + หน้าสุดท้าย + + + บันทึกและเพิ่มใหม่ + + + ลบข้อมูล + + + คุณ..ต้องการลบข้อมูลที่เลือกไว้ ..? + Are you sure you want to delete this record? + + + ค้นหา + + + Page Total: + + + รวมทั้งสิ้น + + + หน้า + + + จาก + + + PageSize + + + ถึง + + + เพิ่มข้อมูล + + + แก้ไขข้อมูล + + + ดูข้อมูลนี้ + Show Record + + + ลงชื่อเข้าใช้ + + + ลงชื่อออก + + + เพิ่มเติม + + + เลือก + + + กรุณากรอกข้อมูลให้ครบ ( {FieldName} ) + + + กรอกข้อมูลยาวมากเกินไป ( {FieldName} ) + + + &nbsp; + + + รวมทุกรายการ + + + ข้อมูลการเข้าใช้ ไม่ถูกต้อง + + + พบข้อผิดพลาดในการลงชือเข้าใช้ + + + ชื่อผู้ใช้: + + + รหัสผ่าน: + + + กรุณา กรอกชื่อผู้ใช้ + + + กรุณา กรอกรหัสผ่าน + + + Skip navigation links + + + กรุณากรอกชื่อผู้ใช้และรหัสผ่าน + Enter your user name and password to sign in. + + + คุณลงชื่อออกไปแล้ว<br> กรุณาลงชื่อเข้าใช้ใหม่ + + + ไม่สามารถเรียกข้อมูลที่เลือกไว้ + The requested record could not be retrieved. + + + กรุณาเลือกข้อมูล + Please select a record. + + + ไม่สามารถเรียกข้อมูลนี้ได้ + The record could not be retrieved. + + + ไม่พบข้อมูลที่เลือก + The selected record does not exist anymore. + + + ไม่สามารถบันทึกข้อมูลได้ เนื่องจากไม่พบข้อมูลหลัก + The data could not be saved because the parent record ID could not be retrieved. + + + The URL parameter value is missing for {URL}. + + + ไม่สามารถบันทึกข้อมูลได้ เนื่องจากข้อมูลหลักยังไม่มีการดำเนินการ + The data could not be retrieved because the parent record is not initialized. + + + ไม่สามารถลบข้อมูลที่ต้องการ + The selected records could not be deleted. + + + กรุณาแก้ข้อผิดพลาด: + + + ไม่มีข้อมูล + No record was found. + + + กรุณาเลือกข้อมูลเพียงรายการเดียว + More than one record was found. Only one record was expected. + + + ทั้งหมด + + + ข้อมูลนี้ได้รับเปลี่ยนแปลงโดยบุคคลอื่น + This record has been changed by another user. + + + *กรุณาเลือก* + + + อื่นๆ + + + พิมพ์ + + + คุณ..ต้องการลบข้อมูลที่เลือกไว้ ..? + Are you sure you want to delete the selected records? + + + พิมพ์หน้านี้ + + + ขยายออก/ยุบเข้า + + + คัดลอกข้อมูล + + + ลงชื่อเข้าใช้อัตโนมัติ + + + + + + จดจำรหัสผ่าน + + + จดจำชื่อผู้ใช้ + + + ไม่ได้ลงชื่อเข้า + + + ส่งออกไป Microsoft Word + + + เพิ่ม + + + โดย + + + แก้ไข + + + แสดง + + + Select + + + Web Report + + + Select Language + + + รายการ + + + ยกเลิกการจำการเข้าใช้ + + + ลบการจดจำชื่อผู้ใช้และรหัสผ่าน + Clear stored user name and password information + + + Web Report + + + ค้น + + + แก้ไข + + + เพิ่ม + + + เลือก + + + ค้นหา และแก้ไข + + + เลือกและแก้ไข + + + แสดง + + + เลือก และแก้ไข + + + ค้นหา และแก้ไข + + + Search + + + นำเข้า + + + คอลั่มน์ + + + The {ColumnName} column is read only and cannot be updated. + + + ต่อไป + + + Select the data file to import. + + + You are currently on the first step of the Import Wizard. + + + table + + + The {ColumnName} column has already been selected. Please select a unique column name for each data column. + + + ก่อนหน้า + + + กรุณาเลือกไฟล์ที่ต้องการนำเข้า + + + The {ColumnName} column is a primary key and cannot be updated. + + + กรุณาเลือกไฟล์ที่ต้องการนำเข้า + + + ชื่อ คอลั่มน์ + + + บรรทัดแรกของข้อมูลเป็นชื่อคอลั่มน์ + + + You are currently on the last step of the Import Wizard. + + + นำเข้าข้อมูล + + + The Import Wizard cannot import data into tables with composite foreign keys. + + + Import Wizard: Step 1 of 2 + + + Import Wizard: Step 2 of 2 + + + {Records} record(s) were successfully imported. + + + The file you selected cannot be imported. Please select an ASCII comma separated value (CSV) file to import. + + + ไฟล์นี้อาจกำลังใช้งานอยู่ กรุณาปิดก่อน แล้วลองใหม่อีกครั้ง + This file is in use by another application. Please close the file and try again. + + + table inside table + + + ขยายออก/ยุบเข้า + + + Show related + + + กรุณาเลือกไฟล์ ตามชนิดที่เลือกไว้ + Please select file according to selected file type. + + + Password: + + + (Optional) + + + Worksheet name: + + + Table name: + + + Your message goes here. + + + {Records} record(s) were skipped. + + + Microsoft Excel (Office 97-2003, Office 2007) + + + ASCII comma separated value (CSV) + + + เลือกชนิดของไฟล์ + + + Microsoft Access (Office 2000-2003, Office 2007) + + + ชยายออก / ยุบเข้า + + + Application logo + + + TAB delimited + + + Open File + + + The record could not be retrieved because the table {TableName} does not have any primary key field in it. + + + ลงชื่อออกเรียบร้อยแล้ว + + + ปิดหน้าต่างนี้ เพื่อลงชื่อออกจากการเข้าใช้ + Please close your browser window to completely log out. + + + Contains + + + ขึ้นต้นด้วย + + + กำลังบันทึกข้อมูล + + + จำนวนที่เลือกไว้= {SelectedCount} .  กรุณาเลือกเพียง {Limit}. + You have selected {SelectedCount} filter values.  Please select no more than {Limit}. + + + เลือกคอลั่มน์ที่ต้องการนำเข้า + Select and assign the data columns you wish to import. + + + คุณไม่มีสิทธิในการเข้าใช้ + The security settings of the application do not permit you to view this page. + + + Unable to access data. Please contact your system administrator or customer support. + + + กรุณาติดต่อผู้ดูแลระบบ + If you believe this is an error, please contact your system administrator to change the security settings. + + + The Import Wizard cannot save a temporary file. +This may be due to insufficient privileges to write within the application folder, or the application is running under Medium Trust with the file operation disabled. + + + Error: + + + Skipped records (first {Number} shown): + + + เสร็จสิ้น + + + บรรทัดที่ {Number}: + + + Skipped records: + + + Sign In + + + Day + + + Year + + + There was no Sign In information for + + + Back + + + Update related database tables. + + + Group By + + + Send + + + Week + + + Your password has been emailed to you at + + + Actions + + + Retrieve User Name and Password + + + PASSWORD + + + ค้นหาจาก... + + + USER NAME + + + 9.2.0 + + + Forgot your password? + + + Filters + + + Sign Out + + + 9.2.0 + + + Sort By + + + Please enter the correct values in the reCaptcha control + + + Are you sure you want to delete this record? + + + Failed sending to + + + Here are your user name(s) and password(s) for + + + More + + + Enter the email address associated with your account + + + Month + + + The number of rows to be exported exceeds the maximum limit. Your file will be exported as ASCII CSV instead, using data fields only in the current table. + + + Quarter + + + Sign In information retrieval + + + Then enter these words in the text box below + + + Menu + + + Your USER NAME and PASSWORD will be emailed directly to the email address you enter. + + + There was no table for login information. + + + There was an error processing your request. + + + There was no email address given. + + + อื่นๆ + + + Settings + + \ No newline at end of file diff --git a/App_GlobalResources/Persons.th-TH.resx b/App_GlobalResources/Persons.th-TH.resx new file mode 100644 index 0000000..3635b2a --- /dev/null +++ b/App_GlobalResources/Persons.th-TH.resx @@ -0,0 +1,734 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + th + + + Pete + + + Neosamz Technologies + + + แก้ไข + + + เพิ่ม + + + ลบออก + + + แก้ไขข้อมูล + + + ดูข้อมูลนี้ + + + เริ่มใหม่ + + + ส่งออก + + + ยกเลิก/กลับ + + + ตกลง + + + บันทึก + + + ไป + + + ค้น + + + Refresh + + + ยกเลิกการกรองข้อมูล + + + คัดลอก + + + ส่งออกไป Excel + + + ส่งออกเป็น PDF ไฟล์ + + + หน้าแรก + + + หน้าแรก + + + หน้าต่อไป + + + หน้าสุดท้าย + + + บันทึกและเพิ่มใหม่ + + + ลบข้อมูล + + + คุณ..ต้องการลบข้อมูลที่เลือกไว้ ..? + Are you sure you want to delete this record? + + + ค้นหา + + + Page Total: + + + รวมทั้งสิ้น + + + หน้า + + + จาก + + + PageSize + + + ถึง + + + เพิ่มข้อมูล + + + แก้ไขข้อมูล + + + ดูข้อมูลนี้ + Show Record + + + ลงชื่อเข้าใช้ + + + ลงชื่อออก + + + เพิ่มเติม + + + เลือก + + + กรุณากรอกข้อมูลให้ครบ ( {FieldName} ) + + + กรอกข้อมูลยาวมากเกินไป ( {FieldName} ) + + + &nbsp; + + + รวมทุกรายการ + + + ข้อมูลการเข้าใช้ ไม่ถูกต้อง + + + พบข้อผิดพลาดในการลงชือเข้าใช้ + + + ชื่อผู้ใช้: + + + รหัสผ่าน: + + + กรุณา กรอกชื่อผู้ใช้ + + + กรุณา กรอกรหัสผ่าน + + + Skip navigation links + + + กรุณากรอกชื่อผู้ใช้และรหัสผ่าน + Enter your user name and password to sign in. + + + คุณลงชื่อออกไปแล้ว<br> กรุณาลงชื่อเข้าใช้ใหม่ + + + ไม่สามารถเรียกข้อมูลที่เลือกไว้ + The requested record could not be retrieved. + + + กรุณาเลือกข้อมูล + Please select a record. + + + ไม่สามารถเรียกข้อมูลนี้ได้ + The record could not be retrieved. + + + ไม่พบข้อมูลที่เลือก + The selected record does not exist anymore. + + + ไม่สามารถบันทึกข้อมูลได้ เนื่องจากไม่พบข้อมูลหลัก + The data could not be saved because the parent record ID could not be retrieved. + + + The URL parameter value is missing for {URL}. + + + ไม่สามารถบันทึกข้อมูลได้ เนื่องจากข้อมูลหลักยังไม่มีการดำเนินการ + The data could not be retrieved because the parent record is not initialized. + + + ไม่สามารถลบข้อมูลที่ต้องการ + The selected records could not be deleted. + + + กรุณาแก้ข้อผิดพลาด: + + + ไม่มีข้อมูล + No record was found. + + + กรุณาเลือกข้อมูลเพียงรายการเดียว + More than one record was found. Only one record was expected. + + + ทั้งหมด + + + ข้อมูลนี้ได้รับเปลี่ยนแปลงโดยบุคคลอื่น + This record has been changed by another user. + + + *กรุณาเลือก* + + + อื่นๆ + + + พิมพ์ + + + คุณ..ต้องการลบข้อมูลที่เลือกไว้ ..? + Are you sure you want to delete the selected records? + + + พิมพ์หน้านี้ + + + ขยายออก/ยุบเข้า + + + คัดลอกข้อมูล + + + ลงชื่อเข้าใช้อัตโนมัติ + + + + + + จดจำรหัสผ่าน + + + จดจำชื่อผู้ใช้ + + + ไม่ได้ลงชื่อเข้า + + + ส่งออกไป Microsoft Word + + + เพิ่ม + + + โดย + + + แก้ไข + + + แสดง + + + Select + + + Web Report + + + Select Language + + + รายการ + + + ยกเลิกการจำการเข้าใช้ + + + ลบการจดจำชื่อผู้ใช้และรหัสผ่าน + Clear stored user name and password information + + + Web Report + + + ค้น + + + แก้ไข + + + เพิ่ม + + + เลือก + + + ค้นหา และแก้ไข + + + เลือกและแก้ไข + + + แสดง + + + เลือก และแก้ไข + + + ค้นหา และแก้ไข + + + Search + + + นำเข้า + + + คอลั่มน์ + + + The {ColumnName} column is read only and cannot be updated. + + + ต่อไป + + + Select the data file to import. + + + You are currently on the first step of the Import Wizard. + + + table + + + The {ColumnName} column has already been selected. Please select a unique column name for each data column. + + + ก่อนหน้า + + + กรุณาเลือกไฟล์ที่ต้องการนำเข้า + + + The {ColumnName} column is a primary key and cannot be updated. + + + กรุณาเลือกไฟล์ที่ต้องการนำเข้า + + + ชื่อ คอลั่มน์ + + + บรรทัดแรกของข้อมูลเป็นชื่อคอลั่มน์ + + + You are currently on the last step of the Import Wizard. + + + นำเข้าข้อมูล + + + The Import Wizard cannot import data into tables with composite foreign keys. + + + Import Wizard: Step 1 of 2 + + + Import Wizard: Step 2 of 2 + + + {Records} record(s) were successfully imported. + + + The file you selected cannot be imported. Please select an ASCII comma separated value (CSV) file to import. + + + ไฟล์นี้อาจกำลังใช้งานอยู่ กรุณาปิดก่อน แล้วลองใหม่อีกครั้ง + This file is in use by another application. Please close the file and try again. + + + table inside table + + + ขยายออก/ยุบเข้า + + + Show related + + + กรุณาเลือกไฟล์ ตามชนิดที่เลือกไว้ + Please select file according to selected file type. + + + Password: + + + (Optional) + + + Worksheet name: + + + Table name: + + + Your message goes here. + + + {Records} record(s) were skipped. + + + Microsoft Excel (Office 97-2003, Office 2007) + + + ASCII comma separated value (CSV) + + + เลือกชนิดของไฟล์ + + + Microsoft Access (Office 2000-2003, Office 2007) + + + ชยายออก / ยุบเข้า + + + Application logo + + + TAB delimited + + + Open File + + + The record could not be retrieved because the table {TableName} does not have any primary key field in it. + + + ลงชื่อออกเรียบร้อยแล้ว + + + ปิดหน้าต่างนี้ เพื่อลงชื่อออกจากการเข้าใช้ + Please close your browser window to completely log out. + + + Contains + + + ขึ้นต้นด้วย + + + กำลังบันทึกข้อมูล + + + จำนวนที่เลือกไว้= {SelectedCount} .  กรุณาเลือกเพียง {Limit}. + You have selected {SelectedCount} filter values.  Please select no more than {Limit}. + + + เลือกคอลั่มน์ที่ต้องการนำเข้า + Select and assign the data columns you wish to import. + + + คุณไม่มีสิทธิในการเข้าใช้ + The security settings of the application do not permit you to view this page. + + + Unable to access data. Please contact your system administrator or customer support. + + + กรุณาติดต่อผู้ดูแลระบบ + If you believe this is an error, please contact your system administrator to change the security settings. + + + The Import Wizard cannot save a temporary file. +This may be due to insufficient privileges to write within the application folder, or the application is running under Medium Trust with the file operation disabled. + + + Error: + + + Skipped records (first {Number} shown): + + + เสร็จสิ้น + + + บรรทัดที่ {Number}: + + + Skipped records: + + + Sign In + + + Day + + + Year + + + There was no Sign In information for + + + Back + + + Update related database tables. + + + Group By + + + Send + + + Week + + + Your password has been emailed to you at + + + Actions + + + Retrieve User Name and Password + + + PASSWORD + + + ค้นหาจาก... + + + USER NAME + + + 9.2.0 + + + Forgot your password? + + + Filters + + + Sign Out + + + 9.2.0 + + + Sort By + + + Please enter the correct values in the reCaptcha control + + + Are you sure you want to delete this record? + + + Failed sending to + + + Here are your user name(s) and password(s) for + + + More + + + Enter the email address associated with your account + + + Month + + + The number of rows to be exported exceeds the maximum limit. Your file will be exported as ASCII CSV instead, using data fields only in the current table. + + + Quarter + + + Sign In information retrieval + + + Then enter these words in the text box below + + + Menu + + + Your USER NAME and PASSWORD will be emailed directly to the email address you enter. + + + There was no table for login information. + + + There was an error processing your request. + + + There was no email address given. + + + อื่นๆ + + + Settings + + \ No newline at end of file diff --git a/App_Themes/Denali/BaseStyles.css b/App_Themes/Denali/BaseStyles.css new file mode 100644 index 0000000..06ba900 --- /dev/null +++ b/App_Themes/Denali/BaseStyles.css @@ -0,0 +1,1833 @@ +/********************************************************************** + * BaseStyles.LeftToRight.css * + * * + * This file contains the styles for Left to Right languages. * + * This file will be copied to BaseStyles.css if you select a LTR * + * language as the primary language of your application. * + * * + * Do not modify this file. To override any of the styles, please * + * modify the Styles.css file. * + * * + **********************************************************************/ + +HTML { /* language direction flow of content on page */ + direction: ltr; + } + + +/********************************************************************** + * Button Styles * + **********************************************************************/ +a.button_link, .thc a.button_link, .tic a.button_link, .ttc a.button_link { /* link text of buttons (including those within column headers and data grid) */ + color: #eeeeee; + font-family:Leela, Tahoma, Verdana, Geneva, ms sans serif; + font-size: 14px; + font-weight: bold; + text-decoration: none; + text-transform: none; + text-align: center; + padding-left: 3px; + padding-right: 3px; + padding-top: 1px; + width: 100%; + } + +a.button_link:hover, .thc a.button_link:hover, .tic a.button_link:hover, .ttc a.button_link:hover { /* link text of buttons (including those within column headers and data grid) hover state */ + color: #ffffff; + text-decoration: none; + } + +.button-TL-white, .bTL { /* theme button top left edge */ + background-image: url(../../Images/buttonTL.gif); + background-repeat: no-repeat; + background-position: bottom right; + width: 14px; + height: 6px; + } +.button-T-white, .bT { /* theme button top center edge */ + background-image: url(../../Images/buttonT.gif); + background-repeat: repeat-x; + background-position: bottom center; + height: 6px; + } +.button-TR-white, .bTR { /* theme button top right edge */ + background-image: url(../../Images/buttonTR.gif); + background-repeat: no-repeat; + background-position: bottom left; + width: 14px; + height: 6px; + } +.button-L-white, .bL { /* theme button left middle edge */ + background-image: url(../../Images/buttonL.gif); + background-repeat: no-repeat; + background-position: center right; + width: 14px; + height: 15px; + } +.button-white, .bC { /* theme button center */ + background-image: url(../../Images/buttonC.gif); + background-repeat: repeat-x; + white-space: nowrap; + height: 15px; + } +.button-R-white, .bR { /* theme button right middle edge */ + background-image: url(../../Images/buttonR.gif); + background-repeat: no-repeat; + background-position: center left; + width: 14px; + height: 15px; + } +.button-BL-white, .bBL { /* theme button bottom left edge */ + background-image: url(../../Images/buttonBL.gif); + background-repeat: no-repeat; + background-position: top right; + width: 14px; + height: 7px; + } +.button-B-white, .bB { /* theme button bottom center edge */ + background-image: url(../../Images/buttonB.gif); + background-repeat: repeat-x; + background-position: top center; + height: 7px; + } +.button-BR-white, .bBR { /* theme button bottom right edge */ + background-image: url(../../Images/buttonBR.gif); + background-repeat: no-repeat; + background-position: top left; + width: 14px; + height: 7px; + } + + +/********************************************************************** + * Multi-level Menu Styles * + **********************************************************************/ +.MLMmenuAlign { /* horizontal menu container alignment */ + padding-bottom: 6px; + padding-top: 6px; + } + +.MLMmenu { /* horizontal menu container */ + } + +.MLMmenusub { /* horizontal submenu container (menu leaves) */ + border: 1px solid #bf9d13; + z-index: 100; + } + +.MLMmC { /* horizontal menu item link text */ + background-color: #e4f5d3; + border: 1px solid #bf9d13; + color: #666666; + cursor: pointer !important; + font-family:Leela, Tahoma, Verdana, Geneva, ms sans serif; + font-size: 14px; + font-weight: bold; + padding-bottom: 4px; + padding-left: 4px; + padding-right: 4px; + padding-top: 4px; + } + +.MLMmoC:hover, .MLMmoC:hover a, .MLMmoC { /* horizontal menu item link text hover state */ + background-color: #ffffff; + color: #000000; + } + +.MLMsubmC { /* horizontal submenu item link text */ + background-color: #cbe5a1; + color: #666666; + cursor: pointer !important; + font-family:Leela, Tahoma, Verdana, Geneva, ms sans serif; + font-size: 14px; + padding-bottom: 2px; + padding-left: 4px; + padding-right: 4px; + padding-top: 2px; + } + +.MLMsubmoC { /* horizontal submenu item link text hover state */ + background-color: #ffffff; + color: #000000; + } + +.MLMmbbg { /* horizontal menu bottom trim */ + } + +.MLMmenuVAlign { /* vertical menu container alignment */ + padding-left: 6px; + padding-right: 6px; + } + +.MLMmenuV { /* vertical menu container */ + position: relative; + } + +.MLMmenuVsub { /* vertical submenu container */ + border: 1px solid #bf9d13; + z-index: 100; + } + +.MLMmvC { /* vertical menu item link text */ + background-color: #e4f5d3; + border: 1px solid #bf9d13; + color: #666666; + cursor: pointer !important; + font-family:Leela, Tahoma, Verdana, Geneva, ms sans serif; + font-size: 14px; + font-weight: bold; + padding-bottom: 4px; + padding-left: 4px; + padding-right: 4px; + padding-top: 4px; + } + +.MLMmvC:hover, .MLMmvC:hover a, .MLMmvoC { /* vertical menu item link text hover state */ + background-color: #ffffff; + color: #000000; + } + +.MLMsubmvC { /* vertical submenu item link text */ + background-color: #cbe5a1; + color: #666666; + cursor: pointer !important; + font-family:Leela, Tahoma, Verdana, Geneva, ms sans serif; + font-size: 14px; + padding-bottom: 2px; + padding-left: 4px; + padding-right: 4px; + padding-top: 2px; + } + +.MLMsubmvoC { /* vertical submenu item link text hover state */ + background-color: #ffffff; + color: #000000; + } + +.MLMmveTL { /* vertical menu top left edge */ + } + +.MLMmveT { /* vertical menu top center edge */ + } + +.MLMmveTR { /* vertical menu top right edge */ + } + +.MLMmveBL { /* vertical menu bottom left edge */ + } + +.MLMmveB { /* vertical menu bottom center edge */ + } + +.MLMmveBR { /* vertical menu bottom right edge */ + } + + +/********************************************************************** + * Classic Menu Styles * + **********************************************************************/ +.menus { /* horizontal menu container */ + padding-bottom: 6px; + padding-top: 6px; + } + +.menusV { /* vertical menu container */ + padding-left: 5px; + padding-right: 7px; + } + +.menu { /* horizontal/vertical menu item text */ + color: #666666; + font-family:Leela, Tahoma, Verdana, Geneva, ms sans serif; + } + +a.menu { /* horizontal/vertical menu item link text */ + color: #666666; + font-family:Leela, Tahoma, Verdana, Geneva, ms sans serif; + font-size: 14px; + font-weight: bold; + text-decoration: none; + text-transform: none; + text-align: center; + padding-top: 1px; + width: 100%; + } + +a.menu:hover { /* horizontal/vertical menu item link text hover state */ + color: #000000; + } + +.menu_on-TL, .moTL, .mvoTL { /* horizontal/vertical menu highlighted item top right edge */ + background-image: url(../../Images/menuOverTL.gif); + background-repeat: no-repeat; + background-position: bottom right; + width: 6px; + height: 5px; + } +.menu_on-T, .moT, .mvoT { /* horizontal/vertical menu highlighted item top center edge */ + background-image: url(../../Images/menuOverT.gif); + background-repeat: repeat-x; + background-position: bottom center; + height: 5px; + } +.menu_on-TR, .moTR, .mvoTR { /* horizontal/vertical menu highlighted item top right edge */ + background-image: url(../../Images/menuOverTR.gif); + background-repeat: no-repeat; + background-position: bottom left; + width: 6px; + height: 5px; + } +.menu_on-L, .moL, .mvoL { /* horizontal/vertical menu highlighted item left middle edge */ + background-image: url(../../Images/menuOverL.gif); + background-repeat: repeat-y; + background-position: center right; + width: 6px; + height: 12px; + } +.menu_on, .moC, .mvoC { /* horizontal/vertical menu highlighted item center */ + background-image: url(../../Images/menuOverC.gif); + white-space: nowrap; + height: 12px; + width: 100%; + } +.menu_on-R, .moR, .mvoR { /* horizontal/vertical menu highlighted item right middle edge */ + background-image: url(../../Images/menuOverR.gif); + background-repeat: repeat-y; + background-position: center left; + width: 6px; + height: 12px; + } +.menu_on-BL, .moBL, .mvoBL { /* horizontal/vertical menu highlighted item bottom left edge */ + background-image: url(../../Images/menuOverBL.gif); + background-repeat: no-repeat; + background-position: top right; + width: 6px; + height: 5px; + } +.menu_on-B, .moB, .mvoB { /* horizontal/vertical menu highlighted item bottom center edge */ + background-image: url(../../Images/menuOverB.gif); + background-repeat: repeat-x; + background-position: top center; + height: 5px; + } +.menu_on-BR, .moBR, .mvoBR { /* horizontal/vertical menu highlighted item bottom right edge */ + background-image: url(../../Images/menuOverBR.gif); + background-repeat: no-repeat; + background-position: top left; + width: 6px; + height: 5px; + } + +.menu_on a, .moC a, .mvoC a { /* horizontal/vertical menu highlighted item link text */ + color: #000000; + font-family:Leela, Tahoma, Verdana, Geneva, ms sans serif; + font-size: 14px; + } + +.menu_off-TL, .mTL, .mvTL { /* horizontal/vertical menu item top right edge */ + background-image: url(../../Images/menuTL.gif); + background-repeat: no-repeat; + background-position: bottom right; + width: 6px; + height: 5px; + } +.menu_off-T, .mT, .mvT { /* horizontal/vertical menu item top center edge */ + background-image: url(../../Images/menuT.gif); + background-repeat: repeat-x; + background-position: bottom center; + height: 5px; + } +.menu_off-TR, .mTR, .mvTR { /* horizontal/vertical menu item top right edge */ + background-image: url(../../Images/menuTR.gif); + background-repeat: no-repeat; + background-position: bottom left; + width: 6px; + height: 5px; + } +.menu_off-L, .mL, .mvL { /* horizontal/vertical menu item left middle edge */ + background-image: url(../../Images/menuL.gif); + background-repeat: repeat-y; + background-position: center right; + width: 6px; + height: 12px; + } +.menu_off, .mC, .mvC { /* horizontal/vertical menu item center */ + background-image: url(../../Images/menuC.gif); + white-space: nowrap; + height: 12px; + width: 100%; + } +.menu_off-R, .mR, .mvR { /* horizontal/vertical menu item right middle edge */ + background-image: url(../../Images/menuR.gif); + background-repeat: repeat-y; + background-position: center left; + width: 6px; + height: 12px; + } +.menu_off-BL, .mBL, .mvBL { /* horizontal/vertical menu item bottom left edge */ + background-image: url(../../Images/menuBL.gif); + background-repeat: no-repeat; + background-position: top right; + width: 6px; + height: 5px; + } +.menu_off-B, .mB, .mvB { /* horizontal/vertical menu item bottom center edge */ + background-image: url(../../Images/menuB.gif); + background-repeat: repeat-x; + background-position: top center; + height: 5px; + } +.menu_off-BR, .mBR, .mvBR { /* horizontal/vertical menu item bottom right edge */ + background-image: url(../../Images/menuBR.gif); + background-repeat: no-repeat; + background-position: top left; + width: 6px; + height: 5px; + } + +.menuEdgeL, .mel { /* horizontal menu container left edge */ + } + +.menuEdgeR, .mer { /* horizontal menu container right edge */ + } + +.menu_bot_bg, .mbbg { /* horizontal menu bottom trim */ + } + + +/********************************************************************** + * Tab Control Styles * + **********************************************************************/ +.ajax__tab_xp { /* tab container alignment */ + margin-bottom: 20px; + margin-left: 0px; + margin-right: 0px; + margin-top: 0px; + padding: 0px; + text-align: left; + } + +.pContent .ajax__tab_xp .ajax__tab_body +{ + /* tab container */ + margin: 0px; + padding: 0px; +} + +.ajax__tab_xp .dialog_view, .ajax__tab_xp .dv { /* panel container within tab container */ + margin: 0px; + margin-bottom: 20px; + padding: 0px; + } + +.ajax__tab_xp .tre { /* data grid container within tab container */ + } + +.ajax__tab_xp .dBody { /* panel content container (excludes panel header) within tab container */ + border: 0px; + } + + +/********************************************************************** + * Page Background Styles * + **********************************************************************/ +.pageBackground, .pBack { /* page content container */ + background-color: #87996b; + margin: 0px; + } + + +/********************************************************************** + * AJAX Smooth Panel Update Styles * + **********************************************************************/ +.ajaxUpdatePanel { /* AJAX smooth panel update screen overlay */ + background-color: #000000; + filter: alpha(opacity=10); + height: 1000px; + -moz-opacity: 0.20; + opacity: 0.20; + padding: 20px; + position: absolute; + width: 100%; + } + + +/********************************************************************** + * Sign In Bar Styles * + **********************************************************************/ +.signInBar { /* sign in bar */ + background-image:url(../../Images/SignInBarBackground.gif); + background-repeat: repeat-x; + color: #ffffff; + font-family:Leela, Tahoma, Verdana, Geneva, ms sans serif; + font-size: 14px; + white-space: nowrap; + } + +.signInBarL { /* sign in bar left edge */ + background-image:url(../../Images/SignInBarL.gif); + background-repeat: no-repeat; + } + +.signInBar a, .signInBar input { /* sign in bar link text */ + color: #ffffff; + font-family:Leela, Tahoma, Verdana, Geneva, ms sans serif; + font-size: 14px; + font-weight: bold; + white-space: nowrap; + } + +.signInBarStatus { /* sign in bar status message text */ + color: #ffffff; + font-family:Leela, Tahoma, Verdana, Geneva, ms sans serif; + font-size: 14px; + text-align: right; + white-space: nowrap; + } + + +/********************************************************************** + * Panel Body Styles * + **********************************************************************/ +.dialog_body, .dBody { /* panel content container (excludes panel header) */ + background-color: #ffffff; + border-top: 1px #aaaaaa solid; + border-right: 1px #aaaaaa solid; + border-left: 1px #aaaaaa solid; + border-bottom: 1px #aaaaaa solid; + color: #666666; + font-family:Leela, Tahoma, Verdana, Geneva, ms sans serif; + font-size: 14px; + text-align: left; + } + +.dBody2 { /* alternate panel content container (excludes panel header) */ + color: #666666; + font-family:Leela, Tahoma, Verdana, Geneva, ms sans serif; + font-size: 14px; + text-align: left; + } + +.dBodyShowSelectRecordDivider { /* deprecated */ + background-color: #f6ffe8; + border-top: 1px solid #aaaaaa; + } + +.dialog_field_value, .dfv { /* panel field value text */ + color: #888888; + font-family:Leela, Tahoma, Verdana, Geneva, ms sans serif; + font-size: 14px; + padding: 1px 4px 1px 4px; + } + +.dialog_header, .dh { /* panel header container */ + background-repeat: repeat-x; + height:28px; + } + +.dialogHeaderBackground, .dhb { /* panel header */ + background-image: url(../../Images/dialogHeaderT.gif); + background-repeat: repeat-x; + } + +.dialog_header_text, .dht { /* panel header title text */ + background-image: url(../../Images/dialogHeaderT.gif); + color: #ffffff; + font-family:Leela, Tahoma, Verdana, Geneva, ms sans serif; + font-size: 14px; + font-weight: bold; + padding-bottom: 0px; + padding-top: 8px; + text-align: left; + text-transform: uppercase; + } + +.dialogHeaderTextRecord, .dhtr { /* record panel header title text */ + color: #ffffff; + font-family:Leela, Tahoma, Verdana, Geneva, ms sans serif; + font-size: 14px; + font-weight: bold; + padding-left:2px; + padding-top: 8px; + text-transform: uppercase; + } + +.dialogHeaderEdgeL, .dhel { /* panel header left edge */ + background-image:url(../../Images/dialogHeaderEdgeL.png); + background-repeat: repeat-y; + background-position: top left; + width: 27px; + height: 28px; + } + +.dialogHeaderEdgeR, .dher { /* panel header right edge */ + background-image:url(../../Images/dialogHeaderEdgeR.png); + background-repeat: repeat-y; + background-position: top right; + width: 27px; + height: 28px; + } + +.dialogHeaderIcon, .dhi { /* panel header add/edit/show icon container */ + background-image: url(../../Images/dialogHeaderT.gif); + background-repeat: repeat-x; + padding-top: 7px; + width: 0px; + } + +.dialogHeaderIconRecord, .dhir { /* record panel header add/edit/show icon container */ + padding-left: 10px; + padding-right: 10px; + padding-top: 4px; + } + +.dialogHeaderExpandCollapseIcon, .dheci { /* panel header expand/collapse icon container */ + background-image:url(../../Images/dialogHeaderT.gif); + width:20px; + height:14px; + padding-top: 8px; + } + +.dialogHeaderPrintEmailIcon, .dhpei { /* panel header print/email icon container */ + padding-right: 10px; + text-align: right; + vertical-align: middle; + width: 100%; + } + +.dialogHeaderTotalRecordCount, .dhtrc { /* panel header total record count container */ + background-image: url(../../Images/dialogHeaderT.gif); + text-align: right; + padding-top: 9px; + padding-left: 20px; + } + +.dialogHeaderTotalRecordCountText, .dhtrct { /* panel header total record count text */ + color: #ffffff; + font-family:Leela, Tahoma, Verdana, Geneva, ms sans serif; + font-size: 14px; + } + +.dialog_view, .dv { /* panel container (includes panel header) */ + margin-bottom: 20px; + margin-left: 0px; + margin-right: 0px; + margin-top: 0px; + padding: 0px; + text-align: left; + } + +.dv2 { /* nested panel container (includes panel header) */ + margin-bottom: 20px; + margin-left: 0px; + margin-right: 0px; + margin-top: 0px; + padding: 0px; + text-align: left; + width: 300px; + } + +.category, .c { /* category filter container */ + color: #666666; + padding: 5px; + } + +.category_area, .ca { /* category filter */ + font-family:Leela, Tahoma, Verdana, Geneva, ms sans serif; + font-size: 14px; + vertical-align: middle; + white-space: nowrap; + padding-bottom: 3px; + } + +.category_area A, .ca A { /* category filter link text */ + color: #888888; + font-family:Leela, Tahoma, Verdana, Geneva, ms sans serif; + font-size: 14px; + text-decoration: underline; + } + +.category_area A:hover, .ca A:hover { /* category filter link text hover state */ + color: #666666; + text-decoration: underline; + } + +.subcategory_label, .scl { /* category filter label */ + font-family:Leela, Tahoma, Verdana, Geneva, ms sans serif; + font-size: 14px; + font-weight: bold; + color: #666666; + padding-left: 4px; + white-space: nowrap; + vertical-align: middle; + } + +.subcategory SELECT, .sc SELECT { /* category filter drop-down list */ + font-family:Leela, Tahoma, Verdana, Geneva, ms sans serif; + font-size: 14px; + border-top: 1px #555555 solid; + border-left: 1px #555555 solid; + border-right: 1px #eeeeee solid; + border-bottom: 1px #eeeeee solid; + } + +.recordPanelButtonsAlignment, .rpbAlign { /* page buttons alignment */ + padding-bottom: 5px; + } + +.buttonPadding { /* page buttons padding */ + margin-right: 6px; + } + +.field_label, .fl { /* field label (on top) */ + color: #666666; + font-family:Leela, Tahoma, Verdana, Geneva, ms sans serif; + font-size: 14px; + font-weight: bold; + padding: 5px 4px 5px 4px; + text-align: left; + vertical-align: middle; + white-space: nowrap; + } + +.field_label_on_side, .fls { /* field lable on side */ + color: #666666; + font-family:Leela, Tahoma, Verdana, Geneva, ms sans serif; + font-size: 14px; + font-weight: bold; + padding: 5px 4px 5px 4px; + text-align: right; + vertical-align: middle; + white-space: nowrap; + } + +.field_value, .fv { /* field value */ + font-family:Leela, Tahoma, Verdana, Geneva, ms sans serif; + font-size: 14px; + padding: 0px; + } + +.field_input, .fi { /* input textbox */ + font-family:Leela, Tahoma, Verdana, Geneva, ms sans serif; + font-size: 14px; + background-color: #ffffff; + border-top: 1px #555555 solid; + border-left: 1px #555555 solid; + border-right: 1px #eeeeee solid; + border-bottom: 1px #eeeeee solid; + } + +.filter_value, .filv { /* filter value */ + font-family:Leela, Tahoma, Verdana, Geneva, ms sans serif; + font-size: 14px; + font-weight: bold; + padding: 2px; + } + +.filter_button_cell, .filbc { /* filter button container */ + padding-left: 9px; + vertical-align: bottom; + } + +.Filter_Input, .fili { /* filter drop-down list */ + border-bottom: 1px #eeeeee solid; + border-left: 1px #555555 solid; + border-right: 1px #eeeeee solid; + border-top: 1px #555555 solid; + font-family: Leela, Tahoma, Verdana, Geneva, ms sans serif; + font-size: 14px; + margin: 2px; + } + +.filter_area, .fila { /* filter label */ + color: #666666; + font-family:Leela, Tahoma, Verdana, Geneva, ms sans serif; + font-size: 14px; + text-align: right; + font-weight: bold; + padding: 4px 7px 4px 7px; + vertical-align: middle; + white-space: nowrap; + } + +.search_area, .sa { /* search area container */ + font-family:Leela, Tahoma, Verdana, Geneva, ms sans serif; + font-size: 14px; + padding-top: 5px; + padding-bottom: 2px; + } + +.search_label, .sl { /* search label */ + color: #003366; + font-family:Leela, Tahoma, Verdana, Geneva, ms sans serif; + font-size: 14px; + font-weight: normal; + vertical-align: middle; + white-space: nowrap; + padding: 5px; + } + +.Search_Input, .si { /* search textbox */ + background-color: #ffffff; + border-bottom: 1px #eeeeee solid; + border-left: 1px #555555 solid; + border-right: 1px #eeeeee solid; + border-top: 1px #555555 solid; + font-family:Leela, Tahoma, Verdana, Geneva, ms sans serif; + font-size: 14px; + margin: 2px; + } + +.rangeFilterText, .rft { /* range filter label */ + color: #bbbbbb; + font-family:Leela, Tahoma, Verdana, Geneva, ms sans serif; + font-size: 14px; + font-weight: normal; + padding-left: 6px; + padding-right: 6px; + text-decoration: none; + text-transform: none; + } + + +/********************************************************************** + * Pagination Styles * + **********************************************************************/ +.button_bar_cell, .prbbc { /* button bar button container */ + background-image:url(../../Images/paginationRowT.gif); + background-repeat: repeat-x; + padding-bottom: 3px; + vertical-align: bottom; + } + +.prbg { /* pagination row button container */ + background-image:url(../../Images/ButtonBarBackground.gif); + background-repeat: repeat-x; + color: #666666; + font-family:Leela, Tahoma, Verdana, Geneva, ms sans serif; + font-size: 14px; + font-weight: normal; + padding-left: 3px; + padding-right: 3px; + white-space: nowrap; + } + +.pagination_area, .pra { /* pagination row container */ + background-image:url(../../Images/paginationRowT.gif); + background-repeat: repeat-x; + color: #ffffff; + font-family:Leela, Tahoma, Verdana, Geneva, ms sans serif; + font-size: 14px; + padding-bottom: 3px; + vertical-align: bottom; + white-space: nowrap; + } + +.pagination_label, .prl { /* pagination row label */ + color: #ffffff; + font-family:Leela, Tahoma, Verdana, Geneva, ms sans serif; + font-size: 14px; + font-weight: normal; + vertical-align: middle; + white-space: nowrap; + padding: 2px; + } + +.pagination_value, .prv { /* pagination row value */ + color: #ffffff; + font-family:Leela, Tahoma, Verdana, Geneva, ms sans serif; + font-size: 14px; + font-weight: bold; + vertical-align: middle; + white-space: nowrap; + padding: 2px; + padding-right: 5px; + padding-left: 5px; + } + +.Pagination_Input, .pri { /* pagination row input textbox */ + font-family:Leela, Tahoma, Verdana, Geneva, ms sans serif; + font-size: 14px; + background-color: #ffffff; + border-bottom: 1px #eeeeee solid; + border-left: 1px #555555 solid; + border-right: 1px #eeeeee solid; + border-top: 1px #555555 solid; + } + +.pagination_row, .pr { /* button bar/pagination row container */ + font-weight: bold; + vertical-align: middle; + } + +.paginationRowEdgeL, .prel { /* button bar/pagination row left edge */ + background-image:url(../../Images/paginationRowEdgeL.gif); + background-repeat: no-repeat; + width: 20px; + height: 37px; + } + +.paginationRowEdgeR, .prer { /* button bar/pagination row right edge */ + background-image:url(../../Images/paginationRowEdgeR.gif); + background-repeat: no-repeat; + width: 20px; + height: 37px; + } + +.paginationButtonFirst, .prbf { /* pagination row first page button */ + background-image:url(../../Images/arrow_beg.gif); + background-repeat: no-repeat; + width: 31px; + height: 31px; + } + +.paginationButtonPrevious, .prbp { /* pagination row previous page button */ + background-image:url(../../Images/arrow_left.gif); + background-repeat: no-repeat; + width: 31px; + height: 31px; + } + +.paginationButtonNext, .prbn { /* pagination row next page button */ + background-image:url(../../Images/arrow_right.gif); + background-repeat: no-repeat; + width: 31px; + height: 31px; + } + +.paginationButtonLast, .prbl { /* pagination row last page button */ + background-image:url(../../Images/arrow_end.gif); + background-repeat: no-repeat; + width: 31px; + height: 31px; + } + + +/********************************************************************** + * Table Rows Styles * + **********************************************************************/ +.header_cell, .header_cell_scrolling, .thc, .thcs { + background-color: #a5bb83; + border-bottom: 1px #bf9d13 solid; + border-right: 1px #bf9d13 solid; + border-top: 1px #bf9d13 solid; + color: #ffffff; + font-family:Leela, Tahoma, Verdana, Geneva, ms sans serif; + font-size: 14px; + font-weight: bold; + padding: 3px; + vertical-align: top; + } + +.thcnb { /* column header container (above row buttons) */ + background-color: #a5bb83; + border-bottom: 1px #bf9d13 solid; + border-top: 1px #bf9d13 solid; + color: #ffffff; + font-family:Leela, Tahoma, Verdana, Geneva, ms sans serif; + font-size: 14px; + font-weight: bold; + padding: 3px; + vertical-align: top; + } + +.thcwb { /* column header container (above select checkbox) */ + background-color: #a5bb83; + border-bottom: 1px #bf9d13 solid; + border-left: 1px #bf9d13 solid; + border-right: 1px #bf9d13 solid; + border-top: 1px #bf9d13 solid; + color: #ffffff; + font-family:Leela, Tahoma, Verdana, Geneva, ms sans serif; + font-size: 14px; + font-weight: bold; + padding: 3px; + vertical-align: top; + } + +.header_cell_empty, .thce { /* column header container (when no column header text is present) */ + background-color: #a5bb83; + border-top: 1px #bf9d13 solid; + border-bottom: 1px #bf9d13 solid; + } + +.column_header, .tch { /* column header text */ + font-family:Leela, Tahoma, Verdana, Geneva, ms sans serif; + font-size: 14px; + font-weight: bold; + } + +.column_header A, .column_header_scrolling A, .tch A, .tchs A { /* column header link text */ + color: #eeeeee; + font-family:Leela, Tahoma, Verdana, Geneva, ms sans serif; + font-size: 14px; + text-decoration: none; + } + +.column_header A:hover, .column_header_scrolling A:hover, .tch A:hover, .tchs A:hover { /* column header link text hover state */ + color: #ffffff; + } + +.columnHeaderFilterPadding, .tchfilp { /* above column filter container */ + padding-top: 4px; + text-align: center; + } + +.columnHeaderFilterPadding Ai, .tchfilp A { + text-decoration: none; + } + +.columnHeaderFilterPadding A:hover, .tchfilp A:hover { /* above column filter link text hover state */ + text-decoration: none; + } + +.icon_cell, .alt_icon_cell, .tic, .taic { /* deprecated: data grid row button container */ + background-color: #ffffff; + border-bottom: 1px #bf9d13 solid; + border-right: 1px #bf9d13 solid; + color: #444444; + padding-top: 3px; + vertical-align: top; + width: 16px; + } + +.icon_cell_highlighted, .alt_icon_cell_highlighted, .tich, .taich { /* deprecated: data grid row button container highlighted state */ + background-color: #87996b; + border-bottom: 1px #bf9d13 solid; + border-right: 1px #bf9d13 solid; + color: #444444; + padding-top: 3px; + vertical-align: top; + width: 16px; + } + +.icon_cell_selected, .tics { /* deprecated: data grid row button container selected state */ + background-color: #cbe5a1; + border-bottom: 1px #bf9d13 solid; + border-right: 1px #bf9d13 solid; + color: #444444; + padding-top: 3px; + vertical-align: top; + width: 16px; + } + +.ticnb { /* data grid row button container */ + background-color: #ffffff; + border-bottom: 1px #bf9d13 solid; + color: #444444; + padding-left: 1px; + padding-top: 5px; + vertical-align: top; + width: 16px; + } + +.tichnb { /* data grid row button container highlighted state */ + background-color: #87996b; + border-bottom: 1px #bf9d13 solid; + color: #444444; + padding-left: 1px; + padding-top: 5px; + vertical-align: top; + width: 16px; + } + +.ticsnb { /* data grid row button container selected state */ + background-color: #cbe5a1; + border-bottom: 1px #bf9d13 solid; + color: #444444; + padding-left: 1px; + padding-top: 5px; + vertical-align: top; + width: 16px; + } + +.ticwb { /* data grid select checkbox container */ + background-color: #ffffff; + border-bottom: 1px #bf9d13 solid; + border-left: 1px #bf9d13 solid; + border-right: 1px #bf9d13 solid; + color: #444444; + padding-top: 3px; + vertical-align: top; + width: 16px; + } + +.tichwb { /* data grid select checkbox container highlighted state */ + background-color: #87996b; + border-bottom: 1px #bf9d13 solid; + border-left: 1px #bf9d13 solid; + border-right: 1px #bf9d13 solid; + color: #444444; + padding-top: 3px; + vertical-align: top; + width: 16px; + } + +.ticswb { /* data grid select checkbox container selected state */ + background-color: #cbe5a1; + border-bottom: 1px #bf9d13 solid; + border-left: 1px #bf9d13 solid; + border-right: 1px #bf9d13 solid; + color: #444444; + padding-top: 3px; + vertical-align: top; + width: 16px; + } + +.tichb { /* data grid right-most row button container (when no select checkbox is present) */ + background-color: #ffffff; + border-bottom: 1px #bf9d13 solid; + border-right: 1px #bf9d13 solid; + color: #444444; + padding-top: 3px; + vertical-align: top; + width: 16px; + } + +.tichhb { /* data grid right-most row button container (when no select checkbox is present) highlighted state */ + background-color: #87996b; + border-bottom: 1px #bf9d13 solid; + border-right: 1px #bf9d13 solid; + color: #444444; + padding-top: 3px; + vertical-align: top; + width: 16px; + } + +.ticshb { /* data grid right-most row button container (when no select checkbox is present) selected state */ + background-color: #cbe5a1; + border-bottom: 1px #bf9d13 solid; + border-right: 1px #bf9d13 solid; + color: #444444; + padding-top: 3px; + vertical-align: top; + width: 16px; + } + +.icon_cell_empty, .tice { /* data grid row button container (when no row button is present) */ + background-color: #ffffff; + border-bottom: 1px #bf9d13 solid; + width: 0px; + } + +.icon_cell_highlighted_empty, .tiche { /* data grid row button container (when no row button is present) highlighted state */ + background-color: #87996b; + border-bottom: 1px #bf9d13 solid; + width: 0px; + } + +.icon_cell_selected_empty, .ticse { /* data grid row button container (when no row button is present) selected state */ + background-color: #cbe5a1; + border-bottom: 1px #bf9d13 solid; + width: 0px; + } + +.table_cell, .alt_table_cell, .ttc, .tatc { /* data grid data container */ + padding: 5px; + color: #666666; + vertical-align: top; + font-family:Leela, Tahoma, Verdana, Geneva, ms sans serif; + font-size: 14px; + text-align: left; + border-right: 1px #bf9d13 solid; + border-bottom: 1px #bf9d13 solid; + background-color: #ffffff; + } + +.table_cell_highlighted, .alt_table_cell_highlighted, .ttch, .tatch { /* data grid data container highlighted state */ + padding: 5px; + color: #ffffff; + vertical-align: top; + font-family:Leela, Tahoma, Verdana, Geneva, ms sans serif; + font-size: 14px; + text-align: left; + border-right: 1px #bf9d13 solid; + border-bottom: 1px #bf9d13 solid; + background-color: #87996b; + } + +.table_cell_selected, .ttcs { /* data grid data container selected state */ + padding: 5px; + color: #666666; + vertical-align: top; + font-family:Leela, Tahoma, Verdana, Geneva, ms sans serif; + font-size: 14px; + text-align: left; + border-right: 1px #bf9d13 solid; + border-bottom: 1px #bf9d13 solid; + background-color: #cbe5a1; + } + +.ttc .thc a, .ttcs .ajax__tab_xp .thc a, .ttch .ajax__tab_xp .thc a { /* nested column header link text */ + color: #eeeeee; + } + +.ttc .thc a:hover { /* nested column header link text hover state */ + color: #ffffff; + } + +.ttc a, .ttch .ajax__tab_xp a, .ttch .ajax__tab_xp, .tatc a, .ttcs a, .dfv a, .dialog_field_value a { /* nested data link text */ + color: #666666; + } + +.ttc a:hover, .tatc a:hover, .ttcs a:hover, .dfv a:hover, .dialog_field_value a:hover { /* nested data link text hover state */ + color: #222222; + } + +.ttch a, .tatch a { + color: #dddddd; + } + +.ttch a:hover, .tatch a:hover { + color: #ffffff; + } + +.ttc .dv, .ttch .dv, .ttcs .dv { /* panel container nested within data grid */ + margin: 0px; + padding: 0px; + } + +.ttc .ajax__tab_xp, .ttch .ajax__tab_xp, .ttcs .ajax__tab_xp { /* tab container nested within data grid */ + margin: 0px; + padding: 0px; + } + +.totals_cell, .tpttc { /* data grid totals container */ + padding: 5px; + color: #666666; + vertical-align: top; + font-family:Leela, Tahoma, Verdana, Geneva, ms sans serif; + font-size: 14px; + text-align: left; + border-right: 1px #bf9d13 solid; + border-bottom: 1px #bf9d13 solid; + background-color: #ffffff; + width: 48px; + } + +.totals_cell_value, .tpttcv { /* data grid totals text */ + padding: 5px; + color: #666666; + vertical-align: top; + font-family:Leela, Tahoma, Verdana, Geneva, ms sans serif; + font-size: 14px; + text-align: right; + background-color: #ffffff; + } + +.page_total_label, .tptl { /* data grid page totals label */ + font-family:Leela, Tahoma, Verdana, Geneva, ms sans serif; + font-size: 14px; + font-weight: normal; + color: #666666; + padding-left: 20px; + white-space: nowrap; + vertical-align: middle; + } + +.page_total_value, .tptv { /* data grid page totals text */ + font-family:Leela, Tahoma, Verdana, Geneva, ms sans serif; + font-size: 14px; + font-weight: normal; + padding: 3px; + } + +.grand_total_label, .tgtl { /* data grid grand total label */ + font-family:Leela, Tahoma, Verdana, Geneva, ms sans serif; + font-size: 14px; + font-weight: normal; + color: #666666; + padding-left: 20px; + white-space: nowrap; + vertical-align: middle; + } + +.grand_total_value, .tgtv { /* data grid grand total text */ + font-family:Leela, Tahoma, Verdana, Geneva, ms sans serif; + font-size: 14px; + font-weight: normal; + padding: 3px; + } + +.tableRowsEdge, .tre { /* data grid container */ + border-left: 1px #bf9d13 solid; + background-color: #bf9d13; + } + +/********************************************************************** + * Scrolling Table Styles * + **********************************************************************/ +div.tableContainer { /* scrolling table container */ + clear: both; + height: 285px; /* defines scrolling region height */ + overflow: auto; /* enables scroll bar */ + } + +div.tableContainer table { /* data grid container of scrolling table */ + width: 97%; /* defines data region width (provide room for scroll bar) */ + } + +thead.fixedHeader tr { /* fixed column header of data grid */ + background-color: #87996b; /* obscures data behind headers */ + position: relative; /* fixes headers in place */ + } + +.scrollContent { /* data grid (excludes fixed column header) within scrolling table */ + display: block; + } + +thead.fixedHeader td.button-white { /* theme button container within scrolling table column header */ + white-space: nowrap; + width: 0%; + } + +thead.fixedHeader table { /* deprecated */ + width: 0%; + } + + +/********************************************************************** + * Auto Type Ahead (Interactive Search) Styles * + **********************************************************************/ +.autotypeahead_completionListElement { /* textbox value */ + background-color: #ffffff; + border-bottom: 1px #555555 solid; + border-left: 1px #555555 solid; + border-right: 1px #555555 solid; + border-top: 1px #555555 solid; + height: 90px; + list-style-type: none; + margin: 0px; + overflow: auto; + padding: 0px; + visibility: hidden; + } + +.autotypeahead_highlightedListItem { /* highlighted list item */ + background-color: #87996b; + color: #ffffff; + padding-bottom: 1px; + } + +.autotypeahead_listItem { /* list item */ + padding-bottom: 1px; + } + + +/********************************************************************** + * AJAX Calendar Styles * + **********************************************************************/ +.MyCalendar .ajax__calendar_container { /* AJAX calendar container */ + background-color: #ffffff; + border: 1px solid #636563; + color: #000000; + z-index: 20; + } + +.MyCalendar .ajax__calendar_day { /* AJAX calendar non-current day container */ + border: 1px solid #ffffff; + } + +.MyCalendar .ajax__calendar_other .ajax__calendar_day, +.MyCalendar .ajax__calendar_other .ajax__calendar_year { /* AJAX calendar non-current month day/year container */ + border: 1px solid #ffffff; + color: #636563; + } + +.MyCalendar .ajax__calendar_hover .ajax__calendar_day, +.MyCalendar .ajax__calendar_hover .ajax__calendar_month, +.MyCalendar .ajax__calendar_hover .ajax__calendar_year { /* AJAX calendar day/month/year hover state */ + background-color: #effbff; + border: 1px solid #def3ff; + color: #0065ce; + } + +.MyCalendar .ajax__calendar_active .ajax__calendar_day, +.MyCalendar .ajax__calendar_active .ajax__calendar_month, +.MyCalendar .ajax__calendar_active .ajax__calendar_year { /* AJAX calendar current day/month/year container */ + background-color: #effbff; + border: 1px solid #0065ce; + color: #0065ce; + } + + +/********************************************************************** + * Info Panel Styles * + **********************************************************************/ +.panelInformationDisplayWithImage { /* information panel (with image) container */ + border-top: 1px #cccccc solid; + border-left: 1px #cccccc solid; + border-right: 1px #cccccc solid; + border-bottom: 1px #cccccc solid; + } + +.panelInformationDisplayWithImage_ImageArea { /* information panel (with image) image container */ + padding: 10px 10px 10px 16px; + } + +.panelInformationDisplayWithImage_InfoArea { /* information panel (with image) info container */ + font-family:Leela, Tahoma, Verdana, Geneva, ms sans serif; + font-size: 14px; + vertical-align: middle; + } + +.panelInformationDisplayWithImage_InfoTitle { /* information panel (with image) info title text */ + font-family:Leela, Tahoma, Verdana, Geneva, ms sans serif; + font-size: 14px; + font-weight: bold; + color: #777777; + white-space: nowrap; + } + +.panelInformationDisplayWithImage_InfoDetails { /* information panel (with image) info details text */ + font-family:Leela, Tahoma, Verdana, Geneva, ms sans serif; + font-size: 14px; + padding-right: 16px; + white-space: nowrap; + } + +.panelInformationDisplay { /* information panel container */ + border-top: 1px #cccccc solid; + border-left: 1px #cccccc solid; + border-right: 1px #cccccc solid; + border-bottom: 1px #cccccc solid; + } + +.panelInformationDisplay_InfoArea { /* information panel info container */ + padding: 10px; + } + +.panelInformationDisplay_InfoTitle { /* information panel info title text */ + font-family:Leela, Tahoma, Verdana, Geneva, ms sans serif; + font-size: 14px; + font-weight: bold; + color: #777777; + white-space: nowrap; + text-align: center; + } + +.panelInformationDisplay_InfoDetails { /* information panel info details text */ + font-family:Leela, Tahoma, Verdana, Geneva, ms sans serif; + font-size: 14px; + white-space: nowrap; + text-align: center; + } + + +/********************************************************************** + * Configuration/Error Page Styles * + **********************************************************************/ +.configureErrorPagesText { /* configure/error page body text */ + font-family:Leela, Tahoma, Verdana, Geneva, ms sans serif; + font-size: 14px; + color: #ffffff; + } + + +/********************************************************************** + * Section 508 Compliance Styles * + **********************************************************************/ +.skipNavigationLinks { /* skip navigation links container*/ + font-family:Leela, Tahoma, Verdana, Geneva, ms sans serif; + font-size: 14px; + color: #ffffff; + } + + +/********************************************************************** + * Detail Rollover Popup Styles * + **********************************************************************/ +.detailRolloverPopup { /* detail rollover popup container */ + position: absolute; + visibility: visible; + z-index: 2; + } + +.detailRolloverTitle { /* detail rollover popup title */ + color: #ffffff; + font-family:Leela, Tahoma, Verdana, Geneva, ms sans serif; + text-transform: uppercase; + font-weight: bold; + font-size: 14px; + padding-left:2px; + padding-top: 8px; + padding-bottom: 0px; + width: 100%; + } + +.detailRolloverPopupCloseButtonAlignment { /* detail rollover popup close button container */ + padding-top: 27px; + } + +.detailRolloverTL { /* detail rollover popup top left edge */ + background-image:url(../../Images/detailRolloverTL.png); + background-position: bottom right; + background-repeat: no-repeat; + height: 57px; + width: 65px; + } + +.detailRolloverT { /* detail rollover popup top center edge */ + background-image:url(../../Images/detailRolloverT.png); + background-position: bottom center; + background-repeat: repeat-x; + height: 57px; + } + +.detailRolloverTR { /* detail rollover popup top right edge */ + background-image:url(../../Images/detailRolloverTR.png); + background-position: bottom left; + background-repeat: no-repeat; + height: 57px; + width: 65px; + } + +.detailRolloverL { /* detail rollover popup left middle edge */ + background-image:url(../../Images/detailRolloverL.png); + background-position: center right; + background-repeat: repeat-y; + width: 65px; + } + +.detailRolloverC { /* detail rollover popup center */ + background-image:url(../../Images/detailRolloverC.png); + font-family:Leela, Tahoma, Verdana, Geneva, ms sans serif; + font-size: 14px; + } + +.detailRolloverR { /* detail rollover popup right middle edge */ + background-image:url(../../Images/detailRolloverR.png); + background-position: center left; + background-repeat: repeat-y; + width: 65px; + } + +.detailRolloverBL { /* detail rollover popup bottom left edge */ + background-image:url(../../Images/detailRolloverBL.png); + background-position: top right; + background-repeat: no-repeat; + height: 29px; + width: 65px; + } + +.detailRolloverB { /* detail rollover popup bottom center edge */ + background-image:url(../../Images/detailRolloverB.png); + background-position: top center; + background-repeat: repeat-x; + height: 29px; + } + +.detailRolloverBR { /* detail rollover popup bottom right edge */ + background-image:url(../../Images/detailRolloverBR.png); + background-position: top left; + background-repeat: no-repeat; + height: 29px; + width: 65px; + } + + +/********************************************************************** + ********************************************************************** + * Migration-Only Styles * + * * + * The following styles have been deprecated in the latest release, * + * but may still be needed in migrated applications. * + ********************************************************************** + **********************************************************************/ + +/********************************************************************** + * Page Center Styles * + **********************************************************************/ +.pcTable { /* contents of page container */ + } +.pcTL { /* page container top left edge */ + } +.pcT { /* page container top center edge (header container) */ + } +.pcTR { /* page container top right edge */ + } +.pcL { /* page container left middle edge (vertical menu container) */ + padding-left: 1px; + padding-top: 0px; + vertical-align: top; + width: 1px; + } +.pcC { /* page container center (contents of page container) */ + vertical-align: top; + width: 100%; + } +.pcR { /* page container right middle edge */ + } +.pcBL { /* page container bottom left edge */ + } +.pcB { /* page container bottom center edge (footer container) */ + width: 1000px; + } +.pcBR { /* page container bottom right edge */ + } + + +/********************************************************************** + * Page Background Styles * + **********************************************************************/ +.pageBorderTL, .pbTL { /* page border top left edge */ + background-color: #87996b; + } +.pageBorderT, .pbT { /* page border top center edge */ + background-color: #87996b; + } +.pageBorderTR, .pbTR { /* page border top right edge */ + background-color: #87996b; + } +.pageBorderC, .pbC { /* page border center */ + background-color: #87996b; + vertical-align: top; + } +.pageBorderR, .pbR { /* page border right middle edge */ + background-color: #87996b; + } +.pageBorderBL, .pbBL { /* page border bottom left edge */ + background-color: #87996b; + } +.pageBorderB, .pbB { /* page border bottom center edge */ + background-color: #87996b; + } +.pageBorderBR, .pbBR { /* page border bottom right edge */ + background-color: #87996b; + } + +.page_yellow, .pContent { /* page content container */ + color: #003366; + height: 30px; + text-align: left; + } + +.pageAlignment, .pAlign { /* page content container alignment */ + vertical-align: top; + } + +.borderTable, .pbTable { /* page content container */ + } + +.divider { /* deprecated */ + } + +.footer { /* footer content container */ + color: #eeeeee; + font-family:Leela, Tahoma, Verdana, Geneva, ms sans serif; + font-size: 14px; + padding-top: 6px; + } + +.logoBG { /* logo image container */ + } + + +/********************************************************************** + * Date Selector Styles * + **********************************************************************/ +.dsTodayDay { /* current day container */ + background-color: #cbe5a1; + } + +.dsDayHeader { /* day of week header container */ + color: #666666; + background-color: #cbe5a1; + font-size: 14px; + padding: 6px; + } + +.dsSelectedDay { /* selected day container */ + padding: 6px; + } + +.dsTitle { /* title */ + color: #666666; + background-color: #87996b; + font-weight: bold; + } + +.dsWeekendDay { /* weekend day container */ + background-color: #eeeeee; + padding: 6px; + } + +.dsOtherMonthDay { /* non-current month/day container */ + background-color: #eeeeee; + padding: 6px; + } + +.dsDay a, .dsTodayDay a, .dsSelectedDay a, .dsWeekendDay a, .dsOtherMonthDay a { /* day link text */ + color: #666666; + font-family:Leela, Tahoma, Verdana, Geneva, ms sans serif; + font-size: 14px; + } + + +/********************************************************************** + * Third Party Controls Styles * + **********************************************************************/ +.thirdparty_button { /* ??? */ + font-family:Leela, Tahoma, Verdana, Geneva, ms sans serif; + background-color: #B49412; + color: #eeeeee; + font-size: 14px; + font-weight: bold; + text-decoration: none; + text-transform: none; + text-align: center; + vertical-align:middle; + border:none; + } + +.Tmenu_off { /* ??? */ + color: #eeeeee; + font-family:Leela, Tahoma, Verdana, Geneva, ms sans serif; + font-size: 14px; + font-weight: bold; + text-decoration: none; + text-align: center; + border: none; + background-color: #87996B; + } + +.Tmenu_on { /* ??? */ + color: #ffffff; + font-weight: bold; + font-family:Leela, Tahoma, Verdana, Geneva, ms sans serif; + font-size: 14px; + text-decoration: none; + text-align: center; + border: none; + background-color: #D0B856; + } + + +/********************************************************************** + * JavaScript Date Selector Styles * + **********************************************************************/ +.dpTable { /* date selector container */ + background-color: #87996b; + border: 1px solid #aaaaaa; + color: #333333; + } + +.dpTD { /* date selector non-current-month day container */ + background-color: #ffffff; + border: 1px #e5dcb8 solid; + padding-top: 5px; + padding-right: 8px; + padding-bottom: 5px; + padding-left: 8px; + text-align: center; + vertical-align: middle; + } + +.dpDayHighlightTD { /* date selector current day container */ + background-color: #c3a423; + border: 1px #bf9d13 solid; + font-weight: bold; + padding-top: 5px; + padding-right: 8px; + padding-bottom: 5px; + padding-left: 8px; + text-align: center; + vertical-align: middle; + } + +.dpTDHover { /* date selector day container hover state */ + background-color: #c3a423; + border: 1px #e5dcb8 solid; + cursor: pointer; + font-weight: bold; + padding-top: 5px; + padding-right: 8px; + padding-bottom: 5px; + padding-left: 8px; + text-align: center; + vertical-align: middle; + } + +.dpDayTD { /* date selector day container */ + background-color: #87996b; + border-bottom: 1px #bf9d13 solid; + color: #ffffff; + padding-top: 2px; + padding-right: 8px; + padding-bottom: 2px; + padding-left: 8px; + text-align: center; + vertical-align: middle; + } + +.dpTitleText { /* date selector title text */ + color: #333333; + font-size: 14px; + font-weight: bold; + padding-top: 3px; + text-align: center; + vertical-align: middle; + } + +.dpDiv { /* deprecated */ + } + +.dpTR { /* date selector week container */ + } + +.dpTitleTR { /* date selector title text container */ + } + +.dpDayTR { /* date selector day container */ + } + + +/********************************************************************** + * Detail Rollover Popup Styles (for non-PNG-supporting IE6) * + **********************************************************************/ +/* +.detailRolloverTL_noPNG { + height: 57px; + width: 65px; + filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod=scale, src='../../Images/detailRolloverTL.png'); + } + +.detailRolloverT_noPNG { + height: 57px; + filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod=scale, src='../../Images/detailRolloverT.png'); + } + +.detailRolloverTR_noPNG { + height: 57px; + width: 65px; + filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod=scale, src='../../Images/detailRolloverTR.png'); + } + +.detailRolloverL_noPNG { + width: 65px; + filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod=scale, src='../../Images/detailRolloverL.png'); + } + +.detailRolloverR_noPNG { + width: 65px; + filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod=scale, src='../../Images/detailRolloverR.png'); + } + +.detailRolloverBL_noPNG { + height: 29px; + width: 65px; + filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod=scale, src='../../Images/detailRolloverBL.png'); + } + +.detailRolloverB_noPNG { + height: 29px; + filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod=scale, src='../../Images/detailRolloverB.png'); + } + +.detailRolloverBR_noPNG { + height: 29px; + width: 65px; + filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod=scale, src='../../Images/detailRolloverBR.png'); + } +*/ + diff --git a/App_Themes/Denali/SarunIndiannaJone.eot b/App_Themes/Denali/SarunIndiannaJone.eot new file mode 100644 index 0000000..cbf44cc Binary files /dev/null and b/App_Themes/Denali/SarunIndiannaJone.eot differ diff --git a/App_Themes/Denali/Styles.css b/App_Themes/Denali/Styles.css new file mode 100644 index 0000000..ed8c6ab --- /dev/null +++ b/App_Themes/Denali/Styles.css @@ -0,0 +1,278 @@ +/********************************************************************** + * Styles.css * + * * + * This file is initially empty and you can add any additional styles * + * or modify any of the styles defined in BaseStyles.css * + * This file will never be overwritten. * + * * + * For example, if you want to override just the top padding for a * + * menu, you can simply add the following lines: * + * * + * .menus { * + * padding-top: 20px; * + * } * + * * + * This will keep all the other styles of the "menus" style as-is, * + * but modify the top padding to be 20px. * + * * + * You can also, add a new style by just specifying it. * + * * + * .menus { * + * padding-top: 20px; * + * text-align: center; * + * } * + * * + * In the above case, we added the text-align style. This style was * + * not specified in the original declaration of the menus style. * + * * + **********************************************************************/ +@font-face { + font-family: "Pudgrong"; + src: url('_pudgron.eot'); + /*src: local('JS Pudgrong Normal'), local('JSPudgrong-Normal'), url('_pudgron.ttf') format('truetype');*/ +} + @font-face { + font-family: "Rukdeaw"; + src: url("can_Rukdeaw01.eot"); +} + @font-face { + font-family: "wansika"; + src: url("_WANSIKA.eot"); +} + @font-face { + font-family: "Leela"; + src: url("leelawad.eot"); +} + @font-face { + font-family: "THSarabun"; + src: url("THSarabun.eot"); +} + + + + + + + + + + + + + + + + + +/********************************************************************** + * Classic Menu Styles * + **********************************************************************/ +.menus { /* horizontal menu container */ + padding-bottom: 6px; + padding-top: 6px; + } + +.menusV { /* vertical menu container */ + padding-left: 5px; + padding-right: 7px; + } + +.menu { /* horizontal/vertical menu item text */ + color: #666666; + font-family:Leela, Tahoma, Verdana, Geneva, ms sans serif; + } + +a.menu { /* horizontal/vertical menu item link text */ + color: #666666; + font-family:Leela, Tahoma, Verdana, Geneva, ms sans serif; + font-size: 14px; + font-weight: bold; + text-decoration: none; + text-transform: none; + text-align: center; + padding-top: 1px; + width: 100%; + } + +a.menu:hover { /* horizontal/vertical menu item link text hover state */ + color: #000000; + } + +.menu_on-TL, .moTL, .mvoTL { /* horizontal/vertical menu highlighted item top right edge */ + background-image: url(../../Images/menuOverTL.gif); + background-repeat: no-repeat; + background-position: bottom right; + width: 6px; + height: 5px; + } +.menu_on-T, .moT, .mvoT { /* horizontal/vertical menu highlighted item top center edge */ + background-image: url(../../Images/menuOverT.gif); + background-repeat: repeat-x; + background-position: bottom center; + height: 5px; + } +.menu_on-TR, .moTR, .mvoTR { /* horizontal/vertical menu highlighted item top right edge */ + background-image: url(../../Images/menuOverTR.gif); + background-repeat: no-repeat; + background-position: bottom left; + width: 6px; + height: 5px; + } +.menu_on-L, .moL, .mvoL { /* horizontal/vertical menu highlighted item left middle edge */ + background-image: url(../../Images/menuOverL.gif); + background-repeat: repeat-y; + background-position: center right; + width: 6px; + height: 12px; + } +.menu_on, .moC, .mvoC { /* horizontal/vertical menu highlighted item center */ + background-image: url(../../Images/menuOverC.gif); + white-space: nowrap; + height: 12px; + width: 100%; + } +.menu_on-R, .moR, .mvoR { /* horizontal/vertical menu highlighted item right middle edge */ + background-image: url(../../Images/menuOverR.gif); + background-repeat: repeat-y; + background-position: center left; + width: 6px; + height: 12px; + } +.menu_on-BL, .moBL, .mvoBL { /* horizontal/vertical menu highlighted item bottom left edge */ + background-image: url(../../Images/menuOverBL.gif); + background-repeat: no-repeat; + background-position: top right; + width: 6px; + height: 5px; + } +.menu_on-B, .moB, .mvoB { /* horizontal/vertical menu highlighted item bottom center edge */ + background-image: url(../../Images/menuOverB.gif); + background-repeat: repeat-x; + background-position: top center; + height: 5px; + } +.menu_on-BR, .moBR, .mvoBR { /* horizontal/vertical menu highlighted item bottom right edge */ + background-image: url(../../Images/menuOverBR.gif); + background-repeat: no-repeat; + background-position: top left; + width: 6px; + height: 5px; + } + +.menu_on a, .moC a, .mvoC a { /* horizontal/vertical menu highlighted item link text */ + color: #000000; + font-family:Leela, Tahoma, Verdana, Geneva, ms sans serif; + font-size: 14px; + } + +.menu_off-TL, .mTL, .mvTL { /* horizontal/vertical menu item top right edge */ + background-image: url(../../Images/menuTL.gif); + background-repeat: no-repeat; + background-position: bottom right; + width: 6px; + height: 5px; + } +.menu_off-T, .mT, .mvT { /* horizontal/vertical menu item top center edge */ + background-image: url(../../Images/menuT.gif); + background-repeat: repeat-x; + background-position: bottom center; + height: 5px; + } +.menu_off-TR, .mTR, .mvTR { /* horizontal/vertical menu item top right edge */ + background-image: url(../../Images/menuTR.gif); + background-repeat: no-repeat; + background-position: bottom left; + width: 6px; + height: 5px; + } +.menu_off-L, .mL, .mvL { /* horizontal/vertical menu item left middle edge */ + background-image: url(../../Images/menuL.gif); + background-repeat: repeat-y; + background-position: center right; + width: 6px; + height: 12px; + } +.menu_off, .mC, .mvC { /* horizontal/vertical menu item center */ + background-image: url(../../Images/menuC.gif); + white-space: nowrap; + height: 12px; + width: 100%; + } +.menu_off-R, .mR, .mvR { /* horizontal/vertical menu item right middle edge */ + background-image: url(../../Images/menuR.gif); + background-repeat: repeat-y; + background-position: center left; + width: 6px; + height: 12px; + } +.menu_off-BL, .mBL, .mvBL { /* horizontal/vertical menu item bottom left edge */ + background-image: url(../../Images/menuBL.gif); + background-repeat: no-repeat; + background-position: top right; + width: 6px; + height: 5px; + } +.menu_off-B, .mB, .mvB { /* horizontal/vertical menu item bottom center edge */ + background-image: url(../../Images/menuB.gif); + background-repeat: repeat-x; + background-position: top center; + height: 5px; + } +.menu_off-BR, .mBR, .mvBR { /* horizontal/vertical menu item bottom right edge */ + background-image: url(../../Images/menuBR.gif); + background-repeat: no-repeat; + background-position: top left; + width: 6px; + height: 5px; + } + +.menuEdgeL, .mel { /* horizontal menu container left edge */ + } + +.menuEdgeR, .mer { /* horizontal menu container right edge */ + } + +.menu_bot_bg, .mbbg { /* horizontal menu bottom trim */ + } + + +/********************************************************************** + * Tab Control Styles * + **********************************************************************/ +.ajax__tab_xp { /* tab container alignment */ + margin-bottom: 20px; + margin-left: 0px; + margin-right: 0px; + margin-top: 0px; + padding: 0px; + text-align: left; + + } + +.pContent .ajax__tab_xp .ajax__tab_body +{ + /* tab container */ + margin: 0px; + padding: 0px; +} + +.ajax__tab_xp .dialog_view, .ajax__tab_xp .dv { /* panel container within tab container */ + margin: 0px; + margin-bottom: 20px; + padding: 0px; + } + +.ajax__tab_xp .tre { /* data grid container within tab container */ + } + +.ajax__tab_xp .dBody { /* panel content container (excludes panel header) within tab container */ + border: 0px; + } + +/*-----------------------------------------*/ +.ajax__tab_tab +{ + font-family: Leela; + font-size: 14px; + color: #333333; +} diff --git a/App_Themes/Denali/THSarabun.eot b/App_Themes/Denali/THSarabun.eot new file mode 100644 index 0000000..c337eec Binary files /dev/null and b/App_Themes/Denali/THSarabun.eot differ diff --git a/App_Themes/Denali/_WANSIKA.eot b/App_Themes/Denali/_WANSIKA.eot new file mode 100644 index 0000000..5b2ca87 Binary files /dev/null and b/App_Themes/Denali/_WANSIKA.eot differ diff --git a/App_Themes/Denali/_pudgron.eot b/App_Themes/Denali/_pudgron.eot new file mode 100644 index 0000000..63bec6b Binary files /dev/null and b/App_Themes/Denali/_pudgron.eot differ diff --git a/App_Themes/Denali/can_Rukdeaw01.eot b/App_Themes/Denali/can_Rukdeaw01.eot new file mode 100644 index 0000000..dc29070 Binary files /dev/null and b/App_Themes/Denali/can_Rukdeaw01.eot differ diff --git a/App_Themes/Denali/leelawad.eot b/App_Themes/Denali/leelawad.eot new file mode 100644 index 0000000..05a3365 Binary files /dev/null and b/App_Themes/Denali/leelawad.eot differ diff --git a/App_Themes/Denali/leelawdb.eot b/App_Themes/Denali/leelawdb.eot new file mode 100644 index 0000000..221fb2f Binary files /dev/null and b/App_Themes/Denali/leelawdb.eot differ diff --git a/ApplicationWebForm.js b/ApplicationWebForm.js new file mode 100644 index 0000000..83d4334 --- /dev/null +++ b/ApplicationWebForm.js @@ -0,0 +1,5735 @@ +var submitcount = 0; + +function checkDisable(node) +{ + return ((node != null) && (node.disabled != true)); +} + +/* + * Sets the focus on the first element that should "reasonably" receive it + */ +function Fev_FocusOnFirstFocusableFormElement() +{ + var lFirstFocusableFormElementID; + for (i = 0; i < document.forms.length; i++) + { + lFirstFocusableFormElementID = Fev_FocusOnDefaultElement(document.forms[i]); + if (lFirstFocusableFormElementID != false) + { + return (lFirstFocusableFormElementID); + } + } + + return(null); +} + +/* + * Sets the focus on the first element that should "reasonably" receive it. Called from SetFocus, while previous function + * called by migrated application + */ +function Fev_FocusOnFirstFocusableFormElement_FromSetFocus() +{ + var lFirstFocusableFormElementID; + if (document != null && document.forms != null && document.forms.length > 0) { + for (i = 0; i < document.forms.length; i++) { + lFirstFocusableFormElementID = Fev_FocusOnDefaultElement_FromSetFocus(document.forms[i]); + if (lFirstFocusableFormElementID != false) { + return (lFirstFocusableFormElementID); + } + } + } + return(null); +} + + +/* + * verifies if the element inside content area, not in the header + * IMPORTANT: if you modified the name of the content place holder in Application Generation Options, add it here to the list + * for example '|| (objElement.id.indexOf("_MyNewPlaceHolder_") != -1) + */ +function IsElementInContent(objElement) { + if ((objElement.id.indexOf("_PageContent_") != -1)) { + return true; + } + else return false; +} + + +/* + * Sets the focus on the first element that is able to receive it + */ +function Fev_FocusOnFirstFocusableElement(objForm) +{ + if (objForm && (objForm != null)) + { + for (i = 0; i < objForm.length; i++) + { + var objElement = objForm.elements[i]; + if (Fev_IsFocusableElement(objElement)) + { + objElement.focus(); + return true; + } + } + } + return false; +} + +/************************************************************************************** + * Function : OpwnWindowCentered(URLstring) * + * Description : This function is responsible to do a window .open. Open the pop up * + and place it in the center of the screen. * + * Parameters : URLstring. the URL for the window.open * + **************************************************************************************/ +function OpenWindowCentered(URLstring) +{ + var width = 400; + var height = 300; + var left = parseInt((screen.availWidth/2) - (width/2)); + var top = parseInt((screen.availHeight/2) - (height/2)); + var windowFeatures = "width=" + width + ",height=" + height + ",left=" + left + ",top=" + top + ",resizable,scrollbars=1"; + helpWindow = window.open (URLstring, "", windowFeatures); + + //return false; +} + + + + + + + + +function ISD_CopyPageSize(dropdown) { + var buttonCtrl = document.getElementById(dropdown.id.replace("PageSizeSelector", "PageSizeButton")); + var pageSize = "5"; + + if ( buttonCtrl == null ) { + var buttonCtrl = document.getElementById(dropdown.id.replace("_PageSizeSelector", "PageSizeButton")); + + if ( buttonCtrl == null ) { + return; + } + } + if ( dropdown.selectedIndex >= 0 ) { + pageSize = dropdown.options[dropdown.selectedIndex].text; + } + + if (navigator.appName.toUpperCase().indexOf(('Microsoft').toUpperCase()) >= 0) { + buttonCtrl.click(); + } else { + var l_newEvent = document.createEvent("MouseEvents"); + l_newEvent.initEvent("click", true, true); + buttonCtrl.dispatchEvent(l_newEvent); + } +} + + + +var ISD_OpenFilterOrLanguagePanelElement = null; +var ISD_OpenFilterOrLanguageButtonElement = null; + + +function ISD_GetPosition(oElement, propertyName) { + var returnValue = 0; + + try { + while( oElement != null ) { + returnValue += eval("oElement." + propertyName); + oElement = oElement.offsetParent; + } + } catch (e) { + returnValue = 0; + } + + return returnValue; +} + + + +function ISD_HidePopupPanel() { + if ( ISD_OpenFilterOrLanguagePanelElement != null && ISD_OpenFilterOrLanguagePanelElement.style.visibility == "visible" ) { + ISD_OpenFilterOrLanguagePanelElement.style.visibility="hidden"; + ISD_OpenFilterOrLanguagePanelElement = null; + ISD_OpenFilterOrLanguageButtonElement = null; + } +} + + + +function ISD_HandlePopupResize() { + if ( ISD_OpenFilterOrLanguagePanelElement == null ) { + return; + } + + var leftValue = ISD_GetPosition(ISD_OpenFilterOrLanguageButtonElement, "offsetLeft"); + var topValue = ISD_GetPosition(ISD_OpenFilterOrLanguageButtonElement, "offsetTop"); + + topValue += ISD_OpenFilterOrLanguageButtonElement.offsetHeight / 2 - 3; + + if ( ISD_OpenFilterOrLanguageButtonElement.tagName == "A" ) { + topValue += 20; + leftValue += (gRTL ? -18 : 20); + } else { + topValue += 22; + } + + try { + if ( !gRTL ) { + leftValue = leftValue - ISD_OpenFilterOrLanguagePanelElement.offsetWidth + ISD_OpenFilterOrLanguageButtonElement.offsetWidth; + } + } catch (e) { + } + if (leftValue < 0) { + leftValue = 0; + } + + ISD_OpenFilterOrLanguagePanelElement.style.left=leftValue + "px"; + ISD_OpenFilterOrLanguagePanelElement.style.top=topValue + "px"; +} + + + + + + + +var allowModernButtonClick = false; + +function ISD_ModernButtonClick(oElement,evt) { + if (allowModernButtonClick) { + return false; + } + if (evt == null) { + evt = window.event; + } + + var didIt = false; + + if ( evt != null ) { + if ( evt.cancelBubble != null ) { + evt.cancelBubble = true; + didIt = true; + } + + if ( evt.stopPropagation != null ) { + evt.stopPropagation(); + didIt = true; + } + } + + if ( didIt ) { + allowModernButtonClick = true; + oElement.childNodes[0].onclick(); + + return false; + } else { + return true; + } +} + + + + +function ISD_ShowPopupPanel(panelName, buttonName, oElement) { + if (!allowModernButtonClick) { + return false; + } + allowModernButtonClick = false; + + var originalPanelName = panelName; + var idx = oElement.id.indexOf(buttonName); + + if ( idx >= 0 ) { + panelName = oElement.id.substring(0, idx) + panelName; + + if ( document.getElementById(panelName) == null && idx > 1 ) { + panelName = oElement.id.substring(0, idx-1) + originalPanelName; + } + } + + var thePanel = document.getElementById(panelName); + + if ( thePanel == null ) { + alert("The panel named '" + originalPanelName + "' cannot be found. It was probably deleted earlier."); + + return; + } + + window.focus(); + + if ( thePanel.style.visibility != "visible" ) { + if ( ISD_OpenFilterOrLanguagePanelElement != null ) { + ISD_OpenFilterOrLanguagePanelElement.style.visibility="hidden"; + } + + ISD_OpenFilterOrLanguagePanelElement = thePanel; + ISD_OpenFilterOrLanguageButtonElement = oElement; + + var size1 = ISD_GetPosition(ISD_OpenFilterOrLanguagePanelElement, "offsetWidth"); + + thePanel.style.visibility = "hidden"; + if ( typeof(thePanel.theWidth) == "undefined" ) { + thePanel.theWidth = thePanel.offsetWidth - 95; + } + + var size2 = ISD_GetPosition(ISD_OpenFilterOrLanguagePanelElement, "offsetWidth"); + + ISD_OpenFilterOrLanguagePanelWidth = size2 - size1; + + thePanel.style.visibility = "visible"; + + ISD_HandlePopupResize(); + } else { + ISD_HidePopupPanel(); + } +} + + + +function ISD_HandlePopupUnload() { + ISD_OpenFilterOrLanguagePanelElement = null; + ISD_OpenFilterOrLanguageButtonElement = null; +} + + +window.onunload = ISD_HandlePopupUnload; +window.onresize = ISD_HandlePopupResize; + + + + + + + + +/************************************************************************************** + * Function : SubmitHRefOnce(objElement, msg) * + * Description : This function should be used for the onclick HTML attribute for a * + * 'a href' to ensure that the button cannot be clicked * + * twice. It changes the href URL to an alert instead of the previous * + * href. This href will then be reset on the postback, and the button * + * will also be enabled by the postback. Note that this only works * + * for an 'a href' at this time (ThemeButtons included). It is not * + * tested for any of the other buttons such as ImageButton, LinkButton * + * or others. * + * Parameters : objElement: the button. Typically it is 'this' * + * msg: The message to report when the user clicks on the button again * + **************************************************************************************/ +function SubmitHRefOnce(objElement, msg) +{ + var ClientValidate = MyPage_ClientValidate(); + if (ClientValidate){ + submitcount += 1; + } + else{ + submitcount = 0; + return true; + } + var strTagName = objElement.tagName; + if (strTagName != null){ + strTagName = strTagName.toLowerCase(); + } + else{ + submitcount = 0; + return true; + } + switch (strTagName){ + case "a": + if (submitcount > 1) { + objElement.href = 'javascript:alert("' + msg + '");'; + submitcount += 1; + return false; + } + + case "input": + if (submitcount > 1) { + alert(msg); + submitcount += 1; + return false; + } + } + return true; +} + +function MyPage_ClientValidate(validationGroup) { + Page_InvalidControlToBeFocused = null; + if (typeof(Page_Validators) == "undefined") { + return true; + } + var i; + for (i = 0; i < Page_Validators.length; i++) { + ValidatorValidate(Page_Validators[i], validationGroup, null); + } + ValidatorUpdateIsValid(); + //ValidationSummaryOnSubmit(validationGroup); + Page_BlockSubmit = !Page_IsValid; + return Page_IsValid; +} +/************************************************************************************** + * Function : FCKeditor_OnComplete() * + * Description : Sets focus in the textarea of the FCKEditor (if the method * + * Fev_FocusOnDefaultElement() determines that it appears before the * + * control upon which focus would otherwise normally be set). * + * Note that this method gets called upon loading of the FCKEditor in * + * the page, but only AFTER Fev_FocusOnFirstFocusableFormElement() * + * gets called; also, the focus needs to be set in this FCKEditor- * + * provided JavaScriptAPI method because the FCKEditor does not * + * respond to the conventional JavaScript focus() method. * + * Parameters : pEditorInstance: reference to the FCKEditor * + **************************************************************************************/ +var gSetFocusOnFCKEditor = false; +function FCKeditor_OnComplete(pEditorInstance) +{ + var oEditor = pEditorInstance; + if (gSetFocusOnFCKEditor == true) + { + oEditor.Focus(); + // disable further focus setting (in case there are more than one FCKEditor textarea on page) + gSetFocusOnFCKEditor = false; + } +} + + + +function IsVisible(objElement) +{ + try { + while( objElement != null ) { + if ( typeof(objElement.className) != "undefined" && objElement.className == "popupWrapper" ) { + return false; + } + if ( typeof(objElement.style) != "undefined" && typeof(objElement.style.visibility) != "undefined" && objElement.style.visibility == "hidden" ) { + return false; + } + objElement = objElement.parentElement; + } + } catch (e) { + } + + return true; +} + + + +/* + * Sets the focus on the first element that should "reasonably" receive it + */ +function Fev_FocusOnDefaultElement_FromSetFocus(objForm) +{ + if (objForm && (objForm != null) && (objForm.length > 0)) + { + for (i = 0; i < objForm.length; i++) + { + var objElement = objForm.elements[i]; + + // if FCKEditor appears before the control upon which focus would normally be set... + // (note that all FCKEditors have an component with id, "...___Config", + // so that is used as the identifier) + if (objElement.id.indexOf("___Config") != -1) + { + continue; + // if you wish to include FCKEditor in the controls where focus could be set by default, + // uncomment next two lines of code which indicate that focus is to be set + // (later by FCKeditor_OnComplete()) on the FCKEditor: + + // gSetFocusOnFCKEditor = true; + // return true; + } + + // if you wish to include Header controls in the list of focusable controls comment out this check + if (!IsElementInContent(objElement)) continue; + + if (Fev_IsFocusableElement(objElement)) + { + var strType = Fev_GetElementType(objElement); + + if ( objElement.className.indexOf("Pagination_Input") == 0 ) { + continue; + } + + if ( objElement.className.indexOf("Search_Input") == 0 && + objElement.outerHTML.indexOf("Search_InputHint") > 0 ) { + continue; + } + + if ( !IsVisible(objElement) ) { + continue; + } + + //we know (strType != null) because it was checked within Fev_IsFocusableElement(). + //NOTE: SELECT tags interfere with mousewheel scrolling when they have focus + // NOTE: if you want to ignore 'select' tags (dropdown list for example) you have to uncomment + // the following code: +// if (strType.toLowerCase().indexOf("select") == 0) +// { +// +// } +// else +// { + // if object and all it's parents are visible... + if (Fev_IsElementVisible(objElement)) + { + // if the FCKEditor does not appear before the control upon which focus would normally be set... + if (gSetFocusOnFCKEditor == false) + { + // sam - Bug 84611 - don't set focus here (focus will be set by Kirill's FixFocus.js code); just return id of focusable control + // just set focus on the "normal" control + // objElement.focus(); + // return true; + return objElement.id; + } + // } closing tag for ignore 'select' tag + } + } + } + } + return false; +} + +/* + * Sets the focus on the first element that should "reasonably" receive it + */ +function Fev_FocusOnDefaultElement(objForm) +{ + if (objForm && (objForm != null)) + { + for (i = 0; i < objForm.length; i++) + { + var objElement = objForm.elements[i]; + + // if FCKEditor appears before the control upon which focus would normally be set... + // (note that all FCKEditors have an component with id, "...___Config", + // so that is used as the identifier) + if (objElement.id.indexOf("___Config") != -1) + { + continue; + // if you wish to include FCKEditor in the controls where focus could be set by default, + // uncomment next two lines of code which indicate that focus is to be set + // (later by FCKeditor_OnComplete()) on the FCKEditor: + + // gSetFocusOnFCKEditor = true; + // return true; + } + + + if (Fev_IsFocusableElement(objElement)) + { + var strType = Fev_GetElementType(objElement); + //we know (strType != null) because it was checked within Fev_IsFocusableElement(). + if (strType.toLowerCase().indexOf("select") == 0) + { + //NOTE: SELECT tags are ignored (they interfere with mousewheel scrolling when they have focus) + } + else + { + // if object and all it's parents are visible... + if (Fev_IsElementVisible(objElement)) + { + // if the FCKEditor does not appear before the control upon which focus would normally be set... + if (gSetFocusOnFCKEditor == false) + { + // sam - Bug 84611 - don't set focus here (focus will be set by Kirill's FixFocus.js code); just return id of focusable control + // just set focus on the "normal" control + // objElement.focus(); + // return true; + return objElement.id; + } + } + } + } + } + } + return false; +} + +/* + * returns true if the element can receive focus + */ +function Fev_IsFocusableElement(objElement) +{ + if (objElement && + (objElement != null) && + Fev_IsElementEnabled(objElement) && + Fev_IsElementVisible(objElement) && + Fev_IsElementEditable(objElement) ) + { + var strType = Fev_GetElementType(objElement); + if (strType != null) + { + if ((strType == "text") || (strType == "textarea") || (strType.toLowerCase().indexOf("select") == 0) || (strType.toString().charAt(0) == "s")) + { + return true; + } + } + } + return false; +} + + + +/* + * returns true if the element is enabled + */ +function Fev_IsElementEnabled(objElement) +{ + if (objElement && (objElement != null)) + { + if (!(objElement.disabled == false)) + { + return false; + } + return true; + } + return false; +} + +/* + * returns true if the element's content is editable by the user + */ +function Fev_IsElementEditable(objElement) +{ + if (objElement && (objElement != null)) + { + if (objElement.readOnly) + { + return false; + } + var strType = Fev_GetElementType(objElement); + if (strType == null) { + strType = ""; + } + if (!objElement.isContentEditable && + ((strType.toLowerCase().indexOf("select") != 0)&&(IE || (strType.toLowerCase().indexOf("text") != 0))) && + (typeof (objElement.isContentEditable) != 'undefined')) + { + return false; + } + return true; + } + return false; +} + +/* + * returns true if the element is visible to the user + */ +function Fev_IsElementVisible(objElement) +{ + if (objElement && (objElement != null)) + { + if (objElement.style && (objElement.style != null)) + { + if (objElement.style.display && (objElement.style.display.toLowerCase() == 'none')) + { + return false; + } + if (objElement.style.visibility && (objElement.style.visibility.toLowerCase() == 'hidden')) + { + return false; + } + /* + if (objElement.style.visibility && (objElement.style.visibility.toLowerCase() == 'inherit')) + { + var objParentElement = Fev_GetParentElement(objElement); + if (objParentElement && (objParentElement != null) && (!Fev_IsElementVisible(objParentElement))) + { + return false; + } + } + */ + } + + var objParentElement = Fev_GetParentElement(objElement); + if (objParentElement && (objParentElement != null)) + { + return Fev_IsElementVisible(objParentElement); + } + else + { + return true; + } + } + return false; +} + +/* + * returns true if the element responds directly to Enter key presses + * return true for: + * Textarea, Select/Dropdown, Input Buttons (Submit/Button/Image/Reset), + * A tags + * return false for everything else, including: + * Input type=[Radio/Checkbox/Text/Password/File] + * IMG tags + */ +function Fev_IsElementUsesEnterKey(objElement) +{ + if (objElement && (objElement != null)) + { + var strType = Fev_GetElementType(objElement); + if (strType != null) strType = strType.toLowerCase(); + switch (strType) + { + case "textarea": + case "select": + case "submit": + case "button": + case "image": + case "reset": + return true; + break; + case "radio": + case "checkbox": + case "text": + case "password": + case "file": + case "select-multiple": + case "select-single": + case "select-one": + return false; + break; + default: + break; + } + + var strTagName = Fev_GetElementTagName(objElement); + if (strTagName != null) strTagName = strTagName.toLowerCase(); + switch (strTagName) + { + case "textarea": + case "select": + case "a": + return true; + break; + case "img": + case "input": + default: + break; + } + } + return false; +} + +function Fev_GetParentElement(objElement) +{ + if (objElement && (objElement != null)) + { + if (objElement.parentNode && (objElement.parentNode != null)) + { + return objElement.parentNode; + } + if (objElement.parentElement && (objElement.parentElement != null)) + { + return objElement.parentElement; + } + } + return null; +} + +function Fev_GetElementType(objElement) +{ + if (objElement && (objElement != null)) + { + if (objElement.type) + { + return objElement.type; + } + } + return null; +} + +function Fev_GetElementTagName(objElement) +{ + if (objElement && (objElement != null)) + { + if (objElement.tagName) + { + return objElement.tagName; + } + } + return null; +} + +function Fev_GetEventSourceElement(objEvent) +{ + if (objEvent && (objEvent != null)) + { + // if IE... + if (objEvent.srcElement) + { + return objEvent.srcElement; + } + // if Firefox... + else if (objEvent.target) + { + return objEvent.target; + } + } + return null; +} + +function Fev_IsEnterKeyPressed(bIgnoreTextAreaEvents) +{ + if (window.event) + { + var e = window.event; + var bIsEnterKeyPress = ((e.keyCode == 13) && (e.type == 'keypress')); + if (bIsEnterKeyPress) + { + if (bIgnoreTextAreaEvents && (bIgnoreTextAreaEvents == true)) + { + var strType = Fev_GetElementType(Fev_GetEventSourceElement(e)); + if (strType != null) strType = strType.toLowerCase(); + if (strType == "textarea") + { + return false; + } + } + return true; + } + } + return false; +} + +function Fev_IsFormSubmitKeyPress(event) +{ + // for IE... + if (window.event) + { + var e = window.event; + var bIsEnterKeyPress = ((e.keyCode == 13) && (e.type == 'keypress')); + if (bIsEnterKeyPress) + { + var eventSrc = Fev_GetEventSourceElement(e); + + if (!Fev_IsElementUsesEnterKey(eventSrc)) + { + return true; + } + } + } + // for Netscape/Firefox + else if (event.which) + { + var bIsEnterKeyPress = (event.which == 13); + if (bIsEnterKeyPress) + { + var eventSrc = Fev_GetEventSourceElement(event); + if (!Fev_IsElementUsesEnterKey(eventSrc)) + { + return true; + } + } + } + + return false; +} + +/************************************************************************************** + * Function : getHRefName() * + * Description : We need to get the name of button used in the = 0) { + startpos = startpos + "doPostBack('".length; + } else { + if (navigator.appName == "Netscape") { + startpos = anHRef.indexOf('DoPostBackWithOptions(new WebForm_PostBackOptions("'); + startpos = startpos + 'DoPostBackWithOptions(new WebForm_PostBackOptions("'.length; + } + else { // IE + startpos = anHRef.indexOf('DoPostBackWithOptions(new%20WebForm_PostBackOptions("'); + startpos = startpos + 'DoPostBackWithOptions(new%20WebForm_PostBackOptions("'.length; + } + } + + var endpos = anHRef.indexOf("',"); + if (endpos < 0) endpos = anHRef.indexOf('",'); + + + anHRef = anHRef.substring(startpos, endpos); + + return anHRef; +} + +/************************************************************************************** + * Function : clickLinkButtonText() * + * Description : onclick event handler for HTML table/row shell surrounding button * + * text link. Locates the anchor in the center table cell and * + * invokes Fev_ClickButton (passing it the anchor's button id) to * + * simulate a physical clicking of the button text link. * + * Parameters : pButtonTableOrRowNode, html table/row shell receiving the onclick * + * event, and which surrounds the button text link to be clicked * + * event, browser-generated onclick event object * + * Assumptions : Only "button" and "menu item" HTML table/row shells will call this * + * function. * + * ISD Feature : "Button/Menu Item Image Edges Clickable" * + * Authors : Samson Wong * + **************************************************************************************/ +function clickLinkButtonText(pButtonTableOrRowNode, event) +{ + // make sure to cancel bubbling of clicks. + if (!event) return; + event.cancelBubble = true; + if (event.stopPropagation) event.stopPropagation(); + + // also check to make sure the target was not the inner area. + // target is used by Firefox, srcElement is used by IE + if (event.target && event.target.toString().toLowerCase().indexOf("dopostback") > -1) return; + if (event.srcElement && event.srcElement.toString().toLowerCase().indexOf("dopostback") > -1) return; + + var lAnchorNodeArray = pButtonTableOrRowNode.getElementsByTagName("a"); + + // if "button", "horizontal menu item", "vertical menu item middle row" clicked... + if ((lAnchorNodeArray != null) && (lAnchorNodeArray.length == 1)) + { + Fev_ClickButton(lAnchorNodeArray.item(0).id, event); + } + else // if "vertical menu item upper/lower row" clicked... + { + var lParentTableNode = pButtonTableOrRowNode.parentNode; + var lChildrenNodeArray = lParentTableNode.getElementsByTagName("tr"); + // alert("clickLinkButtonText(lChildrenNodeArray.length=" + lChildrenNodeArray.length + ")"); + + if (lChildrenNodeArray != null) + { + var lClickedRowFound = false; + var lCurrentRowItemNumber = 1; // ignore vertical menu edge top row + + // locate the clicked row (this will either be one row above or below + // the row containing the vertical menu item to be clicked); terminate search + // before vertical menu edge bottom row + while ((lClickedRowFound == false) && (lCurrentRowItemNumber < lChildrenNodeArray.length-1)) + { + if (lChildrenNodeArray.item(lCurrentRowItemNumber) != pButtonTableOrRowNode) + { + lCurrentRowItemNumber++; + } + else + { + // alert("clickLinkButtonText(lCurrentRowItemNumber=" + lCurrentRowItemNumber + ")"); + lClickedRowFound = true; + } + } + + if (lClickedRowFound == true) + { + // if row above first vertical menu item was clicked... + if (lCurrentRowItemNumber == 1) + { + // vertical menu item to be clicked must be below clicked row + lAnchorNodeArray = lChildrenNodeArray.item(lCurrentRowItemNumber +1).getElementsByTagName("a"); + // if row above vertical menu item was clicked... + if ((lAnchorNodeArray != null) && (lAnchorNodeArray.length == 1)) + { + Fev_ClickButton(lAnchorNodeArray.item(0).id, event); + } + } + // if row below last vertical menu item was clicked... + else if (lCurrentRowItemNumber == (lChildrenNodeArray.length-2)) + { + // vertical menu item to be clicked must be above clicked row + lAnchorNodeArray = lChildrenNodeArray.item(lCurrentRowItemNumber -1).getElementsByTagName("a"); + ((lAnchorNodeArray != null) && (lAnchorNodeArray.length == 1)) + { + Fev_ClickButton(lAnchorNodeArray.item(0).id, event); + } + } + // if row of any other vertical menu item was clicked... + else + { + lAnchorNodeArray = lChildrenNodeArray.item(lCurrentRowItemNumber +1).getElementsByTagName("a"); + // if row above vertical menu item was clicked... + if ((lAnchorNodeArray != null) && (lAnchorNodeArray.length == 1)) + { + Fev_ClickButton(lAnchorNodeArray.item(0).id, event); + } + // if row below vertical menu item was clicked... + else + { + lAnchorNodeArray = lChildrenNodeArray.item(lCurrentRowItemNumber -1).getElementsByTagName("a"); + ((lAnchorNodeArray != null) && (lAnchorNodeArray.length == 1)) + { + Fev_ClickButton(lAnchorNodeArray.item(0).id, event); + } + } + } + } + } + } +} + + +function Fev_ClickButton(buttonId, event) +{ + // make sure to cancel bubbling of clicks. + if (!event) return; + event.cancelBubble = true; + if (event.stopPropagation) event.stopPropagation(); + + var buttonIdWithUnderscores = buttonId; + + var button = document.getElementById(buttonId); + + // If button is null, then try replacing $ with _ and look again. + if (button == null) + { + while (buttonIdWithUnderscores.indexOf("$") != -1) + { + buttonIdWithUnderscores = buttonIdWithUnderscores.replace("$", "_"); + } + + button = document.getElementById(buttonIdWithUnderscores); + } + + // Still nothing? Try appending _Button + if (button == null) + { + button = document.getElementById(buttonIdWithUnderscores + '_Button'); + } + + // Still nothing? Try appending __Button + if (button == null) + { + button = document.getElementById(buttonIdWithUnderscores + '__Button'); + } + + if (button) + { + // var anHRef = getHRefName(button); + // if (anHRef) + // { + + var nav = navigator.appName; + if (nav.toUpperCase().indexOf(('Microsoft').toUpperCase()) >= 0) + { + button.click(); + } + else + { + /* for enter key capture on buttons without href's... */ + if ((event.keyCode == 13) && (!button.href)) { + var l_newEvent = document.createEvent("MouseEvents"); + l_newEvent.initEvent("click", true, true); + button.dispatchEvent(l_newEvent); + } + else { + var anHRef; + // retrieve the entire href, stripping out (if any) the preceding "javascript:" string + if (button.href.toLowerCase().indexOf("javascript:") >= 0) + { + anHRef = button.href.substring("javascript:".length,button.href.length); + } + else + { + anHRef = button.href; + } + + // convert all HTML-encoded quotes into true quotes + anHRef = anHRef.replace(""",'"'); + + // convert all HTML-encoded spaces into true-spaces + anHRef = anHRef.replace(/%20/g,' '); + + // call the javascript built-in function to execute the href string (in effect, this is analogous + // to IE's button.click(), but without having to do the complicated parsing of the href string + // to decide between regular "doPostBack"s and "doPostBackWithOptions"s) + eval(anHRef); + } + } + + return true; + // } + } + return false; +} + +// returns true if the href uses PostBackWithOptions. +function DoesButtonUsePostbackWithOptions(anElement) + +{ + var anHRef = anElement.href; + var startpos = anHRef.indexOf('PostBackWithOptions'); + if (startpos >= 0) + { + return true; + } + return false; +} +//Sets the value or selection of the form element, independent of the element's type. +function Fev_SetFormControlValue(objElement, strValue) +{ + var strTagName = Fev_GetElementTagName(objElement); + if (strTagName != null) strTagName = strTagName.toLowerCase(); + switch (strTagName) + { + case "textarea": + objElement.value = strValue; + return true; + break; + case "select": + var currentIndex = objElement.selectedIndex; + objElement.value = strValue; + if (objElement.selectedIndex < 0) + { + objElement.selectedIndex = currentIndex; + return false; + } + return true; + break; + case "input": + switch (objElement.type.toLowerCase()) + { + case "text": + case "password": + case "hidden": + objElement.value = strValue; + return true; + break; + case "file": + //can't programatically set the value of file controls + return false; + case "checkbox": + if ((strValue == null) || (strValue == '')) + { + objElement.checked = false; + return true; + break; + } + else if (strValue == objElement.value) + { + objElement.checked = true; + return true; + break; + } + else + { + //the specified value matches niether the checked nor unchecked state + //objElement.checked = true; + //objElement.value = strValue; + //return true; + break; + } + case "radio": + if (strValue == null) + { + //uncheck all radio buttons in the group + objElement.checked = true; + objElement.checked = false; + return true; + break; + } + else if (strValue == objElement.value) + { + objElement.checked = true; + return true; + break; + } + else + { + var f = objElement.form; + var allRadioButtonsInGroup = f.elements(objElement.name) + for (i = 0; i < allRadioButtonsInGroup.length; i++) + { + var rb = allRadioButtonsInGroup[i]; + if (strValue == rb.value) + { + rb.checked = true; + return true; + } + } + //the specified value matches the checked state of none of the radio buttons + //objElement.checked = true; + //objElement.checked = false; + //return true; + break; + } + default: + break; + } + default: + break; + } + return false; +} + +//Inserts the value into a list element, independent of the element's type. +function Fev_ReplaceLastListControlOption(objListElement, strValue, strText) +{ + var strTagName = Fev_GetElementTagName(objListElement); + if (strTagName != null) strTagName = strTagName.toLowerCase(); + switch (strTagName) + { + case "select": + var objOption = objListElement.options[objListElement.options.length-1]; + objOption.value = strValue; + objOption.text = strText; + //objOption.innerText = strText; + return true; + break; + default: + break; + } + return false; +} + +function Fev_HandleFormSubmitKeyPress(buttonId, event) +{ + if (Fev_IsFormSubmitKeyPress(event)) + { + if (Fev_ClickButton(buttonId, event)) + { + return true; + } + } + return false; +} + + +/************************************************************************************** + * Function : refreshFixedHeaderRows() * + * Description : Upon expand/collapse of record/table panels, forces a repositioning * + * of any scrolling table's "fixed" header row (to it proper * + * location above/relative to the rest of the shifted table rows. * + * Author : Samson Wong * + **************************************************************************************/ +function refreshFixedHeaderRows() +{ + var lHeaderRowNodesArray = document.getElementsByTagName("thead"); + for (var i=0; i tag node which is clicked upon to initiate toggling * + * of expand/collapse * + * Assumptions : The region which is expanded/collapsed is the table (with HTML * + * id, "CollapsibleRegion") within the sibling (row) of the table * + * row which contains the anchorNode. * + * Author : Samson Wong * + **************************************************************************************/ +function toggleExpandCollapse(anchorNode) +{ + var collapsibleNode = anchorNode; + + // traverse up node tree until the parent table which contains the "dialog_header" and the "collapsible region" is found + while (true) + { + collapsibleNode = collapsibleNode.parentNode; + if ( (collapsibleNode != null) && + (collapsibleNode.tagName == "TABLE") && + ((collapsibleNode.className == "dialog_view") || (collapsibleNode.className == "dv")) + ) + { + break; + } + } + + // traverse down node tree to "collapsible region" + var childNodesArray = collapsibleNode.getElementsByTagName("TABLE"); + for (var i=0; i aLowerBound) + { + aPageSizeTextboxNode.value = new Number(aPageSizeTextboxNode.value) - 1; + } + } + } + } + // } +} + + +/************************************************************************************** + * Function : adjustCurrency() * + * Description : onkeyup event handler to increment/decrement currency. * + * Parameters : aInputTextbox, html textbox containing the currency value to be * + * incremented/decremented * + * aCurrencySymbol, the currency symbol which prepended to the * + * actual currency value * + * aCurrencyDecimalSeparator, the symbol which divides the "whole" * + * portion of the currency from the "fractional" part * + * aIsCurrencySeparatorAtEnd, boolean indicating whether currency * + * symbol trails or precedes currency value * + * ISD Feature : "Increment/Decrement Numerical Fields" * + * Authors : Samson Wong * + **************************************************************************************/ +function adjustCurrency(aInputTextbox, aKeyCode, aCurrencySymbol, aCurrencyDecimalSeparator, aIsCurrencySeparatorAtEnd) +{ + // if (justDoIt == true) + // { + // var lWhichCode = event.keyCode; + var lWhichCode = aKeyCode; + + // if up arrow, or plus key... + if ((lWhichCode == 38) || (lWhichCode == 107) || (lWhichCode == 40) || (lWhichCode == 109)) + { + if ((aCurrencySymbol != "") && (aCurrencyDecimalSeparator != "")) + { + // strip "+" character if it has been appended to currency value + while ((lWhichCode == 107) && (aInputTextbox.value.charAt(aInputTextbox.value.length-1) == "+")) + { + aInputTextbox.value = (aInputTextbox.value).substring(0,aInputTextbox.value.length-1); + } + + // strip "-" character if it has been appended to currency value + while ((lWhichCode == 109) && (aInputTextbox.value.charAt(aInputTextbox.value.length-1) == "-")) + { + aInputTextbox.value = (aInputTextbox.value).substring(0,aInputTextbox.value.length-1); + } + + // if currency value not initialized... + if (aInputTextbox.value == "") + { + if (aIsCurrencySeparatorAtEnd.indexOf("False") != -1) + { + // set initial value (with leading currency symbol) + aInputTextbox.value = aCurrencySymbol + "1" + aCurrencyDecimalSeparator + "00"; + } + else + { + // set initial value (with trailing currency symbol) + aInputTextbox.value = "1" + aCurrencyDecimalSeparator + "00" + aCurrencySymbol; + } + } + else + { + if ((aInputTextbox.value).indexOf(aCurrencyDecimalSeparator) == -1) + { + aInputTextbox.value = aInputTextbox.value + aCurrencyDecimalSeparator + "00"; + } + + var lCurrencyArray = (aInputTextbox.value).replace(aCurrencySymbol,"").split(aCurrencyDecimalSeparator); + + var lCurrencyWhole = null; + var lParenthesesRepresentationOfNegativeValue = false; + // account for "parentheses" representation of negative value + if ((aInputTextbox.value.indexOf("(") == 0) && (aInputTextbox.value.indexOf(")") == aInputTextbox.value.length-1)) + { + lParenthesesRepresentationOfNegativeValue = true; + lCurrencyArray[0] = "-" + lCurrencyArray[0]; + } + + if ((lWhichCode == 38) || (lWhichCode == 107)) + { + lCurrencyWhole = new Number(lCurrencyArray[0].replace(/[^0-9,-]/g,"")) + 1; + } + // ((lWhichCode == 40) || (lWhichCode == 109)) + else + { + lCurrencyWhole = new Number(lCurrencyArray[0].replace(/[^0-9,-]/g,"")) - 1; + } + + lCurrencyArray[1] = lCurrencyArray[1].replace(/[^0-9]/g,"") + if (lCurrencyArray[1].length == 1) + { + lCurrencyArray[1] = lCurrencyArray[1] + "0"; + } + + var lCurrencyFraction = new Number(lCurrencyArray[1]); + + if ((lCurrencyFraction < 10) && (lCurrencyFraction >= 0)) + { + lCurrencyFraction = "0" + lCurrencyFraction; + } + + if (lCurrencyWhole >= 0) + { + if (aIsCurrencySeparatorAtEnd.indexOf("False") != -1) + { + aInputTextbox.value = aCurrencySymbol + lCurrencyWhole + aCurrencyDecimalSeparator + lCurrencyFraction; + } + else + { + aInputTextbox.value = lCurrencyWhole + aCurrencyDecimalSeparator + lCurrencyFraction + aCurrencySymbol; + } + } + else + { + if (aIsCurrencySeparatorAtEnd.indexOf("False") != -1) + { + if (lParenthesesRepresentationOfNegativeValue == false) + { + aInputTextbox.value = "-" + aCurrencySymbol + Math.abs(lCurrencyWhole) + aCurrencyDecimalSeparator + lCurrencyFraction; + } + else + { + aInputTextbox.value = "(" + aCurrencySymbol + Math.abs(lCurrencyWhole) + aCurrencyDecimalSeparator + lCurrencyFraction + ")"; + } + } + else + { + if (lParenthesesRepresentationOfNegativeValue == false) + { + aInputTextbox.value = "-" + Math.abs(lCurrencyWhole) + aCurrencyDecimalSeparator + lCurrencyFraction + aCurrencySymbol; + } + else + { + aInputTextbox.value = "(" + Math.abs(lCurrencyWhole) + aCurrencyDecimalSeparator + lCurrencyFraction + aCurrencySymbol + ")"; + } + } + } + } + } + } + // } +} + + + +/************************************************************************************** + * Function : adjustInteger() * + * Description : onkeyup event handler to increment/decrement integer fields. * + * Parameters : aInputTextbox, html textbox containing the integer value to be * + * incremented/decremented * + * ISD Feature : "Increment/Decrement Numerical Fields" * + * Authors : Samson Wong * + **************************************************************************************/ +function adjustInteger(aInputTextbox, aKeyCode) +{ + // if (justDoIt == true) + // { + // var lWhichCode = event.keyCode; + var lWhichCode = aKeyCode; + + // if up arrow, or plus key... + if ((lWhichCode == 38) || (lWhichCode == 107)) + { + // strip "+" character if it has been appended to integer value + while ((lWhichCode == 107) && (aInputTextbox.value.charAt(aInputTextbox.value.length-1) == "+")) + { + aInputTextbox.value = (aInputTextbox.value).substring(0,aInputTextbox.value.length-1); + } + + // if currency value not initialized or contains invalid characters... + if ((aInputTextbox.value == "") || (isNaN(aInputTextbox.value))) + { + // set initial value + aInputTextbox.value = "1"; + } + else + { + // myAlert("adjustInteger(aInputTextbox.value=" + aInputTextbox.value + ")"); + aInputTextbox.value = new Number(aInputTextbox.value) + 1; + } + } + // if down arrow, or minus key... + else if ((lWhichCode == 40) || (lWhichCode == 109)) + { + // strip "-" character if it has been appended to integer value + while ((lWhichCode == 109) && (aInputTextbox.value.charAt(aInputTextbox.value.length-1) == "-")) + + { + aInputTextbox.value = (aInputTextbox.value).substring(0,aInputTextbox.value.length-1); + } + + // if currency value not initialized or contains invalid characters... + if ((aInputTextbox.value == "") || (isNaN(aInputTextbox.value))) + { + // set initial value + aInputTextbox.value = "1"; + } + else + { + // myAlert("adjustInteger(aInputTextbox.value=" + aInputTextbox.value + ")"); + aInputTextbox.value = new Number(aInputTextbox.value) - 1; + } + } + // } +} + + +/************************************************************************************** + * Function : createNewDate() * + * Description : Create and return a new date object based on the value in the * + * specified textbox and the current date pattern. * + * Parameters : aInputTextbox, textbox containing the current date to be * + * incremented/decremented * + * Assumptions : parseDatePattern() has already been called, so that the format * + * of the date is known. * + * ISD Feature : "Increment/Decrement Numerical Fields" * + * Authors : Samson Wong * + **************************************************************************************/ +function createNewDate(aInputTextbox) +{ + // myAlert("createNewDate(aInputTextbox.value=" + aInputTextbox.value + ")"); + + var rNewDate = new Date(); + var lDateStringArray; + + if (gDateSeparator1 == gDateSeparator2) + { + lDateStringArray = (aInputTextbox.value).split(gDateSeparator1); + } + else // (gDateSeparator1 != gDateSeparator2) + { + var lTempArray1 = (aInputTextbox.value).split(gDateSeparator1); + var lDatePortion1 = lTempArray1[0]; + var lTempArray2 = lTempArray1[1].split(gDateSeparator2); + var lDatePortion2 = lTempArray2[0]; + if (lTempArray2.length == 1) + { + lDateStringArray = new Array(lDatePortion1, lDatePortion2); + } + else if (lTempArray2.length > 1) + { + lDateStringArray = new Array(lDatePortion1, lDatePortion2, lTempArray2[1]); + } + } + + if (gDatePatternArray != null) + { + if ((gDatePatternArray.length == 3) && + (gDatePatternArray[0].charAt(0) == "m") && + (gDatePatternArray[1].charAt(0) == "d") && + (gDatePatternArray[2].charAt(0) == "y")) { + rNewDate.setTime(Date.parse(aInputTextbox.value)); + } + else if ((gDatePatternArray.length == 3) && + (gDatePatternArray[0].charAt(0) == "d") && + (gDatePatternArray[1].charAt(0) == "m") && + (gDatePatternArray[2].charAt(0) == "y")) { + // Date.parse expects date in mm/dd/yyyy format, so swap date and month portions if date pattern is dd/mm/yyyy + rNewDate.setTime(Date.parse(new String(lDateStringArray[1] + gDateSeparator1 + lDateStringArray[0] + gDateSeparator1 + lDateStringArray[2]))); + } + else { + for (var i=0; i<(gDatePatternArray.length); i++) { + switch(gDatePatternArray[i].charAt(0)) { + case "m": + // alert("createNewDate(lDateStringArrayM[" + i + "]=" + lDateStringArray[i] + ")"); + // alert("createNewDate(lDateStringArrayM[" + i + "]-1=" + lDateStringArray[i]-1 + ")"); + rNewDate.setMonth(lDateStringArray[i]-1); + break; + case "d": + // myAlert("createNewDate(lDateStringArrayD[" + i + "]=" + lDateStringArray[i] + ")"); + rNewDate.setDate(lDateStringArray[i]); + break; + case "y": + // myAlert("createNewDate(lDateStringArrayY[" + i + "]=" + lDateStringArray[i] + ")"); + // if year string is only two characters long... + if (lDateStringArray[i].length == 2) + { + // prepend default century + rNewDate.setYear("20" + lDateStringArray[i]); + } + else + { + rNewDate.setYear(lDateStringArray[i]); + } + break; + } + } + } + } + + return (rNewDate); +} + + +/************************************************************************************** + * Function : displayDate() * + * Description : Display a date in the specified textbox. * + * Parameters : aInputTextbox, textbox into which to display date * + * aDate, date to be displayed in specified textbox * + * Assumptions : parseDatePattern() has already been called, so that the display * + * format of the date is known. * + * ISD Feature : "Increment/Decrement Numerical Fields" * + * Authors : Samson Wong * + **************************************************************************************/ +function displayDate(aInputTextbox, aDate) +{ + aInputTextbox.value = ""; + + if (gDatePatternArray != null) + { + for (var i=0; i<(gDatePatternArray.length); i++) { + switch(gDatePatternArray[i].charAt(0)) { + case "m": + // month pattern is two characters long, but the current month is + // only a single digit... + if ((gDatePatternArray[i].length == 2) && (aDate.getMonth() < 9)) + { + // prepend a "0" to month string + aInputTextbox.value += "0" + new String(aDate.getMonth()+1); + } + else + { + aInputTextbox.value += new String(aDate.getMonth()+1); + } + break; + case "d": + aInputTextbox.value += aDate.getDate(); + break; + case "y": + var lDateYearString = new String(aDate.getFullYear()); + // if (lDateYearString.length < 4) + if (aDate.getFullYear() < 1000) + { + // correct browser bug which returns "1xx" for the year "20xx" + aDate.setFullYear(aDate.getFullYear() + 1900); + } + aInputTextbox.value += aDate.getFullYear(); + break; + } + + // post-pend date separator except for last portion of date + if (i == 0) { + aInputTextbox.value += gDateSeparator1; + } + else if ((i == 1) && (gDateDayPosition != 0)) { + aInputTextbox.value += gDateSeparator2; + } + } + } +} + + +/************************************************************************************** + * Function : printPage() * + * Description : Invokes the system's print program (to print the current page). * + * ISD Feature : "Print Page" * + * Authors : Samson Wong * + **************************************************************************************/ +function printPage() +{ + // if (justDoIt == true) + // { + window.print(); + // } +} + + +/************************************************************************************** + * Function : emailPage() * + * Description : Invokes the system's default e-mail client to send an e-mail with * + * the current URL in the body of the message. * + * ISD Feature : "E-mail Page" * + * Authors : Samson Wong * + **************************************************************************************/ +function emailPage() +{ + // if (justDoIt == true) + // { + var lMailStr; + lMailStr = "mailto:?body=" + location.href; + location.href = lMailStr; + // } +} + +/************************************************************************************** +* Function : getParentByTagName() * +* Description : Return the closest parent with a particular tag name * +* Parameters : tag, child tag to be the starting tag to search up * +* Parameters : tagname, name of the parent tag * +* Assumptions : The edit button is contained in the first cell of the table row in * +* focus. * +* Authors : Samson Wong & Cocosoft B.V. * +**************************************************************************************/ +function getParentByTagName(tag, tagname) { + var obj_parent = tag.parentNode; + if (!obj_parent) return null; + if (obj_parent.tagName.toUpperCase() == tagname.toUpperCase()) return obj_parent; + else return getParentByTagName(obj_parent, tagname); +} + + +/************************************************************************************** +* Function : RedirectByViewButton() * +* Description : Invokes the view button server side click event in the selected row * +* row) by programmatically clicking the record's edit button. * +* Parameters : e, event object * +* Assumptions : The view button is contained in the first cell of the table row in * +* focus. * +* ISD Feature : "Up/Down Arrow Keypress Navigation" * +* Authors : Samson Wong & Cocosoft B.V. * +**************************************************************************************/ +function RedirectByViewButton(e) { + if (justDoIt == false) + return; + + var iconCellContents = null; + var rTableRowClickable = false; + + var clickedElement; + // Firefox + if (e.target) { + clickedElement = e.target; + } + // IE or Chrome + else { + clickedElement = e.srcElement; + } + if (clickedElement.nodeName == "INPUT" || + clickedElement.nodeName == "TEXTAREA" || + clickedElement.nodeName == "SELECT" || + clickedElement.nodeName == "OPTION" || + clickedElement.nodeName == "BUTTON" || + clickedElement.nodeName == "LINK" || + clickedElement.nodeName == "MAP" || + clickedElement.nodeName == "A" || + clickedElement.nodeName == "HR") + return; + var tableRow = getParentByTagName(clickedElement, "TR"); + + while (tableRow != null) { + iconCellContents = tableRow.getElementsByTagName("input"); + + for (var i = 0; i < iconCellContents.length; i++) { + if (iconCellContents[i].id.indexOf("ViewButton") != -1) { + iconCellContents[i].click(); + rTableRowClickable = true; + return rTableRowClickable; + } + } + tableRow = getParentByTagName(tableRow, "TR") + } + + return null; + +} + + +/************************************************************************************** + * Description : Global variables used by the following functions: * + * moveToNextTableRow() * + * moveToPreviousTableRow() * + * moveToThisTableRow() * + * updateCurrentTableAndIndex() * + * highlightTableRow() * + * clickEditButtonOfTableRowInFocus() * + * ISD Feature : "Up/Down Arrow Keypress Navigation" * + * Authors : Samson Wong & Cocosoft B.V. * + **************************************************************************************/ +var justDoIt = true; +var currentTable = null; +var currentRow = null; +var currentRowIndex = 0; + +/************************************************************************************** + * Function : captureUpDownKey() * + * Description : Captures an "up/down arrow" and "enter" keyboard event, and calls * + * the respective function to process the event. * + * Parameters : pTableInFocus, html table receiving the keyboard event * + * event, browser-generated event object * + * Assumptions : Only table panels will call this function. * + * ISD Feature : "Up/Down Arrow Keypress Navigation" * + * Authors : Samson Wong & Cocosoft B.V. * + **************************************************************************************/ +function captureUpDownKey(pTableInFocus, event) { + + // capture current scroll position for "maintain position in tables" feature + setCurrentBrowserCoordinates(); + + if (justDoIt == true) { + // if focus is not on a drop-down list, nor the page size entry field (otherwise + // drop-down list navigation via up/down/enter keypress takes precedence) + if ((event.srcElement == null) || ((event.srcElement.nodeName != "SELECT") && ((event.srcElement.id).indexOf("PageSize") == -1))) { + + if (event.keyCode) { + + // if key down... + if (event.keyCode == 40) { + event.returnValue = false; + event.cancel = true; + event.cancelBubble = true; + if (event.stopPropagation) event.stopPropagation(); + moveToNextTableRow(pTableInFocus); + } + // if key up... + else if (event.keyCode == 38) { + event.returnValue = false; + event.cancel = true; + event.cancelBubble = true; + if (event.stopPropagation) event.stopPropagation(); + moveToPreviousTableRow(pTableInFocus); + } + // if enter key... + else if (event.keyCode == 13) { + if (clickEditButtonOfTableRowInFocus() == true) { + event.returnValue = false; + event.cancel = true; + event.cancelBubble = true; + if (event.stopPropagation) event.stopPropagation(); + } + // else let event bubble up to "enter key capture" code for the above column filter button + } + } + } + } +} + +/************************************************************************************** + * Function : captureEnterKeyInScrollingTable() * + * Description : Captures an "enter" keyboard event, and calls the respective * + * function to process the event. * + * Parameters : pTableInFocus, html table receiving the keyboard event * + * event, browser-generated event object * + * Assumptions : Only scrolling table panels will call this function. * + * ISD Feature : "Up/Down Arrow Keypress Navigation" * + * Authors : Samson Wong & Cocosoft B.V. * + **************************************************************************************/ +function captureEnterKeyInScrollingTable(pTableInFocus, event) { + + // capture current scroll position for "maintain position in tables" feature + setCurrentBrowserCoordinates(); + + if (justDoIt == true) { + + // for IE... + if (event.keyCode) { + // if enter key... + if (event.keyCode == 13) { + if (clickEditButtonOfTableRowInFocus() == true) { + event.returnValue = false; + event.cancel = true; + event.cancelBubble = true; + if (event.stopPropagation) event.stopPropagation(); + } + /* else let event bubble up to "enter key capture" code for the above column filter button */ + } + // if key down... + else if (event.keyCode == 40) { + event.returnValue = false; + event.cancel = true; + event.cancelBubble = true; + if (event.stopPropagation) event.stopPropagation(); + // ignore because up/down keypress functionality is not supported in scrolling tables + } + // if key up... + else if (event.keyCode == 38) { + event.returnValue = false; + event.cancel = true; + event.cancelBubble = true; + if (event.stopPropagation) event.stopPropagation(); + // ignore because up/down keypress functionality is not supported in scrolling tables + } + } + // if Netscape/Firefox... + else if (event.which) { + + // if enter key... + if (event.which == 13) { + if (clickEditButtonOfTableRowInFocus() == true) { + event.returnValue = false; + event.cancel = true; + event.cancelBubble = true; + if (event.stopPropagation) event.stopPropagation(); + } + /* else let event bubble up to "enter key capture" code for the above column filter button */ + } + // if key down... + else if (event.which == 40) { + event.returnValue = false; + event.cancel = true; + event.cancelBubble = true; + if (event.stopPropagation) event.stopPropagation(); + // ignore because up/down keypress functionality is not supported in scrolling tables + } + // if key up... + else if (event.which == 38) { + event.returnValue = false; + event.cancel = true; + event.cancelBubble = true; + if (event.stopPropagation) event.stopPropagation(); + // ignore because up/down keypress functionality is not supported in scrolling tables + } + } + } +} + +/************************************************************************************** + * Function : moveToNextTableRow() * + * Description : Upon "down arrow" keypress, disables "up/down arrow navigation" * + * highlight color on the current table row, and enables same on * + * the next table row. * + * Parameters : pTableInFocus, html table receiving the "down arrow" keyboard event * + * Assumptions : None. * + * ISD Feature : "Up/Down Arrow Keypress Navigation" * + * Authors : Samson Wong & Cocosoft B.V. * + **************************************************************************************/ +function moveToNextTableRow(pTableInFocus) { + var tableInFocus; + var tableRows; + var maxRowIndex; + var tableCells; + + if (justDoIt == true) { + + if (pTableInFocus != null) { + + // if focus is still within same table... + if (currentTable == pTableInFocus) + { + // determine the number of rows (including "header row") in this table + var maxRowIndex = getNumberOfTableRows(pTableInFocus); + + if (maxRowIndex > 0) + { + if (currentRowIndex >= maxRowIndex-1) + { + // wrap highlighting + currentRowIndex = 0; + } + + // if current row is not the last row of this table... + if ((currentRowIndex >= 0) && (currentRowIndex < maxRowIndex-1)) { + + if (tableRowHighlightable(getTableRow(currentRowIndex+1)) == true) { + + // unhighlight the current row + unhighlightTableRow(currentRow); + + // make previous row of this table the current row + currentRowIndex++; + + // highlight the (new) current row + highlightTableRow(getTableRow(currentRowIndex)); + } + } + } + } + else { + // make this new table in focus the current table + currentTable = pTableInFocus; + + moveToNextTableRow(currentTable); + } + } + } +} + +/************************************************************************************** + * Function : moveToPreviousTableRow() * + * Description : Upon "up arrow" keypress, disables the "up/down arrow navigation" * + * highlight color on the current table row, and enables same on * + * the previous table row. * + * Parameters : pTableInFocus, html table receiving the "down arrow" keyboard event * + * Assumptions : None. * + * ISD Feature : "Up/Down Arrow Keypress Navigation" * + * Authors : Samson Wong & Cocosoft B.V. * + **************************************************************************************/ +function moveToPreviousTableRow(pTableInFocus) { + + if (justDoIt == true) + { + if (pTableInFocus != null) + { + // if focus is still within same table... + if (currentTable == pTableInFocus) + { + // determine the number of rows (including "header row") in this table + var maxRowIndex = getNumberOfTableRows(pTableInFocus); + + if (maxRowIndex > 0) + { + if (currentRowIndex <= 1) + { + // wrap highlighting + currentRowIndex = maxRowIndex; + } + + // if current row is not the first row of this table... + if ((currentRowIndex > 1) && (currentRowIndex <= maxRowIndex)) + { + if (tableRowHighlightable(getTableRow(currentRowIndex-1)) == true) + { + // unhighlight the current row + unhighlightTableRow(currentRow); + + // make previous row of this table the current row + currentRowIndex--; + + // highlight the (new) current row + highlightTableRow(getTableRow(currentRowIndex)); + } + } + } + } + else { + // make this new table in focus the current table + currentTable = pTableInFocus; + + moveToPreviousTableRow(currentTable); + } + } + } +} + +/************************************************************************************** + * Function : moveToThisTableRow() * + * Description : Upon "radio button select", disables the "up/down arrow navigation" * + * highlight color on the current table row, and enables same on * + * the newly selected table row. * + * Parameters : pTableCell, "radio button" table cell selected * + * Assumptions : Only "radio button" table cells will call this function. * + * ISD Feature : "Up/Down Arrow Keypress Navigation" * + * Authors : Samson Wong & Cocosoft B.V. * + **************************************************************************************/ +function moveToThisTableRow(pTableCell) { + // capture current scroll position for "maintain position in tables" feature + setCurrentBrowserCoordinates(); + + if (justDoIt == true) { + + if (pTableCell != null) { + + var tableRow = pTableCell.parentNode; + + if (tableRow.nodeName == "TD") + { + tableRow = tableRow.parentNode; + } + + if (tableRowHighlightable(tableRow) == true) { + + var iconCellContents = tableRow.getElementsByTagName("input"); + + for (var i=(iconCellContents.length-1); i>=0; i--) + { + if (iconCellContents[i].type == "checkbox") + { + iconCellContents[i].focus(); + break; + } + } + + // if current row highlighted... + if (currentTable != null) + { + unhighlightTableRow(currentRow); + } + + // determine current table and index resulting from focus change + updateCurrentTableAndIndex(tableRow); + + // highlight (new) current table row + highlightTableRow(tableRow); + } + } + } +} + + +/************************************************************************************** + * Function : getTableRow() * + * Description : Retrieve the table row specified by pTableRowIndex in the "current" * + * table. * + * Parameters : pTableRowIndex, index of table row to retrieve * + * Assumptions : Global "currentTable" points to a valid table. * + * ISD Feature : "Up/Down Arrow Keypress Navigation" * + * Authors : Samson Wong & Cocosoft B.V. * + **************************************************************************************/ +function getTableRow(pTableRowIndex) +{ + var rTableRow = null; + + if (justDoIt == true) + { + if (currentTable != null) + { + var lTableRows = currentTable.getElementsByTagName("tr"); + var lTableRowIndex = 1; + + // if there are enough rows in the current table... + if (pTableRowIndex < lTableRows.length) + { + // while table row not found... + for (var i=1; i
with an ID defined by the + // global dateSelectorDivID variable. If such a div doesn't yet exist on the HTML + // document we're working with, add one. + if (!document.getElementById(dateSelectorDivID)) { + // don't use innerHTML to update the body, because it can cause global variables + // that are currently pointing to objects on the page to have bad references + //document.body.innerHTML += "
"; + var newNode = document.createElement("div"); + newNode.setAttribute("id", dateSelectorDivID); + newNode.setAttribute("class", "dpDiv"); + newNode.setAttribute("style", "visibility: hidden;"); + document.body.appendChild(newNode); + } + + // move the dateSelector div to the proper x,y coordinate and toggle the visiblity + var selectorDiv = document.getElementById(dateSelectorDivID); + selectorDiv.style.position = "absolute"; + selectorDiv.style.left = x + "px"; + selectorDiv.style.top = y + "px"; + selectorDiv.style.visibility = (selectorDiv.style.visibility == "visible" ? "hidden" : "visible"); + selectorDiv.style.display = (selectorDiv.style.display == "" ? "none" : ""); + selectorDiv.style.zIndex = 10000; + + // draw the dateSelector table + refreshDateSelector(targetDateField.name, dt.getFullYear(), dt.getMonth(), dt.getDate()); +} + + +/************************************************************************************** + * Function : refreshDateSelector() * + * Description : Function which actually does the drawing of the date selector * + * html table. * + * Parameters : dateFieldName, html element name of the "date input field" that * + * will be filled in if the user picks a date * + * year, year to highlight (optional) (default is today's year) * + * month, month to highlight (optional) (default is today's month) * + * day, day to highlight (optional) (default is today's day) * + * Returns: : None. * + * ISD Feature : "JavaScript Date Selector" * + * Authors : Julian Robichaux, http://www.nsftools.com, and Samson Wong * + **************************************************************************************/ +function refreshDateSelector(dateFieldName, year, month, day) +{ + // if no arguments are passed, use today's date; otherwise, month and year + // are required (if a day is passed, it will be highlighted later) + var thisDay = new Date(); + + if ((month >= 0) && (year > 0)) { + thisDay = new Date(year, month, 1); + } else { + day = thisDay.getDate(); + thisDay.setDate(1); + } + + // the calendar will be drawn as a table + // you can customize the table elements with a global CSS style sheet, + // or by hardcoding style and formatting elements below + var crlf = "\r\n"; + var TABLE = "" + crlf; + var xTABLE = "
" + crlf; + var TR = ""; + var TR_title = ""; + var TR_days = ""; + var TR_todaybutton = ""; + var xTR = "" + crlf; + var TD = ""; + + if (dayNum == day) + html += TD_selected + TD_onclick + DIV_selected + dayNum + xDIV + xTD; + else + html += TD + TD_onclick + dayNum + xTD; + + // if this is a Saturday, start a new row + if (thisDay.getDay() == 6) + html += xTR + TR; + + // increment the day + thisDay.setDate(thisDay.getDate() + 1); + } while (thisDay.getDate() > 1) + + // fill in any trailing blanks + if (thisDay.getDay() > 0) { + for (i = 6; i > thisDay.getDay(); i--) + html += TD_noDay + " " + xTD; + } + html += xTR; + + // add a button to allow the user to easily return to today, or close the calendar + var today = new Date(); + var todayString = "Today is " + dayArrayMed[today.getDay()] + ", " + monthArrayMed[ today.getMonth()] + " " + today.getDate(); + html += TR_todaybutton + TD_todaybutton; + + // sam + // html += " "; + html += "" + html += " "; + html += " "; + html += " "; + html += "
"; + + html += "" + html += " "; + html += " "; + html += " "; + html += " "; + html += " "; + html += " "; + html += " "; + html += " "; + html += " "; + html += " "; + html += " "; + html += " "; + html += " "; + html += " "; + html += " "; + html += "
Today
"; + + html += "
"; + html += " "; + + html += "" + html += " "; + html += " "; + html += " "; + html += " "; + html += " "; + html += " "; + html += " "; + html += " "; + html += " "; + html += " "; + html += " "; + html += " "; + html += " "; + html += " "; + html += " "; + html += "
Cancel
"; + + html += "
"; + + // html += ""; + html += xTD + xTR; + + // and finally, close the table + html += xTABLE; + + document.getElementById(dateSelectorDivID).innerHTML = html; + // add an "iFrame shim" to allow the dateSelector to display above selection lists + adjustiFrame(); +} + + + + +var mobileCurrentCalendarSender = null; + + +function mobileCalendarShownIntercept(e,h) { + if ( e == "years" || e == "months" ) { + return; + } + + mobileCurrentCalendarSender(e, h); +} + + + +function mobileCalendarShown(sender, e) { + mobileCurrentCalendarSender = sender; + sender._switchMode = mobileCalendarShownIntercept; +} + + + +/************************************************************************************** + * Function : getButtonCode() * + * Description : Helper function to construct the html for the previous/next * + * month/year buttons. * + * Parameters : dateFieldName, html element name of the "date input field" that * + * will be filled in if the user picks a date * + * dateVal, current date highlighted * + * adjust, number of months to move back/forward * + * label, previous/next month/year button image to use for this button * + * Returns: : The html for previous/next month/year button. * + * ISD Feature : "JavaScript Date Selector" * + * Authors : Julian Robichaux, http://www.nsftools.com, and Samson Wong * + **************************************************************************************/ +function getButtonCode(dateFieldName, dateVal, adjust, label) +{ + var newMonth = (dateVal.getMonth () + adjust) % 12; + var newYear = dateVal.getFullYear() + parseInt((dateVal.getMonth() + adjust) / 12); + if (newMonth < 0) { + newMonth += 12; + newYear += -1; + } + + // sam + // return ""; + return "
" +} + + +/************************************************************************************** + * Function : getDateString() * + * Description : Convert a JavaScript Date object to a string, based on the * + * dateFormat and dateSeparator variables at the beginning of this * + * script library. * + * Parameters : dateVal, current date highlighted * + * Returns: : The highlighted date as a string. * + * ISD Feature : "JavaScript Date Selector" * + * Authors : Julian Robichaux, http://www.nsftools.com, and Samson Wong * + **************************************************************************************/ +function getDateString(dateVal) +{ + var dayString = "00" + dateVal.getDate(); + var monthString = "00" + (dateVal.getMonth()+1); + dayString = dayString.substring(dayString.length - 2); + monthString = monthString.substring(monthString.length - 2); + + switch (dateFormat) { + case "dmy" : + return dayString + dateSeparator + monthString + dateSeparator + dateVal.getFullYear(); + case "ymd" : + return dateVal.getFullYear() + dateSeparator + monthString + dateSeparator + dayString; + case "mdy" : + default : + return monthString + dateSeparator + dayString + dateSeparator + dateVal.getFullYear(); + } +} + + +/************************************************************************************** + * Function : getFieldDate() * + * Description : Converts a string to a JavaScript Date objec * + * Parameters : dateString, date string to be converted into a JavaScript Date * + * object. * + * Returns: : The date string as a JavaScript Date object. * + * ISD Feature : "JavaScript Date Selector" * + * Authors : Julian Robichaux, http://www.nsftools.com, and Samson Wong * + **************************************************************************************/ +function getFieldDate(dateString) +{ + var dateVal; + var dArray; + var d, m, y; + + try { + dArray = splitDateString(dateString); + if (dArray) { + switch (dateFormat) { + case "dmy" : + d = parseInt(dArray[0], 10); + m = parseInt(dArray[1], 10) - 1; + y = parseInt(dArray[2], 10); + break; + case "ymd" : + d = parseInt(dArray[2], 10); + m = parseInt(dArray[1], 10) - 1; + y = parseInt(dArray[0], 10); + break; + case "mdy" : + default : + d = parseInt(dArray[1], 10); + m = parseInt(dArray[0], 10) - 1; + y = parseInt(dArray[2], 10); + break; + } + dateVal = new Date(y, m, d); + } else if (dateString) { + dateVal = new Date(dateString); + } else { + dateVal = new Date(); + } + } catch(e) { + dateVal = new Date(); + } + + return dateVal; +} + + +/************************************************************************************** + * Function : splitDateString() * + * Description : Splits a date string into an array of elements, using common date * + * separators. * + * Parameters : dateString, date string to be converted into a JavaScript Date * + * object. * + * Returns: : The split date array, if operation successful; false, otherwise. * + * ISD Feature : "JavaScript Date Selector" * + * Authors : Julian Robichaux, http://www.nsftools.com, and Samson Wong * + **************************************************************************************/ +function splitDateString(dateString) +{ + var dArray; + if (dateString.indexOf("/") >= 0) + dArray = dateString.split("/"); + else if (dateString.indexOf(".") >= 0) + dArray = dateString.split("."); + else if (dateString.indexOf("-") >= 0) + dArray = dateString.split("-"); + else if (dateString.indexOf("\\") >= 0) + dArray = dateString.split("\\"); + else + dArray = false; + + return dArray; +} + + +/************************************************************************************** + * Function : dateSelectorClosed() * + * Description : Update the "date input field" with the date string, and hide the * + * date selector. If no date string is passed, just close the * + * date selector without changing the field value. * + * Parameters : dateFieldName, html element name of the "date input field" that * + * will be filled in if the user picks a date * + * dateString, date string with which the "date input field" is to be * + * updated. * + * Returns: : None. * + * ISD Feature : "JavaScript Date Selector" * + * Authors : Julian Robichaux, http://www.nsftools.com, and Samson Wong * + **************************************************************************************/ +/** +If the page developer has defined a function called dateSelectorClosed anywhere on +the page or in an imported library, we will attempt to run that function with the updated +field as a parameter. This can be used for such things as date validation, setting default +values for related fields, etc. For example, you might have a function like this to validate +a start date field: + +function dateSelectorClosed(dateField) +{ + var dateObj = getFieldDate(dateField.value); + var today = new Date(); + today = new Date(today.getFullYear(), today.getMonth(), today.getDate()); + + if (dateField.name == "StartDate") { + if (dateObj < today) { + // if the date is before today, alert the user and display the dateSelector again + alert("Please enter a date that is today or later"); + dateField.value = ""; + document.getElementById(dateSelectorDivID).style.visibility = "visible"; + adjustiFrame(); + } else { + // if the date is okay, set the EndDate field to 7 days after the StartDate + dateObj.setTime(dateObj.getTime() + (7 * 24 * 60 * 60 * 1000)); + var endDateField = document.getElementsByName ("EndDate").item(0); + endDateField.value = getDateString(dateObj); + } + } +} + +*/ +function updateDateField(dateFieldName, dateString) +{ + var targetDateField = document.getElementsByName (dateFieldName).item(0); + if (dateString) + targetDateField.value = dateString; + + var selectorDiv = document.getElementById(dateSelectorDivID); + selectorDiv.style.visibility = "hidden"; + selectorDiv.style.display = "none"; + + adjustiFrame(); + targetDateField.focus(); + + // after the dateSelector has closed, optionally run a user-defined function called + // dateSelectorClosed, passing the field that was just updated as a parameter + // (note that this will only run if the user actually selected a date from the dateSelector) + if ((dateString) && (typeof(dateSelectorClosed) == "function")) + dateSelectorClosed(targetDateField); +} + + +/************************************************************************************** + * Function : adjustiFrame() * + * Description : Uses an "iFrame shim" to deal with problems where the dateSelector * + * shows up behind selection list elements, if they're below the * + * date selector. * + * The problem and solution are described at: * + * http://dotnetjunkies.com/WebLog/jking/archive/2003/07/21/488.aspx * + * http://dotnetjunkies.com/WebLog/jking/archive/2003/10/30/2975.aspx * + * Parameters : selectorDiv, html div containing date selector * + * iFrameDiv, html div containing iframe shim. * + * Returns: : None. * + * ISD Feature : "JavaScript Date Selector" * + * Authors : Julian Robichaux, http://www.nsftools.com, and Samson Wong * + **************************************************************************************/ +function adjustiFrame(selectorDiv, iFrameDiv) +{ + // we know that Opera doesn't like something about this, so if we + // think we're using Opera, don't even try + var is_opera = (navigator.userAgent.toLowerCase().indexOf("opera") != -1); + if (is_opera) + return; + + // put a try/catch block around the whole thing, just in case + try { + if (!document.getElementById(iFrameDivID)) { + // don't use innerHTML to update the body, because it can cause global variables + // that are currently pointing to objects on the page to have bad references + //document.body.innerHTML += " + + + + + diff --git a/FCKeditor/editor/dialog/fck_docprops/fck_document_preview.html b/FCKeditor/editor/dialog/fck_docprops/fck_document_preview.html new file mode 100644 index 0000000..7d0fa94 --- /dev/null +++ b/FCKeditor/editor/dialog/fck_docprops/fck_document_preview.html @@ -0,0 +1,113 @@ + + + + + Document Properties - Preview + + + + + + + + + + + + + + +
+ Normal Text +
+ Visited Link + + Active Link +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ + diff --git a/FCKeditor/editor/dialog/fck_flash.html b/FCKeditor/editor/dialog/fck_flash.html new file mode 100644 index 0000000..eb42cf3 --- /dev/null +++ b/FCKeditor/editor/dialog/fck_flash.html @@ -0,0 +1,146 @@ + + + + + Flash Properties + + + + + + + +
+ + + + + + + + + + +
+ + + + + + + + +
URL +
+
+
+ + + + + + +
+ Width
+ +
  + Height
+ +
+
+ + + + +
+ + + + + + + +
Preview
+
+
+
+ + + + diff --git a/FCKeditor/editor/dialog/fck_flash/fck_flash.js b/FCKeditor/editor/dialog/fck_flash/fck_flash.js new file mode 100644 index 0000000..8ed3add --- /dev/null +++ b/FCKeditor/editor/dialog/fck_flash/fck_flash.js @@ -0,0 +1,285 @@ +/* + * FCKeditor - The text editor for Internet - http://www.fckeditor.net + * Copyright (C) 2003-2007 Frederico Caldeira Knabben + * + * == BEGIN LICENSE == + * + * Licensed under the terms of any of the following licenses at your + * choice: + * + * - GNU General Public License Version 2 or later (the "GPL") + * http://www.gnu.org/licenses/gpl.html + * + * - GNU Lesser General Public License Version 2.1 or later (the "LGPL") + * http://www.gnu.org/licenses/lgpl.html + * + * - Mozilla Public License Version 1.1 or later (the "MPL") + * http://www.mozilla.org/MPL/MPL-1.1.html + * + * == END LICENSE == + * + * Scripts related to the Flash dialog window (see fck_flash.html). + */ + +var oEditor = window.parent.InnerDialogLoaded() ; +var FCK = oEditor.FCK ; +var FCKLang = oEditor.FCKLang ; +var FCKConfig = oEditor.FCKConfig ; + +//#### Dialog Tabs + +// Set the dialog tabs. +window.parent.AddTab( 'Info', oEditor.FCKLang.DlgInfoTab ) ; + +if ( FCKConfig.FlashUpload ) + window.parent.AddTab( 'Upload', FCKLang.DlgLnkUpload ) ; + +if ( !FCKConfig.FlashDlgHideAdvanced ) + window.parent.AddTab( 'Advanced', oEditor.FCKLang.DlgAdvancedTag ) ; + +// Function called when a dialog tag is selected. +function OnDialogTabChange( tabCode ) +{ + ShowE('divInfo' , ( tabCode == 'Info' ) ) ; + ShowE('divUpload' , ( tabCode == 'Upload' ) ) ; + ShowE('divAdvanced' , ( tabCode == 'Advanced' ) ) ; +} + +// Get the selected flash embed (if available). +var oFakeImage = FCK.Selection.GetSelectedElement() ; +var oEmbed ; + +if ( oFakeImage ) +{ + if ( oFakeImage.tagName == 'IMG' && oFakeImage.getAttribute('_fckflash') ) + oEmbed = FCK.GetRealElement( oFakeImage ) ; + else + oFakeImage = null ; +} + +window.onload = function() +{ + // Translate the dialog box texts. + oEditor.FCKLanguageManager.TranslatePage(document) ; + + // Load the selected element information (if any). + LoadSelection() ; + + // Show/Hide the "Browse Server" button. + GetE('tdBrowse').style.display = FCKConfig.FlashBrowser ? '' : 'none' ; + + // Set the actual uploader URL. + if ( FCKConfig.FlashUpload ) + GetE('frmUpload').action = FCKConfig.FlashUploadURL ; + + window.parent.SetAutoSize( true ) ; + + // Activate the "OK" button. + window.parent.SetOkButton( true ) ; +} + +function LoadSelection() +{ + if ( ! oEmbed ) return ; + + GetE('txtUrl').value = GetAttribute( oEmbed, 'src', '' ) ; + GetE('txtWidth').value = GetAttribute( oEmbed, 'width', '' ) ; + GetE('txtHeight').value = GetAttribute( oEmbed, 'height', '' ) ; + + // Get Advances Attributes + GetE('txtAttId').value = oEmbed.id ; + GetE('chkAutoPlay').checked = GetAttribute( oEmbed, 'play', 'true' ) == 'true' ; + GetE('chkLoop').checked = GetAttribute( oEmbed, 'loop', 'true' ) == 'true' ; + GetE('chkMenu').checked = GetAttribute( oEmbed, 'menu', 'true' ) == 'true' ; + GetE('cmbScale').value = GetAttribute( oEmbed, 'scale', '' ).toLowerCase() ; + + GetE('txtAttTitle').value = oEmbed.title ; + + if ( oEditor.FCKBrowserInfo.IsIE ) + { + GetE('txtAttClasses').value = oEmbed.getAttribute('className') || '' ; + GetE('txtAttStyle').value = oEmbed.style.cssText ; + } + else + { + GetE('txtAttClasses').value = oEmbed.getAttribute('class',2) || '' ; + GetE('txtAttStyle').value = oEmbed.getAttribute('style',2) || '' ; + } + + UpdatePreview() ; +} + +//#### The OK button was hit. +function Ok() +{ + if ( GetE('txtUrl').value.length == 0 ) + { + window.parent.SetSelectedTab( 'Info' ) ; + GetE('txtUrl').focus() ; + + alert( oEditor.FCKLang.DlgAlertUrl ) ; + + return false ; + } + + oEditor.FCKUndo.SaveUndoStep() ; + if ( !oEmbed ) + { + oEmbed = FCK.EditorDocument.createElement( 'EMBED' ) ; + oFakeImage = null ; + } + UpdateEmbed( oEmbed ) ; + + if ( !oFakeImage ) + { + oFakeImage = oEditor.FCKDocumentProcessor_CreateFakeImage( 'FCK__Flash', oEmbed ) ; + oFakeImage.setAttribute( '_fckflash', 'true', 0 ) ; + oFakeImage = FCK.InsertElement( oFakeImage ) ; + } + + oEditor.FCKFlashProcessor.RefreshView( oFakeImage, oEmbed ) ; + + return true ; +} + +function UpdateEmbed( e ) +{ + SetAttribute( e, 'type' , 'application/x-shockwave-flash' ) ; + SetAttribute( e, 'pluginspage' , 'http://www.macromedia.com/go/getflashplayer' ) ; + + SetAttribute( e, 'src', GetE('txtUrl').value ) ; + SetAttribute( e, "width" , GetE('txtWidth').value ) ; + SetAttribute( e, "height", GetE('txtHeight').value ) ; + + // Advances Attributes + + SetAttribute( e, 'id' , GetE('txtAttId').value ) ; + SetAttribute( e, 'scale', GetE('cmbScale').value ) ; + + SetAttribute( e, 'play', GetE('chkAutoPlay').checked ? 'true' : 'false' ) ; + SetAttribute( e, 'loop', GetE('chkLoop').checked ? 'true' : 'false' ) ; + SetAttribute( e, 'menu', GetE('chkMenu').checked ? 'true' : 'false' ) ; + + SetAttribute( e, 'title' , GetE('txtAttTitle').value ) ; + + if ( oEditor.FCKBrowserInfo.IsIE ) + { + SetAttribute( e, 'className', GetE('txtAttClasses').value ) ; + e.style.cssText = GetE('txtAttStyle').value ; + } + else + { + SetAttribute( e, 'class', GetE('txtAttClasses').value ) ; + SetAttribute( e, 'style', GetE('txtAttStyle').value ) ; + } +} + +var ePreview ; + +function SetPreviewElement( previewEl ) +{ + ePreview = previewEl ; + + if ( GetE('txtUrl').value.length > 0 ) + UpdatePreview() ; +} + +function UpdatePreview() +{ + if ( !ePreview ) + return ; + + while ( ePreview.firstChild ) + ePreview.removeChild( ePreview.firstChild ) ; + + if ( GetE('txtUrl').value.length == 0 ) + ePreview.innerHTML = ' ' ; + else + { + var oDoc = ePreview.ownerDocument || ePreview.document ; + var e = oDoc.createElement( 'EMBED' ) ; + + SetAttribute( e, 'src', GetE('txtUrl').value ) ; + SetAttribute( e, 'type', 'application/x-shockwave-flash' ) ; + SetAttribute( e, 'width', '100%' ) ; + SetAttribute( e, 'height', '100%' ) ; + + ePreview.appendChild( e ) ; + } +} + +// + +function BrowseServer() +{ + OpenFileBrowser( FCKConfig.FlashBrowserURL, FCKConfig.FlashBrowserWindowWidth, FCKConfig.FlashBrowserWindowHeight ) ; +} + +function SetUrl( url, width, height ) +{ + GetE('txtUrl').value = url ; + + if ( width ) + GetE('txtWidth').value = width ; + + if ( height ) + GetE('txtHeight').value = height ; + + UpdatePreview() ; + + window.parent.SetSelectedTab( 'Info' ) ; +} + +function OnUploadCompleted( errorNumber, fileUrl, fileName, customMsg ) +{ + switch ( errorNumber ) + { + case 0 : // No errors + alert( 'Your file has been successfully uploaded' ) ; + break ; + case 1 : // Custom error + alert( customMsg ) ; + return ; + case 101 : // Custom warning + alert( customMsg ) ; + break ; + case 201 : + alert( 'A file with the same name is already available. The uploaded file has been renamed to "' + fileName + '"' ) ; + break ; + case 202 : + alert( 'Invalid file type' ) ; + return ; + case 203 : + alert( "Security error. You probably don't have enough permissions to upload. Please check your server." ) ; + return ; + default : + alert( 'Error on file upload. Error number: ' + errorNumber ) ; + return ; + } + + SetUrl( fileUrl ) ; + GetE('frmUpload').reset() ; +} + +var oUploadAllowedExtRegex = new RegExp( FCKConfig.FlashUploadAllowedExtensions, 'i' ) ; +var oUploadDeniedExtRegex = new RegExp( FCKConfig.FlashUploadDeniedExtensions, 'i' ) ; + +function CheckUpload() +{ + var sFile = GetE('txtUploadFile').value ; + + if ( sFile.length == 0 ) + { + alert( 'Please select a file to upload' ) ; + return false ; + } + + if ( ( FCKConfig.FlashUploadAllowedExtensions.length > 0 && !oUploadAllowedExtRegex.test( sFile ) ) || + ( FCKConfig.FlashUploadDeniedExtensions.length > 0 && oUploadDeniedExtRegex.test( sFile ) ) ) + { + OnUploadCompleted( 202 ) ; + return false ; + } + + return true ; +} diff --git a/FCKeditor/editor/dialog/fck_flash/fck_flash_preview.html b/FCKeditor/editor/dialog/fck_flash/fck_flash_preview.html new file mode 100644 index 0000000..4e9381f --- /dev/null +++ b/FCKeditor/editor/dialog/fck_flash/fck_flash_preview.html @@ -0,0 +1,46 @@ + + + + + + + + + + + + diff --git a/FCKeditor/editor/dialog/fck_form.html b/FCKeditor/editor/dialog/fck_form.html new file mode 100644 index 0000000..fb9a5b9 --- /dev/null +++ b/FCKeditor/editor/dialog/fck_form.html @@ -0,0 +1,107 @@ + + + + + + + + + + + + + + + +
+ + + + + + + + + + +
+ Name
+ +
+ Action
+ +
+ Method
+ +
+
+ + diff --git a/FCKeditor/editor/dialog/fck_hiddenfield.html b/FCKeditor/editor/dialog/fck_hiddenfield.html new file mode 100644 index 0000000..d7c4d40 --- /dev/null +++ b/FCKeditor/editor/dialog/fck_hiddenfield.html @@ -0,0 +1,119 @@ + + + + + Hidden Field Properties + + + + + + + + + + +
+ + + + + + + +
+ Name
+ +
+ Value
+ +
+
+ + diff --git a/FCKeditor/editor/dialog/fck_image.html b/FCKeditor/editor/dialog/fck_image.html new file mode 100644 index 0000000..aa910f1 --- /dev/null +++ b/FCKeditor/editor/dialog/fck_image.html @@ -0,0 +1,252 @@ + + + + + Image Properties + + + + + + + +
+ + + + + + + + + + +
+ + + + + + + + +
+ URL +
+ +
+
+ Short Description
+
+
+ + + + + + +
+
+ + + + + + + + + + + +
+ Width  + +
+
+
+
+
+
+ Height  +
+
+ + + + + + + + + + + + + + + + + +
+ Border  +
+ HSpace  +
+ VSpace  +
+ Align  + +
+
+     + + + + + + + +
+ Preview
+ +
+
+
+
+ + + + + diff --git a/FCKeditor/editor/dialog/fck_image/fck_image.js b/FCKeditor/editor/dialog/fck_image/fck_image.js new file mode 100644 index 0000000..4e6e0ad --- /dev/null +++ b/FCKeditor/editor/dialog/fck_image/fck_image.js @@ -0,0 +1,492 @@ +/* + * FCKeditor - The text editor for Internet - http://www.fckeditor.net + * Copyright (C) 2003-2007 Frederico Caldeira Knabben + * + * == BEGIN LICENSE == + * + * Licensed under the terms of any of the following licenses at your + * choice: + * + * - GNU General Public License Version 2 or later (the "GPL") + * http://www.gnu.org/licenses/gpl.html + * + * - GNU Lesser General Public License Version 2.1 or later (the "LGPL") + * http://www.gnu.org/licenses/lgpl.html + * + * - Mozilla Public License Version 1.1 or later (the "MPL") + * http://www.mozilla.org/MPL/MPL-1.1.html + * + * == END LICENSE == + * + * Scripts related to the Image dialog window (see fck_image.html). + */ + +var oEditor = window.parent.InnerDialogLoaded() ; +var FCK = oEditor.FCK ; +var FCKLang = oEditor.FCKLang ; +var FCKConfig = oEditor.FCKConfig ; +var FCKDebug = oEditor.FCKDebug ; + +var bImageButton = ( document.location.search.length > 0 && document.location.search.substr(1) == 'ImageButton' ) ; + +//#### Dialog Tabs + +// Set the dialog tabs. +window.parent.AddTab( 'Info', FCKLang.DlgImgInfoTab ) ; + +if ( !bImageButton && !FCKConfig.ImageDlgHideLink ) + window.parent.AddTab( 'Link', FCKLang.DlgImgLinkTab ) ; + +if ( FCKConfig.ImageUpload ) + window.parent.AddTab( 'Upload', FCKLang.DlgLnkUpload ) ; + +if ( !FCKConfig.ImageDlgHideAdvanced ) + window.parent.AddTab( 'Advanced', FCKLang.DlgAdvancedTag ) ; + +// Function called when a dialog tag is selected. +function OnDialogTabChange( tabCode ) +{ + ShowE('divInfo' , ( tabCode == 'Info' ) ) ; + ShowE('divLink' , ( tabCode == 'Link' ) ) ; + ShowE('divUpload' , ( tabCode == 'Upload' ) ) ; + ShowE('divAdvanced' , ( tabCode == 'Advanced' ) ) ; +} + +// Get the selected image (if available). +var oImage = FCK.Selection.GetSelectedElement() ; + +if ( oImage && oImage.tagName != 'IMG' && !( oImage.tagName == 'INPUT' && oImage.type == 'image' ) ) + oImage = null ; + +// Get the active link. +var oLink = FCK.Selection.MoveToAncestorNode( 'A' ) ; + +var oImageOriginal ; + +function UpdateOriginal( resetSize ) +{ + if ( !eImgPreview ) + return ; + + if ( GetE('txtUrl').value.length == 0 ) + { + oImageOriginal = null ; + return ; + } + + oImageOriginal = document.createElement( 'IMG' ) ; // new Image() ; + + if ( resetSize ) + { + oImageOriginal.onload = function() + { + this.onload = null ; + ResetSizes() ; + } + } + + oImageOriginal.src = eImgPreview.src ; +} + +var bPreviewInitialized ; + +window.onload = function() +{ + // Translate the dialog box texts. + oEditor.FCKLanguageManager.TranslatePage(document) ; + + GetE('btnLockSizes').title = FCKLang.DlgImgLockRatio ; + GetE('btnResetSize').title = FCKLang.DlgBtnResetSize ; + + // Load the selected element information (if any). + LoadSelection() ; + + // Show/Hide the "Browse Server" button. + GetE('tdBrowse').style.display = FCKConfig.ImageBrowser ? '' : 'none' ; + GetE('divLnkBrowseServer').style.display = FCKConfig.LinkBrowser ? '' : 'none' ; + + UpdateOriginal() ; + + // Set the actual uploader URL. + if ( FCKConfig.ImageUpload ) + GetE('frmUpload').action = FCKConfig.ImageUploadURL ; + + window.parent.SetAutoSize( true ) ; + + // Activate the "OK" button. + window.parent.SetOkButton( true ) ; +} + +function LoadSelection() +{ + if ( ! oImage ) return ; + + var sUrl = oImage.getAttribute( '_fcksavedurl' ) ; + if ( sUrl == null ) + sUrl = GetAttribute( oImage, 'src', '' ) ; + + GetE('txtUrl').value = sUrl ; + GetE('txtAlt').value = GetAttribute( oImage, 'alt', '' ) ; + GetE('txtVSpace').value = GetAttribute( oImage, 'vspace', '' ) ; + GetE('txtHSpace').value = GetAttribute( oImage, 'hspace', '' ) ; + GetE('txtBorder').value = GetAttribute( oImage, 'border', '' ) ; + GetE('cmbAlign').value = GetAttribute( oImage, 'align', '' ) ; + + var iWidth, iHeight ; + + var regexSize = /^\s*(\d+)px\s*$/i ; + + if ( oImage.style.width ) + { + var aMatchW = oImage.style.width.match( regexSize ) ; + if ( aMatchW ) + { + iWidth = aMatchW[1] ; + oImage.style.width = '' ; + SetAttribute( oImage, 'width' , iWidth ) ; + } + } + + if ( oImage.style.height ) + { + var aMatchH = oImage.style.height.match( regexSize ) ; + if ( aMatchH ) + { + iHeight = aMatchH[1] ; + oImage.style.height = '' ; + SetAttribute( oImage, 'height', iHeight ) ; + } + } + + GetE('txtWidth').value = iWidth ? iWidth : GetAttribute( oImage, "width", '' ) ; + GetE('txtHeight').value = iHeight ? iHeight : GetAttribute( oImage, "height", '' ) ; + + // Get Advances Attributes + GetE('txtAttId').value = oImage.id ; + GetE('cmbAttLangDir').value = oImage.dir ; + GetE('txtAttLangCode').value = oImage.lang ; + GetE('txtAttTitle').value = oImage.title ; + GetE('txtLongDesc').value = oImage.longDesc ; + + if ( oEditor.FCKBrowserInfo.IsIE ) + { + GetE('txtAttClasses').value = oImage.className || '' ; + GetE('txtAttStyle').value = oImage.style.cssText ; + } + else + { + GetE('txtAttClasses').value = oImage.getAttribute('class',2) || '' ; + GetE('txtAttStyle').value = oImage.getAttribute('style',2) ; + } + + if ( oLink ) + { + var sLinkUrl = oLink.getAttribute( '_fcksavedurl' ) ; + if ( sLinkUrl == null ) + sLinkUrl = oLink.getAttribute('href',2) ; + + GetE('txtLnkUrl').value = sLinkUrl ; + GetE('cmbLnkTarget').value = oLink.target ; + } + + UpdatePreview() ; +} + +//#### The OK button was hit. +function Ok() +{ + if ( GetE('txtUrl').value.length == 0 ) + { + window.parent.SetSelectedTab( 'Info' ) ; + GetE('txtUrl').focus() ; + + alert( FCKLang.DlgImgAlertUrl ) ; + + return false ; + } + + var bHasImage = ( oImage != null ) ; + + if ( bHasImage && bImageButton && oImage.tagName == 'IMG' ) + { + if ( confirm( 'Do you want to transform the selected image on a image button?' ) ) + oImage = null ; + } + else if ( bHasImage && !bImageButton && oImage.tagName == 'INPUT' ) + { + if ( confirm( 'Do you want to transform the selected image button on a simple image?' ) ) + oImage = null ; + } + + oEditor.FCKUndo.SaveUndoStep() ; + if ( !bHasImage ) + { + if ( bImageButton ) + { + oImage = FCK.EditorDocument.createElement( 'input' ) ; + oImage.type = 'image' ; + oImage = FCK.InsertElement( oImage ) ; + } + else + oImage = FCK.InsertElement( 'img' ) ; + } + + UpdateImage( oImage ) ; + + var sLnkUrl = GetE('txtLnkUrl').value.Trim() ; + + if ( sLnkUrl.length == 0 ) + { + if ( oLink ) + FCK.ExecuteNamedCommand( 'Unlink' ) ; + } + else + { + if ( oLink ) // Modifying an existent link. + oLink.href = sLnkUrl ; + else // Creating a new link. + { + if ( !bHasImage ) + oEditor.FCKSelection.SelectNode( oImage ) ; + + oLink = oEditor.FCK.CreateLink( sLnkUrl )[0] ; + + if ( !bHasImage ) + { + oEditor.FCKSelection.SelectNode( oLink ) ; + oEditor.FCKSelection.Collapse( false ) ; + } + } + + SetAttribute( oLink, '_fcksavedurl', sLnkUrl ) ; + SetAttribute( oLink, 'target', GetE('cmbLnkTarget').value ) ; + } + + return true ; +} + +function UpdateImage( e, skipId ) +{ + e.src = GetE('txtUrl').value ; + SetAttribute( e, "_fcksavedurl", GetE('txtUrl').value ) ; + SetAttribute( e, "alt" , GetE('txtAlt').value ) ; + SetAttribute( e, "width" , GetE('txtWidth').value ) ; + SetAttribute( e, "height", GetE('txtHeight').value ) ; + SetAttribute( e, "vspace", GetE('txtVSpace').value ) ; + SetAttribute( e, "hspace", GetE('txtHSpace').value ) ; + SetAttribute( e, "border", GetE('txtBorder').value ) ; + SetAttribute( e, "align" , GetE('cmbAlign').value ) ; + + // Advances Attributes + + if ( ! skipId ) + SetAttribute( e, 'id', GetE('txtAttId').value ) ; + + SetAttribute( e, 'dir' , GetE('cmbAttLangDir').value ) ; + SetAttribute( e, 'lang' , GetE('txtAttLangCode').value ) ; + SetAttribute( e, 'title' , GetE('txtAttTitle').value ) ; + SetAttribute( e, 'longDesc' , GetE('txtLongDesc').value ) ; + + if ( oEditor.FCKBrowserInfo.IsIE ) + { + e.className = GetE('txtAttClasses').value ; + e.style.cssText = GetE('txtAttStyle').value ; + } + else + { + SetAttribute( e, 'class' , GetE('txtAttClasses').value ) ; + SetAttribute( e, 'style', GetE('txtAttStyle').value ) ; + } +} + +var eImgPreview ; +var eImgPreviewLink ; + +function SetPreviewElements( imageElement, linkElement ) +{ + eImgPreview = imageElement ; + eImgPreviewLink = linkElement ; + + UpdatePreview() ; + UpdateOriginal() ; + + bPreviewInitialized = true ; +} + +function UpdatePreview() +{ + if ( !eImgPreview || !eImgPreviewLink ) + return ; + + if ( GetE('txtUrl').value.length == 0 ) + eImgPreviewLink.style.display = 'none' ; + else + { + UpdateImage( eImgPreview, true ) ; + + if ( GetE('txtLnkUrl').value.Trim().length > 0 ) + eImgPreviewLink.href = 'javascript:void(null);' ; + else + SetAttribute( eImgPreviewLink, 'href', '' ) ; + + eImgPreviewLink.style.display = '' ; + } +} + +var bLockRatio = true ; + +function SwitchLock( lockButton ) +{ + bLockRatio = !bLockRatio ; + lockButton.className = bLockRatio ? 'BtnLocked' : 'BtnUnlocked' ; + lockButton.title = bLockRatio ? 'Lock sizes' : 'Unlock sizes' ; + + if ( bLockRatio ) + { + if ( GetE('txtWidth').value.length > 0 ) + OnSizeChanged( 'Width', GetE('txtWidth').value ) ; + else + OnSizeChanged( 'Height', GetE('txtHeight').value ) ; + } +} + +// Fired when the width or height input texts change +function OnSizeChanged( dimension, value ) +{ + // Verifies if the aspect ration has to be maintained + if ( oImageOriginal && bLockRatio ) + { + var e = dimension == 'Width' ? GetE('txtHeight') : GetE('txtWidth') ; + + if ( value.length == 0 || isNaN( value ) ) + { + e.value = '' ; + return ; + } + + if ( dimension == 'Width' ) + value = value == 0 ? 0 : Math.round( oImageOriginal.height * ( value / oImageOriginal.width ) ) ; + else + value = value == 0 ? 0 : Math.round( oImageOriginal.width * ( value / oImageOriginal.height ) ) ; + + if ( !isNaN( value ) ) + e.value = value ; + } + + UpdatePreview() ; +} + +// Fired when the Reset Size button is clicked +function ResetSizes() +{ + if ( ! oImageOriginal ) return ; + + GetE('txtWidth').value = oImageOriginal.width ; + GetE('txtHeight').value = oImageOriginal.height ; + + UpdatePreview() ; +} + +function BrowseServer() +{ + OpenServerBrowser( + 'Image', + FCKConfig.ImageBrowserURL, + FCKConfig.ImageBrowserWindowWidth, + FCKConfig.ImageBrowserWindowHeight ) ; +} + +function LnkBrowseServer() +{ + OpenServerBrowser( + 'Link', + FCKConfig.LinkBrowserURL, + FCKConfig.LinkBrowserWindowWidth, + FCKConfig.LinkBrowserWindowHeight ) ; +} + +function OpenServerBrowser( type, url, width, height ) +{ + sActualBrowser = type ; + OpenFileBrowser( url, width, height ) ; +} + +var sActualBrowser ; + +function SetUrl( url, width, height, alt ) +{ + if ( sActualBrowser == 'Link' ) + { + GetE('txtLnkUrl').value = url ; + UpdatePreview() ; + } + else + { + GetE('txtUrl').value = url ; + GetE('txtWidth').value = width ? width : '' ; + GetE('txtHeight').value = height ? height : '' ; + + if ( alt ) + GetE('txtAlt').value = alt; + + UpdatePreview() ; + UpdateOriginal( true ) ; + } + + window.parent.SetSelectedTab( 'Info' ) ; +} + +function OnUploadCompleted( errorNumber, fileUrl, fileName, customMsg ) +{ + switch ( errorNumber ) + { + case 0 : // No errors + alert( 'Your file has been successfully uploaded' ) ; + break ; + case 1 : // Custom error + alert( customMsg ) ; + return ; + case 101 : // Custom warning + alert( customMsg ) ; + break ; + case 201 : + alert( 'A file with the same name is already available. The uploaded file has been renamed to "' + fileName + '"' ) ; + break ; + case 202 : + alert( 'Invalid file type' ) ; + return ; + case 203 : + alert( "Security error. You probably don't have enough permissions to upload. Please check your server." ) ; + return ; + default : + alert( 'Error on file upload. Error number: ' + errorNumber ) ; + return ; + } + + sActualBrowser = '' ; + SetUrl( fileUrl ) ; + GetE('frmUpload').reset() ; +} + +var oUploadAllowedExtRegex = new RegExp( FCKConfig.ImageUploadAllowedExtensions, 'i' ) ; +var oUploadDeniedExtRegex = new RegExp( FCKConfig.ImageUploadDeniedExtensions, 'i' ) ; + +function CheckUpload() +{ + var sFile = GetE('txtUploadFile').value ; + + if ( sFile.length == 0 ) + { + alert( 'Please select a file to upload' ) ; + return false ; + } + + if ( ( FCKConfig.ImageUploadAllowedExtensions.length > 0 && !oUploadAllowedExtRegex.test( sFile ) ) || + ( FCKConfig.ImageUploadDeniedExtensions.length > 0 && oUploadDeniedExtRegex.test( sFile ) ) ) + { + OnUploadCompleted( 202 ) ; + return false ; + } + + return true ; +} diff --git a/FCKeditor/editor/dialog/fck_image/fck_image_preview.html b/FCKeditor/editor/dialog/fck_image/fck_image_preview.html new file mode 100644 index 0000000..58cf771 --- /dev/null +++ b/FCKeditor/editor/dialog/fck_image/fck_image_preview.html @@ -0,0 +1,66 @@ + + + + + + + + + + + + + Lorem + ipsum dolor sit amet, consectetuer adipiscing elit. Maecenas feugiat consequat diam. + Maecenas metus. Vivamus diam purus, cursus a, commodo non, facilisis vitae, nulla. + Aenean dictum lacinia tortor. Nunc iaculis, nibh non iaculis aliquam, orci felis + euismod neque, sed ornare massa mauris sed velit. Nulla pretium mi et risus. Fusce + mi pede, tempor id, cursus ac, ullamcorper nec, enim. Sed tortor. Curabitur molestie. + Duis velit augue, condimentum at, ultrices a, luctus ut, orci. Donec pellentesque + egestas eros. Integer cursus, augue in cursus faucibus, eros pede bibendum sem, + in tempus tellus justo quis ligula. Etiam eget tortor. Vestibulum rutrum, est ut + placerat elementum, lectus nisl aliquam velit, tempor aliquam eros nunc nonummy + metus. In eros metus, gravida a, gravida sed, lobortis id, turpis. Ut ultrices, + ipsum at venenatis fringilla, sem nulla lacinia tellus, eget aliquet turpis mauris + non enim. Nam turpis. Suspendisse lacinia. Curabitur ac tortor ut ipsum egestas + elementum. Nunc imperdiet gravida mauris. + + diff --git a/FCKeditor/editor/dialog/fck_link.html b/FCKeditor/editor/dialog/fck_link.html new file mode 100644 index 0000000..ebf7246 --- /dev/null +++ b/FCKeditor/editor/dialog/fck_link.html @@ -0,0 +1,293 @@ + + + + + Link Properties + + + + + + + + + + + + diff --git a/FCKeditor/editor/dialog/fck_link/fck_link.js b/FCKeditor/editor/dialog/fck_link/fck_link.js new file mode 100644 index 0000000..194dee2 --- /dev/null +++ b/FCKeditor/editor/dialog/fck_link/fck_link.js @@ -0,0 +1,715 @@ +/* + * FCKeditor - The text editor for Internet - http://www.fckeditor.net + * Copyright (C) 2003-2007 Frederico Caldeira Knabben + * + * == BEGIN LICENSE == + * + * Licensed under the terms of any of the following licenses at your + * choice: + * + * - GNU General Public License Version 2 or later (the "GPL") + * http://www.gnu.org/licenses/gpl.html + * + * - GNU Lesser General Public License Version 2.1 or later (the "LGPL") + * http://www.gnu.org/licenses/lgpl.html + * + * - Mozilla Public License Version 1.1 or later (the "MPL") + * http://www.mozilla.org/MPL/MPL-1.1.html + * + * == END LICENSE == + * + * Scripts related to the Link dialog window (see fck_link.html). + */ + +var oEditor = window.parent.InnerDialogLoaded() ; +var FCK = oEditor.FCK ; +var FCKLang = oEditor.FCKLang ; +var FCKConfig = oEditor.FCKConfig ; +var FCKRegexLib = oEditor.FCKRegexLib ; +var FCKTools = oEditor.FCKTools ; + +//#### Dialog Tabs + +// Set the dialog tabs. +window.parent.AddTab( 'Info', FCKLang.DlgLnkInfoTab ) ; + +if ( !FCKConfig.LinkDlgHideTarget ) + window.parent.AddTab( 'Target', FCKLang.DlgLnkTargetTab, true ) ; + +if ( FCKConfig.LinkUpload ) + window.parent.AddTab( 'Upload', FCKLang.DlgLnkUpload, true ) ; + +if ( !FCKConfig.LinkDlgHideAdvanced ) + window.parent.AddTab( 'Advanced', FCKLang.DlgAdvancedTag ) ; + +// Function called when a dialog tag is selected. +function OnDialogTabChange( tabCode ) +{ + ShowE('divInfo' , ( tabCode == 'Info' ) ) ; + ShowE('divTarget' , ( tabCode == 'Target' ) ) ; + ShowE('divUpload' , ( tabCode == 'Upload' ) ) ; + ShowE('divAttribs' , ( tabCode == 'Advanced' ) ) ; + + window.parent.SetAutoSize( true ) ; +} + +//#### Regular Expressions library. +var oRegex = new Object() ; + +oRegex.UriProtocol = /^(((http|https|ftp|news):\/\/)|mailto:)/gi ; + +oRegex.UrlOnChangeProtocol = /^(http|https|ftp|news):\/\/(?=.)/gi ; + +oRegex.UrlOnChangeTestOther = /^((javascript:)|[#\/\.])/gi ; + +oRegex.ReserveTarget = /^_(blank|self|top|parent)$/i ; + +oRegex.PopupUri = /^javascript:void\(\s*window.open\(\s*'([^']+)'\s*,\s*(?:'([^']*)'|null)\s*,\s*'([^']*)'\s*\)\s*\)\s*$/ ; + +// Accessible popups +oRegex.OnClickPopup = /^\s*on[cC]lick="\s*window.open\(\s*this\.href\s*,\s*(?:'([^']*)'|null)\s*,\s*'([^']*)'\s*\)\s*;\s*return\s*false;*\s*"$/ ; + +oRegex.PopupFeatures = /(?:^|,)([^=]+)=(\d+|yes|no)/gi ; + +//#### Parser Functions + +var oParser = new Object() ; + +oParser.ParseEMailUrl = function( emailUrl ) +{ + // Initializes the EMailInfo object. + var oEMailInfo = new Object() ; + oEMailInfo.Address = '' ; + oEMailInfo.Subject = '' ; + oEMailInfo.Body = '' ; + + var oParts = emailUrl.match( /^([^\?]+)\??(.+)?/ ) ; + if ( oParts ) + { + // Set the e-mail address. + oEMailInfo.Address = oParts[1] ; + + // Look for the optional e-mail parameters. + if ( oParts[2] ) + { + var oMatch = oParts[2].match( /(^|&)subject=([^&]+)/i ) ; + if ( oMatch ) oEMailInfo.Subject = decodeURIComponent( oMatch[2] ) ; + + oMatch = oParts[2].match( /(^|&)body=([^&]+)/i ) ; + if ( oMatch ) oEMailInfo.Body = decodeURIComponent( oMatch[2] ) ; + } + } + + return oEMailInfo ; +} + +oParser.CreateEMailUri = function( address, subject, body ) +{ + var sBaseUri = 'mailto:' + address ; + + var sParams = '' ; + + if ( subject.length > 0 ) + sParams = '?subject=' + encodeURIComponent( subject ) ; + + if ( body.length > 0 ) + { + sParams += ( sParams.length == 0 ? '?' : '&' ) ; + sParams += 'body=' + encodeURIComponent( body ) ; + } + + return sBaseUri + sParams ; +} + +//#### Initialization Code + +// oLink: The actual selected link in the editor. +var oLink = FCK.Selection.MoveToAncestorNode( 'A' ) ; +if ( oLink ) + FCK.Selection.SelectNode( oLink ) ; + +window.onload = function() +{ + // Translate the dialog box texts. + oEditor.FCKLanguageManager.TranslatePage(document) ; + + // Fill the Anchor Names and Ids combos. + LoadAnchorNamesAndIds() ; + + // Load the selected link information (if any). + LoadSelection() ; + + // Update the dialog box. + SetLinkType( GetE('cmbLinkType').value ) ; + + // Show/Hide the "Browse Server" button. + GetE('divBrowseServer').style.display = FCKConfig.LinkBrowser ? '' : 'none' ; + + // Show the initial dialog content. + GetE('divInfo').style.display = '' ; + + // Set the actual uploader URL. + if ( FCKConfig.LinkUpload ) + GetE('frmUpload').action = FCKConfig.LinkUploadURL ; + + // Set the default target (from configuration). + SetDefaultTarget() ; + + // Activate the "OK" button. + window.parent.SetOkButton( true ) ; +} + +var bHasAnchors ; + +function LoadAnchorNamesAndIds() +{ + // Since version 2.0, the anchors are replaced in the DOM by IMGs so the user see the icon + // to edit them. So, we must look for that images now. + var aAnchors = new Array() ; + var i ; + var oImages = oEditor.FCK.EditorDocument.getElementsByTagName( 'IMG' ) ; + for( i = 0 ; i < oImages.length ; i++ ) + { + if ( oImages[i].getAttribute('_fckanchor') ) + aAnchors[ aAnchors.length ] = oEditor.FCK.GetRealElement( oImages[i] ) ; + } + + // Add also real anchors + var oLinks = oEditor.FCK.EditorDocument.getElementsByTagName( 'A' ) ; + for( i = 0 ; i < oLinks.length ; i++ ) + { + if ( oLinks[i].name && ( oLinks[i].name.length > 0 ) ) + aAnchors[ aAnchors.length ] = oLinks[i] ; + } + + var aIds = FCKTools.GetAllChildrenIds( oEditor.FCK.EditorDocument.body ) ; + + bHasAnchors = ( aAnchors.length > 0 || aIds.length > 0 ) ; + + for ( i = 0 ; i < aAnchors.length ; i++ ) + { + var sName = aAnchors[i].name ; + if ( sName && sName.length > 0 ) + FCKTools.AddSelectOption( GetE('cmbAnchorName'), sName, sName ) ; + } + + for ( i = 0 ; i < aIds.length ; i++ ) + { + FCKTools.AddSelectOption( GetE('cmbAnchorId'), aIds[i], aIds[i] ) ; + } + + ShowE( 'divSelAnchor' , bHasAnchors ) ; + ShowE( 'divNoAnchor' , !bHasAnchors ) ; +} + +function LoadSelection() +{ + if ( !oLink ) return ; + + var sType = 'url' ; + + // Get the actual Link href. + var sHRef = oLink.getAttribute( '_fcksavedurl' ) ; + if ( sHRef == null ) + sHRef = oLink.getAttribute( 'href' , 2 ) || '' ; + + // Look for a popup javascript link. + var oPopupMatch = oRegex.PopupUri.exec( sHRef ) ; + if( oPopupMatch ) + { + GetE('cmbTarget').value = 'popup' ; + sHRef = oPopupMatch[1] ; + FillPopupFields( oPopupMatch[2], oPopupMatch[3] ) ; + SetTarget( 'popup' ) ; + } + + // Accessible popups, the popup data is in the onclick attribute + if ( !oPopupMatch ) + { + var onclick = oLink.getAttribute( 'onclick_fckprotectedatt' ) ; + if ( onclick ) + { + // Decode the protected string + onclick = decodeURIComponent( onclick ) ; + + oPopupMatch = oRegex.OnClickPopup.exec( onclick ) ; + if( oPopupMatch ) + { + GetE( 'cmbTarget' ).value = 'popup' ; + FillPopupFields( oPopupMatch[1], oPopupMatch[2] ) ; + SetTarget( 'popup' ) ; + } + } + } + + // Search for the protocol. + var sProtocol = oRegex.UriProtocol.exec( sHRef ) ; + + if ( sProtocol ) + { + sProtocol = sProtocol[0].toLowerCase() ; + GetE('cmbLinkProtocol').value = sProtocol ; + + // Remove the protocol and get the remaining URL. + var sUrl = sHRef.replace( oRegex.UriProtocol, '' ) ; + + if ( sProtocol == 'mailto:' ) // It is an e-mail link. + { + sType = 'email' ; + + var oEMailInfo = oParser.ParseEMailUrl( sUrl ) ; + GetE('txtEMailAddress').value = oEMailInfo.Address ; + GetE('txtEMailSubject').value = oEMailInfo.Subject ; + GetE('txtEMailBody').value = oEMailInfo.Body ; + } + else // It is a normal link. + { + sType = 'url' ; + GetE('txtUrl').value = sUrl ; + } + } + else if ( sHRef.substr(0,1) == '#' && sHRef.length > 1 ) // It is an anchor link. + { + sType = 'anchor' ; + GetE('cmbAnchorName').value = GetE('cmbAnchorId').value = sHRef.substr(1) ; + } + else // It is another type of link. + { + sType = 'url' ; + + GetE('cmbLinkProtocol').value = '' ; + GetE('txtUrl').value = sHRef ; + } + + if ( !oPopupMatch ) + { + // Get the target. + var sTarget = oLink.target ; + + if ( sTarget && sTarget.length > 0 ) + { + if ( oRegex.ReserveTarget.test( sTarget ) ) + { + sTarget = sTarget.toLowerCase() ; + GetE('cmbTarget').value = sTarget ; + } + else + GetE('cmbTarget').value = 'frame' ; + GetE('txtTargetFrame').value = sTarget ; + } + } + + // Get Advances Attributes + GetE('txtAttId').value = oLink.id ; + GetE('txtAttName').value = oLink.name ; + GetE('cmbAttLangDir').value = oLink.dir ; + GetE('txtAttLangCode').value = oLink.lang ; + GetE('txtAttAccessKey').value = oLink.accessKey ; + GetE('txtAttTabIndex').value = oLink.tabIndex <= 0 ? '' : oLink.tabIndex ; + GetE('txtAttTitle').value = oLink.title ; + GetE('txtAttContentType').value = oLink.type ; + GetE('txtAttCharSet').value = oLink.charset ; + + var sClass ; + if ( oEditor.FCKBrowserInfo.IsIE ) + { + sClass = oLink.getAttribute('className',2) || '' ; + // Clean up temporary classes for internal use: + sClass = sClass.replace( FCKRegexLib.FCK_Class, '' ) ; + + GetE('txtAttStyle').value = oLink.style.cssText ; + } + else + { + sClass = oLink.getAttribute('class',2) || '' ; + GetE('txtAttStyle').value = oLink.getAttribute('style',2) || '' ; + } + GetE('txtAttClasses').value = sClass ; + + // Update the Link type combo. + GetE('cmbLinkType').value = sType ; +} + +//#### Link type selection. +function SetLinkType( linkType ) +{ + ShowE('divLinkTypeUrl' , (linkType == 'url') ) ; + ShowE('divLinkTypeAnchor' , (linkType == 'anchor') ) ; + ShowE('divLinkTypeEMail' , (linkType == 'email') ) ; + + if ( !FCKConfig.LinkDlgHideTarget ) + window.parent.SetTabVisibility( 'Target' , (linkType == 'url') ) ; + + if ( FCKConfig.LinkUpload ) + window.parent.SetTabVisibility( 'Upload' , (linkType == 'url') ) ; + + if ( !FCKConfig.LinkDlgHideAdvanced ) + window.parent.SetTabVisibility( 'Advanced' , (linkType != 'anchor' || bHasAnchors) ) ; + + if ( linkType == 'email' ) + window.parent.SetAutoSize( true ) ; +} + +//#### Target type selection. +function SetTarget( targetType ) +{ + GetE('tdTargetFrame').style.display = ( targetType == 'popup' ? 'none' : '' ) ; + GetE('tdPopupName').style.display = + GetE('tablePopupFeatures').style.display = ( targetType == 'popup' ? '' : 'none' ) ; + + switch ( targetType ) + { + case "_blank" : + case "_self" : + case "_parent" : + case "_top" : + GetE('txtTargetFrame').value = targetType ; + break ; + case "" : + GetE('txtTargetFrame').value = '' ; + break ; + } + + if ( targetType == 'popup' ) + window.parent.SetAutoSize( true ) ; +} + +//#### Called while the user types the URL. +function OnUrlChange() +{ + var sUrl = GetE('txtUrl').value ; + var sProtocol = oRegex.UrlOnChangeProtocol.exec( sUrl ) ; + + if ( sProtocol ) + { + sUrl = sUrl.substr( sProtocol[0].length ) ; + GetE('txtUrl').value = sUrl ; + GetE('cmbLinkProtocol').value = sProtocol[0].toLowerCase() ; + } + else if ( oRegex.UrlOnChangeTestOther.test( sUrl ) ) + { + GetE('cmbLinkProtocol').value = '' ; + } +} + +//#### Called while the user types the target name. +function OnTargetNameChange() +{ + var sFrame = GetE('txtTargetFrame').value ; + + if ( sFrame.length == 0 ) + GetE('cmbTarget').value = '' ; + else if ( oRegex.ReserveTarget.test( sFrame ) ) + GetE('cmbTarget').value = sFrame.toLowerCase() ; + else + GetE('cmbTarget').value = 'frame' ; +} + +// Accessible popups +function BuildOnClickPopup() +{ + var sWindowName = "'" + GetE('txtPopupName').value.replace(/\W/gi, "") + "'" ; + + var sFeatures = '' ; + var aChkFeatures = document.getElementsByName( 'chkFeature' ) ; + for ( var i = 0 ; i < aChkFeatures.length ; i++ ) + { + if ( i > 0 ) sFeatures += ',' ; + sFeatures += aChkFeatures[i].value + '=' + ( aChkFeatures[i].checked ? 'yes' : 'no' ) ; + } + + if ( GetE('txtPopupWidth').value.length > 0 ) sFeatures += ',width=' + GetE('txtPopupWidth').value ; + if ( GetE('txtPopupHeight').value.length > 0 ) sFeatures += ',height=' + GetE('txtPopupHeight').value ; + if ( GetE('txtPopupLeft').value.length > 0 ) sFeatures += ',left=' + GetE('txtPopupLeft').value ; + if ( GetE('txtPopupTop').value.length > 0 ) sFeatures += ',top=' + GetE('txtPopupTop').value ; + + if ( sFeatures != '' ) + sFeatures = sFeatures + ",status" ; + + return ( "window.open(this.href," + sWindowName + ",'" + sFeatures + "'); return false" ) ; +} + +//#### Fills all Popup related fields. +function FillPopupFields( windowName, features ) +{ + if ( windowName ) + GetE('txtPopupName').value = windowName ; + + var oFeatures = new Object() ; + var oFeaturesMatch ; + while( ( oFeaturesMatch = oRegex.PopupFeatures.exec( features ) ) != null ) + { + var sValue = oFeaturesMatch[2] ; + if ( sValue == ( 'yes' || '1' ) ) + oFeatures[ oFeaturesMatch[1] ] = true ; + else if ( ! isNaN( sValue ) && sValue != 0 ) + oFeatures[ oFeaturesMatch[1] ] = sValue ; + } + + // Update all features check boxes. + var aChkFeatures = document.getElementsByName('chkFeature') ; + for ( var i = 0 ; i < aChkFeatures.length ; i++ ) + { + if ( oFeatures[ aChkFeatures[i].value ] ) + aChkFeatures[i].checked = true ; + } + + // Update position and size text boxes. + if ( oFeatures['width'] ) GetE('txtPopupWidth').value = oFeatures['width'] ; + if ( oFeatures['height'] ) GetE('txtPopupHeight').value = oFeatures['height'] ; + if ( oFeatures['left'] ) GetE('txtPopupLeft').value = oFeatures['left'] ; + if ( oFeatures['top'] ) GetE('txtPopupTop').value = oFeatures['top'] ; +} + +//#### The OK button was hit. +function Ok() +{ + var sUri, sInnerHtml ; + oEditor.FCKUndo.SaveUndoStep() ; + + switch ( GetE('cmbLinkType').value ) + { + case 'url' : + sUri = GetE('txtUrl').value ; + + if ( sUri.length == 0 ) + { + alert( FCKLang.DlnLnkMsgNoUrl ) ; + return false ; + } + + sUri = GetE('cmbLinkProtocol').value + sUri ; + + break ; + + case 'email' : + sUri = GetE('txtEMailAddress').value ; + + if ( sUri.length == 0 ) + { + alert( FCKLang.DlnLnkMsgNoEMail ) ; + return false ; + } + + sUri = oParser.CreateEMailUri( + sUri, + GetE('txtEMailSubject').value, + GetE('txtEMailBody').value ) ; + break ; + + case 'anchor' : + var sAnchor = GetE('cmbAnchorName').value ; + if ( sAnchor.length == 0 ) sAnchor = GetE('cmbAnchorId').value ; + + if ( sAnchor.length == 0 ) + { + alert( FCKLang.DlnLnkMsgNoAnchor ) ; + return false ; + } + + sUri = '#' + sAnchor ; + break ; + } + + // If no link is selected, create a new one (it may result in more than one link creation - #220). + var aLinks = oLink ? [ oLink ] : oEditor.FCK.CreateLink( sUri, true ) ; + + // If no selection, no links are created, so use the uri as the link text (by dom, 2006-05-26) + var aHasSelection = ( aLinks.length > 0 ) ; + if ( !aHasSelection ) + { + sInnerHtml = sUri; + + // Built a better text for empty links. + switch ( GetE('cmbLinkType').value ) + { + // anchor: use old behavior --> return true + case 'anchor': + sInnerHtml = sInnerHtml.replace( /^#/, '' ) ; + break ; + + // url: try to get path + case 'url': + var oLinkPathRegEx = new RegExp("//?([^?\"']+)([?].*)?$") ; + var asLinkPath = oLinkPathRegEx.exec( sUri ) ; + if (asLinkPath != null) + sInnerHtml = asLinkPath[1]; // use matched path + break ; + + // mailto: try to get email address + case 'email': + sInnerHtml = GetE('txtEMailAddress').value ; + break ; + } + + // Create a new (empty) anchor. + aLinks = [ oEditor.FCK.InsertElement( 'a' ) ] ; + } + + for ( var i = 0 ; i < aLinks.length ; i++ ) + { + oLink = aLinks[i] ; + + if ( aHasSelection ) + sInnerHtml = oLink.innerHTML ; // Save the innerHTML (IE changes it if it is like an URL). + + oLink.href = sUri ; + SetAttribute( oLink, '_fcksavedurl', sUri ) ; + + var onclick; + // Accessible popups + if( GetE('cmbTarget').value == 'popup' ) + { + onclick = BuildOnClickPopup() ; + // Encode the attribute + onclick = encodeURIComponent( " onclick=\"" + onclick + "\"" ) ; + SetAttribute( oLink, 'onclick_fckprotectedatt', onclick ) ; + } + else + { + // Check if the previous onclick was for a popup: + // In that case remove the onclick handler. + onclick = oLink.getAttribute( 'onclick_fckprotectedatt' ) ; + if ( onclick ) + { + // Decode the protected string + onclick = decodeURIComponent( onclick ) ; + + if( oRegex.OnClickPopup.test( onclick ) ) + SetAttribute( oLink, 'onclick_fckprotectedatt', '' ) ; + } + } + + oLink.innerHTML = sInnerHtml ; // Set (or restore) the innerHTML + + // Target + if( GetE('cmbTarget').value != 'popup' ) + SetAttribute( oLink, 'target', GetE('txtTargetFrame').value ) ; + else + SetAttribute( oLink, 'target', null ) ; + + // Let's set the "id" only for the first link to avoid duplication. + if ( i == 0 ) + SetAttribute( oLink, 'id', GetE('txtAttId').value ) ; + + // Advances Attributes + SetAttribute( oLink, 'name' , GetE('txtAttName').value ) ; + SetAttribute( oLink, 'dir' , GetE('cmbAttLangDir').value ) ; + SetAttribute( oLink, 'lang' , GetE('txtAttLangCode').value ) ; + SetAttribute( oLink, 'accesskey', GetE('txtAttAccessKey').value ) ; + SetAttribute( oLink, 'tabindex' , ( GetE('txtAttTabIndex').value > 0 ? GetE('txtAttTabIndex').value : null ) ) ; + SetAttribute( oLink, 'title' , GetE('txtAttTitle').value ) ; + SetAttribute( oLink, 'type' , GetE('txtAttContentType').value ) ; + SetAttribute( oLink, 'charset' , GetE('txtAttCharSet').value ) ; + + if ( oEditor.FCKBrowserInfo.IsIE ) + { + var sClass = GetE('txtAttClasses').value ; + // If it's also an anchor add an internal class + if ( GetE('txtAttName').value.length != 0 ) + sClass += ' FCK__AnchorC' ; + SetAttribute( oLink, 'className', sClass ) ; + + oLink.style.cssText = GetE('txtAttStyle').value ; + } + else + { + SetAttribute( oLink, 'class', GetE('txtAttClasses').value ) ; + SetAttribute( oLink, 'style', GetE('txtAttStyle').value ) ; + } + } + + // Select the (first) link. + oEditor.FCKSelection.SelectNode( aLinks[0] ); + + return true ; +} + +function BrowseServer() +{ + OpenFileBrowser( FCKConfig.LinkBrowserURL, FCKConfig.LinkBrowserWindowWidth, FCKConfig.LinkBrowserWindowHeight ) ; +} + +function SetUrl( url ) +{ + document.getElementById('txtUrl').value = url ; + OnUrlChange() ; + window.parent.SetSelectedTab( 'Info' ) ; +} + +function OnUploadCompleted( errorNumber, fileUrl, fileName, customMsg ) +{ + switch ( errorNumber ) + { + case 0 : // No errors + alert( 'Your file has been successfully uploaded' ) ; + break ; + case 1 : // Custom error + alert( customMsg ) ; + return ; + case 101 : // Custom warning + alert( customMsg ) ; + break ; + case 201 : + alert( 'A file with the same name is already available. The uploaded file has been renamed to "' + fileName + '"' ) ; + break ; + case 202 : + alert( 'Invalid file type' ) ; + return ; + case 203 : + alert( "Security error. You probably don't have enough permissions to upload. Please check your server." ) ; + return ; + default : + alert( 'Error on file upload. Error number: ' + errorNumber ) ; + return ; + } + + SetUrl( fileUrl ) ; + GetE('frmUpload').reset() ; +} + +var oUploadAllowedExtRegex = new RegExp( FCKConfig.LinkUploadAllowedExtensions, 'i' ) ; +var oUploadDeniedExtRegex = new RegExp( FCKConfig.LinkUploadDeniedExtensions, 'i' ) ; + +function CheckUpload() +{ + var sFile = GetE('txtUploadFile').value ; + + if ( sFile.length == 0 ) + { + alert( 'Please select a file to upload' ) ; + return false ; + } + + if ( ( FCKConfig.LinkUploadAllowedExtensions.length > 0 && !oUploadAllowedExtRegex.test( sFile ) ) || + ( FCKConfig.LinkUploadDeniedExtensions.length > 0 && oUploadDeniedExtRegex.test( sFile ) ) ) + { + OnUploadCompleted( 202 ) ; + return false ; + } + + return true ; +} + +function SetDefaultTarget() +{ + var target = FCKConfig.DefaultLinkTarget || '' ; + + if ( oLink || target.length == 0 ) + return ; + + switch ( target ) + { + case '_blank' : + case '_self' : + case '_parent' : + case '_top' : + GetE('cmbTarget').value = target ; + break ; + default : + GetE('cmbTarget').value = 'frame' ; + break ; + } + + GetE('txtTargetFrame').value = target ; +} diff --git a/FCKeditor/editor/dialog/fck_listprop.html b/FCKeditor/editor/dialog/fck_listprop.html new file mode 100644 index 0000000..52bfeed --- /dev/null +++ b/FCKeditor/editor/dialog/fck_listprop.html @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + +
+ + + + + +
+ List Type
+ + +   +
+
+ + diff --git a/FCKeditor/editor/dialog/fck_paste.html b/FCKeditor/editor/dialog/fck_paste.html new file mode 100644 index 0000000..39db423 --- /dev/null +++ b/FCKeditor/editor/dialog/fck_paste.html @@ -0,0 +1,340 @@ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ Please paste inside the following box using the keyboard + (Ctrl+V) and hit OK.
+   +
+
+ + +
+ + + + + +
+ + +
+ + +
+ +
+
+ + diff --git a/FCKeditor/editor/dialog/fck_radiobutton.html b/FCKeditor/editor/dialog/fck_radiobutton.html new file mode 100644 index 0000000..491d53a --- /dev/null +++ b/FCKeditor/editor/dialog/fck_radiobutton.html @@ -0,0 +1,110 @@ + + + + + Radio Button Properties + + + + + + + + + + +
+ + + + + + + + + + +
+ Name
+ +
+ Value
+ +
+
+ + diff --git a/FCKeditor/editor/dialog/fck_replace.html b/FCKeditor/editor/dialog/fck_replace.html new file mode 100644 index 0000000..7157aaa --- /dev/null +++ b/FCKeditor/editor/dialog/fck_replace.html @@ -0,0 +1,490 @@ + + + + + + + + + + + + + + + diff --git a/FCKeditor/editor/dialog/fck_select.html b/FCKeditor/editor/dialog/fck_select.html new file mode 100644 index 0000000..599bb7c --- /dev/null +++ b/FCKeditor/editor/dialog/fck_select.html @@ -0,0 +1,178 @@ + + + + + Select Properties + + + + + + + + + + + +
+ + + + + + + + + + + + + + +
Name 
Value 
Size  lines
+
+
+  Available + Options  + + + + + + + + + + + + + + + + + + +
Text
+ +
Value
+ +
+ + +
+
+ +
   +
+
+ + diff --git a/FCKeditor/editor/dialog/fck_select/fck_select.js b/FCKeditor/editor/dialog/fck_select/fck_select.js new file mode 100644 index 0000000..4321804 --- /dev/null +++ b/FCKeditor/editor/dialog/fck_select/fck_select.js @@ -0,0 +1,194 @@ +/* + * FCKeditor - The text editor for Internet - http://www.fckeditor.net + * Copyright (C) 2003-2007 Frederico Caldeira Knabben + * + * == BEGIN LICENSE == + * + * Licensed under the terms of any of the following licenses at your + * choice: + * + * - GNU General Public License Version 2 or later (the "GPL") + * http://www.gnu.org/licenses/gpl.html + * + * - GNU Lesser General Public License Version 2.1 or later (the "LGPL") + * http://www.gnu.org/licenses/lgpl.html + * + * - Mozilla Public License Version 1.1 or later (the "MPL") + * http://www.mozilla.org/MPL/MPL-1.1.html + * + * == END LICENSE == + * + * Scripts for the fck_select.html page. + */ + +function Select( combo ) +{ + var iIndex = combo.selectedIndex ; + + oListText.selectedIndex = iIndex ; + oListValue.selectedIndex = iIndex ; + + var oTxtText = document.getElementById( "txtText" ) ; + var oTxtValue = document.getElementById( "txtValue" ) ; + + oTxtText.value = oListText.value ; + oTxtValue.value = oListValue.value ; +} + +function Add() +{ + var oTxtText = document.getElementById( "txtText" ) ; + var oTxtValue = document.getElementById( "txtValue" ) ; + + AddComboOption( oListText, oTxtText.value, oTxtText.value ) ; + AddComboOption( oListValue, oTxtValue.value, oTxtValue.value ) ; + + oListText.selectedIndex = oListText.options.length - 1 ; + oListValue.selectedIndex = oListValue.options.length - 1 ; + + oTxtText.value = '' ; + oTxtValue.value = '' ; + + oTxtText.focus() ; +} + +function Modify() +{ + var iIndex = oListText.selectedIndex ; + + if ( iIndex < 0 ) return ; + + var oTxtText = document.getElementById( "txtText" ) ; + var oTxtValue = document.getElementById( "txtValue" ) ; + + oListText.options[ iIndex ].innerHTML = HTMLEncode( oTxtText.value ) ; + oListText.options[ iIndex ].value = oTxtText.value ; + + oListValue.options[ iIndex ].innerHTML = HTMLEncode( oTxtValue.value ) ; + oListValue.options[ iIndex ].value = oTxtValue.value ; + + oTxtText.value = '' ; + oTxtValue.value = '' ; + + oTxtText.focus() ; +} + +function Move( steps ) +{ + ChangeOptionPosition( oListText, steps ) ; + ChangeOptionPosition( oListValue, steps ) ; +} + +function Delete() +{ + RemoveSelectedOptions( oListText ) ; + RemoveSelectedOptions( oListValue ) ; +} + +function SetSelectedValue() +{ + var iIndex = oListValue.selectedIndex ; + if ( iIndex < 0 ) return ; + + var oTxtValue = document.getElementById( "txtSelValue" ) ; + + oTxtValue.value = oListValue.options[ iIndex ].value ; +} + +// Moves the selected option by a number of steps (also negative) +function ChangeOptionPosition( combo, steps ) +{ + var iActualIndex = combo.selectedIndex ; + + if ( iActualIndex < 0 ) + return ; + + var iFinalIndex = iActualIndex + steps ; + + if ( iFinalIndex < 0 ) + iFinalIndex = 0 ; + + if ( iFinalIndex > ( combo.options.length - 1 ) ) + iFinalIndex = combo.options.length - 1 ; + + if ( iActualIndex == iFinalIndex ) + return ; + + var oOption = combo.options[ iActualIndex ] ; + var sText = HTMLDecode( oOption.innerHTML ) ; + var sValue = oOption.value ; + + combo.remove( iActualIndex ) ; + + oOption = AddComboOption( combo, sText, sValue, null, iFinalIndex ) ; + + oOption.selected = true ; +} + +// Remove all selected options from a SELECT object +function RemoveSelectedOptions(combo) +{ + // Save the selected index + var iSelectedIndex = combo.selectedIndex ; + + var oOptions = combo.options ; + + // Remove all selected options + for ( var i = oOptions.length - 1 ; i >= 0 ; i-- ) + { + if (oOptions[i].selected) combo.remove(i) ; + } + + // Reset the selection based on the original selected index + if ( combo.options.length > 0 ) + { + if ( iSelectedIndex >= combo.options.length ) iSelectedIndex = combo.options.length - 1 ; + combo.selectedIndex = iSelectedIndex ; + } +} + +// Add a new option to a SELECT object (combo or list) +function AddComboOption( combo, optionText, optionValue, documentObject, index ) +{ + var oOption ; + + if ( documentObject ) + oOption = documentObject.createElement("OPTION") ; + else + oOption = document.createElement("OPTION") ; + + if ( index != null ) + combo.options.add( oOption, index ) ; + else + combo.options.add( oOption ) ; + + oOption.innerHTML = optionText.length > 0 ? HTMLEncode( optionText ) : ' ' ; + oOption.value = optionValue ; + + return oOption ; +} + +function HTMLEncode( text ) +{ + if ( !text ) + return '' ; + + text = text.replace( /&/g, '&' ) ; + text = text.replace( //g, '>' ) ; + + return text ; +} + + +function HTMLDecode( text ) +{ + if ( !text ) + return '' ; + + text = text.replace( />/g, '>' ) ; + text = text.replace( /</g, '<' ) ; + text = text.replace( /&/g, '&' ) ; + + return text ; +} \ No newline at end of file diff --git a/FCKeditor/editor/dialog/fck_smiley.html b/FCKeditor/editor/dialog/fck_smiley.html new file mode 100644 index 0000000..126b778 --- /dev/null +++ b/FCKeditor/editor/dialog/fck_smiley.html @@ -0,0 +1,108 @@ + + + + + + + + + + + + + +
+ + diff --git a/FCKeditor/editor/dialog/fck_source.html b/FCKeditor/editor/dialog/fck_source.html new file mode 100644 index 0000000..f12706d --- /dev/null +++ b/FCKeditor/editor/dialog/fck_source.html @@ -0,0 +1,65 @@ + + + + + Source + + + + + + + + + + +
+ + diff --git a/FCKeditor/editor/dialog/fck_specialchar.html b/FCKeditor/editor/dialog/fck_specialchar.html new file mode 100644 index 0000000..4f8a32f --- /dev/null +++ b/FCKeditor/editor/dialog/fck_specialchar.html @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + +
+ + +
+
     + + + + +
 
+
+ + diff --git a/FCKeditor/editor/dialog/fck_spellerpages.html b/FCKeditor/editor/dialog/fck_spellerpages.html new file mode 100644 index 0000000..96cb270 --- /dev/null +++ b/FCKeditor/editor/dialog/fck_spellerpages.html @@ -0,0 +1,64 @@ + + + + + Spell Check + + + + + + + + + + diff --git a/FCKeditor/editor/dialog/fck_spellerpages/spellerpages/blank.html b/FCKeditor/editor/dialog/fck_spellerpages/spellerpages/blank.html new file mode 100644 index 0000000..e69de29 diff --git a/FCKeditor/editor/dialog/fck_spellerpages/spellerpages/controlWindow.js b/FCKeditor/editor/dialog/fck_spellerpages/spellerpages/controlWindow.js new file mode 100644 index 0000000..6ba8cf0 --- /dev/null +++ b/FCKeditor/editor/dialog/fck_spellerpages/spellerpages/controlWindow.js @@ -0,0 +1,87 @@ +//////////////////////////////////////////////////// +// controlWindow object +//////////////////////////////////////////////////// +function controlWindow( controlForm ) { + // private properties + this._form = controlForm; + + // public properties + this.windowType = "controlWindow"; +// this.noSuggestionSelection = "- No suggestions -"; // by FredCK + this.noSuggestionSelection = FCKLang.DlgSpellNoSuggestions ; + // set up the properties for elements of the given control form + this.suggestionList = this._form.sugg; + this.evaluatedText = this._form.misword; + this.replacementText = this._form.txtsugg; + this.undoButton = this._form.btnUndo; + + // public methods + this.addSuggestion = addSuggestion; + this.clearSuggestions = clearSuggestions; + this.selectDefaultSuggestion = selectDefaultSuggestion; + this.resetForm = resetForm; + this.setSuggestedText = setSuggestedText; + this.enableUndo = enableUndo; + this.disableUndo = disableUndo; +} + +function resetForm() { + if( this._form ) { + this._form.reset(); + } +} + +function setSuggestedText() { + var slct = this.suggestionList; + var txt = this.replacementText; + var str = ""; + if( (slct.options[0].text) && slct.options[0].text != this.noSuggestionSelection ) { + str = slct.options[slct.selectedIndex].text; + } + txt.value = str; +} + +function selectDefaultSuggestion() { + var slct = this.suggestionList; + var txt = this.replacementText; + if( slct.options.length == 0 ) { + this.addSuggestion( this.noSuggestionSelection ); + } else { + slct.options[0].selected = true; + } + this.setSuggestedText(); +} + +function addSuggestion( sugg_text ) { + var slct = this.suggestionList; + if( sugg_text ) { + var i = slct.options.length; + var newOption = new Option( sugg_text, 'sugg_text'+i ); + slct.options[i] = newOption; + } +} + +function clearSuggestions() { + var slct = this.suggestionList; + for( var j = slct.length - 1; j > -1; j-- ) { + if( slct.options[j] ) { + slct.options[j] = null; + } + } +} + +function enableUndo() { + if( this.undoButton ) { + if( this.undoButton.disabled == true ) { + this.undoButton.disabled = false; + } + } +} + +function disableUndo() { + if( this.undoButton ) { + if( this.undoButton.disabled == false ) { + this.undoButton.disabled = true; + } + } +} diff --git a/FCKeditor/editor/dialog/fck_spellerpages/spellerpages/controls.html b/FCKeditor/editor/dialog/fck_spellerpages/spellerpages/controls.html new file mode 100644 index 0000000..919c118 --- /dev/null +++ b/FCKeditor/editor/dialog/fck_spellerpages/spellerpages/controls.html @@ -0,0 +1,153 @@ + + + + + + + +
+ + + + + + + + + + + + + + + + + + +
Not in dictionary:
Change to:
+ + + + + + + +
+ +
+ +
+
   + + + + + + + + + + + + + + + + + + + + + + +
+ +    + +
+ +    + +
+ +    + +
+
+
+ + diff --git a/FCKeditor/editor/dialog/fck_spellerpages/spellerpages/server-scripts/spellchecker.cfm b/FCKeditor/editor/dialog/fck_spellerpages/spellerpages/server-scripts/spellchecker.cfm new file mode 100644 index 0000000..19d5cb7 --- /dev/null +++ b/FCKeditor/editor/dialog/fck_spellerpages/spellerpages/server-scripts/spellchecker.cfm @@ -0,0 +1,148 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ]+>", " ", "all")> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/FCKeditor/editor/dialog/fck_spellerpages/spellerpages/server-scripts/spellchecker.php b/FCKeditor/editor/dialog/fck_spellerpages/spellerpages/server-scripts/spellchecker.php new file mode 100644 index 0000000..69bbe7a --- /dev/null +++ b/FCKeditor/editor/dialog/fck_spellerpages/spellerpages/server-scripts/spellchecker.php @@ -0,0 +1,201 @@ +$val ) { + # $val = str_replace( "'", "%27", $val ); + echo "textinputs[$key] = decodeURIComponent(\"" . $val . "\");\n"; + } +} + +# make declarations for the text input index +function print_textindex_decl( $text_input_idx ) { + echo "words[$text_input_idx] = [];\n"; + echo "suggs[$text_input_idx] = [];\n"; +} + +# set an element of the JavaScript 'words' array to a misspelled word +function print_words_elem( $word, $index, $text_input_idx ) { + echo "words[$text_input_idx][$index] = '" . escape_quote( $word ) . "';\n"; +} + + +# set an element of the JavaScript 'suggs' array to a list of suggestions +function print_suggs_elem( $suggs, $index, $text_input_idx ) { + echo "suggs[$text_input_idx][$index] = ["; + foreach( $suggs as $key=>$val ) { + if( $val ) { + echo "'" . escape_quote( $val ) . "'"; + if ( $key+1 < count( $suggs )) { + echo ", "; + } + } + } + echo "];\n"; +} + +# escape single quote +function escape_quote( $str ) { + return preg_replace ( "/'/", "\\'", $str ); +} + + +# handle a server-side error. +function error_handler( $err ) { + echo "error = '" . escape_quote( $err ) . "';\n"; +} + +## get the list of misspelled words. Put the results in the javascript words array +## for each misspelled word, get suggestions and put in the javascript suggs array +function print_checker_results() { + + global $aspell_prog; + global $aspell_opts; + global $tempfiledir; + global $textinputs; + global $input_separator; + $aspell_err = ""; + # create temp file + $tempfile = tempnam( $tempfiledir, 'aspell_data_' ); + + # open temp file, add the submitted text. + if( $fh = fopen( $tempfile, 'w' )) { + for( $i = 0; $i < count( $textinputs ); $i++ ) { + $text = urldecode( $textinputs[$i] ); + + // Strip all tags for the text. (by FredCK - #339 / #681) + $text = preg_replace( "/<[^>]+>/", " ", $text ) ; + + $lines = explode( "\n", $text ); + fwrite ( $fh, "%\n" ); # exit terse mode + fwrite ( $fh, "^$input_separator\n" ); + fwrite ( $fh, "!\n" ); # enter terse mode + foreach( $lines as $key=>$value ) { + # use carat on each line to escape possible aspell commands + fwrite( $fh, "^$value\n" ); + } + } + fclose( $fh ); + + # exec aspell command - redirect STDERR to STDOUT + $cmd = "$aspell_prog $aspell_opts < $tempfile 2>&1"; + if( $aspellret = shell_exec( $cmd )) { + $linesout = explode( "\n", $aspellret ); + $index = 0; + $text_input_index = -1; + # parse each line of aspell return + foreach( $linesout as $key=>$val ) { + $chardesc = substr( $val, 0, 1 ); + # if '&', then not in dictionary but has suggestions + # if '#', then not in dictionary and no suggestions + # if '*', then it is a delimiter between text inputs + # if '@' then version info + if( $chardesc == '&' || $chardesc == '#' ) { + $line = explode( " ", $val, 5 ); + print_words_elem( $line[1], $index, $text_input_index ); + if( isset( $line[4] )) { + $suggs = explode( ", ", $line[4] ); + } else { + $suggs = array(); + } + print_suggs_elem( $suggs, $index, $text_input_index ); + $index++; + } elseif( $chardesc == '*' ) { + $text_input_index++; + print_textindex_decl( $text_input_index ); + $index = 0; + } elseif( $chardesc != '@' && $chardesc != "" ) { + # assume this is error output + $aspell_err .= $val; + } + } + if( $aspell_err ) { + $aspell_err = "Error executing `$cmd`\\n$aspell_err"; + error_handler( $aspell_err ); + } + } else { + error_handler( "System error: Aspell program execution failed (`$cmd`)" ); + } + } else { + error_handler( "System error: Could not open file '$tempfile' for writing" ); + } + + # close temp file, delete file + unlink( $tempfile ); +} + + +?> + + + + + + + + + + + + + + + + + diff --git a/FCKeditor/editor/dialog/fck_spellerpages/spellerpages/server-scripts/spellchecker.pl b/FCKeditor/editor/dialog/fck_spellerpages/spellerpages/server-scripts/spellchecker.pl new file mode 100644 index 0000000..1598bc1 --- /dev/null +++ b/FCKeditor/editor/dialog/fck_spellerpages/spellerpages/server-scripts/spellchecker.pl @@ -0,0 +1,183 @@ +#!/usr/bin/perl + +use CGI qw/ :standard /; +use File::Temp qw/ tempfile tempdir /; + +# my $spellercss = '/speller/spellerStyle.css'; # by FredCK +my $spellercss = '../spellerStyle.css'; # by FredCK +# my $wordWindowSrc = '/speller/wordWindow.js'; # by FredCK +my $wordWindowSrc = '../wordWindow.js'; # by FredCK +my @textinputs = param( 'textinputs[]' ); # array +# my $aspell_cmd = 'aspell'; # by FredCK (for Linux) +my $aspell_cmd = '"C:\Program Files\Aspell\bin\aspell.exe"'; # by FredCK (for Windows) +my $lang = 'en_US'; +# my $aspell_opts = "-a --lang=$lang --encoding=utf-8"; # by FredCK +my $aspell_opts = "-a --lang=$lang --encoding=utf-8 -H --rem-sgml-check=alt"; # by FredCK +my $input_separator = "A"; + +# set the 'wordtext' JavaScript variable to the submitted text. +sub printTextVar { + for( my $i = 0; $i <= $#textinputs; $i++ ) { + print "textinputs[$i] = decodeURIComponent('" . escapeQuote( $textinputs[$i] ) . "')\n"; + } +} + +sub printTextIdxDecl { + my $idx = shift; + print "words[$idx] = [];\n"; + print "suggs[$idx] = [];\n"; +} + +sub printWordsElem { + my( $textIdx, $wordIdx, $word ) = @_; + print "words[$textIdx][$wordIdx] = '" . escapeQuote( $word ) . "';\n"; +} + +sub printSuggsElem { + my( $textIdx, $wordIdx, @suggs ) = @_; + print "suggs[$textIdx][$wordIdx] = ["; + for my $i ( 0..$#suggs ) { + print "'" . escapeQuote( $suggs[$i] ) . "'"; + if( $i < $#suggs ) { + print ", "; + } + } + print "];\n"; +} + +sub printCheckerResults { + my $textInputIdx = -1; + my $wordIdx = 0; + my $unhandledText; + # create temp file + my $dir = tempdir( CLEANUP => 1 ); + my( $fh, $tmpfilename ) = tempfile( DIR => $dir ); + + # temp file was created properly? + + # open temp file, add the submitted text. + for( my $i = 0; $i <= $#textinputs; $i++ ) { + $text = url_decode( $textinputs[$i] ); + # Strip all tags for the text. (by FredCK - #339 / #681) + $text =~ s/<[^>]+>/ /g; + @lines = split( /\n/, $text ); + print $fh "\%\n"; # exit terse mode + print $fh "^$input_separator\n"; + print $fh "!\n"; # enter terse mode + for my $line ( @lines ) { + # use carat on each line to escape possible aspell commands + print $fh "^$line\n"; + } + + } + # exec aspell command + my $cmd = "$aspell_cmd $aspell_opts < $tmpfilename 2>&1"; + open ASPELL, "$cmd |" or handleError( "Could not execute `$cmd`\\n$!" ) and return; + # parse each line of aspell return + for my $ret ( ) { + chomp( $ret ); + # if '&', then not in dictionary but has suggestions + # if '#', then not in dictionary and no suggestions + # if '*', then it is a delimiter between text inputs + if( $ret =~ /^\*/ ) { + $textInputIdx++; + printTextIdxDecl( $textInputIdx ); + $wordIdx = 0; + + } elsif( $ret =~ /^(&|#)/ ) { + my @tokens = split( " ", $ret, 5 ); + printWordsElem( $textInputIdx, $wordIdx, $tokens[1] ); + my @suggs = (); + if( $tokens[4] ) { + @suggs = split( ", ", $tokens[4] ); + } + printSuggsElem( $textInputIdx, $wordIdx, @suggs ); + $wordIdx++; + } else { + $unhandledText .= $ret; + } + } + close ASPELL or handleError( "Error executing `$cmd`\\n$unhandledText" ) and return; +} + +sub escapeQuote { + my $str = shift; + $str =~ s/'/\\'/g; + return $str; +} + +sub handleError { + my $err = shift; + print "error = '" . escapeQuote( $err ) . "';\n"; +} + +sub url_decode { + local $_ = @_ ? shift : $_; + defined or return; + # change + signs to spaces + tr/+/ /; + # change hex escapes to the proper characters + s/%([a-fA-F0-9]{2})/pack "H2", $1/eg; + return $_; +} + +# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # +# Display HTML +# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # + +print < + + + + + + + + + + + + + +EOF + + diff --git a/FCKeditor/editor/dialog/fck_spellerpages/spellerpages/spellChecker.js b/FCKeditor/editor/dialog/fck_spellerpages/spellerpages/spellChecker.js new file mode 100644 index 0000000..ffbd846 --- /dev/null +++ b/FCKeditor/editor/dialog/fck_spellerpages/spellerpages/spellChecker.js @@ -0,0 +1,462 @@ +//////////////////////////////////////////////////// +// spellChecker.js +// +// spellChecker object +// +// This file is sourced on web pages that have a textarea object to evaluate +// for spelling. It includes the implementation for the spellCheckObject. +// +//////////////////////////////////////////////////// + + +// constructor +function spellChecker( textObject ) { + + // public properties - configurable +// this.popUpUrl = '/speller/spellchecker.html'; // by FredCK + this.popUpUrl = 'fck_spellerpages/spellerpages/spellchecker.html'; // by FredCK + this.popUpName = 'spellchecker'; +// this.popUpProps = "menu=no,width=440,height=350,top=70,left=120,resizable=yes,status=yes"; // by FredCK + this.popUpProps = null ; // by FredCK +// this.spellCheckScript = '/speller/server-scripts/spellchecker.php'; // by FredCK + //this.spellCheckScript = '/cgi-bin/spellchecker.pl'; + + // values used to keep track of what happened to a word + this.replWordFlag = "R"; // single replace + this.ignrWordFlag = "I"; // single ignore + this.replAllFlag = "RA"; // replace all occurances + this.ignrAllFlag = "IA"; // ignore all occurances + this.fromReplAll = "~RA"; // an occurance of a "replace all" word + this.fromIgnrAll = "~IA"; // an occurance of a "ignore all" word + // properties set at run time + this.wordFlags = new Array(); + this.currentTextIndex = 0; + this.currentWordIndex = 0; + this.spellCheckerWin = null; + this.controlWin = null; + this.wordWin = null; + this.textArea = textObject; // deprecated + this.textInputs = arguments; + + // private methods + this._spellcheck = _spellcheck; + this._getSuggestions = _getSuggestions; + this._setAsIgnored = _setAsIgnored; + this._getTotalReplaced = _getTotalReplaced; + this._setWordText = _setWordText; + this._getFormInputs = _getFormInputs; + + // public methods + this.openChecker = openChecker; + this.startCheck = startCheck; + this.checkTextBoxes = checkTextBoxes; + this.checkTextAreas = checkTextAreas; + this.spellCheckAll = spellCheckAll; + this.ignoreWord = ignoreWord; + this.ignoreAll = ignoreAll; + this.replaceWord = replaceWord; + this.replaceAll = replaceAll; + this.terminateSpell = terminateSpell; + this.undo = undo; + + // set the current window's "speller" property to the instance of this class. + // this object can now be referenced by child windows/frames. + window.speller = this; +} + +// call this method to check all text boxes (and only text boxes) in the HTML document +function checkTextBoxes() { + this.textInputs = this._getFormInputs( "^text$" ); + this.openChecker(); +} + +// call this method to check all textareas (and only textareas ) in the HTML document +function checkTextAreas() { + this.textInputs = this._getFormInputs( "^textarea$" ); + this.openChecker(); +} + +// call this method to check all text boxes and textareas in the HTML document +function spellCheckAll() { + this.textInputs = this._getFormInputs( "^text(area)?$" ); + this.openChecker(); +} + +// call this method to check text boxe(s) and/or textarea(s) that were passed in to the +// object's constructor or to the textInputs property +function openChecker() { + this.spellCheckerWin = window.open( this.popUpUrl, this.popUpName, this.popUpProps ); + if( !this.spellCheckerWin.opener ) { + this.spellCheckerWin.opener = window; + } +} + +function startCheck( wordWindowObj, controlWindowObj ) { + + // set properties from args + this.wordWin = wordWindowObj; + this.controlWin = controlWindowObj; + + // reset properties + this.wordWin.resetForm(); + this.controlWin.resetForm(); + this.currentTextIndex = 0; + this.currentWordIndex = 0; + // initialize the flags to an array - one element for each text input + this.wordFlags = new Array( this.wordWin.textInputs.length ); + // each element will be an array that keeps track of each word in the text + for( var i=0; i wi ) || i > ti ) { + // future word: set as "from ignore all" if + // 1) do not already have a flag and + // 2) have the same value as current word + if(( this.wordWin.getTextVal( i, j ) == s_word_to_repl ) + && ( !this.wordFlags[i][j] )) { + this._setAsIgnored( i, j, this.fromIgnrAll ); + } + } + } + } + + // finally, move on + this.currentWordIndex++; + this._spellcheck(); + return true; +} + +function replaceWord() { + var wi = this.currentWordIndex; + var ti = this.currentTextIndex; + if( !this.wordWin ) { + alert( 'Error: Word frame not available.' ); + return false; + } + if( !this.wordWin.getTextVal( ti, wi )) { + alert( 'Error: "Not in dictionary" text is missing' ); + return false; + } + if( !this.controlWin.replacementText ) { + return false ; + } + var txt = this.controlWin.replacementText; + if( txt.value ) { + var newspell = new String( txt.value ); + if( this._setWordText( ti, wi, newspell, this.replWordFlag )) { + this.currentWordIndex++; + this._spellcheck(); + } + } + return true; +} + +function replaceAll() { + var ti = this.currentTextIndex; + var wi = this.currentWordIndex; + if( !this.wordWin ) { + alert( 'Error: Word frame not available.' ); + return false; + } + var s_word_to_repl = this.wordWin.getTextVal( ti, wi ); + if( !s_word_to_repl ) { + alert( 'Error: "Not in dictionary" text is missing' ); + return false; + } + var txt = this.controlWin.replacementText; + if( !txt.value ) return false; + var newspell = new String( txt.value ); + + // set this word as a "replace all" word. + this._setWordText( ti, wi, newspell, this.replAllFlag ); + + // loop through all the words after this word + for( var i = ti; i < this.wordWin.textInputs.length; i++ ) { + for( var j = 0; j < this.wordWin.totalWords( i ); j++ ) { + if(( i == ti && j > wi ) || i > ti ) { + // future word: set word text to s_word_to_repl if + // 1) do not already have a flag and + // 2) have the same value as s_word_to_repl + if(( this.wordWin.getTextVal( i, j ) == s_word_to_repl ) + && ( !this.wordFlags[i][j] )) { + this._setWordText( i, j, newspell, this.fromReplAll ); + } + } + } + } + + // finally, move on + this.currentWordIndex++; + this._spellcheck(); + return true; +} + +function terminateSpell() { + // called when we have reached the end of the spell checking. + var msg = ""; // by FredCK + var numrepl = this._getTotalReplaced(); + if( numrepl == 0 ) { + // see if there were no misspellings to begin with + if( !this.wordWin ) { + msg = ""; + } else { + if( this.wordWin.totalMisspellings() ) { +// msg += "No words changed."; // by FredCK + msg += FCKLang.DlgSpellNoChanges ; // by FredCK + } else { +// msg += "No misspellings found."; // by FredCK + msg += FCKLang.DlgSpellNoMispell ; // by FredCK + } + } + } else if( numrepl == 1 ) { +// msg += "One word changed."; // by FredCK + msg += FCKLang.DlgSpellOneChange ; // by FredCK + } else { +// msg += numrepl + " words changed."; // by FredCK + msg += FCKLang.DlgSpellManyChanges.replace( /%1/g, numrepl ) ; + } + if( msg ) { +// msg += "\n"; // by FredCK + alert( msg ); + } + + if( numrepl > 0 ) { + // update the text field(s) on the opener window + for( var i = 0; i < this.textInputs.length; i++ ) { + // this.textArea.value = this.wordWin.text; + if( this.wordWin ) { + if( this.wordWin.textInputs[i] ) { + this.textInputs[i].value = this.wordWin.textInputs[i]; + } + } + } + } + + // return back to the calling window +// this.spellCheckerWin.close(); // by FredCK + if ( typeof( this.OnFinished ) == 'function' ) // by FredCK + this.OnFinished(numrepl) ; // by FredCK + + return true; +} + +function undo() { + // skip if this is the first word! + var ti = this.currentTextIndex; + var wi = this.currentWordIndex; + + if( this.wordWin.totalPreviousWords( ti, wi ) > 0 ) { + this.wordWin.removeFocus( ti, wi ); + + // go back to the last word index that was acted upon + do { + // if the current word index is zero then reset the seed + if( this.currentWordIndex == 0 && this.currentTextIndex > 0 ) { + this.currentTextIndex--; + this.currentWordIndex = this.wordWin.totalWords( this.currentTextIndex )-1; + if( this.currentWordIndex < 0 ) this.currentWordIndex = 0; + } else { + if( this.currentWordIndex > 0 ) { + this.currentWordIndex--; + } + } + } while ( + this.wordWin.totalWords( this.currentTextIndex ) == 0 + || this.wordFlags[this.currentTextIndex][this.currentWordIndex] == this.fromIgnrAll + || this.wordFlags[this.currentTextIndex][this.currentWordIndex] == this.fromReplAll + ); + + var text_idx = this.currentTextIndex; + var idx = this.currentWordIndex; + var preReplSpell = this.wordWin.originalSpellings[text_idx][idx]; + + // if we got back to the first word then set the Undo button back to disabled + if( this.wordWin.totalPreviousWords( text_idx, idx ) == 0 ) { + this.controlWin.disableUndo(); + } + + var i, j, origSpell ; + // examine what happened to this current word. + switch( this.wordFlags[text_idx][idx] ) { + // replace all: go through this and all the future occurances of the word + // and revert them all to the original spelling and clear their flags + case this.replAllFlag : + for( i = text_idx; i < this.wordWin.textInputs.length; i++ ) { + for( j = 0; j < this.wordWin.totalWords( i ); j++ ) { + if(( i == text_idx && j >= idx ) || i > text_idx ) { + origSpell = this.wordWin.originalSpellings[i][j]; + if( origSpell == preReplSpell ) { + this._setWordText ( i, j, origSpell, undefined ); + } + } + } + } + break; + + // ignore all: go through all the future occurances of the word + // and clear their flags + case this.ignrAllFlag : + for( i = text_idx; i < this.wordWin.textInputs.length; i++ ) { + for( j = 0; j < this.wordWin.totalWords( i ); j++ ) { + if(( i == text_idx && j >= idx ) || i > text_idx ) { + origSpell = this.wordWin.originalSpellings[i][j]; + if( origSpell == preReplSpell ) { + this.wordFlags[i][j] = undefined; + } + } + } + } + break; + + // replace: revert the word to its original spelling + case this.replWordFlag : + this._setWordText ( text_idx, idx, preReplSpell, undefined ); + break; + } + + // For all four cases, clear the wordFlag of this word. re-start the process + this.wordFlags[text_idx][idx] = undefined; + this._spellcheck(); + } +} + +function _spellcheck() { + var ww = this.wordWin; + + // check if this is the last word in the current text element + if( this.currentWordIndex == ww.totalWords( this.currentTextIndex) ) { + this.currentTextIndex++; + this.currentWordIndex = 0; + // keep going if we're not yet past the last text element + if( this.currentTextIndex < this.wordWin.textInputs.length ) { + this._spellcheck(); + return; + } else { + this.terminateSpell(); + return; + } + } + + // if this is after the first one make sure the Undo button is enabled + if( this.currentWordIndex > 0 ) { + this.controlWin.enableUndo(); + } + + // skip the current word if it has already been worked on + if( this.wordFlags[this.currentTextIndex][this.currentWordIndex] ) { + // increment the global current word index and move on. + this.currentWordIndex++; + this._spellcheck(); + } else { + var evalText = ww.getTextVal( this.currentTextIndex, this.currentWordIndex ); + if( evalText ) { + this.controlWin.evaluatedText.value = evalText; + ww.setFocus( this.currentTextIndex, this.currentWordIndex ); + this._getSuggestions( this.currentTextIndex, this.currentWordIndex ); + } + } +} + +function _getSuggestions( text_num, word_num ) { + this.controlWin.clearSuggestions(); + // add suggestion in list for each suggested word. + // get the array of suggested words out of the + // three-dimensional array containing all suggestions. + var a_suggests = this.wordWin.suggestions[text_num][word_num]; + if( a_suggests ) { + // got an array of suggestions. + for( var ii = 0; ii < a_suggests.length; ii++ ) { + this.controlWin.addSuggestion( a_suggests[ii] ); + } + } + this.controlWin.selectDefaultSuggestion(); +} + +function _setAsIgnored( text_num, word_num, flag ) { + // set the UI + this.wordWin.removeFocus( text_num, word_num ); + // do the bookkeeping + this.wordFlags[text_num][word_num] = flag; + return true; +} + +function _getTotalReplaced() { + var i_replaced = 0; + for( var i = 0; i < this.wordFlags.length; i++ ) { + for( var j = 0; j < this.wordFlags[i].length; j++ ) { + if(( this.wordFlags[i][j] == this.replWordFlag ) + || ( this.wordFlags[i][j] == this.replAllFlag ) + || ( this.wordFlags[i][j] == this.fromReplAll )) { + i_replaced++; + } + } + } + return i_replaced; +} + +function _setWordText( text_num, word_num, newText, flag ) { + // set the UI and form inputs + this.wordWin.setText( text_num, word_num, newText ); + // keep track of what happened to this word: + this.wordFlags[text_num][word_num] = flag; + return true; +} + +function _getFormInputs( inputPattern ) { + var inputs = new Array(); + for( var i = 0; i < document.forms.length; i++ ) { + for( var j = 0; j < document.forms[i].elements.length; j++ ) { + if( document.forms[i].elements[j].type.match( inputPattern )) { + inputs[inputs.length] = document.forms[i].elements[j]; + } + } + } + return inputs; +} + diff --git a/FCKeditor/editor/dialog/fck_spellerpages/spellerpages/spellchecker.html b/FCKeditor/editor/dialog/fck_spellerpages/spellerpages/spellchecker.html new file mode 100644 index 0000000..d803fc3 --- /dev/null +++ b/FCKeditor/editor/dialog/fck_spellerpages/spellerpages/spellchecker.html @@ -0,0 +1,71 @@ + + + + + + +Speller Pages + + + + + + diff --git a/FCKeditor/editor/dialog/fck_spellerpages/spellerpages/spellerStyle.css b/FCKeditor/editor/dialog/fck_spellerpages/spellerpages/spellerStyle.css new file mode 100644 index 0000000..47bc1ef --- /dev/null +++ b/FCKeditor/editor/dialog/fck_spellerpages/spellerpages/spellerStyle.css @@ -0,0 +1,49 @@ +.blend { + font-family: courier new; + font-size: 10pt; + border: 0; + margin-bottom:-1; +} +.normalLabel { + font-size:8pt; +} +.normalText { + font-family:arial, helvetica, sans-serif; + font-size:10pt; + color:000000; + background-color:FFFFFF; +} +.plainText { + font-family: courier new, courier, monospace; + font-size: 10pt; + color:000000; + background-color:FFFFFF; +} +.controlWindowBody { + font-family:arial, helvetica, sans-serif; + font-size:8pt; + padding: 7px ; /* by FredCK */ + margin: 0px ; /* by FredCK */ + /* color:000000; by FredCK */ + /* background-color:DADADA; by FredCK */ +} +.readonlyInput { + background-color:DADADA; + color:000000; + font-size:8pt; + width:392px; +} +.textDefault { + font-size:8pt; + width: 200px; +} +.buttonDefault { + width:90px; + height:22px; + font-size:8pt; +} +.suggSlct { + width:200px; + margin-top:2; + font-size:8pt; +} \ No newline at end of file diff --git a/FCKeditor/editor/dialog/fck_spellerpages/spellerpages/wordWindow.js b/FCKeditor/editor/dialog/fck_spellerpages/spellerpages/wordWindow.js new file mode 100644 index 0000000..31a5692 --- /dev/null +++ b/FCKeditor/editor/dialog/fck_spellerpages/spellerpages/wordWindow.js @@ -0,0 +1,272 @@ +//////////////////////////////////////////////////// +// wordWindow object +//////////////////////////////////////////////////// +function wordWindow() { + // private properties + this._forms = []; + + // private methods + this._getWordObject = _getWordObject; + //this._getSpellerObject = _getSpellerObject; + this._wordInputStr = _wordInputStr; + this._adjustIndexes = _adjustIndexes; + this._isWordChar = _isWordChar; + this._lastPos = _lastPos; + + // public properties + this.wordChar = /[a-zA-Z]/; + this.windowType = "wordWindow"; + this.originalSpellings = new Array(); + this.suggestions = new Array(); + this.checkWordBgColor = "pink"; + this.normWordBgColor = "white"; + this.text = ""; + this.textInputs = new Array(); + this.indexes = new Array(); + //this.speller = this._getSpellerObject(); + + // public methods + this.resetForm = resetForm; + this.totalMisspellings = totalMisspellings; + this.totalWords = totalWords; + this.totalPreviousWords = totalPreviousWords; + //this.getTextObjectArray = getTextObjectArray; + this.getTextVal = getTextVal; + this.setFocus = setFocus; + this.removeFocus = removeFocus; + this.setText = setText; + //this.getTotalWords = getTotalWords; + this.writeBody = writeBody; + this.printForHtml = printForHtml; +} + +function resetForm() { + if( this._forms ) { + for( var i = 0; i < this._forms.length; i++ ) { + this._forms[i].reset(); + } + } + return true; +} + +function totalMisspellings() { + var total_words = 0; + for( var i = 0; i < this.textInputs.length; i++ ) { + total_words += this.totalWords( i ); + } + return total_words; +} + +function totalWords( textIndex ) { + return this.originalSpellings[textIndex].length; +} + +function totalPreviousWords( textIndex, wordIndex ) { + var total_words = 0; + for( var i = 0; i <= textIndex; i++ ) { + for( var j = 0; j < this.totalWords( i ); j++ ) { + if( i == textIndex && j == wordIndex ) { + break; + } else { + total_words++; + } + } + } + return total_words; +} + +//function getTextObjectArray() { +// return this._form.elements; +//} + +function getTextVal( textIndex, wordIndex ) { + var word = this._getWordObject( textIndex, wordIndex ); + if( word ) { + return word.value; + } +} + +function setFocus( textIndex, wordIndex ) { + var word = this._getWordObject( textIndex, wordIndex ); + if( word ) { + if( word.type == "text" ) { + word.focus(); + word.style.backgroundColor = this.checkWordBgColor; + } + } +} + +function removeFocus( textIndex, wordIndex ) { + var word = this._getWordObject( textIndex, wordIndex ); + if( word ) { + if( word.type == "text" ) { + word.blur(); + word.style.backgroundColor = this.normWordBgColor; + } + } +} + +function setText( textIndex, wordIndex, newText ) { + var word = this._getWordObject( textIndex, wordIndex ); + var beginStr; + var endStr; + if( word ) { + var pos = this.indexes[textIndex][wordIndex]; + var oldText = word.value; + // update the text given the index of the string + beginStr = this.textInputs[textIndex].substring( 0, pos ); + endStr = this.textInputs[textIndex].substring( + pos + oldText.length, + this.textInputs[textIndex].length + ); + this.textInputs[textIndex] = beginStr + newText + endStr; + + // adjust the indexes on the stack given the differences in + // length between the new word and old word. + var lengthDiff = newText.length - oldText.length; + this._adjustIndexes( textIndex, wordIndex, lengthDiff ); + + word.size = newText.length; + word.value = newText; + this.removeFocus( textIndex, wordIndex ); + } +} + + +function writeBody() { + var d = window.document; + var is_html = false; + + d.open(); + + // iterate through each text input. + for( var txtid = 0; txtid < this.textInputs.length; txtid++ ) { + var end_idx = 0; + var begin_idx = 0; + d.writeln( '
' ); + var wordtxt = this.textInputs[txtid]; + this.indexes[txtid] = []; + + if( wordtxt ) { + var orig = this.originalSpellings[txtid]; + if( !orig ) break; + + //!!! plain text, or HTML mode? + d.writeln( '
' ); + // iterate through each occurrence of a misspelled word. + for( var i = 0; i < orig.length; i++ ) { + // find the position of the current misspelled word, + // starting at the last misspelled word. + // and keep looking if it's a substring of another word + do { + begin_idx = wordtxt.indexOf( orig[i], end_idx ); + end_idx = begin_idx + orig[i].length; + // word not found? messed up! + if( begin_idx == -1 ) break; + // look at the characters immediately before and after + // the word. If they are word characters we'll keep looking. + var before_char = wordtxt.charAt( begin_idx - 1 ); + var after_char = wordtxt.charAt( end_idx ); + } while ( + this._isWordChar( before_char ) + || this._isWordChar( after_char ) + ); + + // keep track of its position in the original text. + this.indexes[txtid][i] = begin_idx; + + // write out the characters before the current misspelled word + for( var j = this._lastPos( txtid, i ); j < begin_idx; j++ ) { + // !!! html mode? make it html compatible + d.write( this.printForHtml( wordtxt.charAt( j ))); + } + + // write out the misspelled word. + d.write( this._wordInputStr( orig[i] )); + + // if it's the last word, write out the rest of the text + if( i == orig.length-1 ){ + d.write( printForHtml( wordtxt.substr( end_idx ))); + } + } + + d.writeln( '
' ); + + } + d.writeln( '
' ); + } + //for ( var j = 0; j < d.forms.length; j++ ) { + // alert( d.forms[j].name ); + // for( var k = 0; k < d.forms[j].elements.length; k++ ) { + // alert( d.forms[j].elements[k].name + ": " + d.forms[j].elements[k].value ); + // } + //} + + // set the _forms property + this._forms = d.forms; + d.close(); +} + +// return the character index in the full text after the last word we evaluated +function _lastPos( txtid, idx ) { + if( idx > 0 ) + return this.indexes[txtid][idx-1] + this.originalSpellings[txtid][idx-1].length; + else + return 0; +} + +function printForHtml( n ) { + return n ; // by FredCK +/* + var htmlstr = n; + if( htmlstr.length == 1 ) { + // do simple case statement if it's just one character + switch ( n ) { + case "\n": + htmlstr = '
'; + break; + case "<": + htmlstr = '<'; + break; + case ">": + htmlstr = '>'; + break; + } + return htmlstr; + } else { + htmlstr = htmlstr.replace( //g, '>' ); + htmlstr = htmlstr.replace( /\n/g, '
' ); + return htmlstr; + } +*/ +} + +function _isWordChar( letter ) { + if( letter.search( this.wordChar ) == -1 ) { + return false; + } else { + return true; + } +} + +function _getWordObject( textIndex, wordIndex ) { + if( this._forms[textIndex] ) { + if( this._forms[textIndex].elements[wordIndex] ) { + return this._forms[textIndex].elements[wordIndex]; + } + } + return null; +} + +function _wordInputStr( word ) { + var str = ''; + return str; +} + +function _adjustIndexes( textIndex, wordIndex, lengthDiff ) { + for( var i = wordIndex + 1; i < this.originalSpellings[textIndex].length; i++ ) { + this.indexes[textIndex][i] = this.indexes[textIndex][i] + lengthDiff; + } +} diff --git a/FCKeditor/editor/dialog/fck_table.html b/FCKeditor/editor/dialog/fck_table.html new file mode 100644 index 0000000..db895ed --- /dev/null +++ b/FCKeditor/editor/dialog/fck_table.html @@ -0,0 +1,293 @@ + + + + + Table Properties + + + + + + + + + + +
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ Rows: +  
+ Columns: +  
+   +  
+ Border size: +  
+ Alignment: +  
+
+     + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Width: +   +  
+ Height: +   +  pixels
+   +   +  
+ Cell spacing: +   +  
+ Cell padding: +   +  
+
+ + + + + + + + + + + +
+ Caption +   +
+ Summary +   +
+
+ + diff --git a/FCKeditor/editor/dialog/fck_tablecell.html b/FCKeditor/editor/dialog/fck_tablecell.html new file mode 100644 index 0000000..8484cb5 --- /dev/null +++ b/FCKeditor/editor/dialog/fck_tablecell.html @@ -0,0 +1,255 @@ + + + + + Table Cell Properties + + + + + + + + + + +
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Width: +   
+ Height: +   pixels
+   +  
+ Word Wrap: +  
+   +  
+ Horizontal Alignment: +  
+ Vertical Alignment: +  
+
+     + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Rows Span: +   + +
+ Columns Span: +   + +
+   +   +  
+ Background Color: +   +   +
+ Border Color: +   +   +
+
+
+ + diff --git a/FCKeditor/editor/dialog/fck_template.html b/FCKeditor/editor/dialog/fck_template.html new file mode 100644 index 0000000..0677fb5 --- /dev/null +++ b/FCKeditor/editor/dialog/fck_template.html @@ -0,0 +1,242 @@ + + + + + + + + + + + + + + + + + + + + + + +
+ Please select the template to open in the editor
+ (the actual contents will be lost):
+
+
+ + +
+
+ + diff --git a/FCKeditor/editor/dialog/fck_template/images/template1.gif b/FCKeditor/editor/dialog/fck_template/images/template1.gif new file mode 100644 index 0000000..efdabbe Binary files /dev/null and b/FCKeditor/editor/dialog/fck_template/images/template1.gif differ diff --git a/FCKeditor/editor/dialog/fck_template/images/template2.gif b/FCKeditor/editor/dialog/fck_template/images/template2.gif new file mode 100644 index 0000000..d1cebb3 Binary files /dev/null and b/FCKeditor/editor/dialog/fck_template/images/template2.gif differ diff --git a/FCKeditor/editor/dialog/fck_template/images/template3.gif b/FCKeditor/editor/dialog/fck_template/images/template3.gif new file mode 100644 index 0000000..db41cb4 Binary files /dev/null and b/FCKeditor/editor/dialog/fck_template/images/template3.gif differ diff --git a/FCKeditor/editor/dialog/fck_textarea.html b/FCKeditor/editor/dialog/fck_textarea.html new file mode 100644 index 0000000..e334684 --- /dev/null +++ b/FCKeditor/editor/dialog/fck_textarea.html @@ -0,0 +1,96 @@ + + + + + Text Area Properties + + + + + + + + + + +
+ + + + +
+ Name
+ + Collumns
+ +
+ Rows
+ +
+
+ + diff --git a/FCKeditor/editor/dialog/fck_textfield.html b/FCKeditor/editor/dialog/fck_textfield.html new file mode 100644 index 0000000..ae6d973 --- /dev/null +++ b/FCKeditor/editor/dialog/fck_textfield.html @@ -0,0 +1,141 @@ + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + +
+ Name
+ +
+ + Value
+ +
+ Character Width
+ +
+ + Maximum Characters
+ +
+ Type
+ +
+   +
+
+ + diff --git a/FCKeditor/editor/dtd/fck_dtd_test.html b/FCKeditor/editor/dtd/fck_dtd_test.html new file mode 100644 index 0000000..3709054 --- /dev/null +++ b/FCKeditor/editor/dtd/fck_dtd_test.html @@ -0,0 +1,43 @@ + + + + DTD Test Page + + + + + +

+ DTD Contents +

+ + +
+ + diff --git a/FCKeditor/editor/dtd/fck_xhtml10strict.js b/FCKeditor/editor/dtd/fck_xhtml10strict.js new file mode 100644 index 0000000..9f6adb7 --- /dev/null +++ b/FCKeditor/editor/dtd/fck_xhtml10strict.js @@ -0,0 +1,116 @@ +/* + * FCKeditor - The text editor for Internet - http://www.fckeditor.net + * Copyright (C) 2003-2007 Frederico Caldeira Knabben + * + * == BEGIN LICENSE == + * + * Licensed under the terms of any of the following licenses at your + * choice: + * + * - GNU General Public License Version 2 or later (the "GPL") + * http://www.gnu.org/licenses/gpl.html + * + * - GNU Lesser General Public License Version 2.1 or later (the "LGPL") + * http://www.gnu.org/licenses/lgpl.html + * + * - Mozilla Public License Version 1.1 or later (the "MPL") + * http://www.mozilla.org/MPL/MPL-1.1.html + * + * == END LICENSE == + * + * Contains the DTD mapping for XHTML 1.0 Strict. + * This file was automatically generated from the file: xhtml10-strict.dtd + */ +FCK.DTD = (function() +{ + X = FCKTools.Merge ; + + var H,I,J,K,C,L,M,A,B,D,E,G,N,F ; + A = {ins:1, del:1, script:1} ; + B = {hr:1, ul:1, div:1, blockquote:1, noscript:1, table:1, address:1, pre:1, p:1, h5:1, dl:1, h4:1, ol:1, h6:1, h1:1, h3:1, h2:1} ; + C = X({fieldset:1}, B) ; + D = X({sub:1, bdo:1, 'var':1, sup:1, br:1, kbd:1, map:1, samp:1, b:1, acronym:1, '#':1, abbr:1, code:1, i:1, cite:1, tt:1, strong:1, q:1, em:1, big:1, small:1, span:1, dfn:1}, A) ; + E = X({img:1, object:1}, D) ; + F = {input:1, button:1, textarea:1, select:1, label:1} ; + G = X({a:1}, F) ; + H = {img:1, noscript:1, br:1, kbd:1, button:1, h5:1, h4:1, samp:1, h6:1, ol:1, h1:1, h3:1, h2:1, form:1, select:1, '#':1, ins:1, abbr:1, label:1, code:1, table:1, script:1, cite:1, input:1, strong:1, textarea:1, big:1, small:1, span:1, hr:1, sub:1, bdo:1, 'var':1, div:1, object:1, sup:1, map:1, dl:1, del:1, fieldset:1, ul:1, b:1, acronym:1, a:1, blockquote:1, i:1, address:1, tt:1, q:1, pre:1, p:1, em:1, dfn:1} ; + + I = X({form:1, fieldset:1}, B, E, G) ; + J = {tr:1} ; + K = {'#':1} ; + L = X(E, G) ; + M = {li:1} ; + N = X({form:1}, A, C) ; + + return { + col: {}, + tr: {td:1, th:1}, + img: {}, + colgroup: {col:1}, + noscript: N, + td: I, + br: {}, + th: I, + kbd: L, + button: X(B, E), + h5: L, + h4: L, + samp: L, + h6: L, + ol: M, + h1: L, + h3: L, + option: K, + h2: L, + form: X(A, C), + select: {optgroup:1, option:1}, + ins: I, + abbr: L, + label: L, + code: L, + table: {thead:1, col:1, tbody:1, tr:1, colgroup:1, caption:1, tfoot:1}, + script: K, + tfoot: J, + cite: L, + li: I, + input: {}, + strong: L, + textarea: K, + big: L, + small: L, + span: L, + dt: L, + hr: {}, + sub: L, + optgroup: {option:1}, + bdo: L, + param: {}, + 'var': L, + div: I, + object: X({param:1}, H), + sup: L, + dd: I, + area: {}, + map: X({form:1, area:1}, A, C), + dl: {dt:1, dd:1}, + del: I, + fieldset: X({legend:1}, H), + thead: J, + ul: M, + acronym: L, + b: L, + a: X({img:1, object:1}, D, F), + blockquote: N, + caption: L, + i: L, + tbody: J, + address: L, + tt: L, + legend: L, + q: L, + pre: X({a:1}, D, F), + p: L, + em: L, + dfn: L + } ; +})() ; diff --git a/FCKeditor/editor/dtd/fck_xhtml10transitional.js b/FCKeditor/editor/dtd/fck_xhtml10transitional.js new file mode 100644 index 0000000..cde4df0 --- /dev/null +++ b/FCKeditor/editor/dtd/fck_xhtml10transitional.js @@ -0,0 +1,140 @@ +/* + * FCKeditor - The text editor for Internet - http://www.fckeditor.net + * Copyright (C) 2003-2007 Frederico Caldeira Knabben + * + * == BEGIN LICENSE == + * + * Licensed under the terms of any of the following licenses at your + * choice: + * + * - GNU General Public License Version 2 or later (the "GPL") + * http://www.gnu.org/licenses/gpl.html + * + * - GNU Lesser General Public License Version 2.1 or later (the "LGPL") + * http://www.gnu.org/licenses/lgpl.html + * + * - Mozilla Public License Version 1.1 or later (the "MPL") + * http://www.mozilla.org/MPL/MPL-1.1.html + * + * == END LICENSE == + * + * Contains the DTD mapping for XHTML 1.0 Transitional. + * This file was automatically generated from the file: xhtml10-transitional.dtd + */ +FCK.DTD = (function() +{ + X = FCKTools.Merge ; + + var A,L,J,M,N,O,D,H,P,K,Q,F,G,C,B,E,I ; + A = {isindex:1, fieldset:1} ; + B = {input:1, button:1, select:1, textarea:1, label:1} ; + C = X({a:1}, B) ; + D = X({iframe:1}, C) ; + E = {hr:1, ul:1, menu:1, div:1, blockquote:1, noscript:1, table:1, center:1, address:1, dir:1, pre:1, h5:1, dl:1, h4:1, noframes:1, h6:1, ol:1, h1:1, h3:1, h2:1} ; + F = {ins:1, del:1, script:1} ; + G = X({b:1, acronym:1, bdo:1, 'var':1, '#':1, abbr:1, code:1, br:1, i:1, cite:1, kbd:1, u:1, strike:1, s:1, tt:1, strong:1, q:1, samp:1, em:1, dfn:1, span:1}, F) ; + H = X({sub:1, img:1, object:1, sup:1, basefont:1, map:1, applet:1, font:1, big:1, small:1}, G) ; + I = X({p:1}, H) ; + J = X({iframe:1}, H, B) ; + K = {img:1, noscript:1, br:1, kbd:1, center:1, button:1, basefont:1, h5:1, h4:1, samp:1, h6:1, ol:1, h1:1, h3:1, h2:1, form:1, font:1, '#':1, select:1, menu:1, ins:1, abbr:1, label:1, code:1, table:1, script:1, cite:1, input:1, iframe:1, strong:1, textarea:1, noframes:1, big:1, small:1, span:1, hr:1, sub:1, bdo:1, 'var':1, div:1, object:1, sup:1, strike:1, dir:1, map:1, dl:1, applet:1, del:1, isindex:1, fieldset:1, ul:1, b:1, acronym:1, a:1, blockquote:1, i:1, u:1, s:1, tt:1, address:1, q:1, pre:1, p:1, em:1, dfn:1} ; + + L = X({a:1}, J) ; + M = {tr:1} ; + N = {'#':1} ; + O = X({param:1}, K) ; + P = X({form:1}, A, D, E, I) ; + Q = {li:1} ; + + return { + col: {}, + tr: {td:1, th:1}, + img: {}, + colgroup: {col:1}, + noscript: P, + td: P, + br: {}, + th: P, + center: P, + kbd: L, + button: X(I, E), + basefont: {}, + h5: L, + h4: L, + samp: L, + h6: L, + ol: Q, + h1: L, + h3: L, + option: N, + h2: L, + form: X(A, D, E, I), + select: {optgroup:1, option:1}, + font: J, // Changed from L to J (see (1)) + ins: P, + menu: Q, + abbr: L, + label: L, + table: {thead:1, col:1, tbody:1, tr:1, colgroup:1, caption:1, tfoot:1}, + code: L, + script: N, + tfoot: M, + cite: L, + li: P, + input: {}, + iframe: P, + strong: J, // Changed from L to J (see (1)) + textarea: N, + noframes: P, + big: J, // Changed from L to J (see (1)) + small: J, // Changed from L to J (see (1)) + span: J, // Changed from L to J (see (1)) + hr: {}, + dt: L, + sub: J, // Changed from L to J (see (1)) + optgroup: {option:1}, + param: {}, + bdo: L, + 'var': J, // Changed from L to J (see (1)) + div: P, + object: O, + sup: J, // Changed from L to J (see (1)) + dd: P, + strike: J, // Changed from L to J (see (1)) + area: {}, + dir: Q, + map: X({area:1, form:1, p:1}, A, F, E), + applet: O, + dl: {dt:1, dd:1}, + del: P, + isindex: {}, + fieldset: X({legend:1}, K), + thead: M, + ul: Q, + acronym: L, + b: J, // Changed from L to J (see (1)) + a: J, + blockquote: P, + caption: L, + i: J, // Changed from L to J (see (1)) + u: J, // Changed from L to J (see (1)) + tbody: M, + s: L, + address: X(D, I), + tt: J, // Changed from L to J (see (1)) + legend: L, + q: L, + pre: X(G, C), + p: L, + em: J, // Changed from L to J (see (1)) + dfn: L + } ; +})() ; + +/* + Notes: + (1) According to the DTD, many elements, like accept elements + inside of them. But, to produce better output results, we have manually + changed the map to avoid breaking the links on pieces, having + "this is a link test", instead of + "this is a link test". +*/ \ No newline at end of file diff --git a/FCKeditor/editor/fckdebug.html b/FCKeditor/editor/fckdebug.html new file mode 100644 index 0000000..2bc173d --- /dev/null +++ b/FCKeditor/editor/fckdebug.html @@ -0,0 +1,153 @@ + + + + + FCKeditor Debug Window + + + + + + + + + + + +
+ + + + + +
+ FCKeditor Debug Window +
+
+ +
+ + diff --git a/FCKeditor/editor/fckdialog.html b/FCKeditor/editor/fckdialog.html new file mode 100644 index 0000000..f3a90a3 --- /dev/null +++ b/FCKeditor/editor/fckdialog.html @@ -0,0 +1,340 @@ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ +
+ + + + + +
  + +   + +
+
+ + diff --git a/FCKeditor/editor/fckeditor.html b/FCKeditor/editor/fckeditor.html new file mode 100644 index 0000000..37de86b --- /dev/null +++ b/FCKeditor/editor/fckeditor.html @@ -0,0 +1,228 @@ + + + + + FCKeditor + + + + + + + + + + + + + + + + + + +
+ + diff --git a/FCKeditor/editor/fckeditor.original.html b/FCKeditor/editor/fckeditor.original.html new file mode 100644 index 0000000..5be3fe3 --- /dev/null +++ b/FCKeditor/editor/fckeditor.original.html @@ -0,0 +1,331 @@ + + + + + FCKeditor + + + + + + + + + + + + + + + + + + +
+ + diff --git a/FCKeditor/editor/filemanager/browser/default/browser.css b/FCKeditor/editor/filemanager/browser/default/browser.css new file mode 100644 index 0000000..cdc5262 --- /dev/null +++ b/FCKeditor/editor/filemanager/browser/default/browser.css @@ -0,0 +1,89 @@ +/* + * FCKeditor - The text editor for Internet - http://www.fckeditor.net + * Copyright (C) 2003-2007 Frederico Caldeira Knabben + * + * == BEGIN LICENSE == + * + * Licensed under the terms of any of the following licenses at your + * choice: + * + * - GNU General Public License Version 2 or later (the "GPL") + * http://www.gnu.org/licenses/gpl.html + * + * - GNU Lesser General Public License Version 2.1 or later (the "LGPL") + * http://www.gnu.org/licenses/lgpl.html + * + * - Mozilla Public License Version 1.1 or later (the "MPL") + * http://www.mozilla.org/MPL/MPL-1.1.html + * + * == END LICENSE == + * + * CSS styles used by all pages that compose the File Browser. + */ + +body +{ + background-color: #f1f1e3; +} + +form +{ + margin: 0px 0px 0px 0px ; + padding: 0px 0px 0px 0px ; +} + +.Frame +{ + background-color: #f1f1e3; + border-color: #f1f1e3; + border-right: thin inset; + border-top: thin inset; + border-left: thin inset; + border-bottom: thin inset; +} + +body.FileArea +{ + + background-color: #ffffff; + margin: 10px; +} + +body, td, input, select +{ + font-size: 11px; + font-family: 'Microsoft Sans Serif' , Arial, Helvetica, Verdana; +} + +.ActualFolder +{ + font-weight: bold; + font-size: 14px; +} + +.PopupButtons +{ + border-top: #d5d59d 1px solid; + background-color: #e3e3c7; + padding: 7px 10px 7px 10px; +} + +.Button, button +{ + border-right: #737357 1px solid; + border-top: #737357 1px solid; + border-left: #737357 1px solid; + color: #3b3b1f; + border-bottom: #737357 1px solid; + background-color: #c7c78f; +} + +.FolderListCurrentFolder img +{ + background-image: url(images/FolderOpened.gif); +} + +.FolderListFolder img +{ + background-image: url(images/Folder.gif); +} \ No newline at end of file diff --git a/FCKeditor/editor/filemanager/browser/default/browser.html b/FCKeditor/editor/filemanager/browser/default/browser.html new file mode 100644 index 0000000..7ad7d3c --- /dev/null +++ b/FCKeditor/editor/filemanager/browser/default/browser.html @@ -0,0 +1,163 @@ + + + + + FCKeditor - Resources Browser + + + + + + + + + + + + + + + + + + + + diff --git a/FCKeditor/editor/filemanager/browser/default/frmactualfolder.html b/FCKeditor/editor/filemanager/browser/default/frmactualfolder.html new file mode 100644 index 0000000..5c4ee03 --- /dev/null +++ b/FCKeditor/editor/filemanager/browser/default/frmactualfolder.html @@ -0,0 +1,67 @@ + + + + + + + + + + + + +
+ +
+ + diff --git a/FCKeditor/editor/filemanager/browser/default/frmcreatefolder.html b/FCKeditor/editor/filemanager/browser/default/frmcreatefolder.html new file mode 100644 index 0000000..fa73c59 --- /dev/null +++ b/FCKeditor/editor/filemanager/browser/default/frmcreatefolder.html @@ -0,0 +1,113 @@ + + + + + + + + + + + + + + +
+ +
+ + diff --git a/FCKeditor/editor/filemanager/browser/default/frmfolders.html b/FCKeditor/editor/filemanager/browser/default/frmfolders.html new file mode 100644 index 0000000..d4500f6 --- /dev/null +++ b/FCKeditor/editor/filemanager/browser/default/frmfolders.html @@ -0,0 +1,196 @@ + + + + + + + + + + + + + + +
+ + diff --git a/FCKeditor/editor/filemanager/browser/default/frmresourceslist.html b/FCKeditor/editor/filemanager/browser/default/frmresourceslist.html new file mode 100644 index 0000000..c8e4d67 --- /dev/null +++ b/FCKeditor/editor/filemanager/browser/default/frmresourceslist.html @@ -0,0 +1,167 @@ + + + + + + + + + + + diff --git a/FCKeditor/editor/filemanager/browser/default/frmresourcetype.html b/FCKeditor/editor/filemanager/browser/default/frmresourcetype.html new file mode 100644 index 0000000..976039c --- /dev/null +++ b/FCKeditor/editor/filemanager/browser/default/frmresourcetype.html @@ -0,0 +1,65 @@ + + + + + + + + + + + + + + +
+ Resource Type
+ +
+ + diff --git a/FCKeditor/editor/filemanager/browser/default/frmupload.html b/FCKeditor/editor/filemanager/browser/default/frmupload.html new file mode 100644 index 0000000..daa633b --- /dev/null +++ b/FCKeditor/editor/filemanager/browser/default/frmupload.html @@ -0,0 +1,114 @@ + + + + + File Upload + + + + + +
+ + + + +
+ Upload a new file in this folder
+ + + + + +
 
+
+
+ + diff --git a/FCKeditor/editor/filemanager/browser/default/images/ButtonArrow.gif b/FCKeditor/editor/filemanager/browser/default/images/ButtonArrow.gif new file mode 100644 index 0000000..a355e5a Binary files /dev/null and b/FCKeditor/editor/filemanager/browser/default/images/ButtonArrow.gif differ diff --git a/FCKeditor/editor/filemanager/browser/default/images/Folder.gif b/FCKeditor/editor/filemanager/browser/default/images/Folder.gif new file mode 100644 index 0000000..ab6824d Binary files /dev/null and b/FCKeditor/editor/filemanager/browser/default/images/Folder.gif differ diff --git a/FCKeditor/editor/filemanager/browser/default/images/Folder32.gif b/FCKeditor/editor/filemanager/browser/default/images/Folder32.gif new file mode 100644 index 0000000..b93b752 Binary files /dev/null and b/FCKeditor/editor/filemanager/browser/default/images/Folder32.gif differ diff --git a/FCKeditor/editor/filemanager/browser/default/images/FolderOpened.gif b/FCKeditor/editor/filemanager/browser/default/images/FolderOpened.gif new file mode 100644 index 0000000..0c5dd41 Binary files /dev/null and b/FCKeditor/editor/filemanager/browser/default/images/FolderOpened.gif differ diff --git a/FCKeditor/editor/filemanager/browser/default/images/FolderOpened32.gif b/FCKeditor/editor/filemanager/browser/default/images/FolderOpened32.gif new file mode 100644 index 0000000..3e3fcf5 Binary files /dev/null and b/FCKeditor/editor/filemanager/browser/default/images/FolderOpened32.gif differ diff --git a/FCKeditor/editor/filemanager/browser/default/images/FolderUp.gif b/FCKeditor/editor/filemanager/browser/default/images/FolderUp.gif new file mode 100644 index 0000000..ad5bc20 Binary files /dev/null and b/FCKeditor/editor/filemanager/browser/default/images/FolderUp.gif differ diff --git a/FCKeditor/editor/filemanager/browser/default/images/icons/32/ai.gif b/FCKeditor/editor/filemanager/browser/default/images/icons/32/ai.gif new file mode 100644 index 0000000..699e6a3 Binary files /dev/null and b/FCKeditor/editor/filemanager/browser/default/images/icons/32/ai.gif differ diff --git a/FCKeditor/editor/filemanager/browser/default/images/icons/32/avi.gif b/FCKeditor/editor/filemanager/browser/default/images/icons/32/avi.gif new file mode 100644 index 0000000..97025bb Binary files /dev/null and b/FCKeditor/editor/filemanager/browser/default/images/icons/32/avi.gif differ diff --git a/FCKeditor/editor/filemanager/browser/default/images/icons/32/bmp.gif b/FCKeditor/editor/filemanager/browser/default/images/icons/32/bmp.gif new file mode 100644 index 0000000..f3c7f82 Binary files /dev/null and b/FCKeditor/editor/filemanager/browser/default/images/icons/32/bmp.gif differ diff --git a/FCKeditor/editor/filemanager/browser/default/images/icons/32/cs.gif b/FCKeditor/editor/filemanager/browser/default/images/icons/32/cs.gif new file mode 100644 index 0000000..b62bd02 Binary files /dev/null and b/FCKeditor/editor/filemanager/browser/default/images/icons/32/cs.gif differ diff --git a/FCKeditor/editor/filemanager/browser/default/images/icons/32/default.icon.gif b/FCKeditor/editor/filemanager/browser/default/images/icons/32/default.icon.gif new file mode 100644 index 0000000..976997b Binary files /dev/null and b/FCKeditor/editor/filemanager/browser/default/images/icons/32/default.icon.gif differ diff --git a/FCKeditor/editor/filemanager/browser/default/images/icons/32/dll.gif b/FCKeditor/editor/filemanager/browser/default/images/icons/32/dll.gif new file mode 100644 index 0000000..9b54964 Binary files /dev/null and b/FCKeditor/editor/filemanager/browser/default/images/icons/32/dll.gif differ diff --git a/FCKeditor/editor/filemanager/browser/default/images/icons/32/doc.gif b/FCKeditor/editor/filemanager/browser/default/images/icons/32/doc.gif new file mode 100644 index 0000000..b557568 Binary files /dev/null and b/FCKeditor/editor/filemanager/browser/default/images/icons/32/doc.gif differ diff --git a/FCKeditor/editor/filemanager/browser/default/images/icons/32/exe.gif b/FCKeditor/editor/filemanager/browser/default/images/icons/32/exe.gif new file mode 100644 index 0000000..7584993 Binary files /dev/null and b/FCKeditor/editor/filemanager/browser/default/images/icons/32/exe.gif differ diff --git a/FCKeditor/editor/filemanager/browser/default/images/icons/32/fla.gif b/FCKeditor/editor/filemanager/browser/default/images/icons/32/fla.gif new file mode 100644 index 0000000..923079f Binary files /dev/null and b/FCKeditor/editor/filemanager/browser/default/images/icons/32/fla.gif differ diff --git a/FCKeditor/editor/filemanager/browser/default/images/icons/32/gif.gif b/FCKeditor/editor/filemanager/browser/default/images/icons/32/gif.gif new file mode 100644 index 0000000..df5f579 Binary files /dev/null and b/FCKeditor/editor/filemanager/browser/default/images/icons/32/gif.gif differ diff --git a/FCKeditor/editor/filemanager/browser/default/images/icons/32/htm.gif b/FCKeditor/editor/filemanager/browser/default/images/icons/32/htm.gif new file mode 100644 index 0000000..a9bdf00 Binary files /dev/null and b/FCKeditor/editor/filemanager/browser/default/images/icons/32/htm.gif differ diff --git a/FCKeditor/editor/filemanager/browser/default/images/icons/32/html.gif b/FCKeditor/editor/filemanager/browser/default/images/icons/32/html.gif new file mode 100644 index 0000000..a9bdf00 Binary files /dev/null and b/FCKeditor/editor/filemanager/browser/default/images/icons/32/html.gif differ diff --git a/FCKeditor/editor/filemanager/browser/default/images/icons/32/jpg.gif b/FCKeditor/editor/filemanager/browser/default/images/icons/32/jpg.gif new file mode 100644 index 0000000..de78363 Binary files /dev/null and b/FCKeditor/editor/filemanager/browser/default/images/icons/32/jpg.gif differ diff --git a/FCKeditor/editor/filemanager/browser/default/images/icons/32/js.gif b/FCKeditor/editor/filemanager/browser/default/images/icons/32/js.gif new file mode 100644 index 0000000..fe0c98e Binary files /dev/null and b/FCKeditor/editor/filemanager/browser/default/images/icons/32/js.gif differ diff --git a/FCKeditor/editor/filemanager/browser/default/images/icons/32/mdb.gif b/FCKeditor/editor/filemanager/browser/default/images/icons/32/mdb.gif new file mode 100644 index 0000000..d3af9e8 Binary files /dev/null and b/FCKeditor/editor/filemanager/browser/default/images/icons/32/mdb.gif differ diff --git a/FCKeditor/editor/filemanager/browser/default/images/icons/32/mp3.gif b/FCKeditor/editor/filemanager/browser/default/images/icons/32/mp3.gif new file mode 100644 index 0000000..7d6360f Binary files /dev/null and b/FCKeditor/editor/filemanager/browser/default/images/icons/32/mp3.gif differ diff --git a/FCKeditor/editor/filemanager/browser/default/images/icons/32/pdf.gif b/FCKeditor/editor/filemanager/browser/default/images/icons/32/pdf.gif new file mode 100644 index 0000000..4950ec8 Binary files /dev/null and b/FCKeditor/editor/filemanager/browser/default/images/icons/32/pdf.gif differ diff --git a/FCKeditor/editor/filemanager/browser/default/images/icons/32/png.gif b/FCKeditor/editor/filemanager/browser/default/images/icons/32/png.gif new file mode 100644 index 0000000..0a79ebf Binary files /dev/null and b/FCKeditor/editor/filemanager/browser/default/images/icons/32/png.gif differ diff --git a/FCKeditor/editor/filemanager/browser/default/images/icons/32/ppt.gif b/FCKeditor/editor/filemanager/browser/default/images/icons/32/ppt.gif new file mode 100644 index 0000000..023431c Binary files /dev/null and b/FCKeditor/editor/filemanager/browser/default/images/icons/32/ppt.gif differ diff --git a/FCKeditor/editor/filemanager/browser/default/images/icons/32/rdp.gif b/FCKeditor/editor/filemanager/browser/default/images/icons/32/rdp.gif new file mode 100644 index 0000000..b9eace7 Binary files /dev/null and b/FCKeditor/editor/filemanager/browser/default/images/icons/32/rdp.gif differ diff --git a/FCKeditor/editor/filemanager/browser/default/images/icons/32/swf.gif b/FCKeditor/editor/filemanager/browser/default/images/icons/32/swf.gif new file mode 100644 index 0000000..5df7de5 Binary files /dev/null and b/FCKeditor/editor/filemanager/browser/default/images/icons/32/swf.gif differ diff --git a/FCKeditor/editor/filemanager/browser/default/images/icons/32/swt.gif b/FCKeditor/editor/filemanager/browser/default/images/icons/32/swt.gif new file mode 100644 index 0000000..7807c07 Binary files /dev/null and b/FCKeditor/editor/filemanager/browser/default/images/icons/32/swt.gif differ diff --git a/FCKeditor/editor/filemanager/browser/default/images/icons/32/txt.gif b/FCKeditor/editor/filemanager/browser/default/images/icons/32/txt.gif new file mode 100644 index 0000000..4e2c2e3 Binary files /dev/null and b/FCKeditor/editor/filemanager/browser/default/images/icons/32/txt.gif differ diff --git a/FCKeditor/editor/filemanager/browser/default/images/icons/32/vsd.gif b/FCKeditor/editor/filemanager/browser/default/images/icons/32/vsd.gif new file mode 100644 index 0000000..7624697 Binary files /dev/null and b/FCKeditor/editor/filemanager/browser/default/images/icons/32/vsd.gif differ diff --git a/FCKeditor/editor/filemanager/browser/default/images/icons/32/xls.gif b/FCKeditor/editor/filemanager/browser/default/images/icons/32/xls.gif new file mode 100644 index 0000000..afe724a Binary files /dev/null and b/FCKeditor/editor/filemanager/browser/default/images/icons/32/xls.gif differ diff --git a/FCKeditor/editor/filemanager/browser/default/images/icons/32/xml.gif b/FCKeditor/editor/filemanager/browser/default/images/icons/32/xml.gif new file mode 100644 index 0000000..4fae356 Binary files /dev/null and b/FCKeditor/editor/filemanager/browser/default/images/icons/32/xml.gif differ diff --git a/FCKeditor/editor/filemanager/browser/default/images/icons/32/zip.gif b/FCKeditor/editor/filemanager/browser/default/images/icons/32/zip.gif new file mode 100644 index 0000000..7157f72 Binary files /dev/null and b/FCKeditor/editor/filemanager/browser/default/images/icons/32/zip.gif differ diff --git a/FCKeditor/editor/filemanager/browser/default/images/icons/ai.gif b/FCKeditor/editor/filemanager/browser/default/images/icons/ai.gif new file mode 100644 index 0000000..ba5a913 Binary files /dev/null and b/FCKeditor/editor/filemanager/browser/default/images/icons/ai.gif differ diff --git a/FCKeditor/editor/filemanager/browser/default/images/icons/avi.gif b/FCKeditor/editor/filemanager/browser/default/images/icons/avi.gif new file mode 100644 index 0000000..6f3bac9 Binary files /dev/null and b/FCKeditor/editor/filemanager/browser/default/images/icons/avi.gif differ diff --git a/FCKeditor/editor/filemanager/browser/default/images/icons/bmp.gif b/FCKeditor/editor/filemanager/browser/default/images/icons/bmp.gif new file mode 100644 index 0000000..7708dd8 Binary files /dev/null and b/FCKeditor/editor/filemanager/browser/default/images/icons/bmp.gif differ diff --git a/FCKeditor/editor/filemanager/browser/default/images/icons/cs.gif b/FCKeditor/editor/filemanager/browser/default/images/icons/cs.gif new file mode 100644 index 0000000..4d92723 Binary files /dev/null and b/FCKeditor/editor/filemanager/browser/default/images/icons/cs.gif differ diff --git a/FCKeditor/editor/filemanager/browser/default/images/icons/default.icon.gif b/FCKeditor/editor/filemanager/browser/default/images/icons/default.icon.gif new file mode 100644 index 0000000..6ce26a4 Binary files /dev/null and b/FCKeditor/editor/filemanager/browser/default/images/icons/default.icon.gif differ diff --git a/FCKeditor/editor/filemanager/browser/default/images/icons/dll.gif b/FCKeditor/editor/filemanager/browser/default/images/icons/dll.gif new file mode 100644 index 0000000..48d445a Binary files /dev/null and b/FCKeditor/editor/filemanager/browser/default/images/icons/dll.gif differ diff --git a/FCKeditor/editor/filemanager/browser/default/images/icons/doc.gif b/FCKeditor/editor/filemanager/browser/default/images/icons/doc.gif new file mode 100644 index 0000000..6535b4c Binary files /dev/null and b/FCKeditor/editor/filemanager/browser/default/images/icons/doc.gif differ diff --git a/FCKeditor/editor/filemanager/browser/default/images/icons/exe.gif b/FCKeditor/editor/filemanager/browser/default/images/icons/exe.gif new file mode 100644 index 0000000..315817f Binary files /dev/null and b/FCKeditor/editor/filemanager/browser/default/images/icons/exe.gif differ diff --git a/FCKeditor/editor/filemanager/browser/default/images/icons/fla.gif b/FCKeditor/editor/filemanager/browser/default/images/icons/fla.gif new file mode 100644 index 0000000..8f91a98 Binary files /dev/null and b/FCKeditor/editor/filemanager/browser/default/images/icons/fla.gif differ diff --git a/FCKeditor/editor/filemanager/browser/default/images/icons/gif.gif b/FCKeditor/editor/filemanager/browser/default/images/icons/gif.gif new file mode 100644 index 0000000..a5e3e6c Binary files /dev/null and b/FCKeditor/editor/filemanager/browser/default/images/icons/gif.gif differ diff --git a/FCKeditor/editor/filemanager/browser/default/images/icons/htm.gif b/FCKeditor/editor/filemanager/browser/default/images/icons/htm.gif new file mode 100644 index 0000000..0b5d6ba Binary files /dev/null and b/FCKeditor/editor/filemanager/browser/default/images/icons/htm.gif differ diff --git a/FCKeditor/editor/filemanager/browser/default/images/icons/html.gif b/FCKeditor/editor/filemanager/browser/default/images/icons/html.gif new file mode 100644 index 0000000..0b5d6ba Binary files /dev/null and b/FCKeditor/editor/filemanager/browser/default/images/icons/html.gif differ diff --git a/FCKeditor/editor/filemanager/browser/default/images/icons/jpg.gif b/FCKeditor/editor/filemanager/browser/default/images/icons/jpg.gif new file mode 100644 index 0000000..634b386 Binary files /dev/null and b/FCKeditor/editor/filemanager/browser/default/images/icons/jpg.gif differ diff --git a/FCKeditor/editor/filemanager/browser/default/images/icons/js.gif b/FCKeditor/editor/filemanager/browser/default/images/icons/js.gif new file mode 100644 index 0000000..4ea17d4 Binary files /dev/null and b/FCKeditor/editor/filemanager/browser/default/images/icons/js.gif differ diff --git a/FCKeditor/editor/filemanager/browser/default/images/icons/mdb.gif b/FCKeditor/editor/filemanager/browser/default/images/icons/mdb.gif new file mode 100644 index 0000000..0d7c102 Binary files /dev/null and b/FCKeditor/editor/filemanager/browser/default/images/icons/mdb.gif differ diff --git a/FCKeditor/editor/filemanager/browser/default/images/icons/mp3.gif b/FCKeditor/editor/filemanager/browser/default/images/icons/mp3.gif new file mode 100644 index 0000000..6f3bac9 Binary files /dev/null and b/FCKeditor/editor/filemanager/browser/default/images/icons/mp3.gif differ diff --git a/FCKeditor/editor/filemanager/browser/default/images/icons/pdf.gif b/FCKeditor/editor/filemanager/browser/default/images/icons/pdf.gif new file mode 100644 index 0000000..ca1f94a Binary files /dev/null and b/FCKeditor/editor/filemanager/browser/default/images/icons/pdf.gif differ diff --git a/FCKeditor/editor/filemanager/browser/default/images/icons/png.gif b/FCKeditor/editor/filemanager/browser/default/images/icons/png.gif new file mode 100644 index 0000000..b6d1b32 Binary files /dev/null and b/FCKeditor/editor/filemanager/browser/default/images/icons/png.gif differ diff --git a/FCKeditor/editor/filemanager/browser/default/images/icons/ppt.gif b/FCKeditor/editor/filemanager/browser/default/images/icons/ppt.gif new file mode 100644 index 0000000..877a8c8 Binary files /dev/null and b/FCKeditor/editor/filemanager/browser/default/images/icons/ppt.gif differ diff --git a/FCKeditor/editor/filemanager/browser/default/images/icons/rdp.gif b/FCKeditor/editor/filemanager/browser/default/images/icons/rdp.gif new file mode 100644 index 0000000..916cd7e Binary files /dev/null and b/FCKeditor/editor/filemanager/browser/default/images/icons/rdp.gif differ diff --git a/FCKeditor/editor/filemanager/browser/default/images/icons/swf.gif b/FCKeditor/editor/filemanager/browser/default/images/icons/swf.gif new file mode 100644 index 0000000..314469d Binary files /dev/null and b/FCKeditor/editor/filemanager/browser/default/images/icons/swf.gif differ diff --git a/FCKeditor/editor/filemanager/browser/default/images/icons/swt.gif b/FCKeditor/editor/filemanager/browser/default/images/icons/swt.gif new file mode 100644 index 0000000..314469d Binary files /dev/null and b/FCKeditor/editor/filemanager/browser/default/images/icons/swt.gif differ diff --git a/FCKeditor/editor/filemanager/browser/default/images/icons/txt.gif b/FCKeditor/editor/filemanager/browser/default/images/icons/txt.gif new file mode 100644 index 0000000..1511ba3 Binary files /dev/null and b/FCKeditor/editor/filemanager/browser/default/images/icons/txt.gif differ diff --git a/FCKeditor/editor/filemanager/browser/default/images/icons/vsd.gif b/FCKeditor/editor/filemanager/browser/default/images/icons/vsd.gif new file mode 100644 index 0000000..9be3daa Binary files /dev/null and b/FCKeditor/editor/filemanager/browser/default/images/icons/vsd.gif differ diff --git a/FCKeditor/editor/filemanager/browser/default/images/icons/xls.gif b/FCKeditor/editor/filemanager/browser/default/images/icons/xls.gif new file mode 100644 index 0000000..f57715d Binary files /dev/null and b/FCKeditor/editor/filemanager/browser/default/images/icons/xls.gif differ diff --git a/FCKeditor/editor/filemanager/browser/default/images/icons/xml.gif b/FCKeditor/editor/filemanager/browser/default/images/icons/xml.gif new file mode 100644 index 0000000..4559928 Binary files /dev/null and b/FCKeditor/editor/filemanager/browser/default/images/icons/xml.gif differ diff --git a/FCKeditor/editor/filemanager/browser/default/images/icons/zip.gif b/FCKeditor/editor/filemanager/browser/default/images/icons/zip.gif new file mode 100644 index 0000000..b1e2492 Binary files /dev/null and b/FCKeditor/editor/filemanager/browser/default/images/icons/zip.gif differ diff --git a/FCKeditor/editor/filemanager/browser/default/images/spacer.gif b/FCKeditor/editor/filemanager/browser/default/images/spacer.gif new file mode 100644 index 0000000..35d42e8 Binary files /dev/null and b/FCKeditor/editor/filemanager/browser/default/images/spacer.gif differ diff --git a/FCKeditor/editor/filemanager/browser/default/js/common.js b/FCKeditor/editor/filemanager/browser/default/js/common.js new file mode 100644 index 0000000..ad486e7 --- /dev/null +++ b/FCKeditor/editor/filemanager/browser/default/js/common.js @@ -0,0 +1,55 @@ +/* + * FCKeditor - The text editor for Internet - http://www.fckeditor.net + * Copyright (C) 2003-2007 Frederico Caldeira Knabben + * + * == BEGIN LICENSE == + * + * Licensed under the terms of any of the following licenses at your + * choice: + * + * - GNU General Public License Version 2 or later (the "GPL") + * http://www.gnu.org/licenses/gpl.html + * + * - GNU Lesser General Public License Version 2.1 or later (the "LGPL") + * http://www.gnu.org/licenses/lgpl.html + * + * - Mozilla Public License Version 1.1 or later (the "MPL") + * http://www.mozilla.org/MPL/MPL-1.1.html + * + * == END LICENSE == + * + * Common objects and functions shared by all pages that compose the + * File Browser dialog window. + */ + +function AddSelectOption( selectElement, optionText, optionValue ) +{ + var oOption = document.createElement("OPTION") ; + + oOption.text = optionText ; + oOption.value = optionValue ; + + selectElement.options.add(oOption) ; + + return oOption ; +} + +var oConnector = window.parent.oConnector ; +var oIcons = window.parent.oIcons ; + + +function StringBuilder( value ) +{ + this._Strings = new Array( value || '' ) ; +} + +StringBuilder.prototype.Append = function( value ) +{ + if ( value ) + this._Strings.push( value ) ; +} + +StringBuilder.prototype.ToString = function() +{ + return this._Strings.join( '' ) ; +} \ No newline at end of file diff --git a/FCKeditor/editor/filemanager/browser/default/js/fckxml.js b/FCKeditor/editor/filemanager/browser/default/js/fckxml.js new file mode 100644 index 0000000..9acdc7f --- /dev/null +++ b/FCKeditor/editor/filemanager/browser/default/js/fckxml.js @@ -0,0 +1,129 @@ +/* + * FCKeditor - The text editor for Internet - http://www.fckeditor.net + * Copyright (C) 2003-2007 Frederico Caldeira Knabben + * + * == BEGIN LICENSE == + * + * Licensed under the terms of any of the following licenses at your + * choice: + * + * - GNU General Public License Version 2 or later (the "GPL") + * http://www.gnu.org/licenses/gpl.html + * + * - GNU Lesser General Public License Version 2.1 or later (the "LGPL") + * http://www.gnu.org/licenses/lgpl.html + * + * - Mozilla Public License Version 1.1 or later (the "MPL") + * http://www.mozilla.org/MPL/MPL-1.1.html + * + * == END LICENSE == + * + * Defines the FCKXml object that is used for XML data calls + * and XML processing. + * + * This script is shared by almost all pages that compose the + * File Browser frameset. + */ + +var FCKXml = function() +{} + +FCKXml.prototype.GetHttpRequest = function() +{ + // Gecko / IE7 + if ( typeof(XMLHttpRequest) != 'undefined' ) + return new XMLHttpRequest() ; + + // IE6 + try { return new ActiveXObject( 'Msxml2.XMLHTTP' ) ; } + catch(e) {} + + // IE5 + try { return new ActiveXObject( 'Microsoft.XMLHTTP' ) ; } + catch(e) {} + + return null ; +} + +FCKXml.prototype.LoadUrl = function( urlToCall, asyncFunctionPointer ) +{ + var oFCKXml = this ; + + var bAsync = ( typeof(asyncFunctionPointer) == 'function' ) ; + + var oXmlHttp = this.GetHttpRequest() ; + + oXmlHttp.open( "GET", urlToCall, bAsync ) ; + + if ( bAsync ) + { + oXmlHttp.onreadystatechange = function() + { + if ( oXmlHttp.readyState == 4 ) + { + if ( ( oXmlHttp.status != 200 && oXmlHttp.status != 304 ) || oXmlHttp.responseXML == null || oXmlHttp.responseXML.firstChild == null ) + { + alert( 'The server didn\'t send back a proper XML response. Please contact your system administrator.\n\n' + + 'XML request error: ' + oXmlHttp.statusText + ' (' + oXmlHttp.status + ')\n\n' + + 'Requested URL:\n' + urlToCall + '\n\n' + + 'Response text:\n' + oXmlHttp.responseText ) ; + return ; + } + + oFCKXml.DOMDocument = oXmlHttp.responseXML ; + asyncFunctionPointer( oFCKXml ) ; + } + } + } + + oXmlHttp.send( null ) ; + + if ( ! bAsync ) + { + if ( oXmlHttp.status == 200 || oXmlHttp.status == 304 ) + this.DOMDocument = oXmlHttp.responseXML ; + else + { + alert( 'XML request error: ' + oXmlHttp.statusText + ' (' + oXmlHttp.status + ')' ) ; + } + } +} + +FCKXml.prototype.SelectNodes = function( xpath ) +{ + if ( navigator.userAgent.indexOf('MSIE') >= 0 ) // IE + return this.DOMDocument.selectNodes( xpath ) ; + else // Gecko + { + var aNodeArray = new Array(); + + var xPathResult = this.DOMDocument.evaluate( xpath, this.DOMDocument, + this.DOMDocument.createNSResolver(this.DOMDocument.documentElement), XPathResult.ORDERED_NODE_ITERATOR_TYPE, null) ; + if ( xPathResult ) + { + var oNode = xPathResult.iterateNext() ; + while( oNode ) + { + aNodeArray[aNodeArray.length] = oNode ; + oNode = xPathResult.iterateNext(); + } + } + return aNodeArray ; + } +} + +FCKXml.prototype.SelectSingleNode = function( xpath ) +{ + if ( navigator.userAgent.indexOf('MSIE') >= 0 ) // IE + return this.DOMDocument.selectSingleNode( xpath ) ; + else // Gecko + { + var xPathResult = this.DOMDocument.evaluate( xpath, this.DOMDocument, + this.DOMDocument.createNSResolver(this.DOMDocument.documentElement), 9, null); + + if ( xPathResult && xPathResult.singleNodeValue ) + return xPathResult.singleNodeValue ; + else + return null ; + } +} diff --git a/FCKeditor/editor/filemanager/connectors/asp/basexml.asp b/FCKeditor/editor/filemanager/connectors/asp/basexml.asp new file mode 100644 index 0000000..744eb1e --- /dev/null +++ b/FCKeditor/editor/filemanager/connectors/asp/basexml.asp @@ -0,0 +1,62 @@ +<% + ' FCKeditor - The text editor for Internet - http://www.fckeditor.net + ' Copyright (C) 2003-2007 Frederico Caldeira Knabben + ' + ' == BEGIN LICENSE == + ' + ' Licensed under the terms of any of the following licenses at your + ' choice: + ' + ' - GNU General Public License Version 2 or later (the "GPL") + ' http://www.gnu.org/licenses/gpl.html + ' + ' - GNU Lesser General Public License Version 2.1 or later (the "LGPL") + ' http://www.gnu.org/licenses/lgpl.html + ' + ' - Mozilla Public License Version 1.1 or later (the "MPL") + ' http://www.mozilla.org/MPL/MPL-1.1.html + ' + ' == END LICENSE == + ' + ' This file include the functions that create the base XML output. +%> +<% + +Sub SetXmlHeaders() + ' Cleans the response buffer. + Response.Clear() + + ' Prevent the browser from caching the result. + Response.CacheControl = "no-cache" + + ' Set the response format. + Response.CharSet = "UTF-8" + Response.ContentType = "text/xml" +End Sub + +Sub CreateXmlHeader( command, resourceType, currentFolder, url ) + ' Create the XML document header. + Response.Write "" + + ' Create the main "Connector" node. + Response.Write "" + + ' Add the current folder node. + Response.Write "" +End Sub + +Sub CreateXmlFooter() + Response.Write "" +End Sub + +Sub SendError( number, text ) + SetXmlHeaders + + ' Create the XML document header. + Response.Write "" + + Response.Write "" + + Response.End +End Sub +%> diff --git a/FCKeditor/editor/filemanager/connectors/asp/class_upload.asp b/FCKeditor/editor/filemanager/connectors/asp/class_upload.asp new file mode 100644 index 0000000..6fec59f --- /dev/null +++ b/FCKeditor/editor/filemanager/connectors/asp/class_upload.asp @@ -0,0 +1,353 @@ +<% + ' FCKeditor - The text editor for Internet - http://www.fckeditor.net + ' Copyright (C) 2003-2007 Frederico Caldeira Knabben + ' + ' == BEGIN LICENSE == + ' + ' Licensed under the terms of any of the following licenses at your + ' choice: + ' + ' - GNU General Public License Version 2 or later (the "GPL") + ' http://www.gnu.org/licenses/gpl.html + ' + ' - GNU Lesser General Public License Version 2.1 or later (the "LGPL") + ' http://www.gnu.org/licenses/lgpl.html + ' + ' - Mozilla Public License Version 1.1 or later (the "MPL") + ' http://www.mozilla.org/MPL/MPL-1.1.html + ' + ' == END LICENSE == + ' + ' These are the classes used to handle ASP upload without using third + ' part components (OCX/DLL). +%> +<% +'********************************************** +' File: NetRube_Upload.asp +' Version: NetRube Upload Class Version 2.3 Build 20070528 +' Author: NetRube +' Email: NetRube@126.com +' Date: 05/28/2007 +' Comments: The code for the Upload. +' This can free usage, but please +' not to delete this copyright information. +' If you have a modification version, +' Please send out a duplicate to me. +'********************************************** +' 文件名: NetRube_Upload.asp +' 版本: NetRube Upload Class Version 2.3 Build 20070528 +' 作者: NetRube(网络乡巴佬) +' 电子邮件: NetRube@126.com +' 日期: 2007年05月28日 +' 声明: 文件上传类 +' 本上传类可以自由使用,但请保留此版权声明信息 +' 如果您对本上传类进行修改增强, +' 请发送一份给俺。 +'********************************************** + +Class NetRube_Upload + + Public File, Form + Private oSourceData + Private nMaxSize, nErr, sAllowed, sDenied, sHtmlExtensions + + Private Sub Class_Initialize + nErr = 0 + nMaxSize = 1048576 + + Set File = Server.CreateObject("Scripting.Dictionary") + File.CompareMode = 1 + Set Form = Server.CreateObject("Scripting.Dictionary") + Form.CompareMode = 1 + + Set oSourceData = Server.CreateObject("ADODB.Stream") + oSourceData.Type = 1 + oSourceData.Mode = 3 + oSourceData.Open + End Sub + + Private Sub Class_Terminate + Form.RemoveAll + Set Form = Nothing + File.RemoveAll + Set File = Nothing + + oSourceData.Close + Set oSourceData = Nothing + End Sub + + Public Property Get Version + Version = "NetRube Upload Class Version 2.3 Build 20070528" + End Property + + Public Property Get ErrNum + ErrNum = nErr + End Property + + Public Property Let MaxSize(nSize) + nMaxSize = nSize + End Property + + Public Property Let Allowed(sExt) + sAllowed = sExt + End Property + + Public Property Let Denied(sExt) + sDenied = sExt + End Property + + Public Property Let HtmlExtensions(sExt) + sHtmlExtensions = sExt + End Property + + Public Sub GetData + Dim aCType + aCType = Split(Request.ServerVariables("HTTP_CONTENT_TYPE"), ";") + if ( uBound(aCType) < 0 ) then + nErr = 1 + Exit Sub + end if + If aCType(0) <> "multipart/form-data" Then + nErr = 1 + Exit Sub + End If + + Dim nTotalSize + nTotalSize = Request.TotalBytes + If nTotalSize < 1 Then + nErr = 2 + Exit Sub + End If + If nMaxSize > 0 And nTotalSize > nMaxSize Then + nErr = 3 + Exit Sub + End If + + 'Thankful long(yrl031715@163.com) + 'Fix upload large file. + '********************************************** + ' 修正作者:long + ' 联系邮件: yrl031715@163.com + ' 修正时间:2007年5月6日 + ' 修正说明:由于iis6的Content-Length 头信息中包含的请求长度超过了 AspMaxRequestEntityAllowed 的值(默认200K), IIS 将返回一个 403 错误信息. + ' 直接导致在iis6下调试FCKeditor上传功能时,一旦文件超过200K,上传文件时文件管理器失去响应,受此影响,文件的快速上传功能也存在在缺陷。 + ' 在参考 宝玉 的 Asp无组件上传带进度条 演示程序后作出如下修改,以修正在iis6下的错误。 + + Dim nTotalBytes, nPartBytes, ReadBytes + ReadBytes = 0 + nTotalBytes = Request.TotalBytes + '循环分块读取 + Do While ReadBytes < nTotalBytes + '分块读取 + nPartBytes = 64 * 1024 '分成每块64k + If nPartBytes + ReadBytes > nTotalBytes Then + nPartBytes = nTotalBytes - ReadBytes + End If + oSourceData.Write Request.BinaryRead(nPartBytes) + ReadBytes = ReadBytes + nPartBytes + Loop + '********************************************** + oSourceData.Position = 0 + + Dim oTotalData, oFormStream, sFormHeader, sFormName, bCrLf, nBoundLen, nFormStart, nFormEnd, nPosStart, nPosEnd, sBoundary + + oTotalData = oSourceData.Read + bCrLf = ChrB(13) & ChrB(10) + sBoundary = MidB(oTotalData, 1, InStrB(1, oTotalData, bCrLf) - 1) + nBoundLen = LenB(sBoundary) + 2 + nFormStart = nBoundLen + + Set oFormStream = Server.CreateObject("ADODB.Stream") + + Do While (nFormStart + 2) < nTotalSize + nFormEnd = InStrB(nFormStart, oTotalData, bCrLf & bCrLf) + 3 + + With oFormStream + .Type = 1 + .Mode = 3 + .Open + oSourceData.Position = nFormStart + oSourceData.CopyTo oFormStream, nFormEnd - nFormStart + .Position = 0 + .Type = 2 + .CharSet = "UTF-8" + sFormHeader = .ReadText + .Close + End With + + nFormStart = InStrB(nFormEnd, oTotalData, sBoundary) - 1 + nPosStart = InStr(22, sFormHeader, " name=", 1) + 7 + nPosEnd = InStr(nPosStart, sFormHeader, """") + sFormName = Mid(sFormHeader, nPosStart, nPosEnd - nPosStart) + + If InStr(45, sFormHeader, " filename=", 1) > 0 Then + Set File(sFormName) = New NetRube_FileInfo + File(sFormName).FormName = sFormName + File(sFormName).Start = nFormEnd + File(sFormName).Size = nFormStart - nFormEnd - 2 + nPosStart = InStr(nPosEnd, sFormHeader, " filename=", 1) + 11 + nPosEnd = InStr(nPosStart, sFormHeader, """") + File(sFormName).ClientPath = Mid(sFormHeader, nPosStart, nPosEnd - nPosStart) + File(sFormName).Name = Mid(File(sFormName).ClientPath, InStrRev(File(sFormName).ClientPath, "\") + 1) + File(sFormName).Ext = LCase(Mid(File(sFormName).Name, InStrRev(File(sFormName).Name, ".") + 1)) + nPosStart = InStr(nPosEnd, sFormHeader, "Content-Type: ", 1) + 14 + nPosEnd = InStr(nPosStart, sFormHeader, vbCr) + File(sFormName).MIME = Mid(sFormHeader, nPosStart, nPosEnd - nPosStart) + Else + With oFormStream + .Type = 1 + .Mode = 3 + .Open + oSourceData.Position = nFormEnd + oSourceData.CopyTo oFormStream, nFormStart - nFormEnd - 2 + .Position = 0 + .Type = 2 + .CharSet = "UTF-8" + Form(sFormName) = .ReadText + .Close + End With + End If + + nFormStart = nFormStart + nBoundLen + Loop + + oTotalData = "" + Set oFormStream = Nothing + End Sub + + Public Sub SaveAs(sItem, sFileName) + If File(sItem).Size < 1 Then + nErr = 2 + Exit Sub + End If + + If Not IsAllowed(File(sItem).Ext) Then + nErr = 4 + Exit Sub + End If + + If InStr( LCase( sFileName ), "::$data" ) > 0 Then + nErr = 4 + Exit Sub + End If + + Dim sFileExt, iFileSize + sFileExt = File(sItem).Ext + iFileSize = File(sItem).Size + + ' Check XSS. + If Not IsHtmlExtension( sFileExt ) Then + ' Calculate the size of data to load (max 1Kb). + Dim iXSSSize + iXSSSize = iFileSize + + If iXSSSize > 1024 Then + iXSSSize = 1024 + End If + + ' Read the data. + Dim sData + oSourceData.Position = File(sItem).Start + sData = oSourceData.Read( iXSSSize ) ' Byte Array + sData = ByteArray2Text( sData ) ' String + + ' Sniff HTML data. + If SniffHtml( sData ) Then + nErr = 4 + Exit Sub + End If + End If + + Dim oFileStream + Set oFileStream = Server.CreateObject("ADODB.Stream") + With oFileStream + .Type = 1 + .Mode = 3 + .Open + oSourceData.Position = File(sItem).Start + oSourceData.CopyTo oFileStream, File(sItem).Size + .Position = 0 + .SaveToFile sFileName, 2 + .Close + End With + Set oFileStream = Nothing + End Sub + + Private Function IsAllowed(sExt) + Dim oRE + Set oRE = New RegExp + oRE.IgnoreCase = True + oRE.Global = True + + If sDenied = "" Then + oRE.Pattern = sAllowed + IsAllowed = (sAllowed = "") Or oRE.Test(sExt) + Else + oRE.Pattern = sDenied + IsAllowed = Not oRE.Test(sExt) + End If + + Set oRE = Nothing + End Function + + Private Function IsHtmlExtension( sExt ) + If sHtmlExtensions = "" Then + Exit Function + End If + + Dim oRE + Set oRE = New RegExp + oRE.IgnoreCase = True + oRE.Global = True + oRE.Pattern = sHtmlExtensions + + IsHtmlExtension = oRE.Test(sExt) + + Set oRE = Nothing + End Function + + Private Function SniffHtml( sData ) + + Dim oRE + Set oRE = New RegExp + oRE.IgnoreCase = True + oRE.Global = True + + Dim aPatterns + aPatterns = Array( " \ No newline at end of file diff --git a/FCKeditor/editor/filemanager/connectors/asp/commands.asp b/FCKeditor/editor/filemanager/connectors/asp/commands.asp new file mode 100644 index 0000000..82b047c --- /dev/null +++ b/FCKeditor/editor/filemanager/connectors/asp/commands.asp @@ -0,0 +1,198 @@ +<% + ' FCKeditor - The text editor for Internet - http://www.fckeditor.net + ' Copyright (C) 2003-2007 Frederico Caldeira Knabben + ' + ' == BEGIN LICENSE == + ' + ' Licensed under the terms of any of the following licenses at your + ' choice: + ' + ' - GNU General Public License Version 2 or later (the "GPL") + ' http://www.gnu.org/licenses/gpl.html + ' + ' - GNU Lesser General Public License Version 2.1 or later (the "LGPL") + ' http://www.gnu.org/licenses/lgpl.html + ' + ' - Mozilla Public License Version 1.1 or later (the "MPL") + ' http://www.mozilla.org/MPL/MPL-1.1.html + ' + ' == END LICENSE == + ' + ' This file include the functions that handle the Command requests + ' in the ASP Connector. +%> +<% +Sub GetFolders( resourceType, currentFolder ) + ' Map the virtual path to the local server path. + Dim sServerDir + sServerDir = ServerMapFolder( resourceType, currentFolder, "GetFolders" ) + + ' Open the "Folders" node. + Response.Write "" + + Dim oFSO, oCurrentFolder, oFolders, oFolder + Set oFSO = Server.CreateObject( "Scripting.FileSystemObject" ) + if not (oFSO.FolderExists( sServerDir ) ) then + Set oFSO = Nothing + SendError 102, currentFolder + end if + + Set oCurrentFolder = oFSO.GetFolder( sServerDir ) + Set oFolders = oCurrentFolder.SubFolders + + For Each oFolder in oFolders + Response.Write "" + Next + + Set oFSO = Nothing + + ' Close the "Folders" node. + Response.Write "" +End Sub + +Sub GetFoldersAndFiles( resourceType, currentFolder ) + ' Map the virtual path to the local server path. + Dim sServerDir + sServerDir = ServerMapFolder( resourceType, currentFolder, "GetFoldersAndFiles" ) + + Dim oFSO, oCurrentFolder, oFolders, oFolder, oFiles, oFile + Set oFSO = Server.CreateObject( "Scripting.FileSystemObject" ) + if not (oFSO.FolderExists( sServerDir ) ) then + Set oFSO = Nothing + SendError 102, currentFolder + end if + + Set oCurrentFolder = oFSO.GetFolder( sServerDir ) + Set oFolders = oCurrentFolder.SubFolders + Set oFiles = oCurrentFolder.Files + + ' Open the "Folders" node. + Response.Write "" + + For Each oFolder in oFolders + Response.Write "" + Next + + ' Close the "Folders" node. + Response.Write "" + + ' Open the "Files" node. + Response.Write "" + + For Each oFile in oFiles + Dim iFileSize + iFileSize = Round( oFile.size / 1024 ) + If ( iFileSize < 1 AND oFile.size <> 0 ) Then iFileSize = 1 + + Response.Write "" + Next + + ' Close the "Files" node. + Response.Write "" +End Sub + +Sub CreateFolder( resourceType, currentFolder ) + Dim sErrorNumber + + Dim sNewFolderName + sNewFolderName = Request.QueryString( "NewFolderName" ) + sNewFolderName = SanitizeFolderName( sNewFolderName ) + + If ( sNewFolderName = "" OR InStr( 1, sNewFolderName, ".." ) > 0 ) Then + sErrorNumber = "102" + Else + ' Map the virtual path to the local server path of the current folder. + Dim sServerDir + sServerDir = ServerMapFolder( resourceType, CombinePaths(currentFolder, sNewFolderName), "CreateFolder" ) + + On Error Resume Next + + CreateServerFolder sServerDir + + Dim iErrNumber, sErrDescription + iErrNumber = err.number + sErrDescription = err.Description + + On Error Goto 0 + + Select Case iErrNumber + Case 0 + sErrorNumber = "0" + Case 52 + sErrorNumber = "102" ' Invalid Folder Name. + Case 70 + sErrorNumber = "103" ' Security Error. + Case 76 + sErrorNumber = "102" ' Path too long. + Case Else + sErrorNumber = "110" + End Select + End If + + ' Create the "Error" node. + Response.Write "" +End Sub + +Sub FileUpload( resourceType, currentFolder, sCommand ) + Dim oUploader + Set oUploader = New NetRube_Upload + oUploader.MaxSize = 0 + oUploader.Allowed = ConfigAllowedExtensions.Item( resourceType ) + oUploader.Denied = ConfigDeniedExtensions.Item( resourceType ) + oUploader.HtmlExtensions = ConfigHtmlExtensions + oUploader.GetData + + Dim sErrorNumber + sErrorNumber = "0" + + Dim sFileName, sOriginalFileName, sExtension + sFileName = "" + + If oUploader.ErrNum > 0 Then + sErrorNumber = "202" + Else + ' Map the virtual path to the local server path. + Dim sServerDir + sServerDir = ServerMapFolder( resourceType, currentFolder, sCommand ) + + Dim oFSO + Set oFSO = Server.CreateObject( "Scripting.FileSystemObject" ) + if not (oFSO.FolderExists( sServerDir ) ) then + sErrorNumber = "102" + else + ' Get the uploaded file name. + sFileName = oUploader.File( "NewFile" ).Name + sExtension = oUploader.File( "NewFile" ).Ext + sFileName = SanitizeFileName( sFileName ) + sOriginalFileName = sFileName + + Dim iCounter + iCounter = 0 + + Do While ( True ) + Dim sFilePath + sFilePath = sServerDir & sFileName + + If ( oFSO.FileExists( sFilePath ) ) Then + iCounter = iCounter + 1 + sFileName = RemoveExtension( sOriginalFileName ) & "(" & iCounter & ")." & sExtension + sErrorNumber = "201" + Else + oUploader.SaveAs "NewFile", sFilePath + If oUploader.ErrNum > 0 Then sErrorNumber = "202" + Exit Do + End If + Loop + end if + End If + + Set oUploader = Nothing + + dim sFileUrl + sFileUrl = CombinePaths( GetResourceTypePath( resourceType, sCommand ) , currentFolder ) + sFileUrl = CombinePaths( sFileUrl, sFileName ) + + SendUploadResults sErrorNumber, sFileUrl, sFileName, "" +End Sub + +%> diff --git a/FCKeditor/editor/filemanager/connectors/asp/config.asp b/FCKeditor/editor/filemanager/connectors/asp/config.asp new file mode 100644 index 0000000..e9a0dcc --- /dev/null +++ b/FCKeditor/editor/filemanager/connectors/asp/config.asp @@ -0,0 +1,128 @@ +<% + ' FCKeditor - The text editor for Internet - http://www.fckeditor.net + ' Copyright (C) 2003-2007 Frederico Caldeira Knabben + ' + ' == BEGIN LICENSE == + ' + ' Licensed under the terms of any of the following licenses at your + ' choice: + ' + ' - GNU General Public License Version 2 or later (the "GPL") + ' http://www.gnu.org/licenses/gpl.html + ' + ' - GNU Lesser General Public License Version 2.1 or later (the "LGPL") + ' http://www.gnu.org/licenses/lgpl.html + ' + ' - Mozilla Public License Version 1.1 or later (the "MPL") + ' http://www.mozilla.org/MPL/MPL-1.1.html + ' + ' == END LICENSE == + ' + ' Configuration file for the File Manager Connector for ASP. +%> +<% + +' SECURITY: You must explicitly enable this "connector" (set it to "True"). +' WARNING: don't just set "ConfigIsEnabled = true", you must be sure that only +' authenticated users can access this file or use some kind of session checking. +Dim ConfigIsEnabled +ConfigIsEnabled = False + +' Path to user files relative to the document root. +' This setting is preserved only for backward compatibility. +' You should look at the settings for each resource type to get the full potential +Dim ConfigUserFilesPath +ConfigUserFilesPath = "/userfiles/" + +' Due to security issues with Apache modules, it is recommended to leave the +' following setting enabled. +Dim ConfigForceSingleExtension +ConfigForceSingleExtension = true + +' What the user can do with this connector +Dim ConfigAllowedCommands +ConfigAllowedCommands = "QuickUpload|FileUpload|GetFolders|GetFoldersAndFiles|CreateFolder" + +' Allowed Resource Types +Dim ConfigAllowedTypes +ConfigAllowedTypes = "File|Image|Flash|Media" + +' For security, HTML is allowed in the first Kb of data for files having the +' following extensions only. +Dim ConfigHtmlExtensions +ConfigHtmlExtensions = "html|htm|xml|xsd|txt|js" +' +' Configuration settings for each Resource Type +' +' - AllowedExtensions: the possible extensions that can be allowed. +' If it is empty then any file type can be uploaded. +' +' - DeniedExtensions: The extensions that won't be allowed. +' If it is empty then no restrictions are done here. +' +' For a file to be uploaded it has to fulfill both the AllowedExtensions +' and DeniedExtensions (that's it: not being denied) conditions. +' +' - FileTypesPath: the virtual folder relative to the document root where +' these resources will be located. +' Attention: It must start and end with a slash: '/' +' +' - FileTypesAbsolutePath: the physical path to the above folder. It must be +' an absolute path. +' If it's an empty string then it will be autocalculated. +' Useful if you are using a virtual directory, symbolic link or alias. +' Examples: 'C:\\MySite\\userfiles\\' or '/root/mysite/userfiles/'. +' Attention: The above 'FileTypesPath' must point to the same directory. +' Attention: It must end with a slash: '/' +' +' - QuickUploadPath: the virtual folder relative to the document root where +' these resources will be uploaded using the Upload tab in the resources +' dialogs. +' Attention: It must start and end with a slash: '/' +' +' - QuickUploadAbsolutePath: the physical path to the above folder. It must be +' an absolute path. +' If it's an empty string then it will be autocalculated. +' Useful if you are using a virtual directory, symbolic link or alias. +' Examples: 'C:\\MySite\\userfiles\\' or '/root/mysite/userfiles/'. +' Attention: The above 'QuickUploadPath' must point to the same directory. +' Attention: It must end with a slash: '/' +' + +Dim ConfigAllowedExtensions, ConfigDeniedExtensions, ConfigFileTypesPath, ConfigFileTypesAbsolutePath, ConfigQuickUploadPath, ConfigQuickUploadAbsolutePath +Set ConfigAllowedExtensions = CreateObject( "Scripting.Dictionary" ) +Set ConfigDeniedExtensions = CreateObject( "Scripting.Dictionary" ) +Set ConfigFileTypesPath = CreateObject( "Scripting.Dictionary" ) +Set ConfigFileTypesAbsolutePath = CreateObject( "Scripting.Dictionary" ) +Set ConfigQuickUploadPath = CreateObject( "Scripting.Dictionary" ) +Set ConfigQuickUploadAbsolutePath = CreateObject( "Scripting.Dictionary" ) + +ConfigAllowedExtensions.Add "File", "7z|aiff|asf|avi|bmp|csv|doc|fla|flv|gif|gz|gzip|jpeg|jpg|mid|mov|mp3|mp4|mpc|mpeg|mpg|ods|odt|pdf|png|ppt|pxd|qt|ram|rar|rm|rmi|rmvb|rtf|sdc|sitd|swf|sxc|sxw|tar|tgz|tif|tiff|txt|vsd|wav|wma|wmv|xls|xml|zip" +ConfigDeniedExtensions.Add "File", "" +ConfigFileTypesPath.Add "File", ConfigUserFilesPath & "file/" +ConfigFileTypesAbsolutePath.Add "File", "" +ConfigQuickUploadPath.Add "File", ConfigUserFilesPath +ConfigQuickUploadAbsolutePath.Add "File", "" + +ConfigAllowedExtensions.Add "Image", "bmp|gif|jpeg|jpg|png" +ConfigDeniedExtensions.Add "Image", "" +ConfigFileTypesPath.Add "Image", ConfigUserFilesPath & "image/" +ConfigFileTypesAbsolutePath.Add "Image", "" +ConfigQuickUploadPath.Add "Image", ConfigUserFilesPath +ConfigQuickUploadAbsolutePath.Add "Image", "" + +ConfigAllowedExtensions.Add "Flash", "swf|flv" +ConfigDeniedExtensions.Add "Flash", "" +ConfigFileTypesPath.Add "Flash", ConfigUserFilesPath & "flash/" +ConfigFileTypesAbsolutePath.Add "Flash", "" +ConfigQuickUploadPath.Add "Flash", ConfigUserFilesPath +ConfigQuickUploadAbsolutePath.Add "Flash", "" + +ConfigAllowedExtensions.Add "Media", "aiff|asf|avi|bmp|fla|flv|gif|jpeg|jpg|mid|mov|mp3|mp4|mpc|mpeg|mpg|png|qt|ram|rm|rmi|rmvb|swf|tif|tiff|wav|wma|wmv" +ConfigDeniedExtensions.Add "Media", "" +ConfigFileTypesPath.Add "Media", ConfigUserFilesPath & "media/" +ConfigFileTypesAbsolutePath.Add "Media", "" +ConfigQuickUploadPath.Add "Media", ConfigUserFilesPath +ConfigQuickUploadAbsolutePath.Add "Media", "" + +%> diff --git a/FCKeditor/editor/filemanager/connectors/asp/connector.asp b/FCKeditor/editor/filemanager/connectors/asp/connector.asp new file mode 100644 index 0000000..bd950e2 --- /dev/null +++ b/FCKeditor/editor/filemanager/connectors/asp/connector.asp @@ -0,0 +1,88 @@ +<%@ CodePage=65001 Language="VBScript"%> +<% +Option Explicit +Response.Buffer = True +%> +<% + ' FCKeditor - The text editor for Internet - http://www.fckeditor.net + ' Copyright (C) 2003-2007 Frederico Caldeira Knabben + ' + ' == BEGIN LICENSE == + ' + ' Licensed under the terms of any of the following licenses at your + ' choice: + ' + ' - GNU General Public License Version 2 or later (the "GPL") + ' http://www.gnu.org/licenses/gpl.html + ' + ' - GNU Lesser General Public License Version 2.1 or later (the "LGPL") + ' http://www.gnu.org/licenses/lgpl.html + ' + ' - Mozilla Public License Version 1.1 or later (the "MPL") + ' http://www.mozilla.org/MPL/MPL-1.1.html + ' + ' == END LICENSE == + ' + ' This is the File Manager Connector for ASP. +%> + + + + + + +<% + +If ( ConfigIsEnabled = False ) Then + SendError 1, "This connector is disabled. Please check the ""editor/filemanager/connectors/asp/config.asp"" file" +End If + +DoResponse + +Sub DoResponse() + Dim sCommand, sResourceType, sCurrentFolder + + ' Get the main request information. + sCommand = Request.QueryString("Command") + + sResourceType = Request.QueryString("Type") + If ( sResourceType = "" ) Then sResourceType = "File" + + sCurrentFolder = GetCurrentFolder() + + ' Check if it is an allowed command + if ( Not IsAllowedCommand( sCommand ) ) then + SendError 1, "The """ & sCommand & """ command isn't allowed" + end if + + ' Check if it is an allowed resource type. + if ( Not IsAllowedType( sResourceType ) ) Then + SendError 1, "The """ & sResourceType & """ resource type isn't allowed" + end if + + ' File Upload doesn't have to Return XML, so it must be intercepted before anything. + If ( sCommand = "FileUpload" ) Then + FileUpload sResourceType, sCurrentFolder, sCommand + Exit Sub + End If + + SetXmlHeaders + + CreateXmlHeader sCommand, sResourceType, sCurrentFolder, GetUrlFromPath( sResourceType, sCurrentFolder, sCommand) + + ' Execute the required command. + Select Case sCommand + Case "GetFolders" + GetFolders sResourceType, sCurrentFolder + Case "GetFoldersAndFiles" + GetFoldersAndFiles sResourceType, sCurrentFolder + Case "CreateFolder" + CreateFolder sResourceType, sCurrentFolder + End Select + + CreateXmlFooter + + Response.End +End Sub + +%> \ No newline at end of file diff --git a/FCKeditor/editor/filemanager/connectors/asp/io.asp b/FCKeditor/editor/filemanager/connectors/asp/io.asp new file mode 100644 index 0000000..8a8cc7e --- /dev/null +++ b/FCKeditor/editor/filemanager/connectors/asp/io.asp @@ -0,0 +1,222 @@ +<% + ' FCKeditor - The text editor for Internet - http://www.fckeditor.net + ' Copyright (C) 2003-2007 Frederico Caldeira Knabben + ' + ' == BEGIN LICENSE == + ' + ' Licensed under the terms of any of the following licenses at your + ' choice: + ' + ' - GNU General Public License Version 2 or later (the "GPL") + ' http://www.gnu.org/licenses/gpl.html + ' + ' - GNU Lesser General Public License Version 2.1 or later (the "LGPL") + ' http://www.gnu.org/licenses/lgpl.html + ' + ' - Mozilla Public License Version 1.1 or later (the "MPL") + ' http://www.mozilla.org/MPL/MPL-1.1.html + ' + ' == END LICENSE == + ' + ' This file include IO specific functions used by the ASP Connector. +%> +<% +function CombinePaths( sBasePath, sFolder) + CombinePaths = RemoveFromEnd( sBasePath, "/" ) & "/" & RemoveFromStart( sFolder, "/" ) +end function + +Function GetResourceTypePath( resourceType, sCommand ) + if ( sCommand = "QuickUpload") then + GetResourceTypePath = ConfigQuickUploadPath.Item( resourceType ) + else + GetResourceTypePath = ConfigFileTypesPath.Item( resourceType ) + end if +end Function + +Function GetResourceTypeDirectory( resourceType, sCommand ) + if ( sCommand = "QuickUpload") then + + if ( ConfigQuickUploadAbsolutePath.Item( resourceType ) <> "" ) then + GetResourceTypeDirectory = ConfigQuickUploadAbsolutePath.Item( resourceType ) + else + ' Map the "UserFiles" path to a local directory. + GetResourceTypeDirectory = Server.MapPath( ConfigQuickUploadPath.Item( resourceType ) ) + end if + else + if ( ConfigFileTypesAbsolutePath.Item( resourceType ) <> "" ) then + GetResourceTypeDirectory = ConfigFileTypesAbsolutePath.Item( resourceType ) + else + ' Map the "UserFiles" path to a local directory. + GetResourceTypeDirectory = Server.MapPath( ConfigFileTypesPath.Item( resourceType ) ) + end if + end if +end Function + +Function GetUrlFromPath( resourceType, folderPath, sCommand ) + GetUrlFromPath = CombinePaths( GetResourceTypePath( resourceType, sCommand ), folderPath ) +End Function + +Function RemoveExtension( fileName ) + RemoveExtension = Left( fileName, InStrRev( fileName, "." ) - 1 ) +End Function + +Function ServerMapFolder( resourceType, folderPath, sCommand ) + Dim sResourceTypePath + ' Get the resource type directory. + sResourceTypePath = GetResourceTypeDirectory( resourceType, sCommand ) + + ' Ensure that the directory exists. + CreateServerFolder sResourceTypePath + + ' Return the resource type directory combined with the required path. + ServerMapFolder = CombinePaths( sResourceTypePath, folderPath ) +End Function + +Sub CreateServerFolder( folderPath ) + Dim oFSO + Set oFSO = Server.CreateObject( "Scripting.FileSystemObject" ) + + Dim sParent + sParent = oFSO.GetParentFolderName( folderPath ) + + ' Check if the parent exists, or create it. + If ( NOT oFSO.FolderExists( sParent ) ) Then CreateServerFolder( sParent ) + + If ( oFSO.FolderExists( folderPath ) = False ) Then + On Error resume next + oFSO.CreateFolder( folderPath ) + + if err.number<>0 then + dim sErrorNumber + Dim iErrNumber, sErrDescription + iErrNumber = err.number + sErrDescription = err.Description + + On Error Goto 0 + + Select Case iErrNumber + Case 52 + sErrorNumber = "102" ' Invalid Folder Name. + Case 70 + sErrorNumber = "103" ' Security Error. + Case 76 + sErrorNumber = "102" ' Path too long. + Case Else + sErrorNumber = "110" + End Select + + SendError sErrorNumber, "CreateServerFolder(" & folderPath & ") : " & sErrDescription + end if + + End If + + Set oFSO = Nothing +End Sub + +Function IsAllowedExt( extension, resourceType ) + Dim oRE + Set oRE = New RegExp + oRE.IgnoreCase = True + oRE.Global = True + + Dim sAllowed, sDenied + sAllowed = ConfigAllowedExtensions.Item( resourceType ) + sDenied = ConfigDeniedExtensions.Item( resourceType ) + + IsAllowedExt = True + + If sDenied <> "" Then + oRE.Pattern = sDenied + IsAllowedExt = Not oRE.Test( extension ) + End If + + If IsAllowedExt And sAllowed <> "" Then + oRE.Pattern = sAllowed + IsAllowedExt = oRE.Test( extension ) + End If + + Set oRE = Nothing +End Function + +Function IsAllowedType( resourceType ) + Dim oRE + Set oRE = New RegExp + oRE.IgnoreCase = True + oRE.Global = True + oRE.Pattern = "^(" & ConfigAllowedTypes & ")$" + + IsAllowedType = oRE.Test( resourceType ) + + Set oRE = Nothing +End Function + +Function IsAllowedCommand( sCommand ) + Dim oRE + Set oRE = New RegExp + oRE.IgnoreCase = True + oRE.Global = True + oRE.Pattern = "^(" & ConfigAllowedCommands & ")$" + + IsAllowedCommand = oRE.Test( sCommand ) + + Set oRE = Nothing +End Function + +function GetCurrentFolder() + dim sCurrentFolder + sCurrentFolder = Request.QueryString("CurrentFolder") + If ( sCurrentFolder = "" ) Then sCurrentFolder = "/" + + ' Check the current folder syntax (must begin and start with a slash). + If ( Right( sCurrentFolder, 1 ) <> "/" ) Then sCurrentFolder = sCurrentFolder & "/" + If ( Left( sCurrentFolder, 1 ) <> "/" ) Then sCurrentFolder = "/" & sCurrentFolder + + ' Check for invalid folder paths (..) + If ( InStr( 1, sCurrentFolder, ".." ) <> 0 ) Then + SendError 102, "" + End If + + GetCurrentFolder = sCurrentFolder +end function + +' Do a cleanup of the folder name to avoid possible problems +function SanitizeFolderName( sNewFolderName ) + Dim oRegex + Set oRegex = New RegExp + oRegex.Global = True + +' remove . \ / | : ? * " < > + oRegex.Pattern = "(\.|\\|\/|\||:|\?|\*|""|\<|\>)" + SanitizeFolderName = oRegex.Replace( sNewFolderName, "_" ) + + Set oRegex = Nothing +end function + +' Do a cleanup of the file name to avoid possible problems +function SanitizeFileName( sNewFileName ) + Dim oRegex + Set oRegex = New RegExp + oRegex.Global = True + + if ( ConfigForceSingleExtension = True ) then + oRegex.Pattern = "\.(?![^.]*$)" + sNewFileName = oRegex.Replace( sNewFileName, "_" ) + end if + +' remove \ / | : ? * " < > + oRegex.Pattern = "(\\|\/|\||:|\?|\*|""|\<|\>)" + SanitizeFileName = oRegex.Replace( sNewFileName, "_" ) + + Set oRegex = Nothing +end function + +' This is the function that sends the results of the uploading process. +Sub SendUploadResults( errorNumber, fileUrl, fileName, customMsg ) + Response.Clear + Response.Write "" + Response.End +End Sub + +%> diff --git a/FCKeditor/editor/filemanager/connectors/asp/upload.asp b/FCKeditor/editor/filemanager/connectors/asp/upload.asp new file mode 100644 index 0000000..b50e492 --- /dev/null +++ b/FCKeditor/editor/filemanager/connectors/asp/upload.asp @@ -0,0 +1,61 @@ +<%@ CodePage=65001 Language="VBScript"%> +<% +Option Explicit +Response.Buffer = True +%> +<% + ' FCKeditor - The text editor for Internet - http://www.fckeditor.net + ' Copyright (C) 2003-2007 Frederico Caldeira Knabben + ' + ' == BEGIN LICENSE == + ' + ' Licensed under the terms of any of the following licenses at your + ' choice: + ' + ' - GNU General Public License Version 2 or later (the "GPL") + ' http://www.gnu.org/licenses/gpl.html + ' + ' - GNU Lesser General Public License Version 2.1 or later (the "LGPL") + ' http://www.gnu.org/licenses/lgpl.html + ' + ' - Mozilla Public License Version 1.1 or later (the "MPL") + ' http://www.mozilla.org/MPL/MPL-1.1.html + ' + ' == END LICENSE == + ' + ' This is the "File Uploader" for ASP. +%> + + + + + +<% + +' Check if this uploader has been enabled. +If ( ConfigIsEnabled = False ) Then + SendUploadResults "1", "", "", "This file uploader is disabled. Please check the ""editor/filemanager/connectors/asp/config.asp"" file" +End If + + Dim sCommand, sResourceType, sCurrentFolder + + sCommand = "QuickUpload" + + sResourceType = Request.QueryString("Type") + If ( sResourceType = "" ) Then sResourceType = "File" + + sCurrentFolder = GetCurrentFolder() + + ' Is Upload enabled? + if ( Not IsAllowedCommand( sCommand ) ) then + SendUploadResults "1", "", "", "The """ & sCommand & """ command isn't allowed" + end if + + ' Check if it is an allowed resource type. + if ( Not IsAllowedType( sResourceType ) ) Then + SendUploadResults "1", "", "", "The " & sResourceType & " resource type isn't allowed" + end if + + FileUpload sResourceType, sCurrentFolder, sCommand + +%> diff --git a/FCKeditor/editor/filemanager/connectors/asp/util.asp b/FCKeditor/editor/filemanager/connectors/asp/util.asp new file mode 100644 index 0000000..86f7229 --- /dev/null +++ b/FCKeditor/editor/filemanager/connectors/asp/util.asp @@ -0,0 +1,55 @@ +<% + ' FCKeditor - The text editor for Internet - http://www.fckeditor.net + ' Copyright (C) 2003-2007 Frederico Caldeira Knabben + ' + ' == BEGIN LICENSE == + ' + ' Licensed under the terms of any of the following licenses at your + ' choice: + ' + ' - GNU General Public License Version 2 or later (the "GPL") + ' http://www.gnu.org/licenses/gpl.html + ' + ' - GNU Lesser General Public License Version 2.1 or later (the "LGPL") + ' http://www.gnu.org/licenses/lgpl.html + ' + ' - Mozilla Public License Version 1.1 or later (the "MPL") + ' http://www.mozilla.org/MPL/MPL-1.1.html + ' + ' == END LICENSE == + ' + ' This file include generic functions used by the ASP Connector. +%> +<% +Function RemoveFromStart( sourceString, charToRemove ) + Dim oRegex + Set oRegex = New RegExp + oRegex.Pattern = "^" & charToRemove & "+" + + RemoveFromStart = oRegex.Replace( sourceString, "" ) +End Function + +Function RemoveFromEnd( sourceString, charToRemove ) + Dim oRegex + Set oRegex = New RegExp + oRegex.Pattern = charToRemove & "+$" + + RemoveFromEnd = oRegex.Replace( sourceString, "" ) +End Function + +Function ConvertToXmlAttribute( value ) + ConvertToXmlAttribute = Replace( value, "&", "&" ) +End Function + +Function InArray( value, sourceArray ) + Dim i + For i = 0 to UBound( sourceArray ) + If sourceArray(i) = value Then + InArray = True + Exit Function + End If + Next + InArray = False +End Function + +%> diff --git a/FCKeditor/editor/filemanager/connectors/aspx/config.ascx b/FCKeditor/editor/filemanager/connectors/aspx/config.ascx new file mode 100644 index 0000000..8392782 --- /dev/null +++ b/FCKeditor/editor/filemanager/connectors/aspx/config.ascx @@ -0,0 +1,98 @@ +<%@ Control Language="C#" EnableViewState="false" AutoEventWireup="false" Inherits="FredCK.FCKeditorV2.FileBrowser.Config" %> +<%-- + * FCKeditor - The text editor for Internet - http://www.fckeditor.net + * Copyright (C) 2003-2007 Frederico Caldeira Knabben + * + * == BEGIN LICENSE == + * + * Licensed under the terms of any of the following licenses at your + * choice: + * + * - GNU General Public License Version 2 or later (the "GPL") + * http://www.gnu.org/licenses/gpl.html + * + * - GNU Lesser General Public License Version 2.1 or later (the "LGPL") + * http://www.gnu.org/licenses/lgpl.html + * + * - Mozilla Public License Version 1.1 or later (the "MPL") + * http://www.mozilla.org/MPL/MPL-1.1.html + * + * == END LICENSE == + * + * Configuration file for the File Browser Connector for ASP.NET. +--%> + diff --git a/FCKeditor/editor/filemanager/connectors/aspx/connector.aspx b/FCKeditor/editor/filemanager/connectors/aspx/connector.aspx new file mode 100644 index 0000000..1ea406a --- /dev/null +++ b/FCKeditor/editor/filemanager/connectors/aspx/connector.aspx @@ -0,0 +1,32 @@ +<%@ Page Language="c#" Trace="false" Inherits="FredCK.FCKeditorV2.FileBrowser.Connector" AutoEventWireup="false" %> +<%@ Register Src="config.ascx" TagName="Config" TagPrefix="FCKeditor" %> +<%-- + * FCKeditor - The text editor for Internet - http://www.fckeditor.net + * Copyright (C) 2003-2007 Frederico Caldeira Knabben + * + * == BEGIN LICENSE == + * + * Licensed under the terms of any of the following licenses at your + * choice: + * + * - GNU General Public License Version 2 or later (the "GPL") + * http://www.gnu.org/licenses/gpl.html + * + * - GNU Lesser General Public License Version 2.1 or later (the "LGPL") + * http://www.gnu.org/licenses/lgpl.html + * + * - Mozilla Public License Version 1.1 or later (the "MPL") + * http://www.mozilla.org/MPL/MPL-1.1.html + * + * == END LICENSE == + * + * This is the File Browser Connector for ASP.NET. + * + * The code of this page if included in the FCKeditor.Net package, + * in the FredCK.FCKeditorV2.dll assembly file. So to use it you must + * include that DLL in your "bin" directory. + * + * To download the FCKeditor.Net package, go to our official web site: + * http://www.fckeditor.net +--%> + \ No newline at end of file diff --git a/FCKeditor/editor/filemanager/connectors/aspx/upload.aspx b/FCKeditor/editor/filemanager/connectors/aspx/upload.aspx new file mode 100644 index 0000000..c3c0d9a --- /dev/null +++ b/FCKeditor/editor/filemanager/connectors/aspx/upload.aspx @@ -0,0 +1,32 @@ +<%@ Page Language="c#" Trace="false" Inherits="FredCK.FCKeditorV2.FileBrowser.Uploader" AutoEventWireup="false" %> +<%@ Register Src="config.ascx" TagName="Config" TagPrefix="FCKeditor" %> +<%-- + * FCKeditor - The text editor for Internet - http://www.fckeditor.net + * Copyright (C) 2003-2007 Frederico Caldeira Knabben + * + * == BEGIN LICENSE == + * + * Licensed under the terms of any of the following licenses at your + * choice: + * + * - GNU General Public License Version 2 or later (the "GPL") + * http://www.gnu.org/licenses/gpl.html + * + * - GNU Lesser General Public License Version 2.1 or later (the "LGPL") + * http://www.gnu.org/licenses/lgpl.html + * + * - Mozilla Public License Version 1.1 or later (the "MPL") + * http://www.mozilla.org/MPL/MPL-1.1.html + * + * == END LICENSE == + * + * This is the Uploader for ASP.NET. + * + * The code of this page if included in the FCKeditor.Net package, + * in the FredCK.FCKeditorV2.dll assemblyfile. So to use it you must + * include that DLL in your "bin" directory. + * + * To download the FCKeditor.Net package, go to our official web site: + * http://www.fckeditor.net +--%> + \ No newline at end of file diff --git a/FCKeditor/editor/filemanager/connectors/cfm/ImageObject.cfc b/FCKeditor/editor/filemanager/connectors/cfm/ImageObject.cfc new file mode 100644 index 0000000..3c5ade7 --- /dev/null +++ b/FCKeditor/editor/filemanager/connectors/cfm/ImageObject.cfc @@ -0,0 +1,273 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/FCKeditor/editor/filemanager/connectors/cfm/cf5_connector.cfm b/FCKeditor/editor/filemanager/connectors/cfm/cf5_connector.cfm new file mode 100644 index 0000000..d1ceaf7 --- /dev/null +++ b/FCKeditor/editor/filemanager/connectors/cfm/cf5_connector.cfm @@ -0,0 +1,315 @@ + + + + + + + + + + + + userFilesPath = config.userFilesPath; + + if ( userFilesPath eq "" ) + { + userFilesPath = "/userfiles/"; + } + + // make sure the user files path is correctly formatted + userFilesPath = replace(userFilesPath, "\", "/", "ALL"); + userFilesPath = replace(userFilesPath, '//', '/', 'ALL'); + if ( right(userFilesPath,1) NEQ "/" ) + { + userFilesPath = userFilesPath & "/"; + } + if ( left(userFilesPath,1) NEQ "/" ) + { + userFilesPath = "/" & userFilesPath; + } + + // make sure the current folder is correctly formatted + url.currentFolder = replace(url.currentFolder, "\", "/", "ALL"); + url.currentFolder = replace(url.currentFolder, '//', '/', 'ALL'); + if ( right(url.currentFolder,1) neq "/" ) + { + url.currentFolder = url.currentFolder & "/"; + } + if ( left(url.currentFolder,1) neq "/" ) + { + url.currentFolder = "/" & url.currentFolder; + } + + if ( find("/",getBaseTemplatePath()) neq 0 ) + { + fs = "/"; + } + else + { + fs = "\"; + } + + // Get the base physical path to the web root for this application. The code to determine the path automatically assumes that + // the "FCKeditor" directory in the http request path is directly off the web root for the application and that it's not a + // virtual directory or a symbolic link / junction. Use the serverPath config setting to force a physical path if necessary. + if ( len(config.serverPath) ) + { + serverPath = config.serverPath; + + if ( right(serverPath,1) neq fs ) + { + serverPath = serverPath & fs; + } + } + else + { + serverPath = replaceNoCase(getBaseTemplatePath(),replace(cgi.script_name,"/",fs,"all"),"") & replace(userFilesPath,"/",fs,"all"); + } + + rootPath = left( serverPath, Len(serverPath) - Len(userFilesPath) ) ; + xmlContent = ""; // append to this string to build content + + + + + + + + + + + + + + + + + + + + + + + + "> + + + + "> + + + + '> + + + + '> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + "> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + i=1; + folders = ""; + while( i lte qDir.recordCount ) { + if( not compareNoCase( qDir.type[i], "FILE" )) + break; + if( not listFind(".,..", qDir.name[i]) ) + folders = folders & ''; + i=i+1; + } + + xmlContent = xmlContent & '' & folders & ''; + + + + + + + + + + + + i=1; + folders = ""; + files = ""; + while( i lte qDir.recordCount ) { + if( not compareNoCase( qDir.type[i], "DIR" ) and not listFind(".,..", qDir.name[i]) ) { + folders = folders & ''; + } else if( not compareNoCase( qDir.type[i], "FILE" ) ) { + fileSizeKB = round(qDir.size[i] / 1024); + files = files & ''; + } + i=i+1; + } + + xmlContent = xmlContent & '' & folders & ''; + xmlContent = xmlContent & '' & files & ''; + + + + + + + + + + + newFolderName = url.newFolderName; + if( reFind("[^A-Za-z0-9_\-\.]", newFolderName) ) { + // Munge folder name same way as we do the filename + // This means folder names are always US-ASCII so we don't have to worry about CF5 and UTF-8 + newFolderName = reReplace(newFolderName, "[^A-Za-z0-9\-\.]", "_", "all"); + newFolderName = reReplace(newFolderName, "_{2,}", "_", "all"); + newFolderName = reReplace(newFolderName, "([^_]+)_+$", "\1", "all"); + newFolderName = reReplace(newFolderName, "$_([^_]+)$", "\1", "all"); + } + + + + + + + + + + + + + + + + + + + + + '> + + + + + + + + + + + + xmlHeader = ''; + xmlHeader = xmlHeader & ''; + xmlFooter = ''; + + + + + + +#xmlHeader##xmlContent##xmlFooter# diff --git a/FCKeditor/editor/filemanager/connectors/cfm/cf5_upload.cfm b/FCKeditor/editor/filemanager/connectors/cfm/cf5_upload.cfm new file mode 100644 index 0000000..b5ac79a --- /dev/null +++ b/FCKeditor/editor/filemanager/connectors/cfm/cf5_upload.cfm @@ -0,0 +1,296 @@ + + + + + + + + + + + + + function SendUploadResults(errorNumber, fileUrl, fileName, customMsg) + { + WriteOutput(''); + } + + + + + + + + + + + + + + + + + + + + + + + + userFilesPath = config.userFilesPath; + + if ( userFilesPath eq "" ) { + userFilesPath = "/userfiles/"; + } + + // make sure the user files path is correctly formatted + userFilesPath = replace(userFilesPath, "\", "/", "ALL"); + userFilesPath = replace(userFilesPath, '//', '/', 'ALL'); + if ( right(userFilesPath,1) NEQ "/" ) { + userFilesPath = userFilesPath & "/"; + } + if ( left(userFilesPath,1) NEQ "/" ) { + userFilesPath = "/" & userFilesPath; + } + + // make sure the current folder is correctly formatted + url.currentFolder = replace(url.currentFolder, "\", "/", "ALL"); + url.currentFolder = replace(url.currentFolder, '//', '/', 'ALL'); + if ( right(url.currentFolder,1) neq "/" ) { + url.currentFolder = url.currentFolder & "/"; + } + if ( left(url.currentFolder,1) neq "/" ) { + url.currentFolder = "/" & url.currentFolder; + } + + if (find("/",getBaseTemplatePath())) { + fs = "/"; + } else { + fs = "\"; + } + + // Get the base physical path to the web root for this application. The code to determine the path automatically assumes that + // the "FCKeditor" directory in the http request path is directly off the web root for the application and that it's not a + // virtual directory or a symbolic link / junction. Use the serverPath config setting to force a physical path if necessary. + if ( len(config.serverPath) ) { + serverPath = config.serverPath; + + if ( right(serverPath,1) neq fs ) { + serverPath = serverPath & fs; + } + } else { + serverPath = replaceNoCase(getBaseTemplatePath(),replace(cgi.script_name,"/",fs,"all"),"") & replace(userFilesPath,"/",fs,"all"); + } + + rootPath = left( serverPath, Len(serverPath) - Len(userFilesPath) ) ; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + errorNumber = 0; + fileName = cffile.ClientFileName ; + fileExt = cffile.ServerFileExt ; + fileExisted = false ; + + // munge filename for html download. Only a-z, 0-9, _, - and . are allowed + if( reFind("[^A-Za-z0-9_\-\.]", fileName) ) { + fileName = reReplace(fileName, "[^A-Za-z0-9\-\.]", "_", "ALL"); + fileName = reReplace(fileName, "_{2,}", "_", "ALL"); + fileName = reReplace(fileName, "([^_]+)_+$", "\1", "ALL"); + fileName = reReplace(fileName, "$_([^_]+)$", "\1", "ALL"); + } + + // remove additional dots from file name + if( isDefined("Config.ForceSingleExtension") and Config.ForceSingleExtension ) + fileName = replace( fileName, '.', "_", "all" ) ; + + // When the original filename already exists, add numbers (0), (1), (2), ... at the end of the filename. + if( compare( cffile.ServerFileName, fileName ) ) { + counter = 0; + tmpFileName = fileName; + while( fileExists("#currentFolderPath##fileName#.#fileExt#") ) { + fileExisted = true ; + counter = counter + 1 ; + fileName = tmpFileName & '(#counter#)' ; + } + } + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/FCKeditor/editor/filemanager/connectors/cfm/cf_basexml.cfm b/FCKeditor/editor/filemanager/connectors/cfm/cf_basexml.cfm new file mode 100644 index 0000000..3ed4868 --- /dev/null +++ b/FCKeditor/editor/filemanager/connectors/cfm/cf_basexml.cfm @@ -0,0 +1,68 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/FCKeditor/editor/filemanager/connectors/cfm/cf_commands.cfm b/FCKeditor/editor/filemanager/connectors/cfm/cf_commands.cfm new file mode 100644 index 0000000..e49284f --- /dev/null +++ b/FCKeditor/editor/filemanager/connectors/cfm/cf_commands.cfm @@ -0,0 +1,225 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + sFileExt = GetExtension( sFileName ) ; + sFilePart = RemoveExtension( sFileName ); + while( fileExists( sServerDir & sFileName ) ) + { + counter = counter + 1; + sFileName = sFilePart & '(#counter#).' & CFFILE.ClientFileExt; + errorNumber = 201; + } + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + while( i lte qDir.recordCount ) + { + if( compareNoCase( qDir.type[i], "FILE" ) and not listFind( ".,..", qDir.name[i] ) ) + { + folders = folders & '' ; + } + i = i + 1; + } + + #folders# + + + + + + + + + + + + + + + + while( i lte qDir.recordCount ) + { + if( not compareNoCase( qDir.type[i], "DIR" ) and not listFind( ".,..", qDir.name[i] ) ) + { + folders = folders & '' ; + } + else if( not compareNoCase( qDir.type[i], "FILE" ) ) + { + fileSizeKB = round(qDir.size[i] / 1024) ; + files = files & '' ; + } + i = i + 1 ; + } + + #folders# + #files# + + + + + + + + + + + + + + + + sNewFolderName = SanitizeFolderName( sNewFolderName ) ; + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/FCKeditor/editor/filemanager/connectors/cfm/cf_connector.cfm b/FCKeditor/editor/filemanager/connectors/cfm/cf_connector.cfm new file mode 100644 index 0000000..a001221 --- /dev/null +++ b/FCKeditor/editor/filemanager/connectors/cfm/cf_connector.cfm @@ -0,0 +1,89 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/FCKeditor/editor/filemanager/connectors/cfm/cf_io.cfm b/FCKeditor/editor/filemanager/connectors/cfm/cf_io.cfm new file mode 100644 index 0000000..24c8259 --- /dev/null +++ b/FCKeditor/editor/filemanager/connectors/cfm/cf_io.cfm @@ -0,0 +1,288 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +', "_", "all" )> + + + + + + + + + + var chunk = ""; + var fileReaderClass = ""; + var fileReader = ""; + var file = ""; + var done = false; + var counter = 0; + var byteArray = ""; + + if( not fileExists( ARGUMENTS.fileName ) ) + { + return "" ; + } + + if (REQUEST.CFVersion gte 8) + { + file = FileOpen( ARGUMENTS.fileName, "readbinary" ) ; + byteArray = FileRead( file, 1024 ) ; + chunk = toString( toBinary( toBase64( byteArray ) ) ) ; + FileClose( file ) ; + } + else + { + fileReaderClass = createObject("java", "java.io.FileInputStream"); + fileReader = fileReaderClass.init(fileName); + + while(not done) + { + char = fileReader.read(); + counter = counter + 1; + if ( char eq -1 or counter eq ARGUMENTS.bytes) + { + done = true; + } + else + { + chunk = chunk & chr(char) ; + } + } + } + + + + + + + + + + + + + + + + + + + + + + + + + + + +', "_", "all" )> + + + diff --git a/FCKeditor/editor/filemanager/connectors/cfm/cf_upload.cfm b/FCKeditor/editor/filemanager/connectors/cfm/cf_upload.cfm new file mode 100644 index 0000000..25c7dfd --- /dev/null +++ b/FCKeditor/editor/filemanager/connectors/cfm/cf_upload.cfm @@ -0,0 +1,68 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/FCKeditor/editor/filemanager/connectors/cfm/cf_util.cfm b/FCKeditor/editor/filemanager/connectors/cfm/cf_util.cfm new file mode 100644 index 0000000..48ce720 --- /dev/null +++ b/FCKeditor/editor/filemanager/connectors/cfm/cf_util.cfm @@ -0,0 +1,132 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + > + + + + + + + + + + + + + + + + diff --git a/FCKeditor/editor/filemanager/connectors/cfm/config.cfm b/FCKeditor/editor/filemanager/connectors/cfm/config.cfm new file mode 100644 index 0000000..9aac079 --- /dev/null +++ b/FCKeditor/editor/filemanager/connectors/cfm/config.cfm @@ -0,0 +1,183 @@ + + + + + Config = StructNew() ; + + // SECURITY: You must explicitly enable this "connector". (Set enabled to "true") + Config.Enabled = true ; + + // Path to uploaded files relative to the document root. + Config.UserFilesPath = "/userfiles/" ; + + // Use this to force the server path if FCKeditor is not running directly off + // the root of the application or the FCKeditor directory in the URL is a virtual directory + // or a symbolic link / junction + // Example: C:\inetpub\wwwroot\myDocs\ + Config.ServerPath = "" ; + + // Due to security issues with Apache modules, it is recommended to leave the + // following setting enabled. + Config.ForceSingleExtension = true ; + + // Perform additional checks for image files - if set to true, validate image size + // (This feature works in MX 6.0 and above) + Config.SecureImageUploads = true; + + // What the user can do with this connector + Config.ConfigAllowedCommands = "QuickUpload,FileUpload,GetFolders,GetFoldersAndFiles,CreateFolder" ; + + //Allowed Resource Types + Config.ConfigAllowedTypes = "File,Image,Flash,Media" ; + + // For security, HTML is allowed in the first Kb of data for files having the + // following extensions only. + // (This feature works in MX 6.0 and above)) + Config.HtmlExtensions = "html,htm,xml,xsd,txt,js" ; + + +// Configuration settings for each Resource Type +// +// - AllowedExtensions: the possible extensions that can be allowed. +// If it is empty then any file type can be uploaded. +// - DeniedExtensions: The extensions that won't be allowed. +// If it is empty then no restrictions are done here. +// +// For a file to be uploaded it has to fulfill both the AllowedExtensions +// and DeniedExtensions (that's it: not being denied) conditions. +// +// - FileTypesPath: the virtual folder relative to the document root where +// these resources will be located. +// Attention: It must start and end with a slash: '/' +// +// - FileTypesAbsolutePath: the physical path to the above folder. It must be +// an absolute path. +// If it's an empty string then it will be autocalculated. +// Usefull if you are using a virtual directory, symbolic link or alias. +// Examples: 'C:\\MySite\\userfiles\\' or '/root/mysite/userfiles/'. +// Attention: The above 'FileTypesPath' must point to the same directory. +// Attention: It must end with a slash: '/' +// +// +// - QuickUploadPath: the virtual folder relative to the document root where +// these resources will be uploaded using the Upload tab in the resources +// dialogs. +// Attention: It must start and end with a slash: '/' +// +// - QuickUploadAbsolutePath: the physical path to the above folder. It must be +// an absolute path. +// If it's an empty string then it will be autocalculated. +// Usefull if you are using a virtual directory, symbolic link or alias. +// Examples: 'C:\\MySite\\userfiles\\' or '/root/mysite/userfiles/'. +// Attention: The above 'QuickUploadPath' must point to the same directory. +// Attention: It must end with a slash: '/' + + Config.AllowedExtensions = StructNew() ; + Config.DeniedExtensions = StructNew() ; + Config.FileTypesPath = StructNew() ; + Config.FileTypesAbsolutePath = StructNew() ; + Config.QuickUploadPath = StructNew() ; + Config.QuickUploadAbsolutePath = StructNew() ; + + Config.AllowedExtensions["File"] = "7z,aiff,asf,avi,bmp,csv,doc,fla,flv,gif,gz,gzip,jpeg,jpg,mid,mov,mp3,mp4,mpc,mpeg,mpg,ods,odt,pdf,png,ppt,pxd,qt,ram,rar,rm,rmi,rmvb,rtf,sdc,sitd,swf,sxc,sxw,tar,tgz,tif,tiff,txt,vsd,wav,wma,wmv,xls,xml,zip" ; + Config.DeniedExtensions["File"] = "" ; + Config.FileTypesPath["File"] = Config.UserFilesPath & 'file/' ; + Config.FileTypesAbsolutePath["File"] = iif( Config.ServerPath eq "", de(""), de(Config.ServerPath & 'file/') ) ; + Config.QuickUploadPath["File"] = Config.FileTypesPath["File"] ; + Config.QuickUploadAbsolutePath["File"] = Config.FileTypesAbsolutePath["File"] ; + + Config.AllowedExtensions["Image"] = "bmp,gif,jpeg,jpg,png" ; + Config.DeniedExtensions["Image"] = "" ; + Config.FileTypesPath["Image"] = Config.UserFilesPath & 'image/' ; + Config.FileTypesAbsolutePath["Image"] = iif( Config.ServerPath eq "", de(""), de(Config.ServerPath & 'image/') ) ; + Config.QuickUploadPath["Image"] = Config.FileTypesPath["Image"] ; + Config.QuickUploadAbsolutePath["Image"] = Config.FileTypesAbsolutePath["Image"] ; + + Config.AllowedExtensions["Flash"] = "swf,flv" ; + Config.DeniedExtensions["Flash"] = "" ; + Config.FileTypesPath["Flash"] = Config.UserFilesPath & 'flash/' ; + Config.FileTypesAbsolutePath["Flash"] = iif( Config.ServerPath eq "", de(""), de(Config.ServerPath & 'flash/') ) ; + Config.QuickUploadPath["Flash"] = Config.FileTypesPath["Flash"] ; + Config.QuickUploadAbsolutePath["Flash"] = Config.FileTypesAbsolutePath["Flash"] ; + + Config.AllowedExtensions["Media"] = "aiff,asf,avi,bmp,fla,flv,gif,jpeg,jpg,mid,mov,mp3,mp4,mpc,mpeg,mpg,png,qt,ram,rm,rmi,rmvb,swf,tif,tiff,wav,wma,wmv" ; + Config.DeniedExtensions["Media"] = "" ; + Config.FileTypesPath["Media"] = Config.UserFilesPath & 'media/' ; + Config.FileTypesAbsolutePath["Media"] = iif( Config.ServerPath eq "", de(""), de(Config.ServerPath & 'media/') ) ; + Config.QuickUploadPath["Media"] = Config.FileTypesPath["Media"] ; + Config.QuickUploadAbsolutePath["Media"] = Config.FileTypesAbsolutePath["Media"] ; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + function structCopyKeys(stFrom, stTo) { + for ( key in stFrom ) { + if ( isStruct(stFrom[key]) ) { + structCopyKeys(stFrom[key],stTo[key]); + } else { + stTo[key] = stFrom[key]; + } + } + } + structCopyKeys(FCKeditor, config); + + + diff --git a/FCKeditor/editor/filemanager/connectors/cfm/connector.cfm b/FCKeditor/editor/filemanager/connectors/cfm/connector.cfm new file mode 100644 index 0000000..df3c0ec --- /dev/null +++ b/FCKeditor/editor/filemanager/connectors/cfm/connector.cfm @@ -0,0 +1,31 @@ + + + + + + + + + \ No newline at end of file diff --git a/FCKeditor/editor/filemanager/connectors/cfm/image.cfc b/FCKeditor/editor/filemanager/connectors/cfm/image.cfc new file mode 100644 index 0000000..b26ff76 --- /dev/null +++ b/FCKeditor/editor/filemanager/connectors/cfm/image.cfc @@ -0,0 +1,1325 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + paths = arrayNew(1); + paths[1] = expandPath("metadata-extractor-2.3.1.jar"); + loader = createObject("component", "javaloader.JavaLoader").init(paths); + + //at this stage we only have access to the class, but we don't have an instance + JpegMetadataReader = loader.create("com.drew.imaging.jpeg.JpegMetadataReader"); + + myMetaData = JpegMetadataReader.readMetadata(inFile); + directories = myMetaData.getDirectoryIterator(); + while (directories.hasNext()) { + currentDirectory = directories.next(); + tags = currentDirectory.getTagIterator(); + while (tags.hasNext()) { + currentTag = tags.next(); + if (currentTag.getTagName() DOES NOT CONTAIN "Unknown") { //leave out the junk data + queryAddRow(retQry); + querySetCell(retQry,"dirName",replace(currentTag.getDirectoryName(),' ','_','ALL')); + tagName = replace(currentTag.getTagName(),' ','','ALL'); + tagName = replace(tagName,'/','','ALL'); + querySetCell(retQry,"tagName",tagName); + querySetCell(retQry,"tagValue",currentTag.getDescription()); + } + } + } + return retQry; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + resizedImage = CreateObject("java", "java.awt.image.BufferedImage"); + at = CreateObject("java", "java.awt.geom.AffineTransform"); + op = CreateObject("java", "java.awt.image.AffineTransformOp"); + + w = img.getWidth(); + h = img.getHeight(); + + if (preserveAspect and cropToExact and newHeight gt 0 and newWidth gt 0) + { + if (w / h gt newWidth / newHeight){ + newWidth = 0; + } else if (w / h lt newWidth / newHeight){ + newHeight = 0; + } + } else if (preserveAspect and newHeight gt 0 and newWidth gt 0) { + if (w / h gt newWidth / newHeight){ + newHeight = 0; + } else if (w / h lt newWidth / newHeight){ + newWidth = 0; + } + } + if (newWidth gt 0 and newHeight eq 0) { + scale = newWidth / w; + w = newWidth; + h = round(h*scale); + } else if (newHeight gt 0 and newWidth eq 0) { + scale = newHeight / h; + h = newHeight; + w = round(w*scale); + } else if (newHeight gt 0 and newWidth gt 0) { + w = newWidth; + h = newHeight; + } else { + retVal = throw( retVal.errorMessage); + return retVal; + } + resizedImage.init(javacast("int",w),javacast("int",h),img.getType()); + + w = w / img.getWidth(); + h = h / img.getHeight(); + + + + op.init(at.getScaleInstance(javacast("double",w),javacast("double",h)), rh); + // resizedImage = op.createCompatibleDestImage(img, img.getColorModel()); + op.filter(img, resizedImage); + + imgInfo = getimageinfo(resizedImage, ""); + if (imgInfo.errorCode gt 0) + { + return imgInfo; + } + + cropOffsetX = max( Int( (imgInfo.width/2) - (newWidth/2) ), 0 ); + cropOffsetY = max( Int( (imgInfo.height/2) - (newHeight/2) ), 0 ); + // There is a chance that the image is exactly the correct + // width and height and don't need to be cropped + if + ( + preserveAspect and cropToExact + and + (imgInfo.width IS NOT specifiedWidth OR imgInfo.height IS NOT specifiedHeight) + ) + { + // Get the correct offset to get the center of the image + cropOffsetX = max( Int( (imgInfo.width/2) - (specifiedWidth/2) ), 0 ); + cropOffsetY = max( Int( (imgInfo.height/2) - (specifiedHeight/2) ), 0 ); + + cropImageResult = crop( resizedImage, "", "", cropOffsetX, cropOffsetY, specifiedWidth, specifiedHeight ); + if ( cropImageResult.errorCode GT 0) + { + return cropImageResult; + } else { + resizedImage = cropImageResult.img; + } + } + if (outputFile eq "") + { + retVal.img = resizedImage; + return retVal; + } else { + saveImage = writeImage(outputFile, resizedImage, jpegCompression); + if (saveImage.errorCode gt 0) + { + return saveImage; + } else { + return retVal; + } + } + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + if (fromX + newWidth gt img.getWidth() + OR + fromY + newHeight gt img.getHeight() + ) + { + retval = throw( "The cropped image dimensions go beyond the original image dimensions."); + return retVal; + } + croppedImage = img.getSubimage(javaCast("int", fromX), javaCast("int", fromY), javaCast("int", newWidth), javaCast("int", newHeight) ); + if (outputFile eq "") + { + retVal.img = croppedImage; + return retVal; + } else { + saveImage = writeImage(outputFile, croppedImage, jpegCompression); + if (saveImage.errorCode gt 0) + { + return saveImage; + } else { + return retVal; + } + } + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + rotatedImage = CreateObject("java", "java.awt.image.BufferedImage"); + at = CreateObject("java", "java.awt.geom.AffineTransform"); + op = CreateObject("java", "java.awt.image.AffineTransformOp"); + + iw = img.getWidth(); h = iw; + ih = img.getHeight(); w = ih; + + if(arguments.degrees eq 180) { w = iw; h = ih; } + + x = (w/2)-(iw/2); + y = (h/2)-(ih/2); + + rotatedImage.init(javacast("int",w),javacast("int",h),img.getType()); + + at.rotate(arguments.degrees * 0.0174532925,w/2,h/2); + at.translate(x,y); + op.init(at, rh); + + op.filter(img, rotatedImage); + + if (outputFile eq "") + { + retVal.img = rotatedImage; + return retVal; + } else { + saveImage = writeImage(outputFile, rotatedImage, jpegCompression); + if (saveImage.errorCode gt 0) + { + return saveImage; + } else { + return retVal; + } + } + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + if (outputFile eq "") + { + retVal = throw( "The convert method requires a valid output filename."); + return retVal; + } else { + saveImage = writeImage(outputFile, img, jpegCompression); + if (saveImage.errorCode gt 0) + { + return saveImage; + } else { + return retVal; + } + } + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + /* + JPEG output method handles compression + */ + out = createObject("java", "java.io.BufferedOutputStream"); + fos = createObject("java", "java.io.FileOutputStream"); + fos.init(tempOutputFile); + out.init(fos); + JPEGCodec = createObject("java", "com.sun.image.codec.jpeg.JPEGCodec"); + encoder = JPEGCodec.createJPEGEncoder(out); + param = encoder.getDefaultJPEGEncodeParam(img); + param.setQuality(quality, false); + encoder.setJPEGEncodeParam(param); + encoder.encode(img); + out.close(); + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + flippedImage = CreateObject("java", "java.awt.image.BufferedImage"); + at = CreateObject("java", "java.awt.geom.AffineTransform"); + op = CreateObject("java", "java.awt.image.AffineTransformOp"); + + flippedImage.init(img.getWidth(), img.getHeight(), img.getType()); + + if (direction eq "horizontal") { + at = at.getScaleInstance(-1, 1); + at.translate(-img.getWidth(), 0); + } else { + at = at.getScaleInstance(1,-1); + at.translate(0, -img.getHeight()); + } + op.init(at, rh); + op.filter(img, flippedImage); + + if (outputFile eq "") + { + retVal.img = flippedImage; + return retVal; + } else { + saveImage = writeImage(outputFile, flippedImage, jpegCompression); + if (saveImage.errorCode gt 0) + { + return saveImage; + } else { + return retVal; + } + } + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + // initialize the blur filter + variables.blurFilter.init(arguments.blurAmount); + // move the source image into the destination image + // so we can repeatedly blur it. + destImage = srcImage; + + for (i=1; i lte iterations; i=i+1) + { + // do the blur i times + destImage = variables.blurFilter.filter(destImage); + } + + + if (outputFile eq "") + { + // return the image object + retVal.img = destImage; + return retVal; + } else { + // write the image object to the specified file. + saveImage = writeImage(outputFile, destImage, jpegCompression); + if (saveImage.errorCode gt 0) + { + return saveImage; + } else { + return retVal; + } + } + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + // initialize the sharpen filter + variables.sharpenFilter.init(); + + destImage = variables.sharpenFilter.filter(srcImage); + + + if (outputFile eq "") + { + // return the image object + retVal.img = destImage; + return retVal; + } else { + // write the image object to the specified file. + saveImage = writeImage(outputFile, destImage, jpegCompression); + if (saveImage.errorCode gt 0) + { + return saveImage; + } else { + return retVal; + } + } + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + // initialize the posterize filter + variables.posterizeFilter.init(arguments.amount); + + destImage = variables.posterizeFilter.filter(srcImage); + + + if (outputFile eq "") + { + // return the image object + retVal.img = destImage; + return retVal; + } else { + // write the image object to the specified file. + saveImage = writeImage(outputFile, destImage, jpegCompression); + if (saveImage.errorCode gt 0) + { + return saveImage; + } else { + return retVal; + } + } + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + // load objects + bgImage = CreateObject("java", "java.awt.image.BufferedImage"); + fontImage = CreateObject("java", "java.awt.image.BufferedImage"); + overlayImage = CreateObject("java", "java.awt.image.BufferedImage"); + Color = CreateObject("java","java.awt.Color"); + font = createObject("java","java.awt.Font"); + font_stream = createObject("java","java.io.FileInputStream"); + ac = CreateObject("Java", "java.awt.AlphaComposite"); + + // set up basic needs + fontColor = Color.init(javacast("int", rgb.red), javacast("int", rgb.green), javacast("int", rgb.blue)); + + if (fontDetails.fontFile neq "") + { + font_stream.init(arguments.fontDetails.fontFile); + font = font.createFont(font.TRUETYPE_FONT, font_stream); + font = font.deriveFont(javacast("float",arguments.fontDetails.size)); + } else { + font.init(fontDetails.fontName, evaluate(fontDetails.style), fontDetails.size); + } + // get font metrics using a 1x1 bufferedImage + fontImage.init(1,1,img.getType()); + g2 = fontImage.createGraphics(); + g2.setRenderingHints(getRenderingHints()); + fc = g2.getFontRenderContext(); + bounds = font.getStringBounds(content,fc); + + g2 = img.createGraphics(); + g2.setRenderingHints(getRenderingHints()); + g2.setFont(font); + g2.setColor(fontColor); + // in case you want to change the alpha + // g2.setComposite(ac.getInstance(ac.SRC_OVER, 0.50)); + + // the location (arguments.fontDetails.size+y) doesn't really work + // the way I want it to. + g2.drawString(content,javacast("int",x),javacast("int",arguments.fontDetails.size+y)); + + if (outputFile eq "") + { + retVal.img = img; + return retVal; + } else { + saveImage = writeImage(outputFile, img, jpegCompression); + if (saveImage.errorCode gt 0) + { + return saveImage; + } else { + return retVal; + } + } + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + at = CreateObject("java", "java.awt.geom.AffineTransform"); + op = CreateObject("java", "java.awt.image.AffineTransformOp"); + ac = CreateObject("Java", "java.awt.AlphaComposite"); + gfx = originalImage.getGraphics(); + gfx.setComposite(ac.getInstance(ac.SRC_OVER, alpha)); + + at.init(); + // op.init(at,op.TYPE_BILINEAR); + op.init(at, rh); + + gfx.drawImage(wmImage, op, javaCast("int",arguments.placeAtX), javacast("int", arguments.placeAtY)); + + gfx.dispose(); + + if (outputFile eq "") + { + retVal.img = originalImage; + return retVal; + } else { + saveImage = writeImage(outputFile, originalImage, jpegCompression); + if (saveImage.errorCode gt 0) + { + return saveImage; + } else { + return retVal; + } + } + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + // convert the image to a specified BufferedImage type and return it + + var width = bImage.getWidth(); + var height = bImage.getHeight(); + var newImage = createObject("java","java.awt.image.BufferedImage").init(javacast("int",width), javacast("int",height), javacast("int",type)); + // int[] rgbArray = new int[width*height]; + var rgbArray = variables.arrObj.newInstance(variables.intClass, javacast("int",width*height)); + + bImage.getRGB( + javacast("int",0), + javacast("int",0), + javacast("int",width), + javacast("int",height), + rgbArray, + javacast("int",0), + javacast("int",width) + ); + newImage.setRGB( + javacast("int",0), + javacast("int",0), + javacast("int",width), + javacast("int",height), + rgbArray, + javacast("int",0), + javacast("int",width) + ); + return newImage; + + + + + + diff --git a/FCKeditor/editor/filemanager/connectors/cfm/upload.cfm b/FCKeditor/editor/filemanager/connectors/cfm/upload.cfm new file mode 100644 index 0000000..d7c2709 --- /dev/null +++ b/FCKeditor/editor/filemanager/connectors/cfm/upload.cfm @@ -0,0 +1,31 @@ + + + + + + + + + \ No newline at end of file diff --git a/FCKeditor/editor/filemanager/connectors/lasso/config.lasso b/FCKeditor/editor/filemanager/connectors/lasso/config.lasso new file mode 100644 index 0000000..32ba94d --- /dev/null +++ b/FCKeditor/editor/filemanager/connectors/lasso/config.lasso @@ -0,0 +1,65 @@ +[//lasso +/* + * FCKeditor - The text editor for Internet - http://www.fckeditor.net + * Copyright (C) 2003-2007 Frederico Caldeira Knabben + * + * == BEGIN LICENSE == + * + * Licensed under the terms of any of the following licenses at your + * choice: + * + * - GNU General Public License Version 2 or later (the "GPL") + * http://www.gnu.org/licenses/gpl.html + * + * - GNU Lesser General Public License Version 2.1 or later (the "LGPL") + * http://www.gnu.org/licenses/lgpl.html + * + * - Mozilla Public License Version 1.1 or later (the "MPL") + * http://www.mozilla.org/MPL/MPL-1.1.html + * + * == END LICENSE == + * + * Configuration file for the File Manager Connector for Lasso. + */ + + /*..................................................................... + The connector uses the file tags, which require authentication. Enter a + valid username and password from Lasso admin for a group with file tags + permissions for uploads and the path you define in UserFilesPath below. + */ + + var('connection') = array( + -username='xxxxxxxx', + -password='xxxxxxxx' + ); + + + /*..................................................................... + Set the base path for files that users can upload and browse (relative + to server root). + + Set which file extensions are allowed and/or denied for each file type. + */ + var('config') = map( + 'Enabled' = false, + 'UserFilesPath' = '/userfiles/', + 'Subdirectories' = map( + 'File' = 'File/', + 'Image' = 'Image/', + 'Flash' = 'Flash/', + 'Media' = 'Media/' + ), + 'AllowedExtensions' = map( + 'File' = array('7z','aiff','asf','avi','bmp','csv','doc','fla','flv','gif','gz','gzip','jpeg','jpg','mid','mov','mp3','mp4','mpc','mpeg','mpg','ods','odt','pdf','png','ppt','pxd','qt','ram','rar','rm','rmi','rmvb','rtf','sdc','sitd','swf','sxc','sxw','tar','tgz','tif','tiff','txt','vsd','wav','wma','wmv','xls','xml','zip'), + 'Image' = array('bmp','gif','jpeg','jpg','png'), + 'Flash' = array('swf','flv'), + 'Media' = array('aiff','asf','avi','bmp','fla','flv','gif','jpeg','jpg','mid','mov','mp3','mp4','mpc','mpeg','mpg','png','qt','ram','rm','rmi','rmvb','swf','tif','tiff','wav','wma','wmv') + ), + 'DeniedExtensions' = map( + 'File' = array(), + 'Image' = array(), + 'Flash' = array(), + 'Media' = array() + ) + ); +] \ No newline at end of file diff --git a/FCKeditor/editor/filemanager/connectors/lasso/connector.lasso b/FCKeditor/editor/filemanager/connectors/lasso/connector.lasso new file mode 100644 index 0000000..40b9180 --- /dev/null +++ b/FCKeditor/editor/filemanager/connectors/lasso/connector.lasso @@ -0,0 +1,257 @@ +[//lasso +/* + * FCKeditor - The text editor for Internet - http://www.fckeditor.net + * Copyright (C) 2003-2007 Frederico Caldeira Knabben + * + * == BEGIN LICENSE == + * + * Licensed under the terms of any of the following licenses at your + * choice: + * + * - GNU General Public License Version 2 or later (the "GPL") + * http://www.gnu.org/licenses/gpl.html + * + * - GNU Lesser General Public License Version 2.1 or later (the "LGPL") + * http://www.gnu.org/licenses/lgpl.html + * + * - Mozilla Public License Version 1.1 or later (the "MPL") + * http://www.mozilla.org/MPL/MPL-1.1.html + * + * == END LICENSE == + * + * This is the File Manager Connector for Lasso. + */ + + /*..................................................................... + Include global configuration. See config.lasso for details. + */ + include('config.lasso'); + + + /*..................................................................... + Translate current date/time to GMT for custom header. + */ + var('headerDate') = date_localtogmt(date)->format('%a, %d %b %Y %T GMT'); + + + /*..................................................................... + Convert query string parameters to variables and initialize output. + */ + var( + 'Command' = action_param('Command'), + 'Type' = action_param('Type'), + 'CurrentFolder' = action_param('CurrentFolder'), + 'ServerPath' = action_param('ServerPath'), + 'NewFolderName' = action_param('NewFolderName'), + 'NewFile' = null, + 'NewFileName' = string, + 'OrigFilePath' = string, + 'NewFilePath' = string, + 'commandData' = string, + 'folders' = '\t\n', + 'files' = '\t\n', + 'errorNumber' = integer, + 'responseType' = 'xml', + 'uploadResult' = '0' + ); + + + /*..................................................................... + Calculate the path to the current folder. + */ + $ServerPath == '' ? $ServerPath = $config->find('UserFilesPath'); + + var('currentFolderURL' = $ServerPath + + $config->find('Subdirectories')->find(action_param('Type')) + + action_param('CurrentFolder') + ); + + + /*..................................................................... + Build the appropriate response per the 'Command' parameter. Wrap the + entire process in an inline for file tag permissions. + */ + inline($connection); + select($Command); + /*............................................................. + List all subdirectories in the 'Current Folder' directory. + */ + case('GetFolders'); + $commandData += '\t\n'; + + iterate(file_listdirectory($currentFolderURL), local('this')); + #this->endswith('/') ? $commandData += '\t\t\n'; + /iterate; + + $commandData += '\t\n'; + + + /*............................................................. + List both files and folders in the 'Current Folder' directory. + Include the file sizes in kilobytes. + */ + case('GetFoldersAndFiles'); + iterate(file_listdirectory($currentFolderURL), local('this')); + if(#this->endswith('/')); + $folders += '\t\t\n'; + else; + local('size') = file_getsize($currentFolderURL + #this) / 1024; + $files += '\t\t\n'; + /if; + /iterate; + + $folders += '\t\n'; + $files += '\t\n'; + + $commandData += $folders + $files; + + + /*............................................................. + Create a directory 'NewFolderName' within the 'Current Folder.' + */ + case('CreateFolder'); + var('newFolder' = $currentFolderURL + $NewFolderName + '/'); + file_create($newFolder); + + + /*......................................................... + Map Lasso's file error codes to FCKEditor's error codes. + */ + select(file_currenterror( -errorcode)); + case(0); + $errorNumber = 0; + case( -9983); + $errorNumber = 101; + case( -9976); + $errorNumber = 102; + case( -9977); + $errorNumber = 102; + case( -9961); + $errorNumber = 103; + case; + $errorNumber = 110; + /select; + + $commandData += '\n'; + + + /*............................................................. + Process an uploaded file. + */ + case('FileUpload'); + /*......................................................... + This is the only command that returns an HTML response. + */ + $responseType = 'html'; + + + /*......................................................... + Was a file actually uploaded? + */ + file_uploads->size ? $NewFile = file_uploads->get(1) | $uploadResult = '202'; + + if($uploadResult == '0'); + /*..................................................... + Split the file's extension from the filename in order + to follow the API's naming convention for duplicate + files. (Test.txt, Test(1).txt, Test(2).txt, etc.) + */ + $NewFileName = $NewFile->find('OrigName'); + $OrigFilePath = $currentFolderURL + $NewFileName; + $NewFilePath = $OrigFilePath; + local('fileExtension') = '.' + $NewFile->find('OrigExtension'); + local('shortFileName') = $NewFileName->removetrailing(#fileExtension)&; + + + /*..................................................... + Make sure the file extension is allowed. + */ + if($config->find('DeniedExtensions')->find($Type) >> $NewFile->find('OrigExtension')); + $uploadResult = '202'; + else; + /*................................................. + Rename the target path until it is unique. + */ + while(file_exists($NewFilePath)); + $NewFilePath = $currentFolderURL + #shortFileName + '(' + loop_count + ')' + #fileExtension; + /while; + + + /*................................................. + Copy the uploaded file to its final location. + */ + file_copy($NewFile->find('path'), $NewFilePath); + + + /*................................................. + Set the error code for the response. Note whether + the file had to be renamed. + */ + select(file_currenterror( -errorcode)); + case(0); + $OrigFilePath != $NewFilePath ? $uploadResult = 201; + case; + $uploadResult = '202'; + /select; + /if; + /if; + + + /*......................................................... + Set the HTML response. + */ + if($uploadResult == '0' || $uploadResult == '201'); + $__html_reply__ = '\ + + '; + else; + $__html_reply__ = '\ + + '; + /if; + /select; + /inline; + + + /*..................................................................... + Send a custom header for xml responses. + */ + if($responseType == 'xml'); + header; +] +HTTP/1.0 200 OK +Date: [$headerDate] +Server: Lasso Professional [lasso_version( -lassoversion)] +Expires: Mon, 26 Jul 1997 05:00:00 GMT +Last-Modified: [$headerDate] +Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 +Pragma: no-cache +Keep-Alive: timeout=15, max=98 +Connection: Keep-Alive +Content-Type: text/xml; charset=utf-8 +[//lasso + /header; + + + /*................................................................. + Set the content type encoding for Lasso. + */ + content_type('text/xml; charset=utf-8'); + + + /*................................................................. + Wrap the response as XML and output. + */ + $__html_reply__ = '\ + + + +' + $commandData + ' + + '; + /if; +] diff --git a/FCKeditor/editor/filemanager/connectors/lasso/upload.lasso b/FCKeditor/editor/filemanager/connectors/lasso/upload.lasso new file mode 100644 index 0000000..e9e3f92 --- /dev/null +++ b/FCKeditor/editor/filemanager/connectors/lasso/upload.lasso @@ -0,0 +1,157 @@ +[//lasso +/* + * FCKeditor - The text editor for Internet - http://www.fckeditor.net + * Copyright (C) 2003-2007 Frederico Caldeira Knabben + * + * == BEGIN LICENSE == + * + * Licensed under the terms of any of the following licenses at your + * choice: + * + * - GNU General Public License Version 2 or later (the "GPL") + * http://www.gnu.org/licenses/gpl.html + * + * - GNU Lesser General Public License Version 2.1 or later (the "LGPL") + * http://www.gnu.org/licenses/lgpl.html + * + * - Mozilla Public License Version 1.1 or later (the "MPL") + * http://www.mozilla.org/MPL/MPL-1.1.html + * + * == END LICENSE == + * + * This is the "File Uploader" for Lasso. + */ + + /*..................................................................... + Include global configuration. See config.lasso for details. + */ + include('config.lasso'); + + + /*..................................................................... + Convert query string parameters to variables and initialize output. + */ + var( + 'Type' = action_param('Type'), + 'CurrentFolder' = action_param('CurrentFolder'), + 'ServerPath' = action_param('ServerPath'), + 'NewFile' = null, + 'NewFileName' = string, + 'OrigFilePath' = string, + 'NewFilePath' = string, + 'errorNumber' = 0, + 'customMsg' = '' + ); + + $Type == '' ? $Type = 'File'; + + + /*..................................................................... + Calculate the path to the current folder. + */ + $ServerPath == '' ? $ServerPath = $config->find('UserFilesPath'); + + var('currentFolderURL' = $ServerPath + + $config->find('Subdirectories')->find(action_param('Type')) + + action_param('CurrentFolder') + ); + + + /*..................................................................... + Custom tag sets the HTML response. + */ + + define_tag( + 'sendresults', + -namespace='fck_', + -priority='replace', + -required='errorNumber', + -type='integer', + -optional='fileUrl', + -type='string', + -optional='fileName', + -type='string', + -optional='customMsg', + -type='string', + -description='Sets the HTML response for the FCKEditor Quick Upload feature.' + ); + $__html_reply__ = '\ + + '; + /define_tag; + + + if($config->find('Enabled')); + /*................................................................. + Process an uploaded file. + */ + inline($connection); + /*............................................................. + Was a file actually uploaded? + */ + file_uploads->size ? $NewFile = file_uploads->get(1) | $errorNumber = 202; + + if($errorNumber == 0); + /*......................................................... + Split the file's extension from the filename in order + to follow the API's naming convention for duplicate + files. (Test.txt, Test(1).txt, Test(2).txt, etc.) + */ + $NewFileName = $NewFile->find('OrigName'); + $OrigFilePath = $currentFolderURL + $NewFileName; + $NewFilePath = $OrigFilePath; + local('fileExtension') = '.' + $NewFile->find('OrigExtension'); + local('shortFileName') = $NewFileName->removetrailing(#fileExtension)&; + + + /*......................................................... + Make sure the file extension is allowed. + */ + + if($config->find('DeniedExtensions')->find($Type) >> $NewFile->find('OrigExtension')); + $errorNumber = 202; + else; + /*..................................................... + Rename the target path until it is unique. + */ + while(file_exists($NewFilePath)); + $NewFileName = #shortFileName + '(' + loop_count + ')' + #fileExtension; + $NewFilePath = $currentFolderURL + $NewFileName; + /while; + + + /*..................................................... + Copy the uploaded file to its final location. + */ + file_copy($NewFile->find('path'), $NewFilePath); + + + /*..................................................... + Set the error code for the response. + */ + select(file_currenterror( -errorcode)); + case(0); + $OrigFilePath != $NewFilePath ? $errorNumber = 201; + case; + $errorNumber = 202; + /select; + /if; + /if; + /inline; + else; + $errorNumber = 1; + $customMsg = 'This file uploader is disabled. Please check the "editor/filemanager/upload/lasso/config.lasso" file.'; + /if; + + fck_sendresults( + -errorNumber=$errorNumber, + -fileUrl=$NewFilePath, + -fileName=$NewFileName, + -customMsg=$customMsg + ); +] diff --git a/FCKeditor/editor/filemanager/connectors/perl/basexml.pl b/FCKeditor/editor/filemanager/connectors/perl/basexml.pl new file mode 100644 index 0000000..f74a567 --- /dev/null +++ b/FCKeditor/editor/filemanager/connectors/perl/basexml.pl @@ -0,0 +1,63 @@ +##### +# FCKeditor - The text editor for Internet - http://www.fckeditor.net +# Copyright (C) 2003-2007 Frederico Caldeira Knabben +# +# == BEGIN LICENSE == +# +# Licensed under the terms of any of the following licenses at your +# choice: +# +# - GNU General Public License Version 2 or later (the "GPL") +# http://www.gnu.org/licenses/gpl.html +# +# - GNU Lesser General Public License Version 2.1 or later (the "LGPL") +# http://www.gnu.org/licenses/lgpl.html +# +# - Mozilla Public License Version 1.1 or later (the "MPL") +# http://www.mozilla.org/MPL/MPL-1.1.html +# +# == END LICENSE == +# +# This is the File Manager Connector for Perl. +##### + +sub CreateXmlHeader +{ + local($command,$resourceType,$currentFolder) = @_; + + # Create the XML document header. + print ''; + + # Create the main "Connector" node. + print ''; + + # Add the current folder node. + print ''; +} + +sub CreateXmlFooter +{ + print ''; +} + +sub SendError +{ + local( $number, $text ) = @_; + + print << "_HTML_HEAD_"; +Content-Type:text/xml; charset=utf-8 +Pragma: no-cache +Cache-Control: no-cache +Expires: Thu, 01 Dec 1994 16:00:00 GMT + +_HTML_HEAD_ + + # Create the XML document header + print '' ; + + print '' ; + + exit ; +} + +1; diff --git a/FCKeditor/editor/filemanager/connectors/perl/commands.pl b/FCKeditor/editor/filemanager/connectors/perl/commands.pl new file mode 100644 index 0000000..c1586f4 --- /dev/null +++ b/FCKeditor/editor/filemanager/connectors/perl/commands.pl @@ -0,0 +1,168 @@ +##### +# FCKeditor - The text editor for Internet - http://www.fckeditor.net +# Copyright (C) 2003-2007 Frederico Caldeira Knabben +# +# == BEGIN LICENSE == +# +# Licensed under the terms of any of the following licenses at your +# choice: +# +# - GNU General Public License Version 2 or later (the "GPL") +# http://www.gnu.org/licenses/gpl.html +# +# - GNU Lesser General Public License Version 2.1 or later (the "LGPL") +# http://www.gnu.org/licenses/lgpl.html +# +# - Mozilla Public License Version 1.1 or later (the "MPL") +# http://www.mozilla.org/MPL/MPL-1.1.html +# +# == END LICENSE == +# +# This is the File Manager Connector for Perl. +##### + +sub GetFolders +{ + + local($resourceType, $currentFolder) = @_; + + # Map the virtual path to the local server path. + $sServerDir = &ServerMapFolder($resourceType, $currentFolder); + print ""; # Open the "Folders" node. + + opendir(DIR,"$sServerDir"); + @files = grep(!/^\.\.?$/,readdir(DIR)); + closedir(DIR); + + foreach $sFile (@files) { + if($sFile != '.' && $sFile != '..' && (-d "$sServerDir$sFile")) { + $cnv_filename = &ConvertToXmlAttribute($sFile); + print ''; + } + } + print ""; # Close the "Folders" node. +} + +sub GetFoldersAndFiles +{ + + local($resourceType, $currentFolder) = @_; + # Map the virtual path to the local server path. + $sServerDir = &ServerMapFolder($resourceType,$currentFolder); + + # Initialize the output buffers for "Folders" and "Files". + $sFolders = ''; + $sFiles = ''; + + opendir(DIR,"$sServerDir"); + @files = grep(!/^\.\.?$/,readdir(DIR)); + closedir(DIR); + + foreach $sFile (@files) { + if($sFile ne '.' && $sFile ne '..') { + if(-d "$sServerDir$sFile") { + $cnv_filename = &ConvertToXmlAttribute($sFile); + $sFolders .= '' ; + } else { + ($iFileSize,$refdate,$filedate,$fileperm) = (stat("$sServerDir$sFile"))[7,8,9,2]; + if($iFileSize > 0) { + $iFileSize = int($iFileSize / 1024); + if($iFileSize < 1) { + $iFileSize = 1; + } + } + $cnv_filename = &ConvertToXmlAttribute($sFile); + $sFiles .= '' ; + } + } + } + print $sFolders ; + print ''; # Close the "Folders" node. + print $sFiles ; + print ''; # Close the "Files" node. +} + +sub CreateFolder +{ + + local($resourceType, $currentFolder) = @_; + $sErrorNumber = '0' ; + $sErrorMsg = '' ; + + if($FORM{'NewFolderName'} ne "") { + $sNewFolderName = $FORM{'NewFolderName'}; + # Map the virtual path to the local server path of the current folder. + $sServerDir = &ServerMapFolder($resourceType, $currentFolder); + if(-w $sServerDir) { + $sServerDir .= $sNewFolderName; + $sErrorMsg = &CreateServerFolder($sServerDir); + if($sErrorMsg == 0) { + $sErrorNumber = '0'; + } elsif($sErrorMsg eq 'Invalid argument' || $sErrorMsg eq 'No such file or directory') { + $sErrorNumber = '102'; #// Path too long. + } else { + $sErrorNumber = '110'; + } + } else { + $sErrorNumber = '103'; + } + } else { + $sErrorNumber = '102' ; + } + # Create the "Error" node. + $cnv_errmsg = &ConvertToXmlAttribute($sErrorMsg); + print ''; +} + +sub FileUpload +{ +eval("use File::Copy;"); + + local($resourceType, $currentFolder) = @_; + + $sErrorNumber = '0' ; + $sFileName = '' ; + if($new_fname) { + # Map the virtual path to the local server path. + $sServerDir = &ServerMapFolder($resourceType,$currentFolder); + + # Get the uploaded file name. + $sFileName = $new_fname; + $sOriginalFileName = $sFileName; + + $iCounter = 0; + while(1) { + $sFilePath = $sServerDir . $sFileName; + if(-e $sFilePath) { + $iCounter++ ; + ($path,$BaseName,$ext) = &RemoveExtension($sOriginalFileName); + $sFileName = $BaseName . '(' . $iCounter . ').' . $ext; + $sErrorNumber = '201'; + } else { + copy("$img_dir/$new_fname","$sFilePath"); + chmod(0777,$sFilePath); + unlink("$img_dir/$new_fname"); + last; + } + } + } else { + $sErrorNumber = '202' ; + } + $sFileName =~ s/"/\\"/g; + + SendUploadResults($sErrorNumber, $resourceType.$currentFolder.$sFileName, $sFileName, ''); +} + +sub SendUploadResults +{ + + local($sErrorNumber, $sFileUrl, $sFileName, $customMsg) = @_; + + print "Content-type: text/html\n\n"; + print ''; + exit ; +} + +1; diff --git a/FCKeditor/editor/filemanager/connectors/perl/connector.cgi b/FCKeditor/editor/filemanager/connectors/perl/connector.cgi new file mode 100644 index 0000000..d854ef3 --- /dev/null +++ b/FCKeditor/editor/filemanager/connectors/perl/connector.cgi @@ -0,0 +1,137 @@ +#!/usr/bin/env perl + +##### +# FCKeditor - The text editor for Internet - http://www.fckeditor.net +# Copyright (C) 2003-2007 Frederico Caldeira Knabben +# +# == BEGIN LICENSE == +# +# Licensed under the terms of any of the following licenses at your +# choice: +# +# - GNU General Public License Version 2 or later (the "GPL") +# http://www.gnu.org/licenses/gpl.html +# +# - GNU Lesser General Public License Version 2.1 or later (the "LGPL") +# http://www.gnu.org/licenses/lgpl.html +# +# - Mozilla Public License Version 1.1 or later (the "MPL") +# http://www.mozilla.org/MPL/MPL-1.1.html +# +# == END LICENSE == +# +# This is the File Manager Connector for Perl. +##### + +## +# ATTENTION: To enable this connector, look for the "SECURITY" comment in this file. +## + +## START: Hack for Windows (Not important to understand the editor code... Perl specific). +if(Windows_check()) { + chdir(GetScriptPath($0)); +} + +sub Windows_check +{ + # IIS,PWS(NT/95) + $www_server_os = $^O; + # Win98 & NT(SP4) + if($www_server_os eq "") { $www_server_os= $ENV{'OS'}; } + # AnHTTPd/Omni/IIS + if($ENV{'SERVER_SOFTWARE'} =~ /AnWeb|Omni|IIS\//i) { $www_server_os= 'win'; } + # Win Apache + if($ENV{'WINDIR'} ne "") { $www_server_os= 'win'; } + if($www_server_os=~ /win/i) { return(1); } + return(0); +} + +sub GetScriptPath { + local($path) = @_; + if($path =~ /[\:\/\\]/) { $path =~ s/(.*?)[\/\\][^\/\\]+$/$1/; } else { $path = '.'; } + $path; +} +## END: Hack for IIS + +require 'util.pl'; +require 'io.pl'; +require 'basexml.pl'; +require 'commands.pl'; +require 'upload_fck.pl'; + +## +# SECURITY: REMOVE/COMMENT THE FOLLOWING LINE TO ENABLE THIS CONNECTOR. +## + &SendError( 1, 'This connector is disabled. Please check the "editor/filemanager/connectors/perl/connector.cgi" file' ) ; + + &read_input(); + + if($FORM{'ServerPath'} ne "") { + $GLOBALS{'UserFilesPath'} = $FORM{'ServerPath'}; + if(!($GLOBALS{'UserFilesPath'} =~ /\/$/)) { + $GLOBALS{'UserFilesPath'} .= '/' ; + } + } else { + $GLOBALS{'UserFilesPath'} = '/userfiles/'; + } + + # Map the "UserFiles" path to a local directory. + $rootpath = &GetRootPath(); + $GLOBALS{'UserFilesDirectory'} = $rootpath . $GLOBALS{'UserFilesPath'}; + + &DoResponse(); + +sub DoResponse +{ + + if($FORM{'Command'} eq "" || $FORM{'Type'} eq "" || $FORM{'CurrentFolder'} eq "") { + return ; + } + # Get the main request informaiton. + $sCommand = $FORM{'Command'}; + $sResourceType = $FORM{'Type'}; + $sCurrentFolder = $FORM{'CurrentFolder'}; + + # Check the current folder syntax (must begin and start with a slash). + if(!($sCurrentFolder =~ /\/$/)) { + $sCurrentFolder .= '/'; + } + if(!($sCurrentFolder =~ /^\//)) { + $sCurrentFolder = '/' . $sCurrentFolder; + } + + # Check for invalid folder paths (..) + if ( $sCurrentFolder =~ /\.\./ ) { + SendError( 102, "" ) ; + } + + # File Upload doesn't have to Return XML, so it must be intercepted before anything. + if($sCommand eq 'FileUpload') { + FileUpload($sResourceType,$sCurrentFolder); + return ; + } + + print << "_HTML_HEAD_"; +Content-Type:text/xml; charset=utf-8 +Pragma: no-cache +Cache-Control: no-cache +Expires: Thu, 01 Dec 1994 16:00:00 GMT + +_HTML_HEAD_ + + &CreateXmlHeader($sCommand,$sResourceType,$sCurrentFolder); + + # Execute the required command. + if($sCommand eq 'GetFolders') { + &GetFolders($sResourceType,$sCurrentFolder); + } elsif($sCommand eq 'GetFoldersAndFiles') { + &GetFoldersAndFiles($sResourceType,$sCurrentFolder); + } elsif($sCommand eq 'CreateFolder') { + &CreateFolder($sResourceType,$sCurrentFolder); + } + + &CreateXmlFooter(); + + exit ; +} + diff --git a/FCKeditor/editor/filemanager/connectors/perl/io.pl b/FCKeditor/editor/filemanager/connectors/perl/io.pl new file mode 100644 index 0000000..7b88cf8 --- /dev/null +++ b/FCKeditor/editor/filemanager/connectors/perl/io.pl @@ -0,0 +1,131 @@ +##### +# FCKeditor - The text editor for Internet - http://www.fckeditor.net +# Copyright (C) 2003-2007 Frederico Caldeira Knabben +# +# == BEGIN LICENSE == +# +# Licensed under the terms of any of the following licenses at your +# choice: +# +# - GNU General Public License Version 2 or later (the "GPL") +# http://www.gnu.org/licenses/gpl.html +# +# - GNU Lesser General Public License Version 2.1 or later (the "LGPL") +# http://www.gnu.org/licenses/lgpl.html +# +# - Mozilla Public License Version 1.1 or later (the "MPL") +# http://www.mozilla.org/MPL/MPL-1.1.html +# +# == END LICENSE == +# +# This is the File Manager Connector for Perl. +##### + +sub GetUrlFromPath +{ + local($resourceType, $folderPath) = @_; + + if($resourceType eq '') { + $rmpath = &RemoveFromEnd($GLOBALS{'UserFilesPath'},'/'); + return("$rmpath$folderPath"); + } else { + return("$GLOBALS{'UserFilesPath'}$resourceType$folderPath"); + } +} + +sub RemoveExtension +{ + local($fileName) = @_; + local($path, $base, $ext); + if($fileName !~ /\./) { + $fileName .= '.'; + } + if($fileName =~ /([^\\\/]*)\.(.*)$/) { + $base = $1; + $ext = $2; + if($fileName =~ /(.*)$base\.$ext$/) { + $path = $1; + } + } + return($path,$base,$ext); + +} + +sub ServerMapFolder +{ + local($resourceType,$folderPath) = @_; + + # Get the resource type directory. + $sResourceTypePath = $GLOBALS{'UserFilesDirectory'} . $resourceType . '/'; + + # Ensure that the directory exists. + &CreateServerFolder($sResourceTypePath); + + # Return the resource type directory combined with the required path. + $rmpath = &RemoveFromStart($folderPath,'/'); + return("$sResourceTypePath$rmpath"); +} + +sub GetParentFolder +{ + local($folderPath) = @_; + + $folderPath =~ s/[\/][^\/]+[\/]?$//g; + return $folderPath; +} + +sub CreateServerFolder +{ + local($folderPath) = @_; + + $sParent = &GetParentFolder($folderPath); + # Check if the parent exists, or create it. + if(!(-e $sParent)) { + $sErrorMsg = &CreateServerFolder($sParent); + if($sErrorMsg == 1) { + return(1); + } + } + if(!(-e $folderPath)) { + umask(000); + mkdir("$folderPath",0777); + chmod(0777,"$folderPath"); + return(0); + } else { + return(1); + } +} + +sub GetRootPath +{ +#use Cwd; + +# my $dir = getcwd; +# print $dir; +# $dir =~ s/$ENV{'DOCUMENT_ROOT'}//g; +# print $dir; +# return($dir); + +# $wk = $0; +# $wk =~ s/\/connector\.cgi//g; +# if($wk) { +# $current_dir = $wk; +# } else { +# $current_dir = `pwd`; +# } +# return($current_dir); +use Cwd; + + if($ENV{'DOCUMENT_ROOT'}) { + $dir = $ENV{'DOCUMENT_ROOT'}; + } else { + my $dir = getcwd; + $workdir =~ s/\/connector\.cgi//g; + $dir =~ s/$workdir//g; + } + return($dir); + + + +} +1; diff --git a/FCKeditor/editor/filemanager/connectors/perl/upload.cgi b/FCKeditor/editor/filemanager/connectors/perl/upload.cgi new file mode 100644 index 0000000..668f5a2 --- /dev/null +++ b/FCKeditor/editor/filemanager/connectors/perl/upload.cgi @@ -0,0 +1,118 @@ +#!/usr/bin/env perl + +##### +# FCKeditor - The text editor for Internet - http://www.fckeditor.net +# Copyright (C) 2003-2007 Frederico Caldeira Knabben +# +# == BEGIN LICENSE == +# +# Licensed under the terms of any of the following licenses at your +# choice: +# +# - GNU General Public License Version 2 or later (the "GPL") +# http://www.gnu.org/licenses/gpl.html +# +# - GNU Lesser General Public License Version 2.1 or later (the "LGPL") +# http://www.gnu.org/licenses/lgpl.html +# +# - Mozilla Public License Version 1.1 or later (the "MPL") +# http://www.mozilla.org/MPL/MPL-1.1.html +# +# == END LICENSE == +# +# This is the File Manager Connector for Perl. +##### + +## +# ATTENTION: To enable this connector, look for the "SECURITY" comment in this file. +## + +## START: Hack for Windows (Not important to understand the editor code... Perl specific). +if(Windows_check()) { + chdir(GetScriptPath($0)); +} + +sub Windows_check +{ + # IIS,PWS(NT/95) + $www_server_os = $^O; + # Win98 & NT(SP4) + if($www_server_os eq "") { $www_server_os= $ENV{'OS'}; } + # AnHTTPd/Omni/IIS + if($ENV{'SERVER_SOFTWARE'} =~ /AnWeb|Omni|IIS\//i) { $www_server_os= 'win'; } + # Win Apache + if($ENV{'WINDIR'} ne "") { $www_server_os= 'win'; } + if($www_server_os=~ /win/i) { return(1); } + return(0); +} + +sub GetScriptPath { + local($path) = @_; + if($path =~ /[\:\/\\]/) { $path =~ s/(.*?)[\/\\][^\/\\]+$/$1/; } else { $path = '.'; } + $path; +} +## END: Hack for IIS + +require 'util.pl'; +require 'io.pl'; +require 'basexml.pl'; +require 'commands.pl'; +require 'upload_fck.pl'; + +## +# SECURITY: REMOVE/COMMENT THE FOLLOWING LINE TO ENABLE THIS CONNECTOR. +## + &SendUploadResults(1, '', '', 'This connector is disabled. Please check the "editor/filemanager/connectors/perl/upload.cgi" file' ) ; + + &read_input(); + + if($FORM{'ServerPath'} ne "") { + $GLOBALS{'UserFilesPath'} = $FORM{'ServerPath'}; + if(!($GLOBALS{'UserFilesPath'} =~ /\/$/)) { + $GLOBALS{'UserFilesPath'} .= '/' ; + } + } else { + $GLOBALS{'UserFilesPath'} = '/userfiles/'; + } + + # Map the "UserFiles" path to a local directory. + $rootpath = &GetRootPath(); + $GLOBALS{'UserFilesDirectory'} = $rootpath . $GLOBALS{'UserFilesPath'}; + + &DoResponse(); + +sub DoResponse +{ + # Get the main request information. + $sCommand = 'FileUpload'; #$FORM{'Command'}; + $sResourceType = $FORM{'Type'}; + $sCurrentFolder = $FORM{'CurrentFolder'}; + + if ($sResourceType eq '') { + $sResourceType = 'File' ; + } + if ($sCurrentFolder eq '') { + $sCurrentFolder = '/' ; + } + + # Check the current folder syntax (must begin and start with a slash). + if(!($sCurrentFolder =~ /\/$/)) { + $sCurrentFolder .= '/'; + } + if(!($sCurrentFolder =~ /^\//)) { + $sCurrentFolder = '/' . $sCurrentFolder; + } + + # Check for invalid folder paths (..) + if ( $sCurrentFolder =~ /\.\./ ) { + SendError( 102, "" ) ; + } + + # File Upload doesn't have to Return XML, so it must be intercepted before anything. + if($sCommand eq 'FileUpload') { + FileUpload($sResourceType,$sCurrentFolder); + return ; + } + +} + diff --git a/FCKeditor/editor/filemanager/connectors/perl/upload_fck.pl b/FCKeditor/editor/filemanager/connectors/perl/upload_fck.pl new file mode 100644 index 0000000..140b8ea --- /dev/null +++ b/FCKeditor/editor/filemanager/connectors/perl/upload_fck.pl @@ -0,0 +1,667 @@ +##### +# FCKeditor - The text editor for Internet - http://www.fckeditor.net +# Copyright (C) 2003-2007 Frederico Caldeira Knabben +# +# == BEGIN LICENSE == +# +# Licensed under the terms of any of the following licenses at your +# choice: +# +# - GNU General Public License Version 2 or later (the "GPL") +# http://www.gnu.org/licenses/gpl.html +# +# - GNU Lesser General Public License Version 2.1 or later (the "LGPL") +# http://www.gnu.org/licenses/lgpl.html +# +# - Mozilla Public License Version 1.1 or later (the "MPL") +# http://www.mozilla.org/MPL/MPL-1.1.html +# +# == END LICENSE == +# +# This is the File Manager Connector for Perl. +##### + +# image data save dir +$img_dir = './temp/'; + + +# File size max(unit KB) +$MAX_CONTENT_SIZE = 30000; + +# Filelock (1=use,0=not use) +$PM{'flock'} = '1'; + + +# upload Content-Type list +my %UPLOAD_CONTENT_TYPE_LIST = ( + 'image/(x-)?png' => 'png', # PNG image + 'image/p?jpe?g' => 'jpg', # JPEG image + 'image/gif' => 'gif', # GIF image + 'image/x-xbitmap' => 'xbm', # XBM image + + 'image/(x-(MS-)?)?bmp' => 'bmp', # Windows BMP image + 'image/pict' => 'pict', # Macintosh PICT image + 'image/tiff' => 'tif', # TIFF image + 'application/pdf' => 'pdf', # PDF image + 'application/x-shockwave-flash' => 'swf', # Shockwave Flash + + 'video/(x-)?msvideo' => 'avi', # Microsoft Video + 'video/quicktime' => 'mov', # QuickTime Video + 'video/mpeg' => 'mpeg', # MPEG Video + 'video/x-mpeg2' => 'mpv2', # MPEG2 Video + + 'audio/(x-)?midi?' => 'mid', # MIDI Audio + 'audio/(x-)?wav' => 'wav', # WAV Audio + 'audio/basic' => 'au', # ULAW Audio + 'audio/mpeg' => 'mpga', # MPEG Audio + + 'application/(x-)?zip(-compressed)?' => 'zip', # ZIP Compress + + 'text/html' => 'html', # HTML + 'text/plain' => 'txt', # TEXT + '(?:application|text)/(?:rtf|richtext)' => 'rtf', # RichText + + 'application/msword' => 'doc', # Microsoft Word + 'application/vnd.ms-excel' => 'xls', # Microsoft Excel + + '' +); + +# Upload is permitted. +# A regular expression is possible. +my %UPLOAD_EXT_LIST = ( + 'png' => 'PNG image', + 'p?jpe?g|jpe|jfif|pjp' => 'JPEG image', + 'gif' => 'GIF image', + 'xbm' => 'XBM image', + + 'bmp|dib|rle' => 'Windows BMP image', + 'pi?ct' => 'Macintosh PICT image', + 'tiff?' => 'TIFF image', + 'pdf' => 'PDF image', + 'swf' => 'Shockwave Flash', + + 'avi' => 'Microsoft Video', + 'moo?v|qt' => 'QuickTime Video', + 'm(p(e?gv?|e|v)|1v)' => 'MPEG Video', + 'mp(v2|2v)' => 'MPEG2 Video', + + 'midi?|kar|smf|rmi|mff' => 'MIDI Audio', + 'wav' => 'WAVE Audio', + 'au|snd' => 'ULAW Audio', + 'mp(e?ga|2|a|3)|abs' => 'MPEG Audio', + + 'zip' => 'ZIP Compress', + 'lzh' => 'LZH Compress', + 'cab' => 'CAB Compress', + + 'd?html?' => 'HTML', + 'rtf|rtx' => 'RichText', + 'txt|text' => 'Text', + + '' +); + + +# sjis or euc +my $CHARCODE = 'sjis'; + +$TRANS_2BYTE_CODE = 0; + +############################################################################## +# Summary +# +# Form Read input +# +# Parameters +# Returns +# Memo +############################################################################## +sub read_input +{ +eval("use File::Copy;"); +eval("use File::Path;"); + + my ($FORM) = @_; + + + mkdir($img_dir,0777); + chmod(0777,$img_dir); + + undef $img_data_exists; + undef @NEWFNAMES; + undef @NEWFNAME_DATA; + + if($ENV{'CONTENT_LENGTH'} > 10000000 || $ENV{'CONTENT_LENGTH'} > $MAX_CONTENT_SIZE * 1024) { + &upload_error( + 'Size Error', + sprintf( + "Transmitting size is too large.MAX %d KB Now Size %d KB(%d bytes Over)", + $MAX_CONTENT_SIZE, + int($ENV{'CONTENT_LENGTH'} / 1024), + $ENV{'CONTENT_LENGTH'} - $MAX_CONTENT_SIZE * 1024 + ) + ); + } + + my $Buffer; + if($ENV{'CONTENT_TYPE'} =~ /multipart\/form-data/) { + # METHOD POST only + return unless($ENV{'CONTENT_LENGTH'}); + + binmode(STDIN); + # STDIN A pause character is detected.'(MacIE3.0 boundary of $ENV{'CONTENT_TYPE'} cannot be trusted.) + my $Boundary = ; + $Boundary =~ s/\x0D\x0A//; + $Boundary = quotemeta($Boundary); + while() { + if(/^\s*Content-Disposition:/i) { + my($name,$ContentType,$FileName); + # form data get + if(/\bname="([^"]+)"/i || /\bname=([^\s:;]+)/i) { + $name = $1; + $name =~ tr/+/ /; + $name =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; + &Encode(\$name); + } + if(/\bfilename="([^"]*)"/i || /\bfilename=([^\s:;]*)/i) { + $FileName = $1 || 'unknown'; + } + # head read + while() { + last if(! /\w/); + if(/^\s*Content-Type:\s*"([^"]+)"/i || /^\s*Content-Type:\s*([^\s:;]+)/i) { + $ContentType = $1; + } + } + # body read + $value = ""; + while() { + last if(/^$Boundary/o); + $value .= $_; + }; + $lastline = $_; + $value =~s /\x0D\x0A$//; + if($value ne '') { + if($FileName || $ContentType) { + $img_data_exists = 1; + ( + $FileName, # + $Ext, # + $Length, # + $ImageWidth, # + $ImageHeight, # + $ContentName # + ) = &CheckContentType(\$value,$FileName,$ContentType); + + $FORM{$name} = $FileName; + $new_fname = $FileName; + push(@NEWFNAME_DATA,"$FileName\t$Ext\t$Length\t$ImageWidth\t$ImageHeight\t$ContentName"); + + # Multi-upload correspondence + push(@NEWFNAMES,$new_fname); + open(OUT,">$img_dir/$new_fname"); + binmode(OUT); + eval "flock(OUT,2);" if($PM{'flock'} == 1); + print OUT $value; + eval "flock(OUT,8);" if($PM{'flock'} == 1); + close(OUT); + + } elsif($name) { + $value =~ tr/+/ /; + $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; + &Encode(\$value,'trans'); + $FORM{$name} .= "\0" if(defined($FORM{$name})); + $FORM{$name} .= $value; + } + } + }; + last if($lastline =~ /^$Boundary\-\-/o); + } + } elsif($ENV{'CONTENT_LENGTH'}) { + read(STDIN,$Buffer,$ENV{'CONTENT_LENGTH'}); + } + foreach(split(/&/,$Buffer),split(/&/,$ENV{'QUERY_STRING'})) { + my($name, $value) = split(/=/); + $name =~ tr/+/ /; + $name =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; + $value =~ tr/+/ /; + $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; + + &Encode(\$name); + &Encode(\$value,'trans'); + $FORM{$name} .= "\0" if(defined($FORM{$name})); + $FORM{$name} .= $value; + + } + +} + +############################################################################## +# Summary +# +# CheckContentType +# +# Parameters +# Returns +# Memo +############################################################################## +sub CheckContentType +{ + + my($DATA,$FileName,$ContentType) = @_; + my($Ext,$ImageWidth,$ImageHeight,$ContentName,$Infomation); + my $DataLength = length($$DATA); + + # An unknown file type + + $_ = $ContentType; + my $UnknownType = ( + !$_ + || /^application\/(x-)?macbinary$/i + || /^application\/applefile$/i + || /^application\/octet-stream$/i + || /^text\/plane$/i + || /^x-unknown-content-type/i + ); + + # MacBinary(Mac Unnecessary data are deleted.) + if($UnknownType || $ENV{'HTTP_USER_AGENT'} =~ /Macintosh|Mac_/) { + if($DataLength > 128 && !unpack("C",substr($$DATA,0,1)) && !unpack("C",substr($$DATA,74,1)) && !unpack("C",substr($$DATA,82,1)) ) { + my $MacBinary_ForkLength = unpack("N", substr($$DATA, 83, 4)); # ForkLength Get + my $MacBinary_FileName = quotemeta(substr($$DATA, 2, unpack("C",substr($$DATA, 1, 1)))); + if($MacBinary_FileName && $MacBinary_ForkLength && $DataLength >= $MacBinary_ForkLength + 128 + && ($FileName =~ /$MacBinary_FileName/i || substr($$DATA,102,4) eq 'mBIN')) { # DATA TOP 128byte MacBinary!! + $$DATA = substr($$DATA,128,$MacBinary_ForkLength); + my $ResourceLength = $DataLength - $MacBinary_ForkLength - 128; + $DataLength = $MacBinary_ForkLength; + } + } + } + + # A file name is changed into EUC. +# &jcode::convert(\$FileName,'euc',$FormCodeDefault); +# &jcode::h2z_euc(\$FileName); + $FileName =~ s/^.*\\//; # Windows, Mac + $FileName =~ s/^.*\///; # UNIX + $FileName =~ s/&/&/g; + $FileName =~ s/"/"/g; + $FileName =~ s//>/g; +# +# if($CHARCODE ne 'euc') { +# &jcode::convert(\$FileName,$CHARCODE,'euc'); +# } + + # An extension is extracted and it changes into a small letter. + my $FileExt; + if($FileName =~ /\.(\w+)$/) { + $FileExt = $1; + $FileExt =~ tr/A-Z/a-z/; + } + + # Executable file detection (ban on upload) + if($$DATA =~ /^MZ/) { + $Ext = 'exe'; + } + # text + if(!$Ext && ($UnknownType || $ContentType =~ /^text\//i || $ContentType =~ /^application\/(?:rtf|richtext)$/i || $ContentType =~ /^image\/x-xbitmap$/i) + && ! $$DATA =~ /[\000-\006\177\377]/) { +# $$DATA =~ s/\x0D\x0A/\n/g; +# $$DATA =~ tr/\x0D\x0A/\n\n/; +# +# if( +# $$DATA =~ /<\s*SCRIPT(?:.|\n)*?>/i +# || $$DATA =~ /<\s*(?:.|\n)*?\bONLOAD\s*=(?:.|\n)*?>/i +# || $$DATA =~ /<\s*(?:.|\n)*?\bONCLICK\s*=(?:.|\n)*?>/i +# ) { +# $Infomation = '(JavaScript contains)'; +# } +# if($$DATA =~ /<\s*TABLE(?:.|\n)*?>/i +# || $$DATA =~ /<\s*BLINK(?:.|\n)*?>/i +# || $$DATA =~ /<\s*MARQUEE(?:.|\n)*?>/i +# || $$DATA =~ /<\s*OBJECT(?:.|\n)*?>/i +# || $$DATA =~ /<\s*EMBED(?:.|\n)*?>/i +# || $$DATA =~ /<\s*FRAME(?:.|\n)*?>/i +# || $$DATA =~ /<\s*APPLET(?:.|\n)*?>/i +# || $$DATA =~ /<\s*FORM(?:.|\n)*?>/i +# || $$DATA =~ /<\s*(?:.|\n)*?\bSRC\s*=(?:.|\n)*?>/i +# || $$DATA =~ /<\s*(?:.|\n)*?\bDYNSRC\s*=(?:.|\n)*?>/i +# ) { +# $Infomation = '(the HTML tag which is not safe is included)'; +# } + + if($FileExt =~ /^txt$/i || $FileExt =~ /^cgi$/i || $FileExt =~ /^pl$/i) { # Text File + $Ext = 'txt'; + } elsif($ContentType =~ /^text\/html$/i || $FileExt =~ /html?/i || $$DATA =~ /<\s*HTML(?:.|\n)*?>/i) { # HTML File + $Ext = 'html'; + } elsif($ContentType =~ /^image\/x-xbitmap$/i || $FileExt =~ /^xbm$/i) { # XBM(x-BitMap) Image + my $XbmName = $1; + my ($XbmWidth, $XbmHeight); + if($$DATA =~ /\#define\s*$XbmName\_width\s*(\d+)/i) { + $XbmWidth = $1; + } + if($$DATA =~ /\#define\s*$XbmName\_height\s*(\d+)/i) { + $XbmHeight = $1; + } + if($XbmWidth && $XbmHeight) { + $Ext = 'xbm'; + $ImageWidth = $XbmWidth; + $ImageHeight = $XbmHeight; + } + } else { # + $Ext = 'txt'; + } + } + + # image + if(!$Ext && ($UnknownType || $ContentType =~ /^image\//i)) { + # PNG + if($$DATA =~ /^\x89PNG\x0D\x0A\x1A\x0A/) { + if(substr($$DATA, 12, 4) eq 'IHDR') { + $Ext = 'png'; + ($ImageWidth, $ImageHeight) = unpack("N2", substr($$DATA, 16, 8)); + } + } elsif($$DATA =~ /^GIF8(?:9|7)a/) { # GIF89a(modified), GIF89a, GIF87a + $Ext = 'gif'; + ($ImageWidth, $ImageHeight) = unpack("v2", substr($$DATA, 6, 4)); + } elsif($$DATA =~ /^II\x2a\x00\x08\x00\x00\x00/ || $$DATA =~ /^MM\x00\x2a\x00\x00\x00\x08/) { # TIFF + $Ext = 'tif'; + } elsif($$DATA =~ /^BM/) { # BMP + $Ext = 'bmp'; + } elsif($$DATA =~ /^\xFF\xD8\xFF/ || $$DATA =~ /JFIF/) { # JPEG + my $HeaderPoint = index($$DATA, "\xFF\xD8\xFF", 0); + my $Point = $HeaderPoint + 2; + while($Point < $DataLength) { + my($Maker, $MakerType, $MakerLength) = unpack("C2n",substr($$DATA,$Point,4)); + if($Maker != 0xFF || $MakerType == 0xd9 || $MakerType == 0xda) { + last; + } elsif($MakerType >= 0xC0 && $MakerType <= 0xC3) { + $Ext = 'jpg'; + ($ImageHeight, $ImageWidth) = unpack("n2", substr($$DATA, $Point + 5, 4)); + if($HeaderPoint > 0) { + $$DATA = substr($$DATA, $HeaderPoint); + $DataLength = length($$DATA); + } + last; + } else { + $Point += $MakerLength + 2; + } + } + } + } + + # audio + if(!$Ext && ($UnknownType || $ContentType =~ /^audio\//i)) { + # MIDI Audio + if($$DATA =~ /^MThd/) { + $Ext = 'mid'; + } elsif($$DATA =~ /^\x2esnd/) { # ULAW Audio + $Ext = 'au'; + } elsif($$DATA =~ /^RIFF/ || $$DATA =~ /^ID3/ && $$DATA =~ /RIFF/) { + my $HeaderPoint = index($$DATA, "RIFF", 0); + $_ = substr($$DATA, $HeaderPoint + 8, 8); + if(/^WAVEfmt $/) { + # WAVE + if(unpack("V",substr($$DATA, $HeaderPoint + 16, 4)) == 16) { + $Ext = 'wav'; + } else { # RIFF WAVE MP3 + $Ext = 'mp3'; + } + } elsif(/^RMIDdata$/) { # RIFF MIDI + $Ext = 'rmi'; + } elsif(/^RMP3data$/) { # RIFF MP3 + $Ext = 'rmp'; + } + if($ContentType =~ /^audio\//i) { + $Infomation .= '(RIFF '. substr($$DATA, $HeaderPoint + 8, 4). ')'; + } + } + } + + # a binary file + unless ($Ext) { + # PDF image + if($$DATA =~ /^\%PDF/) { + # Picture size is not measured. + $Ext = 'pdf'; + } elsif($$DATA =~ /^FWS/) { # Shockwave Flash + $Ext = 'swf'; + } elsif($$DATA =~ /^RIFF/ || $$DATA =~ /^ID3/ && $$DATA =~ /RIFF/) { + my $HeaderPoint = index($$DATA, "RIFF", 0); + $_ = substr($$DATA,$HeaderPoint + 8, 8); + # AVI + if(/^AVI LIST$/) { + $Ext = 'avi'; + } + if($ContentType =~ /^video\//i) { + $Infomation .= '(RIFF '. substr($$DATA, $HeaderPoint + 8, 4). ')'; + } + } elsif($$DATA =~ /^PK/) { # ZIP Compress File + $Ext = 'zip'; + } elsif($$DATA =~ /^MSCF/) { # CAB Compress File + $Ext = 'cab'; + } elsif($$DATA =~ /^Rar\!/) { # RAR Compress File + $Ext = 'rar'; + } elsif(substr($$DATA, 2, 5) =~ /^\-lh(\d+|d)\-$/) { # LHA Compress File + $Infomation .= "(lh$1)"; + $Ext = 'lzh'; + } elsif(substr($$DATA, 325, 25) eq "Apple Video Media Handler" || substr($$DATA, 325, 30) eq "Apple \x83\x72\x83\x66\x83\x49\x81\x45\x83\x81\x83\x66\x83\x42\x83\x41\x83\x6E\x83\x93\x83\x68\x83\x89") { + # QuickTime + $Ext = 'mov'; + } + } + + # Header analysis failure + unless ($Ext) { + # It will be followed if it applies for the MIME type from the browser. + foreach (keys %UPLOAD_CONTENT_TYPE_LIST) { + next unless ($_); + if($ContentType =~ /^$_$/i) { + $Ext = $UPLOAD_CONTENT_TYPE_LIST{$_}; + $ContentName = &CheckContentExt($Ext); + if( + grep {$_ eq $Ext;} ( + 'png', + 'gif', + 'jpg', + 'xbm', + 'tif', + 'bmp', + 'pdf', + 'swf', + 'mov', + 'zip', + 'cab', + 'lzh', + 'rar', + 'mid', + 'rmi', + 'au', + 'wav', + 'avi', + 'exe' + ) + ) { + $Infomation .= ' / Header analysis failure'; + } + if($Ext ne $FileExt && &CheckContentExt($FileExt) eq $ContentName) { + $Ext = $FileExt; + } + last; + } + } + # a MIME type is unknown--It judges from an extension. + unless ($Ext) { + $ContentName = &CheckContentExt($FileExt); + if($ContentName) { + $Ext = $FileExt; + $Infomation .= ' / MIME type is unknown('. $ContentType. ')'; + last; + } + } + } + +# $ContentName = &CheckContentExt($Ext) unless($ContentName); +# if($Ext && $ContentName) { +# $ContentName .= $Infomation; +# } else { +# &upload_error( +# 'Extension Error', +# "$FileName A not corresponding extension ($Ext)
The extension which can be responded ". join(',', sort values(%UPLOAD_EXT_LIST)) +# ); +# } + +# # SSI Tag Deletion +# if($Ext =~ /.?html?/ && $$DATA =~ /<\!/) { +# foreach ( +# 'config', +# 'echo', +# 'exec', +# 'flastmod', +# 'fsize', +# 'include' +# ) { +# $$DATA =~ s/\#\s*$_/\&\#35\;$_/ig +# } +# } + + return ( + $FileName, + $Ext, + int($DataLength / 1024 + 1), + $ImageWidth, + $ImageHeight, + $ContentName + ); +} + +############################################################################## +# Summary +# +# Extension discernment +# +# Parameters +# Returns +# Memo +############################################################################## + +sub CheckContentExt +{ + + my($Ext) = @_; + my $ContentName; + foreach (keys %UPLOAD_EXT_LIST) { + next unless ($_); + if($_ && $Ext =~ /^$_$/) { + $ContentName = $UPLOAD_EXT_LIST{$_}; + last; + } + } + return $ContentName; + +} + +############################################################################## +# Summary +# +# Form decode +# +# Parameters +# Returns +# Memo +############################################################################## +sub Encode +{ + + my($value,$Trans) = @_; + +# my $FormCode = &jcode::getcode($value) || $FormCodeDefault; +# $FormCodeDefault ||= $FormCode; +# +# if($Trans && $TRANS_2BYTE_CODE) { +# if($FormCode ne 'euc') { +# &jcode::convert($value, 'euc', $FormCode); +# } +# &jcode::tr( +# $value, +# "\xA3\xB0-\xA3\xB9\xA3\xC1-\xA3\xDA\xA3\xE1-\xA3\xFA", +# '0-9A-Za-z' +# ); +# if($CHARCODE ne 'euc') { +# &jcode::convert($value,$CHARCODE,'euc'); +# } +# } else { +# if($CHARCODE ne $FormCode) { +# &jcode::convert($value,$CHARCODE,$FormCode); +# } +# } +# if($CHARCODE eq 'euc') { +# &jcode::h2z_euc($value); +# } elsif($CHARCODE eq 'sjis') { +# &jcode::h2z_sjis($value); +# } + +} + +############################################################################## +# Summary +# +# Error Msg +# +# Parameters +# Returns +# Memo +############################################################################## + +sub upload_error +{ + + local($error_message) = $_[0]; + local($error_message2) = $_[1]; + + print "Content-type: text/html\n\n"; + print< + +Error Message + + + + + +
Error Message
+
    +

    $error_message

    +$error_message2
    +
+ + +EOF + &rm_tmp_uploaded_files; # Image Temporary deletion + exit; +} + +############################################################################## +# Summary +# +# Image Temporary deletion +# +# Parameters +# Returns +# Memo +############################################################################## + +sub rm_tmp_uploaded_files +{ + if($img_data_exists == 1){ + sleep 1; + foreach $fname_list(@NEWFNAMES) { + if(-e "$img_dir/$fname_list") { + unlink("$img_dir/$fname_list"); + } + } + } + +} +1; diff --git a/FCKeditor/editor/filemanager/connectors/perl/util.pl b/FCKeditor/editor/filemanager/connectors/perl/util.pl new file mode 100644 index 0000000..f635be1 --- /dev/null +++ b/FCKeditor/editor/filemanager/connectors/perl/util.pl @@ -0,0 +1,68 @@ +##### +# FCKeditor - The text editor for Internet - http://www.fckeditor.net +# Copyright (C) 2003-2007 Frederico Caldeira Knabben +# +# == BEGIN LICENSE == +# +# Licensed under the terms of any of the following licenses at your +# choice: +# +# - GNU General Public License Version 2 or later (the "GPL") +# http://www.gnu.org/licenses/gpl.html +# +# - GNU Lesser General Public License Version 2.1 or later (the "LGPL") +# http://www.gnu.org/licenses/lgpl.html +# +# - Mozilla Public License Version 1.1 or later (the "MPL") +# http://www.mozilla.org/MPL/MPL-1.1.html +# +# == END LICENSE == +# +# This is the File Manager Connector for Perl. +##### + +sub RemoveFromStart +{ + local($sourceString, $charToRemove) = @_; + $sPattern = '^' . $charToRemove . '+' ; + $sourceString =~ s/^$charToRemove+//g; + return $sourceString; +} + +sub RemoveFromEnd +{ + local($sourceString, $charToRemove) = @_; + $sPattern = $charToRemove . '+$' ; + $sourceString =~ s/$charToRemove+$//g; + return $sourceString; +} + +sub ConvertToXmlAttribute +{ + local($value) = @_; + return $value; +# return utf8_encode(htmlspecialchars($value)); + +} + +sub specialchar_cnv +{ + local($ch) = @_; + + $ch =~ s/&/&/g; # & + $ch =~ s/\"/"/g; #" + $ch =~ s/\'/'/g; # ' + $ch =~ s//>/g; # > + return($ch); +} + +sub JS_cnv +{ + local($ch) = @_; + + $ch =~ s/\"/\\\"/g; #" + return($ch); +} + +1; diff --git a/FCKeditor/editor/filemanager/connectors/php/basexml.php b/FCKeditor/editor/filemanager/connectors/php/basexml.php new file mode 100644 index 0000000..7968cc3 --- /dev/null +++ b/FCKeditor/editor/filemanager/connectors/php/basexml.php @@ -0,0 +1,93 @@ +' ; + + // Create the main "Connector" node. + echo '' ; + + // Add the current folder node. + echo '' ; + + $GLOBALS['HeaderSent'] = true ; +} + +function CreateXmlFooter() +{ + echo '' ; +} + +function SendError( $number, $text ) +{ + if ( isset( $GLOBALS['HeaderSent'] ) && $GLOBALS['HeaderSent'] ) + { + SendErrorNode( $number, $text ) ; + CreateXmlFooter() ; + } + else + { + SetXmlHeaders() ; + + // Create the XML document header + echo '' ; + + echo '' ; + + SendErrorNode( $number, $text ) ; + + echo '' ; + } + exit ; +} + +function SendErrorNode( $number, $text ) +{ + echo '' ; +} +?> \ No newline at end of file diff --git a/FCKeditor/editor/filemanager/connectors/php/commands.php b/FCKeditor/editor/filemanager/connectors/php/commands.php new file mode 100644 index 0000000..f8efdfc --- /dev/null +++ b/FCKeditor/editor/filemanager/connectors/php/commands.php @@ -0,0 +1,245 @@ +' ; + } + + closedir( $oCurrentFolder ) ; + + // Open the "Folders" node. + echo "" ; + + natcasesort( $aFolders ) ; + foreach ( $aFolders as $sFolder ) + echo $sFolder ; + + // Close the "Folders" node. + echo "" ; +} + +function GetFoldersAndFiles( $resourceType, $currentFolder ) +{ + // Map the virtual path to the local server path. + $sServerDir = ServerMapFolder( $resourceType, $currentFolder, 'GetFoldersAndFiles' ) ; + + // Arrays that will hold the folders and files names. + $aFolders = array() ; + $aFiles = array() ; + + $oCurrentFolder = opendir( $sServerDir ) ; + + while ( $sFile = readdir( $oCurrentFolder ) ) + { + if ( $sFile != '.' && $sFile != '..' ) + { + if ( is_dir( $sServerDir . $sFile ) ) + $aFolders[] = '' ; + else + { + $iFileSize = @filesize( $sServerDir . $sFile ) ; + if ( !$iFileSize ) { + $iFileSize = 0 ; + } + if ( $iFileSize > 0 ) + { + $iFileSize = round( $iFileSize / 1024 ) ; + if ( $iFileSize < 1 ) $iFileSize = 1 ; + } + + $aFiles[] = '' ; + } + } + } + + // Send the folders + natcasesort( $aFolders ) ; + echo '' ; + + foreach ( $aFolders as $sFolder ) + echo $sFolder ; + + echo '' ; + + // Send the files + natcasesort( $aFiles ) ; + echo '' ; + + foreach ( $aFiles as $sFiles ) + echo $sFiles ; + + echo '' ; +} + +function CreateFolder( $resourceType, $currentFolder ) +{ + if (!isset($_GET)) { + global $_GET; + } + $sErrorNumber = '0' ; + $sErrorMsg = '' ; + + if ( isset( $_GET['NewFolderName'] ) ) + { + $sNewFolderName = $_GET['NewFolderName'] ; + $sNewFolderName = SanitizeFolderName( $sNewFolderName ) ; + + if ( strpos( $sNewFolderName, '..' ) !== FALSE ) + $sErrorNumber = '102' ; // Invalid folder name. + else + { + // Map the virtual path to the local server path of the current folder. + $sServerDir = ServerMapFolder( $resourceType, $currentFolder, 'CreateFolder' ) ; + + if ( is_writable( $sServerDir ) ) + { + $sServerDir .= $sNewFolderName ; + + $sErrorMsg = CreateServerFolder( $sServerDir ) ; + + switch ( $sErrorMsg ) + { + case '' : + $sErrorNumber = '0' ; + break ; + case 'Invalid argument' : + case 'No such file or directory' : + $sErrorNumber = '102' ; // Path too long. + break ; + default : + $sErrorNumber = '110' ; + break ; + } + } + else + $sErrorNumber = '103' ; + } + } + else + $sErrorNumber = '102' ; + + // Create the "Error" node. + echo '' ; +} + +function FileUpload( $resourceType, $currentFolder, $sCommand ) +{ + if (!isset($_FILES)) { + global $_FILES; + } + $sErrorNumber = '0' ; + $sFileName = '' ; + + if ( isset( $_FILES['NewFile'] ) && !is_null( $_FILES['NewFile']['tmp_name'] ) ) + { + global $Config ; + + $oFile = $_FILES['NewFile'] ; + + // Map the virtual path to the local server path. + $sServerDir = ServerMapFolder( $resourceType, $currentFolder, $sCommand ) ; + + // Get the uploaded file name. + $sFileName = $oFile['name'] ; + $sFileName = SanitizeFileName( $sFileName ) ; + + $sOriginalFileName = $sFileName ; + + // Get the extension. + $sExtension = substr( $sFileName, ( strrpos($sFileName, '.') + 1 ) ) ; + $sExtension = strtolower( $sExtension ) ; + + if ( isset( $Config['SecureImageUploads'] ) ) + { + if ( !IsImageValid( $oFile['tmp_name'], $sExtension ) ) + { + $sErrorNumber = '202' ; + } + } + + if ( isset( $Config['HtmlExtensions'] ) ) + { + if ( !IsHtmlExtension( $sExtension, $Config['HtmlExtensions'] ) && DetectHtml( $oFile['tmp_name'] ) ) + { + $sErrorNumber = '202' ; + } + } + + // Check if it is an allowed extension. + if ( !$sErrorNumber && IsAllowedExt( $sExtension, $resourceType ) ) + { + $iCounter = 0 ; + + while ( true ) + { + $sFilePath = $sServerDir . $sFileName ; + + if ( is_file( $sFilePath ) ) + { + $iCounter++ ; + $sFileName = RemoveExtension( $sOriginalFileName ) . '(' . $iCounter . ').' . $sExtension ; + $sErrorNumber = '201' ; + } + else + { + move_uploaded_file( $oFile['tmp_name'], $sFilePath ) ; + + if ( is_file( $sFilePath ) ) + { + $oldumask = umask(0) ; + chmod( $sFilePath, 0777 ) ; + umask( $oldumask ) ; + } + + break ; + } + } + } + else + $sErrorNumber = '202' ; + } + else + $sErrorNumber = '202' ; + + + $sFileUrl = CombinePaths( GetResourceTypePath( $resourceType, $sCommand ) , $currentFolder ) ; + $sFileUrl = CombinePaths( $sFileUrl, $sFileName ) ; + + SendUploadResults( $sErrorNumber, $sFileUrl, $sFileName ) ; + + exit ; +} +?> \ No newline at end of file diff --git a/FCKeditor/editor/filemanager/connectors/php/config.php b/FCKeditor/editor/filemanager/connectors/php/config.php new file mode 100644 index 0000000..d1d27ee --- /dev/null +++ b/FCKeditor/editor/filemanager/connectors/php/config.php @@ -0,0 +1,140 @@ + diff --git a/FCKeditor/editor/filemanager/connectors/php/connector.php b/FCKeditor/editor/filemanager/connectors/php/connector.php new file mode 100644 index 0000000..15c9c0d --- /dev/null +++ b/FCKeditor/editor/filemanager/connectors/php/connector.php @@ -0,0 +1,87 @@ + \ No newline at end of file diff --git a/FCKeditor/editor/filemanager/connectors/php/io.php b/FCKeditor/editor/filemanager/connectors/php/io.php new file mode 100644 index 0000000..c3b7af6 --- /dev/null +++ b/FCKeditor/editor/filemanager/connectors/php/io.php @@ -0,0 +1,272 @@ + 0 ) + return $Config['QuickUploadAbsolutePath'][$resourceType] ; + + // Map the "UserFiles" path to a local directory. + return Server_MapPath( $Config['QuickUploadPath'][$resourceType] ) ; + } + else + { + if ( strlen( $Config['FileTypesAbsolutePath'][$resourceType] ) > 0 ) + return $Config['FileTypesAbsolutePath'][$resourceType] ; + + // Map the "UserFiles" path to a local directory. + return Server_MapPath( $Config['FileTypesPath'][$resourceType] ) ; + } +} + +function GetUrlFromPath( $resourceType, $folderPath, $sCommand ) +{ + return CombinePaths( GetResourceTypePath( $resourceType, $sCommand ), $folderPath ) ; +} + +function RemoveExtension( $fileName ) +{ + return substr( $fileName, 0, strrpos( $fileName, '.' ) ) ; +} + +function ServerMapFolder( $resourceType, $folderPath, $sCommand ) +{ + // Get the resource type directory. + $sResourceTypePath = GetResourceTypeDirectory( $resourceType, $sCommand ) ; + + // Ensure that the directory exists. + $sErrorMsg = CreateServerFolder( $sResourceTypePath ) ; + if ( $sErrorMsg != '' ) + SendError( 1, "Error creating folder \"{$sResourceTypePath}\" ({$sErrorMsg})" ) ; + + // Return the resource type directory combined with the required path. + return CombinePaths( $sResourceTypePath , $folderPath ) ; +} + +function GetParentFolder( $folderPath ) +{ + $sPattern = "-[/\\\\][^/\\\\]+[/\\\\]?$-" ; + return preg_replace( $sPattern, '', $folderPath ) ; +} + +function CreateServerFolder( $folderPath, $lastFolder = null ) +{ + $sParent = GetParentFolder( $folderPath ) ; + + // Ensure the folder path has no double-slashes, or mkdir may fail on certain platforms + while ( strpos($folderPath, '//') !== false ) + { + $folderPath = str_replace( '//', '/', $folderPath ) ; + } + + // Check if the parent exists, or create it. + if ( !file_exists( $sParent ) ) + { + //prevents agains infinite loop when we can't create root folder + if ( !is_null( $lastFolder ) && $lastFolder === $sParent) { + return "Can't create $folderPath directory" ; + } + + $sErrorMsg = CreateServerFolder( $sParent, $folderPath ) ; + if ( $sErrorMsg != '' ) + return $sErrorMsg ; + } + + if ( !file_exists( $folderPath ) ) + { + // Turn off all error reporting. + error_reporting( 0 ) ; + + $php_errormsg = '' ; + // Enable error tracking to catch the error. + ini_set( 'track_errors', '1' ) ; + + // To create the folder with 0777 permissions, we need to set umask to zero. + $oldumask = umask(0) ; + mkdir( $folderPath, 0777 ) ; + umask( $oldumask ) ; + + $sErrorMsg = $php_errormsg ; + + // Restore the configurations. + ini_restore( 'track_errors' ) ; + ini_restore( 'error_reporting' ) ; + + return $sErrorMsg ; + } + else + return '' ; +} + +function GetRootPath() +{ + if (!isset($_SERVER)) { + global $_SERVER; + } + $sRealPath = realpath( './' ) ; + + $sSelfPath = $_SERVER['PHP_SELF'] ; + $sSelfPath = substr( $sSelfPath, 0, strrpos( $sSelfPath, '/' ) ) ; + + $sSelfPath = str_replace( '/', DIRECTORY_SEPARATOR, $sSelfPath ) ; + + $position = strpos( $sRealPath, $sSelfPath ) ; + + // This can check only that this script isn't run from a virtual dir + // But it avoids the problems that arise if it isn't checked + if ( $position === false || $position <> strlen( $sRealPath ) - strlen( $sSelfPath ) ) + SendError( 1, 'Sorry, can\'t map "UserFilesPath" to a physical path. You must set the "UserFilesAbsolutePath" value in "editor/filemanager/connectors/php/config.php".' ) ; + + return substr( $sRealPath, 0, $position ) ; +} + +// Emulate the asp Server.mapPath function. +// given an url path return the physical directory that it corresponds to +function Server_MapPath( $path ) +{ + // This function is available only for Apache + if ( function_exists( 'apache_lookup_uri' ) ) + { + $info = apache_lookup_uri( $path ) ; + return $info->filename . $info->path_info ; + } + + // This isn't correct but for the moment there's no other solution + // If this script is under a virtual directory or symlink it will detect the problem and stop + return GetRootPath() . $path ; +} + +function IsAllowedExt( $sExtension, $resourceType ) +{ + global $Config ; + // Get the allowed and denied extensions arrays. + $arAllowed = $Config['AllowedExtensions'][$resourceType] ; + $arDenied = $Config['DeniedExtensions'][$resourceType] ; + + if ( count($arAllowed) > 0 && !in_array( $sExtension, $arAllowed ) ) + return false ; + + if ( count($arDenied) > 0 && in_array( $sExtension, $arDenied ) ) + return false ; + + return true ; +} + +function IsAllowedType( $resourceType ) +{ + global $Config ; + if ( !in_array( $resourceType, $Config['ConfigAllowedTypes'] ) ) + return false ; + + return true ; +} + +function IsAllowedCommand( $sCommand ) +{ + global $Config ; + + if ( !in_array( $sCommand, $Config['ConfigAllowedCommands'] ) ) + return false ; + + return true ; +} + +function GetCurrentFolder() +{ + if (!isset($_GET)) { + global $_GET; + } + $sCurrentFolder = isset( $_GET['CurrentFolder'] ) ? $_GET['CurrentFolder'] : '/' ; + + // Check the current folder syntax (must begin and start with a slash). + if ( ! ereg( '/$', $sCurrentFolder ) ) $sCurrentFolder .= '/' ; + if ( strpos( $sCurrentFolder, '/' ) !== 0 ) $sCurrentFolder = '/' . $sCurrentFolder ; + + // Ensure the folder path has no double-slashes + while ( strpos ($sCurrentFolder, '//') !== false ) { + $sCurrentFolder = str_replace ('//', '/', $sCurrentFolder) ; + } + + // Check for invalid folder paths (..) + if ( strpos( $sCurrentFolder, '..' ) ) + SendError( 102, '' ) ; + + return $sCurrentFolder ; +} + +// Do a cleanup of the folder name to avoid possible problems +function SanitizeFolderName( $sNewFolderName ) +{ + $sNewFolderName = stripslashes( $sNewFolderName ) ; + + // Remove . \ / | : ? * " < > + $sNewFolderName = preg_replace( '/\\.|\\\\|\\/|\\||\\:|\\?|\\*|"|<|>/', '_', $sNewFolderName ) ; + + return $sNewFolderName ; +} + +// Do a cleanup of the file name to avoid possible problems +function SanitizeFileName( $sNewFileName ) +{ + global $Config ; + + $sNewFileName = stripslashes( $sNewFileName ) ; + + // Replace dots in the name with underscores (only one dot can be there... security issue). + if ( $Config['ForceSingleExtension'] ) + $sNewFileName = preg_replace( '/\\.(?![^.]*$)/', '_', $sNewFileName ) ; + + // Remove \ / | : ? * " < > + $sNewFileName = preg_replace( '/\\\\|\\/|\\||\\:|\\?|\\*|"|<|>/', '_', $sNewFileName ) ; + + return $sNewFileName ; +} + +// This is the function that sends the results of the uploading process. +function SendUploadResults( $errorNumber, $fileUrl = '', $fileName = '', $customMsg = '' ) +{ + echo '' ; + exit ; +} + +?> \ No newline at end of file diff --git a/FCKeditor/editor/filemanager/connectors/php/phpcompat.php b/FCKeditor/editor/filemanager/connectors/php/phpcompat.php new file mode 100644 index 0000000..9a25539 --- /dev/null +++ b/FCKeditor/editor/filemanager/connectors/php/phpcompat.php @@ -0,0 +1,17 @@ + \ No newline at end of file diff --git a/FCKeditor/editor/filemanager/connectors/php/util.php b/FCKeditor/editor/filemanager/connectors/php/util.php new file mode 100644 index 0000000..0ce34ea --- /dev/null +++ b/FCKeditor/editor/filemanager/connectors/php/util.php @@ -0,0 +1,185 @@ + $val ) + { + $lcaseHtmlExtensions[$key] = strtolower( $val ) ; + } + return in_array( $ext, $lcaseHtmlExtensions ) ; +} + +/** + * Detect HTML in the first KB to prevent against potential security issue with + * IE/Safari/Opera file type auto detection bug. + * Returns true if file contain insecure HTML code at the beginning. + * + * @param string $filePath absolute path to file + * @return boolean + */ +function DetectHtml( $filePath ) +{ + $fp = fopen( $filePath, 'rb' ) ; + $chunk = fread( $fp, 1024 ) ; + fclose( $fp ) ; + + $chunk = strtolower( $chunk ) ; + + if (!$chunk) + { + return false ; + } + + $chunk = trim( $chunk ) ; + + if ( preg_match( "/= 4.0.7 + if ( function_exists( 'version_compare' ) ) { + $sCurrentVersion = phpversion(); + if ( version_compare( $sCurrentVersion, "4.2.0" ) >= 0 ) { + $imageCheckExtensions[] = "tiff"; + $imageCheckExtensions[] = "tif"; + } + if ( version_compare( $sCurrentVersion, "4.3.0" ) >= 0 ) { + $imageCheckExtensions[] = "swc"; + } + if ( version_compare( $sCurrentVersion, "4.3.2" ) >= 0 ) { + $imageCheckExtensions[] = "jpc"; + $imageCheckExtensions[] = "jp2"; + $imageCheckExtensions[] = "jpx"; + $imageCheckExtensions[] = "jb2"; + $imageCheckExtensions[] = "xbm"; + $imageCheckExtensions[] = "wbmp"; + } + } + + if ( !in_array( $extension, $imageCheckExtensions ) ) { + return true; + } + + if ( @getimagesize( $filePath ) === false ) { + return false ; + } + + return true; +} + +?> \ No newline at end of file diff --git a/FCKeditor/editor/filemanager/connectors/py/config.py b/FCKeditor/editor/filemanager/connectors/py/config.py new file mode 100644 index 0000000..0240c36 --- /dev/null +++ b/FCKeditor/editor/filemanager/connectors/py/config.py @@ -0,0 +1,135 @@ +#!/usr/bin/env python +""" + * FCKeditor - The text editor for Internet - http://www.fckeditor.net + * Copyright (C) 2003-2007 Frederico Caldeira Knabben + * + * == BEGIN LICENSE == + * + * Licensed under the terms of any of the following licenses at your + * choice: + * + * - GNU General Public License Version 2 or later (the "GPL") + * http://www.gnu.org/licenses/gpl.html + * + * - GNU Lesser General Public License Version 2.1 or later (the "LGPL") + * http://www.gnu.org/licenses/lgpl.html + * + * - Mozilla Public License Version 1.1 or later (the "MPL") + * http://www.mozilla.org/MPL/MPL-1.1.html + * + * == END LICENSE == + * + * Configuration file for the File Manager Connector for Python +""" + +# INSTALLATION NOTE: You must set up your server environment accordingly to run +# python scripts. This connector requires Python 2.4 or greater. +# +# Supported operation modes: +# * WSGI (recommended): You'll need apache + mod_python + modpython_gateway +# or any web server capable of the WSGI python standard +# * Plain Old CGI: Any server capable of running standard python scripts +# (although mod_python is recommended for performance) +# This was the previous connector version operation mode +# +# If you're using Apache web server, replace the htaccess.txt to to .htaccess, +# and set the proper options and paths. +# For WSGI and mod_python, you may need to download modpython_gateway from: +# http://projects.amor.org/misc/svn/modpython_gateway.py and copy it in this +# directory. + + +# SECURITY: You must explicitly enable this "connector". (Set it to "True"). +# WARNING: don't just set "ConfigIsEnabled = True", you must be sure that only +# authenticated users can access this file or use some kind of session checking. +Enabled = False + +# Path to user files relative to the document root. +UserFilesPath = '/userfiles/' + +# Fill the following value it you prefer to specify the absolute path for the +# user files directory. Useful if you are using a virtual directory, symbolic +# link or alias. Examples: 'C:\\MySite\\userfiles\\' or '/root/mysite/userfiles/'. +# Attention: The above 'UserFilesPath' must point to the same directory. +# WARNING: GetRootPath may not work in virtual or mod_python configurations, and +# may not be thread safe. Use this configuration parameter instead. +UserFilesAbsolutePath = '' + +# Due to security issues with Apache modules, it is recommended to leave the +# following setting enabled. +ForceSingleExtension = True + +# What the user can do with this connector +ConfigAllowedCommands = [ 'QuickUpload', 'FileUpload', 'GetFolders', 'GetFoldersAndFiles', 'CreateFolder' ] + +# Allowed Resource Types +ConfigAllowedTypes = ['File', 'Image', 'Flash', 'Media'] + +# Do not touch this 3 lines, see "Configuration settings for each Resource Type" +AllowedExtensions = {}; DeniedExtensions = {}; +FileTypesPath = {}; FileTypesAbsolutePath = {}; +QuickUploadPath = {}; QuickUploadAbsolutePath = {}; + +# Configuration settings for each Resource Type +# +# - AllowedExtensions: the possible extensions that can be allowed. +# If it is empty then any file type can be uploaded. +# - DeniedExtensions: The extensions that won't be allowed. +# If it is empty then no restrictions are done here. +# +# For a file to be uploaded it has to fulfill both the AllowedExtensions +# and DeniedExtensions (that's it: not being denied) conditions. +# +# - FileTypesPath: the virtual folder relative to the document root where +# these resources will be located. +# Attention: It must start and end with a slash: '/' +# +# - FileTypesAbsolutePath: the physical path to the above folder. It must be +# an absolute path. +# If it's an empty string then it will be autocalculated. +# Useful if you are using a virtual directory, symbolic link or alias. +# Examples: 'C:\\MySite\\userfiles\\' or '/root/mysite/userfiles/'. +# Attention: The above 'FileTypesPath' must point to the same directory. +# Attention: It must end with a slash: '/' +# +# +# - QuickUploadPath: the virtual folder relative to the document root where +# these resources will be uploaded using the Upload tab in the resources +# dialogs. +# Attention: It must start and end with a slash: '/' +# +# - QuickUploadAbsolutePath: the physical path to the above folder. It must be +# an absolute path. +# If it's an empty string then it will be autocalculated. +# Useful if you are using a virtual directory, symbolic link or alias. +# Examples: 'C:\\MySite\\userfiles\\' or '/root/mysite/userfiles/'. +# Attention: The above 'QuickUploadPath' must point to the same directory. +# Attention: It must end with a slash: '/' + +AllowedExtensions['File'] = ['7z','aiff','asf','avi','bmp','csv','doc','fla','flv','gif','gz','gzip','jpeg','jpg','mid','mov','mp3','mp4','mpc','mpeg','mpg','ods','odt','pdf','png','ppt','pxd','qt','ram','rar','rm','rmi','rmvb','rtf','sdc','sitd','swf','sxc','sxw','tar','tgz','tif','tiff','txt','vsd','wav','wma','wmv','xls','xml','zip'] +DeniedExtensions['File'] = [] +FileTypesPath['File'] = UserFilesPath + 'file/' +FileTypesAbsolutePath['File'] = (not UserFilesAbsolutePath == '') and (UserFilesAbsolutePath + 'file/') or '' +QuickUploadPath['File'] = FileTypesPath['File'] +QuickUploadAbsolutePath['File'] = FileTypesAbsolutePath['File'] + +AllowedExtensions['Image'] = ['bmp','gif','jpeg','jpg','png'] +DeniedExtensions['Image'] = [] +FileTypesPath['Image'] = UserFilesPath + 'image/' +FileTypesAbsolutePath['Image'] = (not UserFilesAbsolutePath == '') and UserFilesAbsolutePath + 'image/' or '' +QuickUploadPath['Image'] = FileTypesPath['Image'] +QuickUploadAbsolutePath['Image']= FileTypesAbsolutePath['Image'] + +AllowedExtensions['Flash'] = ['swf','flv'] +DeniedExtensions['Flash'] = [] +FileTypesPath['Flash'] = UserFilesPath + 'flash/' +FileTypesAbsolutePath['Flash'] = ( not UserFilesAbsolutePath == '') and UserFilesAbsolutePath + 'flash/' or '' +QuickUploadPath['Flash'] = FileTypesPath['Flash'] +QuickUploadAbsolutePath['Flash']= FileTypesAbsolutePath['Flash'] + +AllowedExtensions['Media'] = ['aiff','asf','avi','bmp','fla', 'flv','gif','jpeg','jpg','mid','mov','mp3','mp4','mpc','mpeg','mpg','png','qt','ram','rm','rmi','rmvb','swf','tif','tiff','wav','wma','wmv'] +DeniedExtensions['Media'] = [] +FileTypesPath['Media'] = UserFilesPath + 'media/' +FileTypesAbsolutePath['Media'] = ( not UserFilesAbsolutePath == '') and UserFilesAbsolutePath + 'media/' or '' +QuickUploadPath['Media'] = FileTypesPath['Media'] +QuickUploadAbsolutePath['Media']= FileTypesAbsolutePath['Media'] diff --git a/FCKeditor/editor/filemanager/connectors/py/connector.py b/FCKeditor/editor/filemanager/connectors/py/connector.py new file mode 100644 index 0000000..4688cbf --- /dev/null +++ b/FCKeditor/editor/filemanager/connectors/py/connector.py @@ -0,0 +1,118 @@ +#!/usr/bin/env python + +""" +FCKeditor - The text editor for Internet - http://www.fckeditor.net +Copyright (C) 2003-2007 Frederico Caldeira Knabben + +== BEGIN LICENSE == + +Licensed under the terms of any of the following licenses at your +choice: + + - GNU General Public License Version 2 or later (the "GPL") + http://www.gnu.org/licenses/gpl.html + + - GNU Lesser General Public License Version 2.1 or later (the "LGPL") + http://www.gnu.org/licenses/lgpl.html + + - Mozilla Public License Version 1.1 or later (the "MPL") + http://www.mozilla.org/MPL/MPL-1.1.html + +== END LICENSE == + +Connector for Python (CGI and WSGI). + +See config.py for configuration settings + +""" +import os + +from fckutil import * +from fckcommands import * # default command's implementation +from fckoutput import * # base http, xml and html output mixins +from fckconnector import FCKeditorConnectorBase # import base connector +import config as Config + +class FCKeditorConnector( FCKeditorConnectorBase, + GetFoldersCommandMixin, + GetFoldersAndFilesCommandMixin, + CreateFolderCommandMixin, + UploadFileCommandMixin, + BaseHttpMixin, BaseXmlMixin, BaseHtmlMixin ): + "The Standard connector class." + def doResponse(self): + "Main function. Process the request, set headers and return a string as response." + s = "" + # Check if this connector is disabled + if not(Config.Enabled): + return self.sendError(1, "This connector is disabled. Please check the connector configurations in \"editor/filemanager/connectors/py/config.py\" and try again.") + # Make sure we have valid inputs + for key in ("Command","Type","CurrentFolder"): + if not self.request.has_key (key): + return + # Get command, resource type and current folder + command = self.request.get("Command") + resourceType = self.request.get("Type") + currentFolder = getCurrentFolder(self.request.get("CurrentFolder")) + # Check for invalid paths + if currentFolder is None: + return self.sendError(102, "") + + # Check if it is an allowed command + if ( not command in Config.ConfigAllowedCommands ): + return self.sendError( 1, 'The %s command isn\'t allowed' % command ) + + if ( not resourceType in Config.ConfigAllowedTypes ): + return self.sendError( 1, 'Invalid type specified' ) + + # Setup paths + if command == "QuickUpload": + self.userFilesFolder = Config.QuickUploadAbsolutePath[resourceType] + self.webUserFilesFolder = Config.QuickUploadPath[resourceType] + else: + self.userFilesFolder = Config.FileTypesAbsolutePath[resourceType] + self.webUserFilesFolder = Config.FileTypesPath[resourceType] + + if not self.userFilesFolder: # no absolute path given (dangerous...) + self.userFilesFolder = mapServerPath(self.environ, + self.webUserFilesFolder) + # Ensure that the directory exists. + if not os.path.exists(self.userFilesFolder): + try: + self.createServerFoldercreateServerFolder( self.userFilesFolder ) + except: + return self.sendError(1, "This connector couldn\'t access to local user\'s files directories. Please check the UserFilesAbsolutePath in \"editor/filemanager/connectors/py/config.py\" and try again. ") + + # File upload doesn't have to return XML, so intercept here + if (command == "FileUpload"): + return self.uploadFile(resourceType, currentFolder) + + # Create Url + url = combinePaths( self.webUserFilesFolder, currentFolder ) + + # Begin XML + s += self.createXmlHeader(command, resourceType, currentFolder, url) + # Execute the command + selector = {"GetFolders": self.getFolders, + "GetFoldersAndFiles": self.getFoldersAndFiles, + "CreateFolder": self.createFolder, + } + s += selector[command](resourceType, currentFolder) + s += self.createXmlFooter() + return s + +# Running from command line (plain old CGI) +if __name__ == '__main__': + try: + # Create a Connector Instance + conn = FCKeditorConnector() + data = conn.doResponse() + for header in conn.headers: + print '%s: %s' % header + print + print data + except: + print "Content-Type: text/plain" + print + import cgi + cgi.print_exception() diff --git a/FCKeditor/editor/filemanager/connectors/py/fckcommands.py b/FCKeditor/editor/filemanager/connectors/py/fckcommands.py new file mode 100644 index 0000000..caaf0cc --- /dev/null +++ b/FCKeditor/editor/filemanager/connectors/py/fckcommands.py @@ -0,0 +1,181 @@ +#!/usr/bin/env python + +""" +FCKeditor - The text editor for Internet - http://www.fckeditor.net +Copyright (C) 2003-2007 Frederico Caldeira Knabben + +== BEGIN LICENSE == + +Licensed under the terms of any of the following licenses at your +choice: + +- GNU General Public License Version 2 or later (the "GPL") +http://www.gnu.org/licenses/gpl.html + +- GNU Lesser General Public License Version 2.1 or later (the "LGPL") +http://www.gnu.org/licenses/lgpl.html + +- Mozilla Public License Version 1.1 or later (the "MPL") +http://www.mozilla.org/MPL/MPL-1.1.html + +== END LICENSE == + +Connector for Python (CGI and WSGI). + +""" + +import os +try: # Windows needs stdio set for binary mode for file upload to work. + import msvcrt + msvcrt.setmode (0, os.O_BINARY) # stdin = 0 + msvcrt.setmode (1, os.O_BINARY) # stdout = 1 +except ImportError: + pass + +from fckutil import * +from fckoutput import * +import config as Config + +class GetFoldersCommandMixin (object): + def getFolders(self, resourceType, currentFolder): + """ + Purpose: command to recieve a list of folders + """ + # Map the virtual path to our local server + serverPath = mapServerFolder(self.userFilesFolder,currentFolder) + s = """""" # Open the folders node + for someObject in os.listdir(serverPath): + someObjectPath = mapServerFolder(serverPath, someObject) + if os.path.isdir(someObjectPath): + s += """""" % ( + convertToXmlAttribute(someObject) + ) + s += """""" # Close the folders node + return s + +class GetFoldersAndFilesCommandMixin (object): + def getFoldersAndFiles(self, resourceType, currentFolder): + """ + Purpose: command to recieve a list of folders and files + """ + # Map the virtual path to our local server + serverPath = mapServerFolder(self.userFilesFolder,currentFolder) + # Open the folders / files node + folders = """""" + files = """""" + for someObject in os.listdir(serverPath): + someObjectPath = mapServerFolder(serverPath, someObject) + if os.path.isdir(someObjectPath): + folders += """""" % ( + convertToXmlAttribute(someObject) + ) + elif os.path.isfile(someObjectPath): + size = os.path.getsize(someObjectPath) + files += """""" % ( + convertToXmlAttribute(someObject), + os.path.getsize(someObjectPath) + ) + # Close the folders / files node + folders += """""" + files += """""" + return folders + files + +class CreateFolderCommandMixin (object): + def createFolder(self, resourceType, currentFolder): + """ + Purpose: command to create a new folder + """ + errorNo = 0; errorMsg =''; + if self.request.has_key("NewFolderName"): + newFolder = self.request.get("NewFolderName", None) + newFolder = sanitizeFolderName (newFolder) + try: + newFolderPath = mapServerFolder(self.userFilesFolder, combinePaths(currentFolder, newFolder)) + self.createServerFolder(newFolderPath) + except Exception, e: + errorMsg = str(e).decode('iso-8859-1').encode('utf-8') # warning with encodigns!!! + if hasattr(e,'errno'): + if e.errno==17: #file already exists + errorNo=0 + elif e.errno==13: # permission denied + errorNo = 103 + elif e.errno==36 or e.errno==2 or e.errno==22: # filename too long / no such file / invalid name + errorNo = 102 + else: + errorNo = 110 + else: + errorNo = 102 + return self.sendErrorNode ( errorNo, errorMsg ) + + def createServerFolder(self, folderPath): + "Purpose: physically creates a folder on the server" + # No need to check if the parent exists, just create all hierachy + oldumask = os.umask(0) + os.makedirs(folderPath,mode=0755) + os.umask( oldumask ) + +class UploadFileCommandMixin (object): + def uploadFile(self, resourceType, currentFolder): + """ + Purpose: command to upload files to server (same as FileUpload) + """ + errorNo = 0 + if self.request.has_key("NewFile"): + # newFile has all the contents we need + newFile = self.request.get("NewFile", "") + # Get the file name + newFileName = newFile.filename + newFileName = sanitizeFileName( newFileName ) + newFileNameOnly = removeExtension(newFileName) + newFileExtension = getExtension(newFileName).lower() + allowedExtensions = Config.AllowedExtensions[resourceType] + deniedExtensions = Config.DeniedExtensions[resourceType] + + if (allowedExtensions): + # Check for allowed + isAllowed = False + if (newFileExtension in allowedExtensions): + isAllowed = True + elif (deniedExtensions): + # Check for denied + isAllowed = True + if (newFileExtension in deniedExtensions): + isAllowed = False + else: + # No extension limitations + isAllowed = True + + if (isAllowed): + # Upload to operating system + # Map the virtual path to the local server path + currentFolderPath = mapServerFolder(self.userFilesFolder, currentFolder) + i = 0 + while (True): + newFilePath = os.path.join (currentFolderPath,newFileName) + if os.path.exists(newFilePath): + i += 1 + newFileName = "%s(%04d).%s" % ( + newFileNameOnly, i, newFileExtension + ) + errorNo= 201 # file renamed + else: + # Read file contents and write to the desired path (similar to php's move_uploaded_file) + fout = file(newFilePath, 'wb') + while (True): + chunk = newFile.file.read(100000) + if not chunk: break + fout.write (chunk) + fout.close() + + if os.path.exists ( newFilePath ): + oldumask = os.umask(0) + os.chmod( newFilePath, 0755 ) + os.umask( oldumask ) + + newFileUrl = self.webUserFilesFolder + currentFolder + newFileName + + return self.sendUploadResults( errorNo , newFileUrl, newFileName ) + else: + return self.sendUploadResults( errorNo = 203, customMsg = "Extension not allowed" ) + else: + return self.sendUploadResults( errorNo = 202, customMsg = "No File" ) diff --git a/FCKeditor/editor/filemanager/connectors/py/fckconnector.py b/FCKeditor/editor/filemanager/connectors/py/fckconnector.py new file mode 100644 index 0000000..6cb2f6e --- /dev/null +++ b/FCKeditor/editor/filemanager/connectors/py/fckconnector.py @@ -0,0 +1,90 @@ +#!/usr/bin/env python + +""" +FCKeditor - The text editor for Internet - http://www.fckeditor.net +Copyright (C) 2003-2007 Frederico Caldeira Knabben + +== BEGIN LICENSE == + +Licensed under the terms of any of the following licenses at your +choice: + +- GNU General Public License Version 2 or later (the "GPL") +http://www.gnu.org/licenses/gpl.html + +- GNU Lesser General Public License Version 2.1 or later (the "LGPL") +http://www.gnu.org/licenses/lgpl.html + +- Mozilla Public License Version 1.1 or later (the "MPL") +http://www.mozilla.org/MPL/MPL-1.1.html + +== END LICENSE == + +Base Connector for Python (CGI and WSGI). + +See config.py for configuration settings + +""" +import cgi, os + +from fckutil import * +from fckcommands import * # default command's implementation +from fckoutput import * # base http, xml and html output mixins +import config as Config + +class FCKeditorConnectorBase( object ): + "The base connector class. Subclass it to extend functionality (see Zope example)" + + def __init__(self, environ=None): + "Constructor: Here you should parse request fields, initialize variables, etc." + self.request = FCKeditorRequest(environ) # Parse request + self.headers = [] # Clean Headers + if environ: + self.environ = environ + else: + self.environ = os.environ + + # local functions + + def setHeader(self, key, value): + self.headers.append ((key, value)) + return + +class FCKeditorRequest(object): + "A wrapper around the request object" + def __init__(self, environ): + if environ: # WSGI + self.request = cgi.FieldStorage(fp=environ['wsgi.input'], + environ=environ, + keep_blank_values=1) + self.environ = environ + else: # plain old cgi + self.environ = os.environ + self.request = cgi.FieldStorage() + if 'REQUEST_METHOD' in self.environ and 'QUERY_STRING' in self.environ: + if self.environ['REQUEST_METHOD'].upper()=='POST': + # we are in a POST, but GET query_string exists + # cgi parses by default POST data, so parse GET QUERY_STRING too + self.get_request = cgi.FieldStorage(fp=None, + environ={ + 'REQUEST_METHOD':'GET', + 'QUERY_STRING':self.environ['QUERY_STRING'], + }, + ) + else: + self.get_request={} + + def has_key(self, key): + return self.request.has_key(key) or self.get_request.has_key(key) + + def get(self, key, default=None): + if key in self.request.keys(): + field = self.request[key] + elif key in self.get_request.keys(): + field = self.get_request[key] + else: + return default + if hasattr(field,"filename") and field.filename: #file upload, do not convert return value + return field + else: + return field.value diff --git a/FCKeditor/editor/filemanager/connectors/py/fckoutput.py b/FCKeditor/editor/filemanager/connectors/py/fckoutput.py new file mode 100644 index 0000000..cdae04f --- /dev/null +++ b/FCKeditor/editor/filemanager/connectors/py/fckoutput.py @@ -0,0 +1,111 @@ +#!/usr/bin/env python + +""" +FCKeditor - The text editor for Internet - http://www.fckeditor.net +Copyright (C) 2003-2007 Frederico Caldeira Knabben + +== BEGIN LICENSE == + +Licensed under the terms of any of the following licenses at your +choice: + +- GNU General Public License Version 2 or later (the "GPL") +http://www.gnu.org/licenses/gpl.html + +- GNU Lesser General Public License Version 2.1 or later (the "LGPL") +http://www.gnu.org/licenses/lgpl.html + +- Mozilla Public License Version 1.1 or later (the "MPL") +http://www.mozilla.org/MPL/MPL-1.1.html + +== END LICENSE == + +Connector for Python (CGI and WSGI). + +""" + +from time import gmtime, strftime +import string + +def escape(text, replace=string.replace): + """ + Converts the special characters '<', '>', and '&'. + + RFC 1866 specifies that these characters be represented + in HTML as < > and & respectively. In Python + 1.5 we use the new string.replace() function for speed. + """ + text = replace(text, '&', '&') # must be done 1st + text = replace(text, '<', '<') + text = replace(text, '>', '>') + text = replace(text, '"', '"') + return text + +def convertToXmlAttribute(value): + if (value is None): + value = "" + return escape(value) + +class BaseHttpMixin(object): + def setHttpHeaders(self, content_type='text/xml'): + "Purpose: to prepare the headers for the xml to return" + # Prevent the browser from caching the result. + # Date in the past + self.setHeader('Expires','Mon, 26 Jul 1997 05:00:00 GMT') + # always modified + self.setHeader('Last-Modified',strftime("%a, %d %b %Y %H:%M:%S GMT", gmtime())) + # HTTP/1.1 + self.setHeader('Cache-Control','no-store, no-cache, must-revalidate') + self.setHeader('Cache-Control','post-check=0, pre-check=0') + # HTTP/1.0 + self.setHeader('Pragma','no-cache') + + # Set the response format. + self.setHeader( 'Content-Type', content_type + '; charset=utf-8' ) + return + +class BaseXmlMixin(object): + def createXmlHeader(self, command, resourceType, currentFolder, url): + "Purpose: returns the xml header" + self.setHttpHeaders() + # Create the XML document header + s = """""" + # Create the main connector node + s += """""" % ( + command, + resourceType + ) + # Add the current folder node + s += """""" % ( + convertToXmlAttribute(currentFolder), + convertToXmlAttribute(url), + ) + return s + + def createXmlFooter(self): + "Purpose: returns the xml footer" + return """""" + + def sendError(self, number, text): + "Purpose: in the event of an error, return an xml based error" + self.setHttpHeaders() + return ("""""" + + """""" + + self.sendErrorNode (number, text) + + """""" ) + + def sendErrorNode(self, number, text): + return """""" % (number, convertToXmlAttribute(text)) + +class BaseHtmlMixin(object): + def sendUploadResults( self, errorNo = 0, fileUrl = '', fileName = '', customMsg = '' ): + self.setHttpHeaders("text/html") + "This is the function that sends the results of the uploading process" + return """""" % { + 'errorNumber': errorNo, + 'fileUrl': fileUrl.replace ('"', '\\"'), + 'fileName': fileName.replace ( '"', '\\"' ) , + 'customMsg': customMsg.replace ( '"', '\\"' ), + } \ No newline at end of file diff --git a/FCKeditor/editor/filemanager/connectors/py/fckutil.py b/FCKeditor/editor/filemanager/connectors/py/fckutil.py new file mode 100644 index 0000000..97f3afe --- /dev/null +++ b/FCKeditor/editor/filemanager/connectors/py/fckutil.py @@ -0,0 +1,127 @@ +#!/usr/bin/env python + +""" +FCKeditor - The text editor for Internet - http://www.fckeditor.net +Copyright (C) 2003-2007 Frederico Caldeira Knabben + +== BEGIN LICENSE == + +Licensed under the terms of any of the following licenses at your +choice: + +- GNU General Public License Version 2 or later (the "GPL") +http://www.gnu.org/licenses/gpl.html + +- GNU Lesser General Public License Version 2.1 or later (the "LGPL") +http://www.gnu.org/licenses/lgpl.html + +- Mozilla Public License Version 1.1 or later (the "MPL") +http://www.mozilla.org/MPL/MPL-1.1.html + +== END LICENSE == + +Utility functions for the File Manager Connector for Python + +""" + +import string, re +import os +import config as Config + +# Generic manipulation functions + +def removeExtension(fileName): + index = fileName.rindex(".") + newFileName = fileName[0:index] + return newFileName + +def getExtension(fileName): + index = fileName.rindex(".") + 1 + fileExtension = fileName[index:] + return fileExtension + +def removeFromStart(string, char): + return string.lstrip(char) + +def removeFromEnd(string, char): + return string.rstrip(char) + +# Path functions + +def combinePaths( basePath, folder ): + return removeFromEnd( basePath, '/' ) + '/' + removeFromStart( folder, '/' ) + +def getFileName(filename): + " Purpose: helper function to extrapolate the filename " + for splitChar in ["/", "\\"]: + array = filename.split(splitChar) + if (len(array) > 1): + filename = array[-1] + return filename + +def sanitizeFolderName( newFolderName ): + "Do a cleanup of the folder name to avoid possible problems" + # Remove . \ / | : ? * + return re.sub( '\\.|\\\\|\\/|\\||\\:|\\?|\\*', '_', newFolderName ) + +def sanitizeFileName( newFileName ): + "Do a cleanup of the file name to avoid possible problems" + # Replace dots in the name with underscores (only one dot can be there... security issue). + if ( Config.ForceSingleExtension ): # remove dots + newFileName = re.sub ( '/\\.(?![^.]*$)/', '_', newFileName ) ; + newFileName = newFileName.replace('\\','/') # convert windows to unix path + newFileName = os.path.basename (newFileName) # strip directories + # Remove \ / | : ? * + return re.sub ( '/\\\\|\\/|\\||\\:|\\?|\\*/', '_', newFileName ) + +def getCurrentFolder(currentFolder): + if not currentFolder: + currentFolder = '/' + + # Check the current folder syntax (must begin and end with a slash). + if (currentFolder[-1] <> "/"): + currentFolder += "/" + if (currentFolder[0] <> "/"): + currentFolder = "/" + currentFolder + + # Ensure the folder path has no double-slashes + while '//' in currentFolder: + currentFolder = currentFolder.replace('//','/') + + # Check for invalid folder paths (..) + if '..' in currentFolder: + return None + + return currentFolder + +def mapServerPath( environ, url): + " Emulate the asp Server.mapPath function. Given an url path return the physical directory that it corresponds to " + # This isn't correct but for the moment there's no other solution + # If this script is under a virtual directory or symlink it will detect the problem and stop + return combinePaths( getRootPath(environ), url ) + +def mapServerFolder(resourceTypePath, folderPath): + return combinePaths ( resourceTypePath , folderPath ) + +def getRootPath(environ): + "Purpose: returns the root path on the server" + # WARNING: this may not be thread safe, and doesn't work w/ VirtualServer/mod_python + # Use Config.UserFilesAbsolutePath instead + + if environ.has_key('DOCUMENT_ROOT'): + return environ['DOCUMENT_ROOT'] + else: + realPath = os.path.realpath( './' ) + selfPath = environ['SCRIPT_FILENAME'] + selfPath = selfPath [ : selfPath.rfind( '/' ) ] + selfPath = selfPath.replace( '/', os.path.sep) + + position = realPath.find(selfPath) + + # This can check only that this script isn't run from a virtual dir + # But it avoids the problems that arise if it isn't checked + raise realPath + if ( position < 0 or position <> len(realPath) - len(selfPath) or realPath[ : position ]==''): + raise Exception('Sorry, can\'t map "UserFilesPath" to a physical path. You must set the "UserFilesAbsolutePath" value in "editor/filemanager/connectors/py/config.py".') + return realPath[ : position ] + diff --git a/FCKeditor/editor/filemanager/connectors/py/htaccess.txt b/FCKeditor/editor/filemanager/connectors/py/htaccess.txt new file mode 100644 index 0000000..d1c31c1 --- /dev/null +++ b/FCKeditor/editor/filemanager/connectors/py/htaccess.txt @@ -0,0 +1,23 @@ +# replace the name of this file to .htaccess (if using apache), +# and set the proper options and paths according your enviroment + +Allow from all + +# If using mod_python uncomment this: +PythonPath "[r'C:\Archivos de programa\Apache Software Foundation\Apache2.2\htdocs\fckeditor\editor\filemanager\connectors\py'] + sys.path" + + +# Recomended: WSGI application running with mod_python and modpython_gateway +SetHandler python-program +PythonHandler modpython_gateway::handler +PythonOption wsgi.application wsgi::App + + +# Emulated CGI with mod_python and cgihandler +#AddHandler mod_python .py +#PythonHandler mod_python.cgihandler + + +# Plain old CGI +#Options +ExecCGI +#AddHandler cgi-script py diff --git a/FCKeditor/editor/filemanager/connectors/py/upload.py b/FCKeditor/editor/filemanager/connectors/py/upload.py new file mode 100644 index 0000000..d7fb260 --- /dev/null +++ b/FCKeditor/editor/filemanager/connectors/py/upload.py @@ -0,0 +1,88 @@ +#!/usr/bin/env python + +""" +FCKeditor - The text editor for Internet - http://www.fckeditor.net +Copyright (C) 2003-2007 Frederico Caldeira Knabben + +== BEGIN LICENSE == + +Licensed under the terms of any of the following licenses at your +choice: + +- GNU General Public License Version 2 or later (the "GPL") +http://www.gnu.org/licenses/gpl.html + +- GNU Lesser General Public License Version 2.1 or later (the "LGPL") +http://www.gnu.org/licenses/lgpl.html + +- Mozilla Public License Version 1.1 or later (the "MPL") +http://www.mozilla.org/MPL/MPL-1.1.html + +== END LICENSE == + +This is the "File Uploader" for Python + +""" +import os + +from fckutil import * +from fckcommands import * # default command's implementation +from fckconnector import FCKeditorConnectorBase # import base connector +import config as Config + +class FCKeditorQuickUpload( FCKeditorConnectorBase, + UploadFileCommandMixin, + BaseHttpMixin, BaseHtmlMixin): + def doResponse(self): + "Main function. Process the request, set headers and return a string as response." + # Check if this connector is disabled + if not(Config.Enabled): + return self.sendUploadResults(1, "This file uploader is disabled. Please check the \"editor/filemanager/connectors/py/config.py\"") + command = 'QuickUpload' + # The file type (from the QueryString, by default 'File'). + resourceType = self.request.get('Type','File') + currentFolder = getCurrentFolder(self.request.get("CurrentFolder","")) + # Check for invalid paths + if currentFolder is None: + return self.sendUploadResults(102, '', '', "") + + # Check if it is an allowed command + if ( not command in Config.ConfigAllowedCommands ): + return self.sendUploadResults( 1, '', '', 'The %s command isn\'t allowed' % command ) + + if ( not resourceType in Config.ConfigAllowedTypes ): + return self.sendUploadResults( 1, '', '', 'Invalid type specified' ) + + # Setup paths + self.userFilesFolder = Config.QuickUploadAbsolutePath[resourceType] + self.webUserFilesFolder = Config.QuickUploadPath[resourceType] + if not self.userFilesFolder: # no absolute path given (dangerous...) + self.userFilesFolder = mapServerPath(self.environ, + self.webUserFilesFolder) + + # Ensure that the directory exists. + if not os.path.exists(self.userFilesFolder): + try: + self.createServerFoldercreateServerFolder( self.userFilesFolder ) + except: + return self.sendError(1, "This connector couldn\'t access to local user\'s files directories. Please check the UserFilesAbsolutePath in \"editor/filemanager/connectors/py/config.py\" and try again. ") + + # File upload doesn't have to return XML, so intercept here + return self.uploadFile(resourceType, currentFolder) + +# Running from command line (plain old CGI) +if __name__ == '__main__': + try: + # Create a Connector Instance + conn = FCKeditorQuickUpload() + data = conn.doResponse() + for header in conn.headers: + if not header is None: + print '%s: %s' % header + print + print data + except: + print "Content-Type: text/plain" + print + import cgi + cgi.print_exception() diff --git a/FCKeditor/editor/filemanager/connectors/py/wsgi.py b/FCKeditor/editor/filemanager/connectors/py/wsgi.py new file mode 100644 index 0000000..a1145db --- /dev/null +++ b/FCKeditor/editor/filemanager/connectors/py/wsgi.py @@ -0,0 +1,58 @@ +#!/usr/bin/env python + +""" +FCKeditor - The text editor for Internet - http://www.fckeditor.net +Copyright (C) 2003-2007 Frederico Caldeira Knabben + +== BEGIN LICENSE == + +Licensed under the terms of any of the following licenses at your +choice: + + - GNU General Public License Version 2 or later (the "GPL") + http://www.gnu.org/licenses/gpl.html + + - GNU Lesser General Public License Version 2.1 or later (the "LGPL") + http://www.gnu.org/licenses/lgpl.html + + - Mozilla Public License Version 1.1 or later (the "MPL") + http://www.mozilla.org/MPL/MPL-1.1.html + +== END LICENSE == + +Connector/QuickUpload for Python (WSGI wrapper). + +See config.py for configuration settings + +""" + +from connector import FCKeditorConnector +from upload import FCKeditorQuickUpload + +import cgitb +from cStringIO import StringIO + +# Running from WSGI capable server (recomended) +def App(environ, start_response): + "WSGI entry point. Run the connector" + if environ['SCRIPT_NAME'].endswith("connector.py"): + conn = FCKeditorConnector(environ) + elif environ['SCRIPT_NAME'].endswith("upload.py"): + conn = FCKeditorQuickUpload(environ) + else: + start_response ("200 Ok", [('Content-Type','text/html')]) + yield "Unknown page requested: " + yield environ['SCRIPT_NAME'] + return + try: + # run the connector + data = conn.doResponse() + # Start WSGI response: + start_response ("200 Ok", conn.headers) + # Send response text + yield data + except: + start_response("500 Internal Server Error",[("Content-type","text/html")]) + file = StringIO() + cgitb.Hook(file = file).handle() + yield file.getvalue() diff --git a/FCKeditor/editor/filemanager/connectors/py/zope.py b/FCKeditor/editor/filemanager/connectors/py/zope.py new file mode 100644 index 0000000..7157085 --- /dev/null +++ b/FCKeditor/editor/filemanager/connectors/py/zope.py @@ -0,0 +1,189 @@ +#!/usr/bin/env python + +""" +FCKeditor - The text editor for Internet - http://www.fckeditor.net +Copyright (C) 2003-2007 Frederico Caldeira Knabben + +== BEGIN LICENSE == + +Licensed under the terms of any of the following licenses at your +choice: + +- GNU General Public License Version 2 or later (the "GPL") +http://www.gnu.org/licenses/gpl.html + +- GNU Lesser General Public License Version 2.1 or later (the "LGPL") +http://www.gnu.org/licenses/lgpl.html + +- Mozilla Public License Version 1.1 or later (the "MPL") +http://www.mozilla.org/MPL/MPL-1.1.html + +== END LICENSE == + +Connector for Python and Zope. + +This code was not tested at all. +It just was ported from pre 2.5 release, so for further reference see +\editor\filemanager\browser\default\connectors\py\connector.py in previous +releases. + +""" + +from fckutil import * +from connector import * +import config as Config + +class FCKeditorConnectorZope(FCKeditorConnector): + """ + Zope versiof FCKeditorConnector + """ + # Allow access (Zope) + __allow_access_to_unprotected_subobjects__ = 1 + + def __init__(self, context=None): + """ + Constructor + """ + FCKeditorConnector.__init__(self, environ=None) # call superclass constructor + # Instance Attributes + self.context = context + self.request = FCKeditorRequest(context) + + def getZopeRootContext(self): + if self.zopeRootContext is None: + self.zopeRootContext = self.context.getPhysicalRoot() + return self.zopeRootContext + + def getZopeUploadContext(self): + if self.zopeUploadContext is None: + folderNames = self.userFilesFolder.split("/") + c = self.getZopeRootContext() + for folderName in folderNames: + if (folderName <> ""): + c = c[folderName] + self.zopeUploadContext = c + return self.zopeUploadContext + + def setHeader(self, key, value): + self.context.REQUEST.RESPONSE.setHeader(key, value) + + def getFolders(self, resourceType, currentFolder): + # Open the folders node + s = "" + s += """""" + zopeFolder = self.findZopeFolder(resourceType, currentFolder) + for (name, o) in zopeFolder.objectItems(["Folder"]): + s += """""" % ( + convertToXmlAttribute(name) + ) + # Close the folders node + s += """""" + return s + + def getZopeFoldersAndFiles(self, resourceType, currentFolder): + folders = self.getZopeFolders(resourceType, currentFolder) + files = self.getZopeFiles(resourceType, currentFolder) + s = folders + files + return s + + def getZopeFiles(self, resourceType, currentFolder): + # Open the files node + s = "" + s += """""" + zopeFolder = self.findZopeFolder(resourceType, currentFolder) + for (name, o) in zopeFolder.objectItems(["File","Image"]): + s += """""" % ( + convertToXmlAttribute(name), + ((o.get_size() / 1024) + 1) + ) + # Close the files node + s += """""" + return s + + def findZopeFolder(self, resourceType, folderName): + # returns the context of the resource / folder + zopeFolder = self.getZopeUploadContext() + folderName = self.removeFromStart(folderName, "/") + folderName = self.removeFromEnd(folderName, "/") + if (resourceType <> ""): + try: + zopeFolder = zopeFolder[resourceType] + except: + zopeFolder.manage_addProduct["OFSP"].manage_addFolder(id=resourceType, title=resourceType) + zopeFolder = zopeFolder[resourceType] + if (folderName <> ""): + folderNames = folderName.split("/") + for folderName in folderNames: + zopeFolder = zopeFolder[folderName] + return zopeFolder + + def createFolder(self, resourceType, currentFolder): + # Find out where we are + zopeFolder = self.findZopeFolder(resourceType, currentFolder) + errorNo = 0 + errorMsg = "" + if self.request.has_key("NewFolderName"): + newFolder = self.request.get("NewFolderName", None) + zopeFolder.manage_addProduct["OFSP"].manage_addFolder(id=newFolder, title=newFolder) + else: + errorNo = 102 + return self.sendErrorNode ( errorNo, errorMsg ) + + def uploadFile(self, resourceType, currentFolder, count=None): + zopeFolder = self.findZopeFolder(resourceType, currentFolder) + file = self.request.get("NewFile", None) + fileName = self.getFileName(file.filename) + fileNameOnly = self.removeExtension(fileName) + fileExtension = self.getExtension(fileName).lower() + if (count): + nid = "%s.%s.%s" % (fileNameOnly, count, fileExtension) + else: + nid = fileName + title = nid + try: + zopeFolder.manage_addProduct['OFSP'].manage_addFile( + id=nid, + title=title, + file=file.read() + ) + except: + if (count): + count += 1 + else: + count = 1 + return self.zopeFileUpload(resourceType, currentFolder, count) + return self.sendUploadResults( 0 ) + +class FCKeditorRequest(object): + "A wrapper around the request object" + def __init__(self, context=None): + r = context.REQUEST + self.request = r + + def has_key(self, key): + return self.request.has_key(key) + + def get(self, key, default=None): + return self.request.get(key, default) + +""" +Running from zope, you will need to modify this connector. +If you have uploaded the FCKeditor into Zope (like me), you need to +move this connector out of Zope, and replace the "connector" with an +alias as below. The key to it is to pass the Zope context in, as +we then have a like to the Zope context. + +## Script (Python) "connector.py" +##bind container=container +##bind context=context +##bind namespace= +##bind script=script +##bind subpath=traverse_subpath +##parameters=*args, **kws +##title=ALIAS +## + +import Products.zope as connector +return connector.FCKeditorConnectorZope(context=context).doResponse() +""" + diff --git a/FCKeditor/editor/filemanager/connectors/test.html b/FCKeditor/editor/filemanager/connectors/test.html new file mode 100644 index 0000000..828a570 --- /dev/null +++ b/FCKeditor/editor/filemanager/connectors/test.html @@ -0,0 +1,177 @@ + + + + + FCKeditor - Connectors Tests + + + + + + + + + + +
+ + + + + + + + +
+ Connector:
+ +
+     + Current Folder
+
+     + Resource Type
+ +
+
+ + + + + + + + + + +
+ Get Folders +     + Get Folders and Files +     + Create Folder +     +
+ File Upload
+ + +
+
+
+ URL: +
+ +
+ + diff --git a/FCKeditor/editor/filemanager/connectors/uploadtest.html b/FCKeditor/editor/filemanager/connectors/uploadtest.html new file mode 100644 index 0000000..8de6edb --- /dev/null +++ b/FCKeditor/editor/filemanager/connectors/uploadtest.html @@ -0,0 +1,149 @@ + + + + FCKeditor - Uploaders Tests + + + + + + + + + + +
+ + + + + + + +
+ Select the "File Uploader" to use:
+ +
+ Resource Type
+ +
       + Custom Uploader URL:
+ +
+
+ + + + + + +
+
+ Upload a new file:
+
+ +
+
       + Uploaded File URL:
+ +
+
+ Post URL:   +
+ +
+ + diff --git a/FCKeditor/editor/images/anchor.gif b/FCKeditor/editor/images/anchor.gif new file mode 100644 index 0000000..5aa797b Binary files /dev/null and b/FCKeditor/editor/images/anchor.gif differ diff --git a/FCKeditor/editor/images/arrow_ltr.gif b/FCKeditor/editor/images/arrow_ltr.gif new file mode 100644 index 0000000..9c59bfe Binary files /dev/null and b/FCKeditor/editor/images/arrow_ltr.gif differ diff --git a/FCKeditor/editor/images/arrow_rtl.gif b/FCKeditor/editor/images/arrow_rtl.gif new file mode 100644 index 0000000..22e8649 Binary files /dev/null and b/FCKeditor/editor/images/arrow_rtl.gif differ diff --git a/FCKeditor/editor/images/smiley/msn/angel_smile.gif b/FCKeditor/editor/images/smiley/msn/angel_smile.gif new file mode 100644 index 0000000..a95e053 Binary files /dev/null and b/FCKeditor/editor/images/smiley/msn/angel_smile.gif differ diff --git a/FCKeditor/editor/images/smiley/msn/angry_smile.gif b/FCKeditor/editor/images/smiley/msn/angry_smile.gif new file mode 100644 index 0000000..c667c5d Binary files /dev/null and b/FCKeditor/editor/images/smiley/msn/angry_smile.gif differ diff --git a/FCKeditor/editor/images/smiley/msn/broken_heart.gif b/FCKeditor/editor/images/smiley/msn/broken_heart.gif new file mode 100644 index 0000000..938cce1 Binary files /dev/null and b/FCKeditor/editor/images/smiley/msn/broken_heart.gif differ diff --git a/FCKeditor/editor/images/smiley/msn/cake.gif b/FCKeditor/editor/images/smiley/msn/cake.gif new file mode 100644 index 0000000..f6489d7 Binary files /dev/null and b/FCKeditor/editor/images/smiley/msn/cake.gif differ diff --git a/FCKeditor/editor/images/smiley/msn/confused_smile.gif b/FCKeditor/editor/images/smiley/msn/confused_smile.gif new file mode 100644 index 0000000..aeb0539 Binary files /dev/null and b/FCKeditor/editor/images/smiley/msn/confused_smile.gif differ diff --git a/FCKeditor/editor/images/smiley/msn/cry_smile.gif b/FCKeditor/editor/images/smiley/msn/cry_smile.gif new file mode 100644 index 0000000..0758f42 Binary files /dev/null and b/FCKeditor/editor/images/smiley/msn/cry_smile.gif differ diff --git a/FCKeditor/editor/images/smiley/msn/devil_smile.gif b/FCKeditor/editor/images/smiley/msn/devil_smile.gif new file mode 100644 index 0000000..15518d7 Binary files /dev/null and b/FCKeditor/editor/images/smiley/msn/devil_smile.gif differ diff --git a/FCKeditor/editor/images/smiley/msn/embaressed_smile.gif b/FCKeditor/editor/images/smiley/msn/embaressed_smile.gif new file mode 100644 index 0000000..c431946 Binary files /dev/null and b/FCKeditor/editor/images/smiley/msn/embaressed_smile.gif differ diff --git a/FCKeditor/editor/images/smiley/msn/envelope.gif b/FCKeditor/editor/images/smiley/msn/envelope.gif new file mode 100644 index 0000000..66d3656 Binary files /dev/null and b/FCKeditor/editor/images/smiley/msn/envelope.gif differ diff --git a/FCKeditor/editor/images/smiley/msn/heart.gif b/FCKeditor/editor/images/smiley/msn/heart.gif new file mode 100644 index 0000000..305714f Binary files /dev/null and b/FCKeditor/editor/images/smiley/msn/heart.gif differ diff --git a/FCKeditor/editor/images/smiley/msn/kiss.gif b/FCKeditor/editor/images/smiley/msn/kiss.gif new file mode 100644 index 0000000..f840ea6 Binary files /dev/null and b/FCKeditor/editor/images/smiley/msn/kiss.gif differ diff --git a/FCKeditor/editor/images/smiley/msn/lightbulb.gif b/FCKeditor/editor/images/smiley/msn/lightbulb.gif new file mode 100644 index 0000000..863be6e Binary files /dev/null and b/FCKeditor/editor/images/smiley/msn/lightbulb.gif differ diff --git a/FCKeditor/editor/images/smiley/msn/omg_smile.gif b/FCKeditor/editor/images/smiley/msn/omg_smile.gif new file mode 100644 index 0000000..aabc7fd Binary files /dev/null and b/FCKeditor/editor/images/smiley/msn/omg_smile.gif differ diff --git a/FCKeditor/editor/images/smiley/msn/regular_smile.gif b/FCKeditor/editor/images/smiley/msn/regular_smile.gif new file mode 100644 index 0000000..33f297e Binary files /dev/null and b/FCKeditor/editor/images/smiley/msn/regular_smile.gif differ diff --git a/FCKeditor/editor/images/smiley/msn/sad_smile.gif b/FCKeditor/editor/images/smiley/msn/sad_smile.gif new file mode 100644 index 0000000..dfb78ef Binary files /dev/null and b/FCKeditor/editor/images/smiley/msn/sad_smile.gif differ diff --git a/FCKeditor/editor/images/smiley/msn/shades_smile.gif b/FCKeditor/editor/images/smiley/msn/shades_smile.gif new file mode 100644 index 0000000..157df77 Binary files /dev/null and b/FCKeditor/editor/images/smiley/msn/shades_smile.gif differ diff --git a/FCKeditor/editor/images/smiley/msn/teeth_smile.gif b/FCKeditor/editor/images/smiley/msn/teeth_smile.gif new file mode 100644 index 0000000..26b5a55 Binary files /dev/null and b/FCKeditor/editor/images/smiley/msn/teeth_smile.gif differ diff --git a/FCKeditor/editor/images/smiley/msn/thumbs_down.gif b/FCKeditor/editor/images/smiley/msn/thumbs_down.gif new file mode 100644 index 0000000..f53ee72 Binary files /dev/null and b/FCKeditor/editor/images/smiley/msn/thumbs_down.gif differ diff --git a/FCKeditor/editor/images/smiley/msn/thumbs_up.gif b/FCKeditor/editor/images/smiley/msn/thumbs_up.gif new file mode 100644 index 0000000..7e8c746 Binary files /dev/null and b/FCKeditor/editor/images/smiley/msn/thumbs_up.gif differ diff --git a/FCKeditor/editor/images/smiley/msn/tounge_smile.gif b/FCKeditor/editor/images/smiley/msn/tounge_smile.gif new file mode 100644 index 0000000..b87ec44 Binary files /dev/null and b/FCKeditor/editor/images/smiley/msn/tounge_smile.gif differ diff --git a/FCKeditor/editor/images/smiley/msn/whatchutalkingabout_smile.gif b/FCKeditor/editor/images/smiley/msn/whatchutalkingabout_smile.gif new file mode 100644 index 0000000..c074122 Binary files /dev/null and b/FCKeditor/editor/images/smiley/msn/whatchutalkingabout_smile.gif differ diff --git a/FCKeditor/editor/images/smiley/msn/wink_smile.gif b/FCKeditor/editor/images/smiley/msn/wink_smile.gif new file mode 100644 index 0000000..eefe61d Binary files /dev/null and b/FCKeditor/editor/images/smiley/msn/wink_smile.gif differ diff --git a/FCKeditor/editor/images/spacer.gif b/FCKeditor/editor/images/spacer.gif new file mode 100644 index 0000000..5bfd67a Binary files /dev/null and b/FCKeditor/editor/images/spacer.gif differ diff --git a/FCKeditor/editor/js/fckeditorcode_gecko.js b/FCKeditor/editor/js/fckeditorcode_gecko.js new file mode 100644 index 0000000..fd74c1b --- /dev/null +++ b/FCKeditor/editor/js/fckeditorcode_gecko.js @@ -0,0 +1,108 @@ +/* + * FCKeditor - The text editor for Internet - http://www.fckeditor.net + * Copyright (C) 2003-2007 Frederico Caldeira Knabben + * + * == BEGIN LICENSE == + * + * Licensed under the terms of any of the following licenses at your + * choice: + * + * - GNU General Public License Version 2 or later (the "GPL") + * http://www.gnu.org/licenses/gpl.html + * + * - GNU Lesser General Public License Version 2.1 or later (the "LGPL") + * http://www.gnu.org/licenses/lgpl.html + * + * - Mozilla Public License Version 1.1 or later (the "MPL") + * http://www.mozilla.org/MPL/MPL-1.1.html + * + * == END LICENSE == + * + * This file has been compressed for better performance. The original source + * can be found at "editor/_source". + */ + +var FCK_STATUS_NOTLOADED=window.parent.FCK_STATUS_NOTLOADED=0;var FCK_STATUS_ACTIVE=window.parent.FCK_STATUS_ACTIVE=1;var FCK_STATUS_COMPLETE=window.parent.FCK_STATUS_COMPLETE=2;var FCK_TRISTATE_OFF=window.parent.FCK_TRISTATE_OFF=0;var FCK_TRISTATE_ON=window.parent.FCK_TRISTATE_ON=1;var FCK_TRISTATE_DISABLED=window.parent.FCK_TRISTATE_DISABLED=-1;var FCK_UNKNOWN=window.parent.FCK_UNKNOWN=-9;var FCK_TOOLBARITEM_ONLYICON=window.parent.FCK_TOOLBARITEM_ONLYICON=0;var FCK_TOOLBARITEM_ONLYTEXT=window.parent.FCK_TOOLBARITEM_ONLYTEXT=1;var FCK_TOOLBARITEM_ICONTEXT=window.parent.FCK_TOOLBARITEM_ICONTEXT=2;var FCK_EDITMODE_WYSIWYG=window.parent.FCK_EDITMODE_WYSIWYG=0;var FCK_EDITMODE_SOURCE=window.parent.FCK_EDITMODE_SOURCE=1;var FCK_IMAGES_PATH='images/';var FCK_SPACER_PATH='images/spacer.gif';var CTRL=1000;var SHIFT=2000;var ALT=4000;var FCK_STYLE_BLOCK=0;var FCK_STYLE_INLINE=1;var FCK_STYLE_OBJECT=2; +String.prototype.Contains=function(A){return (this.indexOf(A)>-1);};String.prototype.Equals=function(){var A=arguments;if (A.length==1&&A[0].pop) A=A[0];for (var i=0;iC) return false;if (B){var E=new RegExp(A+'$','i');return E.test(this);}else return (D==0||this.substr(C-D,D)==A);};String.prototype.Remove=function(A,B){var s='';if (A>0) s=this.substring(0,A);if (A+B=7),IsGecko:s.Contains('gecko/'),IsSafari:s.Contains(' applewebkit/'),IsOpera:!!window.opera,IsMac:s.Contains('macintosh')};(function(A){A.IsGeckoLike=(A.IsGecko||A.IsSafari||A.IsOpera);if (A.IsGecko){var B=s.match(/gecko\/(\d+)/)[1];A.IsGecko10=((B<20051111)||(/rv:1\.7/.test(s)));A.IsGecko19=/rv:1\.9/.test(s);}else A.IsGecko10=false;})(FCKBrowserInfo); +var FCKURLParams={};(function(){var A=document.location.search.substr(1).split('&');for (var i=0;i';if (!FCKRegexLib.HtmlOpener.test(A)) A=''+A+'';if (!FCKRegexLib.HeadOpener.test(A)) A=A.replace(FCKRegexLib.HtmlOpener,'$&');return A;}else{var B=FCKConfig.DocType+'0&&!FCKRegexLib.Html4DocType.test(FCKConfig.DocType)) B+=' style="overflow-y: scroll"';B+='>'+A+'';return B;}},ConvertToDataFormat:function(A,B,C,D){var E=FCKXHtml.GetXHTML(A,!B,D);if (C&&FCKRegexLib.EmptyOutParagraph.test(E)) return '';return E;},FixHtml:function(A){return A;}}; +var FCK={Name:FCKURLParams['InstanceName'],Status:0,EditMode:0,Toolbar:null,HasFocus:false,DataProcessor:new FCKDataProcessor(),AttachToOnSelectionChange:function(A){this.Events.AttachEvent('OnSelectionChange',A);},GetLinkedFieldValue:function(){return this.LinkedField.value;},GetParentForm:function(){return this.LinkedField.form;},StartupValue:'',IsDirty:function(){if (this.EditMode==1) return (this.StartupValue!=this.EditingArea.Textarea.value);else{if (!this.EditorDocument) return false;return (this.StartupValue!=this.EditorDocument.body.innerHTML);}},ResetIsDirty:function(){if (this.EditMode==1) this.StartupValue=this.EditingArea.Textarea.value;else if (this.EditorDocument.body) this.StartupValue=this.EditorDocument.body.innerHTML;},StartEditor:function(){this.TempBaseTag=FCKConfig.BaseHref.length>0?'':'';var A=FCK.KeystrokeHandler=new FCKKeystrokeHandler();A.OnKeystroke=_FCK_KeystrokeHandler_OnKeystroke;A.SetKeystrokes(FCKConfig.Keystrokes);if (FCKBrowserInfo.IsIE7){if ((CTRL+86/*V*/) in A.Keystrokes) A.SetKeystrokes([CTRL+86,true]);if ((SHIFT+45/*INS*/) in A.Keystrokes) A.SetKeystrokes([SHIFT+45,true]);};A.SetKeystrokes([CTRL+8,true]);this.EditingArea=new FCKEditingArea(document.getElementById('xEditingArea'));this.EditingArea.FFSpellChecker=FCKConfig.FirefoxSpellChecker;this.SetData(this.GetLinkedFieldValue(),true);FCKTools.AddEventListener(document,"keydown",this._TabKeyHandler);this.AttachToOnSelectionChange(_FCK_PaddingNodeListener);if (FCKBrowserInfo.IsGecko) this.AttachToOnSelectionChange(this._ExecCheckEmptyBlock);},Focus:function(){FCK.EditingArea.Focus();},SetStatus:function(A){this.Status=A;if (A==1){FCKFocusManager.AddWindow(window,true);if (FCKBrowserInfo.IsIE) FCKFocusManager.AddWindow(window.frameElement,true);if (FCKConfig.StartupFocus) FCK.Focus();};this.Events.FireEvent('OnStatusChange',A);},FixBody:function(){var A=FCKConfig.EnterMode;if (A!='p'&&A!='div') return;var B=this.EditorDocument;if (!B) return;var C=B.body;if (!C) return;FCKDomTools.TrimNode(C);var D=C.firstChild;var E;while (D){var F=false;switch (D.nodeType){case 1:if (!FCKListsLib.BlockElements[D.nodeName.toLowerCase()]&&!D.getAttribute('_fckfakelement')&&D.getAttribute('_moz_dirty')==null) F=true;break;case 3:if (E||D.nodeValue.Trim().length>0) F=true;};if (F){var G=D.parentNode;if (!E) E=G.insertBefore(B.createElement(A),D);E.appendChild(G.removeChild(D));D=E.nextSibling;}else{if (E){FCKDomTools.TrimNode(E);E=null;};D=D.nextSibling;}};if (E) FCKDomTools.TrimNode(E);},GetData:function(A){if (FCK.EditMode==1) return FCK.EditingArea.Textarea.value;this.FixBody();var B=FCK.EditorDocument;if (!B) return null;var C=FCKConfig.FullPage;var D=FCK.DataProcessor.ConvertToDataFormat(C?B.documentElement:B.body,!C,FCKConfig.IgnoreEmptyParagraphValue,A);D=FCK.ProtectEventsRestore(D);if (FCKBrowserInfo.IsIE) D=D.replace(FCKRegexLib.ToReplace,'$1');if (C){if (FCK.DocTypeDeclaration&&FCK.DocTypeDeclaration.length>0) D=FCK.DocTypeDeclaration+'\n'+D;if (FCK.XmlDeclaration&&FCK.XmlDeclaration.length>0) D=FCK.XmlDeclaration+'\n'+D;};return FCKConfig.ProtectedSource.Revert(D);},UpdateLinkedField:function(){var A=FCK.GetXHTML(FCKConfig.FormatOutput);if (FCKConfig.HtmlEncodeOutput) A=FCKTools.HTMLEncode(A);FCK.LinkedField.value=A;FCK.Events.FireEvent('OnAfterLinkedFieldUpdate');},RegisteredDoubleClickHandlers:{},OnDoubleClick:function(A){var B=FCK.RegisteredDoubleClickHandlers[A.tagName];if (B) B(A);},RegisterDoubleClickHandler:function(A,B){FCK.RegisteredDoubleClickHandlers[B.toUpperCase()]=A;},OnAfterSetHTML:function(){FCKDocumentProcessor.Process(FCK.EditorDocument);FCKUndo.SaveUndoStep();FCK.Events.FireEvent('OnSelectionChange');FCK.Events.FireEvent('OnAfterSetHTML');},ProtectUrls:function(A){A=A.replace(FCKRegexLib.ProtectUrlsA,'$& _fcksavedurl=$1');A=A.replace(FCKRegexLib.ProtectUrlsImg,'$& _fcksavedurl=$1');A=A.replace(FCKRegexLib.ProtectUrlsArea,'$& _fcksavedurl=$1');return A;},ProtectEvents:function(A){return A.replace(FCKRegexLib.TagsWithEvent,_FCK_ProtectEvents_ReplaceTags);},ProtectEventsRestore:function(A){return A.replace(FCKRegexLib.ProtectedEvents,_FCK_ProtectEvents_RestoreEvents);},ProtectTags:function(A){var B=FCKConfig.ProtectedTags;if (FCKBrowserInfo.IsIE) B+=B.length>0?'|ABBR|XML|EMBED':'ABBR|XML|EMBED';var C;if (B.length>0){C=new RegExp('<('+B+')(?!\w|:)','gi');A=A.replace(C,'','gi');A=A.replace(C,'<\/FCK:$1>');};B='META';if (FCKBrowserInfo.IsIE) B+='|HR';C=new RegExp('<(('+B+')(?=\\s|>|/)[\\s\\S]*?)/?>','gi');A=A.replace(C,'');return A;},SetData:function(A,B){this.EditingArea.Mode=FCK.EditMode;if (FCKBrowserInfo.IsIE&&FCK.EditorDocument){FCK.EditorDocument.detachEvent("onselectionchange",Doc_OnSelectionChange);};if (FCK.EditMode==0){this._ForceResetIsDirty=(B===true);A=FCKConfig.ProtectedSource.Protect(A);A=FCK.DataProcessor.ConvertToHtml(A);A=A.replace(FCKRegexLib.InvalidSelfCloseTags,'$1>');A=FCK.ProtectEvents(A);A=FCK.ProtectUrls(A);A=FCK.ProtectTags(A);if (FCK.TempBaseTag.length>0&&!FCKRegexLib.HasBaseTag.test(A)) A=A.replace(FCKRegexLib.HeadOpener,'$&'+FCK.TempBaseTag);var C='';if (!FCKConfig.FullPage) C+=_FCK_GetEditorAreaStyleTags();if (FCKBrowserInfo.IsIE) C+=FCK._GetBehaviorsStyle();else if (FCKConfig.ShowBorders) C+='';C+='';A=A.replace(FCKRegexLib.HeadCloser,C+'$&');this.EditingArea.OnLoad=_FCK_EditingArea_OnLoad;this.EditingArea.Start(A);}else{FCK.EditorWindow=null;FCK.EditorDocument=null;FCKDomTools.PaddingNode=null;this.EditingArea.OnLoad=null;this.EditingArea.Start(A);this.EditingArea.Textarea._FCKShowContextMenu=true;FCK.EnterKeyHandler=null;if (B) this.ResetIsDirty();FCK.KeystrokeHandler.AttachToElement(this.EditingArea.Textarea);this.EditingArea.Textarea.focus();FCK.Events.FireEvent('OnAfterSetHTML');};if (FCKBrowserInfo.IsGecko) window.onresize();},HasFocus:false,RedirectNamedCommands:{},ExecuteNamedCommand:function(A,B,C,D){if (!D) FCKUndo.SaveUndoStep();if (!C&&FCK.RedirectNamedCommands[A]!=null) FCK.ExecuteRedirectedNamedCommand(A,B);else{FCK.Focus();FCK.EditorDocument.execCommand(A,false,B);FCK.Events.FireEvent('OnSelectionChange');};if (!D) FCKUndo.SaveUndoStep();},GetNamedCommandState:function(A){try{if (FCKBrowserInfo.IsSafari&&FCK.EditorWindow&&A.IEquals('Paste')) return 0;if (!FCK.EditorDocument.queryCommandEnabled(A)) return -1;else{return FCK.EditorDocument.queryCommandState(A)?1:0;}}catch (e){return 0;}},GetNamedCommandValue:function(A){var B='';var C=FCK.GetNamedCommandState(A);if (C==-1) return null;try{B=this.EditorDocument.queryCommandValue(A);}catch(e) {};return B?B:'';},Paste:function(A){if (FCK.Status!=2||!FCK.Events.FireEvent('OnPaste')) return false;return A||FCK._ExecPaste();},PasteFromWord:function(){FCKDialog.OpenDialog('FCKDialog_Paste',FCKLang.PasteFromWord,'dialog/fck_paste.html',400,330,'Word');},Preview:function(){var A=FCKConfig.ScreenWidth*0.8;var B=FCKConfig.ScreenHeight*0.7;var C=(FCKConfig.ScreenWidth-A)/2;var D=window.open('',null,'toolbar=yes,location=no,status=yes,menubar=yes,scrollbars=yes,resizable=yes,width='+A+',height='+B+',left='+C);var E;if (FCKConfig.FullPage){if (FCK.TempBaseTag.length>0) E=FCK.TempBaseTag+FCK.GetXHTML();else E=FCK.GetXHTML();}else{E=FCKConfig.DocType+''+FCK.TempBaseTag+''+FCKLang.Preview+''+_FCK_GetEditorAreaStyleTags()+''+FCK.GetXHTML()+'';};D.document.write(E);D.document.close();},SwitchEditMode:function(A){var B=(FCK.EditMode==0);var C=FCK.IsDirty();var D;if (B){FCKCommands.GetCommand('ShowBlocks').SaveState();if (!A&&FCKBrowserInfo.IsIE) FCKUndo.SaveUndoStep();D=FCK.GetXHTML(FCKConfig.FormatSource);if (D==null) return false;}else D=this.EditingArea.Textarea.value;FCK.EditMode=B?1:0;FCK.SetData(D,!C);FCK.Focus();FCKTools.RunFunction(FCK.ToolbarSet.RefreshModeState,FCK.ToolbarSet);return true;},InsertElement:function(A){if (typeof A=='string') A=this.EditorDocument.createElement(A);var B=A.nodeName.toLowerCase();var C=new FCKDomRange(this.EditorWindow);if (FCKListsLib.BlockElements[B]!=null){C.SplitBlock();C.InsertNode(A);var D=FCKDomTools.GetNextSourceElement(A,false,null,['hr','br','param','img','area','input']);if (!D&&FCKConfig.EnterMode!='br'){D=this.EditorDocument.body.appendChild(this.EditorDocument.createElement(FCKConfig.EnterMode));if (FCKBrowserInfo.IsGeckoLike) FCKTools.AppendBogusBr(D);};if (FCKListsLib.EmptyElements[B]==null) C.MoveToElementEditStart(A);else if (D) C.MoveToElementEditStart(D);else C.MoveToPosition(A,4);if (FCKBrowserInfo.IsGecko){if (D) D.scrollIntoView(false);A.scrollIntoView(false);}}else{C.MoveToSelection();C.DeleteContents();C.InsertNode(A);C.SetStart(A,4);C.SetEnd(A,4);};C.Select();C.Release();this.Focus();return A;},_InsertBlockElement:function(A){},_IsFunctionKey:function(A){if (A>=16&&A<=20) return true;if (A==27||(A>=33&&A<=40)) return true;if (A==45) return true;return false;},_KeyDownListener:function(A){if (!A) A=FCK.EditorWindow.event;if (FCK.EditorWindow){if (!FCK._IsFunctionKey(A.keyCode)&&!(A.ctrlKey||A.metaKey)&&!(A.keyCode==46)) FCK._KeyDownUndo();};return true;},_KeyDownUndo:function(){if (!FCKUndo.Typing){FCKUndo.SaveUndoStep();FCKUndo.Typing=true;FCK.Events.FireEvent("OnSelectionChange");};FCKUndo.TypesCount++;FCKUndo.Changed=1;if (FCKUndo.TypesCount>FCKUndo.MaxTypes){FCKUndo.TypesCount=0;FCKUndo.SaveUndoStep();}},_TabKeyHandler:function(A){if (!A) A=window.event;var B=A.keyCode;if (B==9&&FCK.EditMode!=0){if (FCKBrowserInfo.IsIE){var C=document.selection.createRange();if (C.parentElement()!=FCK.EditingArea.Textarea) return true;C.text='\t';C.select();}else{var a=[];var D=FCK.EditingArea.Textarea;var E=D.selectionStart;var F=D.selectionEnd;a.push(D.value.substr(0,E));a.push('\t');a.push(D.value.substr(F));D.value=a.join('');D.setSelectionRange(E+1,E+1);};if (A.preventDefault) return A.preventDefault();return A.returnValue=false;};return true;}};FCK.Events=new FCKEvents(FCK);FCK.GetHTML=FCK.GetXHTML=FCK.GetData;FCK.SetHTML=FCK.SetData;FCK.InsertElementAndGetIt=FCK.CreateElement=FCK.InsertElement;function _FCK_ProtectEvents_ReplaceTags(A){return A.replace(FCKRegexLib.EventAttributes,_FCK_ProtectEvents_ReplaceEvents);};function _FCK_ProtectEvents_ReplaceEvents(A,B){return ' '+B+'_fckprotectedatt="'+encodeURIComponent(A)+'"';};function _FCK_ProtectEvents_RestoreEvents(A,B){return decodeURIComponent(B);};function _FCK_MouseEventsListener(A){if (!A) A=window.event;if (A.type=='mousedown') FCK.MouseDownFlag=true;else if (A.type=='mouseup') FCK.MouseDownFlag=false;else if (A.type=='mousemove') FCK.Events.FireEvent('OnMouseMove',A);};function _FCK_PaddingNodeListener(){if (FCKConfig.EnterMode.IEquals('br')) return;FCKDomTools.EnforcePaddingNode(FCK.EditorDocument,FCKConfig.EnterMode);if (!FCKBrowserInfo.IsIE&&FCKDomTools.PaddingNode){var A=FCK.EditorWindow.getSelection();if (A&&A.rangeCount==1){var B=A.getRangeAt(0);if (B.collapsed&&B.startContainer==FCK.EditorDocument.body&&B.startOffset==0){B.selectNodeContents(FCKDomTools.PaddingNode);B.collapse(true);A.removeAllRanges();A.addRange(B);}}}else if (FCKDomTools.PaddingNode){var C=FCKSelection.GetParentElement();var D=FCKDomTools.PaddingNode;if (C&&C.nodeName.IEquals('body')){if (FCK.EditorDocument.body.childNodes.length==1&&FCK.EditorDocument.body.firstChild==D){var B=FCK.EditorDocument.body.createTextRange();var F=false;if (!D.childNodes.firstChild){D.appendChild(D.ownerDocument.createTextNode('\ufeff'));F=true;};B.moveToElementText(D);B.select();if (F) B.pasteHTML('');}}}};function _FCK_EditingArea_OnLoad(){FCK.EditorWindow=FCK.EditingArea.Window;FCK.EditorDocument=FCK.EditingArea.Document;FCK.InitializeBehaviors();FCK.MouseDownFlag=false;FCKTools.AddEventListener(FCK.EditorDocument,'mousemove',_FCK_MouseEventsListener);FCKTools.AddEventListener(FCK.EditorDocument,'mousedown',_FCK_MouseEventsListener);FCKTools.AddEventListener(FCK.EditorDocument,'mouseup',_FCK_MouseEventsListener);if (FCKBrowserInfo.IsSafari){var A=function(evt){if (!(evt.ctrlKey||evt.metaKey)) return;if (FCK.EditMode!=0) return;switch (evt.keyCode){case 89:FCKUndo.Redo();break;case 90:FCKUndo.Undo();break;}};FCKTools.AddEventListener(FCK.EditorDocument,'keyup',A);};FCK.EnterKeyHandler=new FCKEnterKey(FCK.EditorWindow,FCKConfig.EnterMode,FCKConfig.ShiftEnterMode,FCKConfig.TabSpaces);FCK.KeystrokeHandler.AttachToElement(FCK.EditorDocument);if (FCK._ForceResetIsDirty) FCK.ResetIsDirty();if (FCKBrowserInfo.IsIE&&FCK.HasFocus) FCK.EditorDocument.body.setActive();FCK.OnAfterSetHTML();FCKCommands.GetCommand('ShowBlocks').RestoreState();if (FCK.Status!=0) return;if (FCKConfig.Debug) FCKDebug._GetWindow();FCK.SetStatus(1);};function _FCK_GetEditorAreaStyleTags(){var A='';var B=FCKConfig.EditorAreaCSS;var C=FCKConfig.EditorAreaStyles;for (var i=0;i';if (C&&C.length>0) A+="";return A;};function _FCK_KeystrokeHandler_OnKeystroke(A,B){if (FCK.Status!=2) return false;if (FCK.EditMode==0){switch (B){case 'Paste':return!FCK.Paste();case 'Cut':FCKUndo.SaveUndoStep();return false;}}else{if (B.Equals('Paste','Undo','Redo','SelectAll','Cut')) return false;};var C=FCK.Commands.GetCommand(B);return (C.Execute.apply(C,FCKTools.ArgumentsToArray(arguments,2))!==false);};(function(){var A=window.parent.document;var B=A.getElementById(FCK.Name);var i=0;while (B||i==0){if (B&&B.tagName.toLowerCase().Equals('input','textarea')){FCK.LinkedField=B;break;};B=A.getElementsByName(FCK.Name)[i++];}})();var FCKTempBin={Elements:[],AddElement:function(A){var B=this.Elements.length;this.Elements[B]=A;return B;},RemoveElement:function(A){var e=this.Elements[A];this.Elements[A]=null;return e;},Reset:function(){var i=0;while (i40) return;};var C=function(H){if (H.nodeType!=1) return false;var D=H.tagName.toLowerCase();return (FCKListsLib.BlockElements[D]||FCKListsLib.EmptyElements[D]);};var E=function(){var F=FCK.EditorWindow.getSelection();var G=F.getRangeAt(0);if (!G||!G.collapsed) return;var H=G.endContainer;if (H.nodeType!=3) return;if (H.nodeValue.length!=G.endOffset) return;var I=H.parentNode.tagName.toLowerCase();if (!(I=='a'||(!(FCKListsLib.BlockElements[I]||FCKListsLib.NonEmptyBlockElements[I])&&B==35))) return;var J=FCKTools.GetNextTextNode(H,H.parentNode,C);if (J) return;G=FCK.EditorDocument.createRange();J=FCKTools.GetNextTextNode(H,H.parentNode.parentNode,C);if (J){if (FCKBrowserInfo.IsOpera&&B==37) return;G.setStart(J,0);G.setEnd(J,0);}else{while (H.parentNode&&H.parentNode!=FCK.EditorDocument.body&&H.parentNode!=FCK.EditorDocument.documentElement&&H==H.parentNode.lastChild&&(!FCKListsLib.BlockElements[H.parentNode.tagName.toLowerCase()]&&!FCKListsLib.NonEmptyBlockElements[H.parentNode.tagName.toLowerCase()])) H=H.parentNode;if (FCKListsLib.BlockElements[I]||FCKListsLib.EmptyElements[I]||H==FCK.EditorDocument.body){G.setStart(H,H.childNodes.length);G.setEnd(H,H.childNodes.length);}else{var K=H.nextSibling;while (K){if (K.nodeType!=1){K=K.nextSibling;continue;};var L=K.tagName.toLowerCase();if (FCKListsLib.BlockElements[L]||FCKListsLib.EmptyElements[L]||FCKListsLib.NonEmptyBlockElements[L]) break;K=K.nextSibling;};var M=FCK.EditorDocument.createTextNode('');if (K) H.parentNode.insertBefore(M,K);else H.parentNode.appendChild(M);G.setStart(M,0);G.setEnd(M,0);}};F.removeAllRanges();F.addRange(G);FCK.Events.FireEvent("OnSelectionChange");};setTimeout(E,1);};this.ExecOnSelectionChangeTimer=function(){if (FCK.LastOnChangeTimer) window.clearTimeout(FCK.LastOnChangeTimer);FCK.LastOnChangeTimer=window.setTimeout(FCK.ExecOnSelectionChange,100);};this.EditorDocument.addEventListener('mouseup',this.ExecOnSelectionChange,false);this.EditorDocument.addEventListener('keyup',this.ExecOnSelectionChangeTimer,false);this._DblClickListener=function(e){FCK.OnDoubleClick(e.target);e.stopPropagation();};this.EditorDocument.addEventListener('dblclick',this._DblClickListener,true);this.EditorDocument.addEventListener('keydown',this._KeyDownListener,false);if (FCKBrowserInfo.IsGecko){this.EditorWindow.addEventListener('dragdrop',this._ExecDrop,true);}else if (FCKBrowserInfo.IsSafari){var N=function(evt){ if (!FCK.MouseDownFlag) evt.returnValue=false;};this.EditorDocument.addEventListener('dragenter',N,true);this.EditorDocument.addEventListener('dragover',N,true);this.EditorDocument.addEventListener('drop',this._ExecDrop,true);this.EditorDocument.addEventListener('mousedown',function(ev){var O=ev.srcElement;if (O.nodeName.IEquals('IMG','HR','INPUT','TEXTAREA','SELECT')){FCKSelection.SelectNode(O);}},true);this.EditorDocument.addEventListener('mouseup',function(ev){if (ev.srcElement.nodeName.IEquals('INPUT','TEXTAREA','SELECT')) ev.preventDefault()},true);this.EditorDocument.addEventListener('click',function(ev){if (ev.srcElement.nodeName.IEquals('INPUT','TEXTAREA','SELECT')) ev.preventDefault()},true);};if (FCKBrowserInfo.IsGecko||FCKBrowserInfo.IsOpera){this.EditorDocument.addEventListener('keypress',this._ExecCheckCaret,false);this.EditorDocument.addEventListener('click',this._ExecCheckCaret,false);};FCK.ContextMenu._InnerContextMenu.SetMouseClickWindow(FCK.EditorWindow);FCK.ContextMenu._InnerContextMenu.AttachToElement(FCK.EditorDocument);};FCK.MakeEditable=function(){this.EditingArea.MakeEditable();};function Document_OnContextMenu(e){if (!e.target._FCKShowContextMenu) e.preventDefault();};document.oncontextmenu=Document_OnContextMenu;FCK._BaseGetNamedCommandState=FCK.GetNamedCommandState;FCK.GetNamedCommandState=function(A){switch (A){case 'Unlink':return FCKSelection.HasAncestorNode('A')?0:-1;default:return FCK._BaseGetNamedCommandState(A);}};FCK.RedirectNamedCommands={Print:true,Paste:true,Cut:true,Copy:true};FCK.ExecuteRedirectedNamedCommand=function(A,B){switch (A){case 'Print':FCK.EditorWindow.print();break;case 'Paste':try{if (FCKBrowserInfo.IsSafari) throw '';if (FCK.Paste()) FCK.ExecuteNamedCommand('Paste',null,true);}catch (e) { FCKDialog.OpenDialog('FCKDialog_Paste',FCKLang.Paste,'dialog/fck_paste.html',400,330,'Security');};break;case 'Cut':try { FCK.ExecuteNamedCommand('Cut',null,true);}catch (e) { alert(FCKLang.PasteErrorCut);};break;case 'Copy':try { FCK.ExecuteNamedCommand('Copy',null,true);}catch (e) { alert(FCKLang.PasteErrorCopy);};break;default:FCK.ExecuteNamedCommand(A,B);}};FCK._ExecPaste=function(){FCKUndo.SaveUndoStep();if (FCKConfig.ForcePasteAsPlainText){FCK.PasteAsPlainText();return false;};return true;};FCK.InsertHtml=function(A){A=FCKConfig.ProtectedSource.Protect(A);A=FCK.ProtectEvents(A);A=FCK.ProtectUrls(A);A=FCK.ProtectTags(A);FCKUndo.SaveUndoStep();this.EditorDocument.execCommand('inserthtml',false,A);this.Focus();this.Events.FireEvent("OnSelectionChange");};FCK.PasteAsPlainText=function(){FCKTools.RunFunction(FCKDialog.OpenDialog,FCKDialog,['FCKDialog_Paste',FCKLang.PasteAsText,'dialog/fck_paste.html',400,330,'PlainText']);};FCK.GetClipboardHTML=function(){return '';};FCK.CreateLink=function(A,B){var C=[];FCK.ExecuteNamedCommand('Unlink',null,false,!!B);if (A.length>0){var D='javascript:void(0);/*'+(new Date().getTime())+'*/';FCK.ExecuteNamedCommand('CreateLink',D,false,!!B);var E=this.EditorDocument.evaluate("//a[@href='"+D+"']",this.EditorDocument.body,null,XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,null);for (var i=0;i0&&!isNaN(E)) this.PageConfig[D]=parseInt(E,10);else this.PageConfig[D]=E;}};function FCKConfig_LoadPageConfig(){var A=FCKConfig.PageConfig;for (var B in A) FCKConfig[B]=A[B];};function FCKConfig_PreProcess(){var A=FCKConfig;if (A.AllowQueryStringDebug){try{if ((/fckdebug=true/i).test(window.top.location.search)) A.Debug=true;}catch (e) {/*Ignore it. Much probably we are inside a FRAME where the "top" is in another domain (security error).*/}};if (!A.PluginsPath.EndsWith('/')) A.PluginsPath+='/';if (typeof(A.EditorAreaCSS)=='string') A.EditorAreaCSS=A.EditorAreaCSS.split(',');var B=A.ToolbarComboPreviewCSS;if (!B||B.length==0) A.ToolbarComboPreviewCSS=A.EditorAreaCSS;else if (typeof(B)=='string') A.ToolbarComboPreviewCSS=[B];};FCKConfig.ToolbarSets={};FCKConfig.Plugins={};FCKConfig.Plugins.Items=[];FCKConfig.Plugins.Add=function(A,B,C){FCKConfig.Plugins.Items.AddItem([A,B,C]);};FCKConfig.ProtectedSource={};FCKConfig.ProtectedSource._CodeTag=(new Date()).valueOf();FCKConfig.ProtectedSource.RegexEntries=[//g,//gi,//gi,//gi];FCKConfig.ProtectedSource.Add=function(A){this.RegexEntries.AddItem(A);};FCKConfig.ProtectedSource.Protect=function(A){var B=this._CodeTag;function _Replace(protectedSource){var C=FCKTempBin.AddElement(protectedSource);return '';};for (var i=0;i|>)","g");return A.replace(D,_Replace);};FCKConfig.GetBodyAttributes=function(){var A='';if (this.BodyId&&this.BodyId.length>0) A+=' id="'+this.BodyId+'"';if (this.BodyClass&&this.BodyClass.length>0) A+=' class="'+this.BodyClass+'"';return A;};FCKConfig.ApplyBodyAttributes=function(A){if (this.BodyId&&this.BodyId.length>0) A.id=FCKConfig.BodyId;if (this.BodyClass&&this.BodyClass.length>0) A.className+=' '+FCKConfig.BodyClass;}; +var FCKDebug={};FCKDebug._GetWindow=function(){if (!this.DebugWindow||this.DebugWindow.closed) this.DebugWindow=window.open(FCKConfig.BasePath+'fckdebug.html','FCKeditorDebug','menubar=no,scrollbars=yes,resizable=yes,location=no,toolbar=no,width=600,height=500',true);return this.DebugWindow;};FCKDebug.Output=function(A,B,C){if (!FCKConfig.Debug) return;try{this._GetWindow().Output(A,B);}catch (e) {}};FCKDebug.OutputObject=function(A,B){if (!FCKConfig.Debug) return;try{this._GetWindow().OutputObject(A,B);}catch (e) {}} +var FCKDomTools={MoveChildren:function(A,B,C){if (A==B) return;var D;if (C){while ((D=A.lastChild)) B.insertBefore(A.removeChild(D),B.firstChild);}else{while ((D=A.firstChild)) B.appendChild(A.removeChild(D));}},MoveNode:function(A,B,C){if (C) B.insertBefore(FCKDomTools.RemoveNode(A),B.firstChild);else B.appendChild(FCKDomTools.RemoveNode(A));},TrimNode:function(A){this.LTrimNode(A);this.RTrimNode(A);},LTrimNode:function(A){var B;while ((B=A.firstChild)){if (B.nodeType==3){var C=B.nodeValue.LTrim();var D=B.nodeValue.length;if (C.length==0){A.removeChild(B);continue;}else if (C.length0) break;if (A.lastChild) A=A.lastChild;else return this.GetPreviousSourceElement(A,B,C,D);};return null;},GetNextSourceElement:function(A,B,C,D,E){while((A=this.GetNextSourceNode(A,E))){if (A.nodeType==1){if (C&&A.nodeName.IEquals(C)) break;if (D&&A.nodeName.IEquals(D)) return this.GetNextSourceElement(A,B,C,D);return A;}else if (B&&A.nodeType==3&&A.nodeValue.RTrim().length>0) break;};return null;},GetNextSourceNode:function(A,B,C,D){if (!A) return null;var E;if (!B&&A.firstChild) E=A.firstChild;else{if (D&&A==D) return null;E=A.nextSibling;if (!E&&(!D||D!=A.parentNode)) return this.GetNextSourceNode(A.parentNode,true,C,D);};if (C&&E&&E.nodeType!=C) return this.GetNextSourceNode(E,false,C,D);return E;},GetPreviousSourceNode:function(A,B,C,D){if (!A) return null;var E;if (!B&&A.lastChild) E=A.lastChild;else{if (D&&A==D) return null;E=A.previousSibling;if (!E&&(!D||D!=A.parentNode)) return this.GetPreviousSourceNode(A.parentNode,true,C,D);};if (C&&E&&E.nodeType!=C) return this.GetPreviousSourceNode(E,false,C,D);return E;},InsertAfterNode:function(A,B){return A.parentNode.insertBefore(B,A.nextSibling);},GetParents:function(A){var B=[];while (A){B.unshift(A);A=A.parentNode;};return B;},GetCommonParents:function(A,B){var C=this.GetParents(A);var D=this.GetParents(B);var E=[];for (var i=0;i0) D[C.pop().toLowerCase()]=1;var E=this.GetCommonParents(A,B);var F=null;while ((F=E.pop())){if (D[F.nodeName.toLowerCase()]) return F;};return null;},GetIndexOf:function(A){var B=A.parentNode?A.parentNode.firstChild:null;var C=-1;while (B){C++;if (B==A) return C;B=B.nextSibling;};return-1;},PaddingNode:null,EnforcePaddingNode:function(A,B){try{if (!A||!A.body) return;}catch (e){return;};this.CheckAndRemovePaddingNode(A,B,true);try{if (A.body.lastChild&&(A.body.lastChild.nodeType!=1||A.body.lastChild.tagName.toLowerCase()==B.toLowerCase())) return;}catch (e){return;};var C=A.createElement(B);if (FCKBrowserInfo.IsGecko&&FCKListsLib.NonEmptyBlockElements[B]) FCKTools.AppendBogusBr(C);this.PaddingNode=C;if (A.body.childNodes.length==1&&A.body.firstChild.nodeType==1&&A.body.firstChild.tagName.toLowerCase()=='br'&&(A.body.firstChild.getAttribute('_moz_dirty')!=null||A.body.firstChild.getAttribute('type')=='_moz')) A.body.replaceChild(C,A.body.firstChild);else A.body.appendChild(C);},CheckAndRemovePaddingNode:function(A,B,C){var D=this.PaddingNode;if (!D) return;try{if (D.parentNode!=A.body||D.tagName.toLowerCase()!=B||(D.childNodes.length>1)||(D.firstChild&&D.firstChild.nodeValue!='\xa0'&&String(D.firstChild.tagName).toLowerCase()!='br')){this.PaddingNode=null;return;}}catch (e){this.PaddingNode=null;return;};if (!C){if (D.parentNode.childNodes.length>1) D.parentNode.removeChild(D);this.PaddingNode=null;}},HasAttribute:function(A,B){if (A.hasAttribute) return A.hasAttribute(B);else{var C=A.attributes[B];return (C!=undefined&&C.specified);}},HasAttributes:function(A){var B=A.attributes;for (var i=0;i0) return true;}else if (B[i].specified) return true;};return false;},RemoveAttribute:function(A,B){if (FCKBrowserInfo.IsIE&&B.toLowerCase()=='class') B='className';return A.removeAttribute(B,0);},GetAttributeValue:function(A,B){var C=B;if (typeof B=='string') B=A.attributes[B];else C=B.nodeName;if (B&&B.specified){if (C=='style') return A.style.cssText;else if (C=='class'||C.indexOf('on')==0) return B.nodeValue;else{return A.getAttribute(C,2);}};return null;},Contains:function(A,B){if (A.contains&&B.nodeType==1) return A.contains(B);while ((B=B.parentNode)){if (B==A) return true;};return false;},BreakParent:function(A,B,C){var D=C||new FCKDomRange(FCKTools.GetElementWindow(A));D.SetStart(A,4);D.SetEnd(B,4);var E=D.ExtractContents();D.InsertNode(A.parentNode.removeChild(A));E.InsertAfterNode(A);D.Release(!!C);},GetNodeAddress:function(A,B){var C=[];while (A&&A!=A.ownerDocument.documentElement){var D=A.parentNode;var E=-1;for(var i=0;i0) return false;C=C.nextSibling;};return D?this.CheckIsEmptyElement(D,B):true;},SetElementStyles:function(A,B){var C=A.style;for (var D in B) C[D]=B[D];},GetCurrentElementStyle:function(w,A,B){if (FCKBrowserInfo.IsIE) return A.currentStyle[B];else return w.getComputedStyle(A,'')[B];},GetPositionedAncestor:function(w,A){var B=A;while (B!=B.ownerDocument.documentElement){if (this.GetCurrentElementStyle(w,B,'position')!='static') return B;B=B.parentNode;};return null;},ScrollIntoView:function(A,B){var C=FCKTools.GetElementWindow(A);var D=FCKTools.GetViewPaneSize(C).Height;var E=D*-1;if (B===false){E+=A.offsetHeight;E+=parseInt(this.GetCurrentElementStyle(C,A,'marginBottom')||0,10);};E+=A.offsetTop;while ((A=A.offsetParent)) E+=A.offsetTop||0;var F=FCKTools.GetScrollPosition(C).Y;if (E>0&&E>F) C.scrollTo(0,E);}}; +var FCKTools={};FCKTools.CreateBogusBR=function(A){var B=A.createElement('br');B.setAttribute('type','_moz');return B;};FCKTools.AppendStyleSheet=function(A,B){if (typeof(B)=='string') return this._AppendStyleSheet(A,B);else{var C=[];for (var i=0;i/g,'>');return A;};FCKTools.HTMLDecode=function(A){if (!A) return '';A=A.replace(/>/g,'>');A=A.replace(/</g,'<');A=A.replace(/&/g,'&');return A;};FCKTools._ProcessLineBreaksForPMode=function(A,B,C,D,E){var F=0;var G="

";var H="

";var I="
";if (C){G="
  • ";H="
  • ";F=1;};while (D&&D!=A.FCK.EditorDocument.body){if (D.tagName.toLowerCase()=='p'){F=1;break;};D=D.parentNode;};for (var i=0;i0) return A[A.length-1];return null;};FCKTools.GetDocumentPosition=function(w,A){var x=0;var y=0;var B=A;var C=null;var D=FCKTools.GetElementWindow(B);while (B&&!(D==w&&(B==w.document.body||B==w.document.documentElement))){x+=B.offsetLeft-B.scrollLeft;y+=B.offsetTop-B.scrollTop;if (!FCKBrowserInfo.IsOpera){var E=C;while (E&&E!=B){x-=E.scrollLeft;y-=E.scrollTop;E=E.parentNode;}};C=B;if (B.offsetParent) B=B.offsetParent;else{if (D!=w){B=D.frameElement;C=null;if (B) D=FCKTools.GetElementWindow(B);}else B=null;}};if (FCKDomTools.GetCurrentElementStyle(w,w.document.body,'position')!='static'||(FCKBrowserInfo.IsIE&&FCKDomTools.GetPositionedAncestor(w,A)==null)){x+=w.document.body.offsetLeft;y+=w.document.body.offsetTop;};return { "x":x,"y":y };};FCKTools.GetWindowPosition=function(w,A){var B=this.GetDocumentPosition(w,A);var C=FCKTools.GetScrollPosition(w);B.x-=C.X;B.y-=C.Y;return B;};FCKTools.ProtectFormStyles=function(A){if (!A||A.nodeType!=1||A.tagName.toLowerCase()!='form') return [];var B=[];var C=['style','className'];for (var i=0;i0){for (var i=B.length-1;i>=0;i--){var C=B[i][0];var D=B[i][1];if (D) A.insertBefore(C,D);else A.appendChild(C);}}};FCKTools.GetNextNode=function(A,B){if (A.firstChild) return A.firstChild;else if (A.nextSibling) return A.nextSibling;else{var C=A.parentNode;while (C){if (C==B) return null;if (C.nextSibling) return C.nextSibling;else C=C.parentNode;}};return null;};FCKTools.GetNextTextNode=function(A,B,C){node=this.GetNextNode(A,B);if (C&&node&&C(node)) return null;while (node&&node.nodeType!=3){node=this.GetNextNode(node,B);if (C&&node&&C(node)) return null;};return node;};FCKTools.Merge=function(){var A=arguments;var o=A[0];for (var i=1;i0) B[B.length]=D;C(parent.childNodes[i]);}};C(A);return B;};FCKTools.RemoveOuterTags=function(e){var A=e.ownerDocument.createDocumentFragment();for (var i=0;i0){C.Class=A.className;A.className='';};var D=A.getAttribute('style');if (D&&D.length>0){C.Inline=D;A.setAttribute('style','',0);};FCKTools.RestoreFormStyles(A,B);return C;};FCKTools.RestoreStyles=function(A,B){var C=FCKTools.ProtectFormStyles(A);A.className=B.Class||'';if (B.Inline) A.setAttribute('style',B.Inline,0);else A.removeAttribute('style',0);FCKTools.RestoreFormStyles(A,C);};FCKTools.RegisterDollarFunction=function(A){A.$=function(id){return this.document.getElementById(id);};};FCKTools.AppendElement=function(A,B){return A.appendChild(A.ownerDocument.createElement(B));};FCKTools.GetElementPosition=function(A,B){var c={ X:0,Y:0 };var C=B||window;var D=FCKTools.GetElementWindow(A);var E=null;while (A){var F=D.getComputedStyle(A,'').position;if (F&&F!='static'&&A.style.zIndex!=FCKConfig.FloatingPanelsZIndex) break;c.X+=A.offsetLeft-A.scrollLeft;c.Y+=A.offsetTop-A.scrollTop;if (!FCKBrowserInfo.IsOpera){var G=E;while (G&&G!=A){c.X-=G.scrollLeft;c.Y-=G.scrollTop;G=G.parentNode;}};E=A;if (A.offsetParent) A=A.offsetParent;else{if (D!=C){A=D.frameElement;E=null;if (A) D=FCKTools.GetElementWindow(A);}else{c.X+=A.scrollLeft;c.Y+=A.scrollTop;break;}}};return c;}; +var FCKeditorAPI;function InitializeAPI(){var A=window.parent;if (!(FCKeditorAPI=A.FCKeditorAPI)){var B='var FCKeditorAPI = {Version : "2.5.1",VersionBuild : "17566",__Instances : new Object(),GetInstance : function( name ){return this.__Instances[ name ];},_FormSubmit : function(){for ( var name in FCKeditorAPI.__Instances ){var oEditor = FCKeditorAPI.__Instances[ name ] ; if(oEditor.LinkedField.form != null) if ( oEditor.GetParentForm && oEditor.GetParentForm() == this )oEditor.UpdateLinkedField() ;}this._FCKOriginalSubmit() ;},_FunctionQueue : {Functions : new Array(),IsRunning : false,Add : function( f ){this.Functions.push( f );if ( !this.IsRunning )this.StartNext();},StartNext : function(){var aQueue = this.Functions ;if ( aQueue.length > 0 ){this.IsRunning = true;aQueue[0].call();}else this.IsRunning = false;},Remove : function( f ){var aQueue = this.Functions;var i = 0, fFunc;while( (fFunc = aQueue[ i ]) ){if ( fFunc == f )aQueue.splice( i,1 );i++ ;}this.StartNext();}}}';if (A.execScript) A.execScript(B,'JavaScript');else{if (FCKBrowserInfo.IsGecko10){eval.call(A,B);}else if (FCKBrowserInfo.IsSafari||FCKBrowserInfo.IsGecko19){var C=A.document;var D=C.createElement('script');D.appendChild(C.createTextNode(B));C.documentElement.appendChild(D);}else A.eval(B);};FCKeditorAPI=A.FCKeditorAPI;};FCKeditorAPI.__Instances[FCK.Name]=FCK;};function _AttachFormSubmitToAPI(){var A=FCK.GetParentForm();if (A){FCKTools.AddEventListener(A,'submit',FCK.UpdateLinkedField);if (!A._FCKOriginalSubmit&&(typeof(A.submit)=='function'||(!A.submit.tagName&&!A.submit.length))){A._FCKOriginalSubmit=A.submit;A.submit=FCKeditorAPI._FormSubmit;}}};function FCKeditorAPI_Cleanup(){if (!window.FCKUnloadFlag) return;delete FCKeditorAPI.__Instances[FCK.Name];};function FCKeditorAPI_ConfirmCleanup(){window.FCKUnloadFlag=true;};FCKTools.AddEventListener(window,'unload',FCKeditorAPI_Cleanup);FCKTools.AddEventListener(window,'beforeunload',FCKeditorAPI_ConfirmCleanup); +var FCKImagePreloader=function(){this._Images=[];};FCKImagePreloader.prototype={AddImages:function(A){if (typeof(A)=='string') A=A.split(';');this._Images=this._Images.concat(A);},Start:function(){var A=this._Images;this._PreloadCount=A.length;for (var i=0;i]*\>)/i,AfterBody:/(\<\/body\>[\s\S]*$)/i,ToReplace:/___fcktoreplace:([\w]+)/ig,MetaHttpEquiv:/http-equiv\s*=\s*["']?([^"' ]+)/i,HasBaseTag:/]/i,HtmlOpener:/]*>/i,HeadOpener:/]*>/i,HeadCloser:/<\/head\s*>/i,FCK_Class:/\s*FCK__[^ ]*(?=\s+|$)/,ElementName:/(^[a-z_:][\w.\-:]*\w$)|(^[a-z_]$)/,ForceSimpleAmpersand:/___FCKAmp___/g,SpaceNoClose:/\/>/g,EmptyParagraph:/^<(p|div|address|h\d|center)(?=[ >])[^>]*>\s*(<\/\1>)?$/,EmptyOutParagraph:/^<(p|div|address|h\d|center)(?=[ >])[^>]*>(?:\s*| )(<\/\1>)?$/,TagBody:/>]+))/gi,ProtectUrlsA:/]+))/gi,ProtectUrlsArea:/]+))/gi,Html4DocType:/HTML 4\.0 Transitional/i,DocTypeTag:/]*>/i,TagsWithEvent:/<[^\>]+ on\w+[\s\r\n]*=[\s\r\n]*?('|")[\s\S]+?\>/g,EventAttributes:/\s(on\w+)[\s\r\n]*=[\s\r\n]*?('|")([\s\S]*?)\2/g,ProtectedEvents:/\s\w+_fckprotectedatt="([^"]+)"/g,StyleProperties:/\S+\s*:/g,InvalidSelfCloseTags:/(<(?!base|meta|link|hr|br|param|img|area|input)([a-zA-Z0-9:]+)[^>]*)\/>/gi,StyleVariableAttName:/#\(\s*("|')(.+?)\1[^\)]*\s*\)/g,RegExp:/^\/(.*)\/([gim]*)$/}; +var FCKListsLib={BlockElements:{ address:1,blockquote:1,center:1,div:1,dl:1,fieldset:1,form:1,h1:1,h2:1,h3:1,h4:1,h5:1,h6:1,hr:1,marquee:1,noscript:1,ol:1,p:1,pre:1,script:1,table:1,ul:1 },NonEmptyBlockElements:{ p:1,div:1,form:1,h1:1,h2:1,h3:1,h4:1,h5:1,h6:1,address:1,pre:1,ol:1,ul:1,li:1,td:1,th:1 },InlineChildReqElements:{ abbr:1,acronym:1,b:1,bdo:1,big:1,cite:1,code:1,del:1,dfn:1,em:1,font:1,i:1,ins:1,label:1,kbd:1,q:1,samp:1,small:1,span:1,strike:1,strong:1,sub:1,sup:1,tt:1,u:1,'var':1 },InlineNonEmptyElements:{ a:1,abbr:1,acronym:1,b:1,bdo:1,big:1,cite:1,code:1,del:1,dfn:1,em:1,font:1,i:1,ins:1,label:1,kbd:1,q:1,samp:1,small:1,span:1,strike:1,strong:1,sub:1,sup:1,tt:1,u:1,'var':1 },EmptyElements:{ base:1,col:1,meta:1,link:1,hr:1,br:1,param:1,img:1,area:1,input:1 },PathBlockElements:{ address:1,blockquote:1,dl:1,h1:1,h2:1,h3:1,h4:1,h5:1,h6:1,p:1,pre:1,li:1,dt:1,de:1 },PathBlockLimitElements:{ body:1,div:1,td:1,th:1,caption:1,form:1 },StyleBlockElements:{ address:1,div:1,h1:1,h2:1,h3:1,h4:1,h5:1,h6:1,p:1,pre:1 },StyleObjectElements:{ img:1,hr:1,li:1,table:1,tr:1,td:1,embed:1,object:1,ol:1,ul:1 },BlockBoundaries:{ p:1,div:1,h1:1,h2:1,h3:1,h4:1,h5:1,h6:1,hr:1,address:1,pre:1,ol:1,ul:1,li:1,dt:1,de:1,table:1,thead:1,tbody:1,tfoot:1,tr:1,th:1,td:1,caption:1,col:1,colgroup:1,blockquote:1,body:1 },ListBoundaries:{ p:1,div:1,h1:1,h2:1,h3:1,h4:1,h5:1,h6:1,hr:1,address:1,pre:1,ol:1,ul:1,li:1,dt:1,de:1,table:1,thead:1,tbody:1,tfoot:1,tr:1,th:1,td:1,caption:1,col:1,colgroup:1,blockquote:1,body:1,br:1 }}; +var FCKLanguageManager=FCK.Language={AvailableLanguages:{af:'Afrikaans',ar:'Arabic',bg:'Bulgarian',bn:'Bengali/Bangla',bs:'Bosnian',ca:'Catalan',cs:'Czech',da:'Danish',de:'German',el:'Greek',en:'English','en-au':'English (Australia)','en-ca':'English (Canadian)','en-uk':'English (United Kingdom)',eo:'Esperanto',es:'Spanish',et:'Estonian',eu:'Basque',fa:'Persian',fi:'Finnish',fo:'Faroese',fr:'French',gl:'Galician',he:'Hebrew',hi:'Hindi',hr:'Croatian',hu:'Hungarian',it:'Italian',ja:'Japanese',km:'Khmer',ko:'Korean',lt:'Lithuanian',lv:'Latvian',mn:'Mongolian',ms:'Malay',nb:'Norwegian Bokmal',nl:'Dutch',no:'Norwegian',pl:'Polish',pt:'Portuguese (Portugal)','pt-br':'Portuguese (Brazil)',ro:'Romanian',ru:'Russian',sk:'Slovak',sl:'Slovenian',sr:'Serbian (Cyrillic)','sr-latn':'Serbian (Latin)',sv:'Swedish',th:'Thai',tr:'Turkish',uk:'Ukrainian',vi:'Vietnamese',zh:'Chinese Traditional','zh-cn':'Chinese Simplified'},GetActiveLanguage:function(){if (FCKConfig.AutoDetectLanguage){var A;if (navigator.userLanguage) A=navigator.userLanguage.toLowerCase();else if (navigator.language) A=navigator.language.toLowerCase();else{return FCKConfig.DefaultLanguage;};if (A.length>=5){A=A.substr(0,5);if (this.AvailableLanguages[A]) return A;};if (A.length>=2){A=A.substr(0,2);if (this.AvailableLanguages[A]) return A;}};return this.DefaultLanguage;},TranslateElements:function(A,B,C,D){var e=A.getElementsByTagName(B);var E,s;for (var i=0;i0) C+='|'+FCKConfig.AdditionalNumericEntities;FCKXHtmlEntities.EntitiesRegex=new RegExp(C,'g');}; +var FCKXHtml={};FCKXHtml.CurrentJobNum=0;FCKXHtml.GetXHTML=function(A,B,C){FCKDomTools.CheckAndRemovePaddingNode(A.ownerDocument,FCKConfig.EnterMode);FCKXHtmlEntities.Initialize();this._NbspEntity=(FCKConfig.ProcessHTMLEntities?'nbsp':'#160');var D=FCK.IsDirty();FCKXHtml.SpecialBlocks=[];this.XML=FCKTools.CreateXmlObject('DOMDocument');this.MainNode=this.XML.appendChild(this.XML.createElement('xhtml'));FCKXHtml.CurrentJobNum++;if (B) this._AppendNode(this.MainNode,A);else this._AppendChildNodes(this.MainNode,A,false);var E=this._GetMainXmlString();this.XML=null;if (FCKBrowserInfo.IsSafari) E=E.replace(/^/,'');E=E.substr(7,E.length-15).Trim();E=E.replace(FCKRegexLib.SpaceNoClose,' />');if (FCKConfig.ForceSimpleAmpersand) E=E.replace(FCKRegexLib.ForceSimpleAmpersand,'&');if (C) E=FCKCodeFormatter.Format(E);for (var i=0;i0;if (C) A.appendChild(this.XML.createTextNode(B.replace(FCKXHtmlEntities.EntitiesRegex,FCKXHtml_GetEntity)));return C;};function FCKXHtml_GetEntity(A){var B=FCKXHtmlEntities.Entities[A]||('#'+A.charCodeAt(0));return '#?-:'+B+';';};FCKXHtml.TagProcessors={a:function(A,B){if (B.innerHTML.Trim().length==0&&!B.name) return false;var C=B.getAttribute('_fcksavedurl');if (C!=null) FCKXHtml._AppendAttribute(A,'href',C);if (FCKBrowserInfo.IsIE){if (B.name) FCKXHtml._AppendAttribute(A,'name',B.name);};A=FCKXHtml._AppendChildNodes(A,B,false);return A;},area:function(A,B){var C=B.getAttribute('_fcksavedurl');if (C!=null) FCKXHtml._AppendAttribute(A,'href',C);if (FCKBrowserInfo.IsIE){if (!A.attributes.getNamedItem('coords')){var D=B.getAttribute('coords',2);if (D&&D!='0,0,0') FCKXHtml._AppendAttribute(A,'coords',D);};if (!A.attributes.getNamedItem('shape')){var E=B.getAttribute('shape',2);if (E&&E.length>0) FCKXHtml._AppendAttribute(A,'shape',E.toLowerCase());}};return A;},body:function(A,B){A=FCKXHtml._AppendChildNodes(A,B,false);A.removeAttribute('spellcheck');return A;},iframe:function(A,B){var C=B.innerHTML;if (FCKBrowserInfo.IsGecko) C=FCKTools.HTMLDecode(C);C=C.replace(/\s_fcksavedurl="[^"]*"/g,'');A.appendChild(FCKXHtml.XML.createTextNode(FCKXHtml._AppendSpecialItem(C)));return A;},img:function(A,B){if (!A.attributes.getNamedItem('alt')) FCKXHtml._AppendAttribute(A,'alt','');var C=B.getAttribute('_fcksavedurl');if (C!=null) FCKXHtml._AppendAttribute(A,'src',C);return A;},ol:function(A,B,C){if (B.innerHTML.Trim().length==0) return false;var D=C.lastChild;if (D&&D.nodeType==3) D=D.previousSibling;if (D&&D.nodeName.toUpperCase()=='LI'){B._fckxhtmljob=null;FCKXHtml._AppendNode(D,B);return false;};A=FCKXHtml._AppendChildNodes(A,B);return A;},pre:function (A,B){var C=B.firstChild;if (C&&C.nodeType==3) A.appendChild(FCKXHtml.XML.createTextNode(FCKXHtml._AppendSpecialItem('\r\n')));FCKXHtml._AppendChildNodes(A,B,true);return A;},script:function(A,B){if (!A.attributes.getNamedItem('type')) FCKXHtml._AppendAttribute(A,'type','text/javascript');A.appendChild(FCKXHtml.XML.createTextNode(FCKXHtml._AppendSpecialItem(B.text)));return A;},span:function(A,B){if (B.innerHTML.length==0) return false;A=FCKXHtml._AppendChildNodes(A,B,false);return A;},style:function(A,B){if (!A.attributes.getNamedItem('type')) FCKXHtml._AppendAttribute(A,'type','text/css');var C=B.innerHTML;if (FCKBrowserInfo.IsIE) C=C.replace(/^(\r\n|\n|\r)/,'');A.appendChild(FCKXHtml.XML.createTextNode(FCKXHtml._AppendSpecialItem(C)));return A;},title:function(A,B){A.appendChild(FCKXHtml.XML.createTextNode(FCK.EditorDocument.title));return A;}};FCKXHtml.TagProcessors.ul=FCKXHtml.TagProcessors.ol; +FCKXHtml._GetMainXmlString=function(){var A=new XMLSerializer();return A.serializeToString(this.MainNode);};FCKXHtml._AppendAttributes=function(A,B,C){var D=B.attributes;for (var n=0;n]*\>/gi;A.BlocksCloser=/\<\/(P|DIV|H1|H2|H3|H4|H5|H6|ADDRESS|PRE|OL|UL|LI|TITLE|META|LINK|BASE|SCRIPT|LINK|TD|TH|AREA|OPTION)[^\>]*\>/gi;A.NewLineTags=/\<(BR|HR)[^\>]*\>/gi;A.MainTags=/\<\/?(HTML|HEAD|BODY|FORM|TABLE|TBODY|THEAD|TR)[^\>]*\>/gi;A.LineSplitter=/\s*\n+\s*/g;A.IncreaseIndent=/^\<(HTML|HEAD|BODY|FORM|TABLE|TBODY|THEAD|TR|UL|OL)[ \/\>]/i;A.DecreaseIndent=/^\<\/(HTML|HEAD|BODY|FORM|TABLE|TBODY|THEAD|TR|UL|OL)[ \>]/i;A.FormatIndentatorRemove=new RegExp('^'+FCKConfig.FormatIndentator);A.ProtectedTags=/(]*>)([\s\S]*?)(<\/PRE>)/gi;};FCKCodeFormatter._ProtectData=function(A,B,C,D){return B+'___FCKpd___'+FCKCodeFormatter.ProtectedData.AddItem(C)+D;};FCKCodeFormatter.Format=function(A){if (!this.Regex) this.Init();FCKCodeFormatter.ProtectedData=[];var B=A.replace(this.Regex.ProtectedTags,FCKCodeFormatter._ProtectData);B=B.replace(this.Regex.BlocksOpener,'\n$&');B=B.replace(this.Regex.BlocksCloser,'$&\n');B=B.replace(this.Regex.NewLineTags,'$&\n');B=B.replace(this.Regex.MainTags,'\n$&\n');var C='';var D=B.split(this.Regex.LineSplitter);B='';for (var i=0;iB[i]) return 1;};if (A.lengthB.length) return 1;return 0;};FCKUndo._CheckIsBookmarksEqual=function(A,B){if (!(A&&B)) return false;if (FCKBrowserInfo.IsIE){var C=A[1].search(A[0].StartId);var D=B[1].search(B[0].StartId);var E=A[1].search(A[0].EndId);var F=B[1].search(B[0].EndId);return C==D&&E==F;}else{return this._CompareCursors(A.Start,B.Start)==0&&this._CompareCursors(A.End,B.End)==0;}};FCKUndo.SaveUndoStep=function(){if (FCK.EditMode!=0||this.SaveLocked) return;if (this.SavedData.length) this.Changed=true;var A=FCK.EditorDocument.body.innerHTML;var B=this._GetBookmark();this.SavedData=this.SavedData.slice(0,this.CurrentIndex+1);if (this.CurrentIndex>0&&A==this.SavedData[this.CurrentIndex][0]&&this._CheckIsBookmarksEqual(B,this.SavedData[this.CurrentIndex][1])) return;else if (this.CurrentIndex==0&&this.SavedData.length&&A==this.SavedData[0][0]){this.SavedData[0][1]=B;return;};if (this.CurrentIndex+1>=FCKConfig.MaxUndoLevels) this.SavedData.shift();else this.CurrentIndex++;this.SavedData[this.CurrentIndex]=[A,B];FCK.Events.FireEvent("OnSelectionChange");};FCKUndo.CheckUndoState=function(){return (this.Changed||this.CurrentIndex>0);};FCKUndo.CheckRedoState=function(){return (this.CurrentIndex<(this.SavedData.length-1));};FCKUndo.Undo=function(){if (this.CheckUndoState()){if (this.CurrentIndex==(this.SavedData.length-1)){this.SaveUndoStep();};this._ApplyUndoLevel(--this.CurrentIndex);FCK.Events.FireEvent("OnSelectionChange");}};FCKUndo.Redo=function(){if (this.CheckRedoState()){this._ApplyUndoLevel(++this.CurrentIndex);FCK.Events.FireEvent("OnSelectionChange");}};FCKUndo._ApplyUndoLevel=function(A){var B=this.SavedData[A];if (!B) return;if (FCKBrowserInfo.IsIE){if (B[1]&&B[1][1]) FCK.SetInnerHtml(B[1][1]);else FCK.SetInnerHtml(B[0]);}else FCK.EditorDocument.body.innerHTML=B[0];this._SelectBookmark(B[1]);this.TypesCount=0;this.Changed=false;this.Typing=false;}; +var FCKEditingArea=function(A){this.TargetElement=A;this.Mode=0;if (FCK.IECleanup) FCK.IECleanup.AddItem(this,FCKEditingArea_Cleanup);};FCKEditingArea.prototype.Start=function(A,B){var C=this.TargetElement;var D=FCKTools.GetElementDocument(C);var E;while((E=C.firstChild)){if (E.contentWindow) E.contentWindow.document.body.innerHTML='';C.removeChild(E);};if (this.Mode==0){var F=this.IFrame=D.createElement('iframe');if (!FCKBrowserInfo.IsGecko) F.src='javascript:void(0)';F.frameBorder=0;F.width=F.height='100%';C.appendChild(F);if (FCKBrowserInfo.IsIE) A=A.replace(/(]*?)\s*\/?>(?!\s*<\/base>)/gi,'$1>');else if (!B){var G=A.match(FCKRegexLib.BeforeBody);var H=A.match(FCKRegexLib.AfterBody);if (G&&H){var I=A.substr(G[1].length,A.length-G[1].length-H[1].length);A=G[1]+' '+H[1];if (FCKBrowserInfo.IsGecko&&(I.length==0||FCKRegexLib.EmptyParagraph.test(I))) I='
    ';this._BodyHTML=I;}else this._BodyHTML=A;};this.Window=F.contentWindow;var J=this.Document=this.Window.document;J.open();J.write(A);J.close();if (FCKBrowserInfo.IsGecko10&&!B){this.Start(A,true);return;};this.Window._FCKEditingArea=this;if (FCKBrowserInfo.IsGecko10) this.Window.setTimeout(FCKEditingArea_CompleteStart,500);else FCKEditingArea_CompleteStart.call(this.Window);}else{var K=this.Textarea=D.createElement('textarea');K.className='SourceField';K.dir='ltr';FCKDomTools.SetElementStyles(K,{width:'100%',height:'100%',border:'none',resize:'none',outline:'none'});C.appendChild(K);K.value=A;FCKTools.RunFunction(this.OnLoad);}};function FCKEditingArea_CompleteStart(){if (!this.document.body){this.setTimeout(FCKEditingArea_CompleteStart,50);return;};var A=this._FCKEditingArea;A.MakeEditable();FCKTools.RunFunction(A.OnLoad);};FCKEditingArea.prototype.MakeEditable=function(){var A=this.Document;if (FCKBrowserInfo.IsIE){A.body.disabled=true;A.body.contentEditable=true;A.body.removeAttribute("disabled");}else{try{A.body.spellcheck=(this.FFSpellChecker!==false);if (this._BodyHTML){A.body.innerHTML=this._BodyHTML;this._BodyHTML=null;};A.designMode='on';A.execCommand('enableObjectResizing',false,!FCKConfig.DisableObjectResizing);A.execCommand('enableInlineTableEditing',false,!FCKConfig.DisableFFTableHandles);}catch (e){FCKTools.AddEventListener(this.Window.frameElement,'DOMAttrModified',FCKEditingArea_Document_AttributeNodeModified);}}};function FCKEditingArea_Document_AttributeNodeModified(A){var B=A.currentTarget.contentWindow._FCKEditingArea;if (B._timer) window.clearTimeout(B._timer);B._timer=FCKTools.SetTimeout(FCKEditingArea_MakeEditableByMutation,1000,B);};function FCKEditingArea_MakeEditableByMutation(){delete this._timer;FCKTools.RemoveEventListener(this.Window.frameElement,'DOMAttrModified',FCKEditingArea_Document_AttributeNodeModified);this.MakeEditable();};FCKEditingArea.prototype.Focus=function(){try{if (this.Mode==0){if (FCKBrowserInfo.IsIE&&this.Document.hasFocus()) this._EnsureFocusIE();this.Window.focus();if (FCKBrowserInfo.IsIE) this._EnsureFocusIE();}else{var A=FCKTools.GetElementDocument(this.Textarea);if ((!A.hasFocus||A.hasFocus())&&A.activeElement==this.Textarea) return;this.Textarea.focus();}}catch(e) {}};FCKEditingArea.prototype._EnsureFocusIE=function(){this.Document.body.setActive();var A=this.Document.selection.createRange();var B=A.parentElement();var C=B.nodeName.toLowerCase();if (B.childNodes.length>0||!(FCKListsLib.BlockElements[C]||FCKListsLib.NonEmptyBlockElements[C])){return;};A.moveEnd("character",1);A.select();if (A.boundingWidth>0){A.moveEnd("character",-1);A.select();}};function FCKEditingArea_Cleanup(){if (this.Document) this.Document.body.innerHTML="";this.TargetElement=null;this.IFrame=null;this.Document=null;this.Textarea=null;if (this.Window){this.Window._FCKEditingArea=null;this.Window=null;}}; +var FCKKeystrokeHandler=function(A){this.Keystrokes={};this.CancelCtrlDefaults=(A!==false);};FCKKeystrokeHandler.prototype.AttachToElement=function(A){FCKTools.AddEventListenerEx(A,'keydown',_FCKKeystrokeHandler_OnKeyDown,this);if (FCKBrowserInfo.IsGecko10||FCKBrowserInfo.IsOpera||(FCKBrowserInfo.IsGecko&&FCKBrowserInfo.IsMac)) FCKTools.AddEventListenerEx(A,'keypress',_FCKKeystrokeHandler_OnKeyPress,this);};FCKKeystrokeHandler.prototype.SetKeystrokes=function(){for (var i=0;i40))){B._CancelIt=true;if (A.preventDefault) return A.preventDefault();A.returnValue=false;A.cancelBubble=true;return false;};return true;};function _FCKKeystrokeHandler_OnKeyPress(A,B){if (B._CancelIt){if (A.preventDefault) return A.preventDefault();return false;};return true;}; +FCK.DTD=(function(){X=FCKTools.Merge;var A,L,J,M,N,O,D,H,P,K,Q,F,G,C,B,E,I;A={isindex:1,fieldset:1};B={input:1,button:1,select:1,textarea:1,label:1};C=X({a:1},B);D=X({iframe:1},C);E={hr:1,ul:1,menu:1,div:1,blockquote:1,noscript:1,table:1,center:1,address:1,dir:1,pre:1,h5:1,dl:1,h4:1,noframes:1,h6:1,ol:1,h1:1,h3:1,h2:1};F={ins:1,del:1,script:1};G=X({b:1,acronym:1,bdo:1,'var':1,'#':1,abbr:1,code:1,br:1,i:1,cite:1,kbd:1,u:1,strike:1,s:1,tt:1,strong:1,q:1,samp:1,em:1,dfn:1,span:1},F);H=X({sub:1,img:1,object:1,sup:1,basefont:1,map:1,applet:1,font:1,big:1,small:1},G);I=X({p:1},H);J=X({iframe:1},H,B);K={img:1,noscript:1,br:1,kbd:1,center:1,button:1,basefont:1,h5:1,h4:1,samp:1,h6:1,ol:1,h1:1,h3:1,h2:1,form:1,font:1,'#':1,select:1,menu:1,ins:1,abbr:1,label:1,code:1,table:1,script:1,cite:1,input:1,iframe:1,strong:1,textarea:1,noframes:1,big:1,small:1,span:1,hr:1,sub:1,bdo:1,'var':1,div:1,object:1,sup:1,strike:1,dir:1,map:1,dl:1,applet:1,del:1,isindex:1,fieldset:1,ul:1,b:1,acronym:1,a:1,blockquote:1,i:1,u:1,s:1,tt:1,address:1,q:1,pre:1,p:1,em:1,dfn:1};L=X({a:1},J);M={tr:1};N={'#':1};O=X({param:1},K);P=X({form:1},A,D,E,I);Q={li:1};return {col:{},tr:{td:1,th:1},img:{},colgroup:{col:1},noscript:P,td:P,br:{},th:P,center:P,kbd:L,button:X(I,E),basefont:{},h5:L,h4:L,samp:L,h6:L,ol:Q,h1:L,h3:L,option:N,h2:L,form:X(A,D,E,I),select:{optgroup:1,option:1},font:J,ins:P,menu:Q,abbr:L,label:L,table:{thead:1,col:1,tbody:1,tr:1,colgroup:1,caption:1,tfoot:1},code:L,script:N,tfoot:M,cite:L,li:P,input:{},iframe:P,strong:J,textarea:N,noframes:P,big:J,small:J,span:J,hr:{},dt:L,sub:J,optgroup:{option:1},param:{},bdo:L,'var':J,div:P,object:O,sup:J,dd:P,strike:J,area:{},dir:Q,map:X({area:1,form:1,p:1},A,F,E),applet:O,dl:{dt:1,dd:1},del:P,isindex:{},fieldset:X({legend:1},K),thead:M,ul:Q,acronym:L,b:J,a:J,blockquote:P,caption:L,i:J,u:J,tbody:M,s:L,address:X(D,I),tt:J,legend:L,q:L,pre:X(G,C),p:L,em:J,dfn:L};})(); +var FCKStyle=function(A){this.Element=(A.Element||'span').toLowerCase();this._StyleDesc=A;};FCKStyle.prototype={GetType:function(){var A=this.GetType_$;if (A!=undefined) return A;var B=this.Element;if (B=='#'||FCKListsLib.StyleBlockElements[B]) A=0;else if (FCKListsLib.StyleObjectElements[B]) A=2;else A=1;return (this.GetType_$=A);},ApplyToSelection:function(A){var B=new FCKDomRange(A);B.MoveToSelection();this.ApplyToRange(B,true);},ApplyToRange:function(A,B){switch (this.GetType()){case 0:this.ApplyToRange=this._ApplyBlockStyle;break;case 1:this.ApplyToRange=this._ApplyInlineStyle;break;default:return;};this.ApplyToRange(A,B);},ApplyToObject:function(A){if (!A) return;this.BuildElement(null,A);},RemoveFromSelection:function(A){var B=new FCKDomRange(A);B.MoveToSelection();this.RemoveFromRange(B,true);},RemoveFromRange:function(A,B){var C;var D=this._GetAttribsForComparison();var E=this._GetOverridesForComparison();if (A.CheckIsCollapsed()){var C=A.CreateBookmark(true);var G=A.GetBookmarkNode(C,true);var H=new FCKElementPath(G.parentNode);var I=[];var J=!FCKDomTools.GetNextSibling(G);var K=J||!FCKDomTools.GetPreviousSibling(G);var L;var M=-1;for (var i=0;i=0;i--){var E=D[i];for (var F in B){if (FCKDomTools.HasAttribute(E,F)){switch (F){case 'style':this._RemoveStylesFromElement(E);break;case 'class':if (FCKDomTools.GetAttributeValue(E,F)!=this.GetFinalAttributeValue(F)) continue;default:FCKDomTools.RemoveAttribute(E,F);}}};this._RemoveOverrides(E,C[this.Element]);this._RemoveNoAttribElement(E);};for (var G in C){if (G!=this.Element){D=A.getElementsByTagName(G);for (var i=D.length-1;i>=0;i--){var E=D[i];this._RemoveOverrides(E,C[G]);this._RemoveNoAttribElement(E);}}}},_RemoveStylesFromElement:function(A){var B=A.style.cssText;var C=this.GetFinalStyleValue();if (B.length>0&&C.length==0) return;C='(^|;)\\s*('+C.replace(/\s*([^ ]+):.*?(;|$)/g,'$1|').replace(/\|$/,'')+'):[^;]+';var D=new RegExp(C,'gi');B=B.replace(D,'').Trim();if (B.length==0||B==';') FCKDomTools.RemoveAttribute(A,'style');else A.style.cssText=B.replace(D,'');},_RemoveOverrides:function(A,B){var C=B&&B.Attributes;if (C){for (var i=0;i0) C.style.cssText=this.GetFinalStyleValue();return C;},_CompareAttributeValues:function(A,B,C){if (A=='style'&&B&&C){B=B.replace(/;$/,'').toLowerCase();C=C.replace(/;$/,'').toLowerCase();};return (B==C)},GetFinalAttributeValue:function(A){var B=this._StyleDesc.Attributes;var B=B?B[A]:null;if (!B&&A=='style') return this.GetFinalStyleValue();if (B&&this._Variables) B=B.Replace(FCKRegexLib.StyleVariableAttName,this._GetVariableReplace,this);return B;},GetFinalStyleValue:function(){var A=this._GetStyleText();if (A.length>0&&this._Variables){A=A.Replace(FCKRegexLib.StyleVariableAttName,this._GetVariableReplace,this);A=FCKTools.NormalizeCssText(A);};return A;},_GetVariableReplace:function(){return this._Variables[arguments[2]]||arguments[0];},SetVariable:function(A,B){var C=this._Variables;if (!C) C=this._Variables={};this._Variables[A]=B;},_ApplyBlockStyle:function(A,B){var C;if (B) C=A.CreateBookmark(true);var D=new FCKDomRangeIterator(A);D.EnforceRealBlocks=true;var E;while((E=D.GetNextParagraph())){var F=E.parentNode.insertBefore(this.BuildElement(A.Window.document),E);FCKDomTools.MoveChildren(E,F);FCKDomTools.RemoveNode(E);};if (B) A.SelectBookmark(C);},_ApplyInlineStyle:function(A,B){var C=A.Window.document;if (A.CheckIsCollapsed()){var D=this.BuildElement(C);A.InsertNode(D);A.MoveToPosition(D,2);A.Select();return;};var E=this.Element;var F=FCK.DTD[E]||FCK.DTD.span;var G=this._GetAttribsForComparison();var H;A.Expand('inline_elements');var I=A.CreateBookmark(true);var J=A.GetBookmarkNode(I,true);var K=A.GetBookmarkNode(I,false);A.Release(true);var L=FCKDomTools.GetNextSourceNode(J,true);while (L){var M=false;var N=L.nodeType;var O=N==1?L.nodeName.toLowerCase():null;if (!O||F[O]){if ((FCK.DTD[L.parentNode.nodeName.toLowerCase()]||FCK.DTD.span)[E]||!FCK.DTD[E]){if (!A.CheckHasRange()) A.SetStart(L,3);if (N!=1||L.childNodes.length==0){var P=L;var Q=P.parentNode;while (P==Q.lastChild&&F[Q.nodeName.toLowerCase()]){P=Q;};A.SetEnd(P,4);if (P==P.parentNode.lastChild&&!F[P.parentNode.nodeName.toLowerCase()]) M=true;}else{A.SetEnd(L,3);}}else M=true;}else M=true;L=FCKDomTools.GetNextSourceNode(L);if (L==K){L=null;M=true;};if (M&&A.CheckHasRange()&&!A.CheckIsCollapsed()){H=this.BuildElement(C);A.ExtractContents().AppendTo(H);if (H.innerHTML.RTrim().length>0){A.InsertNode(H);this.RemoveFromElement(H);this._MergeSiblings(H,this._GetAttribsForComparison());if (!FCKBrowserInfo.IsIE) H.normalize();};A.Release(true);}};this._FixBookmarkStart(J);if (B) A.SelectBookmark(I);},_FixBookmarkStart:function(A){var B;while ((B=A.nextSibling)){if (B.nodeType==1&&FCKListsLib.InlineNonEmptyElements[B.nodeName.toLowerCase()]){if (!B.firstChild) FCKDomTools.RemoveNode(B);else FCKDomTools.MoveNode(A,B,true);continue;};if (B.nodeType==3&&B.length==0){FCKDomTools.RemoveNode(B);continue;};break;}},_MergeSiblings:function(A,B){if (!A||A.nodeType!=1||!FCKListsLib.InlineNonEmptyElements[A.nodeName.toLowerCase()]) return;this._MergeNextSibling(A,B);this._MergePreviousSibling(A,B);},_MergeNextSibling:function(A,B){var C=A.nextSibling;var D=(C&&C.nodeType==1&&C.getAttribute('_fck_bookmark'));if (D) C=C.nextSibling;if (C&&C.nodeType==1&&C.nodeName==A.nodeName){if (!B) B=this._CreateElementAttribsForComparison(A);if (this._CheckAttributesMatch(C,B)){var E=A.lastChild;if (D) FCKDomTools.MoveNode(A.nextSibling,A);FCKDomTools.MoveChildren(C,A);FCKDomTools.RemoveNode(C);if (E) this._MergeNextSibling(E);}}},_MergePreviousSibling:function(A,B){var C=A.previousSibling;var D=(C&&C.nodeType==1&&C.getAttribute('_fck_bookmark'));if (D) C=C.previousSibling;if (C&&C.nodeType==1&&C.nodeName==A.nodeName){if (!B) B=this._CreateElementAttribsForComparison(A);if (this._CheckAttributesMatch(C,B)){var E=A.firstChild;if (D) FCKDomTools.MoveNode(A.previousSibling,A,true);FCKDomTools.MoveChildren(C,A,true);FCKDomTools.RemoveNode(C);if (E) this._MergePreviousSibling(E);}}},_GetStyleText:function(){var A=this._StyleDesc.Styles;var B=(this._StyleDesc.Attributes?this._StyleDesc.Attributes['style']||'':'');if (B.length>0) B+=';';for (var C in A) B+=C+':'+A[C]+';';if (B.length>0&&!(/#\(/.test(B))){B=FCKTools.NormalizeCssText(B);};return (this._GetStyleText=function() { return B;})();},_GetAttribsForComparison:function(){var A=this._GetAttribsForComparison_$;if (A) return A;A={};var B=this._StyleDesc.Attributes;if (B){for (var C in B){A[C.toLowerCase()]=B[C].toLowerCase();}};if (this._GetStyleText().length>0){A['style']=this._GetStyleText().toLowerCase();};FCKTools.AppendLengthProperty(A,'_length');return (this._GetAttribsForComparison_$=A);},_GetOverridesForComparison:function(){var A=this._GetOverridesForComparison_$;if (A) return A;A={};var B=this._StyleDesc.Overrides;if (B){if (!FCKTools.IsArray(B)) B=[B];for (var i=0;i0) return true;};B=B.nextSibling;};return false;}}; +var FCKElementPath=function(A){var B=null;var C=null;var D=[];var e=A;while (e){if (e.nodeType==1){if (!this.LastElement) this.LastElement=e;var E=e.nodeName.toLowerCase();if (!C){if (!B&&FCKListsLib.PathBlockElements[E]!=null) B=e;if (FCKListsLib.PathBlockLimitElements[E]!=null){if (!B&&E=='div'&&!FCKElementPath._CheckHasBlock(e)) B=e;else C=e;}};D.push(e);if (E=='body') break;};e=e.parentNode;};this.Block=B;this.BlockLimit=C;this.Elements=D;};FCKElementPath._CheckHasBlock=function(A){var B=A.childNodes;for (var i=0,count=B.length;i0){if (D.nodeType==3){var G=D.nodeValue.substr(0,E).Trim();if (G.length!=0) return A.IsStartOfBlock=false;}else F=D.childNodes[E-1];};if (!F) F=FCKDomTools.GetPreviousSourceNode(D,true,null,C);while (F){switch (F.nodeType){case 1:if (!FCKListsLib.InlineChildReqElements[F.nodeName.toLowerCase()]) return A.IsStartOfBlock=false;break;case 3:if (F.nodeValue.Trim().length>0) return A.IsStartOfBlock=false;};F=FCKDomTools.GetPreviousSourceNode(F,false,null,C);};return A.IsStartOfBlock=true;},CheckEndOfBlock:function(A){var B=this._Cache.IsEndOfBlock;if (B!=undefined) return B;var C=this.EndBlock||this.EndBlockLimit;var D=this._Range.endContainer;var E=this._Range.endOffset;var F;if (D.nodeType==3){var G=D.nodeValue;if (E0) return this._Cache.IsEndOfBlock=false;};F=FCKDomTools.GetNextSourceNode(F,false,null,C);};if (A) this.Select();return this._Cache.IsEndOfBlock=true;},CreateBookmark:function(A){var B={StartId:(new Date()).valueOf()+Math.floor(Math.random()*1000)+'S',EndId:(new Date()).valueOf()+Math.floor(Math.random()*1000)+'E'};var C=this.Window.document;var D;var E;var F;if (!this.CheckIsCollapsed()){E=C.createElement('span');E.style.display='none';E.id=B.EndId;E.setAttribute('_fck_bookmark',true);E.innerHTML=' ';F=this.Clone();F.Collapse(false);F.InsertNode(E);};D=C.createElement('span');D.style.display='none';D.id=B.StartId;D.setAttribute('_fck_bookmark',true);D.innerHTML=' ';F=this.Clone();F.Collapse(true);F.InsertNode(D);if (A){B.StartNode=D;B.EndNode=E;};if (E){this.SetStart(D,4);this.SetEnd(E,3);}else this.MoveToPosition(D,4);return B;},GetBookmarkNode:function(A,B){var C=this.Window.document;if (B) return A.StartNode||C.getElementById(A.StartId);else return A.EndNode||C.getElementById(A.EndId);},MoveToBookmark:function(A,B){var C=this.GetBookmarkNode(A,true);var D=this.GetBookmarkNode(A,false);this.SetStart(C,3);if (!B) FCKDomTools.RemoveNode(C);if (D){this.SetEnd(D,3);if (!B) FCKDomTools.RemoveNode(D);}else this.Collapse(true);this._UpdateElementInfo();},CreateBookmark2:function(){if (!this._Range) return { "Start":0,"End":0 };var A={"Start":[this._Range.startOffset],"End":[this._Range.endOffset]};var B=this._Range.startContainer.previousSibling;var C=this._Range.endContainer.previousSibling;var D=this._Range.startContainer;var E=this._Range.endContainer;while (B&&B.nodeType==3){A.Start[0]+=B.length;D=B;B=B.previousSibling;};while (C&&C.nodeType==3){A.End[0]+=C.length;E=C;C=C.previousSibling;};if (D.nodeType==1&&D.childNodes[A.Start[0]]&&D.childNodes[A.Start[0]].nodeType==3){var F=D.childNodes[A.Start[0]];var G=0;while (F.previousSibling&&F.previousSibling.nodeType==3){F=F.previousSibling;G+=F.length;};D=F;A.Start[0]=G;};if (E.nodeType==1&&E.childNodes[A.End[0]]&&E.childNodes[A.End[0]].nodeType==3){var F=E.childNodes[A.End[0]];var G=0;while (F.previousSibling&&F.previousSibling.nodeType==3){F=F.previousSibling;G+=F.length;};E=F;A.End[0]=G;};A.Start=FCKDomTools.GetNodeAddress(D,true).concat(A.Start);A.End=FCKDomTools.GetNodeAddress(E,true).concat(A.End);return A;},MoveToBookmark2:function(A){var B=FCKDomTools.GetNodeFromAddress(this.Window.document,A.Start.slice(0,-1),true);var C=FCKDomTools.GetNodeFromAddress(this.Window.document,A.End.slice(0,-1),true);this.Release(true);this._Range=new FCKW3CRange(this.Window.document);var D=A.Start[A.Start.length-1];var E=A.End[A.End.length-1];while (B.nodeType==3&&D>B.length){if (!B.nextSibling||B.nextSibling.nodeType!=3) break;D-=B.length;B=B.nextSibling;};while (C.nodeType==3&&E>C.length){if (!C.nextSibling||C.nextSibling.nodeType!=3) break;E-=C.length;C=C.nextSibling;};this._Range.setStart(B,D);this._Range.setEnd(C,E);this._UpdateElementInfo();},MoveToPosition:function(A,B){this.SetStart(A,B);this.Collapse(true);},SetStart:function(A,B,C){var D=this._Range;if (!D) D=this._Range=this.CreateRange();switch(B){case 1:D.setStart(A,0);break;case 2:D.setStart(A,A.childNodes.length);break;case 3:D.setStartBefore(A);break;case 4:D.setStartAfter(A);};if (!C) this._UpdateElementInfo();},SetEnd:function(A,B,C){var D=this._Range;if (!D) D=this._Range=this.CreateRange();switch(B){case 1:D.setEnd(A,0);break;case 2:D.setEnd(A,A.childNodes.length);break;case 3:D.setEndBefore(A);break;case 4:D.setEndAfter(A);};if (!C) this._UpdateElementInfo();},Expand:function(A){var B,oSibling;switch (A){case 'inline_elements':if (this._Range.startOffset==0){B=this._Range.startContainer;if (B.nodeType!=1) B=B.previousSibling?null:B.parentNode;if (B){while (FCKListsLib.InlineNonEmptyElements[B.nodeName.toLowerCase()]){this._Range.setStartBefore(B);if (B!=B.parentNode.firstChild) break;B=B.parentNode;}}};B=this._Range.endContainer;var C=this._Range.endOffset;if ((B.nodeType==3&&C>=B.nodeValue.length)||(B.nodeType==1&&C>=B.childNodes.length)||(B.nodeType!=1&&B.nodeType!=3)){if (B.nodeType!=1) B=B.nextSibling?null:B.parentNode;if (B){while (FCKListsLib.InlineNonEmptyElements[B.nodeName.toLowerCase()]){this._Range.setEndAfter(B);if (B!=B.parentNode.lastChild) break;B=B.parentNode;}}};break;case 'block_contents':case 'list_contents':var D=FCKListsLib.BlockBoundaries;if (A=='list_contents'||FCKConfig.EnterMode=='br') D=FCKListsLib.ListBoundaries;if (this.StartBlock&&FCKConfig.EnterMode!='br'&&A=='block_contents') this.SetStart(this.StartBlock,1);else{B=this._Range.startContainer;if (B.nodeType==1){var E=B.childNodes[this._Range.startOffset];if (E) B=FCKDomTools.GetPreviousSourceNode(E,true);else B=B.lastChild||B;};while (B&&(B.nodeType!=1||(B!=this.StartBlockLimit&&!D[B.nodeName.toLowerCase()]))){this._Range.setStartBefore(B);B=B.previousSibling||B.parentNode;}};if (this.EndBlock&&FCKConfig.EnterMode!='br'&&A=='block_contents'&&this.EndBlock.nodeName.toLowerCase()!='li') this.SetEnd(this.EndBlock,2);else{B=this._Range.endContainer;if (B.nodeType==1) B=B.childNodes[this._Range.endOffset]||B.lastChild;while (B&&(B.nodeType!=1||(B!=this.StartBlockLimit&&!D[B.nodeName.toLowerCase()]))){this._Range.setEndAfter(B);B=B.nextSibling||B.parentNode;};if (B&&B.nodeName.toLowerCase()=='br') this._Range.setEndAfter(B);};this._UpdateElementInfo();}},SplitBlock:function(){if (!this._Range) this.MoveToSelection();if (this.StartBlockLimit==this.EndBlockLimit){var A=this.StartBlock;var B=this.EndBlock;var C=null;if (FCKConfig.EnterMode!='br'){if (!A){A=this.FixBlock(true);B=this.EndBlock;};if (!B) B=this.FixBlock(false);};var D=(A!=null&&this.CheckStartOfBlock());var E=(B!=null&&this.CheckEndOfBlock());if (!this.CheckIsEmpty()) this.DeleteContents();if (A&&B&&A==B){if (E){C=new FCKElementPath(this.StartContainer);this.MoveToPosition(B,4);B=null;}else if (D){C=new FCKElementPath(this.StartContainer);this.MoveToPosition(A,3);A=null;}else{this.SetEnd(A,2);var F=this.ExtractContents();B=A.cloneNode(false);B.removeAttribute('id',false);F.AppendTo(B);FCKDomTools.InsertAfterNode(A,B);this.MoveToPosition(A,4);if (FCKBrowserInfo.IsGecko&&!A.nodeName.IEquals(['ul','ol'])) FCKTools.AppendBogusBr(A);}};return {PreviousBlock:A,NextBlock:B,WasStartOfBlock:D,WasEndOfBlock:E,ElementPath:C};};return null;},FixBlock:function(A){var B=this.CreateBookmark();this.Collapse(A);this.Expand('block_contents');var C=this.Window.document.createElement(FCKConfig.EnterMode);this.ExtractContents().AppendTo(C);FCKDomTools.TrimNode(C);this.InsertNode(C);this.MoveToBookmark(B);return C;},Release:function(A){if (!A) this.Window=null;this.StartNode=null;this.StartContainer=null;this.StartBlock=null;this.StartBlockLimit=null;this.EndNode=null;this.EndContainer=null;this.EndBlock=null;this.EndBlockLimit=null;this._Range=null;this._Cache=null;},CheckHasRange:function(){return!!this._Range;},GetTouchedStartNode:function(){var A=this._Range;var B=A.startContainer;if (A.collapsed||B.nodeType!=1) return B;return B.childNodes[A.startOffset]||B;},GetTouchedEndNode:function(){var A=this._Range;var B=A.endContainer;if (A.collapsed||B.nodeType!=1) return B;return B.childNodes[A.endOffset-1]||B;}}; +FCKDomRange.prototype.MoveToSelection=function(){this.Release(true);var A=this.Window.getSelection();if (A&&A.rangeCount>0){this._Range=FCKW3CRange.CreateFromRange(this.Window.document,A.getRangeAt(0));this._UpdateElementInfo();}else if (this.Window.document) this.MoveToElementStart(this.Window.document.body);};FCKDomRange.prototype.Select=function(){var A=this._Range;if (A){var B=A.startContainer;if (A.collapsed&&B.nodeType==1&&B.childNodes.length==0) B.appendChild(A._Document.createTextNode(''));var C=this.Window.document.createRange();C.setStart(B,A.startOffset);try{C.setEnd(A.endContainer,A.endOffset);}catch (e){if (e.toString().Contains('NS_ERROR_ILLEGAL_VALUE')){A.collapse(true);C.setEnd(A.endContainer,A.endOffset);}else throw(e);};var D=this.Window.getSelection();D.removeAllRanges();D.addRange(C);}};FCKDomRange.prototype.SelectBookmark=function(A){var B=this.Window.document.createRange();var C=this.GetBookmarkNode(A,true);var D=this.GetBookmarkNode(A,false);B.setStart(C.parentNode,FCKDomTools.GetIndexOf(C));FCKDomTools.RemoveNode(C);if (D){B.setEnd(D.parentNode,FCKDomTools.GetIndexOf(D));FCKDomTools.RemoveNode(D);};var E=this.Window.getSelection();E.removeAllRanges();E.addRange(B);} +var FCKDomRangeIterator=function(A){this.Range=A;this.ForceBrBreak=false;this.EnforceRealBlocks=false;};FCKDomRangeIterator.CreateFromSelection=function(A){var B=new FCKDomRange(A);B.MoveToSelection();return new FCKDomRangeIterator(B);};FCKDomRangeIterator.prototype={GetNextParagraph:function(){var A;var B;var C;var D;var E;var F=this.ForceBrBreak?FCKListsLib.ListBoundaries:FCKListsLib.BlockBoundaries;if (!this._LastNode){var B=this.Range.Clone();B.Expand(this.ForceBrBreak?'list_contents':'block_contents');this._NextNode=B.GetTouchedStartNode();this._LastNode=B.GetTouchedEndNode();B=null;};var H=this._NextNode;var I=this._LastNode;while (H){var J=false;var K=(H.nodeType!=1);var L=false;if (!K){var M=H.nodeName.toLowerCase();if (F[M]){if (M=='br') K=true;else if (!B&&H.childNodes.length==0&&M!='hr'){A=H;C=H==I;break;};if (B) B.SetEnd(H,3,true);J=true;}else{if (H.firstChild){if (!B){B=new FCKDomRange(this.Range.Window);B.SetStart(H,3,true);};H=H.firstChild;continue;};K=true;}}else if (H.nodeType==3){if (/^[\r\n\t ]+$/.test(H.nodeValue)) K=false;};if (K&&!B){B=new FCKDomRange(this.Range.Window);B.SetStart(H,3,true);};C=((!J||K)&&H==I);if (B&&!J){while (!H.nextSibling&&!C){var N=H.parentNode;if (F[N.nodeName.toLowerCase()]){J=true;C=C||(N==I);break;};H=N;K=true;C=(H==I);L=true;}};if (K) B.SetEnd(H,4,true);if ((J||C)&&B){B._UpdateElementInfo();if (B.StartNode==B.EndNode&&B.StartNode.parentNode==B.StartBlockLimit&&B.StartNode.getAttribute&&B.StartNode.getAttribute('_fck_bookmark')) B=null;else break;};if (C) break;H=FCKDomTools.GetNextSourceNode(H,L,null,I);};if (!A){if (!B){this._NextNode=null;return null;};A=B.StartBlock;if (!A&&!this.EnforceRealBlocks&&B.StartBlockLimit.nodeName.IEquals('DIV','TH','TD')&&B.CheckStartOfBlock()&&B.CheckEndOfBlock()){A=B.StartBlockLimit;}else if (!A||(this.EnforceRealBlocks&&A.nodeName.toLowerCase()=='li')){A=this.Range.Window.document.createElement(FCKConfig.EnterMode=='p'?'p':'div');B.ExtractContents().AppendTo(A);FCKDomTools.TrimNode(A);B.InsertNode(A);D=true;E=true;}else if (A.nodeName.toLowerCase()!='li'){if (!B.CheckStartOfBlock()||!B.CheckEndOfBlock()){A=A.cloneNode(false);B.ExtractContents().AppendTo(A);FCKDomTools.TrimNode(A);var O=B.SplitBlock();D=!O.WasStartOfBlock;E=!O.WasEndOfBlock;FCKDebug.Output('removePreviousBr='+D+',removeLastBr='+E);B.InsertNode(A);}}else if (!C){this._NextNode=A==I?null:FCKDomTools.GetNextSourceNode(B.EndNode,true,null,I);return A;}};if (D){var P=A.previousSibling;if (P&&P.nodeType==1){if (P.nodeName.toLowerCase()=='br') P.parentNode.removeChild(P);else if (P.lastChild&&P.lastChild.nodeName.IEquals('br')) P.removeChild(P.lastChild);}};if (E){var Q=A.lastChild;if (Q&&Q.nodeType==1&&Q.nodeName.toLowerCase()=='br') A.removeChild(Q);};this._NextNode=(C||A==I)?null:FCKDomTools.GetNextSourceNode(A,true,null,I);return A;}}; +var FCKDocumentFragment=function(A,B){this.RootNode=B||A.createDocumentFragment();};FCKDocumentFragment.prototype={AppendTo:function(A){A.appendChild(this.RootNode);},InsertAfterNode:function(A){FCKDomTools.InsertAfterNode(A,this.RootNode);}} +var FCKW3CRange=function(A){this._Document=A;this.startContainer=null;this.startOffset=null;this.endContainer=null;this.endOffset=null;this.collapsed=true;};FCKW3CRange.CreateRange=function(A){return new FCKW3CRange(A);};FCKW3CRange.CreateFromRange=function(A,B){var C=FCKW3CRange.CreateRange(A);C.setStart(B.startContainer,B.startOffset);C.setEnd(B.endContainer,B.endOffset);return C;};FCKW3CRange.prototype={_UpdateCollapsed:function(){this.collapsed=(this.startContainer==this.endContainer&&this.startOffset==this.endOffset);},setStart:function(A,B){this.startContainer=A;this.startOffset=B;if (!this.endContainer){this.endContainer=A;this.endOffset=B;};this._UpdateCollapsed();},setEnd:function(A,B){this.endContainer=A;this.endOffset=B;if (!this.startContainer){this.startContainer=A;this.startOffset=B;};this._UpdateCollapsed();},setStartAfter:function(A){this.setStart(A.parentNode,FCKDomTools.GetIndexOf(A)+1);},setStartBefore:function(A){this.setStart(A.parentNode,FCKDomTools.GetIndexOf(A));},setEndAfter:function(A){this.setEnd(A.parentNode,FCKDomTools.GetIndexOf(A)+1);},setEndBefore:function(A){this.setEnd(A.parentNode,FCKDomTools.GetIndexOf(A));},collapse:function(A){if (A){this.endContainer=this.startContainer;this.endOffset=this.startOffset;}else{this.startContainer=this.endContainer;this.startOffset=this.endOffset;};this.collapsed=true;},selectNodeContents:function(A){this.setStart(A,0);this.setEnd(A,A.nodeType==3?A.data.length:A.childNodes.length);},insertNode:function(A){var B=this.startContainer;var C=this.startOffset;if (B.nodeType==3){B.splitText(C);if (B==this.endContainer) this.setEnd(B.nextSibling,this.endOffset-this.startOffset);FCKDomTools.InsertAfterNode(B,A);return;}else{B.insertBefore(A,B.childNodes[C]||null);if (B==this.endContainer){this.endOffset++;this.collapsed=false;}}},deleteContents:function(){if (this.collapsed) return;this._ExecContentsAction(0);},extractContents:function(){var A=new FCKDocumentFragment(this._Document);if (!this.collapsed) this._ExecContentsAction(1,A);return A;},cloneContents:function(){var A=new FCKDocumentFragment(this._Document);if (!this.collapsed) this._ExecContentsAction(2,A);return A;},_ExecContentsAction:function(A,B){var C=this.startContainer;var D=this.endContainer;var E=this.startOffset;var F=this.endOffset;var G=false;var H=false;if (D.nodeType==3) D=D.splitText(F);else{if (D.childNodes.length>0){if (F>D.childNodes.length-1){D=FCKDomTools.InsertAfterNode(D.lastChild,this._Document.createTextNode(''));H=true;}else D=D.childNodes[F];}};if (C.nodeType==3){C.splitText(E);if (C==D) D=C.nextSibling;}else{if (C.childNodes.length>0&&E<=C.childNodes.length-1){if (E==0){C=C.insertBefore(this._Document.createTextNode(''),C.firstChild);G=true;}else C=C.childNodes[E].previousSibling;}};var I=FCKDomTools.GetParents(C);var J=FCKDomTools.GetParents(D);var i,topStart,topEnd;for (i=0;i0&&levelStartNode!=D) levelClone=K.appendChild(levelStartNode.cloneNode(levelStartNode==D));if (!I[k]||levelStartNode.parentNode!=I[k].parentNode){currentNode=levelStartNode.previousSibling;while(currentNode){if (currentNode==I[k]||currentNode==C) break;currentSibling=currentNode.previousSibling;if (A==2) K.insertBefore(currentNode.cloneNode(true),K.firstChild);else{currentNode.parentNode.removeChild(currentNode);if (A==1) K.insertBefore(currentNode,K.firstChild);};currentNode=currentSibling;}};if (K) K=levelClone;};if (A==2){var L=this.startContainer;if (L.nodeType==3){L.data+=L.nextSibling.data;L.parentNode.removeChild(L.nextSibling);};var M=this.endContainer;if (M.nodeType==3&&M.nextSibling){M.data+=M.nextSibling.data;M.parentNode.removeChild(M.nextSibling);}}else{if (topStart&&topEnd&&(C.parentNode!=topStart.parentNode||D.parentNode!=topEnd.parentNode)){var N=FCKDomTools.GetIndexOf(topEnd);if (G&&topEnd.parentNode==C.parentNode) N--;this.setStart(topEnd.parentNode,N);};this.collapse(true);};if(G) C.parentNode.removeChild(C);if(H&&D.parentNode) D.parentNode.removeChild(D);},cloneRange:function(){return FCKW3CRange.CreateFromRange(this._Document,this);}}; +var FCKEnterKey=function(A,B,C,D){this.Window=A;this.EnterMode=B||'p';this.ShiftEnterMode=C||'br';var E=new FCKKeystrokeHandler(false);E._EnterKey=this;E.OnKeystroke=FCKEnterKey_OnKeystroke;E.SetKeystrokes([[13,'Enter'],[SHIFT+13,'ShiftEnter'],[9,'Tab'],[8,'Backspace'],[CTRL+8,'CtrlBackspace'],[46,'Delete']]);if (D>0){this.TabText='';while (D-->0) this.TabText+='\xa0';};E.AttachToElement(A.document);};function FCKEnterKey_OnKeystroke(A,B){var C=this._EnterKey;try{switch (B){case 'Enter':return C.DoEnter();break;case 'ShiftEnter':return C.DoShiftEnter();break;case 'Backspace':return C.DoBackspace();break;case 'Delete':return C.DoDelete();break;case 'Tab':return C.DoTab();break;case 'CtrlBackspace':return C.DoCtrlBackspace();break;}}catch (e){};return false;};FCKEnterKey.prototype.DoEnter=function(A,B){FCKUndo.SaveUndoStep();this._HasShift=(B===true);var C=FCKSelection.GetParentElement();var D=new FCKElementPath(C);var E=A||this.EnterMode;if (E=='br'||D.Block&&D.Block.tagName.toLowerCase()=='pre') return this._ExecuteEnterBr();else return this._ExecuteEnterBlock(E);};FCKEnterKey.prototype.DoShiftEnter=function(){return this.DoEnter(this.ShiftEnterMode,true);};FCKEnterKey.prototype.DoBackspace=function(){var A=false;var B=new FCKDomRange(this.Window);B.MoveToSelection();if (FCKBrowserInfo.IsIE&&this._CheckIsAllContentsIncluded(B,this.Window.document.body)){this._FixIESelectAllBug(B);return true;};var C=B.CheckIsCollapsed();if (!C){if (FCKBrowserInfo.IsIE&&this.Window.document.selection.type.toLowerCase()=="control"){var D=this.Window.document.selection.createRange();for (var i=D.length-1;i>=0;i--){var E=D.item(i);E.parentNode.removeChild(E);};return true;};return false;};var F=B.StartBlock;var G=B.EndBlock;if (B.StartBlockLimit==B.EndBlockLimit&&F&&G){if (!C){var H=B.CheckEndOfBlock();B.DeleteContents();if (F!=G){B.SetStart(G,1);B.SetEnd(G,1);};B.Select();A=(F==G);};if (B.CheckStartOfBlock()){var I=B.StartBlock;var J=FCKDomTools.GetPreviousSourceElement(I,true,['BODY',B.StartBlockLimit.nodeName],['UL','OL']);A=this._ExecuteBackspace(B,J,I);}else if (FCKBrowserInfo.IsGeckoLike){B.Select();}};B.Release();return A;};FCKEnterKey.prototype.DoCtrlBackspace=function(){FCKUndo.SaveUndoStep();var A=new FCKDomRange(this.Window);A.MoveToSelection();if (FCKBrowserInfo.IsIE&&this._CheckIsAllContentsIncluded(A,this.Window.document.body)){this._FixIESelectAllBug(A);return true;};return false;};FCKEnterKey.prototype._ExecuteBackspace=function(A,B,C){var D=false;if (!B&&C&&C.nodeName.IEquals('LI')&&C.parentNode.parentNode.nodeName.IEquals('LI')){this._OutdentWithSelection(C,A);return true;};if (B&&B.nodeName.IEquals('LI')){var E=FCKDomTools.GetLastChild(B,['UL','OL']);while (E){B=FCKDomTools.GetLastChild(E,'LI');E=FCKDomTools.GetLastChild(B,['UL','OL']);}};if (B&&C){if (C.nodeName.IEquals('LI')&&!B.nodeName.IEquals('LI')){this._OutdentWithSelection(C,A);return true;};var F=C.parentNode;var G=B.nodeName.toLowerCase();if (FCKListsLib.EmptyElements[G]!=null||G=='table'){FCKDomTools.RemoveNode(B);D=true;}else{FCKDomTools.RemoveNode(C);while (F.innerHTML.Trim().length==0){var H=F.parentNode;H.removeChild(F);F=H;};FCKDomTools.LTrimNode(C);FCKDomTools.RTrimNode(B);A.SetStart(B,2,true);A.Collapse(true);var I=A.CreateBookmark(true);if (!C.tagName.IEquals(['TABLE'])) FCKDomTools.MoveChildren(C,B);A.SelectBookmark(I);D=true;}};return D;};FCKEnterKey.prototype.DoDelete=function(){FCKUndo.SaveUndoStep();var A=false;var B=new FCKDomRange(this.Window);B.MoveToSelection();if (FCKBrowserInfo.IsIE&&this._CheckIsAllContentsIncluded(B,this.Window.document.body)){this._FixIESelectAllBug(B);return true;};if (B.CheckIsCollapsed()&&B.CheckEndOfBlock(FCKBrowserInfo.IsGeckoLike)){var C=B.StartBlock;var D=FCKTools.GetElementAscensor(C,'td');var E=FCKDomTools.GetNextSourceElement(C,true,[B.StartBlockLimit.nodeName],['UL','OL','TR'],true);if (D){var F=FCKTools.GetElementAscensor(E,'td');if (F!=D) return true;};A=this._ExecuteBackspace(B,C,E);};B.Release();return A;};FCKEnterKey.prototype.DoTab=function(){var A=new FCKDomRange(this.Window);A.MoveToSelection();var B=A._Range.startContainer;while (B){if (B.nodeType==1){var C=B.tagName.toLowerCase();if (C=="tr"||C=="td"||C=="th"||C=="tbody"||C=="table") return false;else break;};B=B.parentNode;};if (this.TabText){A.DeleteContents();A.InsertNode(this.Window.document.createTextNode(this.TabText));A.Collapse(false);A.Select();};return true;};FCKEnterKey.prototype._ExecuteEnterBlock=function(A,B){var C=B||new FCKDomRange(this.Window);var D=C.SplitBlock();if (D){var E=D.PreviousBlock;var F=D.NextBlock;var G=D.WasStartOfBlock;var H=D.WasEndOfBlock;if (!D.WasStartOfBlock&&!D.WasEndOfBlock){if (F.nodeName.IEquals('li')&&F.firstChild&&F.firstChild.nodeName.IEquals(['ul','ol'])) F.insertBefore(F.ownerDocument.createTextNode('\xa0'),F.firstChild);if (F) C.MoveToElementEditStart(F);}else{if (G&&H&&E.tagName.toUpperCase()=='LI'){C.MoveToElementStart(E);this._OutdentWithSelection(E,C);C.Release();return true;};var I;if (E){var J=E.tagName.toUpperCase();if (!this._HasShift&&!(/^H[1-6]$/).test(J)){I=FCKDomTools.CloneElement(E);}}else if (F) I=FCKDomTools.CloneElement(F);if (!I) I=this.Window.document.createElement(A);var K=D.ElementPath;if (K){for (var i=0,len=K.Elements.length;i=0&&(C=B[i--])){if (C.name.length>0){if (C.innerHTML!==''){if (FCKBrowserInfo.IsIE) C.className+=' FCK__AnchorC';}else{var D=FCKDocumentProcessor_CreateFakeImage('FCK__Anchor',C.cloneNode(true));D.setAttribute('_fckanchor','true',0);C.parentNode.insertBefore(D,C);C.parentNode.removeChild(C);}}}}};var FCKPageBreaksProcessor=FCKDocumentProcessor.AppendNew();FCKPageBreaksProcessor.ProcessDocument=function(A){var B=A.getElementsByTagName('DIV');var C;var i=B.length-1;while (i>=0&&(C=B[i--])){if (C.style.pageBreakAfter=='always'&&C.childNodes.length==1&&C.childNodes[0].style&&C.childNodes[0].style.display=='none'){var D=FCKDocumentProcessor_CreateFakeImage('FCK__PageBreak',C.cloneNode(true));C.parentNode.insertBefore(D,C);C.parentNode.removeChild(C);}}};var FCKFlashProcessor=FCKDocumentProcessor.AppendNew();FCKFlashProcessor.ProcessDocument=function(A){var B=FCK.IsDirty();var C=A.getElementsByTagName('EMBED');var D;var i=C.length-1;while (i>=0&&(D=C[i--])){var E=D.attributes['type'];if ((D.src&&D.src.EndsWith('.swf',true))||(E&&E.nodeValue=='application/x-shockwave-flash')){var F=D.cloneNode(true);var G=FCKDocumentProcessor_CreateFakeImage('FCK__Flash',F);G.setAttribute('_fckflash','true',0);FCKFlashProcessor.RefreshView(G,D);D.parentNode.insertBefore(G,D);D.parentNode.removeChild(D);}};if (!B) FCK.ResetIsDirty();};FCKFlashProcessor.RefreshView=function(A,B){if (B.getAttribute('width')>0) A.style.width=FCKTools.ConvertHtmlSizeToStyle(B.getAttribute('width'));if (B.getAttribute('height')>0) A.style.height=FCKTools.ConvertHtmlSizeToStyle(B.getAttribute('height'));};FCK.GetRealElement=function(A){var e=FCKTempBin.Elements[A.getAttribute('_fckrealelement')];if (A.getAttribute('_fckflash')){if (A.style.width.length>0) e.width=FCKTools.ConvertStyleSizeToHtml(A.style.width);if (A.style.height.length>0) e.height=FCKTools.ConvertStyleSizeToHtml(A.style.height);};return e;};if (FCKBrowserInfo.IsIE){FCKDocumentProcessor.AppendNew().ProcessDocument=function(A){var B=A.getElementsByTagName('HR');var C;var i=B.length-1;while (i>=0&&(C=B[i--])){var D=A.createElement('hr');D.mergeAttributes(C,true);FCKDomTools.InsertAfterNode(C,D);C.parentNode.removeChild(C);}}};FCKDocumentProcessor.AppendNew().ProcessDocument=function(A){var B=A.getElementsByTagName('INPUT');var C;var i=B.length-1;while (i>=0&&(C=B[i--])){if (C.type=='hidden'){var D=FCKDocumentProcessor_CreateFakeImage('FCK__InputHidden',C.cloneNode(true));D.setAttribute('_fckinputhidden','true',0);C.parentNode.insertBefore(D,C);C.parentNode.removeChild(C);}}} +var FCKSelection=FCK.Selection={GetParentBlock:function(){var A=this.GetParentElement();while (A){if (FCKListsLib.BlockBoundaries[A.nodeName.toLowerCase()]) break;A=A.parentNode;};return A;},ApplyStyle:function(A){FCKStyles.ApplyStyle(new FCKStyle(A));}}; +FCKSelection.GetType=function(){var A='Text';var B;try { B=FCK.EditorWindow.getSelection();} catch (e) {};if (B&&B.rangeCount==1){var C=B.getRangeAt(0);if (C.startContainer==C.endContainer&&(C.endOffset-C.startOffset)==1&&C.startContainer.nodeType==1&&FCKListsLib.StyleObjectElements[C.startContainer.childNodes[C.startOffset].nodeName.toLowerCase()]){A='Control';}};return A;};FCKSelection.GetSelectedElement=function(){var A=null;var B=!!FCK.EditorWindow&&FCK.EditorWindow.getSelection();if (B&&B.anchorNode&&B.anchorNode.nodeType==1){if (this.GetType()=='Control'){A=B.anchorNode.childNodes[B.anchorOffset];if (!A) A=B.anchorNode;else if (A.nodeType!=1) return null;}};return A;};FCKSelection.GetParentElement=function(){if (this.GetType()=='Control') return FCKSelection.GetSelectedElement().parentNode;else{var A=FCK.EditorWindow.getSelection();if (A){if (A.anchorNode&&A.anchorNode==A.focusNode) return A.anchorNode.parentNode;var B=new FCKElementPath(A.anchorNode);var C=new FCKElementPath(A.focusNode);var D=null;var E=null;if (B.Elements.length>C.Elements.length){D=B.Elements;E=C.Elements;}else{D=C.Elements;E=B.Elements;};var F=D.length-E.length;for(var i=0;i0){var C=B.getRangeAt(A?0:(B.rangeCount-1));var D=A?C.startContainer:C.endContainer;return (D.nodeType==1?D:D.parentNode);}};return null;};FCKSelection.SelectNode=function(A){var B=FCK.EditorDocument.createRange();B.selectNode(A);var C=FCK.EditorWindow.getSelection();C.removeAllRanges();C.addRange(B);};FCKSelection.Collapse=function(A){var B=FCK.EditorWindow.getSelection();if (A==null||A===true) B.collapseToStart();else B.collapseToEnd();};FCKSelection.HasAncestorNode=function(A){var B=this.GetSelectedElement();if (!B&&FCK.EditorWindow){try { B=FCK.EditorWindow.getSelection().getRangeAt(0).startContainer;}catch(e){}};while (B){if (B.nodeType==1&&B.tagName==A) return true;B=B.parentNode;};return false;};FCKSelection.MoveToAncestorNode=function(A){var B;var C=this.GetSelectedElement();if (!C) C=FCK.EditorWindow.getSelection().getRangeAt(0).startContainer;while (C){if (C.nodeName==A) return C;C=C.parentNode;};return null;};FCKSelection.Delete=function(){var A=FCK.EditorWindow.getSelection();for (var i=0;i=0;i--){if (C[i]) FCKTableHandler.DeleteRows(C[i]);};return;};var E=FCKTools.GetElementAscensor(A,'TABLE');if (E.rows.length==1){FCKTableHandler.DeleteTable(E);return;};A.parentNode.removeChild(A);};FCKTableHandler.DeleteTable=function(A){if (!A){A=FCKSelection.GetSelectedElement();if (!A||A.tagName!='TABLE') A=FCKSelection.MoveToAncestorNode('TABLE');};if (!A) return;FCKSelection.SelectNode(A);FCKSelection.Collapse();if (A.parentNode.childNodes.length==1) A.parentNode.parentNode.removeChild(A.parentNode);else A.parentNode.removeChild(A);};FCKTableHandler.InsertColumn=function(A){var B=null;var C=this.GetSelectedCells();if (C&&C.length) B=C[A?0:(C.length-1)];if (!B) return;var D=FCKTools.GetElementAscensor(B,'TABLE');var E=B.cellIndex;for (var i=0;i=0;i--){if (B[i]) FCKTableHandler.DeleteColumns(B[i]);};return;};if (!A) return;var C=FCKTools.GetElementAscensor(A,'TABLE');var D=A.cellIndex;for (var i=C.rows.length-1;i>=0;i--){var E=C.rows[i];if (D==0&&E.cells.length==1){FCKTableHandler.DeleteRows(E);continue;};if (E.cells[D]) E.removeChild(E.cells[D]);}};FCKTableHandler.InsertCell=function(A,B){var C=null;var D=this.GetSelectedCells();if (D&&D.length) C=D[B?0:(D.length-1)];if (!C) return null;var E=FCK.EditorDocument.createElement('TD');if (FCKBrowserInfo.IsGeckoLike) FCKTools.AppendBogusBr(E);if (!B&&C.cellIndex==C.parentNode.cells.length-1) C.parentNode.appendChild(E);else C.parentNode.insertBefore(E,B?C:C.nextSibling);return E;};FCKTableHandler.DeleteCell=function(A){if (A.parentNode.cells.length==1){FCKTableHandler.DeleteRows(FCKTools.GetElementAscensor(A,'TR'));return;};A.parentNode.removeChild(A);};FCKTableHandler.DeleteCells=function(){var A=FCKTableHandler.GetSelectedCells();for (var i=A.length-1;i>=0;i--){FCKTableHandler.DeleteCell(A[i]);}};FCKTableHandler._MarkCells=function(A,B){for (var i=0;i=E.height){for (D=F;D0){var L=K.removeChild(K.firstChild);if (L.nodeType!=1||(L.getAttribute('type',2)!='_moz'&&L.getAttribute('_moz_dirty')!=null)){I.appendChild(L);J++;}}};if (J>0) I.appendChild(B.ownerDocument.createElement('br'));};this._ReplaceCellsByMarker(C,'_SelectedCells',B);this._UnmarkCells(A,'_SelectedCells');this._InstallTableMap(C,B.parentNode.parentNode);B.appendChild(I);if (FCKBrowserInfo.IsGeckoLike&&(!B.firstChild)) FCKTools.AppendBogusBr(B);this._MoveCaretToCell(B,false);};FCKTableHandler.MergeRight=function(){var A=this.GetMergeRightTarget();if (A==null) return;var B=A.refCell;var C=A.tableMap;var D=A.nextCell;var E=FCK.EditorDocument.createDocumentFragment();while (D&&D.childNodes&&D.childNodes.length>0) E.appendChild(D.removeChild(D.firstChild));D.parentNode.removeChild(D);B.appendChild(E);this._MarkCells([D],'_Replace');this._ReplaceCellsByMarker(C,'_Replace',B);this._InstallTableMap(C,B.parentNode.parentNode);this._MoveCaretToCell(B,false);};FCKTableHandler.MergeDown=function(){var A=this.GetMergeDownTarget();if (A==null) return;var B=A.refCell;var C=A.tableMap;var D=A.nextCell;var E=B.ownerDocument.createDocumentFragment();while (D&&D.childNodes&&D.childNodes.length>0) E.appendChild(D.removeChild(D.firstChild));if (E.firstChild) E.insertBefore(D.ownerDocument.createElement('br'),E.firstChild);B.appendChild(E);this._MarkCells([D],'_Replace');this._ReplaceCellsByMarker(C,'_Replace',B);this._InstallTableMap(C,B.parentNode.parentNode);this._MoveCaretToCell(B,false);};FCKTableHandler.HorizontalSplitCell=function(){var A=FCKTableHandler.GetSelectedCells();if (A.length!=1) return;var B=A[0];var C=this._CreateTableMap(B.parentNode.parentNode);var D=B.parentNode.rowIndex;var E=FCKTableHandler._GetCellIndexSpan(C,D,B);var F=isNaN(B.colSpan)?1:B.colSpan;if (F>1){var G=Math.ceil(F/2);var H=B.ownerDocument.createElement('td');if (FCKBrowserInfo.IsGeckoLike) FCKTools.AppendBogusBr(H);var I=E+G;var J=E+F;var K=isNaN(B.rowSpan)?1:B.rowSpan;for (var r=D;r1){B.rowSpan=Math.ceil(E/2);var G=F+Math.ceil(E/2);var H=null;for (var i=D+1;i0){var C=B.rows[0];C.parentNode.removeChild(C);};for (var i=0;iE) E=j;if (D._colScanned===true) continue;if (A[i][j-1]==D) D.colSpan++;if (A[i][j+1]!=D) D._colScanned=true;}};for (var i=0;i<=E;i++){for (var j=0;j ';var A=FCKDocumentProcessor_CreateFakeImage('FCK__PageBreak',e);var B=new FCKDomRange(FCK.EditorWindow);B.MoveToSelection();var C=B.SplitBlock();if (C.NextBlock) C.NextBlock.parentNode.insertBefore(A,C.NextBlock);else C.PreviousBlock.parentNode.insertBefore(A,C.PreviousBlock.nextSibling);FCK.Events.FireEvent('OnSelectionChange');};FCKPageBreakCommand.prototype.GetState=function(){return 0;};var FCKUnlinkCommand=function(){this.Name='Unlink';};FCKUnlinkCommand.prototype.Execute=function(){FCKUndo.SaveUndoStep();if (FCKBrowserInfo.IsGeckoLike){var A=FCK.Selection.MoveToAncestorNode('A');if (A) FCKTools.RemoveOuterTags(A);return;};FCK.ExecuteNamedCommand(this.Name);};FCKUnlinkCommand.prototype.GetState=function(){var A=FCK.GetNamedCommandState(this.Name);if (A==0&&FCK.EditMode==0){var B=FCKSelection.MoveToAncestorNode('A');var C=(B&&B.name.length>0&&B.href.length==0);if (C) A=-1;};return A;};var FCKSelectAllCommand=function(){this.Name='SelectAll';};FCKSelectAllCommand.prototype.Execute=function(){if (FCK.EditMode==0){FCK.ExecuteNamedCommand('SelectAll');}else{var A=FCK.EditingArea.Textarea;if (FCKBrowserInfo.IsIE){A.createTextRange().execCommand('SelectAll');}else{A.selectionStart=0;A.selectionEnd=A.value.length;};A.focus();}};FCKSelectAllCommand.prototype.GetState=function(){return 0;};var FCKPasteCommand=function(){this.Name='Paste';};FCKPasteCommand.prototype={Execute:function(){if (FCKBrowserInfo.IsIE) FCK.Paste();else FCK.ExecuteNamedCommand('Paste');},GetState:function(){return FCK.GetNamedCommandState('Paste');}};var FCKRuleCommand=function(){this.Name='Rule';};FCKRuleCommand.prototype={Execute:function(){FCKUndo.SaveUndoStep();FCK.InsertElement('hr');},GetState:function(){return FCK.GetNamedCommandState('InsertHorizontalRule');}};var FCKCopyCommand=function(){this.Name='Copy';};FCKCopyCommand.prototype={Execute:function(){FCK.ExecuteNamedCommand(this.Name);},GetState:function(){return FCK.GetNamedCommandState('Cut');}};var FCKAnchorDeleteCommand=function(){this.Name='AnchorDelete';};FCKAnchorDeleteCommand.prototype={Execute:function(){if (FCK.Selection.GetType()=='Control'){FCK.Selection.Delete();}else{var A=FCK.Selection.GetSelectedElement();if (A){if (A.tagName=='IMG'&&A.getAttribute('_fckanchor')) oAnchor=FCK.GetRealElement(A);else A=null;};if (!A){oAnchor=FCK.Selection.MoveToAncestorNode('A');if (oAnchor) FCK.Selection.SelectNode(oAnchor);};if (oAnchor.href.length!=0){oAnchor.removeAttribute('name');if (FCKBrowserInfo.IsIE) oAnchor.className=oAnchor.className.replace(FCKRegexLib.FCK_Class,'');return;};if (A){A.parentNode.removeChild(A);return;};if (oAnchor.innerHTML.length==0){oAnchor.parentNode.removeChild(oAnchor);return;};FCKTools.RemoveOuterTags(oAnchor);};if (FCKBrowserInfo.IsGecko) FCK.Selection.Collapse(true);},GetState:function(){return FCK.GetNamedCommandState('Unlink');}}; +var FCKShowBlockCommand=function(A,B){this.Name=A;if (B!=undefined) this._SavedState=B;else this._SavedState=null;};FCKShowBlockCommand.prototype.Execute=function(){var A=this.GetState();if (A==-1) return;var B=FCK.EditorDocument.body;if (A==1) B.className=B.className.replace(/(^| )FCK__ShowBlocks/g,'');else B.className+=' FCK__ShowBlocks';FCK.Events.FireEvent('OnSelectionChange');};FCKShowBlockCommand.prototype.GetState=function(){if (FCK.EditMode!=0) return -1;if (!FCK.EditorDocument) return 0;if (/FCK__ShowBlocks(?:\s|$)/.test(FCK.EditorDocument.body.className)) return 1;return 0;};FCKShowBlockCommand.prototype.SaveState=function(){this._SavedState=this.GetState();};FCKShowBlockCommand.prototype.RestoreState=function(){if (this._SavedState!=null&&this.GetState()!=this._SavedState) this.Execute();}; +var FCKSpellCheckCommand=function(){this.Name='SpellCheck';this.IsEnabled=(FCKConfig.SpellChecker=='SpellerPages');};FCKSpellCheckCommand.prototype.Execute=function(){FCKDialog.OpenDialog('FCKDialog_SpellCheck','Spell Check','dialog/fck_spellerpages.html',440,480);};FCKSpellCheckCommand.prototype.GetState=function(){return this.IsEnabled?0:-1;} +var FCKTextColorCommand=function(A){this.Name=A=='ForeColor'?'TextColor':'BGColor';this.Type=A;var B;if (FCKBrowserInfo.IsIE) B=window;else if (FCK.ToolbarSet._IFrame) B=FCKTools.GetElementWindow(FCK.ToolbarSet._IFrame);else B=window.parent;this._Panel=new FCKPanel(B);this._Panel.AppendStyleSheet(FCKConfig.SkinPath+'fck_editor.css');this._Panel.MainNode.className='FCK_Panel';this._CreatePanelBody(this._Panel.Document,this._Panel.MainNode);FCKTools.DisableSelection(this._Panel.Document.body);};FCKTextColorCommand.prototype.Execute=function(A,B,C){this._Panel.Show(A,B,C);};FCKTextColorCommand.prototype.SetColor=function(A){FCKUndo.SaveUndoStep();var B=FCKStyles.GetStyle('_FCK_'+(this.Type=='ForeColor'?'Color':'BackColor'));if (!A||A.length==0) FCK.Styles.RemoveStyle(B);else{B.SetVariable('Color',A);FCKStyles.ApplyStyle(B);};FCKUndo.SaveUndoStep();FCK.Focus();FCK.Events.FireEvent('OnSelectionChange');};FCKTextColorCommand.prototype.GetState=function(){return 0;};function FCKTextColorCommand_OnMouseOver(){this.className='ColorSelected';};function FCKTextColorCommand_OnMouseOut(){this.className='ColorDeselected';};function FCKTextColorCommand_OnClick(A,B,C){this.className='ColorDeselected';B.SetColor(C);B._Panel.Hide();};function FCKTextColorCommand_AutoOnClick(A,B){this.className='ColorDeselected';B.SetColor('');B._Panel.Hide();};function FCKTextColorCommand_MoreOnClick(A,B){this.className='ColorDeselected';B._Panel.Hide();FCKDialog.OpenDialog('FCKDialog_Color',FCKLang.DlgColorTitle,'dialog/fck_colorselector.html',400,330,FCKTools.Hitch(B,'SetColor'));};FCKTextColorCommand.prototype._CreatePanelBody=function(A,B){function CreateSelectionDiv(){var C=A.createElement("DIV");C.className='ColorDeselected';FCKTools.AddEventListenerEx(C,'mouseover',FCKTextColorCommand_OnMouseOver);FCKTools.AddEventListenerEx(C,'mouseout',FCKTextColorCommand_OnMouseOut);return C;};var D=B.appendChild(A.createElement("TABLE"));D.className='ForceBaseFont';D.style.tableLayout='fixed';D.cellPadding=0;D.cellSpacing=0;D.border=0;D.width=150;var E=D.insertRow(-1).insertCell(-1);E.colSpan=8;var C=E.appendChild(CreateSelectionDiv());C.innerHTML='\n \n \n \n \n
    '+FCKLang.ColorAutomatic+'
    ';FCKTools.AddEventListenerEx(C,'click',FCKTextColorCommand_AutoOnClick,this);if (!FCKBrowserInfo.IsIE) C.style.width='96%';var G=FCKConfig.FontColors.toString().split(',');var H=0;while (H
    ';if (H>=G.length) C.style.visibility='hidden';else FCKTools.AddEventListenerEx(C,'click',FCKTextColorCommand_OnClick,[this,L]);}};if (FCKConfig.EnableMoreFontColors){E=D.insertRow(-1).insertCell(-1);E.colSpan=8;C=E.appendChild(CreateSelectionDiv());C.innerHTML='
    '+FCKLang.ColorMoreColors+'
    ';FCKTools.AddEventListenerEx(C,'click',FCKTextColorCommand_MoreOnClick,this);};if (!FCKBrowserInfo.IsIE) C.style.width='96%';}; +var FCKPastePlainTextCommand=function(){this.Name='PasteText';};FCKPastePlainTextCommand.prototype.Execute=function(){FCK.PasteAsPlainText();};FCKPastePlainTextCommand.prototype.GetState=function(){return FCK.GetNamedCommandState('Paste');}; +var FCKPasteWordCommand=function(){this.Name='PasteWord';};FCKPasteWordCommand.prototype.Execute=function(){FCK.PasteFromWord();};FCKPasteWordCommand.prototype.GetState=function(){if (FCKConfig.ForcePasteAsPlainText) return -1;else return FCK.GetNamedCommandState('Paste');}; +var FCKTableCommand=function(A){this.Name=A;};FCKTableCommand.prototype.Execute=function(){FCKUndo.SaveUndoStep();if (!FCKBrowserInfo.IsGecko){switch (this.Name){case 'TableMergeRight':return FCKTableHandler.MergeRight();case 'TableMergeDown':return FCKTableHandler.MergeDown();}};switch (this.Name){case 'TableInsertRowAfter':return FCKTableHandler.InsertRow(false);case 'TableInsertRowBefore':return FCKTableHandler.InsertRow(true);case 'TableDeleteRows':return FCKTableHandler.DeleteRows();case 'TableInsertColumnAfter':return FCKTableHandler.InsertColumn(false);case 'TableInsertColumnBefore':return FCKTableHandler.InsertColumn(true);case 'TableDeleteColumns':return FCKTableHandler.DeleteColumns();case 'TableInsertCellAfter':return FCKTableHandler.InsertCell(null,false);case 'TableInsertCellBefore':return FCKTableHandler.InsertCell(null,true);case 'TableDeleteCells':return FCKTableHandler.DeleteCells();case 'TableMergeCells':return FCKTableHandler.MergeCells();case 'TableHorizontalSplitCell':return FCKTableHandler.HorizontalSplitCell();case 'TableVerticalSplitCell':return FCKTableHandler.VerticalSplitCell();case 'TableDelete':return FCKTableHandler.DeleteTable();default:return alert(FCKLang.UnknownCommand.replace(/%1/g,this.Name));}};FCKTableCommand.prototype.GetState=function(){if (FCK.EditorDocument!=null&&FCKSelection.HasAncestorNode('TABLE')){switch (this.Name){case 'TableHorizontalSplitCell':case 'TableVerticalSplitCell':if (FCKTableHandler.GetSelectedCells().length==1) return 0;else return -1;case 'TableMergeCells':if (FCKTableHandler.CheckIsSelectionRectangular()&&FCKTableHandler.GetSelectedCells().length>1) return 0;else return -1;case 'TableMergeRight':return FCKTableHandler.GetMergeRightTarget()?0:-1;case 'TableMergeDown':return FCKTableHandler.GetMergeDownTarget()?0:-1;default:return 0;}}else return -1;}; +var FCKFitWindow=function(){this.Name='FitWindow';};FCKFitWindow.prototype.Execute=function(){var A=window.frameElement;var B=A.style;var C=parent;var D=C.document.documentElement;var E=C.document.body;var F=E.style;var G;if (!this.IsMaximized){if(FCKBrowserInfo.IsIE) C.attachEvent('onresize',FCKFitWindow_Resize);else C.addEventListener('resize',FCKFitWindow_Resize,true);this._ScrollPos=FCKTools.GetScrollPosition(C);G=A;while((G=G.parentNode)){if (G.nodeType==1){G._fckSavedStyles=FCKTools.SaveStyles(G);G.style.zIndex=FCKConfig.FloatingPanelsZIndex-1;}};if (FCKBrowserInfo.IsIE){this.documentElementOverflow=D.style.overflow;D.style.overflow='hidden';F.overflow='hidden';}else{F.overflow='hidden';F.width='0px';F.height='0px';};this._EditorFrameStyles=FCKTools.SaveStyles(A);var H=FCKTools.GetViewPaneSize(C);B.position="absolute";B.zIndex=FCKConfig.FloatingPanelsZIndex-1;B.left="0px";B.top="0px";B.width=H.Width+"px";B.height=H.Height+"px";if (!FCKBrowserInfo.IsIE){B.borderRight=B.borderBottom="9999px solid white";B.backgroundColor="white";};C.scrollTo(0,0);var I=FCKTools.GetWindowPosition(C,A);if (I.x!=0) B.left=(-1*I.x)+"px";if (I.y!=0) B.top=(-1*I.y)+"px";this.IsMaximized=true;}else{if(FCKBrowserInfo.IsIE) C.detachEvent("onresize",FCKFitWindow_Resize);else C.removeEventListener("resize",FCKFitWindow_Resize,true);G=A;while((G=G.parentNode)){if (G._fckSavedStyles){FCKTools.RestoreStyles(G,G._fckSavedStyles);G._fckSavedStyles=null;}};if (FCKBrowserInfo.IsIE) D.style.overflow=this.documentElementOverflow;FCKTools.RestoreStyles(A,this._EditorFrameStyles);C.scrollTo(this._ScrollPos.X,this._ScrollPos.Y);this.IsMaximized=false;};FCKToolbarItems.GetItem('FitWindow').RefreshState();if (FCK.EditMode==0) FCK.EditingArea.MakeEditable();FCK.Focus();};FCKFitWindow.prototype.GetState=function(){if (FCKConfig.ToolbarLocation!='In') return -1;else return (this.IsMaximized?1:0);};function FCKFitWindow_Resize(){var A=FCKTools.GetViewPaneSize(parent);var B=window.frameElement.style;B.width=A.Width+'px';B.height=A.Height+'px';}; +var FCKListCommand=function(A,B){this.Name=A;this.TagName=B;};FCKListCommand.prototype={GetState:function(){if (FCK.EditMode!=0||!FCK.EditorWindow) return -1;var A=FCKSelection.GetBoundaryParentElement(true);var B=A;while (B){if (B.nodeName.IEquals(['ul','ol'])) break;B=B.parentNode;};if (B&&B.nodeName.IEquals(this.TagName)) return 1;else return 0;},Execute:function(){FCKUndo.SaveUndoStep();var A=FCK.EditorDocument;var B=new FCKDomRange(FCK.EditorWindow);B.MoveToSelection();var C=this.GetState();if (C==0){FCKDomTools.TrimNode(A.body);if (!A.body.firstChild){var D=A.createElement('p');A.body.appendChild(D);B.MoveToNodeContents(D);}};var E=B.CreateBookmark();var F=[];var G={};var H=new FCKDomRangeIterator(B);var I;H.ForceBrBreak=(C==0);var J=true;var K=null;while (J){while ((I=H.GetNextParagraph())){var L=new FCKElementPath(I);var M=null;var N=false;var O=L.BlockLimit;for (var i=L.Elements.length-1;i>=0;i--){var P=L.Elements[i];if (P.nodeName.IEquals(['ol','ul'])){if (O._FCK_ListGroupObject) O._FCK_ListGroupObject=null;var Q=P._FCK_ListGroupObject;if (Q) Q.contents.push(I);else{Q={ 'root':P,'contents':[I] };F.push(Q);FCKDomTools.SetElementMarker(G,P,'_FCK_ListGroupObject',Q);};N=true;break;}};if (N) continue;var R=O;if (R._FCK_ListGroupObject) R._FCK_ListGroupObject.contents.push(I);else{var Q={ 'root':R,'contents':[I] };FCKDomTools.SetElementMarker(G,R,'_FCK_ListGroupObject',Q);F.push(Q);}};if (FCKBrowserInfo.IsIE) J=false;else{if (K==null){K=[];var T=FCK.EditorWindow.getSelection();if (T&&F.length==0) K.push(T.getRangeAt(0));for (var i=1;T&&i0){var Q=F.shift();if (C==0){if (Q.root.nodeName.IEquals(['ul','ol'])) this._ChangeListType(Q,G,W);else this._CreateList(Q,W);}else if (C==1&&Q.root.nodeName.IEquals(['ul','ol'])) this._RemoveList(Q,G);};for (var i=0;iC[i-1].indent+1){var H=C[i-1].indent+1-C[i].indent;var I=C[i].indent;while (C[i]&&C[i].indent>=I){C[i].indent+=H;i++;};i--;}};var J=FCKDomTools.ArrayToList(C,B);if (A.root.nextSibling==null||A.root.nextSibling.nodeName.IEquals('br')){if (J.listNode.lastChild.nodeName.IEquals('br')) J.listNode.removeChild(J.listNode.lastChild);};A.root.parentNode.replaceChild(J.listNode,A.root);}}; +var FCKJustifyCommand=function(A){this.AlignValue=A;var B=FCKConfig.ContentLangDirection.toLowerCase();this.IsDefaultAlign=(A=='left'&&B=='ltr')||(A=='right'&&B=='rtl');var C=this._CssClassName=(function(){var D=FCKConfig.JustifyClasses;if (D){switch (A){case 'left':return D[0];case 'center':return D[1];case 'right':return D[2];case 'justify':return D[3];}};return null;})();if (C&&C.length>0) this._CssClassRegex=new RegExp('(?:^|\\s+)'+C+'(?=$|\\s)');};FCKJustifyCommand._GetClassNameRegex=function(){var A=FCKJustifyCommand._ClassRegex;if (A!=undefined) return A;var B=[];var C=FCKConfig.JustifyClasses;if (C){for (var i=0;i<4;i++){var D=C[i];if (D&&D.length>0) B.push(D);}};if (B.length>0) A=new RegExp('(?:^|\\s+)(?:'+B.join('|')+')(?=$|\\s)');else A=null;return FCKJustifyCommand._ClassRegex=A;};FCKJustifyCommand.prototype={Execute:function(){FCKUndo.SaveUndoStep();var A=new FCKDomRange(FCK.EditorWindow);A.MoveToSelection();var B=this.GetState();if (B==-1) return;var C=A.CreateBookmark();var D=this._CssClassName;var E=new FCKDomRangeIterator(A);var F;while ((F=E.GetNextParagraph())){F.removeAttribute('align');if (D){var G=F.className.replace(FCKJustifyCommand._GetClassNameRegex(),'');if (B==0){if (G.length>0) G+=' ';F.className=G+D;}else if (G.length==0) FCKDomTools.RemoveAttribute(F,'class');}else{var H=F.style;if (B==0) H.textAlign=this.AlignValue;else{H.textAlign='';if (H.cssText.length==0) F.removeAttribute('style');}}};A.MoveToBookmark(C);A.Select();FCK.Focus();FCK.Events.FireEvent('OnSelectionChange');},GetState:function(){if (FCK.EditMode!=0||!FCK.EditorWindow) return -1;var A=new FCKElementPath(FCKSelection.GetBoundaryParentElement(true));var B=A.Block||A.BlockLimit;if (!B||B.nodeName.toLowerCase()=='body') return 0;var C;if (FCKBrowserInfo.IsIE) C=B.currentStyle.textAlign;else C=FCK.EditorWindow.getComputedStyle(B,'').getPropertyValue('text-align');C=C.replace(/(-moz-|-webkit-|start|auto)/i,'');if ((!C&&this.IsDefaultAlign)||C==this.AlignValue) return 1;return 0;}}; +var FCKIndentCommand=function(A,B){this.Name=A;this.Offset=B;this.IndentCSSProperty=FCKConfig.ContentLangDirection.IEquals('ltr')?'marginLeft':'marginRight';};FCKIndentCommand._InitIndentModeParameters=function(){if (FCKConfig.IndentClasses&&FCKConfig.IndentClasses.length>0){this._UseIndentClasses=true;this._IndentClassMap={};for (var i=0;i0?H+' ':'')+FCKConfig.IndentClasses[G-1];}else{var I=parseInt(E.style[this.IndentCSSProperty],10);if (isNaN(I)) I=0;I+=this.Offset;I=Math.max(I,0);I=Math.ceil(I/this.Offset)*this.Offset;E.style[this.IndentCSSProperty]=I?I+FCKConfig.IndentUnit:'';if (E.getAttribute('style')=='') E.removeAttribute('style');}}},_IndentList:function(A,B){var C=A.StartContainer;var D=A.EndContainer;while (C&&C.parentNode!=B) C=C.parentNode;while (D&&D.parentNode!=B) D=D.parentNode;if (!C||!D) return;var E=C;var F=[];var G=false;while (G==false){if (E==D) G=true;F.push(E);E=E.nextSibling;};if (F.length<1) return;var H=FCKDomTools.GetParents(B);for (var i=0;iN;i++) M[i].indent+=I;var O=FCKDomTools.ArrayToList(M);if (O) B.parentNode.replaceChild(O.listNode,B);FCKDomTools.ClearAllMarkers(L);}}; +var FCKBlockQuoteCommand=function(){};FCKBlockQuoteCommand.prototype={Execute:function(){FCKUndo.SaveUndoStep();var A=this.GetState();var B=new FCKDomRange(FCK.EditorWindow);B.MoveToSelection();var C=B.CreateBookmark();if (FCKBrowserInfo.IsIE){var D=B.GetBookmarkNode(C,true);var E=B.GetBookmarkNode(C,false);var F;if (D&&D.parentNode.nodeName.IEquals('blockquote')&&!D.previousSibling){F=D;while ((F=F.nextSibling)){if (FCKListsLib.BlockElements[F.nodeName.toLowerCase()]) FCKDomTools.MoveNode(D,F,true);}};if (E&&E.parentNode.nodeName.IEquals('blockquote')&&!E.previousSibling){F=E;while ((F=F.nextSibling)){if (FCKListsLib.BlockElements[F.nodeName.toLowerCase()]){if (F.firstChild==D) FCKDomTools.InsertAfterNode(D,E);else FCKDomTools.MoveNode(E,F,true);}}}};var G=new FCKDomRangeIterator(B);var H;if (A==0){G.EnforceRealBlocks=true;var I=[];while ((H=G.GetNextParagraph())) I.push(H);if (I.length<1){para=B.Window.document.createElement(FCKConfig.EnterMode.IEquals('p')?'p':'div');B.InsertNode(para);para.appendChild(B.Window.document.createTextNode('\ufeff'));B.MoveToBookmark(C);B.MoveToNodeContents(para);B.Collapse(true);C=B.CreateBookmark();I.push(para);};var J=I[0].parentNode;var K=[];for (var i=0;i0){H=I.shift();while (H.parentNode!=J) H=H.parentNode;if (H!=L) K.push(H);L=H;};while (K.length>0){H=K.shift();if (H.nodeName.IEquals('blockquote')){var M=H.ownerDocument.createDocumentFragment();while (H.firstChild){M.appendChild(H.removeChild(H.firstChild));I.push(M.lastChild);};H.parentNode.replaceChild(M,H);}else I.push(H);};var N=B.Window.document.createElement('blockquote');J.insertBefore(N,I[0]);while (I.length>0){H=I.shift();N.appendChild(H);}}else if (A==1){var O=[];while ((H=G.GetNextParagraph())){var P=null;var Q=null;while (H.parentNode){if (H.parentNode.nodeName.IEquals('blockquote')){P=H.parentNode;Q=H;break;};H=H.parentNode;};if (P&&Q) O.push(Q);};var R=[];while (O.length>0){var S=O.shift();var N=S.parentNode;if (S==S.parentNode.firstChild){N.parentNode.insertBefore(N.removeChild(S),N);if (!N.firstChild) N.parentNode.removeChild(N);}else if (S==S.parentNode.lastChild){N.parentNode.insertBefore(N.removeChild(S),N.nextSibling);if (!N.firstChild) N.parentNode.removeChild(N);}else FCKDomTools.BreakParent(S,S.parentNode,B);R.push(S);};if (FCKConfig.EnterMode.IEquals('br')){while (R.length){var S=R.shift();var W=true;if (S.nodeName.IEquals('div')){var M=S.ownerDocument.createDocumentFragment();var Y=W&&S.previousSibling&&!FCKListsLib.BlockBoundaries[S.previousSibling.nodeName.toLowerCase()];if (W&&Y) M.appendChild(S.ownerDocument.createElement('br'));var Z=S.nextSibling&&!FCKListsLib.BlockBoundaries[S.nextSibling.nodeName.toLowerCase()];while (S.firstChild) M.appendChild(S.removeChild(S.firstChild));if (Z) M.appendChild(S.ownerDocument.createElement('br'));S.parentNode.replaceChild(M,S);W=false;}}}};B.MoveToBookmark(C);B.Select();FCK.Focus();FCK.Events.FireEvent('OnSelectionChange');},GetState:function(){if (FCK.EditMode!=0||!FCK.EditorWindow) return -1;var A=new FCKElementPath(FCKSelection.GetBoundaryParentElement(true));var B=A.Block||A.BlockLimit;if (!B||B.nodeName.toLowerCase()=='body') return 0;for (var i=0;i';B.open();B.write(''+G+'<\/head><\/body><\/html>');B.close();FCKTools.AddEventListenerEx(F,'focus',FCKPanel_Window_OnFocus,this);FCKTools.AddEventListenerEx(F,'blur',FCKPanel_Window_OnBlur,this);};B.dir=FCKLang.Dir;FCKTools.AddEventListener(B,'contextmenu',FCKTools.CancelEvent);this.MainNode=B.body.appendChild(B.createElement('DIV'));this.MainNode.style.cssFloat=this.IsRTL?'right':'left';};FCKPanel.prototype.AppendStyleSheet=function(A){FCKTools.AppendStyleSheet(this.Document,A);};FCKPanel.prototype.Preload=function(x,y,A){if (this._Popup) this._Popup.show(x,y,0,0,A);};FCKPanel.prototype.Show=function(x,y,A,B,C){var D;var E=this.MainNode;if (this._Popup){this._Popup.show(x,y,0,0,A);FCKDomTools.SetElementStyles(E,{B:B?B+'px':'',C:C?C+'px':''});D=E.offsetWidth;if (this.IsRTL){if (this.IsContextMenu) x=x-D+1;else if (A) x=(x*-1)+A.offsetWidth-D;};this._Popup.show(x,y,D,E.offsetHeight,A);if (this.OnHide){if (this._Timer) CheckPopupOnHide.call(this,true);this._Timer=FCKTools.SetInterval(CheckPopupOnHide,100,this);}}else{if (typeof(FCK.ToolbarSet.CurrentInstance.FocusManager)!='undefined') FCK.ToolbarSet.CurrentInstance.FocusManager.Lock();if (this.ParentPanel){this.ParentPanel.Lock();FCKPanel_Window_OnBlur(null,this.ParentPanel);};if (FCKPanel._OpenedPanel) FCKPanel._OpenedPanel.Hide();FCKDomTools.SetElementStyles(E,{B:B?B+'px':'',C:C?C+'px':''});D=E.offsetWidth;if (!B) this._IFrame.width=1;if (!C) this._IFrame.height=1;D=E.offsetWidth||E.firstChild.offsetWidth;var F=FCKTools.GetDocumentPosition(this._Window,A.nodeType==9?(FCKTools.IsStrictMode(A)?A.documentElement:A.body):A);var G=FCKDomTools.GetPositionedAncestor(FCKTools.GetElementWindow(this._IFrame),this._IFrame.parentNode);if (G){var H=FCKTools.GetDocumentPosition(FCKTools.GetElementWindow(G),G);F.x-=H.x;F.y-=H.y;};if (this.IsRTL&&!this.IsContextMenu) x=(x*-1);x+=F.x;y+=F.y;if (this.IsRTL){if (this.IsContextMenu) x=x-D+1;else if (A) x=x+A.offsetWidth-D;}else{var I=FCKTools.GetViewPaneSize(this._Window);var J=FCKTools.GetScrollPosition(this._Window);var K=I.Height+J.Y;var L=I.Width+J.X;if ((x+D)>L) x-=x+D-L;if ((y+E.offsetHeight)>K) y-=y+E.offsetHeight-K;};if (x<0) x=0;FCKDomTools.SetElementStyles(this._IFrame,{left:x+'px',top:y+'px'});var M=D;var N=E.offsetHeight;this._IFrame.width=M;this._IFrame.height=N;this._IFrame.contentWindow.focus();FCKPanel._OpenedPanel=this;};this._IsOpened=true;FCKTools.RunFunction(this.OnShow,this);};FCKPanel.prototype.Hide=function(A){if (this._Popup) this._Popup.hide();else{if (!this._IsOpened||this._LockCounter>0) return;if (typeof(FCKFocusManager)!='undefined') FCKFocusManager.Unlock();this._IFrame.width=this._IFrame.height=0;this._IsOpened=false;if (this.ParentPanel) this.ParentPanel.Unlock();if (!A) FCKTools.RunFunction(this.OnHide,this);}};FCKPanel.prototype.CheckIsOpened=function(){if (this._Popup) return this._Popup.isOpen;else return this._IsOpened;};FCKPanel.prototype.CreateChildPanel=function(){var A=this._Popup?FCKTools.GetDocumentWindow(this.Document):this._Window;var B=new FCKPanel(A);B.ParentPanel=this;return B;};FCKPanel.prototype.Lock=function(){this._LockCounter++;};FCKPanel.prototype.Unlock=function(){if (--this._LockCounter==0&&!this.HasFocus) this.Hide();};function FCKPanel_Window_OnFocus(e,A){A.HasFocus=true;};function FCKPanel_Window_OnBlur(e,A){A.HasFocus=false;if (A._LockCounter==0) FCKTools.RunFunction(A.Hide,A);};function CheckPopupOnHide(A){if (A||!this._Popup.isOpen){window.clearInterval(this._Timer);this._Timer=null;FCKTools.RunFunction(this.OnHide,this);}};function FCKPanel_Cleanup(){this._Popup=null;this._Window=null;this.Document=null;this.MainNode=null;}; +var FCKIcon=function(A){var B=A?typeof(A):'undefined';switch (B){case 'number':this.Path=FCKConfig.SkinPath+'fck_strip.gif';this.Size=16;this.Position=A;break;case 'undefined':this.Path=FCK_SPACER_PATH;break;case 'string':this.Path=A;break;default:this.Path=A[0];this.Size=A[1];this.Position=A[2];}};FCKIcon.prototype.CreateIconElement=function(A){var B,eIconImage;if (this.Position){var C='-'+((this.Position-1)*this.Size)+'px';if (FCKBrowserInfo.IsIE){B=A.createElement('DIV');eIconImage=B.appendChild(A.createElement('IMG'));eIconImage.src=this.Path;eIconImage.style.top=C;}else{B=A.createElement('IMG');B.src=FCK_SPACER_PATH;B.style.backgroundPosition='0px '+C;B.style.backgroundImage='url("'+this.Path+'")';}}else{if (FCKBrowserInfo.IsIE){B=A.createElement('DIV');eIconImage=B.appendChild(A.createElement('IMG'));eIconImage.src=this.Path?this.Path:FCK_SPACER_PATH;}else{B=A.createElement('IMG');B.src=this.Path?this.Path:FCK_SPACER_PATH;}};B.className='TB_Button_Image';return B;} +var FCKToolbarButtonUI=function(A,B,C,D,E,F){this.Name=A;this.Label=B||A;this.Tooltip=C||this.Label;this.Style=E||0;this.State=F||0;this.Icon=new FCKIcon(D);if (FCK.IECleanup) FCK.IECleanup.AddItem(this,FCKToolbarButtonUI_Cleanup);};FCKToolbarButtonUI.prototype._CreatePaddingElement=function(A){var B=A.createElement('IMG');B.className='TB_Button_Padding';B.src=FCK_SPACER_PATH;return B;};FCKToolbarButtonUI.prototype.Create=function(A){var B=FCKTools.GetElementDocument(A);var C=this.MainElement=B.createElement('DIV');C.title=this.Tooltip;if (FCKBrowserInfo.IsGecko) C.onmousedown=FCKTools.CancelEvent;FCKTools.AddEventListenerEx(C,'mouseover',FCKToolbarButtonUI_OnMouseOver,this);FCKTools.AddEventListenerEx(C,'mouseout',FCKToolbarButtonUI_OnMouseOut,this);FCKTools.AddEventListenerEx(C,'click',FCKToolbarButtonUI_OnClick,this);this.ChangeState(this.State,true);if (this.Style==0&&!this.ShowArrow){C.appendChild(this.Icon.CreateIconElement(B));}else{var D=C.appendChild(B.createElement('TABLE'));D.cellPadding=0;D.cellSpacing=0;var E=D.insertRow(-1);var F=E.insertCell(-1);if (this.Style==0||this.Style==2) F.appendChild(this.Icon.CreateIconElement(B));else F.appendChild(this._CreatePaddingElement(B));if (this.Style==1||this.Style==2){F=E.insertCell(-1);F.className='TB_Button_Text';F.noWrap=true;F.appendChild(B.createTextNode(this.Label));};if (this.ShowArrow){if (this.Style!=0){E.insertCell(-1).appendChild(this._CreatePaddingElement(B));};F=E.insertCell(-1);var G=F.appendChild(B.createElement('IMG'));G.src=FCKConfig.SkinPath+'images/toolbar.buttonarrow.gif';G.width=5;G.height=3;};F=E.insertCell(-1);F.appendChild(this._CreatePaddingElement(B));};A.appendChild(C);};FCKToolbarButtonUI.prototype.ChangeState=function(A,B){if (!B&&this.State==A) return;var e=this.MainElement;if (!e) return;switch (parseInt(A,10)){case 0:e.className='TB_Button_Off';break;case 1:e.className='TB_Button_On';break;case -1:e.className='TB_Button_Disabled';break;};this.State=A;};function FCKToolbarButtonUI_OnMouseOver(A,B){if (B.State==0) this.className='TB_Button_Off_Over';else if (B.State==1) this.className='TB_Button_On_Over';};function FCKToolbarButtonUI_OnMouseOut(A,B){if (B.State==0) this.className='TB_Button_Off';else if (B.State==1) this.className='TB_Button_On';};function FCKToolbarButtonUI_OnClick(A,B){if (B.OnClick&&B.State!=-1) B.OnClick(B);};function FCKToolbarButtonUI_Cleanup(){this.MainElement=null;}; +var FCKToolbarButton=function(A,B,C,D,E,F,G){this.CommandName=A;this.Label=B;this.Tooltip=C;this.Style=D;this.SourceView=E?true:false;this.ContextSensitive=F?true:false;if (G==null) this.IconPath=FCKConfig.SkinPath+'toolbar/'+A.toLowerCase()+'.gif';else if (typeof(G)=='number') this.IconPath=[FCKConfig.SkinPath+'fck_strip.gif',16,G];else this.IconPath=G;};FCKToolbarButton.prototype.Create=function(A){this._UIButton=new FCKToolbarButtonUI(this.CommandName,this.Label,this.Tooltip,this.IconPath,this.Style);this._UIButton.OnClick=this.Click;this._UIButton._ToolbarButton=this;this._UIButton.Create(A);};FCKToolbarButton.prototype.RefreshState=function(){var A=FCK.ToolbarSet.CurrentInstance.Commands.GetCommand(this.CommandName).GetState();if (A==this._UIButton.State) return;this._UIButton.ChangeState(A);};FCKToolbarButton.prototype.Click=function(){var A=this._ToolbarButton||this;FCK.ToolbarSet.CurrentInstance.Commands.GetCommand(A.CommandName).Execute();};FCKToolbarButton.prototype.Enable=function(){this.RefreshState();};FCKToolbarButton.prototype.Disable=function(){this._UIButton.ChangeState(-1);} +var FCKSpecialCombo=function(A,B,C,D,E){this.FieldWidth=B||100;this.PanelWidth=C||150;this.PanelMaxHeight=D||150;this.Label=' ';this.Caption=A;this.Tooltip=A;this.Style=2;this.Enabled=true;this.Items={};this._Panel=new FCKPanel(E||window);this._Panel.AppendStyleSheet(FCKConfig.SkinPath+'fck_editor.css');this._PanelBox=this._Panel.MainNode.appendChild(this._Panel.Document.createElement('DIV'));this._PanelBox.className='SC_Panel';this._PanelBox.style.width=this.PanelWidth+'px';this._PanelBox.innerHTML='
    ';this._ItemsHolderEl=this._PanelBox.getElementsByTagName('TD')[0];if (FCK.IECleanup) FCK.IECleanup.AddItem(this,FCKSpecialCombo_Cleanup);};function FCKSpecialCombo_ItemOnMouseOver(){this.className+=' SC_ItemOver';};function FCKSpecialCombo_ItemOnMouseOut(){this.className=this.originalClass;};function FCKSpecialCombo_ItemOnClick(A,B,C){this.className=this.originalClass;B._Panel.Hide();B.SetLabel(this.FCKItemLabel);if (typeof(B.OnSelect)=='function') B.OnSelect(C,this);};FCKSpecialCombo.prototype.ClearItems=function (){if (this.Items) this.Items={};var A=this._ItemsHolderEl;while (A.firstChild) A.removeChild(A.firstChild);};FCKSpecialCombo.prototype.AddItem=function(A,B,C,D){var E=this._ItemsHolderEl.appendChild(this._Panel.Document.createElement('DIV'));E.className=E.originalClass='SC_Item';E.innerHTML=B;E.FCKItemLabel=C||A;E.Selected=false;if (FCKBrowserInfo.IsIE) E.style.width='100%';if (D) E.style.backgroundColor=D;FCKTools.AddEventListenerEx(E,'mouseover',FCKSpecialCombo_ItemOnMouseOver);FCKTools.AddEventListenerEx(E,'mouseout',FCKSpecialCombo_ItemOnMouseOut);FCKTools.AddEventListenerEx(E,'click',FCKSpecialCombo_ItemOnClick,[this,A]);this.Items[A.toString().toLowerCase()]=E;return E;};FCKSpecialCombo.prototype.SelectItem=function(A){if (typeof A=='string') A=this.Items[A.toString().toLowerCase()];if (A){A.className=A.originalClass='SC_ItemSelected';A.Selected=true;}};FCKSpecialCombo.prototype.SelectItemByLabel=function(A,B){for (var C in this.Items){var D=this.Items[C];if (D.FCKItemLabel==A){D.className=D.originalClass='SC_ItemSelected';D.Selected=true;if (B) this.SetLabel(A);}}};FCKSpecialCombo.prototype.DeselectAll=function(A){for (var i in this.Items){if (!this.Items[i]) continue;this.Items[i].className=this.Items[i].originalClass='SC_Item';this.Items[i].Selected=false;};if (A) this.SetLabel('');};FCKSpecialCombo.prototype.SetLabelById=function(A){A=A?A.toString().toLowerCase():'';var B=this.Items[A];this.SetLabel(B?B.FCKItemLabel:'');};FCKSpecialCombo.prototype.SetLabel=function(A){A=(!A||A.length==0)?' ':A;if (A==this.Label) return;this.Label=A;var B=this._LabelEl;if (B){B.innerHTML=A;FCKTools.DisableSelection(B);}};FCKSpecialCombo.prototype.SetEnabled=function(A){this.Enabled=A;if (this._OuterTable) this._OuterTable.className=A?'':'SC_FieldDisabled';};FCKSpecialCombo.prototype.Create=function(A){var B=FCKTools.GetElementDocument(A);var C=this._OuterTable=A.appendChild(B.createElement('TABLE'));C.cellPadding=0;C.cellSpacing=0;C.insertRow(-1);var D;var E;switch (this.Style){case 0:D='TB_ButtonType_Icon';E=false;break;case 1:D='TB_ButtonType_Text';E=false;break;case 2:E=true;break;};if (this.Caption&&this.Caption.length>0&&E){var F=C.rows[0].insertCell(-1);F.innerHTML=this.Caption;F.className='SC_FieldCaption';};var G=FCKTools.AppendElement(C.rows[0].insertCell(-1),'div');if (E){G.className='SC_Field';G.style.width=this.FieldWidth+'px';G.innerHTML='
     
    ';this._LabelEl=G.getElementsByTagName('label')[0];this._LabelEl.innerHTML=this.Label;}else{G.className='TB_Button_Off';G.innerHTML='
    '+this.Caption+'
    ';};FCKTools.AddEventListenerEx(G,'mouseover',FCKSpecialCombo_OnMouseOver,this);FCKTools.AddEventListenerEx(G,'mouseout',FCKSpecialCombo_OnMouseOut,this);FCKTools.AddEventListenerEx(G,'click',FCKSpecialCombo_OnClick,this);FCKTools.DisableSelection(this._Panel.Document.body);};function FCKSpecialCombo_Cleanup(){this._LabelEl=null;this._OuterTable=null;this._ItemsHolderEl=null;this._PanelBox=null;if (this.Items){for (var A in this.Items) this.Items[A]=null;}};function FCKSpecialCombo_OnMouseOver(A,B){if (B.Enabled){switch (B.Style){case 0:this.className='TB_Button_On_Over';break;case 1:this.className='TB_Button_On_Over';break;case 2:this.className='SC_Field SC_FieldOver';break;}}};function FCKSpecialCombo_OnMouseOut(A,B){switch (B.Style){case 0:this.className='TB_Button_Off';break;case 1:this.className='TB_Button_Off';break;case 2:this.className='SC_Field';break;}};function FCKSpecialCombo_OnClick(e,A){if (A.Enabled){var B=A._Panel;var C=A._PanelBox;var D=A._ItemsHolderEl;var E=A.PanelMaxHeight;if (A.OnBeforeClick) A.OnBeforeClick(A);if (FCKBrowserInfo.IsIE) B.Preload(0,this.offsetHeight,this);if (D.offsetHeight>E) C.style.height=E+'px';else C.style.height='';B.Show(0,this.offsetHeight,this);}}; +var FCKToolbarSpecialCombo=function(){this.SourceView=false;this.ContextSensitive=true;};FCKToolbarSpecialCombo.prototype.DefaultLabel='';function FCKToolbarSpecialCombo_OnSelect(A,B){FCK.ToolbarSet.CurrentInstance.Commands.GetCommand(this.CommandName).Execute(A,B);};FCKToolbarSpecialCombo.prototype.Create=function(A){this._Combo=new FCKSpecialCombo(this.GetLabel(),this.FieldWidth,this.PanelWidth,this.PanelMaxHeight,FCKBrowserInfo.IsIE?window:FCKTools.GetElementWindow(A).parent);this._Combo.Tooltip=this.Tooltip;this._Combo.Style=this.Style;this.CreateItems(this._Combo);this._Combo.Create(A);this._Combo.CommandName=this.CommandName;this._Combo.OnSelect=FCKToolbarSpecialCombo_OnSelect;};function FCKToolbarSpecialCombo_RefreshActiveItems(A,B){A.DeselectAll();A.SelectItem(B);A.SetLabelById(B);};FCKToolbarSpecialCombo.prototype.RefreshState=function(){var A;var B=FCK.ToolbarSet.CurrentInstance.Commands.GetCommand(this.CommandName).GetState();if (B!=-1){A=1;if (this.RefreshActiveItems) this.RefreshActiveItems(this._Combo,B);else{if (this._LastValue!==B){this._LastValue=B;if (!B||B.length==0){this._Combo.DeselectAll();this._Combo.SetLabel(this.DefaultLabel);}else FCKToolbarSpecialCombo_RefreshActiveItems(this._Combo,B);}}}else A=-1;if (A==this.State) return;if (A==-1){this._Combo.DeselectAll();this._Combo.SetLabel('');};this.State=A;this._Combo.SetEnabled(A!=-1);};FCKToolbarSpecialCombo.prototype.Enable=function(){this.RefreshState();};FCKToolbarSpecialCombo.prototype.Disable=function(){this.State=-1;this._Combo.DeselectAll();this._Combo.SetLabel('');this._Combo.SetEnabled(false);}; +var FCKToolbarStyleCombo=function(A,B){if (A===false) return;this.CommandName='Style';this.Label=this.GetLabel();this.Tooltip=A?A:this.Label;this.Style=B?B:2;this.DefaultLabel=FCKConfig.DefaultStyleLabel||'';};FCKToolbarStyleCombo.prototype=new FCKToolbarSpecialCombo;FCKToolbarStyleCombo.prototype.GetLabel=function(){return FCKLang.Style;};FCKToolbarStyleCombo.prototype.GetStyles=function(){var A={};var B=FCK.ToolbarSet.CurrentInstance.Styles.GetStyles();for (var C in B){var D=B[C];if (!D.IsCore) A[C]=D;};return A;};FCKToolbarStyleCombo.prototype.CreateItems=function(A){var B=A._Panel.Document;FCKTools.AppendStyleSheet(B,FCKConfig.ToolbarComboPreviewCSS);FCKTools.AppendStyleString(B,FCKConfig.EditorAreaStyles);B.body.className+=' ForceBaseFont';FCKConfig.ApplyBodyAttributes(B.body);var C=this.GetStyles();for (var D in C){var E=C[D];var F=E.GetType()==2?D:FCKToolbarStyleCombo_BuildPreview(E,E.Label||D);var G=A.AddItem(D,F);G.Style=E;};A.OnBeforeClick=this.StyleCombo_OnBeforeClick;};FCKToolbarStyleCombo.prototype.RefreshActiveItems=function(A){var B=FCK.ToolbarSet.CurrentInstance.Selection.GetBoundaryParentElement(true);if (B){var C=new FCKElementPath(B);var D=C.Elements;for (var e=0;e');var E=A.Element;if (E=='bdo') E='span';D=['<',E];var F=A._StyleDesc.Attributes;if (F){for (var G in F){D.push(' ',G,'="',A.GetFinalAttributeValue(G),'"');}};if (A._GetStyleText().length>0) D.push(' style="',A.GetFinalStyleValue(),'"');D.push('>',B,'');if (C==0) D.push('');return D.join('');} +var FCKToolbarFontFormatCombo=function(A,B){if (A===false) return;this.CommandName='FontFormat';this.Label=this.GetLabel();this.Tooltip=A?A:this.Label;this.Style=B?B:2;this.NormalLabel='Normal';this.PanelWidth=190;this.DefaultLabel=FCKConfig.DefaultFontFormatLabel||'';};FCKToolbarFontFormatCombo.prototype=new FCKToolbarStyleCombo(false);FCKToolbarFontFormatCombo.prototype.GetLabel=function(){return FCKLang.FontFormat;};FCKToolbarFontFormatCombo.prototype.GetStyles=function(){var A={};var B=FCKLang['FontFormats'].split(';');var C={p:B[0],pre:B[1],address:B[2],h1:B[3],h2:B[4],h3:B[5],h4:B[6],h5:B[7],h6:B[8],div:B[9]||(B[0]+' (DIV)')};var D=FCKConfig.FontFormats.split(';');for (var i=0;i';G.open();G.write(''+H+''+document.getElementById('xToolbarSpace').innerHTML+'');G.close();FCKTools.AddEventListener(G,'contextmenu',FCKTools.CancelEvent);FCKTools.AppendStyleSheet(G,FCKConfig.SkinPath+'fck_editor.css');B=D.__FCKToolbarSet=new FCKToolbarSet(G);B._IFrame=F;if (FCK.IECleanup) FCK.IECleanup.AddItem(D,FCKToolbarSet_Target_Cleanup);};B.CurrentInstance=FCK;FCK.AttachToOnSelectionChange(B.RefreshItemsState);return B;};function FCK_OnBlur(A){var B=A.ToolbarSet;if (B.CurrentInstance==A) B.Disable();};function FCK_OnFocus(A){var B=A.ToolbarSet;var C=A||FCK;B.CurrentInstance.FocusManager.RemoveWindow(B._IFrame.contentWindow);B.CurrentInstance=C;C.FocusManager.AddWindow(B._IFrame.contentWindow,true);B.Enable();};function FCKToolbarSet_Cleanup(){this._TargetElement=null;this._IFrame=null;};function FCKToolbarSet_Target_Cleanup(){this.__FCKToolbarSet=null;};var FCKToolbarSet=function(A){this._Document=A;this._TargetElement=A.getElementById('xToolbar');var B=A.getElementById('xExpandHandle');var C=A.getElementById('xCollapseHandle');B.title=FCKLang.ToolbarExpand;FCKTools.AddEventListener(B,'click',FCKToolbarSet_Expand_OnClick);C.title=FCKLang.ToolbarCollapse;FCKTools.AddEventListener(C,'click',FCKToolbarSet_Collapse_OnClick);if (!FCKConfig.ToolbarCanCollapse||FCKConfig.ToolbarStartExpanded) this.Expand();else this.Collapse();C.style.display=FCKConfig.ToolbarCanCollapse?'':'none';if (FCKConfig.ToolbarCanCollapse) C.style.display='';else A.getElementById('xTBLeftBorder').style.display='';this.Toolbars=[];this.IsLoaded=false;if (FCK.IECleanup) FCK.IECleanup.AddItem(this,FCKToolbarSet_Cleanup);};function FCKToolbarSet_Expand_OnClick(){FCK.ToolbarSet.Expand();};function FCKToolbarSet_Collapse_OnClick(){FCK.ToolbarSet.Collapse();};FCKToolbarSet.prototype.Expand=function(){this._ChangeVisibility(false);};FCKToolbarSet.prototype.Collapse=function(){this._ChangeVisibility(true);};FCKToolbarSet.prototype._ChangeVisibility=function(A){this._Document.getElementById('xCollapsed').style.display=A?'':'none';this._Document.getElementById('xExpanded').style.display=A?'none':'';if (FCKBrowserInfo.IsGecko){FCKTools.RunFunction(window.onresize);}};FCKToolbarSet.prototype.Load=function(A){this.Name=A;this.Items=[];this.ItemsWysiwygOnly=[];this.ItemsContextSensitive=[];this._TargetElement.innerHTML='';var B=FCKConfig.ToolbarSets[A];if (!B){alert(FCKLang.UnknownToolbarSet.replace(/%1/g,A));return;};this.Toolbars=[];for (var x=0;x0) A.deleteRow(0);}};FCKMenuBlock.prototype.Create=function(A){if (!this._ItemsTable){if (FCK.IECleanup) FCK.IECleanup.AddItem(this,FCKMenuBlock_Cleanup);this._Window=FCKTools.GetElementWindow(A);var B=FCKTools.GetElementDocument(A);var C=A.appendChild(B.createElement('table'));C.cellPadding=0;C.cellSpacing=0;FCKTools.DisableSelection(C);var D=C.insertRow(-1).insertCell(-1);D.className='MN_Menu';var E=this._ItemsTable=D.appendChild(B.createElement('table'));E.cellPadding=0;E.cellSpacing=0;};for (var i=0;i0&&F.href.length==0);if (G) return;menu.AddSeparator();if (E) menu.AddItem('Link',FCKLang.EditLink,34);menu.AddItem('Unlink',FCKLang.RemoveLink,35);}}};case 'Image':return {AddItems:function(menu,tag,tagName){if (tagName=='IMG'&&!tag.getAttribute('_fckfakelement')){menu.AddSeparator();menu.AddItem('Image',FCKLang.ImageProperties,37);}}};case 'Anchor':return {AddItems:function(menu,tag,tagName){var F=FCKSelection.MoveToAncestorNode('A');var G=(F&&F.name.length>0);if (G||(tagName=='IMG'&&tag.getAttribute('_fckanchor'))){menu.AddSeparator();menu.AddItem('Anchor',FCKLang.AnchorProp,36);menu.AddItem('AnchorDelete',FCKLang.AnchorDelete);}}};case 'Flash':return {AddItems:function(menu,tag,tagName){if (tagName=='IMG'&&tag.getAttribute('_fckflash')){menu.AddSeparator();menu.AddItem('Flash',FCKLang.FlashProperties,38);}}};case 'Form':return {AddItems:function(menu,tag,tagName){if (FCKSelection.HasAncestorNode('FORM')){menu.AddSeparator();menu.AddItem('Form',FCKLang.FormProp,48);}}};case 'Checkbox':return {AddItems:function(menu,tag,tagName){if (tagName=='INPUT'&&tag.type=='checkbox'){menu.AddSeparator();menu.AddItem('Checkbox',FCKLang.CheckboxProp,49);}}};case 'Radio':return {AddItems:function(menu,tag,tagName){if (tagName=='INPUT'&&tag.type=='radio'){menu.AddSeparator();menu.AddItem('Radio',FCKLang.RadioButtonProp,50);}}};case 'TextField':return {AddItems:function(menu,tag,tagName){if (tagName=='INPUT'&&(tag.type=='text'||tag.type=='password')){menu.AddSeparator();menu.AddItem('TextField',FCKLang.TextFieldProp,51);}}};case 'HiddenField':return {AddItems:function(menu,tag,tagName){if (tagName=='IMG'&&tag.getAttribute('_fckinputhidden')){menu.AddSeparator();menu.AddItem('HiddenField',FCKLang.HiddenFieldProp,56);}}};case 'ImageButton':return {AddItems:function(menu,tag,tagName){if (tagName=='INPUT'&&tag.type=='image'){menu.AddSeparator();menu.AddItem('ImageButton',FCKLang.ImageButtonProp,55);}}};case 'Button':return {AddItems:function(menu,tag,tagName){if (tagName=='INPUT'&&(tag.type=='button'||tag.type=='submit'||tag.type=='reset')){menu.AddSeparator();menu.AddItem('Button',FCKLang.ButtonProp,54);}}};case 'Select':return {AddItems:function(menu,tag,tagName){if (tagName=='SELECT'){menu.AddSeparator();menu.AddItem('Select',FCKLang.SelectionFieldProp,53);}}};case 'Textarea':return {AddItems:function(menu,tag,tagName){if (tagName=='TEXTAREA'){menu.AddSeparator();menu.AddItem('Textarea',FCKLang.TextareaProp,52);}}};case 'BulletedList':return {AddItems:function(menu,tag,tagName){if (FCKSelection.HasAncestorNode('UL')){menu.AddSeparator();menu.AddItem('BulletedList',FCKLang.BulletedListProp,27);}}};case 'NumberedList':return {AddItems:function(menu,tag,tagName){if (FCKSelection.HasAncestorNode('OL')){menu.AddSeparator();menu.AddItem('NumberedList',FCKLang.NumberedListProp,26);}}};};return null;};function FCK_ContextMenu_OnBeforeOpen(){FCK.Events.FireEvent('OnSelectionChange');var A,sTagName;if ((A=FCKSelection.GetSelectedElement())) sTagName=A.tagName;var B=FCK.ContextMenu._InnerContextMenu;B.RemoveAllItems();var C=FCK.ContextMenu.Listeners;for (var i=0;i0){var A;if (this.AvailableLangs.IndexOf(FCKLanguageManager.ActiveLanguage.Code)>=0) A=FCKLanguageManager.ActiveLanguage.Code;else A=this.AvailableLangs[0];LoadScript(this.Path+'lang/'+A+'.js');};LoadScript(this.Path+'fckplugin.js');} +var FCKPlugins=FCK.Plugins={};FCKPlugins.ItemsCount=0;FCKPlugins.Items={};FCKPlugins.Load=function(){var A=FCKPlugins.Items;for (var i=0;i-1);};String.prototype.Equals=function(){var A=arguments;if (A.length==1&&A[0].pop) A=A[0];for (var i=0;iC) return false;if (B){var E=new RegExp(A+'$','i');return E.test(this);}else return (D==0||this.substr(C-D,D)==A);};String.prototype.Remove=function(A,B){var s='';if (A>0) s=this.substring(0,A);if (A+B0){var B=A.pop();if (B) B[1].call(B[0]);};this._FCKCleanupObj=null;if (CollectGarbage) CollectGarbage();}; +var s=navigator.userAgent.toLowerCase();var FCKBrowserInfo={IsIE:/*@cc_on!@*/false,IsIE7:/*@cc_on!@*/false && ( parseFloat( s.match( /msie ([\d|\.]+)/)[1])>=7),IsGecko:s.Contains('gecko/'),IsSafari:s.Contains(' applewebkit/'),IsOpera:!!window.opera,IsMac:s.Contains('macintosh')};(function(A){A.IsGeckoLike=(A.IsGecko||A.IsSafari||A.IsOpera);if (A.IsGecko){var B=s.match(/gecko\/(\d+)/)[1];A.IsGecko10=((B<20051111)||(/rv:1\.7/.test(s)));A.IsGecko19=/rv:1\.9/.test(s);}else A.IsGecko10=false;})(FCKBrowserInfo); +var FCKURLParams={};(function(){var A=document.location.search.substr(1).split('&');for (var i=0;i';if (!FCKRegexLib.HtmlOpener.test(A)) A=''+A+'';if (!FCKRegexLib.HeadOpener.test(A)) A=A.replace(FCKRegexLib.HtmlOpener,'$&');return A;}else{var B=FCKConfig.DocType+'0&&!FCKRegexLib.Html4DocType.test(FCKConfig.DocType)) B+=' style="overflow-y: scroll"';B+='>'+A+'';return B;}},ConvertToDataFormat:function(A,B,C,D){var E=FCKXHtml.GetXHTML(A,!B,D);if (C&&FCKRegexLib.EmptyOutParagraph.test(E)) return '';return E;},FixHtml:function(A){return A;}}; +var FCK={Name:FCKURLParams['InstanceName'],Status:0,EditMode:0,Toolbar:null,HasFocus:false,DataProcessor:new FCKDataProcessor(),AttachToOnSelectionChange:function(A){this.Events.AttachEvent('OnSelectionChange',A);},GetLinkedFieldValue:function(){return this.LinkedField.value;},GetParentForm:function(){return this.LinkedField.form;},StartupValue:'',IsDirty:function(){if (this.EditMode==1) return (this.StartupValue!=this.EditingArea.Textarea.value);else{if (!this.EditorDocument) return false;return (this.StartupValue!=this.EditorDocument.body.innerHTML);}},ResetIsDirty:function(){if (this.EditMode==1) this.StartupValue=this.EditingArea.Textarea.value;else if (this.EditorDocument.body) this.StartupValue=this.EditorDocument.body.innerHTML;},StartEditor:function(){this.TempBaseTag=FCKConfig.BaseHref.length>0?'':'';var A=FCK.KeystrokeHandler=new FCKKeystrokeHandler();A.OnKeystroke=_FCK_KeystrokeHandler_OnKeystroke;A.SetKeystrokes(FCKConfig.Keystrokes);if (FCKBrowserInfo.IsIE7){if ((CTRL+86/*V*/) in A.Keystrokes) A.SetKeystrokes([CTRL+86,true]);if ((SHIFT+45/*INS*/) in A.Keystrokes) A.SetKeystrokes([SHIFT+45,true]);};A.SetKeystrokes([CTRL+8,true]);this.EditingArea=new FCKEditingArea(document.getElementById('xEditingArea'));this.EditingArea.FFSpellChecker=FCKConfig.FirefoxSpellChecker;this.SetData(this.GetLinkedFieldValue(),true);FCKTools.AddEventListener(document,"keydown",this._TabKeyHandler);this.AttachToOnSelectionChange(_FCK_PaddingNodeListener);if (FCKBrowserInfo.IsGecko) this.AttachToOnSelectionChange(this._ExecCheckEmptyBlock);},Focus:function(){FCK.EditingArea.Focus();},SetStatus:function(A){this.Status=A;if (A==1){FCKFocusManager.AddWindow(window,true);if (FCKBrowserInfo.IsIE) FCKFocusManager.AddWindow(window.frameElement,true);if (FCKConfig.StartupFocus) FCK.Focus();};this.Events.FireEvent('OnStatusChange',A);},FixBody:function(){var A=FCKConfig.EnterMode;if (A!='p'&&A!='div') return;var B=this.EditorDocument;if (!B) return;var C=B.body;if (!C) return;FCKDomTools.TrimNode(C);var D=C.firstChild;var E;while (D){var F=false;switch (D.nodeType){case 1:if (!FCKListsLib.BlockElements[D.nodeName.toLowerCase()]&&!D.getAttribute('_fckfakelement')&&D.getAttribute('_moz_dirty')==null) F=true;break;case 3:if (E||D.nodeValue.Trim().length>0) F=true;};if (F){var G=D.parentNode;if (!E) E=G.insertBefore(B.createElement(A),D);E.appendChild(G.removeChild(D));D=E.nextSibling;}else{if (E){FCKDomTools.TrimNode(E);E=null;};D=D.nextSibling;}};if (E) FCKDomTools.TrimNode(E);},GetData:function(A){if (FCK.EditMode==1) return FCK.EditingArea.Textarea.value;this.FixBody();var B=FCK.EditorDocument;if (!B) return null;var C=FCKConfig.FullPage;var D=FCK.DataProcessor.ConvertToDataFormat(C?B.documentElement:B.body,!C,FCKConfig.IgnoreEmptyParagraphValue,A);D=FCK.ProtectEventsRestore(D);if (FCKBrowserInfo.IsIE) D=D.replace(FCKRegexLib.ToReplace,'$1');if (C){if (FCK.DocTypeDeclaration&&FCK.DocTypeDeclaration.length>0) D=FCK.DocTypeDeclaration+'\n'+D;if (FCK.XmlDeclaration&&FCK.XmlDeclaration.length>0) D=FCK.XmlDeclaration+'\n'+D;};return FCKConfig.ProtectedSource.Revert(D);},UpdateLinkedField:function(){var A=FCK.GetXHTML(FCKConfig.FormatOutput);if (FCKConfig.HtmlEncodeOutput) A=FCKTools.HTMLEncode(A);FCK.LinkedField.value=A;FCK.Events.FireEvent('OnAfterLinkedFieldUpdate');},RegisteredDoubleClickHandlers:{},OnDoubleClick:function(A){var B=FCK.RegisteredDoubleClickHandlers[A.tagName];if (B) B(A);},RegisterDoubleClickHandler:function(A,B){FCK.RegisteredDoubleClickHandlers[B.toUpperCase()]=A;},OnAfterSetHTML:function(){FCKDocumentProcessor.Process(FCK.EditorDocument);FCKUndo.SaveUndoStep();FCK.Events.FireEvent('OnSelectionChange');FCK.Events.FireEvent('OnAfterSetHTML');},ProtectUrls:function(A){A=A.replace(FCKRegexLib.ProtectUrlsA,'$& _fcksavedurl=$1');A=A.replace(FCKRegexLib.ProtectUrlsImg,'$& _fcksavedurl=$1');A=A.replace(FCKRegexLib.ProtectUrlsArea,'$& _fcksavedurl=$1');return A;},ProtectEvents:function(A){return A.replace(FCKRegexLib.TagsWithEvent,_FCK_ProtectEvents_ReplaceTags);},ProtectEventsRestore:function(A){return A.replace(FCKRegexLib.ProtectedEvents,_FCK_ProtectEvents_RestoreEvents);},ProtectTags:function(A){var B=FCKConfig.ProtectedTags;if (FCKBrowserInfo.IsIE) B+=B.length>0?'|ABBR|XML|EMBED':'ABBR|XML|EMBED';var C;if (B.length>0){C=new RegExp('<('+B+')(?!\w|:)','gi');A=A.replace(C,'','gi');A=A.replace(C,'<\/FCK:$1>');};B='META';if (FCKBrowserInfo.IsIE) B+='|HR';C=new RegExp('<(('+B+')(?=\\s|>|/)[\\s\\S]*?)/?>','gi');A=A.replace(C,'');return A;},SetData:function(A,B){this.EditingArea.Mode=FCK.EditMode;if (FCKBrowserInfo.IsIE&&FCK.EditorDocument){FCK.EditorDocument.detachEvent("onselectionchange",Doc_OnSelectionChange);};if (FCK.EditMode==0){this._ForceResetIsDirty=(B===true);A=FCKConfig.ProtectedSource.Protect(A);A=FCK.DataProcessor.ConvertToHtml(A);A=A.replace(FCKRegexLib.InvalidSelfCloseTags,'$1>');A=FCK.ProtectEvents(A);A=FCK.ProtectUrls(A);A=FCK.ProtectTags(A);if (FCK.TempBaseTag.length>0&&!FCKRegexLib.HasBaseTag.test(A)) A=A.replace(FCKRegexLib.HeadOpener,'$&'+FCK.TempBaseTag);var C='';if (!FCKConfig.FullPage) C+=_FCK_GetEditorAreaStyleTags();if (FCKBrowserInfo.IsIE) C+=FCK._GetBehaviorsStyle();else if (FCKConfig.ShowBorders) C+='';C+='';A=A.replace(FCKRegexLib.HeadCloser,C+'$&');this.EditingArea.OnLoad=_FCK_EditingArea_OnLoad;this.EditingArea.Start(A);}else{FCK.EditorWindow=null;FCK.EditorDocument=null;FCKDomTools.PaddingNode=null;this.EditingArea.OnLoad=null;this.EditingArea.Start(A);this.EditingArea.Textarea._FCKShowContextMenu=true;FCK.EnterKeyHandler=null;if (B) this.ResetIsDirty();FCK.KeystrokeHandler.AttachToElement(this.EditingArea.Textarea);this.EditingArea.Textarea.focus();FCK.Events.FireEvent('OnAfterSetHTML');};if (FCKBrowserInfo.IsGecko) window.onresize();},HasFocus:false,RedirectNamedCommands:{},ExecuteNamedCommand:function(A,B,C,D){if (!D) FCKUndo.SaveUndoStep();if (!C&&FCK.RedirectNamedCommands[A]!=null) FCK.ExecuteRedirectedNamedCommand(A,B);else{FCK.Focus();FCK.EditorDocument.execCommand(A,false,B);FCK.Events.FireEvent('OnSelectionChange');};if (!D) FCKUndo.SaveUndoStep();},GetNamedCommandState:function(A){try{if (FCKBrowserInfo.IsSafari&&FCK.EditorWindow&&A.IEquals('Paste')) return 0;if (!FCK.EditorDocument.queryCommandEnabled(A)) return -1;else{return FCK.EditorDocument.queryCommandState(A)?1:0;}}catch (e){return 0;}},GetNamedCommandValue:function(A){var B='';var C=FCK.GetNamedCommandState(A);if (C==-1) return null;try{B=this.EditorDocument.queryCommandValue(A);}catch(e) {};return B?B:'';},Paste:function(A){if (FCK.Status!=2||!FCK.Events.FireEvent('OnPaste')) return false;return A||FCK._ExecPaste();},PasteFromWord:function(){FCKDialog.OpenDialog('FCKDialog_Paste',FCKLang.PasteFromWord,'dialog/fck_paste.html',400,330,'Word');},Preview:function(){var A=FCKConfig.ScreenWidth*0.8;var B=FCKConfig.ScreenHeight*0.7;var C=(FCKConfig.ScreenWidth-A)/2;var D=window.open('',null,'toolbar=yes,location=no,status=yes,menubar=yes,scrollbars=yes,resizable=yes,width='+A+',height='+B+',left='+C);var E;if (FCKConfig.FullPage){if (FCK.TempBaseTag.length>0) E=FCK.TempBaseTag+FCK.GetXHTML();else E=FCK.GetXHTML();}else{E=FCKConfig.DocType+''+FCK.TempBaseTag+''+FCKLang.Preview+''+_FCK_GetEditorAreaStyleTags()+''+FCK.GetXHTML()+'';};D.document.write(E);D.document.close();},SwitchEditMode:function(A){var B=(FCK.EditMode==0);var C=FCK.IsDirty();var D;if (B){FCKCommands.GetCommand('ShowBlocks').SaveState();if (!A&&FCKBrowserInfo.IsIE) FCKUndo.SaveUndoStep();D=FCK.GetXHTML(FCKConfig.FormatSource);if (D==null) return false;}else D=this.EditingArea.Textarea.value;FCK.EditMode=B?1:0;FCK.SetData(D,!C);FCK.Focus();FCKTools.RunFunction(FCK.ToolbarSet.RefreshModeState,FCK.ToolbarSet);return true;},InsertElement:function(A){if (typeof A=='string') A=this.EditorDocument.createElement(A);var B=A.nodeName.toLowerCase();var C=new FCKDomRange(this.EditorWindow);if (FCKListsLib.BlockElements[B]!=null){C.SplitBlock();C.InsertNode(A);var D=FCKDomTools.GetNextSourceElement(A,false,null,['hr','br','param','img','area','input']);if (!D&&FCKConfig.EnterMode!='br'){D=this.EditorDocument.body.appendChild(this.EditorDocument.createElement(FCKConfig.EnterMode));if (FCKBrowserInfo.IsGeckoLike) FCKTools.AppendBogusBr(D);};if (FCKListsLib.EmptyElements[B]==null) C.MoveToElementEditStart(A);else if (D) C.MoveToElementEditStart(D);else C.MoveToPosition(A,4);if (FCKBrowserInfo.IsGecko){if (D) D.scrollIntoView(false);A.scrollIntoView(false);}}else{C.MoveToSelection();C.DeleteContents();C.InsertNode(A);C.SetStart(A,4);C.SetEnd(A,4);};C.Select();C.Release();this.Focus();return A;},_InsertBlockElement:function(A){},_IsFunctionKey:function(A){if (A>=16&&A<=20) return true;if (A==27||(A>=33&&A<=40)) return true;if (A==45) return true;return false;},_KeyDownListener:function(A){if (!A) A=FCK.EditorWindow.event;if (FCK.EditorWindow){if (!FCK._IsFunctionKey(A.keyCode)&&!(A.ctrlKey||A.metaKey)&&!(A.keyCode==46)) FCK._KeyDownUndo();};return true;},_KeyDownUndo:function(){if (!FCKUndo.Typing){FCKUndo.SaveUndoStep();FCKUndo.Typing=true;FCK.Events.FireEvent("OnSelectionChange");};FCKUndo.TypesCount++;FCKUndo.Changed=1;if (FCKUndo.TypesCount>FCKUndo.MaxTypes){FCKUndo.TypesCount=0;FCKUndo.SaveUndoStep();}},_TabKeyHandler:function(A){if (!A) A=window.event;var B=A.keyCode;if (B==9&&FCK.EditMode!=0){if (FCKBrowserInfo.IsIE){var C=document.selection.createRange();if (C.parentElement()!=FCK.EditingArea.Textarea) return true;C.text='\t';C.select();}else{var a=[];var D=FCK.EditingArea.Textarea;var E=D.selectionStart;var F=D.selectionEnd;a.push(D.value.substr(0,E));a.push('\t');a.push(D.value.substr(F));D.value=a.join('');D.setSelectionRange(E+1,E+1);};if (A.preventDefault) return A.preventDefault();return A.returnValue=false;};return true;}};FCK.Events=new FCKEvents(FCK);FCK.GetHTML=FCK.GetXHTML=FCK.GetData;FCK.SetHTML=FCK.SetData;FCK.InsertElementAndGetIt=FCK.CreateElement=FCK.InsertElement;function _FCK_ProtectEvents_ReplaceTags(A){return A.replace(FCKRegexLib.EventAttributes,_FCK_ProtectEvents_ReplaceEvents);};function _FCK_ProtectEvents_ReplaceEvents(A,B){return ' '+B+'_fckprotectedatt="'+encodeURIComponent(A)+'"';};function _FCK_ProtectEvents_RestoreEvents(A,B){return decodeURIComponent(B);};function _FCK_MouseEventsListener(A){if (!A) A=window.event;if (A.type=='mousedown') FCK.MouseDownFlag=true;else if (A.type=='mouseup') FCK.MouseDownFlag=false;else if (A.type=='mousemove') FCK.Events.FireEvent('OnMouseMove',A);};function _FCK_PaddingNodeListener(){if (FCKConfig.EnterMode.IEquals('br')) return;FCKDomTools.EnforcePaddingNode(FCK.EditorDocument,FCKConfig.EnterMode);if (!FCKBrowserInfo.IsIE&&FCKDomTools.PaddingNode){var A=FCK.EditorWindow.getSelection();if (A&&A.rangeCount==1){var B=A.getRangeAt(0);if (B.collapsed&&B.startContainer==FCK.EditorDocument.body&&B.startOffset==0){B.selectNodeContents(FCKDomTools.PaddingNode);B.collapse(true);A.removeAllRanges();A.addRange(B);}}}else if (FCKDomTools.PaddingNode){var C=FCKSelection.GetParentElement();var D=FCKDomTools.PaddingNode;if (C&&C.nodeName.IEquals('body')){if (FCK.EditorDocument.body.childNodes.length==1&&FCK.EditorDocument.body.firstChild==D){var B=FCK.EditorDocument.body.createTextRange();var F=false;if (!D.childNodes.firstChild){D.appendChild(D.ownerDocument.createTextNode('\ufeff'));F=true;};B.moveToElementText(D);B.select();if (F) B.pasteHTML('');}}}};function _FCK_EditingArea_OnLoad(){FCK.EditorWindow=FCK.EditingArea.Window;FCK.EditorDocument=FCK.EditingArea.Document;FCK.InitializeBehaviors();FCK.MouseDownFlag=false;FCKTools.AddEventListener(FCK.EditorDocument,'mousemove',_FCK_MouseEventsListener);FCKTools.AddEventListener(FCK.EditorDocument,'mousedown',_FCK_MouseEventsListener);FCKTools.AddEventListener(FCK.EditorDocument,'mouseup',_FCK_MouseEventsListener);if (FCKBrowserInfo.IsSafari){var A=function(evt){if (!(evt.ctrlKey||evt.metaKey)) return;if (FCK.EditMode!=0) return;switch (evt.keyCode){case 89:FCKUndo.Redo();break;case 90:FCKUndo.Undo();break;}};FCKTools.AddEventListener(FCK.EditorDocument,'keyup',A);};FCK.EnterKeyHandler=new FCKEnterKey(FCK.EditorWindow,FCKConfig.EnterMode,FCKConfig.ShiftEnterMode,FCKConfig.TabSpaces);FCK.KeystrokeHandler.AttachToElement(FCK.EditorDocument);if (FCK._ForceResetIsDirty) FCK.ResetIsDirty();if (FCKBrowserInfo.IsIE&&FCK.HasFocus) FCK.EditorDocument.body.setActive();FCK.OnAfterSetHTML();FCKCommands.GetCommand('ShowBlocks').RestoreState();if (FCK.Status!=0) return;if (FCKConfig.Debug) FCKDebug._GetWindow();FCK.SetStatus(1);};function _FCK_GetEditorAreaStyleTags(){var A='';var B=FCKConfig.EditorAreaCSS;var C=FCKConfig.EditorAreaStyles;for (var i=0;i';if (C&&C.length>0) A+="";return A;};function _FCK_KeystrokeHandler_OnKeystroke(A,B){if (FCK.Status!=2) return false;if (FCK.EditMode==0){switch (B){case 'Paste':return!FCK.Paste();case 'Cut':FCKUndo.SaveUndoStep();return false;}}else{if (B.Equals('Paste','Undo','Redo','SelectAll','Cut')) return false;};var C=FCK.Commands.GetCommand(B);return (C.Execute.apply(C,FCKTools.ArgumentsToArray(arguments,2))!==false);};(function(){var A=window.parent.document;var B=A.getElementById(FCK.Name);var i=0;while (B||i==0){if (B&&B.tagName.toLowerCase().Equals('input','textarea')){FCK.LinkedField=B;break;};B=A.getElementsByName(FCK.Name)[i++];}})();var FCKTempBin={Elements:[],AddElement:function(A){var B=this.Elements.length;this.Elements[B]=A;return B;},RemoveElement:function(A){var e=this.Elements[A];this.Elements[A]=null;return e;},Reset:function(){var i=0;while (i0) C+='TABLE { behavior: '+B+' ; }';C+='';FCK._BehaviorsStyle=C;};return FCK._BehaviorsStyle;};function Doc_OnMouseUp(){if (FCK.EditorWindow.event.srcElement.tagName=='HTML'){FCK.Focus();FCK.EditorWindow.event.cancelBubble=true;FCK.EditorWindow.event.returnValue=false;}};function Doc_OnPaste(){var A=FCK.EditorDocument.body;A.detachEvent('onpaste',Doc_OnPaste);var B=FCK.Paste(!FCKConfig.ForcePasteAsPlainText&&!FCKConfig.AutoDetectPasteFromWord);A.attachEvent('onpaste',Doc_OnPaste);return B;};function Doc_OnDblClick(){FCK.OnDoubleClick(FCK.EditorWindow.event.srcElement);FCK.EditorWindow.event.cancelBubble=true;};function Doc_OnSelectionChange(){if (FCK.EditorDocument) FCK.Events.FireEvent("OnSelectionChange");};function Doc_OnDrop(){if (FCK.MouseDownFlag){FCK.MouseDownFlag=false;return;};var A=FCK.EditorWindow.event;if (FCKConfig.ForcePasteAsPlainText){if (FCK._CheckIsPastingEnabled()||FCKConfig.ShowDropDialog) FCK.PasteAsPlainText(A.dataTransfer.getData('Text'));}else{if (FCKConfig.ShowDropDialog) FCKTools.RunFunction(FCKDialog.OpenDialog,FCKDialog,['FCKDialog_Paste',FCKLang.Paste,'dialog/fck_paste.html',400,330,'Security']);};A.returnValue=false;A.cancelBubble=true;};FCK.InitializeBehaviors=function(A){this.EditorDocument.attachEvent('onmouseup',Doc_OnMouseUp);this.EditorDocument.body.attachEvent('onpaste',Doc_OnPaste);this.EditorDocument.body.attachEvent('ondrop',Doc_OnDrop);FCK.ContextMenu._InnerContextMenu.AttachToElement(FCK.EditorDocument.body);this.EditorDocument.attachEvent("onkeydown",FCK._KeyDownListener);this.EditorDocument.attachEvent("ondblclick",Doc_OnDblClick);this.EditorDocument.attachEvent("onselectionchange",Doc_OnSelectionChange);};FCK.InsertHtml=function(A){A=FCKConfig.ProtectedSource.Protect(A);A=FCK.ProtectEvents(A);A=FCK.ProtectUrls(A);A=FCK.ProtectTags(A);FCK.EditorWindow.focus();FCKUndo.SaveUndoStep();var B=FCK.EditorDocument.selection;if (B.type.toLowerCase()=='control') B.clear();A=' '+A;B.createRange().pasteHTML(A);FCK.EditorDocument.getElementById('__fakeFCKRemove__').removeNode(true);FCKDocumentProcessor.Process(FCK.EditorDocument);this.Events.FireEvent("OnSelectionChange");};FCK.SetInnerHtml=function(A){var B=FCK.EditorDocument;B.body.innerHTML='
     
    '+A;B.getElementById('__fakeFCKRemove__').removeNode(true);};function FCK_PreloadImages(){var A=new FCKImagePreloader();A.AddImages(FCKConfig.PreloadImages);A.AddImages(FCKConfig.SkinPath+'fck_strip.gif');A.OnComplete=LoadToolbarSetup;A.Start();};function Document_OnContextMenu(){return (event.srcElement._FCKShowContextMenu==true);};document.oncontextmenu=Document_OnContextMenu;function FCK_Cleanup(){this.LinkedField=null;this.EditorWindow=null;this.EditorDocument=null;};FCK._ExecPaste=function(){if (FCK._PasteIsRunning) return true;if (FCKConfig.ForcePasteAsPlainText){FCK.PasteAsPlainText();return false;};var A=FCK._CheckIsPastingEnabled(true);if (A===false) FCKTools.RunFunction(FCKDialog.OpenDialog,FCKDialog,['FCKDialog_Paste',FCKLang.Paste,'dialog/fck_paste.html',400,330,'Security']);else{if (FCKConfig.AutoDetectPasteFromWord&&A.length>0){var B=/<\w[^>]*(( class="?MsoNormal"?)|(="mso-))/gi;if (B.test(A)){if (confirm(FCKLang.PasteWordConfirm)){FCK.PasteFromWord();return false;}}};FCK._PasteIsRunning=true;FCK.ExecuteNamedCommand('Paste');delete FCK._PasteIsRunning;};return false;};FCK.PasteAsPlainText=function(A){if (!FCK._CheckIsPastingEnabled()){FCKDialog.OpenDialog('FCKDialog_Paste',FCKLang.PasteAsText,'dialog/fck_paste.html',400,330,'PlainText');return;};var B=null;if (!A) B=clipboardData.getData("Text");else B=A;if (B&&B.length>0){B=FCKTools.HTMLEncode(B);B=FCKTools.ProcessLineBreaks(window,FCKConfig,B);var C=B.search('

    ');var D=B.search('

    ');if ((C!=-1&&D!=-1&&C0){if (FCKSelection.GetType()=='Control'){var D=this.EditorDocument.createElement('A');D.href=A;var E=FCKSelection.GetSelectedElement();E.parentNode.insertBefore(D,E);E.parentNode.removeChild(E);D.appendChild(E);return [D];};var F='javascript:void(0);/*'+(new Date().getTime())+'*/';FCK.ExecuteNamedCommand('CreateLink',F,false,!!B);var G=this.EditorDocument.links;for (i=0;i0&&!isNaN(E)) this.PageConfig[D]=parseInt(E,10);else this.PageConfig[D]=E;}};function FCKConfig_LoadPageConfig(){var A=FCKConfig.PageConfig;for (var B in A) FCKConfig[B]=A[B];};function FCKConfig_PreProcess(){var A=FCKConfig;if (A.AllowQueryStringDebug){try{if ((/fckdebug=true/i).test(window.top.location.search)) A.Debug=true;}catch (e) {/*Ignore it. Much probably we are inside a FRAME where the "top" is in another domain (security error).*/}};if (!A.PluginsPath.EndsWith('/')) A.PluginsPath+='/';if (typeof(A.EditorAreaCSS)=='string') A.EditorAreaCSS=A.EditorAreaCSS.split(',');var B=A.ToolbarComboPreviewCSS;if (!B||B.length==0) A.ToolbarComboPreviewCSS=A.EditorAreaCSS;else if (typeof(B)=='string') A.ToolbarComboPreviewCSS=[B];};FCKConfig.ToolbarSets={};FCKConfig.Plugins={};FCKConfig.Plugins.Items=[];FCKConfig.Plugins.Add=function(A,B,C){FCKConfig.Plugins.Items.AddItem([A,B,C]);};FCKConfig.ProtectedSource={};FCKConfig.ProtectedSource._CodeTag=(new Date()).valueOf();FCKConfig.ProtectedSource.RegexEntries=[//g,//gi,//gi,//gi];FCKConfig.ProtectedSource.Add=function(A){this.RegexEntries.AddItem(A);};FCKConfig.ProtectedSource.Protect=function(A){var B=this._CodeTag;function _Replace(protectedSource){var C=FCKTempBin.AddElement(protectedSource);return '';};for (var i=0;i|>)","g");return A.replace(D,_Replace);};FCKConfig.GetBodyAttributes=function(){var A='';if (this.BodyId&&this.BodyId.length>0) A+=' id="'+this.BodyId+'"';if (this.BodyClass&&this.BodyClass.length>0) A+=' class="'+this.BodyClass+'"';return A;};FCKConfig.ApplyBodyAttributes=function(A){if (this.BodyId&&this.BodyId.length>0) A.id=FCKConfig.BodyId;if (this.BodyClass&&this.BodyClass.length>0) A.className+=' '+FCKConfig.BodyClass;}; +var FCKDebug={};FCKDebug._GetWindow=function(){if (!this.DebugWindow||this.DebugWindow.closed) this.DebugWindow=window.open(FCKConfig.BasePath+'fckdebug.html','FCKeditorDebug','menubar=no,scrollbars=yes,resizable=yes,location=no,toolbar=no,width=600,height=500',true);return this.DebugWindow;};FCKDebug.Output=function(A,B,C){if (!FCKConfig.Debug) return;try{this._GetWindow().Output(A,B);}catch (e) {}};FCKDebug.OutputObject=function(A,B){if (!FCKConfig.Debug) return;try{this._GetWindow().OutputObject(A,B);}catch (e) {}} +var FCKDomTools={MoveChildren:function(A,B,C){if (A==B) return;var D;if (C){while ((D=A.lastChild)) B.insertBefore(A.removeChild(D),B.firstChild);}else{while ((D=A.firstChild)) B.appendChild(A.removeChild(D));}},MoveNode:function(A,B,C){if (C) B.insertBefore(FCKDomTools.RemoveNode(A),B.firstChild);else B.appendChild(FCKDomTools.RemoveNode(A));},TrimNode:function(A){this.LTrimNode(A);this.RTrimNode(A);},LTrimNode:function(A){var B;while ((B=A.firstChild)){if (B.nodeType==3){var C=B.nodeValue.LTrim();var D=B.nodeValue.length;if (C.length==0){A.removeChild(B);continue;}else if (C.length0) break;if (A.lastChild) A=A.lastChild;else return this.GetPreviousSourceElement(A,B,C,D);};return null;},GetNextSourceElement:function(A,B,C,D,E){while((A=this.GetNextSourceNode(A,E))){if (A.nodeType==1){if (C&&A.nodeName.IEquals(C)) break;if (D&&A.nodeName.IEquals(D)) return this.GetNextSourceElement(A,B,C,D);return A;}else if (B&&A.nodeType==3&&A.nodeValue.RTrim().length>0) break;};return null;},GetNextSourceNode:function(A,B,C,D){if (!A) return null;var E;if (!B&&A.firstChild) E=A.firstChild;else{if (D&&A==D) return null;E=A.nextSibling;if (!E&&(!D||D!=A.parentNode)) return this.GetNextSourceNode(A.parentNode,true,C,D);};if (C&&E&&E.nodeType!=C) return this.GetNextSourceNode(E,false,C,D);return E;},GetPreviousSourceNode:function(A,B,C,D){if (!A) return null;var E;if (!B&&A.lastChild) E=A.lastChild;else{if (D&&A==D) return null;E=A.previousSibling;if (!E&&(!D||D!=A.parentNode)) return this.GetPreviousSourceNode(A.parentNode,true,C,D);};if (C&&E&&E.nodeType!=C) return this.GetPreviousSourceNode(E,false,C,D);return E;},InsertAfterNode:function(A,B){return A.parentNode.insertBefore(B,A.nextSibling);},GetParents:function(A){var B=[];while (A){B.unshift(A);A=A.parentNode;};return B;},GetCommonParents:function(A,B){var C=this.GetParents(A);var D=this.GetParents(B);var E=[];for (var i=0;i0) D[C.pop().toLowerCase()]=1;var E=this.GetCommonParents(A,B);var F=null;while ((F=E.pop())){if (D[F.nodeName.toLowerCase()]) return F;};return null;},GetIndexOf:function(A){var B=A.parentNode?A.parentNode.firstChild:null;var C=-1;while (B){C++;if (B==A) return C;B=B.nextSibling;};return-1;},PaddingNode:null,EnforcePaddingNode:function(A,B){try{if (!A||!A.body) return;}catch (e){return;};this.CheckAndRemovePaddingNode(A,B,true);try{if (A.body.lastChild&&(A.body.lastChild.nodeType!=1||A.body.lastChild.tagName.toLowerCase()==B.toLowerCase())) return;}catch (e){return;};var C=A.createElement(B);if (FCKBrowserInfo.IsGecko&&FCKListsLib.NonEmptyBlockElements[B]) FCKTools.AppendBogusBr(C);this.PaddingNode=C;if (A.body.childNodes.length==1&&A.body.firstChild.nodeType==1&&A.body.firstChild.tagName.toLowerCase()=='br'&&(A.body.firstChild.getAttribute('_moz_dirty')!=null||A.body.firstChild.getAttribute('type')=='_moz')) A.body.replaceChild(C,A.body.firstChild);else A.body.appendChild(C);},CheckAndRemovePaddingNode:function(A,B,C){var D=this.PaddingNode;if (!D) return;try{if (D.parentNode!=A.body||D.tagName.toLowerCase()!=B||(D.childNodes.length>1)||(D.firstChild&&D.firstChild.nodeValue!='\xa0'&&String(D.firstChild.tagName).toLowerCase()!='br')){this.PaddingNode=null;return;}}catch (e){this.PaddingNode=null;return;};if (!C){if (D.parentNode.childNodes.length>1) D.parentNode.removeChild(D);this.PaddingNode=null;}},HasAttribute:function(A,B){if (A.hasAttribute) return A.hasAttribute(B);else{var C=A.attributes[B];return (C!=undefined&&C.specified);}},HasAttributes:function(A){var B=A.attributes;for (var i=0;i0) return true;}else if (B[i].specified) return true;};return false;},RemoveAttribute:function(A,B){if (FCKBrowserInfo.IsIE&&B.toLowerCase()=='class') B='className';return A.removeAttribute(B,0);},GetAttributeValue:function(A,B){var C=B;if (typeof B=='string') B=A.attributes[B];else C=B.nodeName;if (B&&B.specified){if (C=='style') return A.style.cssText;else if (C=='class'||C.indexOf('on')==0) return B.nodeValue;else{return A.getAttribute(C,2);}};return null;},Contains:function(A,B){if (A.contains&&B.nodeType==1) return A.contains(B);while ((B=B.parentNode)){if (B==A) return true;};return false;},BreakParent:function(A,B,C){var D=C||new FCKDomRange(FCKTools.GetElementWindow(A));D.SetStart(A,4);D.SetEnd(B,4);var E=D.ExtractContents();D.InsertNode(A.parentNode.removeChild(A));E.InsertAfterNode(A);D.Release(!!C);},GetNodeAddress:function(A,B){var C=[];while (A&&A!=A.ownerDocument.documentElement){var D=A.parentNode;var E=-1;for(var i=0;i0) return false;C=C.nextSibling;};return D?this.CheckIsEmptyElement(D,B):true;},SetElementStyles:function(A,B){var C=A.style;for (var D in B) C[D]=B[D];},GetCurrentElementStyle:function(w,A,B){if (FCKBrowserInfo.IsIE) return A.currentStyle[B];else return w.getComputedStyle(A,'')[B];},GetPositionedAncestor:function(w,A){var B=A;while (B!=B.ownerDocument.documentElement){if (this.GetCurrentElementStyle(w,B,'position')!='static') return B;B=B.parentNode;};return null;},ScrollIntoView:function(A,B){var C=FCKTools.GetElementWindow(A);var D=FCKTools.GetViewPaneSize(C).Height;var E=D*-1;if (B===false){E+=A.offsetHeight;E+=parseInt(this.GetCurrentElementStyle(C,A,'marginBottom')||0,10);};E+=A.offsetTop;while ((A=A.offsetParent)) E+=A.offsetTop||0;var F=FCKTools.GetScrollPosition(C).Y;if (E>0&&E>F) C.scrollTo(0,E);}}; +var FCKTools={};FCKTools.CreateBogusBR=function(A){var B=A.createElement('br');B.setAttribute('type','_moz');return B;};FCKTools.AppendStyleSheet=function(A,B){if (typeof(B)=='string') return this._AppendStyleSheet(A,B);else{var C=[];for (var i=0;i/g,'>');return A;};FCKTools.HTMLDecode=function(A){if (!A) return '';A=A.replace(/>/g,'>');A=A.replace(/</g,'<');A=A.replace(/&/g,'&');return A;};FCKTools._ProcessLineBreaksForPMode=function(A,B,C,D,E){var F=0;var G="

    ";var H="

    ";var I="
    ";if (C){G="
  • ";H="
  • ";F=1;};while (D&&D!=A.FCK.EditorDocument.body){if (D.tagName.toLowerCase()=='p'){F=1;break;};D=D.parentNode;};for (var i=0;i0) return A[A.length-1];return null;};FCKTools.GetDocumentPosition=function(w,A){var x=0;var y=0;var B=A;var C=null;var D=FCKTools.GetElementWindow(B);while (B&&!(D==w&&(B==w.document.body||B==w.document.documentElement))){x+=B.offsetLeft-B.scrollLeft;y+=B.offsetTop-B.scrollTop;if (!FCKBrowserInfo.IsOpera){var E=C;while (E&&E!=B){x-=E.scrollLeft;y-=E.scrollTop;E=E.parentNode;}};C=B;if (B.offsetParent) B=B.offsetParent;else{if (D!=w){B=D.frameElement;C=null;if (B) D=FCKTools.GetElementWindow(B);}else B=null;}};if (FCKDomTools.GetCurrentElementStyle(w,w.document.body,'position')!='static'||(FCKBrowserInfo.IsIE&&FCKDomTools.GetPositionedAncestor(w,A)==null)){x+=w.document.body.offsetLeft;y+=w.document.body.offsetTop;};return { "x":x,"y":y };};FCKTools.GetWindowPosition=function(w,A){var B=this.GetDocumentPosition(w,A);var C=FCKTools.GetScrollPosition(w);B.x-=C.X;B.y-=C.Y;return B;};FCKTools.ProtectFormStyles=function(A){if (!A||A.nodeType!=1||A.tagName.toLowerCase()!='form') return [];var B=[];var C=['style','className'];for (var i=0;i0){for (var i=B.length-1;i>=0;i--){var C=B[i][0];var D=B[i][1];if (D) A.insertBefore(C,D);else A.appendChild(C);}}};FCKTools.GetNextNode=function(A,B){if (A.firstChild) return A.firstChild;else if (A.nextSibling) return A.nextSibling;else{var C=A.parentNode;while (C){if (C==B) return null;if (C.nextSibling) return C.nextSibling;else C=C.parentNode;}};return null;};FCKTools.GetNextTextNode=function(A,B,C){node=this.GetNextNode(A,B);if (C&&node&&C(node)) return null;while (node&&node.nodeType!=3){node=this.GetNextNode(node,B);if (C&&node&&C(node)) return null;};return node;};FCKTools.Merge=function(){var A=arguments;var o=A[0];for (var i=1;i0) B[B.length]=C;};return B;};FCKTools.RemoveOuterTags=function(e){e.insertAdjacentHTML('beforeBegin',e.innerHTML);e.parentNode.removeChild(e);};FCKTools.CreateXmlObject=function(A){var B;switch (A){case 'XmlHttp':B=['MSXML2.XmlHttp','Microsoft.XmlHttp'];break;case 'DOMDocument':B=['MSXML2.DOMDocument','Microsoft.XmlDom'];break;};for (var i=0;i<2;i++){try { return new ActiveXObject(B[i]);}catch (e){}};if (FCKLang.NoActiveX){alert(FCKLang.NoActiveX);FCKLang.NoActiveX=null;};return null;};FCKTools.DisableSelection=function(A){A.unselectable='on';var e,i=0;while ((e=A.all[i++])){switch (e.tagName){case 'IFRAME':case 'TEXTAREA':case 'INPUT':case 'SELECT':break;default:e.unselectable='on';}}};FCKTools.GetScrollPosition=function(A){var B=A.document;var C={ X:B.documentElement.scrollLeft,Y:B.documentElement.scrollTop };if (C.X>0||C.Y>0) return C;return { X:B.body.scrollLeft,Y:B.body.scrollTop };};FCKTools.AddEventListener=function(A,B,C){A.attachEvent('on'+B,C);};FCKTools.RemoveEventListener=function(A,B,C){A.detachEvent('on'+B,C);};FCKTools.AddEventListenerEx=function(A,B,C,D){var o={};o.Source=A;o.Params=D||[];o.Listener=function(ev){return C.apply(o.Source,[ev].concat(o.Params));};if (FCK.IECleanup) FCK.IECleanup.AddItem(null,function() { o.Source=null;o.Params=null;});A.attachEvent('on'+B,o.Listener);A=null;D=null;};FCKTools.GetViewPaneSize=function(A){var B;var C=A.document.documentElement;if (C&&C.clientWidth) B=C;else B=A.document.body;if (B) return { Width:B.clientWidth,Height:B.clientHeight };else return { Width:0,Height:0 };};FCKTools.SaveStyles=function(A){var B=FCKTools.ProtectFormStyles(A);var C={};if (A.className.length>0){C.Class=A.className;A.className='';};var D=A.style.cssText;if (D.length>0){C.Inline=D;A.style.cssText='';};FCKTools.RestoreFormStyles(A,B);return C;};FCKTools.RestoreStyles=function(A,B){var C=FCKTools.ProtectFormStyles(A);A.className=B.Class||'';A.style.cssText=B.Inline||'';FCKTools.RestoreFormStyles(A,C);};FCKTools.RegisterDollarFunction=function(A){A.$=A.document.getElementById;};FCKTools.AppendElement=function(A,B){return A.appendChild(this.GetElementDocument(A).createElement(B));};FCKTools.ToLowerCase=function(A){return A.toLowerCase();}; +var FCKeditorAPI;function InitializeAPI(){var A=window.parent;if (!(FCKeditorAPI=A.FCKeditorAPI)){var B='var FCKeditorAPI = {Version : "2.5.1",VersionBuild : "17566",__Instances : new Object(),GetInstance : function( name ){return this.__Instances[ name ];},_FormSubmit : function(){for ( var name in FCKeditorAPI.__Instances ){var oEditor = FCKeditorAPI.__Instances[ name ] ;if(oEditor.LinkedField.form != null) if ( oEditor.GetParentForm && oEditor.GetParentForm() == this )oEditor.UpdateLinkedField() ;}this._FCKOriginalSubmit() ;},_FunctionQueue : {Functions : new Array(),IsRunning : false,Add : function( f ){this.Functions.push( f );if ( !this.IsRunning )this.StartNext();},StartNext : function(){var aQueue = this.Functions ;if ( aQueue.length > 0 ){this.IsRunning = true;aQueue[0].call();}else this.IsRunning = false;},Remove : function( f ){var aQueue = this.Functions;var i = 0, fFunc;while( (fFunc = aQueue[ i ]) ){if ( fFunc == f )aQueue.splice( i,1 );i++ ;}this.StartNext();}}}';if (A.execScript) A.execScript(B,'JavaScript');else{if (FCKBrowserInfo.IsGecko10){eval.call(A,B);}else if (FCKBrowserInfo.IsSafari||FCKBrowserInfo.IsGecko19){var C=A.document;var D=C.createElement('script');D.appendChild(C.createTextNode(B));C.documentElement.appendChild(D);}else A.eval(B);};FCKeditorAPI=A.FCKeditorAPI;};FCKeditorAPI.__Instances[FCK.Name]=FCK;};function _AttachFormSubmitToAPI(){var A=FCK.GetParentForm();if (A){FCKTools.AddEventListener(A,'submit',FCK.UpdateLinkedField);if (!A._FCKOriginalSubmit&&(typeof(A.submit)=='function'||(!A.submit.tagName&&!A.submit.length))){A._FCKOriginalSubmit=A.submit;A.submit=FCKeditorAPI._FormSubmit;}}};function FCKeditorAPI_Cleanup(){if (!window.FCKUnloadFlag) return;delete FCKeditorAPI.__Instances[FCK.Name];};function FCKeditorAPI_ConfirmCleanup(){window.FCKUnloadFlag=true;};FCKTools.AddEventListener(window,'unload',FCKeditorAPI_Cleanup);FCKTools.AddEventListener(window,'beforeunload',FCKeditorAPI_ConfirmCleanup); +var FCKImagePreloader=function(){this._Images=[];};FCKImagePreloader.prototype={AddImages:function(A){if (typeof(A)=='string') A=A.split(';');this._Images=this._Images.concat(A);},Start:function(){var A=this._Images;this._PreloadCount=A.length;for (var i=0;i]*\>)/i,AfterBody:/(\<\/body\>[\s\S]*$)/i,ToReplace:/___fcktoreplace:([\w]+)/ig,MetaHttpEquiv:/http-equiv\s*=\s*["']?([^"' ]+)/i,HasBaseTag:/]/i,HtmlOpener:/]*>/i,HeadOpener:/]*>/i,HeadCloser:/<\/head\s*>/i,FCK_Class:/\s*FCK__[^ ]*(?=\s+|$)/,ElementName:/(^[a-z_:][\w.\-:]*\w$)|(^[a-z_]$)/,ForceSimpleAmpersand:/___FCKAmp___/g,SpaceNoClose:/\/>/g,EmptyParagraph:/^<(p|div|address|h\d|center)(?=[ >])[^>]*>\s*(<\/\1>)?$/,EmptyOutParagraph:/^<(p|div|address|h\d|center)(?=[ >])[^>]*>(?:\s*| )(<\/\1>)?$/,TagBody:/>]+))/gi,ProtectUrlsA:/]+))/gi,ProtectUrlsArea:/]+))/gi,Html4DocType:/HTML 4\.0 Transitional/i,DocTypeTag:/]*>/i,TagsWithEvent:/<[^\>]+ on\w+[\s\r\n]*=[\s\r\n]*?('|")[\s\S]+?\>/g,EventAttributes:/\s(on\w+)[\s\r\n]*=[\s\r\n]*?('|")([\s\S]*?)\2/g,ProtectedEvents:/\s\w+_fckprotectedatt="([^"]+)"/g,StyleProperties:/\S+\s*:/g,InvalidSelfCloseTags:/(<(?!base|meta|link|hr|br|param|img|area|input)([a-zA-Z0-9:]+)[^>]*)\/>/gi,StyleVariableAttName:/#\(\s*("|')(.+?)\1[^\)]*\s*\)/g,RegExp:/^\/(.*)\/([gim]*)$/}; +var FCKListsLib={BlockElements:{ address:1,blockquote:1,center:1,div:1,dl:1,fieldset:1,form:1,h1:1,h2:1,h3:1,h4:1,h5:1,h6:1,hr:1,marquee:1,noscript:1,ol:1,p:1,pre:1,script:1,table:1,ul:1 },NonEmptyBlockElements:{ p:1,div:1,form:1,h1:1,h2:1,h3:1,h4:1,h5:1,h6:1,address:1,pre:1,ol:1,ul:1,li:1,td:1,th:1 },InlineChildReqElements:{ abbr:1,acronym:1,b:1,bdo:1,big:1,cite:1,code:1,del:1,dfn:1,em:1,font:1,i:1,ins:1,label:1,kbd:1,q:1,samp:1,small:1,span:1,strike:1,strong:1,sub:1,sup:1,tt:1,u:1,'var':1 },InlineNonEmptyElements:{ a:1,abbr:1,acronym:1,b:1,bdo:1,big:1,cite:1,code:1,del:1,dfn:1,em:1,font:1,i:1,ins:1,label:1,kbd:1,q:1,samp:1,small:1,span:1,strike:1,strong:1,sub:1,sup:1,tt:1,u:1,'var':1 },EmptyElements:{ base:1,col:1,meta:1,link:1,hr:1,br:1,param:1,img:1,area:1,input:1 },PathBlockElements:{ address:1,blockquote:1,dl:1,h1:1,h2:1,h3:1,h4:1,h5:1,h6:1,p:1,pre:1,li:1,dt:1,de:1 },PathBlockLimitElements:{ body:1,div:1,td:1,th:1,caption:1,form:1 },StyleBlockElements:{ address:1,div:1,h1:1,h2:1,h3:1,h4:1,h5:1,h6:1,p:1,pre:1 },StyleObjectElements:{ img:1,hr:1,li:1,table:1,tr:1,td:1,embed:1,object:1,ol:1,ul:1 },BlockBoundaries:{ p:1,div:1,h1:1,h2:1,h3:1,h4:1,h5:1,h6:1,hr:1,address:1,pre:1,ol:1,ul:1,li:1,dt:1,de:1,table:1,thead:1,tbody:1,tfoot:1,tr:1,th:1,td:1,caption:1,col:1,colgroup:1,blockquote:1,body:1 },ListBoundaries:{ p:1,div:1,h1:1,h2:1,h3:1,h4:1,h5:1,h6:1,hr:1,address:1,pre:1,ol:1,ul:1,li:1,dt:1,de:1,table:1,thead:1,tbody:1,tfoot:1,tr:1,th:1,td:1,caption:1,col:1,colgroup:1,blockquote:1,body:1,br:1 }}; +var FCKLanguageManager=FCK.Language={AvailableLanguages:{af:'Afrikaans',ar:'Arabic',bg:'Bulgarian',bn:'Bengali/Bangla',bs:'Bosnian',ca:'Catalan',cs:'Czech',da:'Danish',de:'German',el:'Greek',en:'English','en-au':'English (Australia)','en-ca':'English (Canadian)','en-uk':'English (United Kingdom)',eo:'Esperanto',es:'Spanish',et:'Estonian',eu:'Basque',fa:'Persian',fi:'Finnish',fo:'Faroese',fr:'French',gl:'Galician',he:'Hebrew',hi:'Hindi',hr:'Croatian',hu:'Hungarian',it:'Italian',ja:'Japanese',km:'Khmer',ko:'Korean',lt:'Lithuanian',lv:'Latvian',mn:'Mongolian',ms:'Malay',nb:'Norwegian Bokmal',nl:'Dutch',no:'Norwegian',pl:'Polish',pt:'Portuguese (Portugal)','pt-br':'Portuguese (Brazil)',ro:'Romanian',ru:'Russian',sk:'Slovak',sl:'Slovenian',sr:'Serbian (Cyrillic)','sr-latn':'Serbian (Latin)',sv:'Swedish',th:'Thai',tr:'Turkish',uk:'Ukrainian',vi:'Vietnamese',zh:'Chinese Traditional','zh-cn':'Chinese Simplified'},GetActiveLanguage:function(){if (FCKConfig.AutoDetectLanguage){var A;if (navigator.userLanguage) A=navigator.userLanguage.toLowerCase();else if (navigator.language) A=navigator.language.toLowerCase();else{return FCKConfig.DefaultLanguage;};if (A.length>=5){A=A.substr(0,5);if (this.AvailableLanguages[A]) return A;};if (A.length>=2){A=A.substr(0,2);if (this.AvailableLanguages[A]) return A;}};return this.DefaultLanguage;},TranslateElements:function(A,B,C,D){var e=A.getElementsByTagName(B);var E,s;for (var i=0;i0) C+='|'+FCKConfig.AdditionalNumericEntities;FCKXHtmlEntities.EntitiesRegex=new RegExp(C,'g');}; +var FCKXHtml={};FCKXHtml.CurrentJobNum=0;FCKXHtml.GetXHTML=function(A,B,C){FCKDomTools.CheckAndRemovePaddingNode(A.ownerDocument,FCKConfig.EnterMode);FCKXHtmlEntities.Initialize();this._NbspEntity=(FCKConfig.ProcessHTMLEntities?'nbsp':'#160');var D=FCK.IsDirty();FCKXHtml.SpecialBlocks=[];this.XML=FCKTools.CreateXmlObject('DOMDocument');this.MainNode=this.XML.appendChild(this.XML.createElement('xhtml'));FCKXHtml.CurrentJobNum++;if (B) this._AppendNode(this.MainNode,A);else this._AppendChildNodes(this.MainNode,A,false);var E=this._GetMainXmlString();this.XML=null;if (FCKBrowserInfo.IsSafari) E=E.replace(/^/,'');E=E.substr(7,E.length-15).Trim();E=E.replace(FCKRegexLib.SpaceNoClose,' />');if (FCKConfig.ForceSimpleAmpersand) E=E.replace(FCKRegexLib.ForceSimpleAmpersand,'&');if (C) E=FCKCodeFormatter.Format(E);for (var i=0;i0;if (C) A.appendChild(this.XML.createTextNode(B.replace(FCKXHtmlEntities.EntitiesRegex,FCKXHtml_GetEntity)));return C;};function FCKXHtml_GetEntity(A){var B=FCKXHtmlEntities.Entities[A]||('#'+A.charCodeAt(0));return '#?-:'+B+';';};FCKXHtml.TagProcessors={a:function(A,B){if (B.innerHTML.Trim().length==0&&!B.name) return false;var C=B.getAttribute('_fcksavedurl');if (C!=null) FCKXHtml._AppendAttribute(A,'href',C);if (FCKBrowserInfo.IsIE){if (B.name) FCKXHtml._AppendAttribute(A,'name',B.name);};A=FCKXHtml._AppendChildNodes(A,B,false);return A;},area:function(A,B){var C=B.getAttribute('_fcksavedurl');if (C!=null) FCKXHtml._AppendAttribute(A,'href',C);if (FCKBrowserInfo.IsIE){if (!A.attributes.getNamedItem('coords')){var D=B.getAttribute('coords',2);if (D&&D!='0,0,0') FCKXHtml._AppendAttribute(A,'coords',D);};if (!A.attributes.getNamedItem('shape')){var E=B.getAttribute('shape',2);if (E&&E.length>0) FCKXHtml._AppendAttribute(A,'shape',E.toLowerCase());}};return A;},body:function(A,B){A=FCKXHtml._AppendChildNodes(A,B,false);A.removeAttribute('spellcheck');return A;},iframe:function(A,B){var C=B.innerHTML;if (FCKBrowserInfo.IsGecko) C=FCKTools.HTMLDecode(C);C=C.replace(/\s_fcksavedurl="[^"]*"/g,'');A.appendChild(FCKXHtml.XML.createTextNode(FCKXHtml._AppendSpecialItem(C)));return A;},img:function(A,B){if (!A.attributes.getNamedItem('alt')) FCKXHtml._AppendAttribute(A,'alt','');var C=B.getAttribute('_fcksavedurl');if (C!=null) FCKXHtml._AppendAttribute(A,'src',C);return A;},ol:function(A,B,C){if (B.innerHTML.Trim().length==0) return false;var D=C.lastChild;if (D&&D.nodeType==3) D=D.previousSibling;if (D&&D.nodeName.toUpperCase()=='LI'){B._fckxhtmljob=null;FCKXHtml._AppendNode(D,B);return false;};A=FCKXHtml._AppendChildNodes(A,B);return A;},pre:function (A,B){var C=B.firstChild;if (C&&C.nodeType==3) A.appendChild(FCKXHtml.XML.createTextNode(FCKXHtml._AppendSpecialItem('\r\n')));FCKXHtml._AppendChildNodes(A,B,true);return A;},script:function(A,B){if (!A.attributes.getNamedItem('type')) FCKXHtml._AppendAttribute(A,'type','text/javascript');A.appendChild(FCKXHtml.XML.createTextNode(FCKXHtml._AppendSpecialItem(B.text)));return A;},span:function(A,B){if (B.innerHTML.length==0) return false;A=FCKXHtml._AppendChildNodes(A,B,false);return A;},style:function(A,B){if (!A.attributes.getNamedItem('type')) FCKXHtml._AppendAttribute(A,'type','text/css');var C=B.innerHTML;if (FCKBrowserInfo.IsIE) C=C.replace(/^(\r\n|\n|\r)/,'');A.appendChild(FCKXHtml.XML.createTextNode(FCKXHtml._AppendSpecialItem(C)));return A;},title:function(A,B){A.appendChild(FCKXHtml.XML.createTextNode(FCK.EditorDocument.title));return A;}};FCKXHtml.TagProcessors.ul=FCKXHtml.TagProcessors.ol; +FCKXHtml._GetMainXmlString=function(){return this.MainNode.xml;};FCKXHtml._AppendAttributes=function(A,B,C,D){var E=B.attributes;for (var n=0;n0) FCKXHtml._AppendAttribute(A,'align',B.align);A=FCKXHtml._AppendChildNodes(A,B,true);return A;};FCKXHtml.TagProcessors['font']=function(A,B){if (A.attributes.length==0) A=FCKXHtml.XML.createDocumentFragment();A=FCKXHtml._AppendChildNodes(A,B);return A;};FCKXHtml.TagProcessors['form']=function(A,B){if (B.acceptCharset&&B.acceptCharset.length>0&&B.acceptCharset!='UNKNOWN') FCKXHtml._AppendAttribute(A,'accept-charset',B.acceptCharset);var C=B.attributes['name'];if (C&&C.value.length>0) FCKXHtml._AppendAttribute(A,'name',C.value);A=FCKXHtml._AppendChildNodes(A,B,true);return A;};FCKXHtml.TagProcessors['input']=function(A,B){if (B.name) FCKXHtml._AppendAttribute(A,'name',B.name);if (B.value&&!A.attributes.getNamedItem('value')) FCKXHtml._AppendAttribute(A,'value',B.value);if (!A.attributes.getNamedItem('type')) FCKXHtml._AppendAttribute(A,'type','text');return A;};FCKXHtml.TagProcessors['label']=function(A,B){if (B.htmlFor.length>0) FCKXHtml._AppendAttribute(A,'for',B.htmlFor);A=FCKXHtml._AppendChildNodes(A,B);return A;};FCKXHtml.TagProcessors['map']=function(A,B){if (!A.attributes.getNamedItem('name')){var C=B.name;if (C) FCKXHtml._AppendAttribute(A,'name',C);};A=FCKXHtml._AppendChildNodes(A,B,true);return A;};FCKXHtml.TagProcessors['meta']=function(A,B){var C=A.attributes.getNamedItem('http-equiv');if (C==null||C.value.length==0){var D=B.outerHTML.match(FCKRegexLib.MetaHttpEquiv);if (D){D=D[1];FCKXHtml._AppendAttribute(A,'http-equiv',D);}};return A;};FCKXHtml.TagProcessors['option']=function(A,B){if (B.selected&&!A.attributes.getNamedItem('selected')) FCKXHtml._AppendAttribute(A,'selected','selected');A=FCKXHtml._AppendChildNodes(A,B);return A;};FCKXHtml.TagProcessors['textarea']=FCKXHtml.TagProcessors['select']=function(A,B){if (B.name) FCKXHtml._AppendAttribute(A,'name',B.name);A=FCKXHtml._AppendChildNodes(A,B);return A;} +var FCKCodeFormatter={};FCKCodeFormatter.Init=function(){var A=this.Regex={};A.BlocksOpener=/\<(P|DIV|H1|H2|H3|H4|H5|H6|ADDRESS|PRE|OL|UL|LI|TITLE|META|LINK|BASE|SCRIPT|LINK|TD|TH|AREA|OPTION)[^\>]*\>/gi;A.BlocksCloser=/\<\/(P|DIV|H1|H2|H3|H4|H5|H6|ADDRESS|PRE|OL|UL|LI|TITLE|META|LINK|BASE|SCRIPT|LINK|TD|TH|AREA|OPTION)[^\>]*\>/gi;A.NewLineTags=/\<(BR|HR)[^\>]*\>/gi;A.MainTags=/\<\/?(HTML|HEAD|BODY|FORM|TABLE|TBODY|THEAD|TR)[^\>]*\>/gi;A.LineSplitter=/\s*\n+\s*/g;A.IncreaseIndent=/^\<(HTML|HEAD|BODY|FORM|TABLE|TBODY|THEAD|TR|UL|OL)[ \/\>]/i;A.DecreaseIndent=/^\<\/(HTML|HEAD|BODY|FORM|TABLE|TBODY|THEAD|TR|UL|OL)[ \>]/i;A.FormatIndentatorRemove=new RegExp('^'+FCKConfig.FormatIndentator);A.ProtectedTags=/(]*>)([\s\S]*?)(<\/PRE>)/gi;};FCKCodeFormatter._ProtectData=function(A,B,C,D){return B+'___FCKpd___'+FCKCodeFormatter.ProtectedData.AddItem(C)+D;};FCKCodeFormatter.Format=function(A){if (!this.Regex) this.Init();FCKCodeFormatter.ProtectedData=[];var B=A.replace(this.Regex.ProtectedTags,FCKCodeFormatter._ProtectData);B=B.replace(this.Regex.BlocksOpener,'\n$&');B=B.replace(this.Regex.BlocksCloser,'$&\n');B=B.replace(this.Regex.NewLineTags,'$&\n');B=B.replace(this.Regex.MainTags,'\n$&\n');var C='';var D=B.split(this.Regex.LineSplitter);B='';for (var i=0;iB[i]) return 1;};if (A.lengthB.length) return 1;return 0;};FCKUndo._CheckIsBookmarksEqual=function(A,B){if (!(A&&B)) return false;if (FCKBrowserInfo.IsIE){var C=A[1].search(A[0].StartId);var D=B[1].search(B[0].StartId);var E=A[1].search(A[0].EndId);var F=B[1].search(B[0].EndId);return C==D&&E==F;}else{return this._CompareCursors(A.Start,B.Start)==0&&this._CompareCursors(A.End,B.End)==0;}};FCKUndo.SaveUndoStep=function(){if (FCK.EditMode!=0||this.SaveLocked) return;if (this.SavedData.length) this.Changed=true;var A=FCK.EditorDocument.body.innerHTML;var B=this._GetBookmark();this.SavedData=this.SavedData.slice(0,this.CurrentIndex+1);if (this.CurrentIndex>0&&A==this.SavedData[this.CurrentIndex][0]&&this._CheckIsBookmarksEqual(B,this.SavedData[this.CurrentIndex][1])) return;else if (this.CurrentIndex==0&&this.SavedData.length&&A==this.SavedData[0][0]){this.SavedData[0][1]=B;return;};if (this.CurrentIndex+1>=FCKConfig.MaxUndoLevels) this.SavedData.shift();else this.CurrentIndex++;this.SavedData[this.CurrentIndex]=[A,B];FCK.Events.FireEvent("OnSelectionChange");};FCKUndo.CheckUndoState=function(){return (this.Changed||this.CurrentIndex>0);};FCKUndo.CheckRedoState=function(){return (this.CurrentIndex<(this.SavedData.length-1));};FCKUndo.Undo=function(){if (this.CheckUndoState()){if (this.CurrentIndex==(this.SavedData.length-1)){this.SaveUndoStep();};this._ApplyUndoLevel(--this.CurrentIndex);FCK.Events.FireEvent("OnSelectionChange");}};FCKUndo.Redo=function(){if (this.CheckRedoState()){this._ApplyUndoLevel(++this.CurrentIndex);FCK.Events.FireEvent("OnSelectionChange");}};FCKUndo._ApplyUndoLevel=function(A){var B=this.SavedData[A];if (!B) return;if (FCKBrowserInfo.IsIE){if (B[1]&&B[1][1]) FCK.SetInnerHtml(B[1][1]);else FCK.SetInnerHtml(B[0]);}else FCK.EditorDocument.body.innerHTML=B[0];this._SelectBookmark(B[1]);this.TypesCount=0;this.Changed=false;this.Typing=false;}; +var FCKEditingArea=function(A){this.TargetElement=A;this.Mode=0;if (FCK.IECleanup) FCK.IECleanup.AddItem(this,FCKEditingArea_Cleanup);};FCKEditingArea.prototype.Start=function(A,B){var C=this.TargetElement;var D=FCKTools.GetElementDocument(C);var E;while((E=C.firstChild)){if (E.contentWindow) E.contentWindow.document.body.innerHTML='';C.removeChild(E);};if (this.Mode==0){var F=this.IFrame=D.createElement('iframe');if (!FCKBrowserInfo.IsGecko) F.src='javascript:void(0)';F.frameBorder=0;F.width=F.height='100%';C.appendChild(F);if (FCKBrowserInfo.IsIE) A=A.replace(/(]*?)\s*\/?>(?!\s*<\/base>)/gi,'$1>');else if (!B){var G=A.match(FCKRegexLib.BeforeBody);var H=A.match(FCKRegexLib.AfterBody);if (G&&H){var I=A.substr(G[1].length,A.length-G[1].length-H[1].length);A=G[1]+' '+H[1];if (FCKBrowserInfo.IsGecko&&(I.length==0||FCKRegexLib.EmptyParagraph.test(I))) I='
    ';this._BodyHTML=I;}else this._BodyHTML=A;};this.Window=F.contentWindow;var J=this.Document=this.Window.document;J.open();J.write(A);J.close();if (FCKBrowserInfo.IsGecko10&&!B){this.Start(A,true);return;};this.Window._FCKEditingArea=this;if (FCKBrowserInfo.IsGecko10) this.Window.setTimeout(FCKEditingArea_CompleteStart,500);else FCKEditingArea_CompleteStart.call(this.Window);}else{var K=this.Textarea=D.createElement('textarea');K.className='SourceField';K.dir='ltr';FCKDomTools.SetElementStyles(K,{width:'100%',height:'100%',border:'none',resize:'none',outline:'none'});C.appendChild(K);K.value=A;FCKTools.RunFunction(this.OnLoad);}};function FCKEditingArea_CompleteStart(){if (!this.document.body){this.setTimeout(FCKEditingArea_CompleteStart,50);return;};var A=this._FCKEditingArea;A.MakeEditable();FCKTools.RunFunction(A.OnLoad);};FCKEditingArea.prototype.MakeEditable=function(){var A=this.Document;if (FCKBrowserInfo.IsIE){A.body.disabled=true;A.body.contentEditable=true;A.body.removeAttribute("disabled");}else{try{A.body.spellcheck=(this.FFSpellChecker!==false);if (this._BodyHTML){A.body.innerHTML=this._BodyHTML;this._BodyHTML=null;};A.designMode='on';A.execCommand('enableObjectResizing',false,!FCKConfig.DisableObjectResizing);A.execCommand('enableInlineTableEditing',false,!FCKConfig.DisableFFTableHandles);}catch (e){FCKTools.AddEventListener(this.Window.frameElement,'DOMAttrModified',FCKEditingArea_Document_AttributeNodeModified);}}};function FCKEditingArea_Document_AttributeNodeModified(A){var B=A.currentTarget.contentWindow._FCKEditingArea;if (B._timer) window.clearTimeout(B._timer);B._timer=FCKTools.SetTimeout(FCKEditingArea_MakeEditableByMutation,1000,B);};function FCKEditingArea_MakeEditableByMutation(){delete this._timer;FCKTools.RemoveEventListener(this.Window.frameElement,'DOMAttrModified',FCKEditingArea_Document_AttributeNodeModified);this.MakeEditable();};FCKEditingArea.prototype.Focus=function(){try{if (this.Mode==0){if (FCKBrowserInfo.IsIE&&this.Document.hasFocus()) this._EnsureFocusIE();this.Window.focus();if (FCKBrowserInfo.IsIE) this._EnsureFocusIE();}else{var A=FCKTools.GetElementDocument(this.Textarea);if ((!A.hasFocus||A.hasFocus())&&A.activeElement==this.Textarea) return;this.Textarea.focus();}}catch(e) {}};FCKEditingArea.prototype._EnsureFocusIE=function(){this.Document.body.setActive();var A=this.Document.selection.createRange();var B=A.parentElement();var C=B.nodeName.toLowerCase();if (B.childNodes.length>0||!(FCKListsLib.BlockElements[C]||FCKListsLib.NonEmptyBlockElements[C])){return;};A.moveEnd("character",1);A.select();if (A.boundingWidth>0){A.moveEnd("character",-1);A.select();}};function FCKEditingArea_Cleanup(){if (this.Document) this.Document.body.innerHTML="";this.TargetElement=null;this.IFrame=null;this.Document=null;this.Textarea=null;if (this.Window){this.Window._FCKEditingArea=null;this.Window=null;}}; +var FCKKeystrokeHandler=function(A){this.Keystrokes={};this.CancelCtrlDefaults=(A!==false);};FCKKeystrokeHandler.prototype.AttachToElement=function(A){FCKTools.AddEventListenerEx(A,'keydown',_FCKKeystrokeHandler_OnKeyDown,this);if (FCKBrowserInfo.IsGecko10||FCKBrowserInfo.IsOpera||(FCKBrowserInfo.IsGecko&&FCKBrowserInfo.IsMac)) FCKTools.AddEventListenerEx(A,'keypress',_FCKKeystrokeHandler_OnKeyPress,this);};FCKKeystrokeHandler.prototype.SetKeystrokes=function(){for (var i=0;i40))){B._CancelIt=true;if (A.preventDefault) return A.preventDefault();A.returnValue=false;A.cancelBubble=true;return false;};return true;};function _FCKKeystrokeHandler_OnKeyPress(A,B){if (B._CancelIt){if (A.preventDefault) return A.preventDefault();return false;};return true;}; +FCK.DTD=(function(){X=FCKTools.Merge;var A,L,J,M,N,O,D,H,P,K,Q,F,G,C,B,E,I;A={isindex:1,fieldset:1};B={input:1,button:1,select:1,textarea:1,label:1};C=X({a:1},B);D=X({iframe:1},C);E={hr:1,ul:1,menu:1,div:1,blockquote:1,noscript:1,table:1,center:1,address:1,dir:1,pre:1,h5:1,dl:1,h4:1,noframes:1,h6:1,ol:1,h1:1,h3:1,h2:1};F={ins:1,del:1,script:1};G=X({b:1,acronym:1,bdo:1,'var':1,'#':1,abbr:1,code:1,br:1,i:1,cite:1,kbd:1,u:1,strike:1,s:1,tt:1,strong:1,q:1,samp:1,em:1,dfn:1,span:1},F);H=X({sub:1,img:1,object:1,sup:1,basefont:1,map:1,applet:1,font:1,big:1,small:1},G);I=X({p:1},H);J=X({iframe:1},H,B);K={img:1,noscript:1,br:1,kbd:1,center:1,button:1,basefont:1,h5:1,h4:1,samp:1,h6:1,ol:1,h1:1,h3:1,h2:1,form:1,font:1,'#':1,select:1,menu:1,ins:1,abbr:1,label:1,code:1,table:1,script:1,cite:1,input:1,iframe:1,strong:1,textarea:1,noframes:1,big:1,small:1,span:1,hr:1,sub:1,bdo:1,'var':1,div:1,object:1,sup:1,strike:1,dir:1,map:1,dl:1,applet:1,del:1,isindex:1,fieldset:1,ul:1,b:1,acronym:1,a:1,blockquote:1,i:1,u:1,s:1,tt:1,address:1,q:1,pre:1,p:1,em:1,dfn:1};L=X({a:1},J);M={tr:1};N={'#':1};O=X({param:1},K);P=X({form:1},A,D,E,I);Q={li:1};return {col:{},tr:{td:1,th:1},img:{},colgroup:{col:1},noscript:P,td:P,br:{},th:P,center:P,kbd:L,button:X(I,E),basefont:{},h5:L,h4:L,samp:L,h6:L,ol:Q,h1:L,h3:L,option:N,h2:L,form:X(A,D,E,I),select:{optgroup:1,option:1},font:J,ins:P,menu:Q,abbr:L,label:L,table:{thead:1,col:1,tbody:1,tr:1,colgroup:1,caption:1,tfoot:1},code:L,script:N,tfoot:M,cite:L,li:P,input:{},iframe:P,strong:J,textarea:N,noframes:P,big:J,small:J,span:J,hr:{},dt:L,sub:J,optgroup:{option:1},param:{},bdo:L,'var':J,div:P,object:O,sup:J,dd:P,strike:J,area:{},dir:Q,map:X({area:1,form:1,p:1},A,F,E),applet:O,dl:{dt:1,dd:1},del:P,isindex:{},fieldset:X({legend:1},K),thead:M,ul:Q,acronym:L,b:J,a:J,blockquote:P,caption:L,i:J,u:J,tbody:M,s:L,address:X(D,I),tt:J,legend:L,q:L,pre:X(G,C),p:L,em:J,dfn:L};})(); +var FCKStyle=function(A){this.Element=(A.Element||'span').toLowerCase();this._StyleDesc=A;};FCKStyle.prototype={GetType:function(){var A=this.GetType_$;if (A!=undefined) return A;var B=this.Element;if (B=='#'||FCKListsLib.StyleBlockElements[B]) A=0;else if (FCKListsLib.StyleObjectElements[B]) A=2;else A=1;return (this.GetType_$=A);},ApplyToSelection:function(A){var B=new FCKDomRange(A);B.MoveToSelection();this.ApplyToRange(B,true);},ApplyToRange:function(A,B){switch (this.GetType()){case 0:this.ApplyToRange=this._ApplyBlockStyle;break;case 1:this.ApplyToRange=this._ApplyInlineStyle;break;default:return;};this.ApplyToRange(A,B);},ApplyToObject:function(A){if (!A) return;this.BuildElement(null,A);},RemoveFromSelection:function(A){var B=new FCKDomRange(A);B.MoveToSelection();this.RemoveFromRange(B,true);},RemoveFromRange:function(A,B){var C;var D=this._GetAttribsForComparison();var E=this._GetOverridesForComparison();if (A.CheckIsCollapsed()){var C=A.CreateBookmark(true);var G=A.GetBookmarkNode(C,true);var H=new FCKElementPath(G.parentNode);var I=[];var J=!FCKDomTools.GetNextSibling(G);var K=J||!FCKDomTools.GetPreviousSibling(G);var L;var M=-1;for (var i=0;i=0;i--){var E=D[i];for (var F in B){if (FCKDomTools.HasAttribute(E,F)){switch (F){case 'style':this._RemoveStylesFromElement(E);break;case 'class':if (FCKDomTools.GetAttributeValue(E,F)!=this.GetFinalAttributeValue(F)) continue;default:FCKDomTools.RemoveAttribute(E,F);}}};this._RemoveOverrides(E,C[this.Element]);this._RemoveNoAttribElement(E);};for (var G in C){if (G!=this.Element){D=A.getElementsByTagName(G);for (var i=D.length-1;i>=0;i--){var E=D[i];this._RemoveOverrides(E,C[G]);this._RemoveNoAttribElement(E);}}}},_RemoveStylesFromElement:function(A){var B=A.style.cssText;var C=this.GetFinalStyleValue();if (B.length>0&&C.length==0) return;C='(^|;)\\s*('+C.replace(/\s*([^ ]+):.*?(;|$)/g,'$1|').replace(/\|$/,'')+'):[^;]+';var D=new RegExp(C,'gi');B=B.replace(D,'').Trim();if (B.length==0||B==';') FCKDomTools.RemoveAttribute(A,'style');else A.style.cssText=B.replace(D,'');},_RemoveOverrides:function(A,B){var C=B&&B.Attributes;if (C){for (var i=0;i0) C.style.cssText=this.GetFinalStyleValue();return C;},_CompareAttributeValues:function(A,B,C){if (A=='style'&&B&&C){B=B.replace(/;$/,'').toLowerCase();C=C.replace(/;$/,'').toLowerCase();};return (B==C)},GetFinalAttributeValue:function(A){var B=this._StyleDesc.Attributes;var B=B?B[A]:null;if (!B&&A=='style') return this.GetFinalStyleValue();if (B&&this._Variables) B=B.Replace(FCKRegexLib.StyleVariableAttName,this._GetVariableReplace,this);return B;},GetFinalStyleValue:function(){var A=this._GetStyleText();if (A.length>0&&this._Variables){A=A.Replace(FCKRegexLib.StyleVariableAttName,this._GetVariableReplace,this);A=FCKTools.NormalizeCssText(A);};return A;},_GetVariableReplace:function(){return this._Variables[arguments[2]]||arguments[0];},SetVariable:function(A,B){var C=this._Variables;if (!C) C=this._Variables={};this._Variables[A]=B;},_ApplyBlockStyle:function(A,B){var C;if (B) C=A.CreateBookmark(true);var D=new FCKDomRangeIterator(A);D.EnforceRealBlocks=true;var E;while((E=D.GetNextParagraph())){var F=E.parentNode.insertBefore(this.BuildElement(A.Window.document),E);FCKDomTools.MoveChildren(E,F);FCKDomTools.RemoveNode(E);};if (B) A.SelectBookmark(C);},_ApplyInlineStyle:function(A,B){var C=A.Window.document;if (A.CheckIsCollapsed()){var D=this.BuildElement(C);A.InsertNode(D);A.MoveToPosition(D,2);A.Select();return;};var E=this.Element;var F=FCK.DTD[E]||FCK.DTD.span;var G=this._GetAttribsForComparison();var H;A.Expand('inline_elements');var I=A.CreateBookmark(true);var J=A.GetBookmarkNode(I,true);var K=A.GetBookmarkNode(I,false);A.Release(true);var L=FCKDomTools.GetNextSourceNode(J,true);while (L){var M=false;var N=L.nodeType;var O=N==1?L.nodeName.toLowerCase():null;if (!O||F[O]){if ((FCK.DTD[L.parentNode.nodeName.toLowerCase()]||FCK.DTD.span)[E]||!FCK.DTD[E]){if (!A.CheckHasRange()) A.SetStart(L,3);if (N!=1||L.childNodes.length==0){var P=L;var Q=P.parentNode;while (P==Q.lastChild&&F[Q.nodeName.toLowerCase()]){P=Q;};A.SetEnd(P,4);if (P==P.parentNode.lastChild&&!F[P.parentNode.nodeName.toLowerCase()]) M=true;}else{A.SetEnd(L,3);}}else M=true;}else M=true;L=FCKDomTools.GetNextSourceNode(L);if (L==K){L=null;M=true;};if (M&&A.CheckHasRange()&&!A.CheckIsCollapsed()){H=this.BuildElement(C);A.ExtractContents().AppendTo(H);if (H.innerHTML.RTrim().length>0){A.InsertNode(H);this.RemoveFromElement(H);this._MergeSiblings(H,this._GetAttribsForComparison());if (!FCKBrowserInfo.IsIE) H.normalize();};A.Release(true);}};this._FixBookmarkStart(J);if (B) A.SelectBookmark(I);},_FixBookmarkStart:function(A){var B;while ((B=A.nextSibling)){if (B.nodeType==1&&FCKListsLib.InlineNonEmptyElements[B.nodeName.toLowerCase()]){if (!B.firstChild) FCKDomTools.RemoveNode(B);else FCKDomTools.MoveNode(A,B,true);continue;};if (B.nodeType==3&&B.length==0){FCKDomTools.RemoveNode(B);continue;};break;}},_MergeSiblings:function(A,B){if (!A||A.nodeType!=1||!FCKListsLib.InlineNonEmptyElements[A.nodeName.toLowerCase()]) return;this._MergeNextSibling(A,B);this._MergePreviousSibling(A,B);},_MergeNextSibling:function(A,B){var C=A.nextSibling;var D=(C&&C.nodeType==1&&C.getAttribute('_fck_bookmark'));if (D) C=C.nextSibling;if (C&&C.nodeType==1&&C.nodeName==A.nodeName){if (!B) B=this._CreateElementAttribsForComparison(A);if (this._CheckAttributesMatch(C,B)){var E=A.lastChild;if (D) FCKDomTools.MoveNode(A.nextSibling,A);FCKDomTools.MoveChildren(C,A);FCKDomTools.RemoveNode(C);if (E) this._MergeNextSibling(E);}}},_MergePreviousSibling:function(A,B){var C=A.previousSibling;var D=(C&&C.nodeType==1&&C.getAttribute('_fck_bookmark'));if (D) C=C.previousSibling;if (C&&C.nodeType==1&&C.nodeName==A.nodeName){if (!B) B=this._CreateElementAttribsForComparison(A);if (this._CheckAttributesMatch(C,B)){var E=A.firstChild;if (D) FCKDomTools.MoveNode(A.previousSibling,A,true);FCKDomTools.MoveChildren(C,A,true);FCKDomTools.RemoveNode(C);if (E) this._MergePreviousSibling(E);}}},_GetStyleText:function(){var A=this._StyleDesc.Styles;var B=(this._StyleDesc.Attributes?this._StyleDesc.Attributes['style']||'':'');if (B.length>0) B+=';';for (var C in A) B+=C+':'+A[C]+';';if (B.length>0&&!(/#\(/.test(B))){B=FCKTools.NormalizeCssText(B);};return (this._GetStyleText=function() { return B;})();},_GetAttribsForComparison:function(){var A=this._GetAttribsForComparison_$;if (A) return A;A={};var B=this._StyleDesc.Attributes;if (B){for (var C in B){A[C.toLowerCase()]=B[C].toLowerCase();}};if (this._GetStyleText().length>0){A['style']=this._GetStyleText().toLowerCase();};FCKTools.AppendLengthProperty(A,'_length');return (this._GetAttribsForComparison_$=A);},_GetOverridesForComparison:function(){var A=this._GetOverridesForComparison_$;if (A) return A;A={};var B=this._StyleDesc.Overrides;if (B){if (!FCKTools.IsArray(B)) B=[B];for (var i=0;i0) return true;};B=B.nextSibling;};return false;}}; +var FCKElementPath=function(A){var B=null;var C=null;var D=[];var e=A;while (e){if (e.nodeType==1){if (!this.LastElement) this.LastElement=e;var E=e.nodeName.toLowerCase();if (!C){if (!B&&FCKListsLib.PathBlockElements[E]!=null) B=e;if (FCKListsLib.PathBlockLimitElements[E]!=null){if (!B&&E=='div'&&!FCKElementPath._CheckHasBlock(e)) B=e;else C=e;}};D.push(e);if (E=='body') break;};e=e.parentNode;};this.Block=B;this.BlockLimit=C;this.Elements=D;};FCKElementPath._CheckHasBlock=function(A){var B=A.childNodes;for (var i=0,count=B.length;i0){if (D.nodeType==3){var G=D.nodeValue.substr(0,E).Trim();if (G.length!=0) return A.IsStartOfBlock=false;}else F=D.childNodes[E-1];};if (!F) F=FCKDomTools.GetPreviousSourceNode(D,true,null,C);while (F){switch (F.nodeType){case 1:if (!FCKListsLib.InlineChildReqElements[F.nodeName.toLowerCase()]) return A.IsStartOfBlock=false;break;case 3:if (F.nodeValue.Trim().length>0) return A.IsStartOfBlock=false;};F=FCKDomTools.GetPreviousSourceNode(F,false,null,C);};return A.IsStartOfBlock=true;},CheckEndOfBlock:function(A){var B=this._Cache.IsEndOfBlock;if (B!=undefined) return B;var C=this.EndBlock||this.EndBlockLimit;var D=this._Range.endContainer;var E=this._Range.endOffset;var F;if (D.nodeType==3){var G=D.nodeValue;if (E0) return this._Cache.IsEndOfBlock=false;};F=FCKDomTools.GetNextSourceNode(F,false,null,C);};if (A) this.Select();return this._Cache.IsEndOfBlock=true;},CreateBookmark:function(A){var B={StartId:(new Date()).valueOf()+Math.floor(Math.random()*1000)+'S',EndId:(new Date()).valueOf()+Math.floor(Math.random()*1000)+'E'};var C=this.Window.document;var D;var E;var F;if (!this.CheckIsCollapsed()){E=C.createElement('span');E.style.display='none';E.id=B.EndId;E.setAttribute('_fck_bookmark',true);E.innerHTML=' ';F=this.Clone();F.Collapse(false);F.InsertNode(E);};D=C.createElement('span');D.style.display='none';D.id=B.StartId;D.setAttribute('_fck_bookmark',true);D.innerHTML=' ';F=this.Clone();F.Collapse(true);F.InsertNode(D);if (A){B.StartNode=D;B.EndNode=E;};if (E){this.SetStart(D,4);this.SetEnd(E,3);}else this.MoveToPosition(D,4);return B;},GetBookmarkNode:function(A,B){var C=this.Window.document;if (B) return A.StartNode||C.getElementById(A.StartId);else return A.EndNode||C.getElementById(A.EndId);},MoveToBookmark:function(A,B){var C=this.GetBookmarkNode(A,true);var D=this.GetBookmarkNode(A,false);this.SetStart(C,3);if (!B) FCKDomTools.RemoveNode(C);if (D){this.SetEnd(D,3);if (!B) FCKDomTools.RemoveNode(D);}else this.Collapse(true);this._UpdateElementInfo();},CreateBookmark2:function(){if (!this._Range) return { "Start":0,"End":0 };var A={"Start":[this._Range.startOffset],"End":[this._Range.endOffset]};var B=this._Range.startContainer.previousSibling;var C=this._Range.endContainer.previousSibling;var D=this._Range.startContainer;var E=this._Range.endContainer;while (B&&B.nodeType==3){A.Start[0]+=B.length;D=B;B=B.previousSibling;};while (C&&C.nodeType==3){A.End[0]+=C.length;E=C;C=C.previousSibling;};if (D.nodeType==1&&D.childNodes[A.Start[0]]&&D.childNodes[A.Start[0]].nodeType==3){var F=D.childNodes[A.Start[0]];var G=0;while (F.previousSibling&&F.previousSibling.nodeType==3){F=F.previousSibling;G+=F.length;};D=F;A.Start[0]=G;};if (E.nodeType==1&&E.childNodes[A.End[0]]&&E.childNodes[A.End[0]].nodeType==3){var F=E.childNodes[A.End[0]];var G=0;while (F.previousSibling&&F.previousSibling.nodeType==3){F=F.previousSibling;G+=F.length;};E=F;A.End[0]=G;};A.Start=FCKDomTools.GetNodeAddress(D,true).concat(A.Start);A.End=FCKDomTools.GetNodeAddress(E,true).concat(A.End);return A;},MoveToBookmark2:function(A){var B=FCKDomTools.GetNodeFromAddress(this.Window.document,A.Start.slice(0,-1),true);var C=FCKDomTools.GetNodeFromAddress(this.Window.document,A.End.slice(0,-1),true);this.Release(true);this._Range=new FCKW3CRange(this.Window.document);var D=A.Start[A.Start.length-1];var E=A.End[A.End.length-1];while (B.nodeType==3&&D>B.length){if (!B.nextSibling||B.nextSibling.nodeType!=3) break;D-=B.length;B=B.nextSibling;};while (C.nodeType==3&&E>C.length){if (!C.nextSibling||C.nextSibling.nodeType!=3) break;E-=C.length;C=C.nextSibling;};this._Range.setStart(B,D);this._Range.setEnd(C,E);this._UpdateElementInfo();},MoveToPosition:function(A,B){this.SetStart(A,B);this.Collapse(true);},SetStart:function(A,B,C){var D=this._Range;if (!D) D=this._Range=this.CreateRange();switch(B){case 1:D.setStart(A,0);break;case 2:D.setStart(A,A.childNodes.length);break;case 3:D.setStartBefore(A);break;case 4:D.setStartAfter(A);};if (!C) this._UpdateElementInfo();},SetEnd:function(A,B,C){var D=this._Range;if (!D) D=this._Range=this.CreateRange();switch(B){case 1:D.setEnd(A,0);break;case 2:D.setEnd(A,A.childNodes.length);break;case 3:D.setEndBefore(A);break;case 4:D.setEndAfter(A);};if (!C) this._UpdateElementInfo();},Expand:function(A){var B,oSibling;switch (A){case 'inline_elements':if (this._Range.startOffset==0){B=this._Range.startContainer;if (B.nodeType!=1) B=B.previousSibling?null:B.parentNode;if (B){while (FCKListsLib.InlineNonEmptyElements[B.nodeName.toLowerCase()]){this._Range.setStartBefore(B);if (B!=B.parentNode.firstChild) break;B=B.parentNode;}}};B=this._Range.endContainer;var C=this._Range.endOffset;if ((B.nodeType==3&&C>=B.nodeValue.length)||(B.nodeType==1&&C>=B.childNodes.length)||(B.nodeType!=1&&B.nodeType!=3)){if (B.nodeType!=1) B=B.nextSibling?null:B.parentNode;if (B){while (FCKListsLib.InlineNonEmptyElements[B.nodeName.toLowerCase()]){this._Range.setEndAfter(B);if (B!=B.parentNode.lastChild) break;B=B.parentNode;}}};break;case 'block_contents':case 'list_contents':var D=FCKListsLib.BlockBoundaries;if (A=='list_contents'||FCKConfig.EnterMode=='br') D=FCKListsLib.ListBoundaries;if (this.StartBlock&&FCKConfig.EnterMode!='br'&&A=='block_contents') this.SetStart(this.StartBlock,1);else{B=this._Range.startContainer;if (B.nodeType==1){var E=B.childNodes[this._Range.startOffset];if (E) B=FCKDomTools.GetPreviousSourceNode(E,true);else B=B.lastChild||B;};while (B&&(B.nodeType!=1||(B!=this.StartBlockLimit&&!D[B.nodeName.toLowerCase()]))){this._Range.setStartBefore(B);B=B.previousSibling||B.parentNode;}};if (this.EndBlock&&FCKConfig.EnterMode!='br'&&A=='block_contents'&&this.EndBlock.nodeName.toLowerCase()!='li') this.SetEnd(this.EndBlock,2);else{B=this._Range.endContainer;if (B.nodeType==1) B=B.childNodes[this._Range.endOffset]||B.lastChild;while (B&&(B.nodeType!=1||(B!=this.StartBlockLimit&&!D[B.nodeName.toLowerCase()]))){this._Range.setEndAfter(B);B=B.nextSibling||B.parentNode;};if (B&&B.nodeName.toLowerCase()=='br') this._Range.setEndAfter(B);};this._UpdateElementInfo();}},SplitBlock:function(){if (!this._Range) this.MoveToSelection();if (this.StartBlockLimit==this.EndBlockLimit){var A=this.StartBlock;var B=this.EndBlock;var C=null;if (FCKConfig.EnterMode!='br'){if (!A){A=this.FixBlock(true);B=this.EndBlock;};if (!B) B=this.FixBlock(false);};var D=(A!=null&&this.CheckStartOfBlock());var E=(B!=null&&this.CheckEndOfBlock());if (!this.CheckIsEmpty()) this.DeleteContents();if (A&&B&&A==B){if (E){C=new FCKElementPath(this.StartContainer);this.MoveToPosition(B,4);B=null;}else if (D){C=new FCKElementPath(this.StartContainer);this.MoveToPosition(A,3);A=null;}else{this.SetEnd(A,2);var F=this.ExtractContents();B=A.cloneNode(false);B.removeAttribute('id',false);F.AppendTo(B);FCKDomTools.InsertAfterNode(A,B);this.MoveToPosition(A,4);if (FCKBrowserInfo.IsGecko&&!A.nodeName.IEquals(['ul','ol'])) FCKTools.AppendBogusBr(A);}};return {PreviousBlock:A,NextBlock:B,WasStartOfBlock:D,WasEndOfBlock:E,ElementPath:C};};return null;},FixBlock:function(A){var B=this.CreateBookmark();this.Collapse(A);this.Expand('block_contents');var C=this.Window.document.createElement(FCKConfig.EnterMode);this.ExtractContents().AppendTo(C);FCKDomTools.TrimNode(C);this.InsertNode(C);this.MoveToBookmark(B);return C;},Release:function(A){if (!A) this.Window=null;this.StartNode=null;this.StartContainer=null;this.StartBlock=null;this.StartBlockLimit=null;this.EndNode=null;this.EndContainer=null;this.EndBlock=null;this.EndBlockLimit=null;this._Range=null;this._Cache=null;},CheckHasRange:function(){return!!this._Range;},GetTouchedStartNode:function(){var A=this._Range;var B=A.startContainer;if (A.collapsed||B.nodeType!=1) return B;return B.childNodes[A.startOffset]||B;},GetTouchedEndNode:function(){var A=this._Range;var B=A.endContainer;if (A.collapsed||B.nodeType!=1) return B;return B.childNodes[A.endOffset-1]||B;}}; +FCKDomRange.prototype.MoveToSelection=function(){this.Release(true);this._Range=new FCKW3CRange(this.Window.document);var A=this.Window.document.selection;if (A.type!='Control'){var B=this._GetSelectionMarkerTag(true);var C=this._GetSelectionMarkerTag(false);if (!B&&!C){this._Range.setStart(this.Window.document.body,0);this._UpdateElementInfo();return;};this._Range.setStart(B.parentNode,FCKDomTools.GetIndexOf(B));B.parentNode.removeChild(B);this._Range.setEnd(C.parentNode,FCKDomTools.GetIndexOf(C));C.parentNode.removeChild(C);this._UpdateElementInfo();}else{var D=A.createRange().item(0);if (D){this._Range.setStartBefore(D);this._Range.setEndAfter(D);this._UpdateElementInfo();}}};FCKDomRange.prototype.Select=function(A){if (this._Range) this.SelectBookmark(this.CreateBookmark(true),A);};FCKDomRange.prototype.SelectBookmark=function(A,B){var C=this.CheckIsCollapsed();var D;var E;var F=this.GetBookmarkNode(A,true);if (!F) return;var G;if (!C) G=this.GetBookmarkNode(A,false);var H=this.Window.document.body.createTextRange();H.moveToElementText(F);H.moveStart('character',1);if (G){var I=this.Window.document.body.createTextRange();I.moveToElementText(G);H.setEndPoint('EndToEnd',I);H.moveEnd('character',-1);}else{D=(B||!F.previousSibling||F.previousSibling.nodeName.toLowerCase()=='br')&&!F.nextSibing;E=this.Window.document.createElement('span');E.innerHTML='';F.parentNode.insertBefore(E,F);if (D){F.parentNode.insertBefore(this.Window.document.createTextNode('\ufeff'),F);}};if (!this._Range) this._Range=this.CreateRange();this._Range.setStartBefore(F);F.parentNode.removeChild(F);if (C){if (D){H.moveStart('character',-1);H.select();this.Window.document.selection.clear();}else H.select();FCKDomTools.RemoveNode(E);}else{this._Range.setEndBefore(G);G.parentNode.removeChild(G);H.select();}};FCKDomRange.prototype._GetSelectionMarkerTag=function(A){var B=this.Window.document;var C=B.selection;var D;try{D=C.createRange();}catch (e){return null;};if (D.parentElement().document!=B) return null;D.collapse(A===true);var E='fck_dom_range_temp_'+(new Date()).valueOf()+'_'+Math.floor(Math.random()*1000);D.pasteHTML('');return B.getElementById(E);}; +var FCKDomRangeIterator=function(A){this.Range=A;this.ForceBrBreak=false;this.EnforceRealBlocks=false;};FCKDomRangeIterator.CreateFromSelection=function(A){var B=new FCKDomRange(A);B.MoveToSelection();return new FCKDomRangeIterator(B);};FCKDomRangeIterator.prototype={GetNextParagraph:function(){var A;var B;var C;var D;var E;var F=this.ForceBrBreak?FCKListsLib.ListBoundaries:FCKListsLib.BlockBoundaries;if (!this._LastNode){var B=this.Range.Clone();B.Expand(this.ForceBrBreak?'list_contents':'block_contents');this._NextNode=B.GetTouchedStartNode();this._LastNode=B.GetTouchedEndNode();B=null;};var H=this._NextNode;var I=this._LastNode;while (H){var J=false;var K=(H.nodeType!=1);var L=false;if (!K){var M=H.nodeName.toLowerCase();if (F[M]){if (M=='br') K=true;else if (!B&&H.childNodes.length==0&&M!='hr'){A=H;C=H==I;break;};if (B) B.SetEnd(H,3,true);J=true;}else{if (H.firstChild){if (!B){B=new FCKDomRange(this.Range.Window);B.SetStart(H,3,true);};H=H.firstChild;continue;};K=true;}}else if (H.nodeType==3){if (/^[\r\n\t ]+$/.test(H.nodeValue)) K=false;};if (K&&!B){B=new FCKDomRange(this.Range.Window);B.SetStart(H,3,true);};C=((!J||K)&&H==I);if (B&&!J){while (!H.nextSibling&&!C){var N=H.parentNode;if (F[N.nodeName.toLowerCase()]){J=true;C=C||(N==I);break;};H=N;K=true;C=(H==I);L=true;}};if (K) B.SetEnd(H,4,true);if ((J||C)&&B){B._UpdateElementInfo();if (B.StartNode==B.EndNode&&B.StartNode.parentNode==B.StartBlockLimit&&B.StartNode.getAttribute&&B.StartNode.getAttribute('_fck_bookmark')) B=null;else break;};if (C) break;H=FCKDomTools.GetNextSourceNode(H,L,null,I);};if (!A){if (!B){this._NextNode=null;return null;};A=B.StartBlock;if (!A&&!this.EnforceRealBlocks&&B.StartBlockLimit.nodeName.IEquals('DIV','TH','TD')&&B.CheckStartOfBlock()&&B.CheckEndOfBlock()){A=B.StartBlockLimit;}else if (!A||(this.EnforceRealBlocks&&A.nodeName.toLowerCase()=='li')){A=this.Range.Window.document.createElement(FCKConfig.EnterMode=='p'?'p':'div');B.ExtractContents().AppendTo(A);FCKDomTools.TrimNode(A);B.InsertNode(A);D=true;E=true;}else if (A.nodeName.toLowerCase()!='li'){if (!B.CheckStartOfBlock()||!B.CheckEndOfBlock()){A=A.cloneNode(false);B.ExtractContents().AppendTo(A);FCKDomTools.TrimNode(A);var O=B.SplitBlock();D=!O.WasStartOfBlock;E=!O.WasEndOfBlock;FCKDebug.Output('removePreviousBr='+D+',removeLastBr='+E);B.InsertNode(A);}}else if (!C){this._NextNode=A==I?null:FCKDomTools.GetNextSourceNode(B.EndNode,true,null,I);return A;}};if (D){var P=A.previousSibling;if (P&&P.nodeType==1){if (P.nodeName.toLowerCase()=='br') P.parentNode.removeChild(P);else if (P.lastChild&&P.lastChild.nodeName.IEquals('br')) P.removeChild(P.lastChild);}};if (E){var Q=A.lastChild;if (Q&&Q.nodeType==1&&Q.nodeName.toLowerCase()=='br') A.removeChild(Q);};this._NextNode=(C||A==I)?null:FCKDomTools.GetNextSourceNode(A,true,null,I);return A;}}; +var FCKDocumentFragment=function(A){this._Document=A;this.RootNode=A.createElement('div');};FCKDocumentFragment.prototype={AppendTo:function(A){FCKDomTools.MoveChildren(this.RootNode,A);},AppendHtml:function(A){var B=this._Document.createElement('div');B.innerHTML=A;FCKDomTools.MoveChildren(B,this.RootNode);},InsertAfterNode:function(A){var B=this.RootNode;var C;while((C=B.lastChild)) FCKDomTools.InsertAfterNode(A,B.removeChild(C));}}; +var FCKW3CRange=function(A){this._Document=A;this.startContainer=null;this.startOffset=null;this.endContainer=null;this.endOffset=null;this.collapsed=true;};FCKW3CRange.CreateRange=function(A){return new FCKW3CRange(A);};FCKW3CRange.CreateFromRange=function(A,B){var C=FCKW3CRange.CreateRange(A);C.setStart(B.startContainer,B.startOffset);C.setEnd(B.endContainer,B.endOffset);return C;};FCKW3CRange.prototype={_UpdateCollapsed:function(){this.collapsed=(this.startContainer==this.endContainer&&this.startOffset==this.endOffset);},setStart:function(A,B){this.startContainer=A;this.startOffset=B;if (!this.endContainer){this.endContainer=A;this.endOffset=B;};this._UpdateCollapsed();},setEnd:function(A,B){this.endContainer=A;this.endOffset=B;if (!this.startContainer){this.startContainer=A;this.startOffset=B;};this._UpdateCollapsed();},setStartAfter:function(A){this.setStart(A.parentNode,FCKDomTools.GetIndexOf(A)+1);},setStartBefore:function(A){this.setStart(A.parentNode,FCKDomTools.GetIndexOf(A));},setEndAfter:function(A){this.setEnd(A.parentNode,FCKDomTools.GetIndexOf(A)+1);},setEndBefore:function(A){this.setEnd(A.parentNode,FCKDomTools.GetIndexOf(A));},collapse:function(A){if (A){this.endContainer=this.startContainer;this.endOffset=this.startOffset;}else{this.startContainer=this.endContainer;this.startOffset=this.endOffset;};this.collapsed=true;},selectNodeContents:function(A){this.setStart(A,0);this.setEnd(A,A.nodeType==3?A.data.length:A.childNodes.length);},insertNode:function(A){var B=this.startContainer;var C=this.startOffset;if (B.nodeType==3){B.splitText(C);if (B==this.endContainer) this.setEnd(B.nextSibling,this.endOffset-this.startOffset);FCKDomTools.InsertAfterNode(B,A);return;}else{B.insertBefore(A,B.childNodes[C]||null);if (B==this.endContainer){this.endOffset++;this.collapsed=false;}}},deleteContents:function(){if (this.collapsed) return;this._ExecContentsAction(0);},extractContents:function(){var A=new FCKDocumentFragment(this._Document);if (!this.collapsed) this._ExecContentsAction(1,A);return A;},cloneContents:function(){var A=new FCKDocumentFragment(this._Document);if (!this.collapsed) this._ExecContentsAction(2,A);return A;},_ExecContentsAction:function(A,B){var C=this.startContainer;var D=this.endContainer;var E=this.startOffset;var F=this.endOffset;var G=false;var H=false;if (D.nodeType==3) D=D.splitText(F);else{if (D.childNodes.length>0){if (F>D.childNodes.length-1){D=FCKDomTools.InsertAfterNode(D.lastChild,this._Document.createTextNode(''));H=true;}else D=D.childNodes[F];}};if (C.nodeType==3){C.splitText(E);if (C==D) D=C.nextSibling;}else{if (C.childNodes.length>0&&E<=C.childNodes.length-1){if (E==0){C=C.insertBefore(this._Document.createTextNode(''),C.firstChild);G=true;}else C=C.childNodes[E].previousSibling;}};var I=FCKDomTools.GetParents(C);var J=FCKDomTools.GetParents(D);var i,topStart,topEnd;for (i=0;i0&&levelStartNode!=D) levelClone=K.appendChild(levelStartNode.cloneNode(levelStartNode==D));if (!I[k]||levelStartNode.parentNode!=I[k].parentNode){currentNode=levelStartNode.previousSibling;while(currentNode){if (currentNode==I[k]||currentNode==C) break;currentSibling=currentNode.previousSibling;if (A==2) K.insertBefore(currentNode.cloneNode(true),K.firstChild);else{currentNode.parentNode.removeChild(currentNode);if (A==1) K.insertBefore(currentNode,K.firstChild);};currentNode=currentSibling;}};if (K) K=levelClone;};if (A==2){var L=this.startContainer;if (L.nodeType==3){L.data+=L.nextSibling.data;L.parentNode.removeChild(L.nextSibling);};var M=this.endContainer;if (M.nodeType==3&&M.nextSibling){M.data+=M.nextSibling.data;M.parentNode.removeChild(M.nextSibling);}}else{if (topStart&&topEnd&&(C.parentNode!=topStart.parentNode||D.parentNode!=topEnd.parentNode)){var N=FCKDomTools.GetIndexOf(topEnd);if (G&&topEnd.parentNode==C.parentNode) N--;this.setStart(topEnd.parentNode,N);};this.collapse(true);};if(G) C.parentNode.removeChild(C);if(H&&D.parentNode) D.parentNode.removeChild(D);},cloneRange:function(){return FCKW3CRange.CreateFromRange(this._Document,this);}}; +var FCKEnterKey=function(A,B,C,D){this.Window=A;this.EnterMode=B||'p';this.ShiftEnterMode=C||'br';var E=new FCKKeystrokeHandler(false);E._EnterKey=this;E.OnKeystroke=FCKEnterKey_OnKeystroke;E.SetKeystrokes([[13,'Enter'],[SHIFT+13,'ShiftEnter'],[9,'Tab'],[8,'Backspace'],[CTRL+8,'CtrlBackspace'],[46,'Delete']]);if (D>0){this.TabText='';while (D-->0) this.TabText+='\xa0';};E.AttachToElement(A.document);};function FCKEnterKey_OnKeystroke(A,B){var C=this._EnterKey;try{switch (B){case 'Enter':return C.DoEnter();break;case 'ShiftEnter':return C.DoShiftEnter();break;case 'Backspace':return C.DoBackspace();break;case 'Delete':return C.DoDelete();break;case 'Tab':return C.DoTab();break;case 'CtrlBackspace':return C.DoCtrlBackspace();break;}}catch (e){};return false;};FCKEnterKey.prototype.DoEnter=function(A,B){FCKUndo.SaveUndoStep();this._HasShift=(B===true);var C=FCKSelection.GetParentElement();var D=new FCKElementPath(C);var E=A||this.EnterMode;if (E=='br'||D.Block&&D.Block.tagName.toLowerCase()=='pre') return this._ExecuteEnterBr();else return this._ExecuteEnterBlock(E);};FCKEnterKey.prototype.DoShiftEnter=function(){return this.DoEnter(this.ShiftEnterMode,true);};FCKEnterKey.prototype.DoBackspace=function(){var A=false;var B=new FCKDomRange(this.Window);B.MoveToSelection();if (FCKBrowserInfo.IsIE&&this._CheckIsAllContentsIncluded(B,this.Window.document.body)){this._FixIESelectAllBug(B);return true;};var C=B.CheckIsCollapsed();if (!C){if (FCKBrowserInfo.IsIE&&this.Window.document.selection.type.toLowerCase()=="control"){var D=this.Window.document.selection.createRange();for (var i=D.length-1;i>=0;i--){var E=D.item(i);E.parentNode.removeChild(E);};return true;};return false;};var F=B.StartBlock;var G=B.EndBlock;if (B.StartBlockLimit==B.EndBlockLimit&&F&&G){if (!C){var H=B.CheckEndOfBlock();B.DeleteContents();if (F!=G){B.SetStart(G,1);B.SetEnd(G,1);};B.Select();A=(F==G);};if (B.CheckStartOfBlock()){var I=B.StartBlock;var J=FCKDomTools.GetPreviousSourceElement(I,true,['BODY',B.StartBlockLimit.nodeName],['UL','OL']);A=this._ExecuteBackspace(B,J,I);}else if (FCKBrowserInfo.IsGeckoLike){B.Select();}};B.Release();return A;};FCKEnterKey.prototype.DoCtrlBackspace=function(){FCKUndo.SaveUndoStep();var A=new FCKDomRange(this.Window);A.MoveToSelection();if (FCKBrowserInfo.IsIE&&this._CheckIsAllContentsIncluded(A,this.Window.document.body)){this._FixIESelectAllBug(A);return true;};return false;};FCKEnterKey.prototype._ExecuteBackspace=function(A,B,C){var D=false;if (!B&&C&&C.nodeName.IEquals('LI')&&C.parentNode.parentNode.nodeName.IEquals('LI')){this._OutdentWithSelection(C,A);return true;};if (B&&B.nodeName.IEquals('LI')){var E=FCKDomTools.GetLastChild(B,['UL','OL']);while (E){B=FCKDomTools.GetLastChild(E,'LI');E=FCKDomTools.GetLastChild(B,['UL','OL']);}};if (B&&C){if (C.nodeName.IEquals('LI')&&!B.nodeName.IEquals('LI')){this._OutdentWithSelection(C,A);return true;};var F=C.parentNode;var G=B.nodeName.toLowerCase();if (FCKListsLib.EmptyElements[G]!=null||G=='table'){FCKDomTools.RemoveNode(B);D=true;}else{FCKDomTools.RemoveNode(C);while (F.innerHTML.Trim().length==0){var H=F.parentNode;H.removeChild(F);F=H;};FCKDomTools.LTrimNode(C);FCKDomTools.RTrimNode(B);A.SetStart(B,2,true);A.Collapse(true);var I=A.CreateBookmark(true);if (!C.tagName.IEquals(['TABLE'])) FCKDomTools.MoveChildren(C,B);A.SelectBookmark(I);D=true;}};return D;};FCKEnterKey.prototype.DoDelete=function(){FCKUndo.SaveUndoStep();var A=false;var B=new FCKDomRange(this.Window);B.MoveToSelection();if (FCKBrowserInfo.IsIE&&this._CheckIsAllContentsIncluded(B,this.Window.document.body)){this._FixIESelectAllBug(B);return true;};if (B.CheckIsCollapsed()&&B.CheckEndOfBlock(FCKBrowserInfo.IsGeckoLike)){var C=B.StartBlock;var D=FCKTools.GetElementAscensor(C,'td');var E=FCKDomTools.GetNextSourceElement(C,true,[B.StartBlockLimit.nodeName],['UL','OL','TR'],true);if (D){var F=FCKTools.GetElementAscensor(E,'td');if (F!=D) return true;};A=this._ExecuteBackspace(B,C,E);};B.Release();return A;};FCKEnterKey.prototype.DoTab=function(){var A=new FCKDomRange(this.Window);A.MoveToSelection();var B=A._Range.startContainer;while (B){if (B.nodeType==1){var C=B.tagName.toLowerCase();if (C=="tr"||C=="td"||C=="th"||C=="tbody"||C=="table") return false;else break;};B=B.parentNode;};if (this.TabText){A.DeleteContents();A.InsertNode(this.Window.document.createTextNode(this.TabText));A.Collapse(false);A.Select();};return true;};FCKEnterKey.prototype._ExecuteEnterBlock=function(A,B){var C=B||new FCKDomRange(this.Window);var D=C.SplitBlock();if (D){var E=D.PreviousBlock;var F=D.NextBlock;var G=D.WasStartOfBlock;var H=D.WasEndOfBlock;if (!D.WasStartOfBlock&&!D.WasEndOfBlock){if (F.nodeName.IEquals('li')&&F.firstChild&&F.firstChild.nodeName.IEquals(['ul','ol'])) F.insertBefore(F.ownerDocument.createTextNode('\xa0'),F.firstChild);if (F) C.MoveToElementEditStart(F);}else{if (G&&H&&E.tagName.toUpperCase()=='LI'){C.MoveToElementStart(E);this._OutdentWithSelection(E,C);C.Release();return true;};var I;if (E){var J=E.tagName.toUpperCase();if (!this._HasShift&&!(/^H[1-6]$/).test(J)){I=FCKDomTools.CloneElement(E);}}else if (F) I=FCKDomTools.CloneElement(F);if (!I) I=this.Window.document.createElement(A);var K=D.ElementPath;if (K){for (var i=0,len=K.Elements.length;i=0&&(C=B[i--])){if (C.name.length>0){if (C.innerHTML!==''){if (FCKBrowserInfo.IsIE) C.className+=' FCK__AnchorC';}else{var D=FCKDocumentProcessor_CreateFakeImage('FCK__Anchor',C.cloneNode(true));D.setAttribute('_fckanchor','true',0);C.parentNode.insertBefore(D,C);C.parentNode.removeChild(C);}}}}};var FCKPageBreaksProcessor=FCKDocumentProcessor.AppendNew();FCKPageBreaksProcessor.ProcessDocument=function(A){var B=A.getElementsByTagName('DIV');var C;var i=B.length-1;while (i>=0&&(C=B[i--])){if (C.style.pageBreakAfter=='always'&&C.childNodes.length==1&&C.childNodes[0].style&&C.childNodes[0].style.display=='none'){var D=FCKDocumentProcessor_CreateFakeImage('FCK__PageBreak',C.cloneNode(true));C.parentNode.insertBefore(D,C);C.parentNode.removeChild(C);}}};var FCKFlashProcessor=FCKDocumentProcessor.AppendNew();FCKFlashProcessor.ProcessDocument=function(A){var B=FCK.IsDirty();var C=A.getElementsByTagName('EMBED');var D;var i=C.length-1;while (i>=0&&(D=C[i--])){var E=D.attributes['type'];if ((D.src&&D.src.EndsWith('.swf',true))||(E&&E.nodeValue=='application/x-shockwave-flash')){var F=D.cloneNode(true);var G=FCKDocumentProcessor_CreateFakeImage('FCK__Flash',F);G.setAttribute('_fckflash','true',0);FCKFlashProcessor.RefreshView(G,D);D.parentNode.insertBefore(G,D);D.parentNode.removeChild(D);}};if (!B) FCK.ResetIsDirty();};FCKFlashProcessor.RefreshView=function(A,B){if (B.getAttribute('width')>0) A.style.width=FCKTools.ConvertHtmlSizeToStyle(B.getAttribute('width'));if (B.getAttribute('height')>0) A.style.height=FCKTools.ConvertHtmlSizeToStyle(B.getAttribute('height'));};FCK.GetRealElement=function(A){var e=FCKTempBin.Elements[A.getAttribute('_fckrealelement')];if (A.getAttribute('_fckflash')){if (A.style.width.length>0) e.width=FCKTools.ConvertStyleSizeToHtml(A.style.width);if (A.style.height.length>0) e.height=FCKTools.ConvertStyleSizeToHtml(A.style.height);};return e;};if (FCKBrowserInfo.IsIE){FCKDocumentProcessor.AppendNew().ProcessDocument=function(A){var B=A.getElementsByTagName('HR');var C;var i=B.length-1;while (i>=0&&(C=B[i--])){var D=A.createElement('hr');D.mergeAttributes(C,true);FCKDomTools.InsertAfterNode(C,D);C.parentNode.removeChild(C);}}};FCKDocumentProcessor.AppendNew().ProcessDocument=function(A){var B=A.getElementsByTagName('INPUT');var C;var i=B.length-1;while (i>=0&&(C=B[i--])){if (C.type=='hidden'){var D=FCKDocumentProcessor_CreateFakeImage('FCK__InputHidden',C.cloneNode(true));D.setAttribute('_fckinputhidden','true',0);C.parentNode.insertBefore(D,C);C.parentNode.removeChild(C);}}} +var FCKSelection=FCK.Selection={GetParentBlock:function(){var A=this.GetParentElement();while (A){if (FCKListsLib.BlockBoundaries[A.nodeName.toLowerCase()]) break;A=A.parentNode;};return A;},ApplyStyle:function(A){FCKStyles.ApplyStyle(new FCKStyle(A));}}; +FCKSelection.GetType=function(){try{var A=FCK.EditorDocument.selection.type;if (A=='Control'||A=='Text') return A;if (FCK.EditorDocument.selection.createRange().parentElement) return 'Text';}catch(e){};return 'None';};FCKSelection.GetSelectedElement=function(){if (this.GetType()=='Control'){var A=FCK.EditorDocument.selection.createRange();if (A&&A.item) return FCK.EditorDocument.selection.createRange().item(0);};return null;};FCKSelection.GetParentElement=function(){switch (this.GetType()){case 'Control':var A=FCKSelection.GetSelectedElement();return A?A.parentElement:null;case 'None':return null;default:return FCK.EditorDocument.selection.createRange().parentElement();}};FCKSelection.GetBoundaryParentElement=function(A){switch (this.GetType()){case 'Control':var B=FCKSelection.GetSelectedElement();return B?B.parentElement:null;case 'None':return null;default:var C=FCK.EditorDocument;var D=C.selection.createRange();D.collapse(A!==false);var B=D.parentElement();return FCKTools.GetElementDocument(B)==C?B:null;}};FCKSelection.SelectNode=function(A){FCK.Focus();FCK.EditorDocument.selection.empty();var B;try{B=FCK.EditorDocument.body.createControlRange();B.addElement(A);}catch(e){B=FCK.EditorDocument.body.createTextRange();B.moveToElementText(A);};B.select();};FCKSelection.Collapse=function(A){FCK.Focus();if (this.GetType()=='Text'){var B=FCK.EditorDocument.selection.createRange();B.collapse(A==null||A===true);B.select();}};FCKSelection.HasAncestorNode=function(A){var B;if (FCK.EditorDocument.selection.type=="Control"){B=this.GetSelectedElement();}else{var C=FCK.EditorDocument.selection.createRange();B=C.parentElement();};while (B){if (B.tagName==A) return true;B=B.parentNode;};return false;};FCKSelection.MoveToAncestorNode=function(A){var B,oRange;if (!FCK.EditorDocument) return null;if (FCK.EditorDocument.selection.type=="Control"){oRange=FCK.EditorDocument.selection.createRange();for (i=0;i=0;i--){if (C[i]) FCKTableHandler.DeleteRows(C[i]);};return;};var E=FCKTools.GetElementAscensor(A,'TABLE');if (E.rows.length==1){FCKTableHandler.DeleteTable(E);return;};A.parentNode.removeChild(A);};FCKTableHandler.DeleteTable=function(A){if (!A){A=FCKSelection.GetSelectedElement();if (!A||A.tagName!='TABLE') A=FCKSelection.MoveToAncestorNode('TABLE');};if (!A) return;FCKSelection.SelectNode(A);FCKSelection.Collapse();if (A.parentNode.childNodes.length==1) A.parentNode.parentNode.removeChild(A.parentNode);else A.parentNode.removeChild(A);};FCKTableHandler.InsertColumn=function(A){var B=null;var C=this.GetSelectedCells();if (C&&C.length) B=C[A?0:(C.length-1)];if (!B) return;var D=FCKTools.GetElementAscensor(B,'TABLE');var E=B.cellIndex;for (var i=0;i=0;i--){if (B[i]) FCKTableHandler.DeleteColumns(B[i]);};return;};if (!A) return;var C=FCKTools.GetElementAscensor(A,'TABLE');var D=A.cellIndex;for (var i=C.rows.length-1;i>=0;i--){var E=C.rows[i];if (D==0&&E.cells.length==1){FCKTableHandler.DeleteRows(E);continue;};if (E.cells[D]) E.removeChild(E.cells[D]);}};FCKTableHandler.InsertCell=function(A,B){var C=null;var D=this.GetSelectedCells();if (D&&D.length) C=D[B?0:(D.length-1)];if (!C) return null;var E=FCK.EditorDocument.createElement('TD');if (FCKBrowserInfo.IsGeckoLike) FCKTools.AppendBogusBr(E);if (!B&&C.cellIndex==C.parentNode.cells.length-1) C.parentNode.appendChild(E);else C.parentNode.insertBefore(E,B?C:C.nextSibling);return E;};FCKTableHandler.DeleteCell=function(A){if (A.parentNode.cells.length==1){FCKTableHandler.DeleteRows(FCKTools.GetElementAscensor(A,'TR'));return;};A.parentNode.removeChild(A);};FCKTableHandler.DeleteCells=function(){var A=FCKTableHandler.GetSelectedCells();for (var i=A.length-1;i>=0;i--){FCKTableHandler.DeleteCell(A[i]);}};FCKTableHandler._MarkCells=function(A,B){for (var i=0;i=E.height){for (D=F;D0){var L=K.removeChild(K.firstChild);if (L.nodeType!=1||(L.getAttribute('type',2)!='_moz'&&L.getAttribute('_moz_dirty')!=null)){I.appendChild(L);J++;}}};if (J>0) I.appendChild(B.ownerDocument.createElement('br'));};this._ReplaceCellsByMarker(C,'_SelectedCells',B);this._UnmarkCells(A,'_SelectedCells');this._InstallTableMap(C,B.parentNode.parentNode);B.appendChild(I);if (FCKBrowserInfo.IsGeckoLike&&(!B.firstChild)) FCKTools.AppendBogusBr(B);this._MoveCaretToCell(B,false);};FCKTableHandler.MergeRight=function(){var A=this.GetMergeRightTarget();if (A==null) return;var B=A.refCell;var C=A.tableMap;var D=A.nextCell;var E=FCK.EditorDocument.createDocumentFragment();while (D&&D.childNodes&&D.childNodes.length>0) E.appendChild(D.removeChild(D.firstChild));D.parentNode.removeChild(D);B.appendChild(E);this._MarkCells([D],'_Replace');this._ReplaceCellsByMarker(C,'_Replace',B);this._InstallTableMap(C,B.parentNode.parentNode);this._MoveCaretToCell(B,false);};FCKTableHandler.MergeDown=function(){var A=this.GetMergeDownTarget();if (A==null) return;var B=A.refCell;var C=A.tableMap;var D=A.nextCell;var E=B.ownerDocument.createDocumentFragment();while (D&&D.childNodes&&D.childNodes.length>0) E.appendChild(D.removeChild(D.firstChild));if (E.firstChild) E.insertBefore(D.ownerDocument.createElement('br'),E.firstChild);B.appendChild(E);this._MarkCells([D],'_Replace');this._ReplaceCellsByMarker(C,'_Replace',B);this._InstallTableMap(C,B.parentNode.parentNode);this._MoveCaretToCell(B,false);};FCKTableHandler.HorizontalSplitCell=function(){var A=FCKTableHandler.GetSelectedCells();if (A.length!=1) return;var B=A[0];var C=this._CreateTableMap(B.parentNode.parentNode);var D=B.parentNode.rowIndex;var E=FCKTableHandler._GetCellIndexSpan(C,D,B);var F=isNaN(B.colSpan)?1:B.colSpan;if (F>1){var G=Math.ceil(F/2);var H=B.ownerDocument.createElement('td');if (FCKBrowserInfo.IsGeckoLike) FCKTools.AppendBogusBr(H);var I=E+G;var J=E+F;var K=isNaN(B.rowSpan)?1:B.rowSpan;for (var r=D;r1){B.rowSpan=Math.ceil(E/2);var G=F+Math.ceil(E/2);var H=null;for (var i=D+1;i0){var C=B.rows[0];C.parentNode.removeChild(C);};for (var i=0;iE) E=j;if (D._colScanned===true) continue;if (A[i][j-1]==D) D.colSpan++;if (A[i][j+1]!=D) D._colScanned=true;}};for (var i=0;i<=E;i++){for (var j=0;j=0&&C.compareEndPoints('StartToEnd',E)<=0)||(C.compareEndPoints('EndToStart',E)>=0&&C.compareEndPoints('EndToEnd',E)<=0)){B[B.length]=D.cells[i];}}}};return B;}; +var FCKXml=function(){this.Error=false;};FCKXml.GetAttribute=function(A,B,C){var D=A.attributes.getNamedItem(B);return D?D.value:C;};FCKXml.TransformToObject=function(A){if (!A) return null;var B={};var C=A.attributes;for (var i=0;i ';var A=FCKDocumentProcessor_CreateFakeImage('FCK__PageBreak',e);var B=new FCKDomRange(FCK.EditorWindow);B.MoveToSelection();var C=B.SplitBlock();if (C.NextBlock) C.NextBlock.parentNode.insertBefore(A,C.NextBlock);else C.PreviousBlock.parentNode.insertBefore(A,C.PreviousBlock.nextSibling);FCK.Events.FireEvent('OnSelectionChange');};FCKPageBreakCommand.prototype.GetState=function(){return 0;};var FCKUnlinkCommand=function(){this.Name='Unlink';};FCKUnlinkCommand.prototype.Execute=function(){FCKUndo.SaveUndoStep();if (FCKBrowserInfo.IsGeckoLike){var A=FCK.Selection.MoveToAncestorNode('A');if (A) FCKTools.RemoveOuterTags(A);return;};FCK.ExecuteNamedCommand(this.Name);};FCKUnlinkCommand.prototype.GetState=function(){var A=FCK.GetNamedCommandState(this.Name);if (A==0&&FCK.EditMode==0){var B=FCKSelection.MoveToAncestorNode('A');var C=(B&&B.name.length>0&&B.href.length==0);if (C) A=-1;};return A;};var FCKSelectAllCommand=function(){this.Name='SelectAll';};FCKSelectAllCommand.prototype.Execute=function(){if (FCK.EditMode==0){FCK.ExecuteNamedCommand('SelectAll');}else{var A=FCK.EditingArea.Textarea;if (FCKBrowserInfo.IsIE){A.createTextRange().execCommand('SelectAll');}else{A.selectionStart=0;A.selectionEnd=A.value.length;};A.focus();}};FCKSelectAllCommand.prototype.GetState=function(){return 0;};var FCKPasteCommand=function(){this.Name='Paste';};FCKPasteCommand.prototype={Execute:function(){if (FCKBrowserInfo.IsIE) FCK.Paste();else FCK.ExecuteNamedCommand('Paste');},GetState:function(){return FCK.GetNamedCommandState('Paste');}};var FCKRuleCommand=function(){this.Name='Rule';};FCKRuleCommand.prototype={Execute:function(){FCKUndo.SaveUndoStep();FCK.InsertElement('hr');},GetState:function(){return FCK.GetNamedCommandState('InsertHorizontalRule');}};var FCKCopyCommand=function(){this.Name='Copy';};FCKCopyCommand.prototype={Execute:function(){FCK.ExecuteNamedCommand(this.Name);},GetState:function(){return FCK.GetNamedCommandState('Cut');}};var FCKAnchorDeleteCommand=function(){this.Name='AnchorDelete';};FCKAnchorDeleteCommand.prototype={Execute:function(){if (FCK.Selection.GetType()=='Control'){FCK.Selection.Delete();}else{var A=FCK.Selection.GetSelectedElement();if (A){if (A.tagName=='IMG'&&A.getAttribute('_fckanchor')) oAnchor=FCK.GetRealElement(A);else A=null;};if (!A){oAnchor=FCK.Selection.MoveToAncestorNode('A');if (oAnchor) FCK.Selection.SelectNode(oAnchor);};if (oAnchor.href.length!=0){oAnchor.removeAttribute('name');if (FCKBrowserInfo.IsIE) oAnchor.className=oAnchor.className.replace(FCKRegexLib.FCK_Class,'');return;};if (A){A.parentNode.removeChild(A);return;};if (oAnchor.innerHTML.length==0){oAnchor.parentNode.removeChild(oAnchor);return;};FCKTools.RemoveOuterTags(oAnchor);};if (FCKBrowserInfo.IsGecko) FCK.Selection.Collapse(true);},GetState:function(){return FCK.GetNamedCommandState('Unlink');}}; +var FCKShowBlockCommand=function(A,B){this.Name=A;if (B!=undefined) this._SavedState=B;else this._SavedState=null;};FCKShowBlockCommand.prototype.Execute=function(){var A=this.GetState();if (A==-1) return;var B=FCK.EditorDocument.body;if (A==1) B.className=B.className.replace(/(^| )FCK__ShowBlocks/g,'');else B.className+=' FCK__ShowBlocks';FCK.Events.FireEvent('OnSelectionChange');};FCKShowBlockCommand.prototype.GetState=function(){if (FCK.EditMode!=0) return -1;if (!FCK.EditorDocument) return 0;if (/FCK__ShowBlocks(?:\s|$)/.test(FCK.EditorDocument.body.className)) return 1;return 0;};FCKShowBlockCommand.prototype.SaveState=function(){this._SavedState=this.GetState();};FCKShowBlockCommand.prototype.RestoreState=function(){if (this._SavedState!=null&&this.GetState()!=this._SavedState) this.Execute();}; +var FCKSpellCheckCommand=function(){this.Name='SpellCheck';this.IsEnabled=(FCKConfig.SpellChecker=='ieSpell'||FCKConfig.SpellChecker=='SpellerPages');};FCKSpellCheckCommand.prototype.Execute=function(){switch (FCKConfig.SpellChecker){case 'ieSpell':this._RunIeSpell();break;case 'SpellerPages':FCKDialog.OpenDialog('FCKDialog_SpellCheck','Spell Check','dialog/fck_spellerpages.html',440,480);break;}};FCKSpellCheckCommand.prototype._RunIeSpell=function(){try{var A=new ActiveXObject("ieSpell.ieSpellExtension");A.CheckAllLinkedDocuments(FCK.EditorDocument);}catch(e){if(e.number==-2146827859){if (confirm(FCKLang.IeSpellDownload)) window.open(FCKConfig.IeSpellDownloadUrl,'IeSpellDownload');}else alert('Error Loading ieSpell: '+e.message+' ('+e.number+')');}};FCKSpellCheckCommand.prototype.GetState=function(){return this.IsEnabled?0:-1;} +var FCKTextColorCommand=function(A){this.Name=A=='ForeColor'?'TextColor':'BGColor';this.Type=A;var B;if (FCKBrowserInfo.IsIE) B=window;else if (FCK.ToolbarSet._IFrame) B=FCKTools.GetElementWindow(FCK.ToolbarSet._IFrame);else B=window.parent;this._Panel=new FCKPanel(B);this._Panel.AppendStyleSheet(FCKConfig.SkinPath+'fck_editor.css');this._Panel.MainNode.className='FCK_Panel';this._CreatePanelBody(this._Panel.Document,this._Panel.MainNode);FCKTools.DisableSelection(this._Panel.Document.body);};FCKTextColorCommand.prototype.Execute=function(A,B,C){this._Panel.Show(A,B,C);};FCKTextColorCommand.prototype.SetColor=function(A){FCKUndo.SaveUndoStep();var B=FCKStyles.GetStyle('_FCK_'+(this.Type=='ForeColor'?'Color':'BackColor'));if (!A||A.length==0) FCK.Styles.RemoveStyle(B);else{B.SetVariable('Color',A);FCKStyles.ApplyStyle(B);};FCKUndo.SaveUndoStep();FCK.Focus();FCK.Events.FireEvent('OnSelectionChange');};FCKTextColorCommand.prototype.GetState=function(){return 0;};function FCKTextColorCommand_OnMouseOver(){this.className='ColorSelected';};function FCKTextColorCommand_OnMouseOut(){this.className='ColorDeselected';};function FCKTextColorCommand_OnClick(A,B,C){this.className='ColorDeselected';B.SetColor(C);B._Panel.Hide();};function FCKTextColorCommand_AutoOnClick(A,B){this.className='ColorDeselected';B.SetColor('');B._Panel.Hide();};function FCKTextColorCommand_MoreOnClick(A,B){this.className='ColorDeselected';B._Panel.Hide();FCKDialog.OpenDialog('FCKDialog_Color',FCKLang.DlgColorTitle,'dialog/fck_colorselector.html',400,330,FCKTools.Hitch(B,'SetColor'));};FCKTextColorCommand.prototype._CreatePanelBody=function(A,B){function CreateSelectionDiv(){var C=A.createElement("DIV");C.className='ColorDeselected';FCKTools.AddEventListenerEx(C,'mouseover',FCKTextColorCommand_OnMouseOver);FCKTools.AddEventListenerEx(C,'mouseout',FCKTextColorCommand_OnMouseOut);return C;};var D=B.appendChild(A.createElement("TABLE"));D.className='ForceBaseFont';D.style.tableLayout='fixed';D.cellPadding=0;D.cellSpacing=0;D.border=0;D.width=150;var E=D.insertRow(-1).insertCell(-1);E.colSpan=8;var C=E.appendChild(CreateSelectionDiv());C.innerHTML='\n \n \n \n \n
    '+FCKLang.ColorAutomatic+'
    ';FCKTools.AddEventListenerEx(C,'click',FCKTextColorCommand_AutoOnClick,this);if (!FCKBrowserInfo.IsIE) C.style.width='96%';var G=FCKConfig.FontColors.toString().split(',');var H=0;while (H
    ';if (H>=G.length) C.style.visibility='hidden';else FCKTools.AddEventListenerEx(C,'click',FCKTextColorCommand_OnClick,[this,L]);}};if (FCKConfig.EnableMoreFontColors){E=D.insertRow(-1).insertCell(-1);E.colSpan=8;C=E.appendChild(CreateSelectionDiv());C.innerHTML='
    '+FCKLang.ColorMoreColors+'
    ';FCKTools.AddEventListenerEx(C,'click',FCKTextColorCommand_MoreOnClick,this);};if (!FCKBrowserInfo.IsIE) C.style.width='96%';}; +var FCKPastePlainTextCommand=function(){this.Name='PasteText';};FCKPastePlainTextCommand.prototype.Execute=function(){FCK.PasteAsPlainText();};FCKPastePlainTextCommand.prototype.GetState=function(){return FCK.GetNamedCommandState('Paste');}; +var FCKPasteWordCommand=function(){this.Name='PasteWord';};FCKPasteWordCommand.prototype.Execute=function(){FCK.PasteFromWord();};FCKPasteWordCommand.prototype.GetState=function(){if (FCKConfig.ForcePasteAsPlainText) return -1;else return FCK.GetNamedCommandState('Paste');}; +var FCKTableCommand=function(A){this.Name=A;};FCKTableCommand.prototype.Execute=function(){FCKUndo.SaveUndoStep();if (!FCKBrowserInfo.IsGecko){switch (this.Name){case 'TableMergeRight':return FCKTableHandler.MergeRight();case 'TableMergeDown':return FCKTableHandler.MergeDown();}};switch (this.Name){case 'TableInsertRowAfter':return FCKTableHandler.InsertRow(false);case 'TableInsertRowBefore':return FCKTableHandler.InsertRow(true);case 'TableDeleteRows':return FCKTableHandler.DeleteRows();case 'TableInsertColumnAfter':return FCKTableHandler.InsertColumn(false);case 'TableInsertColumnBefore':return FCKTableHandler.InsertColumn(true);case 'TableDeleteColumns':return FCKTableHandler.DeleteColumns();case 'TableInsertCellAfter':return FCKTableHandler.InsertCell(null,false);case 'TableInsertCellBefore':return FCKTableHandler.InsertCell(null,true);case 'TableDeleteCells':return FCKTableHandler.DeleteCells();case 'TableMergeCells':return FCKTableHandler.MergeCells();case 'TableHorizontalSplitCell':return FCKTableHandler.HorizontalSplitCell();case 'TableVerticalSplitCell':return FCKTableHandler.VerticalSplitCell();case 'TableDelete':return FCKTableHandler.DeleteTable();default:return alert(FCKLang.UnknownCommand.replace(/%1/g,this.Name));}};FCKTableCommand.prototype.GetState=function(){if (FCK.EditorDocument!=null&&FCKSelection.HasAncestorNode('TABLE')){switch (this.Name){case 'TableHorizontalSplitCell':case 'TableVerticalSplitCell':if (FCKTableHandler.GetSelectedCells().length==1) return 0;else return -1;case 'TableMergeCells':if (FCKTableHandler.CheckIsSelectionRectangular()&&FCKTableHandler.GetSelectedCells().length>1) return 0;else return -1;case 'TableMergeRight':return FCKTableHandler.GetMergeRightTarget()?0:-1;case 'TableMergeDown':return FCKTableHandler.GetMergeDownTarget()?0:-1;default:return 0;}}else return -1;}; +var FCKFitWindow=function(){this.Name='FitWindow';};FCKFitWindow.prototype.Execute=function(){var A=window.frameElement;var B=A.style;var C=parent;var D=C.document.documentElement;var E=C.document.body;var F=E.style;var G;if (!this.IsMaximized){if(FCKBrowserInfo.IsIE) C.attachEvent('onresize',FCKFitWindow_Resize);else C.addEventListener('resize',FCKFitWindow_Resize,true);this._ScrollPos=FCKTools.GetScrollPosition(C);G=A;while((G=G.parentNode)){if (G.nodeType==1){G._fckSavedStyles=FCKTools.SaveStyles(G);G.style.zIndex=FCKConfig.FloatingPanelsZIndex-1;}};if (FCKBrowserInfo.IsIE){this.documentElementOverflow=D.style.overflow;D.style.overflow='hidden';F.overflow='hidden';}else{F.overflow='hidden';F.width='0px';F.height='0px';};this._EditorFrameStyles=FCKTools.SaveStyles(A);var H=FCKTools.GetViewPaneSize(C);B.position="absolute";B.zIndex=FCKConfig.FloatingPanelsZIndex-1;B.left="0px";B.top="0px";B.width=H.Width+"px";B.height=H.Height+"px";if (!FCKBrowserInfo.IsIE){B.borderRight=B.borderBottom="9999px solid white";B.backgroundColor="white";};C.scrollTo(0,0);var I=FCKTools.GetWindowPosition(C,A);if (I.x!=0) B.left=(-1*I.x)+"px";if (I.y!=0) B.top=(-1*I.y)+"px";this.IsMaximized=true;}else{if(FCKBrowserInfo.IsIE) C.detachEvent("onresize",FCKFitWindow_Resize);else C.removeEventListener("resize",FCKFitWindow_Resize,true);G=A;while((G=G.parentNode)){if (G._fckSavedStyles){FCKTools.RestoreStyles(G,G._fckSavedStyles);G._fckSavedStyles=null;}};if (FCKBrowserInfo.IsIE) D.style.overflow=this.documentElementOverflow;FCKTools.RestoreStyles(A,this._EditorFrameStyles);C.scrollTo(this._ScrollPos.X,this._ScrollPos.Y);this.IsMaximized=false;};FCKToolbarItems.GetItem('FitWindow').RefreshState();if (FCK.EditMode==0) FCK.EditingArea.MakeEditable();FCK.Focus();};FCKFitWindow.prototype.GetState=function(){if (FCKConfig.ToolbarLocation!='In') return -1;else return (this.IsMaximized?1:0);};function FCKFitWindow_Resize(){var A=FCKTools.GetViewPaneSize(parent);var B=window.frameElement.style;B.width=A.Width+'px';B.height=A.Height+'px';}; +var FCKListCommand=function(A,B){this.Name=A;this.TagName=B;};FCKListCommand.prototype={GetState:function(){if (FCK.EditMode!=0||!FCK.EditorWindow) return -1;var A=FCKSelection.GetBoundaryParentElement(true);var B=A;while (B){if (B.nodeName.IEquals(['ul','ol'])) break;B=B.parentNode;};if (B&&B.nodeName.IEquals(this.TagName)) return 1;else return 0;},Execute:function(){FCKUndo.SaveUndoStep();var A=FCK.EditorDocument;var B=new FCKDomRange(FCK.EditorWindow);B.MoveToSelection();var C=this.GetState();if (C==0){FCKDomTools.TrimNode(A.body);if (!A.body.firstChild){var D=A.createElement('p');A.body.appendChild(D);B.MoveToNodeContents(D);}};var E=B.CreateBookmark();var F=[];var G={};var H=new FCKDomRangeIterator(B);var I;H.ForceBrBreak=(C==0);var J=true;var K=null;while (J){while ((I=H.GetNextParagraph())){var L=new FCKElementPath(I);var M=null;var N=false;var O=L.BlockLimit;for (var i=L.Elements.length-1;i>=0;i--){var P=L.Elements[i];if (P.nodeName.IEquals(['ol','ul'])){if (O._FCK_ListGroupObject) O._FCK_ListGroupObject=null;var Q=P._FCK_ListGroupObject;if (Q) Q.contents.push(I);else{Q={ 'root':P,'contents':[I] };F.push(Q);FCKDomTools.SetElementMarker(G,P,'_FCK_ListGroupObject',Q);};N=true;break;}};if (N) continue;var R=O;if (R._FCK_ListGroupObject) R._FCK_ListGroupObject.contents.push(I);else{var Q={ 'root':R,'contents':[I] };FCKDomTools.SetElementMarker(G,R,'_FCK_ListGroupObject',Q);F.push(Q);}};if (FCKBrowserInfo.IsIE) J=false;else{if (K==null){K=[];var T=FCK.EditorWindow.getSelection();if (T&&F.length==0) K.push(T.getRangeAt(0));for (var i=1;T&&i0){var Q=F.shift();if (C==0){if (Q.root.nodeName.IEquals(['ul','ol'])) this._ChangeListType(Q,G,W);else this._CreateList(Q,W);}else if (C==1&&Q.root.nodeName.IEquals(['ul','ol'])) this._RemoveList(Q,G);};for (var i=0;iC[i-1].indent+1){var H=C[i-1].indent+1-C[i].indent;var I=C[i].indent;while (C[i]&&C[i].indent>=I){C[i].indent+=H;i++;};i--;}};var J=FCKDomTools.ArrayToList(C,B);if (A.root.nextSibling==null||A.root.nextSibling.nodeName.IEquals('br')){if (J.listNode.lastChild.nodeName.IEquals('br')) J.listNode.removeChild(J.listNode.lastChild);};A.root.parentNode.replaceChild(J.listNode,A.root);}}; +var FCKJustifyCommand=function(A){this.AlignValue=A;var B=FCKConfig.ContentLangDirection.toLowerCase();this.IsDefaultAlign=(A=='left'&&B=='ltr')||(A=='right'&&B=='rtl');var C=this._CssClassName=(function(){var D=FCKConfig.JustifyClasses;if (D){switch (A){case 'left':return D[0];case 'center':return D[1];case 'right':return D[2];case 'justify':return D[3];}};return null;})();if (C&&C.length>0) this._CssClassRegex=new RegExp('(?:^|\\s+)'+C+'(?=$|\\s)');};FCKJustifyCommand._GetClassNameRegex=function(){var A=FCKJustifyCommand._ClassRegex;if (A!=undefined) return A;var B=[];var C=FCKConfig.JustifyClasses;if (C){for (var i=0;i<4;i++){var D=C[i];if (D&&D.length>0) B.push(D);}};if (B.length>0) A=new RegExp('(?:^|\\s+)(?:'+B.join('|')+')(?=$|\\s)');else A=null;return FCKJustifyCommand._ClassRegex=A;};FCKJustifyCommand.prototype={Execute:function(){FCKUndo.SaveUndoStep();var A=new FCKDomRange(FCK.EditorWindow);A.MoveToSelection();var B=this.GetState();if (B==-1) return;var C=A.CreateBookmark();var D=this._CssClassName;var E=new FCKDomRangeIterator(A);var F;while ((F=E.GetNextParagraph())){F.removeAttribute('align');if (D){var G=F.className.replace(FCKJustifyCommand._GetClassNameRegex(),'');if (B==0){if (G.length>0) G+=' ';F.className=G+D;}else if (G.length==0) FCKDomTools.RemoveAttribute(F,'class');}else{var H=F.style;if (B==0) H.textAlign=this.AlignValue;else{H.textAlign='';if (H.cssText.length==0) F.removeAttribute('style');}}};A.MoveToBookmark(C);A.Select();FCK.Focus();FCK.Events.FireEvent('OnSelectionChange');},GetState:function(){if (FCK.EditMode!=0||!FCK.EditorWindow) return -1;var A=new FCKElementPath(FCKSelection.GetBoundaryParentElement(true));var B=A.Block||A.BlockLimit;if (!B||B.nodeName.toLowerCase()=='body') return 0;var C;if (FCKBrowserInfo.IsIE) C=B.currentStyle.textAlign;else C=FCK.EditorWindow.getComputedStyle(B,'').getPropertyValue('text-align');C=C.replace(/(-moz-|-webkit-|start|auto)/i,'');if ((!C&&this.IsDefaultAlign)||C==this.AlignValue) return 1;return 0;}}; +var FCKIndentCommand=function(A,B){this.Name=A;this.Offset=B;this.IndentCSSProperty=FCKConfig.ContentLangDirection.IEquals('ltr')?'marginLeft':'marginRight';};FCKIndentCommand._InitIndentModeParameters=function(){if (FCKConfig.IndentClasses&&FCKConfig.IndentClasses.length>0){this._UseIndentClasses=true;this._IndentClassMap={};for (var i=0;i0?H+' ':'')+FCKConfig.IndentClasses[G-1];}else{var I=parseInt(E.style[this.IndentCSSProperty],10);if (isNaN(I)) I=0;I+=this.Offset;I=Math.max(I,0);I=Math.ceil(I/this.Offset)*this.Offset;E.style[this.IndentCSSProperty]=I?I+FCKConfig.IndentUnit:'';if (E.getAttribute('style')=='') E.removeAttribute('style');}}},_IndentList:function(A,B){var C=A.StartContainer;var D=A.EndContainer;while (C&&C.parentNode!=B) C=C.parentNode;while (D&&D.parentNode!=B) D=D.parentNode;if (!C||!D) return;var E=C;var F=[];var G=false;while (G==false){if (E==D) G=true;F.push(E);E=E.nextSibling;};if (F.length<1) return;var H=FCKDomTools.GetParents(B);for (var i=0;iN;i++) M[i].indent+=I;var O=FCKDomTools.ArrayToList(M);if (O) B.parentNode.replaceChild(O.listNode,B);FCKDomTools.ClearAllMarkers(L);}}; +var FCKBlockQuoteCommand=function(){};FCKBlockQuoteCommand.prototype={Execute:function(){FCKUndo.SaveUndoStep();var A=this.GetState();var B=new FCKDomRange(FCK.EditorWindow);B.MoveToSelection();var C=B.CreateBookmark();if (FCKBrowserInfo.IsIE){var D=B.GetBookmarkNode(C,true);var E=B.GetBookmarkNode(C,false);var F;if (D&&D.parentNode.nodeName.IEquals('blockquote')&&!D.previousSibling){F=D;while ((F=F.nextSibling)){if (FCKListsLib.BlockElements[F.nodeName.toLowerCase()]) FCKDomTools.MoveNode(D,F,true);}};if (E&&E.parentNode.nodeName.IEquals('blockquote')&&!E.previousSibling){F=E;while ((F=F.nextSibling)){if (FCKListsLib.BlockElements[F.nodeName.toLowerCase()]){if (F.firstChild==D) FCKDomTools.InsertAfterNode(D,E);else FCKDomTools.MoveNode(E,F,true);}}}};var G=new FCKDomRangeIterator(B);var H;if (A==0){G.EnforceRealBlocks=true;var I=[];while ((H=G.GetNextParagraph())) I.push(H);if (I.length<1){para=B.Window.document.createElement(FCKConfig.EnterMode.IEquals('p')?'p':'div');B.InsertNode(para);para.appendChild(B.Window.document.createTextNode('\ufeff'));B.MoveToBookmark(C);B.MoveToNodeContents(para);B.Collapse(true);C=B.CreateBookmark();I.push(para);};var J=I[0].parentNode;var K=[];for (var i=0;i0){H=I.shift();while (H.parentNode!=J) H=H.parentNode;if (H!=L) K.push(H);L=H;};while (K.length>0){H=K.shift();if (H.nodeName.IEquals('blockquote')){var M=H.ownerDocument.createDocumentFragment();while (H.firstChild){M.appendChild(H.removeChild(H.firstChild));I.push(M.lastChild);};H.parentNode.replaceChild(M,H);}else I.push(H);};var N=B.Window.document.createElement('blockquote');J.insertBefore(N,I[0]);while (I.length>0){H=I.shift();N.appendChild(H);}}else if (A==1){var O=[];while ((H=G.GetNextParagraph())){var P=null;var Q=null;while (H.parentNode){if (H.parentNode.nodeName.IEquals('blockquote')){P=H.parentNode;Q=H;break;};H=H.parentNode;};if (P&&Q) O.push(Q);};var R=[];while (O.length>0){var S=O.shift();var N=S.parentNode;if (S==S.parentNode.firstChild){N.parentNode.insertBefore(N.removeChild(S),N);if (!N.firstChild) N.parentNode.removeChild(N);}else if (S==S.parentNode.lastChild){N.parentNode.insertBefore(N.removeChild(S),N.nextSibling);if (!N.firstChild) N.parentNode.removeChild(N);}else FCKDomTools.BreakParent(S,S.parentNode,B);R.push(S);};if (FCKConfig.EnterMode.IEquals('br')){while (R.length){var S=R.shift();var W=true;if (S.nodeName.IEquals('div')){var M=S.ownerDocument.createDocumentFragment();var Y=W&&S.previousSibling&&!FCKListsLib.BlockBoundaries[S.previousSibling.nodeName.toLowerCase()];if (W&&Y) M.appendChild(S.ownerDocument.createElement('br'));var Z=S.nextSibling&&!FCKListsLib.BlockBoundaries[S.nextSibling.nodeName.toLowerCase()];while (S.firstChild) M.appendChild(S.removeChild(S.firstChild));if (Z) M.appendChild(S.ownerDocument.createElement('br'));S.parentNode.replaceChild(M,S);W=false;}}}};B.MoveToBookmark(C);B.Select();FCK.Focus();FCK.Events.FireEvent('OnSelectionChange');},GetState:function(){if (FCK.EditMode!=0||!FCK.EditorWindow) return -1;var A=new FCKElementPath(FCKSelection.GetBoundaryParentElement(true));var B=A.Block||A.BlockLimit;if (!B||B.nodeName.toLowerCase()=='body') return 0;for (var i=0;i';B.open();B.write(''+G+'<\/head><\/body><\/html>');B.close();FCKTools.AddEventListenerEx(F,'focus',FCKPanel_Window_OnFocus,this);FCKTools.AddEventListenerEx(F,'blur',FCKPanel_Window_OnBlur,this);};B.dir=FCKLang.Dir;FCKTools.AddEventListener(B,'contextmenu',FCKTools.CancelEvent);this.MainNode=B.body.appendChild(B.createElement('DIV'));this.MainNode.style.cssFloat=this.IsRTL?'right':'left';};FCKPanel.prototype.AppendStyleSheet=function(A){FCKTools.AppendStyleSheet(this.Document,A);};FCKPanel.prototype.Preload=function(x,y,A){if (this._Popup) this._Popup.show(x,y,0,0,A);};FCKPanel.prototype.Show=function(x,y,A,B,C){var D;var E=this.MainNode;if (this._Popup){this._Popup.show(x,y,0,0,A);FCKDomTools.SetElementStyles(E,{B:B?B+'px':'',C:C?C+'px':''});D=E.offsetWidth;if (this.IsRTL){if (this.IsContextMenu) x=x-D+1;else if (A) x=(x*-1)+A.offsetWidth-D;};this._Popup.show(x,y,D,E.offsetHeight,A);if (this.OnHide){if (this._Timer) CheckPopupOnHide.call(this,true);this._Timer=FCKTools.SetInterval(CheckPopupOnHide,100,this);}}else{if (typeof(FCK.ToolbarSet.CurrentInstance.FocusManager)!='undefined') FCK.ToolbarSet.CurrentInstance.FocusManager.Lock();if (this.ParentPanel){this.ParentPanel.Lock();FCKPanel_Window_OnBlur(null,this.ParentPanel);};if (FCKPanel._OpenedPanel) FCKPanel._OpenedPanel.Hide();FCKDomTools.SetElementStyles(E,{B:B?B+'px':'',C:C?C+'px':''});D=E.offsetWidth;if (!B) this._IFrame.width=1;if (!C) this._IFrame.height=1;D=E.offsetWidth||E.firstChild.offsetWidth;var F=FCKTools.GetDocumentPosition(this._Window,A.nodeType==9?(FCKTools.IsStrictMode(A)?A.documentElement:A.body):A);var G=FCKDomTools.GetPositionedAncestor(FCKTools.GetElementWindow(this._IFrame),this._IFrame.parentNode);if (G){var H=FCKTools.GetDocumentPosition(FCKTools.GetElementWindow(G),G);F.x-=H.x;F.y-=H.y;};if (this.IsRTL&&!this.IsContextMenu) x=(x*-1);x+=F.x;y+=F.y;if (this.IsRTL){if (this.IsContextMenu) x=x-D+1;else if (A) x=x+A.offsetWidth-D;}else{var I=FCKTools.GetViewPaneSize(this._Window);var J=FCKTools.GetScrollPosition(this._Window);var K=I.Height+J.Y;var L=I.Width+J.X;if ((x+D)>L) x-=x+D-L;if ((y+E.offsetHeight)>K) y-=y+E.offsetHeight-K;};if (x<0) x=0;FCKDomTools.SetElementStyles(this._IFrame,{left:x+'px',top:y+'px'});var M=D;var N=E.offsetHeight;this._IFrame.width=M;this._IFrame.height=N;this._IFrame.contentWindow.focus();FCKPanel._OpenedPanel=this;};this._IsOpened=true;FCKTools.RunFunction(this.OnShow,this);};FCKPanel.prototype.Hide=function(A){if (this._Popup) this._Popup.hide();else{if (!this._IsOpened||this._LockCounter>0) return;if (typeof(FCKFocusManager)!='undefined') FCKFocusManager.Unlock();this._IFrame.width=this._IFrame.height=0;this._IsOpened=false;if (this.ParentPanel) this.ParentPanel.Unlock();if (!A) FCKTools.RunFunction(this.OnHide,this);}};FCKPanel.prototype.CheckIsOpened=function(){if (this._Popup) return this._Popup.isOpen;else return this._IsOpened;};FCKPanel.prototype.CreateChildPanel=function(){var A=this._Popup?FCKTools.GetDocumentWindow(this.Document):this._Window;var B=new FCKPanel(A);B.ParentPanel=this;return B;};FCKPanel.prototype.Lock=function(){this._LockCounter++;};FCKPanel.prototype.Unlock=function(){if (--this._LockCounter==0&&!this.HasFocus) this.Hide();};function FCKPanel_Window_OnFocus(e,A){A.HasFocus=true;};function FCKPanel_Window_OnBlur(e,A){A.HasFocus=false;if (A._LockCounter==0) FCKTools.RunFunction(A.Hide,A);};function CheckPopupOnHide(A){if (A||!this._Popup.isOpen){window.clearInterval(this._Timer);this._Timer=null;FCKTools.RunFunction(this.OnHide,this);}};function FCKPanel_Cleanup(){this._Popup=null;this._Window=null;this.Document=null;this.MainNode=null;}; +var FCKIcon=function(A){var B=A?typeof(A):'undefined';switch (B){case 'number':this.Path=FCKConfig.SkinPath+'fck_strip.gif';this.Size=16;this.Position=A;break;case 'undefined':this.Path=FCK_SPACER_PATH;break;case 'string':this.Path=A;break;default:this.Path=A[0];this.Size=A[1];this.Position=A[2];}};FCKIcon.prototype.CreateIconElement=function(A){var B,eIconImage;if (this.Position){var C='-'+((this.Position-1)*this.Size)+'px';if (FCKBrowserInfo.IsIE){B=A.createElement('DIV');eIconImage=B.appendChild(A.createElement('IMG'));eIconImage.src=this.Path;eIconImage.style.top=C;}else{B=A.createElement('IMG');B.src=FCK_SPACER_PATH;B.style.backgroundPosition='0px '+C;B.style.backgroundImage='url("'+this.Path+'")';}}else{if (FCKBrowserInfo.IsIE){B=A.createElement('DIV');eIconImage=B.appendChild(A.createElement('IMG'));eIconImage.src=this.Path?this.Path:FCK_SPACER_PATH;}else{B=A.createElement('IMG');B.src=this.Path?this.Path:FCK_SPACER_PATH;}};B.className='TB_Button_Image';return B;} +var FCKToolbarButtonUI=function(A,B,C,D,E,F){this.Name=A;this.Label=B||A;this.Tooltip=C||this.Label;this.Style=E||0;this.State=F||0;this.Icon=new FCKIcon(D);if (FCK.IECleanup) FCK.IECleanup.AddItem(this,FCKToolbarButtonUI_Cleanup);};FCKToolbarButtonUI.prototype._CreatePaddingElement=function(A){var B=A.createElement('IMG');B.className='TB_Button_Padding';B.src=FCK_SPACER_PATH;return B;};FCKToolbarButtonUI.prototype.Create=function(A){var B=FCKTools.GetElementDocument(A);var C=this.MainElement=B.createElement('DIV');C.title=this.Tooltip;if (FCKBrowserInfo.IsGecko) C.onmousedown=FCKTools.CancelEvent;FCKTools.AddEventListenerEx(C,'mouseover',FCKToolbarButtonUI_OnMouseOver,this);FCKTools.AddEventListenerEx(C,'mouseout',FCKToolbarButtonUI_OnMouseOut,this);FCKTools.AddEventListenerEx(C,'click',FCKToolbarButtonUI_OnClick,this);this.ChangeState(this.State,true);if (this.Style==0&&!this.ShowArrow){C.appendChild(this.Icon.CreateIconElement(B));}else{var D=C.appendChild(B.createElement('TABLE'));D.cellPadding=0;D.cellSpacing=0;var E=D.insertRow(-1);var F=E.insertCell(-1);if (this.Style==0||this.Style==2) F.appendChild(this.Icon.CreateIconElement(B));else F.appendChild(this._CreatePaddingElement(B));if (this.Style==1||this.Style==2){F=E.insertCell(-1);F.className='TB_Button_Text';F.noWrap=true;F.appendChild(B.createTextNode(this.Label));};if (this.ShowArrow){if (this.Style!=0){E.insertCell(-1).appendChild(this._CreatePaddingElement(B));};F=E.insertCell(-1);var G=F.appendChild(B.createElement('IMG'));G.src=FCKConfig.SkinPath+'images/toolbar.buttonarrow.gif';G.width=5;G.height=3;};F=E.insertCell(-1);F.appendChild(this._CreatePaddingElement(B));};A.appendChild(C);};FCKToolbarButtonUI.prototype.ChangeState=function(A,B){if (!B&&this.State==A) return;var e=this.MainElement;if (!e) return;switch (parseInt(A,10)){case 0:e.className='TB_Button_Off';break;case 1:e.className='TB_Button_On';break;case -1:e.className='TB_Button_Disabled';break;};this.State=A;};function FCKToolbarButtonUI_OnMouseOver(A,B){if (B.State==0) this.className='TB_Button_Off_Over';else if (B.State==1) this.className='TB_Button_On_Over';};function FCKToolbarButtonUI_OnMouseOut(A,B){if (B.State==0) this.className='TB_Button_Off';else if (B.State==1) this.className='TB_Button_On';};function FCKToolbarButtonUI_OnClick(A,B){if (B.OnClick&&B.State!=-1) B.OnClick(B);};function FCKToolbarButtonUI_Cleanup(){this.MainElement=null;}; +var FCKToolbarButton=function(A,B,C,D,E,F,G){this.CommandName=A;this.Label=B;this.Tooltip=C;this.Style=D;this.SourceView=E?true:false;this.ContextSensitive=F?true:false;if (G==null) this.IconPath=FCKConfig.SkinPath+'toolbar/'+A.toLowerCase()+'.gif';else if (typeof(G)=='number') this.IconPath=[FCKConfig.SkinPath+'fck_strip.gif',16,G];else this.IconPath=G;};FCKToolbarButton.prototype.Create=function(A){this._UIButton=new FCKToolbarButtonUI(this.CommandName,this.Label,this.Tooltip,this.IconPath,this.Style);this._UIButton.OnClick=this.Click;this._UIButton._ToolbarButton=this;this._UIButton.Create(A);};FCKToolbarButton.prototype.RefreshState=function(){var A=FCK.ToolbarSet.CurrentInstance.Commands.GetCommand(this.CommandName).GetState();if (A==this._UIButton.State) return;this._UIButton.ChangeState(A);};FCKToolbarButton.prototype.Click=function(){var A=this._ToolbarButton||this;FCK.ToolbarSet.CurrentInstance.Commands.GetCommand(A.CommandName).Execute();};FCKToolbarButton.prototype.Enable=function(){this.RefreshState();};FCKToolbarButton.prototype.Disable=function(){this._UIButton.ChangeState(-1);} +var FCKSpecialCombo=function(A,B,C,D,E){this.FieldWidth=B||100;this.PanelWidth=C||150;this.PanelMaxHeight=D||150;this.Label=' ';this.Caption=A;this.Tooltip=A;this.Style=2;this.Enabled=true;this.Items={};this._Panel=new FCKPanel(E||window);this._Panel.AppendStyleSheet(FCKConfig.SkinPath+'fck_editor.css');this._PanelBox=this._Panel.MainNode.appendChild(this._Panel.Document.createElement('DIV'));this._PanelBox.className='SC_Panel';this._PanelBox.style.width=this.PanelWidth+'px';this._PanelBox.innerHTML='
    ';this._ItemsHolderEl=this._PanelBox.getElementsByTagName('TD')[0];if (FCK.IECleanup) FCK.IECleanup.AddItem(this,FCKSpecialCombo_Cleanup);};function FCKSpecialCombo_ItemOnMouseOver(){this.className+=' SC_ItemOver';};function FCKSpecialCombo_ItemOnMouseOut(){this.className=this.originalClass;};function FCKSpecialCombo_ItemOnClick(A,B,C){this.className=this.originalClass;B._Panel.Hide();B.SetLabel(this.FCKItemLabel);if (typeof(B.OnSelect)=='function') B.OnSelect(C,this);};FCKSpecialCombo.prototype.ClearItems=function (){if (this.Items) this.Items={};var A=this._ItemsHolderEl;while (A.firstChild) A.removeChild(A.firstChild);};FCKSpecialCombo.prototype.AddItem=function(A,B,C,D){var E=this._ItemsHolderEl.appendChild(this._Panel.Document.createElement('DIV'));E.className=E.originalClass='SC_Item';E.innerHTML=B;E.FCKItemLabel=C||A;E.Selected=false;if (FCKBrowserInfo.IsIE) E.style.width='100%';if (D) E.style.backgroundColor=D;FCKTools.AddEventListenerEx(E,'mouseover',FCKSpecialCombo_ItemOnMouseOver);FCKTools.AddEventListenerEx(E,'mouseout',FCKSpecialCombo_ItemOnMouseOut);FCKTools.AddEventListenerEx(E,'click',FCKSpecialCombo_ItemOnClick,[this,A]);this.Items[A.toString().toLowerCase()]=E;return E;};FCKSpecialCombo.prototype.SelectItem=function(A){if (typeof A=='string') A=this.Items[A.toString().toLowerCase()];if (A){A.className=A.originalClass='SC_ItemSelected';A.Selected=true;}};FCKSpecialCombo.prototype.SelectItemByLabel=function(A,B){for (var C in this.Items){var D=this.Items[C];if (D.FCKItemLabel==A){D.className=D.originalClass='SC_ItemSelected';D.Selected=true;if (B) this.SetLabel(A);}}};FCKSpecialCombo.prototype.DeselectAll=function(A){for (var i in this.Items){if (!this.Items[i]) continue;this.Items[i].className=this.Items[i].originalClass='SC_Item';this.Items[i].Selected=false;};if (A) this.SetLabel('');};FCKSpecialCombo.prototype.SetLabelById=function(A){A=A?A.toString().toLowerCase():'';var B=this.Items[A];this.SetLabel(B?B.FCKItemLabel:'');};FCKSpecialCombo.prototype.SetLabel=function(A){A=(!A||A.length==0)?' ':A;if (A==this.Label) return;this.Label=A;var B=this._LabelEl;if (B){B.innerHTML=A;FCKTools.DisableSelection(B);}};FCKSpecialCombo.prototype.SetEnabled=function(A){this.Enabled=A;if (this._OuterTable) this._OuterTable.className=A?'':'SC_FieldDisabled';};FCKSpecialCombo.prototype.Create=function(A){var B=FCKTools.GetElementDocument(A);var C=this._OuterTable=A.appendChild(B.createElement('TABLE'));C.cellPadding=0;C.cellSpacing=0;C.insertRow(-1);var D;var E;switch (this.Style){case 0:D='TB_ButtonType_Icon';E=false;break;case 1:D='TB_ButtonType_Text';E=false;break;case 2:E=true;break;};if (this.Caption&&this.Caption.length>0&&E){var F=C.rows[0].insertCell(-1);F.innerHTML=this.Caption;F.className='SC_FieldCaption';};var G=FCKTools.AppendElement(C.rows[0].insertCell(-1),'div');if (E){G.className='SC_Field';G.style.width=this.FieldWidth+'px';G.innerHTML='
     
    ';this._LabelEl=G.getElementsByTagName('label')[0];this._LabelEl.innerHTML=this.Label;}else{G.className='TB_Button_Off';G.innerHTML='
    '+this.Caption+'
    ';};FCKTools.AddEventListenerEx(G,'mouseover',FCKSpecialCombo_OnMouseOver,this);FCKTools.AddEventListenerEx(G,'mouseout',FCKSpecialCombo_OnMouseOut,this);FCKTools.AddEventListenerEx(G,'click',FCKSpecialCombo_OnClick,this);FCKTools.DisableSelection(this._Panel.Document.body);};function FCKSpecialCombo_Cleanup(){this._LabelEl=null;this._OuterTable=null;this._ItemsHolderEl=null;this._PanelBox=null;if (this.Items){for (var A in this.Items) this.Items[A]=null;}};function FCKSpecialCombo_OnMouseOver(A,B){if (B.Enabled){switch (B.Style){case 0:this.className='TB_Button_On_Over';break;case 1:this.className='TB_Button_On_Over';break;case 2:this.className='SC_Field SC_FieldOver';break;}}};function FCKSpecialCombo_OnMouseOut(A,B){switch (B.Style){case 0:this.className='TB_Button_Off';break;case 1:this.className='TB_Button_Off';break;case 2:this.className='SC_Field';break;}};function FCKSpecialCombo_OnClick(e,A){if (A.Enabled){var B=A._Panel;var C=A._PanelBox;var D=A._ItemsHolderEl;var E=A.PanelMaxHeight;if (A.OnBeforeClick) A.OnBeforeClick(A);if (FCKBrowserInfo.IsIE) B.Preload(0,this.offsetHeight,this);if (D.offsetHeight>E) C.style.height=E+'px';else C.style.height='';B.Show(0,this.offsetHeight,this);}}; +var FCKToolbarSpecialCombo=function(){this.SourceView=false;this.ContextSensitive=true;};FCKToolbarSpecialCombo.prototype.DefaultLabel='';function FCKToolbarSpecialCombo_OnSelect(A,B){FCK.ToolbarSet.CurrentInstance.Commands.GetCommand(this.CommandName).Execute(A,B);};FCKToolbarSpecialCombo.prototype.Create=function(A){this._Combo=new FCKSpecialCombo(this.GetLabel(),this.FieldWidth,this.PanelWidth,this.PanelMaxHeight,FCKBrowserInfo.IsIE?window:FCKTools.GetElementWindow(A).parent);this._Combo.Tooltip=this.Tooltip;this._Combo.Style=this.Style;this.CreateItems(this._Combo);this._Combo.Create(A);this._Combo.CommandName=this.CommandName;this._Combo.OnSelect=FCKToolbarSpecialCombo_OnSelect;};function FCKToolbarSpecialCombo_RefreshActiveItems(A,B){A.DeselectAll();A.SelectItem(B);A.SetLabelById(B);};FCKToolbarSpecialCombo.prototype.RefreshState=function(){var A;var B=FCK.ToolbarSet.CurrentInstance.Commands.GetCommand(this.CommandName).GetState();if (B!=-1){A=1;if (this.RefreshActiveItems) this.RefreshActiveItems(this._Combo,B);else{if (this._LastValue!==B){this._LastValue=B;if (!B||B.length==0){this._Combo.DeselectAll();this._Combo.SetLabel(this.DefaultLabel);}else FCKToolbarSpecialCombo_RefreshActiveItems(this._Combo,B);}}}else A=-1;if (A==this.State) return;if (A==-1){this._Combo.DeselectAll();this._Combo.SetLabel('');};this.State=A;this._Combo.SetEnabled(A!=-1);};FCKToolbarSpecialCombo.prototype.Enable=function(){this.RefreshState();};FCKToolbarSpecialCombo.prototype.Disable=function(){this.State=-1;this._Combo.DeselectAll();this._Combo.SetLabel('');this._Combo.SetEnabled(false);}; +var FCKToolbarStyleCombo=function(A,B){if (A===false) return;this.CommandName='Style';this.Label=this.GetLabel();this.Tooltip=A?A:this.Label;this.Style=B?B:2;this.DefaultLabel=FCKConfig.DefaultStyleLabel||'';};FCKToolbarStyleCombo.prototype=new FCKToolbarSpecialCombo;FCKToolbarStyleCombo.prototype.GetLabel=function(){return FCKLang.Style;};FCKToolbarStyleCombo.prototype.GetStyles=function(){var A={};var B=FCK.ToolbarSet.CurrentInstance.Styles.GetStyles();for (var C in B){var D=B[C];if (!D.IsCore) A[C]=D;};return A;};FCKToolbarStyleCombo.prototype.CreateItems=function(A){var B=A._Panel.Document;FCKTools.AppendStyleSheet(B,FCKConfig.ToolbarComboPreviewCSS);FCKTools.AppendStyleString(B,FCKConfig.EditorAreaStyles);B.body.className+=' ForceBaseFont';FCKConfig.ApplyBodyAttributes(B.body);var C=this.GetStyles();for (var D in C){var E=C[D];var F=E.GetType()==2?D:FCKToolbarStyleCombo_BuildPreview(E,E.Label||D);var G=A.AddItem(D,F);G.Style=E;};A.OnBeforeClick=this.StyleCombo_OnBeforeClick;};FCKToolbarStyleCombo.prototype.RefreshActiveItems=function(A){var B=FCK.ToolbarSet.CurrentInstance.Selection.GetBoundaryParentElement(true);if (B){var C=new FCKElementPath(B);var D=C.Elements;for (var e=0;e');var E=A.Element;if (E=='bdo') E='span';D=['<',E];var F=A._StyleDesc.Attributes;if (F){for (var G in F){D.push(' ',G,'="',A.GetFinalAttributeValue(G),'"');}};if (A._GetStyleText().length>0) D.push(' style="',A.GetFinalStyleValue(),'"');D.push('>',B,'');if (C==0) D.push('');return D.join('');} +var FCKToolbarFontFormatCombo=function(A,B){if (A===false) return;this.CommandName='FontFormat';this.Label=this.GetLabel();this.Tooltip=A?A:this.Label;this.Style=B?B:2;this.NormalLabel='Normal';this.PanelWidth=190;this.DefaultLabel=FCKConfig.DefaultFontFormatLabel||'';};FCKToolbarFontFormatCombo.prototype=new FCKToolbarStyleCombo(false);FCKToolbarFontFormatCombo.prototype.GetLabel=function(){return FCKLang.FontFormat;};FCKToolbarFontFormatCombo.prototype.GetStyles=function(){var A={};var B=FCKLang['FontFormats'].split(';');var C={p:B[0],pre:B[1],address:B[2],h1:B[3],h2:B[4],h3:B[5],h4:B[6],h5:B[7],h6:B[8],div:B[9]||(B[0]+' (DIV)')};var D=FCKConfig.FontFormats.split(';');for (var i=0;i';G.open();G.write(''+H+''+document.getElementById('xToolbarSpace').innerHTML+'');G.close();FCKTools.AddEventListener(G,'contextmenu',FCKTools.CancelEvent);FCKTools.AppendStyleSheet(G,FCKConfig.SkinPath+'fck_editor.css');B=D.__FCKToolbarSet=new FCKToolbarSet(G);B._IFrame=F;if (FCK.IECleanup) FCK.IECleanup.AddItem(D,FCKToolbarSet_Target_Cleanup);};B.CurrentInstance=FCK;FCK.AttachToOnSelectionChange(B.RefreshItemsState);return B;};function FCK_OnBlur(A){var B=A.ToolbarSet;if (B.CurrentInstance==A) B.Disable();};function FCK_OnFocus(A){var B=A.ToolbarSet;var C=A||FCK;B.CurrentInstance.FocusManager.RemoveWindow(B._IFrame.contentWindow);B.CurrentInstance=C;C.FocusManager.AddWindow(B._IFrame.contentWindow,true);B.Enable();};function FCKToolbarSet_Cleanup(){this._TargetElement=null;this._IFrame=null;};function FCKToolbarSet_Target_Cleanup(){this.__FCKToolbarSet=null;};var FCKToolbarSet=function(A){this._Document=A;this._TargetElement=A.getElementById('xToolbar');var B=A.getElementById('xExpandHandle');var C=A.getElementById('xCollapseHandle');B.title=FCKLang.ToolbarExpand;FCKTools.AddEventListener(B,'click',FCKToolbarSet_Expand_OnClick);C.title=FCKLang.ToolbarCollapse;FCKTools.AddEventListener(C,'click',FCKToolbarSet_Collapse_OnClick);if (!FCKConfig.ToolbarCanCollapse||FCKConfig.ToolbarStartExpanded) this.Expand();else this.Collapse();C.style.display=FCKConfig.ToolbarCanCollapse?'':'none';if (FCKConfig.ToolbarCanCollapse) C.style.display='';else A.getElementById('xTBLeftBorder').style.display='';this.Toolbars=[];this.IsLoaded=false;if (FCK.IECleanup) FCK.IECleanup.AddItem(this,FCKToolbarSet_Cleanup);};function FCKToolbarSet_Expand_OnClick(){FCK.ToolbarSet.Expand();};function FCKToolbarSet_Collapse_OnClick(){FCK.ToolbarSet.Collapse();};FCKToolbarSet.prototype.Expand=function(){this._ChangeVisibility(false);};FCKToolbarSet.prototype.Collapse=function(){this._ChangeVisibility(true);};FCKToolbarSet.prototype._ChangeVisibility=function(A){this._Document.getElementById('xCollapsed').style.display=A?'':'none';this._Document.getElementById('xExpanded').style.display=A?'none':'';if (FCKBrowserInfo.IsGecko){FCKTools.RunFunction(window.onresize);}};FCKToolbarSet.prototype.Load=function(A){this.Name=A;this.Items=[];this.ItemsWysiwygOnly=[];this.ItemsContextSensitive=[];this._TargetElement.innerHTML='';var B=FCKConfig.ToolbarSets[A];if (!B){alert(FCKLang.UnknownToolbarSet.replace(/%1/g,A));return;};this.Toolbars=[];for (var x=0;x0) A.deleteRow(0);}};FCKMenuBlock.prototype.Create=function(A){if (!this._ItemsTable){if (FCK.IECleanup) FCK.IECleanup.AddItem(this,FCKMenuBlock_Cleanup);this._Window=FCKTools.GetElementWindow(A);var B=FCKTools.GetElementDocument(A);var C=A.appendChild(B.createElement('table'));C.cellPadding=0;C.cellSpacing=0;FCKTools.DisableSelection(C);var D=C.insertRow(-1).insertCell(-1);D.className='MN_Menu';var E=this._ItemsTable=D.appendChild(B.createElement('table'));E.cellPadding=0;E.cellSpacing=0;};for (var i=0;i0&&F.href.length==0);if (G) return;menu.AddSeparator();if (E) menu.AddItem('Link',FCKLang.EditLink,34);menu.AddItem('Unlink',FCKLang.RemoveLink,35);}}};case 'Image':return {AddItems:function(menu,tag,tagName){if (tagName=='IMG'&&!tag.getAttribute('_fckfakelement')){menu.AddSeparator();menu.AddItem('Image',FCKLang.ImageProperties,37);}}};case 'Anchor':return {AddItems:function(menu,tag,tagName){var F=FCKSelection.MoveToAncestorNode('A');var G=(F&&F.name.length>0);if (G||(tagName=='IMG'&&tag.getAttribute('_fckanchor'))){menu.AddSeparator();menu.AddItem('Anchor',FCKLang.AnchorProp,36);menu.AddItem('AnchorDelete',FCKLang.AnchorDelete);}}};case 'Flash':return {AddItems:function(menu,tag,tagName){if (tagName=='IMG'&&tag.getAttribute('_fckflash')){menu.AddSeparator();menu.AddItem('Flash',FCKLang.FlashProperties,38);}}};case 'Form':return {AddItems:function(menu,tag,tagName){if (FCKSelection.HasAncestorNode('FORM')){menu.AddSeparator();menu.AddItem('Form',FCKLang.FormProp,48);}}};case 'Checkbox':return {AddItems:function(menu,tag,tagName){if (tagName=='INPUT'&&tag.type=='checkbox'){menu.AddSeparator();menu.AddItem('Checkbox',FCKLang.CheckboxProp,49);}}};case 'Radio':return {AddItems:function(menu,tag,tagName){if (tagName=='INPUT'&&tag.type=='radio'){menu.AddSeparator();menu.AddItem('Radio',FCKLang.RadioButtonProp,50);}}};case 'TextField':return {AddItems:function(menu,tag,tagName){if (tagName=='INPUT'&&(tag.type=='text'||tag.type=='password')){menu.AddSeparator();menu.AddItem('TextField',FCKLang.TextFieldProp,51);}}};case 'HiddenField':return {AddItems:function(menu,tag,tagName){if (tagName=='IMG'&&tag.getAttribute('_fckinputhidden')){menu.AddSeparator();menu.AddItem('HiddenField',FCKLang.HiddenFieldProp,56);}}};case 'ImageButton':return {AddItems:function(menu,tag,tagName){if (tagName=='INPUT'&&tag.type=='image'){menu.AddSeparator();menu.AddItem('ImageButton',FCKLang.ImageButtonProp,55);}}};case 'Button':return {AddItems:function(menu,tag,tagName){if (tagName=='INPUT'&&(tag.type=='button'||tag.type=='submit'||tag.type=='reset')){menu.AddSeparator();menu.AddItem('Button',FCKLang.ButtonProp,54);}}};case 'Select':return {AddItems:function(menu,tag,tagName){if (tagName=='SELECT'){menu.AddSeparator();menu.AddItem('Select',FCKLang.SelectionFieldProp,53);}}};case 'Textarea':return {AddItems:function(menu,tag,tagName){if (tagName=='TEXTAREA'){menu.AddSeparator();menu.AddItem('Textarea',FCKLang.TextareaProp,52);}}};case 'BulletedList':return {AddItems:function(menu,tag,tagName){if (FCKSelection.HasAncestorNode('UL')){menu.AddSeparator();menu.AddItem('BulletedList',FCKLang.BulletedListProp,27);}}};case 'NumberedList':return {AddItems:function(menu,tag,tagName){if (FCKSelection.HasAncestorNode('OL')){menu.AddSeparator();menu.AddItem('NumberedList',FCKLang.NumberedListProp,26);}}};};return null;};function FCK_ContextMenu_OnBeforeOpen(){FCK.Events.FireEvent('OnSelectionChange');var A,sTagName;if ((A=FCKSelection.GetSelectedElement())) sTagName=A.tagName;var B=FCK.ContextMenu._InnerContextMenu;B.RemoveAllItems();var C=FCK.ContextMenu.Listeners;for (var i=0;i0){var A;if (this.AvailableLangs.IndexOf(FCKLanguageManager.ActiveLanguage.Code)>=0) A=FCKLanguageManager.ActiveLanguage.Code;else A=this.AvailableLangs[0];LoadScript(this.Path+'lang/'+A+'.js');};LoadScript(this.Path+'fckplugin.js');} +var FCKPlugins=FCK.Plugins={};FCKPlugins.ItemsCount=0;FCKPlugins.Items={};FCKPlugins.Load=function(){var A=FCKPlugins.Items;for (var i=0;i", +DlgInfoTab : "Info", +DlgAlertUrl : "Voeg asseblief die URL in", + +// General Dialogs Labels +DlgGenNotSet : "", +DlgGenId : "Id", +DlgGenLangDir : "Taal rigting", +DlgGenLangDirLtr : "Links na regs (LTR)", +DlgGenLangDirRtl : "Regs na links (RTL)", +DlgGenLangCode : "Taal kode", +DlgGenAccessKey : "Toegang sleutel", +DlgGenName : "Naam", +DlgGenTabIndex : "Tab Index", +DlgGenLongDescr : "Lang beskreiwing URL", +DlgGenClass : "Skakel Tiepe", +DlgGenTitle : "Voorbeveelings Titel", +DlgGenContType : "Voorbeveelings inhoud soort", +DlgGenLinkCharset : "Geskakelde voorbeeld karakterstel", +DlgGenStyle : "Styl", + +// Image Dialog +DlgImgTitle : "Beeld eienskappe", +DlgImgInfoTab : "Beeld informasie", +DlgImgBtnUpload : "Stuur dit na die Server", +DlgImgURL : "URL", +DlgImgUpload : "Uplaai", +DlgImgAlt : "Alternatiewe beskrywing", +DlgImgWidth : "Weidte", +DlgImgHeight : "Hoogde", +DlgImgLockRatio : "Behou preporsie", +DlgBtnResetSize : "Herstel groote", +DlgImgBorder : "Kant", +DlgImgHSpace : "HSpasie", +DlgImgVSpace : "VSpasie", +DlgImgAlign : "Paradeer", +DlgImgAlignLeft : "Links", +DlgImgAlignAbsBottom: "Abs Onder", +DlgImgAlignAbsMiddle: "Abs Middel", +DlgImgAlignBaseline : "Baseline", +DlgImgAlignBottom : "Onder", +DlgImgAlignMiddle : "Middel", +DlgImgAlignRight : "Regs", +DlgImgAlignTextTop : "Text Bo", +DlgImgAlignTop : "Bo", +DlgImgPreview : "Voorskou", +DlgImgAlertUrl : "Voeg asseblief Beeld URL in.", +DlgImgLinkTab : "Skakel", + +// Flash Dialog +DlgFlashTitle : "Flash eienskappe", +DlgFlashChkPlay : "Automaties Speel", +DlgFlashChkLoop : "Herhaling", +DlgFlashChkMenu : "Laat Flash Menu toe", +DlgFlashScale : "Scale", +DlgFlashScaleAll : "Wys alles", +DlgFlashScaleNoBorder : "Geen kante", +DlgFlashScaleFit : "Presiese pas", + +// Link Dialog +DlgLnkWindowTitle : "Skakel", +DlgLnkInfoTab : "Skakel informasie", +DlgLnkTargetTab : "Mikpunt", + +DlgLnkType : "Skakel soort", +DlgLnkTypeURL : "URL", +DlgLnkTypeAnchor : "Skakel na plekhouers in text", +DlgLnkTypeEMail : "E-Mail", +DlgLnkProto : "Protokol", +DlgLnkProtoOther : "", +DlgLnkURL : "URL", +DlgLnkAnchorSel : "Kies 'n plekhouer", +DlgLnkAnchorByName : "Volgens plekhouer naam", +DlgLnkAnchorById : "Volgens element Id", +DlgLnkNoAnchors : "(Geen plekhouers beskikbaar in dokument}", +DlgLnkEMail : "E-Mail Adres", +DlgLnkEMailSubject : "Boodskap Opskrif", +DlgLnkEMailBody : "Boodskap Inhoud", +DlgLnkUpload : "Oplaai", +DlgLnkBtnUpload : "Stuur na Server", + +DlgLnkTarget : "Mikpunt", +DlgLnkTargetFrame : "", +DlgLnkTargetPopup : "", +DlgLnkTargetBlank : "Nuwe Venster (_blank)", +DlgLnkTargetParent : "Vorige Venster (_parent)", +DlgLnkTargetSelf : "Selfde Venster (_self)", +DlgLnkTargetTop : "Boonste Venster (_top)", +DlgLnkTargetFrameName : "Mikpunt Venster Naam", +DlgLnkPopWinName : "Popup Venster Naam", +DlgLnkPopWinFeat : "Popup Venster Geaartheid", +DlgLnkPopResize : "Verstelbare Groote", +DlgLnkPopLocation : "Adres Balk", +DlgLnkPopMenu : "Menu Balk", +DlgLnkPopScroll : "Gleibalkstuk", +DlgLnkPopStatus : "Status Balk", +DlgLnkPopToolbar : "Gereedskap Balk", +DlgLnkPopFullScrn : "Voll Skerm (IE)", +DlgLnkPopDependent : "Afhanklik (Netscape)", +DlgLnkPopWidth : "Weite", +DlgLnkPopHeight : "Hoogde", +DlgLnkPopLeft : "Links Posisie", +DlgLnkPopTop : "Bo Posisie", + +DlnLnkMsgNoUrl : "Voeg asseblief die URL in", +DlnLnkMsgNoEMail : "Voeg asseblief die e-mail adres in", +DlnLnkMsgNoAnchor : "Kies asseblief 'n plekhouer", +DlnLnkMsgInvPopName : "Die popup naam moet begin met alphabetiese karakters sonder spasies.", + +// Color Dialog +DlgColorTitle : "Kies Kleur", +DlgColorBtnClear : "Maak skoon", +DlgColorHighlight : "Highlight", +DlgColorSelected : "Geselekteer", + +// Smiley Dialog +DlgSmileyTitle : "Voeg Smiley by", + +// Special Character Dialog +DlgSpecialCharTitle : "Kies spesiale karakter", + +// Table Dialog +DlgTableTitle : "Tabel eienskappe", +DlgTableRows : "Reie", +DlgTableColumns : "Kolome", +DlgTableBorder : "Kant groote", +DlgTableAlign : "Parideering", +DlgTableAlignNotSet : "", +DlgTableAlignLeft : "Links", +DlgTableAlignCenter : "Middel", +DlgTableAlignRight : "Regs", +DlgTableWidth : "Weite", +DlgTableWidthPx : "pixels", +DlgTableWidthPc : "percent", +DlgTableHeight : "Hoogde", +DlgTableCellSpace : "Cell spasieering", +DlgTableCellPad : "Cell buffer", +DlgTableCaption : "Beskreiwing", +DlgTableSummary : "Opsomming", + +// Table Cell Dialog +DlgCellTitle : "Cell eienskappe", +DlgCellWidth : "Weite", +DlgCellWidthPx : "pixels", +DlgCellWidthPc : "percent", +DlgCellHeight : "Hoogde", +DlgCellWordWrap : "Woord Wrap", +DlgCellWordWrapNotSet : "", +DlgCellWordWrapYes : "Ja", +DlgCellWordWrapNo : "Nee", +DlgCellHorAlign : "Horisontale rigting", +DlgCellHorAlignNotSet : "", +DlgCellHorAlignLeft : "Links", +DlgCellHorAlignCenter : "Middel", +DlgCellHorAlignRight: "Regs", +DlgCellVerAlign : "Vertikale rigting", +DlgCellVerAlignNotSet : "", +DlgCellVerAlignTop : "Bo", +DlgCellVerAlignMiddle : "Middel", +DlgCellVerAlignBottom : "Onder", +DlgCellVerAlignBaseline : "Baseline", +DlgCellRowSpan : "Rei strekking", +DlgCellCollSpan : "Kolom strekking", +DlgCellBackColor : "Agtergrond Kleur", +DlgCellBorderColor : "Kant Kleur", +DlgCellBtnSelect : "Keuse...", + +// Find and Replace Dialog +DlgFindAndReplaceTitle : "Find and Replace", //MISSING + +// Find Dialog +DlgFindTitle : "Vind", +DlgFindFindBtn : "Vind", +DlgFindNotFoundMsg : "Die gespesifiseerde karakters word nie gevind nie.", + +// Replace Dialog +DlgReplaceTitle : "Vervang", +DlgReplaceFindLbl : "Soek wat:", +DlgReplaceReplaceLbl : "Vervang met:", +DlgReplaceCaseChk : "Vergelyk karakter skryfweise", +DlgReplaceReplaceBtn : "Vervang", +DlgReplaceReplAllBtn : "Vervang alles", +DlgReplaceWordChk : "Vergelyk komplete woord", + +// Paste Operations / Dialog +PasteErrorCut : "U browser se sekuriteit instelling behinder die uitsny aksie. Gebruik asseblief die sleutel kombenasie(Ctrl+X).", +PasteErrorCopy : "U browser se sekuriteit instelling behinder die kopieerings aksie. Gebruik asseblief die sleutel kombenasie(Ctrl+C).", + +PasteAsText : "Voeg slegs karakters by", +PasteFromWord : "Byvoeging uit Word", + +DlgPasteMsg2 : "Voeg asseblief die inhoud in die gegewe box by met sleutel kombenasie(Ctrl+V) en druk OK.", +DlgPasteSec : "Because of your browser security settings, the editor is not able to access your clipboard data directly. You are required to paste it again in this window.", //MISSING +DlgPasteIgnoreFont : "Ignoreer karakter soort defenisies", +DlgPasteRemoveStyles : "Verweider Styl defenisies", +DlgPasteCleanBox : "Maak Box Skoon", + +// Color Picker +ColorAutomatic : "Automaties", +ColorMoreColors : "Meer Kleure...", + +// Document Properties +DocProps : "Dokument Eienskappe", + +// Anchor Dialog +DlgAnchorTitle : "Plekhouer Eienskappe", +DlgAnchorName : "Plekhouer Naam", +DlgAnchorErrorName : "Voltooi die plekhouer naam asseblief", + +// Speller Pages Dialog +DlgSpellNotInDic : "Nie in woordeboek nie", +DlgSpellChangeTo : "Verander na", +DlgSpellBtnIgnore : "Ignoreer", +DlgSpellBtnIgnoreAll : "Ignoreer na-volgende", +DlgSpellBtnReplace : "Vervang", +DlgSpellBtnReplaceAll : "vervang na-volgende", +DlgSpellBtnUndo : "Ont-skep", +DlgSpellNoSuggestions : "- Geen voorstel -", +DlgSpellProgress : "Spelling word beproef...", +DlgSpellNoMispell : "Spellproef kompleet: Geen foute", +DlgSpellNoChanges : "Spellproef kompleet: Geen woord veranderings", +DlgSpellOneChange : "Spellproef kompleet: Een woord verander", +DlgSpellManyChanges : "Spellproef kompleet: %1 woorde verander", + +IeSpellDownload : "Geen Spellproefer geinstaleer nie. Wil U dit aflaai?", + +// Button Dialog +DlgButtonText : "Karakters (Waarde)", +DlgButtonType : "Soort", +DlgButtonTypeBtn : "Knop", +DlgButtonTypeSbm : "Indien", +DlgButtonTypeRst : "Reset", + +// Checkbox and Radio Button Dialogs +DlgCheckboxName : "Naam", +DlgCheckboxValue : "Waarde", +DlgCheckboxSelected : "Uitgekies", + +// Form Dialog +DlgFormName : "Naam", +DlgFormAction : "Aksie", +DlgFormMethod : "Metode", + +// Select Field Dialog +DlgSelectName : "Naam", +DlgSelectValue : "Waarde", +DlgSelectSize : "Grote", +DlgSelectLines : "lyne", +DlgSelectChkMulti : "Laat meerere keuses toe", +DlgSelectOpAvail : "Beskikbare Opsies", +DlgSelectOpText : "Karakters", +DlgSelectOpValue : "Waarde", +DlgSelectBtnAdd : "Byvoeg", +DlgSelectBtnModify : "Verander", +DlgSelectBtnUp : "Op", +DlgSelectBtnDown : "Af", +DlgSelectBtnSetValue : "Stel as uitgekiesde waarde", +DlgSelectBtnDelete : "Verweider", + +// Textarea Dialog +DlgTextareaName : "Naam", +DlgTextareaCols : "Kolom", +DlgTextareaRows : "Reie", + +// Text Field Dialog +DlgTextName : "Naam", +DlgTextValue : "Waarde", +DlgTextCharWidth : "Karakter weite", +DlgTextMaxChars : "Maximale karakters", +DlgTextType : "Soort", +DlgTextTypeText : "Karakters", +DlgTextTypePass : "Wagwoord", + +// Hidden Field Dialog +DlgHiddenName : "Naam", +DlgHiddenValue : "Waarde", + +// Bulleted List Dialog +BulletedListProp : "Gepunkte lys eienskappe", +NumberedListProp : "Genommerde lys eienskappe", +DlgLstStart : "Begin", +DlgLstType : "Soort", +DlgLstTypeCircle : "Sirkel", +DlgLstTypeDisc : "Skyf", +DlgLstTypeSquare : "Vierkant", +DlgLstTypeNumbers : "Nommer (1, 2, 3)", +DlgLstTypeLCase : "Klein Letters (a, b, c)", +DlgLstTypeUCase : "Hoof Letters (A, B, C)", +DlgLstTypeSRoman : "Klein Romeinse nommers (i, ii, iii)", +DlgLstTypeLRoman : "Groot Romeinse nommers (I, II, III)", + +// Document Properties Dialog +DlgDocGeneralTab : "Algemeen", +DlgDocBackTab : "Agtergrond", +DlgDocColorsTab : "Kleure en Rante", +DlgDocMetaTab : "Meta Data", + +DlgDocPageTitle : "Bladsy Opskrif", +DlgDocLangDir : "Taal rigting", +DlgDocLangDirLTR : "Link na Regs (LTR)", +DlgDocLangDirRTL : "Regs na Links (RTL)", +DlgDocLangCode : "Taal Kode", +DlgDocCharSet : "Karakterstel Kodeering", +DlgDocCharSetCE : "Sentraal Europa", +DlgDocCharSetCT : "Chinees Traditioneel (Big5)", +DlgDocCharSetCR : "Cyrillic", +DlgDocCharSetGR : "Grieks", +DlgDocCharSetJP : "Japanees", +DlgDocCharSetKR : "Koreans", +DlgDocCharSetTR : "Turks", +DlgDocCharSetUN : "Unicode (UTF-8)", +DlgDocCharSetWE : "Western European", +DlgDocCharSetOther : "Ander Karakterstel Kodeering", + +DlgDocDocType : "Dokument Opskrif Soort", +DlgDocDocTypeOther : "Ander Dokument Opskrif Soort", +DlgDocIncXHTML : "Voeg XHTML verklaring by", +DlgDocBgColor : "Agtergrond kleur", +DlgDocBgImage : "Agtergrond Beeld URL", +DlgDocBgNoScroll : "Vasgeklemde Agtergrond", +DlgDocCText : "Karakters", +DlgDocCLink : "Skakel", +DlgDocCVisited : "Besoekte Skakel", +DlgDocCActive : "Aktiewe Skakel", +DlgDocMargins : "Bladsy Rante", +DlgDocMaTop : "Bo", +DlgDocMaLeft : "Links", +DlgDocMaRight : "Regs", +DlgDocMaBottom : "Onder", +DlgDocMeIndex : "Dokument Index Sleutelwoorde(comma verdeelt)", +DlgDocMeDescr : "Dokument Beskrywing", +DlgDocMeAuthor : "Skrywer", +DlgDocMeCopy : "Kopiereg", +DlgDocPreview : "Voorskou", + +// Templates Dialog +Templates : "Templates", +DlgTemplatesTitle : "Inhoud Templates", +DlgTemplatesSelMsg : "Kies die template om te gebruik in die editor
    (Inhoud word vervang!):", +DlgTemplatesLoading : "Templates word gelaai. U geduld asseblief...", +DlgTemplatesNoTpl : "(Geen templates gedefinieerd)", +DlgTemplatesReplace : "Vervang bestaande inhoud", + +// About Dialog +DlgAboutAboutTab : "Meer oor", +DlgAboutBrowserInfoTab : "Blaai Informasie deur", +DlgAboutLicenseTab : "Lesensie", +DlgAboutVersion : "weergawe", +DlgAboutInfo : "Vir meer informasie gaan na " +}; diff --git a/FCKeditor/editor/lang/ar.js b/FCKeditor/editor/lang/ar.js new file mode 100644 index 0000000..8d1f9c7 --- /dev/null +++ b/FCKeditor/editor/lang/ar.js @@ -0,0 +1,516 @@ +/* + * FCKeditor - The text editor for Internet - http://www.fckeditor.net + * Copyright (C) 2003-2007 Frederico Caldeira Knabben + * + * == BEGIN LICENSE == + * + * Licensed under the terms of any of the following licenses at your + * choice: + * + * - GNU General Public License Version 2 or later (the "GPL") + * http://www.gnu.org/licenses/gpl.html + * + * - GNU Lesser General Public License Version 2.1 or later (the "LGPL") + * http://www.gnu.org/licenses/lgpl.html + * + * - Mozilla Public License Version 1.1 or later (the "MPL") + * http://www.mozilla.org/MPL/MPL-1.1.html + * + * == END LICENSE == + * + * Arabic language file. + */ + +var FCKLang = +{ +// Language direction : "ltr" (left to right) or "rtl" (right to left). +Dir : "rtl", + +ToolbarCollapse : "ضم شريط الأدوات", +ToolbarExpand : "تمدد شريط الأدوات", + +// Toolbar Items and Context Menu +Save : "حفظ", +NewPage : "صفحة جديدة", +Preview : "معاينة الصفحة", +Cut : "قص", +Copy : "نسخ", +Paste : "لصق", +PasteText : "لصق كنص بسيط", +PasteWord : "لصق من وورد", +Print : "طباعة", +SelectAll : "تحديد الكل", +RemoveFormat : "إزالة التنسيقات", +InsertLinkLbl : "رابط", +InsertLink : "إدراج/تحرير رابط", +RemoveLink : "إزالة رابط", +Anchor : "إدراج/تحرير إشارة مرجعية", +AnchorDelete : "إزالة إشارة مرجعية", +InsertImageLbl : "صورة", +InsertImage : "إدراج/تحرير صورة", +InsertFlashLbl : "فلاش", +InsertFlash : "إدراج/تحرير فيلم فلاش", +InsertTableLbl : "جدول", +InsertTable : "إدراج/تحرير جدول", +InsertLineLbl : "خط فاصل", +InsertLine : "إدراج خط فاصل", +InsertSpecialCharLbl: "رموز", +InsertSpecialChar : "إدراج رموز..ِ", +InsertSmileyLbl : "ابتسامات", +InsertSmiley : "إدراج ابتسامات", +About : "حول FCKeditor", +Bold : "غامق", +Italic : "مائل", +Underline : "تسطير", +StrikeThrough : "يتوسطه خط", +Subscript : "منخفض", +Superscript : "مرتفع", +LeftJustify : "محاذاة إلى اليسار", +CenterJustify : "توسيط", +RightJustify : "محاذاة إلى اليمين", +BlockJustify : "ضبط", +DecreaseIndent : "إنقاص المسافة البادئة", +IncreaseIndent : "زيادة المسافة البادئة", +Blockquote : "اقتباس", +Undo : "تراجع", +Redo : "إعادة", +NumberedListLbl : "تعداد رقمي", +NumberedList : "إدراج/إلغاء تعداد رقمي", +BulletedListLbl : "تعداد نقطي", +BulletedList : "إدراج/إلغاء تعداد نقطي", +ShowTableBorders : "معاينة حدود الجداول", +ShowDetails : "معاينة التفاصيل", +Style : "نمط", +FontFormat : "تنسيق", +Font : "خط", +FontSize : "حجم الخط", +TextColor : "لون النص", +BGColor : "لون الخلفية", +Source : "شفرة المصدر", +Find : "بحث", +Replace : "إستبدال", +SpellCheck : "تدقيق إملائي", +UniversalKeyboard : "لوحة المفاتيح العالمية", +PageBreakLbl : "فصل الصفحة", +PageBreak : "إدخال صفحة جديدة", + +Form : "نموذج", +Checkbox : "خانة إختيار", +RadioButton : "زر خيار", +TextField : "مربع نص", +Textarea : "ناحية نص", +HiddenField : "إدراج حقل خفي", +Button : "زر ضغط", +SelectionField : "قائمة منسدلة", +ImageButton : "زر صورة", + +FitWindow : "تكبير حجم المحرر", +ShowBlocks : "مخطط تفصيلي", + +// Context Menu +EditLink : "تحرير رابط", +CellCM : "خلية", +RowCM : "صف", +ColumnCM : "عمود", +InsertRowAfter : "إدراج صف بعد", +InsertRowBefore : "إدراج صف قبل", +DeleteRows : "حذف صفوف", +InsertColumnAfter : "إدراج عمود بعد", +InsertColumnBefore : "إدراج عمود قبل", +DeleteColumns : "حذف أعمدة", +InsertCellAfter : "إدراج خلية بعد", +InsertCellBefore : "إدراج خلية قبل", +DeleteCells : "حذف خلايا", +MergeCells : "دمج خلايا", +MergeRight : "دمج لليمين", +MergeDown : "دمج للأسفل", +HorizontalSplitCell : "تقسيم الخلية أفقياً", +VerticalSplitCell : "تقسيم الخلية عمودياً", +TableDelete : "حذف الجدول", +CellProperties : "خصائص الخلية", +TableProperties : "خصائص الجدول", +ImageProperties : "خصائص الصورة", +FlashProperties : "خصائص فيلم الفلاش", + +AnchorProp : "خصائص الإشارة المرجعية", +ButtonProp : "خصائص زر الضغط", +CheckboxProp : "خصائص خانة الإختيار", +HiddenFieldProp : "خصائص الحقل الخفي", +RadioButtonProp : "خصائص زر الخيار", +ImageButtonProp : "خصائص زر الصورة", +TextFieldProp : "خصائص مربع النص", +SelectionFieldProp : "خصائص القائمة المنسدلة", +TextareaProp : "خصائص ناحية النص", +FormProp : "خصائص النموذج", + +FontFormats : "عادي;منسّق;دوس;العنوان 1;العنوان 2;العنوان 3;العنوان 4;العنوان 5;العنوان 6", + +// Alerts and Messages +ProcessingXHTML : "إنتظر قليلاً ريثما تتم معالَجة‏ XHTML. لن يستغرق طويلاً...", +Done : "تم", +PasteWordConfirm : "يبدو أن النص المراد لصقه منسوخ من برنامج وورد. هل تود تنظيفه قبل الشروع في عملية اللصق؟", +NotCompatiblePaste : "هذه الميزة تحتاج لمتصفح من النوعInternet Explorer إصدار 5.5 فما فوق. هل تود اللصق دون تنظيف الكود؟", +UnknownToolbarItem : "عنصر شريط أدوات غير معروف \"%1\"", +UnknownCommand : "أمر غير معروف \"%1\"", +NotImplemented : "لم يتم دعم هذا الأمر", +UnknownToolbarSet : "لم أتمكن من العثور على طقم الأدوات \"%1\" ", +NoActiveX : "لتأمين متصفحك يجب أن تحدد بعض مميزات المحرر. يتوجب عليك تمكين الخيار \"Run ActiveX controls and plug-ins\". قد تواجة أخطاء وتلاحظ مميزات مفقودة", +BrowseServerBlocked : "لايمكن فتح مصدر المتصفح. فضلا يجب التأكد بأن جميع موانع النوافذ المنبثقة معطلة", +DialogBlocked : "لايمكن فتح نافذة الحوار . فضلا تأكد من أن مانع النوافذ المنبثة معطل .", + +// Dialogs +DlgBtnOK : "موافق", +DlgBtnCancel : "إلغاء الأمر", +DlgBtnClose : "إغلاق", +DlgBtnBrowseServer : "تصفح الخادم", +DlgAdvancedTag : "متقدم", +DlgOpOther : "<أخرى>", +DlgInfoTab : "معلومات", +DlgAlertUrl : "الرجاء كتابة عنوان الإنترنت", + +// General Dialogs Labels +DlgGenNotSet : "<بدون تحديد>", +DlgGenId : "الرقم", +DlgGenLangDir : "إتجاه النص", +DlgGenLangDirLtr : "اليسار لليمين (LTR)", +DlgGenLangDirRtl : "اليمين لليسار (RTL)", +DlgGenLangCode : "رمز اللغة", +DlgGenAccessKey : "مفاتيح الإختصار", +DlgGenName : "الاسم", +DlgGenTabIndex : "الترتيب", +DlgGenLongDescr : "عنوان الوصف المفصّل", +DlgGenClass : "فئات التنسيق", +DlgGenTitle : "تلميح الشاشة", +DlgGenContType : "نوع التلميح", +DlgGenLinkCharset : "ترميز المادة المطلوبة", +DlgGenStyle : "نمط", + +// Image Dialog +DlgImgTitle : "خصائص الصورة", +DlgImgInfoTab : "معلومات الصورة", +DlgImgBtnUpload : "أرسلها للخادم", +DlgImgURL : "موقع الصورة", +DlgImgUpload : "رفع", +DlgImgAlt : "الوصف", +DlgImgWidth : "العرض", +DlgImgHeight : "الإرتفاع", +DlgImgLockRatio : "تناسق الحجم", +DlgBtnResetSize : "إستعادة الحجم الأصلي", +DlgImgBorder : "سمك الحدود", +DlgImgHSpace : "تباعد أفقي", +DlgImgVSpace : "تباعد عمودي", +DlgImgAlign : "محاذاة", +DlgImgAlignLeft : "يسار", +DlgImgAlignAbsBottom: "أسفل النص", +DlgImgAlignAbsMiddle: "وسط السطر", +DlgImgAlignBaseline : "على السطر", +DlgImgAlignBottom : "أسفل", +DlgImgAlignMiddle : "وسط", +DlgImgAlignRight : "يمين", +DlgImgAlignTextTop : "أعلى النص", +DlgImgAlignTop : "أعلى", +DlgImgPreview : "معاينة", +DlgImgAlertUrl : "فضلاً أكتب الموقع الذي توجد عليه هذه الصورة.", +DlgImgLinkTab : "الرابط", + +// Flash Dialog +DlgFlashTitle : "خصائص فيلم الفلاش", +DlgFlashChkPlay : "تشغيل تلقائي", +DlgFlashChkLoop : "تكرار", +DlgFlashChkMenu : "تمكين قائمة فيلم الفلاش", +DlgFlashScale : "الحجم", +DlgFlashScaleAll : "إظهار الكل", +DlgFlashScaleNoBorder : "بلا حدود", +DlgFlashScaleFit : "ضبط تام", + +// Link Dialog +DlgLnkWindowTitle : "إرتباط تشعبي", +DlgLnkInfoTab : "معلومات الرابط", +DlgLnkTargetTab : "الهدف", + +DlgLnkType : "نوع الربط", +DlgLnkTypeURL : "العنوان", +DlgLnkTypeAnchor : "مكان في هذا المستند", +DlgLnkTypeEMail : "بريد إلكتروني", +DlgLnkProto : "البروتوكول", +DlgLnkProtoOther : "<أخرى>", +DlgLnkURL : "الموقع", +DlgLnkAnchorSel : "اختر علامة مرجعية", +DlgLnkAnchorByName : "حسب اسم العلامة", +DlgLnkAnchorById : "حسب تعريف العنصر", +DlgLnkNoAnchors : "(لا يوجد علامات مرجعية في هذا المستند)", +DlgLnkEMail : "عنوان بريد إلكتروني", +DlgLnkEMailSubject : "موضوع الرسالة", +DlgLnkEMailBody : "محتوى الرسالة", +DlgLnkUpload : "رفع", +DlgLnkBtnUpload : "أرسلها للخادم", + +DlgLnkTarget : "الهدف", +DlgLnkTargetFrame : "<إطار>", +DlgLnkTargetPopup : "<نافذة منبثقة>", +DlgLnkTargetBlank : "إطار جديد (_blank)", +DlgLnkTargetParent : "الإطار الأصل (_parent)", +DlgLnkTargetSelf : "نفس الإطار (_self)", +DlgLnkTargetTop : "صفحة كاملة (_top)", +DlgLnkTargetFrameName : "اسم الإطار الهدف", +DlgLnkPopWinName : "تسمية النافذة المنبثقة", +DlgLnkPopWinFeat : "خصائص النافذة المنبثقة", +DlgLnkPopResize : "قابلة للتحجيم", +DlgLnkPopLocation : "شريط العنوان", +DlgLnkPopMenu : "القوائم الرئيسية", +DlgLnkPopScroll : "أشرطة التمرير", +DlgLnkPopStatus : "شريط الحالة السفلي", +DlgLnkPopToolbar : "شريط الأدوات", +DlgLnkPopFullScrn : "ملئ الشاشة (IE)", +DlgLnkPopDependent : "تابع (Netscape)", +DlgLnkPopWidth : "العرض", +DlgLnkPopHeight : "الإرتفاع", +DlgLnkPopLeft : "التمركز لليسار", +DlgLnkPopTop : "التمركز للأعلى", + +DlnLnkMsgNoUrl : "فضلاً أدخل عنوان الموقع الذي يشير إليه الرابط", +DlnLnkMsgNoEMail : "فضلاً أدخل عنوان البريد الإلكتروني", +DlnLnkMsgNoAnchor : "فضلاً حدد العلامة المرجعية المرغوبة", +DlnLnkMsgInvPopName : "اسم النافذة المنبثقة يجب أن يبدأ بحرف أبجدي دون مسافات", + +// Color Dialog +DlgColorTitle : "اختر لوناً", +DlgColorBtnClear : "مسح", +DlgColorHighlight : "تحديد", +DlgColorSelected : "إختيار", + +// Smiley Dialog +DlgSmileyTitle : "إدراج إبتسامات ", + +// Special Character Dialog +DlgSpecialCharTitle : "إدراج رمز", + +// Table Dialog +DlgTableTitle : "إدراج جدول", +DlgTableRows : "صفوف", +DlgTableColumns : "أعمدة", +DlgTableBorder : "سمك الحدود", +DlgTableAlign : "المحاذاة", +DlgTableAlignNotSet : "<بدون تحديد>", +DlgTableAlignLeft : "يسار", +DlgTableAlignCenter : "وسط", +DlgTableAlignRight : "يمين", +DlgTableWidth : "العرض", +DlgTableWidthPx : "بكسل", +DlgTableWidthPc : "بالمئة", +DlgTableHeight : "الإرتفاع", +DlgTableCellSpace : "تباعد الخلايا", +DlgTableCellPad : "المسافة البادئة", +DlgTableCaption : "الوصف", +DlgTableSummary : "الخلاصة", + +// Table Cell Dialog +DlgCellTitle : "خصائص الخلية", +DlgCellWidth : "العرض", +DlgCellWidthPx : "بكسل", +DlgCellWidthPc : "بالمئة", +DlgCellHeight : "الإرتفاع", +DlgCellWordWrap : "التفاف النص", +DlgCellWordWrapNotSet : "<بدون تحديد>", +DlgCellWordWrapYes : "نعم", +DlgCellWordWrapNo : "لا", +DlgCellHorAlign : "المحاذاة الأفقية", +DlgCellHorAlignNotSet : "<بدون تحديد>", +DlgCellHorAlignLeft : "يسار", +DlgCellHorAlignCenter : "وسط", +DlgCellHorAlignRight: "يمين", +DlgCellVerAlign : "المحاذاة العمودية", +DlgCellVerAlignNotSet : "<بدون تحديد>", +DlgCellVerAlignTop : "أعلى", +DlgCellVerAlignMiddle : "وسط", +DlgCellVerAlignBottom : "أسفل", +DlgCellVerAlignBaseline : "على السطر", +DlgCellRowSpan : "إمتداد الصفوف", +DlgCellCollSpan : "إمتداد الأعمدة", +DlgCellBackColor : "لون الخلفية", +DlgCellBorderColor : "لون الحدود", +DlgCellBtnSelect : "حدّد...", + +// Find and Replace Dialog +DlgFindAndReplaceTitle : "بحث واستبدال", + +// Find Dialog +DlgFindTitle : "بحث", +DlgFindFindBtn : "ابحث", +DlgFindNotFoundMsg : "لم يتم العثور على النص المحدد.", + +// Replace Dialog +DlgReplaceTitle : "إستبدال", +DlgReplaceFindLbl : "البحث عن:", +DlgReplaceReplaceLbl : "إستبدال بـ:", +DlgReplaceCaseChk : "مطابقة حالة الأحرف", +DlgReplaceReplaceBtn : "إستبدال", +DlgReplaceReplAllBtn : "إستبدال الكل", +DlgReplaceWordChk : "الكلمة بالكامل فقط", + +// Paste Operations / Dialog +PasteErrorCut : "الإعدادات الأمنية للمتصفح الذي تستخدمه تمنع القص التلقائي. فضلاً إستخدم لوحة المفاتيح لفعل ذلك (Ctrl+X).", +PasteErrorCopy : "الإعدادات الأمنية للمتصفح الذي تستخدمه تمنع النسخ التلقائي. فضلاً إستخدم لوحة المفاتيح لفعل ذلك (Ctrl+C).", + +PasteAsText : "لصق كنص بسيط", +PasteFromWord : "لصق من وورد", + +DlgPasteMsg2 : "الصق داخل الصندوق بإستخدام زرّي (Ctrl+V) في لوحة المفاتيح، ثم اضغط زر موافق.", +DlgPasteSec : "نظراً لإعدادات الأمان الخاصة بمتصفحك، لن يتمكن هذا المحرر من الوصول لمحتوى حافظتك، لذا وجب عليك لصق المحتوى مرة أخرى في هذه النافذة.", +DlgPasteIgnoreFont : "تجاهل تعريفات أسماء الخطوط", +DlgPasteRemoveStyles : "إزالة تعريفات الأنماط", +DlgPasteCleanBox : "نظّف محتوى الصندوق", + +// Color Picker +ColorAutomatic : "تلقائي", +ColorMoreColors : "ألوان إضافية...", + +// Document Properties +DocProps : "خصائص الصفحة", + +// Anchor Dialog +DlgAnchorTitle : "خصائص إشارة مرجعية", +DlgAnchorName : "اسم الإشارة المرجعية", +DlgAnchorErrorName : "الرجاء كتابة اسم الإشارة المرجعية", + +// Speller Pages Dialog +DlgSpellNotInDic : "ليست في القاموس", +DlgSpellChangeTo : "التغيير إلى", +DlgSpellBtnIgnore : "تجاهل", +DlgSpellBtnIgnoreAll : "تجاهل الكل", +DlgSpellBtnReplace : "تغيير", +DlgSpellBtnReplaceAll : "تغيير الكل", +DlgSpellBtnUndo : "تراجع", +DlgSpellNoSuggestions : "- لا توجد إقتراحات -", +DlgSpellProgress : "جاري التدقيق إملائياً", +DlgSpellNoMispell : "تم إكمال التدقيق الإملائي: لم يتم العثور على أي أخطاء إملائية", +DlgSpellNoChanges : "تم إكمال التدقيق الإملائي: لم يتم تغيير أي كلمة", +DlgSpellOneChange : "تم إكمال التدقيق الإملائي: تم تغيير كلمة واحدة فقط", +DlgSpellManyChanges : "تم إكمال التدقيق الإملائي: تم تغيير %1 كلمات\كلمة", + +IeSpellDownload : "المدقق الإملائي (الإنجليزي) غير مثبّت. هل تود تحميله الآن؟", + +// Button Dialog +DlgButtonText : "القيمة/التسمية", +DlgButtonType : "نوع الزر", +DlgButtonTypeBtn : "زر", +DlgButtonTypeSbm : "إرسال", +DlgButtonTypeRst : "إعادة تعيين", + +// Checkbox and Radio Button Dialogs +DlgCheckboxName : "الاسم", +DlgCheckboxValue : "القيمة", +DlgCheckboxSelected : "محدد", + +// Form Dialog +DlgFormName : "الاسم", +DlgFormAction : "اسم الملف", +DlgFormMethod : "الأسلوب", + +// Select Field Dialog +DlgSelectName : "الاسم", +DlgSelectValue : "القيمة", +DlgSelectSize : "الحجم", +DlgSelectLines : "الأسطر", +DlgSelectChkMulti : "السماح بتحديدات متعددة", +DlgSelectOpAvail : "الخيارات المتاحة", +DlgSelectOpText : "النص", +DlgSelectOpValue : "القيمة", +DlgSelectBtnAdd : "إضافة", +DlgSelectBtnModify : "تعديل", +DlgSelectBtnUp : "تحريك لأعلى", +DlgSelectBtnDown : "تحريك لأسفل", +DlgSelectBtnSetValue : "إجعلها محددة", +DlgSelectBtnDelete : "إزالة", + +// Textarea Dialog +DlgTextareaName : "الاسم", +DlgTextareaCols : "الأعمدة", +DlgTextareaRows : "الصفوف", + +// Text Field Dialog +DlgTextName : "الاسم", +DlgTextValue : "القيمة", +DlgTextCharWidth : "العرض بالأحرف", +DlgTextMaxChars : "عدد الحروف الأقصى", +DlgTextType : "نوع المحتوى", +DlgTextTypeText : "نص", +DlgTextTypePass : "كلمة مرور", + +// Hidden Field Dialog +DlgHiddenName : "الاسم", +DlgHiddenValue : "القيمة", + +// Bulleted List Dialog +BulletedListProp : "خصائص التعداد النقطي", +NumberedListProp : "خصائص التعداد الرقمي", +DlgLstStart : "البدء عند", +DlgLstType : "النوع", +DlgLstTypeCircle : "دائرة", +DlgLstTypeDisc : "قرص", +DlgLstTypeSquare : "مربع", +DlgLstTypeNumbers : "أرقام (1، 2، 3)َ", +DlgLstTypeLCase : "حروف صغيرة (a, b, c)َ", +DlgLstTypeUCase : "حروف كبيرة (A, B, C)َ", +DlgLstTypeSRoman : "ترقيم روماني صغير (i, ii, iii)َ", +DlgLstTypeLRoman : "ترقيم روماني كبير (I, II, III)َ", + +// Document Properties Dialog +DlgDocGeneralTab : "عام", +DlgDocBackTab : "الخلفية", +DlgDocColorsTab : "الألوان والهوامش", +DlgDocMetaTab : "المعرّفات الرأسية", + +DlgDocPageTitle : "عنوان الصفحة", +DlgDocLangDir : "إتجاه اللغة", +DlgDocLangDirLTR : "اليسار لليمين (LTR)", +DlgDocLangDirRTL : "اليمين لليسار (RTL)", +DlgDocLangCode : "رمز اللغة", +DlgDocCharSet : "ترميز الحروف", +DlgDocCharSetCE : "أوروبا الوسطى", +DlgDocCharSetCT : "الصينية التقليدية (Big5)", +DlgDocCharSetCR : "السيريلية", +DlgDocCharSetGR : "اليونانية", +DlgDocCharSetJP : "اليابانية", +DlgDocCharSetKR : "الكورية", +DlgDocCharSetTR : "التركية", +DlgDocCharSetUN : "Unicode (UTF-8)", +DlgDocCharSetWE : "أوروبا الغربية", +DlgDocCharSetOther : "ترميز آخر", + +DlgDocDocType : "ترويسة نوع الصفحة", +DlgDocDocTypeOther : "ترويسة نوع صفحة أخرى", +DlgDocIncXHTML : "تضمين إعلانات‏ لغة XHTMLَ", +DlgDocBgColor : "لون الخلفية", +DlgDocBgImage : "رابط الصورة الخلفية", +DlgDocBgNoScroll : "جعلها علامة مائية", +DlgDocCText : "النص", +DlgDocCLink : "الروابط", +DlgDocCVisited : "المزارة", +DlgDocCActive : "النشطة", +DlgDocMargins : "هوامش الصفحة", +DlgDocMaTop : "علوي", +DlgDocMaLeft : "أيسر", +DlgDocMaRight : "أيمن", +DlgDocMaBottom : "سفلي", +DlgDocMeIndex : "الكلمات الأساسية (مفصولة بفواصل)َ", +DlgDocMeDescr : "وصف الصفحة", +DlgDocMeAuthor : "الكاتب", +DlgDocMeCopy : "المالك", +DlgDocPreview : "معاينة", + +// Templates Dialog +Templates : "القوالب", +DlgTemplatesTitle : "قوالب المحتوى", +DlgTemplatesSelMsg : "اختر القالب الذي تود وضعه في المحرر
    (سيتم فقدان المحتوى الحالي):", +DlgTemplatesLoading : "جاري تحميل قائمة القوالب، الرجاء الإنتظار...", +DlgTemplatesNoTpl : "(لم يتم تعريف أي قالب)", +DlgTemplatesReplace : "استبدال المحتوى", + +// About Dialog +DlgAboutAboutTab : "نبذة", +DlgAboutBrowserInfoTab : "معلومات متصفحك", +DlgAboutLicenseTab : "الترخيص", +DlgAboutVersion : "الإصدار", +DlgAboutInfo : "لمزيد من المعلومات تفضل بزيارة" +}; diff --git a/FCKeditor/editor/lang/bg.js b/FCKeditor/editor/lang/bg.js new file mode 100644 index 0000000..227029b --- /dev/null +++ b/FCKeditor/editor/lang/bg.js @@ -0,0 +1,516 @@ +/* + * FCKeditor - The text editor for Internet - http://www.fckeditor.net + * Copyright (C) 2003-2007 Frederico Caldeira Knabben + * + * == BEGIN LICENSE == + * + * Licensed under the terms of any of the following licenses at your + * choice: + * + * - GNU General Public License Version 2 or later (the "GPL") + * http://www.gnu.org/licenses/gpl.html + * + * - GNU Lesser General Public License Version 2.1 or later (the "LGPL") + * http://www.gnu.org/licenses/lgpl.html + * + * - Mozilla Public License Version 1.1 or later (the "MPL") + * http://www.mozilla.org/MPL/MPL-1.1.html + * + * == END LICENSE == + * + * Bulgarian language file. + */ + +var FCKLang = +{ +// Language direction : "ltr" (left to right) or "rtl" (right to left). +Dir : "ltr", + +ToolbarCollapse : "Скрий панела с инструментите", +ToolbarExpand : "Покажи панела с инструментите", + +// Toolbar Items and Context Menu +Save : "Запази", +NewPage : "Нова страница", +Preview : "Предварителен изглед", +Cut : "Изрежи", +Copy : "Запамети", +Paste : "Вмъкни", +PasteText : "Вмъкни само текст", +PasteWord : "Вмъкни от MS Word", +Print : "Печат", +SelectAll : "Селектирай всичко", +RemoveFormat : "Изтрий форматирането", +InsertLinkLbl : "Връзка", +InsertLink : "Добави/Редактирай връзка", +RemoveLink : "Изтрий връзка", +Anchor : "Добави/Редактирай котва", +AnchorDelete : "Remove Anchor", //MISSING +InsertImageLbl : "Изображение", +InsertImage : "Добави/Редактирай изображение", +InsertFlashLbl : "Flash", +InsertFlash : "Добави/Редактиай Flash обект", +InsertTableLbl : "Таблица", +InsertTable : "Добави/Редактирай таблица", +InsertLineLbl : "Линия", +InsertLine : "Вмъкни хоризонтална линия", +InsertSpecialCharLbl: "Специален символ", +InsertSpecialChar : "Вмъкни специален символ", +InsertSmileyLbl : "Усмивка", +InsertSmiley : "Добави усмивка", +About : "За FCKeditor", +Bold : "Удебелен", +Italic : "Курсив", +Underline : "Подчертан", +StrikeThrough : "Зачертан", +Subscript : "Индекс за база", +Superscript : "Индекс за степен", +LeftJustify : "Подравняване в ляво", +CenterJustify : "Подравнявне в средата", +RightJustify : "Подравняване в дясно", +BlockJustify : "Двустранно подравняване", +DecreaseIndent : "Намали отстъпа", +IncreaseIndent : "Увеличи отстъпа", +Blockquote : "Blockquote", //MISSING +Undo : "Отмени", +Redo : "Повтори", +NumberedListLbl : "Нумериран списък", +NumberedList : "Добави/Изтрий нумериран списък", +BulletedListLbl : "Ненумериран списък", +BulletedList : "Добави/Изтрий ненумериран списък", +ShowTableBorders : "Покажи рамките на таблицата", +ShowDetails : "Покажи подробности", +Style : "Стил", +FontFormat : "Формат", +Font : "Шрифт", +FontSize : "Размер", +TextColor : "Цвят на текста", +BGColor : "Цвят на фона", +Source : "Код", +Find : "Търси", +Replace : "Замести", +SpellCheck : "Провери правописа", +UniversalKeyboard : "Универсална клавиатура", +PageBreakLbl : "Нов ред", +PageBreak : "Вмъкни нов ред", + +Form : "Формуляр", +Checkbox : "Поле за отметка", +RadioButton : "Поле за опция", +TextField : "Текстово поле", +Textarea : "Текстова област", +HiddenField : "Скрито поле", +Button : "Бутон", +SelectionField : "Падащо меню с опции", +ImageButton : "Бутон-изображение", + +FitWindow : "Maximize the editor size", //MISSING +ShowBlocks : "Show Blocks", //MISSING + +// Context Menu +EditLink : "Редактирай връзка", +CellCM : "Cell", //MISSING +RowCM : "Row", //MISSING +ColumnCM : "Column", //MISSING +InsertRowAfter : "Insert Row After", //MISSING +InsertRowBefore : "Insert Row Before", //MISSING +DeleteRows : "Изтрий редовете", +InsertColumnAfter : "Insert Column After", //MISSING +InsertColumnBefore : "Insert Column Before", //MISSING +DeleteColumns : "Изтрий колоните", +InsertCellAfter : "Insert Cell After", //MISSING +InsertCellBefore : "Insert Cell Before", //MISSING +DeleteCells : "Изтрий клетките", +MergeCells : "Обедини клетките", +MergeRight : "Merge Right", //MISSING +MergeDown : "Merge Down", //MISSING +HorizontalSplitCell : "Split Cell Horizontally", //MISSING +VerticalSplitCell : "Split Cell Vertically", //MISSING +TableDelete : "Изтрий таблицата", +CellProperties : "Параметри на клетката", +TableProperties : "Параметри на таблицата", +ImageProperties : "Параметри на изображението", +FlashProperties : "Параметри на Flash обекта", + +AnchorProp : "Параметри на котвата", +ButtonProp : "Параметри на бутона", +CheckboxProp : "Параметри на полето за отметка", +HiddenFieldProp : "Параметри на скритото поле", +RadioButtonProp : "Параметри на полето за опция", +ImageButtonProp : "Параметри на бутона-изображение", +TextFieldProp : "Параметри на текстовото-поле", +SelectionFieldProp : "Параметри на падащото меню с опции", +TextareaProp : "Параметри на текстовата област", +FormProp : "Параметри на формуляра", + +FontFormats : "Нормален;Форматиран;Адрес;Заглавие 1;Заглавие 2;Заглавие 3;Заглавие 4;Заглавие 5;Заглавие 6;Параграф (DIV)", + +// Alerts and Messages +ProcessingXHTML : "Обработка на XHTML. Моля изчакайте...", +Done : "Готово", +PasteWordConfirm : "Текстът, който искате да вмъкнете е копиран от MS Word. Желаете ли да бъде изчистен преди вмъкването?", +NotCompatiblePaste : "Тази операция изисква MS Internet Explorer версия 5.5 или по-висока. Желаете ли да вмъкнете запаметеното без изчистване?", +UnknownToolbarItem : "Непознат инструмент \"%1\"", +UnknownCommand : "Непозната команда \"%1\"", +NotImplemented : "Командата не е имплементирана", +UnknownToolbarSet : "Панелът \"%1\" не съществува", +NoActiveX : "Your browser's security settings could limit some features of the editor. You must enable the option \"Run ActiveX controls and plug-ins\". You may experience errors and notice missing features.", //MISSING +BrowseServerBlocked : "The resources browser could not be opened. Make sure that all popup blockers are disabled.", //MISSING +DialogBlocked : "It was not possible to open the dialog window. Make sure all popup blockers are disabled.", //MISSING + +// Dialogs +DlgBtnOK : "ОК", +DlgBtnCancel : "Отказ", +DlgBtnClose : "Затвори", +DlgBtnBrowseServer : "Разгледай сървъра", +DlgAdvancedTag : "Подробности...", +DlgOpOther : "<Друго>", +DlgInfoTab : "Информация", +DlgAlertUrl : "Моля, въведете пълния път (URL)", + +// General Dialogs Labels +DlgGenNotSet : "<не е настроен>", +DlgGenId : "Идентификатор", +DlgGenLangDir : "посока на речта", +DlgGenLangDirLtr : "От ляво на дясно", +DlgGenLangDirRtl : "От дясно на ляво", +DlgGenLangCode : "Код на езика", +DlgGenAccessKey : "Бърз клавиш", +DlgGenName : "Име", +DlgGenTabIndex : "Ред на достъп", +DlgGenLongDescr : "Описание на връзката", +DlgGenClass : "Клас от стиловите таблици", +DlgGenTitle : "Препоръчително заглавие", +DlgGenContType : "Препоръчителен тип на съдържанието", +DlgGenLinkCharset : "Тип на свързания ресурс", +DlgGenStyle : "Стил", + +// Image Dialog +DlgImgTitle : "Параметри на изображението", +DlgImgInfoTab : "Информация за изображението", +DlgImgBtnUpload : "Прати към сървъра", +DlgImgURL : "Пълен път (URL)", +DlgImgUpload : "Качи", +DlgImgAlt : "Алтернативен текст", +DlgImgWidth : "Ширина", +DlgImgHeight : "Височина", +DlgImgLockRatio : "Запази пропорцията", +DlgBtnResetSize : "Възстанови размера", +DlgImgBorder : "Рамка", +DlgImgHSpace : "Хоризонтален отстъп", +DlgImgVSpace : "Вертикален отстъп", +DlgImgAlign : "Подравняване", +DlgImgAlignLeft : "Ляво", +DlgImgAlignAbsBottom: "Най-долу", +DlgImgAlignAbsMiddle: "Точно по средата", +DlgImgAlignBaseline : "По базовата линия", +DlgImgAlignBottom : "Долу", +DlgImgAlignMiddle : "По средата", +DlgImgAlignRight : "Дясно", +DlgImgAlignTextTop : "Върху текста", +DlgImgAlignTop : "Отгоре", +DlgImgPreview : "Изглед", +DlgImgAlertUrl : "Моля, въведете пълния път до изображението", +DlgImgLinkTab : "Връзка", + +// Flash Dialog +DlgFlashTitle : "Параметри на Flash обекта", +DlgFlashChkPlay : "Автоматично стартиране", +DlgFlashChkLoop : "Ново стартиране след завършването", +DlgFlashChkMenu : "Разрешено Flash меню", +DlgFlashScale : "Оразмеряване", +DlgFlashScaleAll : "Покажи целия обект", +DlgFlashScaleNoBorder : "Без рамка", +DlgFlashScaleFit : "Според мястото", + +// Link Dialog +DlgLnkWindowTitle : "Връзка", +DlgLnkInfoTab : "Информация за връзката", +DlgLnkTargetTab : "Цел", + +DlgLnkType : "Вид на връзката", +DlgLnkTypeURL : "Пълен път (URL)", +DlgLnkTypeAnchor : "Котва в текущата страница", +DlgLnkTypeEMail : "Е-поща", +DlgLnkProto : "Протокол", +DlgLnkProtoOther : "<друго>", +DlgLnkURL : "Пълен път (URL)", +DlgLnkAnchorSel : "Изберете котва", +DlgLnkAnchorByName : "По име на котвата", +DlgLnkAnchorById : "По идентификатор на елемент", +DlgLnkNoAnchors : "(Няма котви в текущия документ)", +DlgLnkEMail : "Адрес за е-поща", +DlgLnkEMailSubject : "Тема на писмото", +DlgLnkEMailBody : "Текст на писмото", +DlgLnkUpload : "Качи", +DlgLnkBtnUpload : "Прати на сървъра", + +DlgLnkTarget : "Цел", +DlgLnkTargetFrame : "<рамка>", +DlgLnkTargetPopup : "<дъщерен прозорец>", +DlgLnkTargetBlank : "Нов прозорец (_blank)", +DlgLnkTargetParent : "Родителски прозорец (_parent)", +DlgLnkTargetSelf : "Активния прозорец (_self)", +DlgLnkTargetTop : "Целия прозорец (_top)", +DlgLnkTargetFrameName : "Име на целевия прозорец", +DlgLnkPopWinName : "Име на дъщерния прозорец", +DlgLnkPopWinFeat : "Параметри на дъщерния прозорец", +DlgLnkPopResize : "С променливи размери", +DlgLnkPopLocation : "Поле за адрес", +DlgLnkPopMenu : "Меню", +DlgLnkPopScroll : "Плъзгач", +DlgLnkPopStatus : "Поле за статус", +DlgLnkPopToolbar : "Панел с бутони", +DlgLnkPopFullScrn : "Голям екран (MS IE)", +DlgLnkPopDependent : "Зависим (Netscape)", +DlgLnkPopWidth : "Ширина", +DlgLnkPopHeight : "Височина", +DlgLnkPopLeft : "Координати - X", +DlgLnkPopTop : "Координати - Y", + +DlnLnkMsgNoUrl : "Моля, напишете пълния път (URL)", +DlnLnkMsgNoEMail : "Моля, напишете адреса за е-поща", +DlnLnkMsgNoAnchor : "Моля, изберете котва", +DlnLnkMsgInvPopName : "The popup name must begin with an alphabetic character and must not contain spaces", //MISSING + +// Color Dialog +DlgColorTitle : "Изберете цвят", +DlgColorBtnClear : "Изчисти", +DlgColorHighlight : "Текущ", +DlgColorSelected : "Избран", + +// Smiley Dialog +DlgSmileyTitle : "Добави усмивка", + +// Special Character Dialog +DlgSpecialCharTitle : "Изберете специален символ", + +// Table Dialog +DlgTableTitle : "Параметри на таблицата", +DlgTableRows : "Редове", +DlgTableColumns : "Колони", +DlgTableBorder : "Размер на рамката", +DlgTableAlign : "Подравняване", +DlgTableAlignNotSet : "<Не е избрано>", +DlgTableAlignLeft : "Ляво", +DlgTableAlignCenter : "Център", +DlgTableAlignRight : "Дясно", +DlgTableWidth : "Ширина", +DlgTableWidthPx : "пиксели", +DlgTableWidthPc : "проценти", +DlgTableHeight : "Височина", +DlgTableCellSpace : "Разстояние между клетките", +DlgTableCellPad : "Отстъп на съдържанието в клетките", +DlgTableCaption : "Заглавие", +DlgTableSummary : "Резюме", + +// Table Cell Dialog +DlgCellTitle : "Параметри на клетката", +DlgCellWidth : "Ширина", +DlgCellWidthPx : "пиксели", +DlgCellWidthPc : "проценти", +DlgCellHeight : "Височина", +DlgCellWordWrap : "пренасяне на нов ред", +DlgCellWordWrapNotSet : "<Не е настроено>", +DlgCellWordWrapYes : "Да", +DlgCellWordWrapNo : "не", +DlgCellHorAlign : "Хоризонтално подравняване", +DlgCellHorAlignNotSet : "<Не е настроено>", +DlgCellHorAlignLeft : "Ляво", +DlgCellHorAlignCenter : "Център", +DlgCellHorAlignRight: "Дясно", +DlgCellVerAlign : "Вертикално подравняване", +DlgCellVerAlignNotSet : "<Не е настроено>", +DlgCellVerAlignTop : "Горе", +DlgCellVerAlignMiddle : "По средата", +DlgCellVerAlignBottom : "Долу", +DlgCellVerAlignBaseline : "По базовата линия", +DlgCellRowSpan : "повече от един ред", +DlgCellCollSpan : "повече от една колона", +DlgCellBackColor : "фонов цвят", +DlgCellBorderColor : "цвят на рамката", +DlgCellBtnSelect : "Изберете...", + +// Find and Replace Dialog +DlgFindAndReplaceTitle : "Find and Replace", //MISSING + +// Find Dialog +DlgFindTitle : "Търси", +DlgFindFindBtn : "Търси", +DlgFindNotFoundMsg : "Указания текст не беше намерен.", + +// Replace Dialog +DlgReplaceTitle : "Замести", +DlgReplaceFindLbl : "Търси:", +DlgReplaceReplaceLbl : "Замести с:", +DlgReplaceCaseChk : "Със същия регистър", +DlgReplaceReplaceBtn : "Замести", +DlgReplaceReplAllBtn : "Замести всички", +DlgReplaceWordChk : "Търси същата дума", + +// Paste Operations / Dialog +PasteErrorCut : "Настройките за сигурност на вашия бразуър не разрешават на редактора да изпълни изрязването. За целта използвайте клавиатурата (Ctrl+X).", +PasteErrorCopy : "Настройките за сигурност на вашия бразуър не разрешават на редактора да изпълни запаметяването. За целта използвайте клавиатурата (Ctrl+C).", + +PasteAsText : "Вмъкни като чист текст", +PasteFromWord : "Вмъкни от MS Word", + +DlgPasteMsg2 : "Вмъкнете тук съдъжанието с клавиатуарата (Ctrl+V) и натиснете OK.", +DlgPasteSec : "Because of your browser security settings, the editor is not able to access your clipboard data directly. You are required to paste it again in this window.", //MISSING +DlgPasteIgnoreFont : "Игнорирай шрифтовите дефиниции", +DlgPasteRemoveStyles : "Изтрий стиловите дефиниции", +DlgPasteCleanBox : "Изчисти", + +// Color Picker +ColorAutomatic : "По подразбиране", +ColorMoreColors : "Други цветове...", + +// Document Properties +DocProps : "Параметри на документа", + +// Anchor Dialog +DlgAnchorTitle : "Параметри на котвата", +DlgAnchorName : "Име на котвата", +DlgAnchorErrorName : "Моля, въведете име на котвата", + +// Speller Pages Dialog +DlgSpellNotInDic : "Липсва в речника", +DlgSpellChangeTo : "Промени на", +DlgSpellBtnIgnore : "Игнорирай", +DlgSpellBtnIgnoreAll : "Игнорирай всички", +DlgSpellBtnReplace : "Замести", +DlgSpellBtnReplaceAll : "Замести всички", +DlgSpellBtnUndo : "Отмени", +DlgSpellNoSuggestions : "- Няма предложения -", +DlgSpellProgress : "Извършване на проверката за правопис...", +DlgSpellNoMispell : "Проверката за правопис завършена: не са открити правописни грешки", +DlgSpellNoChanges : "Проверката за правопис завършена: няма променени думи", +DlgSpellOneChange : "Проверката за правопис завършена: една дума е променена", +DlgSpellManyChanges : "Проверката за правопис завършена: %1 думи са променени", + +IeSpellDownload : "Инструментът за проверка на правопис не е инсталиран. Желаете ли да го инсталирате ?", + +// Button Dialog +DlgButtonText : "Текст (Стойност)", +DlgButtonType : "Тип", +DlgButtonTypeBtn : "Button", //MISSING +DlgButtonTypeSbm : "Submit", //MISSING +DlgButtonTypeRst : "Reset", //MISSING + +// Checkbox and Radio Button Dialogs +DlgCheckboxName : "Име", +DlgCheckboxValue : "Стойност", +DlgCheckboxSelected : "Отметнато", + +// Form Dialog +DlgFormName : "Име", +DlgFormAction : "Действие", +DlgFormMethod : "Метод", + +// Select Field Dialog +DlgSelectName : "Име", +DlgSelectValue : "Стойност", +DlgSelectSize : "Размер", +DlgSelectLines : "линии", +DlgSelectChkMulti : "Разрешено множествено селектиране", +DlgSelectOpAvail : "Възможни опции", +DlgSelectOpText : "Текст", +DlgSelectOpValue : "Стойност", +DlgSelectBtnAdd : "Добави", +DlgSelectBtnModify : "Промени", +DlgSelectBtnUp : "Нагоре", +DlgSelectBtnDown : "Надолу", +DlgSelectBtnSetValue : "Настрой като избрана стойност", +DlgSelectBtnDelete : "Изтрий", + +// Textarea Dialog +DlgTextareaName : "Име", +DlgTextareaCols : "Колони", +DlgTextareaRows : "Редове", + +// Text Field Dialog +DlgTextName : "Име", +DlgTextValue : "Стойност", +DlgTextCharWidth : "Ширина на символите", +DlgTextMaxChars : "Максимум символи", +DlgTextType : "Тип", +DlgTextTypeText : "Текст", +DlgTextTypePass : "Парола", + +// Hidden Field Dialog +DlgHiddenName : "Име", +DlgHiddenValue : "Стойност", + +// Bulleted List Dialog +BulletedListProp : "Параметри на ненумерирания списък", +NumberedListProp : "Параметри на нумерирания списък", +DlgLstStart : "Start", //MISSING +DlgLstType : "Тип", +DlgLstTypeCircle : "Окръжност", +DlgLstTypeDisc : "Кръг", +DlgLstTypeSquare : "Квадрат", +DlgLstTypeNumbers : "Числа (1, 2, 3)", +DlgLstTypeLCase : "Малки букви (a, b, c)", +DlgLstTypeUCase : "Големи букви (A, B, C)", +DlgLstTypeSRoman : "Малки римски числа (i, ii, iii)", +DlgLstTypeLRoman : "Големи римски числа (I, II, III)", + +// Document Properties Dialog +DlgDocGeneralTab : "Общи", +DlgDocBackTab : "Фон", +DlgDocColorsTab : "Цветове и отстъпи", +DlgDocMetaTab : "Мета данни", + +DlgDocPageTitle : "Заглавие на страницата", +DlgDocLangDir : "Посока на речта", +DlgDocLangDirLTR : "От ляво на дясно", +DlgDocLangDirRTL : "От дясно на ляво", +DlgDocLangCode : "Код на езика", +DlgDocCharSet : "Кодиране на символите", +DlgDocCharSetCE : "Central European", //MISSING +DlgDocCharSetCT : "Chinese Traditional (Big5)", //MISSING +DlgDocCharSetCR : "Cyrillic", //MISSING +DlgDocCharSetGR : "Greek", //MISSING +DlgDocCharSetJP : "Japanese", //MISSING +DlgDocCharSetKR : "Korean", //MISSING +DlgDocCharSetTR : "Turkish", //MISSING +DlgDocCharSetUN : "Unicode (UTF-8)", //MISSING +DlgDocCharSetWE : "Western European", //MISSING +DlgDocCharSetOther : "Друго кодиране на символите", + +DlgDocDocType : "Тип на документа", +DlgDocDocTypeOther : "Друг тип на документа", +DlgDocIncXHTML : "Включи XHTML декларация", +DlgDocBgColor : "Цвят на фона", +DlgDocBgImage : "Пълен път до фоновото изображение", +DlgDocBgNoScroll : "Не-повтарящо се фоново изображение", +DlgDocCText : "Текст", +DlgDocCLink : "Връзка", +DlgDocCVisited : "Посетена връзка", +DlgDocCActive : "Активна връзка", +DlgDocMargins : "Отстъпи на страницата", +DlgDocMaTop : "Горе", +DlgDocMaLeft : "Ляво", +DlgDocMaRight : "Дясно", +DlgDocMaBottom : "Долу", +DlgDocMeIndex : "Ключови думи за документа (разделени със запетаи)", +DlgDocMeDescr : "Описание на документа", +DlgDocMeAuthor : "Автор", +DlgDocMeCopy : "Авторски права", +DlgDocPreview : "Изглед", + +// Templates Dialog +Templates : "Шаблони", +DlgTemplatesTitle : "Шаблони", +DlgTemplatesSelMsg : "Изберете шаблон
    (текущото съдържание на редактора ще бъде загубено):", +DlgTemplatesLoading : "Зареждане на списъка с шаблоните. Моля изчакайте...", +DlgTemplatesNoTpl : "(Няма дефинирани шаблони)", +DlgTemplatesReplace : "Replace actual contents", //MISSING + +// About Dialog +DlgAboutAboutTab : "За", +DlgAboutBrowserInfoTab : "Информация за браузъра", +DlgAboutLicenseTab : "License", //MISSING +DlgAboutVersion : "версия", +DlgAboutInfo : "За повече информация посетете" +}; diff --git a/FCKeditor/editor/lang/bn.js b/FCKeditor/editor/lang/bn.js new file mode 100644 index 0000000..365ee90 --- /dev/null +++ b/FCKeditor/editor/lang/bn.js @@ -0,0 +1,516 @@ +/* + * FCKeditor - The text editor for Internet - http://www.fckeditor.net + * Copyright (C) 2003-2007 Frederico Caldeira Knabben + * + * == BEGIN LICENSE == + * + * Licensed under the terms of any of the following licenses at your + * choice: + * + * - GNU General Public License Version 2 or later (the "GPL") + * http://www.gnu.org/licenses/gpl.html + * + * - GNU Lesser General Public License Version 2.1 or later (the "LGPL") + * http://www.gnu.org/licenses/lgpl.html + * + * - Mozilla Public License Version 1.1 or later (the "MPL") + * http://www.mozilla.org/MPL/MPL-1.1.html + * + * == END LICENSE == + * + * Bengali/Bangla language file. + */ + +var FCKLang = +{ +// Language direction : "ltr" (left to right) or "rtl" (right to left). +Dir : "ltr", + +ToolbarCollapse : "টূলবার গুটিয়ে দাও", +ToolbarExpand : "টূলবার ছড়িয়ে দাও", + +// Toolbar Items and Context Menu +Save : "সংরক্ষন কর", +NewPage : "নতুন পেজ", +Preview : "প্রিভিউ", +Cut : "কাট", +Copy : "কপি", +Paste : "পেস্ট", +PasteText : "পেস্ট (সাদা টেক্সট)", +PasteWord : "পেস্ট (শব্দ)", +Print : "প্রিন্ট", +SelectAll : "সব সিলেক্ট কর", +RemoveFormat : "ফরমেট সরাও", +InsertLinkLbl : "লিংকের যুক্ত করার লেবেল", +InsertLink : "লিংক যুক্ত কর", +RemoveLink : "লিংক সরাও", +Anchor : "নোঙ্গর", +AnchorDelete : "Remove Anchor", //MISSING +InsertImageLbl : "ছবির লেবেল যুক্ত কর", +InsertImage : "ছবি যুক্ত কর", +InsertFlashLbl : "ফ্লাশ লেবেল যুক্ত কর", +InsertFlash : "ফ্লাশ যুক্ত কর", +InsertTableLbl : "টেবিলের লেবেল যুক্ত কর", +InsertTable : "টেবিল যুক্ত কর", +InsertLineLbl : "রেখা যুক্ত কর", +InsertLine : "রেখা যুক্ত কর", +InsertSpecialCharLbl: "বিশেষ অক্ষরের লেবেল যুক্ত কর", +InsertSpecialChar : "বিশেষ অক্ষর যুক্ত কর", +InsertSmileyLbl : "স্মাইলী", +InsertSmiley : "স্মাইলী যুক্ত কর", +About : "FCKeditor কে বানিয়েছে", +Bold : "বোল্ড", +Italic : "ইটালিক", +Underline : "আন্ডারলাইন", +StrikeThrough : "স্ট্রাইক থ্রু", +Subscript : "অধোলেখ", +Superscript : "অভিলেখ", +LeftJustify : "বা দিকে ঘেঁষা", +CenterJustify : "মাঝ বরাবর ঘেষা", +RightJustify : "ডান দিকে ঘেঁষা", +BlockJustify : "ব্লক জাস্টিফাই", +DecreaseIndent : "ইনডেন্ট কমাও", +IncreaseIndent : "ইনডেন্ট বাড়াও", +Blockquote : "Blockquote", //MISSING +Undo : "আনডু", +Redo : "রি-ডু", +NumberedListLbl : "সাংখ্যিক লিস্টের লেবেল", +NumberedList : "সাংখ্যিক লিস্ট", +BulletedListLbl : "বুলেট লিস্ট লেবেল", +BulletedList : "বুলেটেড লিস্ট", +ShowTableBorders : "টেবিল বর্ডার", +ShowDetails : "সবটুকু দেখাও", +Style : "স্টাইল", +FontFormat : "ফন্ট ফরমেট", +Font : "ফন্ট", +FontSize : "সাইজ", +TextColor : "টেক্স্ট রং", +BGColor : "বেকগ্রাউন্ড রং", +Source : "সোর্স", +Find : "খোজো", +Replace : "রিপ্লেস", +SpellCheck : "বানান চেক", +UniversalKeyboard : "সার্বজনীন কিবোর্ড", +PageBreakLbl : "পেজ ব্রেক লেবেল", +PageBreak : "পেজ ব্রেক", + +Form : "ফর্ম", +Checkbox : "চেক বাক্স", +RadioButton : "রেডিও বাটন", +TextField : "টেক্সট ফীল্ড", +Textarea : "টেক্সট এরিয়া", +HiddenField : "গুপ্ত ফীল্ড", +Button : "বাটন", +SelectionField : "বাছাই ফীল্ড", +ImageButton : "ছবির বাটন", + +FitWindow : "উইন্ডো ফিট কর", +ShowBlocks : "Show Blocks", //MISSING + +// Context Menu +EditLink : "লিংক সম্পাদন", +CellCM : "সেল", +RowCM : "রো", +ColumnCM : "কলাম", +InsertRowAfter : "Insert Row After", //MISSING +InsertRowBefore : "Insert Row Before", //MISSING +DeleteRows : "রো মুছে দাও", +InsertColumnAfter : "Insert Column After", //MISSING +InsertColumnBefore : "Insert Column Before", //MISSING +DeleteColumns : "কলাম মুছে দাও", +InsertCellAfter : "Insert Cell After", //MISSING +InsertCellBefore : "Insert Cell Before", //MISSING +DeleteCells : "সেল মুছে দাও", +MergeCells : "সেল জোড়া দাও", +MergeRight : "Merge Right", //MISSING +MergeDown : "Merge Down", //MISSING +HorizontalSplitCell : "Split Cell Horizontally", //MISSING +VerticalSplitCell : "Split Cell Vertically", //MISSING +TableDelete : "টেবিল ডিলীট কর", +CellProperties : "সেলের প্রোপার্টিজ", +TableProperties : "টেবিল প্রোপার্টি", +ImageProperties : "ছবি প্রোপার্টি", +FlashProperties : "ফ্লাশ প্রোপার্টি", + +AnchorProp : "নোঙর প্রোপার্টি", +ButtonProp : "বাটন প্রোপার্টি", +CheckboxProp : "চেক বক্স প্রোপার্টি", +HiddenFieldProp : "গুপ্ত ফীল্ড প্রোপার্টি", +RadioButtonProp : "রেডিও বাটন প্রোপার্টি", +ImageButtonProp : "ছবি বাটন প্রোপার্টি", +TextFieldProp : "টেক্সট ফীল্ড প্রোপার্টি", +SelectionFieldProp : "বাছাই ফীল্ড প্রোপার্টি", +TextareaProp : "টেক্সট এরিয়া প্রোপার্টি", +FormProp : "ফর্ম প্রোপার্টি", + +FontFormats : "সাধারণ;ফর্মেটেড;ঠিকানা;শীর্ষক ১;শীর্ষক ২;শীর্ষক ৩;শীর্ষক ৪;শীর্ষক ৫;শীর্ষক ৬;শীর্ষক (DIV)", + +// Alerts and Messages +ProcessingXHTML : "XHTML প্রসেস করা হচ্ছে", +Done : "শেষ হয়েছে", +PasteWordConfirm : "যে টেকস্টটি আপনি পেস্ট করতে চাচ্ছেন মনে হচ্ছে সেটি ওয়ার্ড থেকে কপি করা। আপনি কি পেস্ট করার আগে একে পরিষ্কার করতে চান?", +NotCompatiblePaste : "এই কমান্ডটি শুধুমাত্র ইন্টারনেট এক্সপ্লোরার ৫.০ বা তার পরের ভার্সনে পাওয়া সম্ভব। আপনি কি পরিষ্কার না করেই পেস্ট করতে চান?", +UnknownToolbarItem : "অজানা টুলবার আইটেম \"%1\"", +UnknownCommand : "অজানা কমান্ড \"%1\"", +NotImplemented : "কমান্ড ইমপ্লিমেন্ট করা হয়নি", +UnknownToolbarSet : "টুলবার সেট \"%1\" এর অস্তিত্ব নেই", +NoActiveX : "আপনার ব্রাউজারের সুরক্ষা সেটিংস কারনে এডিটরের কিছু ফিচার পাওয়া নাও যেতে পারে। আপনাকে অবশ্যই \"Run ActiveX controls and plug-ins\" এনাবেল করে নিতে হবে। আপনি ভুলভ্রান্তি কিছু কিছু ফিচারের অনুপস্থিতি উপলব্ধি করতে পারেন।", +BrowseServerBlocked : "রিসোর্স ব্রাউজার খোলা গেল না। নিশ্চিত করুন যে সব পপআপ ব্লকার বন্ধ করা আছে।", +DialogBlocked : "ডায়ালগ ইউন্ডো খোলা গেল না। নিশ্চিত করুন যে সব পপআপ ব্লকার বন্ধ করা আছে।", + +// Dialogs +DlgBtnOK : "ওকে", +DlgBtnCancel : "বাতিল", +DlgBtnClose : "বন্ধ কর", +DlgBtnBrowseServer : "ব্রাউজ সার্ভার", +DlgAdvancedTag : "এডভান্সড", +DlgOpOther : "<অন্য>", +DlgInfoTab : "তথ্য", +DlgAlertUrl : "দয়া করে URL যুক্ত করুন", + +// General Dialogs Labels +DlgGenNotSet : "<সেট নেই>", +DlgGenId : "আইডি", +DlgGenLangDir : "ভাষা লেখার দিক", +DlgGenLangDirLtr : "বাম থেকে ডান (LTR)", +DlgGenLangDirRtl : "ডান থেকে বাম (RTL)", +DlgGenLangCode : "ভাষা কোড", +DlgGenAccessKey : "এক্সেস কী", +DlgGenName : "নাম", +DlgGenTabIndex : "ট্যাব ইন্ডেক্স", +DlgGenLongDescr : "URL এর লম্বা বর্ণনা", +DlgGenClass : "স্টাইল-শীট ক্লাস", +DlgGenTitle : "পরামর্শ শীর্ষক", +DlgGenContType : "পরামর্শ কন্টেন্টের প্রকার", +DlgGenLinkCharset : "লিংক রিসোর্স ক্যারেক্টর সেট", +DlgGenStyle : "স্টাইল", + +// Image Dialog +DlgImgTitle : "ছবির প্রোপার্টি", +DlgImgInfoTab : "ছবির তথ্য", +DlgImgBtnUpload : "ইহাকে সার্ভারে প্রেরন কর", +DlgImgURL : "URL", +DlgImgUpload : "আপলোড", +DlgImgAlt : "বিকল্প টেক্সট", +DlgImgWidth : "প্রস্থ", +DlgImgHeight : "দৈর্ঘ্য", +DlgImgLockRatio : "অনুপাত লক কর", +DlgBtnResetSize : "সাইজ পূর্বাবস্থায় ফিরিয়ে দাও", +DlgImgBorder : "বর্ডার", +DlgImgHSpace : "হরাইজন্টাল স্পেস", +DlgImgVSpace : "ভার্টিকেল স্পেস", +DlgImgAlign : "এলাইন", +DlgImgAlignLeft : "বামে", +DlgImgAlignAbsBottom: "Abs নীচে", +DlgImgAlignAbsMiddle: "Abs উপর", +DlgImgAlignBaseline : "মূল রেখা", +DlgImgAlignBottom : "নীচে", +DlgImgAlignMiddle : "মধ্য", +DlgImgAlignRight : "ডানে", +DlgImgAlignTextTop : "টেক্সট উপর", +DlgImgAlignTop : "উপর", +DlgImgPreview : "প্রীভিউ", +DlgImgAlertUrl : "অনুগ্রহক করে ছবির URL টাইপ করুন", +DlgImgLinkTab : "লিংক", + +// Flash Dialog +DlgFlashTitle : "ফ্ল্যাশ প্রোপার্টি", +DlgFlashChkPlay : "অটো প্লে", +DlgFlashChkLoop : "লূপ", +DlgFlashChkMenu : "ফ্ল্যাশ মেনু এনাবল কর", +DlgFlashScale : "স্কেল", +DlgFlashScaleAll : "সব দেখাও", +DlgFlashScaleNoBorder : "কোনো বর্ডার নেই", +DlgFlashScaleFit : "নিখুঁত ফিট", + +// Link Dialog +DlgLnkWindowTitle : "লিংক", +DlgLnkInfoTab : "লিংক তথ্য", +DlgLnkTargetTab : "টার্গেট", + +DlgLnkType : "লিংক প্রকার", +DlgLnkTypeURL : "URL", +DlgLnkTypeAnchor : "এই পেজে নোঙর কর", +DlgLnkTypeEMail : "ইমেইল", +DlgLnkProto : "প্রোটোকল", +DlgLnkProtoOther : "<অন্য>", +DlgLnkURL : "URL", +DlgLnkAnchorSel : "নোঙর বাছাই", +DlgLnkAnchorByName : "নোঙরের নাম দিয়ে", +DlgLnkAnchorById : "নোঙরের আইডি দিয়ে", +DlgLnkNoAnchors : "(No anchors available in the document)", //MISSING +DlgLnkEMail : "ইমেইল ঠিকানা", +DlgLnkEMailSubject : "মেসেজের বিষয়", +DlgLnkEMailBody : "মেসেজের দেহ", +DlgLnkUpload : "আপলোড", +DlgLnkBtnUpload : "একে সার্ভারে পাঠাও", + +DlgLnkTarget : "টার্গেট", +DlgLnkTargetFrame : "<ফ্রেম>", +DlgLnkTargetPopup : "<পপআপ উইন্ডো>", +DlgLnkTargetBlank : "নতুন উইন্ডো (_blank)", +DlgLnkTargetParent : "মূল উইন্ডো (_parent)", +DlgLnkTargetSelf : "এই উইন্ডো (_self)", +DlgLnkTargetTop : "শীর্ষ উইন্ডো (_top)", +DlgLnkTargetFrameName : "টার্গেট ফ্রেমের নাম", +DlgLnkPopWinName : "পপআপ উইন্ডোর নাম", +DlgLnkPopWinFeat : "পপআপ উইন্ডো ফীচার সমূহ", +DlgLnkPopResize : "রিসাইজ করা সম্ভব", +DlgLnkPopLocation : "লোকেশন বার", +DlgLnkPopMenu : "মেন্যু বার", +DlgLnkPopScroll : "স্ক্রল বার", +DlgLnkPopStatus : "স্ট্যাটাস বার", +DlgLnkPopToolbar : "টুল বার", +DlgLnkPopFullScrn : "পূর্ণ পর্দা জুড়ে (IE)", +DlgLnkPopDependent : "ডিপেন্ডেন্ট (Netscape)", +DlgLnkPopWidth : "প্রস্থ", +DlgLnkPopHeight : "দৈর্ঘ্য", +DlgLnkPopLeft : "বামের পজিশন", +DlgLnkPopTop : "ডানের পজিশন", + +DlnLnkMsgNoUrl : "অনুগ্রহ করে URL লিংক টাইপ করুন", +DlnLnkMsgNoEMail : "অনুগ্রহ করে ইমেইল এড্রেস টাইপ করুন", +DlnLnkMsgNoAnchor : "অনুগ্রহ করে নোঙর বাছাই করুন", +DlnLnkMsgInvPopName : "The popup name must begin with an alphabetic character and must not contain spaces", //MISSING + +// Color Dialog +DlgColorTitle : "রং বাছাই কর", +DlgColorBtnClear : "পরিষ্কার কর", +DlgColorHighlight : "হাইলাইট", +DlgColorSelected : "সিলেক্টেড", + +// Smiley Dialog +DlgSmileyTitle : "স্মাইলী যুক্ত কর", + +// Special Character Dialog +DlgSpecialCharTitle : "বিশেষ ক্যারেক্টার বাছাই কর", + +// Table Dialog +DlgTableTitle : "টেবিল প্রোপার্টি", +DlgTableRows : "রো", +DlgTableColumns : "কলাম", +DlgTableBorder : "বর্ডার সাইজ", +DlgTableAlign : "এলাইনমেন্ট", +DlgTableAlignNotSet : "<সেট নেই>", +DlgTableAlignLeft : "বামে", +DlgTableAlignCenter : "মাঝখানে", +DlgTableAlignRight : "ডানে", +DlgTableWidth : "প্রস্থ", +DlgTableWidthPx : "পিক্সেল", +DlgTableWidthPc : "শতকরা", +DlgTableHeight : "দৈর্ঘ্য", +DlgTableCellSpace : "সেল স্পেস", +DlgTableCellPad : "সেল প্যাডিং", +DlgTableCaption : "শীর্ষক", +DlgTableSummary : "সারাংশ", + +// Table Cell Dialog +DlgCellTitle : "সেল প্রোপার্টি", +DlgCellWidth : "প্রস্থ", +DlgCellWidthPx : "পিক্সেল", +DlgCellWidthPc : "শতকরা", +DlgCellHeight : "দৈর্ঘ্য", +DlgCellWordWrap : "ওয়ার্ড রেপ", +DlgCellWordWrapNotSet : "<সেট নেই>", +DlgCellWordWrapYes : "হাঁ", +DlgCellWordWrapNo : "না", +DlgCellHorAlign : "হরাইজন্টাল এলাইনমেন্ট", +DlgCellHorAlignNotSet : "<সেট নেই>", +DlgCellHorAlignLeft : "বামে", +DlgCellHorAlignCenter : "মাঝখানে", +DlgCellHorAlignRight: "ডানে", +DlgCellVerAlign : "ভার্টিক্যাল এলাইনমেন্ট", +DlgCellVerAlignNotSet : "<সেট নেই>", +DlgCellVerAlignTop : "উপর", +DlgCellVerAlignMiddle : "মধ্য", +DlgCellVerAlignBottom : "নীচে", +DlgCellVerAlignBaseline : "মূলরেখা", +DlgCellRowSpan : "রো স্প্যান", +DlgCellCollSpan : "কলাম স্প্যান", +DlgCellBackColor : "ব্যাকগ্রাউন্ড রং", +DlgCellBorderColor : "বর্ডারের রং", +DlgCellBtnSelect : "বাছাই কর", + +// Find and Replace Dialog +DlgFindAndReplaceTitle : "Find and Replace", //MISSING + +// Find Dialog +DlgFindTitle : "খোঁজো", +DlgFindFindBtn : "খোঁজো", +DlgFindNotFoundMsg : "আপনার উল্লেখিত টেকস্ট পাওয়া যায়নি", + +// Replace Dialog +DlgReplaceTitle : "বদলে দাও", +DlgReplaceFindLbl : "যা খুঁজতে হবে:", +DlgReplaceReplaceLbl : "যার সাথে বদলাতে হবে:", +DlgReplaceCaseChk : "কেস মিলাও", +DlgReplaceReplaceBtn : "বদলে দাও", +DlgReplaceReplAllBtn : "সব বদলে দাও", +DlgReplaceWordChk : "পুরা শব্দ মেলাও", + +// Paste Operations / Dialog +PasteErrorCut : "আপনার ব্রাউজারের সুরক্ষা সেটিংস এডিটরকে অটোমেটিক কাট করার অনুমতি দেয়নি। দয়া করে এই কাজের জন্য কিবোর্ড ব্যবহার করুন (Ctrl+X)।", +PasteErrorCopy : "আপনার ব্রাউজারের সুরক্ষা সেটিংস এডিটরকে অটোমেটিক কপি করার অনুমতি দেয়নি। দয়া করে এই কাজের জন্য কিবোর্ড ব্যবহার করুন (Ctrl+C)।", + +PasteAsText : "সাদা টেক্সট হিসেবে পেস্ট কর", +PasteFromWord : "ওয়ার্ড থেকে পেস্ট কর", + +DlgPasteMsg2 : "অনুগ্রহ করে নীচের বাক্সে কিবোর্ড ব্যবহার করে (Ctrl+V) পেস্ট করুন এবং OK চাপ দিন", +DlgPasteSec : "Because of your browser security settings, the editor is not able to access your clipboard data directly. You are required to paste it again in this window.", //MISSING +DlgPasteIgnoreFont : "ফন্ট ফেস ডেফিনেশন ইগনোর করুন", +DlgPasteRemoveStyles : "স্টাইল ডেফিনেশন সরিয়ে দিন", +DlgPasteCleanBox : "বাক্স পরিষ্কার করুন", + +// Color Picker +ColorAutomatic : "অটোমেটিক", +ColorMoreColors : "আরও রং...", + +// Document Properties +DocProps : "ডক্যুমেন্ট প্রোপার্টি", + +// Anchor Dialog +DlgAnchorTitle : "নোঙরের প্রোপার্টি", +DlgAnchorName : "নোঙরের নাম", +DlgAnchorErrorName : "নোঙরের নাম টাইপ করুন", + +// Speller Pages Dialog +DlgSpellNotInDic : "শব্দকোষে নেই", +DlgSpellChangeTo : "এতে বদলাও", +DlgSpellBtnIgnore : "ইগনোর কর", +DlgSpellBtnIgnoreAll : "সব ইগনোর কর", +DlgSpellBtnReplace : "বদলে দাও", +DlgSpellBtnReplaceAll : "সব বদলে দাও", +DlgSpellBtnUndo : "আন্ডু", +DlgSpellNoSuggestions : "- কোন সাজেশন নেই -", +DlgSpellProgress : "বানান পরীক্ষা চলছে...", +DlgSpellNoMispell : "বানান পরীক্ষা শেষ: কোন ভুল বানান পাওয়া যায়নি", +DlgSpellNoChanges : "বানান পরীক্ষা শেষ: কোন শব্দ পরিবর্তন করা হয়নি", +DlgSpellOneChange : "বানান পরীক্ষা শেষ: একটি মাত্র শব্দ পরিবর্তন করা হয়েছে", +DlgSpellManyChanges : "বানান পরীক্ষা শেষ: %1 গুলো শব্দ বদলে গ্যাছে", + +IeSpellDownload : "বানান পরীক্ষক ইনস্টল করা নেই। আপনি কি এখনই এটা ডাউনলোড করতে চান?", + +// Button Dialog +DlgButtonText : "টেক্সট (ভ্যালু)", +DlgButtonType : "প্রকার", +DlgButtonTypeBtn : "Button", //MISSING +DlgButtonTypeSbm : "Submit", //MISSING +DlgButtonTypeRst : "Reset", //MISSING + +// Checkbox and Radio Button Dialogs +DlgCheckboxName : "নাম", +DlgCheckboxValue : "ভ্যালু", +DlgCheckboxSelected : "সিলেক্টেড", + +// Form Dialog +DlgFormName : "নাম", +DlgFormAction : "একশ্যন", +DlgFormMethod : "পদ্ধতি", + +// Select Field Dialog +DlgSelectName : "নাম", +DlgSelectValue : "ভ্যালু", +DlgSelectSize : "সাইজ", +DlgSelectLines : "লাইন সমূহ", +DlgSelectChkMulti : "একাধিক সিলেকশন এলাউ কর", +DlgSelectOpAvail : "অন্যান্য বিকল্প", +DlgSelectOpText : "টেক্সট", +DlgSelectOpValue : "ভ্যালু", +DlgSelectBtnAdd : "যুক্ত", +DlgSelectBtnModify : "বদলে দাও", +DlgSelectBtnUp : "উপর", +DlgSelectBtnDown : "নীচে", +DlgSelectBtnSetValue : "বাছাই করা ভ্যালু হিসেবে সেট কর", +DlgSelectBtnDelete : "ডিলীট", + +// Textarea Dialog +DlgTextareaName : "নাম", +DlgTextareaCols : "কলাম", +DlgTextareaRows : "রো", + +// Text Field Dialog +DlgTextName : "নাম", +DlgTextValue : "ভ্যালু", +DlgTextCharWidth : "ক্যারেক্টার প্রশস্ততা", +DlgTextMaxChars : "সর্বাধিক ক্যারেক্টার", +DlgTextType : "টাইপ", +DlgTextTypeText : "টেক্সট", +DlgTextTypePass : "পাসওয়ার্ড", + +// Hidden Field Dialog +DlgHiddenName : "নাম", +DlgHiddenValue : "ভ্যালু", + +// Bulleted List Dialog +BulletedListProp : "বুলেটেড সূচী প্রোপার্টি", +NumberedListProp : "সাংখ্যিক সূচী প্রোপার্টি", +DlgLstStart : "Start", //MISSING +DlgLstType : "প্রকার", +DlgLstTypeCircle : "গোল", +DlgLstTypeDisc : "ডিস্ক", +DlgLstTypeSquare : "চৌকোণা", +DlgLstTypeNumbers : "সংখ্যা (1, 2, 3)", +DlgLstTypeLCase : "ছোট অক্ষর (a, b, c)", +DlgLstTypeUCase : "বড় অক্ষর (A, B, C)", +DlgLstTypeSRoman : "ছোট রোমান সংখ্যা (i, ii, iii)", +DlgLstTypeLRoman : "বড় রোমান সংখ্যা (I, II, III)", + +// Document Properties Dialog +DlgDocGeneralTab : "সাধারন", +DlgDocBackTab : "ব্যাকগ্রাউন্ড", +DlgDocColorsTab : "রং এবং মার্জিন", +DlgDocMetaTab : "মেটাডেটা", + +DlgDocPageTitle : "পেজ শীর্ষক", +DlgDocLangDir : "ভাষা লিখার দিক", +DlgDocLangDirLTR : "বাম থেকে ডানে (LTR)", +DlgDocLangDirRTL : "ডান থেকে বামে (RTL)", +DlgDocLangCode : "ভাষা কোড", +DlgDocCharSet : "ক্যারেক্টার সেট এনকোডিং", +DlgDocCharSetCE : "Central European", //MISSING +DlgDocCharSetCT : "Chinese Traditional (Big5)", //MISSING +DlgDocCharSetCR : "Cyrillic", //MISSING +DlgDocCharSetGR : "Greek", //MISSING +DlgDocCharSetJP : "Japanese", //MISSING +DlgDocCharSetKR : "Korean", //MISSING +DlgDocCharSetTR : "Turkish", //MISSING +DlgDocCharSetUN : "Unicode (UTF-8)", //MISSING +DlgDocCharSetWE : "Western European", //MISSING +DlgDocCharSetOther : "অন্য ক্যারেক্টার সেট এনকোডিং", + +DlgDocDocType : "ডক্যুমেন্ট টাইপ হেডিং", +DlgDocDocTypeOther : "অন্য ডক্যুমেন্ট টাইপ হেডিং", +DlgDocIncXHTML : "XHTML ডেক্লারেশন যুক্ত কর", +DlgDocBgColor : "ব্যাকগ্রাউন্ড রং", +DlgDocBgImage : "ব্যাকগ্রাউন্ড ছবির URL", +DlgDocBgNoScroll : "স্ক্রলহীন ব্যাকগ্রাউন্ড", +DlgDocCText : "টেক্সট", +DlgDocCLink : "লিংক", +DlgDocCVisited : "ভিজিট করা লিংক", +DlgDocCActive : "সক্রিয় লিংক", +DlgDocMargins : "পেজ মার্জিন", +DlgDocMaTop : "উপর", +DlgDocMaLeft : "বামে", +DlgDocMaRight : "ডানে", +DlgDocMaBottom : "নীচে", +DlgDocMeIndex : "ডক্যুমেন্ট ইন্ডেক্স কিওয়ার্ড (কমা দ্বারা বিচ্ছিন্ন)", +DlgDocMeDescr : "ডক্যূমেন্ট বর্ণনা", +DlgDocMeAuthor : "লেখক", +DlgDocMeCopy : "কপীরাইট", +DlgDocPreview : "প্রীভিউ", + +// Templates Dialog +Templates : "টেমপ্লেট", +DlgTemplatesTitle : "কনটেন্ট টেমপ্লেট", +DlgTemplatesSelMsg : "অনুগ্রহ করে এডিটরে ওপেন করার জন্য টেমপ্লেট বাছাই করুন
    (আসল কনটেন্ট হারিয়ে যাবে):", +DlgTemplatesLoading : "টেমপ্লেট লিস্ট হারিয়ে যাবে। অনুগ্রহ করে অপেক্ষা করুন...", +DlgTemplatesNoTpl : "(কোন টেমপ্লেট ডিফাইন করা নেই)", +DlgTemplatesReplace : "Replace actual contents", //MISSING + +// About Dialog +DlgAboutAboutTab : "কে বানিয়েছে", +DlgAboutBrowserInfoTab : "ব্রাউজারের ব্যাপারে তথ্য", +DlgAboutLicenseTab : "লাইসেন্স", +DlgAboutVersion : "ভার্সন", +DlgAboutInfo : "আরও তথ্যের জন্য যান" +}; diff --git a/FCKeditor/editor/lang/bs.js b/FCKeditor/editor/lang/bs.js new file mode 100644 index 0000000..7d4f6cc --- /dev/null +++ b/FCKeditor/editor/lang/bs.js @@ -0,0 +1,516 @@ +/* + * FCKeditor - The text editor for Internet - http://www.fckeditor.net + * Copyright (C) 2003-2007 Frederico Caldeira Knabben + * + * == BEGIN LICENSE == + * + * Licensed under the terms of any of the following licenses at your + * choice: + * + * - GNU General Public License Version 2 or later (the "GPL") + * http://www.gnu.org/licenses/gpl.html + * + * - GNU Lesser General Public License Version 2.1 or later (the "LGPL") + * http://www.gnu.org/licenses/lgpl.html + * + * - Mozilla Public License Version 1.1 or later (the "MPL") + * http://www.mozilla.org/MPL/MPL-1.1.html + * + * == END LICENSE == + * + * Bosnian language file. + */ + +var FCKLang = +{ +// Language direction : "ltr" (left to right) or "rtl" (right to left). +Dir : "ltr", + +ToolbarCollapse : "Skupi trake sa alatima", +ToolbarExpand : "Otvori trake sa alatima", + +// Toolbar Items and Context Menu +Save : "Snimi", +NewPage : "Novi dokument", +Preview : "Prikaži", +Cut : "Izreži", +Copy : "Kopiraj", +Paste : "Zalijepi", +PasteText : "Zalijepi kao obièan tekst", +PasteWord : "Zalijepi iz Word-a", +Print : "Štampaj", +SelectAll : "Selektuj sve", +RemoveFormat : "Poništi format", +InsertLinkLbl : "Link", +InsertLink : "Ubaci/Izmjeni link", +RemoveLink : "Izbriši link", +Anchor : "Insert/Edit Anchor", //MISSING +AnchorDelete : "Remove Anchor", //MISSING +InsertImageLbl : "Slika", +InsertImage : "Ubaci/Izmjeni sliku", +InsertFlashLbl : "Flash", //MISSING +InsertFlash : "Insert/Edit Flash", //MISSING +InsertTableLbl : "Tabela", +InsertTable : "Ubaci/Izmjeni tabelu", +InsertLineLbl : "Linija", +InsertLine : "Ubaci horizontalnu liniju", +InsertSpecialCharLbl: "Specijalni karakter", +InsertSpecialChar : "Ubaci specijalni karater", +InsertSmileyLbl : "Smješko", +InsertSmiley : "Ubaci smješka", +About : "O FCKeditor-u", +Bold : "Boldiraj", +Italic : "Ukosi", +Underline : "Podvuci", +StrikeThrough : "Precrtaj", +Subscript : "Subscript", +Superscript : "Superscript", +LeftJustify : "Lijevo poravnanje", +CenterJustify : "Centralno poravnanje", +RightJustify : "Desno poravnanje", +BlockJustify : "Puno poravnanje", +DecreaseIndent : "Smanji uvod", +IncreaseIndent : "Poveæaj uvod", +Blockquote : "Blockquote", //MISSING +Undo : "Vrati", +Redo : "Ponovi", +NumberedListLbl : "Numerisana lista", +NumberedList : "Ubaci/Izmjeni numerisanu listu", +BulletedListLbl : "Lista", +BulletedList : "Ubaci/Izmjeni listu", +ShowTableBorders : "Pokaži okvire tabela", +ShowDetails : "Pokaži detalje", +Style : "Stil", +FontFormat : "Format", +Font : "Font", +FontSize : "Velièina", +TextColor : "Boja teksta", +BGColor : "Boja pozadine", +Source : "HTML kôd", +Find : "Naði", +Replace : "Zamjeni", +SpellCheck : "Check Spelling", //MISSING +UniversalKeyboard : "Universal Keyboard", //MISSING +PageBreakLbl : "Page Break", //MISSING +PageBreak : "Insert Page Break", //MISSING + +Form : "Form", //MISSING +Checkbox : "Checkbox", //MISSING +RadioButton : "Radio Button", //MISSING +TextField : "Text Field", //MISSING +Textarea : "Textarea", //MISSING +HiddenField : "Hidden Field", //MISSING +Button : "Button", //MISSING +SelectionField : "Selection Field", //MISSING +ImageButton : "Image Button", //MISSING + +FitWindow : "Maximize the editor size", //MISSING +ShowBlocks : "Show Blocks", //MISSING + +// Context Menu +EditLink : "Izmjeni link", +CellCM : "Cell", //MISSING +RowCM : "Row", //MISSING +ColumnCM : "Column", //MISSING +InsertRowAfter : "Insert Row After", //MISSING +InsertRowBefore : "Insert Row Before", //MISSING +DeleteRows : "Briši redove", +InsertColumnAfter : "Insert Column After", //MISSING +InsertColumnBefore : "Insert Column Before", //MISSING +DeleteColumns : "Briši kolone", +InsertCellAfter : "Insert Cell After", //MISSING +InsertCellBefore : "Insert Cell Before", //MISSING +DeleteCells : "Briši æelije", +MergeCells : "Spoji æelije", +MergeRight : "Merge Right", //MISSING +MergeDown : "Merge Down", //MISSING +HorizontalSplitCell : "Split Cell Horizontally", //MISSING +VerticalSplitCell : "Split Cell Vertically", //MISSING +TableDelete : "Delete Table", //MISSING +CellProperties : "Svojstva æelije", +TableProperties : "Svojstva tabele", +ImageProperties : "Svojstva slike", +FlashProperties : "Flash Properties", //MISSING + +AnchorProp : "Anchor Properties", //MISSING +ButtonProp : "Button Properties", //MISSING +CheckboxProp : "Checkbox Properties", //MISSING +HiddenFieldProp : "Hidden Field Properties", //MISSING +RadioButtonProp : "Radio Button Properties", //MISSING +ImageButtonProp : "Image Button Properties", //MISSING +TextFieldProp : "Text Field Properties", //MISSING +SelectionFieldProp : "Selection Field Properties", //MISSING +TextareaProp : "Textarea Properties", //MISSING +FormProp : "Form Properties", //MISSING + +FontFormats : "Normal;Formatted;Address;Heading 1;Heading 2;Heading 3;Heading 4;Heading 5;Heading 6", + +// Alerts and Messages +ProcessingXHTML : "Procesiram XHTML. Molim saèekajte...", +Done : "Gotovo", +PasteWordConfirm : "Tekst koji želite zalijepiti èini se da je kopiran iz Worda. Da li želite da se prvo oèisti?", +NotCompatiblePaste : "Ova komanda je podržana u Internet Explorer-u verzijama 5.5 ili novijim. Da li želite da izvršite lijepljenje teksta bez èišæenja?", +UnknownToolbarItem : "Nepoznata stavka sa trake sa alatima \"%1\"", +UnknownCommand : "Nepoznata komanda \"%1\"", +NotImplemented : "Komanda nije implementirana", +UnknownToolbarSet : "Traka sa alatima \"%1\" ne postoji", +NoActiveX : "Your browser's security settings could limit some features of the editor. You must enable the option \"Run ActiveX controls and plug-ins\". You may experience errors and notice missing features.", //MISSING +BrowseServerBlocked : "The resources browser could not be opened. Make sure that all popup blockers are disabled.", //MISSING +DialogBlocked : "It was not possible to open the dialog window. Make sure all popup blockers are disabled.", //MISSING + +// Dialogs +DlgBtnOK : "OK", +DlgBtnCancel : "Odustani", +DlgBtnClose : "Zatvori", +DlgBtnBrowseServer : "Browse Server", //MISSING +DlgAdvancedTag : "Naprednije", +DlgOpOther : "", //MISSING +DlgInfoTab : "Info", //MISSING +DlgAlertUrl : "Please insert the URL", //MISSING + +// General Dialogs Labels +DlgGenNotSet : "", +DlgGenId : "Id", +DlgGenLangDir : "Smjer pisanja", +DlgGenLangDirLtr : "S lijeva na desno (LTR)", +DlgGenLangDirRtl : "S desna na lijevo (RTL)", +DlgGenLangCode : "Jezièni kôd", +DlgGenAccessKey : "Pristupna tipka", +DlgGenName : "Naziv", +DlgGenTabIndex : "Tab indeks", +DlgGenLongDescr : "Dugaèki opis URL-a", +DlgGenClass : "Klase CSS stilova", +DlgGenTitle : "Advisory title", +DlgGenContType : "Advisory vrsta sadržaja", +DlgGenLinkCharset : "Linked Resource Charset", +DlgGenStyle : "Stil", + +// Image Dialog +DlgImgTitle : "Svojstva slike", +DlgImgInfoTab : "Info slike", +DlgImgBtnUpload : "Šalji na server", +DlgImgURL : "URL", +DlgImgUpload : "Šalji", +DlgImgAlt : "Tekst na slici", +DlgImgWidth : "Širina", +DlgImgHeight : "Visina", +DlgImgLockRatio : "Zakljuèaj odnos", +DlgBtnResetSize : "Resetuj dimenzije", +DlgImgBorder : "Okvir", +DlgImgHSpace : "HSpace", +DlgImgVSpace : "VSpace", +DlgImgAlign : "Poravnanje", +DlgImgAlignLeft : "Lijevo", +DlgImgAlignAbsBottom: "Abs dole", +DlgImgAlignAbsMiddle: "Abs sredina", +DlgImgAlignBaseline : "Bazno", +DlgImgAlignBottom : "Dno", +DlgImgAlignMiddle : "Sredina", +DlgImgAlignRight : "Desno", +DlgImgAlignTextTop : "Vrh teksta", +DlgImgAlignTop : "Vrh", +DlgImgPreview : "Prikaz", +DlgImgAlertUrl : "Molimo ukucajte URL od slike.", +DlgImgLinkTab : "Link", //MISSING + +// Flash Dialog +DlgFlashTitle : "Flash Properties", //MISSING +DlgFlashChkPlay : "Auto Play", //MISSING +DlgFlashChkLoop : "Loop", //MISSING +DlgFlashChkMenu : "Enable Flash Menu", //MISSING +DlgFlashScale : "Scale", //MISSING +DlgFlashScaleAll : "Show all", //MISSING +DlgFlashScaleNoBorder : "No Border", //MISSING +DlgFlashScaleFit : "Exact Fit", //MISSING + +// Link Dialog +DlgLnkWindowTitle : "Link", +DlgLnkInfoTab : "Link info", +DlgLnkTargetTab : "Prozor", + +DlgLnkType : "Tip linka", +DlgLnkTypeURL : "URL", +DlgLnkTypeAnchor : "Sidro na ovoj stranici", +DlgLnkTypeEMail : "E-Mail", +DlgLnkProto : "Protokol", +DlgLnkProtoOther : "", +DlgLnkURL : "URL", +DlgLnkAnchorSel : "Izaberi sidro", +DlgLnkAnchorByName : "Po nazivu sidra", +DlgLnkAnchorById : "Po Id-u elementa", +DlgLnkNoAnchors : "(Nema dostupnih sidra na stranici)", +DlgLnkEMail : "E-Mail Adresa", +DlgLnkEMailSubject : "Subjekt poruke", +DlgLnkEMailBody : "Poruka", +DlgLnkUpload : "Šalji", +DlgLnkBtnUpload : "Šalji na server", + +DlgLnkTarget : "Prozor", +DlgLnkTargetFrame : "", +DlgLnkTargetPopup : "", +DlgLnkTargetBlank : "Novi prozor (_blank)", +DlgLnkTargetParent : "Glavni prozor (_parent)", +DlgLnkTargetSelf : "Isti prozor (_self)", +DlgLnkTargetTop : "Najgornji prozor (_top)", +DlgLnkTargetFrameName : "Target Frame Name", //MISSING +DlgLnkPopWinName : "Naziv popup prozora", +DlgLnkPopWinFeat : "Moguænosti popup prozora", +DlgLnkPopResize : "Promjenljive velièine", +DlgLnkPopLocation : "Traka za lokaciju", +DlgLnkPopMenu : "Izborna traka", +DlgLnkPopScroll : "Scroll traka", +DlgLnkPopStatus : "Statusna traka", +DlgLnkPopToolbar : "Traka sa alatima", +DlgLnkPopFullScrn : "Cijeli ekran (IE)", +DlgLnkPopDependent : "Ovisno (Netscape)", +DlgLnkPopWidth : "Širina", +DlgLnkPopHeight : "Visina", +DlgLnkPopLeft : "Lijeva pozicija", +DlgLnkPopTop : "Gornja pozicija", + +DlnLnkMsgNoUrl : "Molimo ukucajte URL link", +DlnLnkMsgNoEMail : "Molimo ukucajte e-mail adresu", +DlnLnkMsgNoAnchor : "Molimo izaberite sidro", +DlnLnkMsgInvPopName : "The popup name must begin with an alphabetic character and must not contain spaces", //MISSING + +// Color Dialog +DlgColorTitle : "Izaberi boju", +DlgColorBtnClear : "Oèisti", +DlgColorHighlight : "Igled", +DlgColorSelected : "Selektovana", + +// Smiley Dialog +DlgSmileyTitle : "Ubaci smješka", + +// Special Character Dialog +DlgSpecialCharTitle : "Izaberi specijalni karakter", + +// Table Dialog +DlgTableTitle : "Svojstva tabele", +DlgTableRows : "Redova", +DlgTableColumns : "Kolona", +DlgTableBorder : "Okvir", +DlgTableAlign : "Poravnanje", +DlgTableAlignNotSet : "", +DlgTableAlignLeft : "Lijevo", +DlgTableAlignCenter : "Centar", +DlgTableAlignRight : "Desno", +DlgTableWidth : "Širina", +DlgTableWidthPx : "piksela", +DlgTableWidthPc : "posto", +DlgTableHeight : "Visina", +DlgTableCellSpace : "Razmak æelija", +DlgTableCellPad : "Uvod æelija", +DlgTableCaption : "Naslov", +DlgTableSummary : "Summary", //MISSING + +// Table Cell Dialog +DlgCellTitle : "Svojstva æelije", +DlgCellWidth : "Širina", +DlgCellWidthPx : "piksela", +DlgCellWidthPc : "posto", +DlgCellHeight : "Visina", +DlgCellWordWrap : "Vrapuj tekst", +DlgCellWordWrapNotSet : "", +DlgCellWordWrapYes : "Da", +DlgCellWordWrapNo : "Ne", +DlgCellHorAlign : "Horizontalno poravnanje", +DlgCellHorAlignNotSet : "", +DlgCellHorAlignLeft : "Lijevo", +DlgCellHorAlignCenter : "Centar", +DlgCellHorAlignRight: "Desno", +DlgCellVerAlign : "Vertikalno poravnanje", +DlgCellVerAlignNotSet : "", +DlgCellVerAlignTop : "Gore", +DlgCellVerAlignMiddle : "Sredina", +DlgCellVerAlignBottom : "Dno", +DlgCellVerAlignBaseline : "Bazno", +DlgCellRowSpan : "Spajanje æelija", +DlgCellCollSpan : "Spajanje kolona", +DlgCellBackColor : "Boja pozadine", +DlgCellBorderColor : "Boja okvira", +DlgCellBtnSelect : "Selektuj...", + +// Find and Replace Dialog +DlgFindAndReplaceTitle : "Find and Replace", //MISSING + +// Find Dialog +DlgFindTitle : "Naði", +DlgFindFindBtn : "Naði", +DlgFindNotFoundMsg : "Traženi tekst nije pronaðen.", + +// Replace Dialog +DlgReplaceTitle : "Zamjeni", +DlgReplaceFindLbl : "Naði šta:", +DlgReplaceReplaceLbl : "Zamjeni sa:", +DlgReplaceCaseChk : "Uporeðuj velika/mala slova", +DlgReplaceReplaceBtn : "Zamjeni", +DlgReplaceReplAllBtn : "Zamjeni sve", +DlgReplaceWordChk : "Uporeðuj samo cijelu rijeè", + +// Paste Operations / Dialog +PasteErrorCut : "Sigurnosne postavke vašeg pretraživaèa ne dozvoljavaju operacije automatskog rezanja. Molimo koristite kraticu na tastaturi (Ctrl+X).", +PasteErrorCopy : "Sigurnosne postavke Vašeg pretraživaèa ne dozvoljavaju operacije automatskog kopiranja. Molimo koristite kraticu na tastaturi (Ctrl+C).", + +PasteAsText : "Zalijepi kao obièan tekst", +PasteFromWord : "Zalijepi iz Word-a", + +DlgPasteMsg2 : "Please paste inside the following box using the keyboard (Ctrl+V) and hit OK.", //MISSING +DlgPasteSec : "Because of your browser security settings, the editor is not able to access your clipboard data directly. You are required to paste it again in this window.", //MISSING +DlgPasteIgnoreFont : "Ignore Font Face definitions", //MISSING +DlgPasteRemoveStyles : "Remove Styles definitions", //MISSING +DlgPasteCleanBox : "Clean Up Box", //MISSING + +// Color Picker +ColorAutomatic : "Automatska", +ColorMoreColors : "Više boja...", + +// Document Properties +DocProps : "Document Properties", //MISSING + +// Anchor Dialog +DlgAnchorTitle : "Anchor Properties", //MISSING +DlgAnchorName : "Anchor Name", //MISSING +DlgAnchorErrorName : "Please type the anchor name", //MISSING + +// Speller Pages Dialog +DlgSpellNotInDic : "Not in dictionary", //MISSING +DlgSpellChangeTo : "Change to", //MISSING +DlgSpellBtnIgnore : "Ignore", //MISSING +DlgSpellBtnIgnoreAll : "Ignore All", //MISSING +DlgSpellBtnReplace : "Replace", //MISSING +DlgSpellBtnReplaceAll : "Replace All", //MISSING +DlgSpellBtnUndo : "Undo", //MISSING +DlgSpellNoSuggestions : "- No suggestions -", //MISSING +DlgSpellProgress : "Spell check in progress...", //MISSING +DlgSpellNoMispell : "Spell check complete: No misspellings found", //MISSING +DlgSpellNoChanges : "Spell check complete: No words changed", //MISSING +DlgSpellOneChange : "Spell check complete: One word changed", //MISSING +DlgSpellManyChanges : "Spell check complete: %1 words changed", //MISSING + +IeSpellDownload : "Spell checker not installed. Do you want to download it now?", //MISSING + +// Button Dialog +DlgButtonText : "Text (Value)", //MISSING +DlgButtonType : "Type", //MISSING +DlgButtonTypeBtn : "Button", //MISSING +DlgButtonTypeSbm : "Submit", //MISSING +DlgButtonTypeRst : "Reset", //MISSING + +// Checkbox and Radio Button Dialogs +DlgCheckboxName : "Name", //MISSING +DlgCheckboxValue : "Value", //MISSING +DlgCheckboxSelected : "Selected", //MISSING + +// Form Dialog +DlgFormName : "Name", //MISSING +DlgFormAction : "Action", //MISSING +DlgFormMethod : "Method", //MISSING + +// Select Field Dialog +DlgSelectName : "Name", //MISSING +DlgSelectValue : "Value", //MISSING +DlgSelectSize : "Size", //MISSING +DlgSelectLines : "lines", //MISSING +DlgSelectChkMulti : "Allow multiple selections", //MISSING +DlgSelectOpAvail : "Available Options", //MISSING +DlgSelectOpText : "Text", //MISSING +DlgSelectOpValue : "Value", //MISSING +DlgSelectBtnAdd : "Add", //MISSING +DlgSelectBtnModify : "Modify", //MISSING +DlgSelectBtnUp : "Up", //MISSING +DlgSelectBtnDown : "Down", //MISSING +DlgSelectBtnSetValue : "Set as selected value", //MISSING +DlgSelectBtnDelete : "Delete", //MISSING + +// Textarea Dialog +DlgTextareaName : "Name", //MISSING +DlgTextareaCols : "Columns", //MISSING +DlgTextareaRows : "Rows", //MISSING + +// Text Field Dialog +DlgTextName : "Name", //MISSING +DlgTextValue : "Value", //MISSING +DlgTextCharWidth : "Character Width", //MISSING +DlgTextMaxChars : "Maximum Characters", //MISSING +DlgTextType : "Type", //MISSING +DlgTextTypeText : "Text", //MISSING +DlgTextTypePass : "Password", //MISSING + +// Hidden Field Dialog +DlgHiddenName : "Name", //MISSING +DlgHiddenValue : "Value", //MISSING + +// Bulleted List Dialog +BulletedListProp : "Bulleted List Properties", //MISSING +NumberedListProp : "Numbered List Properties", //MISSING +DlgLstStart : "Start", //MISSING +DlgLstType : "Type", //MISSING +DlgLstTypeCircle : "Circle", //MISSING +DlgLstTypeDisc : "Disc", //MISSING +DlgLstTypeSquare : "Square", //MISSING +DlgLstTypeNumbers : "Numbers (1, 2, 3)", //MISSING +DlgLstTypeLCase : "Lowercase Letters (a, b, c)", //MISSING +DlgLstTypeUCase : "Uppercase Letters (A, B, C)", //MISSING +DlgLstTypeSRoman : "Small Roman Numerals (i, ii, iii)", //MISSING +DlgLstTypeLRoman : "Large Roman Numerals (I, II, III)", //MISSING + +// Document Properties Dialog +DlgDocGeneralTab : "General", //MISSING +DlgDocBackTab : "Background", //MISSING +DlgDocColorsTab : "Colors and Margins", //MISSING +DlgDocMetaTab : "Meta Data", //MISSING + +DlgDocPageTitle : "Page Title", //MISSING +DlgDocLangDir : "Language Direction", //MISSING +DlgDocLangDirLTR : "Left to Right (LTR)", //MISSING +DlgDocLangDirRTL : "Right to Left (RTL)", //MISSING +DlgDocLangCode : "Language Code", //MISSING +DlgDocCharSet : "Character Set Encoding", //MISSING +DlgDocCharSetCE : "Central European", //MISSING +DlgDocCharSetCT : "Chinese Traditional (Big5)", //MISSING +DlgDocCharSetCR : "Cyrillic", //MISSING +DlgDocCharSetGR : "Greek", //MISSING +DlgDocCharSetJP : "Japanese", //MISSING +DlgDocCharSetKR : "Korean", //MISSING +DlgDocCharSetTR : "Turkish", //MISSING +DlgDocCharSetUN : "Unicode (UTF-8)", //MISSING +DlgDocCharSetWE : "Western European", //MISSING +DlgDocCharSetOther : "Other Character Set Encoding", //MISSING + +DlgDocDocType : "Document Type Heading", //MISSING +DlgDocDocTypeOther : "Other Document Type Heading", //MISSING +DlgDocIncXHTML : "Include XHTML Declarations", //MISSING +DlgDocBgColor : "Background Color", //MISSING +DlgDocBgImage : "Background Image URL", //MISSING +DlgDocBgNoScroll : "Nonscrolling Background", //MISSING +DlgDocCText : "Text", //MISSING +DlgDocCLink : "Link", //MISSING +DlgDocCVisited : "Visited Link", //MISSING +DlgDocCActive : "Active Link", //MISSING +DlgDocMargins : "Page Margins", //MISSING +DlgDocMaTop : "Top", //MISSING +DlgDocMaLeft : "Left", //MISSING +DlgDocMaRight : "Right", //MISSING +DlgDocMaBottom : "Bottom", //MISSING +DlgDocMeIndex : "Document Indexing Keywords (comma separated)", //MISSING +DlgDocMeDescr : "Document Description", //MISSING +DlgDocMeAuthor : "Author", //MISSING +DlgDocMeCopy : "Copyright", //MISSING +DlgDocPreview : "Preview", //MISSING + +// Templates Dialog +Templates : "Templates", //MISSING +DlgTemplatesTitle : "Content Templates", //MISSING +DlgTemplatesSelMsg : "Please select the template to open in the editor
    (the actual contents will be lost):", //MISSING +DlgTemplatesLoading : "Loading templates list. Please wait...", //MISSING +DlgTemplatesNoTpl : "(No templates defined)", //MISSING +DlgTemplatesReplace : "Replace actual contents", //MISSING + +// About Dialog +DlgAboutAboutTab : "About", //MISSING +DlgAboutBrowserInfoTab : "Browser Info", //MISSING +DlgAboutLicenseTab : "License", //MISSING +DlgAboutVersion : "verzija", +DlgAboutInfo : "Za više informacija posjetite" +}; diff --git a/FCKeditor/editor/lang/ca.js b/FCKeditor/editor/lang/ca.js new file mode 100644 index 0000000..41ce9d9 --- /dev/null +++ b/FCKeditor/editor/lang/ca.js @@ -0,0 +1,516 @@ +/* + * FCKeditor - The text editor for Internet - http://www.fckeditor.net + * Copyright (C) 2003-2007 Frederico Caldeira Knabben + * + * == BEGIN LICENSE == + * + * Licensed under the terms of any of the following licenses at your + * choice: + * + * - GNU General Public License Version 2 or later (the "GPL") + * http://www.gnu.org/licenses/gpl.html + * + * - GNU Lesser General Public License Version 2.1 or later (the "LGPL") + * http://www.gnu.org/licenses/lgpl.html + * + * - Mozilla Public License Version 1.1 or later (the "MPL") + * http://www.mozilla.org/MPL/MPL-1.1.html + * + * == END LICENSE == + * + * Catalan language file. + */ + +var FCKLang = +{ +// Language direction : "ltr" (left to right) or "rtl" (right to left). +Dir : "ltr", + +ToolbarCollapse : "Col·lapsa la barra", +ToolbarExpand : "Amplia la barra", + +// Toolbar Items and Context Menu +Save : "Desa", +NewPage : "Nova Pàgina", +Preview : "Vista Prèvia", +Cut : "Retalla", +Copy : "Copia", +Paste : "Enganxa", +PasteText : "Enganxa com a text no formatat", +PasteWord : "Enganxa des del Word", +Print : "Imprimeix", +SelectAll : "Selecciona-ho tot", +RemoveFormat : "Elimina Format", +InsertLinkLbl : "Enllaç", +InsertLink : "Insereix/Edita enllaç", +RemoveLink : "Elimina enllaç", +Anchor : "Insereix/Edita àncora", +AnchorDelete : "Elimina àncora", +InsertImageLbl : "Imatge", +InsertImage : "Insereix/Edita imatge", +InsertFlashLbl : "Flash", +InsertFlash : "Insereix/Edita Flash", +InsertTableLbl : "Taula", +InsertTable : "Insereix/Edita taula", +InsertLineLbl : "Línia", +InsertLine : "Insereix línia horitzontal", +InsertSpecialCharLbl: "Caràcter Especial", +InsertSpecialChar : "Insereix caràcter especial", +InsertSmileyLbl : "Icona", +InsertSmiley : "Insereix icona", +About : "Quant a FCKeditor", +Bold : "Negreta", +Italic : "Cursiva", +Underline : "Subratllat", +StrikeThrough : "Barrat", +Subscript : "Subíndex", +Superscript : "Superíndex", +LeftJustify : "Aliniament esquerra", +CenterJustify : "Aliniament centrat", +RightJustify : "Aliniament dreta", +BlockJustify : "Justifica", +DecreaseIndent : "Sagna el text", +IncreaseIndent : "Treu el sagnat del text", +Blockquote : "Bloc de cita", +Undo : "Desfés", +Redo : "Refés", +NumberedListLbl : "Llista numerada", +NumberedList : "Aplica o elimina la llista numerada", +BulletedListLbl : "Llista de pics", +BulletedList : "Aplica o elimina la llista de pics", +ShowTableBorders : "Mostra les vores de les taules", +ShowDetails : "Mostra detalls", +Style : "Estil", +FontFormat : "Format", +Font : "Tipus de lletra", +FontSize : "Mida", +TextColor : "Color de Text", +BGColor : "Color de Fons", +Source : "Codi font", +Find : "Cerca", +Replace : "Reemplaça", +SpellCheck : "Revisa l'ortografia", +UniversalKeyboard : "Teclat universal", +PageBreakLbl : "Salt de pàgina", +PageBreak : "Insereix salt de pàgina", + +Form : "Formulari", +Checkbox : "Casella de verificació", +RadioButton : "Botó d'opció", +TextField : "Camp de text", +Textarea : "Àrea de text", +HiddenField : "Camp ocult", +Button : "Botó", +SelectionField : "Camp de selecció", +ImageButton : "Botó d'imatge", + +FitWindow : "Maximiza la mida de l'editor", +ShowBlocks : "Mostra els blocs", + +// Context Menu +EditLink : "Edita l'enllaç", +CellCM : "Cel·la", +RowCM : "Fila", +ColumnCM : "Columna", +InsertRowAfter : "Insereix fila darrera", +InsertRowBefore : "Insereix fila abans de", +DeleteRows : "Suprimeix una fila", +InsertColumnAfter : "Insereix columna darrera", +InsertColumnBefore : "Insereix columna abans de", +DeleteColumns : "Suprimeix una columna", +InsertCellAfter : "Insereix cel·la darrera", +InsertCellBefore : "Insereix cel·la abans de", +DeleteCells : "Suprimeix les cel·les", +MergeCells : "Fusiona les cel·les", +MergeRight : "Fusiona cap a la dreta", +MergeDown : "Fusiona cap avall", +HorizontalSplitCell : "Divideix la cel·la horitzontalment", +VerticalSplitCell : "Divideix la cel·la verticalment", +TableDelete : "Suprimeix la taula", +CellProperties : "Propietats de la cel·la", +TableProperties : "Propietats de la taula", +ImageProperties : "Propietats de la imatge", +FlashProperties : "Propietats del Flash", + +AnchorProp : "Propietats de l'àncora", +ButtonProp : "Propietats del botó", +CheckboxProp : "Propietats de la casella de verificació", +HiddenFieldProp : "Propietats del camp ocult", +RadioButtonProp : "Propietats del botó d'opció", +ImageButtonProp : "Propietats del botó d'imatge", +TextFieldProp : "Propietats del camp de text", +SelectionFieldProp : "Propietats del camp de selecció", +TextareaProp : "Propietats de l'àrea de text", +FormProp : "Propietats del formulari", + +FontFormats : "Normal;Formatejat;Adreça;Encapçalament 1;Encapçalament 2;Encapçalament 3;Encapçalament 4;Encapçalament 5;Encapçalament 6", + +// Alerts and Messages +ProcessingXHTML : "Processant XHTML. Si us plau esperi...", +Done : "Fet", +PasteWordConfirm : "El text que voleu enganxar sembla provenir de Word. Voleu netejar aquest text abans que sigui enganxat?", +NotCompatiblePaste : "Aquesta funció és disponible per a Internet Explorer versió 5.5 o superior. Voleu enganxar sense netejar?", +UnknownToolbarItem : "Element de la barra d'eines desconegut \"%1\"", +UnknownCommand : "Nom de comanda desconegut \"%1\"", +NotImplemented : "Mètode no implementat", +UnknownToolbarSet : "Conjunt de barra d'eines \"%1\" inexistent", +NoActiveX : "Les preferències del navegador poden limitar algunes funcions d'aquest editor. Cal habilitar l'opció \"Executa controls ActiveX i plug-ins\". Poden sorgir errors i poden faltar algunes funcions.", +BrowseServerBlocked : "El visualitzador de recursos no s'ha pogut obrir. Assegura't de que els bloquejos de finestres emergents estan desactivats.", +DialogBlocked : "No ha estat possible obrir una finestra de diàleg. Assegura't de que els bloquejos de finestres emergents estan desactivats.", + +// Dialogs +DlgBtnOK : "D'acord", +DlgBtnCancel : "Cancel·la", +DlgBtnClose : "Tanca", +DlgBtnBrowseServer : "Veure servidor", +DlgAdvancedTag : "Avançat", +DlgOpOther : "Altres", +DlgInfoTab : "Info", +DlgAlertUrl : "Si us plau, afegiu la URL", + +// General Dialogs Labels +DlgGenNotSet : "", +DlgGenId : "Id", +DlgGenLangDir : "Direcció de l'idioma", +DlgGenLangDirLtr : "D'esquerra a dreta (LTR)", +DlgGenLangDirRtl : "De dreta a esquerra (RTL)", +DlgGenLangCode : "Codi d'idioma", +DlgGenAccessKey : "Clau d'accés", +DlgGenName : "Nom", +DlgGenTabIndex : "Index de Tab", +DlgGenLongDescr : "Descripció llarga de la URL", +DlgGenClass : "Classes del full d'estil", +DlgGenTitle : "Títol consultiu", +DlgGenContType : "Tipus de contingut consultiu", +DlgGenLinkCharset : "Conjunt de caràcters font enllaçat", +DlgGenStyle : "Estil", + +// Image Dialog +DlgImgTitle : "Propietats de la imatge", +DlgImgInfoTab : "Informació de la imatge", +DlgImgBtnUpload : "Envia-la al servidor", +DlgImgURL : "URL", +DlgImgUpload : "Puja", +DlgImgAlt : "Text alternatiu", +DlgImgWidth : "Amplada", +DlgImgHeight : "Alçada", +DlgImgLockRatio : "Bloqueja les proporcions", +DlgBtnResetSize : "Restaura la mida", +DlgImgBorder : "Vora", +DlgImgHSpace : "Espaiat horit.", +DlgImgVSpace : "Espaiat vert.", +DlgImgAlign : "Alineació", +DlgImgAlignLeft : "Ajusta a l'esquerra", +DlgImgAlignAbsBottom: "Abs Bottom", +DlgImgAlignAbsMiddle: "Abs Middle", +DlgImgAlignBaseline : "Baseline", +DlgImgAlignBottom : "Bottom", +DlgImgAlignMiddle : "Middle", +DlgImgAlignRight : "Ajusta a la dreta", +DlgImgAlignTextTop : "Text Top", +DlgImgAlignTop : "Top", +DlgImgPreview : "Vista prèvia", +DlgImgAlertUrl : "Si us plau, escriviu la URL de la imatge", +DlgImgLinkTab : "Enllaç", + +// Flash Dialog +DlgFlashTitle : "Propietats del Flash", +DlgFlashChkPlay : "Reprodució automàtica", +DlgFlashChkLoop : "Bucle", +DlgFlashChkMenu : "Habilita menú Flash", +DlgFlashScale : "Escala", +DlgFlashScaleAll : "Mostra-ho tot", +DlgFlashScaleNoBorder : "Sense vores", +DlgFlashScaleFit : "Mida exacta", + +// Link Dialog +DlgLnkWindowTitle : "Enllaç", +DlgLnkInfoTab : "Informació de l'enllaç", +DlgLnkTargetTab : "Destí", + +DlgLnkType : "Tipus d'enllaç", +DlgLnkTypeURL : "URL", +DlgLnkTypeAnchor : "Àncora en aquesta pàgina", +DlgLnkTypeEMail : "Correu electrònic", +DlgLnkProto : "Protocol", +DlgLnkProtoOther : "", +DlgLnkURL : "URL", +DlgLnkAnchorSel : "Selecciona una àncora", +DlgLnkAnchorByName : "Per nom d'àncora", +DlgLnkAnchorById : "Per Id d'element", +DlgLnkNoAnchors : "(No hi ha àncores disponibles en aquest document)", +DlgLnkEMail : "Adreça de correu electrònic", +DlgLnkEMailSubject : "Assumpte del missatge", +DlgLnkEMailBody : "Cos del missatge", +DlgLnkUpload : "Puja", +DlgLnkBtnUpload : "Envia al servidor", + +DlgLnkTarget : "Destí", +DlgLnkTargetFrame : "", +DlgLnkTargetPopup : "", +DlgLnkTargetBlank : "Nova finestra (_blank)", +DlgLnkTargetParent : "Finestra pare (_parent)", +DlgLnkTargetSelf : "Mateixa finestra (_self)", +DlgLnkTargetTop : "Finestra Major (_top)", +DlgLnkTargetFrameName : "Nom del marc de destí", +DlgLnkPopWinName : "Nom finestra popup", +DlgLnkPopWinFeat : "Característiques finestra popup", +DlgLnkPopResize : "Redimensionable", +DlgLnkPopLocation : "Barra d'adreça", +DlgLnkPopMenu : "Barra de menú", +DlgLnkPopScroll : "Barres d'scroll", +DlgLnkPopStatus : "Barra d'estat", +DlgLnkPopToolbar : "Barra d'eines", +DlgLnkPopFullScrn : "Pantalla completa (IE)", +DlgLnkPopDependent : "Depenent (Netscape)", +DlgLnkPopWidth : "Amplada", +DlgLnkPopHeight : "Alçada", +DlgLnkPopLeft : "Posició esquerra", +DlgLnkPopTop : "Posició dalt", + +DlnLnkMsgNoUrl : "Si us plau, escrigui l'enllaç URL", +DlnLnkMsgNoEMail : "Si us plau, escrigui l'adreça correu electrònic", +DlnLnkMsgNoAnchor : "Si us plau, escrigui l'àncora", +DlnLnkMsgInvPopName : "El nom de la finestra emergent ha de començar amb una lletra i no pot tenir espais", + +// Color Dialog +DlgColorTitle : "Selecciona el color", +DlgColorBtnClear : "Neteja", +DlgColorHighlight : "Realça", +DlgColorSelected : "Selecciona", + +// Smiley Dialog +DlgSmileyTitle : "Insereix una icona", + +// Special Character Dialog +DlgSpecialCharTitle : "Selecciona el caràcter especial", + +// Table Dialog +DlgTableTitle : "Propietats de la taula", +DlgTableRows : "Files", +DlgTableColumns : "Columnes", +DlgTableBorder : "Mida vora", +DlgTableAlign : "Alineació", +DlgTableAlignNotSet : "", +DlgTableAlignLeft : "Esquerra", +DlgTableAlignCenter : "Centre", +DlgTableAlignRight : "Dreta", +DlgTableWidth : "Amplada", +DlgTableWidthPx : "píxels", +DlgTableWidthPc : "percentatge", +DlgTableHeight : "Alçada", +DlgTableCellSpace : "Espaiat de cel·les", +DlgTableCellPad : "Encoixinament de cel·les", +DlgTableCaption : "Títol", +DlgTableSummary : "Resum", + +// Table Cell Dialog +DlgCellTitle : "Propietats de la cel·la", +DlgCellWidth : "Amplada", +DlgCellWidthPx : "píxels", +DlgCellWidthPc : "percentatge", +DlgCellHeight : "Alçada", +DlgCellWordWrap : "Ajust de paraula", +DlgCellWordWrapNotSet : "", +DlgCellWordWrapYes : "Si", +DlgCellWordWrapNo : "No", +DlgCellHorAlign : "Alineació horitzontal", +DlgCellHorAlignNotSet : "", +DlgCellHorAlignLeft : "Esquerra", +DlgCellHorAlignCenter : "Centre", +DlgCellHorAlignRight: "Dreta", +DlgCellVerAlign : "Alineació vertical", +DlgCellVerAlignNotSet : "", +DlgCellVerAlignTop : "Top", +DlgCellVerAlignMiddle : "Middle", +DlgCellVerAlignBottom : "Bottom", +DlgCellVerAlignBaseline : "Baseline", +DlgCellRowSpan : "Rows Span", +DlgCellCollSpan : "Columns Span", +DlgCellBackColor : "Color de fons", +DlgCellBorderColor : "Color de la vora", +DlgCellBtnSelect : "Seleccioneu...", + +// Find and Replace Dialog +DlgFindAndReplaceTitle : "Cerca i reemplaça", + +// Find Dialog +DlgFindTitle : "Cerca", +DlgFindFindBtn : "Cerca", +DlgFindNotFoundMsg : "El text especificat no s'ha trobat.", + +// Replace Dialog +DlgReplaceTitle : "Reemplaça", +DlgReplaceFindLbl : "Cerca:", +DlgReplaceReplaceLbl : "Remplaça amb:", +DlgReplaceCaseChk : "Distingeix majúscules/minúscules", +DlgReplaceReplaceBtn : "Reemplaça", +DlgReplaceReplAllBtn : "Reemplaça-ho tot", +DlgReplaceWordChk : "Només paraules completes", + +// Paste Operations / Dialog +PasteErrorCut : "La seguretat del vostre navegador no permet executar automàticament les operacions de retallar. Si us plau, utilitzeu el teclat (Ctrl+X).", +PasteErrorCopy : "La seguretat del vostre navegador no permet executar automàticament les operacions de copiar. Si us plau, utilitzeu el teclat (Ctrl+C).", + +PasteAsText : "Enganxa com a text no formatat", +PasteFromWord : "Enganxa com a Word", + +DlgPasteMsg2 : "Si us plau, enganxeu dins del següent camp utilitzant el teclat (Ctrl+V) i premeu OK.", +DlgPasteSec : "A causa de la configuració de seguretat del vostre navegador, l'editor no pot accedir al porta-retalls directament. Enganxeu-ho un altre cop en aquesta finestra.", +DlgPasteIgnoreFont : "Ignora definicions de font", +DlgPasteRemoveStyles : "Elimina definicions d'estil", +DlgPasteCleanBox : "Neteja camp", + +// Color Picker +ColorAutomatic : "Automàtic", +ColorMoreColors : "Més colors...", + +// Document Properties +DocProps : "Propietats del document", + +// Anchor Dialog +DlgAnchorTitle : "Propietats de l'àncora", +DlgAnchorName : "Nom de l'àncora", +DlgAnchorErrorName : "Si us plau, escriviu el nom de l'ancora", + +// Speller Pages Dialog +DlgSpellNotInDic : "No és al diccionari", +DlgSpellChangeTo : "Canvia a", +DlgSpellBtnIgnore : "Ignora", +DlgSpellBtnIgnoreAll : "Ignora-les totes", +DlgSpellBtnReplace : "Canvia", +DlgSpellBtnReplaceAll : "Canvia-les totes", +DlgSpellBtnUndo : "Desfés", +DlgSpellNoSuggestions : "Cap sugerència", +DlgSpellProgress : "Comprovació ortogràfica en progrés", +DlgSpellNoMispell : "Comprovació ortogràfica completada", +DlgSpellNoChanges : "Comprovació ortogràfica: cap paraulada canviada", +DlgSpellOneChange : "Comprovació ortogràfica: una paraula canviada", +DlgSpellManyChanges : "Comprovació ortogràfica %1 paraules canviades", + +IeSpellDownload : "Comprovació ortogràfica no instal·lada. Voleu descarregar-ho ara?", + +// Button Dialog +DlgButtonText : "Text (Valor)", +DlgButtonType : "Tipus", +DlgButtonTypeBtn : "Botó", +DlgButtonTypeSbm : "Transmet formulari", +DlgButtonTypeRst : "Reinicia formulari", + +// Checkbox and Radio Button Dialogs +DlgCheckboxName : "Nom", +DlgCheckboxValue : "Valor", +DlgCheckboxSelected : "Seleccionat", + +// Form Dialog +DlgFormName : "Nom", +DlgFormAction : "Acció", +DlgFormMethod : "Mètode", + +// Select Field Dialog +DlgSelectName : "Nom", +DlgSelectValue : "Valor", +DlgSelectSize : "Mida", +DlgSelectLines : "Línies", +DlgSelectChkMulti : "Permet múltiples seleccions", +DlgSelectOpAvail : "Opcions disponibles", +DlgSelectOpText : "Text", +DlgSelectOpValue : "Valor", +DlgSelectBtnAdd : "Afegeix", +DlgSelectBtnModify : "Modifica", +DlgSelectBtnUp : "Amunt", +DlgSelectBtnDown : "Avall", +DlgSelectBtnSetValue : "Selecciona per defecte", +DlgSelectBtnDelete : "Elimina", + +// Textarea Dialog +DlgTextareaName : "Nom", +DlgTextareaCols : "Columnes", +DlgTextareaRows : "Files", + +// Text Field Dialog +DlgTextName : "Nom", +DlgTextValue : "Valor", +DlgTextCharWidth : "Amplada de caràcter", +DlgTextMaxChars : "Màxim de caràcters", +DlgTextType : "Tipus", +DlgTextTypeText : "Text", +DlgTextTypePass : "Contrasenya", + +// Hidden Field Dialog +DlgHiddenName : "Nom", +DlgHiddenValue : "Valor", + +// Bulleted List Dialog +BulletedListProp : "Propietats de la llista de pics", +NumberedListProp : "Propietats de llista numerada", +DlgLstStart : "Inici", +DlgLstType : "Tipus", +DlgLstTypeCircle : "Cercle", +DlgLstTypeDisc : "Disc", +DlgLstTypeSquare : "Quadrat", +DlgLstTypeNumbers : "Números (1, 2, 3)", +DlgLstTypeLCase : "Lletres minúscules (a, b, c)", +DlgLstTypeUCase : "Lletres majúscules (A, B, C)", +DlgLstTypeSRoman : "Números romans minúscules (i, ii, iii)", +DlgLstTypeLRoman : "Números romans majúscules (I, II, III)", + +// Document Properties Dialog +DlgDocGeneralTab : "General", +DlgDocBackTab : "Fons", +DlgDocColorsTab : "Colors i marges", +DlgDocMetaTab : "Metadades", + +DlgDocPageTitle : "Títol de la pàgina", +DlgDocLangDir : "Direcció idioma", +DlgDocLangDirLTR : "Esquerra a dreta (LTR)", +DlgDocLangDirRTL : "Dreta a esquerra (RTL)", +DlgDocLangCode : "Codi d'idioma", +DlgDocCharSet : "Codificació de conjunt de caràcters", +DlgDocCharSetCE : "Centreeuropeu", +DlgDocCharSetCT : "Xinès tradicional (Big5)", +DlgDocCharSetCR : "Ciríl·lic", +DlgDocCharSetGR : "Grec", +DlgDocCharSetJP : "Japonès", +DlgDocCharSetKR : "Coreà", +DlgDocCharSetTR : "Turc", +DlgDocCharSetUN : "Unicode (UTF-8)", +DlgDocCharSetWE : "Europeu occidental", +DlgDocCharSetOther : "Una altra codificació de caràcters", + +DlgDocDocType : "Capçalera de tipus de document", +DlgDocDocTypeOther : "Un altra capçalera de tipus de document", +DlgDocIncXHTML : "Incloure declaracions XHTML", +DlgDocBgColor : "Color de fons", +DlgDocBgImage : "URL de la imatge de fons", +DlgDocBgNoScroll : "Fons fixe", +DlgDocCText : "Text", +DlgDocCLink : "Enllaç", +DlgDocCVisited : "Enllaç visitat", +DlgDocCActive : "Enllaç actiu", +DlgDocMargins : "Marges de pàgina", +DlgDocMaTop : "Cap", +DlgDocMaLeft : "Esquerra", +DlgDocMaRight : "Dreta", +DlgDocMaBottom : "Peu", +DlgDocMeIndex : "Mots clau per a indexació (separats per coma)", +DlgDocMeDescr : "Descripció del document", +DlgDocMeAuthor : "Autor", +DlgDocMeCopy : "Copyright", +DlgDocPreview : "Vista prèvia", + +// Templates Dialog +Templates : "Plantilles", +DlgTemplatesTitle : "Contingut plantilles", +DlgTemplatesSelMsg : "Si us plau, seleccioneu la plantilla per obrir en l'editor
    (el contingut actual no serà enregistrat):", +DlgTemplatesLoading : "Carregant la llista de plantilles. Si us plau, espereu...", +DlgTemplatesNoTpl : "(No hi ha plantilles definides)", +DlgTemplatesReplace : "Reemplaça el contingut actual", + +// About Dialog +DlgAboutAboutTab : "Quant a", +DlgAboutBrowserInfoTab : "Informació del navegador", +DlgAboutLicenseTab : "Llicència", +DlgAboutVersion : "versió", +DlgAboutInfo : "Per a més informació aneu a" +}; diff --git a/FCKeditor/editor/lang/cs.js b/FCKeditor/editor/lang/cs.js new file mode 100644 index 0000000..01ed1ea --- /dev/null +++ b/FCKeditor/editor/lang/cs.js @@ -0,0 +1,516 @@ +/* + * FCKeditor - The text editor for Internet - http://www.fckeditor.net + * Copyright (C) 2003-2007 Frederico Caldeira Knabben + * + * == BEGIN LICENSE == + * + * Licensed under the terms of any of the following licenses at your + * choice: + * + * - GNU General Public License Version 2 or later (the "GPL") + * http://www.gnu.org/licenses/gpl.html + * + * - GNU Lesser General Public License Version 2.1 or later (the "LGPL") + * http://www.gnu.org/licenses/lgpl.html + * + * - Mozilla Public License Version 1.1 or later (the "MPL") + * http://www.mozilla.org/MPL/MPL-1.1.html + * + * == END LICENSE == + * + * Czech language file. + */ + +var FCKLang = +{ +// Language direction : "ltr" (left to right) or "rtl" (right to left). +Dir : "ltr", + +ToolbarCollapse : "Skrýt panel nástrojů", +ToolbarExpand : "Zobrazit panel nástrojů", + +// Toolbar Items and Context Menu +Save : "Uložit", +NewPage : "Nová stránka", +Preview : "Náhled", +Cut : "Vyjmout", +Copy : "Kopírovat", +Paste : "Vložit", +PasteText : "Vložit jako čistý text", +PasteWord : "Vložit z Wordu", +Print : "Tisk", +SelectAll : "Vybrat vše", +RemoveFormat : "Odstranit formátování", +InsertLinkLbl : "Odkaz", +InsertLink : "Vložit/změnit odkaz", +RemoveLink : "Odstranit odkaz", +Anchor : "Vložít/změnit záložku", +AnchorDelete : "Odstranit kotvu", +InsertImageLbl : "Obrázek", +InsertImage : "Vložit/změnit obrázek", +InsertFlashLbl : "Flash", +InsertFlash : "Vložit/Upravit Flash", +InsertTableLbl : "Tabulka", +InsertTable : "Vložit/změnit tabulku", +InsertLineLbl : "Linka", +InsertLine : "Vložit vodorovnou linku", +InsertSpecialCharLbl: "Speciální znaky", +InsertSpecialChar : "Vložit speciální znaky", +InsertSmileyLbl : "Smajlíky", +InsertSmiley : "Vložit smajlík", +About : "O aplikaci FCKeditor", +Bold : "Tučné", +Italic : "Kurzíva", +Underline : "Podtržené", +StrikeThrough : "Přeškrtnuté", +Subscript : "Dolní index", +Superscript : "Horní index", +LeftJustify : "Zarovnat vlevo", +CenterJustify : "Zarovnat na střed", +RightJustify : "Zarovnat vpravo", +BlockJustify : "Zarovnat do bloku", +DecreaseIndent : "Zmenšit odsazení", +IncreaseIndent : "Zvětšit odsazení", +Blockquote : "Citace", +Undo : "Zpět", +Redo : "Znovu", +NumberedListLbl : "Číslování", +NumberedList : "Vložit/odstranit číslovaný seznam", +BulletedListLbl : "Odrážky", +BulletedList : "Vložit/odstranit odrážky", +ShowTableBorders : "Zobrazit okraje tabulek", +ShowDetails : "Zobrazit podrobnosti", +Style : "Styl", +FontFormat : "Formát", +Font : "Písmo", +FontSize : "Velikost", +TextColor : "Barva textu", +BGColor : "Barva pozadí", +Source : "Zdroj", +Find : "Hledat", +Replace : "Nahradit", +SpellCheck : "Zkontrolovat pravopis", +UniversalKeyboard : "Univerzální klávesnice", +PageBreakLbl : "Konec stránky", +PageBreak : "Vložit konec stránky", + +Form : "Formulář", +Checkbox : "Zaškrtávací políčko", +RadioButton : "Přepínač", +TextField : "Textové pole", +Textarea : "Textová oblast", +HiddenField : "Skryté pole", +Button : "Tlačítko", +SelectionField : "Seznam", +ImageButton : "Obrázkové tlačítko", + +FitWindow : "Maximalizovat velikost editoru", +ShowBlocks : "Ukázat bloky", + +// Context Menu +EditLink : "Změnit odkaz", +CellCM : "Buňka", +RowCM : "Řádek", +ColumnCM : "Sloupec", +InsertRowAfter : "Vložit řádek za", +InsertRowBefore : "Vložit řádek před", +DeleteRows : "Smazat řádky", +InsertColumnAfter : "Vložit sloupec za", +InsertColumnBefore : "Vložit sloupec před", +DeleteColumns : "Smazat sloupec", +InsertCellAfter : "Vložit buňku za", +InsertCellBefore : "Vložit buňku před", +DeleteCells : "Smazat buňky", +MergeCells : "Sloučit buňky", +MergeRight : "Sloučit doprava", +MergeDown : "Sloučit dolů", +HorizontalSplitCell : "Rozdělit buňky vodorovně", +VerticalSplitCell : "Rozdělit buňky svisle", +TableDelete : "Smazat tabulku", +CellProperties : "Vlastnosti buňky", +TableProperties : "Vlastnosti tabulky", +ImageProperties : "Vlastnosti obrázku", +FlashProperties : "Vlastnosti Flashe", + +AnchorProp : "Vlastnosti záložky", +ButtonProp : "Vlastnosti tlačítka", +CheckboxProp : "Vlastnosti zaškrtávacího políčka", +HiddenFieldProp : "Vlastnosti skrytého pole", +RadioButtonProp : "Vlastnosti přepínače", +ImageButtonProp : "Vlastností obrázkového tlačítka", +TextFieldProp : "Vlastnosti textového pole", +SelectionFieldProp : "Vlastnosti seznamu", +TextareaProp : "Vlastnosti textové oblasti", +FormProp : "Vlastnosti formuláře", + +FontFormats : "Normální;Naformátováno;Adresa;Nadpis 1;Nadpis 2;Nadpis 3;Nadpis 4;Nadpis 5;Nadpis 6;Normální (DIV)", + +// Alerts and Messages +ProcessingXHTML : "Probíhá zpracování XHTML. Prosím čekejte...", +Done : "Hotovo", +PasteWordConfirm : "Jak je vidět, vkládaný text je kopírován z Wordu. Chcete jej před vložením vyčistit?", +NotCompatiblePaste : "Tento příkaz je dostupný pouze v Internet Exploreru verze 5.5 nebo vyšší. Chcete vložit text bez vyčištění?", +UnknownToolbarItem : "Neznámá položka panelu nástrojů \"%1\"", +UnknownCommand : "Neznámý příkaz \"%1\"", +NotImplemented : "Příkaz není implementován", +UnknownToolbarSet : "Panel nástrojů \"%1\" neexistuje", +NoActiveX : "Nastavení bezpečnosti Vašeho prohlížeče omezuje funkčnost některých jeho možností. Je třeba zapnout volbu \"Spouštět ovládáací prvky ActiveX a moduly plug-in\", jinak nebude možné využívat všechny dosputné schopnosti editoru.", +BrowseServerBlocked : "Průzkumník zdrojů nelze otevřít. Prověřte, zda nemáte aktivováno blokování popup oken.", +DialogBlocked : "Nelze otevřít dialogové okno. Prověřte, zda nemáte aktivováno blokování popup oken.", + +// Dialogs +DlgBtnOK : "OK", +DlgBtnCancel : "Storno", +DlgBtnClose : "Zavřít", +DlgBtnBrowseServer : "Vybrat na serveru", +DlgAdvancedTag : "Rozšířené", +DlgOpOther : "", +DlgInfoTab : "Info", +DlgAlertUrl : "Prosím vložte URL", + +// General Dialogs Labels +DlgGenNotSet : "", +DlgGenId : "Id", +DlgGenLangDir : "Orientace jazyka", +DlgGenLangDirLtr : "Zleva do prava (LTR)", +DlgGenLangDirRtl : "Zprava do leva (RTL)", +DlgGenLangCode : "Kód jazyka", +DlgGenAccessKey : "Přístupový klíč", +DlgGenName : "Jméno", +DlgGenTabIndex : "Pořadí prvku", +DlgGenLongDescr : "Dlouhý popis URL", +DlgGenClass : "Třída stylu", +DlgGenTitle : "Pomocný titulek", +DlgGenContType : "Pomocný typ obsahu", +DlgGenLinkCharset : "Přiřazená znaková sada", +DlgGenStyle : "Styl", + +// Image Dialog +DlgImgTitle : "Vlastnosti obrázku", +DlgImgInfoTab : "Informace o obrázku", +DlgImgBtnUpload : "Odeslat na server", +DlgImgURL : "URL", +DlgImgUpload : "Odeslat", +DlgImgAlt : "Alternativní text", +DlgImgWidth : "Šířka", +DlgImgHeight : "Výška", +DlgImgLockRatio : "Zámek", +DlgBtnResetSize : "Původní velikost", +DlgImgBorder : "Okraje", +DlgImgHSpace : "H-mezera", +DlgImgVSpace : "V-mezera", +DlgImgAlign : "Zarovnání", +DlgImgAlignLeft : "Vlevo", +DlgImgAlignAbsBottom: "Zcela dolů", +DlgImgAlignAbsMiddle: "Doprostřed", +DlgImgAlignBaseline : "Na účaří", +DlgImgAlignBottom : "Dolů", +DlgImgAlignMiddle : "Na střed", +DlgImgAlignRight : "Vpravo", +DlgImgAlignTextTop : "Na horní okraj textu", +DlgImgAlignTop : "Nahoru", +DlgImgPreview : "Náhled", +DlgImgAlertUrl : "Zadejte prosím URL obrázku", +DlgImgLinkTab : "Odkaz", + +// Flash Dialog +DlgFlashTitle : "Vlastnosti Flashe", +DlgFlashChkPlay : "Automatické spuštění", +DlgFlashChkLoop : "Opakování", +DlgFlashChkMenu : "Nabídka Flash", +DlgFlashScale : "Zobrazit", +DlgFlashScaleAll : "Zobrazit vše", +DlgFlashScaleNoBorder : "Bez okraje", +DlgFlashScaleFit : "Přizpůsobit", + +// Link Dialog +DlgLnkWindowTitle : "Odkaz", +DlgLnkInfoTab : "Informace o odkazu", +DlgLnkTargetTab : "Cíl", + +DlgLnkType : "Typ odkazu", +DlgLnkTypeURL : "URL", +DlgLnkTypeAnchor : "Kotva v této stránce", +DlgLnkTypeEMail : "E-Mail", +DlgLnkProto : "Protokol", +DlgLnkProtoOther : "", +DlgLnkURL : "URL", +DlgLnkAnchorSel : "Vybrat kotvu", +DlgLnkAnchorByName : "Podle jména kotvy", +DlgLnkAnchorById : "Podle Id objektu", +DlgLnkNoAnchors : "(Ve stránce není definována žádná kotva!)", +DlgLnkEMail : "E-Mailová adresa", +DlgLnkEMailSubject : "Předmět zprávy", +DlgLnkEMailBody : "Tělo zprávy", +DlgLnkUpload : "Odeslat", +DlgLnkBtnUpload : "Odeslat na Server", + +DlgLnkTarget : "Cíl", +DlgLnkTargetFrame : "", +DlgLnkTargetPopup : "", +DlgLnkTargetBlank : "Nové okno (_blank)", +DlgLnkTargetParent : "Rodičovské okno (_parent)", +DlgLnkTargetSelf : "Stejné okno (_self)", +DlgLnkTargetTop : "Hlavní okno (_top)", +DlgLnkTargetFrameName : "Název cílového rámu", +DlgLnkPopWinName : "Název vyskakovacího okna", +DlgLnkPopWinFeat : "Vlastnosti vyskakovacího okna", +DlgLnkPopResize : "Měnitelná velikost", +DlgLnkPopLocation : "Panel umístění", +DlgLnkPopMenu : "Panel nabídky", +DlgLnkPopScroll : "Posuvníky", +DlgLnkPopStatus : "Stavový řádek", +DlgLnkPopToolbar : "Panel nástrojů", +DlgLnkPopFullScrn : "Celá obrazovka (IE)", +DlgLnkPopDependent : "Závislost (Netscape)", +DlgLnkPopWidth : "Šířka", +DlgLnkPopHeight : "Výška", +DlgLnkPopLeft : "Levý okraj", +DlgLnkPopTop : "Horní okraj", + +DlnLnkMsgNoUrl : "Zadejte prosím URL odkazu", +DlnLnkMsgNoEMail : "Zadejte prosím e-mailovou adresu", +DlnLnkMsgNoAnchor : "Vyberte prosím kotvu", +DlnLnkMsgInvPopName : "Název vyskakovacího okna musí začínat písmenem a nesmí obsahovat mezery", + +// Color Dialog +DlgColorTitle : "Výběr barvy", +DlgColorBtnClear : "Vymazat", +DlgColorHighlight : "Zvýrazněná", +DlgColorSelected : "Vybraná", + +// Smiley Dialog +DlgSmileyTitle : "Vkládání smajlíků", + +// Special Character Dialog +DlgSpecialCharTitle : "Výběr speciálního znaku", + +// Table Dialog +DlgTableTitle : "Vlastnosti tabulky", +DlgTableRows : "Řádky", +DlgTableColumns : "Sloupce", +DlgTableBorder : "Ohraničení", +DlgTableAlign : "Zarovnání", +DlgTableAlignNotSet : "", +DlgTableAlignLeft : "Vlevo", +DlgTableAlignCenter : "Na střed", +DlgTableAlignRight : "Vpravo", +DlgTableWidth : "Šířka", +DlgTableWidthPx : "bodů", +DlgTableWidthPc : "procent", +DlgTableHeight : "Výška", +DlgTableCellSpace : "Vzdálenost buněk", +DlgTableCellPad : "Odsazení obsahu", +DlgTableCaption : "Popis", +DlgTableSummary : "Souhrn", + +// Table Cell Dialog +DlgCellTitle : "Vlastnosti buňky", +DlgCellWidth : "Šířka", +DlgCellWidthPx : "bodů", +DlgCellWidthPc : "procent", +DlgCellHeight : "Výška", +DlgCellWordWrap : "Zalamování", +DlgCellWordWrapNotSet : "", +DlgCellWordWrapYes : "Ano", +DlgCellWordWrapNo : "Ne", +DlgCellHorAlign : "Vodorovné zarovnání", +DlgCellHorAlignNotSet : "", +DlgCellHorAlignLeft : "Vlevo", +DlgCellHorAlignCenter : "Na střed", +DlgCellHorAlignRight: "Vpravo", +DlgCellVerAlign : "Svislé zarovnání", +DlgCellVerAlignNotSet : "", +DlgCellVerAlignTop : "Nahoru", +DlgCellVerAlignMiddle : "Doprostřed", +DlgCellVerAlignBottom : "Dolů", +DlgCellVerAlignBaseline : "Na účaří", +DlgCellRowSpan : "Sloučené řádky", +DlgCellCollSpan : "Sloučené sloupce", +DlgCellBackColor : "Barva pozadí", +DlgCellBorderColor : "Barva ohraničení", +DlgCellBtnSelect : "Výběr...", + +// Find and Replace Dialog +DlgFindAndReplaceTitle : "Najít a nahradit", + +// Find Dialog +DlgFindTitle : "Hledat", +DlgFindFindBtn : "Hledat", +DlgFindNotFoundMsg : "Hledaný text nebyl nalezen.", + +// Replace Dialog +DlgReplaceTitle : "Nahradit", +DlgReplaceFindLbl : "Co hledat:", +DlgReplaceReplaceLbl : "Čím nahradit:", +DlgReplaceCaseChk : "Rozlišovat velikost písma", +DlgReplaceReplaceBtn : "Nahradit", +DlgReplaceReplAllBtn : "Nahradit vše", +DlgReplaceWordChk : "Pouze celá slova", + +// Paste Operations / Dialog +PasteErrorCut : "Bezpečnostní nastavení Vašeho prohlížeče nedovolují editoru spustit funkci pro vyjmutí zvoleného textu do schránky. Prosím vyjměte zvolený text do schránky pomocí klávesnice (Ctrl+X).", +PasteErrorCopy : "Bezpečnostní nastavení Vašeho prohlížeče nedovolují editoru spustit funkci pro kopírování zvoleného textu do schránky. Prosím zkopírujte zvolený text do schránky pomocí klávesnice (Ctrl+C).", + +PasteAsText : "Vložit jako čistý text", +PasteFromWord : "Vložit text z Wordu", + +DlgPasteMsg2 : "Do následujícího pole vložte požadovaný obsah pomocí klávesnice (Ctrl+V) a stiskněte OK.", +DlgPasteSec : "Z důvodů nastavení bezpečnosti Vašeho prohlížeče nemůže editor přistupovat přímo do schránky. Obsah schránky prosím vložte znovu do tohoto okna.", +DlgPasteIgnoreFont : "Ignorovat písmo", +DlgPasteRemoveStyles : "Odstranit styly", +DlgPasteCleanBox : "Vyčistit", + +// Color Picker +ColorAutomatic : "Automaticky", +ColorMoreColors : "Více barev...", + +// Document Properties +DocProps : "Vlastnosti dokumentu", + +// Anchor Dialog +DlgAnchorTitle : "Vlastnosti záložky", +DlgAnchorName : "Název záložky", +DlgAnchorErrorName : "Zadejte prosím název záložky", + +// Speller Pages Dialog +DlgSpellNotInDic : "Není ve slovníku", +DlgSpellChangeTo : "Změnit na", +DlgSpellBtnIgnore : "Přeskočit", +DlgSpellBtnIgnoreAll : "Přeskakovat vše", +DlgSpellBtnReplace : "Zaměnit", +DlgSpellBtnReplaceAll : "Zaměňovat vše", +DlgSpellBtnUndo : "Zpět", +DlgSpellNoSuggestions : "- žádné návrhy -", +DlgSpellProgress : "Probíhá kontrola pravopisu...", +DlgSpellNoMispell : "Kontrola pravopisu dokončena: Žádné pravopisné chyby nenalezeny", +DlgSpellNoChanges : "Kontrola pravopisu dokončena: Beze změn", +DlgSpellOneChange : "Kontrola pravopisu dokončena: Jedno slovo změněno", +DlgSpellManyChanges : "Kontrola pravopisu dokončena: %1 slov změněno", + +IeSpellDownload : "Kontrola pravopisu není nainstalována. Chcete ji nyní stáhnout?", + +// Button Dialog +DlgButtonText : "Popisek", +DlgButtonType : "Typ", +DlgButtonTypeBtn : "Tlačítko", +DlgButtonTypeSbm : "Odeslat", +DlgButtonTypeRst : "Obnovit", + +// Checkbox and Radio Button Dialogs +DlgCheckboxName : "Název", +DlgCheckboxValue : "Hodnota", +DlgCheckboxSelected : "Zaškrtnuto", + +// Form Dialog +DlgFormName : "Název", +DlgFormAction : "Akce", +DlgFormMethod : "Metoda", + +// Select Field Dialog +DlgSelectName : "Název", +DlgSelectValue : "Hodnota", +DlgSelectSize : "Velikost", +DlgSelectLines : "Řádků", +DlgSelectChkMulti : "Povolit mnohonásobné výběry", +DlgSelectOpAvail : "Dostupná nastavení", +DlgSelectOpText : "Text", +DlgSelectOpValue : "Hodnota", +DlgSelectBtnAdd : "Přidat", +DlgSelectBtnModify : "Změnit", +DlgSelectBtnUp : "Nahoru", +DlgSelectBtnDown : "Dolů", +DlgSelectBtnSetValue : "Nastavit jako vybranou hodnotu", +DlgSelectBtnDelete : "Smazat", + +// Textarea Dialog +DlgTextareaName : "Název", +DlgTextareaCols : "Sloupců", +DlgTextareaRows : "Řádků", + +// Text Field Dialog +DlgTextName : "Název", +DlgTextValue : "Hodnota", +DlgTextCharWidth : "Šířka ve znacích", +DlgTextMaxChars : "Maximální počet znaků", +DlgTextType : "Typ", +DlgTextTypeText : "Text", +DlgTextTypePass : "Heslo", + +// Hidden Field Dialog +DlgHiddenName : "Název", +DlgHiddenValue : "Hodnota", + +// Bulleted List Dialog +BulletedListProp : "Vlastnosti odrážek", +NumberedListProp : "Vlastnosti číslovaného seznamu", +DlgLstStart : "Začátek", +DlgLstType : "Typ", +DlgLstTypeCircle : "Kružnice", +DlgLstTypeDisc : "Kruh", +DlgLstTypeSquare : "Čtverec", +DlgLstTypeNumbers : "Čísla (1, 2, 3)", +DlgLstTypeLCase : "Malá písmena (a, b, c)", +DlgLstTypeUCase : "Velká písmena (A, B, C)", +DlgLstTypeSRoman : "Malé římská číslice (i, ii, iii)", +DlgLstTypeLRoman : "Velké římské číslice (I, II, III)", + +// Document Properties Dialog +DlgDocGeneralTab : "Obecné", +DlgDocBackTab : "Pozadí", +DlgDocColorsTab : "Barvy a okraje", +DlgDocMetaTab : "Metadata", + +DlgDocPageTitle : "Titulek stránky", +DlgDocLangDir : "Směr jazyku", +DlgDocLangDirLTR : "Zleva do prava ", +DlgDocLangDirRTL : "Zprava doleva", +DlgDocLangCode : "Kód jazyku", +DlgDocCharSet : "Znaková sada", +DlgDocCharSetCE : "Středoevropské jazyky", +DlgDocCharSetCT : "Tradiční čínština (Big5)", +DlgDocCharSetCR : "Cyrilice", +DlgDocCharSetGR : "Řečtina", +DlgDocCharSetJP : "Japonština", +DlgDocCharSetKR : "Korejština", +DlgDocCharSetTR : "Turečtina", +DlgDocCharSetUN : "Unicode (UTF-8)", +DlgDocCharSetWE : "Západoevropské jazyky", +DlgDocCharSetOther : "Další znaková sada", + +DlgDocDocType : "Typ dokumentu", +DlgDocDocTypeOther : "Jiný typ dokumetu", +DlgDocIncXHTML : "Zahrnou deklarace XHTML", +DlgDocBgColor : "Barva pozadí", +DlgDocBgImage : "URL obrázku na pozadí", +DlgDocBgNoScroll : "Nerolovatelné pozadí", +DlgDocCText : "Text", +DlgDocCLink : "Odkaz", +DlgDocCVisited : "Navštívený odkaz", +DlgDocCActive : "Vybraný odkaz", +DlgDocMargins : "Okraje stránky", +DlgDocMaTop : "Horní", +DlgDocMaLeft : "Levý", +DlgDocMaRight : "Pravý", +DlgDocMaBottom : "Dolní", +DlgDocMeIndex : "Klíčová slova (oddělená čárkou)", +DlgDocMeDescr : "Popis dokumentu", +DlgDocMeAuthor : "Autor", +DlgDocMeCopy : "Autorská práva", +DlgDocPreview : "Náhled", + +// Templates Dialog +Templates : "Šablony", +DlgTemplatesTitle : "Šablony obsahu", +DlgTemplatesSelMsg : "Prosím zvolte šablonu pro otevření v editoru
    (aktuální obsah editoru bude ztracen):", +DlgTemplatesLoading : "Nahrávám přeheld šablon. Prosím čekejte...", +DlgTemplatesNoTpl : "(Není definována žádná šablona)", +DlgTemplatesReplace : "Nahradit aktuální obsah", + +// About Dialog +DlgAboutAboutTab : "O aplikaci", +DlgAboutBrowserInfoTab : "Informace o prohlížeči", +DlgAboutLicenseTab : "Licence", +DlgAboutVersion : "verze", +DlgAboutInfo : "Více informací získáte na" +}; diff --git a/FCKeditor/editor/lang/da.js b/FCKeditor/editor/lang/da.js new file mode 100644 index 0000000..dd5898f --- /dev/null +++ b/FCKeditor/editor/lang/da.js @@ -0,0 +1,516 @@ +/* + * FCKeditor - The text editor for Internet - http://www.fckeditor.net + * Copyright (C) 2003-2007 Frederico Caldeira Knabben + * + * == BEGIN LICENSE == + * + * Licensed under the terms of any of the following licenses at your + * choice: + * + * - GNU General Public License Version 2 or later (the "GPL") + * http://www.gnu.org/licenses/gpl.html + * + * - GNU Lesser General Public License Version 2.1 or later (the "LGPL") + * http://www.gnu.org/licenses/lgpl.html + * + * - Mozilla Public License Version 1.1 or later (the "MPL") + * http://www.mozilla.org/MPL/MPL-1.1.html + * + * == END LICENSE == + * + * Danish language file. + */ + +var FCKLang = +{ +// Language direction : "ltr" (left to right) or "rtl" (right to left). +Dir : "ltr", + +ToolbarCollapse : "Skjul værktøjslinier", +ToolbarExpand : "Vis værktøjslinier", + +// Toolbar Items and Context Menu +Save : "Gem", +NewPage : "Ny side", +Preview : "Vis eksempel", +Cut : "Klip", +Copy : "Kopier", +Paste : "Indsæt", +PasteText : "Indsæt som ikke-formateret tekst", +PasteWord : "Indsæt fra Word", +Print : "Udskriv", +SelectAll : "Vælg alt", +RemoveFormat : "Fjern formatering", +InsertLinkLbl : "Hyperlink", +InsertLink : "Indsæt/rediger hyperlink", +RemoveLink : "Fjern hyperlink", +Anchor : "Indsæt/rediger bogmærke", +AnchorDelete : "Remove Anchor", //MISSING +InsertImageLbl : "Indsæt billede", +InsertImage : "Indsæt/rediger billede", +InsertFlashLbl : "Flash", +InsertFlash : "Indsæt/rediger Flash", +InsertTableLbl : "Table", +InsertTable : "Indsæt/rediger tabel", +InsertLineLbl : "Linie", +InsertLine : "Indsæt vandret linie", +InsertSpecialCharLbl: "Symbol", +InsertSpecialChar : "Indsæt symbol", +InsertSmileyLbl : "Smiley", +InsertSmiley : "Indsæt smiley", +About : "Om FCKeditor", +Bold : "Fed", +Italic : "Kursiv", +Underline : "Understreget", +StrikeThrough : "Overstreget", +Subscript : "Sænket skrift", +Superscript : "Hævet skrift", +LeftJustify : "Venstrestillet", +CenterJustify : "Centreret", +RightJustify : "Højrestillet", +BlockJustify : "Lige margener", +DecreaseIndent : "Formindsk indrykning", +IncreaseIndent : "Forøg indrykning", +Blockquote : "Blockquote", //MISSING +Undo : "Fortryd", +Redo : "Annuller fortryd", +NumberedListLbl : "Talopstilling", +NumberedList : "Indsæt/fjern talopstilling", +BulletedListLbl : "Punktopstilling", +BulletedList : "Indsæt/fjern punktopstilling", +ShowTableBorders : "Vis tabelkanter", +ShowDetails : "Vis detaljer", +Style : "Typografi", +FontFormat : "Formatering", +Font : "Skrifttype", +FontSize : "Skriftstørrelse", +TextColor : "Tekstfarve", +BGColor : "Baggrundsfarve", +Source : "Kilde", +Find : "Søg", +Replace : "Erstat", +SpellCheck : "Stavekontrol", +UniversalKeyboard : "Universaltastatur", +PageBreakLbl : "Sidskift", +PageBreak : "Indsæt sideskift", + +Form : "Indsæt formular", +Checkbox : "Indsæt afkrydsningsfelt", +RadioButton : "Indsæt alternativknap", +TextField : "Indsæt tekstfelt", +Textarea : "Indsæt tekstboks", +HiddenField : "Indsæt skjult felt", +Button : "Indsæt knap", +SelectionField : "Indsæt liste", +ImageButton : "Indsæt billedknap", + +FitWindow : "Maksimer editor vinduet", +ShowBlocks : "Show Blocks", //MISSING + +// Context Menu +EditLink : "Rediger hyperlink", +CellCM : "Celle", +RowCM : "Række", +ColumnCM : "Kolonne", +InsertRowAfter : "Insert Row After", //MISSING +InsertRowBefore : "Insert Row Before", //MISSING +DeleteRows : "Slet række", +InsertColumnAfter : "Insert Column After", //MISSING +InsertColumnBefore : "Insert Column Before", //MISSING +DeleteColumns : "Slet kolonne", +InsertCellAfter : "Insert Cell After", //MISSING +InsertCellBefore : "Insert Cell Before", //MISSING +DeleteCells : "Slet celle", +MergeCells : "Flet celler", +MergeRight : "Merge Right", //MISSING +MergeDown : "Merge Down", //MISSING +HorizontalSplitCell : "Split Cell Horizontally", //MISSING +VerticalSplitCell : "Split Cell Vertically", //MISSING +TableDelete : "Slet tabel", +CellProperties : "Egenskaber for celle", +TableProperties : "Egenskaber for tabel", +ImageProperties : "Egenskaber for billede", +FlashProperties : "Egenskaber for Flash", + +AnchorProp : "Egenskaber for bogmærke", +ButtonProp : "Egenskaber for knap", +CheckboxProp : "Egenskaber for afkrydsningsfelt", +HiddenFieldProp : "Egenskaber for skjult felt", +RadioButtonProp : "Egenskaber for alternativknap", +ImageButtonProp : "Egenskaber for billedknap", +TextFieldProp : "Egenskaber for tekstfelt", +SelectionFieldProp : "Egenskaber for liste", +TextareaProp : "Egenskaber for tekstboks", +FormProp : "Egenskaber for formular", + +FontFormats : "Normal;Formateret;Adresse;Overskrift 1;Overskrift 2;Overskrift 3;Overskrift 4;Overskrift 5;Overskrift 6;Normal (DIV)", + +// Alerts and Messages +ProcessingXHTML : "Behandler XHTML...", +Done : "Færdig", +PasteWordConfirm : "Den tekst du forsøger at indsætte ser ud til at komme fra Word.
    Vil du rense teksten før den indsættes?", +NotCompatiblePaste : "Denne kommando er tilgændelig i Internet Explorer 5.5 eller senere.
    Vil du indsætte teksten uden at rense den ?", +UnknownToolbarItem : "Ukendt værktøjslinjeobjekt \"%1\"!", +UnknownCommand : "Ukendt kommandonavn \"%1\"!", +NotImplemented : "Kommandoen er ikke implementeret!", +UnknownToolbarSet : "Værktøjslinjen \"%1\" eksisterer ikke!", +NoActiveX : "Din browsers sikkerhedsindstillinger begrænser nogle af editorens muligheder.
    Slå \"Kør ActiveX-objekter og plug-ins\" til, ellers vil du opleve fejl og manglende muligheder.", +BrowseServerBlocked : "Browseren kunne ikke åbne de nødvendige ressourcer!
    Slå pop-up blokering fra.", +DialogBlocked : "Dialogvinduet kunne ikke åbnes!
    Slå pop-up blokering fra.", + +// Dialogs +DlgBtnOK : "OK", +DlgBtnCancel : "Annuller", +DlgBtnClose : "Luk", +DlgBtnBrowseServer : "Gennemse...", +DlgAdvancedTag : "Avanceret", +DlgOpOther : "", +DlgInfoTab : "Generelt", +DlgAlertUrl : "Indtast URL", + +// General Dialogs Labels +DlgGenNotSet : "", +DlgGenId : "Id", +DlgGenLangDir : "Tekstretning", +DlgGenLangDirLtr : "Fra venstre mod højre (LTR)", +DlgGenLangDirRtl : "Fra højre mod venstre (RTL)", +DlgGenLangCode : "Sprogkode", +DlgGenAccessKey : "Genvejstast", +DlgGenName : "Navn", +DlgGenTabIndex : "Tabulator indeks", +DlgGenLongDescr : "Udvidet beskrivelse", +DlgGenClass : "Typografiark", +DlgGenTitle : "Titel", +DlgGenContType : "Indholdstype", +DlgGenLinkCharset : "Tegnsæt", +DlgGenStyle : "Typografi", + +// Image Dialog +DlgImgTitle : "Egenskaber for billede", +DlgImgInfoTab : "Generelt", +DlgImgBtnUpload : "Upload", +DlgImgURL : "URL", +DlgImgUpload : "Upload", +DlgImgAlt : "Alternativ tekst", +DlgImgWidth : "Bredde", +DlgImgHeight : "Højde", +DlgImgLockRatio : "Lås størrelsesforhold", +DlgBtnResetSize : "Nulstil størrelse", +DlgImgBorder : "Ramme", +DlgImgHSpace : "HMargen", +DlgImgVSpace : "VMargen", +DlgImgAlign : "Justering", +DlgImgAlignLeft : "Venstre", +DlgImgAlignAbsBottom: "Absolut nederst", +DlgImgAlignAbsMiddle: "Absolut centreret", +DlgImgAlignBaseline : "Grundlinje", +DlgImgAlignBottom : "Nederst", +DlgImgAlignMiddle : "Centreret", +DlgImgAlignRight : "Højre", +DlgImgAlignTextTop : "Toppen af teksten", +DlgImgAlignTop : "Øverst", +DlgImgPreview : "Vis eksempel", +DlgImgAlertUrl : "Indtast stien til billedet", +DlgImgLinkTab : "Hyperlink", + +// Flash Dialog +DlgFlashTitle : "Egenskaber for Flash", +DlgFlashChkPlay : "Automatisk afspilning", +DlgFlashChkLoop : "Gentagelse", +DlgFlashChkMenu : "Vis Flash menu", +DlgFlashScale : "Skalér", +DlgFlashScaleAll : "Vis alt", +DlgFlashScaleNoBorder : "Ingen ramme", +DlgFlashScaleFit : "Tilpas størrelse", + +// Link Dialog +DlgLnkWindowTitle : "Egenskaber for hyperlink", +DlgLnkInfoTab : "Generelt", +DlgLnkTargetTab : "Mål", + +DlgLnkType : "Hyperlink type", +DlgLnkTypeURL : "URL", +DlgLnkTypeAnchor : "Bogmærke på denne side", +DlgLnkTypeEMail : "E-mail", +DlgLnkProto : "Protokol", +DlgLnkProtoOther : "", +DlgLnkURL : "URL", +DlgLnkAnchorSel : "Vælg et anker", +DlgLnkAnchorByName : "Efter anker navn", +DlgLnkAnchorById : "Efter element Id", +DlgLnkNoAnchors : "(Ingen bogmærker dokumentet)", +DlgLnkEMail : "E-mailadresse", +DlgLnkEMailSubject : "Emne", +DlgLnkEMailBody : "Brødtekst", +DlgLnkUpload : "Upload", +DlgLnkBtnUpload : "Upload", + +DlgLnkTarget : "Mål", +DlgLnkTargetFrame : "", +DlgLnkTargetPopup : "", +DlgLnkTargetBlank : "Nyt vindue (_blank)", +DlgLnkTargetParent : "Overordnet ramme (_parent)", +DlgLnkTargetSelf : "Samme vindue (_self)", +DlgLnkTargetTop : "Hele vinduet (_top)", +DlgLnkTargetFrameName : "Destinationsvinduets navn", +DlgLnkPopWinName : "Pop-up vinduets navn", +DlgLnkPopWinFeat : "Egenskaber for pop-up", +DlgLnkPopResize : "Skalering", +DlgLnkPopLocation : "Adresselinje", +DlgLnkPopMenu : "Menulinje", +DlgLnkPopScroll : "Scrollbars", +DlgLnkPopStatus : "Statuslinje", +DlgLnkPopToolbar : "Værktøjslinje", +DlgLnkPopFullScrn : "Fuld skærm (IE)", +DlgLnkPopDependent : "Koblet/dependent (Netscape)", +DlgLnkPopWidth : "Bredde", +DlgLnkPopHeight : "Højde", +DlgLnkPopLeft : "Position fra venstre", +DlgLnkPopTop : "Position fra toppen", + +DlnLnkMsgNoUrl : "Indtast hyperlink URL!", +DlnLnkMsgNoEMail : "Indtast e-mailaddresse!", +DlnLnkMsgNoAnchor : "Vælg bogmærke!", +DlnLnkMsgInvPopName : "The popup name must begin with an alphabetic character and must not contain spaces", //MISSING + +// Color Dialog +DlgColorTitle : "Vælg farve", +DlgColorBtnClear : "Nulstil", +DlgColorHighlight : "Markeret", +DlgColorSelected : "Valgt", + +// Smiley Dialog +DlgSmileyTitle : "Vælg smiley", + +// Special Character Dialog +DlgSpecialCharTitle : "Vælg symbol", + +// Table Dialog +DlgTableTitle : "Egenskaber for tabel", +DlgTableRows : "Rækker", +DlgTableColumns : "Kolonner", +DlgTableBorder : "Rammebredde", +DlgTableAlign : "Justering", +DlgTableAlignNotSet : "", +DlgTableAlignLeft : "Venstrestillet", +DlgTableAlignCenter : "Centreret", +DlgTableAlignRight : "Højrestillet", +DlgTableWidth : "Bredde", +DlgTableWidthPx : "pixels", +DlgTableWidthPc : "procent", +DlgTableHeight : "Højde", +DlgTableCellSpace : "Celleafstand", +DlgTableCellPad : "Cellemargen", +DlgTableCaption : "Titel", +DlgTableSummary : "Resume", + +// Table Cell Dialog +DlgCellTitle : "Egenskaber for celle", +DlgCellWidth : "Bredde", +DlgCellWidthPx : "pixels", +DlgCellWidthPc : "procent", +DlgCellHeight : "Højde", +DlgCellWordWrap : "Orddeling", +DlgCellWordWrapNotSet : "", +DlgCellWordWrapYes : "Ja", +DlgCellWordWrapNo : "Nej", +DlgCellHorAlign : "Vandret justering", +DlgCellHorAlignNotSet : "", +DlgCellHorAlignLeft : "Venstrestillet", +DlgCellHorAlignCenter : "Centreret", +DlgCellHorAlignRight: "Højrestillet", +DlgCellVerAlign : "Lodret justering", +DlgCellVerAlignNotSet : "", +DlgCellVerAlignTop : "Øverst", +DlgCellVerAlignMiddle : "Centreret", +DlgCellVerAlignBottom : "Nederst", +DlgCellVerAlignBaseline : "Grundlinje", +DlgCellRowSpan : "Højde i antal rækker", +DlgCellCollSpan : "Bredde i antal kolonner", +DlgCellBackColor : "Baggrundsfarve", +DlgCellBorderColor : "Rammefarve", +DlgCellBtnSelect : "Vælg...", + +// Find and Replace Dialog +DlgFindAndReplaceTitle : "Find and Replace", //MISSING + +// Find Dialog +DlgFindTitle : "Find", +DlgFindFindBtn : "Find", +DlgFindNotFoundMsg : "Søgeteksten blev ikke fundet!", + +// Replace Dialog +DlgReplaceTitle : "Erstat", +DlgReplaceFindLbl : "Søg efter:", +DlgReplaceReplaceLbl : "Erstat med:", +DlgReplaceCaseChk : "Forskel på store og små bogstaver", +DlgReplaceReplaceBtn : "Erstat", +DlgReplaceReplAllBtn : "Erstat alle", +DlgReplaceWordChk : "Kun hele ord", + +// Paste Operations / Dialog +PasteErrorCut : "Din browsers sikkerhedsindstillinger tillader ikke editoren at klippe tekst automatisk!
    Brug i stedet tastaturet til at klippe teksten (Ctrl+X).", +PasteErrorCopy : "Din browsers sikkerhedsindstillinger tillader ikke editoren at kopiere tekst automatisk!
    Brug i stedet tastaturet til at kopiere teksten (Ctrl+C).", + +PasteAsText : "Indsæt som ikke-formateret tekst", +PasteFromWord : "Indsæt fra Word", + +DlgPasteMsg2 : "Indsæt i feltet herunder (Ctrl+V) og klik OK.", +DlgPasteSec : "Because of your browser security settings, the editor is not able to access your clipboard data directly. You are required to paste it again in this window.", //MISSING +DlgPasteIgnoreFont : "Ignorer font definitioner", +DlgPasteRemoveStyles : "Ignorer typografi", +DlgPasteCleanBox : "Slet indhold", + +// Color Picker +ColorAutomatic : "Automatisk", +ColorMoreColors : "Flere farver...", + +// Document Properties +DocProps : "Egenskaber for dokument", + +// Anchor Dialog +DlgAnchorTitle : "Egenskaber for bogmærke", +DlgAnchorName : "Bogmærke navn", +DlgAnchorErrorName : "Indtast bogmærke navn!", + +// Speller Pages Dialog +DlgSpellNotInDic : "Ikke i ordbogen", +DlgSpellChangeTo : "Forslag", +DlgSpellBtnIgnore : "Ignorer", +DlgSpellBtnIgnoreAll : "Ignorer alle", +DlgSpellBtnReplace : "Erstat", +DlgSpellBtnReplaceAll : "Erstat alle", +DlgSpellBtnUndo : "Tilbage", +DlgSpellNoSuggestions : "- ingen forslag -", +DlgSpellProgress : "Stavekontrolen arbejder...", +DlgSpellNoMispell : "Stavekontrol færdig: Ingen fejl fundet", +DlgSpellNoChanges : "Stavekontrol færdig: Ingen ord ændret", +DlgSpellOneChange : "Stavekontrol færdig: Et ord ændret", +DlgSpellManyChanges : "Stavekontrol færdig: %1 ord ændret", + +IeSpellDownload : "Stavekontrol ikke installeret.
    Vil du hente den nu?", + +// Button Dialog +DlgButtonText : "Tekst", +DlgButtonType : "Type", +DlgButtonTypeBtn : "Button", //MISSING +DlgButtonTypeSbm : "Submit", //MISSING +DlgButtonTypeRst : "Reset", //MISSING + +// Checkbox and Radio Button Dialogs +DlgCheckboxName : "Navn", +DlgCheckboxValue : "Værdi", +DlgCheckboxSelected : "Valgt", + +// Form Dialog +DlgFormName : "Navn", +DlgFormAction : "Handling", +DlgFormMethod : "Metod", + +// Select Field Dialog +DlgSelectName : "Navn", +DlgSelectValue : "Værdi", +DlgSelectSize : "Størrelse", +DlgSelectLines : "linier", +DlgSelectChkMulti : "Tillad flere valg", +DlgSelectOpAvail : "Valgmuligheder", +DlgSelectOpText : "Tekst", +DlgSelectOpValue : "Værdi", +DlgSelectBtnAdd : "Tilføj", +DlgSelectBtnModify : "Rediger", +DlgSelectBtnUp : "Op", +DlgSelectBtnDown : "Ned", +DlgSelectBtnSetValue : "Sæt som valgt", +DlgSelectBtnDelete : "Slet", + +// Textarea Dialog +DlgTextareaName : "Navn", +DlgTextareaCols : "Kolonner", +DlgTextareaRows : "Rækker", + +// Text Field Dialog +DlgTextName : "Navn", +DlgTextValue : "Værdi", +DlgTextCharWidth : "Bredde (tegn)", +DlgTextMaxChars : "Max antal tegn", +DlgTextType : "Type", +DlgTextTypeText : "Tekst", +DlgTextTypePass : "Adgangskode", + +// Hidden Field Dialog +DlgHiddenName : "Navn", +DlgHiddenValue : "Værdi", + +// Bulleted List Dialog +BulletedListProp : "Egenskaber for punktopstilling", +NumberedListProp : "Egenskaber for talopstilling", +DlgLstStart : "Start", //MISSING +DlgLstType : "Type", +DlgLstTypeCircle : "Cirkel", +DlgLstTypeDisc : "Udfyldt cirkel", +DlgLstTypeSquare : "Firkant", +DlgLstTypeNumbers : "Nummereret (1, 2, 3)", +DlgLstTypeLCase : "Små bogstaver (a, b, c)", +DlgLstTypeUCase : "Store bogstaver (A, B, C)", +DlgLstTypeSRoman : "Små romertal (i, ii, iii)", +DlgLstTypeLRoman : "Store romertal (I, II, III)", + +// Document Properties Dialog +DlgDocGeneralTab : "Generelt", +DlgDocBackTab : "Baggrund", +DlgDocColorsTab : "Farver og margen", +DlgDocMetaTab : "Metadata", + +DlgDocPageTitle : "Sidetitel", +DlgDocLangDir : "Sprog", +DlgDocLangDirLTR : "Fra venstre mod højre (LTR)", +DlgDocLangDirRTL : "Fra højre mod venstre (RTL)", +DlgDocLangCode : "Landekode", +DlgDocCharSet : "Tegnsæt kode", +DlgDocCharSetCE : "Central European", //MISSING +DlgDocCharSetCT : "Chinese Traditional (Big5)", //MISSING +DlgDocCharSetCR : "Cyrillic", //MISSING +DlgDocCharSetGR : "Greek", //MISSING +DlgDocCharSetJP : "Japanese", //MISSING +DlgDocCharSetKR : "Korean", //MISSING +DlgDocCharSetTR : "Turkish", //MISSING +DlgDocCharSetUN : "Unicode (UTF-8)", //MISSING +DlgDocCharSetWE : "Western European", //MISSING +DlgDocCharSetOther : "Anden tegnsæt kode", + +DlgDocDocType : "Dokumenttype kategori", +DlgDocDocTypeOther : "Anden dokumenttype kategori", +DlgDocIncXHTML : "Inkludere XHTML deklartion", +DlgDocBgColor : "Baggrundsfarve", +DlgDocBgImage : "Baggrundsbillede URL", +DlgDocBgNoScroll : "Fastlåst baggrund", +DlgDocCText : "Tekst", +DlgDocCLink : "Hyperlink", +DlgDocCVisited : "Besøgt hyperlink", +DlgDocCActive : "Aktivt hyperlink", +DlgDocMargins : "Sidemargen", +DlgDocMaTop : "Øverst", +DlgDocMaLeft : "Venstre", +DlgDocMaRight : "Højre", +DlgDocMaBottom : "Nederst", +DlgDocMeIndex : "Dokument index nøgleord (kommasepareret)", +DlgDocMeDescr : "Dokument beskrivelse", +DlgDocMeAuthor : "Forfatter", +DlgDocMeCopy : "Copyright", +DlgDocPreview : "Vis", + +// Templates Dialog +Templates : "Skabeloner", +DlgTemplatesTitle : "Indholdsskabeloner", +DlgTemplatesSelMsg : "Vælg den skabelon, som skal åbnes i editoren.
    (Nuværende indhold vil blive overskrevet!):", +DlgTemplatesLoading : "Henter liste over skabeloner...", +DlgTemplatesNoTpl : "(Der er ikke defineret nogen skabelon!)", +DlgTemplatesReplace : "Replace actual contents", //MISSING + +// About Dialog +DlgAboutAboutTab : "Om", +DlgAboutBrowserInfoTab : "Generelt", +DlgAboutLicenseTab : "Licens", +DlgAboutVersion : "version", +DlgAboutInfo : "For yderlig information gå til" +}; diff --git a/FCKeditor/editor/lang/de.js b/FCKeditor/editor/lang/de.js new file mode 100644 index 0000000..e45a672 --- /dev/null +++ b/FCKeditor/editor/lang/de.js @@ -0,0 +1,516 @@ +/* + * FCKeditor - The text editor for Internet - http://www.fckeditor.net + * Copyright (C) 2003-2007 Frederico Caldeira Knabben + * + * == BEGIN LICENSE == + * + * Licensed under the terms of any of the following licenses at your + * choice: + * + * - GNU General Public License Version 2 or later (the "GPL") + * http://www.gnu.org/licenses/gpl.html + * + * - GNU Lesser General Public License Version 2.1 or later (the "LGPL") + * http://www.gnu.org/licenses/lgpl.html + * + * - Mozilla Public License Version 1.1 or later (the "MPL") + * http://www.mozilla.org/MPL/MPL-1.1.html + * + * == END LICENSE == + * + * German language file. + */ + +var FCKLang = +{ +// Language direction : "ltr" (left to right) or "rtl" (right to left). +Dir : "ltr", + +ToolbarCollapse : "Symbolleiste einklappen", +ToolbarExpand : "Symbolleiste ausklappen", + +// Toolbar Items and Context Menu +Save : "Speichern", +NewPage : "Neue Seite", +Preview : "Vorschau", +Cut : "Ausschneiden", +Copy : "Kopieren", +Paste : "Einfügen", +PasteText : "aus Textdatei einfügen", +PasteWord : "aus MS-Word einfügen", +Print : "Drucken", +SelectAll : "Alles auswählen", +RemoveFormat : "Formatierungen entfernen", +InsertLinkLbl : "Link", +InsertLink : "Link einfügen/editieren", +RemoveLink : "Link entfernen", +Anchor : "Anker einfügen/editieren", +AnchorDelete : "Anker entfernen", +InsertImageLbl : "Bild", +InsertImage : "Bild einfügen/editieren", +InsertFlashLbl : "Flash", +InsertFlash : "Flash einfügen/editieren", +InsertTableLbl : "Tabelle", +InsertTable : "Tabelle einfügen/editieren", +InsertLineLbl : "Linie", +InsertLine : "Horizontale Linie einfügen", +InsertSpecialCharLbl: "Sonderzeichen", +InsertSpecialChar : "Sonderzeichen einfügen/editieren", +InsertSmileyLbl : "Smiley", +InsertSmiley : "Smiley einfügen", +About : "Über FCKeditor", +Bold : "Fett", +Italic : "Kursiv", +Underline : "Unterstrichen", +StrikeThrough : "Durchgestrichen", +Subscript : "Tiefgestellt", +Superscript : "Hochgestellt", +LeftJustify : "Linksbündig", +CenterJustify : "Zentriert", +RightJustify : "Rechtsbündig", +BlockJustify : "Blocksatz", +DecreaseIndent : "Einzug verringern", +IncreaseIndent : "Einzug erhöhen", +Blockquote : "Zitatblock", +Undo : "Rückgängig", +Redo : "Wiederherstellen", +NumberedListLbl : "Nummerierte Liste", +NumberedList : "Nummerierte Liste einfügen/entfernen", +BulletedListLbl : "Liste", +BulletedList : "Liste einfügen/entfernen", +ShowTableBorders : "Zeige Tabellenrahmen", +ShowDetails : "Zeige Details", +Style : "Stil", +FontFormat : "Format", +Font : "Schriftart", +FontSize : "Größe", +TextColor : "Textfarbe", +BGColor : "Hintergrundfarbe", +Source : "Quellcode", +Find : "Suchen", +Replace : "Ersetzen", +SpellCheck : "Rechtschreibprüfung", +UniversalKeyboard : "Universal-Tastatur", +PageBreakLbl : "Seitenumbruch", +PageBreak : "Seitenumbruch einfügen", + +Form : "Formular", +Checkbox : "Checkbox", +RadioButton : "Radiobutton", +TextField : "Textfeld einzeilig", +Textarea : "Textfeld mehrzeilig", +HiddenField : "verstecktes Feld", +Button : "Klickbutton", +SelectionField : "Auswahlfeld", +ImageButton : "Bildbutton", + +FitWindow : "Editor maximieren", +ShowBlocks : "Blöcke anzeigen", + +// Context Menu +EditLink : "Link editieren", +CellCM : "Zelle", +RowCM : "Zeile", +ColumnCM : "Spalte", +InsertRowAfter : "Zeile unterhalb einfügen", +InsertRowBefore : "Zeile oberhalb einfügen", +DeleteRows : "Zeile entfernen", +InsertColumnAfter : "Spalte rechts danach einfügen", +InsertColumnBefore : "Spalte links davor einfügen", +DeleteColumns : "Spalte löschen", +InsertCellAfter : "Zelle danach einfügen", +InsertCellBefore : "Zelle davor einfügen", +DeleteCells : "Zelle löschen", +MergeCells : "Zellen verbinden", +MergeRight : "nach rechts verbinden", +MergeDown : "nach unten verbinden", +HorizontalSplitCell : "Zelle horizontal teilen", +VerticalSplitCell : "Zelle vertikal teilen", +TableDelete : "Tabelle löschen", +CellProperties : "Zellen-Eigenschaften", +TableProperties : "Tabellen-Eigenschaften", +ImageProperties : "Bild-Eigenschaften", +FlashProperties : "Flash-Eigenschaften", + +AnchorProp : "Anker-Eigenschaften", +ButtonProp : "Button-Eigenschaften", +CheckboxProp : "Checkbox-Eigenschaften", +HiddenFieldProp : "Verstecktes Feld-Eigenschaften", +RadioButtonProp : "Optionsfeld-Eigenschaften", +ImageButtonProp : "Bildbutton-Eigenschaften", +TextFieldProp : "Textfeld (einzeilig) Eigenschaften", +SelectionFieldProp : "Auswahlfeld-Eigenschaften", +TextareaProp : "Textfeld (mehrzeilig) Eigenschaften", +FormProp : "Formular-Eigenschaften", + +FontFormats : "Normal;Formatiert;Addresse;Überschrift 1;Überschrift 2;Überschrift 3;Überschrift 4;Überschrift 5;Überschrift 6;Normal (DIV)", + +// Alerts and Messages +ProcessingXHTML : "Bearbeite XHTML. Bitte warten...", +Done : "Fertig", +PasteWordConfirm : "Der Text, den Sie einfügen möchten, scheint aus MS-Word kopiert zu sein. Möchten Sie ihn zuvor bereinigen lassen?", +NotCompatiblePaste : "Diese Funktion steht nur im Internet Explorer ab Version 5.5 zur Verfügung. Möchten Sie den Text unbereinigt einfügen?", +UnknownToolbarItem : "Unbekanntes Menüleisten-Objekt \"%1\"", +UnknownCommand : "Unbekannter Befehl \"%1\"", +NotImplemented : "Befehl nicht implementiert", +UnknownToolbarSet : "Menüleiste \"%1\" existiert nicht", +NoActiveX : "Die Sicherheitseinstellungen Ihres Browsers beschränken evtl. einige Funktionen des Editors. Aktivieren Sie die Option \"ActiveX-Steuerelemente und Plugins ausführen\" in den Sicherheitseinstellungen, um diese Funktionen nutzen zu können", +BrowseServerBlocked : "Ein Auswahlfenster konnte nicht geöffnet werden. Stellen Sie sicher, das alle Popup-Blocker ausgeschaltet sind.", +DialogBlocked : "Das Dialog-Fenster konnte nicht geöffnet werden. Stellen Sie sicher, das alle Popup-Blocker ausgeschaltet sind.", + +// Dialogs +DlgBtnOK : "OK", +DlgBtnCancel : "Abbrechen", +DlgBtnClose : "Schließen", +DlgBtnBrowseServer : "Server durchsuchen", +DlgAdvancedTag : "Erweitert", +DlgOpOther : "", +DlgInfoTab : "Info", +DlgAlertUrl : "Bitte tragen Sie die URL ein", + +// General Dialogs Labels +DlgGenNotSet : "", +DlgGenId : "ID", +DlgGenLangDir : "Schreibrichtung", +DlgGenLangDirLtr : "Links nach Rechts (LTR)", +DlgGenLangDirRtl : "Rechts nach Links (RTL)", +DlgGenLangCode : "Sprachenkürzel", +DlgGenAccessKey : "Zugriffstaste", +DlgGenName : "Name", +DlgGenTabIndex : "Tab-Index", +DlgGenLongDescr : "Langform URL", +DlgGenClass : "Stylesheet Klasse", +DlgGenTitle : "Titel Beschreibung", +DlgGenContType : "Inhaltstyp", +DlgGenLinkCharset : "Ziel-Zeichensatz", +DlgGenStyle : "Style", + +// Image Dialog +DlgImgTitle : "Bild-Eigenschaften", +DlgImgInfoTab : "Bild-Info", +DlgImgBtnUpload : "Zum Server senden", +DlgImgURL : "Bildauswahl", +DlgImgUpload : "Upload", +DlgImgAlt : "Alternativer Text", +DlgImgWidth : "Breite", +DlgImgHeight : "Höhe", +DlgImgLockRatio : "Größenverhältniss beibehalten", +DlgBtnResetSize : "Größe zurücksetzen", +DlgImgBorder : "Rahmen", +DlgImgHSpace : "H-Abstand", +DlgImgVSpace : "V-Abstand", +DlgImgAlign : "Ausrichtung", +DlgImgAlignLeft : "Links", +DlgImgAlignAbsBottom: "Abs Unten", +DlgImgAlignAbsMiddle: "Abs Mitte", +DlgImgAlignBaseline : "Baseline", +DlgImgAlignBottom : "Unten", +DlgImgAlignMiddle : "Mitte", +DlgImgAlignRight : "Rechts", +DlgImgAlignTextTop : "Text Oben", +DlgImgAlignTop : "Oben", +DlgImgPreview : "Vorschau", +DlgImgAlertUrl : "Bitte geben Sie die Bild-URL an", +DlgImgLinkTab : "Link", + +// Flash Dialog +DlgFlashTitle : "Flash-Eigenschaften", +DlgFlashChkPlay : "autom. Abspielen", +DlgFlashChkLoop : "Endlosschleife", +DlgFlashChkMenu : "Flash-Menü aktivieren", +DlgFlashScale : "Skalierung", +DlgFlashScaleAll : "Alles anzeigen", +DlgFlashScaleNoBorder : "ohne Rand", +DlgFlashScaleFit : "Passgenau", + +// Link Dialog +DlgLnkWindowTitle : "Link", +DlgLnkInfoTab : "Link-Info", +DlgLnkTargetTab : "Zielseite", + +DlgLnkType : "Link-Typ", +DlgLnkTypeURL : "URL", +DlgLnkTypeAnchor : "Anker in dieser Seite", +DlgLnkTypeEMail : "E-Mail", +DlgLnkProto : "Protokoll", +DlgLnkProtoOther : "", +DlgLnkURL : "URL", +DlgLnkAnchorSel : "Anker auswählen", +DlgLnkAnchorByName : "nach Anker Name", +DlgLnkAnchorById : "nach Element Id", +DlgLnkNoAnchors : "(keine Anker im Dokument vorhanden)", +DlgLnkEMail : "E-Mail Addresse", +DlgLnkEMailSubject : "Betreffzeile", +DlgLnkEMailBody : "Nachrichtentext", +DlgLnkUpload : "Upload", +DlgLnkBtnUpload : "Zum Server senden", + +DlgLnkTarget : "Zielseite", +DlgLnkTargetFrame : "", +DlgLnkTargetPopup : "", +DlgLnkTargetBlank : "Neues Fenster (_blank)", +DlgLnkTargetParent : "Oberes Fenster (_parent)", +DlgLnkTargetSelf : "Gleiches Fenster (_self)", +DlgLnkTargetTop : "Oberstes Fenster (_top)", +DlgLnkTargetFrameName : "Ziel-Fenster-Name", +DlgLnkPopWinName : "Pop-up Fenster-Name", +DlgLnkPopWinFeat : "Pop-up Fenster-Eigenschaften", +DlgLnkPopResize : "Vergrößerbar", +DlgLnkPopLocation : "Adress-Leiste", +DlgLnkPopMenu : "Menü-Leiste", +DlgLnkPopScroll : "Rollbalken", +DlgLnkPopStatus : "Statusleiste", +DlgLnkPopToolbar : "Werkzeugleiste", +DlgLnkPopFullScrn : "Vollbild (IE)", +DlgLnkPopDependent : "Abhängig (Netscape)", +DlgLnkPopWidth : "Breite", +DlgLnkPopHeight : "Höhe", +DlgLnkPopLeft : "Linke Position", +DlgLnkPopTop : "Obere Position", + +DlnLnkMsgNoUrl : "Bitte geben Sie die Link-URL an", +DlnLnkMsgNoEMail : "Bitte geben Sie e-Mail Adresse an", +DlnLnkMsgNoAnchor : "Bitte wählen Sie einen Anker aus", +DlnLnkMsgInvPopName : "Der Name des Popups muss mit einem Buchstaben beginnen und darf keine Leerzeichen enthalten", + +// Color Dialog +DlgColorTitle : "Farbauswahl", +DlgColorBtnClear : "Keine Farbe", +DlgColorHighlight : "Vorschau", +DlgColorSelected : "Ausgewählt", + +// Smiley Dialog +DlgSmileyTitle : "Smiley auswählen", + +// Special Character Dialog +DlgSpecialCharTitle : "Sonderzeichen auswählen", + +// Table Dialog +DlgTableTitle : "Tabellen-Eigenschaften", +DlgTableRows : "Zeile", +DlgTableColumns : "Spalte", +DlgTableBorder : "Rahmen", +DlgTableAlign : "Ausrichtung", +DlgTableAlignNotSet : "", +DlgTableAlignLeft : "Links", +DlgTableAlignCenter : "Zentriert", +DlgTableAlignRight : "Rechts", +DlgTableWidth : "Breite", +DlgTableWidthPx : "Pixel", +DlgTableWidthPc : "%", +DlgTableHeight : "Höhe", +DlgTableCellSpace : "Zellenabstand außen", +DlgTableCellPad : "Zellenabstand innen", +DlgTableCaption : "Überschrift", +DlgTableSummary : "Inhaltsübersicht", + +// Table Cell Dialog +DlgCellTitle : "Zellen-Eigenschaften", +DlgCellWidth : "Breite", +DlgCellWidthPx : "Pixel", +DlgCellWidthPc : "%", +DlgCellHeight : "Höhe", +DlgCellWordWrap : "Umbruch", +DlgCellWordWrapNotSet : "", +DlgCellWordWrapYes : "Ja", +DlgCellWordWrapNo : "Nein", +DlgCellHorAlign : "Horizontale Ausrichtung", +DlgCellHorAlignNotSet : "", +DlgCellHorAlignLeft : "Links", +DlgCellHorAlignCenter : "Zentriert", +DlgCellHorAlignRight: "Rechts", +DlgCellVerAlign : "Vertikale Ausrichtung", +DlgCellVerAlignNotSet : "", +DlgCellVerAlignTop : "Oben", +DlgCellVerAlignMiddle : "Mitte", +DlgCellVerAlignBottom : "Unten", +DlgCellVerAlignBaseline : "Grundlinie", +DlgCellRowSpan : "Zeilen zusammenfassen", +DlgCellCollSpan : "Spalten zusammenfassen", +DlgCellBackColor : "Hintergrundfarbe", +DlgCellBorderColor : "Rahmenfarbe", +DlgCellBtnSelect : "Auswahl...", + +// Find and Replace Dialog +DlgFindAndReplaceTitle : "Suchen und Ersetzen", + +// Find Dialog +DlgFindTitle : "Finden", +DlgFindFindBtn : "Finden", +DlgFindNotFoundMsg : "Der gesuchte Text wurde nicht gefunden.", + +// Replace Dialog +DlgReplaceTitle : "Ersetzen", +DlgReplaceFindLbl : "Suche nach:", +DlgReplaceReplaceLbl : "Ersetze mit:", +DlgReplaceCaseChk : "Groß-Kleinschreibung beachten", +DlgReplaceReplaceBtn : "Ersetzen", +DlgReplaceReplAllBtn : "Alle Ersetzen", +DlgReplaceWordChk : "Nur ganze Worte suchen", + +// Paste Operations / Dialog +PasteErrorCut : "Die Sicherheitseinstellungen Ihres Browsers lassen es nicht zu, den Text automatisch auszuschneiden. Bitte benutzen Sie die System-Zwischenablage über STRG-X (ausschneiden) und STRG-V (einfügen).", +PasteErrorCopy : "Die Sicherheitseinstellungen Ihres Browsers lassen es nicht zu, den Text automatisch kopieren. Bitte benutzen Sie die System-Zwischenablage über STRG-C (kopieren).", + +PasteAsText : "Als Text einfügen", +PasteFromWord : "Aus Word einfügen", + +DlgPasteMsg2 : "Bitte fügen Sie den Text in der folgenden Box über die Tastatur (mit Strg+V) ein und bestätigen Sie mit OK.", +DlgPasteSec : "Aufgrund von Sicherheitsbeschränkungen Ihres Browsers kann der Editor nicht direkt auf die Zwischenablage zugreifen. Bitte fügen Sie den Inhalt erneut in diesem Fenster ein.", +DlgPasteIgnoreFont : "Ignoriere Schriftart-Definitionen", +DlgPasteRemoveStyles : "Entferne Style-Definitionen", +DlgPasteCleanBox : "Inhalt aufräumen", + +// Color Picker +ColorAutomatic : "Automatisch", +ColorMoreColors : "Weitere Farben...", + +// Document Properties +DocProps : "Dokument-Eigenschaften", + +// Anchor Dialog +DlgAnchorTitle : "Anker-Eigenschaften", +DlgAnchorName : "Anker Name", +DlgAnchorErrorName : "Bitte geben Sie den Namen des Ankers ein", + +// Speller Pages Dialog +DlgSpellNotInDic : "Nicht im Wörterbuch", +DlgSpellChangeTo : "Ändern in", +DlgSpellBtnIgnore : "Ignorieren", +DlgSpellBtnIgnoreAll : "Alle Ignorieren", +DlgSpellBtnReplace : "Ersetzen", +DlgSpellBtnReplaceAll : "Alle Ersetzen", +DlgSpellBtnUndo : "Rückgängig", +DlgSpellNoSuggestions : " - keine Vorschläge - ", +DlgSpellProgress : "Rechtschreibprüfung läuft...", +DlgSpellNoMispell : "Rechtschreibprüfung abgeschlossen - keine Fehler gefunden", +DlgSpellNoChanges : "Rechtschreibprüfung abgeschlossen - keine Worte geändert", +DlgSpellOneChange : "Rechtschreibprüfung abgeschlossen - ein Wort geändert", +DlgSpellManyChanges : "Rechtschreibprüfung abgeschlossen - %1 Wörter geändert", + +IeSpellDownload : "Rechtschreibprüfung nicht installiert. Möchten Sie sie jetzt herunterladen?", + +// Button Dialog +DlgButtonText : "Text (Wert)", +DlgButtonType : "Typ", +DlgButtonTypeBtn : "Button", +DlgButtonTypeSbm : "Absenden", +DlgButtonTypeRst : "Zurücksetzen", + +// Checkbox and Radio Button Dialogs +DlgCheckboxName : "Name", +DlgCheckboxValue : "Wert", +DlgCheckboxSelected : "ausgewählt", + +// Form Dialog +DlgFormName : "Name", +DlgFormAction : "Action", +DlgFormMethod : "Method", + +// Select Field Dialog +DlgSelectName : "Name", +DlgSelectValue : "Wert", +DlgSelectSize : "Größe", +DlgSelectLines : "Linien", +DlgSelectChkMulti : "Erlaube Mehrfachauswahl", +DlgSelectOpAvail : "Mögliche Optionen", +DlgSelectOpText : "Text", +DlgSelectOpValue : "Wert", +DlgSelectBtnAdd : "Hinzufügen", +DlgSelectBtnModify : "Ändern", +DlgSelectBtnUp : "Hoch", +DlgSelectBtnDown : "Runter", +DlgSelectBtnSetValue : "Setze als Standardwert", +DlgSelectBtnDelete : "Entfernen", + +// Textarea Dialog +DlgTextareaName : "Name", +DlgTextareaCols : "Spalten", +DlgTextareaRows : "Reihen", + +// Text Field Dialog +DlgTextName : "Name", +DlgTextValue : "Wert", +DlgTextCharWidth : "Zeichenbreite", +DlgTextMaxChars : "Max. Zeichen", +DlgTextType : "Typ", +DlgTextTypeText : "Text", +DlgTextTypePass : "Passwort", + +// Hidden Field Dialog +DlgHiddenName : "Name", +DlgHiddenValue : "Wert", + +// Bulleted List Dialog +BulletedListProp : "Listen-Eigenschaften", +NumberedListProp : "Nummerierte Listen-Eigenschaften", +DlgLstStart : "Start", +DlgLstType : "Typ", +DlgLstTypeCircle : "Ring", +DlgLstTypeDisc : "Kreis", +DlgLstTypeSquare : "Quadrat", +DlgLstTypeNumbers : "Nummern (1, 2, 3)", +DlgLstTypeLCase : "Kleinbuchstaben (a, b, c)", +DlgLstTypeUCase : "Großbuchstaben (A, B, C)", +DlgLstTypeSRoman : "Kleine römische Zahlen (i, ii, iii)", +DlgLstTypeLRoman : "Große römische Zahlen (I, II, III)", + +// Document Properties Dialog +DlgDocGeneralTab : "Allgemein", +DlgDocBackTab : "Hintergrund", +DlgDocColorsTab : "Farben und Abstände", +DlgDocMetaTab : "Metadaten", + +DlgDocPageTitle : "Seitentitel", +DlgDocLangDir : "Schriftrichtung", +DlgDocLangDirLTR : "Links nach Rechts", +DlgDocLangDirRTL : "Rechts nach Links", +DlgDocLangCode : "Sprachkürzel", +DlgDocCharSet : "Zeichenkodierung", +DlgDocCharSetCE : "Zentraleuropäisch", +DlgDocCharSetCT : "traditionell Chinesisch (Big5)", +DlgDocCharSetCR : "Kyrillisch", +DlgDocCharSetGR : "Griechisch", +DlgDocCharSetJP : "Japanisch", +DlgDocCharSetKR : "Koreanisch", +DlgDocCharSetTR : "Türkisch", +DlgDocCharSetUN : "Unicode (UTF-8)", +DlgDocCharSetWE : "Westeuropäisch", +DlgDocCharSetOther : "Andere Zeichenkodierung", + +DlgDocDocType : "Dokumententyp", +DlgDocDocTypeOther : "Anderer Dokumententyp", +DlgDocIncXHTML : "Beziehe XHTML Deklarationen ein", +DlgDocBgColor : "Hintergrundfarbe", +DlgDocBgImage : "Hintergrundbild URL", +DlgDocBgNoScroll : "feststehender Hintergrund", +DlgDocCText : "Text", +DlgDocCLink : "Link", +DlgDocCVisited : "Besuchter Link", +DlgDocCActive : "Aktiver Link", +DlgDocMargins : "Seitenränder", +DlgDocMaTop : "Oben", +DlgDocMaLeft : "Links", +DlgDocMaRight : "Rechts", +DlgDocMaBottom : "Unten", +DlgDocMeIndex : "Schlüsselwörter (durch Komma getrennt)", +DlgDocMeDescr : "Dokument-Beschreibung", +DlgDocMeAuthor : "Autor", +DlgDocMeCopy : "Copyright", +DlgDocPreview : "Vorschau", + +// Templates Dialog +Templates : "Vorlagen", +DlgTemplatesTitle : "Vorlagen", +DlgTemplatesSelMsg : "Klicken Sie auf eine Vorlage, um sie im Editor zu öffnen (der aktuelle Inhalt wird dabei gelöscht!):", +DlgTemplatesLoading : "Liste der Vorlagen wird geladen. Bitte warten...", +DlgTemplatesNoTpl : "(keine Vorlagen definiert)", +DlgTemplatesReplace : "Aktuellen Inhalt ersetzen", + +// About Dialog +DlgAboutAboutTab : "Über", +DlgAboutBrowserInfoTab : "Browser-Info", +DlgAboutLicenseTab : "Lizenz", +DlgAboutVersion : "Version", +DlgAboutInfo : "Für weitere Informationen siehe" +}; diff --git a/FCKeditor/editor/lang/el.js b/FCKeditor/editor/lang/el.js new file mode 100644 index 0000000..de66866 --- /dev/null +++ b/FCKeditor/editor/lang/el.js @@ -0,0 +1,516 @@ +/* + * FCKeditor - The text editor for Internet - http://www.fckeditor.net + * Copyright (C) 2003-2007 Frederico Caldeira Knabben + * + * == BEGIN LICENSE == + * + * Licensed under the terms of any of the following licenses at your + * choice: + * + * - GNU General Public License Version 2 or later (the "GPL") + * http://www.gnu.org/licenses/gpl.html + * + * - GNU Lesser General Public License Version 2.1 or later (the "LGPL") + * http://www.gnu.org/licenses/lgpl.html + * + * - Mozilla Public License Version 1.1 or later (the "MPL") + * http://www.mozilla.org/MPL/MPL-1.1.html + * + * == END LICENSE == + * + * Greek language file. + */ + +var FCKLang = +{ +// Language direction : "ltr" (left to right) or "rtl" (right to left). +Dir : "ltr", + +ToolbarCollapse : "Απόκρυψη Μπάρας Εργαλείων", +ToolbarExpand : "Εμφάνιση Μπάρας Εργαλείων", + +// Toolbar Items and Context Menu +Save : "Αποθήκευση", +NewPage : "Νέα Σελίδα", +Preview : "Προεπισκόπιση", +Cut : "Αποκοπή", +Copy : "Αντιγραφή", +Paste : "Επικόλληση", +PasteText : "Επικόλληση (απλό κείμενο)", +PasteWord : "Επικόλληση από το Word", +Print : "Εκτύπωση", +SelectAll : "Επιλογή όλων", +RemoveFormat : "Αφαίρεση Μορφοποίησης", +InsertLinkLbl : "Σύνδεσμος (Link)", +InsertLink : "Εισαγωγή/Μεταβολή Συνδέσμου (Link)", +RemoveLink : "Αφαίρεση Συνδέσμου (Link)", +Anchor : "Εισαγωγή/επεξεργασία Anchor", +AnchorDelete : "Remove Anchor", //MISSING +InsertImageLbl : "Εικόνα", +InsertImage : "Εισαγωγή/Μεταβολή Εικόνας", +InsertFlashLbl : "Εισαγωγή Flash", +InsertFlash : "Εισαγωγή/επεξεργασία Flash", +InsertTableLbl : "Πίνακας", +InsertTable : "Εισαγωγή/Μεταβολή Πίνακα", +InsertLineLbl : "Γραμμή", +InsertLine : "Εισαγωγή Οριζόντιας Γραμμής", +InsertSpecialCharLbl: "Ειδικό Σύμβολο", +InsertSpecialChar : "Εισαγωγή Ειδικού Συμβόλου", +InsertSmileyLbl : "Smiley", +InsertSmiley : "Εισαγωγή Smiley", +About : "Περί του FCKeditor", +Bold : "Έντονα", +Italic : "Πλάγια", +Underline : "Υπογράμμιση", +StrikeThrough : "Διαγράμμιση", +Subscript : "Δείκτης", +Superscript : "Εκθέτης", +LeftJustify : "Στοίχιση Αριστερά", +CenterJustify : "Στοίχιση στο Κέντρο", +RightJustify : "Στοίχιση Δεξιά", +BlockJustify : "Πλήρης Στοίχιση (Block)", +DecreaseIndent : "Μείωση Εσοχής", +IncreaseIndent : "Αύξηση Εσοχής", +Blockquote : "Blockquote", //MISSING +Undo : "Αναίρεση", +Redo : "Επαναφορά", +NumberedListLbl : "Λίστα με Αριθμούς", +NumberedList : "Εισαγωγή/Διαγραφή Λίστας με Αριθμούς", +BulletedListLbl : "Λίστα με Bullets", +BulletedList : "Εισαγωγή/Διαγραφή Λίστας με Bullets", +ShowTableBorders : "Προβολή Ορίων Πίνακα", +ShowDetails : "Προβολή Λεπτομερειών", +Style : "Στυλ", +FontFormat : "Μορφή Γραμματοσειράς", +Font : "Γραμματοσειρά", +FontSize : "Μέγεθος", +TextColor : "Χρώμα Γραμμάτων", +BGColor : "Χρώμα Υποβάθρου", +Source : "HTML κώδικας", +Find : "Αναζήτηση", +Replace : "Αντικατάσταση", +SpellCheck : "Ορθογραφικός έλεγχος", +UniversalKeyboard : "Διεθνής πληκτρολόγιο", +PageBreakLbl : "Τέλος σελίδας", +PageBreak : "Εισαγωγή τέλους σελίδας", + +Form : "Φόρμα", +Checkbox : "Κουτί επιλογής", +RadioButton : "Κουμπί Radio", +TextField : "Πεδίο κειμένου", +Textarea : "Περιοχή κειμένου", +HiddenField : "Κρυφό πεδίο", +Button : "Κουμπί", +SelectionField : "Πεδίο επιλογής", +ImageButton : "Κουμπί εικόνας", + +FitWindow : "Μεγιστοποίηση προγράμματος", +ShowBlocks : "Show Blocks", //MISSING + +// Context Menu +EditLink : "Μεταβολή Συνδέσμου (Link)", +CellCM : "Κελί", +RowCM : "Σειρά", +ColumnCM : "Στήλη", +InsertRowAfter : "Insert Row After", //MISSING +InsertRowBefore : "Insert Row Before", //MISSING +DeleteRows : "Διαγραφή Γραμμών", +InsertColumnAfter : "Insert Column After", //MISSING +InsertColumnBefore : "Insert Column Before", //MISSING +DeleteColumns : "Διαγραφή Κολωνών", +InsertCellAfter : "Insert Cell After", //MISSING +InsertCellBefore : "Insert Cell Before", //MISSING +DeleteCells : "Διαγραφή Κελιών", +MergeCells : "Ενοποίηση Κελιών", +MergeRight : "Merge Right", //MISSING +MergeDown : "Merge Down", //MISSING +HorizontalSplitCell : "Split Cell Horizontally", //MISSING +VerticalSplitCell : "Split Cell Vertically", //MISSING +TableDelete : "Διαγραφή πίνακα", +CellProperties : "Ιδιότητες Κελιού", +TableProperties : "Ιδιότητες Πίνακα", +ImageProperties : "Ιδιότητες Εικόνας", +FlashProperties : "Ιδιότητες Flash", + +AnchorProp : "Ιδιότητες άγκυρας", +ButtonProp : "Ιδιότητες κουμπιού", +CheckboxProp : "Ιδιότητες κουμπιού επιλογής", +HiddenFieldProp : "Ιδιότητες κρυφού πεδίου", +RadioButtonProp : "Ιδιότητες κουμπιού radio", +ImageButtonProp : "Ιδιότητες κουμπιού εικόνας", +TextFieldProp : "Ιδιότητες πεδίου κειμένου", +SelectionFieldProp : "Ιδιότητες πεδίου επιλογής", +TextareaProp : "Ιδιότητες περιοχής κειμένου", +FormProp : "Ιδιότητες φόρμας", + +FontFormats : "Κανονικό;Μορφοποιημένο;Διεύθυνση;Επικεφαλίδα 1;Επικεφαλίδα 2;Επικεφαλίδα 3;Επικεφαλίδα 4;Επικεφαλίδα 5;Επικεφαλίδα 6", + +// Alerts and Messages +ProcessingXHTML : "Επεξεργασία XHTML. Παρακαλώ περιμένετε...", +Done : "Έτοιμο", +PasteWordConfirm : "Το κείμενο που θέλετε να επικολήσετε, φαίνεται πως προέρχεται από το Word. Θέλετε να καθαριστεί πριν επικοληθεί;", +NotCompatiblePaste : "Αυτή η επιλογή είναι διαθέσιμη στον Internet Explorer έκδοση 5.5+. Θέλετε να γίνει η επικόλληση χωρίς καθαρισμό;", +UnknownToolbarItem : "Άγνωστο αντικείμενο της μπάρας εργαλείων \"%1\"", +UnknownCommand : "Άγνωστή εντολή \"%1\"", +NotImplemented : "Η εντολή δεν έχει ενεργοποιηθεί", +UnknownToolbarSet : "Η μπάρα εργαλείων \"%1\" δεν υπάρχει", +NoActiveX : "Οι ρυθμίσεις ασφαλείας του browser σας μπορεί να περιορίσουν κάποιες ρυθμίσεις του προγράμματος. Χρειάζεται να ενεργοποιήσετε την επιλογή \"Run ActiveX controls and plug-ins\". Ίσως παρουσιαστούν λάθη και παρατηρήσετε ελειπείς λειτουργίες.", +BrowseServerBlocked : "Οι πόροι του browser σας δεν είναι προσπελάσιμοι. Σιγουρευτείτε ότι δεν υπάρχουν ενεργοί popup blockers.", +DialogBlocked : "Δεν ήταν δυνατό να ανοίξει το παράθυρο διαλόγου. Σιγουρευτείτε ότι δεν υπάρχουν ενεργοί popup blockers.", + +// Dialogs +DlgBtnOK : "OK", +DlgBtnCancel : "Ακύρωση", +DlgBtnClose : "Κλείσιμο", +DlgBtnBrowseServer : "Εξερεύνηση διακομιστή", +DlgAdvancedTag : "Για προχωρημένους", +DlgOpOther : "<Άλλα>", +DlgInfoTab : "Πληροφορίες", +DlgAlertUrl : "Παρακαλώ εισάγετε URL", + +// General Dialogs Labels +DlgGenNotSet : "<χωρίς>", +DlgGenId : "Id", +DlgGenLangDir : "Κατεύθυνση κειμένου", +DlgGenLangDirLtr : "Αριστερά προς Δεξιά (LTR)", +DlgGenLangDirRtl : "Δεξιά προς Αριστερά (RTL)", +DlgGenLangCode : "Κωδικός Γλώσσας", +DlgGenAccessKey : "Συντόμευση (Access Key)", +DlgGenName : "Όνομα", +DlgGenTabIndex : "Tab Index", +DlgGenLongDescr : "Αναλυτική περιγραφή URL", +DlgGenClass : "Stylesheet Classes", +DlgGenTitle : "Συμβουλευτικός τίτλος", +DlgGenContType : "Συμβουλευτικός τίτλος περιεχομένου", +DlgGenLinkCharset : "Linked Resource Charset", +DlgGenStyle : "Στύλ", + +// Image Dialog +DlgImgTitle : "Ιδιότητες Εικόνας", +DlgImgInfoTab : "Πληροφορίες Εικόνας", +DlgImgBtnUpload : "Αποστολή στον Διακομιστή", +DlgImgURL : "URL", +DlgImgUpload : "Αποστολή", +DlgImgAlt : "Εναλλακτικό Κείμενο (ALT)", +DlgImgWidth : "Πλάτος", +DlgImgHeight : "Ύψος", +DlgImgLockRatio : "Κλείδωμα Αναλογίας", +DlgBtnResetSize : "Επαναφορά Αρχικού Μεγέθους", +DlgImgBorder : "Περιθώριο", +DlgImgHSpace : "Οριζόντιος Χώρος (HSpace)", +DlgImgVSpace : "Κάθετος Χώρος (VSpace)", +DlgImgAlign : "Ευθυγράμμιση (Align)", +DlgImgAlignLeft : "Αριστερά", +DlgImgAlignAbsBottom: "Απόλυτα Κάτω (Abs Bottom)", +DlgImgAlignAbsMiddle: "Απόλυτα στη Μέση (Abs Middle)", +DlgImgAlignBaseline : "Γραμμή Βάσης (Baseline)", +DlgImgAlignBottom : "Κάτω (Bottom)", +DlgImgAlignMiddle : "Μέση (Middle)", +DlgImgAlignRight : "Δεξιά (Right)", +DlgImgAlignTextTop : "Κορυφή Κειμένου (Text Top)", +DlgImgAlignTop : "Πάνω (Top)", +DlgImgPreview : "Προεπισκόπιση", +DlgImgAlertUrl : "Εισάγετε την τοποθεσία (URL) της εικόνας", +DlgImgLinkTab : "Σύνδεσμος", + +// Flash Dialog +DlgFlashTitle : "Ιδιότητες flash", +DlgFlashChkPlay : "Αυτόματη έναρξη", +DlgFlashChkLoop : "Επανάληψη", +DlgFlashChkMenu : "Ενεργοποίηση Flash Menu", +DlgFlashScale : "Κλίμακα", +DlgFlashScaleAll : "Εμφάνιση όλων", +DlgFlashScaleNoBorder : "Χωρίς όρια", +DlgFlashScaleFit : "Ακριβής εφαρμογή", + +// Link Dialog +DlgLnkWindowTitle : "Σύνδεσμος (Link)", +DlgLnkInfoTab : "Link", +DlgLnkTargetTab : "Παράθυρο Στόχος (Target)", + +DlgLnkType : "Τύπος συνδέσμου (Link)", +DlgLnkTypeURL : "URL", +DlgLnkTypeAnchor : "Άγκυρα σε αυτή τη σελίδα", +DlgLnkTypeEMail : "E-Mail", +DlgLnkProto : "Προτόκολο", +DlgLnkProtoOther : "<άλλο>", +DlgLnkURL : "URL", +DlgLnkAnchorSel : "Επιλέξτε μια άγκυρα", +DlgLnkAnchorByName : "Βάσει του Ονόματος (Name) της άγκυρας", +DlgLnkAnchorById : "Βάσει του Element Id", +DlgLnkNoAnchors : "(Δεν υπάρχουν άγκυρες στο κείμενο)", +DlgLnkEMail : "Διεύθυνση Ηλεκτρονικού Ταχυδρομείου", +DlgLnkEMailSubject : "Θέμα Μηνύματος", +DlgLnkEMailBody : "Κείμενο Μηνύματος", +DlgLnkUpload : "Αποστολή", +DlgLnkBtnUpload : "Αποστολή στον Διακομιστή", + +DlgLnkTarget : "Παράθυρο Στόχος (Target)", +DlgLnkTargetFrame : "<πλαίσιο>", +DlgLnkTargetPopup : "<παράθυρο popup>", +DlgLnkTargetBlank : "Νέο Παράθυρο (_blank)", +DlgLnkTargetParent : "Γονικό Παράθυρο (_parent)", +DlgLnkTargetSelf : "Ίδιο Παράθυρο (_self)", +DlgLnkTargetTop : "Ανώτατο Παράθυρο (_top)", +DlgLnkTargetFrameName : "Όνομα πλαισίου στόχου", +DlgLnkPopWinName : "Όνομα Popup Window", +DlgLnkPopWinFeat : "Επιλογές Popup Window", +DlgLnkPopResize : "Με αλλαγή Μεγέθους", +DlgLnkPopLocation : "Μπάρα Τοποθεσίας", +DlgLnkPopMenu : "Μπάρα Menu", +DlgLnkPopScroll : "Μπάρες Κύλισης", +DlgLnkPopStatus : "Μπάρα Status", +DlgLnkPopToolbar : "Μπάρα Εργαλείων", +DlgLnkPopFullScrn : "Ολόκληρη η Οθόνη (IE)", +DlgLnkPopDependent : "Dependent (Netscape)", +DlgLnkPopWidth : "Πλάτος", +DlgLnkPopHeight : "Ύψος", +DlgLnkPopLeft : "Τοποθεσία Αριστερής Άκρης", +DlgLnkPopTop : "Τοποθεσία Πάνω Άκρης", + +DlnLnkMsgNoUrl : "Εισάγετε την τοποθεσία (URL) του υπερσυνδέσμου (Link)", +DlnLnkMsgNoEMail : "Εισάγετε την διεύθυνση ηλεκτρονικού ταχυδρομείου", +DlnLnkMsgNoAnchor : "Επιλέξτε ένα Anchor", +DlnLnkMsgInvPopName : "Το όνομα του popup πρέπει να αρχίζει με χαρακτήρα της αλφαβήτου και να μην περιέχει κενά", + +// Color Dialog +DlgColorTitle : "Επιλογή χρώματος", +DlgColorBtnClear : "Καθαρισμός", +DlgColorHighlight : "Προεπισκόπιση", +DlgColorSelected : "Επιλεγμένο", + +// Smiley Dialog +DlgSmileyTitle : "Επιλέξτε ένα Smiley", + +// Special Character Dialog +DlgSpecialCharTitle : "Επιλέξτε ένα Ειδικό Σύμβολο", + +// Table Dialog +DlgTableTitle : "Ιδιότητες Πίνακα", +DlgTableRows : "Γραμμές", +DlgTableColumns : "Κολώνες", +DlgTableBorder : "Μέγεθος Περιθωρίου", +DlgTableAlign : "Στοίχιση", +DlgTableAlignNotSet : "<χωρίς>", +DlgTableAlignLeft : "Αριστερά", +DlgTableAlignCenter : "Κέντρο", +DlgTableAlignRight : "Δεξιά", +DlgTableWidth : "Πλάτος", +DlgTableWidthPx : "pixels", +DlgTableWidthPc : "\%", +DlgTableHeight : "Ύψος", +DlgTableCellSpace : "Απόσταση κελιών", +DlgTableCellPad : "Γέμισμα κελιών", +DlgTableCaption : "Υπέρτιτλος", +DlgTableSummary : "Περίληψη", + +// Table Cell Dialog +DlgCellTitle : "Ιδιότητες Κελιού", +DlgCellWidth : "Πλάτος", +DlgCellWidthPx : "pixels", +DlgCellWidthPc : "\%", +DlgCellHeight : "Ύψος", +DlgCellWordWrap : "Με αλλαγή γραμμής", +DlgCellWordWrapNotSet : "<χωρίς>", +DlgCellWordWrapYes : "Ναι", +DlgCellWordWrapNo : "Όχι", +DlgCellHorAlign : "Οριζόντια Στοίχιση", +DlgCellHorAlignNotSet : "<χωρίς>", +DlgCellHorAlignLeft : "Αριστερά", +DlgCellHorAlignCenter : "Κέντρο", +DlgCellHorAlignRight: "Δεξιά", +DlgCellVerAlign : "Κάθετη Στοίχιση", +DlgCellVerAlignNotSet : "<χωρίς>", +DlgCellVerAlignTop : "Πάνω (Top)", +DlgCellVerAlignMiddle : "Μέση (Middle)", +DlgCellVerAlignBottom : "Κάτω (Bottom)", +DlgCellVerAlignBaseline : "Γραμμή Βάσης (Baseline)", +DlgCellRowSpan : "Αριθμός Γραμμών (Rows Span)", +DlgCellCollSpan : "Αριθμός Κολωνών (Columns Span)", +DlgCellBackColor : "Χρώμα Υποβάθρου", +DlgCellBorderColor : "Χρώμα Περιθωρίου", +DlgCellBtnSelect : "Επιλογή...", + +// Find and Replace Dialog +DlgFindAndReplaceTitle : "Find and Replace", //MISSING + +// Find Dialog +DlgFindTitle : "Αναζήτηση", +DlgFindFindBtn : "Αναζήτηση", +DlgFindNotFoundMsg : "Το κείμενο δεν βρέθηκε.", + +// Replace Dialog +DlgReplaceTitle : "Αντικατάσταση", +DlgReplaceFindLbl : "Αναζήτηση:", +DlgReplaceReplaceLbl : "Αντικατάσταση με:", +DlgReplaceCaseChk : "Έλεγχος πεζών/κεφαλαίων", +DlgReplaceReplaceBtn : "Αντικατάσταση", +DlgReplaceReplAllBtn : "Αντικατάσταση Όλων", +DlgReplaceWordChk : "Εύρεση πλήρους λέξης", + +// Paste Operations / Dialog +PasteErrorCut : "Οι ρυθμίσεις ασφαλείας του φυλλομετρητή σας δεν επιτρέπουν την επιλεγμένη εργασία αποκοπής. Χρησιμοποιείστε το πληκτρολόγιο (Ctrl+X).", +PasteErrorCopy : "Οι ρυθμίσεις ασφαλείας του φυλλομετρητή σας δεν επιτρέπουν την επιλεγμένη εργασία αντιγραφής. Χρησιμοποιείστε το πληκτρολόγιο (Ctrl+C).", + +PasteAsText : "Επικόλληση ως Απλό Κείμενο", +PasteFromWord : "Επικόλληση από το Word", + +DlgPasteMsg2 : "Παρακαλώ επικολήστε στο ακόλουθο κουτί χρησιμοποιόντας το πληκτρολόγιο (Ctrl+V) και πατήστε OK.", +DlgPasteSec : "Because of your browser security settings, the editor is not able to access your clipboard data directly. You are required to paste it again in this window.", //MISSING +DlgPasteIgnoreFont : "Αγνόηση προδιαγραφών γραμματοσειράς", +DlgPasteRemoveStyles : "Αφαίρεση προδιαγραφών στύλ", +DlgPasteCleanBox : "Κουτί εκαθάρισης", + +// Color Picker +ColorAutomatic : "Αυτόματο", +ColorMoreColors : "Περισσότερα χρώματα...", + +// Document Properties +DocProps : "Ιδιότητες εγγράφου", + +// Anchor Dialog +DlgAnchorTitle : "Ιδιότητες άγκυρας", +DlgAnchorName : "Όνομα άγκυρας", +DlgAnchorErrorName : "Παρακαλούμε εισάγετε όνομα άγκυρας", + +// Speller Pages Dialog +DlgSpellNotInDic : "Δεν υπάρχει στο λεξικό", +DlgSpellChangeTo : "Αλλαγή σε", +DlgSpellBtnIgnore : "Αγνόηση", +DlgSpellBtnIgnoreAll : "Αγνόηση όλων", +DlgSpellBtnReplace : "Αντικατάσταση", +DlgSpellBtnReplaceAll : "Αντικατάσταση όλων", +DlgSpellBtnUndo : "Αναίρεση", +DlgSpellNoSuggestions : "- Δεν υπάρχουν προτάσεις -", +DlgSpellProgress : "Ορθογραφικός έλεγχος σε εξέλιξη...", +DlgSpellNoMispell : "Ο ορθογραφικός έλεγχος ολοκληρώθηκε: Δεν βρέθηκαν λάθη", +DlgSpellNoChanges : "Ο ορθογραφικός έλεγχος ολοκληρώθηκε: Δεν άλλαξαν λέξεις", +DlgSpellOneChange : "Ο ορθογραφικός έλεγχος ολοκληρώθηκε: Μια λέξη άλλαξε", +DlgSpellManyChanges : "Ο ορθογραφικός έλεγχος ολοκληρώθηκε: %1 λέξεις άλλαξαν", + +IeSpellDownload : "Δεν υπάρχει εγκατεστημένος ορθογράφος. Θέλετε να τον κατεβάσετε τώρα;", + +// Button Dialog +DlgButtonText : "Κείμενο (Τιμή)", +DlgButtonType : "Τύπος", +DlgButtonTypeBtn : "Κουμπί", +DlgButtonTypeSbm : "Καταχώρηση", +DlgButtonTypeRst : "Επαναφορά", + +// Checkbox and Radio Button Dialogs +DlgCheckboxName : "Όνομα", +DlgCheckboxValue : "Τιμή", +DlgCheckboxSelected : "Επιλεγμένο", + +// Form Dialog +DlgFormName : "Όνομα", +DlgFormAction : "Δράση", +DlgFormMethod : "Μάθοδος", + +// Select Field Dialog +DlgSelectName : "Όνομα", +DlgSelectValue : "Τιμή", +DlgSelectSize : "Μέγεθος", +DlgSelectLines : "γραμμές", +DlgSelectChkMulti : "Πολλαπλές επιλογές", +DlgSelectOpAvail : "Διαθέσιμες επιλογές", +DlgSelectOpText : "Κείμενο", +DlgSelectOpValue : "Τιμή", +DlgSelectBtnAdd : "Προσθήκη", +DlgSelectBtnModify : "Αλλαγή", +DlgSelectBtnUp : "Πάνω", +DlgSelectBtnDown : "Κάτω", +DlgSelectBtnSetValue : "Προεπιλεγμένη επιλογή", +DlgSelectBtnDelete : "Διαγραφή", + +// Textarea Dialog +DlgTextareaName : "Όνομα", +DlgTextareaCols : "Στήλες", +DlgTextareaRows : "Σειρές", + +// Text Field Dialog +DlgTextName : "Όνομα", +DlgTextValue : "Τιμή", +DlgTextCharWidth : "Μήκος χαρακτήρων", +DlgTextMaxChars : "Μέγιστοι χαρακτήρες", +DlgTextType : "Τύπος", +DlgTextTypeText : "Κείμενο", +DlgTextTypePass : "Κωδικός", + +// Hidden Field Dialog +DlgHiddenName : "Όνομα", +DlgHiddenValue : "Τιμή", + +// Bulleted List Dialog +BulletedListProp : "Ιδιότητες λίστας Bulleted", +NumberedListProp : "Ιδιότητες αριθμημένης λίστας ", +DlgLstStart : "Αρχή", +DlgLstType : "Τύπος", +DlgLstTypeCircle : "Κύκλος", +DlgLstTypeDisc : "Δίσκος", +DlgLstTypeSquare : "Τετράγωνο", +DlgLstTypeNumbers : "Αριθμοί (1, 2, 3)", +DlgLstTypeLCase : "Πεζά γράμματα (a, b, c)", +DlgLstTypeUCase : "Κεφαλαία γράμματα (A, B, C)", +DlgLstTypeSRoman : "Μικρά λατινικά αριθμητικά (i, ii, iii)", +DlgLstTypeLRoman : "Μεγάλα λατινικά αριθμητικά (I, II, III)", + +// Document Properties Dialog +DlgDocGeneralTab : "Γενικά", +DlgDocBackTab : "Φόντο", +DlgDocColorsTab : "Χρώματα και περιθώρια", +DlgDocMetaTab : "Δεδομένα Meta", + +DlgDocPageTitle : "Τίτλος σελίδας", +DlgDocLangDir : "Κατεύθυνση γραφής", +DlgDocLangDirLTR : "αριστερά προς δεξιά (LTR)", +DlgDocLangDirRTL : "δεξιά προς αριστερά (RTL)", +DlgDocLangCode : "Κωδικός γλώσσας", +DlgDocCharSet : "Κωδικοποίηση χαρακτήρων", +DlgDocCharSetCE : "Κεντρικής Ευρώπης", +DlgDocCharSetCT : "Παραδοσιακά κινέζικα (Big5)", +DlgDocCharSetCR : "Κυριλλική", +DlgDocCharSetGR : "Ελληνική", +DlgDocCharSetJP : "Ιαπωνική", +DlgDocCharSetKR : "Κορεάτικη", +DlgDocCharSetTR : "Τουρκική", +DlgDocCharSetUN : "Διεθνής (UTF-8)", +DlgDocCharSetWE : "Δυτικής Ευρώπης", +DlgDocCharSetOther : "Άλλη κωδικοποίηση χαρακτήρων", + +DlgDocDocType : "Επικεφαλίδα τύπου εγγράφου", +DlgDocDocTypeOther : "Άλλη επικεφαλίδα τύπου εγγράφου", +DlgDocIncXHTML : "Να συμπεριληφθούν οι δηλώσεις XHTML", +DlgDocBgColor : "Χρώμα φόντου", +DlgDocBgImage : "Διεύθυνση εικόνας φόντου", +DlgDocBgNoScroll : "Φόντο χωρίς κύλιση", +DlgDocCText : "Κείμενο", +DlgDocCLink : "Σύνδεσμος", +DlgDocCVisited : "Σύνδεσμος που έχει επισκευθεί", +DlgDocCActive : "Ενεργός σύνδεσμος", +DlgDocMargins : "Περιθώρια σελίδας", +DlgDocMaTop : "Κορυφή", +DlgDocMaLeft : "Αριστερά", +DlgDocMaRight : "Δεξιά", +DlgDocMaBottom : "Κάτω", +DlgDocMeIndex : "Λέξεις κλειδιά δείκτες εγγράφου (διαχωρισμός με κόμμα)", +DlgDocMeDescr : "Περιγραφή εγγράφου", +DlgDocMeAuthor : "Συγγραφέας", +DlgDocMeCopy : "Πνευματικά δικαιώματα", +DlgDocPreview : "Προεπισκόπηση", + +// Templates Dialog +Templates : "Πρότυπα", +DlgTemplatesTitle : "Πρότυπα περιεχομένου", +DlgTemplatesSelMsg : "Παρακαλώ επιλέξτε πρότυπο για εισαγωγή στο πρόγραμμα
    (τα υπάρχοντα περιεχόμενα θα χαθούν):", +DlgTemplatesLoading : "Φόρτωση καταλόγου προτύπων. Παρακαλώ περιμένετε...", +DlgTemplatesNoTpl : "(Δεν έχουν καθοριστεί πρότυπα)", +DlgTemplatesReplace : "Αντικατάσταση υπάρχοντων περιεχομένων", + +// About Dialog +DlgAboutAboutTab : "Σχετικά", +DlgAboutBrowserInfoTab : "Πληροφορίες Browser", +DlgAboutLicenseTab : "Άδεια", +DlgAboutVersion : "έκδοση", +DlgAboutInfo : "Για περισσότερες πληροφορίες" +}; diff --git a/FCKeditor/editor/lang/en-au.js b/FCKeditor/editor/lang/en-au.js new file mode 100644 index 0000000..95d36df --- /dev/null +++ b/FCKeditor/editor/lang/en-au.js @@ -0,0 +1,516 @@ +/* + * FCKeditor - The text editor for Internet - http://www.fckeditor.net + * Copyright (C) 2003-2007 Frederico Caldeira Knabben + * + * == BEGIN LICENSE == + * + * Licensed under the terms of any of the following licenses at your + * choice: + * + * - GNU General Public License Version 2 or later (the "GPL") + * http://www.gnu.org/licenses/gpl.html + * + * - GNU Lesser General Public License Version 2.1 or later (the "LGPL") + * http://www.gnu.org/licenses/lgpl.html + * + * - Mozilla Public License Version 1.1 or later (the "MPL") + * http://www.mozilla.org/MPL/MPL-1.1.html + * + * == END LICENSE == + * + * English (Australia) language file. + */ + +var FCKLang = +{ +// Language direction : "ltr" (left to right) or "rtl" (right to left). +Dir : "ltr", + +ToolbarCollapse : "Collapse Toolbar", +ToolbarExpand : "Expand Toolbar", + +// Toolbar Items and Context Menu +Save : "Save", +NewPage : "New Page", +Preview : "Preview", +Cut : "Cut", +Copy : "Copy", +Paste : "Paste", +PasteText : "Paste as plain text", +PasteWord : "Paste from Word", +Print : "Print", +SelectAll : "Select All", +RemoveFormat : "Remove Format", +InsertLinkLbl : "Link", +InsertLink : "Insert/Edit Link", +RemoveLink : "Remove Link", +Anchor : "Insert/Edit Anchor", +AnchorDelete : "Remove Anchor", +InsertImageLbl : "Image", +InsertImage : "Insert/Edit Image", +InsertFlashLbl : "Flash", +InsertFlash : "Insert/Edit Flash", +InsertTableLbl : "Table", +InsertTable : "Insert/Edit Table", +InsertLineLbl : "Line", +InsertLine : "Insert Horizontal Line", +InsertSpecialCharLbl: "Special Character", +InsertSpecialChar : "Insert Special Character", +InsertSmileyLbl : "Smiley", +InsertSmiley : "Insert Smiley", +About : "About FCKeditor", +Bold : "Bold", +Italic : "Italic", +Underline : "Underline", +StrikeThrough : "Strike Through", +Subscript : "Subscript", +Superscript : "Superscript", +LeftJustify : "Left Justify", +CenterJustify : "Centre Justify", +RightJustify : "Right Justify", +BlockJustify : "Block Justify", +DecreaseIndent : "Decrease Indent", +IncreaseIndent : "Increase Indent", +Blockquote : "Blockquote", +Undo : "Undo", +Redo : "Redo", +NumberedListLbl : "Numbered List", +NumberedList : "Insert/Remove Numbered List", +BulletedListLbl : "Bulleted List", +BulletedList : "Insert/Remove Bulleted List", +ShowTableBorders : "Show Table Borders", +ShowDetails : "Show Details", +Style : "Style", +FontFormat : "Format", +Font : "Font", +FontSize : "Size", +TextColor : "Text Colour", +BGColor : "Background Colour", +Source : "Source", +Find : "Find", +Replace : "Replace", +SpellCheck : "Check Spelling", +UniversalKeyboard : "Universal Keyboard", +PageBreakLbl : "Page Break", +PageBreak : "Insert Page Break", + +Form : "Form", +Checkbox : "Checkbox", +RadioButton : "Radio Button", +TextField : "Text Field", +Textarea : "Textarea", +HiddenField : "Hidden Field", +Button : "Button", +SelectionField : "Selection Field", +ImageButton : "Image Button", + +FitWindow : "Maximize the editor size", +ShowBlocks : "Show Blocks", + +// Context Menu +EditLink : "Edit Link", +CellCM : "Cell", +RowCM : "Row", +ColumnCM : "Column", +InsertRowAfter : "Insert Row After", +InsertRowBefore : "Insert Row Before", +DeleteRows : "Delete Rows", +InsertColumnAfter : "Insert Column After", +InsertColumnBefore : "Insert Column Before", +DeleteColumns : "Delete Columns", +InsertCellAfter : "Insert Cell After", +InsertCellBefore : "Insert Cell Before", +DeleteCells : "Delete Cells", +MergeCells : "Merge Cells", +MergeRight : "Merge Right", +MergeDown : "Merge Down", +HorizontalSplitCell : "Split Cell Horizontally", +VerticalSplitCell : "Split Cell Vertically", +TableDelete : "Delete Table", +CellProperties : "Cell Properties", +TableProperties : "Table Properties", +ImageProperties : "Image Properties", +FlashProperties : "Flash Properties", + +AnchorProp : "Anchor Properties", +ButtonProp : "Button Properties", +CheckboxProp : "Checkbox Properties", +HiddenFieldProp : "Hidden Field Properties", +RadioButtonProp : "Radio Button Properties", +ImageButtonProp : "Image Button Properties", +TextFieldProp : "Text Field Properties", +SelectionFieldProp : "Selection Field Properties", +TextareaProp : "Textarea Properties", +FormProp : "Form Properties", + +FontFormats : "Normal;Formatted;Address;Heading 1;Heading 2;Heading 3;Heading 4;Heading 5;Heading 6;Normal (DIV)", + +// Alerts and Messages +ProcessingXHTML : "Processing XHTML. Please wait...", +Done : "Done", +PasteWordConfirm : "The text you want to paste seems to be copied from Word. Do you want to clean it before pasting?", +NotCompatiblePaste : "This command is available for Internet Explorer version 5.5 or more. Do you want to paste without cleaning?", +UnknownToolbarItem : "Unknown toolbar item \"%1\"", +UnknownCommand : "Unknown command name \"%1\"", +NotImplemented : "Command not implemented", +UnknownToolbarSet : "Toolbar set \"%1\" doesn't exist", +NoActiveX : "Your browser's security settings could limit some features of the editor. You must enable the option \"Run ActiveX controls and plug-ins\". You may experience errors and notice missing features.", +BrowseServerBlocked : "The resources browser could not be opened. Make sure that all popup blockers are disabled.", +DialogBlocked : "It was not possible to open the dialog window. Make sure all popup blockers are disabled.", + +// Dialogs +DlgBtnOK : "OK", +DlgBtnCancel : "Cancel", +DlgBtnClose : "Close", +DlgBtnBrowseServer : "Browse Server", +DlgAdvancedTag : "Advanced", +DlgOpOther : "", +DlgInfoTab : "Info", +DlgAlertUrl : "Please insert the URL", + +// General Dialogs Labels +DlgGenNotSet : "", +DlgGenId : "Id", +DlgGenLangDir : "Language Direction", +DlgGenLangDirLtr : "Left to Right (LTR)", +DlgGenLangDirRtl : "Right to Left (RTL)", +DlgGenLangCode : "Language Code", +DlgGenAccessKey : "Access Key", +DlgGenName : "Name", +DlgGenTabIndex : "Tab Index", +DlgGenLongDescr : "Long Description URL", +DlgGenClass : "Stylesheet Classes", +DlgGenTitle : "Advisory Title", +DlgGenContType : "Advisory Content Type", +DlgGenLinkCharset : "Linked Resource Charset", +DlgGenStyle : "Style", + +// Image Dialog +DlgImgTitle : "Image Properties", +DlgImgInfoTab : "Image Info", +DlgImgBtnUpload : "Send it to the Server", +DlgImgURL : "URL", +DlgImgUpload : "Upload", +DlgImgAlt : "Alternative Text", +DlgImgWidth : "Width", +DlgImgHeight : "Height", +DlgImgLockRatio : "Lock Ratio", +DlgBtnResetSize : "Reset Size", +DlgImgBorder : "Border", +DlgImgHSpace : "HSpace", +DlgImgVSpace : "VSpace", +DlgImgAlign : "Align", +DlgImgAlignLeft : "Left", +DlgImgAlignAbsBottom: "Abs Bottom", +DlgImgAlignAbsMiddle: "Abs Middle", +DlgImgAlignBaseline : "Baseline", +DlgImgAlignBottom : "Bottom", +DlgImgAlignMiddle : "Middle", +DlgImgAlignRight : "Right", +DlgImgAlignTextTop : "Text Top", +DlgImgAlignTop : "Top", +DlgImgPreview : "Preview", +DlgImgAlertUrl : "Please type the image URL", +DlgImgLinkTab : "Link", + +// Flash Dialog +DlgFlashTitle : "Flash Properties", +DlgFlashChkPlay : "Auto Play", +DlgFlashChkLoop : "Loop", +DlgFlashChkMenu : "Enable Flash Menu", +DlgFlashScale : "Scale", +DlgFlashScaleAll : "Show all", +DlgFlashScaleNoBorder : "No Border", +DlgFlashScaleFit : "Exact Fit", + +// Link Dialog +DlgLnkWindowTitle : "Link", +DlgLnkInfoTab : "Link Info", +DlgLnkTargetTab : "Target", + +DlgLnkType : "Link Type", +DlgLnkTypeURL : "URL", +DlgLnkTypeAnchor : "Link to anchor in the text", +DlgLnkTypeEMail : "E-Mail", +DlgLnkProto : "Protocol", +DlgLnkProtoOther : "", +DlgLnkURL : "URL", +DlgLnkAnchorSel : "Select an Anchor", +DlgLnkAnchorByName : "By Anchor Name", +DlgLnkAnchorById : "By Element Id", +DlgLnkNoAnchors : "(No anchors available in the document)", +DlgLnkEMail : "E-Mail Address", +DlgLnkEMailSubject : "Message Subject", +DlgLnkEMailBody : "Message Body", +DlgLnkUpload : "Upload", +DlgLnkBtnUpload : "Send it to the Server", + +DlgLnkTarget : "Target", +DlgLnkTargetFrame : "", +DlgLnkTargetPopup : "", +DlgLnkTargetBlank : "New Window (_blank)", +DlgLnkTargetParent : "Parent Window (_parent)", +DlgLnkTargetSelf : "Same Window (_self)", +DlgLnkTargetTop : "Topmost Window (_top)", +DlgLnkTargetFrameName : "Target Frame Name", +DlgLnkPopWinName : "Popup Window Name", +DlgLnkPopWinFeat : "Popup Window Features", +DlgLnkPopResize : "Resizable", +DlgLnkPopLocation : "Location Bar", +DlgLnkPopMenu : "Menu Bar", +DlgLnkPopScroll : "Scroll Bars", +DlgLnkPopStatus : "Status Bar", +DlgLnkPopToolbar : "Toolbar", +DlgLnkPopFullScrn : "Full Screen (IE)", +DlgLnkPopDependent : "Dependent (Netscape)", +DlgLnkPopWidth : "Width", +DlgLnkPopHeight : "Height", +DlgLnkPopLeft : "Left Position", +DlgLnkPopTop : "Top Position", + +DlnLnkMsgNoUrl : "Please type the link URL", +DlnLnkMsgNoEMail : "Please type the e-mail address", +DlnLnkMsgNoAnchor : "Please select an anchor", +DlnLnkMsgInvPopName : "The popup name must begin with an alphabetic character and must not contain spaces", + +// Color Dialog +DlgColorTitle : "Select Colour", +DlgColorBtnClear : "Clear", +DlgColorHighlight : "Highlight", +DlgColorSelected : "Selected", + +// Smiley Dialog +DlgSmileyTitle : "Insert a Smiley", + +// Special Character Dialog +DlgSpecialCharTitle : "Select Special Character", + +// Table Dialog +DlgTableTitle : "Table Properties", +DlgTableRows : "Rows", +DlgTableColumns : "Columns", +DlgTableBorder : "Border size", +DlgTableAlign : "Alignment", +DlgTableAlignNotSet : "", +DlgTableAlignLeft : "Left", +DlgTableAlignCenter : "Centre", +DlgTableAlignRight : "Right", +DlgTableWidth : "Width", +DlgTableWidthPx : "pixels", +DlgTableWidthPc : "percent", +DlgTableHeight : "Height", +DlgTableCellSpace : "Cell spacing", +DlgTableCellPad : "Cell padding", +DlgTableCaption : "Caption", +DlgTableSummary : "Summary", + +// Table Cell Dialog +DlgCellTitle : "Cell Properties", +DlgCellWidth : "Width", +DlgCellWidthPx : "pixels", +DlgCellWidthPc : "percent", +DlgCellHeight : "Height", +DlgCellWordWrap : "Word Wrap", +DlgCellWordWrapNotSet : "", +DlgCellWordWrapYes : "Yes", +DlgCellWordWrapNo : "No", +DlgCellHorAlign : "Horizontal Alignment", +DlgCellHorAlignNotSet : "", +DlgCellHorAlignLeft : "Left", +DlgCellHorAlignCenter : "Centre", +DlgCellHorAlignRight: "Right", +DlgCellVerAlign : "Vertical Alignment", +DlgCellVerAlignNotSet : "", +DlgCellVerAlignTop : "Top", +DlgCellVerAlignMiddle : "Middle", +DlgCellVerAlignBottom : "Bottom", +DlgCellVerAlignBaseline : "Baseline", +DlgCellRowSpan : "Rows Span", +DlgCellCollSpan : "Columns Span", +DlgCellBackColor : "Background Colour", +DlgCellBorderColor : "Border Colour", +DlgCellBtnSelect : "Select...", + +// Find and Replace Dialog +DlgFindAndReplaceTitle : "Find and Replace", + +// Find Dialog +DlgFindTitle : "Find", +DlgFindFindBtn : "Find", +DlgFindNotFoundMsg : "The specified text was not found.", + +// Replace Dialog +DlgReplaceTitle : "Replace", +DlgReplaceFindLbl : "Find what:", +DlgReplaceReplaceLbl : "Replace with:", +DlgReplaceCaseChk : "Match case", +DlgReplaceReplaceBtn : "Replace", +DlgReplaceReplAllBtn : "Replace All", +DlgReplaceWordChk : "Match whole word", + +// Paste Operations / Dialog +PasteErrorCut : "Your browser security settings don't permit the editor to automatically execute cutting operations. Please use the keyboard for that (Ctrl+X).", +PasteErrorCopy : "Your browser security settings don't permit the editor to automatically execute copying operations. Please use the keyboard for that (Ctrl+C).", + +PasteAsText : "Paste as Plain Text", +PasteFromWord : "Paste from Word", + +DlgPasteMsg2 : "Please paste inside the following box using the keyboard (Ctrl+V) and hit OK.", +DlgPasteSec : "Because of your browser security settings, the editor is not able to access your clipboard data directly. You are required to paste it again in this window.", +DlgPasteIgnoreFont : "Ignore Font Face definitions", +DlgPasteRemoveStyles : "Remove Styles definitions", +DlgPasteCleanBox : "Clean Up Box", + +// Color Picker +ColorAutomatic : "Automatic", +ColorMoreColors : "More Colours...", + +// Document Properties +DocProps : "Document Properties", + +// Anchor Dialog +DlgAnchorTitle : "Anchor Properties", +DlgAnchorName : "Anchor Name", +DlgAnchorErrorName : "Please type the anchor name", + +// Speller Pages Dialog +DlgSpellNotInDic : "Not in dictionary", +DlgSpellChangeTo : "Change to", +DlgSpellBtnIgnore : "Ignore", +DlgSpellBtnIgnoreAll : "Ignore All", +DlgSpellBtnReplace : "Replace", +DlgSpellBtnReplaceAll : "Replace All", +DlgSpellBtnUndo : "Undo", +DlgSpellNoSuggestions : "- No suggestions -", +DlgSpellProgress : "Spell check in progress...", +DlgSpellNoMispell : "Spell check complete: No misspellings found", +DlgSpellNoChanges : "Spell check complete: No words changed", +DlgSpellOneChange : "Spell check complete: One word changed", +DlgSpellManyChanges : "Spell check complete: %1 words changed", + +IeSpellDownload : "Spell checker not installed. Do you want to download it now?", + +// Button Dialog +DlgButtonText : "Text (Value)", +DlgButtonType : "Type", +DlgButtonTypeBtn : "Button", +DlgButtonTypeSbm : "Submit", +DlgButtonTypeRst : "Reset", + +// Checkbox and Radio Button Dialogs +DlgCheckboxName : "Name", +DlgCheckboxValue : "Value", +DlgCheckboxSelected : "Selected", + +// Form Dialog +DlgFormName : "Name", +DlgFormAction : "Action", +DlgFormMethod : "Method", + +// Select Field Dialog +DlgSelectName : "Name", +DlgSelectValue : "Value", +DlgSelectSize : "Size", +DlgSelectLines : "lines", +DlgSelectChkMulti : "Allow multiple selections", +DlgSelectOpAvail : "Available Options", +DlgSelectOpText : "Text", +DlgSelectOpValue : "Value", +DlgSelectBtnAdd : "Add", +DlgSelectBtnModify : "Modify", +DlgSelectBtnUp : "Up", +DlgSelectBtnDown : "Down", +DlgSelectBtnSetValue : "Set as selected value", +DlgSelectBtnDelete : "Delete", + +// Textarea Dialog +DlgTextareaName : "Name", +DlgTextareaCols : "Columns", +DlgTextareaRows : "Rows", + +// Text Field Dialog +DlgTextName : "Name", +DlgTextValue : "Value", +DlgTextCharWidth : "Character Width", +DlgTextMaxChars : "Maximum Characters", +DlgTextType : "Type", +DlgTextTypeText : "Text", +DlgTextTypePass : "Password", + +// Hidden Field Dialog +DlgHiddenName : "Name", +DlgHiddenValue : "Value", + +// Bulleted List Dialog +BulletedListProp : "Bulleted List Properties", +NumberedListProp : "Numbered List Properties", +DlgLstStart : "Start", +DlgLstType : "Type", +DlgLstTypeCircle : "Circle", +DlgLstTypeDisc : "Disc", +DlgLstTypeSquare : "Square", +DlgLstTypeNumbers : "Numbers (1, 2, 3)", +DlgLstTypeLCase : "Lowercase Letters (a, b, c)", +DlgLstTypeUCase : "Uppercase Letters (A, B, C)", +DlgLstTypeSRoman : "Small Roman Numerals (i, ii, iii)", +DlgLstTypeLRoman : "Large Roman Numerals (I, II, III)", + +// Document Properties Dialog +DlgDocGeneralTab : "General", +DlgDocBackTab : "Background", +DlgDocColorsTab : "Colours and Margins", +DlgDocMetaTab : "Meta Data", + +DlgDocPageTitle : "Page Title", +DlgDocLangDir : "Language Direction", +DlgDocLangDirLTR : "Left to Right (LTR)", +DlgDocLangDirRTL : "Right to Left (RTL)", +DlgDocLangCode : "Language Code", +DlgDocCharSet : "Character Set Encoding", +DlgDocCharSetCE : "Central European", +DlgDocCharSetCT : "Chinese Traditional (Big5)", +DlgDocCharSetCR : "Cyrillic", +DlgDocCharSetGR : "Greek", +DlgDocCharSetJP : "Japanese", +DlgDocCharSetKR : "Korean", +DlgDocCharSetTR : "Turkish", +DlgDocCharSetUN : "Unicode (UTF-8)", +DlgDocCharSetWE : "Western European", +DlgDocCharSetOther : "Other Character Set Encoding", + +DlgDocDocType : "Document Type Heading", +DlgDocDocTypeOther : "Other Document Type Heading", +DlgDocIncXHTML : "Include XHTML Declarations", +DlgDocBgColor : "Background Colour", +DlgDocBgImage : "Background Image URL", +DlgDocBgNoScroll : "Nonscrolling Background", +DlgDocCText : "Text", +DlgDocCLink : "Link", +DlgDocCVisited : "Visited Link", +DlgDocCActive : "Active Link", +DlgDocMargins : "Page Margins", +DlgDocMaTop : "Top", +DlgDocMaLeft : "Left", +DlgDocMaRight : "Right", +DlgDocMaBottom : "Bottom", +DlgDocMeIndex : "Document Indexing Keywords (comma separated)", +DlgDocMeDescr : "Document Description", +DlgDocMeAuthor : "Author", +DlgDocMeCopy : "Copyright", +DlgDocPreview : "Preview", + +// Templates Dialog +Templates : "Templates", +DlgTemplatesTitle : "Content Templates", +DlgTemplatesSelMsg : "Please select the template to open in the editor
    (the actual contents will be lost):", +DlgTemplatesLoading : "Loading templates list. Please wait...", +DlgTemplatesNoTpl : "(No templates defined)", +DlgTemplatesReplace : "Replace actual contents", + +// About Dialog +DlgAboutAboutTab : "About", +DlgAboutBrowserInfoTab : "Browser Info", +DlgAboutLicenseTab : "License", +DlgAboutVersion : "version", +DlgAboutInfo : "For further information go to" +}; diff --git a/FCKeditor/editor/lang/en-ca.js b/FCKeditor/editor/lang/en-ca.js new file mode 100644 index 0000000..9f77400 --- /dev/null +++ b/FCKeditor/editor/lang/en-ca.js @@ -0,0 +1,516 @@ +/* + * FCKeditor - The text editor for Internet - http://www.fckeditor.net + * Copyright (C) 2003-2007 Frederico Caldeira Knabben + * + * == BEGIN LICENSE == + * + * Licensed under the terms of any of the following licenses at your + * choice: + * + * - GNU General Public License Version 2 or later (the "GPL") + * http://www.gnu.org/licenses/gpl.html + * + * - GNU Lesser General Public License Version 2.1 or later (the "LGPL") + * http://www.gnu.org/licenses/lgpl.html + * + * - Mozilla Public License Version 1.1 or later (the "MPL") + * http://www.mozilla.org/MPL/MPL-1.1.html + * + * == END LICENSE == + * + * English (Canadian) language file. + */ + +var FCKLang = +{ +// Language direction : "ltr" (left to right) or "rtl" (right to left). +Dir : "ltr", + +ToolbarCollapse : "Collapse Toolbar", +ToolbarExpand : "Expand Toolbar", + +// Toolbar Items and Context Menu +Save : "Save", +NewPage : "New Page", +Preview : "Preview", +Cut : "Cut", +Copy : "Copy", +Paste : "Paste", +PasteText : "Paste as plain text", +PasteWord : "Paste from Word", +Print : "Print", +SelectAll : "Select All", +RemoveFormat : "Remove Format", +InsertLinkLbl : "Link", +InsertLink : "Insert/Edit Link", +RemoveLink : "Remove Link", +Anchor : "Insert/Edit Anchor", +AnchorDelete : "Remove Anchor", +InsertImageLbl : "Image", +InsertImage : "Insert/Edit Image", +InsertFlashLbl : "Flash", +InsertFlash : "Insert/Edit Flash", +InsertTableLbl : "Table", +InsertTable : "Insert/Edit Table", +InsertLineLbl : "Line", +InsertLine : "Insert Horizontal Line", +InsertSpecialCharLbl: "Special Character", +InsertSpecialChar : "Insert Special Character", +InsertSmileyLbl : "Smiley", +InsertSmiley : "Insert Smiley", +About : "About FCKeditor", +Bold : "Bold", +Italic : "Italic", +Underline : "Underline", +StrikeThrough : "Strike Through", +Subscript : "Subscript", +Superscript : "Superscript", +LeftJustify : "Left Justify", +CenterJustify : "Centre Justify", +RightJustify : "Right Justify", +BlockJustify : "Block Justify", +DecreaseIndent : "Decrease Indent", +IncreaseIndent : "Increase Indent", +Blockquote : "Blockquote", +Undo : "Undo", +Redo : "Redo", +NumberedListLbl : "Numbered List", +NumberedList : "Insert/Remove Numbered List", +BulletedListLbl : "Bulleted List", +BulletedList : "Insert/Remove Bulleted List", +ShowTableBorders : "Show Table Borders", +ShowDetails : "Show Details", +Style : "Style", +FontFormat : "Format", +Font : "Font", +FontSize : "Size", +TextColor : "Text Colour", +BGColor : "Background Colour", +Source : "Source", +Find : "Find", +Replace : "Replace", +SpellCheck : "Check Spelling", +UniversalKeyboard : "Universal Keyboard", +PageBreakLbl : "Page Break", +PageBreak : "Insert Page Break", + +Form : "Form", +Checkbox : "Checkbox", +RadioButton : "Radio Button", +TextField : "Text Field", +Textarea : "Textarea", +HiddenField : "Hidden Field", +Button : "Button", +SelectionField : "Selection Field", +ImageButton : "Image Button", + +FitWindow : "Maximize the editor size", +ShowBlocks : "Show Blocks", + +// Context Menu +EditLink : "Edit Link", +CellCM : "Cell", +RowCM : "Row", +ColumnCM : "Column", +InsertRowAfter : "Insert Row After", +InsertRowBefore : "Insert Row Before", +DeleteRows : "Delete Rows", +InsertColumnAfter : "Insert Column After", +InsertColumnBefore : "Insert Column Before", +DeleteColumns : "Delete Columns", +InsertCellAfter : "Insert Cell After", +InsertCellBefore : "Insert Cell Before", +DeleteCells : "Delete Cells", +MergeCells : "Merge Cells", +MergeRight : "Merge Right", +MergeDown : "Merge Down", +HorizontalSplitCell : "Split Cell Horizontally", +VerticalSplitCell : "Split Cell Vertically", +TableDelete : "Delete Table", +CellProperties : "Cell Properties", +TableProperties : "Table Properties", +ImageProperties : "Image Properties", +FlashProperties : "Flash Properties", + +AnchorProp : "Anchor Properties", +ButtonProp : "Button Properties", +CheckboxProp : "Checkbox Properties", +HiddenFieldProp : "Hidden Field Properties", +RadioButtonProp : "Radio Button Properties", +ImageButtonProp : "Image Button Properties", +TextFieldProp : "Text Field Properties", +SelectionFieldProp : "Selection Field Properties", +TextareaProp : "Textarea Properties", +FormProp : "Form Properties", + +FontFormats : "Normal;Formatted;Address;Heading 1;Heading 2;Heading 3;Heading 4;Heading 5;Heading 6;Normal (DIV)", + +// Alerts and Messages +ProcessingXHTML : "Processing XHTML. Please wait...", +Done : "Done", +PasteWordConfirm : "The text you want to paste seems to be copied from Word. Do you want to clean it before pasting?", +NotCompatiblePaste : "This command is available for Internet Explorer version 5.5 or more. Do you want to paste without cleaning?", +UnknownToolbarItem : "Unknown toolbar item \"%1\"", +UnknownCommand : "Unknown command name \"%1\"", +NotImplemented : "Command not implemented", +UnknownToolbarSet : "Toolbar set \"%1\" doesn't exist", +NoActiveX : "Your browser's security settings could limit some features of the editor. You must enable the option \"Run ActiveX controls and plug-ins\". You may experience errors and notice missing features.", +BrowseServerBlocked : "The resources browser could not be opened. Make sure that all popup blockers are disabled.", +DialogBlocked : "It was not possible to open the dialog window. Make sure all popup blockers are disabled.", + +// Dialogs +DlgBtnOK : "OK", +DlgBtnCancel : "Cancel", +DlgBtnClose : "Close", +DlgBtnBrowseServer : "Browse Server", +DlgAdvancedTag : "Advanced", +DlgOpOther : "", +DlgInfoTab : "Info", +DlgAlertUrl : "Please insert the URL", + +// General Dialogs Labels +DlgGenNotSet : "", +DlgGenId : "Id", +DlgGenLangDir : "Language Direction", +DlgGenLangDirLtr : "Left to Right (LTR)", +DlgGenLangDirRtl : "Right to Left (RTL)", +DlgGenLangCode : "Language Code", +DlgGenAccessKey : "Access Key", +DlgGenName : "Name", +DlgGenTabIndex : "Tab Index", +DlgGenLongDescr : "Long Description URL", +DlgGenClass : "Stylesheet Classes", +DlgGenTitle : "Advisory Title", +DlgGenContType : "Advisory Content Type", +DlgGenLinkCharset : "Linked Resource Charset", +DlgGenStyle : "Style", + +// Image Dialog +DlgImgTitle : "Image Properties", +DlgImgInfoTab : "Image Info", +DlgImgBtnUpload : "Send it to the Server", +DlgImgURL : "URL", +DlgImgUpload : "Upload", +DlgImgAlt : "Alternative Text", +DlgImgWidth : "Width", +DlgImgHeight : "Height", +DlgImgLockRatio : "Lock Ratio", +DlgBtnResetSize : "Reset Size", +DlgImgBorder : "Border", +DlgImgHSpace : "HSpace", +DlgImgVSpace : "VSpace", +DlgImgAlign : "Align", +DlgImgAlignLeft : "Left", +DlgImgAlignAbsBottom: "Abs Bottom", +DlgImgAlignAbsMiddle: "Abs Middle", +DlgImgAlignBaseline : "Baseline", +DlgImgAlignBottom : "Bottom", +DlgImgAlignMiddle : "Middle", +DlgImgAlignRight : "Right", +DlgImgAlignTextTop : "Text Top", +DlgImgAlignTop : "Top", +DlgImgPreview : "Preview", +DlgImgAlertUrl : "Please type the image URL", +DlgImgLinkTab : "Link", + +// Flash Dialog +DlgFlashTitle : "Flash Properties", +DlgFlashChkPlay : "Auto Play", +DlgFlashChkLoop : "Loop", +DlgFlashChkMenu : "Enable Flash Menu", +DlgFlashScale : "Scale", +DlgFlashScaleAll : "Show all", +DlgFlashScaleNoBorder : "No Border", +DlgFlashScaleFit : "Exact Fit", + +// Link Dialog +DlgLnkWindowTitle : "Link", +DlgLnkInfoTab : "Link Info", +DlgLnkTargetTab : "Target", + +DlgLnkType : "Link Type", +DlgLnkTypeURL : "URL", +DlgLnkTypeAnchor : "Link to anchor in the text", +DlgLnkTypeEMail : "E-Mail", +DlgLnkProto : "Protocol", +DlgLnkProtoOther : "", +DlgLnkURL : "URL", +DlgLnkAnchorSel : "Select an Anchor", +DlgLnkAnchorByName : "By Anchor Name", +DlgLnkAnchorById : "By Element Id", +DlgLnkNoAnchors : "(No anchors available in the document)", +DlgLnkEMail : "E-Mail Address", +DlgLnkEMailSubject : "Message Subject", +DlgLnkEMailBody : "Message Body", +DlgLnkUpload : "Upload", +DlgLnkBtnUpload : "Send it to the Server", + +DlgLnkTarget : "Target", +DlgLnkTargetFrame : "", +DlgLnkTargetPopup : "", +DlgLnkTargetBlank : "New Window (_blank)", +DlgLnkTargetParent : "Parent Window (_parent)", +DlgLnkTargetSelf : "Same Window (_self)", +DlgLnkTargetTop : "Topmost Window (_top)", +DlgLnkTargetFrameName : "Target Frame Name", +DlgLnkPopWinName : "Popup Window Name", +DlgLnkPopWinFeat : "Popup Window Features", +DlgLnkPopResize : "Resizable", +DlgLnkPopLocation : "Location Bar", +DlgLnkPopMenu : "Menu Bar", +DlgLnkPopScroll : "Scroll Bars", +DlgLnkPopStatus : "Status Bar", +DlgLnkPopToolbar : "Toolbar", +DlgLnkPopFullScrn : "Full Screen (IE)", +DlgLnkPopDependent : "Dependent (Netscape)", +DlgLnkPopWidth : "Width", +DlgLnkPopHeight : "Height", +DlgLnkPopLeft : "Left Position", +DlgLnkPopTop : "Top Position", + +DlnLnkMsgNoUrl : "Please type the link URL", +DlnLnkMsgNoEMail : "Please type the e-mail address", +DlnLnkMsgNoAnchor : "Please select an anchor", +DlnLnkMsgInvPopName : "The popup name must begin with an alphabetic character and must not contain spaces", + +// Color Dialog +DlgColorTitle : "Select Colour", +DlgColorBtnClear : "Clear", +DlgColorHighlight : "Highlight", +DlgColorSelected : "Selected", + +// Smiley Dialog +DlgSmileyTitle : "Insert a Smiley", + +// Special Character Dialog +DlgSpecialCharTitle : "Select Special Character", + +// Table Dialog +DlgTableTitle : "Table Properties", +DlgTableRows : "Rows", +DlgTableColumns : "Columns", +DlgTableBorder : "Border size", +DlgTableAlign : "Alignment", +DlgTableAlignNotSet : "", +DlgTableAlignLeft : "Left", +DlgTableAlignCenter : "Centre", +DlgTableAlignRight : "Right", +DlgTableWidth : "Width", +DlgTableWidthPx : "pixels", +DlgTableWidthPc : "percent", +DlgTableHeight : "Height", +DlgTableCellSpace : "Cell spacing", +DlgTableCellPad : "Cell padding", +DlgTableCaption : "Caption", +DlgTableSummary : "Summary", + +// Table Cell Dialog +DlgCellTitle : "Cell Properties", +DlgCellWidth : "Width", +DlgCellWidthPx : "pixels", +DlgCellWidthPc : "percent", +DlgCellHeight : "Height", +DlgCellWordWrap : "Word Wrap", +DlgCellWordWrapNotSet : "", +DlgCellWordWrapYes : "Yes", +DlgCellWordWrapNo : "No", +DlgCellHorAlign : "Horizontal Alignment", +DlgCellHorAlignNotSet : "", +DlgCellHorAlignLeft : "Left", +DlgCellHorAlignCenter : "Centre", +DlgCellHorAlignRight: "Right", +DlgCellVerAlign : "Vertical Alignment", +DlgCellVerAlignNotSet : "", +DlgCellVerAlignTop : "Top", +DlgCellVerAlignMiddle : "Middle", +DlgCellVerAlignBottom : "Bottom", +DlgCellVerAlignBaseline : "Baseline", +DlgCellRowSpan : "Rows Span", +DlgCellCollSpan : "Columns Span", +DlgCellBackColor : "Background Colour", +DlgCellBorderColor : "Border Colour", +DlgCellBtnSelect : "Select...", + +// Find and Replace Dialog +DlgFindAndReplaceTitle : "Find and Replace", + +// Find Dialog +DlgFindTitle : "Find", +DlgFindFindBtn : "Find", +DlgFindNotFoundMsg : "The specified text was not found.", + +// Replace Dialog +DlgReplaceTitle : "Replace", +DlgReplaceFindLbl : "Find what:", +DlgReplaceReplaceLbl : "Replace with:", +DlgReplaceCaseChk : "Match case", +DlgReplaceReplaceBtn : "Replace", +DlgReplaceReplAllBtn : "Replace All", +DlgReplaceWordChk : "Match whole word", + +// Paste Operations / Dialog +PasteErrorCut : "Your browser security settings don't permit the editor to automatically execute cutting operations. Please use the keyboard for that (Ctrl+X).", +PasteErrorCopy : "Your browser security settings don't permit the editor to automatically execute copying operations. Please use the keyboard for that (Ctrl+C).", + +PasteAsText : "Paste as Plain Text", +PasteFromWord : "Paste from Word", + +DlgPasteMsg2 : "Please paste inside the following box using the keyboard (Ctrl+V) and hit OK.", +DlgPasteSec : "Because of your browser security settings, the editor is not able to access your clipboard data directly. You are required to paste it again in this window.", +DlgPasteIgnoreFont : "Ignore Font Face definitions", +DlgPasteRemoveStyles : "Remove Styles definitions", +DlgPasteCleanBox : "Clean Up Box", + +// Color Picker +ColorAutomatic : "Automatic", +ColorMoreColors : "More Colours...", + +// Document Properties +DocProps : "Document Properties", + +// Anchor Dialog +DlgAnchorTitle : "Anchor Properties", +DlgAnchorName : "Anchor Name", +DlgAnchorErrorName : "Please type the anchor name", + +// Speller Pages Dialog +DlgSpellNotInDic : "Not in dictionary", +DlgSpellChangeTo : "Change to", +DlgSpellBtnIgnore : "Ignore", +DlgSpellBtnIgnoreAll : "Ignore All", +DlgSpellBtnReplace : "Replace", +DlgSpellBtnReplaceAll : "Replace All", +DlgSpellBtnUndo : "Undo", +DlgSpellNoSuggestions : "- No suggestions -", +DlgSpellProgress : "Spell check in progress...", +DlgSpellNoMispell : "Spell check complete: No misspellings found", +DlgSpellNoChanges : "Spell check complete: No words changed", +DlgSpellOneChange : "Spell check complete: One word changed", +DlgSpellManyChanges : "Spell check complete: %1 words changed", + +IeSpellDownload : "Spell checker not installed. Do you want to download it now?", + +// Button Dialog +DlgButtonText : "Text (Value)", +DlgButtonType : "Type", +DlgButtonTypeBtn : "Button", +DlgButtonTypeSbm : "Submit", +DlgButtonTypeRst : "Reset", + +// Checkbox and Radio Button Dialogs +DlgCheckboxName : "Name", +DlgCheckboxValue : "Value", +DlgCheckboxSelected : "Selected", + +// Form Dialog +DlgFormName : "Name", +DlgFormAction : "Action", +DlgFormMethod : "Method", + +// Select Field Dialog +DlgSelectName : "Name", +DlgSelectValue : "Value", +DlgSelectSize : "Size", +DlgSelectLines : "lines", +DlgSelectChkMulti : "Allow multiple selections", +DlgSelectOpAvail : "Available Options", +DlgSelectOpText : "Text", +DlgSelectOpValue : "Value", +DlgSelectBtnAdd : "Add", +DlgSelectBtnModify : "Modify", +DlgSelectBtnUp : "Up", +DlgSelectBtnDown : "Down", +DlgSelectBtnSetValue : "Set as selected value", +DlgSelectBtnDelete : "Delete", + +// Textarea Dialog +DlgTextareaName : "Name", +DlgTextareaCols : "Columns", +DlgTextareaRows : "Rows", + +// Text Field Dialog +DlgTextName : "Name", +DlgTextValue : "Value", +DlgTextCharWidth : "Character Width", +DlgTextMaxChars : "Maximum Characters", +DlgTextType : "Type", +DlgTextTypeText : "Text", +DlgTextTypePass : "Password", + +// Hidden Field Dialog +DlgHiddenName : "Name", +DlgHiddenValue : "Value", + +// Bulleted List Dialog +BulletedListProp : "Bulleted List Properties", +NumberedListProp : "Numbered List Properties", +DlgLstStart : "Start", +DlgLstType : "Type", +DlgLstTypeCircle : "Circle", +DlgLstTypeDisc : "Disc", +DlgLstTypeSquare : "Square", +DlgLstTypeNumbers : "Numbers (1, 2, 3)", +DlgLstTypeLCase : "Lowercase Letters (a, b, c)", +DlgLstTypeUCase : "Uppercase Letters (A, B, C)", +DlgLstTypeSRoman : "Small Roman Numerals (i, ii, iii)", +DlgLstTypeLRoman : "Large Roman Numerals (I, II, III)", + +// Document Properties Dialog +DlgDocGeneralTab : "General", +DlgDocBackTab : "Background", +DlgDocColorsTab : "Colours and Margins", +DlgDocMetaTab : "Meta Data", + +DlgDocPageTitle : "Page Title", +DlgDocLangDir : "Language Direction", +DlgDocLangDirLTR : "Left to Right (LTR)", +DlgDocLangDirRTL : "Right to Left (RTL)", +DlgDocLangCode : "Language Code", +DlgDocCharSet : "Character Set Encoding", +DlgDocCharSetCE : "Central European", +DlgDocCharSetCT : "Chinese Traditional (Big5)", +DlgDocCharSetCR : "Cyrillic", +DlgDocCharSetGR : "Greek", +DlgDocCharSetJP : "Japanese", +DlgDocCharSetKR : "Korean", +DlgDocCharSetTR : "Turkish", +DlgDocCharSetUN : "Unicode (UTF-8)", +DlgDocCharSetWE : "Western European", +DlgDocCharSetOther : "Other Character Set Encoding", + +DlgDocDocType : "Document Type Heading", +DlgDocDocTypeOther : "Other Document Type Heading", +DlgDocIncXHTML : "Include XHTML Declarations", +DlgDocBgColor : "Background Colour", +DlgDocBgImage : "Background Image URL", +DlgDocBgNoScroll : "Nonscrolling Background", +DlgDocCText : "Text", +DlgDocCLink : "Link", +DlgDocCVisited : "Visited Link", +DlgDocCActive : "Active Link", +DlgDocMargins : "Page Margins", +DlgDocMaTop : "Top", +DlgDocMaLeft : "Left", +DlgDocMaRight : "Right", +DlgDocMaBottom : "Bottom", +DlgDocMeIndex : "Document Indexing Keywords (comma separated)", +DlgDocMeDescr : "Document Description", +DlgDocMeAuthor : "Author", +DlgDocMeCopy : "Copyright", +DlgDocPreview : "Preview", + +// Templates Dialog +Templates : "Templates", +DlgTemplatesTitle : "Content Templates", +DlgTemplatesSelMsg : "Please select the template to open in the editor
    (the actual contents will be lost):", +DlgTemplatesLoading : "Loading templates list. Please wait...", +DlgTemplatesNoTpl : "(No templates defined)", +DlgTemplatesReplace : "Replace actual contents", + +// About Dialog +DlgAboutAboutTab : "About", +DlgAboutBrowserInfoTab : "Browser Info", +DlgAboutLicenseTab : "License", +DlgAboutVersion : "version", +DlgAboutInfo : "For further information go to" +}; diff --git a/FCKeditor/editor/lang/en-uk.js b/FCKeditor/editor/lang/en-uk.js new file mode 100644 index 0000000..941f357 --- /dev/null +++ b/FCKeditor/editor/lang/en-uk.js @@ -0,0 +1,516 @@ +/* + * FCKeditor - The text editor for Internet - http://www.fckeditor.net + * Copyright (C) 2003-2007 Frederico Caldeira Knabben + * + * == BEGIN LICENSE == + * + * Licensed under the terms of any of the following licenses at your + * choice: + * + * - GNU General Public License Version 2 or later (the "GPL") + * http://www.gnu.org/licenses/gpl.html + * + * - GNU Lesser General Public License Version 2.1 or later (the "LGPL") + * http://www.gnu.org/licenses/lgpl.html + * + * - Mozilla Public License Version 1.1 or later (the "MPL") + * http://www.mozilla.org/MPL/MPL-1.1.html + * + * == END LICENSE == + * + * English (United Kingdom) language file. + */ + +var FCKLang = +{ +// Language direction : "ltr" (left to right) or "rtl" (right to left). +Dir : "ltr", + +ToolbarCollapse : "Collapse Toolbar", +ToolbarExpand : "Expand Toolbar", + +// Toolbar Items and Context Menu +Save : "Save", +NewPage : "New Page", +Preview : "Preview", +Cut : "Cut", +Copy : "Copy", +Paste : "Paste", +PasteText : "Paste as plain text", +PasteWord : "Paste from Word", +Print : "Print", +SelectAll : "Select All", +RemoveFormat : "Remove Format", +InsertLinkLbl : "Link", +InsertLink : "Insert/Edit Link", +RemoveLink : "Remove Link", +Anchor : "Insert/Edit Anchor", +AnchorDelete : "Remove Anchor", +InsertImageLbl : "Image", +InsertImage : "Insert/Edit Image", +InsertFlashLbl : "Flash", +InsertFlash : "Insert/Edit Flash", +InsertTableLbl : "Table", +InsertTable : "Insert/Edit Table", +InsertLineLbl : "Line", +InsertLine : "Insert Horizontal Line", +InsertSpecialCharLbl: "Special Character", +InsertSpecialChar : "Insert Special Character", +InsertSmileyLbl : "Smiley", +InsertSmiley : "Insert Smiley", +About : "About FCKeditor", +Bold : "Bold", +Italic : "Italic", +Underline : "Underline", +StrikeThrough : "Strike Through", +Subscript : "Subscript", +Superscript : "Superscript", +LeftJustify : "Left Justify", +CenterJustify : "Centre Justify", +RightJustify : "Right Justify", +BlockJustify : "Block Justify", +DecreaseIndent : "Decrease Indent", +IncreaseIndent : "Increase Indent", +Blockquote : "Blockquote", +Undo : "Undo", +Redo : "Redo", +NumberedListLbl : "Numbered List", +NumberedList : "Insert/Remove Numbered List", +BulletedListLbl : "Bulleted List", +BulletedList : "Insert/Remove Bulleted List", +ShowTableBorders : "Show Table Borders", +ShowDetails : "Show Details", +Style : "Style", +FontFormat : "Format", +Font : "Font", +FontSize : "Size", +TextColor : "Text Colour", +BGColor : "Background Colour", +Source : "Source", +Find : "Find", +Replace : "Replace", +SpellCheck : "Check Spelling", +UniversalKeyboard : "Universal Keyboard", +PageBreakLbl : "Page Break", +PageBreak : "Insert Page Break", + +Form : "Form", +Checkbox : "Checkbox", +RadioButton : "Radio Button", +TextField : "Text Field", +Textarea : "Textarea", +HiddenField : "Hidden Field", +Button : "Button", +SelectionField : "Selection Field", +ImageButton : "Image Button", + +FitWindow : "Maximize the editor size", +ShowBlocks : "Show Blocks", + +// Context Menu +EditLink : "Edit Link", +CellCM : "Cell", +RowCM : "Row", +ColumnCM : "Column", +InsertRowAfter : "Insert Row After", +InsertRowBefore : "Insert Row Before", +DeleteRows : "Delete Rows", +InsertColumnAfter : "Insert Column After", +InsertColumnBefore : "Insert Column Before", +DeleteColumns : "Delete Columns", +InsertCellAfter : "Insert Cell After", +InsertCellBefore : "Insert Cell Before", +DeleteCells : "Delete Cells", +MergeCells : "Merge Cells", +MergeRight : "Merge Right", +MergeDown : "Merge Down", +HorizontalSplitCell : "Split Cell Horizontally", +VerticalSplitCell : "Split Cell Vertically", +TableDelete : "Delete Table", +CellProperties : "Cell Properties", +TableProperties : "Table Properties", +ImageProperties : "Image Properties", +FlashProperties : "Flash Properties", + +AnchorProp : "Anchor Properties", +ButtonProp : "Button Properties", +CheckboxProp : "Checkbox Properties", +HiddenFieldProp : "Hidden Field Properties", +RadioButtonProp : "Radio Button Properties", +ImageButtonProp : "Image Button Properties", +TextFieldProp : "Text Field Properties", +SelectionFieldProp : "Selection Field Properties", +TextareaProp : "Textarea Properties", +FormProp : "Form Properties", + +FontFormats : "Normal;Formatted;Address;Heading 1;Heading 2;Heading 3;Heading 4;Heading 5;Heading 6;Normal (DIV)", + +// Alerts and Messages +ProcessingXHTML : "Processing XHTML. Please wait...", +Done : "Done", +PasteWordConfirm : "The text you want to paste seems to be copied from Word. Do you want to clean it before pasting?", +NotCompatiblePaste : "This command is available for Internet Explorer version 5.5 or more. Do you want to paste without cleaning?", +UnknownToolbarItem : "Unknown toolbar item \"%1\"", +UnknownCommand : "Unknown command name \"%1\"", +NotImplemented : "Command not implemented", +UnknownToolbarSet : "Toolbar set \"%1\" doesn't exist", +NoActiveX : "Your browser's security settings could limit some features of the editor. You must enable the option \"Run ActiveX controls and plug-ins\". You may experience errors and notice missing features.", +BrowseServerBlocked : "The resources browser could not be opened. Make sure that all popup blockers are disabled.", +DialogBlocked : "It was not possible to open the dialog window. Make sure all popup blockers are disabled.", + +// Dialogs +DlgBtnOK : "OK", +DlgBtnCancel : "Cancel", +DlgBtnClose : "Close", +DlgBtnBrowseServer : "Browse Server", +DlgAdvancedTag : "Advanced", +DlgOpOther : "", +DlgInfoTab : "Info", +DlgAlertUrl : "Please insert the URL", + +// General Dialogs Labels +DlgGenNotSet : "", +DlgGenId : "Id", +DlgGenLangDir : "Language Direction", +DlgGenLangDirLtr : "Left to Right (LTR)", +DlgGenLangDirRtl : "Right to Left (RTL)", +DlgGenLangCode : "Language Code", +DlgGenAccessKey : "Access Key", +DlgGenName : "Name", +DlgGenTabIndex : "Tab Index", +DlgGenLongDescr : "Long Description URL", +DlgGenClass : "Stylesheet Classes", +DlgGenTitle : "Advisory Title", +DlgGenContType : "Advisory Content Type", +DlgGenLinkCharset : "Linked Resource Charset", +DlgGenStyle : "Style", + +// Image Dialog +DlgImgTitle : "Image Properties", +DlgImgInfoTab : "Image Info", +DlgImgBtnUpload : "Send it to the Server", +DlgImgURL : "URL", +DlgImgUpload : "Upload", +DlgImgAlt : "Alternative Text", +DlgImgWidth : "Width", +DlgImgHeight : "Height", +DlgImgLockRatio : "Lock Ratio", +DlgBtnResetSize : "Reset Size", +DlgImgBorder : "Border", +DlgImgHSpace : "HSpace", +DlgImgVSpace : "VSpace", +DlgImgAlign : "Align", +DlgImgAlignLeft : "Left", +DlgImgAlignAbsBottom: "Abs Bottom", +DlgImgAlignAbsMiddle: "Abs Middle", +DlgImgAlignBaseline : "Baseline", +DlgImgAlignBottom : "Bottom", +DlgImgAlignMiddle : "Middle", +DlgImgAlignRight : "Right", +DlgImgAlignTextTop : "Text Top", +DlgImgAlignTop : "Top", +DlgImgPreview : "Preview", +DlgImgAlertUrl : "Please type the image URL", +DlgImgLinkTab : "Link", + +// Flash Dialog +DlgFlashTitle : "Flash Properties", +DlgFlashChkPlay : "Auto Play", +DlgFlashChkLoop : "Loop", +DlgFlashChkMenu : "Enable Flash Menu", +DlgFlashScale : "Scale", +DlgFlashScaleAll : "Show all", +DlgFlashScaleNoBorder : "No Border", +DlgFlashScaleFit : "Exact Fit", + +// Link Dialog +DlgLnkWindowTitle : "Link", +DlgLnkInfoTab : "Link Info", +DlgLnkTargetTab : "Target", + +DlgLnkType : "Link Type", +DlgLnkTypeURL : "URL", +DlgLnkTypeAnchor : "Link to anchor in the text", +DlgLnkTypeEMail : "E-Mail", +DlgLnkProto : "Protocol", +DlgLnkProtoOther : "", +DlgLnkURL : "URL", +DlgLnkAnchorSel : "Select an Anchor", +DlgLnkAnchorByName : "By Anchor Name", +DlgLnkAnchorById : "By Element Id", +DlgLnkNoAnchors : "(No anchors available in the document)", +DlgLnkEMail : "E-Mail Address", +DlgLnkEMailSubject : "Message Subject", +DlgLnkEMailBody : "Message Body", +DlgLnkUpload : "Upload", +DlgLnkBtnUpload : "Send it to the Server", + +DlgLnkTarget : "Target", +DlgLnkTargetFrame : "", +DlgLnkTargetPopup : "", +DlgLnkTargetBlank : "New Window (_blank)", +DlgLnkTargetParent : "Parent Window (_parent)", +DlgLnkTargetSelf : "Same Window (_self)", +DlgLnkTargetTop : "Topmost Window (_top)", +DlgLnkTargetFrameName : "Target Frame Name", +DlgLnkPopWinName : "Popup Window Name", +DlgLnkPopWinFeat : "Popup Window Features", +DlgLnkPopResize : "Resizable", +DlgLnkPopLocation : "Location Bar", +DlgLnkPopMenu : "Menu Bar", +DlgLnkPopScroll : "Scroll Bars", +DlgLnkPopStatus : "Status Bar", +DlgLnkPopToolbar : "Toolbar", +DlgLnkPopFullScrn : "Full Screen (IE)", +DlgLnkPopDependent : "Dependent (Netscape)", +DlgLnkPopWidth : "Width", +DlgLnkPopHeight : "Height", +DlgLnkPopLeft : "Left Position", +DlgLnkPopTop : "Top Position", + +DlnLnkMsgNoUrl : "Please type the link URL", +DlnLnkMsgNoEMail : "Please type the e-mail address", +DlnLnkMsgNoAnchor : "Please select an anchor", +DlnLnkMsgInvPopName : "The popup name must begin with an alphabetic character and must not contain spaces", + +// Color Dialog +DlgColorTitle : "Select Colour", +DlgColorBtnClear : "Clear", +DlgColorHighlight : "Highlight", +DlgColorSelected : "Selected", + +// Smiley Dialog +DlgSmileyTitle : "Insert a Smiley", + +// Special Character Dialog +DlgSpecialCharTitle : "Select Special Character", + +// Table Dialog +DlgTableTitle : "Table Properties", +DlgTableRows : "Rows", +DlgTableColumns : "Columns", +DlgTableBorder : "Border size", +DlgTableAlign : "Alignment", +DlgTableAlignNotSet : "", +DlgTableAlignLeft : "Left", +DlgTableAlignCenter : "Centre", +DlgTableAlignRight : "Right", +DlgTableWidth : "Width", +DlgTableWidthPx : "pixels", +DlgTableWidthPc : "percent", +DlgTableHeight : "Height", +DlgTableCellSpace : "Cell spacing", +DlgTableCellPad : "Cell padding", +DlgTableCaption : "Caption", +DlgTableSummary : "Summary", + +// Table Cell Dialog +DlgCellTitle : "Cell Properties", +DlgCellWidth : "Width", +DlgCellWidthPx : "pixels", +DlgCellWidthPc : "percent", +DlgCellHeight : "Height", +DlgCellWordWrap : "Word Wrap", +DlgCellWordWrapNotSet : "", +DlgCellWordWrapYes : "Yes", +DlgCellWordWrapNo : "No", +DlgCellHorAlign : "Horizontal Alignment", +DlgCellHorAlignNotSet : "", +DlgCellHorAlignLeft : "Left", +DlgCellHorAlignCenter : "Centre", +DlgCellHorAlignRight: "Right", +DlgCellVerAlign : "Vertical Alignment", +DlgCellVerAlignNotSet : "", +DlgCellVerAlignTop : "Top", +DlgCellVerAlignMiddle : "Middle", +DlgCellVerAlignBottom : "Bottom", +DlgCellVerAlignBaseline : "Baseline", +DlgCellRowSpan : "Rows Span", +DlgCellCollSpan : "Columns Span", +DlgCellBackColor : "Background Colour", +DlgCellBorderColor : "Border Colour", +DlgCellBtnSelect : "Select...", + +// Find and Replace Dialog +DlgFindAndReplaceTitle : "Find and Replace", + +// Find Dialog +DlgFindTitle : "Find", +DlgFindFindBtn : "Find", +DlgFindNotFoundMsg : "The specified text was not found.", + +// Replace Dialog +DlgReplaceTitle : "Replace", +DlgReplaceFindLbl : "Find what:", +DlgReplaceReplaceLbl : "Replace with:", +DlgReplaceCaseChk : "Match case", +DlgReplaceReplaceBtn : "Replace", +DlgReplaceReplAllBtn : "Replace All", +DlgReplaceWordChk : "Match whole word", + +// Paste Operations / Dialog +PasteErrorCut : "Your browser security settings don't permit the editor to automatically execute cutting operations. Please use the keyboard for that (Ctrl+X).", +PasteErrorCopy : "Your browser security settings don't permit the editor to automatically execute copying operations. Please use the keyboard for that (Ctrl+C).", + +PasteAsText : "Paste as Plain Text", +PasteFromWord : "Paste from Word", + +DlgPasteMsg2 : "Please paste inside the following box using the keyboard (Ctrl+V) and hit OK.", +DlgPasteSec : "Because of your browser security settings, the editor is not able to access your clipboard data directly. You are required to paste it again in this window.", +DlgPasteIgnoreFont : "Ignore Font Face definitions", +DlgPasteRemoveStyles : "Remove Styles definitions", +DlgPasteCleanBox : "Clean Up Box", + +// Color Picker +ColorAutomatic : "Automatic", +ColorMoreColors : "More Colours...", + +// Document Properties +DocProps : "Document Properties", + +// Anchor Dialog +DlgAnchorTitle : "Anchor Properties", +DlgAnchorName : "Anchor Name", +DlgAnchorErrorName : "Please type the anchor name", + +// Speller Pages Dialog +DlgSpellNotInDic : "Not in dictionary", +DlgSpellChangeTo : "Change to", +DlgSpellBtnIgnore : "Ignore", +DlgSpellBtnIgnoreAll : "Ignore All", +DlgSpellBtnReplace : "Replace", +DlgSpellBtnReplaceAll : "Replace All", +DlgSpellBtnUndo : "Undo", +DlgSpellNoSuggestions : "- No suggestions -", +DlgSpellProgress : "Spell check in progress...", +DlgSpellNoMispell : "Spell check complete: No misspellings found", +DlgSpellNoChanges : "Spell check complete: No words changed", +DlgSpellOneChange : "Spell check complete: One word changed", +DlgSpellManyChanges : "Spell check complete: %1 words changed", + +IeSpellDownload : "Spell checker not installed. Do you want to download it now?", + +// Button Dialog +DlgButtonText : "Text (Value)", +DlgButtonType : "Type", +DlgButtonTypeBtn : "Button", +DlgButtonTypeSbm : "Submit", +DlgButtonTypeRst : "Reset", + +// Checkbox and Radio Button Dialogs +DlgCheckboxName : "Name", +DlgCheckboxValue : "Value", +DlgCheckboxSelected : "Selected", + +// Form Dialog +DlgFormName : "Name", +DlgFormAction : "Action", +DlgFormMethod : "Method", + +// Select Field Dialog +DlgSelectName : "Name", +DlgSelectValue : "Value", +DlgSelectSize : "Size", +DlgSelectLines : "lines", +DlgSelectChkMulti : "Allow multiple selections", +DlgSelectOpAvail : "Available Options", +DlgSelectOpText : "Text", +DlgSelectOpValue : "Value", +DlgSelectBtnAdd : "Add", +DlgSelectBtnModify : "Modify", +DlgSelectBtnUp : "Up", +DlgSelectBtnDown : "Down", +DlgSelectBtnSetValue : "Set as selected value", +DlgSelectBtnDelete : "Delete", + +// Textarea Dialog +DlgTextareaName : "Name", +DlgTextareaCols : "Columns", +DlgTextareaRows : "Rows", + +// Text Field Dialog +DlgTextName : "Name", +DlgTextValue : "Value", +DlgTextCharWidth : "Character Width", +DlgTextMaxChars : "Maximum Characters", +DlgTextType : "Type", +DlgTextTypeText : "Text", +DlgTextTypePass : "Password", + +// Hidden Field Dialog +DlgHiddenName : "Name", +DlgHiddenValue : "Value", + +// Bulleted List Dialog +BulletedListProp : "Bulleted List Properties", +NumberedListProp : "Numbered List Properties", +DlgLstStart : "Start", +DlgLstType : "Type", +DlgLstTypeCircle : "Circle", +DlgLstTypeDisc : "Disc", +DlgLstTypeSquare : "Square", +DlgLstTypeNumbers : "Numbers (1, 2, 3)", +DlgLstTypeLCase : "Lowercase Letters (a, b, c)", +DlgLstTypeUCase : "Uppercase Letters (A, B, C)", +DlgLstTypeSRoman : "Small Roman Numerals (i, ii, iii)", +DlgLstTypeLRoman : "Large Roman Numerals (I, II, III)", + +// Document Properties Dialog +DlgDocGeneralTab : "General", +DlgDocBackTab : "Background", +DlgDocColorsTab : "Colours and Margins", +DlgDocMetaTab : "Meta Data", + +DlgDocPageTitle : "Page Title", +DlgDocLangDir : "Language Direction", +DlgDocLangDirLTR : "Left to Right (LTR)", +DlgDocLangDirRTL : "Right to Left (RTL)", +DlgDocLangCode : "Language Code", +DlgDocCharSet : "Character Set Encoding", +DlgDocCharSetCE : "Central European", +DlgDocCharSetCT : "Chinese Traditional (Big5)", +DlgDocCharSetCR : "Cyrillic", +DlgDocCharSetGR : "Greek", +DlgDocCharSetJP : "Japanese", +DlgDocCharSetKR : "Korean", +DlgDocCharSetTR : "Turkish", +DlgDocCharSetUN : "Unicode (UTF-8)", +DlgDocCharSetWE : "Western European", +DlgDocCharSetOther : "Other Character Set Encoding", + +DlgDocDocType : "Document Type Heading", +DlgDocDocTypeOther : "Other Document Type Heading", +DlgDocIncXHTML : "Include XHTML Declarations", +DlgDocBgColor : "Background Colour", +DlgDocBgImage : "Background Image URL", +DlgDocBgNoScroll : "Nonscrolling Background", +DlgDocCText : "Text", +DlgDocCLink : "Link", +DlgDocCVisited : "Visited Link", +DlgDocCActive : "Active Link", +DlgDocMargins : "Page Margins", +DlgDocMaTop : "Top", +DlgDocMaLeft : "Left", +DlgDocMaRight : "Right", +DlgDocMaBottom : "Bottom", +DlgDocMeIndex : "Document Indexing Keywords (comma separated)", +DlgDocMeDescr : "Document Description", +DlgDocMeAuthor : "Author", +DlgDocMeCopy : "Copyright", +DlgDocPreview : "Preview", + +// Templates Dialog +Templates : "Templates", +DlgTemplatesTitle : "Content Templates", +DlgTemplatesSelMsg : "Please select the template to open in the editor
    (the actual contents will be lost):", +DlgTemplatesLoading : "Loading templates list. Please wait...", +DlgTemplatesNoTpl : "(No templates defined)", +DlgTemplatesReplace : "Replace actual contents", + +// About Dialog +DlgAboutAboutTab : "About", +DlgAboutBrowserInfoTab : "Browser Info", +DlgAboutLicenseTab : "License", +DlgAboutVersion : "version", +DlgAboutInfo : "For further information go to" +}; diff --git a/FCKeditor/editor/lang/en.js b/FCKeditor/editor/lang/en.js new file mode 100644 index 0000000..e6bccdb --- /dev/null +++ b/FCKeditor/editor/lang/en.js @@ -0,0 +1,516 @@ +/* + * FCKeditor - The text editor for Internet - http://www.fckeditor.net + * Copyright (C) 2003-2007 Frederico Caldeira Knabben + * + * == BEGIN LICENSE == + * + * Licensed under the terms of any of the following licenses at your + * choice: + * + * - GNU General Public License Version 2 or later (the "GPL") + * http://www.gnu.org/licenses/gpl.html + * + * - GNU Lesser General Public License Version 2.1 or later (the "LGPL") + * http://www.gnu.org/licenses/lgpl.html + * + * - Mozilla Public License Version 1.1 or later (the "MPL") + * http://www.mozilla.org/MPL/MPL-1.1.html + * + * == END LICENSE == + * + * English language file. + */ + +var FCKLang = +{ +// Language direction : "ltr" (left to right) or "rtl" (right to left). +Dir : "ltr", + +ToolbarCollapse : "Collapse Toolbar", +ToolbarExpand : "Expand Toolbar", + +// Toolbar Items and Context Menu +Save : "Save", +NewPage : "New Page", +Preview : "Preview", +Cut : "Cut", +Copy : "Copy", +Paste : "Paste", +PasteText : "Paste as plain text", +PasteWord : "Paste from Word", +Print : "Print", +SelectAll : "Select All", +RemoveFormat : "Remove Format", +InsertLinkLbl : "Link", +InsertLink : "Insert/Edit Link", +RemoveLink : "Remove Link", +Anchor : "Insert/Edit Anchor", +AnchorDelete : "Remove Anchor", +InsertImageLbl : "Image", +InsertImage : "Insert/Edit Image", +InsertFlashLbl : "Flash", +InsertFlash : "Insert/Edit Flash", +InsertTableLbl : "Table", +InsertTable : "Insert/Edit Table", +InsertLineLbl : "Line", +InsertLine : "Insert Horizontal Line", +InsertSpecialCharLbl: "Special Character", +InsertSpecialChar : "Insert Special Character", +InsertSmileyLbl : "Smiley", +InsertSmiley : "Insert Smiley", +About : "About FCKeditor", +Bold : "Bold", +Italic : "Italic", +Underline : "Underline", +StrikeThrough : "Strike Through", +Subscript : "Subscript", +Superscript : "Superscript", +LeftJustify : "Left Justify", +CenterJustify : "Center Justify", +RightJustify : "Right Justify", +BlockJustify : "Block Justify", +DecreaseIndent : "Decrease Indent", +IncreaseIndent : "Increase Indent", +Blockquote : "Blockquote", +Undo : "Undo", +Redo : "Redo", +NumberedListLbl : "Numbered List", +NumberedList : "Insert/Remove Numbered List", +BulletedListLbl : "Bulleted List", +BulletedList : "Insert/Remove Bulleted List", +ShowTableBorders : "Show Table Borders", +ShowDetails : "Show Details", +Style : "Style", +FontFormat : "Format", +Font : "Font", +FontSize : "Size", +TextColor : "Text Color", +BGColor : "Background Color", +Source : "Source", +Find : "Find", +Replace : "Replace", +SpellCheck : "Check Spelling", +UniversalKeyboard : "Universal Keyboard", +PageBreakLbl : "Page Break", +PageBreak : "Insert Page Break", + +Form : "Form", +Checkbox : "Checkbox", +RadioButton : "Radio Button", +TextField : "Text Field", +Textarea : "Textarea", +HiddenField : "Hidden Field", +Button : "Button", +SelectionField : "Selection Field", +ImageButton : "Image Button", + +FitWindow : "Maximize the editor size", +ShowBlocks : "Show Blocks", + +// Context Menu +EditLink : "Edit Link", +CellCM : "Cell", +RowCM : "Row", +ColumnCM : "Column", +InsertRowAfter : "Insert Row After", +InsertRowBefore : "Insert Row Before", +DeleteRows : "Delete Rows", +InsertColumnAfter : "Insert Column After", +InsertColumnBefore : "Insert Column Before", +DeleteColumns : "Delete Columns", +InsertCellAfter : "Insert Cell After", +InsertCellBefore : "Insert Cell Before", +DeleteCells : "Delete Cells", +MergeCells : "Merge Cells", +MergeRight : "Merge Right", +MergeDown : "Merge Down", +HorizontalSplitCell : "Split Cell Horizontally", +VerticalSplitCell : "Split Cell Vertically", +TableDelete : "Delete Table", +CellProperties : "Cell Properties", +TableProperties : "Table Properties", +ImageProperties : "Image Properties", +FlashProperties : "Flash Properties", + +AnchorProp : "Anchor Properties", +ButtonProp : "Button Properties", +CheckboxProp : "Checkbox Properties", +HiddenFieldProp : "Hidden Field Properties", +RadioButtonProp : "Radio Button Properties", +ImageButtonProp : "Image Button Properties", +TextFieldProp : "Text Field Properties", +SelectionFieldProp : "Selection Field Properties", +TextareaProp : "Textarea Properties", +FormProp : "Form Properties", + +FontFormats : "Normal;Formatted;Address;Heading 1;Heading 2;Heading 3;Heading 4;Heading 5;Heading 6;Normal (DIV)", + +// Alerts and Messages +ProcessingXHTML : "Processing XHTML. Please wait...", +Done : "Done", +PasteWordConfirm : "The text you want to paste seems to be copied from Word. Do you want to clean it before pasting?", +NotCompatiblePaste : "This command is available for Internet Explorer version 5.5 or more. Do you want to paste without cleaning?", +UnknownToolbarItem : "Unknown toolbar item \"%1\"", +UnknownCommand : "Unknown command name \"%1\"", +NotImplemented : "Command not implemented", +UnknownToolbarSet : "Toolbar set \"%1\" doesn't exist", +NoActiveX : "Your browser's security settings could limit some features of the editor. You must enable the option \"Run ActiveX controls and plug-ins\". You may experience errors and notice missing features.", +BrowseServerBlocked : "The resources browser could not be opened. Make sure that all popup blockers are disabled.", +DialogBlocked : "It was not possible to open the dialog window. Make sure all popup blockers are disabled.", + +// Dialogs +DlgBtnOK : "OK", +DlgBtnCancel : "Cancel", +DlgBtnClose : "Close", +DlgBtnBrowseServer : "Browse Server", +DlgAdvancedTag : "Advanced", +DlgOpOther : "", +DlgInfoTab : "Info", +DlgAlertUrl : "Please insert the URL", + +// General Dialogs Labels +DlgGenNotSet : "", +DlgGenId : "Id", +DlgGenLangDir : "Language Direction", +DlgGenLangDirLtr : "Left to Right (LTR)", +DlgGenLangDirRtl : "Right to Left (RTL)", +DlgGenLangCode : "Language Code", +DlgGenAccessKey : "Access Key", +DlgGenName : "Name", +DlgGenTabIndex : "Tab Index", +DlgGenLongDescr : "Long Description URL", +DlgGenClass : "Stylesheet Classes", +DlgGenTitle : "Advisory Title", +DlgGenContType : "Advisory Content Type", +DlgGenLinkCharset : "Linked Resource Charset", +DlgGenStyle : "Style", + +// Image Dialog +DlgImgTitle : "Image Properties", +DlgImgInfoTab : "Image Info", +DlgImgBtnUpload : "Send it to the Server", +DlgImgURL : "URL", +DlgImgUpload : "Upload", +DlgImgAlt : "Alternative Text", +DlgImgWidth : "Width", +DlgImgHeight : "Height", +DlgImgLockRatio : "Lock Ratio", +DlgBtnResetSize : "Reset Size", +DlgImgBorder : "Border", +DlgImgHSpace : "HSpace", +DlgImgVSpace : "VSpace", +DlgImgAlign : "Align", +DlgImgAlignLeft : "Left", +DlgImgAlignAbsBottom: "Abs Bottom", +DlgImgAlignAbsMiddle: "Abs Middle", +DlgImgAlignBaseline : "Baseline", +DlgImgAlignBottom : "Bottom", +DlgImgAlignMiddle : "Middle", +DlgImgAlignRight : "Right", +DlgImgAlignTextTop : "Text Top", +DlgImgAlignTop : "Top", +DlgImgPreview : "Preview", +DlgImgAlertUrl : "Please type the image URL", +DlgImgLinkTab : "Link", + +// Flash Dialog +DlgFlashTitle : "Flash Properties", +DlgFlashChkPlay : "Auto Play", +DlgFlashChkLoop : "Loop", +DlgFlashChkMenu : "Enable Flash Menu", +DlgFlashScale : "Scale", +DlgFlashScaleAll : "Show all", +DlgFlashScaleNoBorder : "No Border", +DlgFlashScaleFit : "Exact Fit", + +// Link Dialog +DlgLnkWindowTitle : "Link", +DlgLnkInfoTab : "Link Info", +DlgLnkTargetTab : "Target", + +DlgLnkType : "Link Type", +DlgLnkTypeURL : "URL", +DlgLnkTypeAnchor : "Link to anchor in the text", +DlgLnkTypeEMail : "E-Mail", +DlgLnkProto : "Protocol", +DlgLnkProtoOther : "", +DlgLnkURL : "URL", +DlgLnkAnchorSel : "Select an Anchor", +DlgLnkAnchorByName : "By Anchor Name", +DlgLnkAnchorById : "By Element Id", +DlgLnkNoAnchors : "(No anchors available in the document)", +DlgLnkEMail : "E-Mail Address", +DlgLnkEMailSubject : "Message Subject", +DlgLnkEMailBody : "Message Body", +DlgLnkUpload : "Upload", +DlgLnkBtnUpload : "Send it to the Server", + +DlgLnkTarget : "Target", +DlgLnkTargetFrame : "", +DlgLnkTargetPopup : "", +DlgLnkTargetBlank : "New Window (_blank)", +DlgLnkTargetParent : "Parent Window (_parent)", +DlgLnkTargetSelf : "Same Window (_self)", +DlgLnkTargetTop : "Topmost Window (_top)", +DlgLnkTargetFrameName : "Target Frame Name", +DlgLnkPopWinName : "Popup Window Name", +DlgLnkPopWinFeat : "Popup Window Features", +DlgLnkPopResize : "Resizable", +DlgLnkPopLocation : "Location Bar", +DlgLnkPopMenu : "Menu Bar", +DlgLnkPopScroll : "Scroll Bars", +DlgLnkPopStatus : "Status Bar", +DlgLnkPopToolbar : "Toolbar", +DlgLnkPopFullScrn : "Full Screen (IE)", +DlgLnkPopDependent : "Dependent (Netscape)", +DlgLnkPopWidth : "Width", +DlgLnkPopHeight : "Height", +DlgLnkPopLeft : "Left Position", +DlgLnkPopTop : "Top Position", + +DlnLnkMsgNoUrl : "Please type the link URL", +DlnLnkMsgNoEMail : "Please type the e-mail address", +DlnLnkMsgNoAnchor : "Please select an anchor", +DlnLnkMsgInvPopName : "The popup name must begin with an alphabetic character and must not contain spaces", + +// Color Dialog +DlgColorTitle : "Select Color", +DlgColorBtnClear : "Clear", +DlgColorHighlight : "Highlight", +DlgColorSelected : "Selected", + +// Smiley Dialog +DlgSmileyTitle : "Insert a Smiley", + +// Special Character Dialog +DlgSpecialCharTitle : "Select Special Character", + +// Table Dialog +DlgTableTitle : "Table Properties", +DlgTableRows : "Rows", +DlgTableColumns : "Columns", +DlgTableBorder : "Border size", +DlgTableAlign : "Alignment", +DlgTableAlignNotSet : "", +DlgTableAlignLeft : "Left", +DlgTableAlignCenter : "Center", +DlgTableAlignRight : "Right", +DlgTableWidth : "Width", +DlgTableWidthPx : "pixels", +DlgTableWidthPc : "percent", +DlgTableHeight : "Height", +DlgTableCellSpace : "Cell spacing", +DlgTableCellPad : "Cell padding", +DlgTableCaption : "Caption", +DlgTableSummary : "Summary", + +// Table Cell Dialog +DlgCellTitle : "Cell Properties", +DlgCellWidth : "Width", +DlgCellWidthPx : "pixels", +DlgCellWidthPc : "percent", +DlgCellHeight : "Height", +DlgCellWordWrap : "Word Wrap", +DlgCellWordWrapNotSet : "", +DlgCellWordWrapYes : "Yes", +DlgCellWordWrapNo : "No", +DlgCellHorAlign : "Horizontal Alignment", +DlgCellHorAlignNotSet : "", +DlgCellHorAlignLeft : "Left", +DlgCellHorAlignCenter : "Center", +DlgCellHorAlignRight: "Right", +DlgCellVerAlign : "Vertical Alignment", +DlgCellVerAlignNotSet : "", +DlgCellVerAlignTop : "Top", +DlgCellVerAlignMiddle : "Middle", +DlgCellVerAlignBottom : "Bottom", +DlgCellVerAlignBaseline : "Baseline", +DlgCellRowSpan : "Rows Span", +DlgCellCollSpan : "Columns Span", +DlgCellBackColor : "Background Color", +DlgCellBorderColor : "Border Color", +DlgCellBtnSelect : "Select...", + +// Find and Replace Dialog +DlgFindAndReplaceTitle : "Find and Replace", + +// Find Dialog +DlgFindTitle : "Find", +DlgFindFindBtn : "Find", +DlgFindNotFoundMsg : "The specified text was not found.", + +// Replace Dialog +DlgReplaceTitle : "Replace", +DlgReplaceFindLbl : "Find what:", +DlgReplaceReplaceLbl : "Replace with:", +DlgReplaceCaseChk : "Match case", +DlgReplaceReplaceBtn : "Replace", +DlgReplaceReplAllBtn : "Replace All", +DlgReplaceWordChk : "Match whole word", + +// Paste Operations / Dialog +PasteErrorCut : "Your browser security settings don't permit the editor to automatically execute cutting operations. Please use the keyboard for that (Ctrl+X).", +PasteErrorCopy : "Your browser security settings don't permit the editor to automatically execute copying operations. Please use the keyboard for that (Ctrl+C).", + +PasteAsText : "Paste as Plain Text", +PasteFromWord : "Paste from Word", + +DlgPasteMsg2 : "Please paste inside the following box using the keyboard (Ctrl+V) and hit OK.", +DlgPasteSec : "Because of your browser security settings, the editor is not able to access your clipboard data directly. You are required to paste it again in this window.", +DlgPasteIgnoreFont : "Ignore Font Face definitions", +DlgPasteRemoveStyles : "Remove Styles definitions", +DlgPasteCleanBox : "Clean Up Box", + +// Color Picker +ColorAutomatic : "Automatic", +ColorMoreColors : "More Colors...", + +// Document Properties +DocProps : "Document Properties", + +// Anchor Dialog +DlgAnchorTitle : "Anchor Properties", +DlgAnchorName : "Anchor Name", +DlgAnchorErrorName : "Please type the anchor name", + +// Speller Pages Dialog +DlgSpellNotInDic : "Not in dictionary", +DlgSpellChangeTo : "Change to", +DlgSpellBtnIgnore : "Ignore", +DlgSpellBtnIgnoreAll : "Ignore All", +DlgSpellBtnReplace : "Replace", +DlgSpellBtnReplaceAll : "Replace All", +DlgSpellBtnUndo : "Undo", +DlgSpellNoSuggestions : "- No suggestions -", +DlgSpellProgress : "Spell check in progress...", +DlgSpellNoMispell : "Spell check complete: No misspellings found", +DlgSpellNoChanges : "Spell check complete: No words changed", +DlgSpellOneChange : "Spell check complete: One word changed", +DlgSpellManyChanges : "Spell check complete: %1 words changed", + +IeSpellDownload : "Spell checker not installed. Do you want to download it now?", + +// Button Dialog +DlgButtonText : "Text (Value)", +DlgButtonType : "Type", +DlgButtonTypeBtn : "Button", +DlgButtonTypeSbm : "Submit", +DlgButtonTypeRst : "Reset", + +// Checkbox and Radio Button Dialogs +DlgCheckboxName : "Name", +DlgCheckboxValue : "Value", +DlgCheckboxSelected : "Selected", + +// Form Dialog +DlgFormName : "Name", +DlgFormAction : "Action", +DlgFormMethod : "Method", + +// Select Field Dialog +DlgSelectName : "Name", +DlgSelectValue : "Value", +DlgSelectSize : "Size", +DlgSelectLines : "lines", +DlgSelectChkMulti : "Allow multiple selections", +DlgSelectOpAvail : "Available Options", +DlgSelectOpText : "Text", +DlgSelectOpValue : "Value", +DlgSelectBtnAdd : "Add", +DlgSelectBtnModify : "Modify", +DlgSelectBtnUp : "Up", +DlgSelectBtnDown : "Down", +DlgSelectBtnSetValue : "Set as selected value", +DlgSelectBtnDelete : "Delete", + +// Textarea Dialog +DlgTextareaName : "Name", +DlgTextareaCols : "Columns", +DlgTextareaRows : "Rows", + +// Text Field Dialog +DlgTextName : "Name", +DlgTextValue : "Value", +DlgTextCharWidth : "Character Width", +DlgTextMaxChars : "Maximum Characters", +DlgTextType : "Type", +DlgTextTypeText : "Text", +DlgTextTypePass : "Password", + +// Hidden Field Dialog +DlgHiddenName : "Name", +DlgHiddenValue : "Value", + +// Bulleted List Dialog +BulletedListProp : "Bulleted List Properties", +NumberedListProp : "Numbered List Properties", +DlgLstStart : "Start", +DlgLstType : "Type", +DlgLstTypeCircle : "Circle", +DlgLstTypeDisc : "Disc", +DlgLstTypeSquare : "Square", +DlgLstTypeNumbers : "Numbers (1, 2, 3)", +DlgLstTypeLCase : "Lowercase Letters (a, b, c)", +DlgLstTypeUCase : "Uppercase Letters (A, B, C)", +DlgLstTypeSRoman : "Small Roman Numerals (i, ii, iii)", +DlgLstTypeLRoman : "Large Roman Numerals (I, II, III)", + +// Document Properties Dialog +DlgDocGeneralTab : "General", +DlgDocBackTab : "Background", +DlgDocColorsTab : "Colors and Margins", +DlgDocMetaTab : "Meta Data", + +DlgDocPageTitle : "Page Title", +DlgDocLangDir : "Language Direction", +DlgDocLangDirLTR : "Left to Right (LTR)", +DlgDocLangDirRTL : "Right to Left (RTL)", +DlgDocLangCode : "Language Code", +DlgDocCharSet : "Character Set Encoding", +DlgDocCharSetCE : "Central European", +DlgDocCharSetCT : "Chinese Traditional (Big5)", +DlgDocCharSetCR : "Cyrillic", +DlgDocCharSetGR : "Greek", +DlgDocCharSetJP : "Japanese", +DlgDocCharSetKR : "Korean", +DlgDocCharSetTR : "Turkish", +DlgDocCharSetUN : "Unicode (UTF-8)", +DlgDocCharSetWE : "Western European", +DlgDocCharSetOther : "Other Character Set Encoding", + +DlgDocDocType : "Document Type Heading", +DlgDocDocTypeOther : "Other Document Type Heading", +DlgDocIncXHTML : "Include XHTML Declarations", +DlgDocBgColor : "Background Color", +DlgDocBgImage : "Background Image URL", +DlgDocBgNoScroll : "Nonscrolling Background", +DlgDocCText : "Text", +DlgDocCLink : "Link", +DlgDocCVisited : "Visited Link", +DlgDocCActive : "Active Link", +DlgDocMargins : "Page Margins", +DlgDocMaTop : "Top", +DlgDocMaLeft : "Left", +DlgDocMaRight : "Right", +DlgDocMaBottom : "Bottom", +DlgDocMeIndex : "Document Indexing Keywords (comma separated)", +DlgDocMeDescr : "Document Description", +DlgDocMeAuthor : "Author", +DlgDocMeCopy : "Copyright", +DlgDocPreview : "Preview", + +// Templates Dialog +Templates : "Templates", +DlgTemplatesTitle : "Content Templates", +DlgTemplatesSelMsg : "Please select the template to open in the editor
    (the actual contents will be lost):", +DlgTemplatesLoading : "Loading templates list. Please wait...", +DlgTemplatesNoTpl : "(No templates defined)", +DlgTemplatesReplace : "Replace actual contents", + +// About Dialog +DlgAboutAboutTab : "About", +DlgAboutBrowserInfoTab : "Browser Info", +DlgAboutLicenseTab : "License", +DlgAboutVersion : "version", +DlgAboutInfo : "For further information go to" +}; diff --git a/FCKeditor/editor/lang/eo.js b/FCKeditor/editor/lang/eo.js new file mode 100644 index 0000000..7f57de5 --- /dev/null +++ b/FCKeditor/editor/lang/eo.js @@ -0,0 +1,516 @@ +/* + * FCKeditor - The text editor for Internet - http://www.fckeditor.net + * Copyright (C) 2003-2007 Frederico Caldeira Knabben + * + * == BEGIN LICENSE == + * + * Licensed under the terms of any of the following licenses at your + * choice: + * + * - GNU General Public License Version 2 or later (the "GPL") + * http://www.gnu.org/licenses/gpl.html + * + * - GNU Lesser General Public License Version 2.1 or later (the "LGPL") + * http://www.gnu.org/licenses/lgpl.html + * + * - Mozilla Public License Version 1.1 or later (the "MPL") + * http://www.mozilla.org/MPL/MPL-1.1.html + * + * == END LICENSE == + * + * Esperanto language file. + */ + +var FCKLang = +{ +// Language direction : "ltr" (left to right) or "rtl" (right to left). +Dir : "ltr", + +ToolbarCollapse : "Kaŝi Ilobreton", +ToolbarExpand : "Vidigi Ilojn", + +// Toolbar Items and Context Menu +Save : "Sekurigi", +NewPage : "Nova Paĝo", +Preview : "Vidigi Aspekton", +Cut : "Eltondi", +Copy : "Kopii", +Paste : "Interglui", +PasteText : "Interglui kiel Tekston", +PasteWord : "Interglui el Word", +Print : "Presi", +SelectAll : "Elekti ĉion", +RemoveFormat : "Forigi Formaton", +InsertLinkLbl : "Ligilo", +InsertLink : "Enmeti/Ŝanĝi Ligilon", +RemoveLink : "Forigi Ligilon", +Anchor : "Enmeti/Ŝanĝi Ankron", +AnchorDelete : "Remove Anchor", //MISSING +InsertImageLbl : "Bildo", +InsertImage : "Enmeti/Ŝanĝi Bildon", +InsertFlashLbl : "Flash", //MISSING +InsertFlash : "Insert/Edit Flash", //MISSING +InsertTableLbl : "Tabelo", +InsertTable : "Enmeti/Ŝanĝi Tabelon", +InsertLineLbl : "Horizonta Linio", +InsertLine : "Enmeti Horizonta Linio", +InsertSpecialCharLbl: "Speciala Signo", +InsertSpecialChar : "Enmeti Specialan Signon", +InsertSmileyLbl : "Mienvinjeto", +InsertSmiley : "Enmeti Mienvinjeton", +About : "Pri FCKeditor", +Bold : "Grasa", +Italic : "Kursiva", +Underline : "Substreko", +StrikeThrough : "Trastreko", +Subscript : "Subskribo", +Superscript : "Superskribo", +LeftJustify : "Maldekstrigi", +CenterJustify : "Centrigi", +RightJustify : "Dekstrigi", +BlockJustify : "Ĝisrandigi Ambaŭflanke", +DecreaseIndent : "Malpligrandigi Krommarĝenon", +IncreaseIndent : "Pligrandigi Krommarĝenon", +Blockquote : "Blockquote", //MISSING +Undo : "Malfari", +Redo : "Refari", +NumberedListLbl : "Numera Listo", +NumberedList : "Enmeti/Forigi Numeran Liston", +BulletedListLbl : "Bula Listo", +BulletedList : "Enmeti/Forigi Bulan Liston", +ShowTableBorders : "Vidigi Borderojn de Tabelo", +ShowDetails : "Vidigi Detalojn", +Style : "Stilo", +FontFormat : "Formato", +Font : "Tiparo", +FontSize : "Grando", +TextColor : "Teksta Koloro", +BGColor : "Fona Koloro", +Source : "Fonto", +Find : "Serĉi", +Replace : "Anstataŭigi", +SpellCheck : "Literumada Kontrolilo", +UniversalKeyboard : "Universala Klavaro", +PageBreakLbl : "Page Break", //MISSING +PageBreak : "Insert Page Break", //MISSING + +Form : "Formularo", +Checkbox : "Markobutono", +RadioButton : "Radiobutono", +TextField : "Teksta kampo", +Textarea : "Teksta Areo", +HiddenField : "Kaŝita Kampo", +Button : "Butono", +SelectionField : "Elekta Kampo", +ImageButton : "Bildbutono", + +FitWindow : "Maximize the editor size", //MISSING +ShowBlocks : "Show Blocks", //MISSING + +// Context Menu +EditLink : "Modifier Ligilon", +CellCM : "Cell", //MISSING +RowCM : "Row", //MISSING +ColumnCM : "Column", //MISSING +InsertRowAfter : "Insert Row After", //MISSING +InsertRowBefore : "Insert Row Before", //MISSING +DeleteRows : "Forigi Liniojn", +InsertColumnAfter : "Insert Column After", //MISSING +InsertColumnBefore : "Insert Column Before", //MISSING +DeleteColumns : "Forigi Kolumnojn", +InsertCellAfter : "Insert Cell After", //MISSING +InsertCellBefore : "Insert Cell Before", //MISSING +DeleteCells : "Forigi Ĉelojn", +MergeCells : "Kunfandi Ĉelojn", +MergeRight : "Merge Right", //MISSING +MergeDown : "Merge Down", //MISSING +HorizontalSplitCell : "Split Cell Horizontally", //MISSING +VerticalSplitCell : "Split Cell Vertically", //MISSING +TableDelete : "Delete Table", //MISSING +CellProperties : "Atributoj de Ĉelo", +TableProperties : "Atributoj de Tabelo", +ImageProperties : "Atributoj de Bildo", +FlashProperties : "Flash Properties", //MISSING + +AnchorProp : "Ankraj Atributoj", +ButtonProp : "Butonaj Atributoj", +CheckboxProp : "Markobutonaj Atributoj", +HiddenFieldProp : "Atributoj de Kaŝita Kampo", +RadioButtonProp : "Radiobutonaj Atributoj", +ImageButtonProp : "Bildbutonaj Atributoj", +TextFieldProp : "Atributoj de Teksta Kampo", +SelectionFieldProp : "Atributoj de Elekta Kampo", +TextareaProp : "Atributoj de Teksta Areo", +FormProp : "Formularaj Atributoj", + +FontFormats : "Normala;Formatita;Adreso;Titolo 1;Titolo 2;Titolo 3;Titolo 4;Titolo 5;Titolo 6;Paragrafo (DIV)", + +// Alerts and Messages +ProcessingXHTML : "Traktado de XHTML. Bonvolu pacienci...", +Done : "Finita", +PasteWordConfirm : "La algluota teksto ŝajnas esti Word-devena. Ĉu vi volas purigi ĝin antaŭ ol interglui?", +NotCompatiblePaste : "Tiu ĉi komando bezonas almenaŭ Internet Explorer 5.5. Ĉu vi volas daŭrigi sen purigado?", +UnknownToolbarItem : "Ilobretero nekonata \"%1\"", +UnknownCommand : "Komandonomo nekonata \"%1\"", +NotImplemented : "Komando ne ankoraŭ realigita", +UnknownToolbarSet : "La ilobreto \"%1\" ne ekzistas", +NoActiveX : "Your browser's security settings could limit some features of the editor. You must enable the option \"Run ActiveX controls and plug-ins\". You may experience errors and notice missing features.", //MISSING +BrowseServerBlocked : "The resources browser could not be opened. Make sure that all popup blockers are disabled.", //MISSING +DialogBlocked : "It was not possible to open the dialog window. Make sure all popup blockers are disabled.", //MISSING + +// Dialogs +DlgBtnOK : "Akcepti", +DlgBtnCancel : "Rezigni", +DlgBtnClose : "Fermi", +DlgBtnBrowseServer : "Foliumi en la Servilo", +DlgAdvancedTag : "Speciala", +DlgOpOther : "", +DlgInfoTab : "Info", //MISSING +DlgAlertUrl : "Please insert the URL", //MISSING + +// General Dialogs Labels +DlgGenNotSet : "", +DlgGenId : "Id", +DlgGenLangDir : "Skribdirekto", +DlgGenLangDirLtr : "De maldekstro dekstren (LTR)", +DlgGenLangDirRtl : "De dekstro maldekstren (RTL)", +DlgGenLangCode : "Lingva Kodo", +DlgGenAccessKey : "Fulmoklavo", +DlgGenName : "Nomo", +DlgGenTabIndex : "Taba Ordo", +DlgGenLongDescr : "URL de Longa Priskribo", +DlgGenClass : "Klasoj de Stilfolioj", +DlgGenTitle : "Indika Titolo", +DlgGenContType : "Indika Enhavotipo", +DlgGenLinkCharset : "Signaro de la Ligita Rimedo", +DlgGenStyle : "Stilo", + +// Image Dialog +DlgImgTitle : "Atributoj de Bildo", +DlgImgInfoTab : "Informoj pri Bildo", +DlgImgBtnUpload : "Sendu al Servilo", +DlgImgURL : "URL", +DlgImgUpload : "Alŝuti", +DlgImgAlt : "Anstataŭiga Teksto", +DlgImgWidth : "Larĝo", +DlgImgHeight : "Alto", +DlgImgLockRatio : "Konservi Proporcion", +DlgBtnResetSize : "Origina Grando", +DlgImgBorder : "Bordero", +DlgImgHSpace : "HSpaco", +DlgImgVSpace : "VSpaco", +DlgImgAlign : "Ĝisrandigo", +DlgImgAlignLeft : "Maldekstre", +DlgImgAlignAbsBottom: "Abs Malsupre", +DlgImgAlignAbsMiddle: "Abs Centre", +DlgImgAlignBaseline : "Je Malsupro de Teksto", +DlgImgAlignBottom : "Malsupre", +DlgImgAlignMiddle : "Centre", +DlgImgAlignRight : "Dekstre", +DlgImgAlignTextTop : "Je Supro de Teksto", +DlgImgAlignTop : "Supre", +DlgImgPreview : "Vidigi Aspekton", +DlgImgAlertUrl : "Bonvolu tajpi la URL de la bildo", +DlgImgLinkTab : "Link", //MISSING + +// Flash Dialog +DlgFlashTitle : "Flash Properties", //MISSING +DlgFlashChkPlay : "Auto Play", //MISSING +DlgFlashChkLoop : "Loop", //MISSING +DlgFlashChkMenu : "Enable Flash Menu", //MISSING +DlgFlashScale : "Scale", //MISSING +DlgFlashScaleAll : "Show all", //MISSING +DlgFlashScaleNoBorder : "No Border", //MISSING +DlgFlashScaleFit : "Exact Fit", //MISSING + +// Link Dialog +DlgLnkWindowTitle : "Ligilo", +DlgLnkInfoTab : "Informoj pri la Ligilo", +DlgLnkTargetTab : "Celo", + +DlgLnkType : "Tipo de Ligilo", +DlgLnkTypeURL : "URL", +DlgLnkTypeAnchor : "Ankri en tiu ĉi paĝo", +DlgLnkTypeEMail : "Retpoŝto", +DlgLnkProto : "Protokolo", +DlgLnkProtoOther : "", +DlgLnkURL : "URL", +DlgLnkAnchorSel : "Elekti Ankron", +DlgLnkAnchorByName : "Per Ankronomo", +DlgLnkAnchorById : "Per Elementidentigilo", +DlgLnkNoAnchors : "", +DlgLnkEMail : "Retadreso", +DlgLnkEMailSubject : "Temlinio", +DlgLnkEMailBody : "Mesaĝa korpo", +DlgLnkUpload : "Alŝuti", +DlgLnkBtnUpload : "Sendi al Servilo", + +DlgLnkTarget : "Celo", +DlgLnkTargetFrame : "", +DlgLnkTargetPopup : "<ŝprucfenestro>", +DlgLnkTargetBlank : "Nova Fenestro (_blank)", +DlgLnkTargetParent : "Gepatra Fenestro (_parent)", +DlgLnkTargetSelf : "Sama Fenestro (_self)", +DlgLnkTargetTop : "Plej Supra Fenestro (_top)", +DlgLnkTargetFrameName : "Nomo de Kadro", +DlgLnkPopWinName : "Nomo de Ŝprucfenestro", +DlgLnkPopWinFeat : "Atributoj de la Ŝprucfenestro", +DlgLnkPopResize : "Grando Ŝanĝebla", +DlgLnkPopLocation : "Adresobreto", +DlgLnkPopMenu : "Menubreto", +DlgLnkPopScroll : "Rulumlisteloj", +DlgLnkPopStatus : "Statobreto", +DlgLnkPopToolbar : "Ilobreto", +DlgLnkPopFullScrn : "Tutekrane (IE)", +DlgLnkPopDependent : "Dependa (Netscape)", +DlgLnkPopWidth : "Larĝo", +DlgLnkPopHeight : "Alto", +DlgLnkPopLeft : "Pozicio de Maldekstro", +DlgLnkPopTop : "Pozicio de Supro", + +DlnLnkMsgNoUrl : "Bonvolu entajpi la URL-on", +DlnLnkMsgNoEMail : "Bonvolu entajpi la retadreson", +DlnLnkMsgNoAnchor : "Bonvolu elekti ankron", +DlnLnkMsgInvPopName : "The popup name must begin with an alphabetic character and must not contain spaces", //MISSING + +// Color Dialog +DlgColorTitle : "Elekti", +DlgColorBtnClear : "Forigi", +DlgColorHighlight : "Emfazi", +DlgColorSelected : "Elektita", + +// Smiley Dialog +DlgSmileyTitle : "Enmeti Mienvinjeton", + +// Special Character Dialog +DlgSpecialCharTitle : "Enmeti Specialan Signon", + +// Table Dialog +DlgTableTitle : "Atributoj de Tabelo", +DlgTableRows : "Linioj", +DlgTableColumns : "Kolumnoj", +DlgTableBorder : "Bordero", +DlgTableAlign : "Ĝisrandigo", +DlgTableAlignNotSet : "", +DlgTableAlignLeft : "Maldekstre", +DlgTableAlignCenter : "Centre", +DlgTableAlignRight : "Dekstre", +DlgTableWidth : "Larĝo", +DlgTableWidthPx : "Bitbilderoj", +DlgTableWidthPc : "elcentoj", +DlgTableHeight : "Alto", +DlgTableCellSpace : "Interspacigo de Ĉeloj", +DlgTableCellPad : "Ĉirkaŭenhava Plenigado", +DlgTableCaption : "Titolo", +DlgTableSummary : "Summary", //MISSING + +// Table Cell Dialog +DlgCellTitle : "Atributoj de Celo", +DlgCellWidth : "Larĝo", +DlgCellWidthPx : "bitbilderoj", +DlgCellWidthPc : "elcentoj", +DlgCellHeight : "Alto", +DlgCellWordWrap : "Linifaldo", +DlgCellWordWrapNotSet : "", +DlgCellWordWrapYes : "Jes", +DlgCellWordWrapNo : "Ne", +DlgCellHorAlign : "Horizonta Ĝisrandigo", +DlgCellHorAlignNotSet : "", +DlgCellHorAlignLeft : "Maldekstre", +DlgCellHorAlignCenter : "Centre", +DlgCellHorAlignRight: "Dekstre", +DlgCellVerAlign : "Vertikala Ĝisrandigo", +DlgCellVerAlignNotSet : "", +DlgCellVerAlignTop : "Supre", +DlgCellVerAlignMiddle : "Centre", +DlgCellVerAlignBottom : "Malsupre", +DlgCellVerAlignBaseline : "Je Malsupro de Teksto", +DlgCellRowSpan : "Linioj Kunfanditaj", +DlgCellCollSpan : "Kolumnoj Kunfanditaj", +DlgCellBackColor : "Fono", +DlgCellBorderColor : "Bordero", +DlgCellBtnSelect : "Elekti...", + +// Find and Replace Dialog +DlgFindAndReplaceTitle : "Find and Replace", //MISSING + +// Find Dialog +DlgFindTitle : "Serĉi", +DlgFindFindBtn : "Serĉi", +DlgFindNotFoundMsg : "La celteksto ne estas trovita.", + +// Replace Dialog +DlgReplaceTitle : "Anstataŭigi", +DlgReplaceFindLbl : "Serĉi:", +DlgReplaceReplaceLbl : "Anstataŭigi per:", +DlgReplaceCaseChk : "Kongruigi Usklecon", +DlgReplaceReplaceBtn : "Anstataŭigi", +DlgReplaceReplAllBtn : "Anstataŭigi Ĉiun", +DlgReplaceWordChk : "Tuta Vorto", + +// Paste Operations / Dialog +PasteErrorCut : "La sekurecagordo de via TTT-legilo ne permesas, ke la redaktilo faras eltondajn operaciojn. Bonvolu uzi la klavaron por tio (ctrl-X).", +PasteErrorCopy : "La sekurecagordo de via TTT-legilo ne permesas, ke la redaktilo faras kopiajn operaciojn. Bonvolu uzi la klavaron por tio (ctrl-C).", + +PasteAsText : "Interglui kiel Tekston", +PasteFromWord : "Interglui el Word", + +DlgPasteMsg2 : "Please paste inside the following box using the keyboard (Ctrl+V) and hit OK.", //MISSING +DlgPasteSec : "Because of your browser security settings, the editor is not able to access your clipboard data directly. You are required to paste it again in this window.", //MISSING +DlgPasteIgnoreFont : "Ignore Font Face definitions", //MISSING +DlgPasteRemoveStyles : "Remove Styles definitions", //MISSING +DlgPasteCleanBox : "Clean Up Box", //MISSING + +// Color Picker +ColorAutomatic : "Aŭtomata", +ColorMoreColors : "Pli da Koloroj...", + +// Document Properties +DocProps : "Dokumentaj Atributoj", + +// Anchor Dialog +DlgAnchorTitle : "Ankraj Atributoj", +DlgAnchorName : "Ankra Nomo", +DlgAnchorErrorName : "Bv tajpi la ankran nomon", + +// Speller Pages Dialog +DlgSpellNotInDic : "Ne trovita en la vortaro", +DlgSpellChangeTo : "Ŝanĝi al", +DlgSpellBtnIgnore : "Malatenti", +DlgSpellBtnIgnoreAll : "Malatenti Ĉiun", +DlgSpellBtnReplace : "Anstataŭigi", +DlgSpellBtnReplaceAll : "Anstataŭigi Ĉiun", +DlgSpellBtnUndo : "Malfari", +DlgSpellNoSuggestions : "- Neniu propono -", +DlgSpellProgress : "Literumkontrolado daŭras...", +DlgSpellNoMispell : "Literumkontrolado finita: neniu fuŝo trovita", +DlgSpellNoChanges : "Literumkontrolado finita: neniu vorto ŝanĝita", +DlgSpellOneChange : "Literumkontrolado finita: unu vorto ŝanĝita", +DlgSpellManyChanges : "Literumkontrolado finita: %1 vortoj ŝanĝitaj", + +IeSpellDownload : "Literumada Kontrolilo ne instalita. Ĉu vi volas elŝuti ĝin nun?", + +// Button Dialog +DlgButtonText : "Teksto (Valoro)", +DlgButtonType : "Tipo", +DlgButtonTypeBtn : "Button", //MISSING +DlgButtonTypeSbm : "Submit", //MISSING +DlgButtonTypeRst : "Reset", //MISSING + +// Checkbox and Radio Button Dialogs +DlgCheckboxName : "Nomo", +DlgCheckboxValue : "Valoro", +DlgCheckboxSelected : "Elektita", + +// Form Dialog +DlgFormName : "Nomo", +DlgFormAction : "Ago", +DlgFormMethod : "Metodo", + +// Select Field Dialog +DlgSelectName : "Nomo", +DlgSelectValue : "Valoro", +DlgSelectSize : "Grando", +DlgSelectLines : "Linioj", +DlgSelectChkMulti : "Permesi Plurajn Elektojn", +DlgSelectOpAvail : "Elektoj Disponeblaj", +DlgSelectOpText : "Teksto", +DlgSelectOpValue : "Valoro", +DlgSelectBtnAdd : "Aldoni", +DlgSelectBtnModify : "Modifi", +DlgSelectBtnUp : "Supren", +DlgSelectBtnDown : "Malsupren", +DlgSelectBtnSetValue : "Agordi kiel Elektitan Valoron", +DlgSelectBtnDelete : "Forigi", + +// Textarea Dialog +DlgTextareaName : "Nomo", +DlgTextareaCols : "Kolumnoj", +DlgTextareaRows : "Vicoj", + +// Text Field Dialog +DlgTextName : "Nomo", +DlgTextValue : "Valoro", +DlgTextCharWidth : "Signolarĝo", +DlgTextMaxChars : "Maksimuma Nombro da Signoj", +DlgTextType : "Tipo", +DlgTextTypeText : "Teksto", +DlgTextTypePass : "Pasvorto", + +// Hidden Field Dialog +DlgHiddenName : "Nomo", +DlgHiddenValue : "Valoro", + +// Bulleted List Dialog +BulletedListProp : "Atributoj de Bula Listo", +NumberedListProp : "Atributoj de Numera Listo", +DlgLstStart : "Start", //MISSING +DlgLstType : "Tipo", +DlgLstTypeCircle : "Cirklo", +DlgLstTypeDisc : "Disc", //MISSING +DlgLstTypeSquare : "Kvadrato", +DlgLstTypeNumbers : "Ciferoj (1, 2, 3)", +DlgLstTypeLCase : "Minusklaj Literoj (a, b, c)", +DlgLstTypeUCase : "Majusklaj Literoj (A, B, C)", +DlgLstTypeSRoman : "Malgrandaj Romanaj Ciferoj (i, ii, iii)", +DlgLstTypeLRoman : "Grandaj Romanaj Ciferoj (I, II, III)", + +// Document Properties Dialog +DlgDocGeneralTab : "Ĝeneralaĵoj", +DlgDocBackTab : "Fono", +DlgDocColorsTab : "Koloroj kaj Marĝenoj", +DlgDocMetaTab : "Metadatumoj", + +DlgDocPageTitle : "Paĝotitolo", +DlgDocLangDir : "Skribdirekto de la Lingvo", +DlgDocLangDirLTR : "De maldekstro dekstren (LTR)", +DlgDocLangDirRTL : "De dekstro maldekstren (LTR)", +DlgDocLangCode : "Lingvokodo", +DlgDocCharSet : "Signara Kodo", +DlgDocCharSetCE : "Central European", //MISSING +DlgDocCharSetCT : "Chinese Traditional (Big5)", //MISSING +DlgDocCharSetCR : "Cyrillic", //MISSING +DlgDocCharSetGR : "Greek", //MISSING +DlgDocCharSetJP : "Japanese", //MISSING +DlgDocCharSetKR : "Korean", //MISSING +DlgDocCharSetTR : "Turkish", //MISSING +DlgDocCharSetUN : "Unicode (UTF-8)", //MISSING +DlgDocCharSetWE : "Western European", //MISSING +DlgDocCharSetOther : "Alia Signara Kodo", + +DlgDocDocType : "Dokumenta Tipo", +DlgDocDocTypeOther : "Alia Dokumenta Tipo", +DlgDocIncXHTML : "Inkluzivi XHTML Deklaroj", +DlgDocBgColor : "Fona Koloro", +DlgDocBgImage : "URL de Fona Bildo", +DlgDocBgNoScroll : "Neruluma Fono", +DlgDocCText : "Teksto", +DlgDocCLink : "Ligilo", +DlgDocCVisited : "Vizitita Ligilo", +DlgDocCActive : "Aktiva Ligilo", +DlgDocMargins : "Paĝaj Marĝenoj", +DlgDocMaTop : "Supra", +DlgDocMaLeft : "Maldekstra", +DlgDocMaRight : "Dekstra", +DlgDocMaBottom : "Malsupra", +DlgDocMeIndex : "Ŝlosilvortoj de la Dokumento (apartigita de komoj)", +DlgDocMeDescr : "Dokumenta Priskribo", +DlgDocMeAuthor : "Verkinto", +DlgDocMeCopy : "Kopirajto", +DlgDocPreview : "Aspekto", + +// Templates Dialog +Templates : "Templates", //MISSING +DlgTemplatesTitle : "Content Templates", //MISSING +DlgTemplatesSelMsg : "Please select the template to open in the editor
    (the actual contents will be lost):", //MISSING +DlgTemplatesLoading : "Loading templates list. Please wait...", //MISSING +DlgTemplatesNoTpl : "(No templates defined)", //MISSING +DlgTemplatesReplace : "Replace actual contents", //MISSING + +// About Dialog +DlgAboutAboutTab : "Pri", +DlgAboutBrowserInfoTab : "Informoj pri TTT-legilo", +DlgAboutLicenseTab : "License", //MISSING +DlgAboutVersion : "versio", +DlgAboutInfo : "Por pli da informoj, vizitu" +}; diff --git a/FCKeditor/editor/lang/es.js b/FCKeditor/editor/lang/es.js new file mode 100644 index 0000000..bc162ec --- /dev/null +++ b/FCKeditor/editor/lang/es.js @@ -0,0 +1,516 @@ +/* + * FCKeditor - The text editor for Internet - http://www.fckeditor.net + * Copyright (C) 2003-2007 Frederico Caldeira Knabben + * + * == BEGIN LICENSE == + * + * Licensed under the terms of any of the following licenses at your + * choice: + * + * - GNU General Public License Version 2 or later (the "GPL") + * http://www.gnu.org/licenses/gpl.html + * + * - GNU Lesser General Public License Version 2.1 or later (the "LGPL") + * http://www.gnu.org/licenses/lgpl.html + * + * - Mozilla Public License Version 1.1 or later (the "MPL") + * http://www.mozilla.org/MPL/MPL-1.1.html + * + * == END LICENSE == + * + * Spanish language file. + */ + +var FCKLang = +{ +// Language direction : "ltr" (left to right) or "rtl" (right to left). +Dir : "ltr", + +ToolbarCollapse : "Contraer Barra", +ToolbarExpand : "Expandir Barra", + +// Toolbar Items and Context Menu +Save : "Guardar", +NewPage : "Nueva Página", +Preview : "Vista Previa", +Cut : "Cortar", +Copy : "Copiar", +Paste : "Pegar", +PasteText : "Pegar como texto plano", +PasteWord : "Pegar desde Word", +Print : "Imprimir", +SelectAll : "Seleccionar Todo", +RemoveFormat : "Eliminar Formato", +InsertLinkLbl : "Vínculo", +InsertLink : "Insertar/Editar Vínculo", +RemoveLink : "Eliminar Vínculo", +Anchor : "Referencia", +AnchorDelete : "Eliminar Referencia", +InsertImageLbl : "Imagen", +InsertImage : "Insertar/Editar Imagen", +InsertFlashLbl : "Flash", +InsertFlash : "Insertar/Editar Flash", +InsertTableLbl : "Tabla", +InsertTable : "Insertar/Editar Tabla", +InsertLineLbl : "Línea", +InsertLine : "Insertar Línea Horizontal", +InsertSpecialCharLbl: "Caracter Especial", +InsertSpecialChar : "Insertar Caracter Especial", +InsertSmileyLbl : "Emoticons", +InsertSmiley : "Insertar Emoticons", +About : "Acerca de FCKeditor", +Bold : "Negrita", +Italic : "Cursiva", +Underline : "Subrayado", +StrikeThrough : "Tachado", +Subscript : "Subíndice", +Superscript : "Superíndice", +LeftJustify : "Alinear a Izquierda", +CenterJustify : "Centrar", +RightJustify : "Alinear a Derecha", +BlockJustify : "Justificado", +DecreaseIndent : "Disminuir Sangría", +IncreaseIndent : "Aumentar Sangría", +Blockquote : "Cita", +Undo : "Deshacer", +Redo : "Rehacer", +NumberedListLbl : "Numeración", +NumberedList : "Insertar/Eliminar Numeración", +BulletedListLbl : "Viñetas", +BulletedList : "Insertar/Eliminar Viñetas", +ShowTableBorders : "Mostrar Bordes de Tablas", +ShowDetails : "Mostrar saltos de Párrafo", +Style : "Estilo", +FontFormat : "Formato", +Font : "Fuente", +FontSize : "Tamaño", +TextColor : "Color de Texto", +BGColor : "Color de Fondo", +Source : "Fuente HTML", +Find : "Buscar", +Replace : "Reemplazar", +SpellCheck : "Ortografía", +UniversalKeyboard : "Teclado Universal", +PageBreakLbl : "Salto de Página", +PageBreak : "Insertar Salto de Página", + +Form : "Formulario", +Checkbox : "Casilla de Verificación", +RadioButton : "Botones de Radio", +TextField : "Campo de Texto", +Textarea : "Area de Texto", +HiddenField : "Campo Oculto", +Button : "Botón", +SelectionField : "Campo de Selección", +ImageButton : "Botón Imagen", + +FitWindow : "Maximizar el tamaño del editor", +ShowBlocks : "Mostrar bloques", + +// Context Menu +EditLink : "Editar Vínculo", +CellCM : "Celda", +RowCM : "Fila", +ColumnCM : "Columna", +InsertRowAfter : "Insertar fila en la parte inferior", +InsertRowBefore : "Insertar fila en la parte superior", +DeleteRows : "Eliminar Filas", +InsertColumnAfter : "Insertar columna a la derecha", +InsertColumnBefore : "Insertar columna a la izquierda", +DeleteColumns : "Eliminar Columnas", +InsertCellAfter : "Insertar celda a la derecha", +InsertCellBefore : "Insertar celda a la izquierda", +DeleteCells : "Eliminar Celdas", +MergeCells : "Combinar Celdas", +MergeRight : "Combinar a la derecha", +MergeDown : "Combinar hacia abajo", +HorizontalSplitCell : "Dividir la celda horizontalmente", +VerticalSplitCell : "Dividir la celda verticalmente", +TableDelete : "Eliminar Tabla", +CellProperties : "Propiedades de Celda", +TableProperties : "Propiedades de Tabla", +ImageProperties : "Propiedades de Imagen", +FlashProperties : "Propiedades de Flash", + +AnchorProp : "Propiedades de Referencia", +ButtonProp : "Propiedades de Botón", +CheckboxProp : "Propiedades de Casilla", +HiddenFieldProp : "Propiedades de Campo Oculto", +RadioButtonProp : "Propiedades de Botón de Radio", +ImageButtonProp : "Propiedades de Botón de Imagen", +TextFieldProp : "Propiedades de Campo de Texto", +SelectionFieldProp : "Propiedades de Campo de Selección", +TextareaProp : "Propiedades de Area de Texto", +FormProp : "Propiedades de Formulario", + +FontFormats : "Normal;Con formato;Dirección;Encabezado 1;Encabezado 2;Encabezado 3;Encabezado 4;Encabezado 5;Encabezado 6;Normal (DIV)", + +// Alerts and Messages +ProcessingXHTML : "Procesando XHTML. Por favor, espere...", +Done : "Hecho", +PasteWordConfirm : "El texto que desea parece provenir de Word. Desea depurarlo antes de pegarlo?", +NotCompatiblePaste : "Este comando está disponible sólo para Internet Explorer version 5.5 or superior. Desea pegar sin depurar?", +UnknownToolbarItem : "Item de barra desconocido \"%1\"", +UnknownCommand : "Nombre de comando desconocido \"%1\"", +NotImplemented : "Comando no implementado", +UnknownToolbarSet : "Nombre de barra \"%1\" no definido", +NoActiveX : "La configuración de las opciones de seguridad de su navegador puede estar limitando algunas características del editor. Por favor active la opción \"Ejecutar controles y complementos de ActiveX \", de lo contrario puede experimentar errores o ausencia de funcionalidades.", +BrowseServerBlocked : "La ventana de visualización del servidor no pudo ser abierta. Verifique que su navegador no esté bloqueando las ventanas emergentes (pop up).", +DialogBlocked : "No se ha podido abrir la ventana de diálogo. Verifique que su navegador no esté bloqueando las ventanas emergentes (pop up).", + +// Dialogs +DlgBtnOK : "OK", +DlgBtnCancel : "Cancelar", +DlgBtnClose : "Cerrar", +DlgBtnBrowseServer : "Ver Servidor", +DlgAdvancedTag : "Avanzado", +DlgOpOther : "", +DlgInfoTab : "Información", +DlgAlertUrl : "Inserte el URL", + +// General Dialogs Labels +DlgGenNotSet : "", +DlgGenId : "Id", +DlgGenLangDir : "Orientación", +DlgGenLangDirLtr : "Izquierda a Derecha (LTR)", +DlgGenLangDirRtl : "Derecha a Izquierda (RTL)", +DlgGenLangCode : "Cód. de idioma", +DlgGenAccessKey : "Clave de Acceso", +DlgGenName : "Nombre", +DlgGenTabIndex : "Indice de tabulación", +DlgGenLongDescr : "Descripción larga URL", +DlgGenClass : "Clases de hojas de estilo", +DlgGenTitle : "Título", +DlgGenContType : "Tipo de Contenido", +DlgGenLinkCharset : "Fuente de caracteres vinculado", +DlgGenStyle : "Estilo", + +// Image Dialog +DlgImgTitle : "Propiedades de Imagen", +DlgImgInfoTab : "Información de Imagen", +DlgImgBtnUpload : "Enviar al Servidor", +DlgImgURL : "URL", +DlgImgUpload : "Cargar", +DlgImgAlt : "Texto Alternativo", +DlgImgWidth : "Anchura", +DlgImgHeight : "Altura", +DlgImgLockRatio : "Proporcional", +DlgBtnResetSize : "Tamaño Original", +DlgImgBorder : "Borde", +DlgImgHSpace : "Esp.Horiz", +DlgImgVSpace : "Esp.Vert", +DlgImgAlign : "Alineación", +DlgImgAlignLeft : "Izquierda", +DlgImgAlignAbsBottom: "Abs inferior", +DlgImgAlignAbsMiddle: "Abs centro", +DlgImgAlignBaseline : "Línea de base", +DlgImgAlignBottom : "Pie", +DlgImgAlignMiddle : "Centro", +DlgImgAlignRight : "Derecha", +DlgImgAlignTextTop : "Tope del texto", +DlgImgAlignTop : "Tope", +DlgImgPreview : "Vista Previa", +DlgImgAlertUrl : "Por favor escriba la URL de la imagen", +DlgImgLinkTab : "Vínculo", + +// Flash Dialog +DlgFlashTitle : "Propiedades de Flash", +DlgFlashChkPlay : "Autoejecución", +DlgFlashChkLoop : "Repetir", +DlgFlashChkMenu : "Activar Menú Flash", +DlgFlashScale : "Escala", +DlgFlashScaleAll : "Mostrar todo", +DlgFlashScaleNoBorder : "Sin Borde", +DlgFlashScaleFit : "Ajustado", + +// Link Dialog +DlgLnkWindowTitle : "Vínculo", +DlgLnkInfoTab : "Información de Vínculo", +DlgLnkTargetTab : "Destino", + +DlgLnkType : "Tipo de vínculo", +DlgLnkTypeURL : "URL", +DlgLnkTypeAnchor : "Referencia en esta página", +DlgLnkTypeEMail : "E-Mail", +DlgLnkProto : "Protocolo", +DlgLnkProtoOther : "", +DlgLnkURL : "URL", +DlgLnkAnchorSel : "Seleccionar una referencia", +DlgLnkAnchorByName : "Por Nombre de Referencia", +DlgLnkAnchorById : "Por ID de elemento", +DlgLnkNoAnchors : "(No hay referencias disponibles en el documento)", +DlgLnkEMail : "Dirección de E-Mail", +DlgLnkEMailSubject : "Título del Mensaje", +DlgLnkEMailBody : "Cuerpo del Mensaje", +DlgLnkUpload : "Cargar", +DlgLnkBtnUpload : "Enviar al Servidor", + +DlgLnkTarget : "Destino", +DlgLnkTargetFrame : "", +DlgLnkTargetPopup : "", +DlgLnkTargetBlank : "Nueva Ventana(_blank)", +DlgLnkTargetParent : "Ventana Padre (_parent)", +DlgLnkTargetSelf : "Misma Ventana (_self)", +DlgLnkTargetTop : "Ventana primaria (_top)", +DlgLnkTargetFrameName : "Nombre del Marco Destino", +DlgLnkPopWinName : "Nombre de Ventana Emergente", +DlgLnkPopWinFeat : "Características de Ventana Emergente", +DlgLnkPopResize : "Ajustable", +DlgLnkPopLocation : "Barra de ubicación", +DlgLnkPopMenu : "Barra de Menú", +DlgLnkPopScroll : "Barras de desplazamiento", +DlgLnkPopStatus : "Barra de Estado", +DlgLnkPopToolbar : "Barra de Herramientas", +DlgLnkPopFullScrn : "Pantalla Completa (IE)", +DlgLnkPopDependent : "Dependiente (Netscape)", +DlgLnkPopWidth : "Anchura", +DlgLnkPopHeight : "Altura", +DlgLnkPopLeft : "Posición Izquierda", +DlgLnkPopTop : "Posición Derecha", + +DlnLnkMsgNoUrl : "Por favor tipee el vínculo URL", +DlnLnkMsgNoEMail : "Por favor tipee la dirección de e-mail", +DlnLnkMsgNoAnchor : "Por favor seleccione una referencia", +DlnLnkMsgInvPopName : "El nombre debe empezar con un caracter alfanumérico y no debe contener espacios", + +// Color Dialog +DlgColorTitle : "Seleccionar Color", +DlgColorBtnClear : "Ninguno", +DlgColorHighlight : "Resaltado", +DlgColorSelected : "Seleccionado", + +// Smiley Dialog +DlgSmileyTitle : "Insertar un Emoticon", + +// Special Character Dialog +DlgSpecialCharTitle : "Seleccione un caracter especial", + +// Table Dialog +DlgTableTitle : "Propiedades de Tabla", +DlgTableRows : "Filas", +DlgTableColumns : "Columnas", +DlgTableBorder : "Tamaño de Borde", +DlgTableAlign : "Alineación", +DlgTableAlignNotSet : "", +DlgTableAlignLeft : "Izquierda", +DlgTableAlignCenter : "Centrado", +DlgTableAlignRight : "Derecha", +DlgTableWidth : "Anchura", +DlgTableWidthPx : "pixeles", +DlgTableWidthPc : "porcentaje", +DlgTableHeight : "Altura", +DlgTableCellSpace : "Esp. e/celdas", +DlgTableCellPad : "Esp. interior", +DlgTableCaption : "Título", +DlgTableSummary : "Síntesis", + +// Table Cell Dialog +DlgCellTitle : "Propiedades de Celda", +DlgCellWidth : "Anchura", +DlgCellWidthPx : "pixeles", +DlgCellWidthPc : "porcentaje", +DlgCellHeight : "Altura", +DlgCellWordWrap : "Cortar Línea", +DlgCellWordWrapNotSet : "", +DlgCellWordWrapYes : "Si", +DlgCellWordWrapNo : "No", +DlgCellHorAlign : "Alineación Horizontal", +DlgCellHorAlignNotSet : "", +DlgCellHorAlignLeft : "Izquierda", +DlgCellHorAlignCenter : "Centrado", +DlgCellHorAlignRight: "Derecha", +DlgCellVerAlign : "Alineación Vertical", +DlgCellVerAlignNotSet : "", +DlgCellVerAlignTop : "Tope", +DlgCellVerAlignMiddle : "Medio", +DlgCellVerAlignBottom : "ie", +DlgCellVerAlignBaseline : "Línea de Base", +DlgCellRowSpan : "Abarcar Filas", +DlgCellCollSpan : "Abarcar Columnas", +DlgCellBackColor : "Color de Fondo", +DlgCellBorderColor : "Color de Borde", +DlgCellBtnSelect : "Seleccione...", + +// Find and Replace Dialog +DlgFindAndReplaceTitle : "Buscar y Reemplazar", + +// Find Dialog +DlgFindTitle : "Buscar", +DlgFindFindBtn : "Buscar", +DlgFindNotFoundMsg : "El texto especificado no ha sido encontrado.", + +// Replace Dialog +DlgReplaceTitle : "Reemplazar", +DlgReplaceFindLbl : "Texto a buscar:", +DlgReplaceReplaceLbl : "Reemplazar con:", +DlgReplaceCaseChk : "Coincidir may/min", +DlgReplaceReplaceBtn : "Reemplazar", +DlgReplaceReplAllBtn : "Reemplazar Todo", +DlgReplaceWordChk : "Coincidir toda la palabra", + +// Paste Operations / Dialog +PasteErrorCut : "La configuración de seguridad de este navegador no permite la ejecución automática de operaciones de cortado. Por favor use el teclado (Ctrl+X).", +PasteErrorCopy : "La configuración de seguridad de este navegador no permite la ejecución automática de operaciones de copiado. Por favor use el teclado (Ctrl+C).", + +PasteAsText : "Pegar como Texto Plano", +PasteFromWord : "Pegar desde Word", + +DlgPasteMsg2 : "Por favor pegue dentro del cuadro utilizando el teclado (Ctrl+V); luego presione OK.", +DlgPasteSec : "Debido a la configuración de seguridad de su navegador, el editor no tiene acceso al portapapeles. Es necesario que lo pegue de nuevo en esta ventana.", +DlgPasteIgnoreFont : "Ignorar definiciones de fuentes", +DlgPasteRemoveStyles : "Remover definiciones de estilo", +DlgPasteCleanBox : "Borrar el contenido del cuadro", + +// Color Picker +ColorAutomatic : "Automático", +ColorMoreColors : "Más Colores...", + +// Document Properties +DocProps : "Propiedades del Documento", + +// Anchor Dialog +DlgAnchorTitle : "Propiedades de la Referencia", +DlgAnchorName : "Nombre de la Referencia", +DlgAnchorErrorName : "Por favor, complete el nombre de la Referencia", + +// Speller Pages Dialog +DlgSpellNotInDic : "No se encuentra en el Diccionario", +DlgSpellChangeTo : "Cambiar a", +DlgSpellBtnIgnore : "Ignorar", +DlgSpellBtnIgnoreAll : "Ignorar Todo", +DlgSpellBtnReplace : "Reemplazar", +DlgSpellBtnReplaceAll : "Reemplazar Todo", +DlgSpellBtnUndo : "Deshacer", +DlgSpellNoSuggestions : "- No hay sugerencias -", +DlgSpellProgress : "Control de Ortografía en progreso...", +DlgSpellNoMispell : "Control finalizado: no se encontraron errores", +DlgSpellNoChanges : "Control finalizado: no se ha cambiado ninguna palabra", +DlgSpellOneChange : "Control finalizado: se ha cambiado una palabra", +DlgSpellManyChanges : "Control finalizado: se ha cambiado %1 palabras", + +IeSpellDownload : "Módulo de Control de Ortografía no instalado. ¿Desea descargarlo ahora?", + +// Button Dialog +DlgButtonText : "Texto (Valor)", +DlgButtonType : "Tipo", +DlgButtonTypeBtn : "Boton", +DlgButtonTypeSbm : "Enviar", +DlgButtonTypeRst : "Reestablecer", + +// Checkbox and Radio Button Dialogs +DlgCheckboxName : "Nombre", +DlgCheckboxValue : "Valor", +DlgCheckboxSelected : "Seleccionado", + +// Form Dialog +DlgFormName : "Nombre", +DlgFormAction : "Acción", +DlgFormMethod : "Método", + +// Select Field Dialog +DlgSelectName : "Nombre", +DlgSelectValue : "Valor", +DlgSelectSize : "Tamaño", +DlgSelectLines : "Lineas", +DlgSelectChkMulti : "Permitir múltiple selección", +DlgSelectOpAvail : "Opciones disponibles", +DlgSelectOpText : "Texto", +DlgSelectOpValue : "Valor", +DlgSelectBtnAdd : "Agregar", +DlgSelectBtnModify : "Modificar", +DlgSelectBtnUp : "Subir", +DlgSelectBtnDown : "Bajar", +DlgSelectBtnSetValue : "Establecer como predeterminado", +DlgSelectBtnDelete : "Eliminar", + +// Textarea Dialog +DlgTextareaName : "Nombre", +DlgTextareaCols : "Columnas", +DlgTextareaRows : "Filas", + +// Text Field Dialog +DlgTextName : "Nombre", +DlgTextValue : "Valor", +DlgTextCharWidth : "Caracteres de ancho", +DlgTextMaxChars : "Máximo caracteres", +DlgTextType : "Tipo", +DlgTextTypeText : "Texto", +DlgTextTypePass : "Contraseña", + +// Hidden Field Dialog +DlgHiddenName : "Nombre", +DlgHiddenValue : "Valor", + +// Bulleted List Dialog +BulletedListProp : "Propiedades de Viñetas", +NumberedListProp : "Propiedades de Numeraciones", +DlgLstStart : "Inicio", +DlgLstType : "Tipo", +DlgLstTypeCircle : "Círculo", +DlgLstTypeDisc : "Disco", +DlgLstTypeSquare : "Cuadrado", +DlgLstTypeNumbers : "Números (1, 2, 3)", +DlgLstTypeLCase : "letras en minúsculas (a, b, c)", +DlgLstTypeUCase : "letras en mayúsculas (A, B, C)", +DlgLstTypeSRoman : "Números Romanos (i, ii, iii)", +DlgLstTypeLRoman : "Números Romanos (I, II, III)", + +// Document Properties Dialog +DlgDocGeneralTab : "General", +DlgDocBackTab : "Fondo", +DlgDocColorsTab : "Colores y Márgenes", +DlgDocMetaTab : "Meta Información", + +DlgDocPageTitle : "Título de Página", +DlgDocLangDir : "Orientación de idioma", +DlgDocLangDirLTR : "Izq. a Derecha (LTR)", +DlgDocLangDirRTL : "Der. a Izquierda (RTL)", +DlgDocLangCode : "Código de Idioma", +DlgDocCharSet : "Codif. de Conjunto de Caracteres", +DlgDocCharSetCE : "Centro Europeo", +DlgDocCharSetCT : "Chino Tradicional (Big5)", +DlgDocCharSetCR : "Cirílico", +DlgDocCharSetGR : "Griego", +DlgDocCharSetJP : "Japonés", +DlgDocCharSetKR : "Coreano", +DlgDocCharSetTR : "Turco", +DlgDocCharSetUN : "Unicode (UTF-8)", +DlgDocCharSetWE : "Europeo occidental", +DlgDocCharSetOther : "Otra Codificación", + +DlgDocDocType : "Encabezado de Tipo de Documento", +DlgDocDocTypeOther : "Otro Encabezado", +DlgDocIncXHTML : "Incluir Declaraciones XHTML", +DlgDocBgColor : "Color de Fondo", +DlgDocBgImage : "URL de Imagen de Fondo", +DlgDocBgNoScroll : "Fondo sin rolido", +DlgDocCText : "Texto", +DlgDocCLink : "Vínculo", +DlgDocCVisited : "Vínculo Visitado", +DlgDocCActive : "Vínculo Activo", +DlgDocMargins : "Márgenes de Página", +DlgDocMaTop : "Tope", +DlgDocMaLeft : "Izquierda", +DlgDocMaRight : "Derecha", +DlgDocMaBottom : "Pie", +DlgDocMeIndex : "Claves de indexación del Documento (separados por comas)", +DlgDocMeDescr : "Descripción del Documento", +DlgDocMeAuthor : "Autor", +DlgDocMeCopy : "Copyright", +DlgDocPreview : "Vista Previa", + +// Templates Dialog +Templates : "Plantillas", +DlgTemplatesTitle : "Contenido de Plantillas", +DlgTemplatesSelMsg : "Por favor selecciona la plantilla a abrir en el editor
    (el contenido actual se perderá):", +DlgTemplatesLoading : "Cargando lista de Plantillas. Por favor, aguarde...", +DlgTemplatesNoTpl : "(No hay plantillas definidas)", +DlgTemplatesReplace : "Reemplazar el contenido actual", + +// About Dialog +DlgAboutAboutTab : "Acerca de", +DlgAboutBrowserInfoTab : "Información de Navegador", +DlgAboutLicenseTab : "Licencia", +DlgAboutVersion : "versión", +DlgAboutInfo : "Para mayor información por favor dirigirse a" +}; diff --git a/FCKeditor/editor/lang/et.js b/FCKeditor/editor/lang/et.js new file mode 100644 index 0000000..384e114 --- /dev/null +++ b/FCKeditor/editor/lang/et.js @@ -0,0 +1,516 @@ +/* + * FCKeditor - The text editor for Internet - http://www.fckeditor.net + * Copyright (C) 2003-2007 Frederico Caldeira Knabben + * + * == BEGIN LICENSE == + * + * Licensed under the terms of any of the following licenses at your + * choice: + * + * - GNU General Public License Version 2 or later (the "GPL") + * http://www.gnu.org/licenses/gpl.html + * + * - GNU Lesser General Public License Version 2.1 or later (the "LGPL") + * http://www.gnu.org/licenses/lgpl.html + * + * - Mozilla Public License Version 1.1 or later (the "MPL") + * http://www.mozilla.org/MPL/MPL-1.1.html + * + * == END LICENSE == + * + * Estonian language file. + */ + +var FCKLang = +{ +// Language direction : "ltr" (left to right) or "rtl" (right to left). +Dir : "ltr", + +ToolbarCollapse : "Voldi tööriistariba", +ToolbarExpand : "Laienda tööriistariba", + +// Toolbar Items and Context Menu +Save : "Salvesta", +NewPage : "Uus leht", +Preview : "Eelvaade", +Cut : "Lõika", +Copy : "Kopeeri", +Paste : "Kleebi", +PasteText : "Kleebi tavalise tekstina", +PasteWord : "Kleebi Wordist", +Print : "Prindi", +SelectAll : "Vali kõik", +RemoveFormat : "Eemalda vorming", +InsertLinkLbl : "Link", +InsertLink : "Sisesta link / Muuda linki", +RemoveLink : "Eemalda link", +Anchor : "Sisesta ankur / Muuda ankrut", +AnchorDelete : "Eemalda ankur", +InsertImageLbl : "Pilt", +InsertImage : "Sisesta pilt / Muuda pilti", +InsertFlashLbl : "Flash", +InsertFlash : "Sisesta flash / Muuda flashi", +InsertTableLbl : "Tabel", +InsertTable : "Sisesta tabel / Muuda tabelit", +InsertLineLbl : "Joon", +InsertLine : "Sisesta horisontaaljoon", +InsertSpecialCharLbl: "Erimärgid", +InsertSpecialChar : "Sisesta erimärk", +InsertSmileyLbl : "Emotikon", +InsertSmiley : "Sisesta emotikon", +About : "FCKeditor teave", +Bold : "Paks", +Italic : "Kursiiv", +Underline : "Allajoonitud", +StrikeThrough : "Läbijoonitud", +Subscript : "Allindeks", +Superscript : "Ülaindeks", +LeftJustify : "Vasakjoondus", +CenterJustify : "Keskjoondus", +RightJustify : "Paremjoondus", +BlockJustify : "Rööpjoondus", +DecreaseIndent : "Vähenda taanet", +IncreaseIndent : "Suurenda taanet", +Blockquote : "Blokktsitaat", +Undo : "Võta tagasi", +Redo : "Korda toimingut", +NumberedListLbl : "Nummerdatud loetelu", +NumberedList : "Sisesta/Eemalda nummerdatud loetelu", +BulletedListLbl : "Punktiseeritud loetelu", +BulletedList : "Sisesta/Eemalda punktiseeritud loetelu", +ShowTableBorders : "Näita tabeli jooni", +ShowDetails : "Näita üksikasju", +Style : "Laad", +FontFormat : "Vorming", +Font : "Kiri", +FontSize : "Suurus", +TextColor : "Teksti värv", +BGColor : "Tausta värv", +Source : "Lähtekood", +Find : "Otsi", +Replace : "Asenda", +SpellCheck : "Kontrolli õigekirja", +UniversalKeyboard : "Universaalne klaviatuur", +PageBreakLbl : "Lehepiir", +PageBreak : "Sisesta lehevahetuskoht", + +Form : "Vorm", +Checkbox : "Märkeruut", +RadioButton : "Raadionupp", +TextField : "Tekstilahter", +Textarea : "Tekstiala", +HiddenField : "Varjatud lahter", +Button : "Nupp", +SelectionField : "Valiklahter", +ImageButton : "Piltnupp", + +FitWindow : "Maksimeeri redaktori mõõtmed", +ShowBlocks : "Näita blokke", + +// Context Menu +EditLink : "Muuda linki", +CellCM : "Lahter", +RowCM : "Rida", +ColumnCM : "Veerg", +InsertRowAfter : "Sisesta rida peale", +InsertRowBefore : "Sisesta rida enne", +DeleteRows : "Eemalda read", +InsertColumnAfter : "Sisesta veerg peale", +InsertColumnBefore : "Sisesta veerg enne", +DeleteColumns : "Eemalda veerud", +InsertCellAfter : "Sisesta lahter peale", +InsertCellBefore : "Sisesta lahter enne", +DeleteCells : "Eemalda lahtrid", +MergeCells : "Ühenda lahtrid", +MergeRight : "Ühenda paremale", +MergeDown : "Ühenda alla", +HorizontalSplitCell : "Poolita lahter horisontaalselt", +VerticalSplitCell : "Poolita lahter vertikaalselt", +TableDelete : "Kustuta tabel", +CellProperties : "Lahtri atribuudid", +TableProperties : "Tabeli atribuudid", +ImageProperties : "Pildi atribuudid", +FlashProperties : "Flash omadused", + +AnchorProp : "Ankru omadused", +ButtonProp : "Nupu omadused", +CheckboxProp : "Märkeruudu omadused", +HiddenFieldProp : "Varjatud lahtri omadused", +RadioButtonProp : "Raadionupu omadused", +ImageButtonProp : "Piltnupu omadused", +TextFieldProp : "Tekstilahtri omadused", +SelectionFieldProp : "Valiklahtri omadused", +TextareaProp : "Tekstiala omadused", +FormProp : "Vormi omadused", + +FontFormats : "Tavaline;Vormindatud;Aadress;Pealkiri 1;Pealkiri 2;Pealkiri 3;Pealkiri 4;Pealkiri 5;Pealkiri 6;Tavaline (DIV)", + +// Alerts and Messages +ProcessingXHTML : "Töötlen XHTML'i. Palun oota...", +Done : "Tehtud", +PasteWordConfirm : "Tekst, mida soovid lisada paistab pärinevat Word'ist. Kas soovid seda enne kleepimist puhastada?", +NotCompatiblePaste : "See käsk on saadaval ainult Internet Explorer versioon 5.5 või uuema puhul. Kas soovid kleepida ilma puhastamata?", +UnknownToolbarItem : "Tundmatu tööriistarea üksus \"%1\"", +UnknownCommand : "Tundmatu käsunimi \"%1\"", +NotImplemented : "Käsku ei täidetud", +UnknownToolbarSet : "Tööriistariba \"%1\" ei eksisteeri", +NoActiveX : "Sinu veebisirvija turvalisuse seaded võivad limiteerida mõningaid tekstirdaktori kasutusvõimalusi. Sa peaksid võimaldama valiku \"Run ActiveX controls and plug-ins\" oma veebisirvija seadetes. Muidu võid sa täheldada vigu tekstiredaktori töös ja märgata puuduvaid funktsioone.", +BrowseServerBlocked : "Ressursside sirvija avamine ebaõnnestus. Võimalda pop-up akende avanemine.", +DialogBlocked : "Ei olenud võimalik avada dialoogi akent. Võimalda pop-up akende avanemine.", + +// Dialogs +DlgBtnOK : "OK", +DlgBtnCancel : "Loobu", +DlgBtnClose : "Sulge", +DlgBtnBrowseServer : "Sirvi serverit", +DlgAdvancedTag : "Täpsemalt", +DlgOpOther : "", +DlgInfoTab : "Info", +DlgAlertUrl : "Palun sisesta URL", + +// General Dialogs Labels +DlgGenNotSet : "", +DlgGenId : "Id", +DlgGenLangDir : "Keele suund", +DlgGenLangDirLtr : "Vasakult paremale (LTR)", +DlgGenLangDirRtl : "Paremalt vasakule (RTL)", +DlgGenLangCode : "Keele kood", +DlgGenAccessKey : "Juurdepääsu võti", +DlgGenName : "Nimi", +DlgGenTabIndex : "Tab indeks", +DlgGenLongDescr : "Pikk kirjeldus URL", +DlgGenClass : "Stiilistiku klassid", +DlgGenTitle : "Juhendav tiitel", +DlgGenContType : "Juhendava sisu tüüp", +DlgGenLinkCharset : "Lingitud ressurssi märgistik", +DlgGenStyle : "Laad", + +// Image Dialog +DlgImgTitle : "Pildi atribuudid", +DlgImgInfoTab : "Pildi info", +DlgImgBtnUpload : "Saada serverissee", +DlgImgURL : "URL", +DlgImgUpload : "Lae üles", +DlgImgAlt : "Alternatiivne tekst", +DlgImgWidth : "Laius", +DlgImgHeight : "Kõrgus", +DlgImgLockRatio : "Lukusta kuvasuhe", +DlgBtnResetSize : "Lähtesta suurus", +DlgImgBorder : "Joon", +DlgImgHSpace : "H. vaheruum", +DlgImgVSpace : "V. vaheruum", +DlgImgAlign : "Joondus", +DlgImgAlignLeft : "Vasak", +DlgImgAlignAbsBottom: "Abs alla", +DlgImgAlignAbsMiddle: "Abs keskele", +DlgImgAlignBaseline : "Baasjoonele", +DlgImgAlignBottom : "Alla", +DlgImgAlignMiddle : "Keskele", +DlgImgAlignRight : "Paremale", +DlgImgAlignTextTop : "Tekstit üles", +DlgImgAlignTop : "Üles", +DlgImgPreview : "Eelvaade", +DlgImgAlertUrl : "Palun kirjuta pildi URL", +DlgImgLinkTab : "Link", + +// Flash Dialog +DlgFlashTitle : "Flash omadused", +DlgFlashChkPlay : "Automaatne start ", +DlgFlashChkLoop : "Korduv", +DlgFlashChkMenu : "Võimalda flash menüü", +DlgFlashScale : "Mastaap", +DlgFlashScaleAll : "Näita kõike", +DlgFlashScaleNoBorder : "Äärist ei ole", +DlgFlashScaleFit : "Täpne sobivus", + +// Link Dialog +DlgLnkWindowTitle : "Link", +DlgLnkInfoTab : "Lingi info", +DlgLnkTargetTab : "Sihtkoht", + +DlgLnkType : "Lingi tüüp", +DlgLnkTypeURL : "URL", +DlgLnkTypeAnchor : "Ankur sellel lehel", +DlgLnkTypeEMail : "E-post", +DlgLnkProto : "Protokoll", +DlgLnkProtoOther : "", +DlgLnkURL : "URL", +DlgLnkAnchorSel : "Vali ankur", +DlgLnkAnchorByName : "Ankru nime järgi", +DlgLnkAnchorById : "Elemendi id järgi", +DlgLnkNoAnchors : "(Selles dokumendis ei ole ankruid)", +DlgLnkEMail : "E-posti aadress", +DlgLnkEMailSubject : "Sõnumi teema", +DlgLnkEMailBody : "Sõnumi tekst", +DlgLnkUpload : "Lae üles", +DlgLnkBtnUpload : "Saada serverisse", + +DlgLnkTarget : "Sihtkoht", +DlgLnkTargetFrame : "", +DlgLnkTargetPopup : "", +DlgLnkTargetBlank : "Uus aken (_blank)", +DlgLnkTargetParent : "Esivanem aken (_parent)", +DlgLnkTargetSelf : "Sama aken (_self)", +DlgLnkTargetTop : "Pealmine aken (_top)", +DlgLnkTargetFrameName : "Sihtmärk raami nimi", +DlgLnkPopWinName : "Hüpikakna nimi", +DlgLnkPopWinFeat : "Hüpikakna omadused", +DlgLnkPopResize : "Suurendatav", +DlgLnkPopLocation : "Aadressiriba", +DlgLnkPopMenu : "Menüüriba", +DlgLnkPopScroll : "Kerimisribad", +DlgLnkPopStatus : "Olekuriba", +DlgLnkPopToolbar : "Tööriistariba", +DlgLnkPopFullScrn : "Täisekraan (IE)", +DlgLnkPopDependent : "Sõltuv (Netscape)", +DlgLnkPopWidth : "Laius", +DlgLnkPopHeight : "Kõrgus", +DlgLnkPopLeft : "Vasak asukoht", +DlgLnkPopTop : "Ülemine asukoht", + +DlnLnkMsgNoUrl : "Palun kirjuta lingi URL", +DlnLnkMsgNoEMail : "Palun kirjuta E-Posti aadress", +DlnLnkMsgNoAnchor : "Palun vali ankur", +DlnLnkMsgInvPopName : "Hüpikakna nimi peab algama alfabeetilise tähega ja ei tohi sisaldada tühikuid", + +// Color Dialog +DlgColorTitle : "Vali värv", +DlgColorBtnClear : "Tühjenda", +DlgColorHighlight : "Märgi", +DlgColorSelected : "Valitud", + +// Smiley Dialog +DlgSmileyTitle : "Sisesta emotikon", + +// Special Character Dialog +DlgSpecialCharTitle : "Vali erimärk", + +// Table Dialog +DlgTableTitle : "Tabeli atribuudid", +DlgTableRows : "Read", +DlgTableColumns : "Veerud", +DlgTableBorder : "Joone suurus", +DlgTableAlign : "Joondus", +DlgTableAlignNotSet : "", +DlgTableAlignLeft : "Vasak", +DlgTableAlignCenter : "Kesk", +DlgTableAlignRight : "Parem", +DlgTableWidth : "Laius", +DlgTableWidthPx : "pikslit", +DlgTableWidthPc : "protsenti", +DlgTableHeight : "Kõrgus", +DlgTableCellSpace : "Lahtri vahe", +DlgTableCellPad : "Lahtri täidis", +DlgTableCaption : "Tabeli tiitel", +DlgTableSummary : "Kokkuvõte", + +// Table Cell Dialog +DlgCellTitle : "Lahtri atribuudid", +DlgCellWidth : "Laius", +DlgCellWidthPx : "pikslit", +DlgCellWidthPc : "protsenti", +DlgCellHeight : "Kõrgus", +DlgCellWordWrap : "Sõna ülekanne", +DlgCellWordWrapNotSet : "", +DlgCellWordWrapYes : "Jah", +DlgCellWordWrapNo : "Ei", +DlgCellHorAlign : "Horisontaaljoondus", +DlgCellHorAlignNotSet : "", +DlgCellHorAlignLeft : "Vasak", +DlgCellHorAlignCenter : "Kesk", +DlgCellHorAlignRight: "Parem", +DlgCellVerAlign : "Vertikaaljoondus", +DlgCellVerAlignNotSet : "", +DlgCellVerAlignTop : "Üles", +DlgCellVerAlignMiddle : "Keskele", +DlgCellVerAlignBottom : "Alla", +DlgCellVerAlignBaseline : "Baasjoonele", +DlgCellRowSpan : "Reaulatus", +DlgCellCollSpan : "Veeruulatus", +DlgCellBackColor : "Tausta värv", +DlgCellBorderColor : "Joone värv", +DlgCellBtnSelect : "Vali...", + +// Find and Replace Dialog +DlgFindAndReplaceTitle : "Otsi ja asenda", + +// Find Dialog +DlgFindTitle : "Otsi", +DlgFindFindBtn : "Otsi", +DlgFindNotFoundMsg : "Valitud teksti ei leitud.", + +// Replace Dialog +DlgReplaceTitle : "Asenda", +DlgReplaceFindLbl : "Leia mida:", +DlgReplaceReplaceLbl : "Asenda millega:", +DlgReplaceCaseChk : "Erista suur- ja väiketähti", +DlgReplaceReplaceBtn : "Asenda", +DlgReplaceReplAllBtn : "Asenda kõik", +DlgReplaceWordChk : "Otsi terviklike sõnu", + +// Paste Operations / Dialog +PasteErrorCut : "Sinu veebisirvija turvaseaded ei luba redaktoril automaatselt lõigata. Palun kasutage selleks klaviatuuri klahvikombinatsiooni (Ctrl+X).", +PasteErrorCopy : "Sinu veebisirvija turvaseaded ei luba redaktoril automaatselt kopeerida. Palun kasutage selleks klaviatuuri klahvikombinatsiooni (Ctrl+C).", + +PasteAsText : "Kleebi tavalise tekstina", +PasteFromWord : "Kleebi Wordist", + +DlgPasteMsg2 : "Palun kleebi järgnevasse kasti kasutades klaviatuuri klahvikombinatsiooni (Ctrl+V) ja vajuta seejärel OK.", +DlgPasteSec : "Sinu veebisirvija turvaseadete tõttu, ei oma redaktor otsest ligipääsu lõikelaua andmetele. Sa pead kleepima need uuesti siia aknasse.", +DlgPasteIgnoreFont : "Ignoreeri kirja definitsioone", +DlgPasteRemoveStyles : "Eemalda stiilide definitsioonid", +DlgPasteCleanBox : "Puhasta kast", + +// Color Picker +ColorAutomatic : "Automaatne", +ColorMoreColors : "Rohkem värve...", + +// Document Properties +DocProps : "Dokumendi omadused", + +// Anchor Dialog +DlgAnchorTitle : "Ankru omadused", +DlgAnchorName : "Ankru nimi", +DlgAnchorErrorName : "Palun sisest ankru nimi", + +// Speller Pages Dialog +DlgSpellNotInDic : "Puudub sõnastikust", +DlgSpellChangeTo : "Muuda", +DlgSpellBtnIgnore : "Ignoreeri", +DlgSpellBtnIgnoreAll : "Ignoreeri kõiki", +DlgSpellBtnReplace : "Asenda", +DlgSpellBtnReplaceAll : "Asenda kõik", +DlgSpellBtnUndo : "Võta tagasi", +DlgSpellNoSuggestions : "- Soovitused puuduvad -", +DlgSpellProgress : "Toimub õigekirja kontroll...", +DlgSpellNoMispell : "Õigekirja kontroll sooritatud: õigekirjuvigu ei leitud", +DlgSpellNoChanges : "Õigekirja kontroll sooritatud: ühtegi sõna ei muudetud", +DlgSpellOneChange : "Õigekirja kontroll sooritatud: üks sõna muudeti", +DlgSpellManyChanges : "Õigekirja kontroll sooritatud: %1 sõna muudetud", + +IeSpellDownload : "Õigekirja kontrollija ei ole installeeritud. Soovid sa selle alla laadida?", + +// Button Dialog +DlgButtonText : "Tekst (väärtus)", +DlgButtonType : "Tüüp", +DlgButtonTypeBtn : "Nupp", +DlgButtonTypeSbm : "Saada", +DlgButtonTypeRst : "Lähtesta", + +// Checkbox and Radio Button Dialogs +DlgCheckboxName : "Nimi", +DlgCheckboxValue : "Väärtus", +DlgCheckboxSelected : "Valitud", + +// Form Dialog +DlgFormName : "Nimi", +DlgFormAction : "Toiming", +DlgFormMethod : "Meetod", + +// Select Field Dialog +DlgSelectName : "Nimi", +DlgSelectValue : "Väärtus", +DlgSelectSize : "Suurus", +DlgSelectLines : "ridu", +DlgSelectChkMulti : "Võimalda mitu valikut", +DlgSelectOpAvail : "Võimalikud valikud", +DlgSelectOpText : "Tekst", +DlgSelectOpValue : "Väärtus", +DlgSelectBtnAdd : "Lisa", +DlgSelectBtnModify : "Muuda", +DlgSelectBtnUp : "Üles", +DlgSelectBtnDown : "Alla", +DlgSelectBtnSetValue : "Sea valitud olekuna", +DlgSelectBtnDelete : "Kustuta", + +// Textarea Dialog +DlgTextareaName : "Nimi", +DlgTextareaCols : "Veerge", +DlgTextareaRows : "Ridu", + +// Text Field Dialog +DlgTextName : "Nimi", +DlgTextValue : "Väärtus", +DlgTextCharWidth : "Laius (tähemärkides)", +DlgTextMaxChars : "Maksimaalselt tähemärke", +DlgTextType : "Tüüp", +DlgTextTypeText : "Tekst", +DlgTextTypePass : "Parool", + +// Hidden Field Dialog +DlgHiddenName : "Nimi", +DlgHiddenValue : "Väärtus", + +// Bulleted List Dialog +BulletedListProp : "Täpitud loetelu omadused", +NumberedListProp : "Nummerdatud loetelu omadused", +DlgLstStart : "Alusta", +DlgLstType : "Tüüp", +DlgLstTypeCircle : "Ring", +DlgLstTypeDisc : "Ketas", +DlgLstTypeSquare : "Ruut", +DlgLstTypeNumbers : "Numbrid (1, 2, 3)", +DlgLstTypeLCase : "Väiketähed (a, b, c)", +DlgLstTypeUCase : "Suurtähed (A, B, C)", +DlgLstTypeSRoman : "Väiksed Rooma numbrid (i, ii, iii)", +DlgLstTypeLRoman : "Suured Rooma numbrid (I, II, III)", + +// Document Properties Dialog +DlgDocGeneralTab : "Üldine", +DlgDocBackTab : "Taust", +DlgDocColorsTab : "Värvid ja veerised", +DlgDocMetaTab : "Meta andmed", + +DlgDocPageTitle : "Lehekülje tiitel", +DlgDocLangDir : "Kirja suund", +DlgDocLangDirLTR : "Vasakult paremale (LTR)", +DlgDocLangDirRTL : "Paremalt vasakule (RTL)", +DlgDocLangCode : "Keele kood", +DlgDocCharSet : "Märgistiku kodeering", +DlgDocCharSetCE : "Kesk-Euroopa", +DlgDocCharSetCT : "Hiina traditsiooniline (Big5)", +DlgDocCharSetCR : "Kirillisa", +DlgDocCharSetGR : "Kreeka", +DlgDocCharSetJP : "Jaapani", +DlgDocCharSetKR : "Korea", +DlgDocCharSetTR : "Türgi", +DlgDocCharSetUN : "Unicode (UTF-8)", +DlgDocCharSetWE : "Lääne-Euroopa", +DlgDocCharSetOther : "Ülejäänud märgistike kodeeringud", + +DlgDocDocType : "Dokumendi tüüppäis", +DlgDocDocTypeOther : "Teised dokumendi tüüppäised", +DlgDocIncXHTML : "Arva kaasa XHTML deklaratsioonid", +DlgDocBgColor : "Taustavärv", +DlgDocBgImage : "Taustapildi URL", +DlgDocBgNoScroll : "Mittekeritav tagataust", +DlgDocCText : "Tekst", +DlgDocCLink : "Link", +DlgDocCVisited : "Külastatud link", +DlgDocCActive : "Aktiivne link", +DlgDocMargins : "Lehekülje äärised", +DlgDocMaTop : "Ülaserv", +DlgDocMaLeft : "Vasakserv", +DlgDocMaRight : "Paremserv", +DlgDocMaBottom : "Alaserv", +DlgDocMeIndex : "Dokumendi võtmesõnad (eraldatud komadega)", +DlgDocMeDescr : "Dokumendi kirjeldus", +DlgDocMeAuthor : "Autor", +DlgDocMeCopy : "Autoriõigus", +DlgDocPreview : "Eelvaade", + +// Templates Dialog +Templates : "Šabloon", +DlgTemplatesTitle : "Sisu šabloonid", +DlgTemplatesSelMsg : "Palun vali šabloon, et avada see redaktoris
    (praegune sisu läheb kaotsi):", +DlgTemplatesLoading : "Laen šabloonide nimekirja. Palun oota...", +DlgTemplatesNoTpl : "(Ühtegi šablooni ei ole defineeritud)", +DlgTemplatesReplace : "Asenda tegelik sisu", + +// About Dialog +DlgAboutAboutTab : "Teave", +DlgAboutBrowserInfoTab : "Veebisirvija info", +DlgAboutLicenseTab : "Litsents", +DlgAboutVersion : "versioon", +DlgAboutInfo : "Täpsema info saamiseks mine" +}; diff --git a/FCKeditor/editor/lang/eu.js b/FCKeditor/editor/lang/eu.js new file mode 100644 index 0000000..d2d13f3 --- /dev/null +++ b/FCKeditor/editor/lang/eu.js @@ -0,0 +1,517 @@ +/* + * FCKeditor - The text editor for Internet - http://www.fckeditor.net + * Copyright (C) 2003-2007 Frederico Caldeira Knabben + * + * == BEGIN LICENSE == + * + * Licensed under the terms of any of the following licenses at your + * choice: + * + * - GNU General Public License Version 2 or later (the "GPL") + * http://www.gnu.org/licenses/gpl.html + * + * - GNU Lesser General Public License Version 2.1 or later (the "LGPL") + * http://www.gnu.org/licenses/lgpl.html + * + * - Mozilla Public License Version 1.1 or later (the "MPL") + * http://www.mozilla.org/MPL/MPL-1.1.html + * + * == END LICENSE == + * + * Basque language file. + * Euskara hizkuntza fitxategia. + */ + +var FCKLang = +{ +// Language direction : "ltr" (left to right) or "rtl" (right to left). +Dir : "ltr", + +ToolbarCollapse : "Estutu Tresna Barra", +ToolbarExpand : "Hedatu Tresna Barra", + +// Toolbar Items and Context Menu +Save : "Gorde", +NewPage : "Orrialde Berria", +Preview : "Aurrebista", +Cut : "Ebaki", +Copy : "Kopiatu", +Paste : "Itsatsi", +PasteText : "Itsatsi testu bezala", +PasteWord : "Itsatsi Word-etik", +Print : "Inprimatu", +SelectAll : "Hautatu dena", +RemoveFormat : "Kendu Formatoa", +InsertLinkLbl : "Esteka", +InsertLink : "Txertatu/Editatu Esteka", +RemoveLink : "Kendu Esteka", +Anchor : "Aingura", +AnchorDelete : "Remove Anchor", //MISSING +InsertImageLbl : "Irudia", +InsertImage : "Txertatu/Editatu Irudia", +InsertFlashLbl : "Flasha", +InsertFlash : "Txertatu/Editatu Flasha", +InsertTableLbl : "Taula", +InsertTable : "Txertatu/Editatu Taula", +InsertLineLbl : "Lerroa", +InsertLine : "Txertatu Marra Horizontala", +InsertSpecialCharLbl: "Karaktere Berezia", +InsertSpecialChar : "Txertatu Karaktere Berezia", +InsertSmileyLbl : "Aurpegierak", +InsertSmiley : "Txertatu Aurpegierak", +About : "FCKeditor-ri buruz", +Bold : "Lodia", +Italic : "Etzana", +Underline : "Azpimarratu", +StrikeThrough : "Marratua", +Subscript : "Azpi-indize", +Superscript : "Goi-indize", +LeftJustify : "Lerrokatu Ezkerrean", +CenterJustify : "Lerrokatu Erdian", +RightJustify : "Lerrokatu Eskuman", +BlockJustify : "Justifikatu", +DecreaseIndent : "Txikitu Koska", +IncreaseIndent : "Handitu Koska", +Blockquote : "Blockquote", //MISSING +Undo : "Desegin", +Redo : "Berregin", +NumberedListLbl : "Zenbakidun Zerrenda", +NumberedList : "Txertatu/Kendu Zenbakidun zerrenda", +BulletedListLbl : "Buletdun Zerrenda", +BulletedList : "Txertatu/Kendu Buletdun zerrenda", +ShowTableBorders : "Erakutsi Taularen Ertzak", +ShowDetails : "Erakutsi Xehetasunak", +Style : "Estiloa", +FontFormat : "Formatoa", +Font : "Letra-tipoa", +FontSize : "Tamaina", +TextColor : "Testu Kolorea", +BGColor : "Atzeko kolorea", +Source : "HTML Iturburua", +Find : "Bilatu", +Replace : "Ordezkatu", +SpellCheck : "Ortografia", +UniversalKeyboard : "Teklatu Unibertsala", +PageBreakLbl : "Orrialde-jauzia", +PageBreak : "Txertatu Orrialde-jauzia", + +Form : "Formularioa", +Checkbox : "Kontrol-laukia", +RadioButton : "Aukera-botoia", +TextField : "Testu Eremua", +Textarea : "Testu-area", +HiddenField : "Ezkutuko Eremua", +Button : "Botoia", +SelectionField : "Hautespen Eremua", +ImageButton : "Irudi Botoia", + +FitWindow : "Maximizatu editorearen tamaina", +ShowBlocks : "Show Blocks", //MISSING + +// Context Menu +EditLink : "Aldatu Esteka", +CellCM : "Gelaxka", +RowCM : "Errenkada", +ColumnCM : "Zutabea", +InsertRowAfter : "Insert Row After", //MISSING +InsertRowBefore : "Insert Row Before", //MISSING +DeleteRows : "Ezabatu Errenkadak", +InsertColumnAfter : "Insert Column After", //MISSING +InsertColumnBefore : "Insert Column Before", //MISSING +DeleteColumns : "Ezabatu Zutabeak", +InsertCellAfter : "Insert Cell After", //MISSING +InsertCellBefore : "Insert Cell Before", //MISSING +DeleteCells : "Kendu Gelaxkak", +MergeCells : "Batu Gelaxkak", +MergeRight : "Merge Right", //MISSING +MergeDown : "Merge Down", //MISSING +HorizontalSplitCell : "Split Cell Horizontally", //MISSING +VerticalSplitCell : "Split Cell Vertically", //MISSING +TableDelete : "Ezabatu Taula", +CellProperties : "Gelaxkaren Ezaugarriak", +TableProperties : "Taularen Ezaugarriak", +ImageProperties : "Irudiaren Ezaugarriak", +FlashProperties : "Flasharen Ezaugarriak", + +AnchorProp : "Ainguraren Ezaugarriak", +ButtonProp : "Botoiaren Ezaugarriak", +CheckboxProp : "Kontrol-laukiko Ezaugarriak", +HiddenFieldProp : "Ezkutuko Eremuaren Ezaugarriak", +RadioButtonProp : "Aukera-botoiaren Ezaugarriak", +ImageButtonProp : "Irudi Botoiaren Ezaugarriak", +TextFieldProp : "Testu Eremuaren Ezaugarriak", +SelectionFieldProp : "Hautespen Eremuaren Ezaugarriak", +TextareaProp : "Testu-arearen Ezaugarriak", +FormProp : "Formularioaren Ezaugarriak", + +FontFormats : "Arrunta;Formateatua;Helbidea;Izenburua 1;Izenburua 2;Izenburua 3;Izenburua 4;Izenburua 5;Izenburua 6;Paragrafoa (DIV)", + +// Alerts and Messages +ProcessingXHTML : "XHTML Prozesatzen. Itxaron mesedez...", +Done : "Eginda", +PasteWordConfirm : "Itsatsi nahi duzun textua Wordetik hartua dela dirudi. Itsatsi baino lehen garbitu nahi duzu?", +NotCompatiblePaste : "Komando hau Internet Explorer 5.5 bertsiorako edo ondorengoentzako erabilgarria dago. Garbitu gabe itsatsi nahi duzu?", +UnknownToolbarItem : "Ataza barrako elementu ezezaguna \"%1\"", +UnknownCommand : "Komando izen ezezaguna \"%1\"", +NotImplemented : "Komando ez inplementatua", +UnknownToolbarSet : "Ataza barra \"%1\" taldea ez da existitzen", +NoActiveX : "Zure nabigatzailearen segustasun hobespenak editore honen zenbait ezaugarri mugatu ditzake. \"ActiveX kontrolak eta plug-inak\" aktibatu beharko zenituzke, bestela erroreak eta ezaugarrietan mugak egon daitezke.", +BrowseServerBlocked : "Baliabideen arakatzailea ezin da ireki. Ziurtatu popup blokeatzaileak desgaituta dituzula.", +DialogBlocked : "Ezin da elkarrizketa-leihoa ireki. Ziurtatu popup blokeatzaileak desgaituta dituzula.", + +// Dialogs +DlgBtnOK : "Ados", +DlgBtnCancel : "Utzi", +DlgBtnClose : "Itxi", +DlgBtnBrowseServer : "Zerbitzaria arakatu", +DlgAdvancedTag : "Aurreratua", +DlgOpOther : "", +DlgInfoTab : "Informazioa", +DlgAlertUrl : "Mesedez URLa idatzi ezazu", + +// General Dialogs Labels +DlgGenNotSet : "", +DlgGenId : "Id", +DlgGenLangDir : "Hizkuntzaren Norabidea", +DlgGenLangDirLtr : "Ezkerretik Eskumara(LTR)", +DlgGenLangDirRtl : "Eskumatik Ezkerrera (RTL)", +DlgGenLangCode : "Hizkuntza Kodea", +DlgGenAccessKey : "Sarbide-gakoa", +DlgGenName : "Izena", +DlgGenTabIndex : "Tabulazio Indizea", +DlgGenLongDescr : "URL Deskribapen Luzea", +DlgGenClass : "Estilo-orriko Klaseak", +DlgGenTitle : "Izenburua", +DlgGenContType : "Eduki Mota (Content Type)", +DlgGenLinkCharset : "Estekatutako Karaktere Multzoa", +DlgGenStyle : "Estiloa", + +// Image Dialog +DlgImgTitle : "Irudi Ezaugarriak", +DlgImgInfoTab : "Irudi informazioa", +DlgImgBtnUpload : "Zerbitzarira bidalia", +DlgImgURL : "URL", +DlgImgUpload : "Gora Kargatu", +DlgImgAlt : "Textu Alternatiboa", +DlgImgWidth : "Zabalera", +DlgImgHeight : "Altuera", +DlgImgLockRatio : "Erlazioa Blokeatu", +DlgBtnResetSize : "Tamaina Berrezarri", +DlgImgBorder : "Ertza", +DlgImgHSpace : "HSpace", +DlgImgVSpace : "VSpace", +DlgImgAlign : "Lerrokatu", +DlgImgAlignLeft : "Ezkerrera", +DlgImgAlignAbsBottom: "Abs Behean", +DlgImgAlignAbsMiddle: "Abs Erdian", +DlgImgAlignBaseline : "Oinan", +DlgImgAlignBottom : "Behean", +DlgImgAlignMiddle : "Erdian", +DlgImgAlignRight : "Eskuman", +DlgImgAlignTextTop : "Testua Goian", +DlgImgAlignTop : "Goian", +DlgImgPreview : "Aurrebista", +DlgImgAlertUrl : "Mesedez Irudiaren URLa idatzi", +DlgImgLinkTab : "Esteka", + +// Flash Dialog +DlgFlashTitle : "Flasharen Ezaugarriak", +DlgFlashChkPlay : "Automatikoki Erreproduzitu", +DlgFlashChkLoop : "Begizta", +DlgFlashChkMenu : "Flasharen Menua Gaitu", +DlgFlashScale : "Eskalatu", +DlgFlashScaleAll : "Dena erakutsi", +DlgFlashScaleNoBorder : "Ertzarik gabe", +DlgFlashScaleFit : "Doitu", + +// Link Dialog +DlgLnkWindowTitle : "Esteka", +DlgLnkInfoTab : "Estekaren Informazioa", +DlgLnkTargetTab : "Helburua", + +DlgLnkType : "Esteka Mota", +DlgLnkTypeURL : "URL", +DlgLnkTypeAnchor : "Aingura horrialde honentan", +DlgLnkTypeEMail : "ePosta", +DlgLnkProto : "Protokoloa", +DlgLnkProtoOther : "", +DlgLnkURL : "URL", +DlgLnkAnchorSel : "Aingura bat hautatu", +DlgLnkAnchorByName : "Aingura izenagatik", +DlgLnkAnchorById : "Elementuaren ID-gatik", +DlgLnkNoAnchors : "(Ez daude aingurak eskuragarri dokumentuan)", +DlgLnkEMail : "ePosta Helbidea", +DlgLnkEMailSubject : "Mezuaren Gaia", +DlgLnkEMailBody : "Mezuaren Gorputza", +DlgLnkUpload : "Gora kargatu", +DlgLnkBtnUpload : "Zerbitzarira bidali", + +DlgLnkTarget : "Target (Helburua)", +DlgLnkTargetFrame : "", +DlgLnkTargetPopup : "", +DlgLnkTargetBlank : "Lehio Berria (_blank)", +DlgLnkTargetParent : "Lehio Gurasoa (_parent)", +DlgLnkTargetSelf : "Lehio Berdina (_self)", +DlgLnkTargetTop : "Goiko Lehioa (_top)", +DlgLnkTargetFrameName : "Marko Helburuaren Izena", +DlgLnkPopWinName : "Popup Lehioaren Izena", +DlgLnkPopWinFeat : "Popup Lehioaren Ezaugarriak", +DlgLnkPopResize : "Tamaina Aldakorra", +DlgLnkPopLocation : "Kokaleku Barra", +DlgLnkPopMenu : "Menu Barra", +DlgLnkPopScroll : "Korritze Barrak", +DlgLnkPopStatus : "Egoera Barra", +DlgLnkPopToolbar : "Tresna Barra", +DlgLnkPopFullScrn : "Pantaila Osoa (IE)", +DlgLnkPopDependent : "Menpekoa (Netscape)", +DlgLnkPopWidth : "Zabalera", +DlgLnkPopHeight : "Altuera", +DlgLnkPopLeft : "Ezkerreko Posizioa", +DlgLnkPopTop : "Goiko Posizioa", + +DlnLnkMsgNoUrl : "Mesedez URL esteka idatzi", +DlnLnkMsgNoEMail : "Mesedez ePosta helbidea idatzi", +DlnLnkMsgNoAnchor : "Mesedez aingura bat aukeratu", +DlnLnkMsgInvPopName : "The popup name must begin with an alphabetic character and must not contain spaces", //MISSING + +// Color Dialog +DlgColorTitle : "Kolore Aukeraketa", +DlgColorBtnClear : "Garbitu", +DlgColorHighlight : "Nabarmendu", +DlgColorSelected : "Aukeratuta", + +// Smiley Dialog +DlgSmileyTitle : "Aurpegiera Sartu", + +// Special Character Dialog +DlgSpecialCharTitle : "Karaktere Berezia Aukeratu", + +// Table Dialog +DlgTableTitle : "Taularen Ezaugarriak", +DlgTableRows : "Lerroak", +DlgTableColumns : "Zutabeak", +DlgTableBorder : "Ertzaren Zabalera", +DlgTableAlign : "Lerrokatu", +DlgTableAlignNotSet : "", +DlgTableAlignLeft : "Ezkerrean", +DlgTableAlignCenter : "Erdian", +DlgTableAlignRight : "Eskuman", +DlgTableWidth : "Zabalera", +DlgTableWidthPx : "pixel", +DlgTableWidthPc : "ehuneko", +DlgTableHeight : "Altuera", +DlgTableCellSpace : "Gelaxka arteko tartea", +DlgTableCellPad : "Gelaxken betegarria", +DlgTableCaption : "Epigrafea", +DlgTableSummary : "Laburpena", + +// Table Cell Dialog +DlgCellTitle : "Gelaxken Ezaugarriak", +DlgCellWidth : "Zabalera", +DlgCellWidthPx : "pixel", +DlgCellWidthPc : "ehuneko", +DlgCellHeight : "Altuera", +DlgCellWordWrap : "Itzulbira", +DlgCellWordWrapNotSet : "", +DlgCellWordWrapYes : "Bai", +DlgCellWordWrapNo : "Ez", +DlgCellHorAlign : "Horizontal Alignment", +DlgCellHorAlignNotSet : "", +DlgCellHorAlignLeft : "Ezkerrean", +DlgCellHorAlignCenter : "Erdian", +DlgCellHorAlignRight: "Eskuman", +DlgCellVerAlign : "Lerrokatu Bertikalki", +DlgCellVerAlignNotSet : "", +DlgCellVerAlignTop : "Goian", +DlgCellVerAlignMiddle : "Erdian", +DlgCellVerAlignBottom : "Behean", +DlgCellVerAlignBaseline : "Oinan", +DlgCellRowSpan : "Lerroak Hedatu", +DlgCellCollSpan : "Zutabeak Hedatu", +DlgCellBackColor : "Atzeko Kolorea", +DlgCellBorderColor : "Ertzako Kolorea", +DlgCellBtnSelect : "Aukertau...", + +// Find and Replace Dialog +DlgFindAndReplaceTitle : "Find and Replace", //MISSING + +// Find Dialog +DlgFindTitle : "Bilaketa", +DlgFindFindBtn : "Bilatu", +DlgFindNotFoundMsg : "Idatzitako testua ez da topatu.", + +// Replace Dialog +DlgReplaceTitle : "Ordeztu", +DlgReplaceFindLbl : "Zer bilatu:", +DlgReplaceReplaceLbl : "Zerekin ordeztu:", +DlgReplaceCaseChk : "Maiuskula/minuskula", +DlgReplaceReplaceBtn : "Ordeztu", +DlgReplaceReplAllBtn : "Ordeztu Guztiak", +DlgReplaceWordChk : "Esaldi osoa bilatu", + +// Paste Operations / Dialog +PasteErrorCut : "Zure web nabigatzailearen segurtasun ezarpenak testuak automatikoki moztea ez dute baimentzen. Mesedez teklatua erabili ezazu (Ctrl+X).", +PasteErrorCopy : "Zure web nabigatzailearen segurtasun ezarpenak testuak automatikoki kopiatzea ez dute baimentzen. Mesedez teklatua erabili ezazu (Ctrl+C).", + +PasteAsText : "Testu Arrunta bezala Itsatsi", +PasteFromWord : "Word-etik itsatsi", + +DlgPasteMsg2 : "Mesedez teklatua erabilita (Ctrl+V) ondorego eremuan testua itsatsi eta OK sakatu.", +DlgPasteSec : "Because of your browser security settings, the editor is not able to access your clipboard data directly. You are required to paste it again in this window.", //MISSING +DlgPasteIgnoreFont : "Letra Motaren definizioa ezikusi", +DlgPasteRemoveStyles : "Estilo definizioak kendu", +DlgPasteCleanBox : "Testu-eremua Garbitu", + +// Color Picker +ColorAutomatic : "Automatikoa", +ColorMoreColors : "Kolore gehiago...", + +// Document Properties +DocProps : "Dokumentuaren Ezarpenak", + +// Anchor Dialog +DlgAnchorTitle : "Ainguraren Ezaugarriak", +DlgAnchorName : "Ainguraren Izena", +DlgAnchorErrorName : "Idatzi ainguraren izena", + +// Speller Pages Dialog +DlgSpellNotInDic : "Ez dago hiztegian", +DlgSpellChangeTo : "Honekin ordezkatu", +DlgSpellBtnIgnore : "Ezikusi", +DlgSpellBtnIgnoreAll : "Denak Ezikusi", +DlgSpellBtnReplace : "Ordezkatu", +DlgSpellBtnReplaceAll : "Denak Ordezkatu", +DlgSpellBtnUndo : "Desegin", +DlgSpellNoSuggestions : "- Iradokizunik ez -", +DlgSpellProgress : "Zuzenketa ortografikoa martxan...", +DlgSpellNoMispell : "Zuzenketa ortografikoa bukatuta: Akatsik ez", +DlgSpellNoChanges : "Zuzenketa ortografikoa bukatuta: Ez da ezer aldatu", +DlgSpellOneChange : "Zuzenketa ortografikoa bukatuta: Hitz bat aldatu da", +DlgSpellManyChanges : "Zuzenketa ortografikoa bukatuta: %1 hitz aldatu dira", + +IeSpellDownload : "Zuzentzaile ortografikoa ez dago instalatuta. Deskargatu nahi duzu?", + +// Button Dialog +DlgButtonText : "Testua (Balorea)", +DlgButtonType : "Mota", +DlgButtonTypeBtn : "Button", //MISSING +DlgButtonTypeSbm : "Submit", //MISSING +DlgButtonTypeRst : "Reset", //MISSING + +// Checkbox and Radio Button Dialogs +DlgCheckboxName : "Izena", +DlgCheckboxValue : "Balorea", +DlgCheckboxSelected : "Hautatuta", + +// Form Dialog +DlgFormName : "Izena", +DlgFormAction : "Ekintza", +DlgFormMethod : "Method", + +// Select Field Dialog +DlgSelectName : "Izena", +DlgSelectValue : "Balorea", +DlgSelectSize : "Tamaina", +DlgSelectLines : "lerro kopurura", +DlgSelectChkMulti : "Hautaketa anitzak baimendu", +DlgSelectOpAvail : "Aukera Eskuragarriak", +DlgSelectOpText : "Testua", +DlgSelectOpValue : "Balorea", +DlgSelectBtnAdd : "Gehitu", +DlgSelectBtnModify : "Aldatu", +DlgSelectBtnUp : "Gora", +DlgSelectBtnDown : "Behera", +DlgSelectBtnSetValue : "Aukeratutako balorea ezarri", +DlgSelectBtnDelete : "Ezabatu", + +// Textarea Dialog +DlgTextareaName : "Izena", +DlgTextareaCols : "Zutabeak", +DlgTextareaRows : "Lerroak", + +// Text Field Dialog +DlgTextName : "Izena", +DlgTextValue : "Balorea", +DlgTextCharWidth : "Zabalera", +DlgTextMaxChars : "Zenbat karaktere gehienez", +DlgTextType : "Mota", +DlgTextTypeText : "Testua", +DlgTextTypePass : "Pasahitza", + +// Hidden Field Dialog +DlgHiddenName : "Izena", +DlgHiddenValue : "Balorea", + +// Bulleted List Dialog +BulletedListProp : "Buletdun Zerrendaren Ezarpenak", +NumberedListProp : "Zenbakidun Zerrendaren Ezarpenak", +DlgLstStart : "Start", //MISSING +DlgLstType : "Mota", +DlgLstTypeCircle : "Zirkulua", +DlgLstTypeDisc : "Diskoa", +DlgLstTypeSquare : "Karratua", +DlgLstTypeNumbers : "Zenbakiak (1, 2, 3)", +DlgLstTypeLCase : "Letra xeheak (a, b, c)", +DlgLstTypeUCase : "Letra larriak (A, B, C)", +DlgLstTypeSRoman : "Erromatar zenbaki zeheak (i, ii, iii)", +DlgLstTypeLRoman : "Erromatar zenbaki larriak (I, II, III)", + +// Document Properties Dialog +DlgDocGeneralTab : "Orokorra", +DlgDocBackTab : "Atzekaldea", +DlgDocColorsTab : "Koloreak eta Marjinak", +DlgDocMetaTab : "Meta Informazioa", + +DlgDocPageTitle : "Orriaren Izenburua", +DlgDocLangDir : "Hizkuntzaren Norabidea", +DlgDocLangDirLTR : "Ezkerretik eskumara (LTR)", +DlgDocLangDirRTL : "Eskumatik ezkerrera (RTL)", +DlgDocLangCode : "Hizkuntzaren Kodea", +DlgDocCharSet : "Karaktere Multzoaren Kodeketa", +DlgDocCharSetCE : "Central European", //MISSING +DlgDocCharSetCT : "Chinese Traditional (Big5)", //MISSING +DlgDocCharSetCR : "Cyrillic", //MISSING +DlgDocCharSetGR : "Greek", //MISSING +DlgDocCharSetJP : "Japanese", //MISSING +DlgDocCharSetKR : "Korean", //MISSING +DlgDocCharSetTR : "Turkish", //MISSING +DlgDocCharSetUN : "Unicode (UTF-8)", //MISSING +DlgDocCharSetWE : "Western European", //MISSING +DlgDocCharSetOther : "Beste Karaktere Multzoaren Kodeketa", + +DlgDocDocType : "Document Type Goiburua", +DlgDocDocTypeOther : "Beste Document Type Goiburua", +DlgDocIncXHTML : "XHTML Ezarpenak", +DlgDocBgColor : "Atzeko Kolorea", +DlgDocBgImage : "Atzeko Irudiaren URL-a", +DlgDocBgNoScroll : "Korritze gabeko Atzekaldea", +DlgDocCText : "Testua", +DlgDocCLink : "Estekak", +DlgDocCVisited : "Bisitatutako Estekak", +DlgDocCActive : "Esteka Aktiboa", +DlgDocMargins : "Orrialdearen marjinak", +DlgDocMaTop : "Goian", +DlgDocMaLeft : "Ezkerrean", +DlgDocMaRight : "Eskuman", +DlgDocMaBottom : "Behean", +DlgDocMeIndex : "Dokumentuaren Gako-hitzak (komarekin bananduta)", +DlgDocMeDescr : "Dokumentuaren Deskribapena", +DlgDocMeAuthor : "Egilea", +DlgDocMeCopy : "Copyright", +DlgDocPreview : "Aurrebista", + +// Templates Dialog +Templates : "Txantiloiak", +DlgTemplatesTitle : "Eduki Txantiloiak", +DlgTemplatesSelMsg : "Mesedez txantiloia aukeratu editorean kargatzeko
    (orain dauden edukiak galduko dira):", +DlgTemplatesLoading : "Txantiloiak kargatzen. Itxaron mesedez...", +DlgTemplatesNoTpl : "(Ez dago definitutako txantiloirik)", +DlgTemplatesReplace : "Replace actual contents", //MISSING + +// About Dialog +DlgAboutAboutTab : "Honi buruz", +DlgAboutBrowserInfoTab : "Nabigatzailearen Informazioa", +DlgAboutLicenseTab : "Lizentzia", +DlgAboutVersion : "bertsioa", +DlgAboutInfo : "Informazio gehiago eskuratzeko hona joan" +}; diff --git a/FCKeditor/editor/lang/fa.js b/FCKeditor/editor/lang/fa.js new file mode 100644 index 0000000..9186747 --- /dev/null +++ b/FCKeditor/editor/lang/fa.js @@ -0,0 +1,516 @@ +/* + * FCKeditor - The text editor for Internet - http://www.fckeditor.net + * Copyright (C) 2003-2007 Frederico Caldeira Knabben + * + * == BEGIN LICENSE == + * + * Licensed under the terms of any of the following licenses at your + * choice: + * + * - GNU General Public License Version 2 or later (the "GPL") + * http://www.gnu.org/licenses/gpl.html + * + * - GNU Lesser General Public License Version 2.1 or later (the "LGPL") + * http://www.gnu.org/licenses/lgpl.html + * + * - Mozilla Public License Version 1.1 or later (the "MPL") + * http://www.mozilla.org/MPL/MPL-1.1.html + * + * == END LICENSE == + * + * Persian language file. + */ + +var FCKLang = +{ +// Language direction : "ltr" (left to right) or "rtl" (right to left). +Dir : "rtl", + +ToolbarCollapse : "برچیدن نوارابزار", +ToolbarExpand : "گستردن نوارابزار", + +// Toolbar Items and Context Menu +Save : "ذخیره", +NewPage : "برگهٴ تازه", +Preview : "پیش‌نمایش", +Cut : "برش", +Copy : "کپی", +Paste : "چسباندن", +PasteText : "چسباندن به عنوان متن ِساده", +PasteWord : "چسباندن از Word", +Print : "چاپ", +SelectAll : "گزینش همه", +RemoveFormat : "برداشتن فرمت", +InsertLinkLbl : "پیوند", +InsertLink : "گنجاندن/ویرایش ِپیوند", +RemoveLink : "برداشتن پیوند", +Anchor : "گنجاندن/ویرایش ِلنگر", +AnchorDelete : "Remove Anchor", //MISSING +InsertImageLbl : "تصویر", +InsertImage : "گنجاندن/ویرایش ِتصویر", +InsertFlashLbl : "Flash", +InsertFlash : "گنجاندن/ویرایش ِFlash", +InsertTableLbl : "جدول", +InsertTable : "گنجاندن/ویرایش ِجدول", +InsertLineLbl : "خط", +InsertLine : "گنجاندن خط ِافقی", +InsertSpecialCharLbl: "نویسهٴ ویژه", +InsertSpecialChar : "گنجاندن نویسهٴ ویژه", +InsertSmileyLbl : "خندانک", +InsertSmiley : "گنجاندن خندانک", +About : "دربارهٴ FCKeditor", +Bold : "درشت", +Italic : "خمیده", +Underline : "خط‌زیردار", +StrikeThrough : "میان‌خط", +Subscript : "زیرنویس", +Superscript : "بالانویس", +LeftJustify : "چپ‌چین", +CenterJustify : "میان‌چین", +RightJustify : "راست‌چین", +BlockJustify : "بلوک‌چین", +DecreaseIndent : "کاهش تورفتگی", +IncreaseIndent : "افزایش تورفتگی", +Blockquote : "Blockquote", //MISSING +Undo : "واچیدن", +Redo : "بازچیدن", +NumberedListLbl : "فهرست شماره‌دار", +NumberedList : "گنجاندن/برداشتن فهرست شماره‌دار", +BulletedListLbl : "فهرست نقطه‌ای", +BulletedList : "گنجاندن/برداشتن فهرست نقطه‌ای", +ShowTableBorders : "نمایش لبهٴ جدول", +ShowDetails : "نمایش جزئیات", +Style : "سبک", +FontFormat : "فرمت", +Font : "قلم", +FontSize : "اندازه", +TextColor : "رنگ متن", +BGColor : "رنگ پس‌زمینه", +Source : "منبع", +Find : "جستجو", +Replace : "جایگزینی", +SpellCheck : "بررسی املا", +UniversalKeyboard : "صفحه‌کلید جهانی", +PageBreakLbl : "شکستگی ِپایان ِبرگه", +PageBreak : "گنجاندن شکستگی ِپایان ِبرگه", + +Form : "فرم", +Checkbox : "خانهٴ گزینه‌ای", +RadioButton : "دکمهٴ رادیویی", +TextField : "فیلد متنی", +Textarea : "ناحیهٴ متنی", +HiddenField : "فیلد پنهان", +Button : "دکمه", +SelectionField : "فیلد چندگزینه‌ای", +ImageButton : "دکمهٴ تصویری", + +FitWindow : "بیشینه‌سازی ِاندازهٴ ویرایشگر", +ShowBlocks : "Show Blocks", //MISSING + +// Context Menu +EditLink : "ویرایش پیوند", +CellCM : "سلول", +RowCM : "سطر", +ColumnCM : "ستون", +InsertRowAfter : "Insert Row After", //MISSING +InsertRowBefore : "Insert Row Before", //MISSING +DeleteRows : "حذف سطرها", +InsertColumnAfter : "Insert Column After", //MISSING +InsertColumnBefore : "Insert Column Before", //MISSING +DeleteColumns : "حذف ستونها", +InsertCellAfter : "Insert Cell After", //MISSING +InsertCellBefore : "Insert Cell Before", //MISSING +DeleteCells : "حذف سلولها", +MergeCells : "ادغام سلولها", +MergeRight : "Merge Right", //MISSING +MergeDown : "Merge Down", //MISSING +HorizontalSplitCell : "Split Cell Horizontally", //MISSING +VerticalSplitCell : "Split Cell Vertically", //MISSING +TableDelete : "پاک‌کردن جدول", +CellProperties : "ویژگیهای سلول", +TableProperties : "ویژگیهای جدول", +ImageProperties : "ویژگیهای تصویر", +FlashProperties : "ویژگیهای Flash", + +AnchorProp : "ویژگیهای لنگر", +ButtonProp : "ویژگیهای دکمه", +CheckboxProp : "ویژگیهای خانهٴ گزینه‌ای", +HiddenFieldProp : "ویژگیهای فیلد پنهان", +RadioButtonProp : "ویژگیهای دکمهٴ رادیویی", +ImageButtonProp : "ویژگیهای دکمهٴ تصویری", +TextFieldProp : "ویژگیهای فیلد متنی", +SelectionFieldProp : "ویژگیهای فیلد چندگزینه‌ای", +TextareaProp : "ویژگیهای ناحیهٴ متنی", +FormProp : "ویژگیهای فرم", + +FontFormats : "نرمال;فرمت‌شده;آدرس;سرنویس 1;سرنویس 2;سرنویس 3;سرنویس 4;سرنویس 5;سرنویس 6;بند;(DIV)", + +// Alerts and Messages +ProcessingXHTML : "پردازش XHTML. لطفا صبر کنید...", +Done : "انجام شد", +PasteWordConfirm : "متنی که می‌خواهید بچسبانید به نظر می‌رسد از Word کپی شده است. آیا می‌خواهید قبل از چسباندن آن را پاک‌سازی کنید؟", +NotCompatiblePaste : "این فرمان برای مرورگر Internet Explorer از نگارش 5.5 یا بالاتر در دسترس است. آیا می‌خواهید بدون پاک‌سازی، متن را بچسبانید؟", +UnknownToolbarItem : "فقرهٴ نوارابزار ناشناخته \"%1\"", +UnknownCommand : "نام دستور ناشناخته \"%1\"", +NotImplemented : "دستور پیاده‌سازی‌نشده", +UnknownToolbarSet : "مجموعهٴ نوارابزار \"%1\" وجود ندارد", +NoActiveX : "تنظیمات امنیتی مرورگر شما ممکن است در بعضی از ویژگیهای مرورگر محدودیت ایجاد کند. شما باید گزینهٴ \"Run ActiveX controls and plug-ins\" را فعال کنید. ممکن است شما با خطاهایی روبرو باشید و متوجه کمبود ویژگیهایی شوید.", +BrowseServerBlocked : "توانایی بازگشایی مرورگر منابع فراهم نیست. اطمینان حاصل کنید که تمامی برنامه‌های پیشگیری از نمایش popup را از کار بازداشته‌اید.", +DialogBlocked : "توانایی بازگشایی پنجرهٴ کوچک ِگفتگو فراهم نیست. اطمینان حاصل کنید که تمامی برنامه‌های پیشگیری از نمایش popup را از کار بازداشته‌اید.", + +// Dialogs +DlgBtnOK : "پذیرش", +DlgBtnCancel : "انصراف", +DlgBtnClose : "بستن", +DlgBtnBrowseServer : "فهرست‌نمایی سرور", +DlgAdvancedTag : "پیشرفته", +DlgOpOther : "<غیره>", +DlgInfoTab : "اطلاعات", +DlgAlertUrl : "لطفاً URL را بنویسید", + +// General Dialogs Labels +DlgGenNotSet : "<تعین‌نشده>", +DlgGenId : "شناسه", +DlgGenLangDir : "جهت‌نمای زبان", +DlgGenLangDirLtr : "چپ به راست (LTR)", +DlgGenLangDirRtl : "راست به چپ (RTL)", +DlgGenLangCode : "کد زبان", +DlgGenAccessKey : "کلید دستیابی", +DlgGenName : "نام", +DlgGenTabIndex : "نمایهٴ دسترسی با Tab", +DlgGenLongDescr : "URL توصیف طولانی", +DlgGenClass : "کلاسهای شیوه‌نامه(Stylesheet)", +DlgGenTitle : "عنوان کمکی", +DlgGenContType : "نوع محتوای کمکی", +DlgGenLinkCharset : "نویسه‌گان منبع ِپیوندشده", +DlgGenStyle : "شیوه(style)", + +// Image Dialog +DlgImgTitle : "ویژگیهای تصویر", +DlgImgInfoTab : "اطلاعات تصویر", +DlgImgBtnUpload : "به سرور بفرست", +DlgImgURL : "URL", +DlgImgUpload : "انتقال به سرور", +DlgImgAlt : "متن جایگزین", +DlgImgWidth : "پهنا", +DlgImgHeight : "درازا", +DlgImgLockRatio : "قفل‌کردن ِنسبت", +DlgBtnResetSize : "بازنشانی اندازه", +DlgImgBorder : "لبه", +DlgImgHSpace : "فاصلهٴ افقی", +DlgImgVSpace : "فاصلهٴ عمودی", +DlgImgAlign : "چینش", +DlgImgAlignLeft : "چپ", +DlgImgAlignAbsBottom: "پائین مطلق", +DlgImgAlignAbsMiddle: "وسط مطلق", +DlgImgAlignBaseline : "خط‌پایه", +DlgImgAlignBottom : "پائین", +DlgImgAlignMiddle : "وسط", +DlgImgAlignRight : "راست", +DlgImgAlignTextTop : "متن بالا", +DlgImgAlignTop : "بالا", +DlgImgPreview : "پیش‌نمایش", +DlgImgAlertUrl : "لطفا URL تصویر را بنویسید", +DlgImgLinkTab : "پیوند", + +// Flash Dialog +DlgFlashTitle : "ویژگیهای Flash", +DlgFlashChkPlay : "آغاز ِخودکار", +DlgFlashChkLoop : "اجرای پیاپی", +DlgFlashChkMenu : "دردسترس‌بودن منوی Flash", +DlgFlashScale : "مقیاس", +DlgFlashScaleAll : "نمایش همه", +DlgFlashScaleNoBorder : "بدون کران", +DlgFlashScaleFit : "جایگیری کامل", + +// Link Dialog +DlgLnkWindowTitle : "پیوند", +DlgLnkInfoTab : "اطلاعات پیوند", +DlgLnkTargetTab : "مقصد", + +DlgLnkType : "نوع پیوند", +DlgLnkTypeURL : "URL", +DlgLnkTypeAnchor : "لنگر در همین صفحه", +DlgLnkTypeEMail : "پست الکترونیکی", +DlgLnkProto : "پروتکل", +DlgLnkProtoOther : "<دیگر>", +DlgLnkURL : "URL", +DlgLnkAnchorSel : "یک لنگر برگزینید", +DlgLnkAnchorByName : "با نام لنگر", +DlgLnkAnchorById : "با شناسهٴ المان", +DlgLnkNoAnchors : "(در این سند لنگری دردسترس نیست)", +DlgLnkEMail : "نشانی پست الکترونیکی", +DlgLnkEMailSubject : "موضوع پیام", +DlgLnkEMailBody : "متن پیام", +DlgLnkUpload : "انتقال به سرور", +DlgLnkBtnUpload : "به سرور بفرست", + +DlgLnkTarget : "مقصد", +DlgLnkTargetFrame : "<فریم>", +DlgLnkTargetPopup : "<پنجرهٴ پاپاپ>", +DlgLnkTargetBlank : "پنجرهٴ دیگر (_blank)", +DlgLnkTargetParent : "پنجرهٴ والد (_parent)", +DlgLnkTargetSelf : "همان پنجره (_self)", +DlgLnkTargetTop : "بالاترین پنجره (_top)", +DlgLnkTargetFrameName : "نام فریم مقصد", +DlgLnkPopWinName : "نام پنجرهٴ پاپاپ", +DlgLnkPopWinFeat : "ویژگیهای پنجرهٴ پاپاپ", +DlgLnkPopResize : "قابل تغییر اندازه", +DlgLnkPopLocation : "نوار موقعیت", +DlgLnkPopMenu : "نوار منو", +DlgLnkPopScroll : "میله‌های پیمایش", +DlgLnkPopStatus : "نوار وضعیت", +DlgLnkPopToolbar : "نوارابزار", +DlgLnkPopFullScrn : "تمام‌صفحه (IE)", +DlgLnkPopDependent : "وابسته (Netscape)", +DlgLnkPopWidth : "پهنا", +DlgLnkPopHeight : "درازا", +DlgLnkPopLeft : "موقعیت ِچپ", +DlgLnkPopTop : "موقعیت ِبالا", + +DlnLnkMsgNoUrl : "لطفا URL پیوند را بنویسید", +DlnLnkMsgNoEMail : "لطفا نشانی پست الکترونیکی را بنویسید", +DlnLnkMsgNoAnchor : "لطفا لنگری را برگزینید", +DlnLnkMsgInvPopName : "نام پنجرهٴ پاپاپ باید با یک نویسهٴ الفبایی آغاز گردد و نباید فاصله‌های خالی در آن باشند", + +// Color Dialog +DlgColorTitle : "گزینش رنگ", +DlgColorBtnClear : "پاک‌کردن", +DlgColorHighlight : "نمونه", +DlgColorSelected : "برگزیده", + +// Smiley Dialog +DlgSmileyTitle : "گنجاندن خندانک", + +// Special Character Dialog +DlgSpecialCharTitle : "گزینش نویسهٴ‌ویژه", + +// Table Dialog +DlgTableTitle : "ویژگیهای جدول", +DlgTableRows : "سطرها", +DlgTableColumns : "ستونها", +DlgTableBorder : "اندازهٴ لبه", +DlgTableAlign : "چینش", +DlgTableAlignNotSet : "<تعین‌نشده>", +DlgTableAlignLeft : "چپ", +DlgTableAlignCenter : "وسط", +DlgTableAlignRight : "راست", +DlgTableWidth : "پهنا", +DlgTableWidthPx : "پیکسل", +DlgTableWidthPc : "درصد", +DlgTableHeight : "درازا", +DlgTableCellSpace : "فاصلهٴ میان سلولها", +DlgTableCellPad : "فاصلهٴ پرشده در سلول", +DlgTableCaption : "عنوان", +DlgTableSummary : "خلاصه", + +// Table Cell Dialog +DlgCellTitle : "ویژگیهای سلول", +DlgCellWidth : "پهنا", +DlgCellWidthPx : "پیکسل", +DlgCellWidthPc : "درصد", +DlgCellHeight : "درازا", +DlgCellWordWrap : "شکستن واژه‌ها", +DlgCellWordWrapNotSet : "<تعین‌نشده>", +DlgCellWordWrapYes : "بله", +DlgCellWordWrapNo : "خیر", +DlgCellHorAlign : "چینش ِافقی", +DlgCellHorAlignNotSet : "<تعین‌نشده>", +DlgCellHorAlignLeft : "چپ", +DlgCellHorAlignCenter : "وسط", +DlgCellHorAlignRight: "راست", +DlgCellVerAlign : "چینش ِعمودی", +DlgCellVerAlignNotSet : "<تعین‌نشده>", +DlgCellVerAlignTop : "بالا", +DlgCellVerAlignMiddle : "میان", +DlgCellVerAlignBottom : "پائین", +DlgCellVerAlignBaseline : "خط‌پایه", +DlgCellRowSpan : "گستردگی سطرها", +DlgCellCollSpan : "گستردگی ستونها", +DlgCellBackColor : "رنگ پس‌زمینه", +DlgCellBorderColor : "رنگ لبه", +DlgCellBtnSelect : "برگزینید...", + +// Find and Replace Dialog +DlgFindAndReplaceTitle : "Find and Replace", //MISSING + +// Find Dialog +DlgFindTitle : "یافتن", +DlgFindFindBtn : "یافتن", +DlgFindNotFoundMsg : "متن موردنظر یافت نشد.", + +// Replace Dialog +DlgReplaceTitle : "جایگزینی", +DlgReplaceFindLbl : "چه‌چیز را می‌یابید:", +DlgReplaceReplaceLbl : "جایگزینی با:", +DlgReplaceCaseChk : "همسانی در بزرگی و کوچکی نویسه‌ها", +DlgReplaceReplaceBtn : "جایگزینی", +DlgReplaceReplAllBtn : "جایگزینی همهٴ یافته‌ها", +DlgReplaceWordChk : "همسانی با واژهٴ کامل", + +// Paste Operations / Dialog +PasteErrorCut : "تنظیمات امنیتی مرورگر شما اجازه نمی‌دهد که ویرایشگر به طور خودکار عملکردهای برش را انجام دهد. لطفا با دکمه‌های صفحه‌کلید این کار را انجام دهید (Ctrl+X).", +PasteErrorCopy : "تنظیمات امنیتی مرورگر شما اجازه نمی‌دهد که ویرایشگر به طور خودکار عملکردهای کپی‌کردن را انجام دهد. لطفا با دکمه‌های صفحه‌کلید این کار را انجام دهید (Ctrl+C).", + +PasteAsText : "چسباندن به عنوان متن ِساده", +PasteFromWord : "چسباندن از Word", + +DlgPasteMsg2 : "لطفا متن را با کلیدهای (Ctrl+V) در این جعبهٴ متنی بچسبانید و پذیرش را بزنید.", +DlgPasteSec : "به خاطر تنظیمات امنیتی مرورگر شما، ویرایشگر نمی‌تواند دسترسی مستقیم به داده‌های clipboard داشته باشد. شما باید دوباره آنرا در این پنجره بچسبانید.", +DlgPasteIgnoreFont : "چشم‌پوشی از تعاریف نوع قلم", +DlgPasteRemoveStyles : "چشم‌پوشی از تعاریف سبک (style)", +DlgPasteCleanBox : "پاک‌کردن ناحیه", + +// Color Picker +ColorAutomatic : "خودکار", +ColorMoreColors : "رنگهای بیشتر...", + +// Document Properties +DocProps : "ویژگیهای سند", + +// Anchor Dialog +DlgAnchorTitle : "ویژگیهای لنگر", +DlgAnchorName : "نام لنگر", +DlgAnchorErrorName : "لطفا نام لنگر را بنویسید", + +// Speller Pages Dialog +DlgSpellNotInDic : "در واژه‌نامه یافت نشد", +DlgSpellChangeTo : "تغییر به", +DlgSpellBtnIgnore : "چشم‌پوشی", +DlgSpellBtnIgnoreAll : "چشم‌پوشی همه", +DlgSpellBtnReplace : "جایگزینی", +DlgSpellBtnReplaceAll : "جایگزینی همه", +DlgSpellBtnUndo : "واچینش", +DlgSpellNoSuggestions : "- پیشنهادی نیست -", +DlgSpellProgress : "بررسی املا در حال انجام...", +DlgSpellNoMispell : "بررسی املا انجام شد. هیچ غلط‌املائی یافت نشد", +DlgSpellNoChanges : "بررسی املا انجام شد. هیچ واژه‌ای تغییر نیافت", +DlgSpellOneChange : "بررسی املا انجام شد. یک واژه تغییر یافت", +DlgSpellManyChanges : "بررسی املا انجام شد. %1 واژه تغییر یافت", + +IeSpellDownload : "بررسی‌کنندهٴ املا نصب نشده است. آیا می‌خواهید آن را هم‌اکنون دریافت کنید؟", + +// Button Dialog +DlgButtonText : "متن (مقدار)", +DlgButtonType : "نوع", +DlgButtonTypeBtn : "دکمه", +DlgButtonTypeSbm : "Submit", +DlgButtonTypeRst : "بازنشانی (Reset)", + +// Checkbox and Radio Button Dialogs +DlgCheckboxName : "نام", +DlgCheckboxValue : "مقدار", +DlgCheckboxSelected : "برگزیده", + +// Form Dialog +DlgFormName : "نام", +DlgFormAction : "رویداد", +DlgFormMethod : "متد", + +// Select Field Dialog +DlgSelectName : "نام", +DlgSelectValue : "مقدار", +DlgSelectSize : "اندازه", +DlgSelectLines : "خطوط", +DlgSelectChkMulti : "گزینش چندگانه فراهم باشد", +DlgSelectOpAvail : "گزینه‌های دردسترس", +DlgSelectOpText : "متن", +DlgSelectOpValue : "مقدار", +DlgSelectBtnAdd : "افزودن", +DlgSelectBtnModify : "ویرایش", +DlgSelectBtnUp : "بالا", +DlgSelectBtnDown : "پائین", +DlgSelectBtnSetValue : "تنظیم به عنوان مقدار ِبرگزیده", +DlgSelectBtnDelete : "پاک‌کردن", + +// Textarea Dialog +DlgTextareaName : "نام", +DlgTextareaCols : "ستونها", +DlgTextareaRows : "سطرها", + +// Text Field Dialog +DlgTextName : "نام", +DlgTextValue : "مقدار", +DlgTextCharWidth : "پهنای نویسه", +DlgTextMaxChars : "بیشینهٴ نویسه‌ها", +DlgTextType : "نوع", +DlgTextTypeText : "متن", +DlgTextTypePass : "گذرواژه", + +// Hidden Field Dialog +DlgHiddenName : "نام", +DlgHiddenValue : "مقدار", + +// Bulleted List Dialog +BulletedListProp : "ویژگیهای فهرست نقطه‌ای", +NumberedListProp : "ویژگیهای فهرست شماره‌دار", +DlgLstStart : "آغاز", +DlgLstType : "نوع", +DlgLstTypeCircle : "دایره", +DlgLstTypeDisc : "قرص", +DlgLstTypeSquare : "چهارگوش", +DlgLstTypeNumbers : "شماره‌ها (1، 2، 3)", +DlgLstTypeLCase : "نویسه‌های کوچک (a، b، c)", +DlgLstTypeUCase : "نویسه‌های بزرگ (A، B، C)", +DlgLstTypeSRoman : "شمارگان رومی کوچک (i، ii، iii)", +DlgLstTypeLRoman : "شمارگان رومی بزرگ (I، II، III)", + +// Document Properties Dialog +DlgDocGeneralTab : "عمومی", +DlgDocBackTab : "پس‌زمینه", +DlgDocColorsTab : "رنگها و حاشیه‌ها", +DlgDocMetaTab : "فراداده", + +DlgDocPageTitle : "عنوان صفحه", +DlgDocLangDir : "جهت زبان", +DlgDocLangDirLTR : "چپ به راست (LTR(", +DlgDocLangDirRTL : "راست به چپ (RTL(", +DlgDocLangCode : "کد زبان", +DlgDocCharSet : "رمزگذاری نویسه‌گان", +DlgDocCharSetCE : "اروپای مرکزی", +DlgDocCharSetCT : "چینی رسمی (Big5)", +DlgDocCharSetCR : "سیریلیک", +DlgDocCharSetGR : "یونانی", +DlgDocCharSetJP : "ژاپنی", +DlgDocCharSetKR : "کره‌ای", +DlgDocCharSetTR : "ترکی", +DlgDocCharSetUN : "یونیکُد (UTF-8)", +DlgDocCharSetWE : "اروپای غربی", +DlgDocCharSetOther : "رمزگذاری نویسه‌گان دیگر", + +DlgDocDocType : "عنوان نوع سند", +DlgDocDocTypeOther : "عنوان نوع سند دیگر", +DlgDocIncXHTML : "شامل تعاریف XHTML", +DlgDocBgColor : "رنگ پس‌زمینه", +DlgDocBgImage : "URL تصویر پس‌زمینه", +DlgDocBgNoScroll : "پس‌زمینهٴ پیمایش‌ناپذیر", +DlgDocCText : "متن", +DlgDocCLink : "پیوند", +DlgDocCVisited : "پیوند مشاهده‌شده", +DlgDocCActive : "پیوند فعال", +DlgDocMargins : "حاشیه‌های صفحه", +DlgDocMaTop : "بالا", +DlgDocMaLeft : "چپ", +DlgDocMaRight : "راست", +DlgDocMaBottom : "پایین", +DlgDocMeIndex : "کلیدواژگان نمایه‌گذاری سند (با کاما جدا شوند)", +DlgDocMeDescr : "توصیف سند", +DlgDocMeAuthor : "نویسنده", +DlgDocMeCopy : "کپی‌رایت", +DlgDocPreview : "پیش‌نمایش", + +// Templates Dialog +Templates : "الگوها", +DlgTemplatesTitle : "الگوهای محتویات", +DlgTemplatesSelMsg : "لطفا الگوی موردنظر را برای بازکردن در ویرایشگر برگزینید
    (محتویات کنونی از دست خواهند رفت):", +DlgTemplatesLoading : "بارگذاری فهرست الگوها. لطفا صبر کنید...", +DlgTemplatesNoTpl : "(الگوئی تعریف نشده است)", +DlgTemplatesReplace : "محتویات کنونی جایگزین شوند", + +// About Dialog +DlgAboutAboutTab : "درباره", +DlgAboutBrowserInfoTab : "اطلاعات مرورگر", +DlgAboutLicenseTab : "گواهینامه", +DlgAboutVersion : "نگارش", +DlgAboutInfo : "برای آگاهی بیشتر به این نشانی بروید" +}; diff --git a/FCKeditor/editor/lang/fi.js b/FCKeditor/editor/lang/fi.js new file mode 100644 index 0000000..f853e44 --- /dev/null +++ b/FCKeditor/editor/lang/fi.js @@ -0,0 +1,516 @@ +/* + * FCKeditor - The text editor for Internet - http://www.fckeditor.net + * Copyright (C) 2003-2007 Frederico Caldeira Knabben + * + * == BEGIN LICENSE == + * + * Licensed under the terms of any of the following licenses at your + * choice: + * + * - GNU General Public License Version 2 or later (the "GPL") + * http://www.gnu.org/licenses/gpl.html + * + * - GNU Lesser General Public License Version 2.1 or later (the "LGPL") + * http://www.gnu.org/licenses/lgpl.html + * + * - Mozilla Public License Version 1.1 or later (the "MPL") + * http://www.mozilla.org/MPL/MPL-1.1.html + * + * == END LICENSE == + * + * Finnish language file. + */ + +var FCKLang = +{ +// Language direction : "ltr" (left to right) or "rtl" (right to left). +Dir : "ltr", + +ToolbarCollapse : "Piilota työkalurivi", +ToolbarExpand : "Näytä työkalurivi", + +// Toolbar Items and Context Menu +Save : "Tallenna", +NewPage : "Tyhjennä", +Preview : "Esikatsele", +Cut : "Leikkaa", +Copy : "Kopioi", +Paste : "Liitä", +PasteText : "Liitä tekstinä", +PasteWord : "Liitä Wordista", +Print : "Tulosta", +SelectAll : "Valitse kaikki", +RemoveFormat : "Poista muotoilu", +InsertLinkLbl : "Linkki", +InsertLink : "Lisää linkki/muokkaa linkkiä", +RemoveLink : "Poista linkki", +Anchor : "Lisää ankkuri/muokkaa ankkuria", +AnchorDelete : "Poista ankkuri", +InsertImageLbl : "Kuva", +InsertImage : "Lisää kuva/muokkaa kuvaa", +InsertFlashLbl : "Flash", +InsertFlash : "Lisää/muokkaa Flashia", +InsertTableLbl : "Taulu", +InsertTable : "Lisää taulu/muokkaa taulua", +InsertLineLbl : "Murtoviiva", +InsertLine : "Lisää murtoviiva", +InsertSpecialCharLbl: "Erikoismerkki", +InsertSpecialChar : "Lisää erikoismerkki", +InsertSmileyLbl : "Hymiö", +InsertSmiley : "Lisää hymiö", +About : "FCKeditorista", +Bold : "Lihavoitu", +Italic : "Kursivoitu", +Underline : "Alleviivattu", +StrikeThrough : "Yliviivattu", +Subscript : "Alaindeksi", +Superscript : "Yläindeksi", +LeftJustify : "Tasaa vasemmat reunat", +CenterJustify : "Keskitä", +RightJustify : "Tasaa oikeat reunat", +BlockJustify : "Tasaa molemmat reunat", +DecreaseIndent : "Pienennä sisennystä", +IncreaseIndent : "Suurenna sisennystä", +Blockquote : "Lainaus", +Undo : "Kumoa", +Redo : "Toista", +NumberedListLbl : "Numerointi", +NumberedList : "Lisää/poista numerointi", +BulletedListLbl : "Luottelomerkit", +BulletedList : "Lisää/poista luottelomerkit", +ShowTableBorders : "Näytä taulun rajat", +ShowDetails : "Näytä muotoilu", +Style : "Tyyli", +FontFormat : "Muotoilu", +Font : "Fontti", +FontSize : "Koko", +TextColor : "Tekstiväri", +BGColor : "Taustaväri", +Source : "Koodi", +Find : "Etsi", +Replace : "Korvaa", +SpellCheck : "Tarkista oikeinkirjoitus", +UniversalKeyboard : "Universaali näppäimistö", +PageBreakLbl : "Sivun vaihto", +PageBreak : "Lisää sivun vaihto", + +Form : "Lomake", +Checkbox : "Valintaruutu", +RadioButton : "Radiopainike", +TextField : "Tekstikenttä", +Textarea : "Tekstilaatikko", +HiddenField : "Piilokenttä", +Button : "Painike", +SelectionField : "Valintakenttä", +ImageButton : "Kuvapainike", + +FitWindow : "Suurenna editori koko ikkunaan", +ShowBlocks : "Näytä elementit", + +// Context Menu +EditLink : "Muokkaa linkkiä", +CellCM : "Solu", +RowCM : "Rivi", +ColumnCM : "Sarake", +InsertRowAfter : "Lisää rivi alapuolelle", +InsertRowBefore : "Lisää rivi yläpuolelle", +DeleteRows : "Poista rivit", +InsertColumnAfter : "Lisää sarake oikealle", +InsertColumnBefore : "Lisää sarake vasemmalle", +DeleteColumns : "Poista sarakkeet", +InsertCellAfter : "Lisää solu perään", +InsertCellBefore : "Lisää solu eteen", +DeleteCells : "Poista solut", +MergeCells : "Yhdistä solut", +MergeRight : "Yhdistä oikealla olevan kanssa", +MergeDown : "Yhdistä alla olevan kanssa", +HorizontalSplitCell : "Jaa solu vaakasuunnassa", +VerticalSplitCell : "Jaa solu pystysuunnassa", +TableDelete : "Poista taulu", +CellProperties : "Solun ominaisuudet", +TableProperties : "Taulun ominaisuudet", +ImageProperties : "Kuvan ominaisuudet", +FlashProperties : "Flash ominaisuudet", + +AnchorProp : "Ankkurin ominaisuudet", +ButtonProp : "Painikkeen ominaisuudet", +CheckboxProp : "Valintaruudun ominaisuudet", +HiddenFieldProp : "Piilokentän ominaisuudet", +RadioButtonProp : "Radiopainikkeen ominaisuudet", +ImageButtonProp : "Kuvapainikkeen ominaisuudet", +TextFieldProp : "Tekstikentän ominaisuudet", +SelectionFieldProp : "Valintakentän ominaisuudet", +TextareaProp : "Tekstilaatikon ominaisuudet", +FormProp : "Lomakkeen ominaisuudet", + +FontFormats : "Normaali;Muotoiltu;Osoite;Otsikko 1;Otsikko 2;Otsikko 3;Otsikko 4;Otsikko 5;Otsikko 6", + +// Alerts and Messages +ProcessingXHTML : "Prosessoidaan XHTML:ää. Odota hetki...", +Done : "Valmis", +PasteWordConfirm : "Teksti, jonka haluat liittää, näyttää olevan kopioitu Wordista. Haluatko puhdistaa sen ennen liittämistä?", +NotCompatiblePaste : "Tämä komento toimii vain Internet Explorer 5.5:ssa tai uudemmassa. Haluatko liittää ilman puhdistusta?", +UnknownToolbarItem : "Tuntemanton työkalu \"%1\"", +UnknownCommand : "Tuntematon komento \"%1\"", +NotImplemented : "Komentoa ei ole liitetty sovellukseen", +UnknownToolbarSet : "Työkalukokonaisuus \"%1\" ei ole olemassa", +NoActiveX : "Selaimesi turvallisuusasetukset voivat rajoittaa joitain editorin ominaisuuksia. Sinun pitää ottaa käyttöön asetuksista \"Suorita ActiveX komponentit ja -plugin-laajennukset\". Saatat kohdata virheitä ja huomata puuttuvia ominaisuuksia.", +BrowseServerBlocked : "Resurssiselainta ei voitu avata. Varmista, että ponnahdusikkunoiden estäjät eivät ole päällä.", +DialogBlocked : "Apuikkunaa ei voitu avaata. Varmista, että ponnahdusikkunoiden estäjät eivät ole päällä.", + +// Dialogs +DlgBtnOK : "OK", +DlgBtnCancel : "Peruuta", +DlgBtnClose : "Sulje", +DlgBtnBrowseServer : "Selaa palvelinta", +DlgAdvancedTag : "Lisäominaisuudet", +DlgOpOther : "Muut", +DlgInfoTab : "Info", +DlgAlertUrl : "Lisää URL", + +// General Dialogs Labels +DlgGenNotSet : "", +DlgGenId : "Tunniste", +DlgGenLangDir : "Kielen suunta", +DlgGenLangDirLtr : "Vasemmalta oikealle (LTR)", +DlgGenLangDirRtl : "Oikealta vasemmalle (RTL)", +DlgGenLangCode : "Kielikoodi", +DlgGenAccessKey : "Pikanäppäin", +DlgGenName : "Nimi", +DlgGenTabIndex : "Tabulaattori indeksi", +DlgGenLongDescr : "Pitkän kuvauksen URL", +DlgGenClass : "Tyyliluokat", +DlgGenTitle : "Avustava otsikko", +DlgGenContType : "Avustava sisällön tyyppi", +DlgGenLinkCharset : "Linkitetty kirjaimisto", +DlgGenStyle : "Tyyli", + +// Image Dialog +DlgImgTitle : "Kuvan ominaisuudet", +DlgImgInfoTab : "Kuvan tiedot", +DlgImgBtnUpload : "Lähetä palvelimelle", +DlgImgURL : "Osoite", +DlgImgUpload : "Lisää kuva", +DlgImgAlt : "Vaihtoehtoinen teksti", +DlgImgWidth : "Leveys", +DlgImgHeight : "Korkeus", +DlgImgLockRatio : "Lukitse suhteet", +DlgBtnResetSize : "Alkuperäinen koko", +DlgImgBorder : "Raja", +DlgImgHSpace : "Vaakatila", +DlgImgVSpace : "Pystytila", +DlgImgAlign : "Kohdistus", +DlgImgAlignLeft : "Vasemmalle", +DlgImgAlignAbsBottom: "Aivan alas", +DlgImgAlignAbsMiddle: "Aivan keskelle", +DlgImgAlignBaseline : "Alas (teksti)", +DlgImgAlignBottom : "Alas", +DlgImgAlignMiddle : "Keskelle", +DlgImgAlignRight : "Oikealle", +DlgImgAlignTextTop : "Ylös (teksti)", +DlgImgAlignTop : "Ylös", +DlgImgPreview : "Esikatselu", +DlgImgAlertUrl : "Kirjoita kuvan osoite (URL)", +DlgImgLinkTab : "Linkki", + +// Flash Dialog +DlgFlashTitle : "Flash ominaisuudet", +DlgFlashChkPlay : "Automaattinen käynnistys", +DlgFlashChkLoop : "Toisto", +DlgFlashChkMenu : "Näytä Flash-valikko", +DlgFlashScale : "Levitä", +DlgFlashScaleAll : "Näytä kaikki", +DlgFlashScaleNoBorder : "Ei rajaa", +DlgFlashScaleFit : "Tarkka koko", + +// Link Dialog +DlgLnkWindowTitle : "Linkki", +DlgLnkInfoTab : "Linkin tiedot", +DlgLnkTargetTab : "Kohde", + +DlgLnkType : "Linkkityyppi", +DlgLnkTypeURL : "Osoite", +DlgLnkTypeAnchor : "Ankkuri tässä sivussa", +DlgLnkTypeEMail : "Sähköposti", +DlgLnkProto : "Protokolla", +DlgLnkProtoOther : "", +DlgLnkURL : "Osoite", +DlgLnkAnchorSel : "Valitse ankkuri", +DlgLnkAnchorByName : "Ankkurin nimen mukaan", +DlgLnkAnchorById : "Ankkurin ID:n mukaan", +DlgLnkNoAnchors : "(Ei ankkureita tässä dokumentissa)", +DlgLnkEMail : "Sähköpostiosoite", +DlgLnkEMailSubject : "Aihe", +DlgLnkEMailBody : "Viesti", +DlgLnkUpload : "Lisää tiedosto", +DlgLnkBtnUpload : "Lähetä palvelimelle", + +DlgLnkTarget : "Kohde", +DlgLnkTargetFrame : "", +DlgLnkTargetPopup : "", +DlgLnkTargetBlank : "Uusi ikkuna (_blank)", +DlgLnkTargetParent : "Emoikkuna (_parent)", +DlgLnkTargetSelf : "Sama ikkuna (_self)", +DlgLnkTargetTop : "Päällimmäisin ikkuna (_top)", +DlgLnkTargetFrameName : "Kohdekehyksen nimi", +DlgLnkPopWinName : "Popup ikkunan nimi", +DlgLnkPopWinFeat : "Popup ikkunan ominaisuudet", +DlgLnkPopResize : "Venytettävä", +DlgLnkPopLocation : "Osoiterivi", +DlgLnkPopMenu : "Valikkorivi", +DlgLnkPopScroll : "Vierityspalkit", +DlgLnkPopStatus : "Tilarivi", +DlgLnkPopToolbar : "Vakiopainikkeet", +DlgLnkPopFullScrn : "Täysi ikkuna (IE)", +DlgLnkPopDependent : "Riippuva (Netscape)", +DlgLnkPopWidth : "Leveys", +DlgLnkPopHeight : "Korkeus", +DlgLnkPopLeft : "Vasemmalta (px)", +DlgLnkPopTop : "Ylhäältä (px)", + +DlnLnkMsgNoUrl : "Linkille on kirjoitettava URL", +DlnLnkMsgNoEMail : "Kirjoita sähköpostiosoite", +DlnLnkMsgNoAnchor : "Valitse ankkuri", +DlnLnkMsgInvPopName : "Popup-ikkunan nimi pitää alkaa aakkosella ja ei saa sisältää välejä", + +// Color Dialog +DlgColorTitle : "Valitse väri", +DlgColorBtnClear : "Tyhjennä", +DlgColorHighlight : "Kohdalla", +DlgColorSelected : "Valittu", + +// Smiley Dialog +DlgSmileyTitle : "Lisää hymiö", + +// Special Character Dialog +DlgSpecialCharTitle : "Valitse erikoismerkki", + +// Table Dialog +DlgTableTitle : "Taulun ominaisuudet", +DlgTableRows : "Rivit", +DlgTableColumns : "Sarakkeet", +DlgTableBorder : "Rajan paksuus", +DlgTableAlign : "Kohdistus", +DlgTableAlignNotSet : "", +DlgTableAlignLeft : "Vasemmalle", +DlgTableAlignCenter : "Keskelle", +DlgTableAlignRight : "Oikealle", +DlgTableWidth : "Leveys", +DlgTableWidthPx : "pikseliä", +DlgTableWidthPc : "prosenttia", +DlgTableHeight : "Korkeus", +DlgTableCellSpace : "Solujen väli", +DlgTableCellPad : "Solujen sisennys", +DlgTableCaption : "Otsikko", +DlgTableSummary : "Yhteenveto", + +// Table Cell Dialog +DlgCellTitle : "Solun ominaisuudet", +DlgCellWidth : "Leveys", +DlgCellWidthPx : "pikseliä", +DlgCellWidthPc : "prosenttia", +DlgCellHeight : "Korkeus", +DlgCellWordWrap : "Tekstikierrätys", +DlgCellWordWrapNotSet : "", +DlgCellWordWrapYes : "Kyllä", +DlgCellWordWrapNo : "Ei", +DlgCellHorAlign : "Vaakakohdistus", +DlgCellHorAlignNotSet : "", +DlgCellHorAlignLeft : "Vasemmalle", +DlgCellHorAlignCenter : "Keskelle", +DlgCellHorAlignRight: "Oikealle", +DlgCellVerAlign : "Pystykohdistus", +DlgCellVerAlignNotSet : "", +DlgCellVerAlignTop : "Ylös", +DlgCellVerAlignMiddle : "Keskelle", +DlgCellVerAlignBottom : "Alas", +DlgCellVerAlignBaseline : "Tekstin alas", +DlgCellRowSpan : "Rivin jatkuvuus", +DlgCellCollSpan : "Sarakkeen jatkuvuus", +DlgCellBackColor : "Taustaväri", +DlgCellBorderColor : "Rajan väri", +DlgCellBtnSelect : "Valitse...", + +// Find and Replace Dialog +DlgFindAndReplaceTitle : "Etsi ja korvaa", + +// Find Dialog +DlgFindTitle : "Etsi", +DlgFindFindBtn : "Etsi", +DlgFindNotFoundMsg : "Etsittyä tekstiä ei löytynyt.", + +// Replace Dialog +DlgReplaceTitle : "Korvaa", +DlgReplaceFindLbl : "Etsi mitä:", +DlgReplaceReplaceLbl : "Korvaa tällä:", +DlgReplaceCaseChk : "Sama kirjainkoko", +DlgReplaceReplaceBtn : "Korvaa", +DlgReplaceReplAllBtn : "Korvaa kaikki", +DlgReplaceWordChk : "Koko sana", + +// Paste Operations / Dialog +PasteErrorCut : "Selaimesi turva-asetukset eivät salli editorin toteuttaa leikkaamista. Käytä näppäimistöä leikkaamiseen (Ctrl+X).", +PasteErrorCopy : "Selaimesi turva-asetukset eivät salli editorin toteuttaa kopioimista. Käytä näppäimistöä kopioimiseen (Ctrl+C).", + +PasteAsText : "Liitä tekstinä", +PasteFromWord : "Liitä Wordista", + +DlgPasteMsg2 : "Liitä painamalla (Ctrl+V) ja painamalla OK.", +DlgPasteSec : "Selaimesi turva-asetukset eivät salli editorin käyttää leikepöytää suoraan. Sinun pitää suorittaa liittäminen tässä ikkunassa.", +DlgPasteIgnoreFont : "Jätä huomioimatta fonttimääritykset", +DlgPasteRemoveStyles : "Poista tyylimääritykset", +DlgPasteCleanBox : "Tyhjennä", + +// Color Picker +ColorAutomatic : "Automaattinen", +ColorMoreColors : "Lisää värejä...", + +// Document Properties +DocProps : "Dokumentin ominaisuudet", + +// Anchor Dialog +DlgAnchorTitle : "Ankkurin ominaisuudet", +DlgAnchorName : "Nimi", +DlgAnchorErrorName : "Ankkurille on kirjoitettava nimi", + +// Speller Pages Dialog +DlgSpellNotInDic : "Ei sanakirjassa", +DlgSpellChangeTo : "Vaihda", +DlgSpellBtnIgnore : "Jätä huomioimatta", +DlgSpellBtnIgnoreAll : "Jätä kaikki huomioimatta", +DlgSpellBtnReplace : "Korvaa", +DlgSpellBtnReplaceAll : "Korvaa kaikki", +DlgSpellBtnUndo : "Kumoa", +DlgSpellNoSuggestions : "Ei ehdotuksia", +DlgSpellProgress : "Tarkistus käynnissä...", +DlgSpellNoMispell : "Tarkistus valmis: Ei virheitä", +DlgSpellNoChanges : "Tarkistus valmis: Yhtään sanaa ei muutettu", +DlgSpellOneChange : "Tarkistus valmis: Yksi sana muutettiin", +DlgSpellManyChanges : "Tarkistus valmis: %1 sanaa muutettiin", + +IeSpellDownload : "Oikeinkirjoituksen tarkistusta ei ole asennettu. Haluatko ladata sen nyt?", + +// Button Dialog +DlgButtonText : "Teksti (arvo)", +DlgButtonType : "Tyyppi", +DlgButtonTypeBtn : "Painike", +DlgButtonTypeSbm : "Lähetä", +DlgButtonTypeRst : "Tyhjennä", + +// Checkbox and Radio Button Dialogs +DlgCheckboxName : "Nimi", +DlgCheckboxValue : "Arvo", +DlgCheckboxSelected : "Valittu", + +// Form Dialog +DlgFormName : "Nimi", +DlgFormAction : "Toiminto", +DlgFormMethod : "Tapa", + +// Select Field Dialog +DlgSelectName : "Nimi", +DlgSelectValue : "Arvo", +DlgSelectSize : "Koko", +DlgSelectLines : "Rivit", +DlgSelectChkMulti : "Salli usea valinta", +DlgSelectOpAvail : "Ominaisuudet", +DlgSelectOpText : "Teksti", +DlgSelectOpValue : "Arvo", +DlgSelectBtnAdd : "Lisää", +DlgSelectBtnModify : "Muuta", +DlgSelectBtnUp : "Ylös", +DlgSelectBtnDown : "Alas", +DlgSelectBtnSetValue : "Aseta valituksi", +DlgSelectBtnDelete : "Poista", + +// Textarea Dialog +DlgTextareaName : "Nimi", +DlgTextareaCols : "Sarakkeita", +DlgTextareaRows : "Rivejä", + +// Text Field Dialog +DlgTextName : "Nimi", +DlgTextValue : "Arvo", +DlgTextCharWidth : "Leveys", +DlgTextMaxChars : "Maksimi merkkimäärä", +DlgTextType : "Tyyppi", +DlgTextTypeText : "Teksti", +DlgTextTypePass : "Salasana", + +// Hidden Field Dialog +DlgHiddenName : "Nimi", +DlgHiddenValue : "Arvo", + +// Bulleted List Dialog +BulletedListProp : "Luettelon ominaisuudet", +NumberedListProp : "Numeroinnin ominaisuudet", +DlgLstStart : "Alku", +DlgLstType : "Tyyppi", +DlgLstTypeCircle : "Kehä", +DlgLstTypeDisc : "Ympyrä", +DlgLstTypeSquare : "Neliö", +DlgLstTypeNumbers : "Numerot (1, 2, 3)", +DlgLstTypeLCase : "Pienet kirjaimet (a, b, c)", +DlgLstTypeUCase : "Isot kirjaimet (A, B, C)", +DlgLstTypeSRoman : "Pienet roomalaiset numerot (i, ii, iii)", +DlgLstTypeLRoman : "Isot roomalaiset numerot (Ii, II, III)", + +// Document Properties Dialog +DlgDocGeneralTab : "Yleiset", +DlgDocBackTab : "Tausta", +DlgDocColorsTab : "Värit ja marginaalit", +DlgDocMetaTab : "Meta-tieto", + +DlgDocPageTitle : "Sivun nimi", +DlgDocLangDir : "Kielen suunta", +DlgDocLangDirLTR : "Vasemmalta oikealle (LTR)", +DlgDocLangDirRTL : "Oikealta vasemmalle (RTL)", +DlgDocLangCode : "Kielikoodi", +DlgDocCharSet : "Merkistökoodaus", +DlgDocCharSetCE : "Keskieurooppalainen", +DlgDocCharSetCT : "Kiina, perinteinen (Big5)", +DlgDocCharSetCR : "Kyrillinen", +DlgDocCharSetGR : "Kreikka", +DlgDocCharSetJP : "Japani", +DlgDocCharSetKR : "Korealainen", +DlgDocCharSetTR : "Turkkilainen", +DlgDocCharSetUN : "Unicode (UTF-8)", +DlgDocCharSetWE : "Länsieurooppalainen", +DlgDocCharSetOther : "Muu merkistökoodaus", + +DlgDocDocType : "Dokumentin tyyppi", +DlgDocDocTypeOther : "Muu dokumentin tyyppi", +DlgDocIncXHTML : "Lisää XHTML julistukset", +DlgDocBgColor : "Taustaväri", +DlgDocBgImage : "Taustakuva", +DlgDocBgNoScroll : "Paikallaanpysyvä tausta", +DlgDocCText : "Teksti", +DlgDocCLink : "Linkki", +DlgDocCVisited : "Vierailtu linkki", +DlgDocCActive : "Aktiivinen linkki", +DlgDocMargins : "Sivun marginaalit", +DlgDocMaTop : "Ylä", +DlgDocMaLeft : "Vasen", +DlgDocMaRight : "Oikea", +DlgDocMaBottom : "Ala", +DlgDocMeIndex : "Hakusanat (pilkulla erotettuna)", +DlgDocMeDescr : "Kuvaus", +DlgDocMeAuthor : "Tekijä", +DlgDocMeCopy : "Tekijänoikeudet", +DlgDocPreview : "Esikatselu", + +// Templates Dialog +Templates : "Pohjat", +DlgTemplatesTitle : "Sisältöpohjat", +DlgTemplatesSelMsg : "Valitse pohja editoriin
    (aiempi sisältö menetetään):", +DlgTemplatesLoading : "Ladataan listaa pohjista. Hetkinen...", +DlgTemplatesNoTpl : "(Ei määriteltyjä pohjia)", +DlgTemplatesReplace : "Korvaa editorin koko sisältö", + +// About Dialog +DlgAboutAboutTab : "Editorista", +DlgAboutBrowserInfoTab : "Selaimen tiedot", +DlgAboutLicenseTab : "Lisenssi", +DlgAboutVersion : "versio", +DlgAboutInfo : "Lisää tietoa osoitteesta" +}; diff --git a/FCKeditor/editor/lang/fo.js b/FCKeditor/editor/lang/fo.js new file mode 100644 index 0000000..bcde2f9 --- /dev/null +++ b/FCKeditor/editor/lang/fo.js @@ -0,0 +1,516 @@ +/* + * FCKeditor - The text editor for Internet - http://www.fckeditor.net + * Copyright (C) 2003-2007 Frederico Caldeira Knabben + * + * == BEGIN LICENSE == + * + * Licensed under the terms of any of the following licenses at your + * choice: + * + * - GNU General Public License Version 2 or later (the "GPL") + * http://www.gnu.org/licenses/gpl.html + * + * - GNU Lesser General Public License Version 2.1 or later (the "LGPL") + * http://www.gnu.org/licenses/lgpl.html + * + * - Mozilla Public License Version 1.1 or later (the "MPL") + * http://www.mozilla.org/MPL/MPL-1.1.html + * + * == END LICENSE == + * + * Faroese language file. + */ + +var FCKLang = +{ +// Language direction : "ltr" (left to right) or "rtl" (right to left). +Dir : "ltr", + +ToolbarCollapse : "Fjal amboðsbjálkan", +ToolbarExpand : "Vís amboðsbjálkan", + +// Toolbar Items and Context Menu +Save : "Goym", +NewPage : "Nýggj síða", +Preview : "Frumsýning", +Cut : "Kvett", +Copy : "Avrita", +Paste : "Innrita", +PasteText : "Innrita reinan tekst", +PasteWord : "Innrita frá Word", +Print : "Prenta", +SelectAll : "Markera alt", +RemoveFormat : "Strika sniðgeving", +InsertLinkLbl : "Tilknýti", +InsertLink : "Ger/broyt tilknýti", +RemoveLink : "Strika tilknýti", +Anchor : "Ger/broyt marknastein", +AnchorDelete : "Remove Anchor", //MISSING +InsertImageLbl : "Myndir", +InsertImage : "Set inn/broyt mynd", +InsertFlashLbl : "Flash", +InsertFlash : "Set inn/broyt Flash", +InsertTableLbl : "Tabell", +InsertTable : "Set inn/broyt tabell", +InsertLineLbl : "Linja", +InsertLine : "Ger vatnrætta linju", +InsertSpecialCharLbl: "Sertekn", +InsertSpecialChar : "Set inn sertekn", +InsertSmileyLbl : "Smiley", +InsertSmiley : "Set inn Smiley", +About : "Um FCKeditor", +Bold : "Feit skrift", +Italic : "Skráskrift", +Underline : "Undirstrikað", +StrikeThrough : "Yvirstrikað", +Subscript : "Lækkað skrift", +Superscript : "Hækkað skrift", +LeftJustify : "Vinstrasett", +CenterJustify : "Miðsett", +RightJustify : "Høgrasett", +BlockJustify : "Javnir tekstkantar", +DecreaseIndent : "Minka reglubrotarinntriv", +IncreaseIndent : "Økja reglubrotarinntriv", +Blockquote : "Blockquote", //MISSING +Undo : "Angra", +Redo : "Vend aftur", +NumberedListLbl : "Talmerktur listi", +NumberedList : "Ger/strika talmerktan lista", +BulletedListLbl : "Punktmerktur listi", +BulletedList : "Ger/strika punktmerktan lista", +ShowTableBorders : "Vís tabellbordar", +ShowDetails : "Vís í smálutum", +Style : "Typografi", +FontFormat : "Skriftsnið", +Font : "Skrift", +FontSize : "Skriftstødd", +TextColor : "Tekstlitur", +BGColor : "Bakgrundslitur", +Source : "Kelda", +Find : "Leita", +Replace : "Yvirskriva", +SpellCheck : "Kanna stavseting", +UniversalKeyboard : "Knappaborð", +PageBreakLbl : "Síðuskift", +PageBreak : "Ger síðuskift", + +Form : "Formur", +Checkbox : "Flugubein", +RadioButton : "Radioknøttur", +TextField : "Tekstteigur", +Textarea : "Tekstumráði", +HiddenField : "Fjaldur teigur", +Button : "Knøttur", +SelectionField : "Valskrá", +ImageButton : "Myndaknøttur", + +FitWindow : "Set tekstviðgera til fulla stødd", +ShowBlocks : "Show Blocks", //MISSING + +// Context Menu +EditLink : "Broyt tilknýti", +CellCM : "Meski", +RowCM : "Rað", +ColumnCM : "Kolonna", +InsertRowAfter : "Insert Row After", //MISSING +InsertRowBefore : "Insert Row Before", //MISSING +DeleteRows : "Strika røðir", +InsertColumnAfter : "Insert Column After", //MISSING +InsertColumnBefore : "Insert Column Before", //MISSING +DeleteColumns : "Strika kolonnur", +InsertCellAfter : "Insert Cell After", //MISSING +InsertCellBefore : "Insert Cell Before", //MISSING +DeleteCells : "Strika meskar", +MergeCells : "Flætta meskar", +MergeRight : "Merge Right", //MISSING +MergeDown : "Merge Down", //MISSING +HorizontalSplitCell : "Split Cell Horizontally", //MISSING +VerticalSplitCell : "Split Cell Vertically", //MISSING +TableDelete : "Strika tabell", +CellProperties : "Meskueginleikar", +TableProperties : "Tabelleginleikar", +ImageProperties : "Myndaeginleikar", +FlashProperties : "Flash eginleikar", + +AnchorProp : "Eginleikar fyri marknastein", +ButtonProp : "Eginleikar fyri knøtt", +CheckboxProp : "Eginleikar fyri flugubein", +HiddenFieldProp : "Eginleikar fyri fjaldan teig", +RadioButtonProp : "Eginleikar fyri radioknøtt", +ImageButtonProp : "Eginleikar fyri myndaknøtt", +TextFieldProp : "Eginleikar fyri tekstteig", +SelectionFieldProp : "Eginleikar fyri valskrá", +TextareaProp : "Eginleikar fyri tekstumráði", +FormProp : "Eginleikar fyri Form", + +FontFormats : "Vanligt;Sniðgivið;Adressa;Yvirskrift 1;Yvirskrift 2;Yvirskrift 3;Yvirskrift 4;Yvirskrift 5;Yvirskrift 6", + +// Alerts and Messages +ProcessingXHTML : "XHTML verður viðgjørt. Bíða við...", +Done : "Liðugt", +PasteWordConfirm : "Teksturin, royndur verður at seta inn, tykist at stava frá Word. Vilt tú reinsa tekstin, áðrenn hann verður settur inn?", +NotCompatiblePaste : "Hetta er bert tøkt í Internet Explorer 5.5 og nýggjari. Vilt tú seta tekstin inn kortini - óreinsaðan?", +UnknownToolbarItem : "Ókendur lutur í amboðsbjálkanum \"%1\"", +UnknownCommand : "Ókend kommando \"%1\"", +NotImplemented : "Hetta er ikki tøkt í hesi útgávuni", +UnknownToolbarSet : "Amboðsbjálkin \"%1\" finst ikki", +NoActiveX : "Trygdaruppsetingin í alnótskaganum kann sum er avmarka onkrar hentleikar í tekstviðgeranum. Tú mást loyva møguleikanum \"Run/Kør ActiveX controls and plug-ins\". Tú kanst uppliva feilir og ávaringar um tvørrandi hentleikar.", +BrowseServerBlocked : "Ambætarakagin kundi ikki opnast. Tryggja tær, at allar pop-up forðingar eru óvirknar.", +DialogBlocked : "Tað eyðnaðist ikki at opna samskiftisrútin. Tryggja tær, at allar pop-up forðingar eru óvirknar.", + +// Dialogs +DlgBtnOK : "Góðkent", +DlgBtnCancel : "Avlýst", +DlgBtnClose : "Lat aftur", +DlgBtnBrowseServer : "Ambætarakagi", +DlgAdvancedTag : "Fjølbroytt", +DlgOpOther : "", +DlgInfoTab : "Upplýsingar", +DlgAlertUrl : "Vinarliga veit ein URL", + +// General Dialogs Labels +DlgGenNotSet : "", +DlgGenId : "Id", +DlgGenLangDir : "Tekstkós", +DlgGenLangDirLtr : "Frá vinstru til høgru (LTR)", +DlgGenLangDirRtl : "Frá høgru til vinstru (RTL)", +DlgGenLangCode : "Málkoda", +DlgGenAccessKey : "Snarvegisknappur", +DlgGenName : "Navn", +DlgGenTabIndex : "Inntriv indeks", +DlgGenLongDescr : "Víðkað URL frágreiðing", +DlgGenClass : "Typografi klassar", +DlgGenTitle : "Vegleiðandi heiti", +DlgGenContType : "Vegleiðandi innihaldsslag", +DlgGenLinkCharset : "Atknýtt teknsett", +DlgGenStyle : "Typografi", + +// Image Dialog +DlgImgTitle : "Myndaeginleikar", +DlgImgInfoTab : "Myndaupplýsingar", +DlgImgBtnUpload : "Send til ambætaran", +DlgImgURL : "URL", +DlgImgUpload : "Send", +DlgImgAlt : "Alternativur tekstur", +DlgImgWidth : "Breidd", +DlgImgHeight : "Hædd", +DlgImgLockRatio : "Læs lutfallið", +DlgBtnResetSize : "Upprunastødd", +DlgImgBorder : "Bordi", +DlgImgHSpace : "Høgri breddi", +DlgImgVSpace : "Vinstri breddi", +DlgImgAlign : "Justering", +DlgImgAlignLeft : "Vinstra", +DlgImgAlignAbsBottom: "Abs botnur", +DlgImgAlignAbsMiddle: "Abs miðja", +DlgImgAlignBaseline : "Basislinja", +DlgImgAlignBottom : "Botnur", +DlgImgAlignMiddle : "Miðja", +DlgImgAlignRight : "Høgra", +DlgImgAlignTextTop : "Tekst toppur", +DlgImgAlignTop : "Ovast", +DlgImgPreview : "Frumsýning", +DlgImgAlertUrl : "Rita slóðina til myndina", +DlgImgLinkTab : "Tilknýti", + +// Flash Dialog +DlgFlashTitle : "Flash eginleikar", +DlgFlashChkPlay : "Avspælingin byrjar sjálv", +DlgFlashChkLoop : "Endurspæl", +DlgFlashChkMenu : "Ger Flash skrá virkna", +DlgFlashScale : "Skalering", +DlgFlashScaleAll : "Vís alt", +DlgFlashScaleNoBorder : "Eingin bordi", +DlgFlashScaleFit : "Neyv skalering", + +// Link Dialog +DlgLnkWindowTitle : "Tilknýti", +DlgLnkInfoTab : "Tilknýtis upplýsingar", +DlgLnkTargetTab : "Mál", + +DlgLnkType : "Tilknýtisslag", +DlgLnkTypeURL : "URL", +DlgLnkTypeAnchor : "Tilknýti til marknastein í tekstinum", +DlgLnkTypeEMail : "Teldupostur", +DlgLnkProto : "Protokoll", +DlgLnkProtoOther : "", +DlgLnkURL : "URL", +DlgLnkAnchorSel : "Vel ein marknastein", +DlgLnkAnchorByName : "Eftir navni á marknasteini", +DlgLnkAnchorById : "Eftir element Id", +DlgLnkNoAnchors : "(Eingir marknasteinar eru í hesum dokumentið)", +DlgLnkEMail : "Teldupost-adressa", +DlgLnkEMailSubject : "Evni", +DlgLnkEMailBody : "Breyðtekstur", +DlgLnkUpload : "Send til ambætaran", +DlgLnkBtnUpload : "Send til ambætaran", + +DlgLnkTarget : "Mál", +DlgLnkTargetFrame : "", +DlgLnkTargetPopup : "", +DlgLnkTargetBlank : "Nýtt vindeyga (_blank)", +DlgLnkTargetParent : "Upphavliga vindeygað (_parent)", +DlgLnkTargetSelf : "Sama vindeygað (_self)", +DlgLnkTargetTop : "Alt vindeygað (_top)", +DlgLnkTargetFrameName : "Vís navn vindeygans", +DlgLnkPopWinName : "Popup vindeygans navn", +DlgLnkPopWinFeat : "Popup vindeygans víðkaðu eginleikar", +DlgLnkPopResize : "Kann broyta stødd", +DlgLnkPopLocation : "Adressulinja", +DlgLnkPopMenu : "Skrábjálki", +DlgLnkPopScroll : "Rullibjálki", +DlgLnkPopStatus : "Støðufrágreiðingarbjálki", +DlgLnkPopToolbar : "Amboðsbjálki", +DlgLnkPopFullScrn : "Fullur skermur (IE)", +DlgLnkPopDependent : "Bundið (Netscape)", +DlgLnkPopWidth : "Breidd", +DlgLnkPopHeight : "Hædd", +DlgLnkPopLeft : "Frástøða frá vinstru", +DlgLnkPopTop : "Frástøða frá íerva", + +DlnLnkMsgNoUrl : "Vinarliga skriva tilknýti (URL)", +DlnLnkMsgNoEMail : "Vinarliga skriva teldupost-adressu", +DlnLnkMsgNoAnchor : "Vinarliga vel marknastein", +DlnLnkMsgInvPopName : "Popup navnið má byrja við bókstavi og má ikki hava millumrúm", + +// Color Dialog +DlgColorTitle : "Vel lit", +DlgColorBtnClear : "Strika alt", +DlgColorHighlight : "Framhevja", +DlgColorSelected : "Valt", + +// Smiley Dialog +DlgSmileyTitle : "Vel Smiley", + +// Special Character Dialog +DlgSpecialCharTitle : "Vel sertekn", + +// Table Dialog +DlgTableTitle : "Eginleikar fyri tabell", +DlgTableRows : "Røðir", +DlgTableColumns : "Kolonnur", +DlgTableBorder : "Bordabreidd", +DlgTableAlign : "Justering", +DlgTableAlignNotSet : "", +DlgTableAlignLeft : "Vinstrasett", +DlgTableAlignCenter : "Miðsett", +DlgTableAlignRight : "Høgrasett", +DlgTableWidth : "Breidd", +DlgTableWidthPx : "pixels", +DlgTableWidthPc : "prosent", +DlgTableHeight : "Hædd", +DlgTableCellSpace : "Fjarstøða millum meskar", +DlgTableCellPad : "Meskubreddi", +DlgTableCaption : "Tabellfrágreiðing", +DlgTableSummary : "Samandráttur", + +// Table Cell Dialog +DlgCellTitle : "Mesku eginleikar", +DlgCellWidth : "Breidd", +DlgCellWidthPx : "pixels", +DlgCellWidthPc : "prosent", +DlgCellHeight : "Hædd", +DlgCellWordWrap : "Orðkloyving", +DlgCellWordWrapNotSet : "", +DlgCellWordWrapYes : "Ja", +DlgCellWordWrapNo : "Nei", +DlgCellHorAlign : "Vatnrøtt justering", +DlgCellHorAlignNotSet : "", +DlgCellHorAlignLeft : "Vinstrasett", +DlgCellHorAlignCenter : "Miðsett", +DlgCellHorAlignRight: "Høgrasett", +DlgCellVerAlign : "Lodrøtt justering", +DlgCellVerAlignNotSet : "", +DlgCellVerAlignTop : "Ovast", +DlgCellVerAlignMiddle : "Miðjan", +DlgCellVerAlignBottom : "Niðast", +DlgCellVerAlignBaseline : "Basislinja", +DlgCellRowSpan : "Røðir, meskin fevnir um", +DlgCellCollSpan : "Kolonnur, meskin fevnir um", +DlgCellBackColor : "Bakgrundslitur", +DlgCellBorderColor : "Litur á borda", +DlgCellBtnSelect : "Vel...", + +// Find and Replace Dialog +DlgFindAndReplaceTitle : "Find and Replace", //MISSING + +// Find Dialog +DlgFindTitle : "Finn", +DlgFindFindBtn : "Finn", +DlgFindNotFoundMsg : "Leititeksturin varð ikki funnin", + +// Replace Dialog +DlgReplaceTitle : "Yvirskriva", +DlgReplaceFindLbl : "Finn:", +DlgReplaceReplaceLbl : "Yvirskriva við:", +DlgReplaceCaseChk : "Munur á stórum og smáðum bókstavum", +DlgReplaceReplaceBtn : "Yvirskriva", +DlgReplaceReplAllBtn : "Yvirskriva alt", +DlgReplaceWordChk : "Bert heil orð", + +// Paste Operations / Dialog +PasteErrorCut : "Trygdaruppseting alnótskagans forðar tekstviðgeranum í at kvetta tekstin. vinarliga nýt knappaborðið til at kvetta tekstin (CTRL+X).", +PasteErrorCopy : "Trygdaruppseting alnótskagans forðar tekstviðgeranum í at avrita tekstin. Vinarliga nýt knappaborðið til at avrita tekstin (CTRL+C).", + +PasteAsText : "Innrita som reinan tekst", +PasteFromWord : "Innrita fra Word", + +DlgPasteMsg2 : "Vinarliga koyr tekstin í hendan rútin við knappaborðinum (CTRL+V) og klikk á Góðtak.", +DlgPasteSec : "Because of your browser security settings, the editor is not able to access your clipboard data directly. You are required to paste it again in this window.", //MISSING +DlgPasteIgnoreFont : "Forfjóna Font definitiónirnar", +DlgPasteRemoveStyles : "Strika Styles definitiónir", +DlgPasteCleanBox : "Reinskanarkassi", + +// Color Picker +ColorAutomatic : "Av sær sjálvum", +ColorMoreColors : "Fleiri litir...", + +// Document Properties +DocProps : "Eginleikar fyri dokument", + +// Anchor Dialog +DlgAnchorTitle : "Eginleikar fyri marknastein", +DlgAnchorName : "Heiti marknasteinsins", +DlgAnchorErrorName : "Vinarliga rita marknasteinsins heiti", + +// Speller Pages Dialog +DlgSpellNotInDic : "Finst ikki í orðabókini", +DlgSpellChangeTo : "Broyt til", +DlgSpellBtnIgnore : "Forfjóna", +DlgSpellBtnIgnoreAll : "Forfjóna alt", +DlgSpellBtnReplace : "Yvirskriva", +DlgSpellBtnReplaceAll : "Yvirskriva alt", +DlgSpellBtnUndo : "Angra", +DlgSpellNoSuggestions : "- Einki uppskot -", +DlgSpellProgress : "Rættstavarin arbeiðir...", +DlgSpellNoMispell : "Rættstavarain liðugur: Eingin feilur funnin", +DlgSpellNoChanges : "Rættstavarain liðugur: Einki orð varð broytt", +DlgSpellOneChange : "Rættstavarain liðugur: Eitt orð er broytt", +DlgSpellManyChanges : "Rættstavarain liðugur: %1 orð broytt", + +IeSpellDownload : "Rættstavarin er ikki tøkur í tekstviðgeranum. Vilt tú heinta hann nú?", + +// Button Dialog +DlgButtonText : "Tekstur", +DlgButtonType : "Slag", +DlgButtonTypeBtn : "Knøttur", +DlgButtonTypeSbm : "Send", +DlgButtonTypeRst : "Nullstilla", + +// Checkbox and Radio Button Dialogs +DlgCheckboxName : "Navn", +DlgCheckboxValue : "Virði", +DlgCheckboxSelected : "Valt", + +// Form Dialog +DlgFormName : "Navn", +DlgFormAction : "Hending", +DlgFormMethod : "Háttur", + +// Select Field Dialog +DlgSelectName : "Navn", +DlgSelectValue : "Virði", +DlgSelectSize : "Stødd", +DlgSelectLines : "Linjur", +DlgSelectChkMulti : "Loyv fleiri valmøguleikum samstundis", +DlgSelectOpAvail : "Tøkir møguleikar", +DlgSelectOpText : "Tekstur", +DlgSelectOpValue : "Virði", +DlgSelectBtnAdd : "Legg afturat", +DlgSelectBtnModify : "Broyt", +DlgSelectBtnUp : "Upp", +DlgSelectBtnDown : "Niður", +DlgSelectBtnSetValue : "Set sum valt virði", +DlgSelectBtnDelete : "Strika", + +// Textarea Dialog +DlgTextareaName : "Navn", +DlgTextareaCols : "kolonnur", +DlgTextareaRows : "røðir", + +// Text Field Dialog +DlgTextName : "Navn", +DlgTextValue : "Virði", +DlgTextCharWidth : "Breidd (sjónlig tekn)", +DlgTextMaxChars : "Mest loyvdu tekn", +DlgTextType : "Slag", +DlgTextTypeText : "Tekstur", +DlgTextTypePass : "Loyniorð", + +// Hidden Field Dialog +DlgHiddenName : "Navn", +DlgHiddenValue : "Virði", + +// Bulleted List Dialog +BulletedListProp : "Eginleikar fyri punktmerktan lista", +NumberedListProp : "Eginleikar fyri talmerktan lista", +DlgLstStart : "Byrjan", +DlgLstType : "Slag", +DlgLstTypeCircle : "Sirkul", +DlgLstTypeDisc : "Fyltur sirkul", +DlgLstTypeSquare : "Fjórhyrningur", +DlgLstTypeNumbers : "Talmerkt (1, 2, 3)", +DlgLstTypeLCase : "Smáir bókstavir (a, b, c)", +DlgLstTypeUCase : "Stórir bókstavir (A, B, C)", +DlgLstTypeSRoman : "Smá rómaratøl (i, ii, iii)", +DlgLstTypeLRoman : "Stór rómaratøl (I, II, III)", + +// Document Properties Dialog +DlgDocGeneralTab : "Generelt", +DlgDocBackTab : "Bakgrund", +DlgDocColorsTab : "Litir og breddar", +DlgDocMetaTab : "META-upplýsingar", + +DlgDocPageTitle : "Síðuheiti", +DlgDocLangDir : "Tekstkós", +DlgDocLangDirLTR : "Frá vinstru móti høgru (LTR)", +DlgDocLangDirRTL : "Frá høgru móti vinstru (RTL)", +DlgDocLangCode : "Málkoda", +DlgDocCharSet : "Teknsett koda", +DlgDocCharSetCE : "Miðeuropa", +DlgDocCharSetCT : "Kinesiskt traditionelt (Big5)", +DlgDocCharSetCR : "Cyrilliskt", +DlgDocCharSetGR : "Grikst", +DlgDocCharSetJP : "Japanskt", +DlgDocCharSetKR : "Koreanskt", +DlgDocCharSetTR : "Turkiskt", +DlgDocCharSetUN : "UNICODE (UTF-8)", +DlgDocCharSetWE : "Vestureuropa", +DlgDocCharSetOther : "Onnur teknsett koda", + +DlgDocDocType : "Dokumentslag yvirskrift", +DlgDocDocTypeOther : "Annað dokumentslag yvirskrift", +DlgDocIncXHTML : "Viðfest XHTML deklaratiónir", +DlgDocBgColor : "Bakgrundslitur", +DlgDocBgImage : "Leið til bakgrundsmynd (URL)", +DlgDocBgNoScroll : "Læst bakgrund (rullar ikki)", +DlgDocCText : "Tekstur", +DlgDocCLink : "Tilknýti", +DlgDocCVisited : "Vitjaði tilknýti", +DlgDocCActive : "Virkin tilknýti", +DlgDocMargins : "Síðubreddar", +DlgDocMaTop : "Ovast", +DlgDocMaLeft : "Vinstra", +DlgDocMaRight : "Høgra", +DlgDocMaBottom : "Niðast", +DlgDocMeIndex : "Dokument index lyklaorð (sundurbýtt við komma)", +DlgDocMeDescr : "Dokumentlýsing", +DlgDocMeAuthor : "Høvundur", +DlgDocMeCopy : "Upphavsrættindi", +DlgDocPreview : "Frumsýning", + +// Templates Dialog +Templates : "Skabelónir", +DlgTemplatesTitle : "Innihaldsskabelónir", +DlgTemplatesSelMsg : "Vinarliga vel ta skabelón, ið skal opnast í tekstviðgeranum
    (Hetta yvirskrivar núverandi innihald):", +DlgTemplatesLoading : "Heinti yvirlit yvir skabelónir. Vinarliga bíða við...", +DlgTemplatesNoTpl : "(Ongar skabelónir tøkar)", +DlgTemplatesReplace : "Yvirskriva núverandi innihald", + +// About Dialog +DlgAboutAboutTab : "Um", +DlgAboutBrowserInfoTab : "Upplýsingar um alnótskagan", +DlgAboutLicenseTab : "License", +DlgAboutVersion : "version", +DlgAboutInfo : "Fyri fleiri upplýsingar, far til" +}; diff --git a/FCKeditor/editor/lang/fr.js b/FCKeditor/editor/lang/fr.js new file mode 100644 index 0000000..2e8c90f --- /dev/null +++ b/FCKeditor/editor/lang/fr.js @@ -0,0 +1,516 @@ +/* + * FCKeditor - The text editor for Internet - http://www.fckeditor.net + * Copyright (C) 2003-2007 Frederico Caldeira Knabben + * + * == BEGIN LICENSE == + * + * Licensed under the terms of any of the following licenses at your + * choice: + * + * - GNU General Public License Version 2 or later (the "GPL") + * http://www.gnu.org/licenses/gpl.html + * + * - GNU Lesser General Public License Version 2.1 or later (the "LGPL") + * http://www.gnu.org/licenses/lgpl.html + * + * - Mozilla Public License Version 1.1 or later (the "MPL") + * http://www.mozilla.org/MPL/MPL-1.1.html + * + * == END LICENSE == + * + * French language file. + */ + +var FCKLang = +{ +// Language direction : "ltr" (left to right) or "rtl" (right to left). +Dir : "ltr", + +ToolbarCollapse : "Masquer Outils", +ToolbarExpand : "Afficher Outils", + +// Toolbar Items and Context Menu +Save : "Enregistrer", +NewPage : "Nouvelle page", +Preview : "Prévisualisation", +Cut : "Couper", +Copy : "Copier", +Paste : "Coller", +PasteText : "Coller comme texte", +PasteWord : "Coller de Word", +Print : "Imprimer", +SelectAll : "Tout sélectionner", +RemoveFormat : "Supprimer le format", +InsertLinkLbl : "Lien", +InsertLink : "Insérer/modifier le lien", +RemoveLink : "Supprimer le lien", +Anchor : "Insérer/modifier l'ancre", +AnchorDelete : "Supprimer l'ancre", +InsertImageLbl : "Image", +InsertImage : "Insérer/modifier l'image", +InsertFlashLbl : "Animation Flash", +InsertFlash : "Insérer/modifier l'animation Flash", +InsertTableLbl : "Tableau", +InsertTable : "Insérer/modifier le tableau", +InsertLineLbl : "Séparateur", +InsertLine : "Insérer un séparateur", +InsertSpecialCharLbl: "Caractères spéciaux", +InsertSpecialChar : "Insérer un caractère spécial", +InsertSmileyLbl : "Smiley", +InsertSmiley : "Insérer un Smiley", +About : "A propos de FCKeditor", +Bold : "Gras", +Italic : "Italique", +Underline : "Souligné", +StrikeThrough : "Barré", +Subscript : "Indice", +Superscript : "Exposant", +LeftJustify : "Aligné à gauche", +CenterJustify : "Centré", +RightJustify : "Aligné à Droite", +BlockJustify : "Texte justifié", +DecreaseIndent : "Diminuer le retrait", +IncreaseIndent : "Augmenter le retrait", +Blockquote : "Citation", +Undo : "Annuler", +Redo : "Refaire", +NumberedListLbl : "Liste numérotée", +NumberedList : "Insérer/supprimer la liste numérotée", +BulletedListLbl : "Liste à puces", +BulletedList : "Insérer/supprimer la liste à puces", +ShowTableBorders : "Afficher les bordures du tableau", +ShowDetails : "Afficher les caractères invisibles", +Style : "Style", +FontFormat : "Format", +Font : "Police", +FontSize : "Taille", +TextColor : "Couleur de caractère", +BGColor : "Couleur de fond", +Source : "Source", +Find : "Chercher", +Replace : "Remplacer", +SpellCheck : "Orthographe", +UniversalKeyboard : "Clavier universel", +PageBreakLbl : "Saut de page", +PageBreak : "Insérer un saut de page", + +Form : "Formulaire", +Checkbox : "Case à cocher", +RadioButton : "Bouton radio", +TextField : "Champ texte", +Textarea : "Zone de texte", +HiddenField : "Champ caché", +Button : "Bouton", +SelectionField : "Liste/menu", +ImageButton : "Bouton image", + +FitWindow : "Edition pleine page", +ShowBlocks : "Afficher les blocs", + +// Context Menu +EditLink : "Modifier le lien", +CellCM : "Cellule", +RowCM : "Ligne", +ColumnCM : "Colonne", +InsertRowAfter : "Insérer une ligne après", +InsertRowBefore : "Insérer une ligne avant", +DeleteRows : "Supprimer des lignes", +InsertColumnAfter : "Insérer une colonne après", +InsertColumnBefore : "Insérer une colonne avant", +DeleteColumns : "Supprimer des colonnes", +InsertCellAfter : "Insérer une cellule après", +InsertCellBefore : "Insérer une cellule avant", +DeleteCells : "Supprimer des cellules", +MergeCells : "Fusionner les cellules", +MergeRight : "Fusionner à droite", +MergeDown : "Fusionner en bas", +HorizontalSplitCell : "Scinder la cellule horizontalement", +VerticalSplitCell : "Scinder la cellule verticalement", +TableDelete : "Supprimer le tableau", +CellProperties : "Propriétés de cellule", +TableProperties : "Propriétés du tableau", +ImageProperties : "Propriétés de l'image", +FlashProperties : "Propriétés de l'animation Flash", + +AnchorProp : "Propriétés de l'ancre", +ButtonProp : "Propriétés du bouton", +CheckboxProp : "Propriétés de la case à cocher", +HiddenFieldProp : "Propriétés du champ caché", +RadioButtonProp : "Propriétés du bouton radio", +ImageButtonProp : "Propriétés du bouton image", +TextFieldProp : "Propriétés du champ texte", +SelectionFieldProp : "Propriétés de la liste/du menu", +TextareaProp : "Propriétés de la zone de texte", +FormProp : "Propriétés du formulaire", + +FontFormats : "Normal;Formaté;Adresse;En-tête 1;En-tête 2;En-tête 3;En-tête 4;En-tête 5;En-tête 6;Normal (DIV)", + +// Alerts and Messages +ProcessingXHTML : "Calcul XHTML. Veuillez patienter...", +Done : "Terminé", +PasteWordConfirm : "Le texte à coller semble provenir de Word. Désirez-vous le nettoyer avant de coller?", +NotCompatiblePaste : "Cette commande nécessite Internet Explorer version 5.5 minimum. Souhaitez-vous coller sans nettoyage?", +UnknownToolbarItem : "Elément de barre d'outil inconnu \"%1\"", +UnknownCommand : "Nom de commande inconnu \"%1\"", +NotImplemented : "Commande non encore écrite", +UnknownToolbarSet : "La barre d'outils \"%1\" n'existe pas", +NoActiveX : "Les paramètres de sécurité de votre navigateur peuvent limiter quelques fonctionnalités de l'éditeur. Veuillez activer l'option \"Exécuter les contrôles ActiveX et les plug-ins\". Il se peut que vous rencontriez des erreurs et remarquiez quelques limitations.", +BrowseServerBlocked : "Le navigateur n'a pas pu être ouvert. Assurez-vous que les bloqueurs de popups soient désactivés.", +DialogBlocked : "La fenêtre de dialogue n'a pas pu s'ouvrir. Assurez-vous que les bloqueurs de popups soient désactivés.", + +// Dialogs +DlgBtnOK : "OK", +DlgBtnCancel : "Annuler", +DlgBtnClose : "Fermer", +DlgBtnBrowseServer : "Parcourir le serveur", +DlgAdvancedTag : "Avancé", +DlgOpOther : "", +DlgInfoTab : "Info", +DlgAlertUrl : "Veuillez saisir l'URL", + +// General Dialogs Labels +DlgGenNotSet : "", +DlgGenId : "Id", +DlgGenLangDir : "Sens d'écriture", +DlgGenLangDirLtr : "De gauche à droite (LTR)", +DlgGenLangDirRtl : "De droite à gauche (RTL)", +DlgGenLangCode : "Code langue", +DlgGenAccessKey : "Equivalent clavier", +DlgGenName : "Nom", +DlgGenTabIndex : "Ordre de tabulation", +DlgGenLongDescr : "URL de description longue", +DlgGenClass : "Classes de feuilles de style", +DlgGenTitle : "Titre", +DlgGenContType : "Type de contenu", +DlgGenLinkCharset : "Encodage de caractère", +DlgGenStyle : "Style", + +// Image Dialog +DlgImgTitle : "Propriétés de l'image", +DlgImgInfoTab : "Informations sur l'image", +DlgImgBtnUpload : "Envoyer sur le serveur", +DlgImgURL : "URL", +DlgImgUpload : "Télécharger", +DlgImgAlt : "Texte de remplacement", +DlgImgWidth : "Largeur", +DlgImgHeight : "Hauteur", +DlgImgLockRatio : "Garder les proportions", +DlgBtnResetSize : "Taille originale", +DlgImgBorder : "Bordure", +DlgImgHSpace : "Espacement horizontal", +DlgImgVSpace : "Espacement vertical", +DlgImgAlign : "Alignement", +DlgImgAlignLeft : "Gauche", +DlgImgAlignAbsBottom: "Abs Bas", +DlgImgAlignAbsMiddle: "Abs Milieu", +DlgImgAlignBaseline : "Bas du texte", +DlgImgAlignBottom : "Bas", +DlgImgAlignMiddle : "Milieu", +DlgImgAlignRight : "Droite", +DlgImgAlignTextTop : "Haut du texte", +DlgImgAlignTop : "Haut", +DlgImgPreview : "Prévisualisation", +DlgImgAlertUrl : "Veuillez saisir l'URL de l'image", +DlgImgLinkTab : "Lien", + +// Flash Dialog +DlgFlashTitle : "Propriétés de l'animation Flash", +DlgFlashChkPlay : "Lecture automatique", +DlgFlashChkLoop : "Boucle", +DlgFlashChkMenu : "Activer le menu Flash", +DlgFlashScale : "Affichage", +DlgFlashScaleAll : "Par défaut (tout montrer)", +DlgFlashScaleNoBorder : "Sans bordure", +DlgFlashScaleFit : "Ajuster aux dimensions", + +// Link Dialog +DlgLnkWindowTitle : "Propriétés du lien", +DlgLnkInfoTab : "Informations sur le lien", +DlgLnkTargetTab : "Destination", + +DlgLnkType : "Type de lien", +DlgLnkTypeURL : "URL", +DlgLnkTypeAnchor : "Ancre dans cette page", +DlgLnkTypeEMail : "E-Mail", +DlgLnkProto : "Protocole", +DlgLnkProtoOther : "", +DlgLnkURL : "URL", +DlgLnkAnchorSel : "Sélectionner une ancre", +DlgLnkAnchorByName : "Par nom", +DlgLnkAnchorById : "Par id", +DlgLnkNoAnchors : "(Pas d'ancre disponible dans le document)", +DlgLnkEMail : "Adresse E-Mail", +DlgLnkEMailSubject : "Sujet du message", +DlgLnkEMailBody : "Corps du message", +DlgLnkUpload : "Télécharger", +DlgLnkBtnUpload : "Envoyer sur le serveur", + +DlgLnkTarget : "Destination", +DlgLnkTargetFrame : "", +DlgLnkTargetPopup : "", +DlgLnkTargetBlank : "Nouvelle fenêtre (_blank)", +DlgLnkTargetParent : "Fenêtre mère (_parent)", +DlgLnkTargetSelf : "Même fenêtre (_self)", +DlgLnkTargetTop : "Fenêtre supérieure (_top)", +DlgLnkTargetFrameName : "Nom du cadre de destination", +DlgLnkPopWinName : "Nom de la fenêtre popup", +DlgLnkPopWinFeat : "Caractéristiques de la fenêtre popup", +DlgLnkPopResize : "Taille modifiable", +DlgLnkPopLocation : "Barre d'adresses", +DlgLnkPopMenu : "Barre de menu", +DlgLnkPopScroll : "Barres de défilement", +DlgLnkPopStatus : "Barre d'état", +DlgLnkPopToolbar : "Barre d'outils", +DlgLnkPopFullScrn : "Plein écran (IE)", +DlgLnkPopDependent : "Dépendante (Netscape)", +DlgLnkPopWidth : "Largeur", +DlgLnkPopHeight : "Hauteur", +DlgLnkPopLeft : "Position à partir de la gauche", +DlgLnkPopTop : "Position à partir du haut", + +DlnLnkMsgNoUrl : "Veuillez saisir l'URL", +DlnLnkMsgNoEMail : "Veuillez saisir l'adresse e-mail", +DlnLnkMsgNoAnchor : "Veuillez sélectionner une ancre", +DlnLnkMsgInvPopName : "Le nom de la fenêtre popup doit commencer par une lettre et ne doit pas contenir d'espace", + +// Color Dialog +DlgColorTitle : "Sélectionner", +DlgColorBtnClear : "Effacer", +DlgColorHighlight : "Prévisualisation", +DlgColorSelected : "Sélectionné", + +// Smiley Dialog +DlgSmileyTitle : "Insérer un Smiley", + +// Special Character Dialog +DlgSpecialCharTitle : "Insérer un caractère spécial", + +// Table Dialog +DlgTableTitle : "Propriétés du tableau", +DlgTableRows : "Lignes", +DlgTableColumns : "Colonnes", +DlgTableBorder : "Bordure", +DlgTableAlign : "Alignement", +DlgTableAlignNotSet : "", +DlgTableAlignLeft : "Gauche", +DlgTableAlignCenter : "Centré", +DlgTableAlignRight : "Droite", +DlgTableWidth : "Largeur", +DlgTableWidthPx : "pixels", +DlgTableWidthPc : "pourcentage", +DlgTableHeight : "Hauteur", +DlgTableCellSpace : "Espacement", +DlgTableCellPad : "Contour", +DlgTableCaption : "Titre", +DlgTableSummary : "Résumé", + +// Table Cell Dialog +DlgCellTitle : "Propriétés de la cellule", +DlgCellWidth : "Largeur", +DlgCellWidthPx : "pixels", +DlgCellWidthPc : "pourcentage", +DlgCellHeight : "Hauteur", +DlgCellWordWrap : "Retour à la ligne", +DlgCellWordWrapNotSet : "", +DlgCellWordWrapYes : "Oui", +DlgCellWordWrapNo : "Non", +DlgCellHorAlign : "Alignement horizontal", +DlgCellHorAlignNotSet : "", +DlgCellHorAlignLeft : "Gauche", +DlgCellHorAlignCenter : "Centré", +DlgCellHorAlignRight: "Droite", +DlgCellVerAlign : "Alignement vertical", +DlgCellVerAlignNotSet : "", +DlgCellVerAlignTop : "Haut", +DlgCellVerAlignMiddle : "Milieu", +DlgCellVerAlignBottom : "Bas", +DlgCellVerAlignBaseline : "Bas du texte", +DlgCellRowSpan : "Lignes fusionnées", +DlgCellCollSpan : "Colonnes fusionnées", +DlgCellBackColor : "Fond", +DlgCellBorderColor : "Bordure", +DlgCellBtnSelect : "Choisir...", + +// Find and Replace Dialog +DlgFindAndReplaceTitle : "Chercher et Remplacer", + +// Find Dialog +DlgFindTitle : "Chercher", +DlgFindFindBtn : "Chercher", +DlgFindNotFoundMsg : "Le texte indiqué est introuvable.", + +// Replace Dialog +DlgReplaceTitle : "Remplacer", +DlgReplaceFindLbl : "Rechercher:", +DlgReplaceReplaceLbl : "Remplacer par:", +DlgReplaceCaseChk : "Respecter la casse", +DlgReplaceReplaceBtn : "Remplacer", +DlgReplaceReplAllBtn : "Tout remplacer", +DlgReplaceWordChk : "Mot entier", + +// Paste Operations / Dialog +PasteErrorCut : "Les paramètres de sécurité de votre navigateur empêchent l'éditeur de couper automatiquement vos données. Veuillez utiliser les équivalents claviers (Ctrl+X).", +PasteErrorCopy : "Les paramètres de sécurité de votre navigateur empêchent l'éditeur de copier automatiquement vos données. Veuillez utiliser les équivalents claviers (Ctrl+C).", + +PasteAsText : "Coller comme texte", +PasteFromWord : "Coller à partir de Word", + +DlgPasteMsg2 : "Veuillez coller dans la zone ci-dessous en utilisant le clavier (Ctrl+V) et cliquez sur OK.", +DlgPasteSec : "A cause des paramètres de sécurité de votre navigateur, l'éditeur ne peut accéder au presse-papier directement. Vous devez coller à nouveau le contenu dans cette fenêtre.", +DlgPasteIgnoreFont : "Ignorer les polices de caractères", +DlgPasteRemoveStyles : "Supprimer les styles", +DlgPasteCleanBox : "Effacer le contenu", + +// Color Picker +ColorAutomatic : "Automatique", +ColorMoreColors : "Plus de couleurs...", + +// Document Properties +DocProps : "Propriétés du document", + +// Anchor Dialog +DlgAnchorTitle : "Propriétés de l'ancre", +DlgAnchorName : "Nom de l'ancre", +DlgAnchorErrorName : "Veuillez saisir le nom de l'ancre", + +// Speller Pages Dialog +DlgSpellNotInDic : "Pas dans le dictionnaire", +DlgSpellChangeTo : "Changer en", +DlgSpellBtnIgnore : "Ignorer", +DlgSpellBtnIgnoreAll : "Ignorer tout", +DlgSpellBtnReplace : "Remplacer", +DlgSpellBtnReplaceAll : "Remplacer tout", +DlgSpellBtnUndo : "Annuler", +DlgSpellNoSuggestions : "- Aucune suggestion -", +DlgSpellProgress : "Vérification d'orthographe en cours...", +DlgSpellNoMispell : "Vérification d'orthographe terminée: Aucune erreur trouvée", +DlgSpellNoChanges : "Vérification d'orthographe terminée: Pas de modifications", +DlgSpellOneChange : "Vérification d'orthographe terminée: Un mot modifié", +DlgSpellManyChanges : "Vérification d'orthographe terminée: %1 mots modifiés", + +IeSpellDownload : "Le Correcteur n'est pas installé. Souhaitez-vous le télécharger maintenant?", + +// Button Dialog +DlgButtonText : "Texte (valeur)", +DlgButtonType : "Type", +DlgButtonTypeBtn : "Bouton", +DlgButtonTypeSbm : "Envoyer", +DlgButtonTypeRst : "Réinitialiser", + +// Checkbox and Radio Button Dialogs +DlgCheckboxName : "Nom", +DlgCheckboxValue : "Valeur", +DlgCheckboxSelected : "Sélectionné", + +// Form Dialog +DlgFormName : "Nom", +DlgFormAction : "Action", +DlgFormMethod : "Méthode", + +// Select Field Dialog +DlgSelectName : "Nom", +DlgSelectValue : "Valeur", +DlgSelectSize : "Taille", +DlgSelectLines : "lignes", +DlgSelectChkMulti : "Sélection multiple", +DlgSelectOpAvail : "Options disponibles", +DlgSelectOpText : "Texte", +DlgSelectOpValue : "Valeur", +DlgSelectBtnAdd : "Ajouter", +DlgSelectBtnModify : "Modifier", +DlgSelectBtnUp : "Monter", +DlgSelectBtnDown : "Descendre", +DlgSelectBtnSetValue : "Valeur sélectionnée", +DlgSelectBtnDelete : "Supprimer", + +// Textarea Dialog +DlgTextareaName : "Nom", +DlgTextareaCols : "Colonnes", +DlgTextareaRows : "Lignes", + +// Text Field Dialog +DlgTextName : "Nom", +DlgTextValue : "Valeur", +DlgTextCharWidth : "Largeur en caractères", +DlgTextMaxChars : "Nombre maximum de caractères", +DlgTextType : "Type", +DlgTextTypeText : "Texte", +DlgTextTypePass : "Mot de passe", + +// Hidden Field Dialog +DlgHiddenName : "Nom", +DlgHiddenValue : "Valeur", + +// Bulleted List Dialog +BulletedListProp : "Propriétés de liste à puces", +NumberedListProp : "Propriétés de liste numérotée", +DlgLstStart : "Début", +DlgLstType : "Type", +DlgLstTypeCircle : "Cercle", +DlgLstTypeDisc : "Disque", +DlgLstTypeSquare : "Carré", +DlgLstTypeNumbers : "Nombres (1, 2, 3)", +DlgLstTypeLCase : "Lettres minuscules (a, b, c)", +DlgLstTypeUCase : "Lettres majuscules (A, B, C)", +DlgLstTypeSRoman : "Chiffres romains minuscules (i, ii, iii)", +DlgLstTypeLRoman : "Chiffres romains majuscules (I, II, III)", + +// Document Properties Dialog +DlgDocGeneralTab : "Général", +DlgDocBackTab : "Fond", +DlgDocColorsTab : "Couleurs et marges", +DlgDocMetaTab : "Métadonnées", + +DlgDocPageTitle : "Titre de la page", +DlgDocLangDir : "Sens d'écriture", +DlgDocLangDirLTR : "De la gauche vers la droite (LTR)", +DlgDocLangDirRTL : "De la droite vers la gauche (RTL)", +DlgDocLangCode : "Code langue", +DlgDocCharSet : "Encodage de caractère", +DlgDocCharSetCE : "Europe Centrale", +DlgDocCharSetCT : "Chinois Traditionnel (Big5)", +DlgDocCharSetCR : "Cyrillique", +DlgDocCharSetGR : "Grec", +DlgDocCharSetJP : "Japanais", +DlgDocCharSetKR : "Coréen", +DlgDocCharSetTR : "Turc", +DlgDocCharSetUN : "Unicode (UTF-8)", +DlgDocCharSetWE : "Occidental", +DlgDocCharSetOther : "Autre encodage de caractère", + +DlgDocDocType : "Type de document", +DlgDocDocTypeOther : "Autre type de document", +DlgDocIncXHTML : "Inclure les déclarations XHTML", +DlgDocBgColor : "Couleur de fond", +DlgDocBgImage : "Image de fond", +DlgDocBgNoScroll : "Image fixe sans défilement", +DlgDocCText : "Texte", +DlgDocCLink : "Lien", +DlgDocCVisited : "Lien visité", +DlgDocCActive : "Lien activé", +DlgDocMargins : "Marges", +DlgDocMaTop : "Haut", +DlgDocMaLeft : "Gauche", +DlgDocMaRight : "Droite", +DlgDocMaBottom : "Bas", +DlgDocMeIndex : "Mots-clés (séparés par des virgules)", +DlgDocMeDescr : "Description", +DlgDocMeAuthor : "Auteur", +DlgDocMeCopy : "Copyright", +DlgDocPreview : "Prévisualisation", + +// Templates Dialog +Templates : "Modèles", +DlgTemplatesTitle : "Modèles de contenu", +DlgTemplatesSelMsg : "Veuillez sélectionner le modèle à ouvrir dans l'éditeur
    (le contenu actuel sera remplacé):", +DlgTemplatesLoading : "Chargement de la liste des modèles. Veuillez patienter...", +DlgTemplatesNoTpl : "(Aucun modèle disponible)", +DlgTemplatesReplace : "Remplacer tout le contenu", + +// About Dialog +DlgAboutAboutTab : "A propos de", +DlgAboutBrowserInfoTab : "Navigateur", +DlgAboutLicenseTab : "License", +DlgAboutVersion : "version", +DlgAboutInfo : "Pour plus d'informations, aller à" +}; diff --git a/FCKeditor/editor/lang/gl.js b/FCKeditor/editor/lang/gl.js new file mode 100644 index 0000000..b6e3417 --- /dev/null +++ b/FCKeditor/editor/lang/gl.js @@ -0,0 +1,516 @@ +/* + * FCKeditor - The text editor for Internet - http://www.fckeditor.net + * Copyright (C) 2003-2007 Frederico Caldeira Knabben + * + * == BEGIN LICENSE == + * + * Licensed under the terms of any of the following licenses at your + * choice: + * + * - GNU General Public License Version 2 or later (the "GPL") + * http://www.gnu.org/licenses/gpl.html + * + * - GNU Lesser General Public License Version 2.1 or later (the "LGPL") + * http://www.gnu.org/licenses/lgpl.html + * + * - Mozilla Public License Version 1.1 or later (the "MPL") + * http://www.mozilla.org/MPL/MPL-1.1.html + * + * == END LICENSE == + * + * Galician language file. + */ + +var FCKLang = +{ +// Language direction : "ltr" (left to right) or "rtl" (right to left). +Dir : "ltr", + +ToolbarCollapse : "Ocultar Ferramentas", +ToolbarExpand : "Mostrar Ferramentas", + +// Toolbar Items and Context Menu +Save : "Gardar", +NewPage : "Nova Páxina", +Preview : "Vista Previa", +Cut : "Cortar", +Copy : "Copiar", +Paste : "Pegar", +PasteText : "Pegar como texto plano", +PasteWord : "Pegar dende Word", +Print : "Imprimir", +SelectAll : "Seleccionar todo", +RemoveFormat : "Eliminar Formato", +InsertLinkLbl : "Ligazón", +InsertLink : "Inserir/Editar Ligazón", +RemoveLink : "Eliminar Ligazón", +Anchor : "Inserir/Editar Referencia", +AnchorDelete : "Remove Anchor", //MISSING +InsertImageLbl : "Imaxe", +InsertImage : "Inserir/Editar Imaxe", +InsertFlashLbl : "Flash", +InsertFlash : "Inserir/Editar Flash", +InsertTableLbl : "Tabla", +InsertTable : "Inserir/Editar Tabla", +InsertLineLbl : "Liña", +InsertLine : "Inserir Liña Horizontal", +InsertSpecialCharLbl: "Carácter Special", +InsertSpecialChar : "Inserir Carácter Especial", +InsertSmileyLbl : "Smiley", +InsertSmiley : "Inserir Smiley", +About : "Acerca de FCKeditor", +Bold : "Negrita", +Italic : "Cursiva", +Underline : "Sub-raiado", +StrikeThrough : "Tachado", +Subscript : "Subíndice", +Superscript : "Superíndice", +LeftJustify : "Aliñar á Esquerda", +CenterJustify : "Centrado", +RightJustify : "Aliñar á Dereita", +BlockJustify : "Xustificado", +DecreaseIndent : "Disminuir Sangría", +IncreaseIndent : "Aumentar Sangría", +Blockquote : "Blockquote", //MISSING +Undo : "Desfacer", +Redo : "Refacer", +NumberedListLbl : "Lista Numerada", +NumberedList : "Inserir/Eliminar Lista Numerada", +BulletedListLbl : "Marcas", +BulletedList : "Inserir/Eliminar Marcas", +ShowTableBorders : "Mostrar Bordes das Táboas", +ShowDetails : "Mostrar Marcas Parágrafo", +Style : "Estilo", +FontFormat : "Formato", +Font : "Tipo", +FontSize : "Tamaño", +TextColor : "Cor do Texto", +BGColor : "Cor do Fondo", +Source : "Código Fonte", +Find : "Procurar", +Replace : "Substituir", +SpellCheck : "Corrección Ortográfica", +UniversalKeyboard : "Teclado Universal", +PageBreakLbl : "Salto de Páxina", +PageBreak : "Inserir Salto de Páxina", + +Form : "Formulario", +Checkbox : "Cadro de Verificación", +RadioButton : "Botón de Radio", +TextField : "Campo de Texto", +Textarea : "Área de Texto", +HiddenField : "Campo Oculto", +Button : "Botón", +SelectionField : "Campo de Selección", +ImageButton : "Botón de Imaxe", + +FitWindow : "Maximizar o tamaño do editor", +ShowBlocks : "Show Blocks", //MISSING + +// Context Menu +EditLink : "Editar Ligazón", +CellCM : "Cela", +RowCM : "Fila", +ColumnCM : "Columna", +InsertRowAfter : "Insert Row After", //MISSING +InsertRowBefore : "Insert Row Before", //MISSING +DeleteRows : "Borrar Filas", +InsertColumnAfter : "Insert Column After", //MISSING +InsertColumnBefore : "Insert Column Before", //MISSING +DeleteColumns : "Borrar Columnas", +InsertCellAfter : "Insert Cell After", //MISSING +InsertCellBefore : "Insert Cell Before", //MISSING +DeleteCells : "Borrar Cela", +MergeCells : "Unir Celas", +MergeRight : "Merge Right", //MISSING +MergeDown : "Merge Down", //MISSING +HorizontalSplitCell : "Split Cell Horizontally", //MISSING +VerticalSplitCell : "Split Cell Vertically", //MISSING +TableDelete : "Borrar Táboa", +CellProperties : "Propriedades da Cela", +TableProperties : "Propriedades da Táboa", +ImageProperties : "Propriedades Imaxe", +FlashProperties : "Propriedades Flash", + +AnchorProp : "Propriedades da Referencia", +ButtonProp : "Propriedades do Botón", +CheckboxProp : "Propriedades do Cadro de Verificación", +HiddenFieldProp : "Propriedades do Campo Oculto", +RadioButtonProp : "Propriedades do Botón de Radio", +ImageButtonProp : "Propriedades do Botón de Imaxe", +TextFieldProp : "Propriedades do Campo de Texto", +SelectionFieldProp : "Propriedades do Campo de Selección", +TextareaProp : "Propriedades da Área de Texto", +FormProp : "Propriedades do Formulario", + +FontFormats : "Normal;Formateado;Enderezo;Enacabezado 1;Encabezado 2;Encabezado 3;Encabezado 4;Encabezado 5;Encabezado 6;Paragraph (DIV)", + +// Alerts and Messages +ProcessingXHTML : "Procesando XHTML. Por facor, agarde...", +Done : "Feiro", +PasteWordConfirm : "Parece que o texto que quere pegar está copiado do Word.¿Quere limpar o formato antes de pegalo?", +NotCompatiblePaste : "Este comando está disponible para Internet Explorer versión 5.5 ou superior. ¿Quere pegalo sen limpar o formato?", +UnknownToolbarItem : "Ítem de ferramentas descoñecido \"%1\"", +UnknownCommand : "Nome de comando descoñecido \"%1\"", +NotImplemented : "Comando non implementado", +UnknownToolbarSet : "O conxunto de ferramentas \"%1\" non existe", +NoActiveX : "As opcións de seguridade do seu navegador poderían limitar algunha das características de editor. Debe activar a opción \"Executar controis ActiveX e plug-ins\". Pode notar que faltan características e experimentar erros", +BrowseServerBlocked : "Non se poido abrir o navegador de recursos. Asegúrese de que están desactivados os bloqueadores de xanelas emerxentes", +DialogBlocked : "Non foi posible abrir a xanela de diálogo. Asegúrese de que están desactivados os bloqueadores de xanelas emerxentes", + +// Dialogs +DlgBtnOK : "OK", +DlgBtnCancel : "Cancelar", +DlgBtnClose : "Pechar", +DlgBtnBrowseServer : "Navegar no Servidor", +DlgAdvancedTag : "Advanzado", +DlgOpOther : "", +DlgInfoTab : "Info", +DlgAlertUrl : "Por favor, insira a URL", + +// General Dialogs Labels +DlgGenNotSet : "", +DlgGenId : "Id", +DlgGenLangDir : "Orientación do Idioma", +DlgGenLangDirLtr : "Esquerda a Dereita (LTR)", +DlgGenLangDirRtl : "Dereita a Esquerda (RTL)", +DlgGenLangCode : "Código do Idioma", +DlgGenAccessKey : "Chave de Acceso", +DlgGenName : "Nome", +DlgGenTabIndex : "Índice de Tabulación", +DlgGenLongDescr : "Descrición Completa da URL", +DlgGenClass : "Clases da Folla de Estilos", +DlgGenTitle : "Título", +DlgGenContType : "Tipo de Contido", +DlgGenLinkCharset : "Fonte de Caracteres Vinculado", +DlgGenStyle : "Estilo", + +// Image Dialog +DlgImgTitle : "Propriedades da Imaxe", +DlgImgInfoTab : "Información da Imaxe", +DlgImgBtnUpload : "Enviar ó Servidor", +DlgImgURL : "URL", +DlgImgUpload : "Carregar", +DlgImgAlt : "Texto Alternativo", +DlgImgWidth : "Largura", +DlgImgHeight : "Altura", +DlgImgLockRatio : "Proporcional", +DlgBtnResetSize : "Tamaño Orixinal", +DlgImgBorder : "Límite", +DlgImgHSpace : "Esp. Horiz.", +DlgImgVSpace : "Esp. Vert.", +DlgImgAlign : "Aliñamento", +DlgImgAlignLeft : "Esquerda", +DlgImgAlignAbsBottom: "Abs Inferior", +DlgImgAlignAbsMiddle: "Abs Centro", +DlgImgAlignBaseline : "Liña Base", +DlgImgAlignBottom : "Pé", +DlgImgAlignMiddle : "Centro", +DlgImgAlignRight : "Dereita", +DlgImgAlignTextTop : "Tope do Texto", +DlgImgAlignTop : "Tope", +DlgImgPreview : "Vista Previa", +DlgImgAlertUrl : "Por favor, escriba a URL da imaxe", +DlgImgLinkTab : "Ligazón", + +// Flash Dialog +DlgFlashTitle : "Propriedades Flash", +DlgFlashChkPlay : "Auto Execución", +DlgFlashChkLoop : "Bucle", +DlgFlashChkMenu : "Activar Menú Flash", +DlgFlashScale : "Escalar", +DlgFlashScaleAll : "Amosar Todo", +DlgFlashScaleNoBorder : "Sen Borde", +DlgFlashScaleFit : "Encaixar axustando", + +// Link Dialog +DlgLnkWindowTitle : "Ligazón", +DlgLnkInfoTab : "Información da Ligazón", +DlgLnkTargetTab : "Referencia a esta páxina", + +DlgLnkType : "Tipo de Ligazón", +DlgLnkTypeURL : "URL", +DlgLnkTypeAnchor : "Referencia nesta páxina", +DlgLnkTypeEMail : "E-Mail", +DlgLnkProto : "Protocolo", +DlgLnkProtoOther : "", +DlgLnkURL : "URL", +DlgLnkAnchorSel : "Seleccionar unha Referencia", +DlgLnkAnchorByName : "Por Nome de Referencia", +DlgLnkAnchorById : "Por Element Id", +DlgLnkNoAnchors : "(Non hai referencias disponibles no documento)", +DlgLnkEMail : "Enderezo de E-Mail", +DlgLnkEMailSubject : "Asunto do Mensaxe", +DlgLnkEMailBody : "Corpo do Mensaxe", +DlgLnkUpload : "Carregar", +DlgLnkBtnUpload : "Enviar ó servidor", + +DlgLnkTarget : "Destino", +DlgLnkTargetFrame : "", +DlgLnkTargetPopup : "", +DlgLnkTargetBlank : "Nova Xanela (_blank)", +DlgLnkTargetParent : "Xanela Pai (_parent)", +DlgLnkTargetSelf : "Mesma Xanela (_self)", +DlgLnkTargetTop : "Xanela Primaria (_top)", +DlgLnkTargetFrameName : "Nome do Marco Destino", +DlgLnkPopWinName : "Nome da Xanela Emerxente", +DlgLnkPopWinFeat : "Características da Xanela Emerxente", +DlgLnkPopResize : "Axustable", +DlgLnkPopLocation : "Barra de Localización", +DlgLnkPopMenu : "Barra de Menú", +DlgLnkPopScroll : "Barras de Desplazamento", +DlgLnkPopStatus : "Barra de Estado", +DlgLnkPopToolbar : "Barra de Ferramentas", +DlgLnkPopFullScrn : "A Toda Pantalla (IE)", +DlgLnkPopDependent : "Dependente (Netscape)", +DlgLnkPopWidth : "Largura", +DlgLnkPopHeight : "Altura", +DlgLnkPopLeft : "Posición Esquerda", +DlgLnkPopTop : "Posición dende Arriba", + +DlnLnkMsgNoUrl : "Por favor, escriba a ligazón URL", +DlnLnkMsgNoEMail : "Por favor, escriba o enderezo de e-mail", +DlnLnkMsgNoAnchor : "Por favor, seleccione un destino", +DlnLnkMsgInvPopName : "The popup name must begin with an alphabetic character and must not contain spaces", //MISSING + +// Color Dialog +DlgColorTitle : "Seleccionar Color", +DlgColorBtnClear : "Nengunha", +DlgColorHighlight : "Destacado", +DlgColorSelected : "Seleccionado", + +// Smiley Dialog +DlgSmileyTitle : "Inserte un Smiley", + +// Special Character Dialog +DlgSpecialCharTitle : "Seleccione Caracter Especial", + +// Table Dialog +DlgTableTitle : "Propiedades da Táboa", +DlgTableRows : "Filas", +DlgTableColumns : "Columnas", +DlgTableBorder : "Tamaño do Borde", +DlgTableAlign : "Aliñamento", +DlgTableAlignNotSet : "", +DlgTableAlignLeft : "Esquerda", +DlgTableAlignCenter : "Centro", +DlgTableAlignRight : "Ereita", +DlgTableWidth : "Largura", +DlgTableWidthPx : "pixels", +DlgTableWidthPc : "percent", +DlgTableHeight : "Altura", +DlgTableCellSpace : "Marxe entre Celas", +DlgTableCellPad : "Marxe interior", +DlgTableCaption : "Título", +DlgTableSummary : "Sumario", + +// Table Cell Dialog +DlgCellTitle : "Propriedades da Cela", +DlgCellWidth : "Largura", +DlgCellWidthPx : "pixels", +DlgCellWidthPc : "percent", +DlgCellHeight : "Altura", +DlgCellWordWrap : "Axustar Liñas", +DlgCellWordWrapNotSet : "", +DlgCellWordWrapYes : "Si", +DlgCellWordWrapNo : "Non", +DlgCellHorAlign : "Aliñamento Horizontal", +DlgCellHorAlignNotSet : "", +DlgCellHorAlignLeft : "Esquerda", +DlgCellHorAlignCenter : "Centro", +DlgCellHorAlignRight: "Dereita", +DlgCellVerAlign : "Aliñamento Vertical", +DlgCellVerAlignNotSet : "", +DlgCellVerAlignTop : "Arriba", +DlgCellVerAlignMiddle : "Medio", +DlgCellVerAlignBottom : "Abaixo", +DlgCellVerAlignBaseline : "Liña de Base", +DlgCellRowSpan : "Ocupar Filas", +DlgCellCollSpan : "Ocupar Columnas", +DlgCellBackColor : "Color de Fondo", +DlgCellBorderColor : "Color de Borde", +DlgCellBtnSelect : "Seleccionar...", + +// Find and Replace Dialog +DlgFindAndReplaceTitle : "Find and Replace", //MISSING + +// Find Dialog +DlgFindTitle : "Procurar", +DlgFindFindBtn : "Procurar", +DlgFindNotFoundMsg : "Non te atopou o texto indicado.", + +// Replace Dialog +DlgReplaceTitle : "Substituir", +DlgReplaceFindLbl : "Texto a procurar:", +DlgReplaceReplaceLbl : "Substituir con:", +DlgReplaceCaseChk : "Coincidir Mai./min.", +DlgReplaceReplaceBtn : "Substituir", +DlgReplaceReplAllBtn : "Substitiur Todo", +DlgReplaceWordChk : "Coincidir con toda a palabra", + +// Paste Operations / Dialog +PasteErrorCut : "Os axustes de seguridade do seu navegador non permiten que o editor realice automáticamente as tarefas de corte. Por favor, use o teclado para iso (Ctrl+X).", +PasteErrorCopy : "Os axustes de seguridade do seu navegador non permiten que o editor realice automáticamente as tarefas de copia. Por favor, use o teclado para iso (Ctrl+C).", + +PasteAsText : "Pegar como texto plano", +PasteFromWord : "Pegar dende Word", + +DlgPasteMsg2 : "Por favor, pegue dentro do seguinte cadro usando o teclado (Ctrl+V) e pulse OK.", +DlgPasteSec : "Because of your browser security settings, the editor is not able to access your clipboard data directly. You are required to paste it again in this window.", //MISSING +DlgPasteIgnoreFont : "Ignorar as definicións de Tipografía", +DlgPasteRemoveStyles : "Eliminar as definicións de Estilos", +DlgPasteCleanBox : "Limpar o Cadro", + +// Color Picker +ColorAutomatic : "Automático", +ColorMoreColors : "Máis Cores...", + +// Document Properties +DocProps : "Propriedades do Documento", + +// Anchor Dialog +DlgAnchorTitle : "Propriedades da Referencia", +DlgAnchorName : "Nome da Referencia", +DlgAnchorErrorName : "Por favor, escriba o nome da referencia", + +// Speller Pages Dialog +DlgSpellNotInDic : "Non está no diccionario", +DlgSpellChangeTo : "Cambiar a", +DlgSpellBtnIgnore : "Ignorar", +DlgSpellBtnIgnoreAll : "Ignorar Todas", +DlgSpellBtnReplace : "Substituir", +DlgSpellBtnReplaceAll : "Substituir Todas", +DlgSpellBtnUndo : "Desfacer", +DlgSpellNoSuggestions : "- Sen candidatos -", +DlgSpellProgress : "Corrección ortográfica en progreso...", +DlgSpellNoMispell : "Corrección ortográfica rematada: Non se atoparon erros", +DlgSpellNoChanges : "Corrección ortográfica rematada: Non se substituiu nengunha verba", +DlgSpellOneChange : "Corrección ortográfica rematada: Unha verba substituida", +DlgSpellManyChanges : "Corrección ortográfica rematada: %1 verbas substituidas", + +IeSpellDownload : "O corrector ortográfico non está instalado. ¿Quere descargalo agora?", + +// Button Dialog +DlgButtonText : "Texto (Valor)", +DlgButtonType : "Tipo", +DlgButtonTypeBtn : "Button", //MISSING +DlgButtonTypeSbm : "Submit", //MISSING +DlgButtonTypeRst : "Reset", //MISSING + +// Checkbox and Radio Button Dialogs +DlgCheckboxName : "Nome", +DlgCheckboxValue : "Valor", +DlgCheckboxSelected : "Seleccionado", + +// Form Dialog +DlgFormName : "Nome", +DlgFormAction : "Acción", +DlgFormMethod : "Método", + +// Select Field Dialog +DlgSelectName : "Nome", +DlgSelectValue : "Valor", +DlgSelectSize : "Tamaño", +DlgSelectLines : "liñas", +DlgSelectChkMulti : "Permitir múltiples seleccións", +DlgSelectOpAvail : "Opcións Disponibles", +DlgSelectOpText : "Texto", +DlgSelectOpValue : "Valor", +DlgSelectBtnAdd : "Engadir", +DlgSelectBtnModify : "Modificar", +DlgSelectBtnUp : "Subir", +DlgSelectBtnDown : "Baixar", +DlgSelectBtnSetValue : "Definir como valor por defecto", +DlgSelectBtnDelete : "Borrar", + +// Textarea Dialog +DlgTextareaName : "Nome", +DlgTextareaCols : "Columnas", +DlgTextareaRows : "Filas", + +// Text Field Dialog +DlgTextName : "Nome", +DlgTextValue : "Valor", +DlgTextCharWidth : "Tamaño do Caracter", +DlgTextMaxChars : "Máximo de Caracteres", +DlgTextType : "Tipo", +DlgTextTypeText : "Texto", +DlgTextTypePass : "Chave", + +// Hidden Field Dialog +DlgHiddenName : "Nome", +DlgHiddenValue : "Valor", + +// Bulleted List Dialog +BulletedListProp : "Propriedades das Marcas", +NumberedListProp : "Propriedades da Lista de Numeración", +DlgLstStart : "Start", //MISSING +DlgLstType : "Tipo", +DlgLstTypeCircle : "Círculo", +DlgLstTypeDisc : "Disco", +DlgLstTypeSquare : "Cuadrado", +DlgLstTypeNumbers : "Números (1, 2, 3)", +DlgLstTypeLCase : "Letras Minúsculas (a, b, c)", +DlgLstTypeUCase : "Letras Maiúsculas (A, B, C)", +DlgLstTypeSRoman : "Números Romanos en minúscula (i, ii, iii)", +DlgLstTypeLRoman : "Números Romanos en Maiúscula (I, II, III)", + +// Document Properties Dialog +DlgDocGeneralTab : "Xeral", +DlgDocBackTab : "Fondo", +DlgDocColorsTab : "Cores e Marxes", +DlgDocMetaTab : "Meta Data", + +DlgDocPageTitle : "Título da Páxina", +DlgDocLangDir : "Orientación do Idioma", +DlgDocLangDirLTR : "Esquerda a Dereita (LTR)", +DlgDocLangDirRTL : "Dereita a Esquerda (RTL)", +DlgDocLangCode : "Código de Idioma", +DlgDocCharSet : "Codificación do Xogo de Caracteres", +DlgDocCharSetCE : "Central European", //MISSING +DlgDocCharSetCT : "Chinese Traditional (Big5)", //MISSING +DlgDocCharSetCR : "Cyrillic", //MISSING +DlgDocCharSetGR : "Greek", //MISSING +DlgDocCharSetJP : "Japanese", //MISSING +DlgDocCharSetKR : "Korean", //MISSING +DlgDocCharSetTR : "Turkish", //MISSING +DlgDocCharSetUN : "Unicode (UTF-8)", //MISSING +DlgDocCharSetWE : "Western European", //MISSING +DlgDocCharSetOther : "Outra Codificación do Xogo de Caracteres", + +DlgDocDocType : "Encabezado do Tipo de Documento", +DlgDocDocTypeOther : "Outro Encabezado do Tipo de Documento", +DlgDocIncXHTML : "Incluir Declaracións XHTML", +DlgDocBgColor : "Cor de Fondo", +DlgDocBgImage : "URL da Imaxe de Fondo", +DlgDocBgNoScroll : "Fondo Fixo", +DlgDocCText : "Texto", +DlgDocCLink : "Ligazóns", +DlgDocCVisited : "Ligazón Visitada", +DlgDocCActive : "Ligazón Activa", +DlgDocMargins : "Marxes da Páxina", +DlgDocMaTop : "Arriba", +DlgDocMaLeft : "Esquerda", +DlgDocMaRight : "Dereita", +DlgDocMaBottom : "Abaixo", +DlgDocMeIndex : "Palabras Chave de Indexación do Documento (separadas por comas)", +DlgDocMeDescr : "Descripción do Documento", +DlgDocMeAuthor : "Autor", +DlgDocMeCopy : "Copyright", +DlgDocPreview : "Vista Previa", + +// Templates Dialog +Templates : "Plantillas", +DlgTemplatesTitle : "Plantillas de Contido", +DlgTemplatesSelMsg : "Por favor, seleccione a plantilla a abrir no editor
    (o contido actual perderase):", +DlgTemplatesLoading : "Cargando listado de plantillas. Por favor, espere...", +DlgTemplatesNoTpl : "(Non hai plantillas definidas)", +DlgTemplatesReplace : "Replace actual contents", //MISSING + +// About Dialog +DlgAboutAboutTab : "Acerca de", +DlgAboutBrowserInfoTab : "Información do Navegador", +DlgAboutLicenseTab : "Licencia", +DlgAboutVersion : "versión", +DlgAboutInfo : "Para máis información visitar:" +}; diff --git a/FCKeditor/editor/lang/he.js b/FCKeditor/editor/lang/he.js new file mode 100644 index 0000000..040781a --- /dev/null +++ b/FCKeditor/editor/lang/he.js @@ -0,0 +1,516 @@ +/* + * FCKeditor - The text editor for Internet - http://www.fckeditor.net + * Copyright (C) 2003-2007 Frederico Caldeira Knabben + * + * == BEGIN LICENSE == + * + * Licensed under the terms of any of the following licenses at your + * choice: + * + * - GNU General Public License Version 2 or later (the "GPL") + * http://www.gnu.org/licenses/gpl.html + * + * - GNU Lesser General Public License Version 2.1 or later (the "LGPL") + * http://www.gnu.org/licenses/lgpl.html + * + * - Mozilla Public License Version 1.1 or later (the "MPL") + * http://www.mozilla.org/MPL/MPL-1.1.html + * + * == END LICENSE == + * + * Hebrew language file. + */ + +var FCKLang = +{ +// Language direction : "ltr" (left to right) or "rtl" (right to left). +Dir : "rtl", + +ToolbarCollapse : "כיווץ סרגל הכלים", +ToolbarExpand : "פתיחת סרגל הכלים", + +// Toolbar Items and Context Menu +Save : "שמירה", +NewPage : "דף חדש", +Preview : "תצוגה מקדימה", +Cut : "גזירה", +Copy : "העתקה", +Paste : "הדבקה", +PasteText : "הדבקה כטקסט פשוט", +PasteWord : "הדבקה מ-וורד", +Print : "הדפסה", +SelectAll : "בחירת הכל", +RemoveFormat : "הסרת העיצוב", +InsertLinkLbl : "קישור", +InsertLink : "הוספת/עריכת קישור", +RemoveLink : "הסרת הקישור", +Anchor : "הוספת/עריכת נקודת עיגון", +AnchorDelete : "הסר נקודת עיגון", +InsertImageLbl : "תמונה", +InsertImage : "הוספת/עריכת תמונה", +InsertFlashLbl : "פלאש", +InsertFlash : "הוסף/ערוך פלאש", +InsertTableLbl : "טבלה", +InsertTable : "הוספת/עריכת טבלה", +InsertLineLbl : "קו", +InsertLine : "הוספת קו אופקי", +InsertSpecialCharLbl: "תו מיוחד", +InsertSpecialChar : "הוספת תו מיוחד", +InsertSmileyLbl : "סמיילי", +InsertSmiley : "הוספת סמיילי", +About : "אודות FCKeditor", +Bold : "מודגש", +Italic : "נטוי", +Underline : "קו תחתון", +StrikeThrough : "כתיב מחוק", +Subscript : "כתיב תחתון", +Superscript : "כתיב עליון", +LeftJustify : "יישור לשמאל", +CenterJustify : "מרכוז", +RightJustify : "יישור לימין", +BlockJustify : "יישור לשוליים", +DecreaseIndent : "הקטנת אינדנטציה", +IncreaseIndent : "הגדלת אינדנטציה", +Blockquote : "בלוק ציטוט", +Undo : "ביטול צעד אחרון", +Redo : "חזרה על צעד אחרון", +NumberedListLbl : "רשימה ממוספרת", +NumberedList : "הוספת/הסרת רשימה ממוספרת", +BulletedListLbl : "רשימת נקודות", +BulletedList : "הוספת/הסרת רשימת נקודות", +ShowTableBorders : "הצגת מסגרת הטבלה", +ShowDetails : "הצגת פרטים", +Style : "סגנון", +FontFormat : "עיצוב", +Font : "גופן", +FontSize : "גודל", +TextColor : "צבע טקסט", +BGColor : "צבע רקע", +Source : "מקור", +Find : "חיפוש", +Replace : "החלפה", +SpellCheck : "בדיקת איות", +UniversalKeyboard : "מקלדת אוניברסלית", +PageBreakLbl : "שבירת דף", +PageBreak : "הוסף שבירת דף", + +Form : "טופס", +Checkbox : "תיבת סימון", +RadioButton : "לחצן אפשרויות", +TextField : "שדה טקסט", +Textarea : "איזור טקסט", +HiddenField : "שדה חבוי", +Button : "כפתור", +SelectionField : "שדה בחירה", +ImageButton : "כפתור תמונה", + +FitWindow : "הגדל את גודל העורך", +ShowBlocks : "הצג בלוקים", + +// Context Menu +EditLink : "עריכת קישור", +CellCM : "תא", +RowCM : "שורה", +ColumnCM : "עמודה", +InsertRowAfter : "הוסף שורה אחרי", +InsertRowBefore : "הוסף שורה לפני", +DeleteRows : "מחיקת שורות", +InsertColumnAfter : "הוסף עמודה אחרי", +InsertColumnBefore : "הוסף עמודה לפני", +DeleteColumns : "מחיקת עמודות", +InsertCellAfter : "הוסף תא אחרי", +InsertCellBefore : "הוסף תא אחרי", +DeleteCells : "מחיקת תאים", +MergeCells : "מיזוג תאים", +MergeRight : "מזג ימינה", +MergeDown : "מזג למטה", +HorizontalSplitCell : "פצל תא אופקית", +VerticalSplitCell : "פצל תא אנכית", +TableDelete : "מחק טבלה", +CellProperties : "תכונות התא", +TableProperties : "תכונות הטבלה", +ImageProperties : "תכונות התמונה", +FlashProperties : "מאפייני פלאש", + +AnchorProp : "מאפייני נקודת עיגון", +ButtonProp : "מאפייני כפתור", +CheckboxProp : "מאפייני תיבת סימון", +HiddenFieldProp : "מאפיני שדה חבוי", +RadioButtonProp : "מאפייני לחצן אפשרויות", +ImageButtonProp : "מאפיני כפתור תמונה", +TextFieldProp : "מאפייני שדה טקסט", +SelectionFieldProp : "מאפייני שדה בחירה", +TextareaProp : "מאפיני איזור טקסט", +FormProp : "מאפיני טופס", + +FontFormats : "נורמלי;קוד;כתובת;כותרת;כותרת 2;כותרת 3;כותרת 4;כותרת 5;כותרת 6", + +// Alerts and Messages +ProcessingXHTML : "מעבד XHTML, נא להמתין...", +Done : "המשימה הושלמה", +PasteWordConfirm : "נראה הטקסט שבכוונתך להדביק מקורו בקובץ וורד. האם ברצונך לנקות אותו טרם ההדבקה?", +NotCompatiblePaste : "פעולה זו זמינה לדפדפן אינטרנט אקספלורר מגירסא 5.5 ומעלה. האם להמשיך בהדבקה ללא הניקוי?", +UnknownToolbarItem : "פריט לא ידוע בסרגל הכלים \"%1\"", +UnknownCommand : "שם פעולה לא ידוע \"%1\"", +NotImplemented : "הפקודה לא מיושמת", +UnknownToolbarSet : "ערכת סרגל הכלים \"%1\" לא קיימת", +NoActiveX : "הגדרות אבטחה של הדפדפן עלולות לגביל את אפשרויות העריכה.יש לאפשר את האופציה \"הרץ פקדים פעילים ותוספות\". תוכל לחוות טעויות וחיווים של אפשרויות שחסרים.", +BrowseServerBlocked : "לא ניתן לגשת לדפדפן משאבים.אנא וודא שחוסם חלונות הקופצים לא פעיל.", +DialogBlocked : "לא היה ניתן לפתוח חלון דיאלוג. אנא וודא שחוסם חלונות קופצים לא פעיל.", + +// Dialogs +DlgBtnOK : "אישור", +DlgBtnCancel : "ביטול", +DlgBtnClose : "סגירה", +DlgBtnBrowseServer : "סייר השרת", +DlgAdvancedTag : "אפשרויות מתקדמות", +DlgOpOther : "<אחר>", +DlgInfoTab : "מידע", +DlgAlertUrl : "אנה הזן URL", + +// General Dialogs Labels +DlgGenNotSet : "<לא נקבע>", +DlgGenId : "זיהוי (Id)", +DlgGenLangDir : "כיוון שפה", +DlgGenLangDirLtr : "שמאל לימין (LTR)", +DlgGenLangDirRtl : "ימין לשמאל (RTL)", +DlgGenLangCode : "קוד שפה", +DlgGenAccessKey : "מקש גישה", +DlgGenName : "שם", +DlgGenTabIndex : "מספר טאב", +DlgGenLongDescr : "קישור לתיאור מפורט", +DlgGenClass : "גיליונות עיצוב קבוצות", +DlgGenTitle : "כותרת מוצעת", +DlgGenContType : "Content Type מוצע", +DlgGenLinkCharset : "קידוד המשאב המקושר", +DlgGenStyle : "סגנון", + +// Image Dialog +DlgImgTitle : "תכונות התמונה", +DlgImgInfoTab : "מידע על התמונה", +DlgImgBtnUpload : "שליחה לשרת", +DlgImgURL : "כתובת (URL)", +DlgImgUpload : "העלאה", +DlgImgAlt : "טקסט חלופי", +DlgImgWidth : "רוחב", +DlgImgHeight : "גובה", +DlgImgLockRatio : "נעילת היחס", +DlgBtnResetSize : "איפוס הגודל", +DlgImgBorder : "מסגרת", +DlgImgHSpace : "מרווח אופקי", +DlgImgVSpace : "מרווח אנכי", +DlgImgAlign : "יישור", +DlgImgAlignLeft : "לשמאל", +DlgImgAlignAbsBottom: "לתחתית האבסולוטית", +DlgImgAlignAbsMiddle: "מרכוז אבסולוטי", +DlgImgAlignBaseline : "לקו התחתית", +DlgImgAlignBottom : "לתחתית", +DlgImgAlignMiddle : "לאמצע", +DlgImgAlignRight : "לימין", +DlgImgAlignTextTop : "לראש הטקסט", +DlgImgAlignTop : "למעלה", +DlgImgPreview : "תצוגה מקדימה", +DlgImgAlertUrl : "נא להקליד את כתובת התמונה", +DlgImgLinkTab : "קישור", + +// Flash Dialog +DlgFlashTitle : "מאפיני פלאש", +DlgFlashChkPlay : "נגן אוטומטי", +DlgFlashChkLoop : "לולאה", +DlgFlashChkMenu : "אפשר תפריט פלאש", +DlgFlashScale : "גודל", +DlgFlashScaleAll : "הצג הכל", +DlgFlashScaleNoBorder : "ללא גבולות", +DlgFlashScaleFit : "התאמה מושלמת", + +// Link Dialog +DlgLnkWindowTitle : "קישור", +DlgLnkInfoTab : "מידע על הקישור", +DlgLnkTargetTab : "מטרה", + +DlgLnkType : "סוג קישור", +DlgLnkTypeURL : "כתובת (URL)", +DlgLnkTypeAnchor : "עוגן בעמוד זה", +DlgLnkTypeEMail : "דוא''ל", +DlgLnkProto : "פרוטוקול", +DlgLnkProtoOther : "<אחר>", +DlgLnkURL : "כתובת (URL)", +DlgLnkAnchorSel : "בחירת עוגן", +DlgLnkAnchorByName : "עפ''י שם העוגן", +DlgLnkAnchorById : "עפ''י זיהוי (Id) הרכיב", +DlgLnkNoAnchors : "(אין עוגנים זמינים בדף)", +DlgLnkEMail : "כתובת הדוא''ל", +DlgLnkEMailSubject : "נושא ההודעה", +DlgLnkEMailBody : "גוף ההודעה", +DlgLnkUpload : "העלאה", +DlgLnkBtnUpload : "שליחה לשרת", + +DlgLnkTarget : "מטרה", +DlgLnkTargetFrame : "<מסגרת>", +DlgLnkTargetPopup : "<חלון קופץ>", +DlgLnkTargetBlank : "חלון חדש (_blank)", +DlgLnkTargetParent : "חלון האב (_parent)", +DlgLnkTargetSelf : "באותו החלון (_self)", +DlgLnkTargetTop : "חלון ראשי (_top)", +DlgLnkTargetFrameName : "שם מסגרת היעד", +DlgLnkPopWinName : "שם החלון הקופץ", +DlgLnkPopWinFeat : "תכונות החלון הקופץ", +DlgLnkPopResize : "בעל גודל ניתן לשינוי", +DlgLnkPopLocation : "סרגל כתובת", +DlgLnkPopMenu : "סרגל תפריט", +DlgLnkPopScroll : "ניתן לגלילה", +DlgLnkPopStatus : "סרגל חיווי", +DlgLnkPopToolbar : "סרגל הכלים", +DlgLnkPopFullScrn : "מסך מלא (IE)", +DlgLnkPopDependent : "תלוי (Netscape)", +DlgLnkPopWidth : "רוחב", +DlgLnkPopHeight : "גובה", +DlgLnkPopLeft : "מיקום צד שמאל", +DlgLnkPopTop : "מיקום צד עליון", + +DlnLnkMsgNoUrl : "נא להקליד את כתובת הקישור (URL)", +DlnLnkMsgNoEMail : "נא להקליד את כתובת הדוא''ל", +DlnLnkMsgNoAnchor : "נא לבחור עוגן במסמך", +DlnLnkMsgInvPopName : "שם החלון הקופץ חייב להתחיל באותיות ואסור לכלול רווחים", + +// Color Dialog +DlgColorTitle : "בחירת צבע", +DlgColorBtnClear : "איפוס", +DlgColorHighlight : "נוכחי", +DlgColorSelected : "נבחר", + +// Smiley Dialog +DlgSmileyTitle : "הוספת סמיילי", + +// Special Character Dialog +DlgSpecialCharTitle : "בחירת תו מיוחד", + +// Table Dialog +DlgTableTitle : "תכונות טבלה", +DlgTableRows : "שורות", +DlgTableColumns : "עמודות", +DlgTableBorder : "גודל מסגרת", +DlgTableAlign : "יישור", +DlgTableAlignNotSet : "<לא נקבע>", +DlgTableAlignLeft : "שמאל", +DlgTableAlignCenter : "מרכז", +DlgTableAlignRight : "ימין", +DlgTableWidth : "רוחב", +DlgTableWidthPx : "פיקסלים", +DlgTableWidthPc : "אחוז", +DlgTableHeight : "גובה", +DlgTableCellSpace : "מרווח תא", +DlgTableCellPad : "ריפוד תא", +DlgTableCaption : "כיתוב", +DlgTableSummary : "סיכום", + +// Table Cell Dialog +DlgCellTitle : "תכונות תא", +DlgCellWidth : "רוחב", +DlgCellWidthPx : "פיקסלים", +DlgCellWidthPc : "אחוז", +DlgCellHeight : "גובה", +DlgCellWordWrap : "גלילת שורות", +DlgCellWordWrapNotSet : "<לא נקבע>", +DlgCellWordWrapYes : "כן", +DlgCellWordWrapNo : "לא", +DlgCellHorAlign : "יישור אופקי", +DlgCellHorAlignNotSet : "<לא נקבע>", +DlgCellHorAlignLeft : "שמאל", +DlgCellHorAlignCenter : "מרכז", +DlgCellHorAlignRight: "ימין", +DlgCellVerAlign : "יישור אנכי", +DlgCellVerAlignNotSet : "<לא נקבע>", +DlgCellVerAlignTop : "למעלה", +DlgCellVerAlignMiddle : "לאמצע", +DlgCellVerAlignBottom : "לתחתית", +DlgCellVerAlignBaseline : "קו תחתית", +DlgCellRowSpan : "טווח שורות", +DlgCellCollSpan : "טווח עמודות", +DlgCellBackColor : "צבע רקע", +DlgCellBorderColor : "צבע מסגרת", +DlgCellBtnSelect : "בחירה...", + +// Find and Replace Dialog +DlgFindAndReplaceTitle : "חפש והחלף", + +// Find Dialog +DlgFindTitle : "חיפוש", +DlgFindFindBtn : "חיפוש", +DlgFindNotFoundMsg : "הטקסט המבוקש לא נמצא.", + +// Replace Dialog +DlgReplaceTitle : "החלפה", +DlgReplaceFindLbl : "חיפוש מחרוזת:", +DlgReplaceReplaceLbl : "החלפה במחרוזת:", +DlgReplaceCaseChk : "התאמת סוג אותיות (Case)", +DlgReplaceReplaceBtn : "החלפה", +DlgReplaceReplAllBtn : "החלפה בכל העמוד", +DlgReplaceWordChk : "התאמה למילה המלאה", + +// Paste Operations / Dialog +PasteErrorCut : "הגדרות האבטחה בדפדפן שלך לא מאפשרות לעורך לבצע פעולות גזירה אוטומטיות. יש להשתמש במקלדת לשם כך (Ctrl+X).", +PasteErrorCopy : "הגדרות האבטחה בדפדפן שלך לא מאפשרות לעורך לבצע פעולות העתקה אוטומטיות. יש להשתמש במקלדת לשם כך (Ctrl+C).", + +PasteAsText : "הדבקה כטקסט פשוט", +PasteFromWord : "הדבקה מ-וורד", + +DlgPasteMsg2 : "אנא הדבק בתוך הקופסה באמצעות (Ctrl+V) ולחץ על אישור.", +DlgPasteSec : "עקב הגדרות אבטחה בדפדפן, לא ניתן לגשת אל לוח הגזירים (clipboard) בצורה ישירה.אנא בצע הדבק שוב בחלון זה.", +DlgPasteIgnoreFont : "התעלם מהגדרות סוג פונט", +DlgPasteRemoveStyles : "הסר הגדרות סגנון", +DlgPasteCleanBox : "ניקוי קופסה", + +// Color Picker +ColorAutomatic : "אוטומטי", +ColorMoreColors : "צבעים נוספים...", + +// Document Properties +DocProps : "מאפיני מסמך", + +// Anchor Dialog +DlgAnchorTitle : "מאפיני נקודת עיגון", +DlgAnchorName : "שם לנקודת עיגון", +DlgAnchorErrorName : "אנא הזן שם לנקודת עיגון", + +// Speller Pages Dialog +DlgSpellNotInDic : "לא נמצא במילון", +DlgSpellChangeTo : "שנה ל", +DlgSpellBtnIgnore : "התעלם", +DlgSpellBtnIgnoreAll : "התעלם מהכל", +DlgSpellBtnReplace : "החלף", +DlgSpellBtnReplaceAll : "החלף הכל", +DlgSpellBtnUndo : "החזר", +DlgSpellNoSuggestions : "- אין הצעות -", +DlgSpellProgress : "בדיקות איות בתהליך ....", +DlgSpellNoMispell : "בדיקות איות הסתיימה: לא נמצאו שגיעות כתיב", +DlgSpellNoChanges : "בדיקות איות הסתיימה: לא שונתה אף מילה", +DlgSpellOneChange : "בדיקות איות הסתיימה: שונתה מילה אחת", +DlgSpellManyChanges : "בדיקות איות הסתיימה: %1 מילים שונו", + +IeSpellDownload : "בודק האיות לא מותקן, האם אתה מעוניין להוריד?", + +// Button Dialog +DlgButtonText : "טקסט (ערך)", +DlgButtonType : "סוג", +DlgButtonTypeBtn : "כפתור", +DlgButtonTypeSbm : "שלח", +DlgButtonTypeRst : "אפס", + +// Checkbox and Radio Button Dialogs +DlgCheckboxName : "שם", +DlgCheckboxValue : "ערך", +DlgCheckboxSelected : "בחור", + +// Form Dialog +DlgFormName : "שם", +DlgFormAction : "שלח אל", +DlgFormMethod : "סוג שליחה", + +// Select Field Dialog +DlgSelectName : "שם", +DlgSelectValue : "ערך", +DlgSelectSize : "גודל", +DlgSelectLines : "שורות", +DlgSelectChkMulti : "אפשר בחירות מרובות", +DlgSelectOpAvail : "אפשרויות זמינות", +DlgSelectOpText : "טקסט", +DlgSelectOpValue : "ערך", +DlgSelectBtnAdd : "הוסף", +DlgSelectBtnModify : "שנה", +DlgSelectBtnUp : "למעלה", +DlgSelectBtnDown : "למטה", +DlgSelectBtnSetValue : "קבע כברירת מחדל", +DlgSelectBtnDelete : "מחק", + +// Textarea Dialog +DlgTextareaName : "שם", +DlgTextareaCols : "עמודות", +DlgTextareaRows : "שורות", + +// Text Field Dialog +DlgTextName : "שם", +DlgTextValue : "ערך", +DlgTextCharWidth : "רוחב באותיות", +DlgTextMaxChars : "מקסימות אותיות", +DlgTextType : "סוג", +DlgTextTypeText : "טקסט", +DlgTextTypePass : "סיסמה", + +// Hidden Field Dialog +DlgHiddenName : "שם", +DlgHiddenValue : "ערך", + +// Bulleted List Dialog +BulletedListProp : "מאפייני רשימה", +NumberedListProp : "מאפייני רשימה ממוספרת", +DlgLstStart : "התחלה", +DlgLstType : "סוג", +DlgLstTypeCircle : "עיגול", +DlgLstTypeDisc : "דיסק", +DlgLstTypeSquare : "מרובע", +DlgLstTypeNumbers : "מספרים (1, 2, 3)", +DlgLstTypeLCase : "אותיות קטנות (a, b, c)", +DlgLstTypeUCase : "אותיות גדולות (A, B, C)", +DlgLstTypeSRoman : "ספרות רומאיות קטנות (i, ii, iii)", +DlgLstTypeLRoman : "ספרות רומאיות גדולות (I, II, III)", + +// Document Properties Dialog +DlgDocGeneralTab : "כללי", +DlgDocBackTab : "רקע", +DlgDocColorsTab : "צבעים וגבולות", +DlgDocMetaTab : "נתוני META", + +DlgDocPageTitle : "כותרת דף", +DlgDocLangDir : "כיוון שפה", +DlgDocLangDirLTR : "שמאל לימין (LTR)", +DlgDocLangDirRTL : "ימין לשמאל (RTL)", +DlgDocLangCode : "קוד שפה", +DlgDocCharSet : "קידוד אותיות", +DlgDocCharSetCE : "מרכז אירופה", +DlgDocCharSetCT : "סיני מסורתי (Big5)", +DlgDocCharSetCR : "קירילי", +DlgDocCharSetGR : "יוונית", +DlgDocCharSetJP : "יפנית", +DlgDocCharSetKR : "קוראנית", +DlgDocCharSetTR : "טורקית", +DlgDocCharSetUN : "יוני קוד (UTF-8)", +DlgDocCharSetWE : "מערב אירופה", +DlgDocCharSetOther : "קידוד אותיות אחר", + +DlgDocDocType : "הגדרות סוג מסמך", +DlgDocDocTypeOther : "הגדרות סוג מסמך אחרות", +DlgDocIncXHTML : "כלול הגדרות XHTML", +DlgDocBgColor : "צבע רקע", +DlgDocBgImage : "URL לתמונת רקע", +DlgDocBgNoScroll : "רגע ללא גלילה", +DlgDocCText : "טקסט", +DlgDocCLink : "קישור", +DlgDocCVisited : "קישור שבוקר", +DlgDocCActive : " קישור פעיל", +DlgDocMargins : "גבולות דף", +DlgDocMaTop : "למעלה", +DlgDocMaLeft : "שמאלה", +DlgDocMaRight : "ימינה", +DlgDocMaBottom : "למטה", +DlgDocMeIndex : "מפתח עניינים של המסמך )מופרד בפסיק(", +DlgDocMeDescr : "תאור מסמך", +DlgDocMeAuthor : "מחבר", +DlgDocMeCopy : "זכויות יוצרים", +DlgDocPreview : "תצוגה מקדימה", + +// Templates Dialog +Templates : "תבניות", +DlgTemplatesTitle : "תביות תוכן", +DlgTemplatesSelMsg : "אנא בחר תבנית לפתיחה בעורך
    התוכן המקורי ימחק:", +DlgTemplatesLoading : "מעלה רשימת תבניות אנא המתן", +DlgTemplatesNoTpl : "(לא הוגדרו תבניות)", +DlgTemplatesReplace : "החלפת תוכן ממשי", + +// About Dialog +DlgAboutAboutTab : "אודות", +DlgAboutBrowserInfoTab : "גירסת דפדפן", +DlgAboutLicenseTab : "רשיון", +DlgAboutVersion : "גירסא", +DlgAboutInfo : "מידע נוסף ניתן למצוא כאן:" +}; diff --git a/FCKeditor/editor/lang/hi.js b/FCKeditor/editor/lang/hi.js new file mode 100644 index 0000000..019c7fd --- /dev/null +++ b/FCKeditor/editor/lang/hi.js @@ -0,0 +1,516 @@ +/* + * FCKeditor - The text editor for Internet - http://www.fckeditor.net + * Copyright (C) 2003-2007 Frederico Caldeira Knabben + * + * == BEGIN LICENSE == + * + * Licensed under the terms of any of the following licenses at your + * choice: + * + * - GNU General Public License Version 2 or later (the "GPL") + * http://www.gnu.org/licenses/gpl.html + * + * - GNU Lesser General Public License Version 2.1 or later (the "LGPL") + * http://www.gnu.org/licenses/lgpl.html + * + * - Mozilla Public License Version 1.1 or later (the "MPL") + * http://www.mozilla.org/MPL/MPL-1.1.html + * + * == END LICENSE == + * + * Hindi language file. + */ + +var FCKLang = +{ +// Language direction : "ltr" (left to right) or "rtl" (right to left). +Dir : "ltr", + +ToolbarCollapse : "टूलबार सिमटायें", +ToolbarExpand : "टूलबार का विस्तार करें", + +// Toolbar Items and Context Menu +Save : "सेव", +NewPage : "नया पेज", +Preview : "प्रीव्यू", +Cut : "कट", +Copy : "कॉपी", +Paste : "पेस्ट", +PasteText : "पेस्ट (सादा टॅक्स्ट)", +PasteWord : "पेस्ट (वर्ड से)", +Print : "प्रिन्ट", +SelectAll : "सब सॅलॅक्ट करें", +RemoveFormat : "फ़ॉर्मैट हटायें", +InsertLinkLbl : "लिंक", +InsertLink : "लिंक इन्सर्ट/संपादन", +RemoveLink : "लिंक हटायें", +Anchor : "ऐंकर इन्सर्ट/संपादन", +AnchorDelete : "ऐंकर हटायें", +InsertImageLbl : "तस्वीर", +InsertImage : "तस्वीर इन्सर्ट/संपादन", +InsertFlashLbl : "फ़्लैश", +InsertFlash : "फ़्लैश इन्सर्ट/संपादन", +InsertTableLbl : "टेबल", +InsertTable : "टेबल इन्सर्ट/संपादन", +InsertLineLbl : "रेखा", +InsertLine : "हॉरिज़ॉन्टल रेखा इन्सर्ट करें", +InsertSpecialCharLbl: "विशेष करॅक्टर", +InsertSpecialChar : "विशेष करॅक्टर इन्सर्ट करें", +InsertSmileyLbl : "स्माइली", +InsertSmiley : "स्माइली इन्सर्ट करें", +About : "FCKeditor के बारे में", +Bold : "बोल्ड", +Italic : "इटैलिक", +Underline : "रेखांकण", +StrikeThrough : "स्ट्राइक थ्रू", +Subscript : "अधोलेख", +Superscript : "अभिलेख", +LeftJustify : "बायीं तरफ", +CenterJustify : "बीच में", +RightJustify : "दायीं तरफ", +BlockJustify : "ब्लॉक जस्टीफ़ाई", +DecreaseIndent : "इन्डॅन्ट कम करें", +IncreaseIndent : "इन्डॅन्ट बढ़ायें", +Blockquote : "ब्लॉक-कोट", +Undo : "अन्डू", +Redo : "रीडू", +NumberedListLbl : "अंकीय सूची", +NumberedList : "अंकीय सूची इन्सर्ट/संपादन", +BulletedListLbl : "बुलॅट सूची", +BulletedList : "बुलॅट सूची इन्सर्ट/संपादन", +ShowTableBorders : "टेबल बॉर्डरयें दिखायें", +ShowDetails : "ज्यादा दिखायें", +Style : "स्टाइल", +FontFormat : "फ़ॉर्मैट", +Font : "फ़ॉन्ट", +FontSize : "साइज़", +TextColor : "टेक्स्ट रंग", +BGColor : "बैक्ग्राउन्ड रंग", +Source : "सोर्स", +Find : "खोजें", +Replace : "रीप्लेस", +SpellCheck : "वर्तनी (स्पेलिंग) जाँच", +UniversalKeyboard : "यूनीवर्सल कीबोर्ड", +PageBreakLbl : "पेज ब्रेक", +PageBreak : "पेज ब्रेक इन्सर्ट् करें", + +Form : "फ़ॉर्म", +Checkbox : "चॅक बॉक्स", +RadioButton : "रेडिओ बटन", +TextField : "टेक्स्ट फ़ील्ड", +Textarea : "टेक्स्ट एरिया", +HiddenField : "गुप्त फ़ील्ड", +Button : "बटन", +SelectionField : "चुनाव फ़ील्ड", +ImageButton : "तस्वीर बटन", + +FitWindow : "एडिटर साइज़ को चरम सीमा तक बढ़ायें", +ShowBlocks : "ब्लॉक दिखायें", + +// Context Menu +EditLink : "लिंक संपादन", +CellCM : "खाना", +RowCM : "पंक्ति", +ColumnCM : "कालम", +InsertRowAfter : "बाद में पंक्ति डालें", +InsertRowBefore : "पहले पंक्ति डालें", +DeleteRows : "पंक्तियाँ डिलीट करें", +InsertColumnAfter : "बाद में कालम डालें", +InsertColumnBefore : "पहले कालम डालें", +DeleteColumns : "कालम डिलीट करें", +InsertCellAfter : "बाद में सैल डालें", +InsertCellBefore : "पहले सैल डालें", +DeleteCells : "सैल डिलीट करें", +MergeCells : "सैल मिलायें", +MergeRight : "बाँया विलय", +MergeDown : "नीचे विलय करें", +HorizontalSplitCell : "सैल को क्षैतिज स्थिति में विभाजित करें", +VerticalSplitCell : "सैल को लम्बाकार में विभाजित करें", +TableDelete : "टेबल डिलीट करें", +CellProperties : "सैल प्रॉपर्टीज़", +TableProperties : "टेबल प्रॉपर्टीज़", +ImageProperties : "तस्वीर प्रॉपर्टीज़", +FlashProperties : "फ़्लैश प्रॉपर्टीज़", + +AnchorProp : "ऐंकर प्रॉपर्टीज़", +ButtonProp : "बटन प्रॉपर्टीज़", +CheckboxProp : "चॅक बॉक्स प्रॉपर्टीज़", +HiddenFieldProp : "गुप्त फ़ील्ड प्रॉपर्टीज़", +RadioButtonProp : "रेडिओ बटन प्रॉपर्टीज़", +ImageButtonProp : "तस्वीर बटन प्रॉपर्टीज़", +TextFieldProp : "टेक्स्ट फ़ील्ड प्रॉपर्टीज़", +SelectionFieldProp : "चुनाव फ़ील्ड प्रॉपर्टीज़", +TextareaProp : "टेक्स्त एरिया प्रॉपर्टीज़", +FormProp : "फ़ॉर्म प्रॉपर्टीज़", + +FontFormats : "साधारण;फ़ॉर्मैटॅड;पता;शीर्षक 1;शीर्षक 2;शीर्षक 3;शीर्षक 4;शीर्षक 5;शीर्षक 6;शीर्षक (DIV)", + +// Alerts and Messages +ProcessingXHTML : "XHTML प्रोसॅस हो रहा है। ज़रा ठहरें...", +Done : "पूरा हुआ", +PasteWordConfirm : "आप जो टेक्स्ट पेस्ट करना चाहते हैं, वह वर्ड से कॉपी किया हुआ लग रहा है। क्या पेस्ट करने से पहले आप इसे साफ़ करना चाहेंगे?", +NotCompatiblePaste : "यह कमांड इन्टरनॅट एक्स्प्लोरर(Internet Explorer) 5.5 या उसके बाद के वर्ज़न के लिए ही उपलब्ध है। क्या आप बिना साफ़ किए पेस्ट करना चाहेंगे?", +UnknownToolbarItem : "अनजान टूलबार आइटम \"%1\"", +UnknownCommand : "अनजान कमान्ड \"%1\"", +NotImplemented : "कमान्ड इम्प्लीमॅन्ट नहीं किया गया है", +UnknownToolbarSet : "टूलबार सॅट \"%1\" उपलब्ध नहीं है", +NoActiveX : "आपके ब्राउज़र् की सुरक्शा सेटिंग्स् एडिटर की कुछ् फ़ीचरों को सीमित कर् सकती हैं। क्रिपया \"Run ActiveX controls and plug-ins\" विकल्प को एनेबल करें. आपको एरर्स् और गायब फ़ीचर्स् का अनुभव हो सकता है।", +BrowseServerBlocked : "रिसोर्सेज़ ब्राउज़र् नहीं खोला जा सका। क्रिपया सभी पॉप्-अप् ब्लॉकर्स् को डिसेबल करें।", +DialogBlocked : "डायलग विन्डो नहीं खोला जा सका। क्रिपया सभी पॉप्-अप् ब्लॉकर्स् को डिसेबल करें।", + +// Dialogs +DlgBtnOK : "ठीक है", +DlgBtnCancel : "रद्द करें", +DlgBtnClose : "बन्द करें", +DlgBtnBrowseServer : "सर्वर ब्राउज़ करें", +DlgAdvancedTag : "ऍड्वान्स्ड", +DlgOpOther : "<अन्य>", +DlgInfoTab : "सूचना", +DlgAlertUrl : "URL इन्सर्ट करें", + +// General Dialogs Labels +DlgGenNotSet : "<सॅट नहीं>", +DlgGenId : "Id", +DlgGenLangDir : "भाषा लिखने की दिशा", +DlgGenLangDirLtr : "बायें से दायें (LTR)", +DlgGenLangDirRtl : "दायें से बायें (RTL)", +DlgGenLangCode : "भाषा कोड", +DlgGenAccessKey : "ऍक्सॅस की", +DlgGenName : "नाम", +DlgGenTabIndex : "टैब इन्डॅक्स", +DlgGenLongDescr : "अधिक विवरण के लिए URL", +DlgGenClass : "स्टाइल-शीट क्लास", +DlgGenTitle : "परामर्श शीर्शक", +DlgGenContType : "परामर्श कन्टॅन्ट प्रकार", +DlgGenLinkCharset : "लिंक रिसोर्स करॅक्टर सॅट", +DlgGenStyle : "स्टाइल", + +// Image Dialog +DlgImgTitle : "तस्वीर प्रॉपर्टीज़", +DlgImgInfoTab : "तस्वीर की जानकारी", +DlgImgBtnUpload : "इसे सर्वर को भेजें", +DlgImgURL : "URL", +DlgImgUpload : "अपलोड", +DlgImgAlt : "वैकल्पिक टेक्स्ट", +DlgImgWidth : "चौड़ाई", +DlgImgHeight : "ऊँचाई", +DlgImgLockRatio : "लॉक अनुपात", +DlgBtnResetSize : "रीसॅट साइज़", +DlgImgBorder : "बॉर्डर", +DlgImgHSpace : "हॉरिज़ॉन्टल स्पेस", +DlgImgVSpace : "वर्टिकल स्पेस", +DlgImgAlign : "ऍलाइन", +DlgImgAlignLeft : "दायें", +DlgImgAlignAbsBottom: "Abs नीचे", +DlgImgAlignAbsMiddle: "Abs ऊपर", +DlgImgAlignBaseline : "मूल रेखा", +DlgImgAlignBottom : "नीचे", +DlgImgAlignMiddle : "मध्य", +DlgImgAlignRight : "दायें", +DlgImgAlignTextTop : "टेक्स्ट ऊपर", +DlgImgAlignTop : "ऊपर", +DlgImgPreview : "प्रीव्यू", +DlgImgAlertUrl : "तस्वीर का URL टाइप करें ", +DlgImgLinkTab : "लिंक", + +// Flash Dialog +DlgFlashTitle : "फ़्लैश प्रॉपर्टीज़", +DlgFlashChkPlay : "ऑटो प्ले", +DlgFlashChkLoop : "लूप", +DlgFlashChkMenu : "फ़्लैश मॅन्यू का प्रयोग करें", +DlgFlashScale : "स्केल", +DlgFlashScaleAll : "सभी दिखायें", +DlgFlashScaleNoBorder : "कोई बॉर्डर नहीं", +DlgFlashScaleFit : "बिल्कुल फ़िट", + +// Link Dialog +DlgLnkWindowTitle : "लिंक", +DlgLnkInfoTab : "लिंक ", +DlgLnkTargetTab : "टार्गेट", + +DlgLnkType : "लिंक प्रकार", +DlgLnkTypeURL : "URL", +DlgLnkTypeAnchor : "इस पेज का ऐंकर", +DlgLnkTypeEMail : "ई-मेल", +DlgLnkProto : "प्रोटोकॉल", +DlgLnkProtoOther : "<अन्य>", +DlgLnkURL : "URL", +DlgLnkAnchorSel : "ऐंकर चुनें", +DlgLnkAnchorByName : "ऐंकर नाम से", +DlgLnkAnchorById : "ऍलीमॅन्ट Id से", +DlgLnkNoAnchors : "(डॉक्यूमॅन्ट में ऐंकर्स की संख्या)", +DlgLnkEMail : "ई-मेल पता", +DlgLnkEMailSubject : "संदेश विषय", +DlgLnkEMailBody : "संदेश", +DlgLnkUpload : "अपलोड", +DlgLnkBtnUpload : "इसे सर्वर को भेजें", + +DlgLnkTarget : "टार्गेट", +DlgLnkTargetFrame : "<फ़्रेम>", +DlgLnkTargetPopup : "<पॉप-अप विन्डो>", +DlgLnkTargetBlank : "नया विन्डो (_blank)", +DlgLnkTargetParent : "मूल विन्डो (_parent)", +DlgLnkTargetSelf : "इसी विन्डो (_self)", +DlgLnkTargetTop : "शीर्ष विन्डो (_top)", +DlgLnkTargetFrameName : "टार्गेट फ़्रेम का नाम", +DlgLnkPopWinName : "पॉप-अप विन्डो का नाम", +DlgLnkPopWinFeat : "पॉप-अप विन्डो फ़ीचर्स", +DlgLnkPopResize : "साइज़ बदला जा सकता है", +DlgLnkPopLocation : "लोकेशन बार", +DlgLnkPopMenu : "मॅन्यू बार", +DlgLnkPopScroll : "स्क्रॉल बार", +DlgLnkPopStatus : "स्टेटस बार", +DlgLnkPopToolbar : "टूल बार", +DlgLnkPopFullScrn : "फ़ुल स्क्रीन (IE)", +DlgLnkPopDependent : "डिपेन्डॅन्ट (Netscape)", +DlgLnkPopWidth : "चौड़ाई", +DlgLnkPopHeight : "ऊँचाई", +DlgLnkPopLeft : "बायीं तरफ", +DlgLnkPopTop : "दायीं तरफ", + +DlnLnkMsgNoUrl : "लिंक URL टाइप करें", +DlnLnkMsgNoEMail : "ई-मेल पता टाइप करें", +DlnLnkMsgNoAnchor : "ऐंकर चुनें", +DlnLnkMsgInvPopName : "पॉप-अप का नाम अल्फाबेट से शुरू होना चाहिये और उसमें स्पेस नहीं होने चाहिए", + +// Color Dialog +DlgColorTitle : "रंग चुनें", +DlgColorBtnClear : "साफ़ करें", +DlgColorHighlight : "हाइलाइट", +DlgColorSelected : "सॅलॅक्टॅड", + +// Smiley Dialog +DlgSmileyTitle : "स्माइली इन्सर्ट करें", + +// Special Character Dialog +DlgSpecialCharTitle : "विशेष करॅक्टर चुनें", + +// Table Dialog +DlgTableTitle : "टेबल प्रॉपर्टीज़", +DlgTableRows : "पंक्तियाँ", +DlgTableColumns : "कालम", +DlgTableBorder : "बॉर्डर साइज़", +DlgTableAlign : "ऍलाइन्मॅन्ट", +DlgTableAlignNotSet : "<सॅट नहीं>", +DlgTableAlignLeft : "दायें", +DlgTableAlignCenter : "बीच में", +DlgTableAlignRight : "बायें", +DlgTableWidth : "चौड़ाई", +DlgTableWidthPx : "पिक्सैल", +DlgTableWidthPc : "प्रतिशत", +DlgTableHeight : "ऊँचाई", +DlgTableCellSpace : "सैल अंतर", +DlgTableCellPad : "सैल पैडिंग", +DlgTableCaption : "शीर्षक", +DlgTableSummary : "सारांश", + +// Table Cell Dialog +DlgCellTitle : "सैल प्रॉपर्टीज़", +DlgCellWidth : "चौड़ाई", +DlgCellWidthPx : "पिक्सैल", +DlgCellWidthPc : "प्रतिशत", +DlgCellHeight : "ऊँचाई", +DlgCellWordWrap : "वर्ड रैप", +DlgCellWordWrapNotSet : "<सॅट नहीं>", +DlgCellWordWrapYes : "हाँ", +DlgCellWordWrapNo : "नहीं", +DlgCellHorAlign : "हॉरिज़ॉन्टल ऍलाइन्मॅन्ट", +DlgCellHorAlignNotSet : "<सॅट नहीं>", +DlgCellHorAlignLeft : "दायें", +DlgCellHorAlignCenter : "बीच में", +DlgCellHorAlignRight: "बायें", +DlgCellVerAlign : "वर्टिकल ऍलाइन्मॅन्ट", +DlgCellVerAlignNotSet : "<सॅट नहीं>", +DlgCellVerAlignTop : "ऊपर", +DlgCellVerAlignMiddle : "मध्य", +DlgCellVerAlignBottom : "नीचे", +DlgCellVerAlignBaseline : "मूलरेखा", +DlgCellRowSpan : "पंक्ति स्पैन", +DlgCellCollSpan : "कालम स्पैन", +DlgCellBackColor : "बैक्ग्राउन्ड रंग", +DlgCellBorderColor : "बॉर्डर का रंग", +DlgCellBtnSelect : "चुनें...", + +// Find and Replace Dialog +DlgFindAndReplaceTitle : "खोजें और बदलें", + +// Find Dialog +DlgFindTitle : "खोजें", +DlgFindFindBtn : "खोजें", +DlgFindNotFoundMsg : "आपके द्वारा दिया गया टेक्स्ट नहीं मिला", + +// Replace Dialog +DlgReplaceTitle : "रिप्लेस", +DlgReplaceFindLbl : "यह खोजें:", +DlgReplaceReplaceLbl : "इससे रिप्लेस करें:", +DlgReplaceCaseChk : "केस मिलायें", +DlgReplaceReplaceBtn : "रिप्लेस", +DlgReplaceReplAllBtn : "सभी रिप्लेस करें", +DlgReplaceWordChk : "पूरा शब्द मिलायें", + +// Paste Operations / Dialog +PasteErrorCut : "आपके ब्राउज़र की सुरक्षा सॅटिन्ग्स ने कट करने की अनुमति नहीं प्रदान की है। (Ctrl+X) का प्रयोग करें।", +PasteErrorCopy : "आपके ब्राआउज़र की सुरक्षा सॅटिन्ग्स ने कॉपी करने की अनुमति नहीं प्रदान की है। (Ctrl+C) का प्रयोग करें।", + +PasteAsText : "पेस्ट (सादा टॅक्स्ट)", +PasteFromWord : "पेस्ट (वर्ड से)", + +DlgPasteMsg2 : "Ctrl+V का प्रयोग करके पेस्ट करें और ठीक है करें.", +DlgPasteSec : "आपके ब्राउज़र की सुरक्षा आपके ब्राउज़र की सुरKश सैटिंग के कारण, एडिटर आपके क्लिपबोर्ड डेटा को नहीं पा सकता है. आपको उसे इस विन्डो में दोबारा पेस्ट करना होगा.", +DlgPasteIgnoreFont : "फ़ॉन्ट परिभाषा निकालें", +DlgPasteRemoveStyles : "स्टाइल परिभाषा निकालें", +DlgPasteCleanBox : "बॉक्स साफ़ करें", + +// Color Picker +ColorAutomatic : "स्वचालित", +ColorMoreColors : "और रंग...", + +// Document Properties +DocProps : "डॉक्यूमॅन्ट प्रॉपर्टीज़", + +// Anchor Dialog +DlgAnchorTitle : "ऐंकर प्रॉपर्टीज़", +DlgAnchorName : "ऐंकर का नाम", +DlgAnchorErrorName : "ऐंकर का नाम टाइप करें", + +// Speller Pages Dialog +DlgSpellNotInDic : "शब्दकोश में नहीं", +DlgSpellChangeTo : "इसमें बदलें", +DlgSpellBtnIgnore : "इग्नोर", +DlgSpellBtnIgnoreAll : "सभी इग्नोर करें", +DlgSpellBtnReplace : "रिप्लेस", +DlgSpellBtnReplaceAll : "सभी रिप्लेस करें", +DlgSpellBtnUndo : "अन्डू", +DlgSpellNoSuggestions : "- कोई सुझाव नहीं -", +DlgSpellProgress : "वर्तनी की जाँच (स्पॅल-चॅक) जारी है...", +DlgSpellNoMispell : "वर्तनी की जाँच : कोई गलत वर्तनी (स्पॅलिंग) नहीं पाई गई", +DlgSpellNoChanges : "वर्तनी की जाँच :कोई शब्द नहीं बदला गया", +DlgSpellOneChange : "वर्तनी की जाँच : एक शब्द बदला गया", +DlgSpellManyChanges : "वर्तनी की जाँच : %1 शब्द बदले गये", + +IeSpellDownload : "स्पॅल-चॅकर इन्स्टाल नहीं किया गया है। क्या आप इसे डा‌उनलोड करना चाहेंगे?", + +// Button Dialog +DlgButtonText : "टेक्स्ट (वैल्यू)", +DlgButtonType : "प्रकार", +DlgButtonTypeBtn : "बटन", +DlgButtonTypeSbm : "सब्मिट", +DlgButtonTypeRst : "रिसेट", + +// Checkbox and Radio Button Dialogs +DlgCheckboxName : "नाम", +DlgCheckboxValue : "वैल्यू", +DlgCheckboxSelected : "सॅलॅक्टॅड", + +// Form Dialog +DlgFormName : "नाम", +DlgFormAction : "क्रिया", +DlgFormMethod : "तरीका", + +// Select Field Dialog +DlgSelectName : "नाम", +DlgSelectValue : "वैल्यू", +DlgSelectSize : "साइज़", +DlgSelectLines : "पंक्तियाँ", +DlgSelectChkMulti : "एक से ज्यादा विकल्प चुनने दें", +DlgSelectOpAvail : "उपलब्ध विकल्प", +DlgSelectOpText : "टेक्स्ट", +DlgSelectOpValue : "वैल्यू", +DlgSelectBtnAdd : "जोड़ें", +DlgSelectBtnModify : "बदलें", +DlgSelectBtnUp : "ऊपर", +DlgSelectBtnDown : "नीचे", +DlgSelectBtnSetValue : "चुनी गई वैल्यू सॅट करें", +DlgSelectBtnDelete : "डिलीट", + +// Textarea Dialog +DlgTextareaName : "नाम", +DlgTextareaCols : "कालम", +DlgTextareaRows : "पंक्तियां", + +// Text Field Dialog +DlgTextName : "नाम", +DlgTextValue : "वैल्यू", +DlgTextCharWidth : "करॅक्टर की चौढ़ाई", +DlgTextMaxChars : "अधिकतम करॅक्टर", +DlgTextType : "टाइप", +DlgTextTypeText : "टेक्स्ट", +DlgTextTypePass : "पास्वर्ड", + +// Hidden Field Dialog +DlgHiddenName : "नाम", +DlgHiddenValue : "वैल्यू", + +// Bulleted List Dialog +BulletedListProp : "बुलॅट सूची प्रॉपर्टीज़", +NumberedListProp : "अंकीय सूची प्रॉपर्टीज़", +DlgLstStart : "प्रारम्भ", +DlgLstType : "प्रकार", +DlgLstTypeCircle : "गोल", +DlgLstTypeDisc : "डिस्क", +DlgLstTypeSquare : "चौकॊण", +DlgLstTypeNumbers : "अंक (1, 2, 3)", +DlgLstTypeLCase : "छोटे अक्षर (a, b, c)", +DlgLstTypeUCase : "बड़े अक्षर (A, B, C)", +DlgLstTypeSRoman : "छोटे रोमन अंक (i, ii, iii)", +DlgLstTypeLRoman : "बड़े रोमन अंक (I, II, III)", + +// Document Properties Dialog +DlgDocGeneralTab : "आम", +DlgDocBackTab : "बैक्ग्राउन्ड", +DlgDocColorsTab : "रंग और मार्जिन", +DlgDocMetaTab : "मॅटाडेटा", + +DlgDocPageTitle : "पेज शीर्षक", +DlgDocLangDir : "भाषा लिखने की दिशा", +DlgDocLangDirLTR : "बायें से दायें (LTR)", +DlgDocLangDirRTL : "दायें से बायें (RTL)", +DlgDocLangCode : "भाषा कोड", +DlgDocCharSet : "करेक्टर सॅट ऍन्कोडिंग", +DlgDocCharSetCE : "मध्य यूरोपीय (Central European)", +DlgDocCharSetCT : "चीनी (Chinese Traditional Big5)", +DlgDocCharSetCR : "सिरीलिक (Cyrillic)", +DlgDocCharSetGR : "यवन (Greek)", +DlgDocCharSetJP : "जापानी (Japanese)", +DlgDocCharSetKR : "कोरीयन (Korean)", +DlgDocCharSetTR : "तुर्की (Turkish)", +DlgDocCharSetUN : "यूनीकोड (UTF-8)", +DlgDocCharSetWE : "पश्चिम यूरोपीय (Western European)", +DlgDocCharSetOther : "अन्य करेक्टर सॅट ऍन्कोडिंग", + +DlgDocDocType : "डॉक्यूमॅन्ट प्रकार शीर्षक", +DlgDocDocTypeOther : "अन्य डॉक्यूमॅन्ट प्रकार शीर्षक", +DlgDocIncXHTML : "XHTML सूचना सम्मिलित करें", +DlgDocBgColor : "बैक्ग्राउन्ड रंग", +DlgDocBgImage : "बैक्ग्राउन्ड तस्वीर URL", +DlgDocBgNoScroll : "स्क्रॉल न करने वाला बैक्ग्राउन्ड", +DlgDocCText : "टेक्स्ट", +DlgDocCLink : "लिंक", +DlgDocCVisited : "विज़िट किया गया लिंक", +DlgDocCActive : "सक्रिय लिंक", +DlgDocMargins : "पेज मार्जिन", +DlgDocMaTop : "ऊपर", +DlgDocMaLeft : "बायें", +DlgDocMaRight : "दायें", +DlgDocMaBottom : "नीचे", +DlgDocMeIndex : "डॉक्युमॅन्ट इन्डेक्स संकेतशब्द (अल्पविराम से अलग करें)", +DlgDocMeDescr : "डॉक्यूमॅन्ट करॅक्टरन", +DlgDocMeAuthor : "लेखक", +DlgDocMeCopy : "कॉपीराइट", +DlgDocPreview : "प्रीव्यू", + +// Templates Dialog +Templates : "टॅम्प्लेट", +DlgTemplatesTitle : "कन्टेन्ट टॅम्प्लेट", +DlgTemplatesSelMsg : "ऍडिटर में ओपन करने हेतु टॅम्प्लेट चुनें(वर्तमान कन्टॅन्ट सेव नहीं होंगे):", +DlgTemplatesLoading : "टॅम्प्लेट सूची लोड की जा रही है। ज़रा ठहरें...", +DlgTemplatesNoTpl : "(कोई टॅम्प्लेट डिफ़ाइन नहीं किया गया है)", +DlgTemplatesReplace : "मूल शब्दों को बदलें", + +// About Dialog +DlgAboutAboutTab : "FCKEditor के बारे में", +DlgAboutBrowserInfoTab : "ब्राउज़र के बारे में", +DlgAboutLicenseTab : "लाइसैन्स", +DlgAboutVersion : "वर्ज़न", +DlgAboutInfo : "अधिक जानकारी के लिये यहाँ जायें:" +}; diff --git a/FCKeditor/editor/lang/hr.js b/FCKeditor/editor/lang/hr.js new file mode 100644 index 0000000..c6ced7f --- /dev/null +++ b/FCKeditor/editor/lang/hr.js @@ -0,0 +1,516 @@ +/* + * FCKeditor - The text editor for Internet - http://www.fckeditor.net + * Copyright (C) 2003-2007 Frederico Caldeira Knabben + * + * == BEGIN LICENSE == + * + * Licensed under the terms of any of the following licenses at your + * choice: + * + * - GNU General Public License Version 2 or later (the "GPL") + * http://www.gnu.org/licenses/gpl.html + * + * - GNU Lesser General Public License Version 2.1 or later (the "LGPL") + * http://www.gnu.org/licenses/lgpl.html + * + * - Mozilla Public License Version 1.1 or later (the "MPL") + * http://www.mozilla.org/MPL/MPL-1.1.html + * + * == END LICENSE == + * + * Croatian language file. + */ + +var FCKLang = +{ +// Language direction : "ltr" (left to right) or "rtl" (right to left). +Dir : "ltr", + +ToolbarCollapse : "Smanji trake s alatima", +ToolbarExpand : "Proširi trake s alatima", + +// Toolbar Items and Context Menu +Save : "Snimi", +NewPage : "Nova stranica", +Preview : "Pregledaj", +Cut : "Izreži", +Copy : "Kopiraj", +Paste : "Zalijepi", +PasteText : "Zalijepi kao čisti tekst", +PasteWord : "Zalijepi iz Worda", +Print : "Ispiši", +SelectAll : "Odaberi sve", +RemoveFormat : "Ukloni formatiranje", +InsertLinkLbl : "Link", +InsertLink : "Ubaci/promijeni link", +RemoveLink : "Ukloni link", +Anchor : "Ubaci/promijeni sidro", +AnchorDelete : "Ukloni sidro", +InsertImageLbl : "Slika", +InsertImage : "Ubaci/promijeni sliku", +InsertFlashLbl : "Flash", +InsertFlash : "Ubaci/promijeni Flash", +InsertTableLbl : "Tablica", +InsertTable : "Ubaci/promijeni tablicu", +InsertLineLbl : "Linija", +InsertLine : "Ubaci vodoravnu liniju", +InsertSpecialCharLbl: "Posebni karakteri", +InsertSpecialChar : "Ubaci posebne znakove", +InsertSmileyLbl : "Smješko", +InsertSmiley : "Ubaci smješka", +About : "O FCKeditoru", +Bold : "Podebljaj", +Italic : "Ukosi", +Underline : "Potcrtano", +StrikeThrough : "Precrtano", +Subscript : "Subscript", +Superscript : "Superscript", +LeftJustify : "Lijevo poravnanje", +CenterJustify : "Središnje poravnanje", +RightJustify : "Desno poravnanje", +BlockJustify : "Blok poravnanje", +DecreaseIndent : "Pomakni ulijevo", +IncreaseIndent : "Pomakni udesno", +Blockquote : "Blockquote", +Undo : "Poništi", +Redo : "Ponovi", +NumberedListLbl : "Brojčana lista", +NumberedList : "Ubaci/ukloni brojčanu listu", +BulletedListLbl : "Obična lista", +BulletedList : "Ubaci/ukloni običnu listu", +ShowTableBorders : "Prikaži okvir tablice", +ShowDetails : "Prikaži detalje", +Style : "Stil", +FontFormat : "Format", +Font : "Font", +FontSize : "Veličina", +TextColor : "Boja teksta", +BGColor : "Boja pozadine", +Source : "Kôd", +Find : "Pronađi", +Replace : "Zamijeni", +SpellCheck : "Provjeri pravopis", +UniversalKeyboard : "Univerzalna tipkovnica", +PageBreakLbl : "Prijelom stranice", +PageBreak : "Ubaci prijelom stranice", + +Form : "Form", +Checkbox : "Checkbox", +RadioButton : "Radio Button", +TextField : "Text Field", +Textarea : "Textarea", +HiddenField : "Hidden Field", +Button : "Button", +SelectionField : "Selection Field", +ImageButton : "Image Button", + +FitWindow : "Povećaj veličinu editora", +ShowBlocks : "Prikaži blokove", + +// Context Menu +EditLink : "Promijeni link", +CellCM : "Ćelija", +RowCM : "Red", +ColumnCM : "Kolona", +InsertRowAfter : "Ubaci red poslije", +InsertRowBefore : "Ubaci red prije", +DeleteRows : "Izbriši redove", +InsertColumnAfter : "Ubaci kolonu poslije", +InsertColumnBefore : "Ubaci kolonu prije", +DeleteColumns : "Izbriši kolone", +InsertCellAfter : "Ubaci ćeliju poslije", +InsertCellBefore : "Ubaci ćeliju prije", +DeleteCells : "Izbriši ćelije", +MergeCells : "Spoji ćelije", +MergeRight : "Spoji desno", +MergeDown : "Spoji dolje", +HorizontalSplitCell : "Podijeli ćeliju vodoravno", +VerticalSplitCell : "Podijeli ćeliju okomito", +TableDelete : "Izbriši tablicu", +CellProperties : "Svojstva ćelije", +TableProperties : "Svojstva tablice", +ImageProperties : "Svojstva slike", +FlashProperties : "Flash svojstva", + +AnchorProp : "Svojstva sidra", +ButtonProp : "Image Button svojstva", +CheckboxProp : "Checkbox svojstva", +HiddenFieldProp : "Hidden Field svojstva", +RadioButtonProp : "Radio Button svojstva", +ImageButtonProp : "Image Button svojstva", +TextFieldProp : "Text Field svojstva", +SelectionFieldProp : "Selection svojstva", +TextareaProp : "Textarea svojstva", +FormProp : "Form svojstva", + +FontFormats : "Normal;Formatted;Address;Heading 1;Heading 2;Heading 3;Heading 4;Heading 5;Heading 6;Normal (DIV)", + +// Alerts and Messages +ProcessingXHTML : "Obrađujem XHTML. Molimo pričekajte...", +Done : "Završio", +PasteWordConfirm : "Tekst koji želite zalijepiti čini se da je kopiran iz Worda. Želite li prije očistiti tekst?", +NotCompatiblePaste : "Ova naredba je dostupna samo u Internet Exploreru 5.5 ili novijem. Želite li nastaviti bez čišćenja?", +UnknownToolbarItem : "Nepoznati član trake s alatima \"%1\"", +UnknownCommand : "Nepoznata naredba \"%1\"", +NotImplemented : "Naredba nije implementirana", +UnknownToolbarSet : "Traka s alatima \"%1\" ne postoji", +NoActiveX : "Vaše postavke pretraživača mogle bi ograničiti neke od mogućnosti editora. Morate uključiti opciju \"Run ActiveX controls and plug-ins\" u postavkama. Ukoliko to ne učinite, moguće su razliite greške tijekom rada.", +BrowseServerBlocked : "Pretraivač nije moguće otvoriti. Provjerite da li je uključeno blokiranje pop-up prozora.", +DialogBlocked : "Nije moguće otvoriti novi prozor. Provjerite da li je uključeno blokiranje pop-up prozora.", + +// Dialogs +DlgBtnOK : "OK", +DlgBtnCancel : "Poništi", +DlgBtnClose : "Zatvori", +DlgBtnBrowseServer : "Pretraži server", +DlgAdvancedTag : "Napredno", +DlgOpOther : "", +DlgInfoTab : "Info", +DlgAlertUrl : "Molimo unesite URL", + +// General Dialogs Labels +DlgGenNotSet : "", +DlgGenId : "Id", +DlgGenLangDir : "Smjer jezika", +DlgGenLangDirLtr : "S lijeva na desno (LTR)", +DlgGenLangDirRtl : "S desna na lijevo (RTL)", +DlgGenLangCode : "Kôd jezika", +DlgGenAccessKey : "Pristupna tipka", +DlgGenName : "Naziv", +DlgGenTabIndex : "Tab Indeks", +DlgGenLongDescr : "Dugački opis URL", +DlgGenClass : "Stylesheet klase", +DlgGenTitle : "Advisory naslov", +DlgGenContType : "Advisory vrsta sadržaja", +DlgGenLinkCharset : "Kodna stranica povezanih resursa", +DlgGenStyle : "Stil", + +// Image Dialog +DlgImgTitle : "Svojstva slika", +DlgImgInfoTab : "Info slike", +DlgImgBtnUpload : "Pošalji na server", +DlgImgURL : "URL", +DlgImgUpload : "Pošalji", +DlgImgAlt : "Alternativni tekst", +DlgImgWidth : "Širina", +DlgImgHeight : "Visina", +DlgImgLockRatio : "Zaključaj odnos", +DlgBtnResetSize : "Obriši veličinu", +DlgImgBorder : "Okvir", +DlgImgHSpace : "HSpace", +DlgImgVSpace : "VSpace", +DlgImgAlign : "Poravnaj", +DlgImgAlignLeft : "Lijevo", +DlgImgAlignAbsBottom: "Abs dolje", +DlgImgAlignAbsMiddle: "Abs sredina", +DlgImgAlignBaseline : "Bazno", +DlgImgAlignBottom : "Dolje", +DlgImgAlignMiddle : "Sredina", +DlgImgAlignRight : "Desno", +DlgImgAlignTextTop : "Vrh teksta", +DlgImgAlignTop : "Vrh", +DlgImgPreview : "Pregledaj", +DlgImgAlertUrl : "Unesite URL slike", +DlgImgLinkTab : "Link", + +// Flash Dialog +DlgFlashTitle : "Flash svojstva", +DlgFlashChkPlay : "Auto Play", +DlgFlashChkLoop : "Ponavljaj", +DlgFlashChkMenu : "Omogući Flash izbornik", +DlgFlashScale : "Omjer", +DlgFlashScaleAll : "Prikaži sve", +DlgFlashScaleNoBorder : "Bez okvira", +DlgFlashScaleFit : "Točna veličina", + +// Link Dialog +DlgLnkWindowTitle : "Link", +DlgLnkInfoTab : "Link Info", +DlgLnkTargetTab : "Meta", + +DlgLnkType : "Link vrsta", +DlgLnkTypeURL : "URL", +DlgLnkTypeAnchor : "Sidro na ovoj stranici", +DlgLnkTypeEMail : "E-Mail", +DlgLnkProto : "Protokol", +DlgLnkProtoOther : "", +DlgLnkURL : "URL", +DlgLnkAnchorSel : "Odaberi sidro", +DlgLnkAnchorByName : "Po nazivu sidra", +DlgLnkAnchorById : "Po Id elementa", +DlgLnkNoAnchors : "(Nema dostupnih sidra)", +DlgLnkEMail : "E-Mail adresa", +DlgLnkEMailSubject : "Naslov", +DlgLnkEMailBody : "Sadržaj poruke", +DlgLnkUpload : "Pošalji", +DlgLnkBtnUpload : "Pošalji na server", + +DlgLnkTarget : "Meta", +DlgLnkTargetFrame : "", +DlgLnkTargetPopup : "", +DlgLnkTargetBlank : "Novi prozor (_blank)", +DlgLnkTargetParent : "Roditeljski prozor (_parent)", +DlgLnkTargetSelf : "Isti prozor (_self)", +DlgLnkTargetTop : "Vršni prozor (_top)", +DlgLnkTargetFrameName : "Ime ciljnog okvira", +DlgLnkPopWinName : "Naziv popup prozora", +DlgLnkPopWinFeat : "Mogućnosti popup prozora", +DlgLnkPopResize : "Promjenljive veličine", +DlgLnkPopLocation : "Traka za lokaciju", +DlgLnkPopMenu : "Izborna traka", +DlgLnkPopScroll : "Scroll traka", +DlgLnkPopStatus : "Statusna traka", +DlgLnkPopToolbar : "Traka s alatima", +DlgLnkPopFullScrn : "Cijeli ekran (IE)", +DlgLnkPopDependent : "Ovisno (Netscape)", +DlgLnkPopWidth : "Širina", +DlgLnkPopHeight : "Visina", +DlgLnkPopLeft : "Lijeva pozicija", +DlgLnkPopTop : "Gornja pozicija", + +DlnLnkMsgNoUrl : "Molimo upišite URL link", +DlnLnkMsgNoEMail : "Molimo upišite e-mail adresu", +DlnLnkMsgNoAnchor : "Molimo odaberite sidro", +DlnLnkMsgInvPopName : "Ime popup prozora mora početi sa slovom i ne smije sadržavati razmake", + +// Color Dialog +DlgColorTitle : "Odaberite boju", +DlgColorBtnClear : "Obriši", +DlgColorHighlight : "Osvijetli", +DlgColorSelected : "Odaberi", + +// Smiley Dialog +DlgSmileyTitle : "Ubaci smješka", + +// Special Character Dialog +DlgSpecialCharTitle : "Odaberite posebni karakter", + +// Table Dialog +DlgTableTitle : "Svojstva tablice", +DlgTableRows : "Redova", +DlgTableColumns : "Kolona", +DlgTableBorder : "Veličina okvira", +DlgTableAlign : "Poravnanje", +DlgTableAlignNotSet : "", +DlgTableAlignLeft : "Lijevo", +DlgTableAlignCenter : "Središnje", +DlgTableAlignRight : "Desno", +DlgTableWidth : "Širina", +DlgTableWidthPx : "piksela", +DlgTableWidthPc : "postotaka", +DlgTableHeight : "Visina", +DlgTableCellSpace : "Prostornost ćelija", +DlgTableCellPad : "Razmak ćelija", +DlgTableCaption : "Naslov", +DlgTableSummary : "Sažetak", + +// Table Cell Dialog +DlgCellTitle : "Svojstva ćelije", +DlgCellWidth : "Širina", +DlgCellWidthPx : "piksela", +DlgCellWidthPc : "postotaka", +DlgCellHeight : "Visina", +DlgCellWordWrap : "Word Wrap", +DlgCellWordWrapNotSet : "", +DlgCellWordWrapYes : "Da", +DlgCellWordWrapNo : "Ne", +DlgCellHorAlign : "Vodoravno poravnanje", +DlgCellHorAlignNotSet : "", +DlgCellHorAlignLeft : "Lijevo", +DlgCellHorAlignCenter : "Središnje", +DlgCellHorAlignRight: "Desno", +DlgCellVerAlign : "Okomito poravnanje", +DlgCellVerAlignNotSet : "", +DlgCellVerAlignTop : "Gornje", +DlgCellVerAlignMiddle : "Srednišnje", +DlgCellVerAlignBottom : "Donje", +DlgCellVerAlignBaseline : "Bazno", +DlgCellRowSpan : "Spajanje redova", +DlgCellCollSpan : "Spajanje kolona", +DlgCellBackColor : "Boja pozadine", +DlgCellBorderColor : "Boja okvira", +DlgCellBtnSelect : "Odaberi...", + +// Find and Replace Dialog +DlgFindAndReplaceTitle : "Pronađi i zamijeni", + +// Find Dialog +DlgFindTitle : "Pronađi", +DlgFindFindBtn : "Pronađi", +DlgFindNotFoundMsg : "Traženi tekst nije pronađen.", + +// Replace Dialog +DlgReplaceTitle : "Zamijeni", +DlgReplaceFindLbl : "Pronađi:", +DlgReplaceReplaceLbl : "Zamijeni s:", +DlgReplaceCaseChk : "Usporedi mala/velika slova", +DlgReplaceReplaceBtn : "Zamijeni", +DlgReplaceReplAllBtn : "Zamijeni sve", +DlgReplaceWordChk : "Usporedi cijele riječi", + +// Paste Operations / Dialog +PasteErrorCut : "Sigurnosne postavke Vašeg pretraživača ne dozvoljavaju operacije automatskog izrezivanja. Molimo koristite kraticu na tipkovnici (Ctrl+X).", +PasteErrorCopy : "Sigurnosne postavke Vašeg pretraživača ne dozvoljavaju operacije automatskog kopiranja. Molimo koristite kraticu na tipkovnici (Ctrl+C).", + +PasteAsText : "Zalijepi kao čisti tekst", +PasteFromWord : "Zalijepi iz Worda", + +DlgPasteMsg2 : "Molimo zaljepite unutar doljnjeg okvira koristeći tipkovnicu (Ctrl+V) i kliknite OK.", +DlgPasteSec : "Zbog sigurnosnih postavki Vašeg pretraživača, editor nema direktan pristup Vašem međuspremniku. Potrebno je ponovno zalijepiti tekst u ovaj prozor.", +DlgPasteIgnoreFont : "Zanemari definiciju vrste fonta", +DlgPasteRemoveStyles : "Ukloni definicije stilova", +DlgPasteCleanBox : "Očisti okvir", + +// Color Picker +ColorAutomatic : "Automatski", +ColorMoreColors : "Više boja...", + +// Document Properties +DocProps : "Svojstva dokumenta", + +// Anchor Dialog +DlgAnchorTitle : "Svojstva sidra", +DlgAnchorName : "Ime sidra", +DlgAnchorErrorName : "Molimo unesite ime sidra", + +// Speller Pages Dialog +DlgSpellNotInDic : "Nije u rječniku", +DlgSpellChangeTo : "Promijeni u", +DlgSpellBtnIgnore : "Zanemari", +DlgSpellBtnIgnoreAll : "Zanemari sve", +DlgSpellBtnReplace : "Zamijeni", +DlgSpellBtnReplaceAll : "Zamijeni sve", +DlgSpellBtnUndo : "Vrati", +DlgSpellNoSuggestions : "-Nema preporuke-", +DlgSpellProgress : "Provjera u tijeku...", +DlgSpellNoMispell : "Provjera završena: Nema grešaka", +DlgSpellNoChanges : "Provjera završena: Nije napravljena promjena", +DlgSpellOneChange : "Provjera završena: Jedna riječ promjenjena", +DlgSpellManyChanges : "Provjera završena: Promijenjeno %1 riječi", + +IeSpellDownload : "Provjera pravopisa nije instalirana. Želite li skinuti provjeru pravopisa?", + +// Button Dialog +DlgButtonText : "Tekst (vrijednost)", +DlgButtonType : "Vrsta", +DlgButtonTypeBtn : "Gumb", +DlgButtonTypeSbm : "Pošalji", +DlgButtonTypeRst : "Poništi", + +// Checkbox and Radio Button Dialogs +DlgCheckboxName : "Ime", +DlgCheckboxValue : "Vrijednost", +DlgCheckboxSelected : "Odabrano", + +// Form Dialog +DlgFormName : "Ime", +DlgFormAction : "Akcija", +DlgFormMethod : "Metoda", + +// Select Field Dialog +DlgSelectName : "Ime", +DlgSelectValue : "Vrijednost", +DlgSelectSize : "Veličina", +DlgSelectLines : "linija", +DlgSelectChkMulti : "Dozvoli višestruki odabir", +DlgSelectOpAvail : "Dostupne opcije", +DlgSelectOpText : "Tekst", +DlgSelectOpValue : "Vrijednost", +DlgSelectBtnAdd : "Dodaj", +DlgSelectBtnModify : "Promijeni", +DlgSelectBtnUp : "Gore", +DlgSelectBtnDown : "Dolje", +DlgSelectBtnSetValue : "Postavi kao odabranu vrijednost", +DlgSelectBtnDelete : "Obriši", + +// Textarea Dialog +DlgTextareaName : "Ime", +DlgTextareaCols : "Kolona", +DlgTextareaRows : "Redova", + +// Text Field Dialog +DlgTextName : "Ime", +DlgTextValue : "Vrijednost", +DlgTextCharWidth : "Širina", +DlgTextMaxChars : "Najviše karaktera", +DlgTextType : "Vrsta", +DlgTextTypeText : "Tekst", +DlgTextTypePass : "Šifra", + +// Hidden Field Dialog +DlgHiddenName : "Ime", +DlgHiddenValue : "Vrijednost", + +// Bulleted List Dialog +BulletedListProp : "Svojstva liste", +NumberedListProp : "Svojstva brojčane liste", +DlgLstStart : "Početak", +DlgLstType : "Vrsta", +DlgLstTypeCircle : "Krug", +DlgLstTypeDisc : "Disk", +DlgLstTypeSquare : "Kvadrat", +DlgLstTypeNumbers : "Brojevi (1, 2, 3)", +DlgLstTypeLCase : "Mala slova (a, b, c)", +DlgLstTypeUCase : "Velika slova (A, B, C)", +DlgLstTypeSRoman : "Male rimske brojke (i, ii, iii)", +DlgLstTypeLRoman : "Velike rimske brojke (I, II, III)", + +// Document Properties Dialog +DlgDocGeneralTab : "Općenito", +DlgDocBackTab : "Pozadina", +DlgDocColorsTab : "Boje i margine", +DlgDocMetaTab : "Meta Data", + +DlgDocPageTitle : "Naslov stranice", +DlgDocLangDir : "Smjer jezika", +DlgDocLangDirLTR : "S lijeva na desno", +DlgDocLangDirRTL : "S desna na lijevo", +DlgDocLangCode : "Kôd jezika", +DlgDocCharSet : "Enkodiranje znakova", +DlgDocCharSetCE : "Središnja Europa", +DlgDocCharSetCT : "Tradicionalna kineska (Big5)", +DlgDocCharSetCR : "Ćirilica", +DlgDocCharSetGR : "Grčka", +DlgDocCharSetJP : "Japanska", +DlgDocCharSetKR : "Koreanska", +DlgDocCharSetTR : "Turska", +DlgDocCharSetUN : "Unicode (UTF-8)", +DlgDocCharSetWE : "Zapadna Europa", +DlgDocCharSetOther : "Ostalo enkodiranje znakova", + +DlgDocDocType : "Zaglavlje vrste dokumenta", +DlgDocDocTypeOther : "Ostalo zaglavlje vrste dokumenta", +DlgDocIncXHTML : "Ubaci XHTML deklaracije", +DlgDocBgColor : "Boja pozadine", +DlgDocBgImage : "URL slike pozadine", +DlgDocBgNoScroll : "Pozadine se ne pomiče", +DlgDocCText : "Tekst", +DlgDocCLink : "Link", +DlgDocCVisited : "Posjećeni link", +DlgDocCActive : "Aktivni link", +DlgDocMargins : "Margine stranice", +DlgDocMaTop : "Vrh", +DlgDocMaLeft : "Lijevo", +DlgDocMaRight : "Desno", +DlgDocMaBottom : "Dolje", +DlgDocMeIndex : "Ključne riječi dokumenta (odvojene zarezom)", +DlgDocMeDescr : "Opis dokumenta", +DlgDocMeAuthor : "Autor", +DlgDocMeCopy : "Autorska prava", +DlgDocPreview : "Pregledaj", + +// Templates Dialog +Templates : "Predlošci", +DlgTemplatesTitle : "Predlošci sadržaja", +DlgTemplatesSelMsg : "Molimo odaberite predložak koji želite otvoriti
    (stvarni sadržaj će biti izgubljen):", +DlgTemplatesLoading : "Učitavam listu predložaka. Molimo pričekajte...", +DlgTemplatesNoTpl : "(Nema definiranih predložaka)", +DlgTemplatesReplace : "Zamijeni trenutne sadržaje", + +// About Dialog +DlgAboutAboutTab : "O FCKEditoru", +DlgAboutBrowserInfoTab : "Podaci o pretraživaču", +DlgAboutLicenseTab : "Licenca", +DlgAboutVersion : "inačica", +DlgAboutInfo : "Za više informacija posjetite" +}; diff --git a/FCKeditor/editor/lang/hu.js b/FCKeditor/editor/lang/hu.js new file mode 100644 index 0000000..d7dcbd0 --- /dev/null +++ b/FCKeditor/editor/lang/hu.js @@ -0,0 +1,516 @@ +/* + * FCKeditor - The text editor for Internet - http://www.fckeditor.net + * Copyright (C) 2003-2007 Frederico Caldeira Knabben + * + * == BEGIN LICENSE == + * + * Licensed under the terms of any of the following licenses at your + * choice: + * + * - GNU General Public License Version 2 or later (the "GPL") + * http://www.gnu.org/licenses/gpl.html + * + * - GNU Lesser General Public License Version 2.1 or later (the "LGPL") + * http://www.gnu.org/licenses/lgpl.html + * + * - Mozilla Public License Version 1.1 or later (the "MPL") + * http://www.mozilla.org/MPL/MPL-1.1.html + * + * == END LICENSE == + * + * Hungarian language file. + */ + +var FCKLang = +{ +// Language direction : "ltr" (left to right) or "rtl" (right to left). +Dir : "ltr", + +ToolbarCollapse : "Eszköztár elrejtése", +ToolbarExpand : "Eszköztár megjelenítése", + +// Toolbar Items and Context Menu +Save : "Mentés", +NewPage : "Új oldal", +Preview : "Előnézet", +Cut : "Kivágás", +Copy : "Másolás", +Paste : "Beillesztés", +PasteText : "Beillesztés formázás nélkül", +PasteWord : "Beillesztés Word-ből", +Print : "Nyomtatás", +SelectAll : "Mindent kijelöl", +RemoveFormat : "Formázás eltávolítása", +InsertLinkLbl : "Hivatkozás", +InsertLink : "Hivatkozás beillesztése/módosítása", +RemoveLink : "Hivatkozás törlése", +Anchor : "Horgony beillesztése/szerkesztése", +AnchorDelete : "Horgony eltávolítása", +InsertImageLbl : "Kép", +InsertImage : "Kép beillesztése/módosítása", +InsertFlashLbl : "Flash", +InsertFlash : "Flash beillesztése, módosítása", +InsertTableLbl : "Táblázat", +InsertTable : "Táblázat beillesztése/módosítása", +InsertLineLbl : "Vonal", +InsertLine : "Elválasztóvonal beillesztése", +InsertSpecialCharLbl: "Speciális karakter", +InsertSpecialChar : "Speciális karakter beillesztése", +InsertSmileyLbl : "Hangulatjelek", +InsertSmiley : "Hangulatjelek beillesztése", +About : "FCKeditor névjegy", +Bold : "Félkövér", +Italic : "Dőlt", +Underline : "Aláhúzott", +StrikeThrough : "Áthúzott", +Subscript : "Alsó index", +Superscript : "Felső index", +LeftJustify : "Balra", +CenterJustify : "Középre", +RightJustify : "Jobbra", +BlockJustify : "Sorkizárt", +DecreaseIndent : "Behúzás csökkentése", +IncreaseIndent : "Behúzás növelése", +Blockquote : "Idézet blokk", +Undo : "Visszavonás", +Redo : "Ismétlés", +NumberedListLbl : "Számozás", +NumberedList : "Számozás beillesztése/törlése", +BulletedListLbl : "Felsorolás", +BulletedList : "Felsorolás beillesztése/törlése", +ShowTableBorders : "Táblázat szegély mutatása", +ShowDetails : "Részletek mutatása", +Style : "Stílus", +FontFormat : "Formátum", +Font : "Betűtípus", +FontSize : "Méret", +TextColor : "Betűszín", +BGColor : "Háttérszín", +Source : "Forráskód", +Find : "Keresés", +Replace : "Csere", +SpellCheck : "Helyesírás-ellenőrzés", +UniversalKeyboard : "Univerzális billentyűzet", +PageBreakLbl : "Oldaltörés", +PageBreak : "Oldaltörés beillesztése", + +Form : "Űrlap", +Checkbox : "Jelölőnégyzet", +RadioButton : "Választógomb", +TextField : "Szövegmező", +Textarea : "Szövegterület", +HiddenField : "Rejtettmező", +Button : "Gomb", +SelectionField : "Legördülő lista", +ImageButton : "Képgomb", + +FitWindow : "Maximalizálás", +ShowBlocks : "Blokkok megjelenítése", + +// Context Menu +EditLink : "Hivatkozás módosítása", +CellCM : "Cella", +RowCM : "Sor", +ColumnCM : "Oszlop", +InsertRowAfter : "Sor beillesztése az aktuális sor mögé", +InsertRowBefore : "Sor beillesztése az aktuális sor elé", +DeleteRows : "Sorok törlése", +InsertColumnAfter : "Oszlop beillesztése az aktuális oszlop mögé", +InsertColumnBefore : "Oszlop beillesztése az aktuális oszlop elé", +DeleteColumns : "Oszlopok törlése", +InsertCellAfter : "Cella beillesztése az aktuális cella mögé", +InsertCellBefore : "Cella beillesztése az aktuális cella elé", +DeleteCells : "Cellák törlése", +MergeCells : "Cellák egyesítése", +MergeRight : "Cellák egyesítése jobbra", +MergeDown : "Cellák egyesítése lefelé", +HorizontalSplitCell : "Cellák szétválasztása vízszintesen", +VerticalSplitCell : "Cellák szétválasztása függőlegesen", +TableDelete : "Táblázat törlése", +CellProperties : "Cella tulajdonságai", +TableProperties : "Táblázat tulajdonságai", +ImageProperties : "Kép tulajdonságai", +FlashProperties : "Flash tulajdonságai", + +AnchorProp : "Horgony tulajdonságai", +ButtonProp : "Gomb tulajdonságai", +CheckboxProp : "Jelölőnégyzet tulajdonságai", +HiddenFieldProp : "Rejtett mező tulajdonságai", +RadioButtonProp : "Választógomb tulajdonságai", +ImageButtonProp : "Képgomb tulajdonságai", +TextFieldProp : "Szövegmező tulajdonságai", +SelectionFieldProp : "Legördülő lista tulajdonságai", +TextareaProp : "Szövegterület tulajdonságai", +FormProp : "Űrlap tulajdonságai", + +FontFormats : "Normál;Formázott;Címsor;Fejléc 1;Fejléc 2;Fejléc 3;Fejléc 4;Fejléc 5;Fejléc 6;Bekezdés (DIV)", + +// Alerts and Messages +ProcessingXHTML : "XHTML feldolgozása. Kérem várjon...", +Done : "Kész", +PasteWordConfirm : "A beilleszteni kívánt szöveg Word-ből van másolva. El kívánja távolítani a formázást a beillesztés előtt?", +NotCompatiblePaste : "Ez a parancs csak Internet Explorer 5.5 verziótól használható. Megpróbálja beilleszteni a szöveget az eredeti formázással?", +UnknownToolbarItem : "Ismeretlen eszköztár elem \"%1\"", +UnknownCommand : "Ismeretlen parancs \"%1\"", +NotImplemented : "A parancs nem hajtható végre", +UnknownToolbarSet : "Az eszközkészlet \"%1\" nem létezik", +NoActiveX : "A böngésző biztonsági beállításai korlátozzák a szerkesztő lehetőségeit. Engedélyezni kell ezt az opciót: \"Run ActiveX controls and plug-ins\". Ettől függetlenül előfordulhatnak hibaüzenetek ill. bizonyos funkciók hiányozhatnak.", +BrowseServerBlocked : "Nem lehet megnyitni a fájlböngészőt. Bizonyosodjon meg róla, hogy a felbukkanó ablakok engedélyezve vannak.", +DialogBlocked : "Nem lehet megnyitni a párbeszédablakot. Bizonyosodjon meg róla, hogy a felbukkanó ablakok engedélyezve vannak.", + +// Dialogs +DlgBtnOK : "Rendben", +DlgBtnCancel : "Mégsem", +DlgBtnClose : "Bezárás", +DlgBtnBrowseServer : "Böngészés a szerveren", +DlgAdvancedTag : "További opciók", +DlgOpOther : "Egyéb", +DlgInfoTab : "Alaptulajdonságok", +DlgAlertUrl : "Illessze be a webcímet", + +// General Dialogs Labels +DlgGenNotSet : "", +DlgGenId : "Azonosító", +DlgGenLangDir : "Írás iránya", +DlgGenLangDirLtr : "Balról jobbra", +DlgGenLangDirRtl : "Jobbról balra", +DlgGenLangCode : "Nyelv kódja", +DlgGenAccessKey : "Billentyűkombináció", +DlgGenName : "Név", +DlgGenTabIndex : "Tabulátor index", +DlgGenLongDescr : "Részletes leírás webcíme", +DlgGenClass : "Stíluskészlet", +DlgGenTitle : "Súgócimke", +DlgGenContType : "Súgó tartalomtípusa", +DlgGenLinkCharset : "Hivatkozott tartalom kódlapja", +DlgGenStyle : "Stílus", + +// Image Dialog +DlgImgTitle : "Kép tulajdonságai", +DlgImgInfoTab : "Alaptulajdonságok", +DlgImgBtnUpload : "Küldés a szerverre", +DlgImgURL : "Hivatkozás", +DlgImgUpload : "Feltöltés", +DlgImgAlt : "Buborék szöveg", +DlgImgWidth : "Szélesség", +DlgImgHeight : "Magasság", +DlgImgLockRatio : "Arány megtartása", +DlgBtnResetSize : "Eredeti méret", +DlgImgBorder : "Keret", +DlgImgHSpace : "Vízsz. táv", +DlgImgVSpace : "Függ. táv", +DlgImgAlign : "Igazítás", +DlgImgAlignLeft : "Bal", +DlgImgAlignAbsBottom: "Legaljára", +DlgImgAlignAbsMiddle: "Közepére", +DlgImgAlignBaseline : "Alapvonalhoz", +DlgImgAlignBottom : "Aljára", +DlgImgAlignMiddle : "Középre", +DlgImgAlignRight : "Jobbra", +DlgImgAlignTextTop : "Szöveg tetejére", +DlgImgAlignTop : "Tetejére", +DlgImgPreview : "Előnézet", +DlgImgAlertUrl : "Töltse ki a kép webcímét", +DlgImgLinkTab : "Hivatkozás", + +// Flash Dialog +DlgFlashTitle : "Flash tulajdonságai", +DlgFlashChkPlay : "Automata lejátszás", +DlgFlashChkLoop : "Folyamatosan", +DlgFlashChkMenu : "Flash menü engedélyezése", +DlgFlashScale : "Méretezés", +DlgFlashScaleAll : "Mindent mutat", +DlgFlashScaleNoBorder : "Keret nélkül", +DlgFlashScaleFit : "Teljes kitöltés", + +// Link Dialog +DlgLnkWindowTitle : "Hivatkozás tulajdonságai", +DlgLnkInfoTab : "Alaptulajdonságok", +DlgLnkTargetTab : "Megjelenítés", + +DlgLnkType : "Hivatkozás típusa", +DlgLnkTypeURL : "Webcím", +DlgLnkTypeAnchor : "Horgony az oldalon", +DlgLnkTypeEMail : "E-Mail", +DlgLnkProto : "Protokoll", +DlgLnkProtoOther : "", +DlgLnkURL : "Webcím", +DlgLnkAnchorSel : "Horgony választása", +DlgLnkAnchorByName : "Horgony név szerint", +DlgLnkAnchorById : "Azonosító szerint", +DlgLnkNoAnchors : "(Nincs horgony a dokumentumban)", +DlgLnkEMail : "E-Mail cím", +DlgLnkEMailSubject : "Üzenet tárgya", +DlgLnkEMailBody : "Üzenet", +DlgLnkUpload : "Feltöltés", +DlgLnkBtnUpload : "Küldés a szerverre", + +DlgLnkTarget : "Tartalom megjelenítése", +DlgLnkTargetFrame : "", +DlgLnkTargetPopup : "", +DlgLnkTargetBlank : "Új ablakban (_blank)", +DlgLnkTargetParent : "Szülő ablakban (_parent)", +DlgLnkTargetSelf : "Azonos ablakban (_self)", +DlgLnkTargetTop : "Legfelső ablakban (_top)", +DlgLnkTargetFrameName : "Keret neve", +DlgLnkPopWinName : "Felugró ablak neve", +DlgLnkPopWinFeat : "Felugró ablak jellemzői", +DlgLnkPopResize : "Méretezhető", +DlgLnkPopLocation : "Címsor", +DlgLnkPopMenu : "Menü sor", +DlgLnkPopScroll : "Gördítősáv", +DlgLnkPopStatus : "Állapotsor", +DlgLnkPopToolbar : "Eszköztár", +DlgLnkPopFullScrn : "Teljes képernyő (csak IE)", +DlgLnkPopDependent : "Szülőhöz kapcsolt (csak Netscape)", +DlgLnkPopWidth : "Szélesség", +DlgLnkPopHeight : "Magasság", +DlgLnkPopLeft : "Bal pozíció", +DlgLnkPopTop : "Felső pozíció", + +DlnLnkMsgNoUrl : "Adja meg a hivatkozás webcímét", +DlnLnkMsgNoEMail : "Adja meg az E-Mail címet", +DlnLnkMsgNoAnchor : "Válasszon egy horgonyt", +DlnLnkMsgInvPopName : "A felbukkanó ablak neve alfanumerikus karakterrel kezdôdjön, valamint ne tartalmazzon szóközt", + +// Color Dialog +DlgColorTitle : "Színválasztás", +DlgColorBtnClear : "Törlés", +DlgColorHighlight : "Előnézet", +DlgColorSelected : "Kiválasztott", + +// Smiley Dialog +DlgSmileyTitle : "Hangulatjel beszúrása", + +// Special Character Dialog +DlgSpecialCharTitle : "Speciális karakter választása", + +// Table Dialog +DlgTableTitle : "Táblázat tulajdonságai", +DlgTableRows : "Sorok", +DlgTableColumns : "Oszlopok", +DlgTableBorder : "Szegélyméret", +DlgTableAlign : "Igazítás", +DlgTableAlignNotSet : "", +DlgTableAlignLeft : "Balra", +DlgTableAlignCenter : "Középre", +DlgTableAlignRight : "Jobbra", +DlgTableWidth : "Szélesség", +DlgTableWidthPx : "képpont", +DlgTableWidthPc : "százalék", +DlgTableHeight : "Magasság", +DlgTableCellSpace : "Cella térköz", +DlgTableCellPad : "Cella belső margó", +DlgTableCaption : "Felirat", +DlgTableSummary : "Leírás", + +// Table Cell Dialog +DlgCellTitle : "Cella tulajdonságai", +DlgCellWidth : "Szélesség", +DlgCellWidthPx : "képpont", +DlgCellWidthPc : "százalék", +DlgCellHeight : "Magasság", +DlgCellWordWrap : "Sortörés", +DlgCellWordWrapNotSet : "", +DlgCellWordWrapYes : "Igen", +DlgCellWordWrapNo : "Nem", +DlgCellHorAlign : "Vízsz. igazítás", +DlgCellHorAlignNotSet : "", +DlgCellHorAlignLeft : "Balra", +DlgCellHorAlignCenter : "Középre", +DlgCellHorAlignRight: "Jobbra", +DlgCellVerAlign : "Függ. igazítás", +DlgCellVerAlignNotSet : "", +DlgCellVerAlignTop : "Tetejére", +DlgCellVerAlignMiddle : "Középre", +DlgCellVerAlignBottom : "Aljára", +DlgCellVerAlignBaseline : "Egyvonalba", +DlgCellRowSpan : "Sorok egyesítése", +DlgCellCollSpan : "Oszlopok egyesítése", +DlgCellBackColor : "Háttérszín", +DlgCellBorderColor : "Szegélyszín", +DlgCellBtnSelect : "Kiválasztás...", + +// Find and Replace Dialog +DlgFindAndReplaceTitle : "Keresés és csere", + +// Find Dialog +DlgFindTitle : "Keresés", +DlgFindFindBtn : "Keresés", +DlgFindNotFoundMsg : "A keresett szöveg nem található.", + +// Replace Dialog +DlgReplaceTitle : "Csere", +DlgReplaceFindLbl : "Keresett szöveg:", +DlgReplaceReplaceLbl : "Csere erre:", +DlgReplaceCaseChk : "kis- és nagybetű megkülönböztetése", +DlgReplaceReplaceBtn : "Csere", +DlgReplaceReplAllBtn : "Az összes cseréje", +DlgReplaceWordChk : "csak ha ez a teljes szó", + +// Paste Operations / Dialog +PasteErrorCut : "A böngésző biztonsági beállításai nem engedélyezik a szerkesztőnek, hogy végrehajtsa a kivágás műveletet. Használja az alábbi billentyűkombinációt (Ctrl+X).", +PasteErrorCopy : "A böngésző biztonsági beállításai nem engedélyezik a szerkesztőnek, hogy végrehajtsa a másolás műveletet. Használja az alábbi billentyűkombinációt (Ctrl+X).", + +PasteAsText : "Beillesztés formázatlan szövegként", +PasteFromWord : "Beillesztés Word-ből", + +DlgPasteMsg2 : "Másolja be az alábbi mezőbe a Ctrl+V billentyűk lenyomásával, majd nyomjon Rendben-t.", +DlgPasteSec : "A böngésző biztonsági beállításai miatt a szerkesztő nem képes hozzáférni a vágólap adataihoz. Illeszd be újra ebben az ablakban.", +DlgPasteIgnoreFont : "Betű formázások megszüntetése", +DlgPasteRemoveStyles : "Stílusok eltávolítása", +DlgPasteCleanBox : "Törlés", + +// Color Picker +ColorAutomatic : "Automatikus", +ColorMoreColors : "További színek...", + +// Document Properties +DocProps : "Dokumentum tulajdonságai", + +// Anchor Dialog +DlgAnchorTitle : "Horgony tulajdonságai", +DlgAnchorName : "Horgony neve", +DlgAnchorErrorName : "Kérem adja meg a horgony nevét", + +// Speller Pages Dialog +DlgSpellNotInDic : "Nincs a szótárban", +DlgSpellChangeTo : "Módosítás", +DlgSpellBtnIgnore : "Kihagyja", +DlgSpellBtnIgnoreAll : "Mindet kihagyja", +DlgSpellBtnReplace : "Csere", +DlgSpellBtnReplaceAll : "Összes cseréje", +DlgSpellBtnUndo : "Visszavonás", +DlgSpellNoSuggestions : "Nincs javaslat", +DlgSpellProgress : "Helyesírás-ellenőrzés folyamatban...", +DlgSpellNoMispell : "Helyesírás-ellenőrzés kész: Nem találtam hibát", +DlgSpellNoChanges : "Helyesírás-ellenőrzés kész: Nincs változtatott szó", +DlgSpellOneChange : "Helyesírás-ellenőrzés kész: Egy szó cserélve", +DlgSpellManyChanges : "Helyesírás-ellenőrzés kész: %1 szó cserélve", + +IeSpellDownload : "A helyesírás-ellenőrző nincs telepítve. Szeretné letölteni most?", + +// Button Dialog +DlgButtonText : "Szöveg (Érték)", +DlgButtonType : "Típus", +DlgButtonTypeBtn : "Gomb", +DlgButtonTypeSbm : "Küldés", +DlgButtonTypeRst : "Alaphelyzet", + +// Checkbox and Radio Button Dialogs +DlgCheckboxName : "Név", +DlgCheckboxValue : "Érték", +DlgCheckboxSelected : "Kiválasztott", + +// Form Dialog +DlgFormName : "Név", +DlgFormAction : "Adatfeldolgozást végző hivatkozás", +DlgFormMethod : "Adatküldés módja", + +// Select Field Dialog +DlgSelectName : "Név", +DlgSelectValue : "Érték", +DlgSelectSize : "Méret", +DlgSelectLines : "sor", +DlgSelectChkMulti : "több sor is kiválasztható", +DlgSelectOpAvail : "Elérhető opciók", +DlgSelectOpText : "Szöveg", +DlgSelectOpValue : "Érték", +DlgSelectBtnAdd : "Hozzáad", +DlgSelectBtnModify : "Módosít", +DlgSelectBtnUp : "Fel", +DlgSelectBtnDown : "Le", +DlgSelectBtnSetValue : "Legyen az alapértelmezett érték", +DlgSelectBtnDelete : "Töröl", + +// Textarea Dialog +DlgTextareaName : "Név", +DlgTextareaCols : "Karakterek száma egy sorban", +DlgTextareaRows : "Sorok száma", + +// Text Field Dialog +DlgTextName : "Név", +DlgTextValue : "Érték", +DlgTextCharWidth : "Megjelenített karakterek száma", +DlgTextMaxChars : "Maximális karakterszám", +DlgTextType : "Típus", +DlgTextTypeText : "Szöveg", +DlgTextTypePass : "Jelszó", + +// Hidden Field Dialog +DlgHiddenName : "Név", +DlgHiddenValue : "Érték", + +// Bulleted List Dialog +BulletedListProp : "Felsorolás tulajdonságai", +NumberedListProp : "Számozás tulajdonságai", +DlgLstStart : "Start", +DlgLstType : "Formátum", +DlgLstTypeCircle : "Kör", +DlgLstTypeDisc : "Lemez", +DlgLstTypeSquare : "Négyzet", +DlgLstTypeNumbers : "Számok (1, 2, 3)", +DlgLstTypeLCase : "Kisbetűk (a, b, c)", +DlgLstTypeUCase : "Nagybetűk (A, B, C)", +DlgLstTypeSRoman : "Kis római számok (i, ii, iii)", +DlgLstTypeLRoman : "Nagy római számok (I, II, III)", + +// Document Properties Dialog +DlgDocGeneralTab : "Általános", +DlgDocBackTab : "Háttér", +DlgDocColorsTab : "Színek és margók", +DlgDocMetaTab : "Meta adatok", + +DlgDocPageTitle : "Oldalcím", +DlgDocLangDir : "Írás iránya", +DlgDocLangDirLTR : "Balról jobbra", +DlgDocLangDirRTL : "Jobbról balra", +DlgDocLangCode : "Nyelv kód", +DlgDocCharSet : "Karakterkódolás", +DlgDocCharSetCE : "Közép-Európai", +DlgDocCharSetCT : "Kínai Tradicionális (Big5)", +DlgDocCharSetCR : "Cyrill", +DlgDocCharSetGR : "Görög", +DlgDocCharSetJP : "Japán", +DlgDocCharSetKR : "Koreai", +DlgDocCharSetTR : "Török", +DlgDocCharSetUN : "Unicode (UTF-8)", +DlgDocCharSetWE : "Nyugat-Európai", +DlgDocCharSetOther : "Más karakterkódolás", + +DlgDocDocType : "Dokumentum típus fejléc", +DlgDocDocTypeOther : "Más dokumentum típus fejléc", +DlgDocIncXHTML : "XHTML deklarációk beillesztése", +DlgDocBgColor : "Háttérszín", +DlgDocBgImage : "Háttérkép cím", +DlgDocBgNoScroll : "Nem gördíthető háttér", +DlgDocCText : "Szöveg", +DlgDocCLink : "Cím", +DlgDocCVisited : "Látogatott cím", +DlgDocCActive : "Aktív cím", +DlgDocMargins : "Oldal margók", +DlgDocMaTop : "Felső", +DlgDocMaLeft : "Bal", +DlgDocMaRight : "Jobb", +DlgDocMaBottom : "Alsó", +DlgDocMeIndex : "Dokumentum keresőszavak (vesszővel elválasztva)", +DlgDocMeDescr : "Dokumentum leírás", +DlgDocMeAuthor : "Szerző", +DlgDocMeCopy : "Szerzői jog", +DlgDocPreview : "Előnézet", + +// Templates Dialog +Templates : "Sablonok", +DlgTemplatesTitle : "Elérhető sablonok", +DlgTemplatesSelMsg : "Válassza ki melyik sablon nyíljon meg a szerkesztőben
    (a jelenlegi tartalom elveszik):", +DlgTemplatesLoading : "Sablon lista betöltése. Kis türelmet...", +DlgTemplatesNoTpl : "(Nincs sablon megadva)", +DlgTemplatesReplace : "Kicseréli a jelenlegi tartalmat", + +// About Dialog +DlgAboutAboutTab : "Névjegy", +DlgAboutBrowserInfoTab : "Böngésző információ", +DlgAboutLicenseTab : "Licensz", +DlgAboutVersion : "verzió", +DlgAboutInfo : "További információkért látogasson el ide:" +}; diff --git a/FCKeditor/editor/lang/it.js b/FCKeditor/editor/lang/it.js new file mode 100644 index 0000000..3b78246 --- /dev/null +++ b/FCKeditor/editor/lang/it.js @@ -0,0 +1,516 @@ +/* + * FCKeditor - The text editor for Internet - http://www.fckeditor.net + * Copyright (C) 2003-2007 Frederico Caldeira Knabben + * + * == BEGIN LICENSE == + * + * Licensed under the terms of any of the following licenses at your + * choice: + * + * - GNU General Public License Version 2 or later (the "GPL") + * http://www.gnu.org/licenses/gpl.html + * + * - GNU Lesser General Public License Version 2.1 or later (the "LGPL") + * http://www.gnu.org/licenses/lgpl.html + * + * - Mozilla Public License Version 1.1 or later (the "MPL") + * http://www.mozilla.org/MPL/MPL-1.1.html + * + * == END LICENSE == + * + * Italian language file. + */ + +var FCKLang = +{ +// Language direction : "ltr" (left to right) or "rtl" (right to left). +Dir : "ltr", + +ToolbarCollapse : "Nascondi la barra degli strumenti", +ToolbarExpand : "Mostra la barra degli strumenti", + +// Toolbar Items and Context Menu +Save : "Salva", +NewPage : "Nuova pagina vuota", +Preview : "Anteprima", +Cut : "Taglia", +Copy : "Copia", +Paste : "Incolla", +PasteText : "Incolla come testo semplice", +PasteWord : "Incolla da Word", +Print : "Stampa", +SelectAll : "Seleziona tutto", +RemoveFormat : "Elimina formattazione", +InsertLinkLbl : "Collegamento", +InsertLink : "Inserisci/Modifica collegamento", +RemoveLink : "Elimina collegamento", +Anchor : "Inserisci/Modifica Ancora", +AnchorDelete : "Remove Anchor", //MISSING +InsertImageLbl : "Immagine", +InsertImage : "Inserisci/Modifica immagine", +InsertFlashLbl : "Oggetto Flash", +InsertFlash : "Inserisci/Modifica Oggetto Flash", +InsertTableLbl : "Tabella", +InsertTable : "Inserisci/Modifica tabella", +InsertLineLbl : "Riga orizzontale", +InsertLine : "Inserisci riga orizzontale", +InsertSpecialCharLbl: "Caratteri speciali", +InsertSpecialChar : "Inserisci carattere speciale", +InsertSmileyLbl : "Emoticon", +InsertSmiley : "Inserisci emoticon", +About : "Informazioni su FCKeditor", +Bold : "Grassetto", +Italic : "Corsivo", +Underline : "Sottolineato", +StrikeThrough : "Barrato", +Subscript : "Pedice", +Superscript : "Apice", +LeftJustify : "Allinea a sinistra", +CenterJustify : "Centra", +RightJustify : "Allinea a destra", +BlockJustify : "Giustifica", +DecreaseIndent : "Riduci rientro", +IncreaseIndent : "Aumenta rientro", +Blockquote : "Blockquote", //MISSING +Undo : "Annulla", +Redo : "Ripristina", +NumberedListLbl : "Elenco numerato", +NumberedList : "Inserisci/Modifica elenco numerato", +BulletedListLbl : "Elenco puntato", +BulletedList : "Inserisci/Modifica elenco puntato", +ShowTableBorders : "Mostra bordi tabelle", +ShowDetails : "Mostra dettagli", +Style : "Stile", +FontFormat : "Formato", +Font : "Font", +FontSize : "Dimensione", +TextColor : "Colore testo", +BGColor : "Colore sfondo", +Source : "Codice Sorgente", +Find : "Trova", +Replace : "Sostituisci", +SpellCheck : "Correttore ortografico", +UniversalKeyboard : "Tastiera universale", +PageBreakLbl : "Interruzione di pagina", +PageBreak : "Inserisci interruzione di pagina", + +Form : "Modulo", +Checkbox : "Checkbox", +RadioButton : "Radio Button", +TextField : "Campo di testo", +Textarea : "Area di testo", +HiddenField : "Campo nascosto", +Button : "Bottone", +SelectionField : "Menu di selezione", +ImageButton : "Bottone immagine", + +FitWindow : "Massimizza l'area dell'editor", +ShowBlocks : "Show Blocks", //MISSING + +// Context Menu +EditLink : "Modifica collegamento", +CellCM : "Cella", +RowCM : "Riga", +ColumnCM : "Colonna", +InsertRowAfter : "Insert Row After", //MISSING +InsertRowBefore : "Insert Row Before", //MISSING +DeleteRows : "Elimina righe", +InsertColumnAfter : "Insert Column After", //MISSING +InsertColumnBefore : "Insert Column Before", //MISSING +DeleteColumns : "Elimina colonne", +InsertCellAfter : "Insert Cell After", //MISSING +InsertCellBefore : "Insert Cell Before", //MISSING +DeleteCells : "Elimina celle", +MergeCells : "Unisce celle", +MergeRight : "Merge Right", //MISSING +MergeDown : "Merge Down", //MISSING +HorizontalSplitCell : "Split Cell Horizontally", //MISSING +VerticalSplitCell : "Split Cell Vertically", //MISSING +TableDelete : "Cancella Tabella", +CellProperties : "Proprietà cella", +TableProperties : "Proprietà tabella", +ImageProperties : "Proprietà immagine", +FlashProperties : "Proprietà Oggetto Flash", + +AnchorProp : "Proprietà ancora", +ButtonProp : "Proprietà bottone", +CheckboxProp : "Proprietà checkbox", +HiddenFieldProp : "Proprietà campo nascosto", +RadioButtonProp : "Proprietà radio button", +ImageButtonProp : "Proprietà bottone immagine", +TextFieldProp : "Proprietà campo di testo", +SelectionFieldProp : "Proprietà menu di selezione", +TextareaProp : "Proprietà area di testo", +FormProp : "Proprietà modulo", + +FontFormats : "Normale;Formattato;Indirizzo;Titolo 1;Titolo 2;Titolo 3;Titolo 4;Titolo 5;Titolo 6;Paragrafo (DIV)", + +// Alerts and Messages +ProcessingXHTML : "Elaborazione XHTML in corso. Attendere prego...", +Done : "Completato", +PasteWordConfirm : "Il testo da incollare sembra provenire da Word. Desideri pulirlo prima di incollare?", +NotCompatiblePaste : "Questa funzione è disponibile solo per Internet Explorer 5.5 o superiore. Desideri incollare il testo senza pulirlo?", +UnknownToolbarItem : "Elemento della barra strumenti sconosciuto \"%1\"", +UnknownCommand : "Comando sconosciuto \"%1\"", +NotImplemented : "Comando non implementato", +UnknownToolbarSet : "La barra di strumenti \"%1\" non esiste", +NoActiveX : "Le impostazioni di sicurezza del tuo browser potrebbero limitare alcune funzionalità dell'editor. Devi abilitare l'opzione \"Esegui controlli e plug-in ActiveX\". Potresti avere errori e notare funzionalità mancanti.", +BrowseServerBlocked : "Non è possibile aprire la finestra di espolorazione risorse. Verifica che tutti i blocca popup siano bloccati.", +DialogBlocked : "Non è possibile aprire la finestra di dialogo. Verifica che tutti i blocca popup siano bloccati.", + +// Dialogs +DlgBtnOK : "OK", +DlgBtnCancel : "Annulla", +DlgBtnClose : "Chiudi", +DlgBtnBrowseServer : "Cerca sul server", +DlgAdvancedTag : "Avanzate", +DlgOpOther : "", +DlgInfoTab : "Info", +DlgAlertUrl : "Devi inserire l'URL", + +// General Dialogs Labels +DlgGenNotSet : "", +DlgGenId : "Id", +DlgGenLangDir : "Direzione scrittura", +DlgGenLangDirLtr : "Da Sinistra a Destra (LTR)", +DlgGenLangDirRtl : "Da Destra a Sinistra (RTL)", +DlgGenLangCode : "Codice Lingua", +DlgGenAccessKey : "Scorciatoia
    da tastiera", +DlgGenName : "Nome", +DlgGenTabIndex : "Ordine di tabulazione", +DlgGenLongDescr : "URL descrizione estesa", +DlgGenClass : "Nome classe CSS", +DlgGenTitle : "Titolo", +DlgGenContType : "Tipo della risorsa collegata", +DlgGenLinkCharset : "Set di caretteri della risorsa collegata", +DlgGenStyle : "Stile", + +// Image Dialog +DlgImgTitle : "Proprietà immagine", +DlgImgInfoTab : "Informazioni immagine", +DlgImgBtnUpload : "Invia al server", +DlgImgURL : "URL", +DlgImgUpload : "Carica", +DlgImgAlt : "Testo alternativo", +DlgImgWidth : "Larghezza", +DlgImgHeight : "Altezza", +DlgImgLockRatio : "Blocca rapporto", +DlgBtnResetSize : "Reimposta dimensione", +DlgImgBorder : "Bordo", +DlgImgHSpace : "HSpace", +DlgImgVSpace : "VSpace", +DlgImgAlign : "Allineamento", +DlgImgAlignLeft : "Sinistra", +DlgImgAlignAbsBottom: "In basso assoluto", +DlgImgAlignAbsMiddle: "Centrato assoluto", +DlgImgAlignBaseline : "Linea base", +DlgImgAlignBottom : "In Basso", +DlgImgAlignMiddle : "Centrato", +DlgImgAlignRight : "Destra", +DlgImgAlignTextTop : "In alto al testo", +DlgImgAlignTop : "In Alto", +DlgImgPreview : "Anteprima", +DlgImgAlertUrl : "Devi inserire l'URL per l'immagine", +DlgImgLinkTab : "Collegamento", + +// Flash Dialog +DlgFlashTitle : "Proprietà Oggetto Flash", +DlgFlashChkPlay : "Avvio Automatico", +DlgFlashChkLoop : "Cicla", +DlgFlashChkMenu : "Abilita Menu di Flash", +DlgFlashScale : "Ridimensiona", +DlgFlashScaleAll : "Mostra Tutto", +DlgFlashScaleNoBorder : "Senza Bordo", +DlgFlashScaleFit : "Dimensione Esatta", + +// Link Dialog +DlgLnkWindowTitle : "Collegamento", +DlgLnkInfoTab : "Informazioni collegamento", +DlgLnkTargetTab : "Destinazione", + +DlgLnkType : "Tipo di Collegamento", +DlgLnkTypeURL : "URL", +DlgLnkTypeAnchor : "Ancora nella pagina", +DlgLnkTypeEMail : "E-Mail", +DlgLnkProto : "Protocollo", +DlgLnkProtoOther : "", +DlgLnkURL : "URL", +DlgLnkAnchorSel : "Scegli Ancora", +DlgLnkAnchorByName : "Per Nome", +DlgLnkAnchorById : "Per id elemento", +DlgLnkNoAnchors : "(Nessuna ancora disponibile nel documento)", +DlgLnkEMail : "Indirizzo E-Mail", +DlgLnkEMailSubject : "Oggetto del messaggio", +DlgLnkEMailBody : "Corpo del messaggio", +DlgLnkUpload : "Carica", +DlgLnkBtnUpload : "Invia al Server", + +DlgLnkTarget : "Destinazione", +DlgLnkTargetFrame : "", +DlgLnkTargetPopup : "", +DlgLnkTargetBlank : "Nuova finestra (_blank)", +DlgLnkTargetParent : "Finestra padre (_parent)", +DlgLnkTargetSelf : "Stessa finestra (_self)", +DlgLnkTargetTop : "Finestra superiore (_top)", +DlgLnkTargetFrameName : "Nome del riquadro di destinazione", +DlgLnkPopWinName : "Nome finestra popup", +DlgLnkPopWinFeat : "Caratteristiche finestra popup", +DlgLnkPopResize : "Ridimensionabile", +DlgLnkPopLocation : "Barra degli indirizzi", +DlgLnkPopMenu : "Barra del menu", +DlgLnkPopScroll : "Barre di scorrimento", +DlgLnkPopStatus : "Barra di stato", +DlgLnkPopToolbar : "Barra degli strumenti", +DlgLnkPopFullScrn : "A tutto schermo (IE)", +DlgLnkPopDependent : "Dipendente (Netscape)", +DlgLnkPopWidth : "Larghezza", +DlgLnkPopHeight : "Altezza", +DlgLnkPopLeft : "Posizione da sinistra", +DlgLnkPopTop : "Posizione dall'alto", + +DlnLnkMsgNoUrl : "Devi inserire l'URL del collegamento", +DlnLnkMsgNoEMail : "Devi inserire un'indirizzo e-mail", +DlnLnkMsgNoAnchor : "Devi selezionare un'ancora", +DlnLnkMsgInvPopName : "Il nome del popup deve iniziare con una lettera, e non può contenere spazi", + +// Color Dialog +DlgColorTitle : "Seleziona colore", +DlgColorBtnClear : "Vuota", +DlgColorHighlight : "Evidenziato", +DlgColorSelected : "Selezionato", + +// Smiley Dialog +DlgSmileyTitle : "Inserisci emoticon", + +// Special Character Dialog +DlgSpecialCharTitle : "Seleziona carattere speciale", + +// Table Dialog +DlgTableTitle : "Proprietà tabella", +DlgTableRows : "Righe", +DlgTableColumns : "Colonne", +DlgTableBorder : "Dimensione bordo", +DlgTableAlign : "Allineamento", +DlgTableAlignNotSet : "", +DlgTableAlignLeft : "Sinistra", +DlgTableAlignCenter : "Centrato", +DlgTableAlignRight : "Destra", +DlgTableWidth : "Larghezza", +DlgTableWidthPx : "pixel", +DlgTableWidthPc : "percento", +DlgTableHeight : "Altezza", +DlgTableCellSpace : "Spaziatura celle", +DlgTableCellPad : "Padding celle", +DlgTableCaption : "Intestazione", +DlgTableSummary : "Indice", + +// Table Cell Dialog +DlgCellTitle : "Proprietà cella", +DlgCellWidth : "Larghezza", +DlgCellWidthPx : "pixel", +DlgCellWidthPc : "percento", +DlgCellHeight : "Altezza", +DlgCellWordWrap : "A capo automatico", +DlgCellWordWrapNotSet : "", +DlgCellWordWrapYes : "Si", +DlgCellWordWrapNo : "No", +DlgCellHorAlign : "Allineamento orizzontale", +DlgCellHorAlignNotSet : "", +DlgCellHorAlignLeft : "Sinistra", +DlgCellHorAlignCenter : "Centrato", +DlgCellHorAlignRight: "Destra", +DlgCellVerAlign : "Allineamento verticale", +DlgCellVerAlignNotSet : "", +DlgCellVerAlignTop : "In Alto", +DlgCellVerAlignMiddle : "Centrato", +DlgCellVerAlignBottom : "In Basso", +DlgCellVerAlignBaseline : "Linea base", +DlgCellRowSpan : "Righe occupate", +DlgCellCollSpan : "Colonne occupate", +DlgCellBackColor : "Colore sfondo", +DlgCellBorderColor : "Colore bordo", +DlgCellBtnSelect : "Scegli...", + +// Find and Replace Dialog +DlgFindAndReplaceTitle : "Find and Replace", //MISSING + +// Find Dialog +DlgFindTitle : "Trova", +DlgFindFindBtn : "Trova", +DlgFindNotFoundMsg : "L'elemento cercato non è stato trovato.", + +// Replace Dialog +DlgReplaceTitle : "Sostituisci", +DlgReplaceFindLbl : "Trova:", +DlgReplaceReplaceLbl : "Sostituisci con:", +DlgReplaceCaseChk : "Maiuscole/minuscole", +DlgReplaceReplaceBtn : "Sostituisci", +DlgReplaceReplAllBtn : "Sostituisci tutto", +DlgReplaceWordChk : "Solo parole intere", + +// Paste Operations / Dialog +PasteErrorCut : "Le impostazioni di sicurezza del browser non permettono di tagliare automaticamente il testo. Usa la tastiera (Ctrl+X).", +PasteErrorCopy : "Le impostazioni di sicurezza del browser non permettono di copiare automaticamente il testo. Usa la tastiera (Ctrl+C).", + +PasteAsText : "Incolla come testo semplice", +PasteFromWord : "Incolla da Word", + +DlgPasteMsg2 : "Incolla il testo all'interno dell'area sottostante usando la scorciatoia di tastiere (Ctrl+V) e premi OK.", +DlgPasteSec : "Because of your browser security settings, the editor is not able to access your clipboard data directly. You are required to paste it again in this window.", //MISSING +DlgPasteIgnoreFont : "Ignora le definizioni di Font", +DlgPasteRemoveStyles : "Rimuovi le definizioni di Stile", +DlgPasteCleanBox : "Svuota area di testo", + +// Color Picker +ColorAutomatic : "Automatico", +ColorMoreColors : "Altri colori...", + +// Document Properties +DocProps : "Proprietà del Documento", + +// Anchor Dialog +DlgAnchorTitle : "Proprietà ancora", +DlgAnchorName : "Nome ancora", +DlgAnchorErrorName : "Inserici il nome dell'ancora", + +// Speller Pages Dialog +DlgSpellNotInDic : "Non nel dizionario", +DlgSpellChangeTo : "Cambia in", +DlgSpellBtnIgnore : "Ignora", +DlgSpellBtnIgnoreAll : "Ignora tutto", +DlgSpellBtnReplace : "Cambia", +DlgSpellBtnReplaceAll : "Cambia tutto", +DlgSpellBtnUndo : "Annulla", +DlgSpellNoSuggestions : "- Nessun suggerimento -", +DlgSpellProgress : "Controllo ortografico in corso", +DlgSpellNoMispell : "Controllo ortografico completato: nessun errore trovato", +DlgSpellNoChanges : "Controllo ortografico completato: nessuna parola cambiata", +DlgSpellOneChange : "Controllo ortografico completato: 1 parola cambiata", +DlgSpellManyChanges : "Controllo ortografico completato: %1 parole cambiate", + +IeSpellDownload : "Contollo ortografico non installato. Lo vuoi scaricare ora?", + +// Button Dialog +DlgButtonText : "Testo (Value)", +DlgButtonType : "Tipo", +DlgButtonTypeBtn : "Bottone", +DlgButtonTypeSbm : "Invio", +DlgButtonTypeRst : "Annulla", + +// Checkbox and Radio Button Dialogs +DlgCheckboxName : "Nome", +DlgCheckboxValue : "Valore", +DlgCheckboxSelected : "Selezionato", + +// Form Dialog +DlgFormName : "Nome", +DlgFormAction : "Azione", +DlgFormMethod : "Metodo", + +// Select Field Dialog +DlgSelectName : "Nome", +DlgSelectValue : "Valore", +DlgSelectSize : "Dimensione", +DlgSelectLines : "righe", +DlgSelectChkMulti : "Permetti selezione multipla", +DlgSelectOpAvail : "Opzioni disponibili", +DlgSelectOpText : "Testo", +DlgSelectOpValue : "Valore", +DlgSelectBtnAdd : "Aggiungi", +DlgSelectBtnModify : "Modifica", +DlgSelectBtnUp : "Su", +DlgSelectBtnDown : "Gi", +DlgSelectBtnSetValue : "Imposta come predefinito", +DlgSelectBtnDelete : "Rimuovi", + +// Textarea Dialog +DlgTextareaName : "Nome", +DlgTextareaCols : "Colonne", +DlgTextareaRows : "Righe", + +// Text Field Dialog +DlgTextName : "Nome", +DlgTextValue : "Valore", +DlgTextCharWidth : "Larghezza", +DlgTextMaxChars : "Numero massimo di caratteri", +DlgTextType : "Tipo", +DlgTextTypeText : "Testo", +DlgTextTypePass : "Password", + +// Hidden Field Dialog +DlgHiddenName : "Nome", +DlgHiddenValue : "Valore", + +// Bulleted List Dialog +BulletedListProp : "Proprietà lista puntata", +NumberedListProp : "Proprietà lista numerata", +DlgLstStart : "Inizio", +DlgLstType : "Tipo", +DlgLstTypeCircle : "Tondo", +DlgLstTypeDisc : "Disco", +DlgLstTypeSquare : "Quadrato", +DlgLstTypeNumbers : "Numeri (1, 2, 3)", +DlgLstTypeLCase : "Caratteri minuscoli (a, b, c)", +DlgLstTypeUCase : "Caratteri maiuscoli (A, B, C)", +DlgLstTypeSRoman : "Numeri Romani minuscoli (i, ii, iii)", +DlgLstTypeLRoman : "Numeri Romani maiuscoli (I, II, III)", + +// Document Properties Dialog +DlgDocGeneralTab : "Genarale", +DlgDocBackTab : "Sfondo", +DlgDocColorsTab : "Colori e margini", +DlgDocMetaTab : "Meta Data", + +DlgDocPageTitle : "Titolo pagina", +DlgDocLangDir : "Direzione scrittura", +DlgDocLangDirLTR : "Da Sinistra a Destra (LTR)", +DlgDocLangDirRTL : "Da Destra a Sinistra (RTL)", +DlgDocLangCode : "Codice Lingua", +DlgDocCharSet : "Set di caretteri", +DlgDocCharSetCE : "Europa Centrale", +DlgDocCharSetCT : "Cinese Tradizionale (Big5)", +DlgDocCharSetCR : "Cirillico", +DlgDocCharSetGR : "Greco", +DlgDocCharSetJP : "Giapponese", +DlgDocCharSetKR : "Coreano", +DlgDocCharSetTR : "Turco", +DlgDocCharSetUN : "Unicode (UTF-8)", +DlgDocCharSetWE : "Europa Occidentale", +DlgDocCharSetOther : "Altro set di caretteri", + +DlgDocDocType : "Intestazione DocType", +DlgDocDocTypeOther : "Altra intestazione DocType", +DlgDocIncXHTML : "Includi dichiarazione XHTML", +DlgDocBgColor : "Colore di sfondo", +DlgDocBgImage : "Immagine di sfondo", +DlgDocBgNoScroll : "Sfondo fissato", +DlgDocCText : "Testo", +DlgDocCLink : "Collegamento", +DlgDocCVisited : "Collegamento visitato", +DlgDocCActive : "Collegamento attivo", +DlgDocMargins : "Margini", +DlgDocMaTop : "In Alto", +DlgDocMaLeft : "A Sinistra", +DlgDocMaRight : "A Destra", +DlgDocMaBottom : "In Basso", +DlgDocMeIndex : "Chiavi di indicizzazione documento (separate da virgola)", +DlgDocMeDescr : "Descrizione documento", +DlgDocMeAuthor : "Autore", +DlgDocMeCopy : "Copyright", +DlgDocPreview : "Anteprima", + +// Templates Dialog +Templates : "Modelli", +DlgTemplatesTitle : "Contenuto dei modelli", +DlgTemplatesSelMsg : "Seleziona il modello da aprire nell'editor
    (il contenuto attuale verrà eliminato):", +DlgTemplatesLoading : "Caricamento modelli in corso. Attendere prego...", +DlgTemplatesNoTpl : "(Nessun modello definito)", +DlgTemplatesReplace : "Cancella il contenuto corrente", + +// About Dialog +DlgAboutAboutTab : "Informazioni", +DlgAboutBrowserInfoTab : "Informazioni Browser", +DlgAboutLicenseTab : "Licenza", +DlgAboutVersion : "versione", +DlgAboutInfo : "Per maggiori informazioni visitare" +}; diff --git a/FCKeditor/editor/lang/ja.js b/FCKeditor/editor/lang/ja.js new file mode 100644 index 0000000..bdf201b --- /dev/null +++ b/FCKeditor/editor/lang/ja.js @@ -0,0 +1,516 @@ +/* + * FCKeditor - The text editor for Internet - http://www.fckeditor.net + * Copyright (C) 2003-2007 Frederico Caldeira Knabben + * + * == BEGIN LICENSE == + * + * Licensed under the terms of any of the following licenses at your + * choice: + * + * - GNU General Public License Version 2 or later (the "GPL") + * http://www.gnu.org/licenses/gpl.html + * + * - GNU Lesser General Public License Version 2.1 or later (the "LGPL") + * http://www.gnu.org/licenses/lgpl.html + * + * - Mozilla Public License Version 1.1 or later (the "MPL") + * http://www.mozilla.org/MPL/MPL-1.1.html + * + * == END LICENSE == + * + * Japanese language file. + */ + +var FCKLang = +{ +// Language direction : "ltr" (left to right) or "rtl" (right to left). +Dir : "ltr", + +ToolbarCollapse : "ツールバーを隠す", +ToolbarExpand : "ツールバーを表示", + +// Toolbar Items and Context Menu +Save : "保存", +NewPage : "新しいページ", +Preview : "プレビュー", +Cut : "切り取り", +Copy : "コピー", +Paste : "貼り付け", +PasteText : "プレーンテキスト貼り付け", +PasteWord : "ワード文章から貼り付け", +Print : "印刷", +SelectAll : "すべて選択", +RemoveFormat : "フォーマット削除", +InsertLinkLbl : "リンク", +InsertLink : "リンク挿入/編集", +RemoveLink : "リンク削除", +Anchor : "アンカー挿入/編集", +AnchorDelete : "アンカー削除", +InsertImageLbl : "イメージ", +InsertImage : "イメージ挿入/編集", +InsertFlashLbl : "Flash", +InsertFlash : "Flash挿入/編集", +InsertTableLbl : "テーブル", +InsertTable : "テーブル挿入/編集", +InsertLineLbl : "ライン", +InsertLine : "横罫線", +InsertSpecialCharLbl: "特殊文字", +InsertSpecialChar : "特殊文字挿入", +InsertSmileyLbl : "絵文字", +InsertSmiley : "絵文字挿入", +About : "FCKeditorヘルプ", +Bold : "太字", +Italic : "斜体", +Underline : "下線", +StrikeThrough : "打ち消し線", +Subscript : "添え字", +Superscript : "上付き文字", +LeftJustify : "左揃え", +CenterJustify : "中央揃え", +RightJustify : "右揃え", +BlockJustify : "両端揃え", +DecreaseIndent : "インデント解除", +IncreaseIndent : "インデント", +Blockquote : "ブロック引用", +Undo : "元に戻す", +Redo : "やり直し", +NumberedListLbl : "段落番号", +NumberedList : "段落番号の追加/削除", +BulletedListLbl : "箇条書き", +BulletedList : "箇条書きの追加/削除", +ShowTableBorders : "テーブルボーダー表示", +ShowDetails : "詳細表示", +Style : "スタイル", +FontFormat : "フォーマット", +Font : "フォント", +FontSize : "サイズ", +TextColor : "テキスト色", +BGColor : "背景色", +Source : "ソース", +Find : "検索", +Replace : "置き換え", +SpellCheck : "スペルチェック", +UniversalKeyboard : "ユニバーサル・キーボード", +PageBreakLbl : "改ページ", +PageBreak : "改ページ挿入", + +Form : "フォーム", +Checkbox : "チェックボックス", +RadioButton : "ラジオボタン", +TextField : "1行テキスト", +Textarea : "テキストエリア", +HiddenField : "不可視フィールド", +Button : "ボタン", +SelectionField : "選択フィールド", +ImageButton : "画像ボタン", + +FitWindow : "エディタサイズを最大にします", +ShowBlocks : "ブロック表示", + +// Context Menu +EditLink : "リンク編集", +CellCM : "セル", +RowCM : "行", +ColumnCM : "カラム", +InsertRowAfter : "列の後に挿入", +InsertRowBefore : "列の前に挿入", +DeleteRows : "行削除", +InsertColumnAfter : "カラムの後に挿入", +InsertColumnBefore : "カラムの前に挿入", +DeleteColumns : "列削除", +InsertCellAfter : "セルの後に挿入", +InsertCellBefore : "セルの前に挿入", +DeleteCells : "セル削除", +MergeCells : "セル結合", +MergeRight : "右に結合", +MergeDown : "下に結合", +HorizontalSplitCell : "セルを水平方向分割", +VerticalSplitCell : "セルを垂直方向に分割", +TableDelete : "テーブル削除", +CellProperties : "セル プロパティ", +TableProperties : "テーブル プロパティ", +ImageProperties : "イメージ プロパティ", +FlashProperties : "Flash プロパティ", + +AnchorProp : "アンカー プロパティ", +ButtonProp : "ボタン プロパティ", +CheckboxProp : "チェックボックス プロパティ", +HiddenFieldProp : "不可視フィールド プロパティ", +RadioButtonProp : "ラジオボタン プロパティ", +ImageButtonProp : "画像ボタン プロパティ", +TextFieldProp : "1行テキスト プロパティ", +SelectionFieldProp : "選択フィールド プロパティ", +TextareaProp : "テキストエリア プロパティ", +FormProp : "フォーム プロパティ", + +FontFormats : "標準;書式付き;アドレス;見出し 1;見出し 2;見出し 3;見出し 4;見出し 5;見出し 6;標準 (DIV)", + +// Alerts and Messages +ProcessingXHTML : "XHTML処理中. しばらくお待ちください...", +Done : "完了", +PasteWordConfirm : "貼り付けを行うテキストは、ワード文章からコピーされようとしています。貼り付ける前にクリーニングを行いますか?", +NotCompatiblePaste : "このコマンドはインターネット・エクスプローラーバージョン5.5以上で利用可能です。クリーニングしないで貼り付けを行いますか?", +UnknownToolbarItem : "未知のツールバー項目 \"%1\"", +UnknownCommand : "未知のコマンド名 \"%1\"", +NotImplemented : "コマンドはインプリメントされませんでした。", +UnknownToolbarSet : "ツールバー設定 \"%1\" 存在しません。", +NoActiveX : "エラー、警告メッセージなどが発生した場合、ブラウザーのセキュリティ設定によりエディタのいくつかの機能が制限されている可能性があります。セキュリティ設定のオプションで\"ActiveXコントロールとプラグインの実行\"を有効にするにしてください。", +BrowseServerBlocked : "サーバーブラウザーを開くことができませんでした。ポップアップ・ブロック機能が無効になっているか確認してください。", +DialogBlocked : "ダイアログウィンドウを開くことができませんでした。ポップアップ・ブロック機能が無効になっているか確認してください。", + +// Dialogs +DlgBtnOK : "OK", +DlgBtnCancel : "キャンセル", +DlgBtnClose : "閉じる", +DlgBtnBrowseServer : "サーバーブラウザー", +DlgAdvancedTag : "高度な設定", +DlgOpOther : "<その他>", +DlgInfoTab : "情報", +DlgAlertUrl : "URLを挿入してください", + +// General Dialogs Labels +DlgGenNotSet : "<なし>", +DlgGenId : "Id", +DlgGenLangDir : "文字表記の方向", +DlgGenLangDirLtr : "左から右 (LTR)", +DlgGenLangDirRtl : "右から左 (RTL)", +DlgGenLangCode : "言語コード", +DlgGenAccessKey : "アクセスキー", +DlgGenName : "Name属性", +DlgGenTabIndex : "タブインデックス", +DlgGenLongDescr : "longdesc属性(長文説明)", +DlgGenClass : "スタイルシートクラス", +DlgGenTitle : "Title属性", +DlgGenContType : "Content Type属性", +DlgGenLinkCharset : "リンクcharset属性", +DlgGenStyle : "スタイルシート", + +// Image Dialog +DlgImgTitle : "イメージ プロパティ", +DlgImgInfoTab : "イメージ 情報", +DlgImgBtnUpload : "サーバーに送信", +DlgImgURL : "URL", +DlgImgUpload : "アップロード", +DlgImgAlt : "代替テキスト", +DlgImgWidth : "幅", +DlgImgHeight : "高さ", +DlgImgLockRatio : "ロック比率", +DlgBtnResetSize : "サイズリセット", +DlgImgBorder : "ボーダー", +DlgImgHSpace : "横間隔", +DlgImgVSpace : "縦間隔", +DlgImgAlign : "行揃え", +DlgImgAlignLeft : "左", +DlgImgAlignAbsBottom: "下部(絶対的)", +DlgImgAlignAbsMiddle: "中央(絶対的)", +DlgImgAlignBaseline : "ベースライン", +DlgImgAlignBottom : "下", +DlgImgAlignMiddle : "中央", +DlgImgAlignRight : "右", +DlgImgAlignTextTop : "テキスト上部", +DlgImgAlignTop : "上", +DlgImgPreview : "プレビュー", +DlgImgAlertUrl : "イメージのURLを入力してください。", +DlgImgLinkTab : "リンク", + +// Flash Dialog +DlgFlashTitle : "Flash プロパティ", +DlgFlashChkPlay : "再生", +DlgFlashChkLoop : "ループ再生", +DlgFlashChkMenu : "Flashメニュー可能", +DlgFlashScale : "拡大縮小設定", +DlgFlashScaleAll : "すべて表示", +DlgFlashScaleNoBorder : "外が見えない様に拡大", +DlgFlashScaleFit : "上下左右にフィット", + +// Link Dialog +DlgLnkWindowTitle : "ハイパーリンク", +DlgLnkInfoTab : "ハイパーリンク 情報", +DlgLnkTargetTab : "ターゲット", + +DlgLnkType : "リンクタイプ", +DlgLnkTypeURL : "URL", +DlgLnkTypeAnchor : "このページのアンカー", +DlgLnkTypeEMail : "E-Mail", +DlgLnkProto : "プロトコル", +DlgLnkProtoOther : "<その他>", +DlgLnkURL : "URL", +DlgLnkAnchorSel : "アンカーを選択", +DlgLnkAnchorByName : "アンカー名", +DlgLnkAnchorById : "エレメントID", +DlgLnkNoAnchors : "(ドキュメントにおいて利用可能なアンカーはありません。)", +DlgLnkEMail : "E-Mail アドレス", +DlgLnkEMailSubject : "件名", +DlgLnkEMailBody : "本文", +DlgLnkUpload : "アップロード", +DlgLnkBtnUpload : "サーバーに送信", + +DlgLnkTarget : "ターゲット", +DlgLnkTargetFrame : "<フレーム>", +DlgLnkTargetPopup : "<ポップアップウィンドウ>", +DlgLnkTargetBlank : "新しいウィンドウ (_blank)", +DlgLnkTargetParent : "親ウィンドウ (_parent)", +DlgLnkTargetSelf : "同じウィンドウ (_self)", +DlgLnkTargetTop : "最上位ウィンドウ (_top)", +DlgLnkTargetFrameName : "目的のフレーム名", +DlgLnkPopWinName : "ポップアップウィンドウ名", +DlgLnkPopWinFeat : "ポップアップウィンドウ特徴", +DlgLnkPopResize : "リサイズ可能", +DlgLnkPopLocation : "ロケーションバー", +DlgLnkPopMenu : "メニューバー", +DlgLnkPopScroll : "スクロールバー", +DlgLnkPopStatus : "ステータスバー", +DlgLnkPopToolbar : "ツールバー", +DlgLnkPopFullScrn : "全画面モード(IE)", +DlgLnkPopDependent : "開いたウィンドウに連動して閉じる (Netscape)", +DlgLnkPopWidth : "幅", +DlgLnkPopHeight : "高さ", +DlgLnkPopLeft : "左端からの座標で指定", +DlgLnkPopTop : "上端からの座標で指定", + +DlnLnkMsgNoUrl : "リンクURLを入力してください。", +DlnLnkMsgNoEMail : "メールアドレスを入力してください。", +DlnLnkMsgNoAnchor : "アンカーを選択してください。", +DlnLnkMsgInvPopName : "ポップ・アップ名は英字で始まる文字で指定してくだい。ポップ・アップ名にスペースは含めません", + +// Color Dialog +DlgColorTitle : "色選択", +DlgColorBtnClear : "クリア", +DlgColorHighlight : "ハイライト", +DlgColorSelected : "選択色", + +// Smiley Dialog +DlgSmileyTitle : "顔文字挿入", + +// Special Character Dialog +DlgSpecialCharTitle : "特殊文字選択", + +// Table Dialog +DlgTableTitle : "テーブル プロパティ", +DlgTableRows : "行", +DlgTableColumns : "列", +DlgTableBorder : "ボーダーサイズ", +DlgTableAlign : "キャプションの整列", +DlgTableAlignNotSet : "<なし>", +DlgTableAlignLeft : "左", +DlgTableAlignCenter : "中央", +DlgTableAlignRight : "右", +DlgTableWidth : "テーブル幅", +DlgTableWidthPx : "ピクセル", +DlgTableWidthPc : "パーセント", +DlgTableHeight : "テーブル高さ", +DlgTableCellSpace : "セル内余白", +DlgTableCellPad : "セル内間隔", +DlgTableCaption : "キャプション", +DlgTableSummary : "テーブル目的/構造", + +// Table Cell Dialog +DlgCellTitle : "セル プロパティ", +DlgCellWidth : "幅", +DlgCellWidthPx : "ピクセル", +DlgCellWidthPc : "パーセント", +DlgCellHeight : "高さ", +DlgCellWordWrap : "折り返し", +DlgCellWordWrapNotSet : "<なし>", +DlgCellWordWrapYes : "Yes", +DlgCellWordWrapNo : "No", +DlgCellHorAlign : "セル横の整列", +DlgCellHorAlignNotSet : "<なし>", +DlgCellHorAlignLeft : "左", +DlgCellHorAlignCenter : "中央", +DlgCellHorAlignRight: "右", +DlgCellVerAlign : "セル縦の整列", +DlgCellVerAlignNotSet : "<なし>", +DlgCellVerAlignTop : "上", +DlgCellVerAlignMiddle : "中央", +DlgCellVerAlignBottom : "下", +DlgCellVerAlignBaseline : "ベースライン", +DlgCellRowSpan : "縦幅(行数)", +DlgCellCollSpan : "横幅(列数)", +DlgCellBackColor : "背景色", +DlgCellBorderColor : "ボーダーカラー", +DlgCellBtnSelect : "選択...", + +// Find and Replace Dialog +DlgFindAndReplaceTitle : "検索して置換", + +// Find Dialog +DlgFindTitle : "検索", +DlgFindFindBtn : "検索", +DlgFindNotFoundMsg : "指定された文字列は見つかりませんでした。", + +// Replace Dialog +DlgReplaceTitle : "置き換え", +DlgReplaceFindLbl : "検索する文字列:", +DlgReplaceReplaceLbl : "置換えする文字列:", +DlgReplaceCaseChk : "部分一致", +DlgReplaceReplaceBtn : "置換え", +DlgReplaceReplAllBtn : "すべて置換え", +DlgReplaceWordChk : "単語単位で一致", + +// Paste Operations / Dialog +PasteErrorCut : "ブラウザーのセキュリティ設定によりエディタの切り取り操作が自動で実行することができません。実行するには手動でキーボードの(Ctrl+X)を使用してください。", +PasteErrorCopy : "ブラウザーのセキュリティ設定によりエディタのコピー操作が自動で実行することができません。実行するには手動でキーボードの(Ctrl+C)を使用してください。", + +PasteAsText : "プレーンテキスト貼り付け", +PasteFromWord : "ワード文章から貼り付け", + +DlgPasteMsg2 : "キーボード(Ctrl+V)を使用して、次の入力エリア内で貼って、OKを押してください。", +DlgPasteSec : "ブラウザのセキュリティ設定により、エディタはクリップボード・データに直接アクセスすることができません。このウィンドウは貼り付け操作を行う度に表示されます。", +DlgPasteIgnoreFont : "FontタグのFace属性を無視します。", +DlgPasteRemoveStyles : "スタイル定義を削除します。", +DlgPasteCleanBox : "入力エリアクリア", + +// Color Picker +ColorAutomatic : "自動", +ColorMoreColors : "その他の色...", + +// Document Properties +DocProps : "文書 プロパティ", + +// Anchor Dialog +DlgAnchorTitle : "アンカー プロパティ", +DlgAnchorName : "アンカー名", +DlgAnchorErrorName : "アンカー名を必ず入力してください。", + +// Speller Pages Dialog +DlgSpellNotInDic : "辞書にありません", +DlgSpellChangeTo : "変更", +DlgSpellBtnIgnore : "無視", +DlgSpellBtnIgnoreAll : "すべて無視", +DlgSpellBtnReplace : "置換", +DlgSpellBtnReplaceAll : "すべて置換", +DlgSpellBtnUndo : "やり直し", +DlgSpellNoSuggestions : "- 該当なし -", +DlgSpellProgress : "スペルチェック処理中...", +DlgSpellNoMispell : "スペルチェック完了: スペルの誤りはありませんでした", +DlgSpellNoChanges : "スペルチェック完了: 語句は変更されませんでした", +DlgSpellOneChange : "スペルチェック完了: 1語句変更されました", +DlgSpellManyChanges : "スペルチェック完了: %1 語句変更されました", + +IeSpellDownload : "スペルチェッカーがインストールされていません。今すぐダウンロードしますか?", + +// Button Dialog +DlgButtonText : "テキスト (値)", +DlgButtonType : "タイプ", +DlgButtonTypeBtn : "ボタン", +DlgButtonTypeSbm : "送信", +DlgButtonTypeRst : "リセット", + +// Checkbox and Radio Button Dialogs +DlgCheckboxName : "名前", +DlgCheckboxValue : "値", +DlgCheckboxSelected : "選択済み", + +// Form Dialog +DlgFormName : "フォーム名", +DlgFormAction : "アクション", +DlgFormMethod : "メソッド", + +// Select Field Dialog +DlgSelectName : "名前", +DlgSelectValue : "値", +DlgSelectSize : "サイズ", +DlgSelectLines : "行", +DlgSelectChkMulti : "複数項目選択を許可", +DlgSelectOpAvail : "利用可能なオプション", +DlgSelectOpText : "選択項目名", +DlgSelectOpValue : "選択項目値", +DlgSelectBtnAdd : "追加", +DlgSelectBtnModify : "編集", +DlgSelectBtnUp : "上へ", +DlgSelectBtnDown : "下へ", +DlgSelectBtnSetValue : "選択した値を設定", +DlgSelectBtnDelete : "削除", + +// Textarea Dialog +DlgTextareaName : "名前", +DlgTextareaCols : "列", +DlgTextareaRows : "行", + +// Text Field Dialog +DlgTextName : "名前", +DlgTextValue : "値", +DlgTextCharWidth : "サイズ", +DlgTextMaxChars : "最大長", +DlgTextType : "タイプ", +DlgTextTypeText : "テキスト", +DlgTextTypePass : "パスワード入力", + +// Hidden Field Dialog +DlgHiddenName : "名前", +DlgHiddenValue : "値", + +// Bulleted List Dialog +BulletedListProp : "箇条書き プロパティ", +NumberedListProp : "段落番号 プロパティ", +DlgLstStart : "開始文字", +DlgLstType : "タイプ", +DlgLstTypeCircle : "白丸", +DlgLstTypeDisc : "黒丸", +DlgLstTypeSquare : "四角", +DlgLstTypeNumbers : "アラビア数字 (1, 2, 3)", +DlgLstTypeLCase : "英字小文字 (a, b, c)", +DlgLstTypeUCase : "英字大文字 (A, B, C)", +DlgLstTypeSRoman : "ローマ数字小文字 (i, ii, iii)", +DlgLstTypeLRoman : "ローマ数字大文字 (I, II, III)", + +// Document Properties Dialog +DlgDocGeneralTab : "全般", +DlgDocBackTab : "背景", +DlgDocColorsTab : "色とマージン", +DlgDocMetaTab : "メタデータ", + +DlgDocPageTitle : "ページタイトル", +DlgDocLangDir : "言語文字表記の方向", +DlgDocLangDirLTR : "左から右に表記(LTR)", +DlgDocLangDirRTL : "右から左に表記(RTL)", +DlgDocLangCode : "言語コード", +DlgDocCharSet : "文字セット符号化", +DlgDocCharSetCE : "Central European", +DlgDocCharSetCT : "Chinese Traditional (Big5)", +DlgDocCharSetCR : "Cyrillic", +DlgDocCharSetGR : "Greek", +DlgDocCharSetJP : "Japanese", +DlgDocCharSetKR : "Korean", +DlgDocCharSetTR : "Turkish", +DlgDocCharSetUN : "Unicode (UTF-8)", +DlgDocCharSetWE : "Western European", +DlgDocCharSetOther : "他の文字セット符号化", + +DlgDocDocType : "文書タイプヘッダー", +DlgDocDocTypeOther : "その他文書タイプヘッダー", +DlgDocIncXHTML : "XHTML宣言をインクルード", +DlgDocBgColor : "背景色", +DlgDocBgImage : "背景画像 URL", +DlgDocBgNoScroll : "スクロールしない背景", +DlgDocCText : "テキスト", +DlgDocCLink : "リンク", +DlgDocCVisited : "アクセス済みリンク", +DlgDocCActive : "アクセス中リンク", +DlgDocMargins : "ページ・マージン", +DlgDocMaTop : "上部", +DlgDocMaLeft : "左", +DlgDocMaRight : "右", +DlgDocMaBottom : "下部", +DlgDocMeIndex : "文書のキーワード(カンマ区切り)", +DlgDocMeDescr : "文書の概要", +DlgDocMeAuthor : "文書の作者", +DlgDocMeCopy : "文書の著作権", +DlgDocPreview : "プレビュー", + +// Templates Dialog +Templates : "テンプレート(雛形)", +DlgTemplatesTitle : "テンプレート内容", +DlgTemplatesSelMsg : "エディターで使用するテンプレートを選択してください。
    (現在のエディタの内容は失われます):", +DlgTemplatesLoading : "テンプレート一覧読み込み中. しばらくお待ちください...", +DlgTemplatesNoTpl : "(テンプレートが定義されていません)", +DlgTemplatesReplace : "現在のエディタの内容と置換えをします", + +// About Dialog +DlgAboutAboutTab : "バージョン情報", +DlgAboutBrowserInfoTab : "ブラウザ情報", +DlgAboutLicenseTab : "ライセンス", +DlgAboutVersion : "バージョン", +DlgAboutInfo : "より詳しい情報はこちらで" +}; diff --git a/FCKeditor/editor/lang/km.js b/FCKeditor/editor/lang/km.js new file mode 100644 index 0000000..34e6af1 --- /dev/null +++ b/FCKeditor/editor/lang/km.js @@ -0,0 +1,516 @@ +/* + * FCKeditor - The text editor for Internet - http://www.fckeditor.net + * Copyright (C) 2003-2007 Frederico Caldeira Knabben + * + * == BEGIN LICENSE == + * + * Licensed under the terms of any of the following licenses at your + * choice: + * + * - GNU General Public License Version 2 or later (the "GPL") + * http://www.gnu.org/licenses/gpl.html + * + * - GNU Lesser General Public License Version 2.1 or later (the "LGPL") + * http://www.gnu.org/licenses/lgpl.html + * + * - Mozilla Public License Version 1.1 or later (the "MPL") + * http://www.mozilla.org/MPL/MPL-1.1.html + * + * == END LICENSE == + * + * Khmer language file. + */ + +var FCKLang = +{ +// Language direction : "ltr" (left to right) or "rtl" (right to left). +Dir : "ltr", + +ToolbarCollapse : "បង្រួមរបាឧបរកណ៍", +ToolbarExpand : "ពង្រីករបាឧបរណ៍", + +// Toolbar Items and Context Menu +Save : "រក្សាទុក", +NewPage : "ទំព័រថ្មី", +Preview : "មើលសាកល្បង", +Cut : "កាត់យក", +Copy : "ចំលងយក", +Paste : "ចំលងដាក់", +PasteText : "ចំលងដាក់ជាអត្ថបទធម្មតា", +PasteWord : "ចំលងដាក់ពី Word", +Print : "បោះពុម្ភ", +SelectAll : "ជ្រើសរើសទាំងអស់", +RemoveFormat : "លប់ចោល ការរចនា", +InsertLinkLbl : "ឈ្នាប់", +InsertLink : "បន្ថែម/កែប្រែ ឈ្នាប់", +RemoveLink : "លប់ឈ្នាប់", +Anchor : "បន្ថែម/កែប្រែ យុថ្កា", +AnchorDelete : "Remove Anchor", //MISSING +InsertImageLbl : "រូបភាព", +InsertImage : "បន្ថែម/កែប្រែ រូបភាព", +InsertFlashLbl : "Flash", +InsertFlash : "បន្ថែម/កែប្រែ Flash", +InsertTableLbl : "តារាង", +InsertTable : "បន្ថែម/កែប្រែ តារាង", +InsertLineLbl : "បន្ទាត់", +InsertLine : "បន្ថែមបន្ទាត់ផ្តេក", +InsertSpecialCharLbl: "អក្សរពិសេស", +InsertSpecialChar : "បន្ថែមអក្សរពិសេស", +InsertSmileyLbl : "រូបភាព", +InsertSmiley : "បន្ថែម រូបភាព", +About : "អំពី FCKeditor", +Bold : "អក្សរដិតធំ", +Italic : "អក្សរផ្តេក", +Underline : "ដិតបន្ទាត់ពីក្រោមអក្សរ", +StrikeThrough : "ដិតបន្ទាត់ពាក់កណ្តាលអក្សរ", +Subscript : "អក្សរតូចក្រោម", +Superscript : "អក្សរតូចលើ", +LeftJustify : "តំរឹមឆ្វេង", +CenterJustify : "តំរឹមកណ្តាល", +RightJustify : "តំរឹមស្តាំ", +BlockJustify : "តំរឹមសងខាង", +DecreaseIndent : "បន្ថយការចូលបន្ទាត់", +IncreaseIndent : "បន្ថែមការចូលបន្ទាត់", +Blockquote : "Blockquote", //MISSING +Undo : "សារឡើងវិញ", +Redo : "ធ្វើឡើងវិញ", +NumberedListLbl : "បញ្ជីជាអក្សរ", +NumberedList : "បន្ថែម/លប់ បញ្ជីជាអក្សរ", +BulletedListLbl : "បញ្ជីជារង្វង់មូល", +BulletedList : "បន្ថែម/លប់ បញ្ជីជារង្វង់មូល", +ShowTableBorders : "បង្ហាញស៊ុមតារាង", +ShowDetails : "បង្ហាញពិស្តារ", +Style : "ម៉ូត", +FontFormat : "រចនា", +Font : "ហ្វុង", +FontSize : "ទំហំ", +TextColor : "ពណ៌អក្សរ", +BGColor : "ពណ៌ផ្ទៃខាងក្រោយ", +Source : "កូត", +Find : "ស្វែងរក", +Replace : "ជំនួស", +SpellCheck : "ពិនិត្យអក្ខរាវិរុទ្ធ", +UniversalKeyboard : "ក្តារពុម្ភអក្សរសកល", +PageBreakLbl : "ការផ្តាច់ទំព័រ", +PageBreak : "បន្ថែម ការផ្តាច់ទំព័រ", + +Form : "បែបបទ", +Checkbox : "ប្រអប់ជ្រើសរើស", +RadioButton : "ប៉ូតុនរង្វង់មូល", +TextField : "ជួរសរសេរអត្ថបទ", +Textarea : "តំបន់សរសេរអត្ថបទ", +HiddenField : "ជួរលាក់", +Button : "ប៉ូតុន", +SelectionField : "ជួរជ្រើសរើស", +ImageButton : "ប៉ូតុនរូបភាព", + +FitWindow : "Maximize the editor size", //MISSING +ShowBlocks : "Show Blocks", //MISSING + +// Context Menu +EditLink : "កែប្រែឈ្នាប់", +CellCM : "Cell", //MISSING +RowCM : "Row", //MISSING +ColumnCM : "Column", //MISSING +InsertRowAfter : "Insert Row After", //MISSING +InsertRowBefore : "Insert Row Before", //MISSING +DeleteRows : "លប់ជួរផ្តេក", +InsertColumnAfter : "Insert Column After", //MISSING +InsertColumnBefore : "Insert Column Before", //MISSING +DeleteColumns : "លប់ជួរឈរ", +InsertCellAfter : "Insert Cell After", //MISSING +InsertCellBefore : "Insert Cell Before", //MISSING +DeleteCells : "លប់សែល", +MergeCells : "បញ្ជូលសែល", +MergeRight : "Merge Right", //MISSING +MergeDown : "Merge Down", //MISSING +HorizontalSplitCell : "Split Cell Horizontally", //MISSING +VerticalSplitCell : "Split Cell Vertically", //MISSING +TableDelete : "លប់តារាង", +CellProperties : "ការកំណត់សែល", +TableProperties : "ការកំណត់តារាង", +ImageProperties : "ការកំណត់រូបភាព", +FlashProperties : "ការកំណត់ Flash", + +AnchorProp : "ការកំណត់យុថ្កា", +ButtonProp : "ការកំណត់ ប៉ូតុន", +CheckboxProp : "ការកំណត់ប្រអប់ជ្រើសរើស", +HiddenFieldProp : "ការកំណត់ជួរលាក់", +RadioButtonProp : "ការកំណត់ប៉ូតុនរង្វង់", +ImageButtonProp : "ការកំណត់ប៉ូតុនរូបភាព", +TextFieldProp : "ការកំណត់ជួរអត្ថបទ", +SelectionFieldProp : "ការកំណត់ជួរជ្រើសរើស", +TextareaProp : "ការកំណត់កន្លែងសរសេរអត្ថបទ", +FormProp : "ការកំណត់បែបបទ", + +FontFormats : "Normal;Formatted;Address;Heading 1;Heading 2;Heading 3;Heading 4;Heading 5;Heading 6;Normal (DIV)", + +// Alerts and Messages +ProcessingXHTML : "កំពុងដំណើរការ XHTML ។ សូមរងចាំ...", +Done : "ចប់រួចរាល់", +PasteWordConfirm : "អត្ថបទដែលលោកអ្នកបំរុងចំលងដាក់ ហាក់បីដូចជាត្រូវចំលងមកពីកម្មវិធី​Word​។ តើលោកអ្នកចង់សំអាតមុនចំលងអត្ថបទដាក់ទេ?", +NotCompatiblePaste : "ពាក្យបញ្ជានេះប្រើបានតែជាមួយ Internet Explorer កំរិត 5.5 រឺ លើសនេះ ។ តើលោកអ្នកចង់ចំលងដាក់ដោយមិនចាំបាច់សំអាតទេ?", +UnknownToolbarItem : "វត្ថុលើរបាឧបរកណ៍ មិនស្គាល់ \"%1\"", +UnknownCommand : "ឈ្មោះពាក្យបញ្ជា មិនស្គាល់ \"%1\"", +NotImplemented : "ពាក្យបញ្ជា មិនបានអនុវត្ត", +UnknownToolbarSet : "របាឧបរកណ៍ \"%1\" ពុំមាន ។", +NoActiveX : "ការកំណត់សុវត្ថភាពរបស់កម្មវិធីរុករករបស់លោកអ្នក នេះ​អាចធ្វើអោយលោកអ្នកមិនអាចប្រើមុខងារខ្លះរបស់កម្មវិធីតាក់តែងអត្ថបទនេះ ។ លោកអ្នកត្រូវកំណត់អោយ \"ActiveX និង​កម្មវិធីជំនួយក្នុង (plug-ins)\" អោយដំណើរការ ។ លោកអ្នកអាចជួបប្រទះនឹង បញ្ហា ព្រមជាមួយនឹងការបាត់បង់មុខងារណាមួយរបស់កម្មវិធីតាក់តែងអត្ថបទនេះ ។", +BrowseServerBlocked : "The resources browser could not be opened. Make sure that all popup blockers are disabled.", //MISSING +DialogBlocked : "វីនដូវមិនអាចបើកបានទេ ។ សូមពិនិត្យចំពោះកម្មវិធីបិទ វីនដូវលោត (popup) ថាតើវាដំណើរការរឺទេ ។", + +// Dialogs +DlgBtnOK : "យល់ព្រម", +DlgBtnCancel : "មិនយល់ព្រម", +DlgBtnClose : "បិទ", +DlgBtnBrowseServer : "មើល", +DlgAdvancedTag : "កំរិតខ្ពស់", +DlgOpOther : "<ផ្សេងទៅត>", +DlgInfoTab : "ពត៌មាន", +DlgAlertUrl : "សូមសរសេរ URL", + +// General Dialogs Labels +DlgGenNotSet : "<មិនមែន>", +DlgGenId : "Id", +DlgGenLangDir : "ទិសដៅភាសា", +DlgGenLangDirLtr : "ពីឆ្វេងទៅស្តាំ(LTR)", +DlgGenLangDirRtl : "ពីស្តាំទៅឆ្វេង(RTL)", +DlgGenLangCode : "លេខកូតភាសា", +DlgGenAccessKey : "ឃី សំរាប់ចូល", +DlgGenName : "ឈ្មោះ", +DlgGenTabIndex : "លេខ Tab", +DlgGenLongDescr : "អធិប្បាយ URL វែង", +DlgGenClass : "Stylesheet Classes", +DlgGenTitle : "ចំណងជើង ប្រឹក្សា", +DlgGenContType : "ប្រភេទអត្ថបទ ប្រឹក្សា", +DlgGenLinkCharset : "លេខកូតអក្សររបស់ឈ្នាប់", +DlgGenStyle : "ម៉ូត", + +// Image Dialog +DlgImgTitle : "ការកំណត់រូបភាព", +DlgImgInfoTab : "ពត៌មានអំពីរូបភាព", +DlgImgBtnUpload : "បញ្ជូនទៅកាន់ម៉ាស៊ីនផ្តល់សេវា", +DlgImgURL : "URL", +DlgImgUpload : "ទាញយក", +DlgImgAlt : "អត្ថបទជំនួស", +DlgImgWidth : "ទទឹង", +DlgImgHeight : "កំពស់", +DlgImgLockRatio : "អត្រាឡុក", +DlgBtnResetSize : "កំណត់ទំហំឡើងវិញ", +DlgImgBorder : "ស៊ុម", +DlgImgHSpace : "គំលាតទទឹង", +DlgImgVSpace : "គំលាតបណ្តោយ", +DlgImgAlign : "កំណត់ទីតាំង", +DlgImgAlignLeft : "ខាងឆ្វង", +DlgImgAlignAbsBottom: "Abs Bottom", //MISSING +DlgImgAlignAbsMiddle: "Abs Middle", //MISSING +DlgImgAlignBaseline : "បន្ទាត់ជាមូលដ្ឋាន", +DlgImgAlignBottom : "ខាងក្រោម", +DlgImgAlignMiddle : "កណ្តាល", +DlgImgAlignRight : "ខាងស្តាំ", +DlgImgAlignTextTop : "លើអត្ថបទ", +DlgImgAlignTop : "ខាងលើ", +DlgImgPreview : "មើលសាកល្បង", +DlgImgAlertUrl : "សូមសរសេរងាស័យដ្ឋានរបស់រូបភាព", +DlgImgLinkTab : "ឈ្នាប់", + +// Flash Dialog +DlgFlashTitle : "ការកំណត់ Flash", +DlgFlashChkPlay : "លេងដោយស្វ័យប្រវត្ត", +DlgFlashChkLoop : "ចំនួនដង", +DlgFlashChkMenu : "បង្ហាញ មឺនុយរបស់ Flash", +DlgFlashScale : "ទំហំ", +DlgFlashScaleAll : "បង្ហាញទាំងអស់", +DlgFlashScaleNoBorder : "មិនបង្ហាញស៊ុម", +DlgFlashScaleFit : "ត្រូវល្មម", + +// Link Dialog +DlgLnkWindowTitle : "ឈ្នាប់", +DlgLnkInfoTab : "ពត៌មានអំពីឈ្នាប់", +DlgLnkTargetTab : "គោលដៅ", + +DlgLnkType : "ប្រភេទឈ្នាប់", +DlgLnkTypeURL : "URL", +DlgLnkTypeAnchor : "យុថ្កានៅក្នុងទំព័រនេះ", +DlgLnkTypeEMail : "អ៊ីមែល", +DlgLnkProto : "ប្រូតូកូល", +DlgLnkProtoOther : "<ផ្សេងទៀត>", +DlgLnkURL : "URL", +DlgLnkAnchorSel : "ជ្រើសរើសយុថ្កា", +DlgLnkAnchorByName : "តាមឈ្មោះរបស់យុថ្កា", +DlgLnkAnchorById : "តាម Id", +DlgLnkNoAnchors : "(No anchors available in the document)", //MISSING +DlgLnkEMail : "អ៊ីមែល", +DlgLnkEMailSubject : "ចំណងជើងអត្ថបទ", +DlgLnkEMailBody : "អត្ថបទ", +DlgLnkUpload : "ទាញយក", +DlgLnkBtnUpload : "ទាញយក", + +DlgLnkTarget : "គោលដៅ", +DlgLnkTargetFrame : "<ហ្វ្រេម>", +DlgLnkTargetPopup : "<វីនដូវ លោត>", +DlgLnkTargetBlank : "វីនដូវថ្មី (_blank)", +DlgLnkTargetParent : "វីនដូវមេ (_parent)", +DlgLnkTargetSelf : "វីនដូវដដែល (_self)", +DlgLnkTargetTop : "វីនដូវនៅលើគេ(_top)", +DlgLnkTargetFrameName : "ឈ្មោះហ្រ្វេមដែលជាគោលដៅ", +DlgLnkPopWinName : "ឈ្មោះវីនដូវលោត", +DlgLnkPopWinFeat : "លក្ខណះរបស់វីនដូលលោត", +DlgLnkPopResize : "ទំហំអាចផ្លាស់ប្តូរ", +DlgLnkPopLocation : "របា ទីតាំង", +DlgLnkPopMenu : "របា មឺនុយ", +DlgLnkPopScroll : "របា ទាញ", +DlgLnkPopStatus : "របា ពត៌មាន", +DlgLnkPopToolbar : "របា ឩបករណ៍", +DlgLnkPopFullScrn : "អេក្រុងពេញ(IE)", +DlgLnkPopDependent : "អាស្រ័យលើ (Netscape)", +DlgLnkPopWidth : "ទទឹង", +DlgLnkPopHeight : "កំពស់", +DlgLnkPopLeft : "ទីតាំងខាងឆ្វេង", +DlgLnkPopTop : "ទីតាំងខាងលើ", + +DlnLnkMsgNoUrl : "សូមសរសេរ អាស័យដ្ឋាន URL", +DlnLnkMsgNoEMail : "សូមសរសេរ អាស័យដ្ឋាន អ៊ីមែល", +DlnLnkMsgNoAnchor : "សូមជ្រើសរើស យុថ្កា", +DlnLnkMsgInvPopName : "The popup name must begin with an alphabetic character and must not contain spaces", //MISSING + +// Color Dialog +DlgColorTitle : "ជ្រើសរើស ពណ៌", +DlgColorBtnClear : "លប់", +DlgColorHighlight : "ផាត់ពណ៌", +DlgColorSelected : "បានជ្រើសរើស", + +// Smiley Dialog +DlgSmileyTitle : "បញ្ជូលរូបភាព", + +// Special Character Dialog +DlgSpecialCharTitle : "តូអក្សរពិសេស", + +// Table Dialog +DlgTableTitle : "ការកំណត់ តារាង", +DlgTableRows : "ជួរផ្តេក", +DlgTableColumns : "ជួរឈរ", +DlgTableBorder : "ទំហំស៊ុម", +DlgTableAlign : "ការកំណត់ទីតាំង", +DlgTableAlignNotSet : "<មិនកំណត់>", +DlgTableAlignLeft : "ខាងឆ្វេង", +DlgTableAlignCenter : "កណ្តាល", +DlgTableAlignRight : "ខាងស្តាំ", +DlgTableWidth : "ទទឹង", +DlgTableWidthPx : "ភីកសែល", +DlgTableWidthPc : "ភាគរយ", +DlgTableHeight : "កំពស់", +DlgTableCellSpace : "គំលាតសែល", +DlgTableCellPad : "គែមសែល", +DlgTableCaption : "ចំណងជើង", +DlgTableSummary : "សេចក្តីសង្ខេប", + +// Table Cell Dialog +DlgCellTitle : "ការកំណត់ សែល", +DlgCellWidth : "ទទឹង", +DlgCellWidthPx : "ភីកសែល", +DlgCellWidthPc : "ភាគរយ", +DlgCellHeight : "កំពស់", +DlgCellWordWrap : "បង្ហាញអត្ថបទទាំងអស់", +DlgCellWordWrapNotSet : "<មិនកំណត់>", +DlgCellWordWrapYes : "បាទ(ចា)", +DlgCellWordWrapNo : "ទេ", +DlgCellHorAlign : "តំរឹមផ្តេក", +DlgCellHorAlignNotSet : "<មិនកំណត់>", +DlgCellHorAlignLeft : "ខាងឆ្វេង", +DlgCellHorAlignCenter : "កណ្តាល", +DlgCellHorAlignRight: "Right", //MISSING +DlgCellVerAlign : "តំរឹមឈរ", +DlgCellVerAlignNotSet : "<មិនកណត់>", +DlgCellVerAlignTop : "ខាងលើ", +DlgCellVerAlignMiddle : "កណ្តាល", +DlgCellVerAlignBottom : "ខាងក្រោម", +DlgCellVerAlignBaseline : "បន្ទាត់ជាមូលដ្ឋាន", +DlgCellRowSpan : "បញ្ជូលជួរផ្តេក", +DlgCellCollSpan : "បញ្ជូលជួរឈរ", +DlgCellBackColor : "ពណ៌ផ្នែកខាងក្រោម", +DlgCellBorderColor : "ពណ៌ស៊ុម", +DlgCellBtnSelect : "ជ្រើសរើស...", + +// Find and Replace Dialog +DlgFindAndReplaceTitle : "Find and Replace", //MISSING + +// Find Dialog +DlgFindTitle : "ស្វែងរក", +DlgFindFindBtn : "ស្វែងរក", +DlgFindNotFoundMsg : "ពាក្យនេះ រកមិនឃើញទេ ។", + +// Replace Dialog +DlgReplaceTitle : "ជំនួស", +DlgReplaceFindLbl : "ស្វែងរកអ្វី:", +DlgReplaceReplaceLbl : "ជំនួសជាមួយ:", +DlgReplaceCaseChk : "ករណ៉ត្រូវរក", +DlgReplaceReplaceBtn : "ជំនួស", +DlgReplaceReplAllBtn : "ជំនួសទាំងអស់", +DlgReplaceWordChk : "ត្រូវពាក្យទាំងអស់", + +// Paste Operations / Dialog +PasteErrorCut : "ការកំណត់សុវត្ថភាពរបស់កម្មវិធីរុករករបស់លោកអ្នក នេះ​មិនអាចធ្វើកម្មវិធីតាក់តែងអត្ថបទ កាត់អត្ថបទយកដោយស្វ័យប្រវត្តបានឡើយ ។ សូមប្រើប្រាស់បន្សំ ឃីដូចនេះ (Ctrl+X) ។", +PasteErrorCopy : "ការកំណត់សុវត្ថភាពរបស់កម្មវិធីរុករករបស់លោកអ្នក នេះ​មិនអាចធ្វើកម្មវិធីតាក់តែងអត្ថបទ ចំលងអត្ថបទយកដោយស្វ័យប្រវត្តបានឡើយ ។ សូមប្រើប្រាស់បន្សំ ឃីដូចនេះ (Ctrl+C)។", + +PasteAsText : "ចំលងដាក់អត្ថបទធម្មតា", +PasteFromWord : "ចំលងពាក្យពីកម្មវិធី Word", + +DlgPasteMsg2 : "សូមចំលងអត្ថបទទៅដាក់ក្នុងប្រអប់ដូចខាងក្រោមដោយប្រើប្រាស់ ឃី ​(Ctrl+V) ហើយចុច OK ។", +DlgPasteSec : "Because of your browser security settings, the editor is not able to access your clipboard data directly. You are required to paste it again in this window.", //MISSING +DlgPasteIgnoreFont : "មិនគិតអំពីប្រភេទពុម្ភអក្សរ", +DlgPasteRemoveStyles : "លប់ម៉ូត", +DlgPasteCleanBox : "លប់អត្ថបទចេញពីប្រអប់", + +// Color Picker +ColorAutomatic : "ស្វ័យប្រវត្ត", +ColorMoreColors : "ពណ៌ផ្សេងទៀត..", + +// Document Properties +DocProps : "ការកំណត់ ឯកសារ", + +// Anchor Dialog +DlgAnchorTitle : "ការកំណត់ចំណងជើងយុទ្ធថ្កា", +DlgAnchorName : "ឈ្មោះយុទ្ធថ្កា", +DlgAnchorErrorName : "សូមសរសេរ ឈ្មោះយុទ្ធថ្កា", + +// Speller Pages Dialog +DlgSpellNotInDic : "គ្មានក្នុងវចនានុក្រម", +DlgSpellChangeTo : "ផ្លាស់ប្តូរទៅ", +DlgSpellBtnIgnore : "មិនផ្លាស់ប្តូរ", +DlgSpellBtnIgnoreAll : "មិនផ្លាស់ប្តូរ ទាំងអស់", +DlgSpellBtnReplace : "ជំនួស", +DlgSpellBtnReplaceAll : "ជំនួសទាំងអស់", +DlgSpellBtnUndo : "សារឡើងវិញ", +DlgSpellNoSuggestions : "- គ្មានសំណើរ -", +DlgSpellProgress : "កំពុងពិនិត្យអក្ខរាវិរុទ្ធ...", +DlgSpellNoMispell : "ការពិនិត្យអក្ខរាវិរុទ្ធបានចប់: គ្មានកំហុស", +DlgSpellNoChanges : "ការពិនិត្យអក្ខរាវិរុទ្ធបានចប់: ពុំមានផ្លាស់ប្តូរ", +DlgSpellOneChange : "ការពិនិត្យអក្ខរាវិរុទ្ធបានចប់: ពាក្យមួយត្រូចបានផ្លាស់ប្តូរ", +DlgSpellManyChanges : "ការពិនិត្យអក្ខរាវិរុទ្ធបានចប់: %1 ពាក្យបានផ្លាស់ប្តូរ", + +IeSpellDownload : "ពុំមានកម្មវិធីពិនិត្យអក្ខរាវិរុទ្ធ ។ តើចង់ទាញយកពីណា?", + +// Button Dialog +DlgButtonText : "អត្ថបទ(តំលៃ)", +DlgButtonType : "ប្រភេទ", +DlgButtonTypeBtn : "Button", //MISSING +DlgButtonTypeSbm : "Submit", //MISSING +DlgButtonTypeRst : "Reset", //MISSING + +// Checkbox and Radio Button Dialogs +DlgCheckboxName : "ឈ្មោះ", +DlgCheckboxValue : "តំលៃ", +DlgCheckboxSelected : "បានជ្រើសរើស", + +// Form Dialog +DlgFormName : "ឈ្មោះ", +DlgFormAction : "សកម្មភាព", +DlgFormMethod : "វិធី", + +// Select Field Dialog +DlgSelectName : "ឈ្មោះ", +DlgSelectValue : "តំលៃ", +DlgSelectSize : "ទំហំ", +DlgSelectLines : "បន្ទាត់", +DlgSelectChkMulti : "អនុញ្ញាតអោយជ្រើសរើសច្រើន", +DlgSelectOpAvail : "ការកំណត់ជ្រើសរើស ដែលអាចកំណត់បាន", +DlgSelectOpText : "ពាក្យ", +DlgSelectOpValue : "តំលៃ", +DlgSelectBtnAdd : "បន្ថែម", +DlgSelectBtnModify : "ផ្លាស់ប្តូរ", +DlgSelectBtnUp : "លើ", +DlgSelectBtnDown : "ក្រោម", +DlgSelectBtnSetValue : "Set as selected value", //MISSING +DlgSelectBtnDelete : "លប់", + +// Textarea Dialog +DlgTextareaName : "ឈ្មោះ", +DlgTextareaCols : "ជូរឈរ", +DlgTextareaRows : "ជូរផ្តេក", + +// Text Field Dialog +DlgTextName : "ឈ្មោះ", +DlgTextValue : "តំលៃ", +DlgTextCharWidth : "ទទឹង អក្សរ", +DlgTextMaxChars : "អក្សរអតិបរិមា", +DlgTextType : "ប្រភេទ", +DlgTextTypeText : "ពាក្យ", +DlgTextTypePass : "ពាក្យសំងាត់", + +// Hidden Field Dialog +DlgHiddenName : "ឈ្មោះ", +DlgHiddenValue : "តំលៃ", + +// Bulleted List Dialog +BulletedListProp : "កំណត់បញ្ជីរង្វង់", +NumberedListProp : "កំណត់បញ្េជីលេខ", +DlgLstStart : "Start", //MISSING +DlgLstType : "ប្រភេទ", +DlgLstTypeCircle : "រង្វង់", +DlgLstTypeDisc : "Disc", +DlgLstTypeSquare : "ការេ", +DlgLstTypeNumbers : "លេខ(1, 2, 3)", +DlgLstTypeLCase : "អក្សរតូច(a, b, c)", +DlgLstTypeUCase : "អក្សរធំ(A, B, C)", +DlgLstTypeSRoman : "អក្សរឡាតាំងតូច(i, ii, iii)", +DlgLstTypeLRoman : "អក្សរឡាតាំងធំ(I, II, III)", + +// Document Properties Dialog +DlgDocGeneralTab : "ទូទៅ", +DlgDocBackTab : "ផ្នែកខាងក្រោយ", +DlgDocColorsTab : "ទំព័រ​និង ស៊ុម", +DlgDocMetaTab : "ទិន្នន័យមេ", + +DlgDocPageTitle : "ចំណងជើងទំព័រ", +DlgDocLangDir : "ទិសដៅសរសេរភាសា", +DlgDocLangDirLTR : "ពីឆ្វេងទៅស្ដាំ(LTR)", +DlgDocLangDirRTL : "ពីស្ដាំទៅឆ្វេង(RTL)", +DlgDocLangCode : "លេខកូតភាសា", +DlgDocCharSet : "កំណត់លេខកូតភាសា", +DlgDocCharSetCE : "Central European", //MISSING +DlgDocCharSetCT : "Chinese Traditional (Big5)", //MISSING +DlgDocCharSetCR : "Cyrillic", //MISSING +DlgDocCharSetGR : "Greek", //MISSING +DlgDocCharSetJP : "Japanese", //MISSING +DlgDocCharSetKR : "Korean", //MISSING +DlgDocCharSetTR : "Turkish", //MISSING +DlgDocCharSetUN : "Unicode (UTF-8)", //MISSING +DlgDocCharSetWE : "Western European", //MISSING +DlgDocCharSetOther : "កំណត់លេខកូតភាសាផ្សេងទៀត", + +DlgDocDocType : "ប្រភេទក្បាលទំព័រ", +DlgDocDocTypeOther : "ប្រភេទក្បាលទំព័រផ្សេងទៀត", +DlgDocIncXHTML : "បញ្ជូល XHTML", +DlgDocBgColor : "ពណ៌ខាងក្រោម", +DlgDocBgImage : "URL របស់រូបភាពខាងក្រោម", +DlgDocBgNoScroll : "ទំព័រក្រោមមិនប្តូរ", +DlgDocCText : "អត្តបទ", +DlgDocCLink : "ឈ្នាប់", +DlgDocCVisited : "ឈ្នាប់មើលហើយ", +DlgDocCActive : "ឈ្នាប់កំពុងមើល", +DlgDocMargins : "ស៊ុមទំព័រ", +DlgDocMaTop : "លើ", +DlgDocMaLeft : "ឆ្វេង", +DlgDocMaRight : "ស្ដាំ", +DlgDocMaBottom : "ក្រោម", +DlgDocMeIndex : "ពាក្យនៅក្នុងឯកសារ (ផ្តាច់ពីគ្នាដោយក្បៀស)", +DlgDocMeDescr : "សេចក្តីអត្ថាធិប្បាយអំពីឯកសារ", +DlgDocMeAuthor : "អ្នកនិពន្ធ", +DlgDocMeCopy : "រក្សាសិទ្ធិ៏", +DlgDocPreview : "មើលសាកល្បង", + +// Templates Dialog +Templates : "ឯកសារគំរូ", +DlgTemplatesTitle : "ឯកសារគំរូ របស់អត្ថន័យ", +DlgTemplatesSelMsg : "សូមជ្រើសរើសឯកសារគំរូ ដើម្បីបើកនៅក្នុងកម្មវិធីតាក់តែងអត្ថបទ
    (អត្ថបទនឹងបាត់បង់):", +DlgTemplatesLoading : "កំពុងអានបញ្ជីឯកសារគំរូ ។ សូមរងចាំ...", +DlgTemplatesNoTpl : "(ពុំមានឯកសារគំរូត្រូវបានកំណត់)", +DlgTemplatesReplace : "Replace actual contents", //MISSING + +// About Dialog +DlgAboutAboutTab : "អំពី", +DlgAboutBrowserInfoTab : "ព៌តមានកម្មវិធីរុករក", +DlgAboutLicenseTab : "License", //MISSING +DlgAboutVersion : "ជំនាន់", +DlgAboutInfo : "សំរាប់ព៌តមានផ្សេងទៀត សូមទាក់ទង" +}; diff --git a/FCKeditor/editor/lang/ko.js b/FCKeditor/editor/lang/ko.js new file mode 100644 index 0000000..1c80c3e --- /dev/null +++ b/FCKeditor/editor/lang/ko.js @@ -0,0 +1,516 @@ +/* + * FCKeditor - The text editor for Internet - http://www.fckeditor.net + * Copyright (C) 2003-2007 Frederico Caldeira Knabben + * + * == BEGIN LICENSE == + * + * Licensed under the terms of any of the following licenses at your + * choice: + * + * - GNU General Public License Version 2 or later (the "GPL") + * http://www.gnu.org/licenses/gpl.html + * + * - GNU Lesser General Public License Version 2.1 or later (the "LGPL") + * http://www.gnu.org/licenses/lgpl.html + * + * - Mozilla Public License Version 1.1 or later (the "MPL") + * http://www.mozilla.org/MPL/MPL-1.1.html + * + * == END LICENSE == + * + * Korean language file. + */ + +var FCKLang = +{ +// Language direction : "ltr" (left to right) or "rtl" (right to left). +Dir : "ltr", + +ToolbarCollapse : "툴바 감추기", +ToolbarExpand : "툴바 보이기", + +// Toolbar Items and Context Menu +Save : "저장하기", +NewPage : "새 문서", +Preview : "미리보기", +Cut : "잘라내기", +Copy : "복사하기", +Paste : "붙여넣기", +PasteText : "텍스트로 붙여넣기", +PasteWord : "MS Word 형식에서 붙여넣기", +Print : "인쇄하기", +SelectAll : "전체선택", +RemoveFormat : "포맷 지우기", +InsertLinkLbl : "링크", +InsertLink : "링크 삽입/변경", +RemoveLink : "링크 삭제", +Anchor : "책갈피 삽입/변경", +AnchorDelete : "Remove Anchor", //MISSING +InsertImageLbl : "이미지", +InsertImage : "이미지 삽입/변경", +InsertFlashLbl : "플래쉬", +InsertFlash : "플래쉬 삽입/변경", +InsertTableLbl : "표", +InsertTable : "표 삽입/변경", +InsertLineLbl : "수평선", +InsertLine : "수평선 삽입", +InsertSpecialCharLbl: "특수문자 삽입", +InsertSpecialChar : "특수문자 삽입", +InsertSmileyLbl : "아이콘", +InsertSmiley : "아이콘 삽입", +About : "FCKeditor에 대하여", +Bold : "진하게", +Italic : "이텔릭", +Underline : "밑줄", +StrikeThrough : "취소선", +Subscript : "아래 첨자", +Superscript : "위 첨자", +LeftJustify : "왼쪽 정렬", +CenterJustify : "가운데 정렬", +RightJustify : "오른쪽 정렬", +BlockJustify : "양쪽 맞춤", +DecreaseIndent : "내어쓰기", +IncreaseIndent : "들여쓰기", +Blockquote : "Blockquote", //MISSING +Undo : "취소", +Redo : "재실행", +NumberedListLbl : "순서있는 목록", +NumberedList : "순서있는 목록", +BulletedListLbl : "순서없는 목록", +BulletedList : "순서없는 목록", +ShowTableBorders : "표 테두리 보기", +ShowDetails : "문서기호 보기", +Style : "스타일", +FontFormat : "포맷", +Font : "폰트", +FontSize : "글자 크기", +TextColor : "글자 색상", +BGColor : "배경 색상", +Source : "소스", +Find : "찾기", +Replace : "바꾸기", +SpellCheck : "철자검사", +UniversalKeyboard : "다국어 입력기", +PageBreakLbl : "Page Break", //MISSING +PageBreak : "Insert Page Break", //MISSING + +Form : "폼", +Checkbox : "체크박스", +RadioButton : "라디오버튼", +TextField : "입력필드", +Textarea : "입력영역", +HiddenField : "숨김필드", +Button : "버튼", +SelectionField : "펼침목록", +ImageButton : "이미지버튼", + +FitWindow : "Maximize the editor size", //MISSING +ShowBlocks : "Show Blocks", //MISSING + +// Context Menu +EditLink : "링크 수정", +CellCM : "Cell", //MISSING +RowCM : "Row", //MISSING +ColumnCM : "Column", //MISSING +InsertRowAfter : "Insert Row After", //MISSING +InsertRowBefore : "Insert Row Before", //MISSING +DeleteRows : "가로줄 삭제", +InsertColumnAfter : "Insert Column After", //MISSING +InsertColumnBefore : "Insert Column Before", //MISSING +DeleteColumns : "세로줄 삭제", +InsertCellAfter : "Insert Cell After", //MISSING +InsertCellBefore : "Insert Cell Before", //MISSING +DeleteCells : "셀 삭제", +MergeCells : "셀 합치기", +MergeRight : "Merge Right", //MISSING +MergeDown : "Merge Down", //MISSING +HorizontalSplitCell : "Split Cell Horizontally", //MISSING +VerticalSplitCell : "Split Cell Vertically", //MISSING +TableDelete : "Delete Table", //MISSING +CellProperties : "셀 속성", +TableProperties : "표 속성", +ImageProperties : "이미지 속성", +FlashProperties : "플래쉬 속성", + +AnchorProp : "책갈피 속성", +ButtonProp : "버튼 속성", +CheckboxProp : "체크박스 속성", +HiddenFieldProp : "숨김필드 속성", +RadioButtonProp : "라디오버튼 속성", +ImageButtonProp : "이미지버튼 속성", +TextFieldProp : "입력필드 속성", +SelectionFieldProp : "펼침목록 속성", +TextareaProp : "입력영역 속성", +FormProp : "폼 속성", + +FontFormats : "Normal;Formatted;Address;Heading 1;Heading 2;Heading 3;Heading 4;Heading 5;Heading 6", + +// Alerts and Messages +ProcessingXHTML : "XHTML 처리중. 잠시만 기다려주십시요.", +Done : "완료", +PasteWordConfirm : "붙여넣기 할 텍스트는 MS Word에서 복사한 것입니다. 붙여넣기 전에 MS Word 포멧을 삭제하시겠습니까?", +NotCompatiblePaste : "이 명령은 인터넷익스플로러 5.5 버전 이상에서만 작동합니다. 포멧을 삭제하지 않고 붙여넣기 하시겠습니까?", +UnknownToolbarItem : "알수없는 툴바입니다. : \"%1\"", +UnknownCommand : "알수없는 기능입니다. : \"%1\"", +NotImplemented : "기능이 실행되지 않았습니다.", +UnknownToolbarSet : "툴바 설정이 없습니다. : \"%1\"", +NoActiveX : "Your browser's security settings could limit some features of the editor. You must enable the option \"Run ActiveX controls and plug-ins\". You may experience errors and notice missing features.", //MISSING +BrowseServerBlocked : "The resources browser could not be opened. Make sure that all popup blockers are disabled.", //MISSING +DialogBlocked : "It was not possible to open the dialog window. Make sure all popup blockers are disabled.", //MISSING + +// Dialogs +DlgBtnOK : "예", +DlgBtnCancel : "아니오", +DlgBtnClose : "닫기", +DlgBtnBrowseServer : "서버 보기", +DlgAdvancedTag : "자세히", +DlgOpOther : "<기타>", +DlgInfoTab : "정보", +DlgAlertUrl : "URL을 입력하십시요", + +// General Dialogs Labels +DlgGenNotSet : "<설정되지 않음>", +DlgGenId : "ID", +DlgGenLangDir : "쓰기 방향", +DlgGenLangDirLtr : "왼쪽에서 오른쪽 (LTR)", +DlgGenLangDirRtl : "오른쪽에서 왼쪽 (RTL)", +DlgGenLangCode : "언어 코드", +DlgGenAccessKey : "엑세스 키", +DlgGenName : "Name", +DlgGenTabIndex : "탭 순서", +DlgGenLongDescr : "URL 설명", +DlgGenClass : "Stylesheet Classes", +DlgGenTitle : "Advisory Title", +DlgGenContType : "Advisory Content Type", +DlgGenLinkCharset : "Linked Resource Charset", +DlgGenStyle : "Style", + +// Image Dialog +DlgImgTitle : "이미지 설정", +DlgImgInfoTab : "이미지 정보", +DlgImgBtnUpload : "서버로 전송", +DlgImgURL : "URL", +DlgImgUpload : "업로드", +DlgImgAlt : "이미지 설명", +DlgImgWidth : "너비", +DlgImgHeight : "높이", +DlgImgLockRatio : "비율 유지", +DlgBtnResetSize : "원래 크기로", +DlgImgBorder : "테두리", +DlgImgHSpace : "수평여백", +DlgImgVSpace : "수직여백", +DlgImgAlign : "정렬", +DlgImgAlignLeft : "왼쪽", +DlgImgAlignAbsBottom: "줄아래(Abs Bottom)", +DlgImgAlignAbsMiddle: "줄중간(Abs Middle)", +DlgImgAlignBaseline : "기준선", +DlgImgAlignBottom : "아래", +DlgImgAlignMiddle : "중간", +DlgImgAlignRight : "오른쪽", +DlgImgAlignTextTop : "글자위(Text Top)", +DlgImgAlignTop : "위", +DlgImgPreview : "미리보기", +DlgImgAlertUrl : "이미지 URL을 입력하십시요", +DlgImgLinkTab : "링크", + +// Flash Dialog +DlgFlashTitle : "플래쉬 등록정보", +DlgFlashChkPlay : "자동재생", +DlgFlashChkLoop : "반복", +DlgFlashChkMenu : "플래쉬메뉴 가능", +DlgFlashScale : "영역", +DlgFlashScaleAll : "모두보기", +DlgFlashScaleNoBorder : "경계선없음", +DlgFlashScaleFit : "영역자동조절", + +// Link Dialog +DlgLnkWindowTitle : "링크", +DlgLnkInfoTab : "링크 정보", +DlgLnkTargetTab : "타겟", + +DlgLnkType : "링크 종류", +DlgLnkTypeURL : "URL", +DlgLnkTypeAnchor : "책갈피", +DlgLnkTypeEMail : "이메일", +DlgLnkProto : "프로토콜", +DlgLnkProtoOther : "<기타>", +DlgLnkURL : "URL", +DlgLnkAnchorSel : "책갈피 선택", +DlgLnkAnchorByName : "책갈피 이름", +DlgLnkAnchorById : "책갈피 ID", +DlgLnkNoAnchors : "(문서에 책갈피가 없습니다.)", +DlgLnkEMail : "이메일 주소", +DlgLnkEMailSubject : "제목", +DlgLnkEMailBody : "내용", +DlgLnkUpload : "업로드", +DlgLnkBtnUpload : "서버로 전송", + +DlgLnkTarget : "타겟", +DlgLnkTargetFrame : "<프레임>", +DlgLnkTargetPopup : "<팝업창>", +DlgLnkTargetBlank : "새 창 (_blank)", +DlgLnkTargetParent : "부모 창 (_parent)", +DlgLnkTargetSelf : "현재 창 (_self)", +DlgLnkTargetTop : "최 상위 창 (_top)", +DlgLnkTargetFrameName : "타겟 프레임 이름", +DlgLnkPopWinName : "팝업창 이름", +DlgLnkPopWinFeat : "팝업창 설정", +DlgLnkPopResize : "크기조정", +DlgLnkPopLocation : "주소표시줄", +DlgLnkPopMenu : "메뉴바", +DlgLnkPopScroll : "스크롤바", +DlgLnkPopStatus : "상태바", +DlgLnkPopToolbar : "툴바", +DlgLnkPopFullScrn : "전체화면 (IE)", +DlgLnkPopDependent : "Dependent (Netscape)", +DlgLnkPopWidth : "너비", +DlgLnkPopHeight : "높이", +DlgLnkPopLeft : "왼쪽 위치", +DlgLnkPopTop : "윗쪽 위치", + +DlnLnkMsgNoUrl : "링크 URL을 입력하십시요.", +DlnLnkMsgNoEMail : "이메일주소를 입력하십시요.", +DlnLnkMsgNoAnchor : "책갈피명을 입력하십시요.", +DlnLnkMsgInvPopName : "The popup name must begin with an alphabetic character and must not contain spaces", //MISSING + +// Color Dialog +DlgColorTitle : "색상 선택", +DlgColorBtnClear : "지우기", +DlgColorHighlight : "현재", +DlgColorSelected : "선택됨", + +// Smiley Dialog +DlgSmileyTitle : "아이콘 삽입", + +// Special Character Dialog +DlgSpecialCharTitle : "특수문자 선택", + +// Table Dialog +DlgTableTitle : "표 설정", +DlgTableRows : "가로줄", +DlgTableColumns : "세로줄", +DlgTableBorder : "테두리 크기", +DlgTableAlign : "정렬", +DlgTableAlignNotSet : "<설정되지 않음>", +DlgTableAlignLeft : "왼쪽", +DlgTableAlignCenter : "가운데", +DlgTableAlignRight : "오른쪽", +DlgTableWidth : "너비", +DlgTableWidthPx : "픽셀", +DlgTableWidthPc : "퍼센트", +DlgTableHeight : "높이", +DlgTableCellSpace : "셀 간격", +DlgTableCellPad : "셀 여백", +DlgTableCaption : "캡션", +DlgTableSummary : "Summary", //MISSING + +// Table Cell Dialog +DlgCellTitle : "셀 설정", +DlgCellWidth : "너비", +DlgCellWidthPx : "픽셀", +DlgCellWidthPc : "퍼센트", +DlgCellHeight : "높이", +DlgCellWordWrap : "워드랩", +DlgCellWordWrapNotSet : "<설정되지 않음>", +DlgCellWordWrapYes : "예", +DlgCellWordWrapNo : "아니오", +DlgCellHorAlign : "수평 정렬", +DlgCellHorAlignNotSet : "<설정되지 않음>", +DlgCellHorAlignLeft : "왼쪽", +DlgCellHorAlignCenter : "가운데", +DlgCellHorAlignRight: "오른쪽", +DlgCellVerAlign : "수직 정렬", +DlgCellVerAlignNotSet : "<설정되지 않음>", +DlgCellVerAlignTop : "위", +DlgCellVerAlignMiddle : "중간", +DlgCellVerAlignBottom : "아래", +DlgCellVerAlignBaseline : "기준선", +DlgCellRowSpan : "세로 합치기", +DlgCellCollSpan : "가로 합치기", +DlgCellBackColor : "배경 색상", +DlgCellBorderColor : "테두리 색상", +DlgCellBtnSelect : "선택", + +// Find and Replace Dialog +DlgFindAndReplaceTitle : "Find and Replace", //MISSING + +// Find Dialog +DlgFindTitle : "찾기", +DlgFindFindBtn : "찾기", +DlgFindNotFoundMsg : "문자열을 찾을 수 없습니다.", + +// Replace Dialog +DlgReplaceTitle : "바꾸기", +DlgReplaceFindLbl : "찾을 문자열:", +DlgReplaceReplaceLbl : "바꿀 문자열:", +DlgReplaceCaseChk : "대소문자 구분", +DlgReplaceReplaceBtn : "바꾸기", +DlgReplaceReplAllBtn : "모두 바꾸기", +DlgReplaceWordChk : "온전한 단어", + +// Paste Operations / Dialog +PasteErrorCut : "브라우저의 보안설정때문에 잘라내기 기능을 실행할 수 없습니다. 키보드 명령을 사용하십시요. (Ctrl+X).", +PasteErrorCopy : "브라우저의 보안설정때문에 복사하기 기능을 실행할 수 없습니다. 키보드 명령을 사용하십시요. (Ctrl+C).", + +PasteAsText : "텍스트로 붙여넣기", +PasteFromWord : "MS Word 형식에서 붙여넣기", + +DlgPasteMsg2 : "키보드의 (Ctrl+V) 를 이용해서 상자안에 붙여넣고 OK 를 누르세요.", +DlgPasteSec : "Because of your browser security settings, the editor is not able to access your clipboard data directly. You are required to paste it again in this window.", //MISSING +DlgPasteIgnoreFont : "폰트 설정 무시", +DlgPasteRemoveStyles : "스타일 정의 제거", +DlgPasteCleanBox : "글상자 제거", + +// Color Picker +ColorAutomatic : "기본색상", +ColorMoreColors : "색상선택...", + +// Document Properties +DocProps : "문서 속성", + +// Anchor Dialog +DlgAnchorTitle : "책갈피 속성", +DlgAnchorName : "책갈피 이름", +DlgAnchorErrorName : "책갈피 이름을 입력하십시요.", + +// Speller Pages Dialog +DlgSpellNotInDic : "사전에 없는 단어", +DlgSpellChangeTo : "변경할 단어", +DlgSpellBtnIgnore : "건너뜀", +DlgSpellBtnIgnoreAll : "모두 건너뜀", +DlgSpellBtnReplace : "변경", +DlgSpellBtnReplaceAll : "모두 변경", +DlgSpellBtnUndo : "취소", +DlgSpellNoSuggestions : "- 추천단어 없음 -", +DlgSpellProgress : "철자검사를 진행중입니다...", +DlgSpellNoMispell : "철자검사 완료: 잘못된 철자가 없습니다.", +DlgSpellNoChanges : "철자검사 완료: 변경된 단어가 없습니다.", +DlgSpellOneChange : "철자검사 완료: 단어가 변경되었습니다.", +DlgSpellManyChanges : "철자검사 완료: %1 단어가 변경되었습니다.", + +IeSpellDownload : "철자 검사기가 철치되지 않았습니다. 지금 다운로드하시겠습니까?", + +// Button Dialog +DlgButtonText : "버튼글자(값)", +DlgButtonType : "버튼종류", +DlgButtonTypeBtn : "Button", //MISSING +DlgButtonTypeSbm : "Submit", //MISSING +DlgButtonTypeRst : "Reset", //MISSING + +// Checkbox and Radio Button Dialogs +DlgCheckboxName : "이름", +DlgCheckboxValue : "값", +DlgCheckboxSelected : "선택됨", + +// Form Dialog +DlgFormName : "폼이름", +DlgFormAction : "실행경로(Action)", +DlgFormMethod : "방법(Method)", + +// Select Field Dialog +DlgSelectName : "이름", +DlgSelectValue : "값", +DlgSelectSize : "세로크기", +DlgSelectLines : "줄", +DlgSelectChkMulti : "여러항목 선택 허용", +DlgSelectOpAvail : "선택옵션", +DlgSelectOpText : "이름", +DlgSelectOpValue : "값", +DlgSelectBtnAdd : "추가", +DlgSelectBtnModify : "변경", +DlgSelectBtnUp : "위로", +DlgSelectBtnDown : "아래로", +DlgSelectBtnSetValue : "선택된것으로 설정", +DlgSelectBtnDelete : "삭제", + +// Textarea Dialog +DlgTextareaName : "이름", +DlgTextareaCols : "칸수", +DlgTextareaRows : "줄수", + +// Text Field Dialog +DlgTextName : "이름", +DlgTextValue : "값", +DlgTextCharWidth : "글자 너비", +DlgTextMaxChars : "최대 글자수", +DlgTextType : "종류", +DlgTextTypeText : "문자열", +DlgTextTypePass : "비밀번호", + +// Hidden Field Dialog +DlgHiddenName : "이름", +DlgHiddenValue : "값", + +// Bulleted List Dialog +BulletedListProp : "순서없는 목록 속성", +NumberedListProp : "순서있는 목록 속성", +DlgLstStart : "Start", //MISSING +DlgLstType : "종류", +DlgLstTypeCircle : "원(Circle)", +DlgLstTypeDisc : "Disc", //MISSING +DlgLstTypeSquare : "네모점(Square)", +DlgLstTypeNumbers : "번호 (1, 2, 3)", +DlgLstTypeLCase : "소문자 (a, b, c)", +DlgLstTypeUCase : "대문자 (A, B, C)", +DlgLstTypeSRoman : "로마자 수문자 (i, ii, iii)", +DlgLstTypeLRoman : "로마자 대문자 (I, II, III)", + +// Document Properties Dialog +DlgDocGeneralTab : "일반", +DlgDocBackTab : "배경", +DlgDocColorsTab : "색상 및 여백", +DlgDocMetaTab : "메타데이터", + +DlgDocPageTitle : "페이지명", +DlgDocLangDir : "문자 쓰기방향", +DlgDocLangDirLTR : "왼쪽에서 오른쪽 (LTR)", +DlgDocLangDirRTL : "오른쪽에서 왼쪽 (RTL)", +DlgDocLangCode : "언어코드", +DlgDocCharSet : "캐릭터셋 인코딩", +DlgDocCharSetCE : "Central European", //MISSING +DlgDocCharSetCT : "Chinese Traditional (Big5)", //MISSING +DlgDocCharSetCR : "Cyrillic", //MISSING +DlgDocCharSetGR : "Greek", //MISSING +DlgDocCharSetJP : "Japanese", //MISSING +DlgDocCharSetKR : "Korean", //MISSING +DlgDocCharSetTR : "Turkish", //MISSING +DlgDocCharSetUN : "Unicode (UTF-8)", //MISSING +DlgDocCharSetWE : "Western European", //MISSING +DlgDocCharSetOther : "다른 캐릭터셋 인코딩", + +DlgDocDocType : "문서 헤드", +DlgDocDocTypeOther : "다른 문서헤드", +DlgDocIncXHTML : "XHTML 문서정의 포함", +DlgDocBgColor : "배경색상", +DlgDocBgImage : "배경이미지 URL", +DlgDocBgNoScroll : "스크롤되지않는 배경", +DlgDocCText : "텍스트", +DlgDocCLink : "링크", +DlgDocCVisited : "방문한 링크(Visited)", +DlgDocCActive : "활성화된 링크(Active)", +DlgDocMargins : "페이지 여백", +DlgDocMaTop : "위", +DlgDocMaLeft : "왼쪽", +DlgDocMaRight : "오른쪽", +DlgDocMaBottom : "아래", +DlgDocMeIndex : "문서 키워드 (콤마로 구분)", +DlgDocMeDescr : "문서 설명", +DlgDocMeAuthor : "작성자", +DlgDocMeCopy : "저작권", +DlgDocPreview : "미리보기", + +// Templates Dialog +Templates : "템플릿", +DlgTemplatesTitle : "내용 템플릿", +DlgTemplatesSelMsg : "에디터에서 사용할 템플릿을 선택하십시요.
    (지금까지 작성된 내용은 사라집니다.):", +DlgTemplatesLoading : "템플릿 목록을 불러오는중입니다. 잠시만 기다려주십시요.", +DlgTemplatesNoTpl : "(템플릿이 없습니다.)", +DlgTemplatesReplace : "Replace actual contents", //MISSING + +// About Dialog +DlgAboutAboutTab : "About", +DlgAboutBrowserInfoTab : "브라우저 정보", +DlgAboutLicenseTab : "License", //MISSING +DlgAboutVersion : "버전", +DlgAboutInfo : "For further information go to" +}; diff --git a/FCKeditor/editor/lang/lt.js b/FCKeditor/editor/lang/lt.js new file mode 100644 index 0000000..a36be35 --- /dev/null +++ b/FCKeditor/editor/lang/lt.js @@ -0,0 +1,516 @@ +/* + * FCKeditor - The text editor for Internet - http://www.fckeditor.net + * Copyright (C) 2003-2007 Frederico Caldeira Knabben + * + * == BEGIN LICENSE == + * + * Licensed under the terms of any of the following licenses at your + * choice: + * + * - GNU General Public License Version 2 or later (the "GPL") + * http://www.gnu.org/licenses/gpl.html + * + * - GNU Lesser General Public License Version 2.1 or later (the "LGPL") + * http://www.gnu.org/licenses/lgpl.html + * + * - Mozilla Public License Version 1.1 or later (the "MPL") + * http://www.mozilla.org/MPL/MPL-1.1.html + * + * == END LICENSE == + * + * Lithuanian language file. + */ + +var FCKLang = +{ +// Language direction : "ltr" (left to right) or "rtl" (right to left). +Dir : "ltr", + +ToolbarCollapse : "Sutraukti mygtukų juostą", +ToolbarExpand : "Išplėsti mygtukų juostą", + +// Toolbar Items and Context Menu +Save : "Išsaugoti", +NewPage : "Naujas puslapis", +Preview : "Peržiūra", +Cut : "Iškirpti", +Copy : "Kopijuoti", +Paste : "Įdėti", +PasteText : "Įdėti kaip gryną tekstą", +PasteWord : "Įdėti iš Word", +Print : "Spausdinti", +SelectAll : "Pažymėti viską", +RemoveFormat : "Panaikinti formatą", +InsertLinkLbl : "Nuoroda", +InsertLink : "Įterpti/taisyti nuorodą", +RemoveLink : "Panaikinti nuorodą", +Anchor : "Įterpti/modifikuoti žymę", +AnchorDelete : "Remove Anchor", //MISSING +InsertImageLbl : "Vaizdas", +InsertImage : "Įterpti/taisyti vaizdą", +InsertFlashLbl : "Flash", +InsertFlash : "Įterpti/taisyti Flash", +InsertTableLbl : "Lentelė", +InsertTable : "Įterpti/taisyti lentelę", +InsertLineLbl : "Linija", +InsertLine : "Įterpti horizontalią liniją", +InsertSpecialCharLbl: "Spec. simbolis", +InsertSpecialChar : "Įterpti specialų simbolį", +InsertSmileyLbl : "Veideliai", +InsertSmiley : "Įterpti veidelį", +About : "Apie FCKeditor", +Bold : "Pusjuodis", +Italic : "Kursyvas", +Underline : "Pabrauktas", +StrikeThrough : "Perbrauktas", +Subscript : "Apatinis indeksas", +Superscript : "Viršutinis indeksas", +LeftJustify : "Lygiuoti kairę", +CenterJustify : "Centruoti", +RightJustify : "Lygiuoti dešinę", +BlockJustify : "Lygiuoti abi puses", +DecreaseIndent : "Sumažinti įtrauką", +IncreaseIndent : "Padidinti įtrauką", +Blockquote : "Blockquote", //MISSING +Undo : "Atšaukti", +Redo : "Atstatyti", +NumberedListLbl : "Numeruotas sąrašas", +NumberedList : "Įterpti/Panaikinti numeruotą sąrašą", +BulletedListLbl : "Suženklintas sąrašas", +BulletedList : "Įterpti/Panaikinti suženklintą sąrašą", +ShowTableBorders : "Rodyti lentelės rėmus", +ShowDetails : "Rodyti detales", +Style : "Stilius", +FontFormat : "Šrifto formatas", +Font : "Šriftas", +FontSize : "Šrifto dydis", +TextColor : "Teksto spalva", +BGColor : "Fono spalva", +Source : "Šaltinis", +Find : "Rasti", +Replace : "Pakeisti", +SpellCheck : "Rašybos tikrinimas", +UniversalKeyboard : "Universali klaviatūra", +PageBreakLbl : "Puslapių skirtukas", +PageBreak : "Įterpti puslapių skirtuką", + +Form : "Forma", +Checkbox : "Žymimasis langelis", +RadioButton : "Žymimoji akutė", +TextField : "Teksto laukas", +Textarea : "Teksto sritis", +HiddenField : "Nerodomas laukas", +Button : "Mygtukas", +SelectionField : "Atrankos laukas", +ImageButton : "Vaizdinis mygtukas", + +FitWindow : "Maximize the editor size", //MISSING +ShowBlocks : "Show Blocks", //MISSING + +// Context Menu +EditLink : "Taisyti nuorodą", +CellCM : "Cell", //MISSING +RowCM : "Row", //MISSING +ColumnCM : "Column", //MISSING +InsertRowAfter : "Insert Row After", //MISSING +InsertRowBefore : "Insert Row Before", //MISSING +DeleteRows : "Šalinti eilutes", +InsertColumnAfter : "Insert Column After", //MISSING +InsertColumnBefore : "Insert Column Before", //MISSING +DeleteColumns : "Šalinti stulpelius", +InsertCellAfter : "Insert Cell After", //MISSING +InsertCellBefore : "Insert Cell Before", //MISSING +DeleteCells : "Šalinti langelius", +MergeCells : "Sujungti langelius", +MergeRight : "Merge Right", //MISSING +MergeDown : "Merge Down", //MISSING +HorizontalSplitCell : "Split Cell Horizontally", //MISSING +VerticalSplitCell : "Split Cell Vertically", //MISSING +TableDelete : "Šalinti lentelę", +CellProperties : "Langelio savybės", +TableProperties : "Lentelės savybės", +ImageProperties : "Vaizdo savybės", +FlashProperties : "Flash savybės", + +AnchorProp : "Žymės savybės", +ButtonProp : "Mygtuko savybės", +CheckboxProp : "Žymimojo langelio savybės", +HiddenFieldProp : "Nerodomo lauko savybės", +RadioButtonProp : "Žymimosios akutės savybės", +ImageButtonProp : "Vaizdinio mygtuko savybės", +TextFieldProp : "Teksto lauko savybės", +SelectionFieldProp : "Atrankos lauko savybės", +TextareaProp : "Teksto srities savybės", +FormProp : "Formos savybės", + +FontFormats : "Normalus;Formuotas;Kreipinio;Antraštinis 1;Antraštinis 2;Antraštinis 3;Antraštinis 4;Antraštinis 5;Antraštinis 6", + +// Alerts and Messages +ProcessingXHTML : "Apdorojamas XHTML. Prašome palaukti...", +Done : "Baigta", +PasteWordConfirm : "Įdedamas tekstas yra panašus į kopiją iš Word. Ar Jūs norite prieš įdėjimą išvalyti jį?", +NotCompatiblePaste : "Ši komanda yra prieinama tik per Internet Explorer 5.5 ar aukštesnę versiją. Ar Jūs norite įterpti be valymo?", +UnknownToolbarItem : "Nežinomas mygtukų juosta elementas \"%1\"", +UnknownCommand : "Nežinomas komandos vardas \"%1\"", +NotImplemented : "Komanda nėra įgyvendinta", +UnknownToolbarSet : "Mygtukų juostos rinkinys \"%1\" neegzistuoja", +NoActiveX : "Jūsų naršyklės saugumo nuostatos gali riboti kai kurias redaktoriaus savybes. Jūs turite aktyvuoti opciją \"Run ActiveX controls and plug-ins\". Kitu atveju Jums bus pranešama apie klaidas ir trūkstamas savybes.", +BrowseServerBlocked : "Neįmanoma atidaryti naujo naršyklės lango. Įsitikinkite, kad iškylančių langų blokavimo programos neveiksnios.", +DialogBlocked : "Neįmanoma atidaryti dialogo lango. Įsitikinkite, kad iškylančių langų blokavimo programos neveiksnios.", + +// Dialogs +DlgBtnOK : "OK", +DlgBtnCancel : "Nutraukti", +DlgBtnClose : "Uždaryti", +DlgBtnBrowseServer : "Naršyti po serverį", +DlgAdvancedTag : "Papildomas", +DlgOpOther : "", +DlgInfoTab : "Informacija", +DlgAlertUrl : "Prašome įrašyti URL", + +// General Dialogs Labels +DlgGenNotSet : "", +DlgGenId : "Id", +DlgGenLangDir : "Teksto kryptis", +DlgGenLangDirLtr : "Iš kairės į dešinę (LTR)", +DlgGenLangDirRtl : "Iš dešinės į kairę (RTL)", +DlgGenLangCode : "Kalbos kodas", +DlgGenAccessKey : "Prieigos raktas", +DlgGenName : "Vardas", +DlgGenTabIndex : "Tabuliavimo indeksas", +DlgGenLongDescr : "Ilgas aprašymas URL", +DlgGenClass : "Stilių lentelės klasės", +DlgGenTitle : "Konsultacinė antraštė", +DlgGenContType : "Konsultacinio turinio tipas", +DlgGenLinkCharset : "Susietų išteklių simbolių lentelė", +DlgGenStyle : "Stilius", + +// Image Dialog +DlgImgTitle : "Vaizdo savybės", +DlgImgInfoTab : "Vaizdo informacija", +DlgImgBtnUpload : "Siųsti į serverį", +DlgImgURL : "URL", +DlgImgUpload : "Nusiųsti", +DlgImgAlt : "Alternatyvus Tekstas", +DlgImgWidth : "Plotis", +DlgImgHeight : "Aukštis", +DlgImgLockRatio : "Išlaikyti proporciją", +DlgBtnResetSize : "Atstatyti dydį", +DlgImgBorder : "Rėmelis", +DlgImgHSpace : "Hor.Erdvė", +DlgImgVSpace : "Vert.Erdvė", +DlgImgAlign : "Lygiuoti", +DlgImgAlignLeft : "Kairę", +DlgImgAlignAbsBottom: "Absoliučią apačią", +DlgImgAlignAbsMiddle: "Absoliutų vidurį", +DlgImgAlignBaseline : "Apatinę liniją", +DlgImgAlignBottom : "Apačią", +DlgImgAlignMiddle : "Vidurį", +DlgImgAlignRight : "Dešinę", +DlgImgAlignTextTop : "Teksto viršūnę", +DlgImgAlignTop : "Viršūnę", +DlgImgPreview : "Peržiūra", +DlgImgAlertUrl : "Prašome įvesti vaizdo URL", +DlgImgLinkTab : "Nuoroda", + +// Flash Dialog +DlgFlashTitle : "Flash savybės", +DlgFlashChkPlay : "Automatinis paleidimas", +DlgFlashChkLoop : "Ciklas", +DlgFlashChkMenu : "Leisti Flash meniu", +DlgFlashScale : "Mastelis", +DlgFlashScaleAll : "Rodyti visą", +DlgFlashScaleNoBorder : "Be rėmelio", +DlgFlashScaleFit : "Tikslus atitikimas", + +// Link Dialog +DlgLnkWindowTitle : "Nuoroda", +DlgLnkInfoTab : "Nuorodos informacija", +DlgLnkTargetTab : "Paskirtis", + +DlgLnkType : "Nuorodos tipas", +DlgLnkTypeURL : "URL", +DlgLnkTypeAnchor : "Žymė šiame puslapyje", +DlgLnkTypeEMail : "El.paštas", +DlgLnkProto : "Protokolas", +DlgLnkProtoOther : "", +DlgLnkURL : "URL", +DlgLnkAnchorSel : "Pasirinkite žymę", +DlgLnkAnchorByName : "Pagal žymės vardą", +DlgLnkAnchorById : "Pagal žymės Id", +DlgLnkNoAnchors : "(Šiame dokumente žymių nėra)", +DlgLnkEMail : "El.pašto adresas", +DlgLnkEMailSubject : "Žinutės tema", +DlgLnkEMailBody : "Žinutės turinys", +DlgLnkUpload : "Siųsti", +DlgLnkBtnUpload : "Siųsti į serverį", + +DlgLnkTarget : "Paskirties vieta", +DlgLnkTargetFrame : "", +DlgLnkTargetPopup : "", +DlgLnkTargetBlank : "Naujas langas (_blank)", +DlgLnkTargetParent : "Pirminis langas (_parent)", +DlgLnkTargetSelf : "Tas pats langas (_self)", +DlgLnkTargetTop : "Svarbiausias langas (_top)", +DlgLnkTargetFrameName : "Paskirties kadro vardas", +DlgLnkPopWinName : "Paskirties lango vardas", +DlgLnkPopWinFeat : "Išskleidžiamo lango savybės", +DlgLnkPopResize : "Keičiamas dydis", +DlgLnkPopLocation : "Adreso juosta", +DlgLnkPopMenu : "Meniu juosta", +DlgLnkPopScroll : "Slinkties juostos", +DlgLnkPopStatus : "Būsenos juosta", +DlgLnkPopToolbar : "Mygtukų juosta", +DlgLnkPopFullScrn : "Visas ekranas (IE)", +DlgLnkPopDependent : "Priklausomas (Netscape)", +DlgLnkPopWidth : "Plotis", +DlgLnkPopHeight : "Aukštis", +DlgLnkPopLeft : "Kairė pozicija", +DlgLnkPopTop : "Viršutinė pozicija", + +DlnLnkMsgNoUrl : "Prašome įvesti nuorodos URL", +DlnLnkMsgNoEMail : "Prašome įvesti el.pašto adresą", +DlnLnkMsgNoAnchor : "Prašome pasirinkti žymę", +DlnLnkMsgInvPopName : "The popup name must begin with an alphabetic character and must not contain spaces", //MISSING + +// Color Dialog +DlgColorTitle : "Pasirinkite spalvą", +DlgColorBtnClear : "Trinti", +DlgColorHighlight : "Paryškinta", +DlgColorSelected : "Pažymėta", + +// Smiley Dialog +DlgSmileyTitle : "Įterpti veidelį", + +// Special Character Dialog +DlgSpecialCharTitle : "Pasirinkite specialų simbolį", + +// Table Dialog +DlgTableTitle : "Lentelės savybės", +DlgTableRows : "Eilutės", +DlgTableColumns : "Stulpeliai", +DlgTableBorder : "Rėmelio dydis", +DlgTableAlign : "Lygiuoti", +DlgTableAlignNotSet : "", +DlgTableAlignLeft : "Kairę", +DlgTableAlignCenter : "Centrą", +DlgTableAlignRight : "Dešinę", +DlgTableWidth : "Plotis", +DlgTableWidthPx : "taškais", +DlgTableWidthPc : "procentais", +DlgTableHeight : "Aukštis", +DlgTableCellSpace : "Tarpas tarp langelių", +DlgTableCellPad : "Trapas nuo langelio rėmo iki teksto", +DlgTableCaption : "Antraštė", +DlgTableSummary : "Santrauka", + +// Table Cell Dialog +DlgCellTitle : "Langelio savybės", +DlgCellWidth : "Plotis", +DlgCellWidthPx : "taškais", +DlgCellWidthPc : "procentais", +DlgCellHeight : "Aukštis", +DlgCellWordWrap : "Teksto laužymas", +DlgCellWordWrapNotSet : "", +DlgCellWordWrapYes : "Taip", +DlgCellWordWrapNo : "Ne", +DlgCellHorAlign : "Horizontaliai lygiuoti", +DlgCellHorAlignNotSet : "", +DlgCellHorAlignLeft : "Kairę", +DlgCellHorAlignCenter : "Centrą", +DlgCellHorAlignRight: "Dešinę", +DlgCellVerAlign : "Vertikaliai lygiuoti", +DlgCellVerAlignNotSet : "", +DlgCellVerAlignTop : "Viršų", +DlgCellVerAlignMiddle : "Vidurį", +DlgCellVerAlignBottom : "Apačią", +DlgCellVerAlignBaseline : "Apatinę liniją", +DlgCellRowSpan : "Eilučių apjungimas", +DlgCellCollSpan : "Stulpelių apjungimas", +DlgCellBackColor : "Fono spalva", +DlgCellBorderColor : "Rėmelio spalva", +DlgCellBtnSelect : "Pažymėti...", + +// Find and Replace Dialog +DlgFindAndReplaceTitle : "Find and Replace", //MISSING + +// Find Dialog +DlgFindTitle : "Paieška", +DlgFindFindBtn : "Surasti", +DlgFindNotFoundMsg : "Nurodytas tekstas nerastas.", + +// Replace Dialog +DlgReplaceTitle : "Pakeisti", +DlgReplaceFindLbl : "Surasti tekstą:", +DlgReplaceReplaceLbl : "Pakeisti tekstu:", +DlgReplaceCaseChk : "Skirti didžiąsias ir mažąsias raides", +DlgReplaceReplaceBtn : "Pakeisti", +DlgReplaceReplAllBtn : "Pakeisti viską", +DlgReplaceWordChk : "Atitikti pilną žodį", + +// Paste Operations / Dialog +PasteErrorCut : "Jūsų naršyklės saugumo nustatymai neleidžia redaktoriui automatiškai įvykdyti iškirpimo operacijų. Tam prašome naudoti klaviatūrą (Ctrl+X).", +PasteErrorCopy : "Jūsų naršyklės saugumo nustatymai neleidžia redaktoriui automatiškai įvykdyti kopijavimo operacijų. Tam prašome naudoti klaviatūrą (Ctrl+C).", + +PasteAsText : "Įdėti kaip gryną tekstą", +PasteFromWord : "Įdėti iš Word", + +DlgPasteMsg2 : "Žemiau esančiame įvedimo lauke įdėkite tekstą, naudodami klaviatūrą (Ctrl+V) ir spūstelkite mygtuką OK.", +DlgPasteSec : "Because of your browser security settings, the editor is not able to access your clipboard data directly. You are required to paste it again in this window.", //MISSING +DlgPasteIgnoreFont : "Ignoruoti šriftų nustatymus", +DlgPasteRemoveStyles : "Pašalinti stilių nustatymus", +DlgPasteCleanBox : "Trinti įvedimo lauką", + +// Color Picker +ColorAutomatic : "Automatinis", +ColorMoreColors : "Daugiau spalvų...", + +// Document Properties +DocProps : "Dokumento savybės", + +// Anchor Dialog +DlgAnchorTitle : "Žymės savybės", +DlgAnchorName : "Žymės vardas", +DlgAnchorErrorName : "Prašome įvesti žymės vardą", + +// Speller Pages Dialog +DlgSpellNotInDic : "Žodyne nerastas", +DlgSpellChangeTo : "Pakeisti į", +DlgSpellBtnIgnore : "Ignoruoti", +DlgSpellBtnIgnoreAll : "Ignoruoti visus", +DlgSpellBtnReplace : "Pakeisti", +DlgSpellBtnReplaceAll : "Pakeisti visus", +DlgSpellBtnUndo : "Atšaukti", +DlgSpellNoSuggestions : "- Nėra pasiūlymų -", +DlgSpellProgress : "Vyksta rašybos tikrinimas...", +DlgSpellNoMispell : "Rašybos tikrinimas baigtas: Nerasta rašybos klaidų", +DlgSpellNoChanges : "Rašybos tikrinimas baigtas: Nėra pakeistų žodžių", +DlgSpellOneChange : "Rašybos tikrinimas baigtas: Vienas žodis pakeistas", +DlgSpellManyChanges : "Rašybos tikrinimas baigtas: Pakeista %1 žodžių", + +IeSpellDownload : "Rašybos tikrinimas neinstaliuotas. Ar Jūs norite jį dabar atsisiųsti?", + +// Button Dialog +DlgButtonText : "Tekstas (Reikšmė)", +DlgButtonType : "Tipas", +DlgButtonTypeBtn : "Button", //MISSING +DlgButtonTypeSbm : "Submit", //MISSING +DlgButtonTypeRst : "Reset", //MISSING + +// Checkbox and Radio Button Dialogs +DlgCheckboxName : "Vardas", +DlgCheckboxValue : "Reikšmė", +DlgCheckboxSelected : "Pažymėtas", + +// Form Dialog +DlgFormName : "Vardas", +DlgFormAction : "Veiksmas", +DlgFormMethod : "Metodas", + +// Select Field Dialog +DlgSelectName : "Vardas", +DlgSelectValue : "Reikšmė", +DlgSelectSize : "Dydis", +DlgSelectLines : "eilučių", +DlgSelectChkMulti : "Leisti daugeriopą atranką", +DlgSelectOpAvail : "Galimos parinktys", +DlgSelectOpText : "Tekstas", +DlgSelectOpValue : "Reikšmė", +DlgSelectBtnAdd : "Įtraukti", +DlgSelectBtnModify : "Modifikuoti", +DlgSelectBtnUp : "Aukštyn", +DlgSelectBtnDown : "Žemyn", +DlgSelectBtnSetValue : "Laikyti pažymėta reikšme", +DlgSelectBtnDelete : "Trinti", + +// Textarea Dialog +DlgTextareaName : "Vardas", +DlgTextareaCols : "Ilgis", +DlgTextareaRows : "Plotis", + +// Text Field Dialog +DlgTextName : "Vardas", +DlgTextValue : "Reikšmė", +DlgTextCharWidth : "Ilgis simboliais", +DlgTextMaxChars : "Maksimalus simbolių skaičius", +DlgTextType : "Tipas", +DlgTextTypeText : "Tekstas", +DlgTextTypePass : "Slaptažodis", + +// Hidden Field Dialog +DlgHiddenName : "Vardas", +DlgHiddenValue : "Reikšmė", + +// Bulleted List Dialog +BulletedListProp : "Suženklinto sąrašo savybės", +NumberedListProp : "Numeruoto sąrašo savybės", +DlgLstStart : "Start", //MISSING +DlgLstType : "Tipas", +DlgLstTypeCircle : "Apskritimas", +DlgLstTypeDisc : "Diskas", +DlgLstTypeSquare : "Kvadratas", +DlgLstTypeNumbers : "Skaičiai (1, 2, 3)", +DlgLstTypeLCase : "Mažosios raidės (a, b, c)", +DlgLstTypeUCase : "Didžiosios raidės (A, B, C)", +DlgLstTypeSRoman : "Romėnų mažieji skaičiai (i, ii, iii)", +DlgLstTypeLRoman : "Romėnų didieji skaičiai (I, II, III)", + +// Document Properties Dialog +DlgDocGeneralTab : "Bendros savybės", +DlgDocBackTab : "Fonas", +DlgDocColorsTab : "Spalvos ir kraštinės", +DlgDocMetaTab : "Meta duomenys", + +DlgDocPageTitle : "Puslapio antraštė", +DlgDocLangDir : "Kalbos kryptis", +DlgDocLangDirLTR : "Iš kairės į dešinę (LTR)", +DlgDocLangDirRTL : "Iš dešinės į kairę (RTL)", +DlgDocLangCode : "Kalbos kodas", +DlgDocCharSet : "Simbolių kodavimo lentelė", +DlgDocCharSetCE : "Central European", //MISSING +DlgDocCharSetCT : "Chinese Traditional (Big5)", //MISSING +DlgDocCharSetCR : "Cyrillic", //MISSING +DlgDocCharSetGR : "Greek", //MISSING +DlgDocCharSetJP : "Japanese", //MISSING +DlgDocCharSetKR : "Korean", //MISSING +DlgDocCharSetTR : "Turkish", //MISSING +DlgDocCharSetUN : "Unicode (UTF-8)", //MISSING +DlgDocCharSetWE : "Western European", //MISSING +DlgDocCharSetOther : "Kita simbolių kodavimo lentelė", + +DlgDocDocType : "Dokumento tipo antraštė", +DlgDocDocTypeOther : "Kita dokumento tipo antraštė", +DlgDocIncXHTML : "Įtraukti XHTML deklaracijas", +DlgDocBgColor : "Fono spalva", +DlgDocBgImage : "Fono paveikslėlio nuoroda (URL)", +DlgDocBgNoScroll : "Neslenkantis fonas", +DlgDocCText : "Tekstas", +DlgDocCLink : "Nuoroda", +DlgDocCVisited : "Aplankyta nuoroda", +DlgDocCActive : "Aktyvi nuoroda", +DlgDocMargins : "Puslapio kraštinės", +DlgDocMaTop : "Viršuje", +DlgDocMaLeft : "Kairėje", +DlgDocMaRight : "Dešinėje", +DlgDocMaBottom : "Apačioje", +DlgDocMeIndex : "Dokumento indeksavimo raktiniai žodžiai (atskirti kableliais)", +DlgDocMeDescr : "Dokumento apibūdinimas", +DlgDocMeAuthor : "Autorius", +DlgDocMeCopy : "Autorinės teisės", +DlgDocPreview : "Peržiūra", + +// Templates Dialog +Templates : "Šablonai", +DlgTemplatesTitle : "Turinio šablonai", +DlgTemplatesSelMsg : "Pasirinkite norimą šabloną
    (Dėmesio! esamas turinys bus prarastas):", +DlgTemplatesLoading : "Įkeliamas šablonų sąrašas. Prašome palaukti...", +DlgTemplatesNoTpl : "(Šablonų sąrašas tuščias)", +DlgTemplatesReplace : "Replace actual contents", //MISSING + +// About Dialog +DlgAboutAboutTab : "Apie", +DlgAboutBrowserInfoTab : "Naršyklės informacija", +DlgAboutLicenseTab : "License", //MISSING +DlgAboutVersion : "versija", +DlgAboutInfo : "Papildomą informaciją galima gauti" +}; diff --git a/FCKeditor/editor/lang/lv.js b/FCKeditor/editor/lang/lv.js new file mode 100644 index 0000000..1197d8f --- /dev/null +++ b/FCKeditor/editor/lang/lv.js @@ -0,0 +1,516 @@ +/* + * FCKeditor - The text editor for Internet - http://www.fckeditor.net + * Copyright (C) 2003-2007 Frederico Caldeira Knabben + * + * == BEGIN LICENSE == + * + * Licensed under the terms of any of the following licenses at your + * choice: + * + * - GNU General Public License Version 2 or later (the "GPL") + * http://www.gnu.org/licenses/gpl.html + * + * - GNU Lesser General Public License Version 2.1 or later (the "LGPL") + * http://www.gnu.org/licenses/lgpl.html + * + * - Mozilla Public License Version 1.1 or later (the "MPL") + * http://www.mozilla.org/MPL/MPL-1.1.html + * + * == END LICENSE == + * + * Latvian language file. + */ + +var FCKLang = +{ +// Language direction : "ltr" (left to right) or "rtl" (right to left). +Dir : "ltr", + +ToolbarCollapse : "Samazināt rīku joslu", +ToolbarExpand : "Paplašināt rīku joslu", + +// Toolbar Items and Context Menu +Save : "Saglabāt", +NewPage : "Jauna lapa", +Preview : "Pārskatīt", +Cut : "Izgriezt", +Copy : "Kopēt", +Paste : "Ievietot", +PasteText : "Ievietot kā vienkāršu tekstu", +PasteWord : "Ievietot no Worda", +Print : "Drukāt", +SelectAll : "Iezīmēt visu", +RemoveFormat : "Noņemt stilus", +InsertLinkLbl : "Hipersaite", +InsertLink : "Ievietot/Labot hipersaiti", +RemoveLink : "Noņemt hipersaiti", +Anchor : "Ievietot/Labot iezīmi", +AnchorDelete : "Remove Anchor", //MISSING +InsertImageLbl : "Attēls", +InsertImage : "Ievietot/Labot Attēlu", +InsertFlashLbl : "Flash", +InsertFlash : "Ievietot/Labot Flash", +InsertTableLbl : "Tabula", +InsertTable : "Ievietot/Labot Tabulu", +InsertLineLbl : "Atdalītājsvītra", +InsertLine : "Ievietot horizontālu Atdalītājsvītru", +InsertSpecialCharLbl: "Īpašs simbols", +InsertSpecialChar : "Ievietot speciālo simbolu", +InsertSmileyLbl : "Smaidiņi", +InsertSmiley : "Ievietot smaidiņu", +About : "Īsumā par FCKeditor", +Bold : "Treknu šriftu", +Italic : "Slīprakstā", +Underline : "Apakšsvītra", +StrikeThrough : "Pārsvītrots", +Subscript : "Zemrakstā", +Superscript : "Augšrakstā", +LeftJustify : "Izlīdzināt pa kreisi", +CenterJustify : "Izlīdzināt pret centru", +RightJustify : "Izlīdzināt pa labi", +BlockJustify : "Izlīdzināt malas", +DecreaseIndent : "Samazināt atkāpi", +IncreaseIndent : "Palielināt atkāpi", +Blockquote : "Blockquote", //MISSING +Undo : "Atcelt", +Redo : "Atkārtot", +NumberedListLbl : "Numurēts saraksts", +NumberedList : "Ievietot/Noņemt numerēto sarakstu", +BulletedListLbl : "Izcelts saraksts", +BulletedList : "Ievietot/Noņemt izceltu sarakstu", +ShowTableBorders : "Parādīt tabulas robežas", +ShowDetails : "Parādīt sīkāku informāciju", +Style : "Stils", +FontFormat : "Formāts", +Font : "Šrifts", +FontSize : "Izmērs", +TextColor : "Teksta krāsa", +BGColor : "Fona krāsa", +Source : "HTML kods", +Find : "Meklēt", +Replace : "Nomainīt", +SpellCheck : "Pareizrakstības pārbaude", +UniversalKeyboard : "Universāla klaviatūra", +PageBreakLbl : "Lapas pārtraukums", +PageBreak : "Ievietot lapas pārtraukumu", + +Form : "Forma", +Checkbox : "Atzīmēšanas kastīte", +RadioButton : "Izvēles poga", +TextField : "Teksta rinda", +Textarea : "Teksta laukums", +HiddenField : "Paslēpta teksta rinda", +Button : "Poga", +SelectionField : "Iezīmēšanas lauks", +ImageButton : "Attēlpoga", + +FitWindow : "Maksimizēt redaktora izmēru", +ShowBlocks : "Show Blocks", //MISSING + +// Context Menu +EditLink : "Labot hipersaiti", +CellCM : "Šūna", +RowCM : "Rinda", +ColumnCM : "Kolonna", +InsertRowAfter : "Insert Row After", //MISSING +InsertRowBefore : "Insert Row Before", //MISSING +DeleteRows : "Dzēst rindas", +InsertColumnAfter : "Insert Column After", //MISSING +InsertColumnBefore : "Insert Column Before", //MISSING +DeleteColumns : "Dzēst kolonnas", +InsertCellAfter : "Insert Cell After", //MISSING +InsertCellBefore : "Insert Cell Before", //MISSING +DeleteCells : "Dzēst rūtiņas", +MergeCells : "Apvienot rūtiņas", +MergeRight : "Merge Right", //MISSING +MergeDown : "Merge Down", //MISSING +HorizontalSplitCell : "Split Cell Horizontally", //MISSING +VerticalSplitCell : "Split Cell Vertically", //MISSING +TableDelete : "Dzēst tabulu", +CellProperties : "Rūtiņas īpašības", +TableProperties : "Tabulas īpašības", +ImageProperties : "Attēla īpašības", +FlashProperties : "Flash īpašības", + +AnchorProp : "Iezīmes īpašības", +ButtonProp : "Pogas īpašības", +CheckboxProp : "Atzīmēšanas kastītes īpašības", +HiddenFieldProp : "Paslēptās teksta rindas īpašības", +RadioButtonProp : "Izvēles poga īpašības", +ImageButtonProp : "Attēlpogas īpašības", +TextFieldProp : "Teksta rindas īpašības", +SelectionFieldProp : "Iezīmēšanas lauka īpašības", +TextareaProp : "Teksta laukuma īpašības", +FormProp : "Formas īpašības", + +FontFormats : "Normāls teksts;Formatēts teksts;Adrese;Virsraksts 1;Virsraksts 2;Virsraksts 3;Virsraksts 4;Virsraksts 5;Virsraksts 6;Rindkopa (DIV)", + +// Alerts and Messages +ProcessingXHTML : "Tiek apstrādāts XHTML. Lūdzu uzgaidiet...", +Done : "Darīts", +PasteWordConfirm : "Teksta fragments, kas tiek ievietots, izskatās, ka būtu sagatavots Word'ā. Vai vēlaties to apstrādāt pirms ievietošanas?", +NotCompatiblePaste : "Šī darbība ir pieejama Internet Explorer'ī, kas jaunāks par 5.5 versiju. Vai vēlaties ievietot bez apstrādes?", +UnknownToolbarItem : "Nezināms rīku joslas objekts \"%1\"", +UnknownCommand : "Nezināmas darbības nosaukums \"%1\"", +NotImplemented : "Darbība netika paveikta", +UnknownToolbarSet : "Rīku joslas komplekts \"%1\" neeksistē", +NoActiveX : "Interneta pārlūkprogrammas drošības uzstādījumi varētu ietekmēt dažas no redaktora īpašībām. Jābūt aktivizētai sadaļai \"Run ActiveX controls and plug-ins\". Savādāk ir iespējamas kļūdas darbībā un kļūdu paziņojumu parādīšanās.", +BrowseServerBlocked : "Resursu pārlūks nevar tikt atvērts. Pārliecinieties, ka uznirstošo logu bloķētāji ir atslēgti.", +DialogBlocked : "Nav iespējams atvērt dialoglogu. Pārliecinieties, ka uznirstošo logu bloķētāji ir atslēgti.", + +// Dialogs +DlgBtnOK : "Darīts!", +DlgBtnCancel : "Atcelt", +DlgBtnClose : "Aizvērt", +DlgBtnBrowseServer : "Skatīt servera saturu", +DlgAdvancedTag : "Izvērstais", +DlgOpOther : "", +DlgInfoTab : "Informācija", +DlgAlertUrl : "Lūdzu, ievietojiet hipersaiti", + +// General Dialogs Labels +DlgGenNotSet : "